Common Lisp the Language, 2nd Edition


next up previous contents index
Next: Character Conversions Up: Characters Previous: Predicates on Characters

13.3. Character Construction and Selection

These functions may be used to extract attributes of a character and to construct new characters.


[Function]
char-code char

The argument char must be a character object. char-code returns the code attribute of the character object; this will be a non-negative integer less than the (normal) value of the variable char-code-limit.

change_begin
This is usually what you need in order to treat a character as an index into a vector. The length of the vector should then be equal to char-code-limit. Be careful how you initialize this vector; remember that you cannot necessarily expect all non-negative integers less than char-code-limit to be valid character codes.
change_end

old_change_begin

[Function]
char-bits char

The argument char must be a character object. char-bits returns the bits attribute of the character object; this will be a non-negative integer less than the (normal) value of the variable char-bits-limit.
old_change_end

change_begin
X3J13 voted in March 1989 (CHARACTER-PROPOSAL)   to eliminate char-bits.
change_end

old_change_begin

[Function]
char-font char

The argument char must be a character object. char-font returns the font attribute of the character object; this will be a non-negative integer less than the (normal) value of the variable char-font-limit.
old_change_end

change_begin
X3J13 voted in March 1989 (CHARACTER-PROPOSAL)   to eliminate char-font.

The references to the ``normal'' values of the ``variables'' char-code-limit, char-bits-limit, and char-font-limit in the descriptions of char-code, char-bits, and char-font were an oversight on my part. Early in the design of Common Lisp they were indeed variables, but they are at present defined to be constants, and their values therefore are always normal and should not change. But this point is now moot.
change_end


[Function]
code-char code &optional (bits 0) (font 0)

old_change_begin
All three arguments must be non-negative integers. If it is possible in the implementation to construct a character object whose code attribute is code, whose bits attribute is bits, and whose font attribute is font, then such an object is returned; otherwise nil is returned.

For any integers c, b, and f, if (code-char c b f) is not nil then

(char-code (code-char c b f)) => c 
(char-bits (code-char c b f)) => b 
(char-font (code-char c b f)) => f

If the font and bits attributes of a character object c are zero, then it is the case that

(char= (code-char (char-code c)) c)

is true.
old_change_end

change_begin
X3J13 voted in March 1989 (CHARACTER-PROPOSAL)   to eliminate the bits and font arguments from the specification of code-char.
change_end

old_change_begin

[Function]
make-char char &optional (bits 0) (font 0)

The argument char must be a character, and bits and font must be non-negative integers. If it is possible in the implementation to construct a character object whose code attribute is the same as the code attribute of char, whose bits attribute is bits, and whose font attribute is font, then such an object is returned; otherwise nil is returned.

If bits and font are zero, then make-char cannot fail. This implies that for every character object one can ``turn off'' its bits and font attributes.
old_change_end

change_begin
X3J13 voted in March 1989 (CHARACTER-PROPOSAL)   to eliminate make-char.
change_end



next up previous contents index
Next: Character Conversions Up: Characters Previous: Predicates on Characters


[email protected]mu.edu