/* Header for coding system handler.
- Ver.1.0
- Copyright (C) 1995 Free Software Foundation, Inc.
- Copyright (C) 1995 Electrotechnical Laboratory, JAPAN.
+ Copyright (C) 1995, 1997 Electrotechnical Laboratory, JAPAN.
+ Licensed to the Free Software Foundation.
This file is part of GNU Emacs.
#include "../src/ccl.h"
#endif
-/*** EMACS' INTERNAL FORMAT section ***/
+/*** EMACS' INTERNAL FORMAT (emacs-mule) section ***/
/* All code (1-byte) of Emacs' internal format is classified into one
of the followings. See also `charset.h'. */
/* If set, do not produce ISO6429's direction specifying sequence. */
#define CODING_FLAG_ISO_NO_DIRECTION 0x0100
+/* If set, assume designation states are reset at beginning of line on
+ output. */
+#define CODING_FLAG_ISO_INIT_AT_BOL 0x0200
+
+/* If set, designation sequence should be placed at beginning of line
+ on output. */
+#define CODING_FLAG_ISO_DESIGNATE_AT_BOL 0x0400
+
+/* If set, do not encode unexpected charactes on output. */
+#define CODING_FLAG_ISO_SAFE 0x0800
+
+/* A character to be produced on output if encoding of the original
+ character is prohibited by CODING_FLAG_ISO_SAFE. */
+#define CODING_INHIBIT_CHARACTER_SUBSTITUTION 077 /* `?' */
+
/* Structure of the field `spec.iso2022' in the structure `coding_system'. */
struct iso2022_spec
{
int initial_designation[4];
/* A graphic register to which each charset should be designated. */
- int requested_designation[MAX_CHARSET];
+ unsigned char requested_designation[MAX_CHARSET + 1];
/* Set to 1 temporarily only when graphic register 2 or 3 is invoked
by single-shift while encoding. */
int single_shifting;
+
+ /* Set to 1 temporarily only when processing at beginning of line. */
+ int bol;
};
/* Macros to access each field in the structure `spec.iso2022'. */
coding->spec.iso2022.initial_designation[reg]
#define CODING_SPEC_ISO_REQUESTED_DESIGNATION(coding, charset) \
coding->spec.iso2022.requested_designation[charset]
-
-/* Set to 1 temporarily only when encoding a character with
- single-shift function. */
#define CODING_SPEC_ISO_SINGLE_SHIFTING(coding) \
coding->spec.iso2022.single_shifting
+#define CODING_SPEC_ISO_BOL(coding) \
+ coding->spec.iso2022.bol
+
+/* A value which may appear in
+ coding->spec.iso2022.requested_designation indicating that the
+ corresponding charset does not request any graphic register to be
+ designated. */
+#define CODING_SPEC_ISO_NO_REQUESTED_DESIGNATION 4
/* Return a charset which is currently designated to the graphic plane
PLANE in the coding-system CODING. */
-#define CODING_SPEC_ISO_PLANE_CHARSET(coding, plane) \
- CODING_SPEC_ISO_DESIGNATION \
- (coding, CODING_SPEC_ISO_INVOCATION (coding, plane))
+#define CODING_SPEC_ISO_PLANE_CHARSET(coding, plane) \
+ ((CODING_SPEC_ISO_INVOCATION (coding, plane) < 0) \
+ ? -1 \
+ : CODING_SPEC_ISO_DESIGNATION (coding, \
+ CODING_SPEC_ISO_INVOCATION (coding, plane)))
/*** BIG5 section ***/
coding_type_no_conversion, /* A coding system which requires no
conversion for reading and writing
including end-of-line format. */
- coding_type_internal, /* A coding system used in Emacs'
+ coding_type_emacs_mule, /* A coding system used in Emacs'
buffer and string. Requires no
conversion for reading and writing
except for end-of-line format. */
- coding_type_automatic, /* A coding system which requires
+ coding_type_undecided, /* A coding system which requires
automatic detection of a real
coding system. */
coding_type_sjis, /* SJIS coding system for Japanese. */
#define CODING_EOL_CRLF 1 /* Sequence of carriage-return and
line-feed. */
#define CODING_EOL_CR 2 /* Carriage-return only. */
-#define CODING_EOL_AUTOMATIC 3 /* This value is used to denote the
+#define CODING_EOL_UNDECIDED 3 /* This value is used to denote the
eol-type is not yet decided. */
/* Character composition status while encoding/decoding. */
additional conversion. */
Lisp_Object pre_write_conversion;
+ /* Character unification tables to look up, or nil. */
+ Lisp_Object character_unification_table_for_decode;
+ Lisp_Object character_unification_table_for_encode;
+
/* Carryover yielded by decoding/encoding incomplete source. No
coding-system yields more than 7-byte of carryover. This does
not include a text which is not processed because of short of
int carryover_size;
};
-/* Return 1 if the coding-system CODING requires conversion of
- representation of a visible character (text). */
-#define CODING_REQUIRE_TEXT_CONVERSION(coding) \
- ((coding)->type != coding_type_no_conversion \
- && (coding)->type != coding_type_internal)
+/* Return 1 if coding system CODING never requires any code conversion. */
+#define CODING_REQUIRE_NO_CONVERSION(coding) \
+ (((coding)->type == coding_type_no_conversion \
+ || (coding)->type == coding_type_emacs_mule) \
+ && (coding)->eol_type == CODING_EOL_LF)
-/* Return 1 if the coding-system CODING requires conversion of the
- format of end-of-line. */
-#define CODING_REQUIRE_EOL_CONVERSION(coding) \
- ((coding)->eol_type != CODING_EOL_AUTOMATIC \
- && (coding)->eol_type != CODING_EOL_LF)
-
-/* Return 1 if the coding-system CODING requires some conversion. */
-#define CODING_REQUIRE_CONVERSION(coding) \
- (CODING_REQUIRE_TEXT_CONVERSION (coding) \
- || CODING_REQUIRE_EOL_CONVERSION (coding))
+/* Return 1 if coding system CODING may not require code conversion. */
+#define CODING_MAY_REQUIRE_NO_CONVERSION(coding) \
+ (((coding)->type == coding_type_no_conversion \
+ || (coding)->type == coding_type_emacs_mule \
+ || (coding)->type == coding_type_undecided) \
+ && ((coding)->eol_type == CODING_EOL_LF \
+ || (coding)->eol_type == CODING_EOL_UNDECIDED))
/* Index for each coding category in `coding_category_table' */
-#define CODING_CATEGORY_IDX_INTERNAL 0
+#define CODING_CATEGORY_IDX_EMACS_MULE 0
#define CODING_CATEGORY_IDX_SJIS 1
#define CODING_CATEGORY_IDX_ISO_7 2
#define CODING_CATEGORY_IDX_ISO_8_1 3
#define CODING_CATEGORY_IDX_ISO_8_2 4
-#define CODING_CATEGORY_IDX_ISO_ELSE 5
-#define CODING_CATEGORY_IDX_BIG5 6
-#define CODING_CATEGORY_IDX_BINARY 7
-#define CODING_CATEGORY_IDX_MAX 8
+#define CODING_CATEGORY_IDX_ISO_7_ELSE 5
+#define CODING_CATEGORY_IDX_ISO_8_ELSE 6
+#define CODING_CATEGORY_IDX_BIG5 7
+#define CODING_CATEGORY_IDX_BINARY 8
+#define CODING_CATEGORY_IDX_MAX 9
/* Definitions of flag bits returned by the function
detect_coding_mask (). */
-#define CODING_CATEGORY_MASK_INTERNAL (1 << CODING_CATEGORY_IDX_INTERNAL)
+#define CODING_CATEGORY_MASK_EMACS_MULE (1 << CODING_CATEGORY_IDX_EMACS_MULE)
#define CODING_CATEGORY_MASK_SJIS (1 << CODING_CATEGORY_IDX_SJIS)
#define CODING_CATEGORY_MASK_ISO_7 (1 << CODING_CATEGORY_IDX_ISO_7)
#define CODING_CATEGORY_MASK_ISO_8_1 (1 << CODING_CATEGORY_IDX_ISO_8_1)
#define CODING_CATEGORY_MASK_ISO_8_2 (1 << CODING_CATEGORY_IDX_ISO_8_2)
-#define CODING_CATEGORY_MASK_ISO_ELSE (1 << CODING_CATEGORY_IDX_ISO_ELSE)
+#define CODING_CATEGORY_MASK_ISO_7_ELSE (1 << CODING_CATEGORY_IDX_ISO_7_ELSE)
+#define CODING_CATEGORY_MASK_ISO_8_ELSE (1 << CODING_CATEGORY_IDX_ISO_8_ELSE)
#define CODING_CATEGORY_MASK_BIG5 (1 << CODING_CATEGORY_IDX_BIG5)
+#define CODING_CATEGORY_MASK_BINARY (1 << CODING_CATEGORY_IDX_BINARY)
/* This value is returned if detect_coding_mask () find nothing other
than ASCII characters. */
#define CODING_CATEGORY_MASK_ANY \
- ( CODING_CATEGORY_MASK_INTERNAL \
+ ( CODING_CATEGORY_MASK_EMACS_MULE \
| CODING_CATEGORY_MASK_SJIS \
| CODING_CATEGORY_MASK_ISO_7 \
| CODING_CATEGORY_MASK_ISO_8_1 \
| CODING_CATEGORY_MASK_ISO_8_2 \
- | CODING_CATEGORY_MASK_ISO_ELSE \
+ | CODING_CATEGORY_MASK_ISO_7_ELSE \
+ | CODING_CATEGORY_MASK_ISO_8_ELSE \
| CODING_CATEGORY_MASK_BIG5)
/* Macros to decode or encode a character of JISX0208 in SJIS. S1 and
extern char *conversion_buffer, *get_conversion_buffer ();
extern Lisp_Object Fcheck_coding_system ();
extern Lisp_Object Qcoding_system, Qeol_type, Qcoding_category_index;
+extern Lisp_Object Qemacs_mule;
extern Lisp_Object Qbuffer_file_coding_system;
extern Lisp_Object Vcoding_category_list;
function `set-terminal-coding-system'. */
extern struct coding_system terminal_coding;
+/* Coding system to be used to encode text for terminal display when
+ terminal coding system is nil. */
+extern struct coding_system safe_terminal_coding;
+
/* Coding-system of what is sent from terminal keyboard. This
structure contains information of a coding-system specified by the
function `set-keyboard-coding-system'. */
extern struct coding_system keyboard_coding;
-extern Lisp_Object Vcoding_system_alist;
+/* Default coding systems used for process I/O. */
+extern Lisp_Object Vdefault_process_coding_system;
#endif