aboutsummaryrefslogtreecommitdiff
path: root/builtin.cpp
diff options
context:
space:
mode:
authorTeddy <ted.sybil@gmail.com>2013-08-14 00:08:30 +0800
committerTeddy <ted.sybil@gmail.com>2013-08-14 00:08:30 +0800
commitc2522466d2fcb5273004f1989b89186cd68001d7 (patch)
tree6c5eed59e9b32e8e82eee2d22f66be3cede6f6d3 /builtin.cpp
parentfaab1d57661e4d68823723a8270205c3a3c6e148 (diff)
added gc setting built-insgc_cyc
Diffstat (limited to 'builtin.cpp')
-rw-r--r--builtin.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/builtin.cpp b/builtin.cpp
index b983167..2cd738a 100644
--- a/builtin.cpp
+++ b/builtin.cpp
@@ -1515,6 +1515,22 @@ BUILTIN_PROC_DEF(vector_length) {
return new IntNumObj(vect->get_size());
}
+BUILTIN_PROC_DEF(gc_status) {
+ if (args != empty_list)
+ throw TokenError(name, RUN_ERR_WRONG_NUM_OF_ARGS);
+ return new IntNumObj(gc.get_remaining());
+}
+
+BUILTIN_PROC_DEF(set_gc_resolve_threshold) {
+ ARGS_EXACTLY_ONE;
+ CHECK_NUMBER(args->car);
+ CHECK_INT(static_cast<NumObj*>(args->car));
+ ssize_t s = static_cast<IntNumObj*>(args->car)->get_i();
+ if (s < 0)
+ throw TokenError("a non-negative integer", RUN_ERR_WRONG_TYPE);
+ gc.set_resolve_threshold(size_t(s));
+ return new UnspecObj();
+}
BUILTIN_PROC_DEF(display) {
ARGS_EXACTLY_ONE;