1 /* 2 * $LynxId: UCMap.h,v 1.27 2011/12/01 02:00:57 tom Exp $ 3 */ 4 #ifndef UCMAP_H 5 #define UCMAP_H 6 7 #ifndef HTUTILS_H 8 #include <HTUtils.h> 9 #endif 10 11 #ifdef __cplusplus 12 extern "C" { 13 #endif 14 typedef enum { 15 ucError = -1, 16 ucZeroWidth = -2, 17 ucInvalidHash = -3, 18 ucNotFound = -4, 19 ucNeedMore = -10, 20 ucCannotConvert = -11, 21 ucCannotOutput = -12, 22 ucBufferTooSmall = -13, 23 ucUnknown = -14 24 } UCStatus; 25 26 typedef long UCode_t; 27 28 extern BOOL UCScanCode(UCode_t *, const char *, BOOL); 29 30 extern int UCTransUniChar(UCode_t unicode, 31 int charset_out); 32 extern int UCTransUniCharStr(char *outbuf, 33 int buflen, 34 UCode_t unicode, 35 int charset_out, 36 int chk_single_flag); 37 extern int UCTransChar(int ch_in, 38 int charset_in, 39 int charset_out); 40 extern int UCReverseTransChar(int ch_out, 41 int charset_in, 42 int charset_out); 43 extern int UCTransCharStr(char *outbuf, 44 int buflen, 45 int ch_in, 46 int charset_in, 47 int charset_out, 48 int chk_single_flag); 49 #ifdef EXP_JAPANESEUTF8_SUPPORT 50 extern UCode_t UCTransJPToUni(char *inbuf, 51 int buflen, 52 int charset_in); 53 #endif 54 extern UCode_t UCTransToUni(int ch_in, 55 int charset_in); 56 extern int UCGetRawUniMode_byLYhndl(int i); 57 extern int UCGetLYhndl_byMIME(const char *p); /* returns -1 if name not recognized */ 58 extern int safeUCGetLYhndl_byMIME(const char *p); /* returns LATIN1 if name not recognized */ 59 60 #ifdef USE_LOCALE_CHARSET 61 extern void LYFindLocaleCharset(void); 62 #endif 63 64 extern int UCLYhndl_for_unspec; 65 extern int UCLYhndl_for_unrec; 66 extern int UCLYhndl_HTFile_for_unspec; 67 extern int UCLYhndl_HTFile_for_unrec; 68 69 /* easy to type: */ 70 extern int LATIN1; /* UCGetLYhndl_byMIME("iso-8859-1") */ 71 extern int US_ASCII; /* UCGetLYhndl_byMIME("us-ascii") */ 72 extern int UTF8_handle; /* UCGetLYhndl_byMIME("utf-8") */ 73 74 #undef TRANSPARENT /* defined on Solaris in <sys/stream.h> */ 75 extern int TRANSPARENT; /* UCGetLYhndl_byMIME("x-transparent") */ 76 77 /* 78 In general, Lynx translates letters from document charset to display charset. 79 If document charset is not specified or not recognized by Lynx, we fall back 80 to different assumptions below, read also lynx.cfg for info. 81 82 UCLYhndl_for_unspec - assume this as charset for documents that don't 83 specify a charset parameter in HTTP headers or via META 84 this corresponds to "assume_charset" 85 86 UCLYhndl_HTFile_for_unspec - assume this as charset of local file 87 this corresponds to "assume_local_charset" 88 89 UCLYhndl_for_unrec - in case a charset parameter is not recognized; 90 this corresponds to "assume_unrec_charset" 91 92 UCLYhndl_HTFile_for_unrec - the same but only for local files, 93 currently not used. 94 95 current_char_set - this corresponds to "display charset", 96 declared in LYCharSets.c and really important. 97 98 All external charset information is available in so called MIME format. 99 For internal needs Lynx uses charset handlers as integers 100 from UCGetLYhndl_byMIME(). However, there is no way to recover 101 from user's error in configuration file lynx.cfg or command line switches, 102 those unrecognized MIME names are assumed as LATIN1 (via safeUCGetLYhndl...). 103 */ 104 105 #define UCTRANS_NOTFOUND (-4) 106 107 #ifdef __cplusplus 108 } 109 #endif 110 #endif /* UCMAP_H */ 111