From 8b98676cabf986968a4a6f380f91db93bccf57a4 Mon Sep 17 00:00:00 2001 From: Chris Hanson Date: Mon, 24 Sep 2001 05:24:55 +0000 Subject: [PATCH] Make ISO-8859-1 changes to string code, which involved rewriting all of the case-aware procedures. Many of these were inherited from primitives, so it was necessary to write Scheme versions of the primitives. --- v7/src/runtime/char.scm | 32 +++++--- v7/src/runtime/runtime.pkg | 5 +- v7/src/runtime/string.scm | 156 +++++++++++++++++++++++++++++-------- 3 files changed, 151 insertions(+), 42 deletions(-) diff --git a/v7/src/runtime/char.scm b/v7/src/runtime/char.scm index 8174acf96..0ee70d8a6 100644 --- a/v7/src/runtime/char.scm +++ b/v7/src/runtime/char.scm @@ -1,6 +1,6 @@ #| -*-Scheme-*- -$Id: char.scm,v 14.11 2001/09/24 03:44:56 cph Exp $ +$Id: char.scm,v 14.12 2001/09/24 05:24:55 cph Exp $ Copyright (c) 1988-1999, 2001 Massachusetts Institute of Technology @@ -134,20 +134,32 @@ USA. (define (char-ci>=? x y) (fix:>= (char-ci->integer x) (char-ci->integer y))) - + (define (char-downcase char) (guarantee-char char 'CHAR-DOWNCASE) - (let ((n (%char-code char))) - (if (fix:< n 256) - (%make-char (vector-8b-ref downcase-table n) (%char-bits char)) - char))) + (%char-downcase char)) + +(define (%char-downcase char) + (if (fix:< (%char-code char) 256) + (%%char-downcase char) + char)) + +(define-integrable (%%char-downcase char) + (%make-char (vector-8b-ref downcase-table (%char-code char)) + (%char-bits char))) (define (char-upcase char) (guarantee-char char 'CHAR-UPCASE) - (let ((n (%char-code char))) - (if (fix:< n 256) - (%make-char (vector-8b-ref upcase-table n) (%char-bits char)) - char))) + (%char-upcase char)) + +(define (%char-upcase char) + (if (fix:< (%char-code char) 256) + (%%char-upcase char) + char)) + +(define-integrable (%%char-upcase char) + (%make-char (vector-8b-ref upcase-table (%char-code char)) + (%char-bits char))) (define downcase-table) (define upcase-table) diff --git a/v7/src/runtime/runtime.pkg b/v7/src/runtime/runtime.pkg index 88bc3bb84..3943cf7d7 100644 --- a/v7/src/runtime/runtime.pkg +++ b/v7/src/runtime/runtime.pkg @@ -1,6 +1,6 @@ #| -*-Scheme-*- -$Id: runtime.pkg,v 14.374 2001/08/17 12:50:52 cph Exp $ +$Id: runtime.pkg,v 14.375 2001/09/24 05:24:45 cph Exp $ Copyright (c) 1988-2001 Massachusetts Institute of Technology @@ -305,6 +305,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA integer->char make-char name->char) + (export (runtime string) + %%char-downcase + %%char-upcase) (initialization (initialize-package!))) (define-package (runtime character-set) diff --git a/v7/src/runtime/string.scm b/v7/src/runtime/string.scm index f9f32d9c5..6cb367ea4 100644 --- a/v7/src/runtime/string.scm +++ b/v7/src/runtime/string.scm @@ -1,6 +1,6 @@ #| -*-Scheme-*- -$Id: string.scm,v 14.43 2001/06/15 20:38:46 cph Exp $ +$Id: string.scm,v 14.44 2001/09/24 05:24:31 cph Exp $ Copyright (c) 1988-2001 Massachusetts Institute of Technology @@ -43,44 +43,28 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA string-allocate string? string-ref string-set! string-length set-string-length! string-maximum-length set-string-maximum-length! - substring=? substring-ci=? substringascii char))) -(define-integrable (substring-find-next-char string start end char) - (vector-8b-find-next-char string start end (char->ascii char))) - -(define-integrable (substring-find-previous-char string start end char) - (vector-8b-find-previous-char string start end (char->ascii char))) - -(define-integrable (substring-find-next-char-ci string start end char) - (vector-8b-find-next-char-ci string start end (char->ascii char))) +(define-integrable (vector-8b-find-next-char string start end ascii) + (substring-find-next-char string start end (ascii->char ascii))) -(define-integrable (substring-find-previous-char-ci string start end char) - (vector-8b-find-previous-char-ci string start end (char->ascii char))) +(define-integrable (vector-8b-find-previous-char string start end ascii) + (substring-find-previous-char string start end (ascii->char ascii))) -;;; Special, not implemented in microcode. +(define-integrable (vector-8b-find-next-char-ci string start end ascii) + (substring-find-next-char-ci string start end (ascii->char ascii))) -(define (substring-cichar ascii))) ;;; Substring Covers @@ -100,7 +84,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA string2 0 (string-length string2))) (define (string-ci