@@ -41,27 +41,18 @@ enum ruby_encoding_consts {
41
41
#define ENCODING_SHIFT RUBY_ENCODING_SHIFT
42
42
#define ENCODING_MASK RUBY_ENCODING_MASK
43
43
44
- #ifdef TRUFFLERUBY
45
- #define RB_ENCODING_SET_INLINED (obj ,i ) RB_ENCODING_SET(obj,i)
46
- #else
47
44
#define RB_ENCODING_SET_INLINED (obj ,i ) do {\
48
45
RBASIC(obj)->flags &= ~RUBY_ENCODING_MASK;\
49
46
RBASIC(obj)->flags |= (VALUE)(i) << RUBY_ENCODING_SHIFT;\
50
47
} while (0)
51
- #endif
52
48
#define RB_ENCODING_SET (obj ,i ) rb_enc_set_index((obj), (i))
53
49
54
- #ifdef TRUFFLERUBY
55
- #define RB_ENCODING_GET_INLINED (obj ) RB_ENCODING_GET(obj)
56
- #define RB_ENCODING_GET (obj ) rb_enc_get_index(obj)
57
- #else
58
50
#define RB_ENCODING_GET_INLINED (obj ) \
59
51
(int)((RBASIC(obj)->flags & RUBY_ENCODING_MASK)>>RUBY_ENCODING_SHIFT)
60
52
#define RB_ENCODING_GET (obj ) \
61
53
(RB_ENCODING_GET_INLINED(obj) != RUBY_ENCODING_INLINE_MAX ? \
62
54
RB_ENCODING_GET_INLINED(obj) : \
63
55
rb_enc_get_index(obj))
64
- #endif
65
56
66
57
#define RB_ENCODING_IS_ASCII8BIT (obj ) (RB_ENCODING_GET_INLINED(obj) == 0)
67
58
@@ -74,18 +65,12 @@ enum ruby_encoding_consts {
74
65
75
66
enum ruby_coderange_type {
76
67
RUBY_ENC_CODERANGE_UNKNOWN = 0 ,
77
- #ifdef TRUFFLERUBY
78
- RUBY_ENC_CODERANGE_7BIT = 1 ,
79
- RUBY_ENC_CODERANGE_VALID = 2 ,
80
- RUBY_ENC_CODERANGE_BROKEN = 4
81
- #else
82
68
RUBY_ENC_CODERANGE_7BIT = ((int )RUBY_FL_USER8 ),
83
69
RUBY_ENC_CODERANGE_VALID = ((int )RUBY_FL_USER9 ),
84
70
RUBY_ENC_CODERANGE_BROKEN = ((int )(RUBY_FL_USER8 |RUBY_FL_USER9 )),
85
71
RUBY_ENC_CODERANGE_MASK = (RUBY_ENC_CODERANGE_7BIT |
86
72
RUBY_ENC_CODERANGE_VALID |
87
73
RUBY_ENC_CODERANGE_BROKEN )
88
- #endif
89
74
};
90
75
91
76
static inline int
@@ -94,23 +79,12 @@ rb_enc_coderange_clean_p(int cr)
94
79
return (cr ^ (cr >> 1 )) & RUBY_ENC_CODERANGE_7BIT ;
95
80
}
96
81
#define RB_ENC_CODERANGE_CLEAN_P (cr ) rb_enc_coderange_clean_p(cr)
97
- #ifdef TRUFFLERUBY
98
- enum ruby_coderange_type RB_ENC_CODERANGE (VALUE obj );
99
- #else
100
82
#define RB_ENC_CODERANGE (obj ) ((int)RBASIC(obj)->flags & RUBY_ENC_CODERANGE_MASK)
101
- #endif
102
83
#define RB_ENC_CODERANGE_ASCIIONLY (obj ) (RB_ENC_CODERANGE(obj) == RUBY_ENC_CODERANGE_7BIT)
103
-
104
- #ifdef TRUFFLERUBY
105
- void RB_ENC_CODERANGE_SET (VALUE obj , int cr );
106
- void rb_enc_coderange_clear (VALUE );
107
- #define RB_ENC_CODERANGE_CLEAR (obj ) rb_enc_coderange_clear(obj)
108
- #else
109
84
#define RB_ENC_CODERANGE_SET (obj ,cr ) (\
110
85
RBASIC(obj)->flags = \
111
86
(RBASIC(obj)->flags & ~RUBY_ENC_CODERANGE_MASK) | (cr))
112
87
#define RB_ENC_CODERANGE_CLEAR (obj ) RB_ENC_CODERANGE_SET((obj),0)
113
- #endif
114
88
115
89
/* assumed ASCII compatibility */
116
90
#define RB_ENC_CODERANGE_AND (a , b ) \
@@ -173,9 +147,6 @@ VALUE rb_obj_encoding(VALUE);
173
147
VALUE rb_enc_str_buf_cat (VALUE str , const char * ptr , long len , rb_encoding * enc );
174
148
VALUE rb_enc_uint_chr (unsigned int code , rb_encoding * enc );
175
149
176
- VALUE rb_external_str_with_enc (VALUE string , rb_encoding * eenc );
177
- rb_encoding * get_encoding (VALUE string );
178
- #define STR_ENC_GET (string ) get_encoding(string)
179
150
VALUE rb_external_str_new_with_enc (const char * ptr , long len , rb_encoding * );
180
151
VALUE rb_str_export_to_enc (VALUE , rb_encoding * );
181
152
VALUE rb_str_conv_enc (VALUE str , rb_encoding * from , rb_encoding * to );
@@ -206,13 +177,8 @@ rb_encoding *rb_enc_find(const char *name);
206
177
#define rb_enc_name (enc ) (enc)->name
207
178
208
179
/* rb_encoding * -> minlen/maxlen */
209
- #ifdef TRUFFLERUBY
210
- int rb_enc_mbminlen (rb_encoding * enc );
211
- int rb_enc_mbmaxlen (rb_encoding * enc );
212
- #else
213
180
#define rb_enc_mbminlen (enc ) (enc)->min_enc_len
214
181
#define rb_enc_mbmaxlen (enc ) (enc)->max_enc_len
215
- #endif
216
182
217
183
/* -> mbclen (no error notification: 0 < ret <= e-p, no exception) */
218
184
int rb_enc_mbclen (const char * p , const char * e , rb_encoding * enc );
@@ -239,12 +205,7 @@ unsigned int rb_enc_codepoint_len(const char *p, const char *e, int *len, rb_enc
239
205
unsigned int rb_enc_codepoint (const char * p , const char * e , rb_encoding * enc );
240
206
/* overriding macro */
241
207
#define rb_enc_codepoint (p ,e ,enc ) rb_enc_codepoint_len((p),(e),0,(enc))
242
- #ifdef TRUFFLERUBY
243
- int rb_enc_mbc_to_codepoint (char * p , char * e , rb_encoding * enc );
244
- #define rb_enc_mbc_to_codepoint (p , e , enc ) rb_enc_mbc_to_codepoint(p, e, enc)
245
- #else
246
208
#define rb_enc_mbc_to_codepoint (p , e , enc ) ONIGENC_MBC_TO_CODE((enc),(UChar*)(p),(UChar*)(e))
247
- #endif
248
209
249
210
/* -> codelen>0 or raise exception */
250
211
int rb_enc_codelen (int code , rb_encoding * enc );
@@ -258,11 +219,7 @@ int rb_enc_code_to_mbclen(int code, rb_encoding *enc);
258
219
/* start, ptr, end, encoding -> prev_char */
259
220
#define rb_enc_prev_char (s ,p ,e ,enc ) ((char *)onigenc_get_prev_char_head((enc),(UChar*)(s),(UChar*)(p),(UChar*)(e)))
260
221
/* start, ptr, end, encoding -> next_char */
261
- #ifdef TRUFFLERUBY
262
- char * rb_enc_left_char_head (char * start , char * p , char * end , rb_encoding * enc );
263
- #else
264
222
#define rb_enc_left_char_head (s ,p ,e ,enc ) ((char *)onigenc_get_left_adjust_char_head((enc),(UChar*)(s),(UChar*)(p),(UChar*)(e)))
265
- #endif
266
223
#define rb_enc_right_char_head (s ,p ,e ,enc ) ((char *)onigenc_get_right_adjust_char_head((enc),(UChar*)(s),(UChar*)(p),(UChar*)(e)))
267
224
#define rb_enc_step_back (s ,p ,e ,n ,enc ) ((char *)onigenc_step_back((enc),(UChar*)(s),(UChar*)(p),(UChar*)(e),(int)(n)))
268
225
@@ -275,31 +232,17 @@ char* rb_enc_left_char_head(char *start, char *p, char *end, rb_encoding *enc);
275
232
#define rb_enc_islower (c ,enc ) ONIGENC_IS_CODE_LOWER((enc),(c))
276
233
#define rb_enc_isupper (c ,enc ) ONIGENC_IS_CODE_UPPER((enc),(c))
277
234
#define rb_enc_ispunct (c ,enc ) ONIGENC_IS_CODE_PUNCT((enc),(c))
278
- #ifdef TRUFFLERUBY
279
- int rb_enc_isalnum (unsigned char c , rb_encoding * enc );
280
- #define rb_enc_isalnum (c ,enc ) rb_enc_isalnum(c,enc)
281
- #else
282
235
#define rb_enc_isalnum (c ,enc ) ONIGENC_IS_CODE_ALNUM((enc),(c))
283
- #endif
284
236
#define rb_enc_isprint (c ,enc ) ONIGENC_IS_CODE_PRINT((enc),(c))
285
- #ifdef TRUFFLERUBY
286
- int rb_enc_isspace (unsigned char c , rb_encoding * enc );
287
- #define rb_enc_isspace (c ,enc ) rb_enc_isspace(c,enc)
288
- #else
289
237
#define rb_enc_isspace (c ,enc ) ONIGENC_IS_CODE_SPACE((enc),(c))
290
- #endif
291
238
#define rb_enc_isdigit (c ,enc ) ONIGENC_IS_CODE_DIGIT((enc),(c))
292
239
293
- #ifdef TRUFFLERUBY
294
- int rb_enc_asciicompat (rb_encoding * enc );
295
- #else
296
240
static inline int
297
241
rb_enc_asciicompat_inline (rb_encoding * enc )
298
242
{
299
243
return rb_enc_mbminlen (enc )== 1 && !rb_enc_dummy_p (enc );
300
244
}
301
245
#define rb_enc_asciicompat (enc ) rb_enc_asciicompat_inline(enc)
302
- #endif
303
246
304
247
int rb_enc_casefold (char * to , const char * p , const char * e , rb_encoding * enc );
305
248
CONSTFUNC (int rb_enc_toupper (int c , rb_encoding * enc ));
@@ -350,9 +293,6 @@ VALUE rb_check_symbol_cstr(const char *ptr, long len, rb_encoding *enc);
350
293
RUBY_EXTERN VALUE rb_cEncoding ;
351
294
352
295
/* econv stuff */
353
- #ifdef TRUFFLERUBY
354
- struct rb_econv_t {};
355
- #endif
356
296
357
297
typedef enum {
358
298
econv_invalid_byte_sequence ,
0 commit comments