From 7696be307f95423066348555f04546782e08ff22 Mon Sep 17 00:00:00 2001 From: spv420 Date: Sun, 24 Apr 2022 09:37:59 -0400 Subject: rad --- src/js/lib/myutils.js | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) (limited to 'src/js/lib/myutils.js') diff --git a/src/js/lib/myutils.js b/src/js/lib/myutils.js index 0106402..29085c3 100644 --- a/src/js/lib/myutils.js +++ b/src/js/lib/myutils.js @@ -27,6 +27,7 @@ function printf() { return calls4arg.apply(this, args_to_pass); } +/* function syslog() { if (arguments.length > 4) { return printf("warning: tried to printf with %d args, max %d.\n", arguments.length, 4); @@ -60,4 +61,32 @@ function syslog() { function sleep(t) { return calls4arg("sleep", t, 0, 0, 0); -} \ No newline at end of file +} + */ + +function scall_wrapper() { + function _scall_wrapper() { + var args_to_pass = new Array(); + args_to_pass.push(arguments.callee.func_name); + + if (arguments.callee.hasOwnProperty("pre_args")) { + args_to_pass = args_to_pass.concat(arguments.callee.pre_args); + } + + args_to_pass = args_to_pass.concat(Array.from(arguments)); + + if (arguments.callee.hasOwnProperty("post_args")) { + args_to_pass = args_to_pass.concat(arguments.callee.post_args); + } + + return scall.apply(this, args_to_pass); + } + + return _scall_wrapper; +} + +var syslog = scall_wrapper(); +syslog.func_name = "syslog"; + +var sleep = scall_wrapper(); +sleep.func_name = "sleep"; \ No newline at end of file -- cgit v1.2.3