/[global]/global/gtags-parser/C.c
ViewVC logotype

Diff of /global/gtags-parser/C.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by shigio, Fri Feb 18 11:07:18 2005 UTC revision 1.2 by shigio, Thu Feb 24 01:33:48 2005 UTC
# Line 1  Line 1 
1  /*  /*
2   * Copyright (c) 1998, 1999, 2000, 2001, 2002, 2003, 2004   * Copyright (c) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
3   *      Tama Communications Corporation   *      Tama Communications Corporation
4   *   *
5   * This file is part of GNU GLOBAL.   * This file is part of GNU GLOBAL.
# Line 67  static struct { Line 67  static struct {
67  } stack[MAXPIFSTACK], *cur;  } stack[MAXPIFSTACK], *cur;
68  static int piflevel;            /* condition macro level */  static int piflevel;            /* condition macro level */
69  static int level;               /* brace level */  static int level;               /* brace level */
70    static int yaccflag;            /* 1: yacc, 0: c */
71    
72  /*  /*
73   * C: read C (includes .h, .y) file and pickup tag entries.   * yacc: read yacc file and pickup tag entries.
74   */   */
75  void  void
76  C(yacc)  yacc(file)
77          int yacc;          const char *file;
78    {
79            yaccflag = 1;
80            C(file);
81    }
82    /*
83     * C: read C file and pickup tag entries.
84     */
85    void
86    C(file)
87            const char *file;
88  {  {
89          int c, cc;          int c, cc;
90          int savelevel;          int savelevel;
# Line 91  C(yacc) Line 102  C(yacc)
102           * programs           * programs
103           *           *
104           */           */
105          int yaccstatus = (yacc) ? DECLARATIONS : PROGRAMS;          int yaccstatus = (yaccflag) ? DECLARATIONS : PROGRAMS;
106          int inC = (yacc) ? 0 : 1;               /* 1 while C source */          int inC = (yaccflag) ? 0 : 1;           /* 1 while C source */
107    
108          level = piflevel = 0;          level = piflevel = 0;
109          savelevel = -1;          savelevel = -1;
# Line 100  C(yacc) Line 111  C(yacc)
111          startmacro = startsharp = 0;          startmacro = startsharp = 0;
112          cmode = 1;                      /* allow token like '#xxx' */          cmode = 1;                      /* allow token like '#xxx' */
113          crflag = 1;                     /* require '\n' as a token */          crflag = 1;                     /* require '\n' as a token */
114          if (yacc)          if (yaccflag)
115                  ymode = 1;              /* allow token like '%xxx' */                  ymode = 1;              /* allow token like '%xxx' */
116    
117            if (!opentoken(file))
118                    die("'%s' cannot open.", file);
119          while ((cc = nexttoken(interested, reserved_word)) != EOF) {          while ((cc = nexttoken(interested, reserved_word)) != EOF) {
120                  switch (cc) {                  switch (cc) {
121                  case SYMBOL:            /* symbol       */                  case SYMBOL:            /* symbol       */
# Line 464  C(yacc) Line 477  C(yacc)
477                  if (piflevel != 0)                  if (piflevel != 0)
478                          warning("#if block unmatched. (last at level %d.)[+%d %s]", piflevel, lineno, curfile);                          warning("#if block unmatched. (last at level %d.)[+%d %s]", piflevel, lineno, curfile);
479          }          }
480            closetoken();
481  }  }
482  /*  /*
483   * process_attribute: skip attributes in __attribute__((...)).   * process_attribute: skip attributes in __attribute__((...)).

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26