Use libobjects' Coder instead of GNU TypedStream. Comment out

BinaryTree testing.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@458 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Andrew McCallum 1995-06-28 23:51:10 +00:00
parent dc1ac779d1
commit 53061f082f

View file

@ -1,25 +1,35 @@
#include <objects/objects.h>
#include <objects/BinaryCoder.h>
void test(id objects)
{
TypedStream *stream;
Coder *coder;
id read_objects;
[objects addElementsCount:6, ((elt)0),((elt)1),((elt)5),((elt)3),
((elt)4),((elt)2)];
printf("written ");
[objects printForDebugger];
stream = objc_open_typed_stream_for_file("test08.data", OBJC_WRITEONLY);
objc_write_root_object(stream, objects);
objc_close_typed_stream(stream);
coder = [[BinaryCoder alloc]
initEncodingOnStream: [[StdioStream alloc]
initWithFilename:"test08.data"
fmode: "w"]];
[coder encodeObject:objects
withName:""];
[coder release];
[objects release];
stream = objc_open_typed_stream_for_file("test08.data", OBJC_READONLY);
objc_read_object(stream, &objects);
coder = [[BinaryCoder alloc]
initDecodingOnStream: [[StdioStream alloc]
initWithFilename:"test08.data"
fmode: "r"]];
[coder decodeObjectAt:&read_objects withName:NULL];
[coder release];
printf("read ");
[objects printForDebugger];
[objects release];
[read_objects printForDebugger];
[read_objects release];
}
int main()
@ -35,24 +45,28 @@ int main()
objects = [[Set alloc] initWithType:@encode(int)];
test(objects);
#if 0
objects = [[GapArray alloc] initWithType:@encode(int)];
test(objects);
#endif
objects = [[EltNodeCollector alloc] initWithType:@encode(int)
nodeCollector:[[LinkedList alloc] init]
nodeClass:[LinkedListEltNode class]];
test(objects);
#if 0
objects = [[EltNodeCollector alloc] initWithType:@encode(int)
nodeCollector:[[BinaryTree alloc] init]
nodeClass:[BinaryTreeEltNode class]];
test(objects);
#endif
/*
#if 0
objects = [[EltNodeCollector alloc] initWithType:@encode(int)
nodeClass:[RBTreeEltNode class]];
test(objects);
*/
#endif
exit(0);
}