more comments and refactoring in token.c

This commit is contained in:
stefan schippers 2025-02-07 14:23:58 +01:00
parent 51ff56357d
commit 0024dc2759
2 changed files with 4 additions and 16 deletions

View File

@ -455,11 +455,13 @@ int global_spice_netlist(int global, int alert) /* netlister driver */
if(lvs_ignore && (xctx->sym[i].flags & LVS_IGNORE)) continue;
if(!xctx->sym[i].type) continue;
/* store parent symbol template attr (before descending into it) and parent instance prop_ptr
* into xctx->hier_attr[0].templ and xctx->hier_attr[0.prop_ptr,
* to resolve subschematic instances with model=@modp in format string,
* modp will be first looked up in instance prop_ptr string, and if not found
* in parent symbol template string */
my_strdup(_ALLOC_ID_, &xctx->hier_attr[xctx->currsch - 1].templ,
tcl_hook2(xctx->sym[i].templ));
/* only additional symbols (created with instance schematic=... attr) will have this attribute */
my_strdup(_ALLOC_ID_, &xctx->hier_attr[xctx->currsch - 1].prop_ptr,
tcl_hook2(xctx->sym[i].parent_prop_ptr));
my_strdup(_ALLOC_ID_, &abs_path, abs_sym_path(xctx->sym[i].name, ""));

View File

@ -2212,14 +2212,6 @@ int print_spice_element(FILE *fd, int inst)
token[token_pos]='\0';
token_pos=0;
if(strcmp(token,"@symref")==0)
{
const char *s = get_sym_name(inst, 9999, 1, 0);
@ -2376,9 +2368,6 @@ int print_spice_element(FILE *fd, int inst)
/* else tcl var spiceprefix is enabled */
}
else {
/* here a @token in format string will be replaced by value in instance prop_ptr
* or symbol template */
@ -4662,7 +4651,6 @@ const char *translate3(const char *s, int eat_escapes, const char *s1, const cha
size_t token_pos=0;
const char *value;
int escape=0;
char *value1 = NULL;
const char *escape_pos = NULL;
@ -4684,7 +4672,7 @@ const char *translate3(const char *s, int eat_escapes, const char *s1, const cha
}
space=SPACE(c);
if( state==TOK_BEGIN && (c=='@' || c=='%' ) && !escape ) state=TOK_TOKEN; /* 20161210 escape */
if( state==TOK_BEGIN && (c=='@' || c=='%' ) && !escape ) state=TOK_TOKEN;
else if(state==TOK_TOKEN && token_pos > 1 &&
(
( (space || c == '%' || c == '@') && !escape ) ||
@ -4712,9 +4700,7 @@ const char *translate3(const char *s, int eat_escapes, const char *s1, const cha
/* no definition found -> keep token */
my_strcat(_ALLOC_ID_, &result, token);
} else {
my_strdup2(_ALLOC_ID_, &value1, value);
my_strcat(_ALLOC_ID_, &result, value1);
my_free(_ALLOC_ID_, &value1);
my_strcat(_ALLOC_ID_, &result, value);
}
token_pos = 0;
if(c == '@' || c == '%') s--; /* these token separators are also identifiers for next token: push them back */