From aeeef390ae8113bece9ea60e99244da011e5c20d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20H=C3=BCbinette=20=28Hubbe=29?= <hubbe@hubbe.net> Date: Fri, 16 Jan 1998 15:02:40 -0800 Subject: [PATCH] line number bugg fixed Rev: src/cpp.c:1.8 Rev: src/lex.c:1.39 Rev: src/program.c:1.50 --- src/cpp.c | 6 +++++- src/lex.c | 6 +++--- src/program.c | 4 ++-- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/cpp.c b/src/cpp.c index 639798556d..c644dbea26 100644 --- a/src/cpp.c +++ b/src/cpp.c @@ -256,7 +256,6 @@ static void simple_add_define(struct cpp *this, fflush(stderr) #define FIND_EOL() do { \ - this->current_line++; \ while(pos < len && data[pos]!='\n') pos++; \ } while(0) @@ -753,6 +752,8 @@ static INT32 low_cpp(struct cpp *this, { char *foo=data+pos; this->current_line=STRTOL(foo, &foo, 10)-1; + low_my_putchar('#',&this->buf); + low_my_binary_strcat(data+pos, foo-(data+pos), &this->buf); pos=foo-data; SKIPSPACE(); @@ -765,6 +766,9 @@ static INT32 low_cpp(struct cpp *this, free_string(this->current_file); this->current_file=low_free_buf(&nf); + + low_my_putchar(' ',&this->buf); + PUSH_STRING(this->current_file->str,this->current_file->len,&this->buf); } FIND_EOL(); diff --git a/src/lex.c b/src/lex.c index 9f75ab5257..5ded11d4a5 100644 --- a/src/lex.c +++ b/src/lex.c @@ -4,7 +4,7 @@ ||| See the files COPYING and DISCLAIMER for more information. \*/ #include "global.h" -RCSID("$Id: lex.c,v 1.38 1998/01/16 22:33:04 grubba Exp $"); +RCSID("$Id: lex.c,v 1.39 1998/01/16 23:02:39 hubbe Exp $"); #include "language.h" #include "array.h" #include "lex.h" @@ -429,9 +429,9 @@ int yylex(YYSTYPE *yylval) t=yylex2(yylval); if(t<256) { - fprintf(stderr,"yylex() -> '%c' (%d)\n",t,t); + fprintf(stderr,"YYLEX: '%c' (%d) at %s:%d\n",t,t,lex.current_file->str,lex.current_line); }else{ - fprintf(stderr,"yylex() -> %s (%d)\n",get_f_name(t),t); + fprintf(stderr,"YYLEX: %s (%d) at %s:%d\n",low_get_f_name(t,0),t,lex.current_file->str,lex.current_line); } return t; } diff --git a/src/program.c b/src/program.c index 275188c71a..a89e745385 100644 --- a/src/program.c +++ b/src/program.c @@ -4,7 +4,7 @@ ||| See the files COPYING and DISCLAIMER for more information. \*/ #include "global.h" -RCSID("$Id: program.c,v 1.49 1998/01/14 07:53:52 hubbe Exp $"); +RCSID("$Id: program.c,v 1.50 1998/01/16 23:02:40 hubbe Exp $"); #include "program.h" #include "object.h" #include "dynamic_buffer.h" @@ -1632,7 +1632,7 @@ static void insert_small_number(INT32 a) { add_to_linenumbers(a); }else if(a>=-32768 && a<32768){ - add_to_linenumbers(a); + add_to_linenumbers(-127); ins_short(a, add_to_linenumbers); }else{ add_to_linenumbers(-128); -- GitLab