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