From: Chris Hanson <org/chris-hanson/cph>
Date: Wed, 22 Oct 1997 05:31:29 +0000 (+0000)
Subject: Implement subprocess support under NT.  Requires runtime 14.174 or
X-Git-Tag: 20090517-FFI~4977
X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=4207e610196b330c2154eb90fdf64777dc620ba6;p=mit-scheme.git

Implement subprocess support under NT.  Requires runtime 14.174 or
later.
---

diff --git a/v7/src/microcode/nt.h b/v7/src/microcode/nt.h
index f3e3ed8f7..7a37fa2ae 100644
--- a/v7/src/microcode/nt.h
+++ b/v7/src/microcode/nt.h
@@ -1,6 +1,6 @@
 /* -*-C-*-
 
-$Id: nt.h,v 1.6 1997/01/01 22:57:19 cph Exp $
+$Id: nt.h,v 1.7 1997/10/22 05:28:19 cph Exp $
 
 Copyright (c) 1993-97 Massachusetts Institute of Technology
 
@@ -54,6 +54,9 @@ MIT in each case. */
 
 #include <fcntl.h>
 
+enum windows_type { wintype_unknown, wintype_31, wintype_95, wintype_nt };
+extern enum windows_type NT_windows_type;
+
 #ifndef ERRNO_NONBLOCK
 #define ERRNO_NONBLOCK	1998
 #endif
diff --git a/v7/src/microcode/ntapi.h b/v7/src/microcode/ntapi.h
index 27d919e72..f7f9279bb 100644
--- a/v7/src/microcode/ntapi.h
+++ b/v7/src/microcode/ntapi.h
@@ -1,6 +1,6 @@
 /* -*-C-*-
 
-$Id: ntapi.h,v 1.4 1997/08/24 04:05:55 cph Exp $
+$Id: ntapi.h,v 1.5 1997/10/22 05:28:29 cph Exp $
 
 Copyright (c) 1997 Massachusetts Institute of Technology
 
@@ -41,24 +41,37 @@ enum syscall_names
   /* Native Win32 API procedures: */
   apicall_CloseHandle,
   apicall_CopyFile,
-  apicall_CreateFile,
   apicall_CreateDirectory,
+  apicall_CreateFile,
+  apicall_CreatePipe,
+  apicall_CreateProcess,
   apicall_DeleteFile,
+  apicall_DuplicateHandle,
+  apicall_EnumWindows,
   apicall_FindFirstFile,
+  apicall_GetExitCodeProcess,
   apicall_GetFileAttributes,
   apicall_GetFileInformationByHandle,
   apicall_GetFileSize,
   apicall_GetFileTime,
+  apicall_GetStdHandle,
+  apicall_InitializeSecurityDescriptor,
   apicall_MoveFile,
   apicall_MsgWaitForMultipleObjects,
+  apicall_PeekNamedPipe,
   apicall_ReadFile,
   apicall_RemoveDirectory,
   apicall_SetCurrentDirectory,
   apicall_SetFileAttributes,
   apicall_SetFilePointer,
   apicall_SetFileTime,
+  apicall_SetSecurityDescriptorDacl,
+  apicall_SetStdHandle,
   apicall_SetTimer,
+  apicall_TerminateProcess,
   apicall_WaitForMultipleObjects,
+  apicall_WaitForSingleObject,
+  apicall_WriteFile,
 
   /* C Library's unix-style procedures: */
   syscall_close,
@@ -805,24 +818,37 @@ static char * syscall_names_table [] =
   /* Native Win32 API procedures: */
   "CLOSE-HANDLE",
   "COPY-FILE",
-  "CREATE-FILE",
   "CREATE-DIRECTORY",
+  "CREATE-FILE",
+  "CREATE-PIPE",
+  "CREATE-PROCESS",
   "DELETE-FILE",
+  "DUPLICATE-HANDLE",
+  "ENUM-WINDOWS",
   "FIND-FIRST-FILE",
+  "GET-EXIT-CODE-PROCESS",
   "GET-FILE-ATTRIBUTES",
   "GET-FILE-INFORMATION-BY-HANDLE",
   "GET-FILE-SIZE",
   "GET-FILE-TIME",
+  "GET-STD-HANDLE",
+  "INITIALIZE-SECURITY-DESCRIPTOR",
   "MOVE-FILE",
   "MSG-WAIT-FOR-MULTIPLE-OBJECTS",
+  "PEEK-NAMED-PIPE",
   "READ-FILE",
   "REMOVE-DIRECTORY",
   "SET-CURRENT-DIRECTORY",
   "SET-FILE-ATTRIBUTES",
   "SET-FILE-POINTER",
   "SET-FILE-TIME",
