diff --git a/src/actions.c b/src/actions.c index 6a6ba6ac..deee4153 100644 --- a/src/actions.c +++ b/src/actions.c @@ -578,15 +578,15 @@ void enable_layers(void) { int i; char tmp[50]; - xctx->n_active_layers = 0; + n_active_layers = 0; for(i = 0; i< cadlayers; i++) { my_snprintf(tmp, S(tmp), "enable_layer(%d)",i); if(tclgetvar(tmp)[0] == '0') enable_layer[i] = 0; else { enable_layer[i] = 1; if(i>=7) { - xctx->active_layer[xctx->n_active_layers] = i; - xctx->n_active_layers++; + active_layer[n_active_layers] = i; + n_active_layers++; } } } diff --git a/src/callback.c b/src/callback.c index 8bae3e08..473bf14f 100644 --- a/src/callback.c +++ b/src/callback.c @@ -460,8 +460,8 @@ int callback(int event, int mx, int my, KeySym key, } if(key == '$' && ( state == ShiftMask) ) /* toggle pixmap saving */ { - draw_pixmap =!draw_pixmap; - if(draw_pixmap) tcleval("alert_ { enabling draw pixmap} {}"); + xctx->draw_pixmap =!xctx->draw_pixmap; + if(xctx->draw_pixmap) tcleval("alert_ { enabling draw pixmap} {}"); else tcleval("alert_ { disabling draw pixmap} {}"); break; } @@ -480,17 +480,17 @@ int callback(int event, int mx, int my, KeySym key, if(key == '=' && (state &ControlMask)) /* toggle fill rectangles */ { int x; - xctx->fill_pattern++; - if(xctx->fill_pattern==3) xctx->fill_pattern=0; + fill_pattern++; + if(fill_pattern==3) fill_pattern=0; - if(xctx->fill_pattern==1) { + if(fill_pattern==1) { tcleval("alert_ { Stippled pattern fill} {}"); for(x=0;xfill_pattern==2) { + else if(fill_pattern==2) { tcleval("alert_ { solid pattern fill} {}"); for(x=0;xno_draw = 0; if(xctx->semaphore >= 2) break; tcleval("set constrained_move 0" ); constrained_move=0; @@ -1305,13 +1305,13 @@ int callback(int event, int mx, int my, KeySym key, } if(key=='>') { if(xctx->semaphore >= 2) break; - if(draw_single_layer< cadlayers-1) draw_single_layer++; + if(xctx->draw_single_layer< cadlayers-1) xctx->draw_single_layer++; draw(); break; } if(key=='<') { if(xctx->semaphore >= 2) break; - if(draw_single_layer>=0 ) draw_single_layer--; + if(xctx->draw_single_layer>=0 ) xctx->draw_single_layer--; draw(); break; } diff --git a/src/check.c b/src/check.c index 884b0730..ec2d2f70 100644 --- a/src/check.c +++ b/src/check.c @@ -55,7 +55,7 @@ void update_conn_cues(int draw_cues, int dr_win) hash_wires(); /* must be done also if wires==0 to clear wiretable */ if(!xctx->wires) return; - if(!draw_dots) return; + if(!xctx->draw_dots) return; if(cadhalfdotsize*xctx->mooz<0.7) return; x1 = X_TO_XSCHEM(xctx->areax1); y1 = Y_TO_XSCHEM(xctx->areay1); @@ -104,10 +104,10 @@ void update_conn_cues(int draw_cues, int dr_win) /* optimization when editing small areas (detailed zoom) of a huge schematic */ if(LINE_OUTSIDE(wire[i].x1, wire[i].y1, wire[i].x2, wire[i].y2, x1, y1, x2, y2)) continue; - if( wire[i].end1 >1 ) { /* 20150331 draw_dots */ + if( wire[i].end1 >1 ) { filledarc(WIRELAYER, ADD, wire[i].x1, wire[i].y1, cadhalfdotsize, 0, 360); } - if( wire[i].end2 >1 ) { /* 20150331 draw_dots */ + if( wire[i].end2 >1 ) { filledarc(WIRELAYER, ADD, wire[i].x2, wire[i].y2, cadhalfdotsize, 0, 360); } } diff --git a/src/draw.c b/src/draw.c index 4b2872d8..67701ce0 100644 --- a/src/draw.c +++ b/src/draw.c @@ -76,7 +76,7 @@ void print_image() #endif save_draw_grid = draw_grid; draw_grid=0; - draw_pixmap=1; + xctx->draw_pixmap=1; draw(); #ifdef __unix__ XpmWriteFileFromPixmap(display, "plot.xpm", xctx->save_pixmap,0, NULL ); /* .gz ???? */ @@ -95,7 +95,7 @@ void print_image() #endif my_strncpy(xctx->plotfile,"", S(xctx->plotfile)); draw_grid=save_draw_grid; - draw_pixmap=1; + xctx->draw_pixmap=1; } #if HAS_CAIRO==1 @@ -244,7 +244,7 @@ void draw_string(int layer, int what, const char *str, short rot, short flip, in /*fprintf(errfp, "cairo_draw_string(): tt=%s, longest line: %d\n", tt, longest_line); */ if(draw_window) cairo_draw_string_line(xctx->cairo_ctx, tt, x, y, rot, flip, lineno, fext.height, fext.ascent, fext.descent, llength, no_of_lines, longest_line); - if(draw_pixmap) cairo_draw_string_line(xctx->cairo_save_ctx, tt, x, y, rot, flip, + if(xctx->draw_pixmap) cairo_draw_string_line(xctx->cairo_save_ctx, tt, x, y, rot, flip, lineno, fext.height, fext.ascent, fext.descent, llength, no_of_lines, longest_line); lineno++; if(c==0) break; @@ -664,12 +664,12 @@ void drawgrid() x = xctx->xorigin*xctx->mooz; y = xctx->yorigin*xctx->mooz; if(y>xctx->areay1 && y < xctx->areay2) { if(draw_window) XDrawLine(display, xctx->window, gc[GRIDLAYER],xctx->areax1+1,(int)y, xctx->areax2-1, (int)y); - if(draw_pixmap) + if(xctx->draw_pixmap) XDrawLine(display, xctx->save_pixmap, gc[GRIDLAYER],xctx->areax1+1,(int)y, xctx->areax2-1, (int)y); } if(x>xctx->areax1 && x < xctx->areax2) { if(draw_window) XDrawLine(display, xctx->window, gc[GRIDLAYER],(int)x,xctx->areay1+1, (int)x, xctx->areay2-1); - if(draw_pixmap) + if(xctx->draw_pixmap) XDrawLine(display, xctx->save_pixmap, gc[GRIDLAYER],(int)x,xctx->areay1+1, (int)x, xctx->areay2-1); } tmp = floor((xctx->areay1+1)/delta)*delta-fmod(-xctx->yorigin*xctx->mooz,delta); @@ -683,7 +683,7 @@ void drawgrid() XDrawPoints(display,xctx->window,gc[GRIDLAYER],xctx->gridpoint,i,CoordModeOrigin); } } - if(draw_pixmap) { + if(xctx->draw_pixmap) { if(big_grid_points) { XDrawSegments(display,xctx->save_pixmap,gc[GRIDLAYER],xctx->biggridpoint,i); } else { @@ -710,7 +710,7 @@ void drawgrid() XDrawPoints(display,xctx->window,gc[GRIDLAYER],xctx->gridpoint,i,CoordModeOrigin); } } - if(draw_pixmap) { + if(xctx->draw_pixmap) { if(big_grid_points) { XDrawSegments(display,xctx->save_pixmap,gc[GRIDLAYER],xctx->biggridpoint,i); } else { @@ -741,13 +741,13 @@ void drawline(int c, int what, double linex1, double liney1, double linex2, doub { #ifdef __unix__ if(draw_window) XDrawSegments(display, xctx->window, gc[c], rr,i); - if(draw_pixmap) + if(xctx->draw_pixmap) XDrawSegments(display, xctx->save_pixmap, gc[c], rr,i); #else for (j = 0; j < i; ++j) { if (draw_window) XDrawLine(display, xctx->window, gc[c], rr[j].x1, rr[j].y1, rr[j].x2, rr[j].y2); - if (draw_pixmap) + if (xctx->draw_pixmap) XDrawLine(display, xctx->save_pixmap, gc[c], rr[j].x1, rr[j].y1, rr[j].x2, rr[j].y2); } #endif @@ -782,7 +782,7 @@ void drawline(int c, int what, double linex1, double liney1, double linex2, doub XSetLineAttributes (display, gc[c], INT_WIDTH(xctx->lw), xDashType, CapButt, JoinBevel); } if(draw_window) XDrawLine(display, xctx->window, gc[c], x1, y1, x2, y2); - if(draw_pixmap) + if(xctx->draw_pixmap) XDrawLine(display, xctx->save_pixmap, gc[c], x1, y1, x2, y2); if(dash) { XSetLineAttributes (display, gc[c], INT_WIDTH(xctx->lw), LineSolid, CapRound, JoinRound); @@ -807,7 +807,7 @@ void drawline(int c, int what, double linex1, double liney1, double linex2, doub XSetLineAttributes (display, gc[c], INT_BUS_WIDTH(xctx->lw), LineSolid, CapRound, JoinRound); } if(draw_window) XDrawLine(display, xctx->window, gc[c], x1, y1, x2, y2); - if(draw_pixmap) XDrawLine(display, xctx->save_pixmap, gc[c], x1, y1, x2, y2); + if(xctx->draw_pixmap) XDrawLine(display, xctx->save_pixmap, gc[c], x1, y1, x2, y2); XSetLineAttributes (display, gc[c], INT_WIDTH(xctx->lw), LineSolid, CapRound , JoinRound); } } @@ -816,12 +816,12 @@ void drawline(int c, int what, double linex1, double liney1, double linex2, doub { #ifdef __unix__ if(draw_window) XDrawSegments(display, xctx->window, gc[c], rr,i); - if(draw_pixmap) XDrawSegments(display, xctx->save_pixmap, gc[c], rr,i); + if(xctx->draw_pixmap) XDrawSegments(display, xctx->save_pixmap, gc[c], rr,i); #else for (j = 0; j < i; ++j) { if (draw_window) XDrawLine(display, xctx->window, gc[c], rr[j].x1, rr[j].y1, rr[j].x2, rr[j].y2); - if (draw_pixmap) + if (xctx->draw_pixmap) XDrawLine(display, xctx->save_pixmap, gc[c], rr[j].x1, rr[j].y1, rr[j].x2, rr[j].y2); } #endif @@ -1012,7 +1012,7 @@ void filledarc(int c, int what, double x, double y, double r, double a, double b if(i>=CADDRAWBUFFERSIZE) { if(draw_window) XFillArcs(display, xctx->window, gc[c], xarc,i); - if(draw_pixmap) XFillArcs(display, xctx->save_pixmap, gc[c], xarc,i); + if(xctx->draw_pixmap) XFillArcs(display, xctx->save_pixmap, gc[c], xarc,i); i=0; } xx1=X_TO_SCREEN(x-r); @@ -1049,14 +1049,14 @@ void filledarc(int c, int what, double x, double y, double r, double a, double b if( rectclip(xctx->areax1,xctx->areay1,xctx->areax2,xctx->areay2,&x1,&y1,&x2,&y2) ) { if(draw_window) XFillArc(display, xctx->window, gc[c], xx1, yy1, xx2-xx1, yy2-yy1, a*64, b*64); - if(draw_pixmap) XFillArc(display, xctx->save_pixmap, gc[c], xx1, yy1, xx2-xx1, yy2-yy1, a*64, b*64); + if(xctx->draw_pixmap) XFillArc(display, xctx->save_pixmap, gc[c], xx1, yy1, xx2-xx1, yy2-yy1, a*64, b*64); } } else if(what & START) i=0; else if((what & END) && i) { if(draw_window) XFillArcs(display, xctx->window, gc[c], xarc,i); - if(draw_pixmap) XFillArcs(display, xctx->save_pixmap, gc[c], xarc,i); + if(xctx->draw_pixmap) XFillArcs(display, xctx->save_pixmap, gc[c], xarc,i); i=0; } } @@ -1077,7 +1077,7 @@ void drawarc(int c, int what, double x, double y, double r, double a, double b, if(i>=CADDRAWBUFFERSIZE) { if(draw_window) XDrawArcs(display, xctx->window, gc[c], xarc,i); - if(draw_pixmap) XDrawArcs(display, xctx->save_pixmap, gc[c], xarc,i); + if(xctx->draw_pixmap) XDrawArcs(display, xctx->save_pixmap, gc[c], xarc,i); i=0; } xx1=X_TO_SCREEN(x-r); @@ -1126,15 +1126,15 @@ void drawarc(int c, int what, double x, double y, double r, double a, double b, if(draw_window) { XDrawArc(display, xctx->window, gc[c], xx1, yy1, xx2-xx1, yy2-yy1, a*64, b*64); } - if(draw_pixmap) { + if(xctx->draw_pixmap) { XDrawArc(display, xctx->save_pixmap, gc[c], xx1, yy1, xx2-xx1, yy2-yy1, a*64, b*64); } - if(xctx->fill_pattern && fill_type[c]){ + if(fill_pattern && fill_type[c]){ if(arc_fill) { if(draw_window) XFillArc(display, xctx->window, gcstipple[c], xx1, yy1, xx2-xx1, yy2-yy1, a*64, b*64); - if(draw_pixmap) + if(xctx->draw_pixmap) XFillArc(display, xctx->save_pixmap, gcstipple[c], xx1, yy1, xx2-xx1, yy2-yy1, a*64, b*64); } } @@ -1147,7 +1147,7 @@ void drawarc(int c, int what, double x, double y, double r, double a, double b, else if((what & END) && i) { if(draw_window) XDrawArcs(display, xctx->window, gc[c], xarc,i); - if(draw_pixmap) XDrawArcs(display, xctx->save_pixmap, gc[c], xarc,i); + if(xctx->draw_pixmap) XDrawArcs(display, xctx->save_pixmap, gc[c], xarc,i); i=0; } } @@ -1160,7 +1160,7 @@ void filledrect(int c, int what, double rectx1,double recty1,double rectx2,doubl double x1,y1,x2,y2; if(!has_x) return; - if(!xctx->fill_pattern || !fill_type[c]) return; + if(!fill_pattern || !fill_type[c]) return; if(what & NOW) { x1=X_TO_SCREEN(rectx1); @@ -1173,7 +1173,7 @@ void filledrect(int c, int what, double rectx1,double recty1,double rectx2,doubl if(draw_window) XFillRectangle(display, xctx->window, gcstipple[c], (int)x1, (int)y1, (unsigned int)x2 - (unsigned int)x1, (unsigned int)y2 - (unsigned int)y1); - if(draw_pixmap) + if(xctx->draw_pixmap) XFillRectangle(display, xctx->save_pixmap,gcstipple[c], (int)x1, (int)y1, (unsigned int)x2 - (unsigned int)x1, (unsigned int)y2 - (unsigned int)y1); @@ -1185,7 +1185,7 @@ void filledrect(int c, int what, double rectx1,double recty1,double rectx2,doubl if(i>=CADDRAWBUFFERSIZE) { if(draw_window) XFillRectangles(display, xctx->window, gcstipple[c], r,i); - if(draw_pixmap) + if(xctx->draw_pixmap) XFillRectangles(display, xctx->save_pixmap, gcstipple[c], r,i); i=0; } @@ -1206,7 +1206,7 @@ void filledrect(int c, int what, double rectx1,double recty1,double rectx2,doubl else if((what & END) && i) { if(draw_window) XFillRectangles(display, xctx->window, gcstipple[c], r,i); - if(draw_pixmap) XFillRectangles(display, xctx->save_pixmap, gcstipple[c], r,i); + if(xctx->draw_pixmap) XFillRectangles(display, xctx->save_pixmap, gcstipple[c], r,i); i=0; } } @@ -1312,12 +1312,12 @@ void drawpolygon(int c, int what, double *x, double *y, int points, int poly_fil XSetLineAttributes (display, gc[c], INT_WIDTH(xctx->lw), xDashType, CapButt, JoinBevel); } if(draw_window) XDrawLines(display, xctx->window, gc[c], p, points, CoordModeOrigin); - if(draw_pixmap) + if(xctx->draw_pixmap) XDrawLines(display, xctx->save_pixmap, gc[c], p, points, CoordModeOrigin); - if(xctx->fill_pattern && fill_type[c]){ + if(fill_pattern && fill_type[c]){ if(poly_fill && (x[0] == x[points-1]) && (y[0] == y[points-1])) { if(draw_window) XFillPolygon(display, xctx->window, gcstipple[c], p, points, Polygontype, CoordModeOrigin); - if(draw_pixmap) + if(xctx->draw_pixmap) XFillPolygon(display, xctx->save_pixmap, gcstipple[c], p, points, Polygontype, CoordModeOrigin); } } @@ -1378,7 +1378,7 @@ void drawrect(int c, int what, double rectx1,double recty1,double rectx2,double if(draw_window) XDrawRectangle(display, xctx->window, gc[c], (int)x1, (int)y1, (unsigned int)x2 - (unsigned int)x1, (unsigned int)y2 - (unsigned int)y1); - if(draw_pixmap) + if(xctx->draw_pixmap) { XDrawRectangle(display, xctx->save_pixmap, gc[c], (int)x1, (int)y1, (unsigned int)x2 - (unsigned int)x1, @@ -1395,7 +1395,7 @@ void drawrect(int c, int what, double rectx1,double recty1,double rectx2,double if(i>=CADDRAWBUFFERSIZE) { if(draw_window) XDrawRectangles(display, xctx->window, gc[c], r,i); - if(draw_pixmap) + if(xctx->draw_pixmap) XDrawRectangles(display, xctx->save_pixmap, gc[c], r,i); i=0; } @@ -1416,7 +1416,7 @@ void drawrect(int c, int what, double rectx1,double recty1,double rectx2,double else if((what & END) && i) { if(draw_window) XDrawRectangles(display, xctx->window, gc[c], r,i); - if(draw_pixmap) XDrawRectangles(display, xctx->save_pixmap, gc[c], r,i); + if(xctx->draw_pixmap) XDrawRectangles(display, xctx->save_pixmap, gc[c], r,i); i=0; } } @@ -1485,10 +1485,10 @@ void draw(void) #if HAS_CAIRO==1 char *textfont; #endif - if(no_draw) return; + if(xctx->no_draw) return; rebuild_selected_array(); if(has_x) { - if(draw_pixmap) + if(xctx->draw_pixmap) XFillRectangle(display, xctx->save_pixmap, gc[BACKLAYER], xctx->areax1, xctx->areay1, xctx->areaw, xctx->areah); if(draw_window) @@ -1509,7 +1509,7 @@ void draw(void) struct iterator_ctx ctx; dbg(3, "draw(): check4\n"); for(c=0;cdraw_single_layer!=-1 && c != xctx->draw_single_layer) continue; if(enable_layer[c]) for(i=0;ilines[c];i++) { xLine *l = &xctx->line[c][i]; @@ -1559,7 +1559,7 @@ void draw(void) drawrect(c, END, 0.0, 0.0, 0.0, 0.0, 0); drawline(c, END, 0.0, 0.0, 0.0, 0.0, 0); } - if(draw_single_layer==-1 || draw_single_layer==WIRELAYER) { + if(xctx->draw_single_layer==-1 || xctx->draw_single_layer==WIRELAYER) { if(use_hash) init_wire_iterator(&ctx, x1, y1, x2, y2); else i = -1; while(1) { @@ -1583,7 +1583,7 @@ void draw(void) filledrect(WIRELAYER, END, 0.0, 0.0, 0.0, 0.0); drawline(WIRELAYER, END, 0.0, 0.0, 0.0, 0.0, 0); } - if(draw_single_layer ==-1 || draw_single_layer==TEXTLAYER) { + if(xctx->draw_single_layer ==-1 || xctx->draw_single_layer==TEXTLAYER) { for(i=0;itexts;i++) { textlayer = xctx->text[i].layer; diff --git a/src/globals.c b/src/globals.c index 99ee3a02..61b80966 100644 --- a/src/globals.c +++ b/src/globals.c @@ -163,7 +163,6 @@ int en_hilight_conn_inst = 0; int help=0; /* help option set to global scope, printing help is deferred */ /* when configuration ~/.schem has been read 20140406 */ -int no_draw=0; FILE *errfp; char *filename=NULL; /* filename given on cmdline */ char user_conf_dir[PATH_MAX]; @@ -184,32 +183,29 @@ int debug_var=-10; /* will be set to 0 in xinit.c */ int tcp_port = 0; int do_print=0; int no_readline=0; -int draw_pixmap=1; /* use pixmap for double buffer */ int draw_window=0; int text_svg=1; /* use svg element for text instead of xschem's internal vector font */ int text_ps=1; /* use ps font for text instead of xschem's internal vector font */ double cadhalfdotsize = CADHALFDOTSIZE; unsigned int color_index[256]; /* layer color lookup table */ -int max_undo=MAX_UNDO; -int draw_dots=1; -int draw_single_layer=-1; int yyparse_error = 0; int *enable_layer; +int n_active_layers = 0; +int *active_layer; int screendepth; -int *fill_type; /* for every layer: 0: no fill, 1, solid fill, 2: stipple fill */ char **color_array; +int *fill_type; +int fill_pattern = 1; +double color_dim = 0.0; char *xschem_executable=NULL; double *character[256]; /* array or per-char coordinates of xschem internal vector font */ Tcl_Interp *interp; int do_netlist=0; /* set by process_options if user wants netllist from cmdline */ int do_simulation=0; int do_waves=0; -int netlist_count=0; /* netlist counter incremented at any cell being netlisted */ char bus_char[3] = {0, 0, 0}; int constrained_move = 0; -double color_dim=0.0; int batch_mode = 0; /* no tcl console if set; batch mode */ -int show_erc=1; /* following data is relative to the current schematic */ Xschem_ctx *xctx; diff --git a/src/hilight.c b/src/hilight.c index 1511b2ae..7f15019f 100644 --- a/src/hilight.c +++ b/src/hilight.c @@ -97,22 +97,22 @@ void free_hilight_hash(void) /* remove the whole hash table */ } /* by default: - * xctx->active_layer[0] = 7 - * xctx->active_layer[1] = 8 - * xctx->active_layer[2] = 10 if 9 is disabled it is skipped + * active_layer[0] = 7 + * active_layer[1] = 8 + * active_layer[2] = 10 if 9 is disabled it is skipped * ... * if a layer is disabled (not viewable) it is skipped - * xctx->n_active_layers is the total number of layers for hilights. - * standard xschem conf: cadlayers=22, xctx->n_active_layers=15 if no disabled layers. + * n_active_layers is the total number of layers for hilights. + * standard xschem conf: cadlayers=22, n_active_layers=15 if no disabled layers. */ int get_color(int value) { int x; if(value < 0) return (-value) % cadlayers ; - if(xctx->n_active_layers) { - x = value%(xctx->n_active_layers); - return xctx->active_layer[x]; + if(n_active_layers) { + x = value%(n_active_layers); + return active_layer[x]; } else { return cadlayers > 5 ? 5 : cadlayers -1; /* desperate attempt to return a decent color */ } @@ -121,7 +121,7 @@ int get_color(int value) void incr_hilight_color(void) { - xctx->hilight_color = (xctx->hilight_color + 1) % (xctx->n_active_layers * cadlayers); + xctx->hilight_color = (xctx->hilight_color + 1) % (n_active_layers * cadlayers); } /* print all highlight signals which are not ports (in/out/inout). */ @@ -1444,7 +1444,7 @@ void logic_set(int value, int num) if(!xctx->simdata.valid) create_simdata(); rebuild_selected_array(); newval = value; - if(!no_draw && !big) { + if(!xctx->no_draw && !big) { calc_drawing_bbox(&boundbox, 2); bbox(START, 0.0 , 0.0 , 0.0 , 0.0); bbox(ADD, boundbox.x1, boundbox.y1, boundbox.x2, boundbox.y2); @@ -1480,13 +1480,13 @@ void logic_set(int value, int num) propagate_logic(); propagate_hilights(1, 0, XINSERT); } - if(!no_draw && !big) { + if(!xctx->no_draw && !big) { calc_drawing_bbox(&boundbox, 2); bbox(ADD, boundbox.x1, boundbox.y1, boundbox.x2, boundbox.y2); bbox(SET , 0.0 , 0.0 , 0.0 , 0.0); } draw(); - if(!no_draw && !big) bbox(END , 0.0 , 0.0 , 0.0 , 0.0); + if(!xctx->no_draw && !big) bbox(END , 0.0 , 0.0 , 0.0 , 0.0); tcleval("if { [info exists gaw_fd] } {close $gaw_fd; unset gaw_fd}\n"); } @@ -1692,17 +1692,17 @@ void draw_hilight_net(int on_window) drawline(get_color(entry->value), NOW, xctx->wire[i].x1, xctx->wire[i].y1, xctx->wire[i].x2, xctx->wire[i].y2, 0); if(cadhalfdotsize*xctx->mooz>=0.7) { - if( xctx->wire[i].end1 >1 ) { /* 20150331 draw_dots */ + if( xctx->wire[i].end1 >1 ) { filledarc(get_color(entry->value), NOW, xctx->wire[i].x1, xctx->wire[i].y1, cadhalfdotsize, 0, 360); } - if( xctx->wire[i].end2 >1 ) { /* 20150331 draw_dots */ + if( xctx->wire[i].end2 >1 ) { filledarc(get_color(entry->value), NOW, xctx->wire[i].x2, xctx->wire[i].y2, cadhalfdotsize, 0, 360); } } } } for(c=0;cdraw_single_layer!=-1 && c != xctx->draw_single_layer) continue; if(use_hash) init_inst_iterator(&ctx, x1, y1, x2, y2); else i = -1; while(1) { diff --git a/src/in_memory_undo.c b/src/in_memory_undo.c index 2e06e7ce..ac325b1d 100644 --- a/src/in_memory_undo.c +++ b/src/in_memory_undo.c @@ -203,7 +203,7 @@ void push_undo(void) initialized=1; init_undo(); } - slot = xctx->cur_undo_ptr%max_undo; + slot = xctx->cur_undo_ptr%MAX_UNDO; my_strdup(173, &uslot[slot].gptr, xctx->schvhdlprop); my_strdup(174, &uslot[slot].vptr, xctx->schverilogprop); @@ -308,7 +308,7 @@ void push_undo(void) xctx->cur_undo_ptr++; xctx->head_undo_ptr = xctx->cur_undo_ptr; - xctx->tail_undo_ptr = xctx->head_undo_ptr <= max_undo? 0: xctx->head_undo_ptr-max_undo; + xctx->tail_undo_ptr = xctx->head_undo_ptr <= MAX_UNDO? 0: xctx->head_undo_ptr-MAX_UNDO; } @@ -333,7 +333,7 @@ void pop_undo(int redo) if(xctx->cur_undo_ptr<=0) return; /* check undo tail */ xctx->cur_undo_ptr--; } - slot = xctx->cur_undo_ptr%max_undo; + slot = xctx->cur_undo_ptr%MAX_UNDO; clear_drawing(); unselect_all(); my_strdup(198, &xctx->schvhdlprop, uslot[slot].gptr); diff --git a/src/netlist.c b/src/netlist.c index 98e409a3..58d12aaf 100644 --- a/src/netlist.c +++ b/src/netlist.c @@ -276,7 +276,7 @@ void hash_inst_pin(int what, int i, int j) xctx->inst[i].name, j, prop_ptr); statusmsg(str,2); tcleval("wm deiconify .infotext"); /* critical error: force ERC window showing */ - if(!netlist_count) { + if(!xctx->netlist_count) { xctx->inst[i].color = -PINLAYER; xctx->hilight_nets=1; } @@ -448,7 +448,7 @@ static void signal_short( char *n1, char *n2) dbg(1, "signal_short(): signal_short: shorted: %s - %s", n1, n2); statusmsg(str,2); tcleval("wm deiconify .infotext"); /* critical error: force ERC window showing */ - if(!netlist_count) { + if(!xctx->netlist_count) { bus_hilight_lookup(n1, xctx->hilight_color, XINSERT); if(incr_hilight) incr_hilight_color(); bus_hilight_lookup(n2, xctx->hilight_color, XINSERT); @@ -655,8 +655,8 @@ void prepare_netlist_structs(int for_netlist) else delete_netlist_structs(); xctx->simdata.valid = 0; dbg(1, "prepare_netlist_structs(): extraction\n"); - if(netlist_count == 0 ) startlevel = xctx->currsch; - print_erc = netlist_count == 0 || startlevel < xctx->currsch; + if(xctx->netlist_count == 0 ) startlevel = xctx->currsch; + print_erc = xctx->netlist_count == 0 || startlevel < xctx->currsch; if (for_netlist>0) { my_snprintf(nn, S(nn), "-----------%s", xctx->sch[xctx->currsch]); diff --git a/src/node_hash.c b/src/node_hash.c index 33ce4b2c..21b081ac 100644 --- a/src/node_hash.c +++ b/src/node_hash.c @@ -304,7 +304,6 @@ void traverse_node_hash() struct node_hashentry *entry; char str[2048]; /* 20161122 overflow safe */ - if(!show_erc)return; for(i=0;inode_table[i]; @@ -314,14 +313,14 @@ void traverse_node_hash() if(entry->d.out + entry->d.inout + entry->d.in == 1) { my_snprintf(str, S(str), "open net: %s", entry->token); - if(!netlist_count) bus_hilight_lookup(entry->token, xctx->hilight_color, XINSERT_NOREPLACE); + if(!xctx->netlist_count) bus_hilight_lookup(entry->token, xctx->hilight_color, XINSERT_NOREPLACE); if(incr_hilight) incr_hilight_color(); statusmsg(str,2); } else if(entry->d.out ==0 && entry->d.inout == 0) { my_snprintf(str, S(str), "undriven node: %s", entry->token); - if(!netlist_count) bus_hilight_lookup(entry->token, xctx->hilight_color, XINSERT_NOREPLACE); + if(!xctx->netlist_count) bus_hilight_lookup(entry->token, xctx->hilight_color, XINSERT_NOREPLACE); if(incr_hilight) incr_hilight_color(); statusmsg(str,2); tcleval("wm deiconify .infotext"); /* critical error: force ERC window showing */ @@ -329,21 +328,21 @@ void traverse_node_hash() else if(entry->d.out >=2 && entry->d.port>=0) /* era d.port>=2 03102001 */ { my_snprintf(str, S(str), "shorted output node: %s", entry->token); - if(!netlist_count) bus_hilight_lookup(entry->token, xctx->hilight_color, XINSERT_NOREPLACE); + if(!xctx->netlist_count) bus_hilight_lookup(entry->token, xctx->hilight_color, XINSERT_NOREPLACE); if(incr_hilight) incr_hilight_color(); statusmsg(str,2); } else if(entry->d.in ==0 && entry->d.inout == 0) { my_snprintf(str, S(str), "node: %s goes nowhere", entry->token); - if(!netlist_count) bus_hilight_lookup(entry->token, xctx->hilight_color, XINSERT_NOREPLACE); + if(!xctx->netlist_count) bus_hilight_lookup(entry->token, xctx->hilight_color, XINSERT_NOREPLACE); if(incr_hilight) incr_hilight_color(); statusmsg(str,2); } else if(entry->d.out >=2 && entry->d.inout == 0 && entry->d.port>=0) /* era d.port>=2 03102001 */ { my_snprintf(str, S(str), "shorted output node: %s", entry->token); - if(!netlist_count) bus_hilight_lookup(entry->token, xctx->hilight_color, XINSERT_NOREPLACE); + if(!xctx->netlist_count) bus_hilight_lookup(entry->token, xctx->hilight_color, XINSERT_NOREPLACE); if(incr_hilight) incr_hilight_color(); statusmsg(str,2); } diff --git a/src/psprint.c b/src/psprint.c index 9a72aaf1..2e02cc99 100644 --- a/src/psprint.c +++ b/src/psprint.c @@ -118,7 +118,7 @@ static void set_ps_colors(unsigned int pixel) static void ps_xdrawarc(int layer, int fillarc, double x, double y, double r, double a, double b) { - if(xctx->fill_pattern && fillarc) + if(fill_pattern && fillarc) fprintf(fd, "%g %g %g %g %g A %g %g LT C F S\n", x, y, r, -a, -a-b, x, y); else fprintf(fd, "%g %g %g %g %g A S\n", x, y, r, -a, -a-b); @@ -140,7 +140,7 @@ static void ps_xfillrectange(int layer, double x1, double y1, double x2, double y2) { fprintf(fd, "%g %g %g %g R\n", x1,y1,x2-x1,y2-y1); - if( (fill_type[layer] == 1) && xctx->fill_pattern) { + if( (fill_type[layer] == 1) && fill_pattern) { fprintf(fd, "%g %g %g %g RF\n", x1,y1,x2-x1,y2-y1); /* fprintf(fd,"fill\n"); */ } @@ -174,7 +174,7 @@ static void ps_drawpolygon(int c, int what, double *x, double *y, int points, in if(i==0) fprintf(fd, "NP\n%g %g MT\n", xx, yy); else fprintf(fd, "%g %g LT\n", xx, yy); } - if(xctx->fill_pattern && fill_type[c] && poly_fill) { + if(fill_pattern && fill_type[c] && poly_fill) { fprintf(fd, "C F S\n"); } else { fprintf(fd, "S\n"); @@ -852,10 +852,10 @@ void create_ps(char **psfile, int what) y2 = Y_TO_XSCHEM(xctx->areay2); for(init_wire_iterator(&ctx, x1, y1, x2, y2); ( wireptr = wire_iterator_next(&ctx) ) ;) { i = wireptr->n; - if( xctx->wire[i].end1 >1 ) { /* 20150331 draw_dots */ + if( xctx->wire[i].end1 >1 ) { ps_drawarc(WIRELAYER, 1, xctx->wire[i].x1, xctx->wire[i].y1, cadhalfdotsize, 0, 360, 0); } - if( xctx->wire[i].end2 >1 ) { /* 20150331 draw_dots */ + if( xctx->wire[i].end2 >1 ) { ps_drawarc(WIRELAYER, 1, xctx->wire[i].x2, xctx->wire[i].y2, cadhalfdotsize, 0, 360, 0); } } diff --git a/src/save.c b/src/save.c index 65c3abef..747b6aee 100644 --- a/src/save.c +++ b/src/save.c @@ -1118,7 +1118,7 @@ void delete_undo(void) int i; char diff_name[PATH_MAX]; /* overflow safe 20161122 */ - for(i=0; iundo_dirname, i); xunlink(diff_name); } @@ -1149,7 +1149,7 @@ void push_undo(void) #if HAS_POPEN==1 - my_snprintf(diff_name, S(diff_name), "gzip --fast -c > %s/undo%d", xctx->undo_dirname, xctx->cur_undo_ptr%max_undo); + my_snprintf(diff_name, S(diff_name), "gzip --fast -c > %s/undo%d", xctx->undo_dirname, xctx->cur_undo_ptr%MAX_UNDO); fd = popen(diff_name,"w"); if(!fd) { fprintf(errfp, "push_undo(): failed to open write pipe %s\n", diff_name); @@ -1157,7 +1157,7 @@ void push_undo(void) return; } #elif HAS_PIPE==1 - my_snprintf(diff_name, S(diff_name), "%s/undo%d", xctx->undo_dirname, xctx->cur_undo_ptr%max_undo); + my_snprintf(diff_name, S(diff_name), "%s/undo%d", xctx->undo_dirname, xctx->cur_undo_ptr%MAX_UNDO); pipe(pd); if((pid = fork()) ==0) { /* child process */ static char f[PATH_MAX] = ""; @@ -1186,7 +1186,7 @@ void push_undo(void) close(pd[0]); /* close read side of pipe */ fd=fdopen(pd[1],"w"); #else /* uncompressed undo */ - my_snprintf(diff_name, S(diff_name), "%s/undo%d", xctx->undo_dirname, xctx->cur_undo_ptr%max_undo); + my_snprintf(diff_name, S(diff_name), "%s/undo%d", xctx->undo_dirname, xctx->cur_undo_ptr%MAX_UNDO); fd = fopen(diff_name,"w"); if(!fd) { fprintf(errfp, "push_undo(): failed to open undo file %s\n", diff_name); @@ -1197,7 +1197,7 @@ void push_undo(void) write_xschem_file(fd); xctx->cur_undo_ptr++; xctx->head_undo_ptr = xctx->cur_undo_ptr; - xctx->tail_undo_ptr = xctx->head_undo_ptr <= max_undo? 0: xctx->head_undo_ptr-max_undo; + xctx->tail_undo_ptr = xctx->head_undo_ptr <= MAX_UNDO? 0: xctx->head_undo_ptr-MAX_UNDO; #if HAS_POPEN==1 pclose(fd); #elif HAS_PIPE==1 @@ -1243,7 +1243,7 @@ void pop_undo(int redo) unselect_all(); #if HAS_POPEN==1 - my_snprintf(diff_name, S(diff_name), "gzip -d -c %s/undo%d", xctx->undo_dirname, xctx->cur_undo_ptr%max_undo); + my_snprintf(diff_name, S(diff_name), "gzip -d -c %s/undo%d", xctx->undo_dirname, xctx->cur_undo_ptr%MAX_UNDO); fd=popen(diff_name, "r"); if(!fd) { fprintf(errfp, "pop_undo(): failed to open read pipe %s\n", diff_name); @@ -1251,7 +1251,7 @@ void pop_undo(int redo) return; } #elif HAS_PIPE==1 - my_snprintf(diff_name, S(diff_name), "%s/undo%d", xctx->undo_dirname, xctx->cur_undo_ptr%max_undo); + my_snprintf(diff_name, S(diff_name), "%s/undo%d", xctx->undo_dirname, xctx->cur_undo_ptr%MAX_UNDO); pipe(pd); if((pid = fork())==0) { /* child process */ static char f[PATH_MAX] = ""; @@ -1277,7 +1277,7 @@ void pop_undo(int redo) close(pd[1]); /* close write side of pipe */ fd=fdopen(pd[0],"r"); #else /* uncompressed undo */ - my_snprintf(diff_name, S(diff_name), "%s/undo%d", xctx->undo_dirname, xctx->cur_undo_ptr%max_undo); + my_snprintf(diff_name, S(diff_name), "%s/undo%d", xctx->undo_dirname, xctx->cur_undo_ptr%MAX_UNDO); fd=fopen(diff_name, "r"); if(!fd) { fprintf(errfp, "pop_undo(): failed to open read pipe %s\n", diff_name); diff --git a/src/scheduler.c b/src/scheduler.c index 2ba02309..84ec7502 100644 --- a/src/scheduler.c +++ b/src/scheduler.c @@ -629,7 +629,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg Tcl_SetResult(interp, "0",TCL_STATIC); } else if(!strcmp(argv[2],"no_draw")) { - if( no_draw != 0 ) + if( xctx->no_draw != 0 ) Tcl_SetResult(interp, "1",TCL_STATIC); else Tcl_SetResult(interp, "0",TCL_STATIC); @@ -2183,7 +2183,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg } else if(!strcmp(argv[2],"no_draw")) { int s = atoi(argv[3]); - no_draw=s; + xctx->no_draw=s; } else if(!strcmp(argv[2],"hide_symbols")) { int s = atoi(argv[3]); diff --git a/src/spice_netlist.c b/src/spice_netlist.c index 48b47078..e1fdc3ff 100644 --- a/src/spice_netlist.c +++ b/src/spice_netlist.c @@ -135,7 +135,7 @@ void global_spice_netlist(int global) /* netlister driver */ bus_char[0] = str_tmp[0]; bus_char[1] = str_tmp[1]; } - netlist_count=0; + xctx->netlist_count=0; my_snprintf(netl_filename, S(netl_filename), "%s/.%s_%d", netlist_dir, skip_dir(xctx->sch[xctx->currsch]), getpid()); dbg(1, "global_spice_netlist(): opening %s for writing\n",netl_filename); @@ -235,7 +235,7 @@ void global_spice_netlist(int global) /* netlister driver */ } } - netlist_count++; + xctx->netlist_count++; if(xctx->schprop && xctx->schprop[0]) { if(first == 0) fprintf(fd,"**** begin user architecture code\n"); @@ -384,7 +384,7 @@ void global_spice_netlist(int global) /* netlister driver */ } my_free(946, &type); my_free(947, &place); - netlist_count = 0; + xctx->netlist_count = 0; } static char *model_name_result = NULL; @@ -460,7 +460,7 @@ void spice_block_netlist(FILE *fd, int i) spice_stop ? load_schematic(0,filename, 0) : load_schematic(1,filename, 0); spice_netlist(fd, spice_stop); /* 20111113 added spice_stop */ - netlist_count++; + xctx->netlist_count++; if(xctx->schprop && xctx->schprop[0]) { fprintf(fd,"**** begin user architecture code\n"); @@ -523,8 +523,8 @@ void spice_netlist(FILE *fd, int spice_stop ) if( type && !IS_LABEL_OR_PIN(type) ) { /* already done in global_spice_netlist */ - if(!strcmp(type,"netlist_commands") && netlist_count==0) continue; - if(netlist_count && + if(!strcmp(type,"netlist_commands") && xctx->netlist_count==0) continue; + if(xctx->netlist_count && !strcmp(get_tok_value(xctx->inst[i].prop_ptr, "only_toplevel", 0), "true")) continue; if(!strcmp(type,"netlist_commands")) { fprintf(fd,"**** begin user architecture code\n"); @@ -546,7 +546,7 @@ void spice_netlist(FILE *fd, int spice_stop ) } my_free(952, &type); } - if(!spice_stop && !netlist_count) redraw_hilights(0); /* draw_hilight_net(1); */ + if(!spice_stop && !xctx->netlist_count) redraw_hilights(0); /* draw_hilight_net(1); */ } /* calculate the hash function relative to string s */ diff --git a/src/svgdraw.c b/src/svgdraw.c index 40d6f74b..53fbea27 100644 --- a/src/svgdraw.c +++ b/src/svgdraw.c @@ -756,10 +756,10 @@ void svg_draw(void) if(xctx->hilight_nets && (entry=bus_hilight_lookup( xctx->wire[i].node, 0, XLOOKUP))) { color = get_color(entry->value); } - if( xctx->wire[i].end1 >1 ) { /* 20150331 draw_dots */ + if( xctx->wire[i].end1 >1 ) { svg_drawcircle(color, 1, xctx->wire[i].x1, xctx->wire[i].y1, cadhalfdotsize, 0, 360); } - if( xctx->wire[i].end2 >1 ) { /* 20150331 draw_dots */ + if( xctx->wire[i].end2 >1 ) { svg_drawcircle(color, 1, xctx->wire[i].x2, xctx->wire[i].y2, cadhalfdotsize, 0, 360); } } diff --git a/src/tedax_netlist.c b/src/tedax_netlist.c index 5f6d1450..e4658893 100644 --- a/src/tedax_netlist.c +++ b/src/tedax_netlist.c @@ -46,7 +46,7 @@ void global_tedax_netlist(int global) /* netlister driver */ bus_char[0] = str_tmp[0]; bus_char[1] = str_tmp[1]; } - netlist_count=0; + xctx->netlist_count=0; my_snprintf(netl_filename, S(netl_filename), "%s/.%s_%d", netlist_dir, skip_dir(xctx->sch[xctx->currsch]), getpid()); fd=fopen(netl_filename, "w"); @@ -73,7 +73,7 @@ void global_tedax_netlist(int global) /* netlister driver */ fprintf(fd,"tEDAx v1\nbegin netlist v1 %s\n", skip_dir( xctx->sch[xctx->currsch]) ); tedax_netlist(fd, 0); - netlist_count++; + xctx->netlist_count++; /*fprintf(fd,"**** begin user architecture code\n"); */ /*if(xctx->schprop && xctx->schprop[0]) fprintf(fd, "%s\n", xctx->schprop); */ @@ -144,7 +144,7 @@ void global_tedax_netlist(int global) /* netlister driver */ tcleval(tcl_cmd_netlist); } if(!debug_var) xunlink(netl_filename); - netlist_count = 0; + xctx->netlist_count = 0; } @@ -187,7 +187,7 @@ void tedax_block_netlist(FILE *fd, int i) fprintf(fd, "\n"); load_schematic(1,filename, 0); tedax_netlist(fd, tedax_stop); - netlist_count++; + xctx->netlist_count++; if(xctx->schprop && xctx->schprop[0]) { fprintf(fd,"#**** begin user architecture code\n"); @@ -231,8 +231,8 @@ void tedax_netlist(FILE *fd, int tedax_stop ) if( type && !IS_LABEL_OR_PIN(type) ) { /* already done in global_tedax_netlist */ - if(!strcmp(type,"netlist_commands") && netlist_count==0) continue; - if(netlist_count && + if(!strcmp(type,"netlist_commands") && xctx->netlist_count==0) continue; + if(xctx->netlist_count && !strcmp(get_tok_value(xctx->inst[i].prop_ptr, "only_toplevel", 0), "true")) continue; if(!strcmp(type,"netlist_commands")) { fprintf(fd,"#**** begin user architecture code\n"); @@ -245,7 +245,7 @@ void tedax_netlist(FILE *fd, int tedax_stop ) } my_free(967, &type); } - if(!tedax_stop && !netlist_count) redraw_hilights(0); /* draw_hilight_net(1); */ + if(!tedax_stop && !xctx->netlist_count) redraw_hilights(0); /* draw_hilight_net(1); */ } diff --git a/src/token.c b/src/token.c index 38d8fef3..bf03b69b 100644 --- a/src/token.c +++ b/src/token.c @@ -1598,7 +1598,7 @@ int print_spice_element(FILE *fd, int inst) } no_of_pins= (xctx->inst[inst].ptr+ xctx->sym)->rects[PINLAYER]; s=format; - dbg(1, "print_spice_element(): name=%s, format=%s netlist_count=%d\n",name,format, netlist_count); + dbg(1, "print_spice_element(): name=%s, format=%s xctx->netlist_count=%d\n",name,format, xctx->netlist_count); /* begin parsing format string */ while(1) { @@ -1988,7 +1988,7 @@ void print_tedax_element(FILE *fd, int inst) } if(format) { s=format; - dbg(1, "print_tedax_element(): name=%s, tedax_format=%s netlist_count=%d\n",name,format, netlist_count); + dbg(1, "print_tedax_element(): name=%s, tedax_format=%s xctx->netlist_count=%d\n",name,format, xctx->netlist_count); /* begin parsing format string */ while(1) { @@ -2346,7 +2346,7 @@ const char *net_name(int i, int j, int *multip, int hash_prefix_unnamed_net, int i, j, xctx->inst[i].instname ) ; statusmsg(errstr,2); tcleval("wm deiconify .infotext"); /* critical error: force ERC window showing */ - if(!netlist_count) { + if(!xctx->netlist_count) { xctx->inst[i].color = -PINLAYER; xctx->hilight_nets=1; } @@ -2390,7 +2390,7 @@ void print_vhdl_primitive(FILE *fd, int inst) /* netlist primitives, 20071217 * } no_of_pins= (xctx->inst[inst].ptr+ xctx->sym)->rects[PINLAYER]; s=format; - dbg(1, "print_vhdl_primitive(): name=%s, format=%s netlist_count=%d\n",name,format, netlist_count); + dbg(1, "print_vhdl_primitive(): name=%s, format=%s xctx->netlist_count=%d\n",name,format, xctx->netlist_count); fprintf(fd, "---- start primitive "); lab=expandlabel(name, &tmp); @@ -2564,7 +2564,7 @@ void print_verilog_primitive(FILE *fd, int inst) /* netlist switch level primiti } no_of_pins= (xctx->inst[inst].ptr+ xctx->sym)->rects[PINLAYER]; s=format; - dbg(1, "print_verilog_primitive(): name=%s, format=%s netlist_count=%d\n",name,format, netlist_count); + dbg(1, "print_verilog_primitive(): name=%s, format=%s xctx->netlist_count=%d\n",name,format, xctx->netlist_count); fprintf(fd, "---- start primitive "); lab=expandlabel(name, &tmp); diff --git a/src/verilog_netlist.c b/src/verilog_netlist.c index bdac85f1..207f6db0 100644 --- a/src/verilog_netlist.c +++ b/src/verilog_netlist.c @@ -47,7 +47,7 @@ void global_verilog_netlist(int global) /* netlister driver */ if(save_ok == -1) return; } free_hash(subckt_table); - netlist_count=0; + xctx->netlist_count=0; /* top sch properties used for library use declarations and type definitions */ /* to be printed before any entity declarations */ @@ -240,7 +240,7 @@ void global_verilog_netlist(int global) /* netlister driver */ dbg(1, "global_verilog_netlist(): netlisting top level\n"); verilog_netlist(fd, 0); - netlist_count++; + xctx->netlist_count++; fprintf(fd,"---- begin user architecture code\n"); for(i=0;iinstances;i++) { @@ -347,7 +347,7 @@ void global_verilog_netlist(int global) /* netlister driver */ my_free(1076, &port_value); my_free(1077, &tmp_string); my_free(1078, &type); - netlist_count = 0; + xctx->netlist_count = 0; } @@ -469,7 +469,7 @@ void verilog_block_netlist(FILE *fd, int i) dbg(1, "verilog_block_netlist(): netlisting %s\n", skip_dir( xctx->sch[xctx->currsch])); verilog_netlist(fd, verilog_stop); - netlist_count++; + xctx->netlist_count++; fprintf(fd,"---- begin user architecture code\n"); for(l=0;linstances;l++) { if( strcmp(get_tok_value(xctx->inst[l].prop_ptr,"verilog_ignore",0),"true")==0 ) continue; @@ -477,7 +477,7 @@ void verilog_block_netlist(FILE *fd, int i) if(!strcmp(get_tok_value( (xctx->inst[l].ptr+ xctx->sym)->prop_ptr, "verilog_ignore",0 ), "true") ) { continue; } - if(netlist_count && + if(xctx->netlist_count && !strcmp(get_tok_value(xctx->inst[l].prop_ptr, "only_toplevel", 0), "true")) continue; my_strdup(569, &type,(xctx->inst[l].ptr+ xctx->sym)->type); @@ -553,5 +553,5 @@ void verilog_netlist(FILE *fd , int verilog_stop) my_free(1084, &type); } dbg(1, "verilog_netlist(): end\n"); - if(!verilog_stop && !netlist_count) redraw_hilights(0); /*draw_hilight_net(1); */ + if(!verilog_stop && !xctx->netlist_count) redraw_hilights(0); /*draw_hilight_net(1); */ } diff --git a/src/vhdl_netlist.c b/src/vhdl_netlist.c index f746fb72..11682a00 100644 --- a/src/vhdl_netlist.c +++ b/src/vhdl_netlist.c @@ -49,7 +49,7 @@ void global_vhdl_netlist(int global) /* netlister driver */ save_ok = save_schematic(xctx->sch[xctx->currsch]); if(save_ok == -1) return; } - netlist_count=0; + xctx->netlist_count=0; free_hash(subckt_table); my_snprintf(netl_filename, S(netl_filename), "%s/.%s_%d", netlist_dir, skip_dir(xctx->sch[xctx->currsch]), getpid()); @@ -324,7 +324,7 @@ void global_vhdl_netlist(int global) /* netlister driver */ override_netlist_type(-1); /* restore to netlist_dir default */ if(debug_var==0) xunlink(netl_filename); } - netlist_count++; + xctx->netlist_count++; /* preserve current level instance flags before descending hierarchy for netlisting, restore later */ stored_flags = my_calloc(151, xctx->instances, sizeof(unsigned int)); @@ -401,7 +401,7 @@ void global_vhdl_netlist(int global) /* netlister driver */ my_free(1089, &sig_type); my_free(1090, &type); my_free(1091, &port_value); - netlist_count = 0; + xctx->netlist_count = 0; } @@ -595,7 +595,7 @@ void vhdl_block_netlist(FILE *fd, int i) if(!strcmp(get_tok_value( (xctx->inst[l].ptr+ xctx->sym)->prop_ptr, "vhdl_ignore",0 ), "true") ) { continue; } - if(netlist_count && + if(xctx->netlist_count && !strcmp(get_tok_value(xctx->inst[l].prop_ptr, "only_toplevel", 0), "true")) continue; my_strdup(601, &type,(xctx->inst[l].ptr+ xctx->sym)->type); @@ -614,7 +614,7 @@ void vhdl_block_netlist(FILE *fd, int i) override_netlist_type(-1); /* restore to netlist_dir default */ if(debug_var==0) xunlink(netl_filename); } - netlist_count++; + xctx->netlist_count++; my_free(1094, &sig_type); my_free(1095, &port_value); my_free(1096, &type); @@ -705,5 +705,5 @@ void vhdl_netlist(FILE *fd , int vhdl_stop) my_free(1097, &type); } dbg(1, "vhdl_netlist(): end\n"); - if(!vhdl_stop && !netlist_count) redraw_hilights(0); /* draw_hilight_net(1); */ + if(!vhdl_stop && !xctx->netlist_count) redraw_hilights(0); /* draw_hilight_net(1); */ } diff --git a/src/xinit.c b/src/xinit.c index e45e5ab1..a0d49775 100644 --- a/src/xinit.c +++ b/src/xinit.c @@ -364,7 +364,6 @@ void free_xschem_data() for(i=0;isch_path[i]); my_free(1099, &xctx->gridpoint); my_free(1214, &xctx->biggridpoint); - my_free(1121, &xctx->active_layer); my_free(269, &xctx); } @@ -523,13 +522,14 @@ void alloc_xschem_data() xctx->sel_array=my_calloc(619, xctx->maxsel, sizeof(Selected)); xctx->biggridpoint=(XSegment*)my_calloc(1213, CADMAXGRIDPOINTS,sizeof(XSegment)); xctx->gridpoint=(XPoint*)my_calloc(608, CADMAXGRIDPOINTS,sizeof(XPoint)); - xctx->n_active_layers = 0; - xctx->active_layer=my_calloc(563, cadlayers, sizeof(int)); xctx->enable_drill = 0; xctx->pending_fullzoom = 0; my_strncpy(xctx->hiersep, ".", S(xctx->hiersep)); xctx->no_undo = 0; - xctx->fill_pattern = 1; + xctx->draw_single_layer = -1; + xctx->draw_dots = 1; + xctx->no_draw = 0; + xctx->draw_pixmap = 1; } void alloc_data() @@ -538,10 +538,11 @@ void alloc_data() alloc_xschem_data(); /* global context / graphic preferences/settings */ + fill_type=my_calloc(640, cadlayers, sizeof(int)); + active_layer=my_calloc(563, cadlayers, sizeof(int)); color_array=my_calloc(637, cadlayers, sizeof(char*)); gc=my_calloc(638, cadlayers, sizeof(GC)); gcstipple=my_calloc(639, cadlayers, sizeof(GC)); - fill_type=my_calloc(640, cadlayers, sizeof(int)); pixdata=my_calloc(641, cadlayers, sizeof(char*)); for(i=0;i