swarm-support
[Top][All Lists]
Advanced

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

Initializing objects with lisp


From: glen e. p. ropella
Subject: Initializing objects with lisp
Date: Tue, 25 May 1999 16:06:52 -0600

Hidee Ho,

For those of you wondering how to use Lisp to initialize
your objects, I managed to initialize a Swarm just fine
using the following.

Inside the object to be initialized (Booga.m):
----------------------------
@implementation
...blahblahblah...
- loadYourself {
  id expr;
  FILE *fp = 
    fopen("/users/gepr/Swarm/apps/booga/booga.scm", "r");
  if (fp != NULL) {
    id inStream = 
      [InputStream create: scratchZone setFileStream: fp];

    expr = [inStream getExpr];
    [self lispIn: expr];
    [inStream drop];
    fclose(fp);
  }
  return self;
}
...blahblahblah...
@end
----------------------------

Then inside the parent:
------------------------------
booga = [booga create: self];
[booga loadYourself];
------------------------------

I used the "lispIn" method, which is a USING
phase method (as opposed to the "lispInCreate" method
because I do a number of other special things in my
createBegin/createEnd that I don't want to muck with
right now and because I'll probably use the same 
mechanism to design an experiment manager later.
But, presumably, "lispInCreate" would be more appropriate
for this.

Oh yeah, and the lisp expression that gets loaded looks like:

(#:intVar 1 
 #:boolVar #\000 
 #:floatVar 5.000000D0
 )

glen
p.s. Sorry if this is common knowledge to the rest of
y'all.  I just thought I'd post it in case it wasn't.
--
glen e. p. ropella                =><=          Hail Eris!
Home: http://www.trail.com/~gepr/home.html  (505) 424-0448
Work: http://www.swarm.com                  (505) 995-0818  

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