]> code.delx.au - gnu-emacs/blobdiff - src/coding.h
Replace LUCID_LIBW, MOTIF_LIBW with TOOLKIT_LIBW.
[gnu-emacs] / src / coding.h
index d125d57d02be5e528308f071813f2efa111108ab..f47c33847f963842c0320cdb156192559747141f 100644 (file)
@@ -1,8 +1,8 @@
 /* Header for coding system handler.
    Copyright (C) 2001, 2002, 2003, 2004, 2005,
 /* Header for coding system handler.
    Copyright (C) 2001, 2002, 2003, 2004, 2005,
-                 2006, 2007, 2008  Free Software Foundation, Inc.
+                 2006, 2007, 2008, 2009, 2010  Free Software Foundation, Inc.
    Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
    Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
-     2005, 2006, 2007, 2008
+     2005, 2006, 2007, 2008, 2009, 2010
      National Institute of Advanced Industrial Science and Technology (AIST)
      Registration Number H14PRO021
    Copyright (C) 2003
      National Institute of Advanced Industrial Science and Technology (AIST)
      Registration Number H14PRO021
    Copyright (C) 2003
@@ -56,6 +56,12 @@ enum define_coding_iso2022_arg_index
     coding_arg_iso2022_max
   };
 
     coding_arg_iso2022_max
   };
 
+enum define_coding_utf8_arg_index
+  {
+    coding_arg_utf8_bom = coding_arg_max,
+    coding_arg_utf8_max
+  };
+
 enum define_coding_utf16_arg_index
   {
     coding_arg_utf16_bom = coding_arg_max,
 enum define_coding_utf16_arg_index
   {
     coding_arg_utf16_bom = coding_arg_max,
@@ -148,7 +154,7 @@ enum coding_attr_index
     coding_attr_iso_request,
     coding_attr_iso_flags,
 
     coding_attr_iso_request,
     coding_attr_iso_flags,
 
-    coding_attr_utf_16_bom,
+    coding_attr_utf_bom,
     coding_attr_utf_16_endian,
 
     coding_attr_emacs_mule_full,
     coding_attr_utf_16_endian,
 
     coding_attr_emacs_mule_full,
@@ -300,6 +306,37 @@ enum coding_result_code
    ASCII characters (usually '?') for unsupported characters.  */
 #define CODING_MODE_SAFE_ENCODING              0x20
 
    ASCII characters (usually '?') for unsupported characters.  */
 #define CODING_MODE_SAFE_ENCODING              0x20
 
+  /* For handling composition sequence.  */
+#include "composite.h"
+
+enum composition_state
+  {
+    COMPOSING_NO,
+    COMPOSING_CHAR,
+    COMPOSING_RULE,
+    COMPOSING_COMPONENT_CHAR,
+    COMPOSING_COMPONENT_RULE
+  };
+
+/* Structure for the current composition status.  */
+struct composition_status
+{
+  enum composition_state state;
+  enum composition_method method;
+  int old_form;                  /* 0:pre-21 form, 1:post-21 form */
+  int length;            /* number of elements produced in charbuf */
+  int nchars;            /* number of characters composed */
+  int ncomps;            /* number of composition components */
+  /* Maximum carryover is for the case of COMPOSITION_WITH_RULE_ALTCHARS.
+     See the comment in coding.c.  */
+  int carryover[4              /* annotation header */
+               + MAX_COMPOSITION_COMPONENTS * 3 - 2 /* ALTs and RULEs */
+               + 2                                  /* intermediate -1 -1 */
+               + MAX_COMPOSITION_COMPONENTS         /* CHARs */
+               ];
+};
+
+
 /* Structure of the field `spec.iso_2022' in the structure
    `coding_system'.  */
 struct iso_2022_spec
 /* Structure of the field `spec.iso_2022' in the structure
    `coding_system'.  */
 struct iso_2022_spec
@@ -321,15 +358,30 @@ struct iso_2022_spec
 
   /* Set to 1 temporarily only when processing at beginning of line.  */
   int bol;
 
   /* Set to 1 temporarily only when processing at beginning of line.  */
   int bol;
+
+  /* If positive, we are now scanning CTEXT extended segment.  */
+  int ctext_extended_segment_len;
+
+  /* If nonzero, we are now scanning embedded UTF-8 sequence.  */
+  int embedded_utf_8;
+
+  /* The current composition.  */
+  struct composition_status cmp_status;
+};
+
+struct emacs_mule_spec
+{
+  int full_support;
+  struct composition_status cmp_status;
 };
 
 struct ccl_spec;
 
 };
 
 struct ccl_spec;
 
