swarm-support
[Top][All Lists]
Advanced

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

Re: your mail


From: Paul Johnson
Subject: Re: your mail
Date: Tue, 30 Jun 1998 08:40:51 -0500 (CDT)

There are examples of this in hello-world that I copied in my
majority rule application. (Look at neighbor.h for example)

 Your idea is correct, but the implementation
is not quite right. You need to have the typedef in an h file, possibly
by itself, but not necessarily so. Then you include that h file
everywhere you want to use that newly defined type.  

Good Luck.
PJ
On Tue, 30 Jun 1998 address@hidden wrote:

> new data type ....
> Problem: I want to define a new data type (for example, the data type is
> a structure), at a global level, such that this type can be used by any 
> agents in any swarm. I used tutorial/simpleObserverBug programe to test this
> idea. In main.m, I added some codes like:
> 
> typedef struct node Node;
> typedef Node *PtrNode;
> struct node {
> int xxx;
> float yyy;
> PtrNode link;
> };
> 
> and in ModelSwarm.m, in a method definition (e.g., buildobjects), I try to 
> define a temporal variable such as:
> Node n1;
> PtrNode ptr;
> 
> however, when I compiled the newly modified codes, the error message says 
> Node and PtrNode has not been declared. 
> 
> I am not sure whether this is my C knowledge is wrong (I am a moderate level
> C programmer), or Swarm agents does not recognize global data type definition.
> 
> Thanks!
> 
> Dr. Xueyue Huang
> Center for Transport Studies
> Imperial College
> London SW7
> 
>                   ==================================
>    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.
>                   ==================================
> 

Paul E. Johnson                      address@hidden
Dept. of Political Science           http://lark.cc.ukans.edu/~pauljohn
University of Kansas                 Office: (913) 864-9086
Lawrence, Kansas 66045               FAX: (913) 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]