YAZ
5.34.0
|
Implements simple ICONV. More...
#include <assert.h>
#include <errno.h>
#include <string.h>
#include <yaz/xmalloc.h>
#include "iconv-p.h"
Go to the source code of this file.
Data Structures | |
struct | yaz_iconv_struct |
Functions | |
int | yaz_iconv_isbuiltin (yaz_iconv_t cd) |
tests whether conversion is handled by YAZ' iconv or system iconv More... | |
static int | prepare_encoders (yaz_iconv_t cd, const char *tocode) |
static int | prepare_decoders (yaz_iconv_t cd, const char *tocode) |
yaz_iconv_t | yaz_iconv_open (const char *tocode, const char *fromcode) |
just like iconv_open(3) More... | |
size_t | yaz_iconv (yaz_iconv_t cd, char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft) |
just like iconv(3) More... | |
int | yaz_iconv_error (yaz_iconv_t cd) |
returns last error - like errno for iconv(3) More... | |
int | yaz_iconv_close (yaz_iconv_t cd) |
just like iconv_close(3) More... | |
void | yaz_iconv_set_errno (yaz_iconv_t cd, int no) |
Implements simple ICONV.
This implements an interface similar to that of iconv and is used by YAZ to interface with iconv (if present). For systems where iconv is not present, this layer provides a few important conversions: UTF-8, MARC-8, Latin-1.
Definition in file siconv.c.
|
static |
Definition at line 72 of file siconv.c.
References yaz_iconv_struct::decoder, yaz_advancegreek_decoder(), yaz_danmarc_decoder(), yaz_iso5426_decoder(), yaz_iso_5428_decoder(), yaz_iso_8859_1_decoder(), yaz_marc8_decoder(), yaz_ucs4_decoder(), yaz_utf8_decoder(), and yaz_wchar_decoder().
Referenced by yaz_iconv_open().
|
static |
Definition at line 51 of file siconv.c.
References yaz_iconv_struct::encoder, yaz_advancegreek_encoder(), yaz_danmarc_encoder(), yaz_iso_5428_encoder(), yaz_iso_8859_1_encoder(), yaz_marc8_encoder(), yaz_ucs4_encoder(), yaz_utf8_encoder(), and yaz_wchar_encoder().
Referenced by yaz_iconv_open().
size_t yaz_iconv | ( | yaz_iconv_t | cd, |
char ** | inbuf, | ||
size_t * | inbytesleft, | ||
char ** | outbuf, | ||
size_t * | outbytesleft | ||
) |
just like iconv(3)
Definition at line 146 of file siconv.c.
References yaz_iconv_struct::decoder, yaz_iconv_struct::encoder, yaz_iconv_encoder_s::flush_handle, yaz_iconv_struct::init_flag, yaz_iconv_encoder_s::init_handle, yaz_iconv_decoder_s::init_handle, yaz_iconv_struct::my_errno, yaz_iconv_struct::no_read_x, yaz_iconv_decoder_s::read_handle, yaz_iconv_struct::unget_x, yaz_iconv_encoder_s::write_handle, yaz_errno(), YAZ_ICONV_E2BIG, YAZ_ICONV_EILSEQ, YAZ_ICONV_EINVAL, and YAZ_ICONV_UNKNOWN.
Referenced by cdata_one_character(), odr_iconv_string(), odr_reset(), wrbuf_iconv_reset(), and wrbuf_iconv_write2().
int yaz_iconv_close | ( | yaz_iconv_t | cd | ) |
just like iconv_close(3)
Definition at line 284 of file siconv.c.
References yaz_iconv_struct::decoder, yaz_iconv_decoder_s::destroy_handle, yaz_iconv_encoder_s::destroy_handle, yaz_iconv_struct::encoder, and xfree.
Referenced by construct_marc(), convert_marc(), odr_destroy(), odr_set_charset(), process_searchRequest(), return_marc_record(), return_opac_record(), return_string_record(), yaz_iconv_open(), yaz_record_conv_opac_record(), Z3950_send_search(), and ZOOM_connection_Z3950_send_scan().
int yaz_iconv_error | ( | yaz_iconv_t | cd | ) |
returns last error - like errno for iconv(3)
Definition at line 279 of file siconv.c.
References yaz_iconv_struct::my_errno.
Referenced by wrbuf_iconv_write2(), and yaz_write_marc8_generic().
int yaz_iconv_isbuiltin | ( | yaz_iconv_t | cd | ) |
tests whether conversion is handled by YAZ' iconv or system iconv
Definition at line 45 of file siconv.c.
References yaz_iconv_struct::decoder, yaz_iconv_struct::encoder, yaz_iconv_decoder_s::read_handle, and yaz_iconv_encoder_s::write_handle.
yaz_iconv_t yaz_iconv_open | ( | const char * | tocode, |
const char * | fromcode | ||
) |
just like iconv_open(3)
Definition at line 95 of file siconv.c.
References yaz_iconv_encoder_s::data, yaz_iconv_decoder_s::data, yaz_iconv_struct::decoder, yaz_iconv_decoder_s::destroy_handle, yaz_iconv_encoder_s::destroy_handle, yaz_iconv_struct::encoder, yaz_iconv_encoder_s::flush_handle, yaz_iconv_struct::init_flag, yaz_iconv_encoder_s::init_handle, yaz_iconv_decoder_s::init_handle, yaz_iconv_struct::my_errno, prepare_decoders(), prepare_encoders(), yaz_iconv_decoder_s::read_handle, yaz_iconv_encoder_s::write_handle, xmalloc, yaz_iconv_close(), and YAZ_ICONV_UNKNOWN.
Referenced by construct_marc(), convert_marc(), iconv_create_charset(), odr_set_charset(), process_searchRequest(), retrieve_fetch(), yaz_record_conv_opac_record(), Z3950_send_search(), and ZOOM_connection_Z3950_send_scan().
void yaz_iconv_set_errno | ( | yaz_iconv_t | cd, |
int | no | ||
) |
Definition at line 298 of file siconv.c.
References yaz_iconv_struct::my_errno.
Referenced by flush_combos(), flush_iso_8859_1(), init_utf8(), lookup_marc8(), read_advancegreek(), read_danmarc(), read_iso5426(), read_iso_5428_1984(), read_marc8(), read_UCS4(), read_UCS4LE(), read_useq(), read_utf8(), write1(), write_advancegreek(), write_iso_5428_1984(), write_iso_8859_1(), write_UCS4(), write_UCS4LE(), write_UTF8(), yaz_read_iso5426_comb(), yaz_read_marc8_comb(), yaz_write_marc8_2(), and yaz_write_marc8_page_chr().