1/* 2Copyright (c) 2001 by Juliusz Chroboczek 3 4Permission is hereby granted, free of charge, to any person obtaining a copy 5of this software and associated documentation files (the "Software"), to deal 6in the Software without restriction, including without limitation the rights 7to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8copies of the Software, and to permit persons to whom the Software is 9furnished to do so, subject to the following conditions: 10 11The above copyright notice and this permission notice shall be included in 12all copies or substantial portions of the Software. 13 14THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20THE SOFTWARE. 21*/ 22 23#ifndef LUIT_CHARSET_H 24#define LUIT_CHARSET_H 1 25 26#include "other.h" 27 28#define T_FAILED 0 29#define T_94 1 30#define T_96 2 31#define T_128 3 32#define T_9494 4 33#define T_9696 5 34/* Big 5 */ 35#define T_94192 6 36#define T_OTHER 7 37 38/* True for charsets that pass control chars unchanged, at least in 39 the first byte */ 40#define CHARSET_REGULAR(c) ((c)->type != T_128) 41 42typedef struct _Charset { 43 const char *name; 44 int type; 45 unsigned char final; 46 unsigned int (*recode) (unsigned int, const struct _Charset * self); 47 int (*reverse) (unsigned int, const struct _Charset * self); 48 const void *data; 49 int (*other_stack) (unsigned c, OtherStatePtr aux); 50 OtherState *other_aux; 51 unsigned int (*other_recode) (unsigned int c, OtherStatePtr aux); 52 unsigned int (*other_reverse) (unsigned int c, OtherStatePtr aux); 53 struct _Charset *next; 54} CharsetRec, *CharsetPtr; 55 56typedef struct _LocaleCharset { 57 const char *name; 58 int gl; 59 int gr; 60 const char *g0; 61 const char *g1; 62 const char *g2; 63 const char *g3; 64 const char *other; 65} LocaleCharsetRec, *LocaleCharsetPtr; 66 67const CharsetRec *getUnknownCharset(int); 68const CharsetRec *getCharset(unsigned, int); 69const CharsetRec *getCharsetByName(const char *); 70void reportCharsets(void); 71int getLocaleState(const char *locale, const char *charset, 72 int *gl_return, int *gr_return, 73 const CharsetRec * *g0_return, 74 const CharsetRec * *g1_return, 75 const CharsetRec * *g2_return, 76 const CharsetRec * *g3_return, 77 const CharsetRec * *other_return); 78 79#endif /* LUIT_CHARSET_H */ 80