summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorYukihiro Matsumoto <[email protected]>2012-07-30 09:40:53 +0900
committerYukihiro Matsumoto <[email protected]>2012-07-30 09:40:53 +0900
commitd0c1b7b4a8cad2c5a01ccfbe97ffd0381f592f39 (patch)
tree71714f97815fddc471da37f97ceca13f8fd26a45
parentbd035bcbb6b6ed79501b073111ca2c5ea8b29dee (diff)
parent179b2aceeadcd3c5fdac425737280bb09e0ba2d0 (diff)
downloadmruby-d0c1b7b4a8cad2c5a01ccfbe97ffd0381f592f39.tar.gz
mruby-d0c1b7b4a8cad2c5a01ccfbe97ffd0381f592f39.zip
Merge branch 'master' of github.com:mruby/mruby
-rw-r--r--include/mruby/array.h1
-rw-r--r--include/mruby/hash.h3
-rw-r--r--include/mruby/numeric.h1
-rw-r--r--include/mruby/string.h3
-rw-r--r--include/mruby/struct.h3
-rw-r--r--include/mruby/variable.h1
-rw-r--r--src/hash.c4
-rw-r--r--test/driver.c20
-rw-r--r--tools/mrbc/mrbc.c5
9 files changed, 23 insertions, 18 deletions
diff --git a/include/mruby/array.h b/include/mruby/array.h
index f42146f3e..bc10d8919 100644
--- a/include/mruby/array.h
+++ b/include/mruby/array.h
@@ -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)
diff --git a/include/mruby/hash.h b/include/mruby/hash.h
index 7a16d7b5a..f3755eb25 100644
--- a/include/mruby/hash.h
+++ b/include/mruby/hash.h
@@ -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))
diff --git a/include/mruby/numeric.h b/include/mruby/numeric.h
index a3768db2f..867aa27d9 100644
--- a/include/mruby/numeric.h
+++ b/include/mruby/numeric.h
@@ -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);
diff --git a/include/mruby/string.h b/include/mruby/string.h
index 1449a2edf..c6f7c4ab5 100644
--- a/include/mruby/string.h
+++ b/include/mruby/string.h
@@ -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);
diff --git a/include/mruby/struct.h b/include/mruby/struct.h
index 1aee64883..514f66dfe 100644
--- a/include/mruby/struct.h
+++ b/include/mruby/struct.h
@@ -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
diff --git a/include/mruby/variable.h b/include/mruby/variable.h
index a4ed9a0ee..e93a77c55 100644
--- a/include/mruby/variable.h
+++ b/include/mruby/variable.h
@@ -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);
diff --git a/src/hash.c b/src/hash.c
index 5d3835019..927e40e66 100644
--- a/src/hash.c
+++ b/src/hash.c
@@ -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);
diff --git a/test/driver.c b/test/driver.c
index 4fe58432d..d2ad31b26 100644
--- a/test/driver.c
+++ b/test/driver.c
@@ -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;
}
diff --git a/tools/mrbc/mrbc.c b/tools/mrbc/mrbc.c
index 428a3b781..f9810aa4f 100644
--- a/tools/mrbc/mrbc.c
+++ b/tools/mrbc/mrbc.c
@@ -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;
}