| 1 |
/* |
| 2 |
* $LynxId: UCAux.h,v 1.22 2014/12/10 09:48:41 tom Exp $ |
| 3 |
*/ |
| 4 |
#ifndef UCAUX_H |
| 5 |
#define UCAUX_H |
| 6 |
|
| 7 |
#ifndef HTUTILS_H |
| 8 |
#include <HTUtils.h> |
| 9 |
#endif |
| 10 |
|
| 11 |
#ifndef UCDEFS_H |
| 12 |
#include <UCDefs.h> |
| 13 |
#endif /* UCDEFS_H */ |
| 14 |
|
| 15 |
#ifndef HTSTREAM_H |
| 16 |
#include <HTStream.h> |
| 17 |
#endif /* HTSTREAM_H */ |
| 18 |
|
| 19 |
#ifndef UCMAP_H |
| 20 |
#include <UCMap.h> |
| 21 |
#endif /* UCMAP_H */ |
| 22 |
|
| 23 |
#ifdef __cplusplus |
| 24 |
extern "C" { |
| 25 |
#endif |
| 26 |
extern BOOL UCCanUniTranslateFrom(int from); |
| 27 |
extern BOOL UCCanTranslateUniTo(int to); |
| 28 |
extern BOOL UCCanTranslateFromTo(int from, int to); |
| 29 |
extern BOOL UCNeedNotTranslate(int from, |
| 30 |
int to); |
| 31 |
|
| 32 |
struct _UCTransParams { |
| 33 |
BOOL transp; |
| 34 |
BOOL do_cjk; |
| 35 |
BOOL decode_utf8; |
| 36 |
BOOL output_utf8; |
| 37 |
BOOL use_raw_char_in; |
| 38 |
BOOL strip_raw_char_in; |
| 39 |
BOOL pass_160_173_raw; |
| 40 |
BOOL do_8bitraw; |
| 41 |
BOOL trans_to_uni; |
| 42 |
BOOL trans_C0_to_uni; |
| 43 |
BOOL repl_translated_C0; |
| 44 |
BOOL trans_from_uni; |
| 45 |
int ucs_mode; |
| 46 |
}; |
| 47 |
typedef struct _UCTransParams UCTransParams; |
| 48 |
|
| 49 |
typedef struct { |
| 50 |
char utf_count; |
| 51 |
UCode_t utf_char; |
| 52 |
char utf_buf[8]; |
| 53 |
char *utf_buf_p; |
| 54 |
} UTFDecodeState; |
| 55 |
|
| 56 |
typedef enum { |
| 57 |
dUTF8_ok, |
| 58 |
dUTF8_err, |
| 59 |
dUTF8_more |
| 60 |
} dUTF8; |
| 61 |
|
| 62 |
extern dUTF8 HTDecodeUTF8(UTFDecodeState * me, int *c_in_out, UCode_t *result); |
| 63 |
|
| 64 |
extern void UCSetTransParams(UCTransParams * pT, int cs_in, |
| 65 |
const LYUCcharset *p_in, |
| 66 |
int cs_out, |
| 67 |
const LYUCcharset *p_out); |
| 68 |
|
| 69 |
extern void UCTransParams_clear(UCTransParams * pT); |
| 70 |
|
| 71 |
extern void UCSetBoxChars(int cset, |
| 72 |
int *pvert_out, |
| 73 |
int *phori_out, |
| 74 |
int vert_in, |
| 75 |
int hori_in); |
| 76 |
|
| 77 |
typedef void putc_func_t (HTStream *me, |
| 78 |
int ch); |
| 79 |
|
| 80 |
extern BOOL UCPutUtf8_charstring(HTStream *target, |
| 81 |
putc_func_t *actions, |
| 82 |
UCode_t code); |
| 83 |
|
| 84 |
extern BOOL UCConvertUniToUtf8(UCode_t code, |
| 85 |
char *buffer); |
| 86 |
|
| 87 |
extern UCode_t UCGetUniFromUtf8String(const char **ppuni); |
| 88 |
|
| 89 |
#ifdef __cplusplus |
| 90 |
} |
| 91 |
#endif |
| 92 |
#endif /* UCAUX_H */ |