| 1 | |
| 2 | /* |
| 3 | ** Copyright 2000 Double Precision, Inc. |
| 4 | ** See COPYING for distribution information. |
| 5 | ** |
| 6 | ** $Id: xtest.c,v 1.2 2002/11/18 00:54:22 mrsam Exp $ |
| 7 | */ |
| 8 | |
| 9 | #include "unicode.h" |
| 10 | |
| 11 | /* |
| 12 | ** This map is for testing purposes. Funny stuff. |
| 13 | */ |
| 14 | |
| 15 | extern const struct unicode_info unicode_ISO8859_1; |
| 16 | |
| 17 | static unicode_char *c2u(const struct unicode_info *u, const char *cp, int *ip) |
| 18 | { |
| 19 | unicode_char *uc= (*unicode_ISO8859_1.c2u)(&unicode_ISO8859_1, cp, ip); |
| 20 | int i; |
| 21 | |
| 22 | for (i=0; uc && uc[i]; i++) |
| 23 | if (uc[i] >= 0x40 && uc[i] <= 0x7d) |
| 24 | uc[i] ^= 1; |
| 25 | return (uc); |
| 26 | } |
| 27 | |
| 28 | static char *u2c(const struct unicode_info *u, const unicode_char *cp, int *ip) |
| 29 | { |
| 30 | char *uc= (*unicode_ISO8859_1.u2c)(&unicode_ISO8859_1,cp, ip); |
| 31 | |
| 32 | int i; |
| 33 | |
| 34 | for (i=0; uc && uc[i]; i++) |
| 35 | if (uc[i] >= 0x40 && uc[i] <= 0x7d) |
| 36 | uc[i] ^= 1; |
| 37 | return (uc); |
| 38 | } |
| 39 | |
| 40 | static char *toupper_func(const struct unicode_info *u, |
| 41 | const char *cp, int *ip) |
| 42 | { |
| 43 | return ( (*unicode_ISO8859_1.toupper_func)(&unicode_ISO8859_1,cp, ip)); |
| 44 | } |
| 45 | |
| 46 | static char *tolower_func(const struct unicode_info *u, |
| 47 | const char *cp, int *ip) |
| 48 | { |
| 49 | return ( (*unicode_ISO8859_1.tolower_func)(&unicode_ISO8859_1,cp, ip)); |
| 50 | } |
| 51 | |
| 52 | static char *totitle_func(const struct unicode_info *u, |
| 53 | const char *cp, int *ip) |
| 54 | { |
| 55 | return ( (*unicode_ISO8859_1.totitle_func)(&unicode_ISO8859_1,cp, ip)); |
| 56 | } |
| 57 | |
| 58 | const struct unicode_info unicode_XTEST = { |
| 59 | "X-TEST", |
| 60 | 0, |
| 61 | c2u, |
| 62 | u2c, |
| 63 | toupper_func, |
| 64 | tolower_func, |
| 65 | totitle_func}; |