X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=blobdiff_plain;f=src%2Fiso5428.c;h=f357187ec823db7e55a7d334b74a8ea591f270db;hp=a78b00d3287186cc62a436d79c104e28775ded14;hb=4f3bcae93d51a26709c12b51261c3d95af610cb2;hpb=cccb7ecd623450d5b3ca2391327788c84aed71c8 diff --git a/src/iso5428.c b/src/iso5428.c index a78b00d..f357187 100644 --- a/src/iso5428.c +++ b/src/iso5428.c @@ -1,12 +1,10 @@ -/* - * Copyright (C) 1995-2008, Index Data ApS +/* This file is part of the YAZ toolkit. + * Copyright (C) 1995-2011 Index Data * See the file LICENSE for details. - * - * $Id: siconv.c,v 1.50 2008-03-12 08:53:28 adam Exp $ */ /** * \file - * \brief ISO-5428 character mapping (iconv) + * \brief ISO-5428:1984 encoding and decoding */ #if HAVE_CONFIG_H @@ -16,12 +14,12 @@ #include #include #include -#include #include "iconv-p.h" -unsigned long yaz_read_iso5428_1984(yaz_iconv_t cd, unsigned char *inp, - size_t inbytesleft, size_t *no_read) +static unsigned long read_iso_5428_1984(yaz_iconv_t cd, yaz_iconv_decoder_t d, + unsigned char *inp, + size_t inbytesleft, size_t *no_read) { unsigned long x = 0; int tonos = 0; @@ -270,8 +268,9 @@ unsigned long yaz_read_iso5428_1984(yaz_iconv_t cd, unsigned char *inp, return x; } -size_t yaz_write_iso5428_1984(yaz_iconv_t cd, unsigned long x, - char **outbuf, size_t *outbytesleft) +static size_t write_iso_5428_1984(yaz_iconv_t cd, yaz_iconv_encoder_t en, + unsigned long x, + char **outbuf, size_t *outbytesleft) { size_t k = 0; unsigned char *out = (unsigned char*) *outbuf; @@ -365,11 +364,38 @@ size_t yaz_write_iso5428_1984(yaz_iconv_t cd, unsigned long x, return 0; } +yaz_iconv_encoder_t yaz_iso_5428_encoder(const char *name, + yaz_iconv_encoder_t e) +{ + if (!yaz_matchstr(name, "iso54281984") + || !yaz_matchstr(name, "iso5428:1984")) + { + e->write_handle = write_iso_5428_1984; + return e; + } + return 0; +} + +yaz_iconv_decoder_t yaz_iso_5428_decoder(const char *name, + yaz_iconv_decoder_t d) +{ + if (!yaz_matchstr(name, "iso54281984") + || !yaz_matchstr(name, "iso5428:1984")) + { + d->read_handle = read_iso_5428_1984; + return d; + } + return 0; +} + + /* * Local variables: * c-basic-offset: 4 + * c-file-style: "Stroustrup" * indent-tabs-mode: nil * End: * vim: shiftwidth=4 tabstop=8 expandtab */ +