Merge branch 'StefanSchippers:master' into master

This commit is contained in:
Chayan Deb 2025-01-04 17:35:16 +05:30 committed by GitHub
commit 4e084d8cae
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
17 changed files with 202 additions and 142 deletions

View File

@ -1452,8 +1452,15 @@ C {verilog_timescale.sym} 1050 -100 0 0 {name=s1 timestep="1ns" precision="1ns"
<li><kbd> set_different_tok str new_str old_str</kbd></li><pre>
Return string 'str' replacing/adding/removing tokens that are
different between 'new_str' and 'old_str' </pre>
<li><kbd> set_modify</kbd></li><pre>
Force modify status on current schematic </pre>
<li><kbd> set_modify [n]</kbd></li><pre>
Force modify status on current schematic
integer 'n':
0 : clear modified flag, update title and tab names, upd. simulation button colors.
1 : set modified flag, update title and tab names, upd. simulation button colors, rst floater caches.
2 : clear modified flag, do nothing else.
3 : set modified flag, do nothing else.
-1 : set title, rst floater caches.
-2 : rst floater caches, update simulation button colors (Simulate, Waves, Netlist).</pre>
<li><kbd> setprop instance|symbol|text|rect ref tok [val] [fast]</kbd></li><pre>
setprop instance inst [tok] [val] [fast]
@ -1685,6 +1692,7 @@ C {verilog_timescale.sym} 1050 -100 0 0 {name=s1 timestep="1ns" precision="1ns"
</ul>

View File

@ -140,9 +140,14 @@ const char *get_text_floater(int i)
return txt_ptr;
}
/* mod=-1 used to force set title
* mod=-2 used to reset floaters cache
* if floaters are present set_modify(1) (after a modify opration) must be done before draw()
/* mod:
* 0 : clear modified flag, update title and tab names, upd. simulation button colors.
* 1 : set modified flag, update title and tab names, upd. simulation button colors, rst floater caches.
* 2 : clear modified flag, do nothing else.
* 3 : set modified flag, do nothing else.
* -1 : set title, rst floater caches.
* -2 : rst floater caches, update simulation button colors (Simulate, Waves, Netlist).
* If floaters are present set_modify(1) (after a modify operation) must be done before draw()
* to invalidate cached floater string values before redrawing
* return 1 if floaters are found (mod==-2 or mod == 1 or mod == -1) */
int set_modify(int mod)
@ -152,8 +157,8 @@ int set_modify(int mod)
dbg(1, "set_modify(): %d, prev_set_modify=%d\n", mod, xctx->prev_set_modify);
/* set modify state */
if(mod == 0 || mod == 1) {
xctx->modified = mod;
if(mod == 0 || mod == 1 || mod == 2 || mod == 3) {
xctx->modified = (mod & 1);
}
if(mod == 1 || (mod == 0 && xctx->prev_set_modify) || mod == -2) {
/* Do not configure buttons if displaying in preview window */

View File

@ -771,7 +771,8 @@ void draw_symbol(int what,int c, int n,int layer,short tmp_flip, short rot,
dbg(1, "draw_symbol(): drawing string: before translate(): text.txt_ptr=%s\n", text.txt_ptr);
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 */
dbg(1, "draw_symbol(): drawing string: str=%s prop=%s\n", txtptr, text.prop_ptr ? text.prop_ptr : "NULL");
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 ));
dbg(1, "draw_symbol(): after translate3: str=%s\n", txtptr);
@ -2478,7 +2479,7 @@ int graph_fullyzoom(xRect *r, Graph_ctx *gr, int graph_dataset)
/* also trim spaces */
my_strdup2(_ALLOC_ID_, &bus_msb, trim_chars(tmp_ptr, "\n "));
}
dbg(1, "ntok_copy=|%s|, bus_msb=|%s|\n", ntok_copy, bus_msb ? bus_msb : "NULL");
dbg(1, "ntok_copy=|%s|, bus_msb=|%s|\n", ntok_copy, bus_msb ? bus_msb : "<NULL>");
stok = my_strtok_r(sptr, "\n\t ", "\"", 0, &saves);
nptr = sptr = NULL;
if(stok && stok[0]) {
@ -3352,7 +3353,7 @@ int edit_wave_attributes(int what, int i, Graph_ctx *gr)
ctok = my_strtok_r(cptr, " ", "", 0, &savec);
stok = my_strtok_r(sptr, "\t\n ", "\"", 0, &saves);
nptr = cptr = sptr = NULL;
dbg(1, "ntok=%s ctok=%s\n", ntok, ctok? ctok: "NULL");
dbg(1, "ntok=%s ctok=%s\n", ntok, ctok? ctok: "<NULL>");
if(stok && stok[0]) {
sweep_idx = get_raw_index(stok, NULL);
if( sweep_idx == -1) sweep_idx = 0;
@ -3828,11 +3829,11 @@ void draw_graph(int i, const int flags, Graph_ctx *gr, void *ct)
/* also trim spaces */
my_strdup2(_ALLOC_ID_, &bus_msb, trim_chars(tmp_ptr, "\n "));
}
dbg(1, "ntok_copy=|%s|, bus_msb=|%s|\n", ntok_copy, bus_msb ? bus_msb : "NULL");
dbg(1, "ntok_copy=|%s|, bus_msb=|%s|\n", ntok_copy, bus_msb ? bus_msb : "<NULL>");
ctok = my_strtok_r(cptr, " ", "", 0, &savec);
stok = my_strtok_r(sptr, "\t\n ", "\"", 0, &saves);
cptr = sptr = NULL;
dbg(1, "ntok_copy=%s ctok=%s\n", ntok_copy, ctok? ctok: "NULL");
dbg(1, "ntok_copy=%s ctok=%s\n", ntok_copy, ctok? ctok: "<NULL>");
if(ctok && ctok[0]) wc = atoi(ctok);
if(wc < 0) wc = 4;
if(wc >= cadlayers) wc = cadlayers - 1;
@ -3863,7 +3864,7 @@ void draw_graph(int i, const int flags, Graph_ctx *gr, void *ct)
else hilight_graph_node(bus_msb, wc);
}
}
dbg(1, "express=%s, bus_msb=%s\n", express ? express : "NULL", bus_msb ? bus_msb : "NULL");
dbg(1, "express=%s, bus_msb=%s\n", express ? express : "<NULL>", bus_msb ? bus_msb : "<NULL>");
/* quickly find index number of ntok_copy variable to be plotted */
if(sch_waves_loaded() != -1 && valid_rawfile &&
(expression || (idx = get_raw_index(bus_msb ? bus_msb : express, NULL)) != -1)) {

View File

@ -624,7 +624,8 @@ size_t my_mstrcat(int id, char **str, const char *add, ...)
size_t my_strcat(int id, char **str, const char *append_str)
{
size_t s, a;
dbg(3,"my_strcat(%d,): str=%s append_str=%s\n", id, *str, append_str);
dbg(3,"my_strcat(%d,): str=%s append_str=%s\n", id,
*str? *str : "<NULL>", append_str ? append_str : "<NULL>");
if( *str != NULL)
{
s = strlen(*str);
@ -648,7 +649,8 @@ size_t my_strcat(int id, char **str, const char *append_str)
size_t my_strcat2(int id, char **str, const char *append_str)
{
size_t s, a;
dbg(3,"my_strcat(%d,): str=%s append_str=%s\n", id, *str, append_str);
dbg(3,"my_strcat(%d,): str=%s append_str=%s\n", id,
*str? *str : "<NULL>", append_str ? append_str : "<NULL>");
if( *str != NULL)
{
s = strlen(*str);
@ -672,7 +674,8 @@ size_t my_strcat2(int id, char **str, const char *append_str)
size_t my_strncat(int id, char **str, size_t n, const char *append_str)
{
size_t s, a;
dbg(3,"my_strncat(%d,): str=%s append_str=%s\n", id, *str, append_str);
dbg(3,"my_strncat(%d,): str=%s append_str=%s\n", id,
*str? *str : "<NULL>", append_str ? append_str : "<NULL>");
a = strlen(append_str) + 1;
if(a > n + 1) a = n + 1;
if( *str != NULL)
@ -1581,7 +1584,7 @@ static int update_symbol(const char *result, int x, int selected_inst)
dbg(1, "update_symbol(): changing prop: |%s| -> |%s|\n",
xctx->inst[*ii].prop_ptr, new_prop);
if(!pushed) { xctx->push_undo(); pushed=1;}
dbg(1, "update_symbol(): *ii=%d, new_prop=%s\n", *ii, new_prop ? new_prop : "NULL");
dbg(1, "update_symbol(): *ii=%d, new_prop=%s\n", *ii, new_prop ? new_prop : "<NULL>");
my_strdup(_ALLOC_ID_, &xctx->inst[*ii].prop_ptr, new_prop);
}
} else {

View File

@ -153,7 +153,7 @@ Hilight_hashentry *bus_hilight_hash_lookup(const char *token, int value, int wha
int mult;
dbg(1, "bus_hilight_hash_lookup(): token=%s value=%d what=%d\n",
token ? token : "NULL", value, what);
token ? token : "<NULL>", value, what);
xctx->some_nets_added = 0;
if(token==NULL) return NULL;
/* if( token[0] == '#' || !strpbrk(token, "*[],.:")) { */
@ -1478,7 +1478,7 @@ static int eval_logic_expr(int inst, int output)
stack[0] = 2; /* default if nothing is calculated: LOGIC_X */
str = xctx->simdata[inst].pin[output].function;
dbg(1, "eval_logic_expr(): inst=%d pin=%d function=%s\n", inst, output, str ? str : "NULL");
dbg(1, "eval_logic_expr(): inst=%d pin=%d function=%s\n", inst, output, str ? str : "<NULL>");
if(!str) return 2; /* no logic function defined, return LOGIC_X */
while(str[pos]) {
switch(str[pos]) {

View File

@ -921,7 +921,7 @@ static int name_attached_inst_to_net(int k, int sqx, int sqy)
if(touch(wire[k].x1, wire[k].y1, wire[k].x2, wire[k].y2, x0, y0)) {
if(!inst[n].node[p]) {
dbg(1, "name_attached_inst_to_net(): inst %s, pin %d <-- %s\n",
inst[n].instname, p, wire[k].node ? wire[k].node : "NULL");
inst[n].instname, p, wire[k].node ? wire[k].node : "<NULL>");
set_inst_node(n, p, wire[k].node);
err |= instcheck(n, p);
} else {

View File

@ -73,7 +73,7 @@ static Node_hashentry *node_hash_lookup(const char *token, const char *dir,int w
entry->hash=hashcode;
*preventry=entry;
dbg(3, "node_hash_lookup(): hashing %s : value=%s\n\n",
entry->token, entry->value? entry->value:"NULL");
entry->token, entry->value? entry->value:"<NULL>");
dbg(3, "node_hash_lookup(): hashing %s in=%d out=%d inout=%d port=%d\n",
token, d.in, d.out, d.inout, d.port);
}
@ -108,7 +108,7 @@ static Node_hashentry *node_hash_lookup(const char *token, const char *dir,int w
if(value && value[0] !='\0')
my_strdup(_ALLOC_ID_, &(entry->value), value);
dbg(3, "node_hash_lookup(): hashing %s : value=%s\n\n",
entry->token, entry->value? entry->value:"NULL");
entry->token, entry->value? entry->value:"<NULL>");
return entry;
}
}
@ -275,7 +275,7 @@ void print_vhdl_signals(FILE *fd)
mult=1;
}
dbg(2, "print_vhdl_signals(): node: %s mult: %d value=%s \n\n",
ptr->token,mult, ptr->value?ptr->value:"NULL");
ptr->token,mult, ptr->value?ptr->value:"<NULL>");
if( ptr->class && ptr->class[0] )
my_strdup(_ALLOC_ID_, &class, ptr->class);
else
@ -334,7 +334,7 @@ void print_verilog_signals(FILE *fd)
mult=1;
}
dbg(2, " print_verilog_signals(): node: %s mult: %d value=%s \n\n",
ptr->token,mult, ptr->value?ptr->value:"NULL");
ptr->token,mult, ptr->value?ptr->value:"<NULL>");
if(mult>1) {
for(j=mult-1;j>=0;j--) {
if(ptr->verilog_type && ptr->verilog_type[0]) {

View File

@ -61,11 +61,11 @@ static void check_opt(char *opt, char *optval, int type)
cli_opt_do_print = 1;
} else if( (type == LONG && !strcmp("plotfile", opt)) ) {
dbg(1, "process_options(): user plotfile specified: %s\n", optval ? optval : "NULL");
dbg(1, "process_options(): user plotfile specified: %s\n", optval ? optval : "<NULL>");
if(optval) my_strncpy(cli_opt_plotfile, optval, S(cli_opt_plotfile));
} else if( (type == LONG && !strcmp("rcfile", opt)) ) {
dbg(1, "process_options(): user rcfile specified: %s\n", optval ? optval : "NULL");
dbg(1, "process_options(): user rcfile specified: %s\n", optval ? optval : "<NULL>");
if(optval) my_strncpy(cli_opt_rcfile, optval, S(cli_opt_rcfile));
} else if( (type == LONG && !strcmp("png", opt)) ) {

View File

@ -36,7 +36,7 @@ char **parse_cmd_string(const char *cmd, int *argc)
static char *cmd_copy = NULL;
static char *argv[PARSE_SIZE];
char *cmd_ptr, *cmd_save;
dbg(1, "parse_cmd_string(): cmd=|%s|\n", cmd ? cmd : "NULL");
dbg(1, "parse_cmd_string(): cmd=|%s|\n", cmd ? cmd : "<NULL>");
if(!cmd || !cmd[0]) {
if(cmd_copy) my_free(_ALLOC_ID_, &cmd_copy);
return NULL;
@ -1009,7 +1009,7 @@ int raw_read(const char *f, Raw **rawptr, const char *type, double sweep1, doubl
dbg(0, "raw_read(): must clear current raw file before loading new\n");
return res;
}
dbg(1, "raw_read(): type=%s\n", type ? type : "NULL");
dbg(1, "raw_read(): type=%s\n", type ? type : "<NULL>");
*rawptr = my_calloc(_ALLOC_ID_, 1, sizeof(Raw));
raw = *rawptr;
raw->level = -1;
@ -1033,7 +1033,7 @@ int raw_read(const char *f, Raw **rawptr, const char *type, double sweep1, doubl
}
dbg(0, "Raw file data read: %s\n", f);
dbg(0, "points=%d, vars=%d, datasets=%d sim_type=%s\n",
raw->allpoints, raw->nvars, raw->datasets, raw->sim_type ? raw->sim_type : "NULL");
raw->allpoints, raw->nvars, raw->datasets, raw->sim_type ? raw->sim_type : "<NULL>");
} else {
/* free_rawfile(rawptr, 0); */ /* do not free: already done in read_dataset()->extra_rawfile() */
dbg(0, "raw_read(): no useful data found\n");
@ -1179,7 +1179,7 @@ int extra_rawfile(int what, const char *file, const char *type, double sweep1, d
if(type && !type[0]) type = NULL; /* empty string as type will be considered NULL */
dbg(1, "extra_rawfile(): what=%d, file=%s, type=%s\n",
what, file ? file : "NULL", type ? type : "NULL");
what, file ? file : "<NULL>", type ? type : "<NULL>");
if(what == 0) return 0;
/* if not already done insert base raw file (if there is one) into xctx->extra_raw_arr[0] */
if(xctx->raw && xctx->extra_raw_n == 0) {
@ -1242,7 +1242,7 @@ int extra_rawfile(int what, const char *file, const char *type, double sweep1, d
read_ret = raw_read(f, &xctx->raw, type, sweep1, sweep2);
if(read_ret) {
dbg(1, "extra_rawfile(): read %s %s, switch to it. raw->sim_type=%s\n", f,
type ? type : "NULL", xctx->raw->sim_type ? xctx->raw->sim_type : "NULL");
type ? type : "<NULL>", xctx->raw->sim_type ? xctx->raw->sim_type : "<NULL>");
xctx->extra_raw_arr[xctx->extra_raw_n] = xctx->raw;
xctx->extra_prev_idx = xctx->extra_idx;
xctx->extra_idx = xctx->extra_raw_n;
@ -1359,7 +1359,7 @@ int extra_rawfile(int what, const char *file, const char *type, double sweep1, d
Tcl_AppendResult(interp, my_itoa(xctx->extra_idx), " current\n", NULL);
for(i = 0; i < xctx->extra_raw_n; i++) {
Tcl_AppendResult(interp, my_itoa(i), " ", xctx->extra_raw_arr[i]->rawfile, " ",
xctx->extra_raw_arr[i]->sim_type ? xctx->extra_raw_arr[i]->sim_type : "NULL", "\n", NULL);
xctx->extra_raw_arr[i]->sim_type ? xctx->extra_raw_arr[i]->sim_type : "<NULL>", "\n", NULL);
}
}
} else {
@ -3322,11 +3322,12 @@ int save_schematic(const char *schname) /* 20171020 added return value */
xRect *rect;
int rects;
char msg[PATH_MAX + 100];
int same_name = 0;
if(!schname || !strcmp(schname, "")) return 0;
dbg(1, "save_schematic(): currsch=%d schname=%s\n",xctx->currsch, schname);
dbg(1, "save_schematic(): sch[currsch]=%s\n", xctx->sch[xctx->currsch] ? xctx->sch[xctx->currsch] : "NULL");
dbg(1, "save_schematic(): sch[currsch]=%s\n", xctx->sch[xctx->currsch] ? xctx->sch[xctx->currsch] : "<NULL>");
if(!xctx->sch[xctx->currsch]) { /* no current schematic name -> assign new name */
my_strdup2(_ALLOC_ID_, &xctx->sch[xctx->currsch], schname);
@ -3337,6 +3338,7 @@ int save_schematic(const char *schname) /* 20171020 added return value */
set_modify(-1); /* set title to new filename */
}
else { /* user asks to save to same filename */
same_name = 1;
if(!stat(xctx->sch[xctx->currsch], &buf)) {
if(xctx->time_last_modify && xctx->time_last_modify != buf.st_mtime) {
tclvareval("ask_save_optional \"Schematic file: ", xctx->sch[xctx->currsch],
@ -3372,7 +3374,8 @@ int save_schematic(const char *schname) /* 20171020 added return value */
* xctx->prep_hash_wires=0;
*/
if(!strstr(xctx->sch[xctx->currsch], ".xschem_embedded_")) {
set_modify(0);
if(same_name) set_modify(2); /* clear only modified flag, do not set window title etc */
else set_modify(0);
}
tclvareval(xctx->top_path, ".menubar entryconfigure Simulate -background $simulate_bg", NULL);
tclvareval("set tctx::", xctx->current_win_path, "_simulate $simulate_bg", NULL);
@ -3839,7 +3842,7 @@ static void get_sym_type(const char *symname, char **type,
}
}
if( !found ) {
dbg(1, "get_sym_type(): open file %s, pintable %s\n",name, pintable ? "set" : "null");
dbg(1, "get_sym_type(): open file %s, pintable %s\n",name, pintable ? "set" : "<NULL>");
/* ... if not found open file and look for 'type' into the global attributes. */
if(embed_fd) fd = embed_fd;
@ -4656,7 +4659,7 @@ int load_sym_def(const char *name, FILE *embed_fd)
my_snprintf(lay, S(lay), " layer=%d", WIRELAYER);
my_strcat(_ALLOC_ID_, &tt[i].prop_ptr, lay);
}
dbg(1, "l_s_d(): loaded text : t=%s p=%s\n", tt[i].txt_ptr, tt[i].prop_ptr ? tt[i].prop_ptr : "NULL");
dbg(1, "l_s_d(): loaded text : t=%s p=%s\n", tt[i].txt_ptr, tt[i].prop_ptr ? tt[i].prop_ptr : "<NULL>");
set_text_flags(&tt[i]);
++lastt;
break;

View File

@ -5179,8 +5179,16 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
my_free(_ALLOC_ID_, &s);
}
/* set_modify
* Force modify status on current schematic */
/* set_modify [n]
* Force modify status on current schematic
* integer 'n':
* 0 : clear modified flag, update title and tab names, upd. simulation button colors.
* 1 : set modified flag, update title and tab names, upd. simulation button colors, rst floater caches.
* 2 : clear modified flag, do nothing else.
* 3 : set modified flag, do nothing else.
* -1 : set title, rst floater caches.
* -2 : rst floater caches, update simulation button colors (Simulate, Waves, Netlist).
*/
else if(!strcmp(argv[1], "set_modify"))
{
if(!xctx) {Tcl_SetResult(interp, not_avail, TCL_STATIC); return TCL_ERROR;}
@ -5533,7 +5541,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
char *s=NULL;
if(!xctx) {Tcl_SetResult(interp, not_avail, TCL_STATIC); return TCL_ERROR;}
if(argc < 5) {Tcl_SetResult(interp, "Missing arguments", TCL_STATIC);return TCL_ERROR;}
my_strdup(_ALLOC_ID_, &s, subst_token(argv[2], argv[3], strcmp(argv[4], "NULL") ? argv[4] : NULL));
my_strdup(_ALLOC_ID_, &s, subst_token(argv[2], argv[3], strcmp(argv[4], "<NULL>") ? argv[4] : NULL));
Tcl_SetResult(interp, s, TCL_VOLATILE);
my_free(_ALLOC_ID_, &s);
}

View File

@ -360,7 +360,7 @@ void symbol_bbox(int i, double *x1,double *y1, double *x2, double *y2)
if(!xctx->show_hidden_texts && (text.flags & (HIDE_TEXT | HIDE_TEXT_INSTANTIATED))) continue;
sym_flip = flip;
sym_rot = rot;
dbg(1, "symbol_bbox(): instance %d text n: %d text str=%s\n", i,j, text.txt_ptr? text.txt_ptr:"NULL");
dbg(1, "symbol_bbox(): instance %d text n: %d text str=%s\n", i,j, text.txt_ptr? text.txt_ptr:"<NULL>");
tmp_txt = translate(i, text.txt_ptr);
dbg(1, "symbol_bbox(): translated text: %s\n", tmp_txt);
ROTATION(rot, flip, 0.0,0.0,text.x0, text.y0,text_x0,text_y0);
@ -904,7 +904,7 @@ void select_wire(int i,unsigned short select_mode, int fast)
{
my_snprintf(str, S(str), "Info: selected wire: n=%d end1=%d end2=%d\nnode=%s",i,
xctx->wire[i].end1, xctx->wire[i].end2,
xctx->wire[i].prop_ptr? xctx->wire[i].prop_ptr: "(null)");
xctx->wire[i].prop_ptr? xctx->wire[i].prop_ptr: "<NULL>");
statusmsg(str,3);
tcleval("infowindow");

View File

@ -366,7 +366,7 @@ int global_spice_netlist(int global) /* netlister driver */
int n = pinnumber_list[i].n;
str_tmp = expandlabel ( (xctx->inst[n].lab ? xctx->inst[n].lab : ""), &multip);
/*must handle invalid node names */
fprintf(fd, " %s", str_tmp ? str_tmp : "(NULL)" );
fprintf(fd, " %s", str_tmp ? str_tmp : "<NULL>" );
}
}
my_free(_ALLOC_ID_, &pinnumber_list);

View File

@ -408,8 +408,8 @@ static void get_pin_and_attr(const char *token, char **pin_num_or_name, char **p
my_strdup2(_ALLOC_ID_, pin_attr, "");
}
dbg(1, "get_pin_and_attr(): token=%s, name=%s, attr=%s\n", token,
*pin_num_or_name ? *pin_num_or_name : "NULL",
*pin_attr ? *pin_attr: "NULL");
*pin_num_or_name ? *pin_num_or_name : "<NULL>",
*pin_attr ? *pin_attr: "<NULL>");
}
/* state machine that parses a string made up of <token>=<value> ... */
@ -544,7 +544,7 @@ const char *get_sym_template(char *s,char *extra)
/* 2: eat backslashes */
/* 3: 1+2 :) */
dbg(1, "get_sym_template(): s=%s, extra=%s\n", s ? s : "NULL", extra ? extra : "NULL");
dbg(1, "get_sym_template(): s=%s, extra=%s\n", s ? s : "<NULL>", extra ? extra : "<NULL>");
if(s==NULL) {
my_free(_ALLOC_ID_, &result);
return "";
@ -683,7 +683,7 @@ void hash_names(int inst, int action)
stop = inst + 1;
}
if(inst != -1) dbg(1, "hash_names(): start=%d, stop=%d, instname=%s\n",
start, stop, xctx->inst[inst].instname? xctx->inst[inst].instname : "NULL");
start, stop, xctx->inst[inst].instname? xctx->inst[inst].instname : "<NULL>");
for(i = start; i < stop; ++i) {
if(xctx->inst[i].instname && xctx->inst[i].instname[0]) {
my_strdup(_ALLOC_ID_, &upinst, expandlabel(xctx->inst[i].instname, &xmult));
@ -1904,8 +1904,8 @@ static int has_included_subcircuit(int inst, int symbol, char **result)
pin_expanded_ptr = pin_expanded;
while((pin = my_strtok_r(pin_expanded_ptr, ",", "", 0, &pin_save))) {
net = my_strtok_r(net_expanded_ptr, ",", "", 0, &net_save);
str_hash_lookup(&table, pin, net ? net : "NULL", XINSERT_NOREPLACE);
dbg(1, "inserting pin: %s, net: %s\n", pin, net ? net : "NULL");
str_hash_lookup(&table, pin, net ? net : "<NULL>", XINSERT_NOREPLACE);
dbg(1, "inserting pin: %s, net: %s\n", pin, net ? net : "<NULL>");
pin_expanded_ptr = NULL;
net_expanded_ptr = NULL;
}
@ -3693,7 +3693,7 @@ const char *translate(int inst, const char* s)
my_realloc(_ALLOC_ID_, &result,size);
result[0]='\0';
dbg(1, "translate(): substituting props in <%s>, instance <%s>\n", s ? s : "NULL" , instname);
dbg(1, "translate(): substituting props in <%s>, instance <%s>\n", s ? s : "<NULL>" , instname);
while(1)
{

View File

@ -140,7 +140,7 @@ int global_verilog_netlist(int global) /* netlister driver */
str_tmp = get_tok_value( (xctx->inst[i].ptr+ xctx->sym)->prop_ptr, "verilog_format", 2);
my_strdup(_ALLOC_ID_, &tmp_string, str_tmp);
fprintf(fd, "%s\n", str_tmp ? translate(i, tmp_string) : "(NULL)");
fprintf(fd, "%s\n", str_tmp ? translate(i, tmp_string) : "<NULL>");
}
}
@ -168,7 +168,7 @@ int global_verilog_netlist(int global) /* netlister driver */
if(tmp) fprintf(fd, " ,\n");
++tmp;
str_tmp = xctx->inst[i].lab ? xctx->inst[i].lab : "";
fprintf(fd, " %s", str_tmp ? str_tmp : "(NULL)");
fprintf(fd, " %s", str_tmp ? str_tmp : "<NULL>");
}
}
@ -182,7 +182,7 @@ int global_verilog_netlist(int global) /* netlister driver */
if(tmp) fprintf(fd, " ,\n");
++tmp;
str_tmp = xctx->inst[i].lab ? xctx->inst[i].lab : "";
fprintf(fd, " %s", str_tmp ? str_tmp : "(NULL)");
fprintf(fd, " %s", str_tmp ? str_tmp : "<NULL>");
}
}
@ -225,8 +225,8 @@ int global_verilog_netlist(int global) /* netlister driver */
my_strdup(_ALLOC_ID_, &sig_type,get_tok_value(xctx->inst[i].prop_ptr,"verilog_type",0));
if(!sig_type || sig_type[0]=='\0') my_strdup(_ALLOC_ID_, &sig_type,"wire"); /* 20070720 changed reg to wire */
str_tmp = xctx->inst[i].lab ? xctx->inst[i].lab : "";
fprintf(fd, " output %s ;\n", str_tmp ? str_tmp : "(NULL)");
fprintf(fd, " %s %s ", sig_type, str_tmp ? str_tmp : "(NULL)");
fprintf(fd, " output %s ;\n", str_tmp ? str_tmp : "<NULL>");
fprintf(fd, " %s %s ", sig_type, str_tmp ? str_tmp : "<NULL>");
if(port_value && port_value[0]) fprintf(fd," = %s", port_value);
fprintf(fd, ";\n");
@ -244,8 +244,8 @@ int global_verilog_netlist(int global) /* netlister driver */
my_strdup(_ALLOC_ID_, &sig_type,get_tok_value(xctx->inst[i].prop_ptr,"verilog_type",0));
if(!sig_type || sig_type[0]=='\0') my_strdup(_ALLOC_ID_, &sig_type,"wire");
str_tmp = xctx->inst[i].lab ? xctx->inst[i].lab : "";
fprintf(fd, " inout %s ;\n", str_tmp ? str_tmp : "(NULL)");
fprintf(fd, " %s %s ", sig_type, str_tmp ? str_tmp : "(NULL)");
fprintf(fd, " inout %s ;\n", str_tmp ? str_tmp : "<NULL>");
fprintf(fd, " %s %s ", sig_type, str_tmp ? str_tmp : "<NULL>");
if(port_value && port_value[0]) fprintf(fd," = %s", port_value);
fprintf(fd, ";\n");
@ -483,7 +483,7 @@ int verilog_block_netlist(FILE *fd, int i)
if(!xctx->tok_size && strcmp(fmt_attr, "verilog_format"))
str_tmp = get_tok_value( (xctx->inst[j].ptr+ xctx->sym)->prop_ptr, "verilog_format", 2);
my_strdup(_ALLOC_ID_, &tmp_string, str_tmp);
fprintf(fd, "%s\n", str_tmp ? translate(j, tmp_string) : "(NULL)");
fprintf(fd, "%s\n", str_tmp ? translate(j, tmp_string) : "<NULL>");
}
}

