#import "EvalString.h"
#import <strings.h>
#import <stdlib.h>

@implementation EvalString: Object
{ const char *string ;
}


+ new: (const char *) aString ;
{ self = [super alloc] ;
  return [self init: aString] ;
}


- (const char *) cString ;
{ // returns pointer to the internal c string
  return string ;
}

- free ;
{ free((char *) string) ;
  return [super free] ;
}

- init: (const char *) aString
{ int len ;
  [super init] ;
  len = strlen(aString) + 1 ;
  string = (char *) malloc(len) ;
  strncpy((char *) string,aString,len) ;
  return self ;

}


- (char *) partialFree ;
{ // returns pointer to internal
  // c string and frees self.  The
  // memory used by the c string is not
  // freed: it becomes the caller's responsibility
  // to free it (via free())
  const char *s = string ;
  [super free] ;
  return (char *) s ;
}

@end
 