Mercurial > hg > xemacs-beta
comparison src/mule-coding.h @ 213:78f53ef88e17 r20-4b5
Import from CVS: tag r20-4b5
author | cvs |
---|---|
date | Mon, 13 Aug 2007 10:06:47 +0200 |
parents | b405438285a2 |
children | 1f0dabaa0855 |
comparison
equal
deleted
inserted
replaced
212:d8688acf4c5b | 213:78f53ef88e17 |
---|---|
56 { | 56 { |
57 EOL_AUTODETECT, | 57 EOL_AUTODETECT, |
58 EOL_LF, | 58 EOL_LF, |
59 EOL_CRLF, | 59 EOL_CRLF, |
60 EOL_CR | 60 EOL_CR |
61 }; | |
62 | |
63 /* This holds the current state of a running CCL program. */ | |
64 struct ccl_program | |
65 { | |
66 Lisp_Object saved_vector; | |
67 Lisp_Object *prog; /* compiled code */ | |
68 int size; /* size of compiled code */ | |
69 int ic; /* instruction counter */ | |
70 int reg[8]; /* reg[7] is used for `condition' */ | |
71 int end_flag; /* set when processing the last block */ | |
72 int status; | |
73 }; | 61 }; |
74 | 62 |
75 typedef struct charset_conversion_spec charset_conversion_spec; | 63 typedef struct charset_conversion_spec charset_conversion_spec; |
76 struct charset_conversion_spec | 64 struct charset_conversion_spec |
77 { | 65 { |
418 #define CODING_CATEGORY_NO_CONVERSION_MASK \ | 406 #define CODING_CATEGORY_NO_CONVERSION_MASK \ |
419 (1 << CODING_CATEGORY_NO_CONVERSION) | 407 (1 << CODING_CATEGORY_NO_CONVERSION) |
420 #define CODING_CATEGORY_NOT_FINISHED_MASK \ | 408 #define CODING_CATEGORY_NOT_FINISHED_MASK \ |
421 (1 << 30) | 409 (1 << 30) |
422 | 410 |
411 /* Macros to decode or encode a character of JISX0208 in SJIS. S1 and | |
412 S2 are the 1st and 2nd position-codes of JISX0208 in SJIS coding | |
413 system. C1 and C2 are the 1st and 2nd position codes of Emacs' | |
414 internal format. */ | |
415 | |
416 #define DECODE_SJIS(s1, s2, c1, c2) \ | |
417 do { \ | |
418 if (s2 >= 0x9F) \ | |
419 c1 = s1 * 2 - (s1 >= 0xE0 ? 0x160 : 0xE0), \ | |
420 c2 = s2 - 0x7E; \ | |
421 else \ | |
422 c1 = s1 * 2 - ((s1 >= 0xE0) ? 0x161 : 0xE1), \ | |
423 c2 = s2 - ((s2 >= 0x7F) ? 0x20 : 0x1F); \ | |
424 } while (0) | |
425 | |
426 #define ENCODE_SJIS(c1, c2, s1, s2) \ | |
427 do { \ | |
428 if ((c1) & 1) \ | |
429 s1 = (c1) / 2 + (((c1) < 0x5F) ? 0x71 : 0xB1), \ | |
430 s2 = (c2) + (((c2) >= 0x60) ? 0x20 : 0x1F); \ | |
431 else \ | |
432 s1 = (c1) / 2 + (((c1) < 0x5F) ? 0x70 : 0xB0), \ | |
433 s2 = (c2) + 0x7E; \ | |
434 } while (0) | |
435 | |
436 | |
423 extern Lisp_Object make_decoding_input_stream (Lstream *stream, | 437 extern Lisp_Object make_decoding_input_stream (Lstream *stream, |
424 Lisp_Object codesys); | 438 Lisp_Object codesys); |
425 extern Lisp_Object make_encoding_input_stream (Lstream *stream, | 439 extern Lisp_Object make_encoding_input_stream (Lstream *stream, |
426 Lisp_Object codesys); | 440 Lisp_Object codesys); |
427 extern Lisp_Object make_decoding_output_stream (Lstream *stream, | 441 extern Lisp_Object make_decoding_output_stream (Lstream *stream, |
432 extern Lisp_Object encoding_stream_coding_system (Lstream *stream); | 446 extern Lisp_Object encoding_stream_coding_system (Lstream *stream); |
433 extern void set_decoding_stream_coding_system (Lstream *stream, | 447 extern void set_decoding_stream_coding_system (Lstream *stream, |
434 Lisp_Object codesys); | 448 Lisp_Object codesys); |
435 extern void set_encoding_stream_coding_system (Lstream *stream, | 449 extern void set_encoding_stream_coding_system (Lstream *stream, |
436 Lisp_Object codesys); | 450 Lisp_Object codesys); |
437 | |
438 /* In mule-ccl.c */ | |
439 int ccl_driver (struct ccl_program *ccl, CONST unsigned char *src, | |
440 unsigned_char_dynarr *dst, int n, int end_flag); | |
441 void set_ccl_program (struct ccl_program *ccl, Lisp_Object val, int *regs, | |
442 int numregs, int initial_ic); | |
443 | |
444 #endif /* _XEMACS_MULE_CODING_H_ */ | 451 #endif /* _XEMACS_MULE_CODING_H_ */ |