From: Adam Dickmeiss Date: Sun, 6 Nov 2005 01:28:09 +0000 (+0000) Subject: Remove no longer used MARC-8 conversion code X-Git-Tag: YAZ.2.1.10~22 X-Git-Url: http://jsfdemo.indexdata.com/cgi-bin?a=commitdiff_plain;h=a51e14df3987e0c5328d0379c059b772aa4976fa;p=yaz-moved-to-github.git Remove no longer used MARC-8 conversion code --- diff --git a/src/siconv.c b/src/siconv.c index 285d644..9e5393b 100644 --- a/src/siconv.c +++ b/src/siconv.c @@ -2,7 +2,7 @@ * Copyright (C) 1995-2005, Index Data ApS * See the file LICENSE for details. * - * $Id: siconv.c,v 1.14 2005-10-28 18:36:58 adam Exp $ + * $Id: siconv.c,v 1.15 2005-11-06 01:28:09 adam Exp $ */ /** * \file siconv.c @@ -50,8 +50,6 @@ unsigned long yaz_marc8_8_conv (unsigned char *inp, size_t inbytesleft, unsigned long yaz_marc8_9_conv (unsigned char *inp, size_t inbytesleft, size_t *no_read, int *combining); -#define NEW_COMB 1 - struct yaz_iconv_struct { int my_errno; int init_flag; @@ -63,15 +61,11 @@ struct yaz_iconv_struct { char **outbuf, size_t *outbytesleft, int last); int marc8_esc_mode; -#if NEW_COMB + int comb_offset; int comb_size; unsigned long comb_x[8]; size_t comb_no_read[8]; -#else - int marc8_comb_x; - int marc8_comb_no_read; -#endif size_t no_read_x; unsigned long unget_x; #if HAVE_ICONV_H @@ -253,7 +247,6 @@ static unsigned long yaz_read_wchar_t (yaz_iconv_t cd, unsigned char *inp, #endif -#if NEW_COMB static unsigned long yaz_read_marc8_comb (yaz_iconv_t cd, unsigned char *inp, size_t inbytesleft, size_t *no_read, int *comb); @@ -272,8 +265,10 @@ static unsigned long yaz_read_marc8 (yaz_iconv_t cd, unsigned char *inp, We'll increment the no_read counter by 1, since we want to skip over the processing of the closing ligature character */ +#if 0 if (x == 0x0361 || x == 0x0360) *no_read += 1; +#endif cd->comb_offset++; return x; } @@ -368,108 +363,6 @@ static unsigned long yaz_read_marc8_comb (yaz_iconv_t cd, unsigned char *inp, return x; } } -#else -static unsigned long yaz_read_marc8 (yaz_iconv_t cd, unsigned char *inp, - size_t inbytesleft, size_t *no_read) -{ - if (cd->marc8_comb_x) - { - unsigned long x = cd->marc8_comb_x; - *no_read = cd->marc8_comb_no_read; - cd->marc8_comb_x = 0; - return x; - } - *no_read = 0; - while(inbytesleft >= 1 && inp[0] == 27) - { - size_t inbytesleft0 = inbytesleft; - inp++; - inbytesleft--; - while(inbytesleft > 0 && strchr("(,$!", *inp)) - { - inbytesleft--; - inp++; - } - if (inbytesleft <= 0) - { - *no_read = 0; - cd->my_errno = YAZ_ICONV_EINVAL; - return 0; - } - cd->marc8_esc_mode = *inp++; - inbytesleft--; - (*no_read) += inbytesleft0 - inbytesleft; - } - if (inbytesleft <= 0) - return 0; - else - { - unsigned long x; - int comb = 0; - size_t no_read_sub = 0; - - switch(cd->marc8_esc_mode) - { - case 'B': /* Basic ASCII */ - case 'E': /* ANSEL */ - case 's': /* ASCII */ - x = yaz_marc8_1_conv(inp, inbytesleft, &no_read_sub, &comb); - break; - case 'g': /* Greek */ - x = yaz_marc8_2_conv(inp, inbytesleft, &no_read_sub, &comb); - break; - case 'b': /* Subscripts */ - x = yaz_marc8_3_conv(inp, inbytesleft, &no_read_sub, &comb); - break; - case 'p': /* Superscripts */ - x = yaz_marc8_4_conv(inp, inbytesleft, &no_read_sub, &comb); - break; - case '2': /* Basic Hebrew */ - x = yaz_marc8_5_conv(inp, inbytesleft, &no_read_sub, &comb); - break; - case 'N': /* Basic Cyrillic */ - case 'Q': /* Extended Cyrillic */ - x = yaz_marc8_6_conv(inp, inbytesleft, &no_read_sub, &comb); - break; - case '3': /* Basic Arabic */ - case '4': /* Extended Arabic */ - x = yaz_marc8_7_conv(inp, inbytesleft, &no_read_sub, &comb); - break; - case 'S': /* Greek */ - x = yaz_marc8_8_conv(inp, inbytesleft, &no_read_sub, &comb); - break; - case '1': /* Chinese, Japanese, Korean (EACC) */ - x = yaz_marc8_9_conv(inp, inbytesleft, &no_read_sub, &comb); - break; - default: - *no_read = 0; - cd->my_errno = YAZ_ICONV_EILSEQ; - return 0; - } -#if 0 - printf ("esc mode=%c x=%04lX comb=%d\n", cd->marc8_esc_mode, x, comb); -#endif - *no_read += no_read_sub; - - if (comb && cd->marc8_comb_x == 0) - { - size_t tmp_read = 0; - unsigned long next_x; - - /* read next char .. */ - next_x = yaz_read_marc8(cd, inp + *no_read, - inbytesleft - *no_read, &tmp_read); - /* save this x for later .. */ - cd->marc8_comb_x = x; - /* save next read for later .. */ - cd->marc8_comb_no_read = tmp_read; - /* return next x - thereby swap */ - x = next_x; - } - return x; - } -} -#endif static size_t yaz_write_UTF8 (yaz_iconv_t cd, unsigned long x, char **outbuf, size_t *outbytesleft, @@ -752,11 +645,7 @@ yaz_iconv_t yaz_iconv_open (const char *tocode, const char *fromcode) cd->init_handle = 0; cd->my_errno = YAZ_ICONV_UNKNOWN; cd->marc8_esc_mode = 'B'; -#if NEW_COMB cd->comb_offset = cd->comb_size = 0; -#else - cd->marc8_comb_x = 0; -#endif cd->compose_char = 0; /* a useful hack: if fromcode has leading @,