From eb2d143e7798f238dce28245bb5ae5447b257d30 Mon Sep 17 00:00:00 2001 From: Stefan Frederik Date: Sun, 29 Nov 2020 01:59:17 +0100 Subject: [PATCH] more consistent get_tok_value() regarding escaping --- src/actions.c | 6 +- src/netlist.c | 5 +- src/save.c | 4 +- src/scheduler.c | 2 +- src/spice_netlist.c | 4 +- src/token.c | 84 ++++++++++---------- src/verilog_netlist.c | 8 +- src/vhdl_netlist.c | 22 ++--- src/xschem.tcl | 2 +- xschem_library/devices/verilog_timescale.sym | 2 +- 10 files changed, 68 insertions(+), 71 deletions(-) diff --git a/src/actions.c b/src/actions.c index 0bf7fed1..4c30df0e 100644 --- a/src/actions.c +++ b/src/actions.c @@ -1108,8 +1108,8 @@ void launcher(void) tcleval("update; after 300"); select_object(mx,my,0, 0); n=selectedgroup[0].n; - my_strncpy(program, get_tok_value(xctx->inst[n].prop_ptr,"program",2), S(program)); /* handle backslashes */ - str = get_tok_value(xctx->inst[n].prop_ptr,"url",2); /* handle backslashes */ + my_strncpy(program, get_tok_value(xctx->inst[n].prop_ptr,"program",0), S(program)); /* handle backslashes */ + str = get_tok_value(xctx->inst[n].prop_ptr,"url",0); /* handle backslashes */ dbg(1, "launcher(): str=%s\n", str); if(str[0] || (program[0])) { tclsetvar("launcher_var",str); @@ -1120,7 +1120,7 @@ void launcher(void) } tcleval( "launcher"); } else { - my_strncpy(program, get_tok_value(xctx->inst[n].prop_ptr,"tclcommand",2), S(program)); + my_strncpy(program, get_tok_value(xctx->inst[n].prop_ptr,"tclcommand",0), S(program)); if(program[0]) { /* 20170415 execute tcl command */ tcleval(program); } diff --git a/src/netlist.c b/src/netlist.c index 63c8db9d..fceeda6a 100644 --- a/src/netlist.c +++ b/src/netlist.c @@ -732,7 +732,7 @@ void prepare_netlist_structs(int for_netlist) } else { my_strdup(258, &sig_type,get_tok_value(inst[i].prop_ptr,"sig_type",0)); my_strdup(259, &verilog_type,get_tok_value(inst[i].prop_ptr,"verilog_type",0)); - my_strdup(260, &value,get_tok_value(inst[i].prop_ptr,"value",2)); + my_strdup(260, &value,get_tok_value(inst[i].prop_ptr,"value",0)); my_strdup(261, &class,get_tok_value(inst[i].prop_ptr,"class",0)); } @@ -849,8 +849,7 @@ void prepare_netlist_structs(int for_netlist) dbg(2, "prepare_netlist_structs(): naming generic %s\n", inst[iptr->n].node[iptr->pin]); - my_strdup(268, &inst[i].node[j], - get_tok_value(inst[iptr->n].prop_ptr,"value",2) ); + my_strdup(268, &inst[i].node[j], get_tok_value(inst[iptr->n].prop_ptr,"value",0) ); /*my_strdup(269, &inst[i].node[j], inst[iptr->n].node[iptr->pin] ); */ diff --git a/src/save.c b/src/save.c index 8c3aa849..2ffdcb7d 100644 --- a/src/save.c +++ b/src/save.c @@ -1632,7 +1632,7 @@ int load_sym_def(const char *name, FILE *embed_fd) load_ascii_string(&symbol[symbols].prop_ptr, lcc[level].fd); if(!symbol[symbols].prop_ptr) break; my_strdup2(424, &symbol[symbols].templ, - get_tok_value(symbol[symbols].prop_ptr, "template",2)); + get_tok_value(symbol[symbols].prop_ptr, "template", 0)); my_strdup2(515, &symbol[symbols].type, get_tok_value(symbol[symbols].prop_ptr, "type",0)); } @@ -1645,7 +1645,7 @@ int load_sym_def(const char *name, FILE *embed_fd) load_ascii_string(&symbol[symbols].prop_ptr, lcc[level].fd); if(!symbol[symbols].prop_ptr) break; my_strdup2(341, &symbol[symbols].templ, - get_tok_value(symbol[symbols].prop_ptr, "template",2)); + get_tok_value(symbol[symbols].prop_ptr, "template", 0)); my_strdup2(342, &symbol[symbols].type, get_tok_value(symbol[symbols].prop_ptr, "type",0)); } diff --git a/src/scheduler.c b/src/scheduler.c index 7e6208c2..684058ed 100644 --- a/src/scheduler.c +++ b/src/scheduler.c @@ -1681,7 +1681,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg ROTATION(rot, flip, 0.0, 0.0, pinx0, piny0, pinx0, piny0); pinx0 += x0; piny0 += y0; - my_snprintf(num, S(num), "{%s} %g %g", get_tok_value(rct[p].prop_ptr, "name", 2), pinx0, piny0); + my_snprintf(num, S(num), "{%s} %g %g", get_tok_value(rct[p].prop_ptr, "name", 0), pinx0, piny0); Tcl_SetResult(interp, num, TCL_VOLATILE); my_free(530, &tmpstr); } diff --git a/src/spice_netlist.c b/src/spice_netlist.c index 3d330e67..856f24cd 100644 --- a/src/spice_netlist.c +++ b/src/spice_netlist.c @@ -410,10 +410,10 @@ void spice_netlist(FILE *fd, int spice_stop ) const char *m; print_spice_element(fd, i) ; /* this is the element line */ /* hash device_model attribute if any */ - m = get_tok_value(xctx->inst[i].prop_ptr, "device_model", 2); + m = get_tok_value(xctx->inst[i].prop_ptr, "device_model", 0); if(m[0]) str_hash_lookup(model_table, model_name(m), m, XINSERT); else { - m = get_tok_value( (xctx->inst[i].ptr+ xctx->sym)->prop_ptr, "device_model", 2); + m = get_tok_value( (xctx->inst[i].ptr+ xctx->sym)->prop_ptr, "device_model", 0); if(m[0]) str_hash_lookup(model_table, model_name(m), m, XINSERT); } my_free(951, &model_name_result); diff --git a/src/token.c b/src/token.c index 2a45288b..48130740 100644 --- a/src/token.c +++ b/src/token.c @@ -460,9 +460,8 @@ const char *list_tokens(const char *s, int with_quotes) /* NULL tok NOT ALLOWED !!!!!!!! */ /* never returns NULL... */ /* with_quotes: */ -/* 0: eat non escaped quotes (") */ -/* 1: return unescaped quotes as part of the token value if they are present */ -/* 2: eat backslashes and unescaped double quotes (") */ +/* 0: eat unescaped backslashes and unescaped double quotes (") */ +/* 1: return backslashes and quotes as part of the token value if they are present */ const char *get_tok_value(const char *s,const char *tok, int with_quotes) { static char *result=NULL; @@ -518,15 +517,14 @@ const char *get_tok_value(const char *s,const char *tok, int with_quotes) if(c=='"') { if((with_quotes & 1) || escape) token[token_pos++]=c; } - else if( !(c == '\\' && (with_quotes & 2)) ) token[token_pos++]=c; - else if(escape && c == '\\') token[token_pos++]=c; + /* skip unescaped backslashes */ + else if( escape || c != '\\' ) token[token_pos++]=c; } else if(state==TOK_VALUE) { if(c=='"') { if((with_quotes & 1) || escape) result[value_pos++]=c; } /* skip unescaped backslashes */ - else if( !quote || !((c == '\\') && (with_quotes & 2)) ) result[value_pos++]=c; - else if( (c == '\\') && escape ) result[value_pos++]=c; /* add escaped backslashes */ + else if( escape || c != '\\' ) result[value_pos++]=c; } else if(state==TOK_ENDTOK || state==TOK_SEP) { if(token_pos) { token[token_pos]='\0'; @@ -974,7 +972,7 @@ void print_vhdl_element(FILE *fd, int inst) int escape=0; xRect *pinptr; - if(get_tok_value((xctx->inst[inst].ptr+ xctx->sym)->prop_ptr,"vhdl_format",2)[0] != '\0') { + if(get_tok_value((xctx->inst[inst].ptr+ xctx->sym)->prop_ptr,"vhdl_format", 0)[0] != '\0') { print_vhdl_primitive(fd, inst); return; } @@ -1003,7 +1001,7 @@ void print_vhdl_element(FILE *fd, int inst) tmp=0; /* 20080213 use generic_type property to decide if some properties are strings, see later */ - my_strdup(464, &generic_type, get_tok_value((xctx->inst[inst].ptr+ xctx->sym)->prop_ptr,"generic_type",2)); + my_strdup(464, &generic_type, get_tok_value((xctx->inst[inst].ptr+ xctx->sym)->prop_ptr,"generic_type", 0)); while(1) { @@ -1044,7 +1042,7 @@ void print_vhdl_element(FILE *fd, int inst) if(tmp1) fprintf(fd, " ,\n"); /* 20080213 put "" around string type generics! */ - if( generic_type && !strcmp(get_tok_value(generic_type,token, 2), "string") ) { + if( generic_type && !strcmp(get_tok_value(generic_type,token, 0), "string") ) { fprintf(fd, " %s => \"%s\"", token, value); } else { fprintf(fd, " %s => %s", token, value); @@ -1206,10 +1204,10 @@ void print_generic(FILE *fd, char *ent_or_comp, int symbol) for(i=0;isym[symbol].rects[GENERICLAYER];i++) { - my_strdup(476, &generic_type,get_tok_value( - xctx->sym[symbol].rect[GENERICLAYER][i].prop_ptr,"generic_type",0)); - my_strdup(477, &generic_value, get_tok_value( - xctx->sym[symbol].rect[GENERICLAYER][i].prop_ptr,"value",2) ); /*<< 170402 */ + my_strdup(476, &generic_type, + get_tok_value(xctx->sym[symbol].rect[GENERICLAYER][i].prop_ptr,"generic_type",0)); + my_strdup(477, &generic_value, + get_tok_value(xctx->sym[symbol].rect[GENERICLAYER][i].prop_ptr,"value", 0) ); str_tmp = get_tok_value(xctx->sym[symbol].rect[GENERICLAYER][i].prop_ptr,"name",0); if(!tmp) fprintf(fd, "generic (\n"); if(tmp) fprintf(fd, " ;\n"); @@ -1291,8 +1289,8 @@ void print_verilog_param(FILE *fd, int symbol) { /* 20080915 put "" around string params */ - if( !generic_type || strcmp(get_tok_value(generic_type,token, 2), "time") ) { - if( generic_type && !strcmp(get_tok_value(generic_type,token, 2), "string") ) { + if( !generic_type || strcmp(get_tok_value(generic_type,token, 0), "time") ) { + if( generic_type && !strcmp(get_tok_value(generic_type,token, 0), "string") ) { fprintf(fd, " parameter %s = \"%s\" ;\n", token, value); } else { @@ -1328,7 +1326,7 @@ void print_tedax_subckt(FILE *fd, int symbol) int token_pos=0, escape=0; int no_of_pins=0; - my_strdup(460, &format, get_tok_value(xctx->sym[symbol].prop_ptr,"format",2)); + my_strdup(460, &format, get_tok_value(xctx->sym[symbol].prop_ptr,"format",0)); if( (format==NULL) ) { my_free(473, &format); return; /* no format */ @@ -1436,7 +1434,7 @@ void print_spice_subckt(FILE *fd, int symbol) int token_pos=0, escape=0; int no_of_pins=0; - my_strdup(103, &format, get_tok_value(xctx->sym[symbol].prop_ptr,"format",2)); + my_strdup(103, &format, get_tok_value(xctx->sym[symbol].prop_ptr,"format",0)); if( (format==NULL) ) { my_free(1012, &format); return; /* no format */ @@ -1557,9 +1555,9 @@ void print_spice_element(FILE *fd, int inst) if (!name) my_strdup(43, &name, get_tok_value(template, "name", 0)); /* allow format string override in instance */ - my_strdup(470, &format, get_tok_value(xctx->inst[inst].prop_ptr,"format",2)); + my_strdup(470, &format, get_tok_value(xctx->inst[inst].prop_ptr,"format",0)); if(!format || !format[0]) - my_strdup(486, &format, get_tok_value((xctx->inst[inst].ptr+ xctx->sym)->prop_ptr,"format",2)); + my_strdup(486, &format, get_tok_value((xctx->inst[inst].ptr+ xctx->sym)->prop_ptr,"format",0)); if ((name==NULL) || (format==NULL)) { my_free(1015, &template); @@ -1609,7 +1607,7 @@ void print_spice_element(FILE *fd, int inst) value=NULL; } else { dbg(1, "print_spice_element(): token: |%s|\n", token); - value = get_tok_value(xctx->inst[inst].prop_ptr, token+1, 2); + value = get_tok_value(xctx->inst[inst].prop_ptr, token+1, 0); /* get_tok_size==0 indicates that token(+1) does not exist in instance attributes */ if (!get_tok_size) value=get_tok_value(template, token+1, 0); token_exists = get_tok_size; @@ -1831,14 +1829,14 @@ void print_tedax_element(FILE *fd, int inst) int subcircuit = 0; /* struct inst_hashentry *ptr; */ - my_strdup(489, &extra, get_tok_value((xctx->inst[inst].ptr+ xctx->sym)->prop_ptr,"extra",2)); - my_strdup(41, &extra_pinnumber, get_tok_value(xctx->inst[inst].prop_ptr,"extra_pinnumber",2)); + my_strdup(489, &extra, get_tok_value((xctx->inst[inst].ptr+ xctx->sym)->prop_ptr,"extra",0)); + my_strdup(41, &extra_pinnumber, get_tok_value(xctx->inst[inst].prop_ptr,"extra_pinnumber",0)); if(!extra_pinnumber) my_strdup(490, &extra_pinnumber, - get_tok_value((xctx->inst[inst].ptr+ xctx->sym)->prop_ptr,"extra_pinnumber",2)); + get_tok_value((xctx->inst[inst].ptr+ xctx->sym)->prop_ptr,"extra_pinnumber",0)); my_strdup(491, &template, (xctx->inst[inst].ptr+ xctx->sym)->templ); - my_strdup(492, &numslots, get_tok_value(xctx->inst[inst].prop_ptr,"numslots",2)); - if(!numslots) my_strdup(493, &numslots, get_tok_value(template,"numslots",2)); + my_strdup(492, &numslots, get_tok_value(xctx->inst[inst].prop_ptr,"numslots",0)); + if(!numslots) my_strdup(493, &numslots, get_tok_value(template,"numslots",0)); if(!numslots) my_strdup(494, &numslots, "1"); my_strdup(495, &name,xctx->inst[inst].instname); @@ -1846,9 +1844,9 @@ void print_tedax_element(FILE *fd, int inst) if(!name) my_strdup(2, &name, get_tok_value(template, "name", 0)); /* allow format string override in instance */ - my_strdup(1185, &format, get_tok_value(xctx->inst[inst].prop_ptr,"tedax_format",2)); + my_strdup(1185, &format, get_tok_value(xctx->inst[inst].prop_ptr,"tedax_format",0)); if(!format || !format[0]) - my_strdup(497, &format, get_tok_value((xctx->inst[inst].ptr+ xctx->sym)->prop_ptr,"tedax_format",2)); + my_strdup(497, &format, get_tok_value((xctx->inst[inst].ptr+ xctx->sym)->prop_ptr,"tedax_format",0)); no_of_pins= (xctx->inst[inst].ptr+ xctx->sym)->rects[PINLAYER]; if( !format && !strcmp((xctx->inst[inst].ptr+ xctx->sym)->type, "subcircuit") ) { @@ -2138,7 +2136,7 @@ void print_verilog_element(FILE *fd, int inst) int token_pos=0, value_pos=0; int quote=0; - if(get_tok_value((xctx->inst[inst].ptr+ xctx->sym)->prop_ptr,"verilog_format",2)[0] != '\0') { + if(get_tok_value((xctx->inst[inst].ptr+ xctx->sym)->prop_ptr,"verilog_format",0)[0] != '\0') { print_verilog_primitive(fd, inst); return; } @@ -2155,7 +2153,7 @@ void print_verilog_element(FILE *fd, int inst) no_of_pins= (xctx->inst[inst].ptr+ xctx->sym)->rects[PINLAYER]; /* 20080915 use generic_type property to decide if some properties are strings, see later */ - my_strdup(505, &generic_type, get_tok_value((xctx->inst[inst].ptr+ xctx->sym)->prop_ptr,"generic_type",2)); + my_strdup(505, &generic_type, get_tok_value((xctx->inst[inst].ptr+ xctx->sym)->prop_ptr,"generic_type",0)); s=xctx->inst[inst].prop_ptr; @@ -2203,8 +2201,8 @@ void print_verilog_element(FILE *fd, int inst) if(strcmp(token,"spice_ignore") && strcmp(token,"vhdl_ignore") && strcmp(token,"tedax_ignore")) { if(tmp == 0) {fprintf(fd, "#(\n---- start parameters\n");tmp++;tmp1=0;} if(tmp1) fprintf(fd, " ,\n"); - if( !generic_type || strcmp(get_tok_value(generic_type,token, 2), "time") ) { - if( generic_type && !strcmp(get_tok_value(generic_type,token, 2), "string") ) { + if( !generic_type || strcmp(get_tok_value(generic_type,token, 0), "time") ) { + if( generic_type && !strcmp(get_tok_value(generic_type,token, 0), "string") ) { fprintf(fd, " .%s ( \"%s\" )", token, value); } else { fprintf(fd, " .%s ( %s )", token, value); @@ -2331,9 +2329,9 @@ void print_vhdl_primitive(FILE *fd, int inst) /* netlist primitives, 20071217 * if(!name) my_strdup(50, &name, get_tok_value(template, "name", 0)); /* allow format string override in instance */ - my_strdup(1000, &format, get_tok_value(xctx->inst[inst].prop_ptr,"vhdl_format",2)); + my_strdup(1000, &format, get_tok_value(xctx->inst[inst].prop_ptr,"vhdl_format",0)); if(!format || !format[0]) - my_strdup(516, &format, get_tok_value((xctx->inst[inst].ptr+ xctx->sym)->prop_ptr,"vhdl_format",2)); + my_strdup(516, &format, get_tok_value((xctx->inst[inst].ptr+ xctx->sym)->prop_ptr,"vhdl_format",0)); if((name==NULL) || (format==NULL) ) { my_free(1047, &template); my_free(1048, &name); @@ -2378,7 +2376,7 @@ void print_vhdl_primitive(FILE *fd, int inst) /* netlist primitives, 20071217 * token[token_pos]='\0'; token_pos=0; - value = get_tok_value(xctx->inst[inst].prop_ptr, token+1, 2); + value = get_tok_value(xctx->inst[inst].prop_ptr, token+1, 0); /* get_tok_size==0 indicates that token(+1) does not exist in instance attributes */ if(!get_tok_size) value=get_tok_value(template, token+1, 0); @@ -2505,9 +2503,9 @@ void print_verilog_primitive(FILE *fd, int inst) /* netlist switch level primiti if(!name) my_strdup(4, &name, get_tok_value(template, "name", 0)); /* allow format string override in instance */ - my_strdup(1186, &format, get_tok_value(xctx->inst[inst].prop_ptr,"verilog_format",2)); + my_strdup(1186, &format, get_tok_value(xctx->inst[inst].prop_ptr,"verilog_format",0)); if(!format || !format[0]) - my_strdup(522, &format, get_tok_value((xctx->inst[inst].ptr+ xctx->sym)->prop_ptr,"verilog_format",2)); + my_strdup(522, &format, get_tok_value((xctx->inst[inst].ptr+ xctx->sym)->prop_ptr,"verilog_format",0)); if((name==NULL) || (format==NULL) ) { my_free(1054, &template); my_free(1055, &name); @@ -2552,7 +2550,7 @@ void print_verilog_primitive(FILE *fd, int inst) /* netlist switch level primiti token[token_pos]='\0'; token_pos=0; - value = get_tok_value(xctx->inst[inst].prop_ptr, token+1, 2); + value = get_tok_value(xctx->inst[inst].prop_ptr, token+1, 0); /* get_tok_size==0 indicates that token(+1) does not exist in instance attributes */ if(!get_tok_size) value=get_tok_value(template, token+1, 0); @@ -2761,8 +2759,8 @@ const char *translate(int inst, const char* s) value = NULL; get_tok_size = 0; } else { - value = get_tok_value(xctx->inst[inst].prop_ptr, token+1, 2); - if(!get_tok_size) value=get_tok_value((xctx->inst[inst].ptr+ xctx->sym)->templ, token+1, 2); + value = get_tok_value(xctx->inst[inst].prop_ptr, token+1, 0); + if(!get_tok_size) value=get_tok_value((xctx->inst[inst].ptr+ xctx->sym)->templ, token+1, 0); } if(!get_tok_size && token[0] =='$') { @@ -2840,7 +2838,7 @@ const char *translate(int inst, const char* s) /* get pin_attr from instance pin attribute string */ if(!pin_attr_value) { my_strdup(499, &pin_attr_value, - get_tok_value((xctx->inst[inst].ptr+ xctx->sym)->rect[PINLAYER][n].prop_ptr, pin_attr, 2)); + get_tok_value((xctx->inst[inst].ptr+ xctx->sym)->rect[PINLAYER][n].prop_ptr, pin_attr, 0)); } /* @#n:net_name attribute (n = pin number or name) will translate to net name attached to pin @@ -3037,7 +3035,7 @@ const char *translate2(struct Lcc *lcc, int level, char* s) my_free(1069, &value1); get_tok_size = 0; } else { - my_strdup2(332, &value1, get_tok_value(lcc[level].prop_ptr, token + 1, 2)); + my_strdup2(332, &value1, get_tok_value(lcc[level].prop_ptr, token + 1, 0)); } value = ""; if(get_tok_size) { @@ -3047,7 +3045,7 @@ const char *translate2(struct Lcc *lcc, int level, char* s) while(i > 1) { save_tok_size = get_tok_size; save_value_size = get_tok_value_size; - my_strdup2(440, &value2, get_tok_value(lcc[i-1].prop_ptr, value, 2)); + my_strdup2(440, &value2, get_tok_value(lcc[i-1].prop_ptr, value, 0)); if(get_tok_size && value2[0]) { value = value2; } else { diff --git a/src/verilog_netlist.c b/src/verilog_netlist.c index 11887943..8810307e 100644 --- a/src/verilog_netlist.c +++ b/src/verilog_netlist.c @@ -249,7 +249,7 @@ void global_verilog_netlist(int global) /* netlister driver */ } my_strdup(561, &type,(xctx->inst[i].ptr+ xctx->sym)->type); if(type && !strcmp(type,"netlist_commands")) { - fprintf(fd, "%s\n", get_tok_value(xctx->inst[i].prop_ptr,"value",2)); + fprintf(fd, "%s\n", get_tok_value(xctx->inst[i].prop_ptr,"value", 0)); } } @@ -437,8 +437,8 @@ void verilog_block_netlist(FILE *fd, int i) if(strcmp(get_tok_value(xctx->sym[i].rect[PINLAYER][j].prop_ptr,"verilog_ignore",0), "true")) { my_strdup(564, &sig_type,get_tok_value( xctx->sym[i].rect[PINLAYER][j].prop_ptr,"verilog_type",0)); - my_strdup(565, &port_value, get_tok_value( - xctx->sym[i].rect[PINLAYER][j].prop_ptr,"value",2) ); + my_strdup(565, &port_value, + get_tok_value(xctx->sym[i].rect[PINLAYER][j].prop_ptr,"value", 0) ); my_strdup(566, &dir_tmp, get_tok_value(xctx->sym[i].rect[PINLAYER][j].prop_ptr,"dir",0) ); if(strcmp(dir_tmp,"in")){ if(!sig_type || sig_type[0]=='\0') my_strdup(567, &sig_type,"wire"); /* 20070720 changed reg to wire */ @@ -473,7 +473,7 @@ void verilog_block_netlist(FILE *fd, int i) my_strdup(569, &type,(xctx->inst[l].ptr+ xctx->sym)->type); if(type && !strcmp(type,"netlist_commands")) { - fprintf(fd, "%s\n", get_tok_value(xctx->inst[l].prop_ptr,"value",2)); + fprintf(fd, "%s\n", get_tok_value(xctx->inst[l].prop_ptr,"value", 0)); } } diff --git a/src/vhdl_netlist.c b/src/vhdl_netlist.c index ff2ec033..64678972 100644 --- a/src/vhdl_netlist.c +++ b/src/vhdl_netlist.c @@ -139,7 +139,7 @@ void global_vhdl_netlist(int global) /* netlister driver */ /* if(!sig_type || sig_type[0]=='\0') my_strdup(575, &sig_type,"std_logic"); */ /* if( type && (strcmp(type,"generic"))==0) */ /* { */ - /* my_strdup(576, &port_value,get_tok_value(xctx->inst[i].prop_ptr,"value",2)); */ + /* my_strdup(576, &port_value,get_tok_value(xctx->inst[i].prop_ptr,"value", 0)); */ /* str_tmp = get_tok_value(xctx->inst[i].prop_ptr,"lab",0); */ /* if(!tmp) fprintf(fd,"generic (\n"); */ /* if(tmp) fprintf(fd," ;\n"); */ @@ -268,8 +268,8 @@ void global_vhdl_netlist(int global) /* netlister driver */ if(strcmp(get_tok_value(xctx->sym[j].rect[PINLAYER][i].prop_ptr,"vhdl_ignore",0), "true")) { my_strdup(587, &sig_type,get_tok_value( xctx->sym[j].rect[PINLAYER][i].prop_ptr,"sig_type",0)); - my_strdup(588, &port_value, get_tok_value( - xctx->sym[j].rect[PINLAYER][i].prop_ptr,"value",2) ); + my_strdup(588, &port_value, + get_tok_value(xctx->sym[j].rect[PINLAYER][i].prop_ptr,"value", 0) ); if(!sig_type || sig_type[0]=='\0') my_strdup(589, &sig_type,"std_logic"); my_strdup(590, &dir_tmp, get_tok_value(xctx->sym[j].rect[PINLAYER][i].prop_ptr,"dir",0) ); str_tmp = get_tok_value(xctx->sym[j].rect[PINLAYER][i].prop_ptr,"name",0); @@ -303,7 +303,7 @@ void global_vhdl_netlist(int global) /* netlister driver */ } my_strdup(591, &type,(xctx->inst[i].ptr+ xctx->sym)->type); if(type && !strcmp(type,"netlist_commands")) { - fprintf(fd, "%s\n", get_tok_value(xctx->inst[i].prop_ptr,"value",2)); + fprintf(fd, "%s\n", get_tok_value(xctx->inst[i].prop_ptr,"value", 0)); } } @@ -467,10 +467,10 @@ void vhdl_block_netlist(FILE *fd, int i) for(j=0;jsym[i].rects[PINLAYER];j++) { if(strcmp(get_tok_value(xctx->sym[i].rect[PINLAYER][j].prop_ptr,"vhdl_ignore",0), "true")) { - my_strdup(592, &sig_type,get_tok_value( - xctx->sym[i].rect[PINLAYER][j].prop_ptr,"sig_type",0)); - my_strdup(593, &port_value, get_tok_value( - xctx->sym[i].rect[PINLAYER][j].prop_ptr,"value",2) ); + my_strdup(592, &sig_type, + get_tok_value(xctx->sym[i].rect[PINLAYER][j].prop_ptr,"sig_type",0)); + my_strdup(593, &port_value, + get_tok_value(xctx->sym[i].rect[PINLAYER][j].prop_ptr,"value", 0) ); if(!sig_type || sig_type[0]=='\0') my_strdup(594, &sig_type,"std_logic"); my_strdup(595, &dir_tmp, get_tok_value(xctx->sym[i].rect[PINLAYER][j].prop_ptr,"dir",0) ); str_tmp = get_tok_value(xctx->sym[i].rect[PINLAYER][j].prop_ptr,"name",0); @@ -546,8 +546,8 @@ void vhdl_block_netlist(FILE *fd, int i) if(strcmp(get_tok_value(xctx->sym[j].rect[PINLAYER][k].prop_ptr,"vhdl_ignore",0), "true")) { my_strdup(597, &sig_type,get_tok_value( xctx->sym[j].rect[PINLAYER][k].prop_ptr,"sig_type",0)); - my_strdup(598, &port_value, get_tok_value( - xctx->sym[j].rect[PINLAYER][k].prop_ptr,"value",2) ); + my_strdup(598, &port_value, + get_tok_value(xctx->sym[j].rect[PINLAYER][k].prop_ptr,"value", 0) ); if(!sig_type || sig_type[0]=='\0') my_strdup(599, &sig_type,"std_logic"); my_strdup(600, &dir_tmp, get_tok_value(xctx->sym[j].rect[PINLAYER][k].prop_ptr,"dir",0) ); @@ -581,7 +581,7 @@ void vhdl_block_netlist(FILE *fd, int i) my_strdup(601, &type,(xctx->inst[l].ptr+ xctx->sym)->type); if(type && !strcmp(type,"netlist_commands")) { - fprintf(fd, "%s\n", get_tok_value(xctx->inst[l].prop_ptr,"value",2)); + fprintf(fd, "%s\n", get_tok_value(xctx->inst[l].prop_ptr,"value", 0)); } } diff --git a/src/xschem.tcl b/src/xschem.tcl index 6f01e2c3..c6fe4eb8 100644 --- a/src/xschem.tcl +++ b/src/xschem.tcl @@ -2008,7 +2008,7 @@ proc tclpropeval {s instname symname} { # this hook is called in translate() if whole string is contained in a tcleval(...) construct proc tclpropeval2 {s} { global tcl_debug env - if {$tcl_debug <=-1} {puts "tclpropeval2: $s"} + if {$tcl_debug <=-0} {puts "tclpropeval2: $s"} set path [string range [xschem get sch_path] 1 end] regsub {^tcleval\(} $s {} s regsub {\)([ \n\t]*)$} $s {\1} s diff --git a/xschem_library/devices/verilog_timescale.sym b/xschem_library/devices/verilog_timescale.sym index 5575ea8e..82c8e485 100644 --- a/xschem_library/devices/verilog_timescale.sym +++ b/xschem_library/devices/verilog_timescale.sym @@ -5,7 +5,7 @@ spice_ignore=true vhdl_ignore=true tedax_ignore=true template="name=s1 timestep=\\"100ps\\" precision=\\"100ps\\" " -verilog_format="`timescale @timestep\\/@precision"} +verilog_format="`timescale @timestep / @precision"} V {} S {} E {}