+  "SET-SECURITY-DESCRIPTOR-DACL",
+  "SET-STD-HANDLE",
   "SET-TIMER",
+  "TERMINATE-PROCESS",
   "WAIT-FOR-MULTIPLE-OBJECTS",
+  "WAIT-FOR-SINGLE-OBJECT",
+  "WRITE-FILE",
 
   /* C Library's unix-style procedures: */
   "CLOSE",
diff --git a/v7/src/microcode/nttop.c b/v7/src/microcode/nttop.c
index 81004c9b0..71725ecde 100644
--- a/v7/src/microcode/nttop.c
+++ b/v7/src/microcode/nttop.c
@@ -1,6 +1,6 @@
 /* -*-C-*-
 
-$Id: nttop.c,v 1.22 1997/08/24 04:03:53 cph Exp $
+$Id: nttop.c,v 1.23 1997/10/22 05:28:45 cph Exp $
 
 Copyright (c) 1993-97 Massachusetts Institute of Technology
 
@@ -47,6 +47,7 @@ extern void EXFUN (execute_reload_cleanups, (void));
 extern void EXFUN (NT_gui_init, (void));
 extern void EXFUN (NT_initialize_channels, (void));
 extern void EXFUN (NT_initialize_directory_reader, (void));
+extern void EXFUN (NT_initialize_processes, (void));
 extern void EXFUN (NT_initialize_signals, (void));
 extern void EXFUN (NT_initialize_traps, (void));
 extern void EXFUN (NT_initialize_tty, (void));
@@ -122,6 +123,8 @@ DEFUN_VOID (OS_under_emacs_p)
   return (option_emacs_subprocess);
 }
 
+enum windows_type NT_windows_type;
+
 void
 DEFUN_VOID (OS_initialize)
 {
@@ -134,6 +137,7 @@ DEFUN_VOID (OS_initialize)
   NT_initialize_signals ();
   NT_initialize_traps ();
   NT_initialize_directory_reader ();
+  NT_initialize_processes ();
 
   OS_Name = SYSTEM_NAME;
   {
@@ -146,6 +150,7 @@ DEFUN_VOID (OS_initialize)
 		 (DWORD)(LOBYTE(LOWORD(dwVersion))),
 		 (DWORD)(HIBYTE(LOWORD(dwVersion))),
 		 (DWORD)(HIWORD(dwVersion)));
+      NT_windows_type = wintype_nt;
     }
     else if (LOBYTE(LOWORD(dwVersion))<4) {
       // Win32s
@@ -153,12 +158,14 @@ DEFUN_VOID (OS_initialize)
 		 (DWORD)(LOBYTE(LOWORD(dwVersion))),
 		 (DWORD)(HIBYTE(LOWORD(dwVersion))),
 		 (DWORD)(HIWORD(dwVersion) & ~0x8000));
+      NT_windows_type = wintype_31;
     } else {
       // Windows 95
 	sprintf (variant, "Microsoft Windows 95 %u.%u (Build: %u)",
 		 (DWORD)(LOBYTE(LOWORD(dwVersion))),
 		 (DWORD)(HIBYTE(LOWORD(dwVersion))),
 		 (DWORD)(HIWORD(dwVersion) & ~0x8000));
+      NT_windows_type = wintype_95;
     }
 
     OS_Variant = malloc (128);
diff --git a/v7/src/microcode/ntutl/makefile.wcc b/v7/src/microcode/ntutl/makefile.wcc
index 04fb1c2b3..afdbab088 100644
--- a/v7/src/microcode/ntutl/makefile.wcc
+++ b/v7/src/microcode/ntutl/makefile.wcc
@@ -1,6 +1,6 @@
 ### -*- Fundamental -*-
 ###
-###     $Id: makefile.wcc,v 1.8 1997/08/23 02:48:18 cph Exp $
+###     $Id: makefile.wcc,v 1.9 1997/10/22 05:28:08 cph Exp $
 ###
 ###     Copyright (c) 1992-97 Massachusetts Institute of Technology
 ###
@@ -185,6 +185,7 @@ OS_PRIM_SOURCES = &
 prosfile.c &
 prosfs.c &
 prosio.c &
+prosproc.c &
 prosterm.c &
 prostty.c &
 prosenv.c &
@@ -213,6 +214,7 @@ ntfile.c &
 ntfs.c &
 ntgui.c &
 ntio.c &
+ntproc.c &
 ntscreen.c &
 ntsig.c &
 ntsys.c &
@@ -283,6 +285,7 @@ OS_PRIM_OBJECTS = &
 prosfile.obj &
 prosfs.obj &
 prosio.obj &
+prosproc.obj &
 prosterm.obj &
 prosenv.obj &
 prostty.obj &
@@ -311,6 +314,7 @@ ntfile.obj &
 ntfs.obj &
 ntgui.obj &
 ntio.obj &
+ntproc.obj &
 ntscreen.obj &
 ntsig.obj &
 ntsys.obj  &
@@ -507,6 +511,8 @@ ntenv.obj : ntenv.c scheme.tch osenv.h ntscreen.h $(NT_DEPENDENCIES)
 ntfile.obj : ntfile.c osfile.h osio.h ntio.h $(NT_DEPENDENCIES)
 ntfs.obj : ntfs.c ntfs.h osfs.h $(NT_DEPENDENCIES)
 ntio.obj : ntio.c osio.h ntio.h ntscreen.h $(NT_DEPENDENCIES)
+ntproc.obj : ntproc.c $(NT_DEPENDENCIES) osproc.h ntproc.h osio.h ntio.h &
+	ntscreen.h ntgui.h
 nttop.obj : nttop.c ostop.h nttop.h osctty.h errors.h option.h &
 	$(NT_DEPENDENCIES)
 nttty.obj : nttty.c ostty.h osenv.h osio.h ntio.h osterm.h ntterm.h &
@@ -521,7 +527,7 @@ ntkbutl.obj : ntkbutl.asm
 prntenv.obj : prntenv.c $(NT_DEPENDENCIES)
 prntfs.obj : prntfs.c ntfs.h $(NT_DEPENDENCIES) scheme.tch prims.h osfs.h
 prntio.obj : prntio.c $(NT_DEPENDENCIES) scheme.tch prims.h ntio.h osio.h &
-	syscall.h ntapi.h ntscreen.h
+	syscall.h ntscreen.h ntgui.h
 
 cmpauxmd.obj : cmpauxmd.asm
 
diff --git a/v7/src/microcode/prosio.c b/v7/src/microcode/prosio.c
index af3b0fa29..c0f42abb9 100644
--- a/v7/src/microcode/prosio.c
+++ b/v7/src/microcode/prosio.c
@@ -1,6 +1,6 @@
 /* -*-C-*-
 
-$Id: prosio.c,v 1.14 1997/01/01 22:57:40 cph Exp $
+$Id: prosio.c,v 1.15 1997/10/22 05:30:41 cph Exp $
 
 Copyright (c) 1987-97 Massachusetts Institute of Technology
 
@@ -42,7 +42,7 @@ MIT in each case. */
 #define CLOSE_CHANNEL_HOOK(channel)
 #endif
 
