[BACK]Return to rpc_scan.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / rpcgen

Diff for /src/usr.bin/rpcgen/rpc_scan.c between version 1.5 and 1.6

version 1.5, 2001/11/24 19:17:47 version 1.6, 2001/11/24 19:19:59
Line 35 
Line 35 
 #endif  #endif
   
 /*  /*
  * rpc_scan.c, Scanner for the RPC protocol compiler   * rpc_scan.c, Scanner for the RPC protocol compiler
  * Copyright (C) 1987, Sun Microsystems, Inc.   * Copyright (C) 1987, Sun Microsystems, Inc.
  */   */
 #include <sys/cdefs.h>  #include <sys/cdefs.h>
 #include <stdlib.h>  #include <stdlib.h>
Line 64 
Line 64 
 static token lasttok;   /* last token, if pushed */  static token lasttok;   /* last token, if pushed */
   
 /*  /*
  * scan expecting 1 given token   * scan expecting 1 given token
  */   */
 void  void
 scan(expect, tokp)  scan(expect, tokp)
Line 72 
Line 72 
         token *tokp;          token *tokp;
 {  {
         get_token(tokp);          get_token(tokp);
         if (tokp->kind != expect)          if (tokp->kind != expect) {
                 expected1(expect);                  expected1(expect);
           }
 }  }
   
 /*  /*
  * scan expecting any of the 2 given tokens   * scan expecting any of the 2 given tokens
  */   */
 void  void
 scan2(expect1, expect2, tokp)  scan2(expect1, expect2, tokp)
Line 86 
Line 87 
         token *tokp;          token *tokp;
 {  {
         get_token(tokp);          get_token(tokp);
         if (tokp->kind != expect1 && tokp->kind != expect2)          if (tokp->kind != expect1 && tokp->kind != expect2) {
                 expected2(expect1, expect2);                  expected2(expect1, expect2);
           }
 }  }
   
 /*  /*
  * scan expecting any of the 3 given token   * scan expecting any of the 3 given token
  */   */
 void  void
 scan3(expect1, expect2, expect3, tokp)  scan3(expect1, expect2, expect3, tokp)
Line 101 
Line 103 
         token *tokp;          token *tokp;
 {  {
         get_token(tokp);          get_token(tokp);
         if (tokp->kind != expect1 && tokp->kind != expect2 &&          if (tokp->kind != expect1 && tokp->kind != expect2
             tokp->kind != expect3)              && tokp->kind != expect3) {
                 expected3(expect1, expect2, expect3);                  expected3(expect1, expect2, expect3);
           }
 }  }
   
 /*  /*
  * scan expecting a constant, possibly symbolic   * scan expecting a constant, possibly symbolic
  */   */
 void  void
 scan_num(tokp)  scan_num(tokp)
Line 123 
Line 126 
 }  }
   
 /*  /*
  * Peek at the next token   * Peek at the next token
  */   */
 void  void
 peek(tokp)  peek(tokp)
Line 134 
Line 137 
 }  }
   
 /*  /*
  * Peek at the next token and scan it if it matches what you expect   * Peek at the next token and scan it if it matches what you expect
  */   */
 int  int
 peekscan(expect, tokp)  peekscan(expect, tokp)
Line 150 
Line 153 
 }  }
   
 /*  /*
  * Get the next token, printing out any directive that are encountered.   * Get the next token, printing out any directive that are encountered.
  */   */
 void  void
 get_token(tokp)  get_token(tokp)
Line 176 
Line 179 
                                 if (commenting) {                                  if (commenting) {
                                         break;                                          break;
                                 } else if (cppline(curline)) {                                  } else if (cppline(curline)) {
                                         docppline(curline, &linenum,                                          docppline(curline, &linenum,
                                             &infilename);                                                    &infilename);
                                 } else if (directive(curline)) {                                  } else if (directive(curline)) {
                                         printdirective(curline);                                          printdirective(curline);
                                 } else {                                  } else {
Line 206 
Line 209 
         }          }
   
         /*          /*
          * 'where' is not whitespace, comment or directive Must be a token!           * 'where' is not whitespace, comment or directive Must be a token!
          */           */
         switch (*where) {          switch (*where) {
         case ':':          case ':':
Line 389 
Line 392 
 }  }
   
 static token symbols[] = {  static token symbols[] = {
         {TOK_CONST, "const"},                            {TOK_CONST, "const"},
         {TOK_UNION, "union"},                            {TOK_UNION, "union"},
         {TOK_SWITCH, "switch"},                            {TOK_SWITCH, "switch"},
         {TOK_CASE, "case"},                            {TOK_CASE, "case"},
         {TOK_DEFAULT, "default"},                            {TOK_DEFAULT, "default"},
         {TOK_STRUCT, "struct"},                            {TOK_STRUCT, "struct"},
         {TOK_TYPEDEF, "typedef"},                            {TOK_TYPEDEF, "typedef"},
         {TOK_ENUM, "enum"},                            {TOK_ENUM, "enum"},
         {TOK_OPAQUE, "opaque"},                            {TOK_OPAQUE, "opaque"},
         {TOK_BOOL, "bool"},                            {TOK_BOOL, "bool"},
         {TOK_VOID, "void"},                            {TOK_VOID, "void"},
         {TOK_CHAR, "char"},                            {TOK_CHAR, "char"},
         {TOK_INT, "int"},                            {TOK_INT, "int"},
         {TOK_UNSIGNED, "unsigned"},                            {TOK_UNSIGNED, "unsigned"},
         {TOK_SHORT, "short"},                            {TOK_SHORT, "short"},
         {TOK_LONG, "long"},                            {TOK_LONG, "long"},
         {TOK_FLOAT, "float"},                            {TOK_FLOAT, "float"},
         {TOK_DOUBLE, "double"},                            {TOK_DOUBLE, "double"},
         {TOK_STRING, "string"},                            {TOK_STRING, "string"},
         {TOK_PROGRAM, "program"},                            {TOK_PROGRAM, "program"},
         {TOK_VERSION, "version"},                            {TOK_VERSION, "version"},
         {TOK_EOF, "??????"},                            {TOK_EOF, "??????"},
 };  };
   
 static  static

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.6