comparison man/lispref/objects.texi @ 1549:bc9eadea35cf

[xemacs-hg @ 2003-06-30 09:30:58 by stephent] doc improvements <87isqn9aly.fsf@tleepslib.sk.tsukuba.ac.jp> <8765mo9cmp.fsf@tleepslib.sk.tsukuba.ac.jp>
author stephent
date Mon, 30 Jun 2003 09:31:01 +0000
parents b05e2a249757
children 84ee3ca77e7f
comparison
equal deleted inserted replaced
1548:5365af805d4c 1549:bc9eadea35cf
611 @cindex @samp{?} in character constant 611 @cindex @samp{?} in character constant
612 @cindex question mark in character constant 612 @cindex question mark in character constant
613 @cindex @samp{\} in character constant 613 @cindex @samp{\} in character constant
614 @cindex backslash in character constant 614 @cindex backslash in character constant
615 @cindex octal character code 615 @cindex octal character code
616 Finally, the most general read syntax consists of a question mark 616 @cindex hexadecimal character code
617 Finally, there are two read syntaxes involving character codes.
618 It is not possible to represent multibyte or wide characters in this
619 way; the permissible range of codes is from 0 to 255 (@emph{i.e.},
620 @samp{0377} octal or @samp{0xFF} hexadecimal). If you wish to convert
621 code points to other characters, you must use the @samp{make-char} or
622 @samp{unicode-to-char} primitives in Mule. (Non-Mule XEmacsen cannot
623 represent codes out of that range at all, although you can set the font
624 to a registry other than ISO 8859/1 to get the appearance of a greater
625 range of characters.) Although these syntaxes can represent any
626 @sc{ascii} or Latin-1 character, they are preferred only when the
627 precise integral value is more important than the @sc{ascii}
628 representation.
629
630 The first consists of a question mark
617 followed by a backslash and the character code in octal (up to three 631 followed by a backslash and the character code in octal (up to three
618 octal digits); thus, @samp{?\101} for the character @kbd{A}, 632 octal digits); thus, @samp{?\101} for the character @kbd{A},
619 @samp{?\001} for the character @kbd{C-a}, and @code{?\002} for the 633 @samp{?\001} for the character @kbd{C-a}, and @code{?\002} for the
620 character @kbd{C-b}. Although this syntax can represent any @sc{ascii} 634 character @kbd{C-b}.
621 character, it is preferred only when the precise octal value is more 635
622 important than the @sc{ascii} representation. 636 The second consists of a question mark followed by a backslash, the
637 character @samp{x}, and the character code in hexadecimal (up to two
638 hexadecimal digits); thus, @samp{?\x41} for the character @kbd{A},
639 @samp{?\x1} for the character @kbd{C-a}, and @code{?\x2} for the
640 character @kbd{C-b}.
641
642 In both cases, the reader will finalize the character when a non-digit
643 is encountered or the maximum length of a character code is reached. It
644 then starts reading the next token.
623 645
624 @example 646 @example
625 @group 647 @group
626 ;; @r{Under XEmacs 20:} 648 ;; @r{Under XEmacs 20:}
627 ?\012 @result{} ?\n ?\n @result{} ?\n ?\C-j @result{} ?\n 649 ?\012 @result{} ?\n ?\n @result{} ?\n ?\C-j @result{} ?\n
628 ?\101 @result{} ?A ?A @result{} ?A 650 ?\101 @result{} ?A ?A @result{} ?A ?\x0A @result{} ?\n
651 ?\x41 @result{} ?A '(?\xAZ) @result{} '(?\n Z) '(?\0123) @result{} (?\n 3)
629 @end group 652 @end group
630 @group 653 @group
631 ;; @r{Under XEmacs 19:} 654 ;; @r{Under XEmacs 19:}
632 ?\012 @result{} 10 ?\n @result{} 10 ?\C-j @result{} 10 655 ?\012 @result{} 10 ?\n @result{} 10 ?\C-j @result{} 10
633 ?\101 @result{} 65 ?A @result{} 65 656 ?\101 @result{} 65 ?A @result{} 65
657 ;; ?\x41 @r{is a syntax error.}
634 @end group 658 @end group
635 @end example 659 @end example
636 660
637 A backslash is allowed, and harmless, preceding any character without 661 A backslash is allowed, and harmless, preceding any character without
638 a special escape meaning; thus, @samp{?\+} is equivalent to @samp{?+}. 662 a special escape meaning; thus, @samp{?\+} is equivalent to @samp{?+}.