fix a regression in sort_labels.awk after moving tmpfile to /tmp; added oldvalue (for simulation) in hilight hash table

This commit is contained in:
Stefan Frederik 2020-12-26 23:53:26 +01:00
parent 40eaefbb82
commit 5295a6281c
3 changed files with 5 additions and 11 deletions

View File

@ -217,6 +217,7 @@ struct hilight_hashentry *hilight_lookup(const char *token, int value, int what)
my_strdup(138, &(entry->token),token);
entry->path = NULL;
my_strdup(139, &(entry->path),xctx->sch_path[xctx->currsch]);
entry->oldvalue=value; /* just created. There is no oldvalue */
entry->value=value;
entry->hash=hashcode;
*preventry=entry;
@ -233,6 +234,7 @@ struct hilight_hashentry *hilight_lookup(const char *token, int value, int what)
my_free(764, &entry);
*preventry=saveptr;
} else if(what == XINSERT ) {
entry->oldvalue=entry->value;
entry->value = value;
}
return entry; /* found matching entry, return the address */
@ -1353,17 +1355,9 @@ void print_hilight_net(int show)
my_free(780, &filetmp2);
return;
}
#ifdef __unix__
my_snprintf(cmd, S(cmd), "\"%s/order_labels.awk\"", tclgetvar("XSCHEM_SHAREDIR"));
#else
my_snprintf(cmd, S(cmd), "awk -f \"%s/order_labels.awk\"", tclgetvar("XSCHEM_SHAREDIR"));
#endif
my_snprintf(cmd2, S(cmd2), "%s %s > %s", cmd, filetmp1, filetmp2);
#ifdef __unix__
my_snprintf(cmd3, S(cmd3), "\"%s/sort_labels.awk\" %s", tclgetvar("XSCHEM_SHAREDIR"), filetmp1);
#else
my_snprintf(cmd3, S(cmd3), "awk -f \"%s/sort_labels.awk\" %s", tclgetvar("XSCHEM_SHAREDIR"), filetmp1);
#endif
for(i=0;i<HASHSIZE;i++) {
entry=xctx->hilight_table[i];
while(entry) {
@ -1433,7 +1427,6 @@ void print_hilight_net(int show)
xctx->prep_hi_structs=0;
xctx->prep_net_structs=0;
/* delete_netlist_structs(); */
my_free(781, &filetmp1);
my_free(782, &filetmp2);
}

View File

@ -22,8 +22,8 @@ END{
print line[i] > FILENAME
}
close(FILENAME)
system("sort -k 2 " FILENAME " | awk '{$NF=\"\"; print $0}' > " "." FILENAME ".xxxxx")
system("mv ." FILENAME ".xxxxx " FILENAME)
system("sort -k 2 " FILENAME " | awk '{$NF=\"\"; print $0}' > " FILENAME ".xxxxx")
system("mv " FILENAME ".xxxxx " FILENAME)
}

View File

@ -642,6 +642,7 @@ struct hilight_hashentry {
char *token;
char *path; /* hierarchy path */
int value; /* hilight color */
int oldvalue; /* previous hilight color */
};
/* for netlist.c */