From e7537bee1f8f145ac467fd7bb79562399b65c5f7 Mon Sep 17 00:00:00 2001 From: Chris Hanson Date: Fri, 15 Jul 2005 05:31:18 +0000 Subject: [PATCH] Change some variables from signed to unsigned. --- v7/src/microcode/syntax.c | 94 ++++++++++++++++++++++++++++----------- v7/src/microcode/syntax.h | 12 +++-- 2 files changed, 73 insertions(+), 33 deletions(-) diff --git a/v7/src/microcode/syntax.c b/v7/src/microcode/syntax.c index c5cf054cc..6f08a6e85 100644 --- a/v7/src/microcode/syntax.c +++ b/v7/src/microcode/syntax.c @@ -1,9 +1,9 @@ /* -*-C-*- -$Id: syntax.c,v 1.28 2004/12/17 03:46:22 cph Exp $ +$Id: syntax.c,v 1.29 2005/07/15 05:31:09 cph Exp $ Copyright 1987,1988,1989,1991,1993,1996 Massachusetts Institute of Technology -Copyright 2000,2004 Massachusetts Institute of Technology +Copyright 2000,2004,2005 Massachusetts Institute of Technology This file is part of MIT/GNU Scheme. @@ -43,36 +43,77 @@ should have been included along with this file. */ /* Convert a letter which signifies a syntax code into the code it signifies. */ -#define ILLEGAL ((char) syntaxcode_max) +#define ILLEGAL ((unsigned char) syntaxcode_max) -char syntax_spec_code[0200] = +unsigned char syntax_spec_code [0x80] = { ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, - ((char) syntaxcode_whitespace), ILLEGAL, ((char) syntaxcode_string), - ILLEGAL, ((char) syntaxcode_math), ILLEGAL, ILLEGAL, - ((char) syntaxcode_quote), - ((char) syntaxcode_open), ((char) syntaxcode_close), ILLEGAL, ILLEGAL, - ILLEGAL, ((char) syntaxcode_whitespace), ((char) syntaxcode_punct), - ((char) syntaxcode_charquote), + ((unsigned char) syntaxcode_whitespace), + ILLEGAL, + ((unsigned char) syntaxcode_string), + ILLEGAL, + ((unsigned char) syntaxcode_math), + ILLEGAL, + ILLEGAL, + ((unsigned char) syntaxcode_quote), + + ((unsigned char) syntaxcode_open), + ((unsigned char) syntaxcode_close), + ILLEGAL, + ILLEGAL, + ILLEGAL, + ((unsigned char) syntaxcode_whitespace), + ((unsigned char) syntaxcode_punct), + ((unsigned char) syntaxcode_charquote), + ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ((char) syntaxcode_comment), - ILLEGAL, ((char) syntaxcode_endcomment), ILLEGAL, + + ILLEGAL, + ILLEGAL, + ILLEGAL, + ILLEGAL, + ((unsigned char) syntaxcode_comment), + ILLEGAL, + ((unsigned char) syntaxcode_endcomment), + ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, - ((char) syntaxcode_word), - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ((char) syntaxcode_escape), ILLEGAL, - ILLEGAL, ((char) syntaxcode_symbol), + + ILLEGAL, + ILLEGAL, + ILLEGAL, + ILLEGAL, + ILLEGAL, + ILLEGAL, + ILLEGAL, + ((unsigned char) syntaxcode_word), + + ILLEGAL, + ILLEGAL, + ILLEGAL, + ILLEGAL, + ((unsigned char) syntaxcode_escape), + ILLEGAL, + ILLEGAL, + ((unsigned char) syntaxcode_symbol), ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, - ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, - ((char) syntaxcode_word), + + ILLEGAL, + ILLEGAL, + ILLEGAL, + ILLEGAL, + ILLEGAL, + ILLEGAL, + ILLEGAL, + ((unsigned char) syntaxcode_word), + ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL, ILLEGAL }; @@ -83,18 +124,19 @@ unsigned char syntax_code_spec[13] = ' ', '.', 'w', '_', '(', ')', '\'', '\"', '$', '\\', '/', '<', '>' }; -#define MERGE_PREFIX_BIT(bit) \ +#define MERGE_PREFIX_BIT(bit) do \ { \ if ((result & bit) != 0) \ error_bad_range_arg (1); \ result |= bit; \ -} +} while (0) #define MERGE_COMMENT(bit) MERGE_PREFIX_BIT ((bit) << 12) DEFINE_PRIMITIVE ("STRING->SYNTAX-ENTRY", Prim_string_to_syntax_entry, 1, 1, 0) { - long length, c, result; + unsigned long length; + unsigned long result; unsigned char * scan; PRIMITIVE_HEADER (1); @@ -104,17 +146,17 @@ DEFINE_PRIMITIVE ("STRING->SYNTAX-ENTRY", Prim_string_to_syntax_entry, 1, 1, 0) if ((length--) > 0) { - c = (*scan++); + unsigned long c = (*scan++); if (c >= 0200) error_bad_range_arg (1); - result = (syntax_spec_code [c]); + result = (syntax_spec_code[c]); if (result == ILLEGAL) error_bad_range_arg (1); } else - result = ((long) syntaxcode_whitespace); + result = ((unsigned long) syntaxcode_whitespace); if ((length--) > 0) { - c = (*scan++); + unsigned long c = (*scan++); if (c != ' ') result |= (c << 4); } @@ -147,7 +189,7 @@ DEFINE_PRIMITIVE ("STRING->SYNTAX-ENTRY", Prim_string_to_syntax_entry, 1, 1, 0) if (((SYNTAX_ENTRY_CODE (result)) == syntaxcode_endcomment) && (! ((SYNTAX_ENTRY_COMMENT_BITS (result)) & COMEND_FIRST))) MERGE_COMMENT (COMEND_FIRST_A); - PRIMITIVE_RETURN (LONG_TO_UNSIGNED_FIXNUM (result)); + PRIMITIVE_RETURN (ULONG_TO_FIXNUM (result)); } DEFINE_PRIMITIVE ("CHAR->SYNTAX-CODE", Prim_char_to_syntax_code, 2, 2, 0) diff --git a/v7/src/microcode/syntax.h b/v7/src/microcode/syntax.h index 4985e5e6e..c9243c3cd 100644 --- a/v7/src/microcode/syntax.h +++ b/v7/src/microcode/syntax.h @@ -1,6 +1,6 @@ /* -*-C-*- -$Id: syntax.h,v 1.12 2003/02/14 18:28:23 cph Exp $ +$Id: syntax.h,v 1.13 2005/07/15 05:31:18 cph Exp $ Copyright (c) 1987-1999 Massachusetts Institute of Technology @@ -28,9 +28,7 @@ USA. /* NOTE: This program was created by translation from the syntax table code of GNU Emacs; it was translated from the original C to 68000 assembly language (in 1986), and then translated back from 68000 -assembly language to C (in 1987). Users should be aware that the GNU -GENERAL PUBLIC LICENSE may apply to this code. A copy of that license -should have been included along with this file. */ +assembly language to C (in 1987). */ /* CODE is the syntax code for the character. */ #define SYNTAX_ENTRY_CODE(entry) ((enum syntaxcode) ((entry) & 0xF)) @@ -89,13 +87,13 @@ enum syntaxcode /* The possible syntax codes. */ }; #define SYNTAX_ENTRY_QUOTE(entry) \ - (((SYNTAX_ENTRY_CODE (entry)) == syntaxcode_escape) || \ - ((SYNTAX_ENTRY_CODE (entry)) == syntaxcode_charquote)) + (((SYNTAX_ENTRY_CODE (entry)) == syntaxcode_escape) \ + || ((SYNTAX_ENTRY_CODE (entry)) == syntaxcode_charquote)) /* This array, indexed by a character, contains the syntax code which that character signifies (as a char). For example, ((enum syntaxcode) syntax_spec_code['w']) is syntaxcode_word. */ -extern char syntax_spec_code[0200]; +extern unsigned char syntax_spec_code [0x80]; #define SYNTAX_TABLE_P(argument) \ ((VECTOR_P (argument)) && ((VECTOR_LENGTH (argument)) == 0x100)) -- 2.25.1