/[emacs]/emacs/lispref/objects.texi
ViewVC logotype

Diff of /emacs/lispref/objects.texi

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.39 by eliz, Sun Nov 2 06:29:58 2003 UTC revision 1.40 by teirllm, Mon Dec 1 03:57:00 2003 UTC
# Line 226  example, the character @kbd{A} is repres Line 226  example, the character @kbd{A} is repres
226  common to work with @emph{strings}, which are sequences composed of  common to work with @emph{strings}, which are sequences composed of
227  characters.  @xref{String Type}.  characters.  @xref{String Type}.
228    
229    Characters in strings, buffers, and files are currently limited to the    Characters in strings, buffers, and files are currently limited to
230  range of 0 to 524287---nineteen bits.  But not all values in that range  the range of 0 to 524287---nineteen bits.  But not all values in that
231  are valid character codes.  Codes 0 through 127 are @acronym{ASCII} codes; the  range are valid character codes.  Codes 0 through 127 are
232  rest are non-@acronym{ASCII} (@pxref{Non-ASCII Characters}).  Characters that represent  @acronym{ASCII} codes; the rest are non-@acronym{ASCII}
233  keyboard input have a much wider range, to encode modifier keys such as  (@pxref{Non-ASCII Characters}).  Characters that represent keyboard
234    input have a much wider range, to encode modifier keys such as
235  Control, Meta and Shift.  Control, Meta and Shift.
236    
237  @cindex read syntax for characters  @cindex read syntax for characters
# Line 375  possible a wide range of basic character Line 376  possible a wide range of basic character
376  @ifnottex  @ifnottex
377  2**7  2**7
378  @end ifnottex  @end ifnottex
379  bit attached to an @acronym{ASCII} character indicates a meta character; thus, the  bit attached to an @acronym{ASCII} character indicates a meta
380  meta characters that can fit in a string have codes in the range from  character; thus, the meta characters that can fit in a string have
381  128 to 255, and are the meta versions of the ordinary @acronym{ASCII}  codes in the range from 128 to 255, and are the meta versions of the
382  characters.  (In Emacs versions 18 and older, this convention was used  ordinary @acronym{ASCII} characters.  (In Emacs versions 18 and older,
383  for characters outside of strings as well.)  this convention was used for characters outside of strings as well.)
384    
385    The read syntax for meta characters uses @samp{\M-}.  For example,    The read syntax for meta characters uses @samp{\M-}.  For example,
386  @samp{?\M-A} stands for @kbd{M-A}.  You can use @samp{\M-} together with  @samp{?\M-A} stands for @kbd{M-A}.  You can use @samp{\M-} together with
# Line 416  significant in these prefixes.)  Thus, @ Line 417  significant in these prefixes.)  Thus, @
417  @kbd{Alt-Hyper-Meta-x}.  (Note that @samp{\s} with no following @samp{-}  @kbd{Alt-Hyper-Meta-x}.  (Note that @samp{\s} with no following @samp{-}
418  represents the space character.)  represents the space character.)
419  @tex  @tex
420  Numerically, the  Numerically, the bit values are @math{2^{22}} for alt, @math{2^{23}}
421  bit values are @math{2^{22}} for alt, @math{2^{23}} for super and @math{2^{24}} for hyper.  for super and @math{2^{24}} for hyper.
422  @end tex  @end tex
423  @ifnottex  @ifnottex
424  Numerically, the  Numerically, the
# Line 938  one character, @samp{a} with grave accen Line 939  one character, @samp{a} with grave accen
939  constant is just like backslash-newline; it does not contribute any  constant is just like backslash-newline; it does not contribute any
940  character to the string, but it does terminate the preceding hex escape.  character to the string, but it does terminate the preceding hex escape.
941    
942    Using a multibyte hex escape forces the string to multibyte.  You can    You can represent a unibyte non-@acronym{ASCII} character with its
943  represent a unibyte non-@acronym{ASCII} character with its character code,  character code, which must be in the range from 128 (0200 octal) to
944  which must be in the range from 128 (0200 octal) to 255 (0377 octal).  255 (0377 octal).  If you write all such character codes in octal and
945  This forces a unibyte string.  the string contains no other characters forcing it to be multibyte,
946    this produces a unibyte string.  However, using any hex escape in a
947    string (even for an @acronym{ASCII} character) forces the string to be
948    multibyte.
949    
950    @xref{Text Representations}, for more information about the two    @xref{Text Representations}, for more information about the two
951  text representations.  text representations.
# Line 963  distinguish case in @acronym{ASCII} cont Line 967  distinguish case in @acronym{ASCII} cont
967    
968    Properly speaking, strings cannot hold meta characters; but when a    Properly speaking, strings cannot hold meta characters; but when a
969  string is to be used as a key sequence, there is a special convention  string is to be used as a key sequence, there is a special convention
970  that provides a way to represent meta versions of @acronym{ASCII} characters in a  that provides a way to represent meta versions of @acronym{ASCII}
971  string.  If you use the @samp{\M-} syntax to indicate a meta character  characters in a string.  If you use the @samp{\M-} syntax to indicate
972  in a string constant, this sets the  a meta character in a string constant, this sets the
973  @tex  @tex
974  @math{2^{7}}  @math{2^{7}}
975  @end tex  @end tex
# Line 1082  constant that follows actually specifies Line 1086  constant that follows actually specifies
1086  as a bitmap---each ``character'' in the string contains 8 bits, which  as a bitmap---each ``character'' in the string contains 8 bits, which
1087  specify the next 8 elements of the bool-vector (1 stands for @code{t},  specify the next 8 elements of the bool-vector (1 stands for @code{t},
1088  and 0 for @code{nil}).  The least significant bits of the character  and 0 for @code{nil}).  The least significant bits of the character
1089  correspond to the lowest indices in the bool-vector.  If the length is not a  correspond to the lowest indices in the bool-vector.
 multiple of 8, the printed representation shows extra elements, but  
 these extras really make no difference.  
