diff --git a/js-assembler/get-runtime.rkt b/js-assembler/get-runtime.rkt index f15e3e7..417db7c 100644 --- a/js-assembler/get-runtime.rkt +++ b/js-assembler/get-runtime.rkt @@ -40,6 +40,8 @@ js-numbers.js baselib.js + + baselib-frames.js baselib-unionfind.js baselib-equality.js @@ -52,7 +54,7 @@ baselib-symbols.js baselib-strings.js baselib-bytes.js - baselib-hash.js + baselib-hashes.js baselib-regexps.js baselib-paths.js baselib-boxes.js diff --git a/js-assembler/runtime-src/baselib-format.js b/js-assembler/runtime-src/baselib-format.js index ebad0ad..afab903 100644 --- a/js-assembler/runtime-src/baselib-format.js +++ b/js-assembler/runtime-src/baselib-format.js @@ -73,7 +73,7 @@ // toWrittenString: Any Hashtable -> String var toWrittenString = function(x, cache) { if (! cache) { - cache = plt.baselib.hash.makeLowLevelEqHash(); + cache = plt.baselib.hashes.makeLowLevelEqHash(); } if (x === null) { return "null"; @@ -112,7 +112,7 @@ // toDisplayedString: Any Hashtable -> String var toDisplayedString = function(x, cache) { if (! cache) { - cache = plt.baselib.hash.makeLowLevelEqHash(); + cache = plt.baselib.hashes.makeLowLevelEqHash(); } if (x === null) { return "null"; @@ -153,7 +153,7 @@ var ToDomNodeParameters = function(params) { if (! params) { params = {}; } - this.cache = plt.baselib.hash.makeLowLevelEqHash(); + this.cache = plt.baselib.hashes.makeLowLevelEqHash(); for (var k in params) { if (params.hasOwnProperty(k)) { this[k] = params[k]; diff --git a/js-assembler/runtime-src/baselib-frames.js b/js-assembler/runtime-src/baselib-frames.js new file mode 100644 index 0000000..0b73117 --- /dev/null +++ b/js-assembler/runtime-src/baselib-frames.js @@ -0,0 +1,69 @@ +// Frame structures. +(function(baselib) { + var exports = {}; + baselib.frames = exports; + + + + // A generic frame just holds marks. + var Frame = function() { + // The set of continuation marks. + this.marks = []; + + // When we're in the middle of computing with-cont-mark, we + // stash the key in here temporarily. + this.pendingContinuationMarkKey = undefined; + this.pendingApplyValuesProc = undefined; + this.pendingBegin0Count = undefined; + this.pendingBegin0Values = undefined; + }; + + + // Frames must support marks and the temporary variables necessary to + // support with-continuation-mark and with-values. + + // Specialized frames support more features: + + // A CallFrame represents a call stack frame, and includes the return address + // as well as the function being called. + var CallFrame = function(label, proc) { + this.label = label; + this.proc = proc; + + // The set of continuation marks. + this.marks = []; + + // When we're in the middle of computing with-cont-mark, we + // stash the key in here temporarily. + this.pendingContinuationMarkKey = undefined; + }; + CallFrame.prototype = baselib.heir(Frame.prototype); + + + + // A prompt frame includes a return address, as well as a prompt tag + // for supporting delimited continuations. + var PromptFrame = function(label, tag) { + this.label = label; + this.tag = tag; // ContinuationPromptTag + + // The set of continuation marks. + this.marks = []; + + // When we're in the middle of computing with-cont-mark, we + // stash the key in here temporarily. + this.pendingContinuationMarkKey = undefined; + }; + PromptFrame.prototype = baselib.heir(Frame.prototype); + + + + + ////////////////////////////////////////////////////////////////////// + exports.Frame = Frame; + exports.CallFrame = CallFrame; + exports.PromptFrame = PromptFrame; + + + +})(this['plt'].baselib); \ No newline at end of file diff --git a/js-assembler/runtime-src/baselib-hash.js b/js-assembler/runtime-src/baselib-hashes.js similarity index 98% rename from js-assembler/runtime-src/baselib-hash.js rename to js-assembler/runtime-src/baselib-hashes.js index 53cd4cc..896e60c 100644 --- a/js-assembler/runtime-src/baselib-hash.js +++ b/js-assembler/runtime-src/baselib-hashes.js @@ -2,7 +2,7 @@ (function(baselib) { var exports = {}; - baselib.hash = exports; + baselib.hashes = exports; diff --git a/js-assembler/runtime-src/baselib-unionfind.js b/js-assembler/runtime-src/baselib-unionfind.js index a64852a..f47b53b 100644 --- a/js-assembler/runtime-src/baselib-unionfind.js +++ b/js-assembler/runtime-src/baselib-unionfind.js @@ -10,7 +10,7 @@ var UnionFind = function() { // this.parenMap holds the arrows from an arbitrary pointer // to its parent. - this.parentMap = baselib.hash.makeLowLevelEqHash(); + this.parentMap = baselib.hashes.makeLowLevelEqHash(); } // find: ptr -> UnionFindNode diff --git a/js-assembler/runtime-src/runtime.js b/js-assembler/runtime-src/runtime.js index ffbe9f7..9f0a56e 100644 --- a/js-assembler/runtime-src/runtime.js +++ b/js-assembler/runtime-src/runtime.js @@ -49,6 +49,13 @@ if(this['plt'] === undefined) { this['plt'] = {}; } var makeBox = plt.baselib.boxes.makeBox; var isBox = plt.baselib.boxes.isBox; + + + // Frame structures. + var Frame = plt.baselib.frames.Frame; + var CallFrame = plt.baselib.frames.CallFrame; + var PromptFrame = plt.baselib.frames.PromptFrame; + //////////////////////////////////////////////////////////////////////] @@ -238,55 +245,6 @@ if(this['plt'] === undefined) { this['plt'] = {}; } - // A generic frame just holds marks. - var Frame = function() { - // The set of continuation marks. - this.marks = []; - - // When we're in the middle of computing with-cont-mark, we - // stash the key in here temporarily. - this.pendingContinuationMarkKey = undefined; - this.pendingApplyValuesProc = undefined; - this.pendingBegin0Count = undefined; - this.pendingBegin0Values = undefined; - }; - - - // Frames must support marks and the temporary variables necessary to - // support with-continuation-mark and with-values. - - // Specialized frames support more features: - - // A CallFrame represents a call stack frame, and includes the return address - // as well as the function being called. - var CallFrame = function(label, proc) { - this.label = label; - this.proc = proc; - - // When we're in the middle of computing with-cont-mark, we - // stash the key in here temporarily. - this.pendingContinuationMarkKey = undefined; - - // The set of continuation marks. - this.marks = []; - }; - CallFrame.prototype = heir(Frame.prototype); - - // A prompt frame includes a return address, as well as a prompt tag - // for supporting delimited continuations. - var PromptFrame = function(label, tag) { - this.label = label; - this.tag = tag; // ContinuationPromptTag - - // The set of continuation marks. - this.marks = []; - - // When we're in the middle of computing with-cont-mark, we - // stash the key in here temporarily. - this.pendingContinuationMarkKey = undefined; - }; - PromptFrame.prototype = heir(Frame.prototype); - diff --git a/js-assembler/runtime-src/types.js b/js-assembler/runtime-src/types.js index 0e42851..1f23e82 100644 --- a/js-assembler/runtime-src/types.js +++ b/js-assembler/runtime-src/types.js @@ -19,10 +19,10 @@ if (! this['plt']) { this['plt'] = {}; } - var getEqHashCode = plt.baselib.hash.getEqHashCode; + var getEqHashCode = plt.baselib.hashes.getEqHashCode; // makeLowLevelEqHash: -> hashtable // Constructs an eq hashtable that uses Moby's getEqHashCode function. - var makeLowLevelEqHash = plt.baselib.hash.makeLowLevelEqHash; + var makeLowLevelEqHash = plt.baselib.hashes.makeLowLevelEqHash; var toWrittenString = plt.baselib.format.toWrittenString; var toDisplayedString = plt.baselib.format.toDisplayedString; var toDomNode = plt.baselib.format.toDomNode; @@ -124,7 +124,7 @@ if (! this['plt']) { this['plt'] = {}; } var makeHashEq = function(lst) { - var newHash = new plt.baselib.hash.EqHashTable(); + var newHash = new plt.baselib.hashes.EqHashTable(); while ( !isEmpty(lst) ) { newHash.hash.put(lst.first.first, lst.first.rest); lst = lst.rest; @@ -134,7 +134,7 @@ if (! this['plt']) { this['plt'] = {}; } var makeHashEqual = function(lst) { - var newHash = new plt.baselib.hash.EqualHashTable(); + var newHash = new plt.baselib.hashes.EqualHashTable(); while ( !isEmpty(lst) ) { newHash.hash.put(lst.first.first, lst.first.rest); lst = lst.rest; @@ -470,8 +470,8 @@ if (! this['plt']) { this['plt'] = {}; } types.isVector = function(x) { return x instanceof Vector; }; types.isBox = function(x) { return x instanceof plt.baselib.boxes.Box; }; types.isPlaceholder = function(x) { return x instanceof plt.baselib.placeholders.Placeholder; }; - types.isHash = function(x) { return (x instanceof plt.baselib.hash.EqHashTable || - x instanceof plt.baselib.hash.EqualHashTable); }; + types.isHash = function(x) { return (x instanceof plt.baselib.hashes.EqHashTable || + x instanceof plt.baselib.hashes.EqualHashTable); }; types.isByteString = function(x) { return x instanceof plt.baselib.bytes.Bytes; }; types.isStruct = function(x) { return x instanceof Struct; }; types.isColor = Color.predicate;