comparison src/mule-charset.c @ 440:8de8e3f6228a r21-2-28

Import from CVS: tag r21-2-28
author cvs
date Mon, 13 Aug 2007 11:33:38 +0200
parents 84b14dcb0985
children abe6d1db359e
comparison
equal deleted inserted replaced
439:357dd071b03c 440:8de8e3f6228a
75 #endif /* ENABLE_COMPOSITE_CHARS */ 75 #endif /* ENABLE_COMPOSITE_CHARS */
76 76
77 struct charset_lookup *chlook; 77 struct charset_lookup *chlook;
78 78
79 static const struct lrecord_description charset_lookup_description_1[] = { 79 static const struct lrecord_description charset_lookup_description_1[] = {
80 { XD_LISP_OBJECT, offsetof(struct charset_lookup, charset_by_leading_byte), 128+4*128*2 }, 80 { XD_LISP_OBJECT_ARRAY, offsetof (struct charset_lookup, charset_by_leading_byte), 128+4*128*2 },
81 { XD_END } 81 { XD_END }
82 }; 82 };
83 83
84 static const struct struct_description charset_lookup_description = { 84 static const struct struct_description charset_lookup_description = {
85 sizeof(struct charset_lookup), 85 sizeof (struct charset_lookup),
86 charset_lookup_description_1 86 charset_lookup_description_1
87 }; 87 };
88 88
89 /* Table of number of bytes in the string representation of a character 89 /* Table of number of bytes in the string representation of a character
90 indexed by the first byte of that representation. 90 indexed by the first byte of that representation.
407 /************************************************************************/ 407 /************************************************************************/
408 408
409 static Lisp_Object 409 static Lisp_Object
410 mark_charset (Lisp_Object obj) 410 mark_charset (Lisp_Object obj)
411 { 411 {
412 struct Lisp_Charset *cs = XCHARSET (obj); 412 Lisp_Charset *cs = XCHARSET (obj);
413 413
414 mark_object (cs->short_name); 414 mark_object (cs->short_name);
415 mark_object (cs->long_name); 415 mark_object (cs->long_name);
416 mark_object (cs->doc_string); 416 mark_object (cs->doc_string);
417 mark_object (cs->registry); 417 mark_object (cs->registry);
420 } 420 }
421 421
422 static void 422 static void
423 print_charset (Lisp_Object obj, Lisp_Object printcharfun, int escapeflag) 423 print_charset (Lisp_Object obj, Lisp_Object printcharfun, int escapeflag)
424 { 424 {
425 struct Lisp_Charset *cs = XCHARSET (obj); 425 Lisp_Charset *cs = XCHARSET (obj);
426 char buf[200]; 426 char buf[200];
427 427
428 if (print_readably) 428 if (print_readably)
429 error ("printing unreadable object #<charset %s 0x%x>", 429 error ("printing unreadable object #<charset %s 0x%x>",
430 string_data (XSYMBOL (CHARSET_NAME (cs))->name), 430 string_data (XSYMBOL (CHARSET_NAME (cs))->name),
452 sprintf (buf, " 0x%x>", cs->header.uid); 452 sprintf (buf, " 0x%x>", cs->header.uid);
453 write_c_string (buf, printcharfun); 453 write_c_string (buf, printcharfun);
454 } 454 }
455 455
456 static const struct lrecord_description charset_description[] = { 456 static const struct lrecord_description charset_description[] = {
457 { XD_LISP_OBJECT, offsetof(struct Lisp_Charset, name), 7 }, 457 { XD_LISP_OBJECT, offsetof (Lisp_Charset, name) },
458 { XD_LISP_OBJECT, offsetof (Lisp_Charset, doc_string) },
459 { XD_LISP_OBJECT, offsetof (Lisp_Charset, registry) },
460 { XD_LISP_OBJECT, offsetof (Lisp_Charset, short_name) },
461 { XD_LISP_OBJECT, offsetof (Lisp_Charset, long_name) },
462 { XD_LISP_OBJECT, offsetof (Lisp_Charset, reverse_direction_charset) },
463 { XD_LISP_OBJECT, offsetof (Lisp_Charset, ccl_program) },
458 { XD_END } 464 { XD_END }
459 }; 465 };
460 466
461 DEFINE_LRECORD_IMPLEMENTATION ("charset", charset, 467 DEFINE_LRECORD_IMPLEMENTATION ("charset", charset,
462 mark_charset, print_charset, 0, 0, 0, charset_description, 468 mark_charset, print_charset, 0, 0, 0, charset_description,
463 struct Lisp_Charset); 469 Lisp_Charset);
464 /* Make a new charset. */ 470 /* Make a new charset. */
465 471
466 static Lisp_Object 472 static Lisp_Object
467 make_charset (int id, Lisp_Object name, unsigned char rep_bytes, 473 make_charset (int id, Lisp_Object name, unsigned char rep_bytes,
468 unsigned char type, unsigned char columns, unsigned char graphic, 474 unsigned char type, unsigned char columns, unsigned char graphic,
469 Bufbyte final, unsigned char direction, Lisp_Object short_name, 475 Bufbyte final, unsigned char direction, Lisp_Object short_name,
470 Lisp_Object long_name, Lisp_Object doc, 476 Lisp_Object long_name, Lisp_Object doc,
471 Lisp_Object reg) 477 Lisp_Object reg)
472 { 478 {
473 Lisp_Object obj; 479 Lisp_Object obj;
474 struct Lisp_Charset *cs = 480 Lisp_Charset *cs = alloc_lcrecord_type (Lisp_Charset, &lrecord_charset);
475 alloc_lcrecord_type (struct Lisp_Charset, &lrecord_charset); 481
482 zero_lcrecord (cs);
483
476 XSETCHARSET (obj, cs); 484 XSETCHARSET (obj, cs);
477 485
478 CHARSET_ID (cs) = id; 486 CHARSET_ID (cs) = id;
479 CHARSET_NAME (cs) = name; 487 CHARSET_NAME (cs) = name;
480 CHARSET_SHORT_NAME (cs) = short_name; 488 CHARSET_SHORT_NAME (cs) = short_name;
826 { 834 {
827 Lisp_Object new_charset = Qnil; 835 Lisp_Object new_charset = Qnil;
828 int id, dimension, columns, graphic, final; 836 int id, dimension, columns, graphic, final;
829 int direction, type; 837 int direction, type;
830 Lisp_Object registry, doc_string, short_name, long_name; 838 Lisp_Object registry, doc_string, short_name, long_name;
831 struct Lisp_Charset *cs; 839 Lisp_Charset *cs;
832 840
833 charset = Fget_charset (charset); 841 charset = Fget_charset (charset);
834 if (!NILP (XCHARSET_REVERSE_DIRECTION_CHARSET (charset))) 842 if (!NILP (XCHARSET_REVERSE_DIRECTION_CHARSET (charset)))
835 signal_simple_error ("Charset already has reverse-direction charset", 843 signal_simple_error ("Charset already has reverse-direction charset",
836 charset); 844 charset);
975 Recognized properties are those listed in `make-charset', as well as 983 Recognized properties are those listed in `make-charset', as well as
976 'name and 'doc-string. 984 'name and 'doc-string.
977 */ 985 */
978 (charset, prop)) 986 (charset, prop))
979 { 987 {
980 struct Lisp_Charset *cs; 988 Lisp_Charset *cs;
981 989
982 charset = Fget_charset (charset); 990 charset = Fget_charset (charset);
983 cs = XCHARSET (charset); 991 cs = XCHARSET (charset);
984 992
985 CHECK_SYMBOL (prop); 993 CHECK_SYMBOL (prop);
1069 For example, (make-char 'latin-iso8859-2 185) will return the Latin 2 1077 For example, (make-char 'latin-iso8859-2 185) will return the Latin 2
1070 character s with caron. 1078 character s with caron.
1071 */ 1079 */
1072 (charset, arg1, arg2)) 1080 (charset, arg1, arg2))
1073 { 1081 {
1074 struct Lisp_Charset *cs; 1082 Lisp_Charset *cs;
1075 int a1, a2; 1083 int a1, a2;
1076 int lowlim, highlim; 1084 int lowlim, highlim;
1077 1085
1078 charset = Fget_charset (charset); 1086 charset = Fget_charset (charset);
1079 cs = XCHARSET (charset); 1087 cs = XCHARSET (charset);