File tree 2 files changed +14
-9
lines changed
2 files changed +14
-9
lines changed Original file line number Diff line number Diff line change 6
6
7
7
#define USING_IMPORTED_MAPS
8
8
9
+ #define CJK_MOD_SPECIFIC_STATE \
10
+ const encode_map *big5_encmap; \
11
+ const decode_map *big5_decmap;
12
+
9
13
#include "cjkcodecs.h"
10
14
#include "mappings_hk.h"
11
15
12
16
/*
13
17
* BIG5HKSCS codec
14
18
*/
15
19
16
- static const encode_map * big5_encmap = NULL ;
17
- static const decode_map * big5_decmap = NULL ;
18
-
19
20
CODEC_INIT (big5hkscs )
20
21
{
21
- static int initialized = 0 ;
22
-
23
- if (!initialized && IMPORT_MAP (tw , big5 , & big5_encmap , & big5_decmap ))
22
+ cjkcodecs_module_state * st = codec -> modstate ;
23
+ if (IMPORT_MAP (tw , big5 , & st -> big5_encmap , & st -> big5_decmap )) {
24
24
return -1 ;
25
- initialized = 1 ;
25
+ }
26
26
return 0 ;
27
27
}
28
28
@@ -81,7 +81,7 @@ ENCODER(big5hkscs)
81
81
}
82
82
}
83
83
}
84
- else if (TRYMAP_ENC (big5 , code , c ))
84
+ else if (TRYMAP_ENC_ST (big5 , code , c ))
85
85
;
86
86
else
87
87
return 1 ;
@@ -122,7 +122,7 @@ DECODER(big5hkscs)
122
122
REQUIRE_INBUF (2 );
123
123
124
124
if (0xc6 > c || c > 0xc8 || (c < 0xc7 && INBYTE2 < 0xa1 )) {
125
- if (TRYMAP_DEC (big5 , decoded , c , INBYTE2 )) {
125
+ if (TRYMAP_DEC_ST (big5 , decoded , c , INBYTE2 )) {
126
126
OUTCHAR (decoded );
127
127
NEXT_IN (2 );
128
128
continue ;
Original file line number Diff line number Diff line change @@ -211,6 +211,9 @@ get_module_state(PyObject *mod)
211
211
(m)->bottom]) != NOCHAR)
212
212
#define TRYMAP_ENC (charset , assi , uni ) \
213
213
_TRYMAP_ENC(&charset##_encmap[(uni) >> 8], assi, (uni) & 0xff)
214
+ #define TRYMAP_ENC_ST (charset , assi , uni ) \
215
+ _TRYMAP_ENC(&(codec->modstate->charset##_encmap)[(uni) >> 8], \
216
+ assi, (uni) & 0xff)
214
217
215
218
#define _TRYMAP_DEC (m , assi , val ) \
216
219
((m)->map != NULL && \
@@ -219,6 +222,8 @@ get_module_state(PyObject *mod)
219
222
((assi) = (m)->map[(val) - (m)->bottom]) != UNIINV)
220
223
#define TRYMAP_DEC (charset , assi , c1 , c2 ) \
221
224
_TRYMAP_DEC(&charset##_decmap[c1], assi, c2)
225
+ #define TRYMAP_DEC_ST (charset , assi , c1 , c2 ) \
226
+ _TRYMAP_DEC(&(codec->modstate->charset##_decmap)[c1], assi, c2)
222
227
223
228
#define BEGIN_MAPPINGS_LIST (NUM ) \
224
229
static int \
You can’t perform that action at this time.
0 commit comments