home *** CD-ROM | disk | FTP | other *** search
/ Stone Design / Stone Design.iso / Stone_Friends / Wave / WavesWorld / Source / IBPalettes / WWTCLKit / WWTCLClosedCmd.m < prev    next >
Encoding:
Text File  |  1995-03-22  |  2.1 KB  |  79 lines

  1. /* Copyright 1993 Michael B. Johnson
  2.  * Permission to use, copy, modify, and distribute this
  3.  * software and its documentation for any non-commercial 
  4.  * purpose and without fee is hereby granted, provided that the 
  5.  * above copyright notice appears in all copies.  Michael B. Johnson
  6.  * makes no representations about the suitability of this
  7.  * software for any purpose.  It is provided "as is" without
  8.  * express or implied warranty.
  9.  *
  10.  * Permission to use, copy, modify or distribute this software
  11.  * and its documentation for any commercial purpose must be
  12.  * confirmed in writing with Michael B. Johnson.  He can be
  13.  * contacted at:
  14.  *              20 Ames St. E15-023G    
  15.  *              Cambridge, MA 02141
  16.  *              (617) 547 0563
  17.  *              
  18.  */
  19.  
  20.  
  21. #import "WWTCLClosedCmd.h"
  22. #import "WWTCLVarTrace.h"
  23.  
  24. @implementation WWTCLClosedCmd
  25.  
  26. - initWithInterp:newInterp;
  27. {
  28.    [super init];
  29.    interp = newInterp;
  30.    varTraceList = [[List alloc] init];
  31.    closedCmd = NULL;
  32.    originalCmd = NULL;
  33.    return self;
  34. }
  35.  
  36. - free
  37. {
  38.    // when the var traces get free'ed, they remove themselves from the interp
  39.    //NXLogError("%s %d being free'ed\n", [[self class] name], self);
  40.    [[varTraceList freeObjects] free];
  41.    if (originalCmd) {  free(originalCmd); }
  42.    if (closedCmd) {  free(closedCmd); }
  43.  
  44.    return [super free];
  45. }
  46.  
  47. - setOriginalExpression:(const char *)newExpression
  48. {  
  49.    if (originalCmd) { free(originalCmd); }
  50.    originalCmd = NXCopyStringBuffer(newExpression);
  51.    [self setClosedCmd:originalCmd];
  52.  
  53.    return self;
  54. }
  55.  
  56. - setClosedCmd:(const char *)newClosedCmd
  57. {
  58.    if (closedCmd) {  free(closedCmd); }
  59.    closedCmd = NXCopyStringBuffer(newClosedCmd);
  60.    return self;
  61. }
  62.  
  63. - (const char *)cmd  {  return (const char *)closedCmd; }
  64.  
  65. - addTraceFor:(const char *)argName calling:(Tcl_VarTraceProc *)writeProc using:(ClientData)clientData
  66. {
  67.   WWTCLVarTrace *newTrace = [[WWTCLVarTrace alloc] initWithVarName:argName proc:writeProc datum:clientData delegate:self interp:interp];
  68.  
  69.  
  70.   [varTraceList addObject:newTrace];
  71.   return self;
  72. }
  73.  
  74. - (List *)tracedVars
  75. {
  76.     return varTraceList;
  77. }
  78. @end
  79.