diff --git a/src/actions.c b/src/actions.c index 9de30ca5..effe8ca0 100644 --- a/src/actions.c +++ b/src/actions.c @@ -1573,6 +1573,64 @@ void symbol_in_new_window(int new_process) } } +void copy_hierarchy_data(Xschem_ctx *from, Xschem_ctx *to) +{ + char **sch; + char **sch_path; + int *sch_path_hash; + int *sch_inst_number; + int *previous_instance; + Zoom *zoom_array; + Lcc *hier_attr; + int i, j; + Str_hashentry **fromnext; + Str_hashentry **tonext; + + sch = from->sch; + sch_path = from->sch_path; + sch_path_hash = from->sch_path_hash; + sch_inst_number = from->sch_inst_number; + previous_instance = from->previous_instance; + zoom_array = from->zoom_array; + hier_attr = from->hier_attr; + to->currsch = from->currsch; + for(i = 0; i <= from->currsch; i++) { + my_strdup2(_ALLOC_ID_, &to->sch[i], sch[i]); + my_strdup2(_ALLOC_ID_, &to->sch_path[i], sch_path[i]); + to->sch_path_hash[i] = sch_path_hash[i]; + to->sch_inst_number[i] = sch_inst_number[i]; + to->previous_instance[i] = previous_instance[i]; + to->zoom_array[i].x = zoom_array[i].x; + to->zoom_array[i].y = zoom_array[i].y; + to->zoom_array[i].zoom = zoom_array[i].zoom; + to->hier_attr[i].x0 = hier_attr[i].x0; + to->hier_attr[i].y0 = hier_attr[i].y0; + to->hier_attr[i].rot = hier_attr[i].rot; + to->hier_attr[i].flip = hier_attr[i].flip; + to->hier_attr[i].fd = NULL; /* Never used outside load_sym_def() */ + my_strdup2(_ALLOC_ID_, &to->hier_attr[i].prop_ptr, hier_attr[i].prop_ptr); + my_strdup2(_ALLOC_ID_, &to->hier_attr[i].templ, hier_attr[i].templ); + my_strdup2(_ALLOC_ID_, &to->hier_attr[i].symname, hier_attr[i].symname); + if(to->portmap[i].table) str_hash_free(&to->portmap[i]); + str_hash_init(&to->portmap[i], HASHSIZE); + for(j = 0; j < HASHSIZE; j++) { + if(!from->portmap[i].table || !from->portmap[i].table[j]) continue; + fromnext = &(from->portmap[i].table[j]); + tonext = &(to->portmap[i].table[j]); + while(*fromnext) { + Str_hashentry *e; + e = my_calloc(_ALLOC_ID_, 1, sizeof(Str_hashentry)); + e->hash = (*fromnext)->hash; + my_strdup2(_ALLOC_ID_, &e->token, (*fromnext)->token); + my_strdup2(_ALLOC_ID_, &e->value, (*fromnext)->value); + *tonext = e; + fromnext = &( (*fromnext)->next ); + tonext = &( (*tonext)->next ); + } + } + } +} + /* 20111007 duplicate current schematic if no inst selected */ void schematic_in_new_window(int new_process) { diff --git a/src/callback.c b/src/callback.c index 51fd0626..fdd248b6 100644 --- a/src/callback.c +++ b/src/callback.c @@ -1842,6 +1842,16 @@ int rstate; /* (reduced state, without ShiftMask) */ xctx->semaphore = save; break; } + + if(key=='E' && EQUAL_MODMASK) /* edit schematic in new window - new xschem process */ + { + int save = xctx->semaphore; + xctx->semaphore--; /* so semaphore for current context wll be saved correctly */ + schematic_in_new_window(1); + xctx->semaphore = save; + break; + } + if(key=='i' && EQUAL_MODMASK) /* edit symbol in new window */ { int save = xctx->semaphore; @@ -1850,6 +1860,17 @@ int rstate; /* (reduced state, without ShiftMask) */ xctx->semaphore = save; break; } + + if(key=='I' && EQUAL_MODMASK) /* edit symbol in new window - new xschem process */ + { + int save = xctx->semaphore; + xctx->semaphore--; /* so semaphore for current context wll be saved correctly */ + symbol_in_new_window(1); + xctx->semaphore = save; + break; + } + + if( (key=='e' && rstate == ControlMask) || (key==XK_BackSpace)) /* back */ { if(xctx->semaphore >= 2) break; diff --git a/src/save.c b/src/save.c index 2390e6ed..81ae8a39 100644 --- a/src/save.c +++ b/src/save.c @@ -907,6 +907,18 @@ int extra_rawfile(int what, const char *file, const char *type) dbg(0, "extra_rawfile() switch: %s not found or no %s analysis\n", f, type); ret = 0; } + } else if(file && isonlydigit(file) ) { + tclvareval("subst {", file, "}", NULL); + my_strncpy(f, tclresult(), S(f)); + i = atoi(file); + if(i >= 0 && i < xctx->extra_raw_n) { /* if file found switch to it ... */ + dbg(1, "extra_rawfile() switch: found: switch to it\n"); + xctx->extra_prev_idx = xctx->extra_idx; + xctx->extra_idx = i; + } else { + dbg(0, "extra_rawfile() switch: %s not found or no %s analysis\n", f, type); + ret = 0; + } } else { /* switch to next */ xctx->extra_prev_idx = xctx->extra_idx; xctx->extra_idx = (xctx->extra_idx + 1) % xctx->extra_raw_n; diff --git a/src/scheduler.c b/src/scheduler.c index 4c8e1470..16ff0fe5 100644 --- a/src/scheduler.c +++ b/src/scheduler.c @@ -3144,6 +3144,8 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg } else if(argc > 2 && !strcmp(argv[2], "switch")) { if(argc > 4) { ret = extra_rawfile(2, argv[3], argv[4]); + } else if(argc > 3) { + ret = extra_rawfile(2, argv[3], NULL); } else { ret = extra_rawfile(2, NULL, NULL); } @@ -4682,42 +4684,48 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg int type, n, c; if(!xctx) {Tcl_SetResult(interp, not_avail, TCL_STATIC); return TCL_ERROR;} - hash_objects(); - dbg(0, "n_hash_objects=%d\n", xctx->n_hash_objects); - - for(init_object_iterator(&ctx, -420., -970., 1300., -250.); (objectptr = object_iterator_next(&ctx)) ;) { - type = objectptr->type; - n = objectptr->n; - c = objectptr->c; - dbg(0, "type=%d, n=%d c=%d\n", type, n, c); - switch(type) { - case ELEMENT: - select_element(n, SELECTED, 1, 1); - break; - case WIRE: - select_wire(n, SELECTED, 1); - break; - case xTEXT: - select_text(n, SELECTED, 1); - break; - case xRECT: - select_box(c, n, SELECTED, 1, 0); - break; - case LINE: - select_line(c, n, SELECTED, 1); - break; - case POLYGON: - select_polygon(c, n, SELECTED, 1); - break; - case ARC: - select_arc(c, n, SELECTED, 1); - break; + if(argc > 2 && atoi(argv[2]) == 1) { + hash_objects(); + dbg(0, "n_hash_objects=%d\n", xctx->n_hash_objects); + + for(init_object_iterator(&ctx, -420., -970., 1300., -250.); (objectptr = object_iterator_next(&ctx)) ;) { + type = objectptr->type; + n = objectptr->n; + c = objectptr->c; + dbg(0, "type=%d, n=%d c=%d\n", type, n, c); + switch(type) { + case ELEMENT: + select_element(n, SELECTED, 1, 1); + break; + case WIRE: + select_wire(n, SELECTED, 1); + break; + case xTEXT: + select_text(n, SELECTED, 1); + break; + case xRECT: + select_box(c, n, SELECTED, 1, 0); + break; + case LINE: + select_line(c, n, SELECTED, 1); + break; + case POLYGON: + select_polygon(c, n, SELECTED, 1); + break; + case ARC: + select_arc(c, n, SELECTED, 1); + break; + } } + rebuild_selected_array(); + draw(); + + del_object_table(); + } + else if(argc > 2 && atoi(argv[2]) == 2) { + Xschem_ctx **save_xctx = get_save_xctx(); + copy_hierarchy_data(save_xctx[0], save_xctx[1]); } - rebuild_selected_array(); - draw(); - - del_object_table(); Tcl_ResetResult(interp); } diff --git a/src/xschem.h b/src/xschem.h index f9b2576b..c3f546d6 100644 --- a/src/xschem.h +++ b/src/xschem.h @@ -1260,6 +1260,7 @@ extern int check_lib(int what, const char *s); extern int floaters_from_selected_inst(); extern void select_all(void); extern void change_linewidth(double w); +extern void copy_hierarchy_data(Xschem_ctx *from, Xschem_ctx *to); extern void schematic_in_new_window(int new_process); extern void symbol_in_new_window(int new_process); extern void new_xschem_process(const char *cell, int symbol); diff --git a/xschem_library/ngspice/inv_ngspice.sch b/xschem_library/ngspice/inv_ngspice.sch index fa6b4f7f..29b1864b 100644 --- a/xschem_library/ngspice/inv_ngspice.sch +++ b/xschem_library/ngspice/inv_ngspice.sch @@ -26,8 +26,10 @@ S {} E {} T {@name @FUNC} 490 -520 0 0 0.2 0.2 {name=B2} -N 470 -470 470 -430 { lab=#net1} -N 470 -470 540 -470 { lab=#net1} +T {( @#0:resolved_net )} 40 -275 0 0 0.2 0.2 {name=p1 layer=15} +T {( @#0:resolved_net )} 350 -275 0 1 0.2 0.2 {name=p4 layer=15} +N 470 -470 470 -430 { lab=X1} +N 470 -470 540 -470 { lab=X1} N 470 -370 470 -320 { lab=0} N 600 -470 670 -470 { lab=Y1} N 320 -470 360 -470 { lab=A1} diff --git a/xschem_library/rom8k/LD2QHDX4stef.sch b/xschem_library/rom8k/LD2QHDX4stef.sch index 2fc14ef2..cd9575e9 100644 --- a/xschem_library/rom8k/LD2QHDX4stef.sch +++ b/xschem_library/rom8k/LD2QHDX4stef.sch @@ -1,4 +1,4 @@ -v {xschem version=3.4.4 file_version=1.2 +v {xschem version=3.4.5 file_version=1.2 * * This file is part of XSCHEM, * a schematic capture and Spice/Vhdl/Verilog netlisting tool for circuit @@ -20,9 +20,13 @@ v {xschem version=3.4.4 file_version=1.2 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA } G {} +K {} V {} S {} E {} +T {( @#0:resolved_net )} 90 -225 0 0 0.2 0.2 {name=p6 layer=15} +T {( @#0:resolved_net )} 90 -165 0 0 0.2 0.2 {name=p9 layer=15} +T {( @#0:resolved_net )} 90 -145 0 0 0.2 0.2 {name=p10 layer=15} N 1130 -590 1130 -340 {lab=FN} N 660 -520 660 -340 {lab=BN} N 1050 -820 1130 -820 {lab=Q} @@ -68,11 +72,11 @@ N 400 -240 820 -240 {lab=#net1} C {ipin.sym} 80 -220 0 0 {name=p6 lab=D} C {ipin.sym} 80 -160 0 0 {name=p9 lab=G} C {ipin.sym} 80 -140 0 0 {name=p10 lab=CD} -C {opin.sym} 180 -240 0 0 {name=p11 lab=Q} -C {iopin.sym} 180 -220 0 0 {name=p12 lab=vcc} -C {iopin.sym} 180 -200 0 0 {name=p13 lab=vss} -C {iopin.sym} 180 -180 0 0 {name=p14 lab=vccsup} -C {iopin.sym} 180 -160 0 0 {name=p15 lab=vsssup} +C {opin.sym} 230 -210 0 0 {name=p11 lab=Q} +C {iopin.sym} 230 -190 0 0 {name=p12 lab=vcc} +C {iopin.sym} 230 -170 0 0 {name=p13 lab=vss} +C {iopin.sym} 230 -150 0 0 {name=p14 lab=vccsup} +C {iopin.sym} 230 -130 0 0 {name=p15 lab=vsssup} C {lab_pin.sym} 1130 -820 0 1 {name=p1 lab=Q} C {capa.sym} 630 -460 1 0 {name=c2 m=1 value=3f} C {lab_pin.sym} 600 -460 1 0 {name=p8 lab=vss}