From d9b73849e74e9c69531deda5c7e4bce5772d7f95 Mon Sep 17 00:00:00 2001
From: rtoy <rtoy>
Date: Tue, 31 May 2011 13:26:41 +0000
Subject: [PATCH] Add -unidata option to specify unidata.bin file.

This change requires a cross-compile.  Use boot-2011-04-01-cross.lisp
as the cross-compile script.

bootfiles/20b/boot-2011-04-01-cross.lisp:
o New cross-compile bootstrap file

lisp/lisp.c:
o Recognize -unidata option and setup *UNIDATA-PATH* appropriately.

code/commandline.lisp:
o Add defswitch for unidata so we don't get complaints about unknown
  switch.

code/unidata.lisp:
o Rename +UNIDATA-PATH+ to *UNIDATA-PATH*, since it's not a constant
  anymore.
o Update code to use new name.

code/print.lisp:
o Update code to use *UNIDATA-PATH*

compiler/sparc/parms.lisp:
o Add *UNIDATA-PATH* to list of static symbols.
o Add back in spare-9 and spare-8 static symbols since we need to do a
  cross-compile for this change anyway.

compiler/x86/parms.lisp:
o Add *UNIDATA-PATH* to list of static symbols.
o Reorder the static symbols in a more logical arrangment so that the
  spare symbols are at the end.

i18n/local/cmucl.pot:
o Update
---
 bootfiles/20b/boot-2011-04-01-cross.lisp | 11 +++++++++++
 code/commandline.lisp                    |  6 +++++-
 code/print.lisp                          |  6 +++---
 code/unidata.lisp                        |  8 ++++----
 compiler/sparc/parms.lisp                |  6 +++++-
 compiler/x86/parms.lisp                  | 22 ++++++++++++----------
 i18n/locale/cmucl.pot                    |  4 ++++
 lisp/lisp.c                              |  9 ++++++++-
 8 files changed, 52 insertions(+), 20 deletions(-)
 create mode 100644 bootfiles/20b/boot-2011-04-01-cross.lisp

diff --git a/bootfiles/20b/boot-2011-04-01-cross.lisp b/bootfiles/20b/boot-2011-04-01-cross.lisp
new file mode 100644
index 000000000..9df0badc0
--- /dev/null
+++ b/bootfiles/20b/boot-2011-04-01-cross.lisp
@@ -0,0 +1,11 @@
+;; Add -unidata command line option to allow user to tell cmucl where
+;; the unidata.bin file is.
+;;
+;; To build 2011-06, you need to do a cross-compile.  Use this as the
+;; cross-compile bootstrap file.
+
+#+x86
+(load "target:tools/cross-scripts/cross-x86-x86.lisp")
+
+#+sparc
+(load "target:tools/cross-scripts/cross-sparc-sparc.lisp")
diff --git a/code/commandline.lisp b/code/commandline.lisp
index 21dcbd65c..9dded6a45 100644
--- a/code/commandline.lisp
+++ b/code/commandline.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/commandline.lisp,v 1.26 2010/11/02 18:30:04 rtoy Exp $")
+  "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/commandline.lisp,v 1.27 2011/05/31 13:26:40 rtoy Exp $")
 ;;;
 ;;; **********************************************************************
 ;;;
@@ -301,6 +301,10 @@
   "Enables printing of messages indication how CMUCL is searching for
   its default core file.")
 
