mirror of
https://gitlab.com/embeddable-common-lisp/ecl.git
synced 2026-01-25 05:51:55 -08:00
Changes to make the MSVC port work again, including fixes for EXT:RUN-PROGRAM and EXT:EXTERNAL-PROCESS-WAIT.
This commit is contained in:
parent
6ef5f702da
commit
dcb68018c3
8 changed files with 23 additions and 20 deletions
|
|
@ -255,7 +255,8 @@ compile.lsp: bare.lsp $(srcdir)/compile.lsp.in Makefile
|
|||
< $(srcdir)\compile.lsp.in > compile.lsp
|
||||
bare.lsp: $(srcdir)/bare.lsp.in lsp/load.lsp clos/load.lsp cmp/load.lsp cmp/cmpdefs.lsp
|
||||
c\cut "@true_srcdir@" "$(srcdir:\=/)" \
|
||||
"@true_builddir@" "$(MAKEDIR:\=/)" < $(srcdir)\bare.lsp.in > bare.lsp
|
||||
"@true_builddir@" "$(MAKEDIR:\=/)"\
|
||||
"@ECL_CMPDIR@" "cmp" < $(srcdir)\bare.lsp.in > bare.lsp
|
||||
lsp/load.lsp: $(srcdir)/lsp/load.lsp.in
|
||||
$(CP) $(srcdir)\lsp\load.lsp.in lsp\load.lsp
|
||||
clos/load.lsp: $(srcdir)/clos/load.lsp.in
|
||||
|
|
|
|||
4
src/c/alloc_2.d
Normal file → Executable file
4
src/c/alloc_2.d
Normal file → Executable file
|
|
@ -191,7 +191,7 @@ ecl_alloc_object(cl_type t)
|
|||
case t_lock:
|
||||
case t_condition_variable:
|
||||
#endif
|
||||
#ifdef ECL_SEMAPHORES:
|
||||
#ifdef ECL_SEMAPHORES
|
||||
case t_semaphores:
|
||||
#endif
|
||||
case t_foreign:
|
||||
|
|
@ -489,6 +489,7 @@ standard_finalizer(cl_object o)
|
|||
#endif
|
||||
#ifdef ECL_SEMAPHORES
|
||||
case t_semaphore: {
|
||||
const cl_env_ptr the_env = ecl_process_env();
|
||||
ecl_disable_interrupts_env(the_env);
|
||||
mp_semaphore_close(o);
|
||||
ecl_enable_interrupts_env(the_env);
|
||||
|
|
@ -498,6 +499,7 @@ standard_finalizer(cl_object o)
|
|||
#ifdef ECL_THREADS
|
||||
case t_symbol: {
|
||||
cl_object cons = ecl_list1(MAKE_FIXNUM(o->symbol.binding));
|
||||
const cl_env_ptr the_env = ecl_process_env();
|
||||
ecl_disable_interrupts_env(the_env);
|
||||
THREAD_OP_LOCK();
|
||||
ECL_CONS_CDR(cons) = cl_core.reused_indices;
|
||||
|
|
|
|||
6
src/c/file.d
Normal file → Executable file
6
src/c/file.d
Normal file → Executable file
|
|
@ -5021,13 +5021,13 @@ init_file(void)
|
|||
stderr, smm_output, 8, flags, external_format);
|
||||
#else
|
||||
standard_input = ecl_make_file_stream_from_fd(make_constant_base_string("stdin"),
|
||||
STDIN_FILENO, smm_input, 8, flags,
|
||||
STDIN_FILENO, smm_input_file, 8, flags,
|
||||
external_format);
|
||||
standard_output = ecl_make_file_stream_from_fd(make_constant_base_string("stdout"),
|
||||
STDOUT_FILENO, smm_output, 8, flags,
|
||||
STDOUT_FILENO, smm_output_file, 8, flags,
|
||||
external_format);
|
||||
error_output = ecl_make_file_stream_from_fd(make_constant_base_string("stderr"),
|
||||
STDERR_FILENO, smm_output, 8, flags,
|
||||
STDERR_FILENO, smm_output_file, 8, flags,
|
||||
external_format);
|
||||
#endif
|
||||
cl_core.standard_input = standard_input;
|
||||
|
|
|
|||
2
src/c/symbols_list.h
Normal file → Executable file
2
src/c/symbols_list.h
Normal file → Executable file
|
|
@ -1861,7 +1861,7 @@ cl_symbols[] = {
|
|||
{EXT_ "EXTERNAL-PROCESS-WAIT", EXT_ORDINARY, si_external_process_wait, -1, OBJNULL},
|
||||
|
||||
#if defined(_MSC_VER) || defined(mingw32)
|
||||
{SI_ "CLOSE-WINDOWS-HANDLE", SI_ORDINARY, si_close_windows_handle, 1, OBJNULL},
|
||||
{SYS_ "CLOSE-WINDOWS-HANDLE", SI_ORDINARY, si_close_windows_handle, 1, OBJNULL},
|
||||
#endif
|
||||
|
||||
/* Tag for end of list */
|
||||
|
|
|
|||
2
src/c/symbols_list2.h
Normal file → Executable file
2
src/c/symbols_list2.h
Normal file → Executable file
|
|
@ -1861,7 +1861,7 @@ cl_symbols[] = {
|
|||
{EXT_ "EXTERNAL-PROCESS-WAIT","si_external_process_wait"},
|
||||
|
||||
#if defined(_MSC_VER) || defined(mingw32)
|
||||
{SI_ "CLOSE-WINDOWS-HANDLE","si_close_windows_handle"},
|
||||
{SYS_ "CLOSE-WINDOWS-HANDLE","si_close_windows_handle"},
|
||||
#endif
|
||||
|
||||
/* Tag for end of list */
|
||||
|
|
|
|||
23
src/c/unixsys.d
Normal file → Executable file
23
src/c/unixsys.d
Normal file → Executable file
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
#include <ecl/ecl.h>
|
||||
#include <stdlib.h>
|
||||
#include <strings.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <fcntl.h>
|
||||
#include <ecl/internal.h>
|
||||
|
|
@ -139,11 +139,12 @@ si_close_windows_handle(cl_object h)
|
|||
static cl_object
|
||||
make_windows_handle(HANDLE h)
|
||||
{
|
||||
cl_object h = ecl_allocate_foreign_data(@':pointer', sizeof(HANDLE*));
|
||||
HANDLE *ph = (HANDLE*)h->foreign.data;
|
||||
cl_object foreign = ecl_allocate_foreign_data(@':pointer-void',
|
||||
sizeof(HANDLE*));
|
||||
HANDLE *ph = (HANDLE*)foreign->foreign.data;
|
||||
*ph = h;
|
||||
si_set_finalizer(h, @'si::close-windows-handle');
|
||||
return h;
|
||||
si_set_finalizer(foreign, @'si::close-windows-handle');
|
||||
return foreign;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
@ -151,7 +152,7 @@ make_windows_handle(HANDLE h)
|
|||
cl_object status, code;
|
||||
@
|
||||
{
|
||||
if (!FIXNUMP(process_or_pid)) {
|
||||
if (type_of(process_or_pid) == T_STRUCTURE) {
|
||||
cl_object pid = cl_funcall(2, @'ext::external-process-pid',
|
||||
process_or_pid);
|
||||
if (Null(pid)) {
|
||||
|
|
@ -180,7 +181,7 @@ make_windows_handle(HANDLE h)
|
|||
status = @':error';
|
||||
code = Cnil;
|
||||
} else if (exitcode == STILL_ACTIVE) {
|
||||
status = @':runnning';
|
||||
status = @':running';
|
||||
code = Cnil;
|
||||
} else {
|
||||
status = @':exited';
|
||||
|
|
@ -188,9 +189,9 @@ make_windows_handle(HANDLE h)
|
|||
process_or_pid->foreign.data = NULL;
|
||||
CloseHandle(*hProcess);
|
||||
}
|
||||
ecl_enable_interrupts(the_env);
|
||||
ecl_enable_interrupts_env(the_env);
|
||||
#else
|
||||
cl_index pid = fix(process_or_pid);
|
||||
cl_index pid = fixint(process_or_pid);
|
||||
int code_int;
|
||||
int error = waitpid(pid, &code_int, Null(wait)? WNOHANG : 0);
|
||||
if (error < 0) {
|
||||
|
|
@ -250,7 +251,7 @@ make_windows_handle(HANDLE h)
|
|||
command = ecl_null_terminated_base_string(command);
|
||||
|
||||
if (!Null(environ)) {
|
||||
env_buffer = from_list_to_execve_arguments(environ, NULL);
|
||||
env_buffer = from_list_to_execve_argument(environ, NULL);
|
||||
env = env_buffer->base_string.self;
|
||||
}
|
||||
|
||||
|
|
@ -396,7 +397,7 @@ make_windows_handle(HANDLE h)
|
|||
CloseHandle(pr_info.hThread);
|
||||
pid = make_windows_handle(pr_info.hProcess);
|
||||
} else {
|
||||
const char *message;
|
||||
char *message;
|
||||
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM |
|
||||
FORMAT_MESSAGE_ALLOCATE_BUFFER,
|
||||
0, GetLastError(), 0, (void*)&message, 0, NULL);
|
||||
|
|
|
|||
2
src/h/external.h
Normal file → Executable file
2
src/h/external.h
Normal file → Executable file
|
|
@ -1749,7 +1749,7 @@ extern ECL_API cl_object si_disable_interrupts(void);
|
|||
extern ECL_API cl_object si_enable_interrupts(void);
|
||||
extern ECL_API cl_object si_trap_fpe(cl_object condition, cl_object flag);
|
||||
#if defined(_MSC_VER) || defined(mingw32)
|
||||
extern LONG WINAPI _ecl_w32_exception_filter(struct _EXCEPTION_POINTERS*);
|
||||
extern ECL_API LONG WINAPI _ecl_w32_exception_filter(struct _EXCEPTION_POINTERS*);
|
||||
#endif
|
||||
extern ECL_API void ecl_check_pending_interrupts(void);
|
||||
|
||||
|
|
|
|||
1
src/h/stacks.h
Normal file → Executable file
1
src/h/stacks.h
Normal file → Executable file
|
|
@ -408,7 +408,6 @@ extern ECL_API ecl_frame_ptr _ecl_frs_push(register cl_env_ptr, register cl_obje
|
|||
ecl_frs_pop(__the_env); } while (0)
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
extern ECL_API LONG WINAPI _ecl_w32_exception_filter(struct _EXCEPTION_POINTERS *);
|
||||
# define CL_CATCH_ALL_BEGIN(the_env) do { \
|
||||
const cl_env_ptr __the_env = (the_env); \
|
||||
_try { \
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue