Changeset 6128


Ignore:
Timestamp:
Apr 4, 2007, 3:51:47 AM (12 years ago)
Author:
gb
Message:

add BOM-ENCODING; encoded-c-string stuff.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/objc-gf/ccl/level-1/l1-unicode.lisp

    r5571 r6128  
    6363 
    6464  ;; Sets one or more units in memory at the address denoted by
    65   ;; the pointer and idx arguments and returns (+ idx number of
     65  ;; the pointer and index arguments and returns (+ idx number of
    6666  ;; units written to memory), else returns NIL if any character
    6767  ;; can't be encoded.
     
    104104  ;; in this encoding ? (NIL if a BOM can't be encoded.)
    105105  (bom-encoding nil)
     106  ;; How is #\NUL encoded, as a sequence of octets ?  (Typically, as a minimal-
     107  ;; length sequenve of 0s, but there are exceptions.)
     108  (nul-encoding #(0))
    106109  )
    107110
     
    32743277             (setq i nexti nchars (1+ nchars)))))))
    32753278    :literal-char-code-limit #x10000
     3279    :nul-encoding #(0 0)
    32763280    )
    32773281
     
    34363440           (setq i nexti nchars (1+ nchars)))))))
    34373441  :literal-char-code-limit #x10000
     3442  :nul-encoding #(0 0)
    34383443  )
    34393444
     
    36503655  #+little-endian-target :utf-16be
    36513656  :bom-encoding #+big-endian-target #(#xfe #xff) #+little-endian-target #(#xff fe)
     3657  :nul-encoding #(0 0)
    36523658  )
    36533659
     
    37703776     (values (floor noctets 2) (+ start noctets))))
    37713777  :literal-char-code-limit #x10000
     3778  :nul-encoding #(0 0)
    37723779  )
    37733780
     
    38673874     (values (floor noctets 2) (+ start noctets))))
    38683875  :literal-char-code-limit #x10000
     3876  :nul-encoding #(0 0)
    38693877  )
    38703878
     
    39893997  #+big-endian-target :ucs-2le
    39903998  #+little-endian-target :ucs-2be
     3999  :nul-encoding #(0 0)
    39914000  )
    39924001
     
    41704179     (values (floor noctets 4) (+ start noctets))))
    41714180  :literal-char-code-limit #x110000
     4181  :nul-encoding #(0 0 0 0)
    41724182  )
    41734183
     
    42664276     (values (floor noctets 4) (+ start noctets))))
    42674277  :literal-char-code-limit #x110000
     4278  :nul-encoding #(0 0 0 0) 
    42684279  )
    42694280
     
    43894400  #+little-endian-target :utf-32be
    43904401  :bom-encoding #+big-endian-target #(#x00 #x00 #xfe #xff) #+little-endian-target #(#xff #xfe #x00 #x00)
    4391  
     4402  :nul-encoding #(0 0 0 0) 
    43924403  )
    43934404
     
    44234434(defvar *cr-newline-string* (make-string 1 :initial-element #\Return))
    44244435(defvar *crlf-newline-string* (make-array 2 :element-type 'character :initial-contents '(#\Return #\Linefeed)))
     4436(defvar *nul-string (make-string 1 :initial-element #\Nul))
    44254437
    44264438(defun string-size-in-octets (string &key
     
    45274539        (values vector vector-offset)))))
    45284540
     4541
     4542
    45294543(defun count-characters-in-octet-vector (vector &key
    45304544                                                (start 0)
     
    45784592                                     
    45794593(defun cstring-encoded-length-in-bytes (encoding string start end)
    4580   (+ 1                             ; NULL terminator
     4594  (+ (length (character-encoding-nul-encoding encoding))                             ; NUL terminator
    45814595     (funcall (character-encoding-octets-in-string-function encoding)
    45824596              string
Note: See TracChangeset for help on using the changeset viewer.