simplified complex logical expressions on symbol type by using macros
This commit is contained in:
parent
12f74b1265
commit
3060217aec
|
|
@ -765,7 +765,7 @@ void attach_labels_to_inst() /* offloaded from callback.c 20171005 */
|
|||
if(strcmp(rot_txt,"")) rotated_text=atoi(rot_txt); /* 20171208 */
|
||||
|
||||
my_strdup(7, &type,(inst_ptr[selectedgroup[j].n].ptr+instdef)->type); /* 20150409 */
|
||||
if( type && (strcmp(type,"label") && strcmp(type,"ipin")&&strcmp(type,"opin")&&strcmp(type,"iopin") )==0) {
|
||||
if( type && IS_LABEL_OR_PIN(type) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -947,8 +947,7 @@ int place_symbol(int pos, const char *symbol_name, double x, double y, int rot,
|
|||
my_strdup2(13, &inst_ptr[n].instname, get_tok_value(inst_ptr[n].prop_ptr,"name",0) ); /* 20150409 */
|
||||
|
||||
type = instdef[inst_ptr[n].ptr].type; /* 20150409 */
|
||||
cond= !type || (strcmp(type,"label") && strcmp(type,"ipin") && strcmp(type,"show_label") &&
|
||||
strcmp(type,"opin") && strcmp(type,"iopin"));
|
||||
cond= !type || !IS_LABEL_SH_OR_PIN(type);
|
||||
if(cond) inst_ptr[n].flags|=2;
|
||||
else inst_ptr[n].flags &=~2;
|
||||
|
||||
|
|
@ -1420,7 +1419,7 @@ void calc_drawing_bbox(Box *boundbox, int selected)
|
|||
}
|
||||
}
|
||||
}
|
||||
else if( type && !(strcmp(type,"label") && strcmp(type,"ipin") && strcmp(type,"iopin") && strcmp(type,"opin") )) {
|
||||
else if( type && IS_LABEL_OR_PIN(type)) {
|
||||
entry=bus_hilight_lookup( get_tok_value(inst_ptr[i].prop_ptr,"lab",0) , 0, XLOOKUP );
|
||||
if(entry) found = 1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -525,7 +525,7 @@ int callback(int event, int mx, int my, KeySym key,
|
|||
j = selectedgroup[k].n ;
|
||||
/* my_strdup(22, &type,get_tok_value((inst_ptr[j].ptr+instdef)->prop_ptr,"type",0)); */
|
||||
my_strdup(23, &type,(inst_ptr[j].ptr+instdef)->type); /* 20150409 */
|
||||
if( type && (strcmp(type,"label") && strcmp(type,"ipin")&&strcmp(type,"opin")&&strcmp(type,"iopin") )==0) break;
|
||||
if( type && IS_LABEL_SH_OR_PIN(type)) break;
|
||||
symbol = instdef + inst_ptr[j].ptr;
|
||||
npin = symbol->rects[PINLAYER];
|
||||
rect=symbol->boxptr[PINLAYER];
|
||||
|
|
|
|||
18
src/draw.c
18
src/draw.c
|
|
@ -1628,15 +1628,11 @@ void draw(void)
|
|||
type &&
|
||||
(
|
||||
(
|
||||
!(strcmp(type,"label") && strcmp(type,"ipin") && strcmp(type,"show_label") &&
|
||||
strcmp(type,"iopin") && strcmp(type,"opin")) &&
|
||||
inst_ptr[i].node && inst_ptr[i].node[0] &&
|
||||
IS_LABEL_SH_OR_PIN(type) && inst_ptr[i].node && inst_ptr[i].node[0] &&
|
||||
bus_hilight_lookup(inst_ptr[i].node[0], 0, XLOOKUP )
|
||||
) ||
|
||||
(
|
||||
(strcmp(type,"label") && strcmp(type,"ipin") && strcmp(type,"show_label") &&
|
||||
strcmp(type,"iopin") && strcmp(type,"opin")) &&
|
||||
(inst_ptr[i].flags & 4)
|
||||
!IS_LABEL_SH_OR_PIN(type) && (inst_ptr[i].flags & 4)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
|
@ -1666,15 +1662,11 @@ void draw(void)
|
|||
type &&
|
||||
(
|
||||
(
|
||||
!(strcmp(type,"label") && strcmp(type,"ipin") && strcmp(type,"show_label") &&
|
||||
strcmp(type,"iopin") && strcmp(type,"opin")) &&
|
||||
inst_ptr[i].node && inst_ptr[i].node[0] &&
|
||||
bus_hilight_lookup(inst_ptr[i].node[0], 0, XLOOKUP )
|
||||
IS_LABEL_SH_OR_PIN(type) && inst_ptr[i].node && inst_ptr[i].node[0] &&
|
||||
bus_hilight_lookup(inst_ptr[i].node[0], 0, XLOOKUP )
|
||||
) ||
|
||||
(
|
||||
(strcmp(type,"label") && strcmp(type,"ipin") && strcmp(type,"show_label") &&
|
||||
strcmp(type,"iopin") && strcmp(type,"opin")) &&
|
||||
(inst_ptr[i].flags & 4)
|
||||
!IS_LABEL_SH_OR_PIN(type) && (inst_ptr[i].flags & 4)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
|
|
|||
|
|
@ -1073,8 +1073,7 @@ void update_symbol(const char *result, int x)
|
|||
new_prop_string(i, ptr, k, disable_unique_names); /* set new prop_ptr */
|
||||
|
||||
type=instdef[inst_ptr[i].ptr].type; /* 20150409 */
|
||||
cond= !type || (strcmp(type,"label") && strcmp(type,"ipin") && strcmp(type,"show_label") &&
|
||||
strcmp(type,"opin") && strcmp(type,"iopin"));
|
||||
cond= !type || !IS_LABEL_SH_OR_PIN(type);
|
||||
if(cond) inst_ptr[i].flags|=2; /* bit 1: flag for different textlayer for pin/labels */
|
||||
else inst_ptr[i].flags &=~2;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -124,10 +124,7 @@ void find_closest_net_or_symbol_pin(double mx,double my, double *x, double *y)
|
|||
if(!type) continue;
|
||||
|
||||
no_of_pin_rects = (inst_ptr[i].ptr+instdef)->rects[PINLAYER];
|
||||
if( !strcmp(type, "label") ) no_of_pin_rects=1;
|
||||
if( !strcmp(type, "ipin") ) no_of_pin_rects=1;
|
||||
if( !strcmp(type, "opin") ) no_of_pin_rects=1;
|
||||
if( !strcmp(type, "iopin") ) no_of_pin_rects=1;
|
||||
if(IS_LABEL_OR_PIN(type)) no_of_pin_rects=1;
|
||||
for(j=0; j<no_of_pin_rects; j++) {
|
||||
box = ((inst_ptr[i].ptr+instdef)->boxptr[PINLAYER])[j];
|
||||
ROTATION(0.0,0.0,box.x1,box.y1,x1,y1);
|
||||
|
|
|
|||
|
|
@ -474,10 +474,7 @@ int search(const char *tok, const char *val, int sub, int sel, int what)
|
|||
{
|
||||
if(!sel) { /*20190525 */
|
||||
type = (inst_ptr[i].ptr+instdef)->type;
|
||||
if( type &&
|
||||
!(strcmp(type,"label") && strcmp(type,"ipin") && strcmp(type,"show_label") &&
|
||||
strcmp(type,"iopin") && strcmp(type,"opin"))
|
||||
) {
|
||||
if( type && IS_LABEL_SH_OR_PIN(type) ) {
|
||||
if(!bus_hilight_lookup(inst_ptr[i].node[0], col, XINSERT)) hilight_nets = 1;
|
||||
if(what==NOW) for(c=0;c<cadlayers;c++)
|
||||
draw_symbol(NOW, hilight_layer, i,c,0,0,0.0,0.0);
|
||||
|
|
@ -742,12 +739,7 @@ void hilight_net(int to_waveform)
|
|||
break;
|
||||
case ELEMENT:
|
||||
type = (inst_ptr[n].ptr+instdef)->type;
|
||||
if( type &&
|
||||
inst_ptr[n].node && /* instance must have a pin! */
|
||||
!(strcmp(type,"label") && strcmp(type,"ipin") && strcmp(type,"show_label") &&
|
||||
strcmp(type,"iopin") && strcmp(type,"opin") )
|
||||
)
|
||||
{
|
||||
if( type && inst_ptr[n].node && IS_LABEL_SH_OR_PIN(type) ) { /* instance must have a pin! */
|
||||
if(event_reporting) {
|
||||
char s[PATH_MAX];
|
||||
printf("xschem search exact %d lab %s\n", 0, escape_chars(s, inst_ptr[n].node[0], PATH_MAX));
|
||||
|
|
@ -806,11 +798,7 @@ void unhilight_net(void)
|
|||
case ELEMENT:
|
||||
type = (inst_ptr[n].ptr+instdef)->type;
|
||||
if( type &&
|
||||
inst_ptr[n].node && /* instance must have a pin! */
|
||||
!(strcmp(type,"label") && strcmp(type,"ipin") && strcmp(type,"show_label") &&
|
||||
strcmp(type,"iopin") && strcmp(type,"opin") )
|
||||
)
|
||||
{
|
||||
inst_ptr[n].node && IS_LABEL_SH_OR_PIN(type) ) { /* instance must have a pin! */
|
||||
if(event_reporting) {
|
||||
printf("xschem unhilight\n");
|
||||
fflush(stdout);
|
||||
|
|
@ -941,11 +929,7 @@ void draw_hilight_net(int on_window)
|
|||
}
|
||||
}
|
||||
}
|
||||
} else if( type &&
|
||||
!(strcmp(type,"label") && strcmp(type,"ipin") && strcmp(type,"show_label") &&
|
||||
strcmp(type,"iopin") && strcmp(type,"opin") )
|
||||
)
|
||||
{
|
||||
} else if( type && IS_LABEL_SH_OR_PIN(type) ) {
|
||||
entry=bus_hilight_lookup( get_tok_value(inst_ptr[i].prop_ptr,"lab",0) , 0, XLOOKUP);
|
||||
if(entry) inst_color[i]=get_color(entry->value);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -662,11 +662,7 @@ void prepare_netlist_structs(int for_netlist)
|
|||
if (inst_ptr[i].ptr<0) continue;
|
||||
|
||||
my_strdup(248, &type,(inst_ptr[i].ptr+instdef)->type); /* 20150409 */
|
||||
if (type &&
|
||||
inst_ptr[i].node && /* instance must have a pin! */
|
||||
!(strcmp(type,"label") && strcmp(type,"ipin") &&
|
||||
strcmp(type,"iopin") && strcmp(type,"opin")))
|
||||
{
|
||||
if(type && inst_ptr[i].node && IS_LABEL_OR_PIN(type) ) { /* instance must have a pin! */
|
||||
if (for_netlist>0) {
|
||||
/* 20150918 skip labels / pins if ignore property specified on instance */
|
||||
if( netlist_type == CAD_VERILOG_NETLIST &&
|
||||
|
|
@ -789,12 +785,7 @@ void prepare_netlist_structs(int for_netlist)
|
|||
if(for_netlist) for (i=0;i<lastinst;i++) { /* ... assign node fields on all (non label) instances */
|
||||
if (inst_ptr[i].ptr<0) continue;
|
||||
my_strdup(267, &type,(inst_ptr[i].ptr+instdef)->type); /* 20150409 */
|
||||
if (type &&
|
||||
strcmp(type,"label") &&
|
||||
strcmp(type,"ipin") &&
|
||||
strcmp(type,"opin") &&
|
||||
strcmp(type,"iopin"))
|
||||
{
|
||||
if (type && !IS_LABEL_OR_PIN(type) ) {
|
||||
if ((generic_rects = (inst_ptr[i].ptr+instdef)->rects[GENERICLAYER]) > 0)
|
||||
{
|
||||
rects = (inst_ptr[i].ptr+instdef)->rects[PINLAYER];
|
||||
|
|
@ -865,12 +856,7 @@ void prepare_netlist_structs(int for_netlist)
|
|||
if(inst_ptr[i].ptr<0) continue;
|
||||
expandlabel(inst_ptr[i].instname, &inst_mult); /* 20171210 */
|
||||
my_strdup(272, &type,(inst_ptr[i].ptr+instdef)->type); /* 20150409 */
|
||||
if (type &&
|
||||
strcmp(type,"label") &&
|
||||
strcmp(type,"ipin") &&
|
||||
strcmp(type,"opin") &&
|
||||
strcmp(type,"iopin"))
|
||||
{
|
||||
if (type && !IS_LABEL_OR_PIN(type) ) {
|
||||
if ((rects = (inst_ptr[i].ptr+instdef)->rects[PINLAYER]) > 0)
|
||||
{
|
||||
for (j=0;j<rects;j++)
|
||||
|
|
@ -1120,7 +1106,7 @@ int sym_vs_sch_pins()
|
|||
load_ascii_string(&tmp,fd);
|
||||
symbol = match_symbol(name);
|
||||
my_strdup(276, &type, instdef[symbol].type);
|
||||
if(type && (!strcmp(type, "ipin") || !strcmp(type, "opin") || !strcmp(type, "iopin"))) {
|
||||
if(type && IS_PIN(type)) {
|
||||
my_strdup(292, &lab, get_tok_value(tmp, "lab", 0));
|
||||
if(pin_cnt >= lab_array_size) {
|
||||
lab_array_size += CADCHUNKALLOC;
|
||||
|
|
|
|||
|
|
@ -270,10 +270,8 @@ void match_merged_inst(int old)
|
|||
select_element(i,SELECTED,1, 0);
|
||||
symbol_bbox(i, &inst_ptr[i].x1, &inst_ptr[i].y1,
|
||||
&inst_ptr[i].x2, &inst_ptr[i].y2);
|
||||
/* type=get_tok_value(instdef[inst_ptr[i].ptr].prop_ptr,"type",0); */
|
||||
type=instdef[inst_ptr[i].ptr].type; /* 20150409 */
|
||||
cond= !type || (strcmp(type,"label") && strcmp(type,"ipin") && strcmp(type,"show_label") &&
|
||||
strcmp(type,"opin") && strcmp(type,"iopin"));
|
||||
type=instdef[inst_ptr[i].ptr].type;
|
||||
cond= !type || !IS_LABEL_SH_OR_PIN(type);
|
||||
if(cond) inst_ptr[i].flags|=2;
|
||||
else inst_ptr[i].flags &=~2;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -947,10 +947,9 @@ void link_symbols_to_instances(void) /* 20150326 separated from load_schematic()
|
|||
symbol_bbox(i, &inst_ptr[i].x1, &inst_ptr[i].y1,
|
||||
&inst_ptr[i].x2, &inst_ptr[i].y2);
|
||||
type=instdef[inst_ptr[i].ptr].type;
|
||||
cond= !type || (strcmp(type,"label") && strcmp(type,"ipin") && strcmp(type,"show_label") &&
|
||||
strcmp(type,"opin") && strcmp(type,"iopin"));
|
||||
if(cond) inst_ptr[i].flags|=2;
|
||||
else inst_ptr[i].flags &=~2;
|
||||
cond= !type || !IS_LABEL_SH_OR_PIN(type);
|
||||
if(cond) inst_ptr[i].flags|=2; /* ordinary symbol */
|
||||
else inst_ptr[i].flags &=~2; /* label or pin */
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1913,7 +1912,7 @@ int load_sym_def(const char *name, FILE *embed_fd)
|
|||
!strcmp(symtype, "timescale")
|
||||
) break;
|
||||
/* add PINLAYER boxes (symbol pins) at schematic i/o/iopin coordinates. */
|
||||
if (level==0 && (!strcmp(symtype, "ipin") || !strcmp(symtype, "opin") || !strcmp(symtype, "iopin"))) {
|
||||
if( level==0 && IS_PIN(symtype) ) {
|
||||
add_pinlayer_boxes(lastr, bb, symtype, prop_ptr, inst_x0, inst_y0);
|
||||
}
|
||||
/* build symbol filename to be loaded */
|
||||
|
|
|
|||
|
|
@ -583,8 +583,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
my_strdup2(372, &inst_ptr[inst].instname, get_tok_value(inst_ptr[inst].prop_ptr, "name",0));
|
||||
|
||||
type=instdef[inst_ptr[inst].ptr].type; /* 20150409 */
|
||||
cond= !type || (strcmp(type,"label") && strcmp(type,"ipin") && strcmp(type,"show_label") &&
|
||||
strcmp(type,"opin") && strcmp(type,"iopin"));
|
||||
cond= !type || !IS_LABEL_SH_OR_PIN(type);
|
||||
if(cond) inst_ptr[inst].flags|=2;
|
||||
else inst_ptr[inst].flags &=~2;
|
||||
my_free(922, &ptr);
|
||||
|
|
|
|||
|
|
@ -97,8 +97,7 @@ void global_spice_netlist(int global) /* netlister driver */
|
|||
if( type && !strcmp(type,"netlist_options") ) {
|
||||
continue;
|
||||
}
|
||||
if( type && !(strcmp(type,"ipin")&&strcmp(type,"opin")&&strcmp(type,"iopin")) )
|
||||
{
|
||||
if( type && IS_PIN(type)) {
|
||||
str_tmp = expandlabel ( get_tok_value(inst_ptr[i].prop_ptr,"lab",0) ,&mult);
|
||||
dbg(1, "global_spice_netlist(): |%s|\n",
|
||||
get_tok_value(inst_ptr[i].prop_ptr,"lab",0));
|
||||
|
|
@ -374,8 +373,7 @@ void spice_netlist(FILE *fd, int spice_stop )
|
|||
continue;
|
||||
}
|
||||
my_strdup(388, &type,(inst_ptr[i].ptr+instdef)->type); /* 20150409 */
|
||||
if( type && (/*strcmp(type,"label") && */ strcmp(type,"ipin")&&strcmp(type,"opin")&&strcmp(type,"iopin") )==0)
|
||||
{
|
||||
if( type && IS_PIN(type) ) {
|
||||
print_spice_element(fd, i) ; /* this is the element line */
|
||||
}
|
||||
}
|
||||
|
|
@ -389,8 +387,7 @@ void spice_netlist(FILE *fd, int spice_stop )
|
|||
} /*20070726 */
|
||||
|
||||
my_strdup(390, &type,(inst_ptr[i].ptr+instdef)->type); /* 20150409 */
|
||||
if( type && (strcmp(type,"label")&&strcmp(type,"ipin")&& strcmp(type,"opin")&&strcmp(type,"iopin")))
|
||||
{
|
||||
if( type && !IS_LABEL_OR_PIN(type) ) {
|
||||
if(!strcmp(type,"netlist_commands") && netlist_count==0) continue; /* already done in global_spice_netlist */
|
||||
if(netlist_count &&
|
||||
!strcmp(get_tok_value(inst_ptr[i].prop_ptr, "only_toplevel", 0), "true")) continue; /* 20160418 */
|
||||
|
|
|
|||
|
|
@ -195,8 +195,7 @@ void tedax_netlist(FILE *fd, int tedax_stop )
|
|||
continue;
|
||||
}
|
||||
my_strdup(421, &type,(inst_ptr[i].ptr+instdef)->type); /* 20150409 */
|
||||
if( type && (/*strcmp(type,"label") && */ strcmp(type,"ipin")&&strcmp(type,"opin")&&strcmp(type,"iopin") )==0)
|
||||
{
|
||||
if( type && IS_PIN(type) ) {
|
||||
print_tedax_element(fd, i) ; /* this is the element line */
|
||||
}
|
||||
}
|
||||
|
|
@ -208,8 +207,7 @@ void tedax_netlist(FILE *fd, int tedax_stop )
|
|||
continue; /*20070726 */
|
||||
} /*20070726 */
|
||||
my_strdup(423, &type,(inst_ptr[i].ptr+instdef)->type); /* 20150409 */
|
||||
if( type && (/* strcmp(type,"label")&& */ strcmp(type,"ipin")&& strcmp(type,"opin")&&strcmp(type,"iopin")))
|
||||
{
|
||||
if( type && !IS_PIN(type) ) {
|
||||
if(!strcmp(type,"netlist_commands") && netlist_count==0) continue; /* already done in global_tedax_netlist */
|
||||
if(netlist_count &&
|
||||
!strcmp(get_tok_value(inst_ptr[i].prop_ptr, "only_toplevel", 0), "true")) continue; /* 20160418 */
|
||||
|
|
|
|||
|
|
@ -521,10 +521,7 @@ void verilog_netlist(FILE *fd , int verilog_stop)
|
|||
dbg(2, "verilog_netlist(): into the netlisting loop\n");
|
||||
my_strdup(570, &type,(inst_ptr[i].ptr+instdef)->type);
|
||||
if( type &&
|
||||
( strcmp(type,"label")&&
|
||||
strcmp(type,"ipin")&&
|
||||
strcmp(type,"opin")&&
|
||||
strcmp(type,"iopin")&&
|
||||
( !IS_LABEL_OR_PIN(type) &&
|
||||
strcmp(type,"netlist_commands")&& /* 20180124 */
|
||||
strcmp(type,"timescale")&&
|
||||
strcmp(type,"verilog_preprocessor")
|
||||
|
|
|
|||
|
|
@ -661,11 +661,8 @@ void vhdl_netlist(FILE *fd , int vhdl_stop)
|
|||
dbg(2, "vhdl_netlist(): into the netlisting loop\n");
|
||||
my_strdup(603, &type,(inst_ptr[i].ptr+instdef)->type);
|
||||
if( type &&
|
||||
( strcmp(type,"label")&&
|
||||
strcmp(type,"ipin")&&
|
||||
( !IS_LABEL_OR_PIN(type) &&
|
||||
strcmp(type,"generic")&&
|
||||
strcmp(type,"opin")&&
|
||||
strcmp(type,"iopin")&&
|
||||
strcmp(type,"use")&&
|
||||
strcmp(type,"netlist_commands")&& /* 20180124 */
|
||||
strcmp(type,"package") &&
|
||||
|
|
|
|||
305
src/xinit.c
305
src/xinit.c
|
|
@ -191,135 +191,6 @@ void windowid()
|
|||
Tcl_SetResult(interp,"",TCL_STATIC);
|
||||
}
|
||||
|
||||
void free_xschem_data()
|
||||
{
|
||||
int i;
|
||||
my_free(1098, &wire);
|
||||
my_free(1100, &textelement);
|
||||
for(i=0;i<cadlayers;i++) {
|
||||
my_free(1103, &rect[i]);
|
||||
my_free(1104, &line[i]);
|
||||
my_free(1105, &polygon[i]);
|
||||
my_free(1106, &arc[i]);
|
||||
}
|
||||
my_free(1107, &inst_ptr);
|
||||
for(i=0;i<max_symbols;i++) {
|
||||
my_free(1109, &instdef[i].lineptr);
|
||||
my_free(1110, &instdef[i].boxptr);
|
||||
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(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(1124, &lastrect);
|
||||
my_free(1127, &lastpolygon); /* 20171115 */
|
||||
my_free(1128, &lastarc); /* 20171115 */
|
||||
my_free(1129, &lastline);
|
||||
my_free(1130, &max_rects);
|
||||
my_free(1131, &max_polygons); /* 20171115 */
|
||||
my_free(1132, &max_arcs); /* 20171115 */
|
||||
my_free(1133, &max_lines);
|
||||
}
|
||||
|
||||
void xwin_exit(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
if(!init_done) {
|
||||
dbg(1, "xwin_exit() double call, doing nothing...\n");
|
||||
return; /* 20150409 */
|
||||
}
|
||||
delete_netlist_structs();
|
||||
delete_hilight_net();
|
||||
get_unnamed_node(0, 0, 0);
|
||||
|
||||
if(has_x) {
|
||||
#ifdef HAS_CAIRO /* 20171105 */
|
||||
cairo_destroy(ctx);
|
||||
cairo_destroy(save_ctx);
|
||||
cairo_surface_destroy(sfc);
|
||||
cairo_surface_destroy(save_sfc);
|
||||
#endif
|
||||
#ifdef __unix__
|
||||
XFreePixmap(display,save_pixmap);
|
||||
for(i=0;i<cadlayers;i++)XFreePixmap(display,pixmap[i]);
|
||||
#else
|
||||
Tk_FreePixmap(display, save_pixmap);
|
||||
for (i = 0; i < cadlayers; i++)Tk_FreePixmap(display, pixmap[i]);
|
||||
#endif
|
||||
dbg(1, "xwin_exit(): Releasing pixmaps\n");
|
||||
for(i=0;i<cadlayers;i++)
|
||||
{
|
||||
XFreeGC(display,gc[i]);
|
||||
XFreeGC(display,gcstipple[i]);
|
||||
}
|
||||
XFreeGC(display,gctiled);
|
||||
dbg(1, "xwin_exit(): destroying tk windows and releasing X11 stuff\n");
|
||||
Tk_DestroyWindow(mainwindow);
|
||||
#ifdef __unix__
|
||||
if(cad_icon_pixmap) XFreePixmap(display, cad_icon_pixmap);
|
||||
#else
|
||||
if (cad_icon_pixmap) Tk_FreePixmap(display, cad_icon_pixmap);
|
||||
#endif
|
||||
}
|
||||
dbg(1, "xwin_exit(): clearing drawing data structures\n");
|
||||
clear_drawing();
|
||||
remove_symbols();
|
||||
|
||||
free_xschem_data();
|
||||
|
||||
/* global context - graphic preferences/settings */
|
||||
for(i=0;i<cadlayers;i++) {
|
||||
my_free(1101, &color_array[i]);
|
||||
my_free(1102, &pixdata[i]);
|
||||
}
|
||||
my_free(1108, &selectedgroup);
|
||||
my_free(1120, &fill_type);
|
||||
my_free(1121, &active_layer);
|
||||
my_free(1122, &pixdata);
|
||||
my_free(1123, &enable_layer);
|
||||
my_free(1099, &gridpoint);
|
||||
my_free(1134, &pixmap);
|
||||
my_free(1135, &gc);
|
||||
my_free(1136, &gcstipple);
|
||||
my_free(1137, &color_array);
|
||||
my_free(1138, &tcl_command);
|
||||
clear_expandlabel_data();
|
||||
get_sym_template(NULL, NULL); /* clear static data in function */
|
||||
get_tok_value(NULL, NULL, 0); /* clear static data in function */
|
||||
list_tokens(NULL, 0); /* clear static data in function */
|
||||
translate(0, NULL); /* clear static data in function */
|
||||
translate2(NULL, 0, NULL); /* clear static data in function */
|
||||
subst_token(NULL, NULL, NULL); /* clear static data in function */
|
||||
find_nth(NULL, '\0', 0); /* clear static data in function */
|
||||
|
||||
for(i=0;i<CADMAXHIER;i++) my_free(1139, &sch_path[i]);
|
||||
|
||||
dbg(1, "xwin_exit(): removing font\n");
|
||||
for(i=0;i<127;i++) my_free(1140, &character[i]);
|
||||
|
||||
dbg(1, "xwin_exit(): closed display\n");
|
||||
my_free(1141, &filename);
|
||||
|
||||
delete_undo(); /* 20150327 */
|
||||
my_free(1142, &netlist_dir);
|
||||
my_free(1143, &xschem_executable);
|
||||
record_global_node(2, NULL, NULL); /* delete global node array */
|
||||
dbg(1, "xwin_exit(): deleted undo buffer\n");
|
||||
if(errfp!=stderr) fclose(errfp);
|
||||
errfp=stderr;
|
||||
printf("\n");
|
||||
init_done=0; /* 20150409 to avoid multiple calls */
|
||||
}
|
||||
|
||||
|
||||
int err(Display *display, XErrorEvent *xev)
|
||||
{
|
||||
char s[1024]; /* overflow safe 20161122 */
|
||||
|
|
@ -456,6 +327,42 @@ void init_pixdata()
|
|||
}
|
||||
}
|
||||
|
||||
void free_xschem_data()
|
||||
{
|
||||
int i;
|
||||
my_free(1098, &wire);
|
||||
my_free(1100, &textelement);
|
||||
for(i=0;i<cadlayers;i++) {
|
||||
my_free(1103, &rect[i]);
|
||||
my_free(1104, &line[i]);
|
||||
my_free(1105, &polygon[i]);
|
||||
my_free(1106, &arc[i]);
|
||||
}
|
||||
my_free(1107, &inst_ptr);
|
||||
for(i=0;i<max_symbols;i++) {
|
||||
my_free(1109, &instdef[i].lineptr);
|
||||
my_free(1110, &instdef[i].boxptr);
|
||||
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(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(1124, &lastrect);
|
||||
my_free(1127, &lastpolygon); /* 20171115 */
|
||||
my_free(1128, &lastarc); /* 20171115 */
|
||||
my_free(1129, &lastline);
|
||||
my_free(1130, &max_rects);
|
||||
my_free(1131, &max_polygons); /* 20171115 */
|
||||
my_free(1132, &max_arcs); /* 20171115 */
|
||||
my_free(1133, &max_lines);
|
||||
}
|
||||
|
||||
void alloc_xschem_data()
|
||||
{
|
||||
|
|
@ -616,6 +523,56 @@ void alloc_xschem_data()
|
|||
}
|
||||
}
|
||||
|
||||
void save_xschem_data(int what)
|
||||
{
|
||||
static Xschem_ctx xc;
|
||||
|
||||
if(what == 1) {
|
||||
xc.wire = wire;
|
||||
xc.textelement = textelement;
|
||||
xc.rect = rect;
|
||||
xc.line = line;
|
||||
xc.polygon = polygon;
|
||||
xc.arc = arc;
|
||||
xc.inst_ptr = inst_ptr;
|
||||
xc.instdef = instdef;
|
||||
xc.lastwire = lastwire;
|
||||
xc.lastinst = lastinst;
|
||||
xc.lastinstdef = lastinstdef;
|
||||
xc.lasttext = lasttext;
|
||||
xc.lastrect = lastrect;
|
||||
xc.lastpolygon = lastpolygon;
|
||||
xc.lastarc = lastarc;
|
||||
xc.lastline = lastline;
|
||||
xc.max_rects = max_rects;
|
||||
xc.max_polygons = max_polygons;
|
||||
xc.max_arcs = max_arcs;
|
||||
xc.max_lines = max_lines;
|
||||
}
|
||||
else if(what == 2) {
|
||||
wire = xc.wire;
|
||||
textelement = xc.textelement;
|
||||
rect = xc.rect;
|
||||
line = xc.line;
|
||||
polygon = xc.polygon;
|
||||
arc = xc.arc;
|
||||
inst_ptr = xc.inst_ptr;
|
||||
instdef = xc.instdef;
|
||||
lastwire = xc.lastwire;
|
||||
lastinst = xc.lastinst;
|
||||
lastinstdef = xc.lastinstdef;
|
||||
lasttext = xc.lasttext;
|
||||
lastrect = xc.lastrect;
|
||||
lastpolygon = xc.lastpolygon;
|
||||
lastarc = xc.lastarc;
|
||||
lastline = xc.lastline;
|
||||
max_rects = xc.max_rects;
|
||||
max_polygons = xc.max_polygons;
|
||||
max_arcs = xc.max_arcs;
|
||||
max_lines = xc.max_lines;
|
||||
}
|
||||
}
|
||||
|
||||
void alloc_data()
|
||||
{
|
||||
int i;
|
||||
|
|
@ -679,6 +636,96 @@ void alloc_data()
|
|||
enable_layer=my_calloc(87, cadlayers, sizeof(int));
|
||||
}
|
||||
|
||||
void xwin_exit(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
if(!init_done) {
|
||||
dbg(1, "xwin_exit() double call, doing nothing...\n");
|
||||
return; /* 20150409 */
|
||||
}
|
||||
delete_netlist_structs();
|
||||
delete_hilight_net();
|
||||
get_unnamed_node(0, 0, 0);
|
||||
|
||||
if(has_x) {
|
||||
#ifdef HAS_CAIRO /* 20171105 */
|
||||
cairo_destroy(ctx);
|
||||
cairo_destroy(save_ctx);
|
||||
cairo_surface_destroy(sfc);
|
||||
cairo_surface_destroy(save_sfc);
|
||||
#endif
|
||||
#ifdef __unix__
|
||||
XFreePixmap(display,save_pixmap);
|
||||
for(i=0;i<cadlayers;i++)XFreePixmap(display,pixmap[i]);
|
||||
#else
|
||||
Tk_FreePixmap(display, save_pixmap);
|
||||
for (i = 0; i < cadlayers; i++)Tk_FreePixmap(display, pixmap[i]);
|
||||
#endif
|
||||
dbg(1, "xwin_exit(): Releasing pixmaps\n");
|
||||
for(i=0;i<cadlayers;i++)
|
||||
{
|
||||
XFreeGC(display,gc[i]);
|
||||
XFreeGC(display,gcstipple[i]);
|
||||
}
|
||||
XFreeGC(display,gctiled);
|
||||
dbg(1, "xwin_exit(): destroying tk windows and releasing X11 stuff\n");
|
||||
Tk_DestroyWindow(mainwindow);
|
||||
#ifdef __unix__
|
||||
if(cad_icon_pixmap) XFreePixmap(display, cad_icon_pixmap);
|
||||
#else
|
||||
if (cad_icon_pixmap) Tk_FreePixmap(display, cad_icon_pixmap);
|
||||
#endif
|
||||
}
|
||||
dbg(1, "xwin_exit(): clearing drawing data structures\n");
|
||||
clear_drawing();
|
||||
remove_symbols();
|
||||
|
||||
free_xschem_data();
|
||||
|
||||
/* global context - graphic preferences/settings */
|
||||
for(i=0;i<cadlayers;i++) {
|
||||
my_free(1101, &color_array[i]);
|
||||
my_free(1102, &pixdata[i]);
|
||||
}
|
||||
my_free(1108, &selectedgroup);
|
||||
my_free(1120, &fill_type);
|
||||
my_free(1121, &active_layer);
|
||||
my_free(1122, &pixdata);
|
||||
my_free(1123, &enable_layer);
|
||||
my_free(1099, &gridpoint);
|
||||
my_free(1134, &pixmap);
|
||||
my_free(1135, &gc);
|
||||
my_free(1136, &gcstipple);
|
||||
my_free(1137, &color_array);
|
||||
my_free(1138, &tcl_command);
|
||||
clear_expandlabel_data();
|
||||
get_sym_template(NULL, NULL); /* clear static data in function */
|
||||
get_tok_value(NULL, NULL, 0); /* clear static data in function */
|
||||
list_tokens(NULL, 0); /* clear static data in function */
|
||||
translate(0, NULL); /* clear static data in function */
|
||||
translate2(NULL, 0, NULL); /* clear static data in function */
|
||||
subst_token(NULL, NULL, NULL); /* clear static data in function */
|
||||
find_nth(NULL, '\0', 0); /* clear static data in function */
|
||||
|
||||
for(i=0;i<CADMAXHIER;i++) my_free(1139, &sch_path[i]);
|
||||
|
||||
dbg(1, "xwin_exit(): removing font\n");
|
||||
for(i=0;i<127;i++) my_free(1140, &character[i]);
|
||||
|
||||
dbg(1, "xwin_exit(): closed display\n");
|
||||
my_free(1141, &filename);
|
||||
|
||||
delete_undo(); /* 20150327 */
|
||||
my_free(1142, &netlist_dir);
|
||||
my_free(1143, &xschem_executable);
|
||||
record_global_node(2, NULL, NULL); /* delete global node array */
|
||||
dbg(1, "xwin_exit(): deleted undo buffer\n");
|
||||
if(errfp!=stderr) fclose(errfp);
|
||||
errfp=stderr;
|
||||
printf("\n");
|
||||
init_done=0; /* 20150409 to avoid multiple calls */
|
||||
}
|
||||
|
||||
int build_colors(double dim) /* 20171113 */
|
||||
{
|
||||
|
|
|
|||
29
src/xschem.h
29
src/xschem.h
|
|
@ -288,6 +288,12 @@ extern char win_temp_dir[PATH_MAX];
|
|||
#define MINOR(a,b) ( (a) <= (b) ? (a) : (b) )
|
||||
#define ROUND(a) ((a) > 0.0 ? ceil((a) - 0.5) : floor((a) + 0.5))
|
||||
|
||||
#define IS_LABEL_SH_OR_PIN(type) (!(strcmp(type,"label") && strcmp(type,"ipin") && strcmp(type,"opin") && \
|
||||
strcmp(type,"show_label") && strcmp(type,"iopin")))
|
||||
#define IS_LABEL_OR_PIN(type) (!(strcmp(type,"label") && strcmp(type,"ipin") && strcmp(type,"opin") && strcmp(type,"iopin")))
|
||||
#define IS_PIN(type) (!(strcmp(type,"ipin") && strcmp(type,"opin") && strcmp(type,"iopin")))
|
||||
|
||||
|
||||
#define X_TO_SCREEN(x) ( floor((x+xorigin)* mooz) )
|
||||
#define Y_TO_SCREEN(y) ( floor((y+yorigin)* mooz) )
|
||||
#define X_TO_XSCHEM(x) ((x)*zoom -xorigin)
|
||||
|
|
@ -428,6 +434,29 @@ typedef struct
|
|||
char *instname; /* 20150409 instance name (example: I23) */
|
||||
} Instance;
|
||||
|
||||
typedef struct {
|
||||
Wire *wire;
|
||||
Text *textelement;
|
||||
Box **rect;
|
||||
Line **line;
|
||||
xPolygon **polygon;
|
||||
xArc **arc;
|
||||
Instance *inst_ptr;
|
||||
Instdef *instdef;
|
||||
int lastwire;
|
||||
int lastinst;
|
||||
int lastinstdef;
|
||||
int lasttext;
|
||||
int *lastrect;
|
||||
int *lastpolygon;
|
||||
int *lastarc;
|
||||
int *lastline;
|
||||
int *max_rects;
|
||||
int *max_polygons;
|
||||
int *max_arcs;
|
||||
int *max_lines;
|
||||
} Xschem_ctx;
|
||||
|
||||
struct Lcc { /* used for symbols containing schematics as instances (LCC, Local Custom Cell) */
|
||||
double x0;
|
||||
double y0;
|
||||
|
|
|
|||
Loading…
Reference in New Issue