From 1e7f84a200e3cd672ea58cac2edf6295d9675de6 Mon Sep 17 00:00:00 2001 From: Chris Hanson Date: Sun, 15 Oct 1995 00:43:40 +0000 Subject: [PATCH] Add conditionalizations for Watcom C/C++ running under OS/2. --- v7/src/microcode/bchmmg.c | 4 +- v7/src/microcode/bchutl.c | 4 +- v7/src/microcode/cmpintmd/i386.h | 4 +- v7/src/microcode/os2env.c | 64 ++++++++++------------------ v7/src/microcode/os2thrd.c | 23 +++++++--- v7/src/microcode/os2top.c | 4 +- v7/src/microcode/os2utl/config.cmd | 3 +- v7/src/microcode/os2utl/makefile | 5 ++- v7/src/microcode/os2utl/makefile.cmn | 17 ++++---- v7/src/microcode/os2utl/makefile.emx | 3 +- v7/src/microcode/os2utl/makefile.gcc | 3 +- v7/src/microcode/os2utl/makefile.vac | 15 +++---- v7/src/microcode/oscond.h | 6 +-- v7/src/microcode/posixtyp.h | 4 +- v7/src/microcode/prosproc.c | 6 +-- 15 files changed, 81 insertions(+), 84 deletions(-) diff --git a/v7/src/microcode/bchmmg.c b/v7/src/microcode/bchmmg.c index 9c9810f0d..9a357de8e 100644 --- a/v7/src/microcode/bchmmg.c +++ b/v7/src/microcode/bchmmg.c @@ -1,6 +1,6 @@ /* -*-C-*- -$Id: bchmmg.c,v 9.90 1995/10/09 05:51:50 cph Exp $ +$Id: bchmmg.c,v 9.91 1995/10/15 00:36:48 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 -#if defined(__IBMC__) || defined(__EMX__) +#if defined(__IBMC__) || defined(__WATCOMC__) || defined(__EMX__) #include #include #endif diff --git a/v7/src/microcode/bchutl.c b/v7/src/microcode/bchutl.c index 815bd4bff..91a8a8d4f 100644 --- a/v7/src/microcode/bchutl.c +++ b/v7/src/microcode/bchutl.c @@ -1,6 +1,6 @@ /* -*-C-*- -$Id: bchutl.c,v 1.6 1995/10/09 05:52:46 cph Exp $ +$Id: bchutl.c,v 1.7 1995/10/15 00:37:09 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 -#if defined(__IBMC__) || defined(__EMX__) +#if defined(__IBMC__) || defined(__WATCOMC__) || defined(__EMX__) #include #endif diff --git a/v7/src/microcode/cmpintmd/i386.h b/v7/src/microcode/cmpintmd/i386.h index 3239404fe..072445835 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.27 1995/10/09 05:53:15 cph Exp $ +$Id: i386.h,v 1.28 1995/10/15 00:40:18 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: */ -#if defined(_OS2) && defined(__IBMC__) +#if defined(_OS2) && (defined(__IBMC__) || defined(__WATCOMC__)) #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 0629a7121..078221f05 100644 --- a/v7/src/microcode/os2env.c +++ b/v7/src/microcode/os2env.c @@ -1,6 +1,6 @@ /* -*-C-*- -$Id: os2env.c,v 1.8 1995/10/09 05:54:02 cph Exp $ +$Id: os2env.c,v 1.9 1995/10/15 00:37:52 cph Exp $ Copyright (c) 1994-95 Massachusetts Institute of Technology @@ -39,21 +39,24 @@ MIT in each case. */ #include #ifdef __IBMC__ - #include +#define NC_TIMEZONE _timezone +#define NC_DAYLIGHT _daylight +#define NC_FTIME _ftime +#endif -#else /* not __IBMC__ */ -#ifdef __GNUC__ +#if defined(__WATCOMC__) || defined(__EMX__) +#include +#define NC_TIMEZONE timezone +#define NC_DAYLIGHT daylight +#define NC_FTIME ftime +#endif +#ifdef __GCC2__ #include #include -#ifdef __EMX__ -#include #endif -#endif /* __GNUC__ */ -#endif /* not __IBMC__ */ - static void initialize_real_time_clock (void); static double get_real_time_clock (void); @@ -116,42 +119,22 @@ OS_encode_time (struct time_structure * buffer) } } -#ifdef __IBMC__ - -long -OS2_timezone (void) -{ - return (_timezone); -} - -int -OS2_daylight_savings_p (void) -{ - return (_daylight); -} - -#else /* not __IBMC__ */ -#ifdef __EMX__ - long OS2_timezone (void) { - struct timeb tb; - ftime (&tb); - return (tb . timezone); +#ifdef NC_TIMEZONE + return (NC_TIMEZONE); +#endif } int OS2_daylight_savings_p (void) { - struct timeb tb; - ftime (&tb); - return (tb . dstflag); +#ifdef NC_DAYLIGHT + return (NC_DAYLIGHT); +#endif } -#endif /* __EMX__ */ -#endif /* not __IBMC__ */ - static double initial_rtc; static void @@ -169,17 +152,16 @@ OS_real_time_clock (void) static double get_real_time_clock (void) { -#ifdef __IBMC__ +#ifdef NC_FTIME struct timeb rtc; - _ftime (&rtc); + NC_FTIME (&rtc); return ((((double) (rtc . time)) * 1000.0) + ((double) (rtc . millitm))); -#else /* not __IBMC__ */ -#ifdef __GNUC__ +#endif +#ifdef __GCC2__ struct tms rtc; times (&rtc); return (((double) (rtc . tms_utime)) * (1000.0 / ((double) CLK_TCK))); -#endif /* __GNUC__ */ -#endif /* not __IBMC__ */ +#endif } double diff --git a/v7/src/microcode/os2thrd.c b/v7/src/microcode/os2thrd.c index 8731d5f06..d60d4ee05 100644 --- a/v7/src/microcode/os2thrd.c +++ b/v7/src/microcode/os2thrd.c @@ -1,6 +1,6 @@ /* -*-C-*- -$Id: os2thrd.c,v 1.4 1995/10/09 05:55:14 cph Exp $ +$Id: os2thrd.c,v 1.5 1995/10/15 00:38:48 cph Exp $ Copyright (c) 1994-95 Massachusetts Institute of Technology @@ -36,6 +36,19 @@ MIT in each case. */ #include "prims.h" #include "errors.h" +#ifdef __IBMC__ +#define HAVE_BEGINTHREAD +#endif + +#ifdef __WATCOMC__ +#include +#define HAVE_BEGINTHREAD +#endif + +#ifdef __EMX__ +#define HAVE_BEGINTHREAD +#endif + extern void OS2_create_msg_queue (void); extern ULONG APIENTRY OS2_subthread_exception_handler (PEXCEPTIONREPORTRECORD, PEXCEPTIONREGISTRATIONRECORD, PCONTEXTRECORD, @@ -50,24 +63,24 @@ OS2_beginthread (thread_procedure_t procedure, = ((stack_size < 0x2000) ? 0x2000 : ((stack_size + 0xfff) & (~0xfff))); -#if defined(__IBMC__) || defined(__EMX__) +#ifdef HAVE_BEGINTHREAD 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__ nor __EMX__ */ +#else /* not HAVE_BEGINTHREAD */ TID tid; STD_API_CALL (dos_create_thread, ((&tid), ((PFNTHREAD) procedure), ((ULONG) argument), 0, ss)); return (tid); -#endif /* not __IBMC__ nor __EMX__ */ +#endif /* not HAVE_BEGINTHREAD */ } void OS2_endthread (void) { DosUnsetExceptionHandler (THREAD_EXCEPTION_HANDLER ()); -#if defined(__IBMC__) || defined(__EMX__) +#ifdef HAVE_BEGINTHREAD _endthread (); #else dos_exit (EXIT_THREAD, 0); diff --git a/v7/src/microcode/os2top.c b/v7/src/microcode/os2top.c index d64e4c5e8..9328610cf 100644 --- a/v7/src/microcode/os2top.c +++ b/v7/src/microcode/os2top.c @@ -1,6 +1,6 @@ /* -*-C-*- -$Id: os2top.c,v 1.15 1995/10/09 05:55:38 cph Exp $ +$Id: os2top.c,v 1.16 1995/10/15 00:39:03 cph Exp $ Copyright (c) 1994-95 Massachusetts Institute of Technology @@ -420,7 +420,7 @@ OS_restartable_exit (void) { } -#ifdef __IBMC__ +#if defined(__IBMC__) || defined(__WATCOMC__) void bcopy (const char * from, char * to, unsigned int n) { diff --git a/v7/src/microcode/os2utl/config.cmd b/v7/src/microcode/os2utl/config.cmd index fff1e114d..8290d4518 100644 --- a/v7/src/microcode/os2utl/config.cmd +++ b/v7/src/microcode/os2utl/config.cmd @@ -3,9 +3,10 @@ rem MIT Scheme microcode configuration script for OS/2 rem rem Copyright (c) 1994 Massachusetts Institute of Technology rem -rem $Id: config.cmd,v 1.2 1995/10/09 05:58:38 cph Exp $ +rem $Id: config.cmd,v 1.3 1995/10/15 00:42:09 cph Exp $ rem copy cmpintmd\i386.h cmpintmd.h copy cmpauxmd\i386.m4 cmpauxmd.m4 copy os2utl\makefile . +copy cmpauxmd\asmcvt.c . echo ***** Read and edit the makefile! ***** diff --git a/v7/src/microcode/os2utl/makefile b/v7/src/microcode/os2utl/makefile index 64e2c1c85..4a23395d1 100644 --- a/v7/src/microcode/os2utl/makefile +++ b/v7/src/microcode/os2utl/makefile @@ -1,6 +1,6 @@ ### -*- Fundamental -*- ### -### $Id: makefile,v 1.11 1995/10/09 05:58:55 cph Exp $ +### $Id: makefile,v 1.12 1995/10/15 00:42:29 cph Exp $ ### ### Copyright (c) 1994-95 Massachusetts Institute of Technology ### @@ -48,6 +48,9 @@ all: scheme.exe bchschem.exe bintopsb.exe psbtobin.exe # IBM C Set++/2 or IBM Visual Age C++: include os2utl\makefile.vac +# Watcom C/C++: +#include os2utl\makefile.wcc + # EMX/GCC: #include os2utl\makefile.emx diff --git a/v7/src/microcode/os2utl/makefile.cmn b/v7/src/microcode/os2utl/makefile.cmn index 0f9748c7c..fc7d13d3c 100644 --- a/v7/src/microcode/os2utl/makefile.cmn +++ b/v7/src/microcode/os2utl/makefile.cmn @@ -1,6 +1,6 @@ ### -*- Fundamental -*- ### -### $Id: makefile.cmn,v 1.1 1995/10/09 05:59:13 cph Exp $ +### $Id: makefile.cmn,v 1.2 1995/10/15 00:42:44 cph Exp $ ### ### Copyright (c) 1994-95 Massachusetts Institute of Technology ### @@ -256,9 +256,11 @@ BCHOBJECTS = $(CORE_OBJECTS) $(BCH_GC_OBJECTS) $(OS2_OBJECTS) \ $(OS_PRIM_OBJECTS) bchdef.$(OBJ) clean: - rm -f *.$(OBJ) *.exe *.tch usrdef.c bchdef.c + del *.$(OBJ) *.exe *.tch cmpauxmd.$(ASM) usrdef.c bchdef.c \ + $(SYSTEM_CLEAN) findprim.exe : findprim.$(OBJ) +asmcvt.exe : asmcvt.$(OBJ) bintopsb.exe : bintopsb.$(OBJ) missing.$(OBJ) psbtobin.exe : psbtobin.$(OBJ) missing.$(OBJ) breakup.exe : breakup.$(OBJ) @@ -271,7 +273,7 @@ usrdef.c : $(SCHEME_SOURCES) $(SOURCES) $(OS_PRIM_SOURCES) usrdef.tch \ bchdef.c : $(SCHEME_SOURCES) $(BCHSOURCES) $(OS_PRIM_SOURCES) usrdef.tch \ findprim.exe - .\findprim.exe $(SCHEME_SOURCES) $(BCHSOURCES) $(OS_PRIM_SOURCES) \ + .\findprim $(SCHEME_SOURCES) $(BCHSOURCES) $(OS_PRIM_SOURCES) \ > bchdef.c cmpauxmd.$(ASM) : cmpauxmd.m4 @@ -282,17 +284,14 @@ scheme.tch : scheme.h oscond.h ansidecl.h dstack.h obstack.h config.h \ bkpt.h object.h scode.h sdata.h gc.h interp.h stack.h futures.h \ types.h errors.h returns.h const.h fixobj.h default.h extern.h \ prim.h intrpt.h critsec.h outf.h - rm -f $@ - touch $@ + echo touch > $@ psbmap.tch : config.h object.h bignum.h bignmint.h bitstr.h types.h \ sdata.h const.h psbmap.h $(GC_HEAD_FILES) comlin.h comlin.c - rm -f $@ - touch $@ + echo touch > $@ usrdef.tch : usrdef.h config.h object.h prim.h - rm -f $@ - touch $@ + echo touch > $@ foo $(USER_PRIM_OBJECTS) : $(HEAD_FILES) diff --git a/v7/src/microcode/os2utl/makefile.emx b/v7/src/microcode/os2utl/makefile.emx index a8f3c3d80..cf5322e11 100644 --- a/v7/src/microcode/os2utl/makefile.emx +++ b/v7/src/microcode/os2utl/makefile.emx @@ -1,6 +1,6 @@ ### -*- Fundamental -*- ### -### $Id: makefile.emx,v 1.1 1995/10/09 05:59:21 cph Exp $ +### $Id: makefile.emx,v 1.2 1995/10/15 00:43:03 cph Exp $ ### ### Copyright (c) 1994-95 Massachusetts Institute of Technology ### @@ -50,6 +50,7 @@ GCCFLAGS = -Zmt -O -g CFLAGS = $(GCCFLAGS) -DMIT_SCHEME -D__OS2__ LDFLAGS = $(GCCFLAGS) SYSTEM_LIBS = +SYSTEM_CLEAN = M4 = m4 M4FLAGS = -DTYPE_CODE_LENGTH=6 AS = as diff --git a/v7/src/microcode/os2utl/makefile.gcc b/v7/src/microcode/os2utl/makefile.gcc index 345ab4455..7efea9e3c 100644 --- a/v7/src/microcode/os2utl/makefile.gcc +++ b/v7/src/microcode/os2utl/makefile.gcc @@ -1,6 +1,6 @@ ### -*- Fundamental -*- ### -### $Id: makefile.gcc,v 1.1 1995/10/09 05:59:40 cph Exp $ +### $Id: makefile.gcc,v 1.2 1995/10/15 00:43:16 cph Exp $ ### ### Copyright (c) 1995 Massachusetts Institute of Technology ### @@ -50,6 +50,7 @@ GCCFLAGS = -O -g CFLAGS = $(GCCFLAGS) -DMIT_SCHEME LDFLAGS = $(GCCFLAGS) SYSTEM_LIBS = +SYSTEM_CLEAN = M4 = m4 M4FLAGS = -DOS2 AS = as diff --git a/v7/src/microcode/os2utl/makefile.vac b/v7/src/microcode/os2utl/makefile.vac index 7006fd2bf..9ddeaded8 100644 --- a/v7/src/microcode/os2utl/makefile.vac +++ b/v7/src/microcode/os2utl/makefile.vac @@ -1,6 +1,6 @@ ### -*- Fundamental -*- ### -### $Id: makefile.vac,v 1.1 1995/10/09 05:59:30 cph Exp $ +### $Id: makefile.vac,v 1.2 1995/10/15 00:43:40 cph Exp $ ### ### Copyright (c) 1994-95 Massachusetts Institute of Technology ### @@ -37,13 +37,11 @@ ### without prior written consent from MIT in each case. ### -#### Makefile for Scheme under OS/2 using EMX/GCC +#### Makefile for Scheme under OS/2 using IBM Visual Age C++ # This makefile is configured for use with GNU make, the IBM Visual # Age C++ compiler (or IBM C Set++/2), GNU m4, and the GNU assembler -# included with the GCC/2 package. Unfortunately, the output from the -# GNU assembler requires two .lib files from GCC/2 as well; these -# files are referenced here using absolute pathnames. +# included with the EMX/GCC package. # For optimization, replace /Ti+ with /O+, and delete /B"/DBGPACK". # For C Set++/2, delete /B"/DBGPACK". @@ -56,11 +54,12 @@ ICCFLAGS = /Gm+ /Q+ /Wall- /Ti+ CFLAGS = $(ICCFLAGS) /DMIT_SCHEME LDFLAGS = $(ICCFLAGS) /B"/EXEPACK:2" /B"/DBGPACK" SCHEME_LDFLAGS = $(LDFLAGS) -SYSTEM_LIBS = os2utl\libcrt.lib os2utl\gcc.lib +SYSTEM_LIBS = +SYSTEM_CLEAN = M4 = m4 M4FLAGS = -DOS2 -AS = .\os2utl\as -ASFLAGS = -I +AS = as +ASFLAGS = -Zomf %.obj : %.c $(CC) $(CFLAGS) /C $< diff --git a/v7/src/microcode/oscond.h b/v7/src/microcode/oscond.h index c3aa56764..b18011a09 100644 --- a/v7/src/microcode/oscond.h +++ b/v7/src/microcode/oscond.h @@ -1,6 +1,6 @@ /* -*-C-*- -$Id: oscond.h,v 1.19 1995/06/29 23:49:23 cph Exp $ +$Id: oscond.h,v 1.20 1995/10/15 00:39:20 cph Exp $ Copyright (c) 1990-95 Massachusetts Institute of Technology @@ -169,12 +169,12 @@ MIT in each case. */ #define _OS2 /* Don't really know the version but this is correct for my machine. */ #define _OS2_VERSION 211 -#ifdef _M_I386 +#if defined(_M_I386) || defined(M_I386) #define _OS2386 #ifndef i386 #define i386 #endif /* i386 */ -#endif /* _M_I386 */ +#endif /* _M_I386 or M_I386 */ #endif /* __OS2__ */ #if defined(_BSD) || defined(_SYSV) || defined(_PIXEL) diff --git a/v7/src/microcode/posixtyp.h b/v7/src/microcode/posixtyp.h index ab13da82b..c74d9b880 100644 --- a/v7/src/microcode/posixtyp.h +++ b/v7/src/microcode/posixtyp.h @@ -1,6 +1,6 @@ /* -*-C-*- -$Id: posixtyp.h,v 1.11 1994/11/28 04:30:16 cph Exp $ +$Id: posixtyp.h,v 1.12 1995/10/15 00:39:32 cph Exp $ Copyright (c) 1990-1994 Massachusetts Institute of Technology @@ -104,7 +104,7 @@ MIT in each case. */ #endif #ifdef _OS2 -#ifdef __IBMC__ +#if defined(__IBMC__) || defined(__WATCOMC__) #include #include diff --git a/v7/src/microcode/prosproc.c b/v7/src/microcode/prosproc.c index 62460bdf7..42e1e3642 100644 --- a/v7/src/microcode/prosproc.c +++ b/v7/src/microcode/prosproc.c @@ -1,6 +1,6 @@ /* -*-C-*- -$Id: prosproc.c,v 1.15 1995/10/09 05:56:18 cph Exp $ +$Id: prosproc.c,v 1.16 1995/10/15 00:39:51 cph Exp $ Copyright (c) 1990-95 Massachusetts Institute of Technology @@ -180,11 +180,9 @@ DEFUN (convert_string_vector, (vector), SCHEME_OBJECT vector) return (result); } -#ifdef _OS2 -#ifndef __EMX__ +#if defined(_OS2) && defined(__IBMC__) #define environ _environ #endif -#endif DEFINE_PRIMITIVE ("SCHEME-ENVIRONMENT", Prim_scheme_environment, 0, 0, 0) { -- 2.25.1