kanayago 0.2.0 → 0.3.0

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.
Files changed (70) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/Rakefile +5 -48
  4. data/ext/kanayago/extconf.rb +8 -0
  5. data/lib/kanayago/version.rb +1 -1
  6. data/script/setup_parser.rb +136 -0
  7. metadata +2 -64
  8. data/ext/kanayago/ccan/check_type/check_type.h +0 -63
  9. data/ext/kanayago/ccan/container_of/container_of.h +0 -142
  10. data/ext/kanayago/ccan/list/list.h +0 -791
  11. data/ext/kanayago/ccan/str/str.h +0 -17
  12. data/ext/kanayago/constant.h +0 -53
  13. data/ext/kanayago/id.h +0 -354
  14. data/ext/kanayago/id_table.h +0 -54
  15. data/ext/kanayago/include/ruby/st.h +0 -199
  16. data/ext/kanayago/internal/array.h +0 -154
  17. data/ext/kanayago/internal/basic_operators.h +0 -65
  18. data/ext/kanayago/internal/bignum.h +0 -245
  19. data/ext/kanayago/internal/bits.h +0 -650
  20. data/ext/kanayago/internal/compile.h +0 -34
  21. data/ext/kanayago/internal/compilers.h +0 -107
  22. data/ext/kanayago/internal/complex.h +0 -29
  23. data/ext/kanayago/internal/encoding.h +0 -39
  24. data/ext/kanayago/internal/error.h +0 -251
  25. data/ext/kanayago/internal/fixnum.h +0 -185
  26. data/ext/kanayago/internal/gc.h +0 -358
  27. data/ext/kanayago/internal/hash.h +0 -194
  28. data/ext/kanayago/internal/imemo.h +0 -322
  29. data/ext/kanayago/internal/io.h +0 -163
  30. data/ext/kanayago/internal/namespace.h +0 -81
  31. data/ext/kanayago/internal/numeric.h +0 -275
  32. data/ext/kanayago/internal/parse.h +0 -131
  33. data/ext/kanayago/internal/rational.h +0 -71
  34. data/ext/kanayago/internal/re.h +0 -33
  35. data/ext/kanayago/internal/ruby_parser.h +0 -125
  36. data/ext/kanayago/internal/sanitizers.h +0 -346
  37. data/ext/kanayago/internal/serial.h +0 -23
  38. data/ext/kanayago/internal/set_table.h +0 -70
  39. data/ext/kanayago/internal/static_assert.h +0 -16
  40. data/ext/kanayago/internal/string.h +0 -203
  41. data/ext/kanayago/internal/symbol.h +0 -46
  42. data/ext/kanayago/internal/thread.h +0 -112
  43. data/ext/kanayago/internal/variable.h +0 -74
  44. data/ext/kanayago/internal/vm.h +0 -136
  45. data/ext/kanayago/internal/warnings.h +0 -16
  46. data/ext/kanayago/internal.h +0 -105
  47. data/ext/kanayago/lex.c +0 -302
  48. data/ext/kanayago/method.h +0 -271
  49. data/ext/kanayago/node.c +0 -446
  50. data/ext/kanayago/node.h +0 -122
  51. data/ext/kanayago/node_name.inc +0 -224
  52. data/ext/kanayago/parse.c +0 -27377
  53. data/ext/kanayago/parse.h +0 -244
  54. data/ext/kanayago/parser_bits.h +0 -564
  55. data/ext/kanayago/parser_node.h +0 -32
  56. data/ext/kanayago/parser_st.c +0 -165
  57. data/ext/kanayago/parser_st.h +0 -162
  58. data/ext/kanayago/parser_value.h +0 -106
  59. data/ext/kanayago/probes.h +0 -4
  60. data/ext/kanayago/ruby_assert.h +0 -14
  61. data/ext/kanayago/ruby_atomic.h +0 -66
  62. data/ext/kanayago/ruby_parser.c +0 -1137
  63. data/ext/kanayago/rubyparser.h +0 -1394
  64. data/ext/kanayago/shape.h +0 -444
  65. data/ext/kanayago/st.c +0 -3223
  66. data/ext/kanayago/symbol.h +0 -116
  67. data/ext/kanayago/thread_pthread.h +0 -175
  68. data/ext/kanayago/universal_parser.c +0 -211
  69. data/ext/kanayago/vm_core.h +0 -2349
  70. data/ext/kanayago/vm_opts.h +0 -67