View File

@ -218,7 +218,7 @@ int global_vhdl_netlist(int global) /* netlister driver */
/* str_tmp = xctx->inst[i].lab ? xctx->inst[i].lab : ""; */
/* if(!tmp) fprintf(fd,"generic (\n"); */
/* if(tmp) fprintf(fd," ;\n"); */
/* fprintf(fd, " %s : %s", str_tmp ? str_tmp : "(NULL)", sig_type ); */
/* fprintf(fd, " %s : %s", str_tmp ? str_tmp : "<NULL>", sig_type ); */
/* if(port_value &&port_value[0]) */
/* fprintf(fd," := %s", port_value); */
/* */
@ -243,7 +243,7 @@ int global_vhdl_netlist(int global) /* netlister driver */
str_tmp = xctx->inst[i].lab ? xctx->inst[i].lab : "";
if(!tmp) fprintf(fd,"port(\n");
if(tmp) fprintf(fd," ;\n");
fprintf(fd, " %s : out %s", str_tmp ? str_tmp : "(NULL)", sig_type );
fprintf(fd, " %s : out %s", str_tmp ? str_tmp : "<NULL>", sig_type );
tmp=1;
}
}
@ -260,7 +260,7 @@ int global_vhdl_netlist(int global) /* netlister driver */
str_tmp = xctx->inst[i].lab ? xctx->inst[i].lab : "";
if(!tmp) fprintf(fd,"port(\n");
if(tmp) fprintf(fd," ;\n");
fprintf(fd, " %s : inout %s", str_tmp ? str_tmp : "(NULL)", sig_type );
fprintf(fd, " %s : inout %s", str_tmp ? str_tmp : "<NULL>", sig_type );
tmp=1;
}
}

