From 85fcaf025defe5f84880d111663218aa42d0d158 Mon Sep 17 00:00:00 2001 From: ko1 Date: Sun, 29 Oct 2017 15:51:23 +0000 Subject: * node.h (ast_t): renamed to `rb_ast_t`. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60565 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- gc.c | 2 +- iseq.c | 6 +++--- load.c | 4 ++-- node.c | 18 +++++++++--------- node.h | 36 ++++++++++++++++++------------------ parse.y | 24 ++++++++++++------------ ruby.c | 10 +++++----- template/prelude.c.tmpl | 2 +- 8 files changed, 51 insertions(+), 51 deletions(-) diff --git a/gc.c b/gc.c index b485a3ba39..0d6163ea98 100644 --- a/gc.c +++ b/gc.c @@ -434,7 +434,7 @@ typedef struct RVALUE { const rb_iseq_t iseq; rb_env_t env; struct rb_imemo_alloc_struct alloc; - ast_t ast; + rb_ast_t ast; } imemo; struct { struct RBasic basic; diff --git a/iseq.c b/iseq.c index ebe141e03d..757e0f37e5 100644 --- a/iseq.c +++ b/iseq.c @@ -641,9 +641,9 @@ rb_iseq_compile_with_option(VALUE src, VALUE file, VALUE realpath, VALUE line, c #else # define INITIALIZED /* volatile */ #endif - ast_t *(*parse)(VALUE vparser, VALUE fname, VALUE file, int start); + rb_ast_t *(*parse)(VALUE vparser, VALUE fname, VALUE file, int start); int ln; - ast_t *INITIALIZED ast; + rb_ast_t *INITIALIZED ast; /* safe results first */ make_compile_option(&option, opt); @@ -854,7 +854,7 @@ iseqw_s_compile_file(int argc, VALUE *argv, VALUE self) { VALUE file, line = INT2FIX(1), opt = Qnil; VALUE parser, f, exc = Qnil, ret; - ast_t *ast; + rb_ast_t *ast; rb_compile_option_t option; int i; diff --git a/load.c b/load.c index 8b12c4d64c..43007b43a6 100644 --- a/load.c +++ b/load.c @@ -602,7 +602,7 @@ rb_load_internal0(rb_thread_t *th, VALUE fname, int wrap) EC_PUSH_TAG(th->ec); state = EXEC_TAG(); if (state == TAG_NONE) { - ast_t *ast; + rb_ast_t *ast; const rb_iseq_t *iseq; if ((iseq = rb_iseq_load_iseq(fname)) != NULL) { @@ -611,7 +611,7 @@ rb_load_internal0(rb_thread_t *th, VALUE fname, int wrap) else { VALUE parser = rb_parser_new(); rb_parser_set_context(parser, NULL, FALSE); - ast = (ast_t *)rb_parser_load_file(parser, fname); + ast = (rb_ast_t *)rb_parser_load_file(parser, fname); iseq = rb_iseq_new_top(ast->root, rb_fstring_cstr(""), fname, rb_realpath_internal(Qnil, fname, 1), NULL); rb_ast_dispose(ast); diff --git a/node.c b/node.c index 1e5755c721..f4a7b6ec79 100644 --- a/node.c +++ b/node.c @@ -1248,7 +1248,7 @@ rb_node_buffer_free(node_buffer_t *nb) } NODE * -rb_ast_newnode(ast_t *ast) +rb_ast_newnode(rb_ast_t *ast) { node_buffer_t *nb = ast->node_buffer; if (nb->idx >= nb->len) { @@ -1264,27 +1264,27 @@ rb_ast_newnode(ast_t *ast) } void -rb_ast_delete_node(ast_t *ast, NODE *n) +rb_ast_delete_node(rb_ast_t *ast, NODE *n) { (void)ast; (void)n; /* should we implement freelist? */ } -ast_t * +rb_ast_t * rb_ast_new(void) { - return (ast_t *)rb_imemo_new(imemo_ast, 0, (VALUE)rb_node_buffer_new(), rb_ary_tmp_new(0), 0); + return (rb_ast_t *)rb_imemo_new(imemo_ast, 0, (VALUE)rb_node_buffer_new(), rb_ary_tmp_new(0), 0); } void -rb_ast_mark(ast_t *ast) +rb_ast_mark(rb_ast_t *ast) { if (ast->node_buffer) rb_gc_mark(ast->mark_ary); } void -rb_ast_free(ast_t *ast) +rb_ast_free(rb_ast_t *ast) { if (ast->node_buffer) rb_node_buffer_free(ast->node_buffer); ast->node_buffer = 0; @@ -1293,20 +1293,20 @@ rb_ast_free(ast_t *ast) } void -rb_ast_dispose(ast_t *ast) +rb_ast_dispose(rb_ast_t *ast) { rb_ast_free(ast); rb_gc_writebarrier_remember((VALUE)ast); } void -rb_ast_add_mark_object(ast_t *ast, VALUE obj) +rb_ast_add_mark_object(rb_ast_t *ast, VALUE obj) { rb_ary_push(ast->mark_ary, obj); } void -rb_ast_delete_mark_object(ast_t *ast, VALUE obj) +rb_ast_delete_mark_object(rb_ast_t *ast, VALUE obj) { long i; for (i = 0; i < RARRAY_LEN(ast->mark_ary); i++) { diff --git a/node.h b/node.h index 23b2bb11f8..eca966f361 100644 --- a/node.h +++ b/node.h @@ -441,21 +441,21 @@ RUBY_SYMBOL_EXPORT_BEGIN typedef struct node_buffer_struct node_buffer_t; /* T_IMEMO/ast */ -typedef struct ast_struct { +typedef struct rb_ast_struct { VALUE flags; VALUE reserved1; NODE *root; node_buffer_t *node_buffer; VALUE mark_ary; -} ast_t; -ast_t *rb_ast_new(); -void rb_ast_mark(ast_t*); -void rb_ast_dispose(ast_t*); -void rb_ast_free(ast_t*); -void rb_ast_add_mark_object(ast_t*, VALUE); -void rb_ast_delete_mark_object(ast_t*, VALUE); -NODE *rb_ast_newnode(ast_t*); -void rb_ast_delete_node(ast_t*, NODE *n); +} rb_ast_t; +rb_ast_t *rb_ast_new(); +void rb_ast_mark(rb_ast_t*); +void rb_ast_dispose(rb_ast_t*); +void rb_ast_free(rb_ast_t*); +void rb_ast_add_mark_object(rb_ast_t*, VALUE); +void rb_ast_delete_mark_object(rb_ast_t*, VALUE); +NODE *rb_ast_newnode(rb_ast_t*); +void rb_ast_delete_node(rb_ast_t*, NODE *n); VALUE rb_parser_new(void); VALUE rb_parser_end_seen_p(VALUE); @@ -465,15 +465,15 @@ VALUE rb_parser_set_yydebug(VALUE, VALUE); VALUE rb_parser_dump_tree(NODE *node, int comment); void rb_parser_set_options(VALUE, int, int, int, int); -ast_t *rb_parser_compile_cstr(VALUE, const char*, const char*, int, int); -ast_t *rb_parser_compile_string(VALUE, const char*, VALUE, int); -ast_t *rb_parser_compile_file(VALUE, const char*, VALUE, int); -ast_t *rb_parser_compile_string_path(VALUE vparser, VALUE fname, VALUE src, int line); -ast_t *rb_parser_compile_file_path(VALUE vparser, VALUE fname, VALUE input, int line); +rb_ast_t *rb_parser_compile_cstr(VALUE, const char*, const char*, int, int); +rb_ast_t *rb_parser_compile_string(VALUE, const char*, VALUE, int); +rb_ast_t *rb_parser_compile_file(VALUE, const char*, VALUE, int); +rb_ast_t *rb_parser_compile_string_path(VALUE vparser, VALUE fname, VALUE src, int line); +rb_ast_t *rb_parser_compile_file_path(VALUE vparser, VALUE fname, VALUE input, int line); -ast_t *rb_compile_cstr(const char*, const char*, int, int); -ast_t *rb_compile_string(const char*, VALUE, int); -ast_t *rb_compile_file(const char*, VALUE, int); +rb_ast_t *rb_compile_cstr(const char*, const char*, int, int); +rb_ast_t *rb_compile_string(const char*, VALUE, int); +rb_ast_t *rb_compile_file(const char*, VALUE, int); void rb_node_init(NODE *n, enum node_type type, VALUE a0, VALUE a1, VALUE a2); NODE *rb_node_newnode(enum node_type,VALUE,VALUE,VALUE); diff --git a/parse.y b/parse.y index 7ee0a529fa..7cc5314420 100644 --- a/parse.y +++ b/parse.y @@ -239,7 +239,7 @@ struct parser_params { unsigned int do_chomp: 1; unsigned int do_split: 1; - ast_t *ast; + rb_ast_t *ast; NODE *eval_tree_begin; NODE *eval_tree; VALUE error_buffer; @@ -5589,11 +5589,11 @@ lex_getline(struct parser_params *parser) static const rb_data_type_t parser_data_type; #ifndef RIPPER -static ast_t* +static rb_ast_t* parser_compile_string(VALUE vparser, VALUE fname, VALUE s, int line) { struct parser_params *parser; - ast_t *ast; + rb_ast_t *ast; TypedData_Get_Struct(vparser, struct parser_params, &parser_data_type, parser); parser->ast = ast = rb_ast_new(); @@ -5610,34 +5610,34 @@ parser_compile_string(VALUE vparser, VALUE fname, VALUE s, int line) return ast; } -ast_t* +rb_ast_t* rb_compile_string(const char *f, VALUE s, int line) { must_be_ascii_compatible(s); return parser_compile_string(rb_parser_new(), rb_filesystem_str_new_cstr(f), s, line); } -ast_t* +rb_ast_t* rb_parser_compile_string(VALUE vparser, const char *f, VALUE s, int line) { return rb_parser_compile_string_path(vparser, rb_filesystem_str_new_cstr(f), s, line); } -ast_t* +rb_ast_t* rb_parser_compile_string_path(VALUE vparser, VALUE f, VALUE s, int line) { must_be_ascii_compatible(s); return parser_compile_string(vparser, f, s, line); } -ast_t* +rb_ast_t* rb_compile_cstr(const char *f, const char *s, int len, int line) { VALUE str = rb_str_new(s, len); return parser_compile_string(rb_parser_new(), rb_filesystem_str_new_cstr(f), str, line); } -ast_t* +rb_ast_t* rb_parser_compile_cstr(VALUE vparser, const char *f, const char *s, int len, int line) { VALUE str = rb_str_new(s, len); @@ -5652,7 +5652,7 @@ lex_io_gets(struct parser_params *parser, VALUE io) return rb_io_gets_internal(io); } -ast_t* +rb_ast_t* rb_compile_file(const char *f, VALUE file, int start) { VALUE vparser = rb_parser_new(); @@ -5660,17 +5660,17 @@ rb_compile_file(const char *f, VALUE file, int start) return rb_parser_compile_file(vparser, f, file, start); } -ast_t* +rb_ast_t* rb_parser_compile_file(VALUE vparser, const char *f, VALUE file, int start) { return rb_parser_compile_file_path(vparser, rb_filesystem_str_new_cstr(f), file, start); } -ast_t* +rb_ast_t* rb_parser_compile_file_path(VALUE vparser, VALUE fname, VALUE file, int start) { struct parser_params *parser; - ast_t *ast; + rb_ast_t *ast; TypedData_Get_Struct(vparser, struct parser_params, &parser_data_type, parser); parser->ast = ast = rb_ast_new(); diff --git a/ruby.c b/ruby.c index 75f2837d23..f0af34a9a8 100644 --- a/ruby.c +++ b/ruby.c @@ -177,7 +177,7 @@ cmdline_options_init(ruby_cmdline_options_t *opt) return opt; } -static ast_t *load_file(VALUE parser, VALUE fname, VALUE f, int script, +static rb_ast_t *load_file(VALUE parser, VALUE fname, VALUE f, int script, ruby_cmdline_options_t *opt); static VALUE open_load_file(VALUE fname_v, int *xflag); static void forbid_setid(const char *, const ruby_cmdline_options_t *); @@ -1461,7 +1461,7 @@ rb_f_chomp(int argc, VALUE *argv) static VALUE process_options(int argc, char **argv, ruby_cmdline_options_t *opt) { - ast_t *ast = 0; + rb_ast_t *ast = 0; VALUE parser; VALUE script_name; const rb_iseq_t *iseq; @@ -1797,7 +1797,7 @@ load_file_internal(VALUE argp_v) ruby_cmdline_options_t *opt = argp->opt; VALUE f = argp->f; int line_start = 1; - ast_t *ast = 0; + rb_ast_t *ast = 0; rb_encoding *enc; ID set_encoding; @@ -2011,7 +2011,7 @@ restore_load_file(VALUE arg) return Qnil; } -static ast_t * +static rb_ast_t * load_file(VALUE parser, VALUE fname, VALUE f, int script, ruby_cmdline_options_t *opt) { struct load_file_arg arg; @@ -2020,7 +2020,7 @@ load_file(VALUE parser, VALUE fname, VALUE f, int script, ruby_cmdline_options_t arg.script = script; arg.opt = opt; arg.f = f; - return (ast_t *)rb_ensure(load_file_internal, (VALUE)&arg, + return (rb_ast_t *)rb_ensure(load_file_internal, (VALUE)&arg, restore_load_file, (VALUE)&arg); } diff --git a/template/prelude.c.tmpl b/template/prelude.c.tmpl index b791c14ae4..ef024fd05c 100644 --- a/template/prelude.c.tmpl +++ b/template/prelude.c.tmpl @@ -121,7 +121,7 @@ prelude_eval(VALUE code, VALUE name, int line) FALSE, /* int debug_frozen_string_literal; */ }; - ast_t *ast = rb_parser_compile_string_path(rb_parser_new(), name, code, line); + rb_ast_t *ast = rb_parser_compile_string_path(rb_parser_new(), name, code, line); if (!ast->root) { rb_ast_dispose(ast); rb_exc_raise(rb_errinfo()); -- cgit v1.2.3