/* -*-C-*-
-$Id: bchdmp.c,v 9.79 1995/03/21 22:12:50 cph Exp $
+$Id: bchdmp.c,v 9.80 1995/10/09 05:52:16 cph Exp $
Copyright (c) 1987-95 Massachusetts Institute of Technology
#ifdef _OS2
#include "os2.h"
-#ifdef __IBMC__
+#if defined(__IBMC__) || defined(__EMX__)
#include <io.h>
#include <sys\stat.h>
#include <fcntl.h>
/* -*-C-*-
-$Id: bchmmg.c,v 9.89 1995/10/08 15:32:27 cph Exp $
+$Id: bchmmg.c,v 9.90 1995/10/09 05:51:50 cph Exp $
Copyright (c) 1987-95 Massachusetts Institute of Technology
#include "os2.h"
#define SUB_DIRECTORY_DELIMITER '\\'
#define ASSUME_NORMAL_GC_FILE
-#ifdef __IBMC__
+#if defined(__IBMC__) || defined(__EMX__)
#include <io.h>
#include <sys\stat.h>
#endif
/* -*-C-*-
-$Id: bchutl.c,v 1.5 1995/03/21 22:12:45 cph Exp $
+$Id: bchutl.c,v 1.6 1995/10/09 05:52:46 cph Exp $
Copyright (c) 1991-95 Massachusetts Institute of Technology
#else /* not WINNT */
#ifdef _OS2
-#ifdef __IBMC__
+#if defined(__IBMC__) || defined(__EMX__)
#include <io.h>
#endif
/* -*-C-*-
-$Id: i386.h,v 1.26 1995/10/05 03:32:49 cph Exp $
+$Id: i386.h,v 1.27 1995/10/09 05:53:15 cph Exp $
Copyright (c) 1992-95 Massachusetts Institute of Technology
/* Hack for OS/2 calling-convention type: */
-#ifdef _OS2
+#if defined(_OS2) && defined(__IBMC__)
#define ASM_ENTRY_POINT(name) (_System name)
#else
#define ASM_ENTRY_POINT(name) name
/* -*-C-*-
-$Id: os2env.c,v 1.7 1995/04/28 07:16:35 cph Exp $
+$Id: os2env.c,v 1.8 1995/10/09 05:54:02 cph Exp $
Copyright (c) 1994-95 Massachusetts Institute of Technology
#include <sys\timeb.h>
#else /* not __IBMC__ */
-#ifdef __GCC2__
+#ifdef __GNUC__
#include <errno.h>
#include <sys/times.h>
+#ifdef __EMX__
+#include <sys/timeb.h>
+#endif
-#endif /* __GCC2__ */
+#endif /* __GNUC__ */
#endif /* not __IBMC__ */
static void initialize_real_time_clock (void);
}
}
+#ifdef __IBMC__
+
long
OS2_timezone (void)
{
return (_daylight);
}
+#else /* not __IBMC__ */
+#ifdef __EMX__
+
+long
+OS2_timezone (void)
+{
+ struct timeb tb;
+ ftime (&tb);
+ return (tb . timezone);
+}
+
+int
+OS2_daylight_savings_p (void)
+{
+ struct timeb tb;
+ ftime (&tb);
+ return (tb . dstflag);
+}
+
+#endif /* __EMX__ */
+#endif /* not __IBMC__ */
+
static double initial_rtc;
static void
_ftime (&rtc);
return ((((double) (rtc . time)) * 1000.0) + ((double) (rtc . millitm)));
#else /* not __IBMC__ */
-#ifdef __GCC2__
+#ifdef __GNUC__
struct tms rtc;
times (&rtc);
return (((double) (rtc . tms_utime)) * (1000.0 / ((double) CLK_TCK)));
-#endif /* __GCC2__ */
+#endif /* __GNUC__ */
#endif /* not __IBMC__ */
}
/* -*-C-*-
-$Id: os2proc.c,v 1.2 1995/04/28 07:05:03 cph Exp $
+$Id: os2proc.c,v 1.3 1995/10/09 05:54:35 cph Exp $
Copyright (c) 1995 Massachusetts Institute of Technology
\f
typedef struct
{
-
- HFILE stdin;
- HFILE stdout;
- HFILE stderr;
+ HFILE std_in;
+ HFILE std_out;
+ HFILE std_err;
const char * working_directory;
int copied_p;
} process_state_t;
save_process_state (int save_working_dir_p)
{
process_state_t * state = (dstack_alloc (sizeof (process_state_t)));
- (state -> stdin) = NULLHANDLE;
- (state -> stdout) = NULLHANDLE;
- (state -> stderr) = NULLHANDLE;
+ (state -> std_in) = NULLHANDLE;
+ (state -> std_out) = NULLHANDLE;
+ (state -> std_err) = NULLHANDLE;
(state -> working_directory) = 0;
(state -> copied_p) = 0;
transaction_record_action (tat_always, restore_process_state, state);
if (valid_handle_p (0))
- (state -> stdin) = (copy_handle (0));
+ (state -> std_in) = (copy_handle (0));
if (valid_handle_p (1))
- (state -> stdout) = (copy_handle (1));
+ (state -> std_out) = (copy_handle (1));
if (valid_handle_p (2))
- (state -> stderr) = (copy_handle (2));
+ (state -> std_err) = (copy_handle (2));
if (save_working_dir_p)
{
const char * dir = (OS_working_dir_pathname ());
process_state_t * state = env;
if (state -> copied_p)
{
- restore_stdio (0, (state -> stdin));
- restore_stdio (1, (state -> stdout));
- restore_stdio (2, (state -> stderr));
+ restore_stdio (0, (state -> std_in));
+ restore_stdio (1, (state -> std_out));
+ restore_stdio (2, (state -> std_err));
if ((state -> working_directory) != 0)
{
OS_set_working_dir_pathname (state -> working_directory);
OS_free ((void *) (state -> working_directory));
}
}
- if ((state -> stdin) != NULLHANDLE)
- (void) dos_close (state -> stdin);
- if ((state -> stdout) != NULLHANDLE)
- (void) dos_close (state -> stdout);
- if ((state -> stderr) != NULLHANDLE)
- (void) dos_close (state -> stderr);
+ if ((state -> std_in) != NULLHANDLE)
+ (void) dos_close (state -> std_in);
+ if ((state -> std_out) != NULLHANDLE)
+ (void) dos_close (state -> std_out);
+ if ((state -> std_err) != NULLHANDLE)
+ (void) dos_close (state -> std_err);
}
static void
/* -*-C-*-
-$Id: os2thrd.c,v 1.3 1995/04/28 07:05:04 cph Exp $
+$Id: os2thrd.c,v 1.4 1995/10/09 05:55:14 cph Exp $
Copyright (c) 1994-95 Massachusetts Institute of Technology
= ((stack_size < 0x2000)
? 0x2000
: ((stack_size + 0xfff) & (~0xfff)));
-#ifdef __IBMC__
+#if defined(__IBMC__) || defined(__EMX__)
int result = (_beginthread (procedure, 0, ss, argument));
if (result < 0)
OS2_error_system_call (ERROR_MAX_THRDS_REACHED, syscall_beginthread);
return (result);
-#else /* not __IBMC__ */
+#else /* not __IBMC__ nor __EMX__ */
TID tid;
STD_API_CALL (dos_create_thread,
((&tid), ((PFNTHREAD) procedure), ((ULONG) argument), 0, ss));
return (tid);
-#endif /* not __IBMC__ */
+#endif /* not __IBMC__ nor __EMX__ */
}
void
OS2_endthread (void)
{
DosUnsetExceptionHandler (THREAD_EXCEPTION_HANDLER ());
-#ifdef __IBMC__
+#if defined(__IBMC__) || defined(__EMX__)
_endthread ();
#else
dos_exit (EXIT_THREAD, 0);
thread_store_t **
OS2_threadstore (void)
{
- TID tid = (OS2_thread_id ());
+ TID tid = (OS2_current_tid ());
if (tid > MAX_TID)
OS2_logic_error ("Unexpectedly large TID.");
return (& (thread_store_array [tid]));
/* -*-C-*-
-$Id: os2top.c,v 1.14 1995/05/20 03:19:09 cph Exp $
+$Id: os2top.c,v 1.15 1995/10/09 05:55:38 cph Exp $
Copyright (c) 1994-95 Massachusetts Institute of Technology
case ERROR_INVALID_EXE_SIGNATURE: return (syserr_invalid_exe_signature);
case ERROR_EXE_MARKED_INVALID: return (syserr_exe_marked_invalid);
case ERROR_BAD_EXE_FORMAT: return (syserr_bad_exe_format);
+#ifdef ERROR_ITERATED_DATA_EXCEEDS_64k
case ERROR_ITERATED_DATA_EXCEEDS_64k: return (syserr_iterated_data_exceeds_64k);
+#endif
case ERROR_INVALID_MINALLOCSIZE: return (syserr_invalid_minallocsize);
case ERROR_DYNLINK_FROM_INVALID_RING: return (syserr_dynlink_from_invalid_ring);
case ERROR_IOPL_NOT_ENABLED: return (syserr_iopl_not_enabled);
case ERROR_INVALID_SEGDPL: return (syserr_invalid_segdpl);
+#ifdef ERROR_AUTODATASEG_EXCEEDS_64k
case ERROR_AUTODATASEG_EXCEEDS_64k: return (syserr_autodataseg_exceeds_64k);
+#endif
case ERROR_RING2SEG_MUST_BE_MOVABLE: return (syserr_ring2seg_must_be_movable);
+#ifdef ERROR_RELOC_CHAIN_XEEDS_SEGLIM
case ERROR_RELOC_CHAIN_XEEDS_SEGLIM: return (syserr_reloc_chain_xeeds_seglim);
+#endif
case ERROR_INFLOOP_IN_RELOC_CHAIN: return (syserr_infloop_in_reloc_chain);
case ERROR_ENVVAR_NOT_FOUND: return (syserr_envvar_not_found);
case ERROR_NOT_CURRENT_CTRY: return (syserr_not_current_ctry);
case ERROR_INVALID_FREQUENCY: return (syserr_invalid_frequency);
case ERROR_NLS_NO_COUNTRY_FILE: return (syserr_nls_no_country_file);
case ERROR_NLS_OPEN_FAILED: return (syserr_nls_open_failed);
+#ifdef ERROR_NO_COUNTRY_OR_CODEPAGE
case ERROR_NO_COUNTRY_OR_CODEPAGE: return (syserr_no_country_or_codepage);
+#endif
case ERROR_NLS_TABLE_TRUNCATED: return (syserr_nls_table_truncated);
case ERROR_NLS_BAD_TYPE: return (syserr_nls_bad_type);
case ERROR_NLS_TYPE_NOT_FOUND: return (syserr_nls_type_not_found);
case NO_ERROR_BIDI_RW_INCOMPLETE: return (syserr_bidi_rw_incomplete);
case ERROR_IMP_INVALID_PARM: return (syserr_imp_invalid_parm);
case ERROR_IMP_INVALID_LENGTH: return (syserr_imp_invalid_length);
+#ifdef MSG_HPFS_DISK_ERROR_WARN
case MSG_HPFS_DISK_ERROR_WARN: return (syserr_hpfs_disk_error_warn);
+#endif
case ERROR_MON_BAD_BUFFER: return (syserr_mon_bad_buffer);
case ERROR_MODULE_CORRUPTED: return (syserr_module_corrupted);
case ERROR_SM_OUTOF_SWAPFILE: return (syserr_sm_outof_swapfile);
case syserr_invalid_exe_signature: return (ERROR_INVALID_EXE_SIGNATURE);
case syserr_exe_marked_invalid: return (ERROR_EXE_MARKED_INVALID);
case syserr_bad_exe_format: return (ERROR_BAD_EXE_FORMAT);
+#ifdef ERROR_ITERATED_DATA_EXCEEDS_64k
case syserr_iterated_data_exceeds_64k: return (ERROR_ITERATED_DATA_EXCEEDS_64k);
+#endif
case syserr_invalid_minallocsize: return (ERROR_INVALID_MINALLOCSIZE);
case syserr_dynlink_from_invalid_ring: return (ERROR_DYNLINK_FROM_INVALID_RING);
case syserr_iopl_not_enabled: return (ERROR_IOPL_NOT_ENABLED);
case syserr_invalid_segdpl: return (ERROR_INVALID_SEGDPL);
+#ifdef ERROR_AUTODATASEG_EXCEEDS_64k
case syserr_autodataseg_exceeds_64k: return (ERROR_AUTODATASEG_EXCEEDS_64k);
+#endif
case syserr_ring2seg_must_be_movable: return (ERROR_RING2SEG_MUST_BE_MOVABLE);
+#ifdef ERROR_RELOC_CHAIN_XEEDS_SEGLIM
case syserr_reloc_chain_xeeds_seglim: return (ERROR_RELOC_CHAIN_XEEDS_SEGLIM);
+#endif
case syserr_infloop_in_reloc_chain: return (ERROR_INFLOOP_IN_RELOC_CHAIN);
case syserr_envvar_not_found: return (ERROR_ENVVAR_NOT_FOUND);
case syserr_not_current_ctry: return (ERROR_NOT_CURRENT_CTRY);
case syserr_invalid_frequency: return (ERROR_INVALID_FREQUENCY);
case syserr_nls_no_country_file: return (ERROR_NLS_NO_COUNTRY_FILE);
case syserr_nls_open_failed: return (ERROR_NLS_OPEN_FAILED);
+#ifdef ERROR_NO_COUNTRY_OR_CODEPAGE
case syserr_no_country_or_codepage: return (ERROR_NO_COUNTRY_OR_CODEPAGE);
+#endif
case syserr_nls_table_truncated: return (ERROR_NLS_TABLE_TRUNCATED);
case syserr_nls_bad_type: return (ERROR_NLS_BAD_TYPE);
case syserr_nls_type_not_found: return (ERROR_NLS_TYPE_NOT_FOUND);
case syserr_bidi_rw_incomplete: return (NO_ERROR_BIDI_RW_INCOMPLETE);
case syserr_imp_invalid_parm: return (ERROR_IMP_INVALID_PARM);
case syserr_imp_invalid_length: return (ERROR_IMP_INVALID_LENGTH);
+#ifdef MSG_HPFS_DISK_ERROR_WARN
case syserr_hpfs_disk_error_warn: return (MSG_HPFS_DISK_ERROR_WARN);
+#endif
case syserr_mon_bad_buffer: return (ERROR_MON_BAD_BUFFER);
case syserr_module_corrupted: return (ERROR_MODULE_CORRUPTED);
case syserr_sm_outof_swapfile: return (ERROR_SM_OUTOF_SWAPFILE);
/* -*-C-*-
-$Id: os2xcpt.c,v 1.4 1995/04/28 07:20:08 cph Exp $
+$Id: os2xcpt.c,v 1.5 1995/10/09 05:56:04 cph Exp $
Copyright (c) 1994-95 Massachusetts Institute of Technology
EXCEPTION_ENTRY (XCPT_ACCESS_VIOLATION, "access violation"),
EXCEPTION_ENTRY (XCPT_ARRAY_BOUNDS_EXCEEDED, "array bounds exceeded"),
EXCEPTION_ENTRY (XCPT_ASYNC_PROCESS_TERMINATE, "async process terminate"),
+#ifdef XCPT_B1NPX_ERRATA_02
EXCEPTION_ENTRY (XCPT_B1NPX_ERRATA_02, "B1NPX errata"),
+#endif
EXCEPTION_ENTRY (XCPT_BAD_STACK, "bad stack"),
EXCEPTION_ENTRY (XCPT_BREAKPOINT, "breakpoint"),
EXCEPTION_ENTRY (XCPT_DATATYPE_MISALIGNMENT, "data type misalignment"),
/* -*-C-*-
-$Id: prosproc.c,v 1.14 1995/01/05 23:48:27 cph Exp $
+$Id: prosproc.c,v 1.15 1995/10/09 05:56:18 cph Exp $
Copyright (c) 1990-95 Massachusetts Institute of Technology
}
#ifdef _OS2
+#ifndef __EMX__
#define environ _environ
#endif
+#endif
DEFINE_PRIMITIVE ("SCHEME-ENVIRONMENT", Prim_scheme_environment, 0, 0, 0)
{