@@ -18,7 +18,7 @@ MRB_BEGIN_DECL
1818
1919struct mrb_parser_state ;
2020/* load context */
21- typedef struct mrbc_context {
21+ typedef struct mrb_ccontext {
2222 mrb_sym * syms ;
2323 int slen ;
2424 char * filename ;
@@ -35,13 +35,21 @@ typedef struct mrbc_context {
3535 const struct RProc * upper ;
3636
3737 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
4553
4654/* AST node structure */
4755typedef struct mrb_ast_node {
@@ -121,7 +129,7 @@ struct mrb_parser_state {
121129 /* If both f and s are non-null, it will be taken preferentially from s until s < send. */
122130 FILE * f ;
123131#endif
124- mrbc_context * cxt ;
132+ mrb_ccontext * cxt ;
125133 mrb_sym filename_sym ;
126134 uint16_t lineno ;
127135 int column ;
@@ -168,19 +176,19 @@ struct mrb_parser_state {
168176
169177MRB_API struct mrb_parser_state * mrb_parser_new (mrb_state * );
170178MRB_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 * );
172180
173181MRB_API void mrb_parser_set_filename (struct mrb_parser_state * , char const * );
174182MRB_API mrb_sym mrb_parser_get_filename (struct mrb_parser_state * , uint16_t idx );
175183
176184/* utility functions */
177185#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 * );
179187#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 * );
182190MRB_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 );
184192
185193/** program load functions
186194* 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
193201*/
194202#ifndef MRB_NO_STDIO
195203MRB_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 );
198206#endif
199207MRB_API mrb_value mrb_load_string (mrb_state * mrb , const char * s );
200208MRB_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 );
203211
204212/** @} */
205213MRB_END_DECL
0 commit comments