clear_schematic(): clear xctx->sch[..] name before assigning untitled.sch / untitled.sym path name

This commit is contained in:
stefan schippers 2023-09-12 23:16:32 +02:00
parent 55fcf5d28e
commit afd25cf430
2 changed files with 28 additions and 1 deletions

View File

@ -1944,6 +1944,7 @@ void clear_schematic(int cancel, int symbol)
else my_snprintf(name, S(name), "%s-%d.sym", "untitled", i);
if(stat(name, &buf)) break;
}
my_free(_ALLOC_ID_, &xctx->sch[xctx->currsch]);
my_mstrcat(_ALLOC_ID_, &xctx->sch[xctx->currsch], pwd_dir, "/", name, NULL);
my_strncpy(xctx->current_name, name, S(xctx->current_name));
} else {
@ -1954,6 +1955,7 @@ void clear_schematic(int cancel, int symbol)
else my_snprintf(name, S(name), "%s-%d.sch", "untitled", i);
if(stat(name, &buf)) break;
}
my_free(_ALLOC_ID_, &xctx->sch[xctx->currsch]);
my_mstrcat(_ALLOC_ID_, &xctx->sch[xctx->currsch], pwd_dir, "/", name, NULL);
my_strncpy(xctx->current_name, name, S(xctx->current_name));
}

View File

@ -80,6 +80,31 @@ static void check_connected_wire(int stop_at_junction, int n)
}
}
#if 0
int select_dangling_labels(void)
{
int i;
char * type;
for(i = 0; i < xctx->instances; i++) {
type = (xctx->inst[i].ptr+ xctx->sym)->type;
if( type && (IS_LABEL_SH_OR_PIN(type) || !strcmp(type, "probe") )) {
double x0, y0;
int sqx, sqy;
xRect *rct;
Wireentry *wptr;
rct = (xctx->inst[i].ptr+ xctx->sym)->rect[PINLAYER];
if(rct) {
get_inst_pin_coord(i, 0, &x0, &y0);
get_square(x0, y0, &sqx, &sqy);
wptr = xctx->wire_spatial_table[sqx][sqy];
}
}
}
return 0;
}
#endif
/* stop_at_junction==1 --> stop selecting wires at 'T' junctions */
void select_connected_wires(int stop_at_junction)
{
@ -98,7 +123,7 @@ void select_connected_wires(int stop_at_junction)
break;
case ELEMENT:
type = (xctx->inst[i].ptr+ xctx->sym)->type;
if( type && (IS_LABEL_SH_OR_PIN(type) || !strcmp(type, "probe") || !strcmp(type, "ngprobe"))) {
if( type && (IS_LABEL_SH_OR_PIN(type) || !strcmp(type, "probe") )) {
double x0, y0;
int sqx, sqy;
xRect *rct;