From c7d035ae1a729232579a0fe41ed5affa131d3623 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Mon, 20 Feb 2017 00:05:27 -0800 Subject: Import Upstream version 5d9 --- scmmain.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) (limited to 'scmmain.c') diff --git a/scmmain.c b/scmmain.c index ce2d000..7e501fa 100644 --- a/scmmain.c +++ b/scmmain.c @@ -47,12 +47,19 @@ # include #endif +#ifdef _WIN32 +# include +#endif + #include "scm.h" #include "patchlvl.h" #ifdef __IBMC__ # include #endif +#ifdef __NetBSD__ +# include +#endif #ifdef __OpenBSD__ # include #endif @@ -68,6 +75,7 @@ char *scm_find_implpath(execpath) { char *implpath = 0; #ifndef nosve +# ifndef POCKETCONSOLE char *getenvpath = getenv(INIT_GETENV); /* fprintf(stderr, "%s=%s\n", INIT_GETENV, getenvpath); fflush(stderr); */ if (getenvpath) implpath = scm_cat_path(0L, getenvpath, 0L); @@ -80,6 +88,7 @@ char *scm_find_implpath(execpath) fputs("\") not found; Trying elsewhere\n", stderr); } } +# endif #endif if (!implpath && execpath) implpath = find_impl_file(execpath, GENERIC_NAME, INIT_FILE_NAME, dirsep); @@ -90,6 +99,12 @@ char *scm_find_implpath(execpath) } char *generic_name[] = { GENERIC_NAME }; +#ifdef WINSIGNALS +SCM_EXPORT HANDLE scm_hMainThread; +#endif + +void scmmain_init_user_scm(); + int main(argc, argv) int argc; char **argv; @@ -102,10 +117,19 @@ int main(argc, argv) #ifdef __FreeBSD__ fp_prec_t fpspec; #endif + +#ifdef WINSIGNALS + /* need a handle to access the main thread from the signal handler thread */ + DuplicateHandle(GetCurrentProcess(), GetCurrentThread(), GetCurrentProcess(), + &scm_hMainThread, 0, TRUE, DUPLICATE_SAME_ACCESS); +#endif + /* {char ** argvv = argv; */ /* for (;*argvv;argvv++) {fputs(*argvv, stderr); fputs(" ", stderr);} */ /* fputs("\n", stderr);} */ + init_user_scm = scmmain_init_user_scm; + if (0==argc) {argc = 1; argv = generic_name;} /* for macintosh */ #ifndef LACK_SBRK init_sbrk(); /* Do this before malloc()s. */ @@ -162,7 +186,7 @@ int main(argc, argv) /* init_user_scm() is called by the scheme procedure SCM_INIT_EXTENSIONS in "Init5xx.scm" */ -void init_user_scm() +void scmmain_init_user_scm() { /* Put calls to your C initialization routines here. */ } -- cgit v1.2.3