kanayago 0.1.1

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 (74) hide show
  1. checksums.yaml +7 -0
  2. data/.rubocop.yml +15 -0
  3. data/.rubocop_todo.yml +23 -0
  4. data/LICENSE.txt +21 -0
  5. data/README.md +79 -0
  6. data/Rakefile +182 -0
  7. data/ext/kanayago/ccan/check_type/check_type.h +63 -0
  8. data/ext/kanayago/ccan/container_of/container_of.h +142 -0
  9. data/ext/kanayago/ccan/list/list.h +791 -0
  10. data/ext/kanayago/ccan/str/str.h +17 -0
  11. data/ext/kanayago/constant.h +53 -0
  12. data/ext/kanayago/extconf.rb +21 -0
  13. data/ext/kanayago/id.h +347 -0
  14. data/ext/kanayago/id_table.h +39 -0
  15. data/ext/kanayago/internal/array.h +151 -0
  16. data/ext/kanayago/internal/basic_operators.h +64 -0
  17. data/ext/kanayago/internal/bignum.h +244 -0
  18. data/ext/kanayago/internal/bits.h +568 -0
  19. data/ext/kanayago/internal/compile.h +34 -0
  20. data/ext/kanayago/internal/compilers.h +107 -0
  21. data/ext/kanayago/internal/complex.h +29 -0
  22. data/ext/kanayago/internal/encoding.h +36 -0
  23. data/ext/kanayago/internal/error.h +218 -0
  24. data/ext/kanayago/internal/fixnum.h +184 -0
  25. data/ext/kanayago/internal/gc.h +322 -0
  26. data/ext/kanayago/internal/hash.h +191 -0
  27. data/ext/kanayago/internal/imemo.h +261 -0
  28. data/ext/kanayago/internal/io.h +140 -0
  29. data/ext/kanayago/internal/numeric.h +274 -0
  30. data/ext/kanayago/internal/parse.h +117 -0
  31. data/ext/kanayago/internal/rational.h +71 -0
  32. data/ext/kanayago/internal/re.h +28 -0
  33. data/ext/kanayago/internal/ruby_parser.h +125 -0
  34. data/ext/kanayago/internal/sanitizers.h +297 -0
  35. data/ext/kanayago/internal/serial.h +23 -0
  36. data/ext/kanayago/internal/static_assert.h +16 -0
  37. data/ext/kanayago/internal/string.h +186 -0
  38. data/ext/kanayago/internal/symbol.h +45 -0
  39. data/ext/kanayago/internal/thread.h +79 -0
  40. data/ext/kanayago/internal/variable.h +72 -0
  41. data/ext/kanayago/internal/vm.h +137 -0
  42. data/ext/kanayago/internal/warnings.h +16 -0
  43. data/ext/kanayago/internal.h +108 -0
  44. data/ext/kanayago/kanayago.c +420 -0
  45. data/ext/kanayago/kanayago.h +21 -0
  46. data/ext/kanayago/lex.c +302 -0
  47. data/ext/kanayago/method.h +255 -0
  48. data/ext/kanayago/node.c +440 -0
  49. data/ext/kanayago/node.h +111 -0
  50. data/ext/kanayago/node_name.inc +224 -0
  51. data/ext/kanayago/parse.c +26931 -0
  52. data/ext/kanayago/parse.h +244 -0
  53. data/ext/kanayago/parse.tmp.y +16145 -0
  54. data/ext/kanayago/parser_bits.h +564 -0
  55. data/ext/kanayago/parser_node.h +32 -0
  56. data/ext/kanayago/parser_st.c +164 -0
  57. data/ext/kanayago/parser_st.h +162 -0
  58. data/ext/kanayago/parser_value.h +106 -0
  59. data/ext/kanayago/probes.h +4 -0
  60. data/ext/kanayago/ruby_assert.h +14 -0
  61. data/ext/kanayago/ruby_atomic.h +23 -0
  62. data/ext/kanayago/ruby_parser.c +1165 -0
  63. data/ext/kanayago/rubyparser.h +1391 -0
  64. data/ext/kanayago/shape.h +234 -0
  65. data/ext/kanayago/st.c +2339 -0
  66. data/ext/kanayago/symbol.h +123 -0
  67. data/ext/kanayago/thread_pthread.h +168 -0
  68. data/ext/kanayago/universal_parser.c +230 -0
  69. data/ext/kanayago/vm_core.h +2215 -0
  70. data/ext/kanayago/vm_opts.h +67 -0
  71. data/lib/kanayago/version.rb +5 -0
  72. data/lib/kanayago.rb +11 -0
  73. data/sig/kanayago.rbs +4 -0
  74. metadata +116 -0
