changeset 5081:baffa6ca776a

Backed out changeset c673987f5f3d
author Aidan Kehoe <kehoea@parhasard.net>
date Fri, 26 Feb 2010 15:22:15 +0000
parents c673987f5f3d
children 37a17808de95
files lisp/ChangeLog lisp/coding.el lisp/dumped-lisp.el lisp/mule/make-coding-system.el
diffstat 4 files changed, 28 insertions(+), 44 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Mon Feb 22 21:26:18 2010 -0600
+++ b/lisp/ChangeLog	Fri Feb 26 15:22:15 2010 +0000
@@ -1,26 +1,3 @@
-2010-02-22  Ben Wing  <ben@xemacs.org>
-
-	* mule/make-coding-system.el:
-	* mule/make-coding-system.el (fixed-width-generate-helper):
-	* mule/make-coding-system.el (fixed-width-private-use-start): Removed.
-	* mule/make-coding-system.el (fixed-width-create-decode-encode-tables):
-	* coding.el:
-	* coding.el (decode-char): New.
-	* coding.el (featurep):
-	* coding.el (encode-char): New.
-	* dumped-lisp.el (preloaded-file-list):
-	Dump make-coding-system.  Aidan's hack to avoid dumping this file
-	never really worked right -- with some configurations (not clear
-	exactly which ones) `make-coding-system.el' gets dumped anyway due to
-	calls to `make-coding-system' in unicode.el, with the result that
-	the documentation of functions in make-coding-system.el gets lost.
-
-	Also needed to remove defvar fixed-width-private-use-start and
-	incorporate it inline, due to bootstrapping issues -- the call to
-	decode-char introduced a cross-dependency between unicode.el and
-	make-coding-system.el.
-	
-
 2010-02-22  Ben Wing  <ben@xemacs.org>
 
 	* cl-seq.el:
--- a/lisp/coding.el	Mon Feb 22 21:26:18 2010 -0600
+++ b/lisp/coding.el	Fri Feb 26 15:22:15 2010 +0000
@@ -5,7 +5,7 @@
 ;; Copyright (C) 1995 Amdahl Corporation.
 ;; Copyright (C) 1995 Sun Microsystems.
 ;; Copyright (C) 1997 MORIOKA Tomohiko
-;; Copyright (C) 2000, 2001, 2002, 2010 Ben Wing.
+;; Copyright (C) 2000, 2001, 2002 Ben Wing.
 
 ;; This file is part of XEmacs.
 
@@ -464,25 +464,27 @@
   (and (query-coding-string char coding-system)
        (encode-coding-string char coding-system)))
 
-(defun decode-char (quote-ucs code &optional restriction) 
-  "FSF compatibility--return Mule character with Unicode codepoint CODE.
-The second argument must be 'ucs, the third argument is ignored.  "
-  ;; We're prepared to accept invalid Unicode in unicode-to-char, but not in
-  ;; this function, which is the API that should actually be used, since
-  ;; it's available in GNU and in Mule-UCS.
-  (check-argument-range code #x0 #x10FFFF)
-  (assert (eq quote-ucs 'ucs) t
-	  "Sorry, decode-char doesn't yet support anything but the UCS.  ")
-  (unicode-to-char code))
+(if (featurep 'mule)
+    (progn
+      ;; Under Mule, we do much of the complicated coding system creation in
+      ;; Lisp and especially at compile time. We need some function
+      ;; definition for this function to be created in this file, but we can
+      ;; leave assigning the docstring to the autoload cookie
+      ;; handling later. Thankfully; that docstring is big.
+      (autoload 'make-coding-system "mule/make-coding-system")
 
-(defun encode-char (char quote-ucs &optional restriction)
-  "FSF compatibility--return the Unicode code point of CHAR.
-The second argument must be 'ucs, the third argument is ignored.  "
-  (assert (eq quote-ucs 'ucs) t
-	  "Sorry, encode-char doesn't yet support anything but the UCS.  ")
-  (char-to-unicode char))
+      ;; (During byte-compile before dumping, make-coding-system may already
+      ;; have been loaded, make sure not to overwrite the correct compiler
+      ;; macro:)
+      (when (eq 'autoload (car (symbol-function 'make-coding-system)))
+        ;; Make sure to pick up the correct compiler macro when compiling
+        ;; files:
+        (define-compiler-macro make-coding-system (&whole form name type
+                                                   &optional description props)
+          (load (second (symbol-function 'make-coding-system)))
+          (funcall (get 'make-coding-system 'cl-compiler-macro)
+                   form name type description props))))
 
-(unless (featurep 'mule)
   ;; Mule's not available; 
   (fset 'make-coding-system (symbol-function 'make-coding-system-internal))
   (define-coding-system-alias 'escape-quoted 'binary)
--- a/lisp/dumped-lisp.el	Mon Feb 22 21:26:18 2010 -0600
+++ b/lisp/dumped-lisp.el	Fri Feb 26 15:22:15 2010 +0000
@@ -160,7 +160,6 @@
        "code-process"
        ;; Provide basic commands to set coding systems to user
        "code-cmds"
-       (when (featurep 'mule) "mule/make-coding-system")
        "unicode"
 	;;;;;;;;;;;;;;;;;; MULE support
        (when (featurep 'mule)
--- a/lisp/mule/make-coding-system.el	Mon Feb 22 21:26:18 2010 -0600
+++ b/lisp/mule/make-coding-system.el	Fri Feb 26 15:22:15 2010 +0000
@@ -2,7 +2,6 @@
 ;;; much of the implementation of the fixed-width coding system type.
 
 ;; Copyright (C) 2009 Free Software Foundation
-;; Copyright (C) 2010 Ben Wing.
 
 ;; Author: Aidan Kehoe
 
@@ -27,6 +26,13 @@
 
 ;;; Code:
 
+(defvar fixed-width-private-use-start (decode-char 'ucs #xE000)
+  "Start of a 256 code private use area for fixed-width coding systems.
+
+This is used to ensure that distinct octets on disk for a given coding
+system map to distinct XEmacs characters, preventing spurious changes when
+a file is read, not changed, and then written.  ")
+
 (defun fixed-width-generate-helper (decode-table encode-table
 				   encode-failure-octet)
   "Helper func, `fixed-width-generate-encode-program-and-skip-chars-strings',
@@ -317,7 +323,7 @@
   (check-argument-type #'listp unicode-map)
   (let ((decode-table (make-vector 256 nil))
         (encode-table (make-hash-table :size 256 :rehash-threshold 0.999))
-	(private-use-start #xE000)
+	(private-use-start (encode-char fixed-width-private-use-start 'ucs))
         (invalid-sequence-code-point-start
          (eval-when-compile
            (char-to-unicode