84
84
static IncludeStack inc_stack[MAX_INC_DEPTH]; /* stack of included files */
85
85
static SymbolTable *included_files; /* files already included */
87
static int type_of_name ARGS((char *name));
88
static void startCpp ARGS((int level));
89
static void finishCpp ARGS((void));
87
static int type_of_name (char *name);
88
static void startCpp (int level);
89
static void finishCpp (void);
90
90
#if defined(apollo) || !OPT_LINTLIBRARY
91
static void absorb_special ARGS((void));
91
static void absorb_special (void);
93
93
#if OPT_LINTLIBRARY
94
static void gcc_attribute ARGS((void));
94
static void gcc_attribute (void);
96
static void update_line_num ARGS((void));
97
static void save_text ARGS((void));
98
static void save_text_offset ARGS((void));
99
static void get_quoted ARGS((void));
100
static void get_comment ARGS((void));
101
static void get_cpp_directive ARGS((char *dest, unsigned n));
102
static void do_include ARGS((char *f));
103
static void include_file ARGS((char *name, int convert));
104
static void put_file ARGS((FILE *outf));
105
static void put_quoted ARGS((int c));
96
static void update_line_num (void);
97
static void save_text (void);
98
static void save_text_offset (void);
99
static void get_quoted (void);
100
static void get_comment (void);
101
static void get_cpp_directive (char *dest, unsigned n);
102
static void do_include (char *f);
103
static void include_file (char *name, int convert);
104
static void put_file (FILE *outf);
105
static void put_quoted (int c);
107
107
#if OPT_LINTLIBRARY
108
static int decipher_comment ARGS((char *keyword, int len));
108
static int decipher_comment (char *keyword, int len);
114
int yywrap ARGS((void));
148
148
char name[MAX_TEXT_SIZE], value[MAX_TEXT_SIZE];
151
153
sscanf(yytext, "define %s", name);
152
155
get_cpp_directive(buf, sizeof(buf));
153
158
sscanf(buf, "%s", value);
154
160
new_symbol(define_names, name, value, DS_NONE);
172
178
<CPP1>line{WS}+[0-9]+{WS}+\".*$ {
181
cur_file->file_name[0] = 0;
174
182
sscanf(yytext, "line %d \"%[^\"]\"",
175
&cur_file->line_num, cur_file->file_name);
184
cur_file->file_name);
176
186
cur_file->line_num--;
180
190
<CPP1>[0-9]+{WS}+\".*$ {
182
sscanf(yytext, "%d \"%[^\"]\"", &cur_file->line_num,
183
cur_file->file_name);
193
cur_file->file_name[0] = 0;
194
sscanf(yytext, "%d \"%[^\"]\"",
196
cur_file->file_name);
184
198
cur_file->line_num--;
695
703
* the text in the buffer pointed to by <dest> having size <n>.
698
get_cpp_directive (dest, n)
699
char *dest; /* buffer to store directive text */
700
unsigned n; /* size of buffer to store directive text */
707
char *dest, /* buffer to store directive text */
708
unsigned n) /* size of buffer to store directive text */
702
710
char c, lastc[4];
824
832
* point to the file.
827
include_file (name, convert)
828
char *name; /* file name */
829
int convert; /* if TRUE, convert function definitions */
835
include_file (char *name, /* file name */
836
int convert) /* if TRUE, convert function definitions */
832
839
cur_file = inc_stack + inc_depth;
833
840
cur_file->file = yyin;
834
841
cur_file->base_name = xstrdup(name);
835
cur_file->file_name = strcpy(xmalloc(MAX_TEXT_SIZE), name);
842
cur_file->file_name = strcpy(xmalloc(strlen(name) + MAX_TEXT_SIZE), name);
836
843
cur_file->line_num = 1;
837
844
cur_file->convert = convert;
838
845
cur_file->changed = FALSE;
922
927
/* Process include directive.
925
do_include (file_spec)
926
char *file_spec; /* path surrounded by "" or <> */
930
do_include (char *file_spec) /* path surrounded by "" or <> */
928
932
int stdinc; /* 1 = path surrounded by <> */
929
933
char file[MAX_TEXT_SIZE], path[MAX_TEXT_SIZE];