1 // This file is prepended to the result of compile jscl.lisp, and
2 // contain runtime code that jscl assumes to exist.
7 globalEval = eval; // Just an indirect eval
9 function pv (x) { return x==undefined? nil: x; }
12 var r = [].slice.call(arguments);
13 r['multiple-value'] = true;
17 function forcemv (x) {
18 return typeof x == 'object' && 'multiple-value' in x? x: mv(x);
21 // NOTE: Define VALUES to be MV for toplevel forms. It is because
22 // `eval' compiles the forms and execute the Javascript code at
23 // toplevel with `js-eval', so it is necessary to return multiple
24 // values from the eval function.
27 function checkArgsAtLeast(args, n){
28 if (args < n) throw 'too few arguments';
31 function checkArgsAtMost(args, n){
32 if (args > n) throw 'too many arguments';
35 function checkArgs(args, n){
36 checkArgsAtLeast(args, n);
37 checkArgsAtMost(args, n);
40 // Improper list constructor (like LIST*)
42 if (arguments.length == 1)
45 var i = arguments.length-1;
46 var r = arguments[i--];
48 r = {car: arguments[i], cdr: r};