changed attribute text_n_size to text_size_n (for efficienty reasons), improved get_tok_val() (use strstr for quick return "" if no token found)
This commit is contained in:
parent
28ed1351f1
commit
b2aad10650
|
|
@ -127,7 +127,7 @@ name="mchanged_name" model=\"nmos\" w="20u" l="3u" m="10"
|
||||||
<p> A <kbd>hide=true</kbd> attribute will only display the symbol bounding box.</p>
|
<p> A <kbd>hide=true</kbd> attribute will only display the symbol bounding box.</p>
|
||||||
<li><kbd>hide_texts</kbd></li>
|
<li><kbd>hide_texts</kbd></li>
|
||||||
<p> A <kbd>hide_texts=true</kbd> attribute will hide all symbol texts.</p>
|
<p> A <kbd>hide_texts=true</kbd> attribute will hide all symbol texts.</p>
|
||||||
<li><kbd>text_<n>_size</kbd></li>
|
<li><kbd>text_size_<n></kbd></li>
|
||||||
<p> This attribute sets the size of symbol text item number <kbd>n</kbd>. This allows
|
<p> This attribute sets the size of symbol text item number <kbd>n</kbd>. This allows
|
||||||
instance based symbol text sizing.</p>
|
instance based symbol text sizing.</p>
|
||||||
<li><kbd>highlight</kbd></li>
|
<li><kbd>highlight</kbd></li>
|
||||||
|
|
|
||||||
|
|
@ -808,42 +808,42 @@ int set_inst_flags(xInstance *inst)
|
||||||
my_strdup2(_ALLOC_ID_, &(inst->lab), get_tok_value(inst->prop_ptr,"lab",0));
|
my_strdup2(_ALLOC_ID_, &(inst->lab), get_tok_value(inst->prop_ptr,"lab",0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!strboolcmp(get_tok_value(inst->prop_ptr,"hide",0), "true"))
|
if(!strboolcmp(get_tok_value(inst->prop_ptr,"hide",0), "true"))
|
||||||
inst->flags |= HIDE_INST;
|
inst->flags |= HIDE_INST;
|
||||||
|
if(!strboolcmp(get_tok_value(inst->prop_ptr,"hide_texts",0), "true"))
|
||||||
|
inst->flags |= HIDE_SYMBOL_TEXTS;
|
||||||
|
|
||||||
ptr = get_tok_value(inst->prop_ptr,"spice_ignore",0);
|
ptr = get_tok_value(inst->prop_ptr,"spice_ignore",0);
|
||||||
if(!strcmp(ptr, "short"))
|
if(!strcmp(ptr, "short"))
|
||||||
inst->flags |= SPICE_SHORT;
|
inst->flags |= SPICE_SHORT;
|
||||||
else if(!strboolcmp(ptr, "true") || !strcmp(ptr, "open"))
|
else if(!strboolcmp(ptr, "true") || !strcmp(ptr, "open"))
|
||||||
inst->flags |= SPICE_IGNORE;
|
inst->flags |= SPICE_IGNORE;
|
||||||
|
|
||||||
ptr = get_tok_value(inst->prop_ptr,"verilog_ignore",0);
|
ptr = get_tok_value(inst->prop_ptr,"verilog_ignore",0);
|
||||||
if(!strcmp(ptr, "short"))
|
if(!strcmp(ptr, "short"))
|
||||||
inst->flags |= VERILOG_SHORT;
|
inst->flags |= VERILOG_SHORT;
|
||||||
else if(!strboolcmp(ptr, "true") || !strcmp(ptr, "open"))
|
else if(!strboolcmp(ptr, "true") || !strcmp(ptr, "open"))
|
||||||
inst->flags |= VERILOG_IGNORE;
|
inst->flags |= VERILOG_IGNORE;
|
||||||
|
|
||||||
ptr = get_tok_value(inst->prop_ptr,"vhdl_ignore",0);
|
ptr = get_tok_value(inst->prop_ptr,"vhdl_ignore",0);
|
||||||
if(!strcmp(ptr, "short"))
|
if(!strcmp(ptr, "short"))
|
||||||
inst->flags |= VHDL_SHORT;
|
inst->flags |= VHDL_SHORT;
|
||||||
else if(!strboolcmp(ptr, "true") || !strcmp(ptr, "open"))
|
else if(!strboolcmp(ptr, "true") || !strcmp(ptr, "open"))
|
||||||
inst->flags |= VHDL_IGNORE;
|
inst->flags |= VHDL_IGNORE;
|
||||||
|
|
||||||
ptr = get_tok_value(inst->prop_ptr,"tedax_ignore",0);
|
ptr = get_tok_value(inst->prop_ptr,"tedax_ignore",0);
|
||||||
if(!strcmp(ptr, "short"))
|
if(!strcmp(ptr, "short"))
|
||||||
inst->flags |= TEDAX_SHORT;
|
inst->flags |= TEDAX_SHORT;
|
||||||
else if(!strboolcmp(ptr, "true") || !strcmp(ptr, "open"))
|
else if(!strboolcmp(ptr, "true") || !strcmp(ptr, "open"))
|
||||||
inst->flags |= TEDAX_IGNORE;
|
inst->flags |= TEDAX_IGNORE;
|
||||||
|
|
||||||
ptr = get_tok_value(inst->prop_ptr,"lvs_ignore",0);
|
ptr = get_tok_value(inst->prop_ptr,"lvs_ignore",0);
|
||||||
if(!strcmp(ptr, "short"))
|
if(!strcmp(ptr, "short"))
|
||||||
inst->flags |= LVS_IGNORE_SHORT;
|
inst->flags |= LVS_IGNORE_SHORT;
|
||||||
else if(!strboolcmp(ptr, "true") || !strcmp(ptr, "open"))
|
else if(!strboolcmp(ptr, "true") || !strcmp(ptr, "open"))
|
||||||
inst->flags |= LVS_IGNORE_OPEN;
|
inst->flags |= LVS_IGNORE_OPEN;
|
||||||
|
|
||||||
if(!strboolcmp(get_tok_value(inst->prop_ptr,"hide_texts",0), "true"))
|
|
||||||
inst->flags |= HIDE_SYMBOL_TEXTS;
|
|
||||||
|
|
||||||
if(!strboolcmp(get_tok_value(inst->prop_ptr,"highlight",0), "true"))
|
if(!strboolcmp(get_tok_value(inst->prop_ptr,"highlight",0), "true"))
|
||||||
inst->flags |= HILIGHT_CONN;
|
inst->flags |= HILIGHT_CONN;
|
||||||
|
|
||||||
|
|
|
||||||
12
src/draw.c
12
src/draw.c
|
|
@ -420,17 +420,21 @@ void get_sym_text_size(int inst, int text_n, double *xscale, double *yscale)
|
||||||
const char *ts;
|
const char *ts;
|
||||||
double size;
|
double size;
|
||||||
int sym_n = xctx->inst[inst].ptr;
|
int sym_n = xctx->inst[inst].ptr;
|
||||||
xText *txtptr;
|
|
||||||
|
|
||||||
if(sym_n >= 0 && xctx->sym[sym_n].texts > text_n) {
|
if(sym_n >= 0 && xctx->sym[sym_n].texts > text_n) {
|
||||||
txtptr = &(xctx->sym[sym_n].text[text_n]);
|
if(strstr(xctx->inst[inst].prop_ptr, "text_size_")) {
|
||||||
my_snprintf(attr, S(attr), "text_%d_size", text_n);
|
my_snprintf(attr, S(attr), "text_size_%d", text_n);
|
||||||
ts = get_tok_value(xctx->inst[inst].prop_ptr, attr, 0);
|
ts = get_tok_value(xctx->inst[inst].prop_ptr, attr, 0);
|
||||||
|
} else {
|
||||||
|
xctx->tok_size = 0;
|
||||||
|
}
|
||||||
if(xctx->tok_size) {
|
if(xctx->tok_size) {
|
||||||
size = atof(ts);
|
size = atof(ts);
|
||||||
*xscale = size;
|
*xscale = size;
|
||||||
*yscale = size;
|
*yscale = size;
|
||||||
} else {
|
} else {
|
||||||
|
xText *txtptr;
|
||||||
|
txtptr = &(xctx->sym[sym_n].text[text_n]);
|
||||||
*xscale = txtptr->xscale;
|
*xscale = txtptr->xscale;
|
||||||
*yscale = txtptr->yscale;
|
*yscale = txtptr->yscale;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -440,6 +440,7 @@ const char *get_tok_value(const char *s,const char *tok, int with_quotes)
|
||||||
static char *translated_tok = NULL;
|
static char *translated_tok = NULL;
|
||||||
|
|
||||||
xctx->tok_size = 0;
|
xctx->tok_size = 0;
|
||||||
|
|
||||||
if(s==NULL) {
|
if(s==NULL) {
|
||||||
if(tok == NULL) {
|
if(tok == NULL) {
|
||||||
my_free(_ALLOC_ID_, &result);
|
my_free(_ALLOC_ID_, &result);
|
||||||
|
|
@ -450,6 +451,7 @@ const char *get_tok_value(const char *s,const char *tok, int with_quotes)
|
||||||
}
|
}
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
if(!tok || !strstr(s, tok)) return "";
|
||||||
/* dbg(0, "get_tok_value(): looking for <%s> in <%.30s>\n",tok,s); */
|
/* dbg(0, "get_tok_value(): looking for <%s> in <%.30s>\n",tok,s); */
|
||||||
if( size == 0 ) {
|
if( size == 0 ) {
|
||||||
sizetok = size = CADCHUNKALLOC;
|
sizetok = size = CADCHUNKALLOC;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue