summaryrefslogtreecommitdiffstats
path: root/scmmain.c
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2017-02-20 00:05:27 -0800
committerBryan Newbold <bnewbold@robocracy.org>2017-02-20 00:05:27 -0800
commitc7d035ae1a729232579a0fe41ed5affa131d3623 (patch)
treefb387f7c2a8e01cf603d4c75fbbaa68f711df986 /scmmain.c
parentdeda2c0fd8689349fea2a900199a76ff7ecb319e (diff)
downloadscm-c7d035ae1a729232579a0fe41ed5affa131d3623.tar.gz
scm-c7d035ae1a729232579a0fe41ed5affa131d3623.zip
Import Upstream version 5d9upstream/5d9
Diffstat (limited to 'scmmain.c')
-rw-r--r--scmmain.c26
1 files changed, 25 insertions, 1 deletions
diff --git a/scmmain.c b/scmmain.c
index ce2d000..7e501fa 100644
--- a/scmmain.c
+++ b/scmmain.c
@@ -47,12 +47,19 @@
# include <floatingpoint.h>
#endif
+#ifdef _WIN32
+# include <io.h>
+#endif
+
#include "scm.h"
#include "patchlvl.h"
#ifdef __IBMC__
# include <io.h>
#endif
+#ifdef __NetBSD__
+# include <unistd.h>
+#endif
#ifdef __OpenBSD__
# include <unistd.h>
#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. */
}