zscan 2.0.6 → 2.0.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (114) hide show
  1. checksums.yaml +4 -4
  2. data/ext/extconf.rb +9 -1
  3. data/ext/pack/builtin-27.h +79 -0
  4. data/ext/pack/builtin.h +79 -0
  5. data/ext/pack/internal-27.h +96 -0
  6. data/ext/pack/internal-27/array.h +103 -0
  7. data/ext/pack/internal-27/bignum.h +246 -0
  8. data/ext/pack/internal-27/bits.h +566 -0
  9. data/ext/pack/internal-27/class.h +162 -0
  10. data/ext/pack/internal-27/compar.h +50 -0
  11. data/ext/pack/internal-27/compile.h +32 -0
  12. data/ext/pack/internal-27/compilers.h +108 -0
  13. data/ext/pack/internal-27/complex.h +29 -0
  14. data/ext/pack/internal-27/cont.h +23 -0
  15. data/ext/pack/internal-27/dir.h +17 -0
  16. data/ext/pack/internal-27/enc.h +20 -0
  17. data/ext/pack/internal-27/encoding.h +28 -0
  18. data/ext/pack/internal-27/enum.h +19 -0
  19. data/ext/pack/internal-27/enumerator.h +22 -0
  20. data/ext/pack/internal-27/error.h +129 -0
  21. data/ext/pack/internal-27/eval.h +33 -0
  22. data/ext/pack/internal-27/file.h +39 -0
  23. data/ext/pack/internal-27/fixnum.h +185 -0
  24. data/ext/pack/internal-27/gc.h +153 -0
  25. data/ext/pack/internal-27/hash.h +234 -0
  26. data/ext/pack/internal-27/imemo.h +242 -0
  27. data/ext/pack/internal-27/inits.h +51 -0
  28. data/ext/pack/internal-27/io.h +35 -0
  29. data/ext/pack/internal-27/load.h +19 -0
  30. data/ext/pack/internal-27/loadpath.h +17 -0
  31. data/ext/pack/internal-27/math.h +24 -0
  32. data/ext/pack/internal-27/missing.h +19 -0
  33. data/ext/pack/internal-27/mjit.h +29 -0
  34. data/ext/pack/internal-27/numeric.h +249 -0
  35. data/ext/pack/internal-27/object.h +60 -0
  36. data/ext/pack/internal-27/parse.h +23 -0
  37. data/ext/pack/internal-27/proc.h +32 -0
  38. data/ext/pack/internal-27/process.h +130 -0
  39. data/ext/pack/internal-27/random.h +17 -0
  40. data/ext/pack/internal-27/range.h +37 -0
  41. data/ext/pack/internal-27/rational.h +68 -0
  42. data/ext/pack/internal-27/re.h +29 -0
  43. data/ext/pack/internal-27/sanitizers.h +191 -0
  44. data/ext/pack/internal-27/serial.h +24 -0
  45. data/ext/pack/internal-27/signal.h +22 -0
  46. data/ext/pack/internal-27/static_assert.h +17 -0
  47. data/ext/pack/internal-27/string.h +135 -0
  48. data/ext/pack/internal-27/struct.h +154 -0
  49. data/ext/pack/internal-27/symbol.h +41 -0
  50. data/ext/pack/internal-27/thread.h +52 -0
  51. data/ext/pack/internal-27/time.h +35 -0
  52. data/ext/pack/internal-27/transcode.h +21 -0
  53. data/ext/pack/internal-27/util.h +31 -0
  54. data/ext/pack/internal-27/variable.h +92 -0
  55. data/ext/pack/internal-27/vm.h +127 -0
  56. data/ext/pack/internal-27/warnings.h +17 -0
  57. data/ext/pack/internal.h +57 -2102
  58. data/ext/pack/internal/array.h +103 -0
  59. data/ext/pack/internal/bignum.h +246 -0
  60. data/ext/pack/internal/bits.h +566 -0
  61. data/ext/pack/internal/class.h +162 -0
  62. data/ext/pack/internal/compar.h +50 -0
  63. data/ext/pack/internal/compile.h +32 -0
  64. data/ext/pack/internal/compilers.h +108 -0
  65. data/ext/pack/internal/complex.h +29 -0
  66. data/ext/pack/internal/cont.h +23 -0
  67. data/ext/pack/internal/dir.h +17 -0
  68. data/ext/pack/internal/enc.h +20 -0
  69. data/ext/pack/internal/encoding.h +28 -0
  70. data/ext/pack/internal/enum.h +19 -0
  71. data/ext/pack/internal/enumerator.h +22 -0
  72. data/ext/pack/internal/error.h +129 -0
  73. data/ext/pack/internal/eval.h +33 -0
  74. data/ext/pack/internal/file.h +39 -0
  75. data/ext/pack/internal/fixnum.h +185 -0
  76. data/ext/pack/internal/gc.h +153 -0
  77. data/ext/pack/internal/hash.h +234 -0
  78. data/ext/pack/internal/imemo.h +242 -0
  79. data/ext/pack/internal/inits.h +51 -0
  80. data/ext/pack/internal/io.h +35 -0
  81. data/ext/pack/internal/load.h +19 -0
  82. data/ext/pack/internal/loadpath.h +17 -0
  83. data/ext/pack/internal/math.h +24 -0
  84. data/ext/pack/internal/missing.h +19 -0
  85. data/ext/pack/internal/mjit.h +29 -0
  86. data/ext/pack/internal/numeric.h +249 -0
  87. data/ext/pack/internal/object.h +60 -0
  88. data/ext/pack/internal/parse.h +23 -0
  89. data/ext/pack/internal/proc.h +32 -0
  90. data/ext/pack/internal/process.h +130 -0
  91. data/ext/pack/internal/random.h +17 -0
  92. data/ext/pack/internal/range.h +37 -0
  93. data/ext/pack/internal/rational.h +68 -0
  94. data/ext/pack/internal/re.h +29 -0
  95. data/ext/pack/internal/sanitizers.h +191 -0
  96. data/ext/pack/internal/serial.h +24 -0
  97. data/ext/pack/internal/signal.h +22 -0
  98. data/ext/pack/internal/static_assert.h +17 -0
  99. data/ext/pack/internal/string.h +135 -0
  100. data/ext/pack/internal/struct.h +154 -0
  101. data/ext/pack/internal/symbol.h +41 -0
  102. data/ext/pack/internal/thread.h +52 -0
  103. data/ext/pack/internal/time.h +35 -0
  104. data/ext/pack/internal/transcode.h +21 -0
  105. data/ext/pack/internal/util.h +31 -0
  106. data/ext/pack/internal/variable.h +92 -0
  107. data/ext/pack/internal/vm.h +127 -0
  108. data/ext/pack/internal/warnings.h +17 -0
  109. data/ext/pack/pack-26.c +2 -109
  110. data/ext/pack/pack-27.c +1022 -0
  111. data/ext/pack/pack.c +57 -1047
  112. data/lib/zscan.rb +1 -1
  113. data/zscan.gemspec +1 -1
  114. metadata +109 -3
