made edit_symbol_property and tcl edit_prop procedure much simpler when user clicks another instance while edit_prop dialog still open
This commit is contained in:
parent
58a43ccc4d
commit
9570439e16
|
|
@ -149,7 +149,7 @@ int set_netlist_dir(int force, char *dir)
|
|||
if(dir) my_snprintf(cmd, S(cmd), "select_netlist_dir %d %s", force, dir);
|
||||
else my_snprintf(cmd, S(cmd), "select_netlist_dir %d", force);
|
||||
tcleval(cmd);
|
||||
if(!strcmp("", Tcl_GetStringResult(interp)) ) {
|
||||
if(!strcmp("", tclresult()) ) {
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
|
|
@ -161,7 +161,7 @@ const char *abs_sym_path(const char *s, const char *ext)
|
|||
char c[PATH_MAX+1000];
|
||||
my_snprintf(c, S(c), "abs_sym_path {%s} {%s}", s, ext);
|
||||
tcleval(c);
|
||||
return Tcl_GetStringResult(interp);
|
||||
return tclresult();
|
||||
}
|
||||
|
||||
/* Wrapper to Tcl function */
|
||||
|
|
@ -170,7 +170,7 @@ const char *rel_sym_path(const char *s)
|
|||
char c[PATH_MAX+1000];
|
||||
my_snprintf(c, S(c), "rel_sym_path {%s}", s);
|
||||
tcleval(c);
|
||||
return Tcl_GetStringResult(interp);
|
||||
return tclresult();
|
||||
}
|
||||
|
||||
const char *add_ext(const char *f, const char *ext)
|
||||
|
|
@ -437,7 +437,7 @@ const char *get_file_path(char *f)
|
|||
char tmp[2*PATH_MAX+100];
|
||||
my_snprintf(tmp, S(tmp),"get_file_path \"%s\"", f);
|
||||
tcleval(tmp);
|
||||
return Tcl_GetStringResult(interp);
|
||||
return tclresult();
|
||||
}
|
||||
|
||||
int save(int confirm) /* 20171006 add confirm */
|
||||
|
|
@ -451,8 +451,8 @@ int save(int confirm) /* 20171006 add confirm */
|
|||
{
|
||||
if(confirm) {
|
||||
tcleval("ask_save");
|
||||
if(!strcmp(Tcl_GetStringResult(interp), "") ) cancel=1;
|
||||
if(!strcmp(Tcl_GetStringResult(interp), "yes") ) save_ok = save_schematic(schematic[currentsch]);
|
||||
if(!strcmp(tclresult(), "") ) cancel=1;
|
||||
if(!strcmp(tclresult(), "yes") ) save_ok = save_schematic(schematic[currentsch]);
|
||||
} else {
|
||||
save_ok = save_schematic(schematic[currentsch]);
|
||||
}
|
||||
|
|
@ -479,7 +479,7 @@ void saveas(const char *f) /* changed name from ask_save_file to saveas 2012120
|
|||
}
|
||||
|
||||
tcleval(name);
|
||||
my_strncpy(res, Tcl_GetStringResult(interp), S(res));
|
||||
my_strncpy(res, tclresult(), S(res));
|
||||
}
|
||||
else if(f) {
|
||||
my_strncpy(res, f, S(res));
|
||||
|
|
@ -505,7 +505,7 @@ void ask_new_file(void)
|
|||
if(save(1)) return; /* user cancels save, so do nothing. */
|
||||
}
|
||||
tcleval("load_file_dialog {Load Schematic} .sch.sym INITIALLOADDIR");
|
||||
my_snprintf(fullname, S(fullname),"%s", Tcl_GetStringResult(interp));
|
||||
my_snprintf(fullname, S(fullname),"%s", tclresult());
|
||||
|
||||
|
||||
if( fullname[0] ) {
|
||||
|
|
@ -893,7 +893,7 @@ int place_symbol(int pos, const char *symbol_name, double x, double y, int rot,
|
|||
if(current_type==SYMBOL) return 0; /* 20161210 dont allow components placed inside symbols */
|
||||
if(symbol_name==NULL) {
|
||||
tcleval("load_file_dialog {Choose symbol} .sym INITIALINSTDIR");
|
||||
my_strncpy(name, Tcl_GetStringResult(interp), S(name));
|
||||
my_strncpy(name, tclresult(), S(name));
|
||||
} else {
|
||||
my_strncpy(name, symbol_name, S(name));
|
||||
}
|
||||
|
|
@ -1094,7 +1094,7 @@ void descend_schematic(void)
|
|||
my_strncpy(filename, schematic[currentsch], S(filename));
|
||||
my_snprintf(cmd, S(cmd), "save_file_dialog {Save file} .sch.sym INITIALLOADDIR {%s}", filename);
|
||||
tcleval(cmd);
|
||||
my_strncpy(res, Tcl_GetStringResult(interp), S(res));
|
||||
my_strncpy(res, tclresult(), S(res));
|
||||
if(!res[0]) return; /* 20071104 */
|
||||
dbg(1, "descend_schematic(): saving: %s\n",res);
|
||||
save_ok = save_schematic(res);
|
||||
|
|
@ -1139,7 +1139,7 @@ void descend_schematic(void)
|
|||
Tcl_VarEval(interp, "input_line ", "{input instance number (leftmost = 1) to descend into:\n"
|
||||
"negative numbers select instance starting\nfrom the right (rightmost = -1)}"
|
||||
" {} 1 6", NULL);
|
||||
inum = Tcl_GetStringResult(interp);
|
||||
inum = tclresult();
|
||||
dbg(1, "descend_schematic(): inum=%s\n", inum);
|
||||
if(!inum[0]) {
|
||||
my_free(710, &sch_path[currentsch+1]);
|
||||
|
|
@ -1203,8 +1203,8 @@ void go_back(int confirm) /* 20171006 add confirm */
|
|||
{
|
||||
if(confirm) {
|
||||
tcleval("ask_save");
|
||||
if(!strcmp(Tcl_GetStringResult(interp), "yes") ) save_ok = save_schematic(schematic[currentsch]);
|
||||
else if(!strcmp(Tcl_GetStringResult(interp), "") ) return;
|
||||
if(!strcmp(tclresult(), "yes") ) save_ok = save_schematic(schematic[currentsch]);
|
||||
else if(!strcmp(tclresult(), "") ) return;
|
||||
} else {
|
||||
save_ok = save_schematic(schematic[currentsch]);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -654,7 +654,7 @@ int callback(int event, int mx, int my, KeySym key,
|
|||
if(semaphore >= 2) break;
|
||||
if(modified) {
|
||||
tcleval("tk_messageBox -type okcancel -message {UNSAVED data: want to exit?}");
|
||||
if(strcmp(Tcl_GetStringResult(interp),"ok")==0) {
|
||||
if(strcmp(tclresult(),"ok")==0) {
|
||||
tcleval( "exit");
|
||||
}
|
||||
}
|
||||
|
|
@ -755,7 +755,7 @@ int callback(int event, int mx, int my, KeySym key,
|
|||
if(semaphore >= 2) break; /* 20180914 */
|
||||
if(current_type==SCHEMATIC) {
|
||||
tcleval("tk_messageBox -type okcancel -message {do you want to make symbol view ?}");
|
||||
if(strcmp(Tcl_GetStringResult(interp),"ok")==0)
|
||||
if(strcmp(tclresult(),"ok")==0)
|
||||
{
|
||||
save_schematic(schematic[currentsch]);
|
||||
make_symbol();
|
||||
|
|
@ -893,7 +893,7 @@ int callback(int event, int mx, int my, KeySym key,
|
|||
{
|
||||
if(semaphore >= 2) break;
|
||||
tcleval("tk_messageBox -type okcancel -message {Are you sure you want to reload from disk?}");
|
||||
if(strcmp(Tcl_GetStringResult(interp),"ok")==0) {
|
||||
if(strcmp(tclresult(),"ok")==0) {
|
||||
char filename[PATH_MAX];
|
||||
unselect_all();
|
||||
remove_symbols();
|
||||
|
|
@ -1440,9 +1440,9 @@ int callback(int event, int mx, int my, KeySym key,
|
|||
ui_state |= STARTPAN2;
|
||||
break;
|
||||
}
|
||||
else if(semaphore >= 2) {
|
||||
if(button==Button1 && state==0) {
|
||||
tcleval("set editprop_semaphore 2"); /* 20160423 */
|
||||
else if(semaphore >= 2) { /* button1 click to select another instance while edit prop dialog open */
|
||||
if(button==Button1 && state==0 && tclgetvar("edit_symbol_prop_new_sel")[0]) {
|
||||
tcleval("set edit_symbol_prop_new_sel 1; .dialog.f1.b1 invoke"); /* invoke 'OK' of edit prop dialog */
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ void print_image()
|
|||
if(!plotfile[0]) {
|
||||
my_strdup(60, &tmpstring, "tk_getSaveFile -title {Select destination file} -initialdir $env(PWD)");
|
||||
tcleval(tmpstring);
|
||||
r = Tcl_GetStringResult(interp);
|
||||
r = tclresult();
|
||||
my_free(717, &tmpstring);
|
||||
if(r[0]) my_strncpy(plotfile, r, S(plotfile));
|
||||
else return;
|
||||
|
|
|
|||
|
|
@ -793,34 +793,6 @@ static char *old_prop=NULL;
|
|||
static int i=-1;
|
||||
static int netlist_commands;
|
||||
|
||||
void fill_symbol_editprop_form(int x)
|
||||
{
|
||||
/* 20160423 if no more stuff selected close editprop toplevel form */
|
||||
if(lastselected==0 || selectedgroup[0].type!=ELEMENT) {
|
||||
Tcl_GlobalEval(interp, "set editprop_semaphore 0");
|
||||
return;
|
||||
}
|
||||
i=selectedgroup[0].n;
|
||||
dbg(1, "fill_symbol_editprop_form(): element %d property=%s\n",i,inst_ptr[i].prop_ptr);
|
||||
dbg(1, "fill_symbol_editprop_form(): modified=%d\n", modified);
|
||||
dbg(1, "fill_symbol_editprop_form(): symbol=%s\n", inst_ptr[i].name);
|
||||
if(inst_ptr[i].prop_ptr!=NULL) {
|
||||
dbg(1, "fill_symbol_editprop_form(): element %d property=%s\n",i,inst_ptr[i].prop_ptr);
|
||||
|
||||
if(netlist_commands && x==1) {
|
||||
/* 20070318 */
|
||||
tclsetvar("retval",get_tok_value( inst_ptr[i].prop_ptr,"value",0));
|
||||
} else {
|
||||
tclsetvar("retval",inst_ptr[i].prop_ptr);
|
||||
}
|
||||
}
|
||||
else {
|
||||
tclsetvar("retval","");
|
||||
}
|
||||
my_strdup(91, &old_prop, inst_ptr[i].prop_ptr);
|
||||
tclsetvar("symbol",inst_ptr[i].name);
|
||||
}
|
||||
|
||||
/* x=0 use text widget x=1 use vim editor */
|
||||
void edit_symbol_property(int x)
|
||||
{
|
||||
|
|
@ -831,11 +803,22 @@ void edit_symbol_property(int x)
|
|||
if ((inst_ptr[i].ptr + instdef)->type!=NULL)
|
||||
netlist_commands = !strcmp( (inst_ptr[i].ptr+instdef)->type, "netlist_commands");
|
||||
|
||||
fill_symbol_editprop_form( x);
|
||||
if(inst_ptr[i].prop_ptr!=NULL) {
|
||||
if(netlist_commands && x==1) {
|
||||
tclsetvar("retval",get_tok_value( inst_ptr[i].prop_ptr,"value",0));
|
||||
} else {
|
||||
tclsetvar("retval",inst_ptr[i].prop_ptr);
|
||||
}
|
||||
}
|
||||
else {
|
||||
tclsetvar("retval","");
|
||||
}
|
||||
my_strdup(91, &old_prop, inst_ptr[i].prop_ptr);
|
||||
tclsetvar("symbol",inst_ptr[i].name);
|
||||
|
||||
if(x==0) {
|
||||
tcleval("edit_prop {Input property:}");
|
||||
my_strdup(77, &result, Tcl_GetStringResult(interp));
|
||||
my_strdup(77, &result, tclresult());
|
||||
}
|
||||
else {
|
||||
/* edit_vi_netlist_prop will replace \" with " before editing,
|
||||
|
|
@ -844,7 +827,7 @@ void edit_symbol_property(int x)
|
|||
if(netlist_commands && x==1) tcleval("edit_vi_netlist_prop {Input property:}");
|
||||
else if(x==1) tcleval("edit_vi_prop {Input property:}");
|
||||
else if(x==2) tcleval("viewdata $::retval");
|
||||
my_strdup(78, &result, Tcl_GetStringResult(interp));
|
||||
my_strdup(78, &result, tclresult());
|
||||
}
|
||||
dbg(1, "edit_symbol_property(): before update_symbol, modified=%d\n", modified);
|
||||
update_symbol(result, x);
|
||||
|
|
@ -868,6 +851,7 @@ void update_symbol(const char *result, int x)
|
|||
int cond, allow_change_name;
|
||||
int pushed=0; /* 20150327 */
|
||||
|
||||
dbg(1, "update_symbol(): entering\n");
|
||||
i=selectedgroup[0].n; /* 20110413 */
|
||||
if(!result) {
|
||||
dbg(1, "update_symbol(): edit symbol prop aborted\n");
|
||||
|
|
@ -1035,14 +1019,6 @@ void update_symbol(const char *result, int x)
|
|||
dbg(1, "update_symbol(): redrawing inst_ptr.txtprop string\n");
|
||||
draw();
|
||||
bbox(END,0.0,0.0,0.0,0.0);
|
||||
/* 20160308 added if(), leave edited objects selected after updating properties */
|
||||
/* unless i am clicking another element with edit property dialog box open */
|
||||
/* in this latter case the last pointed element remains selected. */
|
||||
if( !strcmp(tclgetvar("editprop_semaphore"), "2")) {
|
||||
unselect_all();
|
||||
select_object(mousex,mousey,SELECTED, 0);
|
||||
}
|
||||
rebuild_selected_array();
|
||||
my_free(731, &name);
|
||||
my_free(732, &ptr);
|
||||
my_free(733, &new_prop);
|
||||
|
|
@ -1147,7 +1123,7 @@ void edit_property(int x)
|
|||
tcleval("edit_vi_prop {Global schematic property:}");
|
||||
}
|
||||
else if(x==2) tcleval("viewdata $::retval");
|
||||
dbg(1, "edit_property(): done executing edit_vi_prop, result=%s\n",Tcl_GetStringResult(interp));
|
||||
dbg(1, "edit_property(): done executing edit_vi_prop, result=%s\n",tclresult());
|
||||
dbg(1, "edit_property(): rcode=%s\n",tclgetvar("rcode") );
|
||||
if(strcmp(tclgetvar("rcode"),"") )
|
||||
{
|
||||
|
|
@ -1202,6 +1178,17 @@ void edit_property(int x)
|
|||
{
|
||||
case ELEMENT:
|
||||
edit_symbol_property(x);
|
||||
while( x == 0 && tclgetvar("edit_symbol_prop_new_sel")[0] == '1' ) {
|
||||
unselect_all();
|
||||
select_object(mousex, mousey, SELECTED, 0);
|
||||
rebuild_selected_array();
|
||||
if(lastselected && selectedgroup[0].type ==ELEMENT) {
|
||||
edit_symbol_property(0);
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
tclsetvar("edit_symbol_prop_new_sel", "");
|
||||
break;
|
||||
case ARC:
|
||||
edit_arc_property();
|
||||
|
|
|
|||
|
|
@ -373,14 +373,14 @@ int check_lib(char *s)
|
|||
|
||||
found=0;
|
||||
tcleval("llength $xschem_libs");
|
||||
range = atoi(Tcl_GetStringResult(interp));
|
||||
range = atoi(tclresult());
|
||||
dbg(1, "check_lib(): %s, range=%d\n", s, range);
|
||||
|
||||
for(i=0;i<range;i++){
|
||||
my_snprintf(str, S(str), "lindex $xschem_libs %d",i);
|
||||
tcleval(str);
|
||||
dbg(1, "check_lib(): xschem_libs=%s\n", Tcl_GetStringResult(interp));
|
||||
if( strstr(s,Tcl_GetStringResult(interp))) found=1;
|
||||
dbg(1, "check_lib(): xschem_libs=%s\n", tclresult());
|
||||
if( strstr(s,tclresult())) found=1;
|
||||
}
|
||||
if(found) return 0;
|
||||
else return 1;
|
||||
|
|
|
|||
|
|
@ -290,8 +290,8 @@ void merge_file(int selection_load, const char ext[])
|
|||
if(!strcmp(ext,"")) { /* 20071215 */
|
||||
my_snprintf(tmp, S(tmp), "load_file_dialog {Merge file} {.sch.sym} INITIALLOADDIR", ext);
|
||||
tcleval(tmp);
|
||||
if(!strcmp(Tcl_GetStringResult(interp),"")) return;
|
||||
my_strncpy(name, (char *)Tcl_GetStringResult(interp), S(name)); /* 20180925 */
|
||||
if(!strcmp(tclresult(),"")) return;
|
||||
my_strncpy(name, (char *)tclresult(), S(name)); /* 20180925 */
|
||||
}
|
||||
else { /* 20071215 */
|
||||
my_strncpy(name, ext, S(name));
|
||||
|
|
|
|||
|
|
@ -367,7 +367,7 @@ static void fill_ps_colors()
|
|||
for(i=0;i<cadlayers;i++) {
|
||||
my_snprintf(s, S(s), "lindex $ps_colors %d", i);
|
||||
tcleval( s);
|
||||
sscanf(Tcl_GetStringResult(interp),"%x", &c);
|
||||
sscanf(tclresult(),"%x", &c);
|
||||
ps_colors[i].red = (c & 0xff0000) >> 16;
|
||||
ps_colors[i].green = (c & 0x00ff00) >> 8;
|
||||
ps_colors[i].blue = (c & 0x0000ff);
|
||||
|
|
@ -389,7 +389,7 @@ void ps_draw(void)
|
|||
my_strdup(59, &tmp, "tk_getSaveFile -title {Select destination file} -initialdir $env(PWD)");
|
||||
tcleval(tmp);
|
||||
my_free(878, &tmp);
|
||||
r = Tcl_GetStringResult(interp);
|
||||
r = tclresult();
|
||||
if(r[0]) my_strncpy(plotfile, r, S(plotfile));
|
||||
else {
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -1838,7 +1838,7 @@ void create_sch_from_sym(void)
|
|||
my_strcat(354, &savecmd, schname);
|
||||
my_strcat(355, &savecmd, " ?\nWARNING: This schematic file already exists, it will be overwritten\"");
|
||||
tcleval(savecmd);
|
||||
if(strcmp(Tcl_GetStringResult(interp), "yes") ) {
|
||||
if(strcmp(tclresult(), "yes") ) {
|
||||
my_free(914, &savecmd);
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -213,7 +213,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
else if(!strcmp(argv[1],"make_symbol"))
|
||||
{
|
||||
if(has_x) tcleval("tk_messageBox -type okcancel -message {do you want to make symbol view ?}");
|
||||
if(!has_x || strcmp(Tcl_GetStringResult(interp),"ok")==0)
|
||||
if(!has_x || strcmp(tclresult(),"ok")==0)
|
||||
if(current_type==SCHEMATIC)
|
||||
{
|
||||
save_schematic(schematic[currentsch]);
|
||||
|
|
@ -373,7 +373,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
{
|
||||
if(modified && has_x) {
|
||||
tcleval("tk_messageBox -type okcancel -message {UNSAVED data: want to exit?}");
|
||||
if(strcmp(Tcl_GetStringResult(interp),"ok")==0) tcleval( "exit");
|
||||
if(strcmp(tclresult(),"ok")==0) tcleval( "exit");
|
||||
}
|
||||
else tcleval( "exit");
|
||||
Tcl_ResetResult(interp);
|
||||
|
|
@ -1109,12 +1109,9 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
}
|
||||
}
|
||||
|
||||
else if(!strcmp(argv[1],"fill_symbol_editprop_form") ) {
|
||||
fill_symbol_editprop_form(0);
|
||||
}
|
||||
|
||||
else if(!strcmp(argv[1],"update_symbol") ) {
|
||||
if(argc >= 3) update_symbol(argv[2],0);
|
||||
else update_symbol(NULL, 0);
|
||||
}
|
||||
|
||||
else if(!strcmp(argv[1], "print_hilight_net") && argc == 3) {
|
||||
|
|
@ -1941,10 +1938,14 @@ void tcleval(const char str[])
|
|||
{
|
||||
dbg(2, "tcleval(): %s\n", str);
|
||||
/* if( Tcl_EvalEx(interp, str, -1, TCL_EVAL_GLOBAL) != TCL_OK) {*/
|
||||
if( Tcl_Eval(interp, str) != TCL_OK) {
|
||||
if( Tcl_GlobalEval(interp, str) != TCL_OK) {
|
||||
fprintf(errfp, "tcleval(): evaluation of script: %s failed\n", str);
|
||||
}
|
||||
}
|
||||
const char *tclresult(void)
|
||||
{
|
||||
return Tcl_GetStringResult(interp);
|
||||
}
|
||||
|
||||
void tclsetvar(const char *s, const char *value)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -393,7 +393,7 @@ static void fill_svg_colors()
|
|||
for(i=0;i<cadlayers;i++) {
|
||||
my_snprintf(s, S(s), "lindex $svg_colors %d", i);
|
||||
tcleval( s);
|
||||
sscanf(Tcl_GetStringResult(interp),"%x", &c);
|
||||
sscanf(tclresult(),"%x", &c);
|
||||
svg_colors[i].red = (c & 0xff0000) >> 16;
|
||||
svg_colors[i].green = (c & 0x00ff00) >> 8;
|
||||
svg_colors[i].blue = (c & 0x0000ff);
|
||||
|
|
@ -419,7 +419,7 @@ void svg_draw(void)
|
|||
if(!plotfile[0]) {
|
||||
my_strdup(61, &tmpstring, "tk_getSaveFile -title {Select destination file} -initialdir $env(PWD)");
|
||||
tcleval(tmpstring);
|
||||
r = Tcl_GetStringResult(interp);
|
||||
r = tclresult();
|
||||
my_free(963, &tmpstring);
|
||||
if(r[0]) my_strncpy(plotfile, r, S(plotfile));
|
||||
else return;
|
||||
|
|
|
|||
|
|
@ -1544,7 +1544,7 @@ void print_spice_element(FILE *fd, int inst)
|
|||
my_snprintf(tclcmd, s, "tclpropeval {%s} {%s} {%s}", token, name, inst_ptr[inst].name);
|
||||
dbg(1, "tclpropeval {%s} {%s} {%s}", token, name, inst_ptr[inst].name);
|
||||
tcleval(tclcmd);
|
||||
fprintf(fd, "%s", Tcl_GetStringResult(interp));
|
||||
fprintf(fd, "%s", tclresult());
|
||||
my_free(1018, &tclcmd);
|
||||
} /* /20171029 */
|
||||
/* 20151028 dont print escaping backslashes */
|
||||
|
|
@ -1798,7 +1798,7 @@ void print_tedax_element(FILE *fd, int inst)
|
|||
Tcl_ResetResult(interp);
|
||||
my_snprintf(tclcmd, s, "tclpropeval {%s} {%s} {%s}", token, name, inst_ptr[inst].name);
|
||||
tcleval(tclcmd);
|
||||
fprintf(fd, "%s", Tcl_GetStringResult(interp));
|
||||
fprintf(fd, "%s", tclresult());
|
||||
my_free(1032, &tclcmd);
|
||||
/* fprintf(errfp, "%s\n", tclcmd); */
|
||||
} /* /20171029 */
|
||||
|
|
@ -2175,7 +2175,7 @@ void print_vhdl_primitive(FILE *fd, int inst) /* netlist primitives, 20071217 *
|
|||
Tcl_ResetResult(interp);
|
||||
my_snprintf(tclcmd, s, "tclpropeval {%s} {%s} {%s}", token, name, inst_ptr[inst].name);
|
||||
tcleval(tclcmd);
|
||||
fprintf(fd, "%s", Tcl_GetStringResult(interp));
|
||||
fprintf(fd, "%s", tclresult());
|
||||
my_free(1049, &tclcmd);
|
||||
}
|
||||
|
||||
|
|
@ -2347,7 +2347,7 @@ void print_verilog_primitive(FILE *fd, int inst) /* netlist switch level primiti
|
|||
Tcl_ResetResult(interp);
|
||||
my_snprintf(tclcmd, s, "tclpropeval {%s} {%s} {%s}", token, name, inst_ptr[inst].name);
|
||||
tcleval(tclcmd);
|
||||
fprintf(fd, "%s", Tcl_GetStringResult(interp));
|
||||
fprintf(fd, "%s", tclresult());
|
||||
my_free(1057, &tclcmd);
|
||||
}
|
||||
/* 20180911 dont print escaping backslashes */
|
||||
|
|
|
|||
|
|
@ -17,11 +17,12 @@ END { endfile(_filename_) }
|
|||
BEGIN{
|
||||
}
|
||||
|
||||
/if(.*) *my_free/{
|
||||
$0 = gensub(/( +)(if\(.*\) +)(my_free.*)/, "\\1\\3","1")
|
||||
/Tcl_GetStringResult\(interp\)/{
|
||||
found = 1
|
||||
gsub(/Tcl_GetStringResult\(interp\)/, "tclresult()")
|
||||
}
|
||||
|
||||
|
||||
function replace_pattern(old, new)
|
||||
{
|
||||
if($0 ~ old) {
|
||||
|
|
|
|||
28
src/xinit.c
28
src/xinit.c
|
|
@ -165,7 +165,7 @@ void windowid()
|
|||
mainwindow=Tk_MainWindow(interp);
|
||||
display = Tk_Display(mainwindow);
|
||||
tcleval( "winfo id .");
|
||||
sscanf(Tcl_GetStringResult(interp), "0x%x", (unsigned int *) &ww);
|
||||
sscanf(tclresult(), "0x%x", (unsigned int *) &ww);
|
||||
framewin = ww;
|
||||
XQueryTree(display, framewin, &rootwindow, &parent_of_topwindow, &framewin_child_ptr, &framewindow_nchildren);
|
||||
dbg(1,"framewinID=%x\n", (unsigned int) framewin);
|
||||
|
|
@ -393,9 +393,9 @@ void init_color_array(double dim)
|
|||
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",Tcl_GetStringResult(interp));
|
||||
dbg(2, "init_color_array(): color:%s\n",tclresult());
|
||||
|
||||
sscanf(Tcl_GetStringResult(interp), "#%02x%02x%02x", &r, &g, &b);/* 20171123 */
|
||||
sscanf(tclresult(), "#%02x%02x%02x", &r, &g, &b);/* 20171123 */
|
||||
rr=r; gg=g; bb=b;
|
||||
|
||||
if( (i!=BACKLAYER) ) {
|
||||
|
|
@ -672,17 +672,17 @@ int build_colors(double dim) /* 20171113 */
|
|||
int i;
|
||||
if(dark_colorscheme) {
|
||||
tcleval("llength $dark_colors");
|
||||
if(atoi(Tcl_GetStringResult(interp))>=cadlayers){
|
||||
if(atoi(tclresult())>=cadlayers){
|
||||
tcleval("set colors $dark_colors");
|
||||
}
|
||||
} else {
|
||||
tcleval("llength $light_colors");
|
||||
if(atoi(Tcl_GetStringResult(interp)) >=cadlayers){
|
||||
if(atoi(tclresult()) >=cadlayers){
|
||||
tcleval("set colors $light_colors");
|
||||
}
|
||||
}
|
||||
tcleval("llength $colors");
|
||||
if(atoi(Tcl_GetStringResult(interp))<cadlayers){
|
||||
if(atoi(tclresult())<cadlayers){
|
||||
fprintf(errfp,"Tcl var colors not set correctly\n");
|
||||
return -1; /* fail */
|
||||
}
|
||||
|
|
@ -738,11 +738,11 @@ int source_tcl_file(char *s)
|
|||
char tmp[1024];
|
||||
if(Tcl_EvalFile(interp, s)==TCL_ERROR) {
|
||||
fprintf(errfp, "Tcl_AppInit() error: can not execute %s, please fix:\n", s);
|
||||
fprintf(errfp, "%s", Tcl_GetStringResult(interp));
|
||||
fprintf(errfp, "%s", tclresult());
|
||||
fprintf(errfp, "\n");
|
||||
my_snprintf(tmp, S(tmp), "tk_messageBox -icon error -type ok -message \
|
||||
{Tcl_AppInit() err 1: can not execute %s, please fix:\n %s}",
|
||||
s, Tcl_GetStringResult(interp));
|
||||
s, tclresult());
|
||||
if(has_x) {
|
||||
tcleval( "wm withdraw ."); /* 20161217 */
|
||||
tcleval( tmp); /* 20161217 */
|
||||
|
|
@ -882,7 +882,7 @@ int Tcl_AppInit(Tcl_Interp *inter)
|
|||
#ifdef __unix__
|
||||
my_snprintf(tmp, S(tmp),"regsub -all {~/} {.:%s} {%s/}", XSCHEM_LIBRARY_PATH, home_dir);
|
||||
tcleval(tmp);
|
||||
tclsetvar("XSCHEM_LIBRARY_PATH", Tcl_GetStringResult(interp));
|
||||
tclsetvar("XSCHEM_LIBRARY_PATH", tclresult());
|
||||
|
||||
running_in_src_dir = 0;
|
||||
/* test if running xschem in src/ dir (usually for testing) */
|
||||
|
|
@ -891,7 +891,7 @@ int Tcl_AppInit(Tcl_Interp *inter)
|
|||
tclsetvar("XSCHEM_SHAREDIR",pwd_dir); /* for testing xschem builds in src dir*/
|
||||
my_snprintf(tmp, S(tmp), "subst .:[file normalize \"%s/../xschem_library/devices\"]", pwd_dir);
|
||||
tcleval(tmp);
|
||||
tclsetvar("XSCHEM_LIBRARY_PATH", Tcl_GetStringResult(interp));
|
||||
tclsetvar("XSCHEM_LIBRARY_PATH", tclresult());
|
||||
} else if( !stat(XSCHEM_SHAREDIR, &buf) ) { /* 20180918 */
|
||||
tclsetvar("XSCHEM_SHAREDIR",XSCHEM_SHAREDIR);
|
||||
/* ... else give up searching, may set later after loading xschemrc */
|
||||
|
|
@ -899,12 +899,12 @@ int Tcl_AppInit(Tcl_Interp *inter)
|
|||
/* create user conf dir , remove ~ if present */
|
||||
my_snprintf(tmp, S(tmp),"regsub {^~/} {%s} {%s/}", USER_CONF_DIR, home_dir);
|
||||
tcleval(tmp);
|
||||
my_snprintf(user_conf_dir, S(user_conf_dir), "%s", Tcl_GetStringResult(interp));
|
||||
my_snprintf(user_conf_dir, S(user_conf_dir), "%s", tclresult());
|
||||
tclsetvar("USER_CONF_DIR", user_conf_dir);
|
||||
#else
|
||||
my_snprintf(tmp, S(tmp),"regsub -all {~/} {.;%s} {%s/}", XSCHEM_LIBRARY_PATH, home_dir);
|
||||
tcleval(tmp);
|
||||
tclsetvar("XSCHEM_LIBRARY_PATH", Tcl_GetStringResult(interp));
|
||||
tclsetvar("XSCHEM_LIBRARY_PATH", tclresult());
|
||||
char install_dir[MAX_PATH];
|
||||
GetModuleFileNameA(NULL, install_dir, MAX_PATH);
|
||||
change_to_unix_fn(install_dir);
|
||||
|
|
@ -914,7 +914,7 @@ int Tcl_AppInit(Tcl_Interp *inter)
|
|||
my_snprintf(tmp, S(tmp), "regexp {bin$} \"%s\"", install_dir); /* debugging in Visual Studio will not have bin */
|
||||
tcleval(tmp);
|
||||
running_in_src_dir = 0;
|
||||
if (atoi(Tcl_GetStringResult(interp)) == 0)
|
||||
if (atoi(tclresult()) == 0)
|
||||
running_in_src_dir = 1; /* no bin, so it's running in Visual studio source directory*/
|
||||
char* gxschem_library=NULL, *xschem_sharedir=NULL;
|
||||
if ((xschem_sharedir=getenv("XSCHEM_SHAREDIR")) != NULL) {
|
||||
|
|
@ -1371,7 +1371,7 @@ int Tcl_AppInit(Tcl_Interp *inter)
|
|||
remove_symbols();
|
||||
my_snprintf(s, S(s), "file normalize \"%s\"", filename);
|
||||
tcleval(s);
|
||||
load_schematic(1, abs_sym_path(Tcl_GetStringResult(interp), ""), 1); /* 20180925.1 */
|
||||
load_schematic(1, abs_sym_path(tclresult(), ""), 1); /* 20180925.1 */
|
||||
}
|
||||
else {
|
||||
char * tmp; /* 20121110 */
|
||||
|
|
|
|||
|
|
@ -872,6 +872,7 @@ extern void edit_property(int x);
|
|||
extern int xschem(ClientData clientdata, Tcl_Interp *interp,
|
||||
int argc, const char * argv[]);
|
||||
extern void tcleval(const char str[]);
|
||||
extern const char *tclresult(void);
|
||||
extern const char *tclgetvar(const char *s);
|
||||
extern void tclsetvar(const char *s, const char *value);
|
||||
extern void statusmsg(char str[],int n);
|
||||
|
|
@ -983,7 +984,6 @@ extern void preview_window(const char *what, const char *tk_win_path, const char
|
|||
extern int window_state (Display *disp, Window win, char *arg);
|
||||
extern void toggle_fullscreen();
|
||||
extern void toggle_only_probes(); /* 20110112 */
|
||||
extern void fill_symbol_editprop_form(int x);
|
||||
extern void update_symbol(const char *result, int x);
|
||||
extern void tclexit(ClientData s);
|
||||
extern int build_colors(double dim); /* reparse the TCL 'colors' list and reassign colors 20171113 */
|
||||
|
|
|
|||
|
|
@ -1969,12 +1969,11 @@ proc change_color {} {
|
|||
}
|
||||
|
||||
proc edit_prop {txtlabel} {
|
||||
global edit_prop_default_geometry infowindow_text selected_tok
|
||||
global prev_symbol retval symbol rcode no_change_attrs preserve_unchanged_attrs copy_cell tcl_debug editprop_semaphore
|
||||
global edit_prop_size infowindow_text selected_tok edit_symbol_prop_new_sel edit_prop_pos
|
||||
global prev_symbol retval symbol rcode no_change_attrs preserve_unchanged_attrs copy_cell tcl_debug
|
||||
global user_wants_copy_cell editprop_sympath
|
||||
set user_wants_copy_cell 0
|
||||
set rcode {}
|
||||
set editprop_semaphore 1
|
||||
if $tcl_debug<=-1 then {puts " edit_prop{}: retval=$retval"}
|
||||
if { [winfo exists .dialog] } return
|
||||
toplevel .dialog -class Dialog
|
||||
|
|
@ -1982,18 +1981,14 @@ proc edit_prop {txtlabel} {
|
|||
set X [expr [winfo pointerx .dialog] - 60]
|
||||
set Y [expr [winfo pointery .dialog] - 35]
|
||||
|
||||
# 20100203
|
||||
if { $::wm_fix } { tkwait visibility .dialog }
|
||||
|
||||
wm geometry .dialog "${edit_prop_default_geometry}+$X+$Y"
|
||||
|
||||
# 20160325 change and remember widget size
|
||||
bind .dialog <Configure> {
|
||||
# puts [wm geometry .dialog]
|
||||
set geom [wm geometry .dialog]
|
||||
regsub {\+.*} $geom {} geom
|
||||
set edit_prop_default_geometry $geom
|
||||
regsub {\+.*} $geom {} edit_prop_size
|
||||
regsub {[^+]*\+} $geom {+} edit_prop_pos
|
||||
}
|
||||
wm geometry .dialog "${edit_prop_size}+$X+$Y"
|
||||
|
||||
set prev_symbol $symbol
|
||||
set editprop_sympath [file dirname [abs_sym_path $symbol]]
|
||||
|
|
@ -2027,7 +2022,6 @@ proc edit_prop {txtlabel} {
|
|||
set symbol [.dialog.f1.e2 get]
|
||||
set abssymbol [abs_sym_path $symbol]
|
||||
set rcode {ok}
|
||||
set editprop_semaphore 0
|
||||
set user_wants_copy_cell $copy_cell
|
||||
set prev_symbol [abs_sym_path $prev_symbol]
|
||||
if { ($abssymbol ne $prev_symbol) && $copy_cell } {
|
||||
|
|
@ -2051,19 +2045,21 @@ proc edit_prop {txtlabel} {
|
|||
# puts "file copy [file rootname $prev_symbol].sym [file rootname $abssymbol].sym"
|
||||
}
|
||||
}
|
||||
## 20190326
|
||||
}
|
||||
#puts "symbol: $symbol , prev_symbol: $prev_symbol"
|
||||
set copy_cell 0 ;# 20120919
|
||||
destroy .dialog
|
||||
}
|
||||
button .dialog.f1.b2 -text "Cancel" -command {
|
||||
set rcode {}
|
||||
set editprop_semaphore 0
|
||||
set edit_symbol_prop_new_sel {}
|
||||
destroy .dialog
|
||||
}
|
||||
|
||||
wm protocol .dialog WM_DELETE_WINDOW {
|
||||
set rcode {}
|
||||
set editprop_semaphore 0
|
||||
set edit_symbol_prop_new_sel {}
|
||||
destroy .dialog
|
||||
}
|
||||
|
||||
button .dialog.f1.b3 -text "Load" -command {
|
||||
|
|
@ -2106,39 +2102,12 @@ proc edit_prop {txtlabel} {
|
|||
.dialog.f1.b2 invoke
|
||||
}
|
||||
}
|
||||
#tkwait visibility .dialog
|
||||
#grab set .dialog
|
||||
#focus .dialog.e1
|
||||
#tkwait window .dialog
|
||||
while {1} {
|
||||
tkwait variable editprop_semaphore
|
||||
if { $editprop_semaphore == 2 } {
|
||||
set retval [.dialog.e1 get 1.0 {end - 1 chars}]
|
||||
set symbol [ .dialog.f1.e2 get]
|
||||
xschem update_symbol ok
|
||||
set editprop_semaphore 1
|
||||
xschem fill_symbol_editprop_form
|
||||
set editprop_sympath [file dirname [abs_sym_path $symbol]]
|
||||
|
||||
# 20160423 no more setected stuff--> close
|
||||
if {$editprop_semaphore==0 } {
|
||||
break
|
||||
}
|
||||
# 20110325 update symbol variable after clicking another element to avoid
|
||||
# modified flag to be set even when nothing changed
|
||||
## set symbol [ .dialog.f1.e2 get]
|
||||
|
||||
.dialog.e1 delete 1.0 end
|
||||
.dialog.e1 insert 1.0 $retval
|
||||
.dialog.f1.e2 delete 0 end
|
||||
.dialog.f1.e2 insert 0 $symbol
|
||||
} else {
|
||||
break
|
||||
}
|
||||
|
||||
if {$edit_symbol_prop_new_sel == 1} {
|
||||
wm geometry .dialog $edit_prop_pos
|
||||
}
|
||||
destroy .dialog
|
||||
set editprop_semaphore 0
|
||||
set edit_symbol_prop_new_sel 0
|
||||
tkwait window .dialog
|
||||
return $rcode
|
||||
}
|
||||
|
||||
|
|
@ -2602,7 +2571,9 @@ proc reconfigure_layers_menu {} {
|
|||
|
||||
proc get_file_path {ff} {
|
||||
global env
|
||||
if { [regexp {/} $ff] } { return $ff }
|
||||
# Absolute path ? return as is.
|
||||
# Linux Windows
|
||||
if { [regexp {^/} $ff] || [regexp {^[a-zA-Z]:} $ff] } { return $ff }
|
||||
if {$::OS == "Windows"} {
|
||||
set pathlist [split $env(PATH) \;]
|
||||
} else {
|
||||
|
|
@ -2612,6 +2583,7 @@ proc get_file_path {ff} {
|
|||
set ii $i/$ff
|
||||
if { [file exists $ii]} {return $ii}
|
||||
}
|
||||
# nothing found, return $ff as is and hope for the best :-)
|
||||
return $ff
|
||||
}
|
||||
|
||||
|
|
@ -2865,10 +2837,10 @@ set_ne disable_unique_names 1
|
|||
set_ne sym_txt 1
|
||||
set_ne show_infowindow 0
|
||||
set_ne symbol_width 150
|
||||
set_ne editprop_semaphore 0
|
||||
set_ne editor {gvim -f}
|
||||
set_ne rainbow_colors 0
|
||||
set_ne initial_geometry {700x448+10+10}
|
||||
set_ne edit_symbol_prop_new_sel {}
|
||||
#20161102
|
||||
set_ne launcher_var {}
|
||||
set_ne launcher_default_program {xdg-open}
|
||||
|
|
@ -2879,7 +2851,7 @@ set_ne auto_hilight 0
|
|||
set_ne to_png {gm convert}
|
||||
|
||||
## 20160325 remember edit_prop widget size
|
||||
set_ne edit_prop_default_geometry 80x12
|
||||
set_ne edit_prop_size 80x12
|
||||
set_ne text_line_default_geometry 80x12
|
||||
set_ne terminal xterm
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
v {xschem version=2.9.5_RC6 file_version=1.1}
|
||||
v {xschem version=2.9.7 file_version=1.2}
|
||||
G {type=pnp
|
||||
format="@spiceprefix@name @pinlist @model area=@area"
|
||||
tedax_format="footprint @name @footprint
|
||||
|
|
@ -19,7 +19,7 @@ B 5 17.5 27.5 22.5 32.5 {name=C dir=inout pinnumber=3}
|
|||
B 5 -22.5 -2.5 -17.5 2.5 {name=B dir=in pinnumber=1}
|
||||
B 5 17.5 -32.5 22.5 -27.5 {name=E dir=inout pinnumber=2}
|
||||
P 4 4 0 -10 15 -15 5 -25 0 -10 {fill=true}
|
||||
T {@device} 20 -13.75 0 0 0.2 0.2 {}
|
||||
T {@model} 20 -13.75 0 0 0.2 0.2 {}
|
||||
T {@name} 20 1.25 0 0 0.2 0.2 {}
|
||||
T {@#2:pinnumber} 25 -28.75 0 0 0.2 0.2 {layer=13}
|
||||
T {@#0:pinnumber} 25 17.5 0 0 0.2 0.2 {layer=13}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
v {xschem version=2.9.5_RC5 file_version=1.1}
|
||||
v {xschem version=2.9.7 file_version=1.2}
|
||||
G {type=diode
|
||||
format="@spiceprefix@name @pinlist @model"
|
||||
tedax_format="footprint @name @footprint
|
||||
|
|
@ -16,6 +16,6 @@ B 5 -2.5 -32.5 2.5 -27.5 {name=p dir=inout pinnumber=1}
|
|||
B 5 -2.5 27.5 2.5 32.5 {name=m dir=inout pinnumber=2}
|
||||
P 4 4 -0 5 -10 -5 10 -5 -0 5 {fill=true}
|
||||
T {@name} 2.5 -20 0 0 0.2 0.2 {}
|
||||
T {@device} 2.5 12.5 0 0 0.2 0.2 {}
|
||||
T {@model} 2.5 12.5 0 0 0.2 0.2 {}
|
||||
T {@#0:pinnumber} -5 -26.25 0 1 0.2 0.2 {layer=13}
|
||||
T {@#1:pinnumber} -5 17.5 0 1 0.2 0.2 {layer=13}
|
||||
|
|
|
|||
Loading…
Reference in New Issue