From b333ff7451921a87b125d03fa30953d96824ef69 Mon Sep 17 00:00:00 2001 From: "Guillermo J. Rozas" Date: Sat, 21 Aug 1993 02:35:30 +0000 Subject: [PATCH] Allow for address relocation to make Scheme run under Windows 3.1. Plus general cleanup of NT code. --- v7/src/microcode/nt.h | 336 +++++++----------------------------------- 1 file changed, 54 insertions(+), 282 deletions(-) diff --git a/v7/src/microcode/nt.h b/v7/src/microcode/nt.h index 0516c5fb5..df9da65b2 100644 --- a/v7/src/microcode/nt.h +++ b/v7/src/microcode/nt.h @@ -1,6 +1,6 @@ /* -*-C-*- -$Id: nt.h,v 1.4 1993/08/03 08:29:54 gjr Exp $ +$Id: nt.h,v 1.5 1993/08/21 02:35:30 gjr Exp $ Copyright (c) 1993 Massachusetts Institute of Technology @@ -43,12 +43,6 @@ MIT in each case. */ #include #include -#ifdef WINNT -#else -#include -#endif - -#include #include #include #include @@ -58,12 +52,8 @@ MIT in each case. */ #include #include -#include /*SRA*/ +#include -/* We fake these for console I/O in DOS */ -#ifndef ESTALE -#define ESTALE 1997 -#endif #ifndef ERRNO_NONBLOCK #define ERRNO_NONBLOCK 1998 #endif @@ -82,136 +72,11 @@ MIT in each case. */ #include "syscall.h" #include #include -/*#include */ - -#define HAVE_MKDIR -#define HAVE_RMDIR -#define HAVE_GETCWD - -/* #define HAVE_DUP2 */ -/* #define HAVE_FCNTL */ -#define VOID_SIGNAL_HANDLERS - -/*#include */ - -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 */ - -/* 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 /* constants for access() */ #ifndef R_OK @@ -233,13 +98,9 @@ typedef int wait_status_t; #define ALERT_STRING "\007" #endif -//#ifndef STDIN_FILENO -//#define STDIN_FILENO 0 -//#define STDOUT_FILENO 1 -//#define STDERR_FILENO 2 -//#endif - -extern HANDLE STDIN_HANDLE, STDOUT_HANDLE, STDERR_HANDLE; +#ifndef GUI + extern HANDLE STDIN_HANDLE, STDOUT_HANDLE, STDERR_HANDLE; +#endif /* constants for open() and fcntl() */ #ifndef O_RDONLY @@ -281,94 +142,75 @@ extern HANDLE STDIN_HANDLE, STDOUT_HANDLE, STDERR_HANDLE; 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 +#define NT_abort abort +#define NT_access access +#define NT_alarm alarm +#define NT_chdir chdir +#define NT_chmod chmod +#define NT_close close +#define NT_ctime ctime +#define NT_dup dup +#define NT_free free +#define NT_fstat fstat +#define NT_getcwd getcwd +#define NT_getenv getenv +#define NT_getegid getegid +#define NT_geteuid geteuid +#define NT_getgrgid getgrgid +#define NT_gethostname gethostname +#define NT_getlogin getlogin +#define NT_getpid getpid +#define NT_getpwnam getpwnam +#define NT_getpwuid getpwuid +#define NT_ioctl ioctl +#define NT_link link +#define NT_localtime localtime +#define NT_lseek lseek +#define NT_malloc malloc +#define NT_mkdir mkdir +#define NT_mknod mknod +#define NT_mktime mktime +#define NT_open open +#define NT_pause pause +#define NT_pipe pipe +#define NT_read read +#define NT_realloc realloc +#define NT_rename rename +#define NT_rmdir RemoveDirectory +#define NT_signal signal +#define NT_sleep sleep +#define NT_stat stat +#define NT_system system +#define NT_time time +#define NT_unlink unlink +#define NT_write write +#define NT_wait wait #ifndef WINNT 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)); #endif - -#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 -extern void EXFUN (DOS_prim_check_errno, (enum syscall_names name)); +extern void EXFUN (NT_prim_check_errno, (enum syscall_names name)); #define STD_VOID_SYSTEM_CALL(name, expression) \ { \ while ((expression) < 0) \ if (errno != EINTR) \ - error_system_call (errno, (name)); \ + error_system_call (errno, (name)); \ } #define STD_BOOL_SYSTEM_CALL(name, expression) \ { \ while (! (expression)) \ - error_system_call (GetLastError(), (name)); \ + error_system_call ((GetLastError ()), (name)); \ } #define STD_HANDLE_SYSTEM_CALL(name, result, expression) \ { \ while (((result) = (expression)) == INVALID_HANDLE_VALUE) \ - error_system_call (GetLastError(), (name)); \ + error_system_call ((GetLastError ()), (name)); \ } #define STD_UINT_SYSTEM_CALL(name, result, expression) \ @@ -382,82 +224,12 @@ extern void EXFUN (DOS_prim_check_errno, (enum syscall_names name)); while (((result) = (expression)) == 0) \ error_system_call (errno, (name)); \ } - -#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 -#endif - -#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 +#define NT_SC_OPEN_MAX() _NFILE #else -#define DOS_SC_OPEN_MAX() 16 +#define NT_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_NT_H */ -- 2.25.1