Commit d0c1b7b4 authored by Yukihiro Matsumoto's avatar Yukihiro Matsumoto

Merge branch 'master' of github.com:mruby/mruby

parents bd035bcb 179b2ace
......@@ -54,7 +54,6 @@ mrb_value mrb_ary_unshift(mrb_state *mrb, mrb_value self, mrb_value item);
mrb_value mrb_ary_new4(mrb_state *mrb, int n, const mrb_value *elts);
mrb_value mrb_assoc_new(mrb_state *mrb, mrb_value car, mrb_value cdr);
mrb_value mrb_ary_entry(mrb_value ary, int offset);
mrb_value mrb_ary_sort(mrb_state *mrb, mrb_value ary);
mrb_value mrb_ary_shift(mrb_state *mrb, mrb_value self);
#if defined(__cplusplus)
......
......@@ -26,10 +26,7 @@ mrb_value mrb_hash_new(mrb_state *mrb);
void mrb_hash_set(mrb_state *mrb, mrb_value hash, mrb_value key, mrb_value val);
mrb_value mrb_hash_get(mrb_state *mrb, mrb_value hash, mrb_value key);
mrb_value mrb_hash_fetch(mrb_state *mrb, mrb_value hash, mrb_value key, mrb_value def);
mrb_value mrb_hash_delete_key(mrb_state *mrb, mrb_value hash, mrb_value key);
mrb_value mrb_hash_keys(mrb_state *mrb, mrb_value hash);
mrb_value mrb_hash(mrb_state *mrb, mrb_value obj);
mrb_value mrb_check_hash_type(mrb_state *mrb, mrb_value self);
/* RHASH_TBL allocates st_table if not available. */
#define RHASH(obj) ((struct RHash*)((obj).value.p))
......
......@@ -18,7 +18,6 @@ extern "C" {
#define FIXABLE(f) (POSFIXABLE(f) && NEGFIXABLE(f))
mrb_value mrb_flt2big(mrb_state *mrb, mrb_float d);
void mrb_num_zerodiv(mrb_state *mrb);
mrb_value mrb_fix2str(mrb_state *mrb, mrb_value x, int base);
mrb_value mrb_fixnum_plus(mrb_state *mrb, mrb_value x, mrb_value y);
......
......@@ -52,7 +52,6 @@ struct RString {
void mrb_str_decref(mrb_state*, struct mrb_shared_string*);
mrb_value mrb_str_literal(mrb_state*, mrb_value);
void mrb_str_concat(mrb_state*, mrb_value, mrb_value);
mrb_value mrb_obj_to_str(mrb_state*, mrb_value);
mrb_value mrb_str_plus(mrb_state*, mrb_value, mrb_value);
mrb_value mrb_obj_as_string(mrb_state *mrb, mrb_value obj);
mrb_value mrb_str_resize(mrb_state *mrb, mrb_value str, int len); /* mrb_str_resize */
......@@ -78,8 +77,6 @@ int mrb_str_hash_cmp(mrb_state *mrb, mrb_value str1, mrb_value str2);
mrb_value mrb_str_buf_append(mrb_state *mrb, mrb_value str, mrb_value str2);
mrb_value mrb_str_inspect(mrb_state *mrb, mrb_value str);
int mrb_str_equal(mrb_state *mrb, mrb_value str1, mrb_value str2);
mrb_value * mrb_svar(mrb_int cnt);
mrb_value mrb_str_drop_bytes(mrb_state *mrb, mrb_value str, long len);
mrb_value mrb_str_dump(mrb_state *mrb, mrb_value str);
mrb_value mrb_str_cat(mrb_state *mrb, mrb_value str, const char *ptr, long len);
mrb_value mrb_str_append(mrb_state *mrb, mrb_value str, mrb_value str2);
......
......@@ -20,9 +20,6 @@ struct RStruct {
#define RSTRUCT_LEN(st) ((int)(RSTRUCT(st)->len))
#define RSTRUCT_PTR(st) (RSTRUCT(st)->ptr)
mrb_value mrb_yield_values(int n, ...);
mrb_value mrb_mod_module_eval(mrb_state *mrb, int argc, mrb_value *argv, mrb_value mod);
#if defined(__cplusplus)
} /* extern "C" { */
#endif
......
......@@ -44,7 +44,6 @@ const char * mrb_class2name(mrb_state *mrb, struct RClass* klass);
mrb_value mrb_iv_get(mrb_state *mrb, mrb_value obj, mrb_sym sym);
void mrb_iv_set(mrb_state *mrb, mrb_value obj, mrb_sym sym, mrb_value v);
mrb_value mrb_iv_remove(mrb_state *mrb, mrb_value obj, mrb_sym sym);
void mrb_copy_generic_ivar(mrb_value clone, mrb_value obj);
int mrb_const_defined_at(mrb_state *mrb, struct RClass *klass, mrb_sym id);
mrb_value mrb_f_global_variables(mrb_state *mrb, mrb_value self);
mrb_value mrb_gv_get(mrb_state *mrb, mrb_sym sym);
......
......@@ -488,7 +488,7 @@ mrb_hash_set_default_proc(mrb_state *mrb, mrb_value hash)
return ifnone;
}
mrb_value
static mrb_value
mrb_hash_delete_key(mrb_state *mrb, mrb_value hash, mrb_value key)
{
khash_t(ht) *h = RHASH_TBL(hash);
......@@ -965,7 +965,7 @@ mrb_hash_to_hash(mrb_state *mrb, mrb_value hash)
*
*/
mrb_value
static mrb_value
mrb_hash_keys(mrb_state *mrb, mrb_value hash)
{
khash_t(ht) *h = RHASH_TBL(hash);
......
......@@ -11,6 +11,7 @@
#include <mruby/proc.h>
#include <mruby/data.h>
#include <mruby/compile.h>
#include <mruby/variable.h>
void
mrb_init_mrbtest(mrb_state *);
......@@ -23,12 +24,24 @@ void print_hint(void)
printf("Thanks :)\n\n");
}
static int
check_error(mrb_state *mrb)
{
/* Error check */
/* $ko_test and $kill_test should be 0 */
mrb_value ko_test = mrb_gv_get(mrb, mrb_intern(mrb, "$ko_test"));
mrb_value kill_test = mrb_gv_get(mrb, mrb_intern(mrb, "$kill_test"));
return FIXNUM_P(ko_test) && mrb_fixnum(ko_test) == 0 && FIXNUM_P(kill_test) && mrb_fixnum(kill_test) == 0;
}
int
main(void)
{
mrb_state *mrb;
mrb_value return_value;
const char *prog = "report()";
int ret = EXIT_SUCCESS;
print_hint();
......@@ -46,11 +59,12 @@ main(void)
if (mrb->exc) {
mrb_p(mrb, return_value);
mrb->exc = 0;
ret = EXIT_FAILURE;
}
else {
/* no */
else if (!check_error(mrb)) {
ret = EXIT_FAILURE;
}
mrb_close(mrb);
return EXIT_SUCCESS;
return ret;
}
......@@ -135,7 +135,10 @@ parse_args(mrb_state *mrb, int argc, char **argv, struct _args *args)
if (outfile == NULL)
outfile = get_outfilename(infile, args->ext);
if ((args->wfp = fopen(outfile, "wb")) == NULL) {
if (strcmp("-", outfile) == 0) {
args->wfp = stdout;
}
else if ((args->wfp = fopen(outfile, "wb")) == NULL) {
printf("%s: Cannot open output file. (%s)\n", *origargv, outfile);
return 0;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment