comparison src/mule-charset.h @ 424:11054d720c21 r21-2-20

Import from CVS: tag r21-2-20
author cvs
date Mon, 13 Aug 2007 11:26:11 +0200
parents 697ef44129c6
children
comparison
equal deleted inserted replaced
423:28d9c139be4c 424:11054d720c21
484 484
485 DECLARE_LRECORD (charset, struct Lisp_Charset); 485 DECLARE_LRECORD (charset, struct Lisp_Charset);
486 #define XCHARSET(x) XRECORD (x, charset, struct Lisp_Charset) 486 #define XCHARSET(x) XRECORD (x, charset, struct Lisp_Charset)
487 #define XSETCHARSET(x, p) XSETRECORD (x, p, charset) 487 #define XSETCHARSET(x, p) XSETRECORD (x, p, charset)
488 #define CHARSETP(x) RECORDP (x, charset) 488 #define CHARSETP(x) RECORDP (x, charset)
489 #define GC_CHARSETP(x) GC_RECORDP (x, charset)
490 #define CHECK_CHARSET(x) CHECK_RECORD (x, charset) 489 #define CHECK_CHARSET(x) CHECK_RECORD (x, charset)
491 #define CONCHECK_CHARSET(x) CONCHECK_RECORD (x, charset) 490 #define CONCHECK_CHARSET(x) CONCHECK_RECORD (x, charset)
492 491
493 #define CHARSET_TYPE_94 0 /* This charset includes 94 characters. */ 492 #define CHARSET_TYPE_94 0 /* This charset includes 94 characters. */
494 #define CHARSET_TYPE_96 1 /* This charset includes 96 characters. */ 493 #define CHARSET_TYPE_96 1 /* This charset includes 96 characters. */
498 #define CHARSET_LEFT_TO_RIGHT 0 497 #define CHARSET_LEFT_TO_RIGHT 0
499 #define CHARSET_RIGHT_TO_LEFT 1 498 #define CHARSET_RIGHT_TO_LEFT 1
500 499
501 /* Leading byte and id have been regrouped. -- OG */ 500 /* Leading byte and id have been regrouped. -- OG */
502 #define CHARSET_ID(cs) ((cs)->id) 501 #define CHARSET_ID(cs) ((cs)->id)
503 #define CHARSET_LEADING_BYTE(cs) ((Bufbyte)(CHARSET_ID(cs))) 502 #define CHARSET_LEADING_BYTE(cs) ((Bufbyte) CHARSET_ID(cs))
504 #define CHARSET_NAME(cs) ((cs)->name) 503 #define CHARSET_NAME(cs) ((cs)->name)
505 #define CHARSET_SHORT_NAME(cs) ((cs)->short_name) 504 #define CHARSET_SHORT_NAME(cs) ((cs)->short_name)
506 #define CHARSET_LONG_NAME(cs) ((cs)->long_name) 505 #define CHARSET_LONG_NAME(cs) ((cs)->long_name)
507 #define CHARSET_REP_BYTES(cs) ((cs)->rep_bytes) 506 #define CHARSET_REP_BYTES(cs) ((cs)->rep_bytes)
508 #define CHARSET_COLUMNS(cs) ((cs)->columns) 507 #define CHARSET_COLUMNS(cs) ((cs)->columns)
538 #define XCHARSET_CHARS(cs) CHARSET_CHARS (XCHARSET (cs)) 537 #define XCHARSET_CHARS(cs) CHARSET_CHARS (XCHARSET (cs))
539 #define XCHARSET_PRIVATE_P(cs) CHARSET_PRIVATE_P (XCHARSET (cs)) 538 #define XCHARSET_PRIVATE_P(cs) CHARSET_PRIVATE_P (XCHARSET (cs))
540 #define XCHARSET_REVERSE_DIRECTION_CHARSET(cs) \ 539 #define XCHARSET_REVERSE_DIRECTION_CHARSET(cs) \
541 CHARSET_REVERSE_DIRECTION_CHARSET (XCHARSET (cs)) 540 CHARSET_REVERSE_DIRECTION_CHARSET (XCHARSET (cs))
542 541
543 /* Table of charsets indexed by (leading byte - 128). */ 542 struct charset_lookup {
544 extern Lisp_Object charset_by_leading_byte[128]; 543 /* Table of charsets indexed by leading byte. */
545 544 Lisp_Object charset_by_leading_byte[128];
546 /* Table of charsets indexed by type/final-byte/direction. */ 545
547 extern Lisp_Object charset_by_attributes[4][128][2]; 546 /* Table of charsets indexed by type/final-byte/direction. */
547 Lisp_Object charset_by_attributes[4][128][2];
548 };
549
550 extern struct charset_lookup *chlook;
548 551
549 /* Table of number of bytes in the string representation of a character 552 /* Table of number of bytes in the string representation of a character
550 indexed by the first byte of that representation. 553 indexed by the first byte of that representation.
551 554
552 This value can be derived other ways -- e.g. something like 555 This value can be derived other ways -- e.g. something like
564 INLINE Lisp_Object CHARSET_BY_LEADING_BYTE (int lb); 567 INLINE Lisp_Object CHARSET_BY_LEADING_BYTE (int lb);
565 INLINE Lisp_Object 568 INLINE Lisp_Object
566 CHARSET_BY_LEADING_BYTE (int lb) 569 CHARSET_BY_LEADING_BYTE (int lb)
567 { 570 {
568 assert (lb >= 0x80 && lb <= 0xFF); 571 assert (lb >= 0x80 && lb <= 0xFF);
569 return charset_by_leading_byte[lb - 128]; 572 return chlook->charset_by_leading_byte[lb - 128];
570 } 573 }
571 574
572 #else 575 #else
573 576
574 #define CHARSET_BY_LEADING_BYTE(lb) (charset_by_leading_byte[(lb) - 128]) 577 #define CHARSET_BY_LEADING_BYTE(lb) (chlook->charset_by_leading_byte[(lb) - 128])
575 578
576 #endif 579 #endif
577 580
578 #define CHARSET_BY_ATTRIBUTES(type, final, dir) \ 581 #define CHARSET_BY_ATTRIBUTES(type, final, dir) \
579 (charset_by_attributes[type][final][dir]) 582 (chlook->charset_by_attributes[type][final][dir])
580 583
581 #ifdef ERROR_CHECK_TYPECHECK 584 #ifdef ERROR_CHECK_TYPECHECK
582 585
583 /* Number of bytes in the string representation of a character */ 586 /* Number of bytes in the string representation of a character */
584 INLINE int REP_BYTES_BY_FIRST_BYTE (int fb); 587 INLINE int REP_BYTES_BY_FIRST_BYTE (int fb);