From c05c177885a491dc6d48fc1caa75cd4acd4f7174 Mon Sep 17 00:00:00 2001 From: stefan schippers Date: Wed, 16 Aug 2023 08:45:41 +0200 Subject: [PATCH] add "postinit_commands" variable that can be set in xschemrc file, this variable may contain commands that will be executed after completing startup. Example: set postinit_commands {xschem set format xyce_format} --- src/xinit.c | 3 +++ src/xschem.tcl | 7 +++++++ 2 files changed, 10 insertions(+) diff --git a/src/xinit.c b/src/xinit.c index 9016c561..4c81540d 100644 --- a/src/xinit.c +++ b/src/xinit.c @@ -2818,6 +2818,9 @@ int Tcl_AppInit(Tcl_Interp *inter) tcleval(cli_opt_tcl_post_command); } + /* Execute tcl commands given in tcl variable postinit_commands if existing */ + tcleval("eval_postinit_commands"); + if(cli_opt_quit) { tcleval("exit"); } diff --git a/src/xschem.tcl b/src/xschem.tcl index 57229bed..4a97d479 100644 --- a/src/xschem.tcl +++ b/src/xschem.tcl @@ -6477,6 +6477,13 @@ proc source_user_tcl_files {} { } } +proc eval_postinit_commands {} { + global postinit_commands + if {[info exists postinit_commands]} { + catch {eval $postinit_commands} + } +} + proc setup_tcp_xschem { {port_number {}} } { global xschem_listen_port xschem_server_getdata