Permalink
Browse files

more tweaks, ready to push

  • Loading branch information...
1 parent c5df56d commit 1c84d0342f578019fbe2d5c9c1101953edc766b9 @maxtaco committed Jan 13, 2012
Showing with 177 additions and 2 deletions.
  1. +2 −2 Cakefile
  2. +175 −0 extras/coffee-script.js
View
@@ -30,7 +30,7 @@ header = """
sources = [
'coffee-script', 'grammar', 'helpers'
'lexer', 'nodes', 'rewriter', 'scope',
- 'tame'
+ 'tame', 'tamelib'
].map (filename) -> "src/#{filename}.coffee"
# Run a CoffeeScript through our node/coffee interpreter.
@@ -97,7 +97,7 @@ task 'build:ultraviolet', 'build and install the Ultraviolet syntax highlighter'
task 'build:browser', 'rebuild the merged script for inclusion in the browser', ->
code = ''
- for name in ['helpers', 'rewriter', 'lexer', 'parser', 'scope', 'tame', 'nodes', 'coffee-script', 'browser']
+ for name in ['helpers', 'rewriter', 'lexer', 'parser', 'scope', 'tame', 'nodes', 'coffee-script', 'browser', 'tamelib']
code += """
require['./#{name}'] = new function() {
var exports = this;
View
@@ -6048,6 +6048,181 @@ if (typeof module !== 'undefined' && require.main === module) {
}).call(this);
+};require['./tamelib'] = new function() {
+ var exports = this;
+ // Generated by CoffeeScript 1.2.1-pre
+(function() {
+ var Pipeliner, tame, tame_internals, __tame_k, _timeout,
+ __slice = [].slice;
+
+ __tame_k = function() {};
+
+ tame_internals = require('./tame');
+
+ tame = tame_internals.runtime;
+
+ _timeout = function(cb, t, res, tmp) {
+ var arr, rv, which, __tame_deferrals,
+ _this = this;
+ rv = new tame.Rendezvous;
+ tmp[0] = rv.id(true).__tame_deferrals.defer({
+ assign_fn: (function() {
+ return function() {
+ return arr = __slice.call(arguments, 0);
+ };
+ })()
+ });
+ setTimeout(rv.id(false).__tame_deferrals.defer({}), t);
+ (function(__tame_k) {
+ __tame_deferrals = new tame.Deferrals(__tame_k);
+ rv.wait(__tame_deferrals.defer({
+ assign_fn: (function() {
+ return function() {
+ return which = arguments[0];
+ };
+ })()
+ }));
+ __tame_deferrals._fulfill();
+ })(function() {
+ if (res) res[0] = which;
+ return cb.apply(null, arr);
+ });
+ };
+
+ exports.timeout = function(cb, t, res) {
+ var tmp;
+ tmp = [];
+ _timeout(cb, t, res, tmp);
+ return tmp[0];
+ };
+
+ exports.Pipeliner = Pipeliner = (function() {
+
+ Pipeliner.name = 'Pipeliner';
+
+ function Pipeliner(window, delay) {
+ this.window = window || 1;
+ this.delay = delay || 0;
+ this.queue = [];
+ this.n_out = 0;
+ this.cb = null;
+ this[tame_internals["const"].deferrals] = this;
+ this["defer"] = this._defer;
+ }
+
+ Pipeliner.prototype.waitInQueue = function(cb) {
+ var __tame_deferrals,
+ _this = this;
+ (function(__tame_k) {
+ var _results, _while;
+ _results = [];
+ _while = function(__tame_k) {
+ var _break, _continue, _next;
+ _break = function() {
+ return __tame_k(_results);
+ };
+ _continue = function() {
+ return _while(__tame_k);
+ };
+ _next = function(__tame_next_arg) {
+ _results.push(__tame_next_arg);
+ return _continue();
+ };
+ if (_this.n_out > _this.window) {
+ (function(__tame_k) {
+ __tame_deferrals = new tame.Deferrals(__tame_k);
+ _this.cb = __tame_deferrals.defer({});
+ __tame_deferrals._fulfill();
+ })(_next);
+ } else {
+ return _break();
+ }
+ };
+ _while(__tame_k);
+ })(function() {
+ _this.n_out++;
+ (function(__tame_k) {
+ if (_this.delay) {
+ (function(__tame_k) {
+ __tame_deferrals = new tame.Deferrals(__tame_k);
+ setTimeout(__tame_deferrals.defer({}), _this.delay);
+ __tame_deferrals._fulfill();
+ })(__tame_k);
+ } else {
+ return __tame_k();
+ }
+ })(function() {
+ return cb();
+ });
+ });
+ };
+
+ Pipeliner.prototype.__defer = function(out, deferArgs) {
+ var tmp, voidCb, __tame_deferrals,
+ _this = this;
+ (function(__tame_k) {
+ __tame_deferrals = new tame.Deferrals(__tame_k);
+ voidCb = __tame_deferrals.defer({});
+ out[0] = function() {
+ var args, _ref;
+ args = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
+ if ((_ref = deferArgs.assign_fn) != null) _ref.apply(null, args);
+ return voidCb();
+ };
+ __tame_deferrals._fulfill();
+ })(function() {
+ _this.n_out--;
+ if (_this.cb) {
+ tmp = _this.cb;
+ _this.cb = null;
+ return tmp();
+ }
+ });
+ };
+
+ Pipeliner.prototype._defer = function(deferArgs) {
+ var tmp;
+ tmp = [];
+ this.__defer(tmp, deferArgs);
+ return tmp[0];
+ };
+
+ Pipeliner.prototype.flush = function(autocb) {
+ var __tame_deferrals, _results, _while,
+ _this = this;
+ __tame_k = autocb;
+ _results = [];
+ _while = function(__tame_k) {
+ var _break, _continue, _next;
+ _break = function() {
+ return __tame_k(_results);
+ };
+ _continue = function() {
+ return _while(__tame_k);
+ };
+ _next = function(__tame_next_arg) {
+ _results.push(__tame_next_arg);
+ return _continue();
+ };
+ if (_this.n_out) {
+ (function(__tame_k) {
+ __tame_deferrals = new tame.Deferrals(__tame_k);
+ _this.cb = __tame_deferrals.defer({});
+ __tame_deferrals._fulfill();
+ })(_next);
+ } else {
+ return _break();
+ }
+ };
+ _while(__tame_k);
+ };
+
+ return Pipeliner;
+
+ })();
+
+}).call(this);
+
};
return require['./coffee-script'];
}();

0 comments on commit 1c84d03

Please sign in to comment.