comparison src/data.c @ 104:cf808b4c4290 r20-1b4

Import from CVS: tag r20-1b4
author cvs
date Mon, 13 Aug 2007 09:16:51 +0200
parents 131b0175ea99
children 360340f9fd5f
comparison
equal deleted inserted replaced
103:30eda07fe280 104:cf808b4c4290
225 225
226 Special kludge: A character is considered `old-eq' to its equivalent integer 226 Special kludge: A character is considered `old-eq' to its equivalent integer
227 even though they are not the same object and are in fact of different 227 even though they are not the same object and are in fact of different
228 types. This is ABSOLUTELY AND UTTERLY HORRENDOUS but is necessary to 228 types. This is ABSOLUTELY AND UTTERLY HORRENDOUS but is necessary to
229 preserve byte-code compatibility with v19. This kludge is known as the 229 preserve byte-code compatibility with v19. This kludge is known as the
230 \"char-int confoundance disease\" and appears in a number of other 230 \"char-to-int confoundance disease\" and appears in a number of other
231 functions with `old-foo' equivalents. 231 functions with `old-foo' equivalents.
232 232
233 Do not use this function! 233 Do not use this function!
234 */ 234 */
235 (obj1, obj2)) 235 (obj1, obj2))
394 394
395 DEFUN ("characterp", Fcharacterp, 1, 1, 0, /* 395 DEFUN ("characterp", Fcharacterp, 1, 1, 0, /*
396 t if OBJECT is a character. 396 t if OBJECT is a character.
397 Unlike in FSF Emacs, a character is its own primitive type. 397 Unlike in FSF Emacs, a character is its own primitive type.
398 Any character can be converted into an equivalent integer using 398 Any character can be converted into an equivalent integer using
399 `char-int'. To convert the other way, use `int-char'; however, 399 `char-to-int'. To convert the other way, use `int-to-char'; however,
400 only some integers can be converted into characters. Such an integer 400 only some integers can be converted into characters. Such an integer
401 is called a `char-int'; see `char-int-p'. 401 is called a `char-to-int'; see `char-int-p'.
402 402
403 Some functions that work on integers (e.g. the comparison functions 403 Some functions that work on integers (e.g. the comparison functions
404 <, <=, =, /=, etc. and the arithmetic functions +, -, *, etc.) 404 <, <=, =, /=, etc. and the arithmetic functions +, -, *, etc.)
405 accept characters and implicitly convert them into integers. In 405 accept characters and implicitly convert them into integers. In
406 general, functions that work on characters also accept char-ints and 406 general, functions that work on characters also accept char-ints and
414 (object)) 414 (object))
415 { 415 {
416 return CHARP (object) ? Qt : Qnil; 416 return CHARP (object) ? Qt : Qnil;
417 } 417 }
418 418
419 DEFUN ("char-int", Fchar_int, 1, 1, 0, /* 419 DEFUN ("char-to-int", Fchar_to_int, 1, 1, 0, /*
420 Convert a character into an equivalent integer. 420 Convert a character into an equivalent integer.
421 The resulting integer will always be non-negative. The integers in 421 The resulting integer will always be non-negative. The integers in
422 the range 0 - 255 map to characters as follows: 422 the range 0 - 255 map to characters as follows:
423 423
424 0 - 31 Control set 0 424 0 - 31 Control set 0
435 { 435 {
436 CHECK_CHAR (ch); 436 CHECK_CHAR (ch);
437 return make_int (XCHAR (ch)); 437 return make_int (XCHAR (ch));
438 } 438 }
439 439
440 DEFUN ("int-char", Fint_char, 1, 1, 0, /* 440 DEFUN ("int-to-char", Fint_to_char, 1, 1, 0, /*
441 Convert an integer into the equivalent character. 441 Convert an integer into the equivalent character.
442 Not all integers correspond to valid characters; use `char-int-p' to 442 Not all integers correspond to valid characters; use `char-int-p' to
443 determine whether this is the case. If the integer cannot be converted, 443 determine whether this is the case. If the integer cannot be converted,
444 nil is returned. 444 nil is returned.
445 */ 445 */
452 return Qnil; 452 return Qnil;
453 } 453 }
454 454
455 DEFUN ("char-int-p", Fchar_int_p, 1, 1, 0, /* 455 DEFUN ("char-int-p", Fchar_int_p, 1, 1, 0, /*
456 t if OBJECT is an integer that can be converted into a character. 456 t if OBJECT is an integer that can be converted into a character.
457 See `char-int'. 457 See `char-to-int'.
458 */ 458 */
459 (object)) 459 (object))
460 { 460 {
461 return CHAR_INTP (object) ? Qt : Qnil; 461 return CHAR_INTP (object) ? Qt : Qnil;
462 } 462 }
2222 DEFSUBR (Fconsp); 2222 DEFSUBR (Fconsp);
2223 DEFSUBR (Fatom); 2223 DEFSUBR (Fatom);
2224 DEFSUBR (Fchar_or_string_p); 2224 DEFSUBR (Fchar_or_string_p);
2225 DEFSUBR (Fcharacterp); 2225 DEFSUBR (Fcharacterp);
2226 DEFSUBR (Fchar_int_p); 2226 DEFSUBR (Fchar_int_p);
2227 DEFSUBR (Fchar_int); 2227 DEFSUBR (Fchar_to_int);
2228 DEFSUBR (Fint_char); 2228 DEFSUBR (Fint_to_char);
2229 DEFSUBR (Fchar_or_char_int_p); 2229 DEFSUBR (Fchar_or_char_int_p);
2230 DEFSUBR (Fintegerp); 2230 DEFSUBR (Fintegerp);
2231 DEFSUBR (Finteger_or_marker_p); 2231 DEFSUBR (Finteger_or_marker_p);
2232 DEFSUBR (Finteger_or_char_p); 2232 DEFSUBR (Finteger_or_char_p);
2233 DEFSUBR (Finteger_char_or_marker_p); 2233 DEFSUBR (Finteger_char_or_marker_p);