Annotation of embedaddon/libiconv/lib/converters.h, revision 1.1

1.1     ! misho       1: /*
        !             2:  * Copyright (C) 1999-2002, 2004-2009 Free Software Foundation, Inc.
        !             3:  * This file is part of the GNU LIBICONV Library.
        !             4:  *
        !             5:  * The GNU LIBICONV Library is free software; you can redistribute it
        !             6:  * and/or modify it under the terms of the GNU Library General Public
        !             7:  * License as published by the Free Software Foundation; either version 2
        !             8:  * of the License, or (at your option) any later version.
        !             9:  *
        !            10:  * The GNU LIBICONV Library is distributed in the hope that it will be
        !            11:  * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
        !            12:  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
        !            13:  * Library General Public License for more details.
        !            14:  *
        !            15:  * You should have received a copy of the GNU Library General Public
        !            16:  * License along with the GNU LIBICONV Library; see the file COPYING.LIB.
        !            17:  * If not, write to the Free Software Foundation, Inc., 51 Franklin Street,
        !            18:  * Fifth Floor, Boston, MA 02110-1301, USA.
        !            19:  */
        !            20: 
        !            21: /* This file defines all the converters. */
        !            22: 
        !            23: 
        !            24: /* Our own notion of wide character, as UCS-4, according to ISO-10646-1. */
        !            25: typedef unsigned int ucs4_t;
        !            26: 
        !            27: /* State used by a conversion. 0 denotes the initial state. */
        !            28: typedef unsigned int state_t;
        !            29: 
        !            30: /* iconv_t is an opaque type. This is the real iconv_t type. */
        !            31: typedef struct conv_struct * conv_t;
        !            32: 
        !            33: /*
        !            34:  * Data type for conversion multibyte -> unicode
        !            35:  */
        !            36: struct mbtowc_funcs {
        !            37:   int (*xxx_mbtowc) (conv_t conv, ucs4_t *pwc, unsigned char const *s, int n);
        !            38:   /*
        !            39:    * int xxx_mbtowc (conv_t conv, ucs4_t *pwc, unsigned char const *s, int n)
        !            40:    * converts the byte sequence starting at s to a wide character. Up to n bytes
        !            41:    * are available at s. n is >= 1.
        !            42:    * Result is number of bytes consumed (if a wide character was read),
        !            43:    * or -1 if invalid, or -2 if n too small, or -2-(number of bytes consumed)
        !            44:    * if only a shift sequence was read.
        !            45:    */
        !            46:   int (*xxx_flushwc) (conv_t conv, ucs4_t *pwc);
        !            47:   /*
        !            48:    * int xxx_flushwc (conv_t conv, ucs4_t *pwc)
        !            49:    * returns to the initial state and stores the pending wide character, if any.
        !            50:    * Result is 1 (if a wide character was read) or 0 if none was pending.
        !            51:    */
        !            52: };
        !            53: 
        !            54: /* Return code if invalid input after a shift sequence of n bytes was read.
        !            55:    (xxx_mbtowc) */
        !            56: #define RET_SHIFT_ILSEQ(n)  (-1-2*(n))
        !            57: /* Return code if invalid. (xxx_mbtowc) */
        !            58: #define RET_ILSEQ           RET_SHIFT_ILSEQ(0)
        !            59: /* Return code if only a shift sequence of n bytes was read. (xxx_mbtowc) */
        !            60: #define RET_TOOFEW(n)       (-2-2*(n))
        !            61: /* Retrieve the n from the encoded RET_... value. */
        !            62: #define DECODE_SHIFT_ILSEQ(r)  ((unsigned int)(RET_SHIFT_ILSEQ(0) - (r)) / 2)
        !            63: #define DECODE_TOOFEW(r)       ((unsigned int)(RET_TOOFEW(0) - (r)) / 2)
        !            64: 
        !            65: /*
        !            66:  * Data type for conversion unicode -> multibyte
        !            67:  */
        !            68: struct wctomb_funcs {
        !            69:   int (*xxx_wctomb) (conv_t conv, unsigned char *r, ucs4_t wc, int n);
        !            70:   /*
        !            71:    * int xxx_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n)
        !            72:    * converts the wide character wc to the character set xxx, and stores the
        !            73:    * result beginning at r. Up to n bytes may be written at r. n is >= 1.
        !            74:    * Result is number of bytes written, or -1 if invalid, or -2 if n too small.
        !            75:    */
        !            76:   int (*xxx_reset) (conv_t conv, unsigned char *r, int n);
        !            77:   /*
        !            78:    * int xxx_reset (conv_t conv, unsigned char *r, int n)
        !            79:    * stores a shift sequences returning to the initial state beginning at r.
        !            80:    * Up to n bytes may be written at r. n is >= 0.
        !            81:    * Result is number of bytes written, or -2 if n too small.
        !            82:    */
        !            83: };
        !            84: 
        !            85: /* Return code if invalid. (xxx_wctomb) */
        !            86: #define RET_ILUNI      -1
        !            87: /* Return code if output buffer is too small. (xxx_wctomb, xxx_reset) */
        !            88: #define RET_TOOSMALL   -2
        !            89: 
        !            90: /*
        !            91:  * Contents of a conversion descriptor.
        !            92:  */
        !            93: struct conv_struct {
        !            94:   struct loop_funcs lfuncs;
        !            95:   /* Input (conversion multibyte -> unicode) */
        !            96:   int iindex;
        !            97:   struct mbtowc_funcs ifuncs;
        !            98:   state_t istate;
        !            99:   /* Output (conversion unicode -> multibyte) */
        !           100:   int oindex;
        !           101:   struct wctomb_funcs ofuncs;
        !           102:   int oflags;
        !           103:   state_t ostate;
        !           104:   /* Operation flags */
        !           105:   int transliterate;
        !           106:   int discard_ilseq;
        !           107:   #ifndef LIBICONV_PLUG
        !           108:   struct iconv_fallbacks fallbacks;
        !           109:   struct iconv_hooks hooks;
        !           110:   #endif
        !           111: };
        !           112: 
        !           113: /*
        !           114:  * Include all the converters.
        !           115:  */
        !           116: 
        !           117: #include "ascii.h"
        !           118: 
        !           119: /* General multi-byte encodings */
        !           120: #include "utf8.h"
        !           121: #include "ucs2.h"
        !           122: #include "ucs2be.h"
        !           123: #include "ucs2le.h"
        !           124: #include "ucs4.h"
        !           125: #include "ucs4be.h"
        !           126: #include "ucs4le.h"
        !           127: #include "utf16.h"
        !           128: #include "utf16be.h"
        !           129: #include "utf16le.h"
        !           130: #include "utf32.h"
        !           131: #include "utf32be.h"
        !           132: #include "utf32le.h"
        !           133: #include "utf7.h"
        !           134: #include "ucs2internal.h"
        !           135: #include "ucs2swapped.h"
        !           136: #include "ucs4internal.h"
        !           137: #include "ucs4swapped.h"
        !           138: #include "c99.h"
        !           139: #include "java.h"
        !           140: 
        !           141: /* 8-bit encodings */
        !           142: #include "iso8859_1.h"
        !           143: #include "iso8859_2.h"
        !           144: #include "iso8859_3.h"
        !           145: #include "iso8859_4.h"
        !           146: #include "iso8859_5.h"
        !           147: #include "iso8859_6.h"
        !           148: #include "iso8859_7.h"
        !           149: #include "iso8859_8.h"
        !           150: #include "iso8859_9.h"
        !           151: #include "iso8859_10.h"
        !           152: #include "iso8859_11.h"
        !           153: #include "iso8859_13.h"
        !           154: #include "iso8859_14.h"
        !           155: #include "iso8859_15.h"
        !           156: #include "iso8859_16.h"
        !           157: #include "koi8_r.h"
        !           158: #include "koi8_u.h"
        !           159: #include "koi8_ru.h"
        !           160: #include "cp1250.h"
        !           161: #include "cp1251.h"
        !           162: #include "cp1252.h"
        !           163: #include "cp1253.h"
        !           164: #include "cp1254.h"
        !           165: #include "cp1255.h"
        !           166: #include "cp1256.h"
        !           167: #include "cp1257.h"
        !           168: #include "cp1258.h"
        !           169: #include "cp850.h"
        !           170: #include "cp862.h"
        !           171: #include "cp866.h"
        !           172: #include "cp1131.h"
        !           173: #include "mac_roman.h"
        !           174: #include "mac_centraleurope.h"
        !           175: #include "mac_iceland.h"
        !           176: #include "mac_croatian.h"
        !           177: #include "mac_romania.h"
        !           178: #include "mac_cyrillic.h"
        !           179: #include "mac_ukraine.h"
        !           180: #include "mac_greek.h"
        !           181: #include "mac_turkish.h"
        !           182: #include "mac_hebrew.h"
        !           183: #include "mac_arabic.h"
        !           184: #include "mac_thai.h"
        !           185: #include "hp_roman8.h"
        !           186: #include "nextstep.h"
        !           187: #include "armscii_8.h"
        !           188: #include "georgian_academy.h"
        !           189: #include "georgian_ps.h"
        !           190: #include "koi8_t.h"
        !           191: #include "pt154.h"
        !           192: #include "rk1048.h"
        !           193: #include "mulelao.h"
        !           194: #include "cp1133.h"
        !           195: #include "tis620.h"
        !           196: #include "cp874.h"
        !           197: #include "viscii.h"
        !           198: #include "tcvn.h"
        !           199: 
        !           200: /* CJK character sets [CCS = coded character set] [CJKV.INF chapter 3] */
        !           201: 
        !           202: typedef struct {
        !           203:   unsigned short indx; /* index into big table */
        !           204:   unsigned short used; /* bitmask of used entries */
        !           205: } Summary16;
        !           206: 
        !           207: #include "iso646_jp.h"
        !           208: #include "jisx0201.h"
        !           209: #include "jisx0208.h"
        !           210: #include "jisx0212.h"
        !           211: 
        !           212: #include "iso646_cn.h"
        !           213: #include "gb2312.h"
        !           214: #include "isoir165.h"
        !           215: /*#include "gb12345.h"*/
        !           216: #include "gbk.h"
        !           217: #include "cns11643.h"
        !           218: #include "big5.h"
        !           219: 
        !           220: #include "ksc5601.h"
        !           221: #include "johab_hangul.h"
        !           222: 
        !           223: /* CJK encodings [CES = character encoding scheme] [CJKV.INF chapter 4] */
        !           224: 
        !           225: #include "euc_jp.h"
        !           226: #include "sjis.h"
        !           227: #include "cp932.h"
        !           228: #include "iso2022_jp.h"
        !           229: #include "iso2022_jp1.h"
        !           230: #include "iso2022_jp2.h"
        !           231: 
        !           232: #include "euc_cn.h"
        !           233: #include "ces_gbk.h"
        !           234: #include "cp936.h"
        !           235: #include "gb18030.h"
        !           236: #include "iso2022_cn.h"
        !           237: #include "iso2022_cnext.h"
        !           238: #include "hz.h"
        !           239: #include "euc_tw.h"
        !           240: #include "ces_big5.h"
        !           241: #include "cp950.h"
        !           242: #include "big5hkscs1999.h"
        !           243: #include "big5hkscs2001.h"
        !           244: #include "big5hkscs2004.h"
        !           245: 
        !           246: #include "euc_kr.h"
        !           247: #include "cp949.h"
        !           248: #include "johab.h"
        !           249: #include "iso2022_kr.h"
        !           250: 
        !           251: /* Encodings used by system dependent locales. */
        !           252: 
        !           253: #ifdef USE_AIX
        !           254: #include "cp856.h"
        !           255: #include "cp922.h"
        !           256: #include "cp943.h"
        !           257: #include "cp1046.h"
        !           258: #include "cp1124.h"
        !           259: #include "cp1129.h"
        !           260: #include "cp1161.h"
        !           261: #include "cp1162.h"
        !           262: #include "cp1163.h"
        !           263: #endif
        !           264: 
        !           265: #ifdef USE_OSF1
        !           266: #include "dec_kanji.h"
        !           267: #include "dec_hanyu.h"
        !           268: #endif
        !           269: 
        !           270: #ifdef USE_DOS
        !           271: #include "cp437.h"
        !           272: #include "cp737.h"
        !           273: #include "cp775.h"
        !           274: #include "cp852.h"
        !           275: #include "cp853.h"
        !           276: #include "cp855.h"
        !           277: #include "cp857.h"
        !           278: #include "cp858.h"
        !           279: #include "cp860.h"
        !           280: #include "cp861.h"
        !           281: #include "cp863.h"
        !           282: #include "cp864.h"
        !           283: #include "cp865.h"
        !           284: #include "cp869.h"
        !           285: #include "cp1125.h"
        !           286: #endif
        !           287: 
        !           288: #ifdef USE_EXTRA
        !           289: #include "euc_jisx0213.h"
        !           290: #include "shift_jisx0213.h"
        !           291: #include "iso2022_jp3.h"
        !           292: #include "big5_2003.h"
        !           293: #include "tds565.h"
        !           294: #include "atarist.h"
        !           295: #include "riscos1.h"
        !           296: #endif
        !           297: 

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>