#import <collections.h>

#define __USE_FIXED_PROTOTYPES__   // for gcc headers
#include <stdio.h>

int main( void )
{
  id s1, s2, s3, t1, FooBarString, s4;

  initModule( collections );

  s1 = [String create: scratchZone setC: "abcdef"];
  printf( "string is: %s\n", [s1 getC] );
  [s1 setC: "foo"];
  printf( "string is: %s\n", [s1 getC] );
  [s1 appendC: "bar"];
  printf( "string is: %s\n", [s1 getC] );
  [s1 drop];

  s2 = [String create: scratchZone];
  [s2 setC: ""];
  printf( "string is: %s\n", [s2 getC] );
  [s2 appendC: "foo"];
  printf( "string is: %s\n", [s2 getC] );
  [s2 drop];

  s3 = [String create: scratchZone];
  printf( "string is: %s\n", [s3 getC] );
  [s3 appendC: "foo"];
  printf( "string is: %s\n", [s3 getC] );
  s4 = [s3 perform: @selector( copy: ) with: scratchZone];
  [s4 appendC: "FOO"];
  printf( "string is: %s\n", [s4 getC] );

  t1 = [String customizeBegin: scratchZone];
  [t1 setC: "foobar"];
  FooBarString = [t1 customizeEnd];
  printf( "FooBarString id is: %0#8x\n", (unsigned int)FooBarString );

  s4 = [FooBarString create: scratchZone];
  printf( "string is: %s  id is: %0#8x\n", [s4 getC], (unsigned int)s4 );
  [s4 appendC: "foo"];
  printf( "string is: %s\n", [s4 getC] );

  s1 = [OutputStream create: scratchZone setFileStream: _obj_xdebug];
  [s1 appendC: "output string\n"];
  [s1 drop];

  s1 = [OutputStream createBegin: scratchZone];
  [s1 setFileStream: _obj_xdebug];
  s1 = [s1 createEnd];
  [s1 appendC: "output string\n"];
  [s1 drop];

  return 0;
}
