From c46afdc58298ce95b2f7664140325ae86f16ab50 Mon Sep 17 00:00:00 2001 From: stefan schippers Date: Mon, 15 Jan 2024 00:45:24 +0100 Subject: [PATCH] add command `xschem fill_type n fill_type` --- doc/xschem_man/developer_info.html | 6 ++++++ src/scheduler.c | 27 ++++++++++++++++++++++++++- src/xinit.c | 4 ++-- src/xschem.h | 2 ++ 4 files changed, 36 insertions(+), 3 deletions(-) diff --git a/doc/xschem_man/developer_info.html b/doc/xschem_man/developer_info.html index 51cbd0d0..b117c242 100644 --- a/doc/xschem_man/developer_info.html +++ b/doc/xschem_man/developer_info.html @@ -548,6 +548,7 @@ C {verilog_timescale.sym} 1050 -100 0 0 {name=s1 timestep="1ns" precision="1ns" +
  • abort_operation
  • @@ -682,6 +683,9 @@ C {verilog_timescale.sym} 1050 -100 0 0 {name=s1 timestep="1ns" precision="1ns"
        xschem expandlabel {2*A[3:0]} --> A[3],A[2],A[1],A[0],A[3],A[2],A[1],A[0] 8
        last field is the number of bits
        since [ and ] are TCL special characters argument must be quoted with { and } 
    +
  • fill_type n fill_type [nodraw]
  • +   Set fill type for layer 'n', fill_type may be 'solid' or 'stipple' or 'empty'
    +   If 'nodraw' is given do not redraw window.
  • find_nth string sep quote keep_quote n
  •     Find n-th field string separated by characters in sep. 1st field is in position 1
        do not split quoted fields (if quote characters are given) and return unquoted.
    @@ -1483,6 +1487,8 @@ C {verilog_timescale.sym} 1050 -100 0 0 {name=s1 timestep="1ns" precision="1ns"
     
     
     
    +
    +
     
     
     
    diff --git a/src/scheduler.c b/src/scheduler.c
    index e1e3e6b5..fe3e498a 100644
    --- a/src/scheduler.c
    +++ b/src/scheduler.c
    @@ -908,13 +908,38 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
         else { cmd_found = 0;}
         break;
         case 'f': /*----------------------------------------------*/
    +    /* fill_type n fill_type [nodraw]
    +     *   Set fill type for layer 'n', fill_type may be 'solid' or 'stipple' or 'empty'
    +     *   If 'nodraw' is given do not redraw window.
    +     */ 
    +    if(!strcmp(argv[1], "fill_type"))
    +    {
    +      int dr = 1;
    +      if(!xctx) {Tcl_SetResult(interp, not_avail, TCL_STATIC); return TCL_ERROR;}
    +      if(argc > 3) {
    +        int n = atoi(argv[2]);
    +        if(n >=0 && n < cadlayers) {
    +          if(!strcmp(argv[3], "solid")) xctx->fill_type[n]=1;
    +          else if(!strcmp(argv[3], "stipple")) xctx->fill_type[n]=2;
    +          else if(!strcmp(argv[3], "empty")) xctx->fill_type[n]=0;
    +          free_gc();
    +          create_gc();
    +          enable_layers();
    +          build_colors(0.0, 0.0);
    +          resetwin(1, 0, 1, 0, 0);  /* recreate pixmap. resetwin(create_pixmap, clear_pixmap, force, w, h) */
    +          if(argc > 4 && !strcmp(argv[4], "nodraw")) dr = 0;
    +          if(dr) draw();
    +        }
    +      } 
    +    }   
    +
         /* find_nth string sep quote keep_quote n
          *   Find n-th field string separated by characters in sep. 1st field is in position 1
          *   do not split quoted fields (if quote characters are given) and return unquoted.
          *   xschem find_nth {aaa,bbb,ccc,ddd} {,} 2  --> bbb 
          *   xschem find_nth {aaa, "bbb, ccc" , ddd} { ,} {"} 2  --> bbb, ccc
          */
    -    if(!strcmp(argv[1], "find_nth"))
    +    else if(!strcmp(argv[1], "find_nth"))
         {
           if(argc > 6) {
             Tcl_SetResult(interp, find_nth(argv[2], argv[3], argv[4], atoi(argv[5]), atoi(argv[6])), TCL_VOLATILE);
    diff --git a/src/xinit.c b/src/xinit.c
    index efe4bd6e..795c0759 100644
    --- a/src/xinit.c
    +++ b/src/xinit.c
    @@ -403,7 +403,7 @@ static void free_xschem_data()
       my_free(_ALLOC_ID_, &xctx);
     }
     
    -static void create_gc(void)
    +void create_gc(void)
     {
       int i;
       for(i=0;i