swarm-support
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Iterating through a list


From: Marcus G. Daniels
Subject: Re: Iterating through a list
Date: 25 Jul 2000 17:10:16 -0600
User-agent: Gnus/5.0803 (Gnus v5.8.3) Emacs/20.6

D4> Given that, is there any reason to believe that the loop should
D4> die if the list is empty?

No.

#import <simtools.h> // initSwarm
#import <collections.h>
#import <objectbase/Swarm.h>

@interface Controller: Swarm
- (void)test;
@end

@implementation Controller
- (void)test
{
  id <List> l = [List create: globalZone];
  id <Index> index;

#if 0
  [l addLast: [SwarmObject create: self]];
  printf ("added: %p\n", [l getLast]);
#endif

  index = [l begin: self];
  while ([index next])
    printf ("%p\n", [index get]);
  [index drop];
}
@end

int
main (int argc, const char **argv)
{
  id controller;

  initSwarmBatch (argc, argv);

  controller = [Controller create: globalZone];
  [controller test];
  return 0;
}

/*
Local Variables:
compile-command: "$SWARMHOME/bin/libtool-swarm --mode=link gcc -D_GNU_SOURCE -o 
index -Wall -Werror -g -Wno-import -I$SWARMHOME/include/swarm 
-L$SWARMHOME/lib/swarm index.m -lswarm -lobjc"
End:
*/

                  ==================================
   Swarm-Support is for discussion of the technical details of the day
   to day usage of Swarm.  For list administration needs (esp.
   [un]subscribing), please send a message to <address@hidden>
   with "help" in the body of the message.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]