From 2a8e1845d68054f2694563675c06bc9840fb8c88 Mon Sep 17 00:00:00 2001 From: Chris Hanson Date: Sun, 2 Jul 1989 05:12:25 +0000 Subject: [PATCH] Two problems with print_a_char: was not checking character to see if it was in domain of character type predicates, and extended character representation didn't match what Psbtobin is looking for -- used hex instead of decimal. --- v7/src/microcode/bintopsb.c | 10 ++++++---- v8/src/microcode/bintopsb.c | 10 ++++++---- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/v7/src/microcode/bintopsb.c b/v7/src/microcode/bintopsb.c index ae7502e17..ba5a7fab4 100644 --- a/v7/src/microcode/bintopsb.c +++ b/v7/src/microcode/bintopsb.c @@ -30,7 +30,7 @@ Technology nor of any adaptation thereof in any advertising, promotional, or sales literature without prior written consent from MIT in each case. */ -/* $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/Attic/bintopsb.c,v 9.37 1989/05/16 07:16:51 jinx Rel $ +/* $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/Attic/bintopsb.c,v 9.38 1989/07/02 05:12:25 cph Exp $ * * This File contains the code to translate internal format binary * files to portable format. @@ -156,18 +156,20 @@ print_a_char(c, name) case '\\': OUT("\\\\"); case '\0': OUT("\\0"); case ' ' : OUT(" "); + default: - if ((isalpha(c)) || (isdigit(c)) || (ispunct(c))) + if ((isascii(c)) && ((isalpha(c)) || (isdigit(c)) || (ispunct(c)))) { putc(c, portable_file); } else { + unsigned int x = (((int) c) & ((1 << CHAR_SIZE) - 1)); fprintf(stderr, "%s: %s: File may not be portable: c = 0x%x\n", - program_name, name, ((int) c)); + program_name, name, x); /* This does not follow C conventions, but eliminates ambiguity */ - fprintf(portable_file, "X%x ", ((int) c)); + fprintf(portable_file, "\\X%d ", x); } } return; diff --git a/v8/src/microcode/bintopsb.c b/v8/src/microcode/bintopsb.c index fe377b159..fece13dd0 100644 --- a/v8/src/microcode/bintopsb.c +++ b/v8/src/microcode/bintopsb.c @@ -30,7 +30,7 @@ Technology nor of any adaptation thereof in any advertising, promotional, or sales literature without prior written consent from MIT in each case. */ -/* $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v8/src/microcode/bintopsb.c,v 9.37 1989/05/16 07:16:51 jinx Rel $ +/* $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v8/src/microcode/bintopsb.c,v 9.38 1989/07/02 05:12:25 cph Exp $ * * This File contains the code to translate internal format binary * files to portable format. @@ -156,18 +156,20 @@ print_a_char(c, name) case '\\': OUT("\\\\"); case '\0': OUT("\\0"); case ' ' : OUT(" "); + default: - if ((isalpha(c)) || (isdigit(c)) || (ispunct(c))) + if ((isascii(c)) && ((isalpha(c)) || (isdigit(c)) || (ispunct(c)))) { putc(c, portable_file); } else { + unsigned int x = (((int) c) & ((1 << CHAR_SIZE) - 1)); fprintf(stderr, "%s: %s: File may not be portable: c = 0x%x\n", - program_name, name, ((int) c)); + program_name, name, x); /* This does not follow C conventions, but eliminates ambiguity */ - fprintf(portable_file, "X%x ", ((int) c)); + fprintf(portable_file, "\\X%d ", x); } } return; -- 2.25.1