diff --git a/doc/xschem_man/developer_info.html b/doc/xschem_man/developer_info.html index 5de3ca2f..1dcc07bf 100644 --- a/doc/xschem_man/developer_info.html +++ b/doc/xschem_man/developer_info.html @@ -766,9 +766,9 @@ C {verilog_timescale.sym} 1050 -100 0 0 {name=s1 timestep="1ns" precision="1ns" 0: eat non escaped quotes (") 1: return unescaped quotes as part of the token value if they are present 2: eat backslashes -
  • load f [symbol|force|noundoreset|nofullzoom]
  • +   
  • load f [symbol|gui|noundoreset|nofullzoom]
  •     Load a new file 'f'.
    -   'force': do not ask to save modified file or warn if opening an already
    +   'gui': ask to save modified file or warn if opening an already
         open file or opening a new(not existing) file.
        'noundoreset': do not reset the undo history
        'symbol': do not load symbols (used if loading a symbol instead of a schematic)
    @@ -854,11 +854,17 @@ C {verilog_timescale.sym} 1050 -100 0 0 {name=s1 timestep="1ns" precision="1ns"
        Debug command to test vector net syntax parser 
  • paste [x y]
  •     Paste clipboard. If 'x y' not given user should complete placement in the GUI 
    -
  • pinlist inst
  • +   
  • pinlist inst [attr]
  •     List all pins of instance 'inst' 
    +   if no 'attr' is given return full attribute string,
    +   else return value for attribute 'attr'.
    +   Example: xschem pinlist x3 name
    +   -->  {PLUS} {OUT} {MINUS}
    +   Example: xschem pinlist x3 dir
    +   -->  {in} {out} {in}
        Example: xschem pinlist x3
    -   -->  { {0} {name=PLUS dir=in } } { {1} {name=OUT dir=out } }
    -        { {2} {name=MINUS dir=in } }
    + --> { {0} {name=PLUS dir=in } } { {1} {name=OUT dir=out } } + { {2} {name=MINUS dir=in } }
  • place_symbol [sym_name] [prop]
  •     Start a GUI placement operation of specified 'sym_name' symbol.
        If 'sym_name' not given prompt user
    @@ -957,6 +963,10 @@ C {verilog_timescale.sym} 1050 -100 0 0 {name=s1 timestep="1ns" precision="1ns"
          symbol: save as symbol (*.sym)
          If not specified default to schematic (*.sch)
        Does not ask confirmation if file name given
    +
  • sch_pinlist
  • +   List a 2-item list of all pins  and directions of current schematic
    +   Example: xschem sch_pinlist
    +   -->  {PLUS} {in} {OUT} {out} {MINUS} {in} {VCC} {inout} {VSS} {inout}
  • schematic_in_new_window [new_process]
  •     When a symbol is selected edit corresponding schematic
        in a new tab/window if not already open.
    diff --git a/src/callback.c b/src/callback.c
    index f17d0862..875fad16 100644
    --- a/src/callback.c
    +++ b/src/callback.c
    @@ -1815,7 +1815,7 @@ int callback(const char *winpath, int event, int mx, int my, KeySym key,
        }
        if(key=='O' && (state == (ControlMask|ShiftMask)) )   /* load most recent tile */
        {
    -     tclvareval("xschem load [lindex $recentfile 0]", NULL);
    +     tclvareval("xschem load [lindex $recentfile 0] gui", NULL);
          break;
        }
        if(key=='O' && state == ShiftMask)   /* toggle light/dark colorscheme 20171113 */
    @@ -2498,7 +2498,7 @@ int callback(const char *winpath, int event, int mx, int my, KeySym key,
              merge_file(2,".sch");
              break;
            case 9: /* load most recent file */
    -         tclvareval("xschem load [lindex $recentfile 0]", NULL);
    +         tclvareval("xschem load [lindex $recentfile 0] gui", NULL);
              break;
            case 10: /* edit attributes */
              edit_property(0);
    diff --git a/src/make_sym.awk b/src/make_sym.awk
    index b312563c..f2d87f2b 100755
    --- a/src/make_sym.awk
    +++ b/src/make_sym.awk
    @@ -151,6 +151,8 @@ function rest_of_props()
       sub(/lab[ \t]*=[ \t]*[^ \t]+[ \t]?/, "")
       sub(/value[ \t]*=[ \t]*[^ \t]+[ \t]?/, "")
       sub(/name[ \t]*=[ \t]*[^ \t]+[ \t]?/, "")
    +  sub(/^[ \t]*/, " ") # always begin with a space separator
    +  sub(/[ \t]*$/, "") # remove trailing white space
       sub(/^[ \t]*$/, "")
       return $0
     }
    @@ -259,8 +261,8 @@ function endfile(f) {
       if(dir=="generic")
       {
        printf "B 3 " (x-size) " " (y+num_i*space-size) " " (x+size) " " (y+num_i*space+size) \
    -         " {name=" label_pin[i] " generic_type=" sig_type " " >sym
    -   if(value !="") printf "value=" value " " >sym
    +         " {name=" label_pin[i] " generic_type=" sig_type >sym
    +   if(value !="") printf " value=" value >sym
        printf props_pin[i] > sym
        printf "}\n" >sym
        print "L 4 " x,y+num_i*space,x+lwidth, y+num_i*space,"{}" >sym
    @@ -270,8 +272,8 @@ function endfile(f) {
       if(dir=="ipin")
       {
        printf "B 5 " (x-size) " " (y+num_i*space-size) " " (x+size) " " (y+num_i*space+size) \
    -         " {name=" label_pin[i] vhdt vert " dir=in " >sym
    -   if(value !="") printf "value=" value " " >sym
    +         " {name=" label_pin[i] vhdt vert " dir=in" >sym
    +   if(value !="") printf " value=" value >sym
        printf props_pin[i] > sym
        printf "}\n" >sym
        print "L 4 " x,y+num_i*space,x+lwidth, y+num_i*space,"{}" >sym
    @@ -281,8 +283,8 @@ function endfile(f) {
       if(dir=="opin")
       {
        printf "B 5 " (-x-size) " " (y+num_o*space-size) " " (-x+size) " " (y+num_o*space+size) \
    -         " {name=" label_pin[i] vhdt vert " dir=out " >sym
    -   if(value !="") printf "value=" value " " >sym
    +         " {name=" label_pin[i] vhdt vert " dir=out" >sym
    +   if(value !="") printf " value=" value >sym
        printf props_pin[i] > sym
        printf "}\n" >sym
        print "L 4 " (-x-lwidth),(y+num_o*space),-x, (y+num_o*space),"{}" >sym
    @@ -292,8 +294,8 @@ function endfile(f) {
       if(dir=="iopin")
       {
        printf "B 5 " (-x-size) " " (y+num_o*space-size) " " (-x+size) " " (y+num_o*space+size) \
    -         " {name=" label_pin[i] vhdt vert " dir=inout " >sym
    -   if(value !="") printf "value=" value " " >sym
    +         " {name=" label_pin[i] vhdt vert " dir=inout" >sym
    +   if(value !="") printf " value=" value >sym
        printf props_pin[i] > sym
        printf "}\n" >sym
        print "L 7 " (-x-lwidth),(y+num_o*space),-x, (y+num_o*space),"{}" >sym
    diff --git a/src/scheduler.c b/src/scheduler.c
    index 3c9249d1..501cd929 100644
    --- a/src/scheduler.c
    +++ b/src/scheduler.c
    @@ -1816,9 +1816,9 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
           }
         }
     
    -    /* load f [symbol|force|noundoreset|nofullzoom]
    +    /* load f [symbol|gui|noundoreset|nofullzoom]
          *   Load a new file 'f'.
    -     *   'force': do not ask to save modified file or warn if opening an already
    +     *   'gui': ask to save modified file or warn if opening an already
          *   open file or opening a new(not existing) file.
          *   'noundoreset': do not reset the undo history
          *   'symbol': do not load symbols (used if loading a symbol instead of a schematic)
    @@ -1826,12 +1826,12 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
          */
         else if(!strcmp(argv[1], "load") )
         {
    -      int load_symbols = 1, force = 0, undo_reset = 1, nofullzoom = 0;
    +      int load_symbols = 1, force = 1, undo_reset = 1, nofullzoom = 0;
           size_t i;
           if(argc > 3) {
             for(i = 3; i < argc; ++i) {
               if(!strcmp(argv[i], "symbol")) load_symbols = 0;
    -          if(!strcmp(argv[i], "force")) force = 1;
    +          if(!strcmp(argv[i], "gui")) force = 0;
               if(!strcmp(argv[i], "noundoreset")) undo_reset = 0;
               if(!strcmp(argv[i], "nofullzoom")) nofullzoom = 1;
             }
    @@ -2240,11 +2240,17 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
           Tcl_ResetResult(interp);
         }
     
    -    /* pinlist inst
    +    /* pinlist inst [attr]
          *   List all pins of instance 'inst' 
    +     *   if no 'attr' is given return full attribute string,
    +     *   else return value for attribute 'attr'.
    +     *   Example: xschem pinlist x3 name
    +     *   -->  {PLUS} {OUT} {MINUS}
    +     *   Example: xschem pinlist x3 dir
    +     *   -->  {in} {out} {in}
          *   Example: xschem pinlist x3
    -     *   -->  { {0} {name=PLUS dir=in } } { {1} {name=OUT dir=out } }
    -     *        { {2} {name=MINUS dir=in } }
    +     *   --> { {0} {name=PLUS dir=in } } { {1} {name=OUT dir=out } }
    +     *       { {2} {name=MINUS dir=in } }
          */
         else if(!strcmp(argv[1], "pinlist"))
         {
    @@ -2256,14 +2262,12 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
             }
             no_of_pins= (xctx->inst[i].ptr+ xctx->sym)->rects[PINLAYER];
             for(p=0;p 3 && argv[3][0]) {
    +            Tcl_AppendResult(interp, "{",
                   get_tok_value((xctx->inst[i].ptr+ xctx->sym)->rect[PINLAYER][p].prop_ptr, argv[3], 0),
    -              "} } ", NULL);
    +              "} ", NULL);
               } else {
    -            Tcl_AppendResult(interp, "{ {", s, "} {", 
    +            Tcl_AppendResult(interp, "{ {", my_itoa(p), "} {",
                    (xctx->inst[i].ptr+ xctx->sym)->rect[PINLAYER][p].prop_ptr, "} } ", NULL);
               }
             }
    @@ -2872,6 +2876,29 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
           else saveas(NULL, SCHEMATIC);
         }
     
    +    /* sch_pinlist
    +     *   List a 2-item list of all pins  and directions of current schematic
    +     *   Example: xschem sch_pinlist
    +     *   -->  {PLUS} {in} {OUT} {out} {MINUS} {in} {VCC} {inout} {VSS} {inout}
    +     */
    +    else if(!strcmp(argv[1], "sch_pinlist"))
    +    {
    +      int i;
    +      char *dir = NULL;
    +      const char *lab;
    +      for(i = 0; i < xctx->instances; ++i) {
    +        if( !strcmp((xctx->inst[i].ptr + xctx->sym)->type, "ipin") ) dir="in";
    +        else if( !strcmp((xctx->inst[i].ptr + xctx->sym)->type, "opin") ) dir="out";
    +        else if( !strcmp((xctx->inst[i].ptr + xctx->sym)->type, "iopin") ) dir="inout";
    +        else dir = NULL;
    +        if(dir) {
    +          lab = get_tok_value(xctx->inst[i].prop_ptr, "lab", 0);
    +          Tcl_AppendResult(interp, "{", lab, "} {", dir, "} ", NULL);
    +             
    +        }
    +      }
    +    }
    +
         /* schematic_in_new_window [new_process]
          *   When a symbol is selected edit corresponding schematic
          *   in a new tab/window if not already open.
    diff --git a/src/xschem.tcl b/src/xschem.tcl
    index 84a0dd21..b70bfc46 100644
    --- a/src/xschem.tcl
    +++ b/src/xschem.tcl
    @@ -735,11 +735,11 @@ proc setup_recent_menu { {in_new_window 0} { topwin {} } } {
         foreach i $recentfile {
           if {$in_new_window} {
             $topwin.menubar.file.menu.recent_new_window add command \
    -          -command "xschem load_new_window {$i}" \
    +          -command "xschem load_new_window {$i} gui" \
               -label [file tail $i]
           } else {
             $topwin.menubar.file.menu.recent add command \
    -          -command "xschem load {$i}" \
    +          -command "xschem load {$i} gui" \
               -label [file tail $i]
           }
         }
    @@ -4697,7 +4697,7 @@ proc swap_compare_schematics {} {
       set sch2 [xschem get sch_to_compare]
       puts "swap_compare_schematics:\n  sch1=$sch1\n  sch2=$sch2"
       if {$sch2 ne {}} {
    -    xschem load $sch2 nofullzoom
    +    xschem load $sch2 nofullzoom gui
         set current  [xschem get schname]
         # Use "file tail" to handle equality of
         # https://raw.githubusercon...tb_reram.sch and /tmp/xschem_web/tb_reram.sch
    @@ -5706,7 +5706,7 @@ proc build_widgets { {topwin {} } } {
       $topwin.menubar.file.menu add command -label "Delete files" -command "xschem delete_files" -accelerator {Shift-D}
     
       $topwin.menubar.file.menu add command -label "Open Most Recent" \
    -    -command {xschem load [lindex "$recentfile" 0]} -accelerator {Ctrl+Shift+O}
    +    -command {xschem load [lindex "$recentfile" 0] gui} -accelerator {Ctrl+Shift+O}
       $topwin.menubar.file.menu add command -label "Save" -command "xschem save" -accelerator {Ctrl+S}
       toolbar_add FileSave "xschem save" "Save File" $topwin
       $topwin.menubar.file.menu add command -label "Merge" -command "xschem merge" -accelerator {Shift+B}