-static Tchannel
+Tchannel
 DEFUN (arg_to_channel, (argument, arg_number),
        SCHEME_OBJECT argument AND
        int arg_number)
diff --git a/v7/src/microcode/uxproc.h b/v7/src/microcode/uxproc.h
index 58de1921d..213ea0287 100644
--- a/v7/src/microcode/uxproc.h
+++ b/v7/src/microcode/uxproc.h
@@ -1,8 +1,8 @@
 /* -*-C-*-
 
-$Id: uxproc.h,v 1.4 1993/06/24 07:10:13 gjr Exp $
+$Id: uxproc.h,v 1.5 1997/10/22 05:30:57 cph Exp $
 
-Copyright (c) 1990-91 Massachusetts Institute of Technology
+Copyright (c) 1990-97 Massachusetts Institute of Technology
 
 This material was developed by the Scheme project at the Massachusetts
 Institute of Technology, Department of Electrical Engineering and
@@ -60,4 +60,8 @@ struct process
 
 extern struct process * process_table;
 
+/* OS_make_subprocess is obsolete, but it uses the same interface as
+   UX_make_subprocess.  */
+#define UX_make_subprocess OS_make_subprocess
+
 #endif /* SCM_UXPROC_H */
diff --git a/v7/src/microcode/version.h b/v7/src/microcode/version.h
index 86a4ccac1..04ddd841f 100644
--- a/v7/src/microcode/version.h
+++ b/v7/src/microcode/version.h
@@ -1,6 +1,6 @@
 /* -*-C-*-
 
-$Id: version.h,v 11.158 1997/04/23 07:01:36 cph Exp $
+$Id: version.h,v 11.159 1997/10/22 05:31:29 cph Exp $
 
 Copyright (c) 1988-97 Massachusetts Institute of Technology
 
@@ -46,5 +46,5 @@ MIT in each case. */
 #define VERSION		11
 #endif
 #ifndef SUBVERSION
-#define SUBVERSION	158
+#define SUBVERSION	159
 #endif