Raymond Toy pushed to branch issue-316-support-roundtrip-char-casing at cmucl / cmucl
Commits: 6c1f62ca by Raymond Toy at 2024-05-30T07:45:58-07:00 Fix comments/docstrings and replace "case table" with "case mapping".
- - - - - 2b8d6de1 by Raymond Toy at 2024-05-30T07:47:22-07:00 Rename create-case-table.lisp to create-case-mapping.lisp.
- - - - - 38549cf2 by Raymond Toy at 2024-05-30T14:42:43-07:00 Rename case-table to case-mapping for consistency
- - - - - 2f2f5ccb by Raymond Toy at 2024-05-30T14:43:07-07:00 Regenerated from latest create-case-mapping.lisp.
- - - - - 1b47d323 by Raymond Toy at 2024-05-30T14:43:26-07:00 Update due to changed docstrings.
- - - - -
4 changed files:
- src/code/char.lisp - src/i18n/locale/cmucl.pot - src/lisp/case-mapping.c - src/tools/create-case-table.lisp → src/tools/create-case-mapping.lisp
Changes:
===================================== src/code/char.lisp ===================================== @@ -63,15 +63,15 @@ (defconstant +ascii-limit+ 127 "A character code strictly larger than this is handled using Unicode - rules.") +c rules.")
;; Table of mappings for upper case and lower case letters. See ;; src/lisp/case-mapping.c. (alien:def-alien-variable "case_mapping" (alien:array (alien:* (alien:array c-call:unsigned-int 64)) 1024))
-;; Each entry in the case table consists of the code for either an -;; upper case or lower case character code. +;; Each entry in the case mapping table consists of the code for +;; either an upper case or lower case character code. (defconstant +upper-case-entry+ (byte 16 0)) (defconstant +lower-case-entry+ (byte 16 16))
@@ -82,9 +82,9 @@ (declaim (inline case-mapping-entry))
(defun case-mapping-entry (code) - "For the character code, CODE, return 0 or the 32-bit value from the - case table. A value of 0 means there was no case mapping (neither - upper nor lower case)." + "For the character code, CODE, the 32-bit value from the + case mapping table that indicates the delta between CODE and the + corresponding upper or lower case character for CODE." (declare (type (integer 0 (#.char-code-limit)) code) (optimize (speed 3) (safety 0))) (let* ((index1 (ldb (byte (- 16 +stage2-size+) +stage2-size+)
===================================== src/i18n/locale/cmucl.pot ===================================== @@ -5446,7 +5446,7 @@ msgstr "" #: src/code/char.lisp msgid "" "A character code strictly larger than this is handled using Unicode\n" -" rules." +"c rules." msgstr ""
#: src/code/char.lisp @@ -5457,9 +5457,9 @@ msgstr ""
#: src/code/char.lisp msgid "" -"For the character code, CODE, return 0 or the 32-bit value from the\n" -" case table. A value of 0 means there was no case mapping (neither\n" -" upper nor lower case)." +"For the character code, CODE, the 32-bit value from the\n" +" case mapping table that indicates the delta between CODE and the\n" +" corresponding upper or lower case character for CODE." msgstr ""
#: src/code/char.lisp
===================================== src/lisp/case-mapping.c ===================================== @@ -1,8 +1,8 @@ /* * DO NOT EDIT. * - * This was generated by (BUILD-CASE-TABLE :stage2-size 6) in - * src/tools/create-case-table.c. + * This was generated by (BUILD-CASE-MAPPING-TABLE :STAGE2-SIZE 6) in + * src/tools/create-case-mapping.lisp. */
#include <stdint.h>
===================================== src/tools/create-case-table.lisp → src/tools/create-case-mapping.lisp ===================================== @@ -18,7 +18,7 @@ ;; Each element of this table is 32-bits long. The low 16 bits ;; contains the mapping of C to the corresponding upper case letter. ;; The high 16 bits maps C to the corresponding lower case letter. -(defun compute-case-table (stage2-size) +(defun compute-case-mapping-table (stage2-size) (let ((table (make-array (ash 1 (- 16 stage2-size))))) (dotimes (i (length table)) (setf (aref table i) (make-array (ash 1 stage2-size) @@ -93,7 +93,7 @@ (sort (loop for stage2-size from 1 to 15 collect (list stage2-size (print-table-stats - (compute-case-table stage2-size) + (compute-case-mapping-table stage2-size) stage2-size))) #'< :key #'second)))) @@ -119,15 +119,15 @@ (format stream "~%};~%"))
;; Print the case table TABLE to a file named by PATHNAME. -(defun dump-case-table (pathname table stage2-size) +(defun dump-case-mapping-table (pathname table stage2-size) (with-open-file (stream pathname :direction :output :if-exists :supersede) (format stream "~ /* * DO NOT EDIT. * - * This was generated by (BUILD-CASE-TABLE :STAGE2-SIZE ~D) in - * src/tools/create-case-table.c. + * This was generated by (BUILD-CASE-MAPPING-TABLE :STAGE2-SIZE ~D) in + * src/tools/create-case-mapping.lisp. */~2%" stage2-size) (format stream "#include <stdint.h>~%") @@ -156,6 +156,6 @@ (format stream "};~%") (format t "Wrote ~S~%" (namestring stream))))
-(defun build-case-table (&key (stage2-size 6) (pathname "./src/lisp/case-mapping.c")) - (let ((table (compute-case-table stage2-size))) - (dump-case-table pathname table stage2-size))) +(defun build-case-mapping-table (&key (stage2-size 6) (pathname "./src/lisp/case-mapping.c")) + (let ((table (compute-case-mapping-table stage2-size))) + (dump-case-mapping-table pathname table stage2-size)))
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/compare/3c52b57623dcd4286798313...