Generated from list.h with ROBODoc v3.2.2 on Sun Aug 27 19:47:34 2000

TABLE OF CONTENTS

  1. List/add2List
  2. List/addList
  3. List/findElement
  4. List/list
  5. List/numberOfElements
  6. List/remList
  7. List/setName

List/add2List

NAME
   add2List -- macro, add an element to the beginning of a list
FUNCTION
   Add an element to the beginning of a list.
INPUTS
   l -- base address of a list.
   e -- address of the element to be added.
EXAMPLE
   add2List(&Player->shiptypes, newShipType);
SEE ALSO
   add2ListF(), addList()
SOURCE
    #define   add2List(l,e)  add2ListF((list **)l,(list *)e)    

List/addList

NAME
   addList -- macro, add an element to the end of a list
FUNCTION
   Add an element to a list.
   Uses evil casts to make it work on different 
   type of lists and elements, so one function can
   be used to add a player to a list of players
   and a planet to a list of planets.
INPUTS
   l -- pointer to the base of a list.
   e -- address of the element to be added.
EXAMPLE
   addList(&Player->shiptypes, newShipType);
SEE ALSO
   addListF(), add2List()
SOURCE
    #define   addList(l,e)    addListF((list **)l,(list *)e)    

List/findElement

NAME
   findElement -- macro, find an element in a list
SYNOPSIS
   findElement(t,l,n)
INPUTS
   t -- type of the element
   l -- base of the list
   n -- name of the element (pointer to a string)
SOURCE
    #define   findElement(t,l,n) (t *)findElementF((list *)l,n)    

List/list

NAME
   list -- list structure
FUNCTION
   Defines the basic structure of a list.
   The same layout is copied in all other structures (Planets, shiptype, 
   battle etc) that we like to store in lists.
   Since all these structures start with the same three fields we
   can use a number of standard functions to manipulate the lists.

   Base pointer    First element        Second element
   +--+        +------------+         +------------+         
   | *-------->| next   | *---------->| next   | *---------->  
   +--+        | cookie |   |         | cookie |   |
               | name   |   |         | name   |   |
               +------------+         +------------+
               | other data |         | other data |
   
   The cookie is used to do sanity checks. Each kind of list
   has its own unique cookie. This way we can check if the
   base pointer really points to a list of planets and not
   to a list of shiptypes for instance.
SOURCE
    typedef struct list {
      struct list    *next;
      long            cookie;
      char           *name;
    } list;    

List/numberOfElements

NAME
   numberOfElements
SOURCE
    #define   numberOfElements(l) numberOfElementsF((list *)l)    

List/remList

NAME
   remList -- macro, remove an element from a list
SYNOPSIS
   remList(l, e)
FUNCTION
INPUTS
   l -- pointer to the base of the list.
   e -- address of the element to be removed.
SEE ALSO
   removeListF(), addList()
SOURCE
    #define   remList(l,e) removeListF((list **)l,(list *)e)    

List/setName

NAME
   setName -- macro, set the name of an element
SEE ALSO
   setNameF()
SOURCE
    #define   setName(e, n) setNameF((list *)e, n)