view lisp/mule/general-late.el @ 5602:c9e5612f5424

Support the MP library on recent FreeBSD, have it pass relevant tests. src/ChangeLog addition: 2011-11-26 Aidan Kehoe <kehoea@parhasard.net> * number-mp.c (bignum_to_string): Don't overwrite the accumulator we've just set up for this function. * number-mp.c (BIGNUM_TO_TYPE): mp_itom() doesn't necessarily do what this code used to think with negative numbers, it can treat them as unsigned ints. Subtract numbers from bignum_zero instead of multiplying them by -1 to convert them to their negative equivalents. * number-mp.c (bignum_to_int): * number-mp.c (bignum_to_uint): * number-mp.c (bignum_to_long): * number-mp.c (bignum_to_ulong): * number-mp.c (bignum_to_double): Use the changed BIGNUM_TO_TYPE() in these functions. * number-mp.c (bignum_ceil): * number-mp.c (bignum_floor): In these functions, be more careful about rounding to positive and negative infinity, respectively. Don't use the sign of QUOTIENT when working out out whether to add or subtract one, rather use the sign QUOTIENT would have if arbitrary-precision division were done. * number-mp.h: * number-mp.h (MP_GCD): Wrap #include <mp.h> in BEGIN_C_DECLS/END_C_DECLS. * number.c (Fbigfloat_get_precision): * number.c (Fbigfloat_set_precision): Don't attempt to call XBIGFLOAT_GET_PREC if this build doesn't support big floats.
author Aidan Kehoe <kehoea@parhasard.net>
date Sat, 26 Nov 2011 17:59:14 +0000
parents 10f179710250
children
line wrap: on
line source

;;; general-late.el --- General Mule code that needs to be run late when
;;                      dumping.
;; Copyright (C) 2006 Free Software Foundation

;; Author: Aidan Kehoe

;; This file is part of XEmacs.

;; XEmacs is free software: you can redistribute it and/or modify it
;; under the terms of the GNU General Public License as published by the
;; Free Software Foundation, either version 3 of the License, or (at your
;; option) any later version.

;; XEmacs is distributed in the hope that it will be useful, but WITHOUT
;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
;; FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
;; for more details.

;; You should have received a copy of the GNU General Public License
;; along with XEmacs.  If not, see <http://www.gnu.org/licenses/>.

;;; Commentary:

;;; Code:

;; The variable is declared in mule-cmds.el; it's initialised here, to give
;; the language-specific code a chance to create its coding systems.

(setq posix-charset-to-coding-system-hash
      (loop
        ;; We want both normal and internal coding systems in order
        ;; to pick up coding system aliases.
        for coding-system in (coding-system-list 'every)
        with res = (make-hash-table :test #'equal)
        do
        (setq coding-system (symbol-name coding-system))
        (unless (or (string-match #r"\(-unix\|-mac\|-dos\)$" coding-system)
                    (string-match #r"^\(internal\|mswindows\)" coding-system))
          (puthash 
           (replace-in-string (downcase coding-system) "[^a-z0-9]" "")
           (coding-system-name (intern coding-system)) res))
        finally return res)

      ;; In a thoughtless act of cultural imperialism, move English, German
      ;; and Japanese to the front of language-info-alist to make start-up a
      ;; fraction faster for those languages.
      language-info-alist
      (cons (assoc "Japanese" language-info-alist)
	    (delete* "Japanese" language-info-alist :test #'equal :key #'car))
      language-info-alist 
      (cons (assoc "German" language-info-alist)
	    (delete* "German" language-info-alist :test #'equal :key #'car))
      language-info-alist
      (cons (assoc "English" language-info-alist)
	    (delete* "English" language-info-alist :test #'equal :key #'car))

      ;; Make Installation-string actually reflect the environment at
      ;; byte-compile time. (We can't necessarily decode it when version.el
      ;; is loaded, since not all the coding systems are available then.)
      Installation-string (if-boundp 'Installation-file-coding-system
			      (decode-coding-string
			       Installation-string
			       Installation-file-coding-system)
			    Installation-string)

      ;; This used to be here to convince the byte-compiler to encode the
      ;; output file using escape-quoted. This is no longer necessary, but
      ;; keeping it here avoids doing the eval-when-compile clause below
      ;; twice, which is a significant improvement.
      system-type (symbol-value (intern "\u0073ystem-type")))

;; When this file is being compiled, all the charsets have been loaded, so
;; we can construct the query-skip-chars-arg string correctly. 
(set-unicode-query-skip-chars-args
 (eval-when-compile 
   (when-fboundp 'map-charset-chars 
     (loop
       for charset in (charset-list)
       with skip-chars-string = ""
       do
       (block no-ucs-mapping
         (map-charset-chars
          #'(lambda (begin end)
              (loop
                while (and begin (>= end begin))
                do
                (when (= -1 (char-to-unicode begin))
                  (return-from no-ucs-mapping))
                (setq begin (int-to-char (1+ begin)))))
          charset)
         (setq skip-chars-string
               (concat skip-chars-string
                       (charset-skip-chars-string charset))))
       finally return skip-chars-string)))
 unicode-invalid-sequence-regexp-range
 (eval-when-compile
   (concat (loop
             for i from #x80 to #xFF
             collect (aref (decode-coding-string (int-char i)
                                                 'utf-8) 0)))))

;; At this point in the dump, all the charsets have been loaded. Now, load
;; their Unicode mappings.
(if load-unicode-tables-at-dump-time
    (let ((data-directory (expand-file-name "etc" source-directory)))
      (load-unicode-tables)))

;;; general-late.el ends here