swarm-support
[Top][All Lists]
Advanced

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

Infile usage/replacement


From: Paul E. Johnson
Subject: Infile usage/replacement
Date: Fri, 31 Mar 2000 11:16:49 -0600

I came across an older swarm app that used InFile in this way. The file
that is retrieved by InFile has a word, then two numbers, and the agents
are created by getting the word, translating that to a class name, and
then getting the numbers for IVARS, and it repeats until all the lines
of the infile are used up.  This uses some objc things I've not seen
before, so in case anybody reading is a learner like me, here it is:


   aFileObj = [InFile create: [self getZone] setName: "trader.setup"]; 

   while ([aFileObj getWord: tClassStr] != 0) 
    {
    [aFileObj getInt: (int *) &rEndow];
    [aFileObj getInt: (int *) &rlEndow];
    tClass = objc_lookup_class (tClassStr); 
    numTraders++;
    sprintf (objNamStr, "%s%d", tClassStr, numTraders);

    aNameObj = [UName create:[self getZone] setBaseName: objNamStr];

    aTrader = [(id) tClass createBegin: [self getZone]];
    [aTrader setMktMaker: mktMaker];
    [aTrader setMktStats: mktStats];
    [aTrader setLiqMean: liqMean liqVar: liqVar];
    [aTrader setDiagLevel: diagLevel];
    [aTrader setTraderName: (char *) [aNameObj getNewName]];
    [aTrader setEndow: rEndow : rlEndow]; 
    aTrader = [aTrader createEnd];

      // Add to all proper lists
    [traderList addLast: aTrader];
  }

I understand the deprecation of Swarm's InFile. How would you replace
this functionality?


-- 
Paul E. Johnson                         email: address@hidden
Dept. of Political Science              http://lark.cc.ukans.edu/~pauljohn
University of Kansas                    Office: (785) 864-9086
Lawrence, Kansas 66045                  FAX: (785) 864-5700

                  ==================================
   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]