编写代码集转换器

本节提供了有关如何使用已解释的概念来编写转换器的信息。

每个转换器都应该定义以下子例程:

  • 实例化 (instantiate)
  • init
  • iconv_exec
  • 图标关闭

特定于转换器的结构应该把核心 iconv 结构作为其第一个元素。 例如:

        typedef struct _LC_example_rec {
            /* Core should be the first element */
                _LC_core_iconv_t        core;
            /* The rest are converter specific data (optional) */
                iconv_t         curcd;
                iconv_t         sb_cd;
                iconv_t         db_cd;
                unsigned char   *cntl;
        } _LC_example_iconv_t;

另一个转换器结构:

        typedef struct _LC_sample_iconv_rec {
                _LC_core_iconv_t        core;
        } _LC_sample_iconv_t;