Add 'quiet' option, get_recursion_depth
This commit is contained in:
parent
416ed28206
commit
3a74ef5e21
12
src/sys.c
12
src/sys.c
@ -203,12 +203,18 @@ KRK_Function(members) {
|
|||||||
|
|
||||||
KRK_Function(set_recursion_depth) {
|
KRK_Function(set_recursion_depth) {
|
||||||
unsigned int maxdepth;
|
unsigned int maxdepth;
|
||||||
if (!krk_parseArgs("I",(const char*[]){"maxdepth"},&maxdepth)) return NONE_VAL();
|
int quiet = 0;
|
||||||
|
if (!krk_parseArgs("I|p",(const char*[]){"maxdepth","quiet"},&maxdepth,&quiet)) return NONE_VAL();
|
||||||
if (krk_currentThread.exitOnFrame != 0) {
|
if (krk_currentThread.exitOnFrame != 0) {
|
||||||
|
if (quiet) return BOOLEAN_VAL(0);
|
||||||
return krk_runtimeError(vm.exceptions->valueError, "Can not change recursion depth in this context.");
|
return krk_runtimeError(vm.exceptions->valueError, "Can not change recursion depth in this context.");
|
||||||
}
|
}
|
||||||
krk_setMaximumRecursionDepth(maxdepth);
|
krk_setMaximumRecursionDepth(maxdepth);
|
||||||
return NONE_VAL();
|
return BOOLEAN_VAL(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
KRK_Function(get_recursion_depth) {
|
||||||
|
return INTEGER_VAL(krk_currentThread.maximumCallDepth);
|
||||||
}
|
}
|
||||||
|
|
||||||
void krk_module_init_kuroko(void) {
|
void krk_module_init_kuroko(void) {
|
||||||
@ -262,6 +268,8 @@ void krk_module_init_kuroko(void) {
|
|||||||
"Obtain a copy of a dict of the direct members of an object.");
|
"Obtain a copy of a dict of the direct members of an object.");
|
||||||
KRK_DOC(BIND_FUNC(vm.system,set_recursion_depth),
|
KRK_DOC(BIND_FUNC(vm.system,set_recursion_depth),
|
||||||
"Change the maximum recursion depth of the current thread if possible.");
|
"Change the maximum recursion depth of the current thread if possible.");
|
||||||
|
KRK_DOC(BIND_FUNC(vm.system,get_recursion_depth),
|
||||||
|
"Examine the maximum recursion depth of the current thread.");
|
||||||
krk_attachNamedObject(&vm.system->fields, "module", (KrkObj*)vm.baseClasses->moduleClass);
|
krk_attachNamedObject(&vm.system->fields, "module", (KrkObj*)vm.baseClasses->moduleClass);
|
||||||
krk_attachNamedObject(&vm.system->fields, "path_sep", (KrkObj*)S(PATH_SEP));
|
krk_attachNamedObject(&vm.system->fields, "path_sep", (KrkObj*)S(PATH_SEP));
|
||||||
KrkValue module_paths = krk_list_of(0,NULL,0);
|
KrkValue module_paths = krk_list_of(0,NULL,0);
|
||||||
|
Loading…
Reference in New Issue
Block a user