diff --git a/image/private/js-impl.js b/image/private/js-impl.js index 60a71d8..4ee947b 100644 --- a/image/private/js-impl.js +++ b/image/private/js-impl.js @@ -170,7 +170,7 @@ EXPORTS['image-color?'] = 'image-color?', 1, function(MACHINE) { - var elt = MACHINE.env[MACHINE.env.length - 1]; + var elt = MACHINE.e[MACHINE.e.length - 1]; return (isColorOrColorString(elt)); }); @@ -181,7 +181,7 @@ EXPORTS['mode?'] = 'mode?', 1, function(MACHINE) { - return isMode(MACHINE.env[MACHINE.env.length - 1]); + return isMode(MACHINE.e[MACHINE.e.length - 1]); }); EXPORTS['x-place?'] = @@ -189,7 +189,7 @@ EXPORTS['x-place?'] = 'x-place?', 1, function(MACHINE) { - return isPlaceX(MACHINE.env[MACHINE.env.length - 1]); + return isPlaceX(MACHINE.e[MACHINE.e.length - 1]); }); EXPORTS['y-place?'] = @@ -197,7 +197,7 @@ EXPORTS['y-place?'] = 'y-place?', 1, function(MACHINE) { - return isPlaceY(MACHINE.env[MACHINE.env.length - 1]); + return isPlaceY(MACHINE.e[MACHINE.e.length - 1]); }); EXPORTS['angle?'] = @@ -205,7 +205,7 @@ EXPORTS['angle?'] = 'angle?', 1, function(MACHINE) { - return isAngle(MACHINE.env[MACHINE.env.length - 1]); + return isAngle(MACHINE.e[MACHINE.e.length - 1]); }); EXPORTS['side-count?'] = @@ -213,7 +213,7 @@ EXPORTS['side-count?'] = 'side-count?', 1, function(MACHINE) { - return isSideCount(MACHINE.env[MACHINE.env.length - 1]); + return isSideCount(MACHINE.e[MACHINE.e.length - 1]); }); @@ -222,7 +222,7 @@ EXPORTS['step-count?'] = 'step-count?', 1, function(MACHINE) { - return isStepCount(MACHINE.env[MACHINE.env.length - 1]); + return isStepCount(MACHINE.e[MACHINE.e.length - 1]); }); @@ -231,7 +231,7 @@ EXPORTS['image?'] = 'image?', 1, function(MACHINE) { - return isImage(MACHINE.env[MACHINE.env.length - 1]); + return isImage(MACHINE.e[MACHINE.e.length - 1]); }); diff --git a/js-assembler/assemble-expression.rkt b/js-assembler/assemble-expression.rkt index 47c9708..86233be 100644 --- a/js-assembler/assemble-expression.rkt +++ b/js-assembler/assemble-expression.rkt @@ -17,7 +17,7 @@ "M.proc.label"] [(MakeCompiledProcedure? op) - (format "new RT.Closure(~a, ~a, [~a], ~a)" + (format "new RT.Closure(~a,~a,[~a],~a)" (assemble-label (make-Label (MakeCompiledProcedure-label op))) (assemble-arity (MakeCompiledProcedure-arity op)) (string-join (map @@ -27,21 +27,21 @@ ;; the environment (which is also in reversed order) ;; during install-closure-values. (reverse (MakeCompiledProcedure-closed-vals op))) - ", ") + ",") (assemble-display-name (MakeCompiledProcedure-display-name op)))] [(MakeCompiledProcedureShell? op) - (format "new RT.Closure(~a, ~a, undefined, ~a)" + (format "new RT.Closure(~a,~a,undefined,~a)" (assemble-label (make-Label (MakeCompiledProcedureShell-label op))) (assemble-arity (MakeCompiledProcedureShell-arity op)) (assemble-display-name (MakeCompiledProcedureShell-display-name op)))] [(CaptureEnvironment? op) - (format "M.env.slice(0, M.env.length - ~a)" + (format "M.e.slice(0, M.e.length-~a)" (CaptureEnvironment-skip op))] [(CaptureControl? op) - (format "M.captureControl(~a, ~a)" + (format "M.captureControl(~a,~a)" (CaptureControl-skip op) (let: ([tag : (U DefaultContinuationPromptTag OpArg) (CaptureControl-tag op)]) @@ -52,8 +52,8 @@ [(MakeBoxedEnvironmentValue? op) - (format "[M.env[M.env.length - 1 - ~a]]" - (MakeBoxedEnvironmentValue-depth op))] + (format "[M.e[M.e.length-~a]]" + (add1 (MakeBoxedEnvironmentValue-depth op)))] [(CallKernelPrimitiveProcedure? op) (open-code-kernel-primitive-procedure op)])) \ No newline at end of file diff --git a/js-assembler/assemble-helpers.rkt b/js-assembler/assemble-helpers.rkt index 6d428d4..e0cb282 100644 --- a/js-assembler/assemble-helpers.rkt +++ b/js-assembler/assemble-helpers.rkt @@ -257,20 +257,20 @@ (: assemble-lexical-reference (EnvLexicalReference -> String)) (define (assemble-lexical-reference a-lex-ref) (if (EnvLexicalReference-unbox? a-lex-ref) - (format "M.env[M.env.length-~a][0]" + (format "M.e[M.e.length-~a][0]" (add1 (EnvLexicalReference-depth a-lex-ref))) - (format "M.env[M.env.length-~a]" + (format "M.e[M.e.length-~a]" (add1 (EnvLexicalReference-depth a-lex-ref))))) (: assemble-prefix-reference (EnvPrefixReference -> String)) (define (assemble-prefix-reference a-ref) - (format "M.env[M.env.length-~a][~a]" + (format "M.e[M.e.length-~a][~a]" (add1 (EnvPrefixReference-depth a-ref)) (EnvPrefixReference-pos a-ref))) (: assemble-whole-prefix-reference (EnvWholePrefixReference -> String)) (define (assemble-whole-prefix-reference a-prefix-ref) - (format "M.env[M.env.length-~a]" + (format "M.e[M.e.length-~a]" (add1 (EnvWholePrefixReference-depth a-prefix-ref)))) @@ -348,7 +348,7 @@ ;; lexical references: they must remain boxes. So all we need is ;; the depth into the environment. (define (assemble-env-reference/closure-capture depth) - (format "M.env[M.env.length - ~a]" + (format "M.e[M.e.length-~a]" (add1 depth))) @@ -436,6 +436,6 @@ (: assemble-variable-reference (VariableReference -> String)) (define (assemble-variable-reference varref) (let ([t (VariableReference-toplevel varref)]) - (format "(new RT.VariableReference(M.env[M.env.length-~a],~a))" + (format "(new RT.VariableReference(M.e[M.e.length-~a],~a))" (add1 (ToplevelRef-depth t)) (ToplevelRef-pos t)))) \ No newline at end of file diff --git a/js-assembler/assemble-perform-statement.rkt b/js-assembler/assemble-perform-statement.rkt index 0350085..2e8fa69 100644 --- a/js-assembler/assemble-perform-statement.rkt +++ b/js-assembler/assemble-perform-statement.rkt @@ -14,10 +14,10 @@ (cond [(CheckToplevelBound!? op) - (format "if (M.env[M.env.length - 1 - ~a][~a] === undefined) { RT.raiseUnboundToplevelError(M.env[M.env.length - 1 - ~a].names[~a]); }" - (CheckToplevelBound!-depth op) + (format "if (M.e[M.e.length-~a][~a]===undefined){ RT.raiseUnboundToplevelError(M.e[M.e.length-~a].names[~a]); }" + (add1 (CheckToplevelBound!-depth op)) (CheckToplevelBound!-pos op) - (CheckToplevelBound!-depth op) + (add1 (CheckToplevelBound!-depth op)) (CheckToplevelBound!-pos op))] @@ -26,11 +26,11 @@ [(ExtendEnvironment/Prefix!? op) (let: ([names : (Listof (U Symbol False GlobalBucket ModuleVariable)) (ExtendEnvironment/Prefix!-names op)]) - (format "M.env.push([~a]);M.env[M.env.length-1].names=[~a];" + (format "M.e.push([~a]);M.e[M.e.length-1].names=[~a];" (string-join (map (lambda: ([n : (U Symbol False GlobalBucket ModuleVariable)]) (cond [(symbol? n) - (format "M.params.currentNamespace[~s] || M.primitives[~s]" + (format "M.params.currentNamespace[~s]||M.primitives[~s]" (symbol->string n) (symbol->string n))] [(eq? n #f) @@ -70,10 +70,10 @@ ",")))] [(InstallClosureValues!? op) - "M.env.push.apply(M.env,M.proc.closedVals);"] + "M.e.push.apply(M.e,M.proc.closedVals);"] [(RestoreEnvironment!? op) - "M.env=M.env[M.env.length-2].slice(0);"] + "M.e=M.e[M.e.length-2].slice(0);"] [(RestoreControl!? op) (format "M.restoreControl(~a);" @@ -86,7 +86,7 @@ (assemble-oparg tag)])))] [(FixClosureShellMap!? op) - (format "M.env[M.env.length-~a].closedVals=[~a];" + (format "M.e[M.e.length-~a].closedVals=[~a];" (add1 (FixClosureShellMap!-depth op)) (string-join (map assemble-env-reference/closure-capture diff --git a/js-assembler/assemble.rkt b/js-assembler/assemble.rkt index 8319276..3dd4016 100644 --- a/js-assembler/assemble.rkt +++ b/js-assembler/assemble.rkt @@ -510,7 +510,7 @@ EOF [(PushEnvironment? stmt) (if (= (PushEnvironment-n stmt) 0) "" - (format "M.env.push(~a);" (string-join + (format "M.e.push(~a);" (string-join (build-list (PushEnvironment-n stmt) (lambda: ([i : Natural]) (if (PushEnvironment-unbox? stmt) @@ -521,16 +521,16 @@ EOF (let: ([skip : OpArg (PopEnvironment-skip stmt)]) (cond [(and (Const? skip) (= (ensure-natural (Const-const skip)) 0)) - (format "M.env.length-=~a;" + (format "M.e.length-=~a;" (assemble-oparg (PopEnvironment-n stmt)))] [else - (format "M.env.splice(M.env.length-(~a +~a),~a);" + (format "M.e.splice(M.e.length-(~a +~a),~a);" (assemble-oparg (PopEnvironment-skip stmt)) (assemble-oparg (PopEnvironment-n stmt)) (assemble-oparg (PopEnvironment-n stmt)))]))] [(PushImmediateOntoEnvironment? stmt) - (format "M.env.push(~a);" + (format "M.e.push(~a);" (let: ([val-string : String (cond [(PushImmediateOntoEnvironment-box? stmt) (format "[~a]" (assemble-oparg (PushImmediateOntoEnvironment-value stmt)))] diff --git a/js-assembler/runtime-src/baselib-check.js b/js-assembler/runtime-src/baselib-check.js index 26d350a..0513c0c 100644 --- a/js-assembler/runtime-src/baselib-check.js +++ b/js-assembler/runtime-src/baselib-check.js @@ -44,7 +44,7 @@ MACHINE, predicateName, predicate, - MACHINE.env[MACHINE.env.length - 1 - position], + MACHINE.e[MACHINE.e.length - 1 - position], position, callerName); }; @@ -63,7 +63,7 @@ function (x) { return parameterizedPredicate.apply(null, [x].concat(args)); }, - MACHINE.env[MACHINE.env.length - 1 - position], + MACHINE.e[MACHINE.e.length - 1 - position], position, callerName); }; @@ -103,7 +103,7 @@ MACHINE, 'list of ' + predicateName, listPredicate, - MACHINE.env[MACHINE.env.length - 1 - position], + MACHINE.e[MACHINE.e.length - 1 - position], position, callerName); }; diff --git a/js-assembler/runtime-src/baselib-functions.js b/js-assembler/runtime-src/baselib-functions.js index f7cdce3..9ff0eee 100644 --- a/js-assembler/runtime-src/baselib-functions.js +++ b/js-assembler/runtime-src/baselib-functions.js @@ -65,7 +65,7 @@ var returnArgs = [].slice.call(arguments, 1); // clear out stack space - MACHINE.env.length -= MACHINE.a; + MACHINE.e.length -= MACHINE.a; if (returnArgs.length === 1) { MACHINE.val = returnArgs[0]; @@ -76,7 +76,7 @@ } else { MACHINE.a = returnArgs.length; MACHINE.val = returnArgs.shift(); - MACHINE.env.push.apply(MACHINE.env, returnArgs.reverse()); + MACHINE.e.push.apply(MACHINE.e, returnArgs.reverse()); return MACHINE.control.pop().label.mvr(MACHINE); } }; @@ -109,7 +109,7 @@ var oldArgcount = MACHINE.a, i; MACHINE.a = arguments.length - 2; for (i = 0; i < arguments.length - 2; i++) { - MACHINE.env.push(arguments[arguments.length - 1 - i]); + MACHINE.e.push(arguments[arguments.length - 1 - i]); } if (!(baselib.arity.isArityMatching(v.racketArity, MACHINE.a))) { @@ -124,7 +124,7 @@ var result = v(MACHINE); MACHINE.a = oldArgcount; for (i = 0; i < arguments.length - 2; i++) { - MACHINE.env.pop(); + MACHINE.e.pop(); } succ(result); } catch (e) { @@ -170,7 +170,7 @@ MACHINE.params['currentErrorHandler'] = oldErrorHandler; var returnValues = [MACHINE.val], i; for (i = 0; i < MACHINE.a - 1; i++) { - returnValues.push(MACHINE.env.pop()); + returnValues.push(MACHINE.e.pop()); } MACHINE.val = oldVal; MACHINE.a = oldArgcount; @@ -184,7 +184,7 @@ MACHINE.a = arguments.length - 2; var i; for (i = 0; i < arguments.length - 2; i++) { - MACHINE.env.push(arguments[arguments.length - 1 - i]); + MACHINE.e.push(arguments[arguments.length - 1 - i]); } MACHINE.proc = v; MACHINE.params['currentErrorHandler'] = function (MACHINE, e) { @@ -238,11 +238,11 @@ oldArgcount = MACHINE.a; MACHINE.a = arguments.length - 4; for (i = 0; i < arguments.length - 4; i++) { - MACHINE.env.push(arguments[arguments.length - 1 - i]); + MACHINE.e.push(arguments[arguments.length - 1 - i]); } var result = proc(MACHINE); for (i = 0; i < arguments.length - 4; i++) { - MACHINE.env.pop(); + MACHINE.e.pop(); } success(result); } else if (isClosure(proc)) { @@ -267,7 +267,7 @@ var returnValues = [MACHINE.val]; var i; for (i = 0; i < MACHINE.a - 1; i++) { - returnValues.push(MACHINE.env.pop()); + returnValues.push(MACHINE.e.pop()); } MACHINE.val = oldVal; MACHINE.a = oldArgcount; @@ -280,7 +280,7 @@ new baselib.frames.CallFrame(afterGoodInvoke, proc)); MACHINE.a = arguments.length - 4; for (i = 0; i < arguments.length - 4; i++) { - MACHINE.env.push(arguments[arguments.length - 1 - i]); + MACHINE.e.push(arguments[arguments.length - 1 - i]); } MACHINE.proc = proc; MACHINE.params['currentErrorHandler'] = function (MACHINE, e) { @@ -325,7 +325,7 @@ function(M) { --M.cbt; M.val = f(M); - M.env.length -= M.a; + M.e.length -= M.a; return M.control.pop().label(M); }, []); diff --git a/js-assembler/runtime-src/baselib-primitives.js b/js-assembler/runtime-src/baselib-primitives.js index bda6f5c..7ebe65f 100644 --- a/js-assembler/runtime-src/baselib-primitives.js +++ b/js-assembler/runtime-src/baselib-primitives.js @@ -151,7 +151,7 @@ 'display', makeList(1, 2), function (M) { - var firstArg = M.env[M.env.length - 1]; + var firstArg = M.e[M.e.length - 1]; var outputPort = M.params.currentOutputPort; if (M.a === 2) { outputPort = checkOutputPort(M, 'display', 1); @@ -190,7 +190,7 @@ 'displayln', makeList(1, 2), function (M){ - var firstArg = M.env[M.env.length-1]; + var firstArg = M.e[M.e.length-1]; var outputPort = M.params.currentOutputPort; if (M.a === 2) { outputPort = checkOutputPort(M, 'displayln', 1); @@ -209,7 +209,7 @@ var args = [], i, formatString; formatString = checkString(M, 'format', 0).toString(); for(i = 1; i < M.a; i++) { - args.push(M.env[M.env.length - 1 - i]); + args.push(M.e[M.e.length - 1 - i]); } return baselib.format.format(formatString, args, 'format'); }); @@ -222,7 +222,7 @@ var args = [], i, formatString, result, outputPort; formatString = checkString(M, 'printf', 0).toString(); for(i = 1; i < M.a; i++) { - args.push(M.env[M.env.length - 1 - i]); + args.push(M.e[M.e.length - 1 - i]); } result = baselib.format.format(formatString, args, 'format'); outputPort = M.params.currentOutputPort; @@ -239,7 +239,7 @@ outputPort = checkOutputPort(M, 'fprintf', 0); formatString = checkString(M, 'fprintf', 1).toString(); for(i = 2; i < M.a; i++) { - args.push(M.env[M.env.length - 1 - i]); + args.push(M.e[M.e.length - 1 - i]); } result = baselib.format.format(formatString, args, 'format'); outputPort.writeDomNode(M, toDomNode(result, 'display')); @@ -451,7 +451,7 @@ 'zero?', 1, function (M) { - var firstArg = M.env[M.env.length-1]; + var firstArg = M.e[M.e.length-1]; return baselib.numbers.equals(firstArg, 0); }); @@ -460,8 +460,8 @@ 'cons', 2, function (M) { - var firstArg = M.env[M.env.length-1]; - var secondArg = M.env[M.env.length-2]; + var firstArg = M.e[M.e.length-1]; + var secondArg = M.e[M.e.length-2]; return makePair(firstArg, secondArg); }); @@ -472,7 +472,7 @@ function (M) { var result = NULL, i; for (i = 0; i < M.a; i++) { - result = makePair(M.env[M.env.length - (M.a - i)], + result = makePair(M.e[M.e.length - (M.a - i)], result); } return result; @@ -484,7 +484,7 @@ function (M) { var result = checkList(M, 'list*', M.a - 1), i; for (i = M.a - 2; i >= 0; i--) { - result = makePair(M.env[M.env.length - 1 - i], + result = makePair(M.e[M.e.length - 1 - i], result); } return result; @@ -524,7 +524,7 @@ 'pair?', 1, function (M) { - var firstArg = M.env[M.env.length-1]; + var firstArg = M.e[M.e.length-1]; return isPair(firstArg); }); @@ -533,7 +533,7 @@ 'list?', 1, function (M) { - return isList(M.env[M.env.length -1]); + return isList(M.e[M.e.length -1]); }); @@ -542,7 +542,7 @@ 2, function (M) { var firstArg = checkPair(M, 'set-car!', 0); - var secondArg = M.env[M.env.length-2]; + var secondArg = M.e[M.e.length-2]; firstArg.first = secondArg; return VOID; }); @@ -553,7 +553,7 @@ 2, function (M) { var firstArg = checkPair(M, 'set-car!', 0); - var secondArg = M.env[M.env.length-2]; + var secondArg = M.e[M.e.length-2]; firstArg.rest = secondArg; return VOID; }); @@ -563,7 +563,7 @@ 'not', 1, function (M) { - var firstArg = M.env[M.env.length-1]; + var firstArg = M.e[M.e.length-1]; return (firstArg === false); }); @@ -572,7 +572,7 @@ 'null?', 1, function (M) { - var firstArg = M.env[M.env.length-1]; + var firstArg = M.e[M.e.length-1]; return firstArg === NULL; }); @@ -584,7 +584,7 @@ var i; var result = []; for (i = 0; i < M.a; i++) { - result.push(M.env[M.env.length-1-i]); + result.push(M.e[M.e.length-1-i]); } var newVector = makeVector(result.length, result); return newVector; @@ -599,7 +599,7 @@ var length = baselib.numbers.toFixnum( checkNatural(M, 'make-vector', 0)); if (M.a === 2) { - value = M.env[M.env.length - 2]; + value = M.e[M.e.length - 2]; } var arr = []; var i; @@ -643,7 +643,7 @@ 2, function (M) { var elts = checkVector(M, 'vector-ref', 0).elts; - var index = M.env[M.env.length-2]; + var index = M.e[M.e.length-2]; return elts[index]; }); @@ -657,7 +657,7 @@ var index = baselib.numbers.toFixnum( checkNaturalInRange(M, 'vector-set!', 1, 0, elts.length)); - var val = M.env[M.env.length - 1 - 2]; + var val = M.e[M.e.length - 1 - 2]; elts[index] = val; return VOID; }); @@ -765,7 +765,7 @@ 'symbol?', 1, function (M) { - var firstArg = M.env[M.env.length-1]; + var firstArg = M.e[M.e.length-1]; return isSymbol(firstArg); }); @@ -979,7 +979,7 @@ 'string?', 1, function (M) { - return isString(M.env[M.env.length - 1]); + return isString(M.e[M.e.length - 1]); }); @@ -1012,7 +1012,7 @@ 'boolean?', 1, function(M) { - var v = M.env[M.env.length - 1]; + var v = M.e[M.e.length - 1]; return (v === true || v === false); }); @@ -1021,7 +1021,7 @@ 'char?', 1, function(M) { - return baselib.chars.isChar(M.env[M.env.length -1 ]); + return baselib.chars.isChar(M.e[M.e.length -1 ]); }); @@ -1064,7 +1064,7 @@ 'box', 1, function (M) { - var firstArg = M.env[M.env.length-1]; + var firstArg = M.e[M.e.length-1]; return makeBox(firstArg); }); @@ -1081,7 +1081,7 @@ 2, function (M) { var firstArg = checkMutableBox(M, 'set-box!', 0); - var secondArg = M.env[M.env.length-2]; + var secondArg = M.e[M.e.length-2]; firstArg.set(secondArg); return VOID; }); @@ -1111,8 +1111,8 @@ 'eq?', 2, function (M) { - var firstArg = M.env[M.env.length-1]; - var secondArg = M.env[M.env.length-2]; + var firstArg = M.e[M.e.length-1]; + var secondArg = M.e[M.e.length-2]; return firstArg === secondArg; }); @@ -1120,8 +1120,8 @@ 'eqv?', 2, function (M) { - var firstArg = M.env[M.env.length-1]; - var secondArg = M.env[M.env.length-2]; + var firstArg = M.e[M.e.length-1]; + var secondArg = M.e[M.e.length-2]; return baselib.equality.eqv(firstArg, secondArg); }); @@ -1131,8 +1131,8 @@ 'equal?', 2, function (M) { - var firstArg = M.env[M.env.length-1]; - var secondArg = M.env[M.env.length-2]; + var firstArg = M.e[M.e.length-1]; + var secondArg = M.e[M.e.length-2]; return equals(firstArg, secondArg); }); @@ -1145,7 +1145,7 @@ throw applyImplementation; } var proc = checkProcedure(M, 'apply', 0); - M.env.pop(); + M.e.pop(); M.a--; checkList(M, 'apply', M.a - 1); M.spliceListIntoStack(M.a - 1); @@ -1178,7 +1178,7 @@ 'procedure?', 1, function (M) { - return baselib.functions.isProcedure(M.env[M.env.length - 1]); + return baselib.functions.isProcedure(M.e[M.e.length - 1]); }); installPrimitiveProcedure( @@ -1214,8 +1214,8 @@ 'member', 2, function (M) { - var x = M.env[M.env.length-1]; - var lst = M.env[M.env.length-2]; + var x = M.e[M.e.length-1]; + var lst = M.e[M.e.length-2]; while (true) { if (lst === NULL) { return false; @@ -1225,7 +1225,7 @@ 'member', 'list', 1, - M.env[M.env.length - 1 - 1]); + M.e[M.e.length - 1 - 1]); } if (equals(x, (lst.first))) { return lst; @@ -1241,7 +1241,7 @@ 1, function (M) { var rev = NULL; - var lst = M.env[M.env.length-1]; + var lst = M.e[M.e.length-1]; while(lst !== NULL) { rev = makePair(testArgument(M, 'pair', isPair, lst, 0, 'reverse').first, rev); @@ -1257,27 +1257,27 @@ 'number?', 1, function(M) { - return isNumber(M.env[M.env.length - 1]); + return isNumber(M.e[M.e.length - 1]); }); installPrimitiveProcedure( 'real?', 1, function(M) { - return isReal(M.env[M.env.length - 1]); + return isReal(M.e[M.e.length - 1]); }); installPrimitiveProcedure( 'complex?', 1, function(M) { - return isComplex(M.env[M.env.length - 1]); + return isComplex(M.e[M.e.length - 1]); }); installPrimitiveProcedure( 'rational?', 1, function(M) { - return isRational(M.env[M.env.length - 1]); + return isRational(M.e[M.e.length - 1]); }); installPrimitiveProcedure( @@ -1490,7 +1490,7 @@ 'integer?', 1, function (M) { - return baselib.numbers.isInteger(M.env[M.env.length - 1]); + return baselib.numbers.isInteger(M.e[M.e.length - 1]); }); @@ -1498,7 +1498,7 @@ 'exact-nonnegative-integer?', 1, function (M) { - return isNatural(M.env[M.env.length - 1]); + return isNatural(M.e[M.e.length - 1]); }); @@ -1726,22 +1726,22 @@ M.captureContinuationMarks())); } - if (isString(M.env[M.env.length - 1])) { + if (isString(M.e[M.e.length - 1])) { var vs = []; for (i = 1; i < M.a; i++) { - vs.push(baselib.format.format("~e", [M.env[M.env.length - 1 - i]])); + vs.push(baselib.format.format("~e", [M.e[M.e.length - 1 - i]])); } - raise(M, baselib.exceptions.makeExnFail(String(M.env[M.env.length - 1]) + + raise(M, baselib.exceptions.makeExnFail(String(M.e[M.e.length - 1]) + ": " + vs.join(' '), M.captureContinuationMarks())); } - if (isSymbol(M.env[M.env.length - 1])) { + if (isSymbol(M.e[M.e.length - 1])) { var fmtString = checkString(M, 'error', 1); - var args = [M.env[M.env.length - 1]]; + var args = [M.e[M.e.length - 1]]; for (i = 2; i < M.a; i++) { - args.push(M.env[M.env.length - 1 - i]); + args.push(M.e[M.e.length - 1 - i]); } raise(M, baselib.exceptions.makeExnFail( baselib.format.format('~s: ' + String(fmtString), @@ -1750,7 +1750,7 @@ } // Fall-through - raiseArgumentTypeError(M, 'error', 'symbol or string', 0, M.env[M.env.length - 1]); + raiseArgumentTypeError(M, 'error', 'symbol or string', 0, M.e[M.e.length - 1]); }); @@ -1760,7 +1760,7 @@ function (M) { var name = checkSymbol(M, 'raise-mismatch-error', 0); var message = checkString(M, 'raise-mismatch-error', 0); - var val = M.env[M.env.length - 1 - 2]; + var val = M.e[M.e.length - 1 - 2]; raise(M, baselib.exceptions.makeExnFail( baselib.format.format("~a: ~a~e", [name, @@ -1781,13 +1781,13 @@ name, expected, undefined, - M.env[M.env.length - 1 - 2]); + M.e[M.e.length - 1 - 2]); } else { raiseArgumentTypeError(M, name, expected, checkNatural(M, 'raise-type-error', 2), - M.env[M.env.length - 1 - 2]); + M.e[M.e.length - 1 - 2]); } }); @@ -1843,7 +1843,7 @@ var args = []; var i; for(i = 0; i < initFieldCount; i++) { - args.push(M.env[M.env.length - 1 - i]); + args.push(M.e[M.e.length - 1 - i]); } return structType.constructor.apply(null, args); }); @@ -1853,7 +1853,7 @@ String(name) + "?", 1, function (M) { - return structType.predicate(M.env[M.env.length - 1]); + return structType.predicate(M.e[M.e.length - 1]); }); var accessorValue = @@ -1862,8 +1862,8 @@ 2, function (M) { return structType.accessor( - M.env[M.env.length - 1], - baselib.numbers.toFixnum(M.env[M.env.length - 2])); + M.e[M.e.length - 1], + baselib.numbers.toFixnum(M.e[M.e.length - 2])); }); accessorValue.structType = structType; @@ -1873,9 +1873,9 @@ 3, function (M) { return structType.mutator( - M.env[M.env.length - 1], - baselib.numbers.toFixnum(M.env[M.env.length - 2]), - M.env[M.env.length - 3]); + M.e[M.e.length - 1], + baselib.numbers.toFixnum(M.e[M.e.length - 2]), + M.e[M.e.length - 3]); }); mutatorValue.structType = structType; @@ -1909,11 +1909,11 @@ 'make-struct-field-accessor', makeList(2, 3), function (M){ - var structType = M.env[M.env.length - 1].structType; - var index = M.env[M.env.length - 2]; + var structType = M.e[M.e.length - 1].structType; + var index = M.e[M.e.length - 2]; var name; if (M.a === 3) { - name = String(M.env[M.env.length - 3]); + name = String(M.e[M.e.length - 3]); } else { name = 'field' + index; } @@ -1936,11 +1936,11 @@ 'make-struct-field-mutator', makeList(2, 3), function (M){ - var structType = M.env[M.env.length - 1].structType; - var index = M.env[M.env.length - 2]; + var structType = M.e[M.e.length - 1].structType; + var index = M.e[M.e.length - 2]; var name; if (M.a === 3) { - name = String(M.env[M.env.length - 3]); + name = String(M.e[M.e.length - 3]); } else { name = 'field' + index; } @@ -1954,7 +1954,7 @@ return structType.mutator( aStruct, baselib.numbers.toFixnum(index), - M.env[M.env.length - 2]); + M.e[M.e.length - 2]); }); }); @@ -1963,7 +1963,7 @@ 'make-placeholder', 1, function(M) { - var v = M.env[M.env.length - 1]; + var v = M.e[M.e.length - 1]; return baselib.placeholders.makePlaceholder(v); }); @@ -1973,7 +1973,7 @@ 2, function(M) { var placeholder = checkPlaceholder(M, 'placeholder-set!', 0); - var val = M.env[M.env.length - 2]; + var val = M.e[M.e.length - 2]; placeholder.set(val); return VOID; }); @@ -1984,7 +1984,7 @@ 'make-reader-graph', 1, function(M) { - var x = M.env[M.env.length - 1]; + var x = M.e[M.e.length - 1]; return baselib.readergraph.readerGraph(x, baselib.hashes.makeLowLevelEqHash(), 0); @@ -1997,7 +1997,7 @@ 'srcloc', 5, function(M) { - var source = M.env[M.env.length - 1]; + var source = M.e[M.e.length - 1]; var line = checkNatural(M, 'srcloc', 1); var column = checkNatural(M, 'srcloc', 2); var position = checkNatural(M, 'srcloc', 3); @@ -2009,7 +2009,7 @@ 'make-srcloc', 5, function(M) { - var source = M.env[M.env.length - 1]; + var source = M.e[M.e.length - 1]; var line = checkNatural(M, 'make-srcloc', 1); var column = checkNatural(M, 'make-srcloc', 2); var position = checkNatural(M, 'make-srcloc', 3); @@ -2021,7 +2021,7 @@ 'srcloc?', 1, function(M) { - return baselib.srclocs.isSrcloc(M.env[M.env.length - 1]); + return baselib.srclocs.isSrcloc(M.e[M.e.length - 1]); }); installPrimitiveProcedure( diff --git a/js-assembler/runtime-src/baselib.js b/js-assembler/runtime-src/baselib.js index 5768c23..0114034 100644 --- a/js-assembler/runtime-src/baselib.js +++ b/js-assembler/runtime-src/baselib.js @@ -45,7 +45,7 @@ if (!(this.plt)) { this.plt = {}; } // Helper to deal with the argument-passing of primitives. Call f - // with arguments bound from MACHINE.env, assuming + // with arguments bound from MACHINE.e, assuming // MACHINE.a has been initialized with the number of // arguments on the stack. vs provides optional values for the // arguments that go beyond those of the mandatoryArgCount. @@ -53,10 +53,10 @@ if (!(this.plt)) { this.plt = {}; } var args = [], i; for (i = 0; i < MACHINE.a; i++) { if (i < mandatoryArgCount) { - args.push(MACHINE.env[MACHINE.env.length - 1 - i]); + args.push(MACHINE.e[MACHINE.e.length - 1 - i]); } else { if (i < MACHINE.a) { - args.push(MACHINE.env[MACHINE.env.length - 1 - i]); + args.push(MACHINE.e[MACHINE.e.length - 1 - i]); } else { args.push(vs[mandatoryArgCount - i]); } diff --git a/js-assembler/runtime-src/runtime.js b/js-assembler/runtime-src/runtime.js index a6e815d..674a8d1 100644 --- a/js-assembler/runtime-src/runtime.js +++ b/js-assembler/runtime-src/runtime.js @@ -191,7 +191,7 @@ } var oldArgcount = MACHINE.a; - var elt = MACHINE.env[MACHINE.env.length - 1]; + var elt = MACHINE.e[MACHINE.e.length - 1]; var outputPort = MACHINE.params.currentOutputPort; if (elt !== VOID) { @@ -215,7 +215,7 @@ this.val = undefined; // value register this.proc = undefined; // procedure register this.a = undefined; // argument count - this.env = []; // environment + this.e = []; // environment this.control = []; // control: Arrayof (U Frame CallFrame PromptFrame) this.running = false; this.modules = {}; // String -> ModuleRecord @@ -315,7 +315,7 @@ if (MACHINE.control[i].tag === tag) { MACHINE.control = MACHINE.control.slice(0, i+1).concat( - MACHINE.env[MACHINE.env.length - 1]); + MACHINE.e[MACHINE.e.length - 1]); return; } } @@ -328,15 +328,15 @@ // appropriately. Machine.prototype.spliceListIntoStack = function(depth) { var MACHINE = this; - var lst = MACHINE.env[MACHINE.env.length - 1 - depth]; + var lst = MACHINE.e[MACHINE.e.length - 1 - depth]; var vals = []; while(lst !== NULL) { vals.push(lst.first); lst = lst.rest; } vals.reverse(); - MACHINE.env.splice.apply(MACHINE.env, - [MACHINE.env.length - 1 - depth, 1].concat(vals)); + MACHINE.e.splice.apply(MACHINE.e, + [MACHINE.e.length - 1 - depth, 1].concat(vals)); MACHINE.a = MACHINE.a + vals.length - 1; }; @@ -347,10 +347,10 @@ var lst = NULL; var i; for (i = 0; i < length; i++) { - lst = makePair(MACHINE.env[MACHINE.env.length - depth - length + i], + lst = makePair(MACHINE.e[MACHINE.e.length - depth - length + i], lst); } - MACHINE.env.splice(MACHINE.env.length - depth - length, + MACHINE.e.splice(MACHINE.e.length - depth - length, length, lst); MACHINE.a = MACHINE.a - length + 1; diff --git a/js/js-impl.js b/js/js-impl.js index bb4562b..a76ceaf 100644 --- a/js/js-impl.js +++ b/js/js-impl.js @@ -6,7 +6,7 @@ EXPORTS['alert'] = 'alert', 1, function(MACHINE) { - var elt = MACHINE.env[MACHINE.env.length - 1]; + var elt = MACHINE.e[MACHINE.e.length - 1]; alert(String(elt)); return VOID; }); @@ -19,7 +19,7 @@ EXPORTS['$'] = '$', 1, function(MACHINE) { - var obj = MACHINE.env[MACHINE.env.length - 1]; + var obj = MACHINE.e[MACHINE.e.length - 1]; return $(obj); }); @@ -28,11 +28,11 @@ EXPORTS['call-method'] = 'call-method', plt.baselib.arity.makeArityAtLeast(2), function(MACHINE) { - var obj = MACHINE.env[MACHINE.env.length - 1]; - var methodName = MACHINE.env[MACHINE.env.length - 2]; + var obj = MACHINE.e[MACHINE.e.length - 1]; + var methodName = MACHINE.e[MACHINE.e.length - 2]; var args = []; for (var i = 0; i < MACHINE.a - 2; i++) { - args.push(MACHINE.env[MACHINE.env.length -1 - 2 - i]); + args.push(MACHINE.e[MACHINE.e.length -1 - 2 - i]); } var result = obj[methodName].apply(obj, args); return result; diff --git a/lang/unsafe/js-impl.js b/lang/unsafe/js-impl.js index b04bd6b..6e900fe 100644 --- a/lang/unsafe/js-impl.js +++ b/lang/unsafe/js-impl.js @@ -4,7 +4,7 @@ EXPORTS['unsafe-car'] = 'unsafe-car', 1, function(MACHINE) { - return MACHINE.env[MACHINE.env.length - 1].first; + return MACHINE.e[MACHINE.e.length - 1].first; }); @@ -13,5 +13,5 @@ EXPORTS['unsafe-cdr'] = 'unsafe-cdr', 1, function(MACHINE) { - return MACHINE.env[MACHINE.env.length - 1].rest; + return MACHINE.e[MACHINE.e.length - 1].rest; }); diff --git a/web-world/js-impl.js b/web-world/js-impl.js index 8730454..d87cb38 100644 --- a/web-world/js-impl.js +++ b/web-world/js-impl.js @@ -1521,7 +1521,7 @@ 'big-bang', plt.baselib.arity.makeArityAtLeast(1), function(MACHINE) { - var world = MACHINE.env[MACHINE.env.length - 1]; + var world = MACHINE.e[MACHINE.e.length - 1]; var handlers = []; var i; for (i = 1; i < MACHINE.a; i++) { @@ -1535,7 +1535,7 @@ 'initial-view', 1, function(MACHINE) { - var viewable = MACHINE.env[MACHINE.env.length - 1]; + var viewable = MACHINE.e[MACHINE.e.length - 1]; var oldArgcount = MACHINE.a; PAUSE(function(restart) { coerseToView(viewable, @@ -1563,7 +1563,7 @@ '->view', 1, function(MACHINE) { - var viewable = MACHINE.env[MACHINE.env.length - 1]; + var viewable = MACHINE.e[MACHINE.e.length - 1]; var oldArgcount = MACHINE.a; PAUSE(function(restart) { coerseToMockView(viewable, @@ -1776,7 +1776,7 @@ 2, function(MACHINE) { var view = checkMockView(MACHINE, 'update-view-text', 0); - var text = plt.baselib.format.toDisplayedString(MACHINE.env[MACHINE.env.length - 2]); + var text = plt.baselib.format.toDisplayedString(MACHINE.e[MACHINE.e.length - 2]); return view.updateText(text); }); @@ -1891,7 +1891,7 @@ function(MACHINE) { var view = checkMockView(MACHINE, 'view-append-child', 0); var oldArgcount = MACHINE.a; - var x = MACHINE.env[MACHINE.env.length - 2]; + var x = MACHINE.e[MACHINE.e.length - 2]; PAUSE(function(restart) { coerseToDomNode(x, function(dom) { @@ -1921,7 +1921,7 @@ function(MACHINE) { var view = checkMockView(MACHINE, 'view-insert-right', 0); var oldArgcount = MACHINE.a; - var x = MACHINE.env[MACHINE.env.length - 2]; + var x = MACHINE.e[MACHINE.e.length - 2]; PAUSE(function(restart) { coerseToDomNode(x, function(dom) { @@ -1953,7 +1953,7 @@ function(MACHINE) { var view = checkMockView(MACHINE, 'view-insert-left', 0); var oldArgcount = MACHINE.a; - var x = MACHINE.env[MACHINE.env.length - 2]; + var x = MACHINE.e[MACHINE.e.length - 2]; PAUSE(function(restart) { coerseToDomNode(x, function(dom) { @@ -2024,7 +2024,7 @@ 'xexp?', 1, function(MACHINE) { - return isXexp(MACHINE.env[MACHINE.env.length - 1]); + return isXexp(MACHINE.e[MACHINE.e.length - 1]); }); diff --git a/world/js-impl.js b/world/js-impl.js index bc0eec9..8e06b24 100644 --- a/world/js-impl.js +++ b/world/js-impl.js @@ -39,7 +39,7 @@ EXPORTS['big-bang'] = 'big-bang', plt.baselib.arity.makeArityAtLeast(1), function(MACHINE) { - var initialWorldValue = MACHINE.env[MACHINE.env.length - 1]; + var initialWorldValue = MACHINE.e[MACHINE.e.length - 1]; var handlers = []; for (var i = 1; i < MACHINE.a; i++) { handlers.push(checkHandler(MACHINE, 'big-bang', i));