- CHECK_NUMBER (character, 0);
- CHECK_NUMBER (idx, 1);
-
- if ((c = cmpchar_component (XINT (character), XINT (idx))) < 0)
- args_out_of_range (character, idx);
-
- return make_number (c);
-}
-
-DEFUN ("composite-char-composition-rule", Fcmpchar_cmp_rule, Scmpchar_cmp_rule,
- 2, 2, 0,
- "Return the Nth composition rule embedded in composite character CHARACTER.\n\
-The returned rule is for composing the Nth component\n\
-on the (N-1)th component. If N is 0, the returned value is always 255.")
- (character, n)
- Lisp_Object character, n;
-{
- int id, i;
-
- CHECK_NUMBER (character, 0);
- CHECK_NUMBER (n, 1);
-
- id = COMPOSITE_CHAR_ID (XINT (character));
- if (id < 0 || id >= n_cmpchars)
- error ("Invalid composite character: %d", XINT (character));
- i = XINT (n);
- if (i > cmpchar_table[id]->glyph_len)
- args_out_of_range (character, n);
-
- return make_number (cmpchar_table[id]->cmp_rule[i]);
-}
-
-DEFUN ("composite-char-composition-rule-p", Fcmpchar_cmp_rule_p,
- Scmpchar_cmp_rule_p, 1, 1, 0,
- "Return non-nil if composite character CHARACTER contains a embedded rule.")
- (character)
- Lisp_Object character;
-{
- int id;
-
- CHECK_NUMBER (character, 0);
- id = COMPOSITE_CHAR_ID (XINT (character));
- if (id < 0 || id >= n_cmpchars)
- error ("Invalid composite character: %d", XINT (character));
-
- return (cmpchar_table[id]->cmp_rule ? Qt : Qnil);
-}
-
-DEFUN ("composite-char-component-count", Fcmpchar_cmp_count,
- Scmpchar_cmp_count, 1, 1, 0,
- "Return number of compoents of composite character CHARACTER.")
- (character)
- Lisp_Object character;
-{
- int id;
-
- CHECK_NUMBER (character, 0);
- id = COMPOSITE_CHAR_ID (XINT (character));
- if (id < 0 || id >= n_cmpchars)
- error ("Invalid composite character: %d", XINT (character));
-
- return (make_number (cmpchar_table[id]->glyph_len));
-}
-
-DEFUN ("compose-string", Fcompose_string, Scompose_string,
- 1, 1, 0,
- "Return one char string composed from all characters in STRING.")
- (str)
- Lisp_Object str;
-{
- unsigned char buf[MAX_LENGTH_OF_MULTI_BYTE_FORM], *p, *pend, *ptemp;
- int len, i;
-
- CHECK_STRING (str, 0);
-
- buf[0] = LEADING_CODE_COMPOSITION;
- p = XSTRING (str)->data;
- pend = p + STRING_BYTES (XSTRING (str));
- i = 1;
- while (p < pend)