From 5161f3dc0a08df30acf67d596897c77eb04c33c2 Mon Sep 17 00:00:00 2001 From: stefan schippers Date: Sat, 11 Jan 2025 14:08:23 +0100 Subject: [PATCH 1/9] some doc updates and comments, error checks in get_sch_from_sym() --- doc/xschem_man/developer_info.html | 4 +++- src/actions.c | 30 ++++++++++++++++++++---------- src/scheduler.c | 5 ++++- 3 files changed, 27 insertions(+), 12 deletions(-) diff --git a/doc/xschem_man/developer_info.html b/doc/xschem_man/developer_info.html index 8dd24c12..5b984dda 100644 --- a/doc/xschem_man/developer_info.html +++ b/doc/xschem_man/developer_info.html @@ -934,7 +934,9 @@ C {verilog_timescale.sym} 1050 -100 0 0 {name=s1 timestep="1ns" precision="1ns" Return a list of 3-items. Each 3-item is an instance name followed by the symbol reference and symbol type. Example: xschem instance_list --> - {x1} {sky130_tests/bandgap.sym} {subcircuit}} {...} {...} {...} ... + {x1} {sky130_tests/bandgap.sym} {subcircuit} + {...} {...} {...} + ...
  • instance_net inst pin
  •     Return the name of the net attached to pin 'pin' of instance 'inst'
        Example: xschem instance_net x3 MINUS --> REF 
    diff --git a/src/actions.c b/src/actions.c index bdc3ac16..d5a728a3 100644 --- a/src/actions.c +++ b/src/actions.c @@ -2073,6 +2073,7 @@ void get_additional_symbols(int what) } } /* fallback = 1: if schematic attribute is set but file not existing fallback + * if inst == -1 use only symbol reference * to defaut symbol schematic (symname.sym -> symname.sch) */ void get_sch_from_sym(char *filename, xSymbol *sym, int inst, int fallback) { @@ -2084,17 +2085,29 @@ void get_sch_from_sym(char *filename, xSymbol *sym, int inst, int fallback) int cancel = 0; int is_gen = 0; + my_strncpy(filename, "", PATH_MAX); + + if(inst != -1 || inst >= xctx->instances) { + dbg(0, "get_sch_from_sym() error: called with invalid inst=%d\n", inst); + return; + } + + if(!sym) { + dbg(0, "get_sch_from_sym() error: called with NULL sym", inst); + return; + } + /* get sch/sym name from parent schematic downloaded from web */ if(is_from_web(xctx->current_dirname)) { web_url = 1; } + dbg(1, "get_sch_from_sym(): current_dirname= %s\n", xctx->current_dirname); dbg(1, "get_sch_from_sym(): symbol %s inst=%d web_url=%d\n", sym->name, inst, web_url); - if(inst >= 0) { - /* resolve schematic=generator.tcl( @n ) where n=11 is defined in instance attrs */ - my_strdup(_ALLOC_ID_, &str_tmp, - translate3(get_tok_value(xctx->inst[inst].prop_ptr,"schematic", 6), 1, - xctx->inst[inst].prop_ptr, NULL, NULL)); + /* resolve schematic=generator.tcl( @n ) where n=11 is defined in instance attrs */ + if(inst >=0 ) { + my_strdup(_ALLOC_ID_, &str_tmp, translate3(get_tok_value(xctx->inst[inst].prop_ptr,"schematic", 6), + 1, xctx->inst[inst].prop_ptr, NULL, NULL)); } if(!str_tmp) my_strdup2(_ALLOC_ID_, &str_tmp, get_tok_value(sym->prop_ptr, "schematic", 6)); if(str_tmp[0]) { /* schematic attribute in symbol or instance was given */ @@ -2111,17 +2124,14 @@ void get_sch_from_sym(char *filename, xSymbol *sym, int inst, int fallback) if(web_url) my_strncpy(filename, sch, PATH_MAX); else my_strncpy(filename, abs_sym_path(sch, ""), PATH_MAX); } - } else { - my_strncpy(filename, "", PATH_MAX); } if(has_x && fallback && !is_gen && filename[0]) { file_exists = !stat(filename, &buf); if(!file_exists) { tclvareval("ask_save {Schematic ", filename, "\ndoes not exist.\nDescend into base schematic?}", NULL); - if(strcmp(tclresult(), "yes") ) fallback = 0; - if(!strcmp(tclresult(), "") ) { - my_strncpy(filename, "", PATH_MAX); + if(strcmp(tclresult(), "yes") ) fallback = 0; /* 'no' or 'cancel' */ + if(!strcmp(tclresult(), "") ) { /* 'cancel' */ cancel = 1; } } diff --git a/src/scheduler.c b/src/scheduler.c index bc08d8ba..9df939b8 100644 --- a/src/scheduler.c +++ b/src/scheduler.c @@ -2413,7 +2413,10 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg * Return a list of 3-items. Each 3-item is * an instance name followed by the symbol reference and symbol type. * Example: xschem instance_list --> - * {x1} {sky130_tests/bandgap.sym} {subcircuit}} {...} {...} {...} ... */ + * {x1} {sky130_tests/bandgap.sym} {subcircuit} + * {...} {...} {...} + * ... + */ else if(!strcmp(argv[1], "instance_list")) { int i; From 02d992d2a63f71d6c6637ad07cbe14a75134d713 Mon Sep 17 00:00:00 2001 From: stefan schippers Date: Sat, 11 Jan 2025 14:10:02 +0100 Subject: [PATCH 2/9] fix error checks in get_sch_from_sym() --- src/actions.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/actions.c b/src/actions.c index d5a728a3..71e9145d 100644 --- a/src/actions.c +++ b/src/actions.c @@ -2087,7 +2087,7 @@ void get_sch_from_sym(char *filename, xSymbol *sym, int inst, int fallback) my_strncpy(filename, "", PATH_MAX); - if(inst != -1 || inst >= xctx->instances) { + if(inst >= xctx->instances) { dbg(0, "get_sch_from_sym() error: called with invalid inst=%d\n", inst); return; } From 172ab4081d596d299ec56536beb184df064f0173 Mon Sep 17 00:00:00 2001 From: stefan schippers Date: Sat, 11 Jan 2025 14:17:30 +0100 Subject: [PATCH 3/9] changed `xschem is_symgen` to `xschem is_generator` as name is more appropriate --- src/scheduler.c | 2 +- src/token.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/scheduler.c b/src/scheduler.c index 9df939b8..3bd67c31 100644 --- a/src/scheduler.c +++ b/src/scheduler.c @@ -2666,7 +2666,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg /* is_symgen symbol * tell if 'symbol' is a generator (symbol(param1,param2,...) */ - else if(!strcmp(argv[1], "is_symgen")) + else if(!strcmp(argv[1], "is_generator")) { char s[30]; if(argc > 2) { diff --git a/src/token.c b/src/token.c index c4c54900..31c0b2cb 100644 --- a/src/token.c +++ b/src/token.c @@ -165,7 +165,7 @@ char *get_generator_command(const char *str) #endif dbg(1, "get_generator_command(): cmd_filename=%s\n", cmd_filename); dbg(1, "get_generator_command(): gen_cmd=%s\n", gen_cmd); - dbg(1, "get_generator_command(): is_symgen=%d\n", is_generator(str)); + dbg(1, "get_generator_command(): is_generator=%d\n", is_generator(str)); end: my_free(_ALLOC_ID_, &cmd); From 7484a6363c0c735a2ca202cac86c18f20cb55bd6 Mon Sep 17 00:00:00 2001 From: stefan schippers Date: Sat, 11 Jan 2025 15:30:22 +0100 Subject: [PATCH 4/9] interpret `xschem symbols {}` as `xschem symbols` (simpler for scripts), update proc cellview --- src/scheduler.c | 2 +- src/xschem.tcl | 23 +++++++++++++++-------- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/src/scheduler.c b/src/scheduler.c index 3bd67c31..cb0837dd 100644 --- a/src/scheduler.c +++ b/src/scheduler.c @@ -5655,7 +5655,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg char n[100]; if(!xctx) {Tcl_SetResult(interp, not_avail, TCL_STATIC); return TCL_ERROR;} if(argc > 2 && !strcmp(argv[2], "derived_symbols")) derived_symbols = 1; - else if(argc > 2) { + else if(argc > 2 && argv[2][0]) { one_symbol = 1; i = get_symbol(argv[2]); if(i >=0) Tcl_AppendResult(interp, my_itoa(i), " {", xctx->sym[i].name, "}", NULL); diff --git a/src/xschem.tcl b/src/xschem.tcl index 98be581e..f20d0a69 100644 --- a/src/xschem.tcl +++ b/src/xschem.tcl @@ -1799,7 +1799,19 @@ proc cellview_setlabels {w symbol sym_sch default_sch sym_spice_sym_def} { } } -proc cellview {} { +proc cellview_edit_item {w sym_spice_sym_def} { + if {[xschem is_generator [$w get]]} { + set f [$w get] + regsub {\(.*} $f {} f + textwindow [abs_sym_path $f] + } elseif { $sym_spice_sym_def eq {}} { + xschem load_new_window [$w get] + } else { + editdata $sym_spice_sym_def {Symbol spice_sym_def attribute} + } +} + +proc cellview {{derived_symbols {}}} { global keep_symbols nolist_libs if {[info tclversion] >= 8.5} { @@ -1824,7 +1836,7 @@ proc cellview {} { frame .cv.center set sf [sframe .cv.center] # puts sf=$sf - set syms [join [lsort -index 1 [xschem symbols]]] + set syms [join [lsort -index 1 [xschem symbols $derived_symbols]]] foreach {i symbol} $syms { set abs_sch [xschem get_sch_from_sym -1 $symbol] set abs_sym [abs_sym_path $symbol] @@ -1850,12 +1862,7 @@ proc cellview {} { entry $sf.f$i.s -width 45 -borderwidth 1 -relief sunken -font $font 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 $sym_spice_sym_def] eq {}} { - xschem load_new_window \[$sf.f$i.s get\] - } else { - editdata [list $sym_spice_sym_def] {Symbol spice_sym_def attribute} - }" + -command "cellview_edit_item $sf.f$i.s [list $sym_spice_sym_def]" if {$sym_spice_sym_def eq {}} { $sf.f$i.s insert 0 $sym_sch } else { From bca111028253e6acb6d376fb42b4512f0b6d827c Mon Sep 17 00:00:00 2001 From: stefan schippers Date: Sat, 11 Jan 2025 17:55:46 +0100 Subject: [PATCH 5/9] add option -nohier to `xschem netlist` command, correctly restore netlist_dir at end --- doc/xschem_man/developer_info.html | 4 ++- src/scheduler.c | 58 ++++++++++++++++++------------ src/xschem.tcl | 2 +- 3 files changed, 39 insertions(+), 25 deletions(-) diff --git a/doc/xschem_man/developer_info.html b/doc/xschem_man/developer_info.html index 5b984dda..4961ea54 100644 --- a/doc/xschem_man/developer_info.html +++ b/doc/xschem_man/developer_info.html @@ -1066,7 +1066,7 @@ C {verilog_timescale.sym} 1050 -100 0 0 {name=s1 timestep="1ns" precision="1ns"
  • net_pin_mismatch
  •     Highlight nets attached to selected symbols with
        a different name than symbol pin 
    -
  • netlist [-messages] [filename]
  • +   
  • netlist [-messages | -erc | -nohier] [filename]
  •     do a netlist of current schematic in currently defined netlist format
        if 'filename'is given use specified name for the netlist
        if 'filename' contains path components place the file in specified path location.
    @@ -1076,6 +1076,8 @@ C {verilog_timescale.sym} 1050 -100 0 0 {name=s1 timestep="1ns" precision="1ns"
        will create the netlist in different places.
        netlisting directory is reset to previous setting after completing this command
        If -messages is given return the ERC messages instead of just a fail (1)
    +   If -erc is given it means netlister is called from gui, enable show infowindow
    +   If -nohier is given netlist only current level
        or no fail (0) code. 
  • new_process [f]
  •     Start a new xschem process for a schematic.
    diff --git a/src/scheduler.c b/src/scheduler.c
    index cb0837dd..799a01e4 100644
    --- a/src/scheduler.c
    +++ b/src/scheduler.c
    @@ -3184,7 +3184,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
           hilight_net_pin_mismatches();
         }
     
    -    /* netlist [-messages] [filename]
    +    /* netlist [-messages | -erc | -nohier] [filename]
          *   do a netlist of current schematic in currently defined netlist format
          *   if 'filename'is given use specified name for the netlist
          *   if 'filename' contains path components place the file in specified path location.
    @@ -3194,51 +3194,62 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
          *   will create the netlist in different places.
          *   netlisting directory is reset to previous setting after completing this command
          *   If -messages is given return the ERC messages instead of just a fail (1)
    +     *   If -erc is given it means netlister is called from gui, enable show infowindow
    +     *   If -nohier is given netlist only current level
          *   or no fail (0) code. */
         else if(!strcmp(argv[1], "netlist") )
         {
           char *saveshow = NULL;
           int err = 0;
    -      int messages = 0;
    +      int hier_netlist = 1;
    +      int i, messages = 0;
    +      int erc = 0;
           const char *fname = NULL;
           const char *path;
    +      char savedir[PATH_MAX];
           int done_netlist = 0;
           if(!xctx) {Tcl_SetResult(interp, not_avail, TCL_STATIC); return TCL_ERROR;}
           yyparse_error = 0;
           my_strdup(_ALLOC_ID_, &saveshow, tclgetvar("show_infowindow_after_netlist"));
    -      if(argc <= 2 || (argc > 2 && strcmp(argv[2], "-erc"))) { /* xschem netlist NOT invoked from GUI */
    -        tclsetvar("show_infowindow_after_netlist", "never");
    -      }
    -      if(argc > 2) {
    -        if(!strcmp(argv[2], "-messages")) {
    -          messages = 1;
    -          if(argc > 3) fname = argv[3];
    -        } else if(strcmp(argv[2], "-erc")) {
    -          fname = argv[2];
    -        }
    -        if(fname) {
    -          my_strncpy(xctx->netlist_name, get_cell_w_ext(fname, 0), S(xctx->netlist_name));
    -          tclvareval("file dirname ", fname, NULL);
    -          path = tclresult();
    -          if(strchr(fname, '/')) {
    -            set_netlist_dir(1, path);
    +
    +      my_strncpy(savedir, tclgetvar("netlist_dir"), S(savedir));
    +      for(i = 2; i < argc; i++) {
    +        if(argv[i][0] == '-') {
    +          if(!strcmp(argv[i], "-messages")) {
    +            messages = 1;
    +          } else if(!strcmp(argv[i], "-erc")) {
    +            erc = 1;
    +          } else if(!strcmp(argv[i], "-nohier")) {
    +            hier_netlist = 0;
               }
    +        } else {
    +          fname = argv[i];
    +          break;
    +        }
    +      }
    +      if(erc == 0) tclsetvar("show_infowindow_after_netlist", "never");
    +      if(fname) {
    +        my_strncpy(xctx->netlist_name, get_cell_w_ext(fname, 0), S(xctx->netlist_name));
    +        tclvareval("file dirname ", fname, NULL);
    +        path = tclresult();
    +        if(strchr(fname, '/')) {
    +          set_netlist_dir(1, path);
             }
           }
           if(set_netlist_dir(0, NULL) ) {
             done_netlist = 1;
             if(xctx->netlist_type == CAD_SPICE_NETLIST)
    -          err = global_spice_netlist(1);                  /* 1 means global netlist */
    +          err = global_spice_netlist(hier_netlist);                  /* 1 means global netlist */
             else if(xctx->netlist_type == CAD_VHDL_NETLIST)
    -          err = global_vhdl_netlist(1);
    +          err = global_vhdl_netlist(hier_netlist);
             else if(xctx->netlist_type == CAD_VERILOG_NETLIST)
    -          err = global_verilog_netlist(1);
    +          err = global_verilog_netlist(hier_netlist);
             else if(xctx->netlist_type == CAD_TEDAX_NETLIST)
    -          global_tedax_netlist(1);
    +          global_tedax_netlist(hier_netlist);
             else
               if(has_x) tcleval("tk_messageBox -type ok -parent [xschem get topwindow] "
                                 "-message {Please Set netlisting mode (Options menu)}");
    -        if( (argc ==3 && strcmp(argv[2], "-erc") ) || argc > 3) {
    +        if( (erc == 0) ) {
               my_strncpy(xctx->netlist_name, "", S(xctx->netlist_name));
             }
           }
    @@ -3259,6 +3270,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
             }
           }
           tclsetvar("show_infowindow_after_netlist", saveshow);
    +      set_netlist_dir(1, savedir);
           if(done_netlist) {
             if(messages) {
               Tcl_SetResult(interp, xctx->infowindow_text, TCL_VOLATILE);
    diff --git a/src/xschem.tcl b/src/xschem.tcl
    index f20d0a69..fee05f7b 100644
    --- a/src/xschem.tcl
    +++ b/src/xschem.tcl
    @@ -1787,7 +1787,7 @@ proc cellview_setlabels {w symbol sym_sch default_sch sym_spice_sym_def} {
         $w configure -fg $symfg
       } else {
         if {[$w get] eq $default_sch} {
    -        puts "need to clear schematic attr in symbol"
    +        puts "$symbol: need to clear schematic attr in symbol"
         } elseif {[$w get] eq $sym_sch} {
           $w configure -bg $symbg
         } else {
    
    From a7d5865ab8c28255ebd553e6ce6992bb43e0ea7e Mon Sep 17 00:00:00 2001
    From: stefan schippers 
    Date: Sat, 11 Jan 2025 20:16:01 +0100
    Subject: [PATCH 6/9] fix erroneous `all pins disconnected` warning when
     netlisting pin-to-pin  connected element chains
    
    ---
     src/netlist.c  | 19 ++++++++++++++++++-
     src/xschem.tcl |  1 -
     2 files changed, 18 insertions(+), 2 deletions(-)
    
    diff --git a/src/netlist.c b/src/netlist.c
    index 87cf255d..52fc1976 100644
    --- a/src/netlist.c
    +++ b/src/netlist.c
    @@ -1427,6 +1427,21 @@ static int name_unlabeled_instances()
         
       /* name nets that do not touch ipin opin alias instances */
       dbg(2, "name_unlabeled_instances(): naming nets that dont touch labels\n");
    +  for (i = 0; i < instances; ++i)
    +  {
    +    if(!inst[i].node) continue;
    +    if(skip_instance(i, 0, netlist_lvs_ignore)) continue;
    +    if(inst[i].ptr != -1) {
    +      rects=(inst[i].ptr+ xctx->sym)->rects[PINLAYER];
    +      for(j = 0; j < rects; ++j) {
    +        if(inst[i].node[j] == NULL)
    +        {
    +          err |= set_unnamed_inst(i, j);
    +        }
    +      }
    +    }
    +  }
    +
       for (i = 0; i < instances; ++i)
       {
         if(!inst[i].node) continue;
    @@ -1438,7 +1453,6 @@ static int name_unlabeled_instances()
             if(inst[i].node[j] == NULL)
             {
               all_unconn++;
    -          err |= set_unnamed_inst(i, j);
             }
           }
           if(rects > 0 && all_unconn == rects && for_netlist > 0 && xctx->netlist_count > 0) {
    @@ -1450,6 +1464,9 @@ static int name_unlabeled_instances()
           }
         }
       }
    +
    +
    +
       return err;
     } 
     
    diff --git a/src/xschem.tcl b/src/xschem.tcl
    index fee05f7b..11244c90 100644
    --- a/src/xschem.tcl
    +++ b/src/xschem.tcl
    @@ -1850,7 +1850,6 @@ proc cellview {{derived_symbols {}}} {
         }
         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}} {
    
    From 7d0a0e82bf6ab6fdaf5e3abb52dcd1ae1d2bd311 Mon Sep 17 00:00:00 2001
    From: stefan schippers 
    Date: Sat, 11 Jan 2025 20:24:16 +0100
    Subject: [PATCH 7/9] name_unlabeled_instances() commented out redundant (never
     happens) check
    
    ---
     src/netlist.c | 4 ++--
     1 file changed, 2 insertions(+), 2 deletions(-)
    
    diff --git a/src/netlist.c b/src/netlist.c
    index 52fc1976..505b5ba9 100644
    --- a/src/netlist.c
    +++ b/src/netlist.c
    @@ -1441,7 +1441,7 @@ static int name_unlabeled_instances()
           }
         }
       }
    -
    +  #if 0 /* should never happen */
       for (i = 0; i < instances; ++i)
       {
         if(!inst[i].node) continue;
    @@ -1464,7 +1464,7 @@ static int name_unlabeled_instances()
           }
         }
       }
    -
    +  #endif
     
     
       return err;
    
    From 66a6c913e3d8378ff3e7ca21eafc1850b2703ec0 Mon Sep 17 00:00:00 2001
    From: stefan schippers 
    Date: Sat, 11 Jan 2025 22:45:42 +0100
    Subject: [PATCH 8/9] removed warning msg
    
    ---
     src/draw.c    |  2 +-
     src/netlist.c | 37 +++++++++++++++++++------------------
     2 files changed, 20 insertions(+), 19 deletions(-)
    
    diff --git a/src/draw.c b/src/draw.c
    index 37b9ff4f..093aadac 100644
    --- a/src/draw.c
    +++ b/src/draw.c
    @@ -3860,7 +3860,7 @@ void draw_graph(int i, const int flags, Graph_ctx *gr, void *ct)
           if(custom_rawfile[0]) {
             if(extra_rawfile(autoload, custom_rawfile, sim_type[0] ? sim_type : 
                (xctx->raw && xctx->raw->sim_type ? xctx->raw->sim_type : NULL), -1.0, -1.0) == 0) {
    -          valid_rawfile = 0;
    +          valid_rawfile = 0; 
             }
           }
           my_strdup2(_ALLOC_ID_, &nd, find_nth(ntok, "%", "\"", 0, 2));
    diff --git a/src/netlist.c b/src/netlist.c
    index 505b5ba9..c39947e5 100644
    --- a/src/netlist.c
    +++ b/src/netlist.c
    @@ -1423,25 +1423,12 @@ static int name_unlabeled_instances()
       int i, j;
       xInstance * const inst = xctx->inst;
       int const instances = xctx->instances;
    -  int rects, all_unconn;
    +  int rects;
         
       /* name nets that do not touch ipin opin alias instances */
    -  dbg(2, "name_unlabeled_instances(): naming nets that dont touch labels\n");
    -  for (i = 0; i < instances; ++i)
    -  {
    -    if(!inst[i].node) continue;
    -    if(skip_instance(i, 0, netlist_lvs_ignore)) continue;
    -    if(inst[i].ptr != -1) {
    -      rects=(inst[i].ptr+ xctx->sym)->rects[PINLAYER];
    -      for(j = 0; j < rects; ++j) {
    -        if(inst[i].node[j] == NULL)
    -        {
    -          err |= set_unnamed_inst(i, j);
    -        }
    -      }
    -    }
    -  }
    -  #if 0 /* should never happen */
    +
    +  #if 0 /* does not work */
    +  int all_unconn;
       for (i = 0; i < instances; ++i)
       {
         if(!inst[i].node) continue;
    @@ -1466,7 +1453,21 @@ static int name_unlabeled_instances()
       }
       #endif
     
    -
    +  dbg(2, "name_unlabeled_instances(): naming nets that dont touch labels\n");
    +  for (i = 0; i < instances; ++i)
    +  {
    +    if(!inst[i].node) continue;
    +    if(skip_instance(i, 0, netlist_lvs_ignore)) continue;
    +    if(inst[i].ptr != -1) {
    +      rects=(inst[i].ptr+ xctx->sym)->rects[PINLAYER];
    +      for(j = 0; j < rects; ++j) {
    +        if(inst[i].node[j] == NULL)
    +        {
    +          err |= set_unnamed_inst(i, j);
    +        }
    +      }
    +    }
    +  }
       return err;
     } 
     
    
    From 8da888a11938dbc9b47c1d80f1fa76307a7e7ab8 Mon Sep 17 00:00:00 2001
    From: stefan schippers 
    Date: Sun, 12 Jan 2025 00:08:41 +0100
    Subject: [PATCH 9/9] fix uninitialized `raw` pointer in graph_fullxzoom() and
     graph_fullxzoom()
    
    ---
     src/draw.c | 6 +++---
     1 file changed, 3 insertions(+), 3 deletions(-)
    
    diff --git a/src/draw.c b/src/draw.c
    index 093aadac..df693b78 100644
    --- a/src/draw.c
    +++ b/src/draw.c
    @@ -2303,6 +2303,7 @@ int graph_fullxzoom(int i, Graph_ctx *gr, int dataset)
         Raw *raw = NULL;
         const char *ptr;
     
    +    raw = xctx->raw;
         autoload = !strboolcmp(get_tok_value(r->prop_ptr,"autoload", 0), "1");
         if(autoload == 0) autoload = 2;
         ptr = get_tok_value(r->prop_ptr,"rawfile", 0);
    @@ -2336,7 +2337,6 @@ int graph_fullxzoom(int i, Graph_ctx *gr, int dataset)
           }
         }
     
    -    raw = xctx->raw;
         /* if doing double variable DC sweeps raw->datasets == 1 but there are multiple curves.
          * find_closest_wave() may return a dataset number that is > 0 but its a "virtual" dataset
          * since double DC sweeps just do multiple sweeps by wrapping the sweep variable 
    @@ -2360,6 +2360,7 @@ int graph_fullxzoom(int i, Graph_ctx *gr, int dataset)
           xx1 = mylog10(xx1);
           xx2 = mylog10(xx2);
         }
    +    dbg(1, "graph_fullxzoom(): xx1=%g, xx2=%g\n");
         my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "x1", dtoa(xx1)));
         my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "x2", dtoa(xx2)));
     
    @@ -2409,7 +2410,7 @@ int graph_fullyzoom(xRect *r,  Graph_ctx *gr, int graph_dataset)
     
           ptr = get_tok_value(r->prop_ptr,"rawfile", 0);
           if(!ptr[0]) {
    -        if(raw && raw->rawfile) my_strdup2(_ALLOC_ID_, &custom_rawfile, raw->rawfile);
    +        if(xctx->raw && xctx->raw->rawfile) my_strdup2(_ALLOC_ID_, &custom_rawfile, xctx->raw->rawfile);
             else  my_strdup2(_ALLOC_ID_, &custom_rawfile, "");
           } else {
             my_strdup2(_ALLOC_ID_, &custom_rawfile, ptr);
    @@ -2431,7 +2432,6 @@ int graph_fullyzoom(xRect *r,  Graph_ctx *gr, int graph_dataset)
               extra_rawfile(autoload, custom_rawfile, sim_type[0] ? sim_type : xctx->raw->sim_type, -1.0, -1.0);
             }
             raw = xctx->raw;
    -
             my_strdup2(_ALLOC_ID_, &nd, find_nth(ntok, "%", "\"", 0, 2));
             /* if % is specified after node name,  is the dataset number to plot in graph */
             if(nd[0]) {