comparison 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
comparison
equal deleted inserted replaced
90269:0f622530c46c 90270:e7efdba36b32
210 hash_lookup (XHASH_TABLE (Vcoding_system_hash_table), \ 210 hash_lookup (XHASH_TABLE (Vcoding_system_hash_table), \
211 coding_system_symbol, NULL) 211 coding_system_symbol, NULL)
212 212
213 /* Return 1 iff CODING_SYSTEM_SYMBOL is a coding system. */ 213 /* Return 1 iff CODING_SYSTEM_SYMBOL is a coding system. */
214 214
215 #define CODING_SYSTEM_P(coding_system_symbol) \ 215 #define CODING_SYSTEM_P(coding_system_symbol) \
216 (! NILP (CODING_SYSTEM_SPEC (coding_system_symbol))) 216 (CODING_SYSTEM_ID (coding_system_symbol) >= 0 \
217 || (! NILP (coding_system_symbol) \
218 && ! NILP (Fcoding_system_p (coding_system_symbol))))
217 219
218 /* Check if X is a coding system or not. */ 220 /* Check if X is a coding system or not. */
219 221
220 #define CHECK_CODING_SYSTEM(x) \ 222 #define CHECK_CODING_SYSTEM(x) \
221 do { \ 223 do { \
222 if (!CODING_SYSTEM_P (x)) \ 224 if (CODING_SYSTEM_ID (x) < 0 \
225 && NILP (Fcheck_coding_system (x))) \
223 wrong_type_argument (Qcoding_system_p, (x)); \ 226 wrong_type_argument (Qcoding_system_p, (x)); \
224 } while (0) 227 } while (0)
225 228
226 229
227 /* Check if X is a coding system or not. If it is, set SEPC to the 230 /* Check if X is a coding system or not. If it is, set SEPC to the
229 232
230 #define CHECK_CODING_SYSTEM_GET_SPEC(x, spec) \ 233 #define CHECK_CODING_SYSTEM_GET_SPEC(x, spec) \
231 do { \ 234 do { \
232 spec = CODING_SYSTEM_SPEC (x); \ 235 spec = CODING_SYSTEM_SPEC (x); \
233 if (NILP (spec)) \ 236 if (NILP (spec)) \
237 { \
238 Fcheck_coding_system (x); \
239 spec = CODING_SYSTEM_SPEC (x); \
240 } \
241 if (NILP (spec)) \
234 x = wrong_type_argument (Qcoding_system_p, (x)); \ 242 x = wrong_type_argument (Qcoding_system_p, (x)); \
235 } while (0) 243 } while (0)
236 244
237 245
238 /* Check if X is a coding system or not. If it is, set ID to the 246 /* Check if X is a coding system or not. If it is, set ID to the
240 248
241 #define CHECK_CODING_SYSTEM_GET_ID(x, id) \ 249 #define CHECK_CODING_SYSTEM_GET_ID(x, id) \
242 do \ 250 do \
243 { \ 251 { \
244 id = CODING_SYSTEM_ID (x); \ 252 id = CODING_SYSTEM_ID (x); \
253 if (id < 0) \
254 { \
255 Fcheck_coding_system (x); \
256 id = CODING_SYSTEM_ID (x); \
257 } \
245 if (id < 0) \ 258 if (id < 0) \
246 x = wrong_type_argument (Qcoding_system_p, (x)); \ 259 x = wrong_type_argument (Qcoding_system_p, (x)); \
247 } while (0) 260 } while (0)
248 261
249 262