Merge branch 'master' into SuperChayan
This commit is contained in:
commit
41fff7fca0
|
|
@ -1994,7 +1994,7 @@ void get_additional_symbols(int what)
|
|||
/* resolve schematic=generator.tcl( @n ) where n=11 is defined in instance attrs */
|
||||
my_strdup2(_ALLOC_ID_, &sch,
|
||||
translate3(get_tok_value(xctx->inst[i].prop_ptr,"schematic", 6), 1,
|
||||
xctx->inst[i].prop_ptr, NULL, NULL));
|
||||
xctx->inst[i].prop_ptr, NULL, NULL, NULL));
|
||||
dbg(1, "sch=%s\n", sch);
|
||||
|
||||
my_strdup2(_ALLOC_ID_, &sch, tcl_hook2(
|
||||
|
|
@ -2034,7 +2034,7 @@ void get_additional_symbols(int what)
|
|||
my_strdup(_ALLOC_ID_, &spice_sym_def,
|
||||
translate3(spice_sym_def, 1, xctx->inst[i].prop_ptr,
|
||||
symptr->templ,
|
||||
symname_attr));
|
||||
symname_attr, NULL));
|
||||
dbg(1, "get_additional_symbols(): spice_sym_def=%s\n", spice_sym_def);
|
||||
my_free(_ALLOC_ID_, &symname_attr);
|
||||
/* if instance symbol has default_schematic set to ignore copy the symbol anyway, since
|
||||
|
|
@ -2128,7 +2128,7 @@ void get_sch_from_sym(char *filename, xSymbol *sym, int inst, int fallback)
|
|||
/* resolve schematic=generator.tcl( @n ) where n=11 is defined in instance attrs */
|
||||
if(inst >=0 ) {
|
||||
my_strdup(_ALLOC_ID_, &str_tmp, translate3(get_tok_value(xctx->inst[inst].prop_ptr,"schematic", 6),
|
||||
1, xctx->inst[inst].prop_ptr, NULL, NULL));
|
||||
1, xctx->inst[inst].prop_ptr, NULL, NULL, NULL));
|
||||
}
|
||||
if(!str_tmp) my_strdup2(_ALLOC_ID_, &str_tmp, get_tok_value(sym->prop_ptr, "schematic", 6));
|
||||
if(str_tmp[0]) { /* schematic attribute in symbol or instance was given */
|
||||
|
|
|
|||
|
|
@ -736,7 +736,7 @@ void draw_symbol(int what,int c, int n,int layer,short tmp_flip, short rot,
|
|||
dbg(1, "draw_symbol(): drawing string: str=%s prop=%s\n",
|
||||
txtptr, text.prop_ptr ? text.prop_ptr : "<NULL>");
|
||||
my_strdup2(_ALLOC_ID_, &txtptr, translate3(txtptr, 1, xctx->inst[n].prop_ptr,
|
||||
xctx->sym[xctx->inst[n].ptr].templ, NULL ));
|
||||
xctx->sym[xctx->inst[n].ptr].templ, NULL, NULL));
|
||||
dbg(1, "draw_symbol(): after translate3: str=%s\n", txtptr);
|
||||
draw_string(textlayer, what, txtptr,
|
||||
(text.rot + ( (flip && (text.rot & 1) ) ? rot+2 : rot) ) & 0x3,
|
||||
|
|
@ -906,7 +906,7 @@ void draw_temp_symbol(int what, GC gc, int n,int layer,short tmp_flip, short rot
|
|||
my_strdup2(_ALLOC_ID_, &txtptr, translate(n, text.txt_ptr));
|
||||
/* do another round of substitutions if some @var are found, but if not found leave @var as is */
|
||||
my_strdup2(_ALLOC_ID_, &txtptr, translate3(txtptr, 1, xctx->inst[n].prop_ptr,
|
||||
xctx->sym[xctx->inst[n].ptr].templ, NULL ));
|
||||
xctx->sym[xctx->inst[n].ptr].templ, NULL, NULL));
|
||||
dbg(1, "draw_temp_symbol(): after translate3: str=%s\n", txtptr);
|
||||
if(txtptr[0]) draw_temp_string(gc, what, txtptr,
|
||||
(text.rot + ( (flip && (text.rot & 1) ) ? rot+2 : rot) ) & 0x3,
|
||||
|
|
|
|||
|
|
@ -1475,7 +1475,7 @@ int drc_check(int i)
|
|||
my_strdup(_ALLOC_ID_, &drc, get_tok_value(xctx->sym[xctx->inst[j].ptr].prop_ptr, "drc", 2));
|
||||
if(drc) {
|
||||
my_strdup(_ALLOC_ID_, &res, translate3(drc, 1,
|
||||
xctx->inst[j].prop_ptr, xctx->sym[xctx->inst[j].ptr].templ, NULL));
|
||||
xctx->inst[j].prop_ptr, xctx->sym[xctx->inst[j].ptr].templ, NULL, NULL));
|
||||
dbg(1, "drc_check(): res = |%s|, drc=|%s|\n", res, drc);
|
||||
if(res) {
|
||||
const char *result;
|
||||
|
|
|
|||
|
|
@ -6068,9 +6068,9 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
int eat_escapes = 0;
|
||||
if(!xctx) {Tcl_SetResult(interp, not_avail, TCL_STATIC); return TCL_ERROR;}
|
||||
if(argc > 3) eat_escapes = atoi(argv[3]);
|
||||
if(argc > 6) my_strdup2(_ALLOC_ID_, &s, translate3(argv[2], eat_escapes, argv[4], argv[5], argv[6]));
|
||||
else if(argc > 5) my_strdup2(_ALLOC_ID_, &s, translate3(argv[2], eat_escapes, argv[4], argv[5], NULL));
|
||||
else if(argc > 4) my_strdup2(_ALLOC_ID_, &s, translate3(argv[2], eat_escapes, argv[4], NULL, NULL));
|
||||
if(argc > 6) my_strdup2(_ALLOC_ID_, &s, translate3(argv[2], eat_escapes, argv[4], argv[5], argv[6], NULL));
|
||||
else if(argc > 5) my_strdup2(_ALLOC_ID_, &s, translate3(argv[2], eat_escapes, argv[4], argv[5], NULL, NULL));
|
||||
else if(argc > 4) my_strdup2(_ALLOC_ID_, &s, translate3(argv[2], eat_escapes, argv[4], NULL, NULL, NULL));
|
||||
else {
|
||||
Tcl_SetResult(interp, "xschem translate3: missing arguments", TCL_STATIC);
|
||||
return TCL_ERROR;
|
||||
|
|
|
|||
|
|
@ -645,7 +645,7 @@ int spice_block_netlist(FILE *fd, int i, int alert)
|
|||
char *symname_attr = NULL;
|
||||
const char *translated_sym_def;
|
||||
my_mstrcat(_ALLOC_ID_, &symname_attr, "symname=", get_cell(name, 0), NULL);
|
||||
translated_sym_def = translate3(sym_def, 1, "", xctx->sym[i].templ, symname_attr);
|
||||
translated_sym_def = translate3(sym_def, 1, xctx->sym[i].templ, symname_attr, NULL, NULL);
|
||||
my_free(_ALLOC_ID_, &symname_attr);
|
||||
fprintf(fd, "%s\n", translated_sym_def);
|
||||
my_free(_ALLOC_ID_, &sym_def);
|
||||
|
|
|
|||
17
src/token.c
17
src/token.c
|
|
@ -1887,7 +1887,7 @@ static int has_included_subcircuit(int inst, int symbol, char **result)
|
|||
my_mstrcat(_ALLOC_ID_, &symname_attr, " symref=", get_sym_name(inst, 9999, 1, 1), NULL);
|
||||
translated_sym_def = translate3(spice_sym_def, 1, xctx->inst[inst].prop_ptr,
|
||||
xctx->sym[symbol].templ,
|
||||
symname_attr);
|
||||
symname_attr, NULL);
|
||||
dbg(1, "has_included_subcircuit(): translated_sym_def=%s\n", translated_sym_def);
|
||||
dbg(1, "has_included_subcircuit(): symname=%s\n", symname);
|
||||
|
||||
|
|
@ -2397,7 +2397,7 @@ int print_spice_element(FILE *fd, int inst)
|
|||
parent_templ = xctx->hier_attr[xctx->currsch - 1].templ;
|
||||
}
|
||||
dbg(1, "print_spice_element(): before translate3(): value=%s\n", value);
|
||||
value = translate3(val, 0, xctx->inst[inst].prop_ptr, parent_prop_ptr, parent_templ);
|
||||
value = translate3(val, 0, xctx->inst[inst].prop_ptr, parent_prop_ptr, parent_templ, NULL);
|
||||
dbg(1, "print_spice_element(): after translate3(): value=%s\n", value);
|
||||
}
|
||||
tok_val_len = strlen(value);
|
||||
|
|
@ -2412,7 +2412,7 @@ int print_spice_element(FILE *fd, int inst)
|
|||
|
||||
if(strstr(value, "expr(") ) {
|
||||
my_strdup2(_ALLOC_ID_, &val, value);
|
||||
value = eval_expr(translate3(val, 1, xctx->inst[inst].prop_ptr, template, NULL));
|
||||
value = eval_expr(translate3(val, 1, xctx->inst[inst].prop_ptr, template, NULL, NULL));
|
||||
}
|
||||
/* token=%xxxx and xxxx is not defined in prop_ptr or template: return xxxx */
|
||||
if(!token_exists && token[0] =='%') {
|
||||
|
|
@ -4493,7 +4493,8 @@ const char *translate(int inst, const char* s)
|
|||
if(strstr(result, "expr(")) {
|
||||
dbg(1, "translate(): expr():%s\n", result);
|
||||
my_strdup2(_ALLOC_ID_, &result, eval_expr(
|
||||
translate3(result, 1, xctx->inst[inst].prop_ptr, xctx->sym[xctx->inst[inst].ptr].templ, NULL)));
|
||||
translate3(result, 1, xctx->inst[inst].prop_ptr, xctx->sym[xctx->inst[inst].ptr].templ,
|
||||
NULL, NULL)));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
|
@ -4640,7 +4641,8 @@ const char *translate2(Lcc *lcc, int level, char* s)
|
|||
/* using s1, s2, s3 in turn to resolve @tokens */
|
||||
/* if no definition for @token is found return @token as is in s */
|
||||
/* if s==NULL return emty string */
|
||||
const char *translate3(const char *s, int eat_escapes, const char *s1, const char *s2, const char *s3)
|
||||
const char *translate3(const char *s, int eat_escapes, const char *s1,
|
||||
const char *s2, const char *s3, const char *s4)
|
||||
{
|
||||
static const char *empty="";
|
||||
static char *translated_tok = NULL;
|
||||
|
|
@ -4659,7 +4661,7 @@ const char *translate3(const char *s, int eat_escapes, const char *s1, const cha
|
|||
my_free(_ALLOC_ID_, &translated_tok);
|
||||
return empty;
|
||||
}
|
||||
dbg(2, "translate3():\n s=%s\n s1=%s\n s2=%s\n s3=%s\n", s, s1, s2, s3);
|
||||
dbg(2, "translate3():\n s=%s\n s1=%s\n s2=%s\n s3=%s s4=%s\n", s, s1, s2, s3, s4);
|
||||
my_strdup2(_ALLOC_ID_, &result, "");
|
||||
|
||||
while(1) {
|
||||
|
|
@ -4696,6 +4698,9 @@ const char *translate3(const char *s, int eat_escapes, const char *s1, const cha
|
|||
if(!xctx->tok_size && s3) {
|
||||
value=get_tok_value(s3, token+1, 0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
if(!xctx->tok_size) { /* above lines did not find a value for token */
|
||||
/* no definition found -> keep token */
|
||||
my_strcat(_ALLOC_ID_, &result, token);
|
||||
|
|
|
|||
|
|
@ -949,7 +949,7 @@ static void xwin_exit(void)
|
|||
list_tokens(NULL, 0); /* clear static data in function */
|
||||
translate(-1, NULL); /* clear static data in function */
|
||||
translate2(NULL, 0, NULL); /* clear static data in function */
|
||||
translate3(NULL, 0, NULL, NULL, NULL); /* clear static data in function */
|
||||
translate3(NULL, 0, NULL, NULL, NULL, NULL); /* clear static data in function */
|
||||
subst_token(NULL, NULL, NULL); /* clear static data in function */
|
||||
find_nth(NULL, "", "", 0, 0); /* clear static data in function */
|
||||
trim_chars(NULL, ""); /* clear static data in function */
|
||||
|
|
|
|||
|
|
@ -1613,7 +1613,8 @@ extern int isonlydigit(const char *s);
|
|||
extern const char *spice_get_node(const char *token);
|
||||
extern const char *translate(int inst, const char* s);
|
||||
extern const char* translate2(Lcc *lcc, int level, char* s);
|
||||
extern const char *translate3(const char* s, int eat_escapes, const char *s1, const char *s2, const char *s3);
|
||||
extern const char *translate3(const char* s, int eat_escapes, const char *s1,
|
||||
const char *s2, const char *s3, const char *s4);
|
||||
extern void print_tedax_element(FILE *fd, int inst);
|
||||
extern int print_spice_element(FILE *fd, int inst);
|
||||
extern void print_spice_subckt_nodes(FILE *fd, int symbol);
|
||||
|
|
|
|||
Loading…
Reference in New Issue