diff --git a/include/cyclone/runtime.h b/include/cyclone/runtime.h index 20babd1c..f718d2c2 100644 --- a/include/cyclone/runtime.h +++ b/include/cyclone/runtime.h @@ -76,6 +76,15 @@ void gc_init_heap(long heap_size); } \ } +#define Cyc_check_argc(data, fnc_name, argc, expected) { \ + if (expected > argc) { \ + char buf[128]; \ + snprintf(buf, 127, "Expected %d arguments to %s but received %ld", \ + expected, fnc_name, argc); \ + Cyc_rt_raise_msg(data, buf); \ + } \ +} + #define Cyc_verify_mutable(data, obj) { \ if (immutable(obj)) Cyc_immutable_obj_error(data, obj); } #define Cyc_verify_immutable(data, obj) { \