@@ -0,0 +1,164 @@
1
+ #include "parser_st.h"
2
+ #include "parser_bits.h"
3
+
4
+ #ifndef TRUE
5
+ # define TRUE 1
6
+ #endif
7
+
8
+ #ifndef FALSE
9
+ # define FALSE 0
10
+ #endif
11
+
12
+ #undef NOT_RUBY
13
+ #undef RUBY
14
+ #undef RUBY_EXPORT
15
+
16
+ #undef MEMCPY
17
+ #define MEMCPY(p1,p2,type,n) nonempty_memcpy((p1), (p2), (sizeof(type) * (n)))
18
+ /* The multiplication should not overflow since this macro is used
19
+ * only with the already allocated size. */
20
+ static inline void *
21
+ nonempty_memcpy(void *dest, const void *src, size_t n)
22
+ {
23
+ if (n) {
24
+ return memcpy(dest, src, n);
25
+ }
26
+ else {
27
+ return dest;
28
+ }
29
+ }
30
+
31
+ #include <stdio.h>
32
+ #ifdef HAVE_STDLIB_H
33
+ #include <stdlib.h>
34
+ #endif
35
+ #include <string.h>
36
+ #include <assert.h>
37
+
38
+ #ifdef __GNUC__
39
+ #define PREFETCH(addr, write_p) __builtin_prefetch(addr, write_p)
40
+ #define EXPECT(expr, val) __builtin_expect(expr, val)
41
+ #define ATTRIBUTE_UNUSED __attribute__((unused))
42
+ #else
43
+ #define PREFETCH(addr, write_p)
44
+ #define EXPECT(expr, val) (expr)
45
+ #define ATTRIBUTE_UNUSED
46
+ #endif
47
+
48
+
49
+ #define st_index_t parser_st_index_t
50
+ #define st_hash_t parser_st_hash_t
51
+ #define st_data_t parser_st_data_t
52
+ #define st_hash_type parser_st_hash_type
53
+ #define st_table parser_st_table
54
+ #define st_table_entry parser_st_table_entry
55
+ #define st_update_callback_func parser_st_update_callback_func
56
+ #define st_foreach_check_callback_func parser_st_foreach_check_callback_func
57
+ #define st_foreach_callback_func parser_st_foreach_callback_func
58
+ #define st_retval parser_st_retval
59
+
60
+ #define ST_CONTINUE ST2_CONTINUE
61
+ #define ST_STOP ST2_STOP
62
+ #define ST_DELETE ST2_DELETE
63
+ #define ST_CHECK ST2_CHECK
64
+ #define ST_REPLACE ST2_REPLACE
65
+
66
+ #undef st_numcmp
67
+ #define st_numcmp rb_parser_st_numcmp
68
+ #undef st_numhash
69
+ #define st_numhash rb_parser_st_numhash
70
+ #undef st_free_table
71
+ #define st_free_table rb_parser_st_free_table
72
+ #define rb_st_hash_start rb_parser_st_hash_start
73
+ #undef st_delete
74
+ #define st_delete rb_parser_st_delete
75
+ #undef st_foreach
76
+ #define st_foreach rb_parser_st_foreach
77
+ #undef st_init_numtable
78
+ #define st_init_numtable rb_parser_st_init_numtable
79
+ #undef st_init_table_with_size
80
+ #define st_init_table_with_size rb_parser_st_init_table_with_size
81
+ #undef st_init_existing_table_with_size
82
+ #define st_init_existing_table_with_size rb_parser_st_init_existing_table_with_size
83
+ #undef st_insert
84
+ #define st_insert rb_parser_st_insert
85
+ #undef st_lookup
86
+ #define st_lookup rb_parser_st_lookup
87
+
88
+ #undef st_table_size
89
+ #define st_table_size rb_parser_st_table_size
90
+ #undef st_clear
91
+ #define st_clear rb_parser_st_clear
92
+ #undef st_init_strtable
93
+ #define st_init_strtable rb_parser_st_init_strtable
94
+ #undef st_init_table
95
+ #define st_init_table rb_parser_st_init_table
96
+ #undef st_init_strcasetable
97
+ #define st_init_strcasetable rb_parser_st_init_strcasetable
98
+ #undef st_init_strtable_with_size
99
+ #define st_init_strtable_with_size rb_parser_st_init_strtable_with_size
100
+ #undef st_init_numtable_with_size
101
+ #define st_init_numtable_with_size rb_parser_st_init_numtable_with_size
102
+ #undef st_init_strcasetable_with_size
103
+ #define st_init_strcasetable_with_size rb_parser_st_init_strcasetable_with_size
104
+ #undef st_memsize
105
+ #define st_memsize rb_parser_st_memsize
106
+ #undef st_get_key
107
+ #define st_get_key rb_parser_st_get_key
108
+ #undef st_add_direct
109
+ #define st_add_direct rb_parser_st_add_direct
110
+ #define rb_st_add_direct_with_hash rb_parser_st_add_direct_with_hash
111
+ #undef st_insert2
112
+ #define st_insert2 rb_parser_st_insert2
113
+ #undef st_replace
114
+ #define st_replace rb_parser_st_replace
115
+ #undef st_copy
116
+ #define st_copy rb_parser_st_copy
117
+ #undef st_delete_safe
118
+ #define st_delete_safe rb_parser_st_delete_safe
119
+ #undef st_shift
120
+ #define st_shift rb_parser_st_shift
121
+ #undef st_cleanup_safe
122
+ #define st_cleanup_safe rb_parser_st_cleanup_safe
123
+ #undef st_update
124
+ #define st_update rb_parser_st_update
125
+ #undef st_foreach_with_replace
126
+ #define st_foreach_with_replace rb_parser_st_foreach_with_replace
127
+ #undef st_foreach_check
128
+ #define st_foreach_check rb_parser_st_foreach_check
129
+ #undef st_keys
130
+ #define st_keys rb_parser_st_keys
131
+ #undef st_keys_check
132
+ #define st_keys_check rb_parser_st_keys_check
133
+ #undef st_values
134
+ #define st_values rb_parser_st_values
135
+ #undef st_values_check
136
+ #define st_values_check rb_parser_st_values_check
137
+ #undef st_hash
138
+ #define st_hash rb_parser_st_hash
139
+ #undef st_hash_uint32
140
+ #define st_hash_uint32 rb_parser_st_hash_uint32
141
+ #undef st_hash_uint
142
+ #define st_hash_uint rb_parser_st_hash_uint
143
+ #undef st_hash_end
144
+ #define st_hash_end rb_parser_st_hash_end
145
+ #undef st_locale_insensitive_strcasecmp
146
+ #define st_locale_insensitive_strcasecmp rb_parser_st_locale_insensitive_strcasecmp
147
+ #undef st_locale_insensitive_strncasecmp
148
+ #define st_locale_insensitive_strncasecmp rb_parser_st_locale_insensitive_strncasecmp
149
+
150
+ #if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
151
+ /* GCC warns about unknown sanitizer, which is annoying. */
152
+ # undef NO_SANITIZE
153
+ # define NO_SANITIZE(x, y) \
154
+ _Pragma("GCC diagnostic push") \
155
+ _Pragma("GCC diagnostic ignored \"-Wattributes\"") \
156
+ __attribute__((__no_sanitize__(x))) y; \
157
+ _Pragma("GCC diagnostic pop")
158
+ #endif
159
+
160
+ #ifndef NO_SANITIZE
161
+ # define NO_SANITIZE(x, y) y
162
+ #endif
163
+
164
+ #include "st.c"
@@ -0,0 +1,162 @@
1
+ /* This is a public domain general purpose hash table package
2
+ originally written by Peter Moore @ UCB.
3
+
4
+ The hash table data structures were redesigned and the package was
5
+ rewritten by Vladimir Makarov <vmakarov@redhat.com>. */
6
+
7
+ #ifndef RUBY_ST2_H
8
+ #define RUBY_ST2_H 1
9
+
10
+ #if defined(__cplusplus)
11
+ extern "C" {
12
+ #if 0
13
+ } /* satisfy cc-mode */
14
+ #endif
15
+ #endif
16
+
17
+ #include <stddef.h>
18
+ #include <stdint.h>
19
+ #include "ruby/config.h"
20
+ #include "ruby/backward/2/long_long.h"
21
+ #include "ruby/defines.h"
22
+
23
+ RUBY_SYMBOL_EXPORT_BEGIN
24
+
25
+ #if SIZEOF_LONG == SIZEOF_VOIDP
26
+ typedef unsigned long parser_st_data_t;
27
+ #elif SIZEOF_LONG_LONG == SIZEOF_VOIDP
28
+ typedef unsigned LONG_LONG parser_st_data_t;
29
+ #else
30
+ # error ---->> parser_st.c requires sizeof(void*) == sizeof(long) or sizeof(LONG_LONG) to be compiled. <<----
31
+ #endif
32
+ #define ST2_DATA_T_DEFINED
33
+
34
+ #ifndef CHAR_BIT
35
+ # ifdef HAVE_LIMITS_H
36
+ # include <limits.h>
37
+ # else
38
+ # define CHAR_BIT 8
39
+ # endif
40
+ #endif
41
+ #ifndef _
42
+ # define _(args) args
43
+ #endif
44
+ #ifndef ANYARGS
45
+ # ifdef __cplusplus
46
+ # define ANYARGS ...
47
+ # else
48
+ # define ANYARGS
49
+ # endif
50
+ #endif
51
+
52
+ typedef struct parser_st_table parser_st_table;
53
+
54
+ typedef parser_st_data_t parser_st_index_t;
55
+
56
+ /* Maximal value of unsigned integer type parser_st_index_t. */
57
+ #define MAX_ST2_INDEX_VAL (~(parser_st_index_t) 0)
58
+
59
+ typedef int parser_st_compare_func(parser_st_data_t, parser_st_data_t);
60
+ typedef parser_st_index_t parser_st_hash_func(parser_st_data_t);
61
+
62
+ typedef char st_check_for_sizeof_parser_st_index_t[SIZEOF_VOIDP == (int)sizeof(parser_st_index_t) ? 1 : -1];
63
+ #define SIZEOF_ST_INDEX_T SIZEOF_VOIDP
64
+
65
+ struct parser_st_hash_type {
66
+ int (*compare)(parser_st_data_t, parser_st_data_t); /* parser_st_compare_func* */
67
+ parser_st_index_t (*hash)(parser_st_data_t); /* parser_st_hash_func* */
68
+ };
69
+
70
+ #define ST_INDEX_BITS (SIZEOF_ST_INDEX_T * CHAR_BIT)
71
+
72
+ #if defined(HAVE_BUILTIN___BUILTIN_CHOOSE_EXPR) && defined(HAVE_BUILTIN___BUILTIN_TYPES_COMPATIBLE_P)
73
+ # define ST2_DATA_COMPATIBLE_P(type) \
74
+ __builtin_choose_expr(__builtin_types_compatible_p(type, parser_st_data_t), 1, 0)
75
+ #else
76
+ # define ST2_DATA_COMPATIBLE_P(type) 0
77
+ #endif
78
+
79
+ typedef struct parser_st_table_entry parser_st_table_entry;
80
+
81
+ struct parser_st_table_entry; /* defined in parser_st.c */
82
+
83
+ struct parser_st_table {
84
+ /* Cached features of the table -- see st.c for more details. */
85
+ unsigned char entry_power, bin_power, size_ind;
86
+ /* How many times the table was rebuilt. */
87
+ unsigned int rebuilds_num;
88
+ const struct parser_st_hash_type *type;
89
+ /* Number of entries currently in the table. */
90
+ parser_st_index_t num_entries;
91
+ /* Array of bins used for access by keys. */
92
+ parser_st_index_t *bins;
93
+ /* Start and bound index of entries in array entries.
94
+ entries_starts and entries_bound are in interval
95
+ [0,allocated_entries]. */
96
+ parser_st_index_t entries_start, entries_bound;
97
+ /* Array of size 2^entry_power. */
98
+ parser_st_table_entry *entries;
99
+ };
100
+
101
+ #define parser_st_is_member(table,key) rb_parser_st_lookup((table),(key),(parser_st_data_t *)0)
102
+
103
+ enum parser_st_retval {ST2_CONTINUE, ST2_STOP, ST2_DELETE, ST2_CHECK, ST2_REPLACE};
104
+
105
+ size_t rb_parser_st_table_size(const struct parser_st_table *tbl);
106
+ parser_st_table *rb_parser_st_init_table(const struct parser_st_hash_type *);
107
+ parser_st_table *rb_parser_st_init_table_with_size(const struct parser_st_hash_type *, parser_st_index_t);
108
+ parser_st_table *rb_parser_st_init_existing_table_with_size(parser_st_table *, const struct parser_st_hash_type *, parser_st_index_t);
109
+ parser_st_table *rb_parser_st_init_numtable(void);
110
+ parser_st_table *rb_parser_st_init_numtable_with_size(parser_st_index_t);
111
+ parser_st_table *rb_parser_st_init_strtable(void);
112
+ parser_st_table *rb_parser_st_init_strtable_with_size(parser_st_index_t);
113
+ parser_st_table *rb_parser_st_init_strcasetable(void);
114
+ parser_st_table *rb_parser_st_init_strcasetable_with_size(parser_st_index_t);
115
+ int rb_parser_st_delete(parser_st_table *, parser_st_data_t *, parser_st_data_t *); /* returns 0:notfound 1:deleted */
116
+ int rb_parser_st_delete_safe(parser_st_table *, parser_st_data_t *, parser_st_data_t *, parser_st_data_t);
117
+ int rb_parser_st_shift(parser_st_table *, parser_st_data_t *, parser_st_data_t *); /* returns 0:notfound 1:deleted */
118
+ int rb_parser_st_insert(parser_st_table *, parser_st_data_t, parser_st_data_t);
119
+ int rb_parser_st_insert2(parser_st_table *, parser_st_data_t, parser_st_data_t, parser_st_data_t (*)(parser_st_data_t));
120
+ int rb_parser_st_lookup(parser_st_table *, parser_st_data_t, parser_st_data_t *);
121
+ int rb_parser_st_get_key(parser_st_table *, parser_st_data_t, parser_st_data_t *);
122
+ typedef int parser_st_update_callback_func(parser_st_data_t *key, parser_st_data_t *value, parser_st_data_t arg, int existing);
123
+ /* *key may be altered, but must equal to the old key, i.e., the
124
+ * results of hash() are same and compare() returns 0, otherwise the
125
+ * behavior is undefined */
126
+ int rb_parser_st_update(parser_st_table *table, parser_st_data_t key, parser_st_update_callback_func *func, parser_st_data_t arg);
127
+ typedef int parser_st_foreach_callback_func(parser_st_data_t, parser_st_data_t, parser_st_data_t);
128
+ typedef int parser_st_foreach_check_callback_func(parser_st_data_t, parser_st_data_t, parser_st_data_t, int);
129
+ int rb_parser_st_foreach_with_replace(parser_st_table *tab, parser_st_foreach_check_callback_func *func, parser_st_update_callback_func *replace, parser_st_data_t arg);
130
+ int rb_parser_st_foreach(parser_st_table *, parser_st_foreach_callback_func *, parser_st_data_t);
131
+ int rb_parser_st_foreach_check(parser_st_table *, parser_st_foreach_check_callback_func *, parser_st_data_t, parser_st_data_t);
132
+ parser_st_index_t rb_parser_st_keys(parser_st_table *table, parser_st_data_t *keys, parser_st_index_t size);
133
+ parser_st_index_t rb_parser_st_keys_check(parser_st_table *table, parser_st_data_t *keys, parser_st_index_t size, parser_st_data_t never);
134
+ parser_st_index_t rb_parser_st_values(parser_st_table *table, parser_st_data_t *values, parser_st_index_t size);
135
+ parser_st_index_t rb_parser_st_values_check(parser_st_table *table, parser_st_data_t *values, parser_st_index_t size, parser_st_data_t never);
136
+ void rb_parser_st_add_direct(parser_st_table *, parser_st_data_t, parser_st_data_t);
137
+ void rb_parser_st_free_table(parser_st_table *);
138
+ void rb_parser_st_cleanup_safe(parser_st_table *, parser_st_data_t);
139
+ void rb_parser_st_clear(parser_st_table *);
140
+ parser_st_table *rb_parser_st_replace(parser_st_table *, parser_st_table *);
141
+ parser_st_table *rb_parser_st_copy(parser_st_table *);
142
+ CONSTFUNC(int rb_parser_st_numcmp(parser_st_data_t, parser_st_data_t));
143
+ CONSTFUNC(parser_st_index_t rb_parser_st_numhash(parser_st_data_t));
144
+ PUREFUNC(int rb_parser_st_locale_insensitive_strcasecmp(const char *s1, const char *s2));
145
+ PUREFUNC(int rb_parser_st_locale_insensitive_strncasecmp(const char *s1, const char *s2, size_t n));
146
+ PUREFUNC(size_t rb_parser_st_memsize(const parser_st_table *));
147
+ PUREFUNC(parser_st_index_t rb_parser_st_hash(const void *ptr, size_t len, parser_st_index_t h));
148
+ CONSTFUNC(parser_st_index_t rb_parser_st_hash_uint32(parser_st_index_t h, uint32_t i));
149
+ CONSTFUNC(parser_st_index_t rb_parser_st_hash_uint(parser_st_index_t h, parser_st_index_t i));
150
+ CONSTFUNC(parser_st_index_t rb_parser_st_hash_end(parser_st_index_t h));
151
+ CONSTFUNC(parser_st_index_t rb_parser_st_hash_start(parser_st_index_t h));
152
+
153
+ RUBY_SYMBOL_EXPORT_END
154
+
155
+ #if defined(__cplusplus)
156
+ #if 0
157
+ { /* satisfy cc-mode */
158
+ #endif
159
+ } /* extern "C" { */
160
+ #endif
161
+
162
+ #endif /* RUBY_ST2_H */
@@ -0,0 +1,106 @@
1
+ #ifndef EXTERNAL_VALUE_H
2
+ #define EXTERNAL_VALUE_H
3
+
4
+ #include "ruby/config.h"
5
+
6
+ #if defined(__DOXYGEN__)
7
+
8
+ /**
9
+ * Type that represents a Ruby object. It is an unsigned integer of some kind,
10
+ * depending on platforms.
11
+ *
12
+ * ```CXX
13
+ * VALUE value = rb_eval_string("ARGF.readlines.map.with_index");
14
+ * ```
15
+ *
16
+ * @warning ::VALUE is not a pointer.
17
+ * @warning ::VALUE can be wider than `long`.
18
+ */
19
+ typedef uintptr_t VALUE;
20
+
21
+ /**
22
+ * Type that represents a Ruby identifier such as a variable name.
23
+ *
24
+ * ```CXX
25
+ * ID method = rb_intern("method");
26
+ * VALUE result = rb_funcall(obj, method, 0);
27
+ * ```
28
+ *
29
+ * @note ::rb_cSymbol is a Ruby-level data type for the same thing.
30
+ */
31
+ typedef uintptr_t ID;
32
+
33
+ /**
34
+ * A signed integer type that has the same width with ::VALUE.
35
+ *
36
+ * @internal
37
+ *
38
+ * @shyouhei wonders: is it guaranteed that `uintptr_t` and `intptr_t` are the
39
+ * same width? As far as I read ISO/IEC 9899:2018 section 7.20.1.4 paragraph 1
40
+ * no such description is given... or defined elsewhere?
41
+ */
42
+ typedef intptr_t SIGNED_VALUE;
43
+
44
+ /**
45
+ * Identical to `sizeof(VALUE)`, except it is a macro that can also be used
46
+ * inside of preprocessor directives such as `#if`. Handy on occasions.
47
+ */
48
+ #define SIZEOF_VALUE SIZEOF_UINTPTR_T
49
+
50
+ /**
51
+ * @private
52
+ *
53
+ * A compile-time constant of type ::VALUE whose value is 0.
54
+ */
55
+ #define RBIMPL_VALUE_NULL UINTPTR_C(0)
56
+
57
+ /**
58
+ * @private
59
+ *
60
+ * A compile-time constant of type ::VALUE whose value is 1.
61
+ */
62
+ #define RBIMPL_VALUE_ONE UINTPTR_C(1)
63
+
64
+ /**
65
+ * @private
66
+ *
67
+ * Maximum possible value that a ::VALUE can take.
68
+ */
69
+ #define RBIMPL_VALUE_FULL UINTPTR_MAX
70
+
71
+ #elif defined HAVE_UINTPTR_T && 0
72
+ typedef uintptr_t VALUE;
73
+ typedef uintptr_t ID;
74
+ # define SIGNED_VALUE intptr_t
75
+ # define SIZEOF_VALUE SIZEOF_UINTPTR_T
76
+ # undef PRI_VALUE_PREFIX
77
+ # define RBIMPL_VALUE_NULL UINTPTR_C(0)
78
+ # define RBIMPL_VALUE_ONE UINTPTR_C(1)
79
+ # define RBIMPL_VALUE_FULL UINTPTR_MAX
80
+
81
+ #elif SIZEOF_LONG == SIZEOF_VOIDP
82
+ typedef unsigned long VALUE;
83
+ typedef unsigned long ID;
84
+ # define SIGNED_VALUE long
85
+ # define SIZEOF_VALUE SIZEOF_LONG
86
+ # define PRI_VALUE_PREFIX "l"
87
+ # define RBIMPL_VALUE_NULL 0UL
88
+ # define RBIMPL_VALUE_ONE 1UL
89
+ # define RBIMPL_VALUE_FULL ULONG_MAX
90
+
91
+ #elif SIZEOF_LONG_LONG == SIZEOF_VOIDP
92
+ typedef unsigned LONG_LONG VALUE;
93
+ typedef unsigned LONG_LONG ID;
94
+ # define SIGNED_VALUE LONG_LONG
95
+ # define LONG_LONG_VALUE 1
96
+ # define SIZEOF_VALUE SIZEOF_LONG_LONG
97
+ # define PRI_VALUE_PREFIX PRI_LL_PREFIX
98
+ # define RBIMPL_VALUE_NULL 0ULL
99
+ # define RBIMPL_VALUE_ONE 1ULL
100
+ # define RBIMPL_VALUE_FULL ULLONG_MAX
101
+
102
+ #else
103
+ # error ---->> ruby requires sizeof(void*) == sizeof(long) or sizeof(LONG_LONG) to be compiled. <<----
104
+ #endif
105
+
106
+ #endif /* EXTERNAL_VALUE_H */
@@ -0,0 +1,4 @@
1
+ #define RUBY_DTRACE_PARSE_BEGIN_ENABLED() (0)
2
+ #define RUBY_DTRACE_PARSE_BEGIN(arg0, arg1) (void)(arg0), (void)(arg1);
3
+ #define RUBY_DTRACE_PARSE_END_ENABLED() (0)
4
+ #define RUBY_DTRACE_PARSE_END(arg0, arg1) (void)(arg0), (void)(arg1);
@@ -0,0 +1,14 @@
1
+ #ifndef RUBY_TOPLEVEL_ASSERT_H /*-*-C-*-vi:se ft=c:*/
2
+ #define RUBY_TOPLEVEL_ASSERT_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
+ */
10
+ #include "ruby/assert.h"
11
+ #undef assert
12
+ #define assert RUBY_ASSERT_NDEBUG
13
+
14
+ #endif /* RUBY_TOPLEVEL_ASSERT_H */
@@ -0,0 +1,23 @@
1
+ #include "ruby/atomic.h"
2
+
3
+ /* shim macros only */
4
+ #define ATOMIC_ADD(var, val) RUBY_ATOMIC_ADD(var, val)
5
+ #define ATOMIC_CAS(var, oldval, newval) RUBY_ATOMIC_CAS(var, oldval, newval)
6
+ #define ATOMIC_DEC(var) RUBY_ATOMIC_DEC(var)
7
+ #define ATOMIC_EXCHANGE(var, val) RUBY_ATOMIC_EXCHANGE(var, val)
8
+ #define ATOMIC_FETCH_ADD(var, val) RUBY_ATOMIC_FETCH_ADD(var, val)
9
+ #define ATOMIC_FETCH_SUB(var, val) RUBY_ATOMIC_FETCH_SUB(var, val)
10
+ #define ATOMIC_INC(var) RUBY_ATOMIC_INC(var)
11
+ #define ATOMIC_OR(var, val) RUBY_ATOMIC_OR(var, val)
12
+ #define ATOMIC_PTR_CAS(var, oldval, newval) RUBY_ATOMIC_PTR_CAS(var, oldval, newval)
13
+ #define ATOMIC_PTR_EXCHANGE(var, val) RUBY_ATOMIC_PTR_EXCHANGE(var, val)
14
+ #define ATOMIC_SET(var, val) RUBY_ATOMIC_SET(var, val)
15
+ #define ATOMIC_SIZE_ADD(var, val) RUBY_ATOMIC_SIZE_ADD(var, val)
16
+ #define ATOMIC_SIZE_CAS(var, oldval, newval) RUBY_ATOMIC_SIZE_CAS(var, oldval, newval)
17
+ #define ATOMIC_SIZE_DEC(var) RUBY_ATOMIC_SIZE_DEC(var)
18
+ #define ATOMIC_SIZE_EXCHANGE(var, val) RUBY_ATOMIC_SIZE_EXCHANGE(var, val)
19
+ #define ATOMIC_SIZE_INC(var) RUBY_ATOMIC_SIZE_INC(var)
20
+ #define ATOMIC_SIZE_SUB(var, val) RUBY_ATOMIC_SIZE_SUB(var, val)
21
+ #define ATOMIC_SUB(var, val) RUBY_ATOMIC_SUB(var, val)
22
+ #define ATOMIC_VALUE_CAS(var, oldval, val) RUBY_ATOMIC_VALUE_CAS(var, oldval, val)
23
+ #define ATOMIC_VALUE_EXCHANGE(var, val) RUBY_ATOMIC_VALUE_EXCHANGE(var, val)