zscan 2.0.4 → 2.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -13,8 +13,6 @@
13
13
  #define RUBY_INTERNAL_H 1
14
14
 
15
15
  #include "ruby.h"
16
- #include "ruby/encoding.h"
17
- #include "ruby/io.h"
18
16
 
19
17
  #if defined(__cplusplus)
20
18
  extern "C" {
@@ -39,6 +37,12 @@ extern "C" {
39
37
  # endif
40
38
  #endif
41
39
 
40
+ /* The most significant bit of the lower part of half-long integer.
41
+ * If sizeof(long) == 4, this is 0x8000.
42
+ * If sizeof(long) == 8, this is 0x80000000.
43
+ */
44
+ #define HALF_LONG_MSB ((SIGNED_VALUE)1<<((SIZEOF_LONG*CHAR_BIT-1)/2))
45
+
42
46
  #define LIKELY(x) RB_LIKELY(x)
43
47
  #define UNLIKELY(x) RB_UNLIKELY(x)
44
48
 
@@ -73,8 +77,10 @@ extern "C" {
73
77
  # define __has_extension __has_feature
74
78
  #endif
75
79
 
76
- #if GCC_VERSION_SINCE(4, 6, 0) || __has_extension(c_static_assert)
80
+ #if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L)
77
81
  # define STATIC_ASSERT(name, expr) _Static_assert(expr, #name ": " #expr)
82
+ #elif GCC_VERSION_SINCE(4, 6, 0) || __has_extension(c_static_assert)
83
+ # define STATIC_ASSERT(name, expr) RB_GNUC_EXTENSION _Static_assert(expr, #name ": " #expr)
78
84
  #else
79
85
  # define STATIC_ASSERT(name, expr) typedef int static_assert_##name##_check[1 - 2*!(expr)]
80
86
  #endif
@@ -101,7 +107,7 @@ extern "C" {
101
107
  __builtin_mul_overflow_p((a), (b), (__typeof__(a * b))0)
102
108
  #elif defined HAVE_BUILTIN___BUILTIN_MUL_OVERFLOW
103
109
  #define MUL_OVERFLOW_P(a, b) \
104
- ({__typeof__(a) c; __builtin_mul_overflow((a), (b), &c);})
110
+ RB_GNUC_EXTENSION_BLOCK(__typeof__(a) c; __builtin_mul_overflow((a), (b), &c))
105
111
  #endif
106
112
 
107
113
  #define MUL_OVERFLOW_SIGNED_INTEGER_P(a, b, min, max) ( \
@@ -114,10 +120,10 @@ extern "C" {
114
120
  #ifdef HAVE_BUILTIN___BUILTIN_MUL_OVERFLOW_P
115
121
  /* __builtin_mul_overflow_p can take bitfield */
116
122
  /* and GCC permits bitfields for integers other than int */
117
- #define MUL_OVERFLOW_FIXNUM_P(a, b) ({ \
118
- struct { SIGNED_VALUE fixnum : SIZEOF_VALUE * CHAR_BIT - 1; } c; \
123
+ #define MUL_OVERFLOW_FIXNUM_P(a, b) RB_GNUC_EXTENSION_BLOCK( \
124
+ struct { long fixnum : SIZEOF_LONG * CHAR_BIT - 1; } c; \
119
125
  __builtin_mul_overflow_p((a), (b), c.fixnum); \
120
- })
126
+ )
121
127
  #else
122
128
  #define MUL_OVERFLOW_FIXNUM_P(a, b) MUL_OVERFLOW_SIGNED_INTEGER_P(a, b, FIXNUM_MIN, FIXNUM_MAX)
123
129
  #endif
@@ -287,10 +293,15 @@ nlz_int128(uint128_t x)
287
293
  static inline unsigned int
288
294
  nlz_intptr(uintptr_t x)
289
295
  {
290
- #if SIZEOF_VOIDP == 8
291
- return nlz_long_long(x);
292
- #elif SIZEOF_VOIDP == 4
296
+ #if SIZEOF_UINTPTR_T == SIZEOF_INT
293
297
  return nlz_int(x);
298
+ #elif SIZEOF_UINTPTR_T == SIZEOF_LONG
299
+ return nlz_long(x);
300
+ #elif SIZEOF_UINTPTR_T == SIZEOF_LONG_LONG
301
+ return nlz_long_long(x);
302
+ #else
303
+ #error no known integer type corresponds uintptr_t
304
+ return /* sane compiler */ ~0;
294
305
  #endif
295
306
  }
296
307
 
@@ -372,8 +383,6 @@ ntz_intptr(uintptr_t x)
372
383
  VALUE rb_int128t2big(int128_t n);
373
384
  #endif
374
385
 
375
- #define ST2FIX(h) LONG2FIX((long)(h))
376
-
377
386
  static inline long
378
387
  rb_overflowed_fix_to_int(long x)
379
388
  {
@@ -503,13 +512,19 @@ rb_fix_mod_fix(VALUE x, VALUE y)
503
512
  return mod;
504
513
  }
505
514
 
506
- #if defined(HAVE_UINT128_T)
515
+ #if defined(HAVE_UINT128_T) && defined(HAVE_LONG_LONG)
507
516
  # define bit_length(x) \
508
517
  (unsigned int) \
509
518
  (sizeof(x) <= SIZEOF_INT ? SIZEOF_INT * CHAR_BIT - nlz_int((unsigned int)(x)) : \
510
519
  sizeof(x) <= SIZEOF_LONG ? SIZEOF_LONG * CHAR_BIT - nlz_long((unsigned long)(x)) : \
511
520
  sizeof(x) <= SIZEOF_LONG_LONG ? SIZEOF_LONG_LONG * CHAR_BIT - nlz_long_long((unsigned LONG_LONG)(x)) : \
512
521
  SIZEOF_INT128_T * CHAR_BIT - nlz_int128((uint128_t)(x)))
522
+ #elif defined(HAVE_UINT128_T)
523
+ # define bit_length(x) \
524
+ (unsigned int) \
525
+ (sizeof(x) <= SIZEOF_INT ? SIZEOF_INT * CHAR_BIT - nlz_int((unsigned int)(x)) : \
526
+ sizeof(x) <= SIZEOF_LONG ? SIZEOF_LONG * CHAR_BIT - nlz_long((unsigned long)(x)) : \
527
+ SIZEOF_INT128_T * CHAR_BIT - nlz_int128((uint128_t)(x)))
513
528
  #elif defined(HAVE_LONG_LONG)
514
529
  # define bit_length(x) \
515
530
  (unsigned int) \
@@ -746,12 +761,15 @@ struct rb_subclass_entry {
746
761
  #if defined(HAVE_LONG_LONG)
747
762
  typedef unsigned LONG_LONG rb_serial_t;
748
763
  #define SERIALT2NUM ULL2NUM
764
+ #define PRI_SERIALT_PREFIX PRI_LL_PREFIX
749
765
  #elif defined(HAVE_UINT64_T)
750
766
  typedef uint64_t rb_serial_t;
751
767
  #define SERIALT2NUM SIZET2NUM
768
+ #define PRI_SERIALT_PREFIX PRI_64_PREFIX
752
769
  #else
753
770
  typedef unsigned long rb_serial_t;
754
771
  #define SERIALT2NUM ULONG2NUM
772
+ #define PRI_SERIALT_PREFIX PRI_LONG_PREFIX
755
773
  #endif
756
774
 
757
775
  struct rb_classext_struct {
@@ -838,45 +856,64 @@ struct RIMemo {
838
856
  };
839
857
 
840
858
  enum imemo_type {
841
- imemo_env = 0,
842
- imemo_cref = 1,
843
- imemo_svar = 2,
844
- imemo_throw_data = 3,
845
- imemo_ifunc = 4,
846
- imemo_memo = 5,
847
- imemo_ment = 6,
848
- imemo_iseq = 7,
849
- imemo_mask = 0x07
859
+ imemo_env = 0,
860
+ imemo_cref = 1, /*!< class reference */
861
+ imemo_svar = 2, /*!< special variable */
862
+ imemo_throw_data = 3,
863
+ imemo_ifunc = 4, /*!< iterator function */
864
+ imemo_memo = 5,
865
+ imemo_ment = 6,
866
+ imemo_iseq = 7,
867
+ imemo_tmpbuf = 8,
868
+ imemo_ast = 9,
869
+ imemo_parser_strterm = 10
850
870
  };
871
+ #define IMEMO_MASK 0x0f
851
872
 
852
873
  static inline enum imemo_type
853
874
  imemo_type(VALUE imemo)
854
875
  {
855
- return (RBASIC(imemo)->flags >> FL_USHIFT) & imemo_mask;
876
+ return (RBASIC(imemo)->flags >> FL_USHIFT) & IMEMO_MASK;
856
877
  }
857
878
 
858
- /* FL_USER0 to FL_USER2 is for type */
859
- #define IMEMO_FL_USHIFT (FL_USHIFT + 3)
860
- #define IMEMO_FL_USER0 FL_USER3
861
- #define IMEMO_FL_USER1 FL_USER4
862
- #define IMEMO_FL_USER2 FL_USER5
863
- #define IMEMO_FL_USER3 FL_USER6
864
- #define IMEMO_FL_USER4 FL_USER7
879
+ static inline int
880
+ imemo_type_p(VALUE imemo, enum imemo_type imemo_type)
881
+ {
882
+ if (LIKELY(!RB_SPECIAL_CONST_P(imemo))) {
883
+ /* fixed at compile time if imemo_type is given. */
884
+ const VALUE mask = (IMEMO_MASK << FL_USHIFT) | RUBY_T_MASK;
885
+ const VALUE expected_type = (imemo_type << FL_USHIFT) | T_IMEMO;
886
+ /* fixed at runtime. */
887
+ return expected_type == (RBASIC(imemo)->flags & mask);
888
+ }
889
+ else {
890
+ return 0;
891
+ }
892
+ }
865
893
 
866
- /* CREF in method.h */
894
+ /* FL_USER0 to FL_USER3 is for type */
895
+ #define IMEMO_FL_USHIFT (FL_USHIFT + 4)
896
+ #define IMEMO_FL_USER0 FL_USER4
897
+ #define IMEMO_FL_USER1 FL_USER5
898
+ #define IMEMO_FL_USER2 FL_USER6
899
+ #define IMEMO_FL_USER3 FL_USER7
900
+ #define IMEMO_FL_USER4 FL_USER8
867
901
 
868
- /* SVAR */
902
+ /* CREF (Class REFerence) is defined in method.h */
869
903
 
904
+ /*! SVAR (Special VARiable) */
870
905
  struct vm_svar {
871
906
  VALUE flags;
872
- const VALUE cref_or_me;
907
+ const VALUE cref_or_me; /*!< class reference or rb_method_entry_t */
873
908
  const VALUE lastline;
874
909
  const VALUE backref;
875
910
  const VALUE others;
876
911
  };
877
912
 
878
- /* THROW_DATA */
879
913
 
914
+ #define THROW_DATA_CONSUMED IMEMO_FL_USER0
915
+
916
+ /*! THROW_DATA */
880
917
  struct vm_throw_data {
881
918
  VALUE flags;
882
919
  VALUE reserved;
@@ -885,22 +922,72 @@ struct vm_throw_data {
885
922
  VALUE throw_state;
886
923
  };
887
924
 
888
- #define THROW_DATA_P(err) RB_TYPE_P((err), T_IMEMO)
925
+ #define THROW_DATA_P(err) RB_TYPE_P((VALUE)(err), T_IMEMO)
926
+
927
+ /* IFUNC (Internal FUNCtion) */
889
928
 
890
- /* IFUNC */
929
+ struct vm_ifunc_argc {
930
+ #if SIZEOF_INT * 2 > SIZEOF_VALUE
931
+ signed int min: (SIZEOF_VALUE * CHAR_BIT) / 2;
932
+ signed int max: (SIZEOF_VALUE * CHAR_BIT) / 2;
933
+ #else
934
+ int min, max;
935
+ #endif
936
+ };
891
937
 
938
+ /*! IFUNC (Internal FUNCtion) */
892
939
  struct vm_ifunc {
893
940
  VALUE flags;
894
941
  VALUE reserved;
895
942
  VALUE (*func)(ANYARGS);
896
943
  const void *data;
897
- ID id;
944
+ struct vm_ifunc_argc argc;
898
945
  };
899
946
 
900
947
  #define IFUNC_NEW(a, b, c) ((struct vm_ifunc *)rb_imemo_new(imemo_ifunc, (VALUE)(a), (VALUE)(b), (VALUE)(c), 0))
948
+ struct vm_ifunc *rb_vm_ifunc_new(VALUE (*func)(ANYARGS), const void *data, int min_argc, int max_argc);
949
+ static inline struct vm_ifunc *
950
+ rb_vm_ifunc_proc_new(VALUE (*func)(ANYARGS), const void *data)
951
+ {
952
+ return rb_vm_ifunc_new(func, data, 0, UNLIMITED_ARGUMENTS);
953
+ }
901
954
 
902
- /* MEMO */
955
+ typedef struct rb_imemo_tmpbuf_struct {
956
+ VALUE flags;
957
+ VALUE reserved;
958
+ VALUE *ptr; /* malloc'ed buffer */
959
+ struct rb_imemo_tmpbuf_struct *next; /* next imemo */
960
+ size_t cnt; /* buffer size in VALUE */
961
+ } rb_imemo_tmpbuf_t;
903
962
 
963
+ VALUE rb_imemo_tmpbuf_auto_free_pointer(void *buf);
964
+ VALUE rb_imemo_tmpbuf_auto_free_maybe_mark_buffer(void *buf, size_t cnt);
965
+ rb_imemo_tmpbuf_t *rb_imemo_tmpbuf_parser_heap(void *buf, rb_imemo_tmpbuf_t *old_heap, size_t cnt);
966
+
967
+ #define RB_IMEMO_TMPBUF_PTR(v) \
968
+ ((void *)(((const struct rb_imemo_tmpbuf_struct *)(v))->ptr))
969
+
970
+ static inline VALUE
971
+ rb_imemo_tmpbuf_auto_free_pointer_new_from_an_RString(VALUE str)
972
+ {
973
+ const void *src;
974
+ void *dst;
975
+ size_t len;
976
+
977
+ SafeStringValue(str);
978
+ len = RSTRING_LEN(str);
979
+ src = RSTRING_PTR(str);
980
+ dst = ruby_xmalloc(len);
981
+ memcpy(dst, src, len);
982
+ return rb_imemo_tmpbuf_auto_free_pointer(dst);
983
+ }
984
+
985
+ void rb_strterm_mark(VALUE obj);
986
+
987
+ /*! MEMO
988
+ *
989
+ * @see imemo_type
990
+ * */
904
991
  struct MEMO {
905
992
  VALUE flags;
906
993
  VALUE reserved;
@@ -941,6 +1028,7 @@ struct MEMO {
941
1028
  enum {
942
1029
  cmp_opt_Fixnum,
943
1030
  cmp_opt_String,
1031
+ cmp_opt_Float,
944
1032
  cmp_optimizable_count
945
1033
  };
946
1034
 
@@ -964,6 +1052,8 @@ struct cmp_opt_data {
964
1052
  (((long)a > (long)b) ? 1 : ((long)a < (long)b) ? -1 : 0) : \
965
1053
  (STRING_P(a) && STRING_P(b) && CMP_OPTIMIZABLE(data, String)) ? \
966
1054
  rb_str_cmp(a, b) : \
1055
+ (RB_FLOAT_TYPE_P(a) && RB_FLOAT_TYPE_P(b) && CMP_OPTIMIZABLE(data, Float)) ? \
1056
+ rb_float_cmp(a, b) : \
967
1057
  rb_cmpint(rb_funcallv(a, id_cmp, 1, &b), a, b))
968
1058
 
969
1059
  /* ment is in method.h */
@@ -988,8 +1078,12 @@ void rb_ary_set_len(VALUE, long);
988
1078
  void rb_ary_delete_same(VALUE, VALUE);
989
1079
  VALUE rb_ary_tmp_new_fill(long capa);
990
1080
  VALUE rb_ary_at(VALUE, VALUE);
1081
+ VALUE rb_ary_aref1(VALUE ary, VALUE i);
1082
+ VALUE rb_ary_aref2(VALUE ary, VALUE b, VALUE e);
991
1083
  size_t rb_ary_memsize(VALUE);
992
- #ifdef __GNUC__
1084
+ VALUE rb_to_array_type(VALUE obj);
1085
+ VALUE rb_check_to_array(VALUE ary);
1086
+ #if defined(__GNUC__) && defined(HAVE_VA_ARGS_MACRO)
993
1087
  #define rb_ary_new_from_args(n, ...) \
994
1088
  __extension__ ({ \
995
1089
  const VALUE args_to_new_ary[] = {__VA_ARGS__}; \
@@ -1000,6 +1094,22 @@ size_t rb_ary_memsize(VALUE);
1000
1094
  })
1001
1095
  #endif
1002
1096
 
1097
+ static inline VALUE
1098
+ rb_ary_entry_internal(VALUE ary, long offset)
1099
+ {
1100
+ long len = RARRAY_LEN(ary);
1101
+ const VALUE *ptr = RARRAY_CONST_PTR(ary);
1102
+ if (len == 0) return Qnil;
1103
+ if (offset < 0) {
1104
+ offset += len;
1105
+ if (offset < 0) return Qnil;
1106
+ }
1107
+ else if (len <= offset) {
1108
+ return Qnil;
1109
+ }
1110
+ return ptr[offset];
1111
+ }
1112
+
1003
1113
  /* bignum.c */
1004
1114
  extern const char ruby_digitmap[];
1005
1115
  double rb_big_fdiv_double(VALUE x, VALUE y);
@@ -1011,6 +1121,7 @@ size_t rb_big_size(VALUE);
1011
1121
  VALUE rb_integer_float_cmp(VALUE x, VALUE y);
1012
1122
  VALUE rb_integer_float_eq(VALUE x, VALUE y);
1013
1123
  VALUE rb_cstr_parse_inum(const char *str, ssize_t len, char **endp, int base);
1124
+ VALUE rb_str_convert_to_inum(VALUE str, int base, int badcheck, int raise_exception);
1014
1125
  VALUE rb_big_comp(VALUE x);
1015
1126
  VALUE rb_big_aref(VALUE x, VALUE y);
1016
1127
  VALUE rb_big_abs(VALUE x);
@@ -1021,6 +1132,7 @@ VALUE rb_big_gt(VALUE x, VALUE y);
1021
1132
  VALUE rb_big_ge(VALUE x, VALUE y);
1022
1133
  VALUE rb_big_lt(VALUE x, VALUE y);
1023
1134
  VALUE rb_big_le(VALUE x, VALUE y);
1135
+ VALUE rb_int_powm(int const argc, VALUE * const argv, VALUE const num);
1024
1136
 
1025
1137
  /* class.c */
1026
1138
  VALUE rb_class_boot(VALUE);
@@ -1035,7 +1147,6 @@ VALUE rb_obj_methods(int argc, const VALUE *argv, VALUE obj);
1035
1147
  VALUE rb_obj_protected_methods(int argc, const VALUE *argv, VALUE obj);
1036
1148
  VALUE rb_obj_private_methods(int argc, const VALUE *argv, VALUE obj);
1037
1149
  VALUE rb_obj_public_methods(int argc, const VALUE *argv, VALUE obj);
1038
- int rb_obj_basic_to_s_p(VALUE);
1039
1150
  VALUE rb_special_singleton_class(VALUE);
1040
1151
  VALUE rb_singleton_class_clone_and_attach(VALUE obj, VALUE attach);
1041
1152
  VALUE rb_singleton_class_get(VALUE obj);
@@ -1051,8 +1162,9 @@ VALUE rb_invcmp(VALUE, VALUE);
1051
1162
  struct rb_block;
1052
1163
  int rb_dvar_defined(ID, const struct rb_block *);
1053
1164
  int rb_local_defined(ID, const struct rb_block *);
1054
- CONSTFUNC(const char * rb_insns_name(int i));
1165
+ const char * rb_insns_name(int i);
1055
1166
  VALUE rb_insns_name_array(void);
1167
+ int rb_vm_insn_addr2insn(const void *);
1056
1168
 
1057
1169
  /* complex.c */
1058
1170
  VALUE rb_complex_plus(VALUE, VALUE);
@@ -1068,15 +1180,20 @@ void ruby_register_rollback_func_for_ensure(VALUE (*ensure_func)(ANYARGS), VALUE
1068
1180
  /* debug.c */
1069
1181
  PRINTF_ARGS(void ruby_debug_printf(const char*, ...), 1, 2);
1070
1182
 
1183
+ /* dir.c */
1184
+ VALUE rb_dir_getwd_ospath(void);
1185
+
1071
1186
  /* dmyext.c */
1072
1187
  void Init_enc(void);
1073
1188
  void Init_ext(void);
1074
1189
 
1075
1190
  /* encoding.c */
1076
1191
  ID rb_id_encoding(void);
1077
- CONSTFUNC(void rb_gc_mark_encodings(void));
1192
+ void rb_gc_mark_encodings(void);
1193
+ #ifdef RUBY_ENCODING_H
1078
1194
  rb_encoding *rb_enc_get_from_index(int index);
1079
1195
  rb_encoding *rb_enc_check_str(VALUE str1, VALUE str2);
1196
+ #endif
1080
1197
  int rb_encdb_replicate(const char *alias, const char *orig);
1081
1198
  int rb_encdb_alias(const char *alias, const char *orig);
1082
1199
  int rb_encdb_dummy(const char *name);
@@ -1095,36 +1212,51 @@ extern VALUE rb_eEAGAIN;
1095
1212
  extern VALUE rb_eEWOULDBLOCK;
1096
1213
  extern VALUE rb_eEINPROGRESS;
1097
1214
  void rb_report_bug_valist(VALUE file, int line, const char *fmt, va_list args);
1098
- VALUE rb_syntax_error_append(VALUE, VALUE, int, int, rb_encoding*, const char*, va_list);
1099
1215
  VALUE rb_check_backtrace(VALUE);
1100
1216
  NORETURN(void rb_async_bug_errno(const char *,int));
1101
1217
  const char *rb_builtin_type_name(int t);
1102
1218
  const char *rb_builtin_class_name(VALUE x);
1103
1219
  PRINTF_ARGS(void rb_sys_warn(const char *fmt, ...), 1, 2);
1104
1220
  PRINTF_ARGS(void rb_syserr_warn(int err, const char *fmt, ...), 2, 3);
1221
+ PRINTF_ARGS(void rb_sys_warning(const char *fmt, ...), 1, 2);
1222
+ PRINTF_ARGS(void rb_syserr_warning(int err, const char *fmt, ...), 2, 3);
1223
+ #ifdef RUBY_ENCODING_H
1224
+ VALUE rb_syntax_error_append(VALUE, VALUE, int, int, rb_encoding*, const char*, va_list);
1105
1225
  PRINTF_ARGS(void rb_enc_warn(rb_encoding *enc, const char *fmt, ...), 2, 3);
1106
1226
  PRINTF_ARGS(void rb_sys_enc_warn(rb_encoding *enc, const char *fmt, ...), 2, 3);
1107
1227
  PRINTF_ARGS(void rb_syserr_enc_warn(int err, rb_encoding *enc, const char *fmt, ...), 3, 4);
1108
- PRINTF_ARGS(void rb_sys_warning(const char *fmt, ...), 1, 2);
1109
- PRINTF_ARGS(void rb_syserr_warning(int err, const char *fmt, ...), 2, 3);
1110
1228
  PRINTF_ARGS(void rb_enc_warning(rb_encoding *enc, const char *fmt, ...), 2, 3);
1111
1229
  PRINTF_ARGS(void rb_sys_enc_warning(rb_encoding *enc, const char *fmt, ...), 2, 3);
1112
1230
  PRINTF_ARGS(void rb_syserr_enc_warning(int err, rb_encoding *enc, const char *fmt, ...), 3, 4);
1231
+ #endif
1232
+
1233
+ #define rb_raise_cstr(etype, mesg) \
1234
+ rb_exc_raise(rb_exc_new_str(etype, rb_str_new_cstr(mesg)))
1235
+ #define rb_raise_static(etype, mesg) \
1236
+ rb_exc_raise(rb_exc_new_str(etype, rb_str_new_static(mesg, rb_strlen_lit(mesg))))
1113
1237
 
1114
1238
  VALUE rb_name_err_new(VALUE mesg, VALUE recv, VALUE method);
1115
1239
  #define rb_name_err_raise_str(mesg, recv, name) \
1116
1240
  rb_exc_raise(rb_name_err_new(mesg, recv, name))
1117
1241
  #define rb_name_err_raise(mesg, recv, name) \
1118
1242
  rb_name_err_raise_str(rb_fstring_cstr(mesg), (recv), (name))
1243
+ VALUE rb_nomethod_err_new(VALUE mesg, VALUE recv, VALUE method, VALUE args, int priv);
1244
+ VALUE rb_key_err_new(VALUE mesg, VALUE recv, VALUE name);
1245
+ #define rb_key_err_raise(mesg, recv, name) \
1246
+ rb_exc_raise(rb_key_err_new(mesg, recv, name))
1119
1247
  NORETURN(void ruby_deprecated_internal_feature(const char *));
1120
1248
  #define DEPRECATED_INTERNAL_FEATURE(func) \
1121
1249
  (ruby_deprecated_internal_feature(func), UNREACHABLE)
1250
+ VALUE rb_warning_warn(VALUE mod, VALUE str);
1251
+ VALUE rb_warning_string(const char *fmt, ...);
1122
1252
 
1123
1253
  /* eval.c */
1124
1254
  VALUE rb_refinement_module_get_refined_class(VALUE module);
1255
+ extern ID ruby_static_id_signo, ruby_static_id_status;
1256
+ #define id_signo ruby_static_id_signo
1257
+ #define id_status ruby_static_id_status
1125
1258
 
1126
1259
  /* eval_error.c */
1127
- void ruby_error_print(void);
1128
1260
  VALUE rb_get_backtrace(VALUE info);
1129
1261
 
1130
1262
  /* eval_jump.c */
@@ -1132,15 +1264,18 @@ void rb_call_end_proc(VALUE data);
1132
1264
  void rb_mark_end_proc(void);
1133
1265
 
1134
1266
  /* file.c */
1267
+ extern const char ruby_null_device[];
1135
1268
  VALUE rb_home_dir_of(VALUE user, VALUE result);
1136
1269
  VALUE rb_default_home_dir(VALUE result);
1137
1270
  VALUE rb_realpath_internal(VALUE basedir, VALUE path, int strict);
1271
+ VALUE rb_check_realpath(VALUE basedir, VALUE path);
1138
1272
  void rb_file_const(const char*, VALUE);
1139
1273
  int rb_file_load_ok(const char *);
1140
1274
  VALUE rb_file_expand_path_fast(VALUE, VALUE);
1141
1275
  VALUE rb_file_expand_path_internal(VALUE, VALUE, int, int, VALUE);
1142
1276
  VALUE rb_get_path_check_to_string(VALUE, int);
1143
1277
  VALUE rb_get_path_check_convert(VALUE, VALUE, int);
1278
+ VALUE rb_get_path_check(VALUE, int);
1144
1279
  void Init_File(void);
1145
1280
  int ruby_is_fd_loadable(int fd);
1146
1281
 
@@ -1181,14 +1316,14 @@ void rb_copy_wb_protected_attribute(VALUE dest, VALUE obj);
1181
1316
  #define ruby_sized_xfree(ptr, size) ruby_xfree(ptr)
1182
1317
  #define SIZED_REALLOC_N(var,type,n,old_n) REALLOC_N(var, type, n)
1183
1318
  #else
1319
+ RUBY_SYMBOL_EXPORT_BEGIN
1184
1320
  void *ruby_sized_xrealloc(void *ptr, size_t new_size, size_t old_size) RUBY_ATTR_ALLOC_SIZE((2));
1185
1321
  void *ruby_sized_xrealloc2(void *ptr, size_t new_count, size_t element_size, size_t old_count) RUBY_ATTR_ALLOC_SIZE((2, 3));
1186
1322
  void ruby_sized_xfree(void *x, size_t size);
1323
+ RUBY_SYMBOL_EXPORT_END
1187
1324
  #define SIZED_REALLOC_N(var,type,n,old_n) ((var)=(type*)ruby_sized_xrealloc((char*)(var), (n) * sizeof(type), (old_n) * sizeof(type)))
1188
1325
  #endif
1189
1326
 
1190
- void rb_gc_resurrect(VALUE ptr);
1191
-
1192
1327
  /* optimized version of NEWOBJ() */
1193
1328
  #undef NEWOBJF_OF
1194
1329
  #undef RB_NEWOBJ_OF
@@ -1200,6 +1335,10 @@ void rb_gc_resurrect(VALUE ptr);
1200
1335
 
1201
1336
  /* hash.c */
1202
1337
  struct st_table *rb_hash_tbl_raw(VALUE hash);
1338
+ VALUE rb_hash_new_with_size(st_index_t size);
1339
+ RUBY_SYMBOL_EXPORT_BEGIN
1340
+ VALUE rb_hash_new_compare_by_id(void);
1341
+ RUBY_SYMBOL_EXPORT_END
1203
1342
  VALUE rb_hash_has_key(VALUE hash, VALUE key);
1204
1343
  VALUE rb_hash_default_value(VALUE hash, VALUE key);
1205
1344
  VALUE rb_hash_set_default_proc(VALUE hash, VALUE proc);
@@ -1208,13 +1347,14 @@ long rb_dbl_long_hash(double d);
1208
1347
  st_table *rb_init_identtable(void);
1209
1348
  st_table *rb_init_identtable_with_size(st_index_t size);
1210
1349
  VALUE rb_hash_compare_by_id_p(VALUE hash);
1350
+ VALUE rb_to_hash_type(VALUE obj);
1351
+ VALUE rb_hash_key_str(VALUE);
1211
1352
 
1212
1353
  #define RHASH_TBL_RAW(h) rb_hash_tbl_raw(h)
1213
1354
  VALUE rb_hash_keys(VALUE hash);
1214
1355
  VALUE rb_hash_values(VALUE hash);
1215
1356
  VALUE rb_hash_rehash(VALUE hash);
1216
1357
  int rb_hash_add_new_element(VALUE hash, VALUE key, VALUE val);
1217
- #define HASH_DELETED FL_USER1
1218
1358
  #define HASH_PROC_DEFAULT FL_USER2
1219
1359
 
1220
1360
  /* inits.c */
@@ -1226,8 +1366,12 @@ void ruby_set_inplace_mode(const char *);
1226
1366
  ssize_t rb_io_bufread(VALUE io, void *buf, size_t size);
1227
1367
  void rb_stdio_set_default_encoding(void);
1228
1368
  VALUE rb_io_flush_raw(VALUE, int);
1369
+ #ifdef RUBY_IO_H
1229
1370
  size_t rb_io_memsize(const rb_io_t *);
1371
+ #endif
1230
1372
  int rb_stderr_tty_p(void);
1373
+ void rb_io_fptr_finalize_internal(void *ptr);
1374
+ #define rb_io_fptr_finalize rb_io_fptr_finalize_internal
1231
1375
 
1232
1376
  /* load.c */
1233
1377
  VALUE rb_get_load_path(void);
@@ -1284,7 +1428,7 @@ enum ruby_num_rounding_mode {
1284
1428
 
1285
1429
  int rb_num_to_uint(VALUE val, unsigned int *ret);
1286
1430
  VALUE ruby_num_interval_step_size(VALUE from, VALUE to, VALUE step, int excl);
1287
- int ruby_float_step(VALUE from, VALUE to, VALUE step, int excl);
1431
+ int ruby_float_step(VALUE from, VALUE to, VALUE step, int excl, int allow_endless);
1288
1432
  double ruby_float_mod(double x, double y);
1289
1433
  int rb_num_negative_p(VALUE);
1290
1434
  VALUE rb_int_succ(VALUE num);
@@ -1301,6 +1445,7 @@ VALUE rb_int2str(VALUE num, int base);
1301
1445
  VALUE rb_dbl_hash(double d);
1302
1446
  VALUE rb_fix_plus(VALUE x, VALUE y);
1303
1447
  VALUE rb_int_gt(VALUE x, VALUE y);
1448
+ int rb_float_cmp(VALUE x, VALUE y);
1304
1449
  VALUE rb_float_gt(VALUE x, VALUE y);
1305
1450
  VALUE rb_int_ge(VALUE x, VALUE y);
1306
1451
  enum ruby_num_rounding_mode rb_num_get_rounding_option(VALUE opts);
@@ -1314,8 +1459,56 @@ VALUE rb_int_and(VALUE x, VALUE y);
1314
1459
  VALUE rb_int_lshift(VALUE x, VALUE y);
1315
1460
  VALUE rb_int_div(VALUE x, VALUE y);
1316
1461
  VALUE rb_int_abs(VALUE num);
1462
+ VALUE rb_int_odd_p(VALUE num);
1463
+
1464
+ static inline VALUE
1465
+ rb_num_compare_with_zero(VALUE num, ID mid)
1466
+ {
1467
+ VALUE zero = INT2FIX(0);
1468
+ VALUE r = rb_check_funcall(num, mid, 1, &zero);
1469
+ if (r == Qundef) {
1470
+ rb_cmperr(num, zero);
1471
+ }
1472
+ return r;
1473
+ }
1474
+
1475
+ static inline int
1476
+ rb_num_positive_int_p(VALUE num)
1477
+ {
1478
+ const ID mid = '>';
1479
+
1480
+ if (FIXNUM_P(num)) {
1481
+ if (rb_method_basic_definition_p(rb_cInteger, mid))
1482
+ return FIXNUM_POSITIVE_P(num);
1483
+ }
1484
+ else if (RB_TYPE_P(num, T_BIGNUM)) {
1485
+ if (rb_method_basic_definition_p(rb_cInteger, mid))
1486
+ return BIGNUM_POSITIVE_P(num);
1487
+ }
1488
+ return RTEST(rb_num_compare_with_zero(num, mid));
1489
+ }
1490
+
1491
+
1492
+ static inline int
1493
+ rb_num_negative_int_p(VALUE num)
1494
+ {
1495
+ const ID mid = '<';
1496
+
1497
+ if (FIXNUM_P(num)) {
1498
+ if (rb_method_basic_definition_p(rb_cInteger, mid))
1499
+ return FIXNUM_NEGATIVE_P(num);
1500
+ }
1501
+ else if (RB_TYPE_P(num, T_BIGNUM)) {
1502
+ if (rb_method_basic_definition_p(rb_cInteger, mid))
1503
+ return BIGNUM_NEGATIVE_P(num);
1504
+ }
1505
+ return RTEST(rb_num_compare_with_zero(num, mid));
1506
+ }
1507
+
1508
+
1317
1509
  VALUE rb_float_abs(VALUE flt);
1318
1510
  VALUE rb_float_equal(VALUE x, VALUE y);
1511
+ VALUE rb_float_eql(VALUE x, VALUE y);
1319
1512
 
1320
1513
  #if USE_FLONUM
1321
1514
  #define RUBY_BIT_ROTL(v, n) (((v) << (n)) | ((v) >> ((sizeof(v) * 8) - n)))
@@ -1400,6 +1593,9 @@ NORETURN(void rb_undefined_alloc(VALUE klass));
1400
1593
  double rb_num_to_dbl(VALUE val);
1401
1594
  VALUE rb_obj_dig(int argc, VALUE *argv, VALUE self, VALUE notfound);
1402
1595
  VALUE rb_immutable_obj_clone(int, VALUE *, VALUE);
1596
+ VALUE rb_obj_not_equal(VALUE obj1, VALUE obj2);
1597
+ VALUE rb_convert_type_with_id(VALUE,int,const char*,ID);
1598
+ VALUE rb_check_convert_type_with_id(VALUE,int,const char*,ID);
1403
1599
 
1404
1600
  struct RBasicRaw {
1405
1601
  VALUE flags;
@@ -1419,7 +1615,9 @@ struct RBasicRaw {
1419
1615
  #endif
1420
1616
  VALUE rb_parser_get_yydebug(VALUE);
1421
1617
  VALUE rb_parser_set_yydebug(VALUE, VALUE);
1618
+ RUBY_SYMBOL_EXPORT_BEGIN
1422
1619
  VALUE rb_parser_set_context(VALUE, const struct rb_block *, int);
1620
+ RUBY_SYMBOL_EXPORT_END
1423
1621
  void *rb_parser_load_file(VALUE parser, VALUE name);
1424
1622
  int rb_is_const_name(VALUE name);
1425
1623
  int rb_is_class_name(VALUE name);
@@ -1445,8 +1643,10 @@ ID rb_id_attrget(ID id);
1445
1643
  VALUE rb_proc_location(VALUE self);
1446
1644
  st_index_t rb_hash_proc(st_index_t hash, VALUE proc);
1447
1645
  int rb_block_arity(void);
1646
+ int rb_block_min_max_arity(int *max);
1448
1647
  VALUE rb_func_proc_new(rb_block_call_func_t func, VALUE val);
1449
- VALUE rb_func_lambda_new(rb_block_call_func_t func, VALUE val);
1648
+ VALUE rb_func_lambda_new(rb_block_call_func_t func, VALUE val, int min_argc, int max_argc);
1649
+ VALUE rb_block_to_s(VALUE self, const struct rb_block *block, const char *additional_info);
1450
1650
 
1451
1651
  /* process.c */
1452
1652
  #define RB_MAX_GROUPS (65536)
@@ -1479,6 +1679,7 @@ struct rb_execarg {
1479
1679
  unsigned new_pgroup_flag : 1;
1480
1680
  unsigned uid_given : 1;
1481
1681
  unsigned gid_given : 1;
1682
+ unsigned exception : 1;
1482
1683
  rb_pid_t pgroup_pgid; /* asis(-1), new pgroup(0), specified pgroup (0<V). */
1483
1684
  VALUE rlimit_limits; /* Qfalse or [[rtype, softlim, hardlim], ...] */
1484
1685
  mode_t umask_mask;
@@ -1498,8 +1699,17 @@ struct rb_execarg {
1498
1699
  * The beginning one is for /bin/sh used by exec_with_sh.
1499
1700
  * The last one for terminating NULL used by execve.
1500
1701
  * See rb_exec_fillarg() in process.c. */
1501
- #define ARGVSTR2ARGC(argv_str) (RSTRING_LEN(argv_str) / sizeof(char *) - 2)
1502
- #define ARGVSTR2ARGV(argv_str) ((char **)RSTRING_PTR(argv_str) + 1)
1702
+ #define ARGVSTR2ARGV(argv_str) ((char **)RB_IMEMO_TMPBUF_PTR(argv_str) + 1)
1703
+
1704
+ static inline size_t
1705
+ ARGVSTR2ARGC(VALUE argv_str)
1706
+ {
1707
+ size_t i = 0;
1708
+ char *const *p = ARGVSTR2ARGV(argv_str);
1709
+ while (p[i++])
1710
+ ;
1711
+ return i - 1;
1712
+ }
1503
1713
 
1504
1714
  rb_pid_t rb_fork_ruby(int *status);
1505
1715
  void rb_last_status_clear(void);
@@ -1512,12 +1722,14 @@ VALUE rb_rational_reciprocal(VALUE x);
1512
1722
  VALUE rb_cstr_to_rat(const char *, int);
1513
1723
  VALUE rb_rational_abs(VALUE self);
1514
1724
  VALUE rb_rational_cmp(VALUE self, VALUE other);
1725
+ VALUE rb_numeric_quo(VALUE x, VALUE y);
1515
1726
 
1516
1727
  /* re.c */
1517
1728
  VALUE rb_reg_compile(VALUE str, int options, const char *sourcefile, int sourceline);
1518
1729
  VALUE rb_reg_check_preprocess(VALUE);
1519
1730
  long rb_reg_search0(VALUE, VALUE, long, int, int);
1520
1731
  VALUE rb_reg_match_p(VALUE re, VALUE str, long pos);
1732
+ bool rb_reg_start_with_p(VALUE re, VALUE str);
1521
1733
  void rb_backref_set_string(VALUE string, long pos, long len);
1522
1734
  int rb_match_count(VALUE match);
1523
1735
  int rb_match_nth_defined(int nth, VALUE match);
@@ -1525,7 +1737,6 @@ int rb_match_nth_defined(int nth, VALUE match);
1525
1737
  /* signal.c */
1526
1738
  extern int ruby_enable_coredump;
1527
1739
  int rb_get_next_signal(void);
1528
- int rb_sigaltstack_size(void);
1529
1740
 
1530
1741
  /* strftime.c */
1531
1742
  #ifdef RUBY_ENCODING_H
@@ -1578,6 +1789,7 @@ VALUE rb_external_str_with_enc(VALUE str, rb_encoding *eenc);
1578
1789
  VALUE rb_str_cat_conv_enc_opts(VALUE newstr, long ofs, const char *ptr, long len,
1579
1790
  rb_encoding *from, int ecflags, VALUE ecopts);
1580
1791
  VALUE rb_enc_str_scrub(rb_encoding *enc, VALUE str, VALUE repl);
1792
+ VALUE rb_str_initialize(VALUE str, const char *ptr, long len, rb_encoding *enc);
1581
1793
  #endif
1582
1794
  #define STR_NOEMBED FL_USER1
1583
1795
  #define STR_SHARED FL_USER2 /* = ELTS_SHARED */
@@ -1589,6 +1801,7 @@ size_t rb_str_memsize(VALUE);
1589
1801
  VALUE rb_sym_proc_call(ID mid, int argc, const VALUE *argv, VALUE passed_proc);
1590
1802
  VALUE rb_sym_to_proc(VALUE sym);
1591
1803
  char *rb_str_to_cstr(VALUE str);
1804
+ VALUE rb_str_eql(VALUE str1, VALUE str2);
1592
1805
 
1593
1806
  /* symbol.c */
1594
1807
  #ifdef RUBY_ENCODING_H
@@ -1613,20 +1826,29 @@ VALUE rb_sym_intern_ascii_cstr(const char *ptr);
1613
1826
  rb_sym_intern_ascii_cstr(ptr); \
1614
1827
  })
1615
1828
  #endif
1829
+ VALUE rb_to_symbol_type(VALUE obj);
1616
1830
 
1617
1831
  /* struct.c */
1618
1832
  VALUE rb_struct_init_copy(VALUE copy, VALUE s);
1619
1833
  VALUE rb_struct_lookup(VALUE s, VALUE idx);
1834
+ VALUE rb_struct_s_keyword_init(VALUE klass);
1620
1835
 
1621
1836
  /* time.c */
1622
1837
  struct timeval rb_time_timeval(VALUE);
1623
1838
 
1624
1839
  /* thread.c */
1840
+ #define COVERAGE_INDEX_LINES 0
1841
+ #define COVERAGE_INDEX_BRANCHES 1
1842
+ #define COVERAGE_TARGET_LINES 1
1843
+ #define COVERAGE_TARGET_BRANCHES 2
1844
+ #define COVERAGE_TARGET_METHODS 4
1845
+
1625
1846
  VALUE rb_obj_is_mutex(VALUE obj);
1626
1847
  VALUE rb_suppress_tracing(VALUE (*func)(VALUE), VALUE arg);
1627
1848
  void rb_thread_execute_interrupts(VALUE th);
1628
1849
  void rb_clear_trace_func(void);
1629
1850
  VALUE rb_get_coverages(void);
1851
+ VALUE rb_default_coverage(int);
1630
1852
  VALUE rb_thread_shield_new(void);
1631
1853
  VALUE rb_thread_shield_wait(VALUE self);
1632
1854
  VALUE rb_thread_shield_release(VALUE self);
@@ -1635,25 +1857,29 @@ int rb_thread_to_be_killed(VALUE thread);
1635
1857
  void rb_mutex_allow_trap(VALUE self, int val);
1636
1858
  VALUE rb_uninterruptible(VALUE (*b_proc)(ANYARGS), VALUE data);
1637
1859
  VALUE rb_mutex_owned_p(VALUE self);
1638
- void ruby_kill(rb_pid_t pid, int sig);
1639
1860
 
1640
1861
  /* thread_pthread.c, thread_win32.c */
1641
- void Init_native_thread(void);
1642
1862
  int rb_divert_reserved_fd(int fd);
1643
1863
 
1644
1864
  /* transcode.c */
1645
1865
  extern VALUE rb_cEncodingConverter;
1866
+ #ifdef RUBY_ENCODING_H
1646
1867
  size_t rb_econv_memsize(rb_econv_t *);
1868
+ #endif
1647
1869
 
1648
1870
  /* us_ascii.c */
1871
+ #ifdef RUBY_ENCODING_H
1649
1872
  extern rb_encoding OnigEncodingUS_ASCII;
1873
+ #endif
1650
1874
 
1651
1875
  /* util.c */
1652
1876
  char *ruby_dtoa(double d_, int mode, int ndigits, int *decpt, int *sign, char **rve);
1653
1877
  char *ruby_hdtoa(double d, const char *xdigs, int ndigits, int *decpt, int *sign, char **rve);
1654
1878
 
1655
1879
  /* utf_8.c */
1880
+ #ifdef RUBY_ENCODING_H
1656
1881
  extern rb_encoding OnigEncodingUTF_8;
1882
+ #endif
1657
1883
 
1658
1884
  /* variable.c */
1659
1885
  void rb_gc_mark_global_tbl(void);
@@ -1663,9 +1889,7 @@ VALUE rb_attr_delete(VALUE, ID);
1663
1889
  VALUE rb_ivar_lookup(VALUE obj, ID id, VALUE undef);
1664
1890
  void rb_autoload_str(VALUE mod, ID id, VALUE file);
1665
1891
  void rb_deprecate_constant(VALUE mod, const char *name);
1666
-
1667
- /* version.c */
1668
- extern const char ruby_engine[];
1892
+ NORETURN(VALUE rb_mod_const_missing(VALUE,VALUE));
1669
1893
 
1670
1894
  /* vm_insnhelper.h */
1671
1895
  rb_serial_t rb_next_class_serial(void);
@@ -1679,11 +1903,9 @@ PUREFUNC(VALUE rb_vm_top_self(void));
1679
1903
  void rb_thread_recycle_stack_release(VALUE *);
1680
1904
  void rb_vm_change_state(void);
1681
1905
  void rb_vm_inc_const_missing_count(void);
1682
- void rb_thread_mark(void *th);
1683
1906
  const void **rb_vm_get_insns_address_table(void);
1684
- VALUE rb_sourcefilename(void);
1685
1907
  VALUE rb_source_location(int *pline);
1686
- const char *rb_source_loc(int *pline);
1908
+ const char *rb_source_location_cstr(int *pline);
1687
1909
  void rb_vm_pop_cfunc_frame(void);
1688
1910
  int rb_vm_add_root_module(ID id, VALUE module);
1689
1911
  void rb_vm_check_redefinition_by_prepend(VALUE klass);
@@ -1702,13 +1924,17 @@ VALUE rb_check_block_call(VALUE, ID, int, const VALUE *, rb_block_call_func_t, V
1702
1924
  typedef void rb_check_funcall_hook(int, VALUE, ID, int, const VALUE *, VALUE);
1703
1925
  VALUE rb_check_funcall_with_hook(VALUE recv, ID mid, int argc, const VALUE *argv,
1704
1926
  rb_check_funcall_hook *hook, VALUE arg);
1927
+ const char *rb_type_str(enum ruby_value_type type);
1705
1928
  VALUE rb_check_funcall_default(VALUE, ID, int, const VALUE *, VALUE);
1706
- VALUE rb_catch_protect(VALUE t, rb_block_call_func *func, VALUE data, int *stateptr);
1707
1929
  VALUE rb_yield_1(VALUE val);
1708
- VALUE rb_yield_lambda(VALUE values);
1930
+ VALUE rb_yield_force_blockarg(VALUE values);
1931
+ VALUE rb_lambda_call(VALUE obj, ID mid, int argc, const VALUE *argv,
1932
+ rb_block_call_func_t bl_proc, int min_argc, int max_argc,
1933
+ VALUE data2);
1709
1934
 
1710
1935
  /* vm_insnhelper.c */
1711
1936
  VALUE rb_equal_opt(VALUE obj1, VALUE obj2);
1937
+ VALUE rb_eql_opt(VALUE obj1, VALUE obj2);
1712
1938
 
1713
1939
  /* vm_method.c */
1714
1940
  void Init_eval_method(void);
@@ -1727,8 +1953,7 @@ void rb_backtrace_print_as_bugreport(void);
1727
1953
  int rb_backtrace_p(VALUE obj);
1728
1954
  VALUE rb_backtrace_to_str_ary(VALUE obj);
1729
1955
  VALUE rb_backtrace_to_location_ary(VALUE obj);
1730
- void rb_backtrace_print_to(VALUE output);
1731
- VALUE rb_vm_backtrace_object(void);
1956
+ void rb_backtrace_each(VALUE (*iter)(VALUE recv, VALUE str), VALUE output);
1732
1957
 
1733
1958
  RUBY_SYMBOL_EXPORT_BEGIN
1734
1959
  const char *rb_objspace_data_type_name(VALUE obj);
@@ -1773,7 +1998,7 @@ NORETURN(void rb_unexpected_type(VALUE,int));
1773
1998
  rb_unexpected_type((VALUE)(v), (t)) : (void)0)
1774
1999
 
1775
2000
  /* file.c (export) */
1776
- #ifdef HAVE_READLINK
2001
+ #if defined HAVE_READLINK && defined RUBY_ENCODING_H
1777
2002
  VALUE rb_readlink(VALUE path, rb_encoding *enc);
1778
2003
  #endif
1779
2004
  #ifdef __APPLE__
@@ -1795,9 +2020,9 @@ VALUE rb_int_positive_pow(long x, unsigned long y);
1795
2020
  /* process.c (export) */
1796
2021
  int rb_exec_async_signal_safe(const struct rb_execarg *e, char *errmsg, size_t errmsg_buflen);
1797
2022
  rb_pid_t rb_fork_async_signal_safe(int *status, int (*chfunc)(void*, char *, size_t), void *charg, VALUE fds, char *errmsg, size_t errmsg_buflen);
1798
- VALUE rb_execarg_new(int argc, const VALUE *argv, int accept_shell);
2023
+ VALUE rb_execarg_new(int argc, const VALUE *argv, int accept_shell, int allow_exc_opt);
1799
2024
  struct rb_execarg *rb_execarg_get(VALUE execarg_obj); /* dangerous. needs GC guard. */
1800
- VALUE rb_execarg_init(int argc, const VALUE *argv, int accept_shell, VALUE execarg_obj);
2025
+ VALUE rb_execarg_init(int argc, const VALUE *argv, int accept_shell, VALUE execarg_obj, int allow_exc_opt);
1801
2026
  int rb_execarg_addopt(VALUE execarg_obj, VALUE key, VALUE val);
1802
2027
  void rb_execarg_parent_start(VALUE execarg_obj);
1803
2028
  void rb_execarg_parent_end(VALUE execarg_obj);
@@ -1817,6 +2042,8 @@ VALUE rb_gcd_gmp(VALUE x, VALUE y);
1817
2042
  /* internal use */
1818
2043
  VALUE rb_setup_fake_str(struct RString *fake_str, const char *name, long len, rb_encoding *enc);
1819
2044
  #endif
2045
+ VALUE rb_str_upto_each(VALUE, VALUE, int, int (*each)(VALUE, VALUE), VALUE);
2046
+ VALUE rb_str_upto_endless_each(VALUE, int (*each)(VALUE, VALUE), VALUE);
1820
2047
 
1821
2048
  /* thread.c (export) */
1822
2049
  int ruby_thread_has_gvl_p(void); /* for ext/fiddle/closure.c */
@@ -1858,7 +2085,7 @@ RUBY_SYMBOL_EXPORT_END
1858
2085
  do { \
1859
2086
  if (UNLIKELY(RUBY_DTRACE_##name##_ENABLED())) { \
1860
2087
  int dtrace_line; \
1861
- const char *dtrace_file = rb_source_loc(&dtrace_line); \
2088
+ const char *dtrace_file = rb_source_location_cstr(&dtrace_line); \
1862
2089
  if (!dtrace_file) dtrace_file = ""; \
1863
2090
  RUBY_DTRACE_##name(arg, dtrace_file, dtrace_line); \
1864
2091
  } \
@@ -1882,6 +2109,28 @@ rb_obj_builtin_type(VALUE obj)
1882
2109
  }
1883
2110
  #endif
1884
2111
 
2112
+ /* A macro for defining a flexible array, like: VALUE ary[FLEX_ARY_LEN]; */
2113
+ #if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
2114
+ # define FLEX_ARY_LEN /* VALUE ary[]; */
2115
+ #elif defined(__GNUC__) && !defined(__STRICT_ANSI__)
2116
+ # define FLEX_ARY_LEN 0 /* VALUE ary[0]; */
2117
+ #else
2118
+ # define FLEX_ARY_LEN 1 /* VALUE ary[1]; */
2119
+ #endif
2120
+
2121
+ /*
2122
+ * For declaring bitfields out of non-unsigned int types:
2123
+ * struct date {
2124
+ * BITFIELD(enum months) month:4;
2125
+ * ...
2126
+ * };
2127
+ */
2128
+ #if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
2129
+ # define BITFIELD(type) type
2130
+ #else
2131
+ # define BITFIELD(type) unsigned int
2132
+ #endif
2133
+
1885
2134
  #if defined(__cplusplus)
1886
2135
  #if 0
1887
2136
  { /* satisfy cc-mode */