From 38804d6c3986f81f8a64a2a321e3e3f795a3be9e Mon Sep 17 00:00:00 2001 From: Peter Johnson Date: Thu, 2 Nov 2006 07:44:09 +0000 Subject: [PATCH] Remove some unused yasm_scanner variables, and properly document the remaining ones. svn path=/trunk/yasm/; revision=1678 --- libyasm/file.c | 6 ------ libyasm/file.h | 9 +++++++-- modules/parsers/gas/gas-token.re | 9 +-------- modules/parsers/nasm/nasm-token.re | 6 +----- 4 files changed, 9 insertions(+), 21 deletions(-) diff --git a/libyasm/file.c b/libyasm/file.c index 30515cf4..63f37b94 100644 --- a/libyasm/file.c +++ b/libyasm/file.c @@ -54,13 +54,9 @@ yasm_scanner_initialize(yasm_scanner *s) s->tok = NULL; s->ptr = NULL; s->cur = NULL; - s->pos = NULL; s->lim = NULL; s->top = NULL; s->eof = NULL; - s->tchar = 0; - s->tline = 0; - s->cline = 1; } void @@ -90,7 +86,6 @@ yasm_fill_helper(yasm_scanner *s, unsigned char **cursor, s->tok = s->bot; s->ptr -= cnt; *cursor -= cnt; - s->pos -= cnt; s->lim -= cnt; } if (!s->bot) @@ -101,7 +96,6 @@ yasm_fill_helper(yasm_scanner *s, unsigned char **cursor, s->tok = buf; s->ptr = &buf[s->ptr - s->bot]; *cursor = &buf[*cursor - s->bot]; - s->pos = &buf[s->pos - s->bot]; s->lim = &buf[s->lim - s->bot]; s->top = &s->lim[BSIZE]; if (s->bot) diff --git a/libyasm/file.h b/libyasm/file.h index d81061d2..3569dd2f 100644 --- a/libyasm/file.h +++ b/libyasm/file.h @@ -36,8 +36,13 @@ /** Re2c scanner state. */ typedef struct yasm_scanner { - unsigned char *bot, *tok, *ptr, *cur, *pos, *lim, *top, *eof; - unsigned int tchar, tline, cline; + unsigned char *bot; /**< Bottom of scan buffer */ + unsigned char *tok; /**< Start of token */ + unsigned char *ptr; /**< Scan marker */ + unsigned char *cur; /**< Cursor (1 past end of token) */ + unsigned char *lim; /**< Limit of good data */ + unsigned char *top; /**< Top of scan buffer */ + unsigned char *eof; /**< End of file */ } yasm_scanner; /** Initialize scanner state. diff --git a/modules/parsers/gas/gas-token.re b/modules/parsers/gas/gas-token.re index db08de4a..64fdebb1 100644 --- a/modules/parsers/gas/gas-token.re +++ b/modules/parsers/gas/gas-token.re @@ -46,11 +46,7 @@ RCSID("$Id$"); #define RETURN(i) {s->cur = cursor; return i;} -#define SCANINIT() { \ - s->tchar = cursor - s->pos; \ - s->tline = s->cline; \ - s->tok = cursor; \ - } +#define SCANINIT() {s->tok = cursor;} #define TOK ((char *)s->tok) #define TOKLEN (size_t)(cursor-s->tok) @@ -149,7 +145,6 @@ fill(yasm_parser_gas *parser_gas, YYCTYPE *cursor) s->tok = s->bot; s->ptr -= cnt; cursor -= cnt; - s->pos -= cnt; s->lim -= cnt; } if (!s->bot) @@ -160,7 +155,6 @@ fill(yasm_parser_gas *parser_gas, YYCTYPE *cursor) s->tok = buf; s->ptr = &buf[s->ptr - s->bot]; cursor = &buf[cursor - s->bot]; - s->pos = &buf[s->pos - s->bot]; s->lim = &buf[s->lim - s->bot]; s->top = &s->lim[BSIZE]; if (s->bot) @@ -712,7 +706,6 @@ rept_scan: s->tok = NULL; s->ptr = NULL; s->cur = NULL; - s->pos = NULL; s->lim = NULL; s->top = NULL; s->eof = NULL; diff --git a/modules/parsers/nasm/nasm-token.re b/modules/parsers/nasm/nasm-token.re index d2879a88..2dab17de 100644 --- a/modules/parsers/nasm/nasm-token.re +++ b/modules/parsers/nasm/nasm-token.re @@ -45,11 +45,7 @@ RCSID("$Id$"); #define RETURN(i) {s->cur = cursor; return i;} -#define SCANINIT() { \ - s->tchar = cursor - s->pos; \ - s->tline = s->cline; \ - s->tok = cursor; \ - } +#define SCANINIT() {s->tok = cursor;} #define TOK ((char *)s->tok) #define TOKLEN (size_t)(cursor-s->tok) -- 2.40.0