Skip to content

Commit a232c9a

Browse files
committed
Import files from MRI 2.7.4
1 parent fd0f34e commit a232c9a

File tree

118 files changed

+1683
-1588
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

118 files changed

+1683
-1588
lines changed

lib/cext/include/ruby/encoding.h

Lines changed: 0 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -41,27 +41,18 @@ enum ruby_encoding_consts {
4141
#define ENCODING_SHIFT RUBY_ENCODING_SHIFT
4242
#define ENCODING_MASK RUBY_ENCODING_MASK
4343

44-
#ifdef TRUFFLERUBY
45-
#define RB_ENCODING_SET_INLINED(obj,i) RB_ENCODING_SET(obj,i)
46-
#else
4744
#define RB_ENCODING_SET_INLINED(obj,i) do {\
4845
RBASIC(obj)->flags &= ~RUBY_ENCODING_MASK;\
4946
RBASIC(obj)->flags |= (VALUE)(i) << RUBY_ENCODING_SHIFT;\
5047
} while (0)
51-
#endif
5248
#define RB_ENCODING_SET(obj,i) rb_enc_set_index((obj), (i))
5349

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
5850
#define RB_ENCODING_GET_INLINED(obj) \
5951
(int)((RBASIC(obj)->flags & RUBY_ENCODING_MASK)>>RUBY_ENCODING_SHIFT)
6052
#define RB_ENCODING_GET(obj) \
6153
(RB_ENCODING_GET_INLINED(obj) != RUBY_ENCODING_INLINE_MAX ? \
6254
RB_ENCODING_GET_INLINED(obj) : \
6355
rb_enc_get_index(obj))
64-
#endif
6556

6657
#define RB_ENCODING_IS_ASCII8BIT(obj) (RB_ENCODING_GET_INLINED(obj) == 0)
6758

@@ -74,18 +65,12 @@ enum ruby_encoding_consts {
7465

7566
enum ruby_coderange_type {
7667
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
8268
RUBY_ENC_CODERANGE_7BIT = ((int)RUBY_FL_USER8),
8369
RUBY_ENC_CODERANGE_VALID = ((int)RUBY_FL_USER9),
8470
RUBY_ENC_CODERANGE_BROKEN = ((int)(RUBY_FL_USER8|RUBY_FL_USER9)),
8571
RUBY_ENC_CODERANGE_MASK = (RUBY_ENC_CODERANGE_7BIT|
8672
RUBY_ENC_CODERANGE_VALID|
8773
RUBY_ENC_CODERANGE_BROKEN)
88-
#endif
8974
};
9075

9176
static inline int
@@ -94,23 +79,12 @@ rb_enc_coderange_clean_p(int cr)
9479
return (cr ^ (cr >> 1)) & RUBY_ENC_CODERANGE_7BIT;
9580
}
9681
#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
10082
#define RB_ENC_CODERANGE(obj) ((int)RBASIC(obj)->flags & RUBY_ENC_CODERANGE_MASK)
101-
#endif
10283
#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
10984
#define RB_ENC_CODERANGE_SET(obj,cr) (\
11085
RBASIC(obj)->flags = \
11186
(RBASIC(obj)->flags & ~RUBY_ENC_CODERANGE_MASK) | (cr))
11287
#define RB_ENC_CODERANGE_CLEAR(obj) RB_ENC_CODERANGE_SET((obj),0)
113-
#endif
11488

11589
/* assumed ASCII compatibility */
11690
#define RB_ENC_CODERANGE_AND(a, b) \
@@ -173,9 +147,6 @@ VALUE rb_obj_encoding(VALUE);
173147
VALUE rb_enc_str_buf_cat(VALUE str, const char *ptr, long len, rb_encoding *enc);
174148
VALUE rb_enc_uint_chr(unsigned int code, rb_encoding *enc);
175149

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)
179150
VALUE rb_external_str_new_with_enc(const char *ptr, long len, rb_encoding *);
180151
VALUE rb_str_export_to_enc(VALUE, rb_encoding *);
181152
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);
206177
#define rb_enc_name(enc) (enc)->name
207178

208179
/* 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
213180
#define rb_enc_mbminlen(enc) (enc)->min_enc_len
214181
#define rb_enc_mbmaxlen(enc) (enc)->max_enc_len
215-
#endif
216182

217183
/* -> mbclen (no error notification: 0 < ret <= e-p, no exception) */
218184
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
239205
unsigned int rb_enc_codepoint(const char *p, const char *e, rb_encoding *enc);
240206
/* overriding macro */
241207
#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
246208
#define rb_enc_mbc_to_codepoint(p, e, enc) ONIGENC_MBC_TO_CODE((enc),(UChar*)(p),(UChar*)(e))
247-
#endif
248209