@@ -0,0 +1,24 @@
1
+ #ifndef INTERNAL_SERIAL_H /*-*-C-*-vi:se ft=c:*/
2
+ #define INTERNAL_SERIAL_H
3
+ /**
4
+ * @file
5
+ * @author Ruby developers <ruby-core@ruby-lang.org>
6
+ * @copyright This file is a part of the programming language Ruby.
7
+ * Permission is hereby granted, to either redistribute and/or
8
+ * modify this file, provided that the conditions mentioned in the
9
+ * file COPYING are met. Consult the file for details.
10
+ * @brief Internal header for rb_serial_t.
11
+ */
12
+ #include "ruby/internal/config.h" /* for HAVE_LONG_LONG */
13
+ #include "ruby/defines.h" /* for LONG_LONG */
14
+
15
+ #ifndef HAVE_LONG_LONG
16
+ # error need C99+
17
+ #endif
18
+
19
+ typedef unsigned LONG_LONG rb_serial_t;
20
+ #define SERIALT2NUM ULL2NUM
21
+ #define PRI_SERIALT_PREFIX PRI_LL_PREFIX
22
+ #define SIZEOF_SERIAL_T SIZEOF_LONG_LONG
23
+
24
+ #endif /* INTERNAL_SERIAL_H */
@@ -0,0 +1,22 @@
1
+ #ifndef INTERNAL_SIGNAL_H /*-*-C-*-vi:se ft=c:*/
2
+ #define INTERNAL_SIGNAL_H
3
+ /**
4
+ * @file
5
+ * @author Ruby developers <ruby-core@ruby-lang.org>
6
+ * @copyright This file is a part of the programming language Ruby.
7
+ * Permission is hereby granted, to either redistribute and/or
8
+ * modify this file, provided that the conditions mentioned in the
9
+ * file COPYING are met. Consult the file for details.
10
+ * @brief Internal header for SignalException.
11
+ */
12
+
13
+ /* signal.c */
14
+ extern int ruby_enable_coredump;
15
+ int rb_get_next_signal(void);
16
+
17
+ RUBY_SYMBOL_EXPORT_BEGIN
18
+ /* signal.c (export) */
19
+ int rb_grantpt(int fd);
20
+ RUBY_SYMBOL_EXPORT_END
21
+
22
+ #endif /* INTERNAL_SIGNAL_H */
@@ -0,0 +1,17 @@
1
+ #ifndef INTERNAL_STATIC_ASSERT_H /*-*-C-*-vi:se ft=c:*/
2
+ #define INTERNAL_STATIC_ASSERT_H
3
+ /**
4
+ * @file
5
+ * @author Ruby developers <ruby-core@ruby-lang.org>
6
+ * @copyright This file is a part of the programming language Ruby.
7
+ * Permission is hereby granted, to either redistribute and/or
8
+ * modify this file, provided that the conditions mentioned in the
9
+ * file COPYING are met. Consult the file for details.
10
+ * @brief C11 shim for _Static_assert.
11
+ */
12
+ #include "ruby/internal/static_assert.h"
13
+ #ifndef STATIC_ASSERT
14
+ # define STATIC_ASSERT RBIMPL_STATIC_ASSERT
15
+ #endif
16
+
17
+ #endif /* INTERNAL_STATIC_ASSERT_H */
@@ -0,0 +1,135 @@
1
+ #ifndef INTERNAL_STRING_H /*-*-C-*-vi:se ft=c:*/
2
+ #define INTERNAL_STRING_H
3
+ /**
4
+ * @file
5
+ * @author Ruby developers <ruby-core@ruby-lang.org>
6
+ * @copyright This file is a part of the programming language Ruby.
7
+ * Permission is hereby granted, to either redistribute and/or
8
+ * modify this file, provided that the conditions mentioned in the
9
+ * file COPYING are met. Consult the file for details.
10
+ * @brief Internal header for String.
11
+ */
12
+ #include "ruby/internal/config.h"
13
+ #include <stddef.h> /* for size_t */
14
+ #include "internal/compilers.h" /* for __has_builtin */
15
+ #include "ruby/internal/stdbool.h" /* for bool */
16
+ #include "ruby/encoding.h" /* for rb_encoding */
17
+ #include "ruby/ruby.h" /* for VALUE */
18
+
19
+ #define STR_NOEMBED FL_USER1
20
+ #define STR_SHARED FL_USER2 /* = ELTS_SHARED */
21
+
22
+ #ifdef rb_fstring_cstr
23
+ # undef rb_fstring_cstr
24
+ #endif
25
+
26
+ /* string.c */
27
+ VALUE rb_fstring(VALUE);
28
+ VALUE rb_fstring_cstr(const char *str);
29
+ VALUE rb_fstring_enc_new(const char *ptr, long len, rb_encoding *enc);
30
+ int rb_str_buf_cat_escaped_char(VALUE result, unsigned int c, int unicode_p);
31
+ int rb_str_symname_p(VALUE);
32
+ VALUE rb_str_quote_unprintable(VALUE);
33
+ char *rb_str_fill_terminator(VALUE str, const int termlen);
34
+ void rb_str_change_terminator_length(VALUE str, const int oldtermlen, const int termlen);
35
+ VALUE rb_str_locktmp_ensure(VALUE str, VALUE (*func)(VALUE), VALUE arg);
36
+ VALUE rb_str_chomp_string(VALUE str, VALUE chomp);
37
+ VALUE rb_external_str_with_enc(VALUE str, rb_encoding *eenc);
38
+ VALUE rb_str_cat_conv_enc_opts(VALUE newstr, long ofs, const char *ptr, long len,
39
+ rb_encoding *from, int ecflags, VALUE ecopts);
40
+ VALUE rb_enc_str_scrub(rb_encoding *enc, VALUE str, VALUE repl);
41
+ VALUE rb_str_initialize(VALUE str, const char *ptr, long len, rb_encoding *enc);
42
+ size_t rb_str_memsize(VALUE);
43
+ char *rb_str_to_cstr(VALUE str);
44
+ const char *ruby_escaped_char(int c);
45
+ static inline bool STR_EMBED_P(VALUE str);
46
+ static inline bool STR_SHARED_P(VALUE str);
47
+ static inline VALUE QUOTE(VALUE v);
48
+ static inline VALUE QUOTE_ID(ID v);
49
+ static inline bool is_ascii_string(VALUE str);
50
+ static inline bool is_broken_string(VALUE str);
51
+ static inline VALUE rb_str_eql_internal(const VALUE str1, const VALUE str2);
52
+
53
+ RUBY_SYMBOL_EXPORT_BEGIN
54
+ /* string.c (export) */
55
+ VALUE rb_str_tmp_frozen_acquire(VALUE str);
56
+ void rb_str_tmp_frozen_release(VALUE str, VALUE tmp);
57
+ VALUE rb_setup_fake_str(struct RString *fake_str, const char *name, long len, rb_encoding *enc);
58
+ VALUE rb_str_upto_each(VALUE, VALUE, int, int (*each)(VALUE, VALUE), VALUE);
59
+ VALUE rb_str_upto_endless_each(VALUE, int (*each)(VALUE, VALUE), VALUE);
60
+ RUBY_SYMBOL_EXPORT_END
61
+
62
+ MJIT_SYMBOL_EXPORT_BEGIN
63
+ VALUE rb_fstring_new(const char *ptr, long len);
64
+ VALUE rb_obj_as_string_result(VALUE str, VALUE obj);
65
+ VALUE rb_str_opt_plus(VALUE x, VALUE y);
66
+ VALUE rb_str_concat_literals(size_t num, const VALUE *strary);
67
+ VALUE rb_str_eql(VALUE str1, VALUE str2);
68
+ VALUE rb_id_quote_unprintable(ID);
69
+ VALUE rb_sym_proc_call(ID mid, int argc, const VALUE *argv, int kw_splat, VALUE passed_proc);
70
+ MJIT_SYMBOL_EXPORT_END
71
+
72
+ #define rb_fstring_lit(str) rb_fstring_new((str), rb_strlen_lit(str))
73
+ #define rb_fstring_literal(str) rb_fstring_lit(str)
74
+ #define rb_fstring_enc_lit(str, enc) rb_fstring_enc_new((str), rb_strlen_lit(str), (enc))
75
+ #define rb_fstring_enc_literal(str, enc) rb_fstring_enc_lit(str, enc)
76
+
77
+ static inline VALUE
78
+ QUOTE(VALUE v)
79
+ {
80
+ return rb_str_quote_unprintable(v);
81
+ }
82
+
83
+ static inline VALUE
84
+ QUOTE_ID(ID i)
85
+ {
86
+ return rb_id_quote_unprintable(i);
87
+ }
88
+
89
+ static inline bool
90
+ STR_EMBED_P(VALUE str)
91
+ {
92
+ return ! FL_TEST_RAW(str, STR_NOEMBED);
93
+ }
94
+
95
+ static inline bool
96
+ STR_SHARED_P(VALUE str)
97
+ {
98
+ return FL_ALL_RAW(str, STR_NOEMBED | ELTS_SHARED);
99
+ }
100
+
101
+ static inline bool
102
+ is_ascii_string(VALUE str)
103
+ {
104
+ return rb_enc_str_coderange(str) == ENC_CODERANGE_7BIT;
105
+ }
106
+
107
+ static inline bool
108
+ is_broken_string(VALUE str)
109
+ {
110
+ return rb_enc_str_coderange(str) == ENC_CODERANGE_BROKEN;
111
+ }
112
+
113
+ /* expect tail call optimization */
114
+ static inline VALUE
115
+ rb_str_eql_internal(const VALUE str1, const VALUE str2)
116
+ {
117
+ const long len = RSTRING_LEN(str1);
118
+ const char *ptr1, *ptr2;
119
+
120
+ if (len != RSTRING_LEN(str2)) return Qfalse;
121
+ if (!rb_str_comparable(str1, str2)) return Qfalse;
122
+ if ((ptr1 = RSTRING_PTR(str1)) == (ptr2 = RSTRING_PTR(str2)))
123
+ return Qtrue;
124
+ if (memcmp(ptr1, ptr2, len) == 0)
125
+ return Qtrue;
126
+ return Qfalse;
127
+ }
128
+
129
+ #if __has_builtin(__builtin_constant_p)
130
+ # define rb_fstring_cstr(str) \
131
+ (__builtin_constant_p(str) ? \
132
+ rb_fstring_new((str), (long)strlen(str)) : \
133
+ (rb_fstring_cstr)(str))
134
+ #endif
135
+ #endif /* INTERNAL_STRING_H */
@@ -0,0 +1,154 @@
1
+ #ifndef INTERNAL_STRUCT_H /*-*-C-*-vi:se ft=c:*/
2
+ #define INTERNAL_STRUCT_H
3
+ /**
4
+ * @file
5
+ * @author Ruby developers <ruby-core@ruby-lang.org>
6
+ * @copyright This file is a part of the programming language Ruby.
7
+ * Permission is hereby granted, to either redistribute and/or
8
+ * modify this file, provided that the conditions mentioned in the
9
+ * file COPYING are met. Consult the file for details.
10
+ * @brief Internal header for Struct.
11
+ */
12
+ #include "ruby/internal/stdbool.h" /* for bool */
13
+ #include "internal/gc.h" /* for RB_OBJ_WRITE */
14
+ #include "ruby/ruby.h" /* for struct RBasic */
15
+
16
+ enum {
17
+ RSTRUCT_EMBED_LEN_MAX = RVALUE_EMBED_LEN_MAX,
18
+ RSTRUCT_EMBED_LEN_MASK = (RUBY_FL_USER2|RUBY_FL_USER1),
19
+ RSTRUCT_EMBED_LEN_SHIFT = (RUBY_FL_USHIFT+1),
20
+ RSTRUCT_TRANSIENT_FLAG = FL_USER3,
21
+ };
22
+
23
+ struct RStruct {
24
+ struct RBasic basic;
25
+ union {
26
+ struct {
27
+ long len;
28
+ const VALUE *ptr;
29
+ } heap;
30
+ const VALUE ary[RSTRUCT_EMBED_LEN_MAX];
31
+ } as;
32
+ };
33
+
34
+ #define RSTRUCT(obj) (R_CAST(RStruct)(obj))
35
+
36
+ #ifdef RSTRUCT_LEN
37
+ # undef RSTRUCT_LEN
38
+ #endif
39
+
40
+ #ifdef RSTRUCT_PTR
41
+ # undef RSTRUCT_PTR
42
+ #endif
43
+
44
+ #ifdef RSTRUCT_SET
45
+ # undef RSTRUCT_SET
46
+ #endif
47
+
48
+ #ifdef RSTRUCT_GET
49
+ # undef RSTRUCT_GET
50
+ #endif
51
+
52
+ #define RSTRUCT_LEN internal_RSTRUCT_LEN
53
+ #define RSTRUCT_SET internal_RSTRUCT_SET
54
+ #define RSTRUCT_GET internal_RSTRUCT_GET
55
+
56
+ /* struct.c */
57
+ VALUE rb_struct_init_copy(VALUE copy, VALUE s);
58
+ VALUE rb_struct_lookup(VALUE s, VALUE idx);
59
+ VALUE rb_struct_s_keyword_init(VALUE klass);
60
+ static inline const VALUE *rb_struct_const_heap_ptr(VALUE st);
61
+ static inline bool RSTRUCT_TRANSIENT_P(VALUE st);
62
+ static inline void RSTRUCT_TRANSIENT_SET(VALUE st);
63
+ static inline void RSTRUCT_TRANSIENT_UNSET(VALUE st);
64
+ static inline long RSTRUCT_EMBED_LEN(VALUE st);
65
+ static inline long RSTRUCT_LEN(VALUE st);
66
+ static inline int RSTRUCT_LENINT(VALUE st);
67
+ static inline const VALUE *RSTRUCT_CONST_PTR(VALUE st);
68
+ static inline void RSTRUCT_SET(VALUE st, long k, VALUE v);
69
+ static inline VALUE RSTRUCT_GET(VALUE st, long k);
70
+
71
+ static inline bool
72
+ RSTRUCT_TRANSIENT_P(VALUE st)
73
+ {
74
+ #if USE_TRANSIENT_HEAP
75
+ return FL_TEST_RAW(st, RSTRUCT_TRANSIENT_FLAG);
76
+ #else
77
+ return false;
78
+ #endif
79
+ }
80
+
81
+ static inline void
82
+ RSTRUCT_TRANSIENT_SET(VALUE st)
83
+ {
84
+ #if USE_TRANSIENT_HEAP
85
+ FL_SET_RAW(st, RSTRUCT_TRANSIENT_FLAG);
86
+ #endif
87
+ }
88
+
89
+ static inline void
90
+ RSTRUCT_TRANSIENT_UNSET(VALUE st)
91
+ {
92
+ #if USE_TRANSIENT_HEAP
93
+ FL_UNSET_RAW(st, RSTRUCT_TRANSIENT_FLAG);
94
+ #endif
95
+ }
96
+
97
+ static inline long
98
+ RSTRUCT_EMBED_LEN(VALUE st)
99
+ {
100
+ long ret = FL_TEST_RAW(st, RSTRUCT_EMBED_LEN_MASK);
101
+ ret >>= RSTRUCT_EMBED_LEN_SHIFT;
102
+ return ret;
103
+ }
104
+
105
+ static inline long
106
+ RSTRUCT_LEN(VALUE st)
107
+ {
108
+ if (FL_TEST_RAW(st, RSTRUCT_EMBED_LEN_MASK)) {
109
+ return RSTRUCT_EMBED_LEN(st);
110
+ }
111
+ else {
112
+ return RSTRUCT(st)->as.heap.len;
113
+ }
114
+ }
115
+
116
+ static inline int
117
+ RSTRUCT_LENINT(VALUE st)
118
+ {
119
+ return rb_long2int(RSTRUCT_LEN(st));
120
+ }
121
+
122
+ static inline const VALUE *
123
+ RSTRUCT_CONST_PTR(VALUE st)
124
+ {
125
+ const struct RStruct *p = RSTRUCT(st);
126
+
127
+ if (FL_TEST_RAW(st, RSTRUCT_EMBED_LEN_MASK)) {
128
+ return p->as.ary;
129
+ }
130
+ else {
131
+ return p->as.heap.ptr;
132
+ }
133
+ }
134
+
135
+ static inline void
136
+ RSTRUCT_SET(VALUE st, long k, VALUE v)
137
+ {
138
+ RB_OBJ_WRITE(st, &RSTRUCT_CONST_PTR(st)[k], v);
139
+ }
140
+
141
+ static inline VALUE
142
+ RSTRUCT_GET(VALUE st, long k)
143
+ {
144
+ return RSTRUCT_CONST_PTR(st)[k];
145
+ }
146
+
147
+ static inline const VALUE *
148
+ rb_struct_const_heap_ptr(VALUE st)
149
+ {
150
+ /* TODO: check embed on debug mode */
151
+ return RSTRUCT(st)->as.heap.ptr;
152
+ }
153
+
154
+ #endif /* INTERNAL_STRUCT_H */
@@ -0,0 +1,41 @@
1
+ #ifndef INTERNAL_SYMBOL_H /*-*-C-*-vi:se ft=c:*/
2
+ #define INTERNAL_SYMBOL_H
3
+ /**
4
+ * @file
5
+ * @author Ruby developers <ruby-core@ruby-lang.org>
6
+ * @copyright This file is a part of the programming language Ruby.
7
+ * Permission is hereby granted, to either redistribute and/or
8
+ * modify this file, provided that the conditions mentioned in the
9
+ * file COPYING are met. Consult the file for details.
10
+ * @brief Internal header for Symbol.
11
+ */
12
+ #include "ruby/ruby.h" /* for VALUE */
13
+ #include "ruby/encoding.h" /* for rb_encoding */
14
+ #include "internal/compilers.h" /* for __has_builtin */
15
+
16
+ #ifdef rb_sym_intern_ascii_cstr
17
+ # undef rb_sym_intern_ascii_cstr
18
+ #endif
19
+
20
+ /* symbol.c */
21
+ VALUE rb_to_symbol_type(VALUE obj);
22
+ VALUE rb_sym_intern(const char *ptr, long len, rb_encoding *enc);
23
+ VALUE rb_sym_intern_ascii(const char *ptr, long len);
24
+ VALUE rb_sym_intern_ascii_cstr(const char *ptr);
25
+ int rb_is_const_name(VALUE name);
26
+ int rb_is_class_name(VALUE name);
27
+ int rb_is_instance_name(VALUE name);
28
+ int rb_is_local_name(VALUE name);
29
+ PUREFUNC(int rb_is_const_sym(VALUE sym));
30
+ PUREFUNC(int rb_is_attrset_sym(VALUE sym));
31
+ ID rb_make_internal_id(void);
32
+ void rb_gc_free_dsymbol(VALUE);
33
+
34
+ #if __has_builtin(__builtin_constant_p)
35
+ #define rb_sym_intern_ascii_cstr(ptr) \
36
+ (__builtin_constant_p(ptr) ? \
37
+ rb_sym_intern_ascii((ptr), (long)strlen(ptr)) : \
38
+ rb_sym_intern_ascii_cstr(ptr))
39
+ #endif
40
+
41
+ #endif /* INTERNAL_SYMBOL_H */
@@ -0,0 +1,52 @@
1
+ #ifndef INTERNAL_THREAD_H /*-*-C-*-vi:se ft=c:*/
2
+ #define INTERNAL_THREAD_H
3
+ /**
4
+ * @file
5
+ * @author Ruby developers <ruby-core@ruby-lang.org>
6
+ * @copyright This file is a part of the programming language Ruby.
7
+ * Permission is hereby granted, to either redistribute and/or
8
+ * modify this file, provided that the conditions mentioned in the
9
+ * file COPYING are met. Consult the file for details.
10
+ * @brief Internal header for Thread.
11
+ */
12
+ #include "ruby/ruby.h" /* for VALUE */
13
+ #include "ruby/intern.h" /* for rb_blocking_function_t */
14
+
15
+ struct rb_thread_struct; /* in vm_core.h */
16
+
17
+ /* thread.c */
18
+ #define COVERAGE_INDEX_LINES 0
19
+ #define COVERAGE_INDEX_BRANCHES 1
20
+ #define COVERAGE_TARGET_LINES 1
21
+ #define COVERAGE_TARGET_BRANCHES 2
22
+ #define COVERAGE_TARGET_METHODS 4
23
+ #define COVERAGE_TARGET_ONESHOT_LINES 8
24
+
25
+ VALUE rb_obj_is_mutex(VALUE obj);
26
+ VALUE rb_suppress_tracing(VALUE (*func)(VALUE), VALUE arg);
27
+ void rb_thread_execute_interrupts(VALUE th);
28
+ VALUE rb_get_coverages(void);
29
+ int rb_get_coverage_mode(void);
30
+ VALUE rb_default_coverage(int);
31
+ VALUE rb_thread_shield_new(void);
32
+ VALUE rb_thread_shield_wait(VALUE self);
33
+ VALUE rb_thread_shield_release(VALUE self);
34
+ VALUE rb_thread_shield_destroy(VALUE self);
35
+ int rb_thread_to_be_killed(VALUE thread);
36
+ void rb_mutex_allow_trap(VALUE self, int val);
37
+ VALUE rb_uninterruptible(VALUE (*b_proc)(VALUE), VALUE data);
38
+ VALUE rb_mutex_owned_p(VALUE self);
39
+
40
+ RUBY_SYMBOL_EXPORT_BEGIN
41
+ /* Temporary. This API will be removed (renamed). */
42
+ VALUE rb_thread_io_blocking_region(rb_blocking_function_t *func, void *data1, int fd);
43
+
44
+ /* thread.c (export) */
45
+ int ruby_thread_has_gvl_p(void); /* for ext/fiddle/closure.c */
46
+ RUBY_SYMBOL_EXPORT_END
47
+
48
+ MJIT_SYMBOL_EXPORT_BEGIN
49
+ int rb_threadptr_execute_interrupts(struct rb_thread_struct *th, int blocking_timing);
50
+ MJIT_SYMBOL_EXPORT_END
51
+
52
+ #endif /* INTERNAL_THREAD_H */