Remove uneeded int2big property for Universal Parser
[ruby.git] / universal_parser.c
blobfa3520eaeba6798fea52b37c644a8c41ba41436b
1 #include <alloca.h>
2 #include <string.h>
3 #include <stdarg.h>
4 #include <stdbool.h>
5 #include <stddef.h>
7 /* Dependency */
8 #include "internal/parse.h"
9 #include "node.h"
10 #include "id.h"
12 #include "internal/compilers.h"
13 #include "ruby/backward/2/inttypes.h"
14 #include "probes.h"
16 #define LIKELY(x) RB_LIKELY(x)
17 #define UNLIKELY(x) RB_UNLIKELY(x)
18 #ifndef TRUE
19 # define TRUE 1
20 #endif
22 #ifndef FALSE
23 # define FALSE 0
24 #endif
25 #define numberof(array) ((int)(sizeof(array) / sizeof((array)[0])))
26 #define rb_strlen_lit(str) (sizeof(str "") - 1)
27 #undef FIXNUM_MAX
28 #define FIXNUM_MAX (LONG_MAX / 2)
29 #undef RSTRING_GETMEM
30 #define RSTRING_GETMEM(str, ptrvar, lenvar) \
31 ((ptrvar) = RSTRING_PTR(str), \
32 (lenvar) = RSTRING_LEN(str))
33 #if defined(USE_FLONUM)
34 # /* Take that. */
35 #elif SIZEOF_VALUE >= SIZEOF_DOUBLE
36 # define USE_FLONUM 1
37 #else
38 # define USE_FLONUM 0
39 #endif
41 /* parser_st */
42 #define st_table parser_st_table
43 #define st_data_t parser_st_data_t
44 #define st_hash_type parser_st_hash_type
45 #define ST_CONTINUE ST2_CONTINUE
46 #define ST_STOP ST2_STOP
47 #define ST_DELETE ST2_DELETE
48 #define ST_CHECK ST2_CHECK
49 #define ST_REPLACE ST2_REPLACE
50 #undef st_init_numtable
51 #define st_init_numtable rb_parser_st_init_numtable
52 #undef st_free_table
53 #define st_free_table rb_parser_st_free_table
54 #undef st_init_table_with_size
55 #define st_init_table_with_size rb_parser_st_init_table_with_size
56 #undef st_insert
57 #define st_insert rb_parser_st_insert
58 #undef st_foreach
59 #define st_foreach rb_parser_st_foreach
60 #undef st_delete
61 #define st_delete rb_parser_st_delete
62 #undef st_is_member
63 #define st_is_member parser_st_is_member
65 #define rb_encoding void
67 #undef T_FLOAT
68 #define T_FLOAT 0x04
69 #undef T_REGEXP
70 #define T_REGEXP 0x06
71 #undef T_HASH
72 #define T_HASH 0x08
73 #undef T_BIGNUM
74 #define T_BIGNUM 0x0a
75 #undef T_COMPLEX
76 #define T_COMPLEX 0x0e
77 #undef T_RATIONAL
78 #define T_RATIONAL 0x0f
80 struct rb_imemo_tmpbuf_struct {
81 VALUE flags;
82 VALUE reserved;
83 VALUE *ptr; /* malloc'ed buffer */
84 struct rb_imemo_tmpbuf_struct *next; /* next imemo */
85 size_t cnt; /* buffer size in VALUE */
88 #undef xmalloc
89 #define xmalloc p->config->malloc
90 #undef xcalloc
91 #define xcalloc p->config->calloc
92 #undef xrealloc
93 #define xrealloc p->config->realloc
94 #undef ALLOC_N
95 #define ALLOC_N(type,n) ((type *)p->config->alloc_n((n), sizeof(type)))
96 #undef ALLOC
97 #define ALLOC(type) ((type *)p->config->alloc(sizeof(type)))
98 #undef xfree
99 #define xfree p->config->free
100 #undef ALLOCA_N
101 // alloca(rbimpl_size_mul_or_raise(x, y));
102 #define ALLOCA_N(type,n) ((type *)alloca(sizeof(type) * (n)))
103 #undef REALLOC_N
104 #define REALLOC_N(var,type,n) ((var) = (type *)p->config->realloc_n((void *)var, n, sizeof(type)))
105 #undef ZALLOC
106 #define ZALLOC(type) ((type *)p->config->zalloc(sizeof(type)))
107 #undef MEMMOVE
108 #define MEMMOVE(p1,p2,type,n) (p->config->rb_memmove((p1), (p2), sizeof(type), (n)))
109 #undef MEMCPY
110 #define MEMCPY(p1,p2,type,n) (p->config->nonempty_memcpy((p1), (p2), sizeof(type), (n)))
112 #define new_strterm p->config->new_strterm
113 #define strterm_is_heredoc p->config->strterm_is_heredoc
114 #define rb_imemo_tmpbuf_auto_free_pointer p->config->tmpbuf_auto_free_pointer
115 #define rb_imemo_tmpbuf_set_ptr p->config->tmpbuf_set_ptr
116 #define rb_imemo_tmpbuf_parser_heap p->config->tmpbuf_parser_heap
118 #define compile_callback p->config->compile_callback
119 #define reg_named_capture_assign p->config->reg_named_capture_assign
120 #define script_lines_defined p->config->script_lines_defined
121 #define script_lines_get p->config->script_lines_get
123 #define rb_obj_freeze p->config->obj_freeze
124 #define rb_obj_hide p->config->obj_hide
125 #undef RB_OBJ_FROZEN
126 #define RB_OBJ_FROZEN p->config->obj_frozen
127 #undef RB_TYPE_P
128 #define RB_TYPE_P p->config->type_p
129 #undef OBJ_FREEZE_RAW
130 #define OBJ_FREEZE_RAW p->config->obj_freeze_raw
132 #undef FIXNUM_P