Writing a code set converter

This section provides information on how to write a converter using the concepts that have already been explained.

Every converter should define the following subroutines:

  • instantiate
  • init
  • iconv_exec
  • iconv_close

The converter-specific structure should have the core iconv structure as its first element. For example:

        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;

Another converter structure:

        typedef struct _LC_sample_iconv_rec {
                _LC_core_iconv_t        core;
        } _LC_sample_iconv_t;