aboutsummaryrefslogtreecommitdiff
path: root/src/utility.js
diff options
context:
space:
mode:
authoralon@honor <none@none>2010-10-02 20:27:20 -0700
committeralon@honor <none@none>2010-10-02 20:27:20 -0700
commit72e5d1365603cc107df97f14d2099ee460ec55af (patch)
treea664ad1ae33ea72dbcbe60cfe9d08ca7d5020849 /src/utility.js
parent6dcf85c6b014dbc6fc32de186a16b651fcc29b92 (diff)
rewrite of relooper, part I: just emulated and loops, no ifs. all reloop but sauer
Diffstat (limited to 'src/utility.js')
-rw-r--r--src/utility.js26
1 files changed, 25 insertions, 1 deletions
diff --git a/src/utility.js b/src/utility.js
index 8907eb91..3d8ce86e 100644
--- a/src/utility.js
+++ b/src/utility.js
@@ -145,6 +145,14 @@ function splitter(array, filter) {
function dcheck(tag) {
return DEBUG_TAGS_SHOWING.indexOf(arguments[0]) != -1;
}
+DPRINT_INDENT = '';
+function dprint_indent() {
+ DPRINT_INDENT += ' ';
+}
+function dprint_unindent() {
+ DPRINT_INDENT = DPRINT_INDENT.substr(3);
+}
+
function dprint() {
var text;
if (arguments[1]) {
@@ -153,7 +161,10 @@ function dprint() {
} else {
text = arguments[0];
}
- text = '// ' + text;
+ if (typeof text === 'function') {
+ text = text(); // Allows deferred calculation, so dprints don't slow us down when not needed
+ }
+ text = DPRINT_INDENT + '// ' + text;
print(text);
}
@@ -178,3 +189,16 @@ function mergeInto(obj, other) {
return obj;
}
+// Sets
+
+set = searchable; // Create a 'set'
+function setSub(x, y) {
+ var ret = set(values(x));
+ for (yy in y) {
+ if (yy in ret) {
+ delete ret.yy;
+ }
+ }
+ return ret;
+}
+