all xctx context is now a dynamically allocated structure; no observable performace impact
This commit is contained in:
parent
0eb706a67e
commit
e7928727d6
616
src/actions.c
616
src/actions.c
File diff suppressed because it is too large
Load Diff
|
|
@ -140,7 +140,7 @@ int callback(int event, int mx, int my, KeySym key,
|
|||
mousex_snap=ROUND(mousex / cadsnap) * cadsnap;
|
||||
mousey_snap=ROUND(mousey / cadsnap) * cadsnap;
|
||||
my_snprintf(str, S(str), "mouse = %.16g %.16g - selected: %d path: %s",
|
||||
mousex_snap, mousey_snap, lastselected, xctx.sch_path[xctx.currsch] );
|
||||
mousex_snap, mousey_snap, lastselected, xctx->sch_path[xctx->currsch] );
|
||||
statusmsg(str,1);
|
||||
switch(event)
|
||||
{
|
||||
|
|
@ -523,9 +523,9 @@ int callback(int event, int mx, int my, KeySym key,
|
|||
for(k=0; k<lastselected; k++) {
|
||||
if(selectedgroup[k].type!=ELEMENT) continue;
|
||||
j = selectedgroup[k].n ;
|
||||
my_strdup(23, &type,(xctx.inst[j].ptr+ xctx.sym)->type);
|
||||
my_strdup(23, &type,(xctx->inst[j].ptr+ xctx->sym)->type);
|
||||
if( type && IS_LABEL_SH_OR_PIN(type)) break;
|
||||
symbol = xctx.sym + xctx.inst[j].ptr;
|
||||
symbol = xctx->sym + xctx->inst[j].ptr;
|
||||
npin = symbol->rects[PINLAYER];
|
||||
rct=symbol->rect[PINLAYER];
|
||||
dbg(1, "\n");
|
||||
|
|
@ -654,7 +654,7 @@ int callback(int event, int mx, int my, KeySym key,
|
|||
}
|
||||
if(key=='P' && state == ShiftMask) /* pan, other way to. */
|
||||
{
|
||||
xctx.xorigin=-mousex_snap+areaw*xctx.zoom/2.0;xctx.yorigin=-mousey_snap+areah*xctx.zoom/2.0;
|
||||
xctx->xorigin=-mousex_snap+areaw*xctx->zoom/2.0;xctx->yorigin=-mousey_snap+areah*xctx->zoom/2.0;
|
||||
draw();
|
||||
break;
|
||||
}
|
||||
|
|
@ -678,25 +678,25 @@ int callback(int event, int mx, int my, KeySym key,
|
|||
}
|
||||
if(key==XK_Right) /* left */
|
||||
{
|
||||
xctx.xorigin+=-CADMOVESTEP*xctx.zoom;
|
||||
xctx->xorigin+=-CADMOVESTEP*xctx->zoom;
|
||||
draw();
|
||||
break;
|
||||
}
|
||||
if(key==XK_Left) /* right */
|
||||
{
|
||||
xctx.xorigin-=-CADMOVESTEP*xctx.zoom;
|
||||
xctx->xorigin-=-CADMOVESTEP*xctx->zoom;
|
||||
draw();
|
||||
break;
|
||||
}
|
||||
if(key==XK_Down) /* down */
|
||||
{
|
||||
xctx.yorigin+=-CADMOVESTEP*xctx.zoom;
|
||||
xctx->yorigin+=-CADMOVESTEP*xctx->zoom;
|
||||
draw();
|
||||
break;
|
||||
}
|
||||
if(key==XK_Up) /* up */
|
||||
{
|
||||
xctx.yorigin-=-CADMOVESTEP*xctx.zoom;
|
||||
xctx->yorigin-=-CADMOVESTEP*xctx->zoom;
|
||||
draw();
|
||||
break;
|
||||
}
|
||||
|
|
@ -761,7 +761,7 @@ int callback(int event, int mx, int my, KeySym key,
|
|||
{
|
||||
if(semaphore >= 2) break;
|
||||
/* check if unnamed schematic, use saveas in this case */
|
||||
if(!strcmp(xctx.sch[xctx.currsch],"") || strstr(xctx.sch[xctx.currsch], "untitled")) {
|
||||
if(!strcmp(xctx->sch[xctx->currsch],"") || strstr(xctx->sch[xctx->currsch], "untitled")) {
|
||||
saveas(NULL, SCHEMATIC);
|
||||
} else {
|
||||
save(1);
|
||||
|
|
@ -807,7 +807,7 @@ int callback(int event, int mx, int my, KeySym key,
|
|||
tcleval("tk_messageBox -type okcancel -message {do you want to make symbol view ?}");
|
||||
if(strcmp(tclresult(),"ok")==0)
|
||||
{
|
||||
save_schematic(xctx.sch[xctx.currsch]);
|
||||
save_schematic(xctx->sch[xctx->currsch]);
|
||||
make_symbol();
|
||||
}
|
||||
break;
|
||||
|
|
@ -900,12 +900,12 @@ int callback(int event, int mx, int my, KeySym key,
|
|||
if(semaphore >= 2) break;
|
||||
rebuild_selected_array();
|
||||
if(lastselected==0 ) {
|
||||
my_snprintf(str, S(str), "edit_file {%s}", abs_sym_path(xctx.sch[xctx.currsch], ""));
|
||||
my_snprintf(str, S(str), "edit_file {%s}", abs_sym_path(xctx->sch[xctx->currsch], ""));
|
||||
tcleval(str);
|
||||
}
|
||||
else if(selectedgroup[0].type==ELEMENT) {
|
||||
my_snprintf(str, S(str), "edit_file {%s}",
|
||||
abs_sym_path(xctx.inst[selectedgroup[0].n].name, ""));
|
||||
abs_sym_path(xctx->inst[selectedgroup[0].n].name, ""));
|
||||
tcleval(str);
|
||||
|
||||
}
|
||||
|
|
@ -946,7 +946,7 @@ int callback(int event, int mx, int my, KeySym key,
|
|||
char filename[PATH_MAX];
|
||||
unselect_all();
|
||||
remove_symbols();
|
||||
my_strncpy(filename, abs_sym_path(xctx.sch[xctx.currsch], ""), S(filename));
|
||||
my_strncpy(filename, abs_sym_path(xctx->sch[xctx->currsch], ""), S(filename));
|
||||
load_schematic(1, filename, 1);
|
||||
draw();
|
||||
}
|
||||
|
|
@ -1348,10 +1348,10 @@ int callback(int event, int mx, int my, KeySym key,
|
|||
rebuild_selected_array();
|
||||
if(lastselected && selectedgroup[0].type==ELEMENT) {
|
||||
my_snprintf(str, S(str), "delete_files {%s}",
|
||||
abs_sym_path(xctx.inst[selectedgroup[0].n].name, ""));
|
||||
abs_sym_path(xctx->inst[selectedgroup[0].n].name, ""));
|
||||
} else {
|
||||
my_snprintf(str, S(str), "delete_files {%s}",
|
||||
abs_sym_path(xctx.sch[xctx.currsch], ""));
|
||||
abs_sym_path(xctx->sch[xctx->currsch], ""));
|
||||
}
|
||||
|
||||
tcleval(str);
|
||||
|
|
@ -1473,19 +1473,19 @@ int callback(int event, int mx, int my, KeySym key,
|
|||
else if(button==Button4 && state == 0 ) view_zoom(CADZOOMSTEP);
|
||||
|
||||
else if(button==Button4 && (state & ShiftMask) && !(state & Button2Mask)) {
|
||||
xctx.xorigin+=-CADMOVESTEP*xctx.zoom/2.;
|
||||
xctx->xorigin+=-CADMOVESTEP*xctx->zoom/2.;
|
||||
draw();
|
||||
}
|
||||
else if(button==Button5 && (state & ShiftMask) && !(state & Button2Mask)) {
|
||||
xctx.xorigin-=-CADMOVESTEP*xctx.zoom/2.;
|
||||
xctx->xorigin-=-CADMOVESTEP*xctx->zoom/2.;
|
||||
draw();
|
||||
}
|
||||
else if(button==Button4 && (state & ControlMask) && !(state & Button2Mask)) {
|
||||
xctx.yorigin+=-CADMOVESTEP*xctx.zoom/2.;
|
||||
xctx->yorigin+=-CADMOVESTEP*xctx->zoom/2.;
|
||||
draw();
|
||||
}
|
||||
else if(button==Button5 && (state & ControlMask) && !(state & Button2Mask)) {
|
||||
xctx.yorigin-=-CADMOVESTEP*xctx.zoom/2.;
|
||||
xctx->yorigin-=-CADMOVESTEP*xctx->zoom/2.;
|
||||
draw();
|
||||
}
|
||||
else if(button==Button1 && (state & Mod1Mask) ) {
|
||||
|
|
@ -1743,7 +1743,7 @@ int callback(int event, int mx, int my, KeySym key,
|
|||
}
|
||||
rebuild_selected_array();
|
||||
my_snprintf(str, S(str), "mouse = %.16g %.16g - selected: %d path: %s",
|
||||
mousex_snap, mousey_snap, lastselected, xctx.sch_path[xctx.currsch] );
|
||||
mousex_snap, mousey_snap, lastselected, xctx->sch_path[xctx->currsch] );
|
||||
statusmsg(str,1);
|
||||
|
||||
}
|
||||
|
|
@ -1765,7 +1765,7 @@ int callback(int event, int mx, int my, KeySym key,
|
|||
#ifndef __unix__
|
||||
case MOUSE_WHEEL_UP: /* windows do not use button4 and button5 like X */
|
||||
{
|
||||
xctx.xorigin += -CADMOVESTEP * xctx.zoom / 2.;
|
||||
xctx->xorigin += -CADMOVESTEP * xctx->zoom / 2.;
|
||||
draw();
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
299
src/check.c
299
src/check.c
|
|
@ -32,12 +32,12 @@ void check_touch(int i, int j,
|
|||
int touch1=0,touch2=0,touch3=0,touch4=0;
|
||||
double delta1x,delta1y,delta2x,delta2y;
|
||||
double x1,y1,x2,y2;
|
||||
x1=xctx.wire[i].x1;
|
||||
x2=xctx.wire[i].x2;
|
||||
y1=xctx.wire[i].y1;
|
||||
y2=xctx.wire[i].y2;
|
||||
x1=xctx->wire[i].x1;
|
||||
x2=xctx->wire[i].x2;
|
||||
y1=xctx->wire[i].y1;
|
||||
y2=xctx->wire[i].y2;
|
||||
delta1x = x2-x1;delta1y = y1-y2 ;
|
||||
delta2x = xctx.wire[j].x2-xctx.wire[j].x1;delta2y = xctx.wire[j].y1-xctx.wire[j].y2 ;
|
||||
delta2x = xctx->wire[j].x2-xctx->wire[j].x1;delta2y = xctx->wire[j].y1-xctx->wire[j].y2 ;
|
||||
|
||||
*included = 0;
|
||||
*includes = 0;
|
||||
|
|
@ -47,32 +47,32 @@ void check_touch(int i, int j,
|
|||
*parallel = (delta1x*delta2y == delta2x*delta1y ? 1:0);
|
||||
|
||||
/* the order of the following 4 if(touch...) is not don't care !!! */
|
||||
if(touch(xctx.wire[j].x1,xctx.wire[j].y1,xctx.wire[j].x2,xctx.wire[j].y2,x1,y1) )
|
||||
if(touch(xctx->wire[j].x1,xctx->wire[j].y1,xctx->wire[j].x2,xctx->wire[j].y2,x1,y1) )
|
||||
{
|
||||
*touches = 1;touch3 =1;
|
||||
*xt = x1; *yt = y1;
|
||||
if((*xt > xctx.wire[j].x1 && *xt < xctx.wire[j].x2)||
|
||||
(*yt > xctx.wire[j].y1 && *yt < xctx.wire[j].y2)) *breaks = 1;
|
||||
if((*xt > xctx->wire[j].x1 && *xt < xctx->wire[j].x2)||
|
||||
(*yt > xctx->wire[j].y1 && *yt < xctx->wire[j].y2)) *breaks = 1;
|
||||
}
|
||||
if(touch(xctx.wire[j].x1,xctx.wire[j].y1,xctx.wire[j].x2,xctx.wire[j].y2,x2,y2) )
|
||||
if(touch(xctx->wire[j].x1,xctx->wire[j].y1,xctx->wire[j].x2,xctx->wire[j].y2,x2,y2) )
|
||||
{
|
||||
*touches = 1;touch4 =1;
|
||||
*xt = x2; *yt = y2;
|
||||
if((*xt > xctx.wire[j].x1 && *xt < xctx.wire[j].x2)||
|
||||
(*yt > xctx.wire[j].y1 && *yt < xctx.wire[j].y2)) *breaks = 1;
|
||||
if((*xt > xctx->wire[j].x1 && *xt < xctx->wire[j].x2)||
|
||||
(*yt > xctx->wire[j].y1 && *yt < xctx->wire[j].y2)) *breaks = 1;
|
||||
}
|
||||
if(touch3 && touch4) *included = 1;
|
||||
|
||||
if(touch(x1,y1,x2,y2,xctx.wire[j].x1,xctx.wire[j].y1) )
|
||||
if(touch(x1,y1,x2,y2,xctx->wire[j].x1,xctx->wire[j].y1) )
|
||||
{
|
||||
*touches = 1;touch1=1;
|
||||
*xt = xctx.wire[j].x1; *yt = xctx.wire[j].y1;
|
||||
*xt = xctx->wire[j].x1; *yt = xctx->wire[j].y1;
|
||||
if((*xt > x1 && *xt < x2)||(*yt > y1 && *yt < y2)) *broken = 1;
|
||||
}
|
||||
if(touch(x1,y1,x2,y2,xctx.wire[j].x2,xctx.wire[j].y2) )
|
||||
if(touch(x1,y1,x2,y2,xctx->wire[j].x2,xctx->wire[j].y2) )
|
||||
{
|
||||
*touches = 1;touch2=1;
|
||||
*xt = xctx.wire[j].x2; *yt = xctx.wire[j].y2;
|
||||
*xt = xctx->wire[j].x2; *yt = xctx->wire[j].y2;
|
||||
if((*xt > x1 && *xt < x2)||(*yt > y1 && *yt < y2)) *broken = 1;
|
||||
}
|
||||
if(touch1 && touch2) *includes = 1;
|
||||
|
|
@ -87,10 +87,10 @@ void update_conn_cues(int draw_cues, int dr_win)
|
|||
double x1, y1, x2, y2;
|
||||
struct wireentry *wireptr;
|
||||
|
||||
hash_wires(); /* must be done also if xctx.wires==0 to clear wiretable */
|
||||
if(!xctx.wires) return;
|
||||
hash_wires(); /* must be done also if xctx->wires==0 to clear wiretable */
|
||||
if(!xctx->wires) return;
|
||||
if(!draw_dots) return;
|
||||
if(cadhalfdotsize*xctx.mooz<0.7) return;
|
||||
if(cadhalfdotsize*xctx->mooz<0.7) return;
|
||||
x1 = X_TO_XSCHEM(areax1);
|
||||
y1 = Y_TO_XSCHEM(areay1);
|
||||
x2 = X_TO_XSCHEM(areax2);
|
||||
|
|
@ -98,18 +98,18 @@ void update_conn_cues(int draw_cues, int dr_win)
|
|||
for(init_wire_iterator(x1, y1, x2, y2); ( wireptr = wire_iterator_next() ) ;) {
|
||||
k=wireptr->n;
|
||||
/* optimization when editing small areas (detailed zoom) of a huge schematic */
|
||||
if(LINE_OUTSIDE(xctx.wire[k].x1, xctx.wire[k].y1, xctx.wire[k].x2, xctx.wire[k].y2, x1, y1, x2, y2)) continue;
|
||||
if(LINE_OUTSIDE(xctx->wire[k].x1, xctx->wire[k].y1, xctx->wire[k].x2, xctx->wire[k].y2, x1, y1, x2, y2)) continue;
|
||||
for(l = 0;l < 2;l++) {
|
||||
if(l==0 ) {
|
||||
if(xctx.wire[k].end1 !=-1) continue;
|
||||
xctx.wire[k].end1=0;
|
||||
x0 = xctx.wire[k].x1;
|
||||
y0 = xctx.wire[k].y1;
|
||||
if(xctx->wire[k].end1 !=-1) continue;
|
||||
xctx->wire[k].end1=0;
|
||||
x0 = xctx->wire[k].x1;
|
||||
y0 = xctx->wire[k].y1;
|
||||
} else {
|
||||
if(xctx.wire[k].end2 !=-1) continue;
|
||||
xctx.wire[k].end2=0;
|
||||
x0 = xctx.wire[k].x2;
|
||||
y0 = xctx.wire[k].y2;
|
||||
if(xctx->wire[k].end2 !=-1) continue;
|
||||
xctx->wire[k].end2=0;
|
||||
x0 = xctx->wire[k].x2;
|
||||
y0 = xctx->wire[k].y2;
|
||||
}
|
||||
get_square(x0, y0, &sqx, &sqy);
|
||||
for(wptr = wiretable[sqx][sqy] ; wptr ; wptr = wptr->next) {
|
||||
|
|
@ -117,14 +117,14 @@ void update_conn_cues(int draw_cues, int dr_win)
|
|||
if(i == k) {
|
||||
continue; /* no check wire against itself */
|
||||
}
|
||||
if( touch(xctx.wire[i].x1, xctx.wire[i].y1, xctx.wire[i].x2, xctx.wire[i].y2, x0,y0) ) {
|
||||
if( (x0 != xctx.wire[i].x1 && x0 != xctx.wire[i].x2) ||
|
||||
(y0 != xctx.wire[i].y1 && y0 != xctx.wire[i].y2) ) {
|
||||
if(l == 0) xctx.wire[k].end1 += 2;
|
||||
else xctx.wire[k].end2 += 2;
|
||||
if( touch(xctx->wire[i].x1, xctx->wire[i].y1, xctx->wire[i].x2, xctx->wire[i].y2, x0,y0) ) {
|
||||
if( (x0 != xctx->wire[i].x1 && x0 != xctx->wire[i].x2) ||
|
||||
(y0 != xctx->wire[i].y1 && y0 != xctx->wire[i].y2) ) {
|
||||
if(l == 0) xctx->wire[k].end1 += 2;
|
||||
else xctx->wire[k].end2 += 2;
|
||||
} else {
|
||||
if(l == 0) xctx.wire[k].end1 += 1;
|
||||
else xctx.wire[k].end2 += 1;
|
||||
if(l == 0) xctx->wire[k].end1 += 1;
|
||||
else xctx->wire[k].end2 += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -136,12 +136,13 @@ void update_conn_cues(int draw_cues, int dr_win)
|
|||
for(init_wire_iterator(x1, y1, x2, y2); ( wireptr = wire_iterator_next() ) ;) {
|
||||
i = wireptr->n;
|
||||
/* optimization when editing small areas (detailed zoom) of a huge schematic */
|
||||
if(LINE_OUTSIDE(xctx.wire[i].x1, xctx.wire[i].y1, xctx.wire[i].x2, xctx.wire[i].y2, x1, y1, x2, y2)) continue;
|
||||
if( xctx.wire[i].end1 >1 ) { /* 20150331 draw_dots */
|
||||
filledarc(WIRELAYER, ADD, xctx.wire[i].x1, xctx.wire[i].y1, cadhalfdotsize, 0, 360);
|
||||
if(LINE_OUTSIDE(xctx->wire[i].x1, xctx->wire[i].y1,
|
||||
xctx->wire[i].x2, xctx->wire[i].y2, x1, y1, x2, y2)) continue;
|
||||
if( xctx->wire[i].end1 >1 ) { /* 20150331 draw_dots */
|
||||
filledarc(WIRELAYER, ADD, xctx->wire[i].x1, xctx->wire[i].y1, cadhalfdotsize, 0, 360);
|
||||
}
|
||||
if( xctx.wire[i].end2 >1 ) { /* 20150331 draw_dots */
|
||||
filledarc(WIRELAYER, ADD, xctx.wire[i].x2, xctx.wire[i].y2, cadhalfdotsize, 0, 360);
|
||||
if( xctx->wire[i].end2 >1 ) { /* 20150331 draw_dots */
|
||||
filledarc(WIRELAYER, ADD, xctx->wire[i].x2, xctx->wire[i].y2, cadhalfdotsize, 0, 360);
|
||||
}
|
||||
}
|
||||
filledarc(WIRELAYER, END, 0.0, 0.0, 0.0, 0.0, 0.0);
|
||||
|
|
@ -159,11 +160,11 @@ void trim_wires(void)
|
|||
|
||||
do {
|
||||
loops++;
|
||||
for(i=0;i<xctx.wires;i++) xctx.wire[i].end1=xctx.wire[i].end2=0;
|
||||
for(i=0;i<xctx->wires;i++) xctx->wire[i].end1=xctx->wire[i].end2=0;
|
||||
changed=0;
|
||||
for(i=0;i<xctx.wires;i++)
|
||||
for(i=0;i<xctx->wires;i++)
|
||||
{
|
||||
for(j=i+1;j<xctx.wires;j++)
|
||||
for(j=i+1;j<xctx->wires;j++)
|
||||
{
|
||||
check_touch(i,j, ¶llel,&breaks,&broken,&touches,&included,&includes, &xt,&yt);
|
||||
if(included)
|
||||
|
|
@ -186,81 +187,81 @@ void trim_wires(void)
|
|||
{
|
||||
check_wire_storage();
|
||||
changed=1;
|
||||
xctx.wire[xctx.wires].x1=xctx.wire[i].x1;
|
||||
xctx.wire[xctx.wires].y1=xctx.wire[i].y1;
|
||||
xctx.wire[xctx.wires].end1=xctx.wire[i].end1;
|
||||
xctx.wire[xctx.wires].end2=1;
|
||||
xctx.wire[xctx.wires].x2=xt;
|
||||
xctx.wire[xctx.wires].y2=yt;
|
||||
xctx.wire[xctx.wires].sel=0;
|
||||
xctx.wire[xctx.wires].prop_ptr=NULL;
|
||||
my_strdup(27, &xctx.wire[xctx.wires].prop_ptr, xctx.wire[i].prop_ptr);
|
||||
if(!strcmp(get_tok_value(xctx.wire[xctx.wires].prop_ptr,"bus",0), "true"))
|
||||
xctx.wire[xctx.wires].bus=1;
|
||||
xctx->wire[xctx->wires].x1=xctx->wire[i].x1;
|
||||
xctx->wire[xctx->wires].y1=xctx->wire[i].y1;
|
||||
xctx->wire[xctx->wires].end1=xctx->wire[i].end1;
|
||||
xctx->wire[xctx->wires].end2=1;
|
||||
xctx->wire[xctx->wires].x2=xt;
|
||||
xctx->wire[xctx->wires].y2=yt;
|
||||
xctx->wire[xctx->wires].sel=0;
|
||||
xctx->wire[xctx->wires].prop_ptr=NULL;
|
||||
my_strdup(27, &xctx->wire[xctx->wires].prop_ptr, xctx->wire[i].prop_ptr);
|
||||
if(!strcmp(get_tok_value(xctx->wire[xctx->wires].prop_ptr,"bus",0), "true"))
|
||||
xctx->wire[xctx->wires].bus=1;
|
||||
else
|
||||
xctx.wire[xctx.wires].bus=0;
|
||||
xctx.wire[xctx.wires].node=NULL;
|
||||
my_strdup(28, &xctx.wire[xctx.wires].node, xctx.wire[i].node);
|
||||
xctx.wires++;
|
||||
xctx->wire[xctx->wires].bus=0;
|
||||
xctx->wire[xctx->wires].node=NULL;
|
||||
my_strdup(28, &xctx->wire[xctx->wires].node, xctx->wire[i].node);
|
||||
xctx->wires++;
|
||||
|
||||
xctx.wire[i].x1 = xt;
|
||||
xctx.wire[i].y1 = yt;
|
||||
xctx.wire[i].end1 = 1;
|
||||
xctx->wire[i].x1 = xt;
|
||||
xctx->wire[i].y1 = yt;
|
||||
xctx->wire[i].end1 = 1;
|
||||
} /* end if broken */
|
||||
else if(breaks) /*xctx.wire[i] breaks xctx.wire[j] */
|
||||
else if(breaks) /*xctx->wire[i] breaks xctx->wire[j] */
|
||||
{
|
||||
changed=1;
|
||||
if(xctx.wire[i].x1==xt && xctx.wire[i].y1==yt) xctx.wire[i].end1+=1;
|
||||
else if(xctx.wire[i].x2==xt && xctx.wire[i].y2==yt) xctx.wire[i].end2+=1;
|
||||
if(xctx->wire[i].x1==xt && xctx->wire[i].y1==yt) xctx->wire[i].end1+=1;
|
||||
else if(xctx->wire[i].x2==xt && xctx->wire[i].y2==yt) xctx->wire[i].end2+=1;
|
||||
|
||||
check_wire_storage();
|
||||
xctx.wire[xctx.wires].x1=xctx.wire[j].x1;
|
||||
xctx.wire[xctx.wires].y1=xctx.wire[j].y1;
|
||||
xctx.wire[xctx.wires].end1=xctx.wire[j].end1;
|
||||
xctx.wire[xctx.wires].end2=1;
|
||||
xctx.wire[xctx.wires].x2=xt;
|
||||
xctx.wire[xctx.wires].y2=yt;
|
||||
xctx.wire[xctx.wires].sel=0;
|
||||
xctx.wire[xctx.wires].prop_ptr=NULL;
|
||||
my_strdup(29, &xctx.wire[xctx.wires].prop_ptr, xctx.wire[j].prop_ptr);
|
||||
if(!strcmp(get_tok_value(xctx.wire[xctx.wires].prop_ptr,"bus",0), "true"))
|
||||
xctx.wire[xctx.wires].bus=1;
|
||||
xctx->wire[xctx->wires].x1=xctx->wire[j].x1;
|
||||
xctx->wire[xctx->wires].y1=xctx->wire[j].y1;
|
||||
xctx->wire[xctx->wires].end1=xctx->wire[j].end1;
|
||||
xctx->wire[xctx->wires].end2=1;
|
||||
xctx->wire[xctx->wires].x2=xt;
|
||||
xctx->wire[xctx->wires].y2=yt;
|
||||
xctx->wire[xctx->wires].sel=0;
|
||||
xctx->wire[xctx->wires].prop_ptr=NULL;
|
||||
my_strdup(29, &xctx->wire[xctx->wires].prop_ptr, xctx->wire[j].prop_ptr);
|
||||
if(!strcmp(get_tok_value(xctx->wire[xctx->wires].prop_ptr,"bus",0), "true"))
|
||||
xctx->wire[xctx->wires].bus=1;
|
||||
else
|
||||
xctx.wire[xctx.wires].bus=0;
|
||||
xctx.wire[xctx.wires].node=NULL;
|
||||
my_strdup(30, &xctx.wire[xctx.wires].node, xctx.wire[j].node);
|
||||
xctx.wires++;
|
||||
xctx->wire[xctx->wires].bus=0;
|
||||
xctx->wire[xctx->wires].node=NULL;
|
||||
my_strdup(30, &xctx->wire[xctx->wires].node, xctx->wire[j].node);
|
||||
xctx->wires++;
|
||||
|
||||
xctx.wire[j].x1 = xt;
|
||||
xctx.wire[j].y1 = yt;
|
||||
xctx.wire[j].end1 = 1;
|
||||
xctx->wire[j].x1 = xt;
|
||||
xctx->wire[j].y1 = yt;
|
||||
xctx->wire[j].end1 = 1;
|
||||
} /* end else if breaks */
|
||||
else /* xctx.wire[i] touches but does not break xctx.wire[j] */
|
||||
else /* xctx->wire[i] touches but does not break xctx->wire[j] */
|
||||
{
|
||||
if(xctx.wire[i].x1==xctx.wire[j].x1 && xctx.wire[i].y1==xctx.wire[j].y1)
|
||||
{xctx.wire[i].end1++;xctx.wire[j].end1++;}
|
||||
else if(xctx.wire[i].x1==xctx.wire[j].x2 && xctx.wire[i].y1==xctx.wire[j].y2)
|
||||
{xctx.wire[i].end1++;xctx.wire[j].end2++;}
|
||||
else if(xctx.wire[i].x2==xctx.wire[j].x1 && xctx.wire[i].y2==xctx.wire[j].y1)
|
||||
{xctx.wire[i].end2++;xctx.wire[j].end1++;}
|
||||
if(xctx->wire[i].x1==xctx->wire[j].x1 && xctx->wire[i].y1==xctx->wire[j].y1)
|
||||
{xctx->wire[i].end1++;xctx->wire[j].end1++;}
|
||||
else if(xctx->wire[i].x1==xctx->wire[j].x2 && xctx->wire[i].y1==xctx->wire[j].y2)
|
||||
{xctx->wire[i].end1++;xctx->wire[j].end2++;}
|
||||
else if(xctx->wire[i].x2==xctx->wire[j].x1 && xctx->wire[i].y2==xctx->wire[j].y1)
|
||||
{xctx->wire[i].end2++;xctx->wire[j].end1++;}
|
||||
else
|
||||
{xctx.wire[i].end2++;xctx.wire[j].end2++;}
|
||||
{xctx->wire[i].end2++;xctx->wire[j].end2++;}
|
||||
}
|
||||
} /* end if touches */
|
||||
} /* end for j */
|
||||
} /* end for i */
|
||||
for(i=0;i<xctx.wires;i++) {
|
||||
for(j=i+1;j<xctx.wires;j++) {
|
||||
for(i=0;i<xctx->wires;i++) {
|
||||
for(j=i+1;j<xctx->wires;j++) {
|
||||
check_touch(i,j, ¶llel,&breaks,&broken,&touches,&included,&includes, &xt,&yt);
|
||||
if( touches && parallel)
|
||||
{
|
||||
if(xctx.wire[j].x1 == xt && xctx.wire[j].y1 == yt) /* touch in x1, y1 */
|
||||
if(xctx->wire[j].x1 == xt && xctx->wire[j].y1 == yt) /* touch in x1, y1 */
|
||||
{
|
||||
if(xctx.wire[i].end2 == 1 && xctx.wire[j].end1 == 1) /* merge wire */
|
||||
if(xctx->wire[i].end2 == 1 && xctx->wire[j].end1 == 1) /* merge wire */
|
||||
{
|
||||
changed=1;
|
||||
xctx.wire[i].x2 = xctx.wire[j].x2;xctx.wire[i].y2 = xctx.wire[j].y2;
|
||||
xctx.wire[i].end2=xctx.wire[j].end2;
|
||||
xctx->wire[i].x2 = xctx->wire[j].x2;xctx->wire[i].y2 = xctx->wire[j].y2;
|
||||
xctx->wire[i].end2=xctx->wire[j].end2;
|
||||
freenet_nocheck(j);
|
||||
j--;
|
||||
break;
|
||||
|
|
@ -268,11 +269,11 @@ void trim_wires(void)
|
|||
}
|
||||
else /* touch in x2,y2 */
|
||||
{
|
||||
if(xctx.wire[i].end1 == 1 && xctx.wire[j].end2 == 1) /* merge wire */
|
||||
if(xctx->wire[i].end1 == 1 && xctx->wire[j].end2 == 1) /* merge wire */
|
||||
{
|
||||
changed=1;
|
||||
xctx.wire[i].x1 = xctx.wire[j].x1;xctx.wire[i].y1 = xctx.wire[j].y1;
|
||||
xctx.wire[i].end1=xctx.wire[j].end1;
|
||||
xctx->wire[i].x1 = xctx->wire[j].x1;xctx->wire[i].y1 = xctx->wire[j].y1;
|
||||
xctx->wire[i].end1=xctx->wire[j].end1;
|
||||
freenet_nocheck(j);
|
||||
j--;
|
||||
break;
|
||||
|
|
@ -304,49 +305,49 @@ void break_wires_at_pins(void)
|
|||
need_rebuild_selected_array=1;
|
||||
rebuild_selected_array();
|
||||
|
||||
/* for(k=0;k<xctx.instances;k++) */
|
||||
/* for(k=0;k<xctx->instances;k++) */
|
||||
for(j=0;j<lastselected;j++) if(selectedgroup[j].type==ELEMENT) {
|
||||
k = selectedgroup[j].n;
|
||||
if( (rects = (xctx.inst[k].ptr+ xctx.sym)->rects[PINLAYER]) > 0 )
|
||||
if( (rects = (xctx->inst[k].ptr+ xctx->sym)->rects[PINLAYER]) > 0 )
|
||||
{
|
||||
for(r=0;r<rects;r++)
|
||||
{
|
||||
rct=(xctx.inst[k].ptr+ xctx.sym)->rect[PINLAYER];
|
||||
rct=(xctx->inst[k].ptr+ xctx->sym)->rect[PINLAYER];
|
||||
x0=(rct[r].x1+rct[r].x2)/2;
|
||||
y0=(rct[r].y1+rct[r].y2)/2;
|
||||
rot=xctx.inst[k].rot;
|
||||
flip=xctx.inst[k].flip;
|
||||
rot=xctx->inst[k].rot;
|
||||
flip=xctx->inst[k].flip;
|
||||
ROTATION(0.0,0.0,x0,y0,rx1,ry1);
|
||||
x0=xctx.inst[k].x0+rx1;
|
||||
y0=xctx.inst[k].y0+ry1;
|
||||
x0=xctx->inst[k].x0+rx1;
|
||||
y0=xctx->inst[k].y0+ry1;
|
||||
get_square(x0, y0, &sqx, &sqy);
|
||||
for(wptr=wiretable[sqx][sqy]; wptr; wptr=wptr->next) {
|
||||
i = wptr->n;
|
||||
if( touch(xctx.wire[i].x1, xctx.wire[i].y1,
|
||||
xctx.wire[i].x2, xctx.wire[i].y2, x0,y0) )
|
||||
if( touch(xctx->wire[i].x1, xctx->wire[i].y1,
|
||||
xctx->wire[i].x2, xctx->wire[i].y2, x0,y0) )
|
||||
{
|
||||
if( (x0!=xctx.wire[i].x1 && x0!=xctx.wire[i].x2) ||
|
||||
(y0!=xctx.wire[i].y1 && y0!=xctx.wire[i].y2) ) {
|
||||
if( (x0!=xctx->wire[i].x1 && x0!=xctx->wire[i].x2) ||
|
||||
(y0!=xctx->wire[i].y1 && y0!=xctx->wire[i].y2) ) {
|
||||
if(!changed) { push_undo(); changed=1;}
|
||||
check_wire_storage();
|
||||
xctx.wire[xctx.wires].x1=xctx.wire[i].x1;
|
||||
xctx.wire[xctx.wires].y1=xctx.wire[i].y1;
|
||||
xctx.wire[xctx.wires].x2=x0;
|
||||
xctx.wire[xctx.wires].y2=y0;
|
||||
xctx.wire[xctx.wires].sel=SELECTED;
|
||||
xctx.wire[xctx.wires].prop_ptr=NULL;
|
||||
my_strdup(31, &xctx.wire[xctx.wires].prop_ptr, xctx.wire[i].prop_ptr);
|
||||
if(!strcmp(get_tok_value(xctx.wire[xctx.wires].prop_ptr,"bus",0), "true"))
|
||||
xctx.wire[xctx.wires].bus=1;
|
||||
xctx->wire[xctx->wires].x1=xctx->wire[i].x1;
|
||||
xctx->wire[xctx->wires].y1=xctx->wire[i].y1;
|
||||
xctx->wire[xctx->wires].x2=x0;
|
||||
xctx->wire[xctx->wires].y2=y0;
|
||||
xctx->wire[xctx->wires].sel=SELECTED;
|
||||
xctx->wire[xctx->wires].prop_ptr=NULL;
|
||||
my_strdup(31, &xctx->wire[xctx->wires].prop_ptr, xctx->wire[i].prop_ptr);
|
||||
if(!strcmp(get_tok_value(xctx->wire[xctx->wires].prop_ptr,"bus",0), "true"))
|
||||
xctx->wire[xctx->wires].bus=1;
|
||||
else
|
||||
xctx.wire[xctx.wires].bus=0;
|
||||
xctx.wire[xctx.wires].node=NULL;
|
||||
hash_wire(XINSERT, xctx.wires);
|
||||
my_strdup(32, &xctx.wire[xctx.wires].node, xctx.wire[i].node);
|
||||
xctx->wire[xctx->wires].bus=0;
|
||||
xctx->wire[xctx->wires].node=NULL;
|
||||
hash_wire(XINSERT, xctx->wires);
|
||||
my_strdup(32, &xctx->wire[xctx->wires].node, xctx->wire[i].node);
|
||||
need_rebuild_selected_array=1;
|
||||
xctx.wires++;
|
||||
xctx.wire[i].x1 = x0;
|
||||
xctx.wire[i].y1 = y0;
|
||||
xctx->wires++;
|
||||
xctx->wire[i].x1 = x0;
|
||||
xctx->wire[i].y1 = y0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -357,17 +358,17 @@ void break_wires_at_pins(void)
|
|||
/* hash_wires(); */
|
||||
rebuild_selected_array();
|
||||
for(j=0;j<lastselected;j++) if(selectedgroup[j].type==WIRE) {
|
||||
/* for(k=0; k < xctx.wires; k++) { */
|
||||
/* for(k=0; k < xctx->wires; k++) { */
|
||||
int l;
|
||||
|
||||
k = selectedgroup[j].n;
|
||||
for(l=0;l<2;l++) {
|
||||
if(l==0 ) {
|
||||
x0 = xctx.wire[k].x1;
|
||||
y0 = xctx.wire[k].y1;
|
||||
x0 = xctx->wire[k].x1;
|
||||
y0 = xctx->wire[k].y1;
|
||||
} else {
|
||||
x0 = xctx.wire[k].x2;
|
||||
y0 = xctx.wire[k].y2;
|
||||
x0 = xctx->wire[k].x2;
|
||||
y0 = xctx->wire[k].y2;
|
||||
}
|
||||
get_square(x0, y0, &sqx, &sqy);
|
||||
/* printf(" k=%d, x0=%g, y0=%g\n", k, x0, y0); */
|
||||
|
|
@ -377,31 +378,31 @@ void break_wires_at_pins(void)
|
|||
if(i==k) {
|
||||
continue; /* no check wire against itself */
|
||||
}
|
||||
if( touch(xctx.wire[i].x1, xctx.wire[i].y1,
|
||||
xctx.wire[i].x2, xctx.wire[i].y2, x0,y0) )
|
||||
if( touch(xctx->wire[i].x1, xctx->wire[i].y1,
|
||||
xctx->wire[i].x2, xctx->wire[i].y2, x0,y0) )
|
||||
{
|
||||
if( (x0!=xctx.wire[i].x1 && x0!=xctx.wire[i].x2) ||
|
||||
(y0!=xctx.wire[i].y1 && y0!=xctx.wire[i].y2) ) {
|
||||
if( (x0!=xctx->wire[i].x1 && x0!=xctx->wire[i].x2) ||
|
||||
(y0!=xctx->wire[i].y1 && y0!=xctx->wire[i].y2) ) {
|
||||
/* printf("touch in mid point: %d\n", l+1); */
|
||||
if(!changed) { push_undo(); changed=1;}
|
||||
check_wire_storage();
|
||||
xctx.wire[xctx.wires].x1=xctx.wire[i].x1;
|
||||
xctx.wire[xctx.wires].y1=xctx.wire[i].y1;
|
||||
xctx.wire[xctx.wires].x2=x0;
|
||||
xctx.wire[xctx.wires].y2=y0;
|
||||
xctx.wire[xctx.wires].sel=SELECTED;
|
||||
xctx.wire[xctx.wires].prop_ptr=NULL;
|
||||
my_strdup(33, &xctx.wire[xctx.wires].prop_ptr, xctx.wire[i].prop_ptr);
|
||||
if(!strcmp(get_tok_value(xctx.wire[xctx.wires].prop_ptr,"bus",0), "true"))
|
||||
xctx.wire[xctx.wires].bus=1;
|
||||
xctx->wire[xctx->wires].x1=xctx->wire[i].x1;
|
||||
xctx->wire[xctx->wires].y1=xctx->wire[i].y1;
|
||||
xctx->wire[xctx->wires].x2=x0;
|
||||
xctx->wire[xctx->wires].y2=y0;
|
||||
xctx->wire[xctx->wires].sel=SELECTED;
|
||||
xctx->wire[xctx->wires].prop_ptr=NULL;
|
||||
my_strdup(33, &xctx->wire[xctx->wires].prop_ptr, xctx->wire[i].prop_ptr);
|
||||
if(!strcmp(get_tok_value(xctx->wire[xctx->wires].prop_ptr,"bus",0), "true"))
|
||||
xctx->wire[xctx->wires].bus=1;
|
||||
else
|
||||
xctx.wire[xctx.wires].bus=0;
|
||||
xctx.wire[xctx.wires].node=NULL;
|
||||
hash_wire(XINSERT, xctx.wires);
|
||||
xctx->wire[xctx->wires].bus=0;
|
||||
xctx->wire[xctx->wires].node=NULL;
|
||||
hash_wire(XINSERT, xctx->wires);
|
||||
need_rebuild_selected_array=1;
|
||||
xctx.wires++;
|
||||
xctx.wire[i].x1 = x0;
|
||||
xctx.wire[i].y1 = y0;
|
||||
xctx->wires++;
|
||||
xctx->wire[i].x1 = x0;
|
||||
xctx->wire[i].y1 = y0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
194
src/draw.c
194
src/draw.c
|
|
@ -93,9 +93,9 @@ void print_image()
|
|||
areay1 = -2*lw;
|
||||
areaw = areax2-areax1;
|
||||
areah = areay2-areay1;
|
||||
saveorx = xctx.xorigin;
|
||||
saveory = xctx.yorigin;
|
||||
savezoom = xctx.zoom;
|
||||
saveorx = xctx->xorigin;
|
||||
saveory = xctx->yorigin;
|
||||
savezoom = xctx->zoom;
|
||||
#ifdef __unix__
|
||||
XFreePixmap(display,save_pixmap);
|
||||
/* save_pixmap = XCreatePixmap(display,window,areaw,areah,depth); */
|
||||
|
|
@ -169,10 +169,10 @@ void print_image()
|
|||
areay1 = -2*lw;
|
||||
areaw = areax2-areax1;
|
||||
areah = areay2-areay1;
|
||||
xctx.zoom = savezoom;
|
||||
xctx.mooz = 1/xctx.zoom;
|
||||
xctx.xorigin = saveorx;
|
||||
xctx.yorigin = saveory;
|
||||
xctx->zoom = savezoom;
|
||||
xctx->mooz = 1/xctx->zoom;
|
||||
xctx->xorigin = saveorx;
|
||||
xctx->yorigin = saveory;
|
||||
#ifdef __unix__
|
||||
XFreePixmap(display,save_pixmap);
|
||||
save_pixmap = XCreatePixmap(display,window,areaw,areah,depth);
|
||||
|
|
@ -284,7 +284,7 @@ void cairo_draw_string_line(cairo_t *cairo_ctx, char *s,
|
|||
rot1=3;
|
||||
} else rot1=0;
|
||||
|
||||
vc = cairo_vert_correct*xctx.mooz; /* converted to device (pixel) space */
|
||||
vc = cairo_vert_correct*xctx->mooz; /* converted to device (pixel) space */
|
||||
|
||||
if( rot==0 && flip==0) {iy+=line_delta+fontascent-vc;}
|
||||
else if(rot==1 && flip==0) {iy+=xadvance+line_offset;ix=ix-fontheight+fontascent+vc-lines+line_delta;}
|
||||
|
|
@ -320,9 +320,9 @@ void draw_string(int layer, int what, const char *s, int rot, int flip, int hcen
|
|||
(void)what; /* UNUSED in cairo version, avoid compiler warning */
|
||||
if(s==NULL || !has_x ) return;
|
||||
size = xscale*52.*cairo_font_scale;
|
||||
/*fprintf(errfp, "size=%.16g\n", size*xctx.mooz); */
|
||||
if(size*xctx.mooz<3.0) return; /* too small */
|
||||
if(size*xctx.mooz>1600) return; /* too big */
|
||||
/*fprintf(errfp, "size=%.16g\n", size*xctx->mooz); */
|
||||
if(size*xctx->mooz<3.0) return; /* too small */
|
||||
if(size*xctx->mooz>1600) return; /* too big */
|
||||
|
||||
text_bbox(s, xscale, yscale, rot, flip, hcenter, vcenter, x,y, &textx1,&texty1,&textx2,&texty2);
|
||||
if(!textclip(areax1,areay1,areax2,areay2,textx1,texty1,textx2,texty2)) {
|
||||
|
|
@ -359,8 +359,8 @@ void draw_string(int layer, int what, const char *s, int rot, int flip, int hcen
|
|||
(double)xcolor_array[layer].green/65535.0,
|
||||
(double)xcolor_array[layer].blue/65535.0);
|
||||
|
||||
cairo_set_font_size (cairo_ctx, size*xctx.mooz);
|
||||
cairo_set_font_size (cairo_save_ctx, size*xctx.mooz);
|
||||
cairo_set_font_size (cairo_ctx, size*xctx->mooz);
|
||||
cairo_set_font_size (cairo_save_ctx, size*xctx->mooz);
|
||||
cairo_font_extents(cairo_ctx, &fext);
|
||||
llength=0;
|
||||
my_strdup2(73, &sss, s);
|
||||
|
|
@ -404,8 +404,8 @@ void draw_string(int layer, int what, const char *str, int rot, int flip, int hc
|
|||
|
||||
if(str==NULL || !has_x ) return;
|
||||
dbg(2, "draw_string(): string=%s\n",str);
|
||||
if(xscale*FONTWIDTH*xctx.mooz<1) {
|
||||
dbg(1, "draw_string(): xscale=%.16g zoom=%.16g \n",xscale,xctx.zoom);
|
||||
if(xscale*FONTWIDTH*xctx->mooz<1) {
|
||||
dbg(1, "draw_string(): xscale=%.16g zoom=%.16g \n",xscale,xctx->zoom);
|
||||
return;
|
||||
}
|
||||
else {
|
||||
|
|
@ -479,46 +479,46 @@ void draw_symbol(int what,int c, int n,int layer,int tmp_flip, int rot,
|
|||
#ifdef HAS_CAIRO
|
||||
char *textfont;
|
||||
#endif
|
||||
if(xctx.inst[n].ptr == -1) return;
|
||||
if(xctx->inst[n].ptr == -1) return;
|
||||
if( (layer != PINLAYER && !enable_layer[layer]) ) return;
|
||||
if(!has_x) return;
|
||||
if(
|
||||
(hide_symbols==1 && (xctx.inst[n].ptr+ xctx.sym)->prop_ptr &&
|
||||
!strcmp( (xctx.inst[n].ptr+ xctx.sym)->type, "subcircuit") ) || (hide_symbols == 2) ) {
|
||||
(hide_symbols==1 && (xctx->inst[n].ptr+ xctx->sym)->prop_ptr &&
|
||||
!strcmp( (xctx->inst[n].ptr+ xctx->sym)->type, "subcircuit") ) || (hide_symbols == 2) ) {
|
||||
hide = 1;
|
||||
} else {
|
||||
hide = 0;
|
||||
}
|
||||
if(hide && layer == 0) {
|
||||
drawrect(4, what, xctx.inst[n].xx1, xctx.inst[n].yy1, xctx.inst[n].xx2, xctx.inst[n].yy2, 2);
|
||||
drawrect(4, what, xctx->inst[n].xx1, xctx->inst[n].yy1, xctx->inst[n].xx2, xctx->inst[n].yy2, 2);
|
||||
}
|
||||
if(layer==0) {
|
||||
x1=X_TO_SCREEN(xctx.inst[n].x1+xoffset); /* 20150729 added xoffset, yoffset */
|
||||
x2=X_TO_SCREEN(xctx.inst[n].x2+xoffset);
|
||||
y1=Y_TO_SCREEN(xctx.inst[n].y1+yoffset);
|
||||
y2=Y_TO_SCREEN(xctx.inst[n].y2+yoffset);
|
||||
x1=X_TO_SCREEN(xctx->inst[n].x1+xoffset); /* 20150729 added xoffset, yoffset */
|
||||
x2=X_TO_SCREEN(xctx->inst[n].x2+xoffset);
|
||||
y1=Y_TO_SCREEN(xctx->inst[n].y1+yoffset);
|
||||
y2=Y_TO_SCREEN(xctx->inst[n].y2+yoffset);
|
||||
if(!only_probes && (x2-x1)< 0.3 && (y2-y1)< 0.3) {
|
||||
xctx.inst[n].flags|=1;
|
||||
xctx->inst[n].flags|=1;
|
||||
return;
|
||||
}
|
||||
else if(OUTSIDE(x1,y1,x2,y2,areax1,areay1,areax2,areay2))
|
||||
{
|
||||
xctx.inst[n].flags|=1;
|
||||
xctx->inst[n].flags|=1;
|
||||
return;
|
||||
}
|
||||
else xctx.inst[n].flags&=~1;
|
||||
else xctx->inst[n].flags&=~1;
|
||||
|
||||
} else if(xctx.inst[n].flags&1) {
|
||||
} else if(xctx->inst[n].flags&1) {
|
||||
dbg(2, "draw_symbol(): skipping inst %d\n", n);
|
||||
return;
|
||||
}
|
||||
flip = xctx.inst[n].flip;
|
||||
flip = xctx->inst[n].flip;
|
||||
if(tmp_flip) flip = !flip;
|
||||
rot = (xctx.inst[n].rot + rot ) & 0x3;
|
||||
rot = (xctx->inst[n].rot + rot ) & 0x3;
|
||||
|
||||
x0=xctx.inst[n].x0 + xoffset;
|
||||
y0=xctx.inst[n].y0 + yoffset;
|
||||
symptr = (xctx.inst[n].ptr+ xctx.sym);
|
||||
x0=xctx->inst[n].x0 + xoffset;
|
||||
y0=xctx->inst[n].y0 + yoffset;
|
||||
symptr = (xctx->inst[n].ptr+ xctx->sym);
|
||||
if(!hide) {
|
||||
for(j=0;j< symptr->lines[layer];j++)
|
||||
{
|
||||
|
|
@ -576,23 +576,23 @@ void draw_symbol(int what,int c, int n,int layer,int tmp_flip, int rot,
|
|||
filledrect(c,what, x0+x1, y0+y1, x0+x2, y0+y2);
|
||||
}
|
||||
}
|
||||
if( (layer==TEXTWIRELAYER && !(xctx.inst[n].flags&2) ) ||
|
||||
(sym_txt && (layer==TEXTLAYER) && (xctx.inst[n].flags&2) ) ) {
|
||||
if( (layer==TEXTWIRELAYER && !(xctx->inst[n].flags&2) ) ||
|
||||
(sym_txt && (layer==TEXTLAYER) && (xctx->inst[n].flags&2) ) ) {
|
||||
const char *txtptr;
|
||||
for(j=0;j< symptr->texts;j++)
|
||||
{
|
||||
text = symptr->text[j];
|
||||
if(text.xscale*FONTWIDTH*xctx.mooz<1) continue;
|
||||
if(text.xscale*FONTWIDTH*xctx->mooz<1) continue;
|
||||
if( hide && text.txt_ptr && strcmp(text.txt_ptr, "@symname") && strcmp(text.txt_ptr, "@name") ) continue;
|
||||
txtptr= translate(n, text.txt_ptr);
|
||||
ROTATION(0.0,0.0,text.x0,text.y0,x1,y1);
|
||||
|
||||
textlayer = c;
|
||||
if( !(c == PINLAYER && (xctx.inst[n].flags & 4))) {
|
||||
if( !(c == PINLAYER && (xctx->inst[n].flags & 4))) {
|
||||
textlayer = symptr->text[j].layer;
|
||||
if(textlayer < 0 || textlayer >= cadlayers) textlayer = c;
|
||||
}
|
||||
if((c == PINLAYER && xctx.inst[n].flags & 4) || enable_layer[textlayer]) {
|
||||
if((c == PINLAYER && xctx->inst[n].flags & 4) || enable_layer[textlayer]) {
|
||||
#ifdef HAS_CAIRO
|
||||
textfont = symptr->text[j].font;
|
||||
if((textfont && textfont[0]) || symptr->text[j].flags) {
|
||||
|
|
@ -649,35 +649,35 @@ void draw_temp_symbol(int what, GC gc, int n,int layer,int tmp_flip, int rot,
|
|||
int customfont;
|
||||
#endif
|
||||
|
||||
if(xctx.inst[n].ptr == -1) return;
|
||||
if(xctx->inst[n].ptr == -1) return;
|
||||
if(!has_x) return;
|
||||
|
||||
flip = xctx.inst[n].flip;
|
||||
flip = xctx->inst[n].flip;
|
||||
if(tmp_flip) flip = !flip;
|
||||
rot = (xctx.inst[n].rot + rot ) & 0x3;
|
||||
rot = (xctx->inst[n].rot + rot ) & 0x3;
|
||||
|
||||
if(layer==0) {
|
||||
x1=X_TO_SCREEN(xctx.inst[n].x1+xoffset); /* 20150729 added xoffset, yoffset */
|
||||
x2=X_TO_SCREEN(xctx.inst[n].x2+xoffset);
|
||||
y1=Y_TO_SCREEN(xctx.inst[n].y1+yoffset);
|
||||
y2=Y_TO_SCREEN (xctx.inst[n].y2+yoffset);
|
||||
x1=X_TO_SCREEN(xctx->inst[n].x1+xoffset); /* 20150729 added xoffset, yoffset */
|
||||
x2=X_TO_SCREEN(xctx->inst[n].x2+xoffset);
|
||||
y1=Y_TO_SCREEN(xctx->inst[n].y1+yoffset);
|
||||
y2=Y_TO_SCREEN (xctx->inst[n].y2+yoffset);
|
||||
if(OUTSIDE(x1,y1,x2,y2,areax1,areay1,areax2,areay2))
|
||||
{
|
||||
xctx.inst[n].flags|=1;
|
||||
xctx->inst[n].flags|=1;
|
||||
return;
|
||||
}
|
||||
else xctx.inst[n].flags&=~1;
|
||||
else xctx->inst[n].flags&=~1;
|
||||
|
||||
/* following code handles different text color for labels/pins 06112002 */
|
||||
|
||||
} else if(xctx.inst[n].flags&1) {
|
||||
} else if(xctx->inst[n].flags&1) {
|
||||
dbg(2, "draw_symbol(): skipping inst %d\n", n);
|
||||
return;
|
||||
} /* /20150424 */
|
||||
|
||||
x0=xctx.inst[n].x0 + xoffset;
|
||||
y0=xctx.inst[n].y0 + yoffset;
|
||||
symptr = (xctx.inst[n].ptr+ xctx.sym);
|
||||
x0=xctx->inst[n].x0 + xoffset;
|
||||
y0=xctx->inst[n].y0 + yoffset;
|
||||
symptr = (xctx->inst[n].ptr+ xctx->sym);
|
||||
for(j=0;j< symptr->lines[layer];j++)
|
||||
{
|
||||
line = (symptr->line[layer])[j];
|
||||
|
|
@ -737,7 +737,7 @@ void draw_temp_symbol(int what, GC gc, int n,int layer,int tmp_flip, int rot,
|
|||
for(j=0;j< symptr->texts;j++)
|
||||
{
|
||||
text = symptr->text[j];
|
||||
if(text.xscale*FONTWIDTH*xctx.mooz<1) continue;
|
||||
if(text.xscale*FONTWIDTH*xctx->mooz<1) continue;
|
||||
txtptr= translate(n, text.txt_ptr);
|
||||
ROTATION(0.0,0.0,text.x0,text.y0,x1,y1);
|
||||
#ifdef HAS_CAIRO
|
||||
|
|
@ -760,9 +760,9 @@ void drawgrid()
|
|||
double delta,tmp;
|
||||
int i=0;
|
||||
if( !draw_grid || !has_x) return;
|
||||
delta=cadgrid*xctx.mooz;
|
||||
delta=cadgrid*xctx->mooz;
|
||||
while(delta<CADGRIDTHRESHOLD) delta*=CADGRIDMULTIPLY; /* <-- to be improved,but works */
|
||||
x = xctx.xorigin*xctx.mooz;y = xctx.yorigin*xctx.mooz;
|
||||
x = xctx->xorigin*xctx->mooz;y = xctx->yorigin*xctx->mooz;
|
||||
if(y>areay1 && y<areay2)
|
||||
{
|
||||
if(draw_window) XDrawLine(display, window, gc[GRIDLAYER],areax1+1,(int)y, areax2-1, (int)y);
|
||||
|
|
@ -775,8 +775,8 @@ void drawgrid()
|
|||
if(draw_pixmap)
|
||||
XDrawLine(display, save_pixmap, gc[GRIDLAYER],(int)x,areay1+1, (int)x, areay2-1);
|
||||
}
|
||||
tmp = floor((areay1+1)/delta)*delta-fmod(-xctx.yorigin*xctx.mooz,delta);
|
||||
for(x=floor((areax1+1)/delta)*delta-fmod(-xctx.xorigin*xctx.mooz,delta);x<areax2;x+=delta)
|
||||
tmp = floor((areay1+1)/delta)*delta-fmod(-xctx->yorigin*xctx->mooz,delta);
|
||||
for(x=floor((areax1+1)/delta)*delta-fmod(-xctx->xorigin*xctx->mooz,delta);x<areax2;x+=delta)
|
||||
{
|
||||
for(y=tmp;y<areay2;y+=delta)
|
||||
{
|
||||
|
|
@ -1575,7 +1575,7 @@ void draw(void)
|
|||
y1 = Y_TO_XSCHEM(areay1);
|
||||
x2 = X_TO_XSCHEM(areax2);
|
||||
y2 = Y_TO_XSCHEM(areay2);
|
||||
use_hash = (xctx.wires> 2000 || xctx.instances > 2000 ) && (x2 - x1 < ITERATOR_THRESHOLD);
|
||||
use_hash = (xctx->wires> 2000 || xctx->instances > 2000 ) && (x2 - x1 < ITERATOR_THRESHOLD);
|
||||
|
||||
if(use_hash) {
|
||||
hash_instances();
|
||||
|
|
@ -1587,26 +1587,26 @@ void draw(void)
|
|||
{
|
||||
if(draw_single_layer!=-1 && c != draw_single_layer) continue;
|
||||
|
||||
if(enable_layer[c]) for(i=0;i<xctx.lines[c];i++) {
|
||||
xLine *l = &xctx.line[c][i];
|
||||
if(enable_layer[c]) for(i=0;i<xctx->lines[c];i++) {
|
||||
xLine *l = &xctx->line[c][i];
|
||||
if(l->bus)
|
||||
drawline(c, THICK, l->x1, l->y1, l->x2, l->y2, l->dash);
|
||||
else
|
||||
drawline(c, ADD, l->x1, l->y1, l->x2, l->y2, l->dash);
|
||||
}
|
||||
if(enable_layer[c]) for(i=0;i<xctx.rects[c];i++)
|
||||
if(enable_layer[c]) for(i=0;i<xctx->rects[c];i++)
|
||||
{
|
||||
xRect *r = &xctx.rect[c][i];
|
||||
xRect *r = &xctx->rect[c][i];
|
||||
drawrect(c, ADD, r->x1, r->y1, r->x2, r->y2, r->dash);
|
||||
filledrect(c, ADD, r->x1, r->y1, r->x2, r->y2);
|
||||
}
|
||||
if(enable_layer[c]) for(i=0;i<xctx.arcs[c];i++)
|
||||
if(enable_layer[c]) for(i=0;i<xctx->arcs[c];i++)
|
||||
{
|
||||
xArc *a = &xctx.arc[c][i];
|
||||
xArc *a = &xctx->arc[c][i];
|
||||
drawarc(c, ADD, a->x, a->y, a->r, a->a, a->b, a->fill, a->dash);
|
||||
}
|
||||
if(enable_layer[c]) for(i=0;i<xctx.polygons[c];i++) {
|
||||
xPoly *p = &xctx.poly[c][i];
|
||||
if(enable_layer[c]) for(i=0;i<xctx->polygons[c];i++) {
|
||||
xPoly *p = &xctx->poly[c][i];
|
||||
drawpolygon(c, NOW, p->x, p->y, p->points, p->fill, p->dash);
|
||||
}
|
||||
if(use_hash) {
|
||||
|
|
@ -1616,9 +1616,9 @@ void draw(void)
|
|||
for(init_inst_iterator(x1, y1, x2, y2); ( instanceptr = inst_iterator_next() ) ;) {
|
||||
int ptr;
|
||||
i = instanceptr->n;
|
||||
ptr = xctx.inst[i].ptr;
|
||||
ptr = xctx->inst[i].ptr;
|
||||
if( ptr !=-1) {
|
||||
symptr = ptr+xctx.sym;
|
||||
symptr = ptr+xctx->sym;
|
||||
if( c==0 || /*20150408 draw_symbol call is needed on layer 0 to avoid redundant work (outside check) */
|
||||
symptr->lines[c] ||
|
||||
symptr->arcs[c] ||
|
||||
|
|
@ -1632,11 +1632,11 @@ void draw(void)
|
|||
type &&
|
||||
(
|
||||
(
|
||||
IS_LABEL_SH_OR_PIN(type) && xctx.inst[i].node && xctx.inst[i].node[0] &&
|
||||
bus_hilight_lookup(xctx.inst[i].node[0], 0, XLOOKUP )
|
||||
IS_LABEL_SH_OR_PIN(type) && xctx->inst[i].node && xctx->inst[i].node[0] &&
|
||||
bus_hilight_lookup(xctx->inst[i].node[0], 0, XLOOKUP )
|
||||
) ||
|
||||
(
|
||||
!IS_LABEL_SH_OR_PIN(type) && (xctx.inst[i].flags & 4)
|
||||
!IS_LABEL_SH_OR_PIN(type) && (xctx->inst[i].flags & 4)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
|
@ -1649,9 +1649,9 @@ void draw(void)
|
|||
/* --------------------------------- /20171224 */
|
||||
} else {
|
||||
|
||||
for(i=0;i<xctx.instances;i++) {
|
||||
if(xctx.inst[i].ptr == -1) continue;
|
||||
symptr = (xctx.inst[i].ptr+ xctx.sym);
|
||||
for(i=0;i<xctx->instances;i++) {
|
||||
if(xctx->inst[i].ptr == -1) continue;
|
||||
symptr = (xctx->inst[i].ptr+ xctx->sym);
|
||||
if( c==0 || /*20150408 draw_symbol call is needed on layer 0 to avoid redundant work (outside check) */
|
||||
symptr->lines[c] ||
|
||||
symptr->arcs[c] ||
|
||||
|
|
@ -1660,17 +1660,17 @@ void draw(void)
|
|||
((c==TEXTWIRELAYER || c==TEXTLAYER) && symptr->texts)) {
|
||||
|
||||
|
||||
type = (xctx.inst[i].ptr+ xctx.sym)->type;
|
||||
type = (xctx->inst[i].ptr+ xctx->sym)->type;
|
||||
if(!(
|
||||
hilight_nets &&
|
||||
type &&
|
||||
(
|
||||
(
|
||||
IS_LABEL_SH_OR_PIN(type) && xctx.inst[i].node && xctx.inst[i].node[0] &&
|
||||
bus_hilight_lookup(xctx.inst[i].node[0], 0, XLOOKUP )
|
||||
IS_LABEL_SH_OR_PIN(type) && xctx->inst[i].node && xctx->inst[i].node[0] &&
|
||||
bus_hilight_lookup(xctx->inst[i].node[0], 0, XLOOKUP )
|
||||
) ||
|
||||
(
|
||||
!IS_LABEL_SH_OR_PIN(type) && (xctx.inst[i].flags & 4)
|
||||
!IS_LABEL_SH_OR_PIN(type) && (xctx->inst[i].flags & 4)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
|
@ -1694,20 +1694,20 @@ void draw(void)
|
|||
|
||||
for(init_wire_iterator(x1, y1, x2, y2); ( wireptr = wire_iterator_next() ) ;) {
|
||||
ii=wireptr->n;
|
||||
if(xctx.wire[ii].bus) {
|
||||
drawline(WIRELAYER, THICK, xctx.wire[ii].x1,xctx.wire[ii].y1,xctx.wire[ii].x2,xctx.wire[ii].y2, 0);
|
||||
if(xctx->wire[ii].bus) {
|
||||
drawline(WIRELAYER, THICK, xctx->wire[ii].x1,xctx->wire[ii].y1,xctx->wire[ii].x2,xctx->wire[ii].y2, 0);
|
||||
}
|
||||
else
|
||||
drawline(WIRELAYER, ADD, xctx.wire[ii].x1,xctx.wire[ii].y1,xctx.wire[ii].x2,xctx.wire[ii].y2, 0);
|
||||
drawline(WIRELAYER, ADD, xctx->wire[ii].x1,xctx->wire[ii].y1,xctx->wire[ii].x2,xctx->wire[ii].y2, 0);
|
||||
}
|
||||
} else {
|
||||
for(i=0;i<xctx.wires;i++)
|
||||
for(i=0;i<xctx->wires;i++)
|
||||
{
|
||||
if(xctx.wire[i].bus) {
|
||||
drawline(WIRELAYER, THICK, xctx.wire[i].x1,xctx.wire[i].y1,xctx.wire[i].x2,xctx.wire[i].y2, 0);
|
||||
if(xctx->wire[i].bus) {
|
||||
drawline(WIRELAYER, THICK, xctx->wire[i].x1,xctx->wire[i].y1,xctx->wire[i].x2,xctx->wire[i].y2, 0);
|
||||
}
|
||||
else
|
||||
drawline(WIRELAYER, ADD, xctx.wire[i].x1,xctx.wire[i].y1,xctx.wire[i].x2,xctx.wire[i].y2, 0);
|
||||
drawline(WIRELAYER, ADD, xctx->wire[i].x1,xctx->wire[i].y1,xctx->wire[i].x2,xctx->wire[i].y2, 0);
|
||||
}
|
||||
}
|
||||
update_conn_cues(1, draw_window);
|
||||
|
|
@ -1715,22 +1715,22 @@ void draw(void)
|
|||
drawline(WIRELAYER, END, 0.0, 0.0, 0.0, 0.0, 0);
|
||||
}
|
||||
if(draw_single_layer ==-1 || draw_single_layer==TEXTLAYER) {
|
||||
for(i=0;i<xctx.texts;i++)
|
||||
for(i=0;i<xctx->texts;i++)
|
||||
{
|
||||
textlayer = xctx.text[i].layer;
|
||||
textlayer = xctx->text[i].layer;
|
||||
if(textlayer < 0 || textlayer >= cadlayers) textlayer = TEXTLAYER;
|
||||
dbg(1, "draw(): drawing string %d = %s\n",i, xctx.text[i].txt_ptr);
|
||||
dbg(1, "draw(): drawing string %d = %s\n",i, xctx->text[i].txt_ptr);
|
||||
#ifdef HAS_CAIRO
|
||||
if(!enable_layer[textlayer]) continue;
|
||||
textfont = xctx.text[i].font;
|
||||
if( (textfont && textfont[0]) || xctx.text[i].flags) {
|
||||
textfont = xctx->text[i].font;
|
||||
if( (textfont && textfont[0]) || xctx->text[i].flags) {
|
||||
cairo_font_slant_t slant;
|
||||
cairo_font_weight_t weight;
|
||||
textfont = (xctx.text[i].font && xctx.text[i].font[0]) ? xctx.text[i].font : cairo_font_name;
|
||||
weight = ( xctx.text[i].flags & TEXT_BOLD) ? CAIRO_FONT_WEIGHT_BOLD : CAIRO_FONT_WEIGHT_NORMAL;
|
||||
textfont = (xctx->text[i].font && xctx->text[i].font[0]) ? xctx->text[i].font : cairo_font_name;
|
||||
weight = ( xctx->text[i].flags & TEXT_BOLD) ? CAIRO_FONT_WEIGHT_BOLD : CAIRO_FONT_WEIGHT_NORMAL;
|
||||
slant = CAIRO_FONT_SLANT_NORMAL;
|
||||
if(xctx.text[i].flags & TEXT_ITALIC) slant = CAIRO_FONT_SLANT_ITALIC;
|
||||
if(xctx.text[i].flags & TEXT_OBLIQUE) slant = CAIRO_FONT_SLANT_OBLIQUE;
|
||||
if(xctx->text[i].flags & TEXT_ITALIC) slant = CAIRO_FONT_SLANT_ITALIC;
|
||||
if(xctx->text[i].flags & TEXT_OBLIQUE) slant = CAIRO_FONT_SLANT_OBLIQUE;
|
||||
|
||||
cairo_save(cairo_ctx);
|
||||
cairo_save(cairo_save_ctx);
|
||||
|
|
@ -1739,12 +1739,12 @@ void draw(void)
|
|||
}
|
||||
#endif
|
||||
|
||||
draw_string(textlayer, ADD, xctx.text[i].txt_ptr,
|
||||
xctx.text[i].rot, xctx.text[i].flip, xctx.text[i].hcenter, xctx.text[i].vcenter,
|
||||
xctx.text[i].x0,xctx.text[i].y0,
|
||||
xctx.text[i].xscale, xctx.text[i].yscale);
|
||||
draw_string(textlayer, ADD, xctx->text[i].txt_ptr,
|
||||
xctx->text[i].rot, xctx->text[i].flip, xctx->text[i].hcenter, xctx->text[i].vcenter,
|
||||
xctx->text[i].x0,xctx->text[i].y0,
|
||||
xctx->text[i].xscale, xctx->text[i].yscale);
|
||||
#ifdef HAS_CAIRO
|
||||
if((textfont && textfont[0]) || xctx.text[i].flags ) {
|
||||
if((textfont && textfont[0]) || xctx->text[i].flags ) {
|
||||
cairo_restore(cairo_ctx);
|
||||
cairo_restore(cairo_save_ctx);
|
||||
}
|
||||
|
|
|
|||
408
src/editprop.c
408
src/editprop.c
|
|
@ -391,13 +391,13 @@ void set_inst_prop(int i)
|
|||
char *ptr = NULL;
|
||||
char *tmp = NULL;
|
||||
|
||||
my_strdup(104, &ptr, (xctx.inst[i].ptr+ xctx.sym)->templ);
|
||||
my_strdup(104, &ptr, (xctx->inst[i].ptr+ xctx->sym)->templ);
|
||||
dbg(1, "set_inst_prop(): i=%d, name=%s, prop_ptr = %s, template=%s\n",
|
||||
i, xctx.inst[i].name, xctx.inst[i].prop_ptr, ptr);
|
||||
my_strdup(69, &xctx.inst[i].prop_ptr, ptr);
|
||||
my_strdup2(70, &xctx.inst[i].instname, get_tok_value(ptr, "name",0));
|
||||
if(xctx.inst[i].instname[0]) {
|
||||
my_strdup(101, &tmp, xctx.inst[i].prop_ptr);
|
||||
i, xctx->inst[i].name, xctx->inst[i].prop_ptr, ptr);
|
||||
my_strdup(69, &xctx->inst[i].prop_ptr, ptr);
|
||||
my_strdup2(70, &xctx->inst[i].instname, get_tok_value(ptr, "name",0));
|
||||
if(xctx->inst[i].instname[0]) {
|
||||
my_strdup(101, &tmp, xctx->inst[i].prop_ptr);
|
||||
new_prop_string(i, tmp, 0, dis_uniq_names);
|
||||
my_free(724, &tmp);
|
||||
}
|
||||
|
|
@ -411,8 +411,8 @@ void edit_rect_property(void)
|
|||
const char *dash;
|
||||
int preserve;
|
||||
char *oldprop=NULL;
|
||||
if(xctx.rect[selectedgroup[0].col][selectedgroup[0].n].prop_ptr!=NULL) {
|
||||
my_strdup(67, &oldprop, xctx.rect[selectedgroup[0].col][selectedgroup[0].n].prop_ptr);
|
||||
if(xctx->rect[selectedgroup[0].col][selectedgroup[0].n].prop_ptr!=NULL) {
|
||||
my_strdup(67, &oldprop, xctx->rect[selectedgroup[0].col][selectedgroup[0].n].prop_ptr);
|
||||
tclsetvar("retval",oldprop);
|
||||
} else {
|
||||
tclsetvar("retval","");
|
||||
|
|
@ -429,25 +429,25 @@ void edit_rect_property(void)
|
|||
c = selectedgroup[i].col;
|
||||
n = selectedgroup[i].n;
|
||||
if(preserve == 1) {
|
||||
set_different_token(&xctx.rect[c][n].prop_ptr,
|
||||
set_different_token(&xctx->rect[c][n].prop_ptr,
|
||||
(char *) tclgetvar("retval"), oldprop, 0, 0);
|
||||
} else {
|
||||
my_strdup(99, &xctx.rect[c][n].prop_ptr,
|
||||
my_strdup(99, &xctx->rect[c][n].prop_ptr,
|
||||
(char *) tclgetvar("retval"));
|
||||
}
|
||||
old_dash = xctx.rect[c][n].dash;
|
||||
dash = get_tok_value(xctx.rect[c][n].prop_ptr,"dash",0);
|
||||
old_dash = xctx->rect[c][n].dash;
|
||||
dash = get_tok_value(xctx->rect[c][n].prop_ptr,"dash",0);
|
||||
if( strcmp(dash, "") ) {
|
||||
int d = atoi(dash);
|
||||
xctx.rect[c][n].dash = d >= 0? d : 0;
|
||||
xctx->rect[c][n].dash = d >= 0? d : 0;
|
||||
} else
|
||||
xctx.rect[c][n].dash = 0;
|
||||
if(old_dash != xctx.rect[c][n].dash) {
|
||||
xctx->rect[c][n].dash = 0;
|
||||
if(old_dash != xctx->rect[c][n].dash) {
|
||||
if(!drw) {
|
||||
bbox(BEGIN,0.0,0.0,0.0,0.0);
|
||||
drw = 1;
|
||||
}
|
||||
bbox(ADD, xctx.rect[c][n].x1, xctx.rect[c][n].y1, xctx.rect[c][n].x2, xctx.rect[c][n].y2);
|
||||
bbox(ADD, xctx->rect[c][n].x1, xctx->rect[c][n].y1, xctx->rect[c][n].x2, xctx->rect[c][n].y2);
|
||||
}
|
||||
}
|
||||
if(drw) {
|
||||
|
|
@ -466,8 +466,8 @@ void edit_line_property(void)
|
|||
const char *dash;
|
||||
int preserve;
|
||||
char *oldprop=NULL;
|
||||
if(xctx.line[selectedgroup[0].col][selectedgroup[0].n].prop_ptr!=NULL) {
|
||||
my_strdup(46, &oldprop, xctx.line[selectedgroup[0].col][selectedgroup[0].n].prop_ptr);
|
||||
if(xctx->line[selectedgroup[0].col][selectedgroup[0].n].prop_ptr!=NULL) {
|
||||
my_strdup(46, &oldprop, xctx->line[selectedgroup[0].col][selectedgroup[0].n].prop_ptr);
|
||||
tclsetvar("retval", oldprop);
|
||||
} else {
|
||||
tclsetvar("retval","");
|
||||
|
|
@ -485,25 +485,25 @@ void edit_line_property(void)
|
|||
c = selectedgroup[i].col;
|
||||
n = selectedgroup[i].n;
|
||||
if(preserve == 1) {
|
||||
set_different_token(&xctx.line[c][n].prop_ptr,
|
||||
set_different_token(&xctx->line[c][n].prop_ptr,
|
||||
(char *) tclgetvar("retval"), oldprop, 0, 0);
|
||||
} else {
|
||||
my_strdup(102, &xctx.line[c][n].prop_ptr,
|
||||
my_strdup(102, &xctx->line[c][n].prop_ptr,
|
||||
(char *) tclgetvar("retval"));
|
||||
}
|
||||
xctx.line[c][n].bus = !strcmp(get_tok_value(xctx.line[c][n].prop_ptr,"bus",0), "true");
|
||||
dash = get_tok_value(xctx.line[c][n].prop_ptr,"dash",0);
|
||||
xctx->line[c][n].bus = !strcmp(get_tok_value(xctx->line[c][n].prop_ptr,"bus",0), "true");
|
||||
dash = get_tok_value(xctx->line[c][n].prop_ptr,"dash",0);
|
||||
if( strcmp(dash, "") ) {
|
||||
int d = atoi(dash);
|
||||
xctx.line[c][n].dash = d >= 0? d : 0;
|
||||
xctx->line[c][n].dash = d >= 0? d : 0;
|
||||
} else
|
||||
xctx.line[c][n].dash = 0;
|
||||
if(xctx.line[c][n].y1 < xctx.line[c][n].y2) {
|
||||
y1 = xctx.line[c][n].y1-bus_width; y2 = xctx.line[c][n].y2+bus_width;
|
||||
xctx->line[c][n].dash = 0;
|
||||
if(xctx->line[c][n].y1 < xctx->line[c][n].y2) {
|
||||
y1 = xctx->line[c][n].y1-bus_width; y2 = xctx->line[c][n].y2+bus_width;
|
||||
} else {
|
||||
y1 = xctx.line[c][n].y1+bus_width; y2 = xctx.line[c][n].y2-bus_width;
|
||||
y1 = xctx->line[c][n].y1+bus_width; y2 = xctx->line[c][n].y2-bus_width;
|
||||
}
|
||||
bbox(ADD, xctx.line[c][n].x1-bus_width, y1 , xctx.line[c][n].x2+bus_width , y2 );
|
||||
bbox(ADD, xctx->line[c][n].x1-bus_width, y1 , xctx->line[c][n].x2+bus_width , y2 );
|
||||
}
|
||||
bbox(SET , 0.0 , 0.0 , 0.0 , 0.0);
|
||||
draw();
|
||||
|
|
@ -520,8 +520,8 @@ void edit_wire_property(void)
|
|||
char *oldprop=NULL;
|
||||
const char *bus_ptr;
|
||||
|
||||
if(xctx.wire[selectedgroup[0].n].prop_ptr!=NULL) {
|
||||
my_strdup(47, &oldprop, xctx.wire[selectedgroup[0].n].prop_ptr);
|
||||
if(xctx->wire[selectedgroup[0].n].prop_ptr!=NULL) {
|
||||
my_strdup(47, &oldprop, xctx->wire[selectedgroup[0].n].prop_ptr);
|
||||
tclsetvar("retval", oldprop);
|
||||
} else {
|
||||
tclsetvar("retval","");
|
||||
|
|
@ -541,29 +541,29 @@ void edit_wire_property(void)
|
|||
/* prepared_hash_wires=0;
|
||||
* prepared_netlist_structs=0;
|
||||
* prepared_hilight_structs=0; */
|
||||
oldbus = xctx.wire[k].bus;
|
||||
oldbus = xctx->wire[k].bus;
|
||||
if(preserve == 1) {
|
||||
set_different_token(&xctx.wire[k].prop_ptr,
|
||||
set_different_token(&xctx->wire[k].prop_ptr,
|
||||
(char *) tclgetvar("retval"), oldprop, 0, 0);
|
||||
} else {
|
||||
my_strdup(100, &xctx.wire[k].prop_ptr,(char *) tclgetvar("retval"));
|
||||
my_strdup(100, &xctx->wire[k].prop_ptr,(char *) tclgetvar("retval"));
|
||||
}
|
||||
bus_ptr = get_tok_value(xctx.wire[k].prop_ptr,"bus",0);
|
||||
bus_ptr = get_tok_value(xctx->wire[k].prop_ptr,"bus",0);
|
||||
if(!strcmp(bus_ptr, "true")) {
|
||||
int ov, y1, y2;
|
||||
ov = bus_width > cadhalfdotsize ? bus_width : CADHALFDOTSIZE;
|
||||
if(xctx.wire[k].y1 < xctx.wire[k].y2) { y1 = xctx.wire[k].y1-ov; y2 = xctx.wire[k].y2+ov; }
|
||||
else { y1 = xctx.wire[k].y1+ov; y2 = xctx.wire[k].y2-ov; }
|
||||
bbox(ADD, xctx.wire[k].x1-ov, y1 , xctx.wire[k].x2+ov , y2 );
|
||||
xctx.wire[k].bus=1;
|
||||
if(xctx->wire[k].y1 < xctx->wire[k].y2) { y1 = xctx->wire[k].y1-ov; y2 = xctx->wire[k].y2+ov; }
|
||||
else { y1 = xctx->wire[k].y1+ov; y2 = xctx->wire[k].y2-ov; }
|
||||
bbox(ADD, xctx->wire[k].x1-ov, y1 , xctx->wire[k].x2+ov , y2 );
|
||||
xctx->wire[k].bus=1;
|
||||
} else {
|
||||
if(oldbus){
|
||||
int ov, y1, y2;
|
||||
ov = bus_width> cadhalfdotsize ? bus_width : CADHALFDOTSIZE;
|
||||
if(xctx.wire[k].y1 < xctx.wire[k].y2) { y1 = xctx.wire[k].y1-ov; y2 = xctx.wire[k].y2+ov; }
|
||||
else { y1 = xctx.wire[k].y1+ov; y2 = xctx.wire[k].y2-ov; }
|
||||
bbox(ADD, xctx.wire[k].x1-ov, y1 , xctx.wire[k].x2+ov , y2 );
|
||||
xctx.wire[k].bus=0;
|
||||
if(xctx->wire[k].y1 < xctx->wire[k].y2) { y1 = xctx->wire[k].y1-ov; y2 = xctx->wire[k].y2+ov; }
|
||||
else { y1 = xctx->wire[k].y1+ov; y2 = xctx->wire[k].y2-ov; }
|
||||
bbox(ADD, xctx->wire[k].x1-ov, y1 , xctx->wire[k].x2+ov , y2 );
|
||||
xctx->wire[k].bus=0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -583,8 +583,8 @@ void edit_arc_property(void)
|
|||
const char *dash;
|
||||
int preserve;
|
||||
|
||||
if(xctx.arc[selectedgroup[0].col][selectedgroup[0].n].prop_ptr!=NULL) {
|
||||
my_strdup(98, &oldprop, xctx.arc[selectedgroup[0].col][selectedgroup[0].n].prop_ptr);
|
||||
if(xctx->arc[selectedgroup[0].col][selectedgroup[0].n].prop_ptr!=NULL) {
|
||||
my_strdup(98, &oldprop, xctx->arc[selectedgroup[0].col][selectedgroup[0].n].prop_ptr);
|
||||
tclsetvar("retval", oldprop);
|
||||
} else {
|
||||
tclsetvar("retval","");
|
||||
|
|
@ -602,31 +602,31 @@ void edit_arc_property(void)
|
|||
c = selectedgroup[ii].col;
|
||||
|
||||
if(preserve == 1) {
|
||||
set_different_token(&xctx.arc[c][i].prop_ptr, (char *) tclgetvar("retval"), oldprop, 0, 0);
|
||||
set_different_token(&xctx->arc[c][i].prop_ptr, (char *) tclgetvar("retval"), oldprop, 0, 0);
|
||||
|
||||
} else {
|
||||
my_strdup(156, &xctx.arc[c][i].prop_ptr, (char *) tclgetvar("retval"));
|
||||
my_strdup(156, &xctx->arc[c][i].prop_ptr, (char *) tclgetvar("retval"));
|
||||
}
|
||||
old_fill = xctx.arc[c][i].fill;
|
||||
if( !strcmp(get_tok_value(xctx.arc[c][i].prop_ptr,"fill",0),"true") )
|
||||
xctx.arc[c][i].fill =1;
|
||||
old_fill = xctx->arc[c][i].fill;
|
||||
if( !strcmp(get_tok_value(xctx->arc[c][i].prop_ptr,"fill",0),"true") )
|
||||
xctx->arc[c][i].fill =1;
|
||||
else
|
||||
xctx.arc[c][i].fill =0;
|
||||
old_dash = xctx.arc[c][i].dash;
|
||||
dash = get_tok_value(xctx.arc[c][i].prop_ptr,"dash",0);
|
||||
xctx->arc[c][i].fill =0;
|
||||
old_dash = xctx->arc[c][i].dash;
|
||||
dash = get_tok_value(xctx->arc[c][i].prop_ptr,"dash",0);
|
||||
if( strcmp(dash, "") ) {
|
||||
int d = atoi(dash);
|
||||
xctx.arc[c][i].dash = d >= 0 ? d : 0;
|
||||
xctx->arc[c][i].dash = d >= 0 ? d : 0;
|
||||
} else
|
||||
xctx.arc[c][i].dash = 0;
|
||||
xctx->arc[c][i].dash = 0;
|
||||
|
||||
|
||||
if(old_fill != xctx.arc[c][i].fill || old_dash != xctx.arc[c][i].dash) {
|
||||
if(old_fill != xctx->arc[c][i].fill || old_dash != xctx->arc[c][i].dash) {
|
||||
if(!drw) {
|
||||
bbox(BEGIN,0.0,0.0,0.0,0.0);
|
||||
drw = 1;
|
||||
}
|
||||
arc_bbox(xctx.arc[c][i].x, xctx.arc[c][i].y, xctx.arc[c][i].r, 0, 360, &x1,&y1,&x2,&y2);
|
||||
arc_bbox(xctx->arc[c][i].x, xctx->arc[c][i].y, xctx->arc[c][i].r, 0, 360, &x1,&y1,&x2,&y2);
|
||||
bbox(ADD, x1, y1, x2, y2);
|
||||
}
|
||||
}
|
||||
|
|
@ -650,8 +650,8 @@ void edit_polygon_property(void)
|
|||
int preserve;
|
||||
|
||||
dbg(1, "edit_property(): input property:\n");
|
||||
if(xctx.poly[selectedgroup[0].col][selectedgroup[0].n].prop_ptr!=NULL) {
|
||||
my_strdup(112, &oldprop, xctx.poly[selectedgroup[0].col][selectedgroup[0].n].prop_ptr);
|
||||
if(xctx->poly[selectedgroup[0].col][selectedgroup[0].n].prop_ptr!=NULL) {
|
||||
my_strdup(112, &oldprop, xctx->poly[selectedgroup[0].col][selectedgroup[0].n].prop_ptr);
|
||||
tclsetvar("retval", oldprop);
|
||||
} else {
|
||||
tclsetvar("retval","");
|
||||
|
|
@ -669,33 +669,33 @@ void edit_polygon_property(void)
|
|||
c = selectedgroup[ii].col;
|
||||
|
||||
if(preserve == 1) {
|
||||
set_different_token(&xctx.poly[c][i].prop_ptr, (char *) tclgetvar("retval"), oldprop, 0, 0);
|
||||
set_different_token(&xctx->poly[c][i].prop_ptr, (char *) tclgetvar("retval"), oldprop, 0, 0);
|
||||
|
||||
} else {
|
||||
my_strdup(113, &xctx.poly[c][i].prop_ptr, (char *) tclgetvar("retval"));
|
||||
my_strdup(113, &xctx->poly[c][i].prop_ptr, (char *) tclgetvar("retval"));
|
||||
}
|
||||
old_fill = xctx.poly[c][i].fill;
|
||||
old_dash = xctx.poly[c][i].dash;
|
||||
if( !strcmp(get_tok_value(xctx.poly[c][i].prop_ptr,"fill",0),"true") )
|
||||
xctx.poly[c][i].fill =1;
|
||||
old_fill = xctx->poly[c][i].fill;
|
||||
old_dash = xctx->poly[c][i].dash;
|
||||
if( !strcmp(get_tok_value(xctx->poly[c][i].prop_ptr,"fill",0),"true") )
|
||||
xctx->poly[c][i].fill =1;
|
||||
else
|
||||
xctx.poly[c][i].fill =0;
|
||||
dash = get_tok_value(xctx.poly[c][i].prop_ptr,"dash",0);
|
||||
xctx->poly[c][i].fill =0;
|
||||
dash = get_tok_value(xctx->poly[c][i].prop_ptr,"dash",0);
|
||||
if( strcmp(dash, "") ) {
|
||||
int d = atoi(dash);
|
||||
xctx.poly[c][i].dash = d >= 0 ? d : 0;
|
||||
xctx->poly[c][i].dash = d >= 0 ? d : 0;
|
||||
} else
|
||||
xctx.poly[c][i].dash = 0;
|
||||
if(old_fill != xctx.poly[c][i].fill || old_dash != xctx.poly[c][i].dash) {
|
||||
xctx->poly[c][i].dash = 0;
|
||||
if(old_fill != xctx->poly[c][i].fill || old_dash != xctx->poly[c][i].dash) {
|
||||
if(!drw) {
|
||||
bbox(BEGIN,0.0,0.0,0.0,0.0);
|
||||
drw = 1;
|
||||
}
|
||||
for(k=0; k<xctx.poly[c][i].points; k++) {
|
||||
if(k==0 || xctx.poly[c][i].x[k] < x1) x1 = xctx.poly[c][i].x[k];
|
||||
if(k==0 || xctx.poly[c][i].y[k] < y1) y1 = xctx.poly[c][i].y[k];
|
||||
if(k==0 || xctx.poly[c][i].x[k] > x2) x2 = xctx.poly[c][i].x[k];
|
||||
if(k==0 || xctx.poly[c][i].y[k] > y2) y2 = xctx.poly[c][i].y[k];
|
||||
for(k=0; k<xctx->poly[c][i].points; k++) {
|
||||
if(k==0 || xctx->poly[c][i].x[k] < x1) x1 = xctx->poly[c][i].x[k];
|
||||
if(k==0 || xctx->poly[c][i].y[k] < y1) y1 = xctx->poly[c][i].y[k];
|
||||
if(k==0 || xctx->poly[c][i].x[k] > x2) x2 = xctx->poly[c][i].x[k];
|
||||
if(k==0 || xctx->poly[c][i].y[k] > y2) y2 = xctx->poly[c][i].y[k];
|
||||
}
|
||||
bbox(ADD, x1, y1, x2, y2);
|
||||
}
|
||||
|
|
@ -725,16 +725,16 @@ void edit_text_property(int x)
|
|||
|
||||
dbg(1, "edit_text_property(): entering\n");
|
||||
sel = selectedgroup[0].n;
|
||||
my_strdup(656, &oldprop, xctx.text[sel].prop_ptr);
|
||||
if(xctx.text[sel].prop_ptr !=NULL)
|
||||
tclsetvar("props",xctx.text[sel].prop_ptr);
|
||||
my_strdup(656, &oldprop, xctx->text[sel].prop_ptr);
|
||||
if(xctx->text[sel].prop_ptr !=NULL)
|
||||
tclsetvar("props",xctx->text[sel].prop_ptr);
|
||||
else
|
||||
tclsetvar("props","");
|
||||
|
||||
tclsetvar("retval",xctx.text[sel].txt_ptr);
|
||||
my_snprintf(property, S(property), "%.16g",xctx.text[sel].yscale);
|
||||
tclsetvar("retval",xctx->text[sel].txt_ptr);
|
||||
my_snprintf(property, S(property), "%.16g",xctx->text[sel].yscale);
|
||||
tclsetvar("vsize",property);
|
||||
my_snprintf(property, S(property), "%.16g",xctx.text[sel].xscale);
|
||||
my_snprintf(property, S(property), "%.16g",xctx->text[sel].xscale);
|
||||
tclsetvar("hsize",property);
|
||||
if(x==0) tcleval("enter_text {text:} normal");
|
||||
else if(x==2) tcleval("viewdata $::retval");
|
||||
|
|
@ -746,7 +746,7 @@ void edit_text_property(int x)
|
|||
|
||||
text_changed=0;
|
||||
if(x == 0 || x == 1) {
|
||||
if( strcmp(xctx.text[sel].txt_ptr, tclgetvar("retval") ) ) {
|
||||
if( strcmp(xctx->text[sel].txt_ptr, tclgetvar("retval") ) ) {
|
||||
dbg(1, "edit_text_property(): x=%d, text_changed=1\n", x);
|
||||
text_changed=1;
|
||||
} else {
|
||||
|
|
@ -764,14 +764,14 @@ void edit_text_property(int x)
|
|||
if(selectedgroup[k].type!=xTEXT) continue;
|
||||
sel=selectedgroup[k].n;
|
||||
|
||||
rot = xctx.text[sel].rot; /* calculate bbox, some cleanup needed here */
|
||||
flip = xctx.text[sel].flip;
|
||||
rot = xctx->text[sel].rot; /* calculate bbox, some cleanup needed here */
|
||||
flip = xctx->text[sel].flip;
|
||||
#ifdef HAS_CAIRO
|
||||
customfont = set_text_custom_font(&xctx.text[sel]);
|
||||
customfont = set_text_custom_font(&xctx->text[sel]);
|
||||
#endif
|
||||
text_bbox(xctx.text[sel].txt_ptr, xctx.text[sel].xscale,
|
||||
xctx.text[sel].yscale, rot, flip, xctx.text[sel].hcenter, xctx.text[sel].vcenter,
|
||||
xctx.text[sel].x0, xctx.text[sel].y0,
|
||||
text_bbox(xctx->text[sel].txt_ptr, xctx->text[sel].xscale,
|
||||
xctx->text[sel].yscale, rot, flip, xctx->text[sel].hcenter, xctx->text[sel].vcenter,
|
||||
xctx->text[sel].x0, xctx->text[sel].y0,
|
||||
&xx1,&yy1,&xx2,&yy2);
|
||||
#ifdef HAS_CAIRO
|
||||
if(customfont) cairo_restore(cairo_ctx);
|
||||
|
|
@ -783,23 +783,23 @@ void edit_text_property(int x)
|
|||
tclgetvar("props"),
|
||||
tclgetvar("retval") );
|
||||
if(text_changed) {
|
||||
c = xctx.rects[PINLAYER];
|
||||
c = xctx->rects[PINLAYER];
|
||||
for(l=0;l<c;l++) {
|
||||
if(!strcmp( (get_tok_value(xctx.rect[PINLAYER][l].prop_ptr, "name",0)),
|
||||
xctx.text[sel].txt_ptr) ) {
|
||||
if(!strcmp( (get_tok_value(xctx->rect[PINLAYER][l].prop_ptr, "name",0)),
|
||||
xctx->text[sel].txt_ptr) ) {
|
||||
#ifdef HAS_CAIRO
|
||||
customfont = set_text_custom_font(&xctx.text[sel]);
|
||||
customfont = set_text_custom_font(&xctx->text[sel]);
|
||||
#endif
|
||||
text_bbox(xctx.text[sel].txt_ptr, xctx.text[sel].xscale,
|
||||
xctx.text[sel].yscale, rot, flip, xctx.text[sel].hcenter, xctx.text[sel].vcenter,
|
||||
xctx.text[sel].x0, xctx.text[sel].y0,
|
||||
text_bbox(xctx->text[sel].txt_ptr, xctx->text[sel].xscale,
|
||||
xctx->text[sel].yscale, rot, flip, xctx->text[sel].hcenter, xctx->text[sel].vcenter,
|
||||
xctx->text[sel].x0, xctx->text[sel].y0,
|
||||
&xx1,&yy1,&xx2,&yy2);
|
||||
#ifdef HAS_CAIRO
|
||||
if(customfont) cairo_restore(cairo_ctx);
|
||||
#endif
|
||||
|
||||
pcx = (xctx.rect[PINLAYER][l].x1+xctx.rect[PINLAYER][l].x2)/2.0;
|
||||
pcy = (xctx.rect[PINLAYER][l].y1+xctx.rect[PINLAYER][l].y2)/2.0;
|
||||
pcx = (xctx->rect[PINLAYER][l].x1+xctx->rect[PINLAYER][l].x2)/2.0;
|
||||
pcy = (xctx->rect[PINLAYER][l].y1+xctx->rect[PINLAYER][l].y2)/2.0;
|
||||
|
||||
if(
|
||||
/* 20171206 20171221 */
|
||||
|
|
@ -810,53 +810,53 @@ void edit_text_property(int x)
|
|||
(fabs(yy1 - pcy) < cadgrid*3 || fabs(yy2 - pcy) < cadgrid*3) )
|
||||
) {
|
||||
if(x==0)
|
||||
my_strdup(71, &xctx.rect[PINLAYER][l].prop_ptr,
|
||||
subst_token(xctx.rect[PINLAYER][l].prop_ptr, "name",
|
||||
my_strdup(71, &xctx->rect[PINLAYER][l].prop_ptr,
|
||||
subst_token(xctx->rect[PINLAYER][l].prop_ptr, "name",
|
||||
(char *) tclgetvar("retval")) );
|
||||
else
|
||||
my_strdup(72, &xctx.rect[PINLAYER][l].prop_ptr,
|
||||
subst_token(xctx.rect[PINLAYER][l].prop_ptr, "name",
|
||||
my_strdup(72, &xctx->rect[PINLAYER][l].prop_ptr,
|
||||
subst_token(xctx->rect[PINLAYER][l].prop_ptr, "name",
|
||||
(char *) tclgetvar("retval")) );
|
||||
}
|
||||
}
|
||||
}
|
||||
my_strdup(74, &xctx.text[sel].txt_ptr, (char *) tclgetvar("retval"));
|
||||
my_strdup(74, &xctx->text[sel].txt_ptr, (char *) tclgetvar("retval"));
|
||||
}
|
||||
if(x==0) {
|
||||
if(preserve)
|
||||
set_different_token(&xctx.text[sel].prop_ptr, (char *) tclgetvar("props"), oldprop, 0, 0);
|
||||
set_different_token(&xctx->text[sel].prop_ptr, (char *) tclgetvar("props"), oldprop, 0, 0);
|
||||
else
|
||||
my_strdup(75, &xctx.text[sel].prop_ptr,(char *) tclgetvar("props"));
|
||||
my_strdup(76, &xctx.text[sel].font, get_tok_value(xctx.text[sel].prop_ptr, "font", 0));
|
||||
my_strdup(75, &xctx->text[sel].prop_ptr,(char *) tclgetvar("props"));
|
||||
my_strdup(76, &xctx->text[sel].font, get_tok_value(xctx->text[sel].prop_ptr, "font", 0));
|
||||
|
||||
str = get_tok_value(xctx.text[sel].prop_ptr, "hcenter", 0);
|
||||
xctx.text[sel].hcenter = strcmp(str, "true") ? 0 : 1;
|
||||
str = get_tok_value(xctx.text[sel].prop_ptr, "vcenter", 0);
|
||||
xctx.text[sel].vcenter = strcmp(str, "true") ? 0 : 1;
|
||||
str = get_tok_value(xctx->text[sel].prop_ptr, "hcenter", 0);
|
||||
xctx->text[sel].hcenter = strcmp(str, "true") ? 0 : 1;
|
||||
str = get_tok_value(xctx->text[sel].prop_ptr, "vcenter", 0);
|
||||
xctx->text[sel].vcenter = strcmp(str, "true") ? 0 : 1;
|
||||
|
||||
str = get_tok_value(xctx.text[sel].prop_ptr, "layer", 0);
|
||||
if(str[0]) xctx.text[sel].layer = atoi(str);
|
||||
else xctx.text[sel].layer=-1;
|
||||
str = get_tok_value(xctx->text[sel].prop_ptr, "layer", 0);
|
||||
if(str[0]) xctx->text[sel].layer = atoi(str);
|
||||
else xctx->text[sel].layer=-1;
|
||||
|
||||
|
||||
xctx.text[sel].flags = 0;
|
||||
str = get_tok_value(xctx.text[sel].prop_ptr, "slant", 0);
|
||||
xctx.text[sel].flags |= strcmp(str, "oblique") ? 0 : TEXT_OBLIQUE;
|
||||
xctx.text[sel].flags |= strcmp(str, "italic") ? 0 : TEXT_ITALIC;
|
||||
str = get_tok_value(xctx.text[sel].prop_ptr, "weight", 0);
|
||||
xctx.text[sel].flags |= strcmp(str, "bold") ? 0 : TEXT_BOLD;
|
||||
xctx->text[sel].flags = 0;
|
||||
str = get_tok_value(xctx->text[sel].prop_ptr, "slant", 0);
|
||||
xctx->text[sel].flags |= strcmp(str, "oblique") ? 0 : TEXT_OBLIQUE;
|
||||
xctx->text[sel].flags |= strcmp(str, "italic") ? 0 : TEXT_ITALIC;
|
||||
str = get_tok_value(xctx->text[sel].prop_ptr, "weight", 0);
|
||||
xctx->text[sel].flags |= strcmp(str, "bold") ? 0 : TEXT_BOLD;
|
||||
|
||||
xctx.text[sel].xscale=atof(tclgetvar("hsize"));
|
||||
xctx.text[sel].yscale=atof(tclgetvar("vsize"));
|
||||
xctx->text[sel].xscale=atof(tclgetvar("hsize"));
|
||||
xctx->text[sel].yscale=atof(tclgetvar("vsize"));
|
||||
}
|
||||
|
||||
/* calculate bbox, some cleanup needed here */
|
||||
#ifdef HAS_CAIRO
|
||||
customfont = set_text_custom_font(&xctx.text[sel]);
|
||||
customfont = set_text_custom_font(&xctx->text[sel]);
|
||||
#endif
|
||||
text_bbox(xctx.text[sel].txt_ptr, xctx.text[sel].xscale,
|
||||
xctx.text[sel].yscale, rot, flip, xctx.text[sel].hcenter, xctx.text[sel].vcenter,
|
||||
xctx.text[sel].x0, xctx.text[sel].y0,
|
||||
text_bbox(xctx->text[sel].txt_ptr, xctx->text[sel].xscale,
|
||||
xctx->text[sel].yscale, rot, flip, xctx->text[sel].hcenter, xctx->text[sel].vcenter,
|
||||
xctx->text[sel].x0, xctx->text[sel].y0,
|
||||
&xx1,&yy1,&xx2,&yy2);
|
||||
#ifdef HAS_CAIRO
|
||||
if(customfont) cairo_restore(cairo_ctx);
|
||||
|
|
@ -883,21 +883,21 @@ void edit_symbol_property(int x)
|
|||
|
||||
i=selectedgroup[0].n;
|
||||
netlist_commands = 0;
|
||||
if ((xctx.inst[i].ptr + xctx.sym)->type!=NULL)
|
||||
netlist_commands = !strcmp( (xctx.inst[i].ptr+ xctx.sym)->type, "netlist_commands");
|
||||
if ((xctx->inst[i].ptr + xctx->sym)->type!=NULL)
|
||||
netlist_commands = !strcmp( (xctx->inst[i].ptr+ xctx->sym)->type, "netlist_commands");
|
||||
|
||||
if(xctx.inst[i].prop_ptr!=NULL) {
|
||||
if(xctx->inst[i].prop_ptr!=NULL) {
|
||||
if(netlist_commands && x==1) {
|
||||
tclsetvar("retval",get_tok_value( xctx.inst[i].prop_ptr,"value",0));
|
||||
tclsetvar("retval",get_tok_value( xctx->inst[i].prop_ptr,"value",0));
|
||||
} else {
|
||||
tclsetvar("retval",xctx.inst[i].prop_ptr);
|
||||
tclsetvar("retval",xctx->inst[i].prop_ptr);
|
||||
}
|
||||
}
|
||||
else {
|
||||
tclsetvar("retval","");
|
||||
}
|
||||
my_strdup(91, &old_prop, xctx.inst[i].prop_ptr);
|
||||
tclsetvar("symbol",xctx.inst[i].name);
|
||||
my_strdup(91, &old_prop, xctx->inst[i].prop_ptr);
|
||||
tclsetvar("symbol",xctx->inst[i].name);
|
||||
|
||||
if(x==0) {
|
||||
tcleval("edit_prop {Input property:}");
|
||||
|
|
@ -963,9 +963,9 @@ void update_symbol(const char *result, int x)
|
|||
bbox(BEGIN,0.0,0.0,0.0,0.0);
|
||||
if(show_pin_net_names) {
|
||||
prepare_netlist_structs(0);
|
||||
for(k = 0; k < (xctx.inst[i].ptr + xctx.sym)->rects[PINLAYER]; k++) {
|
||||
if( xctx.inst[i].node && xctx.inst[i].node[k]) {
|
||||
find_inst_to_be_redrawn(xctx.inst[i].node[k]);
|
||||
for(k = 0; k < (xctx->inst[i].ptr + xctx->sym)->rects[PINLAYER]; k++) {
|
||||
if( xctx->inst[i].node && xctx->inst[i].node[k]) {
|
||||
find_inst_to_be_redrawn(xctx->inst[i].node[k]);
|
||||
}
|
||||
}
|
||||
find_inst_hash_clear();
|
||||
|
|
@ -984,21 +984,21 @@ void update_symbol(const char *result, int x)
|
|||
to use for inst name (from symbol template) */
|
||||
prefix=0;
|
||||
sym_number = -1;
|
||||
if(strcmp(symbol, xctx.inst[i].name)) {
|
||||
if(strcmp(symbol, xctx->inst[i].name)) {
|
||||
set_modify(1);
|
||||
prepared_hash_instances=0;
|
||||
prepared_netlist_structs=0;
|
||||
prepared_hilight_structs=0;
|
||||
sym_number=match_symbol(symbol); /* check if exist */
|
||||
if(sym_number>=0) {
|
||||
prefix=(get_tok_value((xctx.sym+sym_number)->templ, "name",0))[0]; /* get new symbol prefix */
|
||||
prefix=(get_tok_value((xctx->sym+sym_number)->templ, "name",0))[0]; /* get new symbol prefix */
|
||||
}
|
||||
}
|
||||
|
||||
/* instance name prefix (1st char) changed? --> allow_change_name=1 */
|
||||
allow_change_name = 0;
|
||||
if(new_prop) {
|
||||
my_strdup(88, &name, get_tok_value(xctx.inst[i].prop_ptr, "name", 0));
|
||||
my_strdup(88, &name, get_tok_value(xctx->inst[i].prop_ptr, "name", 0));
|
||||
new_name = get_tok_value(new_prop, "name", 0);
|
||||
if(!name || new_name[0] != name[0]) allow_change_name = 1;
|
||||
}
|
||||
|
|
@ -1009,7 +1009,7 @@ void update_symbol(const char *result, int x)
|
|||
|
||||
/* 20171220 calculate bbox before changes to correctly redraw areas */
|
||||
/* must be recalculated as cairo text extents vary with zoom factor. */
|
||||
symbol_bbox(i, &xctx.inst[i].x1, &xctx.inst[i].y1, &xctx.inst[i].x2, &xctx.inst[i].y2);
|
||||
symbol_bbox(i, &xctx->inst[i].x1, &xctx->inst[i].y1, &xctx->inst[i].x2, &xctx->inst[i].y2);
|
||||
|
||||
if(sym_number>=0) /* changing symbol ! */
|
||||
{
|
||||
|
|
@ -1017,19 +1017,19 @@ void update_symbol(const char *result, int x)
|
|||
delete_inst_node(i); /* 20180208 fix crashing bug: delete node info if changing symbol */
|
||||
/* if number of pins is different we must delete these data *before* */
|
||||
/* changing ysmbol, otherwise i might end up deleting non allocated data. */
|
||||
my_strdup(82, &xctx.inst[i].name, rel_sym_path(symbol));
|
||||
my_strdup(82, &xctx->inst[i].name, rel_sym_path(symbol));
|
||||
if(event_reporting) {
|
||||
char n1[PATH_MAX];
|
||||
char n2[PATH_MAX];
|
||||
printf("xschem replace_symbol instance %s %s\n",
|
||||
escape_chars(n1, xctx.inst[i].instname, PATH_MAX),
|
||||
escape_chars(n1, xctx->inst[i].instname, PATH_MAX),
|
||||
escape_chars(n2, symbol, PATH_MAX)
|
||||
);
|
||||
fflush(stdout);
|
||||
}
|
||||
xctx.inst[i].ptr=sym_number; /* update instance to point to new symbol */
|
||||
xctx->inst[i].ptr=sym_number; /* update instance to point to new symbol */
|
||||
}
|
||||
bbox(ADD, xctx.inst[i].x1, xctx.inst[i].y1, xctx.inst[i].x2, xctx.inst[i].y2);
|
||||
bbox(ADD, xctx->inst[i].x1, xctx->inst[i].y1, xctx->inst[i].x2, xctx->inst[i].y2);
|
||||
|
||||
/* update property string from tcl dialog */
|
||||
if(!no_change_props)
|
||||
|
|
@ -1037,10 +1037,10 @@ void update_symbol(const char *result, int x)
|
|||
dbg(1, "update_symbol(): no_change_props=%d\n", no_change_props);
|
||||
if(only_different) {
|
||||
char * ss=NULL;
|
||||
my_strdup(119, &ss, xctx.inst[i].prop_ptr);
|
||||
my_strdup(119, &ss, xctx->inst[i].prop_ptr);
|
||||
if( set_different_token(&ss, new_prop, old_prop, 0, 0) ) {
|
||||
if(!pushed) { push_undo(); pushed=1;}
|
||||
my_strdup(111, &xctx.inst[i].prop_ptr, ss);
|
||||
my_strdup(111, &xctx->inst[i].prop_ptr, ss);
|
||||
set_modify(1);
|
||||
prepared_hash_instances=0;
|
||||
prepared_netlist_structs=0;
|
||||
|
|
@ -1050,10 +1050,10 @@ void update_symbol(const char *result, int x)
|
|||
}
|
||||
else {
|
||||
if(new_prop) {
|
||||
if(!xctx.inst[i].prop_ptr || strcmp(xctx.inst[i].prop_ptr, new_prop)) {
|
||||
dbg(1, "update_symbol(): changing prop: |%s| -> |%s|\n", xctx.inst[i].prop_ptr, new_prop);
|
||||
if(!xctx->inst[i].prop_ptr || strcmp(xctx->inst[i].prop_ptr, new_prop)) {
|
||||
dbg(1, "update_symbol(): changing prop: |%s| -> |%s|\n", xctx->inst[i].prop_ptr, new_prop);
|
||||
if(!pushed) { push_undo(); pushed=1;}
|
||||
my_strdup(84, &xctx.inst[i].prop_ptr, new_prop);
|
||||
my_strdup(84, &xctx->inst[i].prop_ptr, new_prop);
|
||||
set_modify(1);
|
||||
prepared_hash_instances=0;
|
||||
prepared_netlist_structs=0;
|
||||
|
|
@ -1061,7 +1061,7 @@ void update_symbol(const char *result, int x)
|
|||
}
|
||||
} else {
|
||||
if(!pushed) { push_undo(); pushed=1;}
|
||||
my_strdup(86, &xctx.inst[i].prop_ptr, "");
|
||||
my_strdup(86, &xctx->inst[i].prop_ptr, "");
|
||||
set_modify(1);
|
||||
prepared_hash_instances=0;
|
||||
prepared_netlist_structs=0;
|
||||
|
|
@ -1072,7 +1072,7 @@ void update_symbol(const char *result, int x)
|
|||
|
||||
|
||||
|
||||
new_name = get_tok_value(xctx.inst[i].prop_ptr, "name", 1); /* retain quotes in name if any */
|
||||
new_name = get_tok_value(xctx->inst[i].prop_ptr, "name", 1); /* retain quotes in name if any */
|
||||
if(new_name[0]) {
|
||||
if(allow_change_name || (lastselected == 1) ) my_strdup(153, &name, new_name);
|
||||
/* 20110325 only modify prefix if prefix not NUL */
|
||||
|
|
@ -1082,27 +1082,27 @@ void update_symbol(const char *result, int x)
|
|||
else
|
||||
name[1]=prefix; /* change prefix if changing symbol type; */
|
||||
}
|
||||
dbg(1, "update_symbol(): name=%s, inst[i].prop_ptr=%s\n", name, xctx.inst[i].prop_ptr);
|
||||
my_strdup(89, &ptr,subst_token(xctx.inst[i].prop_ptr, "name", name) );
|
||||
dbg(1, "update_symbol(): name=%s, inst[i].prop_ptr=%s\n", name, xctx->inst[i].prop_ptr);
|
||||
my_strdup(89, &ptr,subst_token(xctx->inst[i].prop_ptr, "name", name) );
|
||||
/* set name of current inst */
|
||||
|
||||
if(!pushed) { push_undo(); pushed=1;}
|
||||
if(!k) hash_all_names(i);
|
||||
new_prop_string(i, ptr, k, dis_uniq_names); /* set new prop_ptr */
|
||||
|
||||
type=xctx.sym[xctx.inst[i].ptr].type;
|
||||
type=xctx->sym[xctx->inst[i].ptr].type;
|
||||
cond= !type || !IS_LABEL_SH_OR_PIN(type);
|
||||
if(cond) xctx.inst[i].flags|=2; /* bit 1: flag for different textlayer for pin/labels */
|
||||
else xctx.inst[i].flags &=~2;
|
||||
if(cond) xctx->inst[i].flags|=2; /* bit 1: flag for different textlayer for pin/labels */
|
||||
else xctx->inst[i].flags &=~2;
|
||||
}
|
||||
|
||||
if(event_reporting) {
|
||||
char *ss=NULL;
|
||||
my_strdup(120, &ss, xctx.inst[i].prop_ptr);
|
||||
my_strdup(120, &ss, xctx->inst[i].prop_ptr);
|
||||
set_different_token(&ss, new_prop, old_prop, ELEMENT, i);
|
||||
my_free(730, &ss);
|
||||
}
|
||||
my_strdup2(90, &xctx.inst[i].instname, get_tok_value(xctx.inst[i].prop_ptr, "name",0));
|
||||
my_strdup2(90, &xctx->inst[i].instname, get_tok_value(xctx->inst[i].prop_ptr, "name",0));
|
||||
} /* end for(k=0;k<lastselected;k++) */
|
||||
|
||||
/* new symbol bbox after prop changes (may change due to text length) */
|
||||
|
|
@ -1113,8 +1113,8 @@ void update_symbol(const char *result, int x)
|
|||
for(k=0;k<lastselected;k++) {
|
||||
if(selectedgroup[k].type!=ELEMENT) continue;
|
||||
i=selectedgroup[k].n;
|
||||
symbol_bbox(i, &xctx.inst[i].x1, &xctx.inst[i].y1, &xctx.inst[i].x2, &xctx.inst[i].y2);
|
||||
bbox(ADD, xctx.inst[i].x1, xctx.inst[i].y1, xctx.inst[i].x2, xctx.inst[i].y2);
|
||||
symbol_bbox(i, &xctx->inst[i].x1, &xctx->inst[i].y1, &xctx->inst[i].x2, &xctx->inst[i].y2);
|
||||
bbox(ADD, xctx->inst[i].x1, xctx->inst[i].y1, xctx->inst[i].x2, xctx->inst[i].y2);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1125,9 +1125,9 @@ void update_symbol(const char *result, int x)
|
|||
\|/ */
|
||||
if(show_pin_net_names || hilight_nets) {
|
||||
prepare_netlist_structs(0);
|
||||
for(k = 0; k < (xctx.inst[i].ptr + xctx.sym)->rects[PINLAYER]; k++) {
|
||||
if( xctx.inst[i].node && xctx.inst[i].node[k]) {
|
||||
find_inst_to_be_redrawn(xctx.inst[i].node[k]);
|
||||
for(k = 0; k < (xctx->inst[i].ptr + xctx->sym)->rects[PINLAYER]; k++) {
|
||||
if( xctx->inst[i].node && xctx->inst[i].node[k]) {
|
||||
find_inst_to_be_redrawn(xctx->inst[i].node[k]);
|
||||
}
|
||||
}
|
||||
find_inst_hash_clear();
|
||||
|
|
@ -1170,27 +1170,27 @@ void change_elem_order(void)
|
|||
|
||||
if(selectedgroup[0].type==ELEMENT)
|
||||
{
|
||||
if(new_n>=xctx.instances) new_n=xctx.instances-1;
|
||||
tmpinst=xctx.inst[new_n];
|
||||
xctx.inst[new_n]=xctx.inst[selectedgroup[0].n];
|
||||
xctx.inst[selectedgroup[0].n]=tmpinst;
|
||||
if(new_n>=xctx->instances) new_n=xctx->instances-1;
|
||||
tmpinst=xctx->inst[new_n];
|
||||
xctx->inst[new_n]=xctx->inst[selectedgroup[0].n];
|
||||
xctx->inst[selectedgroup[0].n]=tmpinst;
|
||||
dbg(1, "change_elem_order(): selected element %d\n", selectedgroup[0].n);
|
||||
}
|
||||
else if(selectedgroup[0].type==xRECT)
|
||||
{
|
||||
c=selectedgroup[0].col;
|
||||
if(new_n>=xctx.rects[c]) new_n=xctx.rects[c]-1;
|
||||
tmpbox=xctx.rect[c][new_n];
|
||||
xctx.rect[c][new_n]=xctx.rect[c][selectedgroup[0].n];
|
||||
xctx.rect[c][selectedgroup[0].n]=tmpbox;
|
||||
if(new_n>=xctx->rects[c]) new_n=xctx->rects[c]-1;
|
||||
tmpbox=xctx->rect[c][new_n];
|
||||
xctx->rect[c][new_n]=xctx->rect[c][selectedgroup[0].n];
|
||||
xctx->rect[c][selectedgroup[0].n]=tmpbox;
|
||||
dbg(1, "change_elem_order(): selected element %d\n", selectedgroup[0].n);
|
||||
}
|
||||
else if(selectedgroup[0].type==WIRE)
|
||||
{
|
||||
if(new_n>=xctx.wires) new_n=xctx.wires-1;
|
||||
tmpwire=xctx.wire[new_n];
|
||||
xctx.wire[new_n]=xctx.wire[selectedgroup[0].n];
|
||||
xctx.wire[selectedgroup[0].n]=tmpwire;
|
||||
if(new_n>=xctx->wires) new_n=xctx->wires-1;
|
||||
tmpwire=xctx->wire[new_n];
|
||||
xctx->wire[new_n]=xctx->wire[selectedgroup[0].n];
|
||||
xctx->wire[selectedgroup[0].n]=tmpwire;
|
||||
dbg(1, "change_elem_order(): selected element %d\n", selectedgroup[0].n);
|
||||
}
|
||||
need_rebuild_selected_array = 1;
|
||||
|
|
@ -1210,32 +1210,32 @@ void edit_property(int x)
|
|||
char *new_prop = NULL;
|
||||
|
||||
if(netlist_type==CAD_SYMBOL_ATTRS) {
|
||||
if(xctx.schsymbolprop!=NULL)
|
||||
tclsetvar("retval",xctx.schsymbolprop);
|
||||
if(xctx->schsymbolprop!=NULL)
|
||||
tclsetvar("retval",xctx->schsymbolprop);
|
||||
else
|
||||
tclsetvar("retval","");
|
||||
}
|
||||
else if(netlist_type==CAD_VHDL_NETLIST) {
|
||||
if(xctx.schvhdlprop!=NULL)
|
||||
tclsetvar("retval",xctx.schvhdlprop);
|
||||
if(xctx->schvhdlprop!=NULL)
|
||||
tclsetvar("retval",xctx->schvhdlprop);
|
||||
else
|
||||
tclsetvar("retval","");
|
||||
}
|
||||
else if(netlist_type==CAD_VERILOG_NETLIST) {
|
||||
if(xctx.schverilogprop!=NULL)
|
||||
tclsetvar("retval",xctx.schverilogprop);
|
||||
if(xctx->schverilogprop!=NULL)
|
||||
tclsetvar("retval",xctx->schverilogprop);
|
||||
else
|
||||
tclsetvar("retval","");
|
||||
}
|
||||
else if(netlist_type==CAD_SPICE_NETLIST) {
|
||||
if(xctx.schprop!=NULL)
|
||||
tclsetvar("retval",xctx.schprop);
|
||||
if(xctx->schprop!=NULL)
|
||||
tclsetvar("retval",xctx->schprop);
|
||||
else
|
||||
tclsetvar("retval","");
|
||||
}
|
||||
else if(netlist_type==CAD_TEDAX_NETLIST) {
|
||||
if(xctx.schtedaxprop!=NULL)
|
||||
tclsetvar("retval",xctx.schtedaxprop);
|
||||
if(xctx->schtedaxprop!=NULL)
|
||||
tclsetvar("retval",xctx->schtedaxprop);
|
||||
else
|
||||
tclsetvar("retval","");
|
||||
}
|
||||
|
|
@ -1258,44 +1258,44 @@ void edit_property(int x)
|
|||
|
||||
if(strcmp(tclgetvar("rcode"),"") )
|
||||
{
|
||||
if(netlist_type==CAD_SYMBOL_ATTRS && /* 20120228 check if xctx.schprop NULL */
|
||||
(!xctx.schsymbolprop || strcmp(xctx.schsymbolprop, tclgetvar("retval") ) ) ) {
|
||||
if(netlist_type==CAD_SYMBOL_ATTRS &&
|
||||
(!xctx->schsymbolprop || strcmp(xctx->schsymbolprop, tclgetvar("retval") ) ) ) {
|
||||
set_modify(1); push_undo();
|
||||
my_strdup(422, &xctx.schsymbolprop, (char *) tclgetvar("retval"));
|
||||
my_strdup(422, &xctx->schsymbolprop, (char *) tclgetvar("retval"));
|
||||
|
||||
} else if(netlist_type==CAD_VERILOG_NETLIST && /* 20120228 check if xctx.schverilogprop NULL */
|
||||
(!xctx.schverilogprop || strcmp(xctx.schverilogprop, tclgetvar("retval") ) ) ) {
|
||||
} else if(netlist_type==CAD_VERILOG_NETLIST &&
|
||||
(!xctx->schverilogprop || strcmp(xctx->schverilogprop, tclgetvar("retval") ) ) ) {
|
||||
set_modify(1); push_undo();
|
||||
my_strdup(94, &xctx.schverilogprop, (char *) tclgetvar("retval"));
|
||||
my_strdup(94, &xctx->schverilogprop, (char *) tclgetvar("retval"));
|
||||
|
||||
} else if(netlist_type==CAD_SPICE_NETLIST && /* 20120228 check if xctx.schprop NULL */
|
||||
(!xctx.schprop || strcmp(xctx.schprop, tclgetvar("retval") ) ) ) {
|
||||
} else if(netlist_type==CAD_SPICE_NETLIST &&
|
||||
(!xctx->schprop || strcmp(xctx->schprop, tclgetvar("retval") ) ) ) {
|
||||
set_modify(1); push_undo();
|
||||
my_strdup(95, &xctx.schprop, (char *) tclgetvar("retval"));
|
||||
my_strdup(95, &xctx->schprop, (char *) tclgetvar("retval"));
|
||||
|
||||
} else if(netlist_type==CAD_TEDAX_NETLIST && /* 20120228 check if xctx.schprop NULL */
|
||||
(!xctx.schtedaxprop || strcmp(xctx.schtedaxprop, tclgetvar("retval") ) ) ) {
|
||||
} else if(netlist_type==CAD_TEDAX_NETLIST &&
|
||||
(!xctx->schtedaxprop || strcmp(xctx->schtedaxprop, tclgetvar("retval") ) ) ) {
|
||||
set_modify(1); push_undo();
|
||||
my_strdup(96, &xctx.schtedaxprop, (char *) tclgetvar("retval"));
|
||||
my_strdup(96, &xctx->schtedaxprop, (char *) tclgetvar("retval"));
|
||||
|
||||
} else if(netlist_type==CAD_VHDL_NETLIST && /* 20120228 check if xctx.schvhdlprop NULL */
|
||||
(!xctx.schvhdlprop || strcmp(xctx.schvhdlprop, tclgetvar("retval") ) ) ) { /* netlist_type==CAD_VHDL_NETLIST */
|
||||
} else if(netlist_type==CAD_VHDL_NETLIST &&
|
||||
(!xctx->schvhdlprop || strcmp(xctx->schvhdlprop, tclgetvar("retval") ) ) ) {
|
||||
set_modify(1); push_undo();
|
||||
my_strdup(97, &xctx.schvhdlprop, (char *) tclgetvar("retval"));
|
||||
my_strdup(97, &xctx->schvhdlprop, (char *) tclgetvar("retval"));
|
||||
}
|
||||
}
|
||||
|
||||
/* update the bounding box of vhdl "architecture" instances that embed */
|
||||
/* the xctx.schvhdlprop string. 04102001 */
|
||||
for(j=0;j<xctx.instances;j++)
|
||||
/* the xctx->schvhdlprop string. 04102001 */
|
||||
for(j=0;j<xctx->instances;j++)
|
||||
{
|
||||
if( xctx.inst[j].ptr !=-1 &&
|
||||
(xctx.inst[j].ptr+ xctx.sym)->type &&
|
||||
!strcmp( (xctx.inst[j].ptr+ xctx.sym)->type, "architecture") )
|
||||
if( xctx->inst[j].ptr !=-1 &&
|
||||
(xctx->inst[j].ptr+ xctx->sym)->type &&
|
||||
!strcmp( (xctx->inst[j].ptr+ xctx->sym)->type, "architecture") )
|
||||
{
|
||||
dbg(1, "edit_property(): updating vhdl architecture\n");
|
||||
symbol_bbox(j, &xctx.inst[j].x1, &xctx.inst[j].y1,
|
||||
&xctx.inst[j].x2, &xctx.inst[j].y2);
|
||||
symbol_bbox(j, &xctx->inst[j].x1, &xctx->inst[j].y1,
|
||||
&xctx->inst[j].x2, &xctx->inst[j].y2);
|
||||
}
|
||||
} /* end for(j */
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -33,9 +33,9 @@ void find_closest_net(double mx,double my)
|
|||
int i,w=-1;
|
||||
double threshold = CADWIREMINDIST * CADWIREMINDIST * cadgrid * cadgrid / 400;
|
||||
|
||||
for(i=0;i<xctx.wires;i++)
|
||||
for(i=0;i<xctx->wires;i++)
|
||||
{
|
||||
if( (tmp = dist(xctx.wire[i].x1,xctx.wire[i].y1,xctx.wire[i].x2,xctx.wire[i].y2,mx,my)) < distance )
|
||||
if( (tmp = dist(xctx->wire[i].x1,xctx->wire[i].y1,xctx->wire[i].x2,xctx->wire[i].y2,mx,my)) < distance )
|
||||
{
|
||||
w = i; distance = tmp;
|
||||
}
|
||||
|
|
@ -56,14 +56,14 @@ void find_closest_polygon(double mx,double my)
|
|||
double threshold = CADWIREMINDIST * CADWIREMINDIST * cadgrid * cadgrid / 400;
|
||||
for(c=0;c<cadlayers;c++)
|
||||
{
|
||||
for(i=0;i<xctx.polygons[c];i++)
|
||||
for(i=0;i<xctx->polygons[c];i++)
|
||||
{
|
||||
/*fprintf(errfp, "points=%d\n", xctx.poly[c][i].points); */
|
||||
for(j=0; j<xctx.poly[c][i].points-1; j++) {
|
||||
x1 = xctx.poly[c][i].x[j];
|
||||
y1 = xctx.poly[c][i].y[j];
|
||||
x2 = xctx.poly[c][i].x[j+1];
|
||||
y2 = xctx.poly[c][i].y[j+1];
|
||||
/*fprintf(errfp, "points=%d\n", xctx->poly[c][i].points); */
|
||||
for(j=0; j<xctx->poly[c][i].points-1; j++) {
|
||||
x1 = xctx->poly[c][i].x[j];
|
||||
y1 = xctx->poly[c][i].y[j];
|
||||
x2 = xctx->poly[c][i].x[j+1];
|
||||
y2 = xctx->poly[c][i].y[j+1];
|
||||
ORDER(x1,y1,x2,y2);
|
||||
if( (tmp = dist(x1, y1, x2, y2, mx, my)) < distance )
|
||||
{
|
||||
|
|
@ -89,9 +89,9 @@ void find_closest_line(double mx,double my)
|
|||
double threshold = CADWIREMINDIST * CADWIREMINDIST * cadgrid * cadgrid / 400;
|
||||
for(c=0;c<cadlayers;c++)
|
||||
{
|
||||
for(i=0;i<xctx.lines[c];i++)
|
||||
for(i=0;i<xctx->lines[c];i++)
|
||||
{
|
||||
if( (tmp = dist(xctx.line[c][i].x1,xctx.line[c][i].y1,xctx.line[c][i].x2,xctx.line[c][i].y2,mx,my))
|
||||
if( (tmp = dist(xctx->line[c][i].x1,xctx->line[c][i].y1,xctx->line[c][i].x2,xctx->line[c][i].y2,mx,my))
|
||||
< distance )
|
||||
{
|
||||
l = i; distance = tmp;col = c;
|
||||
|
|
@ -115,18 +115,18 @@ void find_closest_net_or_symbol_pin(double mx,double my, double *x, double *y)
|
|||
char *type=NULL;
|
||||
|
||||
distance = DBL_MAX;
|
||||
for(i=0;i<xctx.instances;i++) {
|
||||
x0=xctx.inst[i].x0;
|
||||
y0=xctx.inst[i].y0;
|
||||
rot = xctx.inst[i].rot;
|
||||
flip = xctx.inst[i].flip;
|
||||
my_strdup(133, &type,(xctx.inst[i].ptr+ xctx.sym)->type);
|
||||
for(i=0;i<xctx->instances;i++) {
|
||||
x0=xctx->inst[i].x0;
|
||||
y0=xctx->inst[i].y0;
|
||||
rot = xctx->inst[i].rot;
|
||||
flip = xctx->inst[i].flip;
|
||||
my_strdup(133, &type,(xctx->inst[i].ptr+ xctx->sym)->type);
|
||||
if(!type) continue;
|
||||
|
||||
no_of_pin_rects = (xctx.inst[i].ptr+ xctx.sym)->rects[PINLAYER];
|
||||
no_of_pin_rects = (xctx->inst[i].ptr+ xctx->sym)->rects[PINLAYER];
|
||||
if(IS_LABEL_OR_PIN(type)) no_of_pin_rects=1;
|
||||
for(j=0; j<no_of_pin_rects; j++) {
|
||||
box = ((xctx.inst[i].ptr+ xctx.sym)->rect[PINLAYER])[j];
|
||||
box = ((xctx->inst[i].ptr+ xctx->sym)->rect[PINLAYER])[j];
|
||||
ROTATION(0.0,0.0,box.x1,box.y1,x1,y1);
|
||||
ROTATION(0.0,0.0,box.x2,box.y2,x2,y2);
|
||||
x1 += x0;
|
||||
|
|
@ -143,17 +143,17 @@ void find_closest_net_or_symbol_pin(double mx,double my, double *x, double *y)
|
|||
}
|
||||
}
|
||||
}
|
||||
for(i=0;i<xctx.wires; i++) {
|
||||
xx=xctx.wire[i].x1;
|
||||
yy = xctx.wire[i].y1;
|
||||
for(i=0;i<xctx->wires; i++) {
|
||||
xx=xctx->wire[i].x1;
|
||||
yy = xctx->wire[i].y1;
|
||||
dist = (mx - xx) * (mx - xx) + (my - yy) * (my - yy);
|
||||
if(dist < distance) {
|
||||
distance = dist;
|
||||
min_dist_x = xx;
|
||||
min_dist_y = yy;
|
||||
}
|
||||
xx=xctx.wire[i].x2;
|
||||
yy = xctx.wire[i].y2;
|
||||
xx=xctx->wire[i].x2;
|
||||
yy = xctx->wire[i].y2;
|
||||
dist = (mx - xx) * (mx - xx) + (my - yy) * (my - yy);
|
||||
if(dist < distance) {
|
||||
distance = dist;
|
||||
|
|
@ -175,18 +175,18 @@ void find_closest_arc(double mx,double my)
|
|||
|
||||
for(c=0;c<cadlayers;c++)
|
||||
{
|
||||
for(i=0;i<xctx.arcs[c];i++)
|
||||
for(i=0;i<xctx->arcs[c];i++)
|
||||
{
|
||||
dist = sqrt(pow(mx-xctx.arc[c][i].x,2) + pow(my-xctx.arc[c][i].y,2)) - xctx.arc[c][i].r;
|
||||
dist = sqrt(pow(mx-xctx->arc[c][i].x,2) + pow(my-xctx->arc[c][i].y,2)) - xctx->arc[c][i].r;
|
||||
dist *= dist; /* square distance */
|
||||
angle = fmod(atan2(xctx.arc[c][i].y-my, mx-xctx.arc[c][i].x)*180./XSCH_PI, 360.);
|
||||
angle = fmod(atan2(xctx->arc[c][i].y-my, mx-xctx->arc[c][i].x)*180./XSCH_PI, 360.);
|
||||
if(angle<0.) angle +=360.;
|
||||
angle1 = xctx.arc[c][i].a;
|
||||
angle2 = fmod(xctx.arc[c][i].a + xctx.arc[c][i].b, 360.);
|
||||
angle1 = xctx->arc[c][i].a;
|
||||
angle2 = fmod(xctx->arc[c][i].a + xctx->arc[c][i].b, 360.);
|
||||
|
||||
match=0;
|
||||
if(dist < distance) {
|
||||
if(xctx.arc[c][i].b==360.) match=1;
|
||||
if(xctx->arc[c][i].b==360.) match=1;
|
||||
if(angle2<angle1) {
|
||||
if(angle >= angle1 || angle<= angle2) {
|
||||
match=1;
|
||||
|
|
@ -199,7 +199,7 @@ void find_closest_arc(double mx,double my)
|
|||
}
|
||||
dbg(1, "find_closest_arc(): dist = %g, angle = %g\n", dist, angle);
|
||||
dbg(1, "find_closest_arc(): center=%g,%g: mouse: %g:%g\n",
|
||||
xctx.arc[c][i].x, xctx.arc[c][i].y, mx, my);
|
||||
xctx->arc[c][i].x, xctx->arc[c][i].y, mx, my);
|
||||
if(match ) {
|
||||
dbg(1, "find_closest_arc(): i = %d\n", i);
|
||||
r = i;
|
||||
|
|
@ -208,7 +208,7 @@ void find_closest_arc(double mx,double my)
|
|||
}
|
||||
} /* end for i */
|
||||
} /* end for c */
|
||||
if( r!=-1 && distance <= thres ) /* * pow(xctx.arc[col][r].r,2)) */
|
||||
if( r!=-1 && distance <= thres ) /* * pow(xctx->arc[col][r].r,2)) */
|
||||
{
|
||||
sel.n = r; sel.type = ARC; sel.col = col;
|
||||
}
|
||||
|
|
@ -221,12 +221,12 @@ void find_closest_box(double mx,double my)
|
|||
int i,c,r=-1, col = 0;
|
||||
for(c=0;c<cadlayers;c++)
|
||||
{
|
||||
for(i=0;i<xctx.rects[c];i++)
|
||||
for(i=0;i<xctx->rects[c];i++)
|
||||
{
|
||||
if( POINTINSIDE(mx,my,xctx.rect[c][i].x1,xctx.rect[c][i].y1,xctx.rect[c][i].x2,xctx.rect[c][i].y2) )
|
||||
if( POINTINSIDE(mx,my,xctx->rect[c][i].x1,xctx->rect[c][i].y1,xctx->rect[c][i].x2,xctx->rect[c][i].y2) )
|
||||
{
|
||||
tmp=dist_from_rect(mx,my,xctx.rect[c][i].x1,xctx.rect[c][i].y1,
|
||||
xctx.rect[c][i].x2,xctx.rect[c][i].y2);
|
||||
tmp=dist_from_rect(mx,my,xctx->rect[c][i].x1,xctx->rect[c][i].y1,
|
||||
xctx->rect[c][i].x2,xctx->rect[c][i].y2);
|
||||
if(tmp < distance)
|
||||
{
|
||||
r = i; distance = tmp;col = c;
|
||||
|
|
@ -245,13 +245,13 @@ void find_closest_element(double mx,double my)
|
|||
{
|
||||
double tmp;
|
||||
int i,r=-1;
|
||||
for(i=0;i<xctx.instances;i++)
|
||||
for(i=0;i<xctx->instances;i++)
|
||||
{
|
||||
dbg(2, "find_closest_element(): %s: %g %g %g %g\n",
|
||||
xctx.inst[i].instname, xctx.inst[i].x1,xctx.inst[i].y1,xctx.inst[i].x2,xctx.inst[i].y2);
|
||||
if( POINTINSIDE(mx,my,xctx.inst[i].x1,xctx.inst[i].y1,xctx.inst[i].x2,xctx.inst[i].y2) )
|
||||
xctx->inst[i].instname, xctx->inst[i].x1,xctx->inst[i].y1,xctx->inst[i].x2,xctx->inst[i].y2);
|
||||
if( POINTINSIDE(mx,my,xctx->inst[i].x1,xctx->inst[i].y1,xctx->inst[i].x2,xctx->inst[i].y2) )
|
||||
{
|
||||
tmp=pow(mx-(xctx.inst[i].xx1 + xctx.inst[i].xx2)/2, 2)+pow(my-(xctx.inst[i].yy1 + xctx.inst[i].yy2)/2, 2);
|
||||
tmp=pow(mx-(xctx->inst[i].xx1 + xctx->inst[i].xx2)/2, 2)+pow(my-(xctx->inst[i].yy1 + xctx->inst[i].yy2)/2, 2);
|
||||
if(tmp*0.1 < distance)
|
||||
{
|
||||
r = i; distance = tmp*0.1;
|
||||
|
|
@ -274,16 +274,16 @@ void find_closest_text(double mx,double my)
|
|||
#ifdef HAS_CAIRO
|
||||
int customfont;
|
||||
#endif
|
||||
for(i=0;i<xctx.texts;i++)
|
||||
for(i=0;i<xctx->texts;i++)
|
||||
{
|
||||
rot = xctx.text[i].rot;
|
||||
flip = xctx.text[i].flip;
|
||||
rot = xctx->text[i].rot;
|
||||
flip = xctx->text[i].flip;
|
||||
#ifdef HAS_CAIRO
|
||||
customfont = set_text_custom_font(&xctx.text[i]);
|
||||
customfont = set_text_custom_font(&xctx->text[i]);
|
||||
#endif
|
||||
text_bbox(xctx.text[i].txt_ptr,
|
||||
xctx.text[i].xscale, xctx.text[i].yscale, rot, flip, xctx.text[i].hcenter, xctx.text[i].vcenter,
|
||||
xctx.text[i].x0, xctx.text[i].y0,
|
||||
text_bbox(xctx->text[i].txt_ptr,
|
||||
xctx->text[i].xscale, xctx->text[i].yscale, rot, flip, xctx->text[i].hcenter, xctx->text[i].vcenter,
|
||||
xctx->text[i].x0, xctx->text[i].y0,
|
||||
&xx1,&yy1, &xx2,&yy2);
|
||||
#ifdef HAS_CAIRO
|
||||
if(customfont) cairo_restore(cairo_ctx);
|
||||
|
|
|
|||
14
src/font.c
14
src/font.c
|
|
@ -27,7 +27,7 @@ void compile_font(void)
|
|||
int code, i;
|
||||
char name[PATH_MAX];
|
||||
|
||||
xctx.currsch = 0;
|
||||
xctx->currsch = 0;
|
||||
my_snprintf(name, S(name), "%s/systemlib/font.sch", tclgetvar("XSCHEM_SHAREDIR"));
|
||||
unselect_all();
|
||||
remove_symbols();
|
||||
|
|
@ -44,13 +44,13 @@ void compile_font(void)
|
|||
for(i=0;i<lastselected;i++)
|
||||
{
|
||||
character[code][i*4+1] =
|
||||
xctx.line[selectedgroup[i].col][selectedgroup[i].n].x1-code*FONTOFFSET;
|
||||
xctx->line[selectedgroup[i].col][selectedgroup[i].n].x1-code*FONTOFFSET;
|
||||
character[code][i*4+2] =
|
||||
xctx.line[selectedgroup[i].col][selectedgroup[i].n].y1+FONTHEIGHT;
|
||||
xctx->line[selectedgroup[i].col][selectedgroup[i].n].y1+FONTHEIGHT;
|
||||
character[code][i*4+3] =
|
||||
xctx.line[selectedgroup[i].col][selectedgroup[i].n].x2-code*FONTOFFSET;
|
||||
xctx->line[selectedgroup[i].col][selectedgroup[i].n].x2-code*FONTOFFSET;
|
||||
character[code][i*4+4] =
|
||||
xctx.line[selectedgroup[i].col][selectedgroup[i].n].y2+FONTHEIGHT;
|
||||
xctx->line[selectedgroup[i].col][selectedgroup[i].n].y2+FONTHEIGHT;
|
||||
dbg(2, ",\n%.16g,%.16g,%.16g,%.16g",
|
||||
character[code][i*4+1],character[code][i*4+2],
|
||||
character[code][i*4+3],character[code][i*4+4]);
|
||||
|
|
@ -59,8 +59,8 @@ void compile_font(void)
|
|||
}
|
||||
clear_drawing();
|
||||
unselect_all();
|
||||
xctx.currsch = 0;
|
||||
my_strncpy(xctx.sch[xctx.currsch], "", S(xctx.sch[xctx.currsch]));
|
||||
xctx->currsch = 0;
|
||||
my_strncpy(xctx->sch[xctx->currsch], "", S(xctx->sch[xctx->currsch]));
|
||||
if(event_reporting) {
|
||||
printf("xschem clear_drawing\n");
|
||||
printf("xschem unselect_all\n");
|
||||
|
|
|
|||
|
|
@ -256,4 +256,4 @@ int show_erc=1;
|
|||
int hilight_nets=0;
|
||||
|
||||
/* following data is relative to the current schematic */
|
||||
Xschem_ctx xctx;
|
||||
Xschem_ctx *xctx;
|
||||
|
|
|
|||
|
|
@ -33,9 +33,9 @@ static unsigned short *wireflag=NULL;
|
|||
|
||||
void init_inst_iterator(double x1, double y1, double x2, double y2)
|
||||
{
|
||||
dbg(3, "init_inst_iterator(): instances=%d\n", xctx.instances);
|
||||
my_realloc(135, &instflag, xctx.instances*sizeof(unsigned short));
|
||||
memset(instflag, 0, xctx.instances*sizeof(unsigned short));
|
||||
dbg(3, "init_inst_iterator(): instances=%d\n", xctx->instances);
|
||||
my_realloc(135, &instflag, xctx->instances*sizeof(unsigned short));
|
||||
memset(instflag, 0, xctx->instances*sizeof(unsigned short));
|
||||
/* calculate square 4 1st corner of drawing area */
|
||||
x1a=floor(x1/BOXSIZE) ;
|
||||
y1a=floor(y1/BOXSIZE) ;
|
||||
|
|
@ -58,7 +58,7 @@ void init_inst_iterator(double x1, double y1, double x2, double y2)
|
|||
struct instentry *inst_iterator_next()
|
||||
{
|
||||
struct instentry *ptr;
|
||||
dbg(3, "inst_iterator_next(): instances=%d\n", xctx.instances);
|
||||
dbg(3, "inst_iterator_next(): instances=%d\n", xctx->instances);
|
||||
while(1) {
|
||||
while(instanceptr) {
|
||||
ptr = instanceptr;
|
||||
|
|
@ -91,9 +91,9 @@ struct instentry *inst_iterator_next()
|
|||
|
||||
void init_wire_iterator(double x1, double y1, double x2, double y2)
|
||||
{
|
||||
dbg(3, "init_wire_iterator(): wires=%d\n", xctx.wires);
|
||||
my_realloc(136, &wireflag, xctx.wires*sizeof(unsigned short));
|
||||
memset(wireflag, 0, xctx.wires*sizeof(unsigned short));
|
||||
dbg(3, "init_wire_iterator(): wires=%d\n", xctx->wires);
|
||||
my_realloc(136, &wireflag, xctx->wires*sizeof(unsigned short));
|
||||
memset(wireflag, 0, xctx->wires*sizeof(unsigned short));
|
||||
/* calculate square 4 1st corner of drawing area */
|
||||
x1a=floor(x1/BOXSIZE) ;
|
||||
y1a=floor(y1/BOXSIZE) ;
|
||||
|
|
@ -116,7 +116,7 @@ void init_wire_iterator(double x1, double y1, double x2, double y2)
|
|||
struct wireentry *wire_iterator_next()
|
||||
{
|
||||
struct wireentry *ptr;
|
||||
dbg(3, "wire_iterator_next(): wires=%d\n", xctx.wires);
|
||||
dbg(3, "wire_iterator_next(): wires=%d\n", xctx->wires);
|
||||
while(1) {
|
||||
while(wireptr) {
|
||||
ptr = wireptr;
|
||||
|
|
|
|||
236
src/hilight.c
236
src/hilight.c
|
|
@ -32,7 +32,7 @@ static unsigned int hash(const char *tok)
|
|||
char *str;
|
||||
int c;
|
||||
|
||||
str=xctx.sch_path[xctx.currsch];
|
||||
str=xctx->sch_path[xctx->currsch];
|
||||
while ( (c = *tok++) )
|
||||
hash = c + (hash << 6) + (hash << 16) - hash;
|
||||
while ( (c = *str++) )
|
||||
|
|
@ -122,7 +122,7 @@ void create_plot_cmd(int viewer)
|
|||
tok = entry->token;
|
||||
node_entry = bus_hash_lookup(tok, "", XLOOKUP, 0, "", "", "", "");
|
||||
if(tok[0] == '#') tok++;
|
||||
if(node_entry && !strcmp(xctx.sch_path[xctx.currsch], entry->path) &&
|
||||
if(node_entry && !strcmp(xctx->sch_path[xctx->currsch], entry->path) &&
|
||||
(node_entry->d.port == 0 || !strcmp(entry->path, ".") )) {
|
||||
c = get_color(entry->value);
|
||||
sprintf(color_str, "%02x%02x%02x", xcolor_array[c].red>>8, xcolor_array[c].green>>8, xcolor_array[c].blue>>8);
|
||||
|
|
@ -204,7 +204,7 @@ struct hilight_hashentry *hilight_lookup(const char *token, int value, int remov
|
|||
entry->token = NULL;
|
||||
my_strdup(138, &(entry->token),token);
|
||||
entry->path = NULL;
|
||||
my_strdup(139, &(entry->path),xctx.sch_path[xctx.currsch]);
|
||||
my_strdup(139, &(entry->path),xctx->sch_path[xctx->currsch]);
|
||||
entry->value=value;
|
||||
entry->hash=hashcode;
|
||||
*preventry=entry;
|
||||
|
|
@ -214,7 +214,7 @@ struct hilight_hashentry *hilight_lookup(const char *token, int value, int remov
|
|||
return NULL; /* whether inserted or not return NULL since it was not in */
|
||||
}
|
||||
if( entry -> hash==hashcode && !strcmp(token,entry->token) &&
|
||||
!strcmp(xctx.sch_path[xctx.currsch], entry->path) ) /* found matching tok */
|
||||
!strcmp(xctx->sch_path[xctx->currsch], entry->path) ) /* found matching tok */
|
||||
{
|
||||
if(remove==XDELETE) /* remove token from the hash table ... */
|
||||
{
|
||||
|
|
@ -294,8 +294,8 @@ void delete_hilight_net(void)
|
|||
}
|
||||
|
||||
hilight_nets=0;
|
||||
for(i=0;i<xctx.instances;i++) {
|
||||
xctx.inst[i].flags &= ~4 ;
|
||||
for(i=0;i<xctx->instances;i++) {
|
||||
xctx->inst[i].flags &= ~4 ;
|
||||
}
|
||||
dbg(1, "delete_hilight_net(): clearing\n");
|
||||
my_free(766, &inst_color);
|
||||
|
|
@ -313,27 +313,27 @@ void hilight_parent_pins(void)
|
|||
|
||||
if(!hilight_nets) return;
|
||||
prepare_netlist_structs(0);
|
||||
i=xctx.previous_instance[xctx.currsch];
|
||||
inst_number = xctx.sch_inst_number[xctx.currsch+1];
|
||||
dbg(1, "hilight_parent_pins(): previous_instance=%d\n", xctx.previous_instance[xctx.currsch]);
|
||||
i=xctx->previous_instance[xctx->currsch];
|
||||
inst_number = xctx->sch_inst_number[xctx->currsch+1];
|
||||
dbg(1, "hilight_parent_pins(): previous_instance=%d\n", xctx->previous_instance[xctx->currsch]);
|
||||
dbg(1, "hilight_parent_pins(): inst_number=%d\n", inst_number);
|
||||
|
||||
rects = (xctx.inst[i].ptr+ xctx.sym)->rects[PINLAYER];
|
||||
rects = (xctx->inst[i].ptr+ xctx->sym)->rects[PINLAYER];
|
||||
|
||||
for(j=0;j<rects;j++)
|
||||
{
|
||||
if(!xctx.inst[i].node[j]) continue;
|
||||
my_strdup(445, &net_node, expandlabel(xctx.inst[i].node[j], &net_mult));
|
||||
if(!xctx->inst[i].node[j]) continue;
|
||||
my_strdup(445, &net_node, expandlabel(xctx->inst[i].node[j], &net_mult));
|
||||
dbg(1, "hilight_parent_pins(): net_node=%s\n", net_node);
|
||||
pin_name = get_tok_value((xctx.inst[i].ptr+ xctx.sym)->rect[PINLAYER][j].prop_ptr,"name",0);
|
||||
pin_name = get_tok_value((xctx->inst[i].ptr+ xctx->sym)->rect[PINLAYER][j].prop_ptr,"name",0);
|
||||
if(!pin_name[0]) continue;
|
||||
my_strdup(450, &pin_node, expandlabel(pin_name, &mult));
|
||||
dbg(1, "hilight_parent_pins(): pin_node=%s\n", pin_node);
|
||||
|
||||
for(k = 1; k<=mult; k++) {
|
||||
xctx.currsch++;
|
||||
xctx->currsch++;
|
||||
entry = bus_hilight_lookup(find_nth(pin_node, ',', k), 0, XLOOKUP);
|
||||
xctx.currsch--;
|
||||
xctx->currsch--;
|
||||
if(entry)
|
||||
{
|
||||
bus_hilight_lookup(find_nth(net_node, ',',
|
||||
|
|
@ -359,19 +359,19 @@ void hilight_child_pins(void)
|
|||
struct hilight_hashentry *entry;
|
||||
int mult, net_mult, i, inst_number;
|
||||
|
||||
i = xctx.previous_instance[xctx.currsch-1];
|
||||
i = xctx->previous_instance[xctx->currsch-1];
|
||||
if(!hilight_nets) return;
|
||||
prepare_netlist_structs(0);
|
||||
rects = (xctx.inst[i].ptr+ xctx.sym)->rects[PINLAYER];
|
||||
inst_number = xctx.sch_inst_number[xctx.currsch];
|
||||
rects = (xctx->inst[i].ptr+ xctx->sym)->rects[PINLAYER];
|
||||
inst_number = xctx->sch_inst_number[xctx->currsch];
|
||||
for(j=0;j<rects;j++)
|
||||
{
|
||||
dbg(1, "inst_number=%d\n", inst_number);
|
||||
|
||||
if(!xctx.inst[i].node[j]) continue;
|
||||
my_strdup(508, &net_node, expandlabel(xctx.inst[i].node[j], &net_mult));
|
||||
if(!xctx->inst[i].node[j]) continue;
|
||||
my_strdup(508, &net_node, expandlabel(xctx->inst[i].node[j], &net_mult));
|
||||
dbg(1, "hilight_child_pins(): net_node=%s\n", net_node);
|
||||
pin_name = get_tok_value((xctx.inst[i].ptr+ xctx.sym)->rect[PINLAYER][j].prop_ptr,"name",0);
|
||||
pin_name = get_tok_value((xctx->inst[i].ptr+ xctx->sym)->rect[PINLAYER][j].prop_ptr,"name",0);
|
||||
if(!pin_name[0]) continue;
|
||||
my_strdup(521, &pin_node, expandlabel(pin_name, &mult));
|
||||
dbg(1, "hilight_child_pins(): pin_node=%s\n", pin_node);
|
||||
|
|
@ -380,9 +380,9 @@ void hilight_child_pins(void)
|
|||
(inst_number-1)*mult+k, k, inst_number, mult);
|
||||
dbg(1, "hilight_child_pins():looking net:%s\n", find_nth(net_node, ',',
|
||||
((inst_number - 1) * mult + k - 1) % net_mult + 1));
|
||||
xctx.currsch--;
|
||||
xctx->currsch--;
|
||||
entry = bus_hilight_lookup(find_nth(net_node, ',', ((inst_number - 1) * mult + k - 1) % net_mult + 1), 0, XLOOKUP);
|
||||
xctx.currsch++;
|
||||
xctx->currsch++;
|
||||
if(entry) {
|
||||
bus_hilight_lookup(find_nth(pin_node, ',', k), entry->value, XINSERT);
|
||||
dbg(1, "hilight_child_pins(): inserting: %s\n", find_nth(pin_node, ',', k));
|
||||
|
|
@ -442,12 +442,12 @@ int search(const char *tok, const char *val, int sub, int sel, int what)
|
|||
has_token = 0;
|
||||
prepare_netlist_structs(0);
|
||||
bus=bus_search(val);
|
||||
for(i=0;i<xctx.instances;i++) {
|
||||
for(i=0;i<xctx->instances;i++) {
|
||||
if(!strcmp(tok,"cell::name")) {
|
||||
has_token = (xctx.inst[i].name != NULL) && xctx.inst[i].name[0];
|
||||
str = xctx.inst[i].name;
|
||||
has_token = (xctx->inst[i].name != NULL) && xctx->inst[i].name[0];
|
||||
str = xctx->inst[i].name;
|
||||
} else if(!strncmp(tok,"cell::", 6)) { /* cell::xxx looks for xxx in global symbol attributes */
|
||||
my_strdup(142, &tmpname,get_tok_value((xctx.inst[i].ptr+ xctx.sym)->prop_ptr,tok+6,0));
|
||||
my_strdup(142, &tmpname,get_tok_value((xctx->inst[i].ptr+ xctx->sym)->prop_ptr,tok+6,0));
|
||||
has_token = get_tok_size;
|
||||
if(tmpname) {
|
||||
str = tmpname;
|
||||
|
|
@ -455,10 +455,10 @@ int search(const char *tok, const char *val, int sub, int sel, int what)
|
|||
str = empty_string;
|
||||
}
|
||||
} else if(!strcmp(tok,"propstring")) {
|
||||
has_token = (xctx.inst[i].prop_ptr != NULL) && xctx.inst[i].prop_ptr[0];
|
||||
str = xctx.inst[i].prop_ptr;
|
||||
has_token = (xctx->inst[i].prop_ptr != NULL) && xctx->inst[i].prop_ptr[0];
|
||||
str = xctx->inst[i].prop_ptr;
|
||||
} else {
|
||||
str = get_tok_value(xctx.inst[i].prop_ptr, tok,0);
|
||||
str = get_tok_value(xctx->inst[i].prop_ptr, tok,0);
|
||||
has_token = get_tok_size;
|
||||
}
|
||||
dbg(1, "search(): inst=%d, tok=%s, val=%s \n", i,tok, str);
|
||||
|
|
@ -476,16 +476,16 @@ int search(const char *tok, const char *val, int sub, int sel, int what)
|
|||
#endif
|
||||
{
|
||||
if(!sel) {
|
||||
type = (xctx.inst[i].ptr+ xctx.sym)->type;
|
||||
type = (xctx->inst[i].ptr+ xctx->sym)->type;
|
||||
if( type && IS_LABEL_SH_OR_PIN(type) ) {
|
||||
if(!bus_hilight_lookup(xctx.inst[i].node[0], col, XINSERT)) hilight_nets = 1;
|
||||
if(!bus_hilight_lookup(xctx->inst[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);
|
||||
}
|
||||
else {
|
||||
dbg(1, "search(): setting hilight flag on inst %d\n",i);
|
||||
hilight_nets=1;
|
||||
xctx.inst[i].flags |= 4;
|
||||
xctx->inst[i].flags |= 4;
|
||||
if(what==NOW) for(c=0;c<cadlayers;c++)
|
||||
draw_symbol(NOW, hilight_layer, i,c,0,0,0.0,0.0);
|
||||
}
|
||||
|
|
@ -503,8 +503,8 @@ int search(const char *tok, const char *val, int sub, int sel, int what)
|
|||
}
|
||||
|
||||
}
|
||||
for(i=0;i<xctx.wires;i++) {
|
||||
str = get_tok_value(xctx.wire[i].prop_ptr, tok,0);
|
||||
for(i=0;i<xctx->wires;i++) {
|
||||
str = get_tok_value(xctx->wire[i].prop_ptr, tok,0);
|
||||
if(get_tok_size ) {
|
||||
#ifdef __unix__
|
||||
if( (!regexec(&re, str,0 , NULL, 0) && !sub ) || /* 20071120 regex instead of strcmp */
|
||||
|
|
@ -513,22 +513,22 @@ int search(const char *tok, const char *val, int sub, int sel, int what)
|
|||
if (!strcmp(str, val) && sub)
|
||||
#endif
|
||||
{
|
||||
dbg(2, "search(): wire=%d, tok=%s, val=%s \n", i,tok, xctx.wire[i].node);
|
||||
dbg(2, "search(): wire=%d, tok=%s, val=%s \n", i,tok, xctx->wire[i].node);
|
||||
if(!sel) {
|
||||
bus_hilight_lookup(xctx.wire[i].node, col, XINSERT);
|
||||
bus_hilight_lookup(xctx->wire[i].node, col, XINSERT);
|
||||
if(what == NOW) {
|
||||
if(xctx.wire[i].bus)
|
||||
if(xctx->wire[i].bus)
|
||||
drawline(hilight_layer, THICK,
|
||||
xctx.wire[i].x1, xctx.wire[i].y1, xctx.wire[i].x2, xctx.wire[i].y2, 0);
|
||||
xctx->wire[i].x1, xctx->wire[i].y1, xctx->wire[i].x2, xctx->wire[i].y2, 0);
|
||||
else
|
||||
drawline(hilight_layer, 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 ) {
|
||||
filledarc(hilight_layer, NOW, xctx.wire[i].x1, xctx.wire[i].y1, cadhalfdotsize, 0, 360);
|
||||
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 ) {
|
||||
filledarc(hilight_layer, NOW, xctx->wire[i].x1, xctx->wire[i].y1, cadhalfdotsize, 0, 360);
|
||||
}
|
||||
if( xctx.wire[i].end2 >1 ) {
|
||||
filledarc(hilight_layer, NOW, xctx.wire[i].x2, xctx.wire[i].y2, cadhalfdotsize, 0, 360);
|
||||
if( xctx->wire[i].end2 >1 ) {
|
||||
filledarc(hilight_layer, NOW, xctx->wire[i].x2, xctx->wire[i].y2, cadhalfdotsize, 0, 360);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -547,8 +547,8 @@ int search(const char *tok, const char *val, int sub, int sel, int what)
|
|||
}
|
||||
}
|
||||
}
|
||||
if(sel) for(c = 0; c < cadlayers; c++) for(i=0;i<xctx.lines[c];i++) {
|
||||
str = get_tok_value(xctx.line[c][i].prop_ptr, tok,0);
|
||||
if(sel) for(c = 0; c < cadlayers; c++) for(i=0;i<xctx->lines[c];i++) {
|
||||
str = get_tok_value(xctx->line[c][i].prop_ptr, tok,0);
|
||||
if(get_tok_size) {
|
||||
#ifdef __unix__
|
||||
if( (!regexec(&re, str,0 , NULL, 0) && !sub ) ||
|
||||
|
|
@ -572,8 +572,8 @@ int search(const char *tok, const char *val, int sub, int sel, int what)
|
|||
}
|
||||
}
|
||||
}
|
||||
if(sel) for(c = 0; c < cadlayers; c++) for(i=0;i<xctx.rects[c];i++) {
|
||||
str = get_tok_value(xctx.rect[c][i].prop_ptr, tok,0);
|
||||
if(sel) for(c = 0; c < cadlayers; c++) for(i=0;i<xctx->rects[c];i++) {
|
||||
str = get_tok_value(xctx->rect[c][i].prop_ptr, tok,0);
|
||||
if(get_tok_size) {
|
||||
#ifdef __unix__
|
||||
if( (!regexec(&re, str,0 , NULL, 0) && !sub ) ||
|
||||
|
|
@ -643,8 +643,8 @@ void drill_hilight(void)
|
|||
while(1) {
|
||||
found=0;
|
||||
count++;
|
||||
for(i=0; i<xctx.instances;i++) {
|
||||
symbol = xctx.inst[i].ptr+xctx.sym;
|
||||
for(i=0; i<xctx->instances;i++) {
|
||||
symbol = xctx->inst[i].ptr+xctx->sym;
|
||||
npin = symbol->rects[PINLAYER];
|
||||
rct=symbol->rect[PINLAYER];
|
||||
for(j=0; j<npin;j++) {
|
||||
|
|
@ -696,7 +696,7 @@ static void send_net_to_gaw(int simtype, const char *node)
|
|||
tok = node;
|
||||
node_entry = bus_hash_lookup(tok, "", XLOOKUP, 0, "", "", "", "");
|
||||
if(tok[0] == '#') tok++;
|
||||
if(node_entry && (node_entry->d.port == 0 || !strcmp(xctx.sch_path[xctx.currsch], ".") )) {
|
||||
if(node_entry && (node_entry->d.port == 0 || !strcmp(xctx->sch_path[xctx->currsch], ".") )) {
|
||||
char *t=NULL, *p=NULL;
|
||||
c = get_color(hilight_color);
|
||||
sprintf(color_str, "%02x%02x%02x", xcolor_array[c].red>>8, xcolor_array[c].green>>8, xcolor_array[c].blue>>8);
|
||||
|
|
@ -704,7 +704,7 @@ static void send_net_to_gaw(int simtype, const char *node)
|
|||
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, xctx.sch_path[xctx.currsch]+1);
|
||||
my_strdup2(254, &p, xctx->sch_path[xctx->currsch]+1);
|
||||
if(simtype == 0 ) { /* spice */
|
||||
Tcl_VarEval(interp, "puts $gaw_fd {copyvar v(", strtolower(p), strtolower(t),
|
||||
") p0 #", color_str, "}\nvwait gaw_fd\n", NULL);
|
||||
|
|
@ -740,9 +740,9 @@ static void send_current_to_gaw(int simtype, const char *node)
|
|||
tcleval("if { ![info exists gaw_fd] } { gaw_setup_tcp }\n");
|
||||
for(k=1; k<=tok_mult; k++) {
|
||||
my_strdup(1179, &t, find_nth(expanded_tok, ',', k));
|
||||
my_strdup2(1180, &p, xctx.sch_path[xctx.currsch]+1);
|
||||
my_strdup2(1180, &p, xctx->sch_path[xctx->currsch]+1);
|
||||
if(!simtype) { /* spice */
|
||||
Tcl_VarEval(interp, "puts $gaw_fd {copyvar i(", xctx.currsch>0 ? "v." : "",
|
||||
Tcl_VarEval(interp, "puts $gaw_fd {copyvar i(", xctx->currsch>0 ? "v." : "",
|
||||
strtolower(p), strtolower(t),
|
||||
") p0 #", color_str, "}\nvwait gaw_fd\n", NULL);
|
||||
} else { /* Xyce */
|
||||
|
|
@ -751,8 +751,8 @@ static void send_current_to_gaw(int simtype, const char *node)
|
|||
if(*c == '.') *c = ':'; /* Xyce uses : as path separator */
|
||||
c++;
|
||||
}
|
||||
Tcl_VarEval(interp, "puts $gaw_fd {copyvar ", xctx.currsch>0 ? "V:" : "",
|
||||
strtoupper(p), strtoupper( xctx.currsch>0 ? t+1 : t ), "#branch",
|
||||
Tcl_VarEval(interp, "puts $gaw_fd {copyvar ", xctx->currsch>0 ? "V:" : "",
|
||||
strtoupper(p), strtoupper( xctx->currsch>0 ? t+1 : t ), "#branch",
|
||||
" p0 #", color_str, "}\nvwait gaw_fd\n", NULL);
|
||||
|
||||
}
|
||||
|
|
@ -782,40 +782,40 @@ void hilight_net(int to_waveform)
|
|||
case WIRE:
|
||||
if(event_reporting) {
|
||||
char s[PATH_MAX];
|
||||
printf("xschem search exact %d lab %s\n", 0, escape_chars(s, xctx.wire[n].node, PATH_MAX));
|
||||
printf("xschem search exact %d lab %s\n", 0, escape_chars(s, xctx->wire[n].node, PATH_MAX));
|
||||
fflush(stdout);
|
||||
}
|
||||
hilight_nets=1;
|
||||
if(!bus_hilight_lookup(xctx.wire[n].node, hilight_color, XINSERT)) {
|
||||
if(to_waveform == GAW) send_net_to_gaw(sim_is_xyce, xctx.wire[n].node);
|
||||
if(!bus_hilight_lookup(xctx->wire[n].node, hilight_color, XINSERT)) {
|
||||
if(to_waveform == GAW) send_net_to_gaw(sim_is_xyce, xctx->wire[n].node);
|
||||
if(incr_hilight) hilight_color++;
|
||||
}
|
||||
break;
|
||||
case ELEMENT:
|
||||
type = (xctx.inst[n].ptr+ xctx.sym)->type;
|
||||
if( type && xctx.inst[n].node && IS_LABEL_SH_OR_PIN(type) ) { /* instance must have a pin! */
|
||||
type = (xctx->inst[n].ptr+ xctx->sym)->type;
|
||||
if( type && xctx->inst[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, xctx.inst[n].node[0], PATH_MAX));
|
||||
printf("xschem search exact %d lab %s\n", 0, escape_chars(s, xctx->inst[n].node[0], PATH_MAX));
|
||||
fflush(stdout);
|
||||
}
|
||||
if(!bus_hilight_lookup(xctx.inst[n].node[0], hilight_color, XINSERT)) {
|
||||
if(to_waveform == GAW) send_net_to_gaw(sim_is_xyce, xctx.inst[n].node[0]);
|
||||
if(!bus_hilight_lookup(xctx->inst[n].node[0], hilight_color, XINSERT)) {
|
||||
if(to_waveform == GAW) send_net_to_gaw(sim_is_xyce, xctx->inst[n].node[0]);
|
||||
hilight_nets=1;
|
||||
if(incr_hilight) hilight_color++;
|
||||
}
|
||||
} else {
|
||||
if(event_reporting) {
|
||||
char s[PATH_MAX];
|
||||
printf("xschem search exact %d name %s\n", 0, escape_chars(s, xctx.inst[n].instname, PATH_MAX));
|
||||
printf("xschem search exact %d name %s\n", 0, escape_chars(s, xctx->inst[n].instname, PATH_MAX));
|
||||
fflush(stdout);
|
||||
}
|
||||
dbg(1, "hilight_net(): setting hilight flag on inst %d\n",n);
|
||||
hilight_nets=1;
|
||||
xctx.inst[n].flags |= 4;
|
||||
xctx->inst[n].flags |= 4;
|
||||
}
|
||||
if(type && (!strcmp(type, "current_probe") || !strcmp(type, "vsource")) ) {
|
||||
if(to_waveform == GAW) send_current_to_gaw(sim_is_xyce, xctx.inst[n].instname);
|
||||
if(to_waveform == GAW) send_current_to_gaw(sim_is_xyce, xctx->inst[n].instname);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
|
@ -846,30 +846,30 @@ void unhilight_net(void)
|
|||
case WIRE:
|
||||
if(event_reporting) {
|
||||
char s[PATH_MAX];
|
||||
printf("xschem search exact %d lab %s\n", 1, escape_chars(s, xctx.wire[n].node, PATH_MAX));
|
||||
printf("xschem search exact %d lab %s\n", 1, escape_chars(s, xctx->wire[n].node, PATH_MAX));
|
||||
printf("xschem unhilight\n");
|
||||
fflush(stdout);
|
||||
}
|
||||
bus_hilight_lookup(xctx.wire[n].node, hilight_color, XDELETE);
|
||||
bus_hilight_lookup(xctx->wire[n].node, hilight_color, XDELETE);
|
||||
break;
|
||||
case ELEMENT:
|
||||
type = (xctx.inst[n].ptr+ xctx.sym)->type;
|
||||
type = (xctx->inst[n].ptr+ xctx->sym)->type;
|
||||
if( type &&
|
||||
xctx.inst[n].node && IS_LABEL_SH_OR_PIN(type) ) { /* instance must have a pin! */
|
||||
xctx->inst[n].node && IS_LABEL_SH_OR_PIN(type) ) { /* instance must have a pin! */
|
||||
if(event_reporting) {
|
||||
printf("xschem unhilight\n");
|
||||
fflush(stdout);
|
||||
}
|
||||
bus_hilight_lookup(xctx.inst[n].node[0], hilight_color, XDELETE);
|
||||
bus_hilight_lookup(xctx->inst[n].node[0], hilight_color, XDELETE);
|
||||
} else {
|
||||
if(event_reporting) {
|
||||
char s[PATH_MAX];
|
||||
printf("xschem search exact %d name %s\n", 1, escape_chars(s, xctx.inst[n].instname, PATH_MAX));
|
||||
printf("xschem search exact %d name %s\n", 1, escape_chars(s, xctx->inst[n].instname, PATH_MAX));
|
||||
printf("xschem unhilight\n");
|
||||
fflush(stdout);
|
||||
}
|
||||
}
|
||||
xctx.inst[n].flags &= ~4;
|
||||
xctx->inst[n].flags &= ~4;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
@ -910,75 +910,75 @@ void draw_hilight_net(int on_window)
|
|||
y1 = Y_TO_XSCHEM(areay1);
|
||||
x2 = X_TO_XSCHEM(areax2);
|
||||
y2 = Y_TO_XSCHEM(areay2);
|
||||
use_hash = (xctx.wires> 2000 || xctx.instances > 2000 ) && (x2 - x1 < ITERATOR_THRESHOLD);
|
||||
use_hash = (xctx->wires> 2000 || xctx->instances > 2000 ) && (x2 - x1 < ITERATOR_THRESHOLD);
|
||||
if(use_hash) {
|
||||
hash_wires();
|
||||
}
|
||||
if(!use_hash) for(i=0;i<xctx.wires;i++)
|
||||
if(!use_hash) for(i=0;i<xctx->wires;i++)
|
||||
{
|
||||
if( (entry = bus_hilight_lookup(xctx.wire[i].node, 0, XLOOKUP)) ) {
|
||||
if(xctx.wire[i].bus)
|
||||
if( (entry = bus_hilight_lookup(xctx->wire[i].node, 0, XLOOKUP)) ) {
|
||||
if(xctx->wire[i].bus)
|
||||
drawline(get_color(entry->value), THICK,
|
||||
xctx.wire[i].x1, xctx.wire[i].y1, xctx.wire[i].x2, xctx.wire[i].y2, 0);
|
||||
xctx->wire[i].x1, xctx->wire[i].y1, xctx->wire[i].x2, xctx->wire[i].y2, 0);
|
||||
else
|
||||
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 */
|
||||
filledarc(get_color(entry->value), NOW, xctx.wire[i].x1, xctx.wire[i].y1, cadhalfdotsize, 0, 360);
|
||||
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 */
|
||||
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 */
|
||||
filledarc(get_color(entry->value), NOW, xctx.wire[i].x2, xctx.wire[i].y2, cadhalfdotsize, 0, 360);
|
||||
if( xctx->wire[i].end2 >1 ) { /* 20150331 draw_dots */
|
||||
filledarc(get_color(entry->value), NOW, xctx->wire[i].x2, xctx->wire[i].y2, cadhalfdotsize, 0, 360);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else for(init_wire_iterator(x1, y1, x2, y2); ( wireptr = wire_iterator_next() ) ;) {
|
||||
i = wireptr->n;
|
||||
if( (entry = bus_hilight_lookup(xctx.wire[i].node, 0, XLOOKUP)) ) {
|
||||
if(xctx.wire[i].bus)
|
||||
if( (entry = bus_hilight_lookup(xctx->wire[i].node, 0, XLOOKUP)) ) {
|
||||
if(xctx->wire[i].bus)
|
||||
drawline(get_color(entry->value), THICK,
|
||||
xctx.wire[i].x1, xctx.wire[i].y1, xctx.wire[i].x2, xctx.wire[i].y2, 0);
|
||||
xctx->wire[i].x1, xctx->wire[i].y1, xctx->wire[i].x2, xctx->wire[i].y2, 0);
|
||||
else
|
||||
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 */
|
||||
filledarc(get_color(entry->value), NOW, xctx.wire[i].x1, xctx.wire[i].y1, cadhalfdotsize, 0, 360);
|
||||
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 */
|
||||
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 */
|
||||
filledarc(get_color(entry->value), NOW, xctx.wire[i].x2, xctx.wire[i].y2, cadhalfdotsize, 0, 360);
|
||||
if( xctx->wire[i].end2 >1 ) { /* 20150331 draw_dots */
|
||||
filledarc(get_color(entry->value), NOW, xctx->wire[i].x2, xctx->wire[i].y2, cadhalfdotsize, 0, 360);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
dbg(1, "draw_hilight_net() : allocating inst_color %d bytes \n", xctx.instances*sizeof(int));
|
||||
my_realloc(145, &inst_color,xctx.instances*sizeof(int));
|
||||
for(i=0;i<xctx.instances;i++)
|
||||
dbg(1, "draw_hilight_net() : allocating inst_color %d bytes \n", xctx->instances*sizeof(int));
|
||||
my_realloc(145, &inst_color,xctx->instances*sizeof(int));
|
||||
for(i=0;i<xctx->instances;i++)
|
||||
{
|
||||
|
||||
x1=X_TO_SCREEN(xctx.inst[i].x1);
|
||||
x2=X_TO_SCREEN(xctx.inst[i].x2);
|
||||
y1=Y_TO_SCREEN(xctx.inst[i].y1);
|
||||
y2=Y_TO_SCREEN(xctx.inst[i].y2);
|
||||
x1=X_TO_SCREEN(xctx->inst[i].x1);
|
||||
x2=X_TO_SCREEN(xctx->inst[i].x2);
|
||||
y1=Y_TO_SCREEN(xctx->inst[i].y1);
|
||||
y2=Y_TO_SCREEN(xctx->inst[i].y2);
|
||||
inst_color[i]=0;
|
||||
if(OUTSIDE(x1,y1,x2,y2,areax1,areay1,areax2,areay2)) continue;
|
||||
/* /20150409 */
|
||||
|
||||
type = (xctx.inst[i].ptr+ xctx.sym)->type;
|
||||
type = (xctx->inst[i].ptr+ xctx->sym)->type;
|
||||
|
||||
hilight_connected_inst = !strcmp(get_tok_value((xctx.inst[i].ptr+ xctx.sym)->prop_ptr, "highlight", 0), "true") ||
|
||||
!strcmp(get_tok_value(xctx.inst[i].prop_ptr, "highlight", 0), "true");
|
||||
if( xctx.inst[i].flags & 4) {
|
||||
hilight_connected_inst = !strcmp(get_tok_value((xctx->inst[i].ptr+ xctx->sym)->prop_ptr, "highlight", 0), "true") ||
|
||||
!strcmp(get_tok_value(xctx->inst[i].prop_ptr, "highlight", 0), "true");
|
||||
if( xctx->inst[i].flags & 4) {
|
||||
dbg(1, "draw_hilight_net(): instance %d flags &4 true\n", i);
|
||||
inst_color[i]=PINLAYER;
|
||||
}
|
||||
else if(hilight_connected_inst) {
|
||||
int rects, j;
|
||||
dbg(2, "draw_hilight_net(): hilight_connected_inst inst=%d, node=%s\n", i, xctx.inst[i].node[0]);
|
||||
if( (rects = (xctx.inst[i].ptr+ xctx.sym)->rects[PINLAYER]) > 0 ) {
|
||||
dbg(2, "draw_hilight_net(): hilight_connected_inst inst=%d, node=%s\n", i, xctx->inst[i].node[0]);
|
||||
if( (rects = (xctx->inst[i].ptr+ xctx->sym)->rects[PINLAYER]) > 0 ) {
|
||||
for(j=0;j<rects;j++) {
|
||||
if( xctx.inst[i].node && xctx.inst[i].node[j]) {
|
||||
entry=bus_hilight_lookup(xctx.inst[i].node[j], 0, XLOOKUP);
|
||||
if( xctx->inst[i].node && xctx->inst[i].node[j]) {
|
||||
entry=bus_hilight_lookup(xctx->inst[i].node[j], 0, XLOOKUP);
|
||||
if(entry) {
|
||||
inst_color[i]=get_color(entry->value);
|
||||
break;
|
||||
|
|
@ -987,7 +987,7 @@ void draw_hilight_net(int on_window)
|
|||
}
|
||||
}
|
||||
} else if( type && IS_LABEL_SH_OR_PIN(type) ) {
|
||||
entry=bus_hilight_lookup( get_tok_value(xctx.inst[i].prop_ptr,"lab",0) , 0, XLOOKUP);
|
||||
entry=bus_hilight_lookup( get_tok_value(xctx->inst[i].prop_ptr,"lab",0) , 0, XLOOKUP);
|
||||
if(entry) inst_color[i]=get_color(entry->value);
|
||||
}
|
||||
}
|
||||
|
|
@ -996,19 +996,19 @@ void draw_hilight_net(int on_window)
|
|||
/* 20160414 from draw() */
|
||||
if(draw_single_layer!=-1 && c != draw_single_layer) continue;
|
||||
|
||||
for(i=0;i<xctx.instances;i++)
|
||||
for(i=0;i<xctx->instances;i++)
|
||||
{
|
||||
if(inst_color[i] )
|
||||
{
|
||||
|
||||
x1=X_TO_SCREEN(xctx.inst[i].x1);
|
||||
x2=X_TO_SCREEN(xctx.inst[i].x2);
|
||||
y1=Y_TO_SCREEN(xctx.inst[i].y1);
|
||||
y2=Y_TO_SCREEN(xctx.inst[i].y2);
|
||||
x1=X_TO_SCREEN(xctx->inst[i].x1);
|
||||
x2=X_TO_SCREEN(xctx->inst[i].x2);
|
||||
y1=Y_TO_SCREEN(xctx->inst[i].y1);
|
||||
y2=Y_TO_SCREEN(xctx->inst[i].y2);
|
||||
if(OUTSIDE(x1,y1,x2,y2,areax1,areay1,areax2,areay2)) continue;
|
||||
dbg(1, "draw_hilight_net(): instance:%d\n",i);
|
||||
/* 20160414 from draw() */
|
||||
symptr = (xctx.inst[i].ptr+ xctx.sym);
|
||||
symptr = (xctx->inst[i].ptr+ xctx->sym);
|
||||
if( c==0 || /*draw_symbol call is needed on layer 0 to avoid redundant work (outside check) */
|
||||
symptr->lines[c] ||
|
||||
symptr->rects[c] ||
|
||||
|
|
@ -1094,7 +1094,7 @@ void print_hilight_net(int show)
|
|||
|
||||
/* 20170926 test for not null node_entry, this may happen if a hilighted net name has been changed */
|
||||
/* before invoking this function, in this case --> skip */
|
||||
if(node_entry && !strcmp(xctx.sch_path[xctx.currsch], entry->path)) {
|
||||
if(node_entry && !strcmp(xctx->sch_path[xctx->currsch], entry->path)) {
|
||||
if(show==3) {
|
||||
|
||||
fprintf(fd, "%s%s\n", !strcmp(entry->path, ".") ? "" : entry->path, entry->token);
|
||||
|
|
|
|||
|
|
@ -204,11 +204,11 @@ void push_undo(void)
|
|||
}
|
||||
slot = cur_undo_ptr%max_undo;
|
||||
|
||||
my_strdup(173, &uslot[slot].gptr, xctx.schvhdlprop);
|
||||
my_strdup(174, &uslot[slot].vptr, xctx.schverilogprop);
|
||||
my_strdup(175, &uslot[slot].sptr, xctx.schprop);
|
||||
my_strdup(359, &uslot[slot].kptr, xctx.schsymbolprop);
|
||||
my_strdup(176, &uslot[slot].eptr, xctx.schtedaxprop);
|
||||
my_strdup(173, &uslot[slot].gptr, xctx->schvhdlprop);
|
||||
my_strdup(174, &uslot[slot].vptr, xctx->schverilogprop);
|
||||
my_strdup(175, &uslot[slot].sptr, xctx->schprop);
|
||||
my_strdup(359, &uslot[slot].kptr, xctx->schsymbolprop);
|
||||
my_strdup(176, &uslot[slot].eptr, xctx->schtedaxprop);
|
||||
|
||||
free_lines(slot);
|
||||
free_rects(slot);
|
||||
|
|
@ -219,45 +219,45 @@ void push_undo(void)
|
|||
free_instances(slot);
|
||||
|
||||
for(c=0;c<cadlayers;c++) {
|
||||
uslot[slot].lines[c] = xctx.lines[c];
|
||||
uslot[slot].rects[c] = xctx.rects[c];
|
||||
uslot[slot].arcs[c] = xctx.arcs[c];
|
||||
uslot[slot].polygons[c] = xctx.polygons[c];
|
||||
uslot[slot].lptr[c] = my_calloc(177, xctx.lines[c], sizeof(xLine));
|
||||
uslot[slot].bptr[c] = my_calloc(178, xctx.rects[c], sizeof(xRect));
|
||||
uslot[slot].pptr[c] = my_calloc(179, xctx.polygons[c], sizeof(xPoly));
|
||||
uslot[slot].aptr[c] = my_calloc(180, xctx.arcs[c], sizeof(xArc));
|
||||
uslot[slot].lines[c] = xctx->lines[c];
|
||||
uslot[slot].rects[c] = xctx->rects[c];
|
||||
uslot[slot].arcs[c] = xctx->arcs[c];
|
||||
uslot[slot].polygons[c] = xctx->polygons[c];
|
||||
uslot[slot].lptr[c] = my_calloc(177, xctx->lines[c], sizeof(xLine));
|
||||
uslot[slot].bptr[c] = my_calloc(178, xctx->rects[c], sizeof(xRect));
|
||||
uslot[slot].pptr[c] = my_calloc(179, xctx->polygons[c], sizeof(xPoly));
|
||||
uslot[slot].aptr[c] = my_calloc(180, xctx->arcs[c], sizeof(xArc));
|
||||
}
|
||||
uslot[slot].wptr = my_calloc(181, xctx.wires, sizeof(xWire));
|
||||
uslot[slot].tptr = my_calloc(182, xctx.texts, sizeof(xText));
|
||||
uslot[slot].iptr = my_calloc(183, xctx.instances, sizeof(xInstance));
|
||||
uslot[slot].texts = xctx.texts;
|
||||
uslot[slot].instances = xctx.instances;
|
||||
uslot[slot].wires = xctx.wires;
|
||||
uslot[slot].wptr = my_calloc(181, xctx->wires, sizeof(xWire));
|
||||
uslot[slot].tptr = my_calloc(182, xctx->texts, sizeof(xText));
|
||||
uslot[slot].iptr = my_calloc(183, xctx->instances, sizeof(xInstance));
|
||||
uslot[slot].texts = xctx->texts;
|
||||
uslot[slot].instances = xctx->instances;
|
||||
uslot[slot].wires = xctx->wires;
|
||||
|
||||
for(c=0;c<cadlayers;c++) {
|
||||
/* lines */
|
||||
for(i=0;i<xctx.lines[c];i++) {
|
||||
uslot[slot].lptr[c][i] = xctx.line[c][i];
|
||||
for(i=0;i<xctx->lines[c];i++) {
|
||||
uslot[slot].lptr[c][i] = xctx->line[c][i];
|
||||
uslot[slot].lptr[c][i].prop_ptr = NULL;
|
||||
my_strdup(184, &uslot[slot].lptr[c][i].prop_ptr, xctx.line[c][i].prop_ptr);
|
||||
my_strdup(184, &uslot[slot].lptr[c][i].prop_ptr, xctx->line[c][i].prop_ptr);
|
||||
}
|
||||
/* rects */
|
||||
for(i=0;i<xctx.rects[c];i++) {
|
||||
uslot[slot].bptr[c][i] = xctx.rect[c][i];
|
||||
for(i=0;i<xctx->rects[c];i++) {
|
||||
uslot[slot].bptr[c][i] = xctx->rect[c][i];
|
||||
uslot[slot].bptr[c][i].prop_ptr = NULL;
|
||||
my_strdup(185, &uslot[slot].bptr[c][i].prop_ptr, xctx.rect[c][i].prop_ptr);
|
||||
my_strdup(185, &uslot[slot].bptr[c][i].prop_ptr, xctx->rect[c][i].prop_ptr);
|
||||
}
|
||||
/* arcs */
|
||||
for(i=0;i<xctx.arcs[c];i++) {
|
||||
uslot[slot].aptr[c][i] = xctx.arc[c][i];
|
||||
for(i=0;i<xctx->arcs[c];i++) {
|
||||
uslot[slot].aptr[c][i] = xctx->arc[c][i];
|
||||
uslot[slot].aptr[c][i].prop_ptr = NULL;
|
||||
my_strdup(186, &uslot[slot].aptr[c][i].prop_ptr, xctx.arc[c][i].prop_ptr);
|
||||
my_strdup(186, &uslot[slot].aptr[c][i].prop_ptr, xctx->arc[c][i].prop_ptr);
|
||||
}
|
||||
/*polygons */
|
||||
for(i=0;i<xctx.polygons[c];i++) {
|
||||
int points = xctx.poly[c][i].points;
|
||||
uslot[slot].pptr[c][i] = xctx.poly[c][i];
|
||||
for(i=0;i<xctx->polygons[c];i++) {
|
||||
int points = xctx->poly[c][i].points;
|
||||
uslot[slot].pptr[c][i] = xctx->poly[c][i];
|
||||
uslot[slot].pptr[c][i].prop_ptr = NULL;
|
||||
uslot[slot].pptr[c][i].x = NULL;
|
||||
uslot[slot].pptr[c][i].y = NULL;
|
||||
|
|
@ -265,40 +265,40 @@ void push_undo(void)
|
|||
uslot[slot].pptr[c][i].x = my_malloc(187, points * sizeof(double));
|
||||
uslot[slot].pptr[c][i].y = my_malloc(188, points * sizeof(double));
|
||||
uslot[slot].pptr[c][i].selected_point = my_malloc(189, points * sizeof(unsigned short));
|
||||
memcpy(uslot[slot].pptr[c][i].x, xctx.poly[c][i].x, points * sizeof(double));
|
||||
memcpy(uslot[slot].pptr[c][i].y, xctx.poly[c][i].y, points * sizeof(double));
|
||||
memcpy(uslot[slot].pptr[c][i].selected_point, xctx.poly[c][i].selected_point, points * sizeof(unsigned short));
|
||||
my_strdup(190, &uslot[slot].pptr[c][i].prop_ptr, xctx.poly[c][i].prop_ptr);
|
||||
memcpy(uslot[slot].pptr[c][i].x, xctx->poly[c][i].x, points * sizeof(double));
|
||||
memcpy(uslot[slot].pptr[c][i].y, xctx->poly[c][i].y, points * sizeof(double));
|
||||
memcpy(uslot[slot].pptr[c][i].selected_point, xctx->poly[c][i].selected_point, points * sizeof(unsigned short));
|
||||
my_strdup(190, &uslot[slot].pptr[c][i].prop_ptr, xctx->poly[c][i].prop_ptr);
|
||||
}
|
||||
}
|
||||
/* instances */
|
||||
for(i=0;i<xctx.instances;i++) {
|
||||
uslot[slot].iptr[i] = xctx.inst[i];
|
||||
for(i=0;i<xctx->instances;i++) {
|
||||
uslot[slot].iptr[i] = xctx->inst[i];
|
||||
uslot[slot].iptr[i].prop_ptr = NULL;
|
||||
uslot[slot].iptr[i].name = NULL;
|
||||
uslot[slot].iptr[i].instname = NULL;
|
||||
uslot[slot].iptr[i].node = NULL;
|
||||
my_strdup2(191, &uslot[slot].iptr[i].instname, xctx.inst[i].instname);
|
||||
my_strdup(192, &uslot[slot].iptr[i].prop_ptr, xctx.inst[i].prop_ptr);
|
||||
my_strdup(193, &uslot[slot].iptr[i].name, xctx.inst[i].name);
|
||||
my_strdup2(191, &uslot[slot].iptr[i].instname, xctx->inst[i].instname);
|
||||
my_strdup(192, &uslot[slot].iptr[i].prop_ptr, xctx->inst[i].prop_ptr);
|
||||
my_strdup(193, &uslot[slot].iptr[i].name, xctx->inst[i].name);
|
||||
}
|
||||
/* texts */
|
||||
for(i=0;i<xctx.texts;i++) {
|
||||
uslot[slot].tptr[i] = xctx.text[i];
|
||||
for(i=0;i<xctx->texts;i++) {
|
||||
uslot[slot].tptr[i] = xctx->text[i];
|
||||
uslot[slot].tptr[i].prop_ptr = NULL;
|
||||
uslot[slot].tptr[i].txt_ptr = NULL;
|
||||
uslot[slot].tptr[i].font = NULL;
|
||||
my_strdup(194, &uslot[slot].tptr[i].prop_ptr, xctx.text[i].prop_ptr);
|
||||
my_strdup(195, &uslot[slot].tptr[i].txt_ptr, xctx.text[i].txt_ptr);
|
||||
my_strdup(196, &uslot[slot].tptr[i].font, xctx.text[i].font);
|
||||
my_strdup(194, &uslot[slot].tptr[i].prop_ptr, xctx->text[i].prop_ptr);
|
||||
my_strdup(195, &uslot[slot].tptr[i].txt_ptr, xctx->text[i].txt_ptr);
|
||||
my_strdup(196, &uslot[slot].tptr[i].font, xctx->text[i].font);
|
||||
}
|
||||
|
||||
/* wires */
|
||||
for(i=0;i<xctx.wires;i++) {
|
||||
uslot[slot].wptr[i] = xctx.wire[i];
|
||||
for(i=0;i<xctx->wires;i++) {
|
||||
uslot[slot].wptr[i] = xctx->wire[i];
|
||||
uslot[slot].wptr[i].prop_ptr = NULL;
|
||||
uslot[slot].wptr[i].node = NULL;
|
||||
my_strdup(197, &uslot[slot].wptr[i].prop_ptr, xctx.wire[i].prop_ptr);
|
||||
my_strdup(197, &uslot[slot].wptr[i].prop_ptr, xctx->wire[i].prop_ptr);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -332,91 +332,91 @@ void pop_undo(int redo)
|
|||
slot = cur_undo_ptr%max_undo;
|
||||
clear_drawing();
|
||||
unselect_all();
|
||||
my_strdup(198, &xctx.schvhdlprop, uslot[slot].gptr);
|
||||
my_strdup(199, &xctx.schverilogprop, uslot[slot].vptr);
|
||||
my_strdup(200, &xctx.schprop, uslot[slot].sptr);
|
||||
my_strdup(389, &xctx.schsymbolprop, uslot[slot].kptr);
|
||||
my_strdup(201, &xctx.schtedaxprop, uslot[slot].eptr);
|
||||
my_strdup(198, &xctx->schvhdlprop, uslot[slot].gptr);
|
||||
my_strdup(199, &xctx->schverilogprop, uslot[slot].vptr);
|
||||
my_strdup(200, &xctx->schprop, uslot[slot].sptr);
|
||||
my_strdup(389, &xctx->schsymbolprop, uslot[slot].kptr);
|
||||
my_strdup(201, &xctx->schtedaxprop, uslot[slot].eptr);
|
||||
for(c=0;c<cadlayers;c++) {
|
||||
/* lines */
|
||||
xctx.maxl[c] = xctx.lines[c] = uslot[slot].lines[c];
|
||||
xctx.line[c] = my_calloc(202, xctx.lines[c], sizeof(xLine));
|
||||
for(i=0;i<xctx.lines[c];i++) {
|
||||
xctx.line[c][i] = uslot[slot].lptr[c][i];
|
||||
xctx.line[c][i].prop_ptr=NULL;
|
||||
my_strdup(203, &xctx.line[c][i].prop_ptr, uslot[slot].lptr[c][i].prop_ptr);
|
||||
xctx->maxl[c] = xctx->lines[c] = uslot[slot].lines[c];
|
||||
xctx->line[c] = my_calloc(202, xctx->lines[c], sizeof(xLine));
|
||||
for(i=0;i<xctx->lines[c];i++) {
|
||||
xctx->line[c][i] = uslot[slot].lptr[c][i];
|
||||
xctx->line[c][i].prop_ptr=NULL;
|
||||
my_strdup(203, &xctx->line[c][i].prop_ptr, uslot[slot].lptr[c][i].prop_ptr);
|
||||
}
|
||||
/* rects */
|
||||
xctx.maxr[c] = xctx.rects[c] = uslot[slot].rects[c];
|
||||
xctx.rect[c] = my_calloc(204, xctx.rects[c], sizeof(xRect));
|
||||
for(i=0;i<xctx.rects[c];i++) {
|
||||
xctx.rect[c][i] = uslot[slot].bptr[c][i];
|
||||
xctx.rect[c][i].prop_ptr=NULL;
|
||||
my_strdup(205, &xctx.rect[c][i].prop_ptr, uslot[slot].bptr[c][i].prop_ptr);
|
||||
xctx->maxr[c] = xctx->rects[c] = uslot[slot].rects[c];
|
||||
xctx->rect[c] = my_calloc(204, xctx->rects[c], sizeof(xRect));
|
||||
for(i=0;i<xctx->rects[c];i++) {
|
||||
xctx->rect[c][i] = uslot[slot].bptr[c][i];
|
||||
xctx->rect[c][i].prop_ptr=NULL;
|
||||
my_strdup(205, &xctx->rect[c][i].prop_ptr, uslot[slot].bptr[c][i].prop_ptr);
|
||||
}
|
||||
/* arcs */
|
||||
xctx.maxa[c] = xctx.arcs[c] = uslot[slot].arcs[c];
|
||||
xctx.arc[c] = my_calloc(206, xctx.arcs[c], sizeof(xArc));
|
||||
for(i=0;i<xctx.arcs[c];i++) {
|
||||
xctx.arc[c][i] = uslot[slot].aptr[c][i];
|
||||
xctx.arc[c][i].prop_ptr=NULL;
|
||||
my_strdup(207, &xctx.arc[c][i].prop_ptr, uslot[slot].aptr[c][i].prop_ptr);
|
||||
xctx->maxa[c] = xctx->arcs[c] = uslot[slot].arcs[c];
|
||||
xctx->arc[c] = my_calloc(206, xctx->arcs[c], sizeof(xArc));
|
||||
for(i=0;i<xctx->arcs[c];i++) {
|
||||
xctx->arc[c][i] = uslot[slot].aptr[c][i];
|
||||
xctx->arc[c][i].prop_ptr=NULL;
|
||||
my_strdup(207, &xctx->arc[c][i].prop_ptr, uslot[slot].aptr[c][i].prop_ptr);
|
||||
}
|
||||
/* polygons */
|
||||
xctx.maxp[c] = xctx.polygons[c] = uslot[slot].polygons[c];
|
||||
xctx.poly[c] = my_calloc(208, xctx.polygons[c], sizeof(xPoly));
|
||||
for(i=0;i<xctx.polygons[c];i++) {
|
||||
xctx->maxp[c] = xctx->polygons[c] = uslot[slot].polygons[c];
|
||||
xctx->poly[c] = my_calloc(208, xctx->polygons[c], sizeof(xPoly));
|
||||
for(i=0;i<xctx->polygons[c];i++) {
|
||||
int points = uslot[slot].pptr[c][i].points;
|
||||
xctx.poly[c][i] = uslot[slot].pptr[c][i];
|
||||
xctx.poly[c][i].prop_ptr=NULL;
|
||||
xctx.poly[c][i].x=NULL;
|
||||
xctx.poly[c][i].y=NULL;
|
||||
xctx.poly[c][i].selected_point=NULL;
|
||||
my_strdup(209, &xctx.poly[c][i].prop_ptr, uslot[slot].pptr[c][i].prop_ptr);
|
||||
my_realloc(210, &xctx.poly[c][i].x, points * sizeof(double));
|
||||
my_realloc(211, &xctx.poly[c][i].y, points * sizeof(double));
|
||||
my_realloc(212, &xctx.poly[c][i].selected_point, points * sizeof(unsigned short));
|
||||
memcpy(xctx.poly[c][i].x, uslot[slot].pptr[c][i].x, points * sizeof(double));
|
||||
memcpy(xctx.poly[c][i].y, uslot[slot].pptr[c][i].y, points * sizeof(double));
|
||||
memcpy(xctx.poly[c][i].selected_point, uslot[slot].pptr[c][i].selected_point, points * sizeof(unsigned short));
|
||||
xctx->poly[c][i] = uslot[slot].pptr[c][i];
|
||||
xctx->poly[c][i].prop_ptr=NULL;
|
||||
xctx->poly[c][i].x=NULL;
|
||||
xctx->poly[c][i].y=NULL;
|
||||
xctx->poly[c][i].selected_point=NULL;
|
||||
my_strdup(209, &xctx->poly[c][i].prop_ptr, uslot[slot].pptr[c][i].prop_ptr);
|
||||
my_realloc(210, &xctx->poly[c][i].x, points * sizeof(double));
|
||||
my_realloc(211, &xctx->poly[c][i].y, points * sizeof(double));
|
||||
my_realloc(212, &xctx->poly[c][i].selected_point, points * sizeof(unsigned short));
|
||||
memcpy(xctx->poly[c][i].x, uslot[slot].pptr[c][i].x, points * sizeof(double));
|
||||
memcpy(xctx->poly[c][i].y, uslot[slot].pptr[c][i].y, points * sizeof(double));
|
||||
memcpy(xctx->poly[c][i].selected_point, uslot[slot].pptr[c][i].selected_point, points * sizeof(unsigned short));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* instances */
|
||||
xctx.maxi = xctx.instances = uslot[slot].instances;
|
||||
inst_ptr = my_calloc(213, xctx.instances, sizeof(xInstance));
|
||||
for(i=0;i<xctx.instances;i++) {
|
||||
xctx.inst[i] = uslot[slot].iptr[i];
|
||||
xctx.inst[i].prop_ptr=NULL;
|
||||
xctx.inst[i].name=NULL;
|
||||
xctx.inst[i].instname=NULL;
|
||||
my_strdup(214, &xctx.inst[i].prop_ptr, uslot[slot].iptr[i].prop_ptr);
|
||||
my_strdup(215, &xctx.inst[i].name, uslot[slot].iptr[i].name);
|
||||
my_strdup2(216, &xctx.inst[i].instname, uslot[slot].iptr[i].instname);
|
||||
xctx->maxi = xctx->instances = uslot[slot].instances;
|
||||
inst_ptr = my_calloc(213, xctx->instances, sizeof(xInstance));
|
||||
for(i=0;i<xctx->instances;i++) {
|
||||
xctx->inst[i] = uslot[slot].iptr[i];
|
||||
xctx->inst[i].prop_ptr=NULL;
|
||||
xctx->inst[i].name=NULL;
|
||||
xctx->inst[i].instname=NULL;
|
||||
my_strdup(214, &xctx->inst[i].prop_ptr, uslot[slot].iptr[i].prop_ptr);
|
||||
my_strdup(215, &xctx->inst[i].name, uslot[slot].iptr[i].name);
|
||||
my_strdup2(216, &xctx->inst[i].instname, uslot[slot].iptr[i].instname);
|
||||
}
|
||||
|
||||
/* texts */
|
||||
xctx.maxt = xctx.texts = uslot[slot].texts;
|
||||
textelement = my_calloc(217, xctx.texts, sizeof(xText));
|
||||
for(i=0;i<xctx.texts;i++) {
|
||||
xctx.text[i] = uslot[slot].tptr[i];
|
||||
xctx.text[i].txt_ptr=NULL;
|
||||
xctx.text[i].font=NULL;
|
||||
xctx.text[i].prop_ptr=NULL;
|
||||
my_strdup(218, &xctx.text[i].prop_ptr, uslot[slot].tptr[i].prop_ptr);
|
||||
my_strdup(219, &xctx.text[i].txt_ptr, uslot[slot].tptr[i].txt_ptr);
|
||||
my_strdup(220, &xctx.text[i].font, uslot[slot].tptr[i].font);
|
||||
xctx->maxt = xctx->texts = uslot[slot].texts;
|
||||
textelement = my_calloc(217, xctx->texts, sizeof(xText));
|
||||
for(i=0;i<xctx->texts;i++) {
|
||||
xctx->text[i] = uslot[slot].tptr[i];
|
||||
xctx->text[i].txt_ptr=NULL;
|
||||
xctx->text[i].font=NULL;
|
||||
xctx->text[i].prop_ptr=NULL;
|
||||
my_strdup(218, &xctx->text[i].prop_ptr, uslot[slot].tptr[i].prop_ptr);
|
||||
my_strdup(219, &xctx->text[i].txt_ptr, uslot[slot].tptr[i].txt_ptr);
|
||||
my_strdup(220, &xctx->text[i].font, uslot[slot].tptr[i].font);
|
||||
}
|
||||
|
||||
/* wires */
|
||||
xctx.maxw = xctx.wires = uslot[slot].wires;
|
||||
wire = my_calloc(221, xctx.wires, sizeof(xWire));
|
||||
for(i=0;i<xctx.wires;i++) {
|
||||
xctx.wire[i] = uslot[slot].wptr[i];
|
||||
xctx.wire[i].prop_ptr=NULL;
|
||||
xctx.wire[i].node=NULL;
|
||||
my_strdup(222, &xctx.wire[i].prop_ptr, uslot[slot].wptr[i].prop_ptr);
|
||||
xctx->maxw = xctx->wires = uslot[slot].wires;
|
||||
wire = my_calloc(221, xctx->wires, sizeof(xWire));
|
||||
for(i=0;i<xctx->wires;i++) {
|
||||
xctx->wire[i] = uslot[slot].wptr[i];
|
||||
xctx->wire[i].prop_ptr=NULL;
|
||||
xctx->wire[i].node=NULL;
|
||||
my_strdup(222, &xctx->wire[i].prop_ptr, uslot[slot].wptr[i].prop_ptr);
|
||||
}
|
||||
|
||||
link_symbols_to_instances();
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ void sig_handler(int s){
|
|||
#ifndef IN_MEMORY_UNDO
|
||||
/* 20180923 no more mkdtemp */
|
||||
my_snprintf(emergency_prefix, S(emergency_prefix), "xschem_emergencysave_%s_",
|
||||
skip_dir(xctx.sch[xctx.currsch]));
|
||||
skip_dir(xctx->sch[xctx->currsch]));
|
||||
if( !(emergency_dir = create_tmpdir(emergency_prefix)) ) {
|
||||
fprintf(errfp, "xinit(): problems creating emergency save dir\n");
|
||||
/* tcleval( "exit"); */
|
||||
|
|
@ -53,7 +53,7 @@ void sig_handler(int s){
|
|||
fprintf(errfp, "EMERGENCY SAVE DIR: %s\n", emergency_dir);
|
||||
#endif
|
||||
fprintf(errfp, "\nFATAL: signal %d\n", s);
|
||||
fprintf(errfp, "while editing: %s\n", skip_dir(xctx.sch[xctx.currsch]));
|
||||
fprintf(errfp, "while editing: %s\n", skip_dir(xctx->sch[xctx->currsch]));
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
|
|
|
|||
813
src/move.c
813
src/move.c
File diff suppressed because it is too large
Load Diff
424
src/netlist.c
424
src/netlist.c
|
|
@ -85,10 +85,10 @@ void hash_inst(int what, int n) /* 20171203 insert object bbox in spatial hash t
|
|||
double x1, y1, x2, y2;
|
||||
int x1a, x2a, y1a, y2a;
|
||||
|
||||
x1=xctx.inst[n].x1;
|
||||
x2=xctx.inst[n].x2;
|
||||
y1=xctx.inst[n].y1;
|
||||
y2=xctx.inst[n].y2;
|
||||
x1=xctx->inst[n].x1;
|
||||
x2=xctx->inst[n].x2;
|
||||
y1=xctx->inst[n].y1;
|
||||
y2=xctx->inst[n].y2;
|
||||
/* ordered bbox */
|
||||
if( x2 < x1) { tmpd=x2;x2=x1;x1=tmpd;}
|
||||
if( y2 < y1) { tmpd=y2;y2=y1;y1=tmpd;}
|
||||
|
|
@ -124,7 +124,7 @@ void hash_instances(void) /* 20171203 insert object bbox in spatial hash table *
|
|||
|
||||
if(prepared_hash_instances) return;
|
||||
del_inst_table();
|
||||
for(n=0; n<xctx.instances; n++) {
|
||||
for(n=0; n<xctx->instances; n++) {
|
||||
hash_inst(XINSERT, n);
|
||||
}
|
||||
prepared_hash_instances=1;
|
||||
|
|
@ -267,17 +267,17 @@ void hash_inst_pin(int what, int i, int j)
|
|||
int rot, flip, sqx, sqy;
|
||||
int rects;
|
||||
|
||||
rects=(xctx.inst[i].ptr+ xctx.sym)->rects[PINLAYER] ;
|
||||
rects=(xctx->inst[i].ptr+ xctx->sym)->rects[PINLAYER] ;
|
||||
if(j>=rects) /* generic pins */
|
||||
{
|
||||
rct=(xctx.inst[i].ptr+ xctx.sym)->rect[GENERICLAYER];
|
||||
rct=(xctx->inst[i].ptr+ xctx->sym)->rect[GENERICLAYER];
|
||||
x0=(rct[j-rects].x1+rct[j-rects].x2)/2;
|
||||
y0=(rct[j-rects].y1+rct[j-rects].y2)/2;
|
||||
prop_ptr = rct[j-rects].prop_ptr;
|
||||
}
|
||||
else
|
||||
{
|
||||
rct=(xctx.inst[i].ptr+ xctx.sym)->rect[PINLAYER];
|
||||
rct=(xctx->inst[i].ptr+ xctx->sym)->rect[PINLAYER];
|
||||
x0=(rct[j].x1+rct[j].x2)/2;
|
||||
y0=(rct[j].y1+rct[j].y2)/2;
|
||||
prop_ptr = rct[j].prop_ptr;
|
||||
|
|
@ -288,18 +288,18 @@ void hash_inst_pin(int what, int i, int j)
|
|||
char str[2048];
|
||||
|
||||
my_snprintf(str, S(str), "symbol %s: missing all or name or dir attributes on pin %d",
|
||||
xctx.inst[i].name, j);
|
||||
xctx->inst[i].name, j);
|
||||
statusmsg(str,2);
|
||||
if(!netlist_count) {
|
||||
xctx.inst[i].flags |=4;
|
||||
xctx->inst[i].flags |=4;
|
||||
hilight_nets=1;
|
||||
}
|
||||
}
|
||||
rot=xctx.inst[i].rot;
|
||||
flip=xctx.inst[i].flip;
|
||||
rot=xctx->inst[i].rot;
|
||||
flip=xctx->inst[i].flip;
|
||||
ROTATION(0.0,0.0,x0,y0,rx1,ry1);
|
||||
x0=xctx.inst[i].x0+rx1;
|
||||
y0=xctx.inst[i].y0+ry1;
|
||||
x0=xctx->inst[i].x0+rx1;
|
||||
y0=xctx->inst[i].y0+ry1;
|
||||
get_square(x0, y0, &sqx, &sqy);
|
||||
if( what == XINSERT ) instpininsert(i, j, x0, y0, sqx, sqy);
|
||||
else instpindelete(i, j, sqx, sqy);
|
||||
|
|
@ -318,27 +318,27 @@ void hash_wire(int what, int n)
|
|||
struct wireentry *wptr;
|
||||
|
||||
|
||||
/* xctx.wire[n].node=NULL; */
|
||||
my_free(827, &xctx.wire[n].node);
|
||||
/* xctx->wire[n].node=NULL; */
|
||||
my_free(827, &xctx->wire[n].node);
|
||||
|
||||
xctx.wire[n].end1 = xctx.wire[n].end2=-1;
|
||||
x1=xctx.wire[n].x1;
|
||||
x2=xctx.wire[n].x2;
|
||||
y1=xctx.wire[n].y1;
|
||||
y2=xctx.wire[n].y2;
|
||||
xctx->wire[n].end1 = xctx->wire[n].end2=-1;
|
||||
x1=xctx->wire[n].x1;
|
||||
x2=xctx->wire[n].x2;
|
||||
y1=xctx->wire[n].y1;
|
||||
y2=xctx->wire[n].y2;
|
||||
/* ordered bbox */
|
||||
if( x2 < x1) { tmpd=x2;x2=x1;x1=tmpd;}
|
||||
if( y2 < y1) { tmpd=y2;y2=y1;y1=tmpd;}
|
||||
|
||||
/* calculate square 4 1st bbox point of xctx.wire[k] */
|
||||
/* calculate square 4 1st bbox point of xctx->wire[k] */
|
||||
x1a=floor(x1/BOXSIZE) ;
|
||||
y1a=floor(y1/BOXSIZE) ;
|
||||
|
||||
/* calculate square 4 2nd bbox point of xctx.wire[k] */
|
||||
/* calculate square 4 2nd bbox point of xctx->wire[k] */
|
||||
x2a=floor(x2/BOXSIZE);
|
||||
y2a=floor(y2/BOXSIZE);
|
||||
|
||||
/*loop thru all squares that intersect bbox of xctx.wire[k] */
|
||||
/*loop thru all squares that intersect bbox of xctx->wire[k] */
|
||||
counti=0;
|
||||
for(i=x1a; i<=x2a && counti < NBOXES; i++)
|
||||
{
|
||||
|
|
@ -349,13 +349,13 @@ void hash_wire(int what, int n)
|
|||
{
|
||||
countj++;
|
||||
tmpj=j%NBOXES; if(tmpj<0) tmpj+=NBOXES;
|
||||
/* insert xctx.wire[n] in region [tmpi, tmpj] */
|
||||
/* insert xctx->wire[n] in region [tmpi, tmpj] */
|
||||
if(what==XINSERT) wireinsert(n, tmpi, tmpj);
|
||||
else wiredelete(n, tmpi, tmpj);
|
||||
|
||||
/* reset ends of all wires that *could* touch xctx.wire[n] */
|
||||
/* reset ends of all wires that *could* touch xctx->wire[n] */
|
||||
for(wptr = wiretable[tmpi][tmpj] ; wptr ; wptr = wptr->next) {
|
||||
xctx.wire[wptr->n].end1 = xctx.wire[wptr->n].end2 = -1;
|
||||
xctx->wire[wptr->n].end1 = xctx->wire[wptr->n].end2 = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -367,7 +367,7 @@ void hash_wires(void)
|
|||
|
||||
if(prepared_hash_wires) return;
|
||||
del_wire_table();
|
||||
for(n=0; n<xctx.wires; n++) hash_wire(XINSERT, n);
|
||||
for(n=0; n<xctx->wires; n++) hash_wire(XINSERT, n);
|
||||
prepared_hash_wires=1;
|
||||
}
|
||||
|
||||
|
|
@ -395,7 +395,7 @@ int check_lib(char *s)
|
|||
void netlist_options(int i)
|
||||
{
|
||||
const char * str;
|
||||
str = get_tok_value(xctx.inst[i].prop_ptr, "bus_replacement_char", 0);
|
||||
str = get_tok_value(xctx->inst[i].prop_ptr, "bus_replacement_char", 0);
|
||||
if(str[0] && str[1] && strlen(str) ==2) {
|
||||
bus_replacement_char[0] = str[0];
|
||||
bus_replacement_char[1] = str[1];
|
||||
|
|
@ -403,16 +403,16 @@ void netlist_options(int i)
|
|||
}
|
||||
/* fprintf(errfp, "netlist_options(): bus_replacement_char=%s\n", str); */
|
||||
|
||||
str = get_tok_value(xctx.inst[i].prop_ptr, "top_subckt", 0);
|
||||
str = get_tok_value(xctx->inst[i].prop_ptr, "top_subckt", 0);
|
||||
if(str[0]) {
|
||||
top_subckt = 0;
|
||||
/* fprintf(errfp, "netlist_options(): prop_ptr=%s\n", xctx.inst[i].prop_ptr); */
|
||||
/* fprintf(errfp, "netlist_options(): prop_ptr=%s\n", xctx->inst[i].prop_ptr); */
|
||||
if(!strcmp(str, "true")) top_subckt = 1;
|
||||
}
|
||||
str = get_tok_value(xctx.inst[i].prop_ptr, "spiceprefix", 0);
|
||||
str = get_tok_value(xctx->inst[i].prop_ptr, "spiceprefix", 0);
|
||||
if(str[0]) {
|
||||
spiceprefix = 1;
|
||||
/* fprintf(errfp, "netlist_options(): prop_ptr=%s\n", xctx.inst[i].prop_ptr); */
|
||||
/* fprintf(errfp, "netlist_options(): prop_ptr=%s\n", xctx->inst[i].prop_ptr); */
|
||||
if(!strcmp(str, "false")) spiceprefix = 0;
|
||||
}
|
||||
}
|
||||
|
|
@ -470,22 +470,22 @@ static void wirecheck(int k) /* recursive routine */
|
|||
int x1a, x2a, y1a, y2a;
|
||||
struct wireentry *ptr2;
|
||||
|
||||
x1=xctx.wire[k].x1;
|
||||
x2=xctx.wire[k].x2;
|
||||
y1=xctx.wire[k].y1;
|
||||
y2=xctx.wire[k].y2;
|
||||
x1=xctx->wire[k].x1;
|
||||
x2=xctx->wire[k].x2;
|
||||
y1=xctx->wire[k].y1;
|
||||
y2=xctx->wire[k].y2;
|
||||
|
||||
/* ordered bbox */
|
||||
RECTORDER(x1, y1, x2, y2);
|
||||
/* calculate square 4 1st bbox point of xctx.wire[k] */
|
||||
/* calculate square 4 1st bbox point of xctx->wire[k] */
|
||||
x1a=floor(x1/BOXSIZE) ;
|
||||
y1a=floor(y1/BOXSIZE) ;
|
||||
|
||||
/* calculate square 4 2nd bbox point of xctx.wire[k] */
|
||||
/* calculate square 4 2nd bbox point of xctx->wire[k] */
|
||||
x2a=floor(x2/BOXSIZE);
|
||||
y2a=floor(y2/BOXSIZE);
|
||||
|
||||
/*loop thru all squares that intersect bbox of xctx.wire[k] */
|
||||
/*loop thru all squares that intersect bbox of xctx->wire[k] */
|
||||
counti=0;
|
||||
for(i=x1a; i<=x2a && counti < NBOXES; i++)
|
||||
{
|
||||
|
|
@ -496,25 +496,25 @@ static void wirecheck(int k) /* recursive routine */
|
|||
{
|
||||
countj++;
|
||||
tmpj=j%NBOXES; if(tmpj<0) tmpj+=NBOXES;
|
||||
/*check if xctx.wire[k] touches wires in square [tmpi, tmpj] */
|
||||
/*check if xctx->wire[k] touches wires in square [tmpi, tmpj] */
|
||||
ptr2=wiretable[tmpi][tmpj];
|
||||
while(ptr2)
|
||||
{
|
||||
if(xctx.wire[ptr2->n].node) {ptr2=ptr2->next; continue;} /* 20171207 net already checked. Move on */
|
||||
if(xctx->wire[ptr2->n].node) {ptr2=ptr2->next; continue;} /* 20171207 net already checked. Move on */
|
||||
if(ptr2->n != k) { /* 20171204 avoid checking wire against itself */
|
||||
touches = touch(xctx.wire[k].x1,xctx.wire[k].y1,xctx.wire[k].x2,xctx.wire[k].y2,
|
||||
xctx.wire[ptr2->n].x1,xctx.wire[ptr2->n].y1) ||
|
||||
touch(xctx.wire[k].x1,xctx.wire[k].y1,xctx.wire[k].x2,xctx.wire[k].y2,
|
||||
xctx.wire[ptr2->n].x2,xctx.wire[ptr2->n].y2) ||
|
||||
touch(xctx.wire[ptr2->n].x1,xctx.wire[ptr2->n].y1,xctx.wire[ptr2->n].x2,
|
||||
xctx.wire[ptr2->n].y2, xctx.wire[k].x1,xctx.wire[k].y1) ||
|
||||
touch(xctx.wire[ptr2->n].x1,xctx.wire[ptr2->n].y1,xctx.wire[ptr2->n].x2,
|
||||
xctx.wire[ptr2->n].y2, xctx.wire[k].x2,xctx.wire[k].y2);
|
||||
touches = touch(xctx->wire[k].x1,xctx->wire[k].y1,xctx->wire[k].x2,xctx->wire[k].y2,
|
||||
xctx->wire[ptr2->n].x1,xctx->wire[ptr2->n].y1) ||
|
||||
touch(xctx->wire[k].x1,xctx->wire[k].y1,xctx->wire[k].x2,xctx->wire[k].y2,
|
||||
xctx->wire[ptr2->n].x2,xctx->wire[ptr2->n].y2) ||
|
||||
touch(xctx->wire[ptr2->n].x1,xctx->wire[ptr2->n].y1,xctx->wire[ptr2->n].x2,
|
||||
xctx->wire[ptr2->n].y2, xctx->wire[k].x1,xctx->wire[k].y1) ||
|
||||
touch(xctx->wire[ptr2->n].x1,xctx->wire[ptr2->n].y1,xctx->wire[ptr2->n].x2,
|
||||
xctx->wire[ptr2->n].y2, xctx->wire[k].x2,xctx->wire[k].y2);
|
||||
if( touches )
|
||||
{
|
||||
my_strdup(239, &xctx.wire[ptr2->n].node, xctx.wire[k].node);
|
||||
my_strdup(240, &xctx.wire[ptr2->n].prop_ptr,
|
||||
subst_token(xctx.wire[ptr2->n].prop_ptr, "lab", xctx.wire[ptr2->n].node));
|
||||
my_strdup(239, &xctx->wire[ptr2->n].node, xctx->wire[k].node);
|
||||
my_strdup(240, &xctx->wire[ptr2->n].prop_ptr,
|
||||
subst_token(xctx->wire[ptr2->n].prop_ptr, "lab", xctx->wire[ptr2->n].node));
|
||||
wirecheck(ptr2->n); /* recursive check */
|
||||
}
|
||||
}
|
||||
|
|
@ -639,42 +639,42 @@ void prepare_netlist_structs(int for_netlist)
|
|||
if (for_netlist>0 && prepared_netlist_structs) return;
|
||||
else if (!for_netlist && prepared_hilight_structs) return;
|
||||
else delete_netlist_structs();
|
||||
if(netlist_count == 0 ) startlevel = xctx.currsch;
|
||||
print_erc = netlist_count == 0 || startlevel < xctx.currsch;
|
||||
if(netlist_count == 0 ) startlevel = xctx->currsch;
|
||||
print_erc = netlist_count == 0 || startlevel < xctx->currsch;
|
||||
|
||||
if (for_netlist>0) {
|
||||
my_snprintf(nn, S(nn), "-----------%s", xctx.sch[xctx.currsch]);
|
||||
my_snprintf(nn, S(nn), "-----------%s", xctx->sch[xctx->currsch]);
|
||||
statusmsg(nn,2);
|
||||
}
|
||||
/* reset wire & inst node labels */
|
||||
dbg(1, "prepare_netlist_structs(): resetting node hash tables\n");
|
||||
hash_wires();
|
||||
for (i=0;i<xctx.instances;i++)
|
||||
for (i=0;i<xctx->instances;i++)
|
||||
{
|
||||
if (xctx.inst[i].ptr<0) continue;
|
||||
if (xctx->inst[i].ptr<0) continue;
|
||||
delete_inst_node(i);
|
||||
rects=(xctx.inst[i].ptr+ xctx.sym)->rects[PINLAYER] +
|
||||
(xctx.inst[i].ptr+ xctx.sym)->rects[GENERICLAYER];
|
||||
rects=(xctx->inst[i].ptr+ xctx->sym)->rects[PINLAYER] +
|
||||
(xctx->inst[i].ptr+ xctx->sym)->rects[GENERICLAYER];
|
||||
if (rects > 0)
|
||||
{
|
||||
xctx.inst[i].node = my_malloc(247, sizeof(char *) * rects);
|
||||
xctx->inst[i].node = my_malloc(247, sizeof(char *) * rects);
|
||||
for (j=0;j<rects;j++)
|
||||
{
|
||||
xctx.inst[i].node[j]=NULL;
|
||||
xctx->inst[i].node[j]=NULL;
|
||||
hash_inst_pin(XINSERT, i, j);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dbg(2, "prepare_netlist_structs(): naming pins from attrs\n");
|
||||
for (i=0;i<xctx.instances;i++)
|
||||
for (i=0;i<xctx->instances;i++)
|
||||
{
|
||||
/* name ipin opin label node fields from prop_ptr attributes */
|
||||
if (xctx.inst[i].ptr<0) continue;
|
||||
if (xctx->inst[i].ptr<0) continue;
|
||||
|
||||
my_strdup(248, &type,(xctx.inst[i].ptr+ xctx.sym)->type);
|
||||
if(print_erc && (!xctx.inst[i].instname || !xctx.inst[i].instname[0]) &&
|
||||
!get_tok_value((xctx.inst[i].ptr+ xctx.sym)->templ, "name", 0)[0]
|
||||
my_strdup(248, &type,(xctx->inst[i].ptr+ xctx->sym)->type);
|
||||
if(print_erc && (!xctx->inst[i].instname || !xctx->inst[i].instname[0]) &&
|
||||
!get_tok_value((xctx->inst[i].ptr+ xctx->sym)->templ, "name", 0)[0]
|
||||
) {
|
||||
char str[2048];
|
||||
if( strcmp(type, "package") &&
|
||||
|
|
@ -683,30 +683,30 @@ void prepare_netlist_structs(int for_netlist)
|
|||
strcmp(type, "arch_declarations") &&
|
||||
strcmp(type, "attributes") &&
|
||||
strcmp(type, "use")) {
|
||||
my_snprintf(str, S(str), "instance: %d (%s): no name attribute set", i, xctx.inst[i].name);
|
||||
my_snprintf(str, S(str), "instance: %d (%s): no name attribute set", i, xctx->inst[i].name);
|
||||
statusmsg(str,2);
|
||||
xctx.inst[i].flags |=4;
|
||||
xctx->inst[i].flags |=4;
|
||||
hilight_nets=1;
|
||||
}
|
||||
}
|
||||
if(print_erc && (!type || !type[0]) ) {
|
||||
char str[2048];
|
||||
my_snprintf(str, S(str), "xSymbol: %s: no type attribute set", xctx.inst[i].name);
|
||||
my_snprintf(str, S(str), "xSymbol: %s: no type attribute set", xctx->inst[i].name);
|
||||
statusmsg(str,2);
|
||||
xctx.inst[i].flags |=4;
|
||||
xctx->inst[i].flags |=4;
|
||||
hilight_nets=1;
|
||||
}
|
||||
if(type && xctx.inst[i].node && IS_LABEL_OR_PIN(type) ) { /* instance must have a pin! */
|
||||
if(type && xctx->inst[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 &&
|
||||
strcmp(get_tok_value(xctx.inst[i].prop_ptr,"verilog_ignore",0),"true")==0 ) continue;
|
||||
strcmp(get_tok_value(xctx->inst[i].prop_ptr,"verilog_ignore",0),"true")==0 ) continue;
|
||||
if( netlist_type == CAD_SPICE_NETLIST &&
|
||||
strcmp(get_tok_value(xctx.inst[i].prop_ptr,"spice_ignore",0),"true")==0 ) continue;
|
||||
strcmp(get_tok_value(xctx->inst[i].prop_ptr,"spice_ignore",0),"true")==0 ) continue;
|
||||
if( netlist_type == CAD_VHDL_NETLIST &&
|
||||
strcmp(get_tok_value(xctx.inst[i].prop_ptr,"vhdl_ignore",0),"true")==0 ) continue;
|
||||
strcmp(get_tok_value(xctx->inst[i].prop_ptr,"vhdl_ignore",0),"true")==0 ) continue;
|
||||
if( netlist_type == CAD_TEDAX_NETLIST &&
|
||||
strcmp(get_tok_value(xctx.inst[i].prop_ptr,"tedax_ignore",0),"true")==0 ) continue;
|
||||
strcmp(get_tok_value(xctx->inst[i].prop_ptr,"tedax_ignore",0),"true")==0 ) continue;
|
||||
}
|
||||
port=0;
|
||||
if (strcmp(type,"label")) { /* instance is a port (not a label) */
|
||||
|
|
@ -714,11 +714,11 @@ void prepare_netlist_structs(int for_netlist)
|
|||
/* 20071204 only define a dir property if instance is not a label */
|
||||
if (!for_netlist) my_strdup(249, &dir, "");
|
||||
else
|
||||
my_strdup(250, &dir, get_tok_value( (xctx.inst[i].ptr+ xctx.sym)->rect[PINLAYER][0].prop_ptr, "dir",0));
|
||||
my_strdup(250, &dir, get_tok_value( (xctx->inst[i].ptr+ xctx->sym)->rect[PINLAYER][0].prop_ptr, "dir",0));
|
||||
}
|
||||
else {
|
||||
/* handle global nodes (global=1 set as symbol property) 28032003 */
|
||||
my_strdup(251, &global_node,get_tok_value((xctx.inst[i].ptr+ xctx.sym)->prop_ptr,"global",0));
|
||||
my_strdup(251, &global_node,get_tok_value((xctx->inst[i].ptr+ xctx->sym)->prop_ptr,"global",0));
|
||||
/*20071204 if instance is a label dont define a dir property for more precise erc checking */
|
||||
my_strdup(252, &dir,"none");
|
||||
}
|
||||
|
|
@ -733,69 +733,69 @@ void prepare_netlist_structs(int for_netlist)
|
|||
my_free(833, &value);
|
||||
my_free(834, &class);
|
||||
} else {
|
||||
my_strdup(258, &sig_type,get_tok_value(xctx.inst[i].prop_ptr,"sig_type",0));
|
||||
my_strdup(259, &verilog_type,get_tok_value(xctx.inst[i].prop_ptr,"verilog_type",0));
|
||||
my_strdup(260, &value,get_tok_value(xctx.inst[i].prop_ptr,"value",2));
|
||||
my_strdup(261, &class,get_tok_value(xctx.inst[i].prop_ptr,"class",0));
|
||||
my_strdup(258, &sig_type,get_tok_value(xctx->inst[i].prop_ptr,"sig_type",0));
|
||||
my_strdup(259, &verilog_type,get_tok_value(xctx->inst[i].prop_ptr,"verilog_type",0));
|
||||
my_strdup(260, &value,get_tok_value(xctx->inst[i].prop_ptr,"value",2));
|
||||
my_strdup(261, &class,get_tok_value(xctx->inst[i].prop_ptr,"class",0));
|
||||
}
|
||||
|
||||
my_strdup(262, &xctx.inst[i].node[0], get_tok_value(xctx.inst[i].prop_ptr,"lab",1));
|
||||
my_strdup(262, &xctx->inst[i].node[0], get_tok_value(xctx->inst[i].prop_ptr,"lab",1));
|
||||
|
||||
if (!(xctx.inst[i].node[0])) {
|
||||
my_strdup(65, &xctx.inst[i].node[0], get_tok_value((xctx.inst[i].ptr+ xctx.sym)->templ, "lab",1));
|
||||
dbg(1, "no lab attr on instance, pick from symbol: %s\n", xctx.inst[i].node[0]);
|
||||
if (!(xctx->inst[i].node[0])) {
|
||||
my_strdup(65, &xctx->inst[i].node[0], get_tok_value((xctx->inst[i].ptr+ xctx->sym)->templ, "lab",1));
|
||||
dbg(1, "no lab attr on instance, pick from symbol: %s\n", xctx->inst[i].node[0]);
|
||||
}
|
||||
/* handle global nodes (global=1 set as symbol property) 28032003 */
|
||||
if (!strcmp(type,"label") && global_node && !strcmp(global_node, "true")) {
|
||||
dbg(1, "prepare_netlist_structs(): global node: %s\n",xctx.inst[i].node[0]);
|
||||
record_global_node(1,NULL, xctx.inst[i].node[0]);
|
||||
dbg(1, "prepare_netlist_structs(): global node: %s\n",xctx->inst[i].node[0]);
|
||||
record_global_node(1,NULL, xctx->inst[i].node[0]);
|
||||
}
|
||||
|
||||
/* do not count multiple labels/pins with same name */
|
||||
bus_hash_lookup(xctx.inst[i].node[0], /* insert node in hash table */
|
||||
bus_hash_lookup(xctx->inst[i].node[0], /* insert node in hash table */
|
||||
dir, XINSERT, port, sig_type, verilog_type, value, class);
|
||||
|
||||
dbg(2, "prepare_netlist_structs(): name=%s\n",
|
||||
get_tok_value( xctx.inst[i].prop_ptr, "lab",0));
|
||||
get_tok_value( xctx->inst[i].prop_ptr, "lab",0));
|
||||
dbg(2, "prepare_netlist_structs(): pin=%s\n",
|
||||
get_tok_value( (xctx.inst[i].ptr+ xctx.sym)->rect[PINLAYER][0].prop_ptr, "name",0));
|
||||
get_tok_value( (xctx->inst[i].ptr+ xctx->sym)->rect[PINLAYER][0].prop_ptr, "name",0));
|
||||
dbg(2, "prepare_netlist_structs(): dir=%s\n",
|
||||
get_tok_value( (xctx.inst[i].ptr+ xctx.sym)->rect[PINLAYER][0].prop_ptr, "dir",0));
|
||||
get_tok_value( (xctx->inst[i].ptr+ xctx->sym)->rect[PINLAYER][0].prop_ptr, "dir",0));
|
||||
|
||||
/* name nets that touch ioin opin alias instances */
|
||||
rct=(xctx.inst[i].ptr+ xctx.sym)->rect[PINLAYER];
|
||||
rct=(xctx->inst[i].ptr+ xctx->sym)->rect[PINLAYER];
|
||||
x0=(rct[0].x1+rct[0].x2)/2;
|
||||
y0=(rct[0].y1+rct[0].y2)/2;
|
||||
rot=xctx.inst[i].rot;
|
||||
flip=xctx.inst[i].flip;
|
||||
rot=xctx->inst[i].rot;
|
||||
flip=xctx->inst[i].flip;
|
||||
ROTATION(0.0,0.0,x0,y0,rx1,ry1);
|
||||
x0=xctx.inst[i].x0+rx1;
|
||||
y0=xctx.inst[i].y0+ry1;
|
||||
x0=xctx->inst[i].x0+rx1;
|
||||
y0=xctx->inst[i].y0+ry1;
|
||||
get_square(x0, y0, &sqx, &sqy);
|
||||
wptr=wiretable[sqx][sqy];
|
||||
if (xctx.inst[i].node[0]) while(wptr)
|
||||
if (xctx->inst[i].node[0]) while(wptr)
|
||||
{
|
||||
if (touch(xctx.wire[wptr->n].x1, xctx.wire[wptr->n].y1,
|
||||
xctx.wire[wptr->n].x2, xctx.wire[wptr->n].y2, x0,y0))
|
||||
if (touch(xctx->wire[wptr->n].x1, xctx->wire[wptr->n].y1,
|
||||
xctx->wire[wptr->n].x2, xctx->wire[wptr->n].y2, x0,y0))
|
||||
{
|
||||
/* short circuit check */
|
||||
if (for_netlist>0) signal_short(xctx.wire[wptr->n].node, xctx.inst[i].node[0]);
|
||||
my_strdup(263, &xctx.wire[wptr->n].node, xctx.inst[i].node[0]);
|
||||
my_strdup(264, &xctx.wire[wptr->n].prop_ptr,
|
||||
subst_token(xctx.wire[wptr->n].prop_ptr, "lab", xctx.wire[wptr->n].node));
|
||||
if (for_netlist>0) signal_short(xctx->wire[wptr->n].node, xctx->inst[i].node[0]);
|
||||
my_strdup(263, &xctx->wire[wptr->n].node, xctx->inst[i].node[0]);
|
||||
my_strdup(264, &xctx->wire[wptr->n].prop_ptr,
|
||||
subst_token(xctx->wire[wptr->n].prop_ptr, "lab", xctx->wire[wptr->n].node));
|
||||
wirecheck(wptr->n);
|
||||
}
|
||||
wptr=wptr->next;
|
||||
}
|
||||
} /* if(type && ... */
|
||||
} /* for(i=0;i<xctx.instances... */
|
||||
} /* for(i=0;i<xctx->instances... */
|
||||
|
||||
/* name nets that do not touch ipin opin alias instances */
|
||||
dbg(2, "prepare_netlist_structs(): naming nets that dont touch labels\n");
|
||||
get_unnamed_node(0,0,0); /*initializes node multiplicity data struct */
|
||||
for (i=0;i<xctx.wires;i++)
|
||||
for (i=0;i<xctx->wires;i++)
|
||||
{
|
||||
if(xctx.wire[i].node == NULL)
|
||||
if(xctx->wire[i].node == NULL)
|
||||
{
|
||||
my_snprintf(tmp_str, S(tmp_str), "#net%d", get_unnamed_node(1,0,0));
|
||||
|
||||
|
|
@ -803,10 +803,10 @@ void prepare_netlist_structs(int for_netlist)
|
|||
while (bus_hash_lookup(&tmp_str[1], "", XLOOKUP, 0, "", "", "", "")!=NULL)
|
||||
my_snprintf(tmp_str, S(tmp_str), "#net%d", get_unnamed_node(1, 0, 0));
|
||||
|
||||
my_strdup(265, &xctx.wire[i].node , tmp_str);
|
||||
my_strdup(266, &xctx.wire[i].prop_ptr,
|
||||
subst_token(xctx.wire[i].prop_ptr, "lab", xctx.wire[i].node));
|
||||
bus_hash_lookup(xctx.wire[i].node,"", XINSERT, 0,"","","",""); /* insert unnamed wire name in hash table */
|
||||
my_strdup(265, &xctx->wire[i].node , tmp_str);
|
||||
my_strdup(266, &xctx->wire[i].prop_ptr,
|
||||
subst_token(xctx->wire[i].prop_ptr, "lab", xctx->wire[i].node));
|
||||
bus_hash_lookup(xctx->wire[i].node,"", XINSERT, 0,"","","",""); /* insert unnamed wire name in hash table */
|
||||
wirecheck(i);
|
||||
}
|
||||
}
|
||||
|
|
@ -816,24 +816,24 @@ void prepare_netlist_structs(int for_netlist)
|
|||
|
||||
/* name generic pins from attached labels */
|
||||
dbg(2, "prepare_netlist_structs(): naming generics from attached labels\n");
|
||||
if(for_netlist) for (i=0;i<xctx.instances;i++) { /* ... assign node fields on all (non label) instances */
|
||||
if (xctx.inst[i].ptr<0) continue;
|
||||
my_strdup(267, &type,(xctx.inst[i].ptr+ xctx.sym)->type);
|
||||
if(for_netlist) for (i=0;i<xctx->instances;i++) { /* ... assign node fields on all (non label) instances */
|
||||
if (xctx->inst[i].ptr<0) continue;
|
||||
my_strdup(267, &type,(xctx->inst[i].ptr+ xctx->sym)->type);
|
||||
if (type && !IS_LABEL_OR_PIN(type) ) {
|
||||
if ((generic_rects = (xctx.inst[i].ptr+ xctx.sym)->rects[GENERICLAYER]) > 0)
|
||||
if ((generic_rects = (xctx->inst[i].ptr+ xctx->sym)->rects[GENERICLAYER]) > 0)
|
||||
{
|
||||
rects = (xctx.inst[i].ptr+ xctx.sym)->rects[PINLAYER];
|
||||
rects = (xctx->inst[i].ptr+ xctx->sym)->rects[PINLAYER];
|
||||
for (j=rects;j<rects+generic_rects;j++)
|
||||
{
|
||||
if (xctx.inst[i].node[j]) continue; /* already named node */
|
||||
rct=(xctx.inst[i].ptr+ xctx.sym)->rect[GENERICLAYER];
|
||||
if (xctx->inst[i].node[j]) continue; /* already named node */
|
||||
rct=(xctx->inst[i].ptr+ xctx->sym)->rect[GENERICLAYER];
|
||||
x0=(rct[j-rects].x1+rct[j-rects].x2)/2;
|
||||
y0=(rct[j-rects].y1+rct[j-rects].y2)/2;
|
||||
rot=xctx.inst[i].rot;
|
||||
flip=xctx.inst[i].flip;
|
||||
rot=xctx->inst[i].rot;
|
||||
flip=xctx->inst[i].flip;
|
||||
ROTATION(0.0,0.0,x0,y0,rx1,ry1);
|
||||
x0=xctx.inst[i].x0+rx1;
|
||||
y0=xctx.inst[i].y0+ry1;
|
||||
x0=xctx->inst[i].x0+rx1;
|
||||
y0=xctx->inst[i].y0+ry1;
|
||||
get_square(x0, y0, &sqx, &sqy);
|
||||
|
||||
iptr=instpintable[sqx][sqy];
|
||||
|
|
@ -846,33 +846,33 @@ void prepare_netlist_structs(int for_netlist)
|
|||
}
|
||||
if ((iptr->x0==x0) && (iptr->y0==y0))
|
||||
{
|
||||
if ((xctx.inst[iptr->n].ptr+ xctx.sym)->type && xctx.inst[iptr->n].node[iptr->pin] != NULL &&
|
||||
!strcmp((xctx.inst[iptr->n].ptr+ xctx.sym)->type, "label"))
|
||||
if ((xctx->inst[iptr->n].ptr+ xctx->sym)->type && xctx->inst[iptr->n].node[iptr->pin] != NULL &&
|
||||
!strcmp((xctx->inst[iptr->n].ptr+ xctx->sym)->type, "label"))
|
||||
{
|
||||
dbg(2, "prepare_netlist_structs(): naming generic %s\n",
|
||||
xctx.inst[iptr->n].node[iptr->pin]);
|
||||
xctx->inst[iptr->n].node[iptr->pin]);
|
||||
|
||||
my_strdup(268, &xctx.inst[i].node[j],
|
||||
get_tok_value(xctx.inst[iptr->n].prop_ptr,"value",2) );
|
||||
my_strdup(268, &xctx->inst[i].node[j],
|
||||
get_tok_value(xctx->inst[iptr->n].prop_ptr,"value",2) );
|
||||
|
||||
/*my_strdup(269, &xctx.inst[i].node[j], xctx.inst[iptr->n].node[iptr->pin] ); */
|
||||
/*my_strdup(269, &xctx->inst[i].node[j], xctx->inst[iptr->n].node[iptr->pin] ); */
|
||||
|
||||
if (!for_netlist) {
|
||||
my_strdup(270, &sig_type,"");
|
||||
bus_hash_lookup(xctx.inst[iptr->n].node[iptr->pin],"none",
|
||||
bus_hash_lookup(xctx->inst[iptr->n].node[iptr->pin],"none",
|
||||
XINSERT, 1, sig_type,"", "","");
|
||||
} else {
|
||||
my_strdup(271, &sig_type,get_tok_value(
|
||||
(xctx.inst[i].ptr+ xctx.sym)->rect[GENERICLAYER][j-rects].prop_ptr, "sig_type",0));
|
||||
(xctx->inst[i].ptr+ xctx->sym)->rect[GENERICLAYER][j-rects].prop_ptr, "sig_type",0));
|
||||
|
||||
/* insert generic label in hash table as a port so it will not */
|
||||
/* be declared as a signal in the vhdl netlist. this is a workaround */
|
||||
/* that should be fixed 25092001 */
|
||||
bus_hash_lookup(xctx.inst[iptr->n].node[iptr->pin],
|
||||
get_tok_value((xctx.inst[i].ptr+ xctx.sym)->rect[GENERICLAYER][j-rects].prop_ptr, "dir",0),
|
||||
bus_hash_lookup(xctx->inst[iptr->n].node[iptr->pin],
|
||||
get_tok_value((xctx->inst[i].ptr+ xctx->sym)->rect[GENERICLAYER][j-rects].prop_ptr, "dir",0),
|
||||
XINSERT, 1, sig_type,"", "","");
|
||||
}
|
||||
} /* end if(xctx.inst[iptr->n].node[iptr->pin] != NULL) */
|
||||
} /* end if(xctx->inst[iptr->n].node[iptr->pin] != NULL) */
|
||||
} /* end if( (iptr->x0==x0) && (iptr->y0==y0) ) */
|
||||
iptr=iptr->next;
|
||||
}
|
||||
|
|
@ -885,54 +885,54 @@ void prepare_netlist_structs(int for_netlist)
|
|||
|
||||
/* name instance pins of non (label,pin) instances */
|
||||
dbg(2, "prepare_netlist_structs(): assigning node names on instance pins\n");
|
||||
for (i=0;i<xctx.instances;i++) /* ... assign node fields on all (non label) instances */
|
||||
for (i=0;i<xctx->instances;i++) /* ... assign node fields on all (non label) instances */
|
||||
{
|
||||
if(xctx.inst[i].ptr<0) continue;
|
||||
expandlabel(xctx.inst[i].instname, &inst_mult);
|
||||
my_strdup(272, &type,(xctx.inst[i].ptr+ xctx.sym)->type);
|
||||
if(xctx->inst[i].ptr<0) continue;
|
||||
expandlabel(xctx->inst[i].instname, &inst_mult);
|
||||
my_strdup(272, &type,(xctx->inst[i].ptr+ xctx->sym)->type);
|
||||
if (type && !IS_LABEL_OR_PIN(type) ) {
|
||||
if ((rects = (xctx.inst[i].ptr+ xctx.sym)->rects[PINLAYER]) > 0)
|
||||
if ((rects = (xctx->inst[i].ptr+ xctx->sym)->rects[PINLAYER]) > 0)
|
||||
{
|
||||
for (j=0;j<rects;j++)
|
||||
{
|
||||
touches=0;
|
||||
if (xctx.inst[i].node[j]) continue; /* already named node */
|
||||
rct=(xctx.inst[i].ptr+ xctx.sym)->rect[PINLAYER];
|
||||
if (xctx->inst[i].node[j]) continue; /* already named node */
|
||||
rct=(xctx->inst[i].ptr+ xctx->sym)->rect[PINLAYER];
|
||||
x0=(rct[j].x1+rct[j].x2)/2;
|
||||
y0=(rct[j].y1+rct[j].y2)/2;
|
||||
rot=xctx.inst[i].rot;
|
||||
flip=xctx.inst[i].flip;
|
||||
rot=xctx->inst[i].rot;
|
||||
flip=xctx->inst[i].flip;
|
||||
ROTATION(0.0,0.0,x0,y0,rx1,ry1);
|
||||
x0=xctx.inst[i].x0+rx1;
|
||||
y0=xctx.inst[i].y0+ry1;
|
||||
x0=xctx->inst[i].x0+rx1;
|
||||
y0=xctx->inst[i].y0+ry1;
|
||||
get_square(x0, y0, &sqx, &sqy);
|
||||
/* name instance nodes that touch named nets */
|
||||
wptr=wiretable[sqx][sqy];
|
||||
dbg(2, "prepare_netlist_structs(): from attached nets\n");
|
||||
while (wptr)
|
||||
{
|
||||
if (touch(xctx.wire[wptr->n].x1, xctx.wire[wptr->n].y1,
|
||||
xctx.wire[wptr->n].x2, xctx.wire[wptr->n].y2, x0,y0))
|
||||
if (touch(xctx->wire[wptr->n].x1, xctx->wire[wptr->n].y1,
|
||||
xctx->wire[wptr->n].x2, xctx->wire[wptr->n].y2, x0,y0))
|
||||
{
|
||||
|
||||
/* short circuit check */
|
||||
if (touches)
|
||||
{
|
||||
if (for_netlist>0) signal_short(xctx.inst[i].node[j], xctx.wire[wptr->n].node);
|
||||
if (for_netlist>0) signal_short(xctx->inst[i].node[j], xctx->wire[wptr->n].node);
|
||||
}
|
||||
if (!touches)
|
||||
{
|
||||
my_strdup(273, &xctx.inst[i].node[j], xctx.wire[wptr->n].node );
|
||||
bus_hash_lookup(xctx.inst[i].node[j],
|
||||
get_tok_value( (xctx.inst[i].ptr+ xctx.sym)->rect[PINLAYER][j].prop_ptr, "dir",0),
|
||||
my_strdup(273, &xctx->inst[i].node[j], xctx->wire[wptr->n].node );
|
||||
bus_hash_lookup(xctx->inst[i].node[j],
|
||||
get_tok_value( (xctx->inst[i].ptr+ xctx->sym)->rect[PINLAYER][j].prop_ptr, "dir",0),
|
||||
XINSERT, 0,"","","","");
|
||||
|
||||
if (xctx.wire[wptr->n].node[0]=='#') /* unnamed node, update its multiplicity */
|
||||
if (xctx->wire[wptr->n].node[0]=='#') /* unnamed node, update its multiplicity */
|
||||
{
|
||||
expandlabel(get_tok_value(
|
||||
(xctx.inst[i].ptr+ xctx.sym)->rect[PINLAYER][j].prop_ptr,"name",0),&pin_mult);
|
||||
(xctx->inst[i].ptr+ xctx->sym)->rect[PINLAYER][j].prop_ptr,"name",0),&pin_mult);
|
||||
|
||||
get_unnamed_node(2, pin_mult * inst_mult, atoi((xctx.inst[i].node[j])+4) );
|
||||
get_unnamed_node(2, pin_mult * inst_mult, atoi((xctx->inst[i].node[j])+4) );
|
||||
}
|
||||
} /* end if(!touches) */
|
||||
touches=1;
|
||||
|
|
@ -952,35 +952,35 @@ void prepare_netlist_structs(int for_netlist)
|
|||
}
|
||||
if ((iptr->x0==x0) && (iptr->y0==y0))
|
||||
{
|
||||
if (xctx.inst[iptr->n].node[iptr->pin] != NULL)
|
||||
if (xctx->inst[iptr->n].node[iptr->pin] != NULL)
|
||||
{
|
||||
/* short circuit check */
|
||||
if (touches)
|
||||
{
|
||||
if (for_netlist>0) signal_short(xctx.inst[i].node[j], xctx.inst[iptr->n].node[iptr->pin]);
|
||||
if (for_netlist>0) signal_short(xctx->inst[i].node[j], xctx->inst[iptr->n].node[iptr->pin]);
|
||||
}
|
||||
if (!touches)
|
||||
{
|
||||
my_strdup(274, &xctx.inst[i].node[j], xctx.inst[iptr->n].node[iptr->pin] );
|
||||
my_strdup(274, &xctx->inst[i].node[j], xctx->inst[iptr->n].node[iptr->pin] );
|
||||
if (!for_netlist) {
|
||||
bus_hash_lookup(xctx.inst[i].node[j],"none", XINSERT, 0,"","","","");
|
||||
bus_hash_lookup(xctx->inst[i].node[j],"none", XINSERT, 0,"","","","");
|
||||
} else {
|
||||
bus_hash_lookup(xctx.inst[i].node[j],
|
||||
get_tok_value( (xctx.inst[i].ptr+ xctx.sym)->rect[PINLAYER][j].prop_ptr, "dir",0),
|
||||
bus_hash_lookup(xctx->inst[i].node[j],
|
||||
get_tok_value( (xctx->inst[i].ptr+ xctx->sym)->rect[PINLAYER][j].prop_ptr, "dir",0),
|
||||
XINSERT, 0,"","","","");
|
||||
}
|
||||
if ((xctx.inst[i].node[j])[0] == '#')
|
||||
if ((xctx->inst[i].node[j])[0] == '#')
|
||||
{
|
||||
expandlabel(get_tok_value(
|
||||
(xctx.inst[i].ptr+ xctx.sym)->rect[PINLAYER][j].prop_ptr,"name",0),&pin_mult );
|
||||
(xctx->inst[i].ptr+ xctx->sym)->rect[PINLAYER][j].prop_ptr,"name",0),&pin_mult );
|
||||
/* done at beginning of for(i) loop 20171210 */
|
||||
/* expandlabel(get_tok_value( */
|
||||
/* xctx.inst[i].prop_ptr,"name",0), &inst_mult); */
|
||||
get_unnamed_node(2, pin_mult * inst_mult, atoi((xctx.inst[i].node[j])+4));
|
||||
/* xctx->inst[i].prop_ptr,"name",0), &inst_mult); */
|
||||
get_unnamed_node(2, pin_mult * inst_mult, atoi((xctx->inst[i].node[j])+4));
|
||||
}
|
||||
}
|
||||
touches=1;
|
||||
} /* end if(xctx.inst[iptr->n].node[iptr->pin] != NULL) */
|
||||
} /* end if(xctx->inst[iptr->n].node[iptr->pin] != NULL) */
|
||||
else /* touches instance with unnamed pins */
|
||||
{
|
||||
touches_unnamed=1;
|
||||
|
|
@ -996,17 +996,17 @@ void prepare_netlist_structs(int for_netlist)
|
|||
if (!(CAD_VHDL_NETLIST && !touches_unnamed))
|
||||
{
|
||||
expandlabel(get_tok_value(
|
||||
(xctx.inst[i].ptr+ xctx.sym)->rect[PINLAYER][j].prop_ptr,"name",0), &pin_mult);
|
||||
(xctx->inst[i].ptr+ xctx->sym)->rect[PINLAYER][j].prop_ptr,"name",0), &pin_mult);
|
||||
/* done at beginning of for(i) loop 20171210 */
|
||||
/* expandlabel(get_tok_value( */
|
||||
/* xctx.inst[i].prop_ptr,"name",0), &inst_mult); */
|
||||
/* xctx->inst[i].prop_ptr,"name",0), &inst_mult); */
|
||||
my_snprintf( tmp_str, S(tmp_str), "#net%d", get_unnamed_node(1, pin_mult * inst_mult, 0));
|
||||
my_strdup(275, &xctx.inst[i].node[j], tmp_str );
|
||||
my_strdup(275, &xctx->inst[i].node[j], tmp_str );
|
||||
if (!for_netlist) {
|
||||
bus_hash_lookup(xctx.inst[i].node[j],"none", XINSERT, 0,"","","","");
|
||||
bus_hash_lookup(xctx->inst[i].node[j],"none", XINSERT, 0,"","","","");
|
||||
} else {
|
||||
bus_hash_lookup(xctx.inst[i].node[j],
|
||||
get_tok_value( (xctx.inst[i].ptr+ xctx.sym)->rect[PINLAYER][j].prop_ptr, "dir",0),
|
||||
bus_hash_lookup(xctx->inst[i].node[j],
|
||||
get_tok_value( (xctx->inst[i].ptr+ xctx->sym)->rect[PINLAYER][j].prop_ptr, "dir",0),
|
||||
XINSERT, 0,"","","","");
|
||||
}
|
||||
}
|
||||
|
|
@ -1051,28 +1051,28 @@ int sym_vs_sch_pins()
|
|||
int endfile;
|
||||
char tag[1];
|
||||
char filename[PATH_MAX];
|
||||
n_syms = xctx.symbols;
|
||||
n_syms = xctx->symbols;
|
||||
for(i=0;i<n_syms;i++)
|
||||
{
|
||||
if( xctx.sym[i].type && !strcmp(xctx.sym[i].type,"subcircuit")) {
|
||||
rects = xctx.sym[i].rects[PINLAYER];
|
||||
my_strncpy(filename, abs_sym_path(get_tok_value(xctx.sym[i].prop_ptr, "schematic", 0), "") , S(filename));
|
||||
if( xctx->sym[i].type && !strcmp(xctx->sym[i].type,"subcircuit")) {
|
||||
rects = xctx->sym[i].rects[PINLAYER];
|
||||
my_strncpy(filename, abs_sym_path(get_tok_value(xctx->sym[i].prop_ptr, "schematic", 0), "") , S(filename));
|
||||
if(!filename[0]) {
|
||||
my_strncpy(filename, add_ext(abs_sym_path(xctx.sym[i].name, ""), ".sch"), S(filename));
|
||||
my_strncpy(filename, add_ext(abs_sym_path(xctx->sym[i].name, ""), ".sch"), S(filename));
|
||||
}
|
||||
if(!stat(filename, &buf)) {
|
||||
fd = fopen(filename, "r");
|
||||
pin_cnt = 0;
|
||||
endfile = 0;
|
||||
version_found=0;
|
||||
xctx.file_version[0] = '\0';
|
||||
xctx->file_version[0] = '\0';
|
||||
while(!endfile) {
|
||||
if(fscanf(fd," %c",tag)==EOF) break;
|
||||
switch(tag[0]) {
|
||||
case 'v':
|
||||
load_ascii_string(&xctx.version_string, fd);
|
||||
my_snprintf(xctx.file_version, S(xctx.file_version), "%s",
|
||||
get_tok_value(xctx.version_string, "file_version", 0));
|
||||
load_ascii_string(&xctx->version_string, fd);
|
||||
my_snprintf(xctx->file_version, S(xctx->file_version), "%s",
|
||||
get_tok_value(xctx->version_string, "file_version", 0));
|
||||
version_found = 1;
|
||||
break;
|
||||
|
||||
|
|
@ -1130,7 +1130,7 @@ int sym_vs_sch_pins()
|
|||
load_ascii_string(&tmp, fd);
|
||||
my_strncpy(name, tmp, S(name));
|
||||
|
||||
if(!strcmp(xctx.file_version,"1.0") ) {
|
||||
if(!strcmp(xctx->file_version,"1.0") ) {
|
||||
dbg(1, "sym_vs_sch_pins(): add_ext(name,\".sym\") = %s\n", add_ext(name, ".sym") );
|
||||
my_strncpy(name, add_ext(name, ".sym"), S(name));
|
||||
}
|
||||
|
|
@ -1142,7 +1142,7 @@ int sym_vs_sch_pins()
|
|||
}
|
||||
load_ascii_string(&tmp,fd);
|
||||
symbol = match_symbol(name);
|
||||
my_strdup(276, &type, xctx.sym[symbol].type);
|
||||
my_strdup(276, &type, xctx->sym[symbol].type);
|
||||
if(type && IS_PIN(type)) {
|
||||
my_strdup(292, &lab, get_tok_value(tmp, "lab", 0));
|
||||
if(pin_cnt >= lab_array_size) {
|
||||
|
|
@ -1154,8 +1154,8 @@ int sym_vs_sch_pins()
|
|||
pin_cnt++;
|
||||
pin_match = 0;
|
||||
for(j=0; j < rects; j++) {
|
||||
my_strdup(293, &pin_name, get_tok_value(xctx.sym[i].rect[PINLAYER][j].prop_ptr, "name", 0));
|
||||
my_strdup(294, &pin_dir, get_tok_value(xctx.sym[i].rect[PINLAYER][j].prop_ptr, "dir", 0));
|
||||
my_strdup(293, &pin_name, get_tok_value(xctx->sym[i].rect[PINLAYER][j].prop_ptr, "name", 0));
|
||||
my_strdup(294, &pin_dir, get_tok_value(xctx->sym[i].rect[PINLAYER][j].prop_ptr, "dir", 0));
|
||||
if( pin_name && !strcmp(pin_name, lab)) {
|
||||
if(!(
|
||||
( !strcmp(type, "ipin") && !strcmp(pin_dir, "in") ) ||
|
||||
|
|
@ -1165,13 +1165,13 @@ int sym_vs_sch_pins()
|
|||
) {
|
||||
char str[2048];
|
||||
my_snprintf(str, S(str), "xSymbol %s: Unmatched subcircuit schematic pin direction: %s",
|
||||
xctx.sym[i].name, lab);
|
||||
xctx->sym[i].name, lab);
|
||||
statusmsg(str,2);
|
||||
my_snprintf(str, S(str), " %s <--> %s", type, pin_dir);
|
||||
statusmsg(str,2);
|
||||
for(j = 0; j < xctx.instances; j++) {
|
||||
if(!strcmp(xctx.inst[j].name, xctx.sym[i].name)) {
|
||||
xctx.inst[j].flags |=4;
|
||||
for(j = 0; j < xctx->instances; j++) {
|
||||
if(!strcmp(xctx->inst[j].name, xctx->sym[i].name)) {
|
||||
xctx->inst[j].flags |=4;
|
||||
hilight_nets=1;
|
||||
}
|
||||
}
|
||||
|
|
@ -1183,11 +1183,11 @@ int sym_vs_sch_pins()
|
|||
if(!pin_match) {
|
||||
char str[2048];
|
||||
/* fprintf(errfp, " unmatched sch / sym pin: %s\n", lab); */
|
||||
my_snprintf(str, S(str), "xSymbol %s: schematic pin: %s not in symbol", xctx.sym[i].name, lab);
|
||||
my_snprintf(str, S(str), "xSymbol %s: schematic pin: %s not in symbol", xctx->sym[i].name, lab);
|
||||
statusmsg(str,2);
|
||||
for(j = 0; j < xctx.instances; j++) {
|
||||
if(!strcmp(xctx.inst[j].name, xctx.sym[i].name)) {
|
||||
xctx.inst[j].flags |=4;
|
||||
for(j = 0; j < xctx->instances; j++) {
|
||||
if(!strcmp(xctx->inst[j].name, xctx->sym[i].name)) {
|
||||
xctx->inst[j].flags |=4;
|
||||
hilight_nets=1;
|
||||
}
|
||||
}
|
||||
|
|
@ -1208,26 +1208,26 @@ int sym_vs_sch_pins()
|
|||
}
|
||||
read_line(fd, 0); /* discard any remaining characters till (but not including) newline */
|
||||
if(check_version && !version_found) break;
|
||||
if(!xctx.file_version[0]) {
|
||||
my_snprintf(xctx.file_version, S(xctx.file_version), "1.0");
|
||||
dbg(1, "sym_vs_sch_pins(): no file_version, assuming file_version=%s\n", xctx.file_version);
|
||||
if(!xctx->file_version[0]) {
|
||||
my_snprintf(xctx->file_version, S(xctx->file_version), "1.0");
|
||||
dbg(1, "sym_vs_sch_pins(): no file_version, assuming file_version=%s\n", xctx->file_version);
|
||||
}
|
||||
} /* while(!endfile) */
|
||||
fclose(fd);
|
||||
if(pin_cnt != rects) {
|
||||
char str[2048];
|
||||
my_snprintf(str, S(str), "xSymbol %s has %d pins, its schematic has %d pins",
|
||||
xctx.sym[i].name, rects, pin_cnt);
|
||||
xctx->sym[i].name, rects, pin_cnt);
|
||||
statusmsg(str,2);
|
||||
for(j = 0; j < xctx.instances; j++) {
|
||||
if(!strcmp(xctx.inst[j].name, xctx.sym[i].name)) {
|
||||
xctx.inst[j].flags |=4;
|
||||
for(j = 0; j < xctx->instances; j++) {
|
||||
if(!strcmp(xctx->inst[j].name, xctx->sym[i].name)) {
|
||||
xctx->inst[j].flags |=4;
|
||||
hilight_nets=1;
|
||||
}
|
||||
}
|
||||
}
|
||||
for(j=0; j < rects; j++) {
|
||||
my_strdup(295, &pin_name, get_tok_value(xctx.sym[i].rect[PINLAYER][j].prop_ptr, "name", 0));
|
||||
my_strdup(295, &pin_name, get_tok_value(xctx->sym[i].rect[PINLAYER][j].prop_ptr, "name", 0));
|
||||
pin_match = 0;
|
||||
for(k=0; k<pin_cnt; k++) {
|
||||
if(pin_name && !strcmp(lab_array[k], pin_name)) {
|
||||
|
|
@ -1239,11 +1239,11 @@ int sym_vs_sch_pins()
|
|||
char str[2048];
|
||||
/* fprintf(errfp, " unmatched sch / sym pin: %s\n", lab); */
|
||||
my_snprintf(str, S(str), "xSymbol %s: symbol pin: %s not in schematic",
|
||||
xctx.sym[i].name, pin_name ? pin_name : "<NULL>");
|
||||
xctx->sym[i].name, pin_name ? pin_name : "<NULL>");
|
||||
statusmsg(str,2);
|
||||
for(k = 0; k < xctx.instances; k++) {
|
||||
if(!strcmp(xctx.inst[k].name, xctx.sym[i].name)) {
|
||||
xctx.inst[k].flags |=4;
|
||||
for(k = 0; k < xctx->instances; k++) {
|
||||
if(!strcmp(xctx->inst[k].name, xctx->sym[i].name)) {
|
||||
xctx->inst[k].flags |=4;
|
||||
hilight_nets=1;
|
||||
}
|
||||
}
|
||||
|
|
@ -1271,21 +1271,21 @@ int sym_vs_sch_pins()
|
|||
my_free(848, &pin_dir);
|
||||
} /* for(i=0;i<n_syms;i++) */
|
||||
|
||||
while(xctx.symbols > n_syms) remove_symbol(xctx.symbols - 1);
|
||||
while(xctx->symbols > n_syms) remove_symbol(xctx->symbols - 1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void delete_inst_node(int i)
|
||||
{
|
||||
int j, rects;
|
||||
if(!xctx.inst[i].node) return;
|
||||
rects = (xctx.inst[i].ptr+ xctx.sym)->rects[PINLAYER] +
|
||||
(xctx.inst[i].ptr+ xctx.sym)->rects[GENERICLAYER];
|
||||
if(!xctx->inst[i].node) return;
|
||||
rects = (xctx->inst[i].ptr+ xctx->sym)->rects[PINLAYER] +
|
||||
(xctx->inst[i].ptr+ xctx->sym)->rects[GENERICLAYER];
|
||||
if( rects > 0 )
|
||||
{
|
||||
for(j=0;j< rects ;j++)
|
||||
my_free(849, &xctx.inst[i].node[j]);
|
||||
my_free(850, &xctx.inst[i].node );
|
||||
my_free(849, &xctx->inst[i].node[j]);
|
||||
my_free(850, &xctx->inst[i].node );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1294,13 +1294,13 @@ void delete_netlist_structs(void)
|
|||
int i;
|
||||
/* erase node data structures */
|
||||
dbg(1, "delete_netlist_structs(): begin erasing\n");
|
||||
for(i=0;i<xctx.instances;i++)
|
||||
for(i=0;i<xctx->instances;i++)
|
||||
{
|
||||
delete_inst_node(i);
|
||||
}
|
||||
for(i=0;i<xctx.wires;i++)
|
||||
for(i=0;i<xctx->wires;i++)
|
||||
{
|
||||
my_free(851, &xctx.wire[i].node);
|
||||
my_free(851, &xctx->wire[i].node);
|
||||
}
|
||||
/* erase inst and wire topological hash tables */
|
||||
del_inst_pin_table();
|
||||
|
|
|
|||
130
src/paste.c
130
src/paste.c
|
|
@ -31,39 +31,39 @@ void merge_text(FILE *fd)
|
|||
int i;
|
||||
const char *str;
|
||||
check_text_storage();
|
||||
i=xctx.texts;
|
||||
xctx.text[i].txt_ptr=NULL;
|
||||
load_ascii_string(&xctx.text[i].txt_ptr,fd);
|
||||
i=xctx->texts;
|
||||
xctx->text[i].txt_ptr=NULL;
|
||||
load_ascii_string(&xctx->text[i].txt_ptr,fd);
|
||||
fscanf(fd, "%lf %lf %d %d %lf %lf ",
|
||||
&xctx.text[i].x0, &xctx.text[i].y0, &xctx.text[i].rot,
|
||||
&xctx.text[i].flip, &xctx.text[i].xscale,
|
||||
&xctx.text[i].yscale);
|
||||
xctx.text[i].prop_ptr=NULL;
|
||||
xctx.text[i].font=NULL;
|
||||
xctx.text[i].sel=0;
|
||||
load_ascii_string(&xctx.text[i].prop_ptr,fd);
|
||||
my_strdup(302, &xctx.text[i].font, get_tok_value(xctx.text[i].prop_ptr, "font", 0));
|
||||
&xctx->text[i].x0, &xctx->text[i].y0, &xctx->text[i].rot,
|
||||
&xctx->text[i].flip, &xctx->text[i].xscale,
|
||||
&xctx->text[i].yscale);
|
||||
xctx->text[i].prop_ptr=NULL;
|
||||
xctx->text[i].font=NULL;
|
||||
xctx->text[i].sel=0;
|
||||
load_ascii_string(&xctx->text[i].prop_ptr,fd);
|
||||
my_strdup(302, &xctx->text[i].font, get_tok_value(xctx->text[i].prop_ptr, "font", 0));
|
||||
|
||||
|
||||
str = get_tok_value(xctx.text[i].prop_ptr, "hcenter", 0);
|
||||
xctx.text[i].hcenter = strcmp(str, "true") ? 0 : 1;
|
||||
str = get_tok_value(xctx.text[i].prop_ptr, "vcenter", 0);
|
||||
xctx.text[i].vcenter = strcmp(str, "true") ? 0 : 1;
|
||||
str = get_tok_value(xctx->text[i].prop_ptr, "hcenter", 0);
|
||||
xctx->text[i].hcenter = strcmp(str, "true") ? 0 : 1;
|
||||
str = get_tok_value(xctx->text[i].prop_ptr, "vcenter", 0);
|
||||
xctx->text[i].vcenter = strcmp(str, "true") ? 0 : 1;
|
||||
|
||||
str = get_tok_value(xctx.text[i].prop_ptr, "layer", 0);
|
||||
if(str[0]) xctx.text[i].layer = atoi(str);
|
||||
else xctx.text[i].layer = -1;
|
||||
str = get_tok_value(xctx->text[i].prop_ptr, "layer", 0);
|
||||
if(str[0]) xctx->text[i].layer = atoi(str);
|
||||
else xctx->text[i].layer = -1;
|
||||
|
||||
xctx.text[i].flags = 0;
|
||||
str = get_tok_value(xctx.text[i].prop_ptr, "slant", 0);
|
||||
xctx.text[i].flags |= strcmp(str, "oblique") ? 0 : TEXT_OBLIQUE;
|
||||
xctx.text[i].flags |= strcmp(str, "italic") ? 0 : TEXT_ITALIC;
|
||||
str = get_tok_value(xctx.text[i].prop_ptr, "weight", 0);
|
||||
xctx.text[i].flags |= strcmp(str, "bold") ? 0 : TEXT_BOLD;
|
||||
xctx->text[i].flags = 0;
|
||||
str = get_tok_value(xctx->text[i].prop_ptr, "slant", 0);
|
||||
xctx->text[i].flags |= strcmp(str, "oblique") ? 0 : TEXT_OBLIQUE;
|
||||
xctx->text[i].flags |= strcmp(str, "italic") ? 0 : TEXT_ITALIC;
|
||||
str = get_tok_value(xctx->text[i].prop_ptr, "weight", 0);
|
||||
xctx->text[i].flags |= strcmp(str, "bold") ? 0 : TEXT_BOLD;
|
||||
|
||||
select_text(i,SELECTED, 1);
|
||||
set_modify(1);
|
||||
xctx.texts++;
|
||||
xctx->texts++;
|
||||
}
|
||||
|
||||
void merge_wire(FILE *fd)
|
||||
|
|
@ -71,7 +71,7 @@ void merge_wire(FILE *fd)
|
|||
int i;
|
||||
double x1,y1,x2,y2;
|
||||
char *ptr=NULL;
|
||||
i=xctx.wires;
|
||||
i=xctx->wires;
|
||||
fscanf(fd, "%lf %lf %lf %lf",&x1, &y1, &x2, &y2 );
|
||||
load_ascii_string( &ptr, fd);
|
||||
storeobject(-1, x1,y1,x2,y2,WIRE,0,SELECTED,ptr);
|
||||
|
|
@ -90,8 +90,8 @@ void merge_box(FILE *fd)
|
|||
c=cadlayers-1;
|
||||
}
|
||||
check_box_storage(c);
|
||||
i=xctx.rects[c];
|
||||
ptr=xctx.rect[c];
|
||||
i=xctx->rects[c];
|
||||
ptr=xctx->rect[c];
|
||||
fscanf(fd, "%lf %lf %lf %lf ",&ptr[i].x1, &ptr[i].y1,
|
||||
&ptr[i].x2, &ptr[i].y2);
|
||||
ptr[i].prop_ptr=NULL;
|
||||
|
|
@ -99,7 +99,7 @@ void merge_box(FILE *fd)
|
|||
ptr[i].sel=0;
|
||||
load_ascii_string( &ptr[i].prop_ptr, fd);
|
||||
select_box(c,i, SELECTED, 1);
|
||||
xctx.rects[c]++;
|
||||
xctx->rects[c]++;
|
||||
set_modify(1);
|
||||
}
|
||||
|
||||
|
|
@ -114,8 +114,8 @@ void merge_arc(FILE *fd)
|
|||
c=cadlayers-1;
|
||||
}
|
||||
check_arc_storage(c);
|
||||
i=xctx.arcs[c];
|
||||
ptr=xctx.arc[c];
|
||||
i=xctx->arcs[c];
|
||||
ptr=xctx->arc[c];
|
||||
fscanf(fd, "%lf %lf %lf %lf %lf ",&ptr[i].x, &ptr[i].y,
|
||||
&ptr[i].r, &ptr[i].a, &ptr[i].b);
|
||||
ptr[i].prop_ptr=NULL;
|
||||
|
|
@ -126,7 +126,7 @@ void merge_arc(FILE *fd)
|
|||
else
|
||||
ptr[i].fill =0;
|
||||
select_arc(c,i, SELECTED, 1);
|
||||
xctx.arcs[c]++;
|
||||
xctx->arcs[c]++;
|
||||
set_modify(1);
|
||||
}
|
||||
|
||||
|
|
@ -142,8 +142,8 @@ void merge_polygon(FILE *fd)
|
|||
c=cadlayers-1;
|
||||
}
|
||||
check_polygon_storage(c);
|
||||
i=xctx.polygons[c];
|
||||
ptr=xctx.poly[c];
|
||||
i=xctx->polygons[c];
|
||||
ptr=xctx->poly[c];
|
||||
ptr[i].x=NULL;
|
||||
ptr[i].y=NULL;
|
||||
ptr[i].selected_point=NULL;
|
||||
|
|
@ -162,7 +162,7 @@ void merge_polygon(FILE *fd)
|
|||
else
|
||||
ptr[i].fill =0;
|
||||
select_polygon(c,i, SELECTED, 1);
|
||||
xctx.polygons[c]++;
|
||||
xctx->polygons[c]++;
|
||||
set_modify(1);
|
||||
}
|
||||
|
||||
|
|
@ -177,8 +177,8 @@ void merge_line(FILE *fd)
|
|||
c=cadlayers-1;
|
||||
}
|
||||
check_line_storage(c);
|
||||
i=xctx.lines[c];
|
||||
ptr=xctx.line[c];
|
||||
i=xctx->lines[c];
|
||||
ptr=xctx->line[c];
|
||||
fscanf(fd, "%lf %lf %lf %lf ",&ptr[i].x1, &ptr[i].y1,
|
||||
&ptr[i].x2, &ptr[i].y2);
|
||||
ORDER(ptr[i].x1, ptr[i].y1, ptr[i].x2, ptr[i].y2);
|
||||
|
|
@ -187,7 +187,7 @@ void merge_line(FILE *fd)
|
|||
ptr[i].sel=0;
|
||||
load_ascii_string( &ptr[i].prop_ptr, fd);
|
||||
select_line(c,i, SELECTED, 1);
|
||||
xctx.lines[c]++;
|
||||
xctx->lines[c]++;
|
||||
set_modify(1);
|
||||
}
|
||||
|
||||
|
|
@ -201,9 +201,9 @@ void merge_inst(int k,FILE *fd)
|
|||
char *prop_ptr=NULL;
|
||||
|
||||
xInstance *ptr;
|
||||
i=xctx.instances;
|
||||
i=xctx->instances;
|
||||
check_inst_storage();
|
||||
ptr=xctx.inst;
|
||||
ptr=xctx->inst;
|
||||
ptr[i].name=NULL;
|
||||
load_ascii_string(&ptr[i].name,fd);
|
||||
if(fscanf(fd, "%lf %lf %d %d",&ptr[i].x0, &ptr[i].y0,&ptr[i].rot, &ptr[i].flip) < 4) {
|
||||
|
|
@ -222,9 +222,9 @@ void merge_inst(int k,FILE *fd)
|
|||
new_prop_string(i, prop_ptr, k, dis_uniq_names);
|
||||
/* the final tmp argument is zero for the 1st call and used in */
|
||||
/* new_prop_string() for cleaning some internal caches. */
|
||||
my_strdup2(306, &xctx.inst[i].instname, get_tok_value(xctx.inst[i].prop_ptr, "name", 0));
|
||||
my_strdup2(306, &xctx->inst[i].instname, get_tok_value(xctx->inst[i].prop_ptr, "name", 0));
|
||||
my_free(871, &prop_ptr);
|
||||
xctx.instances++;
|
||||
xctx->instances++;
|
||||
set_modify(1);
|
||||
}
|
||||
|
||||
|
|
@ -238,42 +238,42 @@ void match_merged_inst(int old)
|
|||
int cond;
|
||||
char *type;
|
||||
missing = 0;
|
||||
for(i=old;i<xctx.instances;i++)
|
||||
for(i=old;i<xctx->instances;i++)
|
||||
{
|
||||
symbol = match_symbol(xctx.inst[i].name);
|
||||
symbol = match_symbol(xctx->inst[i].name);
|
||||
if(symbol == -1)
|
||||
{
|
||||
dbg(1, "match_merged_inst(): missing symbol, skipping...\n");
|
||||
my_free(872, &xctx.inst[i].prop_ptr); /* 06052001 remove properties */
|
||||
my_free(873, &xctx.inst[i].name); /* 06052001 remove symname */
|
||||
my_free(874, &xctx.inst[i].instname);
|
||||
my_free(872, &xctx->inst[i].prop_ptr); /* 06052001 remove properties */
|
||||
my_free(873, &xctx->inst[i].name); /* 06052001 remove symname */
|
||||
my_free(874, &xctx->inst[i].instname);
|
||||
missing++;
|
||||
continue;
|
||||
}
|
||||
xctx.inst[i].ptr = symbol;
|
||||
xctx->inst[i].ptr = symbol;
|
||||
if(missing)
|
||||
{
|
||||
|
||||
xctx.inst[i-missing] = xctx.inst[i];
|
||||
xctx.inst[i].prop_ptr=NULL;
|
||||
xctx->inst[i-missing] = xctx->inst[i];
|
||||
xctx->inst[i].prop_ptr=NULL;
|
||||
/* delete_inst_node(i); */ /* probably not needed */
|
||||
xctx.inst[i].ptr=-1; /*04112003 was 0 */
|
||||
xctx.inst[i].flags=0;
|
||||
xctx.inst[i].name=NULL;
|
||||
xctx.inst[i].instname=NULL;
|
||||
xctx->inst[i].ptr=-1; /*04112003 was 0 */
|
||||
xctx->inst[i].flags=0;
|
||||
xctx->inst[i].name=NULL;
|
||||
xctx->inst[i].instname=NULL;
|
||||
}
|
||||
}
|
||||
xctx.instances -= missing;
|
||||
for(i=old;i<xctx.instances;i++)
|
||||
xctx->instances -= missing;
|
||||
for(i=old;i<xctx->instances;i++)
|
||||
{
|
||||
if(xctx.inst[i].ptr<0) continue;
|
||||
if(xctx->inst[i].ptr<0) continue;
|
||||
select_element(i,SELECTED,1, 0);
|
||||
symbol_bbox(i, &xctx.inst[i].x1, &xctx.inst[i].y1,
|
||||
&xctx.inst[i].x2, &xctx.inst[i].y2);
|
||||
type=xctx.sym[xctx.inst[i].ptr].type;
|
||||
symbol_bbox(i, &xctx->inst[i].x1, &xctx->inst[i].y1,
|
||||
&xctx->inst[i].x2, &xctx->inst[i].y2);
|
||||
type=xctx->sym[xctx->inst[i].ptr].type;
|
||||
cond= !type || !IS_LABEL_SH_OR_PIN(type);
|
||||
if(cond) xctx.inst[i].flags|=2;
|
||||
else xctx.inst[i].flags &=~2;
|
||||
if(cond) xctx->inst[i].flags|=2;
|
||||
else xctx->inst[i].flags &=~2;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -306,7 +306,7 @@ void merge_file(int selection_load, const char ext[])
|
|||
else {
|
||||
my_strncpy(name, ext, S(name));
|
||||
}
|
||||
dbg(1, "merge_file(): sch=%d name=%s\n",xctx.currsch,name);
|
||||
dbg(1, "merge_file(): sch=%d name=%s\n",xctx->currsch,name);
|
||||
}
|
||||
else if(selection_load==1)
|
||||
{
|
||||
|
|
@ -324,7 +324,7 @@ void merge_file(int selection_load, const char ext[])
|
|||
got_mouse = 0;
|
||||
push_undo();
|
||||
unselect_all();
|
||||
old=xctx.instances;
|
||||
old=xctx->instances;
|
||||
while(!endfile)
|
||||
{
|
||||
if(fscanf(fd," %c",tag)==EOF) break;
|
||||
|
|
@ -394,7 +394,7 @@ void merge_file(int selection_load, const char ext[])
|
|||
fclose(fd);
|
||||
ui_state |= STARTMERGE;
|
||||
dbg(1, "merge_file(): loaded file:wire=%d inst=%d ui_state=%ld\n",
|
||||
xctx.wires , xctx.instances, ui_state);
|
||||
xctx->wires , xctx->instances, ui_state);
|
||||
move_objects(BEGIN,0,0,0);
|
||||
mousex_snap = mx_double_save;
|
||||
mousey_snap = my_double_save;
|
||||
|
|
|
|||
128
src/psprint.c
128
src/psprint.c
|
|
@ -21,8 +21,8 @@
|
|||
*/
|
||||
|
||||
#include "xschem.h"
|
||||
#define X_TO_PS(x) ( (x+xctx.xorigin)* xctx.mooz )
|
||||
#define Y_TO_PS(y) ( (y+xctx.yorigin)* xctx.mooz )
|
||||
#define X_TO_PS(x) ( (x+xctx->xorigin)* xctx->mooz )
|
||||
#define Y_TO_PS(y) ( (y+xctx->yorigin)* xctx->mooz )
|
||||
|
||||
static FILE *fd;
|
||||
|
||||
|
|
@ -102,7 +102,7 @@ static void ps_drawpolygon(int c, int what, double *x, double *y, int points, in
|
|||
return;
|
||||
}
|
||||
|
||||
psdash = dash / xctx.zoom;
|
||||
psdash = dash / xctx->zoom;
|
||||
if(dash) {
|
||||
fprintf(fd, "[%g %g] 0 setdash\n", psdash, psdash);
|
||||
}
|
||||
|
|
@ -138,7 +138,7 @@ static void ps_filledrect(int gc, double rectx1,double recty1,double rectx2,doub
|
|||
y2=Y_TO_PS(recty2);
|
||||
if( rectclip(areax1,areay1,areax2,areay2,&x1,&y1,&x2,&y2) )
|
||||
{
|
||||
psdash = dash / xctx.zoom;
|
||||
psdash = dash / xctx->zoom;
|
||||
if(dash) {
|
||||
fprintf(fd, "[%g %g] 0 setdash\n", psdash, psdash);
|
||||
}
|
||||
|
|
@ -157,7 +157,7 @@ static void ps_drawarc(int gc, int fillarc, double x,double y,double r,double a,
|
|||
|
||||
xx=X_TO_PS(x);
|
||||
yy=Y_TO_PS(y);
|
||||
rr=r*xctx.mooz;
|
||||
rr=r*xctx->mooz;
|
||||
arc_bbox(x, y, r, a, b, &x1,&y1,&x2,&y2);
|
||||
x1=X_TO_PS(x1);
|
||||
y1=Y_TO_PS(y1);
|
||||
|
|
@ -166,7 +166,7 @@ static void ps_drawarc(int gc, int fillarc, double x,double y,double r,double a,
|
|||
|
||||
if( rectclip(areax1,areay1,areax2,areay2,&x1,&y1,&x2,&y2) )
|
||||
{
|
||||
psdash = dash / xctx.zoom;
|
||||
psdash = dash / xctx->zoom;
|
||||
if(dash) {
|
||||
fprintf(fd, "[%g %g] 0 setdash\n", psdash, psdash);
|
||||
}
|
||||
|
|
@ -189,7 +189,7 @@ static void ps_drawline(int gc, double linex1,double liney1,double linex2,double
|
|||
y2=Y_TO_PS(liney2);
|
||||
if( clip(&x1,&y1,&x2,&y2) )
|
||||
{
|
||||
psdash = dash / xctx.zoom;
|
||||
psdash = dash / xctx->zoom;
|
||||
if(dash) {
|
||||
fprintf(fd, "[%g %g] 0 setdash\n", psdash, psdash);
|
||||
}
|
||||
|
|
@ -257,9 +257,9 @@ static void ps_drawgrid()
|
|||
double x,y;
|
||||
double delta,tmp;
|
||||
if(!draw_grid) return;
|
||||
delta=cadgrid* xctx.mooz;
|
||||
delta=cadgrid* xctx->mooz;
|
||||
while(delta<CADGRIDTHRESHOLD) delta*=CADGRIDMULTIPLY; /* <-- to be improved,but works */
|
||||
x = xctx.xorigin* xctx.mooz;y = xctx.yorigin* xctx.mooz;
|
||||
x = xctx->xorigin* xctx->mooz;y = xctx->yorigin* xctx->mooz;
|
||||
set_ps_colors(GRIDLAYER);
|
||||
if(y>areay1 && y<areay2)
|
||||
{
|
||||
|
|
@ -270,8 +270,8 @@ static void ps_drawgrid()
|
|||
ps_xdrawline(GRIDLAYER,(int)x,areay1+1, (int)x, areay2-1);
|
||||
}
|
||||
set_ps_colors(GRIDLAYER);
|
||||
tmp = floor((areay1+1)/delta)*delta-fmod(-xctx.yorigin* xctx.mooz,delta);
|
||||
for(x=floor((areax1+1)/delta)*delta-fmod(-xctx.xorigin* xctx.mooz,delta);x<areax2;x+=delta)
|
||||
tmp = floor((areay1+1)/delta)*delta-fmod(-xctx->yorigin* xctx->mooz,delta);
|
||||
for(x=floor((areax1+1)/delta)*delta-fmod(-xctx->xorigin* xctx->mooz,delta);x<areax2;x+=delta)
|
||||
{
|
||||
for(y=tmp;y<areay2;y+=delta)
|
||||
{
|
||||
|
|
@ -295,47 +295,47 @@ static void ps_draw_symbol(int n,int layer,int tmp_flip, int rot,
|
|||
xArc arc;
|
||||
xPoly polygon;
|
||||
|
||||
if(xctx.inst[n].ptr == -1) return;
|
||||
if(xctx->inst[n].ptr == -1) return;
|
||||
if( (layer != PINLAYER && !enable_layer[layer]) ) return;
|
||||
if(layer==0)
|
||||
{
|
||||
x1=X_TO_PS(xctx.inst[n].x1);
|
||||
x2=X_TO_PS(xctx.inst[n].x2);
|
||||
y1=Y_TO_PS(xctx.inst[n].y1);
|
||||
y2=Y_TO_PS(xctx.inst[n].y2);
|
||||
x1=X_TO_PS(xctx->inst[n].x1);
|
||||
x2=X_TO_PS(xctx->inst[n].x2);
|
||||
y1=Y_TO_PS(xctx->inst[n].y1);
|
||||
y2=Y_TO_PS(xctx->inst[n].y2);
|
||||
if(OUTSIDE(x1,y1,x2,y2,areax1,areay1,areax2,areay2))
|
||||
{
|
||||
xctx.inst[n].flags|=1;
|
||||
xctx->inst[n].flags|=1;
|
||||
return;
|
||||
}
|
||||
else xctx.inst[n].flags&=~1;
|
||||
else xctx->inst[n].flags&=~1;
|
||||
|
||||
/* following code handles different text color for labels/pins 06112002 */
|
||||
|
||||
}
|
||||
else if(xctx.inst[n].flags&1)
|
||||
else if(xctx->inst[n].flags&1)
|
||||
{
|
||||
dbg(1, "draw_symbol(): skippinginst %d\n", n);
|
||||
return;
|
||||
}
|
||||
|
||||
flip = xctx.inst[n].flip;
|
||||
flip = xctx->inst[n].flip;
|
||||
if(tmp_flip) flip = !flip;
|
||||
rot = (xctx.inst[n].rot + rot ) & 0x3;
|
||||
rot = (xctx->inst[n].rot + rot ) & 0x3;
|
||||
|
||||
x0=xctx.inst[n].x0 + xoffset;
|
||||
y0=xctx.inst[n].y0 + yoffset;
|
||||
for(j=0;j< (xctx.inst[n].ptr+ xctx.sym)->lines[layer];j++)
|
||||
x0=xctx->inst[n].x0 + xoffset;
|
||||
y0=xctx->inst[n].y0 + yoffset;
|
||||
for(j=0;j< (xctx->inst[n].ptr+ xctx->sym)->lines[layer];j++)
|
||||
{
|
||||
line = ((xctx.inst[n].ptr+ xctx.sym)->line[layer])[j];
|
||||
line = ((xctx->inst[n].ptr+ xctx->sym)->line[layer])[j];
|
||||
ROTATION(0.0,0.0,line.x1,line.y1,x1,y1);
|
||||
ROTATION(0.0,0.0,line.x2,line.y2,x2,y2);
|
||||
ORDER(x1,y1,x2,y2);
|
||||
ps_drawline(layer, x0+x1, y0+y1, x0+x2, y0+y2, line.dash);
|
||||
}
|
||||
for(j=0;j< (xctx.inst[n].ptr+ xctx.sym)->polygons[layer];j++)
|
||||
for(j=0;j< (xctx->inst[n].ptr+ xctx->sym)->polygons[layer];j++)
|
||||
{
|
||||
polygon = ((xctx.inst[n].ptr+ xctx.sym)->poly[layer])[j];
|
||||
polygon = ((xctx->inst[n].ptr+ xctx->sym)->poly[layer])[j];
|
||||
{ /* scope block so we declare some auxiliary arrays for coord transforms. 20171115 */
|
||||
int k;
|
||||
double *x = my_malloc(309, sizeof(double) * polygon.points);
|
||||
|
|
@ -351,10 +351,10 @@ static void ps_draw_symbol(int n,int layer,int tmp_flip, int rot,
|
|||
}
|
||||
|
||||
}
|
||||
for(j=0;j< (xctx.inst[n].ptr+ xctx.sym)->arcs[layer];j++)
|
||||
for(j=0;j< (xctx->inst[n].ptr+ xctx->sym)->arcs[layer];j++)
|
||||
{
|
||||
double angle;
|
||||
arc = ((xctx.inst[n].ptr+ xctx.sym)->arc[layer])[j];
|
||||
arc = ((xctx->inst[n].ptr+ xctx->sym)->arc[layer])[j];
|
||||
if(flip) {
|
||||
angle = 270.*rot+180.-arc.b-arc.a;
|
||||
} else {
|
||||
|
|
@ -365,30 +365,30 @@ static void ps_draw_symbol(int n,int layer,int tmp_flip, int rot,
|
|||
ROTATION(0.0,0.0,arc.x,arc.y,x1,y1);
|
||||
ps_drawarc(layer, arc.fill, x0+x1, y0+y1, arc.r, angle, arc.b, arc.dash);
|
||||
}
|
||||
if( (layer != PINLAYER || enable_layer[layer]) ) for(j=0;j< (xctx.inst[n].ptr+ xctx.sym)->rects[layer];j++)
|
||||
if( (layer != PINLAYER || enable_layer[layer]) ) for(j=0;j< (xctx->inst[n].ptr+ xctx->sym)->rects[layer];j++)
|
||||
{
|
||||
box = ((xctx.inst[n].ptr+ xctx.sym)->rect[layer])[j];
|
||||
box = ((xctx->inst[n].ptr+ xctx->sym)->rect[layer])[j];
|
||||
ROTATION(0.0,0.0,box.x1,box.y1,x1,y1);
|
||||
ROTATION(0.0,0.0,box.x2,box.y2,x2,y2);
|
||||
RECTORDER(x1,y1,x2,y2);
|
||||
ps_filledrect(layer, x0+x1, y0+y1, x0+x2, y0+y2, box.dash);
|
||||
}
|
||||
if( (layer==TEXTWIRELAYER && !(xctx.inst[n].flags&2) ) ||
|
||||
(sym_txt && (layer==TEXTLAYER) && (xctx.inst[n].flags&2) ) )
|
||||
if( (layer==TEXTWIRELAYER && !(xctx->inst[n].flags&2) ) ||
|
||||
(sym_txt && (layer==TEXTLAYER) && (xctx->inst[n].flags&2) ) )
|
||||
{
|
||||
const char *txtptr;
|
||||
for(j=0;j< (xctx.inst[n].ptr+ xctx.sym)->texts;j++)
|
||||
for(j=0;j< (xctx->inst[n].ptr+ xctx->sym)->texts;j++)
|
||||
{
|
||||
text = (xctx.inst[n].ptr+ xctx.sym)->text[j];
|
||||
/* if(text.xscale*FONTWIDTH* xctx.mooz<1) continue; */
|
||||
text = (xctx->inst[n].ptr+ xctx->sym)->text[j];
|
||||
/* if(text.xscale*FONTWIDTH* xctx->mooz<1) continue; */
|
||||
txtptr= translate(n, text.txt_ptr);
|
||||
ROTATION(0.0,0.0,text.x0,text.y0,x1,y1);
|
||||
textlayer = layer;
|
||||
if( !(layer == PINLAYER && (xctx.inst[n].flags & 4))) {
|
||||
textlayer = (xctx.inst[n].ptr+ xctx.sym)->text[j].layer;
|
||||
if( !(layer == PINLAYER && (xctx->inst[n].flags & 4))) {
|
||||
textlayer = (xctx->inst[n].ptr+ xctx->sym)->text[j].layer;
|
||||
if(textlayer < 0 || textlayer >= cadlayers) textlayer = layer;
|
||||
}
|
||||
if((layer == PINLAYER && xctx.inst[n].flags & 4) || enable_layer[textlayer]) {
|
||||
if((layer == PINLAYER && xctx->inst[n].flags & 4) || enable_layer[textlayer]) {
|
||||
ps_draw_string(textlayer, txtptr,
|
||||
(text.rot + ( (flip && (text.rot & 1) ) ? rot+2 : rot) ) & 0x3,
|
||||
flip^text.flip, text.hcenter, text.vcenter,
|
||||
|
|
@ -513,47 +513,47 @@ void ps_draw(void)
|
|||
restore_lw();
|
||||
ps_drawgrid();
|
||||
|
||||
for(i=0;i<xctx.texts;i++)
|
||||
for(i=0;i<xctx->texts;i++)
|
||||
{
|
||||
textlayer = xctx.text[i].layer;
|
||||
textlayer = xctx->text[i].layer;
|
||||
if(textlayer < 0 || textlayer >= cadlayers) textlayer = TEXTLAYER;
|
||||
ps_draw_string(textlayer, xctx.text[i].txt_ptr,
|
||||
xctx.text[i].rot, xctx.text[i].flip, xctx.text[i].hcenter, xctx.text[i].vcenter,
|
||||
xctx.text[i].x0,xctx.text[i].y0,
|
||||
xctx.text[i].xscale, xctx.text[i].yscale);
|
||||
ps_draw_string(textlayer, xctx->text[i].txt_ptr,
|
||||
xctx->text[i].rot, xctx->text[i].flip, xctx->text[i].hcenter, xctx->text[i].vcenter,
|
||||
xctx->text[i].x0,xctx->text[i].y0,
|
||||
xctx->text[i].xscale, xctx->text[i].yscale);
|
||||
}
|
||||
restore_lw();
|
||||
|
||||
for(c=0;c<cadlayers;c++)
|
||||
{
|
||||
set_ps_colors(c);
|
||||
for(i=0;i<xctx.lines[c];i++)
|
||||
ps_drawline(c, xctx.line[c][i].x1, xctx.line[c][i].y1,
|
||||
xctx.line[c][i].x2, xctx.line[c][i].y2, xctx.line[c][i].dash);
|
||||
for(i=0;i<xctx.rects[c];i++)
|
||||
for(i=0;i<xctx->lines[c];i++)
|
||||
ps_drawline(c, xctx->line[c][i].x1, xctx->line[c][i].y1,
|
||||
xctx->line[c][i].x2, xctx->line[c][i].y2, xctx->line[c][i].dash);
|
||||
for(i=0;i<xctx->rects[c];i++)
|
||||
{
|
||||
ps_filledrect(c, xctx.rect[c][i].x1, xctx.rect[c][i].y1,
|
||||
xctx.rect[c][i].x2, xctx.rect[c][i].y2, xctx.rect[c][i].dash);
|
||||
ps_filledrect(c, xctx->rect[c][i].x1, xctx->rect[c][i].y1,
|
||||
xctx->rect[c][i].x2, xctx->rect[c][i].y2, xctx->rect[c][i].dash);
|
||||
}
|
||||
for(i=0;i<xctx.arcs[c];i++)
|
||||
for(i=0;i<xctx->arcs[c];i++)
|
||||
{
|
||||
ps_drawarc(c, xctx.arc[c][i].fill, xctx.arc[c][i].x, xctx.arc[c][i].y,
|
||||
xctx.arc[c][i].r, xctx.arc[c][i].a, xctx.arc[c][i].b, xctx.arc[c][i].dash);
|
||||
ps_drawarc(c, xctx->arc[c][i].fill, xctx->arc[c][i].x, xctx->arc[c][i].y,
|
||||
xctx->arc[c][i].r, xctx->arc[c][i].a, xctx->arc[c][i].b, xctx->arc[c][i].dash);
|
||||
}
|
||||
for(i=0;i<xctx.polygons[c];i++) {
|
||||
ps_drawpolygon(c, NOW, xctx.poly[c][i].x, xctx.poly[c][i].y, xctx.poly[c][i].points,
|
||||
xctx.poly[c][i].fill, xctx.poly[c][i].dash);
|
||||
for(i=0;i<xctx->polygons[c];i++) {
|
||||
ps_drawpolygon(c, NOW, xctx->poly[c][i].x, xctx->poly[c][i].y, xctx->poly[c][i].points,
|
||||
xctx->poly[c][i].fill, xctx->poly[c][i].dash);
|
||||
}
|
||||
|
||||
|
||||
for(i=0;i<xctx.instances;i++)
|
||||
for(i=0;i<xctx->instances;i++)
|
||||
ps_draw_symbol(i,c,0,0,0.0,0.0);
|
||||
|
||||
}
|
||||
set_ps_colors(WIRELAYER);
|
||||
for(i=0;i<xctx.wires;i++)
|
||||
for(i=0;i<xctx->wires;i++)
|
||||
{
|
||||
ps_drawline(WIRELAYER, xctx.wire[i].x1,xctx.wire[i].y1,xctx.wire[i].x2,xctx.wire[i].y2, 0);
|
||||
ps_drawline(WIRELAYER, xctx->wire[i].x1,xctx->wire[i].y1,xctx->wire[i].x2,xctx->wire[i].y2, 0);
|
||||
}
|
||||
|
||||
{
|
||||
|
|
@ -568,11 +568,11 @@ void ps_draw(void)
|
|||
y2 = Y_TO_XSCHEM(areay2);
|
||||
for(init_wire_iterator(x1, y1, x2, y2); ( wireptr = wire_iterator_next() ) ;) {
|
||||
i = wireptr->n;
|
||||
if( xctx.wire[i].end1 >1 ) { /* 20150331 draw_dots */
|
||||
ps_drawarc(WIRELAYER, 1, xctx.wire[i].x1, xctx.wire[i].y1, cadhalfdotsize, 0, 360, 0);
|
||||
if( xctx->wire[i].end1 >1 ) { /* 20150331 draw_dots */
|
||||
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 */
|
||||
ps_drawarc(WIRELAYER, 1, xctx.wire[i].x2, xctx.wire[i].y2, cadhalfdotsize, 0, 360, 0);
|
||||
if( xctx->wire[i].end2 >1 ) { /* 20150331 draw_dots */
|
||||
ps_drawarc(WIRELAYER, 1, xctx->wire[i].x2, xctx->wire[i].y2, cadhalfdotsize, 0, 360, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
568
src/save.c
568
src/save.c
File diff suppressed because it is too large
Load Diff
247
src/scheduler.c
247
src/scheduler.c
|
|
@ -46,8 +46,8 @@ void statusmsg(char str[],int n)
|
|||
int get_instance(const char *s)
|
||||
{
|
||||
int i, found=0;
|
||||
for(i=0;i<xctx.instances;i++) {
|
||||
if(!strcmp(xctx.inst[i].instname, s)) {
|
||||
for(i=0;i<xctx->instances;i++) {
|
||||
if(!strcmp(xctx->inst[i].instname, s)) {
|
||||
found=1;
|
||||
break;
|
||||
}
|
||||
|
|
@ -57,7 +57,7 @@ int get_instance(const char *s)
|
|||
if(!isonlydigit(s)) return -1;
|
||||
i=atol(s);
|
||||
}
|
||||
if(i<0 || i>xctx.instances) {
|
||||
if(i<0 || i>xctx->instances) {
|
||||
Tcl_AppendResult(interp, "Index out of range", NULL);
|
||||
return -1;
|
||||
}
|
||||
|
|
@ -213,7 +213,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
{
|
||||
if(has_x) tcleval("tk_messageBox -type okcancel -message {do you want to make symbol view ?}");
|
||||
if(!has_x || strcmp(tclresult(),"ok")==0) {
|
||||
save_schematic(xctx.sch[xctx.currsch]);
|
||||
save_schematic(xctx->sch[xctx->currsch]);
|
||||
make_symbol();
|
||||
}
|
||||
Tcl_ResetResult(interp);
|
||||
|
|
@ -273,15 +273,15 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
else factor = 1.;
|
||||
if(factor == 0.) factor = 1.;
|
||||
RECTORDER(x1,y1,x2,y2);
|
||||
xctx.xorigin=-x1;xctx.yorigin=-y1;
|
||||
xctx.zoom=(x2-x1)/(areaw-4*lw);
|
||||
xctx->xorigin=-x1;xctx->yorigin=-y1;
|
||||
xctx->zoom=(x2-x1)/(areaw-4*lw);
|
||||
yy1=(y2-y1)/(areah-4*lw);
|
||||
if(yy1>xctx.zoom) xctx.zoom=yy1;
|
||||
xctx.mooz=1/xctx.zoom;
|
||||
xctx.xorigin=xctx.xorigin+areaw*xctx.zoom*(1-1/factor)/2;
|
||||
xctx.yorigin=xctx.yorigin+areah*xctx.zoom*(1-1/factor)/2;
|
||||
xctx.zoom*= factor;
|
||||
xctx.mooz=1/xctx.zoom;
|
||||
if(yy1>xctx->zoom) xctx->zoom=yy1;
|
||||
xctx->mooz=1/xctx->zoom;
|
||||
xctx->xorigin=xctx->xorigin+areaw*xctx->zoom*(1-1/factor)/2;
|
||||
xctx->yorigin=xctx->yorigin+areah*xctx->zoom*(1-1/factor)/2;
|
||||
xctx->zoom*= factor;
|
||||
xctx->mooz=1/xctx->zoom;
|
||||
change_linewidth(-1.);
|
||||
draw();
|
||||
}
|
||||
|
|
@ -294,11 +294,11 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
{
|
||||
int save, missing = 0;
|
||||
if(argc > 2) {
|
||||
save = xctx.symbols;
|
||||
save = xctx->symbols;
|
||||
match_symbol(argv[2]);
|
||||
if( xctx.symbols != save && !strcmp( xctx.sym[xctx.symbols - 1].type, "missing") ) {
|
||||
if( xctx->symbols != save && !strcmp( xctx->sym[xctx->symbols - 1].type, "missing") ) {
|
||||
missing = 1;
|
||||
remove_symbol( xctx.symbols - 1);
|
||||
remove_symbol( xctx->symbols - 1);
|
||||
}
|
||||
}
|
||||
Tcl_ResetResult(interp);
|
||||
|
|
@ -411,7 +411,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
struct stat buf;
|
||||
int i;
|
||||
|
||||
xctx.currsch = 0;
|
||||
xctx->currsch = 0;
|
||||
unselect_all();
|
||||
remove_symbols();
|
||||
clear_drawing();
|
||||
|
|
@ -423,8 +423,8 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
else my_snprintf(name, S(name), "%s-%d.sym", "untitled", i);
|
||||
if(stat(name, &buf)) break;
|
||||
}
|
||||
my_snprintf(xctx.sch[xctx.currsch], S(xctx.sch[xctx.currsch]), "%s/%s", pwd_dir, name);
|
||||
my_strncpy(xctx.current_name, name, S(xctx.current_name));
|
||||
my_snprintf(xctx->sch[xctx->currsch], S(xctx->sch[xctx->currsch]), "%s/%s", pwd_dir, name);
|
||||
my_strncpy(xctx->current_name, name, S(xctx->current_name));
|
||||
} else {
|
||||
netlist_type = CAD_SPICE_NETLIST;
|
||||
tclsetvar("netlist_type","spice");
|
||||
|
|
@ -433,8 +433,8 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
else my_snprintf(name, S(name), "%s-%d.sch", "untitled", i);
|
||||
if(stat(name, &buf)) break;
|
||||
}
|
||||
my_snprintf(xctx.sch[xctx.currsch], S(xctx.sch[xctx.currsch]), "%s/%s", pwd_dir, name);
|
||||
my_strncpy(xctx.current_name, name, S(xctx.current_name));
|
||||
my_snprintf(xctx->sch[xctx->currsch], S(xctx->sch[xctx->currsch]), "%s/%s", pwd_dir, name);
|
||||
my_strncpy(xctx->current_name, name, S(xctx->current_name));
|
||||
}
|
||||
draw();
|
||||
set_modify(0);
|
||||
|
|
@ -460,7 +460,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
{
|
||||
unselect_all();
|
||||
remove_symbols();
|
||||
load_schematic(1, xctx.sch[xctx.currsch], 1);
|
||||
load_schematic(1, xctx->sch[xctx->currsch], 1);
|
||||
if(argc >= 3 && !strcmp(argv[2], "zoom_full") ) {
|
||||
zoom_full(1, 0);
|
||||
} else {
|
||||
|
|
@ -516,8 +516,8 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
return TCL_ERROR;
|
||||
} else {
|
||||
bbox(BEGIN,0.0,0.0,0.0,0.0);
|
||||
symbol_bbox(inst, &xctx.inst[inst].x1, &xctx.inst[inst].y1, &xctx.inst[inst].x2, &xctx.inst[inst].y2);
|
||||
bbox(ADD, xctx.inst[inst].x1, xctx.inst[inst].y1, xctx.inst[inst].x2, xctx.inst[inst].y2);
|
||||
symbol_bbox(inst, &xctx->inst[inst].x1, &xctx->inst[inst].y1, &xctx->inst[inst].x2, &xctx->inst[inst].y2);
|
||||
bbox(ADD, xctx->inst[inst].x1, xctx->inst[inst].y1, xctx->inst[inst].x2, xctx->inst[inst].y2);
|
||||
push_undo();
|
||||
set_modify(1);
|
||||
if(!fast) {
|
||||
|
|
@ -527,15 +527,15 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
}
|
||||
hash_all_names(inst);
|
||||
if(argc >= 5) {
|
||||
new_prop_string(inst, subst_token(xctx.inst[inst].prop_ptr, argv[3], argv[4]),0, dis_uniq_names);
|
||||
new_prop_string(inst, subst_token(xctx->inst[inst].prop_ptr, argv[3], argv[4]),0, dis_uniq_names);
|
||||
|
||||
} else {/* assume argc == 4 */
|
||||
new_prop_string(inst, subst_token(xctx.inst[inst].prop_ptr, argv[3], NULL),0, dis_uniq_names);
|
||||
new_prop_string(inst, subst_token(xctx->inst[inst].prop_ptr, argv[3], NULL),0, dis_uniq_names);
|
||||
}
|
||||
my_strdup2(367, &xctx.inst[inst].instname, get_tok_value(xctx.inst[inst].prop_ptr, "name",0));
|
||||
my_strdup2(367, &xctx->inst[inst].instname, get_tok_value(xctx->inst[inst].prop_ptr, "name",0));
|
||||
/* new symbol bbox after prop changes (may change due to text length) */
|
||||
symbol_bbox(inst, &xctx.inst[inst].x1, &xctx.inst[inst].y1, &xctx.inst[inst].x2, &xctx.inst[inst].y2);
|
||||
bbox(ADD, xctx.inst[inst].x1, xctx.inst[inst].y1, xctx.inst[inst].x2, xctx.inst[inst].y2);
|
||||
symbol_bbox(inst, &xctx->inst[inst].x1, &xctx->inst[inst].y1, &xctx->inst[inst].x2, &xctx->inst[inst].y2);
|
||||
bbox(ADD, xctx->inst[inst].x1, xctx->inst[inst].y1, xctx->inst[inst].x2, xctx->inst[inst].y2);
|
||||
/* redraw symbol with new props */
|
||||
bbox(SET,0.0,0.0,0.0,0.0);
|
||||
draw();
|
||||
|
|
@ -578,37 +578,37 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
sym_number=match_symbol(symbol);
|
||||
if(sym_number>=0)
|
||||
{
|
||||
prefix=(get_tok_value( (xctx.sym+sym_number)->templ , "name",0))[0]; /* get new symbol prefix */
|
||||
prefix=(get_tok_value( (xctx->sym+sym_number)->templ , "name",0))[0]; /* get new symbol prefix */
|
||||
}
|
||||
else prefix = 'x';
|
||||
delete_inst_node(inst); /* 20180208 fix crashing bug: delete node info if changing symbol */
|
||||
/* if number of pins is different we must delete these data *before* */
|
||||
/* changing ysmbol, otherwise i might end up deleting non allocated data. */
|
||||
my_strdup(369, &xctx.inst[inst].name,symbol);
|
||||
xctx.inst[inst].ptr=sym_number;
|
||||
bbox(ADD, xctx.inst[inst].x1, xctx.inst[inst].y1, xctx.inst[inst].x2, xctx.inst[inst].y2);
|
||||
my_strdup(369, &xctx->inst[inst].name,symbol);
|
||||
xctx->inst[inst].ptr=sym_number;
|
||||
bbox(ADD, xctx->inst[inst].x1, xctx->inst[inst].y1, xctx->inst[inst].x2, xctx->inst[inst].y2);
|
||||
|
||||
my_strdup(370, &name, xctx.inst[inst].instname);
|
||||
my_strdup(370, &name, xctx->inst[inst].instname);
|
||||
if(name && name[0] )
|
||||
{
|
||||
/* 20110325 only modify prefix if prefix not NUL */
|
||||
if(prefix) name[0]=prefix; /* change prefix if changing symbol type; */
|
||||
|
||||
my_strdup(371, &ptr,subst_token(xctx.inst[inst].prop_ptr, "name", name) );
|
||||
my_strdup(371, &ptr,subst_token(xctx->inst[inst].prop_ptr, "name", name) );
|
||||
hash_all_names(inst);
|
||||
new_prop_string(inst, ptr,0, dis_uniq_names); /* set new prop_ptr */
|
||||
my_strdup2(372, &xctx.inst[inst].instname, get_tok_value(xctx.inst[inst].prop_ptr, "name",0));
|
||||
my_strdup2(372, &xctx->inst[inst].instname, get_tok_value(xctx->inst[inst].prop_ptr, "name",0));
|
||||
|
||||
type=xctx.sym[xctx.inst[inst].ptr].type;
|
||||
type=xctx->sym[xctx->inst[inst].ptr].type;
|
||||
cond= !type || !IS_LABEL_SH_OR_PIN(type);
|
||||
if(cond) xctx.inst[inst].flags|=2;
|
||||
else xctx.inst[inst].flags &=~2;
|
||||
if(cond) xctx->inst[inst].flags|=2;
|
||||
else xctx->inst[inst].flags &=~2;
|
||||
my_free(922, &ptr);
|
||||
}
|
||||
my_free(923, &name);
|
||||
/* new symbol bbox after prop changes (may change due to text length) */
|
||||
symbol_bbox(inst, &xctx.inst[inst].x1, &xctx.inst[inst].y1, &xctx.inst[inst].x2, &xctx.inst[inst].y2);
|
||||
bbox(ADD, xctx.inst[inst].x1, xctx.inst[inst].y1, xctx.inst[inst].x2, xctx.inst[inst].y2);
|
||||
symbol_bbox(inst, &xctx->inst[inst].x1, &xctx->inst[inst].y1, &xctx->inst[inst].x2, &xctx->inst[inst].y2);
|
||||
bbox(ADD, xctx->inst[inst].x1, xctx->inst[inst].y1, xctx->inst[inst].x2, xctx->inst[inst].y2);
|
||||
/* redraw symbol */
|
||||
bbox(SET,0.0,0.0,0.0,0.0);
|
||||
draw();
|
||||
|
|
@ -622,9 +622,9 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
int i;
|
||||
char n[100];
|
||||
Tcl_AppendResult(interp, "\n", NULL);
|
||||
for(i=0; i<xctx.symbols; i++) {
|
||||
for(i=0; i<xctx->symbols; i++) {
|
||||
my_snprintf(n , S(n), "%d", i);
|
||||
Tcl_AppendResult(interp, " {", n, " ", "{", xctx.sym[i].name, "}", "}\n", NULL);
|
||||
Tcl_AppendResult(interp, " {", n, " ", "{", xctx->sym[i].name, "}", "}\n", NULL);
|
||||
}
|
||||
Tcl_AppendResult(interp, "\n", NULL);
|
||||
}
|
||||
|
|
@ -642,16 +642,16 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
return TCL_ERROR;
|
||||
}
|
||||
if(argc == 4) {
|
||||
Tcl_AppendResult(interp, xctx.inst[i].prop_ptr, NULL);
|
||||
Tcl_AppendResult(interp, xctx->inst[i].prop_ptr, NULL);
|
||||
} else if(!strcmp(argv[4],"cell::name")) {
|
||||
tmp = xctx.inst[i].name;
|
||||
tmp = xctx->inst[i].name;
|
||||
Tcl_AppendResult(interp, tmp, NULL);
|
||||
} else if(strstr(argv[4], "cell::") ) {
|
||||
tmp = get_tok_value( (xctx.inst[i].ptr+ xctx.sym)->prop_ptr, argv[4]+6, 0);
|
||||
tmp = get_tok_value( (xctx->inst[i].ptr+ xctx->sym)->prop_ptr, argv[4]+6, 0);
|
||||
dbg(1, "xschem getprop: looking up instance %d prop cell::|%s| : |%s|\n", i, argv[4]+6, tmp);
|
||||
Tcl_AppendResult(interp, tmp, NULL);
|
||||
} else {
|
||||
Tcl_AppendResult(interp, get_tok_value(xctx.inst[i].prop_ptr, argv[4], 0), NULL);
|
||||
Tcl_AppendResult(interp, get_tok_value(xctx->inst[i].prop_ptr, argv[4], 0), NULL);
|
||||
}
|
||||
} else if(argc > 2 && !strcmp(argv[2], "instance_pin")) {
|
||||
/* 0 1 2 3 4 5 */
|
||||
|
|
@ -673,31 +673,31 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
n = atoi(argv[4]);
|
||||
}
|
||||
else {
|
||||
xSymbol *ptr = xctx.inst[inst].ptr+ xctx.sym;
|
||||
xSymbol *ptr = xctx->inst[inst].ptr+ xctx->sym;
|
||||
for(n = 0; n < ptr->rects[PINLAYER]; n++) {
|
||||
char *prop = ptr->rect[PINLAYER][n].prop_ptr;
|
||||
if(!strcmp(get_tok_value(prop, "name",0), argv[4])) break;
|
||||
}
|
||||
}
|
||||
if(n>=0 && n < (xctx.inst[inst].ptr+ xctx.sym)->rects[PINLAYER]) {
|
||||
if(n>=0 && n < (xctx->inst[inst].ptr+ xctx->sym)->rects[PINLAYER]) {
|
||||
if(argc == 5) {
|
||||
Tcl_AppendResult(interp, (xctx.inst[inst].ptr+ xctx.sym)->rect[PINLAYER][n].prop_ptr, NULL);
|
||||
Tcl_AppendResult(interp, (xctx->inst[inst].ptr+ xctx->sym)->rect[PINLAYER][n].prop_ptr, NULL);
|
||||
} else {
|
||||
tmp = 100 + strlen(argv[4]) + strlen(argv[5]);
|
||||
subtok = my_malloc(83,tmp);
|
||||
my_snprintf(subtok, tmp, "%s(%s)", argv[5], argv[4]);
|
||||
value = get_tok_value(xctx.inst[inst].prop_ptr,subtok,0);
|
||||
value = get_tok_value(xctx->inst[inst].prop_ptr,subtok,0);
|
||||
if(!value[0]) {
|
||||
my_snprintf(subtok, tmp, "%s(%d)", argv[5], n);
|
||||
value = get_tok_value(xctx.inst[inst].prop_ptr,subtok,0);
|
||||
value = get_tok_value(xctx->inst[inst].prop_ptr,subtok,0);
|
||||
}
|
||||
if(!value[0]) {
|
||||
value = get_tok_value((xctx.inst[inst].ptr+ xctx.sym)->rect[PINLAYER][n].prop_ptr,argv[5],0);
|
||||
value = get_tok_value((xctx->inst[inst].ptr+ xctx->sym)->rect[PINLAYER][n].prop_ptr,argv[5],0);
|
||||
}
|
||||
if(value[0] != 0) {
|
||||
char *ss;
|
||||
int slot;
|
||||
if( (ss = strchr(xctx.inst[inst].instname, ':')) ) {
|
||||
if( (ss = strchr(xctx->inst[inst].instname, ':')) ) {
|
||||
sscanf(ss + 1, "%d", &slot);
|
||||
if(strstr(value, ":")) value = find_nth(value, ':', slot);
|
||||
}
|
||||
|
|
@ -712,8 +712,8 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
Tcl_AppendResult(interp, "xschem getprop needs 2 or 3 additional arguments", NULL);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
for(i=0; i<xctx.symbols; i++) {
|
||||
if(!strcmp(xctx.sym[i].name,argv[3])){
|
||||
for(i=0; i<xctx->symbols; i++) {
|
||||
if(!strcmp(xctx->sym[i].name,argv[3])){
|
||||
found=1;
|
||||
break;
|
||||
}
|
||||
|
|
@ -723,9 +723,9 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
return TCL_ERROR;
|
||||
}
|
||||
if(argc == 4)
|
||||
Tcl_AppendResult(interp, xctx.sym[i].prop_ptr, NULL);
|
||||
Tcl_AppendResult(interp, xctx->sym[i].prop_ptr, NULL);
|
||||
else
|
||||
Tcl_AppendResult(interp, get_tok_value(xctx.sym[i].prop_ptr, argv[4], 0), NULL);
|
||||
Tcl_AppendResult(interp, get_tok_value(xctx->sym[i].prop_ptr, argv[4], 0), NULL);
|
||||
}
|
||||
} else if(!strcmp(argv[1],"pinlist")) {
|
||||
int i, p, no_of_pins;
|
||||
|
|
@ -733,17 +733,17 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
Tcl_AppendResult(interp, "xschem getprop: instance not found", NULL);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
no_of_pins= (xctx.inst[i].ptr+ xctx.sym)->rects[PINLAYER];
|
||||
no_of_pins= (xctx->inst[i].ptr+ xctx->sym)->rects[PINLAYER];
|
||||
for(p=0;p<no_of_pins;p++) {
|
||||
char s[10];
|
||||
my_snprintf(s, S(s), "%d", p);
|
||||
if(argc == 4 && argv[3][0]) {
|
||||
Tcl_AppendResult(interp, "{ {", s, "} {",
|
||||
get_tok_value((xctx.inst[i].ptr+ xctx.sym)->rect[PINLAYER][p].prop_ptr, argv[3], 0),
|
||||
get_tok_value((xctx->inst[i].ptr+ xctx->sym)->rect[PINLAYER][p].prop_ptr, argv[3], 0),
|
||||
"} } ", NULL);
|
||||
} else {
|
||||
Tcl_AppendResult(interp, "{ {", s, "} {",
|
||||
(xctx.inst[i].ptr+ xctx.sym)->rect[PINLAYER][p].prop_ptr, "} } ", NULL);
|
||||
(xctx->inst[i].ptr+ xctx->sym)->rect[PINLAYER][p].prop_ptr, "} } ", NULL);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -760,9 +760,9 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
return TCL_ERROR;
|
||||
}
|
||||
prepare_netlist_structs(0);
|
||||
no_of_pins= (xctx.inst[i].ptr+ xctx.sym)->rects[PINLAYER];
|
||||
no_of_pins= (xctx->inst[i].ptr+ xctx->sym)->rects[PINLAYER];
|
||||
for(p=0;p<no_of_pins;p++) {
|
||||
if(!strcmp( get_tok_value((xctx.inst[i].ptr+ xctx.sym)->rect[PINLAYER][p].prop_ptr,"name",0), argv[3])) {
|
||||
if(!strcmp( get_tok_value((xctx->inst[i].ptr+ xctx->sym)->rect[PINLAYER][p].prop_ptr,"name",0), argv[3])) {
|
||||
str_ptr = net_name(i,p,&mult, 0);
|
||||
break;
|
||||
}
|
||||
|
|
@ -779,7 +779,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
for(n=0; n < lastselected; n++) {
|
||||
if(selectedgroup[n].type == ELEMENT) {
|
||||
i = selectedgroup[n].n;
|
||||
my_strcat(645, &res, xctx.inst[i].instname);
|
||||
my_strcat(645, &res, xctx->inst[i].instname);
|
||||
if(n < lastselected-1) my_strcat(646, &res, " ");
|
||||
}
|
||||
}
|
||||
|
|
@ -798,14 +798,14 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
n=strtol(argv[3], &endptr, 10);
|
||||
|
||||
/* 20171006 find by instance name */
|
||||
for(i=0;i<xctx.instances;i++) {
|
||||
if(!strcmp(xctx.inst[i].instname, argv[3])) {
|
||||
for(i=0;i<xctx->instances;i++) {
|
||||
if(!strcmp(xctx->inst[i].instname, argv[3])) {
|
||||
select_element(i, SELECTED, 0, 0);
|
||||
found=1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!found && !(endptr == argv[3]) && n<xctx.instances && n >= 0) {
|
||||
if(!found && !(endptr == argv[3]) && n<xctx->instances && n >= 0) {
|
||||
select_element(n, SELECTED, 0, 0);
|
||||
found = 1;
|
||||
}
|
||||
|
|
@ -818,11 +818,11 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
}
|
||||
else if(!strcmp(argv[2],"wire") && argc==4) {
|
||||
int n=atol(argv[3]);
|
||||
if(n<xctx.wires && n >= 0) select_wire(atol(argv[3]), SELECTED, 0);
|
||||
if(n<xctx->wires && n >= 0) select_wire(atol(argv[3]), SELECTED, 0);
|
||||
}
|
||||
else if(!strcmp(argv[2],"text") && argc==4) {
|
||||
int n=atol(argv[3]);
|
||||
if(n<xctx.texts && n >= 0) select_text(atol(argv[3]), SELECTED, 0);
|
||||
if(n<xctx->texts && n >= 0) select_text(atol(argv[3]), SELECTED, 0);
|
||||
}
|
||||
drawtemparc(gc[SELLAYER], END, 0.0, 0.0, 0.0, 0.0, 0.0);
|
||||
drawtemprect(gc[SELLAYER], END, 0.0, 0.0, 0.0, 0.0);
|
||||
|
|
@ -929,7 +929,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
} else if(!strcmp(argv[1],"save")) {
|
||||
dbg(1, "xschem(): saving: current schematic\n");
|
||||
|
||||
if(!strcmp(xctx.sch[xctx.currsch],"")) { /* 20170622 check if unnamed schematic, use saveas in this case... */
|
||||
if(!strcmp(xctx->sch[xctx->currsch],"")) { /* 20170622 check if unnamed schematic, use saveas in this case... */
|
||||
saveas(NULL, SCHEMATIC);
|
||||
} else {
|
||||
save(0);
|
||||
|
|
@ -940,32 +940,32 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
printf("*******global variables:*******\n");
|
||||
printf("netlist_dir=%s\n", netlist_dir? netlist_dir: "<NULL>");
|
||||
printf("lw=%d\n", lw);
|
||||
printf("wires=%d\n", xctx.wires);
|
||||
printf("instances=%d\n", xctx.instances);
|
||||
printf("symbols=%d\n", xctx.symbols);
|
||||
printf("wires=%d\n", xctx->wires);
|
||||
printf("instances=%d\n", xctx->instances);
|
||||
printf("symbols=%d\n", xctx->symbols);
|
||||
printf("lastselected=%d\n", lastselected);
|
||||
printf("texts=%d\n", xctx.texts);
|
||||
printf("maxt=%d\n", xctx.maxt);
|
||||
printf("maxw=%d\n", xctx.maxw);
|
||||
printf("maxi=%d\n", xctx.maxi);
|
||||
printf("texts=%d\n", xctx->texts);
|
||||
printf("maxt=%d\n", xctx->maxt);
|
||||
printf("maxw=%d\n", xctx->maxw);
|
||||
printf("maxi=%d\n", xctx->maxi);
|
||||
printf("max_selected=%d\n", max_selected);
|
||||
printf("zoom=%.16g\n", xctx.zoom);
|
||||
printf("xorigin=%.16g\n", xctx.xorigin);
|
||||
printf("yorigin=%.16g\n", xctx.yorigin);
|
||||
printf("zoom=%.16g\n", xctx->zoom);
|
||||
printf("xorigin=%.16g\n", xctx->xorigin);
|
||||
printf("yorigin=%.16g\n", xctx->yorigin);
|
||||
for(i=0;i<8;i++)
|
||||
{
|
||||
printf("rects[%d]=%d\n", i, xctx.rects[i]);
|
||||
printf("lines[%d]=%d\n", i, xctx.lines[i]);
|
||||
printf("maxr[%d]=%d\n", i, xctx.maxr[i]);
|
||||
printf("maxl[%d]=%d\n", i, xctx.maxl[i]);
|
||||
printf("rects[%d]=%d\n", i, xctx->rects[i]);
|
||||
printf("lines[%d]=%d\n", i, xctx->lines[i]);
|
||||
printf("maxr[%d]=%d\n", i, xctx->maxr[i]);
|
||||
printf("maxl[%d]=%d\n", i, xctx->maxl[i]);
|
||||
}
|
||||
printf("current_name=%s\n", xctx.current_name);
|
||||
printf("currsch=%d\n", xctx.currsch);
|
||||
for(i=0;i<=xctx.currsch;i++)
|
||||
printf("current_name=%s\n", xctx->current_name);
|
||||
printf("currsch=%d\n", xctx->currsch);
|
||||
for(i=0;i<=xctx->currsch;i++)
|
||||
{
|
||||
printf("previous_instance[%d]=%d\n",i,xctx.previous_instance[i]);
|
||||
printf("sch_path[%d]=%s\n",i,xctx.sch_path[i]? xctx.sch_path[i]:"<NULL>");
|
||||
printf("sch[%d]=%s\n",i,xctx.sch[i]);
|
||||
printf("previous_instance[%d]=%d\n",i,xctx->previous_instance[i]);
|
||||
printf("sch_path[%d]=%s\n",i,xctx->sch_path[i]? xctx->sch_path[i]:"<NULL>");
|
||||
printf("sch[%d]=%s\n",i,xctx->sch[i]);
|
||||
}
|
||||
printf("modified=%d\n", modified);
|
||||
printf("color_ps=%d\n", color_ps);
|
||||
|
|
@ -1153,14 +1153,14 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
else if(!strcmp(argv[1],"edit_file") ) {
|
||||
rebuild_selected_array();
|
||||
if(lastselected==0 ) {
|
||||
save_schematic(xctx.sch[xctx.currsch]); /* sync data with disk file before editing file */
|
||||
save_schematic(xctx->sch[xctx->currsch]); /* sync data with disk file before editing file */
|
||||
my_snprintf(name, S(name), "edit_file {%s}",
|
||||
abs_sym_path(xctx.sch[xctx.currsch], ""));
|
||||
abs_sym_path(xctx->sch[xctx->currsch], ""));
|
||||
tcleval(name);
|
||||
}
|
||||
else if(selectedgroup[0].type==ELEMENT) {
|
||||
my_snprintf(name, S(name), "edit_file {%s}",
|
||||
abs_sym_path(xctx.inst[selectedgroup[0].n].name, ""));
|
||||
abs_sym_path(xctx->inst[selectedgroup[0].n].name, ""));
|
||||
tcleval(name);
|
||||
|
||||
}
|
||||
|
|
@ -1239,13 +1239,13 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
if(argc==3) {
|
||||
dbg(1, "xschem(): load: filename=%s\n", argv[2]);
|
||||
delete_hilight_net();
|
||||
xctx.currsch = 0;
|
||||
xctx->currsch = 0;
|
||||
unselect_all();
|
||||
remove_symbols();
|
||||
/* load_symbol(argv[2]); */
|
||||
load_schematic(0, abs_sym_path(argv[2], ""), 1);
|
||||
my_strdup(374, &xctx.sch_path[xctx.currsch],".");
|
||||
xctx.sch_inst_number[xctx.currsch] = 1;
|
||||
my_strdup(374, &xctx->sch_path[xctx->currsch],".");
|
||||
xctx->sch_inst_number[xctx->currsch] = 1;
|
||||
zoom_full(1, 0);
|
||||
}
|
||||
}
|
||||
|
|
@ -1256,13 +1256,13 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
if(!has_x || !modified || !save(1) ) { /* save(1)==1 --> user cancel */
|
||||
dbg(1, "xschem(): load: filename=%s\n", argv[2]);
|
||||
delete_hilight_net();
|
||||
xctx.currsch = 0;
|
||||
xctx->currsch = 0;
|
||||
unselect_all();
|
||||
remove_symbols();
|
||||
load_schematic(1, abs_sym_path(argv[2], ""), 1);
|
||||
Tcl_VarEval(interp, "update_recent_file {", abs_sym_path(argv[2], ""), "}", NULL);
|
||||
my_strdup(375, &xctx.sch_path[xctx.currsch],".");
|
||||
xctx.sch_inst_number[xctx.currsch] = 1;
|
||||
my_strdup(375, &xctx->sch_path[xctx->currsch],".");
|
||||
xctx->sch_inst_number[xctx->currsch] = 1;
|
||||
zoom_full(1, 0);
|
||||
}
|
||||
}
|
||||
|
|
@ -1519,19 +1519,20 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
else if(!strcmp(argv[1],"instance_bbox")) {
|
||||
int i;
|
||||
char s[200];
|
||||
for(i=0;i<xctx.instances;i++) {
|
||||
if(!strcmp(xctx.inst[i].instname, argv[2])) {
|
||||
for(i=0;i<xctx->instances;i++) {
|
||||
if(!strcmp(xctx->inst[i].instname, argv[2])) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(i<xctx.instances) {
|
||||
my_snprintf(s, S(s), "xInstance: %g %g %g %g", xctx.inst[i].x1, xctx.inst[i].y1, xctx.inst[i].x2, xctx.inst[i].y2);
|
||||
if(i<xctx->instances) {
|
||||
my_snprintf(s, S(s), "xInstance: %g %g %g %g", xctx->inst[i].x1, xctx->inst[i].y1,
|
||||
xctx->inst[i].x2, xctx->inst[i].y2);
|
||||
Tcl_AppendResult(interp, s, NULL);
|
||||
my_snprintf(s, S(s), "\nSymbol: %g %g %g %g",
|
||||
(xctx.inst[i].ptr+ xctx.sym)->minx,
|
||||
(xctx.inst[i].ptr+ xctx.sym)->miny,
|
||||
(xctx.inst[i].ptr+ xctx.sym)->maxx,
|
||||
(xctx.inst[i].ptr+ xctx.sym)->maxy
|
||||
(xctx->inst[i].ptr+ xctx->sym)->minx,
|
||||
(xctx->inst[i].ptr+ xctx->sym)->miny,
|
||||
(xctx->inst[i].ptr+ xctx->sym)->maxx,
|
||||
(xctx->inst[i].ptr+ xctx->sym)->maxy
|
||||
);
|
||||
Tcl_AppendResult(interp, s, NULL);
|
||||
}
|
||||
|
|
@ -1540,12 +1541,12 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
else if(!strcmp(argv[1],"instance_pos")) {
|
||||
int i;
|
||||
char s[30];
|
||||
for(i=0;i<xctx.instances;i++) {
|
||||
if(!strcmp(xctx.inst[i].instname, argv[2])) {
|
||||
for(i=0;i<xctx->instances;i++) {
|
||||
if(!strcmp(xctx->inst[i].instname, argv[2])) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(i==xctx.instances) i = -1;
|
||||
if(i==xctx->instances) i = -1;
|
||||
my_snprintf(s, S(s), "%d", i);
|
||||
Tcl_AppendResult(interp, s, NULL);
|
||||
}
|
||||
|
|
@ -1558,10 +1559,10 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
Tcl_AppendResult(interp, "xschem instance_pins: instance not found", NULL);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
no_of_pins= (xctx.inst[i].ptr+ xctx.sym)->rects[PINLAYER];
|
||||
no_of_pins= (xctx->inst[i].ptr+ xctx->sym)->rects[PINLAYER];
|
||||
for(p=0;p<no_of_pins;p++) {
|
||||
const char *pin;
|
||||
pin = get_tok_value((xctx.inst[i].ptr+ xctx.sym)->rect[PINLAYER][p].prop_ptr,"name",0);
|
||||
pin = get_tok_value((xctx->inst[i].ptr+ xctx->sym)->rect[PINLAYER][p].prop_ptr,"name",0);
|
||||
if(!pin[0]) pin = "--ERROR--";
|
||||
my_strcat(376, &pins, pin);
|
||||
if(p< no_of_pins-1) my_strcat(377, &pins, " ");
|
||||
|
|
@ -1578,21 +1579,21 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
else if(argc >= 3 && !strcmp(argv[1],"get") && !strcmp(argv[2],"schname") ) {
|
||||
int x;
|
||||
if(argc == 4) x = atoi(argv[3]);
|
||||
else x = xctx.currsch;
|
||||
if(x<0 && xctx.currsch+x>=0) {
|
||||
Tcl_AppendResult(interp, xctx.sch[xctx.currsch+x], NULL);
|
||||
} else if(x<=xctx.currsch) {
|
||||
Tcl_AppendResult(interp, xctx.sch[x], NULL);
|
||||
else x = xctx->currsch;
|
||||
if(x<0 && xctx->currsch+x>=0) {
|
||||
Tcl_AppendResult(interp, xctx->sch[xctx->currsch+x], NULL);
|
||||
} else if(x<=xctx->currsch) {
|
||||
Tcl_AppendResult(interp, xctx->sch[x], NULL);
|
||||
}
|
||||
}
|
||||
else if(argc >=3 && !strcmp(argv[1],"get") && !strcmp(argv[2],"sch_path")) {
|
||||
int x;
|
||||
if(argc == 4) x = atoi(argv[3]);
|
||||
else x = xctx.currsch;
|
||||
if(x<0 && xctx.currsch+x>=0) {
|
||||
Tcl_AppendResult(interp, xctx.sch_path[xctx.currsch+x], NULL);
|
||||
} else if(x<=xctx.currsch) {
|
||||
Tcl_AppendResult(interp, xctx.sch_path[x], NULL);
|
||||
else x = xctx->currsch;
|
||||
if(x<0 && xctx->currsch+x>=0) {
|
||||
Tcl_AppendResult(interp, xctx->sch_path[xctx->currsch+x], NULL);
|
||||
} else if(x<=xctx->currsch) {
|
||||
Tcl_AppendResult(interp, xctx->sch_path[x], NULL);
|
||||
}
|
||||
}
|
||||
else if(argc == 4 && !strcmp(argv[1],"get") && !strcmp(argv[2],"expandlabel")) {
|
||||
|
|
@ -1730,7 +1731,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
}
|
||||
else if(!strcmp(argv[2],"currsch")) {
|
||||
char s[30]; /* overflow safe 20161122 */
|
||||
my_snprintf(s, S(s), "%d",xctx.currsch);
|
||||
my_snprintf(s, S(s), "%d",xctx->currsch);
|
||||
Tcl_AppendResult(interp, s,NULL);
|
||||
}
|
||||
else if(!strcmp(argv[2],"semaphore")) {
|
||||
|
|
@ -1763,7 +1764,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
}
|
||||
else if(!strcmp(argv[2],"instances")) {
|
||||
char s[30]; /* overflow safe 20161122 */
|
||||
my_snprintf(s, S(s), "%d",xctx.instances);
|
||||
my_snprintf(s, S(s), "%d",xctx->instances);
|
||||
Tcl_AppendResult(interp, s,NULL);
|
||||
}
|
||||
else if(!strcmp(argv[2],"pinlayer")) {
|
||||
|
|
|
|||
540
src/select.c
540
src/select.c
File diff suppressed because it is too large
Load Diff
|
|
@ -42,7 +42,7 @@ void global_spice_netlist(int global) /* netlister driver */
|
|||
char *subckt_name;
|
||||
|
||||
if(modified) {
|
||||
save_ok = save_schematic(xctx.sch[xctx.currsch]);
|
||||
save_ok = save_schematic(xctx->sch[xctx->currsch]);
|
||||
if(save_ok == -1) return;
|
||||
}
|
||||
free_hash(subckt_table);
|
||||
|
|
@ -58,14 +58,14 @@ void global_spice_netlist(int global) /* netlister driver */
|
|||
bus_replacement_char[1] = str_tmp[1];
|
||||
}
|
||||
netlist_count=0;
|
||||
my_snprintf(netl_filename, S(netl_filename), "%s/.%s_%d", netlist_dir, skip_dir(xctx.sch[xctx.currsch]), getpid());
|
||||
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);
|
||||
fd=fopen(netl_filename, "w");
|
||||
|
||||
if(user_top_netl_name[0]) {
|
||||
my_snprintf(cellname, S(cellname), "%s", get_cell(user_top_netl_name, 0));
|
||||
} else {
|
||||
my_snprintf(cellname, S(cellname), "%s.spice", skip_dir(xctx.sch[xctx.currsch]));
|
||||
my_snprintf(cellname, S(cellname), "%s.spice", skip_dir(xctx->sch[xctx->currsch]));
|
||||
}
|
||||
|
||||
if(fd==NULL) {
|
||||
|
|
@ -73,9 +73,9 @@ void global_spice_netlist(int global) /* netlister driver */
|
|||
return;
|
||||
}
|
||||
/* netlist_options */
|
||||
for(i=0;i<xctx.instances;i++) {
|
||||
if(!(xctx.inst[i].ptr+ xctx.sym)->type) continue;
|
||||
if( !strcmp((xctx.inst[i].ptr+ xctx.sym)->type,"netlist_options") ) {
|
||||
for(i=0;i<xctx->instances;i++) {
|
||||
if(!(xctx->inst[i].ptr+ xctx->sym)->type) continue;
|
||||
if( !strcmp((xctx->inst[i].ptr+ xctx->sym)->type,"netlist_options") ) {
|
||||
netlist_options(i);
|
||||
}
|
||||
}
|
||||
|
|
@ -83,24 +83,24 @@ void global_spice_netlist(int global) /* netlister driver */
|
|||
if(!strcmp(tclgetvar("spiceprefix"), "0")) spiceprefix = 0;
|
||||
|
||||
if(!top_subckt) fprintf(fd,"**");
|
||||
fprintf(fd,".subckt %s", skip_dir( xctx.sch[xctx.currsch]) );
|
||||
fprintf(fd,".subckt %s", skip_dir( xctx->sch[xctx->currsch]) );
|
||||
|
||||
/* print top subckt ipin/opins */
|
||||
for(i=0;i<xctx.instances;i++) {
|
||||
if( strcmp(get_tok_value(xctx.inst[i].prop_ptr,"spice_ignore",0),"true")==0 ) continue;
|
||||
if(xctx.inst[i].ptr<0) continue;
|
||||
if(!strcmp(get_tok_value( (xctx.inst[i].ptr+ xctx.sym)->prop_ptr, "spice_ignore",0 ), "true") ) {
|
||||
for(i=0;i<xctx->instances;i++) {
|
||||
if( strcmp(get_tok_value(xctx->inst[i].prop_ptr,"spice_ignore",0),"true")==0 ) continue;
|
||||
if(xctx->inst[i].ptr<0) continue;
|
||||
if(!strcmp(get_tok_value( (xctx->inst[i].ptr+ xctx->sym)->prop_ptr, "spice_ignore",0 ), "true") ) {
|
||||
continue;
|
||||
}
|
||||
my_strdup(380, &type,(xctx.inst[i].ptr+ xctx.sym)->type);
|
||||
my_strdup(380, &type,(xctx->inst[i].ptr+ xctx->sym)->type);
|
||||
dbg(1, "global_spice_netlist(): |%s|\n", type);
|
||||
if( type && !strcmp(type,"netlist_options") ) {
|
||||
continue;
|
||||
}
|
||||
if( type && IS_PIN(type)) {
|
||||
str_tmp = expandlabel ( get_tok_value(xctx.inst[i].prop_ptr,"lab",0) ,&mult);
|
||||
str_tmp = expandlabel ( get_tok_value(xctx->inst[i].prop_ptr,"lab",0) ,&mult);
|
||||
dbg(1, "global_spice_netlist(): |%s|\n",
|
||||
get_tok_value(xctx.inst[i].prop_ptr,"lab",0));
|
||||
get_tok_value(xctx->inst[i].prop_ptr,"lab",0));
|
||||
/*must handle invalid node names */
|
||||
fprintf(fd, " %s", str_tmp ? str_tmp : "(NULL)" );
|
||||
}
|
||||
|
|
@ -110,18 +110,18 @@ void global_spice_netlist(int global) /* netlister driver */
|
|||
spice_netlist(fd, 0);
|
||||
|
||||
first = 0;
|
||||
for(i=0;i<xctx.instances;i++) /* print netlist_commands of top level cell with no 'place=end' property */
|
||||
for(i=0;i<xctx->instances;i++) /* print netlist_commands of top level cell with no 'place=end' property */
|
||||
{
|
||||
if( strcmp(get_tok_value(xctx.inst[i].prop_ptr,"spice_ignore",0),"true")==0 ) continue;
|
||||
if(xctx.inst[i].ptr<0) continue;
|
||||
if(!strcmp(get_tok_value( (xctx.inst[i].ptr+ xctx.sym)->prop_ptr, "spice_ignore",0 ), "true") ) {
|
||||
if( strcmp(get_tok_value(xctx->inst[i].prop_ptr,"spice_ignore",0),"true")==0 ) continue;
|
||||
if(xctx->inst[i].ptr<0) continue;
|
||||
if(!strcmp(get_tok_value( (xctx->inst[i].ptr+ xctx->sym)->prop_ptr, "spice_ignore",0 ), "true") ) {
|
||||
continue;
|
||||
}
|
||||
my_strdup(381, &type,(xctx.inst[i].ptr+ xctx.sym)->type);
|
||||
my_strdup(382, &place,get_tok_value((xctx.inst[i].ptr+ xctx.sym)->prop_ptr,"place",0));
|
||||
my_strdup(381, &type,(xctx->inst[i].ptr+ xctx->sym)->type);
|
||||
my_strdup(382, &place,get_tok_value((xctx->inst[i].ptr+ xctx->sym)->prop_ptr,"place",0));
|
||||
if( type && !strcmp(type,"netlist_commands") ) {
|
||||
if(!place || strcmp(place, "end" )) {
|
||||
my_strdup(383, &place,get_tok_value(xctx.inst[i].prop_ptr,"place",0));
|
||||
my_strdup(383, &place,get_tok_value(xctx->inst[i].prop_ptr,"place",0));
|
||||
if(!place || strcmp(place, "end" )) {
|
||||
if(first == 0) fprintf(fd,"**** begin user architecture code\n");
|
||||
first++;
|
||||
|
|
@ -133,10 +133,10 @@ void global_spice_netlist(int global) /* netlister driver */
|
|||
|
||||
netlist_count++;
|
||||
|
||||
if(xctx.schprop && xctx.schprop[0]) {
|
||||
if(xctx->schprop && xctx->schprop[0]) {
|
||||
if(first == 0) fprintf(fd,"**** begin user architecture code\n");
|
||||
first++;
|
||||
fprintf(fd, "%s\n", xctx.schprop);
|
||||
fprintf(fd, "%s\n", xctx->schprop);
|
||||
}
|
||||
if(first) fprintf(fd,"**** end user architecture code\n");
|
||||
/* /20100217 */
|
||||
|
|
@ -153,35 +153,35 @@ void global_spice_netlist(int global) /* netlister driver */
|
|||
}
|
||||
|
||||
/* preserve current level instance flags before descending hierarchy for netlisting, restore later */
|
||||
stored_flags = my_calloc(146, xctx.instances, sizeof(unsigned int));
|
||||
for(i=0;i<xctx.instances;i++) stored_flags[i] = xctx.inst[i].flags & 4;
|
||||
stored_flags = my_calloc(146, xctx->instances, sizeof(unsigned int));
|
||||
for(i=0;i<xctx->instances;i++) stored_flags[i] = xctx->inst[i].flags & 4;
|
||||
|
||||
if(global)
|
||||
{
|
||||
unselect_all();
|
||||
remove_symbols(); /* 20161205 ensure all unused symbols purged before descending hierarchy */
|
||||
load_schematic(1, xctx.sch[xctx.currsch], 0);
|
||||
load_schematic(1, xctx->sch[xctx->currsch], 0);
|
||||
|
||||
xctx.currsch++;
|
||||
dbg(1, "global_spice_netlist(): last defined symbol=%d\n",xctx.symbols);
|
||||
xctx->currsch++;
|
||||
dbg(1, "global_spice_netlist(): last defined symbol=%d\n",xctx->symbols);
|
||||
subckt_name=NULL;
|
||||
for(i=0;i<xctx.symbols;i++)
|
||||
for(i=0;i<xctx->symbols;i++)
|
||||
{
|
||||
if( strcmp(get_tok_value(xctx.sym[i].prop_ptr,"spice_ignore",0),"true")==0 ) continue;
|
||||
if(!xctx.sym[i].type) continue;
|
||||
if(strcmp(xctx.sym[i].type,"subcircuit")==0 && check_lib(xctx.sym[i].name))
|
||||
if( strcmp(get_tok_value(xctx->sym[i].prop_ptr,"spice_ignore",0),"true")==0 ) continue;
|
||||
if(!xctx->sym[i].type) continue;
|
||||
if(strcmp(xctx->sym[i].type,"subcircuit")==0 && check_lib(xctx->sym[i].name))
|
||||
{
|
||||
/* xctx.sym can be SCH or SYM, use hash to avoid writing duplicate subckt */
|
||||
my_strdup(391, &subckt_name, get_cell(xctx.sym[i].name, 0));
|
||||
/* xctx->sym can be SCH or SYM, use hash to avoid writing duplicate subckt */
|
||||
my_strdup(391, &subckt_name, get_cell(xctx->sym[i].name, 0));
|
||||
if (hash_lookup(subckt_table, subckt_name, "", XLOOKUP)==NULL)
|
||||
{
|
||||
hash_lookup(subckt_table, subckt_name, "", XINSERT);
|
||||
if( split_files && strcmp(get_tok_value(xctx.sym[i].prop_ptr,"vhdl_netlist",0),"true")==0 )
|
||||
if( split_files && strcmp(get_tok_value(xctx->sym[i].prop_ptr,"vhdl_netlist",0),"true")==0 )
|
||||
vhdl_block_netlist(fd, i);
|
||||
else if(split_files && strcmp(get_tok_value(xctx.sym[i].prop_ptr,"verilog_netlist",0),"true")==0 )
|
||||
else if(split_files && strcmp(get_tok_value(xctx->sym[i].prop_ptr,"verilog_netlist",0),"true")==0 )
|
||||
verilog_block_netlist(fd, i);
|
||||
else
|
||||
if( strcmp(get_tok_value(xctx.sym[i].prop_ptr,"spice_primitive",0),"true") )
|
||||
if( strcmp(get_tok_value(xctx->sym[i].prop_ptr,"spice_primitive",0),"true") )
|
||||
spice_block_netlist(fd, i);
|
||||
}
|
||||
}
|
||||
|
|
@ -189,16 +189,16 @@ void global_spice_netlist(int global) /* netlister driver */
|
|||
free_hash(subckt_table);
|
||||
my_free(944, &subckt_name);
|
||||
/*clear_drawing(); */
|
||||
my_strncpy(xctx.sch[xctx.currsch] , "", S(xctx.sch[xctx.currsch]));
|
||||
xctx.currsch--;
|
||||
my_strncpy(xctx->sch[xctx->currsch] , "", S(xctx->sch[xctx->currsch]));
|
||||
xctx->currsch--;
|
||||
unselect_all();
|
||||
/* remove_symbols(); */
|
||||
load_schematic(1, xctx.sch[xctx.currsch], 0);
|
||||
load_schematic(1, xctx->sch[xctx->currsch], 0);
|
||||
prepare_netlist_structs(1); /* so 'lab=...' attributes for unnamed nets are set */
|
||||
/* symbol vs schematic pin check, we do it here since now we have ALL symbols loaded */
|
||||
sym_vs_sch_pins();
|
||||
/* restore hilight flags from errors found analyzing top level before descending hierarchy */
|
||||
for(i=0;i<xctx.instances; i++) xctx.inst[i].flags |= stored_flags[i];
|
||||
for(i=0;i<xctx->instances; i++) xctx->inst[i].flags |= stored_flags[i];
|
||||
draw_hilight_net(1);
|
||||
}
|
||||
my_free(945, &stored_flags);
|
||||
|
|
@ -209,22 +209,22 @@ void global_spice_netlist(int global) /* netlister driver */
|
|||
/* =================================== 20121223 */
|
||||
first = 0;
|
||||
if(!split_files) {
|
||||
for(i=0;i<xctx.instances;i++) /* print netlist_commands of top level cell with 'place=end' property */
|
||||
for(i=0;i<xctx->instances;i++) /* print netlist_commands of top level cell with 'place=end' property */
|
||||
{
|
||||
if( strcmp(get_tok_value(xctx.inst[i].prop_ptr,"spice_ignore",0),"true")==0 ) continue;
|
||||
if(xctx.inst[i].ptr<0) continue;
|
||||
if(!strcmp(get_tok_value( (xctx.inst[i].ptr+ xctx.sym)->prop_ptr, "spice_ignore",0 ), "true") ) {
|
||||
if( strcmp(get_tok_value(xctx->inst[i].prop_ptr,"spice_ignore",0),"true")==0 ) continue;
|
||||
if(xctx->inst[i].ptr<0) continue;
|
||||
if(!strcmp(get_tok_value( (xctx->inst[i].ptr+ xctx->sym)->prop_ptr, "spice_ignore",0 ), "true") ) {
|
||||
continue;
|
||||
}
|
||||
my_strdup(384, &type,(xctx.inst[i].ptr+ xctx.sym)->type);
|
||||
my_strdup(385, &place,get_tok_value((xctx.inst[i].ptr+ xctx.sym)->prop_ptr,"place",0));
|
||||
my_strdup(384, &type,(xctx->inst[i].ptr+ xctx->sym)->type);
|
||||
my_strdup(385, &place,get_tok_value((xctx->inst[i].ptr+ xctx->sym)->prop_ptr,"place",0));
|
||||
if( type && !strcmp(type,"netlist_commands") ) {
|
||||
if(place && !strcmp(place, "end" )) {
|
||||
if(first == 0) fprintf(fd,"**** begin user architecture code\n");
|
||||
first++;
|
||||
print_spice_element(fd, i) ;
|
||||
} else {
|
||||
my_strdup(386, &place,get_tok_value(xctx.inst[i].prop_ptr,"place",0));
|
||||
my_strdup(386, &place,get_tok_value(xctx->inst[i].prop_ptr,"place",0));
|
||||
if(place && !strcmp(place, "end" )) {
|
||||
if(first == 0) fprintf(fd,"**** begin user architecture code\n");
|
||||
first++;
|
||||
|
|
@ -302,45 +302,45 @@ void spice_block_netlist(FILE *fd, int i)
|
|||
/* int mult; */
|
||||
char *extra=NULL;
|
||||
|
||||
if(!strcmp( get_tok_value(xctx.sym[i].prop_ptr,"spice_stop",0),"true") )
|
||||
if(!strcmp( get_tok_value(xctx->sym[i].prop_ptr,"spice_stop",0),"true") )
|
||||
spice_stop=1;
|
||||
else
|
||||
spice_stop=0;
|
||||
|
||||
if(split_files) {
|
||||
my_snprintf(netl_filename, S(netl_filename), "%s/.%s_%d", netlist_dir, skip_dir(xctx.sym[i].name), getpid());
|
||||
my_snprintf(netl_filename, S(netl_filename), "%s/.%s_%d", netlist_dir, skip_dir(xctx->sym[i].name), getpid());
|
||||
dbg(1, "spice_block_netlist(): split_files: netl_filename=%s\n", netl_filename);
|
||||
fd=fopen(netl_filename, "w");
|
||||
my_snprintf(cellname, S(cellname), "%s.spice", skip_dir(xctx.sym[i].name));
|
||||
my_snprintf(cellname, S(cellname), "%s.spice", skip_dir(xctx->sym[i].name));
|
||||
}
|
||||
|
||||
fprintf(fd, "\n* expanding symbol: %s # of pins=%d\n\n",
|
||||
xctx.sym[i].name,xctx.sym[i].rects[PINLAYER] );
|
||||
xctx->sym[i].name,xctx->sym[i].rects[PINLAYER] );
|
||||
|
||||
fprintf(fd, ".subckt %s ",skip_dir(xctx.sym[i].name));
|
||||
fprintf(fd, ".subckt %s ",skip_dir(xctx->sym[i].name));
|
||||
print_spice_subckt(fd, i);
|
||||
|
||||
my_strdup(387, &extra, get_tok_value(xctx.sym[i].prop_ptr,"extra",0) );
|
||||
my_strdup(387, &extra, get_tok_value(xctx->sym[i].prop_ptr,"extra",0) );
|
||||
fprintf(fd, "%s ", extra ? extra : "" );
|
||||
|
||||
/* 20081206 new get_sym_template does not return token=value pairs where token listed in extra */
|
||||
fprintf(fd, "%s", get_sym_template(xctx.sym[i].templ, extra));
|
||||
fprintf(fd, "%s", get_sym_template(xctx->sym[i].templ, extra));
|
||||
my_free(950, &extra);
|
||||
fprintf(fd, "\n");
|
||||
|
||||
if((str_tmp = get_tok_value(xctx.sym[i].prop_ptr, "schematic",0 ))[0]) {
|
||||
if((str_tmp = get_tok_value(xctx->sym[i].prop_ptr, "schematic",0 ))[0]) {
|
||||
my_strncpy(filename, abs_sym_path(str_tmp, ""), S(filename));
|
||||
load_schematic(1,filename, 0);
|
||||
} else {
|
||||
load_schematic(1, add_ext(abs_sym_path(xctx.sym[i].name, ""), ".sch") ,0);
|
||||
load_schematic(1, add_ext(abs_sym_path(xctx->sym[i].name, ""), ".sch") ,0);
|
||||
}
|
||||
spice_netlist(fd, spice_stop); /* 20111113 added spice_stop */
|
||||
netlist_count++;
|
||||
|
||||
|
||||
if(xctx.schprop && xctx.schprop[0]) {
|
||||
if(xctx->schprop && xctx->schprop[0]) {
|
||||
fprintf(fd,"**** begin user architecture code\n");
|
||||
fprintf(fd, "%s\n", xctx.schprop);
|
||||
fprintf(fd, "%s\n", xctx->schprop);
|
||||
fprintf(fd,"**** end user architecture code\n");
|
||||
}
|
||||
/* /20100217 */
|
||||
|
|
@ -364,32 +364,32 @@ void spice_netlist(FILE *fd, int spice_stop )
|
|||
/* set_modify(1); */ /* 20160302 prepare_netlist_structs could change schematic (wire node naming for example) */
|
||||
traverse_node_hash(); /* print all warnings about unconnected floatings etc */
|
||||
if(!spice_stop) {
|
||||
for(i=0;i<xctx.instances;i++) /* print first ipin/opin defs ... */
|
||||
for(i=0;i<xctx->instances;i++) /* print first ipin/opin defs ... */
|
||||
{
|
||||
if( strcmp(get_tok_value(xctx.inst[i].prop_ptr,"spice_ignore",0),"true")==0 ) continue;
|
||||
if(xctx.inst[i].ptr<0) continue;
|
||||
if(!strcmp(get_tok_value( (xctx.inst[i].ptr+ xctx.sym)->prop_ptr, "spice_ignore",0 ), "true") ) {
|
||||
if( strcmp(get_tok_value(xctx->inst[i].prop_ptr,"spice_ignore",0),"true")==0 ) continue;
|
||||
if(xctx->inst[i].ptr<0) continue;
|
||||
if(!strcmp(get_tok_value( (xctx->inst[i].ptr+ xctx->sym)->prop_ptr, "spice_ignore",0 ), "true") ) {
|
||||
continue;
|
||||
}
|
||||
my_strdup(388, &type,(xctx.inst[i].ptr+ xctx.sym)->type);
|
||||
my_strdup(388, &type,(xctx->inst[i].ptr+ xctx->sym)->type);
|
||||
if( type && IS_PIN(type) ) {
|
||||
print_spice_element(fd, i) ; /* this is the element line */
|
||||
}
|
||||
}
|
||||
|
||||
for(i=0;i<xctx.instances;i++) /* ... then print other lines */
|
||||
for(i=0;i<xctx->instances;i++) /* ... then print other lines */
|
||||
{
|
||||
if( strcmp(get_tok_value(xctx.inst[i].prop_ptr,"spice_ignore",0),"true")==0 ) continue;
|
||||
if(xctx.inst[i].ptr<0) continue;
|
||||
if(!strcmp(get_tok_value( (xctx.inst[i].ptr+ xctx.sym)->prop_ptr, "spice_ignore",0 ), "true") ) {
|
||||
if( strcmp(get_tok_value(xctx->inst[i].prop_ptr,"spice_ignore",0),"true")==0 ) continue;
|
||||
if(xctx->inst[i].ptr<0) continue;
|
||||
if(!strcmp(get_tok_value( (xctx->inst[i].ptr+ xctx->sym)->prop_ptr, "spice_ignore",0 ), "true") ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
my_strdup(390, &type,(xctx.inst[i].ptr+ xctx.sym)->type);
|
||||
my_strdup(390, &type,(xctx->inst[i].ptr+ xctx->sym)->type);
|
||||
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(xctx.inst[i].prop_ptr, "only_toplevel", 0), "true")) continue;
|
||||
!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");
|
||||
print_spice_element(fd, i) ; /* this is the element line */
|
||||
|
|
@ -398,10 +398,10 @@ void spice_netlist(FILE *fd, int spice_stop )
|
|||
const char *m;
|
||||
print_spice_element(fd, i) ; /* this is the element line */
|
||||
/* hash device_model attribute if any */
|
||||
m = get_tok_value(xctx.inst[i].prop_ptr, "device_model", 2);
|
||||
m = get_tok_value(xctx->inst[i].prop_ptr, "device_model", 2);
|
||||
if(m[0]) hash_lookup(model_table, model_name(m), m, XINSERT);
|
||||
else {
|
||||
m = get_tok_value( (xctx.inst[i].ptr+ xctx.sym)->prop_ptr, "device_model", 2);
|
||||
m = get_tok_value( (xctx->inst[i].ptr+ xctx->sym)->prop_ptr, "device_model", 2);
|
||||
if(m[0]) hash_lookup(model_table, model_name(m), m, XINSERT);
|
||||
}
|
||||
my_free(951, &model_name_result);
|
||||
|
|
|
|||
272
src/store.c
272
src/store.c
|
|
@ -25,10 +25,10 @@
|
|||
|
||||
void check_wire_storage(void)
|
||||
{
|
||||
if(xctx.wires >= xctx.maxw)
|
||||
if(xctx->wires >= xctx->maxw)
|
||||
{
|
||||
xctx.maxw=(1+xctx.wires / CADMAXWIRES)*CADMAXWIRES;
|
||||
my_realloc(392, &xctx.wire, sizeof(xWire)*xctx.maxw);
|
||||
xctx->maxw=(1+xctx->wires / CADMAXWIRES)*CADMAXWIRES;
|
||||
my_realloc(392, &xctx->wire, sizeof(xWire)*xctx->maxw);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -43,58 +43,58 @@ void check_selected_storage(void)
|
|||
|
||||
void check_text_storage(void)
|
||||
{
|
||||
if(xctx.texts >= xctx.maxt)
|
||||
if(xctx->texts >= xctx->maxt)
|
||||
{
|
||||
xctx.maxt=(1 + xctx.texts / CADMAXTEXT) * CADMAXTEXT;
|
||||
my_realloc(394, &xctx.text, sizeof(xText)*xctx.maxt);
|
||||
xctx->maxt=(1 + xctx->texts / CADMAXTEXT) * CADMAXTEXT;
|
||||
my_realloc(394, &xctx->text, sizeof(xText)*xctx->maxt);
|
||||
}
|
||||
}
|
||||
|
||||
void check_symbol_storage(void)
|
||||
{
|
||||
int i;
|
||||
if(xctx.symbols >= xctx.maxs)
|
||||
if(xctx->symbols >= xctx->maxs)
|
||||
{
|
||||
dbg(1, "check_symbol_storage(): more than maxs, %s\n",
|
||||
xctx.sch[xctx.currsch] );
|
||||
xctx.maxs=(1 + xctx.symbols / ELEMDEF) * ELEMDEF;
|
||||
my_realloc(395, &xctx.sym, sizeof(xSymbol)*xctx.maxs);
|
||||
for(i=xctx.symbols;i<xctx.maxs;i++) {
|
||||
xctx.sym[i].poly=my_calloc(68, cadlayers, sizeof(xPoly *));
|
||||
if(xctx.sym[i].poly==NULL){
|
||||
xctx->sch[xctx->currsch] );
|
||||
xctx->maxs=(1 + xctx->symbols / ELEMDEF) * ELEMDEF;
|
||||
my_realloc(395, &xctx->sym, sizeof(xSymbol)*xctx->maxs);
|
||||
for(i=xctx->symbols;i<xctx->maxs;i++) {
|
||||
xctx->sym[i].poly=my_calloc(68, cadlayers, sizeof(xPoly *));
|
||||
if(xctx->sym[i].poly==NULL){
|
||||
fprintf(errfp, "check_symbol_storage(): calloc error\n");tcleval( "exit");
|
||||
}
|
||||
|
||||
xctx.sym[i].arc=my_calloc(396, cadlayers, sizeof(xArc *));
|
||||
if(xctx.sym[i].arc==NULL){
|
||||
xctx->sym[i].arc=my_calloc(396, cadlayers, sizeof(xArc *));
|
||||
if(xctx->sym[i].arc==NULL){
|
||||
fprintf(errfp, "check_symbol_storage(): calloc error\n");tcleval( "exit");
|
||||
}
|
||||
|
||||
xctx.sym[i].line=my_calloc(397, cadlayers, sizeof(xLine *));
|
||||
if(xctx.sym[i].line==NULL){
|
||||
xctx->sym[i].line=my_calloc(397, cadlayers, sizeof(xLine *));
|
||||
if(xctx->sym[i].line==NULL){
|
||||
fprintf(errfp, "check_symbol_storage(): calloc error\n");tcleval( "exit");
|
||||
}
|
||||
|
||||
xctx.sym[i].rect=my_calloc(398, cadlayers, sizeof(xRect *));
|
||||
if(xctx.sym[i].rect==NULL){
|
||||
xctx->sym[i].rect=my_calloc(398, cadlayers, sizeof(xRect *));
|
||||
if(xctx->sym[i].rect==NULL){
|
||||
fprintf(errfp, "check_symbol_storage(): calloc error\n");tcleval( "exit");
|
||||
}
|
||||
|
||||
xctx.sym[i].lines=my_calloc(399, cadlayers, sizeof(int));
|
||||
if(xctx.sym[i].lines==NULL){
|
||||
xctx->sym[i].lines=my_calloc(399, cadlayers, sizeof(int));
|
||||
if(xctx->sym[i].lines==NULL){
|
||||
fprintf(errfp, "check_symbol_storage(): calloc error\n");tcleval( "exit");
|
||||
}
|
||||
|
||||
xctx.sym[i].rects=my_calloc(400, cadlayers, sizeof(int));
|
||||
if(xctx.sym[i].rects==NULL){
|
||||
xctx->sym[i].rects=my_calloc(400, cadlayers, sizeof(int));
|
||||
if(xctx->sym[i].rects==NULL){
|
||||
fprintf(errfp, "check_symbol_storage(): calloc error\n");tcleval( "exit");
|
||||
}
|
||||
xctx.sym[i].polygons=my_calloc(401, cadlayers, sizeof(int));
|
||||
if(xctx.sym[i].polygons==NULL){
|
||||
xctx->sym[i].polygons=my_calloc(401, cadlayers, sizeof(int));
|
||||
if(xctx->sym[i].polygons==NULL){
|
||||
fprintf(errfp, "check_symbol_storage(): calloc error\n");tcleval( "exit");
|
||||
}
|
||||
xctx.sym[i].arcs=my_calloc(66, cadlayers, sizeof(int));
|
||||
if(xctx.sym[i].arcs==NULL){
|
||||
xctx->sym[i].arcs=my_calloc(66, cadlayers, sizeof(int));
|
||||
if(xctx->sym[i].arcs==NULL){
|
||||
fprintf(errfp, "check_symbol_storage(): calloc error\n");tcleval( "exit");
|
||||
}
|
||||
}
|
||||
|
|
@ -104,46 +104,46 @@ void check_symbol_storage(void)
|
|||
|
||||
void check_inst_storage(void)
|
||||
{
|
||||
if(xctx.instances >= xctx.maxi)
|
||||
if(xctx->instances >= xctx->maxi)
|
||||
{
|
||||
xctx.maxi=(1 + xctx.instances / ELEMINST) * ELEMINST;
|
||||
my_realloc(402, &xctx.inst, sizeof(xInstance)*xctx.maxi);
|
||||
xctx->maxi=(1 + xctx->instances / ELEMINST) * ELEMINST;
|
||||
my_realloc(402, &xctx->inst, sizeof(xInstance)*xctx->maxi);
|
||||
}
|
||||
}
|
||||
|
||||
void check_arc_storage(int c)
|
||||
{
|
||||
if(xctx.arcs[c] >= xctx.maxa[c])
|
||||
if(xctx->arcs[c] >= xctx->maxa[c])
|
||||
{
|
||||
xctx.maxa[c]=(1 + xctx.arcs[c] / CADMAXOBJECTS) * CADMAXOBJECTS;
|
||||
my_realloc(403, &xctx.arc[c], sizeof(xArc)*xctx.maxa[c]);
|
||||
xctx->maxa[c]=(1 + xctx->arcs[c] / CADMAXOBJECTS) * CADMAXOBJECTS;
|
||||
my_realloc(403, &xctx->arc[c], sizeof(xArc)*xctx->maxa[c]);
|
||||
}
|
||||
}
|
||||
|
||||
void check_box_storage(int c)
|
||||
{
|
||||
if(xctx.rects[c] >= xctx.maxr[c])
|
||||
if(xctx->rects[c] >= xctx->maxr[c])
|
||||
{
|
||||
xctx.maxr[c]=(1 + xctx.rects[c] / CADMAXOBJECTS) * CADMAXOBJECTS;
|
||||
my_realloc(404, &xctx.rect[c], sizeof(xRect)*xctx.maxr[c]);
|
||||
xctx->maxr[c]=(1 + xctx->rects[c] / CADMAXOBJECTS) * CADMAXOBJECTS;
|
||||
my_realloc(404, &xctx->rect[c], sizeof(xRect)*xctx->maxr[c]);
|
||||
}
|
||||
}
|
||||
|
||||
void check_line_storage(int c)
|
||||
{
|
||||
if(xctx.lines[c] >= xctx.maxl[c])
|
||||
if(xctx->lines[c] >= xctx->maxl[c])
|
||||
{
|
||||
xctx.maxl[c]=(1 + xctx.lines[c] / CADMAXOBJECTS) * CADMAXOBJECTS;
|
||||
my_realloc(405, &xctx.line[c], sizeof(xLine)*xctx.maxl[c]);
|
||||
xctx->maxl[c]=(1 + xctx->lines[c] / CADMAXOBJECTS) * CADMAXOBJECTS;
|
||||
my_realloc(405, &xctx->line[c], sizeof(xLine)*xctx->maxl[c]);
|
||||
}
|
||||
}
|
||||
|
||||
void check_polygon_storage(int c)
|
||||
{
|
||||
if(xctx.polygons[c] >= xctx.maxp[c])
|
||||
if(xctx->polygons[c] >= xctx->maxp[c])
|
||||
{
|
||||
xctx.maxp[c]=(1 + xctx.polygons[c] / CADMAXOBJECTS) * CADMAXOBJECTS;
|
||||
my_realloc(406, &xctx.poly[c], sizeof(xPoly)*xctx.maxp[c]);
|
||||
xctx->maxp[c]=(1 + xctx->polygons[c] / CADMAXOBJECTS) * CADMAXOBJECTS;
|
||||
my_realloc(406, &xctx->poly[c], sizeof(xPoly)*xctx->maxp[c]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -153,35 +153,35 @@ void store_arc(int pos, double x, double y, double r, double a, double b,
|
|||
int n, j;
|
||||
const char *dash;
|
||||
check_arc_storage(rectcolor);
|
||||
if(pos==-1) n=xctx.arcs[rectcolor];
|
||||
if(pos==-1) n=xctx->arcs[rectcolor];
|
||||
else
|
||||
{
|
||||
for(j=xctx.arcs[rectcolor];j>pos;j--)
|
||||
for(j=xctx->arcs[rectcolor];j>pos;j--)
|
||||
{
|
||||
xctx.arc[rectcolor][j]=xctx.arc[rectcolor][j-1];
|
||||
xctx->arc[rectcolor][j]=xctx->arc[rectcolor][j-1];
|
||||
}
|
||||
n=pos;
|
||||
}
|
||||
xctx.arc[rectcolor][n].x = x;
|
||||
xctx.arc[rectcolor][n].y = y;
|
||||
xctx.arc[rectcolor][n].r = r;
|
||||
xctx.arc[rectcolor][n].a = a;
|
||||
xctx.arc[rectcolor][n].b = b;
|
||||
xctx.arc[rectcolor][n].prop_ptr = NULL;
|
||||
my_strdup(407, &xctx.arc[rectcolor][n].prop_ptr, prop_ptr);
|
||||
xctx.arc[rectcolor][n].sel = sel;
|
||||
if( !strcmp(get_tok_value(xctx.arc[rectcolor][n].prop_ptr,"fill",0),"true") )
|
||||
xctx.arc[rectcolor][n].fill =1;
|
||||
xctx->arc[rectcolor][n].x = x;
|
||||
xctx->arc[rectcolor][n].y = y;
|
||||
xctx->arc[rectcolor][n].r = r;
|
||||
xctx->arc[rectcolor][n].a = a;
|
||||
xctx->arc[rectcolor][n].b = b;
|
||||
xctx->arc[rectcolor][n].prop_ptr = NULL;
|
||||
my_strdup(407, &xctx->arc[rectcolor][n].prop_ptr, prop_ptr);
|
||||
xctx->arc[rectcolor][n].sel = sel;
|
||||
if( !strcmp(get_tok_value(xctx->arc[rectcolor][n].prop_ptr,"fill",0),"true") )
|
||||
xctx->arc[rectcolor][n].fill =1;
|
||||
else
|
||||
xctx.arc[rectcolor][n].fill =0;
|
||||
dash = get_tok_value(xctx.arc[rectcolor][n].prop_ptr,"dash",0);
|
||||
xctx->arc[rectcolor][n].fill =0;
|
||||
dash = get_tok_value(xctx->arc[rectcolor][n].prop_ptr,"dash",0);
|
||||
if( strcmp(dash, "") ) {
|
||||
int d = atoi(dash);
|
||||
xctx.arc[rectcolor][n].dash = d >= 0 ? d : 0;
|
||||
xctx->arc[rectcolor][n].dash = d >= 0 ? d : 0;
|
||||
} else
|
||||
xctx.arc[rectcolor][n].dash = 0;
|
||||
xctx->arc[rectcolor][n].dash = 0;
|
||||
|
||||
xctx.arcs[rectcolor]++;
|
||||
xctx->arcs[rectcolor]++;
|
||||
set_modify(1);
|
||||
}
|
||||
|
||||
|
|
@ -190,46 +190,46 @@ void store_poly(int pos, double *x, double *y, int points, unsigned int rectcolo
|
|||
int n, j;
|
||||
const char *dash;
|
||||
check_polygon_storage(rectcolor);
|
||||
if(pos==-1) n=xctx.polygons[rectcolor];
|
||||
if(pos==-1) n=xctx->polygons[rectcolor];
|
||||
else
|
||||
{
|
||||
for(j=xctx.polygons[rectcolor];j>pos;j--)
|
||||
for(j=xctx->polygons[rectcolor];j>pos;j--)
|
||||
{
|
||||
xctx.poly[rectcolor][j]=xctx.poly[rectcolor][j-1];
|
||||
xctx->poly[rectcolor][j]=xctx->poly[rectcolor][j-1];
|
||||
}
|
||||
n=pos;
|
||||
}
|
||||
dbg(2, "store_poly(): storing POLYGON %d\n",n);
|
||||
|
||||
xctx.poly[rectcolor][n].x=NULL;
|
||||
xctx.poly[rectcolor][n].y=NULL;
|
||||
xctx.poly[rectcolor][n].selected_point=NULL;
|
||||
xctx.poly[rectcolor][n].prop_ptr=NULL;
|
||||
xctx.poly[rectcolor][n].x= my_calloc(408, points, sizeof(double));
|
||||
xctx.poly[rectcolor][n].y= my_calloc(409, points, sizeof(double));
|
||||
xctx.poly[rectcolor][n].selected_point= my_calloc(410, points, sizeof(unsigned short));
|
||||
my_strdup(411, &xctx.poly[rectcolor][n].prop_ptr, prop_ptr);
|
||||
xctx->poly[rectcolor][n].x=NULL;
|
||||
xctx->poly[rectcolor][n].y=NULL;
|
||||
xctx->poly[rectcolor][n].selected_point=NULL;
|
||||
xctx->poly[rectcolor][n].prop_ptr=NULL;
|
||||
xctx->poly[rectcolor][n].x= my_calloc(408, points, sizeof(double));
|
||||
xctx->poly[rectcolor][n].y= my_calloc(409, points, sizeof(double));
|
||||
xctx->poly[rectcolor][n].selected_point= my_calloc(410, points, sizeof(unsigned short));
|
||||
my_strdup(411, &xctx->poly[rectcolor][n].prop_ptr, prop_ptr);
|
||||
for(j=0;j<points; j++) {
|
||||
xctx.poly[rectcolor][n].x[j] = x[j];
|
||||
xctx.poly[rectcolor][n].y[j] = y[j];
|
||||
xctx->poly[rectcolor][n].x[j] = x[j];
|
||||
xctx->poly[rectcolor][n].y[j] = y[j];
|
||||
}
|
||||
xctx.poly[rectcolor][n].points = points;
|
||||
xctx.poly[rectcolor][n].sel = sel;
|
||||
xctx->poly[rectcolor][n].points = points;
|
||||
xctx->poly[rectcolor][n].sel = sel;
|
||||
|
||||
|
||||
if( !strcmp(get_tok_value(xctx.poly[rectcolor][n].prop_ptr,"fill",0),"true") )
|
||||
xctx.poly[rectcolor][n].fill =1;
|
||||
if( !strcmp(get_tok_value(xctx->poly[rectcolor][n].prop_ptr,"fill",0),"true") )
|
||||
xctx->poly[rectcolor][n].fill =1;
|
||||
else
|
||||
xctx.poly[rectcolor][n].fill =0;
|
||||
dash = get_tok_value(xctx.poly[rectcolor][n].prop_ptr,"dash",0);
|
||||
xctx->poly[rectcolor][n].fill =0;
|
||||
dash = get_tok_value(xctx->poly[rectcolor][n].prop_ptr,"dash",0);
|
||||
if( strcmp(dash, "") ) {
|
||||
int d = atoi(dash);
|
||||
xctx.poly[rectcolor][n].dash = d >= 0 ? d : 0;
|
||||
xctx->poly[rectcolor][n].dash = d >= 0 ? d : 0;
|
||||
} else
|
||||
xctx.poly[rectcolor][n].dash = 0;
|
||||
xctx->poly[rectcolor][n].dash = 0;
|
||||
|
||||
|
||||
xctx.polygons[rectcolor]++;
|
||||
xctx->polygons[rectcolor]++;
|
||||
set_modify(1);
|
||||
}
|
||||
|
||||
|
|
@ -243,92 +243,92 @@ void storeobject(int pos, double x1,double y1,double x2,double y2,
|
|||
{
|
||||
check_line_storage(rectcolor);
|
||||
|
||||
if(pos==-1) n=xctx.lines[rectcolor];
|
||||
if(pos==-1) n=xctx->lines[rectcolor];
|
||||
else
|
||||
{
|
||||
for(j=xctx.lines[rectcolor];j>pos;j--)
|
||||
for(j=xctx->lines[rectcolor];j>pos;j--)
|
||||
{
|
||||
xctx.line[rectcolor][j]=xctx.line[rectcolor][j-1];
|
||||
xctx->line[rectcolor][j]=xctx->line[rectcolor][j-1];
|
||||
}
|
||||
n=pos;
|
||||
}
|
||||
dbg(2, "storeobject(): storing LINE %d\n",n);
|
||||
xctx.line[rectcolor][n].x1=x1;
|
||||
xctx.line[rectcolor][n].x2=x2;
|
||||
xctx.line[rectcolor][n].y1=y1;
|
||||
xctx.line[rectcolor][n].y2=y2;
|
||||
xctx.line[rectcolor][n].prop_ptr=NULL;
|
||||
my_strdup(412, &xctx.line[rectcolor][n].prop_ptr, prop_ptr);
|
||||
xctx.line[rectcolor][n].sel=sel;
|
||||
if( !strcmp(get_tok_value(xctx.line[rectcolor][n].prop_ptr, "bus", 0), "true") )
|
||||
xctx.line[rectcolor][n].bus = 1;
|
||||
xctx->line[rectcolor][n].x1=x1;
|
||||
xctx->line[rectcolor][n].x2=x2;
|
||||
xctx->line[rectcolor][n].y1=y1;
|
||||
xctx->line[rectcolor][n].y2=y2;
|
||||
xctx->line[rectcolor][n].prop_ptr=NULL;
|
||||
my_strdup(412, &xctx->line[rectcolor][n].prop_ptr, prop_ptr);
|
||||
xctx->line[rectcolor][n].sel=sel;
|
||||
if( !strcmp(get_tok_value(xctx->line[rectcolor][n].prop_ptr, "bus", 0), "true") )
|
||||
xctx->line[rectcolor][n].bus = 1;
|
||||
else
|
||||
xctx.line[rectcolor][n].bus = 0;
|
||||
dash = get_tok_value(xctx.line[rectcolor][n].prop_ptr,"dash",0);
|
||||
xctx->line[rectcolor][n].bus = 0;
|
||||
dash = get_tok_value(xctx->line[rectcolor][n].prop_ptr,"dash",0);
|
||||
if( strcmp(dash, "") ) {
|
||||
int d = atoi(dash);
|
||||
xctx.line[rectcolor][n].dash = d >= 0 ? d : 0;
|
||||
xctx->line[rectcolor][n].dash = d >= 0 ? d : 0;
|
||||
} else
|
||||
xctx.line[rectcolor][n].dash = 0;
|
||||
xctx.lines[rectcolor]++;
|
||||
xctx->line[rectcolor][n].dash = 0;
|
||||
xctx->lines[rectcolor]++;
|
||||
set_modify(1);
|
||||
}
|
||||
if(type == xRECT)
|
||||
{
|
||||
check_box_storage(rectcolor);
|
||||
if(pos==-1) n=xctx.rects[rectcolor];
|
||||
if(pos==-1) n=xctx->rects[rectcolor];
|
||||
else
|
||||
{
|
||||
for(j=xctx.rects[rectcolor];j>pos;j--)
|
||||
for(j=xctx->rects[rectcolor];j>pos;j--)
|
||||
{
|
||||
xctx.rect[rectcolor][j]=xctx.rect[rectcolor][j-1];
|
||||
xctx->rect[rectcolor][j]=xctx->rect[rectcolor][j-1];
|
||||
}
|
||||
n=pos;
|
||||
}
|
||||
dbg(2, "storeobject(): storing RECT %d\n",n);
|
||||
xctx.rect[rectcolor][n].x1=x1;
|
||||
xctx.rect[rectcolor][n].x2=x2;
|
||||
xctx.rect[rectcolor][n].y1=y1;
|
||||
xctx.rect[rectcolor][n].y2=y2;
|
||||
xctx.rect[rectcolor][n].prop_ptr=NULL;
|
||||
my_strdup(413, &xctx.rect[rectcolor][n].prop_ptr, prop_ptr);
|
||||
xctx.rect[rectcolor][n].sel=sel;
|
||||
dash = get_tok_value(xctx.rect[rectcolor][n].prop_ptr,"dash",0);
|
||||
xctx->rect[rectcolor][n].x1=x1;
|
||||
xctx->rect[rectcolor][n].x2=x2;
|
||||
xctx->rect[rectcolor][n].y1=y1;
|
||||
xctx->rect[rectcolor][n].y2=y2;
|
||||
xctx->rect[rectcolor][n].prop_ptr=NULL;
|
||||
my_strdup(413, &xctx->rect[rectcolor][n].prop_ptr, prop_ptr);
|
||||
xctx->rect[rectcolor][n].sel=sel;
|
||||
dash = get_tok_value(xctx->rect[rectcolor][n].prop_ptr,"dash",0);
|
||||
if( strcmp(dash, "") ) {
|
||||
int d = atoi(dash);
|
||||
xctx.rect[rectcolor][n].dash = d >= 0 ? d : 0;
|
||||
xctx->rect[rectcolor][n].dash = d >= 0 ? d : 0;
|
||||
} else
|
||||
xctx.rect[rectcolor][n].dash = 0;
|
||||
xctx.rects[rectcolor]++;
|
||||
xctx->rect[rectcolor][n].dash = 0;
|
||||
xctx->rects[rectcolor]++;
|
||||
set_modify(1);
|
||||
}
|
||||
if(type == WIRE)
|
||||
{
|
||||
check_wire_storage();
|
||||
if(pos==-1) n=xctx.wires;
|
||||
if(pos==-1) n=xctx->wires;
|
||||
else
|
||||
{
|
||||
for(j=xctx.wires;j>pos;j--)
|
||||
for(j=xctx->wires;j>pos;j--)
|
||||
{
|
||||
xctx.wire[j]=xctx.wire[j-1];
|
||||
xctx->wire[j]=xctx->wire[j-1];
|
||||
}
|
||||
n=pos;
|
||||
}
|
||||
dbg(2, "storeobject(): storing WIRE %d\n",n);
|
||||
xctx.wire[n].x1=x1;
|
||||
xctx.wire[n].y1=y1;
|
||||
xctx.wire[n].x2=x2;
|
||||
xctx.wire[n].y2=y2;
|
||||
xctx.wire[n].prop_ptr=NULL;
|
||||
xctx.wire[n].node=NULL;
|
||||
xctx.wire[n].end1=0;
|
||||
xctx.wire[n].end2=0;
|
||||
my_strdup(414, &xctx.wire[n].prop_ptr, prop_ptr);
|
||||
if(!strcmp(get_tok_value(xctx.wire[n].prop_ptr,"bus",0), "true")) xctx.wire[n].bus=1;
|
||||
else xctx.wire[n].bus=0;
|
||||
xctx->wire[n].x1=x1;
|
||||
xctx->wire[n].y1=y1;
|
||||
xctx->wire[n].x2=x2;
|
||||
xctx->wire[n].y2=y2;
|
||||
xctx->wire[n].prop_ptr=NULL;
|
||||
xctx->wire[n].node=NULL;
|
||||
xctx->wire[n].end1=0;
|
||||
xctx->wire[n].end2=0;
|
||||
my_strdup(414, &xctx->wire[n].prop_ptr, prop_ptr);
|
||||
if(!strcmp(get_tok_value(xctx->wire[n].prop_ptr,"bus",0), "true")) xctx->wire[n].bus=1;
|
||||
else xctx->wire[n].bus=0;
|
||||
|
||||
xctx.wire[n].sel=sel;
|
||||
xctx.wires++;
|
||||
xctx->wire[n].sel=sel;
|
||||
xctx->wires++;
|
||||
set_modify(1);
|
||||
}
|
||||
}
|
||||
|
|
@ -336,14 +336,14 @@ void storeobject(int pos, double x1,double y1,double x2,double y2,
|
|||
void freenet_nocheck(int i)
|
||||
{
|
||||
int j;
|
||||
my_free(959, &xctx.wire[i].prop_ptr);
|
||||
my_free(960, &xctx.wire[i].node);
|
||||
for(j=i+1;j<xctx.wires;j++)
|
||||
my_free(959, &xctx->wire[i].prop_ptr);
|
||||
my_free(960, &xctx->wire[i].node);
|
||||
for(j=i+1;j<xctx->wires;j++)
|
||||
{
|
||||
xctx.wire[j-1] = xctx.wire[j];
|
||||
xctx.wire[j].prop_ptr=NULL;
|
||||
xctx.wire[j].node=NULL;
|
||||
xctx->wire[j-1] = xctx->wire[j];
|
||||
xctx->wire[j].prop_ptr=NULL;
|
||||
xctx->wire[j].node=NULL;
|
||||
} /*end for j */
|
||||
xctx.wires--;
|
||||
xctx->wires--;
|
||||
}
|
||||
|
||||
|
|
|
|||
132
src/svgdraw.c
132
src/svgdraw.c
|
|
@ -21,8 +21,8 @@
|
|||
*/
|
||||
|
||||
#include "xschem.h"
|
||||
#define X_TO_SVG(x) ( (x+xctx.xorigin)* xctx.mooz )
|
||||
#define Y_TO_SVG(y) ( (y+xctx.yorigin)* xctx.mooz )
|
||||
#define X_TO_SVG(x) ( (x+xctx->xorigin)* xctx->mooz )
|
||||
#define Y_TO_SVG(y) ( (y+xctx->yorigin)* xctx->mooz )
|
||||
|
||||
static FILE *fd;
|
||||
|
||||
|
|
@ -66,7 +66,7 @@ static void set_svg_colors(unsigned int pixel)
|
|||
static void svg_xdrawline(int layer, double x1, double y1, double x2, double y2, int dash)
|
||||
{
|
||||
fprintf(fd,"<path class=\"l%d\" ", layer);
|
||||
if(dash) fprintf(fd, "stroke-dasharray=\"%g,%g\" ", 1.4*dash/xctx.zoom, 1.4*dash/xctx.zoom);
|
||||
if(dash) fprintf(fd, "stroke-dasharray=\"%g,%g\" ", 1.4*dash/xctx->zoom, 1.4*dash/xctx->zoom);
|
||||
fprintf(fd,"d=\"M%g %gL%g %g\"/>\n", x1, y1, x2, y2);
|
||||
}
|
||||
|
||||
|
|
@ -79,7 +79,7 @@ static void svg_xdrawpoint(int layer, double x1, double y1)
|
|||
static void svg_xfillrectangle(int layer, double x1, double y1, double x2, double y2, int dash)
|
||||
{
|
||||
fprintf(fd,"<path class=\"l%d\" ", layer);
|
||||
if(dash) fprintf(fd, "stroke-dasharray=\"%g,%g\" ", 1.4*dash/xctx.zoom, 1.4*dash/xctx.zoom);
|
||||
if(dash) fprintf(fd, "stroke-dasharray=\"%g,%g\" ", 1.4*dash/xctx->zoom, 1.4*dash/xctx->zoom);
|
||||
fprintf(fd,"d=\"M%g %gL%g %gL%g %gL%g %gL%g %gz\"/>\n", x1, y1, x2, y1, x2, y2, x1, y2, x1, y1);
|
||||
}
|
||||
|
||||
|
|
@ -97,7 +97,7 @@ static void svg_drawpolygon(int c, int what, double *x, double *y, int points, i
|
|||
return;
|
||||
}
|
||||
fprintf(fd, "<path class=\"l%d\" ", c);
|
||||
if(dash) fprintf(fd, "stroke-dasharray=\"%g,%g\" ", 1.4*dash/xctx.zoom, 1.4*dash/xctx.zoom);
|
||||
if(dash) fprintf(fd, "stroke-dasharray=\"%g,%g\" ", 1.4*dash/xctx->zoom, 1.4*dash/xctx->zoom);
|
||||
if(fill) {
|
||||
fprintf(fd,"style=\"fill:#%02x%02x%02x;\" d=\"", svg_stroke.red, svg_stroke.green, svg_stroke.blue);
|
||||
} else {
|
||||
|
|
@ -134,7 +134,7 @@ static void svg_drawcircle(int gc, int fillarc, double x,double y,double r,doubl
|
|||
|
||||
xx=X_TO_SVG(x);
|
||||
yy=Y_TO_SVG(y);
|
||||
rr=r*xctx.mooz;
|
||||
rr=r*xctx->mooz;
|
||||
arc_bbox(x, y, r, a, b, &x1,&y1,&x2,&y2);
|
||||
x1=X_TO_SVG(x1);
|
||||
y1=Y_TO_SVG(y1);
|
||||
|
|
@ -159,7 +159,7 @@ static void svg_drawarc(int gc, int fillarc, double x,double y,double r,double a
|
|||
|
||||
xx=X_TO_SVG(x);
|
||||
yy=Y_TO_SVG(y);
|
||||
rr=r*xctx.mooz;
|
||||
rr=r*xctx->mooz;
|
||||
arc_bbox(x, y, r, a, b, &x1,&y1,&x2,&y2);
|
||||
x1=X_TO_SVG(x1);
|
||||
y1=Y_TO_SVG(y1);
|
||||
|
|
@ -170,7 +170,7 @@ static void svg_drawarc(int gc, int fillarc, double x,double y,double r,double a
|
|||
{
|
||||
if(b == 360.) {
|
||||
fprintf(fd, "<circle cx=\"%g\" cy=\"%g\" r=\"%g\" ", xx, yy, rr);
|
||||
if(dash) fprintf(fd, "stroke-dasharray=\"%g,%g\" ", 1.4*dash/xctx.zoom, 1.4*dash/xctx.zoom);
|
||||
if(dash) fprintf(fd, "stroke-dasharray=\"%g,%g\" ", 1.4*dash/xctx->zoom, 1.4*dash/xctx->zoom);
|
||||
if(fillarc)
|
||||
fprintf(fd,
|
||||
"fill=\"rgb(%d,%d,%d)\" stroke=\"rgb(%d,%d,%d)\" stroke-width=\"%g\"/>\n",
|
||||
|
|
@ -188,7 +188,7 @@ static void svg_drawarc(int gc, int fillarc, double x,double y,double r,double a
|
|||
fs = b > 0 ? 0 : 1;
|
||||
|
||||
fprintf(fd,"<path class=\"l%d\" ", gc);
|
||||
if(dash) fprintf(fd, "stroke-dasharray=\"%g,%g\" ", 1.4*dash/xctx.zoom, 1.4*dash/xctx.zoom);
|
||||
if(dash) fprintf(fd, "stroke-dasharray=\"%g,%g\" ", 1.4*dash/xctx->zoom, 1.4*dash/xctx->zoom);
|
||||
if(fillarc)
|
||||
fprintf(fd,"style=\"fill:%02x%02x%02x;\" d=\"", svg_stroke.red, svg_stroke.green, svg_stroke.blue);
|
||||
else
|
||||
|
|
@ -268,9 +268,9 @@ static void svg_drawgrid()
|
|||
double x,y;
|
||||
double delta,tmp;
|
||||
if(!draw_grid) return;
|
||||
delta=cadgrid* xctx.mooz;
|
||||
delta=cadgrid* xctx->mooz;
|
||||
while(delta<CADGRIDTHRESHOLD) delta*=CADGRIDMULTIPLY; /* <-- to be improved,but works */
|
||||
x = xctx.xorigin* xctx.mooz;y = xctx.yorigin* xctx.mooz;
|
||||
x = xctx->xorigin* xctx->mooz;y = xctx->yorigin* xctx->mooz;
|
||||
set_svg_colors(GRIDLAYER);
|
||||
if(y>areay1 && y<areay2)
|
||||
{
|
||||
|
|
@ -281,8 +281,8 @@ static void svg_drawgrid()
|
|||
svg_xdrawline(GRIDLAYER,(int)x,areay1+1, (int)x, areay2-1, 0);
|
||||
}
|
||||
set_svg_colors(GRIDLAYER);
|
||||
tmp = floor((areay1+1)/delta)*delta-fmod(-xctx.yorigin* xctx.mooz,delta);
|
||||
for(x=floor((areax1+1)/delta)*delta-fmod(-xctx.xorigin* xctx.mooz,delta);x<areax2;x+=delta)
|
||||
tmp = floor((areay1+1)/delta)*delta-fmod(-xctx->yorigin* xctx->mooz,delta);
|
||||
for(x=floor((areax1+1)/delta)*delta-fmod(-xctx->xorigin* xctx->mooz,delta);x<areax2;x+=delta)
|
||||
{
|
||||
for(y=tmp;y<areay2;y+=delta)
|
||||
{
|
||||
|
|
@ -306,48 +306,48 @@ static void svg_draw_symbol(int n,int layer,int tmp_flip, int rot,
|
|||
xArc arc;
|
||||
xPoly polygon;
|
||||
|
||||
if(xctx.inst[n].ptr == -1) return;
|
||||
if(xctx->inst[n].ptr == -1) return;
|
||||
if( (layer != PINLAYER && !enable_layer[layer]) ) return;
|
||||
if(layer==0)
|
||||
{
|
||||
x1=X_TO_SVG(xctx.inst[n].x1);
|
||||
x2=X_TO_SVG(xctx.inst[n].x2);
|
||||
y1=Y_TO_SVG(xctx.inst[n].y1);
|
||||
y2=Y_TO_SVG(xctx.inst[n].y2);
|
||||
x1=X_TO_SVG(xctx->inst[n].x1);
|
||||
x2=X_TO_SVG(xctx->inst[n].x2);
|
||||
y1=Y_TO_SVG(xctx->inst[n].y1);
|
||||
y2=Y_TO_SVG(xctx->inst[n].y2);
|
||||
if(OUTSIDE(x1,y1,x2,y2,areax1,areay1,areax2,areay2))
|
||||
{
|
||||
xctx.inst[n].flags|=1;
|
||||
xctx->inst[n].flags|=1;
|
||||
return;
|
||||
}
|
||||
else xctx.inst[n].flags&=~1;
|
||||
else xctx->inst[n].flags&=~1;
|
||||
|
||||
/* following code handles different text color for labels/pins 06112002 */
|
||||
|
||||
}
|
||||
else if(xctx.inst[n].flags&1)
|
||||
else if(xctx->inst[n].flags&1)
|
||||
{
|
||||
dbg(1, "draw_symbol(): skippinginst %d\n", n);
|
||||
return;
|
||||
}
|
||||
|
||||
flip = xctx.inst[n].flip;
|
||||
flip = xctx->inst[n].flip;
|
||||
if(tmp_flip) flip = !flip;
|
||||
rot = (xctx.inst[n].rot + rot ) & 0x3;
|
||||
rot = (xctx->inst[n].rot + rot ) & 0x3;
|
||||
|
||||
x0=xctx.inst[n].x0 + xoffset;
|
||||
y0=xctx.inst[n].y0 + yoffset;
|
||||
for(j=0;j< (xctx.inst[n].ptr+ xctx.sym)->lines[layer];j++)
|
||||
x0=xctx->inst[n].x0 + xoffset;
|
||||
y0=xctx->inst[n].y0 + yoffset;
|
||||
for(j=0;j< (xctx->inst[n].ptr+ xctx->sym)->lines[layer];j++)
|
||||
{
|
||||
line = ((xctx.inst[n].ptr+ xctx.sym)->line[layer])[j];
|
||||
line = ((xctx->inst[n].ptr+ xctx->sym)->line[layer])[j];
|
||||
ROTATION(0.0,0.0,line.x1,line.y1,x1,y1);
|
||||
ROTATION(0.0,0.0,line.x2,line.y2,x2,y2);
|
||||
ORDER(x1,y1,x2,y2);
|
||||
svg_drawline(layer, x0+x1, y0+y1, x0+x2, y0+y2, line.dash);
|
||||
}
|
||||
|
||||
for(j=0;j< (xctx.inst[n].ptr+ xctx.sym)->polygons[layer];j++)
|
||||
for(j=0;j< (xctx->inst[n].ptr+ xctx->sym)->polygons[layer];j++)
|
||||
{
|
||||
polygon = ((xctx.inst[n].ptr+ xctx.sym)->poly[layer])[j];
|
||||
polygon = ((xctx->inst[n].ptr+ xctx->sym)->poly[layer])[j];
|
||||
{ /* scope block so we declare some auxiliary arrays for coord transforms. 20171115 */
|
||||
int k;
|
||||
double *x = my_malloc(417, sizeof(double) * polygon.points);
|
||||
|
|
@ -362,10 +362,10 @@ static void svg_draw_symbol(int n,int layer,int tmp_flip, int rot,
|
|||
my_free(962, &y);
|
||||
}
|
||||
}
|
||||
for(j=0;j< (xctx.inst[n].ptr+ xctx.sym)->arcs[layer];j++)
|
||||
for(j=0;j< (xctx->inst[n].ptr+ xctx->sym)->arcs[layer];j++)
|
||||
{
|
||||
double angle;
|
||||
arc = ((xctx.inst[n].ptr+ xctx.sym)->arc[layer])[j];
|
||||
arc = ((xctx->inst[n].ptr+ xctx->sym)->arc[layer])[j];
|
||||
if(flip) {
|
||||
angle = 270.*rot+180.-arc.b-arc.a;
|
||||
} else {
|
||||
|
|
@ -377,30 +377,30 @@ static void svg_draw_symbol(int n,int layer,int tmp_flip, int rot,
|
|||
svg_drawarc(layer, arc.fill, x0+x1, y0+y1, arc.r, angle, arc.b, arc.dash);
|
||||
}
|
||||
|
||||
if( (layer != PINLAYER || enable_layer[layer]) ) for(j=0;j< (xctx.inst[n].ptr+ xctx.sym)->rects[layer];j++)
|
||||
if( (layer != PINLAYER || enable_layer[layer]) ) for(j=0;j< (xctx->inst[n].ptr+ xctx->sym)->rects[layer];j++)
|
||||
{
|
||||
box = ((xctx.inst[n].ptr+ xctx.sym)->rect[layer])[j];
|
||||
box = ((xctx->inst[n].ptr+ xctx->sym)->rect[layer])[j];
|
||||
ROTATION(0.0,0.0,box.x1,box.y1,x1,y1);
|
||||
ROTATION(0.0,0.0,box.x2,box.y2,x2,y2);
|
||||
RECTORDER(x1,y1,x2,y2);
|
||||
svg_filledrect(layer, x0+x1, y0+y1, x0+x2, y0+y2, box.dash);
|
||||
}
|
||||
if( (layer==TEXTWIRELAYER && !(xctx.inst[n].flags&2) ) ||
|
||||
(sym_txt && (layer==TEXTLAYER) && (xctx.inst[n].flags&2) ) )
|
||||
if( (layer==TEXTWIRELAYER && !(xctx->inst[n].flags&2) ) ||
|
||||
(sym_txt && (layer==TEXTLAYER) && (xctx->inst[n].flags&2) ) )
|
||||
{
|
||||
const char *txtptr;
|
||||
for(j=0;j< (xctx.inst[n].ptr+ xctx.sym)->texts;j++)
|
||||
for(j=0;j< (xctx->inst[n].ptr+ xctx->sym)->texts;j++)
|
||||
{
|
||||
text = (xctx.inst[n].ptr+ xctx.sym)->text[j];
|
||||
/* if(text.xscale*FONTWIDTH* xctx.mooz<1) continue; */
|
||||
text = (xctx->inst[n].ptr+ xctx->sym)->text[j];
|
||||
/* if(text.xscale*FONTWIDTH* xctx->mooz<1) continue; */
|
||||
txtptr= translate(n, text.txt_ptr);
|
||||
ROTATION(0.0,0.0,text.x0,text.y0,x1,y1);
|
||||
textlayer = layer;
|
||||
if( !(layer == PINLAYER && (xctx.inst[n].flags & 4))) {
|
||||
textlayer = (xctx.inst[n].ptr+ xctx.sym)->text[j].layer;
|
||||
if( !(layer == PINLAYER && (xctx->inst[n].flags & 4))) {
|
||||
textlayer = (xctx->inst[n].ptr+ xctx->sym)->text[j].layer;
|
||||
if(textlayer < 0 || textlayer >= cadlayers) textlayer = layer;
|
||||
}
|
||||
if((layer == PINLAYER && xctx.inst[n].flags & 4) || enable_layer[textlayer]) {
|
||||
if((layer == PINLAYER && xctx->inst[n].flags & 4) || enable_layer[textlayer]) {
|
||||
svg_draw_string(textlayer, txtptr,
|
||||
(text.rot + ( (flip && (text.rot & 1) ) ? rot+2 : rot) ) & 0x3,
|
||||
flip^text.flip, text.hcenter, text.vcenter,
|
||||
|
|
@ -528,46 +528,46 @@ void svg_draw(void)
|
|||
}
|
||||
svg_drawgrid();
|
||||
set_svg_colors(TEXTLAYER);
|
||||
for(i=0;i<xctx.texts;i++)
|
||||
for(i=0;i<xctx->texts;i++)
|
||||
{
|
||||
textlayer = xctx.text[i].layer;
|
||||
textlayer = xctx->text[i].layer;
|
||||
if(textlayer < 0 || textlayer >= cadlayers) textlayer = TEXTLAYER;
|
||||
svg_draw_string(textlayer, xctx.text[i].txt_ptr,
|
||||
xctx.text[i].rot, xctx.text[i].flip, xctx.text[i].hcenter, xctx.text[i].vcenter,
|
||||
xctx.text[i].x0,xctx.text[i].y0,
|
||||
xctx.text[i].xscale, xctx.text[i].yscale);
|
||||
svg_draw_string(textlayer, xctx->text[i].txt_ptr,
|
||||
xctx->text[i].rot, xctx->text[i].flip, xctx->text[i].hcenter, xctx->text[i].vcenter,
|
||||
xctx->text[i].x0,xctx->text[i].y0,
|
||||
xctx->text[i].xscale, xctx->text[i].yscale);
|
||||
}
|
||||
|
||||
for(c=0;c<cadlayers;c++)
|
||||
{
|
||||
set_svg_colors(c);
|
||||
for(i=0;i<xctx.lines[c];i++)
|
||||
svg_drawline(c, xctx.line[c][i].x1, xctx.line[c][i].y1,
|
||||
xctx.line[c][i].x2, xctx.line[c][i].y2, xctx.line[c][i].dash);
|
||||
for(i=0;i<xctx.rects[c];i++)
|
||||
for(i=0;i<xctx->lines[c];i++)
|
||||
svg_drawline(c, xctx->line[c][i].x1, xctx->line[c][i].y1,
|
||||
xctx->line[c][i].x2, xctx->line[c][i].y2, xctx->line[c][i].dash);
|
||||
for(i=0;i<xctx->rects[c];i++)
|
||||
{
|
||||
svg_filledrect(c, xctx.rect[c][i].x1, xctx.rect[c][i].y1,
|
||||
xctx.rect[c][i].x2, xctx.rect[c][i].y2, xctx.rect[c][i].dash);
|
||||
svg_filledrect(c, xctx->rect[c][i].x1, xctx->rect[c][i].y1,
|
||||
xctx->rect[c][i].x2, xctx->rect[c][i].y2, xctx->rect[c][i].dash);
|
||||
}
|
||||
for(i=0;i<xctx.arcs[c];i++)
|
||||
for(i=0;i<xctx->arcs[c];i++)
|
||||
{
|
||||
svg_drawarc(c, xctx.arc[c][i].fill, xctx.arc[c][i].x, xctx.arc[c][i].y, xctx.arc[c][i].r,
|
||||
xctx.arc[c][i].a, xctx.arc[c][i].b, xctx.arc[c][i].dash);
|
||||
svg_drawarc(c, xctx->arc[c][i].fill, xctx->arc[c][i].x, xctx->arc[c][i].y, xctx->arc[c][i].r,
|
||||
xctx->arc[c][i].a, xctx->arc[c][i].b, xctx->arc[c][i].dash);
|
||||
}
|
||||
for(i=0;i<xctx.polygons[c];i++) {
|
||||
svg_drawpolygon(c, NOW, xctx.poly[c][i].x, xctx.poly[c][i].y, xctx.poly[c][i].points,
|
||||
xctx.poly[c][i].fill, xctx.poly[c][i].dash);
|
||||
for(i=0;i<xctx->polygons[c];i++) {
|
||||
svg_drawpolygon(c, NOW, xctx->poly[c][i].x, xctx->poly[c][i].y, xctx->poly[c][i].points,
|
||||
xctx->poly[c][i].fill, xctx->poly[c][i].dash);
|
||||
}
|
||||
for(i=0;i<xctx.instances;i++) {
|
||||
for(i=0;i<xctx->instances;i++) {
|
||||
svg_draw_symbol(i,c,0,0,0.0,0.0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
set_svg_colors(WIRELAYER);
|
||||
for(i=0;i<xctx.wires;i++)
|
||||
for(i=0;i<xctx->wires;i++)
|
||||
{
|
||||
svg_drawline(WIRELAYER, xctx.wire[i].x1,xctx.wire[i].y1,xctx.wire[i].x2,xctx.wire[i].y2, 0);
|
||||
svg_drawline(WIRELAYER, xctx->wire[i].x1,xctx->wire[i].y1,xctx->wire[i].x2,xctx->wire[i].y2, 0);
|
||||
}
|
||||
{
|
||||
double x1, y1, x2, y2;
|
||||
|
|
@ -581,11 +581,11 @@ void svg_draw(void)
|
|||
y2 = Y_TO_XSCHEM(areay2);
|
||||
for(init_wire_iterator(x1, y1, x2, y2); ( wireptr = wire_iterator_next() ) ;) {
|
||||
i = wireptr->n;
|
||||
if( xctx.wire[i].end1 >1 ) { /* 20150331 draw_dots */
|
||||
svg_drawcircle(WIRELAYER, 1, xctx.wire[i].x1, xctx.wire[i].y1, cadhalfdotsize, 0, 360);
|
||||
if( xctx->wire[i].end1 >1 ) { /* 20150331 draw_dots */
|
||||
svg_drawcircle(WIRELAYER, 1, xctx->wire[i].x1, xctx->wire[i].y1, cadhalfdotsize, 0, 360);
|
||||
}
|
||||
if( xctx.wire[i].end2 >1 ) { /* 20150331 draw_dots */
|
||||
svg_drawcircle(WIRELAYER, 1, xctx.wire[i].x2, xctx.wire[i].y2, cadhalfdotsize, 0, 360);
|
||||
if( xctx->wire[i].end2 >1 ) { /* 20150331 draw_dots */
|
||||
svg_drawcircle(WIRELAYER, 1, xctx->wire[i].x2, xctx->wire[i].y2, cadhalfdotsize, 0, 360);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,20 +32,20 @@ void global_tedax_netlist(int global) /* netlister driver */
|
|||
char cellname[PATH_MAX]; /* 20081211 overflow safe 20161122 */
|
||||
|
||||
if(modified) {
|
||||
save_ok = save_schematic(xctx.sch[xctx.currsch]);
|
||||
save_ok = save_schematic(xctx->sch[xctx->currsch]);
|
||||
if(save_ok == -1) return;
|
||||
}
|
||||
statusmsg("",2); /* clear infowindow */
|
||||
record_global_node(2, NULL, NULL); /* delete list of global nodes */
|
||||
netlist_count=0;
|
||||
|
||||
my_snprintf(netl_filename, S(netl_filename), "%s/.%s_%d", netlist_dir, skip_dir(xctx.sch[xctx.currsch]), getpid());
|
||||
my_snprintf(netl_filename, S(netl_filename), "%s/.%s_%d", netlist_dir, skip_dir(xctx->sch[xctx->currsch]), getpid());
|
||||
fd=fopen(netl_filename, "w");
|
||||
|
||||
if(user_top_netl_name[0]) {
|
||||
my_snprintf(cellname, S(cellname), "%s", get_cell(user_top_netl_name, 0));
|
||||
} else {
|
||||
my_snprintf(cellname, S(cellname), "%s.tdx", skip_dir(xctx.sch[xctx.currsch]));
|
||||
my_snprintf(cellname, S(cellname), "%s.tdx", skip_dir(xctx->sch[xctx->currsch]));
|
||||
}
|
||||
|
||||
if(fd==NULL){
|
||||
|
|
@ -53,53 +53,53 @@ void global_tedax_netlist(int global) /* netlister driver */
|
|||
return;
|
||||
}
|
||||
dbg(1, "global_tedax_netlist(): opening %s for writing\n",netl_filename);
|
||||
fprintf(fd,"tEDAx v1\nbegin netlist v1 %s\n", skip_dir( xctx.sch[xctx.currsch]) );
|
||||
fprintf(fd,"tEDAx v1\nbegin netlist v1 %s\n", skip_dir( xctx->sch[xctx->currsch]) );
|
||||
|
||||
tedax_netlist(fd, 0);
|
||||
|
||||
|
||||
/*fprintf(fd,"**** begin user architecture code\n"); */
|
||||
/*netlist_count++; */
|
||||
/*if(xctx.schprop && xctx.schprop[0]) fprintf(fd, "%s\n", xctx.schprop); */
|
||||
/*if(xctx->schprop && xctx->schprop[0]) fprintf(fd, "%s\n", xctx->schprop); */
|
||||
/*fprintf(fd,"**** end user architecture code\n"); */
|
||||
/* /20100217 */
|
||||
|
||||
fprintf(fd, "end netlist\n");
|
||||
|
||||
/* preserve current level instance flags before descending hierarchy for netlisting, restore later */
|
||||
stored_flags = my_calloc(149, xctx.instances, sizeof(unsigned int));
|
||||
for(i=0;i<xctx.instances;i++) stored_flags[i] = xctx.inst[i].flags & 4;
|
||||
stored_flags = my_calloc(149, xctx->instances, sizeof(unsigned int));
|
||||
for(i=0;i<xctx->instances;i++) stored_flags[i] = xctx->inst[i].flags & 4;
|
||||
|
||||
if(0) /* was if(global) ... 20180901 no hierarchical tEDAx netlist for now */
|
||||
{
|
||||
unselect_all();
|
||||
remove_symbols(); /* 20161205 ensure all unused symbols purged before descending hierarchy */
|
||||
load_schematic(1, xctx.sch[xctx.currsch], 0);
|
||||
load_schematic(1, xctx->sch[xctx->currsch], 0);
|
||||
|
||||
xctx.currsch++;
|
||||
dbg(2, "global_tedax_netlist(): last defined symbol=%d\n",xctx.symbols);
|
||||
for(i=0;i<xctx.symbols;i++)
|
||||
xctx->currsch++;
|
||||
dbg(2, "global_tedax_netlist(): last defined symbol=%d\n",xctx->symbols);
|
||||
for(i=0;i<xctx->symbols;i++)
|
||||
{
|
||||
if( strcmp(get_tok_value(xctx.sym[i].prop_ptr,"tedax_ignore",0),"true")==0 ) continue;
|
||||
if(!xctx.sym[i].type) continue;
|
||||
if(strcmp(xctx.sym[i].type,"subcircuit")==0 && check_lib(xctx.sym[i].name))
|
||||
if( strcmp(get_tok_value(xctx->sym[i].prop_ptr,"tedax_ignore",0),"true")==0 ) continue;
|
||||
if(!xctx->sym[i].type) continue;
|
||||
if(strcmp(xctx->sym[i].type,"subcircuit")==0 && check_lib(xctx->sym[i].name))
|
||||
{
|
||||
tedax_block_netlist(fd, i);
|
||||
}
|
||||
}
|
||||
/*clear_drawing(); */
|
||||
my_strncpy(xctx.sch[xctx.currsch] , "", S(xctx.sch[xctx.currsch]));
|
||||
xctx.currsch--;
|
||||
my_strncpy(xctx->sch[xctx->currsch] , "", S(xctx->sch[xctx->currsch]));
|
||||
xctx->currsch--;
|
||||
unselect_all();
|
||||
/* remove_symbols(); */
|
||||
load_schematic(1, xctx.sch[xctx.currsch], 0);
|
||||
load_schematic(1, xctx->sch[xctx->currsch], 0);
|
||||
prepare_netlist_structs(1); /* so 'lab=...' attributes for unnamed nets are set */
|
||||
|
||||
/* symbol vs schematic pin check, we do it here since now we have ALL symbols loaded */
|
||||
sym_vs_sch_pins();
|
||||
|
||||
/* restore hilight flags from errors found analyzing top level before descending hierarchy */
|
||||
for(i=0;i<xctx.instances; i++) xctx.inst[i].flags |= stored_flags[i];
|
||||
for(i=0;i<xctx->instances; i++) xctx->inst[i].flags |= stored_flags[i];
|
||||
|
||||
draw_hilight_net(1);
|
||||
}
|
||||
|
|
@ -135,39 +135,39 @@ void tedax_block_netlist(FILE *fd, int i)
|
|||
const char *str_tmp;
|
||||
int mult;
|
||||
char *extra=NULL;
|
||||
if(!strcmp( get_tok_value(xctx.sym[i].prop_ptr,"tedax_stop",0),"true") )
|
||||
if(!strcmp( get_tok_value(xctx->sym[i].prop_ptr,"tedax_stop",0),"true") )
|
||||
tedax_stop=1;
|
||||
else
|
||||
tedax_stop=0;
|
||||
fprintf(fd, "\n* expanding symbol: %s # of pins=%d\n\n",
|
||||
xctx.sym[i].name,xctx.sym[i].rects[PINLAYER] );
|
||||
fprintf(fd, ".subckt %s ",skip_dir(xctx.sym[i].name));
|
||||
for(j=0;j<xctx.sym[i].rects[PINLAYER];j++)
|
||||
xctx->sym[i].name,xctx->sym[i].rects[PINLAYER] );
|
||||
fprintf(fd, ".subckt %s ",skip_dir(xctx->sym[i].name));
|
||||
for(j=0;j<xctx->sym[i].rects[PINLAYER];j++)
|
||||
{
|
||||
str_tmp=
|
||||
expandlabel(get_tok_value(xctx.sym[i].rect[PINLAYER][j].prop_ptr,"name",0), &mult);
|
||||
expandlabel(get_tok_value(xctx->sym[i].rect[PINLAYER][j].prop_ptr,"name",0), &mult);
|
||||
if(str_tmp)
|
||||
fprintf(fd,"%s ",str_tmp);
|
||||
else
|
||||
fprintf(fd,"<NULL> ");
|
||||
}
|
||||
my_strdup(420, &extra, get_tok_value(xctx.sym[i].prop_ptr,"extra",0) );
|
||||
my_strdup(420, &extra, get_tok_value(xctx->sym[i].prop_ptr,"extra",0) );
|
||||
fprintf(fd, "%s ", extra ? extra : "" );
|
||||
/* 20081206 new get_sym_template does not return token=value pairs where token listed in extra */
|
||||
fprintf(fd, "%s", get_sym_template(xctx.sym[i].templ, extra));
|
||||
fprintf(fd, "%s", get_sym_template(xctx->sym[i].templ, extra));
|
||||
my_free(966, &extra);
|
||||
fprintf(fd, "\n");
|
||||
/*clear_drawing(); */
|
||||
if((str_tmp = get_tok_value(xctx.sym[i].prop_ptr, "schematic",0 ))[0]) {
|
||||
if((str_tmp = get_tok_value(xctx->sym[i].prop_ptr, "schematic",0 ))[0]) {
|
||||
my_strncpy(filename, abs_sym_path(str_tmp, ""), S(filename));
|
||||
load_schematic(1,filename, 0);
|
||||
} else {
|
||||
load_schematic(1, add_ext(abs_sym_path(xctx.sym[i].name, ""), ".sch"), 0);
|
||||
load_schematic(1, add_ext(abs_sym_path(xctx->sym[i].name, ""), ".sch"), 0);
|
||||
}
|
||||
tedax_netlist(fd, tedax_stop); /* 20111113 added tedax_stop */
|
||||
netlist_count++;
|
||||
fprintf(fd,"**** begin user architecture code\n");
|
||||
if(xctx.schprop && xctx.schprop[0]) fprintf(fd, "%s\n", xctx.schprop);
|
||||
if(xctx->schprop && xctx->schprop[0]) fprintf(fd, "%s\n", xctx->schprop);
|
||||
fprintf(fd,"**** end user architecture code\n");
|
||||
fprintf(fd, ".ends\n\n");
|
||||
if(split_files) {
|
||||
|
|
@ -188,30 +188,30 @@ void tedax_netlist(FILE *fd, int tedax_stop )
|
|||
/* set_modify(1); */ /* 20160302 prepare_netlist_structs could change schematic (wire node naming for example) */
|
||||
traverse_node_hash(); /* print all warnings about unconnected floatings etc */
|
||||
if(!tedax_stop) {
|
||||
for(i=0;i<xctx.instances;i++) /* print first ipin/opin defs ... */
|
||||
for(i=0;i<xctx->instances;i++) /* print first ipin/opin defs ... */
|
||||
{
|
||||
if( strcmp(get_tok_value(xctx.inst[i].prop_ptr,"tedax_ignore",0),"true")==0 ) continue;
|
||||
if(xctx.inst[i].ptr<0) continue;
|
||||
if(!strcmp(get_tok_value( (xctx.inst[i].ptr+ xctx.sym)->prop_ptr, "tedax_ignore",0 ), "true") ) {
|
||||
if( strcmp(get_tok_value(xctx->inst[i].prop_ptr,"tedax_ignore",0),"true")==0 ) continue;
|
||||
if(xctx->inst[i].ptr<0) continue;
|
||||
if(!strcmp(get_tok_value( (xctx->inst[i].ptr+ xctx->sym)->prop_ptr, "tedax_ignore",0 ), "true") ) {
|
||||
continue;
|
||||
}
|
||||
my_strdup(421, &type,(xctx.inst[i].ptr+ xctx.sym)->type);
|
||||
my_strdup(421, &type,(xctx->inst[i].ptr+ xctx->sym)->type);
|
||||
if( type && IS_PIN(type) ) {
|
||||
print_tedax_element(fd, i) ; /* this is the element line */
|
||||
}
|
||||
}
|
||||
for(i=0;i<xctx.instances;i++) /* ... then print other lines */
|
||||
for(i=0;i<xctx->instances;i++) /* ... then print other lines */
|
||||
{
|
||||
if( strcmp(get_tok_value(xctx.inst[i].prop_ptr,"tedax_ignore",0),"true")==0 ) continue;
|
||||
if(xctx.inst[i].ptr<0) continue;
|
||||
if(!strcmp(get_tok_value( (xctx.inst[i].ptr+ xctx.sym)->prop_ptr, "tedax_ignore",0 ), "true") ) {
|
||||
if( strcmp(get_tok_value(xctx->inst[i].prop_ptr,"tedax_ignore",0),"true")==0 ) continue;
|
||||
if(xctx->inst[i].ptr<0) continue;
|
||||
if(!strcmp(get_tok_value( (xctx->inst[i].ptr+ xctx->sym)->prop_ptr, "tedax_ignore",0 ), "true") ) {
|
||||
continue;
|
||||
}
|
||||
my_strdup(423, &type,(xctx.inst[i].ptr+ xctx.sym)->type);
|
||||
my_strdup(423, &type,(xctx->inst[i].ptr+ xctx->sym)->type);
|
||||
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(xctx.inst[i].prop_ptr, "only_toplevel", 0), "true")) continue;
|
||||
!strcmp(get_tok_value(xctx->inst[i].prop_ptr, "only_toplevel", 0), "true")) continue;
|
||||
print_tedax_element(fd, i) ; /* this is the element line */
|
||||
}
|
||||
}
|
||||
|
|
|
|||
384
src/token.c
384
src/token.c
File diff suppressed because it is too large
Load Diff
|
|
@ -40,7 +40,7 @@ void global_verilog_netlist(int global) /* netlister driver */
|
|||
char *subckt_name;
|
||||
|
||||
if(modified) {
|
||||
save_ok = save_schematic(xctx.sch[xctx.currsch]);
|
||||
save_ok = save_schematic(xctx->sch[xctx->currsch]);
|
||||
if(save_ok == -1) return;
|
||||
}
|
||||
free_hash(subckt_table);
|
||||
|
|
@ -49,13 +49,13 @@ void global_verilog_netlist(int global) /* netlister driver */
|
|||
/* top sch properties used for library use declarations and type definitions */
|
||||
/* to be printed before any entity declarations */
|
||||
|
||||
my_snprintf(netl_filename, S(netl_filename), "%s/.%s_%d", netlist_dir, skip_dir(xctx.sch[xctx.currsch]),getpid());
|
||||
my_snprintf(netl_filename, S(netl_filename), "%s/.%s_%d", netlist_dir, skip_dir(xctx->sch[xctx->currsch]),getpid());
|
||||
fd=fopen(netl_filename, "w");
|
||||
|
||||
if(user_top_netl_name[0]) {
|
||||
my_snprintf(cellname, S(cellname), "%s", get_cell(user_top_netl_name, 0));
|
||||
} else {
|
||||
my_snprintf(cellname, S(cellname), "%s.v", skip_dir(xctx.sch[xctx.currsch]));
|
||||
my_snprintf(cellname, S(cellname), "%s.v", skip_dir(xctx->sch[xctx->currsch]));
|
||||
}
|
||||
|
||||
if(fd==NULL){
|
||||
|
|
@ -67,17 +67,17 @@ void global_verilog_netlist(int global) /* netlister driver */
|
|||
|
||||
|
||||
/* print verilog timescale 10102004 */
|
||||
for(i=0;i<xctx.instances;i++)
|
||||
for(i=0;i<xctx->instances;i++)
|
||||
{
|
||||
if( strcmp(get_tok_value(xctx.inst[i].prop_ptr,"verilog_ignore",0),"true")==0 ) continue;
|
||||
if(xctx.inst[i].ptr<0) continue;
|
||||
if(!strcmp(get_tok_value( (xctx.inst[i].ptr+ xctx.sym)->prop_ptr, "verilog_ignore",0 ), "true") ) {
|
||||
if( strcmp(get_tok_value(xctx->inst[i].prop_ptr,"verilog_ignore",0),"true")==0 ) continue;
|
||||
if(xctx->inst[i].ptr<0) continue;
|
||||
if(!strcmp(get_tok_value( (xctx->inst[i].ptr+ xctx->sym)->prop_ptr, "verilog_ignore",0 ), "true") ) {
|
||||
continue;
|
||||
}
|
||||
my_strdup(105, &type,(xctx.inst[i].ptr+ xctx.sym)->type);
|
||||
my_strdup(105, &type,(xctx->inst[i].ptr+ xctx->sym)->type);
|
||||
if( type && (strcmp(type,"timescale")==0 || strcmp(type,"verilog_preprocessor")==0) )
|
||||
{
|
||||
str_tmp = get_tok_value( (xctx.inst[i].ptr+ xctx.sym)->prop_ptr ,"verilog_format",0);
|
||||
str_tmp = get_tok_value( (xctx->inst[i].ptr+ xctx->sym)->prop_ptr ,"verilog_format",0);
|
||||
my_strdup(106, &tmp_string, str_tmp);
|
||||
fprintf(fd, "%s\n", str_tmp ? translate(i, tmp_string) : "(NULL)");
|
||||
}
|
||||
|
|
@ -86,68 +86,68 @@ void global_verilog_netlist(int global) /* netlister driver */
|
|||
|
||||
|
||||
dbg(1, "global_verilog_netlist(): printing top level entity\n");
|
||||
fprintf(fd,"module %s (\n", skip_dir( xctx.sch[xctx.currsch]) );
|
||||
fprintf(fd,"module %s (\n", skip_dir( xctx->sch[xctx->currsch]) );
|
||||
/* flush data structures (remove unused symbols) */
|
||||
unselect_all();
|
||||
remove_symbols(); /* removed 25122002, readded 04112003 */
|
||||
|
||||
dbg(1, "global_verilog_netlist(): sch[currsch]=%s\n", xctx.sch[xctx.currsch]);
|
||||
dbg(1, "global_verilog_netlist(): sch[currsch]=%s\n", xctx->sch[xctx->currsch]);
|
||||
|
||||
load_schematic(1,xctx.sch[xctx.currsch] ,0);
|
||||
load_schematic(1,xctx->sch[xctx->currsch] ,0);
|
||||
|
||||
|
||||
/* print top subckt port directions */
|
||||
dbg(1, "global_verilog_netlist(): printing top level out pins\n");
|
||||
tmp=0;
|
||||
for(i=0;i<xctx.instances;i++)
|
||||
for(i=0;i<xctx->instances;i++)
|
||||
{
|
||||
if( strcmp(get_tok_value(xctx.inst[i].prop_ptr,"verilog_ignore",0),"true")==0 ) continue;
|
||||
if(xctx.inst[i].ptr<0) continue;
|
||||
if(!strcmp(get_tok_value( (xctx.inst[i].ptr+ xctx.sym)->prop_ptr, "verilog_ignore",0 ), "true") ) {
|
||||
if( strcmp(get_tok_value(xctx->inst[i].prop_ptr,"verilog_ignore",0),"true")==0 ) continue;
|
||||
if(xctx->inst[i].ptr<0) continue;
|
||||
if(!strcmp(get_tok_value( (xctx->inst[i].ptr+ xctx->sym)->prop_ptr, "verilog_ignore",0 ), "true") ) {
|
||||
continue;
|
||||
}
|
||||
my_strdup(546, &type,(xctx.inst[i].ptr+ xctx.sym)->type);
|
||||
my_strdup(546, &type,(xctx->inst[i].ptr+ xctx->sym)->type);
|
||||
if( type && (strcmp(type,"opin"))==0)
|
||||
{
|
||||
if(tmp) fprintf(fd, " ,\n");
|
||||
tmp++;
|
||||
str_tmp = get_tok_value(xctx.inst[i].prop_ptr,"lab",0);
|
||||
str_tmp = get_tok_value(xctx->inst[i].prop_ptr,"lab",0);
|
||||
fprintf(fd, " %s", str_tmp ? str_tmp : "(NULL)");
|
||||
}
|
||||
}
|
||||
|
||||
dbg(1, "global_verilog_netlist(): printing top level inout pins\n");
|
||||
for(i=0;i<xctx.instances;i++)
|
||||
for(i=0;i<xctx->instances;i++)
|
||||
{
|
||||
if( strcmp(get_tok_value(xctx.inst[i].prop_ptr,"verilog_ignore",0),"true")==0 ) continue;
|
||||
if(xctx.inst[i].ptr<0) continue;
|
||||
if(!strcmp(get_tok_value( (xctx.inst[i].ptr+ xctx.sym)->prop_ptr, "verilog_ignore",0 ), "true") ) {
|
||||
if( strcmp(get_tok_value(xctx->inst[i].prop_ptr,"verilog_ignore",0),"true")==0 ) continue;
|
||||
if(xctx->inst[i].ptr<0) continue;
|
||||
if(!strcmp(get_tok_value( (xctx->inst[i].ptr+ xctx->sym)->prop_ptr, "verilog_ignore",0 ), "true") ) {
|
||||
continue;
|
||||
}
|
||||
my_strdup(547, &type,(xctx.inst[i].ptr+ xctx.sym)->type);
|
||||
my_strdup(547, &type,(xctx->inst[i].ptr+ xctx->sym)->type);
|
||||
if( type && (strcmp(type,"iopin"))==0)
|
||||
{
|
||||
if(tmp) fprintf(fd, " ,\n");
|
||||
tmp++;
|
||||
str_tmp = get_tok_value(xctx.inst[i].prop_ptr,"lab",0);
|
||||
str_tmp = get_tok_value(xctx->inst[i].prop_ptr,"lab",0);
|
||||
fprintf(fd, " %s", str_tmp ? str_tmp : "(NULL)");
|
||||
}
|
||||
}
|
||||
|
||||
dbg(1, "global_verilog_netlist(): printing top level input pins\n");
|
||||
for(i=0;i<xctx.instances;i++)
|
||||
for(i=0;i<xctx->instances;i++)
|
||||
{
|
||||
if( strcmp(get_tok_value(xctx.inst[i].prop_ptr,"verilog_ignore",0),"true")==0 ) continue;
|
||||
if(xctx.inst[i].ptr<0) continue;
|
||||
if(!strcmp(get_tok_value( (xctx.inst[i].ptr+ xctx.sym)->prop_ptr, "verilog_ignore",0 ), "true") ) {
|
||||
if( strcmp(get_tok_value(xctx->inst[i].prop_ptr,"verilog_ignore",0),"true")==0 ) continue;
|
||||
if(xctx->inst[i].ptr<0) continue;
|
||||
if(!strcmp(get_tok_value( (xctx->inst[i].ptr+ xctx->sym)->prop_ptr, "verilog_ignore",0 ), "true") ) {
|
||||
continue;
|
||||
}
|
||||
my_strdup(548, &type,(xctx.inst[i].ptr+ xctx.sym)->type);
|
||||
my_strdup(548, &type,(xctx->inst[i].ptr+ xctx->sym)->type);
|
||||
if( type && (strcmp(type,"ipin"))==0)
|
||||
{
|
||||
if(tmp) fprintf(fd, " ,\n");
|
||||
tmp++;
|
||||
str_tmp = get_tok_value(xctx.inst[i].prop_ptr,"lab",0);
|
||||
str_tmp = get_tok_value(xctx->inst[i].prop_ptr,"lab",0);
|
||||
fprintf(fd, " %s", str_tmp ? str_tmp : "<NULL>");
|
||||
}
|
||||
}
|
||||
|
|
@ -155,11 +155,11 @@ void global_verilog_netlist(int global) /* netlister driver */
|
|||
fprintf(fd,"\n);\n");
|
||||
|
||||
/* 20071006 print top level params if defined in symbol */
|
||||
str_tmp = add_ext(xctx.sch[xctx.currsch], ".sym");
|
||||
str_tmp = add_ext(xctx->sch[xctx->currsch], ".sym");
|
||||
if(!stat(str_tmp, &buf)) {
|
||||
load_sym_def(str_tmp, NULL );
|
||||
print_verilog_param(fd,xctx.symbols-1); /* added print top level params */
|
||||
remove_symbol(xctx.symbols - 1);
|
||||
print_verilog_param(fd,xctx->symbols-1); /* added print top level params */
|
||||
remove_symbol(xctx->symbols - 1);
|
||||
}
|
||||
/* 20071006 end */
|
||||
|
||||
|
|
@ -167,20 +167,20 @@ void global_verilog_netlist(int global) /* netlister driver */
|
|||
|
||||
/* print top subckt port types */
|
||||
dbg(1, "global_verilog_netlist(): printing top level out pins\n");
|
||||
for(i=0;i<xctx.instances;i++)
|
||||
for(i=0;i<xctx->instances;i++)
|
||||
{
|
||||
if( strcmp(get_tok_value(xctx.inst[i].prop_ptr,"verilog_ignore",0),"true")==0 ) continue;
|
||||
if(xctx.inst[i].ptr<0) continue;
|
||||
if(!strcmp(get_tok_value( (xctx.inst[i].ptr+ xctx.sym)->prop_ptr, "verilog_ignore",0 ), "true") ) {
|
||||
if( strcmp(get_tok_value(xctx->inst[i].prop_ptr,"verilog_ignore",0),"true")==0 ) continue;
|
||||
if(xctx->inst[i].ptr<0) continue;
|
||||
if(!strcmp(get_tok_value( (xctx->inst[i].ptr+ xctx->sym)->prop_ptr, "verilog_ignore",0 ), "true") ) {
|
||||
continue;
|
||||
}
|
||||
my_strdup(549, &type,(xctx.inst[i].ptr+ xctx.sym)->type);
|
||||
my_strdup(549, &type,(xctx->inst[i].ptr+ xctx->sym)->type);
|
||||
if( type && (strcmp(type,"opin"))==0)
|
||||
{
|
||||
my_strdup(550, &port_value,get_tok_value(xctx.inst[i].prop_ptr,"value",0));
|
||||
my_strdup(551, &sig_type,get_tok_value(xctx.inst[i].prop_ptr,"verilog_type",0));
|
||||
my_strdup(550, &port_value,get_tok_value(xctx->inst[i].prop_ptr,"value",0));
|
||||
my_strdup(551, &sig_type,get_tok_value(xctx->inst[i].prop_ptr,"verilog_type",0));
|
||||
if(!sig_type || sig_type[0]=='\0') my_strdup(552, &sig_type,"wire"); /* 20070720 changed reg to wire */
|
||||
str_tmp = get_tok_value(xctx.inst[i].prop_ptr,"lab",0);
|
||||
str_tmp = get_tok_value(xctx->inst[i].prop_ptr,"lab",0);
|
||||
fprintf(fd, " output %s ;\n", str_tmp ? str_tmp : "(NULL)");
|
||||
fprintf(fd, " %s %s ", sig_type, str_tmp ? str_tmp : "(NULL)");
|
||||
|
||||
|
|
@ -190,20 +190,20 @@ void global_verilog_netlist(int global) /* netlister driver */
|
|||
}
|
||||
|
||||
dbg(1, "global_verilog_netlist(): printing top level inout pins\n");
|
||||
for(i=0;i<xctx.instances;i++)
|
||||
for(i=0;i<xctx->instances;i++)
|
||||
{
|
||||
if( strcmp(get_tok_value(xctx.inst[i].prop_ptr,"verilog_ignore",0),"true")==0 ) continue;
|
||||
if(xctx.inst[i].ptr<0) continue;
|
||||
if(!strcmp(get_tok_value( (xctx.inst[i].ptr+ xctx.sym)->prop_ptr, "verilog_ignore",0 ), "true") ) {
|
||||
if( strcmp(get_tok_value(xctx->inst[i].prop_ptr,"verilog_ignore",0),"true")==0 ) continue;
|
||||
if(xctx->inst[i].ptr<0) continue;
|
||||
if(!strcmp(get_tok_value( (xctx->inst[i].ptr+ xctx->sym)->prop_ptr, "verilog_ignore",0 ), "true") ) {
|
||||
continue;
|
||||
}
|
||||
my_strdup(553, &type,(xctx.inst[i].ptr+ xctx.sym)->type);
|
||||
my_strdup(553, &type,(xctx->inst[i].ptr+ xctx->sym)->type);
|
||||
if( type && (strcmp(type,"iopin"))==0)
|
||||
{
|
||||
my_strdup(554, &port_value,get_tok_value(xctx.inst[i].prop_ptr,"value",0));
|
||||
my_strdup(555, &sig_type,get_tok_value(xctx.inst[i].prop_ptr,"verilog_type",0));
|
||||
my_strdup(554, &port_value,get_tok_value(xctx->inst[i].prop_ptr,"value",0));
|
||||
my_strdup(555, &sig_type,get_tok_value(xctx->inst[i].prop_ptr,"verilog_type",0));
|
||||
if(!sig_type || sig_type[0]=='\0') my_strdup(556, &sig_type,"wire");
|
||||
str_tmp = get_tok_value(xctx.inst[i].prop_ptr,"lab",0);
|
||||
str_tmp = get_tok_value(xctx->inst[i].prop_ptr,"lab",0);
|
||||
fprintf(fd, " inout %s ;\n", str_tmp ? str_tmp : "(NULL)");
|
||||
fprintf(fd, " %s %s ", sig_type, str_tmp ? str_tmp : "(NULL)");
|
||||
|
||||
|
|
@ -213,20 +213,20 @@ void global_verilog_netlist(int global) /* netlister driver */
|
|||
}
|
||||
|
||||
dbg(1, "global_verilog_netlist(): printing top level input pins\n");
|
||||
for(i=0;i<xctx.instances;i++)
|
||||
for(i=0;i<xctx->instances;i++)
|
||||
{
|
||||
if( strcmp(get_tok_value(xctx.inst[i].prop_ptr,"verilog_ignore",0),"true")==0 ) continue;
|
||||
if(xctx.inst[i].ptr<0) continue;
|
||||
if(!strcmp(get_tok_value( (xctx.inst[i].ptr+ xctx.sym)->prop_ptr, "verilog_ignore",0 ), "true") ) {
|
||||
if( strcmp(get_tok_value(xctx->inst[i].prop_ptr,"verilog_ignore",0),"true")==0 ) continue;
|
||||
if(xctx->inst[i].ptr<0) continue;
|
||||
if(!strcmp(get_tok_value( (xctx->inst[i].ptr+ xctx->sym)->prop_ptr, "verilog_ignore",0 ), "true") ) {
|
||||
continue;
|
||||
}
|
||||
my_strdup(557, &type,(xctx.inst[i].ptr+ xctx.sym)->type);
|
||||
my_strdup(557, &type,(xctx->inst[i].ptr+ xctx->sym)->type);
|
||||
if( type && (strcmp(type,"ipin"))==0)
|
||||
{
|
||||
my_strdup(558, &port_value,get_tok_value(xctx.inst[i].prop_ptr,"value",0));
|
||||
my_strdup(559, &sig_type,get_tok_value(xctx.inst[i].prop_ptr,"verilog_type",0));
|
||||
my_strdup(558, &port_value,get_tok_value(xctx->inst[i].prop_ptr,"value",0));
|
||||
my_strdup(559, &sig_type,get_tok_value(xctx->inst[i].prop_ptr,"verilog_type",0));
|
||||
if(!sig_type || sig_type[0]=='\0') my_strdup(560, &sig_type,"wire");
|
||||
str_tmp = get_tok_value(xctx.inst[i].prop_ptr,"lab",0);
|
||||
str_tmp = get_tok_value(xctx->inst[i].prop_ptr,"lab",0);
|
||||
fprintf(fd, " input %s ;\n", str_tmp ? str_tmp : "<NULL>");
|
||||
fprintf(fd, " %s %s ", sig_type, str_tmp ? str_tmp : "<NULL>");
|
||||
|
||||
|
|
@ -240,21 +240,21 @@ void global_verilog_netlist(int global) /* netlister driver */
|
|||
netlist_count++;
|
||||
fprintf(fd,"---- begin user architecture code\n");
|
||||
|
||||
for(i=0;i<xctx.instances;i++) {
|
||||
if( strcmp(get_tok_value(xctx.inst[i].prop_ptr,"verilog_ignore",0),"true")==0 ) continue;
|
||||
if(xctx.inst[i].ptr<0) continue;
|
||||
if(!strcmp(get_tok_value( (xctx.inst[i].ptr+ xctx.sym)->prop_ptr, "verilog_ignore",0 ), "true") ) {
|
||||
for(i=0;i<xctx->instances;i++) {
|
||||
if( strcmp(get_tok_value(xctx->inst[i].prop_ptr,"verilog_ignore",0),"true")==0 ) continue;
|
||||
if(xctx->inst[i].ptr<0) continue;
|
||||
if(!strcmp(get_tok_value( (xctx->inst[i].ptr+ xctx->sym)->prop_ptr, "verilog_ignore",0 ), "true") ) {
|
||||
continue;
|
||||
}
|
||||
my_strdup(561, &type,(xctx.inst[i].ptr+ xctx.sym)->type);
|
||||
my_strdup(561, &type,(xctx->inst[i].ptr+ xctx->sym)->type);
|
||||
if(type && !strcmp(type,"netlist_commands")) {
|
||||
fprintf(fd, "%s\n", get_tok_value(xctx.inst[i].prop_ptr,"value",2));
|
||||
fprintf(fd, "%s\n", get_tok_value(xctx->inst[i].prop_ptr,"value",2));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(xctx.schverilogprop && xctx.schverilogprop[0]) {
|
||||
fprintf(fd, "%s\n", xctx.schverilogprop);
|
||||
if(xctx->schverilogprop && xctx->schverilogprop[0]) {
|
||||
fprintf(fd, "%s\n", xctx->schverilogprop);
|
||||
}
|
||||
fprintf(fd,"---- end user architecture code\n");
|
||||
fprintf(fd, "endmodule\n");
|
||||
|
|
@ -267,52 +267,52 @@ void global_verilog_netlist(int global) /* netlister driver */
|
|||
}
|
||||
|
||||
/* preserve current level instance flags before descending hierarchy for netlisting, restore later */
|
||||
stored_flags = my_calloc(150, xctx.instances, sizeof(unsigned int));
|
||||
for(i=0;i<xctx.instances;i++) stored_flags[i] = xctx.inst[i].flags & 4;
|
||||
stored_flags = my_calloc(150, xctx->instances, sizeof(unsigned int));
|
||||
for(i=0;i<xctx->instances;i++) stored_flags[i] = xctx->inst[i].flags & 4;
|
||||
|
||||
if(global)
|
||||
{
|
||||
unselect_all();
|
||||
remove_symbols(); /* 20161205 ensure all unused symbols purged before descending hierarchy */
|
||||
|
||||
load_schematic(1, xctx.sch[xctx.currsch], 0);
|
||||
load_schematic(1, xctx->sch[xctx->currsch], 0);
|
||||
|
||||
xctx.currsch++;
|
||||
dbg(2, "global_verilog_netlist(): last defined symbol=%d\n",xctx.symbols);
|
||||
xctx->currsch++;
|
||||
dbg(2, "global_verilog_netlist(): last defined symbol=%d\n",xctx->symbols);
|
||||
subckt_name=NULL;
|
||||
for(i=0;i<xctx.symbols;i++)
|
||||
for(i=0;i<xctx->symbols;i++)
|
||||
{
|
||||
if( strcmp(get_tok_value(xctx.sym[i].prop_ptr,"verilog_ignore",0),"true")==0 ) continue;
|
||||
if(!xctx.sym[i].type) continue;
|
||||
if(strcmp(xctx.sym[i].type,"subcircuit")==0 && check_lib(xctx.sym[i].name)) {
|
||||
/* xctx.sym can be SCH or SYM, use hash to avoid writing duplicate subckt */
|
||||
my_strdup(328, &subckt_name, get_cell(xctx.sym[i].name, 0));
|
||||
if( strcmp(get_tok_value(xctx->sym[i].prop_ptr,"verilog_ignore",0),"true")==0 ) continue;
|
||||
if(!xctx->sym[i].type) continue;
|
||||
if(strcmp(xctx->sym[i].type,"subcircuit")==0 && check_lib(xctx->sym[i].name)) {
|
||||
/* xctx->sym can be SCH or SYM, use hash to avoid writing duplicate subckt */
|
||||
my_strdup(328, &subckt_name, get_cell(xctx->sym[i].name, 0));
|
||||
if (hash_lookup(subckt_table, subckt_name, "", XLOOKUP)==NULL)
|
||||
{
|
||||
hash_lookup(subckt_table, subckt_name, "", XINSERT);
|
||||
if( split_files && strcmp(get_tok_value(xctx.sym[i].prop_ptr,"vhdl_netlist",0),"true")==0 )
|
||||
if( split_files && strcmp(get_tok_value(xctx->sym[i].prop_ptr,"vhdl_netlist",0),"true")==0 )
|
||||
vhdl_block_netlist(fd, i);
|
||||
else if(split_files && strcmp(get_tok_value(xctx.sym[i].prop_ptr,"spice_netlist",0),"true")==0 )
|
||||
else if(split_files && strcmp(get_tok_value(xctx->sym[i].prop_ptr,"spice_netlist",0),"true")==0 )
|
||||
spice_block_netlist(fd, i);
|
||||
else
|
||||
if( strcmp(get_tok_value(xctx.sym[i].prop_ptr,"verilog_primitive",0), "true"))
|
||||
if( strcmp(get_tok_value(xctx->sym[i].prop_ptr,"verilog_primitive",0), "true"))
|
||||
verilog_block_netlist(fd, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
free_hash(subckt_table);
|
||||
my_free(1073, &subckt_name);
|
||||
my_strncpy(xctx.sch[xctx.currsch] , "", S(xctx.sch[xctx.currsch]));
|
||||
xctx.currsch--;
|
||||
my_strncpy(xctx->sch[xctx->currsch] , "", S(xctx->sch[xctx->currsch]));
|
||||
xctx->currsch--;
|
||||
unselect_all();
|
||||
/* remove_symbols(); */
|
||||
load_schematic(1,xctx.sch[xctx.currsch], 0);
|
||||
load_schematic(1,xctx->sch[xctx->currsch], 0);
|
||||
prepare_netlist_structs(1); /* so 'lab=...' attributes for unnamed nets are set */
|
||||
/* symbol vs schematic pin check, we do it here since now we have ALL symbols loaded */
|
||||
sym_vs_sch_pins();
|
||||
|
||||
/* restore hilight flags from errors found analyzing top level before descending hierarchy */
|
||||
for(i=0;i<xctx.instances; i++) xctx.inst[i].flags |= stored_flags[i];
|
||||
for(i=0;i<xctx->instances; i++) xctx->inst[i].flags |= stored_flags[i];
|
||||
|
||||
draw_hilight_net(1);
|
||||
}
|
||||
|
|
@ -354,63 +354,63 @@ void verilog_block_netlist(FILE *fd, int i)
|
|||
char cellname[PATH_MAX];
|
||||
const char *str_tmp;
|
||||
|
||||
if(!strcmp( get_tok_value(xctx.sym[i].prop_ptr,"verilog_stop",0),"true") )
|
||||
if(!strcmp( get_tok_value(xctx->sym[i].prop_ptr,"verilog_stop",0),"true") )
|
||||
verilog_stop=1;
|
||||
else
|
||||
verilog_stop=0;
|
||||
|
||||
|
||||
if(split_files) {
|
||||
my_snprintf(netl_filename, S(netl_filename), "%s/.%s_%d", netlist_dir, skip_dir(xctx.sym[i].name), getpid());
|
||||
my_snprintf(netl_filename, S(netl_filename), "%s/.%s_%d", netlist_dir, skip_dir(xctx->sym[i].name), getpid());
|
||||
dbg(1, "global_vhdl_netlist(): split_files: netl_filename=%s\n", netl_filename);
|
||||
fd=fopen(netl_filename, "w");
|
||||
my_snprintf(cellname, S(cellname), "%s.v", skip_dir(xctx.sym[i].name) );
|
||||
my_snprintf(cellname, S(cellname), "%s.v", skip_dir(xctx->sym[i].name) );
|
||||
|
||||
}
|
||||
|
||||
dbg(1, "verilog_block_netlist(): expanding %s\n", xctx.sym[i].name);
|
||||
dbg(1, "verilog_block_netlist(): expanding %s\n", xctx->sym[i].name);
|
||||
fprintf(fd, "\n// expanding symbol: %s # of pins=%d\n\n",
|
||||
xctx.sym[i].name,xctx.sym[i].rects[PINLAYER] );
|
||||
xctx->sym[i].name,xctx->sym[i].rects[PINLAYER] );
|
||||
|
||||
|
||||
if((str_tmp = get_tok_value(xctx.sym[i].prop_ptr, "schematic",0 ))[0]) {
|
||||
if((str_tmp = get_tok_value(xctx->sym[i].prop_ptr, "schematic",0 ))[0]) {
|
||||
my_strncpy(filename, abs_sym_path(str_tmp, ""), S(filename));
|
||||
load_schematic(1,filename, 0);
|
||||
} else {
|
||||
verilog_stop? load_schematic(0, add_ext(abs_sym_path(xctx.sym[i].name, ""), ".sch"), 0) :
|
||||
load_schematic(1, add_ext(abs_sym_path(xctx.sym[i].name, ""), ".sch"), 0);
|
||||
verilog_stop? load_schematic(0, add_ext(abs_sym_path(xctx->sym[i].name, ""), ".sch"), 0) :
|
||||
load_schematic(1, add_ext(abs_sym_path(xctx->sym[i].name, ""), ".sch"), 0);
|
||||
}
|
||||
|
||||
|
||||
/* print verilog timescale and preprocessor directives 10102004 */
|
||||
|
||||
for(j=0;j<xctx.instances;j++)
|
||||
for(j=0;j<xctx->instances;j++)
|
||||
{
|
||||
if( strcmp(get_tok_value(xctx.inst[j].prop_ptr,"verilog_ignore",0),"true")==0 ) continue;
|
||||
if(xctx.inst[j].ptr<0) continue;
|
||||
if(!strcmp(get_tok_value( (xctx.inst[j].ptr+ xctx.sym)->prop_ptr, "verilog_ignore",0 ), "true") ) {
|
||||
if( strcmp(get_tok_value(xctx->inst[j].prop_ptr,"verilog_ignore",0),"true")==0 ) continue;
|
||||
if(xctx->inst[j].ptr<0) continue;
|
||||
if(!strcmp(get_tok_value( (xctx->inst[j].ptr+ xctx->sym)->prop_ptr, "verilog_ignore",0 ), "true") ) {
|
||||
continue;
|
||||
}
|
||||
my_strdup(544, &type,(xctx.inst[j].ptr+ xctx.sym)->type);
|
||||
my_strdup(544, &type,(xctx->inst[j].ptr+ xctx->sym)->type);
|
||||
if( type && ( strcmp(type,"timescale")==0 || strcmp(type,"verilog_preprocessor")==0) )
|
||||
{
|
||||
str_tmp = get_tok_value( (xctx.inst[j].ptr+ xctx.sym)->prop_ptr ,"verilog_format",0);
|
||||
str_tmp = get_tok_value( (xctx->inst[j].ptr+ xctx->sym)->prop_ptr ,"verilog_format",0);
|
||||
my_strdup(545, &tmp_string, str_tmp);
|
||||
fprintf(fd, "%s\n", str_tmp ? translate(j, tmp_string) : "(NULL)");
|
||||
}
|
||||
}
|
||||
|
||||
fprintf(fd, "module %s (\n", skip_dir(xctx.sym[i].name));
|
||||
fprintf(fd, "module %s (\n", skip_dir(xctx->sym[i].name));
|
||||
/*print_generic(fd, "entity", i); */
|
||||
|
||||
dbg(1, "verilog_block_netlist(): entity ports\n");
|
||||
|
||||
/* print ports directions */
|
||||
tmp=0;
|
||||
for(j=0;j<xctx.sym[i].rects[PINLAYER];j++)
|
||||
for(j=0;j<xctx->sym[i].rects[PINLAYER];j++)
|
||||
{
|
||||
if(strcmp(get_tok_value(xctx.sym[i].rect[PINLAYER][j].prop_ptr,"verilog_ignore",0), "true")) {
|
||||
str_tmp = get_tok_value(xctx.sym[i].rect[PINLAYER][j].prop_ptr,"name",0);
|
||||
if(strcmp(get_tok_value(xctx->sym[i].rect[PINLAYER][j].prop_ptr,"verilog_ignore",0), "true")) {
|
||||
str_tmp = get_tok_value(xctx->sym[i].rect[PINLAYER][j].prop_ptr,"name",0);
|
||||
if(tmp) fprintf(fd, " ,\n");
|
||||
tmp++;
|
||||
fprintf(fd," %s", str_tmp ? str_tmp : "<NULL>");
|
||||
|
|
@ -428,20 +428,20 @@ void verilog_block_netlist(FILE *fd, int i)
|
|||
|
||||
/* print port types */
|
||||
tmp=0;
|
||||
for(j=0;j<xctx.sym[i].rects[PINLAYER];j++)
|
||||
for(j=0;j<xctx->sym[i].rects[PINLAYER];j++)
|
||||
{
|
||||
if(strcmp(get_tok_value(xctx.sym[i].rect[PINLAYER][j].prop_ptr,"verilog_ignore",0), "true")) {
|
||||
if(strcmp(get_tok_value(xctx->sym[i].rect[PINLAYER][j].prop_ptr,"verilog_ignore",0), "true")) {
|
||||
my_strdup(564, &sig_type,get_tok_value(
|
||||
xctx.sym[i].rect[PINLAYER][j].prop_ptr,"verilog_type",0));
|
||||
xctx->sym[i].rect[PINLAYER][j].prop_ptr,"verilog_type",0));
|
||||
my_strdup(565, &port_value, get_tok_value(
|
||||
xctx.sym[i].rect[PINLAYER][j].prop_ptr,"value",2) );
|
||||
my_strdup(566, &dir_tmp, get_tok_value(xctx.sym[i].rect[PINLAYER][j].prop_ptr,"dir",0) );
|
||||
xctx->sym[i].rect[PINLAYER][j].prop_ptr,"value",2) );
|
||||
my_strdup(566, &dir_tmp, get_tok_value(xctx->sym[i].rect[PINLAYER][j].prop_ptr,"dir",0) );
|
||||
if(strcmp(dir_tmp,"in")){
|
||||
if(!sig_type || sig_type[0]=='\0') my_strdup(567, &sig_type,"wire"); /* 20070720 changed reg to wire */
|
||||
} else {
|
||||
if(!sig_type || sig_type[0]=='\0') my_strdup(568, &sig_type,"wire");
|
||||
}
|
||||
str_tmp = get_tok_value(xctx.sym[i].rect[PINLAYER][j].prop_ptr,"name",0);
|
||||
str_tmp = get_tok_value(xctx->sym[i].rect[PINLAYER][j].prop_ptr,"name",0);
|
||||
fprintf(fd," %s %s ;\n",
|
||||
strcmp(dir_tmp,"in")? ( strcmp(dir_tmp,"out")? "inout" :"output" ) : "input",
|
||||
str_tmp ? str_tmp : "<NULL>");
|
||||
|
|
@ -454,27 +454,27 @@ void verilog_block_netlist(FILE *fd, int i)
|
|||
}
|
||||
}
|
||||
|
||||
dbg(1, "verilog_block_netlist(): netlisting %s\n", skip_dir( xctx.sch[xctx.currsch]));
|
||||
dbg(1, "verilog_block_netlist(): netlisting %s\n", skip_dir( xctx->sch[xctx->currsch]));
|
||||
verilog_netlist(fd, verilog_stop);
|
||||
netlist_count++;
|
||||
fprintf(fd,"---- begin user architecture code\n");
|
||||
for(l=0;l<xctx.instances;l++) {
|
||||
if( strcmp(get_tok_value(xctx.inst[l].prop_ptr,"verilog_ignore",0),"true")==0 ) continue;
|
||||
if(xctx.inst[l].ptr<0) continue;
|
||||
if(!strcmp(get_tok_value( (xctx.inst[l].ptr+ xctx.sym)->prop_ptr, "verilog_ignore",0 ), "true") ) {
|
||||
for(l=0;l<xctx->instances;l++) {
|
||||
if( strcmp(get_tok_value(xctx->inst[l].prop_ptr,"verilog_ignore",0),"true")==0 ) continue;
|
||||
if(xctx->inst[l].ptr<0) continue;
|
||||
if(!strcmp(get_tok_value( (xctx->inst[l].ptr+ xctx->sym)->prop_ptr, "verilog_ignore",0 ), "true") ) {
|
||||
continue;
|
||||
}
|
||||
if(netlist_count &&
|
||||
!strcmp(get_tok_value(xctx.inst[l].prop_ptr, "only_toplevel", 0), "true")) continue;
|
||||
!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);
|
||||
my_strdup(569, &type,(xctx->inst[l].ptr+ xctx->sym)->type);
|
||||
if(type && !strcmp(type,"netlist_commands")) {
|
||||
fprintf(fd, "%s\n", get_tok_value(xctx.inst[l].prop_ptr,"value",2));
|
||||
fprintf(fd, "%s\n", get_tok_value(xctx->inst[l].prop_ptr,"value",2));
|
||||
}
|
||||
}
|
||||
|
||||
if(xctx.schverilogprop && xctx.schverilogprop[0]) {
|
||||
fprintf(fd, "%s\n", xctx.schverilogprop);
|
||||
if(xctx->schverilogprop && xctx->schverilogprop[0]) {
|
||||
fprintf(fd, "%s\n", xctx->schverilogprop);
|
||||
}
|
||||
fprintf(fd,"---- end user architecture code\n");
|
||||
fprintf(fd, "endmodule\n");
|
||||
|
|
@ -511,16 +511,16 @@ void verilog_netlist(FILE *fd , int verilog_stop)
|
|||
|
||||
if(!verilog_stop)
|
||||
{
|
||||
for(i=0;i<xctx.instances;i++) /* ... print all element except ipin opin labels use package */
|
||||
for(i=0;i<xctx->instances;i++) /* ... print all element except ipin opin labels use package */
|
||||
{
|
||||
if( strcmp(get_tok_value(xctx.inst[i].prop_ptr,"verilog_ignore",0),"true")==0 ) continue;
|
||||
if(xctx.inst[i].ptr<0) continue;
|
||||
if(!strcmp(get_tok_value( (xctx.inst[i].ptr+ xctx.sym)->prop_ptr, "verilog_ignore",0 ), "true") ) {
|
||||
if( strcmp(get_tok_value(xctx->inst[i].prop_ptr,"verilog_ignore",0),"true")==0 ) continue;
|
||||
if(xctx->inst[i].ptr<0) continue;
|
||||
if(!strcmp(get_tok_value( (xctx->inst[i].ptr+ xctx->sym)->prop_ptr, "verilog_ignore",0 ), "true") ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
dbg(2, "verilog_netlist(): into the netlisting loop\n");
|
||||
my_strdup(570, &type,(xctx.inst[i].ptr+ xctx.sym)->type);
|
||||
my_strdup(570, &type,(xctx->inst[i].ptr+ xctx->sym)->type);
|
||||
if( type &&
|
||||
( !IS_LABEL_OR_PIN(type) &&
|
||||
strcmp(type,"netlist_commands")&&
|
||||
|
|
@ -530,7 +530,7 @@ void verilog_netlist(FILE *fd , int verilog_stop)
|
|||
{
|
||||
if(lastselected)
|
||||
{
|
||||
if(xctx.inst[i].sel==SELECTED) print_verilog_element(fd, i) ;
|
||||
if(xctx->inst[i].sel==SELECTED) print_verilog_element(fd, i) ;
|
||||
}
|
||||
else print_verilog_element(fd, i) ; /* this is the element line */
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,19 +44,19 @@ void global_vhdl_netlist(int global) /* netlister driver */
|
|||
/* to be printed before any entity declarations */
|
||||
|
||||
if(modified) {
|
||||
save_ok = save_schematic(xctx.sch[xctx.currsch]);
|
||||
save_ok = save_schematic(xctx->sch[xctx->currsch]);
|
||||
if(save_ok == -1) return;
|
||||
}
|
||||
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());
|
||||
my_snprintf(netl_filename, S(netl_filename), "%s/.%s_%d", netlist_dir, skip_dir(xctx->sch[xctx->currsch]), getpid());
|
||||
fd=fopen(netl_filename, "w");
|
||||
|
||||
|
||||
if(user_top_netl_name[0]) {
|
||||
my_snprintf(cellname, S(cellname), "%s", get_cell(user_top_netl_name, 0));
|
||||
} else {
|
||||
my_snprintf(cellname, S(cellname), "%s.vhdl", skip_dir(xctx.sch[xctx.currsch]));
|
||||
my_snprintf(cellname, S(cellname), "%s.vhdl", skip_dir(xctx->sch[xctx->currsch]));
|
||||
}
|
||||
|
||||
if(fd==NULL){
|
||||
|
|
@ -66,62 +66,62 @@ void global_vhdl_netlist(int global) /* netlister driver */
|
|||
dbg(1, "global_vhdl_netlist(): opening %s for writing\n",netl_filename);
|
||||
|
||||
dbg(1, "global_vhdl_netlist(): printing top level packages\n");
|
||||
for(i=0;i<xctx.instances;i++)
|
||||
for(i=0;i<xctx->instances;i++)
|
||||
{
|
||||
if( strcmp(get_tok_value(xctx.inst[i].prop_ptr,"vhdl_ignore",0),"true")==0 ) continue;
|
||||
if(xctx.inst[i].ptr<0) continue;
|
||||
if(!strcmp(get_tok_value( (xctx.inst[i].ptr+ xctx.sym)->prop_ptr, "vhdl_ignore",0 ), "true") ) {
|
||||
if( strcmp(get_tok_value(xctx->inst[i].prop_ptr,"vhdl_ignore",0),"true")==0 ) continue;
|
||||
if(xctx->inst[i].ptr<0) continue;
|
||||
if(!strcmp(get_tok_value( (xctx->inst[i].ptr+ xctx->sym)->prop_ptr, "vhdl_ignore",0 ), "true") ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
my_strdup(571, &type,(xctx.inst[i].ptr+ xctx.sym)->type);
|
||||
my_strdup(571, &type,(xctx->inst[i].ptr+ xctx->sym)->type);
|
||||
if( type && (strcmp(type,"package"))==0)
|
||||
{
|
||||
if(xctx.inst[i].prop_ptr) { /* */
|
||||
if(xctx->inst[i].prop_ptr) { /* */
|
||||
fprintf(fd, "//// begin package\n"); /* 20080213 mark start of packages */
|
||||
fprintf(fd, "%s\n", xctx.inst[i].prop_ptr);
|
||||
fprintf(fd, "%s\n", xctx->inst[i].prop_ptr);
|
||||
fprintf(fd, "//// end package\n"); /* 20080213 mark end of packages */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dbg(1, "global_vhdl_netlist(): printing top level use statements\n");
|
||||
for(i=0;i<xctx.instances;i++)
|
||||
for(i=0;i<xctx->instances;i++)
|
||||
{
|
||||
if( strcmp(get_tok_value(xctx.inst[i].prop_ptr,"vhdl_ignore",0),"true")==0 ) continue;
|
||||
if(xctx.inst[i].ptr<0) continue;
|
||||
if(!strcmp(get_tok_value( (xctx.inst[i].ptr+ xctx.sym)->prop_ptr, "vhdl_ignore",0 ), "true") ) {
|
||||
if( strcmp(get_tok_value(xctx->inst[i].prop_ptr,"vhdl_ignore",0),"true")==0 ) continue;
|
||||
if(xctx->inst[i].ptr<0) continue;
|
||||
if(!strcmp(get_tok_value( (xctx->inst[i].ptr+ xctx->sym)->prop_ptr, "vhdl_ignore",0 ), "true") ) {
|
||||
continue;
|
||||
}
|
||||
my_strdup(572, &type,(xctx.inst[i].ptr+ xctx.sym)->type);
|
||||
my_strdup(572, &type,(xctx->inst[i].ptr+ xctx->sym)->type);
|
||||
if( type && (strcmp(type,"use"))==0)
|
||||
{
|
||||
if(xctx.inst[i].prop_ptr) fprintf(fd, "%s\n", xctx.inst[i].prop_ptr);
|
||||
if(xctx->inst[i].prop_ptr) fprintf(fd, "%s\n", xctx->inst[i].prop_ptr);
|
||||
}
|
||||
}
|
||||
|
||||
dbg(1, "global_vhdl_netlist(): printing top level entity\n");
|
||||
|
||||
/* 20071015 already done in print_generic() */
|
||||
/* fprintf(fd," --- entity %s is\n", skip_dir( xctx.sch[xctx.currsch]) ); */
|
||||
/* fprintf(fd," --- entity %s is\n", skip_dir( xctx->sch[xctx->currsch]) ); */
|
||||
/* 20071015 end */
|
||||
|
||||
/* flush data structures (remove unused symbols) */
|
||||
unselect_all();
|
||||
remove_symbols(); /* removed 25122002, readded 04112003.. this removes unused symbols */
|
||||
load_schematic(1, xctx.sch[xctx.currsch], 0);
|
||||
load_schematic(1, xctx->sch[xctx->currsch], 0);
|
||||
|
||||
|
||||
/* 20071009 print top level generics if defined in symbol */
|
||||
|
||||
str_tmp = add_ext(xctx.sch[xctx.currsch], ".sym");
|
||||
str_tmp = add_ext(xctx->sch[xctx->currsch], ".sym");
|
||||
if(!stat(str_tmp, &buf)) {
|
||||
load_sym_def(str_tmp, NULL );
|
||||
print_generic(fd,"entity", xctx.symbols-1); /* added print top level params */
|
||||
remove_symbol(xctx.symbols - 1);
|
||||
print_generic(fd,"entity", xctx->symbols-1); /* added print top level params */
|
||||
remove_symbol(xctx->symbols - 1);
|
||||
} else {
|
||||
fprintf(fd,"entity %s is\n", skip_dir( xctx.sch[xctx.currsch]) );
|
||||
fprintf(fd,"entity %s is\n", skip_dir( xctx->sch[xctx->currsch]) );
|
||||
}
|
||||
/* 20071009 end */
|
||||
|
||||
|
|
@ -130,16 +130,16 @@ void global_vhdl_netlist(int global) /* netlister driver */
|
|||
/* print top subckt generics */
|
||||
/* dbg(1, "global_vhdl_netlist(): printing top level generic pins\n"); */
|
||||
/* tmp=0; */
|
||||
/* for(i=0;i<xctx.instances;i++) */
|
||||
/* for(i=0;i<xctx->instances;i++) */
|
||||
/* { */
|
||||
/* if(xctx.inst[i].ptr<0) continue; */
|
||||
/* my_strdup(573, &type,(xctx.inst[i].ptr+ xctx.sym)->type); */
|
||||
/* my_strdup(574, &sig_type,get_tok_value(xctx.inst[i].prop_ptr,"generic_type",0)); */
|
||||
/* if(xctx->inst[i].ptr<0) continue; */
|
||||
/* my_strdup(573, &type,(xctx->inst[i].ptr+ xctx->sym)->type); */
|
||||
/* my_strdup(574, &sig_type,get_tok_value(xctx->inst[i].prop_ptr,"generic_type",0)); */
|
||||
/* if(!sig_type || sig_type[0]=='\0') my_strdup(575, &sig_type,"std_logic"); */
|
||||
/* if( type && (strcmp(type,"generic"))==0) */
|
||||
/* { */
|
||||
/* my_strdup(576, &port_value,get_tok_value(xctx.inst[i].prop_ptr,"value",2)); */
|
||||
/* str_tmp = get_tok_value(xctx.inst[i].prop_ptr,"lab",0); */
|
||||
/* my_strdup(576, &port_value,get_tok_value(xctx->inst[i].prop_ptr,"value",2)); */
|
||||
/* str_tmp = get_tok_value(xctx->inst[i].prop_ptr,"lab",0); */
|
||||
/* if(!tmp) fprintf(fd,"generic (\n"); */
|
||||
/* if(tmp) fprintf(fd," ;\n"); */
|
||||
/* fprintf(fd, " %s : %s", str_tmp ? str_tmp : "(NULL)", sig_type ); */
|
||||
|
|
@ -156,19 +156,19 @@ void global_vhdl_netlist(int global) /* netlister driver */
|
|||
/* print top subckt ipin/opins */
|
||||
dbg(1, "global_vhdl_netlist(): printing top level out pins\n");
|
||||
tmp=0;
|
||||
for(i=0;i<xctx.instances;i++)
|
||||
for(i=0;i<xctx->instances;i++)
|
||||
{
|
||||
if( strcmp(get_tok_value(xctx.inst[i].prop_ptr,"vhdl_ignore",0),"true")==0 ) continue;
|
||||
if(xctx.inst[i].ptr<0) continue;
|
||||
if(!strcmp(get_tok_value( (xctx.inst[i].ptr+ xctx.sym)->prop_ptr, "vhdl_ignore",0 ), "true") ) {
|
||||
if( strcmp(get_tok_value(xctx->inst[i].prop_ptr,"vhdl_ignore",0),"true")==0 ) continue;
|
||||
if(xctx->inst[i].ptr<0) continue;
|
||||
if(!strcmp(get_tok_value( (xctx->inst[i].ptr+ xctx->sym)->prop_ptr, "vhdl_ignore",0 ), "true") ) {
|
||||
continue;
|
||||
}
|
||||
my_strdup(577, &sig_type,get_tok_value(xctx.inst[i].prop_ptr,"sig_type",0));
|
||||
my_strdup(577, &sig_type,get_tok_value(xctx->inst[i].prop_ptr,"sig_type",0));
|
||||
if(!sig_type || sig_type[0]=='\0') my_strdup(578, &sig_type,"std_logic");
|
||||
my_strdup(579, &type,(xctx.inst[i].ptr+ xctx.sym)->type);
|
||||
my_strdup(579, &type,(xctx->inst[i].ptr+ xctx->sym)->type);
|
||||
if( type && (strcmp(type,"opin"))==0)
|
||||
{
|
||||
str_tmp = get_tok_value(xctx.inst[i].prop_ptr,"lab",0);
|
||||
str_tmp = get_tok_value(xctx->inst[i].prop_ptr,"lab",0);
|
||||
if(!tmp) fprintf(fd,"port(\n");
|
||||
if(tmp) fprintf(fd," ;\n");
|
||||
fprintf(fd, " %s : out %s", str_tmp ? str_tmp : "(NULL)", sig_type );
|
||||
|
|
@ -177,19 +177,19 @@ void global_vhdl_netlist(int global) /* netlister driver */
|
|||
}
|
||||
|
||||
dbg(1, "global_vhdl_netlist(): printing top level inout pins\n");
|
||||
for(i=0;i<xctx.instances;i++)
|
||||
for(i=0;i<xctx->instances;i++)
|
||||
{
|
||||
if( strcmp(get_tok_value(xctx.inst[i].prop_ptr,"vhdl_ignore",0),"true")==0 ) continue;
|
||||
if(xctx.inst[i].ptr<0) continue;
|
||||
if(!strcmp(get_tok_value( (xctx.inst[i].ptr+ xctx.sym)->prop_ptr, "vhdl_ignore",0 ), "true") ) {
|
||||
if( strcmp(get_tok_value(xctx->inst[i].prop_ptr,"vhdl_ignore",0),"true")==0 ) continue;
|
||||
if(xctx->inst[i].ptr<0) continue;
|
||||
if(!strcmp(get_tok_value( (xctx->inst[i].ptr+ xctx->sym)->prop_ptr, "vhdl_ignore",0 ), "true") ) {
|
||||
continue;
|
||||
}
|
||||
my_strdup(580, &sig_type,get_tok_value(xctx.inst[i].prop_ptr,"sig_type",0));
|
||||
my_strdup(580, &sig_type,get_tok_value(xctx->inst[i].prop_ptr,"sig_type",0));
|
||||
if(!sig_type || sig_type[0]=='\0') my_strdup(581, &sig_type,"std_logic");
|
||||
my_strdup(582, &type,(xctx.inst[i].ptr+ xctx.sym)->type);
|
||||
my_strdup(582, &type,(xctx->inst[i].ptr+ xctx->sym)->type);
|
||||
if( type && (strcmp(type,"iopin"))==0)
|
||||
{
|
||||
str_tmp = get_tok_value(xctx.inst[i].prop_ptr,"lab",0);
|
||||
str_tmp = get_tok_value(xctx->inst[i].prop_ptr,"lab",0);
|
||||
if(!tmp) fprintf(fd,"port(\n");
|
||||
if(tmp) fprintf(fd," ;\n");
|
||||
fprintf(fd, " %s : inout %s", str_tmp ? str_tmp : "(NULL)", sig_type );
|
||||
|
|
@ -198,19 +198,19 @@ void global_vhdl_netlist(int global) /* netlister driver */
|
|||
}
|
||||
|
||||
dbg(1, "global_vhdl_netlist(): printing top level input pins\n");
|
||||
for(i=0;i<xctx.instances;i++)
|
||||
for(i=0;i<xctx->instances;i++)
|
||||
{
|
||||
if( strcmp(get_tok_value(xctx.inst[i].prop_ptr,"vhdl_ignore",0),"true")==0 ) continue;
|
||||
if(xctx.inst[i].ptr<0) continue;
|
||||
if(!strcmp(get_tok_value( (xctx.inst[i].ptr+ xctx.sym)->prop_ptr, "vhdl_ignore",0 ), "true") ) {
|
||||
if( strcmp(get_tok_value(xctx->inst[i].prop_ptr,"vhdl_ignore",0),"true")==0 ) continue;
|
||||
if(xctx->inst[i].ptr<0) continue;
|
||||
if(!strcmp(get_tok_value( (xctx->inst[i].ptr+ xctx->sym)->prop_ptr, "vhdl_ignore",0 ), "true") ) {
|
||||
continue;
|
||||
}
|
||||
my_strdup(583, &sig_type,get_tok_value(xctx.inst[i].prop_ptr,"sig_type",0));
|
||||
my_strdup(583, &sig_type,get_tok_value(xctx->inst[i].prop_ptr,"sig_type",0));
|
||||
if(!sig_type || sig_type[0]=='\0') my_strdup(584, &sig_type,"std_logic");
|
||||
my_strdup(585, &type,(xctx.inst[i].ptr+ xctx.sym)->type);
|
||||
my_strdup(585, &type,(xctx->inst[i].ptr+ xctx->sym)->type);
|
||||
if( type && (strcmp(type,"ipin"))==0)
|
||||
{
|
||||
str_tmp = get_tok_value(xctx.inst[i].prop_ptr,"lab",0);
|
||||
str_tmp = get_tok_value(xctx->inst[i].prop_ptr,"lab",0);
|
||||
if(!tmp) fprintf(fd,"port(\n");
|
||||
if(tmp) fprintf(fd," ;\n");
|
||||
fprintf(fd, " %s : in %s", str_tmp ? str_tmp : "<NULL>", sig_type );
|
||||
|
|
@ -220,41 +220,41 @@ void global_vhdl_netlist(int global) /* netlister driver */
|
|||
if(tmp) fprintf(fd,"\n);\n");
|
||||
|
||||
dbg(1, "global_vhdl_netlist(): printing top level port attributes\n");
|
||||
for(i=0;i<xctx.instances;i++)
|
||||
for(i=0;i<xctx->instances;i++)
|
||||
{
|
||||
if( strcmp(get_tok_value(xctx.inst[i].prop_ptr,"vhdl_ignore",0),"true")==0 ) continue;
|
||||
if(xctx.inst[i].ptr<0) continue;
|
||||
if(!strcmp(get_tok_value( (xctx.inst[i].ptr+ xctx.sym)->prop_ptr, "vhdl_ignore",0 ), "true") ) {
|
||||
if( strcmp(get_tok_value(xctx->inst[i].prop_ptr,"vhdl_ignore",0),"true")==0 ) continue;
|
||||
if(xctx->inst[i].ptr<0) continue;
|
||||
if(!strcmp(get_tok_value( (xctx->inst[i].ptr+ xctx->sym)->prop_ptr, "vhdl_ignore",0 ), "true") ) {
|
||||
continue;
|
||||
}
|
||||
my_strdup(586, &type,(xctx.inst[i].ptr+ xctx.sym)->type);
|
||||
my_strdup(586, &type,(xctx->inst[i].ptr+ xctx->sym)->type);
|
||||
if( type && (strcmp(type,"port_attributes"))==0)
|
||||
{
|
||||
if(xctx.inst[i].prop_ptr) fprintf(fd, "%s\n", xctx.inst[i].prop_ptr);
|
||||
if(xctx->inst[i].prop_ptr) fprintf(fd, "%s\n", xctx->inst[i].prop_ptr);
|
||||
}
|
||||
}
|
||||
|
||||
fprintf(fd,"end %s ;\n\n", skip_dir( xctx.sch[xctx.currsch]) );
|
||||
fprintf(fd,"end %s ;\n\n", skip_dir( xctx->sch[xctx->currsch]) );
|
||||
fprintf(fd,"architecture arch_%s of %s is\n\n",
|
||||
skip_dir( xctx.sch[xctx.currsch]) , skip_dir( xctx.sch[xctx.currsch]));
|
||||
skip_dir( xctx->sch[xctx->currsch]) , skip_dir( xctx->sch[xctx->currsch]));
|
||||
|
||||
dbg(1, "global_vhdl_netlist(): printing top level used components\n");
|
||||
/* print all components */
|
||||
subckt_name=NULL;
|
||||
for(j=0;j<xctx.symbols;j++)
|
||||
for(j=0;j<xctx->symbols;j++)
|
||||
{
|
||||
if( strcmp(get_tok_value(xctx.sym[j].prop_ptr,"vhdl_primitive",0),"true")==0 ) continue;
|
||||
if( strcmp(get_tok_value(xctx.sym[j].prop_ptr,"vhdl_ignore",0),"true")==0 ) continue;
|
||||
if(!xctx.sym[j].type || (strcmp(xctx.sym[j].type,"primitive")!=0 &&
|
||||
strcmp(xctx.sym[j].type,"subcircuit")!=0)) continue;
|
||||
if( strcmp(get_tok_value(xctx->sym[j].prop_ptr,"vhdl_primitive",0),"true")==0 ) continue;
|
||||
if( strcmp(get_tok_value(xctx->sym[j].prop_ptr,"vhdl_ignore",0),"true")==0 ) continue;
|
||||
if(!xctx->sym[j].type || (strcmp(xctx->sym[j].type,"primitive")!=0 &&
|
||||
strcmp(xctx->sym[j].type,"subcircuit")!=0)) continue;
|
||||
if((
|
||||
strcmp(xctx.sym[j].type,"subcircuit")==0 ||
|
||||
strcmp(xctx.sym[j].type,"primitive")==0
|
||||
) && check_lib(xctx.sym[j].name)
|
||||
strcmp(xctx->sym[j].type,"subcircuit")==0 ||
|
||||
strcmp(xctx->sym[j].type,"primitive")==0
|
||||
) && check_lib(xctx->sym[j].name)
|
||||
)
|
||||
{
|
||||
/* xctx.sym can be SCH or SYM, use hash to avoid writing duplicate subckt */
|
||||
my_strdup(317, &subckt_name, get_cell(xctx.sym[j].name, 0));
|
||||
/* xctx->sym can be SCH or SYM, use hash to avoid writing duplicate subckt */
|
||||
my_strdup(317, &subckt_name, get_cell(xctx->sym[j].name, 0));
|
||||
if (hash_lookup(subckt_table, subckt_name, "", XLOOKUP)==NULL) {
|
||||
hash_lookup(subckt_table, subckt_name, "", XINSERT);
|
||||
/* component generics */
|
||||
|
|
@ -262,16 +262,16 @@ void global_vhdl_netlist(int global) /* netlister driver */
|
|||
|
||||
/* component ports */
|
||||
tmp=0;
|
||||
for(i=0;i<xctx.sym[j].rects[PINLAYER];i++)
|
||||
for(i=0;i<xctx->sym[j].rects[PINLAYER];i++)
|
||||
{
|
||||
if(strcmp(get_tok_value(xctx.sym[j].rect[PINLAYER][i].prop_ptr,"vhdl_ignore",0), "true")) {
|
||||
if(strcmp(get_tok_value(xctx->sym[j].rect[PINLAYER][i].prop_ptr,"vhdl_ignore",0), "true")) {
|
||||
my_strdup(587, &sig_type,get_tok_value(
|
||||
xctx.sym[j].rect[PINLAYER][i].prop_ptr,"sig_type",0));
|
||||
xctx->sym[j].rect[PINLAYER][i].prop_ptr,"sig_type",0));
|
||||
my_strdup(588, &port_value, get_tok_value(
|
||||
xctx.sym[j].rect[PINLAYER][i].prop_ptr,"value",2) );
|
||||
xctx->sym[j].rect[PINLAYER][i].prop_ptr,"value",2) );
|
||||
if(!sig_type || sig_type[0]=='\0') my_strdup(589, &sig_type,"std_logic");
|
||||
my_strdup(590, &dir_tmp, get_tok_value(xctx.sym[j].rect[PINLAYER][i].prop_ptr,"dir",0) );
|
||||
str_tmp = get_tok_value(xctx.sym[j].rect[PINLAYER][i].prop_ptr,"name",0);
|
||||
my_strdup(590, &dir_tmp, get_tok_value(xctx->sym[j].rect[PINLAYER][i].prop_ptr,"dir",0) );
|
||||
str_tmp = get_tok_value(xctx->sym[j].rect[PINLAYER][i].prop_ptr,"name",0);
|
||||
if(!tmp) fprintf(fd, "port (\n");
|
||||
if(tmp) fprintf(fd, " ;\n");
|
||||
fprintf(fd," %s : %s %s",str_tmp ? str_tmp : "<NULL>",
|
||||
|
|
@ -294,22 +294,22 @@ void global_vhdl_netlist(int global) /* netlister driver */
|
|||
vhdl_netlist(fd, 0);
|
||||
fprintf(fd,"//// begin user architecture code\n");
|
||||
|
||||
for(i=0;i<xctx.instances;i++) {
|
||||
if( strcmp(get_tok_value(xctx.inst[i].prop_ptr,"vhdl_ignore",0),"true")==0 ) continue;
|
||||
if(xctx.inst[i].ptr<0) continue;
|
||||
if(!strcmp(get_tok_value( (xctx.inst[i].ptr+ xctx.sym)->prop_ptr, "vhdl_ignore",0 ), "true") ) {
|
||||
for(i=0;i<xctx->instances;i++) {
|
||||
if( strcmp(get_tok_value(xctx->inst[i].prop_ptr,"vhdl_ignore",0),"true")==0 ) continue;
|
||||
if(xctx->inst[i].ptr<0) continue;
|
||||
if(!strcmp(get_tok_value( (xctx->inst[i].ptr+ xctx->sym)->prop_ptr, "vhdl_ignore",0 ), "true") ) {
|
||||
continue;
|
||||
}
|
||||
my_strdup(591, &type,(xctx.inst[i].ptr+ xctx.sym)->type);
|
||||
my_strdup(591, &type,(xctx->inst[i].ptr+ xctx->sym)->type);
|
||||
if(type && !strcmp(type,"netlist_commands")) {
|
||||
fprintf(fd, "%s\n", get_tok_value(xctx.inst[i].prop_ptr,"value",2));
|
||||
fprintf(fd, "%s\n", get_tok_value(xctx->inst[i].prop_ptr,"value",2));
|
||||
}
|
||||
}
|
||||
|
||||
if(xctx.schvhdlprop && xctx.schvhdlprop[0]) {
|
||||
fprintf(fd, "%s\n", xctx.schvhdlprop);
|
||||
if(xctx->schvhdlprop && xctx->schvhdlprop[0]) {
|
||||
fprintf(fd, "%s\n", xctx->schvhdlprop);
|
||||
}
|
||||
fprintf(fd, "end arch_%s ;\n\n", skip_dir( xctx.sch[xctx.currsch]) );
|
||||
fprintf(fd, "end arch_%s ;\n\n", skip_dir( xctx->sch[xctx->currsch]) );
|
||||
|
||||
if(split_files) {
|
||||
fclose(fd);
|
||||
|
|
@ -320,52 +320,52 @@ void global_vhdl_netlist(int global) /* netlister driver */
|
|||
netlist_count++;
|
||||
|
||||
/* preserve current level instance flags before descending hierarchy for netlisting, restore later */
|
||||
stored_flags = my_calloc(151, xctx.instances, sizeof(unsigned int));
|
||||
for(i=0;i<xctx.instances;i++) stored_flags[i] = xctx.inst[i].flags & 4;
|
||||
stored_flags = my_calloc(151, xctx->instances, sizeof(unsigned int));
|
||||
for(i=0;i<xctx->instances;i++) stored_flags[i] = xctx->inst[i].flags & 4;
|
||||
|
||||
if(global)
|
||||
{
|
||||
unselect_all();
|
||||
remove_symbols(); /* 20161205 ensure all unused symbols purged before descending hierarchy */
|
||||
load_schematic(1, xctx.sch[xctx.currsch], 0);
|
||||
load_schematic(1, xctx->sch[xctx->currsch], 0);
|
||||
|
||||
xctx.currsch++;
|
||||
dbg(2, "global_vhdl_netlist(): last defined symbol=%d\n",xctx.symbols);
|
||||
xctx->currsch++;
|
||||
dbg(2, "global_vhdl_netlist(): last defined symbol=%d\n",xctx->symbols);
|
||||
subckt_name=NULL;
|
||||
for(i=0;i<xctx.symbols;i++)
|
||||
for(i=0;i<xctx->symbols;i++)
|
||||
{
|
||||
if( strcmp(get_tok_value(xctx.sym[i].prop_ptr,"vhdl_ignore",0),"true")==0 ) continue;
|
||||
if(!xctx.sym[i].type) continue;
|
||||
if(strcmp(xctx.sym[i].type,"subcircuit")==0 && check_lib(xctx.sym[i].name))
|
||||
if( strcmp(get_tok_value(xctx->sym[i].prop_ptr,"vhdl_ignore",0),"true")==0 ) continue;
|
||||
if(!xctx->sym[i].type) continue;
|
||||
if(strcmp(xctx->sym[i].type,"subcircuit")==0 && check_lib(xctx->sym[i].name))
|
||||
{
|
||||
/* xctx.sym can be SCH or SYM, use hash to avoid writing duplicate subckt */
|
||||
my_strdup(327, &subckt_name, get_cell(xctx.sym[i].name, 0));
|
||||
/* xctx->sym can be SCH or SYM, use hash to avoid writing duplicate subckt */
|
||||
my_strdup(327, &subckt_name, get_cell(xctx->sym[i].name, 0));
|
||||
if (hash_lookup(subckt_table, subckt_name, "", XLOOKUP)==NULL)
|
||||
{
|
||||
hash_lookup(subckt_table, subckt_name, "", XINSERT);
|
||||
if( split_files && strcmp(get_tok_value(xctx.sym[i].prop_ptr,"verilog_netlist",0),"true")==0 )
|
||||
if( split_files && strcmp(get_tok_value(xctx->sym[i].prop_ptr,"verilog_netlist",0),"true")==0 )
|
||||
verilog_block_netlist(fd, i);
|
||||
else if( split_files && strcmp(get_tok_value(xctx.sym[i].prop_ptr,"spice_netlist",0),"true")==0 )
|
||||
else if( split_files && strcmp(get_tok_value(xctx->sym[i].prop_ptr,"spice_netlist",0),"true")==0 )
|
||||
spice_block_netlist(fd, i);
|
||||
else
|
||||
if( strcmp(get_tok_value(xctx.sym[i].prop_ptr,"vhdl_primitive",0),"true"))
|
||||
if( strcmp(get_tok_value(xctx->sym[i].prop_ptr,"vhdl_primitive",0),"true"))
|
||||
vhdl_block_netlist(fd, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
free_hash(subckt_table);
|
||||
my_free(1087, &subckt_name);
|
||||
my_strncpy(xctx.sch[xctx.currsch] , "", S(xctx.sch[xctx.currsch]));
|
||||
xctx.currsch--;
|
||||
my_strncpy(xctx->sch[xctx->currsch] , "", S(xctx->sch[xctx->currsch]));
|
||||
xctx->currsch--;
|
||||
unselect_all();
|
||||
/* remove_symbols(); */
|
||||
load_schematic(1, xctx.sch[xctx.currsch], 0);
|
||||
load_schematic(1, xctx->sch[xctx->currsch], 0);
|
||||
prepare_netlist_structs(1); /* so 'lab=...' attributes for unnamed nets are set */
|
||||
/* symbol vs schematic pin check, we do it here since now we have ALL symbols loaded */
|
||||
sym_vs_sch_pins();
|
||||
|
||||
/* restore hilight flags from errors found analyzing top level before descending hierarchy */
|
||||
for(i=0;i<xctx.instances; i++) xctx.inst[i].flags |= stored_flags[i];
|
||||
for(i=0;i<xctx->instances; i++) xctx->inst[i].flags |= stored_flags[i];
|
||||
|
||||
draw_hilight_net(1);
|
||||
}
|
||||
|
|
@ -404,53 +404,53 @@ void vhdl_block_netlist(FILE *fd, int i)
|
|||
char cellname[PATH_MAX];
|
||||
const char *str_tmp;
|
||||
|
||||
if(!strcmp( get_tok_value(xctx.sym[i].prop_ptr,"vhdl_stop",0),"true") )
|
||||
if(!strcmp( get_tok_value(xctx->sym[i].prop_ptr,"vhdl_stop",0),"true") )
|
||||
vhdl_stop=1;
|
||||
else
|
||||
vhdl_stop=0;
|
||||
|
||||
if(split_files) {
|
||||
my_snprintf(netl_filename, S(netl_filename), "%s/.%s_%d", netlist_dir, skip_dir(xctx.sym[i].name), getpid());
|
||||
my_snprintf(netl_filename, S(netl_filename), "%s/.%s_%d", netlist_dir, skip_dir(xctx->sym[i].name), getpid());
|
||||
dbg(1, "vhdl_block_netlist(): split_files: netl_filename=%s\n", netl_filename);
|
||||
fd=fopen(netl_filename, "w");
|
||||
my_snprintf(cellname, S(cellname), "%s.vhdl", skip_dir(xctx.sym[i].name) );
|
||||
my_snprintf(cellname, S(cellname), "%s.vhdl", skip_dir(xctx->sym[i].name) );
|
||||
}
|
||||
|
||||
dbg(1, "vhdl_block_netlist(): expanding %s\n", xctx.sym[i].name);
|
||||
dbg(1, "vhdl_block_netlist(): expanding %s\n", xctx->sym[i].name);
|
||||
fprintf(fd, "\n-- expanding symbol: %s # of pins=%d\n\n",
|
||||
xctx.sym[i].name,xctx.sym[i].rects[PINLAYER] );
|
||||
xctx->sym[i].name,xctx->sym[i].rects[PINLAYER] );
|
||||
|
||||
if((str_tmp = get_tok_value(xctx.sym[i].prop_ptr, "schematic",0 ))[0]) {
|
||||
if((str_tmp = get_tok_value(xctx->sym[i].prop_ptr, "schematic",0 ))[0]) {
|
||||
my_strncpy(filename, abs_sym_path(str_tmp, ""), S(filename));
|
||||
load_schematic(1,filename, 0);
|
||||
} else {
|
||||
load_schematic(1, add_ext(abs_sym_path(xctx.sym[i].name, ""), ".sch"), 0);
|
||||
load_schematic(1, add_ext(abs_sym_path(xctx->sym[i].name, ""), ".sch"), 0);
|
||||
}
|
||||
|
||||
dbg(1, "vhdl_block_netlist(): packages\n");
|
||||
for(l=0;l<xctx.instances;l++)
|
||||
for(l=0;l<xctx->instances;l++)
|
||||
{
|
||||
if(!(xctx.inst[l].ptr+ xctx.sym)->type) continue;
|
||||
if( strcmp(get_tok_value(xctx.inst[l].prop_ptr,"vhdl_ignore",0),"true")==0 ) continue;
|
||||
if(xctx.inst[l].ptr<0) continue;
|
||||
if(!strcmp(get_tok_value( (xctx.inst[l].ptr+ xctx.sym)->prop_ptr, "vhdl_ignore",0 ), "true") ) {
|
||||
if(!(xctx->inst[l].ptr+ xctx->sym)->type) continue;
|
||||
if( strcmp(get_tok_value(xctx->inst[l].prop_ptr,"vhdl_ignore",0),"true")==0 ) continue;
|
||||
if(xctx->inst[l].ptr<0) continue;
|
||||
if(!strcmp(get_tok_value( (xctx->inst[l].ptr+ xctx->sym)->prop_ptr, "vhdl_ignore",0 ), "true") ) {
|
||||
continue;
|
||||
}
|
||||
if( !strcmp((xctx.inst[l].ptr+ xctx.sym)->type, "package") )
|
||||
fprintf(fd, "%s\n", xctx.inst[l].prop_ptr);
|
||||
if( !strcmp((xctx->inst[l].ptr+ xctx->sym)->type, "package") )
|
||||
fprintf(fd, "%s\n", xctx->inst[l].prop_ptr);
|
||||
}
|
||||
|
||||
dbg(1, "vhdl_block_netlist(): use statements\n");
|
||||
for(l=0;l<xctx.instances;l++)
|
||||
for(l=0;l<xctx->instances;l++)
|
||||
{
|
||||
if( strcmp(get_tok_value(xctx.inst[l].prop_ptr,"vhdl_ignore",0),"true")==0 ) continue;
|
||||
if(xctx.inst[l].ptr<0) continue;
|
||||
if(!(xctx.inst[l].ptr+ xctx.sym)->type) continue;
|
||||
if(!strcmp(get_tok_value( (xctx.inst[l].ptr+ xctx.sym)->prop_ptr, "vhdl_ignore",0 ), "true") ) {
|
||||
if( strcmp(get_tok_value(xctx->inst[l].prop_ptr,"vhdl_ignore",0),"true")==0 ) continue;
|
||||
if(xctx->inst[l].ptr<0) continue;
|
||||
if(!(xctx->inst[l].ptr+ xctx->sym)->type) continue;
|
||||
if(!strcmp(get_tok_value( (xctx->inst[l].ptr+ xctx->sym)->prop_ptr, "vhdl_ignore",0 ), "true") ) {
|
||||
continue;
|
||||
}
|
||||
if( !strcmp((xctx.inst[l].ptr+ xctx.sym)->type, "use") )
|
||||
fprintf(fd, "%s\n", xctx.inst[l].prop_ptr);
|
||||
if( !strcmp((xctx->inst[l].ptr+ xctx->sym)->type, "use") )
|
||||
fprintf(fd, "%s\n", xctx->inst[l].prop_ptr);
|
||||
}
|
||||
|
||||
dbg(1, "vhdl_block_netlist(): entity generics\n");
|
||||
|
|
@ -460,16 +460,16 @@ void vhdl_block_netlist(FILE *fd, int i)
|
|||
dbg(1, "vhdl_block_netlist(): entity ports\n");
|
||||
/* print entity ports */
|
||||
tmp=0;
|
||||
for(j=0;j<xctx.sym[i].rects[PINLAYER];j++)
|
||||
for(j=0;j<xctx->sym[i].rects[PINLAYER];j++)
|
||||
{
|
||||
if(strcmp(get_tok_value(xctx.sym[i].rect[PINLAYER][j].prop_ptr,"vhdl_ignore",0), "true")) {
|
||||
if(strcmp(get_tok_value(xctx->sym[i].rect[PINLAYER][j].prop_ptr,"vhdl_ignore",0), "true")) {
|
||||
my_strdup(592, &sig_type,get_tok_value(
|
||||
xctx.sym[i].rect[PINLAYER][j].prop_ptr,"sig_type",0));
|
||||
xctx->sym[i].rect[PINLAYER][j].prop_ptr,"sig_type",0));
|
||||
my_strdup(593, &port_value, get_tok_value(
|
||||
xctx.sym[i].rect[PINLAYER][j].prop_ptr,"value",2) );
|
||||
xctx->sym[i].rect[PINLAYER][j].prop_ptr,"value",2) );
|
||||
if(!sig_type || sig_type[0]=='\0') my_strdup(594, &sig_type,"std_logic");
|
||||
my_strdup(595, &dir_tmp, get_tok_value(xctx.sym[i].rect[PINLAYER][j].prop_ptr,"dir",0) );
|
||||
str_tmp = get_tok_value(xctx.sym[i].rect[PINLAYER][j].prop_ptr,"name",0);
|
||||
my_strdup(595, &dir_tmp, get_tok_value(xctx->sym[i].rect[PINLAYER][j].prop_ptr,"dir",0) );
|
||||
str_tmp = get_tok_value(xctx->sym[i].rect[PINLAYER][j].prop_ptr,"name",0);
|
||||
if(tmp) fprintf(fd, " ;\n");
|
||||
if(!tmp) fprintf(fd,"port (\n");
|
||||
fprintf(fd," %s : %s %s",str_tmp ? str_tmp : "<NULL>",
|
||||
|
|
@ -483,52 +483,52 @@ void vhdl_block_netlist(FILE *fd, int i)
|
|||
if(tmp) fprintf(fd, "\n);\n");
|
||||
|
||||
dbg(1, "vhdl_block_netlist(): port attributes\n");
|
||||
for(l=0;l<xctx.instances;l++)
|
||||
for(l=0;l<xctx->instances;l++)
|
||||
{
|
||||
if( strcmp(get_tok_value(xctx.inst[l].prop_ptr,"vhdl_ignore",0),"true")==0 ) continue;
|
||||
if(xctx.inst[l].ptr<0) continue;
|
||||
if(!strcmp(get_tok_value( (xctx.inst[l].ptr+ xctx.sym)->prop_ptr, "vhdl_ignore",0 ), "true") ) {
|
||||
if( strcmp(get_tok_value(xctx->inst[l].prop_ptr,"vhdl_ignore",0),"true")==0 ) continue;
|
||||
if(xctx->inst[l].ptr<0) continue;
|
||||
if(!strcmp(get_tok_value( (xctx->inst[l].ptr+ xctx->sym)->prop_ptr, "vhdl_ignore",0 ), "true") ) {
|
||||
continue;
|
||||
}
|
||||
my_strdup(596, &type,(xctx.inst[l].ptr+ xctx.sym)->type);
|
||||
my_strdup(596, &type,(xctx->inst[l].ptr+ xctx->sym)->type);
|
||||
if( type && (strcmp(type,"port_attributes"))==0)
|
||||
{
|
||||
if(xctx.inst[l].prop_ptr) fprintf(fd, "%s\n", xctx.inst[l].prop_ptr);
|
||||
if(xctx->inst[l].prop_ptr) fprintf(fd, "%s\n", xctx->inst[l].prop_ptr);
|
||||
}
|
||||
}
|
||||
fprintf(fd,"end %s ;\n\n", skip_dir(xctx.sym[i].name) );
|
||||
fprintf(fd,"end %s ;\n\n", skip_dir(xctx->sym[i].name) );
|
||||
|
||||
dbg(1, "vhdl_block_netlist(): architecture\n");
|
||||
fprintf(fd,"architecture arch_%s of %s is\n\n",
|
||||
skip_dir(xctx.sym[i].name), skip_dir(xctx.sym[i].name) );
|
||||
/* skip_dir( xctx.sch[xctx.currsch]), skip_dir( xctx.sch[xctx.currsch])); */
|
||||
skip_dir(xctx->sym[i].name), skip_dir(xctx->sym[i].name) );
|
||||
/* skip_dir( xctx->sch[xctx->currsch]), skip_dir( xctx->sch[xctx->currsch])); */
|
||||
/* load current schematic to print used components */
|
||||
|
||||
dbg(1, "vhdl_block_netlist(): used components\n");
|
||||
/* print all components */
|
||||
if(!vhdl_stop)
|
||||
for(j=0;j<xctx.symbols;j++)
|
||||
for(j=0;j<xctx->symbols;j++)
|
||||
{
|
||||
if( strcmp(get_tok_value(xctx.sym[j].prop_ptr,"vhdl_primitive",0),"true")==0 ) continue;
|
||||
if(!xctx.sym[j].type || (strcmp(xctx.sym[j].type,"primitive")!=0 && strcmp(xctx.sym[j].type,"subcircuit")!=0))
|
||||
if( strcmp(get_tok_value(xctx->sym[j].prop_ptr,"vhdl_primitive",0),"true")==0 ) continue;
|
||||
if(!xctx->sym[j].type || (strcmp(xctx->sym[j].type,"primitive")!=0 && strcmp(xctx->sym[j].type,"subcircuit")!=0))
|
||||
continue;
|
||||
if((
|
||||
strcmp(xctx.sym[j].type,"subcircuit")==0 ||
|
||||
strcmp(xctx.sym[j].type,"primitive")==0
|
||||
) && check_lib(xctx.sym[j].name)
|
||||
strcmp(xctx->sym[j].type,"subcircuit")==0 ||
|
||||
strcmp(xctx->sym[j].type,"primitive")==0
|
||||
) && check_lib(xctx->sym[j].name)
|
||||
)
|
||||
{
|
||||
|
||||
/* only print component declaration if used in current subcircuit */
|
||||
found=0;
|
||||
for(l=0;l<xctx.instances;l++)
|
||||
for(l=0;l<xctx->instances;l++)
|
||||
{
|
||||
if( strcmp(get_tok_value(xctx.inst[l].prop_ptr,"vhdl_ignore",0),"true")==0 ) continue;
|
||||
if(xctx.inst[l].ptr<0) continue;
|
||||
if(!strcmp(get_tok_value( (xctx.inst[l].ptr+ xctx.sym)->prop_ptr, "vhdl_ignore",0 ), "true") ) {
|
||||
if( strcmp(get_tok_value(xctx->inst[l].prop_ptr,"vhdl_ignore",0),"true")==0 ) continue;
|
||||
if(xctx->inst[l].ptr<0) continue;
|
||||
if(!strcmp(get_tok_value( (xctx->inst[l].ptr+ xctx->sym)->prop_ptr, "vhdl_ignore",0 ), "true") ) {
|
||||
continue;
|
||||
}
|
||||
if(!strcmp(xctx.sym[j].name,xctx.inst[l].name))
|
||||
if(!strcmp(xctx->sym[j].name,xctx->inst[l].name))
|
||||
{
|
||||
found=1; break;
|
||||
}
|
||||
|
|
@ -540,17 +540,17 @@ void vhdl_block_netlist(FILE *fd, int i)
|
|||
|
||||
/* component ports */
|
||||
tmp=0;
|
||||
for(k=0;k<xctx.sym[j].rects[PINLAYER];k++)
|
||||
for(k=0;k<xctx->sym[j].rects[PINLAYER];k++)
|
||||
{
|
||||
if(strcmp(get_tok_value(xctx.sym[j].rect[PINLAYER][k].prop_ptr,"vhdl_ignore",0), "true")) {
|
||||
if(strcmp(get_tok_value(xctx->sym[j].rect[PINLAYER][k].prop_ptr,"vhdl_ignore",0), "true")) {
|
||||
my_strdup(597, &sig_type,get_tok_value(
|
||||
xctx.sym[j].rect[PINLAYER][k].prop_ptr,"sig_type",0));
|
||||
xctx->sym[j].rect[PINLAYER][k].prop_ptr,"sig_type",0));
|
||||
my_strdup(598, &port_value, get_tok_value(
|
||||
xctx.sym[j].rect[PINLAYER][k].prop_ptr,"value",2) );
|
||||
xctx->sym[j].rect[PINLAYER][k].prop_ptr,"value",2) );
|
||||
|
||||
if(!sig_type || sig_type[0]=='\0') my_strdup(599, &sig_type,"std_logic");
|
||||
my_strdup(600, &dir_tmp, get_tok_value(xctx.sym[j].rect[PINLAYER][k].prop_ptr,"dir",0) );
|
||||
str_tmp = get_tok_value(xctx.sym[j].rect[PINLAYER][k].prop_ptr,"name",0);
|
||||
my_strdup(600, &dir_tmp, get_tok_value(xctx->sym[j].rect[PINLAYER][k].prop_ptr,"dir",0) );
|
||||
str_tmp = get_tok_value(xctx->sym[j].rect[PINLAYER][k].prop_ptr,"name",0);
|
||||
if(!tmp) fprintf(fd, "port (\n");
|
||||
if(tmp) fprintf(fd, " ;\n");
|
||||
fprintf(fd," %s : %s %s",str_tmp ? str_tmp : "<NULL>",
|
||||
|
|
@ -566,30 +566,30 @@ void vhdl_block_netlist(FILE *fd, int i)
|
|||
}
|
||||
}
|
||||
dbg(1, "vhdl_block_netlist(): netlisting %s\n",
|
||||
skip_dir( xctx.sch[xctx.currsch]));
|
||||
skip_dir( xctx->sch[xctx->currsch]));
|
||||
vhdl_netlist(fd, vhdl_stop);
|
||||
fprintf(fd,"//// begin user architecture code\n");
|
||||
|
||||
|
||||
|
||||
for(l=0;l<xctx.instances;l++) {
|
||||
if( strcmp(get_tok_value(xctx.inst[l].prop_ptr,"vhdl_ignore",0),"true")==0 ) continue;
|
||||
if(xctx.inst[l].ptr<0) continue;
|
||||
if(!strcmp(get_tok_value( (xctx.inst[l].ptr+ xctx.sym)->prop_ptr, "vhdl_ignore",0 ), "true") ) {
|
||||
for(l=0;l<xctx->instances;l++) {
|
||||
if( strcmp(get_tok_value(xctx->inst[l].prop_ptr,"vhdl_ignore",0),"true")==0 ) continue;
|
||||
if(xctx->inst[l].ptr<0) continue;
|
||||
if(!strcmp(get_tok_value( (xctx->inst[l].ptr+ xctx->sym)->prop_ptr, "vhdl_ignore",0 ), "true") ) {
|
||||
continue;
|
||||
}
|
||||
if(netlist_count &&
|
||||
!strcmp(get_tok_value(xctx.inst[l].prop_ptr, "only_toplevel", 0), "true")) continue;
|
||||
!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);
|
||||
my_strdup(601, &type,(xctx->inst[l].ptr+ xctx->sym)->type);
|
||||
if(type && !strcmp(type,"netlist_commands")) {
|
||||
fprintf(fd, "%s\n", get_tok_value(xctx.inst[l].prop_ptr,"value",2));
|
||||
fprintf(fd, "%s\n", get_tok_value(xctx->inst[l].prop_ptr,"value",2));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(xctx.schvhdlprop && xctx.schvhdlprop[0]) fprintf(fd, "%s\n", xctx.schvhdlprop);
|
||||
fprintf(fd, "end arch_%s ;\n\n", skip_dir(xctx.sym[i].name) ); /* skip_dir( xctx.sch[xctx.currsch]) ); */
|
||||
if(xctx->schvhdlprop && xctx->schvhdlprop[0]) fprintf(fd, "%s\n", xctx->schvhdlprop);
|
||||
fprintf(fd, "end arch_%s ;\n\n", skip_dir(xctx->sym[i].name) ); /* skip_dir( xctx->sch[xctx->currsch]) ); */
|
||||
if(split_files) {
|
||||
fclose(fd);
|
||||
my_snprintf(tcl_cmd_netlist, S(tcl_cmd_netlist), "netlist {%s} noshow {%s}", netl_filename, cellname);
|
||||
|
|
@ -615,16 +615,16 @@ void vhdl_netlist(FILE *fd , int vhdl_stop)
|
|||
|
||||
dbg(1, "vhdl_netlist(): architecture declarations\n");
|
||||
fprintf(fd, "//// begin user declarations\n");
|
||||
for(l=0;l<xctx.instances;l++)
|
||||
for(l=0;l<xctx->instances;l++)
|
||||
{
|
||||
if( strcmp(get_tok_value(xctx.inst[l].prop_ptr,"vhdl_ignore",0),"true")==0 ) continue;
|
||||
if(!(xctx.inst[l].ptr+ xctx.sym)->type) continue;
|
||||
if(xctx.inst[l].ptr<0) continue;
|
||||
if(!strcmp(get_tok_value( (xctx.inst[l].ptr+ xctx.sym)->prop_ptr, "vhdl_ignore",0 ), "true") ) {
|
||||
if( strcmp(get_tok_value(xctx->inst[l].prop_ptr,"vhdl_ignore",0),"true")==0 ) continue;
|
||||
if(!(xctx->inst[l].ptr+ xctx->sym)->type) continue;
|
||||
if(xctx->inst[l].ptr<0) continue;
|
||||
if(!strcmp(get_tok_value( (xctx->inst[l].ptr+ xctx->sym)->prop_ptr, "vhdl_ignore",0 ), "true") ) {
|
||||
continue;
|
||||
}
|
||||
if(!strcmp((xctx.inst[l].ptr+ xctx.sym)->type, "arch_declarations") )
|
||||
fprintf(fd, "%s\n", xctx.inst[l].prop_ptr? xctx.inst[l].prop_ptr: "");
|
||||
if(!strcmp((xctx->inst[l].ptr+ xctx->sym)->type, "arch_declarations") )
|
||||
fprintf(fd, "%s\n", xctx->inst[l].prop_ptr? xctx->inst[l].prop_ptr: "");
|
||||
}
|
||||
fprintf(fd, "//// end user declarations\n");
|
||||
|
||||
|
|
@ -634,17 +634,17 @@ void vhdl_netlist(FILE *fd , int vhdl_stop)
|
|||
|
||||
dbg(1, "vhdl_netlist(): attributes\n");
|
||||
fprintf(fd, "//// begin user attributes\n");
|
||||
for(l=0;l<xctx.instances;l++)
|
||||
for(l=0;l<xctx->instances;l++)
|
||||
{
|
||||
if( strcmp(get_tok_value(xctx.inst[l].prop_ptr,"vhdl_ignore",0),"true")==0 ) continue;
|
||||
if(xctx.inst[l].ptr<0) continue;
|
||||
if(!strcmp(get_tok_value( (xctx.inst[l].ptr+ xctx.sym)->prop_ptr, "vhdl_ignore",0 ), "true") ) {
|
||||
if( strcmp(get_tok_value(xctx->inst[l].prop_ptr,"vhdl_ignore",0),"true")==0 ) continue;
|
||||
if(xctx->inst[l].ptr<0) continue;
|
||||
if(!strcmp(get_tok_value( (xctx->inst[l].ptr+ xctx->sym)->prop_ptr, "vhdl_ignore",0 ), "true") ) {
|
||||
continue;
|
||||
}
|
||||
my_strdup(602, &type,(xctx.inst[l].ptr+ xctx.sym)->type);
|
||||
my_strdup(602, &type,(xctx->inst[l].ptr+ xctx->sym)->type);
|
||||
if( type && (strcmp(type,"attributes"))==0)
|
||||
{
|
||||
if(xctx.inst[l].prop_ptr) fprintf(fd, "\n%s\n", xctx.inst[l].prop_ptr);
|
||||
if(xctx->inst[l].prop_ptr) fprintf(fd, "\n%s\n", xctx->inst[l].prop_ptr);
|
||||
}
|
||||
}
|
||||
fprintf(fd, "//// end user attributes\n");
|
||||
|
|
@ -653,15 +653,15 @@ void vhdl_netlist(FILE *fd , int vhdl_stop)
|
|||
fprintf(fd, "begin\n"); /* begin reintroduced 09122003 */
|
||||
if(!vhdl_stop)
|
||||
{
|
||||
for(i=0;i<xctx.instances;i++) /* ... print all element except ipin opin labels use package */
|
||||
for(i=0;i<xctx->instances;i++) /* ... print all element except ipin opin labels use package */
|
||||
{ /* dont print elements with vhdl_ignore=true set in symbol */
|
||||
if( strcmp(get_tok_value(xctx.inst[i].prop_ptr,"vhdl_ignore",0),"true")==0 ) continue;
|
||||
if(xctx.inst[i].ptr<0) continue;
|
||||
if(!strcmp(get_tok_value( (xctx.inst[i].ptr+ xctx.sym)->prop_ptr, "vhdl_ignore",0 ), "true") ) {
|
||||
if( strcmp(get_tok_value(xctx->inst[i].prop_ptr,"vhdl_ignore",0),"true")==0 ) continue;
|
||||
if(xctx->inst[i].ptr<0) continue;
|
||||
if(!strcmp(get_tok_value( (xctx->inst[i].ptr+ xctx->sym)->prop_ptr, "vhdl_ignore",0 ), "true") ) {
|
||||
continue;
|
||||
}
|
||||
dbg(2, "vhdl_netlist(): into the netlisting loop\n");
|
||||
my_strdup(603, &type,(xctx.inst[i].ptr+ xctx.sym)->type);
|
||||
my_strdup(603, &type,(xctx->inst[i].ptr+ xctx->sym)->type);
|
||||
if( type &&
|
||||
( !IS_LABEL_OR_PIN(type) &&
|
||||
strcmp(type,"generic")&&
|
||||
|
|
@ -675,7 +675,7 @@ void vhdl_netlist(FILE *fd , int vhdl_stop)
|
|||
{
|
||||
if(lastselected)
|
||||
{
|
||||
if(xctx.inst[i].sel==SELECTED) {
|
||||
if(xctx->inst[i].sel==SELECTED) {
|
||||
print_vhdl_element(fd, i) ;
|
||||
}
|
||||
} else {
|
||||
|
|
|
|||
264
src/xinit.c
264
src/xinit.c
|
|
@ -330,216 +330,218 @@ void init_pixdata()
|
|||
void free_xschem_data()
|
||||
{
|
||||
int i;
|
||||
my_free(1098, &xctx.wire);
|
||||
my_free(1100, &xctx.text);
|
||||
my_free(1107, &xctx.inst);
|
||||
my_free(1098, &xctx->wire);
|
||||
my_free(1100, &xctx->text);
|
||||
my_free(1107, &xctx->inst);
|
||||
for(i=0;i<cadlayers;i++) {
|
||||
my_free(1103, &xctx.rect[i]);
|
||||
my_free(1104, &xctx.line[i]);
|
||||
my_free(1105, &xctx.poly[i]);
|
||||
my_free(1106, &xctx.arc[i]);
|
||||
my_free(1103, &xctx->rect[i]);
|
||||
my_free(1104, &xctx->line[i]);
|
||||
my_free(1105, &xctx->poly[i]);
|
||||
my_free(1106, &xctx->arc[i]);
|
||||
}
|
||||
for(i=0;i<xctx.maxs;i++) {
|
||||
my_free(1109, &xctx.sym[i].line);
|
||||
my_free(1110, &xctx.sym[i].rect);
|
||||
my_free(1111, &xctx.sym[i].arc);
|
||||
my_free(1112, &xctx.sym[i].poly);
|
||||
my_free(1113, &xctx.sym[i].lines);
|
||||
my_free(1114, &xctx.sym[i].polygons);
|
||||
my_free(1115, &xctx.sym[i].arcs);
|
||||
my_free(1116, &xctx.sym[i].rects);
|
||||
for(i=0;i<xctx->maxs;i++) {
|
||||
my_free(1109, &xctx->sym[i].line);
|
||||
my_free(1110, &xctx->sym[i].rect);
|
||||
my_free(1111, &xctx->sym[i].arc);
|
||||
my_free(1112, &xctx->sym[i].poly);
|
||||
my_free(1113, &xctx->sym[i].lines);
|
||||
my_free(1114, &xctx->sym[i].polygons);
|
||||
my_free(1115, &xctx->sym[i].arcs);
|
||||
my_free(1116, &xctx->sym[i].rects);
|
||||
}
|
||||
my_free(1117, &xctx.sym);
|
||||
my_free(1118, &xctx.rect);
|
||||
my_free(1119, &xctx.line);
|
||||
my_free(1125, &xctx.poly);
|
||||
my_free(1126, &xctx.arc);
|
||||
my_free(1124, &xctx.rects);
|
||||
my_free(1127, &xctx.polygons);
|
||||
my_free(1128, &xctx.arcs);
|
||||
my_free(1129, &xctx.lines);
|
||||
my_free(1130, &xctx.maxr);
|
||||
my_free(1131, &xctx.maxp);
|
||||
my_free(1132, &xctx.maxa);
|
||||
my_free(1133, &xctx.maxl);
|
||||
for(i=0;i<CADMAXHIER;i++) my_free(1139, &xctx.sch_path[i]);
|
||||
my_free(1117, &xctx->sym);
|
||||
my_free(1118, &xctx->rect);
|
||||
my_free(1119, &xctx->line);
|
||||
my_free(1125, &xctx->poly);
|
||||
my_free(1126, &xctx->arc);
|
||||
my_free(1124, &xctx->rects);
|
||||
my_free(1127, &xctx->polygons);
|
||||
my_free(1128, &xctx->arcs);
|
||||
my_free(1129, &xctx->lines);
|
||||
my_free(1130, &xctx->maxr);
|
||||
my_free(1131, &xctx->maxp);
|
||||
my_free(1132, &xctx->maxa);
|
||||
my_free(1133, &xctx->maxl);
|
||||
for(i=0;i<CADMAXHIER;i++) my_free(1139, &xctx->sch_path[i]);
|
||||
|
||||
my_free(269, &xctx);
|
||||
|
||||
}
|
||||
|
||||
void alloc_xschem_data()
|
||||
{
|
||||
int i;
|
||||
xctx = my_calloc(152, 1, sizeof(Xschem_ctx));
|
||||
xctx->zoom=CADINITIALZOOM;
|
||||
xctx->mooz=1/CADINITIALZOOM;
|
||||
xctx->xorigin=CADINITIALX;
|
||||
xctx->yorigin=CADINITIALY;
|
||||
xctx->wires = 0;
|
||||
xctx->instances = 0;
|
||||
xctx->symbols = 0;
|
||||
xctx->texts = 0;
|
||||
xctx->schprop = NULL; /* SPICE */
|
||||
xctx->schtedaxprop=NULL; /* tEDAx */
|
||||
xctx->schvhdlprop=NULL; /* vhdl property string */
|
||||
xctx->schsymbolprop=NULL; /* symbol property string */
|
||||
xctx->schverilogprop=NULL;/* verilog */
|
||||
xctx->version_string = NULL;
|
||||
xctx->currsch = 0;
|
||||
for(i=0;i<CADMAXHIER;i++) xctx->sch_path[i]=NULL;
|
||||
my_strdup(1187, &xctx->sch_path[0],".");
|
||||
xctx->sch_inst_number[0] = 1;
|
||||
|
||||
xctx.zoom=CADINITIALZOOM;
|
||||
xctx.mooz=1/CADINITIALZOOM;
|
||||
xctx.xorigin=CADINITIALX;
|
||||
xctx.yorigin=CADINITIALY;
|
||||
xctx.wires = 0;
|
||||
xctx.instances = 0;
|
||||
xctx.symbols = 0;
|
||||
xctx.texts = 0;
|
||||
xctx.schprop = NULL; /* SPICE */
|
||||
xctx.schtedaxprop=NULL; /* tEDAx */
|
||||
xctx.schvhdlprop=NULL; /* vhdl property string */
|
||||
xctx.schsymbolprop=NULL; /* symbol property string */
|
||||
xctx.schverilogprop=NULL;/* verilog */
|
||||
xctx.version_string = NULL;
|
||||
xctx.currsch = 0;
|
||||
for(i=0;i<CADMAXHIER;i++) xctx.sch_path[i]=NULL;
|
||||
my_strdup(1187, &xctx.sch_path[0],".");
|
||||
xctx.sch_inst_number[0] = 1;
|
||||
|
||||
xctx.maxt=CADMAXTEXT;
|
||||
xctx.maxw=CADMAXWIRES;
|
||||
xctx.maxi=ELEMINST;
|
||||
xctx.maxs=ELEMDEF;
|
||||
xctx.text=my_calloc(606, xctx.maxt,sizeof(xText));
|
||||
if(xctx.text==NULL){
|
||||
xctx->maxt=CADMAXTEXT;
|
||||
xctx->maxw=CADMAXWIRES;
|
||||
xctx->maxi=ELEMINST;
|
||||
xctx->maxs=ELEMDEF;
|
||||
xctx->text=my_calloc(606, xctx->maxt,sizeof(xText));
|
||||
if(xctx->text==NULL){
|
||||
fprintf(errfp, "Tcl_AppInit(): calloc error\n");tcleval( "exit");
|
||||
}
|
||||
|
||||
xctx.wire=my_calloc(607, xctx.maxw,sizeof(xWire));
|
||||
if(xctx.wire==NULL){
|
||||
xctx->wire=my_calloc(607, xctx->maxw,sizeof(xWire));
|
||||
if(xctx->wire==NULL){
|
||||
fprintf(errfp, "Tcl_AppInit(): calloc error\n");tcleval( "exit");
|
||||
}
|
||||
|
||||
xctx.inst=my_calloc(609, xctx.maxi , sizeof(xInstance) );
|
||||
if(xctx.inst==NULL){
|
||||
xctx->inst=my_calloc(609, xctx->maxi , sizeof(xInstance) );
|
||||
if(xctx->inst==NULL){
|
||||
fprintf(errfp, "Tcl_AppInit(): calloc error\n");tcleval( "exit");
|
||||
}
|
||||
|
||||
xctx.sym=my_calloc(610, xctx.maxs , sizeof(xSymbol) );
|
||||
if(xctx.sym==NULL){
|
||||
xctx->sym=my_calloc(610, xctx->maxs , sizeof(xSymbol) );
|
||||
if(xctx->sym==NULL){
|
||||
fprintf(errfp, "Tcl_AppInit(): calloc error\n");tcleval( "exit");
|
||||
}
|
||||
for(i=0;i<xctx.maxs;i++) {
|
||||
xctx.sym[i].line=my_calloc(611, cadlayers, sizeof(xLine *));
|
||||
if(xctx.sym[i].line==NULL){
|
||||
for(i=0;i<xctx->maxs;i++) {
|
||||
xctx->sym[i].line=my_calloc(611, cadlayers, sizeof(xLine *));
|
||||
if(xctx->sym[i].line==NULL){
|
||||
fprintf(errfp, "Tcl_AppInit(): calloc error\n");tcleval( "exit");
|
||||
}
|
||||
|
||||
xctx.sym[i].poly=my_calloc(612, cadlayers, sizeof(xPoly *));
|
||||
if(xctx.sym[i].poly==NULL){
|
||||
xctx->sym[i].poly=my_calloc(612, cadlayers, sizeof(xPoly *));
|
||||
if(xctx->sym[i].poly==NULL){
|
||||
fprintf(errfp, "Tcl_AppInit(): calloc error\n");tcleval( "exit");
|
||||
}
|
||||
|
||||
xctx.sym[i].arc=my_calloc(613, cadlayers, sizeof(xArc *));
|
||||
if(xctx.sym[i].arc==NULL){
|
||||
xctx->sym[i].arc=my_calloc(613, cadlayers, sizeof(xArc *));
|
||||
if(xctx->sym[i].arc==NULL){
|
||||
fprintf(errfp, "Tcl_AppInit(): calloc error\n");tcleval( "exit");
|
||||
}
|
||||
|
||||
xctx.sym[i].rect=my_calloc(614, cadlayers, sizeof(xRect *));
|
||||
if(xctx.sym[i].rect==NULL){
|
||||
xctx->sym[i].rect=my_calloc(614, cadlayers, sizeof(xRect *));
|
||||
if(xctx->sym[i].rect==NULL){
|
||||
fprintf(errfp, "Tcl_AppInit(): calloc error\n");tcleval( "exit");
|
||||
}
|
||||
|
||||
xctx.sym[i].lines=my_calloc(615, cadlayers, sizeof(int));
|
||||
if(xctx.sym[i].lines==NULL){
|
||||
xctx->sym[i].lines=my_calloc(615, cadlayers, sizeof(int));
|
||||
if(xctx->sym[i].lines==NULL){
|
||||
fprintf(errfp, "Tcl_AppInit(): calloc error\n");tcleval( "exit");
|
||||
}
|
||||
|
||||
xctx.sym[i].rects=my_calloc(616, cadlayers, sizeof(int));
|
||||
if(xctx.sym[i].rects==NULL){
|
||||
xctx->sym[i].rects=my_calloc(616, cadlayers, sizeof(int));
|
||||
if(xctx->sym[i].rects==NULL){
|
||||
fprintf(errfp, "Tcl_AppInit(): calloc error\n");tcleval( "exit");
|
||||
}
|
||||
xctx.sym[i].arcs=my_calloc(617, cadlayers, sizeof(int));
|
||||
if(xctx.sym[i].arcs==NULL){
|
||||
xctx->sym[i].arcs=my_calloc(617, cadlayers, sizeof(int));
|
||||
if(xctx->sym[i].arcs==NULL){
|
||||
fprintf(errfp, "Tcl_AppInit(): calloc error\n");tcleval( "exit");
|
||||
}
|
||||
xctx.sym[i].polygons=my_calloc(618, cadlayers, sizeof(int));
|
||||
if(xctx.sym[i].polygons==NULL){
|
||||
xctx->sym[i].polygons=my_calloc(618, cadlayers, sizeof(int));
|
||||
if(xctx->sym[i].polygons==NULL){
|
||||
fprintf(errfp, "Tcl_AppInit(): calloc error\n");tcleval( "exit");
|
||||
}
|
||||
}
|
||||
|
||||
xctx.maxr=my_calloc(620, cadlayers, sizeof(int));
|
||||
if(xctx.maxr==NULL){
|
||||
xctx->maxr=my_calloc(620, cadlayers, sizeof(int));
|
||||
if(xctx->maxr==NULL){
|
||||
fprintf(errfp, "Tcl_AppInit(): calloc error\n");tcleval( "exit");
|
||||
}
|
||||
|
||||
xctx.maxa=my_calloc(621, cadlayers, sizeof(int));
|
||||
if(xctx.maxa==NULL){
|
||||
xctx->maxa=my_calloc(621, cadlayers, sizeof(int));
|
||||
if(xctx->maxa==NULL){
|
||||
fprintf(errfp, "Tcl_AppInit(): max_arcscalloc error\n");tcleval( "exit");
|
||||
}
|
||||
|
||||
xctx.maxp=my_calloc(622, cadlayers, sizeof(int));
|
||||
if(xctx.maxp==NULL){
|
||||
xctx->maxp=my_calloc(622, cadlayers, sizeof(int));
|
||||
if(xctx->maxp==NULL){
|
||||
fprintf(errfp, "Tcl_AppInit(): calloc error\n");tcleval( "exit");
|
||||
}
|
||||
|
||||
xctx.maxl=my_calloc(623, cadlayers, sizeof(int));
|
||||
if(xctx.maxl==NULL){
|
||||
xctx->maxl=my_calloc(623, cadlayers, sizeof(int));
|
||||
if(xctx->maxl==NULL){
|
||||
fprintf(errfp, "Tcl_AppInit(): calloc error\n");tcleval( "exit");
|
||||
}
|
||||
|
||||
for(i=0;i<cadlayers;i++)
|
||||
{
|
||||
xctx.maxr[i]=CADMAXOBJECTS;
|
||||
xctx.maxp[i]=CADMAXOBJECTS;
|
||||
xctx.maxl[i]=CADMAXOBJECTS;
|
||||
xctx.maxa[i]=CADMAXOBJECTS;
|
||||
xctx->maxr[i]=CADMAXOBJECTS;
|
||||
xctx->maxp[i]=CADMAXOBJECTS;
|
||||
xctx->maxl[i]=CADMAXOBJECTS;
|
||||
xctx->maxa[i]=CADMAXOBJECTS;
|
||||
}
|
||||
|
||||
xctx.rect=my_calloc(624, cadlayers, sizeof(xRect *));
|
||||
if(xctx.rect==NULL){
|
||||
xctx->rect=my_calloc(624, cadlayers, sizeof(xRect *));
|
||||
if(xctx->rect==NULL){
|
||||
fprintf(errfp, "Tcl_AppInit(): calloc error\n");tcleval( "exit");
|
||||
}
|
||||
|
||||
xctx.line=my_calloc(625, cadlayers, sizeof(xLine *));
|
||||
if(xctx.line==NULL){
|
||||
xctx->line=my_calloc(625, cadlayers, sizeof(xLine *));
|
||||
if(xctx->line==NULL){
|
||||
fprintf(errfp, "Tcl_AppInit(): calloc error\n");tcleval( "exit");
|
||||
}
|
||||
|
||||
xctx.poly=my_calloc(626, cadlayers, sizeof(xPoly *));
|
||||
if(xctx.poly==NULL){
|
||||
xctx->poly=my_calloc(626, cadlayers, sizeof(xPoly *));
|
||||
if(xctx->poly==NULL){
|
||||
fprintf(errfp, "Tcl_AppInit(): calloc error\n");tcleval( "exit");
|
||||
}
|
||||
|
||||
xctx.arc=my_calloc(627, cadlayers, sizeof(xArc *));
|
||||
if(xctx.arc==NULL){
|
||||
xctx->arc=my_calloc(627, cadlayers, sizeof(xArc *));
|
||||
if(xctx->arc==NULL){
|
||||
fprintf(errfp, "Tcl_AppInit(): arc calloc error\n");tcleval( "exit");
|
||||
}
|
||||
|
||||
for(i=0;i<cadlayers;i++)
|
||||
{
|
||||
xctx.rect[i]=my_calloc(628, xctx.maxr[i],sizeof(xRect));
|
||||
if(xctx.rect[i]==NULL){
|
||||
xctx->rect[i]=my_calloc(628, xctx->maxr[i],sizeof(xRect));
|
||||
if(xctx->rect[i]==NULL){
|
||||
fprintf(errfp, "Tcl_AppInit(): calloc error\n");tcleval( "exit");
|
||||
}
|
||||
|
||||
xctx.arc[i]=my_calloc(629, xctx.maxa[i],sizeof(xArc));
|
||||
if(xctx.arc[i]==NULL){
|
||||
xctx->arc[i]=my_calloc(629, xctx->maxa[i],sizeof(xArc));
|
||||
if(xctx->arc[i]==NULL){
|
||||
fprintf(errfp, "Tcl_AppInit(): arc[] calloc error\n");tcleval( "exit");
|
||||
}
|
||||
|
||||
xctx.poly[i]=my_calloc(630, xctx.maxp[i],sizeof(xPoly));
|
||||
if(xctx.poly[i]==NULL){
|
||||
xctx->poly[i]=my_calloc(630, xctx->maxp[i],sizeof(xPoly));
|
||||
if(xctx->poly[i]==NULL){
|
||||
fprintf(errfp, "Tcl_AppInit(): calloc error\n");tcleval( "exit");
|
||||
}
|
||||
|
||||
xctx.line[i]=my_calloc(631, xctx.maxl[i],sizeof(xLine));
|
||||
if(xctx.line[i]==NULL){
|
||||
xctx->line[i]=my_calloc(631, xctx->maxl[i],sizeof(xLine));
|
||||
if(xctx->line[i]==NULL){
|
||||
fprintf(errfp, "Tcl_AppInit(): calloc error\n");tcleval( "exit");
|
||||
}
|
||||
}
|
||||
|
||||
xctx.rects=my_calloc(632, cadlayers, sizeof(int));
|
||||
if(xctx.rects==NULL){
|
||||
xctx->rects=my_calloc(632, cadlayers, sizeof(int));
|
||||
if(xctx->rects==NULL){
|
||||
fprintf(errfp, "Tcl_AppInit(): calloc error\n");tcleval( "exit");
|
||||
}
|
||||
|
||||
xctx.polygons=my_calloc(633, cadlayers, sizeof(int));
|
||||
if(xctx.polygons==NULL){
|
||||
xctx->polygons=my_calloc(633, cadlayers, sizeof(int));
|
||||
if(xctx->polygons==NULL){
|
||||
fprintf(errfp, "Tcl_AppInit(): calloc error\n");tcleval( "exit");
|
||||
}
|
||||
|
||||
xctx.arcs=my_calloc(634, cadlayers, sizeof(int));
|
||||
if(xctx.arcs==NULL){
|
||||
xctx->arcs=my_calloc(634, cadlayers, sizeof(int));
|
||||
if(xctx->arcs==NULL){
|
||||
fprintf(errfp, "Tcl_AppInit(): calloc error\n");tcleval( "exit");
|
||||
}
|
||||
|
||||
xctx.lines=my_calloc(635, cadlayers, sizeof(int));
|
||||
if(xctx.lines==NULL){
|
||||
xctx->lines=my_calloc(635, cadlayers, sizeof(int));
|
||||
if(xctx->lines==NULL){
|
||||
fprintf(errfp, "Tcl_AppInit(): calloc error\n");tcleval( "exit");
|
||||
}
|
||||
}
|
||||
|
|
@ -800,23 +802,23 @@ void preview_window(const char *what, const char *tk_win_path, const char *filen
|
|||
int save_mod, save_ev, save_show_pin;
|
||||
|
||||
/* save context */
|
||||
xor = xctx.xorigin;
|
||||
yor = xctx.yorigin;
|
||||
z = xctx.zoom;
|
||||
xor = xctx->xorigin;
|
||||
yor = xctx->yorigin;
|
||||
z = xctx->zoom;
|
||||
save_window = window;
|
||||
save_mod = modified;
|
||||
save_ev = event_reporting;
|
||||
event_reporting = 0;
|
||||
save_show_pin = show_pin_net_names;
|
||||
show_pin_net_names = 0;
|
||||
my_strncpy(save_name, xctx.current_name, S(save_name));
|
||||
my_strncpy(save_name, xctx->current_name, S(save_name));
|
||||
my_strdup(117, &saveptr, tclgetvar("current_dirname"));
|
||||
push_undo();
|
||||
my_strdup(114, &xctx.sch_path[xctx.currsch+1], xctx.sch_path[xctx.currsch]);
|
||||
my_strcat(115, &xctx.sch_path[xctx.currsch+1], "___preview___");
|
||||
my_strcat(116, &xctx.sch_path[xctx.currsch+1], ".");
|
||||
xctx.sch_inst_number[xctx.currsch+1] = 1;
|
||||
xctx.currsch++;
|
||||
my_strdup(114, &xctx->sch_path[xctx->currsch+1], xctx->sch_path[xctx->currsch]);
|
||||
my_strcat(115, &xctx->sch_path[xctx->currsch+1], "___preview___");
|
||||
my_strcat(116, &xctx->sch_path[xctx->currsch+1], ".");
|
||||
xctx->sch_inst_number[xctx->currsch+1] = 1;
|
||||
xctx->currsch++;
|
||||
|
||||
unselect_all();
|
||||
remove_symbols();
|
||||
|
|
@ -835,21 +837,21 @@ void preview_window(const char *what, const char *tk_win_path, const char *filen
|
|||
my_free(1144, &saveptr);
|
||||
unselect_all();
|
||||
remove_symbols();
|
||||
my_strncpy(xctx.sch[xctx.currsch] , "", S(xctx.sch[xctx.currsch]));
|
||||
xctx.currsch--;
|
||||
my_strncpy(xctx->sch[xctx->currsch] , "", S(xctx->sch[xctx->currsch]));
|
||||
xctx->currsch--;
|
||||
clear_drawing();
|
||||
show_pin_net_names = save_show_pin;
|
||||
pop_undo(0);
|
||||
modified = save_mod;
|
||||
set_modify(modified);
|
||||
window = save_window;
|
||||
xctx.xorigin = xor;
|
||||
xctx.yorigin = yor;
|
||||
xctx.zoom = z;
|
||||
xctx.mooz = 1/z;
|
||||
xctx->xorigin = xor;
|
||||
xctx->yorigin = yor;
|
||||
xctx->zoom = z;
|
||||
xctx->mooz = 1/z;
|
||||
resetwin();
|
||||
change_linewidth(-1.);
|
||||
my_strncpy(xctx.current_name, save_name, S(save_name));
|
||||
my_strncpy(xctx->current_name, save_name, S(save_name));
|
||||
draw();
|
||||
event_reporting = save_ev;
|
||||
}
|
||||
|
|
@ -1198,7 +1200,7 @@ int Tcl_AppInit(Tcl_Interp *inter)
|
|||
xrect[0].height = CADHEIGHT;
|
||||
|
||||
|
||||
my_strncpy(xctx.file_version, XSCHEM_FILE_VERSION, S(xctx.file_version));
|
||||
my_strncpy(xctx->file_version, XSCHEM_FILE_VERSION, S(xctx->file_version));
|
||||
compile_font();
|
||||
/* restore current dir after loading font */
|
||||
if(tcleval("info exists env(PWD)")[0] == '1') {
|
||||
|
|
|
|||
10
src/xschem.h
10
src/xschem.h
|
|
@ -293,10 +293,10 @@ extern char win_temp_dir[PATH_MAX];
|
|||
#define IS_PIN(type) (!(strcmp(type,"ipin") && strcmp(type,"opin") && strcmp(type,"iopin")))
|
||||
|
||||
|
||||
#define X_TO_SCREEN(x) ( floor((x+xctx.xorigin)* xctx.mooz) )
|
||||
#define Y_TO_SCREEN(y) ( floor((y+xctx.yorigin)* xctx.mooz) )
|
||||
#define X_TO_XSCHEM(x) ((x)*xctx.zoom -xctx.xorigin)
|
||||
#define Y_TO_XSCHEM(y) ((y)*xctx.zoom -xctx.yorigin)
|
||||
#define X_TO_SCREEN(x) ( floor((x+xctx->xorigin)* xctx->mooz) )
|
||||
#define Y_TO_SCREEN(y) ( floor((y+xctx->yorigin)* xctx->mooz) )
|
||||
#define X_TO_XSCHEM(x) ((x)*xctx->zoom -xctx->xorigin)
|
||||
#define Y_TO_XSCHEM(y) ((y)*xctx->zoom -xctx->yorigin)
|
||||
|
||||
typedef struct
|
||||
{
|
||||
|
|
@ -557,7 +557,7 @@ struct instentry {
|
|||
};
|
||||
|
||||
/* GLOBAL VARIABLES */
|
||||
extern Xschem_ctx xctx;
|
||||
extern Xschem_ctx *xctx;
|
||||
extern int help;
|
||||
extern char *cad_icon[];
|
||||
extern int semaphore;
|
||||
|
|
|
|||
Loading…
Reference in New Issue