Mercurial > hg > xemacs-beta
comparison man/lispref/objects.texi @ 398:74fd4e045ea6 r21-2-29
Import from CVS: tag r21-2-29
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:13:30 +0200 |
parents | 7d59cb494b73 |
children | 697ef44129c6 |
comparison
equal
deleted
inserted
replaced
397:f4aeb21a5bad | 398:74fd4e045ea6 |
---|---|
341 | 341 |
342 @xref{Numbers}, for more information. | 342 @xref{Numbers}, for more information. |
343 | 343 |
344 @node Character Type | 344 @node Character Type |
345 @subsection Character Type | 345 @subsection Character Type |
346 @cindex @sc{ASCII} character codes | 346 @cindex @sc{ascii} character codes |
347 @cindex char-int confoundance disease | 347 @cindex char-int confoundance disease |
348 | 348 |
349 In XEmacs version 19, and in all versions of FSF GNU Emacs, a | 349 In XEmacs version 19, and in all versions of FSF GNU Emacs, a |
350 @dfn{character} in XEmacs Lisp is nothing more than an integer. | 350 @dfn{character} in XEmacs Lisp is nothing more than an integer. |
351 This is yet another holdover from XEmacs Lisp's derivation from | 351 This is yet another holdover from XEmacs Lisp's derivation from |
352 vintage-1980 Lisps; modern versions of Lisp consider this equivalence | 352 vintage-1980 Lisps; modern versions of Lisp consider this equivalence |
353 a bad idea, and have separate character types. In XEmacs version 20, | 353 a bad idea, and have separate character types. In XEmacs version 20, |
354 the modern convention is followed, and characters are their own | 354 the modern convention is followed, and characters are their own |
355 primitive types. (This change was necessary in order for @sc{MULE}, | 355 primitive types. (This change was necessary in order for @sc{mule}, |
356 i.e. Asian-language, support to be correctly implemented.) | 356 i.e. Asian-language, support to be correctly implemented.) |
357 | 357 |
358 Even in XEmacs version 20, remnants of the equivalence between | 358 Even in XEmacs version 20, remnants of the equivalence between |
359 characters and integers still exist; this is termed the @dfn{char-int | 359 characters and integers still exist; this is termed the @dfn{char-int |
360 confoundance disease}. In particular, many functions such as @code{eq}, | 360 confoundance disease}. In particular, many functions such as @code{eq}, |
361 @code{equal}, and @code{memq} have equivalent functions (@code{old-eq}, | 361 @code{equal}, and @code{memq} have equivalent functions (@code{old-eq}, |
362 @code{old-equal}, @code{old-memq}, etc.) that pretend like characters | 362 @code{old-equal}, @code{old-memq}, etc.) that pretend like characters |
363 are integers are the same. Byte code compiled under any version 19 | 363 are integers are the same. Byte code compiled under any version 19 |
364 Emacs will have all such functions mapped to their @code{old-} equivalents | 364 Emacs will have all such functions mapped to their @code{old-} equivalents |
365 when the byte code is read into XEmacs 20. This is to preserve | 365 when the byte code is read into XEmacs 20. This is to preserve |
366 compatibility -- Emacs 19 converts all constant characters to the equivalent | 366 compatibility---Emacs 19 converts all constant characters to the equivalent |
367 integer during byte-compilation, and thus there is no other way to preserve | 367 integer during byte-compilation, and thus there is no other way to preserve |
368 byte-code compatibility even if the code has specifically been written | 368 byte-code compatibility even if the code has specifically been written |
369 with the distinction between characters and integers in mind. | 369 with the distinction between characters and integers in mind. |
370 | 370 |
371 Every character has an equivalent integer, called the @dfn{character | 371 Every character has an equivalent integer, called the @dfn{character |
372 code}. For example, the character @kbd{A} is represented as the | 372 code}. For example, the character @kbd{A} is represented as the |
373 @w{integer 65}, following the standard @sc{ASCII} representation of | 373 @w{integer 65}, following the standard @sc{ascii} representation of |
374 characters. If XEmacs was not compiled with @sc{MULE} support, the | 374 characters. If XEmacs was not compiled with @sc{mule} support, the |
375 range of this integer will always be 0 to 255 -- eight bits, or one | 375 range of this integer will always be 0 to 255---eight bits, or one |
376 byte. (Integers outside this range are accepted but silently truncated; | 376 byte. (Integers outside this range are accepted but silently truncated; |
377 however, you should most decidedly @emph{not} rely on this, because it | 377 however, you should most decidedly @emph{not} rely on this, because it |
378 will not work under XEmacs with @sc{MULE} support.) When @sc{MULE} | 378 will not work under XEmacs with @sc{mule} support.) When @sc{mule} |
379 support is present, the range of character codes is much | 379 support is present, the range of character codes is much |
380 larger. (Currently, 19 bits are used.) | 380 larger. (Currently, 19 bits are used.) |
381 | 381 |
382 FSF GNU Emacs uses kludgy character codes above 255 to represent | 382 FSF GNU Emacs uses kludgy character codes above 255 to represent |
383 keyboard input of @sc{ASCII} characters in combination with certain | 383 keyboard input of @sc{ascii} characters in combination with certain |
384 modifiers. XEmacs does not use this (a more general mechanism is | 384 modifiers. XEmacs does not use this (a more general mechanism is |
385 used that does not distinguish between @sc{ASCII} keys and other | 385 used that does not distinguish between @sc{ascii} keys and other |
386 keys), so you will never find character codes above 255 in a | 386 keys), so you will never find character codes above 255 in a |
387 non-@sc{MULE} XEmacs. | 387 non-@sc{mule} XEmacs. |
388 | 388 |
389 Individual characters are not often used in programs. It is far more | 389 Individual characters are not often used in programs. It is far more |
390 common to work with @emph{strings}, which are sequences composed of | 390 common to work with @emph{strings}, which are sequences composed of |
391 characters. @xref{String Type}. | 391 characters. @xref{String Type}. |
392 | 392 |
504 character code). For example, @samp{?\M-A} stands for the character | 504 character code). For example, @samp{?\M-A} stands for the character |
505 with character code 193, or 128 plus 65. You should @emph{not} use this | 505 with character code 193, or 128 plus 65. You should @emph{not} use this |
506 syntax in your programs. It is a holdover of yet another confoundance | 506 syntax in your programs. It is a holdover of yet another confoundance |
507 disease from earlier Emacsen. (This was used to represent keyboard input | 507 disease from earlier Emacsen. (This was used to represent keyboard input |
508 with the @key{META} key set, thus the @samp{M}; however, it conflicts | 508 with the @key{META} key set, thus the @samp{M}; however, it conflicts |
509 with the legitimate @sc{ISO}-8859-1 interpretation of the character code. | 509 with the legitimate @sc{iso}-8859-1 interpretation of the character code. |
510 For example, character code 193 is a lowercase @samp{a} with an acute | 510 For example, character code 193 is a lowercase @samp{a} with an acute |
511 accent, in @sc{ISO}-8859-1.) | 511 accent, in @sc{iso}-8859-1.) |
512 | 512 |
513 @ignore @c None of this crap applies to XEmacs. | 513 @ignore @c None of this crap applies to XEmacs. |
514 For use in strings and buffers, you are limited to the control | 514 For use in strings and buffers, you are limited to the control |
515 characters that exist in @sc{ASCII}, but for keyboard input purposes, | 515 characters that exist in @sc{ascii}, but for keyboard input purposes, |
516 you can turn any character into a control character with @samp{C-}. The | 516 you can turn any character into a control character with @samp{C-}. The |
517 character codes for these non-@sc{ASCII} control characters include the | 517 character codes for these non-@sc{ascii} control characters include the |
518 @iftex | 518 @iftex |
519 $2^{26}$ | 519 $2^{26}$ |
520 @end iftex | 520 @end iftex |
521 @ifinfo | 521 @ifinfo |
522 2**26 | 522 2**26 |
615 @cindex octal character code | 615 @cindex octal character code |
616 Finally, the most general read syntax consists of a question mark | 616 Finally, the most general read syntax consists of a question mark |
617 followed by a backslash and the character code in octal (up to three | 617 followed by a backslash and the character code in octal (up to three |
618 octal digits); thus, @samp{?\101} for the character @kbd{A}, | 618 octal digits); thus, @samp{?\101} for the character @kbd{A}, |
619 @samp{?\001} for the character @kbd{C-a}, and @code{?\002} for the | 619 @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} | 620 character @kbd{C-b}. Although this syntax can represent any @sc{ascii} |
621 character, it is preferred only when the precise octal value is more | 621 character, it is preferred only when the precise octal value is more |
622 important than the @sc{ASCII} representation. | 622 important than the @sc{ascii} representation. |
623 | 623 |
624 @example | 624 @example |
625 @group | 625 @group |
626 ;; @r{Under XEmacs 20:} | 626 ;; @r{Under XEmacs 20:} |
627 ?\012 @result{} ?\n ?\n @result{} ?\n ?\C-j @result{} ?\n | 627 ?\012 @result{} ?\n ?\n @result{} ?\n ?\C-j @result{} ?\n |
1519 A @dfn{device} represents a single display on which frames exist. | 1519 A @dfn{device} represents a single display on which frames exist. |
1520 Normally, there is only one device object, but there may be more | 1520 Normally, there is only one device object, but there may be more |
1521 than one if XEmacs is being run on a multi-headed display (e.g. an | 1521 than one if XEmacs is being run on a multi-headed display (e.g. an |
1522 X server with attached color and mono screens) or if XEmacs is | 1522 X server with attached color and mono screens) or if XEmacs is |
1523 simultaneously driving frames attached to different consoles, e.g. | 1523 simultaneously driving frames attached to different consoles, e.g. |
1524 an X display and a @sc{TTY} connection. | 1524 an X display and a @sc{tty} connection. |
1525 | 1525 |
1526 Devices do not have a read syntax. They print in hash notation, | 1526 Devices do not have a read syntax. They print in hash notation, |
1527 giving the device's type, connection name, and a unique number assigned | 1527 giving the device's type, connection name, and a unique number assigned |
1528 at the time the device was created. | 1528 at the time the device was created. |
1529 | 1529 |
1542 | 1542 |
1543 A @dfn{console} represents a single keyboard to which devices | 1543 A @dfn{console} represents a single keyboard to which devices |
1544 (i.e. displays on which frames exist) are connected. Normally, there is | 1544 (i.e. displays on which frames exist) are connected. Normally, there is |
1545 only one console object, but there may be more than one if XEmacs is | 1545 only one console object, but there may be more than one if XEmacs is |
1546 simultaneously driving frames attached to different X servers and/or | 1546 simultaneously driving frames attached to different X servers and/or |
1547 @sc{TTY} connections. (XEmacs is capable of driving multiple X and | 1547 @sc{tty} connections. (XEmacs is capable of driving multiple X and |
1548 @sc{TTY} connections at the same time, and provides a robust mechanism | 1548 @sc{tty} connections at the same time, and provides a robust mechanism |
1549 for handling the differing display capabilities of such heterogeneous | 1549 for handling the differing display capabilities of such heterogeneous |
1550 environments. A buffer with embedded glyphs and multiple fonts and | 1550 environments. A buffer with embedded glyphs and multiple fonts and |
1551 colors, for example, will display reasonably if it simultaneously | 1551 colors, for example, will display reasonably if it simultaneously |
1552 appears on a frame on a color X display, a frame on a mono X display, | 1552 appears on a frame on a color X display, a frame on a mono X display, |
1553 and a frame on a @sc{TTY} connection.) | 1553 and a frame on a @sc{tty} connection.) |
1554 | 1554 |
1555 Consoles do not have a read syntax. They print in hash notation, | 1555 Consoles do not have a read syntax. They print in hash notation, |
1556 giving the console's type, connection name, and a unique number assigned | 1556 giving the console's type, connection name, and a unique number assigned |
1557 at the time the console was created. | 1557 at the time the console was created. |
1558 | 1558 |