Raymond Toy pushed to branch issue-158-darwin-pathnames at cmucl / cmucl
Commits:
-
d7a1099d
by Raymond Toy at 2022-12-21T09:35:37-08:00
4 changed files:
Changes:
| ... | ... | @@ -308,7 +308,8 @@ |
| 308 | 308 | ;;; in Unwind-Protects will get executed.
|
| 309 | 309 | |
| 310 | 310 | (declaim (special *lisp-initialization-functions*
|
| 311 | - *load-time-values*))
|
|
| 311 | + *load-time-values*
|
|
| 312 | + *enable-normalization*))
|
|
| 312 | 313 | |
| 313 | 314 | (eval-when (compile)
|
| 314 | 315 | (defmacro print-and-call (name)
|
| ... | ... | @@ -344,6 +345,7 @@ |
| 344 | 345 | (setf *type-system-initialized* nil)
|
| 345 | 346 | (setf *break-on-signals* nil)
|
| 346 | 347 | (setf unix::*filename-encoding* nil)
|
| 348 | + (setf *enable-normalization* nil)
|
|
| 347 | 349 | #+gengc (setf conditions::*handler-clusters* nil)
|
| 348 | 350 | (setq intl::*default-domain* "cmucl")
|
| 349 | 351 | (setq intl::*locale* "C")
|
| ... | ... | @@ -252,6 +252,24 @@ |
| 252 | 252 | ;;; This constructor is used to make an instance of the correct type
|
| 253 | 253 | ;;; from parsed arguments.
|
| 254 | 254 | |
| 255 | +(defvar *enable-normalization* nil)
|
|
| 256 | + |
|
| 257 | +(defun normalize-name (piece)
|
|
| 258 | + ;; Normalize Darwin pathnames by converting Hangul
|
|
| 259 | + ;; syllables to conjoining jamo, and converting the
|
|
| 260 | + ;; string to NFD form, but skipping over a range of
|
|
| 261 | + ;; characters.
|
|
| 262 | + (typecase piece
|
|
| 263 | + (string
|
|
| 264 | + (if *enable-normalization*
|
|
| 265 | + (decompose (unicode::decompose-hangul piece)
|
|
| 266 | + :compatibility nil
|
|
| 267 | + :darwinp t)
|
|
| 268 | + piece))
|
|
| 269 | + (t
|
|
| 270 | + ;; What should we do about lisp::pattern objects?
|
|
| 271 | + piece)))
|
|
| 272 | +
|
|
| 255 | 273 | (defun %make-pathname-object (host device directory name type version)
|
| 256 | 274 | (if (typep host 'logical-host)
|
| 257 | 275 | (flet ((upcasify (thing)
|
| ... | ... | @@ -271,24 +289,16 @@ |
| 271 | 289 | (upcasify name)
|
| 272 | 290 | (upcasify type)
|
| 273 | 291 | (upcasify version)))
|
| 274 | - #-darwin
|
|
| 292 | + #-(not nil)
|
|
| 275 | 293 | (%make-pathname host device directory name type version)
|
| 276 | - #+darwin
|
|
| 277 | - (flet ((normalize-name (string)
|
|
| 278 | - ;; Normalize Darwin pathnames by converting Hangul
|
|
| 279 | - ;; syllables to conjoining jamo, and converting the
|
|
| 280 | - ;; string to NFD form, but skipping over a range of
|
|
| 281 | - ;; characters.
|
|
| 282 | - (decompose (with-output-to-string (s)
|
|
| 283 | - (unicode::decompose-hangul string s))
|
|
| 284 | - :compatibility nil
|
|
| 285 | - :darwinp t)))
|
|
| 286 | - (%make-pathname host device
|
|
| 287 | - (list (car directory)
|
|
| 288 | - (mapcar #'normalize-name (cdr directory)))
|
|
| 289 | - (normalize-name name)
|
|
| 290 | - (normalize-name type)
|
|
| 291 | - version))))
|
|
| 294 | + #+(not nil)
|
|
| 295 | + (%make-pathname host device
|
|
| 296 | + (when directory
|
|
| 297 | + (list* (car directory)
|
|
| 298 | + (mapcar #'normalize-name (cdr directory))))
|
|
| 299 | + (normalize-name name)
|
|
| 300 | + (normalize-name type)
|
|
| 301 | + version))))
|
|
| 292 | 302 | |
| 293 | 303 | ;;; *LOGICAL-HOSTS* --internal.
|
| 294 | 304 | ;;;
|
| ... | ... | @@ -284,6 +284,16 @@ |
| 284 | 284 | (set-up-locale-external-format)
|
| 285 | 285 | ;; Set terminal encodings to :locale
|
| 286 | 286 | (set-system-external-format :locale)
|
| 287 | + ;; Get some unicode stuff needed for decomposing strings.
|
|
| 288 | + ;; This is needed on Darwin to normalize pathname
|
|
| 289 | + ;; objects, which needs this information. If we don't,
|
|
| 290 | + ;; we'll load the information at runtime when creating
|
|
| 291 | + ;; the path to "unidata.dat", which then calls decompose
|
|
| 292 | + ;; again, and so on.
|
|
| 293 | + (progn
|
|
| 294 | + (lisp::load-decomp)
|
|
| 295 | + (lisp::load-combining)
|
|
| 296 | + (setf *enable-normalization* t))
|
|
| 287 | 297 | (ext::process-command-strings process-command-line)
|
| 288 | 298 | (setf *editor-lisp-p* nil)
|
| 289 | 299 | (macrolet ((find-switch (name)
|
| ... | ... | @@ -513,11 +513,12 @@ |
| 513 | 513 | (read-vector lvec stm :endian-swap :network-order)
|
| 514 | 514 | (values split hvec mvec lvec))))
|
| 515 | 515 | (declare (ignorable #'read16 #'read32 #'read-ntrie))
|
| 516 | - (with-open-file (,stm *unidata-path* :direction :input
|
|
| 517 | - :element-type '(unsigned-byte 8))
|
|
| 518 | - (unless (unidata-locate ,stm ,locn)
|
|
| 519 | - (error (intl:gettext "No data in file.")))
|
|
| 520 | - ,@body)))))
|
|
| 516 | + (let (#+nil(lisp::*enable-normalization* nil))
|
|
| 517 | + (with-open-file (,stm *unidata-path* :direction :input
|
|
| 518 | + :element-type '(unsigned-byte 8))
|
|
| 519 | + (unless (unidata-locate ,stm ,locn)
|
|
| 520 | + (error (intl:gettext "No data in file.")))
|
|
| 521 | + ,@body))))))
|
|
| 521 | 522 | |
| 522 | 523 | (defloader load-range (stm 0)
|
| 523 | 524 | (let* ((n (read32 stm))
|