+(defswitch "unidata" nil
+  "Specify the unidata.bin file to be used."
+  "filename")
+
 #+x86
 (intl:with-textdomain ("cmucl" "cmucl-x86-vm")
 (defswitch "fpu" nil
diff --git a/code/print.lisp b/code/print.lisp
index 8d19ca598..311155be9 100644
--- a/code/print.lisp
+++ b/code/print.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/print.lisp,v 1.131 2010/04/20 17:57:45 rtoy Rel $")
+  "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/print.lisp,v 1.132 2011/05/31 13:26:40 rtoy Exp $")
 ;;;
 ;;; **********************************************************************
 ;;;
@@ -2164,9 +2164,9 @@ radix-R.  If you have a power-list then pass it in as PL."
 ;;; is initialized.
 #+unicode
 (defun reinit-char-attributes ()
-  (unless (probe-file +unidata-path+)
+  (unless (probe-file *unidata-path*)
     (cerror _"Continue anyway" _"Cannot find ~S, so unicode support is not available"
-	    +unidata-path+)
+	    *unidata-path*)
     (return-from reinit-char-attributes nil))
   (flet ((set-bit (char bit)
 	   (let ((code (char-code char)))
diff --git a/code/unidata.lisp b/code/unidata.lisp
index 04deace39..79eb7c77e 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.25 2011/04/02 20:11:31 rtoy Exp $")
+(ext:file-comment "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/unidata.lisp,v 1.26 2011/05/31 13:26:40 rtoy Exp $")
 ;;;
 ;;; **********************************************************************
 ;;;
@@ -16,9 +16,9 @@
 (export '(string-to-nfd string-to-nfkc string-to-nfkd string-to-nfc
 	  unicode-complete unicode-complete-name))
 
-(defconstant +unidata-path+ #p"ext-formats:unidata.bin")
+(defvar *unidata-path* "ext-formats:unidata.bin")
 
-(defvar *unidata-version* "$Revision: 1.25 $")
+(defvar *unidata-version* "$Revision: 1.26 $")
 
 (defstruct unidata
   range
@@ -495,7 +495,7 @@
 		  (read-vector lvec stm :endian-swap :network-order)
 		  (values split hvec mvec lvec))))
        (declare (ignorable #'read16 #'read32 #'read-ntrie))
-       (with-open-file (,stm +unidata-path+ :direction :input
+       (with-open-file (,stm *unidata-path* :direction :input
 			     :element-type '(unsigned-byte 8))
 	 (unless (unidata-locate ,stm ,locn)
 	   (error (intl:gettext "No data in file.")))
diff --git a/compiler/sparc/parms.lisp b/compiler/sparc/parms.lisp
index ac331a3f8..29b19bd58 100644
--- a/compiler/sparc/parms.lisp
+++ b/compiler/sparc/parms.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/compiler/sparc/parms.lisp,v 1.62 2010/12/04 17:32:34 rtoy Exp $")
+  "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/compiler/sparc/parms.lisp,v 1.63 2011/05/31 13:26:40 rtoy Exp $")
 ;;;
 ;;; **********************************************************************
 ;;;
@@ -345,10 +345,14 @@
     ;; FP constants
     *fp-constant-0d0*
     *fp-constant-0f0*
+
+    lisp::*unidata-path*
     
     ;; Some spare static symbols.  Useful for adding another static
     ;; symbol without having to do a cross-compile.  Just rename one
     ;; of these to the desired name.
+    spare-9
+    spare-8
     spare-7
     spare-6
     spare-5
diff --git a/compiler/x86/parms.lisp b/compiler/x86/parms.lisp
index 61bd02668..0784b70b8 100644
--- a/compiler/x86/parms.lisp
+++ b/compiler/x86/parms.lisp
@@ -7,7 +7,7 @@
 ;;; Scott Fahlman or slisp-group@cs.cmu.edu.
 ;;;
 (ext:file-comment
-  "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/compiler/x86/parms.lisp,v 1.42 2010/12/22 02:12:52 rtoy Exp $")
+  "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/compiler/x86/parms.lisp,v 1.43 2011/05/31 13:26:40 rtoy Exp $")
 ;;;
 ;;; **********************************************************************
 ;;;
@@ -351,6 +351,15 @@
       ;; common slot unbound check.
       pcl::..slot-unbound..
 
+      ;; Used by CGC.
+      *x86-cgc-active-p*
+      ;; Foreign linkage stuff
+      lisp::*linkage-table-data*
+      system::*global-table*
+
+      *current-region-free-pointer*
+      *current-region-end-addr*
+
       ;; These are filled in the C run-time.
       lisp::*cmucl-lib*
       lisp::*cmucl-core-path*
@@ -361,8 +370,10 @@
       :key-and-value
       :key-or-value
 
+      lisp::*unidata-path*
       ;; Spare symbols.  Rename these when you need to add some static
       ;; symbols and don't want to do a cross-compile.
+      spare-9
       spare-8
       spare-7
       spare-6
@@ -372,16 +383,7 @@
       spare-2
       spare-1
       
-      ;; Used by CGC.
-      *x86-cgc-active-p*
-      ;; Foreign linkage stuff
-      lisp::*linkage-table-data*
-      system::*global-table*
-      *current-region-free-pointer*
-      *current-region-end-addr*
       *static-blue-bag*		; Must be last or change C code
-
-      
       ))
 
 (defparameter static-functions
diff --git a/i18n/locale/cmucl.pot b/i18n/locale/cmucl.pot
index 18d35d42d..a64437c34 100644
--- a/i18n/locale/cmucl.pot
+++ b/i18n/locale/cmucl.pot
@@ -6009,6 +6009,10 @@ msgid ""
 "  its default core file."
 msgstr ""
 
+#: src/code/commandline.lisp
+msgid "Specify a new path to the unidata.bin file to be used."
+msgstr ""
+
 #: src/code/commandline.lisp
 msgid "~&Usage: ~A <options>~2%"
 msgstr ""
diff --git a/lisp/lisp.c b/lisp/lisp.c
index a808f48ae..2b8ca8686 100644
--- a/lisp/lisp.c
+++ b/lisp/lisp.c
@@ -1,7 +1,7 @@
 /*
  * main() entry point for a stand alone lisp image.
  *
- * $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/lisp.c,v 1.81 2010/12/26 16:04:43 rswindells Exp $
+ * $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/lisp.c,v 1.82 2011/05/31 13:26:41 rtoy Exp $
  *
  */
 
@@ -446,6 +446,7 @@ main(int argc, const char *argv[], const char *envp[])
     const char *default_core;
     const char *lib = NULL;
     const char *cmucllib = NULL;
+    const char *unidata = NULL;
     
     fpu_mode_t fpu_type = AUTO;
     boolean monitor;
@@ -547,6 +548,8 @@ main(int argc, const char *argv[], const char *envp[])
 	    monitor = TRUE;
 	} else if (strcmp(arg, "-debug-lisp-search") == 0) {
 	    debug_lisp_search = TRUE;
+        } else if (strcmp(arg, "-unidata") == 0) {
+          unidata = *++argptr;
         }
 #ifdef i386
 	else if (strcmp(arg, "-fpu") == 0) {
@@ -786,6 +789,10 @@ main(int argc, const char *argv[], const char *envp[])
 	    SetSymbolValue(BATCH_MODE, T);
     }
 
+    if (unidata) {
+      SetSymbolValue(UNIDATA_PATH, alloc_string(unidata));
+    }
+    
     /*
      * Pick off sigint until the lisp system gets far enough along to
      * install it's own.
-- 
GitLab