This is test3.m in view mode; [Download] [Up]
#include <coll/coll.h>
main()
{
id array = [[Array alloc] initEncoding:@encode(int)];
id bag;
id llist;
id btree;
typeof((id)0) foo;
[array addElementsCount:6, ((elt){0}),((elt){1}),((elt){5}),((elt){3}),
((elt){4}),((elt){2})];
bag = [array shallowCopyAs:[Bag class]];
llist = [[EltNodeCollector alloc] initEncoding:@encode(int)
nodeCollector:[[LinkedList alloc] init]
nodeClass:[LinkedListEltNode class]];
[llist addContentsOf:array];
btree = [[EltNodeCollector alloc] initEncoding:@encode(int)
nodeCollector:[[BinaryTree alloc] init]
nodeClass:[BinaryTreeEltNode class]];
[btree addContentsOf:array];
printf("btree count = %d\n", [btree count]);
/* tmp test */
/*
if (typeof((id)0) != typeof(id))
printf("typeof error\n");
*/
[array printForDebugger];
[bag printForDebugger];
[llist printForDebugger];
[btree printForDebugger];
/* foo = [array shallowCopyAs:[Object class]];
Shouldn't the compiler complain about this?
Object does not conform to <Collecting> */
exit(0);
}
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.