View File

@ -1202,7 +1202,7 @@ int preview_window(const char *what, const char *win_path, const char *fname)
if(semaphore) return 0;
++semaphore;
dbg(1, "preview_window(): what=%s, win_path=%s, fname=%s\n",
what, win_path ? win_path : "NULL", fname ? fname : "NULL");
what, win_path ? win_path : "<NULL>", fname ? fname : "<NULL>");
dbg(1, "------\n");
tclvareval("save_ctx ", xctx->current_win_path, NULL);
if(!strcmp(what, "create") && last_preview < 4) {
@ -2579,7 +2579,7 @@ int Tcl_AppInit(Tcl_Interp *inter)
dbg(1, "Tcl_AppInit(): XSCHEM_SHAREDIR=%s XSCHEM_LIBRARY_PATH=%s\n",
tclgetvar("XSCHEM_SHAREDIR"),
tclgetvar("XSCHEM_LIBRARY_PATH") ? tclgetvar("XSCHEM_LIBRARY_PATH") : "NULL"
tclgetvar("XSCHEM_LIBRARY_PATH") ? tclgetvar("XSCHEM_LIBRARY_PATH") : "<NULL>"
);
dbg(1, "Tcl_AppInit(): done step a of xinit()\n");
@ -2917,7 +2917,7 @@ int Tcl_AppInit(Tcl_Interp *inter)
#ifndef __unix__
change_to_unix_fn(tmp);
#endif
dbg(1, "Tcl_AppInit(): tmp=%s\n", tmp? tmp: "NULL");
dbg(1, "Tcl_AppInit(): tmp=%s\n", tmp? tmp: "<NULL>");
if(0 && cli_argc > 1) /* disabled */
my_strncpy(fname, "", S(fname)); /* no load XSCHEM_START_WINDOW if cli args given */
else

View File

@ -1770,25 +1770,34 @@ proc simconf_add {tool} {
############ cellview
# this proc prints symbol bindings (default binding or "schematic" attr in symbol)
# of all symbols used in current and sub schematics.
proc cellview_setlabels {w sch} {
if {[$w get] ne $sch} {
if { [file exists [abs_sym_path [$w get]]] } {
$w configure -bg green
} else {
# puts "$sch --- [$sf.f$i.s get]"
$w configure -bg red
}
proc cellview_setlabels {w sym_sch default_sch sym_spice_sym_def} {
global dark_gui_colorscheme
if {$dark_gui_colorscheme} {
set symfg SeaGreen1
set symbg SeaGreen4
set missingbg IndianRed4
} else {
set symfg SeaGreen4
set symbg SeaGreen1
set missingbg IndianRed1
}
$w configure -fg [option get . foreground {}]
$w configure -bg [option get . background {}]
if { $sym_spice_sym_def ne {}} {
$w configure -fg $symfg
} elseif { ![file exists [abs_sym_path [$w get]]] } {
$w configure -bg $missingbg
} else {
if { [file exists [abs_sym_path [$w get]]] } {
$w configure -bg [option get . background {}]
} else {
$w configure -bg red
if {[$w get] eq $default_sch} {
# ....
} elseif {[$w get] eq $sym_sch} {
$w configure -bg $symbg
}
}
}
proc cellview {} {
global keep_symbols
global keep_symbols nolist_libs
if {[info tclversion] >= 8.5} {
set font {TkDefaultFont 10 bold} ;# Monospace
@ -1813,42 +1822,46 @@ proc cellview {} {
set sf [sframe .cv.center]
# puts sf=$sf
set syms [join [lsort -index 1 [xschem symbols]]]
foreach {i sym} $syms {
set abs_sch [xschem get_sch_from_sym -1 $sym]
set sch [rel_sym_path $abs_sch]
set default_sch [add_ext $sym .sch]
set type [xschem getprop symbol $sym type]
set spice_sym_def [xschem getprop symbol $sym spice_sym_def]
foreach {i symbol} $syms {
set abs_sch [xschem get_sch_from_sym -1 $symbol]
set abs_sym [abs_sym_path $symbol]
set default_sch [add_ext $symbol .sch]
set skip 0
foreach j $nolist_libs {
if {[regexp $j $abs_sym]} {
set skip 1
break
}
}
if {$skip} { continue }
set sym_sch [rel_sym_path $abs_sch]
set default_sch [add_ext $symbol .sch]
set type [xschem getprop symbol $symbol type]
set sym_spice_sym_def [xschem getprop symbol $symbol spice_sym_def]
if {$type eq {subcircuit}} {
frame $sf.f$i
pack $sf.f$i -side top -fill x
label $sf.f$i.l -text $sym -width 20 -anchor w -padx 4 -borderwidth 1 \
label $sf.f$i.l -text $symbol -width 20 -anchor w -padx 4 -borderwidth 1 \
-relief sunken -pady 1 -font $font
# puts $sf.f$i.s
entry $sf.f$i.s -width 50 -borderwidth 1 -relief sunken -font $font
if { $spice_sym_def eq {}} {
if {![file exists $abs_sch]} {
$sf.f$i.s configure -bg red
} elseif {$default_sch ne $sch} {
$sf.f$i.s configure -bg green
}
} else {
$sf.f$i.s configure -fg red
}
balloon $sf.f$i.s $abs_sch
button $sf.f$i.b -text Sch -padx 4 -borderwidth 1 -pady 0 -font $font \
-command "
if { [list $spice_sym_def] eq {}} {
if { [list $sym_spice_sym_def] eq {}} {
xschem load_new_window \[$sf.f$i.s get\]
} else {
editdata [list $spice_sym_def] {Symbol spice_sym_def attribute}
editdata [list $sym_spice_sym_def] {Symbol spice_sym_def attribute}
}"
if {$spice_sym_def eq {}} {
$sf.f$i.s insert 0 $sch
if {$sym_spice_sym_def eq {}} {
$sf.f$i.s insert 0 $sym_sch
} else {
$sf.f$i.s insert 0 {defined in symbol spice_sym_def}
}
bind $sf.f$i.s <KeyRelease> "cellview_setlabels %W [list $sch]"
bind $sf.f$i.s <KeyRelease> "
cellview_setlabels %W [list $sym_sch] [list $default_sch] [list $sym_spice_sym_def]
"
cellview_setlabels $sf.f$i.s $sym_sch $default_sch $sym_spice_sym_def
pack $sf.f$i.l $sf.f$i.s -side left -fill x -expand 1
pack $sf.f$i.b -side left
}
@ -1871,59 +1884,64 @@ proc cellview {} {
############ /cellview
############ traversal
proc traversal_setlabels {w parent_sch sch instname default_sch inst_spice_sym_def sym_spice_sym_def} {
global traversal_cnt
proc traversal_setlabels {w parent_sch instname inst_sch sym_sch default_sch inst_spice_sym_def sym_spice_sym_def} {
global traversal_cnt dark_gui_colorscheme
set sf .trav.center.f.scrl
# puts "traversal_setlabels $w $parent_sch $sch $instname"
# puts "traversal_setlabels $w $parent_sch $inst_sch $instname"
# update schematic
if {$parent_sch ne {}} {
set current [xschem get current_name]
puts "traversal_update_schematic: $w parent: $parent_sch $instname def: $default_sch $sch --> [$w get]"
if { $sch ne [$w get] } {
puts "traversal_update_schematic: $w parent: $parent_sch $instname def: $sym_sch $inst_sch --> [$w get]"
if { $inst_sch ne [$w get] } {
puts "update attr"
xschem load $parent_sch noundoreset nodraw
set sch [xschem getprop instance $instname schematic]
if { $sch ne [$w get]} {
if { [$w get] eq $default_sch} {
xschem setprop instance $instname schematic fast ;# remove schematic attr on instance
} else {
xschem setprop instance $instname schematic [$w get] fast ;# set schematic attr on instance
}
xschem set_modify 1
xschem save
set sch [$w get]
puts "sch set to: $sch"
}
if { [$w get] eq $sym_sch} {
xschem setprop instance $instname schematic fast ;# remove schematic attr on instance
} else {
xschem setprop instance $instname schematic [$w get] fast ;# set schematic attr on instance
}
xschem set_modify 3 ;# set only modified flag to force a save, do not update window/tab titles
xschem save
set inst_sch [$w get]
puts "inst_sch set to: $inst_sch"
xschem load $current noundoreset nodraw
bind $w <KeyRelease> "
traversal_setlabels $w [list $parent_sch] [list $sch] [list $instname] [list $default_sch] \
[list $inst_spice_sym_def] [list $sym_spice_sym_def]
traversal_setlabels $w [list $parent_sch] [list $instname] [list $inst_sch] [list $sym_sch] \
[list $default_sch] [list $inst_spice_sym_def] [list $sym_spice_sym_def]
"
}
}
# /update schematic
if {[$w get] ne $default_sch} {
if { $sym_spice_sym_def ne {}} {
$w configure -fg green
$w configure -bg [option get . background {}]
} elseif {$inst_spice_sym_def ne {}} {
$w configure -fg red
$w configure -bg [option get . background {}]
} elseif { [file exists [abs_sym_path [$w get]]] } {
$w configure -fg [option get . foreground {}]
$w configure -bg green
} else {
$w configure -fg [option get . foreground {}]
$w configure -bg red
}
if {$dark_gui_colorscheme} {
set instfg orange1
set symfg SeaGreen1
set instbg orange4
set symbg SeaGreen4
set missingbg IndianRed4
} else {
if { [file exists [abs_sym_path [$w get]]] } {
$w configure -bg [option get . background {}]
} else {
$w configure -bg red
set instfg orange4
set symfg SeaGreen4
set instbg Orange1
set symbg SeaGreen1
set missingbg IndianRed1
}
$w configure -fg [option get . foreground {}]
$w configure -bg [option get . background {}]
if { $sym_spice_sym_def ne {}} {
$w configure -fg $symfg
} elseif {$inst_spice_sym_def ne {}} {
$w configure -fg $instfg
} elseif { ![file exists [abs_sym_path [$w get]]] } {
$w configure -bg $missingbg
} else {
if {[$w get] eq $default_sch} {
# ....
} elseif {[$w get] eq $sym_sch} {
$w configure -bg $symbg
} elseif {[$w get] eq $inst_sch} {
$w configure -bg $instbg
}
}
}
@ -1996,12 +2014,13 @@ proc hier_traversal {{level 0} {only_subckts 0} {all_hierarchy 1}} {
set instname [xschem getprop instance $i name]
set symbol [xschem getprop instance $i cell::name]
set default_sch [add_ext $symbol .sch]
set sym_sch [rel_sym_path [xschem get_sch_from_sym -1 $symbol]]
set abs_symbol [abs_sym_path $symbol]
set type [xschem getprop symbol $symbol type]
set schematic [xschem get_sch_from_sym $i]
set sch_exists [expr {[file exists $schematic] ? {} : {**missing**}}]
set sch_tail [rel_sym_path $schematic]
set sch_rootname [file tail [file rootname $sch_tail]]
set inst_sch [rel_sym_path $schematic]
set sch_rootname [file tail [file rootname $inst_sch]]
set inst_spice_sym_def [xschem getprop instance $i spice_sym_def]
set sym_spice_sym_def [xschem getprop instance $i cell::spice_sym_def]
if {$only_subckts && ($type ne {subcircuit})} { continue }
@ -2032,7 +2051,7 @@ proc hier_traversal {{level 0} {only_subckts 0} {all_hierarchy 1}} {
} elseif {$sym_spice_sym_def ne {}} {
$sf.f$traversal_cnt.s insert 0 "$sch_rootname defined in symbol spice_sym_def"
} else {
$sf.f$traversal_cnt.s insert 0 "$sch_tail"
$sf.f$traversal_cnt.s insert 0 "$inst_sch"
}
}
button $sf.f$traversal_cnt.bsym -text {Sym} -padx 4 -borderwidth 1 -pady 0 -font $font \
@ -2050,12 +2069,12 @@ proc hier_traversal {{level 0} {only_subckts 0} {all_hierarchy 1}} {
}"
if { $sym_spice_sym_def eq {} && $inst_spice_sym_def eq {}} {
bind $sf.f$traversal_cnt.s <KeyRelease> "
traversal_setlabels %W [list $parent_sch] [list $sch_tail] [list $instname] [list $default_sch] \
[list $inst_spice_sym_def] [list $sym_spice_sym_def]
traversal_setlabels %W [list $parent_sch] [list $instname] [list $inst_sch] [list $sym_sch] \
[list $default_sch] [list $inst_spice_sym_def] [list $sym_spice_sym_def]
"
}
traversal_setlabels $sf.f$traversal_cnt.s {} $sch_tail $instname $default_sch \
$inst_spice_sym_def $sym_spice_sym_def
traversal_setlabels $sf.f$traversal_cnt.s {} $instname $inst_sch $sym_sch \
$default_sch $inst_spice_sym_def $sym_spice_sym_def
pack $sf.f$traversal_cnt.i -side left -fill x -expand 1
pack $sf.f$traversal_cnt.l $sf.f$traversal_cnt.s -side left -fill x
pack $sf.f$traversal_cnt.bsym $sf.f$traversal_cnt.bsch -side left
@ -8861,6 +8880,19 @@ if {$text_replace_selection && $OS != "Windows"} {
}
}
## allow to unpost menu entries when clicking a posted menu
if { [info tclversion] >= 8.6 } {
bind Menu <Button> {
if { [%W cget -type] eq "menubar" && [info exists tk::Priv(menuActivated)]} {
%W activate none
} else {
%W activate @%x,%y
}
tk::MenuButtonDown %W
}
}
## this proc must be called for any created entry widgets
proc entry_replace_selection {w} {
global text_replace_selection OS