Mercurial > repos > tabletprog
comparison compiler.js @ 36:3b0503a67165
Add scripts for building programs via C using d8 rather than a browser
author | Mike Pavone <pavone@retrodev.com> |
---|---|
date | Tue, 10 Jul 2012 19:22:19 -0700 |
parents | bf5e88f6419d |
children | e7be612fd3ae |
comparison
equal
deleted
inserted
replaced
35:bf5e88f6419d | 36:3b0503a67165 |
---|---|
6 var toplevel = new topsymbols(); | 6 var toplevel = new topsymbols(); |
7 function topsymbols() | 7 function topsymbols() |
8 { | 8 { |
9 this.names = null; | 9 this.names = null; |
10 var self = this; | 10 var self = this; |
11 get('/src/', function(data) { | 11 if (typeof window === "object") { |
12 self.names = {}; | 12 get('/src/', function(data) { |
13 var fakeEl = newEl("div", { | 13 self.names = {}; |
14 innerHTML: data.response | 14 var fakeEl = newEl("div", { |
15 innerHTML: data.response | |
16 }); | |
17 each(qall('a', fakeEl), function(idx, a) { | |
18 var tpidx = a.textContent.indexOf('.tp'); | |
19 if (tpidx > -1) { | |
20 self.names[a.textContent.substr(0, tpidx)] = true; | |
21 } | |
22 }); | |
15 }); | 23 }); |
16 each(qall('a', fakeEl), function(idx, a) { | 24 } else { |
17 var tpidx = a.textContent.indexOf('.tp'); | 25 this.names = {}; |
18 if (tpidx > -1) { | 26 } |
19 self.names[a.textContent.substr(0, tpidx)] = true; | |
20 } | |
21 }); | |
22 }); | |
23 } | 27 } |
24 topsymbols.prototype.find = function(name) { | 28 topsymbols.prototype.find = function(name) { |
25 if (!this.names) { | 29 if (!this.names) { |
26 throw new Error('data not ready'); | 30 throw new Error('data not ready'); |
27 } | 31 } |