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. |
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; |
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; |
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 */ |
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__((...)). |