renamed argcount to a

This commit is contained in:
Danny Yoo 2011-09-14 21:47:12 -04:00
parent 298ade1752
commit 318255c253
12 changed files with 136 additions and 129 deletions

View File

@ -286,13 +286,13 @@ EXPORTS['bitmap/url'] =
1,
function(MACHINE) {
var url = checkString(MACHINE, 'bitmap/url', 0);
var oldArgcount = MACHINE.argcount;
var oldArgcount = MACHINE.a;
PAUSE(
function(restart) {
var rawImage = new Image();
rawImage.onload = function() {
restart(function(MACHINE) {
MACHINE.argcount = oldArgcount;
MACHINE.a = oldArgcount;
finalizeClosureCall(
MACHINE,
makeFileImage(url.toString(),
@ -333,7 +333,7 @@ EXPORTS['overlay'] =
var img1 = checkImage(MACHINE, "overlay", 0);
var img2 = checkImage(MACHINE, "overlay", 1);
var restImages = [];
for (var i = 2; i < MACHINE.argcount; i++) {
for (var i = 2; i < MACHINE.a; i++) {
restImages.push(checkImage(MACHINE, "overlay", i));
}
@ -373,7 +373,7 @@ EXPORTS['overlay/xy'] =
var img1 = checkImage(MACHINE, "overlay/align", 2);
var img2 = checkImage(MACHINE, "overlay/align", 3);
var restImages = [];
for (var i = 4; i < MACHINE.argcount; i++) {
for (var i = 4; i < MACHINE.a; i++) {
restImages.push(checkImage(MACHINE, "overlay/align", i));
}
var img = makeOverlayImage(img1,
@ -400,7 +400,7 @@ EXPORTS['underlay'] =
var img1 = checkImage(MACHINE, "underlay", 0);
var img2 = checkImage(MACHINE, "underlay", 1);
var restImages = [];
for (var i = 2; i < MACHINE.argcount; i++) {
for (var i = 2; i < MACHINE.a; i++) {
restImages.push(checkImage(MACHINE, "underlay", i));
}
@ -437,7 +437,7 @@ EXPORTS['underlay/align'] =
var img1 = checkImage(MACHINE, "underlay/align", 2);
var img2 = checkImage(MACHINE, "underlay/align", 3);
var restImages = [];
for (var i = 4; i < MACHINE.argcount; i++) {
for (var i = 4; i < MACHINE.a; i++) {
restImages.push(checkImage(MACHINE, "underlay/align", i));
}
@ -465,7 +465,7 @@ EXPORTS['beside'] =
var img1 = checkImage(MACHINE, "beside", 0);
var img2 = checkImage(MACHINE, "beside", 1);
var restImages = [];
for (var i = 2; i < MACHINE.argcount; i++) {
for (var i = 2; i < MACHINE.a; i++) {
restImages.push(checkImage(MACHINE, "beside", i));
}
@ -491,7 +491,7 @@ EXPORTS['beside/align'] =
var img1 = checkImage(MACHINE, "beside/align", 1);
var img2 = checkImage(MACHINE, "beside/align", 2);
var restImages = [];
for (var i = 3; i < MACHINE.argcount; i++) {
for (var i = 3; i < MACHINE.a; i++) {
restImages.push(checkImage(MACHINE, "beside/align", i));
}
@ -519,7 +519,7 @@ EXPORTS['above'] =
var img1 = checkImage(MACHINE, "above", 0);
var img2 = checkImage(MACHINE, "above", 1);
var restImages = [];
for (var i = 2; i < MACHINE.argcount; i++) {
for (var i = 2; i < MACHINE.a; i++) {
restImages.push(checkImage(MACHINE, "above", i));
}
@ -546,7 +546,7 @@ EXPORTS['above/align'] =
var img1 = checkImage(MACHINE, "above/align", 1);
var img2 = checkImage(MACHINE, "above/align", 2);
var restImages = [];
for (var i = 3; i < MACHINE.argcount; i++) {
for (var i = 3; i < MACHINE.a; i++) {
restImages.push(checkImage(MACHINE, "above/align", i));
}
@ -925,7 +925,7 @@ EXPORTS['star'] =
'star',
plt.baselib.lists.makeList(3, 5),
function(MACHINE) {
if (MACHINE.argcount === 3) {
if (MACHINE.a === 3) {
var sideLength = checkNonNegativeReal(MACHINE, "star", 0);
var mode = checkMode(MACHINE, "star", 1);
var color = checkColor(MACHINE, "star", 2);
@ -934,7 +934,7 @@ EXPORTS['star'] =
jsnums.toFixnum(2),
mode.toString(),
color);
} else if (MACHINE.argcount === 5) {
} else if (MACHINE.a === 5) {
var n = checkSideCount(MACHINE, "star", 0);
var outer = checkNonNegativeReal(MACHINE, "star", 1);
var inner = checkNonNegativeReal(MACHINE, "star", 2);

View File

@ -87,7 +87,7 @@
[(eq? target 'val)
"M.val"]
[(eq? target 'argcount)
"M.argcount"]
"M.a"]
[(EnvLexicalReference? target)
(assemble-lexical-reference target)]
[(EnvPrefixReference? target)
@ -276,7 +276,14 @@
(: assemble-reg (Reg -> String))
(define (assemble-reg a-reg)
(string-append "M." (symbol->string (Reg-name a-reg))))
(let ([name (Reg-name a-reg)])
(cond
[(eq? name 'proc)
"M.proc"]
[(eq? name 'val)
"M.val"]
[(eq? name 'argcount)
"M.a"])))

View File

@ -118,7 +118,7 @@
var raiseContextExpectedValuesError = function(MACHINE, expected) {
var message = baselib.format.format("expected ~e values, received ~e values",
[expected, MACHINE.argcount]);
[expected, MACHINE.a]);
var contMarks = MACHINE.captureContinuationMarks();
raise(MACHINE, ExnFailContract.constructor(message, contMarks));
};

View File

@ -65,16 +65,16 @@
var returnArgs = [].slice.call(arguments, 1);
// clear out stack space
MACHINE.env.length -= MACHINE.argcount;
MACHINE.env.length -= MACHINE.a;
if (returnArgs.length === 1) {
MACHINE.val = returnArgs[0];
return MACHINE.control.pop().label(MACHINE);
} else if (returnArgs.length === 0) {
MACHINE.argcount = 0;
MACHINE.a = 0;
return MACHINE.control.pop().label.mvr(MACHINE);
} else {
MACHINE.argcount = returnArgs.length;
MACHINE.a = returnArgs.length;
MACHINE.val = returnArgs.shift();
MACHINE.env.push.apply(MACHINE.env, returnArgs.reverse());
return MACHINE.control.pop().label.mvr(MACHINE);
@ -106,15 +106,15 @@
succ = succ || function () {};
fail = fail || function () {};
var oldArgcount = MACHINE.argcount, i;
MACHINE.argcount = arguments.length - 2;
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]);
}
if (!(baselib.arity.isArityMatching(v.racketArity, MACHINE.argcount))) {
if (!(baselib.arity.isArityMatching(v.racketArity, MACHINE.a))) {
var msg = baselib.format.format("arity mismatch: ~s expected ~s arguments, but received ~s",
[v.displayName, v.racketArity, MACHINE.argcount]);
[v.displayName, v.racketArity, MACHINE.a]);
return fail(new baselib.exceptions.RacketError(
msg,
baselib.exceptions.makeExnFailContractArity(msg,
@ -122,7 +122,7 @@
}
var result = v(MACHINE);
MACHINE.argcount = oldArgcount;
MACHINE.a = oldArgcount;
for (i = 0; i < arguments.length - 2; i++) {
MACHINE.env.pop();
}
@ -149,7 +149,7 @@
}
var oldVal = MACHINE.val;
var oldArgcount = MACHINE.argcount;
var oldArgcount = MACHINE.a;
var oldProc = MACHINE.proc;
var oldErrorHandler = MACHINE.params['currentErrorHandler'];
@ -159,7 +159,7 @@
MACHINE.params['currentErrorHandler'] = oldErrorHandler;
var returnValue = MACHINE.val;
MACHINE.val = oldVal;
MACHINE.argcount = oldArgcount;
MACHINE.a = oldArgcount;
MACHINE.proc = oldProc;
succ(returnValue);
});
@ -169,11 +169,11 @@
function (restart) {
MACHINE.params['currentErrorHandler'] = oldErrorHandler;
var returnValues = [MACHINE.val], i;
for (i = 0; i < MACHINE.argcount - 1; i++) {
for (i = 0; i < MACHINE.a - 1; i++) {
returnValues.push(MACHINE.env.pop());
}
MACHINE.val = oldVal;
MACHINE.argcount = oldArgcount;
MACHINE.a = oldArgcount;
MACHINE.proc = oldProc;
succ.apply(null, returnValues);
});
@ -181,7 +181,7 @@
MACHINE.control.push(
new baselib.frames.CallFrame(afterGoodInvoke, v));
MACHINE.argcount = arguments.length - 2;
MACHINE.a = arguments.length - 2;
var i;
for (i = 0; i < arguments.length - 2; i++) {
MACHINE.env.push(arguments[arguments.length - 1 - i]);
@ -190,7 +190,7 @@
MACHINE.params['currentErrorHandler'] = function (MACHINE, e) {
MACHINE.params['currentErrorHandler'] = oldErrorHandler;
MACHINE.val = oldVal;
MACHINE.argcount = oldArgcount;
MACHINE.a = oldArgcount;
MACHINE.proc = oldProc;
fail(e);
};
@ -235,8 +235,8 @@
}
if (isPrimitiveProcedure(proc)) {
oldArgcount = MACHINE.argcount;
MACHINE.argcount = arguments.length - 4;
oldArgcount = MACHINE.a;
MACHINE.a = arguments.length - 4;
for (i = 0; i < arguments.length - 4; i++) {
MACHINE.env.push(arguments[arguments.length - 1 - i]);
}
@ -247,7 +247,7 @@
success(result);
} else if (isClosure(proc)) {
oldVal = MACHINE.val;
oldArgcount = MACHINE.argcount;
oldArgcount = MACHINE.a;
oldProc = MACHINE.proc;
oldErrorHandler = MACHINE.params['currentErrorHandler'];
@ -256,7 +256,7 @@
MACHINE.params['currentErrorHandler'] = oldErrorHandler;
var returnValue = MACHINE.val;
MACHINE.val = oldVal;
MACHINE.argcount = oldArgcount;
MACHINE.a = oldArgcount;
MACHINE.proc = oldProc;
success(returnValue);
});
@ -266,11 +266,11 @@
MACHINE.params['currentErrorHandler'] = oldErrorHandler;
var returnValues = [MACHINE.val];
var i;
for (i = 0; i < MACHINE.argcount - 1; i++) {
for (i = 0; i < MACHINE.a - 1; i++) {
returnValues.push(MACHINE.env.pop());
}
MACHINE.val = oldVal;
MACHINE.argcount = oldArgcount;
MACHINE.a = oldArgcount;
MACHINE.proc = oldProc;
success.apply(null, returnValues);
});
@ -278,7 +278,7 @@
MACHINE.control.push(
new baselib.frames.CallFrame(afterGoodInvoke, proc));
MACHINE.argcount = arguments.length - 4;
MACHINE.a = arguments.length - 4;
for (i = 0; i < arguments.length - 4; i++) {
MACHINE.env.push(arguments[arguments.length - 1 - i]);
}
@ -286,7 +286,7 @@
MACHINE.params['currentErrorHandler'] = function (MACHINE, e) {
MACHINE.params['currentErrorHandler'] = oldErrorHandler;
MACHINE.val = oldVal;
MACHINE.argcount = oldArgcount;
MACHINE.a = oldArgcount;
MACHINE.proc = oldProc;
fail(e);
};
@ -325,7 +325,7 @@
function(M) {
--M.cbt;
M.val = f(M);
M.env.length -= M.argcount;
M.env.length -= M.a;
return M.control.pop().label(M);
},
[]);

View File

@ -139,7 +139,7 @@
makeList(0, 1),
function(M) {
var baseName = "g";
if (M.argcount === 1) {
if (M.a === 1) {
baseName = checkSymbolOrString(M, 'gensym', 0).toString();
}
gensymCounter++;
@ -153,7 +153,7 @@
function (M) {
var firstArg = M.env[M.env.length - 1];
var outputPort = M.params.currentOutputPort;
if (M.argcount === 2) {
if (M.a === 2) {
outputPort = checkOutputPort(M, 'display', 1);
}
outputPort.writeDomNode(M, toDomNode(firstArg, 'display'));
@ -167,7 +167,7 @@
function (M) {
var firstArg = checkByte(M, 'write-byte', 0);
var outputPort = M.params.currentOutputPort;
if (M.argcount === 2) {
if (M.a === 2) {
outputPort = checkOutputPort(M, 'display', 1);
}
outputPort.writeDomNode(M, toDomNode(String.fromCharCode(firstArg), 'display'));
@ -179,7 +179,7 @@
'newline', makeList(0, 1),
function (M) {
var outputPort = M.params.currentOutputPort;
if (M.argcount === 1) {
if (M.a === 1) {
outputPort = checkOutputPort(M, 'newline', 1);
}
outputPort.writeDomNode(M, toDomNode("\n", 'display'));
@ -192,7 +192,7 @@
function (M){
var firstArg = M.env[M.env.length-1];
var outputPort = M.params.currentOutputPort;
if (M.argcount === 2) {
if (M.a === 2) {
outputPort = checkOutputPort(M, 'displayln', 1);
}
outputPort.writeDomNode(M, toDomNode(firstArg, 'display'));
@ -208,7 +208,7 @@
function (M) {
var args = [], i, formatString;
formatString = checkString(M, 'format', 0).toString();
for(i = 1; i < M.argcount; i++) {
for(i = 1; i < M.a; i++) {
args.push(M.env[M.env.length - 1 - i]);
}
return baselib.format.format(formatString, args, 'format');
@ -221,7 +221,7 @@
function (M) {
var args = [], i, formatString, result, outputPort;
formatString = checkString(M, 'printf', 0).toString();
for(i = 1; i < M.argcount; i++) {
for(i = 1; i < M.a; i++) {
args.push(M.env[M.env.length - 1 - i]);
}
result = baselib.format.format(formatString, args, 'format');
@ -238,7 +238,7 @@
var args = [], i, formatString, outputPort, result;
outputPort = checkOutputPort(M, 'fprintf', 0);
formatString = checkString(M, 'fprintf', 1).toString();
for(i = 2; i < M.argcount; i++) {
for(i = 2; i < M.a; i++) {
args.push(M.env[M.env.length - 1 - i]);
}
result = baselib.format.format(formatString, args, 'format');
@ -255,7 +255,7 @@
'current-print',
makeList(0, 1),
function (M) {
if (M.argcount === 1) {
if (M.a === 1) {
M.params['currentPrint'] =
checkProcedure(M, 'current-print', 0);
return VOID;
@ -269,7 +269,7 @@
'current-output-port',
makeList(0, 1),
function (M) {
if (M.argcount === 1) {
if (M.a === 1) {
M.params['currentOutputPort'] =
checkOutputPort(M, 'current-output-port', 0);
return VOID;
@ -284,7 +284,7 @@
'current-error-port',
makeList(0, 1),
function (M) {
if (M.argcount === 1) {
if (M.a === 1) {
M.params['currentErrorPort'] =
checkOutputPort(M, 'current-output-port', 0);
return VOID;
@ -305,7 +305,7 @@
function (M) {
var i;
var firstArg = checkNumber(M, '=', 0), secondArg;
for (i = 1; i < M.argcount; i++) {
for (i = 1; i < M.a; i++) {
secondArg = checkNumber(M, '=', i);
if (! (baselib.numbers.equals(firstArg, secondArg))) {
return false;
@ -333,7 +333,7 @@
var makeChainingBinop = function (predicate, name) {
return function (M) {
var firstArg = checkNumber(M, name, 0), secondArg, i;
for (i = 1; i < M.argcount; i++) {
for (i = 1; i < M.a; i++) {
secondArg = checkNumber(M, name, i);
if (! (predicate(firstArg, secondArg))) {
return false;
@ -374,7 +374,7 @@
function (M) {
var result = 0;
var i = 0;
for (i = 0; i < M.argcount; i++) {
for (i = 0; i < M.a; i++) {
result = baselib.numbers.add(
result,
checkNumber(M, '+', i));
@ -389,7 +389,7 @@
function (M) {
var result = 1;
var i = 0;
for (i=0; i < M.argcount; i++) {
for (i=0; i < M.a; i++) {
result = baselib.numbers.multiply(
result,
checkNumber(M, '*', i));
@ -401,13 +401,13 @@
'-',
baselib.arity.makeArityAtLeast(1),
function (M) {
if (M.argcount === 1) {
if (M.a === 1) {
return baselib.numbers.subtract(
0,
checkNumber(M, '-', 0));
}
var result = checkNumber(M, '-', 0), i;
for (i = 1; i < M.argcount; i++) {
for (i = 1; i < M.a; i++) {
result = baselib.numbers.subtract(
result,
checkNumber(M, '-', i));
@ -420,7 +420,7 @@
baselib.arity.makeArityAtLeast(1),
function (M) {
var result = checkNumber(M, '/', 0), i;
for (i = 1; i < M.argcount; i++) {
for (i = 1; i < M.a; i++) {
result = baselib.numbers.divide(
result,
checkNumber(M, '/', i));
@ -471,8 +471,8 @@
baselib.arity.makeArityAtLeast(0),
function (M) {
var result = NULL, i;
for (i = 0; i < M.argcount; i++) {
result = makePair(M.env[M.env.length - (M.argcount - i)],
for (i = 0; i < M.a; i++) {
result = makePair(M.env[M.env.length - (M.a - i)],
result);
}
return result;
@ -482,8 +482,8 @@
'list*',
baselib.arity.makeArityAtLeast(1),
function (M) {
var result = checkList(M, 'list*', M.argcount - 1), i;
for (i = M.argcount - 2; i >= 0; i--) {
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);
}
@ -583,7 +583,7 @@
function (M) {
var i;
var result = [];
for (i = 0; i < M.argcount; i++) {
for (i = 0; i < M.a; i++) {
result.push(M.env[M.env.length-1-i]);
}
var newVector = makeVector(result.length, result);
@ -598,7 +598,7 @@
var value = 0;
var length = baselib.numbers.toFixnum(
checkNatural(M, 'make-vector', 0));
if (M.argcount === 2) {
if (M.a === 2) {
value = M.env[M.env.length - 2];
}
var arr = [];
@ -679,7 +679,7 @@
var value = String.fromCharCode(0);
var length = baselib.numbers.toFixnum(
checkNatural(M, 'make-string', 0));
if (M.argcount === 2) {
if (M.a === 2) {
value = checkChar(M, 'make-string', 1).val;
}
var arr = [];
@ -697,7 +697,7 @@
var str = String(checkString(M, 'substring', 0));
var start = baselib.numbers.toFixnum(checkNatural(M, 'substring', 1));
var end = str.length;
if (M.argcount === 3) {
if (M.a === 3) {
end = baselib.numbers.toFixnum(checkNatural(M, 'substring', 2));
}
return str.substring(start, end);
@ -724,7 +724,7 @@
function (M) {
var i;
var chars = [];
for (i = 0; i < M.argcount; i++) {
for (i = 0; i < M.a; i++) {
chars.push(checkChar(M, 'string', i).val);
}
return chars.join('');
@ -784,7 +784,7 @@
function (M) {
var s = checkString(M, 'string=?', 0).toString();
var i;
for (i = 1; i < M.argcount; i++) {
for (i = 1; i < M.a; i++) {
if (s !== checkString(M, 'string=?', i).toString()) {
return false;
}
@ -799,7 +799,7 @@
function (M) {
var s = checkString(M, 'string<=?', 0).toString();
var i;
for (i = 1; i < M.argcount; i++) {
for (i = 1; i < M.a; i++) {
if ((s <= checkString(M, 'string<=?', i).toString()) === false) {
return false;
}
@ -813,7 +813,7 @@
function (M) {
var s = checkString(M, 'string<?', 0).toString();
var i;
for (i = 1; i < M.argcount; i++) {
for (i = 1; i < M.a; i++) {
if ((s < checkString(M, 'string<?', i).toString()) === false) {
return false;
}
@ -827,7 +827,7 @@
function (M) {
var s = checkString(M, 'string>=?', 0).toString();
var i;
for (i = 1; i < M.argcount; i++) {
for (i = 1; i < M.a; i++) {
if ((s >= checkString(M, 'string>=?', i).toString()) === false) {
return false;
}
@ -841,7 +841,7 @@
function (M) {
var s = checkString(M, 'string>?', 0).toString();
var i;
for (i = 1; i < M.argcount; i++) {
for (i = 1; i < M.a; i++) {
if ((s > checkString(M, 'string>?', i).toString()) === false) {
return false;
}
@ -872,7 +872,7 @@
function (M) {
var s = checkString(M, 'string-ci=?', 0).toString().toUpperCase();
var i;
for (i = 1; i < M.argcount; i++) {
for (i = 1; i < M.a; i++) {
if (s !== checkString(M, 'string-ci=?', i).toString().toUpperCase()) {
return false;
}
@ -887,7 +887,7 @@
function (M) {
var s = checkString(M, 'string-ci<=?', 0).toString().toUpperCase();
var i;
for (i = 1; i < M.argcount; i++) {
for (i = 1; i < M.a; i++) {
if ((s <= checkString(M, 'string-ci<=?', i).toString().toUpperCase()) === false) {
return false;
}
@ -901,7 +901,7 @@
function (M) {
var s = checkString(M, 'string-ci<?', 0).toString().toUpperCase();
var i;
for (i = 1; i < M.argcount; i++) {
for (i = 1; i < M.a; i++) {
if ((s < checkString(M, 'string-ci<?', i).toString().toUpperCase()) === false) {
return false;
}
@ -915,7 +915,7 @@
function (M) {
var s = checkString(M, 'string-ci>=?', 0).toString().toUpperCase();
var i;
for (i = 1; i < M.argcount; i++) {
for (i = 1; i < M.a; i++) {
if ((s >= checkString(M, 'string-ci>=?', i).toString().toUpperCase()) === false) {
return false;
}
@ -929,7 +929,7 @@
function (M) {
var s = checkString(M, 'string-ci>?', 0).toString().toUpperCase();
var i;
for (i = 1; i < M.argcount; i++) {
for (i = 1; i < M.a; i++) {
if ((s > checkString(M, 'string-ci>?', i).toString().toUpperCase()) === false) {
return false;
}
@ -947,7 +947,7 @@
function (M) {
var buffer = [];
var i;
for (i = 0; i < M.argcount; i++) {
for (i = 0; i < M.a; i++) {
buffer.push(checkString(M, 'string-append', i).toString());
}
return buffer.join('');
@ -1031,7 +1031,7 @@
function(M) {
var s = checkChar(M, 'char=?', 0).val;
var i;
for (i = 1; i < M.argcount; i++) {
for (i = 1; i < M.a; i++) {
if (checkChar(M, 'char=?', i).val !== s) {
return false;
}
@ -1098,7 +1098,7 @@
'random',
baselib.lists.makeList(0, 1),
function (M) {
if (M.argcount === 0) {
if (M.a === 0) {
return makeFloat(Math.random());
} else {
var n = checkNatural(M, 'random', 0);
@ -1146,10 +1146,10 @@
}
var proc = checkProcedure(M, 'apply', 0);
M.env.pop();
M.argcount--;
checkList(M, 'apply', M.argcount - 1);
M.spliceListIntoStack(M.argcount - 1);
if (baselib.arity.isArityMatching(proc.racketArity, M.argcount)) {
M.a--;
checkList(M, 'apply', M.a - 1);
M.spliceListIntoStack(M.a - 1);
if (baselib.arity.isArityMatching(proc.racketArity, M.a)) {
M.proc = proc;
if (baselib.functions.isPrimitiveProcedure(proc)) {
return finalizeClosureCall(M, proc(M));
@ -1157,7 +1157,7 @@
return proc.label(M);
}
} else {
raiseArityMismatchError(M, proc, M.argcount);
raiseArityMismatchError(M, proc, M.a);
}
};
installPrimitiveClosure(
@ -1186,8 +1186,8 @@
2,
function (M) {
var proc = checkProcedure(M, 'procedure-arity-includes?', 0);
var argcount = checkNatural(M, 'procedure-arity-includes?', 1);
return baselib.arity.isArityMatching(proc.racketArity, argcount);
var a = checkNatural(M, 'procedure-arity-includes?', 1);
return baselib.arity.isArityMatching(proc.racketArity, a);
});
installPrimitiveProcedure(
@ -1376,7 +1376,7 @@
'atan',
makeList(1, 2),
function (M) {
if (M.argcount === 1) {
if (M.a === 1) {
return baselib.numbers.atan(
checkNumber(M, 'atan', 0));
} else {
@ -1437,7 +1437,7 @@
baselib.arity.makeArityAtLeast(1),
function (M) {
var args = [], i, x;
for (i = 0; i < M.argcount; i++) {
for (i = 0; i < M.a; i++) {
args.push(checkNumber(M, 'gcd', i));
}
x = args.shift();
@ -1449,7 +1449,7 @@
baselib.arity.makeArityAtLeast(1),
function (M) {
var args = [], i, x;
for (i = 0; i < M.argcount; i++) {
for (i = 0; i < M.a; i++) {
args.push(checkNumber(M, 'lcm', i));
}
x = args.shift();
@ -1685,7 +1685,7 @@
var i;
var next;
var currentMin = checkReal(M, 'min', 0);
for (i = 1; i < M.argcount; i++) {
for (i = 1; i < M.a; i++) {
next = checkReal(M, 'min', i);
if (baselib.numbers.lessThan(next, currentMin)) {
currentMin = next;
@ -1701,7 +1701,7 @@
var i;
var next;
var currentMax = checkReal(M, 'min', 0);
for (i = 1; i < M.argcount; i++) {
for (i = 1; i < M.a; i++) {
next = checkReal(M, 'min', i);
if (baselib.numbers.greaterThan(next, currentMax)) {
currentMax = next;
@ -1720,7 +1720,7 @@
baselib.arity.makeArityAtLeast(1),
function (M) {
var i;
if (M.argcount === 1) {
if (M.a === 1) {
var sym = checkSymbol(M, 'error', 1);
raise(M, baselib.exceptions.makeExnFail(String(sym),
M.captureContinuationMarks()));
@ -1728,7 +1728,7 @@
if (isString(M.env[M.env.length - 1])) {
var vs = [];
for (i = 1; i < M.argcount; i++) {
for (i = 1; i < M.a; i++) {
vs.push(baselib.format.format("~e", [M.env[M.env.length - 1 - i]]));
}
raise(M, baselib.exceptions.makeExnFail(String(M.env[M.env.length - 1]) +
@ -1740,7 +1740,7 @@
if (isSymbol(M.env[M.env.length - 1])) {
var fmtString = checkString(M, 'error', 1);
var args = [M.env[M.env.length - 1]];
for (i = 2; i < M.argcount; i++) {
for (i = 2; i < M.a; i++) {
args.push(M.env[M.env.length - 1 - i]);
}
raise(M, baselib.exceptions.makeExnFail(
@ -1776,7 +1776,7 @@
function (M) {
var name = checkSymbol(M, 'raise-type-error', 0);
var expected = checkString(M, 'raise-type-error', 1);
if (M.argcount === 3) {
if (M.a === 3) {
raiseArgumentTypeError(M,
name,
expected,
@ -1894,7 +1894,7 @@
'current-inspector',
makeList(0, 1),
function (M) {
if (M.argcount === 1) {
if (M.a === 1) {
M.params['currentInspector'] =
checkInspector(M, 'current-inspector', 0);
return VOID;
@ -1912,7 +1912,7 @@
var structType = M.env[M.env.length - 1].structType;
var index = M.env[M.env.length - 2];
var name;
if (M.argcount === 3) {
if (M.a === 3) {
name = String(M.env[M.env.length - 3]);
} else {
name = 'field' + index;
@ -1939,7 +1939,7 @@
var structType = M.env[M.env.length - 1].structType;
var index = M.env[M.env.length - 2];
var name;
if (M.argcount === 3) {
if (M.a === 3) {
name = String(M.env[M.env.length - 3]);
} else {
name = 'field' + index;

View File

@ -46,16 +46,16 @@ if (!(this.plt)) { this.plt = {}; }
// Helper to deal with the argument-passing of primitives. Call f
// with arguments bound from MACHINE.env, assuming
// MACHINE.argcount 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 that go beyond those of the mandatoryArgCount.
var withArguments = function (MACHINE, mandatoryArgCount, vs, f) {
var args = [], i;
for (i = 0; i < MACHINE.argcount; i++) {
for (i = 0; i < MACHINE.a; i++) {
if (i < mandatoryArgCount) {
args.push(MACHINE.env[MACHINE.env.length - 1 - i]);
} else {
if (i < MACHINE.argcount) {
if (i < MACHINE.a) {
args.push(MACHINE.env[MACHINE.env.length - 1 - i]);
} else {
args.push(vs[mandatoryArgCount - i]);

View File

@ -189,7 +189,7 @@
if(--MACHINE.cbt < 0) {
throw defaultCurrentPrintImplementation;
}
var oldArgcount = MACHINE.argcount;
var oldArgcount = MACHINE.a;
var elt = MACHINE.env[MACHINE.env.length - 1];
var outputPort =
@ -198,7 +198,7 @@
outputPort.writeDomNode(MACHINE, toDomNode(elt, 'print'));
outputPort.writeDomNode(MACHINE, toDomNode("\n", 'display'));
}
MACHINE.argcount = oldArgcount;
MACHINE.a = oldArgcount;
return finalizeClosureCall(MACHINE, VOID);
};
var defaultCurrentPrint = makeClosure(
@ -214,7 +214,7 @@
this.cbt = STACK_LIMIT_ESTIMATE; // calls before trampoline
this.val = undefined; // value register
this.proc = undefined; // procedure register
this.argcount = undefined; // argument count
this.a = undefined; // argument count
this.env = []; // environment
this.control = []; // control: Arrayof (U Frame CallFrame PromptFrame)
this.running = false;
@ -324,7 +324,7 @@
};
// Splices the list argument in the environment. Adjusts MACHINE.argcount
// Splices the list argument in the environment. Adjusts MACHINE.a
// appropriately.
Machine.prototype.spliceListIntoStack = function(depth) {
var MACHINE = this;
@ -337,7 +337,7 @@
vals.reverse();
MACHINE.env.splice.apply(MACHINE.env,
[MACHINE.env.length - 1 - depth, 1].concat(vals));
MACHINE.argcount = MACHINE.argcount + vals.length - 1;
MACHINE.a = MACHINE.a + vals.length - 1;
};
@ -353,7 +353,7 @@
MACHINE.env.splice(MACHINE.env.length - depth - length,
length,
lst);
MACHINE.argcount = MACHINE.argcount - length + 1;
MACHINE.a = MACHINE.a - length + 1;
};

View File

@ -31,7 +31,7 @@ EXPORTS['call-method'] =
var obj = MACHINE.env[MACHINE.env.length - 1];
var methodName = MACHINE.env[MACHINE.env.length - 2];
var args = [];
for (var i = 0; i < MACHINE.argcount - 2; i++) {
for (var i = 0; i < MACHINE.a - 2; i++) {
args.push(MACHINE.env[MACHINE.env.length -1 - 2 - i]);
}
var result = obj[methodName].apply(obj, args);

View File

@ -71,7 +71,7 @@ EXPORTS['specialize!'] = makeClosure(
1,
function(MACHINE) {
var resource = checkResource(MACHINE, 'specialize!', 0);
var oldArgcount = MACHINE.argcount;
var oldArgcount = MACHINE.a;
if (isImagePath(getResourceKey(resource).toString())) {
return PAUSE(
function(restart) {
@ -81,7 +81,7 @@ EXPORTS['specialize!'] = makeClosure(
delete(rawImage.onerror);
injectImageMethods(resource, rawImage);
restart(function(MACHINE) {
MACHINE.argcount = oldArgcount;
MACHINE.a = oldArgcount;
return finalizeClosureCall(MACHINE, resource);
});
};
@ -91,7 +91,7 @@ EXPORTS['specialize!'] = makeClosure(
// on any kind of image-loading error, fail out and
// just return the resource unchanged.
restart(function(MACHINE) {
MACHINE.argcount = oldArgcount;
MACHINE.a = oldArgcount;
return finalizeClosureCall(MACHINE, resource);
});
}

View File

@ -1076,7 +1076,7 @@
// bigBang.
var bigBang = function(MACHINE, world, handlers) {
var oldArgcount = MACHINE.argcount;
var oldArgcount = MACHINE.a;
var oldCurrentBigBangRecord = currentBigBangRecord;
var running = true;
@ -1110,7 +1110,7 @@
running = false;
stopEventHandlers();
restart(function(MACHINE) {
MACHINE.argcount = oldArgcount;
MACHINE.a = oldArgcount;
MACHINE.params.currentOutputPort = oldOutputPort;
currentBigBangRecord = oldCurrentBigBangRecord;
finalizeClosureCall(MACHINE, world);
@ -1524,7 +1524,7 @@
var world = MACHINE.env[MACHINE.env.length - 1];
var handlers = [];
var i;
for (i = 1; i < MACHINE.argcount; i++) {
for (i = 1; i < MACHINE.a; i++) {
handlers.push(checkWorldHandler(MACHINE, 'big-bang', i));
}
return bigBang(MACHINE, world, handlers);
@ -1536,12 +1536,12 @@
1,
function(MACHINE) {
var viewable = MACHINE.env[MACHINE.env.length - 1];
var oldArgcount = MACHINE.argcount;
var oldArgcount = MACHINE.a;
PAUSE(function(restart) {
coerseToView(viewable,
function(v) {
restart(function(MACHINE) {
MACHINE.argcount = oldArgcount;
MACHINE.a = oldArgcount;
finalizeClosureCall(MACHINE,
new InitialViewHandler(v));
});
@ -1564,12 +1564,12 @@
1,
function(MACHINE) {
var viewable = MACHINE.env[MACHINE.env.length - 1];
var oldArgcount = MACHINE.argcount;
var oldArgcount = MACHINE.a;
PAUSE(function(restart) {
coerseToMockView(viewable,
function(v) {
restart(function(MACHINE) {
MACHINE.argcount = oldArgcount;
MACHINE.a = oldArgcount;
finalizeClosureCall(MACHINE, v);
});
},
@ -1615,7 +1615,7 @@
function(MACHINE) {
var onTick = wrapFunction(checkProcedure(MACHINE, 'on-tick', 0));
var delay = Math.floor(1000/28);
if (MACHINE.argcount === 2) {
if (MACHINE.a === 2) {
delay = Math.floor(plt.baselib.numbers.toFixnum(checkReal(MACHINE, 'on-tick', 1)) * 1000);
}
return new EventHandler('on-tick',
@ -1890,13 +1890,13 @@
2,
function(MACHINE) {
var view = checkMockView(MACHINE, 'view-append-child', 0);
var oldArgcount = MACHINE.argcount;
var oldArgcount = MACHINE.a;
var x = MACHINE.env[MACHINE.env.length - 2];
PAUSE(function(restart) {
coerseToDomNode(x,
function(dom) {
restart(function(MACHINE) {
MACHINE.argcount = oldArgcount;
MACHINE.a = oldArgcount;
var updatedView = view.appendChild(dom);
finalizeClosureCall(MACHINE, updatedView);
});
@ -1920,13 +1920,13 @@
2,
function(MACHINE) {
var view = checkMockView(MACHINE, 'view-insert-right', 0);
var oldArgcount = MACHINE.argcount;
var oldArgcount = MACHINE.a;
var x = MACHINE.env[MACHINE.env.length - 2];
PAUSE(function(restart) {
coerseToDomNode(x,
function(dom) {
restart(function(MACHINE) {
MACHINE.argcount = oldArgcount;
MACHINE.a = oldArgcount;
var updatedView = view.insertRight(dom);
finalizeClosureCall(MACHINE, updatedView);
});
@ -1952,13 +1952,13 @@
2,
function(MACHINE) {
var view = checkMockView(MACHINE, 'view-insert-left', 0);
var oldArgcount = MACHINE.argcount;
var oldArgcount = MACHINE.a;
var x = MACHINE.env[MACHINE.env.length - 2];
PAUSE(function(restart) {
coerseToDomNode(x,
function(dom) {
restart(function(MACHINE) {
MACHINE.argcount = oldArgcount;
MACHINE.a = oldArgcount;
var updatedView = view.insertLeft(dom);
finalizeClosureCall(MACHINE, updatedView);
});

View File

@ -41,7 +41,7 @@ EXPORTS['big-bang'] =
function(MACHINE) {
var initialWorldValue = MACHINE.env[MACHINE.env.length - 1];
var handlers = [];
for (var i = 1; i < MACHINE.argcount; i++) {
for (var i = 1; i < MACHINE.a; i++) {
handlers.push(checkHandler(MACHINE, 'big-bang', i));
}
bigBang(MACHINE, initialWorldValue, handlers);
@ -54,10 +54,10 @@ EXPORTS['on-tick'] =
'on-tick',
plt.baselib.lists.makeList(1, 2),
function(MACHINE) {
if (MACHINE.argcount === 1) {
if (MACHINE.a === 1) {
var f = checkProcedure1(MACHINE, "on-tick", 0);
return new OnTick(f, Math.floor(DEFAULT_TICK_DELAY * 1000));
} else if (MACHINE.argcount === 2) {
} else if (MACHINE.a === 2) {
var f = checkProcedure1(MACHINE, "on-tick", 0);
var delay = checkNonNegativeReal(MACHINE, "on-tick", 1);
return new OnTick(f, Math.floor(jsnums.toFixnum(delay) * 1000));

View File

@ -25,7 +25,7 @@ var finalizeClosureCall = plt.baselib.functions.finalizeClosureCall;
var bigBang = function(MACHINE, initW, handlers) {
var oldArgcount = MACHINE.argcount;
var oldArgcount = MACHINE.a;
var outerToplevelNode = $('<span/>').css('padding', '0px').get(0);
MACHINE.params.currentOutputPort.writeDomNode(MACHINE, outerToplevelNode);
@ -67,7 +67,7 @@ var bigBang = function(MACHINE, initW, handlers) {
restart(function(MACHINE) {
MACHINE.argcount = oldArgcount;
MACHINE.a = oldArgcount;
finalizeClosureCall(
MACHINE,
finalWorldValue);