#ifdef emacs
/*** 8. Emacs Lisp library functions ***/
-DEFUN ("coding-system-p", Fcoding_system_p, Scoding_system_p, 1, 1, 0,
+DEFUE ("coding-system-p", Fcoding_system_p, Scoding_system_p, 1, 1, 0,
doc: /* Return t if OBJECT is nil or a coding-system.
See the documentation of `define-coding-system' for information
about coding-system objects. */)
return Qt;
}
-DEFUN ("read-non-nil-coding-system", Fread_non_nil_coding_system,
+DEFUE ("read-non-nil-coding-system", Fread_non_nil_coding_system,
Sread_non_nil_coding_system, 1, 1, 0,
doc: /* Read a coding system from the minibuffer, prompting with string PROMPT. */)
(Lisp_Object prompt)
return (Fintern (val, Qnil));
}
-DEFUN ("read-coding-system", Fread_coding_system, Sread_coding_system, 1, 2, 0,
+DEFUE ("read-coding-system", Fread_coding_system, Sread_coding_system, 1, 2, 0,
doc: /* Read a coding system from the minibuffer, prompting with string PROMPT.
If the user enters null input, return second argument DEFAULT-CODING-SYSTEM.
Ignores case when completing coding systems (all Emacs coding systems
return (SCHARS (val) == 0 ? Qnil : Fintern (val, Qnil));
}
-DEFUN ("check-coding-system", Fcheck_coding_system, Scheck_coding_system,
+DEFUE ("check-coding-system", Fcheck_coding_system, Scheck_coding_system,
1, 1, 0,
doc: /* Check validity of CODING-SYSTEM.
If valid, return CODING-SYSTEM, else signal a `coding-system-error' error.
}
-DEFUN ("decode-coding-string", Fdecode_coding_string, Sdecode_coding_string,
+DEFUE ("decode-coding-string", Fdecode_coding_string, Sdecode_coding_string,
2, 4, 0,
doc: /* Decode STRING which is encoded in CODING-SYSTEM, and return the result.
{
Lisp_Object spec, attrs, val;
struct charset *charset_roman, *charset_kanji, *charset_kana, *charset;
+ EMACS_INT ch;
int c;
CHECK_NATNUM (code);
- c = XFASTINT (code);
+ ch = XFASTINT (code);
CHECK_CODING_SYSTEM_GET_SPEC (Vsjis_coding_system, spec);
attrs = AREF (spec, 0);
- if (ASCII_BYTE_P (c)
+ if (ASCII_BYTE_P (ch)
&& ! NILP (CODING_ATTR_ASCII_COMPAT (attrs)))
return code;
charset_kana = CHARSET_FROM_ID (XINT (XCAR (val))), val = XCDR (val);
charset_kanji = CHARSET_FROM_ID (XINT (XCAR (val)));
- if (c <= 0x7F)
- charset = charset_roman;
- else if (c >= 0xA0 && c < 0xDF)
+ if (ch <= 0x7F)
{
+ c = ch;
+ charset = charset_roman;
+ }
+ else if (ch >= 0xA0 && ch < 0xDF)
+ {
+ c = ch - 0x80;
charset = charset_kana;
- c -= 0x80;
}
else
{
- int c1 = c >> 8, c2 = c & 0xFF;
+ EMACS_INT c1 = ch >> 8;
+ int c2 = ch & 0xFF;
if (c1 < 0x81 || (c1 > 0x9F && c1 < 0xE0) || c1 > 0xEF
|| c2 < 0x40 || c2 == 0x7F || c2 > 0xFC)
- error ("Invalid code: %d", code);
+ error ("Invalid code: %"pEd, ch);
+ c = ch;
SJIS_TO_JIS (c);
charset = charset_kanji;
}
c = DECODE_CHAR (charset, c);
if (c < 0)
- error ("Invalid code: %d", code);
+ error ("Invalid code: %"pEd, ch);
return make_number (c);
}
{
Lisp_Object spec, attrs, val;
struct charset *charset_roman, *charset_big5, *charset;
+ EMACS_INT ch;
int c;
CHECK_NATNUM (code);
- c = XFASTINT (code);
+ ch = XFASTINT (code);
CHECK_CODING_SYSTEM_GET_SPEC (Vbig5_coding_system, spec);
attrs = AREF (spec, 0);
- if (ASCII_BYTE_P (c)
+ if (ASCII_BYTE_P (ch)
&& ! NILP (CODING_ATTR_ASCII_COMPAT (attrs)))
return code;
charset_roman = CHARSET_FROM_ID (XINT (XCAR (val))), val = XCDR (val);
charset_big5 = CHARSET_FROM_ID (XINT (XCAR (val)));
- if (c <= 0x7F)
- charset = charset_roman;
+ if (ch <= 0x7F)
+ {
+ c = ch;
+ charset = charset_roman;
+ }
else
{
- int b1 = c >> 8, b2 = c & 0x7F;
+ EMACS_INT b1 = ch >> 8;
+ int b2 = ch & 0x7F;
if (b1 < 0xA1 || b1 > 0xFE
|| b2 < 0x40 || (b2 > 0x7E && b2 < 0xA1) || b2 > 0xFE)
- error ("Invalid code: %d", code);
+ error ("Invalid code: %"pEd, ch);
+ c = ch;
charset = charset_big5;
}
- c = DECODE_CHAR (charset, (unsigned )c);
+ c = DECODE_CHAR (charset, c);
if (c < 0)
- error ("Invalid code: %d", code);
+ error ("Invalid code: %"pEd, ch);
return make_number (c);
}
}
\f
-DEFUN ("find-operation-coding-system", Ffind_operation_coding_system,
+DEFUE ("find-operation-coding-system", Ffind_operation_coding_system,
Sfind_operation_coding_system, 1, MANY, 0,
doc: /* Choose a coding system for an operation based on the target name.
The value names a pair of coding systems: (DECODING-SYSTEM . ENCODING-SYSTEM).
|| (EQ (operation, Qinsert_file_contents) && CONSP (target)
&& STRINGP (XCAR (target)) && BUFFERP (XCDR (target)))
|| (EQ (operation, Qopen_network_stream) && INTEGERP (target))))
- error ("Invalid %dth argument", XFASTINT (target_idx) + 1);
+ error ("Invalid %"pEd"th argument", XFASTINT (target_idx) + 1);
if (CONSP (target))
target = XCAR (target);
CHECK_CHARSET_GET_ID (tmp1, id);
CHECK_NATNUM_CDR (val);
if (XINT (XCDR (val)) >= 4)
- error ("Invalid graphic register number: %d", XINT (XCDR (val)));
+ error ("Invalid graphic register number: %"pEd, XINT (XCDR (val)));
XSETCAR (val, make_number (id));
}
return Qnil;
}
-DEFUN ("coding-system-base", Fcoding_system_base, Scoding_system_base,
+DEFUE ("coding-system-base", Fcoding_system_base, Scoding_system_base,
1, 1, 0,
doc: /* Return the base of CODING-SYSTEM.
Any alias or subsidiary coding system is not a base coding system. */)
return AREF (spec, 1);
}
-DEFUN ("coding-system-eol-type", Fcoding_system_eol_type,
+DEFUE ("coding-system-eol-type", Fcoding_system_eol_type,
Scoding_system_eol_type, 1, 1, 0,
doc: /* Return eol-type of CODING-SYSTEM.
An eol-type is an integer 0, 1, 2, or a vector of coding systems.