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
Bundle sha1 rather than use libgcrypt/nettle
[yaz-moved-to-github.git]
/
src
/
advancegreek.c
diff --git
a/src/advancegreek.c
b/src/advancegreek.c
index
7792073
..
0662b40
100644
(file)
--- a/
src/advancegreek.c
+++ b/
src/advancegreek.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_advancegreek(yaz_iconv_t cd, unsigned char *inp,
- size_t inbytesleft, size_t *no_read)
+static unsigned long read_advancegreek(yaz_iconv_t cd, yaz_iconv_decoder_t d,
+ unsigned char *inp,
+ size_t inbytesleft, size_t *no_read)
{
unsigned long x = 0;
int shift = 0;
{
unsigned long x = 0;
int shift = 0;
@@
-46,7
+46,7
@@
unsigned long yaz_read_advancegreek(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 */
@@
-55,217
+55,217
@@
unsigned long yaz_read_advancegreek(yaz_iconv_t cd, unsigned char *inp,
}
switch (*inp) {
case 0x81:
}
switch (*inp) {
case 0x81:
- if (shift)
- if (tonos)
+ if (shift)
+ if (tonos)
x = 0x0386;
x = 0x0386;
- else
+ else
x = 0x0391;
x = 0x0391;
- else
- if (tonos)
+ else
+ if (tonos)
x = 0x03ac;
x = 0x03ac;
- else
+ else
x = 0x03b1;
break;
case 0x82:
x = 0x03b1;
break;
case 0x82:
- if (shift)
+ if (shift)
x = 0x0392;
x = 0x0392;
- else
+ else
x = 0x03b2;
x = 0x03b2;
-
+
break;
case 0x83:
break;
case 0x83:
- if (shift)
+ if (shift)
x = 0x0393;
x = 0x0393;
- else
+ else
x = 0x03b3;
break;
case 0x84:
x = 0x03b3;
break;
case 0x84:
- if (shift)
+ if (shift)
x = 0x0394;
x = 0x0394;
- else
+ else
x = 0x03b4;
break;
case 0x85:
x = 0x03b4;
break;
case 0x85:
- if (shift)
- if (tonos)
+ if (shift)
+ if (tonos)
x = 0x0388;
x = 0x0388;
- else
+ else
x = 0x0395;
x = 0x0395;
- else
- if (tonos)
+ else
+ if (tonos)
x = 0x03ad;
x = 0x03ad;
- else
+ else
x = 0x03b5;
break;
case 0x86:
x = 0x03b5;
break;
case 0x86:
- if (shift)
+ if (shift)
x = 0x0396;
x = 0x0396;
- else
+ else
x = 0x03b6;
break;
case 0x87:
x = 0x03b6;
break;
case 0x87:
- if (shift)
- if (tonos)
+ if (shift)
+ if (tonos)
x = 0x0389;
x = 0x0389;
- else
+ else
x = 0x0397;
x = 0x0397;
- else
- if (tonos)
+ else
+ if (tonos)
x = 0x03ae;
x = 0x03ae;
- else
+ else
x = 0x03b7;
break;
case 0x88:
x = 0x03b7;
break;
case 0x88:
- if (shift)
+ if (shift)
x = 0x0398;
x = 0x0398;
- else
+ else
x = 0x03b8;
break;
case 0x89:
x = 0x03b8;
break;
case 0x89:
- if (shift)
- if (tonos)
+ if (shift)
+ if (tonos)
x = 0x038a;
x = 0x038a;
- else
- if (dialitika)
+ else
+ if (dialitika)
x = 0x03aa;
x = 0x03aa;
- else
+ else
x = 0x0399;
x = 0x0399;
- else
- if (tonos)
- if (dialitika)
+ else
+ 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 0x8a:
x = 0x03b9;
break;
case 0x8a:
- if (shift)
+ if (shift)
x = 0x039a;
x = 0x039a;
- else
+ else
x = 0x03ba;
x = 0x03ba;
-
+
break;
case 0x8b:
break;
case 0x8b:
- if (shift)
+ if (shift)
x = 0x039b;
x = 0x039b;
- else
+ else
x = 0x03bb;
break;
case 0x8c:
x = 0x03bb;
break;
case 0x8c:
- if (shift)
+ if (shift)
x = 0x039c;
x = 0x039c;
- else
+ else
x = 0x03bc;
x = 0x03bc;
-
+
break;
case 0x8d:
break;
case 0x8d:
- if (shift)
+ if (shift)
x = 0x039d;
x = 0x039d;
- else
+ else
x = 0x03bd;
break;
case 0x8e:
x = 0x03bd;
break;
case 0x8e:
- if (shift)
+ if (shift)
x = 0x039e;
x = 0x039e;
- else
+ else
x = 0x03be;
break;
case 0x8f:
x = 0x03be;
break;
case 0x8f:
- if (shift)
- if (tonos)
+ if (shift)
+ if (tonos)
x = 0x038c;
x = 0x038c;
- else
+ else
x = 0x039f;
x = 0x039f;
- else
- if (tonos)
+ else
+ if (tonos)
x = 0x03cc;
x = 0x03cc;
- else
+ else
x = 0x03bf;
break;
case 0x90:
x = 0x03bf;
break;
case 0x90:
- if (shift)
+ if (shift)
x = 0x03a0;
x = 0x03a0;
- else
+ else
x = 0x03c0;
break;
case 0x91:
x = 0x03c0;
break;
case 0x91:
- if (shift)
+ if (shift)
x = 0x03a1;
x = 0x03a1;
- else
+ else
x = 0x03c1;
break;
case 0x92:
x = 0x03c2;
break;
case 0x93:
x = 0x03c1;
break;
case 0x92:
x = 0x03c2;
break;
case 0x93:
- if (shift)
+ if (shift)
x = 0x03a3;
x = 0x03a3;
- else
+ else
x = 0x03c3;
break;
case 0x94:
x = 0x03c3;
break;
case 0x94:
- if (shift)
+ if (shift)
x = 0x03a4;
x = 0x03a4;
- else
+ else
x = 0x03c4;
break;
case 0x95:
x = 0x03c4;
break;
case 0x95:
- if (shift)
- if (tonos)
+ if (shift)
+ if (tonos)
x = 0x038e;
x = 0x038e;
- else
- if (dialitika)
+ else
+ if (dialitika)
x = 0x03ab;
x = 0x03ab;
- else
+ else
x = 0x03a5;
x = 0x03a5;
- else
- if (tonos)
- if (dialitika)
+ else
+ 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 0x96:
x = 0x03c5;
break;
case 0x96:
- if (shift)
+ if (shift)
x = 0x03a6;
x = 0x03a6;
- else
+ else
x = 0x03c6;
break;
case 0x97:
x = 0x03c6;
break;
case 0x97:
- if (shift)
+ if (shift)
x = 0x03a7;
x = 0x03a7;
- else
+ else
x = 0x03c7;
break;
case 0x98:
x = 0x03c7;
break;
case 0x98:
- if (shift)
+ if (shift)
x = 0x03a8;
x = 0x03a8;
- else
+ else
x = 0x03c8;
x = 0x03c8;
-
+
break;
break;
-
+
case 0x99:
case 0x99:
- if (shift)
- if (tonos)
+ if (shift)
+ if (tonos)
x = 0x038f;
x = 0x038f;
- else
+ else
x = 0x03a9;
x = 0x03a9;
- else
- if (tonos)
+ else
+ if (tonos)
x = 0x03ce;
x = 0x03ce;
- else
+ else
x = 0x03c9;
break;
default:
x = 0x03c9;
break;
default:
@@
-273,7
+273,7
@@
unsigned long yaz_read_advancegreek(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_advancegreek(yaz_iconv_t cd, yaz_iconv_encoder_t w,
case 0x03c4 : out[k++]=0x94; break;
case 0x03c5 : out[k++]=0x95; break;
case 0x03c6 : out[k++]=0x96; break;
case 0x03c4 : out[k++]=0x94; break;
case 0x03c5 : out[k++]=0x95; break;
case 0x03c6 : out[k++]=0x96; break;
- case 0x03c7 : out[k++]=0x96; break;
+ case 0x03c7 : out[k++]=0x97; break;
case 0x03c8 : out[k++]=0x98; break;
case 0x03c9 : out[k++]=0x99; break;
default:
case 0x03c8 : out[k++]=0x98; break;
case 0x03c9 : out[k++]=0x99; break;
default:
@@
-365,7
+365,7
@@
static size_t write_advancegreek(yaz_iconv_t cd, yaz_iconv_encoder_t w,
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;
@@
-384,10
+384,23
@@
yaz_iconv_encoder_t yaz_advancegreek_encoder(const char *name,
return 0;
}
return 0;
}
+yaz_iconv_decoder_t yaz_advancegreek_decoder(const char *name,
+ yaz_iconv_decoder_t d)
+{
+ if (!yaz_matchstr(name, "advancegreek"))
+ {
+ d->read_handle = read_advancegreek;
+ 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
*/
+