home *** CD-ROM | disk | FTP | other *** search
/ World of Shareware - Software Farm 2 / wosw_2.zip / wosw_2 / CPROG / CPROTOS.ZIP / LI.C < prev    next >
Text File  |  1991-02-19  |  1KB  |  63 lines

  1. /*  
  2.    List functions -- these just maintain simple lists.
  3.    something more funky needs to be done with the memory
  4.    allocation.   This is all covered under the GNU General
  5.    Public License.  Its free.
  6. */
  7.  
  8.  
  9. #include "tr.h"
  10. #include "li.h"
  11. #include <stdio.h>
  12.  
  13. extern char *comment_buffer;
  14. extern int comment_counter;
  15.  
  16. LInode *li_tail = (LInode *) 0;
  17. LInode *li_head = (LInode *) 0;
  18.  
  19. void
  20. LIadd (decl_spec, decl, decl_list)
  21.      TRnode *decl_spec;
  22.      TRnode *decl;
  23.      TRnode *decl_list;
  24. {
  25.   LInode *linode;
  26.   
  27.   linode = (LInode *) malloc (sizeof (LInode));
  28.   if (0 == linode)
  29.     {
  30.       fprintf (stderr, "Problem with memory in LIadd.\n");
  31.       exit (4);
  32.     }
  33.   linode->decl_spec = decl_spec;
  34.   linode->decl = decl;
  35.   linode->decl_list = decl_list;
  36.  
  37. #ifdef nada
  38. printf ("DELC_SPEC: "); output_tree (decl_spec);
  39. printf ("\nDECL: "); output_tree (decl);
  40. printf ("\nDECL_LIST: "); output_tree (decl_list);
  41. #endif
  42.  
  43.   /*  Link it into the main list.  */
  44.   if (li_tail == 0)
  45.     {
  46.       li_tail = linode;
  47.       li_head = linode;
  48.     }
  49.   else
  50.     {
  51.       li_tail->next = linode;
  52.       li_tail = linode;
  53.     }
  54.  
  55.   if (comment_counter != 0)
  56.     linode->comment = make_string (comment_buffer);
  57.   else
  58.     linode->comment = 0;
  59.  
  60.   linode->next = 0;
  61.   return;
  62. }
  63.