diff --git a/jtag/ChangeLog b/jtag/ChangeLog index 3e23fa34..4a447e8a 100644 --- a/jtag/ChangeLog +++ b/jtag/ChangeLog @@ -1,3 +1,7 @@ +2008-01-21 Arnim Laeuger + + * src/bsdl/*: use gettext for message strings, removed trailing whitespace + 2008-01-20 Arnim Laeuger * src/bsdl/bsdl_bison.y, src/bsdl/bsdl_sem.c, src/bsdl/bsdl.h: diff --git a/jtag/src/bsdl/bsdl.c b/jtag/src/bsdl/bsdl.c index 898754a7..7b3468f0 100644 --- a/jtag/src/bsdl/bsdl.c +++ b/jtag/src/bsdl/bsdl.c @@ -44,7 +44,7 @@ static char **bsdl_path_list = NULL; int bsdl_debug = 0; -void bsdl_msg(int type, char *format, ...) +void bsdl_msg(int type, const char *format, ...) { va_list lst; @@ -94,10 +94,10 @@ int bsdl_read_file(const char *BSDL_File_Name, int mode, const char *idcode) BSDL_File = fopen(BSDL_File_Name, "r"); if (bsdl_debug || (mode == 0)) - bsdl_msg(BSDL_MSG_NOTE, "Reading file '%s'\n", BSDL_File_Name); + bsdl_msg(BSDL_MSG_NOTE, _("Reading file '%s'\n"), BSDL_File_Name); if (BSDL_File == NULL) { - bsdl_msg(BSDL_MSG_ERR, "Unable to open BSDL_file '%s'\n", BSDL_File_Name); + bsdl_msg(BSDL_MSG_ERR, _("Unable to open BSDL_file '%s'\n"), BSDL_File_Name); return -1; } @@ -111,7 +111,7 @@ int bsdl_read_file(const char *BSDL_File_Name, int mode, const char *idcode) return -1; } if (chain->parts == NULL) { - bsdl_msg(BSDL_MSG_ERR, _("Shain without any parts\n")); + bsdl_msg(BSDL_MSG_ERR, _("Chain without any parts\n")); bsdl_parser_deinit(parser_priv); fclose(BSDL_File); return -1; @@ -135,9 +135,9 @@ int bsdl_read_file(const char *BSDL_File_Name, int mode, const char *idcode) Compile_Errors = bsdl_flex_get_compile_errors(parser_priv->scanner); if (Compile_Errors == 0) { if (bsdl_debug) - bsdl_msg(BSDL_MSG_NOTE, "BSDL file '%s' compiled correctly\n", BSDL_File_Name); + bsdl_msg(BSDL_MSG_NOTE, _("BSDL file '%s' compiled correctly\n"), BSDL_File_Name); } else { - bsdl_msg(BSDL_MSG_ERR, "BSDL file '%s' contains errors, stopping\n", BSDL_File_Name); + bsdl_msg(BSDL_MSG_ERR, _("BSDL file '%s' contains errors, stopping\n"), BSDL_File_Name); } if (Compile_Errors == 0) @@ -145,7 +145,7 @@ int bsdl_read_file(const char *BSDL_File_Name, int mode, const char *idcode) if ((Compile_Errors == 0) && parser_priv->jtag_ctrl.idcode) { if (bsdl_debug) - bsdl_msg(BSDL_MSG_NOTE, "Got IDCODE: %s\n", parser_priv->jtag_ctrl.idcode); + bsdl_msg(BSDL_MSG_NOTE, _("Got IDCODE: %s\n"), parser_priv->jtag_ctrl.idcode); /* should be compare the idcodes? */ if (idcode) { @@ -295,7 +295,7 @@ int bsdl_scan_files(const char *idcode, int mode) closedir(dir); } else - bsdl_msg(BSDL_MSG_WARN, "Warning: Cannot open directory %s\n", bsdl_path_list[idx]); + bsdl_msg(BSDL_MSG_WARN, _("Cannot open directory %s\n"), bsdl_path_list[idx]); idx++; } diff --git a/jtag/src/bsdl/bsdl.h b/jtag/src/bsdl/bsdl.h index 997bbc32..0657560c 100644 --- a/jtag/src/bsdl/bsdl.h +++ b/jtag/src/bsdl/bsdl.h @@ -134,7 +134,7 @@ struct parser_priv { typedef struct parser_priv parser_priv_t; -void bsdl_msg(int, char *, ...); +void bsdl_msg(int, const char *, ...); /* BSDL lexer declarations */ void *bsdl_flex_init(FILE *); diff --git a/jtag/src/bsdl/bsdl_bison.y b/jtag/src/bsdl/bsdl_bison.y index f5b9df4e..43784300 100644 --- a/jtag/src/bsdl/bsdl_bison.y +++ b/jtag/src/bsdl/bsdl_bison.y @@ -28,24 +28,24 @@ we are sending to people who request it from our publicized E-Mail address; You are free to redistribute this at will, but we feel that it would be better if respondents asked for it directly so that their addresses can -be entered into our list for future mailings and updates. +be entered into our list for future mailings and updates. It would be helpful if you could confirm receipt of this transmission. -We also would be very interested to hear about your experiences with this +We also would be very interested to hear about your experiences with this information and what you are planning to do with BSDL. Regards, - + Ken Parker Hewlett-Packard Company -*Boundary-Scan Description Language - as documented in: +*Boundary-Scan Description Language - as documented in: -"A Language for Describing Boundary-Scan Devices", K.P. Parker -and S. Oresjo, Proceedings 1990 International Test Conference, +"A Language for Describing Boundary-Scan Devices", K.P. Parker +and S. Oresjo, Proceedings 1990 International Test Conference, Washington DC, pp 222-234 - + - -----------------cut here--------------------------------------------------- @@ -57,7 +57,7 @@ Washington DC, pp 222-234 USA October 1990 -Hello BSDL Parser Requestor, +Hello BSDL Parser Requestor, This Electronic Mail reply contains the computer specifications for Hewlett-Packard's Version 0.0 BSDL parser. This section of the reply @@ -65,7 +65,7 @@ explains the contents of the rest of this file. This file is composed of seven (7) parts: - 1) How to use this file + 1) How to use this file 2) UNIX* Lex source (lexicographical tokenizing rules) @@ -81,12 +81,12 @@ This file is composed of seven (7) parts: 7) [added 901016] Porting experiences to other systems. -RECOMMENDATION: Save a copy of this file in archival storage before +RECOMMENDATION: Save a copy of this file in archival storage before processing it via the instructions below. This will allow you to recover from errors, and allow you to compare subsequently released data for changes. -DISCLAIMERS: +DISCLAIMERS: 1. The IEEE 1149.1 Working Group has not endorsed BSDL Version 0.0 and therefore no person may represent it as an IEEE standard or imply that @@ -96,7 +96,7 @@ DISCLAIMERS: well-conceived initiative that is likely to excelerate the creation of tools that support the 1149.1 standard. As such, changes and enhancements will be carefully considered so as not to needlessly - disrupt these development efforts. The overriding goal is the + disrupt these development efforts. The overriding goal is the ultimate success of the 1149.1 standard. LEGAL NOTICES: @@ -127,6 +127,8 @@ LEGAL NOTICES: #include #include +#include "bsdl_sysdep.h" + /* interface to flex */ #include "bsdl_bison.h" #include "bsdl.h" @@ -145,8 +147,8 @@ int yylex (YYSTYPE *, void *); static void Init_Text(parser_priv_t *); static void Store_Text(parser_priv_t *, char *); static void Make_String(char *, char *); -static void Print_Error(parser_priv_t *, char *); -static void Print_Warning(parser_priv_t *, char *); +static void Print_Error(parser_priv_t *, const char *); +static void Print_Warning(parser_priv_t *, const char *); static void Give_Up_And_Quit(parser_priv_t *); void yyerror(parser_priv_t *, const char *); @@ -158,18 +160,18 @@ void yyerror(parser_priv_t *, const char *); } -%token ENTITY PORT GENERIC USE ATTRIBUTE IS +%token ENTITY PORT GENERIC USE ATTRIBUTE IS %token OF CONSTANT STRING END ALL PIN_MAP %token PHYSICAL_PIN_MAP PIN_MAP_STRING TRUE FALSE SIGNAL %token TAP_SCAN_IN TAP_SCAN_OUT TAP_SCAN_MODE TAP_SCAN_RESET %token TAP_SCAN_CLOCK LOW BOTH IN OUT INOUT %token BUFFER LINKAGE BIT BIT_VECTOR TO DOWNTO %token PACKAGE BODY TYPE SUBTYPE RECORD ARRAY -%token POSITIVE RANGE CELL_INFO INSTRUCTION_LENGTH +%token POSITIVE RANGE CELL_INFO INSTRUCTION_LENGTH %token INSTRUCTION_OPCODE INSTRUCTION_CAPTURE INSTRUCTION_DISABLE %token INSTRUCTION_GUARD INSTRUCTION_PRIVATE INSTRUCTION_USAGE %token INSTRUCTION_SEQUENCE REGISTER_ACCESS BOUNDARY_CELLS -%token BOUNDARY_LENGTH BOUNDARY_REGISTER IDCODE_REGISTER +%token BOUNDARY_LENGTH BOUNDARY_REGISTER IDCODE_REGISTER %token USERCODE_REGISTER DESIGN_WARNING BOUNDARY BYPASS HIGHZ IDCODE DEVICE_ID %token USERCODE INPUT OUTPUT2 OUTPUT3 CONTROL CONTROLR INTERNAL %token CLOCK BIDIR BIDIR_IN BIDIR_OUT EXTEST SAMPLE @@ -198,7 +200,7 @@ void yyerror(parser_priv_t *, const char *); %type Standard_Reg %type Standard_Inst -%start BSDL_Program +%start BSDL_Program %% /* End declarations, begin rules */ @@ -207,8 +209,8 @@ BSDL_Program : Begin_BSDL Part_1 Part_2 End_BSDL Begin_BSDL : ENTITY IDENTIFIER IS { bsdl_set_entity(priv_data, $2); } | error - {Print_Error(priv_data, "Improper Entity declaration"); - Print_Error(priv_data, "Check if source file is BSDL"); + {Print_Error(priv_data, _("Improper Entity declaration")); + Print_Error(priv_data, _("Check if source file is BSDL")); YYABORT; /* Probably not a BSDL source file */ } ; @@ -224,7 +226,7 @@ Part_1 : VHDL_Generic /* 1994 and later */ VHDL_Pin_Map VHDL_Constant_List | error - {Print_Error(priv_data, "Syntax Error"); + {Print_Error(priv_data, _("Syntax Error")); BUMP_ERROR; YYABORT; } ; Part_2 : VHDL_Tap_Signals @@ -241,16 +243,16 @@ Part_2 : VHDL_Tap_Signals VHDL_Boundary_Details VHDL_Boundary_Register | error - {Print_Error(priv_data, "Syntax Error"); + {Print_Error(priv_data, _("Syntax Error")); BUMP_ERROR; YYABORT; } ; End_BSDL : VHDL_Design_Warning END IDENTIFIER SEMICOLON { free($3); } | error - {Print_Error(priv_data, "Syntax Error"); + {Print_Error(priv_data, _("Syntax Error")); BUMP_ERROR; YYABORT; } ; -VHDL_Generic : GENERIC LPAREN PHYSICAL_PIN_MAP COLON STRING COLON_EQUAL +VHDL_Generic : GENERIC LPAREN PHYSICAL_PIN_MAP COLON STRING COLON_EQUAL Quoted_String RPAREN SEMICOLON { bsdl_flex_switch_buffer(priv_data->scanner, @@ -261,7 +263,7 @@ VHDL_Generic : GENERIC LPAREN PHYSICAL_PIN_MAP COLON STRING COLON_EQUAL ; VHDL_Port : PORT LPAREN Port_Specifier_List RPAREN SEMICOLON | error - {Print_Error(priv_data, "Improper Port declaration"); + {Print_Error(priv_data, _("Improper Port declaration")); BUMP_ERROR; YYABORT; } ; Port_Specifier_List : Port_Specifier @@ -290,13 +292,13 @@ Vector_Range : DECIMAL_NUMBER TO DECIMAL_NUMBER | DECIMAL_NUMBER DOWNTO DECIMAL_NUMBER { bsdl_prt_add_range(priv_data, $3, $1); } ; -VHDL_Use_Part : Standard_Use +VHDL_Use_Part : Standard_Use | Standard_Use VHDL_Use_List | error - {Print_Error(priv_data, "Error in Package declaration(s)"); + {Print_Error(priv_data, _("Error in Package declaration(s)")); BUMP_ERROR; YYABORT; } ; -Standard_Use : USE IDENTIFIER +Standard_Use : USE IDENTIFIER {/* Parse Standard 1149.1 Package */ strcpy(priv_data->Package_File_Name, $2); free($2); @@ -312,11 +314,11 @@ Standard_Use : USE IDENTIFIER priv_data->Reading_Package = 0; } ; -Standard_Package : PACKAGE IDENTIFIER IS Standard_Decls Defered_Constants +Standard_Package : PACKAGE IDENTIFIER IS Standard_Decls Defered_Constants Standard_Decls END IDENTIFIER SEMICOLON Package_Body { free($2); free($8); } | error - {Print_Error(priv_data, "Error in Standard Package"); + {Print_Error(priv_data, _("Error in Standard Package")); BUMP_ERROR; YYABORT; } ; Standard_Decls : Standard_Decl @@ -331,7 +333,7 @@ Standard_Decl : ATTRIBUTE Standard_Attributes COLON Attribute_Type SEMICOLON | SUBTYPE PIN_MAP_STRING IS STRING SEMICOLON | SUBTYPE BSDL_EXTENSION IS STRING SEMICOLON | error - {Print_Error(priv_data, "Error in Standard Declarations"); + {Print_Error(priv_data, _("Error in Standard Declarations")); BUMP_ERROR; YYABORT; } ; Standard_Attributes : PIN_MAP | TAP_SCAN_IN | TAP_SCAN_OUT @@ -347,7 +349,7 @@ Standard_Attributes : PIN_MAP | TAP_SCAN_IN | TAP_SCAN_OUT | BOUNDARY_LENGTH | BOUNDARY_REGISTER | DESIGN_WARNING | error - {Print_Error(priv_data, "Error in Attribute identifier"); + {Print_Error(priv_data, _("Error in Attribute identifier")); BUMP_ERROR; YYABORT; } ; Attribute_Type : IDENTIFIER @@ -355,7 +357,7 @@ Attribute_Type : IDENTIFIER | STRING | DECIMAL_NUMBER | error - {Print_Error(priv_data, "Error in Attribute type identification"); + {Print_Error(priv_data, _("Error in Attribute type identification")); BUMP_ERROR; YYABORT; } ; Type_Body : LPAREN ID_Bits RPAREN @@ -364,14 +366,14 @@ Type_Body : LPAREN ID_Bits RPAREN | ARRAY LPAREN DECIMAL_NUMBER TO DECIMAL_NUMBER RPAREN OF IDENTIFIER { free($8); } - | ARRAY LPAREN DECIMAL_NUMBER DOWNTO DECIMAL_NUMBER RPAREN + | ARRAY LPAREN DECIMAL_NUMBER DOWNTO DECIMAL_NUMBER RPAREN OF IDENTIFIER { free($8); } | RECORD Record_Body END RECORD | error - {Print_Error(priv_data, "Error in Type definition"); + {Print_Error(priv_data, _("Error in Type definition")); BUMP_ERROR; YYABORT; } - ; + ; ID_Bits : ID_Bit | ID_Bits COMMA ID_Bit ; @@ -383,7 +385,7 @@ ID_List : IDENTIFIER ID_Bit : SINGLE_QUOTE BIN_X_PATTERN SINGLE_QUOTE { free($2); } | error - {Print_Error(priv_data, "Error in Bit definition"); + {Print_Error(priv_data, _("Error in Bit definition")); BUMP_ERROR; YYABORT; } ; Record_Body : Record_Element @@ -392,7 +394,7 @@ Record_Body : Record_Element Record_Element : IDENTIFIER COLON IDENTIFIER SEMICOLON { free($1); free($3); } | error - {Print_Error(priv_data, "Error in Record Definition"); + {Print_Error(priv_data, _("Error in Record Definition")); BUMP_ERROR; YYABORT; } ; Defered_Constants: Defered_Constant @@ -403,17 +405,17 @@ Defered_Constant : CONSTANT Constant_Body Constant_Body : IDENTIFIER COLON CELL_INFO SEMICOLON { free($1); } | error - {Print_Error(priv_data, "Error in defered constant"); + {Print_Error(priv_data, _("Error in defered constant")); BUMP_ERROR; YYABORT; } ; VHDL_Use_List : VHDL_Use | VHDL_Use_List VHDL_Use ; -Package_Body : PACKAGE BODY IDENTIFIER IS Constant_List END IDENTIFIER +Package_Body : PACKAGE BODY IDENTIFIER IS Constant_List END IDENTIFIER { free($3); free($7); } SEMICOLON | error - {Print_Error(priv_data, "Error in Package Body definition"); + {Print_Error(priv_data, _("Error in Package Body definition")); BUMP_ERROR; YYABORT; } ; Constant_List : Cell_Constant @@ -423,7 +425,7 @@ Cell_Constant : CONSTANT IDENTIFIER COLON CELL_INFO COLON_EQUAL LPAREN Triples_List RPAREN SEMICOLON { free($2); } | error - {Print_Error(priv_data, "Error in Cell Constant definition"); + {Print_Error(priv_data, _("Error in Cell Constant definition")); BUMP_ERROR; YYABORT; } ; Triples_List : Triple @@ -432,27 +434,27 @@ Triples_List : Triple Triple : LPAREN Triple_Function COMMA Triple_Inst COMMA CAP_Data RPAREN | error - {Print_Error(priv_data, "Error in Cell Data Record"); + {Print_Error(priv_data, _("Error in Cell Data Record")); BUMP_ERROR; YYABORT; } ; Triple_Function : INPUT | OUTPUT2 | OUTPUT3 | INTERNAL | CONTROL | CONTROLR | CLOCK | BIDIR_IN | BIDIR_OUT | OBSERVE_ONLY | error - {Print_Error(priv_data, "Error in Cell_Type Function field"); + {Print_Error(priv_data, _("Error in Cell_Type Function field")); BUMP_ERROR; YYABORT; } ; Triple_Inst : EXTEST | SAMPLE | INTEST | RUNBIST | error - {Print_Error(priv_data, "Error in BScan_Inst Instruction field"); + {Print_Error(priv_data, _("Error in BScan_Inst Instruction field")); BUMP_ERROR; YYABORT; } ; CAP_Data : PI | PO | UPD | CAP | X | ZERO | ONE | error - {Print_Error(priv_data, "Error in Constant CAP data source field"); + {Print_Error(priv_data, _("Error in Constant CAP data source field")); BUMP_ERROR; YYABORT; } ; -VHDL_Use : USE IDENTIFIER +VHDL_Use : USE IDENTIFIER {/* Parse Standard 1149.1 Package */ strcpy(priv_data->Package_File_Name, $2); free($2); @@ -472,22 +474,22 @@ User_Package : PACKAGE IDENTIFIER IS Defered_Constants END IDENTIFIER SEMICOLON Package_Body { free($2); free($6); } | error - {Print_Error(priv_data, "Error in User-Defined Package declarations"); + {Print_Error(priv_data, _("Error in User-Defined Package declarations")); BUMP_ERROR; YYABORT; } ; -VHDL_Pin_Map : ATTRIBUTE PIN_MAP OF IDENTIFIER +VHDL_Pin_Map : ATTRIBUTE PIN_MAP OF IDENTIFIER COLON ENTITY IS PHYSICAL_PIN_MAP SEMICOLON { free($4); } | error - {Print_Error(priv_data, "Error in Pin_Map Attribute"); + {Print_Error(priv_data, _("Error in Pin_Map Attribute")); BUMP_ERROR; YYABORT; } ; VHDL_Constant_List : VHDL_Constant - | VHDL_Constant_List VHDL_Constant + | VHDL_Constant_List VHDL_Constant ; VHDL_Constant : CONSTANT VHDL_Constant_Part ; -VHDL_Constant_Part : IDENTIFIER COLON PIN_MAP_STRING COLON_EQUAL +VHDL_Constant_Part : IDENTIFIER COLON PIN_MAP_STRING COLON_EQUAL Quoted_String SEMICOLON { bsdl_flex_switch_buffer(priv_data->scanner, @@ -496,7 +498,7 @@ VHDL_Constant_Part : IDENTIFIER COLON PIN_MAP_STRING COLON_EQUAL BSDL_Map_String { free($1); } | error - {Print_Error(priv_data, "Error in Pin_Map_String constant declaration"); + {Print_Error(priv_data, _("Error in Pin_Map_String constant declaration")); BUMP_ERROR; YYABORT; } ; BSDL_Map_String : Pin_Mapping @@ -515,24 +517,24 @@ Physical_Pin : IDENTIFIER { free($1); } | DECIMAL_NUMBER ; -VHDL_Tap_Signals : VHDL_Tap_Signal +VHDL_Tap_Signals : VHDL_Tap_Signal | VHDL_Tap_Signals VHDL_Tap_Signal ; -VHDL_Tap_Signal : VHDL_Tap_Scan_In - | VHDL_Tap_Scan_Out - | VHDL_Tap_Scan_Clock - | VHDL_Tap_Scan_Mode - | VHDL_Tap_Scan_Reset +VHDL_Tap_Signal : VHDL_Tap_Scan_In + | VHDL_Tap_Scan_Out + | VHDL_Tap_Scan_Clock + | VHDL_Tap_Scan_Mode + | VHDL_Tap_Scan_Reset ; -VHDL_Tap_Scan_In : ATTRIBUTE TAP_SCAN_IN OF IDENTIFIER - COLON SIGNAL IS Boolean SEMICOLON +VHDL_Tap_Scan_In : ATTRIBUTE TAP_SCAN_IN OF IDENTIFIER + COLON SIGNAL IS Boolean SEMICOLON { free($4); } ; VHDL_Tap_Scan_Out : ATTRIBUTE TAP_SCAN_OUT OF IDENTIFIER COLON SIGNAL IS Boolean SEMICOLON { free($4); } ; -VHDL_Tap_Scan_Mode : ATTRIBUTE TAP_SCAN_MODE OF IDENTIFIER +VHDL_Tap_Scan_Mode : ATTRIBUTE TAP_SCAN_MODE OF IDENTIFIER COLON SIGNAL IS Boolean SEMICOLON { free($4); } ; @@ -548,15 +550,15 @@ Stop : LOW | BOTH ; Boolean : TRUE | FALSE ; -VHDL_Inst_Length : ATTRIBUTE INSTRUCTION_LENGTH OF IDENTIFIER +VHDL_Inst_Length : ATTRIBUTE INSTRUCTION_LENGTH OF IDENTIFIER COLON ENTITY IS DECIMAL_NUMBER SEMICOLON { bsdl_set_instruction_length(priv_data, $8); free($4); } ; -VHDL_Inst_Opcode : ATTRIBUTE INSTRUCTION_OPCODE OF IDENTIFIER - COLON ENTITY IS Quoted_String SEMICOLON +VHDL_Inst_Opcode : ATTRIBUTE INSTRUCTION_OPCODE OF IDENTIFIER + COLON ENTITY IS Quoted_String SEMICOLON { bsdl_flex_switch_buffer(priv_data->scanner, priv_data->buffer_for_switch); @@ -568,7 +570,7 @@ BSDL_Opcode_Table: Opcode_Desc | BSDL_Opcode_Table COMMA Opcode_Desc | error {Print_Error(priv_data, - "Error in Instruction_Opcode attribute statement"); + _("Error in Instruction_Opcode attribute statement")); BUMP_ERROR; YYABORT; } ; @@ -580,7 +582,7 @@ Pattern_List : Binary_Pattern | Pattern_List COMMA Binary_Pattern { Print_Warning(priv_data, - "Multiple opcode patterns are not supported, first pattern will be used"); + _("Multiple opcode patterns are not supported, first pattern will be used")); $$ = $1; free($3); } @@ -601,7 +603,7 @@ VHDL_Inst_Detail : VHDL_Inst_Capture | VHDL_Idcode_Register | VHDL_Usercode_Register ; -VHDL_Inst_Capture: ATTRIBUTE INSTRUCTION_CAPTURE OF IDENTIFIER +VHDL_Inst_Capture: ATTRIBUTE INSTRUCTION_CAPTURE OF IDENTIFIER COLON ENTITY IS Quoted_String SEMICOLON { bsdl_flex_switch_buffer(priv_data->scanner, @@ -610,7 +612,7 @@ VHDL_Inst_Capture: ATTRIBUTE INSTRUCTION_CAPTURE OF IDENTIFIER BIN_X_PATTERN { free($4); free($11); } ; -VHDL_Inst_Disable: ATTRIBUTE INSTRUCTION_DISABLE OF IDENTIFIER +VHDL_Inst_Disable: ATTRIBUTE INSTRUCTION_DISABLE OF IDENTIFIER COLON ENTITY IS Quoted_String SEMICOLON { bsdl_flex_switch_buffer(priv_data->scanner, @@ -619,7 +621,7 @@ VHDL_Inst_Disable: ATTRIBUTE INSTRUCTION_DISABLE OF IDENTIFIER IDENTIFIER { free($4); free($11); } ; -VHDL_Inst_Guard : ATTRIBUTE INSTRUCTION_GUARD OF IDENTIFIER +VHDL_Inst_Guard : ATTRIBUTE INSTRUCTION_GUARD OF IDENTIFIER COLON ENTITY IS Quoted_String SEMICOLON { bsdl_flex_switch_buffer(priv_data->scanner, @@ -628,7 +630,7 @@ VHDL_Inst_Guard : ATTRIBUTE INSTRUCTION_GUARD OF IDENTIFIER IDENTIFIER { free($4); free($11); } ; -VHDL_Inst_Private: ATTRIBUTE INSTRUCTION_PRIVATE OF IDENTIFIER +VHDL_Inst_Private: ATTRIBUTE INSTRUCTION_PRIVATE OF IDENTIFIER COLON ENTITY IS Quoted_String SEMICOLON { bsdl_flex_switch_buffer(priv_data->scanner, @@ -640,8 +642,8 @@ VHDL_Inst_Private: ATTRIBUTE INSTRUCTION_PRIVATE OF IDENTIFIER Private_Opcode_List : Private_Opcode | Private_Opcode_List COMMA Private_Opcode | error - {Print_Error(priv_data, "Error in Opcode List"); - BUMP_ERROR; + {Print_Error(priv_data, _("Error in Opcode List")); + BUMP_ERROR; YYABORT; } ; Private_Opcode : IDENTIFIER @@ -681,7 +683,7 @@ VHDL_Usercode_Register: ATTRIBUTE USERCODE_REGISTER OF IDENTIFIER free($4); } ; -VHDL_Register_Access: ATTRIBUTE REGISTER_ACCESS OF IDENTIFIER +VHDL_Register_Access: ATTRIBUTE REGISTER_ACCESS OF IDENTIFIER COLON ENTITY IS Quoted_String SEMICOLON { bsdl_flex_switch_buffer(priv_data->scanner, @@ -737,8 +739,8 @@ VHDL_Boundary_Details: VHDL_Boundary_Detail VHDL_Boundary_Detail: VHDL_Boundary_Cells | VHDL_Boundary_Length ; -VHDL_Boundary_Cells: ATTRIBUTE BOUNDARY_CELLS OF IDENTIFIER - COLON ENTITY IS Quoted_String SEMICOLON +VHDL_Boundary_Cells: ATTRIBUTE BOUNDARY_CELLS OF IDENTIFIER + COLON ENTITY IS Quoted_String SEMICOLON { bsdl_flex_switch_buffer(priv_data->scanner, priv_data->buffer_for_switch); @@ -759,7 +761,7 @@ VHDL_Boundary_Length: ATTRIBUTE BOUNDARY_LENGTH OF IDENTIFIER free($4); } ; -VHDL_Boundary_Register: ATTRIBUTE BOUNDARY_REGISTER OF IDENTIFIER +VHDL_Boundary_Register: ATTRIBUTE BOUNDARY_REGISTER OF IDENTIFIER COLON ENTITY IS Quoted_String SEMICOLON { bsdl_flex_switch_buffer(priv_data->scanner, @@ -771,7 +773,7 @@ VHDL_Boundary_Register: ATTRIBUTE BOUNDARY_REGISTER OF IDENTIFIER BSDL_Cell_Table : Cell_Entry | BSDL_Cell_Table COMMA Cell_Entry | error - {Print_Error(priv_data, "Error in Boundary Cell description"); + {Print_Error(priv_data, _("Error in Boundary Cell description")); BUMP_ERROR; YYABORT; } ; Cell_Entry : DECIMAL_NUMBER LPAREN Cell_Info RPAREN @@ -781,7 +783,7 @@ Cell_Info : Cell_Spec { bsdl_ci_no_disable(priv_data); } | Cell_Spec COMMA Disable_Spec ; -Cell_Spec : IDENTIFIER COMMA Port_Name COMMA Cell_Function +Cell_Spec : IDENTIFIER COMMA Port_Name COMMA Cell_Function COMMA Safe_Value { free($1); @@ -851,7 +853,7 @@ Disable_Value : Z { $$ = KEEPER; } ; VHDL_Design_Warning: /* Null Statement */ - | ATTRIBUTE DESIGN_WARNING OF IDENTIFIER + | ATTRIBUTE DESIGN_WARNING OF IDENTIFIER COLON ENTITY IS Quoted_String SEMICOLON { free($4); } ; @@ -916,28 +918,28 @@ static void Make_String(char *Source, char *Dest) *Dest = '\0'; } /*----------------------------------------------------------------------*/ -static void Print_Error(parser_priv_t *priv_data, char *Errmess) +static void Print_Error(parser_priv_t *priv_data, const char *Errmess) { if (priv_data->Reading_Package) - bsdl_msg(BSDL_MSG_ERR, "Error in Package %s, Line %d, %s.\n", + bsdl_msg(BSDL_MSG_ERR, _("Error in Package %s, Line %d, %s.\n"), priv_data->Package_File_Name, bsdl_flex_get_lineno(priv_data->scanner), Errmess); else - bsdl_msg(BSDL_MSG_ERR, "Error, Line %d, %s.\n", + bsdl_msg(BSDL_MSG_ERR, _("Error, Line %d, %s.\n"), bsdl_flex_get_lineno(priv_data->scanner), Errmess); } /*----------------------------------------------------------------------*/ -static void Print_Warning(parser_priv_t *priv_data, char *Warnmess) +static void Print_Warning(parser_priv_t *priv_data, const char *Warnmess) { if (priv_data->Reading_Package) - bsdl_msg(BSDL_MSG_WARN, "Warning in Package %s, Line %d, %s.\n", + bsdl_msg(BSDL_MSG_WARN, _("Warning in Package %s, Line %d, %s.\n"), priv_data->Package_File_Name, bsdl_flex_get_lineno(priv_data->scanner), Warnmess); else - bsdl_msg(BSDL_MSG_WARN, "Warning, Line %d, %s.\n", + bsdl_msg(BSDL_MSG_WARN, _("Warning, Line %d, %s.\n"), bsdl_flex_get_lineno(priv_data->scanner), Warnmess); } @@ -956,7 +958,7 @@ parser_priv_t *bsdl_parser_init(FILE *f) parser_priv_t *new_priv; if (!(new_priv = (parser_priv_t *)malloc(sizeof(parser_priv_t)))) { - bsdl_msg(BSDL_MSG_ERR, "Out of memory, %s line %i\n", __FILE__, __LINE__); + bsdl_msg(BSDL_MSG_ERR, _("Out of memory, %s line %i\n"), __FILE__, __LINE__); return NULL; } diff --git a/jtag/src/bsdl/bsdl_flex.l b/jtag/src/bsdl/bsdl_flex.l index 48d31e37..43f2e9b8 100644 --- a/jtag/src/bsdl/bsdl_flex.l +++ b/jtag/src/bsdl/bsdl_flex.l @@ -7,7 +7,7 @@ */ /*---------------------------------------------------------- - * + * * Lex source for BSDL * *----------------------------------------------------------*/ @@ -28,24 +28,24 @@ we are sending to people who request it from our publicized E-Mail address; You are free to redistribute this at will, but we feel that it would be better if respondents asked for it directly so that their addresses can -be entered into our list for future mailings and updates. +be entered into our list for future mailings and updates. It would be helpful if you could confirm receipt of this transmission. -We also would be very interested to hear about your experiences with this +We also would be very interested to hear about your experiences with this information and what you are planning to do with BSDL. Regards, - + Ken Parker Hewlett-Packard Company -*Boundary-Scan Description Language - as documented in: +*Boundary-Scan Description Language - as documented in: -"A Language for Describing Boundary-Scan Devices", K.P. Parker -and S. Oresjo, Proceedings 1990 International Test Conference, +"A Language for Describing Boundary-Scan Devices", K.P. Parker +and S. Oresjo, Proceedings 1990 International Test Conference, Washington DC, pp 222-234 - + - -----------------cut here--------------------------------------------------- @@ -57,7 +57,7 @@ Washington DC, pp 222-234 USA October 1990 -Hello BSDL Parser Requestor, +Hello BSDL Parser Requestor, This Electronic Mail reply contains the computer specifications for Hewlett-Packard's Version 0.0 BSDL parser. This section of the reply @@ -65,7 +65,7 @@ explains the contents of the rest of this file. This file is composed of seven (7) parts: - 1) How to use this file + 1) How to use this file 2) UNIX* Lex source (lexicographical tokenizing rules) @@ -81,12 +81,12 @@ This file is composed of seven (7) parts: 7) [added 901016] Porting experiences to other systems. -RECOMMENDATION: Save a copy of this file in archival storage before +RECOMMENDATION: Save a copy of this file in archival storage before processing it via the instructions below. This will allow you to recover from errors, and allow you to compare subsequently released data for changes. -DISCLAIMERS: +DISCLAIMERS: 1. The IEEE 1149.1 Working Group has not endorsed BSDL Version 0.0 and therefore no person may represent it as an IEEE standard or imply that @@ -96,7 +96,7 @@ DISCLAIMERS: well-conceived initiative that is likely to excelerate the creation of tools that support the 1149.1 standard. As such, changes and enhancements will be carefully considered so as not to needlessly - disrupt these development efforts. The overriding goal is the + disrupt these development efforts. The overriding goal is the ultimate success of the 1149.1 standard. LEGAL NOTICES: @@ -126,8 +126,9 @@ LEGAL NOTICES: #include #include -#include "bsdl_bison.h" +#include "bsdl_sysdep.h" +#include "bsdl_bison.h" #include "bsdl.h" #define YY_EXTRA_TYPE scan_extra_t * @@ -275,7 +276,7 @@ Compliance_Patterns COMPLIANCE_PATTERNS {Generic} {yyextra->Base = DECIMAL; return(GENERIC); } {Use} {yyextra->Base = DECIMAL; return(USE); } {Attribute} {yyextra->Base = DECIMAL; return(ATTRIBUTE); } -{Is} {return(IS); } +{Is} {return(IS); } {Constant} {yyextra->Base = DECIMAL; return(CONSTANT); } {String} {return(STRING); } {End} {yyextra->Base = DECIMAL; @@ -402,10 +403,10 @@ Compliance_Patterns COMPLIANCE_PATTERNS return(REAL_NUMBER);} {Concatenate} {return(CONCATENATE);} {Semicolon} {return(SEMICOLON);} -{Illegal} {fprintf(stderr, - "Error: Illegal character %c (/%03o) at line %d:\n", +{Illegal} {bsdl_msg(BSDL_MSG_ERR, + _("Error: Illegal character %c (/%03o) at line %d:\n"), (char)yytext[yyleng-1], (int)yytext[yyleng-1], - yylineno); + yylineno); yyextra->Compile_Errors++; return(ILLEGAL); /* Will cause syntax error */} <> { @@ -421,13 +422,13 @@ void *bsdl_flex_init(FILE *f) /* Change input file from STDIN to BSDL file */ /* get our scanner structure */ if (yylex_init(&scanner) != 0) { - printf("%s: Scanner could not be initialized\n", "BSDL"); + bsdl_msg(BSDL_MSG_ERR, _("Scanner could not be initialized\n") ); return NULL; } yyset_in(f, scanner); if (!(extra = (scan_extra_t *)malloc(sizeof(scan_extra_t)))) { - printf("%s: Out of memory\n", "BSDL"); + bsdl_msg(BSDL_MSG_ERR, _("Out of memory, %s line %i\n"), __FILE__, __LINE__); yylex_destroy(scanner); return NULL; } @@ -453,7 +454,7 @@ int yywrap(yyscan_t scanner) fclose(yyget_in(scanner)); yyset_in(NULL, scanner); } - return(1); + return(1); } @@ -467,7 +468,7 @@ static char *new_string(const char *str) strncpy(n_str, str, n_str_size-1); n_str[n_str_size-1] = '\0'; /* set very last element to EOS */ } else - printf("%s: Out of memory\n", "BSDL"); + bsdl_msg(BSDL_MSG_ERR, _("Out of memory, %s line %i\n"), __FILE__, __LINE__); return(n_str); } @@ -498,7 +499,7 @@ void bsdl_flex_switch_file(yyscan_t scanner, const char *filename) f = fopen(db_file, "r"); if (!f) - printf("%s: Cannot open file %s or %s.\n", "BSDL", filename, db_file); + bsdl_msg(BSDL_MSG_ERR, _("Cannot open file %s or %s.\n"), filename, db_file); free(db_file); if (!f) return; diff --git a/jtag/src/bsdl/bsdl_sem.c b/jtag/src/bsdl/bsdl_sem.c index c24838ae..6d4db736 100644 --- a/jtag/src/bsdl/bsdl_sem.c +++ b/jtag/src/bsdl/bsdl_sem.c @@ -32,8 +32,9 @@ #include #include -#include "bsdl_bison.h" +#include "bsdl_sysdep.h" +#include "bsdl_bison.h" #include "bsdl.h" @@ -256,7 +257,7 @@ void bsdl_prt_add_name(parser_priv_t *priv, char *name) pd->names_list = new_string; } else - bsdl_msg(BSDL_MSG_ERR, "Out of memory, %s line %i\n", __FILE__, __LINE__); + bsdl_msg(BSDL_MSG_ERR, _("Out of memory, %s line %i\n"), __FILE__, __LINE__); } @@ -368,7 +369,7 @@ void bsdl_prt_apply_port(parser_priv_t *priv) free(port_string); } else - bsdl_msg(BSDL_MSG_ERR, "Out of memory, %s line %i\n", __FILE__, __LINE__); + bsdl_msg(BSDL_MSG_ERR, _("Out of memory, %s line %i\n"), __FILE__, __LINE__); name = name->next; } @@ -483,7 +484,7 @@ void bsdl_add_instruction(parser_priv_t *priv, char *instr, char *opcode) priv->jtag_ctrl.instr_list = new_instr; } else - bsdl_msg(BSDL_MSG_ERR, "Out of memory, %s line %i\n", __FILE__, __LINE__); + bsdl_msg(BSDL_MSG_ERR, _("Out of memory, %s line %i\n"), __FILE__, __LINE__); } @@ -570,7 +571,7 @@ void bsdl_ci_set_cell_spec(parser_priv_t *priv, ci->port_name = port_string; } else { - bsdl_msg(BSDL_MSG_ERR, "Out of memory, %s line %i\n", __FILE__, __LINE__); + bsdl_msg(BSDL_MSG_ERR, _("Out of memory, %s line %i\n"), __FILE__, __LINE__); ci->port_name = NULL; } @@ -758,7 +759,7 @@ void bsdl_ac_add_instruction(parser_priv_t *priv, char *instr) ad->instr_list = new_instr; } else - bsdl_msg(BSDL_MSG_ERR, "Out of memory, %s line %i\n", __FILE__, __LINE__); + bsdl_msg(BSDL_MSG_ERR, _("Out of memory, %s line %i\n"), __FILE__, __LINE__); } @@ -789,7 +790,7 @@ void bsdl_ac_apply_assoc(parser_priv_t *priv) ad->ainfo_list = new_ainfo; } else - bsdl_msg(BSDL_MSG_ERR, "Out of memory, %s line %i\n", __FILE__, __LINE__); + bsdl_msg(BSDL_MSG_ERR, _("Out of memory, %s line %i\n"), __FILE__, __LINE__); /* clean up obsolete temporary entries */ ad->reg = NULL; diff --git a/jtag/src/bsdl/bsdl_sysdep.h b/jtag/src/bsdl/bsdl_sysdep.h new file mode 100644 index 00000000..e6b1e90e --- /dev/null +++ b/jtag/src/bsdl/bsdl_sysdep.h @@ -0,0 +1,43 @@ +/* + * $Id$ + * + * Reduced version of the global sysdep.h that is suitable for the + * BSDL subsystem components. config.h defines a number of macros + * that collide with BSDL tokens. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + * + */ + +#ifndef BSDL_SYSDEP_H +#define BSDL_SYSDEP_H + + +#include "gettext.h" +#define _(s) gettext(s) +#define N_(s) gettext_noop(s) +#define P_(s,p,n) ngettext(s,p,n) + +#ifdef S_SPLINT_S +#undef gettext +#define gettext(s) s +#undef gettext_noop +#define gettext_noop(s) s +#undef ngettext +#define ngettext(s,p,n) s +#endif + +#endif /* BSDL_SYSDEP_H */