├── .gitignore ├── 01-pressure-draw └── cljs_draw │ ├── LinearStroke.js │ ├── RadialStroke.js │ ├── core.cljs │ ├── radial.png │ └── util.cljs ├── README.md ├── build ├── build.clj ├── index.html ├── localforage.nopromises.js ├── main.js ├── out ├── cljs │ ├── core.cljs │ ├── core.js │ ├── core.js.map │ ├── core │ │ ├── async.cljs │ │ ├── async.cljs.cache.edn │ │ ├── async.js │ │ ├── async.js.map │ │ └── async │ │ │ └── impl │ │ │ ├── buffers.cljs │ │ │ ├── buffers.cljs.cache.edn │ │ │ ├── buffers.js │ │ │ ├── buffers.js.map │ │ │ ├── channels.cljs │ │ │ ├── channels.cljs.cache.edn │ │ │ ├── channels.js │ │ │ ├── channels.js.map │ │ │ ├── dispatch.cljs │ │ │ ├── dispatch.cljs.cache.edn │ │ │ ├── dispatch.js │ │ │ ├── dispatch.js.map │ │ │ ├── ioc_helpers.cljs │ │ │ ├── ioc_helpers.cljs.cache.edn │ │ │ ├── ioc_helpers.js │ │ │ ├── ioc_helpers.js.map │ │ │ ├── protocols.cljs │ │ │ ├── protocols.cljs.cache.edn │ │ │ ├── protocols.js │ │ │ ├── protocols.js.map │ │ │ ├── timers.cljs │ │ │ ├── timers.cljs.cache.edn │ │ │ ├── timers.js │ │ │ └── timers.js.map │ ├── pprint.cljs │ ├── pprint.cljs.cache.edn │ ├── pprint.js │ ├── pprint.js.map │ ├── repl.cljs │ ├── repl.cljs.cache.edn │ ├── repl.js │ └── repl.js.map ├── cljs_deps.js ├── cljs_draw │ ├── core.cljs │ ├── core.cljs.cache.edn │ ├── core.js │ ├── core.js.map │ ├── util.cljs │ ├── util.cljs.cache.edn │ ├── util.js │ └── util.js.map ├── clojure │ ├── browser │ │ ├── event.cljs │ │ ├── event.cljs.cache.edn │ │ ├── event.js │ │ ├── event.js.map │ │ ├── net.cljs │ │ ├── net.cljs.cache.edn │ │ ├── net.js │ │ ├── net.js.map │ │ ├── repl.cljs │ │ ├── repl.cljs.cache.edn │ │ ├── repl.js │ │ └── repl.js.map │ ├── core │ │ ├── reducers.cljs │ │ ├── reducers.cljs.cache.edn │ │ ├── reducers.js │ │ ├── reducers.js.map │ │ ├── rrb_vector.cljs │ │ ├── rrb_vector.cljs.cache.edn │ │ ├── rrb_vector.js │ │ ├── rrb_vector.js.map │ │ └── rrb_vector │ │ │ ├── interop.cljs │ │ │ ├── interop.cljs.cache.edn │ │ │ ├── interop.js │ │ │ ├── interop.js.map │ │ │ ├── nodes.cljs │ │ │ ├── nodes.cljs.cache.edn │ │ │ ├── nodes.js │ │ │ ├── nodes.js.map │ │ │ ├── protocols.cljs │ │ │ ├── protocols.cljs.cache.edn │ │ │ ├── protocols.js │ │ │ ├── protocols.js.map │ │ │ ├── rrbt.cljs │ │ │ ├── rrbt.cljs.cache.edn │ │ │ ├── rrbt.js │ │ │ ├── rrbt.js.map │ │ │ ├── transients.cljs │ │ │ ├── transients.cljs.cache.edn │ │ │ ├── transients.js │ │ │ ├── transients.js.map │ │ │ ├── trees.cljs │ │ │ ├── trees.cljs.cache.edn │ │ │ ├── trees.js │ │ │ └── trees.js.map │ ├── set.cljs │ ├── set.cljs.cache.edn │ ├── set.js │ ├── set.js.map │ ├── string.cljs │ ├── string.cljs.cache.edn │ ├── string.js │ ├── string.js.map │ ├── walk.cljs │ ├── walk.cljs.cache.edn │ ├── walk.js │ └── walk.js.map ├── fipp │ ├── deque.cljc │ ├── deque.cljc.cache.edn │ ├── deque.js │ ├── deque.js.map │ ├── engine.cljc │ ├── engine.cljc.cache.edn │ ├── engine.js │ └── engine.js.map ├── frontend.js ├── gamma │ ├── api.cljs │ ├── api.cljs.cache.edn │ ├── api.js │ ├── api.js.map │ ├── ast.cljs │ ├── ast.cljs.cache.edn │ ├── ast.js │ ├── ast.js.map │ ├── compiler │ │ ├── bubble_term.cljs │ │ ├── bubble_term.cljs.cache.edn │ │ ├── bubble_term.js │ │ ├── bubble_term.js.map │ │ ├── common.cljs │ │ ├── common.cljs.cache.edn │ │ ├── common.js │ │ ├── common.js.map │ │ ├── core.cljs │ │ ├── core.cljs.cache.edn │ │ ├── core.js │ │ ├── core.js.map │ │ ├── flatten_ast.cljs │ │ ├── flatten_ast.cljs.cache.edn │ │ ├── flatten_ast.js │ │ ├── flatten_ast.js.map │ │ ├── insert_assignments.cljs │ │ ├── insert_assignments.cljs.cache.edn │ │ ├── insert_assignments.js │ │ ├── insert_assignments.js.map │ │ ├── insert_variables.cljs │ │ ├── insert_variables.cljs.cache.edn │ │ ├── insert_variables.js │ │ ├── insert_variables.js.map │ │ ├── lift_assignments.cljs │ │ ├── lift_assignments.cljs.cache.edn │ │ ├── lift_assignments.js │ │ ├── lift_assignments.js.map │ │ ├── move_assignments.cljs │ │ ├── move_assignments.cljs.cache.edn │ │ ├── move_assignments.js │ │ ├── move_assignments.js.map │ │ ├── separate_usages.cljs │ │ ├── separate_usages.cljs.cache.edn │ │ ├── separate_usages.js │ │ └── separate_usages.js.map │ ├── emit │ │ ├── construct.cljs │ │ ├── construct.cljs.cache.edn │ │ ├── construct.js │ │ ├── construct.js.map │ │ ├── emit.cljs │ │ ├── emit.cljs.cache.edn │ │ ├── emit.js │ │ ├── emit.js.map │ │ ├── fun.cljs │ │ ├── fun.cljs.cache.edn │ │ ├── fun.js │ │ ├── fun.js.map │ │ ├── operator.cljs │ │ ├── operator.cljs.cache.edn │ │ ├── operator.js │ │ ├── operator.js.map │ │ ├── statement.cljs │ │ ├── statement.cljs.cache.edn │ │ ├── statement.js │ │ ├── statement.js.map │ │ ├── tag.cljs │ │ ├── tag.cljs.cache.edn │ │ ├── tag.js │ │ └── tag.js.map │ ├── program.cljs │ ├── program.cljs.cache.edn │ ├── program.js │ └── program.js.map ├── gamma_driver │ ├── api.cljs │ ├── api.cljs.cache.edn │ ├── api.js │ ├── api.js.map │ ├── drivers │ │ ├── basic.cljs │ │ ├── basic.cljs.cache.edn │ │ ├── basic.js │ │ └── basic.js.map │ ├── impl │ │ ├── bind.cljs │ │ ├── bind.cljs.cache.edn │ │ ├── bind.js │ │ ├── bind.js.map │ │ ├── context.cljs │ │ ├── context.cljs.cache.edn │ │ ├── context.js │ │ ├── context.js.map │ │ ├── draw.cljs │ │ ├── draw.cljs.cache.edn │ │ ├── draw.js │ │ ├── draw.js.map │ │ ├── resource.cljs │ │ ├── resource.cljs.cache.edn │ │ ├── resource.js │ │ ├── resource.js.map │ │ ├── variable.cljs │ │ ├── variable.cljs.cache.edn │ │ ├── variable.js │ │ └── variable.js.map │ ├── protocols.cljs │ ├── protocols.cljs.cache.edn │ ├── protocols.js │ └── protocols.js.map ├── goog │ ├── array │ │ └── array.js │ ├── asserts │ │ └── asserts.js │ ├── async │ │ ├── delay.js │ │ ├── freelist.js │ │ ├── nexttick.js │ │ ├── run.js │ │ └── workqueue.js │ ├── base.js │ ├── color │ │ ├── color.js │ │ └── names.js │ ├── debug │ │ ├── debug.js │ │ ├── entrypointregistry.js │ │ ├── error.js │ │ ├── logbuffer.js │ │ ├── logger.js │ │ └── logrecord.js │ ├── deps.js │ ├── disposable │ │ ├── disposable.js │ │ └── idisposable.js │ ├── dom │ │ ├── browserfeature.js │ │ ├── dom.js │ │ ├── nodetype.js │ │ ├── safe.js │ │ ├── tagname.js │ │ └── tags.js │ ├── events │ │ ├── browserevent.js │ │ ├── browserfeature.js │ │ ├── event.js │ │ ├── eventhandler.js │ │ ├── eventid.js │ │ ├── events.js │ │ ├── eventtarget.js │ │ ├── eventtype.js │ │ ├── listenable.js │ │ ├── listener.js │ │ └── listenermap.js │ ├── fs │ │ └── url.js │ ├── functions │ │ └── functions.js │ ├── html │ │ ├── safehtml.js │ │ ├── safescript.js │ │ ├── safestyle.js │ │ ├── safestylesheet.js │ │ ├── safeurl.js │ │ ├── trustedresourceurl.js │ │ └── uncheckedconversions.js │ ├── i18n │ │ └── bidi.js │ ├── iter │ │ └── iter.js │ ├── json │ │ └── json.js │ ├── labs │ │ └── useragent │ │ │ ├── browser.js │ │ │ ├── engine.js │ │ │ ├── platform.js │ │ │ └── util.js │ ├── log │ │ └── log.js │ ├── math │ │ ├── coordinate.js │ │ ├── math.js │ │ └── size.js │ ├── messaging │ │ ├── abstractchannel.js │ │ └── messagechannel.js │ ├── mochikit │ │ └── async │ │ │ └── deferred.js │ ├── net │ │ ├── errorcode.js │ │ ├── eventtype.js │ │ ├── httpstatus.js │ │ ├── websocket.js │ │ ├── wrapperxmlhttpfactory.js │ │ ├── xhrio.js │ │ ├── xhrlike.js │ │ ├── xmlhttp.js │ │ ├── xmlhttpfactory.js │ │ └── xpc │ │ │ ├── crosspagechannel.js │ │ │ ├── crosspagechannelrole.js │ │ │ ├── directtransport.js │ │ │ ├── frameelementmethodtransport.js │ │ │ ├── iframepollingtransport.js │ │ │ ├── iframerelaytransport.js │ │ │ ├── nativemessagingtransport.js │ │ │ ├── nixtransport.js │ │ │ ├── transport.js │ │ │ └── xpc.js │ ├── object │ │ └── object.js │ ├── promise │ │ ├── promise.js │ │ ├── resolver.js │ │ └── thenable.js │ ├── reflect │ │ └── reflect.js │ ├── string │ │ ├── const.js │ │ ├── string.js │ │ ├── stringbuffer.js │ │ └── typedstring.js │ ├── structs │ │ ├── collection.js │ │ ├── map.js │ │ ├── set.js │ │ └── structs.js │ ├── testing │ │ └── watchers.js │ ├── timer │ │ └── timer.js │ ├── ui │ │ └── idgenerator.js │ ├── uri │ │ ├── uri.js │ │ └── utils.js │ ├── useragent │ │ ├── product.js │ │ └── useragent.js │ └── webgl │ │ └── webgl.js ├── main.js ├── om │ ├── core.cljs │ ├── core.cljs.cache.edn │ ├── core.js │ ├── core.js.map │ ├── dom.cljs │ ├── dom.cljs.cache.edn │ ├── dom.js │ └── dom.js.map ├── react.inc.js ├── thi │ └── ng │ │ ├── common │ │ ├── data │ │ │ ├── core.cljs │ │ │ ├── core.cljs.cache.edn │ │ │ ├── core.js │ │ │ └── core.js.map │ │ ├── error.cljs │ │ ├── error.cljs.cache.edn │ │ ├── error.js │ │ ├── error.js.map │ │ └── math │ │ │ ├── core.cljs │ │ │ ├── core.cljs.cache.edn │ │ │ ├── core.js │ │ │ └── core.js.map │ │ ├── geom │ │ ├── core.cljs │ │ ├── core.cljs.cache.edn │ │ ├── core.js │ │ ├── core.js.map │ │ └── core │ │ │ ├── matrix.cljs │ │ │ ├── matrix.cljs.cache.edn │ │ │ ├── matrix.js │ │ │ ├── matrix.js.map │ │ │ ├── utils.cljs │ │ │ ├── utils.cljs.cache.edn │ │ │ ├── utils.js │ │ │ ├── utils.js.map │ │ │ ├── vector.cljs │ │ │ ├── vector.cljs.cache.edn │ │ │ ├── vector.js │ │ │ └── vector.js.map │ │ └── math │ │ ├── core.cljc │ │ ├── core.cljc.cache.edn │ │ ├── core.js │ │ └── core.js.map └── watch.log ├── project.clj ├── style.css └── target └── stale └── extract-native.dependencies /.gitignore: -------------------------------------------------------------------------------- 1 | .repl* 2 | .DS_Store 3 | -------------------------------------------------------------------------------- /01-pressure-draw/cljs_draw/LinearStroke.js: -------------------------------------------------------------------------------- 1 | // This is ugly, hacked-together-quickly code 2 | 3 | function LinearStroke(color, brush) { 4 | this._vertices = new Float32Array(200); 5 | this._values = new Float32Array(200); 6 | this._numVertices = 0; 7 | this._color = color && goog.color.hexToRgb(color).map(function(x) { return x / 255; }); 8 | this._rawColor = color; 9 | this._brush = brush; 10 | } 11 | 12 | LinearStroke.prototype.addVertex = function(x, y, value) { 13 | this._vertices = this._maybeResize(this._vertices, 14 | (this._numVertices * 2) + 2); 15 | this._values = this._maybeResize(this._values, 16 | this._numVertices + 1); 17 | 18 | var ptr = this._numVertices * 2; 19 | this._vertices[ptr] = x; 20 | this._vertices[ptr + 1] = y; 21 | 22 | ptr = this._numVertices; 23 | this._values[ptr] = value; 24 | 25 | this._numVertices++; 26 | }; 27 | 28 | LinearStroke.prototype._maybeResize = function(vec, count) { 29 | if(vec.length < count) { 30 | var next = new Float32Array(vec.length + 31 | (count < 1000 ? 1000 : count)); 32 | next.set(vec); 33 | return next; 34 | } 35 | return vec; 36 | }; 37 | 38 | LinearStroke.prototype.setCurrentPos = function(x1, y1, x2, y2) { 39 | this._currentPos = [x1, y1, x2, y2]; 40 | } 41 | 42 | LinearStroke.prototype.getCurrentPos = function() { 43 | return this._currentPos; 44 | }; 45 | 46 | LinearStroke.prototype.getValues = function() { 47 | return this._values; 48 | } 49 | 50 | // Generic mesh methods 51 | 52 | LinearStroke.prototype.getNumVertices = function() { 53 | return this._numVertices; 54 | } 55 | 56 | LinearStroke.prototype.setNumVertices = function(num) { 57 | this._numVertices = num; 58 | } 59 | 60 | LinearStroke.prototype.getVertices = function() { 61 | return this._vertices; 62 | }; 63 | 64 | LinearStroke.prototype.getColor = function() { 65 | return this._color; 66 | }; 67 | 68 | LinearStroke.prototype.getBrush = function() { 69 | return this._brush; 70 | }; 71 | 72 | LinearStroke.prototype.isColor = function(color) { 73 | return this._rawColor === color; 74 | }; 75 | 76 | LinearStroke.prototype.serialize = function() { 77 | return ["linear", this._vertices, this._values, this._numVertices, 78 | this._color, this._rawColor, this._brush]; 79 | } 80 | 81 | LinearStroke.unserialize = function(data) { 82 | var mesh = new LinearStroke(); 83 | mesh._vertices = data[1]; 84 | mesh._values = data[2]; 85 | mesh._numVertices = data[3]; 86 | mesh._color = data[4]; 87 | mesh._rawColor = data[5]; 88 | mesh._brush = data[6]; 89 | return mesh; 90 | } 91 | -------------------------------------------------------------------------------- /01-pressure-draw/cljs_draw/RadialStroke.js: -------------------------------------------------------------------------------- 1 | // This is ugly, hacked-together-quickly code 2 | 3 | function RadialStroke(color, brush) { 4 | this._vertices = new Float32Array(200); 5 | this._texcoords = new Float32Array(200); 6 | this._numVertices = 0; 7 | this._color = color && goog.color.hexToRgb(color).map(function(x) { return x / 255; }); 8 | this._rawColor = color; 9 | this._brush = brush; 10 | } 11 | 12 | RadialStroke.prototype.addVertex = function(x, y, tx, ty) { 13 | this._vertices = this._maybeResize(this._vertices, 14 | (this._numVertices * 2) + 2); 15 | this._texcoords = this._maybeResize(this._texcoords, 16 | (this._numVertices * 2) + 2); 17 | 18 | var ptr = this._numVertices * 2; 19 | this._vertices[ptr] = x; 20 | this._vertices[ptr + 1] = y; 21 | 22 | ptr = this._numVertices * 2; 23 | this._texcoords[ptr] = tx; 24 | this._texcoords[ptr + 1] = ty; 25 | 26 | this._numVertices++; 27 | }; 28 | 29 | RadialStroke.prototype._maybeResize = function(vec, count) { 30 | if(vec.length < count) { 31 | var next = new Float32Array(vec.length + 32 | (count < 1000 ? 1000 : count)); 33 | next.set(vec); 34 | return next; 35 | } 36 | return vec; 37 | }; 38 | 39 | RadialStroke.prototype.setCurrentPos = function(x, y) { 40 | this._currentPos = [x, y]; 41 | } 42 | 43 | RadialStroke.prototype.getCurrentPos = function() { 44 | return this._currentPos; 45 | }; 46 | 47 | RadialStroke.prototype.getTexCoords = function() { 48 | return this._texcoords; 49 | } 50 | 51 | // Generic mesh methods 52 | 53 | RadialStroke.prototype.getNumVertices = function() { 54 | return this._numVertices; 55 | } 56 | 57 | RadialStroke.prototype.setNumVertices = function(num) { 58 | this._numVertices = num; 59 | } 60 | 61 | RadialStroke.prototype.getVertices = function() { 62 | return this._vertices; 63 | }; 64 | 65 | RadialStroke.prototype.getColor = function() { 66 | return this._color; 67 | }; 68 | 69 | RadialStroke.prototype.getBrush = function() { 70 | return this._brush; 71 | }; 72 | 73 | RadialStroke.prototype.isColor = function(color) { 74 | return this._rawColor === color; 75 | }; 76 | 77 | RadialStroke.prototype.serialize = function() { 78 | return ["radial", this._vertices, this._texcoords, this._numVertices, 79 | this._color, this._rawColor, this._brush]; 80 | } 81 | 82 | RadialStroke.unserialize = function(data) { 83 | var mesh = new RadialStroke(); 84 | mesh._vertices = data[1]; 85 | mesh._texcoords = data[2]; 86 | mesh._numVertices = data[3]; 87 | mesh._color = data[4]; 88 | mesh._rawColor = data[5]; 89 | mesh._brush = data[6]; 90 | return mesh; 91 | } 92 | -------------------------------------------------------------------------------- /01-pressure-draw/cljs_draw/radial.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jlongster/learning-clojurescript/c403a077dfeac01bf82b7d56edfca676dfc888c3/01-pressure-draw/cljs_draw/radial.png -------------------------------------------------------------------------------- /01-pressure-draw/cljs_draw/util.cljs: -------------------------------------------------------------------------------- 1 | (ns cljs_draw.util 2 | (:require [goog.events :as events] 3 | [cljs.core.async :refer [ 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /main.js: -------------------------------------------------------------------------------- 1 | var app = require('app'); // Module to control application life. 2 | var BrowserWindow = require('browser-window'); // Module to create native browser window. 3 | 4 | // Keep a global reference of the window object, if you don't, the window will 5 | // be closed automatically when the javascript object is GCed. 6 | var mainWindow = null; 7 | 8 | // Quit when all windows are closed. 9 | app.on('window-all-closed', function() { 10 | if (process.platform != 'darwin') 11 | app.quit(); 12 | }); 13 | 14 | // This method will be called when atom-shell has done everything 15 | // initialization and ready for creating browser windows. 16 | app.on('ready', function() { 17 | // Create the browser window. 18 | mainWindow = new BrowserWindow({width: 800, height: 600}); 19 | 20 | // and load the index.html of the app. 21 | mainWindow.loadUrl('file://' + __dirname + '/index.html'); 22 | 23 | // Emitted when the window is closed. 24 | mainWindow.on('closed', function() { 25 | // Dereference the window object, usually you would store windows 26 | // in an array if your app supports multi windows, this is the time 27 | // when you should delete the corresponding element. 28 | mainWindow = null; 29 | }); 30 | }); 31 | -------------------------------------------------------------------------------- /out/cljs/core/async/impl/dispatch.cljs: -------------------------------------------------------------------------------- 1 | (ns cljs.core.async.impl.dispatch 2 | (:require [cljs.core.async.impl.buffers :as buffers] 3 | [goog.async.nextTick])) 4 | 5 | (def tasks (buffers/ring-buffer 32)) 6 | (def running? false) 7 | (def queued? false) 8 | 9 | (def TASK_BATCH_SIZE 1024) 10 | 11 | (declare queue-dispatcher) 12 | 13 | (defn process-messages [] 14 | (set! running? true) 15 | (set! queued? false) 16 | (loop [count 0] 17 | (let [m (.pop tasks)] 18 | (when-not (nil? m) 19 | (m) 20 | (when (< count TASK_BATCH_SIZE) 21 | (recur (inc count)))))) 22 | (set! running? false) 23 | (when (> (.-length tasks) 0) 24 | (queue-dispatcher))) 25 | 26 | (defn queue-dispatcher [] 27 | (when-not (and queued? running?) 28 | (set! queued? true) 29 | (goog.async.nextTick process-messages))) 30 | 31 | (defn run [f] 32 | (.unbounded-unshift tasks f) 33 | (queue-dispatcher)) 34 | 35 | (defn queue-delay [f delay] 36 | (js/setTimeout f delay)) 37 | 38 | -------------------------------------------------------------------------------- /out/cljs/core/async/impl/dispatch.cljs.cache.edn: -------------------------------------------------------------------------------- 1 | ;; Analyzed by ClojureScript 0.0-3308 2 | {:name cljs.core.async.impl.dispatch, :doc nil, :excludes #{}, :use-macros nil, :require-macros nil, :uses nil, :requires {buffers cljs.core.async.impl.buffers, cljs.core.async.impl.buffers cljs.core.async.impl.buffers, goog.async.nextTick goog.async.nextTick}, :imports nil, :defs {tasks {:name cljs.core.async.impl.dispatch/tasks, :file "out/cljs/core/async/impl/dispatch.cljs", :line 5, :column 1, :end-line 5, :end-column 11, :meta {:file "/Users/james/projects/cljs-draw/out/cljs/core/async/impl/dispatch.cljs", :line 5, :column 6, :end-line 5, :end-column 11}}, running? {:name cljs.core.async.impl.dispatch/running?, :file "out/cljs/core/async/impl/dispatch.cljs", :line 6, :column 1, :end-line 6, :end-column 14, :meta {:file "/Users/james/projects/cljs-draw/out/cljs/core/async/impl/dispatch.cljs", :line 6, :column 6, :end-line 6, :end-column 14}}, queued? {:name cljs.core.async.impl.dispatch/queued?, :file "out/cljs/core/async/impl/dispatch.cljs", :line 7, :column 1, :end-line 7, :end-column 13, :meta {:file "/Users/james/projects/cljs-draw/out/cljs/core/async/impl/dispatch.cljs", :line 7, :column 6, :end-line 7, :end-column 13}}, TASK_BATCH_SIZE {:name cljs.core.async.impl.dispatch/TASK_BATCH_SIZE, :file "out/cljs/core/async/impl/dispatch.cljs", :line 9, :column 1, :end-line 9, :end-column 21, :meta {:file "/Users/james/projects/cljs-draw/out/cljs/core/async/impl/dispatch.cljs", :line 9, :column 6, :end-line 9, :end-column 21}}, queue-dispatcher {:protocol-inline nil, :meta {:file "/Users/james/projects/cljs-draw/out/cljs/core/async/impl/dispatch.cljs", :line 26, :column 7, :end-line 26, :end-column 23, :arglists (quote ([]))}, :name cljs.core.async.impl.dispatch/queue-dispatcher, :variadic false, :file "out/cljs/core/async/impl/dispatch.cljs", :end-column 23, :method-params ([]), :protocol-impl nil, :arglists-meta (nil nil), :column 1, :line 26, :end-line 26, :max-fixed-arity 0, :fn-var true, :arglists (quote ([]))}, process-messages {:protocol-inline nil, :meta {:file "/Users/james/projects/cljs-draw/out/cljs/core/async/impl/dispatch.cljs", :line 13, :column 7, :end-line 13, :end-column 23, :arglists (quote ([]))}, :name cljs.core.async.impl.dispatch/process-messages, :variadic false, :file "out/cljs/core/async/impl/dispatch.cljs", :end-column 23, :method-params ([]), :protocol-impl nil, :arglists-meta (nil nil), :column 1, :line 13, :end-line 13, :max-fixed-arity 0, :fn-var true, :arglists (quote ([]))}, run {:protocol-inline nil, :meta {:file "/Users/james/projects/cljs-draw/out/cljs/core/async/impl/dispatch.cljs", :line 31, :column 7, :end-line 31, :end-column 10, :arglists (quote ([f]))}, :name cljs.core.async.impl.dispatch/run, :variadic false, :file "out/cljs/core/async/impl/dispatch.cljs", :end-column 10, :method-params ([f]), :protocol-impl nil, :arglists-meta (nil nil), :column 1, :line 31, :end-line 31, :max-fixed-arity 1, :fn-var true, :arglists (quote ([f]))}, queue-delay {:protocol-inline nil, :meta {:file "/Users/james/projects/cljs-draw/out/cljs/core/async/impl/dispatch.cljs", :line 35, :column 7, :end-line 35, :end-column 18, :arglists (quote ([f delay]))}, :name cljs.core.async.impl.dispatch/queue-delay, :variadic false, :file "out/cljs/core/async/impl/dispatch.cljs", :end-column 18, :method-params ([f delay]), :protocol-impl nil, :arglists-meta (nil nil), :column 1, :line 35, :end-line 35, :max-fixed-arity 2, :fn-var true, :arglists (quote ([f delay]))}}} -------------------------------------------------------------------------------- /out/cljs/core/async/impl/dispatch.js: -------------------------------------------------------------------------------- 1 | // Compiled by ClojureScript 0.0-3308 {} 2 | goog.provide('cljs.core.async.impl.dispatch'); 3 | goog.require('cljs.core'); 4 | goog.require('cljs.core.async.impl.buffers'); 5 | goog.require('goog.async.nextTick'); 6 | cljs.core.async.impl.dispatch.tasks = cljs.core.async.impl.buffers.ring_buffer.call(null,(32)); 7 | cljs.core.async.impl.dispatch.running_QMARK_ = false; 8 | cljs.core.async.impl.dispatch.queued_QMARK_ = false; 9 | cljs.core.async.impl.dispatch.TASK_BATCH_SIZE = (1024); 10 | cljs.core.async.impl.dispatch.process_messages = (function cljs$core$async$impl$dispatch$process_messages(){ 11 | cljs.core.async.impl.dispatch.running_QMARK_ = true; 12 | 13 | cljs.core.async.impl.dispatch.queued_QMARK_ = false; 14 | 15 | var count_19656 = (0); 16 | while(true){ 17 | var m_19657 = cljs.core.async.impl.dispatch.tasks.pop(); 18 | if((m_19657 == null)){ 19 | } else { 20 | m_19657.call(null); 21 | 22 | if((count_19656 < cljs.core.async.impl.dispatch.TASK_BATCH_SIZE)){ 23 | var G__19658 = (count_19656 + (1)); 24 | count_19656 = G__19658; 25 | continue; 26 | } else { 27 | } 28 | } 29 | break; 30 | } 31 | 32 | cljs.core.async.impl.dispatch.running_QMARK_ = false; 33 | 34 | if((cljs.core.async.impl.dispatch.tasks.length > (0))){ 35 | return cljs.core.async.impl.dispatch.queue_dispatcher.call(null); 36 | } else { 37 | return null; 38 | } 39 | }); 40 | cljs.core.async.impl.dispatch.queue_dispatcher = (function cljs$core$async$impl$dispatch$queue_dispatcher(){ 41 | if(cljs.core.truth_((function (){var and__4941__auto__ = cljs.core.async.impl.dispatch.queued_QMARK_; 42 | if(cljs.core.truth_(and__4941__auto__)){ 43 | return cljs.core.async.impl.dispatch.running_QMARK_; 44 | } else { 45 | return and__4941__auto__; 46 | } 47 | })())){ 48 | return null; 49 | } else { 50 | cljs.core.async.impl.dispatch.queued_QMARK_ = true; 51 | 52 | return goog.async.nextTick(cljs.core.async.impl.dispatch.process_messages); 53 | } 54 | }); 55 | cljs.core.async.impl.dispatch.run = (function cljs$core$async$impl$dispatch$run(f){ 56 | cljs.core.async.impl.dispatch.tasks.unbounded_unshift(f); 57 | 58 | return cljs.core.async.impl.dispatch.queue_dispatcher.call(null); 59 | }); 60 | cljs.core.async.impl.dispatch.queue_delay = (function cljs$core$async$impl$dispatch$queue_delay(f,delay){ 61 | return setTimeout(f,delay); 62 | }); 63 | 64 | //# sourceMappingURL=dispatch.js.map -------------------------------------------------------------------------------- /out/cljs/core/async/impl/dispatch.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"\/Users\/james\/projects\/cljs-draw\/out\/cljs\/core\/async\/impl\/dispatch.js","sources":["dispatch.cljs"],"lineCount":64,"mappings":";AAAA;;;;AAIA,AAAKA,sCAAM,mDAAA,nDAACC;AACZ,+CAAA,\/CAAKC;AACL,8CAAA,9CAAKC;AAEL,gDAAA,hDAAKC;AAEL,AAAA,AAEA,iDAAA,jDAAMC;AAAN,AACE,+CAAA,\/CAAMH;;AACN,8CAAA,9CAAMC;;AACN,kBAAA,dAAOG;;AAAP,AACE,IAAMC,UAAE,AAAMP;AAAd,AACE,GAAU,YAAA,XAAMO;AAAhB;AAAA,AACE,AAACA;;AACD,GAAM,CAAGD,cAAMF;AAAf,AACE,eAAO,eAAA,dAAKE;;;;AADd;;;;;AAEN,+CAAA,\/CAAMJ;;AACN,GAAM,8CAAA,7CAAG,AAAUF;AAAnB,AACE,OAACQ;;AADH;;;AAGF,iDAAA,jDAAMA;AAAN,AACE,oBAAU,iBAAAC,oBAAKN;AAAL,AAAA,oBAAAM;AAAaP;;AAAbO;;;AAAV;;AAAA,AACE,8CAAA,9CAAMN;;AACN,OAACO,oBAAoBL;;;AAEzB,oCAAA,pCAAMM,gFAAKC;AAAX,AACE,AAAoBZ,sDAAMY;;AAC1B,OAACJ;;AAEH,4CAAA,5CAAMK,gGAAaD,EAAEE;AAArB,AACE,OAACC,WAAcH,EAAEE","names":["cljs.core.async.impl.dispatch\/tasks","cljs.core.async.impl.buffers\/ring-buffer","cljs.core.async.impl.dispatch\/running?","cljs.core.async.impl.dispatch\/queued?","cljs.core.async.impl.dispatch\/TASK_BATCH_SIZE","cljs.core.async.impl.dispatch\/process-messages","count","m","cljs.core.async.impl.dispatch\/queue-dispatcher","and__4941__auto__","goog\/async.nextTick","cljs.core.async.impl.dispatch\/run","f","cljs.core.async.impl.dispatch\/queue-delay","delay","js\/setTimeout"]} -------------------------------------------------------------------------------- /out/cljs/core/async/impl/protocols.cljs: -------------------------------------------------------------------------------- 1 | ;; Copyright (c) Rich Hickey and contributors. All rights reserved. 2 | ;; The use and distribution terms for this software are covered by the 3 | ;; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php) 4 | ;; which can be found in the file epl-v10.html at the root of this distribution. 5 | ;; By using this software in any fashion, you are agreeing to be bound by 6 | ;; the terms of this license. 7 | ;; You must not remove this notice, or any other, from this software. 8 | 9 | (ns cljs.core.async.impl.protocols) 10 | 11 | (def ^:const MAX-QUEUE-SIZE 1024) 12 | 13 | (defprotocol ReadPort 14 | (take! [port fn1-handler] "derefable val if taken, nil if take was enqueued")) 15 | 16 | (defprotocol WritePort 17 | (put! [port val fn1-handler] "derefable boolean (false if already closed) if handled, nil if put was enqueued. 18 | Must throw on nil val.")) 19 | 20 | (defprotocol Channel 21 | (close! [chan]) 22 | (closed? [chan])) 23 | 24 | (defprotocol Handler 25 | (active? [h] "returns true if has callback. Must work w/o lock") 26 | #_(lock-id [h] "a unique id for lock acquisition order, 0 if no lock") 27 | (commit [h] "commit to fulfilling its end of the transfer, returns cb. Must be called within lock")) 28 | 29 | (defprotocol Buffer 30 | (full? [b]) 31 | (remove! [b]) 32 | (add!* [b itm])) 33 | 34 | (defn add! 35 | ([b] b) 36 | ([b itm] 37 | (assert (not (nil? itm))) 38 | (add!* b itm))) 39 | 40 | ;; Defines a buffer that will never block (return true to full?) 41 | (defprotocol UnblockingBuffer) 42 | -------------------------------------------------------------------------------- /out/cljs/repl.cljs: -------------------------------------------------------------------------------- 1 | ;; Copyright (c) Rich Hickey. All rights reserved. 2 | ;; The use and distribution terms for this software are covered by the 3 | ;; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php) 4 | ;; which can be found in the file epl-v10.html at the root of this distribution. 5 | ;; By using this software in any fashion, you are agreeing to be bound by 6 | ;; the terms of this license. 7 | ;; You must not remove this notice, or any other, from this software. 8 | 9 | (ns cljs.repl 10 | (:require-macros cljs.repl)) 11 | 12 | (defn print-doc [m] 13 | (println "-------------------------") 14 | (println (str (when-let [ns (:ns m)] (str ns "/")) (:name m))) 15 | (when (:protocol m) 16 | (println "Protocol")) 17 | (cond 18 | (:forms m) (doseq [f (:forms m)] 19 | (println " " f)) 20 | (:arglists m) (let [arglists (:arglists m)] 21 | (if (or (:macro m) 22 | (:repl-special-function m)) 23 | (prn arglists) 24 | (prn 25 | (if (= 'quote (first arglists)) 26 | (second arglists) 27 | arglists))))) 28 | (if (:special-form m) 29 | (do 30 | (println "Special Form") 31 | (println " " (:doc m)) 32 | (if (contains? m :url) 33 | (when (:url m) 34 | (println (str "\n Please see http://clojure.org/" (:url m)))) 35 | (println (str "\n Please see http://clojure.org/special_forms#" 36 | (:name m))))) 37 | (do 38 | (when (:macro m) 39 | (println "Macro")) 40 | (when (:repl-special-function m) 41 | (println "REPL Special Function")) 42 | (println " " (:doc m)) 43 | (when (:protocol m) 44 | (doseq [[name {:keys [doc arglists]}] (:methods m)] 45 | (println) 46 | (println " " name) 47 | (println " " arglists) 48 | (when doc 49 | (println " " doc))))))) 50 | -------------------------------------------------------------------------------- /out/cljs/repl.cljs.cache.edn: -------------------------------------------------------------------------------- 1 | ;; Analyzed by ClojureScript 0.0-3308 2 | {:use-macros nil, :excludes #{}, :name cljs.repl, :imports nil, :requires nil, :uses nil, :defs {print-doc {:protocol-inline nil, :meta {:file "/Users/james/projects/cljs-draw/out/cljs/repl.cljs", :line 12, :column 7, :end-line 12, :end-column 16, :arglists (quote ([m]))}, :name cljs.repl/print-doc, :variadic false, :file "out/cljs/repl.cljs", :end-column 16, :method-params ([m]), :protocol-impl nil, :arglists-meta (nil nil), :column 1, :line 12, :end-line 12, :max-fixed-arity 1, :fn-var true, :arglists (quote ([m]))}}, :require-macros {cljs.repl cljs.repl}, :cljs.analyzer/constants {:seen #{:protocol :ns :name :special-form :repl-special-function :methods :macro :url :arglists :doc :forms}, :order [:ns :name :protocol :forms :arglists :macro :repl-special-function :special-form :doc :url :methods]}, :doc nil} -------------------------------------------------------------------------------- /out/cljs/repl.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"\/Users\/james\/projects\/cljs-draw\/out\/cljs\/repl.js","sources":["repl.cljs"],"lineCount":207,"mappings":";AAQA;;AAGA,sBAAA,tBAAMA,oDAAWC;AAAjB,AACE,4BAAA,5BAACC;;AACD,AAACA,4BAAQ,eAAK,iBAAAC,qBAAc,AAAA,8EAAKF;AAAnB,AAAA,oBAAAE;AAAA,AAAA,SAAAA,LAAWC;AAAX,AAAuB,wCAAA,lBAAKA;;AAA5B;;oBAAqC,AAAA,mFAAOH;;AAC1D,oBAAM,AAAA,0FAAWA;AAAjB,AACE,4BAAA,5BAACC;;AADH;;AAEA,oBACE,AAAA,qFAAQD;AAAG,IAAAI,mBAAA,AAAAC,wBAAU,AAAA,qFAAQL;IAAlBM,qBAAA;IAAAC,qBAAA;IAAAC,iBAAA;;AAAA,AAAA,GAAA,AAAA,CAAAA,iBAAAD;AAAA,cAAA,AAAAE,yBAAAH,mBAAAE,tDAAQS;AAAR,AAAA,AACE,4BAAA,5BAAChB,iCAAagB;;AADhB,eAAAb;eAAAE;eAAAC;eAAA,CAAAC,iBAAA;;;;;;;AAAA,IAAAN,2BAAA,AAAAG,wBAAAD;AAAA,AAAA,GAAAF;AAAA,AAAA,IAAAE,uBAAAF;AAAA,AAAA,GAAA,AAAAQ,uCAAAN;AAAA,IAAAO,wBAAA,AAAAC,gCAAAR;AAAA,AAAA,eAAA,AAAAS,+BAAAT;eAAAO;eAAA,AAAAG,0BAAAH;eAAA;;;;;;;AAAA,cAAA,AAAAI,0BAAAX,pCAAQa;AAAR,AAAA,AACE,4BAAA,5BAAChB,iCAAagB;;AADhB,eAAA,AAAAD,yBAAAZ;eAAA;eAAA;eAAA;;;;;;;;AAAA;;;;;AADb,oBAGE,AAAA,2FAAWJ;AAAG,IAAMkB,iBAAS,AAAA,2FAAWlB;AAA1B,AACE,oBAAI,iBAAAmB,mBAAI,AAAA,qFAAQnB;AAAZ,AAAA,oBAAAmB;AAAAA;;AACC,OAAA,qHAAwBnB;;;AAC5B,AAACoB,wBAAIF;;AACL,AAACE,wBACC,EAAI,yBAAA,zBAACC,oFAAS,AAACN,0BAAMG,kBACnB,AAACI,2BAAOJ,gBACRA;;;AAVvB;;;AAWA,oBAAI,AAAA,oGAAelB;AACjB,AACE,4BAAA,5BAACC;;AACD,4BAAA,5BAACA,gCAAY,AAAA,iFAAMD;;AACnB,GAAI,sCAAA,tCAACuB,oCAAUvB;AACb,oBAAM,AAAA,gFAAMA;AAAZ,AACE,OAACC,4BAAQ,eAAA,oDAA0C,AAAA,gFAAMD;;AAD3D;;;AAEA,OAACC,4BAAQ,eAAA,kEACE,AAAA,mFAAOD;;;AACtB,AACE,oBAAM,AAAA,qFAAQA;AAAd,AACE,4BAAA,5BAACC;;AADH;;AAEA,oBAAM,AAAA,qHAAwBD;AAA9B,AACE,4BAAA,5BAACC;;AADH;;AAEA,4BAAA,5BAACA,gCAAY,AAAA,iFAAMD;;AACnB,oBAAM,AAAA,0FAAWA;AAAjB,AACE,IAAAwB,aAAA,AAAAnB,wBAAsC,AAAA,wFAAUL;IAAhDyB,eAAA;IAAAC,eAAA;IAAAC,WAAA;;AAAA,AAAA,GAAA,AAAA,CAAAA,WAAAD;AAAA,IAAAE,aAAA,AAAAnB,yBAAAgB,aAAAE;WAAA,AAAAE,wBAAAD,WAAA,IAAA,9CAASS;IAATP,aAAA,AAAAD,wBAAAD,WAAA,IAAA;IAAAE,iBAAA,EAAA,AAAAC,+BAAAD,aAAA,AAAAE,0BAAAC,mBAAAH,YAAAA;UAAA,AAAAI,wBAAAJ,eAAA,7CAAsBQ;eAAtB,AAAAJ,wBAAAJ,eAAA,lDAA0BZ;AAA1B,AAAA,AACE,AAACjB;;AACD,4BAAA,5BAACA,gCAAYoC;;AACb,4BAAA,5BAACpC,gCAAYiB;;AACb,oBAAMoB;AAAN,AACE,4BAAA,5BAACrC,gCAAYqC;;AADf;;AAJF,eAAAd;eAAAC;eAAAC;eAAA,CAAAC,WAAA;;;;;;;AAAA,IAAAzB,qBAAA,AAAAG,wBAAAmB;AAAA,AAAA,GAAAtB;AAAA,AAAA,IAAAsB,iBAAAtB;AAAA,AAAA,GAAA,AAAAQ,uCAAAc;AAAA,IAAAb,kBAAA,AAAAC,gCAAAY;AAAA,AAAA,eAAA,AAAAX,+BAAAW;eAAAb;eAAA,AAAAG,0BAAAH;eAAA;;;;;;;AAAA,IAAAwB,aAAA,AAAApB,0BAAAS;WAAA,AAAAK,wBAAAM,WAAA,IAAA,9CAASE;IAATD,aAAA,AAAAP,wBAAAM,WAAA,IAAA;IAAAC,iBAAA,EAAA,AAAAL,+BAAAK,aAAA,AAAAJ,0BAAAC,mBAAAG,YAAAA;UAAA,AAAAF,wBAAAE,eAAA,7CAAsBE;eAAtB,AAAAJ,wBAAAE,eAAA,lDAA0BlB;AAA1B,AAAA,AACE,AAACjB;;AACD,4BAAA,5BAACA,gCAAYoC;;AACb,4BAAA,5BAACpC,gCAAYiB;;AACb,oBAAMoB;AAAN,AACE,4BAAA,5BAACrC,gCAAYqC;;AADf;;AAJF,eAAA,AAAAtB,yBAAAQ;eAAA;eAAA;eAAA;;;;;;;;AAAA;;;;;;AADF","names":["cljs.repl\/print-doc","m","cljs.core\/println","temp__4423__auto__","ns","seq__20811","cljs.core\/seq","chunk__20812","count__20813","i__20814","cljs.core\/-nth","cljs.core\/chunked-seq?","c__5738__auto__","cljs.core\/chunk-first","cljs.core\/chunk-rest","cljs.core\/count","cljs.core\/first","cljs.core\/next","f","arglists","or__4953__auto__","cljs.core\/prn","cljs.core\/=","cljs.core\/second","cljs.core\/contains?","seq__20815","chunk__20816","count__20817","i__20818","vec__20819","cljs.core\/nth","map__20820","cljs.core\/seq?","cljs.core\/apply","cljs.core\/hash-map","cljs.core\/get","vec__20821","map__20822","name","doc"]} -------------------------------------------------------------------------------- /out/cljs_draw/util.cljs: -------------------------------------------------------------------------------- 1 | (ns cljs_draw.util 2 | (:require [goog.events :as events] 3 | [cljs.core.async :refer [clj EventType)))))) 31 | 32 | (when (exists? js/Element) 33 | (extend-protocol IEventType 34 | 35 | js/Element 36 | (event-types 37 | [this] 38 | (into {} 39 | (map 40 | (fn [[k v]] 41 | [(keyword (.toLowerCase k)) 42 | v]) 43 | (merge 44 | (js->clj EventType))))))) 45 | 46 | (defn listen 47 | ([src type fn] 48 | (listen src type fn false)) 49 | ([src type fn capture?] 50 | (events/listen src 51 | (get (event-types src) type type) 52 | fn 53 | capture?))) 54 | 55 | (defn listen-once 56 | ([src type fn] 57 | (listen-once src type fn false)) 58 | ([src type fn capture?] 59 | (events/listenOnce src 60 | (get (event-types src) type type) 61 | fn 62 | capture?))) 63 | 64 | (defn unlisten 65 | ([src type fn] 66 | (unlisten src type fn false)) 67 | ([src type fn capture?] 68 | (events/unlisten src 69 | (get (event-types src) type type) 70 | fn 71 | capture?))) 72 | 73 | (defn unlisten-by-key 74 | [key] 75 | (events/unlistenByKey key)) 76 | 77 | (defn dispatch-event 78 | [src event] 79 | (events/dispatchEvent src event)) 80 | 81 | (defn expose [e] 82 | (events/expose e)) 83 | 84 | (defn fire-listeners 85 | [obj type capture event]) 86 | 87 | (defn total-listener-count [] 88 | (events/getTotalListenerCount)) 89 | 90 | ;; TODO 91 | (defn get-listener [src type listener opt_capt opt_handler]); ⇒ ?Listener 92 | (defn all-listeners [obj type capture]); ⇒ Array. 93 | 94 | (defn unique-event-id [event-type]); ⇒ string 95 | 96 | (defn has-listener [obj opt_type opt_capture]); ⇒ boolean 97 | ;; TODO? (defn listen-with-wrapper [src wrapper listener opt_capt opt_handler]) 98 | ;; TODO? (defn protect-browser-event-entry-point [errorHandler]) 99 | 100 | (defn remove-all [opt_obj opt_type opt_capt]); ⇒ number 101 | ;; TODO? (defn unlisten-with-wrapper [src wrapper listener opt_capt opt_handler]) 102 | -------------------------------------------------------------------------------- /out/clojure/core/rrb_vector.cljs: -------------------------------------------------------------------------------- 1 | (ns clojure.core.rrb-vector 2 | 3 | "An implementation of the confluently persistent vector data 4 | structure introduced in Bagwell, Rompf, \"RRB-Trees: Efficient 5 | Immutable Vectors\", EPFL-REPORT-169879, September, 2011. 6 | 7 | RRB-Trees build upon Clojure's PersistentVectors, adding logarithmic 8 | time concatenation and slicing. 9 | 10 | The main API entry points are clojure.core.rrb-vector/catvec, 11 | performing vector concatenation, and clojure.core.rrb-vector/subvec, 12 | which produces a new vector containing the appropriate subrange of 13 | the input vector (in contrast to cljs.core/subvec, which returns a 14 | view on the input vector). 15 | 16 | The implementation allows for seamless interoperability with 17 | cljs.core/PersistentVector and cljs.core.Subvec instances: 18 | clojure.core.rrb-vector/catvec and clojure.core.rrb-vector/subvec 19 | convert their inputs to clojure.core.rrb-vector.rrbt/Vector 20 | instances whenever necessary (this is a very fast constant time 21 | operation for PersistentVector; for Subvec it is O(log n), where n 22 | is the size of the underlying vector). 23 | 24 | clojure.core.rrb-vector also exports its own versions of vector and 25 | vec which always produce clojure.core.rrb-vector.rrbt.Vector 26 | instances." 27 | 28 | {:author "Michał Marczyk"} 29 | 30 | (:refer-clojure :exclude [vector vec subvec]) 31 | (:require [clojure.core.rrb-vector.protocols :refer [-slicev -splicev]] 32 | [clojure.core.rrb-vector.rrbt :refer [-as-rrbt]] 33 | clojure.core.rrb-vector.interop) 34 | (:require-macros [clojure.core.rrb-vector.macros :refer [gen-vector-method]])) 35 | 36 | (defn catvec 37 | "Concatenates the given vectors in logarithmic time." 38 | ([] 39 | []) 40 | ([v1] 41 | v1) 42 | ([v1 v2] 43 | (-splicev v1 v2)) 44 | ([v1 v2 v3] 45 | (-splicev (-splicev v1 v2) v3)) 46 | ([v1 v2 v3 v4] 47 | (-splicev (-splicev v1 v2) (-splicev v3 v4))) 48 | ([v1 v2 v3 v4 & vn] 49 | (-splicev (-splicev (-splicev v1 v2) (-splicev v3 v4)) 50 | (apply catvec vn)))) 51 | 52 | (defn subvec 53 | "Returns a new vector containing the elements of the given vector v 54 | lying between the start (inclusive) and end (exclusive) indices in 55 | logarithmic time. end defaults to end of vector. The resulting 56 | vector shares structure with the original, but does not hold on to 57 | any elements of the original vector lying outside the given index 58 | range." 59 | ([v start] 60 | (-slicev v start (count v))) 61 | ([v start end] 62 | (-slicev v start end))) 63 | 64 | (defn vector 65 | "Creates a new vector containing the args." 66 | ([] 67 | (gen-vector-method)) 68 | ([x1] 69 | (gen-vector-method x1)) 70 | ([x1 x2] 71 | (gen-vector-method x1 x2)) 72 | ([x1 x2 x3] 73 | (gen-vector-method x1 x2 x3)) 74 | ([x1 x2 x3 x4] 75 | (gen-vector-method x1 x2 x3 x4)) 76 | ([x1 x2 x3 x4 & xn] 77 | (into (vector x1 x2 x3 x4) xn) 78 | #_ 79 | (loop [v (vector x1 x2 x3 x4) 80 | xn xn] 81 | (if xn 82 | (recur (-conj ^not-native v (first xn)) 83 | (next xn)) 84 | v)))) 85 | 86 | (defn vec 87 | "Returns a vector containing the contents of coll. 88 | 89 | If coll is a vector, returns an RRB vector using the internal tree 90 | of coll." 91 | [coll] 92 | (if (vector? coll) 93 | (-as-rrbt coll) 94 | (apply vector coll))) 95 | -------------------------------------------------------------------------------- /out/clojure/core/rrb_vector/interop.cljs: -------------------------------------------------------------------------------- 1 | (ns clojure.core.rrb-vector.interop 2 | (:require [clojure.core.rrb-vector.protocols 3 | :refer [PSliceableVector -slicev 4 | PSpliceableVector -splicev]] 5 | [clojure.core.rrb-vector.rrbt :refer [-as-rrbt]])) 6 | 7 | (extend-protocol PSliceableVector 8 | cljs.core/PersistentVector 9 | (-slicev [v start end] 10 | (-slicev (-as-rrbt v) start end)) 11 | 12 | cljs.core/Subvec 13 | (-slicev [v start end] 14 | (-slicev (-as-rrbt v) start end))) 15 | 16 | (extend-protocol PSpliceableVector 17 | cljs.core/PersistentVector 18 | (-splicev [v1 v2] 19 | (-splicev (-as-rrbt v1) v2)) 20 | 21 | cljs.core/Subvec 22 | (-splicev [v1 v2] 23 | (-splicev (-as-rrbt v1) v2))) 24 | -------------------------------------------------------------------------------- /out/clojure/core/rrb_vector/interop.cljs.cache.edn: -------------------------------------------------------------------------------- 1 | ;; Analyzed by ClojureScript 0.0-3308 2 | {:name clojure.core.rrb-vector.interop, :doc nil, :excludes #{}, :use-macros nil, :require-macros nil, :uses {-as-rrbt clojure.core.rrb-vector.rrbt, -slicev clojure.core.rrb-vector.protocols, PSliceableVector clojure.core.rrb-vector.protocols, -splicev clojure.core.rrb-vector.protocols, PSpliceableVector clojure.core.rrb-vector.protocols}, :requires {clojure.core.rrb-vector.protocols clojure.core.rrb-vector.protocols, clojure.core.rrb-vector.rrbt clojure.core.rrb-vector.rrbt}, :imports nil, :defs {PSliceableVector {:impls (cljs.core/Subvec cljs.core/PersistentVector)}, PSpliceableVector {:impls (cljs.core/Subvec cljs.core/PersistentVector)}}} -------------------------------------------------------------------------------- /out/clojure/core/rrb_vector/interop.js: -------------------------------------------------------------------------------- 1 | // Compiled by ClojureScript 0.0-3308 {} 2 | goog.provide('clojure.core.rrb_vector.interop'); 3 | goog.require('cljs.core'); 4 | goog.require('clojure.core.rrb_vector.protocols'); 5 | goog.require('clojure.core.rrb_vector.rrbt'); 6 | cljs.core.PersistentVector.prototype.clojure$core$rrb_vector$protocols$PSliceableVector$ = true; 7 | 8 | cljs.core.PersistentVector.prototype.clojure$core$rrb_vector$protocols$PSliceableVector$_slicev$arity$3 = (function (v,start,end){ 9 | var v__$1 = this; 10 | return clojure.core.rrb_vector.protocols._slicev.call(null,clojure.core.rrb_vector.rrbt._as_rrbt.call(null,v__$1),start,end); 11 | }); 12 | 13 | cljs.core.Subvec.prototype.clojure$core$rrb_vector$protocols$PSliceableVector$ = true; 14 | 15 | cljs.core.Subvec.prototype.clojure$core$rrb_vector$protocols$PSliceableVector$_slicev$arity$3 = (function (v,start,end){ 16 | var v__$1 = this; 17 | return clojure.core.rrb_vector.protocols._slicev.call(null,clojure.core.rrb_vector.rrbt._as_rrbt.call(null,v__$1),start,end); 18 | }); 19 | cljs.core.PersistentVector.prototype.clojure$core$rrb_vector$protocols$PSpliceableVector$ = true; 20 | 21 | cljs.core.PersistentVector.prototype.clojure$core$rrb_vector$protocols$PSpliceableVector$_splicev$arity$2 = (function (v1,v2){ 22 | var v1__$1 = this; 23 | return clojure.core.rrb_vector.protocols._splicev.call(null,clojure.core.rrb_vector.rrbt._as_rrbt.call(null,v1__$1),v2); 24 | }); 25 | 26 | cljs.core.Subvec.prototype.clojure$core$rrb_vector$protocols$PSpliceableVector$ = true; 27 | 28 | cljs.core.Subvec.prototype.clojure$core$rrb_vector$protocols$PSpliceableVector$_splicev$arity$2 = (function (v1,v2){ 29 | var v1__$1 = this; 30 | return clojure.core.rrb_vector.protocols._splicev.call(null,clojure.core.rrb_vector.rrbt._as_rrbt.call(null,v1__$1),v2); 31 | }); 32 | 33 | //# sourceMappingURL=interop.js.map -------------------------------------------------------------------------------- /out/clojure/core/rrb_vector/interop.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"\/Users\/james\/projects\/cljs-draw\/out\/clojure\/core\/rrb_vector\/interop.js","sources":["interop.cljs"],"lineCount":33,"mappings":";AAAA;;;;AAMA,AAAA,AAAA,AAAA,AAAA,2FAAA,3FACEA;;AADF,AAAA,AAAA,AACEA,0GACA,WAAUC,EAAEC,MAAMC;AAAlB,AAAA,YAAA,RAAUF;AAAV,AACE,OAACG,oDAAQ,AAACC,gDAASJ,OAAGC,MAAMC;;;AAHhC,AAAA,AAAA,AAAA,iFAAA,jFAKEG;;AALF,AAAA,AAAA,AAKEA,gGACA,WAAUL,EAAEC,MAAMC;AAAlB,AAAA,YAAA,RAAUF;AAAV,AACE,OAACG,oDAAQ,AAACC,gDAASJ,OAAGC,MAAMC;;AAEhC,AAAA,AAAA,AAAA,AAAA,4FAAA,5FACEH;;AADF,AAAA,AAAA,AACEA,4GACA,WAAWO,GAAGC;AAAd,AAAA,aAAA,TAAWD;AAAX,AACE,OAACE,qDAAS,AAACJ,gDAASE,QAAIC;;;AAH5B,AAAA,AAAA,AAAA,kFAAA,lFAKEF;;AALF,AAAA,AAAA,AAKEA,kGACA,WAAWC,GAAGC;AAAd,AAAA,aAAA,TAAWD;AAAX,AACE,OAACE,qDAAS,AAACJ,gDAASE,QAAIC","names":["cljs.core\/PersistentVector","v","start","end","clojure.core.rrb-vector.protocols\/-slicev","clojure.core.rrb-vector.rrbt\/-as-rrbt","cljs.core\/Subvec","v1","v2","clojure.core.rrb-vector.protocols\/-splicev"]} -------------------------------------------------------------------------------- /out/clojure/core/rrb_vector/protocols.cljs: -------------------------------------------------------------------------------- 1 | (ns clojure.core.rrb-vector.protocols) 2 | 3 | (defprotocol PSpliceableVector 4 | (-splicev [v1 v2])) 5 | 6 | (defprotocol PSliceableVector 7 | (-slicev [v start end])) 8 | -------------------------------------------------------------------------------- /out/clojure/core/rrb_vector/protocols.cljs.cache.edn: -------------------------------------------------------------------------------- 1 | ;; Analyzed by ClojureScript 0.0-3308 2 | {:name clojure.core.rrb-vector.protocols, :doc nil, :excludes #{}, :use-macros nil, :require-macros nil, :uses nil, :requires nil, :imports nil, :defs {PSpliceableVector {:meta {:file "/Users/james/projects/cljs-draw/out/clojure/core/rrb_vector/protocols.cljs", :line 3, :column 14, :end-line 3, :end-column 31, :doc nil, :protocol-symbol true, :protocol-info {:methods {-splicev [[v1 v2]]}}}, :protocol-symbol true, :name clojure.core.rrb-vector.protocols/PSpliceableVector, :file "out/clojure/core/rrb_vector/protocols.cljs", :end-column 31, :column 1, :line 3, :protocol-info {:methods {-splicev [[v1 v2]]}}, :info nil, :end-line 3, :impls #{}, :doc nil}, -splicev {:protocol-inline nil, :meta {:file "/Users/james/projects/cljs-draw/out/clojure/core/rrb_vector/protocols.cljs", :line 4, :column 4, :end-line 4, :end-column 12, :protocol clojure.core.rrb-vector.protocols/PSpliceableVector, :doc nil, :arglists (quote ([v1 v2]))}, :protocol clojure.core.rrb-vector.protocols/PSpliceableVector, :name clojure.core.rrb-vector.protocols/-splicev, :variadic false, :file "out/clojure/core/rrb_vector/protocols.cljs", :end-column 12, :method-params ([v1 v2]), :protocol-impl nil, :arglists-meta (nil nil), :column 1, :line 3, :end-line 4, :max-fixed-arity 2, :fn-var true, :arglists (quote ([v1 v2])), :doc nil}, PSliceableVector {:meta {:file "/Users/james/projects/cljs-draw/out/clojure/core/rrb_vector/protocols.cljs", :line 6, :column 14, :end-line 6, :end-column 30, :doc nil, :protocol-symbol true, :protocol-info {:methods {-slicev [[v start end]]}}}, :protocol-symbol true, :name clojure.core.rrb-vector.protocols/PSliceableVector, :file "out/clojure/core/rrb_vector/protocols.cljs", :end-column 30, :column 1, :line 6, :protocol-info {:methods {-slicev [[v start end]]}}, :info nil, :end-line 6, :impls #{}, :doc nil}, -slicev {:protocol-inline nil, :meta {:file "/Users/james/projects/cljs-draw/out/clojure/core/rrb_vector/protocols.cljs", :line 7, :column 4, :end-line 7, :end-column 11, :protocol clojure.core.rrb-vector.protocols/PSliceableVector, :doc nil, :arglists (quote ([v start end]))}, :protocol clojure.core.rrb-vector.protocols/PSliceableVector, :name clojure.core.rrb-vector.protocols/-slicev, :variadic false, :file "out/clojure/core/rrb_vector/protocols.cljs", :end-column 11, :method-params ([v start end]), :protocol-impl nil, :arglists-meta (nil nil), :column 1, :line 6, :end-line 7, :max-fixed-arity 3, :fn-var true, :arglists (quote ([v start end])), :doc nil}}} -------------------------------------------------------------------------------- /out/clojure/core/rrb_vector/protocols.js: -------------------------------------------------------------------------------- 1 | // Compiled by ClojureScript 0.0-3308 {} 2 | goog.provide('clojure.core.rrb_vector.protocols'); 3 | goog.require('cljs.core'); 4 | 5 | clojure.core.rrb_vector.protocols.PSpliceableVector = (function (){var obj20748 = {}; 6 | return obj20748; 7 | })(); 8 | 9 | clojure.core.rrb_vector.protocols._splicev = (function clojure$core$rrb_vector$protocols$_splicev(v1,v2){ 10 | if((function (){var and__4941__auto__ = v1; 11 | if(and__4941__auto__){ 12 | return v1.clojure$core$rrb_vector$protocols$PSpliceableVector$_splicev$arity$2; 13 | } else { 14 | return and__4941__auto__; 15 | } 16 | })()){ 17 | return v1.clojure$core$rrb_vector$protocols$PSpliceableVector$_splicev$arity$2(v1,v2); 18 | } else { 19 | var x__5589__auto__ = (((v1 == null))?null:v1); 20 | return (function (){var or__4953__auto__ = (clojure.core.rrb_vector.protocols._splicev[goog.typeOf(x__5589__auto__)]); 21 | if(or__4953__auto__){ 22 | return or__4953__auto__; 23 | } else { 24 | var or__4953__auto____$1 = (clojure.core.rrb_vector.protocols._splicev["_"]); 25 | if(or__4953__auto____$1){ 26 | return or__4953__auto____$1; 27 | } else { 28 | throw cljs.core.missing_protocol.call(null,"PSpliceableVector.-splicev",v1); 29 | } 30 | } 31 | })().call(null,v1,v2); 32 | } 33 | }); 34 | 35 | 36 | clojure.core.rrb_vector.protocols.PSliceableVector = (function (){var obj20750 = {}; 37 | return obj20750; 38 | })(); 39 | 40 | clojure.core.rrb_vector.protocols._slicev = (function clojure$core$rrb_vector$protocols$_slicev(v,start,end){ 41 | if((function (){var and__4941__auto__ = v; 42 | if(and__4941__auto__){ 43 | return v.clojure$core$rrb_vector$protocols$PSliceableVector$_slicev$arity$3; 44 | } else { 45 | return and__4941__auto__; 46 | } 47 | })()){ 48 | return v.clojure$core$rrb_vector$protocols$PSliceableVector$_slicev$arity$3(v,start,end); 49 | } else { 50 | var x__5589__auto__ = (((v == null))?null:v); 51 | return (function (){var or__4953__auto__ = (clojure.core.rrb_vector.protocols._slicev[goog.typeOf(x__5589__auto__)]); 52 | if(or__4953__auto__){ 53 | return or__4953__auto__; 54 | } else { 55 | var or__4953__auto____$1 = (clojure.core.rrb_vector.protocols._slicev["_"]); 56 | if(or__4953__auto____$1){ 57 | return or__4953__auto____$1; 58 | } else { 59 | throw cljs.core.missing_protocol.call(null,"PSliceableVector.-slicev",v); 60 | } 61 | } 62 | })().call(null,v,start,end); 63 | } 64 | }); 65 | 66 | 67 | //# sourceMappingURL=protocols.js.map -------------------------------------------------------------------------------- /out/clojure/core/rrb_vector/protocols.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"\/Users\/james\/projects\/cljs-draw\/out\/clojure\/core\/rrb_vector\/protocols.js","sources":["protocols.cljs"],"lineCount":67,"mappings":";AAAA;;AAEA,AAAA;AAAA,sDAAA,iBAAAA,WAAA,lFAAaO;AAAb,AAAAP;;;AAAA,6CAAA,7CACGQ,kGAAUC,GAAGC;AADhB,AAAA,GAAA,iBAAAT,oBACaQ;AADb,AAAA,GAAAR;AAAA,OACaQ;;AADbR;;;AAAA,OACaQ,wEAAAA,GAAGC;;AADhB,IAAAR,kBAAA,EAAA,OAAA,OAAA,bACaO,kBAAAA;AADb,AAAA,OAAA,iBAAAN,mBAAA,CAAAC,2CAAA,AAAAC,YAAAH;AAAA,AAAA,GAAAC;AAAAA;;AAAA,IAAAA,uBAAA,CAAAC,2CAAA;AAAA,AAAA,GAAAD;AAAAA;;AAAA,MAAA,AAAAG,qCAAA,6BACaG;;;eAAAA,GAAGC;;;;AADhB,AAGA,AAAA;AAAA,qDAAA,iBAAAC,WAAA,jFAAaE;AAAb,AAAAF;;;AAAA,4CAAA,5CACGG,gGAASC,EAAEC,MAAMC;AADpB,AAAA,GAAA,iBAAAhB,oBACYc;AADZ,AAAA,GAAAd;AAAA,OACYc;;AADZd;;;AAAA,OACYc,qEAAAA,EAAEC,MAAMC;;AADpB,IAAAf,kBAAA,EAAA,MAAA,OAAA,ZACYa,iBAAAA;AADZ,AAAA,OAAA,iBAAAZ,mBAAA,CAAAS,0CAAA,AAAAP,YAAAH;AAAA,AAAA,GAAAC;AAAAA;;AAAA,IAAAA,uBAAA,CAAAS,0CAAA;AAAA,AAAA,GAAAT;AAAAA;;AAAA,MAAA,AAAAG,qCAAA,2BACYS;;;eAAAA,EAAEC,MAAMC;;;;AADpB","names":["obj20748","and__4941__auto__","x__5589__auto__","or__4953__auto__","clojure\/core.rrb-vector.protocols.-splicev","goog\/typeOf","cljs.core\/missing-protocol","clojure.core.rrb-vector.protocols\/PSpliceableVector","clojure.core.rrb-vector.protocols\/-splicev","v1","v2","obj20750","clojure\/core.rrb-vector.protocols.-slicev","clojure.core.rrb-vector.protocols\/PSliceableVector","clojure.core.rrb-vector.protocols\/-slicev","v","start","end"]} -------------------------------------------------------------------------------- /out/clojure/core/rrb_vector/trees.cljs.cache.edn: -------------------------------------------------------------------------------- 1 | ;; Analyzed by ClojureScript 0.0-3308 2 | {:use-macros nil, :excludes #{push-tail new-path do-assoc pop-tail array-for}, :name clojure.core.rrb-vector.trees, :imports nil, :requires {clojure.core.rrb-vector.nodes clojure.core.rrb-vector.nodes}, :uses {ranges clojure.core.rrb-vector.nodes, regular? clojure.core.rrb-vector.nodes, last-range clojure.core.rrb-vector.nodes, clone clojure.core.rrb-vector.nodes}, :defs {tail-offset {:protocol-inline nil, :meta {:file "/Users/james/projects/cljs-draw/out/clojure/core/rrb_vector/trees.cljs", :line 6, :column 7, :end-line 6, :end-column 18, :arglists (quote ([cnt tail]))}, :name clojure.core.rrb-vector.trees/tail-offset, :variadic false, :file "out/clojure/core/rrb_vector/trees.cljs", :end-column 18, :method-params ([cnt tail]), :protocol-impl nil, :arglists-meta (nil nil), :column 1, :line 6, :end-line 6, :max-fixed-arity 2, :fn-var true, :arglists (quote ([cnt tail]))}, array-for {:protocol-inline nil, :meta {:file "/Users/james/projects/cljs-draw/out/clojure/core/rrb_vector/trees.cljs", :line 9, :column 7, :end-line 9, :end-column 16, :arglists (quote ([cnt shift root tail i]))}, :name clojure.core.rrb-vector.trees/array-for, :variadic false, :file "out/clojure/core/rrb_vector/trees.cljs", :end-column 16, :method-params ([cnt shift root tail i]), :protocol-impl nil, :arglists-meta (nil nil), :column 1, :line 9, :end-line 9, :max-fixed-arity 5, :fn-var true, :arglists (quote ([cnt shift root tail i]))}, new-path {:protocol-inline nil, :meta {:file "/Users/james/projects/cljs-draw/out/clojure/core/rrb_vector/trees.cljs", :line 38, :column 7, :end-line 38, :end-column 15, :arglists (quote ([tail edit shift current-node]))}, :name clojure.core.rrb-vector.trees/new-path, :variadic false, :file "out/clojure/core/rrb_vector/trees.cljs", :end-column 15, :method-params ([tail edit shift current-node]), :protocol-impl nil, :arglists-meta (nil nil), :column 1, :line 38, :end-line 38, :max-fixed-arity 4, :fn-var true, :arglists (quote ([tail edit shift current-node]))}, push-tail {:protocol-inline nil, :meta {:file "/Users/james/projects/cljs-draw/out/clojure/core/rrb_vector/trees.cljs", :line 59, :column 7, :end-line 59, :end-column 16, :arglists (quote ([shift cnt root-edit current-node tail-node]))}, :name clojure.core.rrb-vector.trees/push-tail, :variadic false, :file "out/clojure/core/rrb_vector/trees.cljs", :end-column 16, :method-params ([shift cnt root-edit current-node tail-node]), :protocol-impl nil, :arglists-meta (nil nil), :column 1, :line 59, :end-line 59, :max-fixed-arity 5, :fn-var true, :arglists (quote ([shift cnt root-edit current-node tail-node]))}, pop-tail {:protocol-inline nil, :meta {:file "/Users/james/projects/cljs-draw/out/clojure/core/rrb_vector/trees.cljs", :line 106, :column 7, :end-line 106, :end-column 15, :arglists (quote ([shift cnt root-edit current-node]))}, :name clojure.core.rrb-vector.trees/pop-tail, :variadic false, :file "out/clojure/core/rrb_vector/trees.cljs", :end-column 15, :method-params ([shift cnt root-edit current-node]), :protocol-impl nil, :arglists-meta (nil nil), :column 1, :line 106, :end-line 106, :max-fixed-arity 4, :fn-var true, :arglists (quote ([shift cnt root-edit current-node]))}, do-assoc {:protocol-inline nil, :meta {:file "/Users/james/projects/cljs-draw/out/clojure/core/rrb_vector/trees.cljs", :line 178, :column 7, :end-line 178, :end-column 15, :arglists (quote ([shift current-node i val]))}, :name clojure.core.rrb-vector.trees/do-assoc, :variadic false, :file "out/clojure/core/rrb_vector/trees.cljs", :end-column 15, :method-params ([shift current-node i val]), :protocol-impl nil, :arglists-meta (nil nil), :column 1, :line 178, :end-line 178, :max-fixed-arity 4, :fn-var true, :arglists (quote ([shift current-node i val]))}}, :require-macros nil, :cljs.analyzer/constants {:seen #{:else}, :order [:else]}, :doc nil} -------------------------------------------------------------------------------- /out/clojure/walk.cljs: -------------------------------------------------------------------------------- 1 | ; Copyright (c) Rich Hickey. All rights reserved. 2 | ; The use and distribution terms for this software are covered by the 3 | ; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php) 4 | ; which can be found in the file epl-v10.html at the root of this distribution. 5 | ; By using this software in any fashion, you are agreeing to be bound by 6 | ; the terms of this license. 7 | ; You must not remove this notice, or any other, from this software. 8 | 9 | ;;; walk.cljs - generic tree walker with replacement 10 | 11 | ;; by Stuart Sierra 12 | ;; Jul5 17, 2011 13 | 14 | ;; CHANGE LOG: 15 | ;; 16 | ;; * July 17, 2011: Port to ClojureScript 17 | ;; 18 | ;; * December 15, 2008: replaced 'walk' with 'prewalk' & 'postwalk' 19 | ;; 20 | ;; * December 9, 2008: first version 21 | 22 | 23 | (ns 24 | ^{:author "Stuart Sierra", 25 | :doc "This file defines a generic tree walker for Clojure data 26 | structures. It takes any data structure (list, vector, map, set, 27 | seq), calls a function on every element, and uses the return value 28 | of the function in place of the original. This makes it fairly 29 | easy to write recursive search-and-replace functions, as shown in 30 | the examples. 31 | 32 | Note: \"walk\" supports all Clojure data structures EXCEPT maps 33 | created with sorted-map-by. There is no (obvious) way to retrieve 34 | the sorting function."} 35 | clojure.walk) 36 | 37 | (defn walk 38 | "Traverses form, an arbitrary data structure. inner and outer are 39 | functions. Applies inner to each element of form, building up a 40 | data structure of the same type, then applies outer to the result. 41 | Recognizes all Clojure data structures. Consumes seqs as with doall." 42 | 43 | {:added "1.1"} 44 | [inner outer form] 45 | (cond 46 | (seq? form) (outer (doall (map inner form))) 47 | (coll? form) (outer (into (empty form) (map inner form))) 48 | :else (outer form))) 49 | 50 | (defn postwalk 51 | "Performs a depth-first, post-order traversal of form. Calls f on 52 | each sub-form, uses f's return value in place of the original. 53 | Recognizes all Clojure data structures. Consumes seqs as with doall." 54 | {:added "1.1"} 55 | [f form] 56 | (walk (partial postwalk f) f form)) 57 | 58 | (defn prewalk 59 | "Like postwalk, but does pre-order traversal." 60 | {:added "1.1"} 61 | [f form] 62 | (walk (partial prewalk f) identity (f form))) 63 | 64 | (defn keywordize-keys 65 | "Recursively transforms all map keys from strings to keywords." 66 | {:added "1.1"} 67 | [m] 68 | (let [f (fn [[k v]] (if (string? k) [(keyword k) v] [k v]))] 69 | ;; only apply to maps 70 | (postwalk (fn [x] (if (map? x) (into {} (map f x)) x)) m))) 71 | 72 | (defn stringify-keys 73 | "Recursively transforms all map keys from keywords to strings." 74 | {:added "1.1"} 75 | [m] 76 | (let [f (fn [[k v]] (if (keyword? k) [(name k) v] [k v]))] 77 | ;; only apply to maps 78 | (postwalk (fn [x] (if (map? x) (into {} (map f x)) x)) m))) 79 | 80 | (defn prewalk-replace 81 | "Recursively transforms form by replacing keys in smap with their 82 | values. Like clojure/replace but works on any data structure. Does 83 | replacement at the root of the tree first." 84 | {:added "1.1"} 85 | [smap form] 86 | (prewalk (fn [x] (if (contains? smap x) (smap x) x)) form)) 87 | 88 | (defn postwalk-replace 89 | "Recursively transforms form by replacing keys in smap with their 90 | values. Like clojure/replace but works on any data structure. Does 91 | replacement at the leaves of the tree first." 92 | {:added "1.1"} 93 | [smap form] 94 | (postwalk (fn [x] (if (contains? smap x) (smap x) x)) form)) 95 | -------------------------------------------------------------------------------- /out/clojure/walk.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"\/Users\/james\/projects\/cljs-draw\/out\/clojure\/walk.js","sources":["walk.cljs"],"lineCount":113,"mappings":";AAsBA;;AAcA;;;;;;oBAAA,pBAAMA,gDAOHC,MAAMC,MAAMC;AAPf,AAQE,GACC,AAACC,+BAAKD;AAAM,OAACD,gBAAM,AAACG,0BAAM,AAACC,wBAAIL,MAAME;;AADtC,GAEC,AAACI,gCAAMJ;AAAM,OAACD,gBAAM,AAACM,yBAAK,AAACC,0BAAMN,MAAM,AAACG,wBAAIL,MAAME;;AAFnD,AAGO,OAACD,gBAAMC;;;;;AAEhB;;;;;wBAAA,xBAAMO,wDAKHC,EAAER;AALL,AAME,OAACH,4BAAK,AAACY,4BAAQC,sBAASF,GAAGA,EAAER;;AAE\/B;;;uBAAA,vBAAMW,sDAGHH,EAAER;AAHL,AAIE,OAACH,4BAAK,AAACY,4BAAQG,qBAAQJ,GAAGK,mBAAS,AAACL,YAAER;;AAExC;;;+BAAA,\/BAAMc,sEAGHC;AAHH,AAIE,IAAMP,IAAE,WAAAQ;AAAA,AAAA,IAAAC,aAAAD;QAAA,AAAAE,wBAAAD,WAAA,IAAA,3CAAME;QAAN,AAAAD,wBAAAD,WAAA,IAAA,3CAAQG;AAAR,AAAY,GAAI,OAASD;AAAb,0FAAiB,AAACE,4BAAQF,GAAGC;;AAA7B,0FAAiCD,EAAEC;;;AAAvD,AAEE,OAACb,gCAAS;kBAAKe;AAAL,AAAQ,GAAI,AAACC,+BAAKD;AAAG,gCAAA,zBAACjB,4DAAQ,AAACF,wBAAIK,EAAEc;;AAAIA;;;CAAIP;;AAE3D;;;8BAAA,9BAAMS,oEAGHT;AAHH,AAIE,IAAMP,IAAE,WAAAiB;AAAA,AAAA,IAAAC,aAAAD;QAAA,AAAAP,wBAAAQ,WAAA,IAAA,3CAAMP;QAAN,AAAAD,wBAAAQ,WAAA,IAAA,3CAAQN;AAAR,AAAY,GAAI,cAAAO,bAAUR;AAAd,0FAAkB,AAACS,yBAAKT,GAAGC;;AAA3B,0FAA+BD,EAAEC;;;AAArD,AAEE,OAACb,gCAAS;kBAAKe;AAAL,AAAQ,GAAI,AAACC,+BAAKD;AAAG,gCAAA,zBAACjB,4DAAQ,AAACF,wBAAIK,EAAEc;;AAAIA;;;CAAIP;;AAE3D;;;;;+BAAA,\/BAAMc,sEAKHC,KAAK9B;AALR,AAME,OAACW,+BAAQ,WAAKW;AAAL,AAAQ,GAAI,AAACS,oCAAUD,KAAKR;AAAG,OAACQ,eAAKR;;AAAGA;;GAAItB;;AAEvD;;;;;gCAAA,hCAAMgC,wEAKHF,KAAK9B;AALR,AAME,OAACO,gCAAS,WAAKe;AAAL,AAAQ,GAAI,AAACS,oCAAUD,KAAKR;AAAG,OAACQ,eAAKR;;AAAGA;;GAAItB","names":["clojure.walk\/walk","inner","outer","form","cljs.core\/seq?","cljs.core\/doall","cljs.core\/map","cljs.core\/coll?","cljs.core\/into","cljs.core\/empty","clojure.walk\/postwalk","f","cljs.core\/partial","postwalk","clojure.walk\/prewalk","prewalk","cljs.core\/identity","clojure.walk\/keywordize-keys","m","p__20358","vec__20359","cljs.core\/nth","k","v","cljs.core\/keyword","x","cljs.core\/map?","clojure.walk\/stringify-keys","p__20362","vec__20363","cljs.core\/Keyword","cljs.core\/name","clojure.walk\/prewalk-replace","smap","cljs.core\/contains?","clojure.walk\/postwalk-replace"]} -------------------------------------------------------------------------------- /out/fipp/deque.cljc: -------------------------------------------------------------------------------- 1 | (ns fipp.deque 2 | "Double-sided queue built on rrb vectors." 3 | (:refer-clojure :exclude [empty concat]) 4 | (:require [clojure.core.rrb-vector :as rrb])) 5 | 6 | (def create vector) 7 | 8 | (def empty []) 9 | 10 | (defn popl [v] 11 | (subvec v 1)) 12 | 13 | (def conjr (fnil conj empty)) 14 | 15 | (defn conjlr [l deque r] 16 | (rrb/catvec [l] deque [r])) 17 | 18 | (def concat rrb/catvec) 19 | -------------------------------------------------------------------------------- /out/fipp/deque.cljc.cache.edn: -------------------------------------------------------------------------------- 1 | ;; Analyzed by ClojureScript 0.0-3308 2 | {:name fipp.deque, :doc "Double-sided queue built on rrb vectors.", :excludes #{concat empty}, :use-macros nil, :require-macros nil, :uses nil, :requires {rrb clojure.core.rrb-vector, clojure.core.rrb-vector clojure.core.rrb-vector}, :imports nil, :defs {create {:name fipp.deque/create, :file "out/fipp/deque.cljc", :line 6, :column 1, :end-line 6, :end-column 12, :meta {:file "/Users/james/projects/cljs-draw/out/fipp/deque.cljc", :line 6, :column 6, :end-line 6, :end-column 12}}, empty {:name fipp.deque/empty, :file "out/fipp/deque.cljc", :line 8, :column 1, :end-line 8, :end-column 11, :meta {:file "/Users/james/projects/cljs-draw/out/fipp/deque.cljc", :line 8, :column 6, :end-line 8, :end-column 11}}, popl {:protocol-inline nil, :meta {:file "/Users/james/projects/cljs-draw/out/fipp/deque.cljc", :line 10, :column 7, :end-line 10, :end-column 11, :arglists (quote ([v]))}, :name fipp.deque/popl, :variadic false, :file "out/fipp/deque.cljc", :end-column 11, :method-params ([v]), :protocol-impl nil, :arglists-meta (nil nil), :column 1, :line 10, :end-line 10, :max-fixed-arity 1, :fn-var true, :arglists (quote ([v]))}, conjr {:name fipp.deque/conjr, :file "out/fipp/deque.cljc", :line 13, :column 1, :end-line 13, :end-column 11, :meta {:file "/Users/james/projects/cljs-draw/out/fipp/deque.cljc", :line 13, :column 6, :end-line 13, :end-column 11}}, conjlr {:protocol-inline nil, :meta {:file "/Users/james/projects/cljs-draw/out/fipp/deque.cljc", :line 15, :column 7, :end-line 15, :end-column 13, :arglists (quote ([l deque r]))}, :name fipp.deque/conjlr, :variadic false, :file "out/fipp/deque.cljc", :end-column 13, :method-params ([l deque r]), :protocol-impl nil, :arglists-meta (nil nil), :column 1, :line 15, :end-line 15, :max-fixed-arity 3, :fn-var true, :arglists (quote ([l deque r]))}, concat {:name fipp.deque/concat, :file "out/fipp/deque.cljc", :line 18, :column 1, :end-line 18, :end-column 12, :meta {:file "/Users/james/projects/cljs-draw/out/fipp/deque.cljc", :line 18, :column 6, :end-line 18, :end-column 12}}}} -------------------------------------------------------------------------------- /out/fipp/deque.js: -------------------------------------------------------------------------------- 1 | // Compiled by ClojureScript 0.0-3308 {} 2 | goog.provide('fipp.deque'); 3 | goog.require('cljs.core'); 4 | goog.require('clojure.core.rrb_vector'); 5 | fipp.deque.create = cljs.core.vector; 6 | fipp.deque.empty = cljs.core.PersistentVector.EMPTY; 7 | fipp.deque.popl = (function fipp$deque$popl(v){ 8 | return cljs.core.subvec.call(null,v,(1)); 9 | }); 10 | fipp.deque.conjr = cljs.core.fnil.call(null,cljs.core.conj,fipp.deque.empty); 11 | fipp.deque.conjlr = (function fipp$deque$conjlr(l,deque,r){ 12 | return clojure.core.rrb_vector.catvec.call(null,new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [l], null),deque,new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [r], null)); 13 | }); 14 | fipp.deque.concat = clojure.core.rrb_vector.catvec; 15 | 16 | //# sourceMappingURL=deque.js.map -------------------------------------------------------------------------------- /out/fipp/deque.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"\/Users\/james\/projects\/cljs-draw\/out\/fipp\/deque.js","sources":["deque.cljc"],"lineCount":16,"mappings":";AAAA;;;AAKA,AAAKA,oBAAOC;AAEZ,mBAAA,nBAAKC;AAEL,kBAAA,lBAAMC,4CAAMC;AAAZ,AACE,oCAAA,7BAACC,2BAAOD;;AAEV,AAAKE,mBAAM,AAACC,yBAAKC,eAAKN;AAEtB,oBAAA,pBAAMO,gDAAQC,EAAEC,MAAMC;AAAtB,AACE,gDAAA,mGAAA,5IAACC,4HAAYH,UAAGC,yFAAOC;;AAEzB,AAAKE,oBAAOD","names":["fipp.deque\/create","cljs.core\/vector","fipp.deque\/empty","fipp.deque\/popl","v","cljs.core\/subvec","fipp.deque\/conjr","cljs.core\/fnil","cljs.core\/conj","fipp.deque\/conjlr","l","deque","r","clojure.core.rrb-vector\/catvec","fipp.deque\/concat"]} -------------------------------------------------------------------------------- /out/frontend.js: -------------------------------------------------------------------------------- 1 | if(typeof goog == "undefined") document.write(''); 2 | document.write(''); 3 | document.write(''); 4 | -------------------------------------------------------------------------------- /out/gamma/compiler/bubble_term.cljs: -------------------------------------------------------------------------------- 1 | (ns gamma.compiler.bubble-term 2 | (:use [gamma.ast :only [id?]])) 3 | 4 | 5 | (defn parent-bubbles [db bubble] 6 | (map 7 | (fn [x] 8 | (if (= :if (:head (db x))) 9 | (assoc bubble :current x :conditional true) 10 | (assoc bubble :current x))) 11 | (get-in db [(:current bubble) :parents]))) 12 | 13 | 14 | ;; term structure {:shared {nodeid {:conditional bool :unconditional int} }} 15 | 16 | (defn bubble-term [db queue] 17 | (let [bubble (first queue)] 18 | (if (nil? bubble) 19 | ;; base case. If bubble is nil, return the db we've built up 20 | db 21 | (if (= :root (:current bubble)) 22 | ;; if bubble has reached the root node, recur to the next bubble in the queue 23 | (recur db (rest queue)) 24 | ;; if not at the root node, inspect and mark node and recur 25 | (let [info-path [(:current bubble) :shared (:start bubble)] 26 | node-info (get-in db info-path)] 27 | (if (:conditional bubble) 28 | ;; bubble is conditional 29 | (if (nil? node-info) 30 | ;; node hasn't been visited before; mark and bubble 31 | (let [parent-bubbles (parent-bubbles db bubble)] 32 | (recur (assoc-in db info-path {:conditional true}) (concat (rest queue) parent-bubbles))) 33 | (if (:unconditional node-info) 34 | ;; node has been visited by an unconditional bubble. mark conditional and recur to next bubble 35 | (recur (assoc-in db (conj info-path :conditional) true) (rest queue)) 36 | ;; node has been visited by conditional bubble. recur to next bubble 37 | (recur db (rest queue)))) 38 | 39 | ;; bubble is unconditional 40 | (if (or (nil? node-info) (nil? (:unconditional node-info))) 41 | ;; node has not been visited by an unconditional bubble. mark and bubble 42 | (let [parent-bubbles (parent-bubbles db bubble)] 43 | (recur (assoc-in db info-path (assoc node-info :unconditional 1)) (concat (rest queue) parent-bubbles))) 44 | ;; node has been visited by unconditional bubble. increment and recur to next bubble. 45 | (recur 46 | (assoc-in db info-path (assoc node-info :unconditional (+ 1 (:unconditional node-info)))) 47 | (rest queue)))) 48 | 49 | ))))) 50 | 51 | (defn bubble-terms [db] 52 | (reduce bubble-term db 53 | (map 54 | (fn [x] (map (fn [y] {:start (:id x) :current y}) (:parents x))) 55 | (filter #(clojure.core/< 1 (count (:parents %))) 56 | (map last db))))) 57 | -------------------------------------------------------------------------------- /out/gamma/compiler/bubble_term.cljs.cache.edn: -------------------------------------------------------------------------------- 1 | ;; Analyzed by ClojureScript 0.0-3308 2 | {:use-macros nil, :excludes #{}, :name gamma.compiler.bubble-term, :imports nil, :requires {gamma.ast gamma.ast}, :uses {id? gamma.ast}, :defs {parent-bubbles {:protocol-inline nil, :meta {:file "/Users/james/projects/cljs-draw/out/gamma/compiler/bubble_term.cljs", :line 5, :column 7, :end-line 5, :end-column 21, :arglists (quote ([db bubble]))}, :name gamma.compiler.bubble-term/parent-bubbles, :variadic false, :file "out/gamma/compiler/bubble_term.cljs", :end-column 21, :method-params ([db bubble]), :protocol-impl nil, :arglists-meta (nil nil), :column 1, :line 5, :end-line 5, :max-fixed-arity 2, :fn-var true, :arglists (quote ([db bubble]))}, bubble-term {:protocol-inline nil, :meta {:file "/Users/james/projects/cljs-draw/out/gamma/compiler/bubble_term.cljs", :line 16, :column 7, :end-line 16, :end-column 18, :arglists (quote ([db queue]))}, :name gamma.compiler.bubble-term/bubble-term, :variadic false, :file "out/gamma/compiler/bubble_term.cljs", :end-column 18, :method-params ([db queue]), :protocol-impl nil, :arglists-meta (nil nil), :column 1, :line 16, :end-line 16, :max-fixed-arity 2, :fn-var true, :arglists (quote ([db queue]))}, bubble-terms {:protocol-inline nil, :meta {:file "/Users/james/projects/cljs-draw/out/gamma/compiler/bubble_term.cljs", :line 51, :column 7, :end-line 51, :end-column 19, :arglists (quote ([db]))}, :name gamma.compiler.bubble-term/bubble-terms, :variadic false, :file "out/gamma/compiler/bubble_term.cljs", :end-column 19, :method-params ([db]), :protocol-impl nil, :arglists-meta (nil nil), :column 1, :line 51, :end-line 51, :max-fixed-arity 1, :fn-var true, :arglists (quote ([db]))}}, :require-macros nil, :cljs.analyzer/constants {:seen #{:if :start :head :root :id :current :parents :shared :unconditional :conditional}, :order [:if :head :current :conditional :parents :root :shared :start :unconditional :id]}, :doc nil} -------------------------------------------------------------------------------- /out/gamma/compiler/bubble_term.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"\/Users\/james\/projects\/cljs-draw\/out\/gamma\/compiler\/bubble_term.js","sources":["bubble_term.cljs"],"lineCount":83,"mappings":";AAAA;;;AAIA,4CAAA,5CAAMA,gGAAgBC,GAAGC;AAAzB,AACE,OAACC,wBACC,WAAKC;AAAL,AACE,GAAI,yBAAA,zBAACC,0EAAM,AAAA,mFAAO,AAACJ,aAAGG;AACpB,wCAAA,8DAAA,mEAAA,lKAACE,0BAAMJ,mEAAgBE;;AACvB,wCAAA,jCAACE,0BAAMJ,mEAAgBE;;GAC3B,8BAAA,qLAAA,nNAACG,2BAAON,sFAAI,AAAA,0FAAUC;;AAK1B,yCAAA,zCAAMM,0FAAaP,GAAGQ;;AAAtB,AACE,IAAMP,SAAO,AAACQ,0BAAMD;AAApB,AACE,GAAI,WAAA,VAAMP;AAERD;;AACA,GAAI,yBAAA,zBAACI,8EAAQ,AAAA,0FAAUH;AAErB,eAAOD;eAAG,AAACU,yBAAKF;;;;;AAEhB,gBAAA,qLAAA,jMAAMG,+FAAW,AAAA,0FAAUV,iEAAgB,AAAA,qFAAQA;IAC7CW,YAAU,AAACN,2BAAON,GAAGW;AAD3B,AAEE,oBAAI,AAAA,iGAAcV;AAEhB,GAAI,cAAA,bAAMW;AAER,IAAMC,iBAAe,AAACd,oDAAeC,GAAGC;AAAxC,AACE,eAAO,0CAAA,2CAAA,mEAAA,xJAACa,6BAASd,GAAGW;eAA+B,AAACI,2BAAO,AAACL,yBAAKF,OAAOK;;;;;AAC1E,oBAAI,AAAA,qGAAgBD;AAElB,eAAO,uIAAA,vIAACE,6BAASd,GAAG,mCAAA,nCAACgB,yBAAKL;eAA8B,AAACD,yBAAKF;;;;;AAE9D,eAAOR;eAAG,AAACU,yBAAKF;;;;;;;AAGpB,GAAI,CAAI,cAAA,bAAMI,wBAAW,oHAAA,nHAAM,AAAA,qGAAgBA;AAE7C,IAAMC,iBAAe,AAACd,oDAAeC,GAAGC;AAAxC,AACE,eAAO,AAACa,6BAASd,GAAGW,UAAU,oCAAA,uEAAA,3GAACN,0BAAMO;eAA6B,AAACG,2BAAO,AAACL,yBAAKF,OAAOK;;;;;AAEzF,eACE,AAACC,6BAASd,GAAGW,UAAU,oCAAA,pCAACN,0BAAMO,iFAAyB,CAAA,MAAK,AAAA,qGAAgBA;eAC5E,AAACF,yBAAKF;;;;;;;;;;;AAItB,0CAAA,1CAAMS,4FAAcjB;AAApB,AACE,OAACkB,2BAAOX,uCAAYP,GACZ,AAACE,wBACC,WAAKC;AAAL,AAAQ,OAACD,wBAAI,WAAKiB;AAAL,AAAA,kDAAA,0IAAA,nFAAgB,AAAA,gFAAKhB,+DAAagB;GAAI,AAAA,0FAAUhB;GAC7D,2BAAA,WAAAiB,tCAACC;AAAD,AAAS,QAAA,MAAkB,AAACC,0BAAM,AAAA,0FAAAF;GAC1B,AAAClB,wBAAIqB,eAAKvB","names":["gamma.compiler.bubble-term\/parent-bubbles","db","bubble","cljs.core\/map","x","cljs.core\/=","cljs.core\/assoc","cljs.core\/get-in","gamma.compiler.bubble-term\/bubble-term","queue","cljs.core\/first","cljs.core\/rest","info-path","node-info","parent-bubbles","cljs.core\/assoc-in","cljs.core\/concat","cljs.core\/conj","gamma.compiler.bubble-term\/bubble-terms","cljs.core\/reduce","y","p1__20344#","cljs.core\/filter","cljs.core\/count","cljs.core\/last"]} -------------------------------------------------------------------------------- /out/gamma/compiler/common.cljs: -------------------------------------------------------------------------------- 1 | (ns gamma.compiler.common 2 | (:use [gamma.ast :only [id? term]])) 3 | 4 | (defn get-element [db location] 5 | (get-in (db (:id location)) (:path location))) 6 | 7 | (defn map-path [f] 8 | (fn [db path] 9 | [db 10 | (let [elt (get-element db path)] 11 | (if (vector? elt) 12 | (mapv #(vector % f) (range 0 (count elt))) 13 | (if (map? elt) 14 | (mapv #(vector % f) (keys elt)) 15 | nil)))])) 16 | 17 | (defn assoc-in-location [db location val] 18 | (let [id (:id location)] 19 | (assoc db id (assoc-in (db id) (:path location) val)))) 20 | 21 | 22 | (defn assoc-in-parent [db location value] 23 | (let [p (:parent location) 24 | pid (:id p)] 25 | (assoc db pid (assoc-in (db pid) (:path p) value)))) 26 | 27 | 28 | 29 | (defn location-conj [db location key] 30 | (let [base-location (update-in location [:path] conj key) 31 | elt (get-element db base-location)] 32 | (if (id? elt) 33 | {:id elt :path [] :parent base-location} 34 | base-location))) 35 | 36 | 37 | (defn merge-elements 38 | ([db elements] (reduce #(update-in %1 [(:id %2)] (fnil merge {}) %2) db elements)) 39 | ([db location elements] 40 | (-> db 41 | (merge-elements elements) 42 | (assoc-in-location location (mapv :id elements))))) 43 | (defn assoc-elements 44 | ([db elements] (reduce #(assoc %1 (:id %2) %2) db elements)) 45 | ([db location elements] 46 | (-> db 47 | (assoc-elements elements) 48 | (assoc-in-location location (mapv :id elements))))) 49 | -------------------------------------------------------------------------------- /out/gamma/compiler/common.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"\/Users\/james\/projects\/cljs-draw\/out\/gamma\/compiler\/common.js","sources":["common.cljs"],"lineCount":106,"mappings":";AAAA;;;AAGA,oCAAA,pCAAMA,gFAAaC,GAAGC;AAAtB,AACG,OAACC,2BAAO,AAACF,aAAG,AAAA,gFAAKC,WAAW,AAAA,mFAAOA;;AAEtC,iCAAA,jCAAME,0EAAUC;AAAhB,AACE,kBAAKJ,GAAGK;AAAR,AAAA,0FACGL,GACA,iBAAMM,MAAI,AAACP,4CAAYC,GAAGK;AAA1B,AACE,GAAI,AAACE,kCAAQD;AACX,gCAAA,zBAACG;kBAADD;AAAA,AAAO,YAAAE,2BAAA,KAAA,EAAA,IAAA,AAAAA,sCAAA,CAAAF,oBAAA,HAAUJ;;CAAG,0BAAA,1BAACO,8BAAQ,AAACC,0BAAMN;;AACpC,GAAI,AAACO,+BAAKP;AACR,gCAAA,zBAACG;kBAADK;AAAA,AAAO,YAAAJ,2BAAA,KAAA,EAAA,IAAA,AAAAA,sCAAA,CAAAI,oBAAA,HAAUV;;CAAG,AAACW,yBAAKT;;AAD5B;;;;;;AAIT,0CAAA,1CAAMU,4FAAmBhB,GAAGC,SAASgB;AAArC,AACE,IAAMC,KAAG,AAAA,gFAAKjB;AAAd,AACE,OAACkB,0BAAMnB,GAAGkB,GAAG,AAACE,6BAAS,AAACpB,aAAGkB,IAAI,AAAA,mFAAOjB,UAAUgB;;AAGpD,wCAAA,xCAAMI,wFAAiBrB,GAAGC,SAASqB;AAAnC,AACE,IAAMC,IAAE,AAAA,uFAAStB;IACXuB,MAAI,AAAA,gFAAKD;AADf,AAEE,OAACJ,0BAAMnB,GAAGwB,IAAI,AAACJ,6BAAS,AAACpB,aAAGwB,KAAK,AAAA,mFAAOD,GAAGD;;AAI\/C,sCAAA,tCAAMG,oFAAezB,GAAGC,SAASyB;AAAjC,AACE,IAAMC,gBAAc,uCAAA,mFAAA,1HAACC,8BAAU3B,yJAAiB4B,eAAKH;IAC\/CpB,MAAI,AAACP,4CAAYC,GAAG2B;AAD1B,AAEE,oBAAI,AAACG,8BAAIxB;AAAT,kDAAA,sDAAA,qDAAA,iCAAA,1FACOA,mJAAqBqB;;AAC1BA;;;AAGN,AAAA,uCAAA,vCAAMK;AAAN,AAAA,IAAAD,WAAA,AAAA;AAAA,AAAA,QAAAA;KAAA;AAAA,OAAAC,mEAAA,CAAA,UAAA,MAAA,CAAA,UAAA;;;KAAA;AAAA,OAAAA,mEAAA,CAAA,UAAA,MAAA,CAAA,UAAA,MAAA,CAAA,UAAA;;;;AAAA,MAAA,KAAAC,MAAA,eAAA,iCAAA,AAAA;;;;;AAAA,AAAA,qEAAA,rEAAMD,gFACFhC,GAAGkC;AADP,AACiB,kCAAA,WAAAC,iBAAAC,vDAACC;AAAD,AAAS,qCAAAF,iBAAA,0QAAAC,zTAACR,kIAAc,AAAA,gFAAAQ,0BAAU,yCAAA,zCAACE,yBAAKC;GAAcvC,GAAGkC;;;AAD1E,AAAA,qEAAA,rEAAMF,gFAEFhC,GAAGC,SAASiC;AAFhB,wGAGOlC,\/CACA,AAACgC,kDAAeE,3GAChB,OAAClB,8GAAkBf,SAAS,yBAAA,zBAACQ,2EAASyB;;;AAL7C,AAAA,+DAAA,\/DAAMF;AAMN,AAAA,uCAAA,vCAAMS;AAAN,AAAA,IAAAD,WAAA,AAAA;AAAA,AAAA,QAAAA;KAAA;AAAA,OAAAC,mEAAA,CAAA,UAAA,MAAA,CAAA,UAAA;;;KAAA;AAAA,OAAAA,mEAAA,CAAA,UAAA,MAAA,CAAA,UAAA,MAAA,CAAA,UAAA;;;;AAAA,MAAA,KAAAR,MAAA,eAAA,iCAAA,AAAA;;;;;AAAA,AAAA,qEAAA,rEAAMQ,gFACFzC,GAAGkC;AADP,AACiB,kCAAA,WAAAQ,iBAAAC,vDAACN;AAAD,AAAS,iCAAAK,mHAAAC,7IAACxB,2CAAS,AAAA,gFAAAwB;GAAa3C,GAAGkC;;;AADpD,AAAA,qEAAA,rEAAMO,gFAEFzC,GAAGC,SAASiC;AAFhB,wGAGOlC,\/CACA,AAACyC,kDAAeP,3GAChB,OAAClB,8GAAkBf,SAAS,yBAAA,zBAACQ,2EAASyB;;;AAL7C,AAAA,+DAAA,\/DAAMO","names":["gamma.compiler.common\/get-element","db","location","cljs.core\/get-in","gamma.compiler.common\/map-path","f","path","elt","cljs.core\/vector?","p1__20253#","cljs.core\/mapv","cljs.core\/PersistentVector","cljs.core\/range","cljs.core\/count","cljs.core\/map?","p1__20254#","cljs.core\/keys","gamma.compiler.common\/assoc-in-location","val","id","cljs.core\/assoc","cljs.core\/assoc-in","gamma.compiler.common\/assoc-in-parent","value","p","pid","gamma.compiler.common\/location-conj","key","base-location","cljs.core\/update-in","cljs.core\/conj","gamma.ast\/id?","G__20258","gamma.compiler.common\/merge-elements","js\/Error","elements","p1__20255#","p2__20256#","cljs.core\/reduce","cljs.core\/fnil","cljs.core\/merge","G__20263","gamma.compiler.common\/assoc-elements","p1__20260#","p2__20261#"]} -------------------------------------------------------------------------------- /out/gamma/compiler/core.cljs: -------------------------------------------------------------------------------- 1 | (ns gamma.compiler.core 2 | (:use [gamma.compiler.common :only [get-element map-path location-conj]] 3 | [gamma.ast :only [id? term]] 4 | [gamma.compiler.flatten-ast :only [flatten-ast]] 5 | [gamma.compiler.bubble-term :only [bubble-terms]] 6 | [gamma.compiler.insert-assignments :only [insert-assignments]] 7 | [gamma.compiler.lift-assignments :only [lift-assignments]] 8 | [gamma.compiler.separate-usages :only [separate-usages]] 9 | [gamma.compiler.insert-variables :only [insert-variables]] 10 | [gamma.compiler.move-assignments :only [move-assignments]] 11 | )) 12 | 13 | 14 | 15 | 16 | (defn push-ops [db ops location stack] 17 | (reduce 18 | (fn [s o] 19 | (if (vector? o) 20 | (conj s [(location-conj db location (first o)) (second o)]) 21 | (conj s [location o]))) 22 | stack 23 | (reverse ops))) 24 | 25 | 26 | (defn transform-1 [db stack] 27 | (loop [db db stack stack c 0] 28 | (if-let [f (peek stack)] 29 | (let [[db ops] 30 | (do 31 | ;(println [(f 1) (f 0)]) 32 | ((f 1) db (f 0)))] 33 | 34 | (recur db (push-ops db ops (f 0) (pop stack)) (inc c))) 35 | db))) 36 | 37 | (defn transform [db f] 38 | (transform-1 db [[{:id :root :path []} f]])) 39 | 40 | 41 | 42 | 43 | 44 | (defn walk [db pre] 45 | (transform 46 | db 47 | (fn walk-fn [db path] 48 | [(pre db path) [[:body (map-path walk-fn)]]]))) 49 | 50 | 51 | 52 | (defn variables [db] 53 | (let [a (atom #{})] 54 | (walk db (fn [db location] 55 | (let [e (get-element db location)] 56 | (if (= :literal (:head e)) 57 | (if (= :variable (:tag (:value e))) 58 | (do 59 | (swap! a conj (:value e)) 60 | (if (:type (:value e)) 61 | nil 62 | (println location)) 63 | )))) 64 | db)) 65 | @a)) 66 | 67 | (defn compile [input] 68 | (-> 69 | (transform 70 | {:root {:source-id :root :id :root}} 71 | (separate-usages 72 | (bubble-terms (flatten-ast input)) {} #{})) 73 | (transform (lift-assignments :root)) 74 | (transform (insert-variables #{})) 75 | (transform (insert-assignments)) 76 | (transform (move-assignments)))) 77 | 78 | 79 | 80 | -------------------------------------------------------------------------------- /out/gamma/compiler/core.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"\/Users\/james\/projects\/cljs-draw\/out\/gamma\/compiler\/core.js","sources":["core.cljs"],"lineCount":82,"mappings":";AAAA;;;;;;;;;;;AAeA,+BAAA,\/BAAMA,sEAAUC,GAAGC,IAAIC,SAASC;AAAhC,AACE,OAACC,2BACC,WAAKC,EAAEC;AAAP,AACE,GAAI,AAACC,kCAAQD;AACX,kCAAA,3BAACE,yBAAKH,qFAAG,AAACI,8CAAcT,GAAGE,SAAS,AAACQ,0BAAMJ,IAAI,AAACK,2BAAOL;;AACvD,kCAAA,3BAACE,yBAAKH,qFAAGH,SAASI;;GACtBH,MACA,AAACS,4BAAQX;;AAGb,kCAAA,lCAAMY,4EAAab,GAAGG;AAAtB,AACE,IAAOH,SAAGA;IAAGG,YAAMA;QAAnB,JAAyBW;;AAAzB,AACE,IAAAC,qBAAW,AAACE,yBAAKd;AAAjB,AAAA,oBAAAY;AAAA,QAAAA,JAASC;AAAT,AACE,IAAAE,aACM,AAEE,AAAC,YAAA,ZAACF,2BAAKhB,OAAG,YAAA,ZAACgB;aAHnB,AAAAG,wBAAAD,WAAA,IAAA,hDAAOlB;UAAP,AAAAmB,wBAAAD,WAAA,IAAA,7CAAUjB;AAAV,AAKE,eAAOD;eAAG,AAACD,uCAASC,OAAGC,IAAI,YAAA,ZAACe,iBAAK,AAACI,wBAAIjB;eAAQ,KAAA,JAAKW;;;;;;AACrDd;;;;;AAEN,gCAAA,hCAAMqB,wEAAWrB,GAAGgB;AAApB,AACE,oDAAA,mFAAA,mFAAA,2CAAA,kDAAA,qDAAA,qDAAA,1ZAACH,0CAAYb,yZAA0BgB;;AAMzC,2BAAA,3BAAMM,8DAAMtB,GAAGuB;AAAf,AACE,OAACF,wCACCrB,GACA,6CAAaA,OAAGwB;AAAhB,AAAA,qHAAA,mFAAA,mFAAA,jMACE,AAACD,cAAIvB,OAAGwB,kOAAc,AAACC,yCAASC;;;AAItC,gCAAA,hCAAMC,wEAAW3B;AAAjB,AACE,IAAM6B,IAAE,yBAAA,zBAACC;AAAT,AACE,AAACR,mCAAKtB,GAAG;kBAAKA,OAAGE;AAAR,AACE,IAAM6B,UAAE,AAACC,4CAAYhC,OAAGE;AAAxB,AACE,GAAI,yBAAA,zBAAC+B,oFAAW,AAAA,mFAAOF;AACrB,GAAI,yBAAA,zBAACE,sFAAY,AAAA,kFAAM,AAAA,oFAAQF;AAC7B,AACE,AAACG,+BAAML,EAAErB,eAAK,AAAA,oFAAQuB;;AACtB,oBAAI,AAAA,mFAAO,AAAA,oFAAQA;AAAnB;AAEE,AAACI,4BAAQjC;;;AALf;;AADF;;AAQFF;;;;AAXb,OAAA4B,0BAYGC;;AAEL,8BAAA,9BAAMO,oEAASC;AAAf,uKAEI,wCAAA,2CAAA,qDAAA,2CAAA,+DAAA,qDAAA,kDAAA,zVAAChB,8ZAEC,oKAAA,mCAAA,vMAACiB,yDACC,AAACC,kDAAa,AAACC,iDAAYH,lmBAC\/B,AAAChB,irBAAU,2DAAA,3DAACoB,ztBACZ,AAACpB,20BAAU,2DAAA,3DAACqB,n3BACZ,AAACrB,k9BAAU,AAACsB,jgCACZ,OAACtB,2jCAAU,AAACuB","names":["gamma.compiler.core\/push-ops","db","ops","location","stack","cljs.core\/reduce","s","o","cljs.core\/vector?","cljs.core\/conj","gamma.compiler.common\/location-conj","cljs.core\/first","cljs.core\/second","cljs.core\/reverse","gamma.compiler.core\/transform-1","c","temp__4421__auto__","f","cljs.core\/peek","vec__20235","cljs.core\/nth","cljs.core\/pop","gamma.compiler.core\/transform","gamma.compiler.core\/walk","pre","path","gamma.compiler.common\/map-path","walk-fn","gamma.compiler.core\/variables","cljs.core\/deref","a","cljs.core\/atom","e","gamma.compiler.common\/get-element","cljs.core\/=","cljs.core\/swap!","cljs.core\/println","gamma.compiler.core\/compile","input","gamma.compiler.separate-usages\/separate-usages","gamma.compiler.bubble-term\/bubble-terms","gamma.compiler.flatten-ast\/flatten-ast","gamma.compiler.lift-assignments\/lift-assignments","gamma.compiler.insert-variables\/insert-variables","gamma.compiler.insert-assignments\/insert-assignments","gamma.compiler.move-assignments\/move-assignments"]} -------------------------------------------------------------------------------- /out/gamma/compiler/flatten_ast.cljs: -------------------------------------------------------------------------------- 1 | (ns gamma.compiler.flatten-ast 2 | (:require [clojure.walk] 3 | [gamma.ast])) 4 | 5 | (defn flatten-ast 6 | ([node] (flatten-ast 7 | (if (= :block (:head node)) 8 | {:root {:id :root :head :block :body (mapv :id (:body node)) :parents [:root]}} 9 | {:root {:id :root :head :block :body [(:id node)] :parents [:root]}}) 10 | node 11 | :root)) 12 | ([db node parent-id] 13 | (let [id (:id node) seen (db id)] 14 | (if seen 15 | (update-in db [id :parents] conj parent-id) 16 | (if (= :literal (:head node)) 17 | (assoc db id (assoc node :parents [parent-id])) 18 | (reduce 19 | #(flatten-ast %1 %2 id) 20 | (assoc db (:id node) 21 | (assoc node 22 | :body (mapv :id (:body node)) 23 | :parents [parent-id])) 24 | (:body node))))))) 25 | 26 | 27 | 28 | (defn ->tree [db id] 29 | (let [e (db id)] 30 | (assoc 31 | (clojure.walk/postwalk 32 | (fn [y] 33 | (if 34 | (gamma.ast/id? y) 35 | (->tree db y) 36 | y)) 37 | (dissoc e :parents :id)) 38 | :id id))) 39 | 40 | 41 | (comment 42 | 43 | 44 | (def x 45 | (->tree 46 | (flatten-ast 47 | (gamma.ast/term :bar 0 (gamma.ast/term :foo 1))) :root)) 48 | 49 | (require '[gamma.compiler.print :refer [printer]] ) 50 | 51 | (fipp.printer/pprint-document 52 | ((printer) x) 53 | {:width 30}) 54 | 55 | (fipp.printer/pprint-document 56 | ((printer) {:id 1 :head :foo :tag :term}) 57 | {:width 30}) 58 | 59 | (fipp.printer/pprint-document 60 | [:group "1" "(" "1" ")" [:group "{" [:align '()] "}"]] 61 | {:width 30}) 62 | 63 | 64 | 65 | 66 | ) 67 | 68 | (comment 69 | 70 | (def c (crazy. 1)) 71 | 72 | (c 2) 73 | 74 | (defrecord crazy [arg] 75 | IFn 76 | (-invoke [this arg] (crazy. this))) 77 | 78 | 79 | (get-fn data) -> fn specific to data (polymorphism) 80 | 81 | 82 | (defrecord dispatcher [get-fn] 83 | IFn 84 | (-invoke [this arg] ((get-fn arg) this arg))) 85 | 86 | 87 | (declare dispatch-map) 88 | 89 | (def dispatch-map (dispatch-map-constructor 90 | dispatch-map 91 | {rule my-transform2})) 92 | 93 | (defn my-transform [dispatch-map arg] 94 | 95 | ) 96 | 97 | 98 | (defn my-transform [dispatcher data] 99 | (.populateSomeObject 100 | (o.) 101 | (:somedata data) 102 | ((assoc dispatcher 103 | :environment-data) (:subdata data))) 104 | ) 105 | 106 | 107 | 108 | 109 | (fn crazy [arg arg2] 110 | [(crazy arg crazy)]) 111 | 112 | 113 | 114 | 115 | ) -------------------------------------------------------------------------------- /out/gamma/compiler/flatten_ast.cljs.cache.edn: -------------------------------------------------------------------------------- 1 | ;; Analyzed by ClojureScript 0.0-3308 2 | {:use-macros nil, :excludes #{}, :name gamma.compiler.flatten-ast, :imports nil, :requires {clojure.walk clojure.walk, gamma.ast gamma.ast}, :uses nil, :defs {flatten-ast {:protocol-inline nil, :meta {:file "/Users/james/projects/cljs-draw/out/gamma/compiler/flatten_ast.cljs", :line 5, :column 7, :end-line 5, :end-column 18, :arglists (quote ([node] [db node parent-id])), :top-fn {:variadic false, :max-fixed-arity 3, :method-params ([node] [db node parent-id]), :arglists ([node] [db node parent-id]), :arglists-meta (nil nil)}}, :name gamma.compiler.flatten-ast/flatten-ast, :variadic false, :file "out/gamma/compiler/flatten_ast.cljs", :end-column 18, :top-fn {:variadic false, :max-fixed-arity 3, :method-params ([node] [db node parent-id]), :arglists ([node] [db node parent-id]), :arglists-meta (nil nil)}, :method-params ([node] [db node parent-id]), :protocol-impl nil, :arglists-meta (nil nil), :column 1, :line 5, :end-line 5, :max-fixed-arity 3, :fn-var true, :arglists ([node] [db node parent-id])}, ->tree {:protocol-inline nil, :meta {:file "/Users/james/projects/cljs-draw/out/gamma/compiler/flatten_ast.cljs", :line 28, :column 7, :end-line 28, :end-column 13, :arglists (quote ([db id]))}, :name gamma.compiler.flatten-ast/->tree, :variadic false, :file "out/gamma/compiler/flatten_ast.cljs", :end-column 13, :method-params ([db id]), :protocol-impl nil, :arglists-meta (nil nil), :column 1, :line 28, :end-line 28, :max-fixed-arity 2, :fn-var true, :arglists (quote ([db id]))}}, :require-macros nil, :cljs.analyzer/constants {:seen #{:block :head :root :id :literal :parents :body}, :order [:block :head :root :id :body :parents :literal]}, :doc nil} -------------------------------------------------------------------------------- /out/gamma/compiler/flatten_ast.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"\/Users\/james\/projects\/cljs-draw\/out\/gamma\/compiler\/flatten_ast.js","sources":["flatten_ast.cljs"],"lineCount":59,"mappings":";AAAA;;;;AAIA,AAAA,yCAAA,zCAAMC;AAAN,AAAA,IAAAD,WAAA,AAAA;AAAA,AAAA,QAAAA;KAAA;AAAA,OAAAC,qEAAA,CAAA,UAAA;;;KAAA;AAAA,OAAAA,qEAAA,CAAA,UAAA,MAAA,CAAA,UAAA,MAAA,CAAA,UAAA;;;;AAAA,MAAA,KAAAC,MAAA,eAAA,iCAAA,AAAA;;;;;AAAA,AAAA,uEAAA,vEAAMD,kFACFE;AADJ,AACU,+xDAAA,xxDAACF,iDACC,4KAAA,2CAAA,qDAAA,2CAAA,kDAAA,qDAAA,qDAAA,sDAAA,4NAAA,4DAAA,mFAAA,6EAAA,2CAAA,qDAAA,2CAAA,kDAAA,qDAAA,qDAAA,sDAAA,sDAAA,iLAAA,4DAAA,mFAAA,lpDAAI,yBAAA,zBAACG,+EAAS,AAAA,mFAAOD,2ZACkB,yBAAA,zBAACE,2EAAS,AAAA,oFAAOF,ysBAChB,AAAA,gFAAKA,2OAC7CA;;;AALZ,AAAA,uEAAA,vEAAMF,kFAOFK,GAAGH,KAAKI;AAPZ,AAQG,IAAMC,KAAG,AAAA,gFAAKL;IAAMM,OAAK,AAACH,aAAGE;AAA7B,AACE,oBAAIC;AACF,wCAAA,sFAAA,vHAACC,8BAAUJ,sFAAIE,uEAAaG,eAAKJ;;AACjC,GAAI,yBAAA,zBAACH,oFAAW,AAAA,mFAAOD;AACrB,OAACS,0BAAMN,GAAGE,GAAG,+BAAA,4DAAA,3FAACI,0BAAMT,oJAAeI;;AACnC,kCAAA,3BAACQ;kBAADF,iBAAAC;AAAA,AACG,wDAAAD,iBAAAC,lEAACb,mFAAkBO;;CACpB,AAACI,0BAAMN,GAAG,AAAA,gFAAKH,MACR,+BAAA,4NAAA,4DAAA,vTAACS,0BAAMT,2DACM,yBAAA,zBAACE,2EAAS,AAAA,oFAAOF,sJACbI,oBACxB,AAAA,oFAAOJ;;;;;AAnBlB,AAAA,iEAAA,jEAAMF;AAuBN,uCAAA,vCAAMe,sFAAQV,GAAGE;AAAjB,AACE,IAAMS,IAAE,AAACX,aAAGE;AAAZ,AACE,OAACI,0BACC,AAACM,gCACA;kBAAKC;AAAL,AACE,oBACE,AAACC,8BAAcD;AACf,OAACE,+CAAOf,GAAGa;;AACXA;;;8IANP,7IAOG,6BAAA,4DAAA,zFAACG,2BAAOL,oKACLT;;AAGV,AA2BA","names":["G__20352","gamma.compiler.flatten-ast\/flatten-ast","js\/Error","node","cljs.core\/=","cljs.core\/mapv","db","parent-id","id","seen","cljs.core\/update-in","cljs.core\/conj","cljs.core\/assoc","p1__20349#","p2__20350#","cljs.core\/reduce","gamma.compiler.flatten-ast\/->tree","e","clojure.walk\/postwalk","y","gamma.ast\/id?","->tree","cljs.core\/dissoc"]} -------------------------------------------------------------------------------- /out/gamma/compiler/insert_assignments.cljs: -------------------------------------------------------------------------------- 1 | (ns gamma.compiler.insert-assignments 2 | (:use [gamma.ast :only [id? gen-term-id]] 3 | [gamma.compiler.common :only [get-element map-path assoc-elements assoc-in-location]])) 4 | 5 | 6 | (defn insert-assignment [db location target-id] 7 | (let [set-id (gen-term-id) var-id (gen-term-id) 8 | this-id (:id location) parent-loc (:parent location)] 9 | ;(println [this-id ]) 10 | (-> db 11 | (assoc-elements [{:id set-id :head :set :body [var-id this-id] :tag :term} 12 | {:id var-id :head :literal :tag :term 13 | :value {:tag :variable :id (:id target-id) 14 | :type (:type (get-element db location))}}]) 15 | (assoc-in-location parent-loc set-id)))) 16 | 17 | (declare insert-assignments-sub) 18 | 19 | (defn insert-assignments [] 20 | (fn [db location ] 21 | (let [e (get-element db location)] 22 | (if (= :block (:head e)) 23 | [db 24 | [[:assignments 25 | (let [x (map-indexed 26 | (fn [i y] [i (insert-assignments-sub y)]) 27 | (:assignments e))] 28 | (fn [db location] [db x]))]]] 29 | [db nil])))) 30 | 31 | 32 | (defn in-path [[a b] f] 33 | (fn [db loc] 34 | [db 35 | [[a (fn [db loc] [db [[b f]]])]]])) 36 | 37 | 38 | 39 | (defn insert-assignments-sub [target-id] 40 | (fn [db location] 41 | (let [e (get-element db location)] 42 | (condp = (:head e) 43 | :if 44 | [db 45 | [(in-path [:body 1] (insert-assignments-sub target-id)) 46 | (in-path [:body 2] (insert-assignments-sub target-id))]] 47 | :block 48 | [db 49 | [(in-path [:body (- (count (:body e)) 1)] (insert-assignments-sub target-id)) 50 | ;(insert-assignments) 51 | ]] 52 | ;:set [db nil] 53 | 54 | [(insert-assignment db location target-id) nil])))) 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | -------------------------------------------------------------------------------- /out/gamma/compiler/insert_assignments.cljs.cache.edn: -------------------------------------------------------------------------------- 1 | ;; Analyzed by ClojureScript 0.0-3308 2 | {:use-macros nil, :excludes #{}, :name gamma.compiler.insert-assignments, :imports nil, :requires {gamma.ast gamma.ast, gamma.compiler.common gamma.compiler.common}, :uses {id? gamma.ast, gen-term-id gamma.ast, assoc-in-location gamma.compiler.common, map-path gamma.compiler.common, get-element gamma.compiler.common, assoc-elements gamma.compiler.common}, :defs {insert-assignment {:protocol-inline nil, :meta {:file "/Users/james/projects/cljs-draw/out/gamma/compiler/insert_assignments.cljs", :line 6, :column 7, :end-line 6, :end-column 24, :arglists (quote ([db location target-id]))}, :name gamma.compiler.insert-assignments/insert-assignment, :variadic false, :file "out/gamma/compiler/insert_assignments.cljs", :end-column 24, :method-params ([db location target-id]), :protocol-impl nil, :arglists-meta (nil nil), :column 1, :line 6, :end-line 6, :max-fixed-arity 3, :fn-var true, :arglists (quote ([db location target-id]))}, insert-assignments-sub {:protocol-inline nil, :meta {:file "/Users/james/projects/cljs-draw/out/gamma/compiler/insert_assignments.cljs", :line 39, :column 7, :end-line 39, :end-column 29, :arglists (quote ([target-id]))}, :name gamma.compiler.insert-assignments/insert-assignments-sub, :variadic false, :file "out/gamma/compiler/insert_assignments.cljs", :end-column 29, :method-params ([target-id]), :protocol-impl nil, :arglists-meta (nil nil), :column 1, :line 39, :end-line 39, :max-fixed-arity 1, :fn-var true, :arglists (quote ([target-id]))}, insert-assignments {:protocol-inline nil, :meta {:file "/Users/james/projects/cljs-draw/out/gamma/compiler/insert_assignments.cljs", :line 19, :column 7, :end-line 19, :end-column 25, :arglists (quote ([]))}, :name gamma.compiler.insert-assignments/insert-assignments, :variadic false, :file "out/gamma/compiler/insert_assignments.cljs", :end-column 25, :method-params ([]), :protocol-impl nil, :arglists-meta (nil nil), :column 1, :line 19, :end-line 19, :max-fixed-arity 0, :fn-var true, :arglists (quote ([]))}, in-path {:protocol-inline nil, :meta {:file "/Users/james/projects/cljs-draw/out/gamma/compiler/insert_assignments.cljs", :line 32, :column 7, :end-line 32, :end-column 14, :arglists (quote ([[a b] f]))}, :name gamma.compiler.insert-assignments/in-path, :variadic false, :file "out/gamma/compiler/insert_assignments.cljs", :end-column 14, :method-params ([p__20242 f]), :protocol-impl nil, :arglists-meta (nil nil), :column 1, :line 32, :end-line 32, :max-fixed-arity 2, :fn-var true, :arglists (quote ([[a b] f]))}}, :require-macros nil, :cljs.analyzer/constants {:seen #{:assignments :block :variable :parent :if :value :type :term :head :id :literal :tag :set :body}, :order [:id :parent :head :body :tag :set :term :value :literal :type :variable :block :assignments :if]}, :doc nil} -------------------------------------------------------------------------------- /out/gamma/compiler/insert_assignments.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"\/Users\/james\/projects\/cljs-draw\/out\/gamma\/compiler\/insert_assignments.js","sources":["insert_assignments.cljs"],"lineCount":64,"mappings":";AAAA;;;;AAKA,sDAAA,tDAAMA,oHAAmBC,GAAGC,SAASC;AAArC,AACE,IAAMC,SAAO,AAACC;IAAaC,SAAO,AAACD;IAC7BE,UAAQ,AAAA,gFAAKL;IAAUM,aAAW,AAAA,uFAASN;AADjD,wGAGMD,\/CACA,kDAAA,mFAAA,2CAAA,yDAAA,qDAAA,kDAAA,sDAAA,0GAAA,oDAAA,8DAAA,2CAAA,yDAAA,qDAAA,2DAAA,oDAAA,sDAAA,sDAAA,2CAAA,oDAAA,6DAAA,6IAAA,\/vCAACQ,kOAAqBL,uPAAyBE,OAAOC,+NAC7BD,qeACqB,AAAA,gFAAKH,gEACnB,AAAA,mFAAO,AAACO,4CAAYT,GAAGC,\/+CACvD,OAACS,4gDAAkBH,WAAWJ;;AAEtC,AAAA,AAEA,uDAAA,vDAAMQ;AAAN,AACE,kBAAKX,GAAGC;AAAR,AACE,IAAMW,IAAE,AAACH,4CAAYT,GAAGC;AAAxB,AACE,GAAI,yBAAA,zBAACY,+EAAS,AAAA,mFAAOD;AAArB,6FAAA,mFAAA,mFAAA,zKACGZ,6OAEE,iBAAMc,IAAE,AAACC,gCACC;kBAAKC,EAAEC;AAAP,AAAA,0FAAWD,EAAE,AAACE,mEAAuBD;;CACrC,AAAA,kGAAcL;AAFxB,AAGE;kBAAKZ,OAAGC;AAAR,AAAA,0FAAmBD,OAAGc;;;;;AAN7B,6FAAA,HAOGd;;;;AAGT,4CAAA,oDAAAmB,hGAAMG,yGAAeG;AAArB,AAAA,IAAAL,aAAAD;QAAA,AAAAE,wBAAAD,WAAA,IAAA,3CAAgBG;QAAhB,AAAAF,wBAAAD,WAAA,IAAA,3CAAkBI;AAAlB,AACE;kBAAKxB,GAAG0B;AAAR,AAAA,6FAAA,mFAAA,tFACG1B,yKACEuB,EAAE;kBAAKvB,OAAG0B;AAAR,AAAA,iGAAA,mFAAA,1FAAc1B,6KAAKwB,EAAEC;;;;;;AAI9B,2DAAA,3DAAMP,8HAAwBhB;AAA9B,AACE,kBAAKF,GAAGC;AAAR,AACE,IAAMW,IAAE,AAACH,4CAAYT,GAAGC;AAAxB,AACE,IAAA0B,cAAOd;IAAPe,cAAS,AAAA,mFAAOhB;AAAhB,AAAA,oBAAA,AAAAe,sBAAA,iDAAAC;AAAA,6FAAA,HAEG5B,sFACC,oDAAA,mFAAA,sDAAA,7LAACsB,yMAAkB,AAACO,mEAAuB3B,YAC3C,oDAAA,mFAAA,sDAAA,7LAACoB,yMAAkB,AAACO,mEAAuB3B;;AAJ\/C,oBAAA,AAAAyB,sBAAA,sDAAAC;AAAA,6FAAA,HAMG5B,sFACC,oDAAA,mFAAA,vIAACsB,6LAAe,qHAAA,pHAAG,AAACQ,0BAAM,AAAA,oFAAOlB,mBAAQ,AAACiB,mEAAuB3B;;AAPrE,+KAAA,rFAYG,AAACH,8DAAkBC,GAAGC,SAASC","names":["gamma.compiler.insert-assignments\/insert-assignment","db","location","target-id","set-id","gamma.ast\/gen-term-id","var-id","this-id","parent-loc","gamma.compiler.common\/assoc-elements","gamma.compiler.common\/get-element","gamma.compiler.common\/assoc-in-location","gamma.compiler.insert-assignments\/insert-assignments","e","cljs.core\/=","x","cljs.core\/map-indexed","i","y","gamma.compiler.insert-assignments\/insert-assignments-sub","p__20242","vec__20244","cljs.core\/nth","gamma.compiler.insert-assignments\/in-path","a","b","f","loc","pred__20248","expr__20249","insert-assignments-sub","cljs.core\/count"]} -------------------------------------------------------------------------------- /out/gamma/compiler/insert_variables.cljs: -------------------------------------------------------------------------------- 1 | (ns gamma.compiler.insert-variables 2 | (:use [gamma.ast :only [id? gen-term-id]] 3 | [gamma.compiler.common :only [get-element map-path assoc-in-location assoc-elements]]) 4 | ) 5 | 6 | 7 | (defn insert-variables-sub [db location] 8 | (let [id (gen-term-id)] 9 | (-> db 10 | (assoc-in-location (:parent location) id) 11 | (assoc-elements [{:id id :head :literal :tag :term 12 | :type (:type (get-element db location)) 13 | :value {:tag :variable :id (:id (:id location)) 14 | :type (:type (get-element db location))}}])))) 15 | 16 | (defn parent-env [db location] 17 | (get (db (:id (:parent location))) :env {})) 18 | 19 | (defn insert-variables [env] 20 | (fn [db location] 21 | (let [elt (get-element db location) 22 | ] 23 | (if (env (:id elt)) 24 | [(insert-variables-sub db location) nil] 25 | (let [new-env (into env (concat 26 | (:assignments elt) 27 | (:env elt)))] 28 | [ 29 | db 30 | [[:assignments (map-path (insert-variables env))] 31 | [:body (map-path (insert-variables new-env))] 32 | ]]))))) 33 | 34 | 35 | -------------------------------------------------------------------------------- /out/gamma/compiler/insert_variables.cljs.cache.edn: -------------------------------------------------------------------------------- 1 | ;; Analyzed by ClojureScript 0.0-3308 2 | {:use-macros nil, :excludes #{}, :name gamma.compiler.insert-variables, :imports nil, :requires {gamma.ast gamma.ast, gamma.compiler.common gamma.compiler.common}, :uses {id? gamma.ast, gen-term-id gamma.ast, assoc-in-location gamma.compiler.common, map-path gamma.compiler.common, get-element gamma.compiler.common, assoc-elements gamma.compiler.common}, :defs {insert-variables-sub {:protocol-inline nil, :meta {:file "/Users/james/projects/cljs-draw/out/gamma/compiler/insert_variables.cljs", :line 7, :column 7, :end-line 7, :end-column 27, :arglists (quote ([db location]))}, :name gamma.compiler.insert-variables/insert-variables-sub, :variadic false, :file "out/gamma/compiler/insert_variables.cljs", :end-column 27, :method-params ([db location]), :protocol-impl nil, :arglists-meta (nil nil), :column 1, :line 7, :end-line 7, :max-fixed-arity 2, :fn-var true, :arglists (quote ([db location]))}, parent-env {:protocol-inline nil, :meta {:file "/Users/james/projects/cljs-draw/out/gamma/compiler/insert_variables.cljs", :line 16, :column 7, :end-line 16, :end-column 17, :arglists (quote ([db location]))}, :name gamma.compiler.insert-variables/parent-env, :variadic false, :file "out/gamma/compiler/insert_variables.cljs", :end-column 17, :method-params ([db location]), :protocol-impl nil, :arglists-meta (nil nil), :column 1, :line 16, :end-line 16, :max-fixed-arity 2, :fn-var true, :arglists (quote ([db location]))}, insert-variables {:protocol-inline nil, :meta {:file "/Users/james/projects/cljs-draw/out/gamma/compiler/insert_variables.cljs", :line 19, :column 7, :end-line 19, :end-column 23, :arglists (quote ([env]))}, :name gamma.compiler.insert-variables/insert-variables, :variadic false, :file "out/gamma/compiler/insert_variables.cljs", :end-column 23, :method-params ([env]), :protocol-impl nil, :arglists-meta (nil nil), :column 1, :line 19, :end-line 19, :max-fixed-arity 1, :fn-var true, :arglists (quote ([env]))}}, :require-macros nil, :cljs.analyzer/constants {:seen #{:assignments :variable :parent :value :type :env :term :head :id :literal :tag :body}, :order [:parent :id :head :tag :type :value :literal :term :variable :env :assignments :body]}, :doc nil} -------------------------------------------------------------------------------- /out/gamma/compiler/insert_variables.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"\/Users\/james\/projects\/cljs-draw\/out\/gamma\/compiler\/insert_variables.js","sources":["insert_variables.cljs"],"lineCount":25,"mappings":";AAAA;;;;AAMA,uDAAA,vDAAMA,sHAAsBC,GAAGC;AAA\/B,AACE,IAAMC,KAAG,AAACC;AAAV,wGACMH,lDACA,AAACI,qDAAkB,AAAA,uFAASH,UAAUC,5MACtC,gNAAA,mFAAA,2CAAA,qDAAA,qDAAA,2DAAA,oDAAA,sDAAA,kMAAA,sDAAA,2CAAA,oDAAA,6DAAA,6NAAA,vsCAACG,yXAAwBH,kRACA,AAAA,mFAAO,AAACI,4CAAYN,GAAGC,+QACF,AAAA,gFAAK,AAAA,gFAAKA,gEACxB,AAAA,mFAAO,AAACK,4CAAYN,GAAGC;;AAE\/D,6CAAA,7CAAMM,kGAAYP,GAAGC;AAArB,AACE,+NAAA,oDAAA,5QAACO,wBAAI,AAACR,aAAG,AAAA,gFAAK,AAAA,uFAASC;;AAEzB,mDAAA,nDAAMQ,8GAAkBC;AAAxB,AACE,kBAAKV,GAAGC;AAAR,AACE,IAAMU,MAAI,AAACL,4CAAYN,GAAGC;AAA1B,AAEE,oBAAI,AAACS,cAAI,AAAA,gFAAKC;AAAd,sKAAA,5EACE,AAACZ,+DAAqBC,GAAGC;;AAC1B,IAAMW,UAAQ,AAACC,yBAAKH,IAAI,AAACI,2BACC,AAAA,kGAAcH,KACd,AAAA,kFAAMA;AAFhC,AAAA,6FAAA,mFAAA,mFAAA,sLAAA,mFAAA,lbAIGX,6OACe,AAACe,yCAAS,AAACC,2DAAiBN,uJACnC,AAACK,yCAAS,AAACC,2DAAiBJ","names":["gamma.compiler.insert-variables\/insert-variables-sub","db","location","id","gamma.ast\/gen-term-id","gamma.compiler.common\/assoc-in-location","gamma.compiler.common\/assoc-elements","gamma.compiler.common\/get-element","gamma.compiler.insert-variables\/parent-env","cljs.core\/get","gamma.compiler.insert-variables\/insert-variables","env","elt","new-env","cljs.core\/into","cljs.core\/concat","gamma.compiler.common\/map-path","insert-variables"]} -------------------------------------------------------------------------------- /out/gamma/compiler/lift_assignments.cljs: -------------------------------------------------------------------------------- 1 | (ns gamma.compiler.lift-assignments 2 | (:use [gamma.ast :only [id? gen-term-id]] 3 | [gamma.compiler.common :only [get-element map-path]]) 4 | ) 5 | 6 | 7 | (defn liftable? [db location] 8 | (let [e (get-element db location)] 9 | (or 10 | (= :shared (peek (pop (:path (:parent location))))) 11 | (and 12 | (#{:if} (:head e)) 13 | (let [env (into #{} (:env (db (:id (:parent location)))))] 14 | (not 15 | (if env (env (:id e)) false))))))) 16 | 17 | 18 | ;; do not lift statements that have been bound from above. 19 | 20 | 21 | (defn lift-assignments-sub [db location target-block-id] 22 | (if (liftable? db location) 23 | (update-in db [target-block-id :assignments] (fnil conj []) (:id location)) 24 | db)) 25 | 26 | (defn get-target [db location target-block-id] 27 | (let [e (get-element db location)] 28 | (if (= :block (:head e)) 29 | (:id e) 30 | target-block-id))) 31 | 32 | ;; do we need to topologically sort the assignments at a given level? 33 | 34 | 35 | (defn lift-assignments [target-block-id] 36 | (fn [db location] 37 | [db 38 | ;; if path is in :shared, or is a statement, lift into target 39 | ;; problem is that the :shared bits of a statement must be inserted first 40 | 41 | 42 | [ 43 | 44 | 45 | [:shared (map-path (lift-assignments target-block-id))] 46 | 47 | [:body (let [target (get-target db location target-block-id)] 48 | (map-path (lift-assignments target)))] 49 | 50 | (fn [db location] 51 | [(lift-assignments-sub db location target-block-id) nil]) 52 | ]])) 53 | 54 | 55 | -------------------------------------------------------------------------------- /out/gamma/compiler/lift_assignments.cljs.cache.edn: -------------------------------------------------------------------------------- 1 | ;; Analyzed by ClojureScript 0.0-3308 2 | {:use-macros nil, :excludes #{}, :name gamma.compiler.lift-assignments, :imports nil, :requires {gamma.ast gamma.ast, gamma.compiler.common gamma.compiler.common}, :uses {id? gamma.ast, gen-term-id gamma.ast, map-path gamma.compiler.common, get-element gamma.compiler.common}, :defs {liftable? {:protocol-inline nil, :meta {:file "/Users/james/projects/cljs-draw/out/gamma/compiler/lift_assignments.cljs", :line 7, :column 7, :end-line 7, :end-column 16, :arglists (quote ([db location]))}, :name gamma.compiler.lift-assignments/liftable?, :variadic false, :file "out/gamma/compiler/lift_assignments.cljs", :end-column 16, :method-params ([db location]), :protocol-impl nil, :arglists-meta (nil nil), :column 1, :line 7, :end-line 7, :max-fixed-arity 2, :fn-var true, :arglists (quote ([db location]))}, lift-assignments-sub {:protocol-inline nil, :meta {:file "/Users/james/projects/cljs-draw/out/gamma/compiler/lift_assignments.cljs", :line 21, :column 7, :end-line 21, :end-column 27, :arglists (quote ([db location target-block-id]))}, :name gamma.compiler.lift-assignments/lift-assignments-sub, :variadic false, :file "out/gamma/compiler/lift_assignments.cljs", :end-column 27, :method-params ([db location target-block-id]), :protocol-impl nil, :arglists-meta (nil nil), :column 1, :line 21, :end-line 21, :max-fixed-arity 3, :fn-var true, :arglists (quote ([db location target-block-id]))}, get-target {:protocol-inline nil, :meta {:file "/Users/james/projects/cljs-draw/out/gamma/compiler/lift_assignments.cljs", :line 26, :column 7, :end-line 26, :end-column 17, :arglists (quote ([db location target-block-id]))}, :name gamma.compiler.lift-assignments/get-target, :variadic false, :file "out/gamma/compiler/lift_assignments.cljs", :end-column 17, :method-params ([db location target-block-id]), :protocol-impl nil, :arglists-meta (nil nil), :column 1, :line 26, :end-line 26, :max-fixed-arity 3, :fn-var true, :arglists (quote ([db location target-block-id]))}, lift-assignments {:protocol-inline nil, :meta {:file "/Users/james/projects/cljs-draw/out/gamma/compiler/lift_assignments.cljs", :line 35, :column 7, :end-line 35, :end-column 23, :arglists (quote ([target-block-id]))}, :name gamma.compiler.lift-assignments/lift-assignments, :variadic false, :file "out/gamma/compiler/lift_assignments.cljs", :end-column 23, :method-params ([target-block-id]), :protocol-impl nil, :arglists-meta (nil nil), :column 1, :line 35, :end-line 35, :max-fixed-arity 1, :fn-var true, :arglists (quote ([target-block-id]))}}, :require-macros nil, :cljs.analyzer/constants {:seen #{:path :assignments :block :parent :if :env :head :id :shared :body}, :order [:shared :path :parent :if :head :env :id :assignments :block :body]}, :doc nil} -------------------------------------------------------------------------------- /out/gamma/compiler/lift_assignments.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"\/Users\/james\/projects\/cljs-draw\/out\/gamma\/compiler\/lift_assignments.js","sources":["lift_assignments.cljs"],"lineCount":46,"mappings":";AAAA;;;;AAMA,kDAAA,lDAAMA,4GAAWC,GAAGC;AAApB,AACE,IAAMC,IAAE,AAACC,4CAAYH,GAAGC;AAAxB,AACE,IAAAG,mBACC,yBAAA,zBAACC,kFAAU,AAACC,yBAAK,AAACC,wBAAI,AAAA,mFAAO,AAAA,uFAASN;AADvC,AAAA,GAAAG;AAAAA;;AAEC,IAAAI,oBACE,AAAA,iFAAA,+EAAQ,AAAA,mFAAON;AADjB,AAAA,oBAAAM;AAEE,IAAMC,MAAI,yBAAA,zBAACC,2DAAS,AAAA,kFAAM,AAACV,aAAG,AAAA,gFAAK,AAAA,uFAASC;AAA5C,AACE,OAACU,wBACC,yHAAA,vGAAIF,KAAI,AAACA,cAAI,AAAA,gFAAKP;;AAJxBM;;;;AAUL,uDAAA,vDAAMI,sHAAsBZ,GAAGC,SAASY;AAAxC,AACE,oBAAI,AAACd,0DAAUC,GAAGC;AAChB,wCAAA,mGAAA,pIAACa,8BAAUd,sFAAIa,4FAA8B,wCAAA,xCAACE,yBAAKC,iDAAS,AAAA,gFAAKf;;AACjED;;;AAEJ,6CAAA,7CAAMiB,kGAAYjB,GAAGC,SAASY;AAA9B,AACE,IAAMX,IAAE,AAACC,4CAAYH,GAAGC;AAAxB,AACE,GAAI,yBAAA,zBAACI,+EAAS,AAAA,mFAAOH;AACnB,OAAA,gFAAKA;;AACLW;;;AAKN,mDAAA,nDAAMK,8GAAkBL;AAAxB,AACE,kBAAKb,GAAGC;AAAR,AAAA,6FAAA,mFAAA,mFAAA,uLAAA,mFAAA,nbACGD,kOAQS,AAACmB,yCAAS,AAACC,2DAAiBP,mKAE9B,iBAAMQ,SAAO,AAACJ,qDAAWjB,GAAGC,SAASY;AAArC,AACG,OAACM,yCAAS,AAACC,2DAAiBC;aAEtC,WAAKrB,OAAGC;AAAR,AAAA,8LAAA,pGACG,AAACW,+DAAqBZ,OAAGC,aAASY","names":["gamma.compiler.lift-assignments\/liftable?","db","location","e","gamma.compiler.common\/get-element","or__4953__auto__","cljs.core\/=","cljs.core\/peek","cljs.core\/pop","and__4941__auto__","env","cljs.core\/into","cljs.core\/not","gamma.compiler.lift-assignments\/lift-assignments-sub","target-block-id","cljs.core\/update-in","cljs.core\/fnil","cljs.core\/conj","gamma.compiler.lift-assignments\/get-target","gamma.compiler.lift-assignments\/lift-assignments","gamma.compiler.common\/map-path","lift-assignments","target"]} -------------------------------------------------------------------------------- /out/gamma/compiler/move_assignments.cljs: -------------------------------------------------------------------------------- 1 | (ns gamma.compiler.move-assignments 2 | (:use [gamma.ast :only [id? gen-term-id]] 3 | [gamma.compiler.common :only [get-element map-path assoc-elements assoc-in-location]]) 4 | ) 5 | 6 | 7 | ;; move assignments into the body of blocks 8 | 9 | (defn helper [db location] 10 | (let [e (get-element db location)] 11 | (if (= :block (:head e)) 12 | (let [a (:assignments e) b (:body e)] 13 | (assoc 14 | db 15 | (:id e) 16 | (assoc (dissoc e :assignments) :body (vec (concat a b)))) 17 | ) 18 | db))) 19 | 20 | (defn move-assignments [] 21 | (fn [db location] 22 | [(helper db location) [ [:body (map-path (move-assignments))]]])) -------------------------------------------------------------------------------- /out/gamma/compiler/move_assignments.cljs.cache.edn: -------------------------------------------------------------------------------- 1 | ;; Analyzed by ClojureScript 0.0-3308 2 | {:use-macros nil, :excludes #{}, :name gamma.compiler.move-assignments, :imports nil, :requires {gamma.ast gamma.ast, gamma.compiler.common gamma.compiler.common}, :uses {id? gamma.ast, gen-term-id gamma.ast, assoc-in-location gamma.compiler.common, map-path gamma.compiler.common, get-element gamma.compiler.common, assoc-elements gamma.compiler.common}, :defs {helper {:protocol-inline nil, :meta {:file "/Users/james/projects/cljs-draw/out/gamma/compiler/move_assignments.cljs", :line 9, :column 7, :end-line 9, :end-column 13, :arglists (quote ([db location]))}, :name gamma.compiler.move-assignments/helper, :variadic false, :file "out/gamma/compiler/move_assignments.cljs", :end-column 13, :method-params ([db location]), :protocol-impl nil, :arglists-meta (nil nil), :column 1, :line 9, :end-line 9, :max-fixed-arity 2, :fn-var true, :arglists (quote ([db location]))}, move-assignments {:protocol-inline nil, :meta {:file "/Users/james/projects/cljs-draw/out/gamma/compiler/move_assignments.cljs", :line 20, :column 7, :end-line 20, :end-column 23, :arglists (quote ([]))}, :name gamma.compiler.move-assignments/move-assignments, :variadic false, :file "out/gamma/compiler/move_assignments.cljs", :end-column 23, :method-params ([]), :protocol-impl nil, :arglists-meta (nil nil), :column 1, :line 20, :end-line 20, :max-fixed-arity 0, :fn-var true, :arglists (quote ([]))}}, :require-macros nil, :cljs.analyzer/constants {:seen #{:assignments :block :head :id :body}, :order [:block :head :assignments :body :id]}, :doc nil} -------------------------------------------------------------------------------- /out/gamma/compiler/move_assignments.js: -------------------------------------------------------------------------------- 1 | // Compiled by ClojureScript 0.0-3308 {} 2 | goog.provide('gamma.compiler.move_assignments'); 3 | goog.require('cljs.core'); 4 | goog.require('gamma.ast'); 5 | goog.require('gamma.compiler.common'); 6 | gamma.compiler.move_assignments.helper = (function gamma$compiler$move_assignments$helper(db,location){ 7 | var e = gamma.compiler.common.get_element.call(null,db,location); 8 | if(cljs.core._EQ_.call(null,new cljs.core.Keyword(null,"block","block",664686210),new cljs.core.Keyword(null,"head","head",-771383919).cljs$core$IFn$_invoke$arity$1(e))){ 9 | var a = new cljs.core.Keyword(null,"assignments","assignments",-1114514911).cljs$core$IFn$_invoke$arity$1(e); 10 | var b = new cljs.core.Keyword(null,"body","body",-2049205669).cljs$core$IFn$_invoke$arity$1(e); 11 | return cljs.core.assoc.call(null,db,new cljs.core.Keyword(null,"id","id",-1388402092).cljs$core$IFn$_invoke$arity$1(e),cljs.core.assoc.call(null,cljs.core.dissoc.call(null,e,new cljs.core.Keyword(null,"assignments","assignments",-1114514911)),new cljs.core.Keyword(null,"body","body",-2049205669),cljs.core.vec.call(null,cljs.core.concat.call(null,a,b)))); 12 | } else { 13 | return db; 14 | } 15 | }); 16 | gamma.compiler.move_assignments.move_assignments = (function gamma$compiler$move_assignments$move_assignments(){ 17 | return (function (db,location){ 18 | return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [gamma.compiler.move_assignments.helper.call(null,db,location),new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"body","body",-2049205669),gamma.compiler.common.map_path.call(null,gamma$compiler$move_assignments$move_assignments.call(null))], null)], null)], null); 19 | }); 20 | }); 21 | 22 | //# sourceMappingURL=move_assignments.js.map -------------------------------------------------------------------------------- /out/gamma/compiler/move_assignments.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"\/Users\/james\/projects\/cljs-draw\/out\/gamma\/compiler\/move_assignments.js","sources":["move_assignments.cljs"],"lineCount":22,"mappings":";AAAA;;;;AAQA,yCAAA,zCAAMA,0FAAQC,GAAGC;AAAjB,AACE,IAAMC,IAAE,AAACC,4CAAYH,GAAGC;AAAxB,AACE,GAAI,yBAAA,zBAACG,+EAAS,AAAA,mFAAOF;AACnB,IAAMG,IAAE,AAAA,kGAAcH;IAAGI,IAAE,AAAA,oFAAOJ;AAAlC,AACE,OAACK,0BACCP,GACA,AAAA,gFAAKE,GACL,4HAAA,5HAACK,0BAAM,6BAAA,7BAACC,2BAAON,6HAAsB,AAACO,wBAAI,AAACC,2BAAOL,EAAEC;;AAExDN;;;AAEN,mDAAA,nDAAMW;AAAN,AACE,kBAAKX,GAAGC;AAAR,AAAA,wJAAA,mFAAA,mFAAA,pOACG,AAACF,iDAAOC,GAAGC,sOAAmB,AAACW,yCAAS,AAACC","names":["gamma.compiler.move-assignments\/helper","db","location","e","gamma.compiler.common\/get-element","cljs.core\/=","a","b","cljs.core\/assoc","cljs.core\/dissoc","cljs.core\/vec","cljs.core\/concat","gamma.compiler.move-assignments\/move-assignments","gamma.compiler.common\/map-path","move-assignments"]} -------------------------------------------------------------------------------- /out/gamma/emit/construct.cljs: -------------------------------------------------------------------------------- 1 | (ns gamma.emit.construct 2 | (:use [gamma.emit.emit :only [emit]] 3 | [gamma.ast :only [head body term ]])) 4 | 5 | (defmethod emit :constructor [db x] 6 | [:group 7 | (name (head x)) 8 | "(" 9 | [:line ""] 10 | [:nest 2 11 | (interpose [:span "," :line] 12 | (map #(emit db (db %)) (body x)))] 13 | ")"]) 14 | -------------------------------------------------------------------------------- /out/gamma/emit/construct.cljs.cache.edn: -------------------------------------------------------------------------------- 1 | ;; Analyzed by ClojureScript 0.0-3308 2 | {:name gamma.emit.construct, :doc nil, :excludes #{}, :use-macros nil, :require-macros nil, :uses {body gamma.ast, term gamma.ast, head gamma.ast, emit gamma.emit.emit}, :requires {gamma.emit.emit gamma.emit.emit, gamma.ast gamma.ast}, :imports nil, :cljs.analyzer/constants {:seen #{:nest :group :line :constructor :span}, :order [:constructor :group :line :nest :span]}} -------------------------------------------------------------------------------- /out/gamma/emit/construct.js: -------------------------------------------------------------------------------- 1 | // Compiled by ClojureScript 0.0-3308 {} 2 | goog.provide('gamma.emit.construct'); 3 | goog.require('cljs.core'); 4 | goog.require('gamma.emit.emit'); 5 | goog.require('gamma.ast'); 6 | cljs.core._add_method.call(null,gamma.emit.emit.emit,new cljs.core.Keyword(null,"constructor","constructor",-1953928811),(function (db,x){ 7 | return new cljs.core.PersistentVector(null, 6, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"group","group",582596132),cljs.core.name.call(null,gamma.ast.head.call(null,x)),"(",new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"line","line",212345235),""], null),new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"nest","nest",-314993663),(2),cljs.core.interpose.call(null,new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"span","span",1394872991),",",new cljs.core.Keyword(null,"line","line",212345235)], null),cljs.core.map.call(null,(function (p1__20231_SHARP_){ 8 | return gamma.emit.emit.emit.call(null,db,db.call(null,p1__20231_SHARP_)); 9 | }),gamma.ast.body.call(null,x)))], null),")"], null); 10 | })); 11 | 12 | //# sourceMappingURL=construct.js.map -------------------------------------------------------------------------------- /out/gamma/emit/construct.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"\/Users\/james\/projects\/cljs-draw\/out\/gamma\/emit\/construct.js","sources":["construct.cljs"],"lineCount":12,"mappings":";AAAA;;;;AAIA,AAAAA,gCAAAC,qBAAA,oEAAA,WAA8BC,GAAGC;AAAjC,AAAA,0FAAA,4GAAA,IAAA,mFAAA,oDAAA,WAAA,mFAAA,qDAAA,pVAEG,AAACC,yBAAK,AAACC,yBAAKF,sSAIX,8BAAA,mFAAA,qDAAA,IAAA,1KAACG,sOACU,wBAAA,WAAAC,nCAACC;AAAD,AAAM,OAACP,+BAAKC,GAAG,aAAAK,bAACL;yCAP\/B,tCAOsC,AAACO,yBAAKN","names":["cljs.core\/-add-method","gamma.emit.emit\/emit","db","x","cljs.core\/name","gamma.ast\/head","cljs.core\/interpose","p1__20231#","cljs.core\/map","gamma.ast\/body"]} -------------------------------------------------------------------------------- /out/gamma/emit/emit.cljs: -------------------------------------------------------------------------------- 1 | (ns gamma.emit.emit 2 | (:use [gamma.ast :only [term head body]])) 3 | 4 | 5 | (defn function? [x] 6 | (gamma.ast/functions (head x))) 7 | 8 | (defn operator-class [x] 9 | (if-let [o (gamma.ast/operators (head x))] 10 | (:class o))) 11 | 12 | (defn primitive? [x] 13 | (or (true? x) (false? x) (integer? x) (number? x))) 14 | 15 | (defn constructor? [x] 16 | (#{:vec2 :vec3 :vec4 :bvec2 :bvec3 :bvec4 :ivec2 :ivec3 :ivec4 :mat2 :mat3 :mat4} 17 | (:head x))) 18 | 19 | (defn emit-dispatch [db x] 20 | (if (primitive? x) 21 | :primitive 22 | (if (#{:float :bool :int} x) 23 | :primitive-type 24 | (if 25 | (constructor? x) 26 | :constructor 27 | (if (function? x) 28 | :function 29 | (if-let [c (operator-class x)] 30 | c 31 | (if-let [h (head x)] 32 | h 33 | (:tag x)))))))) 34 | 35 | 36 | (defmulti emit emit-dispatch) 37 | 38 | (defmethod emit :primitive [db x] 39 | (if (number? x) 40 | (let [tmp (str x)] 41 | (if (pos? (.indexOf tmp ".")) 42 | tmp 43 | (str tmp ".0"))) 44 | (str x))) 45 | 46 | (defmethod emit :primitive-type [db x] (name x)) 47 | 48 | (defmethod emit :literal [db x] (emit db (:value x))) 49 | 50 | (defmethod emit nil [db x] (println [:nil x])) 51 | -------------------------------------------------------------------------------- /out/gamma/emit/emit.cljs.cache.edn: -------------------------------------------------------------------------------- 1 | ;; Analyzed by ClojureScript 0.0-3308 2 | {:use-macros nil, :excludes #{}, :name gamma.emit.emit, :imports nil, :requires {gamma.ast gamma.ast}, :uses {body gamma.ast, term gamma.ast, head gamma.ast}, :defs {function? {:protocol-inline nil, :meta {:file "/Users/james/projects/cljs-draw/out/gamma/emit/emit.cljs", :line 5, :column 7, :end-line 5, :end-column 16, :arglists (quote ([x]))}, :name gamma.emit.emit/function?, :variadic false, :file "out/gamma/emit/emit.cljs", :end-column 16, :method-params ([x]), :protocol-impl nil, :arglists-meta (nil nil), :column 1, :line 5, :end-line 5, :max-fixed-arity 1, :fn-var true, :arglists (quote ([x]))}, operator-class {:protocol-inline nil, :meta {:file "/Users/james/projects/cljs-draw/out/gamma/emit/emit.cljs", :line 8, :column 7, :end-line 8, :end-column 21, :arglists (quote ([x]))}, :name gamma.emit.emit/operator-class, :variadic false, :file "out/gamma/emit/emit.cljs", :end-column 21, :method-params ([x]), :protocol-impl nil, :arglists-meta (nil nil), :column 1, :line 8, :end-line 8, :max-fixed-arity 1, :fn-var true, :arglists (quote ([x]))}, primitive? {:protocol-inline nil, :meta {:file "/Users/james/projects/cljs-draw/out/gamma/emit/emit.cljs", :line 12, :column 7, :end-line 12, :end-column 17, :arglists (quote ([x]))}, :name gamma.emit.emit/primitive?, :variadic false, :file "out/gamma/emit/emit.cljs", :end-column 17, :method-params ([x]), :protocol-impl nil, :arglists-meta (nil nil), :column 1, :line 12, :end-line 12, :max-fixed-arity 1, :fn-var true, :arglists (quote ([x]))}, constructor? {:protocol-inline nil, :meta {:file "/Users/james/projects/cljs-draw/out/gamma/emit/emit.cljs", :line 15, :column 7, :end-line 15, :end-column 19, :arglists (quote ([x]))}, :name gamma.emit.emit/constructor?, :variadic false, :file "out/gamma/emit/emit.cljs", :end-column 19, :method-params ([x]), :protocol-impl nil, :arglists-meta (nil nil), :column 1, :line 15, :end-line 15, :max-fixed-arity 1, :fn-var true, :arglists (quote ([x]))}, emit-dispatch {:protocol-inline nil, :meta {:file "/Users/james/projects/cljs-draw/out/gamma/emit/emit.cljs", :line 19, :column 7, :end-line 19, :end-column 20, :arglists (quote ([db x]))}, :name gamma.emit.emit/emit-dispatch, :variadic false, :file "out/gamma/emit/emit.cljs", :end-column 20, :method-params ([db x]), :protocol-impl nil, :arglists-meta (nil nil), :column 1, :line 19, :end-line 19, :max-fixed-arity 2, :fn-var true, :arglists (quote ([db x]))}, emit {:name gamma.emit.emit/emit, :file "out/gamma/emit/emit.cljs", :line 36, :column 1, :end-line 36, :end-column 15, :meta {:file "/Users/james/projects/cljs-draw/out/gamma/emit/emit.cljs", :line 36, :column 11, :end-line 36, :end-column 15}}}, :require-macros nil, :cljs.analyzer/constants {:seen #{:bvec3 :int :mat3 :default :vec3 :float :ivec4 :value :mat2 :ivec2 :vec4 :function :primitive :vec2 :bvec2 :head :class :nil :constructor :literal :mat4 :bvec4 :tag :bool :hierarchy :ivec3 :primitive-type}, :order [:class :bvec3 :mat3 :vec3 :ivec4 :mat2 :ivec2 :vec4 :vec2 :bvec2 :mat4 :bvec4 :ivec3 :head :primitive :int :float :bool :primitive-type :constructor :function :tag :hierarchy :default :literal :value :nil]}, :doc nil} -------------------------------------------------------------------------------- /out/gamma/emit/emit.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"\/Users\/james\/projects\/cljs-draw\/out\/gamma\/emit\/emit.js","sources":["emit.cljs"],"lineCount":86,"mappings":";AAAA;;;AAIA,kCAAA,lCAAMA,4EAAWC;AAAjB,AACE,OAACC,8BAAoB,AAACC,yBAAKF;;AAE7B,iCAAA,jCAAMG,0EAAgBH;AAAtB,AACE,IAAAI,qBAAW,AAACE,8BAAoB,AAACJ,yBAAKF;AAAtC,AAAA,oBAAAI;AAAA,QAAAA,JAASC;AAAT,AACE,OAAA,sFAAQA;;AADV;;;AAGF,mCAAA,nCAAME,8EAAYP;AAAlB,AACE,QAAI,AAAOA,gBAAG,AAAQA,iBAAG,AAACQ,mCAASR,QAAG,OAASA;;AAEjD,qCAAA,rCAAMS,kFAAcT;AAApB,AACE,OAAA,kFAAA,4DAAA,yDAAA,0DAAA,4DAAA,yDAAA,2DAAA,yDAAA,0DAAA,4DAAA,0DAAA,4DAAA,qFACE,AAAA,mFAAOA;;AAEX,gCAAA,hCAAMU,wEAAeC,GAAGX;AAAxB,AACE,oBAAI,AAACO,2CAAWP;AAAhB;;AAEE,oBAAI,AAAA,iFAAA,yDAAA,6DAAA,mFAAsBA;AAA1B;;AAEE,oBACE,AAACS,6CAAaT;AADhB;;AAGE,oBAAI,AAACD,0CAAUC;AAAf;;AAEC,IAAAI,qBAAW,AAACD,yCAAeH;AAA3B,AAAA,oBAAAI;AAAA,QAAAA,JAASQ;AAAT,AACEA;;AACA,IAAAR,yBAAW,AAACF,yBAAKF;AAAjB,AAAA,oBAAAI;AAAA,QAAAA,JAASS;AAAT,AACEA;;AACA,OAAA,kFAAMb;;;;;;;;AAGnB,GAAA,OAAUwB;AAAV;AAAA,AAAA,uBAAA,iBAAAV,6BAAA,AAAAC,yBAAA,9FAAUS;IAAVR,6BAAA,AAAAD,yBAAA;IAAAE,6BAAA,AAAAF,yBAAA;IAAAG,iCAAA,AAAAH,yBAAA;IAAAI,0BAAA,AAAAC,wBAAA,mCAAA,gEAAA,AAAAC;AAAA,AAAA,YAAAC,kBAAA,AAAAC,2BAAA,kBAAA,sCAAA,4DAAAJ,wBAAAL,2BAAAE,2BAAAC,2BAAAC,nMAAeR;;;AAEf,AAAAe,gCAAAD,qBAAA,+DAAA,WAA4Bb,GAAGX;AAA\/B,AACE,GAAI,OAASA;AACX,IAAM0B,MAAI,eAAK1B;AAAf,AACE,GAAI,oBAAA,nBAAM,YAAA,ZAAU0B;AAClBA;;AACA,yCAAA,nBAAKA;;;AACT,sBAAK1B;;;AAET,AAAAyB,gCAAAD,qBAAA,yEAAA,WAAiCb,GAAGX;AAApC,AAAuC,OAAC2B,yBAAK3B;;AAE7C,AAAAyB,gCAAAD,qBAAA,2DAAA,WAA0Bb,GAAGX;AAA7B,AAAgC,OAACwB,+BAAKb,GAAG,AAAA,oFAAQX;;AAEjD,AAAAyB,gCAAAD,qBAAA,KAAA,WAAqBb,GAAGX;AAAxB,AAA2B,mCAAA,mFAAA,\/GAAC4B,gKAAc5B","names":["gamma.emit.emit\/function?","x","gamma.ast\/functions","gamma.ast\/head","gamma.emit.emit\/operator-class","temp__4421__auto__","o","gamma.ast\/operators","gamma.emit.emit\/primitive?","cljs.core\/integer?","gamma.emit.emit\/constructor?","gamma.emit.emit\/emit-dispatch","db","c","h","method-table__5848__auto__","cljs.core\/atom","prefer-table__5849__auto__","method-cache__5850__auto__","cached-hierarchy__5851__auto__","hierarchy__5852__auto__","cljs.core\/get","cljs.core\/get-global-hierarchy","cljs.core\/MultiFn","cljs.core\/symbol","gamma.emit.emit\/emit","cljs.core\/-add-method","tmp","cljs.core\/name","cljs.core\/println"]} -------------------------------------------------------------------------------- /out/gamma/emit/fun.cljs: -------------------------------------------------------------------------------- 1 | (ns gamma.emit.fun 2 | (:use [gamma.emit.emit :only [emit]] 3 | [gamma.ast :only [head body term ]])) 4 | 5 | 6 | ;;;; FUNCTIONS 7 | 8 | 9 | 10 | (defmethod emit :function [db x] 11 | [:group 12 | (name (head x)) 13 | "(" 14 | [:line ""] 15 | [:nest 2 16 | (interpose [:span "," :line] 17 | (map #(emit db (db %)) (body x)))] 18 | ")"]) 19 | 20 | (defmethod emit :swizzle [db x] 21 | [:span (emit db (db (first (body x)))) "." (name (:swizzle x))]) 22 | 23 | -------------------------------------------------------------------------------- /out/gamma/emit/fun.cljs.cache.edn: -------------------------------------------------------------------------------- 1 | ;; Analyzed by ClojureScript 0.0-3308 2 | {:name gamma.emit.fun, :doc nil, :excludes #{}, :use-macros nil, :require-macros nil, :uses {body gamma.ast, term gamma.ast, head gamma.ast, emit gamma.emit.emit}, :requires {gamma.emit.emit gamma.emit.emit, gamma.ast gamma.ast}, :imports nil, :cljs.analyzer/constants {:seen #{:nest :group :function :line :swizzle :span}, :order [:function :group :line :nest :span :swizzle]}} -------------------------------------------------------------------------------- /out/gamma/emit/fun.js: -------------------------------------------------------------------------------- 1 | // Compiled by ClojureScript 0.0-3308 {} 2 | goog.provide('gamma.emit.fun'); 3 | goog.require('cljs.core'); 4 | goog.require('gamma.emit.emit'); 5 | goog.require('gamma.ast'); 6 | cljs.core._add_method.call(null,gamma.emit.emit.emit,new cljs.core.Keyword(null,"function","function",-2127255473),(function (db,x){ 7 | return new cljs.core.PersistentVector(null, 6, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"group","group",582596132),cljs.core.name.call(null,gamma.ast.head.call(null,x)),"(",new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"line","line",212345235),""], null),new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"nest","nest",-314993663),(2),cljs.core.interpose.call(null,new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"span","span",1394872991),",",new cljs.core.Keyword(null,"line","line",212345235)], null),cljs.core.map.call(null,(function (p1__20228_SHARP_){ 8 | return gamma.emit.emit.emit.call(null,db,db.call(null,p1__20228_SHARP_)); 9 | }),gamma.ast.body.call(null,x)))], null),")"], null); 10 | })); 11 | cljs.core._add_method.call(null,gamma.emit.emit.emit,new cljs.core.Keyword(null,"swizzle","swizzle",-956643048),(function (db,x){ 12 | return new cljs.core.PersistentVector(null, 4, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"span","span",1394872991),gamma.emit.emit.emit.call(null,db,db.call(null,cljs.core.first.call(null,gamma.ast.body.call(null,x)))),".",cljs.core.name.call(null,new cljs.core.Keyword(null,"swizzle","swizzle",-956643048).cljs$core$IFn$_invoke$arity$1(x))], null); 13 | })); 14 | 15 | //# sourceMappingURL=fun.js.map -------------------------------------------------------------------------------- /out/gamma/emit/fun.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"\/Users\/james\/projects\/cljs-draw\/out\/gamma\/emit\/fun.js","sources":["fun.cljs"],"lineCount":15,"mappings":";AAAA;;;;AASA,AAAAA,gCAAAC,qBAAA,8DAAA,WAA2BC,GAAGC;AAA9B,AAAA,0FAAA,4GAAA,IAAA,mFAAA,oDAAA,WAAA,mFAAA,qDAAA,pVAEG,AAACC,yBAAK,AAACC,yBAAKF,sSAIX,8BAAA,mFAAA,qDAAA,IAAA,1KAACG,sOACU,wBAAA,WAAAC,nCAACC;AAAD,AAAM,OAACP,+BAAKC,GAAG,aAAAK,bAACL;yCAP\/B,tCAOsC,AAACO,yBAAKN;;AAG5C,AAAAH,gCAAAC,qBAAA,2DAAA,WAA0BC,GAAGC;AAA7B,AAAA,0FAAA,6JAAA,xGACS,AAACF,+BAAKC,GAAG,AAACA,aAAG,AAACQ,0BAAM,AAACD,yBAAKN,UAAW,AAACC,yBAAK,AAAA,yFAAUD","names":["cljs.core\/-add-method","gamma.emit.emit\/emit","db","x","cljs.core\/name","gamma.ast\/head","cljs.core\/interpose","p1__20228#","cljs.core\/map","gamma.ast\/body","cljs.core\/first"]} -------------------------------------------------------------------------------- /out/gamma/emit/operator.cljs: -------------------------------------------------------------------------------- 1 | (ns gamma.emit.operator 2 | (:use [gamma.emit.emit :only [emit]] 3 | [gamma.ast :only [head body term]])) 4 | 5 | 6 | ;;; OPERATOR CASES 7 | 8 | (defmethod emit :infix [db x] 9 | (let [literal (:literal (gamma.ast/operators (head x)))] 10 | [:group "(" (interpose (str " " literal " ") (map #(emit db (db %)) (body x))) ")"])) 11 | 12 | (defmethod emit :prefix [db x] 13 | (let [literal (:literal (gamma.ast/operators (head x)))] 14 | [:group "(" (str " " literal ) (emit db (db (first (body x)))) ")"])) 15 | 16 | (defmethod emit :postfix [db x] 17 | (let [literal (:literal (gamma.ast/operators (head x)))] 18 | [:group "(" (emit db (db (first (body x)))) (str literal " ") ")"])) 19 | 20 | 21 | (defmethod emit :constructor [db x] 22 | [:group 23 | (emit db (db (first (body x)))) 24 | "(" 25 | [:line ""] 26 | [:nest 2 27 | (interpose [:span "," :line] 28 | (map #(emit db (db %)) (rest (body x))))] 29 | ")"]) 30 | 31 | (defmethod emit :conditional-choice [db x]) 32 | 33 | 34 | (defmethod emit :aget [db x] 35 | (str (emit (first (body x))) "[" (emit (second (body x))) "]")) 36 | 37 | 38 | (defmethod emit :selector [db x] 39 | (str (emit (first (body x))) "." (name (second (body x))))) 40 | 41 | -------------------------------------------------------------------------------- /out/gamma/emit/operator.cljs.cache.edn: -------------------------------------------------------------------------------- 1 | ;; Analyzed by ClojureScript 0.0-3308 2 | {:name gamma.emit.operator, :doc nil, :excludes #{}, :use-macros nil, :require-macros nil, :uses {body gamma.ast, term gamma.ast, head gamma.ast, emit gamma.emit.emit}, :requires {gamma.emit.emit gamma.emit.emit, gamma.ast gamma.ast}, :imports nil, :cljs.analyzer/constants {:seen #{:nest :infix :selector :group :postfix :prefix :conditional-choice :line :constructor :literal :aget :span}, :order [:infix :literal :group :prefix :postfix :constructor :line :nest :span :conditional-choice :aget :selector]}} -------------------------------------------------------------------------------- /out/gamma/emit/operator.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"\/Users\/james\/projects\/cljs-draw\/out\/gamma\/emit\/operator.js","sources":["operator.cljs"],"lineCount":37,"mappings":";AAAA;;;;AAOA,AAAAA,gCAAAC,qBAAA,uDAAA,WAAwBC,GAAGC;AAA3B,AACE,IAAMC,UAAQ,AAAA,yFAAU,AAACC,8BAAoB,AAACC,yBAAKH;AAAnD,AAAA,0FAAA,sDAAA,IACc,AAACI,8BAAU,eAAA,0CAAA,vBAASH,sCAAa,wBAAA,xBAACK;kBAADD;AAAA,AAAM,OAACP,+BAAKC,GAAG,aAAAM,bAACN;;+BAD\/D,9BACsE,AAACQ,yBAAKP;;AAE9E,AAAAH,gCAAAC,qBAAA,yDAAA,WAAyBC,GAAGC;AAA5B,AACE,IAAMC,UAAQ,AAAA,yFAAU,AAACC,8BAAoB,AAACC,yBAAKH;AAAnD,AAAA,0FAAA,sDAAA,iKAAA,7JACc,eAAA,mBAASC,mBAAU,AAACH,+BAAKC,GAAG,AAACA,aAAG,AAACS,0BAAM,AAACD,yBAAKP;;AAE7D,AAAAH,gCAAAC,qBAAA,2DAAA,WAA0BC,GAAGC;AAA7B,AACE,IAAMC,UAAQ,AAAA,yFAAU,AAACC,8BAAoB,AAACC,yBAAKH;AAAnD,AAAA,0FAAA,sDAAA,iKAAA,7JACc,AAACF,+BAAKC,GAAG,AAACA,aAAG,AAACS,0BAAM,AAACD,yBAAKP,MAAM,sCAAA,vBAAKC;;AAGrD,AAAAJ,gCAAAC,qBAAA,oEAAA,WAA8BC,GAAGC;AAAjC,AAAA,0FAAA,8JAAA,IAAA,mFAAA,oDAAA,WAAA,mFAAA,qDAAA,tYAEG,AAACF,+BAAKC,GAAG,AAACA,aAAG,AAACS,0BAAM,AAACD,yBAAKP,wSAIzB,8BAAA,mFAAA,qDAAA,IAAA,1KAACI,sOACU,wBAAA,WAAAK,nCAACH;AAAD,AAAM,OAACR,+BAAKC,GAAG,aAAAU,bAACV;mEAP\/B,hEAOsC,AAACW,yBAAK,AAACH,yBAAKP;;AAGlD,AAAAH,gCAAAC,qBAAA,iFAAA,WAAqCC,GAAGC;AAAxC,AAAA;;AAGA,AAAAH,gCAAAC,qBAAA,qDAAA,WAAuBC,GAAGC;AAA1B,AACE,4HAAA,0HAAA,hOAAK,AAACF,+BAAK,AAACU,0BAAM,AAACD,yBAAKP,uCAAS,AAACF,+BAAK,AAACa,2BAAO,AAACJ,yBAAKP;;AAGvD,AAAAH,gCAAAC,qBAAA,4DAAA,WAA2BC,GAAGC;AAA9B,AACE,4HAAA,tGAAK,AAACF,+BAAK,AAACU,0BAAM,AAACD,yBAAKP,uCAAS,AAACY,yBAAK,AAACD,2BAAO,AAACJ,yBAAKP","names":["cljs.core\/-add-method","gamma.emit.emit\/emit","db","x","literal","gamma.ast\/operators","gamma.ast\/head","cljs.core\/interpose","p1__20753#","cljs.core\/map","gamma.ast\/body","cljs.core\/first","p1__20754#","cljs.core\/rest","cljs.core\/second","cljs.core\/name"]} -------------------------------------------------------------------------------- /out/gamma/emit/statement.cljs: -------------------------------------------------------------------------------- 1 | (ns gamma.emit.statement 2 | (:use [gamma.emit.emit :only [emit]] 3 | [gamma.ast :only [head body term]])) 4 | 5 | ;;;; STATEMENTS 6 | 7 | (defmethod emit :break [db x] 8 | "break") 9 | 10 | (defmethod emit :continue [db x] 11 | "continue") 12 | 13 | (defmethod emit :discard [db x] 14 | "discard") 15 | 16 | (defmethod emit :block [db x] 17 | [:group 18 | (interpose :break 19 | (map (fn [y] 20 | [:group 21 | (emit db (db y)) 22 | (if (#{:if :block} (head (db y))) 23 | "" ";")]) (body x)))]) 24 | 25 | (defmethod emit :set [db x] 26 | [:group (emit db (db (first (body x)))) "=" (emit db (db (second (body x))))]) 27 | 28 | 29 | 30 | 31 | 32 | (comment 33 | [:group 34 | (name (head x)) 35 | "(" 36 | [:line ""] 37 | [:nest 2 38 | (interpose [:span "," :line] 39 | (map #(emit db (db %)) (body x)))] 40 | ")"]) 41 | 42 | (defmethod emit :if [db x] 43 | (let [[test then else] (body x)] 44 | [:group 45 | "if(" 46 | (emit db (db test)) 47 | ")" 48 | "{" 49 | [:nest 2 :break (emit db (db then))] 50 | 51 | "}" 52 | :break 53 | [:nest 2 "else {" :break [:nest 2 (emit db (db else))]] 54 | 55 | "}"] 56 | )) 57 | 58 | 59 | 60 | 61 | 62 | (defmethod emit :for [x] 63 | (let [[init condition increment bod] (body x)] 64 | (str "for(" 65 | (emit init) ";" 66 | (emit condition) ";" 67 | (emit increment) ";){" 68 | (emit bod) 69 | "}"))) 70 | 71 | 72 | 73 | 74 | (defmethod emit :if-else [x] 75 | (let [[test then else] (body x)] 76 | [:group "if" "(" ()] 77 | (str "if(" (emit test) ")" 78 | "{" (emit then) "}" 79 | "else" "{" 80 | (emit else) 81 | "}"))) 82 | 83 | 84 | -------------------------------------------------------------------------------- /out/gamma/emit/statement.cljs.cache.edn: -------------------------------------------------------------------------------- 1 | ;; Analyzed by ClojureScript 0.0-3308 2 | {:name gamma.emit.statement, :doc nil, :excludes #{}, :use-macros nil, :require-macros nil, :uses {body gamma.ast, term gamma.ast, head gamma.ast, emit gamma.emit.emit}, :requires {gamma.emit.emit gamma.emit.emit, gamma.ast gamma.ast}, :imports nil, :cljs.analyzer/constants {:seen #{:nest :block :group :if-else :continue :if :break :for :discard :set}, :order [:break :continue :discard :block :group :if :set :nest :for :if-else]}} -------------------------------------------------------------------------------- /out/gamma/emit/statement.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"\/Users\/james\/projects\/cljs-draw\/out\/gamma\/emit\/statement.js","sources":["statement.cljs"],"lineCount":48,"mappings":";AAAA;;;;AAMA,AAAAA,gCAAAC,qBAAA,sDAAA,WAAwBC,GAAGC;AAA3B,AAAA;;AAGA,AAAAH,gCAAAC,qBAAA,6DAAA,WAA2BC,GAAGC;AAA9B,AAAA;;AAGA,AAAAH,gCAAAC,qBAAA,4DAAA,WAA0BC,GAAGC;AAA7B,AAAA;;AAGA,AAAAH,gCAAAC,qBAAA,sDAAA,WAAwBC,GAAGC;AAA3B,AAAA,0FAAA,sDAEG,8BAAA,9BAACC,oFACU,AAACC,wBAAI,WAAKC;AAAL,AAAA,0FAAA,sDAEG,AAACL,+BAAKC,GAAG,AAACA,aAAGI,IACP,yRAAA,GAAA,1QAAI,AAAA,iFAAA,2DAAA,+EAAe,AAACC,yBAAK,AAACL,aAAGI;GACf,AAACE,yBAAKL;;AAEhD,AAAAH,gCAAAC,qBAAA,kDAAA,WAAsBC,GAAGC;AAAzB,AAAA,0FAAA,8JAAA,xGACU,AAACF,+BAAKC,GAAG,AAACA,aAAG,AAACO,0BAAM,AAACD,yBAAKL,UAAU,AAACF,+BAAKC,GAAG,AAACA,aAAG,AAACQ,2BAAO,AAACF,yBAAKL;;AAMzE,AAUA,AAAAH,gCAAAC,qBAAA,iDAAA,WAAqBC,GAAGC;AAAxB,AACE,IAAAQ,aAAuB,AAACH,yBAAKL;WAA7B,AAAAS,wBAAAD,WAAA,IAAA,9CAAOE;WAAP,AAAAD,wBAAAD,WAAA,IAAA,9CAAYG;YAAZ,AAAAF,wBAAAD,WAAA,IAAA,\/CAAiBI;AAAjB,AAAA,2FAAA,sDAAA,4DAAA,IAAA,IAAA,mFAAA,qDAAA,IAAA,oHAAA,IAAA,sDAAA,mFAAA,qDAAA,IAAA,SAAA,sDAAA,mFAAA,qDAAA,2EAAA,txBAGG,AAACd,+BAAKC,GAAG,AAACA,aAAGW,iNAGG,AAACZ,+BAAKC,GAAG,AAACA,aAAGY,gaAIK,AAACb,+BAAKC,GAAG,AAACA,aAAGa;;AASpD,AAAAf,gCAAAC,qBAAA,oDAAA,WAAsBE;AAAtB,AACE,IAAAa,aAAqC,AAACR,yBAAKL;WAA3C,AAAAS,wBAAAI,WAAA,IAAA,9CAAOC;gBAAP,AAAAL,wBAAAI,WAAA,IAAA,nDAAYE;gBAAZ,AAAAN,wBAAAI,WAAA,IAAA,nDAAsBG;UAAtB,AAAAP,wBAAAI,WAAA,IAAA,7CAAgCI;AAAhC,AACE,sBAAA,0EAAA,4EAAA,4EAAA,wEAAA,pRACK,AAACnB,+BAAKgB,wCACN,AAAChB,+BAAKiB,6CACN,AAACjB,+BAAKkB,+CACN,AAAClB,+BAAKmB;;AAMf,AAAApB,gCAAAC,qBAAA,0DAAA,WAA0BE;AAA1B,AACE,IAAAkB,aAAuB,AAACb,yBAAKL;WAA7B,AAAAS,wBAAAS,WAAA,IAAA,9CAAOR;WAAP,AAAAD,wBAAAS,WAAA,IAAA,9CAAYP;YAAZ,AAAAF,wBAAAS,WAAA,IAAA,\/CAAiBN;AAAjB,AAAA,mFAAA,sDAAA,KAAA,IAAA;;AAEE,sBAAA,yEAAA,mBAAA,uEAAA,mBAAA,sBAAA,wEAAA,\/PAAW,AAACd,+BAAKY,2DACR,AAACZ,+BAAKa,iFAEV,AAACb,+BAAKc","names":["cljs.core\/-add-method","gamma.emit.emit\/emit","db","x","cljs.core\/interpose","cljs.core\/map","y","gamma.ast\/head","gamma.ast\/body","cljs.core\/first","cljs.core\/second","vec__20758","cljs.core\/nth","test","then","else","vec__20759","init","condition","increment","bod","vec__20760"]} -------------------------------------------------------------------------------- /out/gamma/emit/tag.cljs: -------------------------------------------------------------------------------- 1 | (ns gamma.emit.tag 2 | (:use [gamma.emit.emit :only [emit]] 3 | [gamma.ast :only [head body term]])) 4 | 5 | ;;;; PROGRAM 6 | 7 | 8 | (defmethod emit :variable [db x] 9 | (if-let [n (:name x)] 10 | n 11 | (str "v" (:id x)))) 12 | 13 | 14 | (defmethod emit :shader [db x] 15 | [:span 16 | (interpose 17 | :break 18 | (map 19 | (fn [v] (emit db {:tag :declaration :variable v})) 20 | (filter 21 | #(not (re-matches (js/RegExp. "gl_.*") (:name %))) 22 | (concat (:inputs x) (:outputs x))))) 23 | :break 24 | 25 | "void main(void){" 26 | :break 27 | (interpose 28 | :break 29 | (map 30 | (fn [v] (emit db {:tag :declaration :variable v})) 31 | (filter 32 | #(not (if (:name %) (re-matches (js/RegExp. "gl_.*") (:name %)))) 33 | (:locals x)))) 34 | :break 35 | (emit db (db :root)) 36 | :break 37 | "}"]) 38 | 39 | (def qualifier-order 40 | [[:invariant :storage :precision] 41 | [:storage :parameter :precision]]) 42 | 43 | (defmethod emit :declaration [db x] 44 | (try 45 | (let [v (:variable x)] 46 | [:span 47 | (if-let [s (:storage v)] (str (name s) " ") "") 48 | (if-let [p (:precision v)] (str (name p) " ") "") 49 | (name (:type v)) " " (emit db v) ";"]) 50 | (catch js/Error e (println (str "declaration error on: ") (pr-str x))))) 51 | 52 | 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /out/gamma/emit/tag.cljs.cache.edn: -------------------------------------------------------------------------------- 1 | ;; Analyzed by ClojureScript 0.0-3308 2 | {:use-macros nil, :excludes #{}, :name gamma.emit.tag, :imports nil, :requires {gamma.emit.emit gamma.emit.emit, gamma.ast gamma.ast}, :uses {body gamma.ast, term gamma.ast, head gamma.ast, emit gamma.emit.emit}, :defs {qualifier-order {:name gamma.emit.tag/qualifier-order, :file "out/gamma/emit/tag.cljs", :line 39, :column 1, :end-line 39, :end-column 21, :meta {:file "/Users/james/projects/cljs-draw/out/gamma/emit/tag.cljs", :line 39, :column 6, :end-line 39, :end-column 21}}}, :require-macros nil, :cljs.analyzer/constants {:seen #{:variable :else :locals :name :precision :type :break :inputs :root :invariant :id :outputs :storage :declaration :tag :parameter :shader :span}, :order [:variable :name :id :shader :span :break :tag :declaration :inputs :outputs :locals :root :invariant :storage :precision :parameter :else :type]}, :doc nil} -------------------------------------------------------------------------------- /out/gamma/emit/tag.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"\/Users\/james\/projects\/cljs-draw\/out\/gamma\/emit\/tag.js","sources":["tag.cljs"],"lineCount":53,"mappings":";AAAA;;;;AAOA,AAAAA,gCAAAC,qBAAA,6DAAA,WAA2BC,GAAGC;AAA9B,AACE,IAAAC,qBAAW,AAAA,mFAAOD;AAAlB,AAAA,oBAAAC;AAAA,QAAAA,JAASC;AAAT,AACEA;;AACA,sBAAA,mBAAS,AAAA,gFAAKF;;;AAGlB,AAAAH,gCAAAC,qBAAA,yDAAA,WAAyBC,GAAGC;AAA5B,AAAA,2FAAA,qDAEG,8BAAA,9BAACG,oFAEC,AAACC,wBACA,WAAKC;AAAL,AAAQ,yCAAA,2CAAA,oDAAA,oEAAA,rMAACP,+BAAKC,mOAAgCM;GAC9C,2BAAA,WAAAC,tCAACC;AAAD,AACG,OAACC,wBAAI,AAACC,+BAAW,KAAAC,OAAA,UAAqB,AAAA,mFAAAJ;wNAP\/C,sDAAA,mBAAA,9RAQQ,AAACK,2BAAO,AAAA,sFAASX,GAAG,AAAA,0FAAUA,sIAKnC,8BAAA,9BAACG,oFAEC,AAACC,wBACA,WAAKC;AAAL,AAAQ,yCAAA,2CAAA,oDAAA,oEAAA,rMAACP,+BAAKC,mOAAgCM;GAC9C,2BAAA,WAAAO,tCAACL;AAAD,AACG,OAACC,wBAAI,mRAAA,jQAAI,AAAA,mFAAAI,mBAAU,AAACH,+BAAW,KAAAC,OAAA,UAAqB,AAAA,mFAAAE;+FAlB7D,4JAAA,sDAAA,9SAmBQ,AAAA,sFAASZ,4DAEd,AAACF,+BAAKC,GAAG,aAAA,bAACA;;AAIb,iCAAA,mFAAA,mFAAA,gEAAA,2DAAA,wEAAA,mFAAA,2DAAA,+DAAA,vlBAAKc;AAIL,AAAAhB,gCAAAC,qBAAA,oEAAA,WAA8BC,GAAGC;AAAjC,AACE,IAAA,AACE,IAAMK,IAAE,AAAA,2FAAWL;AAAnB,AAAA,0FAAA,qDAEE,iBAAAC,qBAAW,AAAA,yFAAUI;AAArB,AAAA,oBAAAJ;AAAA,QAAAA,JAASc;AAAT,AAAyB,iEAAA,3CAAK,AAACC,yBAAKD;;AAApC;;KACA,iBAAAd,qBAAW,AAAA,8FAAYI;AAAvB,AAAA,oBAAAJ;AAAA,QAAAA,JAASgB;AAAT,AAA2B,iEAAA,3CAAK,AAACD,yBAAKC;;AAAtC;;qHAHF,yCAAA,zJAIE,AAACD,yBAAK,AAAA,mFAAOX,QAAQ,AAACP,+BAAKC,GAAGM;gBALlC,GAAA,CAAAS,kBAMSI;AANT,QAAAJ,JAMkBK;AANlB,AAMoB,OAACC,4BAAQ,eAAA,oCAA+B,AAACC,2BAAOrB;;AANpE,AAAA,MAAAc","names":["cljs.core\/-add-method","gamma.emit.emit\/emit","db","x","temp__4421__auto__","n","cljs.core\/interpose","cljs.core\/map","v","p1__20763#","cljs.core\/filter","cljs.core\/not","cljs.core\/re-matches","js\/RegExp","cljs.core\/concat","p1__20764#","gamma.emit.tag\/qualifier-order","e20765","s","cljs.core\/name","p","js\/Error","e","cljs.core\/println","cljs.core\/pr-str"]} -------------------------------------------------------------------------------- /out/gamma/program.cljs: -------------------------------------------------------------------------------- 1 | (ns gamma.program 2 | (:require gamma.compiler.core 3 | fipp.engine 4 | [gamma.emit.emit :as emit] 5 | gamma.emit.fun 6 | gamma.emit.operator 7 | gamma.emit.statement 8 | gamma.emit.tag 9 | gamma.emit.construct 10 | [gamma.api :as g])) 11 | 12 | (defn ast [inputs] 13 | (apply g/block 14 | (mapv 15 | (fn [[k v]] 16 | (g/set k v)) 17 | inputs))) 18 | 19 | (defn precision-defaults [p] 20 | (let [x (map (fn [[k v]] (str "precision " (name v) " " (name k) ";\n")) p)] 21 | (if (empty? x) 22 | "" 23 | (apply str x)))) 24 | 25 | (defn glsl [shader precision] 26 | (let [p precision] 27 | (str 28 | (precision-defaults p) 29 | (with-out-str 30 | (fipp.engine/pprint-document 31 | (emit/emit (:ir shader) shader) 32 | {:width 80}))))) 33 | 34 | 35 | 36 | (defn shader [shader opts] 37 | (let [ast (ast shader) 38 | ir (gamma.compiler.core/compile ast) 39 | v (gamma.compiler.core/variables ir) 40 | locals (filter 41 | #(not 42 | (#{:attribute :uniform :varying} (:storage %))) 43 | v) 44 | globals (filter 45 | #(#{:attribute :uniform :varying} (:storage %)) 46 | v) 47 | outputs (keys shader) 48 | inputs (clojure.set/difference (into #{} globals) (into #{} outputs)) 49 | ] 50 | (let 51 | [p 52 | {:tag :shader 53 | :inputs inputs 54 | :outputs outputs 55 | :locals locals 56 | :ir ir 57 | :ast ast}] 58 | p 59 | (assoc p :glsl (glsl p opts))))) 60 | 61 | 62 | 63 | (defn program-inputs [vs fs] 64 | (into 65 | (:inputs vs) 66 | (filter #(= :uniform (:storage %)) 67 | (:inputs fs)))) 68 | 69 | (defn program 70 | ([x] 71 | (let [{:keys [vertex-shader fragment-shader precision]} x 72 | vs (shader vertex-shader precision) 73 | fs (shader fragment-shader precision)] 74 | {:tag :program 75 | :vertex-shader vs 76 | :fragment-shader fs 77 | :inputs (program-inputs vs fs)}))) 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | -------------------------------------------------------------------------------- /out/gamma/program.cljs.cache.edn: -------------------------------------------------------------------------------- 1 | ;; Analyzed by ClojureScript 0.0-3308 2 | {:use-macros nil, :excludes #{}, :name gamma.program, :imports nil, :requires {gamma.emit.tag gamma.emit.tag, gamma.emit.statement gamma.emit.statement, gamma.emit.operator gamma.emit.operator, fipp.engine fipp.engine, gamma.emit.emit gamma.emit.emit, gamma.api gamma.api, gamma.compiler.core gamma.compiler.core, g gamma.api, gamma.emit.construct gamma.emit.construct, emit gamma.emit.emit, gamma.emit.fun gamma.emit.fun}, :uses nil, :defs {ast {:protocol-inline nil, :meta {:file "/Users/james/projects/cljs-draw/out/gamma/program.cljs", :line 12, :column 7, :end-line 12, :end-column 10, :arglists (quote ([inputs]))}, :name gamma.program/ast, :variadic false, :file "out/gamma/program.cljs", :end-column 10, :method-params ([inputs]), :protocol-impl nil, :arglists-meta (nil nil), :column 1, :line 12, :end-line 12, :max-fixed-arity 1, :fn-var true, :arglists (quote ([inputs]))}, precision-defaults {:protocol-inline nil, :meta {:file "/Users/james/projects/cljs-draw/out/gamma/program.cljs", :line 19, :column 7, :end-line 19, :end-column 25, :arglists (quote ([p]))}, :name gamma.program/precision-defaults, :variadic false, :file "out/gamma/program.cljs", :end-column 25, :method-params ([p]), :protocol-impl nil, :arglists-meta (nil nil), :column 1, :line 19, :end-line 19, :max-fixed-arity 1, :fn-var true, :arglists (quote ([p]))}, glsl {:protocol-inline nil, :meta {:file "/Users/james/projects/cljs-draw/out/gamma/program.cljs", :line 25, :column 7, :end-line 25, :end-column 11, :arglists (quote ([shader precision]))}, :name gamma.program/glsl, :variadic false, :file "out/gamma/program.cljs", :end-column 11, :method-params ([shader precision]), :protocol-impl nil, :arglists-meta (nil nil), :column 1, :line 25, :end-line 25, :max-fixed-arity 2, :fn-var true, :arglists (quote ([shader precision]))}, shader {:protocol-inline nil, :meta {:file "/Users/james/projects/cljs-draw/out/gamma/program.cljs", :line 36, :column 7, :end-line 36, :end-column 13, :arglists (quote ([shader opts]))}, :name gamma.program/shader, :variadic false, :file "out/gamma/program.cljs", :end-column 13, :method-params ([shader opts]), :protocol-impl nil, :arglists-meta (nil nil), :column 1, :line 36, :end-line 36, :max-fixed-arity 2, :fn-var true, :arglists (quote ([shader opts]))}, program-inputs {:protocol-inline nil, :meta {:file "/Users/james/projects/cljs-draw/out/gamma/program.cljs", :line 63, :column 7, :end-line 63, :end-column 21, :arglists (quote ([vs fs]))}, :name gamma.program/program-inputs, :variadic false, :file "out/gamma/program.cljs", :end-column 21, :method-params ([vs fs]), :protocol-impl nil, :arglists-meta (nil nil), :column 1, :line 63, :end-line 63, :max-fixed-arity 2, :fn-var true, :arglists (quote ([vs fs]))}, program {:protocol-inline nil, :meta {:file "/Users/james/projects/cljs-draw/out/gamma/program.cljs", :line 69, :column 7, :end-line 69, :end-column 14, :arglists (quote ([x]))}, :name gamma.program/program, :variadic false, :file "out/gamma/program.cljs", :end-column 14, :method-params ([x]), :protocol-impl nil, :arglists-meta (nil nil), :column 1, :line 69, :end-line 69, :max-fixed-arity 1, :fn-var true, :arglists (quote ([x]))}}, :require-macros {g gamma.api, gamma.api gamma.api}, :cljs.analyzer/constants {:seen #{:attribute :fragment-shader :glsl :locals :precision :width :ast :vertex-shader :inputs :varying :uniform :outputs :storage :tag :ir :program :shader}, :order [:ir :width :attribute :varying :uniform :storage :tag :inputs :outputs :locals :ast :shader :glsl :vertex-shader :fragment-shader :precision :program]}, :doc nil} -------------------------------------------------------------------------------- /out/gamma/program.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"\/Users\/james\/projects\/cljs-draw\/out\/gamma\/program.js","sources":["program.cljs"],"lineCount":91,"mappings":";AAAA;;;;;;;;;;;AAWA,oBAAA,pBAAMA,gDAAKC;AAAX,AACE,OAACC,0BAAMC,gBACA,AAACC,yBACC,WAAAC;AAAA,AAAA,IAAAC,aAAAD;QAAA,AAAAE,wBAAAD,WAAA,IAAA,3CAAME;QAAN,AAAAD,wBAAAD,WAAA,IAAA,3CAAQG;AAAR,AACE,OAACC,wBAAMF,EAAEC;GACXR;;AAEX,mCAAA,nCAAMU,8EAAoBC;AAA1B,AACE,IAAMC,IAAE,AAACC,wBAAI,WAAAC;AAAA,AAAA,IAAAC,aAAAD;QAAA,AAAAR,wBAAAS,WAAA,IAAA,3CAAMR;QAAN,AAAAD,wBAAAS,WAAA,IAAA,3CAAQP;AAAR,AAAY,sBAAA,uEAAA,8DAAA,zGAAkB,AAACQ,yBAAKR,qCAAO,AAACQ,yBAAKT;GAAWI;AAAzE,AACE,GAAI,AAACM,iCAAOL;AAAZ;;AAEE,OAACX,0BAAMiB,cAAIN;;;AAEjB,qBAAA,rBAAMO,kDAAMC,OAAOC;AAAnB,AACE,IAAMV,IAAEU;AAAR,AACE,sBACE,AAACX,2CAAmBC,kBACpB,iBAAAW,mBAAA,KAAAC;AAAA,AAAA,IAAAC,uCAAAC;IAAAC,kCAAAC;AAAA,AAAA,AAAAF,sCAAA;;AAAA,AAAAE,iCAAA;kBAAAC;AAAA,AAAA,OAAAN,wBAAAM;;;;AAAA,IAAA,AACC,qKAAA,2CAAA,uDAAA,vQAACC,sCACC,AAACC,+BAAU,AAAA,gFAAKV,QAAQA;UAF3B,AAAA,AAAAO,iCAAAD;;AAAA,AAAAD,sCAAAD;;AAAA,sBAAAF;;;AAON,uBAAA,vBAAMS,sDAAQX,WAAOY;AAArB,AACE,IAAMC,MAAI,AAAClC,4BAAIqB;IACTc,KAAG,AAACC,sCAA4BF;IAChCzB,IAAE,AAAC4B,wCAA8BF;IACjCG,SAAO,2BAAA,3BAACE;kBAADD;AAAA,AACG,OAACE,wBACA,AAAA,iFAAA,qEAAA,+DAAA,wFAAiC,AAAA,yFAAAF;;CACnC9B;IACTiC,UAAQ,2BAAA,3BAACF;kBAADG;AAAA,AACG,OAAA,iFAAA,qEAAA,+DAAA,wFAAiC,AAAA,yFAAAA;;CAClClC;IACVmC,UAAQ,AAACC,yBAAKxB;IACdpB,SAAO,AAAC6C,iCAAuB,yBAAA,zBAACC,2DAASL,SAAS,yBAAA,zBAACK,2DAASH;AAXlE,AAaE,QAAA,2CAAA,oDAAA,yDAAA,+DAAA,oEAAA,+DAAA,qDAAA,nZACGhC,oNAEUX,mEACA2C,gEACAN,yDACAH,sDACAD;AAPb,AAQEtB;AACA,mCAAA,5BAACoC,0BAAMpC,sDAAQ,AAACQ,6BAAKR,EAAEqB;;AAI7B,+BAAA,\/BAAMgB,sEAAgBC,GAAGC;AAAzB,AACE,OAACJ,yBACC,AAAA,sFAASG,IACT,2BAAA,WAAAE,tCAACZ;AAAD,AAAS,gCAAA,zBAACa,mFAAW,AAAA,yFAAAD;GACb,AAAA,sFAASD;;AAErB,wBAAA,xBAAMG,wDACFzC;AADJ,AAEG,IAAA0C,aAAwD1C;IAAxD0C,iBAAA,EAAA,AAAAC,+BAAAD,aAAA,AAAArD,0BAAAuD,mBAAAF,YAAAA;oBAAA,AAAAG,wBAAAH,eAAA,vDAAcI;sBAAd,AAAAD,wBAAAH,eAAA,zDAA4BK;gBAA5B,AAAAF,wBAAAH,eAAA,nDAA4CjC;IACtC4B,KAAG,AAAClB,+BAAO2B,cAAcrC;IACzB6B,KAAG,AAACnB,+BAAO4B,gBAAgBtC;AAFjC,AAAA,kDAAA,oDAAA,0DAAA,wEAAA,+EAAA,lFAIoB4B,+EACAC,2DACA,AAACF,uCAAeC,GAAGC","names":["gamma.program\/ast","inputs","cljs.core\/apply","gamma.api\/block","cljs.core\/mapv","p__20209","vec__20210","cljs.core\/nth","k","v","gamma.api\/set","gamma.program\/precision-defaults","p","x","cljs.core\/map","p__20213","vec__20214","cljs.core\/name","cljs.core\/empty?","cljs.core\/str","gamma.program\/glsl","shader","precision","sb__5909__auto__","goog\/string.StringBuffer","*print-newline*20217","cljs.core\/*print-newline*","*print-fn*20218","cljs.core\/*print-fn*","x__5910__auto__","fipp.engine\/pprint-document","gamma.emit.emit\/emit","gamma.program\/shader","opts","ast","ir","gamma.compiler.core\/compile","gamma.compiler.core\/variables","locals","p1__20221#","cljs.core\/filter","cljs.core\/not","globals","p1__20222#","outputs","cljs.core\/keys","clojure.set\/difference","cljs.core\/into","cljs.core\/assoc","gamma.program\/program-inputs","vs","fs","p1__20223#","cljs.core\/=","gamma.program\/program","map__20225","cljs.core\/seq?","cljs.core\/hash-map","cljs.core\/get","vertex-shader","fragment-shader"]} -------------------------------------------------------------------------------- /out/gamma_driver/impl/bind.cljs: -------------------------------------------------------------------------------- 1 | (ns gamma-driver.impl.bind) 2 | 3 | (defn bind-dispatch-fn [element data] 4 | (if (= :variable (:tag element)) 5 | (cond 6 | (= :attribute (:storage element)) :attribute 7 | (and 8 | (= :uniform (:storage element)) 9 | (= :sampler2D (:type element))) :texture-uniform 10 | (= :uniform (:storage element)) :uniform) 11 | (cond 12 | (= :element-index (:tag element)) :element-index 13 | (= :variable-array (:tag element)) :variable-array))) 14 | 15 | 16 | (defmulti bind* 17 | (fn [fns driver program element data] 18 | (bind-dispatch-fn element data))) 19 | 20 | 21 | (defmethod bind* :attribute [fns driver program element input] 22 | (let [{:keys [bind-attribute array-buffer]} fns] 23 | (bind-attribute 24 | driver 25 | program 26 | element 27 | (array-buffer 28 | driver 29 | (let [input (if (map? input) input {:data input}) 30 | data (:data input)] 31 | (assoc input 32 | :data (if (.-length data) 33 | data 34 | (js/Float32Array. (clj->js (flatten data)))) 35 | :usage :static-draw 36 | :element element 37 | :count (if-let [c (:count input)] 38 | c 39 | (if (seqable? data) 40 | (count data))))))))) 41 | 42 | (defmethod bind* :uniform [fns driver program element input] 43 | (let [{:keys [bind-uniform]} fns] 44 | (bind-uniform 45 | driver 46 | program 47 | element 48 | (let [input (if (map? input) input {:data input})] 49 | (assoc input 50 | :element element 51 | :data (clj->js (flatten [(:data input)]))))))) 52 | 53 | (defmethod bind* :element-index [fns driver program element input] 54 | (let [{:keys [element-array-buffer]} fns] 55 | (let [spec (let [input (if (map? input) 56 | input 57 | {:data input})] 58 | (assoc input 59 | ;; Probably already flattened, but keeping it here for now 60 | :data (if (.-buffer (:data input)) 61 | (:data input) 62 | (js/Uint16Array. (clj->js (flatten (:data input))))) 63 | :usage :static-draw 64 | :element element 65 | :count (if-let [c (:count input)] 66 | c 67 | (count (:data input)))))] 68 | (element-array-buffer driver spec)))) 69 | 70 | 71 | (defmethod bind* :texture-uniform [fns driver program variable input] 72 | (let [{:keys [bind-texture-uniform texture]} fns] 73 | (bind-texture-uniform 74 | driver 75 | program 76 | variable 77 | (texture 78 | driver 79 | ;; not sure if this is the right logic 80 | input)))) 81 | 82 | 83 | ;; program should do useProgram; basic driver should cache the program 84 | 85 | ;; (.useProgram (:gl driver) (:program program)) 86 | 87 | (defn bind [fns driver program data] 88 | (let [p ((:program fns) driver program)] 89 | (doseq [[k v] data] 90 | (bind* fns driver p k v)) 91 | p)) 92 | 93 | 94 | ;; bind should return the program or the driver? 95 | 96 | (comment 97 | (draw-arrays d (bind xx) {:mode :triangles})) 98 | 99 | 100 | 101 | 102 | -------------------------------------------------------------------------------- /out/gamma_driver/impl/bind.cljs.cache.edn: -------------------------------------------------------------------------------- 1 | ;; Analyzed by ClojureScript 0.0-3308 2 | {:use-macros nil, :excludes #{}, :name gamma-driver.impl.bind, :imports nil, :requires nil, :uses nil, :defs {bind-dispatch-fn {:protocol-inline nil, :meta {:file "/Users/james/projects/cljs-draw/out/gamma_driver/impl/bind.cljs", :line 3, :column 7, :end-line 3, :end-column 23, :arglists (quote ([element data]))}, :name gamma-driver.impl.bind/bind-dispatch-fn, :variadic false, :file "out/gamma_driver/impl/bind.cljs", :end-column 23, :method-params ([element data]), :protocol-impl nil, :arglists-meta (nil nil), :column 1, :line 3, :end-line 3, :max-fixed-arity 2, :fn-var true, :arglists (quote ([element data]))}, bind* {:name gamma-driver.impl.bind/bind*, :file "out/gamma_driver/impl/bind.cljs", :line 16, :column 1, :end-line 16, :end-column 16, :meta {:file "/Users/james/projects/cljs-draw/out/gamma_driver/impl/bind.cljs", :line 16, :column 11, :end-line 16, :end-column 16}}, bind {:protocol-inline nil, :meta {:file "/Users/james/projects/cljs-draw/out/gamma_driver/impl/bind.cljs", :line 87, :column 7, :end-line 87, :end-column 11, :arglists (quote ([fns driver program data]))}, :name gamma-driver.impl.bind/bind, :variadic false, :file "out/gamma_driver/impl/bind.cljs", :end-column 11, :method-params ([fns driver program data]), :protocol-impl nil, :arglists-meta (nil nil), :column 1, :line 87, :end-line 87, :max-fixed-arity 4, :fn-var true, :arglists (quote ([fns driver program data]))}}, :require-macros nil, :cljs.analyzer/constants {:seen #{:attribute :bind-uniform :static-draw :texture-uniform :variable :element :default :type :usage :uniform :element-array-buffer :count :element-index :storage :bind-texture-uniform :tag :hierarchy :array-buffer :program :bind-attribute :sampler2D :variable-array :texture :data}, :order [:variable :tag :attribute :storage :uniform :sampler2D :type :texture-uniform :element-index :variable-array :hierarchy :default :bind-attribute :array-buffer :data :usage :static-draw :element :count :bind-uniform :element-array-buffer :bind-texture-uniform :texture :program]}, :doc nil} -------------------------------------------------------------------------------- /out/gamma_driver/impl/context.cljs: -------------------------------------------------------------------------------- 1 | (ns gamma-driver.impl.context 2 | (:require [goog.webgl :as ggl])) 3 | 4 | (defn configure [gl spec]) 5 | -------------------------------------------------------------------------------- /out/gamma_driver/impl/context.cljs.cache.edn: -------------------------------------------------------------------------------- 1 | ;; Analyzed by ClojureScript 0.0-3308 2 | {:name gamma-driver.impl.context, :doc nil, :excludes #{}, :use-macros nil, :require-macros nil, :uses nil, :requires {ggl goog.webgl, goog.webgl goog.webgl}, :imports nil, :defs {configure {:protocol-inline nil, :meta {:file "/Users/james/projects/cljs-draw/out/gamma_driver/impl/context.cljs", :line 4, :column 7, :end-line 4, :end-column 16, :arglists (quote ([gl spec]))}, :name gamma-driver.impl.context/configure, :variadic false, :file "out/gamma_driver/impl/context.cljs", :end-column 16, :method-params ([gl spec]), :protocol-impl nil, :arglists-meta (nil nil), :column 1, :line 4, :end-line 4, :max-fixed-arity 2, :fn-var true, :arglists (quote ([gl spec]))}}} -------------------------------------------------------------------------------- /out/gamma_driver/impl/context.js: -------------------------------------------------------------------------------- 1 | // Compiled by ClojureScript 0.0-3308 {} 2 | goog.provide('gamma_driver.impl.context'); 3 | goog.require('cljs.core'); 4 | goog.require('goog.webgl'); 5 | gamma_driver.impl.context.configure = (function gamma_driver$impl$context$configure(gl,spec){ 6 | return null; 7 | }); 8 | 9 | //# sourceMappingURL=context.js.map -------------------------------------------------------------------------------- /out/gamma_driver/impl/context.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"\/Users\/james\/projects\/cljs-draw\/out\/gamma_driver\/impl\/context.js","sources":["context.cljs"],"lineCount":9,"mappings":";AAAA;;;AAGA,sCAAA,tCAAMA,oFAAWC,GAAGC;AAApB,AAAA","names":["gamma-driver.impl.context\/configure","gl","spec"]} -------------------------------------------------------------------------------- /out/gamma_driver/impl/draw.cljs: -------------------------------------------------------------------------------- 1 | (ns gamma-driver.impl.draw 2 | (:refer-clojure :exclude [mask]) 3 | (:require [goog.webgl :as ggl])) 4 | 5 | 6 | (defn clear [gl spec]) 7 | 8 | (defn mask [gl spec]) 9 | 10 | 11 | (def draw-modes 12 | {:lines ggl/LINES 13 | :line-strip ggl/LINE_STRIP 14 | :line-loop ggl/LINE_LOOP 15 | :points ggl/POINTS 16 | :triangle-strip ggl/TRIANGLE_STRIP 17 | :triangle-fan ggl/TRIANGLE_FAN 18 | :triangles ggl/TRIANGLES}) 19 | 20 | (defn draw-arrays 21 | ([gl program opts] 22 | (.useProgram gl (:program program)) 23 | (.drawArrays 24 | gl 25 | (draw-modes (:draw-mode opts)) 26 | (:first opts) 27 | (:count opts))) 28 | ([gl program opts target] 29 | (if target 30 | (do 31 | (.bindFramebuffer gl ggl/FRAMEBUFFER (:frame-buffer target)) 32 | (draw-arrays gl program opts) 33 | (.bindFramebuffer gl ggl/FRAMEBUFFER nil) 34 | target) 35 | (draw-arrays gl program opts)))) 36 | 37 | 38 | (def element-types 39 | {:unsigned-byte ggl/UNSIGNED_BYTE 40 | :unsigned-short ggl/UNSIGNED_SHORT}) 41 | 42 | (defn draw-elements 43 | ([gl program opts] 44 | (let [draw-mode (let [dm (:draw-mode opts)] 45 | (if (integer? dm) 46 | dm 47 | (draw-modes (:draw-mode opts)))) 48 | cnt (:count opts) 49 | data-type (element-types (:index-type opts) ggl/UNSIGNED_SHORT) 50 | offset (* (get {:unsigned-byte 1 :unsigned-short 2} (:index-type opts)) (:first opts))] 51 | (.useProgram gl (:program program)) 52 | (.drawElements gl draw-mode cnt data-type offset))) 53 | ([gl program opts target] 54 | (if target 55 | (do 56 | (.bindFramebuffer gl ggl/FRAMEBUFFER (:frame-buffer target)) 57 | (draw-elements gl program opts) 58 | (.bindFramebuffer gl ggl/FRAMEBUFFER nil)) 59 | (draw-elements gl program opts)))) 60 | 61 | -------------------------------------------------------------------------------- /out/gamma_driver/impl/draw.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"\/Users\/james\/projects\/cljs-draw\/out\/gamma_driver\/impl\/draw.js","sources":["draw.cljs"],"lineCount":98,"mappings":";AAAA;;;AAKA,+BAAA,\/BAAMA,sEAAOC,GAAGC;AAAhB,AAAA;;AAEA,8BAAA,9BAAMC,oEAAMF,GAAGC;AAAf,AAAA;;AAGA,oCAAA,2CAAA,wEAAA,qFAAA,oFAAA,4EAAA,kGAAA,6FAAA,3kBAAKE,sIACKC,gFACKC,qFACDC,+EACHC,0FACQC,+FACFC,wFACHC;AAEd,AAAA,qCAAA,rCAAME;AAAN,AAAA,IAAAD,WAAA,AAAA;AAAA,AAAA,QAAAA;KAAA;AAAA,OAAAC,iEAAA,CAAA,UAAA,MAAA,CAAA,UAAA,MAAA,CAAA,UAAA;;;KAAA;AAAA,OAAAA,iEAAA,CAAA,UAAA,MAAA,CAAA,UAAA,MAAA,CAAA,UAAA,MAAA,CAAA,UAAA;;;;AAAA,MAAA,KAAAC,MAAA,eAAA,iCAAA,AAAA;;;;;AAAA,AAAA,mEAAA,nEAAMD,8EACFZ,GAAGc,QAAQC;AADf,AAEG,AAAaf,cAAG,AAAA,wFAAUc;;AACzB,OACEd,cACA,AAACG,4CAAW,AAAA,8FAAYY,OACxB,AAAA,qFAAQA,MACR,AAAA,qFAAQA;;;AAPd,AAAA,mEAAA,nEAAMH,8EAQFZ,GAAGc,QAAQC,KAAKC;AARpB,AASG,oBAAIA;AACF,AACE,AAAkBhB,mBAAGiB,uBAAgB,AAAA,kGAAeD;;AACpD,AAACJ,6CAAYZ,GAAGc,QAAQC;;AACxB,0CAAA,1CAAkBf,mBAAGiB;;AACrBD;;AACF,OAACJ,6CAAYZ,GAAGc,QAAQC;;;;AAf7B,AAAA,6DAAA,7DAAMH;AAkBN,uCAAA,2CAAA,+FAAA,jLAAKM,wJACaC,mGACCC;AAEnB,AAAA,uCAAA,vCAAME;AAAN,AAAA,IAAAD,WAAA,AAAA;AAAA,AAAA,QAAAA;KAAA;AAAA,OAAAC,mEAAA,CAAA,UAAA,MAAA,CAAA,UAAA,MAAA,CAAA,UAAA;;;KAAA;AAAA,OAAAA,mEAAA,CAAA,UAAA,MAAA,CAAA,UAAA,MAAA,CAAA,UAAA,MAAA,CAAA,UAAA;;;;AAAA,MAAA,KAAAT,MAAA,eAAA,iCAAA,AAAA;;;;;AAAA,AAAA,qEAAA,rEAAMS,gFACFtB,GAAGc,QAAQC;AADf,AAEG,IAAMQ,YAAU,iBAAMC,KAAG,AAAA,8FAAYT;AAArB,AACE,GAAI,AAACU,mCAASD;AACZA;;AACA,OAACrB,4CAAW,AAAA,8FAAYY;;;IACtCW,MAAU,AAAA,qFAAQX;IAClBY,YAAU,AAACT,+CAAc,AAAA,8FAAaH,MAAMK;IAC5CQ,SAAU,CAAG,wBAAA,2CAAA,sEAAA,IAAA,0EAAA,vNAACC,mOAAyC,AAAA,8FAAad,SAAO,AAAA,qFAAQA;AANzF,AAOE,AAAaf,cAAG,AAAA,wFAAUc;;AAC1B,OAAed,gBAAGuB,UAAUG,IAAIC,UAAUC;;;AAV\/C,AAAA,qEAAA,rEAAMN,gFAWFtB,GAAGc,QAAQC,KAAKC;AAXpB,AAYG,oBAAIA;AACF,AACE,AAAkBhB,mBAAGiB,uBAAgB,AAAA,kGAAeD;;AACpD,AAACM,+CAActB,GAAGc,QAAQC;;AAC1B,iDAAA,1CAAkBf,mBAAGiB;;AACvB,OAACK,+CAActB,GAAGc,QAAQC;;;;AAjB\/B,AAAA,+DAAA,\/DAAMO","names":["gamma-driver.impl.draw\/clear","gl","spec","gamma-driver.impl.draw\/mask","gamma-driver.impl.draw\/draw-modes","goog.webgl\/LINES","goog.webgl\/LINE_STRIP","goog.webgl\/LINE_LOOP","goog.webgl\/POINTS","goog.webgl\/TRIANGLE_STRIP","goog.webgl\/TRIANGLE_FAN","goog.webgl\/TRIANGLES","G__20192","gamma-driver.impl.draw\/draw-arrays","js\/Error","program","opts","target","goog.webgl\/FRAMEBUFFER","gamma-driver.impl.draw\/element-types","goog.webgl\/UNSIGNED_BYTE","goog.webgl\/UNSIGNED_SHORT","G__20195","gamma-driver.impl.draw\/draw-elements","draw-mode","dm","cljs.core\/integer?","cnt","data-type","offset","cljs.core\/get"]} -------------------------------------------------------------------------------- /out/gamma_driver/impl/variable.cljs: -------------------------------------------------------------------------------- 1 | (ns gamma-driver.impl.variable 2 | (:require [goog.webgl :as ggl])) 3 | 4 | 5 | 6 | (defn attribute-location [gl program attribute] 7 | (.getAttribLocation gl (:program program) (:name attribute))) 8 | 9 | 10 | (defn default-layout [attribute] 11 | {:normalized? false 12 | :size ({:float 1 :vec2 2 :vec3 3 :vec4 4} 13 | (:type attribute)) 14 | :type ggl/FLOAT 15 | :offset 0 16 | :stride 0 17 | }) 18 | 19 | 20 | (defn bind-attribute [gl program attribute input] 21 | (let [location (attribute-location gl program attribute) 22 | {:keys [size type normalized? stride offset]} 23 | ((or (:layout input) default-layout) attribute)] 24 | (.bindBuffer gl ggl/ARRAY_BUFFER (:array-buffer input)) 25 | (.vertexAttribPointer gl 26 | location 27 | size 28 | type 29 | normalized? 30 | stride 31 | offset) 32 | (.enableVertexAttribArray gl location) 33 | input)) 34 | 35 | (defn element-index-input [gl program indices input] 36 | (.bindBuffer gl ggl/ELEMENT_ARRAY_BUFFER (:element-array-buffer input)) 37 | input) 38 | 39 | (defn uniform-location [gl program uniform] 40 | (.getUniformLocation gl (:program program) (:name uniform))) 41 | 42 | 43 | (defn bind-uniform [gl program uniform input] 44 | (let [location (uniform-location gl program uniform) 45 | type (:type uniform) 46 | data (:data input)] 47 | (case type 48 | :bool (.uniform1iv gl location data) 49 | :bvec2 (.uniform2iv gl location data) 50 | :bvec3 (.uniform3iv gl location data) 51 | :bvec4 (.uniform4iv gl location data) 52 | :float (.uniform1fv gl location data) 53 | :vec2 (.uniform2fv gl location data) 54 | :vec3 (.uniform3fv gl location data) 55 | :vec4 (.uniform4fv gl location data) 56 | :int (.uniform1iv gl location data) 57 | :ivec2 (.uniform2iv gl location data) 58 | :ivec3 (.uniform3iv gl location data) 59 | :ivec4 (.uniform4iv gl location data) 60 | :mat2 (.uniformMatrix2fv gl location false data) 61 | :mat3 (.uniformMatrix3fv gl location false data) 62 | :mat4 (.uniformMatrix4fv gl location false data) 63 | nil) 64 | input)) 65 | 66 | 67 | 68 | (defn bind-texture-uniform [gl program uniform texture] 69 | (let [location (uniform-location gl program uniform) 70 | id (:texture-id texture)] 71 | (.activeTexture gl (+ ggl/TEXTURE0 id)) 72 | (.bindTexture gl ggl/TEXTURE_2D (:texture texture)) 73 | (.uniform1i gl location id)) 74 | texture) 75 | -------------------------------------------------------------------------------- /out/gamma_driver/impl/variable.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"\/Users\/james\/projects\/cljs-draw\/out\/gamma_driver\/impl\/variable.js","sources":["variable.cljs"],"lineCount":126,"mappings":";AAAA;;;AAKA,gDAAA,hDAAMA,wGAAoBC,GAAGC,QAAQC;AAArC,AACE,OAAoBF,qBAAG,AAAA,wFAAUC,SAAS,AAAA,mFAAOC;;AAGnD,4CAAA,5CAAMC,gGAAgBD;AAAtB,AAAA,kDAAA,mEAAA,MAAA,ubAAA,sEAAA,wDAAA,IAAA,0DAAA,9jBAES,AAAA,2CAAA,wDAAA,IAAA,qDAAA,IAAA,qDAAA,IAAA,oDAAA,sBACE,AAAA,mFAAOA,iEACTE;;AAMT,4CAAA,5CAAMC,gGAAgBL,GAAGC,QAAQC,UAAUI;AAA3C,AACE,IAAMM,WAAS,AAACb,wDAAmBC,GAAGC,QAAQC;IAA9CK,aAEM,AAAC,iBAAAW,mBAAI,AAAA,wFAASZ;AAAb,AAAA,oBAAAY;AAAAA;;AAAoBf;;eAAgBD;IAF3CK,iBAAA,EAAA,AAAAC,+BAAAD,aAAA,AAAAE,0BAAAC,mBAAAH,YAAAA;WAAA,AAAAI,wBAAAJ,eAAA,9CACcM;WADd,AAAAF,wBAAAJ,eAAA,9CACmBO;wBADnB,AAAAH,wBAAAJ,eAAA,3DACwBQ;aADxB,AAAAJ,wBAAAJ,eAAA,hDACoCS;aADpC,AAAAL,wBAAAJ,eAAA,hDAC2CU;AAD3C,AAGE,AAAajB,cAAGmB,wBAAiB,AAAA,kGAAeb;;AAChD,AAAsBN,uBACAY,SACAC,KACAC,KACAC,kBACAC,OACAC;;AACtB,AAA0BjB,2BAAGY;;AAC7BN;;AAEJ,iDAAA,jDAAMc,0GAAqBpB,GAAGC,QAAQoB,QAAQf;AAA9C,AACE,AAAaN,cAAGsB,gCAAyB,AAAA,oHAAuBhB;;AAChEA;;AAEF,8CAAA,9CAAMiB,oGAAkBvB,GAAGC,QAAQuB;AAAnC,AACE,OAAqBxB,sBAAG,AAAA,wFAAUC,SAAS,AAAA,mFAAOuB;;AAGpD,0CAAA,1CAAMC,4FAAczB,GAAGC,QAAQuB,QAAQlB;AAAvC,AACE,IAAMM,WAAS,AAACW,sDAAiBvB,GAAGC,QAAQuB;IACtCV,OAAK,AAAA,mFAAOU;IACZE,OAAK,AAAA,mFAAOpB;AAFlB,AAGE,IAAAqB,iBAAA,EAAA,iBAAAC,oBAAA,SAAA,7CAAMd,oCAAAA;AAAN,AAAA,QAAAa;KAAA;AAGS,AAAa3B,cAAGY,SAASc;;;KAHlC;AASO,AAAa1B,cAAGY,SAASc;;;KAThC;AAcQ,6BAAA,7BAAmB1B,oBAAGY,eAAec;;;KAd7C;AAOQ,AAAa1B,cAAGY,SAASc;;;KAPjC;AAKS,AAAa1B,cAAGY,SAASc;;;KALlC;AAYS,AAAa1B,cAAGY,SAASc;;;KAZlC;AAaQ,6BAAA,7BAAmB1B,oBAAGY,eAAec;;;KAb7C;AAUS,AAAa1B,cAAGY,SAASc;;;KAVlC;AAQQ,AAAa1B,cAAGY,SAASc;;;KARjC;AAMQ,AAAa1B,cAAGY,SAASc;;;KANjC;AAES,AAAa1B,cAAGY,SAASc;;;KAFlC;AAeQ,6BAAA,7BAAmB1B,oBAAGY,eAAec;;;KAf7C;AAIS,AAAa1B,cAAGY,SAASc;;;KAJlC;AACQ,AAAa1B,cAAGY,SAASc;;;KADjC;AAWS,AAAa1B,cAAGY,SAASc;;;;AAXlC;;;AAiBApB;;AAIJ,kDAAA,lDAAMuB,4GAAsB7B,GAAGC,QAAQuB,QAAQM;AAA\/C,AACE,IAAMlB,iBAAS,AAACW,sDAAiBvB,GAAGC,QAAQuB;IACtCO,WAAG,AAAA,+FAAaD;AADtB,AAEE,AAAgB9B,iBAAG,CAAGgC,sBAAaD;;AACnC,AAAc\/B,eAAGiC,sBAAe,AAAA,yFAAUH;;AAC1C,AAAY9B,aAAGY,eAASmB;;AAC1BD","names":["gamma-driver.impl.variable\/attribute-location","gl","program","attribute","gamma-driver.impl.variable\/default-layout","goog.webgl\/FLOAT","gamma-driver.impl.variable\/bind-attribute","input","map__20137","cljs.core\/seq?","cljs.core\/apply","cljs.core\/hash-map","cljs.core\/get","location","size","type","normalized?","stride","offset","or__4953__auto__","goog.webgl\/ARRAY_BUFFER","gamma-driver.impl.variable\/element-index-input","indices","goog.webgl\/ELEMENT_ARRAY_BUFFER","gamma-driver.impl.variable\/uniform-location","uniform","gamma-driver.impl.variable\/bind-uniform","data","G__20139","cljs.core\/Keyword","gamma-driver.impl.variable\/bind-texture-uniform","texture","id","goog.webgl\/TEXTURE0","goog.webgl\/TEXTURE_2D"]} -------------------------------------------------------------------------------- /out/gamma_driver/protocols.cljs: -------------------------------------------------------------------------------- 1 | (ns gamma-driver.protocols) 2 | 3 | 4 | (defprotocol IContext 5 | (configure [this spec]) 6 | (gl [this])) 7 | 8 | (defprotocol IResource 9 | (program [this spec]) 10 | (array-buffer [this spec]) 11 | (element-array-buffer [this spec]) 12 | (texture [this spec]) 13 | (frame-buffer [this spec]) 14 | (render-buffer [this spec]) 15 | (release [this resource])) 16 | 17 | (defprotocol IBindVariable 18 | (bind-attribute [this program attribute input]) 19 | (bind-texture-uniform [this program uniform input]) 20 | (bind-uniform [this program uniform input])) 21 | 22 | (defprotocol IBind 23 | (bind [this program spec])) 24 | 25 | (defprotocol IDraw 26 | (draw-arrays [this program spec] [this program spec target]) 27 | (draw-elements [this program spec] [this program spec target])) 28 | -------------------------------------------------------------------------------- /out/goog/async/freelist.js: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Closure Library Authors. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS-IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | /** 16 | * @fileoverview Simple freelist. 17 | * 18 | * An anterative to goog.structs.SimplePool, it imposes the requirement that the 19 | * objects in the list contain a "next" property that can be used to maintain 20 | * the pool. 21 | */ 22 | 23 | goog.provide('goog.async.FreeList'); 24 | 25 | 26 | /** 27 | * @template ITEM 28 | */ 29 | goog.async.FreeList = goog.defineClass(null, { 30 | /** 31 | * @param {function():ITEM} create 32 | * @param {function(ITEM):void} reset 33 | * @param {number} limit 34 | */ 35 | constructor: function(create, reset, limit) { 36 | /** @const {number} */ 37 | this.limit_ = limit; 38 | /** @const {function()} */ 39 | this.create_ = create; 40 | /** @const {function(ITEM):void} */ 41 | this.reset_ = reset; 42 | 43 | /** @type {number} */ 44 | this.occupants_ = 0; 45 | /** @type {ITEM} */ 46 | this.head_ = null; 47 | }, 48 | 49 | /** 50 | * @return {ITEM} 51 | */ 52 | get: function() { 53 | var item; 54 | if (this.occupants_ > 0) { 55 | this.occupants_--; 56 | item = this.head_; 57 | this.head_ = item.next; 58 | item.next = null; 59 | } else { 60 | item = this.create_(); 61 | } 62 | return item; 63 | }, 64 | 65 | /** 66 | * @param {ITEM} item An item available for possible future reuse. 67 | */ 68 | put: function(item) { 69 | this.reset_(item); 70 | if (this.occupants_ < this.limit_) { 71 | this.occupants_++; 72 | item.next = this.head_; 73 | this.head_ = item; 74 | } 75 | }, 76 | 77 | /** 78 | * Visible for testing. 79 | * @package 80 | * @return {number} 81 | */ 82 | occupants: function() { 83 | return this.occupants_; 84 | } 85 | }); 86 | 87 | 88 | 89 | -------------------------------------------------------------------------------- /out/goog/debug/error.js: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Closure Library Authors. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS-IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | /** 16 | * @fileoverview Provides a base class for custom Error objects such that the 17 | * stack is correctly maintained. 18 | * 19 | * You should never need to throw goog.debug.Error(msg) directly, Error(msg) is 20 | * sufficient. 21 | * 22 | */ 23 | 24 | goog.provide('goog.debug.Error'); 25 | 26 | 27 | 28 | /** 29 | * Base class for custom error objects. 30 | * @param {*=} opt_msg The message associated with the error. 31 | * @constructor 32 | * @extends {Error} 33 | */ 34 | goog.debug.Error = function(opt_msg) { 35 | 36 | // Attempt to ensure there is a stack trace. 37 | if (Error.captureStackTrace) { 38 | Error.captureStackTrace(this, goog.debug.Error); 39 | } else { 40 | var stack = new Error().stack; 41 | if (stack) { 42 | this.stack = stack; 43 | } 44 | } 45 | 46 | if (opt_msg) { 47 | this.message = String(opt_msg); 48 | } 49 | 50 | /** 51 | * Whether to report this error to the server. Setting this to false will 52 | * cause the error reporter to not report the error back to the server, 53 | * which can be useful if the client knows that the error has already been 54 | * logged on the server. 55 | * @type {boolean} 56 | */ 57 | this.reportErrorToServer = true; 58 | }; 59 | goog.inherits(goog.debug.Error, Error); 60 | 61 | 62 | /** @override */ 63 | goog.debug.Error.prototype.name = 'CustomError'; 64 | -------------------------------------------------------------------------------- /out/goog/disposable/idisposable.js: -------------------------------------------------------------------------------- 1 | // Copyright 2011 The Closure Library Authors. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS-IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | /** 16 | * @fileoverview Definition of the disposable interface. A disposable object 17 | * has a dispose method to to clean up references and resources. 18 | * @author nnaze@google.com (Nathan Naze) 19 | */ 20 | 21 | 22 | goog.provide('goog.disposable.IDisposable'); 23 | 24 | 25 | 26 | /** 27 | * Interface for a disposable object. If a instance requires cleanup 28 | * (references COM objects, DOM notes, or other disposable objects), it should 29 | * implement this interface (it may subclass goog.Disposable). 30 | * @interface 31 | */ 32 | goog.disposable.IDisposable = function() {}; 33 | 34 | 35 | /** 36 | * Disposes of the object and its resources. 37 | * @return {void} Nothing. 38 | */ 39 | goog.disposable.IDisposable.prototype.dispose = goog.abstractMethod; 40 | 41 | 42 | /** 43 | * @return {boolean} Whether the object has been disposed of. 44 | */ 45 | goog.disposable.IDisposable.prototype.isDisposed = goog.abstractMethod; 46 | -------------------------------------------------------------------------------- /out/goog/dom/browserfeature.js: -------------------------------------------------------------------------------- 1 | // Copyright 2010 The Closure Library Authors. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS-IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | /** 16 | * @fileoverview Browser capability checks for the dom package. 17 | * 18 | */ 19 | 20 | 21 | goog.provide('goog.dom.BrowserFeature'); 22 | 23 | goog.require('goog.userAgent'); 24 | 25 | 26 | /** 27 | * Enum of browser capabilities. 28 | * @enum {boolean} 29 | */ 30 | goog.dom.BrowserFeature = { 31 | /** 32 | * Whether attributes 'name' and 'type' can be added to an element after it's 33 | * created. False in Internet Explorer prior to version 9. 34 | */ 35 | CAN_ADD_NAME_OR_TYPE_ATTRIBUTES: !goog.userAgent.IE || 36 | goog.userAgent.isDocumentModeOrHigher(9), 37 | 38 | /** 39 | * Whether we can use element.children to access an element's Element 40 | * children. Available since Gecko 1.9.1, IE 9. (IE<9 also includes comment 41 | * nodes in the collection.) 42 | */ 43 | CAN_USE_CHILDREN_ATTRIBUTE: !goog.userAgent.GECKO && !goog.userAgent.IE || 44 | goog.userAgent.IE && goog.userAgent.isDocumentModeOrHigher(9) || 45 | goog.userAgent.GECKO && goog.userAgent.isVersionOrHigher('1.9.1'), 46 | 47 | /** 48 | * Opera, Safari 3, and Internet Explorer 9 all support innerText but they 49 | * include text nodes in script and style tags. Not document-mode-dependent. 50 | */ 51 | CAN_USE_INNER_TEXT: ( 52 | goog.userAgent.IE && !goog.userAgent.isVersionOrHigher('9')), 53 | 54 | /** 55 | * MSIE, Opera, and Safari>=4 support element.parentElement to access an 56 | * element's parent if it is an Element. 57 | */ 58 | CAN_USE_PARENT_ELEMENT_PROPERTY: goog.userAgent.IE || goog.userAgent.OPERA || 59 | goog.userAgent.WEBKIT, 60 | 61 | /** 62 | * Whether NoScope elements need a scoped element written before them in 63 | * innerHTML. 64 | * MSDN: http://msdn.microsoft.com/en-us/library/ms533897(VS.85).aspx#1 65 | */ 66 | INNER_HTML_NEEDS_SCOPED_ELEMENT: goog.userAgent.IE, 67 | 68 | /** 69 | * Whether we use legacy IE range API. 70 | */ 71 | LEGACY_IE_RANGES: goog.userAgent.IE && !goog.userAgent.isDocumentModeOrHigher(9) 72 | }; 73 | -------------------------------------------------------------------------------- /out/goog/dom/nodetype.js: -------------------------------------------------------------------------------- 1 | // Copyright 2006 The Closure Library Authors. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS-IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | /** 16 | * @fileoverview Definition of goog.dom.NodeType. 17 | */ 18 | 19 | goog.provide('goog.dom.NodeType'); 20 | 21 | 22 | /** 23 | * Constants for the nodeType attribute in the Node interface. 24 | * 25 | * These constants match those specified in the Node interface. These are 26 | * usually present on the Node object in recent browsers, but not in older 27 | * browsers (specifically, early IEs) and thus are given here. 28 | * 29 | * In some browsers (early IEs), these are not defined on the Node object, 30 | * so they are provided here. 31 | * 32 | * See http://www.w3.org/TR/DOM-Level-2-Core/core.html#ID-1950641247 33 | * @enum {number} 34 | */ 35 | goog.dom.NodeType = { 36 | ELEMENT: 1, 37 | ATTRIBUTE: 2, 38 | TEXT: 3, 39 | CDATA_SECTION: 4, 40 | ENTITY_REFERENCE: 5, 41 | ENTITY: 6, 42 | PROCESSING_INSTRUCTION: 7, 43 | COMMENT: 8, 44 | DOCUMENT: 9, 45 | DOCUMENT_TYPE: 10, 46 | DOCUMENT_FRAGMENT: 11, 47 | NOTATION: 12 48 | }; 49 | -------------------------------------------------------------------------------- /out/goog/dom/tags.js: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Closure Library Authors. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS-IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | /** 16 | * @fileoverview Utilities for HTML element tag names. 17 | */ 18 | goog.provide('goog.dom.tags'); 19 | 20 | goog.require('goog.object'); 21 | 22 | 23 | /** 24 | * The void elements specified by 25 | * http://www.w3.org/TR/html-markup/syntax.html#void-elements. 26 | * @const 27 | * @type {!Object} 28 | * @private 29 | */ 30 | goog.dom.tags.VOID_TAGS_ = goog.object.createSet(('area,base,br,col,command,' + 31 | 'embed,hr,img,input,keygen,link,meta,param,source,track,wbr').split(',')); 32 | 33 | 34 | /** 35 | * Checks whether the tag is void (with no contents allowed and no legal end 36 | * tag), for example 'br'. 37 | * @param {string} tagName The tag name in lower case. 38 | * @return {boolean} 39 | */ 40 | goog.dom.tags.isVoidTag = function(tagName) { 41 | return goog.dom.tags.VOID_TAGS_[tagName] === true; 42 | }; 43 | -------------------------------------------------------------------------------- /out/goog/events/browserfeature.js: -------------------------------------------------------------------------------- 1 | // Copyright 2010 The Closure Library Authors. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS-IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | /** 16 | * @fileoverview Browser capability checks for the events package. 17 | * 18 | */ 19 | 20 | 21 | goog.provide('goog.events.BrowserFeature'); 22 | 23 | goog.require('goog.userAgent'); 24 | 25 | 26 | /** 27 | * Enum of browser capabilities. 28 | * @enum {boolean} 29 | */ 30 | goog.events.BrowserFeature = { 31 | /** 32 | * Whether the button attribute of the event is W3C compliant. False in 33 | * Internet Explorer prior to version 9; document-version dependent. 34 | */ 35 | HAS_W3C_BUTTON: !goog.userAgent.IE || 36 | goog.userAgent.isDocumentModeOrHigher(9), 37 | 38 | /** 39 | * Whether the browser supports full W3C event model. 40 | */ 41 | HAS_W3C_EVENT_SUPPORT: !goog.userAgent.IE || 42 | goog.userAgent.isDocumentModeOrHigher(9), 43 | 44 | /** 45 | * To prevent default in IE7-8 for certain keydown events we need set the 46 | * keyCode to -1. 47 | */ 48 | SET_KEY_CODE_TO_PREVENT_DEFAULT: goog.userAgent.IE && 49 | !goog.userAgent.isVersionOrHigher('9'), 50 | 51 | /** 52 | * Whether the {@code navigator.onLine} property is supported. 53 | */ 54 | HAS_NAVIGATOR_ONLINE_PROPERTY: !goog.userAgent.WEBKIT || 55 | goog.userAgent.isVersionOrHigher('528'), 56 | 57 | /** 58 | * Whether HTML5 network online/offline events are supported. 59 | */ 60 | HAS_HTML5_NETWORK_EVENT_SUPPORT: 61 | goog.userAgent.GECKO && goog.userAgent.isVersionOrHigher('1.9b') || 62 | goog.userAgent.IE && goog.userAgent.isVersionOrHigher('8') || 63 | goog.userAgent.OPERA && goog.userAgent.isVersionOrHigher('9.5') || 64 | goog.userAgent.WEBKIT && goog.userAgent.isVersionOrHigher('528'), 65 | 66 | /** 67 | * Whether HTML5 network events fire on document.body, or otherwise the 68 | * window. 69 | */ 70 | HTML5_NETWORK_EVENTS_FIRE_ON_BODY: 71 | goog.userAgent.GECKO && !goog.userAgent.isVersionOrHigher('8') || 72 | goog.userAgent.IE && !goog.userAgent.isVersionOrHigher('9'), 73 | 74 | /** 75 | * Whether touch is enabled in the browser. 76 | */ 77 | TOUCH_ENABLED: 78 | ('ontouchstart' in goog.global || 79 | !!(goog.global['document'] && 80 | document.documentElement && 81 | 'ontouchstart' in document.documentElement) || 82 | // IE10 uses non-standard touch events, so it has a different check. 83 | !!(goog.global['navigator'] && 84 | goog.global['navigator']['msMaxTouchPoints'])) 85 | }; 86 | -------------------------------------------------------------------------------- /out/goog/events/eventid.js: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Closure Library Authors. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS-IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | goog.provide('goog.events.EventId'); 16 | 17 | 18 | 19 | /** 20 | * A templated class that is used when registering for events. Typical usage: 21 | * 22 | * /** @type {goog.events.EventId} 23 | * var myEventId = new goog.events.EventId( 24 | * goog.events.getUniqueId(('someEvent')); 25 | * 26 | * // No need to cast or declare here since the compiler knows the correct 27 | * // type of 'evt' (MyEventObj). 28 | * something.listen(myEventId, function(evt) {}); 29 | * 30 | * 31 | * @param {string} eventId 32 | * @template T 33 | * @constructor 34 | * @struct 35 | * @final 36 | */ 37 | goog.events.EventId = function(eventId) { 38 | /** @const */ this.id = eventId; 39 | }; 40 | 41 | 42 | /** 43 | * @override 44 | */ 45 | goog.events.EventId.prototype.toString = function() { 46 | return this.id; 47 | }; 48 | -------------------------------------------------------------------------------- /out/goog/fs/url.js: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Closure Library Authors. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS-IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | /** 16 | * @fileoverview Wrapper for URL and its createObjectUrl and revokeObjectUrl 17 | * methods that are part of the HTML5 File API. 18 | */ 19 | 20 | goog.provide('goog.fs.url'); 21 | 22 | 23 | /** 24 | * Creates a blob URL for a blob object. 25 | * Throws an error if the browser does not support Object Urls. 26 | * 27 | * @param {!Blob} blob The object for which to create the URL. 28 | * @return {string} The URL for the object. 29 | */ 30 | goog.fs.url.createObjectUrl = function(blob) { 31 | return goog.fs.url.getUrlObject_().createObjectURL(blob); 32 | }; 33 | 34 | 35 | /** 36 | * Revokes a URL created by {@link goog.fs.url.createObjectUrl}. 37 | * Throws an error if the browser does not support Object Urls. 38 | * 39 | * @param {string} url The URL to revoke. 40 | */ 41 | goog.fs.url.revokeObjectUrl = function(url) { 42 | goog.fs.url.getUrlObject_().revokeObjectURL(url); 43 | }; 44 | 45 | 46 | /** 47 | * @typedef {{createObjectURL: (function(!Blob): string), 48 | * revokeObjectURL: function(string): void}} 49 | */ 50 | goog.fs.url.UrlObject_; 51 | 52 | 53 | /** 54 | * Get the object that has the createObjectURL and revokeObjectURL functions for 55 | * this browser. 56 | * 57 | * @return {goog.fs.url.UrlObject_} The object for this browser. 58 | * @private 59 | */ 60 | goog.fs.url.getUrlObject_ = function() { 61 | var urlObject = goog.fs.url.findUrlObject_(); 62 | if (urlObject != null) { 63 | return urlObject; 64 | } else { 65 | throw Error('This browser doesn\'t seem to support blob URLs'); 66 | } 67 | }; 68 | 69 | 70 | /** 71 | * Finds the object that has the createObjectURL and revokeObjectURL functions 72 | * for this browser. 73 | * 74 | * @return {?goog.fs.url.UrlObject_} The object for this browser or null if the 75 | * browser does not support Object Urls. 76 | * @private 77 | */ 78 | goog.fs.url.findUrlObject_ = function() { 79 | // This is what the spec says to do 80 | // http://dev.w3.org/2006/webapi/FileAPI/#dfn-createObjectURL 81 | if (goog.isDef(goog.global.URL) && 82 | goog.isDef(goog.global.URL.createObjectURL)) { 83 | return /** @type {goog.fs.url.UrlObject_} */ (goog.global.URL); 84 | // This is what Chrome does (as of 10.0.648.6 dev) 85 | } else if (goog.isDef(goog.global.webkitURL) && 86 | goog.isDef(goog.global.webkitURL.createObjectURL)) { 87 | return /** @type {goog.fs.url.UrlObject_} */ (goog.global.webkitURL); 88 | // This is what the spec used to say to do 89 | } else if (goog.isDef(goog.global.createObjectURL)) { 90 | return /** @type {goog.fs.url.UrlObject_} */ (goog.global); 91 | } else { 92 | return null; 93 | } 94 | }; 95 | 96 | 97 | /** 98 | * Checks whether this browser supports Object Urls. If not, calls to 99 | * createObjectUrl and revokeObjectUrl will result in an error. 100 | * 101 | * @return {boolean} True if this browser supports Object Urls. 102 | */ 103 | goog.fs.url.browserSupportsObjectUrls = function() { 104 | return goog.fs.url.findUrlObject_() != null; 105 | }; 106 | -------------------------------------------------------------------------------- /out/goog/net/eventtype.js: -------------------------------------------------------------------------------- 1 | // Copyright 2006 The Closure Library Authors. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS-IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | /** 16 | * @fileoverview Common events for the network classes. 17 | */ 18 | 19 | 20 | goog.provide('goog.net.EventType'); 21 | 22 | 23 | /** 24 | * Event names for network events 25 | * @enum {string} 26 | */ 27 | goog.net.EventType = { 28 | COMPLETE: 'complete', 29 | SUCCESS: 'success', 30 | ERROR: 'error', 31 | ABORT: 'abort', 32 | READY: 'ready', 33 | READY_STATE_CHANGE: 'readystatechange', 34 | TIMEOUT: 'timeout', 35 | INCREMENTAL_DATA: 'incrementaldata', 36 | PROGRESS: 'progress' 37 | }; 38 | -------------------------------------------------------------------------------- /out/goog/net/wrapperxmlhttpfactory.js: -------------------------------------------------------------------------------- 1 | // Copyright 2010 The Closure Library Authors. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS-IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | /** 16 | * @fileoverview Implementation of XmlHttpFactory which allows construction from 17 | * simple factory methods. 18 | * @author dbk@google.com (David Barrett-Kahn) 19 | */ 20 | 21 | goog.provide('goog.net.WrapperXmlHttpFactory'); 22 | 23 | /** @suppress {extraRequire} Typedef. */ 24 | goog.require('goog.net.XhrLike'); 25 | goog.require('goog.net.XmlHttpFactory'); 26 | 27 | 28 | 29 | /** 30 | * An xhr factory subclass which can be constructed using two factory methods. 31 | * This exists partly to allow the preservation of goog.net.XmlHttp.setFactory() 32 | * with an unchanged signature. 33 | * @param {function():!goog.net.XhrLike.OrNative} xhrFactory 34 | * A function which returns a new XHR object. 35 | * @param {function():!Object} optionsFactory A function which returns the 36 | * options associated with xhr objects from this factory. 37 | * @extends {goog.net.XmlHttpFactory} 38 | * @constructor 39 | * @final 40 | */ 41 | goog.net.WrapperXmlHttpFactory = function(xhrFactory, optionsFactory) { 42 | goog.net.XmlHttpFactory.call(this); 43 | 44 | /** 45 | * XHR factory method. 46 | * @type {function() : !goog.net.XhrLike.OrNative} 47 | * @private 48 | */ 49 | this.xhrFactory_ = xhrFactory; 50 | 51 | /** 52 | * Options factory method. 53 | * @type {function() : !Object} 54 | * @private 55 | */ 56 | this.optionsFactory_ = optionsFactory; 57 | }; 58 | goog.inherits(goog.net.WrapperXmlHttpFactory, goog.net.XmlHttpFactory); 59 | 60 | 61 | /** @override */ 62 | goog.net.WrapperXmlHttpFactory.prototype.createInstance = function() { 63 | return this.xhrFactory_(); 64 | }; 65 | 66 | 67 | /** @override */ 68 | goog.net.WrapperXmlHttpFactory.prototype.getOptions = function() { 69 | return this.optionsFactory_(); 70 | }; 71 | 72 | -------------------------------------------------------------------------------- /out/goog/net/xhrlike.js: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Closure Library Authors. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS-IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | goog.provide('goog.net.XhrLike'); 16 | 17 | 18 | 19 | /** 20 | * Interface for the common parts of XMLHttpRequest. 21 | * 22 | * Mostly copied from externs/w3c_xml.js. 23 | * 24 | * @interface 25 | * @see http://www.w3.org/TR/XMLHttpRequest/ 26 | */ 27 | goog.net.XhrLike = function() {}; 28 | 29 | 30 | /** 31 | * Typedef that refers to either native or custom-implemented XHR objects. 32 | * @typedef {!goog.net.XhrLike|!XMLHttpRequest} 33 | */ 34 | goog.net.XhrLike.OrNative; 35 | 36 | 37 | /** 38 | * @type {function()|null|undefined} 39 | * @see http://www.w3.org/TR/XMLHttpRequest/#handler-xhr-onreadystatechange 40 | */ 41 | goog.net.XhrLike.prototype.onreadystatechange; 42 | 43 | 44 | /** 45 | * @type {string} 46 | * @see http://www.w3.org/TR/XMLHttpRequest/#the-responsetext-attribute 47 | */ 48 | goog.net.XhrLike.prototype.responseText; 49 | 50 | 51 | /** 52 | * @type {Document} 53 | * @see http://www.w3.org/TR/XMLHttpRequest/#the-responsexml-attribute 54 | */ 55 | goog.net.XhrLike.prototype.responseXML; 56 | 57 | 58 | /** 59 | * @type {number} 60 | * @see http://www.w3.org/TR/XMLHttpRequest/#readystate 61 | */ 62 | goog.net.XhrLike.prototype.readyState; 63 | 64 | 65 | /** 66 | * @type {number} 67 | * @see http://www.w3.org/TR/XMLHttpRequest/#status 68 | */ 69 | goog.net.XhrLike.prototype.status; 70 | 71 | 72 | /** 73 | * @type {string} 74 | * @see http://www.w3.org/TR/XMLHttpRequest/#statustext 75 | */ 76 | goog.net.XhrLike.prototype.statusText; 77 | 78 | 79 | /** 80 | * @param {string} method 81 | * @param {string} url 82 | * @param {?boolean=} opt_async 83 | * @param {?string=} opt_user 84 | * @param {?string=} opt_password 85 | * @see http://www.w3.org/TR/XMLHttpRequest/#the-open()-method 86 | */ 87 | goog.net.XhrLike.prototype.open = function(method, url, opt_async, opt_user, 88 | opt_password) {}; 89 | 90 | 91 | /** 92 | * @param {ArrayBuffer|ArrayBufferView|Blob|Document|FormData|string=} opt_data 93 | * @see http://www.w3.org/TR/XMLHttpRequest/#the-send()-method 94 | */ 95 | goog.net.XhrLike.prototype.send = function(opt_data) {}; 96 | 97 | 98 | /** 99 | * @see http://www.w3.org/TR/XMLHttpRequest/#the-abort()-method 100 | */ 101 | goog.net.XhrLike.prototype.abort = function() {}; 102 | 103 | 104 | /** 105 | * @param {string} header 106 | * @param {string} value 107 | * @see http://www.w3.org/TR/XMLHttpRequest/#the-setrequestheader()-method 108 | */ 109 | goog.net.XhrLike.prototype.setRequestHeader = function(header, value) {}; 110 | 111 | 112 | /** 113 | * @param {string} header 114 | * @return {string} 115 | * @see http://www.w3.org/TR/XMLHttpRequest/#the-getresponseheader()-method 116 | */ 117 | goog.net.XhrLike.prototype.getResponseHeader = function(header) {}; 118 | 119 | 120 | /** 121 | * @return {string} 122 | * @see http://www.w3.org/TR/XMLHttpRequest/#the-getallresponseheaders()-method 123 | */ 124 | goog.net.XhrLike.prototype.getAllResponseHeaders = function() {}; 125 | -------------------------------------------------------------------------------- /out/goog/net/xmlhttpfactory.js: -------------------------------------------------------------------------------- 1 | // Copyright 2010 The Closure Library Authors. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS-IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | /** 16 | * @fileoverview Interface for a factory for creating XMLHttpRequest objects 17 | * and metadata about them. 18 | * @author dbk@google.com (David Barrett-Kahn) 19 | */ 20 | 21 | goog.provide('goog.net.XmlHttpFactory'); 22 | 23 | /** @suppress {extraRequire} Typedef. */ 24 | goog.require('goog.net.XhrLike'); 25 | 26 | 27 | 28 | /** 29 | * Abstract base class for an XmlHttpRequest factory. 30 | * @constructor 31 | */ 32 | goog.net.XmlHttpFactory = function() { 33 | }; 34 | 35 | 36 | /** 37 | * Cache of options - we only actually call internalGetOptions once. 38 | * @type {Object} 39 | * @private 40 | */ 41 | goog.net.XmlHttpFactory.prototype.cachedOptions_ = null; 42 | 43 | 44 | /** 45 | * @return {!goog.net.XhrLike.OrNative} A new XhrLike instance. 46 | */ 47 | goog.net.XmlHttpFactory.prototype.createInstance = goog.abstractMethod; 48 | 49 | 50 | /** 51 | * @return {Object} Options describing how xhr objects obtained from this 52 | * factory should be used. 53 | */ 54 | goog.net.XmlHttpFactory.prototype.getOptions = function() { 55 | return this.cachedOptions_ || 56 | (this.cachedOptions_ = this.internalGetOptions()); 57 | }; 58 | 59 | 60 | /** 61 | * Override this method in subclasses to preserve the caching offered by 62 | * getOptions(). 63 | * @return {Object} Options describing how xhr objects obtained from this 64 | * factory should be used. 65 | * @protected 66 | */ 67 | goog.net.XmlHttpFactory.prototype.internalGetOptions = goog.abstractMethod; 68 | -------------------------------------------------------------------------------- /out/goog/net/xpc/crosspagechannelrole.js: -------------------------------------------------------------------------------- 1 | // Copyright 2007 The Closure Library Authors. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS-IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | /** 16 | * @fileoverview Provides the enum for the role of the CrossPageChannel. 17 | * 18 | */ 19 | 20 | goog.provide('goog.net.xpc.CrossPageChannelRole'); 21 | 22 | 23 | /** 24 | * The role of the peer. 25 | * @enum {number} 26 | */ 27 | goog.net.xpc.CrossPageChannelRole = { 28 | OUTER: 0, 29 | INNER: 1 30 | }; 31 | -------------------------------------------------------------------------------- /out/goog/net/xpc/transport.js: -------------------------------------------------------------------------------- 1 | // Copyright 2007 The Closure Library Authors. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS-IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | /** 16 | * @fileoverview Contains the base class for transports. 17 | * 18 | */ 19 | 20 | 21 | goog.provide('goog.net.xpc.Transport'); 22 | 23 | goog.require('goog.Disposable'); 24 | goog.require('goog.dom'); 25 | goog.require('goog.net.xpc.TransportNames'); 26 | 27 | 28 | 29 | /** 30 | * The base class for transports. 31 | * @param {goog.dom.DomHelper=} opt_domHelper The dom helper to use for 32 | * finding the window objects. 33 | * @constructor 34 | * @extends {goog.Disposable}; 35 | */ 36 | goog.net.xpc.Transport = function(opt_domHelper) { 37 | goog.Disposable.call(this); 38 | 39 | /** 40 | * The dom helper to use for finding the window objects to reference. 41 | * @type {goog.dom.DomHelper} 42 | * @private 43 | */ 44 | this.domHelper_ = opt_domHelper || goog.dom.getDomHelper(); 45 | }; 46 | goog.inherits(goog.net.xpc.Transport, goog.Disposable); 47 | 48 | 49 | /** 50 | * The transport type. 51 | * @type {number} 52 | * @protected 53 | */ 54 | goog.net.xpc.Transport.prototype.transportType = 0; 55 | 56 | 57 | /** 58 | * @return {number} The transport type identifier. 59 | */ 60 | goog.net.xpc.Transport.prototype.getType = function() { 61 | return this.transportType; 62 | }; 63 | 64 | 65 | /** 66 | * Returns the window associated with this transport instance. 67 | * @return {!Window} The window to use. 68 | */ 69 | goog.net.xpc.Transport.prototype.getWindow = function() { 70 | return this.domHelper_.getWindow(); 71 | }; 72 | 73 | 74 | /** 75 | * Return the transport name. 76 | * @return {string} the transport name. 77 | */ 78 | goog.net.xpc.Transport.prototype.getName = function() { 79 | return goog.net.xpc.TransportNames[String(this.transportType)] || ''; 80 | }; 81 | 82 | 83 | /** 84 | * Handles transport service messages (internal signalling). 85 | * @param {string} payload The message content. 86 | */ 87 | goog.net.xpc.Transport.prototype.transportServiceHandler = goog.abstractMethod; 88 | 89 | 90 | /** 91 | * Connects this transport. 92 | * The transport implementation is expected to call 93 | * CrossPageChannel.prototype.notifyConnected when the channel is ready 94 | * to be used. 95 | */ 96 | goog.net.xpc.Transport.prototype.connect = goog.abstractMethod; 97 | 98 | 99 | /** 100 | * Sends a message. 101 | * @param {string} service The name off the service the message is to be 102 | * delivered to. 103 | * @param {string} payload The message content. 104 | */ 105 | goog.net.xpc.Transport.prototype.send = goog.abstractMethod; 106 | -------------------------------------------------------------------------------- /out/goog/promise/resolver.js: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Closure Library Authors. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS-IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | goog.provide('goog.promise.Resolver'); 16 | 17 | 18 | 19 | /** 20 | * Resolver interface for promises. The resolver is a convenience interface that 21 | * bundles the promise and its associated resolve and reject functions together, 22 | * for cases where the resolver needs to be persisted internally. 23 | * 24 | * @interface 25 | * @template TYPE 26 | */ 27 | goog.promise.Resolver = function() {}; 28 | 29 | 30 | /** 31 | * The promise that created this resolver. 32 | * @type {!goog.Promise} 33 | */ 34 | goog.promise.Resolver.prototype.promise; 35 | 36 | 37 | /** 38 | * Resolves this resolver with the specified value. 39 | * @type {function((TYPE|goog.Promise|Thenable)=)} 40 | */ 41 | goog.promise.Resolver.prototype.resolve; 42 | 43 | 44 | /** 45 | * Rejects this resolver with the specified reason. 46 | * @type {function(*=): void} 47 | */ 48 | goog.promise.Resolver.prototype.reject; 49 | -------------------------------------------------------------------------------- /out/goog/reflect/reflect.js: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Closure Library Authors. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS-IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | /** 16 | * @fileoverview Useful compiler idioms. 17 | * 18 | * @author johnlenz@google.com (John Lenz) 19 | */ 20 | 21 | goog.provide('goog.reflect'); 22 | 23 | 24 | /** 25 | * Syntax for object literal casts. 26 | * @see http://go/jscompiler-renaming 27 | * @see http://code.google.com/p/closure-compiler/wiki/ 28 | * ExperimentalTypeBasedPropertyRenaming 29 | * 30 | * Use this if you have an object literal whose keys need to have the same names 31 | * as the properties of some class even after they are renamed by the compiler. 32 | * 33 | * @param {!Function} type Type to cast to. 34 | * @param {Object} object Object literal to cast. 35 | * @return {Object} The object literal. 36 | */ 37 | goog.reflect.object = function(type, object) { 38 | return object; 39 | }; 40 | 41 | 42 | /** 43 | * To assert to the compiler that an operation is needed when it would 44 | * otherwise be stripped. For example: 45 | * 46 | * // Force a layout 47 | * goog.reflect.sinkValue(dialog.offsetHeight); 48 | * 49 | * @type {!Function} 50 | */ 51 | goog.reflect.sinkValue = function(x) { 52 | goog.reflect.sinkValue[' '](x); 53 | return x; 54 | }; 55 | 56 | 57 | /** 58 | * The compiler should optimize this function away iff no one ever uses 59 | * goog.reflect.sinkValue. 60 | */ 61 | goog.reflect.sinkValue[' '] = goog.nullFunction; 62 | 63 | 64 | /** 65 | * Check if a property can be accessed without throwing an exception. 66 | * @param {Object} obj The owner of the property. 67 | * @param {string} prop The property name. 68 | * @return {boolean} Whether the property is accessible. Will also return true 69 | * if obj is null. 70 | */ 71 | goog.reflect.canAccessProperty = function(obj, prop) { 72 | /** @preserveTry */ 73 | try { 74 | goog.reflect.sinkValue(obj[prop]); 75 | return true; 76 | } catch (e) {} 77 | return false; 78 | }; 79 | -------------------------------------------------------------------------------- /out/goog/string/stringbuffer.js: -------------------------------------------------------------------------------- 1 | // Copyright 2006 The Closure Library Authors. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS-IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | /** 16 | * @fileoverview Utility for fast string concatenation. 17 | */ 18 | 19 | goog.provide('goog.string.StringBuffer'); 20 | 21 | 22 | 23 | /** 24 | * Utility class to facilitate string concatenation. 25 | * 26 | * @param {*=} opt_a1 Optional first initial item to append. 27 | * @param {...*} var_args Other initial items to 28 | * append, e.g., new goog.string.StringBuffer('foo', 'bar'). 29 | * @constructor 30 | */ 31 | goog.string.StringBuffer = function(opt_a1, var_args) { 32 | if (opt_a1 != null) { 33 | this.append.apply(this, arguments); 34 | } 35 | }; 36 | 37 | 38 | /** 39 | * Internal buffer for the string to be concatenated. 40 | * @type {string} 41 | * @private 42 | */ 43 | goog.string.StringBuffer.prototype.buffer_ = ''; 44 | 45 | 46 | /** 47 | * Sets the contents of the string buffer object, replacing what's currently 48 | * there. 49 | * 50 | * @param {*} s String to set. 51 | */ 52 | goog.string.StringBuffer.prototype.set = function(s) { 53 | this.buffer_ = '' + s; 54 | }; 55 | 56 | 57 | /** 58 | * Appends one or more items to the buffer. 59 | * 60 | * Calling this with null, undefined, or empty arguments is an error. 61 | * 62 | * @param {*} a1 Required first string. 63 | * @param {*=} opt_a2 Optional second string. 64 | * @param {...*} var_args Other items to append, 65 | * e.g., sb.append('foo', 'bar', 'baz'). 66 | * @return {!goog.string.StringBuffer} This same StringBuffer object. 67 | * @suppress {duplicate} 68 | */ 69 | goog.string.StringBuffer.prototype.append = function(a1, opt_a2, var_args) { 70 | // Use a1 directly to avoid arguments instantiation for single-arg case. 71 | this.buffer_ += a1; 72 | if (opt_a2 != null) { // second argument is undefined (null == undefined) 73 | for (var i = 1; i < arguments.length; i++) { 74 | this.buffer_ += arguments[i]; 75 | } 76 | } 77 | return this; 78 | }; 79 | 80 | 81 | /** 82 | * Clears the internal buffer. 83 | */ 84 | goog.string.StringBuffer.prototype.clear = function() { 85 | this.buffer_ = ''; 86 | }; 87 | 88 | 89 | /** 90 | * @return {number} the length of the current contents of the buffer. 91 | */ 92 | goog.string.StringBuffer.prototype.getLength = function() { 93 | return this.buffer_.length; 94 | }; 95 | 96 | 97 | /** 98 | * @return {string} The concatenated string. 99 | * @override 100 | */ 101 | goog.string.StringBuffer.prototype.toString = function() { 102 | return this.buffer_; 103 | }; 104 | -------------------------------------------------------------------------------- /out/goog/string/typedstring.js: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Closure Library Authors. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS-IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | goog.provide('goog.string.TypedString'); 16 | 17 | 18 | 19 | /** 20 | * Wrapper for strings that conform to a data type or language. 21 | * 22 | * Implementations of this interface are wrappers for strings, and typically 23 | * associate a type contract with the wrapped string. Concrete implementations 24 | * of this interface may choose to implement additional run-time type checking, 25 | * see for example {@code goog.html.SafeHtml}. If available, client code that 26 | * needs to ensure type membership of an object should use the type's function 27 | * to assert type membership, such as {@code goog.html.SafeHtml.unwrap}. 28 | * @interface 29 | */ 30 | goog.string.TypedString = function() {}; 31 | 32 | 33 | /** 34 | * Interface marker of the TypedString interface. 35 | * 36 | * This property can be used to determine at runtime whether or not an object 37 | * implements this interface. All implementations of this interface set this 38 | * property to {@code true}. 39 | * @type {boolean} 40 | */ 41 | goog.string.TypedString.prototype.implementsGoogStringTypedString; 42 | 43 | 44 | /** 45 | * Retrieves this wrapped string's value. 46 | * @return {!string} The wrapped string's value. 47 | */ 48 | goog.string.TypedString.prototype.getTypedStringValue; 49 | -------------------------------------------------------------------------------- /out/goog/structs/collection.js: -------------------------------------------------------------------------------- 1 | // Copyright 2011 The Closure Library Authors. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS-IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | /** 16 | * @fileoverview Defines the collection interface. 17 | * 18 | * @author nnaze@google.com (Nathan Naze) 19 | */ 20 | 21 | goog.provide('goog.structs.Collection'); 22 | 23 | 24 | 25 | /** 26 | * An interface for a collection of values. 27 | * @interface 28 | * @template T 29 | */ 30 | goog.structs.Collection = function() {}; 31 | 32 | 33 | /** 34 | * @param {T} value Value to add to the collection. 35 | */ 36 | goog.structs.Collection.prototype.add; 37 | 38 | 39 | /** 40 | * @param {T} value Value to remove from the collection. 41 | */ 42 | goog.structs.Collection.prototype.remove; 43 | 44 | 45 | /** 46 | * @param {T} value Value to find in the collection. 47 | * @return {boolean} Whether the collection contains the specified value. 48 | */ 49 | goog.structs.Collection.prototype.contains; 50 | 51 | 52 | /** 53 | * @return {number} The number of values stored in the collection. 54 | */ 55 | goog.structs.Collection.prototype.getCount; 56 | 57 | -------------------------------------------------------------------------------- /out/goog/testing/watchers.js: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Closure Library Authors. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS-IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | /** 16 | * @fileoverview Simple notifiers for the Closure testing framework. 17 | * 18 | * @author johnlenz@google.com (John Lenz) 19 | */ 20 | 21 | goog.provide('goog.testing.watchers'); 22 | 23 | 24 | /** @private {!Array} */ 25 | goog.testing.watchers.resetWatchers_ = []; 26 | 27 | 28 | /** 29 | * Fires clock reset watching functions. 30 | */ 31 | goog.testing.watchers.signalClockReset = function() { 32 | var watchers = goog.testing.watchers.resetWatchers_; 33 | for (var i = 0; i < watchers.length; i++) { 34 | goog.testing.watchers.resetWatchers_[i](); 35 | } 36 | }; 37 | 38 | 39 | /** 40 | * Enqueues a function to be called when the clock used for setTimeout is reset. 41 | * @param {function()} fn 42 | */ 43 | goog.testing.watchers.watchClockReset = function(fn) { 44 | goog.testing.watchers.resetWatchers_.push(fn); 45 | }; 46 | 47 | -------------------------------------------------------------------------------- /out/goog/ui/idgenerator.js: -------------------------------------------------------------------------------- 1 | // Copyright 2008 The Closure Library Authors. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS-IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | /** 16 | * @fileoverview Generator for unique element IDs. 17 | * 18 | */ 19 | 20 | goog.provide('goog.ui.IdGenerator'); 21 | 22 | 23 | 24 | /** 25 | * Creates a new id generator. 26 | * @constructor 27 | * @final 28 | */ 29 | goog.ui.IdGenerator = function() { 30 | }; 31 | goog.addSingletonGetter(goog.ui.IdGenerator); 32 | 33 | 34 | /** 35 | * Next unique ID to use 36 | * @type {number} 37 | * @private 38 | */ 39 | goog.ui.IdGenerator.prototype.nextId_ = 0; 40 | 41 | 42 | /** 43 | * Gets the next unique ID. 44 | * @return {string} The next unique identifier. 45 | */ 46 | goog.ui.IdGenerator.prototype.getNextUniqueId = function() { 47 | return ':' + (this.nextId_++).toString(36); 48 | }; 49 | -------------------------------------------------------------------------------- /out/om/dom.cljs: -------------------------------------------------------------------------------- 1 | (ns om.dom 2 | (:refer-clojure :exclude [map meta time]) 3 | (:require-macros [om.dom :as dom]) 4 | (:require [cljsjs.react] 5 | [goog.object :as gobject])) 6 | 7 | (dom/gen-react-dom-fns) 8 | 9 | (defn wrap-form-element [ctor display-name] 10 | (js/React.createFactory 11 | (js/React.createClass 12 | #js 13 | {:getDisplayName 14 | (fn [] display-name) 15 | :getInitialState 16 | (fn [] 17 | (this-as this 18 | #js {:value (aget (.-props this) "value")})) 19 | :onChange 20 | (fn [e] 21 | (this-as this 22 | (let [handler (aget (.-props this) "onChange")] 23 | (when-not (nil? handler) 24 | (handler e) 25 | (.setState this #js {:value (.. e -target -value)}))))) 26 | :componentWillReceiveProps 27 | (fn [new-props] 28 | (this-as this 29 | (.setState this #js {:value (aget new-props "value")}))) 30 | :render 31 | (fn [] 32 | (this-as this 33 | ;; NOTE: if switch to macro we remove a closure allocation 34 | (let [props #js {}] 35 | (gobject/extend props (.-props this) 36 | #js {:value (aget (.-state this) "value") 37 | :onChange (aget this "onChange") 38 | :children (aget (.-props this) "children")}) 39 | (ctor props))))}))) 40 | 41 | (def input (wrap-form-element js/React.DOM.input "input")) 42 | 43 | (def textarea (wrap-form-element js/React.DOM.textarea "textarea")) 44 | 45 | (def option (wrap-form-element js/React.DOM.option "option")) 46 | 47 | (defn render 48 | "Equivalent to React.render" 49 | [component el] 50 | (js/React.render component el)) 51 | 52 | (defn render-to-str 53 | "Equivalent to React.renderToString" 54 | [c] 55 | (js/React.renderToString c)) 56 | -------------------------------------------------------------------------------- /out/thi/ng/common/error.cljs: -------------------------------------------------------------------------------- 1 | (ns thi.ng.common.error) 2 | 3 | (defn throw! 4 | [^String msg] 5 | (throw 6 | 7 | (js/Error. msg))) 8 | 9 | (defn key-error! 10 | [k] (throw! (str "Illegal lookup key: " k))) 11 | 12 | (defn type-error! 13 | [t x] (throw! (str "Can't create " t " from " (pr-str x)))) 14 | 15 | (defn arity-error! 16 | [n] (throw! (str "Wrong number of args: " n))) 17 | 18 | (defn illegal-arg! 19 | ([x] (illegal-arg! "Illegal argument" x)) 20 | ([msg x] (throw! (str msg ": " x)))) 21 | 22 | (defn unsupported! 23 | ([] (unsupported! "Unsupported operation")) 24 | ([^String msg] 25 | (throw 26 | 27 | (js/Error. msg)))) 28 | 29 | ;;;;;;;;;;;; This file autogenerated from src/cljx/thi/ng/common/error.cljx 30 | -------------------------------------------------------------------------------- /out/thi/ng/common/error.cljs.cache.edn: -------------------------------------------------------------------------------- 1 | ;; Analyzed by ClojureScript 0.0-3308 2 | {:name thi.ng.common.error, :doc nil, :excludes #{}, :use-macros nil, :require-macros nil, :uses nil, :requires nil, :imports nil, :defs {throw! {:protocol-inline nil, :meta {:file "/Users/james/projects/cljs-draw/out/thi/ng/common/error.cljs", :line 3, :column 7, :end-line 3, :end-column 13, :arglists (quote ([msg]))}, :name thi.ng.common.error/throw!, :variadic false, :file "out/thi/ng/common/error.cljs", :end-column 13, :method-params ([msg]), :protocol-impl nil, :arglists-meta (nil nil), :column 1, :line 3, :end-line 3, :max-fixed-arity 1, :fn-var true, :arglists (quote ([msg]))}, key-error! {:protocol-inline nil, :meta {:file "/Users/james/projects/cljs-draw/out/thi/ng/common/error.cljs", :line 9, :column 7, :end-line 9, :end-column 17, :arglists (quote ([k]))}, :name thi.ng.common.error/key-error!, :variadic false, :file "out/thi/ng/common/error.cljs", :end-column 17, :method-params ([k]), :protocol-impl nil, :arglists-meta (nil nil), :column 1, :line 9, :end-line 9, :max-fixed-arity 1, :fn-var true, :arglists (quote ([k]))}, type-error! {:protocol-inline nil, :meta {:file "/Users/james/projects/cljs-draw/out/thi/ng/common/error.cljs", :line 12, :column 7, :end-line 12, :end-column 18, :arglists (quote ([t x]))}, :name thi.ng.common.error/type-error!, :variadic false, :file "out/thi/ng/common/error.cljs", :end-column 18, :method-params ([t x]), :protocol-impl nil, :arglists-meta (nil nil), :column 1, :line 12, :end-line 12, :max-fixed-arity 2, :fn-var true, :arglists (quote ([t x]))}, arity-error! {:protocol-inline nil, :meta {:file "/Users/james/projects/cljs-draw/out/thi/ng/common/error.cljs", :line 15, :column 7, :end-line 15, :end-column 19, :arglists (quote ([n]))}, :name thi.ng.common.error/arity-error!, :variadic false, :file "out/thi/ng/common/error.cljs", :end-column 19, :method-params ([n]), :protocol-impl nil, :arglists-meta (nil nil), :column 1, :line 15, :end-line 15, :max-fixed-arity 1, :fn-var true, :arglists (quote ([n]))}, illegal-arg! {:protocol-inline nil, :meta {:file "/Users/james/projects/cljs-draw/out/thi/ng/common/error.cljs", :line 18, :column 7, :end-line 18, :end-column 19, :arglists (quote ([x] [msg x])), :top-fn {:variadic false, :max-fixed-arity 2, :method-params ([x] [msg x]), :arglists ([x] [msg x]), :arglists-meta (nil nil)}}, :name thi.ng.common.error/illegal-arg!, :variadic false, :file "out/thi/ng/common/error.cljs", :end-column 19, :top-fn {:variadic false, :max-fixed-arity 2, :method-params ([x] [msg x]), :arglists ([x] [msg x]), :arglists-meta (nil nil)}, :method-params ([x] [msg x]), :protocol-impl nil, :arglists-meta (nil nil), :column 1, :line 18, :end-line 18, :max-fixed-arity 2, :fn-var true, :arglists ([x] [msg x])}, unsupported! {:protocol-inline nil, :meta {:file "/Users/james/projects/cljs-draw/out/thi/ng/common/error.cljs", :line 22, :column 7, :end-line 22, :end-column 19, :arglists (quote ([] [msg])), :top-fn {:variadic false, :max-fixed-arity 1, :method-params ([] [msg]), :arglists ([] [msg]), :arglists-meta (nil nil)}}, :name thi.ng.common.error/unsupported!, :variadic false, :file "out/thi/ng/common/error.cljs", :end-column 19, :top-fn {:variadic false, :max-fixed-arity 1, :method-params ([] [msg]), :arglists ([] [msg]), :arglists-meta (nil nil)}, :method-params ([] [msg]), :protocol-impl nil, :arglists-meta (nil nil), :column 1, :line 22, :end-line 22, :max-fixed-arity 1, :fn-var true, :arglists ([] [msg])}}} -------------------------------------------------------------------------------- /out/thi/ng/common/error.js: -------------------------------------------------------------------------------- 1 | // Compiled by ClojureScript 0.0-3308 {} 2 | goog.provide('thi.ng.common.error'); 3 | goog.require('cljs.core'); 4 | thi.ng.common.error.throw_BANG_ = (function thi$ng$common$error$throw_BANG_(msg){ 5 | throw (new Error(msg)); 6 | }); 7 | thi.ng.common.error.key_error_BANG_ = (function thi$ng$common$error$key_error_BANG_(k){ 8 | return thi.ng.common.error.throw_BANG_.call(null,[cljs.core.str("Illegal lookup key: "),cljs.core.str(k)].join('')); 9 | }); 10 | thi.ng.common.error.type_error_BANG_ = (function thi$ng$common$error$type_error_BANG_(t,x){ 11 | return thi.ng.common.error.throw_BANG_.call(null,[cljs.core.str("Can't create "),cljs.core.str(t),cljs.core.str(" from "),cljs.core.str(cljs.core.pr_str.call(null,x))].join('')); 12 | }); 13 | thi.ng.common.error.arity_error_BANG_ = (function thi$ng$common$error$arity_error_BANG_(n){ 14 | return thi.ng.common.error.throw_BANG_.call(null,[cljs.core.str("Wrong number of args: "),cljs.core.str(n)].join('')); 15 | }); 16 | thi.ng.common.error.illegal_arg_BANG_ = (function thi$ng$common$error$illegal_arg_BANG_(){ 17 | var G__16988 = arguments.length; 18 | switch (G__16988) { 19 | case 1: 20 | return thi.ng.common.error.illegal_arg_BANG_.cljs$core$IFn$_invoke$arity$1((arguments[(0)])); 21 | 22 | break; 23 | case 2: 24 | return thi.ng.common.error.illegal_arg_BANG_.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)])); 25 | 26 | break; 27 | default: 28 | throw (new Error([cljs.core.str("Invalid arity: "),cljs.core.str(arguments.length)].join(''))); 29 | 30 | } 31 | }); 32 | 33 | thi.ng.common.error.illegal_arg_BANG_.cljs$core$IFn$_invoke$arity$1 = (function (x){ 34 | return thi.ng.common.error.illegal_arg_BANG_.call(null,"Illegal argument",x); 35 | }); 36 | 37 | thi.ng.common.error.illegal_arg_BANG_.cljs$core$IFn$_invoke$arity$2 = (function (msg,x){ 38 | return thi.ng.common.error.throw_BANG_.call(null,[cljs.core.str(msg),cljs.core.str(": "),cljs.core.str(x)].join('')); 39 | }); 40 | 41 | thi.ng.common.error.illegal_arg_BANG_.cljs$lang$maxFixedArity = 2; 42 | thi.ng.common.error.unsupported_BANG_ = (function thi$ng$common$error$unsupported_BANG_(){ 43 | var G__16991 = arguments.length; 44 | switch (G__16991) { 45 | case 0: 46 | return thi.ng.common.error.unsupported_BANG_.cljs$core$IFn$_invoke$arity$0(); 47 | 48 | break; 49 | case 1: 50 | return thi.ng.common.error.unsupported_BANG_.cljs$core$IFn$_invoke$arity$1((arguments[(0)])); 51 | 52 | break; 53 | default: 54 | throw (new Error([cljs.core.str("Invalid arity: "),cljs.core.str(arguments.length)].join(''))); 55 | 56 | } 57 | }); 58 | 59 | thi.ng.common.error.unsupported_BANG_.cljs$core$IFn$_invoke$arity$0 = (function (){ 60 | return thi.ng.common.error.unsupported_BANG_.call(null,"Unsupported operation"); 61 | }); 62 | 63 | thi.ng.common.error.unsupported_BANG_.cljs$core$IFn$_invoke$arity$1 = (function (msg){ 64 | throw (new Error(msg)); 65 | }); 66 | 67 | thi.ng.common.error.unsupported_BANG_.cljs$lang$maxFixedArity = 1; 68 | 69 | //# sourceMappingURL=error.js.map -------------------------------------------------------------------------------- /out/thi/ng/common/error.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"\/Users\/james\/projects\/cljs-draw\/out\/thi\/ng\/common\/error.js","sources":["error.cljs"],"lineCount":69,"mappings":";AAAA;;AAEA,kCAAA,lCAAMA,4EACKC;AADX,AAEE,MAEQ,KAAAC,MAAWD;;AAErB,sCAAA,tCAAME,oFACHC;AADH,AACM,OAACJ,0CAAO,eAAA,sCAA4BI;;AAE1C,uCAAA,vCAAMC,sFACHC,EAAEC;AADL,AACQ,OAACP,0CAAO,eAAA,gDAAA,jBAAqBM,yCAAW,AAACE,2BAAOD;;AAExD,wCAAA,xCAAME,wFACHC;AADH,AACM,OAACV,0CAAO,eAAA,wCAA8BU;;AAE5C,AAAA,wCAAA,xCAAME;AAAN,AAAA,IAAAD,WAAA,AAAA;AAAA,AAAA,QAAAA;KAAA;AAAA,OAAAC,oEAAA,CAAA,UAAA;;;KAAA;AAAA,OAAAA,oEAAA,CAAA,UAAA,MAAA,CAAA,UAAA;;;;AAAA,MAAA,KAAAV,MAAA,eAAA,iCAAA,AAAA;;;;;AAAA,AAAA,sEAAA,tEAAMU,iFACFL;AADJ,AACO,uDAAA,hDAACK,mEAAgCL;;;AADxC,AAAA,sEAAA,tEAAMK,iFAEFX,IAAIM;AAFR,AAEW,OAACP,0CAAO,kCAAA,nBAAKC,uCAASM;;;AAFjC,AAAA,gEAAA,hEAAMK;AAIN,AAAA,wCAAA,xCAAME;AAAN,AAAA,IAAAD,WAAA,AAAA;AAAA,AAAA,QAAAA;KAAA;AAAA,OAAAC;;;KAAA;AAAA,OAAAA,oEAAA,CAAA,UAAA;;;;AAAA,MAAA,KAAAZ,MAAA,eAAA,iCAAA,AAAA;;;;;AAAA,AAAA,sEAAA,tEAAMY;AAAN,AACM,uDAAA,hDAACA;;;AADP,AAAA,sEAAA,tEAAMA,iFAEMb;AAFZ,AAGK,MAEQ,KAAAC,MAAWD;;;AALxB,AAAA,gEAAA,hEAAMa","names":["thi.ng.common.error\/throw!","msg","js\/Error","thi.ng.common.error\/key-error!","k","thi.ng.common.error\/type-error!","t","x","cljs.core\/pr-str","thi.ng.common.error\/arity-error!","n","G__16988","thi.ng.common.error\/illegal-arg!","G__16991","thi.ng.common.error\/unsupported!"]} -------------------------------------------------------------------------------- /project.clj: -------------------------------------------------------------------------------- 1 | (defproject cljs-draw "0.0.1-SNAPSHOT" 2 | :description "draw stuff" 3 | :dependencies 4 | [[org.clojure/clojurescript "0.0-3308"] 5 | [org.clojure/core.async "0.1.346.0-17112a-alpha"] 6 | [org.omcljs/om "0.8.8"] 7 | [kovasb/gamma "0.0-135-2-g18b5**DIRTY**"] 8 | [kovasb/gamma-driver "0.0-49-5-g4447"] 9 | [fipp "0.6.2"] 10 | [thi.ng/geom "0.0.783"] 11 | [thi.ng/math "0.1.0"]]) 12 | -------------------------------------------------------------------------------- /style.css: -------------------------------------------------------------------------------- 1 | * { 2 | -webkit-box-sizing: border-box; 3 | -moz-box-sizing: border-box; 4 | box-sizing: border-box; 5 | } 6 | 7 | body, .mount { 8 | margin: 0; 9 | padding: 0; 10 | height: 100%; 11 | overflow: hidden; 12 | } 13 | 14 | a, a:active { 15 | color: #cccccc; 16 | text-decoration: none; 17 | } -------------------------------------------------------------------------------- /target/stale/extract-native.dependencies: -------------------------------------------------------------------------------- 1 | ([:dependencies ([org.clojure/clojurescript "0.0-3308"] [org.clojure/core.async "0.1.346.0-17112a-alpha"] [org.omcljs/om "0.8.8"] [kovasb/gamma "0.0-135-2-g18b5**DIRTY**"] [kovasb/gamma-driver "0.0-49-5-g4447"] [fipp/fipp "0.6.2"] [thi.ng/geom "0.0.783"] [thi.ng/math "0.1.0"] [org.clojure/tools.nrepl "0.2.6" :exclusions ([org.clojure/clojure]) :scope "test"] [clojure-complete/clojure-complete "0.2.3" :exclusions ([org.clojure/clojure]) :scope "test"])]) --------------------------------------------------------------------------------