(unless (or (<= #xF900 code #xFA2D) (<= #xFA30 code #xFA6A)
(<= #xFA70 code #xFAD9) (<= #x2F800 code #x2FA1D))
; Transform the code so that it fits in 16 bits. In
- ; Unicode 3.1 the following ranges are used.
+ ; Unicode 5.1 the following ranges are used.
; 0x00000..0x04DFF >>12= 0x00..0x04 -> 0x0..0x4
- ; 0x0A000..0x0A4FF >>12= 0x0A -> 0x5
+ ; 0x0A000..0x0AAFF >>12= 0x0A -> 0x5
; 0x0F900..0x0FFFF >>12= 0x0F -> 0x6
- ; 0x10300..0x104FF >>12= 0x10 -> 0x7
- ; 0x1D000..0x1D7DD >>12= 0x1D -> 0x8
- ; 0x2F800..0x2FAFF >>12= 0x2F -> 0x9
- ; 0xE0000..0xE00FF >>12= 0xE0 -> 0xA
+ ; 0x10000..0x10A58 >>12= 0x10 -> 0x7
+ ; 0x12000..0x12473 >>12= 0x12 -> 0x8
+ ; 0x1D000..0x1D7FF >>12= 0x1D -> 0x9
+ ; 0x1F000..0x1F093 >>12= 0x1F -> 0xA
+ ; 0x2F800..0x2FAFF >>12= 0x2F -> 0xB
+ ; 0xE0000..0xE00FF >>12= 0xE0 -> 0xC
(flet ((transform (x)
(dpb
(case (ash x -12)
(#x0A 5)
(#x0F 6)
(#x10 7)
- (#x1D 8)
- (#x2F 9)
- (#xE0 #xA)
+ (#x12 8)
+ (#x1D 9)
+ (#x1F #xA)
+ (#x2F #xB)
+ (#xE0 #xC)
(t (error "Update the transform function for 0x~5,'0X" x))
)
(byte 8 12)
;; Output the tables.
(with-open-file (ostream outputfile :direction :output
#+UNICODE :external-format #+UNICODE charset:ascii)
+ (format ostream "/* DO NOT EDIT! GENERATED AUTOMATICALLY! */~%")
(format ostream "/*~%")
(format ostream " * ~A~%" (file-namestring outputfile))
(format ostream " *~%")
(incf i (length (unicode-char-word-indices uc)))
) )
(format ostream "};~%")
- (format ostream "static const struct { uint16_t code; uint16_t name; } unicode_name_to_code[~D] = {~%"
+ (format ostream "static const struct { uint16_t code; uint32_t name:24; }~%")
+ (format ostream "#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)~%__attribute__((__packed__))~%#endif~%")
+ (format ostream "unicode_name_to_code[~D] = {~%"
(length all-chars)
)
(dolist (uc all-chars)
(format ostream "~%")
)
(format ostream "};~%")
- (format ostream "static const struct { uint16_t code; uint16_t name; } unicode_code_to_name[~D] = {~%"
+ (format ostream "static const struct { uint16_t code; uint32_t name:24; }~%")
+ (format ostream "#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)~%__attribute__((__packed__))~%#endif~%")
+ (format ostream "unicode_code_to_name[~D] = {~%"
(length all-chars)
)
(dolist (uc (sort (copy-list all-chars) #'< :key #'unicode-char-code))