1a8fdb4bcSmrg/* 2a8fdb4bcSmrgCopyright (c) 2001 by Juliusz Chroboczek 3a8fdb4bcSmrg 4a8fdb4bcSmrgPermission is hereby granted, free of charge, to any person obtaining a copy 5a8fdb4bcSmrgof this software and associated documentation files (the "Software"), to deal 6a8fdb4bcSmrgin the Software without restriction, including without limitation the rights 7a8fdb4bcSmrgto use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8a8fdb4bcSmrgcopies of the Software, and to permit persons to whom the Software is 9a8fdb4bcSmrgfurnished to do so, subject to the following conditions: 10a8fdb4bcSmrg 11a8fdb4bcSmrgThe above copyright notice and this permission notice shall be included in 12a8fdb4bcSmrgall copies or substantial portions of the Software. 13a8fdb4bcSmrg 14a8fdb4bcSmrgTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15a8fdb4bcSmrgIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16a8fdb4bcSmrgFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17a8fdb4bcSmrgAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18a8fdb4bcSmrgLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19a8fdb4bcSmrgOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20a8fdb4bcSmrgTHE SOFTWARE. 21a8fdb4bcSmrg*/ 2277683534Smrg 2377683534Smrg#ifndef LUIT_CHARSET_H 2477683534Smrg#define LUIT_CHARSET_H 1 2577683534Smrg 2677683534Smrg#include "other.h" 27a8fdb4bcSmrg 28a8fdb4bcSmrg#define T_FAILED 0 29a8fdb4bcSmrg#define T_94 1 30a8fdb4bcSmrg#define T_96 2 31a8fdb4bcSmrg#define T_128 3 32a8fdb4bcSmrg#define T_9494 4 33a8fdb4bcSmrg#define T_9696 5 34a8fdb4bcSmrg/* Big 5 */ 35a8fdb4bcSmrg#define T_94192 6 36a8fdb4bcSmrg#define T_OTHER 7 37a8fdb4bcSmrg 38a8fdb4bcSmrg/* True for charsets that pass control chars unchanged, at least in 39a8fdb4bcSmrg the first byte */ 40a8fdb4bcSmrg#define CHARSET_REGULAR(c) ((c)->type != T_128) 41a8fdb4bcSmrg 42a8fdb4bcSmrgtypedef struct _Charset { 4377683534Smrg const char *name; 44a8fdb4bcSmrg int type; 45a8fdb4bcSmrg unsigned char final; 4677683534Smrg unsigned int (*recode) (unsigned int, const struct _Charset * self); 4777683534Smrg int (*reverse) (unsigned int, const struct _Charset * self); 4877683534Smrg const void *data; 4977683534Smrg int (*other_stack) (unsigned c, OtherStatePtr aux); 50a8fdb4bcSmrg OtherState *other_aux; 5177683534Smrg unsigned int (*other_recode) (unsigned int c, OtherStatePtr aux); 5277683534Smrg unsigned int (*other_reverse) (unsigned int c, OtherStatePtr aux); 53a8fdb4bcSmrg struct _Charset *next; 54a8fdb4bcSmrg} CharsetRec, *CharsetPtr; 55a8fdb4bcSmrg 56a8fdb4bcSmrgtypedef struct _LocaleCharset { 57a8fdb4bcSmrg const char *name; 58a8fdb4bcSmrg int gl; 59a8fdb4bcSmrg int gr; 60a8fdb4bcSmrg const char *g0; 61a8fdb4bcSmrg const char *g1; 62a8fdb4bcSmrg const char *g2; 63a8fdb4bcSmrg const char *g3; 64a8fdb4bcSmrg const char *other; 65a8fdb4bcSmrg} LocaleCharsetRec, *LocaleCharsetPtr; 66a8fdb4bcSmrg 6777683534Smrgconst CharsetRec *getUnknownCharset(int); 6877683534Smrgconst CharsetRec *getCharset(unsigned, int); 6977683534Smrgconst CharsetRec *getCharsetByName(const char *); 70a8fdb4bcSmrgvoid reportCharsets(void); 7177683534Smrgint getLocaleState(const char *locale, const char *charset, 7277683534Smrg int *gl_return, int *gr_return, 7377683534Smrg const CharsetRec * *g0_return, 7477683534Smrg const CharsetRec * *g1_return, 7577683534Smrg const CharsetRec * *g2_return, 7677683534Smrg const CharsetRec * *g3_return, 7777683534Smrg const CharsetRec * *other_return); 7877683534Smrg 7977683534Smrg#endif /* LUIT_CHARSET_H */ 80