From 3434331f2f26ae9465c3743ff574300499586f81 Mon Sep 17 00:00:00 2001 From: Stefan Frederik Date: Sat, 27 Aug 2022 14:14:06 +0200 Subject: [PATCH] add better error reporting in case of tcp port conflicts --- scconfig/src/default/deps_default.c | 1 + scconfig/src/default/find.h | 1 + scconfig/src/default/find_time.c | 26 +++++++++++++++++++++++++- src/xschem.tcl | 4 ++-- 4 files changed, 29 insertions(+), 3 deletions(-) diff --git a/scconfig/src/default/deps_default.c b/scconfig/src/default/deps_default.c index aff8c297..8b9f9735 100644 --- a/scconfig/src/default/deps_default.c +++ b/scconfig/src/default/deps_default.c @@ -131,6 +131,7 @@ void deps_default_init(void) 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/timeGetTime/*", find_time_timeGetTime); 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 e10a0739..953c84fe 100644 --- a/scconfig/src/default/find.h +++ b/scconfig/src/default/find.h @@ -149,6 +149,7 @@ 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_timeGetTime(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 a21c1acc..d58cdcb3 100644 --- a/scconfig/src/default/find_time.c +++ b/scconfig/src/default/find_time.c @@ -86,7 +86,7 @@ static int test_clock_gettime(const char *name_, int logdepth, int fatal, const NL; int len = strlen(name_); - /* truncate "/*" from the end of the node name */ + /* truncate "/ *" from the end of the node name */ memcpy(name, name_, len); if (name[len-1] == '*') name[len-2] = '\0'; @@ -165,6 +165,30 @@ int find_time_QueryPerformanceCounter(const char *name, int logdepth, int fatal) return try_fail(logdepth, "libs/time/QueryPerformanceCounter"); } +int find_time_timeGetTime(const char *name, int logdepth, int fatal) +{ + char *test_c = + NL "#include " + NL "int main() {" + NL " DWORD now;" + NL " now = timeGetTime();" + NL " if (now > 1)" + NL " puts(\"OK\");" + NL " return 0;" + NL "}" + NL; + + require("cc/cc", logdepth, fatal); + + report("Checking for timeGetTime()... "); + logprintf(logdepth, "find_time_timeGetTime: trying to find timeGetTime...\n"); + logdepth++; + + if (try_icl(logdepth, "libs/time/timeGetTime", test_c, "#include ", NULL, "-lwinmm")) + return 0; + return try_fail(logdepth, "libs/time/timeGetTime"); +} + int find_time_gettimeofday(const char *name, int logdepth, int fatal) { diff --git a/src/xschem.tcl b/src/xschem.tcl index 2851d085..130f17ec 100644 --- a/src/xschem.tcl +++ b/src/xschem.tcl @@ -5506,7 +5506,7 @@ proc setup_tcp_xschem {} { global xschem_listen_port xschem_server_getdata if { [info exists xschem_listen_port] && ($xschem_listen_port ne {}) } { if {[catch {socket -server xschem_server $xschem_listen_port} err]} { - puts "problems listening to TCP port: $xschem_listen_port" + puts "setup_tcp_xschem: problems listening to TCP port: $xschem_listen_port" puts $err return 0 } else { @@ -5520,7 +5520,7 @@ proc setup_tcp_bespice {} { global bespice_listen_port bespice_server_getdata if { [info exists bespice_listen_port] && ($bespice_listen_port ne {}) } { if {[catch {socket -server bespice_server $bespice_listen_port} err]} { - puts "problems listening to TCP port: $bespice_listen_port" + puts "setup_tcp_bespice: problems listening to TCP port: $bespice_listen_port" puts $err return 0 } else {