From a826481f56d6958860c23bd974708e96404f06e2 Mon Sep 17 00:00:00 2001
From: rtoy <rtoy>
Date: Tue, 16 Jun 2009 17:23:15 +0000
Subject: [PATCH] code/string.lisp: o Only define STRING-TO-NFD,
 STRING-TO-NFKD, and STRING-TO-NFKC for   Unicode builds.  Conditionalize out
 their support functions too. o Update export list to be conditional on
 Unicode too. o Use new name for get-pairwise-composition.

code/exports.lisp:
o Update export list to be conditional on Unicode for above changes
  in string.lisp.

code/unidata.lisp:
o Change name from GET-PAIRWISE-COMPOSITION to
  UNICODE-PAIRWISE-COMPOSITION to match other Unicode function names.
---
 code/exports.lisp |  8 +++++---
 code/string.lisp  | 21 +++++++++++++--------
 code/unidata.lisp |  4 ++--
 3 files changed, 20 insertions(+), 13 deletions(-)

diff --git a/code/exports.lisp b/code/exports.lisp
index 00b23272f..d9c2260bf 100644
--- a/code/exports.lisp
+++ b/code/exports.lisp
@@ -5,7 +5,7 @@
 ;;; Carnegie Mellon University, and has been placed in the public domain.
 ;;;
 (ext:file-comment
-  "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/exports.lisp,v 1.283 2009/06/11 16:03:57 rtoy Exp $")
+  "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/exports.lisp,v 1.284 2009/06/16 17:23:14 rtoy Exp $")
 ;;;
 ;;; **********************************************************************
 ;;;
@@ -869,8 +869,10 @@
    "MAKE-LOAD-FORM" "MAKE-LOAD-FORM-SAVING-SLOTS"
    "CHAR-TITLECASE" "TITLE-CASE-P"
    "GLYPH" "SGLYPH"
-   "STRING-TO-NFD" "STRING-TO-NFKC" "STRING-TO-NFC" "STRING-TO-NFKD"
-   "CODEPOINT-LIMIT" "CODEPOINT"))
+   "STRING-TO-NFC"
+   "CODEPOINT-LIMIT" "CODEPOINT")
+  #+unicode
+  (:export "STRING-TO-NFD" "STRING-TO-NFKC"  "STRING-TO-NFKD"))
 
 (defpackage "EVAL"
   (:export "*EVAL-STACK-TRACE*" "*INTERNAL-APPLY-NODE-TRACE*"
diff --git a/code/string.lisp b/code/string.lisp
index d0344eae1..107a51382 100644
--- a/code/string.lisp
+++ b/code/string.lisp
@@ -5,7 +5,7 @@
 ;;; Carnegie Mellon University, and has been placed in the public domain.
 ;;;
 (ext:file-comment
-  "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/string.lisp,v 1.13 2009/06/11 16:03:59 rtoy Exp $")
+  "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/string.lisp,v 1.14 2009/06/16 17:23:15 rtoy Exp $")
 ;;;
 ;;; **********************************************************************
 ;;;
@@ -20,13 +20,15 @@
 	  string= string-equal string< string> string<= string>= string/=
 	  string-lessp string-greaterp string-not-lessp string-not-greaterp
 	  string-not-equal
-	  string-to-nfd string-to-nfkd string-to-nfc string-to-nfkc
+	  string-to-nfc
 	  make-string
 	  string-trim string-left-trim string-right-trim
 	  string-upcase
 	  string-downcase string-capitalize nstring-upcase nstring-downcase
 	  nstring-capitalize))
 
+#+unicode
+(export '(string-to-nfd string-to-nfkd string-to-nfkc))
 
 (declaim (inline surrogatep surrogates-to-codepoint codepoint surrogates))
 
@@ -1173,6 +1175,8 @@
 
 
 
+#+unicode
+(progn
 (defun decompose (string &optional (compatibility t))
   (declare (type string string))
   (let ((result (make-string (cond ((< (length string) 40)
@@ -1292,7 +1296,7 @@
 	      (codepoint target decomp-pos len)
 	    (when wide (incf decomp-pos))
 	    (let ((ch-class (unicode-combining-class ch))
-		  (composite (get-pairwise-composition starter-ch ch)))
+		  (composite (unicode-pairwise-composition starter-ch ch)))
 	      (declare (type (integer 0 256) ch-class))
 	      (cond ((and composite
 			  (or (< last-class ch-class) (zerop last-class)))
@@ -1324,7 +1328,6 @@
   compatible decomposition form.  The NFKD string is returned."
   (decompose string t))
 
-#+unicode
 (defun string-to-nfc (string)
   "Convert String to Unicode Normalization Form C (NFC).  If the
   string a simple string and is already normalized, the original
@@ -1336,10 +1339,6 @@
 		  (%compose (string-to-nfd string)))
 	      'simple-string)))
 
-#-unicode  ;; Needed by package.lisp
-(defun string-to-nfc (string)
-  (if (simple-string-p string) string (coerce string 'simple-string)))
-
 (defun string-to-nfkc (string)
   "Convert String to Unicode Normalization Form KC (NFKC).  If the
   string is a simple string and is already normalized, the original
@@ -1350,3 +1349,9 @@
 		  (%compose (copy-seq string))
 		  (%compose (string-to-nfkd string)))
 	      'simple-string)))
+) ; end unicode
+
+#-unicode  ;; Needed by package.lisp
+(defun string-to-nfc (string)
+  (if (simple-string-p string) string (coerce string 'simple-string)))
+
diff --git a/code/unidata.lisp b/code/unidata.lisp
index 5781451a1..b261d2578 100644
--- a/code/unidata.lisp
+++ b/code/unidata.lisp
@@ -4,7 +4,7 @@
 ;;; This code was written by Paul Foley and has been placed in the public
 ;;; domain.
 ;;; 
-(ext:file-comment "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/unidata.lisp,v 1.2 2009/06/11 16:03:59 rtoy Exp $")
+(ext:file-comment "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/unidata.lisp,v 1.3 2009/06/16 17:23:15 rtoy Exp $")
 ;;;
 ;;; **********************************************************************
 ;;;
@@ -1042,7 +1042,7 @@
 		   (+ c1 index-t)))))))))
 	     
 
-(defun get-pairwise-composition (c1 c2)
+(defun unicode-pairwise-composition (c1 c2)
   (declare (type codepoint c1 c2)
 	   (optimize (speed 3)))
   (unless *composition-pair-table*
-- 
GitLab