diff --git a/src/globals.c b/src/globals.c index 256feb59..0ea4f59f 100644 --- a/src/globals.c +++ b/src/globals.c @@ -67,7 +67,6 @@ int draw_window=0; /* 20181009 */ int draw_grid=1; double cadgrid = CADGRID; double cadhalfdotsize = CADHALFDOTSIZE; -char current_name[PATH_MAX]; /* 20190519 */ int change_lw=0; /* allow change linewidth */ int incr_hilight=1; int auto_hilight=0; @@ -185,21 +184,13 @@ double zoom=CADINITIALZOOM; double mooz=1/CADINITIALZOOM; double xorigin=CADINITIALX; double yorigin=CADINITIALY; -double *character[256]; - int lastselected = 0; +double *character[256]; /* array or per-char coordinates of xschem internal vector font */ +int lastselected = 0; +int max_selected; Selected *selectedgroup; /* array of selected objects to be */ /* drawn while moving if < MAXGROUP selected */ XPoint *gridpoint; /* pointer to array of gridpoints, used in draw() */ Tcl_Interp *interp; - int max_texts; - int max_wires; - int max_instances; - int max_symbols; - int max_selected; - int *max_rects; - int *max_polygons; /* 20171115 */ - int *max_arcs; /* 20181012 */ - int *max_lines; int do_netlist=0; /* set by process_options if user wants netllist from cmdline */ int do_simulation=0; /* 20171007 */ @@ -215,50 +206,16 @@ int prepared_netlist_structs=0; int prepared_hilight_structs=0; int prepared_hash_instances=0; int prepared_hash_wires=0; -/* */ -/* following data is relative to the current schematic */ -/* */ -Wire *wire; -int lastwire = 0; -Instance *inst_ptr; /* Pointer to element INSTANCE */ -int lastinst = 0; -Instdef *instdef; /* Pointer to element definition */ -int lastinstdef = 0; -Box **rect; -int *lastrect; -xPolygon **polygon; /* 20171115 */ -int *lastpolygon; /* 20171115 */ -xArc **arc; -int *lastarc; -Line **line; -int *lastline; -Text *textelement; -int lasttext=0; -char schematic[CADMAXHIER][PATH_MAX]; -int currentsch = 0; -char *schprop=NULL; /* spice */ -char *schtedaxprop=NULL; /* tEDAx */ -char *schvhdlprop=NULL; /* vhdl and symbol property string */ -char *schsymbolprop=NULL; /* vhdl and symbol property string */ -char *xschem_version_string=NULL; /* vhdl and symbol property string */ -char file_version[100]; -char *schverilogprop=NULL;/* verilog */ -int show_erc=1; -int hilight_nets=0; -char *sch_path[CADMAXHIER]; -int sch_inst_number[CADMAXHIER]; -int previous_instance[CADMAXHIER]; /* to remember the instance we came from when going up the hier. */ +int horizontal_move=0; /* 20171023 */ +int vertical_move=0; /* 20171023 */ int modified = 0; int color_ps=-1; int only_probes=0; /* 20110112 */ int hilight_color=0; -Zoom zoom_array[CADMAXHIER]; int pending_fullzoom=0; int split_files=0; /* split netlist files 20081202 */ char *netlist_dir=NULL; /* user set netlist directory via cmd-option or menu or xschemrc */ char user_top_netl_name[PATH_MAX] = ""; /* user set netlist name via cmd option -N */ -int horizontal_move=0; /* 20171023 */ -int vertical_move=0; /* 20171023 */ XColor xcolor_array[256];/* 20171109 */ Visual *visual; /*20171111 */ int dark_colorscheme=1; /* 20171113 */ @@ -301,4 +258,46 @@ double cairo_font_line_spacing=1.0; /* allows to change line spacing: default: 1 /* allowed values should be in the range [-4, 4] */ double cairo_vert_correct=0.0; double nocairo_vert_correct=0.0; +int show_erc=1; +int hilight_nets=0; +/* following data is relative to the current schematic */ +int max_texts; +int max_wires; +int max_instances; +int max_symbols; +int *max_rects; +int *max_polygons; +int *max_arcs; +int *max_lines; +Wire *wire; +int lastwire = 0; +Instance *inst_ptr; /* Pointer to element INSTANCE */ +int lastinst = 0; +Instdef *instdef; /* Pointer to element definition */ +int lastinstdef = 0; +Box **rect; +int *lastrect; +xPolygon **polygon; +int *lastpolygon; +xArc **arc; +int *lastarc; +Line **line; +int *lastline; +Text *textelement; +int lasttext=0; +char schematic[CADMAXHIER][PATH_MAX]; +int currentsch = 0; +char current_name[PATH_MAX]; +char *schprop=NULL; /* spice */ +char *schtedaxprop=NULL; /* tEDAx */ +char *schvhdlprop=NULL; /* vhdl property string */ +char *schsymbolprop=NULL; /* symbol property string */ +char *schverilogprop=NULL;/* verilog */ +char *xschem_version_string=NULL; +char file_version[100]; +char *sch_path[CADMAXHIER]; +int sch_inst_number[CADMAXHIER]; +int previous_instance[CADMAXHIER]; /* to remember the instance we came from when going up the hier. */ +Zoom zoom_array[CADMAXHIER]; + diff --git a/src/hilight.c b/src/hilight.c index fa107955..ace2d737 100644 --- a/src/hilight.c +++ b/src/hilight.c @@ -741,8 +741,8 @@ static void send_current_to_gaw(int simtype, const char *node) expanded_tok = expandlabel(tok, &tok_mult); tcleval("if { ![info exists gaw_fd] } { gaw_setup_tcp }\n"); for(k=1; k<=tok_mult; k++) { - my_strdup(246, &t, find_nth(expanded_tok, ',', k)); - my_strdup2(254, &p, sch_path[currentsch]+1); + my_strdup(1179, &t, find_nth(expanded_tok, ',', k)); + my_strdup2(1180, &p, sch_path[currentsch]+1); if(!simtype) { /* spice */ Tcl_VarEval(interp, "puts $gaw_fd {copyvar i(", currentsch>0 ? "v." : "", strtolower(p), strtolower(t), @@ -759,8 +759,8 @@ static void send_current_to_gaw(int simtype, const char *node) } } - my_free(774, &p); - my_free(775, &t); + my_free(1181, &p); + my_free(1182, &t); } diff --git a/src/save.c b/src/save.c index 5e9ace16..21768669 100644 --- a/src/save.c +++ b/src/save.c @@ -400,7 +400,12 @@ void save_line(FILE *fd) void write_xschem_file(FILE *fd) { int ty=0; - fprintf(fd, "v {xschem version=%s file_version=%s}\n", XSCHEM_VERSION, XSCHEM_FILE_VERSION); + + my_strdup2(1183, &xschem_version_string, subst_token(xschem_version_string, "version", XSCHEM_VERSION)); + my_strdup2(1184, &xschem_version_string, subst_token(xschem_version_string, "file_version", XSCHEM_FILE_VERSION)); + /* fprintf(fd, "v {xschem version=%s file_version=%s}\n", XSCHEM_VERSION, XSCHEM_FILE_VERSION); */ + fprintf(fd, "v {%s}\n", xschem_version_string); + if(schvhdlprop && !schsymbolprop) { get_tok_value(schvhdlprop,"type",0); diff --git a/src/xinit.c b/src/xinit.c index 057aaa14..d5126a96 100644 --- a/src/xinit.c +++ b/src/xinit.c @@ -345,22 +345,22 @@ void free_xschem_data() my_free(1111, &instdef[i].arcptr); my_free(1112, &instdef[i].polygonptr); my_free(1113, &instdef[i].lines); - my_free(1114, &instdef[i].polygons); /* 20171115 */ - my_free(1115, &instdef[i].arcs); /* 20181012 */ + my_free(1114, &instdef[i].polygons); + my_free(1115, &instdef[i].arcs); my_free(1116, &instdef[i].rects); } my_free(1117, &instdef); my_free(1118, &rect); my_free(1119, &line); - my_free(1125, &polygon); /* 20171115 */ - my_free(1126, &arc); /* 20171115 */ + my_free(1125, &polygon); + my_free(1126, &arc); my_free(1124, &lastrect); - my_free(1127, &lastpolygon); /* 20171115 */ - my_free(1128, &lastarc); /* 20171115 */ + my_free(1127, &lastpolygon); + my_free(1128, &lastarc); my_free(1129, &lastline); my_free(1130, &max_rects); - my_free(1131, &max_polygons); /* 20171115 */ - my_free(1132, &max_arcs); /* 20171115 */ + my_free(1131, &max_polygons); + my_free(1132, &max_arcs); my_free(1133, &max_lines); } @@ -528,6 +528,7 @@ void save_xschem_data(int what) static Xschem_ctx xc; if(what == 1) { + /* malloc'd storage */ xc.wire = wire; xc.textelement = textelement; xc.rect = rect; @@ -548,8 +549,15 @@ void save_xschem_data(int what) xc.max_polygons = max_polygons; xc.max_arcs = max_arcs; xc.max_lines = max_lines; + /*non malloc'd storage */ + xc.max_texts = max_texts; + xc.max_wires = max_wires; + xc.max_instances = max_instances; + xc.max_symbols = max_symbols; + } else if(what == 2) { + /* malloc'd storage */ wire = xc.wire; textelement = xc.textelement; rect = xc.rect; @@ -570,6 +578,11 @@ void save_xschem_data(int what) max_polygons = xc.max_polygons; max_arcs = xc.max_arcs; max_lines = xc.max_lines; + /*non malloc'd storage */ + max_texts = xc.max_texts; + max_wires = xc.max_wires; + max_instances = xc.max_instances; + max_symbols = xc.max_symbols; } } diff --git a/src/xschem.h b/src/xschem.h index 1f4fedcb..9cf2a9b9 100644 --- a/src/xschem.h +++ b/src/xschem.h @@ -299,6 +299,7 @@ extern char win_temp_dir[PATH_MAX]; #define X_TO_XSCHEM(x) ((x)*zoom -xorigin) #define Y_TO_XSCHEM(y) ((y)*zoom -yorigin) + typedef struct { unsigned short type; @@ -455,6 +456,10 @@ typedef struct { int *max_polygons; int *max_arcs; int *max_lines; + int max_texts; + int max_wires; + int max_instances; + int max_symbols; } Xschem_ctx; struct Lcc { /* used for symbols containing schematics as instances (LCC, Local Custom Cell) */