(translate_char): Accept list of translation tables.
[bpt/emacs.git] / src / coding.h
1 /* Header for coding system handler.
2 Copyright (C) 1995, 1997 Electrotechnical Laboratory, JAPAN.
3 Licensed to the Free Software Foundation.
4 Copyright (C) 2003
5 National Institute of Advanced Industrial Science and Technology (AIST)
6 Registration Number H13PRO009
7
8 This file is part of GNU Emacs.
9
10 GNU Emacs is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 2, or (at your option)
13 any later version.
14
15 GNU Emacs is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
19
20 You should have received a copy of the GNU General Public License
21 along with GNU Emacs; see the file COPYING. If not, write to
22 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23 Boston, MA 02111-1307, USA. */
24
25 #ifndef EMACS_CODING_H
26 #define EMACS_CODING_H
27
28 /* Index to arguments of Fdefine_coding_system_internal. */
29
30 enum define_coding_system_arg_index
31 {
32 coding_arg_name,
33 coding_arg_mnemonic,
34 coding_arg_coding_type,
35 coding_arg_charset_list,
36 coding_arg_ascii_compatible_p,
37 coding_arg_decode_translation_table,
38 coding_arg_encode_translation_table,
39 coding_arg_post_read_conversion,
40 coding_arg_pre_write_conversion,
41 coding_arg_default_char,
42 coding_arg_for_unibyte,
43 coding_arg_plist,
44 coding_arg_eol_type,
45 coding_arg_max
46 };
47
48 enum define_coding_iso2022_arg_index
49 {
50 coding_arg_iso2022_initial = coding_arg_max,
51 coding_arg_iso2022_reg_usage,
52 coding_arg_iso2022_request,
53 coding_arg_iso2022_flags,
54 coding_arg_iso2022_max
55 };
56
57 enum define_coding_utf16_arg_index
58 {
59 coding_arg_utf16_bom = coding_arg_max,
60 coding_arg_utf16_endian,
61 coding_arg_utf16_max
62 };
63
64 enum define_coding_ccl_arg_index
65 {
66 coding_arg_ccl_decoder = coding_arg_max,
67 coding_arg_ccl_encoder,
68 coding_arg_ccl_valids,
69 coding_arg_ccl_max
70 };
71
72 extern Lisp_Object Vcoding_system_hash_table;
73
74 /* Enumeration of coding system type. */
75
76 enum coding_system_type
77 {
78 coding_type_charset,
79 coding_type_utf_8,
80 coding_type_utf_16,
81 coding_type_iso_2022,
82 coding_type_emacs_mule,
83 coding_type_sjis,
84 coding_type_ccl,
85 coding_type_raw_text,
86 coding_type_undecided,
87 coding_type_max
88 };
89
90
91 /* Enumeration of end-of-line format type. */
92
93 enum end_of_line_type
94 {
95 eol_lf, /* Line-feed only, same as Emacs' internal
96 format. */
97 eol_crlf, /* Sequence of carriage-return and
98 line-feed. */
99 eol_cr, /* Carriage-return only. */
100 eol_any, /* Accept any of above. Produce line-feed
101 only. */
102 eol_undecided, /* This value is used to denote that the
103 eol-type is not yet undecided. */
104 eol_type_max
105 };
106
107 /* Enumeration of index to an attribute vector of a coding system. */
108
109 enum coding_attr_index
110 {
111 coding_attr_base_name,
112 coding_attr_docstring,
113 coding_attr_mnemonic,
114 coding_attr_type,
115 coding_attr_charset_list,
116 coding_attr_ascii_compat,
117 coding_attr_decode_tbl,
118 coding_attr_encode_tbl,
119 coding_attr_trans_tbl,
120 coding_attr_post_read,
121 coding_attr_pre_write,
122 coding_attr_default_char,
123 coding_attr_for_unibyte,
124 coding_attr_plist,
125
126 coding_attr_category,
127 coding_attr_safe_charsets,
128
129 /* The followings are extra attributes for each type. */
130 coding_attr_charset_valids,
131
132 coding_attr_ccl_decoder,
133 coding_attr_ccl_encoder,
134 coding_attr_ccl_valids,
135
136 coding_attr_iso_initial,
137 coding_attr_iso_usage,
138 coding_attr_iso_request,
139 coding_attr_iso_flags,
140
141 coding_attr_utf_16_bom,
142 coding_attr_utf_16_endian,
143
144 coding_attr_emacs_mule_full,
145
146 coding_attr_last_index
147 };
148
149
150 #define CODING_ATTR_BASE_NAME(attrs) AREF (attrs, coding_attr_base_name)
151 #define CODING_ATTR_TYPE(attrs) AREF (attrs, coding_attr_type)
152 #define CODING_ATTR_CHARSET_LIST(attrs) AREF (attrs, coding_attr_charset_list)
153 #define CODING_ATTR_MNEMONIC(attrs) AREF (attrs, coding_attr_mnemonic)
154 #define CODING_ATTR_DOCSTRING(attrs) AREF (attrs, coding_attr_docstring)
155 #define CODING_ATTR_ASCII_COMPAT(attrs) AREF (attrs, coding_attr_ascii_compat)
156 #define CODING_ATTR_DECODE_TBL(attrs) AREF (attrs, coding_attr_decode_tbl)
157 #define CODING_ATTR_ENCODE_TBL(attrs) AREF (attrs, coding_attr_encode_tbl)
158 #define CODING_ATTR_TRANS_TBL(attrs) AREF (attrs, coding_attr_trans_tbl)
159 #define CODING_ATTR_POST_READ(attrs) AREF (attrs, coding_attr_post_read)
160 #define CODING_ATTR_PRE_WRITE(attrs) AREF (attrs, coding_attr_pre_write)
161 #define CODING_ATTR_DEFAULT_CHAR(attrs) AREF (attrs, coding_attr_default_char)
162 #define CODING_ATTR_FOR_UNIBYTE(attrs) AREF (attrs, coding_attr_for_unibyte)
163 #define CODING_ATTR_FLUSHING(attrs) AREF (attrs, coding_attr_flushing)
164 #define CODING_ATTR_PLIST(attrs) AREF (attrs, coding_attr_plist)
165 #define CODING_ATTR_CATEGORY(attrs) AREF (attrs, coding_attr_category)
166 #define CODING_ATTR_SAFE_CHARSETS(attrs)AREF (attrs, coding_attr_safe_charsets)
167
168
169 #define CODING_ID_ATTRS(id) \
170 (AREF (HASH_VALUE (XHASH_TABLE (Vcoding_system_hash_table), id), 0))
171
172 #define CODING_ID_ALIASES(id) \
173 (AREF (HASH_VALUE (XHASH_TABLE (Vcoding_system_hash_table), id), 1))
174
175 #define CODING_ID_EOL_TYPE(id) \
176 (AREF (HASH_VALUE (XHASH_TABLE (Vcoding_system_hash_table), id), 2))
177
178 #define CODING_ID_NAME(id) \
179 (HASH_KEY (XHASH_TABLE (Vcoding_system_hash_table), id))
180
181 #define CODING_SYSTEM_SPEC(coding_system_symbol) \
182 (Fgethash (coding_system_symbol, Vcoding_system_hash_table, Qnil))
183
184 #define CODING_SYSTEM_ID(coding_system_symbol) \
185 hash_lookup (XHASH_TABLE (Vcoding_system_hash_table), \
186 coding_system_symbol, NULL)
187
188 #define CODING_SYSTEM_P(coding_system_symbol) \
189 (! NILP (CODING_SYSTEM_SPEC (coding_system_symbol)))
190
191 #define CHECK_CODING_SYSTEM(x) \
192 do { \
193 if (!CODING_SYSTEM_P (x)) \
194 wrong_type_argument (Qcoding_system_p, (x)); \
195 } while (0)
196
197
198 #define CHECK_CODING_SYSTEM_GET_SPEC(x, spec) \
199 do { \
200 spec = CODING_SYSTEM_SPEC (x); \
201 if (NILP (spec)) \
202 x = wrong_type_argument (Qcoding_system_p, (x)); \
203 } while (0)
204
205
206 #define CHECK_CODING_SYSTEM_GET_ID(x, id) \
207 do \
208 { \
209 id = CODING_SYSTEM_ID (x); \
210 if (id < 0) \
211 x = wrong_type_argument (Qcoding_system_p, (x)); \
212 } while (0)
213
214
215 /*** GENERAL section ***/
216
217 /* Enumeration of result code of code conversion. */
218 enum coding_result_code
219 {
220 CODING_RESULT_SUCCESS,
221 CODING_RESULT_INSUFFICIENT_SRC,
222 CODING_RESULT_INSUFFICIENT_DST,
223 CODING_RESULT_INCONSISTENT_EOL,
224 CODING_RESULT_INVALID_SRC,
225 CODING_RESULT_INTERRUPT,
226 CODING_RESULT_INSUFFICIENT_MEM
227 };
228
229
230 /* Macros used for the member `mode' of the struct coding_system. */
231
232 /* If set, recover the original CR or LF of the already decoded text
233 when the decoding routine encounters an inconsistent eol format. */
234 #define CODING_MODE_INHIBIT_INCONSISTENT_EOL 0x01
235
236 /* If set, the decoding/encoding routines treat the current data as
237 the last block of the whole text to be converted, and do the
238 appropriate finishing job. */
239 #define CODING_MODE_LAST_BLOCK 0x02
240
241 /* If set, it means that the current source text is in a buffer which
242 enables selective display. */
243 #define CODING_MODE_SELECTIVE_DISPLAY 0x04
244
245 /* This flag is used by the decoding/encoding routines on the fly. If
246 set, it means that right-to-left text is being processed. */
247 #define CODING_MODE_DIRECTION 0x08
248
249 #define CODING_MODE_FIXED_DESTINATION 0x10
250
251 #define CODING_MODE_SAFE_ENCODING 0x20
252
253 /* Structure of the field `spec.iso_2022' in the structure
254 `coding_system'. */
255 struct iso_2022_spec
256 {
257 /* Bit-wise-or of CODING_ISO_FLAG_XXX. */
258 unsigned flags;
259
260 /* The current graphic register invoked to each graphic plane. */
261 int current_invocation[2];
262
263 /* The current charset designated to each graphic register. The
264 value -1 means that not charset is designated, -2 means that
265 there was an invalid designation previously. */
266 int current_designation[4];
267
268 /* Set to 1 temporarily only when graphic register 2 or 3 is invoked
269 by single-shift while encoding. */
270 int single_shifting;
271
272 /* Set to 1 temporarily only when processing at beginning of line. */
273 int bol;
274 };
275
276 struct ccl_spec;
277
278 enum utf_16_bom_type
279 {
280 utf_16_detect_bom,
281 utf_16_without_bom,
282 utf_16_with_bom
283 };
284
285 enum utf_16_endian_type
286 {
287 utf_16_big_endian,
288 utf_16_little_endian
289 };
290
291 struct utf_16_spec
292 {
293 enum utf_16_bom_type bom;
294 enum utf_16_endian_type endian;
295 int surrogate;
296 };
297
298 struct coding_detection_info
299 {
300 /* Values of these members are bitwise-OR of CATEGORY_MASK_XXXs. */
301 /* Which categories are already checked. */
302 int checked;
303 /* Which categories are strongly found. */
304 int found;
305 /* Which categories are rejected. */
306 int rejected;
307 };
308
309
310 struct coding_system
311 {
312 /* ID number of the coding system. This is an index to
313 Vcoding_system_hash_table. This value is set by
314 setup_coding_system. At the early stage of building time, this
315 value is -1 in the array coding_categories to indicate that no
316 coding-system of that category is yet defined. */
317 int id;
318
319 /* Flag bits of the coding system. The meaning of each bit is common
320 to all types of coding systems. */
321 int common_flags;
322
323 /* Mode bits of the coding system. See the comments of the macros
324 CODING_MODE_XXX. */
325 unsigned int mode;
326
327 /* Detailed information specific to each type of coding system. */
328 union
329 {
330 struct iso_2022_spec iso_2022;
331 struct ccl_spec *ccl; /* Defined in ccl.h. */
332 struct utf_16_spec utf_16;
333 int emacs_mule_full_support;
334 } spec;
335
336 int max_charset_id;
337 char *safe_charsets;
338
339 /* The following two members specify how binary 8-bit code 128..255
340 are represented in source and destination text respectively. 1
341 means they are represented by 2-byte sequence, 0 means they are
342 represented by 1-byte as is (see the comment in character.h). */
343 unsigned src_multibyte : 1;
344 unsigned dst_multibyte : 1;
345
346 /* How may heading bytes we can skip for decoding. This is set to
347 -1 in setup_coding_system, and updated by detect_coding. So,
348 when this is equal to the byte length of the text being
349 converted, we can skip the actual conversion process. */
350 int head_ascii;
351
352 /* The following members are set by encoding/decoding routine. */
353 EMACS_INT produced, produced_char, consumed, consumed_char;
354
355 /* Number of error source data found in a decoding routine. */
356 int errors;
357
358 /* Store the positions of error source data. */
359 EMACS_INT *error_positions;
360
361 /* Finish status of code conversion. */
362 enum coding_result_code result;
363
364 /* The following members are all Lisp symbols. We don't have to
365 protect them from GC because the current garbage collection
366 doesn't relocate Lisp symbols. But, when it is changed, we must
367 find a way to protect them. */
368
369 EMACS_INT src_pos, src_pos_byte, src_chars, src_bytes;
370 Lisp_Object src_object;
371 const unsigned char *source;
372
373 EMACS_INT dst_pos, dst_pos_byte, dst_bytes;
374 Lisp_Object dst_object;
375 unsigned char *destination;
376
377 int chars_at_source;
378
379 /* If an element is non-negative, it is a character code.
380
381 If it is in the range -128..-1, it is a 8-bit character code
382 minus 256.
383
384 If it is less than -128, it specifies the start of an annotation
385 chunk. The length of the chunk is -128 minus the value of the
386 element. The following elements are OFFSET, ANNOTATION-TYPE, and
387 a sequence of actual data for the annotation. OFFSET is a
388 character position offset from dst_pos or src_pos,
389 ANNOTATION-TYPE specfies the meaning of the annotation and how to
390 handle the following data.. */
391 int *charbuf;
392 int charbuf_size, charbuf_used;
393
394 /* Set to 1 if charbuf contains an annotation. */
395 int annotated;
396
397 unsigned char carryover[64];
398 int carryover_bytes;
399
400 int default_char;
401
402 int (*detector) P_ ((struct coding_system *,
403 struct coding_detection_info *));
404 void (*decoder) P_ ((struct coding_system *));
405 int (*encoder) P_ ((struct coding_system *));
406 };
407
408 /* Meanings of bits in the member `common_flags' of the structure
409 coding_system. The lowest 8 bits are reserved for various kind of
410 annotations (currently two of them are used). */
411 #define CODING_ANNOTATION_MASK 0x00FF
412 #define CODING_ANNOTATE_COMPOSITION_MASK 0x0001
413 #define CODING_ANNOTATE_DIRECTION_MASK 0x0002
414 #define CODING_ANNOTATE_CHARSET_MASK 0x0003
415 #define CODING_FOR_UNIBYTE_MASK 0x0100
416 #define CODING_REQUIRE_FLUSHING_MASK 0x0200
417 #define CODING_REQUIRE_DECODING_MASK 0x0400
418 #define CODING_REQUIRE_ENCODING_MASK 0x0800
419 #define CODING_REQUIRE_DETECTION_MASK 0x1000
420 #define CODING_RESET_AT_BOL_MASK 0x2000
421
422 /* Return 1 if the coding context CODING requires annotaion
423 handling. */
424 #define CODING_REQUIRE_ANNOTATION(coding) \
425 ((coding)->common_flags & CODING_ANNOTATION_MASK)
426
427 /* Return 1 if the coding context CODING prefers decoding into unibyte. */
428 #define CODING_FOR_UNIBYTE(coding) \
429 ((coding)->common_flags & CODING_FOR_UNIBYTE_MASK)
430
431 /* Return 1 if the coding context CODING requires specific code to be
432 attached at the tail of converted text. */
433 #define CODING_REQUIRE_FLUSHING(coding) \
434 ((coding)->common_flags & CODING_REQUIRE_FLUSHING_MASK)
435
436 /* Return 1 if the coding context CODING requires code conversion on
437 decoding. */
438 #define CODING_REQUIRE_DECODING(coding) \
439 ((coding)->dst_multibyte \
440 || (coding)->common_flags & CODING_REQUIRE_DECODING_MASK)
441
442
443 /* Return 1 if the coding context CODING requires code conversion on
444 encoding. */
445 #define CODING_REQUIRE_ENCODING(coding) \
446 ((coding)->src_multibyte \
447 || (coding)->common_flags & CODING_REQUIRE_ENCODING_MASK \
448 || (coding)->mode & CODING_MODE_SELECTIVE_DISPLAY)
449
450
451 /* Return 1 if the coding context CODING requires some kind of code
452 detection. */
453 #define CODING_REQUIRE_DETECTION(coding) \
454 ((coding)->common_flags & CODING_REQUIRE_DETECTION_MASK)
455
456 /* Return 1 if the coding context CODING requires code conversion on
457 decoding or some kind of code detection. */
458 #define CODING_MAY_REQUIRE_DECODING(coding) \
459 (CODING_REQUIRE_DECODING (coding) \
460 || CODING_REQUIRE_DETECTION (coding))
461
462 /* Macros to decode or encode a character of JISX0208 in SJIS. S1 and
463 S2 are the 1st and 2nd position-codes of JISX0208 in SJIS coding
464 system. C1 and C2 are the 1st and 2nd position codes of Emacs'
465 internal format. */
466
467 #define SJIS_TO_JIS(code) \
468 do { \
469 int s1, s2, j1, j2; \
470 \
471 s1 = (code) >> 8, s2 = (code) & 0xFF; \
472 \
473 if (s2 >= 0x9F) \
474 (j1 = s1 * 2 - (s1 >= 0xE0 ? 0x160 : 0xE0), \
475 j2 = s2 - 0x7E); \
476 else \
477 (j1 = s1 * 2 - ((s1 >= 0xE0) ? 0x161 : 0xE1), \
478 j2 = s2 - ((s2 >= 0x7F) ? 0x20 : 0x1F)); \
479 (code) = (j1 << 8) | j2; \
480 } while (0)
481
482
483 #define JIS_TO_SJIS(code) \
484 do { \
485 int s1, s2, j1, j2; \
486 \
487 j1 = (code) >> 8, j2 = (code) & 0xFF; \
488 if (j1 & 1) \
489 (s1 = j1 / 2 + ((j1 < 0x5F) ? 0x71 : 0xB1), \
490 s2 = j2 + ((j2 >= 0x60) ? 0x20 : 0x1F)); \
491 else \
492 (s1 = j1 / 2 + ((j1 < 0x5F) ? 0x70 : 0xB0), \
493 s2 = j2 + 0x7E); \
494 (code) = (s1 << 8) | s2; \
495 } while (0)
496
497
498 /* Encode the file name NAME using the specified coding system
499 for file names, if any. */
500 #define ENCODE_FILE(name) \
501 (! NILP (Vfile_name_coding_system) \
502 && XFASTINT (Vfile_name_coding_system) != 0 \
503 ? code_convert_string_norecord (name, Vfile_name_coding_system, 1) \
504 : (! NILP (Vdefault_file_name_coding_system) \
505 && XFASTINT (Vdefault_file_name_coding_system) != 0 \
506 ? code_convert_string_norecord (name, Vdefault_file_name_coding_system, 1) \
507 : name))
508
509
510 /* Decode the file name NAME using the specified coding system
511 for file names, if any. */
512 #define DECODE_FILE(name) \
513 (! NILP (Vfile_name_coding_system) \
514 && XFASTINT (Vfile_name_coding_system) != 0 \
515 ? code_convert_string_norecord (name, Vfile_name_coding_system, 0) \
516 : (! NILP (Vdefault_file_name_coding_system) \
517 && XFASTINT (Vdefault_file_name_coding_system) != 0 \
518 ? code_convert_string_norecord (name, Vdefault_file_name_coding_system, 0) \
519 : name))
520
521
522 #ifdef WINDOWSNT
523 /* Encode the string STR using the specified coding system
524 for w32 system functions, if any. */
525 #define ENCODE_SYSTEM(str) \
526 (! NILP (Vlocale_coding_system) \
527 && XFASTINT (Vlocale_coding_system) != 0 \
528 ? code_convert_string_norecord (str, Vlocale_coding_system, 1) \
529 : str)
530
531 /* Decode the string STR using the specified coding system
532 for w32 system functions, if any. */
533 #define DECODE_SYSTEM(name) \
534 (! NILP (Vlocale_coding_system) \
535 && XFASTINT (Vlocale_coding_system) != 0 \
536 ? code_convert_string_norecord (str, Vlocale_coding_system, 0) \
537 : str)
538
539 #else /* WINDOWSNT */
540
541 #define ENCODE_SYSTEM(str) string_make_unibyte(str)
542 #define DECODE_SYSTEM(name) name
543
544 #endif /* !WINDOWSNT */
545
546 /* Used by the gtk menu code. Note that this encodes utf-8, not
547 utf-8-emacs, so it's not a no-op. */
548 #define ENCODE_UTF_8(str) code_convert_string_norecord (str, Qutf_8, 1)
549
550 /* Extern declarations. */
551 extern Lisp_Object code_conversion_save P_ ((int, int));
552 extern int decoding_buffer_size P_ ((struct coding_system *, int));
553 extern int encoding_buffer_size P_ ((struct coding_system *, int));
554 extern void setup_coding_system P_ ((Lisp_Object, struct coding_system *));
555 extern void detect_coding P_ ((struct coding_system *));
556 extern Lisp_Object code_convert_region P_ ((Lisp_Object, Lisp_Object,
557 Lisp_Object, Lisp_Object,
558 int, int));
559 extern Lisp_Object code_convert_string P_ ((Lisp_Object, Lisp_Object,
560 Lisp_Object, int, int, int));
561 extern Lisp_Object code_convert_string_norecord P_ ((Lisp_Object, Lisp_Object,
562 int));
563 extern Lisp_Object raw_text_coding_system P_ ((Lisp_Object));
564 extern Lisp_Object coding_inherit_eol_type P_ ((Lisp_Object, Lisp_Object));
565
566 extern int decode_coding_gap P_ ((struct coding_system *,
567 EMACS_INT, EMACS_INT));
568 extern int encode_coding_gap P_ ((struct coding_system *,
569 EMACS_INT, EMACS_INT));
570 extern void decode_coding_object P_ ((struct coding_system *,
571 Lisp_Object, EMACS_INT, EMACS_INT,
572 EMACS_INT, EMACS_INT, Lisp_Object));
573 extern void encode_coding_object P_ ((struct coding_system *,
574 Lisp_Object, EMACS_INT, EMACS_INT,
575 EMACS_INT, EMACS_INT, Lisp_Object));
576
577 #define decode_coding_region(coding, from, to) \
578 decode_coding_object (coding, Fcurrent_buffer (), \
579 from, CHAR_TO_BYTE (from), \
580 to, CHAR_TO_BYTE (to), Fcurrent_buffer ())
581
582
583 #define encode_coding_region(coding, from, to) \
584 encode_coding_object (coding, Fcurrent_buffer (), \
585 from, CHAR_TO_BYTE (from), \
586 to, CHAR_TO_BYTE (to), Fcurrent_buffer ())
587
588
589 #define decode_coding_string(coding, string, nocopy) \
590 decode_coding_object (coding, string, 0, 0, XSTRING (string)->size, \
591 STRING_BYTES (XSTRING (string)), Qt)
592
593 #define encode_coding_string(coding, string, nocopy) \
594 (encode_coding_object (coding, string, 0, 0, XSTRING (string)->size, \
595 STRING_BYTES (XSTRING (string)), Qt), \
596 (coding)->dst_object)
597
598
599 #define decode_coding_c_string(coding, src, bytes, dst_object) \
600 do { \
601 (coding)->source = (src); \
602 (coding)->src_chars = (coding)->src_bytes = (bytes); \
603 decode_coding_object ((coding), Qnil, 0, 0, (bytes), (bytes), \
604 (dst_object)); \
605 } while (0)
606
607
608 extern Lisp_Object preferred_coding_system P_ (());
609
610
611 extern Lisp_Object Qutf_8, Qutf_8_emacs;
612
613 extern Lisp_Object Qcoding_system, Qeol_type, Qcoding_category_index;
614 extern Lisp_Object Qcoding_system_p;
615 extern Lisp_Object Qraw_text, Qemacs_mule, Qno_conversion, Qundecided;
616 extern Lisp_Object Qiso_2022;
617 extern Lisp_Object Qbuffer_file_coding_system;
618
619 extern Lisp_Object Qunix, Qdos, Qmac;
620
621 extern Lisp_Object Qtranslation_table;
622 extern Lisp_Object Qtranslation_table_id;
623
624 /* Mnemonic strings to indicate each type of end-of-line. */
625 extern Lisp_Object eol_mnemonic_unix, eol_mnemonic_dos, eol_mnemonic_mac;
626 /* Mnemonic string to indicate type of end-of-line is not yet decided. */
627 extern Lisp_Object eol_mnemonic_undecided;
628
629 #ifdef emacs
630 extern Lisp_Object Qfile_coding_system;
631 extern Lisp_Object Qcall_process, Qcall_process_region, Qprocess_argument;
632 extern Lisp_Object Qstart_process, Qopen_network_stream;
633 extern Lisp_Object Qwrite_region;
634
635 extern char *emacs_strerror P_ ((int));
636
637 /* Coding-system for reading files and receiving data from process. */
638 extern Lisp_Object Vcoding_system_for_read;
639 /* Coding-system for writing files and sending data to process. */
640 extern Lisp_Object Vcoding_system_for_write;
641 /* Coding-system actually used in the latest I/O. */
642 extern Lisp_Object Vlast_coding_system_used;
643 /* Coding-system to use with system messages (e.g. strerror). */
644 extern Lisp_Object Vlocale_coding_system;
645
646 /* If non-zero, process buffer inherits the coding system used to decode
647 the subprocess output. */
648 extern int inherit_process_coding_system;
649
650 /* Coding-system to be used for encoding terminal output. This
651 structure contains information of a coding-system specified by the
652 function `set-terminal-coding-system'. */
653 extern struct coding_system terminal_coding;
654
655 /* Coding system to be used to encode text for terminal display when
656 terminal coding system is nil. */
657 extern struct coding_system safe_terminal_coding;
658
659 /* Coding-system of what is sent from terminal keyboard. This
660 structure contains information of a coding-system specified by the
661 function `set-keyboard-coding-system'. */
662 extern struct coding_system keyboard_coding;
663
664 /* Default coding systems used for process I/O. */
665 extern Lisp_Object Vdefault_process_coding_system;
666
667 /* Function to call to force a user to force select a propert coding
668 system. */
669 extern Lisp_Object Vselect_safe_coding_system_function;
670
671 /* If nonzero, on writing a file, Vselect_safe_coding_system_function
672 is called even if Vcoding_system_for_write is non-nil. */
673 extern int coding_system_require_warning;
674
675 /* Coding system for file names, or nil if none. */
676 extern Lisp_Object Vfile_name_coding_system;
677
678 /* Coding system for file names used only when
679 Vfile_name_coding_system is nil. */
680 extern Lisp_Object Vdefault_file_name_coding_system;
681
682 #endif
683
684 /* Error signaled when there's a problem with detecting coding system */
685 extern Lisp_Object Qcoding_system_error;
686
687 extern char emacs_mule_bytes[256];
688 extern int emacs_mule_string_char P_ ((unsigned char *));
689
690 #endif /* EMACS_CODING_H */