/* -*-C-*-
-$Id: bchdmp.c,v 9.78 1994/01/30 03:32:11 gjr Exp $
+$Id: bchdmp.c,v 9.79 1995/03/21 22:12:50 cph Exp $
-Copyright (c) 1987-1994 Massachusetts Institute of Technology
+Copyright (c) 1987-95 Massachusetts Institute of Technology
This material was developed by the Scheme project at the Massachusetts
Institute of Technology, Department of Electrical Engineering and
#endif /* WINNT */
+#ifdef _OS2
+#include "os2.h"
+
+#ifdef __IBMC__
+#include <io.h>
+#include <sys\stat.h>
+#include <fcntl.h>
+#endif
+
+#ifndef F_OK
+#define F_OK 0
+#define X_OK 1
+#define W_OK 2
+#define R_OK 4
+#endif
+
+char *
+DEFUN (mktemp, (fname), unsigned char * fname)
+{
+ /* This assumes that fname ends in at least 3 Xs.
+ tmpname seems too random to use.
+ This, of course, has a window in which another program can
+ create the file.
+ */
+
+ int posn = ((strlen (fname)) - 3);
+ int counter;
+
+ for (counter = 0; counter < 1000; counter++)
+ {
+ sprintf (&fname[posn], "%03d", counter);
+ if ((access (fname, F_OK)) != 0)
+ {
+ int fid = (open (fname,
+ (O_CREAT | O_EXCL | O_RDWR),
+ (S_IREAD | S_IWRITE)));
+ if (fid < 0)
+ continue;
+ close (fid);
+ break;
+ }
+ }
+ if (counter >= 1000)
+ return ((char *) NULL);
+
+ return ((char *) fname);
+}
+
+#define FASDUMP_FILENAME_DEFINED
+static char FASDUMP_FILENAME[] = "\\tmp\\faXXXXXX";
+#endif /* _OS2 */
+
#ifndef FASDUMP_FILENAME_DEFINED
/* Assume Unix */
/* -*-C-*-
-$Id: bchdrn.h,v 1.6 1993/11/22 00:32:47 gjr Exp $
+$Id: bchdrn.h,v 1.7 1995/03/21 22:12:41 cph Exp $
-Copyright (c) 1991-1993 Massachusetts Institute of Technology
+Copyright (c) 1991-95 Massachusetts Institute of Technology
This material was developed by the Scheme project at the Massachusetts
Institute of Technology, Department of Electrical Engineering and
/* Header file for overlapped I/O in bchscheme. */
#ifndef _BCHDRN_H_INCLUDED
-
#define _BCHDRN_H_INCLUDED
#include "ansidecl.h"
# include <unistd.h>
#else
#ifndef DOS386
+#ifndef _OS2
extern int EXFUN (read, (int, PTR, unsigned int));
extern int EXFUN (write, (int, PTR, unsigned int));
#endif
#endif
+#endif
#if defined(HAVE_POSIX_SIGNALS) && defined(HAVE_BSD_SIGNALS)
# define RE_INSTALL_HANDLER(signum,handler) do { } while (0)
/* -*-C-*-
-$Id: bchmmg.c,v 9.86 1994/01/30 03:31:48 gjr Exp $
+$Id: bchmmg.c,v 9.87 1995/03/21 22:12:32 cph Exp $
-Copyright (c) 1987-1994 Massachusetts Institute of Technology
+Copyright (c) 1987-95 Massachusetts Institute of Technology
This material was developed by the Scheme project at the Massachusetts
Institute of Technology, Department of Electrical Engineering and
#ifdef WINNT
# include "nt.h"
# define SUB_DIRECTORY_DELIMITER '\\'
+# define ASSUME_NORMAL_GC_FILE
+#endif
+
+#ifdef _OS2
+#include "os2.h"
+#define SUB_DIRECTORY_DELIMITER '\\'
+#define ASSUME_NORMAL_GC_FILE
+#ifdef __IBMC__
+#include <io.h>
+#include <sys\stat.h>
+#endif
+#ifndef F_OK
+#define F_OK 0
+#define X_OK 1
+#define W_OK 2
+#define R_OK 4
+#endif
#endif
#ifndef SUB_DIRECTORY_DELIMITER
return (1);
}
-#ifndef WINNT
+#ifdef WINNT
+#include <windows.h>
+
+int
+DEFUN (io_error_retry_p, (operation_name, noise),
+ char * operation_name AND char * noise)
+{
+ char buf[512];
+ extern HANDLE master_tty_window;
+
+ sprintf (&buf[0],
+ "%s: GC file error (code = %d) when manipulating %s.\n"
+ "Choose an option (Cancel = Exit Scheme)",
+ operation_name, (GetLastError ()), noise);
+ switch (MessageBox (master_tty_window,
+ &buf[0],
+ "MIT Scheme garbage-collection problem description",
+ (MB_ICONSTOP | MB_ABORTRETRYIGNORE | MB_APPLMODAL)))
+ {
+ case IDABORT:
+ return (1);
+
+ case IDRETRY:
+ return (0);
+
+ case IDIGNORE:
+ Microcode_Termination (TERM_EXIT);
+ }
+}
+
+#else /* not WINNT */
+#ifdef _OS2
+
+#define INCL_WIN
+#include <os2.h>
+
+int
+io_error_retry_p (char * operation_name, char * noise)
+{
+ char buf [512];
+ sprintf ((&buf[0]),
+ "%s: GC file error (code = %d) when manipulating %s.\n"
+ "Choose an option (Cancel = Exit Scheme)",
+ operation_name, errno, noise);
+ switch (WinMessageBox (HWND_DESKTOP,
+ NULLHANDLE,
+ (&buf[0]),
+ "MIT Scheme garbage-collection problem description",
+ 0,
+ (MB_ICONHAND | MB_ABORTRETRYIGNORE | MB_APPLMODAL)))
+ {
+ case MBID_ABORT: return (1);
+ case MBID_RETRY: return (0);
+ case MBID_IGNORE: Microcode_Termination (TERM_EXIT);
+ }
+}
+
+#else /* not _OS2 */
extern char EXFUN (userio_choose_option,
(CONST char *, CONST char *, CONST char **));
}
}
}
-\f
-#else /* WINNT */
-#include <windows.h>
-int
-DEFUN (io_error_retry_p, (operation_name, noise),
- char * operation_name AND char * noise)
-{
- char buf[512];
- extern HANDLE master_tty_window;
-
- sprintf (&buf[0],
- "%s: GC file error (code = %d) when manipulating %s.\n"
- "Choose an option (Cancel = Exit Scheme)",
- operation_name, (GetLastError ()), noise);
- switch (MessageBox (master_tty_window,
- &buf[0],
- "MIT Scheme garbage-collection problem description",
- (MB_ICONSTOP | MB_ABORTRETRYIGNORE | MB_APPLMODAL)))
- {
- case IDABORT:
- return (1);
-
- case IDRETRY:
- return (0);
-
- case IDIGNORE:
- Microcode_Termination (TERM_EXIT);
- }
-}
-#endif /* WINNT */
+#endif /* not _OS2 */
+#endif /* not WINNT */
\f
static int
DEFUN (verify_write, (position, size, success),
}
else
{
-#ifdef WINNT
- /* SRA: for NT, for the time being, we just assume that it will be a
- normal file */
+#ifdef ASSUME_NORMAL_GC_FILE
+ /* Assume that it will be a normal file. */
exists_p = true;
can_dump_directly_p = true;
#else
}
else
can_dump_directly_p = true;
-#endif
+#endif /* not ASSUME_NORMAL_GC_FILE */
}
\f
gc_file = (open (gc_file_name, flags, GC_FILE_MASK));
if (gc_file == -1)
{
-#if defined(DOS386) || defined(WINNT)
- /* Under DOS and Windows, errno does not give sufficient information. */
+#if defined(DOS386) || defined(WINNT) || defined(_OS2)
+ /* errno does not give sufficient information except under unix. */
int saved_errno = errno;
char
}
else
errno = saved_errno;
-#endif /* defined(DOS386) || defined(WINNT) */
+#endif /* defined(DOS386) || defined(WINNT) || defined(_OS2) */
termination_open_gc_file ("open", ((char *) NULL));
}
gc_file_current_position = -1; /* Unknown position */
+#ifndef ASSUME_NORMAL_GC_FILE
/* Determine whether it is a seekable file. */
-
if (exists_p && ((file_info.st_mode & S_IFMT) == S_IFCHR))
{
#if defined(F_GETFL) && defined(F_SETFL) && defined(O_NONBLOCK)
(void) (fcntl (gc_file, F_SETFL, (flags | O_NONBLOCK)));
#endif
}
+#endif /* not ASSUME_NORMAL_GC_FILE */
return;
}
\f
/* -*-C-*-
-$Id: bchutl.c,v 1.4 1993/11/11 20:18:41 cph Exp $
+$Id: bchutl.c,v 1.5 1995/03/21 22:12:45 cph Exp $
-Copyright (c) 1991-1993 Massachusetts Institute of Technology
+Copyright (c) 1991-95 Massachusetts Institute of Technology
This material was developed by the Scheme project at the Massachusetts
Institute of Technology, Department of Electrical Engineering and
promotional, or sales literature without prior written consent from
MIT in each case. */
+#include "oscond.h"
+#include "ansidecl.h"
+
#include <errno.h>
#ifndef EINTR
#define EINTR 1999
#ifndef DOS386
#ifndef WINNT
+#ifndef _OS2
#ifndef _NEXTOS
#include <unistd.h>
#endif
#endif
#endif
-
-#include "ansidecl.h"
+#endif
extern char * EXFUN (error_name, (int));
extern int EXFUN (retrying_file_operation,
}
#else /* not WINNT */
+#ifdef _OS2
+
+#ifdef __IBMC__
+#include <io.h>
+#endif
+
+char *
+DEFUN (error_name, (code), int code)
+{
+ static char buf [512];
+ sprintf ((&buf[0]), "%d, unknown error", code);
+ return (&buf[0]);
+}
+
+#else /* not _OS2 */
char *
DEFUN (error_name, (code), int code)
return (&buf[0]);
}
-#endif /* WINNT */
+#endif /* not _OS2 */
+#endif /* not WINNT */
#ifndef SEEK_SET
#define SEEK_SET 0