#include <ctype.h>#include <stdio.h>#include <signal.h>#include <string.h>#include <unistd.h>#include <sys/types.h>#include <sys/stat.h>#include <fcntl.h>#include <sys/time.h>#include <sys/resource.h>#include <errno.h>#include "lclintMacros.nf"#include "llbasic.h"#include "lcllib.h"#include "cpp.h"#include "cpplib.h"#include "cpperror.h"#include "cpphash.h"#include "cppexp.h"#include "version.h"#include "portab.h"#include "osd.h"Go to the source code of this file.
Compounds | |
| struct | argdata |
| struct | default_include |
| struct | directive |
| struct | file_name_map |
| struct | file_name_map_list |
Defines | |
| #define | NO_SHORTNAMES |
| #define | IMPORT_FOUND -2 |
| #define | SKIP_INCLUDE IMPORT_FOUND |
| #define | IMPORT_NOT_FOUND -1 |
| #define | STDC_VALUE 1 |
| #define | PATH_SEPARATOR ':' |
| #define | O_RDONLY 0 |
| #define | SIZE_TYPE "long unsigned int" |
| #define | PTRDIFF_TYPE "long int" |
| #define | WCHAR_TYPE "int" |
| #define | USER_LABEL_PREFIX "" |
| #define | REGISTER_PREFIX "" |
| #define | SKIP_WHITE_SPACE(p) do { while (is_hor_space[(int) *(p)]) { (p)++; } } while (0) |
| #define | SKIP_ALL_WHITE_SPACE(p) do { while (is_space[*(p)]) { (p)++; } } while (0) |
| #define | cppBuffer_get(BUFFER) |
| #define | cppReader_puts(PFILE, STR, N) |
| #define | cppReader_putCharQ(PFILE, CH) (*(PFILE)->limit++ = (CH)) |
| #define | cppReader_putChar(PFILE, CH) (cppReader_reserve (PFILE, (size_t) 1), cppReader_putCharQ (PFILE, CH)) |
| #define | cppReader_nullTerminateQ(PFILE) (*(PFILE)->limit = 0) |
| #define | cppReader_nullTerminate(PFILE) |
| #define | cppReader_adjustWritten(PFILE,DELTA) ((PFILE)->limit += (DELTA)) |
| #define | cppReader_isC89(PFILE) (CPPOPTIONS(PFILE)->c89) |
| #define | cppReader_wcharType(PFILE) |
| #define | cppReader_forward(pfile, N) |
| #define | cppReader_getC(pfile) (cppBuffer_get (cppReader_getBufferSafe (pfile))) |
| #define | cppReader_peekC(pfile) (cppBufPeek (cppReader_getBufferSafe (pfile))) |
| #define | NEWLINE_FIX |
| #define | NEWLINE_FIX1(C) |
| #define | SELF_DIR_DUMMY ((struct file_name_list *) (~0)) |
| #define | REST_EXTENSION_LENGTH (sizeof (rest_extension) - 1) |
| #define | ARG_BASE ((pfile)->token_buffer) |
| #define | FNAME_HASHSIZE 37 |
| #define | FILE_NAME_MAP_FILE "header.gcc" |
Enumerations | |
| enum | file_change_code { same_file, enter_file, leave_file } |
Functions | |
| bool | isIdentifierChar (char c) |
| void | cppReader_growBuffer (cppReader *pfile, size_t n) |
| void | cppReader_define (cppReader *pfile, char *str) |
| void | cppReader_addIncludeChain (cppReader *pfile, struct file_name_list *dir) |
| void | cppOptions_init (cppOptions *opts) |
| int | cppSkipHspace (cppReader *pfile) |
| void | cppReader_skipRestOfLine (cppReader *pfile) |
| int | cppReader_checkMacroName (cppReader *pfile, char *symname, cstring usage) |
| cppBuffer* | cppReader_popBuffer (cppReader *pfile) |
| void | cppBuffer_lineAndColumn ( cppBuffer *pbuf, int *linep, int *colp) |
| cppBuffer* | cppReader_fileBuffer (cppReader *pfile) |
| enum cpp_token | cppGetToken (cppReader *pfile) |
| void | cppReader_init (cppReader *pfile) |
| void | cppReader_finish ( cppReader *pfile) |
| void | cppCleanup (cppReader *pfile) |
| void | cppReader_initializeReader (cppReader *pfile) |
| int | cppReader_startProcess (cppReader *pfile, cstring fname) |
| cppBuffer* | cppReader_getBufferSafe (cppReader *pfile) |
| int | cppBufPeek (cppBuffer *buf) |
| cppBuffer* | cppBuffer_prevBuffer (cppBuffer *buf) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Initializer: \
do { while (cppReader_peekC (pfile) == '\\' && cpp_peekN (pfile, 1) == '\n') { cppReader_forward (pfile, 2); } } while(FALSE) |
|
|
Initializer: do { \
while ((C) == '\\' && cppReader_peekC (pfile) == '\n') { cppReader_forward (pfile, 1); (C) = cppReader_getC (pfile); }\
} while(0)Definition at line 303 of file cpplib.c. Referenced by cppGetToken(). |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Definition at line 225 of file cpplib.c. Referenced by REST_EXTENSION_LENGTH(). |
|
|
|
|
|
|
|
|
|
|
|
Initializer: \ ((BUFFER)->cur < (BUFFER)->rlimit ? *(BUFFER)->cur++ : EOF) |
|
|
Definition at line 267 of file cpplib.c. Referenced by cppGetToken(). |
|
|
Initializer: \ (cppBuffer_forward (cppReader_getBufferSafe (pfile), (N))) Definition at line 281 of file cpplib.c. Referenced by cppGetToken(), and cppSkipHspace(). |
|
|
Definition at line 285 of file cpplib.c. Referenced by cppGetToken(). |
|
|
Definition at line 270 of file cpplib.c. Referenced by cppGetToken(). |
|
|
Initializer: \ (cppReader_reserve (PFILE, (size_t) 1), *(PFILE)->limit = 0) Definition at line 262 of file cpplib.c. Referenced by cppGetToken(). |
|
|
Definition at line 258 of file cpplib.c. Referenced by cppGetToken(). |
|
|
Definition at line 288 of file cpplib.c. Referenced by cppGetToken(), and cppSkipHspace(). |
|
|
Definition at line 252 of file cpplib.c. Referenced by cppGetToken(). |
|
|
Definition at line 246 of file cpplib.c. Referenced by cppGetToken(). |
|
|
Initializer: \ cppReader_reserve(PFILE, N), cppReader_putStrN (PFILE, STR,N) Definition at line 239 of file cpplib.c. Referenced by cppGetToken(). |
|
|
Initializer: \ (CPPOPTIONS (PFILE)->cplusplus ? "__wchar_t" : WCHAR_TYPE) |
|
|
Definition at line 412 of file cpplib.c. 00412 {
00413 same_file, enter_file, leave_file
00414 }
|
|
|
Definition at line 6726 of file cpplib.c. Referenced by cppGetToken(). 06727 {
06728 if (buf->cur == NULL || buf->rlimit == NULL) {
06729 return EOF;
06730 }
06731
06732 if (buf->cur < buf->rlimit) {
06733 return *(buf->cur);
06734 }
06735
06736 return EOF;
06737 }
|
|
|
Definition at line 2408 of file cpplib.c. Referenced by REST_EXTENSION_LENGTH(), and cppGetToken(). 02410 {
02411 int dummy;
02412
02413 if (colp == NULL)
02414 {
02415 colp = &dummy;
02416 /*@-branchstate@*/
02417 } /*@=branchstate@*/
02418
02419 if (pbuf != NULL)
02420 {
02421 *linep = pbuf->lineno;
02422 *colp = pbuf->colno;
02423
02424 llassert (pbuf->buf != NULL);
02425 llassert (pbuf->cur != NULL);
02426
02427 adjust_position (pbuf->buf + pbuf->line_base, pbuf->cur, linep, colp);
02428 }
02429 else
02430 {
02431 *linep = 0;
02432 *colp = 0;
02433 }
02434 }
|
|
|
Definition at line 7432 of file cpplib.c. Referenced by cppGetToken(), and cppReader_fileBuffer(). 07433 {
07434 return buf + 1;
07435 }
|
|
|
Definition at line 6215 of file cpplib.c. 06216 {
06217 while (CPPBUFFER (pfile) != cppReader_nullBuffer (pfile))
06218 {
06219 (void) cppReader_popBuffer (pfile);
06220 }
06221
06222 if (pfile->token_buffer != NULL)
06223 {
06224 sfree (pfile->token_buffer);
06225 pfile->token_buffer = NULL;
06226 }
06227
06228 while (pfile->if_stack != NULL)
06229 {
06230 cppIfStackFrame *temp = pfile->if_stack;
06231 pfile->if_stack = temp->next;
06232 sfree (temp);
06233 }
06234
06235 while (pfile->all_include_files != NULL)
06236 {
06237 struct file_name_list *temp = pfile->all_include_files;
06238 pfile->all_include_files = temp->next;
06239 /*@-dependenttrans@*/
06240 cstring_free (temp->fname);
06241 /*@=dependenttrans@*/
06242 sfree (temp);
06243 }
06244
06245 cppReader_hashCleanup ();
06246 }
|
|
|
Definition at line 5045 of file cpplib.c. Referenced by cppProcess(). 05046 {
05047 int c, c2, c3;
05048 size_t old_written = 0;
05049 int start_line, start_column;
05050 enum cpp_token token;
05051 struct cppOptions *opts = CPPOPTIONS (pfile);
05052 cppReader_getBuffer (pfile)->prev = cppReader_getBuffer (pfile)->cur;
05053
05054 get_next:
05055 c = cppReader_getC (pfile);
05056
05057 if (c == EOF)
05058 {
05059 handle_eof:
05060 if (cppReader_getBuffer (pfile)->seen_eof)
05061 {
05062 cppBuffer *buf = cppReader_popBuffer (pfile);
05063
05064 if (buf != cppReader_nullBuffer (pfile))
05065 {
05066 goto get_next;
05067 }
05068 else
05069 {
05070 return CPP_EOF;
05071 }
05072 }
05073 else
05074 {
05075 cppBuffer *next_buf = cppBuffer_prevBuffer (cppReader_getBuffer (pfile));
05076 cppReader_getBuffer (pfile)->seen_eof = 1;
05077
05078 if (cstring_isDefined (cppReader_getBuffer (pfile)->nominal_fname)
05079 && next_buf != cppReader_nullBuffer (pfile))
05080 {
05081 /* We're about to return from an #include file.
05082 Emit #line information now (as part of the CPP_POP) result.
05083 But the #line refers to the file we will pop to. */
05084 cppBuffer *cur_buffer = CPPBUFFER (pfile);
05085 CPPBUFFER (pfile) = next_buf;
05086 pfile->input_stack_listing_current = 0;
05087 output_line_command (pfile, 0, leave_file);
05088 CPPBUFFER (pfile) = cur_buffer;
05089 }
05090 return CPP_POP;
05091 }
05092 }
05093 else
05094 {
05095 long newlines;
05096 struct parse_marker start_mark;
05097
05098 switch (c)
05099 {
05100 case '/':
05101 if (cppReader_peekC (pfile) == '=')
05102 {
05103 goto op2;
05104 }
05105
05106 if (opts->put_out_comments)
05107 {
05108 parseSetMark (&start_mark, pfile);
05109 }
05110
05111 newlines = 0;
05112 cppBuffer_lineAndColumn (cppReader_fileBuffer (pfile),
05113 &start_line, &start_column);
05114 c = skip_comment (pfile, &newlines);
05115
05116 if (opts->put_out_comments && (c == '/' || c == EOF))
05117 {
05118 assertSet (&start_mark);
05119 parseClearMark (&start_mark);
05120 }
05121
05122 if (c == '/')
05123 goto randomchar;
05124 if (c == EOF)
05125 {
05126 cppReader_errorWithLine (pfile, start_line, start_column,
05127 cstring_makeLiteral ("Unterminated comment"));
05128 goto handle_eof;
05129 }
05130 c = '/'; /* Initial letter of comment. */
05131 return_comment:
05132 /* Comments are equivalent to spaces.
05133 For -traditional, a comment is equivalent to nothing. */
05134
05135 if (opts->put_out_comments)
05136 {
05137 enum cpp_token res;
05138
05139 assertSet (&start_mark);
05140 res = cpp_handleComment (pfile, &start_mark);
05141 pfile->lineno += newlines;
05142 return res;
05143 }
05144 else if (cppReader_isTraditional (pfile))
05145 {
05146 return CPP_COMMENT;
05147 }
05148 else
05149 {
05150 cppReader_reserve(pfile, 1);
05151 cppReader_putCharQ (pfile, ' ');
05152 return CPP_HSPACE;
05153 }
05154
05155 case '#':
05156 if (!pfile->only_seen_white)
05157 {
05158 goto randomchar;
05159 }
05160
05161 if (cppReader_handleDirective (pfile))
05162 {
05163 return CPP_DIRECTIVE;
05164 }
05165
05166 pfile->only_seen_white = 0;
05167 return CPP_OTHER;
05168
05169 case '\"':
05170 case '\'':
05171 /* A single quoted string is treated like a double -- some
05172 programs (e.g., troff) are perverse this way */
05173 cppBuffer_lineAndColumn (cppReader_fileBuffer (pfile),
05174 &start_line, &start_column);
05175 old_written = cppReader_getWritten (pfile);
05176 string:
05177 cppReader_putChar (pfile, c);
05178 while (TRUE)
05179 {
05180 int cc = cppReader_getC (pfile);
05181 if (cc == EOF)
05182 {
05183 if (cppBuffer_isMacro (CPPBUFFER (pfile)))
05184 {
05185 /* try harder: this string crosses a macro expansion
05186 boundary. This can happen naturally if -traditional.
05187 Otherwise, only -D can make a macro with an unmatched
05188 quote. */
05189 cppBuffer *next_buf
05190 = cppBuffer_prevBuffer (cppReader_getBuffer (pfile));
05191 (*cppReader_getBuffer (pfile)->cleanup)
05192 (cppReader_getBuffer (pfile), pfile);
05193 CPPBUFFER (pfile) = next_buf;
05194 continue;
05195 }
05196 if (!cppReader_isTraditional (pfile))
05197 {
05198 cpp_setLocation (pfile);
05199
05200 setLine (long_toInt (start_line));
05201 setColumn (long_toInt (start_column));
05202
05203 if (pfile->multiline_string_line != long_toInt (start_line)
05204 && pfile->multiline_string_line != 0)
05205 {
05206 genppllerrorhint
05207 (FLG_PREPROC,
05208 message ("Unterminated string or character constant"),
05209 message ("%q: Possible real start of unterminated constant",
05210 fileloc_unparseRaw
05211 (fileloc_filename (g_currentloc),
05212 pfile->multiline_string_line)));
05213 pfile->multiline_string_line = 0;
05214 }
05215 else
05216 {
05217 genppllerror
05218 (FLG_PREPROC,
05219 message ("Unterminated string or character constant"));
05220 }
05221 }
05222 /*@loopbreak@*/ break;
05223 }
05224 cppReader_putChar (pfile, cc);
05225 switch (cc)
05226 {
05227 case '\n':
05228 /* Traditionally, end of line ends a string constant with
05229 no error. So exit the loop and record the new line. */
05230 if (cppReader_isTraditional (pfile))
05231 goto while2end;
05232 if (c == '\'')
05233 {
05234 goto while2end;
05235 }
05236 if (cppReader_isPedantic (pfile)
05237 && pfile->multiline_string_line == 0)
05238 {
05239 cppReader_pedwarnWithLine
05240 (pfile, long_toInt (start_line),
05241 long_toInt (start_column),
05242 cstring_makeLiteral ("String constant runs past end of line"));
05243 }
05244 if (pfile->multiline_string_line == 0)
05245 {
05246 pfile->multiline_string_line = start_line;
05247 }
05248
05249 /*@switchbreak@*/ break;
05250
05251 case '\\':
05252 cc = cppReader_getC (pfile);
05253 if (cc == '\n')
05254 {
05255 /* Backslash newline is replaced by nothing at all. */
05256 cppReader_adjustWritten (pfile, -1);
05257 pfile->lineno++;
05258 }
05259 else
05260 {
05261 /* ANSI stupidly requires that in \\ the second \
05262 is *not* prevented from combining with a newline. */
05263 NEWLINE_FIX1(cc);
05264 if (cc != EOF)
05265 cppReader_putChar (pfile, cc);
05266 }
05267 /*@switchbreak@*/ break;
05268
05269 case '\"':
05270 case '\'':
05271 if (cc == c)
05272 goto while2end;
05273 /*@switchbreak@*/ break;
05274 }
05275 }
05276 while2end:
05277 pfile->lineno += count_newlines (pfile->token_buffer + old_written,
05278 cppReader_getPWritten (pfile));
05279 pfile->only_seen_white = 0;
05280 return c == '\'' ? CPP_CHAR : CPP_STRING;
05281
05282 case '$':
05283 if (!opts->dollars_in_ident)
05284 goto randomchar;
05285 goto letter;
05286
05287 case ':':
05288 if (opts->cplusplus && cppReader_peekC (pfile) == ':')
05289 goto op2;
05290 goto randomchar;
05291
05292 case '&':
05293 case '+':
05294 case '|':
05295 NEWLINE_FIX;
05296 c2 = cppReader_peekC (pfile);
05297 if (c2 == c || c2 == '=')
05298 goto op2;
05299 goto randomchar;
05300
05301 case '*':
05302 case '!':
05303 case '%':
05304 case '=':
05305 case '^':
05306 NEWLINE_FIX;
05307 if (cppReader_peekC (pfile) == '=')
05308 goto op2;
05309 goto randomchar;
05310
05311 case '-':
05312 NEWLINE_FIX;
05313 c2 = cppReader_peekC (pfile);
05314 if (c2 == '-' && opts->chill)
05315 {
05316 /* Chill style comment */
05317 if (opts->put_out_comments)
05318 {
05319 parseSetMark (&start_mark, pfile);
05320 }
05321
05322 cppReader_forward (pfile, 1); /* Skip second '-'. */
05323
05324 for (;;)
05325 {
05326 c = cppReader_getC (pfile);
05327 if (c == EOF)
05328 /*@loopbreak@*/ break;
05329 if (c == '\n')
05330 {
05331 /* Don't consider final '\n' to be part of comment. */
05332 cppReader_forward (pfile, -1);
05333 /*@loopbreak@*/ break;
05334 }
05335 }
05336 c = '-';
05337 goto return_comment;
05338 }
05339 if (c2 == '-' || c2 == '=' || c2 == '>')
05340 goto op2;
05341 goto randomchar;
05342
05343 case '<':
05344 if (pfile->parsing_include_directive)
05345 {
05346 for (;;)
05347 {
05348 cppReader_putChar (pfile, c);
05349 if (c == '>')
05350 /*@loopbreak@*/ break;
05351 c = cppReader_getC (pfile);
05352 NEWLINE_FIX1 (c);
05353 if (c == '\n' || c == EOF)
05354 {
05355 cppReader_errorLit (pfile,
05356 cstring_makeLiteralTemp ("Missing '>' in \"#include <FILENAME>\""));
05357 /*@loopbreak@*/ break;
05358 }
05359 }
05360 return CPP_STRING;
05361 }
05362 /*@fallthrough@*/
05363 case '>':
05364 NEWLINE_FIX;
05365 c2 = cppReader_peekC (pfile);
05366 if (c2 == '=')
05367 goto op2;
05368 if (c2 != c)
05369 goto randomchar;
05370 cppReader_forward (pfile, 1);
05371 cppReader_reserve (pfile, 4);
05372 cppReader_putChar (pfile, c);
05373 cppReader_putChar (pfile, c2);
05374 NEWLINE_FIX;
05375 c3 = cppReader_peekC (pfile);
05376 if (c3 == '=')
05377 cppReader_putCharQ (pfile, cppReader_getC (pfile));
05378 cppReader_nullTerminateQ (pfile);
05379 pfile->only_seen_white = 0;
05380 return CPP_OTHER;
05381
05382 case '@':
05383 if (cppReader_getBuffer (pfile)->has_escapes)
05384 {
05385 c = cppReader_getC (pfile);
05386 if (c == '-')
05387 {
05388 if (pfile->output_escapes)
05389 cppReader_puts (pfile, "@-", 2);
05390 parse_name (pfile, cppReader_getC (pfile));
05391 return CPP_NAME;
05392 }
05393 else if (is_space [c])
05394 {
05395 cppReader_reserve (pfile, 2);
05396 if (pfile->output_escapes)
05397 cppReader_putCharQ (pfile, '@');
05398 cppReader_putCharQ (pfile, c);
05399 return CPP_HSPACE;
05400 }
05401 else
05402 {
05403 ;
05404 }
05405 }
05406 if (pfile->output_escapes)
05407 {
05408 cppReader_puts (pfile, "@@", 2);
05409 return CPP_OTHER;
05410 }
05411 goto randomchar;
05412 case '.':
05413 NEWLINE_FIX;
05414 c2 = cppReader_peekC (pfile);
05415 if (isdigit(c2))
05416 {
05417 cppReader_reserve(pfile, 2);
05418 cppReader_putCharQ (pfile, '.');
05419 c = cppReader_getC (pfile);
05420 goto number;
05421 }
05422
05423 /* FIXME - misses the case "..\\\n." */
05424 if (c2 == '.' && cpp_peekN (pfile, 1) == '.')
05425 {
05426 cppReader_reserve(pfile, 4);
05427 cppReader_putCharQ (pfile, '.');
05428 cppReader_putCharQ (pfile, '.');
05429 cppReader_putCharQ (pfile, '.');
05430 cppReader_forward (pfile, 2);
05431 cppReader_nullTerminateQ (pfile);
05432 pfile->only_seen_white = 0;
05433 return CPP_3DOTS;
05434 }
05435 goto randomchar;
05436 op2:
05437 token = CPP_OTHER;
05438 pfile->only_seen_white = 0;
05439 op2any:
05440 cppReader_reserve(pfile, 3);
05441 cppReader_putCharQ (pfile, c);
05442 cppReader_putCharQ (pfile, cppReader_getC (pfile));
05443 cppReader_nullTerminateQ (pfile);
05444 return token;
05445
05446 case 'L':
05447 NEWLINE_FIX;
05448 c2 = cppReader_peekC (pfile);
05449 if ((c2 == '\'' || c2 == '\"') && !cppReader_isTraditional (pfile))
05450 {
05451 cppReader_putChar (pfile, c);
05452 c = cppReader_getC (pfile);
05453 goto string;
05454 }
05455 goto letter;
05456
05457 case '0': case '1': case '2': case '3': case '4':
05458 case '5': case '6': case '7': case '8': case '9':
05459 number:
05460 c2 = '.';
05461 for (;;)
05462 {
05463 cppReader_reserve (pfile, 2);
05464 cppReader_putCharQ (pfile, c);
05465 NEWLINE_FIX;
05466 c = cppReader_peekC (pfile);
05467 if (c == EOF)
05468 /*@loopbreak@*/ break;
05469 if (!is_idchar[c] && c != '.'
05470 && ((c2 != 'e' && c2 != 'E'
05471 && ((c2 != 'p' && c2 != 'P') || cppReader_isC89 (pfile)))
05472 || (c != '+' && c != '-')))
05473 /*@loopbreak@*/ break;
05474 cppReader_forward (pfile, 1);
05475 c2= c;
05476 }
05477
05478 cppReader_nullTerminateQ (pfile);
05479 pfile->only_seen_white = 0;
05480 return CPP_NUMBER;
05481
05482 case 'b': case 'c': case 'd': case 'h': case 'o':
05483 case 'B': case 'C': case 'D': case 'H': case 'O':
05484 if (opts->chill && cppReader_peekC (pfile) == '\'')
05485 {
05486 pfile->only_seen_white = 0;
05487 cppReader_reserve (pfile, 2);
05488 cppReader_putCharQ (pfile, c);
05489 cppReader_putCharQ (pfile, '\'');
05490 cppReader_forward (pfile, 1);
05491 for (;;)
05492 {
05493 c = cppReader_getC (pfile);
05494 if (c == EOF)
05495 goto chill_number_eof;
05496 if (!is_idchar[c])
05497 {
05498 if (c == '\\' && cppReader_peekC (pfile) == '\n')
05499 {
05500 cppReader_forward (pfile, 2);
05501 continue;
05502 }
05503 /*@loopbreak@*/ break;
05504 }
05505 cppReader_putChar (pfile, c);
05506 }
05507 if (c == '\'')
05508 {
05509 cppReader_reserve (pfile, 2);
05510 cppReader_putCharQ (pfile, c);
05511 cppReader_nullTerminateQ (pfile);
05512 return CPP_STRING;
05513 }
05514 else
05515 {
05516 cppReader_forward (pfile, -1);
05517 chill_number_eof:
05518 cppReader_nullTerminate (pfile);
05519 return CPP_NUMBER;
05520 }
05521 }
05522 else
05523 goto letter;
05524 case '_':
05525 case 'a': case 'e': case 'f': case 'g': case 'i': case 'j':
05526 case 'k': case 'l': case 'm': case 'n': case 'p': case 'q':
05527 case 'r': case 's': case 't': case 'u': case 'v': case 'w':
05528 case 'x': case 'y': case 'z':
05529 case 'A': case 'E': case 'F': case 'G': case 'I': case 'J':
05530 case 'K': case 'M': case 'N': case 'P': case 'Q': case 'R':
05531 case 'S': case 'T': case 'U': case 'V': case 'W': case 'X':
05532 case 'Y': case 'Z':
05533 letter:
05534 {
05535 HASHNODE *hp;
05536 char *ident;
05537 size_t before_name_written = cppReader_getWritten (pfile);
05538 int ident_len;
05539 parse_name (pfile, c);
05540 pfile->only_seen_white = 0;
05541 if (pfile->no_macro_expand)
05542 {
05543 return CPP_NAME;
05544 }
05545
05546 ident = pfile->token_buffer + before_name_written;
05547 ident_len = (cppReader_getPWritten (pfile)) - ident;
05548
05549 hp = cppReader_lookupExpand (ident, ident_len, -1);
05550
05551 if (hp == NULL)
05552 {
05553 return CPP_NAME;
05554 }
05555
05556 if (hp->type == T_DISABLED)
05557 {
05558 if (pfile->output_escapes)
05559 { /* Return "@-IDENT", followed by '\0'. */
05560 int i;
05561 cppReader_reserve (pfile, 3);
05562 ident = pfile->token_buffer + before_name_written;
05563 cppReader_adjustWritten (pfile, 2);
05564
05565 for (i = ident_len; i >= 0; i--)
05566 {
05567 ident[i+2] = ident[i];
05568 }
05569
05570 ident[0] = '@';
05571 ident[1] = '-';
05572 }
05573 return CPP_NAME;
05574 }
05575
05576 /* If macro wants an arglist, verify that a '(' follows.
05577 first skip all whitespace, copying it to the output
05578 after the macro name. Then, if there is no '(',
05579 decide this is not a macro call and leave things that way. */
05580
05581 if (hp->type == T_MACRO && hp->value.defn->nargs >= 0)
05582 {
05583 struct parse_marker macro_mark;
05584 int is_macro_call;
05585
05586 while (cppBuffer_isMacro (CPPBUFFER (pfile)))
05587 {
05588 cppBuffer *next_buf;
05589 cppSkipHspace (pfile);
05590 if (cppReader_peekC (pfile) != EOF)
05591 {
05592 /*@loopbreak@*/ break;
05593 }
05594
05595 next_buf = cppBuffer_prevBuffer (cppReader_getBuffer (pfile));
05596 (*cppReader_getBuffer (pfile)->cleanup) (cppReader_getBuffer (pfile), pfile);
05597 CPPBUFFER (pfile) = next_buf;
05598 }
05599
05600 parseSetMark (¯o_mark, pfile);
05601
05602 for (;;)
05603 {
05604 cppSkipHspace (pfile);
05605 c = cppReader_peekC (pfile);
05606 is_macro_call = c == '(';
05607 if (c != '\n')
05608 /*@loopbreak@*/ break;
05609 cppReader_forward (pfile, 1);
05610 }
05611
05612 if (!is_macro_call)
05613 {
05614 parseGotoMark (¯o_mark, pfile);
05615 }
05616
05617 parseClearMark (¯o_mark);
05618
05619 if (!is_macro_call)
05620 {
05621 return CPP_NAME;
05622 }
05623 }
05624 /* This is now known to be a macro call. */
05625
05626 /* it might not actually be a macro. */
05627 if (hp->type != T_MACRO)
05628 {
05629 size_t xbuf_len;
05630 char *xbuf;
05631
05632 cppReader_setWritten (pfile, before_name_written);
05633 special_symbol (hp, pfile);
05634 xbuf_len = cppReader_getWritten (pfile) - before_name_written;
05635 xbuf = (char *) dmalloc (xbuf_len + 1);
05636 cppReader_setWritten (pfile, before_name_written);
05637 memcpy (xbuf, cppReader_getPWritten (pfile), xbuf_len + 1);
05638 push_macro_expansion (pfile, xbuf, xbuf_len, hp);
05639 }
05640 else
05641 {
05642 /* Expand the macro, reading arguments as needed,
05643 and push the expansion on the input stack. */
05644 macroexpand (pfile, hp);
05645 cppReader_setWritten (pfile, before_name_written);
05646 }
05647
05648 /* An extra "@ " is added to the end of a macro expansion
05649 to prevent accidental token pasting. We prefer to avoid
05650 unneeded extra spaces (for the sake of cpp-using tools like
05651 imake). Here we remove the space if it is safe to do so. */
05652
05653 llassert (pfile->buffer->rlimit != NULL);
05654
05655 if (pfile->buffer->rlimit - pfile->buffer->cur >= 3
05656 && pfile->buffer->rlimit[-2] == '@'
05657 && pfile->buffer->rlimit[-1] == ' ')
05658 {
05659 int c1 = pfile->buffer->rlimit[-3];
05660 int cl2 = cppBufPeek (cppBuffer_prevBuffer (CPPBUFFER (pfile)));
05661
05662 if (cl2 == EOF || !unsafe_chars ((char) c1, (char) cl2))
05663 pfile->buffer->rlimit -= 2;
05664 }
05665 }
05666 goto get_next;
05667
05668 case ' ': case '\t': case '\v': case '\r':
05669 for (;;)
05670 {
05671 cppReader_putChar (pfile, c);
05672 c = cppReader_peekC (pfile);
05673 if (c == EOF || !is_hor_space[c])
05674 /*@loopbreak@*/ break;
05675 cppReader_forward (pfile, 1);
05676 }
05677 return CPP_HSPACE;
05678
05679 case '\\':
05680 c2 = cppReader_peekC (pfile);
05681 if (c2 != '\n')
05682 goto randomchar;
05683 token = CPP_HSPACE;
05684 goto op2any;
05685
05686 case '\n':
05687 cppReader_putChar (pfile, c);
05688 if (pfile->only_seen_white == 0)
05689 pfile->only_seen_white = 1;
05690 pfile->lineno++;
05691 output_line_command (pfile, 1, same_file);
05692 return CPP_VSPACE;
05693
05694 case '(': token = CPP_LPAREN; goto char1;
05695 case ')': token = CPP_RPAREN; goto char1;
05696 case '{': token = CPP_LBRACE; goto char1;
05697 case '}': token = CPP_RBRACE; goto char1;
05698 case ',': token = CPP_COMMA; goto char1;
05699 case ';': token = CPP_SEMICOLON; goto char1;
05700
05701 randomchar:
05702 default:
05703 token = CPP_OTHER;
05704 char1:
05705 pfile->only_seen_white = 0;
05706 cppReader_putChar (pfile, c);
05707 return token;
05708 }
05709 }
05710
05711 BADBRANCH;
05712 /*@notreached@*/
05713 }
|
|
|
Definition at line 870 of file cpplib.c. Referenced by cppReader_initMod(). 00871 {
00872 memset ((char *) opts, 0, sizeof *opts);
00873 assertSet (opts);
00874
00875 opts->in_fname = NULL;
00876 opts->out_fname = NULL;
00877
00878 /* Initialize is_idchar to allow $. */
00879 opts->dollars_in_ident = TRUE;
00880
00881 opts->no_line_commands = 0;
00882 opts->no_trigraphs = TRUE;
00883 opts->put_out_comments = 1;
00884 opts->print_include_names = 0;
00885 opts->dump_macros = DUMP_DEFINITIONS; /* DUMP_NONE; */
00886 opts->no_output = 0;
00887 opts->cplusplus = 0;
00888
00889 opts->cplusplus_comments = 1;
00890 opts->verbose = 0;
00891 opts->lang_asm = 0;
00892 opts->for_lint = 0;
00893 opts->chill = 0;
00894 opts->pedantic_errors = 0;
00895 opts->inhibit_warnings = 0;
00896 opts->warn_comments = 0;
00897 opts->warnings_are_errors = 0;
00898
00899 initialize_char_syntax (opts);
00900 }
|
|
|
Definition at line 771 of file cpplib.c. Referenced by cppAddIncludeDir(), and cppReader_initializeReader(). 00772 {
00773 struct cppOptions *opts = CPPOPTIONS (pfile);
00774
00775 if (dir == 0)
00776 {
00777 return;
00778 }
00779
00780 if (opts->include == 0)
00781 {
00782 opts->include = dir;
00783 }
00784 else
00785 {
00786 llassert (opts->last_include->next == NULL);
00787 opts->last_include->next = dir;
00788 }
00789
00790 if (opts->first_bracket_include == 0)
00791 {
00792 int len = cstring_length (dir->fname) + INCLUDE_LEN_FUDGE;
00793 opts->first_bracket_include = dir;
00794 if (len > pfile->max_include_len)
00795 {
00796 pfile->max_include_len = len;
00797 }
00798 }
00799
00800 dir->next = NULL;
00801 opts->last_include = dir;
00802 /* cppReader_showIncludeChain (pfile); */
00803 }
|
|
|
Definition at line 1967 of file cpplib.c. Referenced by REST_EXTENSION_LENGTH(), and cppDoUndefine(). 01970 {
01971 char *p;
01972 size_t sym_length;
01973
01974 for (p = symname; is_idchar[(int) *p]; p++)
01975 {
01976 ;
01977 }
01978
01979 sym_length = size_fromInt (p - symname);
01980
01981 if (sym_length == 0
01982 || (sym_length == 1 && *symname == 'L' && (*p == '\'' || *p == '"')))
01983 cppReader_error (pfile, message ("invalid %s name", usage));
01984 else if (!is_idstart[(int) *symname])
01985 {
01986 char *msg = (char *) dmalloc (sym_length + 1);
01987 memcpy (msg, symname, sym_length);
01988 msg[sym_length] = '\0';
01989 cppReader_error (pfile, message ("invalid %s name `%s'", usage,
01990 cstring_fromChars (msg)));
01991 sfree (msg);
01992 }
01993 else
01994 {
01995 if ((strncmp (symname, "defined", 7) == 0) && sym_length == 7)
01996 {
01997 cppReader_error (pfile, message ("invalid %s name `defined'", usage));
01998 }
01999 }
02000
02001 return size_toInt (sym_length);
02002 }
|
|
|
Definition at line 613 of file cpplib.c. Referenced by cppDoDefine(), and cppReader_initializeReader(). 00614 {
00615 char *buf = NULL;
00616 char *p = str;
00617
00618 DPRINTF (("Cpp reader define: %s", str));
00619
00620 if (!is_idstart[(int) *p])
00621 {
00622 DPRINTF (("ERROR 1"));
00623 cppReader_error (pfile,
00624 message ("Malformed option `-D%s'",
00625 cstring_fromChars (str)));
00626
00627 return;
00628 }
00629
00630 p++;
00631
00632 DPRINTF (("Here 2"));
00633
00634 while (is_idchar[(int) *p])
00635 {
00636 p++;
00637 }
00638
00639 if (*p == '(') {
00640 p++;
00641 while (*p != ')' && *p != '\0') {
00642 p++;
00643 }
00644
00645 if (*p == ')') {
00646 p++;
00647 } else {
00648 cppReader_error
00649 (pfile,
00650 message ("Malformed option: -D%s (no closing parenthesis)",
00651 cstring_fromChars (str)));
00652 }
00653 }
00654
00655 DPRINTF (("Here 2"));
00656
00657 if (*p == '\0')
00658 {
00659 buf = (char *) dmalloc (size_fromInt (p - str + 4));
00660 strcpy ((char *) buf, str);
00661 strcat ((char *) buf, " 1");
00662 }
00663 else if (*p != '=')
00664 {
00665 DPRINTF (("ERROR 2"));
00666 cppReader_error (pfile,
00667 message ("Malformed option: -D%s (expected '=', found '%c')",
00668 cstring_fromChars (str),
00669 *p));
00670 return;
00671 }
00672 else
00673 {
00674 char *q;
00675 /* Copy the entire option so we can modify it. */
00676 DPRINTF (("Copying..."));
00677 buf = (char *) dmalloc (2 * strlen (str) + 1);
00678 strncpy (buf, str, size_fromInt (p - str));
00679
00680 /* Change the = to a space. */
00681 buf[p - str] = ' ';
00682 /* Scan for any backslash-newline and remove it. */
00683 p++;
00684 q = &buf[p - str];
00685
00686 while (*p != '\0')
00687 {
00688 if (*p == '\\' && p[1] == '\n')
00689 p += 2;
00690 else
00691 *q++ = *p++;
00692 }
00693
00694 DPRINTF (("Here we are..."));
00695 *q = '\0';
00696 }
00697
00698 llassert (buf != NULL);
00699 DPRINTF (("Do define: %s / %ld", buf, size_toLong (strlen (buf))));
00700 (void) do_define (pfile, NULL, buf, buf + strlen (buf));
00701 sfree (buf);
00702 }
|
|
|
Definition at line 2438 of file cpplib.c. Referenced by cppReader_errorWithLine(). 02439 {
02440 cppBuffer *ip = cppReader_getBuffer (pfile);
02441
02442 for ( ;
02443 ip != NULL && ip != cppReader_nullBuffer (pfile);
02444 ip = cppBuffer_prevBuffer (ip))
02445 {
02446 if (ip->fname != NULL)
02447 {
02448 return ip;
02449 }
02450 }
02451
02452 return NULL;
02453 }
|
|
|
Definition at line 6206 of file cpplib.c. Referenced by cppProcess(). 06207 {
06208 ;
06209 }
|
|
|
Definition at line 6714 of file cpplib.c. 06715 {
06716 llassert (pfile->buffer != NULL);
06717 return pfile->buffer;
06718 }
|
|
|
Definition at line 596 of file cpplib.c. 00597 {
00598 size_t old_written = cppReader_getWritten (pfile);
00599 pfile->token_buffer_size = n + 2 * pfile->token_buffer_size;
00600 pfile->token_buffer = (char *)
00601 drealloc (pfile->token_buffer, pfile->token_buffer_size);
00602 cppReader_setWritten (pfile, old_written);
00603 }
|
|
|
Definition at line 6184 of file cpplib.c. Referenced by cppReader_initMod(). 06185 {
06186 memset ((char *) pfile, 0, sizeof (*pfile));
06187
06188 pfile->get_token = cppGetToken;
06189 pfile->token_buffer_size = 200;
06190 pfile->token_buffer = (char *) dmalloc (pfile->token_buffer_size);
06191 pfile->all_include_files = NULL;
06192
06193 assertSet (pfile);
06194
06195 cppReader_setWritten (pfile, 0);
06196
06197 pfile->system_include_depth = 0;
06198 pfile->max_include_len = 0;
06199 pfile->timebuf = NULL;
06200 pfile->only_seen_white = 1;
06201
06202 pfile->buffer = cppReader_nullBuffer (pfile);
06203 }
|
|
|
Definition at line 6379 of file cpplib.c. Referenced by cppReader_initialize(). 06380 {
06381 struct cppOptions *opts = CPPOPTIONS (pfile);
06382 char *xp;
06383
06384 /* The code looks at the defaults through this pointer, rather than through
06385 the constant structure above. This pointer gets changed if an environment
06386 variable specifies other defaults. */
06387
06388 struct default_include *include_defaults = include_defaults_array;
06389
06390 /* Add dirs from CPATH after dirs from -I. */
06391 /* There seems to be confusion about what CPATH should do,
06392 so for the moment it is not documented. */
06393 /* Some people say that CPATH should replace the standard include dirs,
06394 but that seems pointless: it comes before them, so it overrides them
06395 anyway. */
06396
06397 xp = (char *) getenv ("CPATH");
06398
06399 if (xp != 0 && ! opts->no_standard_includes)
06400 {
06401 path_include (pfile, xp);
06402 }
06403
06404 /* Now that dollars_in_ident is known, initialize is_idchar. */
06405 initialize_char_syntax (opts);
06406
06407 /* CppReader_Install __LINE__, etc. Must follow initialize_char_syntax
06408 and option processing. */
06409
06410 initialize_builtins (pfile);
06411
06412 /* Do standard #defines and assertions
06413 that identify system and machine type. */
06414
06415 if (!opts->inhibit_predefs) {
06416 char *p = (char *) dmalloc (strlen (predefs) + 1);
06417 strcpy (p, predefs);
06418
06419 while (*p)
06420 {
06421 char *q;
06422
06423 while (*p == ' ' || *p == '\t')
06424 {
06425 p++;
06426 }
06427
06428 /* Handle -D options. */
06429 if (p[0] == '-' && p[1] == 'D')
06430 {
06431 q = &p[2];
06432
06433 while (*p && *p != ' ' && *p != '\t')
06434 {
06435 p++;
06436 }
06437
06438 if (*p != 0)
06439 {
06440 *p++= 0;
06441 }
06442
06443 if (opts->debug_output)
06444 {
06445 output_line_command (pfile, 0, same_file);
06446 }
06447
06448 cppReader_define (pfile, q);
06449
06450 while (*p == ' ' || *p == '\t')
06451 {
06452 p++;
06453 }
06454 }
06455 else
06456 {
06457 abort ();
06458 }
06459 }
06460
06461 sfree (p);
06462 }
06463
06464 opts->done_initializing = 1;
06465
06466 { /* Read the appropriate environment variable and if it exists
06467 replace include_defaults with the listed path. */
06468 char *epath = 0;
06469 #ifdef __CYGWIN32__
06470 char *win32epath;
06471 int win32_buf_size = 0; /* memory we need to allocate */
06472 #endif
06473
06474 if (opts->cplusplus)
06475 {
06476 epath = getenv ("CPLUS_INCLUDE_PATH");
06477 }
06478 else
06479 {
06480 epath = getenv ("C_INCLUDE_PATH");
06481 }
06482
06483 /*
06484 ** If the environment var for this language is set,
06485 ** add to the default list of include directories.
06486 */
06487
06488 if (epath != NULL) {
06489 char *nstore = (char *) dmalloc (strlen (epath) + 2);
06490 int num_dirs;
06491 char *startp, *endp;
06492
06493 #ifdef __CYGWIN32__
06494 /* if we have a posix path list, convert to win32 path list */
06495 if (cygwin32_posix_path_list_p (epath))
06496 {
06497 win32_buf_size = cygwin32_posix_to_win32_path_list_buf_size (epath);
06498 win32epath = (char *) dmalloc /*@i4@*/ (win32_buf_size);
06499 cygwin32_posix_to_win32_path_list (epath, win32epath);
06500 epath = win32epath;
06501 }
06502 #endif
06503 for (num_dirs = 1, startp = epath; *startp; startp++)
06504 {
06505 if (*startp == PATH_SEPARATOR)
06506 num_dirs++;
06507 }
06508
06509 /*@-sizeoftype@*/
06510 include_defaults
06511 = (struct default_include *) dmalloc ((num_dirs
06512 * sizeof (struct default_include))
06513 + sizeof (include_defaults_array));
06514 /*@=sizeoftype@*/
06515
06516 startp = endp = epath;
06517 num_dirs = 0;
06518 while (1) {
06519 /* Handle cases like c:/usr/lib:d:/gcc/lib */
06520 if ((*endp == PATH_SEPARATOR) || *endp == 0)
06521 {
06522 strncpy (nstore, startp, size_fromInt (endp - startp));
06523 if (endp == startp)
06524 {
06525 strcpy (nstore, ".");
06526 }
06527 else
06528 {
06529 nstore[endp-startp] = '\0';
06530 }
06531
06532 include_defaults[num_dirs].fname = cstring_fromCharsNew (nstore);
06533 include_defaults[num_dirs].cplusplus = opts->cplusplus;
06534 include_defaults[num_dirs].cxx_aware = 1;
06535 num_dirs++;
06536
06537 if (*endp == '\0')
06538 {
06539 break;
06540 }
06541 endp = startp = endp + 1;
06542 }
06543 else
06544 {
06545 endp++;
06546 }
06547 }
06548 /* Put the usual defaults back in at the end. */
06549 memcpy ((char *) &include_defaults[num_dirs],
06550 (char *) include_defaults_array,
06551 sizeof (include_defaults_array));
06552
06553 sfree (nstore);
06554 /*@-branchstate@*/ } /*@=branchstate@*/
06555 }
06556
06557 cppReader_appendIncludeChain (pfile, opts->before_system,
06558 opts->last_before_system);
06559 opts->first_system_include = opts->before_system;
06560
06561 /* Unless -fnostdinc,
06562 tack on the standard include file dirs to the specified list */
06563 if (!opts->no_standard_includes) {
06564 struct default_include *p = include_defaults;
06565 char *specd_prefix = opts->include_prefix;
06566 char *default_prefix = mstring_copy (GCC_INCLUDE_DIR);
06567 int default_len = 0;
06568
06569 /* Remove the `include' from /usr/local/lib/gcc.../include. */
06570 if (default_prefix != NULL) {
06571 if (!strcmp (default_prefix + strlen (default_prefix) - 8, "/include")) {
06572 default_len = strlen (default_prefix) - 7;
06573 default_prefix[default_len] = 0;
06574 }
06575 }
06576
06577 /* Search "translated" versions of GNU directories.
06578 These have /usr/local/lib/gcc... replaced by specd_prefix. */
06579 if (specd_prefix != 0 && default_len != 0)
06580 for (p = include_defaults; p->fname != NULL; p++) {
06581 /* Some standard dirs are only for C++. */
06582 if (!p->cplusplus
06583 || (opts->cplusplus && !opts->no_standard_cplusplus_includes)) {
06584 /* Does this dir start with the prefix? */
06585 if (!strncmp (cstring_toCharsSafe (p->fname), default_prefix,
06586 size_fromInt (default_len)))
06587 {
06588 /* Yes; change prefix and add to search list. */
06589 struct file_name_list *nlist
06590 = (struct file_name_list *) dmalloc (sizeof (*nlist));
06591 size_t this_len = strlen (specd_prefix) + cstring_length (p->fname) - default_len;
06592 char *str = (char *) dmalloc (this_len + 1);
06593 strcpy (str, specd_prefix);
06594 strcat (str, cstring_toCharsSafe (p->fname) + default_len);
06595
06596 nlist->next = NULL;
06597 nlist->fname = cstring_fromChars (str);
06598 nlist->control_macro = 0;
06599 nlist->c_system_include_path = !p->cxx_aware;
06600 nlist->got_name_map = 0;
06601
06602 cppReader_addIncludeChain (pfile, nlist);
06603 if (opts->first_system_include == 0)
06604 {
06605 opts->first_system_include = nlist;
06606 }
06607 }
06608 }
06609 }
06610
06611 /* Search ordinary names for GNU include directories. */
06612
06613 for (p = include_defaults; p->fname != NULL; p++)
06614 {
06615 /* Some standard dirs are only for C++. */
06616 if (!p->cplusplus
06617 || (opts->cplusplus && !opts->no_standard_cplusplus_includes))
06618 {
06619 struct file_name_list *nlist
06620 = (struct file_name_list *) dmalloc (sizeof (*nlist));
06621 nlist->control_macro = 0;
06622 nlist->c_system_include_path = !p->cxx_aware;
06623 nlist->fname = p->fname;
06624 nlist->got_name_map = 0;
06625 nlist->next = NULL;
06626
06627 cppReader_addIncludeChain (pfile, nlist);
06628
06629 if (opts->first_system_include == 0)
06630 {
06631 opts->first_system_include = nlist;
06632 }
06633 }
06634 }
06635 sfree (default_prefix);
06636 }
06637
06638 /* Tack the after_include chain at the end of the include chain. */
06639 cppReader_appendIncludeChain (pfile, opts->after_include,
06640 opts->last_after_include);
06641
06642 if (opts->first_system_include == 0)
06643 {
06644 opts->first_system_include = opts->after_include;
06645 }
06646
06647 /* With -v, print the list of dirs to search. */
06648 if (opts->verbose) {
06649 struct file_name_list *p;
06650 fprintf (stderr, "#include \"...\" search starts here:\n");
06651
06652 for (p = opts->include; p != NULL; p = p->next) {
06653 if (p == opts->first_bracket_include)
06654 fprintf (stderr, "#include <...> search starts here:\n");
06655
06656 fprintf (stderr, " %s\n", cstring_toCharsSafe (p->fname));
06657 }
06658 fprintf (stderr, "End of search list.\n");
06659 }
06660 }
|
|
|
Definition at line 2287 of file cpplib.c. Referenced by cppCleanup(), and cppGetToken(). 02288 {
02289 cppBuffer *buf = CPPBUFFER (pfile);
02290
02291 llassert (buf != NULL);
02292
02293 (void) (*buf->cleanup) (buf, pfile);
02294 return ++CPPBUFFER (pfile);
02295 }
|
|
|
Definition at line 1172 of file cpplib.c. Referenced by FNAME_HASHSIZE(), and cppReader_parseExpression(). 01173 {
01174 size_t old = cppReader_getWritten (pfile);
01175 copy_rest_of_line (pfile);
01176 cppReader_setWritten (pfile, old);
01177 }
|
|
|
Definition at line 6662 of file cpplib.c. Referenced by cppProcess(). 06663 {
06664 cppBuffer *fp;
06665 int f;
06666 struct cppOptions *opts = CPPOPTIONS (pfile);
06667
06668 fp = cppReader_pushBuffer (pfile, NULL, 0);
06669
06670 if (fp == NULL)
06671 {
06672 return 0;
06673 }
06674
06675 if (opts->in_fname == NULL)
06676 {
06677 opts->in_fname = cstring_makeLiteralTemp ("");
06678 }
06679
06680 fp->fname = opts->in_fname;
06681 fp->nominal_fname = fp->fname;
06682 fp->lineno = 0;
06683
06684 /* Copy the entire contents of the main input file into
06685 the stacked input buffer previously allocated for it. */
06686
06687 if (cstring_isEmpty (fname))
06688 {
06689 fname = cstring_makeLiteralTemp ("");
06690 f = 0;
06691 }
06692 else if ((f = open (cstring_toCharsSafe (fname), O_RDONLY, 0666)) < 0)
06693 {
06694 cppReader_pfatalWithName (pfile, fname);
06695 }
06696 else
06697 {
06698 ;
06699 }
06700
06701 if (finclude (pfile, f, fname, 0, NULL))
06702 {
06703 output_line_command (pfile, 0, same_file);
06704 }
06705
06706 return 1;
06707 }
|
|
|
Definition at line 1043 of file cpplib.c. Referenced by cppGetToken(). 01044 {
01045 int nspaces = 0;
01046
01047 while (TRUE)
01048 {
01049 int c;
01050
01051 llassert (pfile->buffer != NULL);
01052
01053 c = cppReader_peekC (pfile);
01054
01055 if (c == EOF)
01056 {
01057 return 0; /* FIXME */
01058 }
01059
01060 if (is_hor_space[c])
01061 {
01062 if ((c == '\f' || c == '\v') && cppReader_isPedantic (pfile))
01063 cppReader_pedwarn (pfile,
01064 message ("%s in preprocessing directive",
01065 c == '\f'
01066 ? cstring_makeLiteralTemp ("formfeed")
01067 : cstring_makeLiteralTemp ("vertical tab")));
01068
01069 nspaces++;
01070 cppReader_forward (pfile, 1);
01071 }
01072 else if (c == '/')
01073 {
01074 cppReader_forward (pfile, 1);
01075 c = skip_comment (pfile, NULL);
01076
01077 if (c == '/')
01078 {
01079 cppReader_forward (pfile, -1);
01080 }
01081
01082 if (c == EOF || c == '/')
01083 {
01084 return nspaces;
01085 }
01086 }
01087 else if (c == '\\' && cpp_peekN (pfile, 1) == '\n')
01088 {
01089 cppReader_forward (pfile, 2);
01090 }
01091 else if (c == '@' && CPPBUFFER (pfile)->has_escapes
01092 && is_hor_space [cpp_peekN (pfile, 1)])
01093 {
01094 cppReader_forward (pfile, 2);
01095 }
01096 else
01097 {
01098 return nspaces;
01099 }
01100 }
01101 }
|
|
|
Definition at line 550 of file cpplib.c. Referenced by cppReader_install(), and cppReader_lookup(). 00551 {
00552 return is_idchar[(int) c];
00553 }
|
1.2.3 written by Dimitri van Heesch,
© 1997-2000