From b597932d4c96e26f4d7eb8dde12412f1019e49bf Mon Sep 17 00:00:00 2001 From: Danny Yoo Date: Sun, 3 Jul 2011 19:12:37 -0400 Subject: [PATCH] continuing to move and disable --- js-assembler/get-runtime.rkt | 6 +- js-assembler/runtime-src/baselib_arity.js | 40 +++ .../runtime-src/baselib_exceptions.js | 133 +++++++ js-assembler/runtime-src/baselib_structs.js | 19 +- js-assembler/runtime-src/runtime.js | 76 ++-- js-assembler/runtime-src/types.js | 335 ++++++++---------- 6 files changed, 365 insertions(+), 244 deletions(-) create mode 100644 js-assembler/runtime-src/baselib_arity.js create mode 100644 js-assembler/runtime-src/baselib_exceptions.js diff --git a/js-assembler/get-runtime.rkt b/js-assembler/get-runtime.rkt index 591388c..3811477 100644 --- a/js-assembler/get-runtime.rkt +++ b/js-assembler/get-runtime.rkt @@ -38,6 +38,7 @@ (define-runtime-path baselib_unionfind.js "runtime-src/baselib_unionfind.js") (define-runtime-path baselib_hash.js "runtime-src/baselib_hash.js") (define-runtime-path baselib_structs.js "runtime-src/baselib_structs.js") +(define-runtime-path baselib_arity.js "runtime-src/baselib_arity.js") (define-runtime-path jshashtable.js "runtime-src/jshashtable-2.1_src.js") @@ -61,16 +62,15 @@ (define files (list jquery-protect-header.js jquery.js jquery-protect-footer.js - jshashtable.js jsnums.js - - + baselib.js baselib_unionfind.js baselib_hash.js baselib_structs.js + baselib_arity.js link.js diff --git a/js-assembler/runtime-src/baselib_arity.js b/js-assembler/runtime-src/baselib_arity.js new file mode 100644 index 0000000..7771855 --- /dev/null +++ b/js-assembler/runtime-src/baselib_arity.js @@ -0,0 +1,40 @@ +// Arity structure +(function(baselib) { + var exports = {}; + baselib.arity = exports; + + + // An arity is either a primitive number, an ArityAtLeast instance, + // or a list of either primitive numbers or ArityAtLeast instances. + + var ArityAtLeast = function(n) { + this.value = n; + }; + + // isArityMatching: arity natural -> boolean + // Produces true if n satisfies the arity. + var isArityMatching = function(arity, n) { + if (typeof(arity) === 'number') { + return arity === n; + } else if (arity instanceof ArityAtLeast) { + return n >= arity.value; + } else { + while (arity !== plt.types.EMPTY) { + if (typeof(arity.first) === 'number') { + if (arity.first === n) { return true; } + } else if (arity instanceof ArityAtLeast) { + if (n >= arity.first.value) { return true; } + } + arity = arity.rest; + } + return false; + } + } + + + + exports.ArityAtLeast = ArityAtLeast; + exports.isArityMatching = isArityMatching; + + +})(this['plt'].baselib); \ No newline at end of file diff --git a/js-assembler/runtime-src/baselib_exceptions.js b/js-assembler/runtime-src/baselib_exceptions.js new file mode 100644 index 0000000..8dcef5e --- /dev/null +++ b/js-assembler/runtime-src/baselib_exceptions.js @@ -0,0 +1,133 @@ +// Exceptions + +(function(baselib) { + var exceptions = {}; + baselib.exceptions = exceptions; + + + + // Error type exports + var InternalError = function(val, contMarks) { + this.val = val; + this.contMarks = (contMarks ? contMarks : false); + } + + + var SchemeError = function(val) { + this.val = val; + } + + + var IncompleteExn = function(constructor, msg, otherArgs) { + this.constructor = constructor; + this.msg = msg; + this.otherArgs = otherArgs; + }; + + + var Exn = plt.baselib.structs.makeStructureType( + 'exn', + false, + 2, + 0, + false, + function(args, name, k) { +// helpers.check(args[0], isString, name, 'string', 1); +// helpers.check(args[1], types.isContinuationMarkSet, +// name, 'continuation mark set', 2); + return k(args); + }); + + // (define-struct (exn:break exn) (continuation)) + var ExnBreak = plt.baselib.structs.makeStructureType( + 'exn:break', Exn, 1, 0, false, + function(args, name, k) { +// helpers.check(args[2], function(x) { return x instanceof ContinuationClosureValue; }, +// name, 'continuation', 3); + return k(args); + }); + + var ExnFail = + plt.baselib.structs.makeStructureType('exn:fail', + Exn, 0, 0, false, false); + + var ExnFailContract = + plt.baselib.structs.makeStructureType('exn:fail:contract', + ExnFail, 0, 0, false, false); + + var ExnFailContractArity = + plt.baselib.structs.makeStructureType('exn:fail:contract:arity', + ExnFailContract, 0, 0, false, false); + + var ExnFailContractVariable = + plt.baselib.structs.makeStructureType('exn:fail:contract:variable', + ExnFailContract, 1, 0, false, false); + + var ExnFailContractDivisionByZero = + plt.baselib.structs.makeStructureType('exn:fail:contract:divide-by-zero', + ExnFailContract, 0, 0, false, false); + + + + + + + ////////////////////////////////////////////////////////////////////// + + // Exports + + exceptions.InternalError = InternalError; + exceptions.internalError = function(v, contMarks) { return new InternalError(v, contMarks); }; + exceptions.isInternalError = function(x) { return x instanceof InternalError; }; + + + exceptions.SchemeError = SchemeError; + exceptions.schemeError = function(v) { return new SchemeError(v); }; + exceptions.isSchemeError = function(v) { return v instanceof SchemeError; }; + + + exceptions.IncompleteExn = IncompleteExn; + exceptions.incompleteExn = function(constructor, msg, args) { return new IncompleteExn(constructor, msg, args); }; + exceptions.isIncompleteExn = function(x) { return x instanceof IncompleteExn; }; + + + exceptions.Exn = Exn; + exceptions.exn = Exn.constructor; + exceptions.isExn = Exn.predicate; + exceptions.exnMessage = function(exn) { return Exn.accessor(exn, 0); }; + exceptions.exnContMarks = function(exn) { return Exn.accessor(exn, 1); }; + exceptions.exnSetContMarks = function(exn, v) { Exn.mutator(exn, 1, v); }; + + exceptions.ExnBreak = ExnBreak; + exceptions.exnBreak = ExnBreak.constructor; + exceptions.isExnBreak = ExnBreak.predicate; + exceptions.exnBreakContinuation = + function(exn) { return ExnBreak.accessor(exn, 0); }; + + exceptions.ExnFail = ExnFail; + exceptions.exnFail = ExnFail.constructor; + exceptions.isExnFail = ExnFail.predicate; + + exceptions.ExnFailContract = ExnFailContract; + exceptions.exnFailContract = ExnFailContract.constructor; + exceptions.isExnFailContract = ExnFailContract.predicate; + + exceptions.ExnFailContractArity = ExnFailContractArity; + exceptions.exnFailContractArity = ExnFailContractArity.constructor; + exceptions.isExnFailContractArity = ExnFailContractArity.predicate; + + exceptions.ExnFailContractVariable = ExnFailContractVariable; + exceptions.exnFailContractVariable = ExnFailContractVariable.constructor; + exceptions.isExnFailContractVariable = ExnFailContractVariable.predicate; + exceptions.exnFailContractVariableId = + function(exn) { return ExnFailContractVariable.accessor(exn, 0); }; + + + exceptions.ExnFailContractDivisionByZero = ExnFailContractDivisionByZero; + exceptions.exnFailContractDivisionByZero = ExnFailContractDivisionByZero.constructor; + exceptions.isExnFailContractDivisionByZero = ExnFailContractDivisionByZero.predicate; + + + + +})(this['plt'].baselib); \ No newline at end of file diff --git a/js-assembler/runtime-src/baselib_structs.js b/js-assembler/runtime-src/baselib_structs.js index 6087877..9ab7011 100644 --- a/js-assembler/runtime-src/baselib_structs.js +++ b/js-assembler/runtime-src/baselib_structs.js @@ -9,8 +9,16 @@ - var StructType = function(name, type, numberOfArgs, numberOfFields, firstField, - applyGuard, constructor, predicate, accessor, mutator) { + var StructType = function(name, // string + type, // StructType + numberOfArgs, // number + numberOfFields, // number + firstField, + applyGuard, + constructor, + predicate, + accessor, + mutator) { this.name = name; this.type = type; this.numberOfArgs = numberOfArgs; @@ -38,10 +46,17 @@ + // guard-function: array string (array -> value) + + + // makeStructureType: string StructType number number boolean + // guard-function -> StructType + // // Creates a new structure type. + var makeStructureType = function(theName, parentType, initFieldCnt, diff --git a/js-assembler/runtime-src/runtime.js b/js-assembler/runtime-src/runtime.js index 952e08d..71aacf6 100644 --- a/js-assembler/runtime-src/runtime.js +++ b/js-assembler/runtime-src/runtime.js @@ -96,7 +96,7 @@ if(this['plt'] === undefined) { this['plt'] = {}; } 'currentErrorHandler': function(MACHINE, exn) { MACHINE.params.currentErrorDisplayer( MACHINE, - exn); + toDomNode(exn)); }, 'currentNamespace': {}, @@ -542,33 +542,6 @@ if(this['plt'] === undefined) { this['plt'] = {}; } - // An arity is either a primitive number, an ArityAtLeast instance, - // or a list of either primitive numbers or ArityAtLeast instances. - - var ArityAtLeast = function(n) { - this.value = n; - }; - - // isArityMatching: arity natural -> boolean - // Produces true if n satisfies the arity. - var isArityMatching = function(arity, n) { - if (typeof(arity) === 'number') { - return arity === n; - } else if (arity instanceof ArityAtLeast) { - return n >= arity.value; - } else { - while (arity !== NULL) { - if (typeof(arity.first) === 'number') { - if (arity.first === n) { return true; } - } else if (arity instanceof ArityAtLeast) { - if (n >= arity.first.value) { return true; } - } - arity = arity.rest; - } - return false; - } - } - @@ -696,7 +669,7 @@ if(this['plt'] === undefined) { this['plt'] = {}; } installPrimitiveProcedure( 'format', - new ArityAtLeast(1), + new plt.baselib.arity.ArityAtLeast(1), function(MACHINE) { var args = [], i, formatString; testArgument(MACHINE, @@ -716,7 +689,7 @@ if(this['plt'] === undefined) { this['plt'] = {}; } installPrimitiveProcedure( 'printf', - new ArityAtLeast(1), + new plt.baselib.arity.ArityAtLeast(1), function(MACHINE) { var args = [], i, formatString; testArgument(MACHINE, @@ -738,7 +711,7 @@ if(this['plt'] === undefined) { this['plt'] = {}; } installPrimitiveProcedure( 'fprintf', - new ArityAtLeast(2), + new plt.baselib.arity.ArityAtLeast(2), function(MACHINE) { var args = [], i, formatString; testArgument(MACHINE, @@ -799,7 +772,7 @@ if(this['plt'] === undefined) { this['plt'] = {}; } installPrimitiveProcedure( '=', - new ArityAtLeast(2), + new plt.baselib.arity.ArityAtLeast(2), function(MACHINE) { var firstArg = MACHINE.env[MACHINE.env.length-1]; testArgument(MACHINE, 'number', isNumber, firstArg, 0, '='); @@ -853,7 +826,7 @@ if(this['plt'] === undefined) { this['plt'] = {}; } installPrimitiveProcedure( '<', - new ArityAtLeast(2), + new plt.baselib.arity.ArityAtLeast(2), function(MACHINE) { var firstArg = MACHINE.env[MACHINE.env.length-1]; testArgument(MACHINE, @@ -876,7 +849,7 @@ if(this['plt'] === undefined) { this['plt'] = {}; } installPrimitiveProcedure( '>', - new ArityAtLeast(2), + new plt.baselib.arity.ArityAtLeast(2), function(MACHINE) { var firstArg = MACHINE.env[MACHINE.env.length-1]; testArgument(MACHINE, @@ -898,7 +871,7 @@ if(this['plt'] === undefined) { this['plt'] = {}; } installPrimitiveProcedure( '<=', - new ArityAtLeast(2), + new plt.baselib.arity.ArityAtLeast(2), function(MACHINE) { var firstArg = MACHINE.env[MACHINE.env.length-1]; testArgument(MACHINE, @@ -921,7 +894,7 @@ if(this['plt'] === undefined) { this['plt'] = {}; } installPrimitiveProcedure( '>=', - new ArityAtLeast(2), + new plt.baselib.arity.ArityAtLeast(2), function(MACHINE) { var firstArg = MACHINE.env[MACHINE.env.length-1]; testArgument(MACHINE, @@ -944,7 +917,7 @@ if(this['plt'] === undefined) { this['plt'] = {}; } installPrimitiveProcedure( '+', - new ArityAtLeast(0), + new plt.baselib.arity.ArityAtLeast(0), function(MACHINE) { var result = 0; var i = 0; @@ -963,7 +936,7 @@ if(this['plt'] === undefined) { this['plt'] = {}; } installPrimitiveProcedure( '*', - new ArityAtLeast(0), + new plt.baselib.arity.ArityAtLeast(0), function(MACHINE) { var result = 1; var i = 0; @@ -981,7 +954,7 @@ if(this['plt'] === undefined) { this['plt'] = {}; } installPrimitiveProcedure( '-', - new ArityAtLeast(1), + new plt.baselib.arity.ArityAtLeast(1), function(MACHINE) { if (MACHINE.argcount === 1) { testArgument(MACHINE, @@ -1007,7 +980,7 @@ if(this['plt'] === undefined) { this['plt'] = {}; } installPrimitiveProcedure( '/', - new ArityAtLeast(1), + new plt.baselib.arity.ArityAtLeast(1), function(MACHINE) { testArgument(MACHINE, 'number', @@ -1080,7 +1053,7 @@ if(this['plt'] === undefined) { this['plt'] = {}; } installPrimitiveProcedure( 'list', - new ArityAtLeast(0), + new plt.baselib.arity.ArityAtLeast(0), function(MACHINE) { var result = NULL; for (var i = 0; i < MACHINE.argcount; i++) { @@ -1180,7 +1153,7 @@ if(this['plt'] === undefined) { this['plt'] = {}; } installPrimitiveProcedure( 'vector', - new ArityAtLeast(0), + new plt.baselib.arity.ArityAtLeast(0), function(MACHINE) { var i; var result = []; @@ -1322,7 +1295,7 @@ if(this['plt'] === undefined) { this['plt'] = {}; } installPrimitiveProcedure( 'string-append', - new ArityAtLeast(0), + new plt.baselib.arity.ArityAtLeast(0), function(MACHINE) { var buffer = []; var i; @@ -1369,7 +1342,7 @@ if(this['plt'] === undefined) { this['plt'] = {}; } installPrimitiveProcedure( 'void', - new ArityAtLeast(0), + new plt.baselib.arity.ArityAtLeast(0), function(MACHINE) { return VOID; }); @@ -1624,7 +1597,7 @@ if(this['plt'] === undefined) { this['plt'] = {}; } installPrimitiveProcedure( 'gcd', - new ArityAtLeast(1), + new plt.baselib.arity.ArityAtLeast(1), function(MACHINE) { var args = [], i, x; for (i = 0; i < MACHINE.argcount; i++) { @@ -1643,7 +1616,7 @@ if(this['plt'] === undefined) { this['plt'] = {}; } installPrimitiveProcedure( 'lcm', - new ArityAtLeast(1), + new plt.baselib.arity.ArityAtLeast(1), function(MACHINE) { var args = [], i, x; for (i = 0; i < MACHINE.argcount; i++) { @@ -2060,7 +2033,7 @@ if(this['plt'] === undefined) { this['plt'] = {}; } installPrimitiveProcedure( 'format', - new ArityAtLeast(1), + new plt.baselib.arity.ArityAtLeast(1), function(MACHINE) { var args = [], i, formatString; testArgument(MACHINE, @@ -2104,8 +2077,9 @@ if(this['plt'] === undefined) { this['plt'] = {}; } inspector, // FIXME: currently ignored procSpec, // FIXME: currently ignored immutables, // FIXME: currently ignored - guard, - constructorName) { + guard, // FIXME: currently ignored + constructorName // FIXME, currently ignored + ) { // FIXME: we need to return those five values back. finalizeClosureCall(MACHINE, @@ -2542,8 +2516,8 @@ if(this['plt'] === undefined) { this['plt'] = {}; } exports['toWrittenString'] = toWrittenString; exports['toDisplayedString'] = toDisplayedString; - exports['ArityAtLeast'] = ArityAtLeast; - exports['isArityMatching'] = isArityMatching; + exports['ArityAtLeast'] = plt.baselib.arity.ArityAtLeast; + exports['isArityMatching'] = plt.baselib.arity.isArityMatching; exports['heir'] = heir; exports['makeClassPredicate'] = makeClassPredicate; diff --git a/js-assembler/runtime-src/types.js b/js-assembler/runtime-src/types.js index 10a5fd5..2a072ed 100644 --- a/js-assembler/runtime-src/types.js +++ b/js-assembler/runtime-src/types.js @@ -963,134 +963,134 @@ String.prototype.toDisplayedString = function(cache) { ////////////////////////////////////////////////////////////////////// - var JsValue = function(name, val) { - this.name = name; - this.val = val; - }; +// var JsValue = function(name, val) { +// this.name = name; +// this.val = val; +// }; - JsValue.prototype.toString = function() { - return '#'; - }; +// JsValue.prototype.toString = function() { +// return '#'; +// }; - JsValue.prototype.toDomNode = function(cache) { - return toDomNode(this.val, cache); - }; +// JsValue.prototype.toDomNode = function(cache) { +// return toDomNode(this.val, cache); +// }; - JsValue.prototype.equals = function(other, aUnionFind) { - return (this.val === other.val); - }; +// JsValue.prototype.equals = function(other, aUnionFind) { +// return (this.val === other.val); +// }; - // unbox: jsvalue -> any - // Unwraps the value out of the JsValue box. - JsValue.prototype.unbox = function() { - return this.val; - }; +// // unbox: jsvalue -> any +// // Unwraps the value out of the JsValue box. +// JsValue.prototype.unbox = function() { +// return this.val; +// }; - var WrappedSchemeValue = function(val) { - this.val = val; - }; +// var WrappedSchemeValue = function(val) { +// this.val = val; +// }; - WrappedSchemeValue.prototype.toString = function() { return toString(this.val); }; - WrappedSchemeValue.prototype.toWrittenString = function(cache) { return toWrittenString(this.val, cache); }; - WrappedSchemeValue.prototype.toDisplayedString = function(cache) { return toDisplayedString(this.val, cache); }; +// WrappedSchemeValue.prototype.toString = function() { return toString(this.val); }; +// WrappedSchemeValue.prototype.toWrittenString = function(cache) { return toWrittenString(this.val, cache); }; +// WrappedSchemeValue.prototype.toDisplayedString = function(cache) { return toDisplayedString(this.val, cache); }; - // unbox: jsvalue -> any - // Unwraps the value out of the WrappedSchemeValue box. - WrappedSchemeValue.prototype.unbox = function() { - return this.val; - }; +// // unbox: jsvalue -> any +// // Unwraps the value out of the WrappedSchemeValue box. +// WrappedSchemeValue.prototype.unbox = function() { +// return this.val; +// }; ////////////////////////////////////////////////////////////////////// - var WorldConfig = function(startup, shutdown, startupArgs) { - this.startup = startup; - this.shutdown = shutdown; - this.startupArgs = startupArgs; - }; +// var WorldConfig = function(startup, shutdown, startupArgs) { +// this.startup = startup; +// this.shutdown = shutdown; +// this.startupArgs = startupArgs; +// }; - WorldConfig.prototype.toString = function() { - return '#'; - }; +// WorldConfig.prototype.toString = function() { +// return '#'; +// }; - WorldConfig.prototype.equals = function(other, aUnionFind) { - return ( equals(this.startup, other.startup, aUnionFind) && - equals(this.shutdown, other.shutdown, aUnionFind) && - equals(this.shutdownArg, other.shutdownArg, aUnionFind) && - equals(this.restartArg, other.restartArg, aUnionFind) ); - }; +// WorldConfig.prototype.equals = function(other, aUnionFind) { +// return ( equals(this.startup, other.startup, aUnionFind) && +// equals(this.shutdown, other.shutdown, aUnionFind) && +// equals(this.shutdownArg, other.shutdownArg, aUnionFind) && +// equals(this.restartArg, other.restartArg, aUnionFind) ); +// }; - var Effect = plt.baselib.structs.makeStructureType('effect', false, 0, 0, false, false); - Effect.type.prototype.invokeEffect = function() { - helpers.raise(types.incompleteExn( - types.exnFail, - 'effect type created without using make-effect-type', - [])); - }; +// var Effect = plt.baselib.structs.makeStructureType('effect', false, 0, 0, false, false); +// Effect.type.prototype.invokeEffect = function() { +// helpers.raise(types.incompleteExn( +// types.exnFail, +// 'effect type created without using make-effect-type', +// [])); +// }; - var makeEffectType = function(name, superType, initFieldCnt, impl, guard) { - if ( !superType ) { - superType = Effect; - } +// var makeEffectType = function(name, superType, initFieldCnt, impl, guard) { +// if ( !superType ) { +// superType = Effect; +// } - var newType = plt.baselib.structs.makeStructureType(name, superType, initFieldCnt, 0, false, guard); - var lastFieldIndex = newType.firstField + newType.numberOfFields; +// var newType = plt.baselib.structs.makeStructureType(name, superType, initFieldCnt, 0, false, guard); +// var lastFieldIndex = newType.firstField + newType.numberOfFields; - newType.type.prototype.invokeEffect = function(aBigBang, k) { - var schemeChangeWorld = new PrimProc('update-world', 1, false, false, - function(worldUpdater) { - //helpers.check(worldUpdater, helpers.procArityContains(1), - // 'update-world', 'procedure (arity 1)', 1); +// newType.type.prototype.invokeEffect = function(aBigBang, k) { +// var schemeChangeWorld = new PrimProc('update-world', 1, false, false, +// function(worldUpdater) { +// //helpers.check(worldUpdater, helpers.procArityContains(1), +// // 'update-world', 'procedure (arity 1)', 1); - return new INTERNAL_PAUSE( - function(caller, onSuccess, onFail) { - aBigBang.changeWorld(function(w, k2) { - caller(worldUpdater, - [w], k2, - function(e) { throw e; }, - 'change-world (effect)'); - }, - function() { onSuccess(VOID_VALUE, 'restarting (change-world (effect))'); }); - }); - }); +// return new INTERNAL_PAUSE( +// function(caller, onSuccess, onFail) { +// aBigBang.changeWorld(function(w, k2) { +// caller(worldUpdater, +// [w], k2, +// function(e) { throw e; }, +// 'change-world (effect)'); +// }, +// function() { onSuccess(VOID_VALUE, 'restarting (change-world (effect))'); }); +// }); +// }); - var args = this._fields.slice(0, lastFieldIndex); - args.unshift(schemeChangeWorld); - return aBigBang.caller(impl, args, k, function(e) { throw e; }, 'invoking effect ' + name); - } +// var args = this._fields.slice(0, lastFieldIndex); +// args.unshift(schemeChangeWorld); +// return aBigBang.caller(impl, args, k, function(e) { throw e; }, 'invoking effect ' + name); +// } - return newType; - }; +// return newType; +// }; - var RenderEffect = plt.baselib.structs.makeStructureType('render-effect', false, 0, 0, false, false); - RenderEffect.type.prototype.callImplementation = function(caller, k) { - helpers.raise(types.incompleteExn( - types.exnFail, - 'render effect created without using make-render-effect-type', - [])); - }; +// var RenderEffect = plt.baselib.structs.makeStructureType('render-effect', false, 0, 0, false, false); +// RenderEffect.type.prototype.callImplementation = function(caller, k) { +// helpers.raise(types.incompleteExn( +// types.exnFail, +// 'render effect created without using make-render-effect-type', +// [])); +// }; - var makeRenderEffectType = function(name, superType, initFieldCnt, impl, guard) { - if ( !superType ) { - superType = RenderEffect; - } +// var makeRenderEffectType = function(name, superType, initFieldCnt, impl, guard) { +// if ( !superType ) { +// superType = RenderEffect; +// } - var newType = plt.baselib.structs.makeStructureType(name, superType, initFieldCnt, 0, false, guard); - var lastFieldIndex = newType.firstField + newType.numberOfFields; +// var newType = plt.baselib.structs.makeStructureType(name, superType, initFieldCnt, 0, false, guard); +// var lastFieldIndex = newType.firstField + newType.numberOfFields; - newType.type.prototype.callImplementation = function(caller, k) { - var args = this._fields.slice(0, lastFieldIndex); - caller(impl, args, k); - } +// newType.type.prototype.callImplementation = function(caller, k) { +// var args = this._fields.slice(0, lastFieldIndex); +// caller(impl, args, k); +// } - return newType; - }; +// return newType; +// }; ////////////////////////////////////////////////////////////////////// @@ -1239,20 +1239,6 @@ String.prototype.toDisplayedString = function(cache) { - var ContinuationClosureValue = function(vstack, cstack) { - this.name = types.EMPTY; - this.vstack = vstack.slice(0); - this.cstack = cstack.slice(0); - }; - - ContinuationClosureValue.prototype.toString = function() { - if (this.name !== Empty.EMPTY) { - return helpers.format("#", [this.name]); - } else { - return "#"; - } - }; - @@ -1315,33 +1301,6 @@ String.prototype.toDisplayedString = function(cache) { ////////////////////////////////////////////////////////////////////// - var PrimProc = function(name, numParams, isRest, usesState, impl) { - this.name = name; - this.numParams = numParams; - this.isRest = isRest; - this.usesState = usesState; - this.impl = impl; - }; - - PrimProc.prototype.toString = function() { - return ("#"); - }; - - PrimProc.prototype.toWrittenString = function(cache) { - return ("#"); - }; - - PrimProc.prototype.toDisplayedString = function(cache) { - return ("#"); - }; - - - PrimProc.prototype.toDomNode = function(cache) { - var div = document.createElement("span"); - div.appendChild(document.createTextNode("#")); - return div; - }; - ////////////////////////////////////////////////////////////////////// @@ -1414,24 +1373,24 @@ String.prototype.toDisplayedString = function(cache) { ////////////////////////////////////////////////////////////////////// - // ContinuationPromptTag: symbol | false -> ContinuationPromptTag - var ContinuationPromptTag = function(sym) { - this.sym = sym; - }; +// // ContinuationPromptTag: symbol | false -> ContinuationPromptTag +// var ContinuationPromptTag = function(sym) { +// this.sym = sym; +// }; - var defaultContinuationPromptTag = new ContinuationPromptTag(); +// var defaultContinuationPromptTag = new ContinuationPromptTag(); - var defaultContinuationPromptTagHandler = new PrimProc( - 'default-continuation-prompt-tag-handler', - 1, - false, - true, - function(aState, thunk) { - aState.pushControl( - new control.ApplicationControl( - new control.ConstantControl(thunk), - [])); - }); +// var defaultContinuationPromptTagHandler = new PrimProc( +// 'default-continuation-prompt-tag-handler', +// 1, +// false, +// true, +// function(aState, thunk) { +// aState.pushControl( +// new control.ApplicationControl( +// new control.ConstantControl(thunk), +// [])); +// }); ////////////////////////////////////////////////////////////////////// @@ -1653,10 +1612,12 @@ String.prototype.toDisplayedString = function(cache) { types.isStruct = function(x) { return x instanceof Struct; }; types.isArityAtLeast = ArityAtLeast.predicate; types.isColor = Color.predicate; - types.isFunction = function(x) { - return (x instanceof PrimProc || - x instanceof ContinuationClosureValue); - }; + +// types.isFunction = function(x) { +// return (x instanceof PrimProc); +// }; + + types.isJsValue = function(x) { return x instanceof JsValue; }; types.isWrappedSchemeValue = function(x) { return x instanceof WrappedSchemeValue; }; @@ -1666,11 +1627,9 @@ String.prototype.toDisplayedString = function(cache) { types.VOID = VOID_VALUE; types.EOF = EOF_VALUE; - types.ContinuationPromptTag = ContinuationPromptTag; - types.defaultContinuationPromptTag = defaultContinuationPromptTag; - types.defaultContinuationPromptTagHandler = defaultContinuationPromptTagHandler; - types.ContinuationClosureValue = ContinuationClosureValue; - types.PrimProc = PrimProc; +// types.ContinuationPromptTag = ContinuationPromptTag; +// types.defaultContinuationPromptTag = defaultContinuationPromptTag; +// types.defaultContinuationPromptTagHandler = defaultContinuationPromptTagHandler; // types.makeOptionPrimitive = makeOptionPrimitive; types.internalCall = function(op, args, k) { return new INTERNAL_CALL(op, args, k); }; @@ -1682,7 +1641,7 @@ String.prototype.toDisplayedString = function(cache) { types.isContMarkRecordControl = function(x) { return x instanceof ContMarkRecordControl; }; types.continuationMarkSet = function(dict) { return new ContinuationMarkSet(dict); }; types.isContinuationMarkSet = function(x) { return x instanceof ContinuationMarkSet; }; - types.isContinuationPromptTag = function(x) { return x instanceof ContinuationPromptTag; }; +// types.isContinuationPromptTag = function(x) { return x instanceof ContinuationPromptTag; }; types.Box = Box; @@ -1708,42 +1667,42 @@ String.prototype.toDisplayedString = function(cache) { /////////////////////////////////////// // World-specific exports - // big bang info to be passed into a make-world-config startup argument - var BigBangInfo = plt.baselib.structs.makeStructureType('bb-info', false, 2, 0, false, - function(args, name, k) { - //helpers.check(args[0], helpers.procArityContains(1), name, 'procedure (arity 1)', 1); - //helpers.check(args[1], types.isJsValue, name, 'js-object', 2); - return k(args); - }); - types.BigBangInfo = BigBangInfo; - types.makeBigBangInfo = BigBangInfo.constructor; - types.isBigBangInfo = BigBangInfo.predicate; - types.bbInfoChangeWorld = function(info) { return BigBangInfo.accessor(info, 0); }; - types.bbInfoToplevelNode = function(info) { return BigBangInfo.accessor(info, 1); }; +// // big bang info to be passed into a make-world-config startup argument +// var BigBangInfo = plt.baselib.structs.makeStructureType('bb-info', false, 2, 0, false, +// function(args, name, k) { +// //helpers.check(args[0], helpers.procArityContains(1), name, 'procedure (arity 1)', 1); +// //helpers.check(args[1], types.isJsValue, name, 'js-object', 2); +// return k(args); +// }); +// types.BigBangInfo = BigBangInfo; +// types.makeBigBangInfo = BigBangInfo.constructor; +// types.isBigBangInfo = BigBangInfo.predicate; +// types.bbInfoChangeWorld = function(info) { return BigBangInfo.accessor(info, 0); }; +// types.bbInfoToplevelNode = function(info) { return BigBangInfo.accessor(info, 1); }; // World config information for user-defined configurations - types.worldConfig = function(startup, shutdown, pause, restart) { return new WorldConfig(startup, shutdown, pause, restart); }; - types.isWorldConfig = function(x) { return x instanceof WorldConfig; }; +// types.worldConfig = function(startup, shutdown, pause, restart) { return new WorldConfig(startup, shutdown, pause, restart); }; +// types.isWorldConfig = function(x) { return x instanceof WorldConfig; }; // exporting information to create effect types - types.makeEffectType = makeEffectType; - types.isEffectType = function(x) { - return ((x instanceof plt.baselib.structs.StructType)&& x.type.prototype.invokeEffect) ? true : false; - }; +// types.makeEffectType = makeEffectType; +// types.isEffectType = function(x) { +// return ((x instanceof plt.baselib.structs.StructType)&& x.type.prototype.invokeEffect) ? true : false; +// }; - types.isEffect = Effect.predicate; +// types.isEffect = Effect.predicate; // exporting functions to create render effect types - types.makeRenderEffectType = makeRenderEffectType; - types.isRenderEffectType = function(x) { - return (x instanceof plt.baselib.structs.StructType && x.type.prototype.callImplementation) ? true : false; - }; +// types.makeRenderEffectType = makeRenderEffectType; +// types.isRenderEffectType = function(x) { +// return (x instanceof plt.baselib.structs.StructType && x.type.prototype.callImplementation) ? true : false; +// }; - types.isRenderEffect = RenderEffect.predicate; +// types.isRenderEffect = RenderEffect.predicate;