From 6ccb9d3502b4f2865211ada561e915c1fcba2dac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnim=20L=C3=A4uger?= Date: Thu, 21 Feb 2008 20:56:37 +0000 Subject: [PATCH] avoid error message from scanner in simple test mode git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@1073 b68d4a1b-bc3d-0410-92ed-d4ac073336b7 --- jtag/ChangeLog | 4 ++++ jtag/src/bsdl/bsdl.c | 4 +--- jtag/src/bsdl/bsdl.h | 6 ++++-- jtag/src/bsdl/bsdl_bison.y | 7 +++++-- jtag/src/bsdl/bsdl_flex.l | 17 ++++++++++------- 5 files changed, 24 insertions(+), 14 deletions(-) diff --git a/jtag/ChangeLog b/jtag/ChangeLog index a8a500f2..374bf85f 100644 --- a/jtag/ChangeLog +++ b/jtag/ChangeLog @@ -1,5 +1,9 @@ 2008-02-21 Arnim Laeuger + * src/bsdl/bsdl_bison.y, src/bsdl/bsdl.h, src/bsdl/bsdl_flex.l, src/bsdl/bsdl.c: + push mode and debug through init tree to avoid error message from scanner + in simple test mode. + * src/bus/fjmem.c: merged branches/jmem to trunk -> added fjmem bus driver diff --git a/jtag/src/bsdl/bsdl.c b/jtag/src/bsdl/bsdl.c index 62628cf1..56a80482 100644 --- a/jtag/src/bsdl/bsdl.c +++ b/jtag/src/bsdl/bsdl.c @@ -104,7 +104,7 @@ int bsdl_read_file(const char *BSDL_File_Name, int mode, const char *idcode) return -1; } - if ((parser_priv = bsdl_parser_init(BSDL_File))) { + if ((parser_priv = bsdl_parser_init(BSDL_File, mode, bsdl_debug))) { if (mode >= 0) { if (mode >= 1) { if (chain == NULL) { @@ -130,8 +130,6 @@ int bsdl_read_file(const char *BSDL_File_Name, int mode, const char *idcode) } else parser_priv->jtag_ctrl.part = NULL; - parser_priv->jtag_ctrl.mode = mode; - parser_priv->jtag_ctrl.debug = bsdl_debug; parser_priv->jtag_ctrl.idcode = NULL; bsdlparse(parser_priv); diff --git a/jtag/src/bsdl/bsdl.h b/jtag/src/bsdl/bsdl.h index 3e24037a..0327d47f 100644 --- a/jtag/src/bsdl/bsdl.h +++ b/jtag/src/bsdl/bsdl.h @@ -35,6 +35,8 @@ /* private data of the flex scanner handled internally in bsdl_flex.l as yyextra */ struct scan_extra { + int mode; + int debug; int Compile_Errors; int Base; }; @@ -137,7 +139,7 @@ typedef struct parser_priv parser_priv_t; void bsdl_msg(int, const char *, ...); /* BSDL lexer declarations */ -void *bsdl_flex_init(FILE *); +void *bsdl_flex_init(FILE *, int, int); void bsdl_flex_deinit(void *); void bsdl_flex_switch_file(void *, char *); void bsdl_flex_switch_buffer(void *, const char *); @@ -147,7 +149,7 @@ int bsdl_flex_get_lineno(void *); void bsdl_flex_set_bin_x(void *); /* BSDL parser declarations */ -parser_priv_t *bsdl_parser_init(FILE *); +parser_priv_t *bsdl_parser_init(FILE *, int, int); void bsdl_parser_deinit(parser_priv_t *); int bsdlparse(parser_priv_t *); diff --git a/jtag/src/bsdl/bsdl_bison.y b/jtag/src/bsdl/bsdl_bison.y index bb691063..201ff550 100644 --- a/jtag/src/bsdl/bsdl_bison.y +++ b/jtag/src/bsdl/bsdl_bison.y @@ -957,7 +957,7 @@ void yyerror(parser_priv_t *priv_data, const char *error_string) { } /*----------------------------------------------------------------------*/ -parser_priv_t *bsdl_parser_init(FILE *f) +parser_priv_t *bsdl_parser_init(FILE *f, int mode, int debug) { parser_priv_t *new_priv; @@ -966,11 +966,14 @@ parser_priv_t *bsdl_parser_init(FILE *f) return NULL; } + new_priv->jtag_ctrl.mode = mode; + new_priv->jtag_ctrl.debug = debug; + new_priv->Reading_Package = 0; new_priv->buffer_for_switch = NULL; new_priv->len_buffer_for_switch = 0; - if (!(new_priv->scanner = bsdl_flex_init(f))) { + if (!(new_priv->scanner = bsdl_flex_init(f, mode, debug))) { free(new_priv); new_priv = NULL; } diff --git a/jtag/src/bsdl/bsdl_flex.l b/jtag/src/bsdl/bsdl_flex.l index b25932cf..9ccaa33f 100644 --- a/jtag/src/bsdl/bsdl_flex.l +++ b/jtag/src/bsdl/bsdl_flex.l @@ -404,11 +404,12 @@ Compliance_Patterns COMPLIANCE_PATTERNS return(REAL_NUMBER);} {Concatenate} {return(CONCATENATE);} {Semicolon} {return(SEMICOLON);} -{Illegal} {bsdl_msg(BSDL_MSG_ERR, - _("Error: Illegal character %c (/%03o) at line %d:\n"), - (char)yytext[yyleng-1], (int)yytext[yyleng-1], - yylineno); - yyextra->Compile_Errors++; +{Illegal} {if (yyextra->debug || (yyextra->mode >= 0)) + bsdl_msg(BSDL_MSG_ERR, + _("Illegal character %c (/%03o) at line %d:\n"), + (char)yytext[yyleng-1], (int)yytext[yyleng-1], + yylineno); + yyextra->Compile_Errors++; return(ILLEGAL); /* Will cause syntax error */} <> { yypop_buffer_state(yyscanner); @@ -416,7 +417,7 @@ Compliance_Patterns COMPLIANCE_PATTERNS yyterminate(); } %% -void *bsdl_flex_init(FILE *f) /* Change input file from STDIN to BSDL file */ +void *bsdl_flex_init(FILE *f, int mode, int debug) { scan_extra_t *extra; yyscan_t scanner; @@ -434,8 +435,10 @@ void *bsdl_flex_init(FILE *f) /* Change input file from STDIN to BSDL file */ return NULL; } + extra->mode = mode; + extra->debug = debug; extra->Compile_Errors = 0; - extra->Base = DECIMAL; + extra->Base = DECIMAL; yyset_extra(extra, scanner);