-enum utf_16_bom_type
+enum utf_bom_type
   {
   {
-    utf_16_detect_bom,
-    utf_16_without_bom,
-    utf_16_with_bom
+    utf_detect_bom,
+    utf_without_bom,
+    utf_with_bom
   };
 
 enum utf_16_endian_type
   };
 
 enum utf_16_endian_type
@@ -340,7 +392,7 @@ enum utf_16_endian_type
 
 struct utf_16_spec
 {
 
 struct utf_16_spec
 {
-  enum utf_16_bom_type bom;
+  enum utf_bom_type bom;
   enum utf_16_endian_type endian;
   int surrogate;
 };
   enum utf_16_endian_type endian;
   int surrogate;
 };
@@ -380,11 +432,12 @@ struct coding_system
       struct iso_2022_spec iso_2022;
       struct ccl_spec *ccl;    /* Defined in ccl.h.  */
       struct utf_16_spec utf_16;
       struct iso_2022_spec iso_2022;
       struct ccl_spec *ccl;    /* Defined in ccl.h.  */
       struct utf_16_spec utf_16;
-      int emacs_mule_full_support;
+      enum utf_bom_type utf_8_bom;
+      struct emacs_mule_spec emacs_mule;
     } spec;
 
   int max_charset_id;
     } spec;
 
   int max_charset_id;
-  char *safe_charsets;
+  unsigned char *safe_charsets;
 
   /* The following two members specify how binary 8-bit code 128..255
      are represented in source and destination text respectively.  1
 
   /* The following two members specify how binary 8-bit code 128..255
      are represented in source and destination text respectively.  1
@@ -577,7 +630,7 @@ struct coding_system
     if (j1 & 1)                                                \
       {                                                        \
        s1 = (j1 <= 0x25 ? 0xF0 + (j1 - 0x21) / 2       \
     if (j1 & 1)                                                \
       {                                                        \
        s1 = (j1 <= 0x25 ? 0xF0 + (j1 - 0x21) / 2       \
-             : j1 <= 0x27 ? 0xF3 + (j1 - 0x2D) / 2     \
+             : j1 <= 0x2F ? 0xF3 + (j1 - 0x2D) / 2     \
              : 0xF5 + (j1 - 0x6F) / 2);                \
        s2 = j2 + ((j2 >= 0x60) ? 0x20 : 0x1F);         \
       }                                                        \
              : 0xF5 + (j1 - 0x6F) / 2);                \
        s2 = j2 + ((j2 >= 0x60) ? 0x20 : 0x1F);         \
       }                                                        \
@@ -643,6 +696,7 @@ extern int decoding_buffer_size P_ ((struct coding_system *, int));
 extern int encoding_buffer_size P_ ((struct coding_system *, int));
 extern void setup_coding_system P_ ((Lisp_Object, struct coding_system *));
 extern Lisp_Object coding_charset_list P_ ((struct coding_system *));
 extern int encoding_buffer_size P_ ((struct coding_system *, int));
 extern void setup_coding_system P_ ((Lisp_Object, struct coding_system *));
 extern Lisp_Object coding_charset_list P_ ((struct coding_system *));
+extern Lisp_Object coding_system_charset_list P_ ((Lisp_Object));
 extern void detect_coding P_ ((struct coding_system *));
 extern Lisp_Object code_convert_region P_ ((Lisp_Object, Lisp_Object,
                                            Lisp_Object, Lisp_Object,
 extern void detect_coding P_ ((struct coding_system *));
 extern Lisp_Object code_convert_region P_ ((Lisp_Object, Lisp_Object,
                                            Lisp_Object, Lisp_Object,
@@ -680,13 +734,14 @@ extern void encode_coding_object P_ ((struct coding_system *,
 
 
 #define decode_coding_string(coding, string, nocopy)                   \
 
 
 #define decode_coding_string(coding, string, nocopy)                   \
-  decode_coding_object (coding, string, 0, 0, XSTRING (string)->size,  \
-                       STRING_BYTES (XSTRING (string)), Qt)
+  decode_coding_object (coding, string, 0, 0, SCHARS (string),         \
+                       SBYTES (string), Qt)
 
 #define encode_coding_string(coding, string, nocopy)                   \
 
 #define encode_coding_string(coding, string, nocopy)                   \
-  (encode_coding_object (coding, string, 0, 0, XSTRING (string)->size, \
-                        STRING_BYTES (XSTRING (string)), Qt),          \
-   (coding)->dst_object)
+  (STRING_MULTIBYTE(string) ?                                          \
+    (encode_coding_object (coding, string, 0, 0, SCHARS (string),      \
+                          SBYTES (string), Qt),                        \
+     (coding)->dst_object) : (string))
 
 
 #define decode_coding_c_string(coding, src, bytes, dst_object)         \
 
 
 #define decode_coding_c_string(coding, src, bytes, dst_object)         \