@@ -18,7 +18,7 @@ MRB_BEGIN_DECL
18
18
19
19
struct mrb_parser_state ;
20
20
/* load context */
21
- typedef struct mrbc_context {
21
+ typedef struct mrb_ccontext {
22
22
mrb_sym * syms ;
23
23
int slen ;
24
24
char * filename ;
@@ -35,13 +35,21 @@ typedef struct mrbc_context {
35
35
const struct RProc * upper ;
36
36
37
37
size_t parser_nerr ;
38
- } mrbc_context ;
39
-
40
- MRB_API mrbc_context * mrbc_context_new (mrb_state * mrb );
41
- MRB_API void mrbc_context_free (mrb_state * mrb , mrbc_context * cxt );
42
- MRB_API const char * mrbc_filename (mrb_state * mrb , mrbc_context * c , const char * s );
43
- MRB_API void mrbc_partial_hook (mrb_state * mrb , mrbc_context * c , int (* partial_hook )(struct mrb_parser_state * ), void * data );
44
- MRB_API void mrbc_cleanup_local_variables (mrb_state * mrb , mrbc_context * c );
38
+ } mrb_ccontext ; /* compiler context */
39
+
40
+ MRB_API mrb_ccontext * mrb_ccontext_new (mrb_state * mrb );
41
+ MRB_API void mrb_ccontext_free (mrb_state * mrb , mrb_ccontext * cxt );
42
+ MRB_API const char * mrb_ccontext_filename (mrb_state * mrb , mrb_ccontext * c , const char * s );
43
+ MRB_API void mrb_ccontext_partial_hook (mrb_state * mrb , mrb_ccontext * c , int (* partial_hook )(struct mrb_parser_state * ), void * data );
44
+ MRB_API void mrb_ccontext_cleanup_local_variables (mrb_state * mrb , mrb_ccontext * c );
45
+
46
+ /* compatibility macros */
47
+ #define mrbc_context mrb_ccontext
48
+ #define mrbc_context_new mrb_ccontext_new
49
+ #define mrbc_context_free mrb_ccontext_free
50
+ #define mrbc_filename mrb_ccontext_filename
51
+ #define mrbc_partial_hook mrb_ccontext_partial_hook
52
+ #define mrbc_cleanup_local_variables mrb_ccontext_cleanup_local_variables
45
53
46
54
/* AST node structure */
47
55
typedef struct mrb_ast_node {
@@ -121,7 +129,7 @@ struct mrb_parser_state {
121
129
/* If both f and s are non-null, it will be taken preferentially from s until s < send. */
122
130
FILE * f ;
123
131
#endif
124
- mrbc_context * cxt ;
132
+ mrb_ccontext * cxt ;
125
133
mrb_sym filename_sym ;
126
134
uint16_t lineno ;
127
135
int column ;
@@ -168,19 +176,19 @@ struct mrb_parser_state {
168
176
169
177
MRB_API struct mrb_parser_state * mrb_parser_new (mrb_state * );
170
178
MRB_API void mrb_parser_free (struct mrb_parser_state * );
171
- MRB_API void mrb_parser_parse (struct mrb_parser_state * ,mrbc_context * );
179
+ MRB_API void mrb_parser_parse (struct mrb_parser_state * ,mrb_ccontext * );
172
180
173
181
MRB_API void mrb_parser_set_filename (struct mrb_parser_state * , char const * );
174
182
MRB_API mrb_sym mrb_parser_get_filename (struct mrb_parser_state * , uint16_t idx );
175
183
176
184
/* utility functions */
177
185
#ifndef MRB_NO_STDIO
178
- MRB_API struct mrb_parser_state * mrb_parse_file (mrb_state * ,FILE * ,mrbc_context * );
186
+ MRB_API struct mrb_parser_state * mrb_parse_file (mrb_state * ,FILE * ,mrb_ccontext * );
179
187
#endif
180
- MRB_API struct mrb_parser_state * mrb_parse_string (mrb_state * ,const char * ,mrbc_context * );
181
- MRB_API struct mrb_parser_state * mrb_parse_nstring (mrb_state * ,const char * ,size_t ,mrbc_context * );
188
+ MRB_API struct mrb_parser_state * mrb_parse_string (mrb_state * ,const char * ,mrb_ccontext * );
189
+ MRB_API struct mrb_parser_state * mrb_parse_nstring (mrb_state * ,const char * ,size_t ,mrb_ccontext * );
182
190
MRB_API struct RProc * mrb_generate_code (mrb_state * , struct mrb_parser_state * );
183
- MRB_API mrb_value mrb_load_exec (mrb_state * mrb , struct mrb_parser_state * p , mrbc_context * c );
191
+ MRB_API mrb_value mrb_load_exec (mrb_state * mrb , struct mrb_parser_state * p , mrb_ccontext * c );
184
192
185
193
/** program load functions
186
194
* Please note! Currently due to interactions with the GC calling these functions will
@@ -193,13 +201,13 @@ MRB_API mrb_value mrb_load_exec(mrb_state *mrb, struct mrb_parser_state *p, mrbc
193
201
*/
194
202
#ifndef MRB_NO_STDIO
195
203
MRB_API mrb_value mrb_load_file (mrb_state * ,FILE * );
196
- MRB_API mrb_value mrb_load_file_cxt (mrb_state * ,FILE * , mrbc_context * cxt );
197
- MRB_API mrb_value mrb_load_detect_file_cxt (mrb_state * mrb , FILE * fp , mrbc_context * c );
204
+ MRB_API mrb_value mrb_load_file_cxt (mrb_state * ,FILE * , mrb_ccontext * cxt );
205
+ MRB_API mrb_value mrb_load_detect_file_cxt (mrb_state * mrb , FILE * fp , mrb_ccontext * c );
198
206
#endif
199
207
MRB_API mrb_value mrb_load_string (mrb_state * mrb , const char * s );
200
208
MRB_API mrb_value mrb_load_nstring (mrb_state * mrb , const char * s , size_t len );
201
- MRB_API mrb_value mrb_load_string_cxt (mrb_state * mrb , const char * s , mrbc_context * cxt );
202
- MRB_API mrb_value mrb_load_nstring_cxt (mrb_state * mrb , const char * s , size_t len , mrbc_context * cxt );
209
+ MRB_API mrb_value mrb_load_string_cxt (mrb_state * mrb , const char * s , mrb_ccontext * cxt );
210
+ MRB_API mrb_value mrb_load_nstring_cxt (mrb_state * mrb , const char * s , size_t len , mrb_ccontext * cxt );
203
211
204
212
/** @} */
205
213
MRB_END_DECL
0 commit comments