From f05f1c21cfde1617de44ece67d7bbbb1017dea03 Mon Sep 17 00:00:00 2001 From: "Henry M. Wu" Date: Tue, 11 Feb 1992 21:15:00 +0000 Subject: [PATCH] Make setup_io take mode arguments to prevent text translation on non-Unix systems. --- v7/src/microcode/bintopsb.c | 5 ++--- v7/src/microcode/ppband.c | 25 +++++++++++++++++++++++-- v7/src/microcode/psbmap.h | 36 ++++++++++++++++++------------------ v7/src/microcode/psbtobin.c | 7 +++---- v8/src/microcode/bintopsb.c | 5 ++--- v8/src/microcode/ppband.c | 25 +++++++++++++++++++++++-- v8/src/microcode/psbmap.h | 36 ++++++++++++++++++------------------ v8/src/microcode/psbtobin.c | 7 +++---- 8 files changed, 92 insertions(+), 54 deletions(-) diff --git a/v7/src/microcode/bintopsb.c b/v7/src/microcode/bintopsb.c index 960c2a84d..ad093e818 100644 --- a/v7/src/microcode/bintopsb.c +++ b/v7/src/microcode/bintopsb.c @@ -1,6 +1,6 @@ /* -*-C-*- -$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/Attic/bintopsb.c,v 9.49 1992/02/03 22:38:18 jinx Exp $ +$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/Attic/bintopsb.c,v 9.50 1992/02/11 21:14:38 mhwu Exp $ Copyright (c) 1987-1992 Massachusetts Institute of Technology @@ -37,7 +37,6 @@ MIT in each case. */ /* IO definitions */ -#include "ansidecl.h" #include "psbmap.h" #include "trap.h" #include "limits.h" @@ -1798,7 +1797,7 @@ DEFUN (main, (argc, argv), quit (1); } - setup_io (); + setup_io ("rb", "w"); do_it (); quit (0); } diff --git a/v7/src/microcode/ppband.c b/v7/src/microcode/ppband.c index 8dd82dc33..8b7c1dbad 100644 --- a/v7/src/microcode/ppband.c +++ b/v7/src/microcode/ppband.c @@ -1,8 +1,8 @@ /* -*-C-*- -$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/Attic/ppband.c,v 9.42 1990/11/21 21:07:33 jinx Rel $ +$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/Attic/ppband.c,v 9.43 1992/02/11 21:15:00 mhwu Exp $ -Copyright (c) 1987, 1989, 1990 Massachusetts Institute of Technology +Copyright (c) 1987-1992 Massachusetts Institute of Technology This material was developed by the Scheme project at the Massachusetts Institute of Technology, Department of Electrical Engineering and @@ -47,6 +47,23 @@ MIT in each case. */ #define fast register +/* These are needed when there is no compiler support. */ + +extern void EXFUN (gc_death, + (long code, char *, SCHEME_OBJECT *, SCHEME_OBJECT *)); + +extern char + gc_death_message_buffer[]; + +void +DEFUN (gc_death, (code, message, scan, free), + long code AND char * message + AND SCHEME_OBJECT * scan AND SCHEME_OBJECT * free) +{ + fprintf (stderr, "gc_death: %s.\n", message); + exit (1); +} + /* These are needed by load.c */ static SCHEME_OBJECT * memory_base; @@ -155,7 +172,11 @@ DEFUN (print_long_as_string, (string), char *string) printf (" "); break; +#ifdef __STDC__ case '\a': +#else + case '\007': +#endif printf (" \\a"); break; diff --git a/v7/src/microcode/psbmap.h b/v7/src/microcode/psbmap.h index 17811a8ef..6eff63d80 100644 --- a/v7/src/microcode/psbmap.h +++ b/v7/src/microcode/psbmap.h @@ -1,8 +1,8 @@ /* -*-C-*- -$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/Attic/psbmap.h,v 9.34 1992/01/15 17:31:41 jinx Exp $ +$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/Attic/psbmap.h,v 9.35 1992/02/11 21:14:07 mhwu Exp $ -Copyright (c) 1987-92 Massachusetts Institute of Technology +Copyright (c) 1987-1992 Massachusetts Institute of Technology This material was developed by the Scheme project at the Massachusetts Institute of Technology, Department of Electrical Engineering and @@ -45,6 +45,7 @@ MIT in each case. */ #define fast register #include +#include "ansidecl.h" #include "config.h" #include "types.h" #include "object.h" @@ -179,8 +180,7 @@ static char FILE *input_file, *output_file; Boolean -strequal(s1, s2) - register char *s1, *s2; +DEFUN (strequal, (s1, s2), register char * s1 AND register char * s2) { for ( ; *s1 != '\0'; s1++, s2++) { @@ -193,44 +193,44 @@ strequal(s1, s2) } void -setup_io() +DEFUN (setup_io, (input_mode, output_mode), + CONST char * input_mode AND CONST char * output_mode) { - if (strequal(input_file_name, "-")) + if (strequal (input_file_name, "-")) { input_file = stdin; } else { - input_file = fopen(input_file_name, "r"); + input_file = (fopen (input_file_name, input_mode)); if (input_file == ((FILE *) NULL)) { - fprintf(stderr, "%s: failed to open %s for input.\n", - input_file_name); - exit(1); + fprintf (stderr, "%s: failed to open %s for input.\n", + input_file_name); + exit (1); } } - if (strequal(output_file_name, "-")) + if (strequal (output_file_name, "-")) { output_file = stdout; } else { - output_file = fopen(output_file_name, "w"); + output_file = (fopen (output_file_name, output_mode)); if (output_file == ((FILE *) NULL)) { - fprintf(stderr, "%s: failed to open %s for output.\n", - output_file_name); - fclose(input_file); - exit(1); + fprintf (stderr, "%s: failed to open %s for output.\n", + output_file_name); + fclose (input_file); + exit (1); } } return; } void -quit(code) - int code; +DEFUN (quit, (code), int code) { fclose(input_file); fclose(output_file); diff --git a/v7/src/microcode/psbtobin.c b/v7/src/microcode/psbtobin.c index 0b0ba4476..dd51b76ca 100644 --- a/v7/src/microcode/psbtobin.c +++ b/v7/src/microcode/psbtobin.c @@ -1,8 +1,8 @@ /* -*-C-*- -$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/Attic/psbtobin.c,v 9.46 1992/02/03 22:39:43 jinx Exp $ +$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/Attic/psbtobin.c,v 9.47 1992/02/11 21:14:23 mhwu Exp $ -Copyright (c) 1987-92 Massachusetts Institute of Technology +Copyright (c) 1987-1992 Massachusetts Institute of Technology This material was developed by the Scheme project at the Massachusetts Institute of Technology, Department of Electrical Engineering and @@ -37,7 +37,6 @@ MIT in each case. */ /* Cheap renames */ -#include "ansidecl.h" #include "psbmap.h" #include "float.h" #include "limits.h" @@ -1249,7 +1248,7 @@ DEFUN (main, (argc, argv), } allow_nmv_p = (allow_nmv_p || allow_compiled_p); - setup_io (); + setup_io ("r", "wb"); do_it (); quit (0); } diff --git a/v8/src/microcode/bintopsb.c b/v8/src/microcode/bintopsb.c index 2160b0cd6..ea726cdbf 100644 --- a/v8/src/microcode/bintopsb.c +++ b/v8/src/microcode/bintopsb.c @@ -1,6 +1,6 @@ /* -*-C-*- -$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v8/src/microcode/bintopsb.c,v 9.49 1992/02/03 22:38:18 jinx Exp $ +$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v8/src/microcode/bintopsb.c,v 9.50 1992/02/11 21:14:38 mhwu Exp $ Copyright (c) 1987-1992 Massachusetts Institute of Technology @@ -37,7 +37,6 @@ MIT in each case. */ /* IO definitions */ -#include "ansidecl.h" #include "psbmap.h" #include "trap.h" #include "limits.h" @@ -1798,7 +1797,7 @@ DEFUN (main, (argc, argv), quit (1); } - setup_io (); + setup_io ("rb", "w"); do_it (); quit (0); } diff --git a/v8/src/microcode/ppband.c b/v8/src/microcode/ppband.c index 84ce7d1b4..c58eae8ca 100644 --- a/v8/src/microcode/ppband.c +++ b/v8/src/microcode/ppband.c @@ -1,8 +1,8 @@ /* -*-C-*- -$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v8/src/microcode/ppband.c,v 9.42 1990/11/21 21:07:33 jinx Rel $ +$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v8/src/microcode/ppband.c,v 9.43 1992/02/11 21:15:00 mhwu Exp $ -Copyright (c) 1987, 1989, 1990 Massachusetts Institute of Technology +Copyright (c) 1987-1992 Massachusetts Institute of Technology This material was developed by the Scheme project at the Massachusetts Institute of Technology, Department of Electrical Engineering and @@ -47,6 +47,23 @@ MIT in each case. */ #define fast register +/* These are needed when there is no compiler support. */ + +extern void EXFUN (gc_death, + (long code, char *, SCHEME_OBJECT *, SCHEME_OBJECT *)); + +extern char + gc_death_message_buffer[]; + +void +DEFUN (gc_death, (code, message, scan, free), + long code AND char * message + AND SCHEME_OBJECT * scan AND SCHEME_OBJECT * free) +{ + fprintf (stderr, "gc_death: %s.\n", message); + exit (1); +} + /* These are needed by load.c */ static SCHEME_OBJECT * memory_base; @@ -155,7 +172,11 @@ DEFUN (print_long_as_string, (string), char *string) printf (" "); break; +#ifdef __STDC__ case '\a': +#else + case '\007': +#endif printf (" \\a"); break; diff --git a/v8/src/microcode/psbmap.h b/v8/src/microcode/psbmap.h index 312b0249a..aa1ad0aad 100644 --- a/v8/src/microcode/psbmap.h +++ b/v8/src/microcode/psbmap.h @@ -1,8 +1,8 @@ /* -*-C-*- -$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v8/src/microcode/psbmap.h,v 9.34 1992/01/15 17:31:41 jinx Exp $ +$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v8/src/microcode/psbmap.h,v 9.35 1992/02/11 21:14:07 mhwu Exp $ -Copyright (c) 1987-92 Massachusetts Institute of Technology +Copyright (c) 1987-1992 Massachusetts Institute of Technology This material was developed by the Scheme project at the Massachusetts Institute of Technology, Department of Electrical Engineering and @@ -45,6 +45,7 @@ MIT in each case. */ #define fast register #include +#include "ansidecl.h" #include "config.h" #include "types.h" #include "object.h" @@ -179,8 +180,7 @@ static char FILE *input_file, *output_file; Boolean -strequal(s1, s2) - register char *s1, *s2; +DEFUN (strequal, (s1, s2), register char * s1 AND register char * s2) { for ( ; *s1 != '\0'; s1++, s2++) { @@ -193,44 +193,44 @@ strequal(s1, s2) } void -setup_io() +DEFUN (setup_io, (input_mode, output_mode), + CONST char * input_mode AND CONST char * output_mode) { - if (strequal(input_file_name, "-")) + if (strequal (input_file_name, "-")) { input_file = stdin; } else { - input_file = fopen(input_file_name, "r"); + input_file = (fopen (input_file_name, input_mode)); if (input_file == ((FILE *) NULL)) { - fprintf(stderr, "%s: failed to open %s for input.\n", - input_file_name); - exit(1); + fprintf (stderr, "%s: failed to open %s for input.\n", + input_file_name); + exit (1); } } - if (strequal(output_file_name, "-")) + if (strequal (output_file_name, "-")) { output_file = stdout; } else { - output_file = fopen(output_file_name, "w"); + output_file = (fopen (output_file_name, output_mode)); if (output_file == ((FILE *) NULL)) { - fprintf(stderr, "%s: failed to open %s for output.\n", - output_file_name); - fclose(input_file); - exit(1); + fprintf (stderr, "%s: failed to open %s for output.\n", + output_file_name); + fclose (input_file); + exit (1); } } return; } void -quit(code) - int code; +DEFUN (quit, (code), int code) { fclose(input_file); fclose(output_file); diff --git a/v8/src/microcode/psbtobin.c b/v8/src/microcode/psbtobin.c index f860961bb..9b29ebf55 100644 --- a/v8/src/microcode/psbtobin.c +++ b/v8/src/microcode/psbtobin.c @@ -1,8 +1,8 @@ /* -*-C-*- -$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v8/src/microcode/psbtobin.c,v 9.46 1992/02/03 22:39:43 jinx Exp $ +$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v8/src/microcode/psbtobin.c,v 9.47 1992/02/11 21:14:23 mhwu Exp $ -Copyright (c) 1987-92 Massachusetts Institute of Technology +Copyright (c) 1987-1992 Massachusetts Institute of Technology This material was developed by the Scheme project at the Massachusetts Institute of Technology, Department of Electrical Engineering and @@ -37,7 +37,6 @@ MIT in each case. */ /* Cheap renames */ -#include "ansidecl.h" #include "psbmap.h" #include "float.h" #include "limits.h" @@ -1249,7 +1248,7 @@ DEFUN (main, (argc, argv), } allow_nmv_p = (allow_nmv_p || allow_compiled_p); - setup_io (); + setup_io ("r", "wb"); do_it (); quit (0); } -- 2.25.1