comparison src/mule-charset.h @ 438:84b14dcb0985 r21-2-27

Import from CVS: tag r21-2-27
author cvs
date Mon, 13 Aug 2007 11:32:25 +0200
parents 3ecd8885ac67
children 8de8e3f6228a
comparison
equal deleted inserted replaced
437:e2a4e8b94b82 438:84b14dcb0985
237 a "leading byte prefix", which is either 0x9E or 0x9F. (No 237 a "leading byte prefix", which is either 0x9E or 0x9F. (No
238 character sets are ever assigned these leading bytes.) Specifically: 238 character sets are ever assigned these leading bytes.) Specifically:
239 239
240 Character set Encoding (PC == position-code) 240 Character set Encoding (PC == position-code)
241 ------------- -------- (LB == leading-byte) 241 ------------- -------- (LB == leading-byte)
242 ASCII PC1 | 242 ASCII PC1 |
243 Control-1 LB | PC1 + 0xA0 243 Control-1 LB | PC1 + 0xA0
244 Dimension-1 official LB | PC1 + 0x80 244 Dimension-1 official LB | PC1 + 0x80
245 Dimension-1 private 0x9E | LB | PC1 + 0x80 245 Dimension-1 private 0x9E | LB | PC1 + 0x80
246 Dimension-2 official LB | PC1 | PC2 + 0x80 246 Dimension-2 official LB | PC1 | PC2 + 0x80
247 Dimension-2 private 0x9F | LB | PC1 + 0x80 | PC2 + 0x80 247 Dimension-2 private 0x9F | LB | PC1 + 0x80 | PC2 + 0x80
555 Lisp_Object charset_by_attributes[4][128][2]; 555 Lisp_Object charset_by_attributes[4][128][2];
556 }; 556 };
557 557
558 extern struct charset_lookup *chlook; 558 extern struct charset_lookup *chlook;
559 559
560 /* Table of number of bytes in the string representation of a character
561 indexed by the first byte of that representation.
562
563 This value can be derived other ways -- e.g. something like
564
565 (BYTE_ASCII_P (first_byte) ? 1 :
566 XCHARSET_REP_BYTES (CHARSET_BY_LEADING_BYTE (first_byte)))
567
568 but it's faster this way. */
569 extern Bytecount rep_bytes_by_first_byte[0xA0];
570
571 #ifdef ERROR_CHECK_TYPECHECK 560 #ifdef ERROR_CHECK_TYPECHECK
572 /* int not Bufbyte even though that is the actual type of a leading byte. 561 /* int not Bufbyte even though that is the actual type of a leading byte.
573 This way, out-ot-range values will get caught rather than automatically 562 This way, out-ot-range values will get caught rather than automatically
574 truncated. */ 563 truncated. */
575 INLINE Lisp_Object CHARSET_BY_LEADING_BYTE (int lb); 564 INLINE Lisp_Object CHARSET_BY_LEADING_BYTE (int lb);
587 #endif 576 #endif
588 577
589 #define CHARSET_BY_ATTRIBUTES(type, final, dir) \ 578 #define CHARSET_BY_ATTRIBUTES(type, final, dir) \
590 (chlook->charset_by_attributes[type][final][dir]) 579 (chlook->charset_by_attributes[type][final][dir])
591 580
592 #ifdef ERROR_CHECK_TYPECHECK 581
593 582 /* Table of number of bytes in the string representation of a character
594 /* Number of bytes in the string representation of a character */ 583 indexed by the first byte of that representation.
584
585 This value can be derived in other ways -- e.g. something like
586 XCHARSET_REP_BYTES (CHARSET_BY_LEADING_BYTE (first_byte))
587 but it's faster this way. */
588 extern const Bytecount rep_bytes_by_first_byte[0xA0];
589
590 /* Number of bytes in the string representation of a character. */
595 INLINE int REP_BYTES_BY_FIRST_BYTE (int fb); 591 INLINE int REP_BYTES_BY_FIRST_BYTE (int fb);
596 INLINE int 592 INLINE int
597 REP_BYTES_BY_FIRST_BYTE (int fb) 593 REP_BYTES_BY_FIRST_BYTE (int fb)
598 { 594 {
599 assert (fb >= 0 && fb < 0xA0); 595 #ifdef ERROR_CHECK_TYPECHECK
596 assert (0 <= fb && fb < 0xA0);
597 #endif
600 return rep_bytes_by_first_byte[fb]; 598 return rep_bytes_by_first_byte[fb];
601 } 599 }
602
603 #else
604 #define REP_BYTES_BY_FIRST_BYTE(fb) (rep_bytes_by_first_byte[fb])
605 #endif
606 600
607 601
608 /************************************************************************/ 602 /************************************************************************/
609 /* Dealing with characters */ 603 /* Dealing with characters */
610 /************************************************************************/ 604 /************************************************************************/