Mercurial > hg > tinycc
changeset 479:7909d3c7e712
Replace global "ch" with "fch" so it's slightly easier to grep for. (It's the
last char read from the input file by inp() which inputs a single char from the
global variable "file".)
author | Rob Landley <rob@landley.net> |
---|---|
date | Sat, 08 Sep 2007 17:30:03 -0500 |
parents | e9cd70a790dd |
children | 995cf196fe69 |
files | tcc.c tccasm.c tccelf.c |
diffstat | 3 files changed, 43 insertions(+), 43 deletions(-) [+] |
line wrap: on
line diff
--- a/tcc.c Sat Sep 08 05:09:17 2007 -0500 +++ b/tcc.c Sat Sep 08 17:30:03 2007 -0500 @@ -51,7 +51,7 @@ /* parser */ static struct BufferedFile *file; -static int ch, tok; +static int fch, tok; static CValue tokc; static CString tokcstr; /* current parsed string, if any */ /* additional informations about token */ @@ -1073,10 +1073,10 @@ /* read next char from current input file and handle end of input buffer */ static inline void inp(void) { - ch = *(++(file->buf_ptr)); + fch = *(++(file->buf_ptr)); /* end of buffer/file handling */ - if (ch == CH_EOB) - ch = handle_eob(); + if (fch == CH_EOB) + fch = handle_eob(); } /* space excluding newline */ @@ -1088,10 +1088,10 @@ /* handle '\[\r]\n' */ static int handle_stray_noerror(void) { - while (ch == '\\') { + while (fch == '\\') { inp(); - while (is_space(ch)) inp(); - if (ch == '\n') { + while (is_space(fch)) inp(); + if (fch == '\n') { file->line_num++; inp(); } else return 1; @@ -1120,7 +1120,7 @@ } else { parse_stray: file->buf_ptr = p; - ch = *p; + fch = *p; handle_stray(); p = file->buf_ptr; c = *p; @@ -1157,7 +1157,7 @@ static void minp(void) { inp(); - if (ch == '\\') + if (fch == '\\') handle_stray(); } @@ -1277,7 +1277,7 @@ static inline void skip_spaces(void) { - while (is_space(ch)) + while (is_space(fch)) cinp(); } @@ -1376,7 +1376,7 @@ if (c == CH_EOF) { expect("#endif"); } else if (c == '\\') { - ch = file->buf_ptr[0]; + fch = file->buf_ptr[0]; handle_stray_noerror(); } p = file->buf_ptr; @@ -1389,12 +1389,12 @@ /* skip comments */ case '/': file->buf_ptr = p; - ch = *p; + fch = *p; minp(); p = file->buf_ptr; - if (ch == '*') { + if (fch == '*') { p = parse_comment(p); - } else if (ch == '/') { + } else if (fch == '/') { p = parse_line_comment(p); } break; @@ -2001,21 +2001,21 @@ break; case TOK_INCLUDE: case TOK_INCLUDE_NEXT: - ch = file->buf_ptr[0]; + fch = file->buf_ptr[0]; /* XXX: incorrect if comments : use next_nomacro with a special mode */ skip_spaces(); - if (ch == '<') { + if (fch == '<') { c = '>'; goto read_name; - } else if (ch == '\"') { - c = ch; + } else if (fch == '\"') { + c = fch; read_name: /* XXX: better stray handling */ minp(); q = buf; - while (ch != c && ch != '\n' && ch != CH_EOF) { + while (fch != c && fch != '\n' && fch != CH_EOF) { if ((q - buf) < sizeof(buf) - 1) - *q++ = ch; + *q++ = fch; minp(); } *q = '\0'; @@ -2122,7 +2122,7 @@ put_stabs(file->filename, N_BINCL, 0, 0, 0); } next_tok_flags |= TOK_FLAG_BOW | TOK_FLAG_BOF | TOK_FLAG_BOL; - ch = file->buf_ptr[0]; + fch = file->buf_ptr[0]; goto the_end; } break; @@ -2212,12 +2212,12 @@ case TOK_ERROR: case TOK_WARNING: c = tok; - ch = file->buf_ptr[0]; + fch = file->buf_ptr[0]; skip_spaces(); q = buf; - while (ch != '\n' && ch != CH_EOF) { + while (fch != '\n' && fch != CH_EOF) { if ((q - buf) < sizeof(buf) - 1) - *q++ = ch; + *q++ = fch; minp(); } *q = '\0'; @@ -2689,7 +2689,7 @@ goto redo_no_start; } else { file->buf_ptr = p; - ch = *p; + fch = *p; handle_stray(); p = file->buf_ptr; goto redo_no_start; @@ -3272,10 +3272,10 @@ } } else { /* XXX: incorrect with comments */ - ch = file->buf_ptr[0]; - while (is_space(ch) || ch == '\n') + fch = file->buf_ptr[0]; + while (is_space(fch) || fch == '\n') cinp(); - t = ch; + t = fch; } if (t != '(') /* no macro subst */ return -1; @@ -8562,7 +8562,7 @@ s1->nb_errors = 0; s1->error_set_jmp_enabled = 1; - ch = file->buf_ptr[0]; + fch = file->buf_ptr[0]; next_tok_flags = TOK_FLAG_BOW | TOK_FLAG_BOL | TOK_FLAG_BOF; parse_flags = PARSE_FLAG_PREPROCESS | PARSE_FLAG_TOK_NUM; next(); @@ -8599,7 +8599,7 @@ define_start = define_stack; - ch = file->buf_ptr[0]; + fch = file->buf_ptr[0]; tok_flags = TOK_FLAG_BOL | TOK_FLAG_BOF; parse_flags = PARSE_FLAG_ASM_COMMENTS | PARSE_FLAG_PREPROCESS | PARSE_FLAG_LINEFEED; @@ -8684,7 +8684,7 @@ s1->include_stack_ptr = s1->include_stack; /* parse with define parser */ - ch = file->buf_ptr[0]; + fch = file->buf_ptr[0]; next_nomacro(); parse_define(); file = NULL;
--- a/tccasm.c Sat Sep 08 05:09:17 2007 -0500 +++ b/tccasm.c Sat Sep 08 17:30:03 2007 -0500 @@ -617,7 +617,7 @@ /* XXX: undefine C labels */ - ch = file->buf_ptr[0]; + fch = file->buf_ptr[0]; next_tok_flags = TOK_FLAG_BOW | TOK_FLAG_BOL | TOK_FLAG_BOF; parse_flags = PARSE_FLAG_ASM_COMMENTS; if (do_preprocess)
--- a/tccelf.c Sat Sep 08 05:09:17 2007 -0500 +++ b/tccelf.c Sat Sep 08 17:30:03 2007 -0500 @@ -2266,7 +2266,7 @@ char *q; redo: - switch(ch) { + switch(fch) { case ' ': case '\t': case '\f': @@ -2277,9 +2277,9 @@ goto redo; case '/': minp(); - if (ch == '*') { + if (fch == '*') { file->buf_ptr = parse_comment(file->buf_ptr); - ch = file->buf_ptr[0]; + fch = file->buf_ptr[0]; goto redo; } else { q = name; @@ -2297,13 +2297,13 @@ q = name; parse_name: for(;;) { - if (!((ch >= 'a' && ch <= 'z') || - (ch >= 'A' && ch <= 'Z') || - (ch >= '0' && ch <= '9') || - strchr("/.-_+=$:\\,~", ch))) + if (!((fch >= 'a' && fch <= 'z') || + (fch >= 'A' && fch <= 'Z') || + (fch >= '0' && fch <= '9') || + strchr("/.-_+=$:\\,~", fch))) break; if ((q - name) < name_size - 1) { - *q++ = ch; + *q++ = fch; } minp(); } @@ -2314,7 +2314,7 @@ c = LD_TOK_EOF; break; default: - c = ch; + c = fch; inp(); break; } @@ -2370,8 +2370,8 @@ char filename[1024]; int t, ret; - ch = file->buf_ptr[0]; - ch = handle_eob(); + //fch = file->buf_ptr[0]; + fch = handle_eob(); for(;;) { t = ld_next(s1, cmd, sizeof(cmd)); if (t == LD_TOK_EOF)