From 048cdbdc916bcebfc9bdf50235ffebbaed34f338 Mon Sep 17 00:00:00 2001 From: mgoffioul Date: Mon, 25 Sep 2006 09:42:58 +0000 Subject: [PATCH] - [Win32] Command-line arguments are now available for programs compiled with :SYSTEM set to :WINDOWS - [Win32] si_trap_fpe is now exported by ecl.dl - [Win32] exports new finalizer functions si_[set/get]_finalizer --- msvc/ecl-threads.def | 4 ++++ msvc/ecl.def | 4 ++++ src/CHANGELOG | 5 +++++ src/c/main.d | 20 ++++++++++++++++++++ src/cmp/cmpmain.lsp | 6 ++++-- src/h/external.h | 3 +++ 6 files changed, 40 insertions(+), 2 deletions(-) diff --git a/msvc/ecl-threads.def b/msvc/ecl-threads.def index 36eac5f5e..2decbe7a2 100755 --- a/msvc/ecl-threads.def +++ b/msvc/ecl-threads.def @@ -9,6 +9,8 @@ EXPORTS make_cons si_gc si_gc_dump + si_set_finalizer + si_get_finalizer ; all_symbols @@ -530,6 +532,7 @@ EXPORTS ecl_self DATA cl_boot cl_shutdown + ecl_get_commandline_args ; mapfun.c @@ -1151,6 +1154,7 @@ EXPORTS si_catch_bad_signals si_uncatch_bad_signals si_check_pending_interrupts + si_trap_fpe ; unixsys.c diff --git a/msvc/ecl.def b/msvc/ecl.def index b3e758f30..4272c2a76 100644 --- a/msvc/ecl.def +++ b/msvc/ecl.def @@ -9,6 +9,8 @@ EXPORTS make_cons si_gc si_gc_dump + si_set_finalizer + si_get_finalizer ; all_symbols @@ -537,6 +539,7 @@ EXPORTS ecl_self DATA cl_boot cl_shutdown + ecl_get_commandline_args ; mapfun.c @@ -1134,6 +1137,7 @@ EXPORTS si_catch_bad_signals si_uncatch_bad_signals si_check_pending_interrupts + si_trap_fpe ; unixsys.c diff --git a/src/CHANGELOG b/src/CHANGELOG index d237bd5a9..39a2bffff 100644 --- a/src/CHANGELOG +++ b/src/CHANGELOG @@ -21,6 +21,9 @@ ECL 1.0: using SI:SET-FINALIZER and SI:GET-FINALIZER. Only one closure per object is allowed. + - [Win32] Command-line arguments are now available for programs compiled with + :SYSTEM set to :WINDOWS (M. Goffioul) + * Bugs fixed: @@ -50,6 +53,8 @@ ECL 1.0: - [Win32] DIRECTORY did not take the drive letter into account. + - [Win32] si_trap_fpe is now exported by ecl.dll + ;;; Local Variables: *** ;;; mode:text *** ;;; fill-column:79 *** diff --git a/src/c/main.d b/src/c/main.d index 3d4446e2d..15571ab0b 100644 --- a/src/c/main.d +++ b/src/c/main.d @@ -566,3 +566,23 @@ si_pointer(cl_object x) { @(return make_unsigned_integer((cl_index)x)) } + +#if defined(_MSC_VER) || defined(mingw32) +void +ecl_get_commandline_args(int* argc, char*** argv) { + LPWSTR *wArgs; + int i; + + if (argc == NULL || argv == NULL) + return; + + wArgs = CommandLineToArgvW(GetCommandLineW(), argc); + *argv = (char**)malloc(sizeof(char*)*(*argc)); + for (i=0; i<*argc; i++) { + int len = wcslen(wArgs[i]); + (*argv)[i] = (char*)malloc(2*(len+1)); + wcstombs((*argv)[i], wArgs[i], len+1); + } + LocalFree(wArgs); +} +#endif diff --git a/src/cmp/cmpmain.lsp b/src/cmp/cmpmain.lsp index 90aca79e1..612194b10 100644 --- a/src/cmp/cmpmain.lsp +++ b/src/cmp/cmpmain.lsp @@ -180,9 +180,11 @@ main(int argc, char **argv) int WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { - char *fake_argv = \"ecl.exe\"; + char **argv; + int argc; ~A - cl_boot(1, &fake_argv); + ecl_get_commandline_args(&argc, &argv); + cl_boot(argc, argv); read_VV(OBJNULL, ~A); ~A }") diff --git a/src/h/external.h b/src/h/external.h index a3b42c028..dc7ec105d 100644 --- a/src/h/external.h +++ b/src/h/external.h @@ -798,6 +798,9 @@ extern bool ecl_booted; extern const char *ecl_self; extern int cl_boot(int argc, char **argv); extern int cl_shutdown(void); +#if defined(_MSC_VER) || defined(mingw32) +extern void ecl_get_commandline_args(int* argc, char*** argv); +#endif /* mapfun.c */