projects
/
yaz-moved-to-github.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Include links to pre-compiled ICU binaries
[yaz-moved-to-github.git]
/
src
/
iso5428.c
diff --git
a/src/iso5428.c
b/src/iso5428.c
index
752f9c8
..
8d7b3c2
100644
(file)
--- a/
src/iso5428.c
+++ b/
src/iso5428.c
@@
-1,5
+1,5
@@
/* This file is part of the YAZ toolkit.
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2008 Index Data
+ * Copyright (C) Index Data
* See the file LICENSE for details.
*/
/**
* See the file LICENSE for details.
*/
/**
@@
-14,12
+14,12
@@
#include <assert.h>
#include <errno.h>
#include <string.h>
#include <assert.h>
#include <errno.h>
#include <string.h>
-#include <ctype.h>
#include "iconv-p.h"
#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;
{
unsigned long x = 0;
int tonos = 0;
@@
-41,7
+41,7
@@
unsigned long yaz_read_iso5428_1984(yaz_iconv_t cd, unsigned char *inp,
inp++;
--inbytesleft;
(*no_read)++;
inp++;
--inbytesleft;
(*no_read)++;
- }
+ }
if (inbytesleft == 0)
{
yaz_iconv_set_errno(cd, YAZ_ICONV_EINVAL); /* incomplete input */
if (inbytesleft == 0)
{
yaz_iconv_set_errno(cd, YAZ_ICONV_EINVAL); /* incomplete input */
@@
-50,15
+50,15
@@
unsigned long yaz_read_iso5428_1984(yaz_iconv_t cd, unsigned char *inp,
}
switch (*inp) {
case 0xe1: /* alpha small */
}
switch (*inp) {
case 0xe1: /* alpha small */
- if (tonos)
+ if (tonos)
x = 0x03ac;
x = 0x03ac;
- else
+ else
x = 0x03b1;
break;
case 0xc1: /* alpha capital */
x = 0x03b1;
break;
case 0xc1: /* alpha capital */
- if (tonos)
+ if (tonos)
x = 0x0386;
x = 0x0386;
- else
+ else
x = 0x0391;
break;
x = 0x0391;
break;
@@
-83,15
+83,15
@@
unsigned long yaz_read_iso5428_1984(yaz_iconv_t cd, unsigned char *inp,
x = 0x0394;
break;
case 0xe6: /* epsilon small */
x = 0x0394;
break;
case 0xe6: /* epsilon small */
- if (tonos)
+ if (tonos)
x = 0x03ad;
x = 0x03ad;
- else
+ else
x = 0x03b5;
break;
case 0xc6: /* epsilon capital */
x = 0x03b5;
break;
case 0xc6: /* epsilon capital */
- if (tonos)
+ if (tonos)
x = 0x0388;
x = 0x0388;
- else
+ else
x = 0x0395;
break;
case 0xe9: /* Zeta small */
x = 0x0395;
break;
case 0xe9: /* Zeta small */
@@
-101,15
+101,15
@@
unsigned long yaz_read_iso5428_1984(yaz_iconv_t cd, unsigned char *inp,
x = 0x0396;
break;
case 0xea: /* Eta small */
x = 0x0396;
break;
case 0xea: /* Eta small */
- if (tonos)
+ if (tonos)
x = 0x03ae;
x = 0x03ae;
- else
+ else
x = 0x03b7;
break;
case 0xca: /* Eta capital */
x = 0x03b7;
break;
case 0xca: /* Eta capital */
- if (tonos)
+ if (tonos)
x = 0x0389;
x = 0x0389;
- else
+ else
x = 0x0397;
break;
case 0xeb: /* Theta small */
x = 0x0397;
break;
case 0xeb: /* Theta small */
@@
-119,24
+119,24
@@
unsigned long yaz_read_iso5428_1984(yaz_iconv_t cd, unsigned char *inp,
x = 0x0398;
break;
case 0xec: /* Iota small */
x = 0x0398;
break;
case 0xec: /* Iota small */
- if (tonos)
- if (dialitika)
+ if (tonos)
+ if (dialitika)
x = 0x0390;
x = 0x0390;
- else
+ else
x = 0x03af;
x = 0x03af;
- else
- if (dialitika)
+ else
+ if (dialitika)
x = 0x03ca;
x = 0x03ca;
- else
+ else
x = 0x03b9;
break;
case 0xcc: /* Iota capital */
x = 0x03b9;
break;
case 0xcc: /* Iota capital */
- if (tonos)
+ if (tonos)
x = 0x038a;
x = 0x038a;
- else
- if (dialitika)
+ else
+ if (dialitika)
x = 0x03aa;
x = 0x03aa;
- else
+ else
x = 0x0399;
break;
case 0xed: /* Kappa small */
x = 0x0399;
break;
case 0xed: /* Kappa small */
@@
-170,15
+170,15
@@
unsigned long yaz_read_iso5428_1984(yaz_iconv_t cd, unsigned char *inp,
x = 0x039e;
break;
case 0xf2: /* Omicron small */
x = 0x039e;
break;
case 0xf2: /* Omicron small */
- if (tonos)
+ if (tonos)
x = 0x03cc;
x = 0x03cc;
- else
+ else
x = 0x03bf;
break;
case 0xd2: /* Omicron capital */
x = 0x03bf;
break;
case 0xd2: /* Omicron capital */
- if (tonos)
+ if (tonos)
x = 0x038c;
x = 0x038c;
- else
+ else
x = 0x039f;
break;
case 0xf3: /* Pi small */
x = 0x039f;
break;
case 0xf3: /* Pi small */
@@
-209,24
+209,24
@@
unsigned long yaz_read_iso5428_1984(yaz_iconv_t cd, unsigned char *inp,
x = 0x03a4;
break;
case 0xf9: /* Upsilon small */
x = 0x03a4;
break;
case 0xf9: /* Upsilon small */
- if (tonos)
- if (dialitika)
+ if (tonos)
+ if (dialitika)
x = 0x03b0;
x = 0x03b0;
- else
+ else
x = 0x03cd;
x = 0x03cd;
- else
- if (dialitika)
+ else
+ if (dialitika)
x = 0x03cb;
x = 0x03cb;
- else
+ else
x = 0x03c5;
break;
case 0xd9: /* Upsilon capital */
x = 0x03c5;
break;
case 0xd9: /* Upsilon capital */
- if (tonos)
+ if (tonos)
x = 0x038e;
x = 0x038e;
- else
- if (dialitika)
+ else
+ if (dialitika)
x = 0x03ab;
x = 0x03ab;
- else
+ else
x = 0x03a5;
break;
case 0xfa: /* Phi small */
x = 0x03a5;
break;
case 0xfa: /* Phi small */
@@
-248,15
+248,15
@@
unsigned long yaz_read_iso5428_1984(yaz_iconv_t cd, unsigned char *inp,
x = 0x03a8;
break;
case 0xfd: /* Omega small */
x = 0x03a8;
break;
case 0xfd: /* Omega small */
- if (tonos)
+ if (tonos)
x = 0x03ce;
x = 0x03ce;
- else
+ else
x = 0x03c9;
break;
case 0xdd: /* Omega capital */
x = 0x03c9;
break;
case 0xdd: /* Omega capital */
- if (tonos)
+ if (tonos)
x = 0x038f;
x = 0x038f;
- else
+ else
x = 0x03a9;
break;
default:
x = 0x03a9;
break;
default:
@@
-264,7
+264,7
@@
unsigned long yaz_read_iso5428_1984(yaz_iconv_t cd, unsigned char *inp,
break;
}
(*no_read)++;
break;
}
(*no_read)++;
-
+
return x;
}
return x;
}
@@
-356,7
+356,7
@@
static size_t write_iso_5428_1984(yaz_iconv_t cd, yaz_iconv_encoder_t en,
yaz_iconv_set_errno(cd, YAZ_ICONV_EILSEQ);
return (size_t) -1;
}
yaz_iconv_set_errno(cd, YAZ_ICONV_EILSEQ);
return (size_t) -1;
}
- out[k++] = x;
+ out[k++] = (unsigned char ) x;
break;
}
*outbytesleft -= k;
break;
}
*outbytesleft -= k;
@@
-376,11
+376,26
@@
yaz_iconv_encoder_t yaz_iso_5428_encoder(const char *name,
return 0;
}
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
/*
* Local variables:
* c-basic-offset: 4
+ * c-file-style: "Stroustrup"
* indent-tabs-mode: nil
* End:
* vim: shiftwidth=4 tabstop=8 expandtab
*/
* indent-tabs-mode: nil
* End:
* vim: shiftwidth=4 tabstop=8 expandtab
*/
+