1090    
1091  @example  @example
1092  (make-bool-vector 3 t)  (make-bool-vector 3 t)
1093       @result{} #&3"\007"       @result{} #&3"^G"
1094  (make-bool-vector 3 nil)  (make-bool-vector 3 nil)
1095       @result{} #&3"\0"       @result{} #&3"^@@"
1096  ;; @r{These are equal since only the first 3 bits are used.}  @end example
1097    
1098    @noindent
1099    These results make sense, because the binary code for @samp{C-g} is
1100    111 and @samp{C-@@} is the character with code 0.
1101    
1102      If the length is not a multiple of 8, the printed representation
1103    shows extra elements, but these extras really make no difference.  For
1104    instance, in the next example, the two bool-vectors are equal, because
1105    only the first 3 bits are used:
1106    
1107    @example
1108  (equal #&3"\377" #&3"\007")  (equal #&3"\377" #&3"\007")
1109       @result{} t       @result{} t
1110  @end example  @end example
# Line 1875  always true. Line 1888  always true.
1888  @end example  @end example
1889    
1890  Comparison of strings is case-sensitive, but does not take account of  Comparison of strings is case-sensitive, but does not take account of
1891  text properties---it compares only the characters in the strings.  text properties---it compares only the characters in the strings.  For
1892  A unibyte string never equals a multibyte string unless the  technical reasons, a unibyte string and a multibyte string are
1893  contents are entirely @acronym{ASCII} (@pxref{Text Representations}).  @code{equal} if and only if they contain the same sequence of
1894    character codes and all these codes are either in the range 0 through
1895    127 (@acronym{ASCII}) or 160 through 255 (@code{eight-bit-graphic}).
1896    (@pxref{Text Representations}).
1897    
1898  @example  @example
1899  @group  @group

Legend:
Removed from v.1.39  
changed lines
  Added in v.1.40

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26