From: Chris Hanson Date: Mon, 9 Oct 1995 05:56:18 +0000 (+0000) Subject: Add conditionalizations for EMX/GCC under OS/2. X-Git-Tag: 20090517-FFI~5906 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=696c5e3a4b945a98eaa810efd7d9b79b9ec57170;p=mit-scheme.git Add conditionalizations for EMX/GCC under OS/2. --- diff --git a/v7/src/microcode/bchdmp.c b/v7/src/microcode/bchdmp.c index 6ce3dfe77..490baa658 100644 --- a/v7/src/microcode/bchdmp.c +++ b/v7/src/microcode/bchdmp.c @@ -1,6 +1,6 @@ /* -*-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 @@ -97,7 +97,7 @@ static char FASDUMP_FILENAME[] = "\\tmp\\faXXXXXX"; #ifdef _OS2 #include "os2.h" -#ifdef __IBMC__ +#if defined(__IBMC__) || defined(__EMX__) #include #include #include diff --git a/v7/src/microcode/bchmmg.c b/v7/src/microcode/bchmmg.c index ef2a3687d..9c9810f0d 100644 --- a/v7/src/microcode/bchmmg.c +++ b/v7/src/microcode/bchmmg.c @@ -1,6 +1,6 @@ /* -*-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 @@ -56,7 +56,7 @@ MIT in each case. */ #include "os2.h" #define SUB_DIRECTORY_DELIMITER '\\' #define ASSUME_NORMAL_GC_FILE -#ifdef __IBMC__ +#if defined(__IBMC__) || defined(__EMX__) #include #include #endif diff --git a/v7/src/microcode/bchutl.c b/v7/src/microcode/bchutl.c index c4949b3e6..815bd4bff 100644 --- a/v7/src/microcode/bchutl.c +++ b/v7/src/microcode/bchutl.c @@ -1,6 +1,6 @@ /* -*-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 @@ -72,7 +72,7 @@ DEFUN (error_name, (code), int code) #else /* not WINNT */ #ifdef _OS2 -#ifdef __IBMC__ +#if defined(__IBMC__) || defined(__EMX__) #include #endif diff --git a/v7/src/microcode/cmpintmd/i386.h b/v7/src/microcode/cmpintmd/i386.h index ebe5e41d2..3239404fe 100644 --- a/v7/src/microcode/cmpintmd/i386.h +++ b/v7/src/microcode/cmpintmd/i386.h @@ -1,6 +1,6 @@ /* -*-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 @@ -51,7 +51,7 @@ MIT in each case. */ /* 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 diff --git a/v7/src/microcode/os2env.c b/v7/src/microcode/os2env.c index 0f30053cc..0629a7121 100644 --- a/v7/src/microcode/os2env.c +++ b/v7/src/microcode/os2env.c @@ -1,6 +1,6 @@ /* -*-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 @@ -43,12 +43,15 @@ MIT in each case. */ #include #else /* not __IBMC__ */ -#ifdef __GCC2__ +#ifdef __GNUC__ #include #include +#ifdef __EMX__ +#include +#endif -#endif /* __GCC2__ */ +#endif /* __GNUC__ */ #endif /* not __IBMC__ */ static void initialize_real_time_clock (void); @@ -113,6 +116,8 @@ OS_encode_time (struct time_structure * buffer) } } +#ifdef __IBMC__ + long OS2_timezone (void) { @@ -125,6 +130,28 @@ OS2_daylight_savings_p (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 @@ -147,11 +174,11 @@ get_real_time_clock (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__ */ } diff --git a/v7/src/microcode/os2proc.c b/v7/src/microcode/os2proc.c index b122092b5..9881c1c58 100644 --- a/v7/src/microcode/os2proc.c +++ b/v7/src/microcode/os2proc.c @@ -1,6 +1,6 @@ /* -*-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 @@ -187,10 +187,9 @@ OS_make_subprocess (const char * filename, 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; @@ -199,18 +198,18 @@ static void 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 ()); @@ -242,21 +241,21 @@ restore_process_state (void * env) 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 diff --git a/v7/src/microcode/os2thrd.c b/v7/src/microcode/os2thrd.c index 6721904c1..8731d5f06 100644 --- a/v7/src/microcode/os2thrd.c +++ b/v7/src/microcode/os2thrd.c @@ -1,6 +1,6 @@ /* -*-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 @@ -50,24 +50,24 @@ OS2_beginthread (thread_procedure_t procedure, = ((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); @@ -96,7 +96,7 @@ static thread_store_t * thread_store_array [MAX_TID + 1]; 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])); diff --git a/v7/src/microcode/os2top.c b/v7/src/microcode/os2top.c index 6cbb3e3d8..d64e4c5e8 100644 --- a/v7/src/microcode/os2top.c +++ b/v7/src/microcode/os2top.c @@ -1,6 +1,6 @@ /* -*-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 @@ -623,14 +623,20 @@ OS_error_code_to_syserr (int code) 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); @@ -807,7 +813,9 @@ OS_error_code_to_syserr (int code) 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); @@ -987,7 +995,9 @@ OS_error_code_to_syserr (int code) 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); @@ -1238,14 +1248,20 @@ syserr_to_error_code (enum syserr_names syserr) 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); @@ -1422,7 +1438,9 @@ syserr_to_error_code (enum syserr_names syserr) 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); @@ -1602,7 +1620,9 @@ syserr_to_error_code (enum syserr_names syserr) 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); diff --git a/v7/src/microcode/os2xcpt.c b/v7/src/microcode/os2xcpt.c index 92ea93103..3d62bb88f 100644 --- a/v7/src/microcode/os2xcpt.c +++ b/v7/src/microcode/os2xcpt.c @@ -1,6 +1,6 @@ /* -*-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 @@ -816,7 +816,9 @@ static exception_entry_t exception_names [] = 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"), diff --git a/v7/src/microcode/prosproc.c b/v7/src/microcode/prosproc.c index d51a880b4..62460bdf7 100644 --- a/v7/src/microcode/prosproc.c +++ b/v7/src/microcode/prosproc.c @@ -1,6 +1,6 @@ /* -*-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 @@ -181,8 +181,10 @@ DEFUN (convert_string_vector, (vector), SCHEME_OBJECT vector) } #ifdef _OS2 +#ifndef __EMX__ #define environ _environ #endif +#endif DEFINE_PRIMITIVE ("SCHEME-ENVIRONMENT", Prim_scheme_environment, 0, 0, 0) {