diff options
Diffstat (limited to 'include')
| -rw-r--r-- | include/mruby.h | 1 | ||||
| -rw-r--r-- | include/mruby/compile.h | 16 | ||||
| -rw-r--r-- | include/mruby/value.h | 19 |
3 files changed, 27 insertions, 9 deletions
diff --git a/include/mruby.h b/include/mruby.h index 4e4751c38..84aeff0d7 100644 --- a/include/mruby.h +++ b/include/mruby.h @@ -209,7 +209,6 @@ mrb_state* mrb_open(void); mrb_state* mrb_open_allocf(mrb_allocf, void *ud); void mrb_irep_free(mrb_state*, struct mrb_irep*); void mrb_close(mrb_state*); -int mrb_checkstack(mrb_state*,int); mrb_value mrb_top_self(mrb_state *); mrb_value mrb_run(mrb_state*, struct RProc*, mrb_value); diff --git a/include/mruby/compile.h b/include/mruby/compile.h index 4b12cb10c..8b0743fa3 100644 --- a/include/mruby/compile.h +++ b/include/mruby/compile.h @@ -68,13 +68,15 @@ struct mrb_parser_message { enum mrb_string_type { str_not_parsing = (0), - str_squote = (STR_FUNC_PARSING), - str_dquote = (STR_FUNC_PARSING|STR_FUNC_EXPAND), - str_regexp = (STR_FUNC_PARSING|STR_FUNC_REGEXP|STR_FUNC_EXPAND), - str_sword = (STR_FUNC_PARSING|STR_FUNC_WORD|STR_FUNC_ARRAY), - str_dword = (STR_FUNC_PARSING|STR_FUNC_WORD|STR_FUNC_ARRAY|STR_FUNC_EXPAND), - str_ssym = (STR_FUNC_PARSING|STR_FUNC_SYMBOL), - str_heredoc = (STR_FUNC_PARSING|STR_FUNC_HEREDOC), + str_squote = (STR_FUNC_PARSING), + str_dquote = (STR_FUNC_PARSING|STR_FUNC_EXPAND), + str_regexp = (STR_FUNC_PARSING|STR_FUNC_REGEXP|STR_FUNC_EXPAND), + str_sword = (STR_FUNC_PARSING|STR_FUNC_WORD|STR_FUNC_ARRAY), + str_dword = (STR_FUNC_PARSING|STR_FUNC_WORD|STR_FUNC_ARRAY|STR_FUNC_EXPAND), + str_ssym = (STR_FUNC_PARSING|STR_FUNC_SYMBOL), + 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), }; /* heredoc structure */ diff --git a/include/mruby/value.h b/include/mruby/value.h index eae08855d..5730bf909 100644 --- a/include/mruby/value.h +++ b/include/mruby/value.h @@ -154,7 +154,8 @@ mrb_float_value(mrb_float f) #define mrb_string_p(o) (mrb_type(o) == MRB_TT_STRING) #define mrb_hash_p(o) (mrb_type(o) == MRB_TT_HASH) #define mrb_voidp_p(o) (mrb_type(o) == MRB_TT_VOIDP) -#define mrb_test(o) (mrb_type(o) != MRB_TT_FALSE) +#define mrb_bool(o) (mrb_type(o) != MRB_TT_FALSE) +#define mrb_test(o) mrb_bool(o) #define MRB_OBJECT_HEADER \ enum mrb_vtype tt:8;\ @@ -274,4 +275,20 @@ mrb_undef_value(void) return v; } +static inline mrb_value +mrb_bool_value(mrb_bool boolean) +{ + mrb_value v; + + v.value.i = 1; + if (boolean) { + v.tt = MRB_TT_TRUE; + } + else { + v.tt = MRB_TT_FALSE; + } + + return v; +} + #endif /* MRUBY_OBJECT_H */ |
