From 69a23355fb876c636c9fe574950d5915a6ad3783 Mon Sep 17 00:00:00 2001 From: stefan schippers Date: Sat, 4 Jan 2025 11:33:58 +0100 Subject: [PATCH] refactor some debug print messages for NULL strings --- src/draw.c | 13 +++++++------ src/editprop.c | 11 +++++++---- src/hilight.c | 4 ++-- src/netlist.c | 2 +- src/node_hash.c | 8 ++++---- src/options.c | 4 ++-- src/save.c | 18 +++++++++--------- src/scheduler.c | 2 +- src/select.c | 4 ++-- src/spice_netlist.c | 2 +- src/token.c | 14 +++++++------- src/verilog_netlist.c | 16 ++++++++-------- src/vhdl_netlist.c | 6 +++--- src/xinit.c | 6 +++--- 14 files changed, 57 insertions(+), 53 deletions(-) diff --git a/src/draw.c b/src/draw.c index 6fa8c132..cf376639 100644 --- a/src/draw.c +++ b/src/draw.c @@ -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 : ""); 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 : ""); 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: ""); 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 : ""); 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: ""); 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 : "", bus_msb ? bus_msb : ""); /* 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)) { diff --git a/src/editprop.c b/src/editprop.c index dd23a094..277ad78d 100644 --- a/src/editprop.c +++ b/src/editprop.c @@ -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 : "", append_str ? append_str : ""); 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 : "", append_str ? append_str : ""); 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 : "", append_str ? append_str : ""); 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 : ""); my_strdup(_ALLOC_ID_, &xctx->inst[*ii].prop_ptr, new_prop); } } else { diff --git a/src/hilight.c b/src/hilight.c index 1035cab8..f4d0f2b7 100644 --- a/src/hilight.c +++ b/src/hilight.c @@ -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 : "", 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 : ""); if(!str) return 2; /* no logic function defined, return LOGIC_X */ while(str[pos]) { switch(str[pos]) { diff --git a/src/netlist.c b/src/netlist.c index 303a7ebf..a474f53a 100644 --- a/src/netlist.c +++ b/src/netlist.c @@ -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 : ""); set_inst_node(n, p, wire[k].node); err |= instcheck(n, p); } else { diff --git a/src/node_hash.c b/src/node_hash.c index 1c0c816c..b7939e5e 100644 --- a/src/node_hash.c +++ b/src/node_hash.c @@ -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:""); 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:""); 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:""); 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:""); if(mult>1) { for(j=mult-1;j>=0;j--) { if(ptr->verilog_type && ptr->verilog_type[0]) { diff --git a/src/options.c b/src/options.c index 84015594..e2872111 100644 --- a/src/options.c +++ b/src/options.c @@ -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 : ""); 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 : ""); if(optval) my_strncpy(cli_opt_rcfile, optval, S(cli_opt_rcfile)); } else if( (type == LONG && !strcmp("png", opt)) ) { diff --git a/src/save.c b/src/save.c index 04b416db..df57a7c8 100644 --- a/src/save.c +++ b/src/save.c @@ -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 : ""); 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 : ""); *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 : ""); } 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 : "", type ? type : ""); 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 : "", xctx->raw->sim_type ? xctx->raw->sim_type : ""); 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 : "", "\n", NULL); } } } else { @@ -3326,7 +3326,7 @@ int save_schematic(const char *schname) /* 20171020 added return value */ 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] : ""); if(!xctx->sch[xctx->currsch]) { /* no current schematic name -> assign new name */ my_strdup2(_ALLOC_ID_, &xctx->sch[xctx->currsch], schname); @@ -3839,7 +3839,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" : ""); /* ... if not found open file and look for 'type' into the global attributes. */ if(embed_fd) fd = embed_fd; @@ -4656,7 +4656,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 : ""); set_text_flags(&tt[i]); ++lastt; break; diff --git a/src/scheduler.c b/src/scheduler.c index a6ce89de..81ad5732 100644 --- a/src/scheduler.c +++ b/src/scheduler.c @@ -5533,7 +5533,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], "") ? argv[4] : NULL)); Tcl_SetResult(interp, s, TCL_VOLATILE); my_free(_ALLOC_ID_, &s); } diff --git a/src/select.c b/src/select.c index e08d58ed..bf8f3c92 100644 --- a/src/select.c +++ b/src/select.c @@ -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:""); 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: ""); statusmsg(str,3); tcleval("infowindow"); diff --git a/src/spice_netlist.c b/src/spice_netlist.c index 169318f1..fe1ebb1b 100644 --- a/src/spice_netlist.c +++ b/src/spice_netlist.c @@ -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 : "" ); } } my_free(_ALLOC_ID_, &pinnumber_list); diff --git a/src/token.c b/src/token.c index 8a9bb0b7..f41c01e7 100644 --- a/src/token.c +++ b/src/token.c @@ -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 : "", + *pin_attr ? *pin_attr: ""); } /* state machine that parses a string made up of = ... */ @@ -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 : "", extra ? extra : ""); 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 : ""); 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 : "", XINSERT_NOREPLACE); + dbg(1, "inserting pin: %s, net: %s\n", pin, net ? net : ""); 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 : "" , instname); while(1) { diff --git a/src/verilog_netlist.c b/src/verilog_netlist.c index 8fa681ed..2a66227c 100644 --- a/src/verilog_netlist.c +++ b/src/verilog_netlist.c @@ -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) : ""); } } @@ -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 : ""); } } @@ -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 : ""); } } @@ -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 : ""); + fprintf(fd, " %s %s ", sig_type, str_tmp ? str_tmp : ""); 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 : ""); + fprintf(fd, " %s %s ", sig_type, str_tmp ? str_tmp : ""); 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) : ""); } } diff --git a/src/vhdl_netlist.c b/src/vhdl_netlist.c index c3845d94..ad54345d 100644 --- a/src/vhdl_netlist.c +++ b/src/vhdl_netlist.c @@ -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 : "", 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 : "", 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 : "", sig_type ); tmp=1; } } diff --git a/src/xinit.c b/src/xinit.c index 604d7086..bb4d5b6e 100644 --- a/src/xinit.c +++ b/src/xinit.c @@ -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 : "", fname ? fname : ""); 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") : "" ); 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: ""); if(0 && cli_argc > 1) /* disabled */ my_strncpy(fname, "", S(fname)); /* no load XSCHEM_START_WINDOW if cli args given */ else