diff options
| -rw-r--r-- | src/js/lib/myutils.js | 31 | ||||
| -rw-r--r-- | src/js/main.js | 3 |
2 files changed, 32 insertions, 2 deletions
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 diff --git a/src/js/main.js b/src/js/main.js index 908b582..018e514 100644 --- a/src/js/main.js +++ b/src/js/main.js @@ -48,7 +48,8 @@ function main() { var i = 0; while (true) { - scall("printf", "get rekt from jsc %d (slide=%x)\n", i, slide); +// scall("printf", "get rekt from jsc %d (slide=%x)\n", i, slide); + syslog(LOG_SYSLOG, "get rekt from jsc %d (slide=%x)\n", i, slide); sleep(0); i++; } |
