1 /*
2    kanji.h: Handling 2byte char, and so on.
3 */
4 #ifndef KANJI_H
5 #define KANJI_H
6 #include "cpascal.h"
7 #include <ptexenc/ptexenc.h>
8 #include <ptexenc/unicode.h>
9 #ifdef eupTeX
10 #define getintone(w) ((w).cint1)
11 #define setintone(w,a) ((w).cint1=(a))
12 #endif
13 
14 #ifndef KANJI
15 #define KANJI
16 #endif
17 
18 /* (e)upTeX does not allow file names with 0x5c */
19 #define not_kanji_char_seq(a,b) (1)
20 #define notkanjicharseq not_kanji_char_seq
21 
22 #if !defined(WIN32)
23 extern int sjisterminal;
24 #endif
25 
26 /* functions */
27 #define XXHi(x) BYTE1(x)
28 #define XHi(x) BYTE2(x)
29 #define Hi(x) BYTE3(x)
30 #define Lo(x) BYTE4(x)
31 
32 extern boolean check_kanji (integer c);
33 #define checkkanji check_kanji
34 extern boolean is_char_ascii (integer c);
35 #define ischarascii is_char_ascii
36 extern boolean is_char_kanji (integer c);
37 #define ischarkanji is_char_kanji
38 extern boolean ismultiprn (integer c);
39 extern integer calc_pos (integer c);
40 #define calcpos calc_pos
41 extern integer kcatcodekey (integer c);
42 extern integer multilenbuffchar (integer c);
43 
44 extern void init_default_kanji (const_string file_str, const_string internal_str);
45 /* for upTeX, e-upTeX, upBibTeX, upDVItype, upPLtoTF, and upTFtoPL */
46 #define initkanji() init_default_kanji("utf8", "uptex")
47 /* for upDVItype */
48 #define setpriorfileenc() set_prior_file_enc()
49 
50 /* number of rest of multi-char for kcode_pos */
51 #define nrestmultichr(x)  ( (x)!=0 ? ((x) / 8) + 2 - ((x) % 8) : -1 )
52 
53 #ifndef PRESERVE_PUTC
54 #undef putc
55 #define putc(c,fp) putc2(c,fp)
56 #endif /* !PRESERVE_PUTC */
57 
58 #ifdef UPBIBTEX
59 #define inputline2(fp,buff,pos,size,ptr) input_line2(fp,buff,pos,size,ptr)
60 #else
61 #define inputline2(fp,buff,pos,size) input_line2(fp,buff,pos,size,NULL)
62 #endif
63 
64 extern void init_kanji (const_string file_str, const_string internal_str);
65 extern void dump_kanji (FILE *fp);
66 extern void undump_kanji (FILE *fp);
67 #define dumpkanji dump_kanji
68 #define undumpkanji undump_kanji
69 
70 #endif /* not KANJI_H */
71