use pre-increment where expression is not used
This commit is contained in:
parent
01bc76955e
commit
a8aaf996e7
|
|
@ -56,7 +56,7 @@ unsigned int hash_file(const char *f, int skip_path_lines)
|
|||
}
|
||||
}
|
||||
n = strlen(line);
|
||||
for(i = 0; i < n; i++) {
|
||||
for(i = 0; i < n; ++i) {
|
||||
/* skip CRs so hashes will match on unix / windows */
|
||||
if(line[i] == '\r') {
|
||||
cr = 1;
|
||||
|
|
@ -484,8 +484,8 @@ void remove_symbol(int j)
|
|||
my_free(_ALLOC_ID_, &xctx->sym[j].type);
|
||||
my_free(_ALLOC_ID_, &xctx->sym[j].name);
|
||||
/* /20150409 */
|
||||
for(c=0;c<cadlayers;c++) {
|
||||
for(i=0;i<xctx->sym[j].polygons[c];i++) {
|
||||
for(c=0;c<cadlayers; ++c) {
|
||||
for(i=0;i<xctx->sym[j].polygons[c]; ++i) {
|
||||
if(xctx->sym[j].poly[c][i].prop_ptr != NULL) {
|
||||
my_free(_ALLOC_ID_, &xctx->sym[j].poly[c][i].prop_ptr);
|
||||
}
|
||||
|
|
@ -496,7 +496,7 @@ void remove_symbol(int j)
|
|||
my_free(_ALLOC_ID_, &xctx->sym[j].poly[c]);
|
||||
xctx->sym[j].polygons[c] = 0;
|
||||
|
||||
for(i=0;i<xctx->sym[j].lines[c];i++) {
|
||||
for(i=0;i<xctx->sym[j].lines[c]; ++i) {
|
||||
if(xctx->sym[j].line[c][i].prop_ptr != NULL) {
|
||||
my_free(_ALLOC_ID_, &xctx->sym[j].line[c][i].prop_ptr);
|
||||
}
|
||||
|
|
@ -504,7 +504,7 @@ void remove_symbol(int j)
|
|||
my_free(_ALLOC_ID_, &xctx->sym[j].line[c]);
|
||||
xctx->sym[j].lines[c] = 0;
|
||||
|
||||
for(i=0;i<xctx->sym[j].arcs[c];i++) {
|
||||
for(i=0;i<xctx->sym[j].arcs[c]; ++i) {
|
||||
if(xctx->sym[j].arc[c][i].prop_ptr != NULL) {
|
||||
my_free(_ALLOC_ID_, &xctx->sym[j].arc[c][i].prop_ptr);
|
||||
}
|
||||
|
|
@ -512,7 +512,7 @@ void remove_symbol(int j)
|
|||
my_free(_ALLOC_ID_, &xctx->sym[j].arc[c]);
|
||||
xctx->sym[j].arcs[c] = 0;
|
||||
|
||||
for(i=0;i<xctx->sym[j].rects[c];i++) {
|
||||
for(i=0;i<xctx->sym[j].rects[c]; ++i) {
|
||||
if(xctx->sym[j].rect[c][i].prop_ptr != NULL) {
|
||||
my_free(_ALLOC_ID_, &xctx->sym[j].rect[c][i].prop_ptr);
|
||||
}
|
||||
|
|
@ -521,7 +521,7 @@ void remove_symbol(int j)
|
|||
my_free(_ALLOC_ID_, &xctx->sym[j].rect[c]);
|
||||
xctx->sym[j].rects[c] = 0;
|
||||
}
|
||||
for(i=0;i<xctx->sym[j].texts;i++) {
|
||||
for(i=0;i<xctx->sym[j].texts; ++i) {
|
||||
if(xctx->sym[j].text[i].prop_ptr != NULL) {
|
||||
my_free(_ALLOC_ID_, &xctx->sym[j].text[i].prop_ptr);
|
||||
}
|
||||
|
|
@ -536,7 +536,7 @@ void remove_symbol(int j)
|
|||
xctx->sym[j].texts = 0;
|
||||
|
||||
save = xctx->sym[j]; /* save cleared symbol slot */
|
||||
for(i = j + 1; i < xctx->symbols; i++) {
|
||||
for(i = j + 1; i < xctx->symbols; ++i) {
|
||||
xctx->sym[i-1] = xctx->sym[i];
|
||||
}
|
||||
xctx->sym[xctx->symbols-1] = save; /* fill end with cleared symbol slot */
|
||||
|
|
@ -547,7 +547,7 @@ void remove_symbols(void)
|
|||
{
|
||||
int j;
|
||||
|
||||
for(j = 0; j < xctx->instances; j++) {
|
||||
for(j = 0; j < xctx->instances; ++j) {
|
||||
delete_inst_node(j); /* must be deleted before symbols are deleted */
|
||||
xctx->inst[j].ptr = -1; /* clear symbol reference on instanecs */
|
||||
}
|
||||
|
|
@ -649,13 +649,13 @@ void clear_drawing(void)
|
|||
my_free(_ALLOC_ID_, &xctx->version_string);
|
||||
if(xctx->header_text) my_free(_ALLOC_ID_, &xctx->header_text);
|
||||
my_free(_ALLOC_ID_, &xctx->schverilogprop);
|
||||
for(i=0;i<xctx->wires;i++)
|
||||
for(i=0;i<xctx->wires; ++i)
|
||||
{
|
||||
my_free(_ALLOC_ID_, &xctx->wire[i].prop_ptr);
|
||||
my_free(_ALLOC_ID_, &xctx->wire[i].node);
|
||||
}
|
||||
xctx->wires = 0;
|
||||
for(i=0;i<xctx->instances;i++)
|
||||
for(i=0;i<xctx->instances; ++i)
|
||||
{
|
||||
my_free(_ALLOC_ID_, &xctx->inst[i].prop_ptr);
|
||||
my_free(_ALLOC_ID_, &xctx->inst[i].name);
|
||||
|
|
@ -664,29 +664,29 @@ void clear_drawing(void)
|
|||
delete_inst_node(i);
|
||||
}
|
||||
xctx->instances = 0;
|
||||
for(i=0;i<xctx->texts;i++)
|
||||
for(i=0;i<xctx->texts; ++i)
|
||||
{
|
||||
my_free(_ALLOC_ID_, &xctx->text[i].font);
|
||||
my_free(_ALLOC_ID_, &xctx->text[i].prop_ptr);
|
||||
my_free(_ALLOC_ID_, &xctx->text[i].txt_ptr);
|
||||
}
|
||||
xctx->texts = 0;
|
||||
for(i=0;i<cadlayers;i++)
|
||||
for(i=0;i<cadlayers; ++i)
|
||||
{
|
||||
for(j=0;j<xctx->lines[i];j++)
|
||||
for(j=0;j<xctx->lines[i]; ++j)
|
||||
{
|
||||
my_free(_ALLOC_ID_, &xctx->line[i][j].prop_ptr);
|
||||
}
|
||||
for(j=0;j<xctx->rects[i];j++)
|
||||
for(j=0;j<xctx->rects[i]; ++j)
|
||||
{
|
||||
my_free(_ALLOC_ID_, &xctx->rect[i][j].prop_ptr);
|
||||
set_rect_extraptr(0, &xctx->rect[i][j]);
|
||||
}
|
||||
for(j=0;j<xctx->arcs[i];j++)
|
||||
for(j=0;j<xctx->arcs[i]; ++j)
|
||||
{
|
||||
my_free(_ALLOC_ID_, &xctx->arc[i][j].prop_ptr);
|
||||
}
|
||||
for(j=0;j<xctx->polygons[i]; j++) {
|
||||
for(j=0;j<xctx->polygons[i]; ++j) {
|
||||
my_free(_ALLOC_ID_, &xctx->poly[i][j].x);
|
||||
my_free(_ALLOC_ID_, &xctx->poly[i][j].y);
|
||||
my_free(_ALLOC_ID_, &xctx->poly[i][j].prop_ptr);
|
||||
|
|
@ -707,7 +707,7 @@ void enable_layers(void)
|
|||
char tmp[50];
|
||||
const char *en;
|
||||
xctx->n_active_layers = 0;
|
||||
for(i = 0; i< cadlayers; i++) {
|
||||
for(i = 0; i< cadlayers; ++i) {
|
||||
my_snprintf(tmp, S(tmp), "enable_layer(%d)",i);
|
||||
en = tclgetvar(tmp);
|
||||
if(!en || en[0] == '0') xctx->enable_layer[i] = 0;
|
||||
|
|
@ -737,7 +737,7 @@ short connect_by_kissing(void)
|
|||
rebuild_selected_array();
|
||||
k = xctx->lastsel;
|
||||
prepare_netlist_structs(0);
|
||||
for(j=0;j<k;j++) if(xctx->sel_array[j].type==ELEMENT) {
|
||||
for(j=0;j<k; ++j) if(xctx->sel_array[j].type==ELEMENT) {
|
||||
x0 = xctx->inst[xctx->sel_array[j].n].x0;
|
||||
y0 = xctx->inst[xctx->sel_array[j].n].y0;
|
||||
rot = xctx->inst[xctx->sel_array[j].n].rot;
|
||||
|
|
@ -745,7 +745,7 @@ short connect_by_kissing(void)
|
|||
symbol = xctx->sym + xctx->inst[xctx->sel_array[j].n].ptr;
|
||||
npin = symbol->rects[PINLAYER];
|
||||
rct=symbol->rect[PINLAYER];
|
||||
for(i=0;i<npin;i++) {
|
||||
for(i=0;i<npin; ++i) {
|
||||
pinx0 = (rct[i].x1+rct[i].x2)/2;
|
||||
piny0 = (rct[i].y1+rct[i].y2)/2;
|
||||
ROTATION(rot, flip, 0.0, 0.0, pinx0, piny0, pinx0, piny0);
|
||||
|
|
@ -832,7 +832,7 @@ void attach_labels_to_inst(int interactive) /* offloaded from callback.c 201710
|
|||
k = xctx->lastsel;
|
||||
first_call=1; /* 20171214 for place_symbol--> new_prop_string */
|
||||
prepare_netlist_structs(0);
|
||||
for(j=0;j<k;j++) if(xctx->sel_array[j].type==ELEMENT) {
|
||||
for(j=0;j<k; ++j) if(xctx->sel_array[j].type==ELEMENT) {
|
||||
found=1;
|
||||
my_strdup(_ALLOC_ID_, &prop, xctx->inst[xctx->sel_array[j].n].instname);
|
||||
my_strcat(_ALLOC_ID_, &prop, "_");
|
||||
|
|
@ -876,7 +876,7 @@ void attach_labels_to_inst(int interactive) /* offloaded from callback.c 201710
|
|||
npin = symbol->rects[PINLAYER];
|
||||
rct=symbol->rect[PINLAYER];
|
||||
|
||||
for(i=0;i<npin;i++) {
|
||||
for(i=0;i<npin; ++i) {
|
||||
my_strdup(_ALLOC_ID_, &labname,get_tok_value(rct[i].prop_ptr,"name",1));
|
||||
dbg(1,"attach_labels_to_inst(): 2 --> labname=%s\n", labname);
|
||||
|
||||
|
|
@ -1480,30 +1480,30 @@ void calc_drawing_bbox(xRect *boundbox, int selected)
|
|||
boundbox->x2=100;
|
||||
boundbox->y1=-100;
|
||||
boundbox->y2=100;
|
||||
if(selected != 2) for(c=0;c<cadlayers;c++)
|
||||
if(selected != 2) for(c=0;c<cadlayers; ++c)
|
||||
{
|
||||
const char *tmp = tclgetvar("hide_empty_graphs");
|
||||
int hide_graphs = (tmp && tmp[0] == '1') ? 1 : 0;
|
||||
int waves = (sch_waves_loaded() >= 0);
|
||||
|
||||
for(i=0;i<xctx->lines[c];i++)
|
||||
for(i=0;i<xctx->lines[c]; ++i)
|
||||
{
|
||||
if(selected == 1 && !xctx->line[c][i].sel) continue;
|
||||
rect.x1=xctx->line[c][i].x1;
|
||||
rect.x2=xctx->line[c][i].x2;
|
||||
rect.y1=xctx->line[c][i].y1;
|
||||
rect.y2=xctx->line[c][i].y2;
|
||||
count++;
|
||||
++count;
|
||||
updatebbox(count,boundbox,&rect);
|
||||
}
|
||||
|
||||
for(i=0;i<xctx->polygons[c];i++)
|
||||
for(i=0;i<xctx->polygons[c]; ++i)
|
||||
{
|
||||
double x1=0., y1=0., x2=0., y2=0.;
|
||||
int k;
|
||||
if(selected == 1 && !xctx->poly[c][i].sel) continue;
|
||||
count++;
|
||||
for(k=0; k<xctx->poly[c][i].points; k++) {
|
||||
++count;
|
||||
for(k=0; k<xctx->poly[c][i].points; ++k) {
|
||||
/* fprintf(errfp, " poly: point %d: %.16g %.16g\n", k, pp[c][i].x[k], pp[c][i].y[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];
|
||||
|
|
@ -1514,16 +1514,16 @@ void calc_drawing_bbox(xRect *boundbox, int selected)
|
|||
updatebbox(count,boundbox,&rect);
|
||||
}
|
||||
|
||||
for(i=0;i<xctx->arcs[c];i++)
|
||||
for(i=0;i<xctx->arcs[c]; ++i)
|
||||
{
|
||||
if(selected == 1 && !xctx->arc[c][i].sel) continue;
|
||||
arc_bbox(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,
|
||||
&rect.x1, &rect.y1, &rect.x2, &rect.y2);
|
||||
count++;
|
||||
++count;
|
||||
updatebbox(count,boundbox,&rect);
|
||||
}
|
||||
|
||||
for(i=0;i<xctx->rects[c];i++)
|
||||
for(i=0;i<xctx->rects[c]; ++i)
|
||||
{
|
||||
if(selected == 1 && !xctx->rect[c][i].sel) continue;
|
||||
/* skip graph objects if no datafile loaded */
|
||||
|
|
@ -1534,12 +1534,12 @@ void calc_drawing_bbox(xRect *boundbox, int selected)
|
|||
rect.x2=xctx->rect[c][i].x2;
|
||||
rect.y1=xctx->rect[c][i].y1;
|
||||
rect.y2=xctx->rect[c][i].y2;
|
||||
count++;
|
||||
++count;
|
||||
updatebbox(count,boundbox,&rect);
|
||||
}
|
||||
}
|
||||
if(selected == 2 && xctx->hilight_nets) prepare_netlist_structs(0);
|
||||
for(i=0;i<xctx->wires;i++)
|
||||
for(i=0;i<xctx->wires; ++i)
|
||||
{
|
||||
double ov, y1, y2;
|
||||
if(selected == 1 && !xctx->wire[i].sel) continue;
|
||||
|
|
@ -1564,10 +1564,10 @@ void calc_drawing_bbox(xRect *boundbox, int selected)
|
|||
rect.x2 = xctx->wire[i].x2+ov;
|
||||
rect.y1 = y1;
|
||||
rect.y2 = y2;
|
||||
count++;
|
||||
++count;
|
||||
updatebbox(count,boundbox,&rect);
|
||||
}
|
||||
if(has_x && selected != 2) for(i=0;i<xctx->texts;i++)
|
||||
if(has_x && selected != 2) for(i=0;i<xctx->texts; ++i)
|
||||
{
|
||||
int no_of_lines;
|
||||
double longest_line;
|
||||
|
|
@ -1580,7 +1580,7 @@ void calc_drawing_bbox(xRect *boundbox, int selected)
|
|||
xctx->text[i].hcenter, xctx->text[i].vcenter,
|
||||
xctx->text[i].x0, xctx->text[i].y0,
|
||||
&rect.x1,&rect.y1, &rect.x2,&rect.y2, &no_of_lines, &longest_line) ) {
|
||||
count++;
|
||||
++count;
|
||||
updatebbox(count,boundbox,&rect);
|
||||
}
|
||||
#if HAS_CAIRO==1
|
||||
|
|
@ -1589,7 +1589,7 @@ void calc_drawing_bbox(xRect *boundbox, int selected)
|
|||
}
|
||||
#endif
|
||||
}
|
||||
for(i=0;i<xctx->instances;i++)
|
||||
for(i=0;i<xctx->instances; ++i)
|
||||
{
|
||||
char *type;
|
||||
Hilight_hashentry *entry;
|
||||
|
|
@ -1616,7 +1616,7 @@ void calc_drawing_bbox(xRect *boundbox, int selected)
|
|||
rect.y1=xctx->inst[i].y1;
|
||||
rect.x2=xctx->inst[i].x2;
|
||||
rect.y2=xctx->inst[i].y2;
|
||||
count++;
|
||||
++count;
|
||||
updatebbox(count,boundbox,&rect);
|
||||
}
|
||||
}
|
||||
|
|
@ -1825,7 +1825,7 @@ void draw_stuff(void)
|
|||
for(xctx->rectcolor = 4; xctx->rectcolor < cadlayers; xctx->rectcolor++) {
|
||||
#else
|
||||
#endif
|
||||
for(i = 0; i < n; i++)
|
||||
for(i = 0; i < n; ++i)
|
||||
{
|
||||
w=(xctx->areaw*xctx->zoom/800) * rand() / (RAND_MAX+1.0);
|
||||
h=(xctx->areah*xctx->zoom/80) * rand() / (RAND_MAX+1.0);
|
||||
|
|
@ -1842,7 +1842,7 @@ void draw_stuff(void)
|
|||
#endif
|
||||
}
|
||||
|
||||
for(i = 0; i < n; i++)
|
||||
for(i = 0; i < n; ++i)
|
||||
{
|
||||
w=(xctx->areaw*xctx->zoom/80) * rand() / (RAND_MAX+1.0);
|
||||
h=(xctx->areah*xctx->zoom/800) * rand() / (RAND_MAX+1.0);
|
||||
|
|
@ -1859,7 +1859,7 @@ void draw_stuff(void)
|
|||
#endif
|
||||
}
|
||||
|
||||
for(i = 0; i < n; i++)
|
||||
for(i = 0; i < n; ++i)
|
||||
{
|
||||
w=xctx->zoom * rand() / (RAND_MAX+1.0);
|
||||
h=w;
|
||||
|
|
@ -2079,7 +2079,7 @@ void change_layer()
|
|||
|
||||
|
||||
if(xctx->lastsel) xctx->push_undo();
|
||||
for(k=0;k<xctx->lastsel;k++)
|
||||
for(k=0;k<xctx->lastsel; ++k)
|
||||
{
|
||||
n=xctx->sel_array[k].n;
|
||||
type=xctx->sel_array[k].type;
|
||||
|
|
@ -2120,7 +2120,7 @@ void change_layer()
|
|||
p = xctx->text[n].prop_ptr;
|
||||
while(*p) {
|
||||
if(*p == '\n') *p = ' ';
|
||||
p++;
|
||||
++p;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2431,7 +2431,7 @@ int text_bbox(const char *str, double xscale, double yscale,
|
|||
while( s && s[c] ) {
|
||||
if(s[c] == '\n') {
|
||||
s[c]='\0';
|
||||
hh++;
|
||||
++hh;
|
||||
(*cairo_lines)++;
|
||||
if(str_ptr[0]!='\0') {
|
||||
cairo_text_extents(xctx->cairo_ctx, str_ptr, &ext);
|
||||
|
|
@ -2442,7 +2442,7 @@ int text_bbox(const char *str, double xscale, double yscale,
|
|||
str_ptr = s+c+1;
|
||||
} else {
|
||||
}
|
||||
c++;
|
||||
++c;
|
||||
}
|
||||
if(str_ptr && str_ptr[0]!='\0') {
|
||||
cairo_text_extents(xctx->cairo_ctx, str_ptr, &ext);
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ static int waves_selected(int event, KeySym key, int state, int button)
|
|||
else if(event == ButtonPress && button == Button1 && (state & ShiftMask) ) skip = 1;
|
||||
else if(event == ButtonRelease && button == Button2) skip = 1;
|
||||
else if(event == KeyPress && (state & ShiftMask)) skip = 1;
|
||||
else if(!skip) for(i=0; i< xctx->rects[GRIDLAYER]; i++) {
|
||||
else if(!skip) for(i=0; i< xctx->rects[GRIDLAYER]; ++i) {
|
||||
xRect *r;
|
||||
r = &xctx->rect[GRIDLAYER][i];
|
||||
if(!(r->flags & 1) ) continue;
|
||||
|
|
@ -230,7 +230,7 @@ static void backannotate_at_cursor_b_pos(xRect *r, Graph_ctx *gr)
|
|||
}
|
||||
last = p;
|
||||
}
|
||||
cnt++;
|
||||
++cnt;
|
||||
} /* if(xx >= start && xx <= end) */
|
||||
prev_prev_x = prev_x;
|
||||
prev_x = xx;
|
||||
|
|
@ -251,7 +251,7 @@ static void backannotate_at_cursor_b_pos(xRect *r, Graph_ctx *gr)
|
|||
dbg(1, "xx=%g, p=%d\n", xx, p);
|
||||
tcleval("array unset ngspice::ngspice_data");
|
||||
xctx->graph_annotate_p = p;
|
||||
for(i = 0; i < xctx->graph_nvars; i++) {
|
||||
for(i = 0; i < xctx->graph_nvars; ++i) {
|
||||
char s[100];
|
||||
my_snprintf(s, S(s), "%.4g", xctx->graph_values[i][p]);
|
||||
dbg(1, "%s = %g\n", xctx->graph_names[i], xctx->graph_values[i][p]);
|
||||
|
|
@ -274,9 +274,9 @@ static void backannotate_at_cursor_b_pos(xRect *r, Graph_ctx *gr)
|
|||
|
||||
save = xctx->draw_window;
|
||||
xctx->draw_window = 1;
|
||||
for(c=0;c<cadlayers;c++) {
|
||||
for(c=0;c<cadlayers; ++c) {
|
||||
if(xctx->draw_single_layer!=-1 && c != xctx->draw_single_layer) continue;
|
||||
for(i = 0; i < xctx->instances; i++) {
|
||||
for(i = 0; i < xctx->instances; ++i) {
|
||||
type = get_tok_value((xctx->inst[i].ptr+ xctx->sym)->prop_ptr, "type", 0);
|
||||
if(!strstr(type, "source") && !strstr(type, "probe")) continue;
|
||||
if(xctx->inst[i].ptr == -1 || (c > 0 && (xctx->inst[i].flags & 1)) ) continue;
|
||||
|
|
@ -331,7 +331,7 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int
|
|||
cairo_font_face_destroy(xctx->cairo_font);
|
||||
#endif
|
||||
gr = &xctx->graph_struct;
|
||||
for(i=0; i < xctx->rects[GRIDLAYER]; i++) {
|
||||
for(i=0; i < xctx->rects[GRIDLAYER]; ++i) {
|
||||
if( (xctx->ui_state & GRAPHPAN) && i != xctx->graph_master) continue;
|
||||
r = &xctx->rect[GRIDLAYER][i];
|
||||
/* process only graph boxes */
|
||||
|
|
@ -451,7 +451,7 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int
|
|||
} /* key == 't' */
|
||||
break;
|
||||
} /* if( POINTINSIDE(...) */
|
||||
} /* for(i=0; i < xctx->rects[GRIDLAYER]; i++) */
|
||||
} /* for(i=0; i < xctx->rects[GRIDLAYER]; ++i) */
|
||||
dbg(1, "out of 1st loop: i=%d\n", i);
|
||||
|
||||
/* check if user clicked on a wave label -> draw wave in bold */
|
||||
|
|
@ -510,7 +510,7 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int
|
|||
|
||||
|
||||
/* second loop: after having determined the master graph do the others */
|
||||
for(i=0; i< xctx->rects[GRIDLAYER]; i++) {
|
||||
for(i=0; i< xctx->rects[GRIDLAYER]; ++i) {
|
||||
r = &xctx->rect[GRIDLAYER][i];
|
||||
need_redraw = 0;
|
||||
if( !(r->flags & 1) ) continue;
|
||||
|
|
@ -904,7 +904,7 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int
|
|||
if(j >= 0) {
|
||||
int ofs = 0;
|
||||
for(dset = 0 ; dset < xctx->graph_datasets; dset++) {
|
||||
for(i = ofs; i < ofs + xctx->graph_npoints[dset]; i++) {
|
||||
for(i = ofs; i < ofs + xctx->graph_npoints[dset]; ++i) {
|
||||
double sweepval;
|
||||
if(gr->logx) sweepval = mylog10(xctx->graph_values[sweep_idx][i]);
|
||||
else sweepval = xctx->graph_values[sweep_idx][i];
|
||||
|
|
|
|||
32
src/check.c
32
src/check.c
|
|
@ -65,7 +65,7 @@ void update_conn_cues(int layer, int draw_cues, int dr_win)
|
|||
k=wireptr->n;
|
||||
/* optimization when editing small areas (detailed zoom) of a huge schematic */
|
||||
if(LINE_OUTSIDE(wire[k].x1, wire[k].y1, wire[k].x2, wire[k].y2, x1, y1, x2, y2)) continue;
|
||||
for(l = 0;l < 2;l++) {
|
||||
for(l = 0;l < 2; ++l) {
|
||||
if(l==0 ) {
|
||||
if(wire[k].end1 !=-1) continue;
|
||||
wire[k].end1=0;
|
||||
|
|
@ -149,12 +149,12 @@ void trim_wires(void)
|
|||
do {
|
||||
/* dbg(1, "trim_wires(): start: %g\n", timer(1)); */
|
||||
changed = 0;
|
||||
doloops++;
|
||||
++doloops;
|
||||
hash_wires(); /* end1 and end2 reset to -1 */
|
||||
/* dbg(1, "trim_wires(): hash_wires_1: %g\n", timer(1)); */
|
||||
|
||||
/* break all wires */
|
||||
for(i=0;i<xctx->wires;i++) {
|
||||
for(i=0;i<xctx->wires; ++i) {
|
||||
int hashloopcnt = 0;
|
||||
x0 = xctx->wire[i].x1;
|
||||
y0 = xctx->wire[i].y1;
|
||||
|
|
@ -173,7 +173,7 @@ void trim_wires(void)
|
|||
}
|
||||
j = wptr->n;
|
||||
if(i == j) continue;
|
||||
hashloopcnt++;
|
||||
++hashloopcnt;
|
||||
breaks = check_breaks(xctx->wire[j].x1, xctx->wire[j].y1, xctx->wire[j].x2, xctx->wire[j].y2, x0, y0);
|
||||
if(breaks) { /* wire[i] breaks wire[j] */
|
||||
dbg(2, "trim_wires(): %d (%g %g %g %g) breaks %d (%g %g %g %g) in (%g, %g)\n", i,
|
||||
|
|
@ -214,7 +214,7 @@ void trim_wires(void)
|
|||
/* reduce included wires */
|
||||
my_realloc(_ALLOC_ID_, &wireflag, xctx->wires*sizeof(unsigned short));
|
||||
memset(wireflag, 0, xctx->wires*sizeof(unsigned short));
|
||||
for(i=0;i<xctx->wires;i++) {
|
||||
for(i=0;i<xctx->wires; ++i) {
|
||||
if(wireflag[i]) continue;
|
||||
x0 = xctx->wire[i].x1;
|
||||
y0 = xctx->wire[i].y1;
|
||||
|
|
@ -250,10 +250,10 @@ void trim_wires(void)
|
|||
|
||||
/* delete wires */
|
||||
j = 0;
|
||||
for(i=0;i<xctx->wires;i++)
|
||||
for(i=0;i<xctx->wires; ++i)
|
||||
{
|
||||
if(wireflag[i]) {
|
||||
j++;
|
||||
++j;
|
||||
/* hash_wire(XDELETE, i, 0);*/ /* can not be done since wire deletions change wire idexes in array */
|
||||
my_free(_ALLOC_ID_, &xctx->wire[i].prop_ptr);
|
||||
my_free(_ALLOC_ID_, &xctx->wire[i].node);
|
||||
|
|
@ -278,7 +278,7 @@ void trim_wires(void)
|
|||
/* dbg(1, "trim_wires(): hash_wires_2: %g\n", timer(1)); */
|
||||
|
||||
/* update endpoint (end1, end2) connection counters */
|
||||
for(i=0;i<xctx->wires;i++) {
|
||||
for(i=0;i<xctx->wires; ++i) {
|
||||
x0 = xctx->wire[i].x1;
|
||||
y0 = xctx->wire[i].y1;
|
||||
xctx->wire[i].end1 = xctx->wire[i].end2 = 0;
|
||||
|
|
@ -317,7 +317,7 @@ void trim_wires(void)
|
|||
/* dbg(1, "trim_wires(): endpoints: %g\n", timer(1)); */
|
||||
|
||||
/* merge parallel touching (in wire[i].x2, wire[i].y2) wires */
|
||||
for(i=0;i<xctx->wires;i++) {
|
||||
for(i=0;i<xctx->wires; ++i) {
|
||||
if(wireflag[i]) continue;
|
||||
x0 = xctx->wire[i].x2;
|
||||
y0 = xctx->wire[i].y2;
|
||||
|
|
@ -345,11 +345,11 @@ void trim_wires(void)
|
|||
|
||||
/* delete wires */
|
||||
j = 0;
|
||||
for(i=0;i<xctx->wires;i++)
|
||||
for(i=0;i<xctx->wires; ++i)
|
||||
{
|
||||
xctx->wire[i].end1 = xctx->wire[i].end2 = -1; /* reset all endpoints we recalculate all at end */
|
||||
if(wireflag[i]) {
|
||||
j++;
|
||||
++j;
|
||||
/* hash_wire(XDELETE, i, 0);*/ /* can not be done since wire deletions change wire idexes in array */
|
||||
my_free(_ALLOC_ID_, &xctx->wire[i].prop_ptr);
|
||||
my_free(_ALLOC_ID_, &xctx->wire[i].node);
|
||||
|
|
@ -389,8 +389,8 @@ void break_wires_at_pins(void)
|
|||
/* xctx->need_reb_sel_arr=1; */ /* seems not needed */
|
||||
rebuild_selected_array();
|
||||
|
||||
/* for(k=0;k<xctx->instances;k++) */
|
||||
for(j=0;j<xctx->lastsel;j++) if(xctx->sel_array[j].type==ELEMENT) {
|
||||
/* for(k=0;k<xctx->instances; ++k) */
|
||||
for(j=0;j<xctx->lastsel; ++j) if(xctx->sel_array[j].type==ELEMENT) {
|
||||
k = xctx->sel_array[j].n;
|
||||
if( (rects = (xctx->inst[k].ptr+ xctx->sym)->rects[PINLAYER]) > 0 )
|
||||
{
|
||||
|
|
@ -434,12 +434,12 @@ void break_wires_at_pins(void)
|
|||
/* xctx->prep_hash_wires=0; */
|
||||
/* hash_wires(); */
|
||||
rebuild_selected_array();
|
||||
for(j=0;j<xctx->lastsel;j++) if(xctx->sel_array[j].type==WIRE) {
|
||||
/* for(k=0; k < xctx->wires; k++) { */
|
||||
for(j=0;j<xctx->lastsel; ++j) if(xctx->sel_array[j].type==WIRE) {
|
||||
/* for(k=0; k < xctx->wires; ++k) { */
|
||||
int l;
|
||||
|
||||
k = xctx->sel_array[j].n;
|
||||
for(l=0;l<2;l++) {
|
||||
for(l=0;l<2; ++l) {
|
||||
if(l==0 ) {
|
||||
x0 = xctx->wire[k].x1;
|
||||
y0 = xctx->wire[k].y1;
|
||||
|
|
|
|||
120
src/draw.c
120
src/draw.c
|
|
@ -315,15 +315,15 @@ void draw_string(int layer, int what, const char *str, short rot, short flip, in
|
|||
lineno, fext.height, fext.ascent, fext.descent, llength, no_of_lines, longest_line);
|
||||
if(xctx->draw_pixmap) cairo_draw_string_line(xctx->cairo_save_ctx, tt, x, y, rot, flip,
|
||||
lineno, fext.height, fext.ascent, fext.descent, llength, no_of_lines, longest_line);
|
||||
lineno++;
|
||||
++lineno;
|
||||
if(c==0) break;
|
||||
*ss='\n';
|
||||
tt=ss+1;
|
||||
llength=0;
|
||||
} else {
|
||||
llength++;
|
||||
++llength;
|
||||
}
|
||||
ss++;
|
||||
++ss;
|
||||
}
|
||||
my_free(_ALLOC_ID_, &sss);
|
||||
}
|
||||
|
|
@ -388,7 +388,7 @@ void draw_string(int layer, int what, const char *str, short rot, short flip, in
|
|||
ORDER(rx1,ry1,rx2,ry2);
|
||||
drawline(layer, what, rx1, ry1, rx2, ry2, 0, NULL);
|
||||
}
|
||||
pos++;
|
||||
++pos;
|
||||
a += FONTWIDTH+FONTWHITESPACE;
|
||||
}
|
||||
}
|
||||
|
|
@ -417,7 +417,7 @@ void draw_temp_string(GC gctext, int what, const char *str, short rot, short fli
|
|||
void draw_symbol(int what,int c, int n,int layer,short tmp_flip, short rot,
|
||||
double xoffset, double yoffset)
|
||||
/* draws current layer only, should be called within */
|
||||
{ /* a "for(i=0;i<cadlayers;i++)" loop */
|
||||
{ /* a "for(i=0;i<cadlayers; ++i)" loop */
|
||||
int k, j, textlayer, hide = 0;
|
||||
double x0,y0,x1,y1,x2,y2;
|
||||
double *x, *y; /* polygon point arrays */
|
||||
|
|
@ -490,7 +490,7 @@ void draw_symbol(int what,int c, int n,int layer,short tmp_flip, short rot,
|
|||
y0=xctx->inst[n].y0 + yoffset;
|
||||
symptr = (xctx->inst[n].ptr+ xctx->sym);
|
||||
if(!hide) {
|
||||
for(j=0;j< symptr->lines[layer];j++)
|
||||
for(j=0;j< symptr->lines[layer]; ++j)
|
||||
{
|
||||
line = &(symptr->line[layer])[j];
|
||||
ROTATION(rot, flip, 0.0,0.0,line->x1,line->y1,x1,y1);
|
||||
|
|
@ -501,12 +501,12 @@ void draw_symbol(int what,int c, int n,int layer,short tmp_flip, short rot,
|
|||
else
|
||||
drawline(c,what, x0+x1, y0+y1, x0+x2, y0+y2, line->dash, NULL);
|
||||
}
|
||||
for(j=0;j< symptr->polygons[layer];j++)
|
||||
for(j=0;j< symptr->polygons[layer]; ++j)
|
||||
{
|
||||
polygon = &(symptr->poly[layer])[j];
|
||||
x = my_malloc(_ALLOC_ID_, sizeof(double) * polygon->points);
|
||||
y = my_malloc(_ALLOC_ID_, sizeof(double) * polygon->points);
|
||||
for(k=0;k<polygon->points;k++) {
|
||||
for(k=0;k<polygon->points; ++k) {
|
||||
ROTATION(rot, flip, 0.0,0.0,polygon->x[k],polygon->y[k],x[k],y[k]);
|
||||
x[k]+= x0;
|
||||
y[k] += y0;
|
||||
|
|
@ -515,7 +515,7 @@ void draw_symbol(int what,int c, int n,int layer,short tmp_flip, short rot,
|
|||
my_free(_ALLOC_ID_, &x);
|
||||
my_free(_ALLOC_ID_, &y);
|
||||
}
|
||||
for(j=0;j< symptr->arcs[layer];j++)
|
||||
for(j=0;j< symptr->arcs[layer]; ++j)
|
||||
{
|
||||
|
||||
arc = &(symptr->arc[layer])[j];
|
||||
|
|
@ -533,7 +533,7 @@ void draw_symbol(int what,int c, int n,int layer,short tmp_flip, short rot,
|
|||
|
||||
if( (!hide && xctx->enable_layer[layer]) ||
|
||||
(hide && layer == PINLAYER && xctx->enable_layer[layer]) ) {
|
||||
for(j=0;j< symptr->rects[layer];j++)
|
||||
for(j=0;j< symptr->rects[layer]; ++j)
|
||||
{
|
||||
rect = &(symptr->rect[layer])[j];
|
||||
ROTATION(rot, flip, 0.0,0.0,rect->x1,rect->y1,x1,y1);
|
||||
|
|
@ -557,7 +557,7 @@ void draw_symbol(int what,int c, int n,int layer,short tmp_flip, short rot,
|
|||
if( (layer==TEXTWIRELAYER && !(xctx->inst[n].flags&2) ) ||
|
||||
(xctx->sym_txt && (layer==TEXTLAYER) && (xctx->inst[n].flags&2) ) ) {
|
||||
const char *txtptr;
|
||||
for(j=0;j< symptr->texts;j++)
|
||||
for(j=0;j< symptr->texts; ++j)
|
||||
{
|
||||
text = symptr->text[j];
|
||||
if(!text.txt_ptr || !text.txt_ptr[0] || text.xscale*FONTWIDTH*xctx->mooz<1) continue;
|
||||
|
|
@ -617,7 +617,7 @@ void draw_symbol(int what,int c, int n,int layer,short tmp_flip, short rot,
|
|||
void draw_temp_symbol(int what, GC gc, int n,int layer,short tmp_flip, short rot,
|
||||
double xoffset, double yoffset)
|
||||
/* draws current layer only, should be called within */
|
||||
{ /* a "for(i=0;i<cadlayers;i++)" loop */
|
||||
{ /* a "for(i=0;i<cadlayers; ++i)" loop */
|
||||
int j;
|
||||
double x0,y0,x1,y1,x2,y2;
|
||||
short flip;
|
||||
|
|
@ -666,7 +666,7 @@ void draw_temp_symbol(int what, GC gc, int n,int layer,short tmp_flip, short rot
|
|||
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++)
|
||||
for(j=0;j< symptr->lines[layer]; ++j)
|
||||
{
|
||||
line = &(symptr->line[layer])[j];
|
||||
ROTATION(rot, flip, 0.0,0.0,line->x1,line->y1,x1,y1);
|
||||
|
|
@ -677,7 +677,7 @@ void draw_temp_symbol(int what, GC gc, int n,int layer,short tmp_flip, short rot
|
|||
else
|
||||
drawtempline(gc,what, x0+x1, y0+y1, x0+x2, y0+y2);
|
||||
}
|
||||
for(j=0;j< symptr->polygons[layer];j++)
|
||||
for(j=0;j< symptr->polygons[layer]; ++j)
|
||||
{
|
||||
polygon = &(symptr->poly[layer])[j];
|
||||
|
||||
|
|
@ -685,7 +685,7 @@ void draw_temp_symbol(int what, GC gc, int n,int layer,short tmp_flip, short rot
|
|||
int k;
|
||||
double *x = my_malloc(_ALLOC_ID_, sizeof(double) * polygon->points);
|
||||
double *y = my_malloc(_ALLOC_ID_, sizeof(double) * polygon->points);
|
||||
for(k=0;k<polygon->points;k++) {
|
||||
for(k=0;k<polygon->points; ++k) {
|
||||
ROTATION(rot, flip, 0.0,0.0,polygon->x[k],polygon->y[k],x[k],y[k]);
|
||||
x[k] += x0;
|
||||
y[k] += y0;
|
||||
|
|
@ -696,7 +696,7 @@ void draw_temp_symbol(int what, GC gc, int n,int layer,short tmp_flip, short rot
|
|||
}
|
||||
}
|
||||
|
||||
for(j=0;j< symptr->rects[layer];j++)
|
||||
for(j=0;j< symptr->rects[layer]; ++j)
|
||||
{
|
||||
rect = &(symptr->rect[layer])[j];
|
||||
ROTATION(rot, flip, 0.0,0.0,rect->x1,rect->y1,x1,y1);
|
||||
|
|
@ -704,7 +704,7 @@ void draw_temp_symbol(int what, GC gc, int n,int layer,short tmp_flip, short rot
|
|||
RECTORDER(x1,y1,x2,y2);
|
||||
drawtemprect(gc,what, x0+x1, y0+y1, x0+x2, y0+y2);
|
||||
}
|
||||
for(j=0;j< symptr->arcs[layer];j++)
|
||||
for(j=0;j< symptr->arcs[layer]; ++j)
|
||||
{
|
||||
arc = &(symptr->arc[layer])[j];
|
||||
if(flip) {
|
||||
|
|
@ -721,7 +721,7 @@ void draw_temp_symbol(int what, GC gc, int n,int layer,short tmp_flip, short rot
|
|||
if(layer==PROPERTYLAYER && xctx->sym_txt)
|
||||
{
|
||||
const char *txtptr;
|
||||
for(j=0;j< symptr->texts;j++)
|
||||
for(j=0;j< symptr->texts; ++j)
|
||||
{
|
||||
text = symptr->text[j];
|
||||
if(!text.txt_ptr || !text.txt_ptr[0] || text.xscale*FONTWIDTH*xctx->mooz<1) continue;
|
||||
|
|
@ -838,11 +838,11 @@ static void drawgrid()
|
|||
if(big_gr) {
|
||||
xctx->biggridpoint[i].x1 = xctx->biggridpoint[i].x2 = (short)(x);
|
||||
xctx->biggridpoint[i].y1 = xctx->biggridpoint[i].y2 = (short)(y);
|
||||
i++;
|
||||
++i;
|
||||
} else {
|
||||
xctx->gridpoint[i].x=(short)(x);
|
||||
xctx->gridpoint[i].y=(short)(y);
|
||||
i++;
|
||||
++i;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
@ -961,7 +961,7 @@ void drawline(int c, int what, double linex1, double liney1, double linex2, doub
|
|||
rr[i].y1=(short)y1;
|
||||
rr[i].x2=(short)x2;
|
||||
rr[i].y2=(short)y2;
|
||||
i++;
|
||||
++i;
|
||||
}
|
||||
}
|
||||
else if(what & NOW)
|
||||
|
|
@ -1065,7 +1065,7 @@ void drawtempline(GC gc, int what, double linex1,double liney1,double linex2,dou
|
|||
r[i].y1=(short)y1;
|
||||
r[i].x2=(short)x2;
|
||||
r[i].y2=(short)y2;
|
||||
i++;
|
||||
++i;
|
||||
}
|
||||
}
|
||||
else if(what & NOW)
|
||||
|
|
@ -1139,7 +1139,7 @@ void drawtemparc(GC gc, int what, double x, double y, double r, double a, double
|
|||
xarc[i].height=(unsigned short)(yy2 - yy1);
|
||||
xarc[i].angle1 = (short)(a*64);
|
||||
xarc[i].angle2 = (short)(b*64);
|
||||
i++;
|
||||
++i;
|
||||
}
|
||||
}
|
||||
else if(what & NOW)
|
||||
|
|
@ -1234,7 +1234,7 @@ void filledarc(int c, int what, double x, double y, double r, double a, double b
|
|||
xarc[i].height=(unsigned short)(yy2 - yy1);
|
||||
xarc[i].angle1 = (short)(a*64);
|
||||
xarc[i].angle2 = (short)(b*64);
|
||||
i++;
|
||||
++i;
|
||||
}
|
||||
}
|
||||
else if(what & NOW)
|
||||
|
|
@ -1300,7 +1300,7 @@ void drawarc(int c, int what, double x, double y, double r, double a, double b,
|
|||
xarc[i].height=(unsigned short)(yy2 - yy1);
|
||||
xarc[i].angle1 = (short)(a*64);
|
||||
xarc[i].angle2 = (short)(b*64);
|
||||
i++;
|
||||
++i;
|
||||
}
|
||||
}
|
||||
else if(what & NOW)
|
||||
|
|
@ -1405,7 +1405,7 @@ void filledrect(int c, int what, double rectx1,double recty1,double rectx2,doubl
|
|||
r[i].y=(short)y1;
|
||||
r[i].width=(unsigned short)(x2-r[i].x);
|
||||
r[i].height=(unsigned short)(y2-r[i].y);
|
||||
i++;
|
||||
++i;
|
||||
}
|
||||
}
|
||||
else if((what & END) && i)
|
||||
|
|
@ -1419,7 +1419,7 @@ void filledrect(int c, int what, double rectx1,double recty1,double rectx2,doubl
|
|||
void polygon_bbox(double *x, double *y, int points, double *bx1, double *by1, double *bx2, double *by2)
|
||||
{
|
||||
int j;
|
||||
for(j=0; j<points; j++) {
|
||||
for(j=0; j<points; ++j) {
|
||||
if(j==0 || x[j] < *bx1) *bx1 = x[j];
|
||||
if(j==0 || x[j] > *bx2) *bx2 = x[j];
|
||||
if(j==0 || y[j] < *by1) *by1 = y[j];
|
||||
|
|
@ -1466,7 +1466,7 @@ void arc_bbox(double x, double y, double r, double a, double b,
|
|||
*by2 = y2;
|
||||
if(y3 > *by2) *by2 = y3;
|
||||
|
||||
for(i=aa; i<=bb; i++) {
|
||||
for(i=aa; i<=bb; ++i) {
|
||||
if(i%360==0) {
|
||||
*bx2 = x + r;
|
||||
}
|
||||
|
|
@ -1506,15 +1506,15 @@ void drawpolygon(int c, int what, double *x, double *y, int points, int poly_fil
|
|||
if(!xctx->only_probes && (x2-x1)<1.0 && (y2-y1)<1.0) return;
|
||||
p = my_malloc(_ALLOC_ID_, sizeof(XPoint) * points);
|
||||
if(what) {
|
||||
for(i=0;i<points; i++) {
|
||||
for(i=0;i<points; ++i) {
|
||||
clip_xy_to_short(X_TO_SCREEN(x[i]), Y_TO_SCREEN(y[i]), &sx, &sy);
|
||||
p[i].x = sx;
|
||||
p[i].y = sy;
|
||||
}
|
||||
} else {
|
||||
/* preserve cache locality working on contiguous data */
|
||||
for(i=0;i<points; i++) p[i].x = (short)X_TO_SCREEN(x[i]);
|
||||
for(i=0;i<points; i++) p[i].y = (short)Y_TO_SCREEN(y[i]);
|
||||
for(i=0;i<points; ++i) p[i].x = (short)X_TO_SCREEN(x[i]);
|
||||
for(i=0;i<points; ++i) p[i].y = (short)Y_TO_SCREEN(y[i]);
|
||||
}
|
||||
if(dash) {
|
||||
char dash_arr[2];
|
||||
|
|
@ -1553,7 +1553,7 @@ void drawtemppolygon(GC g, int what, double *x, double *y, int points)
|
|||
y2=Y_TO_SCREEN(y2);
|
||||
p = my_malloc(_ALLOC_ID_, sizeof(XPoint) * points);
|
||||
if( rectclip(xctx->areax1,xctx->areay1,xctx->areax2,xctx->areay2,&x1,&y1,&x2,&y2) ) {
|
||||
for(i=0;i<points; i++) {
|
||||
for(i=0;i<points; ++i) {
|
||||
clip_xy_to_short(X_TO_SCREEN(x[i]), Y_TO_SCREEN(y[i]), &sx, &sy);
|
||||
p[i].x = sx;
|
||||
p[i].y = sy;
|
||||
|
|
@ -1618,7 +1618,7 @@ void drawrect(int c, int what, double rectx1,double recty1,double rectx2,double
|
|||
r[i].y=(short)y1;
|
||||
r[i].width=(unsigned short)(x2-r[i].x);
|
||||
r[i].height=(unsigned short)(y2-r[i].y);
|
||||
i++;
|
||||
++i;
|
||||
}
|
||||
}
|
||||
else if((what & END) && i)
|
||||
|
|
@ -1668,7 +1668,7 @@ void drawtemprect(GC gc, int what, double rectx1,double recty1,double rectx2,dou
|
|||
r[i].y=(short)y1;
|
||||
r[i].width=(unsigned short)(x2-r[i].x);
|
||||
r[i].height=(unsigned short)(y2-r[i].y);
|
||||
i++;
|
||||
++i;
|
||||
}
|
||||
}
|
||||
else if((what & END) && i)
|
||||
|
|
@ -1798,10 +1798,10 @@ static void get_bus_value(int n_bits, int hex_digits, SPICE_DATA **idx_arr, int
|
|||
if(i < 0) break; /* MSB nibble is less than 4 bits --> break */
|
||||
} else hexdigit |= (val >= vthh ? 1 : 0);
|
||||
if(bin < 3) {
|
||||
bin++;
|
||||
++bin;
|
||||
hexdigit <<= 1;
|
||||
} else {
|
||||
hex++;
|
||||
++hex;
|
||||
if(x)
|
||||
busval[hex_digits - hex] = 'X';
|
||||
else
|
||||
|
|
@ -1812,7 +1812,7 @@ static void get_bus_value(int n_bits, int hex_digits, SPICE_DATA **idx_arr, int
|
|||
}
|
||||
}
|
||||
if(bin) { /* process (incomplete) MSB nibble */
|
||||
hex++;
|
||||
++hex;
|
||||
if(x)
|
||||
busval[hex_digits - hex] = 'X';
|
||||
else {
|
||||
|
|
@ -1848,7 +1848,7 @@ static SPICE_DATA **get_bus_idx_array(const char *ntok, int *n_bits)
|
|||
idx_arr[p] = NULL;
|
||||
}
|
||||
/* dbg(0, "get_bus_idx_array(): bit_name=%s, p=%d\n", bit_name, p); */
|
||||
p++;
|
||||
++p;
|
||||
}
|
||||
my_free(_ALLOC_ID_, &ntok_copy);
|
||||
return idx_arr;
|
||||
|
|
@ -2017,9 +2017,9 @@ static void draw_graph_grid(Graph_ctx *gr, void *ct)
|
|||
/* vertical grid lines */
|
||||
deltax = axis_increment(gr->gx1, gr->gx2, gr->divx, (gr->logx));
|
||||
startx = axis_start(gr->gx1, deltax, gr->divx);
|
||||
for(j = -1;; j++) { /* start one interval before to allow sub grids at beginning */
|
||||
for(j = -1;; ++j) { /* start one interval before to allow sub grids at beginning */
|
||||
wx = startx + j * deltax;
|
||||
if(gr->subdivx > 0) for(k = 1; k <=gr->subdivx; k++) {
|
||||
if(gr->subdivx > 0) for(k = 1; k <=gr->subdivx; ++k) {
|
||||
double subwx;
|
||||
if(gr->logx)
|
||||
subwx = wx + deltax * mylog10(1.0 + (double)k * 9.0 / ((double)gr->subdivx + 1.0));
|
||||
|
|
@ -2049,9 +2049,9 @@ static void draw_graph_grid(Graph_ctx *gr, void *ct)
|
|||
if(!gr->digital) {
|
||||
deltay = axis_increment(gr->gy1, gr->gy2, gr->divy, gr->logy);
|
||||
starty = axis_start(gr->gy1, deltay, gr->divy);
|
||||
for(j = -1;; j++) { /* start one interval before to allow sub grids at beginning */
|
||||
for(j = -1;; ++j) { /* start one interval before to allow sub grids at beginning */
|
||||
wy = starty + j * deltay;
|
||||
if(gr->subdivy > 0) for(k = 1; k <=gr->subdivy; k++) {
|
||||
if(gr->subdivy > 0) for(k = 1; k <=gr->subdivy; ++k) {
|
||||
double subwy;
|
||||
if(gr->logy)
|
||||
subwy = wy + deltay * mylog10(1.0 + (double)k * 9.0 / ((double)gr->subdivy + 1.0));
|
||||
|
|
@ -2572,7 +2572,7 @@ int edit_wave_attributes(int what, int i, Graph_ctx *gr)
|
|||
}
|
||||
}
|
||||
}
|
||||
wcnt++;
|
||||
++wcnt;
|
||||
} /* while( (ntok = my_strtok_r(nptr, "\n\t ", "", &saven)) ) */
|
||||
my_free(_ALLOC_ID_, &node);
|
||||
my_free(_ALLOC_ID_, &color);
|
||||
|
|
@ -2626,7 +2626,7 @@ int calc_custom_data_yrange(int sweep_idx, const char *express, Graph_ctx *gr)
|
|||
if(xx >= start && xx <= end) {
|
||||
if(first == -1) first = p;
|
||||
last = p;
|
||||
cnt++;
|
||||
++cnt;
|
||||
} /* if(xx >= start && xx <= end) */
|
||||
prev_prev_x = prev_x;
|
||||
prev_x = xx;
|
||||
|
|
@ -2754,7 +2754,7 @@ int find_closest_wave(int i, Graph_ctx *gr)
|
|||
xval, yval, xx, yy, sweepvar_wrap, ntok, stok? stok : "<NULL>");
|
||||
}
|
||||
last = p;
|
||||
cnt++;
|
||||
++cnt;
|
||||
} /* if(xx >= start && xx <= end) */
|
||||
prev_prev_x = prev_x;
|
||||
prev_x = xx;
|
||||
|
|
@ -2765,7 +2765,7 @@ int find_closest_wave(int i, Graph_ctx *gr)
|
|||
} /* for(dset...) */
|
||||
|
||||
} /* if( (idx = get_raw_index(ntok)) != -1 ) */
|
||||
wcnt++;
|
||||
++wcnt;
|
||||
} /* while( (ntok = my_strtok_r(nptr, "\n\t ", "", &saven)) ) */
|
||||
dbg(0, "closest dataset=%d\n", closest_dataset);
|
||||
if(express) my_free(_ALLOC_ID_, &express);
|
||||
|
|
@ -2940,7 +2940,7 @@ void draw_graph(int i, const int flags, Graph_ctx *gr, void *ct)
|
|||
} /* if(dataset == -1 || dataset == sweepvar_wrap) */
|
||||
last = p;
|
||||
poly_npoints++;
|
||||
cnt++;
|
||||
++cnt;
|
||||
} /* if(xx >= start && xx <= end) */
|
||||
prev_prev_x = prev_x;
|
||||
prev_x = xx;
|
||||
|
|
@ -2970,7 +2970,7 @@ void draw_graph(int i, const int flags, Graph_ctx *gr, void *ct)
|
|||
my_free(_ALLOC_ID_, &point);
|
||||
if(idx_arr) my_free(_ALLOC_ID_, &idx_arr);
|
||||
} /* if( expression || (idx = get_raw_index(bus_msb ? bus_msb : express)) != -1 ) */
|
||||
wcnt++;
|
||||
++wcnt;
|
||||
if(bus_msb) my_free(_ALLOC_ID_, &bus_msb);
|
||||
} /* while( (ntok = my_strtok_r(nptr, "\n\t ", "", &saven)) ) */
|
||||
if(express) my_free(_ALLOC_ID_, &express);
|
||||
|
|
@ -3030,7 +3030,7 @@ static void draw_graph_all(int flags)
|
|||
cairo_font_face_destroy(xctx->cairo_font);
|
||||
#endif
|
||||
if(xctx->draw_single_layer==-1 || GRIDLAYER == xctx->draw_single_layer) {
|
||||
if(xctx->enable_layer[GRIDLAYER]) for(i = 0; i < xctx->rects[GRIDLAYER]; i++) {
|
||||
if(xctx->enable_layer[GRIDLAYER]) for(i = 0; i < xctx->rects[GRIDLAYER]; ++i) {
|
||||
xRect *r = &xctx->rect[GRIDLAYER][i];
|
||||
if(r->flags & 1) {
|
||||
setup_graph_data(i, flags, 0, &xctx->graph_struct);
|
||||
|
|
@ -3259,7 +3259,7 @@ static void draw_images_all(void)
|
|||
#if HAS_CAIRO==1
|
||||
int i;
|
||||
if(xctx->draw_single_layer==-1 || GRIDLAYER == xctx->draw_single_layer) {
|
||||
if(xctx->enable_layer[GRIDLAYER]) for(i = 0; i < xctx->rects[GRIDLAYER]; i++) {
|
||||
if(xctx->enable_layer[GRIDLAYER]) for(i = 0; i < xctx->rects[GRIDLAYER]; ++i) {
|
||||
xRect *r = &xctx->rect[GRIDLAYER][i];
|
||||
if(r->flags & 1024) {
|
||||
draw_image(1, r, &r->x1, &r->y1, &r->x2, &r->y2, 0, 0);
|
||||
|
|
@ -3315,7 +3315,7 @@ void svg_embedded_graph(FILE *fd, xRect *r, double rx1, double ry1, double rx2,
|
|||
cairo_set_source_surface(ct, xctx->cairo_save_sfc, 0, 0);
|
||||
cairo_set_operator(ct, CAIRO_OPERATOR_SOURCE);
|
||||
cairo_paint(ct);
|
||||
for(int i = 0; i < xctx->rects[GRIDLAYER]; i++) {
|
||||
for(int i = 0; i < xctx->rects[GRIDLAYER]; ++i) {
|
||||
xRect *r = &xctx->rect[GRIDLAYER][i];
|
||||
if(r->flags & 1) {
|
||||
setup_graph_data(i, 8, 0, &xctx->graph_struct);
|
||||
|
|
@ -3408,15 +3408,15 @@ void draw(void)
|
|||
hash_wires();
|
||||
}
|
||||
dbg(3, "draw(): check4\n");
|
||||
for(c=0;c<cadlayers;c++) {
|
||||
for(c=0;c<cadlayers; ++c) {
|
||||
if(xctx->draw_single_layer!=-1 && c != xctx->draw_single_layer) continue;
|
||||
cc = c; if(xctx->only_probes) cc = GRIDLAYER;
|
||||
if(xctx->enable_layer[c]) for(i=0;i<xctx->lines[c];i++) {
|
||||
if(xctx->enable_layer[c]) for(i=0;i<xctx->lines[c]; ++i) {
|
||||
xLine *l = &xctx->line[c][i];
|
||||
if(l->bus) drawline(cc, THICK, l->x1, l->y1, l->x2, l->y2, l->dash, NULL);
|
||||
else drawline(cc, ADD, l->x1, l->y1, l->x2, l->y2, l->dash, NULL);
|
||||
}
|
||||
if(xctx->enable_layer[c]) for(i=0;i<xctx->rects[c];i++) {
|
||||
if(xctx->enable_layer[c]) for(i=0;i<xctx->rects[c]; ++i) {
|
||||
xRect *r = &xctx->rect[c][i];
|
||||
#if HAS_CAIRO==1
|
||||
if(c != GRIDLAYER || !(r->flags & (1 + 1024)))
|
||||
|
|
@ -3428,11 +3428,11 @@ void draw(void)
|
|||
if(r->fill) filledrect(cc, ADD, r->x1, r->y1, r->x2, r->y2);
|
||||
}
|
||||
}
|
||||
if(xctx->enable_layer[c]) for(i=0;i<xctx->arcs[c];i++) {
|
||||
if(xctx->enable_layer[c]) for(i=0;i<xctx->arcs[c]; ++i) {
|
||||
xArc *a = &xctx->arc[c][i];
|
||||
drawarc(cc, ADD, a->x, a->y, a->r, a->a, a->b, a->fill, a->dash);
|
||||
}
|
||||
if(xctx->enable_layer[c]) for(i=0;i<xctx->polygons[c];i++) {
|
||||
if(xctx->enable_layer[c]) for(i=0;i<xctx->polygons[c]; ++i) {
|
||||
xPoly *p = &xctx->poly[c][i];
|
||||
drawpolygon(cc, NOW, p->x, p->y, p->points, p->fill, p->dash);
|
||||
}
|
||||
|
|
@ -3444,7 +3444,7 @@ void draw(void)
|
|||
i = instanceptr->n;
|
||||
}
|
||||
else {
|
||||
i++;
|
||||
++i;
|
||||
if(i >= xctx->instances) break;
|
||||
}
|
||||
if(xctx->inst[i].ptr == -1 || (c > 0 && (xctx->inst[i].flags & 1)) ) continue;
|
||||
|
|
@ -3475,7 +3475,7 @@ void draw(void)
|
|||
i = wireptr->n;
|
||||
}
|
||||
else {
|
||||
i++;
|
||||
++i;
|
||||
if(i >= xctx->wires) break;
|
||||
}
|
||||
if(xctx->wire[i].bus) {
|
||||
|
|
@ -3491,7 +3491,7 @@ void draw(void)
|
|||
drawline(cc, END, 0.0, 0.0, 0.0, 0.0, 0, NULL);
|
||||
}
|
||||
if(xctx->draw_single_layer ==-1 || xctx->draw_single_layer==TEXTLAYER) {
|
||||
for(i=0;i<xctx->texts;i++)
|
||||
for(i=0;i<xctx->texts; ++i)
|
||||
{
|
||||
textlayer = xctx->text[i].layer;
|
||||
if(!xctx->show_hidden_texts && (xctx->text[i].flags & HIDE_TEXT)) continue;
|
||||
|
|
@ -3536,7 +3536,7 @@ void draw(void)
|
|||
drawrect(textlayer, END, 0.0, 0.0, 0.0, 0.0, 0);
|
||||
drawline(textlayer, END, 0.0, 0.0, 0.0, 0.0, 0, NULL);
|
||||
#endif
|
||||
} /* for(i=0;i<xctx->texts;i++) */
|
||||
} /* for(i=0;i<xctx->texts; ++i) */
|
||||
} /* if(xctx->draw_single_layer ==-1 || xctx->draw_single_layer==TEXTLAYER) */
|
||||
if(xctx->only_probes) build_colors(1.0, 0);
|
||||
if(xctx->only_probes) {
|
||||
|
|
|
|||
|
|
@ -113,11 +113,11 @@ char *my_strtok_r(char *str, const char *delim, const char *quote, char **savept
|
|||
if(ne) *(*saveptr - ne) = **saveptr; /* shift back eating escapes / quotes */
|
||||
if(!e && strchr(quote, **saveptr)) {
|
||||
q = !q;
|
||||
ne++;
|
||||
++ne;
|
||||
}
|
||||
if(quote[0] && !e && **saveptr == '\\') { /* if quote is empty string do not skip backslashes either */
|
||||
e = 1;
|
||||
ne++;
|
||||
++ne;
|
||||
} else e = 0;
|
||||
++(*saveptr);
|
||||
}
|
||||
|
|
@ -573,7 +573,7 @@ int my_strncpy(char *d, const char *s, size_t n)
|
|||
d[i] = '\0';
|
||||
return i;
|
||||
}
|
||||
i++;
|
||||
++i;
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
|
@ -625,9 +625,9 @@ float my_atof(const char *p)
|
|||
sign = 1.0;
|
||||
if(*p == '-') {
|
||||
sign = -1.0;
|
||||
p++;
|
||||
++p;
|
||||
} else if(*p == '+') {
|
||||
p++;
|
||||
++p;
|
||||
}
|
||||
/* Get digits */
|
||||
for(value = 0.0; DGT(*p); p++) {
|
||||
|
|
@ -636,10 +636,10 @@ float my_atof(const char *p)
|
|||
/* get fractional part */
|
||||
if(*p == '.') {
|
||||
int cnt = 0;
|
||||
p++;
|
||||
++p;
|
||||
while (DGT(*p)) {
|
||||
if(cnt < 8) value += (*p - '0') * p10[cnt++];
|
||||
p++;
|
||||
++p;
|
||||
}
|
||||
}
|
||||
/* Exponent */
|
||||
|
|
@ -647,10 +647,10 @@ float my_atof(const char *p)
|
|||
scale = 1.0;
|
||||
if((*p == 'e') || (*p == 'E')) {
|
||||
/* Exponent sign */
|
||||
p++;
|
||||
++p;
|
||||
if(*p == '-') {
|
||||
frac = 1;
|
||||
p++;
|
||||
++p;
|
||||
} else if(*p == '+') p++;
|
||||
/* Get exponent. */
|
||||
for(; DGT(*p); p++) {
|
||||
|
|
@ -683,9 +683,9 @@ double my_atod(const char *p)
|
|||
sign = 1.0;
|
||||
if(*p == '-') {
|
||||
sign = -1.0;
|
||||
p++;
|
||||
++p;
|
||||
} else if(*p == '+') {
|
||||
p++;
|
||||
++p;
|
||||
}
|
||||
/* Get digits */
|
||||
for(value = 0.0; DGT(*p); p++) {
|
||||
|
|
@ -694,10 +694,10 @@ double my_atod(const char *p)
|
|||
/* get fractional part */
|
||||
if(*p == '.') {
|
||||
int cnt = 0;
|
||||
p++;
|
||||
++p;
|
||||
while (DGT(*p)) {
|
||||
if(cnt < 18) value += (*p - '0') * p10[cnt++];
|
||||
p++;
|
||||
++p;
|
||||
}
|
||||
}
|
||||
/* Exponent */
|
||||
|
|
@ -705,10 +705,10 @@ double my_atod(const char *p)
|
|||
scale = 1.0;
|
||||
if((*p == 'e') || (*p == 'E')) {
|
||||
/* Exponent sign */
|
||||
p++;
|
||||
++p;
|
||||
if(*p == '-') {
|
||||
frac = 1;
|
||||
p++;
|
||||
++p;
|
||||
} else if(*p == '+') p++;
|
||||
/* Get exponent. */
|
||||
for(; DGT(*p); p++) {
|
||||
|
|
@ -780,7 +780,7 @@ static void edit_rect_property(int x)
|
|||
{
|
||||
xctx->push_undo();
|
||||
set_modify(1);
|
||||
for(i=0; i<xctx->lastsel; i++) {
|
||||
for(i=0; i<xctx->lastsel; ++i) {
|
||||
if(xctx->sel_array[i].type != xRECT) continue;
|
||||
c = xctx->sel_array[i].col;
|
||||
n = xctx->sel_array[i].n;
|
||||
|
|
@ -849,7 +849,7 @@ static void edit_line_property(void)
|
|||
xctx->push_undo();
|
||||
set_modify(1);
|
||||
bbox(START, 0.0 , 0.0 , 0.0 , 0.0);
|
||||
for(i=0; i<xctx->lastsel; i++) {
|
||||
for(i=0; i<xctx->lastsel; ++i) {
|
||||
if(xctx->sel_array[i].type != LINE) continue;
|
||||
c = xctx->sel_array[i].col;
|
||||
n = xctx->sel_array[i].n;
|
||||
|
|
@ -904,7 +904,7 @@ static void edit_wire_property(void)
|
|||
xctx->push_undo();
|
||||
set_modify(1);
|
||||
bbox(START, 0.0 , 0.0 , 0.0 , 0.0);
|
||||
for(i=0; i<xctx->lastsel; i++) {
|
||||
for(i=0; i<xctx->lastsel; ++i) {
|
||||
int oldbus=0;
|
||||
int k = xctx->sel_array[i].n;
|
||||
if(xctx->sel_array[i].type != WIRE) continue;
|
||||
|
|
@ -1065,7 +1065,7 @@ static void edit_polygon_property(void)
|
|||
bbox(START,0.0,0.0,0.0,0.0);
|
||||
drw = 1;
|
||||
}
|
||||
for(k=0; k<xctx->poly[c][i].points; 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];
|
||||
|
|
@ -1144,7 +1144,7 @@ static void edit_text_property(int x)
|
|||
xctx->push_undo();
|
||||
}
|
||||
bbox(START,0.0,0.0,0.0,0.0);
|
||||
for(k=0;k<xctx->lastsel;k++)
|
||||
for(k=0;k<xctx->lastsel; ++k)
|
||||
{
|
||||
if(xctx->sel_array[k].type!=xTEXT) continue;
|
||||
sel=xctx->sel_array[k].n;
|
||||
|
|
@ -1168,7 +1168,7 @@ static void edit_text_property(int x)
|
|||
double cg;
|
||||
cg = tclgetdoublevar("cadgrid");
|
||||
c = xctx->rects[PINLAYER];
|
||||
for(l=0;l<c;l++) {
|
||||
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 HAS_CAIRO==1
|
||||
|
|
@ -1300,7 +1300,7 @@ static void update_symbol(const char *result, int x)
|
|||
prefix=(get_tok_value((xctx->sym+sym_number)->templ, "name",0))[0]; /* get new symbol prefix */
|
||||
}
|
||||
}
|
||||
for(k=0;k<xctx->lastsel;k++) {
|
||||
for(k=0;k<xctx->lastsel; ++k) {
|
||||
dbg(1, "update_symbol(): for k loop: k=%d\n", k);
|
||||
if(xctx->sel_array[k].type!=ELEMENT) continue;
|
||||
*ii=xctx->sel_array[k].n;
|
||||
|
|
@ -1378,7 +1378,7 @@ static void update_symbol(const char *result, int x)
|
|||
xctx->inst[*ii].flags |= HILIGHT_CONN;
|
||||
else xctx->inst[*ii].flags &= ~HILIGHT_CONN;
|
||||
xctx->inst[*ii].embed = !strcmp(get_tok_value(xctx->inst[*ii].prop_ptr, "embed", 2), "true");
|
||||
} /* end for(k=0;k<xctx->lastsel;k++) */
|
||||
} /* end for(k=0;k<xctx->lastsel; ++k) */
|
||||
/* new symbol bbox after prop changes (may change due to text length) */
|
||||
if(xctx->modified) {
|
||||
xctx->prep_hash_inst=0;
|
||||
|
|
@ -1631,7 +1631,7 @@ void edit_property(int x)
|
|||
|
||||
/* update the bounding box of vhdl "architecture" instances that embed */
|
||||
/* the xctx->schvhdlprop string. 04102001 */
|
||||
for(j=0;j<xctx->instances;j++)
|
||||
for(j=0;j<xctx->instances; ++j)
|
||||
{
|
||||
if( xctx->inst[j].ptr !=-1 &&
|
||||
(xctx->inst[j].ptr+ xctx->sym)->type &&
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ static void find_closest_net(double mx,double my)
|
|||
double threshold;
|
||||
threshold = CADWIREMINDIST * CADWIREMINDIST * xctx->zoom * xctx->zoom;
|
||||
|
||||
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 )
|
||||
{
|
||||
|
|
@ -56,13 +56,13 @@ static void find_closest_polygon(double mx,double my)
|
|||
double x1, y1, x2, y2;
|
||||
double threshold;
|
||||
threshold = CADWIREMINDIST * CADWIREMINDIST * xctx->zoom * xctx->zoom;
|
||||
for(c=0;c<cadlayers;c++)
|
||||
for(c=0;c<cadlayers; ++c)
|
||||
{
|
||||
if(!xctx->enable_layer[c]) continue;
|
||||
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++) {
|
||||
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];
|
||||
|
|
@ -91,10 +91,10 @@ static void find_closest_line(double mx,double my)
|
|||
int i,c,l=-1, col = 0;
|
||||
double threshold;
|
||||
threshold = CADWIREMINDIST * CADWIREMINDIST * xctx->zoom * xctx->zoom;
|
||||
for(c=0;c<cadlayers;c++)
|
||||
for(c=0;c<cadlayers; ++c)
|
||||
{
|
||||
if(!xctx->enable_layer[c]) continue;
|
||||
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))
|
||||
< distance )
|
||||
|
|
@ -121,7 +121,7 @@ void find_closest_net_or_symbol_pin(double mx,double my, double *x, double *y)
|
|||
double curr_dist;
|
||||
|
||||
curr_dist = DBL_MAX;
|
||||
for(i=0;i<xctx->instances;i++) {
|
||||
for(i=0;i<xctx->instances; ++i) {
|
||||
x0=xctx->inst[i].x0;
|
||||
y0=xctx->inst[i].y0;
|
||||
rot = xctx->inst[i].rot;
|
||||
|
|
@ -131,7 +131,7 @@ void find_closest_net_or_symbol_pin(double mx,double my, double *x, double *y)
|
|||
|
||||
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++) {
|
||||
for(j=0; j<no_of_pin_rects; ++j) {
|
||||
rect = ((xctx->inst[i].ptr+ xctx->sym)->rect[PINLAYER])[j];
|
||||
ROTATION(rot, flip, 0.0,0.0,rect.x1,rect.y1,x1,y1);
|
||||
ROTATION(rot, flip, 0.0,0.0,rect.x2,rect.y2,x2,y2);
|
||||
|
|
@ -149,7 +149,7 @@ void find_closest_net_or_symbol_pin(double mx,double my, double *x, double *y)
|
|||
}
|
||||
}
|
||||
}
|
||||
for(i=0;i<xctx->wires; i++) {
|
||||
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);
|
||||
|
|
@ -180,10 +180,10 @@ static void find_closest_arc(double mx,double my)
|
|||
double threshold;
|
||||
threshold = CADWIREMINDIST * CADWIREMINDIST * xctx->zoom * xctx->zoom;
|
||||
|
||||
for(c=0;c<cadlayers;c++)
|
||||
for(c=0;c<cadlayers; ++c)
|
||||
{
|
||||
if(!xctx->enable_layer[c]) continue;
|
||||
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 *= dist; /* square distance */
|
||||
|
|
@ -227,10 +227,10 @@ static void find_closest_box(double mx,double my)
|
|||
{
|
||||
double tmp;
|
||||
int i,c,r=-1, col = 0;
|
||||
for(c=0;c<cadlayers;c++)
|
||||
for(c=0;c<cadlayers; ++c)
|
||||
{
|
||||
if(!xctx->enable_layer[c]) continue;
|
||||
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) )
|
||||
{
|
||||
|
|
@ -254,7 +254,7 @@ static 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);
|
||||
|
|
@ -283,7 +283,7 @@ static void find_closest_text(double mx,double my)
|
|||
int customfont;
|
||||
#endif
|
||||
threshold = CADWIREMINDIST * CADWIREMINDIST * xctx->zoom * xctx->zoom;
|
||||
for(i=0;i<xctx->texts;i++)
|
||||
for(i=0;i<xctx->texts; ++i)
|
||||
{
|
||||
rot = xctx->text[i].rot;
|
||||
flip = xctx->text[i].flip;
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ void compile_font(void)
|
|||
character[code] = my_calloc(_ALLOC_ID_, xctx->lastsel*4+1, sizeof(double));
|
||||
character[code][0] = (double)xctx->lastsel;
|
||||
dbg(2, "compile_font(): character[%d][]={%.16g",code,character[code][0]);
|
||||
for(i=0;i<xctx->lastsel;i++)
|
||||
for(i=0;i<xctx->lastsel; ++i)
|
||||
{
|
||||
character[code][i*4+1] =
|
||||
xctx->line[xctx->sel_array[i].col][xctx->sel_array[i].n].x1-code*FONTOFFSET;
|
||||
|
|
|
|||
132
src/hilight.c
132
src/hilight.c
|
|
@ -60,7 +60,7 @@ static void hilight_hash_free(void) /* remove the whole hash table */
|
|||
int i;
|
||||
|
||||
dbg(2, "hilight_hash_free(): removing hash table\n");
|
||||
for(i=0;i<HASHSIZE;i++)
|
||||
for(i=0;i<HASHSIZE; ++i)
|
||||
{
|
||||
hilight_hash_free_entry( xctx->hilight_table[i] );
|
||||
xctx->hilight_table[i] = NULL;
|
||||
|
|
@ -188,7 +188,7 @@ void display_hilights(char **str)
|
|||
int i;
|
||||
int first = 1;
|
||||
Hilight_hashentry *entry;
|
||||
for(i=0;i<HASHSIZE;i++) {
|
||||
for(i=0;i<HASHSIZE; ++i) {
|
||||
entry = xctx->hilight_table[i];
|
||||
while(entry) {
|
||||
if(!first) my_strcat(_ALLOC_ID_, str, " ");
|
||||
|
|
@ -207,10 +207,10 @@ static int there_are_hilights()
|
|||
register int i;
|
||||
register xInstance * inst = xctx->inst;
|
||||
register Hilight_hashentry **hiptr = xctx->hilight_table;
|
||||
for(i=0;i<HASHSIZE;i++) {
|
||||
for(i=0;i<HASHSIZE; ++i) {
|
||||
if(hiptr[i]) return 1;
|
||||
}
|
||||
for(i = 0; i < xctx->instances; i++) {
|
||||
for(i = 0; i < xctx->instances; ++i) {
|
||||
if(inst[i].color != -10000) return 1;
|
||||
}
|
||||
return 0;
|
||||
|
|
@ -291,7 +291,7 @@ void create_plot_cmd(void)
|
|||
if(tclresult()[0] == '0') return;
|
||||
idx = 1;
|
||||
first = 1;
|
||||
for(i=0;i<HASHSIZE;i++) /* set ngspice colors */
|
||||
for(i=0;i<HASHSIZE; ++i) /* set ngspice colors */
|
||||
{
|
||||
entry = xctx->hilight_table[i];
|
||||
while(entry) {
|
||||
|
|
@ -301,7 +301,7 @@ void create_plot_cmd(void)
|
|||
if(node_entry && !strcmp(xctx->sch_path[xctx->currsch], entry->path) &&
|
||||
(node_entry->d.port == 0 || !strcmp(entry->path, ".") )) {
|
||||
c = get_color(entry->value);
|
||||
idx++;
|
||||
++idx;
|
||||
if(viewer == NGSPICE) {
|
||||
sprintf(color_str, "%02x/%02x/%02x",
|
||||
xctx->xcolor_array[c].red>>8, xctx->xcolor_array[c].green>>8, xctx->xcolor_array[c].blue>>8);
|
||||
|
|
@ -335,7 +335,7 @@ void create_plot_cmd(void)
|
|||
char *c=p;
|
||||
while(*c){
|
||||
if(*c == '.') *c = ':'; /* Xyce uses : as path separator */
|
||||
c++;
|
||||
++c;
|
||||
}
|
||||
tclvareval("puts $gaw_fd {copyvar ", strtoupper(p), strtoupper(t),
|
||||
" sel #", color_str, "}\nvwait gaw_fd\n", NULL);
|
||||
|
|
@ -368,7 +368,7 @@ void create_plot_cmd(void)
|
|||
char *c=p;
|
||||
while(*c){
|
||||
if(*c == '.') *c = ':'; /* Xyce uses : as path separator */
|
||||
c++;
|
||||
++c;
|
||||
}
|
||||
tclvareval(
|
||||
"puts $bespice_server_getdata(sock) ",
|
||||
|
|
@ -409,7 +409,7 @@ void clear_all_hilights(void)
|
|||
if(!xctx->hilight_nets) return;
|
||||
hilight_hash_free();
|
||||
xctx->hilight_nets=0;
|
||||
for(i=0;i<xctx->instances;i++) {
|
||||
for(i=0;i<xctx->instances; ++i) {
|
||||
xctx->inst[i].color = -10000 ;
|
||||
}
|
||||
dbg(1, "clear_all_hilights(): clearing\n");
|
||||
|
|
@ -431,7 +431,7 @@ void hilight_net_pin_mismatches(void)
|
|||
incr_hi = tclgetboolvar("incr_hilight");
|
||||
rebuild_selected_array();
|
||||
prepare_netlist_structs(0);
|
||||
for(k=0; k<xctx->lastsel; k++) {
|
||||
for(k=0; k<xctx->lastsel; ++k) {
|
||||
if(xctx->sel_array[k].type!=ELEMENT) continue;
|
||||
j = xctx->sel_array[k].n ;
|
||||
my_strdup(_ALLOC_ID_, &type,(xctx->inst[j].ptr+ xctx->sym)->type);
|
||||
|
|
@ -440,7 +440,7 @@ void hilight_net_pin_mismatches(void)
|
|||
npin = symbol->rects[PINLAYER];
|
||||
rct=symbol->rect[PINLAYER];
|
||||
dbg(1, "hilight_net_pin_mismatches(): \n");
|
||||
for(i=0;i<npin;i++) {
|
||||
for(i=0;i<npin; ++i) {
|
||||
my_strdup(_ALLOC_ID_, &labname,get_tok_value(rct[i].prop_ptr,"name",0));
|
||||
my_strdup(_ALLOC_ID_, &lab, expandlabel(labname, &mult));
|
||||
my_strdup(_ALLOC_ID_, &netname, net_name(j,i, &mult, 0, 0));
|
||||
|
|
@ -478,7 +478,7 @@ void hilight_parent_pins(void)
|
|||
|
||||
rects = (xctx->inst[i].ptr+ xctx->sym)->rects[PINLAYER];
|
||||
|
||||
for(j=0;j<rects;j++)
|
||||
for(j=0;j<rects; ++j)
|
||||
{
|
||||
if(!xctx->inst[i].node[j]) continue;
|
||||
my_strdup(_ALLOC_ID_, &net_node, expandlabel(xctx->inst[i].node[j], &net_mult));
|
||||
|
|
@ -488,7 +488,7 @@ void hilight_parent_pins(void)
|
|||
my_strdup(_ALLOC_ID_, &pin_node, expandlabel(pin_name, &mult));
|
||||
dbg(1, "hilight_parent_pins(): pin_node=%s\n", pin_node);
|
||||
|
||||
for(k = 1; k<=mult; k++) {
|
||||
for(k = 1; k<=mult; ++k) {
|
||||
xctx->currsch++;
|
||||
entry = bus_hilight_hash_lookup(find_nth(pin_node, ",", k), 0, XLOOKUP);
|
||||
xctx->currsch--;
|
||||
|
|
@ -522,7 +522,7 @@ void hilight_child_pins(void)
|
|||
prepare_netlist_structs(0);
|
||||
rects = (xctx->inst[i].ptr+ xctx->sym)->rects[PINLAYER];
|
||||
inst_number = xctx->sch_inst_number[xctx->currsch];
|
||||
for(j=0;j<rects;j++)
|
||||
for(j=0;j<rects; ++j)
|
||||
{
|
||||
dbg(1, "hilight_child_pins(): inst_number=%d\n", inst_number);
|
||||
|
||||
|
|
@ -533,7 +533,7 @@ void hilight_child_pins(void)
|
|||
if(!pin_name[0]) continue;
|
||||
my_strdup(_ALLOC_ID_, &pin_node, expandlabel(pin_name, &mult));
|
||||
dbg(1, "hilight_child_pins(): pin_node=%s\n", pin_node);
|
||||
for(k = 1; k<=mult; k++) {
|
||||
for(k = 1; k<=mult; ++k) {
|
||||
dbg(1, "hilight_child_pins(): looking nth net:%d, k=%d, inst_number=%d, mult=%d\n",
|
||||
(inst_number-1)*mult+k, k, inst_number, mult);
|
||||
/* dbg(1, "hilight_child_pins(): looking net:%s\n", find_nth(net_node, ",",
|
||||
|
|
@ -608,7 +608,7 @@ int search(const char *tok, const char *val, int sub, int sel)
|
|||
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;
|
||||
|
|
@ -667,7 +667,7 @@ int search(const char *tok, const char *val, int sub, int sel)
|
|||
}
|
||||
}
|
||||
}
|
||||
for(i=0;i<xctx->wires;i++) {
|
||||
for(i=0;i<xctx->wires; ++i) {
|
||||
str = get_tok_value(xctx->wire[i].prop_ptr, tok,0);
|
||||
if(xctx->tok_size ) {
|
||||
#ifdef __unix__
|
||||
|
|
@ -696,7 +696,7 @@ int search(const char *tok, const char *val, int sub, int sel)
|
|||
}
|
||||
}
|
||||
if(!sel && xctx->hilight_nets) propagate_hilights(1, 0, XINSERT_NOREPLACE);
|
||||
if(sel) for(c = 0; c < cadlayers; c++) for(i=0;i<xctx->lines[c];i++) {
|
||||
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(xctx->tok_size) {
|
||||
#ifdef __unix__
|
||||
|
|
@ -722,7 +722,7 @@ int search(const char *tok, const char *val, int sub, int sel)
|
|||
}
|
||||
}
|
||||
}
|
||||
if(sel) for(c = 0; c < cadlayers; c++) for(i=0;i<xctx->rects[c];i++) {
|
||||
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(xctx->tok_size) {
|
||||
#ifdef __unix__
|
||||
|
|
@ -788,18 +788,18 @@ static void drill_hilight(int mode)
|
|||
prepare_netlist_structs(0);
|
||||
while(1) {
|
||||
found=0;
|
||||
for(i=0; i<xctx->instances;i++) {
|
||||
for(i=0; i<xctx->instances; ++i) {
|
||||
/* expandlabel(xctx->inst[i].instname, &instmult); */
|
||||
symbol = xctx->inst[i].ptr+xctx->sym;
|
||||
npin = symbol->rects[PINLAYER];
|
||||
rct=symbol->rect[PINLAYER];
|
||||
hilight_connected_inst = en_hi &&
|
||||
((xctx->inst[i].flags & HILIGHT_CONN) || (symbol->flags & HILIGHT_CONN));
|
||||
for(j=0; j<npin;j++) {
|
||||
for(j=0; j<npin; ++j) {
|
||||
my_strdup2(_ALLOC_ID_, &netname, net_name(i, j, &mult, 1, 0));
|
||||
expandlabel(netname, &mult);
|
||||
dbg(1, "inst=%s, pin=%d, netname=%s, mult=%d\n", xctx->inst[i].instname, j, netname, mult);
|
||||
for(k = 1; k <= mult; k++) {
|
||||
for(k = 1; k <= mult; ++k) {
|
||||
netbitname = find_nth(netname, ",", k);
|
||||
dbg(1, "netbitname=%s\n", netbitname);
|
||||
if( (entry=bus_hilight_hash_lookup(netbitname, 0, XLOOKUP)) ) {
|
||||
|
|
@ -832,7 +832,7 @@ static void drill_hilight(int mode)
|
|||
}
|
||||
}
|
||||
} /* if(entry) */
|
||||
} /* for(k = 1; k <= mult; k++) */
|
||||
} /* for(k = 1; k <= mult; ++k) */
|
||||
} /* for(j...) */
|
||||
} /* for(i...) */
|
||||
if(!found) break;
|
||||
|
|
@ -880,7 +880,7 @@ static void send_net_to_bespice(int simtype, const char *node)
|
|||
xctx->xcolor_array[c].blue>>8);
|
||||
expanded_tok = expandlabel(tok, &tok_mult);
|
||||
my_strdup2(_ALLOC_ID_, &p, xctx->sch_path[xctx->currsch]+1);
|
||||
for(k=1; k<=tok_mult; k++) {
|
||||
for(k=1; k<=tok_mult; ++k) {
|
||||
my_strdup(_ALLOC_ID_, &t, find_nth(expanded_tok, ",", k));
|
||||
if(simtype == 0 ) { /* spice */
|
||||
tclvareval(
|
||||
|
|
@ -900,7 +900,7 @@ static void send_net_to_bespice(int simtype, const char *node)
|
|||
char *c=p;
|
||||
while(*c){
|
||||
if(*c == '.') *c = ':'; /* Xyce uses : as path separator */
|
||||
c++;
|
||||
++c;
|
||||
}
|
||||
tclvareval(
|
||||
"puts $bespice_server_getdata(sock) ",
|
||||
|
|
@ -947,11 +947,11 @@ static void send_net_to_graph(char **s, int simtype, const char *node)
|
|||
/* skip path components that are above the level where raw file was loaded */
|
||||
while(*path && skip < start_level) {
|
||||
if(*path == '.') skip++;
|
||||
path++;
|
||||
++path;
|
||||
}
|
||||
}
|
||||
strtolower(path);
|
||||
for(k=1; k<=tok_mult; k++) {
|
||||
for(k=1; k<=tok_mult; ++k) {
|
||||
my_strdup(_ALLOC_ID_, &t, find_nth(expanded_tok, ",", k));
|
||||
strtolower(t);
|
||||
if(simtype == 0 ) { /* ngspice */
|
||||
|
|
@ -993,7 +993,7 @@ static void send_net_to_gaw(int simtype, const char *node)
|
|||
my_strdup2(_ALLOC_ID_, &p, xctx->sch_path[xctx->currsch]+1);
|
||||
path = p;
|
||||
strtolower(path);
|
||||
for(k=1; k<=tok_mult; k++) {
|
||||
for(k=1; k<=tok_mult; ++k) {
|
||||
my_strdup(_ALLOC_ID_, &t, find_nth(expanded_tok, ",", k));
|
||||
strtolower(t);
|
||||
if(simtype == 0 ) { /* ngspice */
|
||||
|
|
@ -1029,7 +1029,7 @@ static void send_current_to_bespice(int simtype, const char *node)
|
|||
xctx->xcolor_array[c].blue>>8);
|
||||
expanded_tok = expandlabel(tok, &tok_mult);
|
||||
my_strdup2(_ALLOC_ID_, &p, xctx->sch_path[xctx->currsch]+1);
|
||||
for(k=1; k<=tok_mult; k++) {
|
||||
for(k=1; k<=tok_mult; ++k) {
|
||||
my_strdup(_ALLOC_ID_, &t, find_nth(expanded_tok, ",", k));
|
||||
if(!simtype) { /* spice */
|
||||
tclvareval(
|
||||
|
|
@ -1051,7 +1051,7 @@ static void send_current_to_bespice(int simtype, const char *node)
|
|||
char *c=p;
|
||||
while(*c){
|
||||
if(*c == '.') *c = ':'; /* Xyce uses : as path separator */
|
||||
c++;
|
||||
++c;
|
||||
}
|
||||
|
||||
tclvareval(
|
||||
|
|
@ -1095,12 +1095,12 @@ static void send_current_to_graph(char **s, int simtype, const char *node)
|
|||
/* skip path components that are above the level where raw file was loaded */
|
||||
while(*path && skip < start_level) {
|
||||
if(*path == '.') skip++;
|
||||
path++;
|
||||
++path;
|
||||
}
|
||||
}
|
||||
strtolower(path);
|
||||
there_is_hierarchy = (strstr(path, ".") != NULL);
|
||||
for(k=1; k<=tok_mult; k++) {
|
||||
for(k=1; k<=tok_mult; ++k) {
|
||||
my_strdup(_ALLOC_ID_, &t, find_nth(expanded_tok, ",", k));
|
||||
strtolower(t);
|
||||
if(!simtype) { /* ngspice */
|
||||
|
|
@ -1140,7 +1140,7 @@ static void send_current_to_gaw(int simtype, const char *node)
|
|||
path = p;
|
||||
strtolower(path);
|
||||
there_is_hierarchy = (xctx->currsch > 0);
|
||||
for(k=1; k<=tok_mult; k++) {
|
||||
for(k=1; k<=tok_mult; ++k) {
|
||||
my_strdup(_ALLOC_ID_, &t, find_nth(expanded_tok, ",", k));
|
||||
strtolower(t);
|
||||
if(!simtype) { /* spice */
|
||||
|
|
@ -1150,7 +1150,7 @@ static void send_current_to_gaw(int simtype, const char *node)
|
|||
char *c=p;
|
||||
while(*c){
|
||||
if(*c == '.') *c = ':'; /* Xyce uses : as path separator */
|
||||
c++;
|
||||
++c;
|
||||
}
|
||||
/*
|
||||
tclvareval("puts $gaw_fd {copyvar ", there_is_hierarchy ? "V:" : "",
|
||||
|
|
@ -1179,7 +1179,7 @@ void propagate_hilights(int set, int clear, int mode)
|
|||
en_hi = tclgetboolvar("en_hilight_conn_inst");
|
||||
|
||||
prepare_netlist_structs(0);
|
||||
for(i = 0; i < xctx->instances; i++) {
|
||||
for(i = 0; i < xctx->instances; ++i) {
|
||||
if(xctx->inst[i].ptr < 0 ) {
|
||||
dbg(0, "propagate_hilights(): .ptr<0, unbound symbol: inst %d, name=%s sch=%s\n",
|
||||
i, xctx->inst[i].instname, xctx->current_name);
|
||||
|
|
@ -1194,7 +1194,7 @@ void propagate_hilights(int set, int clear, int mode)
|
|||
int rects, j, nohilight_pins;
|
||||
if( (rects = (xctx->inst[i].ptr+ xctx->sym)->rects[PINLAYER]) > 0 ) {
|
||||
nohilight_pins = 1;
|
||||
for(j=0;j<rects;j++) {
|
||||
for(j=0;j<rects; ++j) {
|
||||
if( xctx->inst[i].node && xctx->inst[i].node[j]) {
|
||||
entry=bus_hilight_hash_lookup(xctx->inst[i].node[j], 0, XLOOKUP);
|
||||
if(entry) {
|
||||
|
|
@ -1277,13 +1277,13 @@ static int eval_logic_expr(int inst, int output)
|
|||
case 'd': /* duplicate top element*/
|
||||
if(sp > 0 && sp < STACKMAX) {
|
||||
stack[sp] = stack[sp - 1];
|
||||
sp++;
|
||||
++sp;
|
||||
}
|
||||
break;
|
||||
case 'r': /* rotate down: bottom element goes to top */
|
||||
if(sp > 1) {
|
||||
s = stack[0];
|
||||
for(i = 0 ; i < sp - 1; i++) stack[i] = stack[i + 1];
|
||||
for(i = 0 ; i < sp - 1; ++i) stack[i] = stack[i + 1];
|
||||
stack[sp - 1] = s;
|
||||
}
|
||||
break;
|
||||
|
|
@ -1347,7 +1347,7 @@ static int eval_logic_expr(int inst, int output)
|
|||
case '|': /* or operator */
|
||||
if(sp > 1) {
|
||||
res = 0;
|
||||
for(i = sp - 2; i < sp; i++) {
|
||||
for(i = sp - 2; i < sp; ++i) {
|
||||
if(stack[i] == 1) {
|
||||
res = 1;
|
||||
break;
|
||||
|
|
@ -1362,7 +1362,7 @@ static int eval_logic_expr(int inst, int output)
|
|||
case '&': /* and operator */
|
||||
if(sp > 1) {
|
||||
res = 1;
|
||||
for(i = sp - 2; i < sp; i++) {
|
||||
for(i = sp - 2; i < sp; ++i) {
|
||||
if(stack[i] == 0) {
|
||||
res = 0;
|
||||
break;
|
||||
|
|
@ -1377,7 +1377,7 @@ static int eval_logic_expr(int inst, int output)
|
|||
case '^': /* xor operator */
|
||||
if(sp > 1) {
|
||||
res = 0;
|
||||
for(i = sp - 2; i < sp; i++) {
|
||||
for(i = sp - 2; i < sp; ++i) {
|
||||
if(stack[i] < 2) {
|
||||
res = res ^ stack[i];
|
||||
}
|
||||
|
|
@ -1422,7 +1422,7 @@ static int eval_logic_expr(int inst, int output)
|
|||
}
|
||||
else dbg(0, "eval_logic_expr(): stack overflow!\n");
|
||||
}
|
||||
pos++;
|
||||
++pos;
|
||||
} /* while */
|
||||
dbg(1, "eval_logic_expr(): inst %d output %d, returning %d\n", inst, output, stack[0]);
|
||||
return stack[0];
|
||||
|
|
@ -1440,13 +1440,13 @@ static void create_simdata(void)
|
|||
free_simdata();
|
||||
my_realloc(_ALLOC_ID_, &xctx->simdata, xctx->instances * sizeof(Simdata));
|
||||
xctx->simdata_ninst = xctx->instances;
|
||||
for(i = 0; i < xctx->instances; i++) {
|
||||
for(i = 0; i < xctx->instances; ++i) {
|
||||
xSymbol *symbol = xctx->inst[i].ptr + xctx->sym;
|
||||
int npin = symbol->rects[PINLAYER];
|
||||
xctx->simdata[i].pin = NULL;
|
||||
if(npin) my_realloc(_ALLOC_ID_, &xctx->simdata[i].pin, npin * sizeof(Simdata_pin));
|
||||
xctx->simdata[i].npin = npin;
|
||||
for(j = 0; j < npin; j++) {
|
||||
for(j = 0; j < npin; ++j) {
|
||||
char function[20];
|
||||
xctx->simdata[i].pin[j].function=NULL;
|
||||
xctx->simdata[i].pin[j].go_to=NULL;
|
||||
|
|
@ -1465,9 +1465,9 @@ void free_simdata(void)
|
|||
int i, j;
|
||||
|
||||
if(xctx->simdata) {
|
||||
for(i = 0; i < xctx->simdata_ninst; i++) { /* can not use xctx->instances if a new sch is loaded */
|
||||
for(i = 0; i < xctx->simdata_ninst; ++i) { /* can not use xctx->instances if a new sch is loaded */
|
||||
int npin = xctx->simdata[i].npin;
|
||||
for(j = 0; j < npin; j++) {
|
||||
for(j = 0; j < npin; ++j) {
|
||||
my_free(_ALLOC_ID_, &xctx->simdata[i].pin[j].function);
|
||||
my_free(_ALLOC_ID_, &xctx->simdata[i].pin[j].go_to);
|
||||
}
|
||||
|
|
@ -1491,16 +1491,16 @@ static void propagate_logic()
|
|||
prepare_netlist_structs(0);
|
||||
if(!xctx->simdata) create_simdata();
|
||||
|
||||
for(i=0; i<xctx->instances; i++)
|
||||
for(j=0;j < xctx->simdata[i].npin; j++)
|
||||
for(i=0; i<xctx->instances; ++i)
|
||||
for(j=0;j < xctx->simdata[i].npin; ++j)
|
||||
xctx->simdata[i].pin[j].value=-10000;
|
||||
|
||||
while(1) {
|
||||
dbg(1, "propagate_logic(): main loop iteration\n");
|
||||
found=0;
|
||||
for(i=0; i<xctx->instances; i++) {
|
||||
for(i=0; i<xctx->instances; ++i) {
|
||||
npin = xctx->simdata[i].npin;
|
||||
for(j=0; j<npin;j++) {
|
||||
for(j=0; j<npin; ++j) {
|
||||
if(xctx->simdata && xctx->simdata[i].pin && xctx->simdata[i].pin[j].go_to) {
|
||||
int n = 1;
|
||||
const char *propag;
|
||||
|
|
@ -1530,7 +1530,7 @@ static void propagate_logic()
|
|||
dbg(1, "propagate_logic(): inst=%d pin %d, goto=%s\n", i,j, xctx->simdata[i].pin[j].go_to);
|
||||
while(1) {
|
||||
propag = find_nth(xctx->simdata[i].pin[j].go_to, ",", n);
|
||||
n++;
|
||||
++n;
|
||||
if(!propag[0]) break;
|
||||
propagate = atoi(propag);
|
||||
if(propagate < 0 || propagate >= npin) {
|
||||
|
|
@ -1568,8 +1568,8 @@ static void propagate_logic()
|
|||
xctx->hilight_time++;
|
||||
|
||||
/* update all values */
|
||||
for(i=0; i<xctx->instances; i++) {
|
||||
for(j=0;j < xctx->simdata[i].npin; j++) {
|
||||
for(i=0; i<xctx->instances; ++i) {
|
||||
for(j=0;j < xctx->simdata[i].npin; ++j) {
|
||||
if(xctx->simdata[i].pin[j].value != -10000) {
|
||||
entry = hilight_hash_lookup(xctx->inst[i].node[j], 0, XLOOKUP);
|
||||
if(!entry || xctx->hilight_time != entry->time) {
|
||||
|
|
@ -1592,7 +1592,7 @@ static void propagate_logic()
|
|||
/* get out from infinite loops (circuit is oscillating) */
|
||||
tclvareval("update; expr {$::tclstop == 1}", NULL);
|
||||
if( tclresult()[0] == '1') break;
|
||||
iter++;
|
||||
++iter;
|
||||
} /* while(1) */
|
||||
/* my_free(_ALLOC_ID_, &propagated_net); */
|
||||
}
|
||||
|
|
@ -1616,8 +1616,8 @@ void logic_set(int value, int num)
|
|||
bbox(START, 0.0 , 0.0 , 0.0 , 0.0);
|
||||
bbox(ADD, boundbox.x1, boundbox.y1, boundbox.x2, boundbox.y2);
|
||||
}
|
||||
for(j = 0; j < num; j++) {
|
||||
for(i=0;i<xctx->lastsel;i++)
|
||||
for(j = 0; j < num; ++j) {
|
||||
for(i=0;i<xctx->lastsel; ++i)
|
||||
{
|
||||
char *node = NULL;
|
||||
n = xctx->sel_array[i].n;
|
||||
|
|
@ -1671,7 +1671,7 @@ void hilight_net(int viewer)
|
|||
rebuild_selected_array();
|
||||
tcleval("sim_is_xyce");
|
||||
sim_is_xyce = atoi( tclresult() );
|
||||
for(i=0;i<xctx->lastsel;i++) {
|
||||
for(i=0;i<xctx->lastsel; ++i) {
|
||||
n = xctx->sel_array[i].n;
|
||||
switch(xctx->sel_array[i].type) {
|
||||
case WIRE:
|
||||
|
|
@ -1731,7 +1731,7 @@ void unhilight_net(void)
|
|||
prepare_netlist_structs(0);
|
||||
if(!big) calc_drawing_bbox(&boundbox, 2);
|
||||
dbg(1, "unhilight_net(): entering\n");
|
||||
for(i=0;i<xctx->lastsel;i++) {
|
||||
for(i=0;i<xctx->lastsel; ++i) {
|
||||
n = xctx->sel_array[i].n;
|
||||
switch(xctx->sel_array[i].type) {
|
||||
case WIRE:
|
||||
|
|
@ -1794,12 +1794,12 @@ void select_hilight_net(void)
|
|||
if(!xctx->hilight_nets) return;
|
||||
en_hi = tclgetboolvar("en_hilight_conn_inst");
|
||||
prepare_netlist_structs(0);
|
||||
for(i=0;i<xctx->wires;i++) {
|
||||
for(i=0;i<xctx->wires; ++i) {
|
||||
if( (entry = bus_hilight_hash_lookup(xctx->wire[i].node, 0, XLOOKUP)) ) {
|
||||
xctx->wire[i].sel = SELECTED;
|
||||
}
|
||||
}
|
||||
for(i=0;i<xctx->instances;i++) {
|
||||
for(i=0;i<xctx->instances; ++i) {
|
||||
|
||||
type = (xctx->inst[i].ptr+ xctx->sym)->type;
|
||||
hilight_connected_inst = en_hi &&
|
||||
|
|
@ -1811,7 +1811,7 @@ void select_hilight_net(void)
|
|||
else if(hilight_connected_inst) {
|
||||
int rects, j;
|
||||
if( (rects = (xctx->inst[i].ptr+ xctx->sym)->rects[PINLAYER]) > 0 ) {
|
||||
for(j=0;j<rects;j++) {
|
||||
for(j=0;j<rects; ++j) {
|
||||
if( xctx->inst[i].node && xctx->inst[i].node[j]) {
|
||||
entry=bus_hilight_hash_lookup(xctx->inst[i].node[j], 0, XLOOKUP);
|
||||
if(entry) {
|
||||
|
|
@ -1866,7 +1866,7 @@ void draw_hilight_net(int on_window)
|
|||
i = wireptr->n;
|
||||
}
|
||||
else {
|
||||
i++;
|
||||
++i;
|
||||
if(i >= xctx->wires) break;
|
||||
}
|
||||
if( (entry = bus_hilight_hash_lookup(xctx->wire[i].node, 0, XLOOKUP)) ) {
|
||||
|
|
@ -1886,7 +1886,7 @@ void draw_hilight_net(int on_window)
|
|||
}
|
||||
}
|
||||
}
|
||||
for(c=0;c<cadlayers;c++) {
|
||||
for(c=0;c<cadlayers; ++c) {
|
||||
if(xctx->draw_single_layer!=-1 && c != xctx->draw_single_layer) continue;
|
||||
if(use_hash) init_inst_iterator(&ctx, x1, y1, x2, y2);
|
||||
else i = -1;
|
||||
|
|
@ -1896,7 +1896,7 @@ void draw_hilight_net(int on_window)
|
|||
i = instanceptr->n;
|
||||
}
|
||||
else {
|
||||
i++;
|
||||
++i;
|
||||
if(i >= xctx->instances) break;
|
||||
}
|
||||
if(xctx->inst[i].color != -10000)
|
||||
|
|
@ -1956,7 +1956,7 @@ void print_hilight_net(int show)
|
|||
my_snprintf(cmd, S(cmd), "awk -f \"%s/order_labels.awk\"", tclgetvar("XSCHEM_SHAREDIR"));
|
||||
my_snprintf(cmd2, S(cmd2), "%s %s > %s", cmd, filetmp1, filetmp2);
|
||||
my_snprintf(cmd3, S(cmd3), "awk -f \"%s/sort_labels.awk\" %s", tclgetvar("XSCHEM_SHAREDIR"), filetmp1);
|
||||
for(i=0;i<HASHSIZE;i++) {
|
||||
for(i=0;i<HASHSIZE; ++i) {
|
||||
entry=xctx->hilight_table[i];
|
||||
while(entry) {
|
||||
dbg(1, "print_hilight_net(): (hilight_hashentry *)entry->token=%s\n", entry->token);
|
||||
|
|
@ -2038,7 +2038,7 @@ void list_hilights(void)
|
|||
Tcl_ResetResult(interp);
|
||||
prepare_netlist_structs(1); /* use full prepare_netlist_structs(1) to recognize pin direction */
|
||||
/* when creating pins from hilight nets 20171221 */
|
||||
for(i=0;i<HASHSIZE;i++) {
|
||||
for(i=0;i<HASHSIZE; ++i) {
|
||||
entry=xctx->hilight_table[i];
|
||||
while(entry) {
|
||||
node_entry = bus_node_hash_lookup(entry->token, "", XLOOKUP, 0, "", "", "", "");
|
||||
|
|
|
|||
|
|
@ -26,8 +26,8 @@ static void free_undo_lines(int slot)
|
|||
{
|
||||
int i, c;
|
||||
|
||||
for(c = 0;c<cadlayers; c++) {
|
||||
for(i = 0;i<xctx->uslot[slot].lines[c]; i++) {
|
||||
for(c = 0;c<cadlayers; ++c) {
|
||||
for(i = 0;i<xctx->uslot[slot].lines[c]; ++i) {
|
||||
my_free(_ALLOC_ID_, &xctx->uslot[slot].lptr[c][i].prop_ptr);
|
||||
}
|
||||
my_free(_ALLOC_ID_, &xctx->uslot[slot].lptr[c]);
|
||||
|
|
@ -39,8 +39,8 @@ static void free_undo_rects(int slot)
|
|||
{
|
||||
int i, c;
|
||||
|
||||
for(c = 0;c<cadlayers; c++) {
|
||||
for(i = 0;i<xctx->uslot[slot].rects[c]; i++) {
|
||||
for(c = 0;c<cadlayers; ++c) {
|
||||
for(i = 0;i<xctx->uslot[slot].rects[c]; ++i) {
|
||||
my_free(_ALLOC_ID_, &xctx->uslot[slot].bptr[c][i].prop_ptr);
|
||||
}
|
||||
my_free(_ALLOC_ID_, &xctx->uslot[slot].bptr[c]);
|
||||
|
|
@ -52,8 +52,8 @@ static void free_undo_polygons(int slot)
|
|||
{
|
||||
int i, c;
|
||||
|
||||
for(c = 0;c<cadlayers; c++) {
|
||||
for(i = 0;i<xctx->uslot[slot].polygons[c]; i++) {
|
||||
for(c = 0;c<cadlayers; ++c) {
|
||||
for(i = 0;i<xctx->uslot[slot].polygons[c]; ++i) {
|
||||
my_free(_ALLOC_ID_, &xctx->uslot[slot].pptr[c][i].prop_ptr);
|
||||
my_free(_ALLOC_ID_, &xctx->uslot[slot].pptr[c][i].x);
|
||||
my_free(_ALLOC_ID_, &xctx->uslot[slot].pptr[c][i].y);
|
||||
|
|
@ -68,8 +68,8 @@ static void free_undo_arcs(int slot)
|
|||
{
|
||||
int i, c;
|
||||
|
||||
for(c = 0;c<cadlayers; c++) {
|
||||
for(i = 0;i<xctx->uslot[slot].arcs[c]; i++) {
|
||||
for(c = 0;c<cadlayers; ++c) {
|
||||
for(i = 0;i<xctx->uslot[slot].arcs[c]; ++i) {
|
||||
my_free(_ALLOC_ID_, &xctx->uslot[slot].aptr[c][i].prop_ptr);
|
||||
}
|
||||
my_free(_ALLOC_ID_, &xctx->uslot[slot].aptr[c]);
|
||||
|
|
@ -81,7 +81,7 @@ static void free_undo_wires(int slot)
|
|||
{
|
||||
int i;
|
||||
|
||||
for(i = 0;i<xctx->uslot[slot].wires; i++) {
|
||||
for(i = 0;i<xctx->uslot[slot].wires; ++i) {
|
||||
my_free(_ALLOC_ID_, &xctx->uslot[slot].wptr[i].prop_ptr);
|
||||
}
|
||||
my_free(_ALLOC_ID_, &xctx->uslot[slot].wptr);
|
||||
|
|
@ -92,7 +92,7 @@ static void free_undo_texts(int slot)
|
|||
{
|
||||
int i;
|
||||
|
||||
for(i = 0;i<xctx->uslot[slot].texts; i++) {
|
||||
for(i = 0;i<xctx->uslot[slot].texts; ++i) {
|
||||
my_free(_ALLOC_ID_, &xctx->uslot[slot].tptr[i].prop_ptr);
|
||||
my_free(_ALLOC_ID_, &xctx->uslot[slot].tptr[i].txt_ptr);
|
||||
my_free(_ALLOC_ID_, &xctx->uslot[slot].tptr[i].font);
|
||||
|
|
@ -105,7 +105,7 @@ static void free_undo_instances(int slot)
|
|||
{
|
||||
int i;
|
||||
|
||||
for(i = 0;i<xctx->uslot[slot].instances; i++) {
|
||||
for(i = 0;i<xctx->uslot[slot].instances; ++i) {
|
||||
my_free(_ALLOC_ID_, &xctx->uslot[slot].iptr[i].name);
|
||||
my_free(_ALLOC_ID_, &xctx->uslot[slot].iptr[i].prop_ptr);
|
||||
my_free(_ALLOC_ID_, &xctx->uslot[slot].iptr[i].instname);
|
||||
|
|
@ -121,15 +121,15 @@ static void free_undo_symbols(int slot)
|
|||
xSymbol *sym;
|
||||
|
||||
symbols = xctx->uslot[slot].symbols;
|
||||
for(i = 0;i < symbols; i++) {
|
||||
for(i = 0;i < symbols; ++i) {
|
||||
sym = &xctx->uslot[slot].symptr[i];
|
||||
my_free(_ALLOC_ID_, &sym->name);
|
||||
my_free(_ALLOC_ID_, &sym->prop_ptr);
|
||||
my_free(_ALLOC_ID_, &sym->type);
|
||||
my_free(_ALLOC_ID_, &sym->templ);
|
||||
|
||||
for(c = 0;c<cadlayers;c++) {
|
||||
for(j = 0;j<sym->polygons[c];j++) {
|
||||
for(c = 0;c<cadlayers; ++c) {
|
||||
for(j = 0;j<sym->polygons[c]; ++j) {
|
||||
if(sym->poly[c][j].prop_ptr != NULL) {
|
||||
my_free(_ALLOC_ID_, &sym->poly[c][j].prop_ptr);
|
||||
}
|
||||
|
|
@ -140,7 +140,7 @@ static void free_undo_symbols(int slot)
|
|||
my_free(_ALLOC_ID_, &sym->poly[c]);
|
||||
sym->polygons[c] = 0;
|
||||
|
||||
for(j = 0;j<sym->lines[c];j++) {
|
||||
for(j = 0;j<sym->lines[c]; ++j) {
|
||||
if(sym->line[c][j].prop_ptr != NULL) {
|
||||
my_free(_ALLOC_ID_, &sym->line[c][j].prop_ptr);
|
||||
}
|
||||
|
|
@ -148,7 +148,7 @@ static void free_undo_symbols(int slot)
|
|||
my_free(_ALLOC_ID_, &sym->line[c]);
|
||||
sym->lines[c] = 0;
|
||||
|
||||
for(j = 0;j<sym->arcs[c];j++) {
|
||||
for(j = 0;j<sym->arcs[c]; ++j) {
|
||||
if(sym->arc[c][j].prop_ptr != NULL) {
|
||||
my_free(_ALLOC_ID_, &sym->arc[c][j].prop_ptr);
|
||||
}
|
||||
|
|
@ -156,7 +156,7 @@ static void free_undo_symbols(int slot)
|
|||
my_free(_ALLOC_ID_, &sym->arc[c]);
|
||||
sym->arcs[c] = 0;
|
||||
|
||||
for(j = 0;j<sym->rects[c];j++) {
|
||||
for(j = 0;j<sym->rects[c]; ++j) {
|
||||
if(sym->rect[c][j].prop_ptr != NULL) {
|
||||
my_free(_ALLOC_ID_, &sym->rect[c][j].prop_ptr);
|
||||
}
|
||||
|
|
@ -164,7 +164,7 @@ static void free_undo_symbols(int slot)
|
|||
my_free(_ALLOC_ID_, &sym->rect[c]);
|
||||
sym->rects[c] = 0;
|
||||
}
|
||||
for(j = 0;j<sym->texts;j++) {
|
||||
for(j = 0;j<sym->texts; ++j) {
|
||||
if(sym->text[j].prop_ptr != NULL) {
|
||||
my_free(_ALLOC_ID_, &sym->text[j].prop_ptr);
|
||||
}
|
||||
|
|
@ -280,7 +280,7 @@ void mem_push_undo(void)
|
|||
memcpy(xctx->uslot[slot].rects, xctx->rects, sizeof(xctx->rects[0]) * cadlayers);
|
||||
memcpy(xctx->uslot[slot].arcs, xctx->arcs, sizeof(xctx->arcs[0]) * cadlayers);
|
||||
memcpy(xctx->uslot[slot].polygons, xctx->polygons, sizeof(xctx->polygons[0]) * cadlayers);
|
||||
for(c = 0;c<cadlayers;c++) {
|
||||
for(c = 0;c<cadlayers; ++c) {
|
||||
xctx->uslot[slot].lptr[c] = my_calloc(_ALLOC_ID_, xctx->lines[c], sizeof(xLine));
|
||||
xctx->uslot[slot].bptr[c] = my_calloc(_ALLOC_ID_, xctx->rects[c], sizeof(xRect));
|
||||
xctx->uslot[slot].pptr[c] = my_calloc(_ALLOC_ID_, xctx->polygons[c], sizeof(xPoly));
|
||||
|
|
@ -295,28 +295,28 @@ void mem_push_undo(void)
|
|||
xctx->uslot[slot].symbols = xctx->symbols;
|
||||
xctx->uslot[slot].wires = xctx->wires;
|
||||
|
||||
for(c = 0;c<cadlayers;c++) {
|
||||
for(c = 0;c<cadlayers; ++c) {
|
||||
/* lines */
|
||||
for(i = 0;i<xctx->lines[c];i++) {
|
||||
for(i = 0;i<xctx->lines[c]; ++i) {
|
||||
xctx->uslot[slot].lptr[c][i] = xctx->line[c][i];
|
||||
xctx->uslot[slot].lptr[c][i].prop_ptr = NULL;
|
||||
my_strdup(_ALLOC_ID_, &xctx->uslot[slot].lptr[c][i].prop_ptr, xctx->line[c][i].prop_ptr);
|
||||
}
|
||||
/* rects */
|
||||
for(i = 0;i<xctx->rects[c];i++) {
|
||||
for(i = 0;i<xctx->rects[c]; ++i) {
|
||||
xctx->uslot[slot].bptr[c][i] = xctx->rect[c][i];
|
||||
xctx->uslot[slot].bptr[c][i].prop_ptr = NULL;
|
||||
xctx->uslot[slot].bptr[c][i].extraptr = NULL;
|
||||
my_strdup(_ALLOC_ID_, &xctx->uslot[slot].bptr[c][i].prop_ptr, xctx->rect[c][i].prop_ptr);
|
||||
}
|
||||
/* arcs */
|
||||
for(i = 0;i<xctx->arcs[c];i++) {
|
||||
for(i = 0;i<xctx->arcs[c]; ++i) {
|
||||
xctx->uslot[slot].aptr[c][i] = xctx->arc[c][i];
|
||||
xctx->uslot[slot].aptr[c][i].prop_ptr = NULL;
|
||||
my_strdup(_ALLOC_ID_, &xctx->uslot[slot].aptr[c][i].prop_ptr, xctx->arc[c][i].prop_ptr);
|
||||
}
|
||||
/*polygons */
|
||||
for(i = 0;i<xctx->polygons[c];i++) {
|
||||
for(i = 0;i<xctx->polygons[c]; ++i) {
|
||||
int points = xctx->poly[c][i].points;
|
||||
xctx->uslot[slot].pptr[c][i] = xctx->poly[c][i];
|
||||
xctx->uslot[slot].pptr[c][i].prop_ptr = NULL;
|
||||
|
|
@ -331,7 +331,7 @@ void mem_push_undo(void)
|
|||
}
|
||||
}
|
||||
/* instances */
|
||||
for(i = 0;i<xctx->instances;i++) {
|
||||
for(i = 0;i<xctx->instances; ++i) {
|
||||
xctx->uslot[slot].iptr[i] = xctx->inst[i];
|
||||
xctx->uslot[slot].iptr[i].prop_ptr = NULL;
|
||||
xctx->uslot[slot].iptr[i].name = NULL;
|
||||
|
|
@ -345,7 +345,7 @@ void mem_push_undo(void)
|
|||
}
|
||||
|
||||
/* symbols */
|
||||
for(i = 0;i<xctx->symbols;i++) {
|
||||
for(i = 0;i<xctx->symbols; ++i) {
|
||||
sym = &xctx->uslot[slot].symptr[i];
|
||||
xctx->uslot[slot].symptr[i] = xctx->sym[i];
|
||||
sym->name = NULL;
|
||||
|
|
@ -370,17 +370,17 @@ void mem_push_undo(void)
|
|||
memcpy(sym->rects, xctx->sym[i].rects, sizeof(sym->rects[0]) * cadlayers);
|
||||
memcpy(sym->arcs, xctx->sym[i].arcs, sizeof(sym->arcs[0]) * cadlayers);
|
||||
memcpy(sym->polygons, xctx->sym[i].polygons, sizeof(sym->polygons[0]) * cadlayers);
|
||||
for(c = 0;c<cadlayers;c++) {
|
||||
for(c = 0;c<cadlayers; ++c) {
|
||||
/* symbol lines */
|
||||
sym->line[c] = my_calloc(_ALLOC_ID_, xctx->sym[i].lines[c], sizeof(xLine));
|
||||
for(j = 0; j < xctx->sym[i].lines[c]; j++) {
|
||||
for(j = 0; j < xctx->sym[i].lines[c]; ++j) {
|
||||
sym->line[c][j] = xctx->sym[i].line[c][j];
|
||||
sym->line[c][j].prop_ptr = NULL;
|
||||
my_strdup(_ALLOC_ID_, &sym->line[c][j].prop_ptr, xctx->sym[i].line[c][j].prop_ptr);
|
||||
}
|
||||
/* symbol rects */
|
||||
sym->rect[c] = my_calloc(_ALLOC_ID_, xctx->sym[i].rects[c], sizeof(xRect));
|
||||
for(j = 0; j < xctx->sym[i].rects[c]; j++) {
|
||||
for(j = 0; j < xctx->sym[i].rects[c]; ++j) {
|
||||
sym->rect[c][j] = xctx->sym[i].rect[c][j];
|
||||
sym->rect[c][j].prop_ptr = NULL;
|
||||
sym->rect[c][j].extraptr = NULL;
|
||||
|
|
@ -388,14 +388,14 @@ void mem_push_undo(void)
|
|||
}
|
||||
/* symbol arcs */
|
||||
sym->arc[c] = my_calloc(_ALLOC_ID_, xctx->sym[i].arcs[c], sizeof(xArc));
|
||||
for(j = 0; j < xctx->sym[i].arcs[c]; j++) {
|
||||
for(j = 0; j < xctx->sym[i].arcs[c]; ++j) {
|
||||
sym->arc[c][j] = xctx->sym[i].arc[c][j];
|
||||
sym->arc[c][j].prop_ptr = NULL;
|
||||
my_strdup(_ALLOC_ID_, &sym->arc[c][j].prop_ptr, xctx->sym[i].arc[c][j].prop_ptr);
|
||||
}
|
||||
/* symbol polygons */
|
||||
sym->poly[c] = my_calloc(_ALLOC_ID_, xctx->sym[i].polygons[c], sizeof(xPoly));
|
||||
for(j = 0; j < xctx->sym[i].polygons[c]; j++) {
|
||||
for(j = 0; j < xctx->sym[i].polygons[c]; ++j) {
|
||||
int points = xctx->sym[i].poly[c][j].points;
|
||||
sym->poly[c][j] = xctx->sym[i].poly[c][j];
|
||||
sym->poly[c][j].prop_ptr = NULL;
|
||||
|
|
@ -410,7 +410,7 @@ void mem_push_undo(void)
|
|||
}
|
||||
}
|
||||
/* symbol texts */
|
||||
for(j = 0; j < xctx->sym[i].texts; j++) {
|
||||
for(j = 0; j < xctx->sym[i].texts; ++j) {
|
||||
sym->text[j] = xctx->sym[i].text[j];
|
||||
sym->text[j].prop_ptr = NULL;
|
||||
sym->text[j].txt_ptr = NULL;
|
||||
|
|
@ -422,7 +422,7 @@ void mem_push_undo(void)
|
|||
|
||||
}
|
||||
/* texts */
|
||||
for(i = 0;i<xctx->texts;i++) {
|
||||
for(i = 0;i<xctx->texts; ++i) {
|
||||
xctx->uslot[slot].tptr[i] = xctx->text[i];
|
||||
xctx->uslot[slot].tptr[i].prop_ptr = NULL;
|
||||
xctx->uslot[slot].tptr[i].txt_ptr = NULL;
|
||||
|
|
@ -433,7 +433,7 @@ void mem_push_undo(void)
|
|||
}
|
||||
|
||||
/* wires */
|
||||
for(i = 0;i<xctx->wires;i++) {
|
||||
for(i = 0;i<xctx->wires; ++i) {
|
||||
xctx->uslot[slot].wptr[i] = xctx->wire[i];
|
||||
xctx->uslot[slot].wptr[i].prop_ptr = NULL;
|
||||
xctx->uslot[slot].wptr[i].node = NULL;
|
||||
|
|
@ -484,7 +484,7 @@ void mem_pop_undo(int redo, int set_modify_status)
|
|||
my_free(_ALLOC_ID_, &xctx->text);
|
||||
my_free(_ALLOC_ID_, &xctx->inst);
|
||||
|
||||
for(i = 0;i<cadlayers;i++) {
|
||||
for(i = 0;i<cadlayers; ++i) {
|
||||
my_free(_ALLOC_ID_, &xctx->rect[i]);
|
||||
my_free(_ALLOC_ID_, &xctx->line[i]);
|
||||
my_free(_ALLOC_ID_, &xctx->poly[i]);
|
||||
|
|
@ -494,7 +494,7 @@ void mem_pop_undo(int redo, int set_modify_status)
|
|||
remove_symbols();
|
||||
|
||||
|
||||
for(i = 0;i<xctx->maxs;i++) {
|
||||
for(i = 0;i<xctx->maxs; ++i) {
|
||||
my_free(_ALLOC_ID_, &xctx->sym[i].line);
|
||||
my_free(_ALLOC_ID_, &xctx->sym[i].rect);
|
||||
my_free(_ALLOC_ID_, &xctx->sym[i].arc);
|
||||
|
|
@ -515,11 +515,11 @@ void mem_pop_undo(int redo, int set_modify_status)
|
|||
my_strdup(_ALLOC_ID_, &xctx->schsymbolprop, xctx->uslot[slot].kptr);
|
||||
my_strdup(_ALLOC_ID_, &xctx->schtedaxprop, xctx->uslot[slot].eptr);
|
||||
|
||||
for(c = 0;c<cadlayers;c++) {
|
||||
for(c = 0;c<cadlayers; ++c) {
|
||||
/* lines */
|
||||
xctx->maxl[c] = xctx->lines[c] = xctx->uslot[slot].lines[c];
|
||||
xctx->line[c] = my_calloc(_ALLOC_ID_, xctx->lines[c], sizeof(xLine));
|
||||
for(i = 0;i<xctx->lines[c];i++) {
|
||||
for(i = 0;i<xctx->lines[c]; ++i) {
|
||||
xctx->line[c][i] = xctx->uslot[slot].lptr[c][i];
|
||||
xctx->line[c][i].prop_ptr = NULL;
|
||||
my_strdup(_ALLOC_ID_, &xctx->line[c][i].prop_ptr, xctx->uslot[slot].lptr[c][i].prop_ptr);
|
||||
|
|
@ -527,7 +527,7 @@ void mem_pop_undo(int redo, int set_modify_status)
|
|||
/* rects */
|
||||
xctx->maxr[c] = xctx->rects[c] = xctx->uslot[slot].rects[c];
|
||||
xctx->rect[c] = my_calloc(_ALLOC_ID_, xctx->rects[c], sizeof(xRect));
|
||||
for(i = 0;i<xctx->rects[c];i++) {
|
||||
for(i = 0;i<xctx->rects[c]; ++i) {
|
||||
xctx->rect[c][i] = xctx->uslot[slot].bptr[c][i];
|
||||
xctx->rect[c][i].prop_ptr = NULL;
|
||||
xctx->rect[c][i].extraptr = NULL;
|
||||
|
|
@ -536,7 +536,7 @@ void mem_pop_undo(int redo, int set_modify_status)
|
|||
/* arcs */
|
||||
xctx->maxa[c] = xctx->arcs[c] = xctx->uslot[slot].arcs[c];
|
||||
xctx->arc[c] = my_calloc(_ALLOC_ID_, xctx->arcs[c], sizeof(xArc));
|
||||
for(i = 0;i<xctx->arcs[c];i++) {
|
||||
for(i = 0;i<xctx->arcs[c]; ++i) {
|
||||
xctx->arc[c][i] = xctx->uslot[slot].aptr[c][i];
|
||||
xctx->arc[c][i].prop_ptr = NULL;
|
||||
my_strdup(_ALLOC_ID_, &xctx->arc[c][i].prop_ptr, xctx->uslot[slot].aptr[c][i].prop_ptr);
|
||||
|
|
@ -544,7 +544,7 @@ void mem_pop_undo(int redo, int set_modify_status)
|
|||
/* polygons */
|
||||
xctx->maxp[c] = xctx->polygons[c] = xctx->uslot[slot].polygons[c];
|
||||
xctx->poly[c] = my_calloc(_ALLOC_ID_, xctx->polygons[c], sizeof(xPoly));
|
||||
for(i = 0;i<xctx->polygons[c];i++) {
|
||||
for(i = 0;i<xctx->polygons[c]; ++i) {
|
||||
int points = xctx->uslot[slot].pptr[c][i].points;
|
||||
xctx->poly[c][i] = xctx->uslot[slot].pptr[c][i];
|
||||
xctx->poly[c][i].prop_ptr = NULL;
|
||||
|
|
@ -562,7 +562,7 @@ void mem_pop_undo(int redo, int set_modify_status)
|
|||
/* instances */
|
||||
xctx->maxi = xctx->instances = xctx->uslot[slot].instances;
|
||||
xctx->inst = my_calloc(_ALLOC_ID_, xctx->instances, sizeof(xInstance));
|
||||
for(i = 0;i<xctx->instances;i++) {
|
||||
for(i = 0;i<xctx->instances; ++i) {
|
||||
xctx->inst[i] = xctx->uslot[slot].iptr[i];
|
||||
xctx->inst[i].prop_ptr = NULL;
|
||||
xctx->inst[i].name = NULL;
|
||||
|
|
@ -578,7 +578,7 @@ void mem_pop_undo(int redo, int set_modify_status)
|
|||
xctx->maxs = xctx->symbols = xctx->uslot[slot].symbols;
|
||||
xctx->sym = my_calloc(_ALLOC_ID_, xctx->symbols, sizeof(xSymbol));
|
||||
|
||||
for(i = 0;i<xctx->symbols;i++) {
|
||||
for(i = 0;i<xctx->symbols; ++i) {
|
||||
sym = &xctx->uslot[slot].symptr[i];
|
||||
xctx->sym[i] = *sym;
|
||||
xctx->sym[i].name = NULL;
|
||||
|
|
@ -605,17 +605,17 @@ void mem_pop_undo(int redo, int set_modify_status)
|
|||
memcpy(xctx->sym[i].arcs, sym->arcs, sizeof(sym->arcs[0]) * cadlayers);
|
||||
memcpy(xctx->sym[i].polygons, sym->polygons, sizeof(sym->polygons[0]) * cadlayers);
|
||||
|
||||
for(c = 0;c<cadlayers;c++) {
|
||||
for(c = 0;c<cadlayers; ++c) {
|
||||
/* symbol lines */
|
||||
xctx->sym[i].line[c] = my_calloc(_ALLOC_ID_, sym->lines[c], sizeof(xLine));
|
||||
for(j = 0; j < xctx->sym[i].lines[c]; j++) {
|
||||
for(j = 0; j < xctx->sym[i].lines[c]; ++j) {
|
||||
xctx->sym[i].line[c][j] = sym->line[c][j];
|
||||
xctx->sym[i].line[c][j].prop_ptr = NULL;
|
||||
my_strdup(_ALLOC_ID_, & xctx->sym[i].line[c][j].prop_ptr, sym->line[c][j].prop_ptr);
|
||||
}
|
||||
/* symbol rects */
|
||||
xctx->sym[i].rect[c] = my_calloc(_ALLOC_ID_, sym->rects[c], sizeof(xRect));
|
||||
for(j = 0; j < xctx->sym[i].rects[c]; j++) {
|
||||
for(j = 0; j < xctx->sym[i].rects[c]; ++j) {
|
||||
xctx->sym[i].rect[c][j] = sym->rect[c][j];
|
||||
xctx->sym[i].rect[c][j].prop_ptr = NULL;
|
||||
xctx->sym[i].rect[c][j].extraptr = NULL;
|
||||
|
|
@ -623,14 +623,14 @@ void mem_pop_undo(int redo, int set_modify_status)
|
|||
}
|
||||
/* symbol arcs */
|
||||
xctx->sym[i].arc[c] = my_calloc(_ALLOC_ID_, sym->arcs[c], sizeof(xArc));
|
||||
for(j = 0; j < xctx->sym[i].arcs[c]; j++) {
|
||||
for(j = 0; j < xctx->sym[i].arcs[c]; ++j) {
|
||||
xctx->sym[i].arc[c][j] = sym->arc[c][j];
|
||||
xctx->sym[i].arc[c][j].prop_ptr = NULL;
|
||||
my_strdup(_ALLOC_ID_, & xctx->sym[i].arc[c][j].prop_ptr, sym->arc[c][j].prop_ptr);
|
||||
}
|
||||
/* symbol polygons */
|
||||
xctx->sym[i].poly[c] = my_calloc(_ALLOC_ID_, sym->polygons[c], sizeof(xPoly));
|
||||
for(j = 0; j < xctx->sym[i].polygons[c]; j++) {
|
||||
for(j = 0; j < xctx->sym[i].polygons[c]; ++j) {
|
||||
int points = sym->poly[c][j].points;
|
||||
xctx->sym[i].poly[c][j] = sym->poly[c][j];
|
||||
xctx->sym[i].poly[c][j].prop_ptr = NULL;
|
||||
|
|
@ -645,7 +645,7 @@ void mem_pop_undo(int redo, int set_modify_status)
|
|||
}
|
||||
}
|
||||
/* symbol texts */
|
||||
for(j = 0; j < xctx->sym[i].texts; j++) {
|
||||
for(j = 0; j < xctx->sym[i].texts; ++j) {
|
||||
xctx->sym[i].text[j] = sym->text[j];
|
||||
xctx->sym[i].text[j].prop_ptr = NULL;
|
||||
xctx->sym[i].text[j].txt_ptr = NULL;
|
||||
|
|
@ -659,7 +659,7 @@ void mem_pop_undo(int redo, int set_modify_status)
|
|||
/* texts */
|
||||
xctx->maxt = xctx->texts = xctx->uslot[slot].texts;
|
||||
xctx->text = my_calloc(_ALLOC_ID_, xctx->texts, sizeof(xText));
|
||||
for(i = 0;i<xctx->texts;i++) {
|
||||
for(i = 0;i<xctx->texts; ++i) {
|
||||
xctx->text[i] = xctx->uslot[slot].tptr[i];
|
||||
xctx->text[i].txt_ptr = NULL;
|
||||
xctx->text[i].font = NULL;
|
||||
|
|
@ -672,7 +672,7 @@ void mem_pop_undo(int redo, int set_modify_status)
|
|||
/* wires */
|
||||
xctx->maxw = xctx->wires = xctx->uslot[slot].wires;
|
||||
xctx->wire = my_calloc(_ALLOC_ID_, xctx->wires, sizeof(xWire));
|
||||
for(i = 0;i<xctx->wires;i++) {
|
||||
for(i = 0;i<xctx->wires; ++i) {
|
||||
xctx->wire[i] = xctx->uslot[slot].wptr[i];
|
||||
xctx->wire[i].prop_ptr = NULL;
|
||||
xctx->wire[i].node = NULL;
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ int main(int argc, char **argv)
|
|||
|
||||
cli_opt_argc = argc;
|
||||
cli_opt_argv = my_malloc(_ALLOC_ID_, cli_opt_argc * sizeof(char *));
|
||||
for(i = 0; i < cli_opt_argc; i++) {
|
||||
for(i = 0; i < cli_opt_argc; ++i) {
|
||||
cli_opt_argv[i] = NULL;
|
||||
my_strdup(_ALLOC_ID_, &cli_opt_argv[i], argv[i]);
|
||||
}
|
||||
|
|
|
|||
80
src/move.c
80
src/move.c
|
|
@ -30,7 +30,7 @@ void rebuild_selected_array() /* can be used only if new selected set is lower *
|
|||
dbg(2, "rebuild selected array\n");
|
||||
if(!xctx->need_reb_sel_arr) return;
|
||||
xctx->lastsel=0;
|
||||
for(i=0;i<xctx->texts;i++)
|
||||
for(i=0;i<xctx->texts; ++i)
|
||||
if(xctx->text[i].sel)
|
||||
{
|
||||
check_selected_storage();
|
||||
|
|
@ -38,7 +38,7 @@ void rebuild_selected_array() /* can be used only if new selected set is lower *
|
|||
xctx->sel_array[xctx->lastsel].n = i;
|
||||
xctx->sel_array[xctx->lastsel++].col = TEXTLAYER;
|
||||
}
|
||||
for(i=0;i<xctx->instances;i++)
|
||||
for(i=0;i<xctx->instances; ++i)
|
||||
if(xctx->inst[i].sel)
|
||||
{
|
||||
check_selected_storage();
|
||||
|
|
@ -46,7 +46,7 @@ void rebuild_selected_array() /* can be used only if new selected set is lower *
|
|||
xctx->sel_array[xctx->lastsel].n = i;
|
||||
xctx->sel_array[xctx->lastsel++].col = WIRELAYER;
|
||||
}
|
||||
for(i=0;i<xctx->wires;i++)
|
||||
for(i=0;i<xctx->wires; ++i)
|
||||
if(xctx->wire[i].sel)
|
||||
{
|
||||
check_selected_storage();
|
||||
|
|
@ -54,9 +54,9 @@ void rebuild_selected_array() /* can be used only if new selected set is lower *
|
|||
xctx->sel_array[xctx->lastsel].n = i;
|
||||
xctx->sel_array[xctx->lastsel++].col = WIRELAYER;
|
||||
}
|
||||
for(c=0;c<cadlayers;c++)
|
||||
for(c=0;c<cadlayers; ++c)
|
||||
{
|
||||
for(i=0;i<xctx->arcs[c];i++)
|
||||
for(i=0;i<xctx->arcs[c]; ++i)
|
||||
if(xctx->arc[c][i].sel)
|
||||
{
|
||||
check_selected_storage();
|
||||
|
|
@ -64,7 +64,7 @@ void rebuild_selected_array() /* can be used only if new selected set is lower *
|
|||
xctx->sel_array[xctx->lastsel].n = i;
|
||||
xctx->sel_array[xctx->lastsel++].col = c;
|
||||
}
|
||||
for(i=0;i<xctx->rects[c];i++)
|
||||
for(i=0;i<xctx->rects[c]; ++i)
|
||||
if(xctx->rect[c][i].sel)
|
||||
{
|
||||
check_selected_storage();
|
||||
|
|
@ -72,7 +72,7 @@ void rebuild_selected_array() /* can be used only if new selected set is lower *
|
|||
xctx->sel_array[xctx->lastsel].n = i;
|
||||
xctx->sel_array[xctx->lastsel++].col = c;
|
||||
}
|
||||
for(i=0;i<xctx->lines[c];i++)
|
||||
for(i=0;i<xctx->lines[c]; ++i)
|
||||
if(xctx->line[c][i].sel)
|
||||
{
|
||||
check_selected_storage();
|
||||
|
|
@ -80,7 +80,7 @@ void rebuild_selected_array() /* can be used only if new selected set is lower *
|
|||
xctx->sel_array[xctx->lastsel].n = i;
|
||||
xctx->sel_array[xctx->lastsel++].col = c;
|
||||
}
|
||||
for(i=0;i<xctx->polygons[c];i++)
|
||||
for(i=0;i<xctx->polygons[c]; ++i)
|
||||
if(xctx->poly[c][i].sel)
|
||||
{
|
||||
check_selected_storage();
|
||||
|
|
@ -100,14 +100,14 @@ void check_collapsing_objects()
|
|||
int found=0;
|
||||
|
||||
j=0;
|
||||
for(i=0;i<xctx->wires;i++)
|
||||
for(i=0;i<xctx->wires; ++i)
|
||||
{
|
||||
if(xctx->wire[i].x1==xctx->wire[i].x2 && xctx->wire[i].y1 == xctx->wire[i].y2)
|
||||
{
|
||||
my_free(_ALLOC_ID_, &xctx->wire[i].prop_ptr);
|
||||
my_free(_ALLOC_ID_, &xctx->wire[i].node);
|
||||
found=1;
|
||||
j++;
|
||||
++j;
|
||||
continue;
|
||||
}
|
||||
if(j)
|
||||
|
|
@ -118,16 +118,16 @@ void check_collapsing_objects()
|
|||
xctx->wires -= j;
|
||||
|
||||
/* option: remove degenerated lines */
|
||||
for(c=0;c<cadlayers;c++)
|
||||
for(c=0;c<cadlayers; ++c)
|
||||
{
|
||||
j = 0;
|
||||
for(i=0;i<xctx->lines[c];i++)
|
||||
for(i=0;i<xctx->lines[c]; ++i)
|
||||
{
|
||||
if(xctx->line[c][i].x1==xctx->line[c][i].x2 && xctx->line[c][i].y1 == xctx->line[c][i].y2)
|
||||
{
|
||||
my_free(_ALLOC_ID_, &xctx->line[c][i].prop_ptr);
|
||||
found=1;
|
||||
j++;
|
||||
++j;
|
||||
continue;
|
||||
}
|
||||
if(j)
|
||||
|
|
@ -137,17 +137,17 @@ void check_collapsing_objects()
|
|||
}
|
||||
xctx->lines[c] -= j;
|
||||
}
|
||||
for(c=0;c<cadlayers;c++)
|
||||
for(c=0;c<cadlayers; ++c)
|
||||
{
|
||||
j = 0;
|
||||
for(i=0;i<xctx->rects[c];i++)
|
||||
for(i=0;i<xctx->rects[c]; ++i)
|
||||
{
|
||||
if(xctx->rect[c][i].x1==xctx->rect[c][i].x2 || xctx->rect[c][i].y1 == xctx->rect[c][i].y2)
|
||||
{
|
||||
my_free(_ALLOC_ID_, &xctx->rect[c][i].prop_ptr);
|
||||
set_rect_extraptr(0, &xctx->rect[c][i]);
|
||||
found=1;
|
||||
j++;
|
||||
++j;
|
||||
continue;
|
||||
}
|
||||
if(j)
|
||||
|
|
@ -169,7 +169,7 @@ static void update_symbol_bboxes(short rot, short flip)
|
|||
int i, n;
|
||||
short save_flip, save_rot;
|
||||
|
||||
for(i=0;i<xctx->movelastsel;i++)
|
||||
for(i=0;i<xctx->movelastsel; ++i)
|
||||
{
|
||||
n = xctx->sel_array[i].n;
|
||||
dbg(1, "update_symbol_bboxes(): i=%d, movelastsel=%d, n=%d\n", i, xctx->movelastsel, n);
|
||||
|
|
@ -194,7 +194,7 @@ void draw_selection(GC g, int interruptable)
|
|||
#endif
|
||||
|
||||
if(g != xctx->gctiled) xctx->movelastsel = xctx->lastsel;
|
||||
for(i=0;i<xctx->movelastsel;i++)
|
||||
for(i=0;i<xctx->movelastsel; ++i)
|
||||
{
|
||||
c = xctx->sel_array[i].col;n = xctx->sel_array[i].n;
|
||||
switch(xctx->sel_array[i].type)
|
||||
|
|
@ -299,7 +299,7 @@ void draw_selection(GC g, int interruptable)
|
|||
double *x = my_malloc(_ALLOC_ID_, sizeof(double) *xctx->poly[c][n].points);
|
||||
double *y = my_malloc(_ALLOC_ID_, sizeof(double) *xctx->poly[c][n].points);
|
||||
if(xctx->poly[c][n].sel==SELECTED || xctx->poly[c][n].sel==SELECTED1) {
|
||||
for(k=0;k<xctx->poly[c][n].points; k++) {
|
||||
for(k=0;k<xctx->poly[c][n].points; ++k) {
|
||||
if( xctx->poly[c][n].sel==SELECTED || xctx->poly[c][n].selected_point[k]) {
|
||||
if(xctx->rotatelocal) {
|
||||
ROTATION(xctx->move_rot, xctx->move_flip, xctx->poly[c][n].x[0], xctx->poly[c][n].y[0],
|
||||
|
|
@ -439,7 +439,7 @@ void draw_selection(GC g, int interruptable)
|
|||
ROTATION(xctx->move_rot, xctx->move_flip, xctx->x1, xctx->y_1,
|
||||
xctx->inst[n].x0, xctx->inst[n].y0, xctx->rx1,xctx->ry1);
|
||||
}
|
||||
for(k=0;k<cadlayers;k++) {
|
||||
for(k=0;k<cadlayers; ++k) {
|
||||
draw_temp_symbol(ADD, g, n, k, xctx->move_flip,
|
||||
( xctx->move_flip && (xctx->inst[n].rot & 1) ) ? xctx->move_rot+2 : xctx->move_rot,
|
||||
xctx->rx1-xctx->inst[n].x0+xctx->deltax,xctx->ry1-xctx->inst[n].y0+xctx->deltay);
|
||||
|
|
@ -465,7 +465,7 @@ void draw_selection(GC g, int interruptable)
|
|||
return;
|
||||
}
|
||||
#endif
|
||||
} /* for(i=0;i<xctx->movelastsel;i++) */
|
||||
} /* for(i=0;i<xctx->movelastsel; ++i) */
|
||||
drawtemparc(g, END, 0.0, 0.0, 0.0, 0.0, 0.0);
|
||||
drawtemprect(g, END, 0.0, 0.0, 0.0, 0.0);
|
||||
drawtempline(g, END, 0.0, 0.0, 0.0, 0.0);
|
||||
|
|
@ -506,7 +506,7 @@ void find_inst_to_be_redrawn(int what)
|
|||
if(xctx->node_redraw_table.table == NULL) int_hash_init(&xctx->node_redraw_table, HASHSIZE);
|
||||
if(what & 32) prepare_netlist_structs(0);
|
||||
if(!(what & 8)) {
|
||||
for(i=0;i<xctx->lastsel;i++)
|
||||
for(i=0;i<xctx->lastsel; ++i)
|
||||
{
|
||||
n = xctx->sel_array[i].n;
|
||||
if( xctx->sel_array[i].type == ELEMENT) {
|
||||
|
|
@ -533,7 +533,7 @@ void find_inst_to_be_redrawn(int what)
|
|||
my_realloc(_ALLOC_ID_, &xctx->inst_redraw_table, xctx->instances * sizeof(unsigned char));
|
||||
xctx->inst_redraw_table_size = xctx->instances;
|
||||
}
|
||||
for(i=0; i < xctx->instances; i++) {
|
||||
for(i=0; i < xctx->instances; ++i) {
|
||||
sym = xctx->inst[i].ptr + xctx->sym;
|
||||
rects = sym->rects[PINLAYER];
|
||||
if(what & 2 && xctx->inst_redraw_table[i]) {
|
||||
|
|
@ -562,7 +562,7 @@ void find_inst_to_be_redrawn(int what)
|
|||
}
|
||||
}
|
||||
|
||||
if(what & 5) for(i=0;i < xctx->wires; i++) {
|
||||
if(what & 5) for(i=0;i < xctx->wires; ++i) {
|
||||
if(xctx->wire[i].node) {
|
||||
nentry = int_hash_lookup(&xctx->node_redraw_table, xctx->wire[i].node, 0, XLOOKUP);
|
||||
if(nentry) {
|
||||
|
|
@ -586,7 +586,7 @@ void find_inst_to_be_redrawn(int what)
|
|||
}
|
||||
} /* if((s_pnetname || xctx->hilight_nets)) */
|
||||
if(!(what & 8) ) {
|
||||
if(what & 5) for(i=0;i<xctx->lastsel;i++) { /* add bboxes of selected objects */
|
||||
if(what & 5) for(i=0;i<xctx->lastsel; ++i) { /* add bboxes of selected objects */
|
||||
n = xctx->sel_array[i].n;
|
||||
if( xctx->sel_array[i].type == ELEMENT) {
|
||||
dbg(1, "find_inst_to_be_redrawn(): 5 bboxing inst %s\n", xctx->inst[n].instname);
|
||||
|
|
@ -671,7 +671,7 @@ void copy_objects(int what)
|
|||
update_symbol_bboxes(0, 0);
|
||||
find_inst_to_be_redrawn(0); /* build list before copying and recalculating prepare_netlist_structs() */
|
||||
|
||||
for(i=0;i<xctx->lastsel;i++)
|
||||
for(i=0;i<xctx->lastsel; ++i)
|
||||
{
|
||||
n = xctx->sel_array[i].n;
|
||||
if(xctx->sel_array[i].type == WIRE)
|
||||
|
|
@ -729,9 +729,9 @@ void copy_objects(int what)
|
|||
}
|
||||
}
|
||||
|
||||
for(k=0;k<cadlayers;k++)
|
||||
for(k=0;k<cadlayers; ++k)
|
||||
{
|
||||
for(i=0;i<xctx->lastsel;i++)
|
||||
for(i=0;i<xctx->lastsel; ++i)
|
||||
{
|
||||
c = xctx->sel_array[i].col;n = xctx->sel_array[i].n;
|
||||
switch(xctx->sel_array[i].type)
|
||||
|
|
@ -798,7 +798,7 @@ void copy_objects(int what)
|
|||
double *x = my_malloc(_ALLOC_ID_, sizeof(double) *p->points);
|
||||
double *y = my_malloc(_ALLOC_ID_, sizeof(double) *p->points);
|
||||
int j;
|
||||
for(j=0; j<p->points; j++) {
|
||||
for(j=0; j<p->points; ++j) {
|
||||
if( p->sel==SELECTED || p->selected_point[j]) {
|
||||
if(xctx->rotatelocal) {
|
||||
ROTATION(xctx->move_rot, xctx->move_flip, p->x[0], p->y[0], p->x[j], p->y[j], xctx->rx1,xctx->ry1);
|
||||
|
|
@ -934,15 +934,15 @@ void copy_objects(int what)
|
|||
default:
|
||||
break;
|
||||
} /* end switch(xctx->sel_array[i].type) */
|
||||
} /* end for(i=0;i<xctx->lastsel;i++) */
|
||||
} /* end for(i=0;i<xctx->lastsel; ++i) */
|
||||
|
||||
|
||||
} /* end for(k=0;k<cadlayers;k++) */
|
||||
} /* end for(k=0;k<cadlayers; ++k) */
|
||||
|
||||
|
||||
|
||||
|
||||
for(i = 0; i < xctx->lastsel; i++) {
|
||||
for(i = 0; i < xctx->lastsel; ++i) {
|
||||
n = xctx->sel_array[i].n;
|
||||
if(xctx->sel_array[i].type == ELEMENT) {
|
||||
xctx->prep_hash_inst = 0;
|
||||
|
|
@ -985,7 +985,7 @@ void copy_objects(int what)
|
|||
tclgetboolvar("disable_unique_names"));
|
||||
xctx->instances++;
|
||||
} /* if(xctx->sel_array[i].type == ELEMENT) */
|
||||
} /* for(i = 0; i < xctx->lastsel; i++) */
|
||||
} /* for(i = 0; i < xctx->lastsel; ++i) */
|
||||
xctx->need_reb_sel_arr=1;
|
||||
rebuild_selected_array();
|
||||
if(!firsti || !firstw) {
|
||||
|
|
@ -1099,9 +1099,9 @@ void move_objects(int what, int merge, double dx, double dy)
|
|||
draw_selection(xctx->gctiled,0);
|
||||
update_symbol_bboxes(0, 0);
|
||||
find_inst_to_be_redrawn(0); /* build list before moving and recalculating prepare_netlist_structs() */
|
||||
for(k=0;k<cadlayers;k++)
|
||||
for(k=0;k<cadlayers; ++k)
|
||||
{
|
||||
for(i=0;i<xctx->lastsel;i++)
|
||||
for(i=0;i<xctx->lastsel; ++i)
|
||||
{
|
||||
c = xctx->sel_array[i].col;n = xctx->sel_array[i].n;
|
||||
switch(xctx->sel_array[i].type)
|
||||
|
|
@ -1254,7 +1254,7 @@ void move_objects(int what, int merge, double dx, double dy)
|
|||
double savex0, savey0;
|
||||
savex0 = p->x[0];
|
||||
savey0 = p->y[0];
|
||||
for(j=0; j<p->points; j++) {
|
||||
for(j=0; j<p->points; ++j) {
|
||||
if(j==0 || p->x[j] < bx1) bx1 = p->x[j];
|
||||
if(j==0 || p->y[j] < by1) by1 = p->y[j];
|
||||
if(j==0 || p->x[j] > bx2) bx2 = p->x[j];
|
||||
|
|
@ -1276,7 +1276,7 @@ void move_objects(int what, int merge, double dx, double dy)
|
|||
}
|
||||
bbox(ADD, bx1, by1, bx2, by2); /* bbox before move */
|
||||
|
||||
for(j=0; j<p->points; j++) {
|
||||
for(j=0; j<p->points; ++j) {
|
||||
if(j==0 || p->x[j] < bx1) bx1 = p->x[j];
|
||||
if(j==0 || p->y[j] < by1) by1 = p->y[j];
|
||||
if(j==0 || p->x[j] > bx2) bx2 = p->x[j];
|
||||
|
|
@ -1478,10 +1478,10 @@ void move_objects(int what, int merge, double dx, double dy)
|
|||
default:
|
||||
break;
|
||||
} /* end switch(xctx->sel_array[i].type) */
|
||||
} /* end for(i=0;i<xctx->lastsel;i++) */
|
||||
} /*end for(k=0;k<cadlayers;k++) */
|
||||
} /* end for(i=0;i<xctx->lastsel; ++i) */
|
||||
} /*end for(k=0;k<cadlayers; ++k) */
|
||||
|
||||
for(i = 0; i < xctx->lastsel; i++) {
|
||||
for(i = 0; i < xctx->lastsel; ++i) {
|
||||
n = xctx->sel_array[i].n;
|
||||
if(xctx->sel_array[i].type == ELEMENT) {
|
||||
xctx->prep_hash_inst=0;
|
||||
|
|
|
|||
104
src/netlist.c
104
src/netlist.c
|
|
@ -60,8 +60,8 @@ void del_inst_table(void)
|
|||
{
|
||||
int i,j;
|
||||
|
||||
for(i=0;i<NBOXES;i++)
|
||||
for(j=0;j<NBOXES;j++)
|
||||
for(i=0;i<NBOXES; ++i)
|
||||
for(j=0;j<NBOXES; ++j)
|
||||
xctx->inst_spatial_table[i][j] = delinstentry(xctx->inst_spatial_table[i][j]);
|
||||
xctx->prep_hash_inst=0;
|
||||
dbg(1, "del_inst_table(): cleared object hash table\n");
|
||||
|
|
@ -96,14 +96,14 @@ void hash_inst(int what, int n) /* 20171203 insert object bbox in spatial hash t
|
|||
|
||||
/*loop thru all squares that intersect bbox of object[k] */
|
||||
counti=0;
|
||||
for(i=x1a; i<=x2a && counti < NBOXES; i++)
|
||||
for(i=x1a; i<=x2a && counti < NBOXES; ++i)
|
||||
{
|
||||
counti++;
|
||||
++counti;
|
||||
tmpi=i%NBOXES; if(tmpi<0) tmpi+=NBOXES;
|
||||
countj=0;
|
||||
for(j=y1a; j<=y2a && countj < NBOXES; j++)
|
||||
for(j=y1a; j<=y2a && countj < NBOXES; ++j)
|
||||
{
|
||||
countj++;
|
||||
++countj;
|
||||
tmpj=j%NBOXES; if(tmpj<0) tmpj+=NBOXES;
|
||||
/* insert object_ptr[n] in region [tmpi, tmpj] */
|
||||
if(what == XINSERT) instinsert(n, tmpi, tmpj);
|
||||
|
|
@ -117,7 +117,7 @@ void hash_instances(void) /* 20171203 insert object bbox in spatial hash table *
|
|||
|
||||
if(xctx->prep_hash_inst) return;
|
||||
del_inst_table();
|
||||
for(n=0; n<xctx->instances; n++) {
|
||||
for(n=0; n<xctx->instances; ++n) {
|
||||
hash_inst(XINSERT, n);
|
||||
}
|
||||
xctx->prep_hash_inst=1;
|
||||
|
|
@ -174,8 +174,8 @@ static void del_inst_pin_table(void)
|
|||
{
|
||||
int i,j;
|
||||
|
||||
for(i=0;i<NBOXES;i++)
|
||||
for(j=0;j<NBOXES;j++)
|
||||
for(i=0;i<NBOXES; ++i)
|
||||
for(j=0;j<NBOXES; ++j)
|
||||
xctx->instpin_spatial_table[i][j] = delinstpinentry(xctx->instpin_spatial_table[i][j]);
|
||||
}
|
||||
|
||||
|
|
@ -219,8 +219,8 @@ void del_wire_table(void)
|
|||
{
|
||||
int i,j;
|
||||
|
||||
for(i=0;i<NBOXES;i++)
|
||||
for(j=0;j<NBOXES;j++)
|
||||
for(i=0;i<NBOXES; ++i)
|
||||
for(j=0;j<NBOXES; ++j)
|
||||
xctx->wire_spatial_table[i][j] = delwireentry(xctx->wire_spatial_table[i][j]);
|
||||
xctx->prep_hash_wires=0;
|
||||
}
|
||||
|
|
@ -324,14 +324,14 @@ void hash_wire(int what, int n, int incremental)
|
|||
|
||||
/*loop thru all squares that intersect bbox of wire[k] */
|
||||
counti=0;
|
||||
for(i=x1a; i<=x2a && counti < NBOXES; i++)
|
||||
for(i=x1a; i<=x2a && counti < NBOXES; ++i)
|
||||
{
|
||||
counti++;
|
||||
++counti;
|
||||
tmpi=i%NBOXES; if(tmpi<0) tmpi+=NBOXES;
|
||||
countj=0;
|
||||
for(j=y1a; j<=y2a && countj < NBOXES; j++)
|
||||
for(j=y1a; j<=y2a && countj < NBOXES; ++j)
|
||||
{
|
||||
countj++;
|
||||
++countj;
|
||||
tmpj=j%NBOXES; if(tmpj<0) tmpj+=NBOXES;
|
||||
/* insert wire[n] in region [tmpi, tmpj] */
|
||||
if(what==XINSERT) wireinsert(n, tmpi, tmpj);
|
||||
|
|
@ -351,7 +351,7 @@ void hash_wires(void)
|
|||
if(xctx->prep_hash_wires) return;
|
||||
del_wire_table();
|
||||
|
||||
for(n=0; n<xctx->wires; n++) hash_wire(XINSERT, n, 0);
|
||||
for(n=0; n<xctx->wires; ++n) hash_wire(XINSERT, n, 0);
|
||||
xctx->prep_hash_wires=1;
|
||||
}
|
||||
|
||||
|
|
@ -373,7 +373,7 @@ int check_lib(int what, const char *s)
|
|||
range = atoi(tclresult());
|
||||
dbg(1, "check_lib(): s=%s, range=%d\n", s, range);
|
||||
|
||||
for(i=0;i<range;i++){
|
||||
for(i=0;i<range; ++i){
|
||||
if(what & 1 ) my_snprintf(str, S(str), "lindex $xschem_libs %d",i);
|
||||
if(what & 2 ) my_snprintf(str, S(str), "lindex $noprint_libs %d",i);
|
||||
if(what & 4 ) my_snprintf(str, S(str), "lindex $nolist_libs %d",i);
|
||||
|
|
@ -441,8 +441,8 @@ static void print_wires(void)
|
|||
{
|
||||
int i,j;
|
||||
Wireentry *ptr;
|
||||
for(i=0;i<NBOXES;i++) {
|
||||
for(j=0;j<NBOXES;j++)
|
||||
for(i=0;i<NBOXES; ++i) {
|
||||
for(j=0;j<NBOXES; ++j)
|
||||
{
|
||||
dbg(1, "print_wires(): %4d%4d :\n",i,j);
|
||||
ptr=xctx->wire_spatial_table[i][j];
|
||||
|
|
@ -481,7 +481,7 @@ int record_global_node(int what, FILE *fp, char *node)
|
|||
if( what==1 || what==3) {
|
||||
if(!node) return 0;
|
||||
if(!strcmp(node, "0")) return 1;
|
||||
for(i=0;i<max_globals;i++) {
|
||||
for(i=0;i<max_globals; ++i) {
|
||||
if( !strcmp(node, globals[i] )) return 1; /* node is a global */
|
||||
}
|
||||
if(what == 3) return 0; /* node is not a global */
|
||||
|
|
@ -493,7 +493,7 @@ int record_global_node(int what, FILE *fp, char *node)
|
|||
my_strdup(_ALLOC_ID_, &globals[max_globals], node);
|
||||
max_globals++;
|
||||
} else if(what == 0 || what == 2) {
|
||||
for(i=0;i<max_globals;i++) {
|
||||
for(i=0;i<max_globals; ++i) {
|
||||
if(what == 0 && xctx->netlist_type == CAD_SPICE_NETLIST) fprintf(fp, ".GLOBAL %s\n", globals[i]);
|
||||
if(what == 0 && xctx->netlist_type == CAD_TEDAX_NETLIST) fprintf(fp, "__GLOBAL__ %s\n", globals[i]);
|
||||
my_free(_ALLOC_ID_, &globals[i]);
|
||||
|
|
@ -583,13 +583,13 @@ static void name_generics()
|
|||
|
||||
/* name generic pins from attached labels */
|
||||
dbg(2, "prepare_netlist_structs(): naming generics from attached labels\n");
|
||||
if(for_netlist) for (i=0;i<instances;i++) { /* ... assign node fields on all (non label) instances */
|
||||
if(for_netlist) for (i=0;i<instances; ++i) { /* ... assign node fields on all (non label) instances */
|
||||
if(inst[i].ptr<0) continue;
|
||||
my_strdup(_ALLOC_ID_, &type,(inst[i].ptr+ xctx->sym)->type);
|
||||
if(type && !IS_LABEL_OR_PIN(type) ) {
|
||||
if((generic_rects = (inst[i].ptr+ xctx->sym)->rects[GENERICLAYER]) > 0) {
|
||||
rects = (inst[i].ptr+ xctx->sym)->rects[PINLAYER];
|
||||
for (j=rects;j<rects+generic_rects;j++) {
|
||||
for (j=rects;j<rects+generic_rects; ++j) {
|
||||
if(inst[i].node[j]) continue; /* already named node */
|
||||
rct=(inst[i].ptr+ xctx->sym)->rect[GENERICLAYER];
|
||||
x0=(rct[j-rects].x1+rct[j-rects].x2)/2;
|
||||
|
|
@ -626,7 +626,7 @@ static void name_generics()
|
|||
} /* end if(inst[iptr->n].node[iptr->pin] != NULL) */
|
||||
} /* end if( (iptr->x0==x0) && (iptr->y0==y0) ) */
|
||||
} /* end for(iptr=xctx->instpin_spatial_table[sqx][sqy]; iptr; iptr = iptr ->next) */
|
||||
} /* end for(j=0;j<rects;j++) */
|
||||
} /* end for(j=0;j<rects; ++j) */
|
||||
} /* end if( rects=...>0) */
|
||||
} /* end if(type not a label nor pin)... */
|
||||
} /* end for(i...) */
|
||||
|
|
@ -720,12 +720,12 @@ static void wirecheck(int k) /* recursive routine */
|
|||
y2a = (int)floor(y2 / BOXSIZE);
|
||||
/*loop thru all squares that intersect bbox of wire[k] */
|
||||
counti = 0;
|
||||
for(i = x1a; i <= x2a && counti < NBOXES; i++) {
|
||||
counti++;
|
||||
for(i = x1a; i <= x2a && counti < NBOXES; ++i) {
|
||||
++counti;
|
||||
tmpi = i % NBOXES; if(tmpi < 0) tmpi += NBOXES;
|
||||
countj = 0;
|
||||
for(j = y1a; j <= y2a && countj < NBOXES; j++) {
|
||||
countj++;
|
||||
for(j = y1a; j <= y2a && countj < NBOXES; ++j) {
|
||||
++countj;
|
||||
tmpj = j % NBOXES; if(tmpj < 0) tmpj += NBOXES;
|
||||
/*check if wire[k] touches wires in square [tmpi, tmpj] */
|
||||
for(wptr = xctx->wire_spatial_table[tmpi][tmpj]; wptr; wptr = wptr->next) {
|
||||
|
|
@ -814,12 +814,12 @@ static int find_pass_through_symbols(int what, int ninst)
|
|||
if(what == 0 ) { /* initialize */
|
||||
pt_symbol = my_calloc(_ALLOC_ID_, xctx->symbols, sizeof(int));
|
||||
symtable = my_calloc(_ALLOC_ID_, xctx->symbols, sizeof(int));
|
||||
for(i = 0; i < instances; i++) {
|
||||
for(i = 0; i < instances; ++i) {
|
||||
k = inst[i].ptr;
|
||||
if( k < 0 || symtable[k] ) continue;
|
||||
symtable[k] =1;
|
||||
int_hash_init(&table, 37);
|
||||
for(j = 0; j < xctx->sym[k].rects[PINLAYER]; j++) {
|
||||
for(j = 0; j < xctx->sym[k].rects[PINLAYER]; ++j) {
|
||||
const char *pin_name = get_tok_value(xctx->sym[k].rect[PINLAYER][j].prop_ptr, "name", 0);
|
||||
if(int_hash_lookup(&table, pin_name, j, XINSERT_NOREPLACE)) {
|
||||
dbg(1, " pass thru symbol found\n");
|
||||
|
|
@ -857,7 +857,7 @@ static void instcheck(int n, int p)
|
|||
char *pin_name = NULL;
|
||||
my_strdup(_ALLOC_ID_, &pin_name, get_tok_value(xctx->sym[k].rect[PINLAYER][p].prop_ptr, "name", 0));
|
||||
if(p >= rects) return;
|
||||
for(j = 0; j < rects; j++) {
|
||||
for(j = 0; j < rects; ++j) {
|
||||
const char *other_pin;
|
||||
if(j == p) continue;
|
||||
other_pin = get_tok_value(xctx->sym[k].rect[PINLAYER][j].prop_ptr, "name", 0);
|
||||
|
|
@ -907,7 +907,7 @@ static void name_nodes_of_pins_labels_and_propagate()
|
|||
* print_erc must be set to 0 to avoid double erc printing
|
||||
*/
|
||||
print_erc = (xctx->netlist_count == 0 || startlevel < xctx->currsch) && for_netlist;
|
||||
for (i=0;i<instances;i++) {
|
||||
for (i=0;i<instances; ++i) {
|
||||
/* name ipin opin label node fields from prop_ptr attributes */
|
||||
if(inst[i].ptr<0) continue;
|
||||
|
||||
|
|
@ -1020,7 +1020,7 @@ static void name_unlabeled_nets()
|
|||
|
||||
/* name nets that do not touch ipin opin alias instances */
|
||||
dbg(2, "prepare_netlist_structs(): naming nets that dont touch labels\n");
|
||||
for (i = 0; i < xctx->wires; i++)
|
||||
for (i = 0; i < xctx->wires; ++i)
|
||||
{
|
||||
if(xctx->wire[i].node == NULL)
|
||||
{
|
||||
|
|
@ -1052,10 +1052,10 @@ static void name_unlabeled_instances()
|
|||
|
||||
/* name nets that do not touch ipin opin alias instances */
|
||||
dbg(2, "prepare_netlist_structs(): naming nets that dont touch labels\n");
|
||||
for (i = 0; i < instances; i++)
|
||||
for (i = 0; i < instances; ++i)
|
||||
{
|
||||
rects=(inst[i].ptr+ xctx->sym)->rects[PINLAYER];
|
||||
for(j = 0; j < rects; j++) {
|
||||
for(j = 0; j < rects; ++j) {
|
||||
if(inst[i].node[j] == NULL)
|
||||
{
|
||||
set_unnamed_inst(i, j);
|
||||
|
|
@ -1074,7 +1074,7 @@ static void reset_node_data_and_rehash()
|
|||
/* reset wire & inst node labels */
|
||||
dbg(2, "prepare_netlist_structs(): rehashing wires and instance pins in spatial hash table\n");
|
||||
hash_wires();
|
||||
for (i=0;i<instances;i++)
|
||||
for (i=0;i<instances; ++i)
|
||||
{
|
||||
if(inst[i].ptr<0) continue;
|
||||
rects=(inst[i].ptr+ xctx->sym)->rects[PINLAYER] +
|
||||
|
|
@ -1082,7 +1082,7 @@ static void reset_node_data_and_rehash()
|
|||
if(rects > 0)
|
||||
{
|
||||
inst[i].node = my_malloc(_ALLOC_ID_, sizeof(char *) * rects);
|
||||
for (j=0;j<rects;j++)
|
||||
for (j=0;j<rects; ++j)
|
||||
{
|
||||
inst[i].node[j]=NULL;
|
||||
hash_inst_pin(XINSERT, i, j);
|
||||
|
|
@ -1134,7 +1134,7 @@ void delete_inst_node(int i)
|
|||
(xctx->inst[i].ptr+ xctx->sym)->rects[GENERICLAYER];
|
||||
if( rects > 0 )
|
||||
{
|
||||
for(j=0;j< rects ;j++)
|
||||
for(j=0;j< rects ; ++j)
|
||||
my_free(_ALLOC_ID_, &xctx->inst[i].node[j]);
|
||||
my_free(_ALLOC_ID_, &xctx->inst[i].node );
|
||||
}
|
||||
|
|
@ -1145,11 +1145,11 @@ 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(_ALLOC_ID_, &xctx->wire[i].node);
|
||||
}
|
||||
|
|
@ -1170,7 +1170,7 @@ int warning_overlapped_symbols(int sel)
|
|||
char s[512];
|
||||
|
||||
int_hash_init(&table, HASHSIZE);
|
||||
for(i = 0; i < xctx->instances; i++) {
|
||||
for(i = 0; i < xctx->instances; ++i) {
|
||||
dbg(1, "instance:%s: %s\n", xctx->inst[i].instname, xctx->inst[i].name);
|
||||
my_snprintf(s, S(s), "%g %g %g %g",
|
||||
xctx->inst[i].xx1, xctx->inst[i].yy1, xctx->inst[i].xx2, xctx->inst[i].yy2);
|
||||
|
|
@ -1218,7 +1218,7 @@ int sym_vs_sch_pins()
|
|||
char filename[PATH_MAX];
|
||||
char f_version[100];
|
||||
n_syms = xctx->symbols;
|
||||
for(i=0;i<n_syms;i++)
|
||||
for(i=0;i<n_syms; ++i)
|
||||
{
|
||||
if( xctx->sym[i].type && !strcmp(xctx->sym[i].type,"subcircuit")) {
|
||||
rects = xctx->sym[i].rects[PINLAYER];
|
||||
|
|
@ -1271,7 +1271,7 @@ int sym_vs_sch_pins()
|
|||
read_line(fd, 0);
|
||||
break;
|
||||
}
|
||||
for(j=0;j<tmpi;j++) {
|
||||
for(j=0;j<tmpi; ++j) {
|
||||
if(fscanf(fd, "%lf %lf ",&tmpd, &tmpd)<2) {
|
||||
fprintf(errfp,"sym_vs_sch_pins(): WARNING: missing fields for POLYGON points, ignoring.\n");
|
||||
read_line(fd, 0);
|
||||
|
|
@ -1329,7 +1329,7 @@ int sym_vs_sch_pins()
|
|||
my_strdup(_ALLOC_ID_, &(lab_array[pin_cnt]), lab);
|
||||
pin_cnt++;
|
||||
pin_match = 0;
|
||||
for(j=0; j < rects; j++) {
|
||||
for(j=0; j < rects; ++j) {
|
||||
my_strdup(_ALLOC_ID_, &pin_name,
|
||||
expandlabel(get_tok_value(xctx->sym[i].rect[PINLAYER][j].prop_ptr, "name", 0), &mult));
|
||||
my_strdup(_ALLOC_ID_, &pin_dir, get_tok_value(xctx->sym[i].rect[PINLAYER][j].prop_ptr, "dir", 0));
|
||||
|
|
@ -1347,7 +1347,7 @@ int sym_vs_sch_pins()
|
|||
my_snprintf(str, S(str), " %s <--> %s", type, pin_dir);
|
||||
statusmsg(str,2);
|
||||
tcleval("show_infotext"); /* critical error: force ERC window showing */
|
||||
for(j = 0; j < xctx->instances; j++) {
|
||||
for(j = 0; j < xctx->instances; ++j) {
|
||||
if(!xctx->x_strcmp(xctx->inst[j].name, xctx->sym[i].name)) {
|
||||
xctx->inst[i].color = -PINLAYER;
|
||||
xctx->hilight_nets=1;
|
||||
|
|
@ -1364,7 +1364,7 @@ int sym_vs_sch_pins()
|
|||
my_snprintf(str, S(str), "Symbol %s: schematic pin: %s not in symbol", xctx->sym[i].name, lab);
|
||||
statusmsg(str,2);
|
||||
tcleval("show_infotext"); /* critical error: force ERC window showing */
|
||||
for(j = 0; j < xctx->instances; j++) {
|
||||
for(j = 0; j < xctx->instances; ++j) {
|
||||
if(!xctx->x_strcmp(xctx->inst[j].name, xctx->sym[i].name)) {
|
||||
xctx->inst[i].color = -PINLAYER;
|
||||
xctx->hilight_nets=1;
|
||||
|
|
@ -1398,18 +1398,18 @@ int sym_vs_sch_pins()
|
|||
xctx->sym[i].name, rects, pin_cnt);
|
||||
statusmsg(str,2);
|
||||
tcleval("show_infotext"); /* critical error: force ERC window showing */
|
||||
for(j = 0; j < xctx->instances; j++) {
|
||||
for(j = 0; j < xctx->instances; ++j) {
|
||||
if(!xctx->x_strcmp(xctx->inst[j].name, xctx->sym[i].name)) {
|
||||
xctx->inst[i].color = -PINLAYER;
|
||||
xctx->hilight_nets=1;
|
||||
}
|
||||
}
|
||||
}
|
||||
for(j=0; j < rects; j++) {
|
||||
for(j=0; j < rects; ++j) {
|
||||
my_strdup(_ALLOC_ID_, &pin_name,
|
||||
expandlabel(get_tok_value(xctx->sym[i].rect[PINLAYER][j].prop_ptr, "name", 0), &mult));
|
||||
pin_match = 0;
|
||||
for(k=0; k<pin_cnt; k++) {
|
||||
for(k=0; k<pin_cnt; ++k) {
|
||||
if(pin_name && !strcmp(lab_array[k], pin_name)) {
|
||||
pin_match++;
|
||||
break;
|
||||
|
|
@ -1422,7 +1422,7 @@ int sym_vs_sch_pins()
|
|||
xctx->sym[i].name, pin_name ? pin_name : "<NULL>");
|
||||
statusmsg(str,2);
|
||||
tcleval("show_infotext"); /* critical error: force ERC window showing */
|
||||
for(k = 0; k < xctx->instances; k++) {
|
||||
for(k = 0; k < xctx->instances; ++k) {
|
||||
if(!xctx->x_strcmp(xctx->inst[k].name, xctx->sym[i].name)) {
|
||||
xctx->inst[i].color = -PINLAYER;
|
||||
xctx->hilight_nets=1;
|
||||
|
|
@ -1432,7 +1432,7 @@ int sym_vs_sch_pins()
|
|||
}
|
||||
}
|
||||
if(lab_array_size) {
|
||||
for(k=0;k<pin_cnt;k++) {
|
||||
for(k=0;k<pin_cnt; ++k) {
|
||||
my_free(_ALLOC_ID_, &(lab_array[k]));
|
||||
}
|
||||
my_free(_ALLOC_ID_, &lab_array);
|
||||
|
|
@ -1445,7 +1445,7 @@ int sym_vs_sch_pins()
|
|||
my_free(_ALLOC_ID_, &lab);
|
||||
my_free(_ALLOC_ID_, &pin_name);
|
||||
my_free(_ALLOC_ID_, &pin_dir);
|
||||
} /* for(i=0;i<n_syms;i++) */
|
||||
} /* for(i=0;i<n_syms; ++i) */
|
||||
|
||||
while(xctx->symbols > n_syms) remove_symbol(xctx->symbols - 1);
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -185,7 +185,7 @@ void node_hash_free(void) /* remove the whole hash table */
|
|||
int i;
|
||||
|
||||
dbg(2, "node_hash_free(): removing hash table\n");
|
||||
for(i=0;i<HASHSIZE;i++)
|
||||
for(i=0;i<HASHSIZE; ++i)
|
||||
{
|
||||
node_hash_free_entry( xctx->node_table[i] );
|
||||
xctx->node_table[i] = NULL;
|
||||
|
|
@ -200,7 +200,7 @@ void traverse_node_hash()
|
|||
int incr_hi;
|
||||
|
||||
incr_hi = tclgetboolvar("incr_hilight");
|
||||
for(i=0;i<HASHSIZE;i++)
|
||||
for(i=0;i<HASHSIZE; ++i)
|
||||
{
|
||||
entry = xctx->node_table[i];
|
||||
while(entry)
|
||||
|
|
@ -259,7 +259,7 @@ void print_vhdl_signals(FILE *fd)
|
|||
char *class=NULL;
|
||||
|
||||
found=0;
|
||||
for(i=0;i<HASHSIZE;i++) {
|
||||
for(i=0;i<HASHSIZE; ++i) {
|
||||
ptr = xctx->node_table[i];
|
||||
while(ptr) {
|
||||
if(strstr(ptr->token, ".")) {
|
||||
|
|
@ -323,7 +323,7 @@ void print_verilog_signals(FILE *fd)
|
|||
|
||||
dbg(2, " print_verilog_signals(): entering routine\n");
|
||||
found=0;
|
||||
for(i=0;i<HASHSIZE;i++) {
|
||||
for(i=0;i<HASHSIZE; ++i) {
|
||||
ptr = xctx->node_table[i];
|
||||
while(ptr) {
|
||||
if(ptr->d.port == 0 ) {
|
||||
|
|
|
|||
|
|
@ -169,17 +169,17 @@ int process_options(int argc, char *argv[])
|
|||
int i, arg_cnt;
|
||||
char *opt, *optval;
|
||||
|
||||
for(arg_cnt = i = 1; i < argc; i++) {
|
||||
for(arg_cnt = i = 1; i < argc; ++i) {
|
||||
opt = argv[i];
|
||||
if(*opt == '-') { /* options */
|
||||
opt++;
|
||||
++opt;
|
||||
if(opt && *opt=='-') { /* long options */
|
||||
opt++;
|
||||
++opt;
|
||||
if(*opt) {
|
||||
optval = strchr(opt, '=');
|
||||
if(optval) {
|
||||
*optval = '\0';
|
||||
optval++;
|
||||
++optval;
|
||||
}
|
||||
if(!optval && i < argc-1 && argv[i+1][0] != '-') {
|
||||
/* options requiring arguments are listed here */
|
||||
|
|
@ -242,7 +242,7 @@ int process_options(int argc, char *argv[])
|
|||
}
|
||||
check_opt(opt, optval, SHORT);
|
||||
/* printf("opt: %c, value: %s\n", *opt, optval ? optval : "no value"); */
|
||||
opt++;
|
||||
++opt;
|
||||
}
|
||||
}
|
||||
} else { /* arguments */
|
||||
|
|
|
|||
|
|
@ -182,7 +182,7 @@ static void merge_polygon(FILE *fd)
|
|||
ptr[i].selected_point= my_calloc(_ALLOC_ID_, points, sizeof(unsigned short));
|
||||
ptr[i].points=points;
|
||||
ptr[i].sel=0;
|
||||
for(j=0;j<points;j++) {
|
||||
for(j=0;j<points; ++j) {
|
||||
if(fscanf(fd, "%lf %lf ",&(ptr[i].x[j]), &(ptr[i].y[j]))<2) {
|
||||
fprintf(errfp,"merge_polygon(): WARNING: missing fields for POLYGON points, ignoring.\n");
|
||||
my_free(_ALLOC_ID_, &ptr[i].x);
|
||||
|
|
|
|||
|
|
@ -228,7 +228,7 @@ void ps_drawPNG(xRect* r, double x1, double y1, double x2, double y2, int rot, i
|
|||
fprintf(fd, "} exec\n");
|
||||
|
||||
#if 1 /* break lines */
|
||||
for (i = 0; i < oLength; i++)
|
||||
for (i = 0; i < oLength; ++i)
|
||||
{
|
||||
fputc(ascii85EncodedJpeg[i],fd);
|
||||
if(i > 0 && (i % 64) == 0)
|
||||
|
|
@ -315,7 +315,7 @@ void ps_embedded_graph(xRect* r, double rx1, double ry1, double rx2, double ry2)
|
|||
cairo_set_source_surface(ct, xctx->cairo_save_sfc, 0, 0);
|
||||
cairo_set_operator(ct, CAIRO_OPERATOR_SOURCE);
|
||||
cairo_paint(ct);
|
||||
for (i = 0; i < xctx->rects[GRIDLAYER]; i++) {
|
||||
for (i = 0; i < xctx->rects[GRIDLAYER]; ++i) {
|
||||
xRect* r2 = &xctx->rect[GRIDLAYER][i];
|
||||
if (r2->flags & 1) {
|
||||
setup_graph_data(i, 8, 0, &xctx->graph_struct);
|
||||
|
|
@ -360,7 +360,7 @@ void ps_embedded_graph(xRect* r, double rx1, double ry1, double rx2, double ry2)
|
|||
fprintf(fd, "} exec\n");
|
||||
|
||||
#if 1 /* break lines */
|
||||
for (i = 0; i < oLength; i++)
|
||||
for (i = 0; i < oLength; ++i)
|
||||
{
|
||||
fputc(ascii85EncodedJpeg[i],fd);
|
||||
if(i > 0 && (i % 64) == 0)
|
||||
|
|
@ -450,7 +450,7 @@ static void ps_drawpolygon(int c, int what, double *x, double *y, int points, in
|
|||
if(dash) {
|
||||
fprintf(fd, "[%g %g] 0 setdash\n", psdash, psdash);
|
||||
}
|
||||
for(i=0;i<points; i++) {
|
||||
for(i=0;i<points; ++i) {
|
||||
xx = X_TO_PS(x[i]);
|
||||
yy = Y_TO_PS(y[i]);
|
||||
if(i==0) fprintf(fd, "NP\n%g %g MT\n", xx, yy);
|
||||
|
|
@ -603,7 +603,7 @@ static void ps_draw_string_line(int layer, char *s, double x, double y, double s
|
|||
default:
|
||||
fputc(c, fd);
|
||||
}
|
||||
s++;
|
||||
++s;
|
||||
}
|
||||
fprintf(fd, ")\n");
|
||||
if (rot==1 && flip==0) {fprintf(fd, "dup SW pop neg 0 RMT\n");}
|
||||
|
|
@ -679,15 +679,15 @@ static void ps_draw_string(int layer, const char *str, short rot, short flip, in
|
|||
*ss='\0';
|
||||
ps_draw_string_line(layer, tt, x, y, size, rot, flip, lineno,
|
||||
height, ascent, descent, llength, no_of_lines, longest_line);
|
||||
lineno++;
|
||||
++lineno;
|
||||
if(c==0) break;
|
||||
*ss='\n';
|
||||
tt=ss+1;
|
||||
llength=0;
|
||||
} else {
|
||||
llength++;
|
||||
++llength;
|
||||
}
|
||||
ss++;
|
||||
++ss;
|
||||
}
|
||||
my_free(_ALLOC_ID_, &sss);
|
||||
}
|
||||
|
|
@ -743,7 +743,7 @@ static void old_ps_draw_string(int gctext, const char *str,
|
|||
ORDER(rx1,ry1,rx2,ry2);
|
||||
ps_drawline(gctext, rx1, ry1, rx2, ry2, 0);
|
||||
}
|
||||
pos++;
|
||||
++pos;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -779,7 +779,7 @@ static void ps_drawgrid()
|
|||
|
||||
static void ps_draw_symbol(int n,int layer, int what, short tmp_flip, short rot, double xoffset, double yoffset)
|
||||
/* draws current layer only, should be called within */
|
||||
{ /* a "for(i=0;i<cadlayers;i++)" loop */
|
||||
{ /* a "for(i=0;i<cadlayers; ++i)" loop */
|
||||
int j, hide = 0;
|
||||
double x0,y0,x1,y1,x2,y2;
|
||||
short flip;
|
||||
|
|
@ -841,7 +841,7 @@ static void ps_draw_symbol(int n,int layer, int what, short tmp_flip, short rot,
|
|||
x0=xctx->inst[n].x0 + xoffset;
|
||||
y0=xctx->inst[n].y0 + yoffset;
|
||||
symptr = (xctx->inst[n].ptr+ xctx->sym);
|
||||
for(j=0;j< (xctx->inst[n].ptr+ xctx->sym)->lines[layer];j++)
|
||||
for(j=0;j< (xctx->inst[n].ptr+ xctx->sym)->lines[layer]; ++j)
|
||||
{
|
||||
line = ((xctx->inst[n].ptr+ xctx->sym)->line[layer])[j];
|
||||
ROTATION(rot, flip, 0.0,0.0,line.x1,line.y1,x1,y1);
|
||||
|
|
@ -849,14 +849,14 @@ static void ps_draw_symbol(int n,int layer, int what, short tmp_flip, short rot,
|
|||
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];
|
||||
{ /* scope block so we declare some auxiliary arrays for coord transforms. 20171115 */
|
||||
int k;
|
||||
double *x = my_malloc(_ALLOC_ID_, sizeof(double) * polygon.points);
|
||||
double *y = my_malloc(_ALLOC_ID_, sizeof(double) * polygon.points);
|
||||
for(k=0;k<polygon.points;k++) {
|
||||
for(k=0;k<polygon.points; ++k) {
|
||||
ROTATION(rot, flip, 0.0,0.0,polygon.x[k],polygon.y[k],x[k],y[k]);
|
||||
x[k]+= x0;
|
||||
y[k] += y0;
|
||||
|
|
@ -867,7 +867,7 @@ static void ps_draw_symbol(int n,int layer, int what, short tmp_flip, short 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];
|
||||
|
|
@ -881,7 +881,7 @@ static void ps_draw_symbol(int n,int layer, int what, short tmp_flip, short rot,
|
|||
ROTATION(rot, flip, 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( xctx->enable_layer[layer] ) for(j=0;j< (xctx->inst[n].ptr+ xctx->sym)->rects[layer];j++)
|
||||
if( xctx->enable_layer[layer] ) for(j=0;j< (xctx->inst[n].ptr+ xctx->sym)->rects[layer]; ++j)
|
||||
{
|
||||
rect = ((xctx->inst[n].ptr+ xctx->sym)->rect[layer])[j];
|
||||
ROTATION(rot, flip, 0.0,0.0,rect.x1,rect.y1,x1,y1);
|
||||
|
|
@ -898,7 +898,7 @@ static void ps_draw_symbol(int n,int layer, int what, short tmp_flip, short rot,
|
|||
(xctx->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; */
|
||||
|
|
@ -958,7 +958,7 @@ static void fill_ps_colors()
|
|||
* tcleval( "puts $ps_colors");
|
||||
* }
|
||||
*/
|
||||
for(i=0;i<cadlayers;i++) {
|
||||
for(i=0;i<cadlayers; ++i) {
|
||||
my_snprintf(s, S(s), "lindex $ps_colors %u", i);
|
||||
tcleval( s);
|
||||
sscanf(tclresult(),"%x", &c);
|
||||
|
|
@ -1038,10 +1038,10 @@ void create_ps(char **psfile, int what)
|
|||
fprintf(fd, "%%%%EndComments\n");
|
||||
fprintf(fd, "%%%%BeginProlog\n\n");
|
||||
|
||||
for(i = 0; i < sizeof(utf8_enc)/sizeof(char *); i++) {
|
||||
for(i = 0; i < sizeof(utf8_enc)/sizeof(char *); ++i) {
|
||||
fprintf(fd, "%s", utf8_enc[i]);
|
||||
}
|
||||
for(i = 0; i < sizeof(utf8)/sizeof(char *); i++) {
|
||||
for(i = 0; i < sizeof(utf8)/sizeof(char *); ++i) {
|
||||
fprintf(fd, "%s", utf8[i]);
|
||||
}
|
||||
|
||||
|
|
@ -1082,7 +1082,7 @@ void create_ps(char **psfile, int what)
|
|||
|
||||
|
||||
if(what & 2) { /* page */
|
||||
numpages++;
|
||||
++numpages;
|
||||
fprintf(fd, "%%%%BeginSetup\n");
|
||||
fprintf(fd, "<< /PageSize [%g %g] /Orientation 0 >> setpagedevice\n", pagex, pagey);
|
||||
fprintf(fd, "%%%%Page: %d %d\n\n", numpages, numpages);
|
||||
|
|
@ -1112,7 +1112,7 @@ void create_ps(char **psfile, int what)
|
|||
set_lw();
|
||||
ps_drawgrid();
|
||||
|
||||
for(i=0;i<xctx->texts;i++)
|
||||
for(i=0;i<xctx->texts; ++i)
|
||||
{
|
||||
textlayer = xctx->text[i].layer;
|
||||
if(!xctx->show_hidden_texts && (xctx->text[i].flags & HIDE_TEXT)) continue;
|
||||
|
|
@ -1149,13 +1149,13 @@ void create_ps(char **psfile, int what)
|
|||
xctx->text[i].xscale, xctx->text[i].yscale);
|
||||
}
|
||||
}
|
||||
for(c=0;c<cadlayers;c++)
|
||||
for(c=0;c<cadlayers; ++c)
|
||||
{
|
||||
set_ps_colors(c);
|
||||
for(i=0;i<xctx->lines[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++)
|
||||
for(i=0;i<xctx->rects[c]; ++i)
|
||||
{
|
||||
|
||||
if (c == GRIDLAYER && (xctx->rect[c][i].flags & 1024)) { /* image */
|
||||
|
|
@ -1173,20 +1173,20 @@ void create_ps(char **psfile, int what)
|
|||
xctx->rect[c][i].x2, xctx->rect[c][i].y2, xctx->rect[c][i].dash, xctx->rect[c][i].fill);
|
||||
}
|
||||
}
|
||||
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);
|
||||
}
|
||||
for(i=0;i<xctx->polygons[c];i++) {
|
||||
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,what,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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ void replace_bracket(char *s)
|
|||
while(*s) {
|
||||
/* if(*s =='[' || *s == ']') *s='_'; */
|
||||
if(*s ==':') *s='.';
|
||||
s++;
|
||||
++s;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -250,11 +250,11 @@ void free_storage()
|
|||
{
|
||||
int i;
|
||||
|
||||
for(i = 0 ; i < nvars; i++) {
|
||||
for(i = 0 ; i < nvars; ++i) {
|
||||
free(names[i]);
|
||||
free(vcd_ids[i]);
|
||||
}
|
||||
for(i = 0 ; i < npoints; i++) {
|
||||
for(i = 0 ; i < npoints; ++i) {
|
||||
free(values[i]);
|
||||
}
|
||||
free(values);
|
||||
|
|
@ -267,16 +267,16 @@ int main(int argc, char *argv[])
|
|||
int res;
|
||||
int i = 1;
|
||||
|
||||
for(i = 1; i < argc; i++) {
|
||||
for(i = 1; i < argc; ++i) {
|
||||
if(!strcmp(argv[i], "-v")) {
|
||||
i++;
|
||||
++i;
|
||||
if(i + 1 >= argc) continue;
|
||||
binary_waves = 1;
|
||||
voltage = atof(argv[i]);
|
||||
vth = voltage * 0.75;
|
||||
vtl = voltage * 0.25;
|
||||
} else if(argv[i][0] == '-') {
|
||||
i++;
|
||||
++i;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
172
src/save.c
172
src/save.c
|
|
@ -224,9 +224,9 @@ char *base64_encode(const unsigned char *data, const size_t input_length, size_t
|
|||
encoded_data[j++] = b64_enc[(triple >> 12) & 0x3F];
|
||||
encoded_data[j++] = b64_enc[(triple >> 6) & 0x3F];
|
||||
encoded_data[j++] = b64_enc[(triple) & 0x3F];
|
||||
cnt++;
|
||||
++cnt;
|
||||
}
|
||||
for (i = 0; i < mod_table[input_length % 3]; i++)
|
||||
for (i = 0; i < mod_table[input_length % 3]; ++i)
|
||||
encoded_data[*output_length - 1 - i] = '=';
|
||||
encoded_data[*output_length] = '\0'; /* add \0 at end so it can be used as a regular char string */
|
||||
return encoded_data;
|
||||
|
|
@ -268,7 +268,7 @@ unsigned char *base64_decode(const char *data, const size_t input_length, size_t
|
|||
if(data[i] == '\n' || data[i] == ' ' || data[i] == '\r' || data[i] == '\t') {
|
||||
dbg(1, "base64_decode(): white space: i=%d, cnt=%d, j=%d\n", i, cnt, j);
|
||||
actual_length--;
|
||||
i++;
|
||||
++i;
|
||||
continue;
|
||||
}
|
||||
sextet[cnt & 3] = data[i] == '=' ? 0 : b64_dec[(int)data[i]];
|
||||
|
|
@ -278,8 +278,8 @@ unsigned char *base64_decode(const char *data, const size_t input_length, size_t
|
|||
decoded_data[j++] = (unsigned char)((triple >> 8) & 0xFF);
|
||||
decoded_data[j++] = (unsigned char)((triple) & 0xFF);
|
||||
}
|
||||
cnt++;
|
||||
i++;
|
||||
++cnt;
|
||||
++i;
|
||||
}
|
||||
*output_length = actual_length / 4 * 3 - padding;
|
||||
return decoded_data;
|
||||
|
|
@ -319,28 +319,28 @@ unsigned char *ascii85_encode(const unsigned char *data, const size_t input_leng
|
|||
{
|
||||
encoded_data[idx]='z';
|
||||
*output_length-=4;
|
||||
idx++;
|
||||
++idx;
|
||||
continue;
|
||||
}
|
||||
encoded_data[idx] = (unsigned char)(val / pow85[4]);
|
||||
val = val - encoded_data[idx] * pow85[4];
|
||||
encoded_data[idx]=b85_enc[encoded_data[idx]];
|
||||
idx++;
|
||||
++idx;
|
||||
encoded_data[idx] = (unsigned char)(val / pow85[3]);
|
||||
val = val - encoded_data[idx] * pow85[3];
|
||||
encoded_data[idx]=b85_enc[encoded_data[idx]];
|
||||
idx++;
|
||||
++idx;
|
||||
encoded_data[idx] = (unsigned char)(val / pow85[2]);
|
||||
val = val - encoded_data[idx] * pow85[2];
|
||||
encoded_data[idx]=b85_enc[encoded_data[idx]];
|
||||
idx++;
|
||||
++idx;
|
||||
encoded_data[idx] = (unsigned char)(val / pow85[1]);
|
||||
val = val - encoded_data[idx] * pow85[1];
|
||||
encoded_data[idx]=b85_enc[encoded_data[idx]];
|
||||
idx++;
|
||||
++idx;
|
||||
encoded_data[idx] = (unsigned char)val;
|
||||
encoded_data[idx]=b85_enc[encoded_data[idx]];
|
||||
idx++;
|
||||
++idx;
|
||||
}
|
||||
my_free(_ALLOC_ID_, &paddedData);
|
||||
*output_length-=padding;
|
||||
|
|
@ -574,7 +574,7 @@ static int read_dataset(FILE *fd, const char *type)
|
|||
ptr = varname;
|
||||
while(*ptr) {
|
||||
if(*ptr == ':') *ptr = '.';
|
||||
ptr++;
|
||||
++ptr;
|
||||
}
|
||||
if(xctx->graph_sim_type && !strcmp(xctx->graph_sim_type, "ac")) { /* AC */
|
||||
my_strcat(_ALLOC_ID_, &xctx->graph_names[i << 1], varname);
|
||||
|
|
@ -614,7 +614,7 @@ void free_rawfile(int dr)
|
|||
dbg(1, "free_rawfile(): clearing data\n");
|
||||
if(xctx->graph_names) {
|
||||
deleted = 1;
|
||||
for(i = 0 ; i < xctx->graph_nvars; i++) {
|
||||
for(i = 0 ; i < xctx->graph_nvars; ++i) {
|
||||
my_free(_ALLOC_ID_, &xctx->graph_names[i]);
|
||||
}
|
||||
my_free(_ALLOC_ID_, &xctx->graph_names);
|
||||
|
|
@ -622,7 +622,7 @@ void free_rawfile(int dr)
|
|||
if(xctx->graph_values) {
|
||||
deleted = 1;
|
||||
/* free also extra column for custom data plots */
|
||||
for(i = 0 ; i <= xctx->graph_nvars; i++) {
|
||||
for(i = 0 ; i <= xctx->graph_nvars; ++i) {
|
||||
my_free(_ALLOC_ID_, &xctx->graph_values[i]);
|
||||
}
|
||||
my_free(_ALLOC_ID_, &xctx->graph_values);
|
||||
|
|
@ -717,7 +717,7 @@ int raw_read(const char *f, const char *type)
|
|||
xctx->graph_raw_level = xctx->currsch;
|
||||
tclsetintvar("graph_raw_level", xctx->currsch);
|
||||
xctx->graph_allpoints = 0;
|
||||
for(i = 0; i < xctx->graph_datasets; i++) {
|
||||
for(i = 0; i < xctx->graph_datasets; ++i) {
|
||||
xctx->graph_allpoints += xctx->graph_npoints[i];
|
||||
}
|
||||
dbg(0, "Raw file data read: %s\n", f);
|
||||
|
|
@ -826,15 +826,15 @@ int table_read(const char *f)
|
|||
#endif
|
||||
|
||||
}
|
||||
field++;
|
||||
++field;
|
||||
}
|
||||
if(nline) { /* skip header line for npoints calculation*/
|
||||
npoints++;
|
||||
++npoints;
|
||||
dataset_points++;
|
||||
}
|
||||
xctx->graph_npoints[xctx->graph_datasets - 1] = dataset_points;
|
||||
/* dbg(1, "\n"); */
|
||||
nline++;
|
||||
++nline;
|
||||
if(nline == 1) {
|
||||
int f;
|
||||
xctx->graph_values = my_calloc(_ALLOC_ID_, xctx->graph_nvars + 1, sizeof(SPICE_DATA *));
|
||||
|
|
@ -852,7 +852,7 @@ int table_read(const char *f)
|
|||
xctx->graph_raw_level = xctx->currsch;
|
||||
tclsetintvar("graph_raw_level", xctx->currsch);
|
||||
xctx->graph_allpoints = 0;
|
||||
for(i = 0; i < xctx->graph_datasets; i++) {
|
||||
for(i = 0; i < xctx->graph_datasets; ++i) {
|
||||
xctx->graph_allpoints += xctx->graph_npoints[i];
|
||||
}
|
||||
dbg(0, "Table file data read: %s\n", f);
|
||||
|
|
@ -921,14 +921,14 @@ static double ravg_store(int what , int i, int p, int last, double value)
|
|||
if(i >= imax) {
|
||||
int new_size = i + 4;
|
||||
my_realloc(_ALLOC_ID_, &arr, sizeof(double *) * new_size);
|
||||
for(j = imax; j < new_size; j++) {
|
||||
for(j = imax; j < new_size; ++j) {
|
||||
arr[j] = my_calloc(_ALLOC_ID_, last + 1, sizeof(double));
|
||||
}
|
||||
imax = new_size;
|
||||
}
|
||||
arr[i][p] = value;
|
||||
} else if(what == 0 && imax) {
|
||||
for(j = 0; j < imax; j++) {
|
||||
for(j = 0; j < imax; ++j) {
|
||||
my_free(_ALLOC_ID_, &arr[j]);
|
||||
}
|
||||
my_free(_ALLOC_ID_, &arr);
|
||||
|
|
@ -1061,7 +1061,7 @@ int plot_raw_custom_data(int sweep_idx, int first, int last, const char *expr)
|
|||
my_free(_ALLOC_ID_, &ntok_copy);
|
||||
for(p = first ; p <= last; p++) {
|
||||
stackptr2 = 0;
|
||||
for(i = 0; i < stackptr1; i++) {
|
||||
for(i = 0; i < stackptr1; ++i) {
|
||||
if(stack1[i].i == NUMBER) { /* number */
|
||||
stack2[stackptr2++] = stack1[i].d;
|
||||
}
|
||||
|
|
@ -1325,7 +1325,7 @@ int plot_raw_custom_data(int sweep_idx, int first, int last, const char *expr)
|
|||
break;
|
||||
} /* switch(...) */
|
||||
} /* if(stackptr2 > 0) */
|
||||
} /* for(i = 0; i < stackptr1; i++) */
|
||||
} /* for(i = 0; i < stackptr1; ++i) */
|
||||
y[p] = (SPICE_DATA)stack2[0];
|
||||
} /* for(p = first ...) */
|
||||
ravg_store(0, 0, 0, 0, 0.0); /* clear data */
|
||||
|
|
@ -1341,7 +1341,7 @@ double get_raw_value(int dataset, int idx, int point)
|
|||
if(point < xctx->graph_allpoints)
|
||||
return xctx->graph_values[idx][point];
|
||||
} else {
|
||||
for(i = 0; i < dataset; i++) {
|
||||
for(i = 0; i < dataset; ++i) {
|
||||
ofs += xctx->graph_npoints[i];
|
||||
}
|
||||
if(ofs + point < xctx->graph_allpoints) {
|
||||
|
|
@ -1434,7 +1434,7 @@ static const char *random_string(const char *prefix)
|
|||
prefix_size = strlen(prefix);
|
||||
str[0]='/';
|
||||
memcpy(str+1, prefix, prefix_size);
|
||||
for(i=prefix_size+1; i < prefix_size + random_size+1; i++) {
|
||||
for(i=prefix_size+1; i < prefix_size + random_size+1; ++i) {
|
||||
idx = rand()%(sizeof(charset)-1);
|
||||
str[i] = charset[idx];
|
||||
}
|
||||
|
|
@ -1455,7 +1455,7 @@ const char *create_tmpdir(char *prefix)
|
|||
static char str[PATH_MAX]; /* safe even with multiple schematics if immediately copied */
|
||||
int i;
|
||||
struct stat buf;
|
||||
for(i=0; i<5;i++) {
|
||||
for(i=0; i<5; ++i) {
|
||||
my_snprintf(str, S(str), "%s%s", tclgetvar("XSCHEM_TMP_DIR"), random_string(prefix));
|
||||
if(stat(str, &buf) && !mkdir(str, 0700) ) { /* dir must not exist */
|
||||
dbg(1, "create_tmpdir(): created dir: %s\n", str);
|
||||
|
|
@ -1481,7 +1481,7 @@ FILE *open_tmpfile(char *prefix, char **filename)
|
|||
int i;
|
||||
FILE *fd;
|
||||
struct stat buf;
|
||||
for(i=0; i<5;i++) {
|
||||
for(i=0; i<5; ++i) {
|
||||
my_snprintf(str, S(str), "%s%s", tclgetvar("XSCHEM_TMP_DIR"), random_string(prefix));
|
||||
*filename = str;
|
||||
if(stat(str, &buf) && (fd = fopen(str, "w")) ) { /* file must not exist */
|
||||
|
|
@ -1553,40 +1553,40 @@ static void save_embedded_symbol(xSymbol *s, FILE *fd)
|
|||
fprintf(fd, "V {}\n");
|
||||
fprintf(fd, "S {}\n");
|
||||
fprintf(fd, "E {}\n");
|
||||
for(c=0;c<cadlayers;c++)
|
||||
for(c=0;c<cadlayers; ++c)
|
||||
{
|
||||
xLine *ptr;
|
||||
ptr=s->line[c];
|
||||
for(i=0;i<s->lines[c];i++)
|
||||
for(i=0;i<s->lines[c]; ++i)
|
||||
{
|
||||
fprintf(fd, "L %d %.16g %.16g %.16g %.16g ", c,ptr[i].x1, ptr[i].y1,ptr[i].x2,
|
||||
ptr[i].y2 );
|
||||
save_ascii_string(ptr[i].prop_ptr,fd, 1);
|
||||
}
|
||||
}
|
||||
for(c=0;c<cadlayers;c++)
|
||||
for(c=0;c<cadlayers; ++c)
|
||||
{
|
||||
xRect *ptr;
|
||||
ptr=s->rect[c];
|
||||
for(i=0;i<s->rects[c];i++)
|
||||
for(i=0;i<s->rects[c]; ++i)
|
||||
{
|
||||
fprintf(fd, "B %d %.16g %.16g %.16g %.16g ", c,ptr[i].x1, ptr[i].y1,ptr[i].x2,
|
||||
ptr[i].y2);
|
||||
save_ascii_string(ptr[i].prop_ptr,fd, 1);
|
||||
}
|
||||
}
|
||||
for(c=0;c<cadlayers;c++)
|
||||
for(c=0;c<cadlayers; ++c)
|
||||
{
|
||||
xArc *ptr;
|
||||
ptr=s->arc[c];
|
||||
for(i=0;i<s->arcs[c];i++)
|
||||
for(i=0;i<s->arcs[c]; ++i)
|
||||
{
|
||||
fprintf(fd, "A %d %.16g %.16g %.16g %.16g %.16g ", c,ptr[i].x, ptr[i].y,ptr[i].r,
|
||||
ptr[i].a, ptr[i].b);
|
||||
save_ascii_string(ptr[i].prop_ptr,fd, 1);
|
||||
}
|
||||
}
|
||||
for(i=0;i<s->texts;i++)
|
||||
for(i=0;i<s->texts; ++i)
|
||||
{
|
||||
xText *ptr;
|
||||
ptr = s->text;
|
||||
|
|
@ -1597,14 +1597,14 @@ static void save_embedded_symbol(xSymbol *s, FILE *fd)
|
|||
ptr[i].yscale);
|
||||
save_ascii_string(ptr[i].prop_ptr,fd, 1);
|
||||
}
|
||||
for(c=0;c<cadlayers;c++)
|
||||
for(c=0;c<cadlayers; ++c)
|
||||
{
|
||||
xPoly *ptr;
|
||||
ptr=s->poly[c];
|
||||
for(i=0;i<s->polygons[c];i++)
|
||||
for(i=0;i<s->polygons[c]; ++i)
|
||||
{
|
||||
fprintf(fd, "P %d %d ", c,ptr[i].points);
|
||||
for(j=0;j<ptr[i].points;j++) {
|
||||
for(j=0;j<ptr[i].points; ++j) {
|
||||
fprintf(fd, "%.16g %.16g ", ptr[i].x[j], ptr[i].y[j]);
|
||||
}
|
||||
save_ascii_string(ptr[i].prop_ptr,fd, 1);
|
||||
|
|
@ -1621,9 +1621,9 @@ static void save_inst(FILE *fd, int select_only)
|
|||
|
||||
inst=xctx->inst;
|
||||
oldversion = !strcmp(xctx->file_version, "1.0");
|
||||
for(i=0;i<xctx->symbols;i++) xctx->sym[i].flags &=~EMBEDDED;
|
||||
for(i=0;i<xctx->symbols; ++i) xctx->sym[i].flags &=~EMBEDDED;
|
||||
embedded_saved = my_calloc(_ALLOC_ID_, xctx->symbols, sizeof(int));
|
||||
for(i=0;i<xctx->instances;i++)
|
||||
for(i=0;i<xctx->instances; ++i)
|
||||
{
|
||||
if (select_only && inst[i].sel != SELECTED) continue;
|
||||
fputs("C ", fd);
|
||||
|
|
@ -1653,7 +1653,7 @@ static void save_wire(FILE *fd, int select_only)
|
|||
xWire *ptr;
|
||||
|
||||
ptr=xctx->wire;
|
||||
for(i=0;i<xctx->wires;i++)
|
||||
for(i=0;i<xctx->wires; ++i)
|
||||
{
|
||||
if (select_only && ptr[i].sel != SELECTED) continue;
|
||||
fprintf(fd, "N %.16g %.16g %.16g %.16g ",ptr[i].x1, ptr[i].y1, ptr[i].x2,
|
||||
|
|
@ -1667,7 +1667,7 @@ static void save_text(FILE *fd, int select_only)
|
|||
int i;
|
||||
xText *ptr;
|
||||
ptr=xctx->text;
|
||||
for(i=0;i<xctx->texts;i++)
|
||||
for(i=0;i<xctx->texts; ++i)
|
||||
{
|
||||
if (select_only && ptr[i].sel != SELECTED) continue;
|
||||
fprintf(fd, "T ");
|
||||
|
|
@ -1683,14 +1683,14 @@ static void save_polygon(FILE *fd, int select_only)
|
|||
{
|
||||
int c, i, j;
|
||||
xPoly *ptr;
|
||||
for(c=0;c<cadlayers;c++)
|
||||
for(c=0;c<cadlayers; ++c)
|
||||
{
|
||||
ptr=xctx->poly[c];
|
||||
for(i=0;i<xctx->polygons[c];i++)
|
||||
for(i=0;i<xctx->polygons[c]; ++i)
|
||||
{
|
||||
if (select_only && ptr[i].sel != SELECTED) continue;
|
||||
fprintf(fd, "P %d %d ", c,ptr[i].points);
|
||||
for(j=0;j<ptr[i].points;j++) {
|
||||
for(j=0;j<ptr[i].points; ++j) {
|
||||
fprintf(fd, "%.16g %.16g ", ptr[i].x[j], ptr[i].y[j]);
|
||||
}
|
||||
save_ascii_string(ptr[i].prop_ptr,fd, 1);
|
||||
|
|
@ -1702,10 +1702,10 @@ static void save_arc(FILE *fd, int select_only)
|
|||
{
|
||||
int c, i;
|
||||
xArc *ptr;
|
||||
for(c=0;c<cadlayers;c++)
|
||||
for(c=0;c<cadlayers; ++c)
|
||||
{
|
||||
ptr=xctx->arc[c];
|
||||
for(i=0;i<xctx->arcs[c];i++)
|
||||
for(i=0;i<xctx->arcs[c]; ++i)
|
||||
{
|
||||
if (select_only && ptr[i].sel != SELECTED) continue;
|
||||
fprintf(fd, "A %d %.16g %.16g %.16g %.16g %.16g ", c,ptr[i].x, ptr[i].y,ptr[i].r,
|
||||
|
|
@ -1719,10 +1719,10 @@ static void save_box(FILE *fd, int select_only)
|
|||
{
|
||||
int c, i;
|
||||
xRect *ptr;
|
||||
for(c=0;c<cadlayers;c++)
|
||||
for(c=0;c<cadlayers; ++c)
|
||||
{
|
||||
ptr=xctx->rect[c];
|
||||
for(i=0;i<xctx->rects[c];i++)
|
||||
for(i=0;i<xctx->rects[c]; ++i)
|
||||
{
|
||||
if (select_only && ptr[i].sel != SELECTED) continue;
|
||||
fprintf(fd, "B %d %.16g %.16g %.16g %.16g ", c,ptr[i].x1, ptr[i].y1,ptr[i].x2,
|
||||
|
|
@ -1736,10 +1736,10 @@ static void save_line(FILE *fd, int select_only)
|
|||
{
|
||||
int c, i;
|
||||
xLine *ptr;
|
||||
for(c=0;c<cadlayers;c++)
|
||||
for(c=0;c<cadlayers; ++c)
|
||||
{
|
||||
ptr=xctx->line[c];
|
||||
for(i=0;i<xctx->lines[c];i++)
|
||||
for(i=0;i<xctx->lines[c]; ++i)
|
||||
{
|
||||
if (select_only && ptr[i].sel != SELECTED) continue;
|
||||
fprintf(fd, "L %d %.16g %.16g %.16g %.16g ", c,ptr[i].x1, ptr[i].y1,ptr[i].x2,
|
||||
|
|
@ -1928,7 +1928,7 @@ static void load_polygon(FILE *fd)
|
|||
ptr[i].selected_point= my_calloc(_ALLOC_ID_, points, sizeof(unsigned short));
|
||||
ptr[i].points=points;
|
||||
ptr[i].sel=0;
|
||||
for(j=0;j<points;j++) {
|
||||
for(j=0;j<points; ++j) {
|
||||
if(fscanf(fd, "%lf %lf ",&(ptr[i].x[j]), &(ptr[i].y[j]))<2) {
|
||||
fprintf(errfp,"WARNING: missing fields for POLYGON points, ignoring.\n");
|
||||
my_free(_ALLOC_ID_, &ptr[i].x);
|
||||
|
|
@ -2163,7 +2163,7 @@ static void read_xschem_file(FILE *fd)
|
|||
if(xctx->inst[xctx->instances-1].name) {
|
||||
my_snprintf(name_embedded, S(name_embedded), "%s/.xschem_embedded_%d_%s",
|
||||
tclgetvar("XSCHEM_TMP_DIR"), getpid(), get_cell_w_ext(xctx->inst[xctx->instances-1].name, 0));
|
||||
for(i=0;i<xctx->symbols;i++)
|
||||
for(i=0;i<xctx->symbols; ++i)
|
||||
{
|
||||
dbg(1, "read_xschem_file(): sym[i].name=%s, name_embedded=%s\n", xctx->sym[i].name, name_embedded);
|
||||
dbg(1, "read_xschem_file(): inst[instances-1].name=%s\n", xctx->inst[xctx->instances-1].name);
|
||||
|
|
@ -2252,7 +2252,7 @@ void load_ascii_string(char **ptr, FILE *fd)
|
|||
}
|
||||
str[i]=(char)c;
|
||||
escape = 0;
|
||||
i++;
|
||||
++i;
|
||||
} else if(c=='{') begin=1;
|
||||
}
|
||||
dbg(2, "load_ascii_string(): string read=%s\n",str? str:"<NULL>");
|
||||
|
|
@ -2376,13 +2376,13 @@ void link_symbols_to_instances(int from) /* from >= 0 : linking symbols from pas
|
|||
from = 0;
|
||||
merge = 0;
|
||||
}
|
||||
for(i = from; i < xctx->instances; i++) {
|
||||
for(i = from; i < xctx->instances; ++i) {
|
||||
dbg(2, "link_symbols_to_instances(): inst=%d\n", i);
|
||||
dbg(2, "link_symbols_to_instances(): matching inst %d name=%s \n",i, xctx->inst[i].name);
|
||||
dbg(2, "link_symbols_to_instances(): -------\n");
|
||||
xctx->inst[i].ptr = match_symbol(xctx->inst[i].name);
|
||||
}
|
||||
for(i = from; i < xctx->instances; i++) {
|
||||
for(i = from; i < xctx->instances; ++i) {
|
||||
type=xctx->sym[xctx->inst[i].ptr].type;
|
||||
cond= !type || !IS_LABEL_SH_OR_PIN(type);
|
||||
if(cond) xctx->inst[i].flags|=2; /* ordinary symbol */
|
||||
|
|
@ -2393,7 +2393,7 @@ void link_symbols_to_instances(int from) /* from >= 0 : linking symbols from pas
|
|||
}
|
||||
/* symbol_bbox() might call translate() that might call prepare_netlist_structs() that
|
||||
* needs .lab field set above, so this must be done last */
|
||||
for(i = from; i < xctx->instances; i++) {
|
||||
for(i = from; i < xctx->instances; ++i) {
|
||||
symbol_bbox(i, &xctx->inst[i].x1, &xctx->inst[i].y1, &xctx->inst[i].x2, &xctx->inst[i].y2);
|
||||
if(merge) select_element(i,SELECTED,1, 0); /* leave elements selected if a paste/copy from windows is done */
|
||||
}
|
||||
|
|
@ -2502,7 +2502,7 @@ void load_schematic(int load_symbols, const char *fname, int reset_undo) /* 2015
|
|||
/* if(reset_undo) xctx->time_last_modify = time(NULL); */ /* no file given, set mtime to current time */
|
||||
if(reset_undo) xctx->time_last_modify = 0; /* no file given, set mtime to 0 (undefined) */
|
||||
clear_drawing();
|
||||
for(i=0;;i++) {
|
||||
for(i=0;; ++i) {
|
||||
if(xctx->netlist_type == CAD_SYMBOL_ATTRS) {
|
||||
if(i == 0) my_snprintf(name, S(name), "%s.sym", "untitled");
|
||||
else my_snprintf(name, S(name), "%s-%d.sym", "untitled", i);
|
||||
|
|
@ -2547,7 +2547,7 @@ void delete_undo(void)
|
|||
dbg(1, "delete_undo(): undo_initialized = %d\n", xctx->undo_initialized);
|
||||
if(!xctx->undo_initialized) return;
|
||||
clear_undo();
|
||||
for(i=0; i<MAX_UNDO; i++) {
|
||||
for(i=0; i<MAX_UNDO; ++i) {
|
||||
my_snprintf(diff_name, S(diff_name), "%s/undo%d",xctx->undo_dirname, i);
|
||||
xunlink(diff_name);
|
||||
}
|
||||
|
|
@ -2775,7 +2775,7 @@ static void get_sym_type(const char *symname, char **type,
|
|||
}
|
||||
found=0;
|
||||
/* first look in already loaded symbols in xctx->sym[] array... */
|
||||
for(i=0;i<xctx->symbols;i++) {
|
||||
for(i=0;i<xctx->symbols; ++i) {
|
||||
if(xctx->x_strcmp(symname, xctx->sym[i].name) == 0) {
|
||||
my_strdup2(_ALLOC_ID_, type, xctx->sym[i].type);
|
||||
found = 1;
|
||||
|
|
@ -2785,7 +2785,7 @@ static void get_sym_type(const char *symname, char **type,
|
|||
/* hash pins to get LCC schematic have same order as corresponding symbol */
|
||||
if(found && pintable) {
|
||||
*sym_n_pins = xctx->sym[i].rects[PINLAYER];
|
||||
for (c = 0; c < xctx->sym[i].rects[PINLAYER]; c++) {
|
||||
for (c = 0; c < xctx->sym[i].rects[PINLAYER]; ++c) {
|
||||
int_hash_lookup(pintable, get_tok_value(xctx->sym[i].rect[PINLAYER][c].prop_ptr, "name", 0), c, XINSERT);
|
||||
}
|
||||
}
|
||||
|
|
@ -2880,7 +2880,7 @@ static void align_sch_pins_with_sym(const char *name, int pos)
|
|||
}
|
||||
rect = (xRect *) my_malloc(_ALLOC_ID_, sizeof(xRect) * sym_n_pins);
|
||||
dbg(1, "align_sch_pins_with_sym(): symbol: %s\n", symname);
|
||||
for(i=0; i < xctx->sym[pos].rects[PINLAYER]; i++) {
|
||||
for(i=0; i < xctx->sym[pos].rects[PINLAYER]; ++i) {
|
||||
Int_hashentry *entry;
|
||||
pinname = get_tok_value(xctx->sym[pos].rect[PINLAYER][i].prop_ptr, "name", 0);
|
||||
entry = int_hash_lookup(&pintable, pinname, 0 , XLOOKUP);
|
||||
|
|
@ -2895,7 +2895,7 @@ static void align_sch_pins_with_sym(const char *name, int pos)
|
|||
}
|
||||
if(!fail) {
|
||||
/* copy rect[] ordererd array to LCC schematic instance */
|
||||
for(i=0; i < xctx->sym[pos].rects[PINLAYER]; i++) {
|
||||
for(i=0; i < xctx->sym[pos].rects[PINLAYER]; ++i) {
|
||||
xctx->sym[pos].rect[PINLAYER][i] = rect[i];
|
||||
}
|
||||
}
|
||||
|
|
@ -2971,39 +2971,39 @@ static void calc_symbol_bbox(int pos)
|
|||
xRect boundbox, tmp;
|
||||
|
||||
boundbox.x1 = boundbox.x2 = boundbox.y1 = boundbox.y2 = 0;
|
||||
for(c=0;c<cadlayers;c++)
|
||||
for(c=0;c<cadlayers; ++c)
|
||||
{
|
||||
for(i=0;i<xctx->sym[pos].lines[c];i++)
|
||||
for(i=0;i<xctx->sym[pos].lines[c]; ++i)
|
||||
{
|
||||
count++;
|
||||
++count;
|
||||
tmp.x1=xctx->sym[pos].line[c][i].x1;tmp.y1=xctx->sym[pos].line[c][i].y1;
|
||||
tmp.x2=xctx->sym[pos].line[c][i].x2;tmp.y2=xctx->sym[pos].line[c][i].y2;
|
||||
updatebbox(count,&boundbox,&tmp);
|
||||
dbg(2, "calc_symbol_bbox(): line[%d][%d]: %g %g %g %g\n",
|
||||
c, i, tmp.x1,tmp.y1,tmp.x2,tmp.y2);
|
||||
}
|
||||
for(i=0;i<xctx->sym[pos].arcs[c];i++)
|
||||
for(i=0;i<xctx->sym[pos].arcs[c]; ++i)
|
||||
{
|
||||
count++;
|
||||
++count;
|
||||
arc_bbox(xctx->sym[pos].arc[c][i].x, xctx->sym[pos].arc[c][i].y, xctx->sym[pos].arc[c][i].r,
|
||||
xctx->sym[pos].arc[c][i].a, xctx->sym[pos].arc[c][i].b,
|
||||
&tmp.x1, &tmp.y1, &tmp.x2, &tmp.y2);
|
||||
/* printf("arc bbox: %g %g %g %g\n", tmp.x1, tmp.y1, tmp.x2, tmp.y2); */
|
||||
updatebbox(count,&boundbox,&tmp);
|
||||
}
|
||||
for(i=0;i<xctx->sym[pos].rects[c];i++)
|
||||
for(i=0;i<xctx->sym[pos].rects[c]; ++i)
|
||||
{
|
||||
count++;
|
||||
++count;
|
||||
tmp.x1=xctx->sym[pos].rect[c][i].x1;tmp.y1=xctx->sym[pos].rect[c][i].y1;
|
||||
tmp.x2=xctx->sym[pos].rect[c][i].x2;tmp.y2=xctx->sym[pos].rect[c][i].y2;
|
||||
updatebbox(count,&boundbox,&tmp);
|
||||
}
|
||||
for(i=0;i<xctx->sym[pos].polygons[c];i++)
|
||||
for(i=0;i<xctx->sym[pos].polygons[c]; ++i)
|
||||
{
|
||||
double x1=0., y1=0., x2=0., y2=0.;
|
||||
int k;
|
||||
count++;
|
||||
for(k=0; k<xctx->sym[pos].poly[c][i].points; k++) {
|
||||
++count;
|
||||
for(k=0; k<xctx->sym[pos].poly[c][i].points; ++k) {
|
||||
/*fprintf(errfp, " poly: point %d: %.16g %.16g\n", k, pp[c][i].x[k], pp[c][i].y[k]); */
|
||||
if(k==0 || xctx->sym[pos].poly[c][i].x[k] < x1) x1 = xctx->sym[pos].poly[c][i].x[k];
|
||||
if(k==0 || xctx->sym[pos].poly[c][i].y[k] < y1) y1 = xctx->sym[pos].poly[c][i].y[k];
|
||||
|
|
@ -3018,7 +3018,7 @@ static void calc_symbol_bbox(int pos)
|
|||
* do not include symbol text in bounding box, since text length
|
||||
* is variable from one instance to another due to '@' variable expansions
|
||||
*
|
||||
* for(i=0;i<lastt;i++)
|
||||
* for(i=0;i<lastt; ++i)
|
||||
* {
|
||||
int tmp;
|
||||
* count++;
|
||||
|
|
@ -3059,7 +3059,7 @@ void sort_symbol_pins(xRect *pin_array, int npins, const char *name)
|
|||
|
||||
if(npins > 0) do_sort = 1; /* no pins, no sort... */
|
||||
/* do not sort if some pins don't have pinnumber attribute */
|
||||
for(j = 0; j < npins; j++) {
|
||||
for(j = 0; j < npins; ++j) {
|
||||
pinnumber = get_tok_value(pin_array[j].prop_ptr, "sim_pinnumber", 0);
|
||||
if(!pinnumber[0]) do_sort = 0;
|
||||
}
|
||||
|
|
@ -3160,7 +3160,7 @@ int load_sym_def(const char *name, FILE *embed_fd)
|
|||
}
|
||||
endfile=0;
|
||||
/* initialize data for loading a new symbol */
|
||||
for(c=0;c<cadlayers;c++)
|
||||
for(c=0;c<cadlayers; ++c)
|
||||
{
|
||||
lasta[c] = lastl[c] = lastr[c] = lastp[c] = 0;
|
||||
ll[c] = NULL; bb[c] = NULL; pp[c] = NULL; aa[c] = NULL;
|
||||
|
|
@ -3300,7 +3300,7 @@ int load_sym_def(const char *name, FILE *embed_fd)
|
|||
pp[c][i].y = my_calloc(_ALLOC_ID_, poly_points, sizeof(double));
|
||||
pp[c][i].selected_point = my_calloc(_ALLOC_ID_, poly_points, sizeof(unsigned short));
|
||||
pp[c][i].points = poly_points;
|
||||
for(k=0;k<poly_points;k++) {
|
||||
for(k=0;k<poly_points; ++k) {
|
||||
if(fscanf(lcc[level].fd, "%lf %lf ",&(pp[c][i].x[k]), &(pp[c][i].y[k]) ) < 2 ) {
|
||||
fprintf(errfp,"l_s_d(): WARNING: missing fields for POLYGON object\n");
|
||||
}
|
||||
|
|
@ -3446,7 +3446,7 @@ int load_sym_def(const char *name, FILE *embed_fd)
|
|||
char *path = NULL;
|
||||
if(level > 1) { /* add parent LCC instance names (X1, Xinv etc) */
|
||||
int i;
|
||||
for(i = 1; i <level; i++) {
|
||||
for(i = 1; i <level; ++i) {
|
||||
const char *instname = get_tok_value(lcc[i].prop_ptr, "name", 0);
|
||||
my_strcat(_ALLOC_ID_, &path, instname);
|
||||
my_strcat(_ALLOC_ID_, &path, ".");
|
||||
|
|
@ -3467,7 +3467,7 @@ int load_sym_def(const char *name, FILE *embed_fd)
|
|||
char *path = NULL;
|
||||
if(level > 1) { /* add parent LCC instance names (X1, Xinv etc) */
|
||||
int i;
|
||||
for(i = 1; i <level; i++) {
|
||||
for(i = 1; i <level; ++i) {
|
||||
const char *instname = get_tok_value(lcc[i].prop_ptr, "name", 0);
|
||||
my_strcat(_ALLOC_ID_, &path, instname);
|
||||
my_strcat(_ALLOC_ID_, &path, ".");
|
||||
|
|
@ -3496,7 +3496,7 @@ int load_sym_def(const char *name, FILE *embed_fd)
|
|||
}
|
||||
dbg(1, "l_s_d(): loaded text : t=%s p=%s\n", tt[i].txt_ptr, tt[i].prop_ptr ? tt[i].prop_ptr : "NULL");
|
||||
set_text_flags(&tt[i]);
|
||||
lastt++;
|
||||
++lastt;
|
||||
break;
|
||||
case 'N': /* store wires as lines on layer WIRELAYER. */
|
||||
i = lastl[WIRELAYER];
|
||||
|
|
@ -3674,7 +3674,7 @@ int load_sym_def(const char *name, FILE *embed_fd)
|
|||
symbol[symbols].flags &= ~EMBEDDED;
|
||||
}
|
||||
dbg(2, "l_s_d(): finished parsing file\n");
|
||||
for(c=0;c<cadlayers;c++)
|
||||
for(c=0;c<cadlayers; ++c)
|
||||
{
|
||||
symbol[symbols].arcs[c] = lasta[c];
|
||||
symbol[symbols].lines[c] = lastl[c];
|
||||
|
|
@ -3812,7 +3812,7 @@ void create_sch_from_sym(void)
|
|||
npin = ptr->rects[GENERICLAYER];
|
||||
rct = ptr->rect[GENERICLAYER];
|
||||
ypos=0;
|
||||
for(i=0;i<npin;i++) {
|
||||
for(i=0;i<npin; ++i) {
|
||||
my_strdup(_ALLOC_ID_, &prop, rct[i].prop_ptr);
|
||||
if(!prop) continue;
|
||||
sub_prop=strstr(prop,"name=")+5;
|
||||
|
|
@ -3826,9 +3826,9 @@ void create_sch_from_sym(void)
|
|||
} /* for(i) */
|
||||
npin = ptr->rects[PINLAYER];
|
||||
rct = ptr->rect[PINLAYER];
|
||||
for(j=0;j<3;j++) {
|
||||
for(j=0;j<3; ++j) {
|
||||
if(j==1) ypos=0;
|
||||
for(i=0;i<npin;i++) {
|
||||
for(i=0;i<npin; ++i) {
|
||||
my_strdup(_ALLOC_ID_, &prop, rct[i].prop_ptr);
|
||||
if(!prop) continue;
|
||||
sub_prop=strstr(prop,"name=")+5;
|
||||
|
|
@ -3955,7 +3955,7 @@ void round_schematic_to_grid(double c_snap)
|
|||
{
|
||||
int i, c, n, p;
|
||||
rebuild_selected_array();
|
||||
for(i=0;i<xctx->lastsel;i++)
|
||||
for(i=0;i<xctx->lastsel; ++i)
|
||||
{
|
||||
c = xctx->sel_array[i].col; n = xctx->sel_array[i].n;
|
||||
switch(xctx->sel_array[i].type)
|
||||
|
|
@ -4049,7 +4049,7 @@ void save_selection(int what)
|
|||
}
|
||||
fprintf(fd, "v {xschem version=%s file_version=%s}\n", XSCHEM_VERSION, XSCHEM_FILE_VERSION);
|
||||
fprintf(fd, "G { %.16g %.16g }\n", xctx->mousex_snap, xctx->mousey_snap);
|
||||
for(i=0;i<xctx->lastsel;i++)
|
||||
for(i=0;i<xctx->lastsel; ++i)
|
||||
{
|
||||
c = xctx->sel_array[i].col;n = xctx->sel_array[i].n;
|
||||
switch(xctx->sel_array[i].type)
|
||||
|
|
@ -4078,7 +4078,7 @@ void save_selection(int what)
|
|||
|
||||
case POLYGON:
|
||||
fprintf(fd, "P %d %d ", c, xctx->poly[c][n].points);
|
||||
for(k=0; k<xctx->poly[c][n].points; k++) {
|
||||
for(k=0; k<xctx->poly[c][n].points; ++k) {
|
||||
fprintf(fd, "%.16g %.16g ", xctx->poly[c][n].x[k], xctx->poly[c][n].y[k]);
|
||||
}
|
||||
save_ascii_string(xctx->poly[c][n].prop_ptr,fd, 1);
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ void statusmsg(char str[],int n)
|
|||
static int get_instance(const char *s)
|
||||
{
|
||||
int i, found=0;
|
||||
for(i=0;i<xctx->instances;i++) {
|
||||
for(i=0;i<xctx->instances; ++i) {
|
||||
if(!strcmp(xctx->inst[i].instname, s)) {
|
||||
found=1;
|
||||
break;
|
||||
|
|
@ -287,7 +287,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
if(debug_var>=2) {
|
||||
int i;
|
||||
fprintf(errfp, "xschem():");
|
||||
for(i=0; i<argc; i++) {
|
||||
for(i=0; i<argc; ++i) {
|
||||
fprintf(errfp, "%s ", argv[i]);
|
||||
}
|
||||
fprintf(errfp, "\n");
|
||||
|
|
@ -391,7 +391,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
raw_read(f, "op");
|
||||
if(xctx->graph_values) {
|
||||
xctx->graph_annotate_p = 0;
|
||||
for(i = 0; i < xctx->graph_nvars; i++) {
|
||||
for(i = 0; i < xctx->graph_nvars; ++i) {
|
||||
char s[100];
|
||||
int p = 0;
|
||||
my_snprintf(s, S(s), "%.4g", xctx->graph_values[i][p]);
|
||||
|
|
@ -473,7 +473,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
char sympath[PATH_MAX];
|
||||
const char *name;
|
||||
struct stat buf;
|
||||
for(i=0;i<xctx->symbols;i++) {
|
||||
for(i=0;i<xctx->symbols; ++i) {
|
||||
name = xctx->sym[i].name;
|
||||
if(!strcmp(xctx->file_version, "1.0")) {
|
||||
my_strncpy(sympath, abs_sym_path(name, ".sym"), S(sympath));
|
||||
|
|
@ -522,7 +522,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
if(argc > 2 && !strcmp(argv[2], "SYMBOL")) {
|
||||
xctx->netlist_type = CAD_SYMBOL_ATTRS;
|
||||
set_tcl_netlist_type();
|
||||
for(i=0;;i++) { /* find a non-existent untitled[-n].sym */
|
||||
for(i=0;; ++i) { /* find a non-existent untitled[-n].sym */
|
||||
if(i == 0) my_snprintf(name, S(name), "%s.sym", "untitled");
|
||||
else my_snprintf(name, S(name), "%s-%d.sym", "untitled", i);
|
||||
if(stat(name, &buf)) break;
|
||||
|
|
@ -532,7 +532,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
} else {
|
||||
xctx->netlist_type = CAD_SPICE_NETLIST;
|
||||
set_tcl_netlist_type();
|
||||
for(i=0;;i++) {
|
||||
for(i=0;; ++i) {
|
||||
if(i == 0) my_snprintf(name, S(name), "%s.sch", "untitled");
|
||||
else my_snprintf(name, S(name), "%s-%d.sch", "untitled", i);
|
||||
if(stat(name, &buf)) break;
|
||||
|
|
@ -1138,7 +1138,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
}
|
||||
else {
|
||||
xSymbol *ptr = xctx->inst[inst].ptr+ xctx->sym;
|
||||
for(n = 0; n < ptr->rects[PINLAYER]; n++) {
|
||||
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;
|
||||
}
|
||||
|
|
@ -1177,7 +1177,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
Tcl_SetResult(interp, "xschem getprop symbol needs 1 or 2 or 3 additional arguments", TCL_STATIC);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
for(i=0; i<xctx->symbols; i++) {
|
||||
for(i=0; i<xctx->symbols; ++i) {
|
||||
if(!xctx->x_strcmp(xctx->sym[i].name,argv[3])){
|
||||
found=1;
|
||||
break;
|
||||
|
|
@ -1249,7 +1249,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
my_snprintf(res, S(res), "zoom=%.16g\n", xctx->zoom); Tcl_AppendResult(interp, res, NULL);
|
||||
my_snprintf(res, S(res), "xorigin=%.16g\n", xctx->xorigin); Tcl_AppendResult(interp, res, NULL);
|
||||
my_snprintf(res, S(res), "yorigin=%.16g\n", xctx->yorigin); Tcl_AppendResult(interp, res, NULL);
|
||||
for(i=0;i<8;i++)
|
||||
for(i=0;i<8; ++i)
|
||||
{
|
||||
my_snprintf(res, S(res), "rects[%d]=%d\n", i, xctx->rects[i]); Tcl_AppendResult(interp, res, NULL);
|
||||
my_snprintf(res, S(res), "lines[%d]=%d\n", i, xctx->lines[i]); Tcl_AppendResult(interp, res, NULL);
|
||||
|
|
@ -1258,7 +1258,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
}
|
||||
my_snprintf(res, S(res), "current_name=%s\n", xctx->current_name); Tcl_AppendResult(interp, res, NULL);
|
||||
my_snprintf(res, S(res), "currsch=%d\n", xctx->currsch); Tcl_AppendResult(interp, res, NULL);
|
||||
for(i=0;i<=xctx->currsch;i++)
|
||||
for(i=0;i<=xctx->currsch; ++i)
|
||||
{
|
||||
my_snprintf(res, S(res), "previous_instance[%d]=%d\n",
|
||||
i,xctx->previous_instance[i]); Tcl_AppendResult(interp, res, NULL);
|
||||
|
|
@ -1430,7 +1430,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
{
|
||||
int i;
|
||||
char s[200];
|
||||
for(i=0;i<xctx->instances;i++) {
|
||||
for(i=0;i<xctx->instances; ++i) {
|
||||
if(!strcmp(xctx->inst[i].instname, argv[2])) {
|
||||
break;
|
||||
}
|
||||
|
|
@ -1585,7 +1585,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
{
|
||||
int i;
|
||||
char s[30];
|
||||
for(i=0;i<xctx->instances;i++) {
|
||||
for(i=0;i<xctx->instances; ++i) {
|
||||
if(!strcmp(xctx->inst[i].instname, argv[2])) {
|
||||
break;
|
||||
}
|
||||
|
|
@ -1609,7 +1609,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
Tcl_SetResult(interp, "xschem instances_to_net requires a net name argument", TCL_STATIC);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
for(i = 0;i < xctx->instances; i++) {
|
||||
for(i = 0;i < xctx->instances; ++i) {
|
||||
x0 = xctx->inst[i].x0;
|
||||
y0 = xctx->inst[i].y0;
|
||||
rot = xctx->inst[i].rot;
|
||||
|
|
@ -1701,7 +1701,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
int load_symbols = 1, force = 0, undo_reset = 1, nofullzoom = 0;
|
||||
size_t i;
|
||||
if(argc > 3) {
|
||||
for(i = 3; i < argc; i++) {
|
||||
for(i = 3; i < argc; ++i) {
|
||||
if(!strcmp(argv[i], "symbol")) load_symbols = 0;
|
||||
if(!strcmp(argv[i], "force")) force = 1;
|
||||
if(!strcmp(argv[i], "noundoreset")) undo_reset = 0;
|
||||
|
|
@ -1921,7 +1921,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
int c, i;
|
||||
char **av;
|
||||
av = parse_cmd_string(argv[2], &c);
|
||||
for(i = 0; i < c; i++) {
|
||||
for(i = 0; i < c; ++i) {
|
||||
dbg(0, "--> %s\n", av[i]);
|
||||
}
|
||||
}
|
||||
|
|
@ -2218,7 +2218,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
} else if(argc > 2 && !strcmp(argv[2], "vars")) {
|
||||
Tcl_SetResult(interp, my_itoa(xctx->graph_nvars), TCL_VOLATILE);
|
||||
} else if(argc > 2 && !strcmp(argv[2], "list")) {
|
||||
for(i = 0 ; i < xctx->graph_nvars; i++) {
|
||||
for(i = 0 ; i < xctx->graph_nvars; ++i) {
|
||||
if(i > 0) Tcl_AppendResult(interp, "\n", NULL);
|
||||
Tcl_AppendResult(interp, xctx->graph_names[i], NULL);
|
||||
}
|
||||
|
|
@ -2520,7 +2520,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
{
|
||||
int n, i;
|
||||
rebuild_selected_array();
|
||||
for(n=0; n < xctx->lastsel; n++) {
|
||||
for(n=0; n < xctx->lastsel; ++n) {
|
||||
if(xctx->sel_array[n].type == ELEMENT) {
|
||||
i = xctx->sel_array[n].n;
|
||||
Tcl_AppendResult(interp, /* "{", */ xctx->inst[i].instname, " ", /* "} ", */ NULL);
|
||||
|
|
@ -2532,7 +2532,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
{
|
||||
int n, i;
|
||||
rebuild_selected_array();
|
||||
for(n=0; n < xctx->lastsel; n++) {
|
||||
for(n=0; n < xctx->lastsel; ++n) {
|
||||
if(xctx->sel_array[n].type == WIRE) {
|
||||
i = xctx->sel_array[n].n;
|
||||
Tcl_AppendResult(interp, get_tok_value(xctx->wire[i].prop_ptr, "lab",0), " ", NULL);
|
||||
|
|
@ -2880,7 +2880,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
else if(!strcmp(argv[1], "show_pin_net_names"))
|
||||
{
|
||||
int i;
|
||||
for(i = 0; i < xctx->instances; i++) {
|
||||
for(i = 0; i < xctx->instances; ++i) {
|
||||
symbol_bbox(i, &xctx->inst[i].x1, &xctx->inst[i].y1, &xctx->inst[i].x2, &xctx->inst[i].y2);
|
||||
}
|
||||
}
|
||||
|
|
@ -2916,7 +2916,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
int i;
|
||||
char n[100];
|
||||
Tcl_SetResult(interp, "\n", TCL_STATIC);
|
||||
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);
|
||||
}
|
||||
|
|
@ -3155,7 +3155,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
int draw = 1;
|
||||
double shrink = 0.97;
|
||||
char * endptr;
|
||||
for(i = 2; i < argc; i++) {
|
||||
for(i = 2; i < argc; ++i) {
|
||||
if(!strcmp(argv[i], "center")) flags |= 2;
|
||||
else if(!strcmp(argv[i], "nodraw")) draw = 0;
|
||||
else if(!strcmp(argv[i], "nolinewidth")) flags &= ~1;
|
||||
|
|
|
|||
98
src/select.c
98
src/select.c
|
|
@ -89,7 +89,7 @@ void select_connected_wires(int stop_at_junction)
|
|||
hash_wires();
|
||||
hash_instances();
|
||||
rebuild_selected_array(); /* does nothing as already done in most of use cases */
|
||||
for(n=0; n<xctx->lastsel; n++) {
|
||||
for(n=0; n<xctx->lastsel; ++n) {
|
||||
i = xctx->sel_array[n].n;
|
||||
switch(xctx->sel_array[n].type) {
|
||||
char *type;
|
||||
|
|
@ -162,7 +162,7 @@ void symbol_bbox(int i, double *x1,double *y1, double *x2, double *y2)
|
|||
xctx->inst[i].yy2 = *y2;
|
||||
dbg(2, "symbol_bbox(): instance=%s %.16g %.16g %.16g %.16g\n",xctx->inst[i].instname,*x1, *y1, *x2, *y2);
|
||||
/* strings bbox */
|
||||
for(j=0;j< (xctx->inst[i].ptr+ xctx->sym)->texts;j++)
|
||||
for(j=0;j< (xctx->inst[i].ptr+ xctx->sym)->texts; ++j)
|
||||
{
|
||||
sym_flip = flip;
|
||||
sym_rot = rot;
|
||||
|
|
@ -201,7 +201,7 @@ static void del_rect_line_arc_poly(void)
|
|||
int customfont;
|
||||
#endif
|
||||
|
||||
for(k=0;k<xctx->lastsel;k++)
|
||||
for(k=0;k<xctx->lastsel; ++k)
|
||||
{
|
||||
double xx1, yy1, xx2, yy2;
|
||||
int n=xctx->sel_array[k].n;
|
||||
|
|
@ -223,15 +223,15 @@ static void del_rect_line_arc_poly(void)
|
|||
bbox(ADD, xx1, yy1, xx2, yy2 );
|
||||
}
|
||||
}
|
||||
for(c=0;c<cadlayers;c++)
|
||||
for(c=0;c<cadlayers; ++c)
|
||||
{
|
||||
j = 0;
|
||||
for(i=0;i<xctx->rects[c];i++)
|
||||
for(i=0;i<xctx->rects[c]; ++i)
|
||||
{
|
||||
if(xctx->rect[c][i].sel == SELECTED)
|
||||
{
|
||||
if(c == GRIDLAYER) xctx->graph_lastsel = -1; /* invalidate last selected graph */
|
||||
j++;
|
||||
++j;
|
||||
bbox(ADD, xctx->rect[c][i].x1, xctx->rect[c][i].y1, xctx->rect[c][i].x2, xctx->rect[c][i].y2);
|
||||
my_free(_ALLOC_ID_, &xctx->rect[c][i].prop_ptr);
|
||||
set_rect_extraptr(0, &xctx->rect[c][i]);
|
||||
|
|
@ -245,11 +245,11 @@ static void del_rect_line_arc_poly(void)
|
|||
}
|
||||
xctx->rects[c] -= j;
|
||||
j = 0;
|
||||
for(i=0;i<xctx->lines[c];i++)
|
||||
for(i=0;i<xctx->lines[c]; ++i)
|
||||
{
|
||||
if(xctx->line[c][i].sel == SELECTED)
|
||||
{
|
||||
j++;
|
||||
++j;
|
||||
if(xctx->line[c][i].bus){
|
||||
double ov, y1, y2;
|
||||
ov = INT_BUS_WIDTH(xctx->lw);
|
||||
|
|
@ -271,11 +271,11 @@ static void del_rect_line_arc_poly(void)
|
|||
xctx->lines[c] -= j;
|
||||
|
||||
j = 0;
|
||||
for(i=0;i<xctx->arcs[c];i++)
|
||||
for(i=0;i<xctx->arcs[c]; ++i)
|
||||
{
|
||||
if(xctx->arc[c][i].sel == SELECTED)
|
||||
{
|
||||
j++;
|
||||
++j;
|
||||
|
||||
if(xctx->arc[c][i].fill)
|
||||
arc_bbox(xctx->arc[c][i].x, xctx->arc[c][i].y, xctx->arc[c][i].r, 0, 360,
|
||||
|
|
@ -298,19 +298,19 @@ static void del_rect_line_arc_poly(void)
|
|||
|
||||
|
||||
j = 0;
|
||||
for(i=0;i<xctx->polygons[c];i++)
|
||||
for(i=0;i<xctx->polygons[c]; ++i)
|
||||
{
|
||||
if(xctx->poly[c][i].sel == SELECTED)
|
||||
{
|
||||
int k;
|
||||
double x1=0., y1=0., x2=0., y2=0.;
|
||||
for(k=0; k<xctx->poly[c][i].points; 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];
|
||||
}
|
||||
j++;
|
||||
++j;
|
||||
bbox(ADD, x1, y1, x2, y2);
|
||||
my_free(_ALLOC_ID_, &xctx->poly[c][i].prop_ptr);
|
||||
my_free(_ALLOC_ID_, &xctx->poly[c][i].x);
|
||||
|
|
@ -349,7 +349,7 @@ void delete(int to_push_undo)
|
|||
find_inst_to_be_redrawn(4 + 32); /* 32: call prepare_netlist_structs(0) if show net names enabled
|
||||
* 4: call symbol_bbox() to precisely update bbox to current zoom level
|
||||
*/
|
||||
for(i=0;i<xctx->texts;i++)
|
||||
for(i=0;i<xctx->texts; ++i)
|
||||
{
|
||||
if(xctx->text[i].sel == SELECTED)
|
||||
{
|
||||
|
|
@ -372,7 +372,7 @@ void delete(int to_push_undo)
|
|||
my_free(_ALLOC_ID_, &xctx->text[i].font);
|
||||
my_free(_ALLOC_ID_, &xctx->text[i].txt_ptr);
|
||||
set_modify(1);
|
||||
j++;
|
||||
++j;
|
||||
continue;
|
||||
}
|
||||
if(j)
|
||||
|
|
@ -385,7 +385,7 @@ void delete(int to_push_undo)
|
|||
xctx->texts -= j;
|
||||
j = 0;
|
||||
|
||||
for(i=0;i<xctx->instances;i++)
|
||||
for(i=0;i<xctx->instances; ++i)
|
||||
{
|
||||
if(xctx->inst[i].sel == SELECTED)
|
||||
{
|
||||
|
|
@ -398,7 +398,7 @@ void delete(int to_push_undo)
|
|||
my_free(_ALLOC_ID_, &xctx->inst[i].name);
|
||||
my_free(_ALLOC_ID_, &xctx->inst[i].instname);
|
||||
my_free(_ALLOC_ID_, &xctx->inst[i].lab);
|
||||
j++;
|
||||
++j;
|
||||
continue;
|
||||
}
|
||||
if(j)
|
||||
|
|
@ -414,10 +414,10 @@ void delete(int to_push_undo)
|
|||
xctx->prep_hi_structs=0;
|
||||
}
|
||||
j = 0;
|
||||
for(i=0;i<xctx->wires;i++)
|
||||
for(i=0;i<xctx->wires; ++i)
|
||||
{
|
||||
if(xctx->wire[i].sel == SELECTED) {
|
||||
j++;
|
||||
++j;
|
||||
if(xctx->wire[i].bus){
|
||||
double ov, y1, y2;
|
||||
ov = INT_BUS_WIDTH(xctx->lw)> cadhalfdotsize ? INT_BUS_WIDTH(xctx->lw) : CADHALFDOTSIZE;
|
||||
|
|
@ -607,7 +607,7 @@ void unselect_all(int dr)
|
|||
xctx->ui_state = 0;
|
||||
xctx->lastsel = 0;
|
||||
|
||||
for(i=0;i<xctx->wires;i++)
|
||||
for(i=0;i<xctx->wires; ++i)
|
||||
{
|
||||
if(xctx->wire[i].sel)
|
||||
{
|
||||
|
|
@ -624,16 +624,16 @@ void unselect_all(int dr)
|
|||
}
|
||||
}
|
||||
}
|
||||
for(i=0;i<xctx->instances;i++)
|
||||
for(i=0;i<xctx->instances; ++i)
|
||||
{
|
||||
if(xctx->inst[i].sel == SELECTED)
|
||||
{
|
||||
xctx->inst[i].sel = 0;
|
||||
if(dr) for(c=0;c<cadlayers;c++)
|
||||
if(dr) for(c=0;c<cadlayers; ++c)
|
||||
draw_temp_symbol(ADD, xctx->gctiled, i, c,0,0,0.0,0.0);
|
||||
}
|
||||
}
|
||||
for(i=0;i<xctx->texts;i++)
|
||||
for(i=0;i<xctx->texts; ++i)
|
||||
{
|
||||
if(xctx->text[i].sel == SELECTED)
|
||||
{
|
||||
|
|
@ -654,9 +654,9 @@ void unselect_all(int dr)
|
|||
}
|
||||
}
|
||||
}
|
||||
for(c=0;c<cadlayers;c++)
|
||||
for(c=0;c<cadlayers; ++c)
|
||||
{
|
||||
for(i=0;i<xctx->arcs[c];i++)
|
||||
for(i=0;i<xctx->arcs[c]; ++i)
|
||||
{
|
||||
if(xctx->arc[c][i].sel)
|
||||
{
|
||||
|
|
@ -665,7 +665,7 @@ void unselect_all(int dr)
|
|||
xctx->arc[c][i].r, xctx->arc[c][i].a, xctx->arc[c][i].b);
|
||||
}
|
||||
}
|
||||
for(i=0;i<xctx->rects[c];i++)
|
||||
for(i=0;i<xctx->rects[c]; ++i)
|
||||
{
|
||||
if(xctx->rect[c][i].sel)
|
||||
{
|
||||
|
|
@ -674,7 +674,7 @@ void unselect_all(int dr)
|
|||
xctx->rect[c][i].x2, xctx->rect[c][i].y2);
|
||||
}
|
||||
}
|
||||
for(i=0;i<xctx->lines[c];i++)
|
||||
for(i=0;i<xctx->lines[c]; ++i)
|
||||
{
|
||||
if(xctx->line[c][i].sel)
|
||||
{
|
||||
|
|
@ -689,12 +689,12 @@ void unselect_all(int dr)
|
|||
}
|
||||
}
|
||||
}
|
||||
for(i=0;i<xctx->polygons[c];i++)
|
||||
for(i=0;i<xctx->polygons[c]; ++i)
|
||||
{
|
||||
if(xctx->poly[c][i].sel)
|
||||
{
|
||||
int k;
|
||||
for(k=0;k<xctx->poly[c][i].points; k++) xctx->poly[c][i].selected_point[k] = 0;
|
||||
for(k=0;k<xctx->poly[c][i].points; ++k) xctx->poly[c][i].selected_point[k] = 0;
|
||||
xctx->poly[c][i].sel = 0;
|
||||
if(dr) drawtemppolygon(xctx->gctiled, NOW, xctx->poly[c][i].x, xctx->poly[c][i].y, xctx->poly[c][i].points);
|
||||
}
|
||||
|
|
@ -768,7 +768,7 @@ void select_element(int i,unsigned short select_mode, int fast, int override_loc
|
|||
/* 20190526 */ /*Why this? 20191125 only on small schematics. slow down on big schematics */
|
||||
if(xctx->instances < 150) {
|
||||
prepare_netlist_structs(0);
|
||||
for(j=0;j< (xctx->inst[i].ptr+ xctx->sym)->rects[PINLAYER] ;j++)
|
||||
for(j=0;j< (xctx->inst[i].ptr+ xctx->sym)->rects[PINLAYER] ; ++j)
|
||||
{
|
||||
if(xctx->inst[i].node && (xctx->inst[i].ptr+ xctx->sym)->rect[PINLAYER][j].prop_ptr)
|
||||
{
|
||||
|
|
@ -788,11 +788,11 @@ void select_element(int i,unsigned short select_mode, int fast, int override_loc
|
|||
}
|
||||
xctx->inst[i].sel = select_mode;
|
||||
if(select_mode) {
|
||||
for(c=0;c<cadlayers;c++) {
|
||||
for(c=0;c<cadlayers; ++c) {
|
||||
draw_temp_symbol(ADD, xctx->gc[SELLAYER], i,c,0,0,0.0,0.0);
|
||||
}
|
||||
} else {
|
||||
for(c=0;c<cadlayers;c++) {
|
||||
for(c=0;c<cadlayers; ++c) {
|
||||
draw_temp_symbol(NOW, xctx->gctiled, i,c,0,0,0.0,0.0);
|
||||
}
|
||||
}
|
||||
|
|
@ -1025,7 +1025,7 @@ void select_inside(double x1,double y1, double x2, double y2, int sel) /*added u
|
|||
#endif
|
||||
|
||||
en_s = tclgetboolvar("enable_stretch");
|
||||
for(i=0;i<xctx->wires;i++)
|
||||
for(i=0;i<xctx->wires; ++i)
|
||||
{
|
||||
if(RECT_INSIDE(xctx->wire[i].x1,xctx->wire[i].y1,xctx->wire[i].x2,xctx->wire[i].y2, x1,y1,x2,y2))
|
||||
{
|
||||
|
|
@ -1043,7 +1043,7 @@ void select_inside(double x1,double y1, double x2, double y2, int sel) /*added u
|
|||
select_wire(i,SELECTED2, 1);
|
||||
}
|
||||
}
|
||||
for(i=0;i<xctx->texts;i++)
|
||||
for(i=0;i<xctx->texts; ++i)
|
||||
{
|
||||
select_rot = xctx->text[i].rot;
|
||||
select_flip = xctx->text[i].flip;
|
||||
|
|
@ -1066,7 +1066,7 @@ void select_inside(double x1,double y1, double x2, double y2, int sel) /*added u
|
|||
sel ? select_text(i, SELECTED, 1): select_text(i, 0, 1);
|
||||
}
|
||||
}
|
||||
for(i=0;i<xctx->instances;i++)
|
||||
for(i=0;i<xctx->instances; ++i)
|
||||
{
|
||||
if(RECT_INSIDE(xctx->inst[i].xx1, xctx->inst[i].yy1, xctx->inst[i].xx2, xctx->inst[i].yy2, x1,y1,x2,y2))
|
||||
{
|
||||
|
|
@ -1074,17 +1074,17 @@ void select_inside(double x1,double y1, double x2, double y2, int sel) /*added u
|
|||
sel ? select_element(i,SELECTED,1, 1): select_element(i,0,1, 0);
|
||||
}
|
||||
}
|
||||
for(c=0;c<cadlayers;c++)
|
||||
for(c=0;c<cadlayers; ++c)
|
||||
{
|
||||
if(!xctx->enable_layer[c]) continue;
|
||||
for(i=0;i<xctx->polygons[c]; i++) {
|
||||
for(i=0;i<xctx->polygons[c]; ++i) {
|
||||
int k, selected_points, flag;
|
||||
|
||||
polygon_bbox(xctx->poly[c][i].x, xctx->poly[c][i].y, xctx->poly[c][i].points, &xa, &ya, &xb, &yb);
|
||||
if(OUTSIDE(xa, ya, xb, yb, x1, y1, x2, y2)) continue;
|
||||
selected_points = 0;
|
||||
flag=0;
|
||||
for(k=0; k<xctx->poly[c][i].points; k++) {
|
||||
for(k=0; k<xctx->poly[c][i].points; ++k) {
|
||||
if(xctx->poly[c][i].sel==SELECTED) xctx->poly[c][i].selected_point[k] = 1;
|
||||
if( POINTINSIDE(xctx->poly[c][i].x[k],xctx->poly[c][i].y[k], x1,y1,x2,y2)) {
|
||||
flag=1;
|
||||
|
|
@ -1106,7 +1106,7 @@ void select_inside(double x1,double y1, double x2, double y2, int sel) /*added u
|
|||
}
|
||||
|
||||
}
|
||||
for(i=0;i<xctx->lines[c];i++)
|
||||
for(i=0;i<xctx->lines[c]; ++i)
|
||||
{
|
||||
if(RECT_INSIDE(xctx->line[c][i].x1,xctx->line[c][i].y1,xctx->line[c][i].x2,xctx->line[c][i].y2, x1,y1,x2,y2))
|
||||
{
|
||||
|
|
@ -1124,7 +1124,7 @@ void select_inside(double x1,double y1, double x2, double y2, int sel) /*added u
|
|||
select_line(c, i,SELECTED2,1);
|
||||
}
|
||||
}
|
||||
for(i=0;i<xctx->arcs[c];i++) {
|
||||
for(i=0;i<xctx->arcs[c]; ++i) {
|
||||
x = xctx->arc[c][i].x;
|
||||
y = xctx->arc[c][i].y;
|
||||
a = xctx->arc[c][i].a;
|
||||
|
|
@ -1155,7 +1155,7 @@ void select_inside(double x1,double y1, double x2, double y2, int sel) /*added u
|
|||
select_arc(c, i,SELECTED2,1);
|
||||
}
|
||||
}
|
||||
for(i=0;i<xctx->rects[c];i++)
|
||||
for(i=0;i<xctx->rects[c]; ++i)
|
||||
{
|
||||
if(RECT_INSIDE(xctx->rect[c][i].x1,xctx->rect[c][i].y1,xctx->rect[c][i].x2,xctx->rect[c][i].y2, x1,y1,x2,y2))
|
||||
{
|
||||
|
|
@ -1196,33 +1196,33 @@ void select_all(void)
|
|||
{
|
||||
int c,i;
|
||||
|
||||
for(i=0;i<xctx->wires;i++)
|
||||
for(i=0;i<xctx->wires; ++i)
|
||||
{
|
||||
select_wire(i,SELECTED, 1);
|
||||
}
|
||||
for(i=0;i<xctx->texts;i++)
|
||||
for(i=0;i<xctx->texts; ++i)
|
||||
{
|
||||
select_text(i, SELECTED, 1);
|
||||
}
|
||||
for(i=0;i<xctx->instances;i++)
|
||||
for(i=0;i<xctx->instances; ++i)
|
||||
{
|
||||
select_element(i,SELECTED,1, 0);
|
||||
}
|
||||
for(c=0;c<cadlayers;c++)
|
||||
for(c=0;c<cadlayers; ++c)
|
||||
{
|
||||
for(i=0;i<xctx->polygons[c];i++)
|
||||
for(i=0;i<xctx->polygons[c]; ++i)
|
||||
{
|
||||
select_polygon(c,i,SELECTED,1);
|
||||
}
|
||||
for(i=0;i<xctx->lines[c];i++)
|
||||
for(i=0;i<xctx->lines[c]; ++i)
|
||||
{
|
||||
select_line(c,i,SELECTED,1);
|
||||
}
|
||||
for(i=0;i<xctx->arcs[c];i++)
|
||||
for(i=0;i<xctx->arcs[c]; ++i)
|
||||
{
|
||||
select_arc(c,i, SELECTED, 1);
|
||||
}
|
||||
for(i=0;i<xctx->rects[c];i++)
|
||||
for(i=0;i<xctx->rects[c]; ++i)
|
||||
{
|
||||
select_box(c,i, SELECTED, 1, 0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ void hier_psprint(char **res, int what) /* netlister driver */
|
|||
xctx->sch_path_hash[xctx->currsch+1] = 0;
|
||||
xctx->currsch++;
|
||||
subckt_name=NULL;
|
||||
for(i=0;i<xctx->symbols;i++)
|
||||
for(i=0;i<xctx->symbols; ++i)
|
||||
{
|
||||
int flag;
|
||||
/* for printing we process also symbols that have *_ignore attribute */
|
||||
|
|
@ -149,7 +149,7 @@ static void spice_netlist(FILE *fd, int spice_stop )
|
|||
xctx->prep_net_structs = 0;
|
||||
prepare_netlist_structs(1);
|
||||
traverse_node_hash(); /* print all warnings about unconnected floatings etc */
|
||||
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;
|
||||
|
|
@ -174,7 +174,7 @@ static void spice_netlist(FILE *fd, int spice_stop )
|
|||
}
|
||||
}
|
||||
if(top_sub) fprintf(fd, "\n");
|
||||
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;
|
||||
|
|
@ -265,7 +265,7 @@ void global_spice_netlist(int global) /* netlister driver */
|
|||
my_snprintf(cellname, S(cellname), "%s.spice", skip_dir(xctx->sch[xctx->currsch]));
|
||||
}
|
||||
first = 0;
|
||||
for(i=0;i<xctx->instances;i++) /* print netlist_commands of top level cell with 'place=header' property */
|
||||
for(i=0;i<xctx->instances; ++i) /* print netlist_commands of top level cell with 'place=header' property */
|
||||
{
|
||||
if( strcmp(get_tok_value(xctx->inst[i].prop_ptr,"spice_ignore",0),"true")==0 ) continue;
|
||||
if(xctx->inst[i].ptr<0) continue;
|
||||
|
|
@ -280,7 +280,7 @@ void global_spice_netlist(int global) /* netlister driver */
|
|||
}
|
||||
if(place && !strcmp(place, "header" )) {
|
||||
if(first == 0) fprintf(fd,"**** begin user header code\n");
|
||||
first++;
|
||||
++first;
|
||||
print_spice_element(fd, i) ; /* this is the element line */
|
||||
}
|
||||
}
|
||||
|
|
@ -288,7 +288,7 @@ void global_spice_netlist(int global) /* netlister driver */
|
|||
if(first) fprintf(fd,"**** end user header code\n");
|
||||
|
||||
/* netlist_options */
|
||||
for(i=0;i<xctx->instances;i++) {
|
||||
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);
|
||||
|
|
@ -299,7 +299,7 @@ void global_spice_netlist(int global) /* netlister driver */
|
|||
fprintf(fd,".subckt %s", skip_dir( xctx->sch[xctx->currsch]) );
|
||||
|
||||
/* print top subckt ipin/opins */
|
||||
for(i=0;i<xctx->instances;i++) {
|
||||
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") ) {
|
||||
|
|
@ -323,7 +323,7 @@ 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
|
||||
and no place=header */
|
||||
{
|
||||
if( strcmp(get_tok_value(xctx->inst[i].prop_ptr,"spice_ignore",0),"true")==0 ) continue;
|
||||
|
|
@ -339,7 +339,7 @@ void global_spice_netlist(int global) /* netlister driver */
|
|||
}
|
||||
if(!place || (strcmp(place, "end") && strcmp(place, "header")) ) {
|
||||
if(first == 0) fprintf(fd,"**** begin user architecture code\n");
|
||||
first++;
|
||||
++first;
|
||||
print_spice_element(fd, i) ; /* this is the element line */
|
||||
}
|
||||
}
|
||||
|
|
@ -349,7 +349,7 @@ void global_spice_netlist(int global) /* netlister driver */
|
|||
|
||||
if(xctx->schprop && xctx->schprop[0]) {
|
||||
if(first == 0) fprintf(fd,"**** begin user architecture code\n");
|
||||
first++;
|
||||
++first;
|
||||
fprintf(fd, "%s\n", xctx->schprop);
|
||||
}
|
||||
if(first) fprintf(fd,"**** end user architecture code\n");
|
||||
|
|
@ -377,7 +377,7 @@ void global_spice_netlist(int global) /* netlister driver */
|
|||
warning_overlapped_symbols(0);
|
||||
/* preserve current level instance flags before descending hierarchy for netlisting, restore later */
|
||||
stored_flags = my_calloc(_ALLOC_ID_, xctx->instances, sizeof(unsigned int));
|
||||
for(i=0;i<xctx->instances;i++) stored_flags[i] = xctx->inst[i].color;
|
||||
for(i=0;i<xctx->instances; ++i) stored_flags[i] = xctx->inst[i].color;
|
||||
|
||||
if(global)
|
||||
{
|
||||
|
|
@ -395,7 +395,7 @@ void global_spice_netlist(int global) /* netlister driver */
|
|||
|
||||
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;
|
||||
|
|
@ -434,7 +434,7 @@ void global_spice_netlist(int global) /* netlister driver */
|
|||
if(!xctx->hilight_nets) xctx->hilight_nets = saved_hilight_nets;
|
||||
}
|
||||
/* restore hilight flags from errors found analyzing top level before descending hierarchy */
|
||||
for(i=0;i<xctx->instances; i++) xctx->inst[i].color = stored_flags[i];
|
||||
for(i=0;i<xctx->instances; ++i) xctx->inst[i].color = stored_flags[i];
|
||||
propagate_hilights(1, 0, XINSERT_NOREPLACE);
|
||||
draw_hilight_net(1);
|
||||
my_free(_ALLOC_ID_, &stored_flags);
|
||||
|
|
@ -445,7 +445,7 @@ void global_spice_netlist(int global) /* netlister driver */
|
|||
/* =================================== 20121223 */
|
||||
first = 0;
|
||||
if(!split_f) {
|
||||
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;
|
||||
|
|
@ -457,13 +457,13 @@ void global_spice_netlist(int global) /* netlister driver */
|
|||
if( type && !strcmp(type,"netlist_commands") ) {
|
||||
if(place && !strcmp(place, "end" )) {
|
||||
if(first == 0) fprintf(fd,"**** begin user architecture code\n");
|
||||
first++;
|
||||
++first;
|
||||
print_spice_element(fd, i) ;
|
||||
} else {
|
||||
my_strdup(_ALLOC_ID_, &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++;
|
||||
++first;
|
||||
print_spice_element(fd, i) ;
|
||||
}
|
||||
}
|
||||
|
|
@ -472,11 +472,11 @@ void global_spice_netlist(int global) /* netlister driver */
|
|||
|
||||
}
|
||||
/* print device_model attributes */
|
||||
for(i=0;i<model_table.size; i++) {
|
||||
for(i=0;i<model_table.size; ++i) {
|
||||
model_entry=model_table.table[i];
|
||||
while(model_entry) {
|
||||
if(first == 0) fprintf(fd,"**** begin user architecture code\n");
|
||||
first++;
|
||||
++first;
|
||||
fprintf(fd, "%s\n", model_entry->value);
|
||||
model_entry = model_entry->next;
|
||||
}
|
||||
|
|
@ -675,7 +675,7 @@ void str_hash_free(Str_hashtable *hashtable)
|
|||
if(hashtable->table) {
|
||||
int i;
|
||||
Str_hashentry **table = hashtable->table;
|
||||
for(i=0;i < hashtable->size;i++)
|
||||
for(i=0;i < hashtable->size; ++i)
|
||||
{
|
||||
str_hash_free_entry( table[i] );
|
||||
table[i] = NULL;
|
||||
|
|
@ -773,7 +773,7 @@ void int_hash_free(Int_hashtable *hashtable)
|
|||
if(hashtable->table) {
|
||||
int i;
|
||||
Int_hashentry **table = hashtable->table;
|
||||
for(i=0;i < hashtable->size;i++)
|
||||
for(i=0;i < hashtable->size; ++i)
|
||||
{
|
||||
int_hash_free_entry( table[i] );
|
||||
table[i] = NULL;
|
||||
|
|
@ -873,7 +873,7 @@ void ptr_hash_free(Ptr_hashtable *hashtable)
|
|||
if(hashtable->table) {
|
||||
int i;
|
||||
Ptr_hashentry **table = hashtable->table;
|
||||
for(i=0;i < hashtable->size;i++)
|
||||
for(i=0;i < hashtable->size; ++i)
|
||||
{
|
||||
ptr_hash_free_entry( table[i] );
|
||||
table[i] = NULL;
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ void check_symbol_storage(void)
|
|||
xctx->sch[xctx->currsch] );
|
||||
xctx->maxs=(1 + xctx->symbols / ELEMDEF) * ELEMDEF;
|
||||
my_realloc(_ALLOC_ID_, &xctx->sym, sizeof(xSymbol)*xctx->maxs);
|
||||
for(i=xctx->symbols;i<xctx->maxs;i++) {
|
||||
for(i=xctx->symbols;i<xctx->maxs; ++i) {
|
||||
xctx->sym[i].poly=my_calloc(_ALLOC_ID_, cadlayers, sizeof(xPoly *));
|
||||
if(xctx->sym[i].poly==NULL){
|
||||
fprintf(errfp, "check_symbol_storage(): calloc error\n");tcleval( "exit");
|
||||
|
|
@ -227,7 +227,7 @@ void store_poly(int pos, double *x, double *y, int points, unsigned int rectc,
|
|||
xctx->poly[rectc][n].y= my_calloc(_ALLOC_ID_, points, sizeof(double));
|
||||
xctx->poly[rectc][n].selected_point= my_calloc(_ALLOC_ID_, points, sizeof(unsigned short));
|
||||
my_strdup(_ALLOC_ID_, &xctx->poly[rectc][n].prop_ptr, prop_ptr);
|
||||
for(j=0;j<points; j++) {
|
||||
for(j=0;j<points; ++j) {
|
||||
xctx->poly[rectc][n].x[j] = x[j];
|
||||
xctx->poly[rectc][n].y[j] = y[j];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ static void svg_drawpolygon(int c, int what, double *x, double *y, int points, i
|
|||
fprintf(fd,"style=\"fill:none;\" ");
|
||||
}
|
||||
fprintf(fd, "d=\"");
|
||||
for(i=0;i<points; i++) {
|
||||
for(i=0;i<points; ++i) {
|
||||
xx = X_TO_SVG(x[i]);
|
||||
yy = Y_TO_SVG(y[i]);
|
||||
if(i==0) fprintf(fd, "M%g %g", xx, yy);
|
||||
|
|
@ -244,7 +244,7 @@ static void svg_draw_string_line(int layer, char *s, double x, double y, double
|
|||
default:
|
||||
fputc(*s, fd);
|
||||
}
|
||||
s++;
|
||||
++s;
|
||||
}
|
||||
fprintf(fd, "</text>\n");
|
||||
}
|
||||
|
|
@ -299,15 +299,15 @@ static void svg_draw_string(int layer, const char *str, short rot, short flip, i
|
|||
*ss='\0';
|
||||
svg_draw_string_line(layer, tt, x, y, size, rot, flip, lineno, height,
|
||||
ascent, descent, llength, no_of_lines, longest_line);
|
||||
lineno++;
|
||||
++lineno;
|
||||
if(c==0) break;
|
||||
*ss='\n';
|
||||
tt=ss+1;
|
||||
llength=0;
|
||||
} else {
|
||||
llength++;
|
||||
++llength;
|
||||
}
|
||||
ss++;
|
||||
++ss;
|
||||
}
|
||||
my_free(_ALLOC_ID_, &sss);
|
||||
}
|
||||
|
|
@ -361,7 +361,7 @@ static void old_svg_draw_string(int layer, const char *str,
|
|||
ORDER(rx1,ry1,rx2,ry2);
|
||||
svg_drawline(layer, 0, rx1, ry1, rx2, ry2, 0);
|
||||
}
|
||||
pos++;
|
||||
++pos;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -434,7 +434,7 @@ static void svg_embedded_image(xRect *r, double rx1, double ry1, double rx2, dou
|
|||
static void svg_draw_symbol(int c, int n,int layer,short tmp_flip, short rot,
|
||||
double xoffset, double yoffset)
|
||||
/* draws current layer only, should be called within */
|
||||
{ /* a "for(i=0;i<cadlayers;i++)" loop */
|
||||
{ /* a "for(i=0;i<cadlayers; ++i)" loop */
|
||||
int j, hide = 0;
|
||||
double x0,y0,x1,y1,x2,y2;
|
||||
short flip;
|
||||
|
|
@ -478,20 +478,20 @@ static void svg_draw_symbol(int c, int n,int layer,short tmp_flip, short rot,
|
|||
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++) {
|
||||
for(j=0;j< symptr->lines[layer]; ++j) {
|
||||
line = (symptr->line[layer])[j];
|
||||
ROTATION(rot, flip, 0.0,0.0,line.x1,line.y1,x1,y1);
|
||||
ROTATION(rot, flip, 0.0,0.0,line.x2,line.y2,x2,y2);
|
||||
ORDER(x1,y1,x2,y2);
|
||||
svg_drawline(c, line.bus, x0+x1, y0+y1, x0+x2, y0+y2, line.dash);
|
||||
}
|
||||
for(j=0;j< symptr->polygons[layer];j++) {
|
||||
for(j=0;j< symptr->polygons[layer]; ++j) {
|
||||
polygon = (symptr->poly[layer])[j];
|
||||
{ /* scope block so we declare some auxiliary arrays for coord transforms. 20171115 */
|
||||
int k;
|
||||
double *x = my_malloc(_ALLOC_ID_, sizeof(double) * polygon.points);
|
||||
double *y = my_malloc(_ALLOC_ID_, sizeof(double) * polygon.points);
|
||||
for(k=0;k<polygon.points;k++) {
|
||||
for(k=0;k<polygon.points; ++k) {
|
||||
ROTATION(rot, flip, 0.0,0.0,polygon.x[k],polygon.y[k],x[k],y[k]);
|
||||
x[k]+= x0;
|
||||
y[k] += y0;
|
||||
|
|
@ -501,7 +501,7 @@ static void svg_draw_symbol(int c, int n,int layer,short tmp_flip, short rot,
|
|||
my_free(_ALLOC_ID_, &y);
|
||||
}
|
||||
}
|
||||
for(j=0;j< symptr->arcs[layer];j++) {
|
||||
for(j=0;j< symptr->arcs[layer]; ++j) {
|
||||
double angle;
|
||||
arc = (symptr->arc[layer])[j];
|
||||
if(flip) {
|
||||
|
|
@ -515,7 +515,7 @@ static void svg_draw_symbol(int c, int n,int layer,short tmp_flip, short rot,
|
|||
svg_drawarc(c, arc.fill, x0+x1, y0+y1, arc.r, angle, arc.b, arc.dash);
|
||||
}
|
||||
|
||||
if( xctx->enable_layer[layer] ) for(j=0;j< symptr->rects[layer];j++) {
|
||||
if( xctx->enable_layer[layer] ) for(j=0;j< symptr->rects[layer]; ++j) {
|
||||
rect = &(symptr->rect[layer])[j];
|
||||
ROTATION(rot, flip, 0.0,0.0,rect->x1,rect->y1,x1,y1);
|
||||
ROTATION(rot, flip, 0.0,0.0,rect->x2,rect->y2,x2,y2);
|
||||
|
|
@ -534,7 +534,7 @@ static void svg_draw_symbol(int c, int n,int layer,short tmp_flip, short rot,
|
|||
if( (layer==TEXTWIRELAYER && !(xctx->inst[n].flags&2) ) ||
|
||||
(xctx->sym_txt && (layer==TEXTLAYER) && (xctx->inst[n].flags&2) ) ) {
|
||||
const char *txtptr;
|
||||
for(j=0;j< symptr->texts;j++) {
|
||||
for(j=0;j< symptr->texts; ++j) {
|
||||
text = symptr->text[j];
|
||||
/* if(text.xscale*FONTWIDTH* xctx->mooz<1) continue; */
|
||||
if(!xctx->show_hidden_texts && (symptr->text[j].flags & HIDE_TEXT)) continue;
|
||||
|
|
@ -587,7 +587,7 @@ static void fill_svg_colors()
|
|||
* tcleval( "puts $svg_colors");
|
||||
* }
|
||||
*/
|
||||
for(i=0;i<cadlayers;i++) {
|
||||
for(i=0;i<cadlayers; ++i) {
|
||||
if(color_ps) {
|
||||
my_snprintf(s, S(s), "lindex $svg_colors %d", i);
|
||||
tcleval( s);
|
||||
|
|
@ -677,20 +677,20 @@ void svg_draw(void)
|
|||
unused_layer = my_calloc(_ALLOC_ID_, cadlayers, sizeof(int));
|
||||
#if 0
|
||||
* /* Determine used layers. Disabled since we want hilight colors */
|
||||
* for(c=0;c<cadlayers;c++) unused_layer[c] = 1;
|
||||
* for(c=0;c<cadlayers; ++c) unused_layer[c] = 1;
|
||||
* unused_layer[0] = 0; /* background */
|
||||
* for(i=0;i<xctx->texts;i++)
|
||||
* for(i=0;i<xctx->texts; ++i)
|
||||
* {
|
||||
* textlayer = xctx->text[i].layer;
|
||||
* if(textlayer < 0 || textlayer >= cadlayers) textlayer = TEXTLAYER;
|
||||
* unused_layer[textlayer] = 0;
|
||||
* }
|
||||
* for(c=0;c<cadlayers;c++)
|
||||
* for(c=0;c<cadlayers; ++c)
|
||||
* {
|
||||
* xSymbol symptr = (xctx->inst[i].ptr + xctx->sym);
|
||||
* if(xctx->lines[c] || xctx->rects[c] || xctx->arcs[c] || xctx->polygons[c]) unused_layer[c] = 0;
|
||||
* if(xctx->wires) unused_layer[WIRELAYER] = 0;
|
||||
* for(i=0;i<xctx->instances;i++) {
|
||||
* for(i=0;i<xctx->instances; ++i) {
|
||||
* if( (c == PINLAYER || xctx->enable_layer[c]) && symptr->lines[c] ) unused_layer[c] = 0;
|
||||
* if( (c == PINLAYER || xctx->enable_layer[c]) && symptr->polygons[c] ) unused_layer[c] = 0;
|
||||
* if( (c == PINLAYER || xctx->enable_layer[c]) && symptr->arcs[c] ) unused_layer[c] = 0;
|
||||
|
|
@ -699,7 +699,7 @@ void svg_draw(void)
|
|||
* (xctx->sym_txt && (c==TEXTLAYER) && (xctx->inst[i].flags&2) ) )
|
||||
* {
|
||||
* int j;
|
||||
* for(j=0;j< symptr->texts;j++)
|
||||
* for(j=0;j< symptr->texts; ++j)
|
||||
* {
|
||||
* textlayer = c;
|
||||
* if( !(xctx->inst[i].color == PINLAYER)) {
|
||||
|
|
@ -733,7 +733,7 @@ void svg_draw(void)
|
|||
* 1 : solid fill
|
||||
* 2 : patterned (stippled) fill
|
||||
*/
|
||||
for(i=0;i<cadlayers;i++){
|
||||
for(i=0;i<cadlayers; ++i){
|
||||
if(unused_layer[i]) continue;
|
||||
fprintf(fd, ".l%d{\n", i);
|
||||
if( xctx->fill_pattern == 0 || xctx->fill_type[i] == 0)
|
||||
|
|
@ -762,7 +762,7 @@ void svg_draw(void)
|
|||
/* background */
|
||||
fprintf(fd, "<rect class=\"l0\" x=\"%g\" y=\"%g\" width=\"%g\" height=\"%g\"/>\n", 0.0, 0.0, dx, dy);
|
||||
svg_drawgrid();
|
||||
for(i=0;i<xctx->texts;i++)
|
||||
for(i=0;i<xctx->texts; ++i)
|
||||
{
|
||||
textlayer = xctx->text[i].layer;
|
||||
if(!xctx->show_hidden_texts && (xctx->text[i].flags & HIDE_TEXT)) continue;
|
||||
|
|
@ -795,9 +795,9 @@ void svg_draw(void)
|
|||
|
||||
|
||||
/* do first graphs as these require draw() which clobbers xctx->inst[n].flags bit 0 */
|
||||
for(c=0;c<cadlayers;c++)
|
||||
for(c=0;c<cadlayers; ++c)
|
||||
{
|
||||
for(i=0;i<xctx->rects[c];i++)
|
||||
for(i=0;i<xctx->rects[c]; ++i)
|
||||
{
|
||||
if(c == GRIDLAYER && (xctx->rect[c][i].flags & 1) ) { /* graph */
|
||||
xRect *r = &xctx->rect[c][i];
|
||||
|
|
@ -805,12 +805,12 @@ void svg_draw(void)
|
|||
}
|
||||
}
|
||||
}
|
||||
for(c=0;c<cadlayers;c++)
|
||||
for(c=0;c<cadlayers; ++c)
|
||||
{
|
||||
for(i=0;i<xctx->lines[c];i++)
|
||||
for(i=0;i<xctx->lines[c]; ++i)
|
||||
svg_drawline(c, xctx->line[c][i].bus, 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->rects[c]; ++i)
|
||||
{
|
||||
if(c == GRIDLAYER && (xctx->rect[c][i].flags & 1) ) { /* graph */
|
||||
/* do nothing, done above */
|
||||
|
|
@ -823,23 +823,23 @@ void svg_draw(void)
|
|||
xctx->rect[c][i].dash, xctx->rect[c][i].fill);
|
||||
}
|
||||
}
|
||||
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);
|
||||
}
|
||||
for(i=0;i<xctx->polygons[c];i++) {
|
||||
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) {
|
||||
color = c;
|
||||
if(xctx->inst[i].color != -10000) color = get_color(xctx->inst[i].color);
|
||||
svg_draw_symbol(color,i,c,0,0,0.0,0.0);
|
||||
}
|
||||
}
|
||||
prepare_netlist_structs(0); /* NEEDED: data was cleared by trim_wires() */
|
||||
for(i=0;i<xctx->wires;i++)
|
||||
for(i=0;i<xctx->wires; ++i)
|
||||
{
|
||||
color = WIRELAYER;
|
||||
if(xctx->hilight_nets && (entry=bus_hilight_hash_lookup( xctx->wire[i].node, 0, XLOOKUP))) {
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ static void tedax_netlist(FILE *fd, int tedax_stop )
|
|||
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;
|
||||
|
|
@ -45,7 +45,7 @@ static void tedax_netlist(FILE *fd, int tedax_stop )
|
|||
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;
|
||||
|
|
@ -152,7 +152,7 @@ void global_tedax_netlist(int global) /* netlister driver */
|
|||
}
|
||||
|
||||
/* netlist_options */
|
||||
for(i=0;i<xctx->instances;i++) {
|
||||
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);
|
||||
|
|
@ -176,7 +176,7 @@ void global_tedax_netlist(int global) /* netlister driver */
|
|||
warning_overlapped_symbols(0);
|
||||
/* preserve current level instance flags before descending hierarchy for netlisting, restore later */
|
||||
stored_flags = my_calloc(_ALLOC_ID_, xctx->instances, sizeof(unsigned int));
|
||||
for(i=0;i<xctx->instances;i++) stored_flags[i] = xctx->inst[i].color;
|
||||
for(i=0;i<xctx->instances; ++i) stored_flags[i] = xctx->inst[i].color;
|
||||
|
||||
if(global) /* was if(global) ... 20180901 no hierarchical tEDAx netlist for now */
|
||||
{
|
||||
|
|
@ -192,7 +192,7 @@ void global_tedax_netlist(int global) /* netlister driver */
|
|||
xctx->currsch++;
|
||||
|
||||
dbg(2, "global_tedax_netlist(): last defined symbol=%d\n",xctx->symbols);
|
||||
for(i=0;i<xctx->symbols;i++)
|
||||
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;
|
||||
|
|
@ -216,7 +216,7 @@ void global_tedax_netlist(int global) /* netlister driver */
|
|||
if(!xctx->hilight_nets) xctx->hilight_nets = saved_hilight_nets;
|
||||
}
|
||||
/* restore hilight flags from errors found analyzing top level before descending hierarchy */
|
||||
for(i=0;i<xctx->instances; i++) xctx->inst[i].color = stored_flags[i];
|
||||
for(i=0;i<xctx->instances; ++i) xctx->inst[i].color = stored_flags[i];
|
||||
propagate_hilights(1, 0, XINSERT_NOREPLACE);
|
||||
draw_hilight_net(1);
|
||||
my_free(_ALLOC_ID_, &stored_flags);
|
||||
|
|
|
|||
72
src/token.c
72
src/token.c
|
|
@ -48,7 +48,7 @@ void hash_all_names(void)
|
|||
char *upinst = NULL, *type = NULL;
|
||||
int_hash_free(&xctx->inst_table);
|
||||
int_hash_init(&xctx->inst_table, HASHSIZE);
|
||||
for(i=0; i<xctx->instances; i++) {
|
||||
for(i=0; i<xctx->instances; ++i) {
|
||||
if(xctx->inst[i].instname && xctx->inst[i].instname[0]) {
|
||||
my_strdup(_ALLOC_ID_, &type,(xctx->inst[i].ptr+ xctx->sym)->type);
|
||||
if(!type) continue;
|
||||
|
|
@ -112,7 +112,7 @@ void check_unique_names(int rename)
|
|||
int_hash_free(&xctx->inst_table);
|
||||
int_hash_init(&xctx->inst_table, HASHSIZE);
|
||||
first = 1;
|
||||
for(i=0;i<xctx->instances;i++) {
|
||||
for(i=0;i<xctx->instances; ++i) {
|
||||
if(xctx->inst[i].instname && xctx->inst[i].instname[0]) {
|
||||
my_strdup(_ALLOC_ID_, &type,(xctx->inst[i].ptr+ xctx->sym)->type);
|
||||
if(!type) continue;
|
||||
|
|
@ -164,7 +164,7 @@ int match_symbol(const char *name) /* never returns -1, if symbol not found loa
|
|||
int i,found;
|
||||
|
||||
found=0;
|
||||
for(i=0;i<xctx->symbols;i++)
|
||||
for(i=0;i<xctx->symbols; ++i)
|
||||
{
|
||||
/* dbg(1, "match_symbol(): name=%s, sym[i].name=%s\n",name, xctx->sym[i].name);*/
|
||||
if(xctx->x_strcmp(name, xctx->sym[i].name) == 0)
|
||||
|
|
@ -808,7 +808,7 @@ static void print_vhdl_primitive(FILE *fd, int inst) /* netlist primitives, 200
|
|||
Int_hashtable table = {NULL, 0};
|
||||
int first = 1;
|
||||
int_hash_init(&table, 37);
|
||||
for(i=0;i<no_of_pins;i++)
|
||||
for(i=0;i<no_of_pins; ++i)
|
||||
{
|
||||
char *prop = (xctx->inst[inst].ptr + xctx->sym)->rect[PINLAYER][i].prop_ptr;
|
||||
if(strcmp(get_tok_value(prop,"vhdl_ignore",0), "true")) {
|
||||
|
|
@ -824,7 +824,7 @@ static void print_vhdl_primitive(FILE *fd, int inst) /* netlist primitives, 200
|
|||
int_hash_free(&table);
|
||||
}
|
||||
else if(token[0]=='@' && token[1]=='@') { /* recognize single pins 15112003 */
|
||||
for(i=0;i<no_of_pins;i++) {
|
||||
for(i=0;i<no_of_pins; ++i) {
|
||||
xSymbol *ptr = xctx->inst[inst].ptr + xctx->sym;
|
||||
if(!strcmp( get_tok_value(ptr->rect[PINLAYER][i].prop_ptr,"name",0), token+2)) {
|
||||
if(strcmp(get_tok_value(ptr->rect[PINLAYER][i].prop_ptr,"vhdl_ignore",0), "true")) {
|
||||
|
|
@ -1227,7 +1227,7 @@ void print_vhdl_element(FILE *fd, int inst)
|
|||
dbg(2, "print_vhdl_element(): printing generic maps \n");
|
||||
|
||||
/* print generic map */
|
||||
for(i=0;i<no_of_generics;i++)
|
||||
for(i=0;i<no_of_generics; ++i)
|
||||
{
|
||||
my_strdup(_ALLOC_ID_, &generic_type,get_tok_value(
|
||||
(xctx->inst[inst].ptr + xctx->sym)->rect[GENERICLAYER][i].prop_ptr,"type",0));
|
||||
|
|
@ -1252,7 +1252,7 @@ void print_vhdl_element(FILE *fd, int inst)
|
|||
tmp=0;
|
||||
pinptr = (xctx->inst[inst].ptr + xctx->sym)->rect[PINLAYER];
|
||||
int_hash_init(&table, 37);
|
||||
for(i=0;i<no_of_pins;i++)
|
||||
for(i=0;i<no_of_pins; ++i)
|
||||
{
|
||||
if(strcmp(get_tok_value(pinptr[i].prop_ptr,"vhdl_ignore",0), "true")) {
|
||||
const char *name = get_tok_value(pinptr[i].prop_ptr, "name", 0);
|
||||
|
|
@ -1367,7 +1367,7 @@ void print_generic(FILE *fd, char *ent_or_comp, int symbol)
|
|||
}
|
||||
}
|
||||
|
||||
for(i=0;i<xctx->sym[symbol].rects[GENERICLAYER];i++)
|
||||
for(i=0;i<xctx->sym[symbol].rects[GENERICLAYER]; ++i)
|
||||
{
|
||||
my_strdup(_ALLOC_ID_, &generic_type,
|
||||
get_tok_value(xctx->sym[symbol].rect[GENERICLAYER][i].prop_ptr,"generic_type",0));
|
||||
|
|
@ -1489,7 +1489,7 @@ void print_tedax_subckt(FILE *fd, int symbol)
|
|||
|
||||
no_of_pins= xctx->sym[symbol].rects[PINLAYER];
|
||||
|
||||
for(i=0;i<no_of_pins;i++)
|
||||
for(i=0;i<no_of_pins; ++i)
|
||||
{
|
||||
if(strcmp(get_tok_value(xctx->sym[symbol].rect[PINLAYER][i].prop_ptr,"spice_ignore",0), "true")) {
|
||||
str_ptr=
|
||||
|
|
@ -1574,7 +1574,7 @@ void print_spice_subckt_nodes(FILE *fd, int symbol)
|
|||
else if(strcmp(token, "@pinlist")==0) {
|
||||
Int_hashtable table = {NULL, 0};
|
||||
int_hash_init(&table, 37);
|
||||
for(i=0;i<no_of_pins;i++)
|
||||
for(i=0;i<no_of_pins; ++i)
|
||||
{
|
||||
if(strcmp(get_tok_value(xctx->sym[symbol].rect[PINLAYER][i].prop_ptr,"spice_ignore",0), "true")) {
|
||||
const char *name = get_tok_value(xctx->sym[symbol].rect[PINLAYER][i].prop_ptr,"name",0);
|
||||
|
|
@ -1588,7 +1588,7 @@ void print_spice_subckt_nodes(FILE *fd, int symbol)
|
|||
}
|
||||
else if(token[0]=='@' && token[1]=='@') { /* recognize single pins 15112003 */
|
||||
char *prop=NULL;
|
||||
for(i = 0; i<no_of_pins; i++) {
|
||||
for(i = 0; i<no_of_pins; ++i) {
|
||||
prop = xctx->sym[symbol].rect[PINLAYER][i].prop_ptr;
|
||||
if(!strcmp(get_tok_value(prop, "name",0), token + 2)) break;
|
||||
}
|
||||
|
|
@ -1830,7 +1830,7 @@ int print_spice_element(FILE *fd, int inst)
|
|||
{ /* and node number: m1 n1 m2 n2 .... */
|
||||
Int_hashtable table = {NULL, 0};
|
||||
int_hash_init(&table, 37);
|
||||
for(i=0;i<no_of_pins;i++)
|
||||
for(i=0;i<no_of_pins; ++i)
|
||||
{
|
||||
char *prop = (xctx->inst[inst].ptr + xctx->sym)->rect[PINLAYER][i].prop_ptr;
|
||||
int spice_ignore = !strcmp(get_tok_value(prop, "spice_ignore", 0), "true");
|
||||
|
|
@ -1849,7 +1849,7 @@ int print_spice_element(FILE *fd, int inst)
|
|||
int_hash_free(&table);
|
||||
}
|
||||
else if(token[0]=='@' && token[1]=='@') { /* recognize single pins 15112003 */
|
||||
for(i=0;i<no_of_pins;i++) {
|
||||
for(i=0;i<no_of_pins; ++i) {
|
||||
char *prop = (xctx->inst[inst].ptr + xctx->sym)->rect[PINLAYER][i].prop_ptr;
|
||||
if (!strcmp( get_tok_value(prop,"name",0), token+2)) {
|
||||
if(strcmp(get_tok_value(prop,"spice_ignore",0), "true")) {
|
||||
|
|
@ -2016,14 +2016,14 @@ void print_tedax_element(FILE *fd, int inst)
|
|||
subcircuit = 1;
|
||||
fprintf(fd, "__subcircuit__ %s %s\n", skip_dir(xctx->inst[inst].name), xctx->inst[inst].instname);
|
||||
int_hash_init(&table, 37);
|
||||
for(i=0;i<no_of_pins; i++) {
|
||||
for(i=0;i<no_of_pins; ++i) {
|
||||
my_strdup2(_ALLOC_ID_, &net, net_name(inst,i, &net_mult, 0, 1));
|
||||
my_strdup2(_ALLOC_ID_, &pinname,
|
||||
get_tok_value((xctx->inst[inst].ptr + xctx->sym)->rect[PINLAYER][i].prop_ptr,"name",0));
|
||||
my_strdup2(_ALLOC_ID_, &pin, expandlabel(pinname, &pin_mult));
|
||||
if(!int_hash_lookup(&table, pinname, 1, XINSERT_NOREPLACE)) {
|
||||
dbg(1, "#net=%s pinname=%s pin=%s net_mult=%d pin_mult=%d\n", net, pinname, pin, net_mult, pin_mult);
|
||||
for(n = 0; n < net_mult; n++) {
|
||||
for(n = 0; n < net_mult; ++n) {
|
||||
my_strdup(_ALLOC_ID_, &netbit, find_nth(net, ",", n+1));
|
||||
my_strdup(_ALLOC_ID_, &pinbit, find_nth(pin, ",", n+1));
|
||||
fprintf(fd, "__map__ %s -> %s\n",
|
||||
|
|
@ -2053,7 +2053,7 @@ void print_tedax_element(FILE *fd, int inst)
|
|||
|
||||
if(!subcircuit) {
|
||||
fprintf(fd, "begin_inst %s numslots %s\n", name, numslots);
|
||||
for(i=0;i<no_of_pins; i++) {
|
||||
for(i=0;i<no_of_pins; ++i) {
|
||||
char *pinnumber;
|
||||
pinnumber = get_pin_attr_from_inst(inst, i, "pinnumber");
|
||||
if(!pinnumber) {
|
||||
|
|
@ -2095,7 +2095,7 @@ void print_tedax_element(FILE *fd, int inst)
|
|||
if(!extra_token_val[0]) extra_token_val="--UNDEF--";
|
||||
|
||||
fprintf(fd, "conn %s %s %s %s %d", name, extra_token_val, extra_token, extra_pinnumber_token, i+1);
|
||||
i++;
|
||||
++i;
|
||||
if(instance_based) fprintf(fd, " # instance_based");
|
||||
fprintf(fd,"\n");
|
||||
}
|
||||
|
|
@ -2177,7 +2177,7 @@ void print_tedax_element(FILE *fd, int inst)
|
|||
else if(strcmp(token,"@pinlist")==0)
|
||||
/* print multiplicity */
|
||||
{ /* and node number: m1 n1 m2 n2 .... */
|
||||
for(i=0;i<no_of_pins;i++)
|
||||
for(i=0;i<no_of_pins; ++i)
|
||||
{
|
||||
str_ptr = net_name(inst,i, &multip, 0, 1);
|
||||
/* fprintf(errfp, "inst: %s --> %s\n", name, str_ptr); */
|
||||
|
|
@ -2185,7 +2185,7 @@ void print_tedax_element(FILE *fd, int inst)
|
|||
}
|
||||
}
|
||||
else if(token[0]=='@' && token[1]=='@') { /* recognize single pins 15112003 */
|
||||
for(i=0;i<no_of_pins;i++) {
|
||||
for(i=0;i<no_of_pins; ++i) {
|
||||
if(!strcmp(
|
||||
get_tok_value((xctx->inst[inst].ptr + xctx->sym)->rect[PINLAYER][i].prop_ptr,"name",0),
|
||||
token+2
|
||||
|
|
@ -2416,7 +2416,7 @@ static void print_verilog_primitive(FILE *fd, int inst) /* netlist switch level
|
|||
Int_hashtable table = {NULL, 0};
|
||||
int first = 1;
|
||||
int_hash_init(&table, 37);
|
||||
for(i=0;i<no_of_pins;i++) {
|
||||
for(i=0;i<no_of_pins; ++i) {
|
||||
if(strcmp(get_tok_value(xctx->sym[symbol].rect[PINLAYER][i].prop_ptr,"verilog_ignore",0), "true")) {
|
||||
const char *name = get_tok_value(xctx->sym[symbol].rect[PINLAYER][i].prop_ptr,"name",0);
|
||||
if(!int_hash_lookup(&table, name, 1, XINSERT_NOREPLACE)) {
|
||||
|
|
@ -2430,7 +2430,7 @@ static void print_verilog_primitive(FILE *fd, int inst) /* netlist switch level
|
|||
int_hash_free(&table);
|
||||
}
|
||||
else if(token[0]=='@' && token[1]=='@') { /* recognize single pins 15112003 */
|
||||
for(i=0;i<no_of_pins;i++) {
|
||||
for(i=0;i<no_of_pins; ++i) {
|
||||
char *prop = (xctx->inst[inst].ptr + xctx->sym)->rect[PINLAYER][i].prop_ptr;
|
||||
if(!strcmp( get_tok_value(prop,"name",0), token+2)) {
|
||||
str_ptr = net_name(inst,i, &multip, 0, 1);
|
||||
|
|
@ -2589,7 +2589,7 @@ void print_verilog_element(FILE *fd, int inst)
|
|||
if(strcmp(token,"spice_ignore") && strcmp(token,"vhdl_ignore") && strcmp(token,"tedax_ignore")) {
|
||||
if(tmp == 0) {
|
||||
fprintf(fd, "#(\n---- start parameters\n");
|
||||
tmp++;
|
||||
++tmp;
|
||||
tmp1=0;
|
||||
}
|
||||
/* skip attributes of type time (delay="20 ns") that have VHDL syntax */
|
||||
|
|
@ -2626,7 +2626,7 @@ void print_verilog_element(FILE *fd, int inst)
|
|||
/* print port map */
|
||||
tmp=0;
|
||||
int_hash_init(&table, 37);
|
||||
for(i=0;i<no_of_pins;i++)
|
||||
for(i=0;i<no_of_pins; ++i)
|
||||
{
|
||||
xSymbol *ptr = xctx->inst[inst].ptr + xctx->sym;
|
||||
if(strcmp(get_tok_value(ptr->rect[PINLAYER][i].prop_ptr,"verilog_ignore",0), "true")) {
|
||||
|
|
@ -2691,7 +2691,7 @@ const char *net_name(int i, int j, int *multip, int hash_prefix_unnamed_net, int
|
|||
{
|
||||
my_strdup(_ALLOC_ID_, &pinname, get_tok_value( sym->rect[PINLAYER][j].prop_ptr,"name",0));
|
||||
/* before reporting unconnected pin try to locate duplicated pin and use it if found */
|
||||
for(k = 0; k < no_of_pins; k++) {
|
||||
for(k = 0; k < no_of_pins; ++k) {
|
||||
const char *duplicated_pinname;
|
||||
if(k == j) continue;
|
||||
duplicated_pinname = get_tok_value( sym->rect[PINLAYER][k].prop_ptr,"name",0);
|
||||
|
|
@ -2760,7 +2760,7 @@ int isonlydigit(const char *s)
|
|||
if(s == NULL || *s == '\0') return 0;
|
||||
while( (c = *s) ) {
|
||||
if(c < '0' || c > '9') return 0;
|
||||
s++;
|
||||
++s;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -2791,17 +2791,17 @@ char *find_nth(const char *str, const char *sep, int n)
|
|||
i = 0;
|
||||
while(result[i] && strchr(sep, result[i])) i++; /* strip off leading separators */
|
||||
ptr = result + i;
|
||||
for(count=1; result[i] != 0; i++) {
|
||||
for(count=1; result[i] != 0; ++i) {
|
||||
if(strchr(sep, result[i])) {
|
||||
result[i]=0;
|
||||
if(count==n) {
|
||||
dbg(1, "1 find_nth(): returning %s\n", ptr);
|
||||
return ptr;
|
||||
}
|
||||
i++;
|
||||
++i;
|
||||
while(result[i] && strchr(sep, result[i])) i++;
|
||||
ptr = result + i;
|
||||
count++;
|
||||
++count;
|
||||
}
|
||||
}
|
||||
if(count==n) {
|
||||
|
|
@ -2910,7 +2910,7 @@ const char *translate(int inst, const char* s)
|
|||
int i, multip;
|
||||
int no_of_pins= (xctx->inst[inst].ptr + xctx->sym)->rects[PINLAYER];
|
||||
prepare_netlist_structs(0);
|
||||
for(i=0;i<no_of_pins;i++) {
|
||||
for(i=0;i<no_of_pins; ++i) {
|
||||
char *prop = (xctx->inst[inst].ptr + xctx->sym)->rect[PINLAYER][i].prop_ptr;
|
||||
if (!strcmp( get_tok_value(prop,"name",0), token+2)) {
|
||||
if(strcmp(get_tok_value(prop,"spice_ignore",0), "true")) {
|
||||
|
|
@ -2935,7 +2935,7 @@ const char *translate(int inst, const char* s)
|
|||
n = atoi(pin_num_or_name);
|
||||
}
|
||||
else if(pin_num_or_name[0]) {
|
||||
for(n = 0 ; n < (xctx->inst[inst].ptr + xctx->sym)->rects[PINLAYER]; n++) {
|
||||
for(n = 0 ; n < (xctx->inst[inst].ptr + xctx->sym)->rects[PINLAYER]; ++n) {
|
||||
char *prop = (xctx->inst[inst].ptr + xctx->sym)->rect[PINLAYER][n].prop_ptr;
|
||||
if(!strcmp(get_tok_value(prop,"name",0), pin_num_or_name)) break;
|
||||
}
|
||||
|
|
@ -3067,7 +3067,7 @@ const char *translate(int inst, const char* s)
|
|||
/* skip path components that are above the level where raw file was loaded */
|
||||
while(*path && skip < start_level) {
|
||||
if(*path == '.') skip++;
|
||||
path++;
|
||||
++path;
|
||||
}
|
||||
prepare_netlist_structs(0);
|
||||
if(pin_prop_ptr) net = get_tok_value(pin_prop_ptr, "lab", 0);
|
||||
|
|
@ -3120,7 +3120,7 @@ const char *translate(int inst, const char* s)
|
|||
/* skip path components that are above the level where raw file was loaded */
|
||||
while(*path && skip < start_level) {
|
||||
if(*path == '.') skip++;
|
||||
path++;
|
||||
++path;
|
||||
}
|
||||
net = my_malloc(_ALLOC_ID_, tmp);
|
||||
n = sscanf(token + 19, "%[^)]", net);
|
||||
|
|
@ -3173,7 +3173,7 @@ const char *translate(int inst, const char* s)
|
|||
/* skip path components that are above the level where raw file was loaded */
|
||||
while(*path && skip < start_level) {
|
||||
if(*path == '.') skip++;
|
||||
path++;
|
||||
++path;
|
||||
}
|
||||
dev = my_malloc(_ALLOC_ID_, tmp);
|
||||
n = sscanf(token + 19, "%[^)]", dev);
|
||||
|
|
@ -3242,7 +3242,7 @@ const char *translate(int inst, const char* s)
|
|||
/* skip path components that are above the level where raw file was loaded */
|
||||
while(*path && skip < start_level) {
|
||||
if(*path == '.') skip++;
|
||||
path++;
|
||||
++path;
|
||||
}
|
||||
prepare_netlist_structs(0);
|
||||
net1 = net_name(inst, 0, &multip, 0, 0);
|
||||
|
|
@ -3305,7 +3305,7 @@ const char *translate(int inst, const char* s)
|
|||
/* skip path components that are above the level where raw file was loaded */
|
||||
while(*path && skip < start_level) {
|
||||
if(*path == '.') skip++;
|
||||
path++;
|
||||
++path;
|
||||
}
|
||||
my_strdup2(_ALLOC_ID_, &dev, xctx->inst[inst].instname);
|
||||
strtolower(dev);
|
||||
|
|
@ -3537,7 +3537,7 @@ const char *translate2(Lcc *lcc, int level, char* s)
|
|||
my_strdup2(_ALLOC_ID_, &path, "@path@name\\.");
|
||||
if(level > 1) { /* add parent LCC instance names (X1, Xinv etc) */
|
||||
int i;
|
||||
for(i = 1; i <level; i++) {
|
||||
for(i = 1; i <level; ++i) {
|
||||
const char *instname = get_tok_value(lcc[i].prop_ptr, "name", 0);
|
||||
my_strcat(_ALLOC_ID_, &path, instname);
|
||||
my_strcat(_ALLOC_ID_, &path, ".");
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ static 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;
|
||||
|
|
@ -122,7 +122,7 @@ void global_verilog_netlist(int global) /* netlister driver */
|
|||
|
||||
/* print verilog timescale 10102004 */
|
||||
fmt_attr = xctx->format ? xctx->format : "verilog_format";
|
||||
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;
|
||||
|
|
@ -156,7 +156,7 @@ void global_verilog_netlist(int global) /* netlister driver */
|
|||
/* 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;
|
||||
|
|
@ -167,14 +167,14 @@ void global_verilog_netlist(int global) /* netlister driver */
|
|||
if( type && (strcmp(type,"opin"))==0)
|
||||
{
|
||||
if(tmp) fprintf(fd, " ,\n");
|
||||
tmp++;
|
||||
++tmp;
|
||||
str_tmp = xctx->inst[i].lab ? xctx->inst[i].lab : "";
|
||||
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;
|
||||
|
|
@ -185,14 +185,14 @@ void global_verilog_netlist(int global) /* netlister driver */
|
|||
if( type && (strcmp(type,"iopin"))==0)
|
||||
{
|
||||
if(tmp) fprintf(fd, " ,\n");
|
||||
tmp++;
|
||||
++tmp;
|
||||
str_tmp = xctx->inst[i].lab ? xctx->inst[i].lab : "";
|
||||
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;
|
||||
|
|
@ -203,7 +203,7 @@ void global_verilog_netlist(int global) /* netlister driver */
|
|||
if( type && (strcmp(type,"ipin"))==0)
|
||||
{
|
||||
if(tmp) fprintf(fd, " ,\n");
|
||||
tmp++;
|
||||
++tmp;
|
||||
str_tmp = xctx->inst[i].lab ? xctx->inst[i].lab : "";
|
||||
fprintf(fd, " %s", str_tmp ? str_tmp : "<NULL>");
|
||||
}
|
||||
|
|
@ -224,7 +224,7 @@ 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;
|
||||
|
|
@ -247,7 +247,7 @@ 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;
|
||||
|
|
@ -270,7 +270,7 @@ 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;
|
||||
|
|
@ -297,7 +297,7 @@ void global_verilog_netlist(int global) /* netlister driver */
|
|||
xctx->netlist_count++;
|
||||
fprintf(fd,"---- begin user architecture code\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") ) {
|
||||
|
|
@ -333,7 +333,7 @@ void global_verilog_netlist(int global) /* netlister driver */
|
|||
warning_overlapped_symbols(0);
|
||||
/* preserve current level instance flags before descending hierarchy for netlisting, restore later */
|
||||
stored_flags = my_calloc(_ALLOC_ID_, xctx->instances, sizeof(unsigned int));
|
||||
for(i=0;i<xctx->instances;i++) stored_flags[i] = xctx->inst[i].color;
|
||||
for(i=0;i<xctx->instances; ++i) stored_flags[i] = xctx->inst[i].color;
|
||||
|
||||
if(global)
|
||||
{
|
||||
|
|
@ -350,7 +350,7 @@ void global_verilog_netlist(int global) /* netlister driver */
|
|||
|
||||
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;
|
||||
|
|
@ -385,7 +385,7 @@ void global_verilog_netlist(int global) /* netlister driver */
|
|||
if(!xctx->hilight_nets) xctx->hilight_nets = saved_hilight_nets;
|
||||
}
|
||||
/* restore hilight flags from errors found analyzing top level before descending hierarchy */
|
||||
for(i=0;i<xctx->instances; i++) xctx->inst[i].color = stored_flags[i];
|
||||
for(i=0;i<xctx->instances; ++i) xctx->inst[i].color = stored_flags[i];
|
||||
propagate_hilights(1, 0, XINSERT_NOREPLACE);
|
||||
draw_hilight_net(1);
|
||||
my_free(_ALLOC_ID_, &stored_flags);
|
||||
|
|
@ -460,7 +460,7 @@ void verilog_block_netlist(FILE *fd, int i)
|
|||
verilog_stop? load_schematic(0,filename, 0) : load_schematic(1,filename, 0);
|
||||
/* print verilog timescale and preprocessor directives 10102004 */
|
||||
fmt_attr = xctx->format ? xctx->format : "verilog_format";
|
||||
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;
|
||||
|
|
@ -499,13 +499,13 @@ void verilog_block_netlist(FILE *fd, int i)
|
|||
|
||||
/* print port list */
|
||||
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")) {
|
||||
const char *name = get_tok_value(xctx->sym[i].rect[PINLAYER][j].prop_ptr, "name", 0);
|
||||
if(!int_hash_lookup(&table, name, 1, XINSERT_NOREPLACE)) {
|
||||
if(tmp) fprintf(fd, " ,\n");
|
||||
tmp++;
|
||||
++tmp;
|
||||
fprintf(fd," %s", name);
|
||||
}
|
||||
}
|
||||
|
|
@ -518,7 +518,7 @@ void verilog_block_netlist(FILE *fd, int i)
|
|||
if(!extra_token) break;
|
||||
if(tmp) fprintf(fd, " ,\n");
|
||||
fprintf(fd, " %s", extra_token);
|
||||
tmp++;
|
||||
++tmp;
|
||||
}
|
||||
}
|
||||
fprintf(fd, "\n);\n");
|
||||
|
|
@ -528,7 +528,7 @@ void verilog_block_netlist(FILE *fd, int i)
|
|||
print_verilog_param(fd,i);
|
||||
/* print port types */
|
||||
int_hash_init(&table, 37);
|
||||
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")) {
|
||||
my_strdup(_ALLOC_ID_, &sig_type,get_tok_value(
|
||||
|
|
@ -565,7 +565,7 @@ void verilog_block_netlist(FILE *fd, int i)
|
|||
dbg(1, "verilog_block_netlist(): netlisting %s\n", skip_dir( xctx->sch[xctx->currsch]));
|
||||
verilog_netlist(fd, verilog_stop);
|
||||
fprintf(fd,"---- begin user architecture code\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,"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") ) {
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ static 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;
|
||||
|
|
@ -56,7 +56,7 @@ static 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;
|
||||
|
|
@ -75,7 +75,7 @@ static 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;
|
||||
|
|
@ -158,7 +158,7 @@ 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;
|
||||
|
|
@ -179,7 +179,7 @@ void global_vhdl_netlist(int global) /* netlister driver */
|
|||
}
|
||||
|
||||
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;
|
||||
|
|
@ -222,7 +222,7 @@ 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(xxx, &type,(xctx->inst[i].ptr+ xctx->sym)->type); */
|
||||
|
|
@ -248,7 +248,7 @@ 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;
|
||||
|
|
@ -269,7 +269,7 @@ 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;
|
||||
|
|
@ -290,7 +290,7 @@ 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;
|
||||
|
|
@ -312,7 +312,7 @@ 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;
|
||||
|
|
@ -333,7 +333,7 @@ void global_vhdl_netlist(int global) /* netlister driver */
|
|||
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;
|
||||
|
|
@ -357,7 +357,7 @@ void global_vhdl_netlist(int global) /* netlister driver */
|
|||
/* component ports */
|
||||
tmp=0;
|
||||
int_hash_init(&table, 37);
|
||||
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")) {
|
||||
my_strdup(_ALLOC_ID_, &sig_type,get_tok_value(
|
||||
|
|
@ -392,7 +392,7 @@ 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++) {
|
||||
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") ) {
|
||||
|
|
@ -427,7 +427,7 @@ void global_vhdl_netlist(int global) /* netlister driver */
|
|||
warning_overlapped_symbols(0);
|
||||
/* preserve current level instance flags before descending hierarchy for netlisting, restore later */
|
||||
stored_flags = my_calloc(_ALLOC_ID_, xctx->instances, sizeof(unsigned int));
|
||||
for(i=0;i<xctx->instances;i++) stored_flags[i] = xctx->inst[i].color;
|
||||
for(i=0;i<xctx->instances; ++i) stored_flags[i] = xctx->inst[i].color;
|
||||
|
||||
if(global)
|
||||
{
|
||||
|
|
@ -445,7 +445,7 @@ void global_vhdl_netlist(int global) /* netlister driver */
|
|||
|
||||
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;
|
||||
|
|
@ -481,7 +481,7 @@ void global_vhdl_netlist(int global) /* netlister driver */
|
|||
if(!xctx->hilight_nets) xctx->hilight_nets = saved_hilight_nets;
|
||||
}
|
||||
/* restore hilight flags from errors found analyzing top level before descending hierarchy */
|
||||
for(i=0;i<xctx->instances; i++) xctx->inst[i].color = stored_flags[i];
|
||||
for(i=0;i<xctx->instances; ++i) xctx->inst[i].color = stored_flags[i];
|
||||
propagate_hilights(1, 0, XINSERT_NOREPLACE);
|
||||
draw_hilight_net(1);
|
||||
my_free(_ALLOC_ID_, &stored_flags);
|
||||
|
|
@ -548,7 +548,7 @@ void vhdl_block_netlist(FILE *fd, int i)
|
|||
fprintf(fd, "-- sch_path: %s\n", filename);
|
||||
load_schematic(1,filename, 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;
|
||||
|
|
@ -561,7 +561,7 @@ void vhdl_block_netlist(FILE *fd, int i)
|
|||
}
|
||||
|
||||
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;
|
||||
|
|
@ -581,7 +581,7 @@ void vhdl_block_netlist(FILE *fd, int i)
|
|||
/* print entity ports */
|
||||
tmp=0;
|
||||
int_hash_init(&table, 37);
|
||||
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")) {
|
||||
my_strdup(_ALLOC_ID_, &sig_type,
|
||||
|
|
@ -607,7 +607,7 @@ 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;
|
||||
|
|
@ -631,7 +631,7 @@ void vhdl_block_netlist(FILE *fd, int i)
|
|||
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 &&
|
||||
|
|
@ -644,7 +644,7 @@ void vhdl_block_netlist(FILE *fd, int i)
|
|||
|
||||
/* 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;
|
||||
|
|
@ -662,7 +662,7 @@ void vhdl_block_netlist(FILE *fd, int i)
|
|||
/* component ports */
|
||||
tmp=0;
|
||||
int_hash_init(&table, 37);
|
||||
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")) {
|
||||
my_strdup(_ALLOC_ID_, &sig_type,get_tok_value(
|
||||
|
|
@ -694,7 +694,7 @@ void vhdl_block_netlist(FILE *fd, int i)
|
|||
vhdl_netlist(fd, vhdl_stop);
|
||||
fprintf(fd,"//// begin user architecture code\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") ) {
|
||||
|
|
|
|||
104
src/xinit.c
104
src/xinit.c
|
|
@ -126,7 +126,7 @@ static int window_state (Display *disp, Window win, char *arg) {/*{{{*/
|
|||
fputs("Invalid zero length property.\n", errfp);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
for( i = 0; p2[i]; i++) tmp2[i] = (char)toupper( p2[i] );
|
||||
for( i = 0; p2[i]; ++i) tmp2[i] = (char)toupper( p2[i] );
|
||||
tmp2[i] = '\0';
|
||||
my_snprintf(tmp_prop2, S(tmp_prop2), "_NET_WM_STATE_%s", tmp2);
|
||||
prop2 = XInternAtom(disp, tmp_prop2, False);
|
||||
|
|
@ -137,7 +137,7 @@ static int window_state (Display *disp, Window win, char *arg) {/*{{{*/
|
|||
fputs("Invalid zero length property.\n", errfp);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
for( i = 0; p1[i]; i++) tmp1[i] = (char)toupper( p1[i] );
|
||||
for( i = 0; p1[i]; ++i) tmp1[i] = (char)toupper( p1[i] );
|
||||
tmp1[i] = '\0';
|
||||
my_snprintf(tmp_prop1, S(tmp_prop1), "_NET_WM_STATE_%s", tmp1);
|
||||
prop1 = XInternAtom(disp, tmp_prop1, False);
|
||||
|
|
@ -224,7 +224,7 @@ static unsigned int find_best_color(char colorname[])
|
|||
|
||||
if( XAllocNamedColor(display, colormap, colorname, &xcolor_exact, &xcolor) ==0 )
|
||||
{
|
||||
for(i=0;i<=255;i++) {
|
||||
for(i=0;i<=255; ++i) {
|
||||
xctx->xcolor_array[i].pixel=i;
|
||||
XQueryColor(display, colormap, xctx->xcolor_array+i);
|
||||
}
|
||||
|
|
@ -233,7 +233,7 @@ static unsigned int find_best_color(char colorname[])
|
|||
XLookupColor(display, colormap, colorname, &xcolor_exact, &xcolor);
|
||||
red = xcolor.red; green = xcolor.green; blue = xcolor.blue;
|
||||
idx=0;
|
||||
for(i = 0;i<=255; i++)
|
||||
for(i = 0;i<=255; ++i)
|
||||
{
|
||||
r = xctx->xcolor_array[i].red ; g = xctx->xcolor_array[i].green ; b = xctx->xcolor_array[i].blue;
|
||||
deltar = (r - red);deltag = (g - green);deltab = (b - blue);
|
||||
|
|
@ -268,7 +268,7 @@ static void init_color_array(double dim, double dim_bg)
|
|||
unsigned int r, g, b;
|
||||
double tmp_dim;
|
||||
|
||||
for(i=0;i<cadlayers;i++) {
|
||||
for(i=0;i<cadlayers; ++i) {
|
||||
my_snprintf(s, S(s), "lindex $colors %d",i);
|
||||
tcleval(s);
|
||||
dbg(2, "init_color_array(): color:%s\n",tclresult());
|
||||
|
|
@ -297,9 +297,9 @@ static void init_color_array(double dim, double dim_bg)
|
|||
static void init_pixdata()/* populate xctx->fill_type array that is used in create_gc() to set fill styles */
|
||||
{
|
||||
int i,j, full, empty;
|
||||
for(i=0;i<cadlayers;i++) {
|
||||
for(i=0;i<cadlayers; ++i) {
|
||||
full=1; empty=1;
|
||||
for(j=0;j<32;j++) {
|
||||
for(j=0;j<32; ++j) {
|
||||
if(i<sizeof(pixdata_init)/sizeof(pixdata_init[0]))
|
||||
pixdata[i][j] = pixdata_init[i][j];
|
||||
else
|
||||
|
|
@ -329,13 +329,13 @@ static void free_xschem_data()
|
|||
my_free(_ALLOC_ID_, &xctx->wire);
|
||||
my_free(_ALLOC_ID_, &xctx->text);
|
||||
my_free(_ALLOC_ID_, &xctx->inst);
|
||||
for(i=0;i<cadlayers;i++) {
|
||||
for(i=0;i<cadlayers; ++i) {
|
||||
my_free(_ALLOC_ID_, &xctx->rect[i]);
|
||||
my_free(_ALLOC_ID_, &xctx->line[i]);
|
||||
my_free(_ALLOC_ID_, &xctx->poly[i]);
|
||||
my_free(_ALLOC_ID_, &xctx->arc[i]);
|
||||
}
|
||||
for(i=0;i<xctx->maxs;i++) {
|
||||
for(i=0;i<xctx->maxs; ++i) {
|
||||
my_free(_ALLOC_ID_, &xctx->sym[i].line);
|
||||
my_free(_ALLOC_ID_, &xctx->sym[i].rect);
|
||||
my_free(_ALLOC_ID_, &xctx->sym[i].arc);
|
||||
|
|
@ -359,7 +359,7 @@ static void free_xschem_data()
|
|||
my_free(_ALLOC_ID_, &xctx->maxa);
|
||||
my_free(_ALLOC_ID_, &xctx->maxl);
|
||||
my_free(_ALLOC_ID_, &xctx->sel_array);
|
||||
for(i=0;i<CADMAXHIER;i++) {
|
||||
for(i=0;i<CADMAXHIER; ++i) {
|
||||
if(xctx->sch_path[i]) my_free(_ALLOC_ID_, &xctx->sch_path[i]);
|
||||
if(xctx->hier_attr[i].templ) my_free(_ALLOC_ID_, &xctx->hier_attr[i].templ);
|
||||
if(xctx->hier_attr[i].prop_ptr) my_free(_ALLOC_ID_, &xctx->hier_attr[i].prop_ptr);
|
||||
|
|
@ -370,7 +370,7 @@ static void free_xschem_data()
|
|||
my_free(_ALLOC_ID_, &xctx->biggridpoint);
|
||||
my_free(_ALLOC_ID_, &xctx->gc);
|
||||
my_free(_ALLOC_ID_, &xctx->gcstipple);
|
||||
for(i=0;i<cadlayers;i++) my_free(_ALLOC_ID_, &xctx->color_array[i]);
|
||||
for(i=0;i<cadlayers; ++i) my_free(_ALLOC_ID_, &xctx->color_array[i]);
|
||||
my_free(_ALLOC_ID_, &xctx->color_array);
|
||||
my_free(_ALLOC_ID_, &xctx->enable_layer);
|
||||
my_free(_ALLOC_ID_, &xctx->active_layer);
|
||||
|
|
@ -385,7 +385,7 @@ static void free_xschem_data()
|
|||
static void create_gc(void)
|
||||
{
|
||||
int i;
|
||||
for(i=0;i<cadlayers;i++)
|
||||
for(i=0;i<cadlayers; ++i)
|
||||
{
|
||||
pixmap[i] = XCreateBitmapFromData(display, xctx->window, (char*)(pixdata[i]),16,16);
|
||||
xctx->gc[i] = XCreateGC(display,xctx->window,0L,NULL);
|
||||
|
|
@ -399,7 +399,7 @@ static void create_gc(void)
|
|||
static void free_gc()
|
||||
{
|
||||
int i;
|
||||
for(i=0;i<cadlayers;i++) {
|
||||
for(i=0;i<cadlayers; ++i) {
|
||||
XFreeGC(display,xctx->gc[i]);
|
||||
XFreeGC(display,xctx->gcstipple[i]);
|
||||
}
|
||||
|
|
@ -491,8 +491,8 @@ static void alloc_xschem_data(const char *top_path, const char *win_path)
|
|||
xctx->plotfile[0] = '\0';
|
||||
xctx->netlist_unconn_cnt = 0; /* unique count of unconnected pins while netlisting */
|
||||
xctx->current_dirname[0] = '\0';
|
||||
for(i = 0; i < NBOXES; i++) {
|
||||
for(j = 0; j < NBOXES; j++) {
|
||||
for(i = 0; i < NBOXES; ++i) {
|
||||
for(j = 0; j < NBOXES; ++j) {
|
||||
xctx->instpin_spatial_table[i][j] = NULL;
|
||||
xctx->wire_spatial_table[i][j] = NULL;
|
||||
xctx->inst_spatial_table[i][j] = NULL;
|
||||
|
|
@ -542,7 +542,7 @@ static void alloc_xschem_data(const char *top_path, const char *win_path)
|
|||
xctx->hilight_time = 0; /* timestamp for sims */
|
||||
xctx->hilight_nets = 0;
|
||||
xctx->hilight_color = 0;
|
||||
for(i=0;i<CADMAXHIER;i++) {
|
||||
for(i=0;i<CADMAXHIER; ++i) {
|
||||
xctx->sch[i][0] = '\0';
|
||||
xctx->sch_path[i]=NULL;
|
||||
xctx->sch_path_hash[i]=0;
|
||||
|
|
@ -561,7 +561,7 @@ static void alloc_xschem_data(const char *top_path, const char *win_path)
|
|||
xctx->wire=my_calloc(_ALLOC_ID_, xctx->maxw,sizeof(xWire));
|
||||
xctx->inst=my_calloc(_ALLOC_ID_, xctx->maxi , sizeof(xInstance) );
|
||||
xctx->sym=my_calloc(_ALLOC_ID_, xctx->maxs , sizeof(xSymbol) );
|
||||
for(i=0;i<xctx->maxs;i++) {
|
||||
for(i=0;i<xctx->maxs; ++i) {
|
||||
xctx->sym[i].line=my_calloc(_ALLOC_ID_, cadlayers, sizeof(xLine *));
|
||||
xctx->sym[i].poly=my_calloc(_ALLOC_ID_, cadlayers, sizeof(xPoly *));
|
||||
xctx->sym[i].arc=my_calloc(_ALLOC_ID_, cadlayers, sizeof(xArc *));
|
||||
|
|
@ -575,7 +575,7 @@ static void alloc_xschem_data(const char *top_path, const char *win_path)
|
|||
xctx->maxa=my_calloc(_ALLOC_ID_, cadlayers, sizeof(int));
|
||||
xctx->maxp=my_calloc(_ALLOC_ID_, cadlayers, sizeof(int));
|
||||
xctx->maxl=my_calloc(_ALLOC_ID_, cadlayers, sizeof(int));
|
||||
for(i=0;i<cadlayers;i++)
|
||||
for(i=0;i<cadlayers; ++i)
|
||||
{
|
||||
xctx->maxr[i]=CADMAXOBJECTS;
|
||||
xctx->maxp[i]=CADMAXOBJECTS;
|
||||
|
|
@ -586,7 +586,7 @@ static void alloc_xschem_data(const char *top_path, const char *win_path)
|
|||
xctx->line=my_calloc(_ALLOC_ID_, cadlayers, sizeof(xLine *));
|
||||
xctx->poly=my_calloc(_ALLOC_ID_, cadlayers, sizeof(xPoly *));
|
||||
xctx->arc=my_calloc(_ALLOC_ID_, cadlayers, sizeof(xArc *));
|
||||
for(i=0;i<cadlayers;i++)
|
||||
for(i=0;i<cadlayers; ++i)
|
||||
{
|
||||
xctx->rect[i]=my_calloc(_ALLOC_ID_, xctx->maxr[i],sizeof(xRect));
|
||||
xctx->arc[i]=my_calloc(_ALLOC_ID_, xctx->maxa[i],sizeof(xArc));
|
||||
|
|
@ -695,7 +695,7 @@ int compare_schematics(const char *f)
|
|||
}
|
||||
|
||||
/* HASH SCHEMATIC 1 */
|
||||
for(i = 0; i < xctx->instances; i++) {
|
||||
for(i = 0; i < xctx->instances; ++i) {
|
||||
l = 1024 + strlen(xctx->inst[i].prop_ptr ? xctx->inst[i].prop_ptr : "");
|
||||
my_realloc(_ALLOC_ID_, &s, l);
|
||||
my_snprintf(s, l, "C %s %g %g %d %d %s", xctx->inst[i].name,
|
||||
|
|
@ -703,7 +703,7 @@ int compare_schematics(const char *f)
|
|||
xctx->inst[i].prop_ptr ? xctx->inst[i].prop_ptr : "");
|
||||
int_hash_lookup(&table1, s, i, XINSERT_NOREPLACE);
|
||||
}
|
||||
for(i=0;i<xctx->wires;i++)
|
||||
for(i=0;i<xctx->wires; ++i)
|
||||
{
|
||||
l =1024 + strlen(xctx->wire[i].prop_ptr ? xctx->wire[i].prop_ptr : "");
|
||||
my_realloc(_ALLOC_ID_, &s, l);
|
||||
|
|
@ -757,7 +757,7 @@ int compare_schematics(const char *f)
|
|||
load_schematic(1, xctx->sch_to_compare, 0); /* last param to 0, do not alter window title */
|
||||
|
||||
/* HASH SCHEMATIC 2 , CHECK SCHEMATIC 2 WITH SCHEMATIC 1 */
|
||||
for(i = 0; i < xctx->instances; i++) {
|
||||
for(i = 0; i < xctx->instances; ++i) {
|
||||
l = 1024 + strlen(xctx->inst[i].prop_ptr ? xctx->inst[i].prop_ptr : "");
|
||||
my_realloc(_ALLOC_ID_, &s, l);
|
||||
my_snprintf(s, l, "C %s %g %g %d %d %s", xctx->inst[i].name,
|
||||
|
|
@ -773,7 +773,7 @@ int compare_schematics(const char *f)
|
|||
ret = 1;
|
||||
}
|
||||
}
|
||||
for(i=0;i<xctx->wires;i++)
|
||||
for(i=0;i<xctx->wires; ++i)
|
||||
{
|
||||
l =1024 + strlen(xctx->wire[i].prop_ptr ? xctx->wire[i].prop_ptr : "");
|
||||
my_realloc(_ALLOC_ID_, &s, l);
|
||||
|
|
@ -803,7 +803,7 @@ int compare_schematics(const char *f)
|
|||
xctx = save_xctx;
|
||||
|
||||
/* CHECK SCHEMATIC 1 WITH SCHEMATIC 2*/
|
||||
for(i = 0; i < xctx->instances; i++) {
|
||||
for(i = 0; i < xctx->instances; ++i) {
|
||||
l = 1024 + strlen(xctx->inst[i].prop_ptr ? xctx->inst[i].prop_ptr : "");
|
||||
my_realloc(_ALLOC_ID_,&s, l);
|
||||
my_snprintf(s, l, "C %s %g %g %d %d %s", xctx->inst[i].name,
|
||||
|
|
@ -816,7 +816,7 @@ int compare_schematics(const char *f)
|
|||
ret = 1;
|
||||
}
|
||||
}
|
||||
for(i=0;i<xctx->wires;i++)
|
||||
for(i=0;i<xctx->wires; ++i)
|
||||
{
|
||||
l = 1024 + strlen(xctx->wire[i].prop_ptr ? xctx->wire[i].prop_ptr : "");
|
||||
my_realloc(_ALLOC_ID_, &s, l);
|
||||
|
|
@ -859,16 +859,16 @@ static void xwin_exit(void)
|
|||
if (cad_icon_pixmap) Tk_FreePixmap(display, cad_icon_pixmap);
|
||||
#endif
|
||||
#ifdef __unix__
|
||||
for(i = 0; i < cadlayers; i++) XFreePixmap(display,pixmap[i]);
|
||||
for(i = 0; i < cadlayers; ++i) XFreePixmap(display,pixmap[i]);
|
||||
#else
|
||||
for(i = 0; i < cadlayers; i++) Tk_FreePixmap(display, pixmap[i]);
|
||||
for(i = 0; i < cadlayers; ++i) Tk_FreePixmap(display, pixmap[i]);
|
||||
#endif
|
||||
my_free(_ALLOC_ID_, &pixmap);
|
||||
}
|
||||
dbg(1, "xwin_exit(): clearing drawing data structures\n");
|
||||
|
||||
/* global context - graphic preferences/settings */
|
||||
for(i=0;i<cadlayers;i++) {
|
||||
for(i=0;i<cadlayers; ++i) {
|
||||
my_free(_ALLOC_ID_, &pixdata[i]);
|
||||
}
|
||||
my_free(_ALLOC_ID_, &pixdata);
|
||||
|
|
@ -885,14 +885,14 @@ static void xwin_exit(void)
|
|||
tcl_hook2(NULL); /* clear static data in function */
|
||||
save_ascii_string(NULL, NULL, 0); /* clear static data in function */
|
||||
dbg(1, "xwin_exit(): removing font\n");
|
||||
for(i=0;i<127;i++) my_free(_ALLOC_ID_, &character[i]);
|
||||
for(i=0;i<127; ++i) my_free(_ALLOC_ID_, &character[i]);
|
||||
dbg(1, "xwin_exit(): closed display\n");
|
||||
my_strncpy(cli_opt_filename, "", S(cli_opt_filename));
|
||||
my_free(_ALLOC_ID_, &xschem_executable);
|
||||
record_global_node(2, NULL, NULL); /* delete global node array */
|
||||
dbg(1, "xwin_exit(): deleted undo buffer\n");
|
||||
/* delete cmdline stuff */
|
||||
for(i = 0 ; i < cli_opt_argc; i++) {
|
||||
for(i = 0 ; i < cli_opt_argc; ++i) {
|
||||
my_free(_ALLOC_ID_, &cli_opt_argv[i]);
|
||||
}
|
||||
my_free(_ALLOC_ID_, &cli_opt_argv);
|
||||
|
|
@ -927,7 +927,7 @@ static void xwin_exit(void)
|
|||
* XAllocNamedColor fails to find the requested "color_array[i]".
|
||||
* When all xctx->color_index[] are populated with pixel values xctx->xcolor_array[]
|
||||
* is reset with the xschem layer colors in build_colors() using XLookupColor():
|
||||
* for(i=0;i<cadlayers;i++) {
|
||||
* for(i=0;i<cadlayers; ++i) {
|
||||
* XLookupColor(display, colormap, xctx->color_array[i], &xcolor_exact, &xcolor);
|
||||
* xctx->xcolor_array[i] = xcolor;
|
||||
* }
|
||||
|
|
@ -959,17 +959,17 @@ int build_colors(double dim, double dim_bg)
|
|||
tcleval("regsub -all {#} $svg_colors {0x} svg_colors");
|
||||
}
|
||||
init_color_array(dim, dim_bg);
|
||||
for(i=0;i<cadlayers;i++)
|
||||
for(i=0;i<cadlayers; ++i)
|
||||
{
|
||||
xctx->color_index[i] = find_best_color(xctx->color_array[i]);
|
||||
}
|
||||
for(i=0;i<cadlayers;i++)
|
||||
for(i=0;i<cadlayers; ++i)
|
||||
{
|
||||
XSetBackground(display, xctx->gc[i], xctx->color_index[0]); /* for dashed lines 'off' color */
|
||||
XSetForeground(display, xctx->gc[i], xctx->color_index[i]);
|
||||
XSetForeground(display, xctx->gcstipple[i], xctx->color_index[i]);
|
||||
}
|
||||
for(i=0;i<cadlayers;i++) {
|
||||
for(i=0;i<cadlayers; ++i) {
|
||||
#ifdef __unix__
|
||||
XLookupColor(display, colormap, xctx->color_array[i], &xcolor_exact, &xcolor);
|
||||
xctx->xcolor_array[i] = xcolor;
|
||||
|
|
@ -987,7 +987,7 @@ void set_clip_mask(int what)
|
|||
{
|
||||
int i;
|
||||
if(what == SET) {
|
||||
for(i=0;i<cadlayers;i++)
|
||||
for(i=0;i<cadlayers; ++i)
|
||||
{
|
||||
XSetClipRectangles(display, xctx->gc[i], 0,0, xctx->xrect, 1, Unsorted);
|
||||
XSetClipRectangles(display, xctx->gcstipple[i], 0,0, xctx->xrect, 1, Unsorted);
|
||||
|
|
@ -1002,7 +1002,7 @@ void set_clip_mask(int what)
|
|||
cairo_clip(xctx->cairo_save_ctx);
|
||||
#endif
|
||||
} else if(what == END) {
|
||||
for(i=0;i<cadlayers;i++)
|
||||
for(i=0;i<cadlayers; ++i)
|
||||
{
|
||||
XSetClipMask(display, xctx->gc[i], None);
|
||||
XSetClipMask(display, xctx->gcstipple[i], None);
|
||||
|
|
@ -1126,7 +1126,7 @@ void preview_window(const char *what, const char *win_path, const char *fname)
|
|||
/* avoid reentrant calls for example if an alert box is displayed while loading file to preview,
|
||||
* and an Expose event calls another preview draw */
|
||||
if(semaphore) return;
|
||||
semaphore++;
|
||||
++semaphore;
|
||||
dbg(1, "------\n");
|
||||
if(!strcmp(what, "create")) {
|
||||
dbg(1, "preview_window() create, save ctx, win_path=%s\n", win_path);
|
||||
|
|
@ -1183,7 +1183,7 @@ int check_loaded(const char *f, char *win_path)
|
|||
int i;
|
||||
Xschem_ctx *ctx;
|
||||
int found = 0;
|
||||
for(i = 0; i < MAX_NEW_WINDOWS; i++) {
|
||||
for(i = 0; i < MAX_NEW_WINDOWS; ++i) {
|
||||
ctx = save_xctx[i];
|
||||
dbg(1, "window_count=%d i=%d\n", window_count, i);
|
||||
/* if only one schematic it is not yet saved in save_xctx */
|
||||
|
|
@ -1220,7 +1220,7 @@ static void switch_window(int *window_count, const char *win_path)
|
|||
tkwin = Tk_NameToWindow(interp, win_path, mainwindow); /* NULL if win_path not existing */
|
||||
if(!tkwin) dbg(0, "new_schematic(\"switch_win\",...): Warning: %s has been destroyed\n", win_path);
|
||||
n = -1;
|
||||
if(tkwin) for(i = 0; i < MAX_NEW_WINDOWS; i++) {
|
||||
if(tkwin) for(i = 0; i < MAX_NEW_WINDOWS; ++i) {
|
||||
if(!strcmp(win_path, window_path[i])) {
|
||||
n = i;
|
||||
break;
|
||||
|
|
@ -1247,7 +1247,7 @@ static void switch_tab(int *window_count, const char *win_path)
|
|||
if(*window_count) {
|
||||
dbg(1, "new_schematic() switch_tab: %s\n", win_path);
|
||||
n = -1;
|
||||
for(i = 0; i < MAX_NEW_WINDOWS; i++) {
|
||||
for(i = 0; i < MAX_NEW_WINDOWS; ++i) {
|
||||
if(!strcmp(win_path, window_path[i])) {
|
||||
n = i;
|
||||
break;
|
||||
|
|
@ -1297,7 +1297,7 @@ static void create_new_window(int *window_count, const char *fname)
|
|||
}
|
||||
}
|
||||
if(*window_count == 0) {
|
||||
for(i = 0; i < MAX_NEW_WINDOWS; i++) {
|
||||
for(i = 0; i < MAX_NEW_WINDOWS; ++i) {
|
||||
save_xctx[i] = NULL;
|
||||
my_strncpy(window_path[i], "", S(window_path[i]));
|
||||
}
|
||||
|
|
@ -1314,7 +1314,7 @@ static void create_new_window(int *window_count, const char *fname)
|
|||
tclvareval("[xschem get top_path].menubar.simulate configure -bg $simulate_bg", NULL);
|
||||
tcleval(".menubar.view.menu entryconfigure {Tabbed interface} -state disabled");
|
||||
n = -1;
|
||||
for(i = 1; i < MAX_NEW_WINDOWS; i++) { /* search 1st free slot */
|
||||
for(i = 1; i < MAX_NEW_WINDOWS; ++i) { /* search 1st free slot */
|
||||
if(save_xctx[i] == NULL) {
|
||||
n = i;
|
||||
break;
|
||||
|
|
@ -1389,7 +1389,7 @@ static void create_new_tab(int *window_count, const char *fname)
|
|||
}
|
||||
}
|
||||
if(*window_count == 0) {
|
||||
for(i = 0; i < MAX_NEW_WINDOWS; i++) {
|
||||
for(i = 0; i < MAX_NEW_WINDOWS; ++i) {
|
||||
save_xctx[i] = NULL;
|
||||
my_strncpy(window_path[i], "", S(window_path[i]));
|
||||
}
|
||||
|
|
@ -1405,7 +1405,7 @@ static void create_new_tab(int *window_count, const char *fname)
|
|||
tclvareval("[xschem get top_path].menubar.simulate configure -bg $simulate_bg", NULL);
|
||||
tcleval(".menubar.view.menu entryconfigure {Tabbed interface} -state disabled");
|
||||
n = -1;
|
||||
for(i = 1; i < MAX_NEW_WINDOWS; i++) { /* search 1st free slot */
|
||||
for(i = 1; i < MAX_NEW_WINDOWS; ++i) { /* search 1st free slot */
|
||||
if(save_xctx[i] == NULL) {
|
||||
n = i;
|
||||
break;
|
||||
|
|
@ -1473,7 +1473,7 @@ static void destroy_window(int *window_count, const char *win_path)
|
|||
tkwin = Tk_NameToWindow(interp, win_path, mainwindow); /* NULL if win_path not existing */
|
||||
if(!tkwin) dbg(0, "new_schematic(\"destroy\", ...): Warning: %s has been destroyed\n", win_path);
|
||||
n = -1;
|
||||
if(tkwin) for(i = 1; i < MAX_NEW_WINDOWS; i++) {
|
||||
if(tkwin) for(i = 1; i < MAX_NEW_WINDOWS; ++i) {
|
||||
if(!strcmp(win_path, window_path[i])) {
|
||||
n = i;
|
||||
break;
|
||||
|
|
@ -1529,7 +1529,7 @@ static void destroy_tab(int *window_count, const char *win_path)
|
|||
Tcl_ResetResult(interp);
|
||||
if(close) {
|
||||
n = -1;
|
||||
for(i = 1; i < MAX_NEW_WINDOWS; i++) {
|
||||
for(i = 1; i < MAX_NEW_WINDOWS; ++i) {
|
||||
if(!strcmp(win_path, window_path[i])) {
|
||||
n = i;
|
||||
break;
|
||||
|
|
@ -1574,7 +1574,7 @@ static void destroy_all_windows(int *window_count)
|
|||
if(*window_count) {
|
||||
int close;
|
||||
dbg(1, "new_schematic() destroy_all\n");
|
||||
for(i = 1; i < MAX_NEW_WINDOWS; i++) {
|
||||
for(i = 1; i < MAX_NEW_WINDOWS; ++i) {
|
||||
if(window_path[i][0]) {
|
||||
tkwin = Tk_NameToWindow(interp, window_path[i], mainwindow); /* NULL if win_path not existing */
|
||||
if(!tkwin) dbg(0, "new_schematic(\"switch\",...): Warning: %s has been destroyed\n", window_path[i]);
|
||||
|
|
@ -1622,7 +1622,7 @@ static void destroy_all_tabs(int *window_count)
|
|||
if(*window_count) {
|
||||
int close;
|
||||
dbg(1, "new_schematic() destroy_all_tabs\n");
|
||||
for(i = 1; i < MAX_NEW_WINDOWS; i++) {
|
||||
for(i = 1; i < MAX_NEW_WINDOWS; ++i) {
|
||||
if(window_path[i][0]) {
|
||||
xctx = save_xctx[i];
|
||||
close = 0;
|
||||
|
|
@ -1720,7 +1720,7 @@ void change_linewidth(double w)
|
|||
if(has_x) {
|
||||
linew = INT_WIDTH(xctx->lw);
|
||||
dbg(1, "Line width = %d\n", linew);
|
||||
for(i=0;i<cadlayers;i++) {
|
||||
for(i=0;i<cadlayers; ++i) {
|
||||
XSetLineAttributes (display, xctx->gc[i], linew, LineSolid, LINECAP , LINEJOIN);
|
||||
}
|
||||
XSetLineAttributes (display, xctx->gctiled, linew, LineSolid, LINECAP , LINEJOIN);
|
||||
|
|
@ -2250,7 +2250,7 @@ int Tcl_AppInit(Tcl_Interp *inter)
|
|||
|
||||
/* global context / graphic preferences/settings */
|
||||
pixdata=my_calloc(_ALLOC_ID_, cadlayers, sizeof(char*));
|
||||
for(i=0;i<cadlayers;i++)
|
||||
for(i=0;i<cadlayers; ++i)
|
||||
{
|
||||
pixdata[i]=my_calloc(_ALLOC_ID_, 32, sizeof(char));
|
||||
}
|
||||
|
|
@ -2296,7 +2296,7 @@ int Tcl_AppInit(Tcl_Interp *inter)
|
|||
my_strncpy(xctx->file_version, XSCHEM_FILE_VERSION, S(xctx->file_version));
|
||||
/* compile_font() needs enabled layers, these are set after xschem.tcl loading completed
|
||||
* so we temporarily enable all them here */
|
||||
for(i = 0; i < cadlayers; i++) xctx->enable_layer[i] = 1;
|
||||
for(i = 0; i < cadlayers; ++i) xctx->enable_layer[i] = 1;
|
||||
compile_font();
|
||||
/* restore current dir after loading font */
|
||||
if(getenv("PWD")) {
|
||||
|
|
@ -2575,7 +2575,7 @@ int Tcl_AppInit(Tcl_Interp *inter)
|
|||
}
|
||||
|
||||
/* load additional files */
|
||||
if(has_x) for(i = 2; i < cli_opt_argc; i++) {
|
||||
if(has_x) for(i = 2; i < cli_opt_argc; ++i) {
|
||||
tclvareval("xschem load_new_window ", cli_opt_argv[i], NULL);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue