X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=src%2Ffile-coding.h;h=6d673fa7a92a882543f6695243f9f81603620790;hb=b073ad3949bbab4cf51e6c5de4725bb150b3ad11;hp=ff7046521e292f0871d03fb4d464f8c5b29925f1;hpb=b5eeb6918c29470b36f8461c402eb0c65cb19bd2;p=chise%2Fxemacs-chise.git.1 diff --git a/src/file-coding.h b/src/file-coding.h index ff70465..6d673fa 100644 --- a/src/file-coding.h +++ b/src/file-coding.h @@ -1,6 +1,7 @@ /* Header for code conversion stuff Copyright (C) 1991, 1995 Free Software Foundation, Inc. Copyright (C) 1995 Sun Microsystems, Inc. + Copyright (C) 1999,2000,2002,2005,2012 MORIOKA Tomohiko This file is part of XEmacs. @@ -24,14 +25,14 @@ Boston, MA 02111-1307, USA. */ /* 91.10.09 written by K.Handa */ /* Rewritten by Ben Wing . */ -#ifndef _XEMACS_MULE_CODING_H_ -#define _XEMACS_MULE_CODING_H_ +#ifndef INCLUDED_file_coding_h_ +#define INCLUDED_file_coding_h_ struct decoding_stream; struct encoding_stream; /* Coding system types. These go into the TYPE field of a - struct Lisp_Coding_System. */ + Lisp_Coding_System. */ enum coding_system_type { @@ -44,6 +45,9 @@ enum coding_system_type CODESYS_BIG5, /* BIG5 (used for Taiwanese). */ CODESYS_UCS4, /* ISO 10646 UCS-4 */ CODESYS_UTF8, /* ISO 10646 UTF-8 */ +#ifdef UTF2000 + CODESYS_UTF16, /* ISO 10646 UTF-16 */ +#endif CODESYS_CCL, /* Converter written in CCL. */ #endif CODESYS_NO_CONVERSION /* "No conversion"; used for binary files. @@ -84,7 +88,8 @@ struct Lisp_Coding_System struct lcrecord_header header; /* Name and doc string of this coding system. */ - Lisp_Object name, doc_string; + Lisp_Object name; + Lisp_Object doc_string; /* This is the major type of the coding system -- one of Big5, ISO2022, Shift-JIS, etc. See the constants above. */ @@ -94,14 +99,17 @@ struct Lisp_Coding_System system is active for a particular buffer. */ Lisp_Object mnemonic; - Lisp_Object post_read_conversion, pre_write_conversion; + Lisp_Object post_read_conversion; + Lisp_Object pre_write_conversion; eol_type_t eol_type; /* Subsidiary coding systems that specify a particular type of EOL marking, rather than autodetecting it. These will only be non-nil if (eol_type == EOL_AUTODETECT). */ - Lisp_Object eol_lf, eol_crlf, eol_cr; + Lisp_Object eol_lf; + Lisp_Object eol_crlf; + Lisp_Object eol_cr; #ifdef MULE struct { @@ -130,14 +138,21 @@ struct Lisp_Coding_System { /* For a CCL coding system, these specify the CCL programs used for decoding (input) and encoding (output). */ - Lisp_Object decode, encode; + Lisp_Object decode; + Lisp_Object encode; } ccl; #endif +#ifdef UTF2000 + unsigned int disable_composition :1; + unsigned int enable_decomposition :1; + unsigned int use_entity_reference :1; + Lisp_Object ccs_priority_list; +#endif }; typedef struct Lisp_Coding_System Lisp_Coding_System; -DECLARE_LRECORD (coding_system, struct Lisp_Coding_System); -#define XCODING_SYSTEM(x) XRECORD (x, coding_system, struct Lisp_Coding_System) +DECLARE_LRECORD (coding_system, Lisp_Coding_System); +#define XCODING_SYSTEM(x) XRECORD (x, coding_system, Lisp_Coding_System) #define XSETCODING_SYSTEM(x, p) XSETRECORD (x, p, coding_system) #define CODING_SYSTEMP(x) RECORDP (x, coding_system) #define CHECK_CODING_SYSTEM(x) CHECK_RECORD (x, coding_system) @@ -176,6 +191,16 @@ DECLARE_LRECORD (coding_system, struct Lisp_Coding_System); #define CODING_SYSTEM_CCL_DECODE(codesys) ((codesys)->ccl.decode) #define CODING_SYSTEM_CCL_ENCODE(codesys) ((codesys)->ccl.encode) #endif /* MULE */ +#ifdef UTF2000 +#define CODING_SYSTEM_DISABLE_COMPOSITION(codesys) \ + ((codesys)->disable_composition) +#define CODING_SYSTEM_ENABLE_DECOMPOSITION(codesys) \ + ((codesys)->enable_decomposition) +#define CODING_SYSTEM_USE_ENTITY_REFERENCE(codesys) \ + ((codesys)->use_entity_reference) +#define CODING_SYSTEM_CCS_PRIORITY_LIST(codesys) \ + ((codesys)->ccs_priority_list) +#endif #define XCODING_SYSTEM_NAME(codesys) \ CODING_SYSTEM_NAME (XCODING_SYSTEM (codesys)) @@ -222,6 +247,16 @@ DECLARE_LRECORD (coding_system, struct Lisp_Coding_System); #define XCODING_SYSTEM_CCL_ENCODE(codesys) \ CODING_SYSTEM_CCL_ENCODE (XCODING_SYSTEM (codesys)) #endif /* MULE */ +#ifdef UTF2000 +#define XCODING_SYSTEM_DISABLE_COMPOSITION(codesys) \ + CODING_SYSTEM_DISABLE_COMPOSITION (XCODING_SYSTEM (codesys)) +#define XCODING_SYSTEM_ENABLE_DECOMPOSITION(codesys) \ + CODING_SYSTEM_ENABLE_DECOMPOSITION (XCODING_SYSTEM (codesys)) +#define XCODING_SYSTEM_USE_ENTITY_REFERENCE(codesys) \ + CODING_SYSTEM_USE_ENTITY_REFERENCE (XCODING_SYSTEM (codesys)) +#define XCODING_SYSTEM_CCS_PRIORITY_LIST(codesys) \ + CODING_SYSTEM_CCS_PRIORITY_LIST (XCODING_SYSTEM (codesys)) +#endif EXFUN (Fcoding_category_list, 0); EXFUN (Fcoding_category_system, 1); @@ -251,7 +286,7 @@ EXFUN (Fsubsidiary_coding_system, 2); extern Lisp_Object Qucs4, Qutf8; extern Lisp_Object Qbig5, Qccl, Qcharset_g0; extern Lisp_Object Qcharset_g1, Qcharset_g2, Qcharset_g3, Qcoding_system_error; -extern Lisp_Object Qcoding_systemp, Qcr, Qcrlf, Qctext, Qdecode, Qencode; +extern Lisp_Object Qcoding_systemp, Qcr, Qcrlf, Qdecode, Qencode; extern Lisp_Object Qeol_cr, Qeol_crlf, Qeol_lf, Qeol_type, Qescape_quoted; extern Lisp_Object Qforce_g0_on_output, Qforce_g1_on_output; extern Lisp_Object Qforce_g2_on_output, Qforce_g3_on_output; @@ -403,32 +438,51 @@ enum iso_esc_flag #define ISO_CODE_CSI 0x9B /* control-sequence-introduce */ #endif /* MULE */ -/* For detecting the encoding of text */ +/* Distinguishable categories of encodings. + + This list determines the initial priority of the categories. + + For better or worse, currently Mule files are encoded in 7-bit ISO 2022. + For this reason, under Mule ISO_7 gets highest priority. + + Putting NO_CONVERSION second prevents "binary corruption" in the + default case in all but the (presumably) extremely rare case of a + binary file which contains redundant escape sequences but no 8-bit + characters. + + The remaining priorities are based on perceived "internationalization + political correctness." An exception is UCS-4 at the bottom, since + basically everything is compatible with UCS-4, but it is likely to + be very rare as an external encoding. */ + enum coding_category_type { + /* must be a contiguous range of values 0 -- CODING_CATEGORY_LAST - 1 */ #ifdef MULE - CODING_CATEGORY_SHIFT_JIS, CODING_CATEGORY_ISO_7, /* ISO2022 system using only seven-bit bytes, no locking shift */ - CODING_CATEGORY_ISO_8_DESIGNATE, /* ISO2022 system using eight-bit bytes, - no locking shift, no single shift, - using designation to switch charsets */ + CODING_CATEGORY_NO_CONVERSION, + CODING_CATEGORY_UTF8, CODING_CATEGORY_ISO_8_1, /* ISO2022 system using eight-bit bytes, no locking shift, no designation sequences, one-dimension characters in the upper half. */ CODING_CATEGORY_ISO_8_2, /* ISO2022 system using eight-bit bytes, no locking shift, no designation sequences, two-dimension characters in the upper half. */ + CODING_CATEGORY_ISO_8_DESIGNATE, /* ISO2022 system using eight-bit bytes, + no locking shift, no single shift, + using designation to switch charsets */ CODING_CATEGORY_ISO_LOCK_SHIFT, /* ISO2022 system using locking shift */ + CODING_CATEGORY_SHIFT_JIS, CODING_CATEGORY_BIG5, + CODING_CATEGORY_UTF16, CODING_CATEGORY_UCS4, - CODING_CATEGORY_UTF8, +#else /* not MULE */ + CODING_CATEGORY_NO_CONVERSION, #endif /* MULE */ - CODING_CATEGORY_NO_CONVERSION + CODING_CATEGORY_LAST /* not a real coding category */ }; -#define CODING_CATEGORY_LAST CODING_CATEGORY_NO_CONVERSION - #ifdef MULE #define CODING_CATEGORY_SHIFT_JIS_MASK \ (1 << CODING_CATEGORY_SHIFT_JIS) @@ -446,6 +500,8 @@ enum coding_category_type (1 << CODING_CATEGORY_BIG5) #define CODING_CATEGORY_UCS4_MASK \ (1 << CODING_CATEGORY_UCS4) +#define CODING_CATEGORY_UTF16_MASK \ + (1 << CODING_CATEGORY_UTF16) #define CODING_CATEGORY_UTF8_MASK \ (1 << CODING_CATEGORY_UTF8) #endif @@ -515,5 +571,6 @@ void determine_real_coding_system (Lstream *stream, Lisp_Object *codesys_in_out, #define BUFBYTE_FIRST_BYTE_P(c) ((c) < 0xA0) #define BUFBYTE_LEADING_BYTE_P(c) BYTE_C1_P (c) #endif /* not MULE */ -#endif /* _XEMACS_MULE_CODING_H_ */ + +#endif /* INCLUDED_file_coding_h_ */