diff options
Diffstat (limited to 'include')
| -rw-r--r-- | include/mrbconf.h | 2 | ||||
| -rw-r--r-- | include/mruby.h | 9 | ||||
| -rw-r--r-- | include/mruby/compile.h | 8 | ||||
| -rw-r--r-- | include/mruby/hash.h | 2 |
4 files changed, 18 insertions, 3 deletions
diff --git a/include/mrbconf.h b/include/mrbconf.h index 030e00c9f..a6914cdb4 100644 --- a/include/mrbconf.h +++ b/include/mrbconf.h @@ -49,6 +49,8 @@ /* initial minimum size for string buffer */ //#define MRB_STR_BUF_MIN_SIZE 128 +/* array size for parser buffer */ +//#define MRB_PARSER_BUF_SIZE 1024 /* -DDISABLE_XXXX to drop following features */ //#define DISABLE_STDIO /* use of stdio */ diff --git a/include/mruby.h b/include/mruby.h index 84aeff0d7..c5c607893 100644 --- a/include/mruby.h +++ b/include/mruby.h @@ -189,13 +189,20 @@ int mrb_get_args(mrb_state *mrb, const char *format, ...); mrb_value mrb_funcall(mrb_state*, mrb_value, const char*, int,...); mrb_value mrb_funcall_argv(mrb_state*, mrb_value, mrb_sym, int, mrb_value*); mrb_value mrb_funcall_with_block(mrb_state*, mrb_value, mrb_sym, int, mrb_value*, mrb_value); -mrb_sym mrb_intern(mrb_state*,const char*); +mrb_sym mrb_intern_cstr(mrb_state*,const char*); mrb_sym mrb_intern2(mrb_state*,const char*,size_t); mrb_sym mrb_intern_str(mrb_state*,mrb_value); const char *mrb_sym2name(mrb_state*,mrb_sym); const char *mrb_sym2name_len(mrb_state*,mrb_sym,size_t*); mrb_value mrb_str_format(mrb_state *, int, const mrb_value *, mrb_value); +/* For backward compatibility. */ +static inline +mrb_sym mrb_intern(mrb_state *mrb,const char *cstr) +{ + return mrb_intern_cstr(mrb, cstr); +} + void *mrb_malloc(mrb_state*, size_t); void *mrb_calloc(mrb_state*, size_t, size_t); void *mrb_realloc(mrb_state*, void*, size_t); diff --git a/include/mruby/compile.h b/include/mruby/compile.h index 8b0743fa3..26f8a597f 100644 --- a/include/mruby/compile.h +++ b/include/mruby/compile.h @@ -65,6 +65,7 @@ struct mrb_parser_message { #define STR_FUNC_SYMBOL 0x10 #define STR_FUNC_ARRAY 0x20 #define STR_FUNC_HEREDOC 0x40 +#define STR_FUNC_XQUOTE 0x80 enum mrb_string_type { str_not_parsing = (0), @@ -77,6 +78,7 @@ enum mrb_string_type { str_ssymbols = (STR_FUNC_PARSING|STR_FUNC_SYMBOL|STR_FUNC_ARRAY), str_dsymbols = (STR_FUNC_PARSING|STR_FUNC_SYMBOL|STR_FUNC_ARRAY|STR_FUNC_EXPAND), str_heredoc = (STR_FUNC_PARSING|STR_FUNC_HEREDOC), + str_xquote = (STR_FUNC_PARSING|STR_FUNC_XQUOTE|STR_FUNC_EXPAND), }; /* heredoc structure */ @@ -89,6 +91,10 @@ struct mrb_parser_heredoc_info { mrb_ast_node *doc; }; +#ifndef MRB_PARSER_BUF_SIZE +# define MRB_PARSER_BUF_SIZE 1024 +#endif + /* parser structure */ struct mrb_parser_state { mrb_state *mrb; @@ -111,7 +117,7 @@ struct mrb_parser_state { mrb_ast_node *locals; mrb_ast_node *pb; - char buf[1024]; + char buf[MRB_PARSER_BUF_SIZE]; int bidx; mrb_ast_node *heredocs; /* list of mrb_parser_heredoc_info* */ diff --git a/include/mruby/hash.h b/include/mruby/hash.h index ac28f13fd..baace7567 100644 --- a/include/mruby/hash.h +++ b/include/mruby/hash.h @@ -33,7 +33,7 @@ mrb_value mrb_check_hash_type(mrb_state *mrb, mrb_value hash); /* RHASH_TBL allocates st_table if not available. */ #define RHASH(obj) ((struct RHash*)((obj).value.p)) #define RHASH_TBL(h) (RHASH(h)->ht) -#define RHASH_IFNONE(h) mrb_iv_get(mrb, (h), mrb_intern(mrb, "ifnone")) +#define RHASH_IFNONE(h) mrb_iv_get(mrb, (h), mrb_intern2(mrb, "ifnone", 6)) #define RHASH_PROCDEFAULT(h) RHASH_IFNONE(h) struct kh_ht * mrb_hash_tbl(mrb_state *mrb, mrb_value hash); |
