From c4ebc92aa2b854a6fa1751e393a57ffb65e021b9 Mon Sep 17 00:00:00 2001 From: stefan schippers Date: Sat, 21 Dec 2024 13:05:33 +0100 Subject: [PATCH] update xschem go_back command (pas integer notitle to go_back() function; simplify wrap handling vs sweep variable in draw_graph(), graph_fullyzoom(), calc_custom_data_yrange(), find_closest_wave() --- doc/xschem_man/developer_info.html | 2 +- src/draw.c | 26 +++++++++----------------- src/scheduler.c | 6 +++--- src/traversal.tcl | 2 +- 4 files changed, 14 insertions(+), 22 deletions(-) diff --git a/doc/xschem_man/developer_info.html b/doc/xschem_man/developer_info.html index ee0ddf30..517687a9 100644 --- a/doc/xschem_man/developer_info.html +++ b/doc/xschem_man/developer_info.html @@ -877,7 +877,7 @@ C {verilog_timescale.sym} 1050 -100 0 0 {name=s1 timestep="1ns" precision="1ns" Return various global variables used in the program
  • go_back [notitle]
  •     Go up one level (pop) in hierarchy
    -   if string 'notitle' is given do not update window title (slow) 
    + if integer 'notitle' given pass it to the go_back() function (1=do not update window title)
  • grabscreen
  •     grab root window 
  • hash_file file [skip_path_lines]
  • diff --git a/src/draw.c b/src/draw.c
    index 1a9fc28a..6fa8c132 100644
    --- a/src/draw.c
    +++ b/src/draw.c
    @@ -2423,7 +2423,6 @@ int graph_fullyzoom(xRect *r,  Graph_ctx *gr, int graph_dataset)
           end = (gr->gx1 <= gr->gx2) ? gr->gx2 : gr->gx1;
       
           while( (ntok = my_strtok_r(nptr, "\n", "\"", 4, &saven)) ) {
    -        int allow_wrap = 1;
             char *nd = NULL;
             char str_extra_idx[30];
     
    @@ -2466,7 +2465,6 @@ int graph_fullyzoom(xRect *r,  Graph_ctx *gr, int graph_dataset)
             if(raw && raw->sim_type && !strcmp(raw->sim_type, "op") && raw->datasets > 1 && raw->npoints[0] == 1) {
               save_datasets = raw->datasets;
               raw->datasets = 1;
    -          allow_wrap = 0;
               save_npoints = raw->npoints[0];
               raw->npoints[0] = raw->allpoints;
             }
    @@ -2514,13 +2512,12 @@ int graph_fullyzoom(xRect *r,  Graph_ctx *gr, int graph_dataset)
                 double xx, xx0 = 0.0; /* gcc gives false warnings if xx0 not initialized here */
                 int cnt=0, wrap;
                 register SPICE_DATA *gv = raw->values[sweep_idx];
    -            SPICE_DATA *gv0 = raw->values[0]; /* spice sweep variable, used to determine wrap arounds */
                 ofs_end = ofs + raw->npoints[dset];
                 for(p = ofs ; p < ofs_end; p++) {
                   if(gr->logx) xx = mylog10(gv[p]);
                   else xx = gv[p];
    -              if(p == ofs) xx0 = gv0[p];
    -              wrap = allow_wrap && (cnt > 1 && gv0[p] == xx0);
    +              if(p == ofs) xx0 = gv[p];
    +              wrap = (cnt > 1 && gv[p] == xx0);
                   if(wrap) {
                      sweepvar_wrap++;
                      cnt = 0;
    @@ -3450,7 +3447,6 @@ int calc_custom_data_yrange(int sweep_idx, const char *express, Graph_ctx *gr)
       for(dset = 0 ; dset < raw->datasets; dset++) {
         int cnt=0, wrap;
         register SPICE_DATA *gv = raw->values[sweep_idx];
    -    SPICE_DATA *gv0 = raw->values[0]; /* spice sweep variable, used to determine wrap arounds */
         ofs_end = ofs + raw->npoints[dset];
         first = -1;
         last = ofs; 
    @@ -3460,8 +3456,8 @@ int calc_custom_data_yrange(int sweep_idx, const char *express, Graph_ctx *gr)
           else
             xx = gv[p];
     
    -      if(p == ofs) xx0 = gv0[p];
    -      wrap = ( cnt > 1 && gv0[p] == xx0);
    +      if(p == ofs) xx0 = gv[p];
    +      wrap = ( cnt > 1 && gv[p] == xx0);
           if(first != -1) {                      /* there is something to plot ... */
             if(xx > end || xx < start ||         /* ... and we ran out of graph area ... */
               wrap) {                          /* ... or sweep variable changed direction */
    @@ -3586,7 +3582,6 @@ int find_closest_wave(int i, Graph_ctx *gr)
             double prev_x = 0.0;
             int cnt=0, wrap;
             register SPICE_DATA *gvx = raw->values[sweep_idx];
    -        SPICE_DATA *gv0 = raw->values[0];
             register SPICE_DATA *gvy;
             ofs_end = ofs + raw->npoints[dset];
             if(expression) plot_raw_custom_data(sweep_idx, ofs, ofs_end - 1, express, NULL);
    @@ -3600,10 +3595,10 @@ int find_closest_wave(int i, Graph_ctx *gr)
             for(p = ofs ; p < ofs_end; p++) {
               if(gr->logx) xx = mylog10(gvx[p]);
               else xx = gvx[p];
    -          if(p == ofs) xx0 = gv0[p];
    +          if(p == ofs) xx0 = gvx[p];
               if(gr->logy) yy = mylog10(gvy[p]);
               else  yy = gvy[p];
    -          wrap = (cnt > 1 && gv0[p] == xx0);
    +          wrap = (cnt > 1 && gvx[p] == xx0);
               if(first != -1) {
                 if(xx > end || xx < start || wrap) {
                   dbg(1, "find_closest_wave(): last=%d\n", last);
    @@ -3762,7 +3757,6 @@ void draw_graph(int i, const int flags, Graph_ctx *gr, void *ct)
         /* process each node given in "node" attribute, get also associated color/sweep var if any*/
         while( (ntok = my_strtok_r(nptr, "\n", "\"", 4, &saven)) ) {
           int valid_rawfile = 1;
    -      int allow_wrap = 1;
           char *nd = NULL;
           char str_extra_idx[30];
     
    @@ -3821,7 +3815,6 @@ void draw_graph(int i, const int flags, Graph_ctx *gr, void *ct)
              && xctx->raw->datasets > 1 && xctx->raw->npoints[0] == 1) {
             save_datasets = xctx->raw->datasets;
             xctx->raw->datasets = 1;
    -        allow_wrap = 0;
             save_npoints = xctx->raw->npoints[0];
             xctx->raw->npoints[0] = xctx->raw->allpoints;
           }
    @@ -3902,7 +3895,6 @@ void draw_graph(int i, const int flags, Graph_ctx *gr, void *ct)
               double prev_x;
               int cnt=0, wrap;
               register SPICE_DATA *gv = xctx->raw->values[sweep_idx];
    -          SPICE_DATA *gv0 = xctx->raw->values[0]; /* spice sweep variable, used to determine wrap arounds */
                 
               ofs_end = ofs + xctx->raw->npoints[dset];
               first = -1;
    @@ -3919,8 +3911,8 @@ void draw_graph(int i, const int flags, Graph_ctx *gr, void *ct)
                 else  xx = gv[p];
     
                 xxprevious = xxfollowing = xx;
    -            if(p == ofs) xx0 = gv0[p];
    -            wrap = allow_wrap && (cnt > 1 && gv0[p] == xx0);
    +            if(p == ofs) xx0 = gv[p];
    +            wrap = cnt > 1 && gv[p] == xx0;
                 #if 1 /* plot one point before start and one point after end so
                        * waves will extend to whole graph area even if there are few points
                        * but NOT if we are about to wrap (missing 1st/last point in 2-var dc sweeps) */
    @@ -3929,7 +3921,7 @@ void draw_graph(int i, const int flags, Graph_ctx *gr, void *ct)
                   else  xxprevious = gv[p - 1];
                 }
                 /*                    .................<-- next point will not wrap.  */
    -            if(p < ofs_end - 1 && gv0[p + 1] != xx0) {
    +            if(p < ofs_end - 1 && gv[p + 1] != xx0) {
                   if(gr->logx) xxfollowing = mylog10(gv[p + 1]);
                   else  xxfollowing = gv[p + 1];
                 }
    diff --git a/src/scheduler.c b/src/scheduler.c
    index 36d80965..44040594 100644
    --- a/src/scheduler.c
    +++ b/src/scheduler.c
    @@ -2079,13 +2079,13 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
     
         /* go_back [notitle]
          *   Go up one level (pop) in hierarchy
    -     *   if string 'notitle' is given do not update window title (slow) */
    +     *   if integer 'notitle' given pass it to the go_back() function (1=do not update window title) */
         else if(!strcmp(argv[1], "go_back"))
         {
           int set_title = 1;
           if(!xctx) {Tcl_SetResult(interp, not_avail, TCL_STATIC); return TCL_ERROR;}
    -      if(argc > 2 && !strcmp(argv[2], "notitle")) {
    -        set_title = 0;
    +      if(argc > 2 ) {
    +        set_title = atoi(argv[2]);
           }
           if((xctx->semaphore == 0)) go_back(1, set_title);
           Tcl_ResetResult(interp);
    diff --git a/src/traversal.tcl b/src/traversal.tcl
    index b8ad1443..04367ea1 100644
    --- a/src/traversal.tcl
    +++ b/src/traversal.tcl
    @@ -92,7 +92,7 @@ proc hier_traversal {fd {level 0} only_subckts} {
           if {$descended} {
             incr level
             set dp [hier_traversal $fd $level $only_subckts]
    -        xschem go_back notitle
    +        xschem go_back 1
             incr level -1
           }
         }