@@ -1,322 +0,0 @@
1
- #ifndef INTERNAL_IMEMO_H /*-*-C-*-vi:se ft=c:*/
2
- #define INTERNAL_IMEMO_H
3
- /**
4
- * @author Ruby developers <ruby-core@ruby-lang.org>
5
- * @copyright This file is a part of the programming language Ruby.
6
- * Permission is hereby granted, to either redistribute and/or
7
- * modify this file, provided that the conditions mentioned in the
8
- * file COPYING are met. Consult the file for details.
9
- * @brief IMEMO: Internal memo object.
10
- */
11
- #include "ruby/internal/config.h"
12
- #include <stddef.h> /* for size_t */
13
- #include "id_table.h"
14
- #include "internal/array.h" /* for rb_ary_hidden_new_fill */
15
- #include "ruby/internal/stdbool.h" /* for bool */
16
- #include "ruby/ruby.h" /* for rb_block_call_func_t */
17
-
18
- #define IMEMO_MASK 0x0f
19
-
20
- /* FL_USER0 to FL_USER3 is for type */
21
- #define IMEMO_FL_USHIFT (FL_USHIFT + 4)
22
- #define IMEMO_FL_USER0 FL_USER4
23
- #define IMEMO_FL_USER1 FL_USER5
24
- #define IMEMO_FL_USER2 FL_USER6
25
- #define IMEMO_FL_USER3 FL_USER7
26
- #define IMEMO_FL_USER4 FL_USER8
27
- #define IMEMO_FL_USER5 FL_USER9
28
- #define IMEMO_FL_USER6 FL_USER10
29
-
30
- enum imemo_type {
31
- imemo_env = 0,
32
- imemo_cref = 1, /*!< class reference */
33
- imemo_svar = 2, /*!< special variable */
34
- imemo_throw_data = 3,
35
- imemo_ifunc = 4, /*!< iterator function */
36
- imemo_memo = 5,
37
- imemo_ment = 6,
38
- imemo_iseq = 7,
39
- imemo_tmpbuf = 8,
40
- imemo_callinfo = 10,
41
- imemo_callcache = 11,
42
- imemo_constcache = 12,
43
- imemo_fields = 13,
44
- };
45
-
46
- /* CREF (Class REFerence) is defined in method.h */
47
-
48
- /*! SVAR (Special VARiable) */
49
- struct vm_svar {
50
- VALUE flags;
51
- const VALUE cref_or_me; /*!< class reference or rb_method_entry_t */
52
- const VALUE lastline;
53
- const VALUE backref;
54
- const VALUE others;
55
- };
56
-
57
- /*! THROW_DATA */
58
- struct vm_throw_data {
59
- VALUE flags;
60
- VALUE reserved;
61
- const VALUE throw_obj;
62
- const struct rb_control_frame_struct *catch_frame;
63
- int throw_state;
64
- };
65
-
66
- #define THROW_DATA_CONSUMED IMEMO_FL_USER0
67
-
68
- /* IFUNC (Internal FUNCtion) */
69
-
70
- struct vm_ifunc_argc {
71
- #if SIZEOF_INT * 2 > SIZEOF_VALUE
72
- signed int min: (SIZEOF_VALUE * CHAR_BIT) / 2;
73
- signed int max: (SIZEOF_VALUE * CHAR_BIT) / 2;
74
- #else
75
- int min, max;
76
- #endif
77
- };
78
-
79
- /*! IFUNC (Internal FUNCtion)
80
- *
81
- * Bookkeeping for converting a C function and some closed-over data into a
82
- * block passable to methods. Like Ruby Proc, but not directly accessible at
83
- * Ruby level since this is an imemo. See rb_block_call() and friends.
84
- */
85
- struct vm_ifunc {
86
- VALUE flags;
87
- VALUE *svar_lep;
88
- rb_block_call_func_t func;
89
- const void *data;
90
- struct vm_ifunc_argc argc;
91
- };
92
- #define IFUNC_YIELD_OPTIMIZABLE IMEMO_FL_USER0
93
-
94
- struct rb_imemo_tmpbuf_struct {
95
- VALUE flags;
96
- VALUE *ptr; /* malloc'ed buffer */
97
- size_t cnt; /* buffer size in VALUE */
98
- };
99
-
100
- /*! MEMO
101
- *
102
- * @see imemo_type
103
- * */
104
- struct MEMO {
105
- VALUE flags;
106
- VALUE reserved;
107
- const VALUE v1;
108
- const VALUE v2;
109
- union {
110
- long cnt;
111
- long state;
112
- const VALUE value;
113
- void (*func)(void);
114
- } u3;
115
- };
116
-
117
- #define IMEMO_NEW(T, type, v0) ((T *)rb_imemo_new((type), (v0), sizeof(T), false))
118
- #define SHAREABLE_IMEMO_NEW(T, type, v0) ((T *)rb_imemo_new((type), (v0), sizeof(T), true))
119
-
120
- /* ment is in method.h */
121
-
122
- #define THROW_DATA_P(err) imemo_throw_data_p((VALUE)err)
123
- #define MEMO_CAST(m) ((struct MEMO *)(m))
124
- #define MEMO_FOR(type, value) ((type *)RARRAY_PTR(value))
125
- #define NEW_MEMO_FOR(type, value) \
126
- ((value) = rb_ary_hidden_new_fill(type_roomof(type, VALUE)), MEMO_FOR(type, value))
127
- #define NEW_PARTIAL_MEMO_FOR(type, value, member) \
128
- ((value) = rb_ary_hidden_new_fill(type_roomof(type, VALUE)), \
129
- rb_ary_set_len((value), offsetof(type, member) / sizeof(VALUE)), \
130
- MEMO_FOR(type, value))
131
-
132
- #ifndef RUBY_RUBYPARSER_H
133
- typedef struct rb_imemo_tmpbuf_struct rb_imemo_tmpbuf_t;
134
- #endif
135
- VALUE rb_imemo_new(enum imemo_type type, VALUE v0, size_t size, bool is_shareable);
136
- VALUE rb_imemo_tmpbuf_new(void);
137
- struct vm_ifunc *rb_vm_ifunc_new(rb_block_call_func_t func, const void *data, int min_argc, int max_argc);
138
- static inline enum imemo_type imemo_type(VALUE imemo);
139
- static inline int imemo_type_p(VALUE imemo, enum imemo_type imemo_type);
140
- static inline bool imemo_throw_data_p(VALUE imemo);
141
- static inline struct vm_ifunc *rb_vm_ifunc_proc_new(rb_block_call_func_t func, const void *data);
142
- static inline void *RB_IMEMO_TMPBUF_PTR(VALUE v);
143
- static inline void *rb_imemo_tmpbuf_set_ptr(VALUE v, void *ptr);
144
- static inline void MEMO_V1_SET(struct MEMO *m, VALUE v);
145
- static inline void MEMO_V2_SET(struct MEMO *m, VALUE v);
146
-
147
- size_t rb_imemo_memsize(VALUE obj);
148
- void rb_imemo_mark_and_move(VALUE obj, bool reference_updating);
149
- void rb_imemo_free(VALUE obj);
150
-
151
- RUBY_SYMBOL_EXPORT_BEGIN
152
- const char *rb_imemo_name(enum imemo_type type);
153
- RUBY_SYMBOL_EXPORT_END
154
-
155
- static inline struct MEMO *
156
- MEMO_NEW(VALUE a, VALUE b, VALUE c)
157
- {
158
- struct MEMO *memo = IMEMO_NEW(struct MEMO, imemo_memo, 0);
159
- *((VALUE *)&memo->v1) = a;
160
- *((VALUE *)&memo->v2) = b;
161
- *((VALUE *)&memo->u3.value) = c;
162
-
163
- return memo;
164
- }
165
-
166
- static inline enum imemo_type
167
- imemo_type(VALUE imemo)
168
- {
169
- return (RBASIC(imemo)->flags >> FL_USHIFT) & IMEMO_MASK;
170
- }
171
-
172
- static inline int
173
- imemo_type_p(VALUE imemo, enum imemo_type imemo_type)
174
- {
175
- if (LIKELY(!RB_SPECIAL_CONST_P(imemo))) {
176
- /* fixed at compile time if imemo_type is given. */
177
- const VALUE mask = (IMEMO_MASK << FL_USHIFT) | RUBY_T_MASK;
178
- const VALUE expected_type = (imemo_type << FL_USHIFT) | T_IMEMO;
179
- /* fixed at runtime. */
180
- return expected_type == (RBASIC(imemo)->flags & mask);
181
- }
182
- else {
183
- return 0;
184
- }
185
- }
186
-
187
- #define IMEMO_TYPE_P(v, t) imemo_type_p((VALUE)(v), t)
188
-
189
- static inline bool
190
- imemo_throw_data_p(VALUE imemo)
191
- {
192
- return RB_TYPE_P(imemo, T_IMEMO);
193
- }
194
-
195
- static inline struct vm_ifunc *
196
- rb_vm_ifunc_proc_new(rb_block_call_func_t func, const void *data)
197
- {
198
- return rb_vm_ifunc_new(func, data, 0, UNLIMITED_ARGUMENTS);
199
- }
200
-
201
- static inline void *
202
- RB_IMEMO_TMPBUF_PTR(VALUE v)
203
- {
204
- const struct rb_imemo_tmpbuf_struct *p = (const void *)v;
205
- return p->ptr;
206
- }
207
-
208
- static inline void *
209
- rb_imemo_tmpbuf_set_ptr(VALUE v, void *ptr)
210
- {
211
- return ((rb_imemo_tmpbuf_t *)v)->ptr = ptr;
212
- }
213
-
214
- static inline VALUE
215
- rb_imemo_tmpbuf_new_from_an_RString(VALUE str)
216
- {
217
- const void *src;
218
- VALUE imemo;
219
- rb_imemo_tmpbuf_t *tmpbuf;
220
- void *dst;
221
- size_t len;
222
-
223
- StringValue(str);
224
- /* create tmpbuf to keep the pointer before xmalloc */
225
- imemo = rb_imemo_tmpbuf_new();
226
- tmpbuf = (rb_imemo_tmpbuf_t *)imemo;
227
- len = RSTRING_LEN(str);
228
- src = RSTRING_PTR(str);
229
- dst = ruby_xmalloc(len);
230
- memcpy(dst, src, len);
231
- tmpbuf->ptr = dst;
232
- return imemo;
233
- }
234
-
235
- static inline void
236
- MEMO_V1_SET(struct MEMO *m, VALUE v)
237
- {
238
- RB_OBJ_WRITE(m, &m->v1, v);
239
- }
240
-
241
- static inline void
242
- MEMO_V2_SET(struct MEMO *m, VALUE v)
243
- {
244
- RB_OBJ_WRITE(m, &m->v2, v);
245
- }
246
-
247
- struct rb_fields {
248
- struct RBasic basic;
249
- union {
250
- struct {
251
- VALUE fields[1];
252
- } embed;
253
- struct {
254
- VALUE *ptr;
255
- } external;
256
- struct {
257
- // Note: the st_table could be embedded, but complex T_CLASS should be rare to
258
- // non-existent, so not really worth the trouble.
259
- st_table *table;
260
- } complex;
261
- } as;
262
- };
263
-
264
- // IMEMO/fields and T_OBJECT have exactly the same layout.
265
- // This is useful for JIT and common codepaths.
266
- #define OBJ_FIELD_HEAP ROBJECT_HEAP
267
- STATIC_ASSERT(imemo_fields_flags, OBJ_FIELD_HEAP == IMEMO_FL_USER0);
268
- STATIC_ASSERT(imemo_fields_embed_offset, offsetof(struct RObject, as.ary) == offsetof(struct rb_fields, as.embed.fields));
269
- STATIC_ASSERT(imemo_fields_embed_offset, offsetof(struct RObject, as.heap.fields) == offsetof(struct rb_fields, as.external.ptr));
270
- STATIC_ASSERT(imemo_fields_embed_offset, offsetof(struct RObject, as.heap.fields) == offsetof(struct rb_fields, as.complex.table));
271
-
272
- #define IMEMO_OBJ_FIELDS(fields) ((struct rb_fields *)fields)
273
-
274
- VALUE rb_imemo_fields_new(VALUE owner, size_t capa, bool shareable);
275
- VALUE rb_imemo_fields_new_complex(VALUE owner, size_t capa, bool shareable);
276
- VALUE rb_imemo_fields_new_complex_tbl(VALUE owner, st_table *tbl, bool shareable);
277
- VALUE rb_imemo_fields_clone(VALUE fields_obj);
278
- void rb_imemo_fields_clear(VALUE fields_obj);
279
-
280
- static inline VALUE
281
- rb_imemo_fields_owner(VALUE fields_obj)
282
- {
283
- RUBY_ASSERT(IMEMO_TYPE_P(fields_obj, imemo_fields));
284
-
285
- return CLASS_OF(fields_obj);
286
- }
287
-
288
- static inline VALUE *
289
- rb_imemo_fields_ptr(VALUE fields_obj)
290
- {
291
- if (!fields_obj) {
292
- return NULL;
293
- }
294
-
295
- RUBY_ASSERT(IMEMO_TYPE_P(fields_obj, imemo_fields) || RB_TYPE_P(fields_obj, T_OBJECT));
296
-
297
- if (UNLIKELY(FL_TEST_RAW(fields_obj, OBJ_FIELD_HEAP))) {
298
- return IMEMO_OBJ_FIELDS(fields_obj)->as.external.ptr;
299
- }
300
- else {
301
- return IMEMO_OBJ_FIELDS(fields_obj)->as.embed.fields;
302
- }
303
- }
304
-
305
- static inline st_table *
306
- rb_imemo_fields_complex_tbl(VALUE fields_obj)
307
- {
308
- if (!fields_obj) {
309
- return NULL;
310
- }
311
-
312
- RUBY_ASSERT(IMEMO_TYPE_P(fields_obj, imemo_fields) || RB_TYPE_P(fields_obj, T_OBJECT));
313
- RUBY_ASSERT(FL_TEST_RAW(fields_obj, OBJ_FIELD_HEAP));
314
-
315
- // Some codepaths unconditionally access the fields_ptr, and assume it can be used as st_table if the
316
- // shape is too_complex.
317
- RUBY_ASSERT((st_table *)rb_imemo_fields_ptr(fields_obj) == IMEMO_OBJ_FIELDS(fields_obj)->as.complex.table);
318
-
319
- return IMEMO_OBJ_FIELDS(fields_obj)->as.complex.table;
320
- }
321
-
322
- #endif /* INTERNAL_IMEMO_H */
@@ -1,163 +0,0 @@
1
- #ifndef INTERNAL_IO_H /*-*-C-*-vi:se ft=c:*/
2
- #define INTERNAL_IO_H
3
- /**
4
- * @author Ruby developers <ruby-core@ruby-lang.org>
5
- * @copyright This file is a part of the programming language Ruby.
6
- * Permission is hereby granted, to either redistribute and/or
7
- * modify this file, provided that the conditions mentioned in the
8
- * file COPYING are met. Consult the file for details.
9
- * @brief Internal header for IO.
10
- */
11
- #include "ruby/ruby.h" /* for VALUE */
12
-
13
- #define HAVE_RB_IO_T
14
- struct rb_io;
15
-
16
- #include "ruby/io.h" /* for rb_io_t */
17
- #include "ccan/list/list.h"
18
- #include "serial.h"
19
-
20
- #define IO_WITHOUT_GVL(func, arg) rb_nogvl(func, arg, RUBY_UBF_IO, 0, RB_NOGVL_OFFLOAD_SAFE)
21
- #define IO_WITHOUT_GVL_INT(func, arg) (int)(VALUE)IO_WITHOUT_GVL(func, arg)
22
-
23
- // Represents an in-flight blocking operation:
24
- struct rb_io_blocking_operation {
25
- // The linked list data structure.
26
- struct ccan_list_node list;
27
-
28
- // The execution context of the blocking operation.
29
- struct rb_execution_context_struct *ec;
30
- };
31
-
32
- /** Ruby's IO, metadata and buffers. */
33
- struct rb_io {
34
-
35
- /** The IO's Ruby level counterpart. */
36
- VALUE self;
37
-
38
- /** stdio ptr for read/write, if available. */
39
- FILE *stdio_file;
40
-
41
- /** file descriptor. */
42
- int fd;
43
-
44
- /** mode flags: FMODE_XXXs */
45
- enum rb_io_mode mode;
46
-
47
- /** child's pid (for pipes) */
48
- rb_pid_t pid;
49
-
50
- /** number of lines read */
51
- int lineno;
52
-
53
- /** pathname for file */
54
- VALUE pathv;
55
-
56
- /** finalize proc */
57
- void (*finalize)(struct rb_io*,int);
58
-
59
- /** Write buffer. */
60
- rb_io_buffer_t wbuf;
61
-
62
- /**
63
- * (Byte) read buffer. Note also that there is a field called
64
- * ::rb_io_t::cbuf, which also concerns read IO.
65
- */
66
- rb_io_buffer_t rbuf;
67
-
68
- /**
69
- * Duplex IO object, if set.
70
- *
71
- * @see rb_io_set_write_io()
72
- */
73
- VALUE tied_io_for_writing;
74
-
75
- struct rb_io_encoding encs; /**< Decomposed encoding flags. */
76
-
77
- /** Encoding converter used when reading from this IO. */
78
- rb_econv_t *readconv;
79
-
80
- /**
81
- * rb_io_ungetc() destination. This buffer is read before checking
82
- * ::rb_io_t::rbuf
83
- */
84
- rb_io_buffer_t cbuf;
85
-
86
- /** Encoding converter used when writing to this IO. */
87
- rb_econv_t *writeconv;
88
-
89
- /**
90
- * This is, when set, an instance of ::rb_cString which holds the "common"
91
- * encoding. Write conversion can convert strings twice... In case
92
- * conversion from encoding X to encoding Y does not exist, Ruby finds an
93
- * encoding Z that bridges the two, so that X to Z to Y conversion happens.
94
- */
95
- VALUE writeconv_asciicompat;
96
-
97
- /** Whether ::rb_io_t::writeconv is already set up. */
98
- int writeconv_initialized;
99
-
100
- /**
101
- * Value of ::rb_io_t::rb_io_enc_t::ecflags stored right before
102
- * initialising ::rb_io_t::writeconv.
103
- */
104
- int writeconv_pre_ecflags;
105
-
106
- /**
107
- * Value of ::rb_io_t::rb_io_enc_t::ecopts stored right before initialising
108
- * ::rb_io_t::writeconv.
109
- */
110
- VALUE writeconv_pre_ecopts;
111
-
112
- /**
113
- * This is a Ruby level mutex. It avoids multiple threads to write to an
114
- * IO at once; helps for instance rb_io_puts() to ensure newlines right
115
- * next to its arguments.
116
- *
117
- * This of course doesn't help inter-process IO interleaves, though.
118
- */
119
- VALUE write_lock;
120
-
121
- /**
122
- * The timeout associated with this IO when performing blocking operations.
123
- */
124
- VALUE timeout;
125
-
126
- /**
127
- * Threads that are performing a blocking operation without the GVL using
128
- * this IO. On calling IO#close, these threads will be interrupted so that
129
- * the operation can be cancelled.
130
- */
131
- struct ccan_list_head blocking_operations;
132
- struct rb_execution_context_struct *closing_ec;
133
- VALUE wakeup_mutex;
134
-
135
- // The fork generation of the blocking operations list.
136
- rb_serial_t fork_generation;
137
- };
138
-
139
- /* io.c */
140
- void ruby_set_inplace_mode(const char *);
141
- void rb_stdio_set_default_encoding(void);
142
- VALUE rb_io_flush_raw(VALUE, int);
143
- size_t rb_io_memsize(const rb_io_t *);
144
- int rb_stderr_tty_p(void);
145
- VALUE rb_io_popen(VALUE pname, VALUE pmode, VALUE env, VALUE opt);
146
-
147
- VALUE rb_io_prep_stdin(void);
148
- VALUE rb_io_prep_stdout(void);
149
- VALUE rb_io_prep_stderr(void);
150
-
151
- int rb_io_notify_close(struct rb_io *fptr);
152
-
153
- RUBY_SYMBOL_EXPORT_BEGIN
154
- /* io.c (export) */
155
- void rb_maygvl_fd_fix_cloexec(int fd);
156
- int rb_gc_for_fd(int err);
157
- void rb_write_error_str(VALUE mesg);
158
-
159
- VALUE rb_io_blocking_region_wait(struct rb_io *io, rb_blocking_function_t *function, void *argument, enum rb_io_event events);
160
- VALUE rb_io_blocking_region(struct rb_io *io, rb_blocking_function_t *function, void *argument);
161
- RUBY_SYMBOL_EXPORT_END
162
-
163
- #endif /* INTERNAL_IO_H */
@@ -1,81 +0,0 @@
1
- #ifndef INTERNAL_NAMESPACE_H /*-*-C-*-vi:se ft=c:*/
2
- #define INTERNAL_NAMESPACE_H
3
-
4
- #include "ruby/ruby.h" /* for VALUE */
5
-
6
- /**
7
- * @author Ruby developers <ruby-core@ruby-lang.org>
8
- * @copyright This file is a part of the programming language Ruby.
9
- * Permission is hereby granted, to either redistribute and/or
10
- * modify this file, provided that the conditions mentioned in the
11
- * file COPYING are met. Consult the file for details.
12
- * @brief Internal header for Namespace.
13
- */
14
- struct rb_namespace_struct {
15
- /*
16
- * To retrieve Namespace object that provides #require and so on.
17
- * That is used from load.c, etc., that uses rb_namespace_t internally.
18
- */
19
- VALUE ns_object;
20
- long ns_id; // namespace id to generate ext filenames
21
-
22
- VALUE top_self;
23
-
24
- VALUE load_path;
25
- VALUE load_path_snapshot;
26
- VALUE load_path_check_cache;
27
- VALUE expanded_load_path;
28
- VALUE loaded_features;
29
- VALUE loaded_features_snapshot;
30
- VALUE loaded_features_realpaths;
31
- VALUE loaded_features_realpath_map;
32
- struct st_table *loaded_features_index;
33
- struct st_table *loading_table;
34
- VALUE ruby_dln_libmap;
35
-
36
- VALUE gvar_tbl;
37
-
38
- bool is_user;
39
- bool is_optional;
40
- };
41
- typedef struct rb_namespace_struct rb_namespace_t;
42
-
43
- #define NAMESPACE_OBJ_P(obj) (rb_obj_class(obj) == rb_cNamespace)
44
-
45
- #define NAMESPACE_ROOT_P(ns) (ns && !ns->is_user)
46
- #define NAMESPACE_USER_P(ns) (ns && ns->is_user)
47
- #define NAMESPACE_OPTIONAL_P(ns) (ns && ns->is_optional)
48
- #define NAMESPACE_MAIN_P(ns) (ns && ns->is_user && !ns->is_optional)
49
-
50
- #define NAMESPACE_METHOD_DEFINITION(mdef) (mdef ? mdef->ns : NULL)
51
- #define NAMESPACE_METHOD_ENTRY(me) (me ? NAMESPACE_METHOD_DEFINITION(me->def) : NULL)
52
- #define NAMESPACE_CC(cc) (cc ? NAMESPACE_METHOD_ENTRY(cc->cme_) : NULL)
53
- #define NAMESPACE_CC_ENTRIES(ccs) (ccs ? NAMESPACE_METHOD_ENTRY(ccs->cme) : NULL)
54
-
55
- RUBY_EXTERN bool ruby_namespace_enabled;
56
- RUBY_EXTERN bool ruby_namespace_init_done;
57
- RUBY_EXTERN bool ruby_namespace_crashed;
58
-
59
- static inline bool
60
- rb_namespace_available(void)
61
- {
62
- return ruby_namespace_enabled;
63
- }
64
-
65
- const rb_namespace_t * rb_root_namespace(void);
66
- const rb_namespace_t * rb_main_namespace(void);
67
- const rb_namespace_t * rb_current_namespace(void);
68
- const rb_namespace_t * rb_loading_namespace(void);
69
- const rb_namespace_t * rb_current_namespace_in_crash_report(void);
70
-
71
- void rb_namespace_entry_mark(void *);
72
- void rb_namespace_gc_update_references(void *ptr);
73
-
74
- rb_namespace_t * rb_get_namespace_t(VALUE ns);
75
- VALUE rb_get_namespace_object(rb_namespace_t *ns);
76
-
77
- VALUE rb_namespace_local_extension(VALUE namespace, VALUE fname, VALUE path);
78
-
79
- void rb_initialize_main_namespace(void);
80
- void rb_namespace_init_done(void);
81
- #endif /* INTERNAL_NAMESPACE_H */