249210
/* -> codelen>0 or raise exception */
250211
int rb_enc_codelen(int code, rb_encoding *enc);
@@ -258,11 +219,7 @@ int rb_enc_code_to_mbclen(int code, rb_encoding *enc);
258219
/* start, ptr, end, encoding -> prev_char */
259220
#define rb_enc_prev_char(s,p,e,enc) ((char *)onigenc_get_prev_char_head((enc),(UChar*)(s),(UChar*)(p),(UChar*)(e)))
260221
/* 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
264222
#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
266223
#define rb_enc_right_char_head(s,p,e,enc) ((char *)onigenc_get_right_adjust_char_head((enc),(UChar*)(s),(UChar*)(p),(UChar*)(e)))
267224
#define rb_enc_step_back(s,p,e,n,enc) ((char *)onigenc_step_back((enc),(UChar*)(s),(UChar*)(p),(UChar*)(e),(int)(n)))
268225

@@ -275,31 +232,17 @@ char* rb_enc_left_char_head(char *start, char *p, char *end, rb_encoding *enc);
275232
#define rb_enc_islower(c,enc) ONIGENC_IS_CODE_LOWER((enc),(c))
276233
#define rb_enc_isupper(c,enc) ONIGENC_IS_CODE_UPPER((enc),(c))
277234
#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
282235
#define rb_enc_isalnum(c,enc) ONIGENC_IS_CODE_ALNUM((enc),(c))
283-
#endif
284236
#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
289237
#define rb_enc_isspace(c,enc) ONIGENC_IS_CODE_SPACE((enc),(c))
290-
#endif
291238
#define rb_enc_isdigit(c,enc) ONIGENC_IS_CODE_DIGIT((enc),(c))
292239

293-
#ifdef TRUFFLERUBY
294-
int rb_enc_asciicompat(rb_encoding *enc);
295-
#else
296240
static inline int
297241
rb_enc_asciicompat_inline(rb_encoding *enc)
298242
{
299243
return rb_enc_mbminlen(enc)==1 && !rb_enc_dummy_p(enc);
300244
}
301245
#define rb_enc_asciicompat(enc) rb_enc_asciicompat_inline(enc)
302-
#endif
303246

304247
int rb_enc_casefold(char *to, const char *p, const char *e, rb_encoding *enc);
305248
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);
350293
RUBY_EXTERN VALUE rb_cEncoding;
351294

352295
/* econv stuff */
353-
#ifdef TRUFFLERUBY
354-
struct rb_econv_t {};
355-
#endif
356296

357297
typedef enum {
358298
econv_invalid_byte_sequence,

lib/cext/include/ruby/intern.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -308,8 +308,6 @@ void rb_check_trusted(VALUE);
308308
rb_error_frozen_object(frozen_obj); \
309309
} \
310310
} while (0)
311-
#define rb_check_trusted_internal(obj) ((void) 0)
312-
#ifndef TRUFFLERUBY
313311
#ifdef __GNUC__
314312
#define rb_check_frozen(obj) __extension__({rb_check_frozen_internal(obj);})
315313
#else
@@ -326,7 +324,6 @@ rb_check_trusted_inline(VALUE obj)
326324
}
327325
#define rb_check_trusted(obj) rb_check_trusted_inline(obj)
328326
#endif
329-
#endif
330327
void rb_check_copyable(VALUE obj, VALUE orig);
331328

332329
#define RB_OBJ_INIT_COPY(obj, orig) \
@@ -583,13 +580,11 @@ VALUE rb_hash_size(VALUE);
583580
void rb_hash_free(VALUE);
584581
/* io.c */
585582
#define rb_defout rb_stdout
586-
#ifndef TRUFFLERUBY
587583
RUBY_EXTERN VALUE rb_fs;
588584
RUBY_EXTERN VALUE rb_output_fs;
589585
RUBY_EXTERN VALUE rb_rs;
590586
RUBY_EXTERN VALUE rb_default_rs;
591587
RUBY_EXTERN VALUE rb_output_rs;
592-
#endif
593588
VALUE rb_io_write(VALUE, VALUE);
594589
VALUE rb_io_gets(VALUE);
595590
VALUE rb_io_getbyte(VALUE);
@@ -842,7 +837,6 @@ VALUE rb_str_scrub(VALUE, VALUE);
842837
/* symbol.c */
843838
VALUE rb_sym_all_symbols(void);
844839

