diff src/coding.h @ 90270:e7efdba36b32

(CODING_SYSTEM_P): If ID is not available, call Fcoding_system_p. (CHECK_CODING_SYSTEM): If ID is not available, call Fcheck_coding_system. (CHECK_CODING_SYSTEM_GET_SPEC): Try also Fcheck_coding_system. (CHECK_CODING_SYSTEM_GET_ID): Likewise.
author Kenichi Handa <handa@m17n.org>
date Thu, 19 Jan 2006 07:17:59 +0000
parents 7beb78bc1f8e
children c5406394f567
line wrap: on
line diff
--- a/src/coding.h	Thu Jan 19 07:16:47 2006 +0000
+++ b/src/coding.h	Thu Jan 19 07:17:59 2006 +0000
@@ -212,14 +212,17 @@
 
 /* Return 1 iff CODING_SYSTEM_SYMBOL is a coding system.  */
 
-#define CODING_SYSTEM_P(coding_system_symbol)	\
-  (! NILP (CODING_SYSTEM_SPEC (coding_system_symbol)))
+#define CODING_SYSTEM_P(coding_system_symbol)		\
+  (CODING_SYSTEM_ID (coding_system_symbol) >= 0		\
+   || (! NILP (coding_system_symbol)			\
+       && ! NILP (Fcoding_system_p (coding_system_symbol))))
 
 /* Check if X is a coding system or not.  */
 
 #define CHECK_CODING_SYSTEM(x)				\
   do {							\
-    if (!CODING_SYSTEM_P (x))				\
+    if (CODING_SYSTEM_ID (x) < 0			\
+	&& NILP (Fcheck_coding_system (x)))		\
       wrong_type_argument (Qcoding_system_p, (x));	\
   } while (0)
 
@@ -231,6 +234,11 @@
   do {							\
     spec = CODING_SYSTEM_SPEC (x);			\
     if (NILP (spec))					\
+      {							\
+	Fcheck_coding_system (x);			\
+	spec = CODING_SYSTEM_SPEC (x);			\
+      }							\
+    if (NILP (spec))					\
       x = wrong_type_argument (Qcoding_system_p, (x));	\
   } while (0)
 
@@ -243,6 +251,11 @@
     {								\
       id = CODING_SYSTEM_ID (x);				\
       if (id < 0)						\
+	{							\
+	  Fcheck_coding_system (x);				\
+	  id = CODING_SYSTEM_ID (x);				\
+	}							\
+      if (id < 0)						\
 	x = wrong_type_argument (Qcoding_system_p, (x));	\
     } while (0)