struct charset_lookup *chlook;
static const struct lrecord_description charset_lookup_description_1[] = {
- { XD_LISP_OBJECT, offsetof(struct charset_lookup, charset_by_leading_byte), 128+4*128*2 },
+ { XD_LISP_OBJECT_ARRAY, offsetof (struct charset_lookup, charset_by_leading_byte), 128+4*128*2 },
{ XD_END }
};
static const struct struct_description charset_lookup_description = {
- sizeof(struct charset_lookup),
+ sizeof (struct charset_lookup),
charset_lookup_description_1
};
rep_bytes_by_first_byte(c) is more efficient than the equivalent
canonical computation:
- (BYTE_ASCII_P (c) ? 1 : XCHARSET_REP_BYTES (CHARSET_BY_LEADING_BYTE (c))) */
+ XCHARSET_REP_BYTES (CHARSET_BY_LEADING_BYTE (c)) */
-Bytecount rep_bytes_by_first_byte[0xA0] =
+const Bytecount rep_bytes_by_first_byte[0xA0] =
{ /* 0x00 - 0x7f are for straight ASCII */
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
static Lisp_Object
mark_charset (Lisp_Object obj)
{
- struct Lisp_Charset *cs = XCHARSET (obj);
+ Lisp_Charset *cs = XCHARSET (obj);
mark_object (cs->short_name);
mark_object (cs->long_name);
static void
print_charset (Lisp_Object obj, Lisp_Object printcharfun, int escapeflag)
{
- struct Lisp_Charset *cs = XCHARSET (obj);
+ Lisp_Charset *cs = XCHARSET (obj);
char buf[200];
if (print_readably)
}
static const struct lrecord_description charset_description[] = {
- { XD_LISP_OBJECT, offsetof(struct Lisp_Charset, name), 7 },
+ { XD_LISP_OBJECT, offsetof (Lisp_Charset, name) },
+ { XD_LISP_OBJECT, offsetof (Lisp_Charset, doc_string) },
+ { XD_LISP_OBJECT, offsetof (Lisp_Charset, registry) },
+ { XD_LISP_OBJECT, offsetof (Lisp_Charset, short_name) },
+ { XD_LISP_OBJECT, offsetof (Lisp_Charset, long_name) },
+ { XD_LISP_OBJECT, offsetof (Lisp_Charset, reverse_direction_charset) },
+ { XD_LISP_OBJECT, offsetof (Lisp_Charset, ccl_program) },
{ XD_END }
};
DEFINE_LRECORD_IMPLEMENTATION ("charset", charset,
mark_charset, print_charset, 0, 0, 0, charset_description,
- struct Lisp_Charset);
+ Lisp_Charset);
/* Make a new charset. */
static Lisp_Object
Lisp_Object reg)
{
Lisp_Object obj;
- struct Lisp_Charset *cs =
- alloc_lcrecord_type (struct Lisp_Charset, &lrecord_charset);
+ Lisp_Charset *cs = alloc_lcrecord_type (Lisp_Charset, &lrecord_charset);
+
+ zero_lcrecord (cs);
+
XSETCHARSET (obj, cs);
CHARSET_ID (cs) = id;
assert (NILP (chlook->charset_by_leading_byte[id - 128]));
chlook->charset_by_leading_byte[id - 128] = obj;
- if (id < 0xA0)
- /* official leading byte */
- rep_bytes_by_first_byte[id] = rep_bytes;
/* Some charsets are "faux" and don't have names or really exist at
all except in the leading-byte table. */
int id, dimension, columns, graphic, final;
int direction, type;
Lisp_Object registry, doc_string, short_name, long_name;
- struct Lisp_Charset *cs;
+ Lisp_Charset *cs;
charset = Fget_charset (charset);
if (!NILP (XCHARSET_REVERSE_DIRECTION_CHARSET (charset)))
*/
(charset, prop))
{
- struct Lisp_Charset *cs;
+ Lisp_Charset *cs;
charset = Fget_charset (charset);
cs = XCHARSET (charset);
*/
(charset, arg1, arg2))
{
- struct Lisp_Charset *cs;
+ Lisp_Charset *cs;
int a1, a2;
int lowlim, highlim;
(CHAR_LEADING_BYTE (XCHAR (ch))));
}
+DEFUN ("char-octet", Fchar_octet, 1, 2, 0, /*
+Return the octet numbered N (should be 0 or 1) of char CH.
+N defaults to 0 if omitted.
+*/
+ (ch, n))
+{
+ Lisp_Object charset;
+ int octet0, octet1;
+
+ CHECK_CHAR_COERCE_INT (ch);
+
+ BREAKUP_CHAR (XCHAR (ch), charset, octet0, octet1);
+
+ if (NILP (n) || EQ (n, Qzero))
+ return make_int (octet0);
+ else if (EQ (n, make_int (1)))
+ return make_int (octet1);
+ else
+ signal_simple_error ("Octet number must be 0 or 1", n);
+}
+
DEFUN ("split-char", Fsplit_char, 1, 1, 0, /*
Return list of charset and one or two position-codes of CHAR.
*/
DEFSUBR (Fmake_char);
DEFSUBR (Fchar_charset);
+ DEFSUBR (Fchar_octet);
DEFSUBR (Fsplit_char);
#ifdef ENABLE_COMPOSITE_CHARS