NAME
     init_table - initializes a variable table.
     find_address - finds an address of a variable from a variable table.
     table - registers a variable in the variable table.

SYNOPSIS
     #include "table.h"
     table.c

     struct list *
     init_table(void);

     int 
     find_address(char *s, struct list *local_table);

     void
     table(char *s, struct list *local_table);

DESCRIPTION
     The file "table.h" defines the type of the Table structure like:

	  struct list
          {
              struct listItem *head;
	      struct listItem *tail;
	  };

     listItem's structure is also defined as:

          struct listItem
          {
	      int address; 
	      char variable_name[16]; /* Should be MAXIDLEN */
	      struct listItem *successor;
	  };

     The file "table.c" contains all the functions mentioned above. It
     implements necessary functions to control the variable table.

     init_table initializes a table by obtaining required memory for a
     table from memory and then passing the starting address of the
     obtained piece of memory. It also initializes the address variable
     so that the variables addresses can began from 0(zero). Upon success
     it returns 'struct list *'(the bad point about this function is that
     it never checks whether 'malloc' failed or succeded). It should be
     called:

	  struct list *Table;
		 .
		 .
		 .
	  Table = init_table();

     find_address takes a 'char *' and a 'struct list *' as its arguments.
     It searches the 'struct list *' for the variable named 'char *'.
     If it finds a variable named 'char *', it returns its address,
     otherwise it passes -1. Success or failure should be checked at the
     caller side like:

	  if(find_address("var1", Table) == -1)
	      .... /* failed to find the variable "var1" */
	  else
	      .... /* found the variable "var1"          */

     table takes a 'char *' and a 'struct list *' as its arguments. It
     searches the 'struct list *' for the var 'char *' before registering
     it. If 'char *' already exists in the 'struct list *', it calls the
     error function. Otherwise it registers the variable. It should be
     called:

          table("var1", Table);

     Point to remember regarding this table function is that it exits the
     program upon failure.

     The easiest way to produce a variable table for:

          var x, y, z;

     is:

	  struct list *Table;

	  Table = init_table();
	  table("x", Table);
	  table("y", Table);
	  table("z", Table);

      This shoule produce a table like:

	   --------------------
	  | Var name | Address |
	   --------------------
          |     x    |    0    |
	   --------------------
          |     y    |    1    |
	   --------------------
          |     z    |    2    |
	   --------------------

FILES
     table.h 
     table.c

WARNING
     The following functions are not required from other parts:

	  push, append, clean_table. 

SEE ALSO
     push. 

AUTHOR
     Chakma Junan <jchakma@yahoo.com> 
     Information and Computer Sciences
     Toyohashi University of Technology.
     (It was originially implemented by: ohno@edu.tut.ac.jp)

     Last Updated: Tue Feb 15 00:54:57 JST 2000
