readable function pointer call syntax

This commit is contained in:
Stefan Frederik 2021-11-29 11:52:32 +01:00
parent d3ef2038ed
commit fe549c0f5c
17 changed files with 94 additions and 94 deletions

View File

@ -780,7 +780,7 @@ int place_symbol(int pos, const char *symbol_name, double x, double y, short rot
dbg(1, "place_symbol(): load_file_dialog returns: name=%s\n",name);
my_strncpy(name, rel_sym_path(name), S(name));
if(name[0]) {
if(first_call && to_push_undo) (*xctx->push_undo_ptr)();
if(first_call && to_push_undo) xctx->push_undo();
} else return 0;
i=match_symbol(name);
@ -1581,7 +1581,7 @@ void new_wire(int what, double mx_snap, double my_snap)
s_pnetname = tclgetboolvar("show_pin_net_names");
if( (what & PLACE) ) {
if( (xctx->ui_state & STARTWIRE) && (xctx->nl_x1!=xctx->nl_x2 || xctx->nl_y1!=xctx->nl_y2) ) {
(*xctx->push_undo_ptr)();
xctx->push_undo();
if(xctx->manhattan_lines==1) {
if(xctx->nl_xx2!=xctx->nl_xx1) {
xctx->nl_xx1 = xctx->nl_x1; xctx->nl_yy1 = xctx->nl_y1;
@ -1750,7 +1750,7 @@ void change_layer()
double x1,y1,x2,y2, a, b, r;
if(xctx->lastsel) (*xctx->push_undo_ptr)();
if(xctx->lastsel) xctx->push_undo();
for(k=0;k<xctx->lastsel;k++)
{
n=xctx->sel_array[k].n;
@ -1810,7 +1810,7 @@ void new_arc(int what, double sweep)
xctx->nl_x3, xctx->nl_y3, &xctx->nl_x, &xctx->nl_y, &xctx->nl_r, &xctx->nl_a, &xctx->nl_b);
if(xctx->nl_sweep_angle==360.) xctx->nl_b=360.;
if(xctx->nl_r>0.) {
(*xctx->push_undo_ptr)();
xctx->push_undo();
drawarc(xctx->rectcolor, NOW, xctx->nl_x, xctx->nl_y, xctx->nl_r, xctx->nl_a, xctx->nl_b, 0, 0);
store_arc(-1, xctx->nl_x, xctx->nl_y, xctx->nl_r, xctx->nl_a, xctx->nl_b, xctx->rectcolor, 0, NULL);
}
@ -1845,7 +1845,7 @@ void new_line(int what)
{
if( (xctx->nl_x1!=xctx->nl_x2 || xctx->nl_y1!=xctx->nl_y2) && (xctx->ui_state & STARTLINE) )
{
(*xctx->push_undo_ptr)();
xctx->push_undo();
if(xctx->manhattan_lines==1) {
if(xctx->nl_xx2!=xctx->nl_xx1) {
xctx->nl_xx1 = xctx->nl_x1; xctx->nl_yy1 = xctx->nl_y1;
@ -1961,7 +1961,7 @@ void new_rect(int what)
{
int save_draw;
RECTORDER(xctx->nl_x1,xctx->nl_y1,xctx->nl_x2,xctx->nl_y2);
(*xctx->push_undo_ptr)();
xctx->push_undo();
drawrect(xctx->rectcolor, NOW, xctx->nl_x1,xctx->nl_y1,xctx->nl_x2,xctx->nl_y2, 0);
save_draw = xctx->draw_window;
xctx->draw_window = 1;
@ -2037,7 +2037,7 @@ void new_polygon(int what)
/* closed poly end by clicking on first point */
((what & ADD) && xctx->nl_polyx[xctx->nl_points-1] == xctx->nl_polyx[0] &&
xctx->nl_polyy[xctx->nl_points-1] == xctx->nl_polyy[0]) ) {
(*xctx->push_undo_ptr)();
xctx->push_undo();
drawtemppolygon(xctx->gctiled, NOW, xctx->nl_polyx, xctx->nl_polyy, xctx->nl_points+1);
store_poly(-1, xctx->nl_polyx, xctx->nl_polyy, xctx->nl_points, xctx->rectcolor, 0, NULL);
/* fprintf(errfp, "new_poly: finish: nl_points=%d\n", xctx->nl_points); */
@ -2226,7 +2226,7 @@ int place_text(int draw_text, double mx, double my)
txt = (char *)tclgetvar("retval");
if(!strcmp(txt,"")) return 0; /* dont allocate text object if empty string given */
(*xctx->push_undo_ptr)();
xctx->push_undo();
check_text_storage();
t->txt_ptr=NULL;
t->prop_ptr=NULL; /* 20111006 added missing initialization of pointer */

View File

@ -1105,7 +1105,7 @@ int callback(const char *winpath, int event, int mx, int my, KeySym key,
if(key=='u' && state==Mod1Mask) /* align to grid */
{
if(xctx->semaphore >= 2) break;
(*xctx->push_undo_ptr)();
xctx->push_undo();
round_schematic_to_grid(c_snap);
set_modify(1);
if(tclgetboolvar("autotrim_wires")) trim_wires();
@ -1136,21 +1136,21 @@ int callback(const char *winpath, int event, int mx, int my, KeySym key,
if(key=='u' && state==0) /* undo */
{
if(xctx->semaphore >= 2) break;
(*xctx->pop_undo_ptr)(0, 1); /* 2nd parameter: set_modify_status */
xctx->pop_undo(0, 1); /* 2nd parameter: set_modify_status */
draw();
break;
}
if(key=='U' && state==ShiftMask) /* redo */
{
if(xctx->semaphore >= 2) break;
(*xctx->pop_undo_ptr)(1, 1); /* 2nd parameter: set_modify_status */
xctx->pop_undo(1, 1); /* 2nd parameter: set_modify_status */
draw();
break;
}
if(key=='&') /* check wire connectivity */
{
if(xctx->semaphore >= 2) break;
(*xctx->push_undo_ptr)();
xctx->push_undo();
trim_wires();
draw();
break;

View File

@ -414,7 +414,7 @@ void break_wires_at_pins(void)
{
if( (x0!=xctx->wire[i].x1 && x0!=xctx->wire[i].x2) ||
(y0!=xctx->wire[i].y1 && y0!=xctx->wire[i].y2) ) {
if(!changed) { (*xctx->push_undo_ptr)(); changed=1;}
if(!changed) { xctx->push_undo(); changed=1;}
check_wire_storage();
xctx->wire[xctx->wires].x1=xctx->wire[i].x1;
xctx->wire[xctx->wires].y1=xctx->wire[i].y1;
@ -470,7 +470,7 @@ void break_wires_at_pins(void)
if( (x0!=xctx->wire[i].x1 && x0!=xctx->wire[i].x2) ||
(y0!=xctx->wire[i].y1 && y0!=xctx->wire[i].y2) ) {
/* printf("touch in mid point: %d\n", l+1); */
if(!changed) { (*xctx->push_undo_ptr)(); changed=1;}
if(!changed) { xctx->push_undo(); changed=1;}
check_wire_storage();
xctx->wire[xctx->wires].x1=xctx->wire[i].x1;
xctx->wire[xctx->wires].y1=xctx->wire[i].y1;

View File

@ -409,7 +409,7 @@ void edit_rect_property(void)
preserve = atoi(tclgetvar("preserve_unchanged_attrs"));
if(strcmp(tclgetvar("rcode"),"") )
{
(*xctx->push_undo_ptr)();
xctx->push_undo();
set_modify(1);
for(i=0; i<xctx->lastsel; i++) {
if(xctx->sel_array[i].type != xRECT) continue;
@ -464,7 +464,7 @@ void edit_line_property(void)
if(strcmp(tclgetvar("rcode"),"") )
{
int y1, y2;
(*xctx->push_undo_ptr)();
xctx->push_undo();
set_modify(1);
bbox(START, 0.0 , 0.0 , 0.0 , 0.0);
for(i=0; i<xctx->lastsel; i++) {
@ -517,7 +517,7 @@ void edit_wire_property(void)
preserve = atoi(tclgetvar("preserve_unchanged_attrs"));
if(strcmp(tclgetvar("rcode"),"") )
{
(*xctx->push_undo_ptr)();
xctx->push_undo();
set_modify(1);
bbox(START, 0.0 , 0.0 , 0.0 , 0.0);
for(i=0; i<xctx->lastsel; i++) {
@ -581,7 +581,7 @@ void edit_arc_property(void)
if(strcmp(tclgetvar("rcode"),"") )
{
set_modify(1); (*xctx->push_undo_ptr)();
set_modify(1); xctx->push_undo();
for(ii=0; ii<xctx->lastsel; ii++) {
if(xctx->sel_array[ii].type != ARC) continue;
@ -648,7 +648,7 @@ void edit_polygon_property(void)
if(strcmp(tclgetvar("rcode"),"") )
{
set_modify(1); (*xctx->push_undo_ptr)();
set_modify(1); xctx->push_undo();
for(ii=0; ii<xctx->lastsel; ii++) {
if(xctx->sel_array[ii].type != POLYGON) continue;
@ -743,7 +743,7 @@ void edit_text_property(int x)
if(strcmp(tclgetvar("rcode"),"") )
{
dbg(1, "edit_text_property(): rcode !=\"\"\n");
set_modify(1); (*xctx->push_undo_ptr)();
set_modify(1); xctx->push_undo();
bbox(START,0.0,0.0,0.0,0.0);
for(k=0;k<xctx->lastsel;k++)
{
@ -986,7 +986,7 @@ void update_symbol(const char *result, int x)
&xctx->inst[*ii].x2, &xctx->inst[*ii].y2);
if(sym_number>=0) /* changing symbol ! */
{
if(!pushed) { (*xctx->push_undo_ptr)(); pushed=1;}
if(!pushed) { xctx->push_undo(); pushed=1;}
delete_inst_node(*ii); /* 20180208 fix crashing bug: delete node info if changing symbol */
/* if number of pins is different we must delete these data *before* */
/* changing ysmbol, otherwise *ii might end up deleting non allocated data. */
@ -1004,7 +1004,7 @@ void update_symbol(const char *result, int x)
char * ss=NULL;
my_strdup(119, &ss, xctx->inst[*ii].prop_ptr);
if( set_different_token(&ss, new_prop, xctx->old_prop, 0, 0) ) {
if(!pushed) { (*xctx->push_undo_ptr)(); pushed=1;}
if(!pushed) { xctx->push_undo(); pushed=1;}
my_strdup(111, &xctx->inst[*ii].prop_ptr, ss);
set_modify(1);
}
@ -1015,12 +1015,12 @@ void update_symbol(const char *result, int x)
if(!xctx->inst[*ii].prop_ptr || strcmp(xctx->inst[*ii].prop_ptr, new_prop)) {
dbg(1, "update_symbol(): changing prop: |%s| -> |%s|\n",
xctx->inst[*ii].prop_ptr, new_prop);
if(!pushed) { (*xctx->push_undo_ptr)(); pushed=1;}
if(!pushed) { xctx->push_undo(); pushed=1;}
my_strdup(84, &xctx->inst[*ii].prop_ptr, new_prop);
set_modify(1);
}
} else {
if(!pushed) { (*xctx->push_undo_ptr)(); pushed=1;}
if(!pushed) { xctx->push_undo(); pushed=1;}
my_strdup(86, &xctx->inst[*ii].prop_ptr, "");
set_modify(1);
}
@ -1037,7 +1037,7 @@ void update_symbol(const char *result, int x)
name, xctx->inst[*ii].prop_ptr);
my_strdup(89, &ptr,subst_token(xctx->inst[*ii].prop_ptr, "name", name) );
/* set name of current inst */
if(!pushed) { (*xctx->push_undo_ptr)(); pushed=1;}
if(!pushed) { xctx->push_undo(); pushed=1;}
if(!k) hash_all_names(*ii);
new_prop_string(*ii, ptr, k, tclgetboolvar("disable_unique_names")); /* set new prop_ptr */
}
@ -1111,7 +1111,7 @@ void change_elem_order(void)
tcleval("text_line {Object Sequence number} 0");
if(strcmp(tclgetvar("rcode"),"") )
{
(*xctx->push_undo_ptr)();
xctx->push_undo();
set_modify(1);
xctx->prep_hash_inst=0;
xctx->prep_net_structs=0;
@ -1208,27 +1208,27 @@ void edit_property(int x)
{
if(xctx->netlist_type==CAD_SYMBOL_ATTRS &&
(!xctx->schsymbolprop || strcmp(xctx->schsymbolprop, tclgetvar("retval") ) ) ) {
set_modify(1); (*xctx->push_undo_ptr)();
set_modify(1); xctx->push_undo();
my_strdup(422, &xctx->schsymbolprop, (char *) tclgetvar("retval"));
} else if(xctx->netlist_type==CAD_VERILOG_NETLIST &&
(!xctx->schverilogprop || strcmp(xctx->schverilogprop, tclgetvar("retval") ) ) ) {
set_modify(1); (*xctx->push_undo_ptr)();
set_modify(1); xctx->push_undo();
my_strdup(94, &xctx->schverilogprop, (char *) tclgetvar("retval"));
} else if(xctx->netlist_type==CAD_SPICE_NETLIST &&
(!xctx->schprop || strcmp(xctx->schprop, tclgetvar("retval") ) ) ) {
set_modify(1); (*xctx->push_undo_ptr)();
set_modify(1); xctx->push_undo();
my_strdup(95, &xctx->schprop, (char *) tclgetvar("retval"));
} else if(xctx->netlist_type==CAD_TEDAX_NETLIST &&
(!xctx->schtedaxprop || strcmp(xctx->schtedaxprop, tclgetvar("retval") ) ) ) {
set_modify(1); (*xctx->push_undo_ptr)();
set_modify(1); xctx->push_undo();
my_strdup(96, &xctx->schtedaxprop, (char *) tclgetvar("retval"));
} else if(xctx->netlist_type==CAD_VHDL_NETLIST &&
(!xctx->schvhdlprop || strcmp(xctx->schvhdlprop, tclgetvar("retval") ) ) ) {
set_modify(1); (*xctx->push_undo_ptr)();
set_modify(1); xctx->push_undo();
my_strdup(97, &xctx->schvhdlprop, (char *) tclgetvar("retval"));
}
}

View File

@ -465,7 +465,7 @@ void mem_pop_undo(int redo, int set_modify_status)
} else if(redo == 0) { /* undo */
if(xctx->cur_undo_ptr == xctx->tail_undo_ptr) return;
if(xctx->head_undo_ptr == xctx->cur_undo_ptr) {
(*xctx->push_undo_ptr)();
xctx->push_undo();
xctx->head_undo_ptr--;
xctx->cur_undo_ptr--;
}

View File

@ -582,7 +582,7 @@ void copy_objects(int what)
int l, firstw, firsti;
bbox(START, 0.0 , 0.0 , 0.0 , 0.0);
newpropcnt=0;
set_modify(1); (*xctx->push_undo_ptr)(); /* 20150327 push_undo */
set_modify(1); xctx->push_undo(); /* 20150327 push_undo */
firstw = firsti = 1;
@ -1053,7 +1053,7 @@ void move_objects(int what, int merge, double dx, double dy)
set_modify(1);
if( !(xctx->ui_state & (STARTMERGE | PLACE_SYMBOL | PLACE_TEXT)) ) { /* no undo push for MERGE ad PLACE, already done before */
dbg(1, "move_objects(): push undo state\n");
(*xctx->push_undo_ptr)();
xctx->push_undo();
}
xctx->ui_state &= ~PLACE_SYMBOL;
xctx->ui_state &= ~PLACE_TEXT;

View File

@ -319,7 +319,7 @@ void merge_file(int selection_load, const char ext[])
xctx->prep_hash_inst=0;
xctx->prep_hash_wires=0;
got_mouse = 0;
(*xctx->push_undo_ptr)();
xctx->push_undo();
unselect_all();
old=xctx->instances;
while(!endfile)

View File

@ -1066,7 +1066,7 @@ void load_schematic(int load_symbols, const char *filename, int reset_undo) /* 2
xctx->prep_net_structs=0;
xctx->prep_hash_inst=0;
xctx->prep_hash_wires=0;
if(reset_undo) (*xctx->clear_undo_ptr)();
if(reset_undo) xctx->clear_undo();
if(reset_undo) xctx->prev_set_modify = -1; /* will force set_modify(0) to set window title */
else xctx->prev_set_modify = 0; /* will prevent set_modify(0) from setting window title */
if(filename && filename[0]) {
@ -1195,7 +1195,7 @@ void push_undo(void)
xctx->undo_dirname, xctx->cur_undo_ptr%MAX_UNDO);
fd = popen(diff_name,"w");
if(!fd) {
fprintf(errfp, "(*xctx->push_undo_ptr)(): failed to open write pipe %s\n", diff_name);
fprintf(errfp, "push_undo(): failed to open write pipe %s\n", diff_name);
xctx->no_undo=1;
return;
}
@ -1221,7 +1221,7 @@ void push_undo(void)
#endif
execlp("gzip", "gzip", "--fast", "-c", NULL); /* replace current process with comand */
/* never gets here */
fprintf(errfp, "(*xctx->push_undo_ptr)(): problems with execlp\n");
fprintf(errfp, "push_undo(): problems with execlp\n");
Tcl_Eval(interp, "exit");
}
close(pd[0]); /* close read side of pipe */
@ -1230,7 +1230,7 @@ void push_undo(void)
my_snprintf(diff_name, S(diff_name), "%s/undo%d", xctx->undo_dirname, xctx->cur_undo_ptr%MAX_UNDO);
fd = fopen(diff_name,"w");
if(!fd) {
fprintf(errfp, "(*xctx->push_undo_ptr)(): failed to open undo file %s\n", diff_name);
fprintf(errfp, "push_undo(): failed to open undo file %s\n", diff_name);
xctx->no_undo=1;
return;
}
@ -1278,7 +1278,7 @@ void pop_undo(int redo, int set_modify_status)
dbg(1, "pop_undo(): undo; cur_undo_ptr=%d tail_undo_ptr=%d head_undo_ptr=%d\n",
xctx->cur_undo_ptr, xctx->tail_undo_ptr, xctx->head_undo_ptr);
if(xctx->head_undo_ptr == xctx->cur_undo_ptr) {
(*xctx->push_undo_ptr)();
xctx->push_undo();
xctx->head_undo_ptr--;
xctx->cur_undo_ptr--;
}
@ -1295,7 +1295,7 @@ void pop_undo(int redo, int set_modify_status)
my_snprintf(diff_name, S(diff_name), "gzip -d -c %s/undo%d", xctx->undo_dirname, xctx->cur_undo_ptr%MAX_UNDO);
fd=popen(diff_name, "r");
if(!fd) {
fprintf(errfp, "(*xctx->pop_undo_ptr)(): failed to open read pipe %s\n", diff_name);
fprintf(errfp, "pop_undo(): failed to open read pipe %s\n", diff_name);
xctx->no_undo=1;
return;
}
@ -1327,7 +1327,7 @@ void pop_undo(int redo, int set_modify_status)
my_snprintf(diff_name, S(diff_name), "%s/undo%d", xctx->undo_dirname, xctx->cur_undo_ptr%MAX_UNDO);
fd=fopen(diff_name, "r");
if(!fd) {
fprintf(errfp, "(*xctx->pop_undo_ptr)(): failed to open read pipe %s\n", diff_name);
fprintf(errfp, "pop_undo(): failed to open read pipe %s\n", diff_name);
xctx->no_undo=1;
return;
}
@ -2219,7 +2219,7 @@ void make_schematic_symbol_from_sel(void)
tcleval("tk_messageBox -type ok -message {Cannot overwrite current schematic}");
}
else if (strlen(filename)) {
if (xctx->lastsel) (*xctx->push_undo_ptr)();
if (xctx->lastsel) xctx->push_undo();
make_schematic(filename);
delete(0/*to_push_undo*/);
place_symbol(-1, filename, 0, 0, 0, 0, NULL, 4, 1, 0/*to_push_undo*/);

View File

@ -104,7 +104,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
else if(!strcmp(argv[1],"align"))
{
cmd_found = 1;
(*xctx->push_undo_ptr)();
xctx->push_undo();
round_schematic_to_grid(tclgetdoublevar("cadsnap"));
if(tclgetvar("autotrim_wires")) trim_wires();
set_modify(1);
@ -1789,7 +1789,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
else if(!strcmp(argv[1],"push_undo"))
{
cmd_found = 1;
(*xctx->push_undo_ptr)();
xctx->push_undo();
Tcl_ResetResult(interp);
}
}
@ -1830,7 +1830,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
else if(!strcmp(argv[1],"redo"))
{
cmd_found = 1;
(*xctx->pop_undo_ptr)(1, 1); /* 2nd param: set_modify_status */
xctx->pop_undo(1, 1); /* 2nd param: set_modify_status */
Tcl_ResetResult(interp);
}
@ -1899,7 +1899,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
bbox(START,0.0,0.0,0.0,0.0);
my_strncpy(symbol, argv[3], S(symbol));
(*xctx->push_undo_ptr)();
xctx->push_undo();
set_modify(1);
if(!fast) {
xctx->prep_hash_inst=0;
@ -2281,7 +2281,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
bbox(START,0.0,0.0,0.0,0.0);
symbol_bbox(inst, &xctx->inst[inst].x1, &xctx->inst[inst].y1, &xctx->inst[inst].x2, &xctx->inst[inst].y2);
bbox(ADD, xctx->inst[inst].x1, xctx->inst[inst].y1, xctx->inst[inst].x2, xctx->inst[inst].y2);
(*xctx->push_undo_ptr)();
xctx->push_undo();
}
set_modify(1);
xctx->prep_hash_inst=0;
@ -2401,7 +2401,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
else if(!strcmp(argv[1],"trim_wires"))
{
cmd_found = 1;
(*xctx->push_undo_ptr)();
xctx->push_undo();
trim_wires();
draw();
Tcl_ResetResult(interp);
@ -2419,7 +2419,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
if(argc > 3) {
set_modify = atoi(argv[3]);
}
(*xctx->pop_undo_ptr)(redo, set_modify); /* 2nd param: set_modify_status */
xctx->pop_undo(redo, set_modify); /* 2nd param: set_modify_status */
Tcl_ResetResult(interp);
}
@ -2432,20 +2432,20 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
mem_delete_undo(); /*reset memory undo */
}
/* redefine undo function pointers */
xctx->push_undo_ptr = push_undo;
xctx->pop_undo_ptr = pop_undo;
xctx->delete_undo_ptr = delete_undo;
xctx->clear_undo_ptr = clear_undo;
xctx->push_undo = push_undo;
xctx->pop_undo = pop_undo;
xctx->delete_undo = delete_undo;
xctx->clear_undo = clear_undo;
xctx->undo_type = 0; /* disk */
} else { /* "memory" */
if(xctx->undo_type == 0) {
delete_undo(); /*reset disk undo */
}
/* redefine undo function pointers */
xctx->push_undo_ptr = mem_push_undo;
xctx->pop_undo_ptr = mem_pop_undo;
xctx->delete_undo_ptr = mem_delete_undo;
xctx->clear_undo_ptr = mem_clear_undo;
xctx->push_undo = mem_push_undo;
xctx->pop_undo = mem_pop_undo;
xctx->delete_undo = mem_delete_undo;
xctx->clear_undo = mem_clear_undo;
xctx->undo_type = 1; /* memory */
}
}
@ -2524,7 +2524,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
if(argc >= 7) pos=atol(argv[6]);
if(argc == 8) prop = argv[7];
else prop = NULL;
(*xctx->push_undo_ptr)();
xctx->push_undo();
storeobject(pos, x1,y1,x2,y2,WIRE,0,0,prop);
xctx->prep_hi_structs=0;
xctx->prep_net_structs=0;

View File

@ -328,7 +328,7 @@ void delete(int to_push_undo)
j = 0;
bbox(START, 0.0 , 0.0 , 0.0 , 0.0);
rebuild_selected_array();
if(to_push_undo && xctx->lastsel) (*xctx->push_undo_ptr)();
if(to_push_undo && xctx->lastsel) xctx->push_undo();
/* first calculate bbox, because symbol_bbox() needs translate (@#0:net_name) which
* needs prepare_netlist_structs which needs a consistent xctx->inst[] data structure */

View File

@ -36,7 +36,7 @@ void hier_psprint(void) /* netlister driver */
char *sch = NULL;
if(!ps_draw(1)) return; /* prolog */
(*xctx->push_undo_ptr)();
xctx->push_undo();
str_hash_free(subckt_table);
zoom_full(0, 0, 1, 0.97);
ps_draw(2); /* page */
@ -44,8 +44,8 @@ void hier_psprint(void) /* netlister driver */
unselect_all();
remove_symbols(); /* ensure all unused symbols purged before descending hierarchy */
/* reload data without popping undo stack, this populates embedded symbols if any */
(*xctx->pop_undo_ptr)(2, 0);
/* link_symbols_to_instances(-1); */ /* done in (*xctx->pop_undo_ptr)() */
xctx->pop_undo(2, 0);
/* link_symbols_to_instances(-1); */ /* done in xctx->pop_undo() */
my_strdup(1224, &xctx->sch_path[xctx->currsch+1], xctx->sch_path[xctx->currsch]);
my_strcat(1227, &xctx->sch_path[xctx->currsch+1], "->netlisting");
xctx->sch_path_hash[xctx->currsch+1] = 0;
@ -85,7 +85,7 @@ void hier_psprint(void) /* netlister driver */
xctx->currsch--;
unselect_all();
/* load_schematic(1, xctx->sch[xctx->currsch], 0); */
(*xctx->pop_undo_ptr)(0, 0);
xctx->pop_undo(0, 0);
ps_draw(4); /* trailer */
zoom_full(0, 0, 1, 0.97);
draw();
@ -111,7 +111,7 @@ void global_spice_netlist(int global) /* netlister driver */
split_f = tclgetboolvar("split_files");
top_sub = tclgetboolvar("top_subckt");
(*xctx->push_undo_ptr)();
xctx->push_undo();
xctx->netlist_unconn_cnt=0; /* unique count of unconnected pins while netlisting */
statusmsg("",2); /* clear infowindow */
str_hash_free(subckt_table);
@ -259,8 +259,8 @@ void global_spice_netlist(int global) /* netlister driver */
unselect_all();
remove_symbols(); /* 20161205 ensure all unused symbols purged before descending hierarchy */
/* reload data without popping undo stack, this populates embedded symbols if any */
(*xctx->pop_undo_ptr)(2, 0);
/* link_symbols_to_instances(-1); */ /* done in (*xctx->pop_undo_ptr)() */
xctx->pop_undo(2, 0);
/* link_symbols_to_instances(-1); */ /* done in xctx->pop_undo() */
my_strdup(469, &xctx->sch_path[xctx->currsch+1], xctx->sch_path[xctx->currsch]);
my_strcat(481, &xctx->sch_path[xctx->currsch+1], "->netlisting");
xctx->sch_path_hash[xctx->currsch+1] = 0;
@ -299,7 +299,7 @@ void global_spice_netlist(int global) /* netlister driver */
unselect_all();
/* remove_symbols(); */
/* load_schematic(1, xctx->sch[xctx->currsch], 0); */
(*xctx->pop_undo_ptr)(0, 0);
xctx->pop_undo(0, 0);
prepare_netlist_structs(1); /* so 'lab=...' attributes for unnamed nets are set */
/* symbol vs schematic pin check, we do it here since now we have ALL symbols loaded */
sym_vs_sch_pins();

View File

@ -33,7 +33,7 @@ void global_tedax_netlist(int global) /* netlister driver */
char cellname[PATH_MAX]; /* 20081211 overflow safe 20161122 */
char *abs_path = NULL;
(*xctx->push_undo_ptr)();
xctx->push_undo();
statusmsg("",2); /* clear infowindow */
record_global_node(2, NULL, NULL); /* delete list of global nodes */
bus_char[0] = bus_char[1] = '\0';
@ -89,8 +89,8 @@ void global_tedax_netlist(int global) /* netlister driver */
unselect_all();
remove_symbols(); /* 20161205 ensure all unused symbols purged before descending hierarchy */
/* reload data without popping undo stack, this populates embedded symbols if any */
(*xctx->pop_undo_ptr)(2, 0);
/* link_symbols_to_instances(-1); */ /* done in (*xctx->pop_undo_ptr)() */
xctx->pop_undo(2, 0);
/* link_symbols_to_instances(-1); */ /* done in xctx->pop_undo() */
my_strdup(482, &xctx->sch_path[xctx->currsch+1], xctx->sch_path[xctx->currsch]);
my_strcat(485, &xctx->sch_path[xctx->currsch+1], "->netlisting");
xctx->sch_path_hash[xctx->currsch+1] = 0;
@ -114,7 +114,7 @@ void global_tedax_netlist(int global) /* netlister driver */
unselect_all();
/* remove_symbols(); */
/* load_schematic(1, xctx->sch[xctx->currsch], 0); */
(*xctx->pop_undo_ptr)(0, 0);
xctx->pop_undo(0, 0);
prepare_netlist_structs(1); /* so 'lab=...' attributes for unnamed nets are set */
/* symbol vs schematic pin check, we do it here since now we have ALL symbols loaded */

View File

@ -210,7 +210,7 @@ void check_unique_names(int rename)
if(rename == 1) {
if(first) {
bbox(START,0.0,0.0,0.0,0.0);
set_modify(1); (*xctx->push_undo_ptr)();
set_modify(1); xctx->push_undo();
xctx->prep_hash_inst=0;
xctx->prep_net_structs=0;
xctx->prep_hi_structs=0;

View File

@ -42,7 +42,7 @@ void global_verilog_netlist(int global) /* netlister driver */
int split_f;
split_f = tclgetboolvar("split_files");
(*xctx->push_undo_ptr)();
xctx->push_undo();
xctx->netlist_unconn_cnt=0; /* unique count of unconnected pins while netlisting */
statusmsg("",2); /* clear infowindow */
str_hash_free(subckt_table);
@ -93,8 +93,8 @@ void global_verilog_netlist(int global) /* netlister driver */
unselect_all();
remove_symbols(); /* removed 25122002, readded 04112003 */
/* reload data without popping undo stack, this populates embedded symbols if any */
(*xctx->pop_undo_ptr)(2, 0);
/* link_symbols_to_instances(-1); */ /* done in (*xctx->pop_undo_ptr)() */
xctx->pop_undo(2, 0);
/* link_symbols_to_instances(-1); */ /* done in xctx->pop_undo() */
dbg(1, "global_verilog_netlist(): sch[currsch]=%s\n", xctx->sch[xctx->currsch]);
/* print top subckt port directions */
@ -283,8 +283,8 @@ void global_verilog_netlist(int global) /* netlister driver */
unselect_all();
remove_symbols(); /* 20161205 ensure all unused symbols purged before descending hierarchy */
/* reload data without popping undo stack, this populates embedded symbols if any */
(*xctx->pop_undo_ptr)(2, 0);
/* link_symbols_to_instances(-1); */ /* done in (*xctx->pop_undo_ptr)() */
xctx->pop_undo(2, 0);
/* link_symbols_to_instances(-1); */ /* done in xctx->pop_undo() */
my_strdup(487, &xctx->sch_path[xctx->currsch+1], xctx->sch_path[xctx->currsch]);
my_strcat(496, &xctx->sch_path[xctx->currsch+1], "->netlisting");
xctx->sch_path_hash[xctx->currsch+1] = 0;
@ -321,7 +321,7 @@ void global_verilog_netlist(int global) /* netlister driver */
unselect_all();
/* remove_symbols(); */
/* load_schematic(1,xctx->sch[xctx->currsch], 0); */
(*xctx->pop_undo_ptr)(0, 0);
xctx->pop_undo(0, 0);
prepare_netlist_structs(1); /* so 'lab=...' attributes for unnamed nets are set */
/* symbol vs schematic pin check, we do it here since now we have ALL symbols loaded */
sym_vs_sch_pins();

View File

@ -43,7 +43,7 @@ void global_vhdl_netlist(int global) /* netlister driver */
int split_f;
split_f = tclgetboolvar("split_files");
(*xctx->push_undo_ptr)();
xctx->push_undo();
xctx->netlist_unconn_cnt=0; /* unique count of unconnected pins while netlisting */
statusmsg("",2); /* clear infowindow */
/* top sch properties used for library use declarations and type definitions */
@ -114,8 +114,8 @@ void global_vhdl_netlist(int global) /* netlister driver */
unselect_all();
remove_symbols(); /* removed 25122002, readded 04112003.. this removes unused symbols */
/* reload data without popping undo stack, this populates embedded symbols if any */
(*xctx->pop_undo_ptr)(2, 0);
/* link_symbols_to_instances(-1); */ /* done in (*xctx->pop_undo_ptr)() */
xctx->pop_undo(2, 0);
/* link_symbols_to_instances(-1); */ /* done in xctx->pop_undo() */
/* 20071009 print top level generics if defined in symbol */
str_tmp = add_ext(xctx->sch[xctx->currsch], ".sym");
@ -340,8 +340,8 @@ void global_vhdl_netlist(int global) /* netlister driver */
unselect_all();
remove_symbols(); /* 20161205 ensure all unused symbols purged before descending hierarchy */
/* reload data without popping undo stack, this populates embedded symbols if any */
(*xctx->pop_undo_ptr)(2, 0);
/* link_symbols_to_instances(-1); */ /* done in (*xctx->pop_undo_ptr)() */
xctx->pop_undo(2, 0);
/* link_symbols_to_instances(-1); */ /* done in xctx->pop_undo() */
my_strdup(502, &xctx->sch_path[xctx->currsch+1], xctx->sch_path[xctx->currsch]);
my_strcat(509, &xctx->sch_path[xctx->currsch+1], "->netlisting");
xctx->sch_path_hash[xctx->currsch+1] = 0;
@ -379,7 +379,7 @@ void global_vhdl_netlist(int global) /* netlister driver */
unselect_all();
/* remove_symbols(); */
/* load_schematic(1, xctx->sch[xctx->currsch], 0); */
(*xctx->pop_undo_ptr)(0, 0);
xctx->pop_undo(0, 0);
prepare_netlist_structs(1); /* so 'lab=...' attributes for unnamed nets are set */
/* symbol vs schematic pin check, we do it here since now we have ALL symbols loaded */
sym_vs_sch_pins();

View File

@ -321,7 +321,7 @@ void init_pixdata()/* populate xctx->fill_type array that is used in create_gc()
void free_xschem_data()
{
int i;
(*xctx->delete_undo_ptr)();
xctx->delete_undo();
free_simdata();
my_free(1098, &xctx->wire);
my_free(1100, &xctx->text);
@ -405,10 +405,10 @@ void alloc_xschem_data(const char *top_path)
if(!strcmp(tclgetvar("undo_type"), "disk")) xctx->undo_type = 0;
else xctx->undo_type = 1; /* "memory" */
xctx->push_undo_ptr = &push_undo;
xctx->pop_undo_ptr = &pop_undo;
xctx->delete_undo_ptr = &delete_undo;
xctx->clear_undo_ptr = &clear_undo;
xctx->push_undo = &push_undo;
xctx->pop_undo = &pop_undo;
xctx->delete_undo = &delete_undo;
xctx->clear_undo = &clear_undo;
xctx->undo_initialized = 0;
xctx->zoom=CADINITIALZOOM;
xctx->mooz=1/CADINITIALZOOM;

View File

@ -712,10 +712,10 @@ typedef struct {
int draw_window;
time_t time_last_modify;
int undo_type; /* 0: on disk, 1: in memory */
void (*push_undo_ptr)(void);
void (*pop_undo_ptr)(int, int);
void (*delete_undo_ptr)(void);
void (*clear_undo_ptr)(void);
void (*push_undo)(void);
void (*pop_undo)(int, int);
void (*delete_undo)(void);
void (*clear_undo)(void);
} Xschem_ctx;
struct Lcc { /* used for symbols containing schematics as instances (LCC, Local Custom Cell) */