/* -*-C-*-
-$Id: bchmmg.c,v 9.97 2000/12/05 21:23:42 cph Exp $
+$Id: bchmmg.c,v 9.98 2000/12/05 21:34:56 cph Exp $
Copyright (c) 1987-2000 Massachusetts Institute of Technology
# include "nt.h"
# define SUB_DIRECTORY_DELIMITER '\\'
#endif
-#ifndef F_OK
-#define F_OK 0
-#define X_OK 1
-#define W_OK 2
-#define R_OK 4
-#endif
-#endif
#ifdef __OS2__
# include "os2.h"
/* -*-C-*-
-$Id: bchpur.c,v 9.69 2000/12/05 21:23:42 cph Exp $
+$Id: bchpur.c,v 9.70 2000/12/05 21:34:56 cph Exp $
Copyright (c) 1987-2000 Massachusetts Institute of Technology
Constant_Top, NORMAL_GC, 1));
}
- if (result != free_buffer_ptr)
- gc_death (TERM_BROKEN_HEART, "purify: constant copy ended too early",
- result, free_buffer_ptr);
- /*NOTREACHED*/
-
length = (new_free_const + 1 - old_free_const);
(*free_buffer_ptr++) = (MAKE_OBJECT (TC_MANIFEST_SPECIAL_NM_VECTOR, 1));
(*free_buffer_ptr++) = (MAKE_OBJECT (END_OF_BLOCK, length));
+++ /dev/null
-/* -*-C-*-
-
-$Id: config.h,v 9.101 2000/01/31 03:32:45 cph Exp $
-
-Copyright (c) 1987-2000 Massachusetts Institute of Technology
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or (at
-your option) any later version.
-
-This program is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-/* This file contains the configuration information and the information
- given on the command line on Unix. */
-
-#ifndef SCM_CONFIG_H
-#define SCM_CONFIG_H
-\f
-/* Default switches. */
-
-#include "oscond.h"
-#include "version.h"
-
-#ifndef butterfly
-#ifndef _UNIX
-/* On unix, these are part of the make file. */
-
-/* Runtime debugging flags, with appropriate defaults: */
-
-/* To debug the interpreter code itself, define ENABLE_DEBUGGING_TOOLS */
-/* #define ENABLE_DEBUGGING_TOOLS */
-
-/* If runtime HISTORY recording (a Scheme code debugging tool) is not
- desired. */
-/* #define DISABLE_HISTORY */
-
-/* To enable the STEPPER. Incompatible with futures. */
-#define COMPILE_STEPPER
-
-/* To enable FUTURES (a multiprocessor / multiprocessing extension).
- This option is incompatible with the stepper.
- Future.c must also be compiled. */
-/* #define COMPILE_FUTURES */
-
-/* To enable stacklets (mostly useful with FUTURES). These allow the
- stack to be allocated in small chunks from the heap, rather than
- in a single contiguous area at start up time. The use of the this
- option is incompatible with the stepper and compiler. */
-
-/* #define USE_STACKLETS */
-#endif /* not _UNIX */
-#endif /* not butterfly */
-
-/* Some configuration consistency testing */
-
-#ifdef COMPILE_STEPPER
-#ifdef COMPILE_FUTURES
-#include "Error: Futures and stepping are not currently compatible."
-#endif
-#endif
-
-#ifdef USE_STACKLETS
-#ifdef COMPILE_STEPPER
-#include "Error: The stepper doesn't work with stacklets."
-#endif
-#endif
-
-/* For use in the C pre-processor, not in code! */
-#define FALSE 0
-#define TRUE 1
-
-/* These C type definitions are needed by everybody.
- They should not be here, but it is unavoidable. */
-typedef char Boolean;
-#define true ((Boolean) TRUE)
-#define false ((Boolean) FALSE)
-
-/* This is the Scheme object type.
- The various fields are defined in "object.h". */
-typedef unsigned long SCHEME_OBJECT;
-#define OBJECT_LENGTH (CHAR_BIT * (sizeof (unsigned long)))
-\f
-/* Operating System / Machine dependencies:
-
- For each implementation, be sure to specify FASL_INTERNAL_FORMAT.
- Make sure that there is an appropriate FASL_<machine name>.
- If there isn't, add one to the list below.
-
- If you do not know the values of the parameters specified below,
- try compiling and running the Wsize program ("make Wsize" if on a
- unix variant). It may not run, but if it does, it will probably
- compute the correct information.
-
- Note that the C type void is used in the sources. If your version
- of C does not have this type, you should bypass it. This can be
- done by inserting the preprocessor command '#define void' in this
- file, under the heading for your kind of machine.
-
- These parameters MUST be specified (and are computed by Wsize):
-
- CHAR_BIT is the size of a character in bits.
-
- FLOATING_ALIGNMENT should be defined ONLY if the system requires
- floating point numbers (double) to be aligned more strictly than
- SCHEME_OBJECTs (unsigned long). The value must be a mask of the
- low order bits which are required to be zero for the storage
- address. For example, a value of 0x7 requires octabyte alignment
- on a machine where addresses are specified in bytes. The alignment
- must be an integral multiple of the length of a long.
-
- VAX_BYTE_ORDER should be defined ONLY if the least significant byte
- of a longword in memory lies at the lowest address, not defined
- otherwise (i.e. Motorola MC68020, with opposite convention, or
- PDP-10 with word addressing).
-
- Other flags (the safe option is NOT to define them, which will
- sacrifice speed for safety):
-
- HEAP_IN_LOW_MEMORY should be defined if malloc returns the lowest
- available memory and thus all addresses will fit in the datum portion
- of a Scheme object. The datum portion of a Scheme object is 8 bits
- less than the length of a C long.
-
- b32 says that objects are 32 bits long. The information is
- redundant, but some C compilers do not do constant folding when
- shifts are involved, so it sometimes makes a big difference to
- define the constants directly rather than in terms of other
- constants. Similar things can be done for other word sizes.
-
- The following switches say whether to use the system-provided
- library routines rather than the emulated versions in the Scheme
- sources. The library routines should be more accurate and probably
- more efficient.
-
- HAS_FLOOR should be defined if the system has the double-precision
- procedures floor and ceil. On Unix, look for floor(3M).
-
- HAS_FREXP should be defined if the system has the double-precision
- procedures ldexp and frexp. On Unix, look for frexp(3C).
-
- HAS_MODF should be defined if the system has the double-precision
- procedure modf. On Unix, look for frexp(3C). **** This flag is
- new as of 22-SEP-89; please comment out any incorrect #define's as
- we haven't been able to test this on all machines.
-
-*/
-\f
-/* Possible values for FASL_INTERNAL_FORMAT. For the most part this
- means the processor type, so for example there are several aliases
- for 68000 family processors. This scheme allows sharing of
- compiled code on machines with the same processor type. Probably
- we will have to create a more powerful method of identifying FASL
- files when we introduce new differences, such as whether or not a
- 68881 coprocessor is installed. */
-
-#define FASL_UNKNOWN 0
-#define FASL_PDP10 1
-#define FASL_VAX 2
-#define FASL_68020 3
-#define FASL_68000 4
-#define FASL_HP_9000_500 5
-#define FASL_I386 6
-#define FASL_BFLY 7
-#define FASL_CYBER 8
-#define FASL_CELERITY 9
-#define FASL_HP_SPECTRUM 10
-#define FASL_UMAX 11
-#define FASL_PYR 12
-#define FASL_ALLIANT 13
-#define FASL_SPARC 14
-#define FASL_MIPS 15
-#define FASL_APOLLO_68K 16
-#define FASL_APOLLO_PRISM 17
-#define FASL_ALPHA 18
-#define FASL_RS6000 19
-\f
-#ifdef vax
-
-/* Amazingly unix and vms agree on all these */
-
-#define MACHINE_TYPE "vax"
-#define FASL_INTERNAL_FORMAT FASL_VAX
-#define HAS_COMPILER_SUPPORT
-#define TYPE_CODE_LENGTH 6
-#define VAX_BYTE_ORDER
-#define b32
-#define HEAP_IN_LOW_MEMORY
-#define HAS_FLOOR
-#define HAS_FREXP
-#define HAS_MODF
-
-/* Not on these, however */
-
-#ifdef vms
-
-#define VMS_VERSION 4
-#define VMS_SUBVERSION 5
-
-/* If your C runtime library already defines the `tbuffer' datatype,
- then define this symbol. */
-/* #define HAVE_TBUFFER */
-
-/* Name conflict in VMS with system variable */
-#define Free Free_Register
-
-#if (VMS_VERSION < 4)
-/* Pre version 4 VMS has no void type. */
-#define void
-#endif /* VMS_VERSION */
-
-/* This eliminates a spurious warning from the C compiler. */
-#define main_type
-
-/* exit(0) produces horrible message on VMS */
-#define NORMAL_EXIT 1
-
-#define EXIT_SCHEME_DECLARATIONS static jmp_buf exit_scheme_jmp_buf
-
-#define INIT_EXIT_SCHEME() \
-{ \
- int which_way = (setjmp (exit_scheme_jmp_buf)); \
- if (which_way == NORMAL_EXIT) \
- return; \
-}
-
-#define EXIT_SCHEME(value) \
-{ \
- if (value != 0) \
- exit (value); \
- longjmp (exit_scheme_jmp_buf, NORMAL_EXIT); \
-}
-
-#else /* not vms */
-
-/* Vax Unix C compiler bug */
-#define HAVE_DOUBLE_TO_LONG_BUG
-
-#endif /* not vms */
-#endif /* vax */
-\f
-#if defined(hp9000s800) || defined(__hp9000s800)
-#if defined(hp9000s700) || defined(__hp9000s700)
-#define MACHINE_TYPE "hp9000s700"
-#else
-#define MACHINE_TYPE "hp9000s800"
-#endif
-#define FASL_INTERNAL_FORMAT FASL_HP_SPECTRUM
-#define HAS_COMPILER_SUPPORT
-#define TYPE_CODE_LENGTH 6
-#define FLOATING_ALIGNMENT 0x7
-#define b32
-
-#define HAS_FLOOR
-#define HAS_FREXP
-#define HAS_MODF
-
-/* Heap resides in data space, pointed at by space register 5.
- Short pointers must have their high two bits set to 01 so that
- it is interpreted as space register 5, 2nd quadrant.
-
- This is kludged by the definitions below, and is still considered
- HEAP_IN_LOW_MEMORY. */
-
-#define HEAP_IN_LOW_MEMORY
-
-/* data segment bits and mask for all bits */
-
-#define HPPA_QUAD_BIT 0x40000000
-#define HPPA_QUAD_MASK 0xC0000000
-
-#define DATUM_TO_ADDRESS(datum) \
- ((SCHEME_OBJECT *) (((unsigned long) (datum)) | HPPA_QUAD_BIT))
-
-#define ADDRESS_TO_DATUM(address) \
- ((SCHEME_OBJECT) (((unsigned long) (address)) & (~(HPPA_QUAD_MASK))))
-
-#if (VERSION > 11)
-
-/* SHARP_F is a magic value:
- Typecode TC_CONSTANT, high datum bits #b100, low datum bits are the top
- TYPE_CODE_LENGTH bits of HPPA_QUAD_BIT
-
- SHARP_F is stored in gr5 for access by compiled code. This allows
- us to generate #F and test against #F quickly, and also to use gr5
- for compiled OBJECT->ADDRESS operations. If we ever go to 5bit
- typecodes we will be able to dispense with this overloading.
-
- See also cmpauxmd/hppa.m4
-*/
-
-#define SHARP_F 0x22000010
-#endif /* (VERSION > 11) */
-
-#endif /* hp9000s800 */
-
-#if defined(hp9000s300) || defined(__hp9000s300)
-#if defined(hp9000s400) || defined(__hp9000s400)
-#define MACHINE_TYPE "hp9000s400"
-#else
-#define MACHINE_TYPE "hp9000s300"
-#endif
-#ifdef MC68010
-#define FASL_INTERNAL_FORMAT FASL_68000
-#else
-#define FASL_INTERNAL_FORMAT FASL_68020
-#define HAS_COMPILER_SUPPORT
-#endif
-#define b32
-#define HEAP_IN_LOW_MEMORY
-#define TYPE_CODE_LENGTH 6
-
-#define HAS_FLOOR
-#define HAS_FREXP
-#define HAS_MODF
-
-#endif /* hp9000s300 */
-
-#ifdef hp9000s500
-#define MACHINE_TYPE "hp9000s500"
-#define FASL_INTERNAL_FORMAT FASL_HP_9000_500
-#define b32
-
-/* An unfortunate fact of life on this machine:
- the C heap is in high memory thus HEAP_IN_LOW_MEMORY is not
- defined and the whole thing runs slowly. */
-
-/* C Compiler bug when constant folding and anchor pointing */
-#define And2(x, y) ((x) ? (y) : false)
-#define And3(x, y, z) ((x) ? ((y) ? (z) : false) : false)
-#define Or2(x, y) ((x) ? true : (y))
-#define Or3(x, y, z) ((x) ? true : ((y) ? true : (z)))
-
-#define HAS_FLOOR
-#define HAS_FREXP
-#define HAS_MODF
-
-#endif /* hp9000s500 */
-\f
-#ifdef sparc
-#define MACHINE_TYPE "sun4"
-#define FASL_INTERNAL_FORMAT FASL_SPARC
-#define FLOATING_ALIGNMENT 0x7
-#define b32
-#define HEAP_IN_LOW_MEMORY
-#define HAS_FLOOR
-#define HAS_FREXP
-#define HAS_MODF
-#define HAVE_DOUBLE_TO_LONG_BUG
-#endif
-
-#ifdef sun3
-#define MACHINE_TYPE "sun3"
-#define FASL_INTERNAL_FORMAT FASL_68020
-#define HAS_COMPILER_SUPPORT
-#define TYPE_CODE_LENGTH 6
-#define b32
-#define HEAP_IN_LOW_MEMORY
-#define HAS_FLOOR
-#define HAS_FREXP
-#define HAS_MODF
-#define HAVE_DOUBLE_TO_LONG_BUG
-#endif
-
-#ifdef sun2
-#define MACHINE_TYPE "sun2"
-#define FASL_INTERNAL_FORMAT FASL_68000
-#define b32
-#define HEAP_IN_LOW_MEMORY
-#define HAS_FLOOR
-#define HAS_FREXP
-#define HAS_MODF
-#define HAVE_DOUBLE_TO_LONG_BUG
-#endif
-
-#ifdef NeXT
-#define MACHINE_TYPE "next"
-#define FASL_INTERNAL_FORMAT FASL_68020
-#define HAS_COMPILER_SUPPORT
-#define TYPE_CODE_LENGTH 6
-#define b32
-#define HEAP_IN_LOW_MEMORY
-#define HAS_FLOOR
-#define HAS_FREXP
-#define HAS_MODF
-#endif
-\f
-#ifdef i386
-
-#define FASL_INTERNAL_FORMAT FASL_I386
-#define HAS_COMPILER_SUPPORT
-#define HEAP_IN_LOW_MEMORY
-#define TYPE_CODE_LENGTH 6
-#define VAX_BYTE_ORDER
-#define b32
-
-#ifdef sequent
-# define MACHINE_TYPE "sequent386"
-#endif
-
-#ifdef sun
-# define MACHINE_TYPE "sun386i"
-#endif
-
-#ifndef MACHINE_TYPE
-# define MACHINE_TYPE "i386/i486"
-#endif
-
-/* These are really OS-dependent.
- They are correct for the sequent, SYSV3, DOS (Zortech),
- but we don't know about other 386 systems.
- */
-
-/* Bug in Mach 3.0 for 386s floating point library, and for linux
- 1.2.9 running GCC 2.6.3. */
-#if !(defined(_MACH_UNIX) || defined(__linux))
-# define HAS_FLOOR
-# define HAS_FREXP
-# define HAS_MODF
-#endif
-
-#ifdef __linux
-extern void * linux_heap_malloc (unsigned long);
-#define HEAP_MALLOC linux_heap_malloc
-#define HEAP_FREE(address)
-#endif
-
-#ifdef __FreeBSD__
-extern void * freebsd_heap_malloc (unsigned long);
-#define HEAP_MALLOC freebsd_heap_malloc
-#define HEAP_FREE(address)
-#endif
-
-/* !WINNT_RAW_ADDRESSES is useful only for Windows 3.1, which we no
- longer support -- so define it always. */
-#ifdef WINNT
-#ifndef WINNT_RAW_ADDRESSES
-#define WINNT_RAW_ADDRESSES
-#endif
-#endif
-
-#if defined(WINNT) && !defined(WINNT_RAW_ADDRESSES)
-
-/* This kludge exists because of Win32s which allocates
- user memory with the high bit set on addresses.
- Real NT doesn't have this problem, but we want to
- share binaries.
- */
-
-typedef unsigned long SCHEME_ADDR;
-extern unsigned long winnt_address_delta;
-
-#define DATUM_TO_ADDRESS(datum) \
- ((SCHEME_OBJECT *) (((unsigned long) (datum)) + winnt_address_delta))
-
-#define ADDRESS_TO_DATUM(address) \
- ((SCHEME_OBJECT) (((unsigned long) (address)) - winnt_address_delta))
-
-#define SCHEME_ADDR_TO_ADDR(saddr) (DATUM_TO_ADDRESS (saddr))
-#define ADDR_TO_SCHEME_ADDR(caddr) (ADDRESS_TO_DATUM (caddr))
-#define HOOK_TO_SCHEME_OFFSET(hook) (ADDRESS_TO_DATUM (hook))
-
-#endif /* WINNT && !WINNT_RAW_ADDRESSES */
-
-#endif /* i386 */
-\f
-#ifdef mips
-
-#define MACHINE_TYPE "mips"
-#define FASL_INTERNAL_FORMAT FASL_MIPS
-#define HAS_COMPILER_SUPPORT
-#define TYPE_CODE_LENGTH 6
-#define FLOATING_ALIGNMENT 0x7
-#define b32
-
-#ifdef ultrix
-#define VAX_BYTE_ORDER
-#else
-#ifdef MIPSEL
-#define VAX_BYTE_ORDER
-#endif
-#endif
-
-#if defined(sony) || defined(_IRIX)
-#define HAS_FLOOR
-#define HAS_FREXP
-#define HAS_MODF
-#endif
-
-#if defined(_IRIX6) && defined(HAS_COMPILER_SUPPORT) && !defined(NATIVE_CODE_IS_C)
-extern void * irix_heap_malloc (long);
-#define HEAP_MALLOC irix_heap_malloc
-#endif
-
-/* Heap resides in data space which begins at 0x10000000. This is
- kludged by the definitions below, and is still considered
- HEAP_IN_LOW_MEMORY. */
-
-#define HEAP_IN_LOW_MEMORY
-#define MIPS_DATA_BIT 0x10000000
-
-#define DATUM_TO_ADDRESS(datum) \
- ((SCHEME_OBJECT *) (((unsigned long) (datum)) | MIPS_DATA_BIT))
-
-#define ADDRESS_TO_DATUM(address) \
- ((SCHEME_OBJECT) (((unsigned long) (address)) & (~(MIPS_DATA_BIT))))
-
-/* MIPS compiled binaries are large! */
-#ifdef HAS_COMPILER_SUPPORT
-
-#ifndef DEFAULT_SMALL_CONSTANT
-#define DEFAULT_SMALL_CONSTANT 700
-#endif
-
-#ifndef DEFAULT_LARGE_CONSTANT
-#define DEFAULT_LARGE_CONSTANT 1500
-#endif
-
-#endif /* HAS_COMPILER_SUPPORT */
-
-#endif /* mips */
-\f
-#ifdef __alpha
-#define MACHINE_TYPE "Alpha"
-#define FASL_INTERNAL_FORMAT FASL_ALPHA
-#define HAS_COMPILER_SUPPORT
-#define TYPE_CODE_LENGTH 8
-
-/* The ASCII character set is used. */
-#define HEAP_IN_LOW_MEMORY 1
-/* unsigned longs use logical shifting. */
-#define VAX_BYTE_ORDER 1
-
-/* Flonums have no special alignment constraints. */
-#define FLONUM_MANTISSA_BITS 53
-#define FLONUM_EXPT_SIZE 10
-#define MAX_FLONUM_EXPONENT 1023
-/* Floating point representation uses hidden bit. */
-#define HAS_FLOOR
-/* #define HAS_FREXP */
-#define HAS_MODF
-
-#if defined(HAS_COMPILER_SUPPORT) && !defined(NATIVE_CODE_IS_C)
-extern void * alpha_heap_malloc (long);
-# define HEAP_MALLOC alpha_heap_malloc
-#endif
-
-#endif /* __alpha */
-\f
-#ifdef _OS2
-
-#define PREALLOCATE_HEAP_MEMORY() \
-{ \
- extern void OS2_alloc_heap (void); \
- OS2_alloc_heap (); \
-}
-
-extern void * OS2_commit_heap (unsigned long);
-#define HEAP_MALLOC OS2_commit_heap
-#define HEAP_FREE(address)
-
-#define EXIT_SCHEME_DECLARATIONS extern void OS2_exit_scheme (int)
-#define EXIT_SCHEME OS2_exit_scheme
-
-extern void OS2_stack_reset (void);
-#define STACK_RESET OS2_stack_reset
-
-extern int OS2_stack_overflowed_p (void);
-#define STACK_OVERFLOWED_P OS2_stack_overflowed_p
-
-#endif /* _OS2 */
-
-#ifdef DOS386
-extern void EXFUN (dos386_stack_reset, (void));
-#define STACK_RESET dos386_stack_reset
-#endif /* DOS386 */
-
-#ifdef WINNT
-
-extern void EXFUN (winnt_stack_reset, (void));
-#define STACK_RESET winnt_stack_reset
-
-#define HEAP_MALLOC(size) (WIN32_ALLOCATE_HEAP ((size), (&scheme_heap_handle)))
-#define HEAP_FREE(base) \
- WIN32_RELEASE_HEAP (((char *) (base)), scheme_heap_handle)
-
-/* We must not define `main' as that causes conflicts when compiling
- this code with the Watcom C compiler. */
-#define main_name scheme_main
-
-#endif /* WINNT */
-\f
-/* These (pdp10, nu) haven't worked in a while.
- Should be upgraded or flushed some day. */
-
-#ifdef pdp10
-#define MACHINE_TYPE "pdp10"
-#define FASL_INTERNAL_FORMAT FASL_PDP10
-#define HEAP_IN_LOW_MEMORY
-#define CHAR_BIT 36 / * Ugh! Supposedly fixed in newer Cs * /
-#define UNSIGNED_SHIFT_BUG
-#endif /* pdp10 */
-
-#ifdef nu
-#define MACHINE_TYPE "nu"
-#define FASL_INTERNAL_FORMAT FASL_68000
-#define b32
-#define HEAP_IN_LOW_MEMORY
-#define HAS_FREXP
-#define UNSIGNED_SHIFT_BUG
-#endif /* nu */
-
-/* These are pretty old too, but more recent versions have run. */
-
-#ifdef butterfly
-#define MACHINE_TYPE "butterfly"
-#define FASL_INTERNAL_FORMAT FASL_BFLY
-#define b32
-#define HEAP_IN_LOW_MEMORY
-#include <public.h>
-#define HAS_FREXP
-#define HAS_MODF
-#endif
-\f
-#ifdef cyber180
-#define MACHINE_TYPE "cyber180"
-#define FASL_INTERNAL_FORMAT FASL_CYBER
-#define HEAP_IN_LOW_MEMORY
-#define UNSIGNED_SHIFT_BUG
-/* The Cyber180 C compiler manifests a bug in hairy conditional expressions */
-#define Conditional_Bug
-#endif /* cyber180 */
-
-#ifdef celerity
-#define MACHINE_TYPE "celerity"
-#define FASL_INTERNAL_FORMAT FASL_CELERITY
-#define b32
-#define HEAP_IN_LOW_MEMORY
-#endif /* celerity */
-
-#ifdef umax
-#define MACHINE_TYPE "umax"
-#define FASL_INTERNAL_FORMAT FASL_UMAX
-#define VAX_BYTE_ORDER
-#define b32
-#define HEAP_IN_LOW_MEMORY
-#define HAS_FLOOR
-#define HAS_FREXP
-#define HAS_MODF
-#endif /* umax */
-
-#ifdef pyr
-#define MACHINE_TYPE "pyramid"
-#define FASL_INTERNAL_FORMAT FASL_PYR
-#define b32
-#define HEAP_IN_LOW_MEMORY
-#endif /* pyr */
-
-#ifdef alliant
-#define MACHINE_TYPE "alliant"
-#define FASL_INTERNAL_FORMAT FASL_ALLIANT
-#define b32
-#define HEAP_IN_LOW_MEMORY
-#define HAS_FLOOR
-#define HAS_FREXP
-#define HAS_MODF
-#endif /* alliant */
-
-#ifdef apollo
-#if _ISP__M68K
-#define MACHINE_TYPE "Apollo 68k"
-#define FASL_INTERNAL_FORMAT FASL_APOLLO_68K
-#define TYPE_CODE_LENGTH 6
-#else
-#define MACHINE_TYPE "Apollo Prism"
-#define FASL_INTERNAL_FORMAT FASL_APOLLO_PRISM
-#endif
-#define b32
-#define HEAP_IN_LOW_MEMORY
-#define HAS_FLOOR
-#define HAS_FREXP
-#endif /* apollo */
-
-#ifdef _IBMR2
-#define MACHINE_TYPE "IBM RS6000"
-#define FASL_INTERNAL_FORMAT FASL_RS6000
-/* Heap is not in Low Memory. */
-#define FLONUM_MANTISSA_BITS 53
-#define FLONUM_EXPT_SIZE 10
-#define MAX_FLONUM_EXPONENT 1023
-#endif /* _IBMR2 */
-\f
-#ifdef NATIVE_CODE_IS_C
-# ifndef HAS_COMPILER_SUPPORT
-# define HAS_COMPILER_SUPPORT
-# endif
-# ifndef TYPE_CODE_LENGTH
-# define TYPE_CODE_LENGTH 6
-# endif
-#endif
-
-/* Make sure that some definition applies. If this error occurs, and
- the parameters of the configuration are unknown, try the Wsize
- program. */
-#ifndef MACHINE_TYPE
-#include "Error: config.h: Unknown configuration."
-#endif
-
-/* Virtually all machines have 8-bit characters these days, so don't
- explicitly specify this value unless it is different. */
-#ifndef CHAR_BIT
-#define CHAR_BIT 8
-#endif
-
-#ifndef TYPE_CODE_LENGTH
-# define TYPE_CODE_LENGTH 8
-#endif
-
-/* The GNU C compiler does not have any of these bugs. */
-#ifdef __GNUC__
-#undef HAVE_DOUBLE_TO_LONG_BUG
-#undef UNSIGNED_SHIFT_BUG
-#undef Conditional_Bug
-#endif
-
-#endif /* not SCM_CONFIG_H */
+++ /dev/null
-;;; -*-Midas-*-
-;;;
-;;; $Id: dosasutl.asm,v 1.4 1999/01/02 06:11:34 cph Exp $
-;;;
-;;; Copyright (c) 1992, 1999 Massachusetts Institute of Technology
-;;;
-;;; This program is free software; you can redistribute it and/or
-;;; modify it under the terms of the GNU General Public License as
-;;; published by the Free Software Foundation; either version 2 of the
-;;; License, or (at your option) any later version.
-;;;
-;;; This program is distributed in the hope that it will be useful,
-;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-;;; General Public License for more details.
-;;;
-;;; You should have received a copy of the GNU General Public License
-;;; along with this program; if not, write to the Free Software
-;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-;;;
-
-.386
-.model tiny
- .code
-\f
- public _getCS
-_getCS:
- xor eax,eax ; clear eax
- mov ax,cs ; copy code segment descriptor
- ret
-
- public _getSS
-_getSS:
- xor eax,eax ; clear eax
- mov ax,ss ; copy code segment descriptor
- ret
-
-;; Frame on entry to farcpy
-
-;;24 size
-;;20 src_sel
-;;16 src_off
-;;12 dst_sel
-;;8 dst_off
-;;4 ret add
-;;0 previous ebp
-
- public _farcpy
-_farcpy:
- push ebp
- mov ebp,esp
- push ebx
- push ds
- push es
-
- mov eax,12[ebp]
- mov ds,ax ; dst sel
- mov eax,20[ebp]
- mov es,ax ; src sel
- mov edx,8[ebp] ; dst off
- mov ecx,16[ebp] ; src off
- mov eax,24[ebp] ; count
- jmp enter_loop
-
-farcpy_loop:
- mov bl,es:[ecx]
- mov ds:[edx],bl
- inc ecx
- inc edx
-
-enter_loop:
- dec eax
- jge farcpy_loop
-
- pop es
- pop ds
- pop ebx
- pop ebp
- ret
-end
+++ /dev/null
-/* -*-C-*-
-
-$Id: dosconio.c,v 1.13 1999/01/02 06:11:34 cph Exp $
-
-Copyright (c) 1992-1999 Massachusetts Institute of Technology
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or (at
-your option) any later version.
-
-This program is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-/* Console I/O supplement */
-
-#include "scheme.h"
-#include "prims.h"
-#include "msdos.h"
-#include "dosio.h"
-#include "dosscan.h"
-#include "dossys.h"
-#include "intrpt.h"
-\f
-#ifdef __STDC__
-#define fileno(fp) ((fp)->_file)
-#endif
-
-#define CONIO_BUFFER_SIZE (1024)
-#define TYPEAHEAD_BUFFER_SIZE (1024)
-
-#define System_Error_Reset() \
- (errno = 0)
-
-#define System_Error_Return(err) \
-{ \
- errno = err; \
- return -1; \
-}
-
-/* Characters are kept in the typeahead_buffer before read is called,
- in the key_buffer before return is pressed, and in the line_buffer
- before the line is read.
- */
-typedef struct conin_buffer_struct
-{
- unsigned char buffer[CONIO_BUFFER_SIZE];
- size_t length;
-} conio_buffer_t;
-
-typedef struct typeahead_buffer_struct
-{
- unsigned char buffer[TYPEAHEAD_BUFFER_SIZE];
- size_t length;
-} typeahead_buffer_t;
-
-static conio_buffer_t line_buffer, key_buffer;
-static typeahead_buffer_t typeahead_buffer;
-\f
-static int max_scancode_conversion_length = 1;
-static unsigned char * keyboard_scancode_table[] = DEFAULT_SCANCODE_CONVERSIONS;
-
-#define IMAX(a, b) (((a) > (b)) ? (a) : (b))
-
-#define TYPEAHEAD_BUFFER_REMAINING() \
- (TYPEAHEAD_BUFFER_SIZE - typeahead_buffer.length)
-
-#define TYPEAHEAD_BUFFER_AVAILABLE_P() \
- ((TYPEAHEAD_BUFFER_REMAINING ()) >= max_scancode_conversion_length)
-
-static void
-DEFUN (map_keyboard_scancode, (scancode), unsigned char scancode)
-{
- extern int signal_keyboard_character_interrupt (int);
-
- if (scancode < KEYBOARD_SCANCODE_TABLE_SIZE)
- {
- int len;
- unsigned char * conversion = keyboard_scancode_table[scancode];
- if (conversion == NO_CONVERSION)
- return;
- else if (conversion == SOFT_ATTN)
- {
- signal_keyboard_character_interrupt (-1);
- return;
- }
- else if (conversion == HARD_ATTN)
- {
- signal_keyboard_character_interrupt (-2);
- return;
- }
-
- len = ((conversion == CTRL_AT) ? 1 : (strlen (conversion)));
-
- if (len <= (TYPEAHEAD_BUFFER_REMAINING ()))
- {
- /* Copy conversion string into typeahead buffer, worrying about
- interrupt characters along the way.
- */
- while (--len >= 0)
- {
- if ((signal_keyboard_character_interrupt ((int) (*conversion))) == 0)
- typeahead_buffer.buffer[typeahead_buffer.length++] = *conversion++;
- }
- }
- }
- return;
-}
-\f
-static void
-DEFUN_VOID (recompute_max_scancode_conversion_length)
-{
- int i, length;
- max_scancode_conversion_length = 1;
-
- for (i = 0; i < KEYBOARD_SCANCODE_TABLE_SIZE; i++)
- {
- unsigned char * conversion = keyboard_scancode_table[i];
- if (conversion == NO_CONVERSION)
- length = 0;
- else if (conversion == CTRL_AT)
- length = 1;
- else
- length = (strlen (conversion));
- max_scancode_conversion_length = (IMAX (length,
- max_scancode_conversion_length));
- }
- return;
-}
-
-static void
-DEFUN_VOID (consume_typeahead)
-{
- extern int signal_keyboard_character_interrupt (int);
- unsigned char character;
-
- while ((TYPEAHEAD_BUFFER_AVAILABLE_P ()) &&
- (dos_poll_keyboard_character (&character)))
- {
- if (character == '\0') /* Extended scancode */
- {
- dos_poll_keyboard_character (&character);
- map_keyboard_scancode (character);
- }
- else if ((signal_keyboard_character_interrupt ((int) character)) == 0)
- typeahead_buffer.buffer[typeahead_buffer.length++] = character;
- else
- break;
- }
- return;
-}
-
-static int
-DEFUN_VOID (typeahead_available_p)
-{
- consume_typeahead ();
- return (!(typeahead_buffer.length == 0));
-}
-
-static unsigned char
-DEFUN_VOID (get_typeahead_character)
-{
- if (typeahead_buffer.length == 0)
- return '\0';
- else
- {
- int i;
- unsigned char result;
-
- result = typeahead_buffer.buffer[0];
- for (i = 1; i < typeahead_buffer.length; i++)
- typeahead_buffer.buffer[i - 1] = typeahead_buffer.buffer[i];
- typeahead_buffer.length--;
- return (result);
- }
-}
-\f
-static void
-DEFUN (key_buffer_insert_self, (c), unsigned char c)
-{
- static unsigned char crlf[] = {CARRIAGE_RETURN, LINEFEED};
-
- if (key_buffer.length != CONIO_BUFFER_SIZE)
- {
- key_buffer.buffer[key_buffer.length++] = c;
- if (c == LINEFEED)
- dos_console_write (crlf, (sizeof (crlf)));
- else
- dos_console_write (&c, 1);
- }
- return;
-}
-
-static void
-DEFUN_VOID (key_buffer_erase_character)
-{
- static char erase[] = {BACKSPACE, SPACE, BACKSPACE};
-
- if (key_buffer.length != 0)
- {
- key_buffer.length -= 1;
- dos_console_write (erase, (sizeof (erase)));
- }
- return;
-}
-
-static void
-DEFUN_VOID (key_buffer_to_line_buffer)
-{
- register size_t i = 0;
- register size_t j = 0;
-
- while ((i < key_buffer.length)
- && (line_buffer.length != CONIO_BUFFER_SIZE))
- line_buffer.buffer[line_buffer.length++] = key_buffer.buffer[i++];
- while (i < key_buffer.length)
- key_buffer.buffer[j++] = key_buffer.buffer[i++];
- key_buffer.length = j;
- return;
-}
-\f
-void
-DEFUN_VOID (flush_conio_buffers)
-{
- line_buffer.length = 0;
- key_buffer.length = 0;
- typeahead_buffer.length = 0;
- return;
-}
-
-void
-DEFUN_VOID (DOS_initialize_conio)
-{
- void initialize_keyboard_interrupt_table (void);
- void initialize_scancode_table (void);
-
- flush_conio_buffers ();
- initialize_keyboard_interrupt_table ();
- initialize_scancode_table ();
- return;
-}
-
-extern void EXFUN (DOS_initialize_fov, (SCHEME_OBJECT));
-
-/* This sets up the interrupt handlers for both DOS and NT,
- so that bands can be shared.
- */
-
-void
-DEFUN (DOS_initialize_fov, (fov), SCHEME_OBJECT fov)
-{
- int ctr, in;
- SCHEME_OBJECT iv, imv, prim, mask;
- extern SCHEME_OBJECT EXFUN (make_primitive, (char *, int));
- static int interrupt_numbers[] = {
- Global_GC_Level,
- Global_1_Level
- };
- static long interrupt_masks[] = {
- 0, /* No interrupts allowed */
- (INT_Stack_Overflow | INT_Global_GC | INT_GC)
- };
-
- iv = (FAST_VECTOR_REF (fov, System_Interrupt_Vector));
- imv = (FAST_VECTOR_REF (fov, FIXOBJ_INTERRUPT_MASK_VECTOR));
- prim = (make_primitive ("MICROCODE-POLL-INTERRUPT-HANDLER", 2));
-
- for (ctr = 0; ctr < ((sizeof (interrupt_numbers)) / (sizeof (int))); ctr++)
- {
- in = interrupt_numbers[ctr];
- VECTOR_SET (iv, in, prim);
- VECTOR_SET (imv, in, (long_to_integer (interrupt_masks[ctr])));
- }
- return;
-}
-
-static void
-DEFUN (non_buffered_key_command, (c), unsigned char c)
-{
- if (line_buffer.length == CONIO_BUFFER_SIZE) return;
-
- if ((!DOS_keyboard_intercepted_p)
- && (c == BACKSPACE))
- c = DELETE;
- line_buffer.buffer[line_buffer.length++] = c;
- return;
-}
-
-static int
-DEFUN (empty_line_buffer, (buffer, nbytes), char * buffer AND size_t nbytes)
-{
- register size_t i, j;
-
- for (i = 0; ((i < line_buffer.length)&&(i < nbytes)); i++)
- *buffer++ = line_buffer.buffer[i];
- nbytes = i;
- for (j = 0; i < line_buffer.length; i++, j++)
- line_buffer.buffer[j] = line_buffer.buffer[i];
- line_buffer.length -= nbytes;
- return (nbytes);
-}
-\f
-static void
-DEFUN (buffered_key_command, (c), unsigned char c)
-{
- switch(c)
- {
- case CARRIAGE_RETURN:
- case LINEFEED:
- key_buffer_insert_self(LINEFEED);
- key_buffer_to_line_buffer();
- break;
- case DELETE:
- case BACKSPACE: /* Backspace */
- if (key_buffer.length != 0)
- key_buffer_erase_character();
- break;
- default:
- key_buffer_insert_self(c);
- break;
- }
- return;
-}
-
-long
-DEFUN (console_read, (buffer, nbytes, buffered_p, blocking_p, intrpt_p),
- char * buffer AND unsigned nbytes
- AND int buffered_p AND int blocking_p AND int intrpt_p)
-{
- System_Error_Reset ();
- do
- { /* Get all pending characters into the buffer */
- while (typeahead_available_p ())
- {
- if (buffered_p)
- buffered_key_command (get_typeahead_character ());
- else
- /* Non buffered channel, in CScheme, also no echo. */
- non_buffered_key_command (get_typeahead_character ());
- } /* End WHILE */
- /* Test for pending interrupts here: */
- if (intrpt_p && (pending_interrupts_p ()))
- {
- if (INTERRUPT_QUEUED_P (INT_Character))
- flush_conio_buffers ();
- System_Error_Return (EINTR);
- }
- /* Return if we buffered up a line, or channel is not buffered */
- if (line_buffer.length != 0)
- return (empty_line_buffer (buffer, nbytes));
- } while (blocking_p); /* Keep reading for blocking channel. */
- /* This means there is nothing available, don't block */
- System_Error_Return (ERRNO_NONBLOCK);
- return (0);
-}
-\f
-DEFINE_PRIMITIVE ("MICROCODE-POLL-INTERRUPT-HANDLER", Prim_dos_high_priority_timer,
- 2, 2, "DOS Polling interrupt handler---timer and keyboard.")
-{
- extern void EXFUN (dos_process_timer_interrupt, (void));
- PRIMITIVE_HEADER (2);
-
- consume_typeahead ();
- dos_process_timer_interrupt ();
- CLEAR_INTERRUPT (INT_Global_GC);
- PRIMITIVE_RETURN (UNSPECIFIC);
-}
-
-DEFINE_PRIMITIVE ("KEYBOARD-GET-CONVERSION", Prim_keyboard_get_conversion, 1, 1,
- "Translate a keyboard scan code into a string.")
-{
- PRIMITIVE_HEADER (1);
- {
- long scancode = arg_integer(1);
-
- if ((scancode < 0) || (scancode >= KEYBOARD_SCANCODE_TABLE_SIZE))
- error_bad_range_arg(1);
- else
- {
- unsigned char * conversion = keyboard_scancode_table[scancode];
- if (conversion == NO_CONVERSION)
- PRIMITIVE_RETURN (SHARP_F);
- else if (conversion == CTRL_AT)
- PRIMITIVE_RETURN (memory_to_string (1, "\0"));
- else
- PRIMITIVE_RETURN (char_pointer_to_string (conversion));
- }
- }
-}
-
-#ifndef ULONG_BIT
-# define ULONG_BIT ((sizeof (unsigned long)) * CHAR_BIT)
-#endif
-
-#define MALLOCED_TABLE_SIZE \
- ((KEYBOARD_SCANCODE_TABLE_SIZE + (ULONG_BIT - 1)) / ULONG_BIT)
-
-static unsigned long scancode_malloced_table[MALLOCED_TABLE_SIZE] = {0,};
-
-#define SCANCODE_TO_MALLOCED_TABLE_WORD(s) ((s) / ULONG_BIT)
-#define SCANCODE_TO_MALLOCED_TABLE_BIT(s) ((s) % ULONG_BIT)
-
-#define SCANCODE_MALLOCED_P(s) \
- ((scancode_malloced_table[SCANCODE_TO_MALLOCED_TABLE_WORD (s)] & \
- (1 << SCANCODE_TO_MALLOCED_TABLE_BIT (s))) \
- != 0)
-
-#define SCANCODE_MALLOCED(s) \
- (scancode_malloced_table[SCANCODE_TO_MALLOCED_TABLE_WORD (s)] |= \
- (1 << SCANCODE_TO_MALLOCED_TABLE_BIT (s)))
-
-#define SCANCODE_MALLOCED_NOT(s) \
- (scancode_malloced_table[SCANCODE_TO_MALLOCED_TABLE_WORD (s)] &= \
- (~(1 << SCANCODE_TO_MALLOCED_TABLE_BIT (s))))
-
-static void
-DEFUN_VOID (initialize_scancode_table)
-{
- int i;
-
- for (i = 0; i < MALLOCED_TABLE_SIZE; i++)
- scancode_malloced_table[i] = ((unsigned long) 0);
- recompute_max_scancode_conversion_length ();
- return;
-}
-\f
-DEFINE_PRIMITIVE ("KEYBOARD-SET-CONVERSION!", Prim_keyboard_set_conversion, 2, 2,
- "Set the translation for a keyboard scan code.")
-{
- PRIMITIVE_HEADER (2);
- {
- int scancode = (arg_integer (1));
- SCHEME_OBJECT scheme_conversion = (ARG_REF (2));
-
- if ((scancode < 0) || (scancode >= KEYBOARD_SCANCODE_TABLE_SIZE))
- error_bad_range_arg(1);
- else
- {
- int len;
- unsigned char * old_conversion = keyboard_scancode_table[scancode];
- int old_malloced_p = (SCANCODE_MALLOCED_P (scancode));
-
- if ((scheme_conversion != SHARP_F) && (!STRING_P (scheme_conversion)))
- error_wrong_type_arg (2);
-
- len = ((scheme_conversion == SHARP_F)
- ? 0
- : (STRING_LENGTH (scheme_conversion)));
- if (len == 0)
- {
- keyboard_scancode_table[scancode] = NO_CONVERSION;
- SCANCODE_MALLOCED_NOT (scancode);
- if (old_malloced_p)
- DOS_free (old_conversion);
- }
- else if ((len == 1)
- && ((STRING_REF (scheme_conversion, 0)) == '\0'))
- {
- keyboard_scancode_table[scancode] = CTRL_AT;
- SCANCODE_MALLOCED_NOT (scancode);
- if (old_malloced_p)
- DOS_free (old_conversion);
- }
- else
- {
- int i;
- unsigned char * conversion, * ptr, * scheme;
-
- conversion = (DOS_malloc (len + 1));
- if (conversion == 0)
- error_system_call (ENOMEM, syscall_malloc);
- ptr = conversion;
- scheme = (STRING_LOC (scheme_conversion, 0));
- for (i = 0; i < len; i ++)
- *ptr++ = *scheme++;
- *ptr = '\0';
- keyboard_scancode_table[scancode] = conversion;
- SCANCODE_MALLOCED (scancode);
- if (old_malloced_p)
- DOS_free (old_conversion);
- }
- recompute_max_scancode_conversion_length ();
- PRIMITIVE_RETURN (UNSPECIFIC);
- }
- }
-}
+++ /dev/null
-/* -*-C-*-
-
-$Id: dosenv.c,v 1.10 1999/01/02 06:11:34 cph Exp $
-
-Copyright (c) 1992-1999 Massachusetts Institute of Technology
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or (at
-your option) any later version.
-
-This program is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-#include "msdos.h"
-#include "osenv.h"
-#include <stdlib.h>
-\f
-time_t
-DEFUN_VOID (OS_encoded_time)
-{
- time_t t;
- STD_UINT_SYSTEM_CALL (syscall_time, t, (DOS_time (0)));
- return (t);
-}
-
-void
-DEFUN (OS_decode_time, (t, buffer), time_t t AND struct time_structure * buffer)
-{
- struct tm * ts;
- STD_PTR_SYSTEM_CALL (syscall_localtime, ts, (DOS_localtime (&t)));
- (buffer -> year) = ((ts -> tm_year) + 1900);
- (buffer -> month) = ((ts -> tm_mon) + 1);
- (buffer -> day) = (ts -> tm_mday);
- (buffer -> hour) = (ts -> tm_hour);
- (buffer -> minute) = (ts -> tm_min);
- (buffer -> second) = (ts -> tm_sec);
- (buffer -> daylight_savings_time) = (ts -> tm_isdst);
- /* I'm assuming that `timezone' is implemented by the C library;
- this might need conditionalization. -- cph */
- (buffer -> time_zone) = timezone;
- {
- /* In localtime() encoding, 0 is Sunday; in ours, it's Monday. */
- int wday = (ts -> tm_wday);
- (buffer -> day_of_week) = ((wday == 0) ? 6 : (wday - 1));
- }
-}
-
-time_t
-DEFUN (OS_encode_time ,(buffer), struct time_structure * buffer)
-{
- time_t t;
- struct tm ts_s, * ts;
- ts = &ts_s;
- (ts -> tm_year) = ((buffer -> year) - 1900);
- (ts -> tm_mon) = ((buffer -> month) - 1);
- (ts -> tm_mday) = (buffer -> day);
- (ts -> tm_hour) = (buffer -> hour);
- (ts -> tm_min) = (buffer -> minute);
- (ts -> tm_sec) = (buffer -> second);
- (ts -> tm_isdst) = (buffer -> daylight_savings_time);
- STD_UINT_SYSTEM_CALL (syscall_mktime, t, (DOS_mktime (ts)));
- /* mktime assumes its argument is local time, and converts it to
- UTC; if the specified time zone is different, adjust the result. */
- if (((buffer -> time_zone) != INT_MAX)
- && ((buffer -> time_zone) != timezone))
- t = ((t - timezone) + (buffer -> time_zone));
- return (t);
-}
-
-double
-DEFUN_VOID (OS_real_time_clock)
-{
- /* Jump through hoops because `clock()' wraps around to zero after
- one day and `time()' has at best resolution of one second. */
- return
- (((((double) (((long) (OS_encoded_time ())) / 60L)) * 60.0)
- + (((double) (((long) (clock ())) % (60L * ((long) CLOCKS_PER_SEC))))
- / ((double) CLOCKS_PER_SEC)))
- * 1000.0);
-}
-
-double
-DEFUN_VOID (OS_process_clock)
-{
- /* This must not signal an error in normal use. */
- return (OS_real_time_clock ());
-}
-\f
-/* Timer adjustments */
-#define PC_TIMER_TICKS_PER_SECOND (18.2)
-/* This should work out to about 55 */
-#define PC_MILLISECONDS_PER_TIMER_TICK \
- ((long) ((1000.0/PC_TIMER_TICKS_PER_SECOND)+0.5))
-
-static unsigned long
-DEFUN (ms_to_ticks, (clocks), clock_t clocks)
-{ ldiv_t ticks;
- unsigned long result;
-
- ticks = ldiv((long) clocks, PC_MILLISECONDS_PER_TIMER_TICK);
-
- result = ((ticks.rem >= (PC_MILLISECONDS_PER_TIMER_TICK/2)) ?
- (ticks.quot + 1) : (ticks.quot));
- return (result == 0) ? 1 : result;
-}
-
-void
-DEFUN (OS_process_timer_set, (first, interval),
- clock_t first AND
- clock_t interval)
-{ extern volatile unsigned long scm_itimer_counter, scm_itimer_reload;
- /* Convert granularity to 1/18.2 seconds */
-
- scm_itimer_counter = ms_to_ticks(first);
- scm_itimer_reload = ms_to_ticks(interval);
-
- return;
-}
-
-void
-DEFUN_VOID (OS_process_timer_clear)
-{
- scm_itimer_reload = scm_itimer_counter = 0;
- return;
-}
-
-void
-DEFUN (OS_profile_timer_set, (first, interval),
- clock_t first AND
- clock_t interval)
-{
- error_unimplemented_primitive ();
-}
-
-void
-DEFUN_VOID (OS_profile_timer_clear)
-{
- return;
-}
-
-void
-DEFUN (OS_real_timer_set, (first, interval),
- clock_t first AND
- clock_t interval)
-{
- OS_process_timer_set (first, interval);
-}
-
-void
-DEFUN_VOID (OS_real_timer_clear)
-{
- OS_process_timer_clear();
- return;
-}
-
-void
-DEFUN_VOID (DOS_initialize_environment)
-{
- return;
-}
-\f
-static size_t current_dir_path_size = 0;
-static char * current_dir_path = 0;
-
-CONST char *
-DEFUN_VOID (OS_working_dir_pathname)
-{
- if (current_dir_path) {
- return (current_dir_path);
- }
- if (current_dir_path_size == 0)
- {
- current_dir_path = (DOS_malloc (1024));
- if (current_dir_path == 0)
- error_system_call (ENOMEM, syscall_malloc);
- current_dir_path_size = 1024;
- }
- while (1)
- {
- if ((DOS_getcwd (current_dir_path, current_dir_path_size)) != 0)
- { strlwr(current_dir_path);
- return (current_dir_path);
- }
-#ifdef ERANGE
- if (errno != ERANGE)
- error_system_call (errno, syscall_getcwd);
-#endif
- current_dir_path_size *= 2;
- {
- char * new_current_dir_path =
- (DOS_realloc (current_dir_path, current_dir_path_size));
- if (new_current_dir_path == 0)
- /* ANSI C requires `path' to be unchanged -- we may have to
- discard it for systems that don't behave thus. */
- error_system_call (ENOMEM, syscall_realloc);
- current_dir_path = new_current_dir_path;
- }
- }
-}
-
-void
-DEFUN (OS_set_working_dir_pathname, (name), char * name)
-{ char filename[128], drive[3];
- int drive_number;
- size_t name_size = strlen (name);
-
- drive_number = dos_split_filename(name, drive, filename);
- dos_set_default_drive(drive_number);
- STD_VOID_SYSTEM_CALL (syscall_chdir, (DOS_chdir (filename)));
-
- while (1) {
- if (name_size < current_dir_path_size) {
- strcpy(current_dir_path, name);
- return;
- }
- current_dir_path_size *= 2;
- {
- char * new_current_dir_path =
- (DOS_realloc (current_dir_path, current_dir_path_size));
- if (new_current_dir_path == 0)
- error_system_call (ENOMEM, syscall_realloc);
- current_dir_path = new_current_dir_path;
- }
- }
-}
+++ /dev/null
-/* -*-C-*-
-
-$Id: dosexcp.c,v 1.6 1999/01/02 06:11:34 cph Exp $
-
-Copyright (c) 1992, 1999 Massachusetts Institute of Technology
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or (at
-your option) any later version.
-
-This program is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <dos.h>
-#include "msdos.h"
-#include "dossys.h"
-#include "dosinsn.h"
-#include "dosexcp.h"
-\f
-int
-DPMI_get_exception_vector (unsigned exception,
- unsigned short * cs_selector,
- unsigned * code_offset)
-{
- union REGS regs;
-
- if (exception > 0x1f)
- {
- errno = EINVAL;
- return (DOS_FAILURE);
- }
- regs.e.eax = 0x202;
- regs.e.ebx = exception;
- intDPMI (®s, ®s);
- if ((regs.e.flags & 1) != 0)
- {
- errno = EINVAL;
- return (DOS_FAILURE);
- }
- * cs_selector = regs.x.cx;
- * code_offset = regs.e.edx;
- return (DOS_SUCCESS);
-}
-
-int
-DPMI_set_exception_vector (unsigned exception,
- unsigned short cs_selector,
- unsigned code_offset)
-{
- union REGS regs;
-
- if (exception > 0x1f)
- {
- errno = EINVAL;
- return (DOS_FAILURE);
- }
- regs.e.eax = 0x203;
- regs.e.ebx = exception;
- regs.e.ecx = cs_selector;
- regs.e.edx = code_offset;
- intDPMI (®s, ®s);
- if ((regs.e.flags & 1) != 0)
- {
- errno = EINVAL;
- return (DOS_FAILURE);
- }
- return (DOS_SUCCESS);
-}
-\f
-static void *
-make_DPMI_exception_trampoline (unsigned exception,
- void ((*funcptr)
- (unsigned,
- unsigned,
- struct sigcontext *)),
- void * stack)
-{
- void DPMI_exception_method (void);
- void DPMI_GP_exception_method (void);
- void * trampoline;
- int size;
- INSN_DECLS();
-
- size = ((exception == DOS_EXCP_General_protection) ? 8 : 6);
- trampoline = (malloc (TRAMP_SIZE (size)));
- if (trampoline == ((void *) NULL))
- {
- errno = ENOMEM;
- return ((void *) NULL);
- }
-
- INIT_INSNS (trampoline);
-
- PUSH_INSN (exception);
- PUSH_INSN (getDS ());
- PUSH_INSN (0); /* Use same CS and near calls and returns */
- PUSH_INSN (funcptr);
- PUSH_INSN (getDS ()); /* Assumed to be on Heap if not null! */
- PUSH_INSN (stack);
- if (exception == DOS_EXCP_General_protection)
- {
- unsigned short previous_cs;
- unsigned previous_eip;
-
- if ((DPMI_get_exception_vector (exception, & previous_cs, & previous_eip))
- != DOS_SUCCESS)
- {
- free (trampoline);
- errno = EACCES;
- return ((void *) NULL);
- }
- PUSH_INSN (previous_cs);
- PUSH_INSN (previous_eip);
- JMP_INSN (DPMI_GP_exception_method);
- }
- else
- JMP_INSN (DPMI_exception_method);
-
- HLT_INSNS (size);
-
- return (trampoline);
-}
-
-int
-DPMI_set_exception_handler (unsigned exception,
- void ((*funcptr)
- (unsigned,
- unsigned,
- struct sigcontext *)),
- void * stack)
-{
- void * handler;
-
- if (exception > 0x1f)
- {
- errno = EINVAL;
- return (DOS_FAILURE);
- }
- handler = (make_DPMI_exception_trampoline (exception, funcptr, stack));
- if ((handler == ((void *) NULL))
- || ((DPMI_set_exception_vector (exception,
- (getCS ()),
- ((unsigned) handler)))
- != DOS_SUCCESS))
- {
- int saved_errno = errno;
-
- if (handler != ((void *) NULL))
- free (handler);
- errno = saved_errno;
- return (DOS_FAILURE);
- }
- return (DOS_SUCCESS);
-}
-
-/* This assumes that it is undoing the effects of DPMI_set_exception_handler */
-
-int
-DPMI_restore_exception_handler (unsigned exception,
- unsigned short cs_selector,
- unsigned code_offset)
-{
- unsigned short current_cs;
- unsigned current_eip;
-
- if (((DPMI_get_exception_vector (exception, & current_cs, & current_eip))
- != DOS_SUCCESS)
- || ((DPMI_set_exception_vector (exception, cs_selector, code_offset))
- != DOS_SUCCESS))
- return (DOS_FAILURE);
- free ((void *) current_eip);
- return (DOS_SUCCESS);
-}
-\f
-extern int DPMI_free_scheme_stack (unsigned short);
-extern int DPMI_alloc_scheme_stack (unsigned short *,
- unsigned short *,
- unsigned long);
-
-int
-DPMI_free_scheme_stack (unsigned short ss)
-{
- union REGS regs;
-
- regs.x.ax = 0x1;
- regs.x.bx = ss;
- intDPMI (®s, ®s);
- return ((regs.e.cflag != 0) ? DOS_FAILURE : DOS_SUCCESS);
-}
-
-#define I386_PAGE_BITS 12
-#define I386_PAGE_SIZE (1 << I386_PAGE_BITS)
-#define I386_PAGE_MASK (I386_PAGE_SIZE - 1)
-
-int
-DPMI_alloc_scheme_stack (unsigned short * ds,
- unsigned short * ss,
- unsigned long limit)
-{
- unsigned short ds_sel, css_sel, ss_sel;
- unsigned long descriptor[2];
- struct SREGS sregs;
- union REGS regs;
-
- segread (&sregs);
- css_sel = sregs.ss;
- ds_sel = sregs.ds;
-
- regs.x.ax = 0x0; /* Allocate LDT Descriptor */
- regs.x.cx = 1;
- intDPMI (®s, ®s);
- if (regs.e.cflag != 0)
- return (DOS_FAILURE);
- ss_sel = regs.x.ax;
-
- sregs.es = ds_sel;
- regs.x.ax = 0xb; /* Get Descriptor */
- regs.x.bx = css_sel;
- regs.e.edi = ((unsigned long) &descriptor[0]);
- intDPMIx (®s, ®s, &sregs);
- if (regs.e.cflag != 0)
- {
-fail:
- DPMI_free_scheme_stack (ss_sel);
- fprintf (stderr, "DPMI_alloc_scheme_stack: failed.\n");
- return (DOS_FAILURE);
- }
-
- /* Set the granularity bit and the limit */
- descriptor[1] = (descriptor[1] | (1UL << 23));
- descriptor[1] &= (~ (0xfUL << 16));
- descriptor[1] |= ((limit >> I386_PAGE_BITS) & (0xfUL << 16));
-
- descriptor[0] &= 0xffff0000UL;
- descriptor[0] |= ((limit >> I386_PAGE_BITS) & 0xffff);
-
- regs.x.ax = 0xc; /* Set Descriptor */
- regs.x.bx = ss_sel;
- regs.e.edi = ((unsigned long) &descriptor[0]);
- intDPMIx (®s, ®s, &sregs);
- if (regs.e.cflag != 0)
- goto fail;
-
- *ds = ds_sel;
- *ss = ss_sel;
- return (DOS_SUCCESS);
-}
-\f
-int
-X32_get_exception_vector (unsigned exception,
- unsigned short * cs_selector,
- unsigned * code_offset)
-{
- struct SREGS sregs;
- union REGS regs;
-
- if (exception > 15)
- {
- errno = EINVAL;
- return (DOS_FAILURE);
- }
- segread (&sregs);
- regs.e.eax = 0x2532;
- regs.h.cl = exception;
- intdosx (®s, ®s, &sregs);
- if ((regs.e.flags & 1) != 0)
- {
- errno = EINVAL;
- return (DOS_FAILURE);
- }
- * cs_selector = sregs.es;
- * code_offset = regs.e.ebx;
- return (DOS_SUCCESS);
-}
-
-static int
-X32_set_exception_vector (unsigned exception,
- unsigned short cs_selector,
- unsigned code_offset)
-{
- union REGS regs;
- struct SREGS sregs;
-
- if (exception > 15)
- {
- errno = EINVAL;
- return (DOS_FAILURE);
- }
- segread (& sregs);
- regs.e.eax = 0x2533;
- regs.h.cl = exception;
- sregs.ds = cs_selector;
- regs.e.edx = code_offset;
-
- intdosx (®s, ®s, &sregs);
- if ((regs.e.flags & 1) != 0)
- {
- errno = EINVAL;
- return (DOS_FAILURE);
- }
- return (DOS_SUCCESS);
-}
-\f
-struct X32_excp_handler
-{
- unsigned esp;
- unsigned ss;
- unsigned eip;
- unsigned cs;
- unsigned ds;
-};
-
-extern struct X32_excp_handler X32_excp_handlers[];
-
-int
-X32_set_exception_handler (unsigned exception,
- void ((*funcptr)
- (unsigned,
- unsigned,
- struct sigcontext *)),
- void * stack)
-{
- unsigned short cs, ds;
- struct X32_excp_handler * handler, old_handler;
- extern void X32_exception_method (void);
-
- if (exception > 15)
- {
- errno = EINVAL;
- return (DOS_FAILURE);
- }
-
- cs = (getCS ());
- ds = (getDS ());
-
- handler = &X32_excp_handlers[exception];
-
- old_handler.esp = handler->esp;
- old_handler.ss = handler->ss;
- old_handler.eip = handler->eip;
- old_handler.cs = handler->cs;
- old_handler.ds = handler->ds;
-
- handler->esp = ((unsigned) stack);
- handler->ss = ds;
- handler->eip = ((unsigned) funcptr);
- handler->cs = 0; /* 0 means handler expects near call */
- handler->ds = ds;
-
- if ((X32_set_exception_vector (exception,
- cs,
- ((unsigned) X32_exception_method)))
- != DOS_SUCCESS)
- {
- handler->esp = old_handler.esp;
- handler->ss = old_handler.ss;
- handler->eip = old_handler.eip;
- handler->cs = old_handler.cs;
- handler->ds = old_handler.ds;
-
- return (DOS_FAILURE);
- }
- return (DOS_SUCCESS);
-}
-
-/* This assumes that it is undoing the effects of X32_set_exception_handler */
-
-int
-X32_restore_exception_handler (unsigned exception,
- unsigned short cs_selector,
- unsigned code_offset)
-{
- struct X32_excp_handler * handler, old_handler;
-
- if (exception > 15)
- {
- errno = EINVAL;
- return (DOS_FAILURE);
- }
-
- handler = &X32_excp_handlers[exception];
-
- old_handler.esp = handler->esp;
- old_handler.ss = handler->ss;
- old_handler.eip = handler->eip;
- old_handler.cs = handler->cs;
- old_handler.ds = handler->ds;
-
- handler->esp = 0;
- handler->ss = 0;
- handler->eip = 0;
- handler->cs = 0;
- handler->ds = 0;
-
- if ((X32_set_exception_vector (exception, cs_selector, code_offset))
- != DOS_SUCCESS)
- {
- handler->esp = old_handler.esp;
- handler->ss = old_handler.ss;
- handler->eip = old_handler.eip;
- handler->cs = old_handler.cs;
- handler->ds = old_handler.ds;
-
- return (DOS_FAILURE);
- }
- return (DOS_SUCCESS);
-}
+++ /dev/null
-/* -*-C-*-
-
-$Id: dosexcp.h,v 1.4 1999/01/02 06:11:34 cph Exp $
-
-Copyright (c) 1992, 1999 Massachusetts Institute of Technology
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or (at
-your option) any later version.
-
-This program is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-#ifndef _DOSEXCP_H_
-# define _DOSEXCP_H_
-\f
-#define NUM_DOS_EXCP 18
-
-#define DOS_INVALID_TRAP -1
-
-#define DOS_EXCP_Integer_divide_by_zero 0
-#define DOS_EXCP_Debug_exception 1
-#define DOS_EXCP_Non_maskable_interrupt 2
-#define DOS_EXCP_Breakpoint 3
-#define DOS_EXCP_Integer_overflow 4
-#define DOS_EXCP_Bounds_check 5
-#define DOS_EXCP_Invalid_opcode 6
-#define DOS_EXCP_Numeric_co_processor_not_available 7
-#define DOS_EXCP_Double_fault 8
-#define DOS_EXCP_Numeric_co_processor_segment_overrun 9
- /* ^ can only occur on an FP-less chip (386 or 486SX). */
-#define DOS_EXCP_Invalid_TSS 10
-#define DOS_EXCP_Segment_not_present 11
-#define DOS_EXCP_Stack_exception 12
-#define DOS_EXCP_General_protection 13
-#define DOS_EXCP_Page_Fault 14
- /* 15 is reserved by Intel. */
-#define DOS_EXCP_Floating_point_exception 16
-#define DOS_EXCP_Alignment_check 17
- /* 18-31 are reserved by Intel. */
-
-struct sigcontext
-{
- unsigned sc_eax;
- unsigned sc_ecx;
- unsigned sc_edx;
- unsigned sc_ebx;
- unsigned sc_esp;
- unsigned sc_ebp;
- unsigned sc_esi;
- unsigned sc_edi;
- unsigned sc_eip;
- unsigned sc_eflags;
- unsigned sc_cs;
- unsigned sc_ss;
- unsigned sc_ds;
- unsigned sc_es;
- unsigned sc_fs;
- unsigned sc_gs;
-};
-
-extern int
- DPMI_get_exception_vector (unsigned exception,
- unsigned short * cs_selector,
- unsigned * code_offset);
-
-extern int
- DPMI_set_exception_vector (unsigned exception,
- unsigned short cs_selector,
- unsigned code_offset);
-
-extern int
- DPMI_set_exception_handler (unsigned exception,
- void (*funcptr) (unsigned,
- unsigned,
- struct sigcontext *),
- void * stack);
-
-extern int
- DPMI_restore_exception_handler (unsigned exception,
- unsigned short cs_selector,
- unsigned code_offset);
-
-
-extern int
- X32_get_exception_vector (unsigned exception,
- unsigned short * cs_selector,
- unsigned * code_offset);
-
-extern int
- X32_set_exception_handler (unsigned exception,
- void (*funcptr) (unsigned,
- unsigned,
- struct sigcontext *),
- void * stack);
-
-extern int
- X32_restore_exception_handler (unsigned exception,
- unsigned short cs_selector,
- unsigned code_offset);
-
-#endif /* _DOSEXCP_H_ */
+++ /dev/null
-/* -*-C-*-
-
-$Id: dosfg.c,v 1.4 1999/01/02 06:11:34 cph Exp $
-
-Copyright (c) 1992, 1999 Massachusetts Institute of Technology
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or (at
-your option) any later version.
-
-This program is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-/* Zortech 'Flash Graphics' primitives */
-
-#include "scheme.h"
-#include "prims.h"
-#include <fg.h>
-\f
-#define ARG_FG_COORD arg_nonnegative_integer
-
-/* Internal state to emulate Starbase behaviour */
-typedef struct fg_state_struct
-{
- fg_color_t color;
- fg_color_t background;
- fg_coord_t x;
- fg_coord_t y;
- fg_box_t clip;
- int mode;
- int line_type;
- int mask;
- int rotation;
-} fg_state_t;
-
-static fg_state_t current;
-
-/* This makes sure that the variables will not be changed unless
- both args are of the right type.
- */
-
-#define Get_Scheme_Coordinates(xp, x, yp, y) \
-do \
-{ fg_coord_t _tmp_x, _tmp_y; \
- _tmp_x = (ARG_FG_COORD(xp)); \
- _tmp_y = (ARG_FG_COORD(yp)); \
- (x) = _tmp_x, (y) = _tmp_y; \
-} while (0)
-
-\f
-DEFINE_PRIMITIVE ("FG-OPEN", Prim_fg_open, 0, 0,
-"Initializes the graphics display.")
-{
- PRIMITIVE_HEADER (0);
- {
- if (fg_init() != 0)
- {
- current.color = FG_WHITE;
- current.background= FG_BLACK;
- current.line_type = FG_LINE_SOLID;
- current.mode = FG_MODE_SET;
- current.rotation = FG_ROT0;
- current.mask = (int) (~0);
- current.x = (fg_coord_t) 0;
- current.y = (fg_coord_t) 0;
-
- fg_box_cpy(current.clip, fg.displaybox);
-
- { int i;
- for (i=1000000L; i > 0; i--);
- }
-
- PRIMITIVE_RETURN (SHARP_T);
- }
- else
- PRIMITIVE_RETURN (SHARP_F);
- }
-}
-
-DEFINE_PRIMITIVE ("FG-CLOSE", Prim_fg_close, 0, 0,
-"Closes the graphics device.")
-{
- PRIMITIVE_HEADER (0);
- fg_term();
- PRIMITIVE_RETURN (UNSPECIFIC);
-}
-
-DEFINE_PRIMITIVE ("FG-CLEAR", Prim_fg_clear, 0, 0, 0)
-{
- PRIMITIVE_HEADER (0);
- fg_fillbox(current.background, current.mode, current.mask, fg.displaybox);
- PRIMITIVE_RETURN (UNSPECIFIC);
-}
-
-DEFINE_PRIMITIVE ("FG-DRAW-POINT", Prim_fg_draw_point, 2, 2, 0)
-{
- PRIMITIVE_HEADER (2);
- {
- Get_Scheme_Coordinates(1, current.x, 2, current.y);
-
- if (fg_pt_inbox(current.clip, current.x, current.y))
- fg_drawdot(current.color, current.mode, current.mask,
- current.x, current.y);
- }
- PRIMITIVE_RETURN (UNSPECIFIC);
-}
-\f
-DEFINE_PRIMITIVE ("FG-MOVE-CURSOR", Prim_fg_move_cursor, 2, 2, 0)
-{
- PRIMITIVE_HEADER (2);
- {
- Get_Scheme_Coordinates(1, current.x, 2, current.y);
- }
- PRIMITIVE_RETURN (UNSPECIFIC);
-}
-
-DEFINE_PRIMITIVE ("FG-DRAG-CURSOR", Prim_fg_drag_cursor, 2, 2, 0)
-{
- PRIMITIVE_HEADER (2);
- { fg_coord_t x, y;
- fg_line_t line, cline;
-
- Get_Scheme_Coordinates(1, x, 2, y);
-
- fg_make_line(line, current.x, current.y, x, y);
- (void) fg_lineclip(current.clip, line, cline);
- fg_drawline(current.color, current.mode, current.mask,
- current.line_type, cline);
- current.x = x, current.y = y;
- }
- PRIMITIVE_RETURN (UNSPECIFIC);
-}
-
-DEFINE_PRIMITIVE ("FG-DRAW-LINE", Prim_fg_draw_line, 4, 4, 0)
-{
- PRIMITIVE_HEADER (4);
- { fg_coord_t x, y;
- fg_line_t line, cline;
-
- Get_Scheme_Coordinates(1, x, 2, y);
- Get_Scheme_Coordinates(3, current.x, 4, current.y);
-
- fg_make_line(line, x, y, current.x, current.y);
- (void) fg_lineclip(current.clip, line, cline);
- fg_drawline(current.color, current.mode, current.mask,
- current.line_type, cline);
- }
- PRIMITIVE_RETURN (UNSPECIFIC);
-}
-\f
-DEFINE_PRIMITIVE ("FG-SET-LINE-STYLE", Prim_fg_set_line_style, 1, 1, 0)
-{
- PRIMITIVE_HEADER (1);
- current.line_type = (int) arg_index_integer(1, FG_LINE_MAX);
- PRIMITIVE_RETURN (UNSPECIFIC);
-}
-
-DEFINE_PRIMITIVE ("FG-SET-DRAWING-MODE", Prim_fg_set_drawing_mode, 1, 1, 0)
-{
- PRIMITIVE_HEADER (1);
- { int mode = (int) arg_index_integer(1, 2);
-
- current.mode = (mode == 0) ? FG_MODE_SET : FG_MODE_XOR;
- }
- PRIMITIVE_RETURN (UNSPECIFIC);
-}
-
-DEFINE_PRIMITIVE ("FG-DEVICE-COORDINATES", Prim_fg_device_coordinates, 0, 0, 0)
-{
- PRIMITIVE_HEADER (0);
- { SCHEME_OBJECT result = (allocate_marked_vector (TC_VECTOR, 4, true));
-
- VECTOR_SET (result, 0, long_to_integer(fg.displaybox[FG_X1]));
- VECTOR_SET (result, 1, long_to_integer(fg.displaybox[FG_Y1]));
- VECTOR_SET (result, 2, long_to_integer(fg.displaybox[FG_X2]));
- VECTOR_SET (result, 3, long_to_integer(fg.displaybox[FG_Y2]));
-
- PRIMITIVE_RETURN (result);
- }
-}
-
-DEFINE_PRIMITIVE ("FG-RESET-CLIP-RECTANGLE", Prim_fg_reset_clip_rectangle,
- 0, 0, 0)
-{
- PRIMITIVE_HEADER (0);
- {
- fg_box_cpy(current.clip, fg.displaybox);
- }
- PRIMITIVE_RETURN (UNSPECIFIC);
-}
-
-DEFINE_PRIMITIVE ("FG-SET-CLIP-RECTANGLE", Prim_fg_set_clip_rectangle, 4, 4, 0)
-{
- PRIMITIVE_HEADER (4);
- { fg_coord_t x1, y1, x2, y2;
-
- Get_Scheme_Coordinates(1, x1, 2, y1);
- Get_Scheme_Coordinates(1, x2, 2, y2);
-
- if (fg_pt_inbox(fg.displaybox, x1, y1) == 0)
- error_bad_range_arg(1);
- if (fg_pt_inbox(fg.displaybox, x1, y1) == 0)
- error_bad_range_arg(3);
-
- current.clip[FG_X1] = x1;
- current.clip[FG_Y1] = y1;
- current.clip[FG_X2] = x2;
- current.clip[FG_Y2] = y2;
- }
- PRIMITIVE_RETURN (UNSPECIFIC);
-}
-\f
-DEFINE_PRIMITIVE ("FG-DRAW-TEXT", Prim_fg_draw_text, 3, 3,
- "(FG-DRAW-TEXT DEVICE X Y STRING)")
-{
- PRIMITIVE_HEADER (3);
- {
- fg_coord_t x, y;
- unsigned char * string = STRING_ARG(3);
-
- Get_Scheme_Coordinates(1, x, 2, y);
- fg_puts(current.color, current.mode, current.mask,
- current.rotation, x, y, string, current.clip);
- }
- PRIMITIVE_RETURN (UNSPECIFIC);
-}
-
-DEFINE_PRIMITIVE ("FG-SET-TEXT-ROTATION", Prim_fg_set_text_rotation, 1, 1, 0)
-{
- PRIMITIVE_HEADER (1);
- {
- long angle = ((long) (arg_real_number (1))) % 360;
- int path_style = FG_ROT0;
-
- if ((angle > 315) || (angle <= 45))
- path_style = FG_ROT0;
- else if ((angle > 45) && (angle <= 135))
- path_style = FG_ROT90;
- else if ((angle > 135) && (angle <= 225))
- path_style = FG_ROT180;
- else if ((angle > 225) && (angle <= 315))
- path_style = FG_ROT270;
-
- current.rotation = path_style;
- }
- PRIMITIVE_RETURN (UNSPECIFIC);
-}
-\f
-DEFINE_PRIMITIVE ("FG-COLOR-MAP-SIZE", Prim_fg_color_map_size, 0, 0, 0)
-{
- PRIMITIVE_HEADER (0);
- PRIMITIVE_RETURN (long_to_integer (fg.ncolormap));
-}
-
-DEFINE_PRIMITIVE ("FG-DEFINE-COLOR", Prim_fg_define_color, 4, 4,
- "(FG-DEFINE-COLOR COLOR-INDEX RED GREEN BLUE)")
-{
- PRIMITIVE_HEADER (4);
- {
- fg_color_t index, r, g, b;
-
- index = arg_index_integer(1, fg.ncolormap);
- r = arg_real_number(2);
- g = arg_real_number(3);
- b = arg_real_number(4);
-
- fg_setpalette(index, r, g, b);
- }
- PRIMITIVE_RETURN (UNSPECIFIC);
-}
-
-DEFINE_PRIMITIVE ("FG-SET-LINE-COLOR", Prim_fg_set_line_color, 1, 1,
- "(FG-SET-LINE-COLOR COLOR-INDEX)")
-{
- PRIMITIVE_HEADER (1);
- current.color = arg_index_integer(1, fg.ncolormap);
- PRIMITIVE_RETURN (UNSPECIFIC);
-}
-\f
-#if 0
-/* Graphics Screen Dump */
-
-static void print_graphics ();
-
-UNDEFINE_PRIMITIVE ("FG-WRITE-IMAGE-FILE", Prim_fg_write_image_file, 3, 3,
- "(FG-WRITE-IMAGE-FILE DEVICE FILENAME INVERT?)\n\
-Write a file containing an image of the DEVICE's screen, in a format\n\
-suitable for printing on an HP laserjet printer.\n\
-If INVERT? is not #F, invert black and white in the output.")
-{
- PRIMITIVE_HEADER (3);
- print_graphics ((SB_DEVICE_ARG (1)), (STRING_ARG (2)), (BOOLEAN_ARG (3)));
- PRIMITIVE_RETURN (UNSPECIFIC);
-}
-
-static char rasres[] = "\033*t100R";
-static char rastop[] = "\033&l2E";
-static char raslft[] = "\033&a2L";
-static char rasbeg[] = "\033*r0A";
-static char raslen[] = "\033*b96W";
-static char rasend[] = "\033*rB";
-
-static int
-inquire_cmap_mask (fildes)
- int fildes;
-{
- int cmap_size = (inquire_cmap_size (fildes));
- return
- (((cmap_size >= 0) && (cmap_size < 8))
- ? ((1 << cmap_size) - 1)
- : (-1));
-}
-
-static int
-open_dumpfile (dumpname)
- char * dumpname;
-{
- int dumpfile = (creat (dumpname, 0666));
- if (dumpfile == (-1))
- {
- fprintf (stderr, "\nunable to create graphics dump file.");
- fflush (stderr);
- error_external_return ();
- }
- dumpfile = (open (dumpname, OUTINDEV));
- if (dumpfile == (-1))
- {
- fprintf (stderr, "\nunable to open graphics dump file.");
- fflush (stderr);
- error_external_return ();
- }
- return (dumpfile);
-}
-\f
-static void
-print_graphics (descriptor, dumpname, inverse_p)
- int descriptor;
- char * dumpname;
- int inverse_p;
-{
- int dumpfile = (open_dumpfile (dumpname));
- write (dumpfile, rasres, (strlen (rasres)));
- write (dumpfile, rastop, (strlen (rastop)));
- write (dumpfile, raslft, (strlen (raslft)));
- write (dumpfile, rasbeg, (strlen (rasbeg)));
- {
- fast unsigned char mask = (inquire_cmap_mask (descriptor));
- int col;
- for (col = (1024 - 16); (col >= 0); col = (col - 16))
- {
- unsigned char pixdata [(16 * 768)];
- {
- fast unsigned char * p = (& (pixdata [0]));
- fast unsigned char * pe = (& (pixdata [sizeof (pixdata)]));
- while (p < pe)
- (*p++) = '\0';
- }
- dcblock_read (descriptor, col, 0, 16, 768, pixdata, 0);
- {
- int x;
- for (x = (16 - 1); (x >= 0); x -= 1)
- {
- unsigned char rasdata [96];
- fast unsigned char * p = (& (pixdata [x]));
- fast unsigned char * r = rasdata;
- int n;
- for (n = 0; (n < 96); n += 1)
- {
- fast unsigned char c = 0;
- int nn;
- for (nn = 0; (nn < 8); nn += 1)
- {
- c <<= 1;
- if (((* p) & mask) != 0)
- c |= 1;
- p += 16;
- }
- (*r++) = (inverse_p ? (~ c) : c);
- }
- write (dumpfile, raslen, (strlen (raslen)));
- write (dumpfile, rasdata, 96);
- }
- }
- }
- }
- write (dumpfile, rasend, (strlen (rasend)));
- close (dumpfile);
- return;
-}
-#endif
+++ /dev/null
-/* -*-C-*-
-
-$Id: dosfile.c,v 1.4 1999/01/02 06:11:34 cph Exp $
-
-Copyright (c) 1992-1999 Massachusetts Institute of Technology
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or (at
-your option) any later version.
-
-This program is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-#include "msdos.h"
-#include "osfile.h"
-#include "dosio.h"
-
-extern void EXFUN (terminal_open, (Tchannel channel));
-\f
-static enum channel_type
-DEFUN (fd_channel_type, (fd), int fd)
-{
- struct stat stat_buf;
- if ((DOS_fstat (fd, (&stat_buf))) < 0)
- return (channel_type_unknown);
- {
- mode_t type = ((stat_buf . st_mode) & S_IFMT);
- return
- ((type == S_IFREG) ? channel_type_file
- : (type == S_IFCHR)
- ? ((isatty (fd))
- ? channel_type_terminal
- : channel_type_unix_character_device)
-#ifdef S_IFIFO
- : (type == S_IFIFO) ? channel_type_unix_fifo
-#endif
-#ifdef S_IFBLK
- : (type == S_IFBLK) ? channel_type_unix_block_device
-#endif
- : (type == S_IFDIR) ? channel_type_directory
- : channel_type_unknown);
- }
-}
-
-Tchannel
-DEFUN (OS_open_fd, (fd), int fd)
-{
- enum channel_type type = (fd_channel_type (fd));
- Tchannel channel;
- MAKE_CHANNEL (fd, type, channel =);
-
- /* Like Unix, all terminals initialize to cooked mode. */
- if (type == channel_type_terminal) CHANNEL_COOKED(channel) = 1;
-
- return (channel);
-}
-
-static Tchannel
-DEFUN (open_file, (filename, oflag), CONST char * filename AND int oflag)
-{
- int fd;
- STD_UINT_SYSTEM_CALL
- (syscall_open, fd, (DOS_open (filename, oflag, MODE_REG)));
- return (OS_open_fd (fd));
-}
-
-#define DEFUN_OPEN_FILE(name, oflag) \
-Tchannel \
-DEFUN (name, (filename), CONST char * filename) \
-{ \
- return (open_file (filename, oflag)); \
-}
-
-DEFUN_OPEN_FILE (OS_open_input_file, O_RDONLY)
-DEFUN_OPEN_FILE (OS_open_output_file, (O_WRONLY | O_CREAT | O_TRUNC))
-DEFUN_OPEN_FILE (OS_open_io_file, (O_RDWR | O_CREAT))
-
-#ifdef HAVE_APPEND
-
-DEFUN_OPEN_FILE (OS_open_append_file, (O_WRONLY | O_CREAT | O_APPEND))
-
-#else
-
-Tchannel
-DEFUN (OS_open_append_file, (filename), CONST char * filename)
-{
- error_unimplemented_primitive ();
- return (0);
-}
-
-#endif
-\f
-static Tchannel
-DEFUN (make_load_channel, (fd), int fd)
-{
- enum channel_type type = (fd_channel_type (fd));
- if ((type == channel_type_terminal)
- || (type == channel_type_directory)
- || (type == channel_type_unknown))
- return (NO_CHANNEL);
- MAKE_CHANNEL (fd, type, return);
-}
-
-Tchannel
-DEFUN (OS_open_load_file, (filename), CONST char * filename)
-{
- while (1)
- {
- int fd = (DOS_open (filename, O_RDONLY, MODE_REG));
- if (fd >= 0)
- return (make_load_channel (fd));
- if (errno != EINTR)
- return (NO_CHANNEL);
- }
-}
-
-Tchannel
-DEFUN (OS_open_dump_file, (filename), CONST char * filename)
-{
- while (1)
- {
- int fd = (DOS_open (filename, (O_WRONLY | O_CREAT | O_TRUNC), MODE_REG));
- if (fd >= 0)
- return (make_load_channel (fd));
- if (errno != EINTR)
- return (NO_CHANNEL);
- }
-}
-
-off_t
-DEFUN (OS_file_length, (channel), Tchannel channel)
-{
- struct stat stat_buf;
- STD_VOID_SYSTEM_CALL
- (syscall_fstat, (DOS_fstat ((CHANNEL_DESCRIPTOR (channel)), (&stat_buf))));
- return (stat_buf . st_size);
-}
-
-off_t
-DEFUN (OS_file_position, (channel), Tchannel channel)
-{
- off_t result;
- STD_UINT_SYSTEM_CALL
- (syscall_lseek,
- result,
- (DOS_lseek ((CHANNEL_DESCRIPTOR (channel)), 0L, SEEK_CUR)));
- return (result);
-}
-
-void
-DEFUN (OS_file_set_position, (channel, position),
- Tchannel channel AND
- off_t position)
-{
- off_t result;
- STD_UINT_SYSTEM_CALL
- (syscall_lseek,
- result,
- (DOS_lseek ((CHANNEL_DESCRIPTOR (channel)), position, SEEK_SET)));
- if (result != position)
- error_external_return ();
-}
+++ /dev/null
-/* -*-C-*-
-
-$Id: dosfs.c,v 1.6 1999/01/02 06:11:34 cph Exp $
-
-Copyright (c) 1992-1999 Massachusetts Institute of Technology
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or (at
-your option) any later version.
-
-This program is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-#include "msdos.h"
-#include "osfs.h"
-\f
-enum file_existence
-DEFUN (OS_file_existence_test, (name), char * name)
-{
- struct stat s;
- char filename[128];
-
- dos_pathname_as_filename (name, filename);
-
- return
- (((DOS_stat (filename, (&s))) < 0)
- ? file_doesnt_exist : file_does_exist);
-}
-
-int
-DEFUN (OS_file_access, (name, mode), CONST char * name AND unsigned int mode)
-{
- char filename[128];
-
- dos_pathname_as_filename (name, filename);
- return ((DOS_access (filename, mode)) == 0);
-}
-
-int
-DEFUN (OS_file_directory_p, (name), char * name)
-{
- struct stat s;
- char filename[128];
-
- dos_pathname_as_filename (name, filename);
- return (((DOS_stat (filename, (&s))) == 0) &&
- (((s . st_mode) & S_IFMT) == S_IFDIR));
-}
-
-CONST char *
-DEFUN (OS_file_soft_link_p, (name), CONST char * name)
-{
- return (0);
-}
-
-void
-DEFUN (OS_file_remove, (name), CONST char * name)
-{
- STD_VOID_SYSTEM_CALL (syscall_unlink, (DOS_unlink (name)));
-}
-\f
-void
-DEFUN (OS_file_remove_link, (name), CONST char * name)
-{
- struct stat s;
- if ( (DOS_stat (name, (&s)) == 0) &&
- (((s . st_mode) & S_IFMT) == S_IFREG) )
- DOS_unlink (name);
- return;
-}
-
-void
-DEFUN (OS_file_link_hard, (from_name, to_name),
- CONST char * from_name AND
- CONST char * to_name)
-{
- error_unimplemented_primitive ();
- /*NOTREACHED*/
-}
-
-void
-DEFUN (OS_file_link_soft, (from_name, to_name),
- CONST char * from_name AND
- CONST char * to_name)
-{
- error_unimplemented_primitive ();
- /*NOTREACHED*/
-}
-
-void
-DEFUN (OS_file_rename, (from_name, to_name),
- CONST char * from_name AND
- CONST char * to_name)
-{
- if ((rename (from_name, to_name)) != 0)
- error_system_call (errno, syscall_rename);
-}
-
-void
-DEFUN (OS_file_copy, (from_name, to_name),
- CONST char * from_name AND
- CONST char * to_name)
-{
- int result;
- Tchannel source_channel = (OS_open_input_file (from_name));
- Tchannel destination_channel = (OS_open_output_file (to_name));
- off_t source_length = (OS_file_length (source_channel));
-
- result = (OS_channel_copy (source_length,
- source_channel,
- destination_channel));
-
- OS_channel_close (source_channel);
- OS_channel_close (destination_channel);
-
- if (result < 0)
- {
- signal_error_from_primitive (ERR_IO_ERROR);
- }
- return;
-}
-
-void
-DEFUN (OS_directory_make, (name), CONST char * name)
-{
- STD_VOID_SYSTEM_CALL (syscall_mkdir, (DOS_mkdir (name)));
-}
-
-void
-DEFUN (OS_directory_delete, (name), CONST char * name)
-{
- STD_VOID_SYSTEM_CALL (syscall_rmdir, (DOS_rmdir (name)));
-}
-\f
-/* This is such that directory open does not return the first file */
-
-typedef struct DIR_struct
-{
- struct FIND *entry;
- char pathname[13];
-} DIR;
-
-#define GET_DIRECTORY_ENTRY_NAME(entry, pathname) \
- (strcpy (pathname, ((entry)->name)), strlwr (pathname))
-
-static DIR ** directory_pointers;
-static unsigned int n_directory_pointers;
-
-void
-DEFUN_VOID (DOS_initialize_directory_reader)
-{
- directory_pointers = 0;
- n_directory_pointers = 0;
- return;
-}
-
-static unsigned int
-DEFUN (allocate_directory_pointer, (pointer), DIR * pointer)
-{
- if (n_directory_pointers == 0)
- {
- DIR ** pointers = ((DIR **) (DOS_malloc ((sizeof (DIR *)) * 4)));
- if (pointers == 0)
- error_system_call (ENOMEM, syscall_malloc);
- directory_pointers = pointers;
- n_directory_pointers = 4;
- {
- DIR ** scan = directory_pointers;
- DIR ** end = (scan + n_directory_pointers);
- (*scan++) = pointer;
- while (scan < end)
- (*scan++) = 0;
- }
- return (0);
- }
- {
- DIR ** scan = directory_pointers;
- DIR ** end = (scan + n_directory_pointers);
- while (scan < end)
- if ((*scan++) == 0)
- {
- (*--scan) = pointer;
- return (scan - directory_pointers);
- }
- }
- {
- unsigned int result = n_directory_pointers;
- unsigned int n_pointers = (2 * n_directory_pointers);
- DIR ** pointers =
- ((DIR **)
- (DOS_realloc (((PTR) directory_pointers),
- ((sizeof (DIR *)) * n_pointers))));
- if (pointers == 0)
- error_system_call (ENOMEM, syscall_realloc);
- {
- DIR ** scan = (pointers + result);
- DIR ** end = (pointers + n_pointers);
- (*scan++) = pointer;
- while (scan < end)
- (*scan++) = 0;
- }
- directory_pointers = pointers;
- n_directory_pointers = n_pointers;
- return (result);
- }
-}
-
-#define REFERENCE_DIRECTORY(index) (directory_pointers[(index)])
-#define DEALLOCATE_DIRECTORY(index) ((directory_pointers[(index)]) = 0)
-
-int
-DEFUN (OS_directory_valid_p, (index), long index)
-{
- return
- ((0 <= index)
- && (index < n_directory_pointers)
- && ((REFERENCE_DIRECTORY (index)) != 0));
-}
-\f
-unsigned int
-DEFUN (OS_directory_open, (name), CONST char * name)
-{
- char filename[128], searchname[128];
- struct FIND *entry;
- DIR * pointer = malloc (sizeof(DIR));
-
- if (pointer == 0)
- error_system_call (ENOMEM, syscall_malloc);
-
- if (dos_pathname_as_filename (name, filename))
- sprintf (searchname, "%s*.*", filename);
- else
- sprintf (searchname, "%s\\*.*", filename);
-
- if ((entry = findfirst(searchname, FA_DIREC)) == 0)
- error_system_call (errno, syscall_opendir);
-
- pointer->entry = entry;
- return (allocate_directory_pointer (pointer));
-}
-
-CONST char *
-DEFUN (OS_directory_read, (index), unsigned int index)
-{
- DIR * pointer = REFERENCE_DIRECTORY (index);
- if (pointer->entry == 0)
- return 0;
-
- GET_DIRECTORY_ENTRY_NAME (pointer->entry, pointer->pathname);
- pointer->entry = findnext ();
- return (pointer -> pathname);
-}
-
-CONST char *
-DEFUN (OS_directory_read_matching, (index, prefix),
- unsigned int index AND
- CONST char * prefix)
-{
- error_unimplemented_primitive ();
- /*NOTREACHED*/
-}
-
-void
-DEFUN (OS_directory_close, (index), unsigned int index)
-{ DIR * pointer = REFERENCE_DIRECTORY (index);
-
- free (pointer);
- DEALLOCATE_DIRECTORY (index);
-}
-\f
-int
-DEFUN (DOS_read_file_status, (name, s),
- CONST char * name AND
- struct stat * s)
-{
- char filename[128];
-
- dos_pathname_as_filename (name, filename);
-
- while ((stat (filename, s)) < 0)
- {
- if (errno == EINTR)
- continue;
- if ((errno == ENOENT) || (errno == ENOTDIR))
- return (0);
- error_system_call (errno, syscall_lstat);
- }
- return (1);
-}
+++ /dev/null
-;;; -*-Midas-*-
-;;;
-;;; $Id: dosi10.asm,v 1.3 1999/01/02 06:11:34 cph Exp $
-;;;
-;;; Copyright (c) 1992, 1999 Massachusetts Institute of Technology
-;;;
-;;; This program is free software; you can redistribute it and/or
-;;; modify it under the terms of the GNU General Public License as
-;;; published by the Free Software Foundation; either version 2 of the
-;;; License, or (at your option) any later version.
-;;;
-;;; This program is distributed in the hope that it will be useful,
-;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-;;; General Public License for more details.
-;;;
-;;; You should have received a copy of the GNU General Public License
-;;; along with this program; if not, write to the Free Software
-;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-;;;
-
-.386
-.model tiny
- .code
-\f
-FRAME equ 8
-
-;;
-;; STACK MAP: (after initial 'PUSH EBP')
-;;
-;; (EBP+FRAME)+24 unsigned long pString (segment16:offset16 format)
-;; (EBP+FRAME)+20 unsigned long lRow
-;; (EBP+FRAME)+16 unsigned long lColumn
-;; (EBP+FRAME)+12 unsigned long lCharCount
-;; (EBP+FRAME)+08 unsigned long lSingleAttribute
-;; (EBP+FRAME)+04 unsigned long lPageNumber
-;; (EBP+FRAME)+00 unsigned long lAttributeMode
-;; --------------------------------
-;; (EBP+FRAME)-04 EIP return address
-;; (EBP+FRAME)-08 Old EBP
-;;
-
- public _asm_bios__write_string_attr
-_asm_bios__write_string_attr proc near
- push EBP
- mov EBP,ESP
-
- lea ESP,-20[ESP]
-
- push EBX
- push ESI
- push ES
-
- mov EAX,04[EBP+FRAME] ;; BH = iPageNumber
- mov BH,AL
- mov EAX,08[EBP+FRAME] ;; BL = iSingleAttribute
- mov BL,AL
- mov ECX,12[EBP+FRAME] ;; CX = iCharCount
- mov EAX,16[EBP+FRAME] ;; DL = iColumn
- mov DL,AL
- mov EAX,20[EBP+FRAME] ;; DH = iRow
- mov DH,AL
- mov EAX,24[EBP+FRAME] ;; ES = pString segment
- ror EAX,16
- mov WORD PTR -18[EBP],10h
- mov -16[EBP],AX
- mov -14[EBP],AX
- mov -12[EBP],AX
- mov -10[EBP],AX
- mov EAX,00[EBP+FRAME] ;; AL = iAttributeMode
- mov AH,13h ;; AH = 0x13
- mov -08[EBP],EAX
- mov -04[EBP],EDX
-
- push ebp
- mov ESI,24[EBP+FRAME] ;; BP = pString offset
- lea edx,-18[EBP]
- mov BP,SI
- mov AX,2511h
- int 21h
- pop ebp
-
- pop ES
- pop ESI
- pop EBX
-
- mov ESP,EBP
-
- pop EBP
- ret
-_asm_bios__write_string_attr endp
-
-;;;; Example test program:
-;;;; 386i10t.exe: 386i10t.c 386i10.asm
-;;;; $(CC) $(CFLAGS) -L/m -o386i10t.exe 386i10.obj 386i10t.obj $(FLASHTEK)
-;;;;
-;;;; #include "386int10.h"
-;;;;
-;;;; unsigned long RealModeBufferParagraph = 0;
-;;;; char *pRealModeBuffer = NULL;
-;;;;
-;;;; void bios_write_string_attributed(char *pString, int iColumn,
-;;;; int iRow, int iSingleAttribute)
-;;;; {
-;;;; strcpy(pRealModeBuffer,pString);
-;;;; asm_bios__write_string_attr(1,0,iSingleAttribute,strlen(pString),
-;;;; iColumn,iRow,((RealModeBufferParagraph << 16) + 0));
-;;;; }
-;;;;
-;;;; static char *lpszStatic = "This is a static string.";
-;;;;
-;;;; main()
-;;;; {
-;;;; char *lpszAuto = "This is an auto variable string.";
-;;;;
-;;;; {
-;;;; union REGS rIn;
-;;;; union REGS rOut;
-;;;;
-;;;; rIn.h.ah = 0x48;
-;;;; rIn.x.bx = 256;
-;;;; int86(0x21,&rIn,&rOut);
-;;;; /* Ought to check for success, carry flag cleared if successful */
-;;;; if (rOut.x.flags & 0x1)
-;;;; {
-;;;; printf("The attempt to allocate real-mode memory failed.\n");
-;;;; exit(1);
-;;;; }
-;;;; else
-;;;; {
-;;;; printf("The attempt to allocate real-mode memory appears successful.\n");
-;;;; }
-;;;; pRealModeBuffer = (char *) rOut.e.ebx;
-;;;; RealModeBufferParagraph = rOut.x.ax;
-;;;; printf("RealModeBufferParagraph = %lx",RealModeBufferParagraph);
-;;;; }
-;;;;
-;;;; printf("Hello, world.\n");
-;;;;
-;;;; bios_write_string_attributed(lpszStatic,0,0,112);
-;;;; bios_write_string_attributed(lpszAuto,0,1,112);
-;;;; bios_write_string_attributed("This is an unnamed string literal.\n",0,2,112);
-;;;;
-;;;; printf("Good-bye, world.\n");
-;;;;
-;;;; }
-;;;;
-
-end
+++ /dev/null
-/* -*-C-*-
-
-$Id: dosinsn.h,v 1.3 1999/01/02 06:11:34 cph Exp $
-
-Copyright (c) 1992, 1999 Massachusetts Institute of Technology
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or (at
-your option) any later version.
-
-This program is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-#ifndef _DOSINSN_H_
-# define _DOSINSN_H_
-\f
-#ifdef getDS
-#undef getDS
-#endif
-
-#ifdef getCS
-#undef getCS
-#endif
-
-#ifdef getSS
-#undef getSS
-#endif
-
-extern unsigned short getCS (void);
-extern unsigned short getDS (void);
-extern unsigned short getSS (void);
-extern void farcpy (unsigned dst_off, unsigned dst_sel,
- unsigned src_off, unsigned src_sel,
- unsigned size);
-
-#define TRAMP_SIZE(npush) (4 * ((3 + (7 + (5 * npush))) / 4))
-
-#define INSN_DECLS() \
- unsigned short getCS (void); \
- unsigned char * startptr; \
- unsigned char * byteptr; \
- unsigned short * wordptr; \
- unsigned long * dwordptr
-
-#define INIT_INSNS(store) \
-do { \
- startptr = ((unsigned char *) (store)); \
- byteptr = startptr; \
-} while (0)
-
-#define PUSH_INSN(value) \
-do { \
- *byteptr++ = 0x68; \
- dwordptr = ((unsigned long *) byteptr); \
- *dwordptr++ = ((unsigned long) (value)); \
- byteptr = ((unsigned char *) dwordptr); \
-} while (0)
-
-#define JMP_INSN(value) \
-do { \
- *byteptr++ = 0xea; \
- dwordptr = ((unsigned long *) byteptr); \
- *dwordptr++ = ((unsigned long) (value)); \
- wordptr = ((unsigned short *) dwordptr); \
- *wordptr++ = (getCS ()); \
- byteptr = ((unsigned char *) wordptr); \
-} while (0)
-
-#define FRET_INSN() \
-do { \
- *byteptr++ = 0xcb; \
-} while (0)
-
-/* pad with HLT to end (on dword bdry.) */
-
-#define HLT_INSNS(npush) \
-do { \
- unsigned char * endptr = \
- (startptr + (TRAMP_SIZE (npush))); \
- while (byteptr < endptr) \
- *byteptr++ = 0xf4; \
-} while (0)
-
-#endif /* _DOSINSN_H_ */
+++ /dev/null
-/* -*-C-*-
-
-$Id: dosint10.c,v 1.9 1999/01/02 06:11:34 cph Exp $
-
-Copyright (c) 1992-1999 Massachusetts Institute of Technology
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or (at
-your option) any later version.
-
-This program is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-/*
- Scheme primitives for faster video on PC's by using BIOS Int. 0x10
- (pshuang@martigny, June 1992).
-
- Naming conventions: bios__* are simply interfaces to the raw BIOS
- calls, bios_* are slightly cooked interfaces, e.g. they do not have
- the exact same parameters that the BIOS calls document.
-
- The coordinates (0,0) correspond to the upper-left corner.
-*/
-
-#include "scheme.h"
-#include "prims.h"
-#include "msdos.h"
-#include "dosint10.h"
-#include "osio.h"
-#include "ostty.h"
-\f
-/**********************************************************************/
-
-#define MAP map_ansi_sys_color_to_bios_attribute
-
-#define DEFAULT_FOREGROUND 37 /* White */
-#define DEFAULT_BACKGROUND 40 /* Black */
-
-static int
-map_ansi_sys_color_to_bios_attribute (int iANSIcode)
-{
- /*
- ANSI.SYS color mappings (ISO 6429 standard) to video memory attributes:
-
- (Notes: Bit 7 == Blink; Foreground bits with bit 3 low map similar
- to Background bits, except that 0b0111 maps to Light Gray; background
- colors in ANSI.SYS specified with foreground+10.)
-
- ANSI.SYS Background (bits 6-4) Foreground (bits 3-0, bit 3 high)
- ========== ===================== =================================
- 30 Black 000 Dark Gray
- 31 Red 100 Light Red
- 32 Green 010 Light Green
- 33 Yellow 110 (listed as Brown) Yellow
- 34 Blue 001 Light Blue
- 35 Magenta 101 Light Magenta
- 36 Cyan 011 Light Cyan
- 37 White 111 White
- */
-
- switch (iANSIcode)
- {
- case 30:
- case 40: return 0x00;
-
- case 31:
- case 41: return _0B(0,0,0,0,0,1,0,0);
-
- case 32:
- case 42: return _0B(0,0,0,0,0,0,1,0);
-
- case 33:
- case 43: return _0B(0,0,0,0,0,1,1,0);
-
- case 34:
- case 44: return _0B(0,0,0,0,0,0,0,1);
-
- case 35:
- case 45: return _0B(0,0,0,0,0,1,0,1);
-
- case 36:
- case 46: return _0B(0,0,0,0,0,0,1,1);
-
- case 37:
- case 47: return _0B(0,0,0,0,0,1,1,1);
-
- default: return (0);
- }
-}
-\f
-static int bios_initialized_p = 0;
-static int display_columns = UNINITIALIZED;
-static int display_rows = UNINITIALIZED;
- /* 0-based values, initialized from variables in dostty.c */
-static int foreground_attribute = UNINITIALIZED;
-static int background_attribute = UNINITIALIZED;
-static int normal_video = UNINITIALIZED;
-static int reverse_video = UNINITIALIZED;
-
-static void
-bios_initialize_variables (int foreground, int background)
-{
- char* psTemp;
-
- if (display_columns == UNINITIALIZED)
- display_columns = (tty_x_size - 1);
-
- if (display_rows == UNINITIALIZED)
- display_rows = (tty_y_size - 1);
-
- foreground_attribute = (MAP (foreground));
- background_attribute = (MAP (background));
- normal_video = ((background_attribute << 4) | foreground_attribute);
- reverse_video = ((foreground_attribute << 4) | background_attribute);
- return;
-}
-
-static int
-stdout_is_console_p (void)
-{
- Tchannel output = (OS_tty_output_channel ());
- if ((OS_channel_type (output)) != channel_type_terminal)
- return (0);
- return (1);
-}
-\f
-static void
-bios_uninitialize_variables (void)
-{
- display_columns = UNINITIALIZED;
- display_rows = UNINITIALIZED;
- foreground_attribute = UNINITIALIZED;
- background_attribute = UNINITIALIZED;
- normal_video = UNINITIALIZED;
- reverse_video = UNINITIALIZED;
- return;
-}
-
-static void
-bios__scroll_up_rectangle (int iBlankAttribute, int iLines,
- int iUpperLeftX, int iUpperLeftY,
- int iBottomRightX, int iBottomRightY)
-{
- union REGS regs;
-
- regs.h.ah = 0x06;
- regs.h.al = iLines;
- regs.h.bh = iBlankAttribute;
- regs.h.ch = iUpperLeftY;
- regs.h.cl = iUpperLeftX;
- regs.h.dh = iBottomRightY;
- regs.h.dl = iBottomRightX;
- int10h (®s, ®s);
- return;
-}
-
-static void
-bios__scroll_down_rectangle (int iBlankAttribute, int iLines,
- int iUpperLeftX, int iUpperLeftY,
- int iBottomRightX, int iBottomRightY)
-{
- union REGS regs;
-
- regs.h.ah = 0x07;
- regs.h.al = iLines;
- regs.h.bh = iBlankAttribute;
- regs.h.ch = iUpperLeftY;
- regs.h.cl = iUpperLeftX;
- regs.h.dh = iBottomRightY;
- regs.h.dl = iBottomRightX;
- int10h (®s, ®s);
- return;
-}
-
-static void
-bios__set_cursor_position (int iPageNumber, int iColumn, int iRow)
-{
- union REGS regs;
-
- regs.h.ah = 0x02;
- regs.h.bh = iPageNumber;
- regs.h.dh = iRow;
- regs.h.dl = iColumn;
- int10h (®s, ®s);
- return;
-}
-\f
-static void
-bios__write_char_with_attribute (char cChar, int iPageNumber,
- int iAttribute, int iRepeatCount)
- /* Note: no special characters are recognized */
-{
- union REGS regs;
-
- regs.h.ah = 0x09;
- regs.h.al = cChar;
- regs.h.bh = iPageNumber;
- regs.h.bl = iAttribute;
- regs.x.cx = iRepeatCount;
- int10h (®s, ®s);
- return;
-}
-
-static void
-bios__teletype_output_char (char cChar, int iPageNumber,
- int iGraphicsModeForegroundColor)
- /* Note: CR/LF/BS/BEL recognized */
-{
- union REGS regs;
-
- regs.h.ah = 0x0E;
- regs.h.al = cChar;
- regs.h.bh = iPageNumber;
- regs.h.bl = iGraphicsModeForegroundColor;
- int10h (®s, ®s);
- return;
-}
-
-static void
-bios__set_video_mode (int iModeNumber)
-{
- union REGS regs;
-
- regs.h.ah = 0x00;
- regs.h.al = iModeNumber;
- int10h (®s, ®s);
- return;
-}
-
-static void
-bios__set_cursor_size (int iBlinkMode, int iTopScan, int iBottomScan)
-{
- union REGS regs;
-
- regs.h.ah = 0x01;
- regs.h.ch = (((iBlinkMode & _0B(0,0,0,0,0,0,1,1)) << 5)
- | (iTopScan & _0B(0,0,0,1,1,1,1,1)));
- regs.h.cl = (iBottomScan & _0B(0,0,0,1,1,1,1,1));
- int10h (®s, ®s);
- return;
-}
-\f
-static void
-bios_clear_line (int iCol, int iRow, int iFirstUnusedX)
-{
- bios__scroll_up_rectangle (normal_video, 0, iCol, iRow, iFirstUnusedX, iRow);
- return;
-}
-
-static void
-bios_clear_region (int iUpperLeftX, int iUpperLeftY,
- int iBottomRightX, int iBottomRightY)
-{
- bios__scroll_up_rectangle (normal_video, 0,
- iUpperLeftX, iUpperLeftY,
- iBottomRightX, iBottomRightY);
- return;
-}
-
-static void
-bios_clear_screen (void)
-{
- bios__scroll_up_rectangle (normal_video, 0x00,
- 0, 0, display_columns, display_rows);
- return;
-}
-
-static void
-bios_get_cursor_position (int * x, int * y)
-{
- union REGS regs;
-
- regs.h.ah = 0x03;
- regs.h.bh = 0x00; /* page number */
- int10h (®s, ®s);
- *y = regs.h.dh;
- *x = regs.h.dl;
- return;
-}
-
-static void
-bios_write_string_attributed (char * pString, long lLength, int iColumn,
- int iRow, int iSingleAttribute)
-{
- strncpy (pRealModeBuffer, pString, lLength);
- asm_bios__write_string_attr (1, 0, iSingleAttribute, lLength,
- iColumn, iRow,
- ((RealModeBufferParagraph << 16) + 0));
- return;
-}
-
-/* This does no argument checking. */
-
-void
-bios__set_text_size (int al, int bl)
-{
- union REGS regs;
-
- regs.h.ah = 0x11;
- regs.h.al = al;
- regs.h.bl = bl;
- int10h (®s, ®s);
- return;
-}
-\f
-DEFINE_PRIMITIVE ("BIOS:CAN-USE-BIOS?", Prim_bios_p, 0, 0,
- "#T if BIOS operations can be used, otherwise #F. ()")
-{
- PRIMITIVE_HEADER (0);
- PRIMITIVE_RETURN ((stdout_is_console_p ()) ? SHARP_T : SHARP_F);
-}
-
-DEFINE_PRIMITIVE ("BIOS:BEEP", Prim_bios_beep, 0, 0,
- "Produce a Beep [feep]. ()")
-{
- PRIMITIVE_HEADER (0);
- if (!bios_initialized_p)
- error_external_return ();
- bios__teletype_output_char ('\007', 0, 0x00);
- PRIMITIVE_RETURN (SHARP_T);
-}
-
-DEFINE_PRIMITIVE ("BIOS:CLEAR-LINE!", Prim_bios_clear_line, 3, 3,
- "Clear a line in the console. (column row first-unused)")
-{
- PRIMITIVE_HEADER (3);
- if (!bios_initialized_p)
- error_external_return ();
- bios_clear_line ((arg_integer (1)), (arg_integer (2)), (arg_integer (3)));
- PRIMITIVE_RETURN (SHARP_T);
-}
-
-DEFINE_PRIMITIVE ("BIOS:CLEAR-RECTANGLE!", Prim_bios_clear_rectangle, 5, 5,
- "Clear a rectangle in the console. (xl xu yl yu hl)")
-{
- PRIMITIVE_HEADER (5);
- if (!bios_initialized_p)
- error_external_return ();
- bios_clear_region ((arg_integer (1)), (arg_integer (3)),
- (arg_integer (2)), (arg_integer (4)));
- PRIMITIVE_RETURN (SHARP_T);
-}
-
-DEFINE_PRIMITIVE ("BIOS:CLEAR-SCREEN!", Prim_bios_clear_screen, 0, 0,
- "Clear the whole console. ()")
-{
- PRIMITIVE_HEADER (0);
- if (!bios_initialized_p)
- error_external_return ();
- bios_clear_screen ();
- PRIMITIVE_RETURN (SHARP_T);
-}
-
-DEFINE_PRIMITIVE ("BIOS:INITIALIZE!", Prim_bios_enter, 2, 2,
- "Initialize bios internal state. (foreground background)")
-{
- PRIMITIVE_HEADER (2);
- if ((! (stdout_is_console_p ())) || bios_initialized_p)
- error_external_return ();
- bios_initialize_variables ((arg_integer_in_range (1, 30, 38)),
- (arg_integer_in_range (2, 40, 48)));
- bios_initialized_p = 1;
- PRIMITIVE_RETURN (SHARP_T);
-}
-
-DEFINE_PRIMITIVE ("BIOS:EXIT!", Prim_bios_exit, 0, 0,
- "Clean up bios internal state. ()")
-{
- PRIMITIVE_HEADER (0);
- if (!bios_initialized_p)
- error_external_return ();
- bios_uninitialize_variables ();
- bios_initialized_p = 0;
- PRIMITIVE_RETURN (SHARP_T);
-}
-\f
-DEFINE_PRIMITIVE ("BIOS:SCROLL-LINES-DOWN!", Prim_bios_scroll_lines_down, 5, 5,
- "Scroll a console rectangle down. (xl xu yl yu delta)")
-{
- PRIMITIVE_HEADER (5);
- if (!bios_initialized_p)
- error_external_return ();
- bios__scroll_down_rectangle (normal_video, (arg_integer (5)),
- (arg_integer (1)), (arg_integer (3)),
- (arg_integer (2)), (arg_integer (4)));
- PRIMITIVE_RETURN (SHARP_T);
-}
-
-DEFINE_PRIMITIVE ("BIOS:SCROLL-LINES-UP!", Prim_bios_scroll_lines_up, 5, 5,
- "Scroll a console rectangle up. (xl xu yl yu delta)")
-{
- PRIMITIVE_HEADER (5);
- if (!bios_initialized_p)
- error_external_return ();
- bios__scroll_up_rectangle (normal_video, (arg_integer (5)),
- (arg_integer (1)), (arg_integer (3)),
- (arg_integer (2)), (arg_integer (4)));
- PRIMITIVE_RETURN (SHARP_T);
-}
-
-DEFINE_PRIMITIVE ("BIOS:WRITE-CURSOR!", Prim_bios_write_cursor, 2, 2,
- "Draw the cursor on the console. (x y)")
-{
- PRIMITIVE_HEADER (2);
- if (!bios_initialized_p)
- error_external_return ();
- bios__set_cursor_position (0, (arg_integer (1)), (arg_integer (2)));
- PRIMITIVE_RETURN (SHARP_T);
-}
-
-DEFINE_PRIMITIVE ("BIOS:WRITE-CHAR!", Prim_bios_write_char, 2, 2,
- "Write a character on the console. (char highlight)")
-{
- PRIMITIVE_HEADER (2);
- if (!bios_initialized_p)
- error_external_return ();
- if (BOOLEAN_ARG (2))
- {
- int x, y;
-
- bios_get_cursor_position (&x, &y);
- bios__scroll_up_rectangle (reverse_video, 1, x, y, x, y);
- bios__teletype_output_char ((arg_ascii_char (1)), 0, 0);
- }
- else
- bios__teletype_output_char ((arg_ascii_char (1)), 0, 0);
- PRIMITIVE_RETURN (SHARP_T);
-}
-\f
-DEFINE_PRIMITIVE ("BIOS:WRITE-SUBSTRING!", Prim_bios_write_substring, 4, 4,
- "Write a string on the console. (str start end highlight)")
-{
- int x, y;
- long start, end;
- PRIMITIVE_HEADER (4);
- if (!bios_initialized_p)
- error_external_return ();
- start = (arg_integer (2));
- end = (arg_integer (3));
- if (start > end)
- PRIMITIVE_RETURN (SHARP_F);
- bios_get_cursor_position (&x, &y);
- bios_write_string_attributed (((STRING_ARG (1)) + start), (end - start),
- x, y,
- ((BOOLEAN_ARG (4))
- ? reverse_video
- : normal_video));
- PRIMITIVE_RETURN (SHARP_T);
-}
-
-DEFINE_PRIMITIVE ("BIOS:SET-VIDEO-MODE!", Prim_bios_set_video_mode, 1, 1,
- "Set the video display mode for the console. (mode)")
-{
- PRIMITIVE_HEADER (1);
- if ((! (stdout_is_console_p ())) || bios_initialized_p)
- error_external_return ();
- bios__set_video_mode (arg_integer (1));
- pc_gestalt_screen_x_size ();
- pc_gestalt_screen_y_size ();
- bios_clear_screen ();
- bios__set_cursor_position (0, 0, display_rows);
- PRIMITIVE_RETURN (SHARP_T);
-}
-
-DEFINE_PRIMITIVE ("BIOS:SET-CURSOR-SIZE!", Prim_bios_set_cursor_size, 3, 3,
- "Set the cursor's shape and size. (blinkmode top bottom)")
- /* blinkmode: 0 = normal, 1 = invisible, 2 = erratic, 3 = slow */
-{
- PRIMITIVE_HEADER (3);
- if (! (stdout_is_console_p ()))
- error_external_return ();
- bios__set_cursor_size ((arg_integer (1)),
- (arg_integer (2)),
- (arg_integer (3)));
- PRIMITIVE_RETURN (SHARP_T);
-}
-
-DEFINE_PRIMITIVE ("BIOS:SET-TEXT-SIZE!", Prim_bios_set_text_size, 2, 2,
- "Diddle the character generator's blocks. (al bl)")
-{
- int al, bl;
- PRIMITIVE_HEADER (2);
- if ((! (stdout_is_console_p ())) || bios_initialized_p)
- error_external_return ();
- al = (arg_integer_in_range (1, 0x0, 0x20));
- bl = (arg_integer (2));
- if (((al & 0x8) != 0) || ((al & 0x7) == 0) || ((al & 0x7) > 4))
- error_bad_range_arg (1);
- bios__set_text_size (al, bl);
- PRIMITIVE_RETURN (SHARP_T);
-}
+++ /dev/null
-/* -*-C-*-
-
-$Id: dosint10.h,v 1.3 1999/01/02 06:11:34 cph Exp $
-
-Copyright (c) 1992, 1999 Massachusetts Institute of Technology
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or (at
-your option) any later version.
-
-This program is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-#include <stdio.h>
-#include <dos.h>
-#include <stdlib.h>
-\f
-#define _0B(b7,b6,b5,b4,b3,b2,b1,b0) ((b7<<7)|(b6<<6)|(b5<<5)|(b4<<4)|(b3<<3)|(b2<<2)|(b1<<1)|(b0))
-#define UNINITIALIZED -1
-
-int map_ansi_sys_color_to_bios_attribute (int iANSIcode);
-
-void bios_initialize_variables (int, int);
-void bios_uninitialize_variables (void);
-
-void bios__scroll_up_rectangle (int iBlankAttribute, int iLines,
- int iUpperLeftX, int iUpperLeftY,
- int iBottomRightX, int iBottomRightY);
-void bios__scroll_down_rectangle (int iBlankAttribute, int iLines,
- int iUpperLeftX, int iUpperLeftY,
- int iBottomRightX, int iBottomRightY);
-void bios__set_cursor_position (int iPageNumber, int iColumn, int iRow);
-void bios__write_char_with_attribute (char cChar, int iPageNumber,
- int iAttribute, int iRepeatCount);
-void bios__teletype_output_char (char cChar, int iPageNumber,
- int iGraphicsModeForegroundColor);
-void bios__set_video_mode (int iModeNumber);
-void bios__set_cursor_size (int iBlinkMode, int iTopScan, int iBottomScan);
-
-void bios_clear_line (int iCol, int iRow, int iFirstUnusedX);
-void bios_clear_region (int iUpperLeftX, int iUpperLeftY,
- int iBottomRightX, int iBottomRightY);
-void bios_clear_screen (void);
-void bios_get_cursor_position (int *x, int *y);
-void bios_write_string_attributed (char *pString, long lLength, int iColumn,
- int iRow, int iSingleAttribute);
-
-extern void asm_bios__write_string_attr (unsigned long lAttributeMode,
- unsigned long lPageNumber, unsigned long lSingleAttribute,
- unsigned long lCharCount, unsigned long lColumn, unsigned long lRow,
- unsigned long pString);
-
-extern int tty_x_size;
-extern int tty_y_size;
-extern unsigned long RealModeBufferParagraph;
-extern char * pRealModeBuffer;
-extern void pc_gestalt_screen_x_size (void);
-extern void pc_gestalt_screen_y_size (void);
-
+++ /dev/null
-/* -*-C-*-
-
-$Id: dosio.c,v 1.9 1999/01/02 06:11:34 cph Exp $
-
-Copyright (c) 1992-1999 Massachusetts Institute of Technology
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or (at
-your option) any later version.
-
-This program is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-#include "msdos.h"
-#include "dosio.h"
-#include "osterm.h"
-
-#ifndef fileno
-#define fileno(fp) ((fp)->_file)
-#endif
-\f
-size_t OS_channel_table_size;
-struct channel * channel_table;
-
-static void
-DEFUN_VOID (DOS_channel_close_all)
-{
- Tchannel channel;
- for (channel = 0; (channel < OS_channel_table_size); channel += 1)
- if (CHANNEL_OPEN_P (channel))
- OS_channel_close_noerror (channel);
- return;
-}
-
-void
-DEFUN_VOID (DOS_initialize_channels)
-{
- OS_channel_table_size = (DOS_SC_OPEN_MAX ());
- channel_table =
- (DOS_malloc (OS_channel_table_size * (sizeof (struct channel))));
- if (channel_table == 0)
- {
- fprintf (stderr, "\nUnable to allocate channel table.\n");
- fflush (stderr);
- termination_init_error ();
- }
- {
- Tchannel channel;
- for (channel = 0; (channel < OS_channel_table_size); channel += 1)
- MARK_CHANNEL_CLOSED (channel);
- }
- add_reload_cleanup (DOS_channel_close_all);
-}
-
-void
-DEFUN_VOID (DOS_reset_channels)
-{
- DOS_free (channel_table);
- channel_table = 0;
- OS_channel_table_size = 0;
- return;
-}
-
-Tchannel
-DEFUN_VOID (channel_allocate)
-{
- Tchannel channel = 0;
- while (1)
- {
- if (channel == OS_channel_table_size)
- error_out_of_channels ();
- if (CHANNEL_CLOSED_P (channel))
- return (channel);
- channel += 1;
- }
-}
-\f
-int
-DEFUN (OS_channel_open_p, (channel), Tchannel channel)
-{
- return (CHANNEL_OPEN_P (channel));
-}
-
-void
-DEFUN (OS_channel_close, (channel), Tchannel channel)
-{
- if (! (CHANNEL_INTERNAL (channel)))
- {
- STD_VOID_SYSTEM_CALL
- (syscall_close, (DOS_close (CHANNEL_DESCRIPTOR (channel))));
- MARK_CHANNEL_CLOSED (channel);
- }
- return;
-}
-
-void
-DEFUN (OS_channel_close_noerror, (channel), Tchannel channel)
-{
- if (! (CHANNEL_INTERNAL (channel)))
- {
- DOS_close (CHANNEL_DESCRIPTOR (channel));
- MARK_CHANNEL_CLOSED (channel);
- }
- return;
-}
-
-static void
-DEFUN (channel_close_on_abort_1, (cp), PTR cp)
-{
- OS_channel_close (* ((Tchannel *) cp));
- return;
-}
-
-void
-DEFUN (OS_channel_close_on_abort, (channel), Tchannel channel)
-{
- Tchannel * cp = (dstack_alloc (sizeof (Tchannel)));
- (*cp) = (channel);
- transaction_record_action (tat_abort, channel_close_on_abort_1, cp);
- return;
-}
-
-enum channel_type
-DEFUN (OS_channel_type, (channel), Tchannel channel)
-{
- return (CHANNEL_TYPE (channel));
-}
-\f
-void
-DEFUN (OS_terminal_flush_input, (channel), Tchannel channel)
-{ extern void EXFUN (flush_conio_buffers, (void));
-
- if ((CHANNEL_DESCRIPTOR (channel)) == (fileno (stdin)))
- flush_conio_buffers();
- return;
-}
-
-void
-DEFUN (OS_terminal_flush_output, (channel), Tchannel channel)
-{
- return;
-}
-
-void
-DEFUN (OS_terminal_drain_output, (channel), Tchannel channel)
-{
- return;
-}
-
-extern int EXFUN (dos_read, (int, PTR, size_t, int, int, int));
-
-int
-DEFUN (dos_read, (fd, buffer, nbytes, buffered_p, blocking_p, intrpt_p),
- int fd AND PTR buffer AND size_t nbytes
- AND int buffered_p AND int blocking_p AND int intrpt_p)
-{
- if (nbytes == 0)
- return (0);
- else if (fd == (fileno (stdin)))
- return (console_read (buffer, nbytes, buffered_p, blocking_p, intrpt_p));
- else
- return (DOS_read (fd, buffer, nbytes));
-}
-
-int
-DEFUN (dos_channel_read, (channel, buffer, nbytes),
- Tchannel channel AND PTR buffer AND size_t nbytes)
-{
- if (nbytes == 0)
- return 0;
- else if ((CHANNEL_DESCRIPTOR (channel)) == (fileno (stdin)))
- return (console_read (buffer, nbytes,
- (CHANNEL_BUFFERED (channel)),
- (CHANNEL_BLOCKING_P (channel)),
- 1));
- else
- return (DOS_read ((CHANNEL_DESCRIPTOR (channel)), buffer, nbytes));
-}
-
-long
-DEFUN (OS_channel_read, (channel, buffer, nbytes),
- Tchannel channel AND PTR buffer AND size_t nbytes)
-{
- while (1)
- {
- long scr = (dos_channel_read (channel, buffer, nbytes));
- if (scr < 0)
- {
- if (errno == ERRNO_NONBLOCK)
- return -1;
- DOS_prim_check_errno (syscall_read);
- continue;
- }
- else if (scr > nbytes)
- error_external_return ();
- else
- return (scr);
- }
-}
-\f
-static int
-DEFUN (dos_write, (fd, buffer, nbytes),
- int fd AND CONST unsigned char * buffer AND size_t nbytes)
-{
- return ((fd == (fileno (stdout)))
- ? (dos_console_write (buffer, nbytes))
- : (DOS_write (fd, buffer, nbytes)));
-}
-
-#define Syscall_Write(fd, buffer, size, so_far) \
-do \
-{ size_t _size = (size); \
- int _written; \
- _written = dos_write ((fd), (buffer), (_size)); \
- if (_size != _written) \
- return ((_written < 0) ? -1 : (so_far) + _written); \
-} while (0)
-
-long
-DEFUN (text_write, (fd, buffer, nbytes),
- int fd AND CONST unsigned char * buffer AND size_t nbytes)
-{ /* Map LF to CR/LF */
- static CONST unsigned char crlf[] = {CARRIAGE_RETURN, LINEFEED};
- CONST unsigned char *start;
- size_t i;
-
- for (i = 0, start = buffer; i < nbytes; start = &buffer[i])
- { size_t len;
-
- while ((i < nbytes) && (buffer[i] != LINEFEED)) i++;
- len = (&buffer[i] - start);
-
- Syscall_Write (fd, start, len, (i - len));
-
- if ((i < nbytes) && (buffer[i] == LINEFEED))
- { /* We are sitting on a linefeed. Write out CRLF */
- /* This backs out incorrectly if only CR is written out */
- Syscall_Write (fd, crlf, (sizeof (crlf)), i);
- i = i + 1; /* Skip over special character */
- }
- }
- return nbytes;
-}
-
-#undef Syscall_Write
-
-long
-DEFUN (OS_channel_write, (channel, buffer, nbytes),
- Tchannel channel AND CONST PTR buffer AND size_t nbytes)
-{
- if (nbytes == 0)
- return (0);
-
- while (1)
- {
- int fd, scr;
-
- fd = CHANNEL_DESCRIPTOR(channel);
- scr = ((CHANNEL_COOKED (channel))
- ? (text_write (fd, buffer, nbytes))
- : (dos_write (fd, buffer, nbytes)));
-
- if (scr < 0)
- {
- DOS_prim_check_errno (syscall_write);
- continue;
- }
-
- if (scr > nbytes)
- error_external_return ();
- return scr;
- }
-}
-\f
-size_t
-DEFUN (OS_channel_read_load_file, (channel, buffer, nbytes),
- Tchannel channel AND PTR buffer AND size_t nbytes)
-{
- int scr;
- scr = (DOS_read ((CHANNEL_DESCRIPTOR (channel)), buffer, nbytes));
- return ((scr < 0) ? 0 : scr);
-}
-
-size_t
-DEFUN (OS_channel_write_dump_file, (channel, buffer, nbytes),
- Tchannel channel AND CONST PTR buffer AND size_t nbytes)
-{
- int scr = (DOS_write ((CHANNEL_DESCRIPTOR (channel)), buffer, nbytes));
- return ((scr < 0) ? 0 : scr);
-}
-
-void
-DEFUN (OS_channel_write_string, (channel, string),
- Tchannel channel AND
- CONST char * string)
-{
- unsigned long length = (strlen (string));
- if ((OS_channel_write (channel, string, length)) != length)
- error_external_return ();
-}
-
-void
-DEFUN (OS_make_pipe, (readerp, writerp),
- Tchannel * readerp AND
- Tchannel * writerp)
-{
- return;
-}
-\f
-int
-DEFUN (OS_channel_nonblocking_p, (channel), Tchannel channel)
-{
- return (CHANNEL_NONBLOCKING (channel));
-}
-
-void
-DEFUN (OS_channel_nonblocking, (channel), Tchannel channel)
-{
- (CHANNEL_NONBLOCKING (channel)) = 1;
- return;
-}
-
-void
-DEFUN (OS_channel_blocking, (channel), Tchannel channel)
-{
- (CHANNEL_NONBLOCKING (channel)) = 0;
-}
-
-int
-DEFUN (OS_terminal_buffered_p, (channel), Tchannel channel)
-{
- return (CHANNEL_BUFFERED(channel));
-}
-
-void
-DEFUN (OS_terminal_buffered, (channel), Tchannel channel)
-{
- CHANNEL_BUFFERED(channel) = 1;
-}
-
-void
-DEFUN (OS_terminal_nonbuffered, (channel), Tchannel channel)
-{
- CHANNEL_BUFFERED(channel) = 0;
-}
-
-int
-DEFUN (OS_terminal_cooked_output_p, (channel), Tchannel channel)
-{
- return (CHANNEL_COOKED(channel));
-}
-
-void
-DEFUN (OS_terminal_cooked_output, (channel), Tchannel channel)
-{
- CHANNEL_COOKED(channel) = 1;
-}
-
-void
-DEFUN (OS_terminal_raw_output, (channel), Tchannel channel)
-{
- CHANNEL_COOKED(channel) = 0;
-}
-\f
-unsigned int
-DEFUN (arg_baud_index, (argument), unsigned int argument)
-{
- return (arg_index_integer (argument, 1));
-}
-
-unsigned int
-DEFUN (OS_terminal_get_ispeed, (channel), Tchannel channel)
-{
- return (0);
-}
-
-unsigned int
-DEFUN (OS_terminal_get_ospeed, (channel), Tchannel channel)
-{
- return (0);
-}
-
-void
-DEFUN (OS_terminal_set_ispeed, (channel, baud),
- Tchannel channel AND
- unsigned int baud)
-{
- error_unimplemented_primitive ();
-}
-
-void
-DEFUN (OS_terminal_set_ospeed, (channel, baud),
- Tchannel channel AND
- unsigned int baud)
-{
- error_unimplemented_primitive ();
-}
-
-unsigned int
-DEFUN (OS_baud_index_to_rate, (index), unsigned int index)
-{
- return (9600);
-}
-
-int
-DEFUN (OS_baud_rate_to_index, (rate), unsigned int rate)
-{
- return ((rate == 9600) ? 0 : -1);
-}
-
-unsigned int
-DEFUN_VOID (OS_terminal_state_size)
-{
- return (3);
-}
-
-void
-DEFUN (OS_terminal_get_state, (channel, state_ptr),
- Tchannel channel AND PTR state_ptr)
-{
- unsigned char *statep = (unsigned char *) state_ptr;
-
- *statep++ = CHANNEL_NONBLOCKING(channel);
- *statep++ = CHANNEL_BUFFERED(channel);
- *statep = CHANNEL_COOKED(channel);
-
- return;
-}
-
-void
-DEFUN (OS_terminal_set_state, (channel, state_ptr),
- Tchannel channel AND PTR state_ptr)
-{
- unsigned char *statep = (unsigned char *) state_ptr;
-
- CHANNEL_NONBLOCKING(channel) = *statep++;
- CHANNEL_BUFFERED(channel) = *statep++;
- CHANNEL_COOKED(channel) = *statep;
-
- return;
-}
-
-#ifndef FALSE
-# define FALSE 0
-#endif
-
-int
-DEFUN_VOID (OS_job_control_p)
-{
- return (FALSE);
-}
-
-int
-DEFUN_VOID (OS_have_ptys_p)
-{
- return (FALSE);
-}
-
-/* No SELECT in DOS */
-CONST int OS_have_select_p = 0;
+++ /dev/null
-/* -*-C-*-
-
-$Id: dosio.h,v 1.5 1999/01/02 06:11:34 cph Exp $
-
-Copyright (c) 1992-1999 Massachusetts Institute of Technology
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or (at
-your option) any later version.
-
-This program is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-#ifndef SCM_DOSIO_H
-#define SCM_DOSIO_H
-
-#include "osio.h"
-
-struct channel
-{
- int descriptor;
- enum channel_type type;
- unsigned int internal : 1;
- unsigned int nonblocking : 1;
- unsigned int buffered : 1;
- unsigned int cooked : 1;
-};
-
-#define MARK_CHANNEL_CLOSED(channel) ((CHANNEL_DESCRIPTOR (channel)) = (-1))
-#define CHANNEL_CLOSED_P(channel) ((CHANNEL_DESCRIPTOR (channel)) < 0)
-#define CHANNEL_OPEN_P(channel) ((CHANNEL_DESCRIPTOR (channel)) >= 0)
-#define CHANNEL_DESCRIPTOR(channel) ((channel_table [(channel)]) . descriptor)
-#define CHANNEL_TYPE(channel) ((channel_table [(channel)]) . type)
-#define CHANNEL_INTERNAL(channel) ((channel_table [(channel)]) . internal)
-#define CHANNEL_NONBLOCKING(channel) \
- ((channel_table [(channel)]) . nonblocking)
-#define CHANNEL_BLOCKING_P(channel) \
- (!CHANNEL_NONBLOCKING(channel))
-#define CHANNEL_BUFFERED(channel) ((channel_table [(channel)]) . buffered)
-#define CHANNEL_COOKED(channel) ((channel_table [(channel)]) . cooked)
-
-#define MAKE_CHANNEL(descriptor, type, receiver) \
-{ \
- Tchannel MAKE_CHANNEL_temp = (channel_allocate ()); \
- (CHANNEL_DESCRIPTOR (MAKE_CHANNEL_temp)) = (descriptor); \
- (CHANNEL_TYPE (MAKE_CHANNEL_temp)) = (type); \
- (CHANNEL_INTERNAL (MAKE_CHANNEL_temp)) = 0; \
- (CHANNEL_NONBLOCKING (MAKE_CHANNEL_temp)) = 0; \
- (CHANNEL_BUFFERED (MAKE_CHANNEL_temp)) = 1; \
- (CHANNEL_COOKED (MAKE_CHANNEL_temp)) = 0; \
- receiver (MAKE_CHANNEL_temp); \
-}
-
-extern struct channel * channel_table;
-extern Tchannel EXFUN (channel_allocate, (void));
-
-#define BACKSPACE '\b'
-#define SPACE ' '
-#define CARRIAGE_RETURN '\r'
-#define LINEFEED '\n'
-#define CNTRL_Z '\032'
-#define DELETE '\177'
-
-#endif /* SCM_DOSIO_H */
+++ /dev/null
-/* -*-C-*-
-
-$Id: doskbd.c,v 1.13 1999/01/02 06:11:34 cph Exp $
-
-Copyright (c) 1992, 1999 Massachusetts Institute of Technology
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or (at
-your option) any later version.
-
-This program is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <errno.h>
-#include <bios.h>
-#include <dos.h>
-#include <int.h>
-#include "msdos.h"
-#include "osio.h"
-#include "ostty.h"
-\f
-/* These flags determine how the code will behave. */
-
-#define DOSX_USE_INT_INTERCEPT
-#define DOSX_RM_HANDLER_UNTOUCHED
-#define DOSX_PM_HANDLER_UNTOUCHED
-/* #define DOSX_RM_HANDLER_REAL */
-#define DPMI_RM_HANDLER_REAL
-#define DPMI_PM_HANDLER_UNTOUCHED
-
-#ifdef getDS
-#undef getDS
-#endif
-
-#ifdef getCS
-#undef getCS
-#endif
-
-#include "dossys.h"
-#include "dosinsn.h"
-#include "doskbd.h"
-
-#ifndef ELOOP
-# define ELOOP 2000
-#endif
-
-#ifndef EFAULT
-# define EFAULT 2001
-#endif
-
-/* These depend on the C compiler (Zortech) allocating them contiguosly. */
-
-extern unsigned char scan_code_tables_start[];
-extern unsigned char scan_code_tables_end[];
-
-/* Tables mapping scan codes to ASCII characters.
- Entries with NULL (\0) should not be mapped by the
- Scheme keyboard ISR. Let the default handler map them.
- */
-
-unsigned char
-scan_code_tables_start[] = "foo";
-
-static unsigned char modifier_mask = 0x4f;
-\f
-static unsigned char
-unshifted_scan_code_to_ascii[] =
-{
- '\0', /* 0 */
- '\033', /* 1 */
- '1', /* 2 */
- '2', /* 3 */
- '3', /* 4 */
- '4', /* 5 */
- '5', /* 6 */
- '6', /* 7 */
- '7', /* 8 */
- '8', /* 9 */
- '9', /* 10 */
- '0', /* 11 */
- '-', /* 12 */
- '=', /* 13 */
- '\177', /* 14 */
- '\t', /* 15 */
- 'q', /* 16 */
- 'w', /* 17 */
- 'e', /* 18 */
- 'r', /* 19 */
- 't', /* 20 */
- 'y', /* 21 */
- 'u', /* 22 */
- 'i', /* 23 */
- 'o', /* 24 */
- 'p', /* 25 */
- '[', /* 26 */
- ']', /* 27 */
- '\r', /* 28 */
- '\0', /* 29 */
- 'a', /* 30 */
- 's', /* 31 */
- 'd', /* 32 */
- 'f', /* 33 */
- 'g', /* 34 */
- 'h', /* 35 */
- 'j', /* 36 */
- 'k', /* 37 */
- 'l', /* 38 */
- ';', /* 39 */
- '\'', /* 40 */
- '`', /* 41 */
- '\0', /* 42 */
- '\\', /* 43 */
- 'z', /* 44 */
- 'x', /* 45 */
- 'c', /* 46 */
- 'v', /* 47 */
- 'b', /* 48 */
- 'n', /* 49 */
- 'm', /* 50 */
- ',', /* 51 */
- '.', /* 52 */
- '/', /* 53 */
- '\0', /* 54 */
- '\0', /* 55 */
- '\0', /* 56 */
- ' ' /* 57 */
- };
-\f
-static unsigned char
-shifted_scan_code_to_ascii[] =
-{
- '\0', /* 0 */
- '\033', /* 1 */
- '!', /* 2 */
- '@', /* 3 */
- '#', /* 4 */
- '$', /* 5 */
- '%', /* 6 */
- '^', /* 7 */
- '&', /* 8 */
- '*', /* 9 */
- '(', /* 10 */
- ')', /* 11 */
- '_', /* 12 */
- '+', /* 13 */
- '\177', /* 14 */
- '\t', /* 15 */
- 'Q', /* 16 */
- 'W', /* 17 */
- 'E', /* 18 */
- 'R', /* 19 */
- 'T', /* 20 */
- 'Y', /* 21 */
- 'U', /* 22 */
- 'I', /* 23 */
- 'O', /* 24 */
- 'P', /* 25 */
- '{', /* 26 */
- '}', /* 27 */
- '\r', /* 28 */
- '\0', /* 29 */
- 'A', /* 30 */
- 'S', /* 31 */
- 'D', /* 32 */
- 'F', /* 33 */
- 'G', /* 34 */
- 'H', /* 35 */
- 'J', /* 36 */
- 'K', /* 37 */
- 'L', /* 38 */
- ':', /* 39 */
- '\"', /* 40 */
- '~', /* 41 */
- '\0', /* 42 */
- '|', /* 43 */
- 'Z', /* 44 */
- 'X', /* 45 */
- 'C', /* 46 */
- 'V', /* 47 */
- 'B', /* 48 */
- 'N', /* 49 */
- 'M', /* 50 */
- '<', /* 51 */
- '>', /* 52 */
- '?', /* 53 */
- '\0', /* 54 */
- '\0', /* 55 */
- '\0', /* 56 */
- ' ' /* 57 */
- };
-\f
-static unsigned char
-caps_scan_code_to_ascii[] =
-{
- '\0', /* 0 */
- '\033', /* 1 */
- '1', /* 2 */
- '2', /* 3 */
- '3', /* 4 */
- '4', /* 5 */
- '5', /* 6 */
- '6', /* 7 */
- '7', /* 8 */
- '8', /* 9 */
- '9', /* 10 */
- '0', /* 11 */
- '-', /* 12 */
- '=', /* 13 */
- '\177', /* 14 */
- '\t', /* 15 */
- 'Q', /* 16 */
- 'W', /* 17 */
- 'E', /* 18 */
- 'R', /* 19 */
- 'T', /* 20 */
- 'Y', /* 21 */
- 'U', /* 22 */
- 'I', /* 23 */
- 'O', /* 24 */
- 'P', /* 25 */
- '[', /* 26 */
- ']', /* 27 */
- '\r', /* 28 */
- '\0', /* 29 */
- 'A', /* 30 */
- 'S', /* 31 */
- 'D', /* 32 */
- 'F', /* 33 */
- 'G', /* 34 */
- 'H', /* 35 */
- 'J', /* 36 */
- 'K', /* 37 */
- 'L', /* 38 */
- ';', /* 39 */
- '\'', /* 40 */
- '`', /* 41 */
- '\0', /* 42 */
- '\\', /* 43 */
- 'Z', /* 44 */
- 'X', /* 45 */
- 'C', /* 46 */
- 'V', /* 47 */
- 'B', /* 48 */
- 'N', /* 49 */
- 'M', /* 50 */
- ',', /* 51 */
- '.', /* 52 */
- '/', /* 53 */
- '\0', /* 54 */
- '\0', /* 55 */
- '\0', /* 56 */
- ' ' /* 57 */
- };
-
-unsigned char
-scan_code_tables_end[] = "bar";
-\f
-union RM_address
-{
- unsigned fp;
- struct
- {
- unsigned short off;
- unsigned short seg;
- } x;
-};
-
-dos_boolean
-under_QEMM_386_p (void)
-{
- unsigned int i;
- union REGS regs;
-
- regs.h.al = 0x01;
- regs.x.bx = 0x5145;
- regs.x.cx = 0x4d4d;
- regs.x.dx = 0x3432;
-
- for (i = 0xc0; i <= 0xff; i++)
- {
- regs.h.ah = i;
- int86 (0x2f, ®s, ®s);
- if (regs.x.bx == 0x4f4b)
- return (dos_true);
- }
- return (dos_false);
-}
-
-static void
-normalize_RM_address (union RM_address * addr)
-{
- if (addr->x.off > 0xf)
- {
- addr->x.seg += (addr->x.off >> 4);
- addr->x.off = (addr->x.off & 0xf);
- }
- return;
-}
-
-static dos_boolean
-install_kbd_hook_p (char * var_name)
-{
- extern int strcmp_ci (char *, char *);
- char * envvar = (DOS_getenv (var_name));
-
- if ((envvar != NULL) && ((strcmp_ci (envvar, "true")) == 0))
- return (dos_true);
- else
- return (dos_false);
-}
-\f
-/*
- We would like to use Zortech's int_intercept with the following
- routine under DOSX (or Phar Lap).
-
- Unfortunately, it does not work under QEMM386 or under MS Windows 3.1.
- The real-mode call-back routine is apparently just plain broken.
-
- In addition, bypassing DOSX under DPMI 0.9 and using DPMI's
- real-mode call backs does not work consistently, and the keyboard
- interrupt happens only in real mode since we are capturing the
- interrupt DOS uses to tell the BIOS that a scan code has arrived
- after doing the handshake with the keyboard device itself.
-
- Thus, under DPMI, we install our own hard-coded real-mode keyboard
- driver and don't bother with a protected mode handler. All the
- code is here in case it can be turned on in the future, perhaps for
- a different DOS Extender or a new version of DPMI.
-
- Apparently telling DOSX to install a protected mode handler and
- making it reflect real mode interrupts to protected mode does not
- work consistently under QEMM386 either, thus we are now installing
- a real-mode handler no matter what, although using different
- mechanisms under DPMI and not DPMI.
- */
-
-#ifdef DOSX_USE_INT_INTERCEPT
-
-#define PC_KBD_ALT_MASK 0x8
-#define PC_KBD_CTRL_MASK 0x4
-#define PC_KBD_SHIFT_MASK 0x3
-#define PC_KBD_CAPSL_MASK 0x40
-
-#define DOS_HOOK_TRANSLATE_KEYSTROKE 0x4f
-#define DOS_KBD_FUNC_RECORD_KEYSTROKE 0x5
-\f
-int
-bios_keyboard_handler (struct INT_DATA * pd)
-{
- unsigned char scan_code, chord, ascii, * table;
- union REGS regs;
-
- if (pd->regs.h.ah != DOS_HOOK_TRANSLATE_KEYSTROKE)
- return (INTERRUPT_CHAIN_NEXT);
-
- scan_code = (pd->regs.h.al);
-
- /* All the tables are assumed to be the same length. */
-
- if (scan_code >= (sizeof (shifted_scan_code_to_ascii)))
- return (INTERRUPT_CHAIN_NEXT);
-
- chord = ((bioskey (_KEYBRD_SHIFTSTATUS)) & modifier_mask);
-
- if ((chord & (PC_KBD_CTRL_MASK | PC_KBD_SHIFT_MASK)) != 0)
- table = &shifted_scan_code_to_ascii[0];
- else if ((chord & PC_KBD_CAPSL_MASK) != 0)
- table = &caps_scan_code_to_ascii[0];
- else
- table = &unshifted_scan_code_to_ascii[0];
-
- ascii = table[scan_code];
-
- if (ascii == 0)
- return (INTERRUPT_CHAIN_NEXT);
- if ((chord & PC_KBD_CTRL_MASK) != 0)
- ascii &= ~0x60; /* Controlify */
- if (chord & PC_KBD_ALT_MASK)
- ascii |= 0x80; /* Metafy */
- if (ascii == 0360)
- return (INTERRUPT_CHAIN_NEXT); /* Problems with M-p */
- if ((ascii == 0200) || (ascii == 0))
- scan_code = 3; /* Problems with C-Space */
-
- /* Insert metafied char in bios buffer. */
- regs.h.ah = DOS_KBD_FUNC_RECORD_KEYSTROKE;
- regs.h.ch = scan_code;
- regs.h.cl = ascii;
- int86 (DOS_INTVECT_KEYBOARD_REQUEST, ®s, ®s);
-
- pd->regs.e.flags &= ~1; /* clear CF, scan code ignored! */
- return (INTERRUPT_RETURN);
-}
-#endif /* DOSX_USE_INT_INTERCEPT */
-\f
-static void
-DPMI_PM_getvector (unsigned vecnum, unsigned * eip, unsigned * cs)
-{
- union REGS regs;
-
- regs.x.ax = 0x204;
- regs.h.bl = (vecnum & 0xff);
- intDPMI (®s, ®s);
- * eip = regs.e.edx;
- * cs = ((unsigned) regs.x.cx);
- return;
-}
-
-static int
-DPMI_PM_setvector (unsigned vecnum, unsigned eip, unsigned cs)
-{
- union REGS regs;
-
- regs.x.ax = 0x205;
- regs.h.bl = (vecnum & 0xff);
- regs.e.edx = eip;
- regs.x.cx = ((unsigned short) cs);
- intDPMI (®s, ®s);
- return (((regs.e.flags & 1) == 0) ? DOS_SUCCESS : DOS_FAILURE);
-}
-
-static void
-DPMI_RM_getvector (unsigned vecnum, unsigned short * ip, unsigned short * cs)
-{
- union REGS regs;
-
- regs.x.ax = 0x200;
- regs.h.bl = (vecnum & 0xff);
- intDPMI (®s, ®s);
- * ip = regs.x.dx;
- * cs = regs.x.cx;
- return;
-}
-
-static int
-DPMI_RM_setvector (unsigned vecnum, unsigned short ip, unsigned short cs)
-{
- union REGS regs;
-
- regs.x.ax = 0x201;
- regs.h.bl = (vecnum & 0xff);
- regs.x.cx = cs;
- regs.x.dx = ip;
- intDPMI (®s, ®s);
- return (((regs.e.flags & 1) == 0) ? DOS_SUCCESS : DOS_FAILURE);
-}
-\f
-#ifdef DPMI_RM_HANDLER_PROTECTED
-
-struct DPMI_RM_REGS
-{
- unsigned long edi; /* 0 */
- unsigned long esi; /* 4 */
- unsigned long ebp; /* 8 */
- unsigned long esp; /* 12 */
- unsigned long ebx; /* 16 */
- unsigned long edx; /* 20 */
- unsigned long ecx; /* 24 */
- unsigned long eax; /* 28 */
- unsigned short flags; /* 30 */
- unsigned short es; /* 32 */
- unsigned short ds; /* 34 */
- unsigned short fs; /* 36 */
- unsigned short gs; /* 38 */
- unsigned short ip; /* 40 */
- unsigned short cs; /* 42 */
- unsigned short sp; /* 44 */
- unsigned short ss; /* 48 */
- unsigned short pad; /* 50 */
- unsigned long old_vector_ip; /* 52 */
- unsigned long old_vector_cs; /* 56 */
-};
-
-static int
-DPMI_allocate_RM_call_back (unsigned short * cb_ip,
- unsigned short * cb_cs,
- unsigned eip, unsigned cs,
- unsigned RM_regs, unsigned ds)
-{
- union REGS regs;
- struct SREGS sregs;
-
- segread (& sregs);
- regs.x.ax = 0x303;
- regs.e.esi = eip;
- sregs.ds = cs;
- regs.e.edi = RM_regs;
- sregs.es = ds;
-
- intDPMIx (®s, ®s, &sregs);
- * cb_ip = regs.x.dx;
- * cb_cs = regs.x.cx;
- return (((regs.e.flags & 1) == 0) ? DOS_SUCCESS : DOS_FAILURE);
-}
-
-static int
-DPMI_free_RM_call_back (unsigned short cb_ip, unsigned short cb_cs)
-{
- union REGS regs;
-
- regs.x.ax = 0x304;
- regs.x.cx = cb_cs;
- regs.x.dx = cb_ip;
- intDPMI (®s, ®s);
- return (((regs.e.flags & 1) == 0) ? DOS_SUCCESS : DOS_FAILURE);
-}
-
-#endif /* DPMI_RM_HANDLER_PROTECTED */
-\f
-#ifdef DPMI_RM_HANDLER_REAL
-
-static int
-DPMI_allocate_DOS_block (unsigned short size,
- unsigned short * rm_seg,
- unsigned short * pm_sel)
-{
- union REGS regs;
-
- regs.x.ax = 0x100;
- regs.x.bx = ((((unsigned) size) + 15) >> 4); /* paragraphs */
- intDPMI (®s, ®s);
- * rm_seg = regs.x.ax;
- * pm_sel = regs.x.dx;
- return (((regs.e.flags & 1) == 0) ? DOS_SUCCESS : DOS_FAILURE);
-}
-
-static int
-DPMI_free_DOS_block (unsigned short selector)
-{
- union REGS regs;
-
- regs.x.ax = 0x101;
- regs.x.dx = selector;
- intDPMI (®s, ®s);
- return (((regs.e.flags & 1) == 0) ? DOS_SUCCESS : DOS_FAILURE);
-}
-
-#endif /* DPMI_RM_HANDLER_REAL */
-\f
-#ifdef DOSX_RM_HANDLER_REAL
-
-static int
-DOSX_allocate_DOS_block (unsigned short size,
- unsigned short * rm_seg)
-{
- union REGS regs;
-#if 0
-
- regs.x.ax = 0x25c0;
- regs.x.bx = ((((unsigned) size) + 15) >> 4); /* paragraphs */
- intdos (®s, ®s);
- if ((regs.e.flags & 1) == 0)
- {
- * rm_seg = regs.x.ax;
- return (DOS_SUCCESS);
- }
- if (regs.x.ax == 0x8)
- errno = ENOMEM;
- else
- errno = EFAULT;
- return (DOS_FAILURE);
-
-#else /* not 0 */
-
- regs.h.ah = 0x48;
- regs.x.bx = ((((unsigned) size) + 15) >> 4); /* paragraphs */
- intdos (®s, ®s);
- * rm_seg = regs.x.ax;
- if ((regs.e.flags & 1) != 0)
- {
- errno = ENOMEM;
- return (DOS_FAILURE);
- }
- return (DOS_SUCCESS);
-
-#endif /* 0 */
-}
-
-static int
-DOSX_free_DOS_block (unsigned short seg)
-{
- union REGS regs;
-#if 0
-
- regs.x.ax = 0x25c1;
- regs.x.cx = seg;
- intdos (®s, ®s);
-
-#else /* not 0 */
-
- struct SREGS sregs;
-
- regs.h.ah = 0x49;
- segread (&sregs);
- sregs.es = seg;
- intdosx (®s, ®s, &sregs);
-
-#endif /* 0 */
- return (((regs.e.flags & 1) == 0) ? DOS_SUCCESS : DOS_FAILURE);
-}
-
-#endif /* DOSX_RM_HANDLER_REAL */
-\f
-#ifndef DOSX_PM_HANDLER_UNTOUCHED
-
-static void
-DOSX_PM_getvector (unsigned vecnum, unsigned * eip, unsigned * cs)
-{
- union REGS regs;
- struct SREGS sregs;
-
- regs.x.ax = 0x2502;
- regs.h.cl = (vecnum & 0xff);
- segread (&sregs);
- intdosx (®s, ®s, &sregs);
- * eip = regs.e.ebx;
- * cs = ((unsigned) sregs.es);
- return;
-}
-
-static void
-DOSX_installvector (unsigned vecnum, unsigned eip, unsigned cs)
-{
- union REGS regs;
- struct SREGS sregs;
-
- regs.x.ax = 0x2506;
- regs.h.cl = (vecnum & 0xff);
- regs.e.edx = eip;
- segread (&sregs);
- sregs.ds = cs;
- intdosx (®s, ®s, &sregs);
- return;
-}
-
-static void
-DOSX_restore_vector (unsigned vecnum, unsigned eip,
- unsigned cs, unsigned rmode)
-{
- union REGS regs;
- struct SREGS sregs;
-
- segread (&sregs);
- sregs.ds = cs;
- regs.e.edx = eip;
- regs.e.ebx = rmode;
- regs.x.ax = 0x2507;
- regs.h.cl = (vecnum & 0xff);
- intdosx (®s, ®s, &sregs);
- return;
-}
-
-#endif /* DOSX_PM_HANDLER_UNTOUCHED */
-\f
-#if (!(defined(DOSX_RM_HANDLER_UNTOUCHED) && defined(DOSX_PM_HANDLER_UNTOUCHED)))
-
-static void
-DOSX_RM_getvector (unsigned vecnum, unsigned * vector)
-{
- union REGS regs;
-
- regs.x.ax = 0x2503;
- regs.h.cl = (vecnum & 0xff);
- intdos (®s, ®s);
- * vector = regs.e.ebx;
- return;
-}
-
-#endif /* !(DOSX_RM_HANDLER_UNTOUCHED && DOSX_PM_HANDLER_UNTOUCHED) */
-
-#ifndef DOSX_RM_HANDLER_UNTOUCHED
-
-static int
-DOSX_RM_setvector (unsigned vecnum, unsigned rm_address)
-{
- union REGS regs;
-
- regs.x.ax = 0x2505;
- regs.h.cl = (vecnum & 0xff);
- regs.e.ebx = rm_address;
- intdos (®s, ®s);
- return (((regs.e.flags & 1) == 0) ? DOS_SUCCESS : DOS_FAILURE);
-}
-
-#if 0
-static int
-DOSX_convert_PM_to_RM_address (unsigned short sel, unsigned offset,
- unsigned length, unsigned * rm_address)
-{
- union REGS regs;
- struct SREGS sregs;
-
- segread (&sregs);
- sregs.es = sel;
- regs.e.ebx = offset;
- regs.e.ecx = length;
- regs.e.eax = 0x250f;
- intdosx (®s, ®s, &sregs);
- * rm_address = regs.e.ecx;
- return (((regs.e.flags & 1) == 0) ? DOS_SUCCESS : DOS_FAILURE);
-}
-#endif /* 0 */
-
-#endif /* DOSX_RM_HANDLER_UNTOUCHED */
-\f
-static unsigned
- old_PM_vector_eip,
- old_PM_vector_cs;
-
-static union RM_address old_RM_vector;
-
-static void
- * scheme_PM_vector = ((void *) NULL),
- * scheme_RM_vector = ((void *) NULL);
-
-#if (!defined (DOSX_PM_HANDLER_UNTOUCHED)) || (!defined (DPMI_PM_HANDLER_UNTOUCHED))
-static void *
-make_PM_trampoline (void (* hook) (void))
-{
- void * trampoline;
- INSN_DECLS ();
-
- trampoline = (malloc (TRAMP_SIZE (7)));
- if (trampoline != ((void *) NULL))
- {
- INIT_INSNS (trampoline);
- PUSH_INSN (old_PM_vector_cs);
- PUSH_INSN (old_PM_vector_eip);
- PUSH_INSH (caps_scan_code_to_ascii);
- PUSH_INSN (shifted_scan_code_to_ascii);
- PUSH_INSN (unshifted_scan_code_to_ascii);
- PUSH_INSN (& modifier_mask);
- PUSH_INSN (getDS ());
- JMP_INSN (hook);
- HLT_INSNS (7);
- }
- return (trampoline);
-}
-#endif /* !DOSX_PM_HANDLER_UNTOUCHED || !DPMI_PM_HANDLER_UNTOUCHED */
-
-#ifdef DPMI_RM_HANDLER_PROTECTED
-static void *
-make_RM_trampoline (void (* hook) (void))
-{
- void * trampoline;
- INSN_DECLS ();
-
- trampoline = (malloc (TRAMP_SIZE (7)));
- if (trampoline != ((void *) NULL))
- {
- INIT_INSNS (trampoline);
- PUSH_INSN (old_RM_vector.x.seg);
- PUSH_INSN (old_RM_vector.x.off);
- PUSH_INSH (caps_scan_code_to_ascii);
- PUSH_INSN (shifted_scan_code_to_ascii);
- PUSH_INSN (unshifted_scan_code_to_ascii);
- PUSH_INSN (& modifier_mask);
- PUSH_INSN (getDS ());
- JMP_INSN (hook);
- HLT_INSNS (7);
- }
- return (trampoline);
-}
-#endif /* DPMI_RM_HANDLER_PROTECTED */
-
-#ifdef DPMI_RM_HANDLER_PROTECTED
- static union RM_address DPMI_RM_call_back;
- static void * DPMI_RM_regs = ((void *) NULL);
-#endif /* DPMI_RM_HANDLER_PROTECTED */
-
-#ifdef DPMI_RM_HANDLER_REAL
- static unsigned short DPMI_RM_selector = 0;
-#endif /* DPMI_RM_HANDLER_REAL */
-\f
-static char * DPMI_env_var = "MITSCHEME_DPMI_EXT_KBD";
-
-static int
-DPMI_restore_kbd_hook (void)
-{
- if (!(install_kbd_hook_p (DPMI_env_var)))
- return (DOS_FAILURE);
-
-#ifdef DPMI_RM_HANDLER_REAL
- if (DPMI_RM_selector != 0)
- {
- if (((DPMI_RM_setvector (DOS_INTVECT_SYSTEM_SERVICES,
- old_RM_vector.x.off,
- old_RM_vector.x.seg))
- != DOS_SUCCESS)
- || ((DPMI_free_DOS_block (DPMI_RM_selector)) != DOS_SUCCESS))
- {
- errno = EACCES;
- return (DOS_FAILURE);
- }
- DPMI_RM_selector = 0;
- free (scheme_RM_vector);
- scheme_RM_vector = ((void *) NULL);
- }
-#endif /* #ifdef DPMI_RM_HANDLER_REAL */
-
-#ifdef DPMI_RM_HANDLER_PROTECTED
- if (scheme_RM_vector != ((void *) NULL))
- {
- if (((DPMI_RM_setvector (DOS_INTVECT_SYSTEM_SERVICES,
- old_RM_vector.x.off,
- old_RM_vector.x.seg))
- != DOS_SUCCESS)
- || ((DPMI_free_RM_call_back (DPMI_RM_call_back.x.off,
- DPMI_RM_call_back.x.seg))
- != DOS_SUCCESS))
- {
- errno = EACCES;
- return (DOS_FAILURE);
- }
- free (DPMI_RM_regs);
- free (scheme_RM_vector);
- scheme_RM_vector = ((void *) NULL);
- }
-#endif /* DPMI_RM_HANDLER_PROTECTED */
-
-#ifndef DPMI_PM_HANDLER_UNTOUCHED
- if (scheme_PM_vector != ((void *) NULL))
- {
- if ((DPMI_PM_setvector (DOS_INTVECT_SYSTEM_SERVICES,
- old_PM_vector_eip,
- old_PM_vector_cs))
- != DOS_SUCCESS)
- {
- errno = EACCES;
- return (DOS_FAILURE);
- }
- free (scheme_PM_vector);
- scheme_PM_vector = ((void *) NULL);
- }
-#endif /* DPMI_PM_HANDLER_UNTOUCHED */
-
- return (DOS_SUCCESS);
-}
-\f
-#if defined(DPMI_RM_HANDLER_REAL) || defined(DOSX_RM_HANDLER_REAL)
-
-static unsigned tables_offset = 0;
-
-#define PATTERN_MODIFIER_OFFSET 0
-#define PATTERN_UNSHIFTED_PTR_OFFSET 2
-#define PATTERN_SHIFTED_PTR_OFFSET 4
-#define PATTERN_CAPS_PTR_OFFSET 6
-#define PATTERN_CHAIN_OFFSET 10
-#define PATTERN_START_OFFSET 14
-
-#define RM_ISR_MASK_OFFSET PATTERN_MODIFIER_OFFSET
-
-static void *
-make_RM_handler (unsigned * size, unsigned * offset, unsigned * delta)
-{
- extern void RM_keyboard_pattern_start (void);
- extern void RM_keyboard_pattern_end (void);
- unsigned long pattern_start, start_offset;
- unsigned long pattern_size, total_size;
- unsigned short * wordptr;
- unsigned char * copy;
- union REGS regs;
-
- regs.x.ax = 0x2509;
- intdos (®s, ®s);
- start_offset = ((unsigned long) RM_keyboard_pattern_start);
- pattern_start = ((((unsigned long) regs.x.bx) << 4) + start_offset);
-
- pattern_size = (((unsigned long) RM_keyboard_pattern_end) - start_offset);
- total_size = (pattern_size
- + (sizeof (unshifted_scan_code_to_ascii))
- + (sizeof (shifted_scan_code_to_ascii))
- + (sizeof (caps_scan_code_to_ascii)));
-
- copy = ((unsigned char *) (malloc (total_size)));
- if (copy == ((unsigned char *) NULL))
- return ((void *) NULL);
-
- farcpy (((unsigned) copy), (getDS ()),
- ((unsigned) pattern_start), (regs.e.edx >> 16),
- pattern_size);
-
- if (copy[PATTERN_START_OFFSET] != ((unsigned char) 0x9c))
- {
- fprintf (stderr, "make_RM_handler: Bad pattern!\n");
- fprintf (stderr, "\tpattern_start = 0x%lx, pattern_size = %d.\n",
- pattern_start, pattern_size);
- fprintf (stderr, "\tselector = 0x%x; segment = 0x%x; start_offset = 0x%x.\n",
- (regs.e.edx >> 16), regs.x.bx, start_offset);
- free (copy);
- return ((void *) NULL);
- }
-
- memcpy ((copy + pattern_size),
- unshifted_scan_code_to_ascii,
- (sizeof (unshifted_scan_code_to_ascii)));
-
- memcpy ((copy + (pattern_size + (sizeof (unshifted_scan_code_to_ascii)))),
- shifted_scan_code_to_ascii,
- (sizeof (shifted_scan_code_to_ascii)));
-
- memcpy ((copy + (pattern_size + ((sizeof (unshifted_scan_code_to_ascii))
- + (sizeof (shifted_scan_code_to_ascii))))),
- caps_scan_code_to_ascii,
- (sizeof (caps_scan_code_to_ascii)));
-
- copy[PATTERN_MODIFIER_OFFSET] = modifier_mask;
- wordptr = ((unsigned short *) (copy + PATTERN_UNSHIFTED_PTR_OFFSET));
- * wordptr = (pattern_size + start_offset);
- wordptr = ((unsigned short *) (copy + PATTERN_SHIFTED_PTR_OFFSET));
- * wordptr = ((pattern_size + (sizeof (unshifted_scan_code_to_ascii)))
- + start_offset);
- wordptr = ((unsigned short *) (copy + PATTERN_CAPS_PTR_OFFSET));
- * wordptr = ((pattern_size + ((sizeof (unshifted_scan_code_to_ascii))
- + (sizeof (shifted_scan_code_to_ascii))))
- + start_offset);
- wordptr = ((unsigned short *) (copy + PATTERN_CHAIN_OFFSET));
- * wordptr++ = old_RM_vector.x.off;
- * wordptr = old_RM_vector.x.seg;
-
- * delta = start_offset;
- * size = total_size;
- * offset = PATTERN_START_OFFSET;
- tables_offset = pattern_size;
- return ((void *) copy);
-}
-
-#endif /* DPMI_RM_HANDLER_REAL || DOSX_RM_HANDLER_REAL */
-\f
-static int
-DPMI_install_kbd_hook (void)
-{
- if (!(install_kbd_hook_p (DPMI_env_var)))
- return (DOS_FAILURE);
-
-#ifndef DPMI_PM_HANDLER_UNTOUCHED
-
- DPMI_PM_getvector (DOS_INTVECT_SYSTEM_SERVICES,
- & old_PM_vector_eip,
- & old_PM_vector_cs);
-
- {
- extern void DPMI_PM_scheme_system_isr (void);
- void * PM_trampoline;
-
- PM_trampoline = (make_PM_trampoline (DPMI_PM_scheme_system_isr));
- if (PM_trampoline == ((void *) NULL))
- {
- errno = ENOMEM;
- return (DOS_FAILURE);
- }
- if ((DPMI_PM_setvector (DOS_INTVECT_SYSTEM_SERVICES,
- ((unsigned) PM_trampoline),
- (getCS ())))
- != DOS_SUCCESS)
- {
- errno = EACCES;
- free (PM_trampoline);
- return (DOS_FAILURE);
- }
- scheme_PM_vector = PM_trampoline;
- }
-
-#endif /* DPMI_PM_HANDLER_UNTOUCHED */
-\f
-#ifndef DPMI_RM_HANDLER_UNTOUCHED
-
- DPMI_RM_getvector (DOS_INTVECT_SYSTEM_SERVICES,
- & old_RM_vector.x.off,
- & old_RM_vector.x.seg);
-
-# ifdef DPMI_RM_HANDLER_PROTECTED
-
- {
- extern void DPMI_RM_scheme_system_isr (void);
- struct DPMI_RM_REGS * RM_regs;
- union RM_address RM_call_back;
- void * RM_trampoline;
-
- RM_regs = ((struct DPMI_RM_REGS *)
- (malloc (sizeof (struct DPMI_RM_REGS))));
- if (RM_regs == ((struct DPMI_RM_REGS *) NULL))
- {
- DPMI_restore_kbd_hook ();
- errno = ENOMEM;
- return (DOS_FAILURE);
- }
-
- RM_regs->ss = 0;
- RM_regs->sp = 0;
- RM_regs->old_vector_ip = (old_RM_vector.x.off);
- RM_regs->old_vector_cs = (old_RM_vector.x.seg);
-
- RM_trampoline = (make_RM_trampoline (DPMI_RM_scheme_system_isr));
- if (RM_trampoline == ((void *) NULL))
- {
- free (RM_regs);
- DPMI_restore_kbd_hook ();
- errno = ENOMEM;
- return (DOS_FAILURE);
- }
-
- if (((DPMI_allocate_RM_call_back (& RM_call_back.x.off,
- & RM_call_back.x.seg,
- ((unsigned) RM_trampoline),
- ((unsigned) (getCS ())),
- ((unsigned) RM_regs),
- ((unsigned) (getDS ()))))
- != DOS_SUCCESS)
- || ((DPMI_RM_setvector (DOS_INTVECT_SYSTEM_SERVICES,
- RM_call_back.x.off,
- RM_call_back.x.seg))
- != DOS_SUCCESS))
- {
- free (RM_trampoline);
- free (RM_regs);
- DPMI_restore_kbd_hook ();
- errno = EACCES;
- return (DOS_FAILURE);
- }
- scheme_RM_vector = RM_trampoline;
- DPMI_RM_regs = ((void *) RM_regs);
- DPMI_RM_call_back = RM_call_back;
- }
-
-# else /* not DPMI_RM_HANDLER_PROTECTED = DPMI_RM_HANDLER_REAL */
-\f
- {
- void * RM_handler;
- unsigned handler_size, entry_offset, relocation;
- unsigned short prot_mode_selector;
- unsigned short real_mode_segment;
- unsigned long base_addr;
-
- RM_handler = (make_RM_handler (& handler_size, & entry_offset, & relocation));
- if (RM_handler == ((void *) NULL))
- {
- int saved_errno = errno;
-
- DPMI_restore_kbd_hook ();
- errno = saved_errno;
- return (DOS_FAILURE);
- }
-
- if ((DPMI_allocate_DOS_block (handler_size,
- & real_mode_segment,
- & prot_mode_selector))
- != DOS_SUCCESS)
- {
- free (RM_handler);
- DPMI_restore_kbd_hook ();
- errno = ENOMEM;
- return (DOS_FAILURE);
- }
-
- farcpy (0, prot_mode_selector,
- ((unsigned) RM_handler), (getDS ()),
- handler_size);
-
- base_addr = ((((unsigned long) real_mode_segment) << 4) - relocation);
-
- if ((DPMI_RM_setvector (DOS_INTVECT_SYSTEM_SERVICES,
- (entry_offset + relocation),
- (base_addr >> 4)))
- != DOS_SUCCESS)
- {
- DPMI_free_DOS_block (prot_mode_selector);
- free (RM_handler);
- DPMI_restore_kbd_hook ();
- errno = EACCES;
- return (DOS_FAILURE);
- }
-
- DPMI_RM_selector = prot_mode_selector;
- scheme_RM_vector = RM_handler; /* Kludge! */
- }
-
-# endif /* not DPMI_RM_HANDLER_PROTECTED */
-#endif /* DPMI_RM_HANDLER_UNTOUCHED */
- return (DOS_SUCCESS);
-}
-\f
-static void
-DPMI_set_modifier_mask (unsigned char new_mask)
-{
-#ifdef DPMI_RM_HANDLER_REAL
-
- if (DPMI_RM_selector != 0)
- farcpy (RM_ISR_MASK_OFFSET, DPMI_RM_selector,
- ((unsigned) (& new_mask)), (getDS ()),
- 1);
-
-#endif /* DPMI_RM_HANDLER_REAL */
- return;
-}
-
-static void
-DPMI_set_kbd_translation (unsigned table,
- unsigned scan_code,
- unsigned char new)
-{
-#ifdef DPMI_RM_HANDLER_REAL
-
- int offset = tables_offset;
-
- switch (table)
- {
- case 2:
- offset += (sizeof (shifted_scan_code_to_ascii));
-
- case 1:
- offset += (sizeof (unshifted_scan_code_to_ascii));
-
- default:
- break;
- }
-
- if (DPMI_RM_selector != 0)
- farcpy ((scan_code + tables_offset),
- DPMI_RM_selector,
- ((unsigned) (& new)),
- (getDS ()),
- 1);
-
-#endif /* DPMI_RM_HANDLER_REAL */
-
- return;
-}
-
-dos_boolean
-under_DPMI_p (void)
-{
- union REGS regs;
-
- regs.e.eax = 0x1686;
- int86 (0x2f, ®s, ®s);
- return (regs.x.ax == 0);
-}
-\f
-#ifdef DOSX_RM_HANDLER_REAL
- static unsigned short DOSX_RM_segment = 0;
-#endif /* DOSX_RM_HANDLER_REAL */
-#ifdef DOSX_USE_INT_INTERCEPT
- static unsigned char kludge;
-#endif /* DOSX_USE_INT_INTERCEPT */
-
-static char * DOSX_env_var = "MITSCHEME_DOSX_EXT_KBD";
-
-static int
-DOSX_install_kbd_hook (void)
-{
- if (!(install_kbd_hook_p (DOSX_env_var)))
- return (DOS_FAILURE);
-
-#ifdef DOSX_USE_INT_INTERCEPT
- {
- int_intercept (DOS_INTVECT_SYSTEM_SERVICES,
- bios_keyboard_handler,
- 256);
-
- scheme_PM_vector = ((void *) & kludge);
- }
-#else /* not DOSX_USE_INT_INTERCEPT */
-#ifndef DOSX_PM_HANDLER_UNTOUCHED
- {
- extern void DOSX_scheme_system_isr (void);
- void * trampoline;
-
- DOSX_PM_getvector (DOS_INTVECT_SYSTEM_SERVICES,
- & old_PM_vector_eip,
- & old_PM_vector_cs);
- DOSX_RM_getvector (DOS_INTVECT_SYSTEM_SERVICES,
- & old_RM_vector.fp);
-
- trampoline = (make_PM_trampoline (DOSX_scheme_system_isr));
- if (trampoline == ((void *) NULL))
- return (DOS_FAILURE);
-
- DOSX_installvector (DOS_INTVECT_SYSTEM_SERVICES,
- ((unsigned) trampoline),
- ((unsigned) (getCS ())));
-
- scheme_PM_vector = trampoline;
- }
-#endif /* DOSX_PM_HANDLER_UNTOUCHED */
-
-#ifdef DOSX_RM_HANDLER_REAL
- {
- void * RM_handler;
- union RM_address new_handler;
- unsigned handler_size, entry_offset, relocation;
- unsigned long base_addr;
-
- DOSX_RM_getvector (DOS_INTVECT_SYSTEM_SERVICES,
- ((unsigned *) & old_RM_vector));
-
- RM_handler = (make_RM_handler (& handler_size, & entry_offset, & relocation));
- if (RM_handler == ((void *) NULL))
- return (DOS_FAILURE);
-
-#if 0
-
- if ((DOSX_convert_PM_to_RM_address ((getDS ()), ((unsigned) RM_handler),
- handler_size,
- ((unsigned *) & new_handler)))
- != DOS_SUCCESS)
- {
- int saved_errno = errno;
-
- fflush (stdout);
- free (RM_handler);
- errno = saved_errno;
- return (DOS_FAILURE);
- }
-
- if ((new_handler.x.off & 0xf) != 0)
- {
- fflush (stdout);
- free (RM_handler);
- errno = EFAULT;
- return (DOS_FAILURE);
- }
-
- base_addr = (((new_handler.x.seg << 4) + (new_handler.x.off))
- - relocation);
- new_handler.x.seg = (base_addr >> 4);
- new_handler.x.off = (base_addr & 0xf);
- new_handler.x.off += (relocation + entry_offset);
-
- if ((DOSX_RM_setvector (DOS_INTVECT_SYSTEM_SERVICES,
- ((unsigned) new_handler)))
- != DOS_SUCCESS)
- {
- fflush (stdout);
- free (RM_handler);
- errno = EFAULT;
- return (DOS_FAILURE);
- }
-
-#else /* not 0 */
-
- if ((DOSX_allocate_DOS_block (handler_size, &new_handler.x.seg))
- != DOS_SUCCESS)
- {
- int saved_errno = errno;
-
- free (RM_handler);
- errno = saved_errno;
- return (DOS_FAILURE);
- }
-
- /* This assumes that the bottom 1 Mb of memory is mapped to the DOS
- memory, so it can be accessed directly.
- */
-
- memcpy (((void *) ((unsigned long) new_handler.x.seg << 4)),
- RM_handler,
- handler_size);
-
- DOSX_RM_segment = new_handler.x.seg;
-
- base_addr = ((new_handler.x.seg << 4) - relocation)
- new_handler.x.seg = (base_addr >> 4);
- new_handler.x.off = (base_addr & 0xf);
- new_handler.x.off += (relocation + entry_offset);
-
- if ((DOSX_RM_setvector (DOS_INTVECT_SYSTEM_SERVICES, new_handler.fp))
- != DOS_SUCCESS)
- {
- DOSX_free_DOS_block (DOSX_RM_segment);
- DOSX_RM_segment = 0;
- fflush (stdout);
- free (RM_handler);
- errno = EFAULT;
- return (DOS_FAILURE);
- }
-
-#endif /* 0 */
-
- scheme_RM_vector = RM_handler;
- }
-
-#endif /* DOSX_PM_HANDLER_UNTOUCHED */
-#endif /* DOSX_USE_INT_INTERCEPT */
- return (DOS_SUCCESS);
-}
-\f
-static int
-DOSX_restore_kbd_hook (void)
-{
- if (!(install_kbd_hook_p (DOSX_env_var)))
- return (DOS_FAILURE);
-
-#ifdef DOSX_USE_INT_INTERCEPT
-
- (void) int_restore (DOS_INTVECT_SYSTEM_SERVICES);
- scheme_PM_vector = ((void *) NULL);
-
-#else /* not DOSX_USE_INT_INTERCEPT */
-#ifndef DOSX_PM_HANDLER_UNTOUCHED
-
- DOSX_restore_vector (DOS_INTVECT_SYSTEM_SERVICES,
- old_PM_vector_eip,
- old_PM_vector_cs,
- old_RM_vector.fp);
-
- free (scheme_PM_vector);
- scheme_PM_vector = ((void *) NULL);
-
-#endif /* DOSX_PM_HANDLER_UNTOUCHED */
-
-#ifdef DOSX_RM_HANDLER_REAL
-
- if ((DOSX_RM_setvector (DOS_INTVECT_SYSTEM_SERVICES,
- ((unsigned) old_RM_vector)))
- != DOS_SUCCESS)
- return (DOS_FAILURE);
-
-#if 1
-
- if ((DOSX_free_DOS_block (DOSX_RM_segment)) != DOS_SUCCESS)
- return (DOS_FAILURE);
- DOSX_RM_segment = 0;
-
-#endif /* 1 */
-
- free (scheme_RM_vector);
- scheme_RM_vector = ((void *) NULL);
-
-#endif /* DOSX_RM_HANDLER_REAL */
-#endif /* DOSX_USE_INT_INTERCEPT */
- return (DOS_SUCCESS);
-}
-\f
-static void
-DOSX_set_modifier_mask (unsigned char new_mask)
-{
-#ifdef DOSX_RM_HANDLER_REAL
-
- if (DOSX_RM_segment != 0)
- (* ((unsigned char *)
- ((((unsigned long) DOSX_RM_segment) << 4) + RM_ISR_MASK_OFFSET)))
- = new_mask;
-
-#endif /* DOSX_RM_HANDLER_REAL */
- return;
-}
-
-static void
-DOSX_set_kbd_translation (unsigned table,
- unsigned scan_code,
- unsigned char new)
-{
-#ifdef DOSX_RM_HANDLER_REAL
-
- int offset = tables_offset;
-
- switch (table)
- {
- case 2:
- offset += (sizeof (shifted_scan_code_to_ascii));
-
- case 1:
- offset += (sizeof (unshifted_scan_code_to_ascii));
-
- default:
- break;
- }
-
- if (DOSX_RM_segment != 0)
- (* ((unsigned char *)
- ((((unsigned long) DOSX_RM_segment) << 4) + (scan_code + offset))))
- = new;
-
-#endif /* DOSX_RM_HANDLER_REAL */
- return;
-}
-
-static dos_boolean
-under_DOSX_p (void)
-{
- return (dos_true);
-}
-\f
-/* Zortech's int_intercept does not work consistently with X32.
- Here is alternative lower-level code.
- */
-
-static char * X32_env_var = "MITSCHEME_X32_EXT_KBD";
-
-extern dos_boolean EXFUN (under_X32_p, (void));
-
-static int
-X32_install_kbd_hook (void)
-{
- extern int EXFUN (X32_int_intercept, (unsigned, void (*) (void), PTR));
- extern void EXFUN (X32_keyboard_interrupt, (void));
- extern PTR X32_kbd_interrupt_pointers[];
- extern int X32_kbd_interrupt_previous;
-
- if (!(install_kbd_hook_p (X32_env_var)))
- return (DOS_FAILURE);
-
- X32_kbd_interrupt_pointers[0] = ((PTR) &modifier_mask);
- X32_kbd_interrupt_pointers[1] = ((PTR) &unshifted_scan_code_to_ascii[0]);
- X32_kbd_interrupt_pointers[2] = ((PTR) &shifted_scan_code_to_ascii[0]);
- X32_kbd_interrupt_pointers[3] = ((PTR) &caps_scan_code_to_ascii[0]);
-
- if ((X32_int_intercept (DOS_INTVECT_SYSTEM_SERVICES,
- X32_keyboard_interrupt,
- ((PTR) &X32_kbd_interrupt_previous)))
- != 0)
- return (DOS_FAILURE);
- return (DOS_SUCCESS);
-}
-
-static int
-X32_restore_kbd_hook (void)
-{
- extern int EXFUN (X32_interrupt_restore, (unsigned));
-
- if ((!(install_kbd_hook_p (X32_env_var)))
- || (X32_interrupt_restore (DOS_INTVECT_SYSTEM_SERVICES)) != 0)
- return (DOS_FAILURE);
- return (DOS_SUCCESS);
-}
-
-static void
-X32_set_modifier_mask (unsigned char new_mask)
-{
- return;
-}
-
-static void
-X32_set_kbd_translation (unsigned table,
- unsigned scan_code,
- unsigned char new)
-{
- return;
-}
-\f
-struct keyboard_method_s
-{
- dos_boolean (* present) (void);
- int (* install) (void);
- int (* restore) (void);
- void (* set_modifier_mask) (unsigned char);
- void (* set_kbd_translation) (unsigned, unsigned, unsigned char);
-};
-
-static struct keyboard_method_s keyboard_methods[] =
-{
- {
- under_DPMI_p,
- DPMI_install_kbd_hook,
- DPMI_restore_kbd_hook,
- DPMI_set_modifier_mask,
- DPMI_set_kbd_translation
- },
- {
- under_X32_p,
- X32_install_kbd_hook,
- X32_restore_kbd_hook,
- X32_set_modifier_mask,
- X32_set_kbd_translation
- },
- {
- under_DOSX_p,
- DOSX_install_kbd_hook,
- DOSX_restore_kbd_hook,
- DOSX_set_modifier_mask,
- DOSX_set_kbd_translation
- }
-};
-
-struct keyboard_method_s *
- installed_keyboard_method = ((struct keyboard_method_s *) NULL);
-
-#define N_KEYBOARD_METHODS \
- ((sizeof (keyboard_methods)) / (sizeof (struct keyboard_method_s)))
-
-static int
-stdin_is_keyboard_p (void)
-{
- Tchannel input = (OS_tty_input_channel ());
- if ((OS_channel_type (input)) != channel_type_terminal)
- return (0);
- return (1);
-}
-
-int
-dos_install_kbd_hook (void)
-{
- int i, result;
-
- if (stdin_is_keyboard_p ())
- for (i = 0; i < N_KEYBOARD_METHODS; i++)
- {
- if ((* (keyboard_methods[i].present)) ())
- {
- result = ((* (keyboard_methods[i].install)) ());
- if (result == DOS_SUCCESS)
- installed_keyboard_method = &keyboard_methods[i];
- return (result);
- }
- }
- return (DOS_FAILURE);
-}
-\f
-int
-dos_restore_kbd_hook (void)
-{
- int result;
-
- if (installed_keyboard_method == ((struct keyboard_method_s *) NULL))
- return (DOS_SUCCESS);
-
- result = (* (installed_keyboard_method->restore)) ();
- if (result == DOS_SUCCESS)
- installed_keyboard_method = ((struct keyboard_method_s *) NULL);
- return (result);
-}
-
-unsigned char
-dos_set_kbd_modifier_mask (unsigned char new_mask)
-{
- unsigned char old_mask = modifier_mask;
-
- modifier_mask = new_mask;
-
- if (installed_keyboard_method != ((struct keyboard_method_s *) NULL))
- (* (installed_keyboard_method->set_modifier_mask)) (modifier_mask);
-
- return (old_mask);
-}
-
-extern int EXFUN (dos_set_kbd_translation,
- (unsigned, unsigned, unsigned char));
-
-int
-dos_set_kbd_translation (unsigned which_table,
- unsigned scan_code,
- unsigned char new)
-{
- unsigned char old;
- unsigned char * table;
-
- if (scan_code >= (sizeof (shifted_scan_code_to_ascii)))
- return (-1);
-
- switch (which_table)
- {
- case 0:
- default:
- table = &unshifted_scan_code_to_ascii[0];
- break;
-
- case 1:
- table = &shifted_scan_code_to_ascii[0];
- break;
-
- case 2:
- table = &caps_scan_code_to_ascii[0];
- break;
- }
-
- old = table[scan_code];
- table[scan_code] = new;
-
- if (installed_keyboard_method != ((struct keyboard_method_s *) NULL))
- (* (installed_keyboard_method->set_kbd_translation))
- (which_table, scan_code, new);
-
- return ((int) old);
-}
+++ /dev/null
-/* -*-C-*-
-
-$Id: doskbd.h,v 1.3 1999/01/02 06:11:34 cph Exp $
-
-Copyright (c) 1992, 1999 Massachusetts Institute of Technology
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or (at
-your option) any later version.
-
-This program is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-#ifndef _DOSKBD_H
-# define _DOSKBD_H
-
-extern dos_boolean under_DPMI_p (void);
-extern int dos_install_kbd_hook (void);
-extern int dos_restore_kbd_hook (void);
-extern unsigned char dos_set_kbd_modifier_mask (unsigned char new_mask);
-
-#endif /* _DOSKBD_H */
+++ /dev/null
-;;; -*-Midas-*-
-;;;
-;;; $Id: doskbutl.asm,v 1.7 1999/01/02 06:11:34 cph Exp $
-;;;
-;;; Copyright (c) 1992, 1999 Massachusetts Institute of Technology
-;;;
-;;; This program is free software; you can redistribute it and/or
-;;; modify it under the terms of the GNU General Public License as
-;;; published by the Free Software Foundation; either version 2 of the
-;;; License, or (at your option) any later version.
-;;;
-;;; This program is distributed in the hope that it will be useful,
-;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-;;; General Public License for more details.
-;;;
-;;; You should have received a copy of the GNU General Public License
-;;; along with this program; if not, write to the Free Software
-;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-;;;
-
-.386
-.model tiny
- .code
-\f
-;; Stack on entry to _DOSX_scheme_system_isr
-;;
-;;36 IRETD EFLAGS
-;;32 IRETD CS
-;;28 IRETD EIP
-;;24 CS for next handler in chain
-;;20 EIP for next handler in chain
-;;16 offset of caps table
-;;12 offset of shifted table
-;;8 offset of unshifted table
-;;4 offset of modifier mask
-;;0 DS for scan_code to ascii tables
-
- extrn scheme_system_isr:near
- public _DOSX_scheme_system_isr
- public _DPMI_PM_scheme_system_isr
-
-_DOSX_scheme_system_isr:
-_DPMI_PM_scheme_system_isr:
- pushfd
- call scheme_system_isr
- jnc DOSX_scheme_system_dismiss
-
-;; Chain to next handler (flags unmodified)
- popfd
- lea esp,20[esp]
-; ret far
- db 0cbh
-
-;; Dismiss/finish interrupt (update flags)
-
-DOSX_scheme_system_dismiss:
- push eax
- mov eax,4[esp] ;updated flags
- mov 44[esp],eax ;flags to restore
- pop eax
- popfd
- lea esp,28[esp]
- iretd
-\f
-;; Stack on entry to _DPMI_scheme_system_isr
-;;
-;;24 CS for next (real mode) handler in chain
-;;20 IP for next (real mode) handler in chain
-;;16 offset for caps table
-;;12 offset for shifted table
-;;8 offset for unshifted table
-;;4 offset of modifier mask
-;;0 DS for scan_code to ascii tables
-
- public _DPMI_RM_scheme_system_isr
-_DPMI_RM_scheme_system_isr:
- mov eax,es:28[edi] ; real mode eax
- xor edx,edx
- mov dx,es:32[edi] ; real mode flags
- push edx
- call scheme_system_isr
- jnc DPMI_scheme_system_dismiss
-
-;; Chain to next real mode handler (flags unmodified)
- lea esp,4[esp] ; drop flags
- mov eax,20[esp] ; real mode IP (padded to dword)
- mov es:42[edi],ax
- mov eax,24[esp] ; real mode CS (padded to dword)
- mov es:44[edi],ax
- lea esp,28[esp] ; pop args
- iret ; tell DPMI we're done
-
-;; Dismiss/finish interrupt in real mode (update flags, simulate RM iret)
-
-DPMI_scheme_system_dismiss:
- pop eax ; updated flags
- mov es:32[edi],ax
- mov ax,ds:[esi] ; real mode IRET ip
- mov es:42[edi],ax
- mov ax,ds:2[esi] ; real mode IRET cs
- mov es:44[edi],ax
- add word ptr es:46[edi],6 ; bump real mode sp
- lea esp,28[esp] ; pop args
- iret ; tell DPMI we're done
-\f
-;; These macros taken from x32's mac32.asm
-
-;Macro for start of a real mode code segment
-start16code macro
-__X386_CODESEG_16 segment para use16 public 'CODE'
-assume cs:__X386_CODESEG_16,ds:nothing,es:nothing,fs:nothing,gs:nothing,ss:nothing
-endm
-
-;Macro for end of real mode code segment
-end16code macro
-__X386_CODESEG_16 ends
-endm
-
-start16code
- public _RM_keyboard_pattern_start
-_RM_keyboard_pattern_start:
-
-modifier_mask:
- db 2 dup (0)
-unshifted_table_offset:
- db 2 dup (0)
-shifted_table_offset:
- db 2 dup (0)
-caps_table_offset:
- db 2 dup (0)
-
-chain:
- popf
- db 0eah ; jmpf next_in_chain
- db 4 dup (0)
-
-kbd_isr:
- pushf
- cmp ah,4fh
- jne chain
- cmp al,39h
- ja chain
- push bx ; Preserve bx
- push ax ; Preserve scan code
- mov ah,2h
- int 16h ; Get modifier bits
- and al,byte ptr cs:modifier_mask
- pop bx ; Get scan code
- push bx
- and bx,3fh ; Drop fncn
-
- push si
- mov si,word ptr cs:shifted_table_offset
- test al,7h ; Ctrl or shift set?
- jne do_fetch
-
- mov si,word ptr cs:caps_table_offset
- test al,40h ; CAPS set?
- jne do_fetch
-
- mov si,word ptr cs:unshifted_table_offset
-
-do_fetch:
- mov bl,byte ptr cs:[bx+si] ; Fetch translated byte.
- pop si
- cmp bl,0 ; No translation?
- je abort_translation
- ; bt al,2h ; Control set?
- db 0fh,0bah,0e0h,2 ; bt al,2h
- jnc after_ctrl
- and bl,09fh ; controlify
-after_ctrl:
- ; bt al,3h ; Alt set?
- db 0fh,0bah,0e0h,3
- jnc after_meta
- or bl,080h ; metify
-after_meta:
- cmp bl,0f0h ; M-p ?
- je abort_translation
- pop ax
- push cx ; Preserve cx
- push ax
- mov ch,al ; Scan code
- cmp bl,0 ; C-Space?
- jne after_ctrl_space
- mov ch,3 ; Fudge scan code
-after_ctrl_space:
- mov cl,bl ; ASCII value
- mov ah,05h ; fcn. number
- int 16h ; Record keystroke
- pop ax ; Restore registers
- pop cx
- pop bx
- push bp
- mov bp,sp
- and 8[bp],0feh ; clc iret's flags
- pop bp
- popf
- clc
- iret
-
-abort_translation:
- pop ax
- pop bx
- jmp chain
-
- public _RM_keyboard_pattern_end
-_RM_keyboard_pattern_end:
- nop
-
-end16code
-
-end
+++ /dev/null
-/* -*-C-*-
-
-$Id: dosscan.h,v 1.5 1999/01/02 06:11:34 cph Exp $
-
-Copyright (c) 1992, 1999 Massachusetts Institute of Technology
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or (at
-your option) any later version.
-
-This program is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-/* Scan code conversion table for DOS */
-
-#ifndef SCM_DOSSCAN_INCLUDE
-#define SCM_DOSSCAN_INCLUDE
-
-#define METAFY(c) ((unsigned char) (((unsigned char) (c)) + 128))
-/* This had better get uppercase characters */
-#define CONTROLIFY(c) ((unsigned char) (((unsigned char) (c)) - 64))
-
-#define NO_CONVERSION ((unsigned char *) ((void *) 0))
-
-unsigned char CTRL_AT[] = { '\0' };
-unsigned char HARD_ATTN[] = "HA";
-unsigned char SOFT_ATTN[] = "SA";
-unsigned char META_a[] = {METAFY('a'), '\0'};
-unsigned char META_b[] = {METAFY('b'), '\0'};
-unsigned char META_c[] = {METAFY('c'), '\0'};
-unsigned char META_d[] = {METAFY('d'), '\0'};
-unsigned char META_e[] = {METAFY('e'), '\0'};
-unsigned char META_f[] = {METAFY('f'), '\0'};
-unsigned char META_g[] = {METAFY('g'), '\0'};
-unsigned char META_h[] = {METAFY('h'), '\0'};
-unsigned char META_i[] = {METAFY('i'), '\0'};
-unsigned char META_j[] = {METAFY('j'), '\0'};
-unsigned char META_k[] = {METAFY('k'), '\0'};
-unsigned char META_l[] = {METAFY('l'), '\0'};
-unsigned char META_m[] = {METAFY('m'), '\0'};
-unsigned char META_n[] = {METAFY('n'), '\0'};
-unsigned char META_o[] = {METAFY('o'), '\0'};
-unsigned char META_p[] = {METAFY('p'), '\0'};
-unsigned char META_q[] = {METAFY('q'), '\0'};
-unsigned char META_r[] = {METAFY('r'), '\0'};
-unsigned char META_s[] = {METAFY('s'), '\0'};
-unsigned char META_t[] = {METAFY('t'), '\0'};
-unsigned char META_u[] = {METAFY('u'), '\0'};
-unsigned char META_v[] = {METAFY('v'), '\0'};
-unsigned char META_w[] = {METAFY('w'), '\0'};
-unsigned char META_x[] = {METAFY('x'), '\0'};
-unsigned char META_y[] = {METAFY('y'), '\0'};
-unsigned char META_z[] = {METAFY('z'), '\0'};
-unsigned char META_1[] = {METAFY('1'), '\0'};
-unsigned char META_2[] = {METAFY('2'), '\0'};
-unsigned char META_3[] = {METAFY('3'), '\0'};
-unsigned char META_4[] = {METAFY('4'), '\0'};
-unsigned char META_5[] = {METAFY('5'), '\0'};
-unsigned char META_6[] = {METAFY('6'), '\0'};
-unsigned char META_7[] = {METAFY('7'), '\0'};
-unsigned char META_8[] = {METAFY('8'), '\0'};
-unsigned char META_9[] = {METAFY('9'), '\0'};
-unsigned char META_0[] = {METAFY('0'), '\0'};
-unsigned char META_DASH[] = {METAFY('-'), '\0'};
-unsigned char META_EQUAL[] = {METAFY('='), '\0'};
-unsigned char META_RET[] = {METAFY('\r'), '\0'};
-unsigned char META_TAB[] = {METAFY('\t'), '\0'};
-unsigned char META_LBROK[] = {METAFY('['), '\0'};
-unsigned char META_RBROK[] = {METAFY(']'), '\0'};
-unsigned char META_BACK[] = {METAFY('\\'), '\0'};
-unsigned char META_SEMI[] = {METAFY(';'), '\0'};
-unsigned char META_RQUOTE[] = {METAFY('\''), '\0'};
-unsigned char META_COMMA[] = {METAFY(','), '\0'};
-unsigned char META_DOT[] = {METAFY('.'), '\0'};
-unsigned char META_SLASH[] = {METAFY('/'), '\0'};
-unsigned char META_LQUOTE[] = {METAFY('`'), '\0'};
-unsigned char META_PLUS[] = {METAFY('+'), '\0'};
-
-#define DEFAULT_SCANCODE_CONVERSIONS \
-{ \
-/* 0 */ NO_CONVERSION, \
-/* 1 */ NO_CONVERSION, \
-/* 2 */ NO_CONVERSION, \
-/* 3 */ CTRL_AT, \
-/* 4 */ NO_CONVERSION, \
-/* 5 */ NO_CONVERSION, \
-/* 6 */ NO_CONVERSION, \
-/* 7 */ NO_CONVERSION, \
-/* 8 */ NO_CONVERSION, \
-/* 9 */ NO_CONVERSION, \
-/* 10 */ NO_CONVERSION, \
-/* 11 */ NO_CONVERSION, \
-/* 12 */ NO_CONVERSION, \
-/* 13 */ NO_CONVERSION, \
-/* 14 */ NO_CONVERSION, \
-/* 15 */ NO_CONVERSION, \
-/* 16 */ META_q, \
-/* 17 */ META_w, \
-/* 18 */ META_e, \
-/* 19 */ META_r, \
-/* 20 */ META_t, \
-/* 21 */ META_y, \
-/* 22 */ META_u, \
-/* 23 */ META_i, \
-/* 24 */ META_o, \
-/* 25 */ META_p, \
-/* 26 */ META_LBROK, \
-/* 27 */ META_RBROK, \
-/* 28 */ META_RET, \
-/* 29 */ NO_CONVERSION, \
-/* 30 */ META_a, \
-/* 31 */ META_s, \
-/* 32 */ META_d, \
-/* 33 */ META_f, \
-/* 34 */ META_g, \
-/* 35 */ META_h, \
-/* 36 */ META_j, \
-/* 37 */ META_k, \
-/* 38 */ META_l, \
-/* 39 */ META_SEMI, \
-/* 40 */ META_RQUOTE, \
-/* 41 */ META_LQUOTE, \
-/* 42 */ NO_CONVERSION, \
-/* 43 */ META_BACK, \
-/* 44 */ META_z, \
-/* 45 */ META_x, \
-/* 46 */ META_c, \
-/* 47 */ META_v, \
-/* 48 */ META_b, \
-/* 49 */ META_n, \
-/* 50 */ META_m, \
-/* 51 */ META_COMMA, \
-/* 52 */ META_DOT, \
-/* 53 */ META_SLASH, \
-/* 54 */ NO_CONVERSION, \
-/* 55 */ META_PLUS, \
-/* 56 */ NO_CONVERSION, \
-/* 57 */ NO_CONVERSION, \
-/* 58 */ NO_CONVERSION, \
-/* 59 */ "(proceed)\r", \
-/* 60 */ NO_CONVERSION, \
-/* 61 */ NO_CONVERSION, \
-/* 62 */ NO_CONVERSION, \
-/* 63 */ NO_CONVERSION, \
-/* 64 */ NO_CONVERSION, \
-/* 65 */ NO_CONVERSION, \
-/* 66 */ NO_CONVERSION, \
-/* 67 */ NO_CONVERSION, \
-/* 68 */ NO_CONVERSION, \
-/* 69 */ NO_CONVERSION, \
-/* 70 */ NO_CONVERSION, \
-/* 71 */ NO_CONVERSION, \
-/* 72 */ NO_CONVERSION, \
-/* 73 */ NO_CONVERSION, \
-/* 74 */ META_SLASH, \
-/* 75 */ NO_CONVERSION, \
-/* 76 */ NO_CONVERSION, \
-/* 77 */ NO_CONVERSION, \
-/* 78 */ NO_CONVERSION, \
-/* 79 */ NO_CONVERSION, \
-/* 80 */ NO_CONVERSION, \
-/* 81 */ NO_CONVERSION, \
-/* 82 */ NO_CONVERSION, \
-/* 83 */ NO_CONVERSION, \
-/* 84 */ NO_CONVERSION, \
-/* 85 */ NO_CONVERSION, \
-/* 86 */ NO_CONVERSION, \
-/* 87 */ NO_CONVERSION, \
-/* 88 */ NO_CONVERSION, \
-/* 89 */ NO_CONVERSION, \
-/* 90 */ NO_CONVERSION, \
-/* 91 */ NO_CONVERSION, \
-/* 92 */ NO_CONVERSION, \
-/* 93 */ NO_CONVERSION, \
-/* 94 */ NO_CONVERSION, \
-/* 95 */ NO_CONVERSION, \
-/* 96 */ NO_CONVERSION, \
-/* 97 */ NO_CONVERSION, \
-/* 98 */ NO_CONVERSION, \
-/* 99 */ NO_CONVERSION, \
-/* 100 */ NO_CONVERSION, \
-/* 101 */ NO_CONVERSION, \
-/* 102 */ NO_CONVERSION, \
-/* 103 */ HARD_ATTN, /* Ctrl-F10 */ \
-/* 104 */ NO_CONVERSION, \
-/* 105 */ NO_CONVERSION, \
-/* 106 */ NO_CONVERSION, \
-/* 107 */ NO_CONVERSION, \
-/* 108 */ NO_CONVERSION, \
-/* 109 */ NO_CONVERSION, \
-/* 110 */ NO_CONVERSION, \
-/* 111 */ NO_CONVERSION, \
-/* 112 */ NO_CONVERSION, \
-/* 113 */ SOFT_ATTN, /* Alt-F10 */ \
-/* 114 */ NO_CONVERSION, \
-/* 115 */ NO_CONVERSION, \
-/* 116 */ NO_CONVERSION, \
-/* 117 */ NO_CONVERSION, \
-/* 118 */ NO_CONVERSION, \
-/* 119 */ NO_CONVERSION, \
-/* 120 */ META_1, \
-/* 121 */ META_2, \
-/* 122 */ META_3, \
-/* 123 */ META_4, \
-/* 124 */ META_5, \
-/* 125 */ META_6, \
-/* 126 */ META_7, \
-/* 127 */ META_8, \
-/* 128 */ META_9, \
-/* 129 */ META_0, \
-/* 130 */ META_DASH, \
-/* 131 */ META_EQUAL, \
-/* 132 */ NO_CONVERSION, \
-/* 133 */ NO_CONVERSION, \
-/* 134 */ NO_CONVERSION, \
-/* 135 */ NO_CONVERSION, \
-/* 136 */ NO_CONVERSION, \
-/* 137 */ NO_CONVERSION, \
-/* 138 */ NO_CONVERSION, \
-/* 139 */ NO_CONVERSION, \
-/* 140 */ NO_CONVERSION, \
-/* 141 */ NO_CONVERSION, \
-/* 142 */ NO_CONVERSION, \
-/* 143 */ NO_CONVERSION, \
-/* 144 */ NO_CONVERSION, \
-/* 145 */ NO_CONVERSION, \
-/* 146 */ NO_CONVERSION, \
-/* 147 */ NO_CONVERSION, \
-/* 148 */ NO_CONVERSION, \
-/* 149 */ NO_CONVERSION, \
-/* 150 */ NO_CONVERSION, \
-/* 151 */ NO_CONVERSION, \
-/* 152 */ NO_CONVERSION, \
-/* 153 */ NO_CONVERSION, \
-/* 154 */ NO_CONVERSION, \
-/* 155 */ NO_CONVERSION, \
-/* 156 */ NO_CONVERSION, \
-/* 157 */ NO_CONVERSION, \
-/* 158 */ NO_CONVERSION, \
-/* 159 */ NO_CONVERSION, \
-/* 160 */ NO_CONVERSION, \
-/* 161 */ NO_CONVERSION, \
-/* 162 */ NO_CONVERSION, \
-/* 163 */ NO_CONVERSION, \
-/* 164 */ META_DASH, \
-/* 165 */ META_TAB, \
-/* 166 */ META_RET, \
-/* 167 */ NO_CONVERSION, \
-/* 168 */ NO_CONVERSION, \
-/* 169 */ NO_CONVERSION, \
-/* 170 */ NO_CONVERSION, \
-/* 171 */ NO_CONVERSION, \
-/* 172 */ NO_CONVERSION, \
-/* 173 */ NO_CONVERSION, \
-/* 174 */ NO_CONVERSION, \
-/* 175 */ NO_CONVERSION, \
-/* 176 */ NO_CONVERSION, \
-/* 177 */ NO_CONVERSION, \
-/* 178 */ NO_CONVERSION, \
-/* 179 */ NO_CONVERSION, \
-/* 180 */ NO_CONVERSION, \
-/* 181 */ NO_CONVERSION, \
-/* 182 */ NO_CONVERSION, \
-/* 183 */ NO_CONVERSION, \
-/* 184 */ NO_CONVERSION, \
-/* 185 */ NO_CONVERSION, \
-/* 186 */ NO_CONVERSION, \
-/* 187 */ NO_CONVERSION, \
-/* 188 */ NO_CONVERSION, \
-/* 189 */ NO_CONVERSION, \
-/* 190 */ NO_CONVERSION, \
-/* 191 */ NO_CONVERSION, \
-/* 192 */ NO_CONVERSION, \
-/* 193 */ NO_CONVERSION, \
-/* 194 */ NO_CONVERSION, \
-/* 195 */ NO_CONVERSION, \
-/* 196 */ NO_CONVERSION, \
-/* 197 */ NO_CONVERSION, \
-/* 198 */ NO_CONVERSION, \
-/* 199 */ NO_CONVERSION, \
-/* 200 */ NO_CONVERSION, \
-/* 201 */ NO_CONVERSION, \
-/* 202 */ NO_CONVERSION, \
-/* 203 */ NO_CONVERSION, \
-/* 204 */ NO_CONVERSION, \
-/* 205 */ NO_CONVERSION, \
-/* 206 */ NO_CONVERSION, \
-/* 207 */ NO_CONVERSION, \
-/* 208 */ NO_CONVERSION, \
-/* 209 */ NO_CONVERSION, \
-/* 210 */ NO_CONVERSION, \
-/* 211 */ NO_CONVERSION, \
-/* 212 */ NO_CONVERSION, \
-/* 213 */ NO_CONVERSION, \
-/* 214 */ NO_CONVERSION, \
-/* 215 */ NO_CONVERSION, \
-/* 216 */ NO_CONVERSION, \
-/* 217 */ NO_CONVERSION, \
-/* 218 */ NO_CONVERSION, \
-/* 219 */ NO_CONVERSION, \
-/* 220 */ NO_CONVERSION, \
-/* 221 */ NO_CONVERSION, \
-/* 222 */ NO_CONVERSION, \
-/* 223 */ NO_CONVERSION, \
-/* 224 */ NO_CONVERSION, \
-/* 225 */ NO_CONVERSION, \
-/* 226 */ NO_CONVERSION, \
-/* 227 */ NO_CONVERSION, \
-/* 228 */ NO_CONVERSION, \
-/* 229 */ NO_CONVERSION, \
-/* 230 */ NO_CONVERSION, \
-/* 231 */ NO_CONVERSION, \
-/* 232 */ NO_CONVERSION, \
-/* 233 */ NO_CONVERSION, \
-/* 234 */ NO_CONVERSION, \
-/* 235 */ NO_CONVERSION, \
-/* 236 */ NO_CONVERSION, \
-/* 237 */ NO_CONVERSION, \
-/* 238 */ NO_CONVERSION, \
-/* 239 */ NO_CONVERSION, \
-/* 240 */ NO_CONVERSION, \
-/* 241 */ NO_CONVERSION, \
-/* 242 */ NO_CONVERSION, \
-/* 243 */ NO_CONVERSION, \
-/* 244 */ NO_CONVERSION, \
-/* 245 */ NO_CONVERSION, \
-/* 246 */ NO_CONVERSION, \
-/* 247 */ NO_CONVERSION, \
-/* 248 */ NO_CONVERSION, \
-/* 249 */ NO_CONVERSION, \
-/* 250 */ NO_CONVERSION, \
-/* 251 */ NO_CONVERSION, \
-/* 252 */ NO_CONVERSION, \
-/* 253 */ NO_CONVERSION, \
-/* 254 */ NO_CONVERSION, \
-/* 255 */ NO_CONVERSION \
-}
-
-#define KEYBOARD_SCANCODE_TABLE_SIZE (256)
-#endif
+++ /dev/null
-/* -*-C-*-
-
-$Id: dosselec.h,v 1.3 1999/01/02 06:11:34 cph Exp $
-
-Copyright (c) 1992, 1999 Massachusetts Institute of Technology
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or (at
-your option) any later version.
-
-This program is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-#ifndef SCM_DOSSELECT_H
-#define SCM_DOSSELECT_H
-
-enum select_input
-{
- select_input_argument,
- select_input_other,
- select_input_none,
- select_input_process_status,
- select_input_interrupt
-};
-
-extern CONST int DOS_have_select_p;
-extern enum select_input EXFUN (DOS_select_input, (int fd, int blockp));
-
-#endif /* SCM_DOSSELECT_H */
+++ /dev/null
-/* -*-C-*-
-
-$Id: dossig.c,v 1.17 1999/01/02 06:11:34 cph Exp $
-
-Copyright (c) 1992-1999 Massachusetts Institute of Technology
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or (at
-your option) any later version.
-
-This program is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-#include "scheme.h"
-#include "msdos.h"
-#include <signal.h>
-#include <int.h>
-#include "ossig.h"
-#include "osctty.h"
-#include "ostty.h"
-#include "critsec.h"
-#include <bios.h>
-#include "dossys.h"
-#include "dosexcp.h"
-#include "doskbd.h"
-#ifdef USE_ZORTECH_CERROR
-#include <cerror.h>
-#endif
-
-#ifndef fileno
-#define fileno(fp) ((fp)->_file)
-#endif
-
-cc_t EXFUN (DOS_interactive_interrupt_handler, (void));
-\f
-/* Signal Manipulation */
-
-#ifdef UNUSED
-
-static Tsignal_handler
-DEFUN (current_handler, (signo), int signo)
-{
- Tsignal_handler result = (DOS_signal (signo, SIG_IGN));
- if (result != SIG_IGN)
- DOS_signal (signo, result);
- return (result);
-}
-
-#define INSTALL_HANDLER DOS_signal
-#define NEED_HANDLER_TRANSACTION
-
-#define ENTER_HANDLER(signo)
-#define ABORT_HANDLER DOS_signal
-#define EXIT_HANDLER DOS_signal
-
-#endif /* UNUSED */
-
-/* These could be implemented, at least under DPMI by examining
- and setting the virtual interrupt state.
- */
-
-void
-DEFUN_VOID (preserve_signal_mask)
-{
- return;
-}
-
-void
-DEFUN_VOID (block_signals)
-{
- return;
-}
-
-void
-DEFUN_VOID (unblock_signals)
-{
- return;
-}
-\f
-#ifdef UNUSED
-/* Signal Descriptors */
-
-enum dfl_action { dfl_terminate, dfl_ignore, dfl_stop };
-
-struct signal_descriptor
-{
- int signo;
- CONST char * name;
- enum dfl_action action;
- int flags;
-};
-
-/* `flags' bits */
-#define NOIGNORE 1
-#define NOBLOCK 2
-#define NOCATCH 4
-#define CORE_DUMP 8
-
-static struct signal_descriptor * signal_descriptors;
-static unsigned int signal_descriptors_length;
-static unsigned int signal_descriptors_limit;
-
-static void
-DEFUN (defsignal, (signo, name, action, flags),
- int signo AND
- CONST char * name AND
- enum dfl_action action AND
- int flags)
-{
- if (signo == 0)
- return;
- if (signal_descriptors_length == signal_descriptors_limit)
- {
- signal_descriptors_limit += 8;
- signal_descriptors =
- (DOS_realloc (signal_descriptors,
- (signal_descriptors_limit *
- (sizeof (struct signal_descriptor)))));
- if (signal_descriptors == 0)
- {
- fprintf (stderr, "\nUnable to grow signal definitions table.\n");
- fflush (stderr);
- termination_init_error ();
- }
- }
- {
- struct signal_descriptor * sd =
- (signal_descriptors + (signal_descriptors_length++));
- (sd -> signo) = signo;
- (sd -> name) = name;
- (sd -> action) = action;
- (sd -> flags) = flags;
- }
-}
-
-static struct signal_descriptor *
-DEFUN (find_signal_descriptor, (signo), int signo)
-{
- struct signal_descriptor * scan = signal_descriptors;
- struct signal_descriptor * end = (scan + signal_descriptors_length);
- for (; (scan < end); scan += 1)
- if ((scan -> signo) == signo)
- return (scan);
- return (0);
-}
-
-CONST char *
-DEFUN (find_signal_name, (signo), int signo)
-{
- static char buffer [32];
- struct signal_descriptor * descriptor = (find_signal_descriptor (signo));
- if (descriptor != 0)
- return (descriptor -> name);
- sprintf (buffer, "unknown signal %d", signo);
- return ((CONST char *) buffer);
-}
-\f
-#define OS_SPECIFIC_SIGNALS()
-
-#if (SIGABRT == SIGIOT)
-#undef SIGABRT
-#define SIGABRT 0
-#endif
-
-static void
-DEFUN_VOID (initialize_signal_descriptors)
-{
- signal_descriptors_length = 0;
- signal_descriptors_limit = 32;
- signal_descriptors =
- (DOS_malloc (signal_descriptors_limit *
- (sizeof (struct signal_descriptor))));
- if (signal_descriptors == 0)
- {
- fprintf (stderr, "\nUnable to allocate signal definitions table.\n");
- fflush (stderr);
- termination_init_error ();
- }
-
- defsignal (SIGINT, "SIGINT", dfl_terminate, 0);
- defsignal (SIGILL, "SIGILL", dfl_terminate, CORE_DUMP);
- defsignal (SIGFPE, "SIGFPE", dfl_terminate, CORE_DUMP);
- defsignal (SIGSEGV, "SIGSEGV", dfl_terminate, CORE_DUMP);
- defsignal (SIGTERM, "SIGTERM", dfl_terminate, 0);
- defsignal (SIGABRT, "SIGABRT", dfl_terminate, CORE_DUMP);
-
- OS_SPECIFIC_SIGNALS ();
-}
-\f
-/* Signal Handlers */
-
-struct handler_record
-{
- int signo;
- Tsignal_handler handler;
-};
-
-#define DEFUN_STD_HANDLER(name, statement) \
-static Tsignal_handler_result \
-DEFUN (name, (signo), int signo) \
-{ \
- int STD_HANDLER_abortp; \
- ENTER_HANDLER (signo); \
- STD_HANDLER_abortp = (enter_interruption_extent ()); \
- transaction_begin (); \
- { \
- struct handler_record * record = \
- (dstack_alloc (sizeof (struct handler_record))); \
- (record -> signo) = signo; \
- (record -> handler) = 0; \
- transaction_record_action (tat_abort, ta_abort_handler, record); \
- } \
- statement; \
- if (STD_HANDLER_abortp) \
- { \
- transaction_abort (); \
- exit_interruption_extent (); \
- } \
- transaction_commit (); \
- EXIT_HANDLER (signo, name); \
- SIGNAL_HANDLER_RETURN (); \
-}
-
-static void
-DEFUN (ta_abort_handler, (ap), PTR ap)
-{
- ABORT_HANDLER ((((struct handler_record *) ap) -> signo),
- (((struct handler_record *) ap) -> handler));
-}
-#endif /* UNUSED */
-\f
-#define CONTROL_B_INTERRUPT_CHAR 'B'
-#define CONTROL_G_INTERRUPT_CHAR 'G'
-#define CONTROL_U_INTERRUPT_CHAR 'U'
-#define CONTROL_X_INTERRUPT_CHAR 'X'
-#define INTERACTIVE_INTERRUPT_CHAR '!'
-#define TERMINATE_INTERRUPT_CHAR '@'
-#define NO_INTERRUPT_CHAR '0'
-
-#ifdef UNUSED
-static void
-DEFUN (echo_keyboard_interrupt, (c, dc), cc_t c AND cc_t dc)
-{
- c &= 0177;
- if (c == ALERT_CHAR)
- putc (c, stdout);
- else if (c < '\040')
- {
- putc ('^', stdout);
- putc ((c + '@'), stdout);
- }
- else if (c == '\177')
- fputs ("^?", stdout);
- else
- putc (c, stdout);
- fflush (stdout);
-}
-
-DEFUN_STD_HANDLER (sighnd_control_g,
- {
- tty_set_next_interrupt_char (CONTROL_G_INTERRUPT_CHAR);
- })
-
-DEFUN_STD_HANDLER (sighnd_control_c,
- {
- cc_t int_char;
-
- int_char = (DOS_interactive_interrupt_handler ());
- if (int_char != ((cc_t) 0))
- tty_set_next_interrupt_char (int_char);
- })
-
-#endif /* UNUSED */
-
-/* Keyboard interrupt */
-
-#define KB_INT_TABLE_SIZE ((256) + 1)
-
-#define CONTROL_BREAK '\0' /* A lie. */
-#define CONTROL_B '\002'
-#define CONTROL_C '\003'
-#define CONTROL_G '\007'
-#define CONTROL_U '\025'
-#define CONTROL_X '\030'
-
-#define CONTROL_B_ENABLE (0x1)
-#define CONTROL_G_ENABLE (0x2)
-#define CONTROL_U_ENABLE (0x4)
-#define CONTROL_X_ENABLE (0x8)
-#define INTERACTIVE_INTERRUPT_ENABLE (0x10)
-#define TERMINATE_INTERRUPT_ENABLE (0x20)
-
-/* This is a table and also a null terminated string. */
-unsigned char keyboard_interrupt_table[KB_INT_TABLE_SIZE];
-static unsigned char keyboard_interrupt_enables;
-
-void
-DEFUN (OS_ctty_get_interrupt_enables, (mask), Tinterrupt_enables * mask)
-{
- *mask = ((Tinterrupt_enables) keyboard_interrupt_enables);
- return;
-}
-
-void
-DEFUN (OS_ctty_set_interrupt_enables, (mask), Tinterrupt_enables * mask)
-{
- /* Kludge: ctl-break always enabled. */
- keyboard_interrupt_enables = (((unsigned char) (*mask))
- | TERMINATE_INTERRUPT_ENABLE);
- return;
-}
-\f
-/* This is a temporary kludge. */
-
-#define NUM_INT_CHANNELS 6
-static cc_t int_chars[NUM_INT_CHANNELS];
-static cc_t int_handlers[NUM_INT_CHANNELS];
-
-static void
-DEFUN_VOID (update_interrupt_characters)
-{
- int i;
-
- for (i = 0; i < KB_INT_TABLE_SIZE; i++)
- keyboard_interrupt_table[i] = NO_INTERRUPT_CHAR;
-
- for (i = 0; i < NUM_INT_CHANNELS; i++)
- {
- unsigned char handler;
-
- switch (int_handlers[i])
- {
- case interrupt_handler_control_b:
- handler = CONTROL_B_INTERRUPT_CHAR;
- break;
-
- case interrupt_handler_control_g:
- handler = CONTROL_G_INTERRUPT_CHAR;
- break;
-
- case interrupt_handler_control_u:
- handler = CONTROL_U_INTERRUPT_CHAR;
- break;
-
- case interrupt_handler_control_x:
- handler = CONTROL_X_INTERRUPT_CHAR;
- break;
-
- case interrupt_handler_interactive:
- handler = INTERACTIVE_INTERRUPT_CHAR;
- break;
-
- case interrupt_handler_terminate:
- handler = TERMINATE_INTERRUPT_CHAR;
- break;
-
- default:
- handler = NO_INTERRUPT_CHAR;
- break;
- }
- keyboard_interrupt_table[(int) (int_chars[i])] = handler;
- }
- return;
-}
-\f
-unsigned int
-DEFUN_VOID (OS_ctty_num_int_chars)
-{
- return (NUM_INT_CHANNELS);
-}
-
-cc_t *
-DEFUN_VOID (OS_ctty_get_int_chars)
-{
- return (&int_chars[0]);
-}
-
-void
-DEFUN (OS_ctty_set_int_chars, (new_int_chars), cc_t * new_int_chars)
-{
- int i;
-
- for (i = 0; i < NUM_INT_CHANNELS; i++)
- int_chars[i] = new_int_chars[i];
- update_interrupt_characters ();
- return;
-}
-
-cc_t *
-DEFUN_VOID (OS_ctty_get_int_char_handlers)
-{
- return (&int_handlers[0]);
-}
-
-void
-DEFUN (OS_ctty_set_int_char_handlers, (new_int_handlers),
- cc_t * new_int_handlers)
-{
- int i;
-
- for (i = 0; i < NUM_INT_CHANNELS; i++)
- int_handlers[i] = new_int_handlers[i];
- update_interrupt_characters ();
- return;
-}
-
-extern long EXFUN (text_write, (int, CONST unsigned char *, size_t));
-
-static void
-DEFUN (console_write_string, (string), unsigned char * string)
-{
- (void) text_write ((fileno (stdout)), string, (strlen (string)));
- return;
-}
-
-static void
-DEFUN (console_write_character, (c), unsigned char c)
-{
- (void) text_write ((fileno (stdout)), &c, 1);
- return;
-}
-
-static unsigned char
-DEFUN_VOID (console_read_character)
-{
- unsigned char c;
- extern int EXFUN (dos_read, (int, PTR, size_t, int, int, int));
-
- /* non-buffered, blocking, non-interrupting read. */
- (void) dos_read ((fileno (stdin)), &c, 1, 0, 1, 0);
- return (c);
-}
-\f
-void
-DEFUN_VOID (initialize_keyboard_interrupt_table)
-{
- /* Set up default interrupt characters */
- int_chars[0] = CONTROL_B;
- int_handlers[0] = ((unsigned char) interrupt_handler_control_b);
- int_chars[1] = CONTROL_G;
- int_handlers[1] = ((unsigned char) interrupt_handler_control_g);
- int_chars[2] = CONTROL_U;
- int_handlers[2] = ((unsigned char) interrupt_handler_control_u);
- int_chars[3] = CONTROL_X;
- int_handlers[3] = ((unsigned char) interrupt_handler_control_x);
- int_chars[4] = CONTROL_C;
- int_handlers[4] = ((unsigned char) interrupt_handler_interactive);
- int_chars[5] = CONTROL_BREAK;
- int_handlers[5] = ((unsigned char) interrupt_handler_terminate);
- update_interrupt_characters ();
- keyboard_interrupt_enables =
- (CONTROL_B_ENABLE | CONTROL_G_ENABLE
- | CONTROL_U_ENABLE | CONTROL_X_ENABLE
- | INTERACTIVE_INTERRUPT_ENABLE
- | TERMINATE_INTERRUPT_ENABLE);
- return;
-}
-
-static int hard_attn_limit = 2;
-static int hard_attn_counter = 0;
-
-cc_t
-DEFUN (OS_tty_map_interrupt_char, (int_char), cc_t int_char)
-{
- /* Scheme got a keyboard interrupt, reset the hard attention counter. */
- hard_attn_counter = 0;
- return (int_char);
-}
-
-static void
-DEFUN_VOID (print_interrupt_help)
-{
- console_write_string ("\nInterrupt Choices are:\n");
- console_write_string ("C-G interrupt: G, g, ^G (abort to top level)\n");
- console_write_string ("C-X interrupt: X, x, ^x (abort)\n");
- console_write_string ("C-B interrupt: B, b, ^B (break)\n");
- console_write_string ("C-U interrupt: U, u, ^U (up)\n");
- console_write_string ("Ignore interrupt: I, i (dismiss)\n");
- console_write_string ("Reset scheme: R, r (hard reset)\n");
- console_write_string ("Quit scheme: Q, q (exit)\n");
- console_write_string ("Print help: ?");
- return;
-}
-
-#define REQUEST_INTERRUPT_IF_ENABLED(mask) do \
-{ \
- if (keyboard_interrupt_enables & (mask)) \
- { \
- tty_set_next_interrupt_char (interrupt_char); \
- interrupt_p = 1; \
- } \
- else \
- interrupt_p = 0; \
-} while (0)
-\f
-int EXFUN (signal_keyboard_character_interrupt, (int));
-
-int
-DEFUN (signal_keyboard_character_interrupt, (c), int c)
-{
- if (c == -1)
- {
- if (keyboard_interrupt_enables & TERMINATE_INTERRUPT_ENABLE)
- goto interactive_interrupt;
- else
- return (0);
- }
- if (c == -2)
- {
- /* Special kludge for hard attn. */
- if (keyboard_interrupt_enables & TERMINATE_INTERRUPT_ENABLE)
- {
- hard_attn_counter += 1;
- if (hard_attn_counter >= hard_attn_limit)
- {
- console_write_string ("\nTerminating scheme!");
- termination_normal (0);
- }
- goto interactive_interrupt;
- }
- return (0);
- }
- else if ((c >= 0) && (c < KB_INT_TABLE_SIZE))
- {
- int interrupt_p, interrupt_char;
-
- interrupt_char = keyboard_interrupt_table[c];
-
- switch (interrupt_char)
- {
- case CONTROL_B_INTERRUPT_CHAR:
- REQUEST_INTERRUPT_IF_ENABLED (CONTROL_B_ENABLE);
- break;
-
- case CONTROL_G_INTERRUPT_CHAR:
- REQUEST_INTERRUPT_IF_ENABLED (CONTROL_G_ENABLE);
- break;
-
- case CONTROL_U_INTERRUPT_CHAR:
- REQUEST_INTERRUPT_IF_ENABLED (CONTROL_U_ENABLE);
- break;
-
- case CONTROL_X_INTERRUPT_CHAR:
- REQUEST_INTERRUPT_IF_ENABLED (CONTROL_X_ENABLE);
- break;
-
- case INTERACTIVE_INTERRUPT_CHAR:
- if (! (keyboard_interrupt_enables & INTERACTIVE_INTERRUPT_ENABLE))
- {
- interrupt_p = 0;
- break;
- }
-interactive_interrupt:
- {
- cc_t int_char;
-
- int_char = (DOS_interactive_interrupt_handler ());
- if (int_char == ((cc_t) 0))
- hard_attn_counter = 0;
- else
- {
- tty_set_next_interrupt_char ((int) int_char);
- interrupt_p = 1;
- }
- }
- break;
-
- default:
- interrupt_p = 0;
- }
- return (interrupt_p);
- }
- return (0);
-}
-\f
-cc_t
-DEFUN_VOID (DOS_interactive_interrupt_handler)
-{
- while (1)
- {
- unsigned char response;
-
- console_write_string
- ("\nKeyboard interrupt, type character (? for help): ");
-
- response = (console_read_character ());
- console_write_character (response);
-
- switch (response)
- {
- case 'b':
- case 'B':
- case CONTROL_B:
- return CONTROL_B_INTERRUPT_CHAR;
-
- case 'g':
- case 'G':
- case CONTROL_G:
- return CONTROL_G_INTERRUPT_CHAR;
-
- case 'i':
- case 'I':
- return ((cc_t) 0);
-
- case 'R':
- case 'r':
- {
- extern void EXFUN (soft_reset, (void));
- soft_reset ();
- /*NOTREACHED*/
- }
-
- case 'q':
- case 'Q':
- {
- console_write_string ("\nTerminate scheme (y or n)? ");
- response = (console_read_character ());
- console_write_character (response);
- if ((response == 'y') || (response == 'Y'))
- {
- console_write_string ("\n");
- termination_normal (0);
- }
- print_interrupt_help ();
- break;
- }
-
- case 'u':
- case 'U':
- case CONTROL_U:
- return CONTROL_U_INTERRUPT_CHAR;
-
- case 'x':
- case 'X':
- case CONTROL_X:
- return CONTROL_X_INTERRUPT_CHAR;
-
- case '?':
- print_interrupt_help ();
- break;
-
- default:
- {
- unsigned char temp[128];
-
- sprintf (temp, "\nIllegal interrupt character: [%c]", response);
- console_write_string (temp);
- print_interrupt_help ();
- break;
- }
- }
- }
-}
-\f
-void
-DEFUN_VOID (OS_restartable_exit)
-{
- extern int EXFUN (X32_suspend, (void));
-
- if ((X32_suspend ()) < 0)
- error_external_return ();
- return;
-}
-
-#ifdef UNUSED
-
-#define IF_POSIX_SIGNALS(code) do {} while (0)
-
-DEFUN_STD_HANDLER (sighnd_stop, {})
-
-#ifdef HAVE_ITIMER
-
-DEFUN_STD_HANDLER (sighnd_timer,
- {
- request_timer_interrupt ();
- })
-
-#else /* not HAVE_ITIMER */
-
-extern void EXFUN (reschedule_alarm, (void));
-
-DEFUN_STD_HANDLER (sighnd_timer,
- {
- /* reschedule_alarm ();
- request_timer_interrupt ();
- */
- })
-
-#endif /* HAVE_ITIMER */
-\f
-DEFUN_STD_HANDLER (sighnd_save_then_terminate,
- (request_suspend_interrupt ()))
-
-#ifndef SIGNUP
-#define SIGHUP 999
-#endif
-
-DEFUN_STD_HANDLER (sighnd_terminate,
- (termination_signal
- ((! (option_emacs_subprocess && (signo == SIGHUP)))
- ? (find_signal_name (signo))
- : 0)))
-
-#define VOID ((struct sigcontext *) 0)
-
-DEFUN_STD_HANDLER (sighnd_fpe,
- {
- if (executing_scheme_primitive_p ())
- error_floating_point_exception ();
- trap_handler ("floating-point exception signal", signo, VOID, VOID);
- })
-
-DEFUN_STD_HANDLER (sighnd_hardware_trap,
- (trap_handler ("hardware fault signal", signo, VOID, VOID)))
-
-DEFUN_STD_HANDLER (sighnd_software_trap,
- (trap_handler ("system software fault signal", signo, VOID, VOID)))
-
-
-/* When a child process terminates, it becomes a zombie until its
- parent process calls one of the wait() routines to obtain the
- child's termination status. The SIGCHLD handler must always call
- wait() or waitpid() to permit the child process's resources to be
- freed. */
-
-/* On systems with waitpid() (i.e. those that support WNOHANG) we must
- loop until there are no more processes, because some of those
- systems may deliver only one SIGCHLD when more than one child
- terminates. Systems without waitpid() (e.g. _SYSV) typically
- provide queuing of SIGCHLD such that one SIGCHLD is delivered for
- every child that terminates. Systems that provide neither
- waitpid() nor queuing are so losing that we can't win, in which
- case we just hope that child terminations don't happen too close to
- one another to cause problems. */
-
-DEFUN_STD_HANDLER (sighnd_dead_subprocess,
- {
- })
-#endif /* UNUSED */
-\f
-/* PC specific low-level interrupt hooks. */
-/* Control-Break Interrupt. */
-
-int
-DEFUN (control_break_handler, (pd), struct INT_DATA * pd)
-{
- tty_set_next_interrupt_char (CONTROL_G_INTERRUPT_CHAR);
- return (INTERRUPT_RETURN);
-}
-
-/* Critical-Error (abort, retry, ignore, fail) handler */
-
-#define CE_CAN_ERROR_BIT 0x1000
-#define CE_CAN_RETRY_BIT 0x0800
-#define CE_CAN_IGNORE_BIT 0x0400
-
-#define CE_IGNORE 0
-#define CE_RETRY 1
-#define CE_KILL 2
-#define CE_ERROR 3
-
-int
-ce_handler (int * ax, int * di)
-{
- if (((* ax) & CE_CAN_ERROR_BIT) != 0)
- * ax = (((* ax) & 0xff00) | CE_ERROR);
-
- else if (((* ax) & CE_CAN_IGNORE_BIT) != 0)
- * ax = (((* ax) & 0xff00) | CE_IGNORE);
-
- else if (((* ax) & CE_CAN_RETRY_BIT) != 0)
- * ax = (((* ax) & 0xff00) | CE_RETRY);
-
- else
- /* We should really kill Scheme,
- but there may be no way to do this from here.
- */
- * ax = (((* ax) & 0xff00) | CE_KILL);
-
- return (1);
-}
-
-#ifdef USE_ZORTECH_CERROR
-
-int _far _cdecl
-critical_error_handler (int * ax, int * di)
-{
- return (ce_handler (ax, di));
-}
-
-#else /* not USE_ZORTECH_CERROR */
-
-int
-DEFUN (critical_error_handler, (pd), struct INT_DATA * pd)
-{
- int value = (ce_handler (&pd->regs.e.eax, &pd->regs.e.edi));
- return ((value == 1) ? INTERRUPT_RETURN : INTERRUPT_CHAIN_NEXT);
-}
-
-#endif /* USE_ZORTECH_CERROR */
-\f
-/* Interval timer */
-
-/* Scheme timer emulation; DOS does not have an ITIMER like unix. */
-/* Zero means timer is not set or has expired. */
-
-extern unsigned long scm_itimer_counter;
-extern unsigned long scm_itimer_reload;
-
-unsigned long scm_itimer_counter = 0;
-unsigned long scm_itimer_reload = 0;
-
-extern void EXFUN (dos_process_timer_interrupt, (void));
-
-void
-DEFUN_VOID (dos_process_timer_interrupt)
-{
- if (scm_itimer_counter != 0)
- {
- if (--scm_itimer_counter == 0)
- {
- scm_itimer_counter = scm_itimer_reload;
- request_timer_interrupt ();
- }
- }
- return;
-}
-
-extern int EXFUN (bios_timer_handler, (struct INT_DATA *));
-
-int
-DEFUN (bios_timer_handler, (pd), struct INT_DATA *pd)
-{
-#if 0
- dos_process_timer_interrupt ();
-#else
- /* This is a kludge for DOS.
- Reuse INT_Global_GC as a high-priority interrupt from
- which the keyboard interrupt and real timer interrupt are
- derived.
- */
- REQUEST_INTERRUPT (INT_Global_GC);
-#endif
- return (INTERRUPT_CHAIN_NEXT);
-}
-\f
-static Boolean
- dos_interrupts_initialized_p = false,
- ctrl_c_check_flag = true;
-
-dos_boolean DOS_keyboard_intercepted_p = false;
-
-#define NUM_DOS_INTVECT (MAX_DOS_INTVECT + 1)
-#define NUM_DOS_HANDLERS (NUM_DOS_INTVECT + NUM_DOS_EXCP)
-static int EXFUN ((* (dos_interrupt_restoration[NUM_DOS_HANDLERS])),
- (unsigned));
-
-static void
-DEFUN (dos_record_interrupt_interception, (intno, restorer),
- unsigned intno AND int ((*restorer) (unsigned)))
-{
- dos_interrupt_restoration[intno] = restorer;
- return;
-}
-
-static int
-DEFUN (scm_int_restore, (iv), unsigned iv)
-{
- int_restore (iv);
- return (DOS_SUCCESS); /* A big lie. */
-}
-
-static int
-DEFUN (scm_int_intercept, (iv, proc, stack),
- unsigned iv AND int (*proc)(struct INT_DATA *) AND unsigned stack)
-{
- if ((int_intercept (iv, proc, stack)) != 0)
- return (DOS_FAILURE);
-
- dos_record_interrupt_interception (iv, scm_int_restore);
- return (DOS_SUCCESS);
-}
-
-static void
-DEFUN_VOID (DOS_initialize_interrupts)
-{
- int iv;
-
-#ifdef USE_ZORTECH_CERROR
- _cerror_handler = ((int _far _cdecl (*) (int *, int *)) NULL);
-#endif
-
- ctrl_c_check_flag = (dos_set_ctrl_c_check_flag (0));
-
- for (iv = (NUM_DOS_HANDLERS - 1); iv >= 0; iv--)
- dos_interrupt_restoration[iv] = ((int (*) (unsigned)) NULL);
-
- dos_interrupts_initialized_p = true;
- return;
-}
-\f
-extern int EXFUN (DPMI_free_scheme_stack, (unsigned short));
-extern int EXFUN (DPMI_alloc_scheme_stack,
- (unsigned short *, unsigned short *, unsigned long));
-
-extern unsigned short Scheme_Stack_Segment_Selector;
-extern unsigned short scheme_ss, scheme_ds;
-unsigned short scheme_ds = 0;
-unsigned short scheme_ss = 0;
-
-static char i386_exceptions_to_handle[] =
-{
- DOS_EXCP_Stack_exception, /* Must be first */
- DOS_EXCP_Integer_divide_by_zero,
- DOS_EXCP_Debug_exception,
- DOS_EXCP_Breakpoint,
- DOS_EXCP_Integer_overflow,
- DOS_EXCP_Bounds_check,
- DOS_EXCP_Invalid_opcode,
- DOS_EXCP_Numeric_co_processor_not_available,
- DOS_EXCP_Numeric_co_processor_segment_overrun,
- DOS_EXCP_Invalid_TSS,
- DOS_EXCP_Segment_not_present,
- DOS_EXCP_General_protection,
- DOS_EXCP_Page_Fault,
- DOS_EXCP_Floating_point_exception,
- DOS_EXCP_Alignment_check,
- DOS_INVALID_TRAP
-};
-
-static short old_excp_handler_cs[NUM_DOS_EXCP];
-static unsigned old_excp_handler_eip[NUM_DOS_EXCP];
-static void * stack_exception_fault_stack = ((void *) NULL);
-
-#define STACK_EXCEPTION_STACK_SIZE 2048
-
-static int
-DEFUN (restore_exception_handler, (iv, restore),
- unsigned iv
- AND int EXFUN ((* restore), (unsigned, unsigned short, unsigned)))
-{
- unsigned excp = (iv - NUM_DOS_INTVECT);
-
- if (((* restore) (excp,
- old_excp_handler_cs[excp],
- old_excp_handler_eip[excp]))
- != DOS_SUCCESS)
- return (DOS_FAILURE);
- if (excp == DOS_EXCP_Stack_exception)
- {
- if (scheme_ss != 0)
- {
- Scheme_Stack_Segment_Selector = scheme_ds;
- DPMI_free_scheme_stack (scheme_ss);
- }
- free (stack_exception_fault_stack);
- stack_exception_fault_stack = ((void *) NULL);
- }
- return (DOS_SUCCESS);
-}
-
-/* The following two procedures would not be here if C had lambda */
-
-static int
-DEFUN (DPMI_restore_handler, (iv), unsigned iv)
-{
- return (restore_exception_handler (iv, DPMI_restore_exception_handler));
-}
-
-static int
-DEFUN (X32_restore_handler, (iv), unsigned iv)
-{
- return (restore_exception_handler (iv, X32_restore_exception_handler));
-}
-\f
-static void
-DEFUN (exception_handler, (trapno, trapcode, scp),
- unsigned trapno AND unsigned trapcode AND struct sigcontext * scp)
-{
- trap_handler ("hardware exception", ((int) trapno), trapcode, scp);
- /*NOTREACHED*/
-}
-
-static void
-DEFUN (DPMI_stack_fault_handler, (trapno, trapcode, scp),
- unsigned trapno AND unsigned trapcode AND struct sigcontext * scp)
-{
- Scheme_Stack_Segment_Selector = scheme_ds;
- if (((scp->sc_ss & 0xffff) == scheme_ss)
- && (scp->sc_esp < (((unsigned long) Stack_Guard) + 0x1000)))
- {
- scp->sc_ss = scheme_ds;
- REQUEST_INTERRUPT (INT_Stack_Overflow);
- return;
- }
- trap_handler ("hardware exception", ((int) trapno), trapcode, scp);
- /*NOTREACHED*/
-}
-
-extern void EXFUN (dos386_stack_reset, (void));
-
-void
-DEFUN_VOID (dos386_stack_reset)
-{
- if (scheme_ss != 0)
- Scheme_Stack_Segment_Selector = scheme_ss;
- return;
-}
-
-static void
-DEFUN (install_exception_handlers, (get_vector, set_handler, restore),
- int EXFUN ((* get_vector),
- (unsigned, unsigned short *, unsigned *))
- AND int EXFUN ((* set_handler),
- (unsigned,
- void EXFUN ((*),
- (unsigned,
- unsigned,
- struct sigcontext *)),
- void *))
- AND int EXFUN ((* restore), (unsigned)))
-{
- int i;
- char * normal_stack = ((char *) NULL);
-\f
- for (i = 0; dos_true ; i++)
- {
- int excp = ((int) i386_exceptions_to_handle[i]);
-
- if (excp == DOS_INVALID_TRAP)
- break;
- if (((* get_vector) (((unsigned) excp),
- & old_excp_handler_cs[excp],
- & old_excp_handler_eip[excp]))
- != DOS_SUCCESS)
- continue;
- if (excp == DOS_EXCP_Stack_exception)
- {
- void EXFUN ((* handler), (unsigned, unsigned, struct sigcontext *));
- char * stack;
-
- stack = ((char *) (malloc (2 * STACK_EXCEPTION_STACK_SIZE)));
- if (stack == ((char *) NULL))
- continue;
- handler = exception_handler;
- if ((under_DPMI_p ())
- && (enable_DPMI_exceptions_p ())
- && ((DPMI_alloc_scheme_stack (&scheme_ds, &scheme_ss,
- ((unsigned long) Stack_Guard)))
- == DOS_SUCCESS))
- {
- Scheme_Stack_Segment_Selector = scheme_ss;
- handler = DPMI_stack_fault_handler;
- normal_stack = (stack + STACK_EXCEPTION_STACK_SIZE);
- }
- if (((* set_handler) (((unsigned) excp),
- handler,
- ((void *) (stack + STACK_EXCEPTION_STACK_SIZE))))
- != DOS_SUCCESS)
- {
- normal_stack = ((char *) NULL);
- free (stack);
- if (handler != exception_handler)
- {
- Scheme_Stack_Segment_Selector = scheme_ds;
- DPMI_free_scheme_stack (scheme_ss);
- scheme_ss = 0;
- }
- continue;
- }
- stack_exception_fault_stack = ((void *) stack);
- }
- else if (((* set_handler) (((unsigned) excp),
- exception_handler,
- ((void *) normal_stack)))
- != DOS_SUCCESS)
- continue;
- dos_record_interrupt_interception ((excp + NUM_DOS_INTVECT), restore);
- }
- return;
-}
-\f
-/* No lambda! foo. */
-
-static int
-DEFUN (DOS_restore_keyboard, (intno), unsigned intno)
-{
- if ((dos_restore_kbd_hook ()) != DOS_SUCCESS)
- return (DOS_FAILURE);
- DOS_keyboard_intercepted_p = false;
- return (DOS_SUCCESS);
-}
-
-/* This defaults to true. */
-
-static dos_boolean
-DEFUN (feature_enabled_p, (symbol), char * symbol)
-{
- extern int strcmp_ci (char *, char *);
- char * envvar = (DOS_getenv (symbol));
-
- if ((envvar == NULL)
- || ((strcmp_ci (envvar, "true")) == 0)
- || ((strcmp_ci (envvar, "yes")) == 0))
- return (dos_true);
- else
- return (dos_false);
-}
-
-static dos_boolean
-DEFUN_VOID (enable_DPMI_exceptions_p)
-{
- return (feature_enabled_p ("MITSCHEME_DPMI_EXCEPTIONS"));
-}
-
-static dos_boolean
-DEFUN_VOID (enable_X32_exceptions_p)
-{
- return (feature_enabled_p ("MITSCHEME_X32_EXCEPTIONS"));
-}
-\f
-static void
-DEFUN_VOID (DOS_install_interrupts)
-{
- extern dos_boolean EXFUN (under_X32_p, (void));
- dos_boolean x32_p = (under_X32_p ());
- dos_boolean dpmi_p = (under_DPMI_p ());
-
- if (x32_p && (feature_enabled_p ("MITSCHEME_X32_INTERRUPTS")))
- {
- extern void EXFUN (X32_asm_initialize, (void));
- extern int EXFUN (X32_lock_scheme_microcode, (void));
- extern int EXFUN (X32_interrupt_restore, (unsigned));
- extern int EXFUN (X32_int_intercept, (unsigned, void (*) (), PTR));
- extern void EXFUN (X32_timer_interrupt, (void));
- extern void EXFUN (X32_critical_error, (void));
- extern int X32_timer_interrupt_previous;
- extern int X32_critical_error_previous;
-
- X32_asm_initialize ();
-
- if ((X32_lock_scheme_microcode ()) != 0)
- {
- fprintf (stderr,
- "\n;; DOS_install_interrupts (X32): Unable to lock memory.");
- fprintf (stderr,
- "\n;; Interrupt and exceptions handlers not available!\n");
- fflush (stderr);
- return;
- }
-
- if ((X32_int_intercept (DOS_INTVECT_USER_TIMER_TICK,
- X32_timer_interrupt,
- ((PTR) &X32_timer_interrupt_previous)))
- != 0)
- {
- fprintf (stderr,
- "\n;; DOS_install_interrupts (X32): Unable to intercept.");
- fprintf (stderr,
- "\n;; Timer interrupt not available!\n");
- fflush (stderr);
- }
- else
- dos_record_interrupt_interception (DOS_INTVECT_USER_TIMER_TICK,
- X32_interrupt_restore);
-
- if (!dpmi_p)
- {
-#ifdef USE_ZORTECH_CERROR
- _cerror_handler = critical_error_handler;
- cerror_open ();
-#else /* not USE_ZORTECH_CERROR */
- if ((X32_int_intercept (DOS_INTVECT_CRITICAL_ERROR,
- X32_critical_error,
- ((PTR) &X32_critical_error_previous)))
- == 0)
- dos_record_interrupt_interception (DOS_INTVECT_CRITICAL_ERROR,
- X32_interrupt_restore);
-
-#endif /* USE_ZORTECH_CERROR */
- }
- }
-\f
- else if (feature_enabled_p ("MITSCHEME_DOSX_INTERRUPTS"))
- {
- scm_int_intercept (DOS_INTVECT_USER_TIMER_TICK,
- bios_timer_handler,
- 256);
-
- if (!dpmi_p)
- {
- scm_int_intercept (DOS_INTVECT_KB_CTRL_BREAK,
- control_break_handler,
- 256);
-
-#ifdef USE_ZORTECH_CERROR
- _cerror_handler = critical_error_handler;
- cerror_open ();
-#else /* not USE_ZORTECH_CERROR */
- scm_int_intercept (DOS_INTVECT_CRITICAL_ERROR,
- critical_error_handler,
- 256);
-#endif /* USE_ZORTECH_CERROR */
- }
- }
-
- if ((dos_install_kbd_hook ()) == DOS_SUCCESS)
- {
- dos_record_interrupt_interception (DOS_INTVECT_SYSTEM_SERVICES,
- DOS_restore_keyboard);
- DOS_keyboard_intercepted_p = true;
- }
-
- if (dpmi_p && (enable_DPMI_exceptions_p ()))
- install_exception_handlers (DPMI_get_exception_vector,
- DPMI_set_exception_handler,
- DPMI_restore_handler);
- else if (x32_p && (enable_X32_exceptions_p ()))
- install_exception_handlers (X32_get_exception_vector,
- X32_set_exception_handler,
- X32_restore_handler);
-
- return;
-}
-
-void
-DEFUN_VOID (DOS_restore_interrupts)
-{
- int iv;
-
- if (dos_interrupts_initialized_p)
- {
- for (iv = (NUM_DOS_HANDLERS - 1); iv >= 0; iv--)
- if ((dos_interrupt_restoration[iv]) != ((int (*) (unsigned)) NULL))
- {
- (void) ((dos_interrupt_restoration[iv]) (iv));
- dos_interrupt_restoration[iv] = ((int (*) (unsigned)) NULL);
- }
-
-#ifdef USE_ZORTECH_CERROR
- if (_cerror_handler == critical_error_handler)
- {
- cerror_close ();
- _cerror_handler = ((int _far _cdecl (*) (int *, int *)) NULL);
- }
-#endif /* USE_ZORTECH_CERROR */
-
- dos_interrupts_initialized_p = false;
- }
- dos_set_ctrl_c_check_flag (ctrl_c_check_flag);
- return;
-}
-\f
-/* Signal Bindings */
-
-#ifdef UNUSED
-
-static void
-DEFUN (bind_handler, (signo, handler),
- int signo AND
- Tsignal_handler handler)
-{
- if ((signo != 0)
- && ((handler != ((Tsignal_handler) sighnd_stop)))
- && ((current_handler (signo)) == SIG_DFL))
- INSTALL_HANDLER (signo, handler);
- return;
-}
-
-#endif /* UNUSED */
-
-void
-DEFUN_VOID (DOS_initialize_signals)
-{
-#ifdef UNUSED
- initialize_signal_descriptors ();
- bind_handler (SIGINT, sighnd_control_c);
- bind_handler (SIGTERM, sighnd_control_g);
- bind_handler (SIGFPE, sighnd_fpe);
- if ((isatty (STDIN_FILENO)) || option_emacs_subprocess)
- {
- bind_handler (SIGILL, sighnd_hardware_trap);
- bind_handler (SIGSEGV, sighnd_hardware_trap);
- bind_handler (SIGABRT, sighnd_software_trap);
- }
- {
- struct signal_descriptor * scan = signal_descriptors;
- struct signal_descriptor * end = (scan + signal_descriptors_length);
- while (scan < end)
- {
- if (((scan -> flags) & NOCATCH) == 0)
- switch (scan -> action)
- {
- case dfl_terminate:
- bind_handler ((scan -> signo), sighnd_terminate);
- break;
- case dfl_stop:
- bind_handler ((scan -> signo), sighnd_stop);
- break;
- }
- scan += 1;
- }
- }
-#else /* UNUSED */
- DOS_initialize_interrupts ();
- DOS_install_interrupts ();
-#endif /* UNUSED */
- return;
-}
+++ /dev/null
-/* -*-C-*-
-
-$Id: dossys.c,v 1.5 1999/01/02 06:11:34 cph Exp $
-
-Copyright (c) 1992, 1999 Massachusetts Institute of Technology
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or (at
-your option) any later version.
-
-This program is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-#include <dos.h>
-#include <stdio.h>
-#include "msdos.h"
-#include "dossys.h"
-\f
-#ifdef UNUSED
-int
-dos_keyboard_input_available_p (void)
-{
- union REGS regs;
-
- regs.h.ah = 0x0B;
- intdos (®s, ®s);
- return (regs.h.al != 0);
-}
-
-unsigned char
-dos_get_keyboard_character (void)
-{
- union REGS regs;
-
- regs.h.ah = 0x07;
- intdos (®s, ®s);
- return ((unsigned char) (regs.h.al));
-}
-#endif /* UNUSED */
-
-int
-dos_poll_keyboard_character (unsigned char * result)
-{
- union REGS regs;
-
- regs.h.ah = 0x06;
- regs.h.dl = 0xFF;
- intdos (®s, ®s);
- *result = ((unsigned char) (regs.h.al));
- return ((regs.x.flags & 0x40) == 0);
-}
-
-void
-dos_console_write_character (unsigned char character)
-{
- union REGS regs;
-
- regs.h.ah = 0x06;
- regs.h.dl = character;
- intdos (®s, ®s);
- return;
-}
-
-int
-dos_console_write (void * vbuffer, size_t nsize)
-{
- unsigned char * buffer = vbuffer;
- union REGS inregs, outregs;
- int i;
-
- inregs.h.ah = 0x06;
- for (i = 0; i < nsize; i++)
- {
- inregs.h.dl = buffer[i];
- intdos (&inregs, &outregs);
- }
- return (nsize);
-}
-\f
-/* DOS I/O functions using handles */
-
-#ifdef UNUSED
-handle_t
-dos_open_file_with_handle (unsigned char * name, int mode)
-{
- union REGS regs;
- struct SREGS segregs;
-
- regs.e.edx = ((unsigned long) name);
- segread (&segregs);
- regs.h.ah = 0x3D;
- regs.h.al = mode;
- intdosx (®s, ®s, &segregs);
- return ((regs.x.cflag) ? DOS_FAILURE : ((unsigned int) regs.x.ax));
-}
-
-int
-dos_close_file_with_handle (handle_t handle)
-{
- union REGS regs;
-
- regs.x.bx = handle;
- regs.h.al = 0x3E;
- intdos (®s, ®s);
- return ((regs.x.cflag) ? DOS_FAILURE : DOS_SUCCESS);
-}
-
-int
-dos_read_file_with_handle (handle_t handle, void * buffer, size_t nbytes)
-{
- union REGS regs;
- struct SREGS segregs;
-
- regs.x.bx = handle;
- regs.e.edx = ((unsigned long) buffer);
- regs.e.ecx = nbytes;
- segread (&segregs);
- regs.h.ah = 0x3F;
- intdosx (®s, ®s, &segregs);
- return ((regs.x.cflag) ? DOS_FAILURE : regs.e.eax);
-}
-
-int
-dos_write_file_with_handle (handle_t handle, void * buffer, size_t nbytes)
-{
- union REGS regs;
- struct SREGS segregs;
-
- regs.x.bx = handle;
- regs.e.edx = (unsigned long) buffer;
- regs.e.ecx = nbytes;
- segread (&segregs);
- regs.h.ah = 0x40;
- intdosx (®s, ®s, &segregs);
- return ((regs.x.cflag) ? DOS_FAILURE : regs.e.eax);
-}
-
-int
-dos_get_device_status_with_handle (handle_t handle)
-{
- union REGS regs;
-
- regs.x.bx = handle;
- regs.x.ax = 0x4400;
- intdos (®s, ®s);
- return ((regs.x.cflag) ? DOS_FAILURE : ((unsigned int) regs.x.dx));
-}
-
-int
-dos_set_device_status_with_handle (handle_t handle, int mode)
-{
- int original_mode;
- union REGS regs;
-
- original_mode = dos_get_device_status_with_handle(handle);
- if (original_mode == DOS_FAILURE)
- return (DOS_FAILURE);
- regs.x.dx = mode;
- regs.x.bx = handle;
- regs.x.ax = 0x4401;
- intdos (®s, ®s);
- return ((regs.x.cflag) ? DOS_FAILURE : original_mode);
-}
-#endif /* UNUSED */
-\f
-void
-dos_get_version (version_t *version_number)
-{
- union REGS regs;
-
- /* Use old style version number because we may be running below DOS 5.0 */
- regs.h.al = 0x01;
- regs.h.ah = 0x30;
- intdos (®s, ®s);
- version_number -> major = regs.h.al;
- version_number -> minor = regs.h.ah;
- if ((version_number -> major) >= 5)
- { /* Get the real version. */
- regs.x.ax = 0x3306;
- intdos (®s, ®s);
- version_number -> major = regs.h.bl;
- version_number -> minor = regs.h.bh;
- }
- return;
-}
-
-#ifdef UNUSED
-void
-dos_reset_drive (void)
-{
- union REGS regs;
-
- regs.h.al = 0x0d;
- intdos (®s, ®s);
- return;
-}
-
-int
-dos_set_verify_flag (int verify_p)
-{
- union REGS regs;
- int old_flag;
-
- regs.h.ah = 0x54;
- intdos (®s, ®s);
- old_flag = regs.h.al;
- regs.h.al = ((verify_p) ? 1 : 0);
- regs.h.ah = 0x2E;
- intdos (®s, ®s);
- return (old_flag);
-}
-#endif /* UNUSED */
-
-int
-dos_set_ctrl_c_check_flag (int check_p)
-{
- union REGS regs;
- int old_flag;
-
- regs.x.ax = 0x3300;
- intdos (®s, ®s);
- old_flag = regs.h.dl;
- regs.h.dl = ((check_p) ? 1 : 0);
- regs.x.ax = 0x3301;
- intdos (®s, ®s);
- return (old_flag);
-}
-
-int
-dos_rename_file (const char * old, const char * new)
-{
- union REGS regs;
- struct SREGS segregs;
-
- regs.e.edx = ((unsigned long) old);
- regs.e.edi = ((unsigned long) new);
- segread (&segregs);
- segregs.es = segregs.ds;
- regs.h.ah = 0x56;
- intdosx (®s, ®s, &segregs);
- if (regs.x.cflag)
- return (DOS_FAILURE);
- else
- return (DOS_SUCCESS);
-}
-
-#ifdef UNUSED
-int
-dos_get_machine_name (char * name)
-{
- union REGS regs;
- struct SREGS segregs;
-
- regs.e.edx = ((unsigned long) name);
- segread (&segregs);
- regs.x.ax = 0x5E00;
- intdosx (®s, ®s, &segregs);
- if ((regs.x.cflag) || (regs.h.ch == 0))
- return (DOS_FAILURE);
- else
- return (regs.h.cl);
-}
-#endif /* UNUSED */
-
-int
-dos_drive_letter_to_number (char letter)
-{
- if (letter == '\0')
- return 0;
- else if ((letter >= 'a') && (letter <= 'z'))
- return ((letter - 'a') + 1);
- else if ((letter >= 'A') && (letter <= 'Z'))
- return ((letter - 'A') + 1);
- else
- return (-1);
-}
-
-#ifdef UNUSED
-char
-dos_drive_number_to_letter (int number)
-{
- if ((number >= 1) && (number <= 26))
- return ('A' + (number - 1));
- else
- return ('\0');
-}
-#endif /* UNUSED */
-
-int
-dos_set_default_drive (int drive_number)
-{
- union REGS regs;
-
- if (drive_number > 0)
- {
- regs.h.dl = (drive_number - 1);
- regs.h.ah = 0x0E;
- intdos (®s, ®s);
- }
- return (DOS_SUCCESS);
-}
-
-#ifdef UNUSED
-int
-dos_get_default_drive (int drive_number)
-{
- union REGS regs;
-
- regs.h.ah = 0x19;
- intdos (®s, ®s);
- return ((regs.h.al) + 1);
-}
-#endif /* UNUSED */
-\f
-dos_boolean
-dos_pathname_as_filename (char * name, char * buffer)
-{ /* Returns whether directory encountered is top level */
- unsigned int end_index = ((strlen (name)) - 1);
-
- /* The runtime system comes down with a name that has a back slash
- at the end. This will choke DOS.
- */
- strcpy (buffer, name);
- if ((end_index >= 0) && (buffer[end_index] == '\\'))
- { /* Name is indeed a directory */
- if (end_index == 0) /* if only one char, name is top */
- return (dos_true);
- else
- {
- if (buffer[end_index-1] == ':') /* Preceded by drive letter, top */
- return (dos_true);
- else
- {
- buffer[end_index] = '\0';
- return (dos_false);
- }
- }
- }
- else
- return (dos_false);
-}
-
-int
-dos_split_filename (char * name, char * device, char * filename)
-{
- unsigned start;
- int drive_number;
-
- if ((strlen(name) >= 2) && (name[1] == ':'))
- {
- device[0] = name[0], device[1] = name[1], device[2] = '\0';
- drive_number = dos_drive_letter_to_number(name[0]);
- start = 2;
- }
- else
- {
- device[0] = '\0';
- drive_number = 0;
- start = 0;
- }
- dos_pathname_as_filename (&name[start], filename);
- return (drive_number);
-}
-\f
-/* The following code should work at least under X32, Zortech's DOSX,
- and Phar Lap 386/DOSX.
-*/
-
-extern int DOS_canonicalize_filename (char *, char *);
-extern unsigned long RealModeBufferParagraph;
-extern char *pRealModeBuffer;
-
-#pragma ZTC align 1
-
-struct rm_interrupt
-{
- unsigned short intno;
- unsigned short ds;
- unsigned short es;
- unsigned short fs;
- unsigned short gs;
- unsigned long eax;
- unsigned long edx;
-};
-
-#pragma ZTC align
-
-#define RETURN_BUFFER_SIZE 128
-
-int
-DOS_canonicalize_filename (char * aliased, char * direct)
-{
- struct rm_interrupt intrpt;
- struct SREGS sregs;
- union REGS regs;
-
- if (pRealModeBuffer == NULL)
- return (-1);
- strcpy ((pRealModeBuffer + RETURN_BUFFER_SIZE), aliased);
- segread (&sregs);
- /* Int 21h, ah = 60h: Canonicalize filename or path. */
- intrpt.intno = 0x21;
- intrpt.eax = 0x6000;
- intrpt.ds = (RealModeBufferParagraph + (RETURN_BUFFER_SIZE >> 4));
- intrpt.es = RealModeBufferParagraph;
- regs.e.esi = 0;
- regs.e.edi = 0;
- regs.e.edx = ((unsigned) &intrpt);
- /* Int 21h, ax = 2511h: Issue real mode interrupt. */
- regs.x.ax = 0x2511;
- intdosx (®s, ®s, &sregs);
- if (regs.e.cflag != 0)
- return (-1);
- strncpy (direct, pRealModeBuffer, RETURN_BUFFER_SIZE);
- return (0);
-}
-\f
-extern void DOS_initialize_real_mode (void);
-unsigned long RealModeBufferParagraph = 0;
-char *pRealModeBuffer = NULL;
-
-void
-DOS_initialize_real_mode (void)
-{
- union REGS regs;
-
- regs.h.ah = 0x48;
- regs.x.bx = 256;
- intdos (®s, ®s);
- if (regs.e.cflag == 0)
- {
- pRealModeBuffer = ((char *) regs.e.ebx);
- RealModeBufferParagraph = regs.x.ax;
- }
- return;
-}
+++ /dev/null
-/* -*-C-*-
-
-$Id: dossys.h,v 1.3 1999/01/02 06:11:34 cph Exp $
-
-Copyright (c) 1992, 1999 Massachusetts Institute of Technology
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or (at
-your option) any later version.
-
-This program is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-#ifndef SCM_DOSSYS_H
-#define SCM_DOSSYS_H
-\f
-#define DOS_SUCCESS (0)
-#define DOS_FAILURE (-1)
-#define dos_boolean int
-#define dos_true (1)
-#define dos_false (0)
-
-typedef struct version_struct
-{
- unsigned char major;
- unsigned char minor;
-} version_t;
-
-typedef int handle_t;
-
-/* Console Character I/O */
-#ifdef UNUSED
-extern int dos_keyboard_input_available_p (void);
-extern unsigned char dos_get_keyboard_character (void);
-#endif /* UNUSED */
-extern int dos_poll_keyboard_character (unsigned char *result);
-extern void dos_console_write_character (unsigned char character);
-extern int dos_console_write (void * vbuffer, size_t nsize);
-
-/* Handle I/O */
-#ifdef UNUSED
-extern handle_t dos_open_file_with_handle (unsigned char * name, int mode);
-extern int dos_close_file_with_handle (handle_t handle);
-extern int dos_read_file_with_handle
- (handle_t handle, void * buffer, size_t nbytes);
-extern int dos_write_file_with_handle
- (handle_t handle, void * buffer, size_t nbytes);
-extern int dos_get_device_status_with_handle (handle_t handle);
-extern int dos_set_device_status_with_handle (handle_t handle, int mode);
-#endif /* UNUSED */
-
-/* Misc */
-extern void dos_get_version (version_t * version_number);
-#ifdef UNUSED
-extern void dos_reset_drive (void);
-extern int dos_set_verify_flag (int verify_p);
-#endif /* UNUSED */
-extern int dos_set_ctrl_c_check_flag (int check_p);
-extern int dos_rename_file (const char *old, const char *new);
-#ifdef UNUSED
-extern int dos_get_machine_name (char *name);
-#endif /* UNUSED */
-extern int dos_drive_letter_to_number (char letter);
-#ifdef UNUSED
-extern char dos_drive_number_to_letter (int number);
-extern int dos_get_default_drive (int drive_number);
-#endif /* UNUSED */
-extern int dos_set_default_drive (int drive_number);
-extern int dos_pathname_as_filename (char * name, char * buffer);
-extern int dos_split_filename (char * name, char * device, char * filename);
-
-/* Keyboard control */
-
-extern dos_boolean DOS_keyboard_intercepted_p;
-extern int dos_restore_kbd_hook (void);
-extern int dos_install_kbd_hook (void);
-extern unsigned char dos_set_kbd_modifier_mask (unsigned char);
-\f
-/* DOS Interrupt Vectors */
-#define DOS_INTVECT_DIVIDE_BY_0 (0x00)
-#define DOS_INTVECT_SINGLE_STEP (0x01)
-#define DOS_INTVECT_NMI (0x02)
-#define DOS_INTVECT_BREAKPOINT (0x03)
-#define DOS_INTVECT_OVERFLOW (0x04)
-#define DOS_INTVECT_PRINT_SCREEN (0x05)
-#define DOS_INTVECT_INVALID_OPCODE (0x06)
-#define DOS_INTVECT_RESERVED_1 (0x07)
-#define DOS_INTVECT_SYSTEM_TIMER (0x08)
-#define DOS_INTVECT_KEYBOARD_EVENT (0x09)
-#define DOS_INTVECT_IRQ2 (0x0A)
-#define DOS_INTVECT_IRQ3 (0x0B)
-#define DOS_INTVECT_IRQ4 (0x0C)
-#define DOS_INTVECT_IRQ5 (0x0D)
-#define DOS_INTVECT_DISKETTE_EVENT (0x0E)
-#define DOS_INTVECT_IRQ7 (0x0F)
-#define DOS_INTVECT_VIDEO (0x10)
-#define DOS_INTVECT_EQUIPMENT (0x11)
-#define DOS_INTVECT_MEMORY_SIZE (0x12)
-#define DOS_INTVECT_DISK_REQUEST (0x13)
-#define DOS_INTVECT_COMMUNICATIONS (0x14)
-#define DOS_INTVECT_SYSTEM_SERVICES (0x15)
-#define DOS_INTVECT_KEYBOARD_REQUEST (0x16)
-#define DOS_INTVECT_PRINTER_REQUEST (0x17)
-#define DOS_INTVECT_IBM_BASIC (0x18)
-#define DOS_INTVECT_BOOTSTRAP (0x19)
-#define DOS_INTVECT_SYSTEM_TIMER_2 (0x1A)
-#define DOS_INTVECT_KB_CTRL_BREAK (0x1B)
-#define DOS_INTVECT_USER_TIMER_TICK (0x1C)
-#define DOS_INTVECT_VIDEO_PARAMETERS (0x1D)
-#define DOS_INTVECT_DISKETTE_PARAMETERS (0x1E)
-#define DOS_INTVECT_GRAPHICS_CHARACTERS (0x1F)
-#define DOS_INTVECT_PROGRAM_TERMINATE (0x20)
-#define DOS_INTVECT_DOS_REQUEST (0x21)
-#define DOS_INTVECT_TERMINATE_ADDRESS (0x22)
-#define DOS_INTVECT_DOS_CTRL_BREAK (0x23)
-#define DOS_INTVECT_CRITICAL_ERROR (0x24)
-#define DOS_INTVECT_ABS_DISK_READ (0x25)
-#define DOS_INTVECT_ABS_DISK_WRITE (0x26)
-#define DOS_INTVECT_TSR (0x27)
-#define DOS_INTVECT_DOS_IDLE (0x28)
-#define DOS_INTVECT_DOS_TTY (0x29)
-#define DOS_INTVECT_MS_NET (0x2A)
-#define DOS_INTVECT_DOS_INTERNAL_1 (0x2B)
-#define DOS_INTVECT_DOS_INTERNAL_2 (0x2C)
-#define DOS_INTVECT_DOS_INTERNAL_3 (0x2D)
-#define DOS_INTVECT_BATCH_EXEC (0x2E)
-#define DOS_INTVECT_MULTIPLEX (0x2F)
-#define DOS_INTVECT_CPM_JUMP_1 (0x30)
-#define DOS_INTVECT_CPM_JUMP_2 (0x31)
-#define DOS_INTVECT_RESERVED_2 (0x32)
-#define DOS_INTVECT_MS_MOUSE (0x33)
-/* Non consecutive */
-#define DOS_INTVECT_DISKETTE_REQUEST (0x40)
-#define DOS_INTVECT_FIXED_DISK_1_PARAM (0x41)
-#define DOS_INTVECT_EGA_GRAPHICS_CHARS (0x43)
-#define DOS_INTVECT_FIXED_DISK_2_PARAM (0x46)
-#define DOS_INTVECT_USER_ALARM (0x4A)
-#define DOS_INTVECT_PROGRAM_USE_1 (0x60)
-#define DOS_INTVECT_PROGRAM_USE_2 (0x61)
-#define DOS_INTVECT_PROGRAM_USE_3 (0x62)
-#define DOS_INTVECT_PROGRAM_USE_4 (0x63)
-#define DOS_INTVECT_PROGRAM_USE_5 (0x64)
-#define DOS_INTVECT_PROGRAM_USE_6 (0x65)
-#define DOS_INTVECT_PROGRAM_USE_7 (0x66)
-#define DOS_INTVECT_EMS_REQUEST (0x67)
-#define DOS_INTVECT_REAL_TIME_CLOCK (0x70)
-#define DOS_INTVECT_IRQ2_REDIRECT (0x72)
-#define DOS_INTVECT_IRQ11 (0x73)
-#define DOS_INTVECT_IBM_MOUSE_EVENT (0x74)
-#define DOS_INTVECT_COPROCESSOR_ERROR (0x75)
-#define DOS_INTVECT_HARD_DISK_EVENT (0x76)
-#define DOS_INTVECT_IRQ15 (0x77)
-
-#define MAX_DOS_INTVECT (0xFF)
-
-#endif /* SCM_DOSSYS_H */
+++ /dev/null
-/* -*-C-*-
-
-$Id: dosterm.h,v 1.3 1999/01/02 06:11:34 cph Exp $
-
-Copyright (c) 1992, 1999 Massachusetts Institute of Technology
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or (at
-your option) any later version.
-
-This program is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-#ifndef SCM_UXTERM_H
-#define SCM_UXTERM_H
-
-#include "osterm.h"
-
-#endif /* SCM_UXTERM_H */
+++ /dev/null
-/* -*-C-*-
-
-$Id: dostop.c,v 1.13 2000/05/20 18:59:10 cph Exp $
-
-Copyright (c) 1992-1999 Massachusetts Institute of Technology
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or (at
-your option) any later version.
-
-This program is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-#include "msdos.h"
-#include "dostop.h"
-#include "osctty.h"
-#include "dosutil.h"
-#include "errors.h"
-#include "option.h"
-
-extern void EXFUN (DOS_initialize_channels, (void));
-extern void EXFUN (DOS_initialize_ctty, (int interactive));
-extern void EXFUN (DOS_initialize_directory_reader, (void));
-extern void EXFUN (DOS_initialize_environment, (void));
-extern void EXFUN (DOS_initialize_processes, (void));
-extern void EXFUN (DOS_initialize_signals, (void));
-extern void EXFUN (DOS_initialize_terminals, (void));
-extern void EXFUN (DOS_initialize_trap_recovery, (void));
-extern void EXFUN (DOS_initialize_conio, (void));
-extern void EXFUN (DOS_initialize_tty, (void));
-extern void EXFUN (DOS_initialize_userio, (void));
-extern void EXFUN (DOS_initialize_real_mode, (void));
-
-extern void EXFUN (DOS_reset_channels, (void));
-extern void EXFUN (DOS_reset_processes, (void));
-extern void EXFUN (DOS_reset_terminals, (void));
-extern void EXFUN (execute_reload_cleanups, (void));
-
-extern void EXFUN (DOS_ctty_save_external_state, (void));
-extern void EXFUN (DOS_ctty_save_internal_state, (void));
-extern void EXFUN (DOS_ctty_restore_internal_state, (void));
-extern void EXFUN (DOS_ctty_restore_external_state, (void));
-
-/* reset_interruptable_extent */
-
-extern CONST char * OS_Name;
-extern CONST char * OS_Variant;
-\f
-static int interactive;
-
-int
-DEFUN_VOID (OS_under_emacs_p)
-{
- return (option_emacs_subprocess);
-}
-
-void
-DEFUN_VOID (OS_initialize)
-{
- interactive = 1;
-
- DOS_initialize_channels ();
- DOS_initialize_environment ();
- DOS_initialize_tty ();
- DOS_initialize_trap_recovery ();
- DOS_initialize_signals ();
- DOS_initialize_directory_reader ();
- DOS_initialize_conio();
- DOS_initialize_real_mode ();
- OS_Name = SYSTEM_NAME;
- {
- version_t version_number;
- dos_get_version(&version_number);
- OS_Variant = (malloc ((strlen (SYSTEM_VARIANT)) + 19));
- sprintf (((char *) OS_Variant), "%s %d.%d 386/486",
- SYSTEM_VARIANT,
- (int) version_number.major,
- (int) version_number.minor);
- }
-}
-
-void
-DEFUN_VOID (OS_announcement)
-{
- /* To make our compiler vendors happy. */
- fprintf(stdout,
- "Copyright (c) 1992-1994 Massachusetts Institute of Technology\n");
- fputs ("", stdout);
-}
-
-void
-DEFUN_VOID (OS_reset)
-{
- /*
- There should really be a reset for each initialize above,
- but the rest seem innocuous.
- */
-
- DOS_reset_channels ();
- execute_reload_cleanups ();
-}
-
-void
-DEFUN (OS_quit, (code, abnormal_p), int code AND int abnormal_p)
-{
- fflush (stdout);
- fputs ("\nScheme has terminated abnormally!\n", stdout);
- OS_restore_external_state ();
-}
-\f
-#ifndef EAGAIN
-#define EAGAIN ERRNO_NONBLOCK
-#endif
-
-enum syserr_names
-DEFUN (OS_error_code_to_syserr, (code), int code)
-{
- switch (code)
- {
- case E2BIG: return (syserr_arg_list_too_long);
- case EACCES: return (syserr_permission_denied);
- case EAGAIN: return (syserr_resource_temporarily_unavailable);
- case EBADF: return (syserr_bad_file_descriptor);
- case EDEADLOCK: return (syserr_resource_deadlock_avoided);
- case EDOM: return (syserr_domain_error);
- case EEXIST: return (syserr_file_exists);
- case EINTR: return (syserr_interrupted_function_call);
- case EINVAL: return (syserr_invalid_argument);
- case EMFILE: return (syserr_too_many_open_files);
- case ENOENT: return (syserr_no_such_file_or_directory);
- case ENOEXEC: return (syserr_exec_format_error);
- case ENOMEM: return (syserr_not_enough_space);
- case ENOTDIR: return (syserr_not_a_directory);
- case ERANGE: return (syserr_result_too_large);
- default: return (syserr_unknown);
- }
-}
-
-static int
-DEFUN (syserr_to_error_code, (syserr), enum syserr_names syserr)
-{
- switch (syserr)
- {
- case syserr_arg_list_too_long: return (E2BIG);
- case syserr_bad_file_descriptor: return (EBADF);
- case syserr_domain_error: return (EDOM);
- case syserr_exec_format_error: return (ENOEXEC);
- case syserr_file_exists: return (EEXIST);
- case syserr_interrupted_function_call: return (EINTR);
- case syserr_invalid_argument: return (EINVAL);
- case syserr_no_such_file_or_directory: return (ENOENT);
- case syserr_not_a_directory: return (ENOTDIR);
- case syserr_not_enough_space: return (ENOMEM);
- case syserr_permission_denied: return (EACCES);
- case syserr_resource_deadlock_avoided: return (EDEADLOCK);
- case syserr_resource_temporarily_unavailable: return (EAGAIN);
- case syserr_result_too_large: return (ERANGE);
- case syserr_too_many_open_files: return (EMFILE);
- default: return (0);
- }
-}
-
-CONST char *
-DEFUN (OS_error_code_to_message, (syserr), unsigned int syserr)
-{
- extern char * sys_errlist [];
- extern int sys_nerr;
- int code = (syserr_to_error_code ((enum syserr_names) syserr));
- return (((code > 0) && (code <= sys_nerr)) ? (sys_errlist [code]) : 0);
-}
-
-void
-DEFUN (DOS_prim_check_errno, (name), enum syscall_names name)
-{
- if (errno != EINTR)
- error_system_call (errno, name);
- deliver_pending_interrupts();
-}
-
-void OS_restore_external_state (void)
-{ extern void DOS_restore_interrupts(void);
-
- DOS_restore_interrupts();
- return;
-}
-
-void bcopy (const char *s1, char *s2, int n)
-{
- while (n-- > 0)
- *s2++ = *s1++;
- return;
-}
-\f
-static char * syscall_names_table [] =
-{
- "accept",
- "bind",
- "chdir",
- "chmod",
- "close",
- "connect",
- "fcntl-getfl",
- "fcntl-setfl",
- "fork",
- "fstat",
- "ftruncate",
- "getcwd",
- "gethostname",
- "gettimeofday",
- "ioctl-tiocgpgrp",
- "ioctl-tiocsigsend",
- "kill",
- "link",
- "listen",
- "localtime",
- "lseek",
- "malloc",
- "mkdir",
- "open",
- "opendir",
- "pause",
- "pipe",
- "read",
- "readlink",
- "realloc",
- "rename",
- "rmdir",
- "select",
- "setitimer",
- "setpgid",
- "sighold",
- "sigprocmask",
- "sigsuspend",
- "sleep",
- "socket",
- "symlink",
- "tcdrain",
- "tcflush",
- "tcgetpgrp",
- "tcsetpgrp",
- "terminal-get-state",
- "terminal-set-state",
- "time",
- "times",
- "unlink",
- "utime",
- "vfork",
- "write",
- "stat",
- "lstat",
- "mktime",
- "dynamic-load"
-};
-
-void
-OS_syscall_names (unsigned int * length, unsigned char *** names)
-{
- (*length) = ((sizeof (syscall_names_table)) / (sizeof (char *)));
- (*names) = ((unsigned char **) syscall_names_table);
-}
-\f
-static char * syserr_names_table [] =
-{
- "unknown",
- "arg-list-too-long",
- "bad-address",
- "bad-file-descriptor",
- "broken-pipe",
- "directory-not-empty",
- "domain-error",
- "exec-format-error",
- "file-exists",
- "file-too-large",
- "filename-too-long",
- "function-not-implemented",
- "improper-link",
- "inappropriate-io-control-operation",
- "interrupted-function-call",
- "invalid-argument",
- "invalid-seek",
- "io-error",
- "is-a-directory",
- "no-child-processes",
- "no-locks-available",
- "no-space-left-on-device",
- "no-such-device",
- "no-such-device-or-address",
- "no-such-file-or-directory",
- "no-such-process",
- "not-a-directory",
- "not-enough-space",
- "operation-not-permitted",
- "permission-denied",
- "read-only-file-system",
- "resource-busy",
- "resource-deadlock-avoided",
- "resource-temporarily-unavailable",
- "result-too-large",
- "too-many-links",
- "too-many-open-files",
- "too-many-open-files"
-};
-
-void
-OS_syserr_names (unsigned int * length, unsigned char *** names)
-{
- (*length) = ((sizeof (syserr_names_table)) / (sizeof (char *)));
- (*names) = ((unsigned char **) syserr_names_table);
-}
+++ /dev/null
-/* -*-C-*-
-
-$Id: dostop.h,v 1.3 1999/01/02 06:11:34 cph Exp $
-
-Copyright (c) 1992, 1999 Massachusetts Institute of Technology
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or (at
-your option) any later version.
-
-This program is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-#ifndef SCM_DOSTOP_H
-#define SCM_DOSTOP_H
-
-#include "ostop.h"
-
-#endif /* SCM_DOSTOP_H */
+++ /dev/null
-/* -*-C-*-
-
-$Id: dostrap.c,v 1.7 1999/01/02 06:11:34 cph Exp $
-
-Copyright (c) 1992-1999 Massachusetts Institute of Technology
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or (at
-your option) any later version.
-
-This program is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-#include "scheme.h"
-#include "os.h"
-#include "msdos.h"
-#include "dostrap.h"
-#include "dosexcp.h"
-
-extern void EXFUN (DOS_initialize_trap_recovery, (void));
-CONST char * EXFUN (find_trap_name, (int trapno));
-extern PTR initial_C_stack_pointer;
-\f
-static enum trap_state trap_state;
-static enum trap_state user_trap_state;
-
-static enum trap_state saved_trap_state;
-static int saved_trapno;
-static SIGINFO_T saved_info;
-static struct FULL_SIGCONTEXT * saved_scp;
-
-static unsigned short
- initial_C_ss = 0,
- initial_C_ds = 0,
- initial_C_cs = 0;
-
-static void EXFUN (initialize_dos_trap_codes, (void));
-static void EXFUN
- (continue_from_trap,
- (int trapno, SIGINFO_T info, struct FULL_SIGCONTEXT * scp));
-
-void
-DEFUN_VOID (DOS_initialize_trap_recovery)
-{
- extern unsigned short getSS (void);
-
- initial_C_ss = (getSS ());
- initial_C_ds = (getDS ());
- initial_C_cs = (getCS ());
- trap_state = trap_state_recover;
- user_trap_state = trap_state_recover;
- initialize_dos_trap_codes ();
-}
-
-enum trap_state
-DEFUN (OS_set_trap_state, (state), enum trap_state state)
-{
- enum trap_state old_trap_state = user_trap_state;
- user_trap_state = state;
- trap_state = state;
- return (old_trap_state);
-}
-
-static void
-DEFUN_VOID (trap_normal_termination)
-{
- trap_state = trap_state_exitting_soft;
- termination_trap ();
-}
-
-static void
-DEFUN_VOID (trap_immediate_termination)
-{
- trap_state = trap_state_exitting_hard;
- OS_restore_external_state ();
- exit (1);
-}
-
-static void
-DEFUN_VOID (trap_recover)
-{
- if (WITHIN_CRITICAL_SECTION_P ())
- {
- CLEAR_CRITICAL_SECTION_HOOK ();
- EXIT_CRITICAL_SECTION ({});
- }
- reset_interruptable_extent ();
- continue_from_trap (saved_trapno, saved_info, saved_scp);
-}
-\f
-void
-DEFUN (trap_handler, (message, trapno, info, scp),
- CONST char * message AND
- int trapno AND
- SIGINFO_T info AND
- struct FULL_SIGCONTEXT * scp)
-{
- int code = ((SIGINFO_VALID_P (info)) ? (SIGINFO_CODE (info)) : 0);
- Boolean stack_overflowed_p = (STACK_OVERFLOWED_P ());
- enum trap_state old_trap_state = trap_state;
-
- if (old_trap_state == trap_state_exitting_hard)
- _exit (1);
- else if (old_trap_state == trap_state_exitting_soft)
- trap_immediate_termination ();
- trap_state = trap_state_trapped;
- if (WITHIN_CRITICAL_SECTION_P ())
- {
- fprintf (stdout,
- "\n>> A %s has occurred within critical section \"%s\".\n",
- message, (CRITICAL_SECTION_NAME ()));
- fprintf (stdout, ">> [exception %d (%s), code %d = 0x%x]\n",
- trapno, (find_trap_name (trapno)), code, code);
- }
- else if (stack_overflowed_p || (old_trap_state != trap_state_recover))
- {
- fprintf (stdout, "\n>> A %s (%d) has occurred.\n", message, trapno);
- fprintf (stdout, ">> [exception %d (%s), code %d = 0x%x]\n",
- trapno, (find_trap_name (trapno)), code, code);
- }
- if (stack_overflowed_p)
- {
- fputs (">> The stack has overflowed overwriting adjacent memory.\n",
- stdout);
- fputs (">> This was probably caused by a runaway recursion.\n", stdout);
- }
- fflush (stdout);
-
- switch (old_trap_state)
- {
- case trap_state_trapped:
- if ((saved_trap_state == trap_state_recover) ||
- (saved_trap_state == trap_state_query))
- {
- fputs (">> The trap occurred while processing an earlier trap.\n",
- stdout);
- fprintf (stdout,
- ">> [The earlier trap raised exception %d (%s), code %d.]\n",
- saved_trapno,
- (find_trap_name (saved_trapno)),
- ((SIGINFO_VALID_P (saved_info))
- ? (SIGINFO_CODE (saved_info))
- : 0));
- fputs (((WITHIN_CRITICAL_SECTION_P ())
- ? ">> Successful recovery is extremely unlikely.\n"
- : ">> Successful recovery is unlikely.\n"),
- stdout);
- break;
- }
- else
- trap_immediate_termination ();
- case trap_state_recover:
- if ((WITHIN_CRITICAL_SECTION_P ()) || stack_overflowed_p)
- {
- fputs (">> Successful recovery is unlikely.\n", stdout);
- break;
- }
- else
- {
- saved_trap_state = old_trap_state;
- saved_trapno = trapno;
- saved_info = info;
- saved_scp = scp;
- trap_recover ();
- }
- case trap_state_exit:
- termination_trap ();
- }
-
- fflush (stdout);
- saved_trap_state = old_trap_state;
- saved_trapno = trapno;
- saved_info = info;
- saved_scp = scp;
-
- while (1)
- {
- char option;
- static CONST char * trap_query_choices[] =
- {
- "I = terminate immediately",
- "N = terminate normally",
- "R = attempt recovery",
- "Q = terminate normally",
- 0
- };
- option = (userio_choose_option
- ("Choose one of the following actions:",
- "Action -> ",
- trap_query_choices));
- switch (option)
- {
- case 'I':
- trap_immediate_termination ();
- case '\0':
- /* Error in IO. Assume everything scrod. */
- case 'N':
- case 'Q':
- trap_normal_termination ();
- case 'R':
- trap_recover ();
- }
- }
-}
-\f
-#define STATE_UNKNOWN (LONG_TO_UNSIGNED_FIXNUM (0))
-#define STATE_PRIMITIVE (LONG_TO_UNSIGNED_FIXNUM (1))
-#define STATE_COMPILED_CODE (LONG_TO_UNSIGNED_FIXNUM (2))
-#define STATE_PROBABLY_COMPILED (LONG_TO_UNSIGNED_FIXNUM (3))
-
-struct trap_recovery_info
-{
- SCHEME_OBJECT state;
- SCHEME_OBJECT pc_info_1;
- SCHEME_OBJECT pc_info_2;
- SCHEME_OBJECT extra_trap_info;
-};
-
-static struct trap_recovery_info dummy_recovery_info =
-{
- STATE_UNKNOWN,
- SHARP_F,
- SHARP_F,
- SHARP_F
-};
-
-struct dos_trap_code_desc
-{
- int trapno;
- unsigned long code_mask;
- unsigned long code_value;
- char *name;
-};
-
-static struct dos_trap_code_desc dos_trap_codes [64];
-
-#define DECLARE_DOS_TRAP_CODE(s, m, v, n) \
-{ \
- ((dos_trap_codes [i]) . trapno) = (s); \
- ((dos_trap_codes [i]) . code_mask) = (m); \
- ((dos_trap_codes [i]) . code_value) = (v); \
- ((dos_trap_codes [i]) . name) = (n); \
- i += 1; \
-}
-
-static SCHEME_OBJECT
-DEFUN (find_trap_code_name, (trapno, info, scp),
- int trapno AND
- SIGINFO_T info AND
- struct FULL_SIGCONTEXT * scp)
-{
- unsigned long code = 0;
- char * name = 0;
- if (SIGINFO_VALID_P (info))
- {
- code = (SIGINFO_CODE (info));
- {
- struct dos_trap_code_desc * entry = (& (dos_trap_codes [0]));
- while ((entry -> trapno) != DOS_INVALID_TRAP)
- if (((entry -> trapno) == trapno)
- && (((entry -> code_mask) & code) == (entry -> code_value)))
- {
- name = (entry -> name);
- break;
- }
- else
- entry += 1;
- }
- }
- return (cons ((long_to_integer ((long) code)),
- ((name == 0) ? SHARP_F
- : (char_pointer_to_string ((unsigned char *) name)))));
-}
-\f
-static void
-DEFUN_VOID (initialize_dos_trap_codes)
-{
- unsigned int i = 0;
-
- DECLARE_DOS_TRAP_CODE (DOS_EXCP_Integer_divide_by_zero,
- 0, 0,
- "Integer divide by zero");
- DECLARE_DOS_TRAP_CODE (DOS_EXCP_Debug_exception,
- 0, 0,
- "Debug exception");
- DECLARE_DOS_TRAP_CODE (DOS_EXCP_Non_maskable_interrupt,
- 0, 0,
- "Non-maskable interrupt");
- DECLARE_DOS_TRAP_CODE (DOS_EXCP_Breakpoint,
- 0, 0,
- "Breakpoint");
- DECLARE_DOS_TRAP_CODE (DOS_EXCP_Integer_overflow,
- 0, 0,
- "Integer overflow");
- DECLARE_DOS_TRAP_CODE (DOS_EXCP_Bounds_check,
- 0, 0,
- "Bounds check");
- DECLARE_DOS_TRAP_CODE (DOS_EXCP_Invalid_opcode,
- 0, 0,
- "Invalid opcode");
- DECLARE_DOS_TRAP_CODE (DOS_EXCP_Numeric_co_processor_not_available,
- 0, 0,
- "Numeric co-processor not available");
- DECLARE_DOS_TRAP_CODE (DOS_EXCP_Double_fault,
- 0, 0,
- "Double fault");
- DECLARE_DOS_TRAP_CODE (DOS_EXCP_Numeric_co_processor_segment_overrun,
- 0, 0,
- "Numeric co-processor segment overrun");
- DECLARE_DOS_TRAP_CODE (DOS_EXCP_Invalid_TSS,
- 0, 0,
- "Invalid TSS");
- DECLARE_DOS_TRAP_CODE (DOS_EXCP_Segment_not_present,
- 0, 0,
- "Segment not present");
- DECLARE_DOS_TRAP_CODE (DOS_EXCP_Stack_exception,
- 0, 0,
- "Stack exception");
- DECLARE_DOS_TRAP_CODE (DOS_EXCP_General_protection,
- 0, 0,
- "General protection");
- DECLARE_DOS_TRAP_CODE (DOS_EXCP_Page_Fault,
- 0, 0,
- "Page Fault");
- DECLARE_DOS_TRAP_CODE (DOS_EXCP_Floating_point_exception,
- 0, 0,
- "Floating-point exception");
- DECLARE_DOS_TRAP_CODE (DOS_EXCP_Alignment_check,
- 0, 0,
- "Alignment check");
- DECLARE_DOS_TRAP_CODE (DOS_INVALID_TRAP, 0, 0, ((char *) 0));
- return;
-}
-
-static CONST char *
-trap_names[NUM_DOS_EXCP] =
-{
- "Integer divide by zero",
- "Debugging trap",
- "NMI interrupt",
- "Breakpoint exception",
- "INTO -- integer overflow",
- "BOUND -- range exceeded",
- "UD -- invalid opcode",
- "NM -- 387 not available",
- "DF -- double fault",
- "387 segment overrun",
- "TS -- invalid TSS",
- "NP -- segment not present",
- "SS -- stack fault",
- "GP -- general protection",
- "PF -- page fault",
- ((CONST char *) NULL),
- "MF -- floating-point error",
- "AC -- alignment check"
-};
-
-CONST char *
-DEFUN (find_trap_name, (trapno), int trapno)
-{
- static char buffer [64], * name;
- if ((trapno >= 0) &&
- (trapno < ((sizeof (trap_names)) / (sizeof (char *)))))
- {
- name = trap_names[trapno];
- if ((name != ((char *) NULL))
- && (name[0] != '\0'))
- return ((CONST char *) name);
- }
- sprintf (buffer, "unknown exception %d", trapno);
- return ((CONST char *) buffer);
-}
-\f
-static void
-DEFUN (setup_trap_frame, (trapno, info, scp, trinfo, new_stack_pointer),
- int trapno AND
- SIGINFO_T info AND
- struct FULL_SIGCONTEXT * scp AND
- struct trap_recovery_info * trinfo AND
- SCHEME_OBJECT * new_stack_pointer)
-{
- SCHEME_OBJECT handler;
- SCHEME_OBJECT trap_name, trap_code;
- int stack_recovered_p = (new_stack_pointer != 0);
- long saved_mask = (FETCH_INTERRUPT_MASK ());
- SET_INTERRUPT_MASK (0); /* To prevent GC for now. */
- if ((! (Valid_Fixed_Obj_Vector ())) ||
- ((handler = (Get_Fixed_Obj_Slot (Trap_Handler))) == SHARP_F))
- {
- fprintf (stderr, "There is no trap handler for recovery!\n");
- fprintf (stderr, "Trap = %s.\n", (find_trap_name (trapno)));
- fprintf (stderr, "pc = %04x:%08lx; sp = %04x:%08lx.\n",
- scp->sc_cs, scp->sc_eip, scp->sc_ss, scp->sc_esp);
- fflush (stderr);
- termination_trap ();
- }
- if (Free > MemTop)
- Request_GC (0);
-
- trap_name =
- ((trapno < 0)
- ? SHARP_F
- : (char_pointer_to_string
- ((unsigned char *) (find_trap_name (trapno)))));
- trap_code = (find_trap_code_name (trapno, info, scp));
- if (!stack_recovered_p)
- {
- INITIALIZE_STACK ();
- Will_Push (CONTINUATION_SIZE);
- Store_Return (RC_END_OF_COMPUTATION);
- Store_Expression (SHARP_F);
- Save_Cont ();
- Pushed ();
- }
- else
- Stack_Pointer = new_stack_pointer;
- Will_Push (7 + CONTINUATION_SIZE);
- STACK_PUSH (trinfo -> extra_trap_info);
- STACK_PUSH (trinfo -> pc_info_2);
- STACK_PUSH (trinfo -> pc_info_1);
- STACK_PUSH (trinfo -> state);
- STACK_PUSH (BOOLEAN_TO_OBJECT (stack_recovered_p));
- STACK_PUSH (trap_code);
- STACK_PUSH (trap_name);
- Store_Return (RC_HARDWARE_TRAP);
- Store_Expression (long_to_integer (trapno));
- Save_Cont ();
- Pushed ();
- if (stack_recovered_p
- /* This may want to do it in other cases, but this may be enough. */
- && (trinfo->state == STATE_COMPILED_CODE))
- Stop_History ();
-
- History = (Make_Dummy_History ());
- Will_Push (STACK_ENV_EXTRA_SLOTS + 2);
- STACK_PUSH (trap_name);
- STACK_PUSH (handler);
- STACK_PUSH (STACK_FRAME_HEADER + 1);
- Pushed ();
- SET_INTERRUPT_MASK (saved_mask);
- abort_to_interpreter (PRIM_APPLY);
-}
-\f
-/* DOS_INVALID_TRAP is an invalid trap, it means a user requested reset. */
-
-void
-DEFUN (hard_reset, (scp), struct FULL_SIGCONTEXT * scp)
-{
- continue_from_trap (DOS_INVALID_TRAP, 0, scp);
-}
-
-/* Called synchronously. */
-
-void
-DEFUN_VOID (soft_reset)
-{
- struct trap_recovery_info trinfo;
- SCHEME_OBJECT * new_stack_pointer =
- (((Stack_Pointer <= Stack_Top) && (Stack_Pointer > Stack_Guard))
- ? Stack_Pointer
- : 0);
- if ((Regs[REGBLOCK_PRIMITIVE]) != SHARP_F)
- {
- (trinfo . state) = STATE_PRIMITIVE;
- (trinfo . pc_info_1) = (Regs[REGBLOCK_PRIMITIVE]);
- (trinfo . pc_info_2) =
- (LONG_TO_UNSIGNED_FIXNUM (Regs[REGBLOCK_LEXPR_ACTUALS]));
- (trinfo . extra_trap_info) = SHARP_F;
- }
- else
- {
- (trinfo . state) = STATE_UNKNOWN;
- (trinfo . pc_info_1) = SHARP_F;
- (trinfo . pc_info_2) = SHARP_F;
- (trinfo . extra_trap_info) = SHARP_F;
- }
- if ((Free >= Heap_Top) || (Free < Heap_Bottom))
- /* Let's hope this works. */
- Free = MemTop;
- setup_trap_frame (DOS_INVALID_TRAP, 0, 0, (&trinfo), new_stack_pointer);
-}
-
-#if !defined(HAVE_SIGCONTEXT) || !defined(HAS_COMPILER_SUPPORT) || defined(USE_STACKLETS)
-
-static void
-DEFUN (continue_from_trap, (trapno, info, scp),
- int trapno AND
- SIGINFO_T info AND
- struct FULL_SIGCONTEXT * scp)
-{
- if (Free < MemTop)
- Free = MemTop;
- setup_trap_frame (trapno, info, scp, (&dummy_recovery_info), 0);
-}
-
-#else /* HAVE_SIGCONTEXT and HAS_COMPILER_SUPPORT and not USE_STACKLETS */
-\f
-/* Heuristic recovery from processor traps/exceptions.
-
- continue_from_trap attempts to:
-
- 1) validate the trap information (pc and sp);
- 2) determine whether compiled code was executing, a primitive was
- executing, or execution was in the interpreter;
- 3) guess what C global state is still valid; and
- 4) set up a recovery frame for the interpreter so that debuggers can
- display more information. */
-
-#include "gccode.h"
-
-#define SCHEME_ALIGNMENT_MASK ((sizeof (long)) - 1)
-#define STACK_ALIGNMENT_MASK SCHEME_ALIGNMENT_MASK
-#define FREE_PARANOIA_MARGIN 0x100
-
-/* PCs must be aligned according to this. */
-
-#define PC_ALIGNMENT_MASK ((1 << PC_ZERO_BITS) - 1)
-
-/* But they may have bits that can be masked by this. */
-
-#ifndef PC_VALUE_MASK
-#define PC_VALUE_MASK (~0)
-#endif
-
-#define C_STACK_SIZE 0x01000000
-
-#ifdef HAS_COMPILER_SUPPORT
-#define ALLOW_ONLY_C 0
-#else
-#define ALLOW_ONLY_C 1
-#define PLAUSIBLE_CC_BLOCK_P(block) 0
-#endif
-
-static SCHEME_OBJECT * EXFUN
- (find_block_address, (char * pc_value, SCHEME_OBJECT * area_start));
-
-#if 0
-#define get_etext() (&etext)
-#else
-/* For now */
-#define get_etext() (Heap_Bottom)
-#endif
-
-static void
-DEFUN (continue_from_trap, (trapno, info, scp),
- int trapno AND
- SIGINFO_T info AND
- struct FULL_SIGCONTEXT * scp)
-{
- extern unsigned short scheme_ss;
- int pc_in_C;
- int pc_in_heap;
- int pc_in_constant_space;
- int pc_in_scheme;
- int pc_in_hyper_space;
- int scheme_sp_valid;
- long C_sp;
- long scheme_sp;
- long the_pc;
- SCHEME_OBJECT * new_stack_pointer;
- SCHEME_OBJECT * xtra_info;
- struct trap_recovery_info trinfo;
-
- if (scp == ((struct FULL_SIGCONTEXT *) NULL))
- {
- if (Free < MemTop)
- Free = MemTop;
- setup_trap_frame (trapno, info, scp, (&dummy_recovery_info), 0);
- /*NOTREACHED*/
- }
-
- C_sp = (FULL_SIGCONTEXT_SP (scp));
- scheme_sp = (FULL_SIGCONTEXT_SCHSP (scp));
- the_pc = ((FULL_SIGCONTEXT_PC (scp)) & PC_VALUE_MASK);
-
-#if FALSE
- fprintf (stderr, "\ncontinue_from_trap:");
- fprintf (stderr, "\tpc = 0x%08lx\n", the_pc);
- fprintf (stderr, "\tCsp = 0x%08lx\n", C_sp);
- fprintf (stderr, "\tssp = 0x%08lx\n", scheme_sp);
- fprintf (stderr, "\tesp = 0x%08lx\n", Ext_Stack_Pointer);
-#endif
-
- if (((the_pc & PC_ALIGNMENT_MASK) != 0)
- || (scp->sc_cs != initial_C_cs))
- {
- pc_in_C = 0;
- pc_in_heap = 0;
- pc_in_constant_space = 0;
- pc_in_scheme = 0;
- pc_in_hyper_space = 1;
- }
- else
- {
- pc_in_C = (the_pc <= ((long) (get_etext ())));
- pc_in_heap =
- ((the_pc < ((long) Heap_Top)) && (the_pc >= ((long) Heap_Bottom)));
- pc_in_constant_space =
- ((the_pc < ((long) Constant_Top)) &&
- (the_pc >= ((long) Constant_Space)));
- pc_in_scheme = (pc_in_heap || pc_in_constant_space);
- pc_in_hyper_space = ((!pc_in_C) && (!pc_in_scheme));
- }
-
- scheme_sp_valid =
- (pc_in_scheme
- && (((scp->sc_ss & 0xffff) == (scp->sc_ds & 0xffff))
- || ((scheme_ss != 0)
- && ((scp->sc_ss & 0xffff) == scheme_ss)))
- && ((scp->sc_ds & 0xffff) == (initial_C_ds & 0xffff))
- && ((scheme_sp < ((long) Stack_Top)) &&
- (scheme_sp >= ((long) Stack_Bottom)) &&
- ((scheme_sp & STACK_ALIGNMENT_MASK) == 0)));
-
- new_stack_pointer =
- (scheme_sp_valid
- ? ((SCHEME_OBJECT *) scheme_sp)
- : ((pc_in_C
- && ((scp->sc_ss & 0xffff) == (initial_C_ss & 0xffff))
- && (Stack_Pointer < Stack_Top)
- && (Stack_Pointer > Stack_Bottom))
- ? Stack_Pointer
- : ((SCHEME_OBJECT *) 0)));
-
- if (pc_in_hyper_space || (pc_in_scheme && ALLOW_ONLY_C))
- {
- /* In hyper space. */
- (trinfo . state) = STATE_UNKNOWN;
- (trinfo . pc_info_1) = SHARP_F;
- (trinfo . pc_info_2) = SHARP_F;
- new_stack_pointer = 0;
- if ((Free < MemTop) ||
- (Free >= Heap_Top) ||
- ((((unsigned long) Free) & SCHEME_ALIGNMENT_MASK) != 0))
- Free = MemTop;
- }
- else if (pc_in_scheme)
- {
- /* In compiled code. */
- SCHEME_OBJECT * block_addr;
- SCHEME_OBJECT * maybe_free;
- block_addr =
- (find_block_address (((PTR) the_pc),
- (pc_in_heap ? Heap_Bottom : Constant_Space)));
- if (block_addr == 0)
- {
- (trinfo . state) = STATE_PROBABLY_COMPILED;
- (trinfo . pc_info_1) = (LONG_TO_UNSIGNED_FIXNUM (the_pc));
- (trinfo . pc_info_2) = SHARP_F;
- if ((Free < MemTop) ||
- (Free >= Heap_Top) ||
- ((((unsigned long) Free) & SCHEME_ALIGNMENT_MASK) != 0))
- Free = MemTop;
- }
- else
- {
- (trinfo . state) = STATE_COMPILED_CODE;
- (trinfo . pc_info_1) =
- (MAKE_POINTER_OBJECT (TC_COMPILED_CODE_BLOCK, block_addr));
- (trinfo . pc_info_2) =
- (LONG_TO_UNSIGNED_FIXNUM (the_pc - ((long) block_addr)));
-#ifdef HAVE_FULL_SIGCONTEXT
- maybe_free = ((SCHEME_OBJECT *) (FULL_SIGCONTEXT_RFREE (scp)));
- if (((((unsigned long) maybe_free) & SCHEME_ALIGNMENT_MASK) == 0)
- && (maybe_free >= Heap_Bottom) && (maybe_free < Heap_Top))
- Free = (maybe_free + FREE_PARANOIA_MARGIN);
- else
-#endif
- {
- if ((Free < MemTop) || (Free >= Heap_Top)
- || ((((unsigned long) Free) & SCHEME_ALIGNMENT_MASK) != 0))
- Free = MemTop;
- }
- }
- }
- else
- {
- /* In the interpreter, a primitive, or a compiled code utility. */
-
- SCHEME_OBJECT primitive = (Regs[REGBLOCK_PRIMITIVE]);
-
- if ((OBJECT_TYPE (primitive)) != TC_PRIMITIVE)
- {
- (trinfo . state) = STATE_UNKNOWN;
- (trinfo . pc_info_1) = SHARP_F;
- (trinfo . pc_info_2) = SHARP_F;
- new_stack_pointer = 0;
- }
- else
- {
- long primitive_address =
- ((long) (Primitive_Procedure_Table[OBJECT_DATUM (primitive)]));
- (trinfo . state) = STATE_PRIMITIVE;
- (trinfo . pc_info_1) = primitive;
- (trinfo . pc_info_2) =
- (LONG_TO_UNSIGNED_FIXNUM (Regs[REGBLOCK_LEXPR_ACTUALS]));
- }
- if ((new_stack_pointer == 0)
- || ((((unsigned long) Free) & SCHEME_ALIGNMENT_MASK) != 0)
- || ((Free < Heap_Bottom) || (Free >= Heap_Top))
- || ((Free < MemTop) && ((Free + FREE_PARANOIA_MARGIN) >= MemTop)))
- Free = MemTop;
- else if ((Free + FREE_PARANOIA_MARGIN) < MemTop)
- Free += FREE_PARANOIA_MARGIN;
- }
- xtra_info = Free;
- Free += (1 + 2 + PROCESSOR_NREGS);
- (trinfo . extra_trap_info) =
- (MAKE_POINTER_OBJECT (TC_NON_MARKED_VECTOR, xtra_info));
- (*xtra_info++) =
- (MAKE_OBJECT (TC_MANIFEST_NM_VECTOR, (2 + PROCESSOR_NREGS)));
- (*xtra_info++) = ((SCHEME_OBJECT) the_pc);
- (*xtra_info++) = ((SCHEME_OBJECT) C_sp);
- {
- int counter = FULL_SIGCONTEXT_NREGS;
- int * regs = (FULL_SIGCONTEXT_FIRST_REG (scp));
- while ((counter--) > 0)
- (*xtra_info++) = ((SCHEME_OBJECT) (*regs++));
- }
- /* We assume that regs,sp,pc is the order in the processor.
- Scheme can always fix this. */
- if ((PROCESSOR_NREGS - FULL_SIGCONTEXT_NREGS) > 0)
- (*xtra_info++) = ((SCHEME_OBJECT) C_sp);
- if ((PROCESSOR_NREGS - FULL_SIGCONTEXT_NREGS) > 1)
- (*xtra_info++) = ((SCHEME_OBJECT) the_pc);
- setup_trap_frame (trapno, info, scp, (&trinfo), new_stack_pointer);
-}
-\f
-/* Find the compiled code block in area which contains `pc_value'.
- This attempts to be more efficient than `find_block_address_in_area'.
- If the pointer is in the heap, it can actually do twice as
- much work, but it is expected to pay off on the average. */
-
-static SCHEME_OBJECT * EXFUN
- (find_block_address_in_area, (char * pc_value, SCHEME_OBJECT * area_start));
-
-#define MINIMUM_SCAN_RANGE 2048
-
-static SCHEME_OBJECT *
-DEFUN (find_block_address, (pc_value, area_start),
- char * pc_value AND
- SCHEME_OBJECT * area_start)
-{
- if (area_start == Constant_Space)
- {
- extern SCHEME_OBJECT * EXFUN
- (find_constant_space_block, (SCHEME_OBJECT *));
- SCHEME_OBJECT * constant_block =
- (find_constant_space_block
- ((SCHEME_OBJECT *)
- (((unsigned long) pc_value) &~ SCHEME_ALIGNMENT_MASK)));
- return
- ((constant_block == 0)
- ? 0
- : (find_block_address_in_area (pc_value, constant_block)));
- }
- {
- SCHEME_OBJECT * nearest_word =
- ((SCHEME_OBJECT *)
- (((unsigned long) pc_value) &~ SCHEME_ALIGNMENT_MASK));
- long maximum_distance = (nearest_word - area_start);
- long distance = maximum_distance;
- while ((distance / 2) > MINIMUM_SCAN_RANGE)
- distance = (distance / 2);
- while ((distance * 2) < maximum_distance)
- {
- SCHEME_OBJECT * block =
- (find_block_address_in_area (pc_value, (nearest_word - distance)));
- if (block != 0)
- return (block);
- distance *= 2;
- }
- }
- return (find_block_address_in_area (pc_value, area_start));
-}
-\f
-/*
- Find the compiled code block in area which contains `pc_value',
- by scanning sequentially the complete area.
- For the time being, skip over manifest closures and linkage sections. */
-
-static SCHEME_OBJECT *
-DEFUN (find_block_address_in_area, (pc_value, area_start),
- char * pc_value AND
- SCHEME_OBJECT * area_start)
-{
- SCHEME_OBJECT * first_valid = area_start;
- SCHEME_OBJECT * area = area_start;
- while (((char *) area) < pc_value)
- {
- SCHEME_OBJECT object = (*area);
- switch (OBJECT_TYPE (object))
- {
- case TC_LINKAGE_SECTION:
- {
- switch (READ_LINKAGE_KIND (object))
- {
- case GLOBAL_OPERATOR_LINKAGE_KIND:
- case OPERATOR_LINKAGE_KIND:
- {
- long count = (READ_OPERATOR_LINKAGE_COUNT (object));
- area = ((END_OPERATOR_LINKAGE_AREA (area, count)) + 1);
- break;
- }
-
- default:
-#if FALSE
- {
- gc_death (TERM_EXIT,
- "find_block_address: Unknown compiler linkage kind.",
- area, NULL);
- /*NOTREACHED*/
- }
-#else
- /* Fall through, no reason to crash here. */
-#endif
- case ASSIGNMENT_LINKAGE_KIND:
- case CLOSURE_PATTERN_LINKAGE_KIND:
- case REFERENCE_LINKAGE_KIND:
- area += ((READ_CACHE_LINKAGE_COUNT (object)) + 1);
- break;
-
- }
- break;
- }
- case TC_MANIFEST_CLOSURE:
- {
- area += 1;
- {
- long count = (MANIFEST_CLOSURE_COUNT (area));
- area = ((MANIFEST_CLOSURE_END (area, count)) + 1);
- }
- break;
- }
- case TC_MANIFEST_NM_VECTOR:
- {
- long count = (OBJECT_DATUM (object));
- if (((char *) (area + (count + 1))) < pc_value)
- {
- area += (count + 1);
- first_valid = area;
- break;
- }
- {
- SCHEME_OBJECT * block = (area - 1);
- return
- (((area == first_valid) ||
- ((OBJECT_TYPE (*block)) != TC_MANIFEST_VECTOR) ||
- ((OBJECT_DATUM (*block)) < (count + 1)) ||
- (! (PLAUSIBLE_CC_BLOCK_P (block))))
- ? 0
- : block);
- }
- }
- default:
- {
- area += 1;
- break;
- }
- }
- }
- return (0);
-}
-
-#endif /* HAVE_SIGCONTEXT and HAS_COMPILER_SUPPORT and not USE_STACKLETS */
-
+++ /dev/null
-/* -*-C-*-
-
-$Id: dostrap.h,v 1.4 1999/01/02 06:11:34 cph Exp $
-
-Copyright (c) 1992-1999 Massachusetts Institute of Technology
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or (at
-your option) any later version.
-
-This program is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-#ifndef SCM_DOSTRAP_H
-#define SCM_DOSTRAP_H
-\f
-#ifndef SIGINFO_T
-#define SIGINFO_T unsigned
-#define SIGINFO_VALID_P(info) (1)
-#define SIGINFO_CODE(info) (info)
-#endif
-
-/* EIP not included here, not a "register", except on the Vax.
- 8 General registers.
- 6 Segment registers.
- 1 Flags register.
- */
-
-#define HAVE_SIGCONTEXT
-#define HAVE_FULL_SIGCONTEXT
-#define PROCESSOR_NREGS (8 + 6 + 1)
-#define FULL_SIGCONTEXT_NREGS PROCESSOR_NREGS
-
-#define SIGCONTEXT sigcontext
-#define SIGCONTEXT_SP(scp) ((scp)->sc_esp)
-#define SIGCONTEXT_PC(scp) ((scp)->sc_eip)
-
-#define FULL_SIGCONTEXT SIGCONTEXT
-#define FULL_SIGCONTEXT_SP SIGCONTEXT_SP
-#define FULL_SIGCONTEXT_PC SIGCONTEXT_PC
-#define FULL_SIGCONTEXT_RFREE(scp) ((scp)->sc_edi)
-#define FULL_SIGCONTEXT_FIRST_REG(scp) (& (scp->sc_eax))
-#define FULL_SIGCONTEXT_SCHSP FULL_SIGCONTEXT_SP
-
-#define DECLARE_FULL_SIGCONTEXT(name) \
- struct FULL_SIGCONTEXT * name
-
-#define INITIALIZE_FULL_SIGCONTEXT(partial, full) \
- ((full) = ((struct FULL_SIGCONTEXT *) (partial)))
-
-#define INVALID_TRAP -1
-\f
-enum trap_state
-{
- trap_state_trapped,
- trap_state_exit,
- trap_state_suspend,
- trap_state_query,
- trap_state_recover,
- trap_state_exitting_soft,
- trap_state_exitting_hard
-};
-
-extern enum trap_state EXFUN (OS_set_trap_state, (enum trap_state state));
-extern void EXFUN
- (trap_handler,
- (CONST char * message,
- int signo,
- SIGINFO_T info,
- struct FULL_SIGCONTEXT * scp));
-extern void EXFUN (hard_reset, (struct FULL_SIGCONTEXT * scp));
-extern void EXFUN (soft_reset, (void));
-
-#endif /* SCM_DOSTRAP_H */
+++ /dev/null
-/* -*-C-*-
-
-$Id: dostterm.c,v 1.3 1999/01/02 06:11:34 cph Exp $
-
-Copyright (c) 1992, 1999 Massachusetts Institute of Technology
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or (at
-your option) any later version.
-
-This program is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-/* termcap(3) interface for Scheme -- Only a subset needed for DOS. */
-
-#include "scheme.h"
-#include "prims.h"
-#include "osterm.h"
-
-extern char * EXFUN (tparam, (char *, char*, int, int, ...));
-extern char * EXFUN (tgoto, (char *, int, int));
-extern int EXFUN (tputs, (char *, int, void (*) (int)));
-extern char * BC;
-extern char * UP;
-extern char PC;
-extern short ospeed;
-
-#ifndef TERMCAP_BUFFER_SIZE
-#define TERMCAP_BUFFER_SIZE 2048
-#endif
-
-static char tputs_output [TERMCAP_BUFFER_SIZE];
-static char * tputs_output_scan;
-
-static void
-DEFUN (tputs_write_char, (c), int c)
-{
- (*tputs_output_scan++) = c;
- return;
-}
-\f
-DEFINE_PRIMITIVE ("TERMCAP-PARAM-STRING", Prim_termcap_param_string, 5, 5, 0)
-{
- PRIMITIVE_HEADER (5);
- {
- char * s =
- (tparam ((STRING_ARG (1)), 0, 0,
- (arg_nonnegative_integer (2)),
- (arg_nonnegative_integer (3)),
- (arg_nonnegative_integer (4)),
- (arg_nonnegative_integer (5))));
- SCHEME_OBJECT result = (char_pointer_to_string ((unsigned char *) s));
- free (s);
- PRIMITIVE_RETURN (result);
- }
-}
-
-DEFINE_PRIMITIVE ("TERMCAP-GOTO-STRING", Prim_termcap_goto_string, 5, 5, 0)
-{
- PRIMITIVE_HEADER (5);
- {
- BC = (((ARG_REF (4)) == SHARP_F) ? 0 : (STRING_ARG (4)));
- UP = (((ARG_REF (5)) == SHARP_F) ? 0 : (STRING_ARG (5)));
- PRIMITIVE_RETURN
- (char_pointer_to_string
- ((unsigned char *)
- (tgoto ((STRING_ARG (1)),
- (arg_nonnegative_integer (2)),
- (arg_nonnegative_integer (3))))));
- }
-}
-
-DEFINE_PRIMITIVE ("TERMCAP-PAD-STRING", Prim_termcap_pad_string, 4, 4, 0)
-{
- PRIMITIVE_HEADER (4);
- ospeed = (arg_baud_index (3));
- PC = (((ARG_REF (4)) == SHARP_F) ? '\0' : ((STRING_ARG (4)) [0]));
- tputs_output_scan = tputs_output;
- tputs ((STRING_ARG (1)), (arg_nonnegative_integer (2)), tputs_write_char);
- PRIMITIVE_RETURN
- (memory_to_string ((tputs_output_scan - tputs_output),
- ((unsigned char *) tputs_output)));
-}
+++ /dev/null
-/* -*-C-*-
-
-$Id: dostty.c,v 1.4 1999/01/02 06:11:34 cph Exp $
-
-Copyright (c) 1992, 1999 Massachusetts Institute of Technology
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or (at
-your option) any later version.
-
-This program is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-#include "msdos.h"
-#include "ostty.h"
-#include "osenv.h"
-#include "dosio.h"
-#include "dosterm.h"
-\f
-/* Standard Input and Output */
-
-static Tchannel input_channel;
-static Tchannel output_channel;
-int tty_x_size;
-int tty_y_size;
- /* 1-based values */
-static char * tty_command_beep;
-static char * tty_command_clear;
-
-Tchannel
-DEFUN_VOID (OS_tty_input_channel)
-{
- return (input_channel);
-}
-
-Tchannel
-DEFUN_VOID (OS_tty_output_channel)
-{
- return (output_channel);
-}
-
-unsigned int
-DEFUN_VOID (OS_tty_x_size)
-{
- return (tty_x_size);
-}
-
-unsigned int
-DEFUN_VOID (OS_tty_y_size)
-{
- return (tty_y_size);
-}
-
-CONST char *
-DEFUN_VOID (OS_tty_command_beep)
-{
- return (tty_command_beep);
-}
-
-CONST char *
-DEFUN_VOID (OS_tty_command_clear)
-{
- return (tty_command_clear);
-}
-\f
-#ifndef TERMCAP_BUFFER_SIZE
-#define TERMCAP_BUFFER_SIZE 0
-#endif
-
-#ifndef DEFAULT_TTY_X_SIZE
-#define DEFAULT_TTY_X_SIZE 80
-#endif
-
-#ifndef DEFAULT_TTY_Y_SIZE
-#define DEFAULT_TTY_Y_SIZE 25
-#endif
-
-void
-pc_gestalt_screen_x_size (void)
-{
- char *psTemp;
-
- psTemp = (getenv ("MITSCHEME_COLUMNS"));
- if (psTemp == NULL)
- {
- union REGS regs;
-
- regs.h.ah = 0x0F;
- regs.h.al = 0x00;
- int10h (®s, ®s);
- tty_x_size = regs.h.ah;
- }
- else
- {
- tty_x_size = (atoi (psTemp));
- if (tty_x_size == 0)
- tty_x_size = DEFAULT_TTY_X_SIZE; /* atoi failed, use default */
- }
- return;
-}
-
-void
-pc_gestalt_screen_y_size (void)
-{
- char *psTemp;
-
- psTemp = (getenv ("MITSCHEME_LINES"));
- if (psTemp == NULL)
- {
- union REGS regs;
-
- regs.x.ax = 0x1130;
- regs.h.bh = 0x00;
- regs.h.dl = DEFAULT_TTY_Y_SIZE-1;
- int10h (®s, ®s);
- tty_y_size = regs.h.dl + 1;
- }
- else
- {
- tty_y_size = (atoi (psTemp));
- if (tty_y_size == 0)
- tty_y_size = DEFAULT_TTY_Y_SIZE; /* atoi failed, use default */
- }
- return;
-}
-
-void
-DEFUN_VOID (DOS_initialize_tty)
-{
- extern Tchannel EXFUN (OS_open_fd, (int fd));
- input_channel = (OS_open_fd (STDIN_FILENO));
- (CHANNEL_INTERNAL (input_channel)) = 1;
- output_channel = (OS_open_fd (STDOUT_FILENO));
- (CHANNEL_INTERNAL (output_channel)) = 1;
- tty_x_size = (-1);
- tty_y_size = (-1);
- tty_command_beep = ALERT_STRING;
- tty_command_clear = "\033[2J";
-
- /* Figure out the size of the terminal. Tries environment variables.
- If that fails, use default values. */
-
- pc_gestalt_screen_x_size ();
- pc_gestalt_screen_y_size ();
- return;
-}
-\f
-/* Fake TERMCAP capability */
-short ospeed;
-char PC;
-
-int
-tputs (string, nlines, outfun)
- register char * string;
- int nlines;
- register int (*outfun) ();
-{
- register int padcount = 0;
-
- if (string == (char *) 0)
- return;
- while (*string >= '0' && *string <= '9')
- {
- padcount += *string++ - '0';
- padcount *= 10;
- }
- if (*string == '.')
- {
- string++;
- padcount += *string++ - '0';
- }
- if (*string == '*')
- {
- string++;
- padcount *= nlines;
- }
- while (*string)
- (*outfun) (*string++);
-
- return (0);
-}
+++ /dev/null
-/* -*-C-*-
-
-$Id: dosutil.c,v 1.3 1999/01/02 06:11:34 cph Exp $
-
-Copyright (c) 1992, 1999 Massachusetts Institute of Technology
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or (at
-your option) any later version.
-
-This program is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-#include "msdos.h"
-#include "dosutil.h"
-#include <ctype.h>
-\f
-static CONST char *
-DEFUN (char_description_brief, (c), unsigned char c)
-{
- static char buffer [5];
- switch (c)
- {
- case ' ': return ("SPC");
- case '\t': return ("TAB");
- case '\r': return ("RET");
- case '\n': return ("LFD");
- case '\033': return ("ESC");
- case '\177': return ("DEL");
- default:
- if (c < ' ')
- {
- (buffer[0]) = '^';
- (buffer[1]) = (c + '@');
- (buffer[2]) = '\0';
- }
- else if (c < '\177')
- {
- (buffer[0]) = c;
- (buffer[1]) = '\0';
- }
- else
- {
- (buffer[0]) = '\\';
- (buffer[1]) = (c >> 6);
- (buffer[2]) = ((c >> 3) & 7);
- (buffer[3]) = (c & 7);
- (buffer[4]) = '\0';
- }
- return (buffer);
- }
-}
-
-CONST char *
-DEFUN (char_description, (c, long_p), unsigned char c AND int long_p)
-{
- static char buffer [64];
- CONST char * description = (char_description_brief (c));
- if (long_p)
- {
- int meta = (c >= 0200);
- int cc = (c & 0177);
- int control = (cc < 0040);
- if (meta || control)
- {
- sprintf (buffer, "`%s' (%s%s%c)",
- description,
- (meta ? "meta-" : ""),
- (control ? "control-" : ""),
- (control ? (cc + 0100) : cc));
- return (buffer);
- }
- }
- sprintf (buffer, "`%s'", description);
- return (buffer);
-}
-\f
-void
-DEFUN_VOID (DOS_initialize_userio)
-{
- return;
-}
-
-static void
-DEFUN (restore_input_state, (ap), PTR ap)
-{
- return;
-}
-
-void
-DEFUN_VOID (userio_buffered_input)
-{
- return;
-}
-
-char
-DEFUN_VOID (userio_read_char)
-{
- char c;
- while (1)
- {
- int nread;
-
- errno = 0;
- nread = (DOS_read (STDIN_FILENO, (&c), 1));
- if (nread == 1)
- break;
- if (errno != EINTR)
- {
- c = '\0';
- break;
- }
- }
- return (c);
-}
-
-char
-DEFUN_VOID (userio_read_char_raw)
-{
- transaction_begin ();
- {
- char c = (userio_read_char ());
- transaction_commit ();
- return (c);
- }
-}
-\f
-char
-DEFUN (userio_choose_option, (herald, prompt, choices),
- CONST char * herald AND
- CONST char * prompt AND
- CONST char ** choices)
-{
- while (1)
- {
- fputs (herald, stdout);
- putc ('\n', stdout);
- {
- CONST char ** scan = choices;
- while (1)
- {
- CONST char * choice = (*scan++);
- if (choice == 0)
- break;
- fprintf (stdout, " %s\n", choice);
- }
- }
- fputs (prompt, stdout);
- fflush (stdout);
- {
- char command = (userio_read_char_raw ());
- if ((command == '\0') && (errno != 0))
- return (command);
- putc ('\n', stdout);
- fflush (stdout);
- if (islower (command))
- command = (toupper (command));
- {
- CONST char ** scan = choices;
- while (1)
- {
- CONST char * choice = (*scan++);
- if (choice == 0)
- break;
- {
- char option = (*choice);
- if (islower (option))
- option = (toupper (option));
- if (command == option)
- return (option);
- }
- }
- }
- }
- }
-}
-
-int
-DEFUN (userio_confirm, (prompt), CONST char * prompt)
-{
- while (1)
- {
- fputs (prompt, stdout);
- fflush (stdout);
- switch (userio_read_char_raw ())
- {
- case 'y':
- case 'Y':
- return (1);
- case 'n':
- case 'N':
- return (0);
- case '\0':
- if (errno != 0)
- {
- /* IO problems, assume everything scrod. */
- fprintf (stderr, "Problems reading keyboard input -- exiting.\n");
- termination_eof ();
- }
- }
- }
-}
+++ /dev/null
-/* -*-C-*-
-
-$Id: dosutil.h,v 1.3 1999/01/02 06:11:34 cph Exp $
-
-Copyright (c) 1992, 1999 Massachusetts Institute of Technology
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or (at
-your option) any later version.
-
-This program is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-#ifndef SCM_UXUTIL_H
-#define SCM_UXUTIL_H
-
-#include "os.h"
-
-extern CONST char * EXFUN (char_description, (unsigned char c, int long_p));
-extern void EXFUN (userio_buffered_input, (void));
-extern char EXFUN (userio_read_char, (void));
-extern char EXFUN (userio_read_char_raw, (void));
-extern char EXFUN
- (userio_choose_option,
- (CONST char * herald, CONST char * prompt, CONST char ** choices));
-extern int EXFUN (userio_confirm, (CONST char * prompt));
-
-#endif /* SCM_UXUTIL_H */
+++ /dev/null
-;;; -*-Fundamental-*-
-;;;
-;;; $Id: bch-prm.lst,v 1.7 1999/01/02 06:11:34 cph Exp $
-;;;
-;;; Copyright (c) 1992-1999 Massachusetts Institute of Technology
-;;;
-;;; This program is free software; you can redistribute it and/or
-;;; modify it under the terms of the GNU General Public License as
-;;; published by the Free Software Foundation; either version 2 of the
-;;; License, or (at your option) any later version.
-;;;
-;;; This program is distributed in the hope that it will be useful,
-;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-;;; General Public License for more details.
-;;;
-;;; You should have received a copy of the GNU General Public License
-;;; along with this program; if not, write to the Free Software
-;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-;;;
-;;;; Shared files (Unix and DOS)
-artutl.c
-avltree.c
-bignum.c
-bigprm.c
-bitstr.c
-boot.c
-char.c
-comutl.c
-daemon.c
-debug.c
-dfloat.c
-error.c
-extern.c
-fasload.c
-fixnum.c
-flonum.c
-generic.c
-hooks.c
-hunk.c
-intern.c
-interp.c
-intprm.c
-list.c
-lookprm.c
-lookup.c
-missing.c
-obstack.c
-option.c
-osscheme.c
-ostty.c
-prim.c
-primutl.c
-prmcon.c
-ptrvec.c
-purutl.c
-regex.c
-rgxprim.c
-step.c
-storage.c
-string.c
-syntax.c
-sysprim.c
-term.c
-transact.c
-utils.c
-vector.c
-wind.c
-;;;; Generic OS primitive files
-prosenv.c
-prosfile.c
-prosfs.c
-prosio.c
-prosterm.c
-prostty.c
-;;;; DOS OS primitive files
-prdosenv.c
-prdosfs.c
-;;;; Bizarre DOS primitive files
-dosconio.c
-dosint10.c
-dostterm.c
-;;;; GC files
-bchdmp.c
-bchgcl.c
-bchmmg.c
-bchpur.c
-bchutl.c
+++ /dev/null
-artutl.obj
-avltree.obj
-bignum.obj
-bigprm.obj
-bitstr.obj
-boot.obj
-char.obj
-cmpauxmd.obj
-cmpint.obj
-comutl.obj
-daemon.obj
-debug.obj
-dfloat.obj
-error.obj
-extern.obj
-fasload.obj
-fixnum.obj
-flonum.obj
-generic.obj
-hooks.obj
-hunk.obj
-intern.obj
-interp.obj
-intext.obj
-intprm.obj
-list.obj
-lookprm.obj
-lookup.obj
-missing.obj
-obstack.obj
-option.obj
-osscheme.obj
-ostty.obj
-outf.obj
-prim.obj
-primutl.obj
-prmcon.obj
-ptrvec.obj
-purutl.obj
-regex.obj
-rgxprim.obj
-step.obj
-storage.obj
-string.obj
-syntax.obj
-sysprim.obj
-term.obj
-tparam.obj
-transact.obj
-utils.obj
-vector.obj
-wind.obj
-
-prosenv.obj
-prosfile.obj
-prosfs.obj
-prosio.obj
-prosterm.obj
-prostty.obj
-
-prdosenv.obj
-prdosfs.obj
-
-dosasutl.obj
-dosconio.obj
-dosenv.obj
-dosexcp.obj
-dosfile.obj
-dosfs.obj
-dosi10.obj
-dosint10.obj
-dosio.obj
-doskbd.obj
-doskbutl.obj
-dossig.obj
-dossys.obj
-dostop.obj
-dostrap.obj
-dostterm.obj
-dostty.obj
-dosutil.obj
-dosx32.obj
-dosxcutl.obj
-
-bchdmp.obj
-bchgcl.obj
-bchmmg.obj
-bchpur.obj
-bchutl.obj
-bchdef.obj
-
--lm
--mx
--3
--obchscheme.exe
+++ /dev/null
-@echo off
-rem MIT Scheme microcode configuration script for DOS
-rem
-rem Copyright (c) 1993 Massachusetts Institute of Technology
-rem
-rem $Id: config.bat,v 1.2 1993/06/24 15:18:04 gjr Exp $
-rem
-copy cmpintmd\i386.h cmpintmd.h
-copy cmpauxmd\i386-dos.asm cmpauxmd.asm
-copy dosutl\*.lst .
-copy dosutl\*.h .
-copy dosutl\makefile .
+++ /dev/null
-/* float.h */
-/* Produced by hard-params version 4.1, CWI, Amsterdam */
-
-#define FLT_RADIX 2
-#define FLT_MANT_DIG 24
-#define FLT_DIG 6
-#define FLT_ROUNDS 1
-#define FLT_EPSILON ((float)1.19209290e-007)
-#define FLT_MIN_EXP (-125)
-#define FLT_MIN ((float)1.17549435e-038)
-#define FLT_MIN_10_EXP (-37)
-#define FLT_MAX_EXP 128
-#define FLT_MAX ((float)3.40282347e+038)
-#define FLT_MAX_10_EXP 38
-
-#define DBL_MANT_DIG 53
-#define DBL_DIG 15
-#define DBL_EPSILON 2.2204460492503130e-016
-
-/* *** WARNING: Possibly bad output from printf above */
-/* expected value around 2.2204460492503130e-16, bit pattern:
- 00000000 00000000 00000000 00000000 00000000 00000000 10110000 00111100 */
-/* sscanf gave 2.2204460492503126e-016, bit pattern:
- 11111111 11111111 11111111 11111111 11111111 11111111 10101111 00111100 */
-/* difference= 2.4651903288156620e-032 */
-
-#define DBL_MIN_EXP (-1021)
-#define DBL_MIN 2.2250738585072018e-308
-#define DBL_MIN_10_EXP (-307)
-#define DBL_MAX_EXP 1024
-#define DBL_MAX 1.7976931348623155e+308
-
-/* *** WARNING: Possibly bad output from printf above */
-/* expected value around 1.7976931348623164e308, bit pattern:
- 11111111 11111111 11111111 11111111 11111111 11111111 11101111 01111111 */
-/* sscanf gave inf, bit pattern:
- 00000000 00000000 00000000 00000000 00000000 00000000 11110000 01111111 */
-/* difference= -inf */
-
-#define DBL_MAX_10_EXP 308
-
+++ /dev/null
-/* limits.h */
-/* Produced by hard-params version 4.1, CWI, Amsterdam */
-
-#define CHAR_BIT 8
-#define CHAR_MAX 127
-#define CHAR_MIN (-128)
-#define SCHAR_MAX 127
-#define SCHAR_MIN (-128)
-#define UCHAR_MAX 255
-#define SHRT_MAX 32767
-#define SHRT_MIN (-32768)
-#define INT_MAX 2147483647
-#define INT_MIN (-2147483648)
-#define LONG_MAX 2147483647
-#define LONG_MIN (-2147483648)
-#define USHRT_MAX 65535
-#define UINT_MAX 4294967295
-#define ULONG_MAX 4294967295
+++ /dev/null
-### -*- Fundamental -*-
-###
-### $Id: makefile,v 1.13 1999/01/02 06:11:34 cph Exp $
-###
-### Copyright (c) 1992-1999 Massachusetts Institute of Technology
-###
-### This program is free software; you can redistribute it and/or
-### modify it under the terms of the GNU General Public License as
-### published by the Free Software Foundation; either version 2 of the
-### License, or (at your option) any later version.
-###
-### This program is distributed in the hope that it will be useful,
-### but WITHOUT ANY WARRANTY; without even the implied warranty of
-### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-### General Public License for more details.
-###
-### You should have received a copy of the GNU General Public License
-### along with this program; if not, write to the Free Software
-### Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-###
-
-#### Makefile for Scheme on DOS
-
-TERMCAP_OBJECTS = dostterm.obj tparam.obj
-TERMCAP_SOURCES = dostterm.c tparam.c
-TERMCAP_LIBS =
-GRAPHICS_SOURCES = # dosfg.c
-GRAPHICS_OBJECTS = # dosfg.obj
-GRAPHICS_LIBS = # fgp.lib
-MACHINE_SWITCHES = -3 -mx -DNO_CONST -Di386
-MACHINE_SOURCES = cmpint.c cmpauxmd.asm
-MACHINE_OBJECTS = cmpint.obj cmpauxmd.obj
-GC_HEAD_FILES = gccode.h cmpgc.h cmpintmd.h
-USER_PRIM_SOURCES = dosint10.c dosi10.asm dosx32.c
-USER_PRIM_OBJECTS = dosint10.obj dosi10.obj dosx32.obj
-USER_LIBS =
-CC = ztc
-M4 = # m4
-AS = mlx
-LDFLAGS =
-CFLAGS = -DMIT_SCHEME $(MACHINE_SWITCHES) -D__STDC__ -Jm -o
-
-all: bintopsb.exe psbtobin.exe scheme.exe bchschem.exe # mswload.exe
-
-.c.obj:
- $(CC) $(CFLAGS) -c $*.c
-.c.s:
- $(CC) $(CFLAGS) -S $*.c
-.m4.asm:
- $(M4) -DTYPE_CODE_LENGTH=6 $*.m4 > $*.asm
-.asm.obj:
- $(AS) /Zm /Cp /c $*.asm
-
-SCHEME_SOURCES = $(TERMCAP_SOURCES) $(GRAPHICS_SOURCES) $(USER_PRIM_SOURCES) missing.c
-SCHEME_OBJECTS = $(TERMCAP_OBJECTS) $(GRAPHICS_OBJECTS) $(USER_PRIM_OBJECTS) missing.obj
-SCHEME_LIB = $(USER_LIBS) $(GRAPHICS_LIBS) $(TERMCAP_LIBS) -lm
-CORE_SOURCES = \
-$(MACHINE_SOURCES) \
-artutl.c \
-avltree.c \
-bignum.c \
-bigprm.c \
-bitstr.c \
-boot.c \
-char.c \
-comutl.c \
-daemon.c \
-debug.c \
-dfloat.c \
-error.c \
-extern.c \
-fasload.c \
-fixnum.c \
-flonum.c \
-generic.c \
-hooks.c \
-hunk.c \
-intern.c \
-interp.c \
-intprm.c \
-list.c \
-lookprm.c \
-lookup.c \
-obstack.c \
-option.c \
-osscheme.c \
-ostty.c \
-outf.c \
-prim.c \
-primutl.c \
-prmcon.c \
-ptrvec.c \
-purutl.c \
-regex.c \
-rgxprim.c \
-step.c \
-storage.c \
-string.c \
-syntax.c \
-sysprim.c \
-term.c \
-transact.c \
-utils.c \
-vector.c \
-wind.c
-
-STD_GC_SOURCES = \
-fasdump.c \
-gcloop.c \
-memmag.c \
-purify.c \
-wabbit.c
-
-BCH_GC_SOURCES = \
-bchdmp.c \
-bchgcl.c \
-bchmmg.c \
-bchpur.c \
-bchutl.c
-
-# DOS
-DOS_SOURCES = \
-intext.c \
-dosfs.c \
-dosenv.c \
-dosfile.c \
-dosio.c \
-dosconio.c \
-dostty.c \
-dostop.c \
-dosutil.c \
-dossig.c \
-dostrap.c \
-prdosfs.c \
-dossys.c \
-doskbd.c \
-dosexcp.c \
-doskbutl.asm \
-dosxcutl.asm \
-dosasutl.asm
-
-DOS_OBJECTS = \
-intext.obj \
-dosfs.obj \
-dosenv.obj \
-dosfile.obj \
-dosio.obj \
-dosconio.obj \
-dostty.obj \
-dostop.obj \
-dosutil.obj \
-dossig.obj \
-dostrap.obj \
-dossys.obj \
-doskbd.obj \
-dosexcp.obj \
-doskbutl.obj \
-dosxcutl.obj \
-dosasutl.obj
-
-OS_PRIM_SOURCES = \
-prosfile.c \
-prosfs.c \
-prosio.c \
-prosterm.c \
-prostty.c \
-prosenv.c \
-prdosfs.c \
-prdosenv.c
-# prosproc.c \
-# pruxsock.c
-
-HEAD_FILES = scheme.tch prims.h zones.h locks.h bignum.h \
- $(GC_HEAD_FILES) trap.h lookup.h history.h cmpint.h
-
-CORE_OBJECTS = \
-$(MACHINE_OBJECTS) \
-artutl.obj \
-avltree.obj \
-bignum.obj \
-bigprm.obj \
-bitstr.obj \
-boot.obj \
-char.obj \
-comutl.obj \
-daemon.obj \
-debug.obj \
-dfloat.obj \
-error.obj \
-extern.obj \
-fasload.obj \
-fixnum.obj \
-flonum.obj \
-generic.obj \
-hooks.obj \
-hunk.obj \
-intern.obj \
-interp.obj \
-intprm.obj \
-list.obj \
-lookprm.obj \
-lookup.obj \
-obstack.obj \
-option.obj \
-osscheme.obj \
-ostty.obj \
-outf.obj \
-prim.obj \
-primutl.obj \
-prmcon.obj \
-ptrvec.obj \
-purutl.obj \
-regex.obj \
-rgxprim.obj \
-step.obj \
-storage.obj \
-string.obj \
-syntax.obj \
-sysprim.obj \
-term.obj \
-transact.obj \
-utils.obj \
-vector.obj \
-wind.obj
-
-OS_PRIM_OBJECTS = \
-prosfile.obj \
-prosfs.obj \
-prosio.obj \
-prosterm.obj \
-prosenv.obj \
-prostty.obj \
-prdosenv.obj \
-prdosfs.obj
-# prosproc.obj \
-# pruxsock.obj
-
-STD_GC_OBJECTS = \
-fasdump.obj \
-gcloop.obj \
-memmag.obj \
-purify.obj \
-wabbit.obj
-
-BCH_GC_OBJECTS = \
-bchdmp.obj \
-bchgcl.obj \
-bchmmg.obj \
-bchpur.obj \
-bchutl.obj
-
-SOURCES = $(CORE_SOURCES) $(STD_GC_SOURCES)
-OBJECTS = $(CORE_OBJECTS) $(STD_GC_OBJECTS) $(DOS_OBJECTS) $(OS_PRIM_OBJECTS) usrdef.obj
-
-BCHSOURCES = $(CORE_SOURCES) $(BCH_GC_SOURCES)
-BCHOBJECTS = $(CORE_OBJECTS) $(BCH_GC_OBJECTS) $(DOS_OBJECTS) $(OS_PRIM_OBJECTS) bchdef.obj
-
-XTNDRLIB = x32v.lib
-
-scheme.exe : $(OBJECTS) $(SCHEME_OBJECTS) scm-ztc.lst
- $(CC) @scm-ztc.lst $(XTNDRLIB)
-bchschem.exe : $(BCHOBJECTS) $(SCHEME_OBJECTS) bch-ztc.lst
- $(CC) @bch-ztc.lst $(XTNDRLIB)
-findprim.exe : findprim.obj
- $(CC) findprim.obj $(MACHINE_SWITCHES) $(XTNDRLIB)
-bintopsb.exe : bintopsb.obj missing.obj
- $(CC) bintopsb.obj missing.obj $(MACHINE_SWITCHES) $(LDFLAGS) $(XTNDRLIB)
-psbtobin.exe : psbtobin.obj missing.obj
- $(CC) psbtobin.obj missing.obj $(MACHINE_SWITCHES) $(LDFLAGS) $(XTNDRLIB)
-breakup.exe : breakup.obj
- $(CC) breakup.obj $(MACHINE_SWITCHES) $(LDFLAG)
-wsize.exe : wsize.obj
- $(CC) wsize.obj $(MACHINE_SWITCHES) $(LDFLAGS)
-ppband.exe : ppband.obj
- $(CC) ppband.obj $(MACHINE_SWITCHES) $(LDFLAGS) $(XTNDRLIB)
-
-usrdef.c : $(SCHEME_SOURCES) $(SOURCES) $(OS_PRIM_SOURCES) dosconio.c usrdef.tch findprim.exe scm-prm.lst
- rm -f usrdef.c
- ./findprim -o usrdef.c -l .\scm-prm.lst
-
-bchdef.c : $(SCHEME_SOURCES) $(BCHSOURCES) $(OS_PRIM_SOURCES) usrdef.tch findprim.exe bch-prm.lst
- rm -f bchdef.c
- ./findprim -o bchdef.c -l .\bch-prm.lst
-
-primitive_tables :
- rm -f usrdef.c usrdef.obj bchdef.c bchdef.obj
-
-COMMON_OBJECTS = $(CORE_OBJECTS) $(STD_GC_OBJECTS) $(DOS_OBJECTS) $(OS_PRIM_OBJECTS)
-
-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 float.h
- rm -f scheme.tch
- touch scheme.tch
-
-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 psbmap.tch
- touch psbmap.tch
-
-usrdef.tch : usrdef.h config.h object.h prim.h
- rm -f usrdef.tch
- touch usrdef.tch
-
-# Zortech MAKE seems not to allow redirection
-# limits.h : hard-par.exe
-# -./hard-par -l > limits.h
-
-# float.h : hard-par.exe
-# -./hard-par -f > float.h
-
-hard-par.exe : hard-par.c
- $(CC) hard-par.c $(MACHINE_SWITCHES) -DNO_SIG -DNO_SC $(LDFLAGS)
-
-foo $(USER_PRIM_OBJECTS) : $(HEAD_FILES)
-interp.obj : scheme.tch locks.h trap.h lookup.h history.h cmpint.h zones.h prmcon.h
-hooks.obj : scheme.tch prims.h winder.h history.h
-utils.obj : scheme.tch prims.h winder.h history.h cmpint.h syscall.h
-primutl.obj : scheme.tch os.h prims.h usrdef.h prename.h syscall.h \
- avltree.h $(GC_HEAD_FILES)
-hunk.obj list.obj step.obj vector.obj sysprim.obj daemon.obj prim.obj extern.obj : \
- scheme.tch prims.h
-lookup.obj debug.obj intern.obj : scheme.tch prims.h lookup.h trap.h locks.h
-fasload.obj : scheme.tch prims.h osscheme.h osfile.h osio.h $(GC_HEAD_FILES) \
- trap.h option.h prmcon.h load.c fasl.h
-fasdump.obj : scheme.tch prims.h osio.h osfile.h osfs.h $(GC_HEAD_FILES) \
- trap.h lookup.h fasl.h dump.c
-memmag.obj : scheme.tch prims.h $(GC_HEAD_FILES) memmag.h
-gcloop.obj : scheme.tch $(GC_HEAD_FILES)
-purify.obj : scheme.tch prims.h $(GC_HEAD_FILES) zones.h
-wabbit.obj : scheme.tch $(GC_HEAD_FILES)
-purutl.obj : scheme.tch prims.h $(GC_HEAD_FILES) zones.h
-comutl.obj : scheme.tch prims.h
-artutl.obj : scheme.tch
-avltree.obj : ansidecl.h avltree.h
-bignum.obj : scheme.tch bignmint.h limits.h
-bigprm.obj flonum.obj intprm.obj : scheme.tch prims.h zones.h
-generic.obj : scheme.tch prims.h
-fixnum.obj : scheme.tch prims.h mul.c
-storage.obj : scheme.tch gctype.c
-char.obj string.obj dfloat.obj : scheme.tch prims.h
-dostterm.obj : scheme.tch prims.h osterm.h
-boot.obj : scheme.tch prims.h version.h option.h ostop.h
-option.obj : ansidecl.h option.h
-term.obj : scheme.tch
-missing.obj : config.h
-BCHGCC_H = bchgcc.h oscond.h $(GC_HEAD_FILES)
-bchdmp.obj : scheme.tch prims.h dosio.h osio.h osfile.h trap.h lookup.h \
- $(BCHGCC_H) fasl.h dump.c
-bchdrn.obj : ansidecl.h bchdrn.h
-bchmmg.obj : scheme.tch prims.h msdos.h $(BCHGCC_H) option.h bchdrn.h memmag.h
-bchgcl.obj : scheme.tch $(BCHGCC_H)
-bchpur.obj : scheme.tch prims.h $(BCHGCC_H) zones.h
-bchutl.obj : ansidecl.h
-syntax.obj : scheme.tch prims.h edwin.h syntax.h
-bitstr.obj : scheme.tch prims.h bitstr.h
-regex.obj : scheme.tch syntax.h regex.h
-rgxprim.obj : scheme.tch prims.h edwin.h syntax.h regex.h
-bintopsb.obj : psbmap.tch trap.h limits.h fasl.h load.c bltdef.h
-psbtobin.obj : psbmap.tch float.h fasl.h dump.c
-ppband.obj : ansidecl.h config.h errors.h types.h const.h object.h \
- $(GC_HEAD_FILES) sdata.h load.c fasl.h
-
-fft.obj : scheme.tch prims.h zones.h array.h image.h
-array.obj image.obj : scheme.tch prims.h array.h
-cmpint.obj : scheme.tch prim.h $(GC_HEAD_FILES)
-osscheme.obj : scheme.tch posixtyp.h os.h osscheme.h
-ostty.obj : ansidecl.h oscond.h posixtyp.h os.h ostty.h osscheme.h
-error.obj ptrvec.obj transact.obj : ansidecl.h dstack.h
-wind.obj : ansidecl.h dstack.h obstack.h
-obstack.obj : obstack.h
-
-OS_PRIM_DEPENDENCIES = scheme.tch prims.h posixtyp.h os.h
-prosenv.obj : osenv.h ostop.h $(OS_PRIM_DEPENDENCIES)
-prosfile.obj : osfile.h $(OS_PRIM_DEPENDENCIES)
-prosfs.obj : osfs.h $(OS_PRIM_DEPENDENCIES)
-prosio.obj : osio.h $(OS_PRIM_DEPENDENCIES)
-prosproc.obj : osproc.h $(OS_PRIM_DEPENDENCIES)
-prosterm.obj : osterm.h osio.h $(OS_PRIM_DEPENDENCIES)
-prostty.obj : ostty.h osctty.h ossig.h osfile.h osio.h $(OS_PRIM_DEPENDENCIES)
-prmcon.obj : scheme.tch prims.h prmcon.h $(OS_PRIM_DEPENDENCIES)
-
-DOS_DEPENDENCIES = oscond.h ansidecl.h posixtyp.h intext.h \
- dstack.h os.h osscheme.h msdos.h dossys.h syscall.h
-dosenv.obj : osenv.h $(DOS_DEPENDENCIES)
-dosfile.obj : osfile.h osio.h dosio.h $(DOS_DEPENDENCIES)
-dosfs.obj : osfs.h $(DOS_DEPENDENCIES)
-dosio.obj : osio.h dosio.h $(DOS_DEPENDENCIES)
-dosconio.obj : scheme.tch prims.h dosscan.h osio.h dosio.h $(DOS_DEPENDENCIES)
-dostop.obj : ostop.h dostop.h osctty.h dosutil.h errors.h option.h $(DOS_DEPENDENCIES)
-dostty.obj : ostty.h osenv.h osio.h dosio.h osterm.h dosterm.h $(DOS_DEPENDENCIES)
-dosutil.obj : dosutil.h $(DOS_DEPENDENCIES)
-dossig.obj : ossig.h osctty.h ostty.h critsec.h dosexcp.h doskbd.h $(DOS_DEPENDENCIES)
-dostrap.obj: dostrap.h dosexcp.h $(DOS_DEPENDENCIES)
-dossys.obj: dossys.h
-dosexcp.obj : dosexcp.h dossys.h dosinsn.h
-doskbd.obj : doskbd.h dossys.h dosinsn.h
-dosasutl.obj : dosasutl.asm
-doskbutl.obj : doskbutl.asm
-dosxcutl.obj : dosxcutl.asm
-dosint10.obj: dosint10.c dosint10.h
-dosi10.obj: dosi10.asm
-dosx32.obj: dosx32.c
-prdosenv.obj : $(DOS_DEPENDENCIES)
-prdosfs.obj : $(DOS_DEPENDENCIES) scheme.h prims.h osfs.h
-cmpauxmd.obj : cmpauxmd.asm
-
-clean:
- del *.tch
- del *.obj
- del *.exe
-
-unconfig:
- del cmpintmd.h
- del cmpauxmd.asm
- del float.h
- del limits.h
- del makefile
- del *.lst
-
-
+++ /dev/null
-;;; -*-Fundamental-*-
-;;;
-;;; $Id: scm-prm.lst,v 1.7 1999/01/02 06:11:34 cph Exp $
-;;;
-;;; Copyright (c) 1992-1999 Massachusetts Institute of Technology
-;;;
-;;; This program is free software; you can redistribute it and/or
-;;; modify it under the terms of the GNU General Public License as
-;;; published by the Free Software Foundation; either version 2 of the
-;;; License, or (at your option) any later version.
-;;;
-;;; This program is distributed in the hope that it will be useful,
-;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-;;; General Public License for more details.
-;;;
-;;; You should have received a copy of the GNU General Public License
-;;; along with this program; if not, write to the Free Software
-;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-;;;
-;;;; Shared files (Unix and DOS)
-artutl.c
-avltree.c
-bignum.c
-bigprm.c
-bitstr.c
-boot.c
-char.c
-comutl.c
-daemon.c
-debug.c
-dfloat.c
-error.c
-extern.c
-fasload.c
-fixnum.c
-flonum.c
-generic.c
-hooks.c
-hunk.c
-intern.c
-interp.c
-intprm.c
-list.c
-lookprm.c
-lookup.c
-missing.c
-obstack.c
-option.c
-osscheme.c
-ostty.c
-prim.c
-primutl.c
-prmcon.c
-ptrvec.c
-purutl.c
-regex.c
-rgxprim.c
-step.c
-storage.c
-string.c
-syntax.c
-sysprim.c
-term.c
-transact.c
-utils.c
-vector.c
-wind.c
-;;;; Generic OS primitive files
-prosenv.c
-prosfile.c
-prosfs.c
-prosio.c
-prosterm.c
-prostty.c
-;;;; DOS OS primitive files
-prdosenv.c
-prdosfs.c
-;;;; Bizarre DOS primitive files
-dosconio.c
-dosint10.c
-dostterm.c
-;;;; GC files
-fasdump.c
-gcloop.c
-memmag.c
-purify.c
+++ /dev/null
-artutl.obj
-avltree.obj
-bignum.obj
-bigprm.obj
-bitstr.obj
-boot.obj
-char.obj
-cmpauxmd.obj
-cmpint.obj
-comutl.obj
-daemon.obj
-debug.obj
-dfloat.obj
-error.obj
-extern.obj
-fasload.obj
-fixnum.obj
-flonum.obj
-generic.obj
-hooks.obj
-hunk.obj
-intern.obj
-interp.obj
-intext.obj
-intprm.obj
-list.obj
-lookprm.obj
-lookup.obj
-missing.obj
-obstack.obj
-option.obj
-osscheme.obj
-ostty.obj
-outf.obj
-prim.obj
-primutl.obj
-prmcon.obj
-ptrvec.obj
-purutl.obj
-regex.obj
-rgxprim.obj
-step.obj
-storage.obj
-string.obj
-syntax.obj
-sysprim.obj
-term.obj
-tparam.obj
-transact.obj
-utils.obj
-vector.obj
-wind.obj
-
-prosenv.obj
-prosfile.obj
-prosfs.obj
-prosio.obj
-prosterm.obj
-prostty.obj
-
-prdosenv.obj
-prdosfs.obj
-
-dosasutl.obj
-dosconio.obj
-dosenv.obj
-dosexcp.obj
-dosfile.obj
-dosfs.obj
-dosi10.obj
-dosint10.obj
-dosio.obj
-doskbd.obj
-doskbutl.obj
-dossig.obj
-dossys.obj
-dostop.obj
-dostrap.obj
-dostterm.obj
-dostty.obj
-dosutil.obj
-dosx32.obj
-dosxcutl.obj
-
-fasdump.obj
-gcloop.obj
-memmag.obj
-purify.obj
-usrdef.obj
-
--lm
--mx
--3
--oscheme.exe
+++ /dev/null
-/* -*-C-*-
-
-$Id: dosx32.c,v 1.7 1999/01/02 06:11:34 cph Exp $
-
-Copyright (c) 1992-1999 Massachusetts Institute of Technology
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or (at
-your option) any later version.
-
-This program is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-#include <int.h>
-#include <stdio.h>
-#include <process.h>
-#include "scheme.h"
-#include "msdos.h"
-#include "dosio.h"
-#include "dossys.h"
-
-#ifdef getDS
-#undef getDS
-#endif
-
-#ifdef getCS
-#undef getCS
-#endif
-
-extern unsigned short EXFUN (getCS, (void));
-extern unsigned short EXFUN (getDS, (void));
-\f
-/* Exports */
-
-extern int EXFUN (under_X32_p, (void));
-extern int EXFUN (X32_lock_scheme_microcode, (void));
-extern int EXFUN (X32_interrupt_restore, (unsigned));
-extern int EXFUN (X32_int_intercept, (unsigned, void (*) (void), PTR));
-
-int
-DEFUN_VOID (under_X32_p)
-{
- union REGS regs;
-
- regs.x.bx = (getDS ());
- regs.x.ax = 0x3504;
- intdos (®s, ®s);
- return ((regs.e.flags & 1) == 0);
-}
-
-#define I486_PAGE_SIZE 4096
-
-#define OPERATION_LOCK 0
-#define OPERATION_UNLOCK 1
-
-static unsigned short x32_lock_methods[2] = { 0x501, 0x601 };
-
-static int
-DEFUN (lock_unlock, (operation, segment, offset, size),
- unsigned short operation
- AND unsigned short segment
- AND PTR offset
- AND unsigned long size)
-{
- union REGS regs;
- struct SREGS sregs;
- unsigned long base;
- unsigned long bound;
- unsigned long page_aligned_size;
-
- base = ((unsigned long) offset);
- page_aligned_size = size;
-
- bound = (base + size);
- base = (base & (~ (I486_PAGE_SIZE - 1)));
- bound = ((bound + (I486_PAGE_SIZE - 1)) & (~ (I486_PAGE_SIZE - 1)));
- page_aligned_size = (bound - base);
-
- regs.x.ax = 0x252b;
- regs.x.bx = x32_lock_methods[operation];
- regs.e.edx = page_aligned_size;
- regs.e.ecx = base;
- segread (&sregs);
- sregs.es = segment;
- intdosx (®s, ®s, &sregs);
- return (((regs.e.flags & 1) != 0) ? -1 : 0);
-}
-\f
-static int
-DEFUN (lock_region, (segment, offset, size),
- unsigned short segment
- AND PTR offset
- AND unsigned long size)
-{
- return (lock_unlock (OPERATION_LOCK, segment, offset, size));
-}
-
-static int
-DEFUN (unlock_region, (segment, offset, size),
- unsigned short segment
- AND PTR offset
- AND unsigned long size)
-{
- return (lock_unlock (OPERATION_UNLOCK, segment, offset, size));
-}
-
-#define ES 0
-#define CS 1
-#define SS 2
-#define DS 3
-
-struct wired_area_s
-{
- int seg;
- PTR start;
- PTR end;
-};
-
-extern unsigned X32_locked_data_start;
-extern unsigned X32_locked_data_end;
-extern void EXFUN (X32_locked_code_start, (void));
-extern void EXFUN (X32_locked_code_end, (void));
-extern unsigned char scan_code_tables_start[];
-extern unsigned char scan_code_tables_end[];
-
-static struct wired_area_s wired_areas[] =
-{
- {
- DS,
- ((PTR) &X32_locked_data_start),
- ((PTR) &X32_locked_data_end)
- },
- {
- CS,
- ((PTR) X32_locked_code_start),
- ((PTR) X32_locked_code_end)
- },
- {
- DS,
- ((PTR) &scan_code_tables_start[0]),
- ((PTR) &scan_code_tables_end[0])
- }
-};
-\f
-#define N_WIRED_AREAS ((sizeof (wired_areas)) / (sizeof (struct wired_area_s)))
-
-int
-DEFUN_VOID (X32_lock_scheme_microcode)
-{
- int i, j;
- unsigned short cs, ds, sel;
-
- ds = (getDS ());
- cs = (getCS ());
-
- for (i = 0; i < N_WIRED_AREAS; i++)
- {
- sel = ((wired_areas[i].seg == CS) ? cs : ds);
- if ((lock_region (sel,
- wired_areas[i].start,
- (((unsigned long) wired_areas[i].end)
- - ((unsigned long) wired_areas[i].start))))
- != 0)
- {
- while (--i >= 0)
- {
- sel = ((wired_areas[i].seg == CS) ? cs : ds);
- (void) unlock_region (sel,
- wired_areas[i].start,
- (((unsigned long) wired_areas[i].end)
- - ((unsigned long) wired_areas[i].start)));
- }
- return (-1);
- }
- }
- return (0);
-}
-\f
-struct save_area
-{
- unsigned protected_offset;
- unsigned protected_segment;
- unsigned real_handler;
-};
-
-struct save_record
-{
- unsigned iv;
- struct save_area * area;
- struct save_record * next;
- void EXFUN ((* handler), (void));
-};
-
-static struct save_record
- * X32_save_areas = ((struct save_record *) NULL);
-
-static int
-DEFUN (X32_do_restore, (iv, area),
- unsigned iv
- AND struct save_area * area)
-{
- struct SREGS sregs;
- union REGS regs;
-
- segread (&sregs);
- regs.x.ax = 0x2507;
- regs.h.cl = iv;
- regs.e.edx = area->protected_offset;
- regs.e.ebx = area->real_handler;
- sregs.ds = area->protected_segment;
- intdosx (®s, ®s, &sregs);
- return (((regs.e.flags & 0x1) == 0) ? 0 : -1);
-}
-
-static int
-DEFUN (X32_do_install, (iv, handler),
- unsigned iv
- AND void EXFUN ((* handler), (void)))
-{
- struct SREGS sregs;
- union REGS regs;
-
- /* Set real and protected mode handler. */
-
- segread (&sregs);
- regs.x.ax = 0x2506;
- regs.h.cl = iv;
- regs.e.edx = ((unsigned) handler);
- sregs.ds = (getCS ());
- intdosx (®s, ®s, &sregs);
- if ((regs.e.flags & 1) != 0)
- return (-1);
- return (0);
-}
-\f
-static struct save_record **
-DEFUN (X32_find_interrupt, (iv), unsigned iv)
-{
- struct save_record ** loc, * this;
-
- loc = &X32_save_areas;
- this = (* loc);
- while (this != ((struct save_record *) NULL))
- {
- if (this->iv == iv)
- break;
- loc = &this->next;
- this = (*loc);
- }
- return (loc);
-}
-
-static int
-DEFUN (X32_remember_interrupt, (iv, area, handler),
- unsigned iv
- AND struct save_area * area
- AND void EXFUN ((* handler), (void)))
-{
- struct save_record * this;
-
- this = ((struct save_record *) (malloc (sizeof (struct save_record))));
- if (this == ((struct save_record *) NULL))
- return (-1);
- this->iv = iv;
- this->area = area;
- this->next = X32_save_areas;
- this->handler = handler;
- X32_save_areas = this;
- return (0);
-}
-\f
-int
-DEFUN (X32_interrupt_restore, (iv), unsigned iv)
-{
- struct save_record ** loc, * this;
-
- loc = (X32_find_interrupt (iv));
- this = (* loc);
- if ((this == ((struct save_record *) NULL))
- || ((X32_do_restore (iv, this->area)) != 0))
- return (-1);
-
- * loc = (this->next);
- free (this);
- return (0);
-}
-
-int
-DEFUN (X32_int_intercept, (iv, handler, ptr),
- unsigned iv
- AND void EXFUN ((* handler), (void))
- AND PTR ptr)
-{
- struct SREGS sregs;
- union REGS regs;
- struct save_area * area = ((struct save_area *) ptr);
-
- /* Preserve previous real mode interrupt handler */
-
- {
- regs.x.ax = 0x2503;
- regs.h.cl = iv;
- intdos (®s, ®s);
- if ((regs.e.flags & 1) != 0)
- return (-1);
- area->real_handler = regs.e.ebx;
- }
-
- /* Preserve previous protected mode interrupt handler. */
-
- {
- regs.x.ax = 0x2502;
- regs.h.cl = iv;
- segread (&sregs);
- intdosx (®s, ®s, &sregs);
- if ((regs.e.flags & 1) != 0)
- return (-1);
-
- area->protected_segment = sregs.es;
- area->protected_offset = regs.e.ebx;
- }
-
- if ((X32_do_install (iv, handler)) != 0)
- return (-1);
-
- if ((X32_remember_interrupt (iv, area, handler)) != 0)
- {
- (void) X32_do_restore (iv, area);
- return (-1);
- }
- return (0);
-}
-
-static int
-DEFUN (X32_DPMI_invoke, (proc, arg),
- int EXFUN ((* proc), (void *))
- AND void * arg)
-{
- /* Plain system does not work in X32 under DPMI
- in the presence of our timer interrupt handler.
- Disable the timer interrupt around the call to system.
- */
- static struct save_record ** ptimer_record = ((struct save_record **) NULL);
- struct save_record * timer_record;
- int result;
-
- if (ptimer_record == ((struct save_record **) NULL))
- {
- ptimer_record = (X32_find_interrupt (DOS_INTVECT_USER_TIMER_TICK));
- if (ptimer_record == ((struct save_record **) NULL))
- return (-1);
- }
-
- timer_record = * ptimer_record;
- if ((X32_do_restore (DOS_INTVECT_USER_TIMER_TICK, timer_record->area))
- != 0)
- return (-1);
-
- result = ((* proc) (arg));
-
- if ((X32_do_install (DOS_INTVECT_USER_TIMER_TICK, timer_record->handler))
- != 0)
- {
- /* We are massively scrod. */
- * ptimer_record = timer_record->next;
- return (-2);
- }
- /* Request a low-level timer interrupt, in case we missed it because
- we disabled it.
- */
- REQUEST_INTERRUPT (INT_Global_GC);
- return (result);
-}
-\f
-extern int EXFUN (X32_subprocess, (const char *, int, int, int));
-extern int EXFUN (X32_system, (const char *));
-extern int EXFUN (system, (const char *));
-
-static int
-DEFUN (dummy_system, (command), const char * command)
-{
- return (-1);
-}
-
-DEFUN (X32_DPMI_system, (command), const char * command)
-{
- return (X32_DPMI_invoke (((int EXFUN ((*), (void *))) system),
- ((void *) command)));
-}
-
-int EXFUN (which_system, (const char *));
-
-static int EXFUN ((* fsystem), (const char *)) = which_system;
-
-static int
-DEFUN (which_system, (command), const char * command)
-{
- if (! (under_X32_p ()))
- fsystem = dummy_system;
- else if (! (under_DPMI_p ()))
- fsystem = system;
- else
- fsystem = X32_DPMI_system;
- return ((* fsystem) (command));
-}
-
-int
-DEFUN (X32_system, (command), const char * command)
-{
- return (((* fsystem) (command)));
-}
-\f
-/* values for io specs:
- -1 => default (console)
- >= 0 => channel number.
- */
-
-static int
-DEFUN (swap_io_handle, (handle, spec),
- int handle AND int spec)
-{
- if ((spec == -1) || ((CHANNEL_DESCRIPTOR (spec)) == handle))
- return (-1);
- else
- {
- int saved = (dup (handle));
- if (saved == -1)
- return (-3);
- if ((dup2 ((CHANNEL_DESCRIPTOR (spec)), handle)) != 0)
- {
- close (saved);
- return (-4);
- }
- return (saved);
- }
-}
-
-static int
-DEFUN (restore_io_handle, (handle, saved_handle),
- int handle AND int saved_handle)
-{
- if (saved_handle < 0)
- return (0);
- else if ((dup2 (saved_handle, handle)) != 0)
- return (-1);
- close (saved_handle);
- return (0);
-}
-
-#define SWAP_HANDLE(h, spec, code) do \
-{ \
- int saved_handle = (swap_io_handle ((h), (spec))); \
- if (saved_handle < -1) \
- result = saved_handle; \
- else \
- { \
- code; \
- restore_io_handle ((h), saved_handle); \
- } \
-} while (0)
-
-int
-DEFUN (X32_subprocess, (command, in_spec, out_spec, err_spec),
- const char * command
- AND int in_spec
- AND int out_spec
- AND int err_spec)
-{
- int result;
-
- SWAP_HANDLE (0, in_spec,
- SWAP_HANDLE (1, out_spec,
- SWAP_HANDLE (2, err_spec,
- (result = ((* fsystem)
- (command))))));
- return (result);
-}
-\f
-extern int EXFUN (X32_suspend, (void));
-
-#if !defined (EXEC_SYNC) && defined(P_WAIT)
-# define EXEC_SYNC P_WAIT
-#endif
-
-#define DOS_SHELL "command.com"
-
-int
-DEFUN (lambda_spawn, (ignore), void * ignore)
-{
- return (spawnlp (EXEC_SYNC, DOS_SHELL, NULL));
-}
-
-int
-DEFUN_VOID (X32_suspend)
-{
- if (! (under_X32_p ()))
- return (-1);
- else if (! (under_DPMI_p ()))
- return (lambda_spawn ((void *) NULL));
- else
- return (X32_DPMI_invoke (((int EXFUN ((*), (void *))) lambda_spawn),
- ((void *) NULL)));
-}
+++ /dev/null
-;;; -*-Midas-*-
-;;;
-;;; $Id: dosxcutl.asm,v 1.8 1999/01/02 06:11:34 cph Exp $
-;;;
-;;; Copyright (c) 1992, 1999 Massachusetts Institute of Technology
-;;;
-;;; This program is free software; you can redistribute it and/or
-;;; modify it under the terms of the GNU General Public License as
-;;; published by the Free Software Foundation; either version 2 of the
-;;; License, or (at your option) any later version.
-;;;
-;;; This program is distributed in the hope that it will be useful,
-;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-;;; General Public License for more details.
-;;;
-;;; You should have received a copy of the GNU General Public License
-;;; along with this program; if not, write to the Free Software
-;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-;;;
-
-.386
-.model tiny
- .code
-\f
- public _DPMI_GP_exception_method
-_DPMI_GP_exception_method:
- cmp 40[esp],080000000h
- je DPMI_exception_method_merge
- lea esp,32[esp] ; pop args
-; jmpf -32[esp] ; invoke previous handler
- db 0ffh
- db 06ch
- db 024h
- db 0e0h
-
-DPMI_exception_method_merge:
- lea esp,8[esp] ; pop previous handler
- ;; fall through
-
-;; frame on entry to DPMI_exception_method
-;;
-;;28 trapped SS
-;;24 trapped ESP
-;;20 trapped EFLAGS
-;;16 trapped CS
-;;12 trapped EIP
-;;8 TRAP error code
-;;4 DPMI return hook CS
-;;0 DPMI return hook EIP
-;; <Above this is a standard DPMI exception frame>
-;;20 TRAP number
-;;16 C handler DS
-;;12 C handler CS
-;;8 C handler EIP
-;;4 trap handling SS
-;;0 trap handling ESP
-;; <old ebp goes here>
-;;
-;; This code assumes that the trapped ESP is valid.
-;; It will push from it.
-;; Thus this code cannot be used for a stack fault exception.
-
- public _DPMI_exception_method
-_DPMI_exception_method:
- push ebp
- mov ebp,esp
- push es
- push eax
- push ecx
- push edx
- push ebx
-
- mov eax,4[ebp+4] ; trap frame SS
- mov ecx,0[ebp+4] ; trap frame ESP
- xor ebx,ebx
- mov ebx,28[ebp+28] ; trapped SS
- mov edx,24[ebp+28] ; trapped ESP
- cmp ecx,0
- jne DPMI_set_up_trap_frame
- mov ecx,edx ; Use the trapped stack
- mov eax,ebx ; to build the trap frame
-\f
-DPMI_set_up_trap_frame:
- push eax
- pop es
-
- sub ecx,4 ; push trapped SS
- mov es:[ecx],ebx
-
- sub ecx,4 ; push trapped ESP
- mov es:[ecx],edx
-
- sub ecx,4 ; push trapped EFLAGS
- mov eax,20[ebp+28]
- mov es:[ecx],eax
-
- sub ecx,4 ; push trapped CS
- xor eax,eax
- mov ax,16[ebp+28]
- mov es:[ecx],eax
-
- sub ecx,4 ; push trapped EIP
- mov eax,12[ebp+28]
- mov es:[ecx],eax
-
- sub ecx,4 ; push trap code
- mov eax,8[ebp+28]
- mov es:[ecx],eax
-
- sub ecx,4 ; push trap number
- mov eax,20[ebp+4]
- mov es:[ecx],eax
-
- sub ecx,4 ; push funcptr DS
- mov eax,16[ebp+4]
- mov es:[ecx],eax
-
- sub ecx,4 ; push funcptr CS
- mov eax,12[ebp+4]
- mov es:[ecx],eax
-
- sub ecx,4 ; push funcptr EIP
- mov eax,8[ebp+4]
- mov es:[ecx],eax
-
- mov 28[ebp+28],es ; store hook SS
- mov 24[ebp+28],ecx ; store hook ESP
-
- mov 16[ebp+28],cs ; replace trapped CS
- jmp DPMI_obtain_hook_pc
-
-DPMI_after_obtain_hook_pc:
- pop eax ; PC of obtain_pc
- mov 12[ebp+28],eax ; replace trapped EIP
-
- pop ebx
- pop edx
- pop ecx
- pop eax
- pop es
- pop ebp
- lea esp,24[esp] ; pop args
-
-; The assembler does not assemble the following instruction correctly.
-; ret far ; resume thread
- db 0cbh
-\f
-;; Kludge to obtain the offset of DPMI_exception_method_hook
-
-DPMI_obtain_hook_pc:
- call DPMI_after_obtain_hook_pc
-
-;; Intercepted trap frame:
-;;
-;;36 trapped SS
-;;32 trapped ESP <Typically a pointer to offset 40>
-;;28 trapped EFLAGS
-;;24 trapped CS
-;;20 trapped EIP
-;;16 trap code
-;;12 trap number
-;;8 C function DS
-;;4 C function CS
-;;0 C function EIP
-
- public DPMI_exception_method_hook
-DPMI_exception_method_hook:
- push ebp ; preserve trapped ebp
- mov ebp,esp
- push gs ; -4
- push fs ; -8
- push es ; -12
- push ds ; -16
-
-;; The following code is shared by the exception handlers under DPMI
-;; and X32.
-
- public common_exception_method_merge
-common_exception_method_merge:
- push 36[ebp+4] ; -20 trapped ss
- push 24[ebp+4] ; -24 trapped cs
- push 28[ebp+4] ; -28 trapped eflags
- push 20[ebp+4] ; -32 trapped eip
- push edi ; -36
- push esi ; -40
- push [ebp] ; -44 trapped ebp
- push 32[ebp+4] ; -48 trapped esp
- push ebx ; -52
- push edx ; -56
- push ecx ; -60
- push eax ; -64
- push esp ; sigcontext ptr
- push 16[ebp+4] ; trap code
- push 12[ebp+4] ; trap number
-
- mov ds,8[ebp+4] ; DS of handler
- mov edx,4[ebp+4] ; CS of handler
- mov eax,0[ebp+4] ; EIP of handler
- cmp edx,0 ; test CS of handler
- jne common_use_far_call
- call eax ; Invoke handler
- jmp common_continue_after_exception
-
-common_after_continuation_setup:
-;; Build far RET frame on stack
-
- push edx ; CS of handler
- push eax ; EIP of handler
-
-; ret far ; Invoke handler
- db 0cbh
-\f
-common_use_far_call:
- push cs ; Simulate a far call
- call common_after_continuation_setup
-
-common_continue_after_exception:
-;;
-;; If the handler returns, update machine state and `return' to
-;; the trapped code.
-;;
- add esp,12 ; pop args to C handler
-
- mov eax,-48[ebp] ; update esp
- mov 32[ebp+4],eax
- mov eax,-44[ebp] ; update ebp
- mov [ebp],eax
- mov eax,-32[ebp] ; update eip
- mov 20[ebp+4],eax
- mov eax,-28[ebp] ; update eflags
- mov 28[ebp+4],eax
- mov eax,-24[ebp] ; update cs
- mov 24[ebp+4],eax
- mov eax,-20[ebp] ; update ss
- mov 36[ebp+4],eax
-
- pop eax
- pop ecx
- pop edx
- pop ebx
- add esp,8 ; ignore esp and ebp
- pop esi
- pop edi
- add esp,16 ; ignore eip, eflags, cs, ss
- pop ds
- pop es
- pop fs
- pop gs
-
-;; If this were part of the OS, the following instructions would
-;; do what we want, assuming that we were running at a higher
-;; privilege level than the interrupted task. We need a
-;; `return-to-outer-level' IRETD that restores ESP and SS in
-;; addition to EIP, CS, and EFLAGS.
-;;
-;; However, the architecture does not allow us to specify that
-;; explicitly, and in all likelihood an IRETD will be taken to
-;; mean a `return-to-samel-level' IRETD, which will not pop and
-;; update SS and ESP!
-;;
-;; pop ebp
-;; lea esp,20[esp] ; bump past trap info
-;; iretd ; I wish
-;;
-;; The only way to correctly emulate it is to construct a piece
-;; of code that contains an explicit far jump to the return
-;; CS:EIP after loading EFLAGS, SS, and ESP from the stack.
-;; Unfortunately we can't conveniently create such a thunk here,
-;; since we don't have a pair of selectors representing a code
-;; segment and a writable data segment with the same base and
-;; limit.
-;;
-;; Instead what this code will do is check whether the stack would
-;; not change (same SS and offset to immediately above the frame).
-;; If so, after moving the data around, we'll just do a far return.
-;;
-;; Otherwise, we will build a far return frame on the target stack,
-;; switch stacks, and do a far return.
-;;
-;; This will only work if the target stack is reasonable (and is
-;; big enough for a few words). This is particularly not true in
-;; the case of a stack fault, but we would expect the returning
-;; handler to have changed the stack to a valid one in that case
-;; -- not a valid assumption.
-;;
-;; In addition, the stack comparison assumes that different selectors
-;; mean different stacks, which is also not a valid assumption.
-;; particularly since 32-bit programs often have different SS and DS
-;; selectors mapping over the same linear range.
-;; The code also assumes that even if the selectors are the same,
-;; the target range is either identical to the default,
-;; or non-overlapping.
-\f
- push eax ; -4
- mov ax,ss
- cmp ax,36[ebp+4]
- jne common_different_stacks
- lea eax,40[ebp+4]
- cmp eax,32[ebp+4]
- jne common_different_stacks
-
-;; Easy case: The target stack is what we would return to trivially.
-;; Overwrite SS and ESP with CS and EIP, restore flags, and do a far
-;; return.
-
- mov eax,24[ebp+4] ; Move CS
- mov 36[ebp+4],eax
- mov eax,20[ebp+4] ; Move EIP
- mov 32[ebp+4],eax
- pop eax
- pop ebp
- lea esp,28[ebp] ; Pop trap info and old CS and EIP
- popfd ; Restore eflags
-;
-; The assembler does not assemble the following instruction correctly.
-; ret far ; resume thread
- db 0cbh
-
-common_different_stacks:
- push edx ; -8 Scratch regs
- push ds ; -12 These two must be contiguous
- push ecx ; -16 for LDS instruction below!
- mov ds,36[ebp+4] ; target stack SS
- mov ecx,32[ebp+4] ; target stack ESP
-
- sub ecx,4 ; push target CS
- mov eax,24[ebp+4]
- mov [ecx],eax
-
- sub ecx,4 ; push target EIP
- mov eax,20[ebp+4]
- mov [ecx],eax
-
- sub ecx,4 ; push target EFLAGS
- mov eax,28[ebp+4]
- mov [ecx],eax
-;;
-;; Switch stacks
-;;
- mov dx,ss ; Preserve current stack
- mov ax,ds
- mov ss,ax ; This instruction locks
- mov esp,ecx ; interrupts around this one!
- mov ds,dx
- mov ecx,ebp
-
- mov ebp,[ecx] ; Restore regs
- mov eax,-4[ecx]
- mov edx,-8[ecx]
- lds ecx,-16[ecx]
- popfd
-
-; ret far ; resume thread
- db 0cbh
-\f
-;; Locked data for X32.
-;; It includes all the data and code accessed during a hardware
-;; interrupt or an exception before X32 is reset, i.e. while
-;; it cannot process a page fault.
-
- .data
-
- public _X32_locked_data_start
-_X32_locked_data_start dd 0
-
-X32_excp_buffer db 64 dup(0)
- public _X32_excp_handlers
-_X32_excp_handlers db 32*20 dup (0)
-
- public _X32_ds_val
-_X32_ds_val dd 06765h
-
- public _X32_critical_error_previous
-_X32_critical_error_previous dd 0
- dd 0
- dd 0
-
- public _X32_timer_interrupt_previous
-_X32_timer_interrupt_previous dd 0
- dd 0
- dd 0
-
- public _X32_kbd_interrupt_previous
-_X32_kbd_interrupt_previous dd 0
- dd 0
- dd 0
-
- public _X32_kbd_interrupt_pointers
-_X32_kbd_interrupt_pointers dd 0 ; mask
- dd 0 ; unshifted table
- dd 0 ; shifted table
- dd 0 ; caps table
-
- ; This is usually declared in C,
- ; but they need to be locked since
- public _MemTop ; they are accessed by
-_MemTop dd 0 ; X32_timer_interrupt.
-
-REGBLOCK_MEMTOP equ 0 ; Offset of MEMTOP into Registers.
-REGBLOCK_INT_MASK equ 4 ; Offset of INT_MASK into Registers
-REGBLOCK_INT_CODE equ 48 ; Offset of INT_CODE into Registers
-
- public _Regstart
-_Regstart db 128 dup (0) ; This must be contiguous to Registers!
- public _Registers
-_Registers dd 0 ; This is the MEMTOP used by compiled code!
- ; It is the only register that needs to be
- ; locked.
-
- public _X32_locked_data_end
-_X32_locked_data_end db 3452 dup (0) ; Rest of registers and hooks.
- ; The magic 3452 is
- ; ((REGBLOCK_SIZE_IN_OBJECTS - 1) * 4)
- ; from cmpaux-i386.m4
-
- .code
-\f
-;; Exception handlers for X32 and X32V.
-;; This code is not reentrant.
-;; The same exception within this code will really confused the world.
-;; It should be rewritten in the future to be reentrant.
-
-;; frame on entry to _X32_exception_method (sp points to 0)
-;;
-;; 12 pointer to interrupt structure
-;; 8 eflags at interrupt
-;; 4 CS for IRETD
-;; 0 EIP for IRETD
-;; -4 old DS
-;; -8 old EAX
-;; -12 old ECX
-;; -16 old EDX
-
-X32FRAME equ 16
-
-;; The pointer to the interrupt structure points to offset 0 of
-;; a block on SS whose layout is
-
-;; 32 dword SS
-;; 28 dword ESP
-;; 24 dword EFLAGS
-;; 20 dword CS
-;; 16 dword EIP
-;; 14 mode 0 for int. in real mode, 1 for int. in prot. mode, 2 for excp.
-;; 12 INT# 0 - 256
-;; 10 word GS
-;; 8 word FS
-;; 6 word ES
-;; 4 word DS
-;; 0 dword EAX
-;; -4 trap error code
-
- public _X32_locked_code_start
-_X32_locked_code_start:
-
- public _X32_exception_method
-_X32_exception_method:
- push ds ; Preserve registers
- push eax
- push ecx
- push edx
-
- mov ecx,12[esp+X32FRAME] ; Pointer to structure
- mov ds,_X32_ds_val ; Temporary buffer
- lea edx,X32_excp_buffer
-
- xor eax,eax
- mov ax,ss:32[ecx] ; SS at time of trap
- mov 4[edx],eax
-
- mov eax,ss:28[ecx] ; ESP at time of trap
- mov 0[edx],eax
-
- mov eax,ss:24[ecx] ; EFLAGS at time of trap
- mov 8[edx],eax
-
- xor eax,eax
- mov ax,ss:20[ecx] ; CS at time of trap
- mov 12[edx],eax
-
- mov eax,ss:16[ecx] ; EIP at time of trap
- mov 16[edx],eax
-
- mov eax,ss:-4[ecx] ; Trap code
- mov 20[edx],eax
-
- xor eax,eax ; Trapped gs
- mov ax,ss:10[ecx]
- mov 24[edx],eax
-
- xor eax,eax ; Trapped fs
- mov ax,ss:8[ecx]
- mov 28[edx],eax
-
- xor eax,eax ; Trapped es
- mov ax,ss:6[ecx]
- mov 32[edx],eax
-
- xor eax,eax ; Trapped ds
- mov ax,ss:4[ecx]
- mov 36[edx],eax
-
- mov eax,ss:[ecx] ; Trapped eax
- mov 40[edx],eax
-
- mov eax,[esp] ; Trapped edx
- mov 44[edx],eax
-
- mov eax,4[esp] ; Trapped ecx
- mov 48[edx],eax
-
- xor eax,eax
- mov ax,ss:12[ecx] ; Trap number
- mov 52[edx],eax
-
- mov ecx,eax ; Multiply by 20
- shl eax,2
- add eax,ecx
- shl eax,2
-
- lea ecx,dword ptr _X32_excp_handlers
- add ecx,eax ; handler info for this excp.
-
- mov eax,[ecx] ; handler ESP
- cmp eax,0 ; Use trapped stack?
- jne X32_set_up_trap_sp
-
- lss esp,fword ptr [edx] ; Restore trapped stack
- jmp X32_set_up_trap_sp_merge
-
-X32_set_up_trap_sp:
- lss esp,fword ptr [ecx] ; Use stack specified by handler
-
-X32_set_up_trap_sp_merge:
-
- mov ax,2501h ; Restore X32's internal state
- int 21h
- jmp X32_set_up_trap_stack
-
-;; Note: X32_set_up_stack does not need to be locked in memory
-;; because we get to it after resetting X32 (i.e. scheme is
-;; executing as a normal program again), so it should be able to
-;; page it in if necessary.
-\f
-;;;; X32 interrupt handlers:
-;; Must be locked in memory (and all the data they access).
-
-;; X32 timer interrupt handler.
-;; This signals Scheme's "global GC interrupt", a high-priority
-;; timer interrupt from which the keyboard and real timer
-;; interrupts are derived.
-
-INT_Timer equ 2 ; This must agree with intrpt.h
-;; INT_Timer equ 64
-
- public _X32_timer_interrupt
-_X32_timer_interrupt:
- push ds
- mov ds,cs:_X32_ds_val
- push eax
- or dword ptr _Registers[REGBLOCK_INT_CODE],INT_Timer
- mov eax,dword ptr _Registers[REGBLOCK_INT_CODE]
- and eax,dword ptr _Registers[REGBLOCK_INT_MASK]
- cmp eax,0
- je x32_timer_continue
- mov dword ptr _Registers[REGBLOCK_MEMTOP],-1
-
-x32_timer_continue:
- pop eax
-
-x32_timer_return:
- pop ds
- jmp fword ptr cs:_X32_timer_interrupt_previous
-
-;; X32 critical error interrupt handler.
-;; This gets invoked primarily when accessing removable media
-;; that is not present.
-;; Very few DOS functions can be invoked from here.
-
- public _X32_critical_error
-_X32_critical_error:
- pushfd
- test ah,10h ; can error ?
- je x32_critical_error_ignore
- mov al,03h ; error
- jmp x32_critical_error_return
-
-x32_critical_error_ignore:
- test ah,04h ; can ignore ?
- je x32_critical_error_retry
- mov al,00h ; ignore
- jmp x32_critical_error_return
-
-x32_critical_error_retry:
- test ah,08h ; can retry ?
- je x32_critical_error_kill
- mov al,01h ; ignore
- jmp x32_critical_error_return
-
-x32_critical_error_kill:
- ;; For now, invoke the previous handler.
- ;; Eventually we should abort cleanly,
- ;; but it is not clear it can be done.
- popfd
- jmp fword ptr cs:_X32_critical_error_previous
-
-x32_critical_error_return:
- popfd
- iretd
-
-;; X32 keyboard interrupt handler
-;; This performs scan-code to ASCII translation in order
-;; not to drop the bucky bits.
-;;
-
- public _X32_keyboard_interrupt
-_X32_keyboard_interrupt:
- push dword ptr cs:_X32_kbd_interrupt_pointers[12]
- push dword ptr cs:_X32_kbd_interrupt_pointers[8]
- push dword ptr cs:_X32_kbd_interrupt_pointers[4]
- push dword ptr cs:_X32_kbd_interrupt_pointers[0]
- push dword ptr cs:_X32_ds_val[0]
- pushfd
- call scheme_system_isr
- jnc x32_keyboard_interrupt_dismiss
-
- popfd ; original flags
- lea esp,20[esp] ; pop args
- jmp fword ptr cs:_X32_kbd_interrupt_previous
-
-x32_keyboard_interrupt_dismiss:
- push ebx ; preserve ebx
- push ecx ; preserve ecx
- mov ebx,8[esp] ; updated flags
- mov 40[esp],ebx ; store eflags to location 1
- mov ecx,44[esp] ; pointer to interrupt structure
- mov ss:[ecx],eax ; store new eax
- mov ss:24[ecx],ebx ; store eflags to location 2
- pop ecx
- pop ebx
- popfd ; updated flags
- lea esp,20[esp] ; pop args
- iretd
-\f
-;; Stack on entry to scheme_system_isr
-;;
-;;28 offset of caps table
-;;24 offset of shifted table
-;;20 offset of unshifted table
-;;16 offset of modifier mask
-;;12 DS for scan_code to ascii tables
-;;8 Flags to restore/modify
-;;4 EIP for low-level hook (DPMI/X32/DOSX)
-;;0 Old ebp [pushed on entry]
-;;
-;; Arguments:
-;; AL = scan code
-;; AH = 4fh
-;; CF set
-;;
-;; Return:
-;; AL = scan code
-;; CF clear if scan code should be ignored (interrupt dismissed).
-
-chain_to_next_handler:
- stc ; set the carry flag
- ret
-
- public scheme_system_isr
-scheme_system_isr:
- cmp ah,4fh
- jne chain_to_next_handler
- cmp al,39h
- ja chain_to_next_handler
-
-;; process a keystroke
-
- push ebp
- mov ebp,esp
- push eax ; Preserve accross interrupt
-
- mov ah,2h ; Get shift bits
- int 16h ; Return in AL
-
- push ecx
- push edx ; Preserve regs
- push es
-
- mov edx,12[ebp] ; Segment selector
- push edx
- pop es
-
- mov edx,16[ebp] ; Modifier mask address
- and al,es:[edx] ; Ignore modifiers
- push eax ; Save result
-
- mov ecx,-4[ebp] ; Scan code + function number
- and ecx,3fh ; Only scan code
- and eax,47h ; Shift, ctrl, and CAPS-LOCK mask
-
- test al,7h
- jne use_shifted
- test al,40h
- jne use_caps
-
-use_unshifted:
- mov edx,20[ebp] ; Unshifted table offset
- jmp index_into_table
-
-use_shifted:
- mov edx,24[ebp] ; Shifted table offset
- jmp index_into_table
-
-use_caps:
- mov edx,28[ebp] ; Caps-locked table offset
-; jmp index_into_table
-\f
-index_into_table:
- mov al,es:[edx] [ecx] ; Get ASCII value
- pop edx ; Masked modifier bits
- cmp al,0 ; Null entries mean chain
- je abort_translation
-
- bt edx,2 ; Control set?
- jnc after_control
- and al,09fh ; Clear bits 6 and 5
-
-after_control:
- bt edx,3 ; Alt set?
- jnc after_meta
- or al,080h ; Set bit 8
-
-after_meta:
- cmp al,0f0h ; M-p ?
- je abort_translation
- mov ecx,-4[ebp] ; Get scan code
-
- cmp al,0 ; C-Space ?
- jne after_ctrl_space
- mov cl,3 ; Fudge scan code
-
-after_ctrl_space:
- mov ch,cl
- mov cl,al ; Transfer ASCII value
-
- mov ah,5h ; Insert keystroke
- int 16h ; CH = scan code, CL = ASCII
- ; returns AL = 0h if win, 1h if buffer full
-
- and byte ptr 8[ebp],0feh ; clear interrupt carry flag
- pop es
- pop edx
- pop ecx
- pop eax
- pop ebp
- clc ; clear our carry flag
- ret
-
-abort_translation:
- pop es
- pop edx
- pop ecx
- pop eax
- pop ebp
- stc ; set carry flag
- ret
-\f
- public _X32_locked_code_end
-_X32_locked_code_end:
-
-X32_set_up_trap_stack:
- push 4[edx] ; Trapped SS
- push 0[edx] ; Trapped ESP
- push 8[edx] ; Trapped EFLAGS
- push 12[edx] ; Trapped CS
- push 16[edx] ; Trapped EIP
- push 20[edx] ; Trap code
- push 52[edx] ; Trap number
- push 16[ecx] ; C handler DS
- push 12[ecx] ; C handler CS
- push 8[ecx] ; C handler EIP
- push ebp ; Trapped EBP
- mov ebp,esp
- push 24[edx] ; Trapped GS
- push 28[edx] ; Trapped FS
- push 32[edx] ; Trapped ES
- push 36[edx] ; Trapped DS
- mov eax,40[edx] ; Restore trapped EAX
- mov ecx,48[edx] ; Restore trapped ECX
- mov edx,44[edx] ; Restore trapped EDX
- jmp common_exception_method_merge
-
- public _X32_asm_initialize
-_X32_asm_initialize:
- mov _X32_ds_val,ds
- ret
-
-end
+++ /dev/null
-/* -*-C-*-
- Machine file for DEC Alpha computers.
-
-$Id: alpha.h,v 1.4 1993/02/15 03:46:52 gjr Exp $
-
-Copyright (c) 1992-1993 Digital Equipment Corporation
-
-*/
-
-#ifndef PROC_TYPE
-#define PROC_TYPE PROC_TYPE_ALPHA
-#endif /* PROC_TYPE */
-
-#define LIB_DEBUG
-
-#define C_SWITCH_MACHINE -Olimit 1800
+++ /dev/null
-/* -*-C-*-
- Machine file for Apollo 68k
-
-$Id: apoll68k.h,v 1.4 1999/01/02 06:11:34 cph Exp $
-
-Copyright (c) 1989-1999 Massachusetts Institute of Technology
-Copyright (c) 1991 Michael K. Gschwind
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or (at
-your option) any later version.
-
-This program is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-#ifndef PROC_TYPE
-#define PROC_TYPE PROC_TYPE_UNKNOWN
-#endif /* PROC_TYPE */
-
-#ifndef ALTERNATE_CC
-
-#define C_SWITCH_MACHINE -Dapollo -A nansi
-#define LD_SWITCH_MACHINE -L/usr/lib/X11
-
-#else /* ALTERNATE_CC */
-
-#define C_SWITCH_MACHINE -Dapollo
-#define LD_SWITCH_MACHINE -L/usr/lib/X11
-
-#endif
+++ /dev/null
-/* -*-C-*-
- Machine file for Harris HCX computers
-
-$Id: hcx.h,v 1.3 1999/01/02 06:11:34 cph Exp $
-
-Copyright (c) 1989-1999 Massachusetts Institute of Technology
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or (at
-your option) any later version.
-
-This program is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-#ifndef PROC_TYPE
-#define PROC_TYPE PROC_TYPE_HCX
-#endif /* PROC_TYPE */
-
+++ /dev/null
-/* -*-C-*-
- Machine file for HP9000 series 300 (or 200)
-
-$Id: hp9k300.h,v 1.13 1999/01/02 06:11:34 cph Exp $
-
-Copyright (c) 1989-1999 Massachusetts Institute of Technology
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or (at
-your option) any later version.
-
-This program is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-/* In the following, it is assumed that the standard C compiler is the
- HP C compiler, and the "alternate" compiler is the GNU C compiler (GCC).
- */
-
-/* Change this to PROC_TYPE_68000 if your machine is a series 200 or a
- model 310.
- */
-#ifndef PROC_TYPE
-#define PROC_TYPE PROC_TYPE_68020
-#endif /* PROC_TYPE */
-
-/* The M4_SWITCH_MACHINE must contain -DHP if using HP C, -DGCC, if using
- GCC, and nothing special if using PCC.
- */
-
-#if (PROC_TYPE == PROC_TYPE_68020)
-
-#ifndef ALTERNATE_CC
-#define M4_SWITCH_MACHINE -DMC68881 -DTYPE_CODE_LENGTH=6 -DHP
-#else
-#define M4_SWITCH_MACHINE -DMC68881 -DTYPE_CODE_LENGTH=6 -DGCC
-#endif
-
-#define AS_SWITCH_MACHINE +x -V 3
-
-#else
-#define M4_SWITCH_MACHINE
-#define AS_SWITCH_MACHINE +X
-#endif
-
-#ifndef ALTERNATE_CC
-
-/* For hp-ux version 6.5 or 7.0, uncomment this definition. */
-/* The full optimizer breaks some of the files in those versions. */
-/* #define C_OPTIMIZE_SWITCH +O1 */
-
-/* C_SWITCH_MACHINE can take on several values:
- 1. "-Aa -D_HPUX_SOURCE" is for use on HP-UX 9.0 and later; it
- specifies ANSI C with HP-UX extensions.
- 2. "-Wp,-H512000" can be used on HP-UX 8.0 and later; it specifies
- traditional C.
- 3. "-Wp,-H512000 -Wc,-Nt30000,-Ns3000" is for use in pre-8.0
- releases. */
-#define C_SWITCH_MACHINE -Aa -D_HPUX_SOURCE -DCOMPILER_PROCESSOR_TYPE=COMPILER_MC68020_TYPE -Dhp9000s300
-
-#else
-
-#define C_SWITCH_MACHINE -DCOMPILER_PROCESSOR_TYPE=COMPILER_MC68020_TYPE
-
-#endif
-
-#if defined(HAVE_STARBASE_GRAPHICS) && !defined(STARBASE_DEVICE_DRIVERS)
-/* Add additional Starbase device drivers here. */
-#define STARBASE_DEVICE_DRIVERS -ldd300h
-#endif
+++ /dev/null
-/* -*-C-*-
- Machine file for HP9000 series 400 (or 300) with 68040
-
-$Id: hp9k400.h,v 1.9 1999/01/02 06:11:34 cph Exp $
-
-Copyright (c) 1991-1999 Massachusetts Institute of Technology
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or (at
-your option) any later version.
-
-This program is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-/* In the following, it is assumed that the standard C compiler is the
- HP C compiler, and the "alternate" compiler is the GNU C compiler (GCC).
- */
-
-/* Change this to PROC_TYPE_68000 if your machine is a series 200 or a
- model 310.
- */
-#ifndef PROC_TYPE
-#define PROC_TYPE PROC_TYPE_68020
-#endif /* PROC_TYPE */
-
-/* The M4_SWITCH_MACHINE must contain -DHP if using HP C, -DGCC, if using
- GCC, and nothing special if using PCC.
- */
-
-#if (PROC_TYPE == PROC_TYPE_68020)
-
-#ifndef ALTERNATE_CC
-#define M4_SWITCH_MACHINE -DMC68881 -DTYPE_CODE_LENGTH=6 -DHP
-#else
-#define M4_SWITCH_MACHINE -DMC68881 -DTYPE_CODE_LENGTH=6 -DGCC
-#endif
-
-#define AS_SWITCH_MACHINE +x -V 3
-
-#else
-#define M4_SWITCH_MACHINE
-#define AS_SWITCH_MACHINE +X
-#endif
-
-#ifndef ALTERNATE_CC
-
-/* For hp-ux version 6.5 or 7.0, uncomment this definition. */
-/* The full optimizer breaks some of the files in those versions. */
-/* #define C_OPTIMIZE_SWITCH +O1 */
-
-/* C_SWITCH_MACHINE can take on several values:
- 1. "-Aa -D_HPUX_SOURCE" is for use on HP-UX 9.0 and later; it
- specifies ANSI C with HP-UX extensions.
- 2. "-Wp,-H512000" can be used on HP-UX 8.0 and later; it specifies
- traditional C.
- 3. "-Wp,-H512000 -Wc,-Nt30000,-Ns3000" is for use in pre-8.0
- releases. */
-#define C_SWITCH_MACHINE -Aa -D_HPUX_SOURCE -Dhp9000s300
-
-#else
-
-#define C_SWITCH_MACHINE
-
-#endif
-
-#if defined(HAVE_STARBASE_GRAPHICS) && !defined(STARBASE_DEVICE_DRIVERS)
-/* Add additional Starbase device drivers here. */
-#define STARBASE_DEVICE_DRIVERS -ldd300h
-#endif
+++ /dev/null
-/* -*-C-*-
- Machine file for HP9000 series 600, 700, 800.
-
-$Id: hp9k800.h,v 1.14 1999/01/02 06:11:34 cph Exp $
-
-Copyright (c) 1989-1999 Massachusetts Institute of Technology
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or (at
-your option) any later version.
-
-This program is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-#ifndef PROC_TYPE
-#define PROC_TYPE PROC_TYPE_HPPA
-#endif /* PROC_TYPE */
-
-#if defined(hpux) || defined(__hpux)
-
-#if defined(HAVE_STARBASE_GRAPHICS) && !defined(STARBASE_DEVICE_DRIVERS)
-/* Add additional Starbase device drivers here. */
-# define STARBASE_DEVICE_DRIVERS -ldd98550
-#endif
-
-/* The following is also needed under HP-UX 8.01: +Obb999 */
-
-#ifndef ALTERNATE_CC
- /* Assume HPC */
-/* C_SWITCH_MACHINE can take on several values:
- 1. "-Ae" is for use on HP-UX 9.0 and later; it specifies ANSI C
- with HP-UX extensions.
- 2. "-Aa -D_HPUX_SOURCE" is similar but for earlier HP-UX releases.
- 3. "-Wp,-H512000" can be used in pre-9.0 releases to get
- traditional C (it might work in 9.0 also but hasn't been
- tested). */
-# define C_SWITCH_MACHINE -Ae
-# define M4_SWITCH_MACHINE -DTYPE_CODE_LENGTH=6 -DHPC
-/* "-Wl,+s" tells the linker to allow the environment variable
- SHLIB_PATH to be used to define directories to search for shared
- libraries when the microcode is executed. */
-# define LD_SWITCH_MACHINE -Wl,+s
-#else
- /* Assume GCC */
-# define C_SWITCH_MACHINE
-# define M4_SWITCH_MACHINE -DTYPE_CODE_LENGTH=6 -DGCC
-#endif
-
-#else /* not hpux or __hpux */
-
-/* Utah BSD */
-
-#ifndef ALTERNATE_CC
-# define C_SWITCH_MACHINE -Dhp9000s800
-# define M4_SWITCH_MACHINE -P "define(TYPE_CODE_LENGTH,6)" -P "define(HPC,1)"
-#else
-# define M4_SWITCH_MACHINE -P "define(TYPE_CODE_LENGTH,6)" -P "define(GCC,1)"
-#endif
-
-#endif /* hpux or __hpux */
+++ /dev/null
-/* -*-C-*-
- Machine file for Intel i386 computers
-
-$Id: i386.h,v 1.6 1999/01/02 06:11:34 cph Exp $
-
-Copyright (c) 1990-1999 Massachusetts Institute of Technology
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or (at
-your option) any later version.
-
-This program is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-#ifndef PROC_TYPE
-#define PROC_TYPE PROC_TYPE_I386
-#endif /* PROC_TYPE */
-
-#ifdef _SYSV
-#define M4_SWITCH_MACHINE -DTYPE_CODE_LENGTH=6
-#else
-/* BSD hack when using ultrix.m4 */
-#define M4_SWITCH_MACHINE -P "define(TYPE_CODE_LENGTH,6)"
-#endif
-
-#define C_SWITCH_MACHINE
+++ /dev/null
-/* -*-C-*-
- Machine file for IBM PC/RT computers
-
-$Id: ibm032.h,v 1.3 1999/01/02 06:11:34 cph Exp $
-
-Copyright (c) 1989-1999 Massachusetts Institute of Technology
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or (at
-your option) any later version.
-
-This program is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-#ifndef PROC_TYPE
-#define PROC_TYPE PROC_TYPE_IBM032
-#endif /* PROC_TYPE */
-
-#define C_SWITCH_MACHINE -Dunix
-
+++ /dev/null
-/* -*-C-*-
- Machine file for MIPS computers.
-
-$Id: mips.h,v 1.10 1999/01/02 06:11:34 cph Exp $
-
-Copyright (c) 1989-1999 Massachusetts Institute of Technology
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or (at
-your option) any later version.
-
-This program is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-#ifndef PROC_TYPE
-#define PROC_TYPE PROC_TYPE_MIPS
-#endif /* PROC_TYPE */
-
-/* The MIPS compiler/linker doesn't use -lg. */
-#define LIB_DEBUG
-
-#ifndef ALTERNATE_CC
-/* The "-std" switch says to turn on ANSI features and compatible
- extensions. The "-Olimit" switch is needed because some procedures
- are larger than the built-in optimization limit. */
-#ifdef _ULTRIX
-/* Ultrix doesn't support -std */
-#define C_SWITCH_MACHINE -Olimit 2000
-#else
-#define C_SWITCH_MACHINE -std -Olimit 2000
-#endif
-#else
-#define C_SWITCH_MACHINE
-#endif
+++ /dev/null
-/* -*-C-*-
- Machine file for NeXT
-
-$Id: next.h,v 1.6 1999/01/02 06:11:34 cph Exp $
-
-Copyright (c) 1990-1999 Massachusetts Institute of Technology
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or (at
-your option) any later version.
-
-This program is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-#ifndef PROC_TYPE
-#define PROC_TYPE PROC_TYPE_68020
-#endif /* PROC_TYPE */
-
-#define C_SWITCH_MACHINE -DNeXT
-#define LD_SWITCH_MACHINE
+++ /dev/null
-/* -*-C-*-
- Machine file for IBM RS6000 systems.
-
-$Id: rs6000.h,v 1.3 1999/01/02 06:11:34 cph Exp $
-
-Copyright (c) 1993, 1999 Massachusetts Institute of Technology
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or (at
-your option) any later version.
-
-This program is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
+++ /dev/null
-/* -*-C-*-
- Machine file for Sun 3
-
-$Id: sun3.h,v 1.7 1999/01/02 06:11:34 cph Exp $
-
-Copyright (c) 1989-1999 Massachusetts Institute of Technology
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or (at
-your option) any later version.
-
-This program is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-#ifndef PROC_TYPE
-#define PROC_TYPE PROC_TYPE_68020
-#endif /* PROC_TYPE */
-
-#ifndef ALTERNATE_CC
-
-/* If your machine doesn't have a 68881 coprocessor, remove
- "-f68881" from this line and the LD_SWITCH_MACHINE line. */
-#define C_SWITCH_MACHINE -Dsun3 -f68881
-#define LD_SWITCH_MACHINE -f68881
-
-#else /* ALTERNATE_CC */
-
-#define C_SWITCH_MACHINE -Dsun3
-
-#endif
+++ /dev/null
-/* -*-C-*-
- Machine file for Sun 4
-
-$Id: sun4.h,v 1.4 1999/01/02 06:11:34 cph Exp $
-
-Copyright (c) 1990-1999 Massachusetts Institute of Technology
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or (at
-your option) any later version.
-
-This program is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-#ifndef PROC_TYPE
-#define PROC_TYPE PROC_TYPE_SPARC
-#endif /* PROC_TYPE */
-
-#define C_SWITCH_MACHINE -Dsun4
-#define LD_SWITCH_MACHINE
+++ /dev/null
-/* -*-C-*-
- Machine file for Encore Multimax computers with NS32x32 processors
-
-$Id: umax.h,v 1.3 1999/01/02 06:11:34 cph Exp $
-
-Copyright (c) 1989-1999 Massachusetts Institute of Technology
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or (at
-your option) any later version.
-
-This program is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-#ifndef PROC_TYPE
-#define PROC_TYPE PROC_TYPE_NS32K
-#endif /* PROC_TYPE */
+++ /dev/null
-/* -*-C-*-
- Machine file for DEC Vax computers
-
-$Id: vax.h,v 1.6 1999/01/02 06:11:34 cph Exp $
-
-Copyright (c) 1989-1999 Massachusetts Institute of Technology
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or (at
-your option) any later version.
-
-This program is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-/* This causes problems when generating xmakefile. */
-
-#ifdef vax
-#undef vax
-#endif
-
-#ifndef PROC_TYPE
-#define PROC_TYPE PROC_TYPE_VAX
-#endif /* PROC_TYPE */
-
-/* The M4_SWITCH_MACHINE must contain -P "define(GCC,1)", if using GCC,
- -P "define(VMS,1)" if preparing the files for VMS Vax C,
- and nothing special if using PCC.
- */
-
-#ifndef ALTERNATE_CC
-#define M4_SWITCH_MACHINE -P "define(TYPE_CODE_LENGTH,6)"
-#else
-#define M4_SWITCH_MACHINE -P "define(TYPE_CODE_LENGTH,6)" -P "define(GCC,1)"
-#endif
-
-#define C_SWITCH_MACHINE
+++ /dev/null
-/* -*-C-*-
-
-$Id: msdos.h,v 1.7 1999/01/02 06:11:34 cph Exp $
-
-Copyright (c) 1992-1999 Massachusetts Institute of Technology
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or (at
-your option) any later version.
-
-This program is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-/* DOS system include file */
-
-#ifndef SCM_MSDOS_H
-#define SCM_MSDOS_H
-\f
-#define SYSTEM_NAME "dos"
-#define SYSTEM_VARIANT "MS-DOS"
-
-#include <sys/types.h>
-#include <sys/times.h>
-#include <dos.h>
-#include <io.h>
-#include <conio.h>
-#include <sys/stat.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <direct.h>
-#include <signal.h>
-#include <errno.h>
-/* We fake these for console I/O in DOS */
-#ifndef ESTALE
-#define ESTALE 1997
-#endif
-#ifndef ERRNO_NONBLOCK
-#define ERRNO_NONBLOCK 1998
-#endif
-#ifndef EINTR
-#define EINTR 1999
-#endif
-
-#include "oscond.h"
-#include "ansidecl.h"
-#include "posixtyp.h"
-
-#include "intext.h"
-#include "dstack.h"
-#include "osscheme.h"
-#include "dossys.h"
-#include "syscall.h"
-#include <limits.h>
-#include <time.h>
-#include <termio.h>
-
-#define HAVE_MKDIR
-#define HAVE_RMDIR
-#define HAVE_GETCWD
-
-/* #define HAVE_DUP2 */
-/* #define HAVE_FCNTL */
-#define VOID_SIGNAL_HANDLERS
-
-#include <sys/dir.h>
-\f
-typedef void Tsignal_handler_result;
-#define SIGNAL_HANDLER_RETURN() return
-
-typedef Tsignal_handler_result (*Tsignal_handler) ();
-
-#ifndef SIG_ERR
-#define SIG_ERR ((Tsignal_handler) (-1))
-#endif
-
-#if !defined(SIGCHLD) && defined(SIGCLD)
-#define SIGCHLD SIGCLD
-#endif
-#if !defined(SIGABRT) && defined(SIGIOT)
-#define SIGABRT SIGIOT
-#endif
-
-/* Crufty, but it will work here. */
-#ifndef ENOSYS
-#define ENOSYS 0
-#endif
-
-#ifdef UNION_WAIT_STATUS
-
-typedef union wait wait_status_t;
-
-#ifndef WEXITSTATUS
-#define WEXITSTATUS(_X) ((_X) . w_retcode)
-#endif
-
-#ifndef WTERMSIG
-#define WTERMSIG(_X) ((_X) . w_termsig)
-#endif
-
-#ifndef WSTOPSIG
-#define WSTOPSIG(_X) ((_X) . w_stopsig)
-#endif
-
-#else /* not UNION_WAIT_STATUS */
-
-typedef int wait_status_t;
-
-#ifndef WIFEXITED
-#define WIFEXITED(_X) (((_X) & 0377) == 0)
-#endif
-
-#ifndef WIFSTOPPED
-#define WIFSTOPPED(_X) (((_X) & 0377) == 0177)
-#endif
-
-#ifndef WIFSIGNALED
-#define WIFSIGNALED(_X) ((((_X) & 0377) != 0) && (((_X) & 0377) != 0177))
-#endif
-
-#ifndef WEXITSTATUS
-#define WEXITSTATUS(_X) (((_X) >> 8) & 0377)
-#endif
-
-#ifndef WTERMSIG
-#define WTERMSIG(_X) ((_X) & 0177)
-#endif
-
-#ifndef WSTOPSIG
-#define WSTOPSIG(_X) (((_X) >> 8) & 0377)
-#endif
-
-#endif /* UNION_WAIT_STATUS */
-\f
-/* Provide null defaults for all the signals we're likely to use so we
- aren't continually testing to see if they're defined. */
-
-#ifndef SIGLOST
-#define SIGLOST 0
-#endif
-#ifndef SIGWINCH
-#define SIGWINCH 0
-#endif
-#ifndef SIGURG
-#define SIGURG 0
-#endif
-#ifndef SIGIO
-#define SIGIO 0
-#endif
-#ifndef SIGUSR1
-#define SIGUSR1 0
-#endif
-#ifndef SIGUSR2
-#define SIGUSR2 0
-#endif
-#ifndef SIGVTALRM
-#define SIGVTALRM 0
-#endif
-#ifndef SIGABRT
-#define SIGABRT 0
-#endif
-#ifndef SIGPWR
-#define SIGPWR 0
-#endif
-#ifndef SIGPROF
-#define SIGPROF 0
-#endif
-#ifndef SIGSTOP
-#define SIGSTOP 0
-#endif
-#ifndef SIGTSTP
-#define SIGTSTP 0
-#endif
-#ifndef SIGCONT
-#define SIGCONT 0
-#endif
-#ifndef SIGCHLD
-#define SIGCHLD 0
-#endif
-#ifndef SIGTTIN
-#define SIGTTIN 0
-#endif
-#ifndef SIGTTOU
-#define SIGTTOU 0
-#endif
-\f
-/* constants for access() */
-#ifndef R_OK
-#define R_OK 4
-#define W_OK 2
-#define X_OK 1
-#define F_OK 0
-#endif
-
-#ifndef MAXPATHLEN
-#define MAXPATHLEN 128
-#endif
-
-#ifdef __STDC__
-#define ALERT_CHAR '\a'
-#define ALERT_STRING "\a"
-#else
-#define ALERT_CHAR '\007'
-#define ALERT_STRING "\007"
-#endif
-
-#ifndef STDIN_FILENO
-#define STDIN_FILENO 0
-#define STDOUT_FILENO 1
-#define STDERR_FILENO 2
-#endif
-
-/* constants for open() and fcntl() */
-#ifndef O_RDONLY
-#define O_RDONLY 0
-#define O_WRONLY 1
-#define O_RDWR 2
-#endif
-
-/* mode bit definitions for open(), creat(), and chmod() */
-#ifndef S_IRWXU
-#define S_IRWXU 0700
-#define S_IRWXG 0070
-#define S_IRWXO 0007
-#endif
-
-#ifndef S_IRUSR
-#define S_IRUSR 0400
-#define S_IWUSR 0200
-#define S_IXUSR 0100
-#define S_IRGRP 0040
-#define S_IWGRP 0020
-#define S_IXGRP 0010
-#define S_IROTH 0004
-#define S_IWOTH 0002
-#define S_IXOTH 0001
-#endif
-
-#define MODE_REG (S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH)
-#define MODE_DIR (MODE_REG | S_IXUSR | S_IXGRP | S_IXOTH)
-
-/* constants for lseek() */
-#ifndef SEEK_SET
-#define SEEK_SET 0
-#define SEEK_CUR 1
-#define SEEK_END 2
-#endif
-\f
-#ifndef DECL_GETLOGIN
-extern char * EXFUN (getlogin, (void));
-#endif
-
-#define DOS_abort abort
-#define DOS_access access
-#define DOS_alarm alarm
-#define DOS_chdir chdir
-#define DOS_chmod chmod
-#define DOS_close close
-#define DOS_ctime ctime
-#define DOS_dup dup
-#define DOS_free free
-#define DOS_fstat fstat
-#define DOS_getcwd getcwd
-#define DOS_getenv getenv
-#define DOS_getegid getegid
-#define DOS_geteuid geteuid
-#define DOS_getgrgid getgrgid
-#define DOS_gethostname gethostname
-#define DOS_getlogin getlogin
-#define DOS_getpid getpid
-#define DOS_getpwnam getpwnam
-#define DOS_getpwuid getpwuid
-#define DOS_ioctl ioctl
-#define DOS_link link
-#define DOS_localtime localtime
-#define DOS_lseek lseek
-#define DOS_malloc malloc
-#define DOS_mknod mknod
-#define DOS_mktime mktime
-#define DOS_pause pause
-#define DOS_pipe pipe
-#define DOS_read read
-#define DOS_realloc realloc
-#define DOS_signal signal
-#define DOS_sleep sleep
-#define DOS_stat stat
-#define DOS_system system
-#define DOS_time time
-#define DOS_unlink unlink
-#define DOS_write write
-#define DOS_wait wait
-
-extern PTR EXFUN (malloc, (unsigned int size));
-extern PTR EXFUN (realloc, (PTR ptr, unsigned int size));
-extern int EXFUN (gethostname, (char * name, unsigned int size));
-
-#ifdef HAVE_FCNTL
-#define DOS_fcntl fcntl
-#endif
-
-#ifdef HAVE_TRUNCATE
-#define DOS_ftruncate ftruncate
-#define DOS_truncate truncate
-#endif
-
-#ifdef HAVE_VFORK
-#define DOS_vfork vfork
-#else
-#define DOS_vfork fork
-#endif
-
-#ifdef HAVE_SYMBOLIC_LINKS
-#define DOS_lstat lstat
-#define DOS_readlink readlink
-#define DOS_symlink symlink
-#else
-#define DOS_lstat stat
-#endif
-\f
-extern void EXFUN (DOS_prim_check_errno, (enum syscall_names name));
-
-#define STD_VOID_SYSTEM_CALL(name, expression) \
-{ \
- while ((expression) < 0) \
- error_system_call (errno, (name)); \
-}
-
-#define STD_UINT_SYSTEM_CALL(name, result, expression) \
-{ \
- while (((result) = (expression)) < 0) \
- error_system_call (errno, (name)); \
-}
-
-#define STD_PTR_SYSTEM_CALL(name, result, expression) \
-{ \
- while (((result) = (expression)) == 0) \
- error_system_call (errno, (name)); \
-}
-
-typedef struct {
- int dummy;
-} Ttty_state;
-\f
-#ifdef HAVE_GETTIMEOFDAY
-#define DOS_gettimeofday gettimeofday
-#endif
-#ifdef HAVE_ITIMER
-#define DOS_setitimer setitimer
-#endif
-#ifdef HAVE_RMDIR
-#define DOS_rmdir rmdir
-#endif
-#ifdef HAVE_TIMES
-#define DOS_times times
-#endif
-
-#ifdef HAVE_DUMB_OPEN
-extern int EXFUN (DOS_open, (CONST char * name, int oflag, mode_t mode));
-#else
-#define DOS_open open
-#endif
-
-#ifdef HAVE_GETCWD
-#define DOS_getcwd getcwd
-#else
-#define EMULATE_GETCWD
-#define HAVE_GETCWD
-extern char * EXFUN (DOS_getcwd, (char * buffer, size_t length));
-#endif
-
-#ifdef HAVE_MKDIR
-#define DOS_mkdir mkdir
-#else
-#define EMULATE_MKDIR
-#define HAVE_MKDIR
-extern int EXFUN (DOS_mkdir, (CONST char * name, mode_t mode));
-#endif
-
-#ifdef HAVE_RENAME
-#define DOS_rename rename
-#else
-#define DOS_rename dos_rename_file
-
-#ifdef HAVE_WAITPID
-#define DOS_waitpid waitpid
-#else /* not HAVE_WAITPID */
-#ifdef HAVE_WAIT3
-#define EMULATE_WAITPID
-#define HAVE_WAITPID
-extern int EXFUN
- (DOS_waitpid, (pid_t pid, wait_status_t * stat_loc, int options));
-#endif /* HAVE_WAIT3 */
-#endif /* HAVE_WAITPID */
-
-#ifndef WUNTRACED
-#define WUNTRACED 0
-#endif
-
-#ifdef HAVE_SELECT
-#define DOS_select select
-#endif /* HAVE_SELECT */
-
-#ifdef _NFILE
-#define DOS_SC_OPEN_MAX() _NFILE
-#else
-#define DOS_SC_OPEN_MAX() 16
-#endif
-
-/* Interrupts */
-
-#define int10h(in,out) int86 (0x10, in, out)
-#define intDPMI(in,out) int86 (0x31, in, out)
-#define intDPMIx(in,out,seg) int86x (0x31, in, out, seg)
-
-/* Doesn't really go anywhere */
-#define INTERRUPT_CHAIN_NEXT 0
-#define INTERRUPT_RETURN 1
-
-#endif /* SCM_MSDOS_H */
+++ /dev/null
-/* -*-C-*-
-
-$Id: oscond.h,v 1.26 1999/01/02 06:11:34 cph Exp $
-
-Copyright (c) 1990-1999 Massachusetts Institute of Technology
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or (at
-your option) any later version.
-
-This program is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-/* Operating System Conditionalizations.
- Identify the operating system, its version, and generalizations. */
-
-#ifndef SCM_OSCOND_H
-#define SCM_OSCOND_H
-\f
-/* _POSIX is assumed to be independent of all operating-system and
- machine specification macros. */
-
-#if defined(__osf__) || defined(_AIX) || defined(__linux) || defined(__bsdi__) || defined(_ULTRIX) || defined(__FreeBSD__)
-# define _POSIX
-# define _BSD4_3
-#endif
-
-/* From Garrett Wollman <wollman@lcs.mit.edu>:
- __FreeBSD__ == 1 means version 1.x
- __FreeBSD__ == 2 means there is an <osreldate.h> and __FreeBSD_version
- from that header is a release date.
- __FreeBSD__ == 3 means there is an <osreldate.h> and __FreeBSD_version
- is a large integer which is not a date (sigh) but which is related to
- the version number (i.e, it's totally pointless). */
-
-#if defined(__hpux) && !defined(hpux)
-#define hpux
-#endif
-
-#if defined(__hp9000s300) && !defined(hp9000s300)
-#define hp9000s300
-#endif
-
-#if defined(__hp9000s400) && !defined(hp9000s400)
-#define hp9000s400
-#endif
-
-#if defined(__hp9000s700) && !defined(hp9000s700)
-#define hp9000s700
-#endif
-
-#if defined(__hp9000s800) && !defined(hp9000s800)
-#define hp9000s800
-#endif
-
-#if defined(hpux) && !defined(_HPUX)
-#define _HPUX
-#endif
-
-#ifdef _HPUX
-#ifdef __hpux
-
-#define _POSIX
-#define _SYSV3
-
-#include <sys/types.h>
-#ifdef PGID_USE_PID
-#define _HPUX_VERSION 100
-#else
-#include <a.out.h>
-#ifdef SHL_MAGIC
-#define _HPUX_VERSION 80
-#else
-#define _HPUX_VERSION 70
-#endif
-#endif
-
-#else /* not __hpux */
-
-#define _SYSV
-
-/* Definitions in this file identify the operating system version. */
-#include <signal.h>
-
-#ifdef hp9000s300
-#ifdef SV_BSDSIG
-#define _HPUX_VERSION 65
-#else
-/* Versions prior to 6.2 aren't worth dealing with anymore. */
-#define _HPUX_VERSION 62
-#endif
-#endif
-
-#ifdef hp9000s800
-#ifdef SV_RESETHAND
-#define _HPUX_VERSION 65 /* actually, 3.0 */
-#else
-/* Versions prior to 2.0 aren't worth dealing with anymore. */
-#define _HPUX_VERSION 62 /* actually, 2.0 */
-#endif
-#endif
-
-#endif /* __hpux */
-#endif /* _HPUX */
-
-#if defined(_IRIX4) || defined(_IRIX6)
-#ifndef _IRIX
-#define _IRIX
-#endif
-#endif
-
-#ifdef _IRIX
-#define _POSIX
-#define _SYSV3
-#endif
-
-#ifdef _SYSV4
-#define _POSIX
-#define _SYSV3
-#endif
-
-#ifdef _SYSV3
-#define _SYSV
-#endif
-
-#if defined(_NEXTOS)
-
-#define _BSD4_3
-
-#include <sys/port.h>
-#ifdef PORT_BACKLOG_DEFAULT
-#define _NEXTOS_VERSION 20
-#else
-#define _NEXTOS_VERSION 10
-#endif
-
-#endif /* _NEXTOS */
-
-#if defined(_SUNOS3) || defined(_SUNOS4)
-#define _SUNOS
-#define _BSD4_2
-#endif
-
-#if defined(_BSD4_3)
-#define _BSD 43
-#else
-#if defined(_BSD4_2)
-#define _BSD 42
-#endif
-#endif
-
-#if defined(_BSD) && defined(_SYSV)
-#include "error: can't define both _BSD and _SYSV"
-#endif
-
-#if defined(_M_IX86) && !defined(i386)
-#define i386
-#endif
-
-#if defined(DOS386)
-# define _DOS386
-# define _DOS386_VERSION 50
-#endif
-
-#ifdef __OS2__
-#define _OS2
-/* Don't really know the version but this is correct for my machine. */
-#define _OS2_VERSION 211
-#ifdef i386
-#define _OS2386
-#endif
-#endif
-
-#if (defined(_WIN32) || defined(__NT__)) && !defined(WINNT)
-#define WINNT
-#endif
-
-#if defined(_MSC_VER) && !defined(CL386)
-#define CL386
-#endif
-
-#if defined(_BSD) || defined(_SYSV) || defined(_PIXEL)
-# define _UNIX
-#else
-# ifdef _DOS386
-# define _DOS
-# else
-# if defined(WINNT) && defined(i386)
-# define _NT386
-# define _NT386_VERSION 0
-# ifdef CL386
-# define NT386CL
-# endif
-# else
-# ifndef _OS2
-# include "error: unknown operating system -- you must customize"
-# endif /* _OS2 */
-# endif /* _NT386 */
-# endif /* _DOS386 */
-#endif /* _BSD || _SYSV || _PIXEL */
-
-/* SRA: WinNT macros. (one day there will be MIPS and Alpha versions?)
- WINNT: any windows NT system
- i386: i386 processor
- CL386: using Microsoft's compiler (done from makefile)
- _NT386: WINNT && i386
- NT386CL: _NT386 && CL386
-*/
-
-#endif /* SCM_OSCOND_H */
+++ /dev/null
-/* -*-C-*-
-
-$Id: posixtyp.h,v 1.16 1999/01/02 06:11:34 cph Exp $
-
-Copyright (c) 1990-1999 Massachusetts Institute of Technology
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or (at
-your option) any later version.
-
-This program is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-\f
-#ifndef SCM_POSIXTYPE_H
-#define SCM_POSIXTYPE_H
-
-#ifdef _POSIX
-
-#include <sys/types.h>
-#include <sys/times.h>
-#include <termios.h>
-
-#else /* not _POSIX */
-
-#ifdef _UNIX
-#include <sys/types.h>
-
-#if defined(_HPUX) && (_HPUX_VERSION == 65)
-#define _MODE_T
-#define _NLINK_T
-#define _SIZE_T
-#define _OFF_T
-#endif
-
-#ifdef _BSD
-#define _UID_T
-#define _SIZE_T
-#define _OFF_T
-#endif
-
-#ifdef _BSD4_3
-#ifndef _NEXTOS
-#define _MODE_T
-#define _NLINK_T
-#define _PID_T
-#define _CLOCK_T
-#endif
-#define _TIME_T
-#endif
-
-#if defined(_SUNOS4) && defined(__sys_stdtypes_h)
-#define _MODE_T
-#define _NLINK_T
-#define _PID_T
-#define _CLOCK_T
-#define _TIME_T
-#define _SIZE_T
-#define _OFF_T
-#define _CC_T
-#endif
-
-#ifdef apollo
-#define _MODE_T
-#define _NLINK_T
-#define _PID_T
-#define _OFF_T
-#endif
-
-#endif
-
-#ifdef WINNT
-
-#include <sys/types.h>
-#include <time.h>
-
-#ifdef CL386
-/*#define _MODE_T*/
-#define _NLINK_T
-/* #define _PID_T */
-#define _CLOCK_T
-#define _TIME_T
-#define _SIZE_T
-#define _OFF_T
-#define off_t _off_t
-/*#define _CC_T*/
-#endif
-
-#ifdef __WATCOMC__
-#define _TIME_T
-#define _OFF_T
-#define _SIZE_T
-#define _CLOCK_T
-#endif
-
-#ifndef _PID_T
-#define _PID_T
-typedef unsigned long pid_t;
-#endif
-
-#endif
-
-#ifdef _OS2
-#if defined(__IBMC__) || defined(__WATCOMC__)
-
-#include <sys/types.h>
-#include <time.h>
-#define _TIME_T
-#define _OFF_T
-#define _SIZE_T
-#define _CLOCK_T
-
-#else /* not __IBMC__ */
-#ifdef __GNUC__
-
-/* This is for GCC with the GNU C library. */
-#include <sys/types.h>
-#include <time.h>
-#define _TIME_T
-#define _OFF_T
-#define _SIZE_T
-#define _CLOCK_T
-#define _MODE_T
-#define _NLINK_T
-#define _PID_T
-#define _UID_T
-#define _GID_T
-
-#endif /* __GNUC__ */
-#endif /* not __IBMC__ */
-#endif /* _OS2 */
-
-#ifndef _MODE_T
-#define _MODE_T
-typedef unsigned short mode_t;
-#endif
-
-#ifndef _NLINK_T
-#define _NLINK_T
-#ifndef _ULTRIX
-typedef short nlink_t;
-#endif
-#endif
-
-#ifndef _PID_T
-#define _PID_T
-typedef long pid_t;
-#endif
-
-#ifndef _UID_T
-#define _UID_T
-#ifdef _SYSV
-typedef unsigned short uid_t;
-typedef unsigned short gid_t;
-#else
-typedef short uid_t;
-typedef short gid_t;
-#endif
-#endif
-
-#ifndef _CLOCK_T
-#define _CLOCK_T
-typedef unsigned long clock_t;
-#endif
-
-#ifndef _TIME_T
-#define _TIME_T
-typedef long time_t;
-#endif
-
-#ifndef _SIZE_T
-#define _SIZE_T
-typedef unsigned int size_t;
-#endif
-
-#ifndef _OFF_T
-#define _OFF_T
-typedef unsigned int off_t;
-#endif
-
-#ifndef _CC_T
-#define _CC_T
-typedef unsigned char cc_t;
-#endif
-
-#endif /* not _POSIX */
-
-#endif /* SCM_POSIXTYPE_H */
+++ /dev/null
-/* -*-C-*-
-
-$Id: prdosenv.c,v 1.11 1999/01/02 06:11:34 cph Exp $
-
-Copyright (c) 1992-1999 Massachusetts Institute of Technology
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or (at
-your option) any later version.
-
-This program is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-/* Unix-specific process-environment primitives. */
-/* DOS imitation */
-
-#include "scheme.h"
-#include "prims.h"
-#include "msdos.h"
-#include "dosio.h"
-\f
-DEFINE_PRIMITIVE ("FILE-TIME->STRING", Prim_file_time_to_string, 1, 1,
- "Convert a file system time stamp into a date/time string.")
-{
- PRIMITIVE_HEADER (1);
- CHECK_ARG (1, INTEGER_P);
- {
- time_t clock = (arg_integer (1));
- char * time_string = (DOS_ctime (&clock));
- (time_string[24]) = '\0';
- PRIMITIVE_RETURN (char_pointer_to_string ((unsigned char *) time_string));
- }
-}
-
-DEFINE_PRIMITIVE ("DOS-SET-KEYBOARD-MODIFIER-MASK!", Prim_dos_set_kbd_mod_mask,
- 1, 1,
- "Set the keyboard modifier mask")
-{
- extern unsigned char EXFUN (dos_set_kbd_modifier_mask, (unsigned char));
- PRIMITIVE_HEADER (1);
-
- PRIMITIVE_RETURN (long_to_integer
- ((long)
- (dos_set_kbd_modifier_mask ((unsigned char)
- (arg_integer (1))))));
-}
-
-DEFINE_PRIMITIVE ("DOS-SET-KEYBOARD-TRANSLATION!",
- Prim_dos_set_keyboard_translation,
- 3, 3, 0)
-{
- int result;
- extern int EXFUN (dos_set_kbd_translation,
- (unsigned, unsigned, unsigned char));
- PRIMITIVE_HEADER (3);
-
- result = (dos_set_kbd_translation (((unsigned) (arg_integer (1))),
- ((unsigned) (arg_integer (2))),
- ((unsigned char) (arg_integer (3)))));
- if (result < 0)
- error_bad_range_arg (2);
-
- PRIMITIVE_RETURN (long_to_integer ((long) result));
-}
-\f
-DEFINE_PRIMITIVE ("SYSTEM", Prim_system, 1, 1,
- "Invoke COMMAND.COM on the string argument.\n\
-Wait until the command terminates, returning its exit status as an integer.")
-{
- int result;
- extern int EXFUN (X32_system, (char *));
- PRIMITIVE_HEADER (1);
-
- result = (X32_system (STRING_ARG (1)));
- if (result < -1)
- error_external_return ();
- PRIMITIVE_RETURN (long_to_integer ((long) result));
-}
-
-/* values for io specs:
- -1 => default (console)
- >= 0 => channel number.
- */
-
-static int
-DEFUN (arg_io_spec, (arg_no), int arg_no)
-{
- int arg = (arg_integer (arg_no));
-
- if ((arg < -1)
- || (arg >= ((int) OS_channel_table_size))
- || ((arg >= 0)
- && (! (OS_channel_open_p ((Tchannel) arg)))))
- error_bad_range_arg (arg_no);
- return (arg);
-}
-
-DEFINE_PRIMITIVE ("RUN-SUBPROCESS", Prim_run_subprocess, 4, 4,
- "Invoke COMMAND.COM on STRING with I/O as specified by other arguments.\n\
-Wait until the command terminates, returning its exit status as an integer.")
-{
- int result;
- extern int EXFUN (X32_subprocess, (char *, int, int, int));
- PRIMITIVE_HEADER (3);
-
- result = (X32_subprocess ((STRING_ARG (1)),
- (arg_io_spec (2)),
- (arg_io_spec (3)),
- (arg_io_spec (4))));
- if (result < -1)
- error_external_return ();
- PRIMITIVE_RETURN (long_to_integer ((long) result));
-}
-\f
-DEFINE_PRIMITIVE ("GET-ENVIRONMENT-VARIABLE", Prim_get_environment_variable, 1, 1,
- "Look up the value of a variable in the user's shell environment.\n\
-The argument, a variable name, must be a string.\n\
-The result is either a string (the variable's value),\n\
- or #F indicating that the variable does not exist.")
-{
- PRIMITIVE_HEADER (1);
- {
- CONST char * variable_value = (DOS_getenv (STRING_ARG (1)));
- PRIMITIVE_RETURN
- ((variable_value == 0)
- ? SHARP_F
- : (char_pointer_to_string ((unsigned char *) variable_value)));
- }
-}
+++ /dev/null
-/* -*-C-*-
-
-$Id: prdosfs.c,v 1.5 1999/01/02 06:11:34 cph Exp $
-
-Copyright (c) 1992-1999 Massachusetts Institute of Technology
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or (at
-your option) any later version.
-
-This program is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-/* Unix-specific file-system primitives. */
-/* DOS Immitation */
-
-#include "scheme.h"
-#include "prims.h"
-#include "msdos.h"
-#include "osfs.h"
-
-extern int EXFUN
- (DOS_read_file_status, (CONST char * filename, struct stat * s));
-
-static SCHEME_OBJECT EXFUN (file_attributes_internal, (struct stat * s));
-static void EXFUN (file_mode_string, (struct stat * s, char * a));
-static char EXFUN (file_type_letter, (struct stat * s));
-static void EXFUN (rwx, (unsigned short bits, char * chars));
-static SCHEME_OBJECT EXFUN (file_touch, (CONST char * filename));
-static void EXFUN (protect_fd, (int fd));
-
-#ifndef FILE_TOUCH_OPEN_TRIES
-#define FILE_TOUCH_OPEN_TRIES 5
-#endif
-\f
-DEFINE_PRIMITIVE ("FILE-MODES", Prim_file_modes, 1, 1,
- "Return mode bits of FILE, as an integer.")
-{
- struct stat stat_result;
- PRIMITIVE_HEADER (1);
- PRIMITIVE_RETURN
- ((DOS_read_file_status ((STRING_ARG (1)), (&stat_result)))
- ? (LONG_TO_UNSIGNED_FIXNUM ((stat_result . st_mode) & 07777))
- : SHARP_F);
-}
-
-DEFINE_PRIMITIVE ("SET-FILE-MODES!", Prim_set_file_modes, 2, 2,
- "Set the mode bits of FILE to MODE.")
-{
- PRIMITIVE_HEADER (2);
- if ((DOS_chmod ((STRING_ARG (1)), (arg_index_integer (2, 010000)))) < 0)
- error_system_call (errno, syscall_chmod);
- PRIMITIVE_RETURN (SHARP_F);
-}
-
-DEFINE_PRIMITIVE ("FILE-MOD-TIME", Prim_file_mod_time, 1, 1, 0)
-{
- struct stat s;
- PRIMITIVE_HEADER (1);
- PRIMITIVE_RETURN
- ((DOS_read_file_status ((STRING_ARG (1)), (&s)))
- ? (long_to_integer (s . st_mtime))
- : SHARP_F);
-}
-\f
-/* Returns a vector of 10 items:
-
- 0 = #T iff the file is a directory,
- string (name linked to) for symbolic link,
- #F for all other files.
- 1 = number of links to the file
- 2 = user id, as an unsigned integer
- 3 = group id, as an unsigned integer
- 4 = last access time of the file
- 5 = last modification time of the file
- 6 = last change time of the file
- 7 = size of the file in bytes
- 8 = mode string for the file
- 9 = inode number of the file
-
- The file_mode_string stuff was gobbled from GNU Emacs. */
-
-#define FILE_ATTRIBUTES_PRIMITIVE(stat_syscall) \
-{ \
- struct stat s; \
- PRIMITIVE_HEADER (1); \
- PRIMITIVE_RETURN \
- ((stat_syscall ((STRING_ARG (1)), (&s))) \
- ? (file_attributes_internal (&s)) \
- : SHARP_F); \
-}
-
-DEFINE_PRIMITIVE ("FILE-ATTRIBUTES", Prim_file_attributes, 1, 1,
- "Given a file name, return attribute information about the file.\n\
-If the file exists and its status information is accessible, the result\n\
-is a vector of 10 items (see the reference manual for details). Otherwise\n\
-the result is #F.")
- FILE_ATTRIBUTES_PRIMITIVE (DOS_read_file_status)
-
-static SCHEME_OBJECT
-DEFUN (file_attributes_internal, (s), struct stat * s)
-{
- SCHEME_OBJECT result = (allocate_marked_vector (TC_VECTOR, 10, true));
- SCHEME_OBJECT modes = (allocate_string (10));
- switch ((s -> st_mode) & S_IFMT)
- {
- case S_IFDIR:
- VECTOR_SET (result, 0, SHARP_T);
- break;
-#ifdef S_IFLNK
- case S_IFLNK:
- VECTOR_SET (result, 0,
- (char_pointer_to_string
- ((unsigned char *)
- (OS_file_soft_link_p
- ((CONST char *) (STRING_LOC ((ARG_REF (1)), 0)))))));
- break;
-#endif
- default:
- VECTOR_SET (result, 0, SHARP_F);
- break;
- }
- VECTOR_SET (result, 1, (long_to_integer (s -> st_nlink)));
- VECTOR_SET (result, 2, (long_to_integer (s -> st_uid)));
- VECTOR_SET (result, 3, (long_to_integer (s -> st_gid)));
- VECTOR_SET (result, 4, (long_to_integer (s -> st_atime)));
- VECTOR_SET (result, 5, (long_to_integer (s -> st_mtime)));
- VECTOR_SET (result, 6, (long_to_integer (s -> st_ctime)));
- VECTOR_SET (result, 7, (long_to_integer (s -> st_size)));
- file_mode_string (s, ((char *) (STRING_LOC (modes, 0))));
- VECTOR_SET (result, 8, modes);
- VECTOR_SET (result, 9, (long_to_integer (s -> st_ino)));
- return (result);
-}
-\f
-/* file_mode_string - set file attribute data
-
- File_mode_string converts the data in the st_mode field of file
- status block `s' to a 10 character attribute string, which it
- stores in the block that `a' points to.
-
- This attribute string is modelled after the string produced by the
- Berkeley ls.
-
- As usual under Unix, the elements of the string are numbered from
- 0. Their meanings are:
-
- 0 File type. 'd' for directory, 'c' for character special, 'b'
- for block special, 'm' for multiplex, 'l' for symbolic link,
- 's' for socket, 'p' for fifo, '-' for any other file type
- 1 'r' if the owner may read, '-' otherwise.
- 2 'w' if the owner may write, '-' otherwise.
- 3 'x' if the owner may execute, 's' if the file is set-user-id,
- '-' otherwise. 'S' if the file is set-user-id, but the
- execute bit isn't set. (sys V `feature' which helps to catch
- screw case.)
- 4 'r' if group members may read, '-' otherwise.
- 5 'w' if group members may write, '-' otherwise.
- 6 'x' if group members may execute, 's' if the file is
- set-group-id, '-' otherwise. 'S' if it is set-group-id but
- not executable.
- 7 'r' if any user may read, '-' otherwise.
- 8 'w' if any user may write, '-' otherwise.
- 9 'x' if any user may execute, 't' if the file is "sticky" (will
- be retained in swap space after execution), '-' otherwise. */
-
-static void
-DEFUN (file_mode_string, (s, a), struct stat * s AND char * a)
-{
- (a[0]) = (file_type_letter (s));
- rwx ((((s -> st_mode) & 0700) << 0), (& (a [1])));
- rwx ((((s -> st_mode) & 0070) << 3), (& (a [4])));
- rwx ((((s -> st_mode) & 0007) << 6), (& (a [7])));
-#ifdef S_ISUID
- if (((s -> st_mode) & S_ISUID) != 0)
- (a[3]) = (((a[3]) == 'x') ? 's' : 'S');
-#endif
-#ifdef S_ISGID
- if (((s -> st_mode) & S_ISGID) != 0)
- (a[6]) = (((a [6]) == 'x') ? 's' : 'S');
-#endif
-#ifdef S_ISVTX
- if (((s -> st_mode) & S_ISVTX) != 0)
- (a[9]) = (((a [9]) == 'x') ? 't' : 'T');
-#endif
-}
-\f
-static char
-DEFUN (file_type_letter, (s), struct stat * s)
-{
- switch ((s -> st_mode) & S_IFMT)
- {
- case S_IFDIR:
- return ('d');
- case S_IFCHR:
- return ('c');
- case S_IFBLK:
- return ('b');
-#ifdef S_IFLNK
- case S_IFLNK:
- return ('l');
-#endif
-#ifdef S_IFMPC
-/* These do not seem to exist */
- case S_IFMPC:
- case S_IFMPB:
- return ('m');
-#endif
-#ifdef S_IFSOCK
- case S_IFSOCK:
- return ('s');
-#endif
-#ifdef S_IFIFO
- case S_IFIFO:
- return ('p');
-#endif
-#ifdef S_IFNWK /* hp-ux hack */
- case S_IFNWK:
- return ('n');
-#endif
- default:
- return ('-');
- }
-}
-
-static void
-DEFUN (rwx, (bits, chars), unsigned short bits AND char * chars)
-{
- (chars[0]) = (((bits & S_IREAD) != 0) ? 'r' : '-');
- (chars[1]) = (((bits & S_IWRITE) != 0) ? 'w' : '-');
- (chars[2]) = (((bits & S_IEXEC) != 0) ? 'x' : '-');
-}
-\f
-DEFINE_PRIMITIVE ("FILE-TOUCH", Prim_file_touch, 1, 1,
- "Given a file name, change the times of the file to the current time.\n\
-If the file does not exist, create it.\n\
-Both the access time and modification time are changed.\n\
-Return #F if the file existed and its time was modified.\n\
-Otherwise the file did not exist and it was created.")
-{
- PRIMITIVE_HEADER (1);
- PRIMITIVE_RETURN (file_touch ((CONST char *) (STRING_ARG (1))));
-}
-
-static SCHEME_OBJECT
-DEFUN (file_touch, (filename), CONST char * filename)
-{
- int fd;
- transaction_begin ();
- {
- unsigned int count = 0;
- while (1)
- {
- count += 1;
- /* Use O_EXCL to prevent overwriting existing file. */
- fd = (DOS_open (filename, (O_RDWR | O_CREAT | O_EXCL), MODE_REG));
- if (fd >= 0)
- {
- protect_fd (fd);
- transaction_commit ();
- return (SHARP_T);
- }
- if (errno == EEXIST)
- {
- fd = (DOS_open (filename, O_RDWR, MODE_REG));
- if (fd >= 0)
- {
- protect_fd (fd);
- break;
- }
- else if ((errno == ENOENT) || (errno == ESTALE))
- continue;
- }
- if (count >= FILE_TOUCH_OPEN_TRIES)
- error_system_call (errno, syscall_open);
- }
- }
- {
- struct stat file_status;
- STD_VOID_SYSTEM_CALL (syscall_fstat, (DOS_fstat (fd, (&file_status))));
- if (((file_status . st_mode) & S_IFMT) != S_IFREG)
- error_bad_range_arg (1);
- /* CASE 3: file length of 0 needs special treatment. */
- if ((file_status . st_size) == 0)
- {
- char buf [1];
- (buf[0]) = '\0';
- STD_VOID_SYSTEM_CALL (syscall_write, (DOS_write (fd, buf, 1)));
-#ifdef HAVE_TRUNCATE
- STD_VOID_SYSTEM_CALL (syscall_ftruncate, (DOS_ftruncate (fd, 0)));
- transaction_commit ();
-#else /* not HAVE_TRUNCATE */
- transaction_commit ();
- fd = (DOS_open (filename, (O_WRONLY | O_TRUNC), MODE_REG));
- if (fd >= 0)
- STD_VOID_SYSTEM_CALL (syscall_close, (DOS_close (fd)));
-#endif /* HAVE_TRUNCATE */
- return (SHARP_F);
- }
- }
- /* CASE 4: read, then write back the first byte in the file. */
- {
- char buf [1];
- int scr;
- STD_UINT_SYSTEM_CALL (syscall_read, scr, (DOS_read (fd, buf, 1)));
- if (scr > 0)
- {
- STD_VOID_SYSTEM_CALL (syscall_lseek, (DOS_lseek (fd, 0, SEEK_SET)));
- STD_VOID_SYSTEM_CALL (syscall_write, (DOS_write (fd, buf, 1)));
- }
- }
- transaction_commit ();
- return (SHARP_F);
-}
-
-static void
-DEFUN (protect_fd_close, (ap), PTR ap)
-{
- DOS_close (* ((int *) ap));
-}
-
-static void
-DEFUN (protect_fd, (fd), int fd)
-{
- int * p = (dstack_alloc (sizeof (int)));
- (*p) = fd;
- transaction_record_action (tat_always, protect_fd_close, p);
-}
-\f
-DEFINE_PRIMITIVE ("SET-FILE-TIMES!", Prim_set_file_times, 3, 3,
- "Change the access and modification times of FILE.\n\
-The second and third arguments are the respective times;\n\
-they are integers are the times in seconds since 00:00:00 GMT, Jan. 1, 1970\n\
-The file must exist and you must be the owner (or superuser).")
-{
- PRIMITIVE_HEADER (3);
- {
- time_t times[2];
-
- times[0] = (time_t) arg_integer (2);
- times[1] = (time_t) arg_integer (3);
- STD_VOID_SYSTEM_CALL(syscall_utime, (utime ((STRING_ARG (1)), ×)));
- PRIMITIVE_RETURN (SHARP_F);
- }
-}
-
-DEFINE_PRIMITIVE ("FILE-EQ?", Prim_file_eq_p, 2, 2,
- "True iff the two file arguments are the same file.")
-{
- extern int EXFUN (DOS_canonicalize_filename, (char *, char *));
- static char buf1[128], buf2[128];
- PRIMITIVE_HEADER (2);
-
- if (((DOS_canonicalize_filename ((STRING_ARG (1)), &buf1[0]))
- == -1)
- || ((DOS_canonicalize_filename ((STRING_ARG (2)), &buf2[0]))
- == -1))
- error_external_return ();
- PRIMITIVE_RETURN (BOOLEAN_TO_OBJECT ((strcmp (&buf1[0], &buf2[0])) == 0));
-}
-
-/* This is a dummy primitive -- see "prntfs.c" for the real one. */
-DEFINE_PRIMITIVE ("NT-GET-VOLUME-INFORMATION", Prim_NT_get_vol_info, 1, 1, 0)
-{
- PRIMITIVE_HEADER (1);
- {
- SCHEME_OBJECT result = (allocate_marked_vector (TC_VECTOR, 5, 1));
- VECTOR_SET (result, 0, (char_pointer_to_string ("")));
- VECTOR_SET (result, 1, (ulong_to_integer (0)));
- VECTOR_SET (result, 2, (ulong_to_integer (12)));
- VECTOR_SET (result, 3, (ulong_to_integer (0)));
- VECTOR_SET (result, 4, (char_pointer_to_string ("FAT")));
- PRIMITIVE_RETURN (result);
- }
-}
+++ /dev/null
-/* -*-C-*-
- System file for 386BSD
-
-$Id: 386bsd.h,v 1.3 1999/01/02 06:11:34 cph Exp $
-
-Copyright (c) 1993-1999 Massachusetts Institute of Technology
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or (at
-your option) any later version.
-
-This program is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-#define C_SWITCH_SYSTEM -I/usr/X11R6/include
-
-#define C_OPTIMIZE_SWITCH -O6
-
-#define LIBX11_MACHINE -L/usr/X11R6/lib
-
-#define LIBS_TERMCAP -ltermcap
-
-#define LIB_DEBUG
-
-#define ALTERNATE_M4 s/ultrix.m4
-
-/* Use the built-in files <limits.h> and <float.h> rather than those
- generated by the "hard-par" program. */
-#define USE_BUILT_IN_LIMITS_FILES
-
-#ifdef __bsdi__
-/* Compile using shared libraries and GCC v2. */
-#define ALTERNATE_CC shlicc2
-#endif
-
-#ifdef __FreeBSD__
-#define ALTERNATE_CC gcc
-#endif
+++ /dev/null
-/* -*-C-*-
- System file for AIX
-
-$Id: aix.h,v 1.3 1999/01/02 06:11:34 cph Exp $
-
-Copyright (c) 1993, 1999 Massachusetts Institute of Technology
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or (at
-your option) any later version.
-
-This program is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-#define C_SWITCH_SYSTEM -D_AIX
-
-#define LIBS_SYSTEM -lbsd -ltermcap
-
-/* These definitions configure the microcode to support dynamic loading. */
-#define SOURCES_SYSTEM pruxdld.c
-#define OBJECTS_SYSTEM pruxdld.o
-#define LD_SWITCH_SYSTEM -bE:scheme.exp
+++ /dev/null
-/* -*-C-*-
- System file for BSD4.2
-
-$Id: bsd4-2.h,v 1.8 1999/01/02 06:11:34 cph Exp $
-
-Copyright (c) 1989-1999 Massachusetts Institute of Technology
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or (at
-your option) any later version.
-
-This program is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-#define C_SWITCH_SYSTEM -D_BSD4_2
-
-#define LIBS_TERMCAP -ltermcap
-
-#define ALTERNATE_M4 s/ultrix.m4
+++ /dev/null
-/* -*-C-*-
- System file for BSD4.3
-
-$Id: bsd4-3.h,v 1.6 1999/01/02 06:11:34 cph Exp $
-
-Copyright (c) 1990-1999 Massachusetts Institute of Technology
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or (at
-your option) any later version.
-
-This program is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-#define C_SWITCH_SYSTEM -D_BSD4_3 -DCAST_FUNCTION_TO_INT_BUG
-
-#define LIBS_TERMCAP -ltermcap
-
-#define ALTERNATE_M4 s/ultrix.m4
+++ /dev/null
-/* -*-C-*-
- System file for DEC OSF1
-
-$Id: decosf.h,v 1.4 1993/11/21 18:55:14 gjr Exp $
-
-Copyright (C) 1992-1993 Digital Equipment Corporation */
-
-#define LIB_DEBUG /* no -lg */
-
-/* AUTOCLOBBER_BUG temporarily defined (until BL10) and release. */
-/* Apparently it is no longer necessary at BL10 -DAUTOCLOBBER_BUG. */
-
-#define C_SWITCH_SYSTEM -std1
-
-/* These definitions configure the microcode to support dynamic loading. */
-#define SOURCES_SYSTEM pruxdld.c
-#define OBJECTS_SYSTEM pruxdld.o
+++ /dev/null
-#!/bin/csh -f
-###
-### $Id: dos.m4,v 1.6 1993/06/24 07:59:37 gjr Exp $
-###
-### Copyright (c) 1992-1993 Massachusetts Institute of Technology
-###
-#### Postprocessing to get valid dos assembly language from cmpauxmd/i386.m4
-
-set tmpfil = "m4.tmp"
-set seen_input = 0
-rm -f "$tmpfil"
-
-echo changecom\(\`\;\'\) >> "$tmpfil"
-echo "define(DOS,1)" >> "$tmpfil"
-while ($#argv != 0)
- if ("$argv[1]" == "-P") then
- echo "$argv[2]" >> "$tmpfil"
- shift
- else
- set seen_input = 1
- sed -e '/#/;/g' < "$argv[1]" >> "$tmpfil"
- endif
- shift
-end
-if ($seen_input == 0) then
- sed -e 's/#/;/g' >> "$tmpfil"
-endif
-m4 < "$tmpfil" | sed -e 's/^\f$//' | sed -n -e '/^..*/p'
-rm -f "$tmpfil"
+++ /dev/null
-/* -*-C-*-
- System file for FreeBSD
-
-$Id: freebsd.h,v 1.4 2000/02/01 04:13:55 cph Exp $
-
-Copyright (c) 1993-2000 Massachusetts Institute of Technology
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or (at
-your option) any later version.
-
-This program is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-#ifdef __ELF__
-
-#define C_SWITCH_SYSTEM -I/usr/X11R6/include
-
-#define LIBX11_MACHINE -L/usr/X11R6/lib
-
-#define LIB_DEBUG
-
-#define ALTERNATE_M4 s/ultrix.m4
-
-#define LINUX_STATIC_LIBS(libs) -Xlinker -Bstatic libs -Xlinker -Bdynamic
-
-#define M4_SWITCH_SYSTEM -P "define(SUPPRESS_LEADING_UNDERSCORE,1)"
-
-#define LIBS_TERMCAP LINUX_STATIC_LIBS (-ltermcap)
-#define HAVE_TERMINFO
-
-/* Use the built-in files <limits.h> and <float.h> rather than those
- generated by the "hard-par" program. */
-#define USE_BUILT_IN_LIMITS_FILES
-
-#else /* not __ELF__ */
-
-#include "386bsd.h"
-
-#endif /* not __ELF__ */
+++ /dev/null
-/* -*-C-*-
- System file for HP-UX
-
-$Id: hpux.h,v 1.12 1999/01/02 06:11:34 cph Exp $
-
-Copyright (c) 1989-1999 Massachusetts Institute of Technology
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or (at
-your option) any later version.
-
-This program is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-#define HAVE_TERMINFO
-
-/* Define HAVE_STARBASE_GRAPHICS if you want Starbase graphics support. */
-/* #define HAVE_STARBASE_GRAPHICS */
-
-/* No special libraries are needed for debugging. */
-#define LIB_DEBUG
-
-#ifndef INSTALL_PROGRAM
-#define INSTALL_PROGRAM cp
-#endif
-
-/* For releases of hp-UX prior to 9.0 change the following lines to
- read X11R4 instead of X11R5. */
-#define C_SWITCH_SYSTEM -D_HPUX -I/usr/include/X11R5
-#define LD_SWITCH_SYSTEM -L /usr/lib/X11R5 -Wl,-E
-
-/* These definitions, and the -Wl,-E in LD_SWITCH_SYSTEM, configure
- the microcode to support dynamic loading. */
-#define SOURCES_SYSTEM pruxdld.c
-#define OBJECTS_SYSTEM pruxdld.o
-#define LIBS_SYSTEM -ldld
+++ /dev/null
-/* -*-C-*-
- System file for SGI's IRIS version 4.x
-
-$Id: irix4.h,v 1.5 1999/01/02 06:11:34 cph Exp $
-
-Copyright (c) 1992-1999 Massachusetts Institute of Technology
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or (at
-your option) any later version.
-
-This program is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-#define HAVE_TERMINFO
-
-#ifndef INSTALL_PROGRAM
-#define INSTALL_PROGRAM cp
-#endif
-
-#define C_SWITCH_SYSTEM -D_IRIX4
-#define ALTERNATE_M4 s/ultrix.m4
-#define ALTERNATE_CC cc -cckr -float -Olimit 2000
-#define LIBS_SYSTEM -lmalloc
+++ /dev/null
-/* -*-C-*-
- System file for SGI's IRIS version 6.x
-
-$Id: irix6.h,v 1.2 1999/01/02 06:11:34 cph Exp $
-
-Copyright (c) 1998-1999 Massachusetts Institute of Technology
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or (at
-your option) any later version.
-
-This program is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-#define HAVE_TERMINFO
-
-#ifndef INSTALL_PROGRAM
-#define INSTALL_PROGRAM cp
-#endif
-
-#define C_SWITCH_SYSTEM -xansi -float -Olimit 2000 -D_IRIX6
-#define ALTERNATE_M4 s/ultrix.m4
-#define ALTERNATE_CC cc
-#define LIBS_SYSTEM
-
-/* Use the built-in files <limits.h> and <float.h> rather than those
- generated by the "hard-par" program. */
-#define USE_BUILT_IN_LIMITS_FILES
+++ /dev/null
-/* -*-C-*-
- System file for Linux
-
-$Id: linux.h,v 1.20 2000/02/07 04:53:08 cph Exp $
-
-Copyright (c) 1995-2000 Massachusetts Institute of Technology
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or (at
-your option) any later version.
-
-This program is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-#define LIBX11_SYSTEM -L/usr/X11R6/lib
-
-#define LIB_DEBUG
-
-#define ALTERNATE_M4 s/ultrix.m4
-
-#define LINUX_STATIC_LIBS(libs) -Xlinker -Bstatic libs -Xlinker -Bdynamic
-
-#ifdef __ELF__
-#if ((__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 95)))
-#define M4_SWITCH_SYSTEM -P "define(LINUX_ELF,1)" -P "define(CALLEE_POPS_STRUCT_RETURN,1)"
-#else
-#define M4_SWITCH_SYSTEM -P "define(LINUX_ELF,1)"
-#endif
-/* Newer versions of Debian don't really support termcap. However,
- ncurses is supported on all GNU/Linux systems, so we'll use that
- instead. */
-#define LIBS_TERMCAP LINUX_STATIC_LIBS (-lncurses)
-#define HAVE_TERMINFO
-/* Comment out the following line if you are running ncurses 1.9.9g or
- later. Version 1.9.9e and earlier defined "tparam", but version
- 1.9.9g and later do not. */
-/* #define TERMCAP_FILES */
-#else
-#define M4_SWITCH_SYSTEM
-#define LIBS_TERMCAP LINUX_STATIC_LIBS (-ltermcap)
-#endif
-
-#define LD_SWITCH_SYSTEM -export-dynamic
-
-#ifndef DISABLE_DLD_SUPPORT
-/* These definitions configure the microcode to support dynamic loading. */
-#define SOURCES_SYSTEM pruxdld.c
-#define OBJECTS_SYSTEM pruxdld.o
-#define LIBS_SYSTEM -ldl
-#endif
-
-/* Use the built-in files <limits.h> and <float.h> rather than those
- generated by the "hard-par" program. */
-#define USE_BUILT_IN_LIMITS_FILES
+++ /dev/null
-OUTPUT_FORMAT("elf32-i386", "elf32-i386",
- "elf32-i386")
-OUTPUT_ARCH(i386)
-ENTRY(_start)
-SEARCH_DIR(/lib); SEARCH_DIR(/usr/lib); SEARCH_DIR(/usr/local/lib); SEARCH_DIR(/usr/i486-linux/lib);
-/* Do we need any of these for elf?
- __DYNAMIC = 0; */
-SECTIONS
-{
- /* Read-only sections, merged into text segment: */
- . = 0x00010000 + SIZEOF_HEADERS;
- .interp : { *(.interp) }
- .hash : { *(.hash) }
- .dynsym : { *(.dynsym) }
- .dynstr : { *(.dynstr) }
- .rel.text : { *(.rel.text) }
- .rela.text : { *(.rela.text) }
- .rel.data : { *(.rel.data) }
- .rela.data : { *(.rela.data) }
- .rel.rodata : { *(.rel.rodata) }
- .rela.rodata : { *(.rela.rodata) }
- .rel.got : { *(.rel.got) }
- .rela.got : { *(.rela.got) }
- .rel.ctors : { *(.rel.ctors) }
- .rela.ctors : { *(.rela.ctors) }
- .rel.dtors : { *(.rel.dtors) }
- .rela.dtors : { *(.rela.dtors) }
- .rel.init : { *(.rel.init) }
- .rela.init : { *(.rela.init) }
- .rel.fini : { *(.rel.fini) }
- .rela.fini : { *(.rela.fini) }
- .rel.bss : { *(.rel.bss) }
- .rela.bss : { *(.rela.bss) }
- .rel.plt : { *(.rel.plt) }
- .rela.plt : { *(.rela.plt) }
- .init : { *(.init) } =0x9090
- .plt : { *(.plt) }
- .text :
- {
- *(.text)
- /* .gnu.warning sections are handled specially by elf32.em. */
- *(.gnu.warning)
- } =0x9090
- _etext = .;
- PROVIDE (etext = .);
- .fini : { *(.fini) } =0x9090
- .rodata : { *(.rodata) }
- .rodata1 : { *(.rodata1) }
- /* Adjust the address for the data segment. We want to adjust up to
- the same address within the page on the next page up. It would
- be more correct to do this:
- . = ALIGN(0x1000)
- + ((ALIGN(8) + 0x1000 - ALIGN(0x1000))
- & (0x1000 - 1);
- The current expression does not correctly handle the case of a
- text segment ending precisely at the end of a page; it causes the
- data segment to skip a page. The above expression does not have
- this problem, but it will currently (2/95) cause BFD to allocate
- a single segment, combining both text and data, for this case.
- This will prevent the text segment from being shared among
- multiple executions of the program; I think that is more
- important than losing a page of the virtual address space (note
- that no actual memory is lost; the page which is skipped can not
- be referenced). */
- . = ALIGN(0x1000) + ((ALIGN(8) + 0x1000 - ALIGN(0x1000)) & (0x1000 - 1));
- .data :
- {
- *(.data)
- CONSTRUCTORS
- }
- .data1 : { *(.data1) }
- .ctors : { *(.ctors) }
- .dtors : { *(.dtors) }
- .got : { *(.got.plt) *(.got) }
- .dynamic : { *(.dynamic) }
- /* We want the small data sections together, so single-instruction offsets
- can access them all, and initialized data all before uninitialized, so
- we can shorten the on-disk segment size. */
- .sdata : { *(.sdata) }
- _edata = .;
- PROVIDE (edata = .);
- __bss_start = .;
- .sbss : { *(.sbss) *(.scommon) }
- .bss :
- {
- *(.dynbss)
- *(.bss)
- *(COMMON)
- }
- _end = . ;
- PROVIDE (end = .);
- /* These are needed for ELF backends which have not yet been
- converted to the new style linker. */
- .stab 0 : { *(.stab) }
- .stabstr 0 : { *(.stabstr) }
- /* DWARF debug sections.
- Symbols in the .debug DWARF section are relative to the beginning of the
- section so we begin .debug at 0. It's not clear yet what needs to happen
- for the others. */
- .debug 0 : { *(.debug) }
- .debug_srcinfo 0 : { *(.debug_srcinfo) }
- .debug_aranges 0 : { *(.debug_aranges) }
- .debug_pubnames 0 : { *(.debug_pubnames) }
- .debug_sfnames 0 : { *(.debug_sfnames) }
- .line 0 : { *(.line) }
- /* These must appear regardless of . */
-}
+++ /dev/null
-/* -*-C-*-
- System file for Mach emulating BSD4.3
-
-$Id: mach4-3.h,v 1.4 1999/01/02 06:11:34 cph Exp $
-
-Copyright (c) 1992-1999 Massachusetts Institute of Technology
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or (at
-your option) any later version.
-
-This program is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-#define C_SWITCH_SYSTEM -D_BSD4_3 -D_MACH_UNIX -DCAST_FUNCTION_TO_INT_BUG
-
-#define LIBS_TERMCAP -ltermcap
-
-#define ALTERNATE_M4 s/ultrix.m4
-
-#define LIBS_SYSTEM -lmach
+++ /dev/null
-/* -*-C-*-
- System file for Sony NEWS-OS version 5
-
-$Id: newsos5.h,v 1.5 1999/01/02 06:11:34 cph Exp $
-
-Copyright (c) 1992-1999 Massachusetts Institute of Technology
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or (at
-your option) any later version.
-
-This program is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-#include "s/sysv4.h"
-
-#ifndef ALTERNATE_CC
-/* This is required for version 5.0.2 or later.
- Comment this out if you have 5.0.1. */
-#define LD_SWITCH_SYSTEM -non_shared
-#endif
+++ /dev/null
-/* -*-C-*-
- System file for NeXT running Mach
-
-$Id: nextos.h,v 1.7 1999/01/02 06:11:34 cph Exp $
-
-Copyright (c) 1990-1999 Massachusetts Institute of Technology
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or (at
-your option) any later version.
-
-This program is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-#define C_SWITCH_SYSTEM -bsd -fwritable-strings -D_NEXTOS
-#define LIBS_TERMCAP -ltermcap
-/* -lg not needed if -g is given. */
-#define LIB_DEBUG
+++ /dev/null
-#!/bin/csh -f
-###
-### $Id: nt.m4,v 1.2 1995/10/24 06:29:51 cph Exp $
-###
-### Copyright (c) 1993-95 Massachusetts Institute of Technology
-###
-### Processing to get Win32 assembly language from "i386.m4".
-
-set tmpfil = "m4.tmp"
-set seen_input = 0
-rm -f "$tmpfil"
-
-echo changecom\(\`\;\'\) >> "$tmpfil"
-echo "define(WIN32,1)" >> "$tmpfil"
-while ($#argv != 0)
- if ("$argv[1]" == "-P") then
- echo "$argv[2]" >> "$tmpfil"
- shift
- else
- set seen_input = 1
- sed -e '/#/;/g' < "$argv[1]" >> "$tmpfil"
- endif
- shift
-end
-if ($seen_input == 0) then
- sed -e 's/#/;/g' >> "$tmpfil"
-endif
-m4 < "$tmpfil" | sed -e 's/^\f$//' | sed -n -e '/^..*/p'
-rm -f "$tmpfil"
+++ /dev/null
-/* -*-C-*-
- System file for SUNOS
-
-$Id: sunos3.h,v 1.5 1999/01/02 06:11:34 cph Exp $
-
-Copyright (c) 1990-1999 Massachusetts Institute of Technology
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or (at
-your option) any later version.
-
-This program is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-#ifndef ALTERNATE_CC
-#define C_SWITCH_SYSTEM -D_SUNOS3 -DCAST_FUNCTION_TO_INT_BUG
-#else
-#define C_SWITCH_SYSTEM -D_SUNOS3
-#endif
-
-#define LIBS_TERMCAP -ltermcap
-
-#define ALTERNATE_M4 s/ultrix.m4
+++ /dev/null
-/* -*-C-*-
- System file for SUNOS
-
-$Id: sunos4.h,v 1.8 1999/01/02 06:11:34 cph Exp $
-
-Copyright (c) 1990-1999 Massachusetts Institute of Technology
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or (at
-your option) any later version.
-
-This program is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-#define C_SWITCH_SYSTEM -D_SUNOS4
-
-#define LIBS_TERMCAP -ltermcap
-
-#define ALTERNATE_M4 s/ultrix.m4
-
-/* These definitions configure the microcode to support dynamic loading. */
-#define SOURCES_SYSTEM pruxdld.c
-#define OBJECTS_SYSTEM pruxdld.o
-#define LIBS_SYSTEM -ldl
+++ /dev/null
-/* -*-C-*-
- System file for AT&T System V Release 3
-
-$Id: sysv3.h,v 1.5 1999/01/02 06:11:34 cph Exp $
-
-Copyright (c) 1990-1999 Massachusetts Institute of Technology
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or (at
-your option) any later version.
-
-This program is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-#define HAVE_TERMINFO
-
-#ifndef INSTALL_PROGRAM
-#define INSTALL_PROGRAM cp
-#endif
-
-#ifndef _SYSV
-#define _SYSV
-#endif
-
-#define C_SWITCH_SYSTEM -D_SYSV3
+++ /dev/null
-/* -*-C-*-
- System file for AT&T System V Release 4
-
-$Id: sysv4.h,v 1.4 1999/01/02 06:11:34 cph Exp $
-
-Copyright (c) 1991-1999 Massachusetts Institute of Technology
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or (at
-your option) any later version.
-
-This program is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-#define HAVE_TERMINFO
-
-#ifndef INSTALL_PROGRAM
-#define INSTALL_PROGRAM cp
-#endif
-
-#define C_SWITCH_SYSTEM -D_SYSV4
-#define LIBS_SYSTEM -lsocket -lnsl
+++ /dev/null
-/* -*-C-*-
- System file for Ultrix
-
-$Id: ultrix.h,v 1.16 1999/01/02 06:11:34 cph Exp $
-
-Copyright (c) 1989-1999 Massachusetts Institute of Technology
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or (at
-your option) any later version.
-
-This program is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-/* Why? -- ask JMiller */
-#undef ultrix
-
-/* This is in mips.h for some reason. */
-/* #define LIB_DEBUG */
-
-#define _ULTRIX
-#define C_SWITCH_SYSTEM -D_ULTRIX -YPOSIX
-#define LD_SWITCH_SYSTEM -YPOSIX
-
-#define LIBS_TERMCAP -ltermcap
-
-/* Fix random bug in Ultrix "libX11.a"; I quote:
-
- "Linker library processing works this way. If the library hasn't
- had ranlib(1) run on it, the Linker searches the library
- sequentially exactly once, loading every module that resolves a
- reference on the undefined symbol list. If the library has been
- processed by ranlib(1), the Linker searches the index that ranlib
- built for unresolved external references and loads any modules that
- resolve those references. It repeatedly searches the index until
- either it has no more unresolved references or until a search
- results in no more modules being loaded. The Linker then processes
- the next item on the command line.
-
- This explains why -lc -lX11 -lc works but -lX11 -lc doesn't. The
- emacs code itself references calloc or cfree somewhere. If the
- Linker encounters libc.a before libX11.a, it will use libc.a's
- version of calloc/cfree. By the time it encounters libX11.a,
- calloc and cfree are not on the undefined symbol list and thus
- there is no reason to load XvmsAlloc.o. You need the second
- reference to libc.a on the command line to resolve any references
- from modules in libX11.a to modules in libc.a not already loaded.
- If you put libX11.a first, calloc and cfree references cause
- XvmsAlloc.o to be loaded. This module also defines free, malloc,
- and realloc, causing the multiple symbol definitions message from
- ld(1)." */
-
-#define LIBX11_SYSTEM -lc
-
-#define ALTERNATE_M4 s/ultrix.m4
-#ifndef INSTALL_PROGRAM
-#define INSTALL_PROGRAM cp
-#endif
+++ /dev/null
-#!/bin/sh
-###
-### $Id: ultrix.m4,v 1.7 1995/06/28 22:05:35 cph Exp $
-###
-### Copyright (c) 1989-1995 Massachusetts Institute of Technology
-###
-#### Postprocessing to make m4 work correctly under Ultrix & BSD.
-
-if [ $# = 0 ]
-then
- sed -e '/^#/D' | m4 | sed -e 's/@/$/g' -e 's/^\f$//'
-else
- tmpfil="m4.tmp"
- seen_input=0
- rm -f "$tmpfil"
-
- while [ $# != 0 ]
- do
- if [ "$1" = "-P" ]
- then
- echo "$2" >> "$tmpfil"
- shift
- else
- seen_input=1
- sed -e '/^#/D' < "$1" >> "$tmpfil"
- fi
- shift
- done
- if [ $seen_input = 0 ]
- then
- sed -e '/^#/D' >> "$tmpfil"
- fi
- m4 < "$tmpfil" | sed -e 's/@/$/g' -e 's/^\f$//'
- rm -f "$tmpfil"
-fi
+++ /dev/null
-/* -*-C-*-
- System file for Encore UMAX42 and Mach
-
-$Id: umax.h,v 1.6 1999/01/02 06:11:34 cph Exp $
-
-Copyright (c) 1989-1999 Massachusetts Institute of Technology
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or (at
-your option) any later version.
-
-This program is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-#define C_SWITCH_SYSTEM -D_BSD4_2 -Dumax
-
-#define LIBS_TERMCAP -ltermcap
+++ /dev/null
-/* -*-C-*-
-
-$Id: cf-dist.h,v 1.25 2000/10/16 18:32:09 cph Exp $
-
-Copyright (c) 1989-2000 Massachusetts Institute of Technology
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or (at
-your option) any later version.
-
-This program is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-/* Change the value of this macro to 1 to use the C back end instead of
- a native back end (if one exists).
-*/
-
-#define BACK_END_TYPE 2
-
-#define PROC_TYPE_UNKNOWN 0
-#define PROC_TYPE_68000 1
-#define PROC_TYPE_68020 2
-#define PROC_TYPE_HPPA 3 /* HP Precision Architecture */
-#define PROC_TYPE_VAX 4
-#define PROC_TYPE_MIPS 5
-#define PROC_TYPE_NS32K 6
-#define PROC_TYPE_HCX 7 /* Harris HCX */
-#define PROC_TYPE_IBM032 8 /* IBM RT */
-#define PROC_TYPE_SPARC 9
-#define PROC_TYPE_I386 10
-#define PROC_TYPE_ALPHA 11
-#define PROC_TYPE_POWER 12 /* IBM RS6000 and PowerPC */
-#define PROC_TYPE_LIARC 13 /* Scheme compiled to C */
-
-#if (BACK_END_TYPE == 0)
-#define PROC_TYPE PROC_TYPE_UNKNOWN
-#endif
-
-#if (BACK_END_TYPE == 1)
-#define PROC_TYPE PROC_TYPE_LIARC
-#endif
-
-/* Define this macro to use a non-standard compiler.
- It must be defined before including the m/ and s/ files because
- they may be conditionalized on it. */
-/* #define ALTERNATE_CC gcc */
-
-/* Define this macro to use a non-standard assembler. */
-/* #define ALTERNATE_AS gashp */
-
-/* Define this macro to use a non-standard install program. */
-/* #define INSTALL_PROGRAM cp -p */
-
-#include "s.h"
-#include "m.h"
-
-#ifndef PROC_TYPE
-#define PROC_TYPE PROC_TYPE_UNKNOWN
-#endif
-
-/* The following two switches are mutually exclusive for most C compilers.
- An exception is the GNU C compiler. */
-
-/* If defined, this prevents the C compiler from running its optimizer. */
-/* #define SUPPRESS_C_OPTIMIZER */
-
-#ifndef __GNUC__
-/* If defined, this prevents the C compiler from
- generating debugging information. */
-#define SUPPRESS_C_DEBUGGING
-#endif
-
-/* Some compilation options:
- -DDISABLE_HISTORY turns off history recording mechanism
- -DCOMPILE_STEPPER turns on support for the stepper
- */
-#define C_SWITCH_FEATURES -DCOMPILE_STEPPER
-
-/* Define HAVE_X_WINDOWS if you want to use the X window system. */
-#define HAVE_X_WINDOWS
-
-#if defined(__hpux) || defined(hpux)
-/* If this is an HP-UX system, Starbase graphics support is available.
- If you don't want this support, comment out the following line. */
-#define HAVE_STARBASE_GRAPHICS
-#endif
-
-#ifdef HAVE_STARBASE_GRAPHICS
-/* You may need to tweak one of the following device driver
- definitions to be correct for your machine. */
-
-#if defined(__hp9000s700) || defined(hp9000s700)
-
-/* This default covers the standard grayscale and 8-bit color graphics
- for series 700 workstations. If you have 24-bit graphics you will
- need to change this. */
-#define STARBASE_DEVICE_DRIVERS -lddgcrx
-
-#else
-#if defined(__hp9000s300) || defined(hp9000s300)
-
-/* This default covers the standard monochrome and 8-bit (or less)
- color displays for 300 and 400 series workstations. It also
- supports the 98556 graphics accelerator. */
-#define STARBASE_DEVICE_DRIVERS -ldd300h -ldd98556
-
-#endif /* __hp9000s300 */
-#endif /* __hp9000s700 */
-#endif /* HAVE_STARBASE_GRAPHICS */
+++ /dev/null
-#!/bin/sh
-# Configuration script for MIT Scheme
-# $Id: config,v 1.31 2000/01/31 03:32:05 cph Exp $
-# Modelled on the configuration script for GNU CC
-# The section between lines is the copyright prefix from the GNU CC config.
-#----------------------------------------------------------------------
-
-# Copyright (C) 1988 Free Software Foundation, Inc.
-# Copyright (C) 1988-2000 Massachusetts Institute of Technology
-
-#This file is part of GNU CC.
-
-#GNU CC is free software; you can redistribute it and/or modify
-#it under the terms of the GNU General Public License as published by
-#the Free Software Foundation; either version 1, or (at your option)
-#any later version.
-
-#GNU CC is distributed in the hope that it will be useful,
-#but WITHOUT ANY WARRANTY; without even the implied warranty of
-#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-#GNU General Public License for more details.
-
-#You should have received a copy of the GNU General Public License
-#along with GNU CC; see the file COPYING. If not, write to
-#the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
-
-#----------------------------------------------------------------------
-#
-# Shell script to create proper links to machine-dependent files in
-# preparation for compiling gcc.
-#
-# Usage: config [-C-back-end | -native-back-end | -no-back-end] machine
-#
-# If config succeeds, it leaves its status in config.out.
-# If config fails after disturbing the status quo,
-# config.out is removed.
-#
-
-usage()
-{
- echo "Usage: $progname [-C-back-end | -native-back-end | -no-back-end] machine"
- echo "Where \`machine' is one of:"
- echo "alpha-osf alpha"
- echo "mips-ultrix dec-3100 dec-5100 pmax nws3250 sgi-irix4 sgi-irix6"
- echo "hp9k300 hp9k400 hp9k700 hp9k800 next"
- echo "sun3 sun3-os3 sun3-nfp sun3-os3-nfp sun4 sparc"
- echo "i386-sysv 386bsd umax i386-linux i386-freebsd"
- echo "vax-bsd42 vax-bsd43 vax-ultrix"
- echo "rs6000"
- if [ -r config.out ]
- then
- cat config.out
- fi
- exit 1;
-}
-
-
-discriminate()
-{
- machine=$1
-
- case $machine in
- alpha-osf | alpha) # DEC Alpha running OSF
- system_file=decosf
- machine_file=alpha
- cmpint_file=alpha.h
- cmpaux_file=alpha.m4
- ;;
- mips-ultrix | dec-3100 | dec-5100 | pmax)
- system_file=ultrix
- machine_file=mips
- cmpint_file=mips.h
- cmpaux_file=mips.m4
- ;;
- sgi-irix4 | sgi4d)
- system_file=irix4
- machine_file=mips
- cmpint_file=mips.h
- cmpaux_file=mips.m4
- ;;
- sgi-irix6)
- system_file=irix6
- machine_file=mips
- cmpint_file=mips.h
- cmpaux_file=mips.m4
- ;;
- nws3250) # sony news laptop
- system_file=newsos5
- machine_file=mips
- cmpint_file=mips.h
- cmpaux_file=mips.m4
- ;;
- 386bsd)
- system_file=386bsd
- machine_file=i386
- cmpint_file=i386.h
- cmpaux_file=i386.m4
- ;;
- i386-linux)
- system_file=linux
- machine_file=i386
- cmpint_file=i386.h
- cmpaux_file=i386.m4
- ;;
- i386-freebsd)
- system_file=freebsd
- machine_file=i386
- cmpint_file=i386.h
- cmpaux_file=i386.m4
- ;;
- i386-sysv)
- system_file=sysv3
- machine_file=i386
- cmpint_file=i386.h
- cmpaux_file=i386.m4
- ;;
- hp9k800 | hp9k700) # HP9000 series 800
- system_file=hpux
- machine_file=hp9k800
- cmpint_file=hppa.h
- cmpaux_file=hppa.m4
- ;;
- hp9k300) # HP9000 series 300
- system_file=hpux
- machine_file=hp9k300
- cmpint_file=mc68k.h
- cmpaux_file=mc68k.m4
- ;;
- hp9k400) # HP9000 series 400
- system_file=hpux
- machine_file=hp9k400
- cmpint_file=mc68k.h
- cmpaux_file=mc68k.m4
- ;;
- next)
- system_file=nextos
- machine_file=next
- cmpint_file=mc68k.h
- cmpaux_file=mc68k.m4
- cmp_file=sun3-gcc.s
- ;;
- sun3)
- system_file=sunos4
- machine_file=sun3
- cmpint_file=mc68k.h
- cmpaux_file=mc68k.m4
- cmp_file=sun3.s
- ;;
- sun3-os3) # sun3, pre-4.0 sunos
- system_file=sunos3
- machine_file=sun3
- cmpint_file=mc68k.h
- cmpaux_file=mc68k.m4
- cmp_file=sun3.s
- ;;
- sun3-nfp) # sun3, No Floating Point
- system_file=sunos4
- machine_file=sun3
- cmpint_file=mc68k.h
- cmpaux_file=mc68k.m4
- cmp_file=sun3-nfp.s
- ;;
- sun3-os3-nfp) # sun3, pre-4.0 sunos, No FP
- system_file=sunos3
- machine_file=sun3
- cmpint_file=mc68k.h
- cmpaux_file=mc68k.m4
- cmp_file=sun3-nfp.s
- ;;
- sun4 | sparc)
- system_file=sunos4
- machine_file=sun4
- ;;
- rs6000)
- system_file=aix
- machine_file=rs6000
- ;;
- umax) # Encore Multimax
- system_file=umax
- machine_file=umax
- ;;
- vax-bsd42) # vaxen running 4.2BSD
- system_file=bsd4-2
- machine_file=vax
- cmpint_file=vax.h
- cmpaux_file=vax.m4
- ;;
- vax-bsd43) # vaxen running 4.3BSD
- system_file=bsd4-3
- machine_file=vax
- cmpint_file=vax.h
- cmpaux_file=vax.m4
- ;;
- vax-ultrix) # vaxen running ultrix
- system_file=ultrix
- machine_file=vax
- cmpint_file=vax.h
- cmpaux_file=vax.m4
- ;;
- *)
- echo "$progname: unknown machine name: $machine"
- usage
- esac;
-}
-
-perform()
-{
- files="s/${system_file}.h m/${machine_file}.h unxutl/makefile unxutl/ymkfile unxutl/ymake.sed"
- links="s.h m.h makefile ymkfile ymake.sed"
-
- while [ -n "$files" ]
- do
- # set file to car of files, files to cdr of files
- set $files; file=$1; shift; files=$*
- set $links; link=$1; shift; links=$*
-
- if [ ! -r $file ]
- then
- echo "$progname: cannot create a link \`$link',"
- echo "since the file \`$file' does not exist."
- exit 1
- fi
-
- $remove -f $link
- $remove -f config.out
- # Make a symlink if possible, otherwise try a hard link
- $symbolic_link $file $link 2>/dev/null || $hard_link $file $link
-
- if [ ! -r $link ]
- then
- echo "$progname: unable to link \`$link' to \`$file'."
- exit 1
- fi
- echo "Linked \`$link' to \`$file'."
- done
-
- files="unxutl/cf-dist.h"
- targets="cf.h"
-
- while [ -n "$files" ]
- do
- # set file to car of files, files to cdr of files
- set $files; file=$1; shift; files=$*
- set $targets; target=$1; shift; targets=$*
-
- if [ ! -r $file ]
- then
- echo "$progname: cannot create file \`$target',"
- echo "since the file \`$file' does not exist."
- exit 1
- fi
-
- $remove -f $target
- $remove -f config.out
- # Make a symlink if possible, otherwise try a hard link
- $copy $file $target
-
- if [ ! -r $target ]
- then
- echo "$progname: unable to copy \`$file' to \`$target'."
- exit 1
- fi
- echo "Copied \`$file' to \`$target'."
- done
-
- case $cmpint_file in
- nothing_special)
- ;;
- *)
- $symbolic_link cmpintmd/$cmpint_file cmpintmd.h 2>/dev/null \
- || $hard_link cmpintmd/$cmpint_file cmpintmd.h
- if [ ! -r cmpintmd.h ]
- then
- echo "$progname: unable to link \`cmpintmd.h' to \`cmpintmd/$cmpint_file'."
- exit 1
- fi
- echo "Linked \`cmpintmd.h' to \`cmpintmd/$cmpint_file'."
- ;;
- esac
-
- case $cmpaux_file in
- nothing_special)
- ;;
- *)
- $symbolic_link cmpauxmd/$cmpaux_file $cmpaux_target 2>/dev/null \
- || $hard_link cmpauxmd/$cmpaux_file $cmpaux_target
- if [ ! -r $cmpaux_target ]
- then
- echo "$progname: unable to link \`$cmpaux_target' to \`cmpauxmd/$cmpaux_file'."
- exit 1
- fi
- echo "Linked \`$cmpaux_target' to \`cmpauxmd/$cmpaux_file'."
- ;;
- esac
-
- case $cmp_file in
- nothing_special)
- ;;
- *)
- $symbolic_link cmpauxmd/$cmp_file cmpauxmd.s 2>/dev/null \
- || $hard_link cmpauxmd/$cmp_file cmpauxmd.s
- if [ ! -r cmpauxmd.s ]
- then
- echo "$progname: unable to link \`cmpauxmd.s' to \`cmpauxmd/$cmp_file'."
- exit 1
- fi
- echo "Linked \`cmpauxmd.s' to \`cmpauxmd/$cmp_file'."
- ;;
- esac
-
- (echo "Links are now set up for use with a $machine." ; \
- echo "Remember to edit file cf.h before using make.") \
- | tee config.out
-}
-
-progname=$0
-
-remove=rm
-hard_link="ln -f"
-symbolic_link="ln -sf"
-copy=cp
-move=mv
-edit=sed
-
-#for Test
-#remove="echo rm"
-#hard_link="echo ln -f"
-#symbolic_link="echo ln -sf"
-#copy="echo cp"
-#move="echo mv"
-#edif="echo sed"
-
-cmpint_file=nothing_special
-cmpaux_file=nothing_special
-cmpaux_target=cmpauxmd.m4
-cmp_file=nothing_special
-
-case $# in
-1)
- discriminate $*
- perform $*
- exit 0
- ;;
-
-2)
- case $1 in
-
- -C-back-end | -c-back-end)
- shift
- discriminate $*
- cmpint_file=c.h
- cmpaux_file=c.c
- cmpaux_target=cmpauxmd.c
- perform $*
- $move cf.h cf-orig.h
- $edit 's/BACK_END_TYPE 2/BACK_END_TYPE 1/' <cf-orig.h >cf.h
- $remove -f cf-orig.h
- exit 0
- ;;
-
- -native-back-end)
- shift
- discriminate $*
- perform $*
- $move cf.h cf-orig.h
- $edit 's/BACK_END_TYPE 2/BACK_END_TYPE 2/' <cf-orig.h >cf.h
- $remove -f cf-orig.h
- exit 0
- ;;
-
- -no-back-end)
- shift
- discriminate $*
- cmpint_file=nothing_special
- cmpaux_file=nothing_special
- cmpaux_target=cmpauxmd.c
- perform $*
- $move cf.h cf-orig.h
- $edit 's/BACK_END_TYPE 2/BACK_END_TYPE 0/' <cf-orig.h >cf.h
- $remove -f cf-orig.h
- exit 0
- ;;
-
- *)
- usage
- ;;
- esac
- ;;
-
-*)
- usage
- ;;
-esac
+++ /dev/null
-#
-# Makefile for MIT CScheme microcode.
-#
-# $Id: makefile,v 1.28 2000/03/22 01:52:43 cph Exp $
-#
-CPP = cc -E
-MAKE = make # BSD doesn't have it as a default.
-
-all: xmkfile
- $(MAKE) $(MAKEOVERRIDES) -f xmkfile ${MFLAGS} all
-.PHONY: all
-
-scheme: xmkfile
- $(MAKE) $(MAKEOVERRIDES) -f xmkfile ${MFLAGS} scheme
-.PHONY: scheme
-
-xscheme: xmkfile
- $(MAKE) $(MAKEOVERRIDES) -f xmkfile ${MFLAGS} xscheme
-.PHONY: xscheme
-
-bchscheme: xmkfile
- $(MAKE) $(MAKEOVERRIDES) -f xmkfile ${MFLAGS} bchscheme
-.PHONY: bchscheme
-
-bchdrn: xmkfile
- $(MAKE) $(MAKEOVERRIDES) -f xmkfile ${MFLAGS} bchdrn
-.PHONY: bchdrn
-
-psbtobin: xmkfile
- $(MAKE) $(MAKEOVERRIDES) -f xmkfile ${MFLAGS} psbtobin
-.PHONY: psbtobin
-
-bintopsb: xmkfile
- $(MAKE) $(MAKEOVERRIDES) -f xmkfile ${MFLAGS} bintopsb
-.PHONY: bintopsb
-
-ppband: xmkfile
- $(MAKE) $(MAKEOVERRIDES) -f xmkfile ${MFLAGS} ppband
-.PHONY: ppband
-
-hppacach: xmkfile
- $(MAKE) $(MAKEOVERRIDES) -f xmkfile ${MFLAGS} hppacach
-.PHONY: hppacach
-
-install: xmkfile
- $(MAKE) $(MAKEOVERRIDES) -f xmkfile ${MFLAGS} install
-.PHONY: install
-
-world: xmkfile
- $(MAKE) $(MAKEOVERRIDES) -f xmkfile ${MFLAGS} world
-.PHONY: world
-
-install.world: xmkfile
- $(MAKE) $(MAKEOVERRIDES) -f xmkfile ${MFLAGS} install.world
-.PHONY: install.world
-
-everything: xmkfile
- $(MAKE) $(MAKEOVERRIDES) -f xmkfile ${MFLAGS} everything
-.PHONY: everything
-
-# If you have a problem with cc -E here, changing
-# the definition of CPP above may fix it.
-xmkfile: ymkfile ymake.sed ymake.lcl ymake.ccl cf.h s.h m.h
- rm -f xmkfile junk.c
- cp ymkfile junk.c
- $(CPP) junk.c | sed -n -f ymake.sed > xmkfile
- rm -f junk.c
-
-ymake.lcl:
- touch ymake.lcl
-
-ymake.ccl:
- echo "COMPILED_SOURCES =" > ymake.ccl
-
-clean remove:
-# the - at the beginning of the following line is what causes make to continue
-# even if the clean.world target doesn't exist
- - $(MAKE) $(MAKEOVERRIDES) -f xmkfile ${MFLAGS} clean.world
- rm -f *.o *.s *.tch xmkfile
- rm -f scheme xscheme bchscheme bchdrn
- rm -f findprim bintopsb psbtobin breakup wsize ppband
- rm -f hard-par limits.h float.h
- rm -f usrdef.c bchdef.c compinit.h
- rm -f lint.out
-
-unconfig:
- rm -f m.h s.h cmpintmd.h cmpauxmd.* config.out
- rm -f ymkfile ymake.sed makefile
- - rm -f cf-save.h ymake-save.lcl
- - mv -f cf.h cf-save.h
- - mv -f ymake.lcl ymake-save.lcl
-
-TAGS:
- etags -r '/^DEF[A-Za-z_ \t(]+"\([^"]+\)"/' *.[ch]
-
-locked:
- rlog -L -R RCS/*,v
- rlog -L -R m/RCS/*,v
- rlog -L -R s/RCS/*,v
- rlog -L -R dosutl/RCS/*,v
- rlog -L -R ntutl/RCS/*,v
- rlog -L -R unxutl/RCS/*,v
-
-getpgsz.h : pagesize.h
- rm -f getpgsz.h
- cp pagesize.h getpgsz.h
+++ /dev/null
-/* -*- C -*-
- Switzerland local additions to the makefile
- $Id: y300.lcl,v 1.24 1993/06/24 06:40:31 gjr Exp $
- */
-
-COMMON_OBJECTS = $(CORE_OBJECTS) $(STD_GC_OBJECTS) $(UNIX_OBJECTS) $(OS_PRIM_OBJECTS)
-
-/* These extra files are for 6003. They assume we're using HP-UX. */
-
-6003_SOURCES = $(X_SOURCES) $(TERMCAP_OBJECTS) $(GRAPHICS_SOURCES)\
- SOURCES_SYSTEM SOURCES_MACHINE sgraph_a.c fft.c array.c\
- image.c
-6003_OBJECTS = $(X_OBJECTS) $(TERMCAP_OBJECTS) $(GRAPHICS_OBJECTS)\
- OBJECTS_SYSTEM OBJECTS_MACHINE sgraph_a.o fft.o array.o\
- image.o usr6003.o
-6003_LIB = $(USER_LIBS) $(GRAPHICS_LIBS) $(X_LIB) $(TERMCAP_LIBS)\
- LIB_MATH LIBS_SYSTEM LIBS_MACHINE LIB_DEBUG LIB_STANDARD
-
-/* These extra files are for the toolkit scheme.
- Vanilla scheme microcode + gpio primitives.
- */
-
-/* This is a kludge. The real library is libdvio.a, but the gnu linker
- does not like it because it defines _write but not __write, required
- by printf and family. Thus the linker loads write.o from the standard
- library, and complains about a duplicate definition of _write!
- libndvio.a is a copy of libdvio.a with __dup, ___fcntl, _ioctl, __open,
- __read, and __write defined to the same values as the names with
- only one underscore.
-
- (We have since changed to a different release of HP-UX, and the new
- release links without editing the library. For now, we'll use the
- original library. -- CPH)
-*/
-
-#if 1
-#define LIB_DVIO -ldvio
-#else
-#define LIB_DVIO -lndvio
-#endif
-
-KIT_SOURCES = $(X_SOURCES) $(TERMCAP_SOURCES) $(GRAPHICS_SOURCES)\
- SOURCES_SYSTEM SOURCES_MACHINE gpio.c
-KIT_OBJECTS = $(X_OBJECTS) $(TERMCAP_OBJECTS) $(GRAPHICS_OBJECTS)\
- OBJECTS_SYSTEM OBJECTS_MACHINE gpio.o usrkit.o
-KIT_LIB = $(USER_LIBS) $(GRAPHICS_LIBS) $(X_LIB) $(TERMCAP_LIBS)\
- LIB_MATH LIBS_SYSTEM LIBS_MACHINE LIB_DEBUG LIB_STANDARD LIB_DVIO
-
-/* Franklyn's personal scheme: 6003-like + sgraph_xt. */
-
-LYN_SOURCES = $(X_SOURCES) $(CTERM_SOURCES) $(GRAPHICS_SOURCES)\
- unixprim.c sgraph_a.c sgraph_x.c fft.c array.c image.c
-LYN_OBJECTS = $(X_OBJECTS) $(CTERM_OBJECTS) $(GRAPHICS_OBJECTS)\
- unixprim.o sgraph_a.o sgraph_x.o fft.o array.o image.o\
- usrLYN.o
-LYN_LIB = $(USER_LIBS) $(GRAPHICS_LIBS) $(X_LIB) $(CTERM_LIB)\
- -lm
-
-
-SIG_SOURCES = $(X_SOURCES) $(TERMCAP_OBJECTS)\
- SOURCES_SYSTEM SOURCES_MACHINE fft.c array.c image.c
-SIG_OBJECTS = $(X_OBJECTS) $(TERMCAP_OBJECTS)\
- OBJECTS_SYSTEM OBJECTS_MACHINE fft.o array.o image.o usrSIG.o
-SIG_LIB = $(USER_LIBS) $(X_LIB) $(TERMCAP_LIBS)\
- LIB_MATH LIBS_SYSTEM LIBS_MACHINE LIB_DEBUG LIB_STANDARD
-
-
-world: all scmsig scm6003 kitscheme
-
-everything: world ppband
-
-install.world: install scm6003
- -mv -f $(BINDIR)/scm6003 $(BINDIR)/scm6003.busy
- rm -f $(BINDIR)/scm6003.busy
- $(INSTALL) scm6003 $(BINDIR)/scm6003
- -mv -f $(BINDIR)/kitscheme $(BINDIR)/kitscheme.busy
- rm -f $(BINDIR)/kitscheme.busy
- $(INSTALL) kitscheme $(BINDIR)/kitscheme
-
-scm6003 : $(COMMON_OBJECTS) $(6003_OBJECTS)
- @ECHO "#** Re-linking" $@ because of $?
- rm -f $@
- $(CC) $(LDFLAGS) -o $@ $(COMMON_OBJECTS) $(6003_OBJECTS) $(6003_LIB)
-
-usr6003.c : $(6003_SOURCES) $(SOURCES) $(OS_PRIM_SOURCES) usrdef.tch findprim xmkfile
- @ECHO "#** Re-making" $@ because of $?
- rm -f usr6003.c
- ./findprim $(6003_SOURCES) $(SOURCES) $(OS_PRIM_SOURCES) > usr6003.c
-
-kitscheme : $(COMMON_OBJECTS) $(KIT_OBJECTS)
- @ECHO "#** Re-linking" $@ because of $?
- rm -f $@
-#if 1
- $(CC) $(LDFLAGS) -o $@ $(COMMON_OBJECTS) $(KIT_OBJECTS) $(KIT_LIB)
-#else
- gld $(LDFLAGS) -noinhibit-exec -o $@ /usr/local/lib/gcc-crt0.o \
- $(COMMON_OBJECTS) $(KIT_OBJECTS) $(KIT_LIB) \
- /usr/local/lib/gcc-gnulib -lc /usr/local/lib/gcc-gnulib
-#endif
-
-usrkit.c : $(KIT_SOURCES) $(SOURCES) $(OS_PRIM_SOURCES) usrdef.tch findprim xmkfile
- @ECHO "#** Re-making" $@ because of $?
- rm -f usrkit.c
- ./findprim $(KIT_SOURCES) $(SOURCES) $(OS_PRIM_SOURCES) > usrkit.c
-
-scmLYN : $(COMMON_OBJECTS) $(LYN_OBJECTS)
- @echo "#** Re-linking" $@ because of $?
- rm -f $@
- $(CC) $(LDFLAGS) -o $@ $(COMMON_OBJECTS) $(LYN_OBJECTS) $(LYN_LIB)
-
-usrLYN.c : $(LYN_SOURCES) $(SOURCES) $(OS_PRIM_SOURCES) usrdef.tch findprim xmkfile
- @echo "#** Re-making" $@ because of $?
- rm -f usrLYN.c
- ./findprim $(LYN_SOURCES) $(SOURCES) $(OS_PRIM_SOURCES) > usrLYN.c
-
-gpio.o : gpio.c scheme.tch prims.h
-
-
-scmsig : $(COMMON_OBJECTS) $(SIG_OBJECTS)
- @ECHO "#** Re-linking" $@ because of $?
- rm -f $@
- $(CC) $(LDFLAGS) -o $@ $(COMMON_OBJECTS) $(SIG_OBJECTS) $(SIG_LIB)
-
-usrSIG.c : $(SIG_SOURCES) $(SOURCES) $(OS_PRIM_SOURCES) usrdef.tch findprim xmkfile
- @ECHO "#** Re-making" $@ because of $?
- rm -f usrSIG.c
- ./findprim $(SIG_SOURCES) $(SOURCES) $(OS_PRIM_SOURCES) > usrSIG.c
-
+++ /dev/null
-/* -*- C -*-
- Switzerland local additions to the makefile
- $Id: y700.lcl,v 1.8 1993/07/23 20:06:58 nick Exp $
- */
-
-COMMON_OBJECTS = $(CORE_OBJECTS) $(STD_GC_OBJECTS) $(UNIX_OBJECTS) $(OS_PRIM_OBJECTS)
-
-/* Foreign function interface
- The following are reasonable defaults
- Make a file called "ffi" with the scheme-like definitions of the
-functions you want to call. Then load "gen-prim.scm" into a scheme,
-and call "(gen-prim "ffi"), which will generate an "ffi.c" and an
-"ffi.scm". Edit these as appropriate. Then add your stuff to the
-three lines below and do 'make xmkfile' followed by 'make -f xmkfile scmffi'.
- */
-
-FFI_SOURCES = ffi.c
-FFI_OBJECTS = ffi.o
-FFI_LIBS = -ldld -lcl -lisamstub -lc
-
-ALL_FFI_SOURCES = $(X_SOURCES) $(TERMCAP_OBJECTS) $(GRAPHICS_SOURCES)\
- SOURCES_SYSTEM SOURCES_MACHINE $(FFI_SOURCES)
-ALL_FFI_OBJECTS = $(X_OBJECTS) $(TERMCAP_OBJECTS) $(GRAPHICS_OBJECTS)\
- OBJECTS_SYSTEM OBJECTS_MACHINE ffi.o $(FFI_OBJECTS) usrFFI.o
-ALL_FFI_LIBS = $(USER_LIBS) $(FFI_LIBS) $(GRAPHICS_LIBS) $(X_LIB) $(TERMCAP_LIBS)\
- LIB_MATH LIBS_SYSTEM LIBS_MACHINE LIB_DEBUG LIB_STANDARD
-
-
-/* There is some hair here since scmsig (the signal-processing schemne
-for GJS) and scm6003 (thanos) need separate versions of some files.
-REAL_IS_DEFINED_DOUBLE needs to be set to 1 for scmsig and 0
-otherwise. Since we need two versions of the .o files, the convention
-is that the version with the variable set to 1 is called 'd_foo.o',
-while the other would be just 'foo.o'. Array.h will set the var to 0
-if it is unset - nick */
-
-
-/* These extra files are for 6003. They assume we're using HP-UX. */
-
-6003_SOURCES = $(X_SOURCES) $(TERMCAP_OBJECTS) $(GRAPHICS_SOURCES)\
- SOURCES_SYSTEM SOURCES_MACHINE sgraph_a.c fft.c array.c\
- image.c
-6003_OBJECTS = $(X_OBJECTS) $(TERMCAP_OBJECTS) $(GRAPHICS_OBJECTS)\
- OBJECTS_SYSTEM OBJECTS_MACHINE sgraph_a.o fft.o array.o\
- image.o usr6003.o
-6003_LIB = $(USER_LIBS) $(GRAPHICS_LIBS) $(X_LIB) $(TERMCAP_LIBS)\
- LIB_MATH LIBS_SYSTEM LIBS_MACHINE LIB_DEBUG LIB_STANDARD
-
-
-/* For GJS's signal processing stuff */
-
-SIG_SOURCES = $(X_SOURCES) $(TERMCAP_OBJECTS)\
- SOURCES_SYSTEM SOURCES_MACHINE d_fft.c d_array.c d_image.c
-SIG_OBJECTS = $(X_OBJECTS) $(TERMCAP_OBJECTS)\
- OBJECTS_SYSTEM OBJECTS_MACHINE d_fft.o d_array.o d_image.o usrSIG.o
-SIG_LIB = $(USER_LIBS) $(X_LIB) $(TERMCAP_LIBS)\
- LIB_MATH LIBS_SYSTEM LIBS_MACHINE LIB_DEBUG LIB_STANDARD
-
-world: all scmsig scm6003
-
-everything: world ppband
-
-install.world: install scmsig scm6003
- -mv -f $(BINDIR)/scm6003 $(BINDIR)/scm6003.busy
- -rm -f $(BINDIR)/scm6003.busy
- $(INSTALL) scm6003 $(BINDIR)/scm6003
- -mv -f $(BINDIR)/scmsig $(BINDIR)/scmsig.busy
- -rm -f $(BINDIR)/scmsig.busy
- $(INSTALL) scmsig $(BINDIR)/scmsig
-
-
-scmffi : $(COMMON_OBJECTS) $(ALL_FFI_OBJECTS)
- @ECHO "#** Re-linking" $@ because of $?
- rm -f $@
- $(CC) $(LDFLAGS) -o $@ $(COMMON_OBJECTS) $(ALL_FFI_OBJECTS) $(ALL_FFI_LIBS)
-
-usrFFI.c : $(ALL_FFI_SOURCES) $(SOURCES) $(OS_PRIM_SOURCES) usrdef.tch findprim xmkfile
- @ECHO "#** Re-making" $@ because of $?
- rm -f usrFFI.c
- ./findprim $(ALL_FFI_SOURCES) $(SOURCES) $(OS_PRIM_SOURCES) > usrFFI.c
-
-
-scm6003 : $(COMMON_OBJECTS) $(6003_OBJECTS)
- @ECHO "#** Re-linking" $@ because of $?
- rm -f $@
- $(CC) $(LDFLAGS) -o $@ $(COMMON_OBJECTS) $(6003_OBJECTS) $(6003_LIB)
-
-usr6003.c : $(6003_SOURCES) $(SOURCES) $(OS_PRIM_SOURCES) usrdef.tch findprim xmkfile
- @ECHO "#** Re-making" $@ because of $?
- rm -f usr6003.c
- ./findprim $(6003_SOURCES) $(SOURCES) $(OS_PRIM_SOURCES) > usr6003.c
-
-
-scmsig : $(COMMON_OBJECTS) $(SIG_OBJECTS)
- @ECHO "#** Re-linking" $@ because of $?
- rm -f $@
- $(CC) $(LDFLAGS) -o $@ $(COMMON_OBJECTS) $(SIG_OBJECTS) $(SIG_LIB)
-
-usrSIG.c : $(SIG_SOURCES) $(SOURCES) $(OS_PRIM_SOURCES) usrdef.tch findprim xmkfile
- @ECHO "#** Re-making" $@ because of $?
- rm -f usrSIG.c
- ./findprim $(SIG_SOURCES) $(SOURCES) $(OS_PRIM_SOURCES) > usrSIG.c
-
-sgraph.o sgraph_x.o sgx.o : scheme.tch prims.h sgraph.h
-sgraph_a.o : scheme.tch prims.h sgraph.h array.h
-fft.o : scheme.tch prims.h zones.h array.h image.h
-array.o image.o : scheme.tch prims.h array.h
-ffi.o : scheme.tch prims.h
-
-d_sgraph_a.o: scheme.tch prims.h sgraph.h array.h d_sgraph_a.c
- $(CC) $(CFLAGS) -DREAL_IS_DEFINED_DOUBLE=1 -c $*.c
-
-d_fft.o: scheme.tch prims.h zones.h array.h image.h d_fft.c
- $(CC) $(CFLAGS) -DREAL_IS_DEFINED_DOUBLE=1 -c $*.c
-
-d_array.o d_image.o: scheme.tch prims.h array.h d_array.c d_image.c
- $(CC) $(CFLAGS) -DREAL_IS_DEFINED_DOUBLE=1 -c $*.c
-
-
-d_sgraph_a.c: sgraph_a.c
- ln -f -s sgraph_a.c d_sgraph_a.c
-
-d_fft.c: fft.c
- ln -f -s fft.c d_fft.c
-
-d_array.c: array.c
- ln -f -s array.c d_array.c
-
-d_image.c: image.c
- ln -f -s image.c d_image.c
-
-clean.world:
- rm -f scmsig scm6003 kitscheme scmLYN
- rm -f usrSIG.o usr6003.o usrkit.o usrLYN.o
- rm -f usrSIG.c usr6003.c usrkit.c usrLYN.c
- rm -f d_sgraph_a.c d_fft.c d_array.c d_image.c
+++ /dev/null
-/* -*- C -*-
- Switzerland local additions to the makefile
- $Id: y800.lcl,v 1.2 1993/06/24 06:44:06 gjr Exp $
- */
-
-COMMON_OBJECTS = $(CORE_OBJECTS) $(STD_GC_OBJECTS) $(UNIX_OBJECTS) $(OS_PRIM_OBJECTS)
-
-world: all
-
-everything: world ppband
-
-install.world: install
-
+++ /dev/null
-s/[ ][ ]*@@/\
-/g
-s/[ ][ ]*$//
-s/^#.*//
-s/^[ \f ][ \f ]*$//
-s/^ / /
-/^..*$/p
+++ /dev/null
-/* -*-C-*-
-
-$Id: ymkfile,v 1.96 2000/01/18 05:14:06 cph Exp $
-
-Copyright (c) 1989-2000 Massachusetts Institute of Technology
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or (at
-your option) any later version.
-
-This program is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-#include "cf.h"
-
-#undef unix
-#undef vax
-
-#ifndef RUN
-#ifdef __STDC__
-#define RUN(program) ./##program
-#else
-#define RUN(program) ./program
-#endif
-#endif
-
-#ifndef SOURCES_SYSTEM
-#define SOURCES_SYSTEM
-#endif
-
-#ifndef SOURCES_MACHINE
-#define SOURCES_MACHINE
-#endif
-
-#ifndef OBJECTS_SYSTEM
-#define OBJECTS_SYSTEM
-#endif
-
-#ifndef OBJECTS_MACHINE
-#define OBJECTS_MACHINE
-#endif
-
-#ifndef LIBS_SYSTEM
-#define LIBS_SYSTEM
-#endif
-
-#ifndef LIBS_MACHINE
-#define LIBS_MACHINE
-#endif
-
-#ifndef C_SWITCH_SYSTEM
-#define C_SWITCH_SYSTEM
-#endif
-
-#ifndef C_SWITCH_MACHINE
-#define C_SWITCH_MACHINE
-#endif
-
-#ifndef C_SWITCH_FEATURES
-#define C_SWITCH_FEATURES
-#endif
-
-/* Unless inhibited or changed, use -g to compile for debugging. */
-#ifndef C_DEBUG_SWITCH
-#define C_DEBUG_SWITCH -g
-#endif
-
-/* If user wants to optimize, this is how. */
-#ifndef C_OPTIMIZE_SWITCH
-#define C_OPTIMIZE_SWITCH -O
-#endif
-
-#ifndef LD_SWITCH_CF
-#define LD_SWITCH_CF
-#endif
-
-#ifndef LD_SWITCH_SYSTEM
-#define LD_SWITCH_SYSTEM
-#endif
-
-#ifndef LD_SWITCH_MACHINE
-#define LD_SWITCH_MACHINE
-#endif
-
-#ifndef M4_SWITCH_SYSTEM
-#define M4_SWITCH_SYSTEM
-#endif
-
-#ifndef M4_SWITCH_MACHINE
-#define M4_SWITCH_MACHINE
-#endif
-
-#ifndef AS_SWITCH_SYSTEM
-#define AS_SWITCH_SYSTEM
-#endif
-
-#ifndef AS_SWITCH_MACHINE
-#define AS_SWITCH_MACHINE
-#endif
-
-/* Some machines don't find the standard C libraries in the usual place. */
-#ifndef LIB_STANDARD
-#define LIB_STANDARD
-#endif
-
-#ifndef LIB_MATH
-#define LIB_MATH -lm
-#endif
-
-#ifndef LIB_DEBUG
-#define LIB_DEBUG -lg
-#endif
-
-#ifndef LIBX11_MACHINE
-#define LIBX11_MACHINE
-#endif
-
-#ifndef LIBX11_SYSTEM
-#define LIBX11_SYSTEM
-#endif
-
-#ifdef HAVE_TERMINFO
-#ifndef LIBS_TERMCAP
-#define LIBS_TERMCAP -lcurses
-#endif
-#ifndef TERMCAP_FILES
-#define TERMCAP_FILES terminfo.o
-#endif
-#else /* not HAVE_TERMINFO */
-#ifndef LIBS_TERMCAP
-#define LIBS_TERMCAP
-#ifndef TERMCAP_FILES
-#define TERMCAP_FILES termcap.o tparam.o
-#endif
-#else /* LIBS_TERMCAP */
-#ifndef TERMCAP_FILES
-#define TERMCAP_FILES tparam.o
-#endif
-#endif /* LIBS_TERMCAP */
-#endif /* not HAVE_TERMINFO */
-TERMCAP_SOURCES = tterm.c
-TERMCAP_OBJECTS = TERMCAP_FILES tterm.o
-TERMCAP_LIBS = LIBS_TERMCAP
-
-#ifdef HAVE_X_WINDOWS
-X_SOURCES = x11base.c x11term.c x11graph.c x11color.c
-X_OBJECTS = x11base.o x11term.o x11graph.o x11color.o
-#ifndef X11_LIBRARY
-#define X11_LIBRARY -lX11
-#endif
-X_LIB = LIBX11_MACHINE LIBX11_SYSTEM X11_LIBRARY
-#endif /* HAVE_X_WINDOWS */
-
-#ifdef HAVE_STARBASE_GRAPHICS
-GRAPHICS_SOURCES = starbase.c
-GRAPHICS_OBJECTS = starbase.o
-GRAPHICS_LIBS = STARBASE_DEVICE_DRIVERS -lsb1 -lsb2
-#else /* not HAVE_STARBASE_GRAPHICS */
-GRAPHICS_SOURCES =
-GRAPHICS_OBJECTS =
-GRAPHICS_LIBS =
-#endif /* HAVE_STARBASE_GRAPHICS */
-
-#if (PROC_TYPE == PROC_TYPE_68020)
-#define PROC_TYPE_KNOWN
-MACHINE_SWITCHES =
-MACHINE_SOURCES = cmpint.c cmpauxmd.m4
-MACHINE_OBJECTS = cmpint.o cmpauxmd.o
-GC_HEAD_FILES = gccode.h cmpgc.h cmpintmd.h
-
-cmpauxmd.o : cmpauxmd.s
-#ifdef __hpux
-cmpauxmd.s : cmpauxmd.m4 xmkfile
-#endif
-
-#endif /* PROC_TYPE_68020 */
-
-#if (PROC_TYPE == PROC_TYPE_68000)
-#define PROC_TYPE_KNOWN
-MACHINE_SWITCHES = -DMC68010
-MACHINE_SOURCES = cmpint.c
-MACHINE_OBJECTS = cmpint.o
-GC_HEAD_FILES = gccode.h cmpgc.h
-#endif /* PROC_TYPE_68000 */
-
-#if (PROC_TYPE == PROC_TYPE_VAX)
-#define PROC_TYPE_KNOWN
-MACHINE_SWITCHES =
-MACHINE_SOURCES = cmpauxmd.m4 cmpint.c
-MACHINE_OBJECTS = cmpauxmd.o cmpint.o
-GC_HEAD_FILES = gccode.h cmpgc.h cmpintmd.h
-
-cmpauxmd.o : cmpauxmd.s
-cmpauxmd.s : cmpauxmd.m4 xmkfile
-
-#endif /* PROC_TYPE_VAX */
-
-#if (PROC_TYPE == PROC_TYPE_HPPA)
-#define PROC_TYPE_KNOWN
-#undef hppa
-MACHINE_SWITCHES =
-MACHINE_SOURCES = cmpauxmd.m4 cmpint.c
-MACHINE_OBJECTS = cmpauxmd.o cmpint.o
-GC_HEAD_FILES = gccode.h cmpgc.h cmpintmd.h hppacach.h
-XTRA_TARGETS = hppacach
-
-cmpauxmd.o : cmpauxmd.s
-cmpauxmd.s : cmpauxmd.m4 xmkfile
-
-#endif /* PROC_TYPE_HPPA */
-
-#if (PROC_TYPE == PROC_TYPE_MIPS)
-#define PROC_TYPE_KNOWN
-#undef mips
-MACHINE_SWITCHES =
-MACHINE_SOURCES = cmpauxmd.m4 cmpint.c
-MACHINE_OBJECTS = cmpauxmd.o cmpint.o
-GC_HEAD_FILES = gccode.h cmpgc.h cmpintmd.h
-
-cmpauxmd.o : cmpauxmd.s
-cmpauxmd.s : cmpauxmd.m4 xmkfile
-
-#endif /* PROC_TYPE_MIPS */
-
-#if (PROC_TYPE == PROC_TYPE_I386)
-#define PROC_TYPE_KNOWN
-#undef i386
-MACHINE_SWITCHES =
-MACHINE_SOURCES = cmpauxmd.m4 cmpint.c
-MACHINE_OBJECTS = cmpauxmd.o cmpint.o
-GC_HEAD_FILES = gccode.h cmpgc.h cmpintmd.h
-
-cmpauxmd.o : cmpauxmd.s
-cmpauxmd.s : cmpauxmd.m4 xmkfile
-
-#endif /* PROC_TYPE_I386 */
-
-#if (PROC_TYPE == PROC_TYPE_ALPHA)
-#define PROC_TYPE_KNOWN
-MACHINE_SWITCHES =
-MACHINE_SOURCES = cmpauxmd.m4 cmpint.c
-MACHINE_OBJECTS = cmpauxmd.o cmpint.o
-GC_HEAD_FILES = gccode.h cmpgc.h cmpintmd.h
-
-cmpauxmd.o : cmpauxmd.s
-cmpauxmd.s : cmpauxmd.m4 xmkfile
-
-#endif /* PROC_TYPE_ALPHA */
-
-#if (PROC_TYPE == PROC_TYPE_LIARC)
-#define PROC_TYPE_KNOWN
-
-#include "ymake.ccl"
-
-COMPILED_OBJECTS = $(COMPILED_SOURCES:.c=.o)
-
-MACHINE_SWITCHES = -DNATIVE_CODE_IS_C -DCOMPILE_FOR_STATIC_LINKING
-MACHINE_SOURCES = cmpauxmd.c cmpint.c compinit.c $(COMPILED_SOURCES)
-MACHINE_OBJECTS = cmpauxmd.o cmpint.o compinit.o $(COMPILED_OBJECTS)
-GC_HEAD_FILES = gccode.h cmpgc.h cmpintmd.h
-LIARC_HEAD_FILES = \
-ansidecl.h \
-config.h \
-default.h \
-object.h \
-sdata.h \
-types.h \
-errors.h \
-const.h \
-interp.h \
-prim.h \
-$(GC_HEAD_FILES)
-cmpauxmd.o : cmpauxmd.c liarc.tch prims.h bignum.h bitstr.h avltree.h
-compinit.o : compinit.c liarc.tch compinit.h
-/* The following includes liarc.tch in case COMPILED_SOURCES is empty,
- to prevent fgrep from reading stdin.
- */
-compinit.h : $(COMPILED_SOURCES) liarc.tch xmkfile
- /* @echo "#*** Generating" $@ "because of" $? */
- rm -f $@
- fgrep DECLARE_COMPILED_CODE liarc.tch $(COMPILED_SOURCES) | \
- sed -e 's/.*:/ /' -e 's/)/);/' > $@
- fgrep DECLARE_COMPILED_DATA liarc.tch $(COMPILED_SOURCES) | \
- sed -e 's/.*:/ /' -e 's/)/);/' >> $@
-
-foo $(COMPILED_OBJECTS) : liarc.tch
-liarc.tch: liarc.h $(LIARC_HEAD_FILES)
- /* @echo "#** Generating" $@ because of $? */
- rm -f $@
- echo "touch" > $@
-
-#endif /* PROC_TYPE_LIARC */
-
-#ifndef PROC_TYPE_KNOWN
-MACHINE_SWITCHES =
-MACHINE_SOURCES = cmpint.c
-MACHINE_OBJECTS = cmpint.o
-GC_HEAD_FILES = gccode.h cmpgc.h
-#endif /* PROC_TYPE_KNOWN */
-
-USER_PRIM_SOURCES = $(CF_USER_PRIM_SOURCES)
-USER_PRIM_OBJECTS = $(CF_USER_PRIM_OBJECTS)
-USER_LIBS = $(CF_USER_LIBS)
-
-SHELL = /bin/sh
-
-#ifdef INSTALL_PROGRAM
-INSTALL = INSTALL_PROGRAM
-#else
-INSTALL = install -c
-#endif
-#ifdef INSTALL_BINARY_DIRECTORY
-BINDIR = INSTALL_BINARY_DIRECTORY
-#else
-BINDIR = /usr/local/bin
-#endif
-#ifdef ALTERNATE_CC
-CC = ALTERNATE_CC
-#else
-CC = cc
-#endif
-#ifdef ALTERNATE_M4
-M4 = ALTERNATE_M4
-#else
-M4 = m4
-#endif
-#ifdef ALTERNATE_AS
-AS = ALTERNATE_AS
-#else
-AS = as
-#endif
-
-#ifdef SUPPRESS_C_OPTIMIZER
-#undef C_OPTIMIZE_SWITCH
-#define C_OPTIMIZE_SWITCH
-#endif
-
-#ifdef SUPPRESS_C_DEBUGGING
-#undef C_DEBUG_SWITCH
-#define C_DEBUG_SWITCH
-#undef LIB_DEBUG
-#define LIB_DEBUG
-#endif
-
-LDFLAGS = LD_SWITCH_CF LD_SWITCH_SYSTEM LD_SWITCH_MACHINE C_DEBUG_SWITCH
-
-CFLAGS = -DMIT_SCHEME C_OPTIMIZE_SWITCH C_DEBUG_SWITCH C_SWITCH_MACHINE C_SWITCH_SYSTEM C_SWITCH_FEATURES $(MACHINE_SWITCHES)
-
-#ifndef ECHO
-#define ECHO echo
-#endif
-
-.SUFFIXES: .o .cpp .s .m4
-
-.c.o:
- /* @ECHO "#** Generating" $@ because of $? */
- $(CC) $(CFLAGS) -c $*.c
-
-.c.cpp:
- /* @ECHO "#** Generating" $@ */
- make -f xmkfile breakup
- $(CC) $(CFLAGS) -E $*.c | \
- RUN(breakup) | \
- sed -e 's/^#.*//' -e 's/^[ ]*$$//' -e 's/^\f$$//' | \
- sed -n -e '/^..*/p' > $*.cpp
-
-.c.s:
- /* @ECHO "#** Generating" $@ */
- $(CC) $(CFLAGS) -S $*.c
-
-.m4.s:
- /* @ECHO "#** Generating" $@ because of $? */
- $(M4) M4_SWITCH_SYSTEM M4_SWITCH_MACHINE $*.m4 > $*.s
-
-.s.o:
- /* @ECHO "#** Generating" $@ because of $? */
- $(AS) AS_SWITCH_SYSTEM AS_SWITCH_MACHINE -o $*.o $*.s
-
-/* Source and object files */
-
-SCHEME_SOURCES = $(X_SOURCES) $(TERMCAP_SOURCES) $(GRAPHICS_SOURCES) SOURCES_SYSTEM SOURCES_MACHINE $(USER_PRIM_SOURCES) missing.c
-SCHEME_OBJECTS = $(X_OBJECTS) $(TERMCAP_OBJECTS) $(GRAPHICS_OBJECTS) OBJECTS_SYSTEM OBJECTS_MACHINE $(USER_PRIM_OBJECTS) missing.o
-SCHEME_LIB = $(USER_LIBS) $(GRAPHICS_LIBS) $(X_LIB) $(TERMCAP_LIBS) LIB_MATH LIBS_SYSTEM LIBS_MACHINE LIB_DEBUG LIB_STANDARD
-
-CORE_SOURCES = \
-$(MACHINE_SOURCES) \
-artutl.c \
-avltree.c \
-bignum.c \
-bigprm.c \
-bitstr.c \
-boot.c \
-char.c \
-comutl.c \
-daemon.c \
-debug.c \
-dfloat.c \
-error.c \
-extern.c \
-fasload.c \
-fixnum.c \
-flonum.c \
-generic.c \
-hooks.c \
-hunk.c \
-intern.c \
-interp.c \
-intprm.c \
-list.c \
-lookprm.c \
-lookup.c \
-obstack.c \
-option.c \
-osscheme.c \
-ostty.c \
-outf.c \
-prim.c \
-primutl.c \
-prmcon.c \
-ptrvec.c \
-purutl.c \
-regex.c \
-rgxprim.c \
-step.c \
-storage.c \
-string.c \
-syntax.c \
-sysprim.c \
-term.c \
-transact.c \
-utils.c \
-vector.c \
-wind.c
-
-STD_GC_SOURCES = \
-fasdump.c \
-gcloop.c \
-memmag.c \
-purify.c \
-wabbit.c
-
-BCH_GC_SOURCES = \
-bchdmp.c \
-bchgcl.c \
-bchmmg.c \
-bchpur.c \
-bchutl.c
-
-UNIX_SOURCES = \
-intext.c \
-ux.c \
-uxctty.c \
-uxenv.c \
-uxfile.c \
-uxfs.c \
-uxio.c \
-uxproc.c \
-uxsig.c \
-uxsock.c \
-uxterm.c \
-uxtop.c \
-uxtrap.c \
-uxtty.c \
-uxutil.c
-
-OS_PRIM_SOURCES = \
-prosenv.c \
-prosfile.c \
-prosfs.c \
-prosio.c \
-prosproc.c \
-prospty.c \
-prosterm.c \
-prostty.c \
-pruxenv.c \
-pruxfs.c \
-pruxio.c \
-pruxsock.c
-
-HEAD_FILES = scheme.tch prims.h zones.h locks.h bignum.h \
- $(GC_HEAD_FILES) trap.h lookup.h history.h cmpint.h
-
-CORE_OBJECTS = \
-$(MACHINE_OBJECTS) \
-artutl.o \
-avltree.o \
-bignum.o \
-bigprm.o \
-bitstr.o \
-boot.o \
-char.o \
-comutl.o \
-daemon.o \
-debug.o \
-dfloat.o \
-error.o \
-extern.o \
-fasload.o \
-fixnum.o \
-flonum.o \
-generic.o \
-hooks.o \
-hunk.o \
-intern.o \
-interp.o \
-intprm.o \
-list.o \
-lookprm.o \
-lookup.o \
-obstack.o \
-option.o \
-osscheme.o \
-ostty.o \
-outf.o \
-prim.o \
-primutl.o \
-prmcon.o \
-ptrvec.o \
-purutl.o \
-regex.o \
-rgxprim.o \
-step.o \
-storage.o \
-string.o \
-syntax.o \
-sysprim.o \
-term.o \
-transact.o \
-utils.o \
-vector.o \
-wind.o
-
-UNIX_OBJECTS = \
-intext.o \
-ux.o \
-uxctty.o \
-uxenv.o \
-uxfile.o \
-uxfs.o \
-uxio.o \
-uxproc.o \
-uxsig.o \
-uxsock.o \
-uxterm.o \
-uxtop.o \
-uxtrap.o \
-uxtty.o \
-uxutil.o
-
-OS_PRIM_OBJECTS = \
-prosenv.o \
-prosfile.o \
-prosfs.o \
-prosio.o \
-prosproc.o \
-prospty.o \
-prosterm.o \
-prostty.o \
-pruxenv.o \
-pruxfs.o \
-pruxio.o \
-pruxsock.o
-
-STD_GC_OBJECTS = \
-fasdump.o \
-gcloop.o \
-memmag.o \
-purify.o \
-wabbit.o
-
-BCH_GC_OBJECTS = \
-bchdmp.o \
-bchgcl.o \
-bchmmg.o \
-bchpur.o \
-bchutl.o
-
-SOURCES = $(CORE_SOURCES) $(STD_GC_SOURCES)
-OBJECTS = $(CORE_OBJECTS) $(STD_GC_OBJECTS) $(UNIX_OBJECTS) $(OS_PRIM_OBJECTS) usrdef.o
-BCHSOURCES = $(CORE_SOURCES) $(BCH_GC_SOURCES)
-BCHOBJECTS = $(CORE_OBJECTS) $(BCH_GC_OBJECTS) $(UNIX_OBJECTS) $(OS_PRIM_OBJECTS) bchdef.o
-
-/* Construction rules. */
-
-all: bintopsb psbtobin scheme bchscheme bchdrn $(XTRA_TARGETS)
-
-scheme xscheme : $(OBJECTS) $(SCHEME_OBJECTS)
- /* @ECHO "#** Re-linking" $@ because of $? */
- rm -f $@
- $(CC) $(LDFLAGS) -o $@ $(OBJECTS) $(SCHEME_OBJECTS) $(SCHEME_LIB)
-
-bchscheme : $(BCHOBJECTS) $(SCHEME_OBJECTS)
- /* @ECHO "#** Re-linking" $@ because of $? */
- rm -f $@
- $(CC) $(LDFLAGS) -o $@ $(BCHOBJECTS) $(SCHEME_OBJECTS) $(SCHEME_LIB)
-
-bchdrn : bchdrn.o bchutl.o
- /* @ECHO "#** Re-linking" $@ because of $? */
- rm -f $@
- $(CC) $(LDFLAGS) -o $@ bchdrn.o bchutl.o
-
-findprim : findprim.o
- /* @ECHO "#** Re-linking" $@ because of $? */
- $(CC) $(LDFLAGS) -o $@ findprim.o
-
-bintopsb : bintopsb.o missing.o
- /* @ECHO "#** Re-linking" $@ because of $? */
- $(CC) $(LDFLAGS) -o $@ bintopsb.o missing.o LIB_MATH
-
-psbtobin : psbtobin.o missing.o
- /* @ECHO "#** Re-linking" $@ because of $? */
- $(CC) $(LDFLAGS) -o $@ psbtobin.o missing.o LIB_MATH
-
-breakup : breakup.o
- /* @ECHO "#** Re-linking" $@ because of $? */
- $(CC) $(LDFLAGS) -o $@ breakup.o
-
-wsize : wsize.o
- /* @ECHO "#** Re-linking" $@ because of $? */
- $(CC) $(LDFLAGS) -o $@ wsize.o LIB_MATH LIBS_SYSTEM LIBS_MACHINE LIB_DEBUG LIB_STANDARD
-
-ppband : ppband.o
- /* @ECHO "#** Re-linking" $@ because of $? */
- $(CC) $(LDFLAGS) -o $@ ppband.o
-
-install: scheme bchscheme
- -mv -f $(BINDIR)/scheme $(BINDIR)/scheme.busy
- -rm -f $(BINDIR)/scheme.busy
- $(INSTALL) scheme $(BINDIR)/scheme
- -mv -f $(BINDIR)/bchscheme $(BINDIR)/bchscheme.busy
- -rm -f $(BINDIR)/bchscheme.busy
- $(INSTALL) bchscheme $(BINDIR)/bchscheme
-
-/* Primitive table files */
-
-/* The first two are for VMS. */
-
-usrdef.txt :
- RUN(make_vmslist) usrdef.txt $(SCHEME_SOURCES) $(SOURCES) $(OS_PRIM_SOURCES)
-
-vmsusrdef.c :
- echo "$$ findprim -o usrdef.c -l [-.vms]usrdef.txt"
- $(CC) $(CFLAGS) -c usrdef.c
-
-usrdef.c : $(SCHEME_SOURCES) $(SOURCES) $(OS_PRIM_SOURCES) usrdef.tch findprim xmkfile
- /* @ECHO "#** Re-making" $@ because of $? */
- rm -f usrdef.c
- RUN(findprim) $(SCHEME_SOURCES) $(SOURCES) $(OS_PRIM_SOURCES) > usrdef.c
-
-bchdef.c : $(SCHEME_SOURCES) $(BCHSOURCES) $(OS_PRIM_SOURCES) usrdef.tch findprim xmkfile
- /* @ECHO "#** Re-making" $@ because of $? */
- rm -f bchdef.c
- RUN(findprim) $(SCHEME_SOURCES) $(BCHSOURCES) $(OS_PRIM_SOURCES) > bchdef.c
-
-primitive_tables :
- rm -f usrdef.c usrdef.o bchdef.c bchdef.o
-
-scheme.tch psbmap.tch usrdef.tch :
- /* @ECHO "#** Resetting" $@ because of $? */
- rm -f $@
- /* Create the file by opening rather than using `touch' program.
- Some versions of the `touch' program don't work well when the
- file server's clock is not synchronized with the client's. */
- echo "touch" > $@
-
-#include "ymake.lcl"
-
-/* scheme.tch depends also on butterfly.h rename.c */
-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 float.h outf.h
-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
-usrdef.tch : usrdef.h config.h object.h prim.h
-
-#ifdef USE_BUILT_IN_LIMITS_FILES
-
-/* `hard-par' dies trying to generate float.h under linux (using GCC 2.6.3).
- However, the built-in limits file generates all the constants we need. */
-
-limits.h :
- rm -f limits.h
- echo "#include <limits.h>" > limits.h
-float.h :
- rm -f float.h
- echo "#include <float.h>" > float.h
-
-#else /* not USE_BUILT_IN_LIMITS_FILES */
-
-limits.h : hard-par
- rm -f limits.h
- RUN(hard-par) -l > limits.h
-float.h : hard-par
- rm -f float.h
- RUN(hard-par) -f > float.h
-hard-par : hard-par.c
- $(CC) -DNO_SC $(LDFLAGS) -o hard-par hard-par.c
-
-#endif /* not USE_BUILT_IN_LIMITS_FILES */
-
-hppacach.o : hppacach.h
-
-hppacach : hppacach.o
- $(CC) $(CFLAGS) -o hppacach hppacach.o
-
-lint.out : $(SOURCES) $(SCHEME_SOURCES) $(CSRC) usrdef.c $(HEAD_FILES)
- rm -f lint.out
- lint $(CFLAGS) $(SOURCES) $(SCHEME_SOURCES) $(CSRC) usrdef.c > lint.out
-
-/* Dependencies of the object files on the header files */
-
-/* "foo" prevents syntax error when USER_PRIM_OBJECTS is empty. */
-foo $(USER_PRIM_OBJECTS) : $(HEAD_FILES)
-
-interp.o : scheme.tch locks.h trap.h lookup.h history.h cmpint.h zones.h prmcon.h
-hooks.o : scheme.tch prims.h winder.h history.h
-utils.o : scheme.tch prims.h winder.h history.h cmpint.h syscall.h
-primutl.o : scheme.tch os.h prims.h usrdef.h prename.h syscall.h \
- avltree.h $(GC_HEAD_FILES)
-
-hunk.o list.o step.o vector.o sysprim.o daemon.o prim.o extern.o : \
- scheme.tch prims.h
-
-lookup.o lookprm.o debug.o intern.o : scheme.tch prims.h lookup.h trap.h locks.h
-
-fasload.o : scheme.tch prims.h osscheme.h osfile.h osio.h $(GC_HEAD_FILES) \
- trap.h option.h prmcon.h load.c fasl.h
-fasdump.o : scheme.tch prims.h osio.h osfile.h osfs.h $(GC_HEAD_FILES) \
- trap.h lookup.h fasl.h dump.c
-
-memmag.o : scheme.tch prims.h memmag.h $(GC_HEAD_FILES) memmag.h
-gcloop.o : scheme.tch $(GC_HEAD_FILES)
-purify.o : scheme.tch prims.h $(GC_HEAD_FILES) zones.h
-wabbit.o : scheme.tch $(GC_HEAD_FILES)
-purutl.o : scheme.tch prims.h $(GC_HEAD_FILES) zones.h
-comutl.o : scheme.tch prims.h
-gctype.o : config.h
-
-artutl.o : scheme.tch
-avltree.o : ansidecl.h avltree.h
-bignum.o : scheme.tch bignmint.h limits.h
-bigprm.o flonum.o intprm.o : scheme.tch prims.h zones.h
-generic.o : scheme.tch prims.h
-fixnum.o : scheme.tch prims.h mul.c
-
-storage.o : scheme.tch gctype.c
-
-char.o string.o dfloat.o : scheme.tch prims.h
-tterm.o : scheme.tch prims.h osterm.h
-
-boot.o : scheme.tch prims.h version.h option.h ostop.h os.h
-option.o : scheme.tch fasl.h osenv.h osfs.h
-term.o : scheme.tch
-missing.o : config.h
-
-BCHGCC_H = bchgcc.h oscond.h $(GC_HEAD_FILES)
-bchdmp.o : scheme.tch prims.h uxio.h osio.h osfile.h osfs.h trap.h lookup.h \
- $(BCHGCC_H) fasl.h dump.c
-bchdrn.o : ansidecl.h bchdrn.h
-bchmmg.o : scheme.tch prims.h memmag.h ux.h $(BCHGCC_H) option.h bchdrn.h memmag.h
-bchgcl.o : scheme.tch $(BCHGCC_H)
-bchpur.o : scheme.tch prims.h $(BCHGCC_H) zones.h
-bchutl.o : ansidecl.h
-
-syntax.o : scheme.tch prims.h edwin.h syntax.h
-bitstr.o : scheme.tch prims.h bitstr.h
-regex.o : scheme.tch syntax.h regex.h
-rgxprim.o : scheme.tch prims.h edwin.h syntax.h regex.h
-
-bintopsb.o : psbmap.tch trap.h limits.h fasl.h load.c bltdef.h
-psbtobin.o : psbmap.tch float.h fasl.h dump.c
-ppband.o : ansidecl.h config.h errors.h types.h const.h object.h \
- $(GC_HEAD_FILES) sdata.h load.c fasl.h
-wsize.o : config.h
-
-dmpwrld.o : scheme.tch prims.h ux.h osfs.h \
- unexec.c unexhppa.c getpgsz.h
-
-x11base.o x11color.o x11graph.o x11term.o starbasx.o : scheme.tch prims.h \
- x11.h
-x11base.o : ux.h uxselect.h
-starbase.o : scheme.tch prims.h
-
-cmpint.o : scheme.tch prim.h $(GC_HEAD_FILES)
-
-osscheme.o : scheme.tch posixtyp.h os.h osscheme.h
-ostty.o : ansidecl.h oscond.h posixtyp.h os.h ostty.h osscheme.h
-
-error.o ptrvec.o transact.o : ansidecl.h dstack.h outf.h
-wind.o : ansidecl.h dstack.h obstack.h
-obstack.o : obstack.h
-
-$(UNIX_OBJECTS) pruxenv.o pruxfs.o pruxio.o pruxsock.o : oscond.h ansidecl.h \
- posixtyp.h intext.h dstack.h os.h osscheme.h ux.h syscall.h
-uxctty.o : osctty.h ossig.h
-uxenv.o : ux.h osenv.h config.h
-uxfile.o : osfile.h osio.h uxio.h
-uxfs.o : osfs.h osfile.h osio.h
-uxio.o : osio.h uxio.h uxselect.h
-uxproc.o : osproc.h uxproc.h osio.h uxio.h osterm.h ostop.h
-uxsig.o : config.h ux.h ossig.h osctty.h ostty.h ostop.h uxtrap.h uxsig.h \
- uxutil.h critsec.h
-uxsock.o : uxsock.h osio.h uxio.h prims.h
-uxterm.o : osterm.h uxterm.h osio.h uxio.h ospty.h
-uxtop.o : ostop.h uxtop.h osctty.h uxutil.h errors.h option.h
-uxtrap.o : scheme.tch uxtrap.h uxutil.h option.h ostop.h $(GC_HEAD_FILES)
-uxtty.o : ostty.h osenv.h osio.h uxio.h osterm.h uxterm.h
-uxutil.o : uxutil.h
-pruxfs.o : osfs.h
-pruxio.o : osio.h uxselect.h uxproc.h
-pruxsock.o : osio.h uxsock.h
-
-$(OS_PRIM_OBJECTS) : scheme.tch prims.h posixtyp.h os.h
-prosenv.o : osenv.h ostop.h
-prosfile.o : osfile.h
-prosfs.o : osfs.h
-prosio.o : osio.h
-prosproc.o : osproc.h
-prospty.o : osterm.h osio.h ospty.h
-prosterm.o : osterm.h osio.h
-prostty.o : ostty.h osctty.h osfile.h osio.h
-
-prmcon.o : scheme.tch prims.h prmcon.h
-
+++ /dev/null
-/* -*- C -*-
- Switzerland local additions to the makefile
- $Id: ynws3250.lcl,v 1.3 1993/06/28 02:29:58 cph Exp $
- */
-
-COMMON_OBJECTS = $(CORE_OBJECTS) $(STD_GC_OBJECTS) $(UNIX_OBJECTS) $(OS_PRIM_OBJECTS)
-
-/* For GJS's signal processing stuff */
-
-SIG_SOURCES = $(X_SOURCES) $(TERMCAP_OBJECTS)\
- SOURCES_SYSTEM SOURCES_MACHINE fft.c array.c image.c
-SIG_OBJECTS = $(X_OBJECTS) $(TERMCAP_OBJECTS)\
- OBJECTS_SYSTEM OBJECTS_MACHINE fft.o array.o image.o usrSIG.o
-SIG_LIB = $(USER_LIBS) $(X_LIB) $(TERMCAP_LIBS)\
- LIB_MATH LIBS_SYSTEM LIBS_MACHINE LIB_DEBUG LIB_STANDARD
-
-world: all scmsig
-
-everything: world ppband
-
-install.world: install scmsig
- -mv -f $(BINDIR)/scmsig $(BINDIR)/scmsig.busy
- rm -f $(BINDIR)/scmsig.busy
- $(INSTALL) scmsig $(BINDIR)/scmsig
-
-scmsig : $(COMMON_OBJECTS) $(SIG_OBJECTS)
- @ECHO "#** Re-linking" $@ because of $?
- rm -f $@
- $(CC) $(LDFLAGS) -o $@ $(COMMON_OBJECTS) $(SIG_OBJECTS) $(SIG_LIB)
-
-usrSIG.c : $(SIG_SOURCES) $(SOURCES) $(OS_PRIM_SOURCES) usrdef.tch findprim xmkfile
- @ECHO "#** Re-making" $@ because of $?
- rm -f usrSIG.c
- ./findprim $(SIG_SOURCES) $(SOURCES) $(OS_PRIM_SOURCES) > usrSIG.c
-
-clean.world:
- rm -f scmsig usrSIG.o usrSIG.c