From 4136f7cf10f1cf1a9d596f9e91ae9738a9c7405a Mon Sep 17 00:00:00 2001 From: Stefan Frederik Date: Sat, 27 Aug 2022 13:30:30 +0200 Subject: [PATCH] return loaded filename in xschem load command --- scconfig/src/default/deps_default.c | 1 + scconfig/src/default/find.h | 1 + scconfig/src/default/find_time.c | 25 +++++++++++++++++++++++++ src/scheduler.c | 1 + src/xschem.h | 4 ++-- 5 files changed, 30 insertions(+), 2 deletions(-) diff --git a/scconfig/src/default/deps_default.c b/scconfig/src/default/deps_default.c index eefbec2d..aff8c297 100644 --- a/scconfig/src/default/deps_default.c +++ b/scconfig/src/default/deps_default.c @@ -130,6 +130,7 @@ void deps_default_init(void) dep_add("libs/time/clock_gettime/*",find_time_clock_gettime); dep_add("libs/time/CLOCK_MONOTONIC_RAW/*",find_time_CLOCK_MONOTONIC_RAW); dep_add("libs/time/mach_absolute_time/*", find_time_mach_absolute_time); + dep_add("libs/time/QueryPerformanceCounter/*", find_time_QueryPerformanceCounter); dep_add("libs/time/gettimeofday/*", find_time_gettimeofday); dep_add("libs/time/ftime/*", find_time_ftime); dep_add("libs/time/timegm/*", find_time_timegm); diff --git a/scconfig/src/default/find.h b/scconfig/src/default/find.h index cfdec505..e10a0739 100644 --- a/scconfig/src/default/find.h +++ b/scconfig/src/default/find.h @@ -148,6 +148,7 @@ int find_time_Sleep(const char *name, int logdepth, int fatal); int find_time_clock_gettime(const char *name, int logdepth, int fatal); int find_time_CLOCK_MONOTONIC_RAW(const char *name, int logdepth, int fatal); int find_time_mach_absolute_time(const char *name, int logdepth, int fatal); +int find_time_QueryPerformanceCounter(const char *name, int logdepth, int fatal); int find_time_gettimeofday(const char *name, int logdepth, int fatal); int find_time_ftime(const char *name, int logdepth, int fatal); int find_time_timegm(const char *name, int logdepth, int fatal); diff --git a/scconfig/src/default/find_time.c b/scconfig/src/default/find_time.c index c86f46d2..a21c1acc 100644 --- a/scconfig/src/default/find_time.c +++ b/scconfig/src/default/find_time.c @@ -140,6 +140,31 @@ int find_time_mach_absolute_time(const char *name, int logdepth, int fatal) return try_fail(logdepth, "libs/time/mach_absolute_time"); } +int find_time_QueryPerformanceCounter(const char *name, int logdepth, int fatal) +{ + char *test_c = + NL "#include " + NL "int main() {" + NL " LARGE_INTEGER tmp;" + NL " BOOL res;" + NL " res = QueryPerformanceCounter(&tmp);" + NL " if (res && (tmp.QuadPart > 1))" + NL " puts(\"OK\");" + NL " return 0;" + NL "}" + NL; + + require("cc/cc", logdepth, fatal); + + report("Checking for QueryPerformanceCounter()... "); + logprintf(logdepth, "find_time_QueryPerformanceCounter: trying to find QueryPerformanceCounter...\n"); + logdepth++; + + if (try_icl(logdepth, "libs/time/QueryPerformanceCounter", test_c, "#include ", NULL, NULL)) + return 0; + return try_fail(logdepth, "libs/time/QueryPerformanceCounter"); +} + int find_time_gettimeofday(const char *name, int logdepth, int fatal) { diff --git a/src/scheduler.c b/src/scheduler.c index d2bb88ef..c1027f65 100644 --- a/src/scheduler.c +++ b/src/scheduler.c @@ -1646,6 +1646,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg else if(argc==2) { ask_new_file(); } + Tcl_SetResult(interp, xctx->sch[xctx->currsch], TCL_STATIC); } else if(!strcmp(argv[1],"load_new_window") ) { diff --git a/src/xschem.h b/src/xschem.h index c7497a77..aa4c4d75 100644 --- a/src/xschem.h +++ b/src/xschem.h @@ -750,8 +750,8 @@ typedef struct { char current_name[PATH_MAX]; char file_version[100]; char *sch_path[CADMAXHIER]; - int sch_path_hash[CADMAXHIER]; - int sch_inst_number[CADMAXHIER]; + int sch_path_hash[CADMAXHIER]; /* cached hash of hierarchic schematic path for speed */ + int sch_inst_number[CADMAXHIER]; /* inst number descended into in case of vector instances X1[5:0] */ int previous_instance[CADMAXHIER]; /* to remember the instance we came from when going up the hier. */ Zoom zoom_array[CADMAXHIER]; double xorigin,yorigin;