subst_token(): better token removal (remove space or newline to avoid having many remaining blanks); `netlist_postprocess` xschemrc tcl variable to insert commands after netlist is created
This commit is contained in:
parent
53fda635c9
commit
a4ce2d1b64
|
|
@ -3836,43 +3836,8 @@ int rstate; /* (reduced state, without ShiftMask) */
|
|||
}
|
||||
if(key=='n' && rstate==0) /* hierarchical netlist */
|
||||
{
|
||||
int err = 0;
|
||||
yyparse_error = 0;
|
||||
if(xctx->semaphore >= 2) break;
|
||||
unselect_all(1);
|
||||
if(set_netlist_dir(0, NULL)) {
|
||||
dbg(1, "callback(): -------------\n");
|
||||
if(xctx->netlist_type == CAD_SPICE_NETLIST)
|
||||
err = global_spice_netlist(1, 1);
|
||||
else if(xctx->netlist_type == CAD_VHDL_NETLIST)
|
||||
err = global_vhdl_netlist(1, 1);
|
||||
else if(xctx->netlist_type == CAD_VERILOG_NETLIST)
|
||||
err = global_verilog_netlist(1, 1);
|
||||
else if(xctx->netlist_type == CAD_TEDAX_NETLIST)
|
||||
err = global_tedax_netlist(1, 1);
|
||||
else
|
||||
tcleval("tk_messageBox -type ok -parent [xschem get topwindow] "
|
||||
"-message {Please Set netlisting mode (Options menu)}");
|
||||
|
||||
dbg(1, "callback(): -------------\n");
|
||||
}
|
||||
else {
|
||||
if(has_x) tcleval("alert_ {Can not write into the netlist directory. Please check} {}");
|
||||
else dbg(0, "Can not write into the netlist directory. Please check");
|
||||
err = 1;
|
||||
}
|
||||
if(err) {
|
||||
if(has_x) {
|
||||
tclvareval(xctx->top_path, ".menubar entryconfigure Netlist -background red", NULL);
|
||||
tclvareval("set tctx::", xctx->current_win_path, "_netlist red", NULL);
|
||||
}
|
||||
|
||||
} else {
|
||||
if(has_x) {
|
||||
tclvareval(xctx->top_path, ".menubar entryconfigure Netlist -background Green", NULL);
|
||||
tclvareval("set tctx::", xctx->current_win_path, "_netlist Green", NULL);
|
||||
}
|
||||
}
|
||||
tcleval("xschem netlist -erc");
|
||||
break;
|
||||
}
|
||||
if(key=='N' && rstate == 0) /* current level only netlist */
|
||||
|
|
|
|||
|
|
@ -3377,6 +3377,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
}
|
||||
}
|
||||
tclsetvar("show_infowindow_after_netlist", saveshow);
|
||||
tcleval("eval_netlist_postprocess");
|
||||
set_netlist_dir(1, savedir);
|
||||
if(done_netlist) {
|
||||
if(messages) {
|
||||
|
|
|
|||
|
|
@ -1216,7 +1216,7 @@ const char *subst_token(const char *s, const char *tok, const char *new_val)
|
|||
size_t token_pos=0, result_pos=0, result_save_pos = 0, tmp;
|
||||
int quote=0;
|
||||
int done_subst=0;
|
||||
int escape=0, matched_tok=0;
|
||||
int escape=0, matched_tok=0, removed_tok = 0;
|
||||
char *new_val_copy = NULL;
|
||||
size_t new_val_len;
|
||||
|
||||
|
|
@ -1299,6 +1299,7 @@ const char *subst_token(const char *s, const char *tok, const char *new_val)
|
|||
} else { /* remove token (and value if any) */
|
||||
result_pos = result_save_pos;
|
||||
done_subst = 1;
|
||||
removed_tok = 1;
|
||||
}
|
||||
}
|
||||
result_save_pos = result_pos;
|
||||
|
|
@ -1335,11 +1336,13 @@ const char *subst_token(const char *s, const char *tok, const char *new_val)
|
|||
} else { /* remove token (and value if any) */
|
||||
result_pos = result_save_pos;
|
||||
done_subst = 1;
|
||||
removed_tok = 1;
|
||||
}
|
||||
}
|
||||
state=TOK_VALUE;
|
||||
} else if( state == TOK_VALUE && space && !quote && !escape) {
|
||||
state=TOK_BEGIN;
|
||||
if(matched_tok && removed_tok && (c == '\n' || c == ' ') ) continue;
|
||||
}
|
||||
/* state actions */
|
||||
if(state == TOK_BEGIN) {
|
||||
|
|
|
|||
|
|
@ -8917,6 +8917,15 @@ proc eval_postinit_commands {} {
|
|||
}
|
||||
}
|
||||
|
||||
proc eval_netlist_postprocess {} {
|
||||
global netlist_postprocess
|
||||
if {[info exists netlist_postprocess]} {
|
||||
if {[catch {uplevel #0 $netlist_postprocess} res]} {
|
||||
puts "executing $netlist_postprocess:\n\n$res"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
proc setup_tcp_xschem { {port_number {}} } {
|
||||
global xschem_listen_port xschem_server_getdata
|
||||
|
||||
|
|
|
|||
|
|
@ -524,7 +524,10 @@
|
|||
# }
|
||||
# }
|
||||
|
||||
|
||||
###########################################################################
|
||||
#### TCL COMMANDS TO BE EXECUTED AFTER GENERATING NETLIST
|
||||
###########################################################################
|
||||
# set netlist_postprocess {textfile $netlist_dir/[xschem get netlist_name fallback]}
|
||||
|
||||
###########################################################################
|
||||
#### WEB URL DOWNLOAD HELPER APPLICATION
|
||||
|
|
|
|||
Loading…
Reference in New Issue