home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / vol_200 / 204_01 / symbol.c < prev   
Text File  |  1979-12-31  |  2KB  |  59 lines

  1. #include        <stdio.h>
  2. #include        "c.h"
  3. #include        "expr.h"
  4. #include        "gen.h"
  5. #include        "cglbdec.h"
  6.  
  7. /*
  8.  *    68000 C compiler
  9.  *
  10.  *    Copyright 1984, 1985, 1986 Matthew Brandt.
  11.  *  all commercial rights reserved.
  12.  *
  13.  *    This compiler is intended as an instructive tool for personal use. Any
  14.  *    use for profit without the written consent of the author is prohibited.
  15.  *
  16.  *    This compiler may be distributed freely for non-commercial use as long
  17.  *    as this notice stays intact. Please forward any enhancements or questions
  18.  *    to:
  19.  *
  20.  *        Matthew Brandt
  21.  *        Box 920337
  22.  *        Norcross, Ga 30092
  23.  */
  24.  
  25. SYM     *search(na,thead)
  26. char    *na;
  27. SYM     *thead;
  28. {       while( thead != 0) {
  29.                 if(strcmp(thead->name,na) == 0)
  30.                         return thead;
  31.                 thead = thead->next;
  32.                 }
  33.         return 0;
  34. }
  35.  
  36. SYM     *gsearch(na)
  37. char    *na;
  38. {       SYM     *sp;
  39.         if( (sp = search(na,lsyms.head)) == 0)
  40.                 sp = search(na,gsyms.head);
  41.         return sp;
  42. }
  43.  
  44. insert(sp,table)
  45. SYM     *sp;
  46. TABLE   *table;
  47. {       if( search(sp->name,table->head) == 0) {
  48.                 if( table->head == 0)
  49.                         table->head = table->tail = sp;
  50.                 else    {
  51.                         table->tail->next = sp;
  52.                         table->tail = sp;
  53.                         }
  54.                 sp->next = 0;
  55.                 }
  56.         else
  57.                 error(ERR_DUPSYM);
  58. }
  59.