home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / vol_300 / 338_02 / searchkw.c < prev    next >
Text File  |  1979-12-31  |  2KB  |  53 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. struct kwblk {
  26.         char            *word;
  27.         int              stype;
  28.         }       keywords[] = {
  29.  
  30.         {"int", kw_int}, {"char", kw_char}, {"long", kw_long},
  31.         {"float", kw_float}, {"double", kw_double}, {"return", kw_return},
  32.         {"struct", kw_struct}, {"union", kw_union}, {"typedef", kw_typedef},
  33.         {"enum", kw_enum}, {"static", kw_static}, {"auto", kw_auto},
  34.         {"sizeof", kw_sizeof}, {"do", kw_do}, {"if", kw_if},
  35.         {"else", kw_else}, {"for", kw_for},{"switch", kw_switch},
  36.         {"while", kw_while},{"short", kw_short}, {"extern", kw_extern},
  37.         {"case", kw_case}, {"goto", kw_goto}, {"default", kw_default},
  38.         {"register", kw_register}, {"unsigned", kw_unsigned},
  39.         {"break", kw_break}, {"continue", kw_continue}, {"void", kw_void},
  40.         {0, 0} };
  41.  
  42. searchkw()
  43. {       struct kwblk    *kwbp;
  44.         kwbp = keywords;
  45.         while(kwbp->word != 0) {
  46.                 if(strcmp(lastid,kwbp->word) == 0)
  47.                         return lastst = kwbp->stype;
  48.                 else
  49.                         ++kwbp;
  50.                 }
  51. }
  52.  
  53.