845-
#ifndef TRUFFLERUBY
846840
#ifdef HAVE_BUILTIN___BUILTIN_CONSTANT_P
847841
#define rb_str_new(str, len) RB_GNUC_EXTENSION_BLOCK( \
848842
(__builtin_constant_p(str) && __builtin_constant_p(len)) ? \
@@ -906,7 +900,6 @@ VALUE rb_sym_all_symbols(void);
906900
rb_exc_new_cstr((klass), (ptr)) \
907901
)
908902
#endif
909-
#endif
910903
#define rb_str_new2 rb_str_new_cstr
911904
#define rb_str_new3 rb_str_new_shared
912905
#define rb_str_new4 rb_str_new_frozen

lib/cext/include/ruby/io.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -124,12 +124,7 @@ typedef struct rb_io_enc_t rb_io_enc_t;
124124
/* #define FMODE_INET 0x00400000 */
125125
/* #define FMODE_INET6 0x00800000 */
126126

127-
#ifdef TRUFFLERUBY
128-
POLYGLOT_DECLARE_STRUCT(rb_io_t)
129-
#define GetOpenFile(obj,fp) rb_io_check_closed((fp) = polyglot_as_rb_io_t(RUBY_CEXT_INVOKE_NO_WRAP("GetOpenFile", obj)))
130-
#else
131127
#define GetOpenFile(obj,fp) rb_io_check_closed((fp) = RFILE(rb_io_taint_check(obj))->fptr)
132-
#endif
133128

134129
#define MakeOpenFile(obj, fp) do {\
135130
(fp) = rb_io_make_open_file(obj);\

lib/cext/include/ruby/onigmo.h

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -324,24 +324,13 @@ int onigenc_ascii_only_case_map(OnigCaseFoldType* flagP, const OnigUChar** pp, c
324324
#define ONIGENC_IS_MBC_ASCII_WORD(enc,s,end) \
325325
onigenc_ascii_is_code_ctype( \
326326
ONIGENC_MBC_TO_CODE(enc,s,end),ONIGENC_CTYPE_WORD,enc)
327-
#ifdef TRUFFLERUBY
328-
int enc_is_unicode(const OnigEncodingType *enc);
329-
#define ONIGENC_IS_UNICODE(enc) enc_is_unicode(enc)
330-
#else
331327
#define ONIGENC_IS_UNICODE(enc) ((enc)->flags & ONIGENC_FLAG_UNICODE)
332-
#endif
333328

334329

335330
#define ONIGENC_NAME(enc) ((enc)->name)
336331

337-
#ifdef TRUFFLERUBY
338-
int rb_tr_enc_mbc_case_fold(const OnigEncodingType *enc, int flag, const UChar** p, const UChar* end, UChar* lower);
339-
#define ONIGENC_MBC_CASE_FOLD(enc,flag,pp,end,buf) \
340-
rb_tr_enc_mbc_case_fold(enc,flag,pp,end,buf)
341-
#else
342332
#define ONIGENC_MBC_CASE_FOLD(enc,flag,pp,end,buf) \
343333
(enc)->mbc_case_fold(flag,(const OnigUChar** )pp,end,buf,enc)
344-
#endif
345334
#define ONIGENC_IS_ALLOWED_REVERSE_MATCH(enc,s,end) \
346335
(enc)->is_allowed_reverse_match(s,end,enc)
347336
#define ONIGENC_LEFT_ADJUST_CHAR_HEAD(enc,start,s,end) \
@@ -375,15 +364,8 @@ int onigenc_mbclen_approximate(const OnigUChar* p,const OnigUChar* e, const stru
375364
#define ONIGENC_MBC_MINLEN(enc) ((enc)->min_enc_len)
376365
#define ONIGENC_IS_MBC_NEWLINE(enc,p,end) (enc)->is_mbc_newline((p),(end),enc)
377366
#define ONIGENC_MBC_TO_CODE(enc,p,end) (enc)->mbc_to_code((p),(end),enc)
378-
#ifdef TRUFFLERUBY
379-
int rb_tr_code_to_mbclen(OnigCodePoint code, OnigEncodingType *encoding);
380-
#define ONIGENC_CODE_TO_MBCLEN(enc,code) rb_tr_code_to_mbclen(code,enc)
381-
int rb_tr_code_to_mbc(OnigCodePoint code, UChar *buf, OnigEncoding enc);
382-
#define ONIGENC_CODE_TO_MBC(enc,code,buf) rb_tr_code_to_mbc(code,buf,enc)
383-
#else
384367
#define ONIGENC_CODE_TO_MBCLEN(enc,code) (enc)->code_to_mbclen(code,enc)
385368
#define ONIGENC_CODE_TO_MBC(enc,code,buf) (enc)->code_to_mbc(code,buf,enc)
386-
#endif
387369
#define ONIGENC_PROPERTY_NAME_TO_CTYPE(enc,p,end) \
388370
(enc)->property_name_to_ctype(enc,p,end)
389371

0 commit comments

Comments
 (0)