moving some type definitions out of runtime, like frame
This commit is contained in:
parent
5149c99a12
commit
e20f984e26
|
@ -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
|
||||
|
|
|
@ -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];
|
||||
|
|
69
js-assembler/runtime-src/baselib-frames.js
Normal file
69
js-assembler/runtime-src/baselib-frames.js
Normal file
|
@ -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);
|
|
@ -2,7 +2,7 @@
|
|||
(function(baselib) {
|
||||
var exports = {};
|
||||
|
||||
baselib.hash = exports;
|
||||
baselib.hashes = exports;
|
||||
|
||||
|
||||
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue
Block a user