removed function Make_String()

git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@1007 b68d4a1b-bc3d-0410-92ed-d4ac073336b7
master
Arnim Läuger 17 years ago
parent 6a79245f08
commit 0aa7e74a05

@ -1,3 +1,9 @@
2008-02-11 Arnim Laeuger <arniml@users.sourceforge.net>
* src/bsdl/bsdl_bison.y (Store_Text): removed function Make_String()
the QUOTED_STRING is directly copied to buffer_for_switch
* src/bsdl/bsdl.h: memeber String_Val of parser_priv obseleted
2008-02-10 Arnim Laeuger <arniml@users.sourceforge.net>
* src/tap/cable/ft2232.c (ft2232_generic_init, ft2232_jtagkey_init)

@ -122,12 +122,10 @@ struct jtag_ctrl {
/* private data of the bison parser
used to store variables the would end up as globals otherwise */
struct parser_priv {
char String_Val[150];
char Package_File_Name[100];
int Reading_Package;
char *buffer_for_switch;
size_t len_buffer_for_switch;
int idx_to_buffer;
void *scanner;
struct jtag_ctrl jtag_ctrl;
};

@ -147,7 +147,6 @@ 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 *, const char *);
static void Print_Warning(parser_priv_t *, const char *);
static void Give_Up_And_Quit(parser_priv_t *);
@ -876,13 +875,11 @@ BSDL_Compliance_Pattern: LPAREN Physical_Pin_List RPAREN
{ free($5); }
;
Quoted_String : QUOTED_STRING
{Make_String($1, priv_data->String_Val);
Init_Text(priv_data);
Store_Text(priv_data, priv_data->String_Val);
{Init_Text(priv_data);
Store_Text(priv_data, $1);
free($1); }
| Quoted_String CONCATENATE QUOTED_STRING
{Make_String($3, priv_data->String_Val);
Store_Text(priv_data, priv_data->String_Val);
{Store_Text(priv_data, $3);
free($3); }
;
%% /* End rules, begin programs */
@ -894,29 +891,26 @@ static void Init_Text(parser_priv_t *priv_data)
priv_data->len_buffer_for_switch = 160;
}
priv_data->buffer_for_switch[0] = '\0';
priv_data->idx_to_buffer = 0;
}
/*----------------------------------------------------------------------*/
static void Store_Text(parser_priv_t *priv_data, char *String)
static void Store_Text(parser_priv_t *priv_data, char *Source)
{ /* Save characters from VHDL string in local string buffer. */
size_t req_len;
char *SourceEnd;
req_len = strlen(priv_data->buffer_for_switch) + strlen(String) + 1;
SourceEnd = ++Source; /* skip leading '"' */
while (*SourceEnd && (*SourceEnd != '"') && (*SourceEnd != '\n'))
SourceEnd++;
/* terminate Source string with NUL character */
*SourceEnd = '\0';
req_len = strlen(priv_data->buffer_for_switch) + strlen(Source) + 1;
if (req_len > priv_data->len_buffer_for_switch) {
priv_data->buffer_for_switch = (char *)realloc(priv_data->buffer_for_switch,
req_len);
priv_data->len_buffer_for_switch = req_len;
}
strcpy(&(priv_data->buffer_for_switch[priv_data->idx_to_buffer]), String);
priv_data->idx_to_buffer += strlen(String);
}
/*----------------------------------------------------------------------*/
static void Make_String(char *Source, char *Dest)
{
char Ch;
for (Source++; Ch = *Source, (Ch != '"') && (Ch != '\n'); Source++, Dest++)
*Dest = *Source;
*Dest = '\0';
strcat(priv_data->buffer_for_switch, Source);
}
/*----------------------------------------------------------------------*/
static void Print_Error(parser_priv_t *priv_data, const char *Errmess)

Loading…
Cancel
Save