skip NULL or empty texts in draw_symbol, translate2() skip @@... and @#... tokens (return empty)

This commit is contained in:
Stefan Frederik 2022-10-21 17:48:54 +02:00
parent 4e05fe1bab
commit cb652adb5f
3 changed files with 7 additions and 7 deletions

View File

@ -555,7 +555,7 @@ void draw_symbol(int what,int c, int n,int layer,short tmp_flip, short rot,
for(j=0;j< symptr->texts;j++)
{
text = symptr->text[j];
if(text.xscale*FONTWIDTH*xctx->mooz<1) continue;
if(!text.txt_ptr || !text.txt_ptr[0] || text.xscale*FONTWIDTH*xctx->mooz<1) continue;
if(!xctx->show_hidden_texts && (text.flags & HIDE_TEXT)) continue;
if( hide && text.txt_ptr && strcmp(text.txt_ptr, "@symname") && strcmp(text.txt_ptr, "@name") ) continue;
txtptr= translate(n, text.txt_ptr);
@ -715,8 +715,8 @@ void draw_temp_symbol(int what, GC gc, int n,int layer,short tmp_flip, short rot
for(j=0;j< symptr->texts;j++)
{
text = symptr->text[j];
if(!text.txt_ptr || !text.txt_ptr[0] || text.xscale*FONTWIDTH*xctx->mooz<1) continue;
if(!xctx->show_hidden_texts && (text.flags & HIDE_TEXT)) continue;
if(text.xscale*FONTWIDTH*xctx->mooz<1) continue;
txtptr= translate(n, text.txt_ptr);
ROTATION(rot, flip, 0.0,0.0,text.x0,text.y0,x1,y1);
#if HAS_CAIRO==1

View File

@ -3128,10 +3128,10 @@ int load_sym_def(const char *name, FILE *embed_fd)
const char* tmp = translate2(lcc, level, tt[i].txt_ptr);
dbg(1, "l_s_d(): txt2: tt[i].txt_ptr=%s, i=%d\n", tt[i].txt_ptr, i);
rot = lcc[level].rot; flip = lcc[level].flip;
if (tmp) my_strdup(651, &tt[i].txt_ptr, tmp);
my_strdup2(651, &tt[i].txt_ptr, tmp);
dbg(1, "l_s_d(): txt3: tt[i].txt_ptr=%s, i=%d\n", tt[i].txt_ptr, i);
/* allow annotation inside LCC instances. */
if(tt[i].txt_ptr && !strcmp(tt[i].txt_ptr, "@spice_get_voltage")) {
if(!strcmp(tt[i].txt_ptr, "@spice_get_voltage")) {
/* prop_ptr is the attribute string of last loaded LCC component */
const char *lab;
size_t new_size = 0;
@ -3152,7 +3152,7 @@ int load_sym_def(const char *name, FILE *embed_fd)
my_free(1589, &path);
dbg(1, " --> tt[i].txt_ptr=%s\n", tt[i].txt_ptr);
}
if(tt[i].txt_ptr && !strcmp(tt[i].txt_ptr, "@spice_get_current")) {
if(!strcmp(tt[i].txt_ptr, "@spice_get_current")) {
/* prop_ptr is the attribute string of last loaded LCC component */
const char *dev;
size_t new_size = 0;

View File

@ -3431,12 +3431,12 @@ const char *translate2(Lcc *lcc, int level, char* s)
token[token_pos] = '\0';
token_pos = 0;
dbg(1, "translate2(): lcc[%d].prop_ptr=%s\n", level, lcc[level].prop_ptr);
dbg(1, "translate2(): lcc[%d].prop_ptr=%s token=%s\n", level, lcc[level].prop_ptr, token);
/* if spiceprefix==0 and token == @spiceprefix then set empty value */
if(!tclgetboolvar("spiceprefix") && !strcmp(token, "@spiceprefix")) {
if(value) my_free(1069, &value);
xctx->tok_size = 0;
} else if(!strncmp(token, "@#",2)) { /* get rid of pin attribute info */
} else if(token[0] == '@' && (token[1] == '@' || token[1] == '#')) { /* get rid of pin attribute info */
if(value) my_free(1572, &value);
xctx->tok_size = 0;
} else {