1 
2 #ifndef UNICODE__JAPANESE_H__
3 #define UNICODE__JAPANESE_H__
4 
5 /* $Id: Japanese.h 41491 2008-02-15 07:21:13Z hio $ */
6 
7 #if !defined(__cplusplus) && !defined(bool)
8 #define bool char
9 #define true 1
10 #define false 0
11 #endif
12 
13 #include "EXTERN.h"
14 #include "perl.h"
15 #include "XSUB.h"
16 #include "mediate.h"
17 
18 #ifndef assert
19 #include <assert.h>
20 #endif
21 
22 #include "str.h"
23 
24 #ifdef TEST
25 /* ``TEST'' is defined by devel.PL */
26 #include "test.h"
27 #define ONTEST(cmd) cmd
28 #else
29 #define ONTEST(cmd)
30 #endif
31 
32 #ifndef EXTERN_C
33 #  ifdef __cplusplus
34 #    define EXTERN_C extern "C"
35 #  else
36 #    define EXTERN_C
37 #  endif
38 #endif
39 
40 /* misc. */
41 #define new_SV_UNDEF() newSVsv(&PL_sv_undef)
42 
43 /* -------------------------------------------------------------------
44  * XS methods.
45  */
46 #ifdef __cplusplus
47 extern "C"
48 {
49 #endif
50   /* sjis <=> utf8  (conv.cpp) */
51   SV* xs_sjis_utf8(SV* sv_str);
52   SV* xs_utf8_sjis(SV* sv_str);
53 
54   /* getcode  (getcode.cpp) */
55   SV* xs_getcode(SV* sv_str);
56   int xs_getcode_list(SV* sv_str);
57 
58   /* utf-8 validation (utf8.c) */
59   SV* xs_validate_utf8(SV* sv_str);
60 
61   /* sjis<=>eucjp, sjis<=>jis */
62   SV* xs_sjis_eucjp(SV* sv_str);
63   SV* xs_eucjp_sjis(SV* sv_str);
64   SV* xs_sjis_jis(SV* sv_str);
65   SV* xs_jis_sjis(SV* sv_str);
66 
67   /* sjis(i-mode)<=>utf8 */
68   SV* xs_sjis_imode1_utf8(SV* sv_str);
69   SV* xs_sjis_imode2_utf8(SV* sv_str);
70   SV* xs_utf8_sjis_imode1(SV* sv_str);
71   SV* xs_utf8_sjis_imode2(SV* sv_str);
72 
73   /* sjis(j-sky)<=>utf8 */
74   SV* xs_sjis_jsky1_utf8(SV* sv_str);
75   SV* xs_sjis_jsky2_utf8(SV* sv_str);
76   SV* xs_utf8_sjis_jsky1(SV* sv_str);
77   SV* xs_utf8_sjis_jsky2(SV* sv_str);
78 
79   /* sjis(dot-i)<=>utf8 */
80   SV* xs_sjis_doti_utf8(SV* sv_str);
81   SV* xs_utf8_sjis_doti(SV* sv_str);
82 
83   /* ucs2<=>utf-8 */
84   SV* xs_ucs2_utf8(SV* sv_str);
85   SV* xs_utf8_ucs2(SV* sv_str);
86 
87   /* ucs4<=>utf-8 */
88   SV* xs_ucs4_utf8(SV* sv_str);
89   SV* xs_utf8_ucs4(SV* sv_str);
90 
91   /* utf-16<=>utf8 */
92   SV* xs_utf16_utf8(SV* sv_str);
93   SV* xs_utf8_utf16(SV* sv_str);
94 
95 /* init/cleanup memoey map. */
96 /* (ja:) ����ޥåץե������Ϣ */
97 extern void do_memmap(void);
98 extern void do_memunmap(void);
99 
100 /* SJIS <=> UTF8 mapping table      */
101 /* (ja:) SJIS <=> UTF8 �Ѵ��ơ��֥� */
102 /* index is in 0..0xffff            */
103 extern UJ_UINT8 const* g_u2s_table;
104 extern UJ_UINT8 const* g_s2u_table;
105 
106   /* i-mode/j-sky/dot-i emoji <=> UTF8 mapping table */
107   /* (ja:) i-mode/j-sky/dot-i ��ʸ�� <=> UTF8 �Ѵ��ơ��֥� */
108   extern UJ_UINT32 const* g_ei2u1_table;
109   extern UJ_UINT32 const* g_ei2u2_table;
110   extern UJ_UINT16 const* g_eu2i1_table;
111   extern UJ_UINT16 const* g_eu2i2_table;
112   extern UJ_UINT32 const* g_ej2u1_table;
113   extern UJ_UINT32 const* g_ej2u2_table;
114   extern UJ_UINT8  const* g_eu2j1_table; /* char [][5] */
115   extern UJ_UINT8  const* g_eu2j2_table; /* char [][5] */
116   extern UJ_UINT32 const* g_ed2u_table;
117   extern UJ_UINT16 const* g_eu2d_table;
118 
119   /* i-mode/j-sky/dot-i��ʸ�� <=> UTF8 �Ѵ��ơ��֥�����ǿ� */
120   /* �Х��ȿ��Ǥʤ����ǿ�                                   */
121   extern int g_ei2u1_size;
122   extern int g_ei2u2_size;
123   extern int g_eu2i1_size;
124   extern int g_eu2i2_size;
125   extern int g_ej2u1_size;
126   extern int g_ej2u2_size;
127   extern int g_eu2j1_size;
128   extern int g_eu2j2_size;
129   extern int g_ed2u_size;
130   extern int g_eu2d_size;
131 #ifdef __cplusplus
132 }
133 #endif
134 
135 #ifdef UNIJP__PERL_OLDER_THAN_5_006
136 /* above symbol is defined by Makefile.PL:sub configure. */
137 
138 #define aTHX_
139 #define pTHX_
140 #define dTHX_
141 #define get_av(var_name,create_flag) perl_get_av(var_name,create_flag);
142 
143 #ifndef newSVpvn
144 #define newSVpvn(str,len) newSVpv(str,len)
145 #endif
146 
147 #endif /* UNIJP__PERL_OLDER_THAN_5_006 */
148 
149 #ifdef UNIJP__PERL_OLDER_THAN_5_005
150 /* above symbol is defined by Makefile.PL:sub configure. */
151 #ifndef PL_sv_undef
152 #define PL_sv_undef sv_undef
153 #endif
154 #endif /* UNIJP__PERL_OLDER_THAN_5_005 */
155 
156 /* for 5.005_xx */
157 #ifndef call_pv
158 #define call_pv perl_call_pv
159 #endif
160 #ifndef eval_pv
161 #define eval_pv perl_eval_pv
162 #endif
163 #ifndef get_sv
164 #define get_sv perl_get_sv
165 #endif
166 
167 /* for 5.004_xx */
168 #ifndef PL_na
169 #define PL_na UNIJP_PL_na
170 static STRLEN UNIJP_PL_na;
171 #endif
172 
173 #endif /* UNICODE__JAPANESE_H__ */
174