PageRenderTime 45ms CodeModel.GetById 20ms RepoModel.GetById 0ms app.codeStats 1ms

/socketTests/Server/bin/Server.js

http://github.com/AxGord/Pony
JavaScript | 4365 lines | 4365 code | 0 blank | 0 comment | 984 complexity | 67fb8df429786a461e2befa524c2c05d MD5 | raw file
Possible License(s): MIT
  1. (function () { "use strict";
  2. var $estr = function() { return js.Boot.__string_rec(this,''); };
  3. function $extend(from, fields) {
  4. function Inherit() {} Inherit.prototype = from; var proto = new Inherit();
  5. for (var name in fields) proto[name] = fields[name];
  6. if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString;
  7. return proto;
  8. }
  9. var HxOverrides = function() { };
  10. HxOverrides.__name__ = true;
  11. HxOverrides.cca = function(s,index) {
  12. var x = s.charCodeAt(index);
  13. if(x != x) return undefined;
  14. return x;
  15. };
  16. HxOverrides.substr = function(s,pos,len) {
  17. if(pos != null && pos != 0 && len != null && len < 0) return "";
  18. if(len == null) len = s.length;
  19. if(pos < 0) {
  20. pos = s.length + pos;
  21. if(pos < 0) pos = 0;
  22. } else if(len < 0) len = s.length + len - pos;
  23. return s.substr(pos,len);
  24. };
  25. HxOverrides.indexOf = function(a,obj,i) {
  26. var len = a.length;
  27. if(i < 0) {
  28. i += len;
  29. if(i < 0) i = 0;
  30. }
  31. while(i < len) {
  32. if(a[i] === obj) return i;
  33. i++;
  34. }
  35. return -1;
  36. };
  37. HxOverrides.remove = function(a,obj) {
  38. var i = HxOverrides.indexOf(a,obj,0);
  39. if(i == -1) return false;
  40. a.splice(i,1);
  41. return true;
  42. };
  43. HxOverrides.iter = function(a) {
  44. return { cur : 0, arr : a, hasNext : function() {
  45. return this.cur < this.arr.length;
  46. }, next : function() {
  47. return this.arr[this.cur++];
  48. }};
  49. };
  50. var IntIterator = function(min,max) {
  51. this.min = min;
  52. this.max = max;
  53. };
  54. IntIterator.__name__ = true;
  55. IntIterator.prototype = {
  56. __class__: IntIterator
  57. };
  58. var Lambda = function() { };
  59. Lambda.__name__ = true;
  60. Lambda.exists = function(it,f) {
  61. var $it0 = $iterator(it)();
  62. while( $it0.hasNext() ) {
  63. var x = $it0.next();
  64. if(f(x)) return true;
  65. }
  66. return false;
  67. };
  68. Lambda.indexOf = function(it,v) {
  69. var i = 0;
  70. var $it0 = $iterator(it)();
  71. while( $it0.hasNext() ) {
  72. var v2 = $it0.next();
  73. if(v == v2) return i;
  74. i++;
  75. }
  76. return -1;
  77. };
  78. var List = function() {
  79. this.length = 0;
  80. };
  81. List.__name__ = true;
  82. List.prototype = {
  83. add: function(item) {
  84. var x = [item];
  85. if(this.h == null) this.h = x; else this.q[1] = x;
  86. this.q = x;
  87. this.length++;
  88. }
  89. ,push: function(item) {
  90. var x = [item,this.h];
  91. this.h = x;
  92. if(this.q == null) this.q = x;
  93. this.length++;
  94. }
  95. ,pop: function() {
  96. if(this.h == null) return null;
  97. var x = this.h[0];
  98. this.h = this.h[1];
  99. if(this.h == null) this.q = null;
  100. this.length--;
  101. return x;
  102. }
  103. ,remove: function(v) {
  104. var prev = null;
  105. var l = this.h;
  106. while(l != null) {
  107. if(l[0] == v) {
  108. if(prev == null) this.h = l[1]; else prev[1] = l[1];
  109. if(this.q == l) this.q = prev;
  110. this.length--;
  111. return true;
  112. }
  113. prev = l;
  114. l = l[1];
  115. }
  116. return false;
  117. }
  118. ,__class__: List
  119. };
  120. var Main = function() { };
  121. Main.__name__ = true;
  122. Main.main = function() {
  123. var s = new pony.net.SocketServer(13579);
  124. var this1 = s.onConnect;
  125. var listener;
  126. var l;
  127. var f = pony._Function.Function_Impl_.from(function(cl) {
  128. var bo = new haxe.io.BytesOutput();
  129. bo.writeInt32("Hello man!".length);
  130. bo.writeString("Hello man!");
  131. cl.send(bo);
  132. },1,false);
  133. l = pony.events._Listener.Listener_Impl_._fromFunction(f);
  134. listener = l;
  135. pony.events._Signal1.Signal1_Impl_.add(this1,listener);
  136. this1;
  137. };
  138. Math.__name__ = true;
  139. var Reflect = function() { };
  140. Reflect.__name__ = true;
  141. Reflect.field = function(o,field) {
  142. try {
  143. return o[field];
  144. } catch( e ) {
  145. return null;
  146. }
  147. };
  148. Reflect.setField = function(o,field,value) {
  149. o[field] = value;
  150. };
  151. Reflect.callMethod = function(o,func,args) {
  152. return func.apply(o,args);
  153. };
  154. Reflect.fields = function(o) {
  155. var a = [];
  156. if(o != null) {
  157. var hasOwnProperty = Object.prototype.hasOwnProperty;
  158. for( var f in o ) {
  159. if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) a.push(f);
  160. }
  161. }
  162. return a;
  163. };
  164. Reflect.isFunction = function(f) {
  165. return typeof(f) == "function" && !(f.__name__ || f.__ename__);
  166. };
  167. Reflect.compare = function(a,b) {
  168. if(a == b) return 0; else if(a > b) return 1; else return -1;
  169. };
  170. Reflect.compareMethods = function(f1,f2) {
  171. if(f1 == f2) return true;
  172. if(!Reflect.isFunction(f1) || !Reflect.isFunction(f2)) return false;
  173. return f1.scope == f2.scope && f1.method == f2.method && f1.method != null;
  174. };
  175. Reflect.isObject = function(v) {
  176. if(v == null) return false;
  177. var t = typeof(v);
  178. return t == "string" || t == "object" && v.__enum__ == null || t == "function" && (v.__name__ || v.__ename__) != null;
  179. };
  180. Reflect.isEnumValue = function(v) {
  181. return v != null && v.__enum__ != null;
  182. };
  183. Reflect.makeVarArgs = function(f) {
  184. return function() {
  185. var a = Array.prototype.slice.call(arguments);
  186. return f(a);
  187. };
  188. };
  189. var Std = function() { };
  190. Std.__name__ = true;
  191. Std.string = function(s) {
  192. return js.Boot.__string_rec(s,"");
  193. };
  194. Std.parseInt = function(x) {
  195. var v = parseInt(x,10);
  196. if(v == 0 && (HxOverrides.cca(x,1) == 120 || HxOverrides.cca(x,1) == 88)) v = parseInt(x);
  197. if(isNaN(v)) return null;
  198. return v;
  199. };
  200. Std.parseFloat = function(x) {
  201. return parseFloat(x);
  202. };
  203. var StringBuf = function() {
  204. this.b = "";
  205. };
  206. StringBuf.__name__ = true;
  207. StringBuf.prototype = {
  208. add: function(x) {
  209. this.b += Std.string(x);
  210. }
  211. ,addSub: function(s,pos,len) {
  212. if(len == null) this.b += HxOverrides.substr(s,pos,null); else this.b += HxOverrides.substr(s,pos,len);
  213. }
  214. ,__class__: StringBuf
  215. };
  216. var StringTools = function() { };
  217. StringTools.__name__ = true;
  218. StringTools.isSpace = function(s,pos) {
  219. var c = HxOverrides.cca(s,pos);
  220. return c > 8 && c < 14 || c == 32;
  221. };
  222. StringTools.ltrim = function(s) {
  223. var l = s.length;
  224. var r = 0;
  225. while(r < l && StringTools.isSpace(s,r)) r++;
  226. if(r > 0) return HxOverrides.substr(s,r,l - r); else return s;
  227. };
  228. StringTools.rtrim = function(s) {
  229. var l = s.length;
  230. var r = 0;
  231. while(r < l && StringTools.isSpace(s,l - r - 1)) r++;
  232. if(r > 0) return HxOverrides.substr(s,0,l - r); else return s;
  233. };
  234. StringTools.trim = function(s) {
  235. return StringTools.ltrim(StringTools.rtrim(s));
  236. };
  237. StringTools.hex = function(n,digits) {
  238. var s = "";
  239. var hexChars = "0123456789ABCDEF";
  240. do {
  241. s = hexChars.charAt(n & 15) + s;
  242. n >>>= 4;
  243. } while(n > 0);
  244. if(digits != null) while(s.length < digits) s = "0" + s;
  245. return s;
  246. };
  247. StringTools.fastCodeAt = function(s,index) {
  248. return s.charCodeAt(index);
  249. };
  250. var ValueType = { __ename__ : true, __constructs__ : ["TNull","TInt","TFloat","TBool","TObject","TFunction","TClass","TEnum","TUnknown"] };
  251. ValueType.TNull = ["TNull",0];
  252. ValueType.TNull.toString = $estr;
  253. ValueType.TNull.__enum__ = ValueType;
  254. ValueType.TInt = ["TInt",1];
  255. ValueType.TInt.toString = $estr;
  256. ValueType.TInt.__enum__ = ValueType;
  257. ValueType.TFloat = ["TFloat",2];
  258. ValueType.TFloat.toString = $estr;
  259. ValueType.TFloat.__enum__ = ValueType;
  260. ValueType.TBool = ["TBool",3];
  261. ValueType.TBool.toString = $estr;
  262. ValueType.TBool.__enum__ = ValueType;
  263. ValueType.TObject = ["TObject",4];
  264. ValueType.TObject.toString = $estr;
  265. ValueType.TObject.__enum__ = ValueType;
  266. ValueType.TFunction = ["TFunction",5];
  267. ValueType.TFunction.toString = $estr;
  268. ValueType.TFunction.__enum__ = ValueType;
  269. ValueType.TClass = function(c) { var $x = ["TClass",6,c]; $x.__enum__ = ValueType; $x.toString = $estr; return $x; };
  270. ValueType.TEnum = function(e) { var $x = ["TEnum",7,e]; $x.__enum__ = ValueType; $x.toString = $estr; return $x; };
  271. ValueType.TUnknown = ["TUnknown",8];
  272. ValueType.TUnknown.toString = $estr;
  273. ValueType.TUnknown.__enum__ = ValueType;
  274. var Type = function() { };
  275. Type.__name__ = true;
  276. Type.getEnum = function(o) {
  277. if(o == null) return null;
  278. return o.__enum__;
  279. };
  280. Type.createEmptyInstance = function(cl) {
  281. function empty() {}; empty.prototype = cl.prototype;
  282. return new empty();
  283. };
  284. Type["typeof"] = function(v) {
  285. var _g = typeof(v);
  286. switch(_g) {
  287. case "boolean":
  288. return ValueType.TBool;
  289. case "string":
  290. return ValueType.TClass(String);
  291. case "number":
  292. if(Math.ceil(v) == v % 2147483648.0) return ValueType.TInt;
  293. return ValueType.TFloat;
  294. case "object":
  295. if(v == null) return ValueType.TNull;
  296. var e = v.__enum__;
  297. if(e != null) return ValueType.TEnum(e);
  298. var c = js.Boot.getClass(v);
  299. if(c != null) return ValueType.TClass(c);
  300. return ValueType.TObject;
  301. case "function":
  302. if(v.__name__ || v.__ename__) return ValueType.TObject;
  303. return ValueType.TFunction;
  304. case "undefined":
  305. return ValueType.TNull;
  306. default:
  307. return ValueType.TUnknown;
  308. }
  309. };
  310. Type.enumParameters = function(e) {
  311. return e.slice(2);
  312. };
  313. Type.enumIndex = function(e) {
  314. return e[1];
  315. };
  316. var XmlType = { __ename__ : true, __constructs__ : [] };
  317. var Xml = function() {
  318. };
  319. Xml.__name__ = true;
  320. Xml.parse = function(str) {
  321. return haxe.xml.Parser.parse(str);
  322. };
  323. Xml.createElement = function(name) {
  324. var r = new Xml();
  325. r.nodeType = Xml.Element;
  326. r._children = new Array();
  327. r._attributes = new haxe.ds.StringMap();
  328. r.set_nodeName(name);
  329. return r;
  330. };
  331. Xml.createPCData = function(data) {
  332. var r = new Xml();
  333. r.nodeType = Xml.PCData;
  334. r.set_nodeValue(data);
  335. return r;
  336. };
  337. Xml.createCData = function(data) {
  338. var r = new Xml();
  339. r.nodeType = Xml.CData;
  340. r.set_nodeValue(data);
  341. return r;
  342. };
  343. Xml.createComment = function(data) {
  344. var r = new Xml();
  345. r.nodeType = Xml.Comment;
  346. r.set_nodeValue(data);
  347. return r;
  348. };
  349. Xml.createDocType = function(data) {
  350. var r = new Xml();
  351. r.nodeType = Xml.DocType;
  352. r.set_nodeValue(data);
  353. return r;
  354. };
  355. Xml.createProcessingInstruction = function(data) {
  356. var r = new Xml();
  357. r.nodeType = Xml.ProcessingInstruction;
  358. r.set_nodeValue(data);
  359. return r;
  360. };
  361. Xml.createDocument = function() {
  362. var r = new Xml();
  363. r.nodeType = Xml.Document;
  364. r._children = new Array();
  365. return r;
  366. };
  367. Xml.prototype = {
  368. get_nodeName: function() {
  369. if(this.nodeType != Xml.Element) throw "bad nodeType";
  370. return this._nodeName;
  371. }
  372. ,set_nodeName: function(n) {
  373. if(this.nodeType != Xml.Element) throw "bad nodeType";
  374. return this._nodeName = n;
  375. }
  376. ,set_nodeValue: function(v) {
  377. if(this.nodeType == Xml.Element || this.nodeType == Xml.Document) throw "bad nodeType";
  378. return this._nodeValue = v;
  379. }
  380. ,get: function(att) {
  381. if(this.nodeType != Xml.Element) throw "bad nodeType";
  382. return this._attributes.get(att);
  383. }
  384. ,set: function(att,value) {
  385. if(this.nodeType != Xml.Element) throw "bad nodeType";
  386. this._attributes.set(att,value);
  387. }
  388. ,exists: function(att) {
  389. if(this.nodeType != Xml.Element) throw "bad nodeType";
  390. return this._attributes.exists(att);
  391. }
  392. ,addChild: function(x) {
  393. if(this._children == null) throw "bad nodetype";
  394. if(x._parent != null) HxOverrides.remove(x._parent._children,x);
  395. x._parent = this;
  396. this._children.push(x);
  397. }
  398. ,__class__: Xml
  399. };
  400. var haxe = {};
  401. haxe.StackItem = { __ename__ : true, __constructs__ : ["CFunction","Module","FilePos","Method","LocalFunction"] };
  402. haxe.StackItem.CFunction = ["CFunction",0];
  403. haxe.StackItem.CFunction.toString = $estr;
  404. haxe.StackItem.CFunction.__enum__ = haxe.StackItem;
  405. haxe.StackItem.Module = function(m) { var $x = ["Module",1,m]; $x.__enum__ = haxe.StackItem; $x.toString = $estr; return $x; };
  406. haxe.StackItem.FilePos = function(s,file,line) { var $x = ["FilePos",2,s,file,line]; $x.__enum__ = haxe.StackItem; $x.toString = $estr; return $x; };
  407. haxe.StackItem.Method = function(classname,method) { var $x = ["Method",3,classname,method]; $x.__enum__ = haxe.StackItem; $x.toString = $estr; return $x; };
  408. haxe.StackItem.LocalFunction = function(v) { var $x = ["LocalFunction",4,v]; $x.__enum__ = haxe.StackItem; $x.toString = $estr; return $x; };
  409. haxe.CallStack = function() { };
  410. haxe.CallStack.__name__ = true;
  411. haxe.CallStack.exceptionStack = function() {
  412. return [];
  413. };
  414. haxe.CallStack.toString = function(stack) {
  415. var b = new StringBuf();
  416. var _g = 0;
  417. while(_g < stack.length) {
  418. var s = stack[_g];
  419. ++_g;
  420. b.b += "\nCalled from ";
  421. haxe.CallStack.itemToString(b,s);
  422. }
  423. return b.b;
  424. };
  425. haxe.CallStack.itemToString = function(b,s) {
  426. switch(s[1]) {
  427. case 0:
  428. b.b += "a C function";
  429. break;
  430. case 1:
  431. var m = s[2];
  432. b.b += "module ";
  433. if(m == null) b.b += "null"; else b.b += "" + m;
  434. break;
  435. case 2:
  436. var line = s[4];
  437. var file = s[3];
  438. var s1 = s[2];
  439. if(s1 != null) {
  440. haxe.CallStack.itemToString(b,s1);
  441. b.b += " (";
  442. }
  443. if(file == null) b.b += "null"; else b.b += "" + file;
  444. b.b += " line ";
  445. if(line == null) b.b += "null"; else b.b += "" + line;
  446. if(s1 != null) b.b += ")";
  447. break;
  448. case 3:
  449. var meth = s[3];
  450. var cname = s[2];
  451. if(cname == null) b.b += "null"; else b.b += "" + cname;
  452. b.b += ".";
  453. if(meth == null) b.b += "null"; else b.b += "" + meth;
  454. break;
  455. case 4:
  456. var n = s[2];
  457. b.b += "local function #";
  458. if(n == null) b.b += "null"; else b.b += "" + n;
  459. break;
  460. }
  461. };
  462. haxe.IMap = function() { };
  463. haxe.IMap.__name__ = true;
  464. haxe.Log = function() { };
  465. haxe.Log.__name__ = true;
  466. haxe.Log.trace = function(v,infos) {
  467. js.Boot.__trace(v,infos);
  468. };
  469. haxe.Timer = function(time_ms) {
  470. var me = this;
  471. this.id = setInterval(function() {
  472. me.run();
  473. },time_ms);
  474. };
  475. haxe.Timer.__name__ = true;
  476. haxe.Timer.delay = function(f,time_ms) {
  477. var t = new haxe.Timer(time_ms);
  478. t.run = function() {
  479. t.stop();
  480. f();
  481. };
  482. return t;
  483. };
  484. haxe.Timer.prototype = {
  485. stop: function() {
  486. if(this.id == null) return;
  487. clearInterval(this.id);
  488. this.id = null;
  489. }
  490. ,run: function() {
  491. }
  492. ,__class__: haxe.Timer
  493. };
  494. haxe.ds = {};
  495. haxe.ds.BalancedTree = function() {
  496. };
  497. haxe.ds.BalancedTree.__name__ = true;
  498. haxe.ds.BalancedTree.prototype = {
  499. set: function(key,value) {
  500. this.root = this.setLoop(key,value,this.root);
  501. }
  502. ,get: function(key) {
  503. var node = this.root;
  504. while(node != null) {
  505. var c = this.compare(key,node.key);
  506. if(c == 0) return node.value;
  507. if(c < 0) node = node.left; else node = node.right;
  508. }
  509. return null;
  510. }
  511. ,keys: function() {
  512. var ret = [];
  513. this.keysLoop(this.root,ret);
  514. return HxOverrides.iter(ret);
  515. }
  516. ,setLoop: function(k,v,node) {
  517. if(node == null) return new haxe.ds.TreeNode(null,k,v,null);
  518. var c = this.compare(k,node.key);
  519. if(c == 0) return new haxe.ds.TreeNode(node.left,k,v,node.right,node == null?0:node._height); else if(c < 0) {
  520. var nl = this.setLoop(k,v,node.left);
  521. return this.balance(nl,node.key,node.value,node.right);
  522. } else {
  523. var nr = this.setLoop(k,v,node.right);
  524. return this.balance(node.left,node.key,node.value,nr);
  525. }
  526. }
  527. ,keysLoop: function(node,acc) {
  528. if(node != null) {
  529. this.keysLoop(node.left,acc);
  530. acc.push(node.key);
  531. this.keysLoop(node.right,acc);
  532. }
  533. }
  534. ,balance: function(l,k,v,r) {
  535. var hl;
  536. if(l == null) hl = 0; else hl = l._height;
  537. var hr;
  538. if(r == null) hr = 0; else hr = r._height;
  539. if(hl > hr + 2) {
  540. if((function($this) {
  541. var $r;
  542. var _this = l.left;
  543. $r = _this == null?0:_this._height;
  544. return $r;
  545. }(this)) >= (function($this) {
  546. var $r;
  547. var _this1 = l.right;
  548. $r = _this1 == null?0:_this1._height;
  549. return $r;
  550. }(this))) return new haxe.ds.TreeNode(l.left,l.key,l.value,new haxe.ds.TreeNode(l.right,k,v,r)); else return new haxe.ds.TreeNode(new haxe.ds.TreeNode(l.left,l.key,l.value,l.right.left),l.right.key,l.right.value,new haxe.ds.TreeNode(l.right.right,k,v,r));
  551. } else if(hr > hl + 2) {
  552. if((function($this) {
  553. var $r;
  554. var _this2 = r.right;
  555. $r = _this2 == null?0:_this2._height;
  556. return $r;
  557. }(this)) > (function($this) {
  558. var $r;
  559. var _this3 = r.left;
  560. $r = _this3 == null?0:_this3._height;
  561. return $r;
  562. }(this))) return new haxe.ds.TreeNode(new haxe.ds.TreeNode(l,k,v,r.left),r.key,r.value,r.right); else return new haxe.ds.TreeNode(new haxe.ds.TreeNode(l,k,v,r.left.left),r.left.key,r.left.value,new haxe.ds.TreeNode(r.left.right,r.key,r.value,r.right));
  563. } else return new haxe.ds.TreeNode(l,k,v,r,(hl > hr?hl:hr) + 1);
  564. }
  565. ,compare: function(k1,k2) {
  566. return Reflect.compare(k1,k2);
  567. }
  568. ,__class__: haxe.ds.BalancedTree
  569. };
  570. haxe.ds.TreeNode = function(l,k,v,r,h) {
  571. if(h == null) h = -1;
  572. this.left = l;
  573. this.key = k;
  574. this.value = v;
  575. this.right = r;
  576. if(h == -1) this._height = ((function($this) {
  577. var $r;
  578. var _this = $this.left;
  579. $r = _this == null?0:_this._height;
  580. return $r;
  581. }(this)) > (function($this) {
  582. var $r;
  583. var _this1 = $this.right;
  584. $r = _this1 == null?0:_this1._height;
  585. return $r;
  586. }(this))?(function($this) {
  587. var $r;
  588. var _this2 = $this.left;
  589. $r = _this2 == null?0:_this2._height;
  590. return $r;
  591. }(this)):(function($this) {
  592. var $r;
  593. var _this3 = $this.right;
  594. $r = _this3 == null?0:_this3._height;
  595. return $r;
  596. }(this))) + 1; else this._height = h;
  597. };
  598. haxe.ds.TreeNode.__name__ = true;
  599. haxe.ds.TreeNode.prototype = {
  600. __class__: haxe.ds.TreeNode
  601. };
  602. haxe.ds.EnumValueMap = function() {
  603. haxe.ds.BalancedTree.call(this);
  604. };
  605. haxe.ds.EnumValueMap.__name__ = true;
  606. haxe.ds.EnumValueMap.__interfaces__ = [haxe.IMap];
  607. haxe.ds.EnumValueMap.__super__ = haxe.ds.BalancedTree;
  608. haxe.ds.EnumValueMap.prototype = $extend(haxe.ds.BalancedTree.prototype,{
  609. compare: function(k1,k2) {
  610. var d = k1[1] - k2[1];
  611. if(d != 0) return d;
  612. var p1 = k1.slice(2);
  613. var p2 = k2.slice(2);
  614. if(p1.length == 0 && p2.length == 0) return 0;
  615. return this.compareArgs(p1,p2);
  616. }
  617. ,compareArgs: function(a1,a2) {
  618. var ld = a1.length - a2.length;
  619. if(ld != 0) return ld;
  620. var _g1 = 0;
  621. var _g = a1.length;
  622. while(_g1 < _g) {
  623. var i = _g1++;
  624. var d = this.compareArg(a1[i],a2[i]);
  625. if(d != 0) return d;
  626. }
  627. return 0;
  628. }
  629. ,compareArg: function(v1,v2) {
  630. if(Reflect.isEnumValue(v1) && Reflect.isEnumValue(v2)) return this.compare(v1,v2); else if((v1 instanceof Array) && v1.__enum__ == null && ((v2 instanceof Array) && v2.__enum__ == null)) return this.compareArgs(v1,v2); else return Reflect.compare(v1,v2);
  631. }
  632. ,__class__: haxe.ds.EnumValueMap
  633. });
  634. haxe.ds.IntMap = function() {
  635. this.h = { };
  636. };
  637. haxe.ds.IntMap.__name__ = true;
  638. haxe.ds.IntMap.__interfaces__ = [haxe.IMap];
  639. haxe.ds.IntMap.prototype = {
  640. set: function(key,value) {
  641. this.h[key] = value;
  642. }
  643. ,get: function(key) {
  644. return this.h[key];
  645. }
  646. ,exists: function(key) {
  647. return this.h.hasOwnProperty(key);
  648. }
  649. ,remove: function(key) {
  650. if(!this.h.hasOwnProperty(key)) return false;
  651. delete(this.h[key]);
  652. return true;
  653. }
  654. ,keys: function() {
  655. var a = [];
  656. for( var key in this.h ) {
  657. if(this.h.hasOwnProperty(key)) a.push(key | 0);
  658. }
  659. return HxOverrides.iter(a);
  660. }
  661. ,iterator: function() {
  662. return { ref : this.h, it : this.keys(), hasNext : function() {
  663. return this.it.hasNext();
  664. }, next : function() {
  665. var i = this.it.next();
  666. return this.ref[i];
  667. }};
  668. }
  669. ,__class__: haxe.ds.IntMap
  670. };
  671. haxe.ds.StringMap = function() {
  672. this.h = { };
  673. };
  674. haxe.ds.StringMap.__name__ = true;
  675. haxe.ds.StringMap.__interfaces__ = [haxe.IMap];
  676. haxe.ds.StringMap.prototype = {
  677. set: function(key,value) {
  678. this.h["$" + key] = value;
  679. }
  680. ,get: function(key) {
  681. return this.h["$" + key];
  682. }
  683. ,exists: function(key) {
  684. return this.h.hasOwnProperty("$" + key);
  685. }
  686. ,__class__: haxe.ds.StringMap
  687. };
  688. haxe.io = {};
  689. haxe.io.Bytes = function(length,b) {
  690. this.length = length;
  691. this.b = b;
  692. };
  693. haxe.io.Bytes.__name__ = true;
  694. haxe.io.Bytes.alloc = function(length) {
  695. return new haxe.io.Bytes(length,new Buffer(length));
  696. };
  697. haxe.io.Bytes.ofString = function(s) {
  698. var nb = new Buffer(s,"utf8");
  699. return new haxe.io.Bytes(nb.length,nb);
  700. };
  701. haxe.io.Bytes.ofData = function(b) {
  702. return new haxe.io.Bytes(b.length,b);
  703. };
  704. haxe.io.Bytes.prototype = {
  705. get: function(pos) {
  706. return this.b[pos];
  707. }
  708. ,set: function(pos,v) {
  709. this.b[pos] = v;
  710. }
  711. ,blit: function(pos,src,srcpos,len) {
  712. if(pos < 0 || srcpos < 0 || len < 0 || pos + len > this.length || srcpos + len > src.length) throw haxe.io.Error.OutsideBounds;
  713. src.b.copy(this.b,pos,srcpos,srcpos + len);
  714. }
  715. ,sub: function(pos,len) {
  716. if(pos < 0 || len < 0 || pos + len > this.length) throw haxe.io.Error.OutsideBounds;
  717. var nb = new Buffer(len);
  718. var slice = this.b.slice(pos,pos + len);
  719. slice.copy(nb,0,0,len);
  720. return new haxe.io.Bytes(len,nb);
  721. }
  722. ,compare: function(other) {
  723. var b1 = this.b;
  724. var b2 = other.b;
  725. var len;
  726. if(this.length < other.length) len = this.length; else len = other.length;
  727. var _g = 0;
  728. while(_g < len) {
  729. var i = _g++;
  730. if(b1[i] != b2[i]) return b1[i] - b2[i];
  731. }
  732. return this.length - other.length;
  733. }
  734. ,readString: function(pos,len) {
  735. if(pos < 0 || len < 0 || pos + len > this.length) throw haxe.io.Error.OutsideBounds;
  736. var s = "";
  737. var b = this.b;
  738. var fcc = String.fromCharCode;
  739. var i = pos;
  740. var max = pos + len;
  741. while(i < max) {
  742. var c = b[i++];
  743. if(c < 128) {
  744. if(c == 0) break;
  745. s += fcc(c);
  746. } else if(c < 224) s += fcc((c & 63) << 6 | b[i++] & 127); else if(c < 240) {
  747. var c2 = b[i++];
  748. s += fcc((c & 31) << 12 | (c2 & 127) << 6 | b[i++] & 127);
  749. } else {
  750. var c21 = b[i++];
  751. var c3 = b[i++];
  752. s += fcc((c & 15) << 18 | (c21 & 127) << 12 | c3 << 6 & 127 | b[i++] & 127);
  753. }
  754. }
  755. return s;
  756. }
  757. ,toString: function() {
  758. return this.readString(0,this.length);
  759. }
  760. ,toHex: function() {
  761. var s_b = "";
  762. var chars = [];
  763. var str = "0123456789abcdef";
  764. var _g1 = 0;
  765. var _g = str.length;
  766. while(_g1 < _g) {
  767. var i = _g1++;
  768. chars.push(HxOverrides.cca(str,i));
  769. }
  770. var _g11 = 0;
  771. var _g2 = this.length;
  772. while(_g11 < _g2) {
  773. var i1 = _g11++;
  774. var c = this.b[i1];
  775. s_b += String.fromCharCode(chars[c >> 4]);
  776. s_b += String.fromCharCode(chars[c & 15]);
  777. }
  778. return s_b;
  779. }
  780. ,getData: function() {
  781. return this.b;
  782. }
  783. ,__class__: haxe.io.Bytes
  784. };
  785. haxe.io.BytesBuffer = function() {
  786. this.b = new Array();
  787. };
  788. haxe.io.BytesBuffer.__name__ = true;
  789. haxe.io.BytesBuffer.prototype = {
  790. get_length: function() {
  791. return this.b.length;
  792. }
  793. ,addByte: function($byte) {
  794. this.b.push($byte);
  795. }
  796. ,add: function(src) {
  797. var b1 = this.b;
  798. var b2 = src.b;
  799. var _g1 = 0;
  800. var _g = src.length;
  801. while(_g1 < _g) {
  802. var i = _g1++;
  803. this.b.push(b2[i]);
  804. }
  805. }
  806. ,addBytes: function(src,pos,len) {
  807. if(pos < 0 || len < 0 || pos + len > src.length) throw haxe.io.Error.OutsideBounds;
  808. var b1 = this.b;
  809. var b2 = src.b;
  810. var _g1 = pos;
  811. var _g = pos + len;
  812. while(_g1 < _g) {
  813. var i = _g1++;
  814. this.b.push(b2[i]);
  815. }
  816. }
  817. ,getBytes: function() {
  818. var nb = new Buffer(this.b);
  819. var bytes = new haxe.io.Bytes(nb.length,nb);
  820. this.b = null;
  821. return bytes;
  822. }
  823. ,__class__: haxe.io.BytesBuffer
  824. };
  825. haxe.io.Input = function() { };
  826. haxe.io.Input.__name__ = true;
  827. haxe.io.Input.prototype = {
  828. readByte: function() {
  829. throw "Not implemented";
  830. }
  831. ,readBytes: function(s,pos,len) {
  832. var k = len;
  833. var b = s.b;
  834. if(pos < 0 || len < 0 || pos + len > s.length) throw haxe.io.Error.OutsideBounds;
  835. while(k > 0) {
  836. b[pos] = this.readByte();
  837. pos++;
  838. k--;
  839. }
  840. return len;
  841. }
  842. ,readFullBytes: function(s,pos,len) {
  843. while(len > 0) {
  844. var k = this.readBytes(s,pos,len);
  845. pos += k;
  846. len -= k;
  847. }
  848. }
  849. ,read: function(nbytes) {
  850. var s = haxe.io.Bytes.alloc(nbytes);
  851. var p = 0;
  852. while(nbytes > 0) {
  853. var k = this.readBytes(s,p,nbytes);
  854. if(k == 0) throw haxe.io.Error.Blocked;
  855. p += k;
  856. nbytes -= k;
  857. }
  858. return s;
  859. }
  860. ,readInt32: function() {
  861. var ch1 = this.readByte();
  862. var ch2 = this.readByte();
  863. var ch3 = this.readByte();
  864. var ch4 = this.readByte();
  865. if(this.bigEndian) return ch4 | ch3 << 8 | ch2 << 16 | ch1 << 24; else return ch1 | ch2 << 8 | ch3 << 16 | ch4 << 24;
  866. }
  867. ,readString: function(len) {
  868. var b = haxe.io.Bytes.alloc(len);
  869. this.readFullBytes(b,0,len);
  870. return b.toString();
  871. }
  872. ,__class__: haxe.io.Input
  873. };
  874. haxe.io.BytesInput = function(b,pos,len) {
  875. if(pos == null) pos = 0;
  876. if(len == null) len = b.length - pos;
  877. if(pos < 0 || len < 0 || pos + len > b.length) throw haxe.io.Error.OutsideBounds;
  878. this.b = b.b;
  879. this.pos = pos;
  880. this.len = len;
  881. this.totlen = len;
  882. };
  883. haxe.io.BytesInput.__name__ = true;
  884. haxe.io.BytesInput.__super__ = haxe.io.Input;
  885. haxe.io.BytesInput.prototype = $extend(haxe.io.Input.prototype,{
  886. readByte: function() {
  887. if(this.len == 0) throw new haxe.io.Eof();
  888. this.len--;
  889. return this.b[this.pos++];
  890. }
  891. ,readBytes: function(buf,pos,len) {
  892. if(pos < 0 || len < 0 || pos + len > buf.length) throw haxe.io.Error.OutsideBounds;
  893. if(this.len == 0 && len > 0) throw new haxe.io.Eof();
  894. if(this.len < len) len = this.len;
  895. var b1 = this.b;
  896. var b2 = buf.b;
  897. var _g = 0;
  898. while(_g < len) {
  899. var i = _g++;
  900. b2[pos + i] = b1[this.pos + i];
  901. }
  902. this.pos += len;
  903. this.len -= len;
  904. return len;
  905. }
  906. ,__class__: haxe.io.BytesInput
  907. });
  908. haxe.io.Output = function() { };
  909. haxe.io.Output.__name__ = true;
  910. haxe.io.Output.prototype = {
  911. writeByte: function(c) {
  912. throw "Not implemented";
  913. }
  914. ,writeBytes: function(s,pos,len) {
  915. var k = len;
  916. var b = s.b;
  917. if(pos < 0 || len < 0 || pos + len > s.length) throw haxe.io.Error.OutsideBounds;
  918. while(k > 0) {
  919. this.writeByte(b[pos]);
  920. pos++;
  921. k--;
  922. }
  923. return len;
  924. }
  925. ,close: function() {
  926. }
  927. ,write: function(s) {
  928. var l = s.length;
  929. var p = 0;
  930. while(l > 0) {
  931. var k = this.writeBytes(s,p,l);
  932. if(k == 0) throw haxe.io.Error.Blocked;
  933. p += k;
  934. l -= k;
  935. }
  936. }
  937. ,writeFullBytes: function(s,pos,len) {
  938. while(len > 0) {
  939. var k = this.writeBytes(s,pos,len);
  940. pos += k;
  941. len -= k;
  942. }
  943. }
  944. ,writeInt32: function(x) {
  945. if(this.bigEndian) {
  946. this.writeByte(x >>> 24);
  947. this.writeByte(x >> 16 & 255);
  948. this.writeByte(x >> 8 & 255);
  949. this.writeByte(x & 255);
  950. } else {
  951. this.writeByte(x & 255);
  952. this.writeByte(x >> 8 & 255);
  953. this.writeByte(x >> 16 & 255);
  954. this.writeByte(x >>> 24);
  955. }
  956. }
  957. ,writeString: function(s) {
  958. var b = haxe.io.Bytes.ofString(s);
  959. this.writeFullBytes(b,0,b.length);
  960. }
  961. ,__class__: haxe.io.Output
  962. };
  963. haxe.io.BytesOutput = function() {
  964. this.b = new haxe.io.BytesBuffer();
  965. };
  966. haxe.io.BytesOutput.__name__ = true;
  967. haxe.io.BytesOutput.__super__ = haxe.io.Output;
  968. haxe.io.BytesOutput.prototype = $extend(haxe.io.Output.prototype,{
  969. writeByte: function(c) {
  970. this.b.b.push(c);
  971. }
  972. ,writeBytes: function(buf,pos,len) {
  973. this.b.addBytes(buf,pos,len);
  974. return len;
  975. }
  976. ,getBytes: function() {
  977. return this.b.getBytes();
  978. }
  979. ,__class__: haxe.io.BytesOutput
  980. });
  981. haxe.io.Eof = function() {
  982. };
  983. haxe.io.Eof.__name__ = true;
  984. haxe.io.Eof.prototype = {
  985. toString: function() {
  986. return "Eof";
  987. }
  988. ,__class__: haxe.io.Eof
  989. };
  990. haxe.io.Error = { __ename__ : true, __constructs__ : ["Blocked","Overflow","OutsideBounds","Custom"] };
  991. haxe.io.Error.Blocked = ["Blocked",0];
  992. haxe.io.Error.Blocked.toString = $estr;
  993. haxe.io.Error.Blocked.__enum__ = haxe.io.Error;
  994. haxe.io.Error.Overflow = ["Overflow",1];
  995. haxe.io.Error.Overflow.toString = $estr;
  996. haxe.io.Error.Overflow.__enum__ = haxe.io.Error;
  997. haxe.io.Error.OutsideBounds = ["OutsideBounds",2];
  998. haxe.io.Error.OutsideBounds.toString = $estr;
  999. haxe.io.Error.OutsideBounds.__enum__ = haxe.io.Error;
  1000. haxe.io.Error.Custom = function(e) { var $x = ["Custom",3,e]; $x.__enum__ = haxe.io.Error; $x.toString = $estr; return $x; };
  1001. haxe.xml = {};
  1002. haxe.xml._Fast = {};
  1003. haxe.xml._Fast.NodeAccess = function(x) {
  1004. this.__x = x;
  1005. };
  1006. haxe.xml._Fast.NodeAccess.__name__ = true;
  1007. haxe.xml._Fast.NodeAccess.prototype = {
  1008. __class__: haxe.xml._Fast.NodeAccess
  1009. };
  1010. haxe.xml._Fast.AttribAccess = function(x) {
  1011. this.__x = x;
  1012. };
  1013. haxe.xml._Fast.AttribAccess.__name__ = true;
  1014. haxe.xml._Fast.AttribAccess.prototype = {
  1015. resolve: function(name) {
  1016. if(this.__x.nodeType == Xml.Document) throw "Cannot access document attribute " + name;
  1017. var v = this.__x.get(name);
  1018. if(v == null) throw this.__x.get_nodeName() + " is missing attribute " + name;
  1019. return v;
  1020. }
  1021. ,__class__: haxe.xml._Fast.AttribAccess
  1022. };
  1023. haxe.xml._Fast.HasAttribAccess = function(x) {
  1024. this.__x = x;
  1025. };
  1026. haxe.xml._Fast.HasAttribAccess.__name__ = true;
  1027. haxe.xml._Fast.HasAttribAccess.prototype = {
  1028. resolve: function(name) {
  1029. if(this.__x.nodeType == Xml.Document) throw "Cannot access document attribute " + name;
  1030. return this.__x.exists(name);
  1031. }
  1032. ,__class__: haxe.xml._Fast.HasAttribAccess
  1033. };
  1034. haxe.xml._Fast.HasNodeAccess = function(x) {
  1035. this.__x = x;
  1036. };
  1037. haxe.xml._Fast.HasNodeAccess.__name__ = true;
  1038. haxe.xml._Fast.HasNodeAccess.prototype = {
  1039. __class__: haxe.xml._Fast.HasNodeAccess
  1040. };
  1041. haxe.xml._Fast.NodeListAccess = function(x) {
  1042. this.__x = x;
  1043. };
  1044. haxe.xml._Fast.NodeListAccess.__name__ = true;
  1045. haxe.xml._Fast.NodeListAccess.prototype = {
  1046. __class__: haxe.xml._Fast.NodeListAccess
  1047. };
  1048. haxe.xml.Fast = function(x) {
  1049. if(x.nodeType != Xml.Document && x.nodeType != Xml.Element) throw "Invalid nodeType " + Std.string(x.nodeType);
  1050. this.x = x;
  1051. this.node = new haxe.xml._Fast.NodeAccess(x);
  1052. this.nodes = new haxe.xml._Fast.NodeListAccess(x);
  1053. this.att = new haxe.xml._Fast.AttribAccess(x);
  1054. this.has = new haxe.xml._Fast.HasAttribAccess(x);
  1055. this.hasNode = new haxe.xml._Fast.HasNodeAccess(x);
  1056. };
  1057. haxe.xml.Fast.__name__ = true;
  1058. haxe.xml.Fast.prototype = {
  1059. __class__: haxe.xml.Fast
  1060. };
  1061. haxe.xml.Parser = function() { };
  1062. haxe.xml.Parser.__name__ = true;
  1063. haxe.xml.Parser.parse = function(str) {
  1064. var doc = Xml.createDocument();
  1065. haxe.xml.Parser.doParse(str,0,doc);
  1066. return doc;
  1067. };
  1068. haxe.xml.Parser.doParse = function(str,p,parent) {
  1069. if(p == null) p = 0;
  1070. var xml = null;
  1071. var state = 1;
  1072. var next = 1;
  1073. var aname = null;
  1074. var start = 0;
  1075. var nsubs = 0;
  1076. var nbrackets = 0;
  1077. var c = str.charCodeAt(p);
  1078. var buf = new StringBuf();
  1079. while(!(c != c)) {
  1080. switch(state) {
  1081. case 0:
  1082. switch(c) {
  1083. case 10:case 13:case 9:case 32:
  1084. break;
  1085. default:
  1086. state = next;
  1087. continue;
  1088. }
  1089. break;
  1090. case 1:
  1091. switch(c) {
  1092. case 60:
  1093. state = 0;
  1094. next = 2;
  1095. break;
  1096. default:
  1097. start = p;
  1098. state = 13;
  1099. continue;
  1100. }
  1101. break;
  1102. case 13:
  1103. if(c == 60) {
  1104. var child = Xml.createPCData(buf.b + HxOverrides.substr(str,start,p - start));
  1105. buf = new StringBuf();
  1106. parent.addChild(child);
  1107. nsubs++;
  1108. state = 0;
  1109. next = 2;
  1110. } else if(c == 38) {
  1111. buf.addSub(str,start,p - start);
  1112. state = 18;
  1113. next = 13;
  1114. start = p + 1;
  1115. }
  1116. break;
  1117. case 17:
  1118. if(c == 93 && str.charCodeAt(p + 1) == 93 && str.charCodeAt(p + 2) == 62) {
  1119. var child1 = Xml.createCData(HxOverrides.substr(str,start,p - start));
  1120. parent.addChild(child1);
  1121. nsubs++;
  1122. p += 2;
  1123. state = 1;
  1124. }
  1125. break;
  1126. case 2:
  1127. switch(c) {
  1128. case 33:
  1129. if(str.charCodeAt(p + 1) == 91) {
  1130. p += 2;
  1131. if(HxOverrides.substr(str,p,6).toUpperCase() != "CDATA[") throw "Expected <![CDATA[";
  1132. p += 5;
  1133. state = 17;
  1134. start = p + 1;
  1135. } else if(str.charCodeAt(p + 1) == 68 || str.charCodeAt(p + 1) == 100) {
  1136. if(HxOverrides.substr(str,p + 2,6).toUpperCase() != "OCTYPE") throw "Expected <!DOCTYPE";
  1137. p += 8;
  1138. state = 16;
  1139. start = p + 1;
  1140. } else if(str.charCodeAt(p + 1) != 45 || str.charCodeAt(p + 2) != 45) throw "Expected <!--"; else {
  1141. p += 2;
  1142. state = 15;
  1143. start = p + 1;
  1144. }
  1145. break;
  1146. case 63:
  1147. state = 14;
  1148. start = p;
  1149. break;
  1150. case 47:
  1151. if(parent == null) throw "Expected node name";
  1152. start = p + 1;
  1153. state = 0;
  1154. next = 10;
  1155. break;
  1156. default:
  1157. state = 3;
  1158. start = p;
  1159. continue;
  1160. }
  1161. break;
  1162. case 3:
  1163. if(!(c >= 97 && c <= 122 || c >= 65 && c <= 90 || c >= 48 && c <= 57 || c == 58 || c == 46 || c == 95 || c == 45)) {
  1164. if(p == start) throw "Expected node name";
  1165. xml = Xml.createElement(HxOverrides.substr(str,start,p - start));
  1166. parent.addChild(xml);
  1167. state = 0;
  1168. next = 4;
  1169. continue;
  1170. }
  1171. break;
  1172. case 4:
  1173. switch(c) {
  1174. case 47:
  1175. state = 11;
  1176. nsubs++;
  1177. break;
  1178. case 62:
  1179. state = 9;
  1180. nsubs++;
  1181. break;
  1182. default:
  1183. state = 5;
  1184. start = p;
  1185. continue;
  1186. }
  1187. break;
  1188. case 5:
  1189. if(!(c >= 97 && c <= 122 || c >= 65 && c <= 90 || c >= 48 && c <= 57 || c == 58 || c == 46 || c == 95 || c == 45)) {
  1190. var tmp;
  1191. if(start == p) throw "Expected attribute name";
  1192. tmp = HxOverrides.substr(str,start,p - start);
  1193. aname = tmp;
  1194. if(xml.exists(aname)) throw "Duplicate attribute";
  1195. state = 0;
  1196. next = 6;
  1197. continue;
  1198. }
  1199. break;
  1200. case 6:
  1201. switch(c) {
  1202. case 61:
  1203. state = 0;
  1204. next = 7;
  1205. break;
  1206. default:
  1207. throw "Expected =";
  1208. }
  1209. break;
  1210. case 7:
  1211. switch(c) {
  1212. case 34:case 39:
  1213. state = 8;
  1214. start = p;
  1215. break;
  1216. default:
  1217. throw "Expected \"";
  1218. }
  1219. break;
  1220. case 8:
  1221. if(c == str.charCodeAt(start)) {
  1222. var val = HxOverrides.substr(str,start + 1,p - start - 1);
  1223. xml.set(aname,val);
  1224. state = 0;
  1225. next = 4;
  1226. }
  1227. break;
  1228. case 9:
  1229. p = haxe.xml.Parser.doParse(str,p,xml);
  1230. start = p;
  1231. state = 1;
  1232. break;
  1233. case 11:
  1234. switch(c) {
  1235. case 62:
  1236. state = 1;
  1237. break;
  1238. default:
  1239. throw "Expected >";
  1240. }
  1241. break;
  1242. case 12:
  1243. switch(c) {
  1244. case 62:
  1245. if(nsubs == 0) parent.addChild(Xml.createPCData(""));
  1246. return p;
  1247. default:
  1248. throw "Expected >";
  1249. }
  1250. break;
  1251. case 10:
  1252. if(!(c >= 97 && c <= 122 || c >= 65 && c <= 90 || c >= 48 && c <= 57 || c == 58 || c == 46 || c == 95 || c == 45)) {
  1253. if(start == p) throw "Expected node name";
  1254. var v = HxOverrides.substr(str,start,p - start);
  1255. if(v != parent.get_nodeName()) throw "Expected </" + parent.get_nodeName() + ">";
  1256. state = 0;
  1257. next = 12;
  1258. continue;
  1259. }
  1260. break;
  1261. case 15:
  1262. if(c == 45 && str.charCodeAt(p + 1) == 45 && str.charCodeAt(p + 2) == 62) {
  1263. parent.addChild(Xml.createComment(HxOverrides.substr(str,start,p - start)));
  1264. p += 2;
  1265. state = 1;
  1266. }
  1267. break;
  1268. case 16:
  1269. if(c == 91) nbrackets++; else if(c == 93) nbrackets--; else if(c == 62 && nbrackets == 0) {
  1270. parent.addChild(Xml.createDocType(HxOverrides.substr(str,start,p - start)));
  1271. state = 1;
  1272. }
  1273. break;
  1274. case 14:
  1275. if(c == 63 && str.charCodeAt(p + 1) == 62) {
  1276. p++;
  1277. var str1 = HxOverrides.substr(str,start + 1,p - start - 2);
  1278. parent.addChild(Xml.createProcessingInstruction(str1));
  1279. state = 1;
  1280. }
  1281. break;
  1282. case 18:
  1283. if(c == 59) {
  1284. var s = HxOverrides.substr(str,start,p - start);
  1285. if(s.charCodeAt(0) == 35) {
  1286. var i;
  1287. if(s.charCodeAt(1) == 120) i = Std.parseInt("0" + HxOverrides.substr(s,1,s.length - 1)); else i = Std.parseInt(HxOverrides.substr(s,1,s.length - 1));
  1288. buf.add(String.fromCharCode(i));
  1289. } else if(!haxe.xml.Parser.escapes.exists(s)) buf.b += Std.string("&" + s + ";"); else buf.add(haxe.xml.Parser.escapes.get(s));
  1290. start = p + 1;
  1291. state = next;
  1292. }
  1293. break;
  1294. }
  1295. c = StringTools.fastCodeAt(str,++p);
  1296. }
  1297. if(state == 1) {
  1298. start = p;
  1299. state = 13;
  1300. }
  1301. if(state == 13) {
  1302. if(p != start || nsubs == 0) parent.addChild(Xml.createPCData(buf.b + HxOverrides.substr(str,start,p - start)));
  1303. return p;
  1304. }
  1305. throw "Unexpected end";
  1306. };
  1307. var js = {};
  1308. js.Boot = function() { };
  1309. js.Boot.__name__ = true;
  1310. js.Boot.__unhtml = function(s) {
  1311. return s.split("&").join("&amp;").split("<").join("&lt;").split(">").join("&gt;");
  1312. };
  1313. js.Boot.__trace = function(v,i) {
  1314. var msg;
  1315. if(i != null) msg = i.fileName + ":" + i.lineNumber + ": "; else msg = "";
  1316. msg += js.Boot.__string_rec(v,"");
  1317. if(i != null && i.customParams != null) {
  1318. var _g = 0;
  1319. var _g1 = i.customParams;
  1320. while(_g < _g1.length) {
  1321. var v1 = _g1[_g];
  1322. ++_g;
  1323. msg += "," + js.Boot.__string_rec(v1,"");
  1324. }
  1325. }
  1326. var d;
  1327. if(typeof(document) != "undefined" && (d = document.getElementById("haxe:trace")) != null) d.innerHTML += js.Boot.__unhtml(msg) + "<br/>"; else if(typeof console != "undefined" && console.log != null) console.log(msg);
  1328. };
  1329. js.Boot.getClass = function(o) {
  1330. if((o instanceof Array) && o.__enum__ == null) return Array; else {
  1331. var cl = o.__class__;
  1332. if(cl != null) return cl;
  1333. var name = js.Boot.__nativeClassName(o);
  1334. if(name != null) return js.Boot.__resolveNativeClass(name);
  1335. return null;
  1336. }
  1337. };
  1338. js.Boot.__string_rec = function(o,s) {
  1339. if(o == null) return "null";
  1340. if(s.length >= 5) return "<...>";
  1341. var t = typeof(o);
  1342. if(t == "function" && (o.__name__ || o.__ename__)) t = "object";
  1343. switch(t) {
  1344. case "object":
  1345. if(o instanceof Array) {
  1346. if(o.__enum__) {
  1347. if(o.length == 2) return o[0];
  1348. var str = o[0] + "(";
  1349. s += "\t";
  1350. var _g1 = 2;
  1351. var _g = o.length;
  1352. while(_g1 < _g) {
  1353. var i = _g1++;
  1354. if(i != 2) str += "," + js.Boot.__string_rec(o[i],s); else str += js.Boot.__string_rec(o[i],s);
  1355. }
  1356. return str + ")";
  1357. }
  1358. var l = o.length;
  1359. var i1;
  1360. var str1 = "[";
  1361. s += "\t";
  1362. var _g2 = 0;
  1363. while(_g2 < l) {
  1364. var i2 = _g2++;
  1365. str1 += (i2 > 0?",":"") + js.Boot.__string_rec(o[i2],s);
  1366. }
  1367. str1 += "]";
  1368. return str1;
  1369. }
  1370. var tostr;
  1371. try {
  1372. tostr = o.toString;
  1373. } catch( e ) {
  1374. return "???";
  1375. }
  1376. if(tostr != null && tostr != Object.toString) {
  1377. var s2 = o.toString();
  1378. if(s2 != "[object Object]") return s2;
  1379. }
  1380. var k = null;
  1381. var str2 = "{\n";
  1382. s += "\t";
  1383. var hasp = o.hasOwnProperty != null;
  1384. for( var k in o ) {
  1385. if(hasp && !o.hasOwnProperty(k)) {
  1386. continue;
  1387. }
  1388. if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") {
  1389. continue;
  1390. }
  1391. if(str2.length != 2) str2 += ", \n";
  1392. str2 += s + k + " : " + js.Boot.__string_rec(o[k],s);
  1393. }
  1394. s = s.substring(1);
  1395. str2 += "\n" + s + "}";
  1396. return str2;
  1397. case "function":
  1398. return "<function>";
  1399. case "string":
  1400. return o;
  1401. default:
  1402. return String(o);
  1403. }
  1404. };
  1405. js.Boot.__interfLoop = function(cc,cl) {
  1406. if(cc == null) return false;
  1407. if(cc == cl) return true;
  1408. var intf = cc.__interfaces__;
  1409. if(intf != null) {
  1410. var _g1 = 0;
  1411. var _g = intf.length;
  1412. while(_g1 < _g) {
  1413. var i = _g1++;
  1414. var i1 = intf[i];
  1415. if(i1 == cl || js.Boot.__interfLoop(i1,cl)) return true;
  1416. }
  1417. }
  1418. return js.Boot.__interfLoop(cc.__super__,cl);
  1419. };
  1420. js.Boot.__instanceof = function(o,cl) {
  1421. if(cl == null) return false;
  1422. switch(cl) {
  1423. case Int:
  1424. return (o|0) === o;
  1425. case Float:
  1426. return typeof(o) == "number";
  1427. case Bool:
  1428. return typeof(o) == "boolean";
  1429. case String:
  1430. return typeof(o) == "string";
  1431. case Array:
  1432. return (o instanceof Array) && o.__enum__ == null;
  1433. case Dynamic:
  1434. return true;
  1435. default:
  1436. if(o != null) {
  1437. if(typeof(cl) == "function") {
  1438. if(o instanceof cl) return true;
  1439. if(js.Boot.__interfLoop(js.Boot.getClass(o),cl)) return true;
  1440. } else if(typeof(cl) == "object" && js.Boot.__isNativeObj(cl)) {
  1441. if(o instanceof cl) return true;
  1442. }
  1443. } else return false;
  1444. if(cl == Class && o.__name__ != null) return true;
  1445. if(cl == Enum && o.__ename__ != null) return true;
  1446. return o.__enum__ == cl;
  1447. }
  1448. };
  1449. js.Boot.__nativeClassName = function(o) {
  1450. var name = js.Boot.__toStr.call(o).slice(8,-1);
  1451. if(name == "Object" || name == "Function" || name == "Math" || name == "JSON") return null;
  1452. return name;
  1453. };
  1454. js.Boot.__isNativeObj = function(o) {
  1455. return js.Boot.__nativeClassName(o) != null;
  1456. };
  1457. js.Boot.__resolveNativeClass = function(name) {
  1458. if(typeof window != "undefined") return window[name]; else return global[name];
  1459. };
  1460. js.NodeC = function() { };
  1461. js.NodeC.__name__ = true;
  1462. js.Node = function() { };
  1463. js.Node.__name__ = true;
  1464. js.Node.get_assert = function() {
  1465. return js.Node.require("assert");
  1466. };
  1467. js.Node.get_child_process = function() {
  1468. return js.Node.require("child_process");
  1469. };
  1470. js.Node.get_cluster = function() {
  1471. return js.Node.require("cluster");
  1472. };
  1473. js.Node.get_crypto = function() {
  1474. return js.Node.require("crypto");
  1475. };
  1476. js.Node.get_dgram = function() {
  1477. return js.Node.require("dgram");
  1478. };
  1479. js.Node.get_dns = function() {
  1480. return js.Node.require("dns");
  1481. };
  1482. js.Node.get_fs = function() {
  1483. return js.Node.require("fs");
  1484. };
  1485. js.Node.get_http = function() {
  1486. return js.Node.require("http");
  1487. };
  1488. js.Node.get_https = function() {
  1489. return js.Node.require("https");
  1490. };
  1491. js.Node.get_net = function() {
  1492. return js.Node.require("net");
  1493. };
  1494. js.Node.get_os = function() {
  1495. return js.Node.require("os");
  1496. };
  1497. js.Node.get_path = function() {
  1498. return js.Node.require("path");
  1499. };
  1500. js.Node.get_querystring = function() {
  1501. return js.Node.require("querystring");
  1502. };
  1503. js.Node.get_repl = function() {
  1504. return js.Node.require("repl");
  1505. };
  1506. js.Node.get_tls = function() {
  1507. return js.Node.require("tls");
  1508. };
  1509. js.Node.get_url = function() {
  1510. return js.Node.require("url");
  1511. };
  1512. js.Node.get_util = function() {
  1513. return js.Node.require("util");
  1514. };
  1515. js.Node.get_vm = function() {
  1516. return js.Node.require("vm");
  1517. };
  1518. js.Node.get_zlib = function() {
  1519. return js.Node.require("zlib");
  1520. };
  1521. js.Node.get___filename = function() {
  1522. return __filename;
  1523. };
  1524. js.Node.get___dirname = function() {
  1525. return __dirname;
  1526. };
  1527. js.Node.get_json = function() {
  1528. return JSON;
  1529. };
  1530. js.Node.newSocket = function(options) {
  1531. return new js.Node.net.Socket(options);
  1532. };
  1533. var pony = {};
  1534. pony._Byte = {};
  1535. pony._Byte.Byte_Impl_ = function() { };
  1536. pony._Byte.Byte_Impl_.__name__ = true;
  1537. pony._Byte.Byte_Impl_.get_a = function(this1) {
  1538. return this1 >> 4;
  1539. };
  1540. pony._Byte.Byte_Impl_.get_b = function(this1) {
  1541. return this1 & 15;
  1542. };
  1543. pony._Byte.Byte_Impl_.create = function(a,b) {
  1544. return (a << 4) + b;
  1545. };
  1546. pony._Byte.Byte_Impl_.chechSumWith = function(this1,b) {
  1547. return this1 + b & 255;
  1548. };
  1549. pony._Byte.Byte_Impl_.toString = function(this1) {
  1550. return "0x" + StringTools.hex(this1);
  1551. };
  1552. pony.Dictionary = function(maxDepth) {
  1553. if(maxDepth == null) maxDepth = 1;
  1554. this.maxDepth = maxDepth;
  1555. this.ks = [];
  1556. this.vs = [];
  1557. };
  1558. pony.Dictionary.__name__ = true;
  1559. pony.Dictionary.prototype = {
  1560. getIndex: function(k) {
  1561. return pony.Tools.superIndexOf(this.ks,k,this.maxDepth);
  1562. }
  1563. ,set: function(k,v) {
  1564. var i = pony.Tools.superIndexOf(this.ks,k,this.maxDepth);
  1565. if(i != -1) {
  1566. this.vs[i] = v;
  1567. return i;
  1568. } else {
  1569. this.ks.push(k);
  1570. return this.vs.push(v);
  1571. }
  1572. }
  1573. ,get: function(k) {
  1574. var i = pony.Tools.superIndexOf(this.ks,k,this.maxDepth);
  1575. if(i == -1) return null; else return this.vs[i];
  1576. }
  1577. ,exists: function(k) {
  1578. return pony.Tools.superIndexOf(this.ks,k,this.maxDepth) != -1;
  1579. }
  1580. ,remove: function(k) {
  1581. var i = pony.Tools.superIndexOf(this.ks,k,this.maxDepth);
  1582. if(i != -1) {
  1583. this.ks.splice(i,1);
  1584. this.vs.splice(i,1);
  1585. return true;
  1586. } else return false;
  1587. }
  1588. ,removeIndex: function(i) {
  1589. this.ks.splice(i,1);
  1590. this.vs.splice(i,1);
  1591. }
  1592. ,clear: function() {
  1593. this.ks = [];
  1594. this.vs = [];
  1595. }
  1596. ,iterator: function() {
  1597. return HxOverrides.iter(this.vs);
  1598. }
  1599. ,keys: function() {
  1600. return HxOverrides.iter(this.ks);
  1601. }
  1602. ,toString: function() {
  1603. var a = [];
  1604. var $it0 = HxOverrides.iter(this.ks);
  1605. while( $it0.hasNext() ) {
  1606. var k = $it0.next();
  1607. a.push(Std.string(k) + ": " + Std.string(this.get(k)));
  1608. }
  1609. return "[" + a.join(", ") + "]";
  1610. }
  1611. ,removeValue: function(v) {
  1612. var i = HxOverrides.indexOf(this.vs,v,0);
  1613. if(i != -1) {
  1614. this.ks.splice(i,1);
  1615. this.vs.splice(i,1);
  1616. }
  1617. }
  1618. ,getKey: function(v) {
  1619. var i = HxOverrides.indexOf(this.vs,v,0);
  1620. if(i == -1) return null;
  1621. return this.ks[i];
  1622. }
  1623. ,getValueIndex: function(v) {
  1624. return HxOverrides.indexOf(this.vs,v,0);
  1625. }
  1626. ,get_count: function() {
  1627. return this.ks.length;
  1628. }
  1629. ,__class__: pony.Dictionary
  1630. };
  1631. pony._Function = {};
  1632. pony._Function.Function_Impl_ = function() { };
  1633. pony._Function.Function_Impl_.__name__ = true;
  1634. pony._Function.Function_Impl_._new = function(f,count,args,ret,event) {
  1635. if(event == null) event = false;
  1636. if(ret == null) ret = true;
  1637. var this1;
  1638. pony._Function.Function_Impl_.counter++;
  1639. if(pony._Function.Function_Impl_.searchFree) while(true) {
  1640. var $it0 = HxOverrides.iter(pony._Function.Function_Impl_.list.vs);
  1641. while( $it0.hasNext() ) {
  1642. var e = $it0.next();
  1643. if(e.id != pony._Function.Function_Impl_.counter) break;
  1644. }
  1645. pony._Function.Function_Impl_.counter++;
  1646. } else if(pony._Function.Function_Impl_.counter == -1) pony._Function.Function_Impl_.searchFree = true;
  1647. this1 = { f : f, count : count, args : args == null?[]:args, id : pony._Function.Function_Impl_.counter, used : 0, event : event, ret : ret};
  1648. return this1;
  1649. };
  1650. pony._Function.Function_Impl_.from = function(f,argc,ret,event) {
  1651. if(event == null) event = false;
  1652. if(ret == null) ret = true;
  1653. if(pony._Function.Function_Impl_.list.exists(f)) return pony._Function.Function_Impl_.list.get(f); else {
  1654. pony._Function.Function_Impl_.unusedCount++;
  1655. var o = pony._Function.Function_Impl_._new(f,argc,null,ret,event);
  1656. pony._Function.Function_Impl_.list.set(f,o);
  1657. return o;
  1658. }
  1659. };
  1660. pony._Function.Function_Impl_.fromEventR = function(f) {
  1661. return pony._Function.Function_Impl_.from(f,1,true,true);
  1662. };
  1663. pony._Function.Function_Impl_.fromEvent = function(f) {
  1664. return pony._Function.Function_Impl_.from(f,1,false,true);
  1665. };
  1666. pony._Function.Function_Impl_.from0r = function(f) {
  1667. return pony._Function.Function_Impl_.from(f,0);
  1668. };
  1669. pony._Function.Function_Impl_.from1r = function(f) {
  1670. return pony._Function.Function_Impl_.from(f,1);
  1671. };
  1672. pony._Function.Function_Impl_.from2r = function(f) {
  1673. return pony._Function.Function_Impl_.from(f,2);
  1674. };
  1675. pony._Function.Function_Impl_.from3r = function(f) {
  1676. return pony._Function.Function_Impl_.from(f,3);
  1677. };
  1678. pony._Function.Function_Impl_.from4r = function(f) {
  1679. return pony._Function.Function_Impl_.from(f,4);
  1680. };
  1681. pony._Function.Function_Impl_.from5r = function(f) {
  1682. return pony._Function.Function_Impl_.from(f,5);
  1683. };
  1684. pony._Function.Function_Impl_.from6r = function(f) {
  1685. return pony._Function.Function_Impl_.from(f,6);
  1686. };
  1687. pony._Function.Function_Impl_.from7r = function(f) {
  1688. return pony._Function.Function_Impl_.from(f,7);
  1689. };
  1690. pony._Function.Function_Impl_.from0 = function(f) {
  1691. return pony._Function.Function_Impl_.from(f,0,false);
  1692. };
  1693. pony._Function.Function_Impl_.from1 = function(f) {
  1694. return pony._Function.Function_Impl_.from(f,1,false);
  1695. };
  1696. pony._Function.Function_Impl_.from2 = function(f) {
  1697. return pony._Function.Function_Impl_.from(f,2,false);
  1698. };
  1699. pony._Function.Function_Impl_.from3 = function(f) {
  1700. return pony._Function.Function_Impl_.from(f,3,false);
  1701. };
  1702. pony._Function.Function_Impl_.from4 = function(f) {
  1703. return pony._Function.Function_Impl_.from(f,4,false);
  1704. };
  1705. pony._Function.Function_Impl_.from5 = function(f) {
  1706. return pony._Function.Function_Impl_.from(f,5,false);
  1707. };
  1708. pony._Function.Function_Impl_.from6 = function(f) {
  1709. return pony._Function.Function_Impl_.from(f,6,false);
  1710. };
  1711. pony._Function.Function_Impl_.from7 = function(f) {
  1712. return pony._Function.Function_Impl_.from(f,7,false);
  1713. };
  1714. pony._Function.Function_Impl_.call = function(this1,args) {
  1715. if(args == null) args = [];
  1716. return Reflect.callMethod(null,this1.f,this1.args.concat(args));
  1717. };
  1718. pony._Function.Function_Impl_.get_id = function(this1) {
  1719. return this1.id;
  1720. };
  1721. pony._Function.Function_Impl_.get_count = function(this1) {
  1722. return this1.count;
  1723. };
  1724. pony._Function.Function_Impl_._setArgs = function(this1,args) {
  1725. this1.count -= args.length;
  1726. this1.args = this1.args.concat(args);
  1727. };
  1728. pony._Function.Function_Impl_._use = function(this1) {
  1729. this1.used++;
  1730. };
  1731. pony._Function.Function_Impl_.unuse = function(this1) {
  1732. this1.used--;
  1733. if(this1.used <= 0) {
  1734. pony._Function.Function_Impl_.list.remove(this1.f);
  1735. this1 = null;
  1736. pony._Function.Function_Impl_.unusedCount--;
  1737. }
  1738. };
  1739. pony._Function.Function_Impl_.get_used = function(this1) {
  1740. return this1.used;
  1741. };
  1742. pony._Function.Function_Impl_.get_event = function(this1) {
  1743. return this1.event;
  1744. };
  1745. pony._Function.Function_Impl_.get_ret = function(this1) {
  1746. return this1.ret;
  1747. };
  1748. pony.IEvent = function() { };
  1749. pony.IEvent.__name__ = true;
  1750. pony.ILogable = function() { };
  1751. pony.ILogable.__name__ = true;
  1752. pony.ILogable.prototype = {
  1753. __class__: pony.ILogable
  1754. };
  1755. pony._KeyValue = {};
  1756. pony._KeyValue.KeyValue_Impl_ = function() { };
  1757. pony._KeyValue.KeyValue_Impl_.__name__ = true;
  1758. pony._KeyValue.KeyValue_Impl_._new = function(p) {
  1759. return p;
  1760. };
  1761. pony._KeyValue.KeyValue_Impl_.get_key = function(this1) {
  1762. return this1.a;
  1763. };
  1764. pony._KeyValue.KeyValue_Impl_.get_value = function(this1) {
  1765. return this1.b;
  1766. };
  1767. pony._KeyValue.KeyValue_Impl_.fromPair = function(p) {
  1768. return p;
  1769. };
  1770. pony._KeyValue.KeyValue_Impl_.toPair = function(this1) {
  1771. return this1;
  1772. };
  1773. pony.Logable = function() {
  1774. var this1 = pony.events.Signal.create(this);
  1775. this.log = this1;
  1776. var this2 = pony.events.Signal.create(this);
  1777. this.error = this2;
  1778. };
  1779. pony.Logable.__name__ = true;
  1780. pony.Logable.__interfaces__ = [pony.ILogable];
  1781. pony.Logable.prototype = {
  1782. _error: function(s,p) {
  1783. pony.events._Signal2.Signal2_Impl_.dispatch(this.error,s,p);
  1784. }
  1785. ,_log: function(s,p) {
  1786. pony.events._Signal2.Signal2_Impl_.dispatch(this.log,s,p);
  1787. }
  1788. ,__class__: pony.Logable
  1789. };
  1790. pony._Pair = {};
  1791. pony._Pair.Pair_Impl_ = function() { };
  1792. pony._Pair.Pair_Impl_.__name__ = true;
  1793. pony._Pair.Pair_Impl_._new = function(a,b) {
  1794. return { a : a, b : b};
  1795. };
  1796. pony._Pair.Pair_Impl_.get_a = function(this1) {
  1797. return this1.a;
  1798. };
  1799. pony._Pair.Pair_Impl_.get_b = function(this1) {
  1800. return this1.b;
  1801. };
  1802. pony._Pair.Pair_Impl_.set_a = function(this1,v) {
  1803. return this1.a = v;
  1804. };
  1805. pony._Pair.Pair_Impl_.set_b = function(this1,v) {
  1806. return this1.b = v;
  1807. };
  1808. pony._Pair.Pair_Impl_.fromObj = function(o) {
  1809. return o;
  1810. };
  1811. pony._Pair.Pair_Impl_.toObj = function(this1) {
  1812. return this1;
  1813. };
  1814. pony._Pair.Pair_Impl_.array = function(a) {
  1815. return { a : a[0], b : a[1]};
  1816. };
  1817. pony.Priority = function(data) {
  1818. this["double"] = false;
  1819. this.clear();
  1820. if(data != null) {
  1821. var _g = 0;
  1822. while(_g < data.length) {
  1823. var e = data[_g];
  1824. ++_g;
  1825. this.addElement(e);
  1826. }
  1827. }
  1828. };
  1829. pony.Priority.__name__ = true;
  1830. pony.Priority.createIds = function(a) {
  1831. var i = 0;
  1832. return new pony.Priority((function($this) {
  1833. var $r;
  1834. var _g = [];
  1835. {
  1836. var _g1 = 0;
  1837. while(_g1 < a.length) {
  1838. var e = a[_g1];
  1839. ++_g1;
  1840. _g.push({ id : i++, name : e});
  1841. }
  1842. }
  1843. $r = _g;
  1844. return $r;
  1845. }(this)));
  1846. };
  1847. pony.Priority.prototype = {
  1848. addElement: function(e,priority) {
  1849. if(priority == null) priority = 0;
  1850. if(!this["double"] && this.existsElement(e)) return this;
  1851. var s;
  1852. if(this.hash.exists(priority)) s = this.hash.get(priority); else s = 0;
  1853. var c = 0;
  1854. var $it0 = this.hash.keys();
  1855. while( $it0.hasNext() ) {
  1856. var k = $it0.next();
  1857. if(k < priority) c += this.hash.get(k);
  1858. }
  1859. c += s;
  1860. this.data.splice(c,0,e);
  1861. var _g1 = 0;
  1862. var _g = this.counters.length;
  1863. while(_g1 < _g) {
  1864. var k1 = _g1++;
  1865. if(c < this.counters[k1]) this.counters[k1]++;
  1866. }
  1867. this.hash.set(priority,s + 1);
  1868. return this;
  1869. }
  1870. ,addArray: function(a,priority) {
  1871. if(priority == null) priority = 0;
  1872. var _g = 0;
  1873. while(_g < a.length) {
  1874. var e = a[_g];
  1875. ++_g;
  1876. this.addElement(e,priority);
  1877. }
  1878. return this;
  1879. }
  1880. ,iterator: function() {
  1881. var _g = this;
  1882. var n = this.counters.push(0) - 1;
  1883. return { hasNext : function() {
  1884. if(_g.counters.length < n) _g.counters.push(n);
  1885. if(_g.data[_g.counters[n]] != null) return true; else {
  1886. _g.counters.splice(n,1);
  1887. return false;
  1888. }
  1889. }, next : function() {
  1890. return _g.data[_g.counters[n]++];
  1891. }};
  1892. }
  1893. ,clear: function() {
  1894. this.hash = new haxe.ds.IntMap();
  1895. this.data = new Array();
  1896. this.counters = [0];
  1897. return this;
  1898. }
  1899. ,destroy: function() {
  1900. this.hash = null;
  1901. this.data = null;
  1902. this.counters = null;
  1903. }
  1904. ,existsElement: function(element) {
  1905. return Lambda.exists(this.data,function(e) {
  1906. return e == element;
  1907. });
  1908. }
  1909. ,existsFunction: function(f) {
  1910. return Lambda.exists(this.data,f);
  1911. }
  1912. ,existsArray: function(a) {
  1913. var _g = 0;
  1914. while(_g < a.length) {
  1915. var e = a[_g];
  1916. ++_g;
  1917. if(this.existsElement(e)) return true;
  1918. }
  1919. return false;
  1920. }
  1921. ,search: function(f) {
  1922. var s = null;
  1923. Lambda.exists(this.data,function(e) {
  1924. if(f(e)) {
  1925. s = e;
  1926. return true;
  1927. } else return false;
  1928. });
  1929. return s;
  1930. }
  1931. ,removeElement: function(e) {
  1932. var i = HxOverrides.indexOf(this.data,e,0);
  1933. if(i == -1) return false;
  1934. var _g1 = 0;
  1935. var _g = this.counters.length;
  1936. while(_g1 < _g) {
  1937. var k = _g1++;
  1938. if(i < this.counters[k]) this.counters[k]--;
  1939. }
  1940. HxOverrides.remove(this.data,e);
  1941. var a = [];
  1942. var $it0 = this.hash.keys();
  1943. while( $it0.hasNext() ) {
  1944. var k1 = $it0.next();
  1945. a.push(k1);
  1946. }
  1947. a.sort(function(x,y) {
  1948. return x - y;
  1949. });
  1950. var _g2 = 0;
  1951. while(_g2 < a.length) {
  1952. var k2 = a[_g2];
  1953. ++_g2;
  1954. if(i > 0) i -= this.hash.get(k2); else {
  1955. var value = this.hash.get(k2) - 1;
  1956. this.hash.set(k2,value);
  1957. break;
  1958. }
  1959. }
  1960. if(this["double"]) this.removeElement(e);
  1961. return true;
  1962. }
  1963. ,removeFunction: function(f) {
  1964. var e = this.search(f);
  1965. if(e != null) return this.removeElement(e); else return false;
  1966. }
  1967. ,removeArray: function(a) {
  1968. var f = true;
  1969. var _g = 0;
  1970. while(_g < a.length) {
  1971. var e = a[_g];
  1972. ++_g;
  1973. if(!this.removeElement(e)) f = false;
  1974. }
  1975. return f;
  1976. }
  1977. ,repriority: function(priority) {
  1978. if(priority == null) priority = 0;
  1979. this.hash = new haxe.ds.IntMap();
  1980. this.hash.set(priority,this.data.length);
  1981. }
  1982. ,changeElement: function(e,priority) {
  1983. if(priority == null) priority = 0;
  1984. if(this.removeElement(e)) this.addElement(e,priority); else throw "Element not exists";
  1985. return this;
  1986. }
  1987. ,changeFunction: function(f,priority) {
  1988. if(priority == null) priority = 0;
  1989. var e = this.search(f);
  1990. return this.changeElement(e,priority);
  1991. }
  1992. ,changeArray: function(a,priority) {
  1993. if(priority == null) priority = 0;
  1994. var _g = 0;
  1995. while(_g < a.length) {
  1996. var e = a[_g];
  1997. ++_g;
  1998. this.changeElement(e,priority);
  1999. }
  2000. return this;
  2001. }
  2002. ,toString: function() {
  2003. return this.data.toString();
  2004. }
  2005. ,join: function(sep) {
  2006. return this.data.join(sep);
  2007. }
  2008. ,get_first: function() {
  2009. return this.data[0];
  2010. }
  2011. ,get_last: function() {
  2012. return this.data[this.data.length - 1];
  2013. }
  2014. ,get_length: function() {
  2015. return this.data.length;
  2016. }
  2017. ,get_empty: function() {
  2018. return this.data.length == 0;
  2019. }
  2020. ,loop: function() {
  2021. if(this.counters[0] >= this.data.length) {
  2022. this.counters[0] = 0;
  2023. if(this.data.length == 0) return null;
  2024. }
  2025. return this.data[this.counters[0]++];
  2026. }
  2027. ,resetLoop: function() {
  2028. this.counters[0] = 0;
  2029. return this;
  2030. }
  2031. ,reloop: function(e) {
  2032. while(this.loop() != e) null;
  2033. }
  2034. ,get_current: function() {
  2035. if(this.counters[0] > this.data.length) return this.data[0]; else if(this.counters[0] < 1) return this.data[this.data.length - 1]; else return this.data[this.counters[0] - 1];
  2036. }
  2037. ,backLoop: function() {
  2038. if(this.data.length == 0) {
  2039. this.counters[0] = 0;
  2040. return null;
  2041. }
  2042. this.counters[0]--;
  2043. if(this.counters[0] < 1) this.counters[0] = this.data.length;
  2044. return this.data[this.counters[0] - 1];
  2045. }
  2046. ,get_min: function() {
  2047. var n = null;
  2048. var $it0 = this.hash.keys();
  2049. while( $it0.hasNext() ) {
  2050. var k = $it0.next();
  2051. if(n == null || k < n) n = k;
  2052. }
  2053. return n;
  2054. }
  2055. ,get_max: function() {
  2056. var n = null;
  2057. var $it0 = this.hash.keys();
  2058. while( $it0.hasNext() ) {
  2059. var k = $it0.next();
  2060. if(n == null || k > n) n = k;
  2061. }
  2062. return n;
  2063. }
  2064. ,addElementToBegin: function(e) {
  2065. this.addElement(e,this.get_min() - 1);
  2066. }
  2067. ,addElementToEnd: function(e) {
  2068. this.addElement(e,this.get_max() + 1);
  2069. }
  2070. ,__class__: pony.Priority
  2071. };
  2072. pony.Queue = function(method) {
  2073. this.busy = false;
  2074. this.method = method;
  2075. this.list = new List();
  2076. this.call = Reflect.makeVarArgs($bind(this,this._call));
  2077. };
  2078. pony.Queue.__name__ = true;
  2079. pony.Queue.prototype = {
  2080. _call: function(a) {
  2081. if(!this.busy) {
  2082. this.method.apply(null,a);
  2083. this.busy = true;
  2084. } else this.list.add(a);
  2085. }
  2086. ,next: function() {
  2087. if(this.list.length > 0) Reflect.callMethod(null,this.method,this.list.pop()); else this.busy = false;
  2088. }
  2089. ,__class__: pony.Queue
  2090. };
  2091. pony.Tools = function() { };
  2092. pony.Tools.__name__ = true;
  2093. pony.Tools.nore = function(v) {
  2094. return v == null || v.length == 0;
  2095. };
  2096. pony.Tools.or = function(v1,v2) {
  2097. if(v1 == null) return v2; else return v1;
  2098. };
  2099. pony.Tools.equal = function(a,b,maxDepth) {
  2100. if(maxDepth == null) maxDepth = 1;
  2101. if(a == b) return true;
  2102. if(maxDepth == 0) return false;
  2103. var type = Type["typeof"](a);
  2104. switch(type[1]) {
  2105. case 1:case 2:case 3:case 0:
  2106. return false;
  2107. case 5:
  2108. try {
  2109. return Reflect.compareMethods(a,b);
  2110. } catch( _ ) {
  2111. return false;
  2112. }
  2113. break;
  2114. case 7:
  2115. var t = type[2];
  2116. if(t != Type.getEnum(b)) return false;
  2117. if(Type.enumIndex(a) != Type.enumIndex(b)) return false;
  2118. var a1 = Type.enumParameters(a);
  2119. var b1 = Type.enumParameters(b);
  2120. if(a1.length != b1.length) return false;
  2121. var _g1 = 0;
  2122. var _g = a1.length;
  2123. while(_g1 < _g) {
  2124. var i = _g1++;
  2125. if(!pony.Tools.equal(a1[i],b1[i],maxDepth - 1)) return false;
  2126. }
  2127. return true;
  2128. case 4:
  2129. if(js.Boot.__instanceof(a,Class)) return false;
  2130. break;
  2131. case 8:
  2132. break;
  2133. case 6:
  2134. var t1 = type[2];
  2135. if(t1 == Array) {
  2136. if(!((b instanceof Array) && b.__enum__ == null)) return false;
  2137. if(a.length != b.length) return false;
  2138. var _g11 = 0;
  2139. var _g2 = a.length;
  2140. while(_g11 < _g2) {
  2141. var i1 = _g11++;
  2142. if(!pony.Tools.equal(a[i1],b[i1],maxDepth - 1)) return false;
  2143. }
  2144. return true;
  2145. }
  2146. break;
  2147. }
  2148. {
  2149. var _g3 = Type["typeof"](b);
  2150. switch(_g3[1]) {
  2151. case 1:case 2:case 3:case 5:case 7:case 0:
  2152. return false;
  2153. case 4:
  2154. if(js.Boot.__instanceof(b,Class)) return false;
  2155. break;
  2156. case 6:
  2157. var t2 = _g3[2];
  2158. if(t2 == Array) return false;
  2159. break;
  2160. case 8:
  2161. break;
  2162. }
  2163. }
  2164. var fields = Reflect.fields(a);
  2165. if(fields.length == Reflect.fields(b).length) {
  2166. if(fields.length == 0) return true;
  2167. var _g4 = 0;
  2168. while(_g4 < fields.length) {
  2169. var f = fields[_g4];
  2170. ++_g4;
  2171. if(!Object.prototype.hasOwnProperty.call(b,f) || !pony.Tools.equal(Reflect.field(a,f),Reflect.field(b,f),maxDepth - 1)) return false;
  2172. }
  2173. return true;
  2174. }
  2175. return false;
  2176. };
  2177. pony.Tools.superIndexOf = function(it,v,maxDepth) {
  2178. if(maxDepth == null) maxDepth = 1;
  2179. var i = 0;
  2180. var $it0 = $iterator(it)();
  2181. while( $it0.hasNext() ) {
  2182. var e = $it0.next();
  2183. if(pony.Tools.equal(e,v,maxDepth)) return i;
  2184. i++;
  2185. }
  2186. return -1;
  2187. };
  2188. pony.Tools.superMultyIndexOf = function(it,av,maxDepth) {
  2189. if(maxDepth == null) maxDepth = 1;
  2190. var i = 0;
  2191. var $it0 = $iterator(it)();
  2192. while( $it0.hasNext() ) {
  2193. var e = $it0.next();
  2194. var _g = 0;
  2195. while(_g < av.length) {
  2196. var v = av[_g];
  2197. ++_g;
  2198. if(pony.Tools.equal(e,v,maxDepth)) return i;
  2199. }
  2200. i++;
  2201. }
  2202. return -1;
  2203. };
  2204. pony.Tools.multyIndexOf = function(it,av) {
  2205. var i = 0;
  2206. var $it0 = $iterator(it)();
  2207. while( $it0.hasNext() ) {
  2208. var e = $it0.next();
  2209. var _g = 0;
  2210. while(_g < av.length) {
  2211. var v = av[_g];
  2212. ++_g;
  2213. if(e == v) return i;
  2214. }
  2215. i++;
  2216. }
  2217. return -1;
  2218. };
  2219. pony.Tools.cut = function(inp) {
  2220. var out = new haxe.io.BytesOutput();
  2221. var cntNull = 0;
  2222. var flagNull = true;
  2223. var cur = -99;
  2224. while(true) {
  2225. try {
  2226. cur = inp.readByte();
  2227. } catch( _ ) {
  2228. break;
  2229. }
  2230. if(cur == 0) {
  2231. if(!flagNull) flagNull = true;
  2232. cntNull++;
  2233. } else {
  2234. if(flagNull) while(cntNull-- > 0) out.writeByte(0);
  2235. flagNull = false;
  2236. out.writeByte(cur);
  2237. }
  2238. }
  2239. out.close();
  2240. return new haxe.io.BytesInput(out.getBytes());
  2241. };
  2242. pony.Tools.exists = function(a,e) {
  2243. return Lambda.indexOf(a,e) != -1;
  2244. };
  2245. pony.Tools.bytesIterator = function(b) {
  2246. var i = 0;
  2247. return { hasNext : function() {
  2248. return i < b.length;
  2249. }, next : function() {
  2250. return b.get(i++);
  2251. }};
  2252. };
  2253. pony.Tools.bytesInputIterator = function(b) {
  2254. var i = 0;
  2255. return { hasNext : function() {
  2256. return b.pos < b.totlen;
  2257. }, next : function() {
  2258. return b.readByte();
  2259. }};
  2260. };
  2261. pony.Tools.setFields = function(a,b) {
  2262. var _g = 0;
  2263. var _g1 = Reflect.fields(b);
  2264. while(_g < _g1.length) {
  2265. var p = _g1[_g];
  2266. ++_g;
  2267. var d = Reflect.field(b,p);
  2268. if(Reflect.isObject(d) && !(typeof(d) == "string")) pony.Tools.setFields(Reflect.field(a,p),d); else a[p] = d;
  2269. }
  2270. };
  2271. pony.Tools.copyFields = function(a,b) {
  2272. var _g = 0;
  2273. var _g1 = Reflect.fields(b);
  2274. while(_g < _g1.length) {
  2275. var p = _g1[_g];
  2276. ++_g;
  2277. Reflect.setField(a,p,Reflect.field(b,p));
  2278. }
  2279. };
  2280. pony.Tools.parsePrefixObjects = function(a,delimiter) {
  2281. if(delimiter == null) delimiter = "_";
  2282. var result = { };
  2283. var _g = 0;
  2284. var _g1 = Reflect.fields(a);
  2285. while(_g < _g1.length) {
  2286. var f = _g1[_g];
  2287. ++_g;
  2288. var d = f.split(delimiter);
  2289. var obj = result;
  2290. var _g3 = 0;
  2291. var _g2 = d.length - 1;
  2292. while(_g3 < _g2) {
  2293. var i = _g3++;
  2294. if(Object.prototype.hasOwnProperty.call(obj,d[i])) obj = Reflect.field(obj,d[i]); else {
  2295. var newObj = { };
  2296. obj[d[i]] = newObj;
  2297. obj = newObj;
  2298. }
  2299. }
  2300. Reflect.setField(obj,d.pop(),Reflect.field(a,f));
  2301. }
  2302. return result;
  2303. };
  2304. pony.Tools.convertObject = function(a,fun) {
  2305. var result = { };
  2306. var _g = 0;
  2307. var _g1 = Reflect.fields(a);
  2308. while(_g < _g1.length) {
  2309. var p = _g1[_g];
  2310. ++_g;
  2311. var d = Reflect.field(a,p);
  2312. if(Reflect.isObject(d) && !(typeof(d) == "string")) Reflect.setField(result,p,pony.Tools.convertObject(d,fun)); else Reflect.setField(result,p,fun(d));
  2313. }
  2314. return result;
  2315. };
  2316. pony.Tools.traceThrow = function(e) {
  2317. haxe.Log.trace(e,null);
  2318. haxe.Log.trace(haxe.CallStack.toString(haxe.CallStack.exceptionStack()),null);
  2319. };
  2320. pony.Tools.writeStr = function(b,s) {
  2321. b.writeInt32(s.length);
  2322. b.writeString(s);
  2323. };
  2324. pony.Tools.readStr = function(b) {
  2325. try {
  2326. return b.readString(b.readInt32());
  2327. } catch( _ ) {
  2328. return null;
  2329. }
  2330. };
  2331. pony.Tools.reverse = function(map) {
  2332. var _g = new haxe.ds.EnumValueMap();
  2333. var $it0 = map.keys();
  2334. while( $it0.hasNext() ) {
  2335. var k = $it0.next();
  2336. var key = map.get(k);
  2337. _g.set(key,k);
  2338. }
  2339. return _g;
  2340. };
  2341. pony.Tools.min = function(it) {
  2342. return Reflect.field(it,"min");
  2343. };
  2344. pony.Tools.max = function(it) {
  2345. return Reflect.field(it,"max");
  2346. };
  2347. pony.Tools.copy = function(it) {
  2348. return new IntIterator(Reflect.field(it,"min"),Reflect.field(it,"max"));
  2349. };
  2350. pony.Tools.nullFunction0 = function() {
  2351. return;
  2352. };
  2353. pony.Tools.nullFunction1 = function(_) {
  2354. return;
  2355. };
  2356. pony.Tools.nullFunction2 = function(_,_1) {
  2357. return;
  2358. };
  2359. pony.Tools.nullFunction3 = function(_,_1,_2) {
  2360. return;
  2361. };
  2362. pony.Tools.nullFunction4 = function(_,_1,_2,_3) {
  2363. return;
  2364. };
  2365. pony.Tools.nullFunction5 = function(_,_1,_2,_3,_4) {
  2366. return;
  2367. };
  2368. pony.Tools.errorFunction = function(e) {
  2369. throw e;
  2370. };
  2371. pony.ArrayTools = function() { };
  2372. pony.ArrayTools.__name__ = true;
  2373. pony.ArrayTools.exists = function(a,e) {
  2374. return HxOverrides.indexOf(a,e,0) != -1;
  2375. };
  2376. pony.ArrayTools.thereIs = function(a,b) {
  2377. var $it0 = $iterator(a)();
  2378. while( $it0.hasNext() ) {
  2379. var e = $it0.next();
  2380. if(pony.Tools.equal(e,b)) return true;
  2381. }
  2382. return false;
  2383. };
  2384. pony.ArrayTools.kv = function(a) {
  2385. var i = 0;
  2386. var it = $iterator(a)();
  2387. return { hasNext : $bind(it,it.hasNext), next : function() {
  2388. var p;
  2389. var b = it.next();
  2390. p = { a : i, b : b};
  2391. i++;
  2392. return p;
  2393. }};
  2394. };
  2395. pony.ArrayTools.toBytes = function(a) {
  2396. var b = new haxe.io.BytesOutput();
  2397. var _g = 0;
  2398. while(_g < a.length) {
  2399. var e = a[_g];
  2400. ++_g;
  2401. b.writeByte(e);
  2402. }
  2403. return b;
  2404. };
  2405. pony.ArrayTools.randomize = function(a) {
  2406. a.sort(pony.ArrayTools.randomizeSort);
  2407. return a;
  2408. };
  2409. pony.ArrayTools.randomizeSort = function(_,_1) {
  2410. if(Math.random() > 0.5) return 1; else return -1;
  2411. };
  2412. pony.ArrayTools.last = function(a) {
  2413. return a[a.length - 1];
  2414. };
  2415. pony.ArrayTools.swap = function(array,a,b) {
  2416. if(a > b) return pony.ArrayTools.swap(array,b,a); else if(a == b) return array;
  2417. var v1 = array[a];
  2418. var v2 = array[b];
  2419. var p1;
  2420. if(a == 0) p1 = []; else p1 = array.slice(0,a);
  2421. var p2 = array.slice(a + 1,b);
  2422. var p3 = array.slice(b + 1);
  2423. p1.push(v2);
  2424. p2.push(v1);
  2425. return p1.concat(p2).concat(p3);
  2426. };
  2427. pony.ArrayTools["delete"] = function(array,index) {
  2428. var na = [];
  2429. var _g1 = 0;
  2430. var _g = array.length;
  2431. while(_g1 < _g) {
  2432. var i = _g1++;
  2433. if(i != index) na.push(array[i]);
  2434. }
  2435. return na;
  2436. };
  2437. pony.FloatTools = function() { };
  2438. pony.FloatTools.__name__ = true;
  2439. pony.FloatTools._toFixed = function(v,n,begin,d,beginS,endS) {
  2440. if(endS == null) endS = "0";
  2441. if(beginS == null) beginS = "0";
  2442. if(d == null) d = ".";
  2443. if(begin == null) begin = 0;
  2444. if(begin != 0) {
  2445. var s = pony.FloatTools._toFixed(v,n,0,d,beginS,endS);
  2446. var a = s.split(d);
  2447. var d1 = begin - a[0].length;
  2448. return pony.text.TextTools.repeat(beginS,d1) + s;
  2449. }
  2450. if(n == 0) return Std.string(v | 0);
  2451. var p = Math.pow(10,n);
  2452. v = Math.floor(v * p) / p;
  2453. var s1;
  2454. if(v == null) s1 = "null"; else s1 = "" + v;
  2455. var a1 = s1.split(".");
  2456. if(a1.length <= 1) return s1 + d + pony.text.TextTools.repeat(endS,n); else return a1[0] + d + a1[1] + pony.text.TextTools.repeat(endS,n - a1[1].length);
  2457. };
  2458. pony.XMLTools = function() { };
  2459. pony.XMLTools.__name__ = true;
  2460. pony.XMLTools.isTrue = function(x,name) {
  2461. return x.has.resolve(name) && pony.text.TextTools.isTrue(x.att.resolve(name));
  2462. };
  2463. pony.XMLTools.fast = function(text) {
  2464. return new haxe.xml.Fast(Xml.parse(text));
  2465. };
  2466. pony.events = {};
  2467. pony.events.Event = function(args,target,parent) {
  2468. this.target = target;
  2469. if(args == null) this.args = []; else this.args = args;
  2470. this.parent = parent;
  2471. this._stopPropagation = false;
  2472. };
  2473. pony.events.Event.__name__ = true;
  2474. pony.events.Event.__interfaces__ = [pony.IEvent];
  2475. pony.events.Event.prototype = {
  2476. _setListener: function(l) {
  2477. this.currentListener = l;
  2478. }
  2479. ,stopPropagation: function(lvl) {
  2480. if(lvl == null) lvl = -1;
  2481. if(this.parent != null && (lvl == -1 || lvl > 0)) this.parent.stopPropagation(lvl - 1);
  2482. this._stopPropagation = true;
  2483. }
  2484. ,get_count: function() {
  2485. return this.currentListener.count;
  2486. }
  2487. ,set_count: function(v) {
  2488. return this.currentListener.count = v;
  2489. }
  2490. ,get_prev: function() {
  2491. return this.currentListener.prev;
  2492. }
  2493. ,__class__: pony.events.Event
  2494. };
  2495. pony.events._Listener = {};
  2496. pony.events._Listener.Listener_Impl_ = function() { };
  2497. pony.events._Listener.Listener_Impl_.__name__ = true;
  2498. pony.events._Listener.Listener_Impl_._new = function(f,count) {
  2499. if(count == null) count = -1;
  2500. var this1;
  2501. f.used++;
  2502. this1 = { f : f, count : count, event : f.event, prev : null, used : 0, active : true, ignoreReturn : !f.ret};
  2503. return this1;
  2504. };
  2505. pony.events._Listener.Listener_Impl_.fromFunction = function(f) {
  2506. return pony.events._Listener.Listener_Impl_._fromFunction(f);
  2507. };
  2508. pony.events._Listener.Listener_Impl_.fromSignal = function(s) {
  2509. var f = pony._Function.Function_Impl_.from($bind(s,s.dispatchEvent),1,true,true);
  2510. return pony.events._Listener.Listener_Impl_._fromFunction(f);
  2511. };
  2512. pony.events._Listener.Listener_Impl_._fromFunction = function(f) {
  2513. if(pony.events._Listener.Listener_Impl_.flist.exists(f.id)) return pony.events._Listener.Listener_Impl_.flist.get(f.id); else {
  2514. var o;
  2515. var this1;
  2516. f.used++;
  2517. this1 = { f : f, count : -1, event : f.event, prev : null, used : 0, active : true, ignoreReturn : !f.ret};
  2518. o = this1;
  2519. pony.events._Listener.Listener_Impl_.flist.set(f.id,o);
  2520. return o;
  2521. }
  2522. };
  2523. pony.events._Listener.Listener_Impl_.get_count = function(this1) {
  2524. return this1.count;
  2525. };
  2526. pony.events._Listener.Listener_Impl_.call = function(this1,event) {
  2527. if(!this1.active) return true;
  2528. this1.count--;
  2529. event.currentListener = this1;
  2530. var r = true;
  2531. if(this1.event) {
  2532. if(this1.ignoreReturn) {
  2533. var this2 = this1.f;
  2534. var args = [event];
  2535. if(args == null) args = [];
  2536. Reflect.callMethod(null,this2.f,this2.args.concat(args));
  2537. } else if((function($this) {
  2538. var $r;
  2539. var this3 = this1.f;
  2540. var args1 = [event];
  2541. if(args1 == null) args1 = [];
  2542. $r = Reflect.callMethod(null,this3.f,this3.args.concat(args1));
  2543. return $r;
  2544. }(this)) == false) r = false;
  2545. } else {
  2546. var args2 = [];
  2547. var _g = 0;
  2548. var _g1 = event.args;
  2549. while(_g < _g1.length) {
  2550. var e = _g1[_g];
  2551. ++_g;
  2552. args2.push(e);
  2553. }
  2554. args2.push(event.target);
  2555. args2.push(event);
  2556. if(this1.ignoreReturn) {
  2557. var this4 = this1.f;
  2558. var args3 = args2.slice(0,this1.f.count);
  2559. if(args3 == null) args3 = [];
  2560. Reflect.callMethod(null,this4.f,this4.args.concat(args3));
  2561. } else if((function($this) {
  2562. var $r;
  2563. var this5 = this1.f;
  2564. var args4 = args2.slice(0,this1.f.count);
  2565. if(args4 == null) args4 = [];
  2566. $r = Reflect.callMethod(null,this5.f,this5.args.concat(args4));
  2567. return $r;
  2568. }(this)) == false) r = false;
  2569. }
  2570. this1.prev = event;
  2571. if(event._stopPropagation) return false; else return r;
  2572. };
  2573. pony.events._Listener.Listener_Impl_.setCount = function(this1,count) {
  2574. var f = this1.f;
  2575. var this2;
  2576. f.used++;
  2577. this2 = { f : f, count : count, event : f.event, prev : null, used : 0, active : true, ignoreReturn : !f.ret};
  2578. return this2;
  2579. };
  2580. pony.events._Listener.Listener_Impl_._use = function(this1) {
  2581. this1.used++;
  2582. };
  2583. pony.events._Listener.Listener_Impl_.unuse = function(this1) {
  2584. this1.used--;
  2585. if(this1.used == 0) {
  2586. pony.events._Listener.Listener_Impl_.flist.remove(this1.f.id);
  2587. this1.f.used--;
  2588. if(this1.f.used <= 0) {
  2589. pony._Function.Function_Impl_.list.remove(this1.f.f);
  2590. this1.f = null;
  2591. pony._Function.Function_Impl_.unusedCount--;
  2592. }
  2593. }
  2594. };
  2595. pony.events._Listener.Listener_Impl_.get_used = function(this1) {
  2596. return this1.used;
  2597. };
  2598. pony.events._Listener.Listener_Impl_.unusedCount = function() {
  2599. var c = 0;
  2600. var $it0 = pony.events._Listener.Listener_Impl_.flist.iterator();
  2601. while( $it0.hasNext() ) {
  2602. var l = $it0.next();
  2603. if(l.used <= 0) c++;
  2604. }
  2605. return c;
  2606. };
  2607. pony.events._Listener.Listener_Impl_.get_active = function(this1) {
  2608. return this1.active;
  2609. };
  2610. pony.events._Listener.Listener_Impl_.set_active = function(this1,b) {
  2611. return this1.active = b;
  2612. };
  2613. pony.events._Listener0 = {};
  2614. pony.events._Listener0.Listener0_Impl_ = function() { };
  2615. pony.events._Listener0.Listener0_Impl_.__name__ = true;
  2616. pony.events._Listener0.Listener0_Impl_._new = function(l) {
  2617. return l;
  2618. };
  2619. pony.events._Listener0.Listener0_Impl_.from0 = function(f) {
  2620. var l;
  2621. var f1 = pony._Function.Function_Impl_.from(f,0,false);
  2622. l = pony.events._Listener.Listener_Impl_._fromFunction(f1);
  2623. return l;
  2624. };
  2625. pony.events._Listener0.Listener0_Impl_.fromE = function(f) {
  2626. var l;
  2627. var f1 = pony._Function.Function_Impl_.from(f,1,false,true);
  2628. l = pony.events._Listener.Listener_Impl_._fromFunction(f1);
  2629. return l;
  2630. };
  2631. pony.events._Listener0.Listener0_Impl_.from0T = function(f) {
  2632. var l;
  2633. var f1 = pony._Function.Function_Impl_.from(f,1,false);
  2634. l = pony.events._Listener.Listener_Impl_._fromFunction(f1);
  2635. return l;
  2636. };
  2637. pony.events._Listener0.Listener0_Impl_.fromTE = function(f) {
  2638. var l;
  2639. var f1 = pony._Function.Function_Impl_.from(f,2,false);
  2640. l = pony.events._Listener.Listener_Impl_._fromFunction(f1);
  2641. return l;
  2642. };
  2643. pony.events._Listener0.Listener0_Impl_.to = function(this1) {
  2644. return this1;
  2645. };
  2646. pony.events._Listener0.Listener0_Impl_.fromSignal0 = function(s) {
  2647. var f = (function(_e) {
  2648. return function(event) {
  2649. return pony.events._Signal0.Signal0_Impl_.dispatchEvent(_e,event);
  2650. };
  2651. })(s);
  2652. var l;
  2653. var f1 = pony._Function.Function_Impl_.from(f,1,false,true);
  2654. l = pony.events._Listener.Listener_Impl_._fromFunction(f1);
  2655. return l;
  2656. };
  2657. pony.events._Listener1 = {};
  2658. pony.events._Listener1.Listener1_Impl_ = function() { };
  2659. pony.events._Listener1.Listener1_Impl_.__name__ = true;
  2660. pony.events._Listener1.Listener1_Impl_._new = function(l) {
  2661. return l;
  2662. };
  2663. pony.events._Listener1.Listener1_Impl_.from0 = function(f) {
  2664. var l;
  2665. var f1 = pony._Function.Function_Impl_.from(f,0,false);
  2666. l = pony.events._Listener.Listener_Impl_._fromFunction(f1);
  2667. return l;
  2668. };
  2669. pony.events._Listener1.Listener1_Impl_.fromE = function(f) {
  2670. var l;
  2671. var f1 = pony._Function.Function_Impl_.from(f,1,false,true);
  2672. l = pony.events._Listener.Listener_Impl_._fromFunction(f1);
  2673. return l;
  2674. };
  2675. pony.events._Listener1.Listener1_Impl_.from1 = function(f) {
  2676. var l;
  2677. var f1 = pony._Function.Function_Impl_.from(f,1,false);
  2678. l = pony.events._Listener.Listener_Impl_._fromFunction(f1);
  2679. return l;
  2680. };
  2681. pony.events._Listener1.Listener1_Impl_.from1T = function(f) {
  2682. var l;
  2683. var f1 = pony._Function.Function_Impl_.from(f,2,false);
  2684. l = pony.events._Listener.Listener_Impl_._fromFunction(f1);
  2685. return l;
  2686. };
  2687. pony.events._Listener1.Listener1_Impl_.from1TE = function(f) {
  2688. var l;
  2689. var f1 = pony._Function.Function_Impl_.from(f,3,false);
  2690. l = pony.events._Listener.Listener_Impl_._fromFunction(f1);
  2691. return l;
  2692. };
  2693. pony.events._Listener1.Listener1_Impl_.to = function(this1) {
  2694. return this1;
  2695. };
  2696. pony.events._Listener1.Listener1_Impl_.fromSignal0 = function(s) {
  2697. var l;
  2698. var f;
  2699. var f1 = (function(_e) {
  2700. return function(event) {
  2701. return pony.events._Signal0.Signal0_Impl_.dispatchEvent(_e,event);
  2702. };
  2703. })(s);
  2704. f = pony._Function.Function_Impl_.from(f1,1,true,true);
  2705. l = pony.events._Listener.Listener_Impl_._fromFunction(f);
  2706. return l;
  2707. };
  2708. pony.events._Listener1.Listener1_Impl_.fromSignal1 = function(s) {
  2709. var l;
  2710. var f;
  2711. var f1 = (function(_e) {
  2712. return function(event) {
  2713. return pony.events._Signal1.Signal1_Impl_.dispatchEvent(_e,event);
  2714. };
  2715. })(s);
  2716. f = pony._Function.Function_Impl_.from(f1,1,true,true);
  2717. l = pony.events._Listener.Listener_Impl_._fromFunction(f);
  2718. return l;
  2719. };
  2720. pony.events._Listener2 = {};
  2721. pony.events._Listener2.Listener2_Impl_ = function() { };
  2722. pony.events._Listener2.Listener2_Impl_.__name__ = true;
  2723. pony.events._Listener2.Listener2_Impl_._new = function(l) {
  2724. return l;
  2725. };
  2726. pony.events._Listener2.Listener2_Impl_.from0 = function(f) {
  2727. var l;
  2728. var f1 = pony._Function.Function_Impl_.from(f,0,false);
  2729. l = pony.events._Listener.Listener_Impl_._fromFunction(f1);
  2730. return l;
  2731. };
  2732. pony.events._Listener2.Listener2_Impl_.fromE = function(f) {
  2733. var l;
  2734. var f1 = pony._Function.Function_Impl_.from(f,1,false,true);
  2735. l = pony.events._Listener.Listener_Impl_._fromFunction(f1);
  2736. return l;
  2737. };
  2738. pony.events._Listener2.Listener2_Impl_.from1 = function(f) {
  2739. var l;
  2740. var f1 = pony._Function.Function_Impl_.from(f,1,false);
  2741. l = pony.events._Listener.Listener_Impl_._fromFunction(f1);
  2742. return l;
  2743. };
  2744. pony.events._Listener2.Listener2_Impl_.from1E = function(f) {
  2745. var l;
  2746. var f1 = pony._Function.Function_Impl_.from(f,2,false);
  2747. l = pony.events._Listener.Listener_Impl_._fromFunction(f1);
  2748. return l;
  2749. };
  2750. pony.events._Listener2.Listener2_Impl_.from2 = function(f) {
  2751. var l;
  2752. var f1 = pony._Function.Function_Impl_.from(f,2,false);
  2753. l = pony.events._Listener.Listener_Impl_._fromFunction(f1);
  2754. return l;
  2755. };
  2756. pony.events._Listener2.Listener2_Impl_.from2T = function(f) {
  2757. var l;
  2758. var f1 = pony._Function.Function_Impl_.from(f,3,false);
  2759. l = pony.events._Listener.Listener_Impl_._fromFunction(f1);
  2760. return l;
  2761. };
  2762. pony.events._Listener2.Listener2_Impl_.from2TE = function(f) {
  2763. var l;
  2764. var f1 = pony._Function.Function_Impl_.from(f,4,false);
  2765. l = pony.events._Listener.Listener_Impl_._fromFunction(f1);
  2766. return l;
  2767. };
  2768. pony.events._Listener2.Listener2_Impl_.to = function(this1) {
  2769. return this1;
  2770. };
  2771. pony.events._Listener2.Listener2_Impl_.fromSignal0 = function(s) {
  2772. var l;
  2773. var f;
  2774. var f1 = (function(_e) {
  2775. return function(event) {
  2776. return pony.events._Signal0.Signal0_Impl_.dispatchEvent(_e,event);
  2777. };
  2778. })(s);
  2779. f = pony._Function.Function_Impl_.from(f1,1,true,true);
  2780. l = pony.events._Listener.Listener_Impl_._fromFunction(f);
  2781. return l;
  2782. };
  2783. pony.events._Listener2.Listener2_Impl_.fromSignal1 = function(s) {
  2784. var l;
  2785. var f;
  2786. var f1 = (function(_e) {
  2787. return function(event) {
  2788. return pony.events._Signal1.Signal1_Impl_.dispatchEvent(_e,event);
  2789. };
  2790. })(s);
  2791. f = pony._Function.Function_Impl_.from(f1,1,true,true);
  2792. l = pony.events._Listener.Listener_Impl_._fromFunction(f);
  2793. return l;
  2794. };
  2795. pony.events._Listener2.Listener2_Impl_.fromSignal2 = function(s) {
  2796. var l;
  2797. var f;
  2798. var f1 = (function(_e) {
  2799. return function(event) {
  2800. return pony.events._Signal2.Signal2_Impl_.dispatchEvent(_e,event);
  2801. };
  2802. })(s);
  2803. f = pony._Function.Function_Impl_.from(f1,1,true,true);
  2804. l = pony.events._Listener.Listener_Impl_._fromFunction(f);
  2805. return l;
  2806. };
  2807. pony.events.Signal = function(target) {
  2808. this.silent = false;
  2809. this.subMap = new pony.Dictionary(5);
  2810. this.subHandlers = new haxe.ds.IntMap();
  2811. this.bindMap = new pony.Dictionary(5);
  2812. this.bindHandlers = new haxe.ds.IntMap();
  2813. this.notMap = new pony.Dictionary(5);
  2814. this.notHandlers = new haxe.ds.IntMap();
  2815. this.target = target;
  2816. this.listeners = new pony.Priority();
  2817. this.lRunCopy = new List();
  2818. this;
  2819. var s = Type.createEmptyInstance(pony.events.Signal).init(this);
  2820. this.lostListeners = s;
  2821. var s1 = Type.createEmptyInstance(pony.events.Signal).init(this);
  2822. this.takeListeners = s1;
  2823. };
  2824. pony.events.Signal.__name__ = true;
  2825. pony.events.Signal.create = function(t) {
  2826. var s = new pony.events.Signal(t);
  2827. return s;
  2828. };
  2829. pony.events.Signal.createEmpty = function() {
  2830. var s = new pony.events.Signal();
  2831. return s;
  2832. };
  2833. pony.events.Signal.prototype = {
  2834. init: function(target) {
  2835. this.target = target;
  2836. this.listeners = new pony.Priority();
  2837. this.lRunCopy = new List();
  2838. return this;
  2839. }
  2840. ,add: function(listener,priority) {
  2841. if(priority == null) priority = 0;
  2842. listener.used++;
  2843. var f = this.listeners.data.length == 0;
  2844. this.listeners.addElement(listener,priority);
  2845. if(f && this.takeListeners != null) pony.events._Signal0.Signal0_Impl_.dispatchEmpty(this.takeListeners);
  2846. return this;
  2847. }
  2848. ,remove: function(listener) {
  2849. if(this.listeners.data.length == 0) return this;
  2850. if(this.listeners.removeElement(listener)) {
  2851. var _g_head = this.lRunCopy.h;
  2852. var _g_val = null;
  2853. while(_g_head != null) {
  2854. var c;
  2855. _g_val = _g_head[0];
  2856. _g_head = _g_head[1];
  2857. c = _g_val;
  2858. c.removeElement(listener);
  2859. }
  2860. listener.used--;
  2861. if(listener.used == 0) {
  2862. pony.events._Listener.Listener_Impl_.flist.remove(listener.f.id);
  2863. listener.f.used--;
  2864. if(listener.f.used <= 0) {
  2865. pony._Function.Function_Impl_.list.remove(listener.f.f);
  2866. listener.f = null;
  2867. pony._Function.Function_Impl_.unusedCount--;
  2868. }
  2869. }
  2870. if(this.listeners.data.length == 0 && this.lostListeners != null) pony.events._Signal0.Signal0_Impl_.dispatchEmpty(this.lostListeners);
  2871. }
  2872. return this;
  2873. }
  2874. ,changePriority: function(listener,priority) {
  2875. if(priority == null) priority = 0;
  2876. this.listeners.changeElement(listener,priority);
  2877. return this;
  2878. }
  2879. ,once: function(listener,priority) {
  2880. if(priority == null) priority = 0;
  2881. return this.add((function($this) {
  2882. var $r;
  2883. var f = listener.f;
  2884. var this1;
  2885. f.used++;
  2886. this1 = { f : f, count : 1, event : f.event, prev : null, used : 0, active : true, ignoreReturn : !f.ret};
  2887. $r = this1;
  2888. return $r;
  2889. }(this)),priority);
  2890. }
  2891. ,dispatchEvent: function(event) {
  2892. if(this.listeners.data.length == 0) return this;
  2893. event.signal = this;
  2894. if(this.silent) return this;
  2895. var c = new pony.Priority(this.listeners.data.slice());
  2896. this.lRunCopy.add(c);
  2897. var $it0 = c.iterator();
  2898. while( $it0.hasNext() ) {
  2899. var l = $it0.next();
  2900. var r = false;
  2901. try {
  2902. r = pony.events._Listener.Listener_Impl_.call(l,event);
  2903. } catch( $e1 ) {
  2904. if( js.Boot.__instanceof($e1,String) ) {
  2905. var msg = $e1;
  2906. this.remove(l);
  2907. this.lRunCopy.remove(c);
  2908. throw msg;
  2909. } else {
  2910. var e = $e1;
  2911. this.remove(l);
  2912. this.lRunCopy.remove(c);
  2913. try {
  2914. haxe.Log.trace(haxe.CallStack.toString(haxe.CallStack.exceptionStack()),{ fileName : "Signal.hx", lineNumber : 202, className : "pony.events.Signal", methodName : "dispatchEvent"});
  2915. } catch( e1 ) {
  2916. }
  2917. throw e;
  2918. }
  2919. }
  2920. if(l.count == 0) this.remove(l);
  2921. if(!r) break;
  2922. }
  2923. this.lRunCopy.remove(c);
  2924. return this;
  2925. }
  2926. ,dispatchArgs: function(args) {
  2927. this.dispatchEvent(new pony.events.Event(args,this.target));
  2928. return this;
  2929. }
  2930. ,dispatchEmpty: function() {
  2931. this.dispatchEvent(new pony.events.Event(null,this.target));
  2932. }
  2933. ,dispatchEmpty1: function(_) {
  2934. this.dispatchEvent(new pony.events.Event(null,this.target));
  2935. }
  2936. ,subArgs: function(args,priority) {
  2937. if(priority == null) priority = 0;
  2938. var s = this.subMap.get(args);
  2939. if(s == null) {
  2940. s = new pony.events.Signal(this.target);
  2941. s.parent = this;
  2942. var l;
  2943. var f;
  2944. var f1 = (function(f2,a1) {
  2945. return function(a2) {
  2946. f2(a1,a2);
  2947. };
  2948. })($bind(this,this.subHandler),args);
  2949. f = pony._Function.Function_Impl_.from(f1,1,false,true);
  2950. l = pony.events._Listener.Listener_Impl_._fromFunction(f);
  2951. var k = this.subMap.set(args,s);
  2952. this.subHandlers.set(k,l);
  2953. l;
  2954. this.add(l,priority);
  2955. }
  2956. return s;
  2957. }
  2958. ,subHandler: function(args,event) {
  2959. var a = event.args.slice();
  2960. var _g = 0;
  2961. while(_g < args.length) {
  2962. var arg = args[_g];
  2963. ++_g;
  2964. if(a.shift() != arg) return;
  2965. }
  2966. this.subMap.get(args).dispatchEvent(new pony.events.Event(a,event.target,event));
  2967. }
  2968. ,changeSubArgs: function(args,priority) {
  2969. if(priority == null) priority = 0;
  2970. this.removeSubArgs(args);
  2971. return this.subArgs(args,priority);
  2972. }
  2973. ,removeSubArgs: function(args) {
  2974. var s = this.subMap.get(args);
  2975. if(s == null) return this;
  2976. s.destroy();
  2977. return this;
  2978. }
  2979. ,removeAllSub: function() {
  2980. if(this.subMap != null) {
  2981. var $it0 = HxOverrides.iter(this.subMap.vs);
  2982. while( $it0.hasNext() ) {
  2983. var e = $it0.next();
  2984. e.destroy();
  2985. }
  2986. this.subMap.clear();
  2987. }
  2988. return this;
  2989. }
  2990. ,removeSubSignal: function(s) {
  2991. var i = HxOverrides.indexOf(this.subMap.vs,s,0);
  2992. if(i != -1) {
  2993. s.remove(this.subHandlers.get(i));
  2994. this.subHandlers.remove(i);
  2995. this.subMap.removeIndex(i);
  2996. }
  2997. var i1 = HxOverrides.indexOf(this.bindMap.vs,s,0);
  2998. if(i1 != -1) {
  2999. s.remove(this.bindHandlers.get(i1));
  3000. this.bindHandlers.remove(i1);
  3001. this.bindMap.removeIndex(i1);
  3002. }
  3003. var i2 = HxOverrides.indexOf(this.notMap.vs,s,0);
  3004. if(i2 != -1) {
  3005. s.remove(this.notHandlers.get(i2));
  3006. this.notHandlers.remove(i2);
  3007. this.notMap.removeIndex(i2);
  3008. }
  3009. }
  3010. ,bindArgs: function(args,priority) {
  3011. if(priority == null) priority = 0;
  3012. var s = this.bindMap.get(args);
  3013. if(s == null) {
  3014. s = new pony.events.Signal(this.target);
  3015. s.parent = this;
  3016. var l;
  3017. var f;
  3018. var f1 = (function(f2,a1) {
  3019. return function(a2) {
  3020. f2(a1,a2);
  3021. };
  3022. })($bind(this,this.bindHandler),args);
  3023. f = pony._Function.Function_Impl_.from(f1,1,false,true);
  3024. l = pony.events._Listener.Listener_Impl_._fromFunction(f);
  3025. var k = this.bindMap.set(args,s);
  3026. this.bindHandlers.set(k,l);
  3027. l;
  3028. this.add(l,priority);
  3029. }
  3030. return s;
  3031. }
  3032. ,bindHandler: function(args,event) {
  3033. this.bindMap.get(args).dispatchEvent(new pony.events.Event(args.concat(event.args),event.target,event));
  3034. }
  3035. ,removeBindArgs: function(args) {
  3036. var s = this.bindMap.get(args);
  3037. if(s == null) return this;
  3038. s.destroy();
  3039. return this;
  3040. }
  3041. ,removeAllBind: function() {
  3042. if(this.bindMap != null) {
  3043. var $it0 = HxOverrides.iter(this.bindMap.vs);
  3044. while( $it0.hasNext() ) {
  3045. var e = $it0.next();
  3046. e.destroy();
  3047. }
  3048. this.bindMap.clear();
  3049. }
  3050. return this;
  3051. }
  3052. ,notArgs: function(args,priority) {
  3053. if(priority == null) priority = 0;
  3054. var s = this.bindMap.get(args);
  3055. if(s == null) {
  3056. s = new pony.events.Signal(this.target);
  3057. s.parent = this;
  3058. var l;
  3059. var f;
  3060. var f1 = (function(f2,a1) {
  3061. return function(a2) {
  3062. f2(a1,a2);
  3063. };
  3064. })($bind(this,this.notHandler),args);
  3065. f = pony._Function.Function_Impl_.from(f1,1,false,true);
  3066. l = pony.events._Listener.Listener_Impl_._fromFunction(f);
  3067. var k = this.notMap.set(args,s);
  3068. this.notHandlers.set(k,l);
  3069. l;
  3070. this.add(l,priority);
  3071. }
  3072. return s;
  3073. }
  3074. ,notHandler: function(args,event) {
  3075. var a = event.args.slice();
  3076. var _g = 0;
  3077. while(_g < args.length) {
  3078. var arg = args[_g];
  3079. ++_g;
  3080. if(a.shift() == arg) return;
  3081. }
  3082. this.notMap.get(args).dispatchEvent(new pony.events.Event(a,event.target,event));
  3083. }
  3084. ,removeNotArgs: function(args) {
  3085. var s = this.bindMap.get(args);
  3086. if(s == null) return this;
  3087. s.destroy();
  3088. return this;
  3089. }
  3090. ,removeAllNot: function() {
  3091. if(this.notMap != null) {
  3092. var $it0 = HxOverrides.iter(this.notMap.vs);
  3093. while( $it0.hasNext() ) {
  3094. var e = $it0.next();
  3095. e.destroy();
  3096. }
  3097. this.notMap.clear();
  3098. }
  3099. return this;
  3100. }
  3101. ,and: function(signal) {
  3102. var _g = this;
  3103. var ns = new pony.events.Signal();
  3104. var lock1 = false;
  3105. var lock2 = false;
  3106. this.add((function($this) {
  3107. var $r;
  3108. var f = pony._Function.Function_Impl_.from(function(e1) {
  3109. if(lock1) return;
  3110. lock2 = true;
  3111. signal.once((function($this) {
  3112. var $r;
  3113. var f1 = pony._Function.Function_Impl_.from(function(e2) {
  3114. lock2 = false;
  3115. ns.dispatchEvent(new pony.events.Event(e1.args.concat(e2.args),_g.target,e1));
  3116. },1,false,true);
  3117. $r = pony.events._Listener.Listener_Impl_._fromFunction(f1);
  3118. return $r;
  3119. }(this)),null);
  3120. },1,false,true);
  3121. $r = pony.events._Listener.Listener_Impl_._fromFunction(f);
  3122. return $r;
  3123. }(this)));
  3124. signal.add((function($this) {
  3125. var $r;
  3126. var f2 = pony._Function.Function_Impl_.from(function(e21) {
  3127. if(lock2) return;
  3128. lock1 = true;
  3129. _g.once((function($this) {
  3130. var $r;
  3131. var f3 = pony._Function.Function_Impl_.from(function(e11) {
  3132. lock1 = false;
  3133. ns.dispatchEvent(new pony.events.Event(e11.args.concat(e21.args),_g.target,e11));
  3134. },1,false,true);
  3135. $r = pony.events._Listener.Listener_Impl_._fromFunction(f3);
  3136. return $r;
  3137. }(this)),null);
  3138. },1,false,true);
  3139. $r = pony.events._Listener.Listener_Impl_._fromFunction(f2);
  3140. return $r;
  3141. }(this)));
  3142. return ns;
  3143. }
  3144. ,or: function(signal) {
  3145. var ns = new pony.events.Signal();
  3146. this.add((function($this) {
  3147. var $r;
  3148. var f = pony._Function.Function_Impl_.from($bind(ns,ns.dispatchEvent),1,true,true);
  3149. $r = pony.events._Listener.Listener_Impl_._fromFunction(f);
  3150. return $r;
  3151. }(this)));
  3152. signal.add((function($this) {
  3153. var $r;
  3154. var f1 = pony._Function.Function_Impl_.from($bind(ns,ns.dispatchEvent),1,true,true);
  3155. $r = pony.events._Listener.Listener_Impl_._fromFunction(f1);
  3156. return $r;
  3157. }(this)));
  3158. return ns;
  3159. }
  3160. ,removeAllListeners: function() {
  3161. var f = this.listeners.data.length == 0;
  3162. var $it0 = this.listeners.iterator();
  3163. while( $it0.hasNext() ) {
  3164. var l = $it0.next();
  3165. l.used--;
  3166. if(l.used == 0) {
  3167. pony.events._Listener.Listener_Impl_.flist.remove(l.f.id);
  3168. l.f.used--;
  3169. if(l.f.used <= 0) {
  3170. pony._Function.Function_Impl_.list.remove(l.f.f);
  3171. l.f = null;
  3172. pony._Function.Function_Impl_.unusedCount--;
  3173. }
  3174. }
  3175. }
  3176. this.listeners.clear();
  3177. if(!f && this.lostListeners != null) pony.events._Signal0.Signal0_Impl_.dispatch(this.lostListeners);
  3178. return this;
  3179. }
  3180. ,buildListenerEvent: function(event) {
  3181. var _g = this;
  3182. var f = pony._Function.Function_Impl_.from(function() {
  3183. _g.dispatchEvent(event);
  3184. },0,false);
  3185. return pony.events._Listener.Listener_Impl_._fromFunction(f);
  3186. }
  3187. ,buildListenerArgs: function(args) {
  3188. return this.buildListenerEvent(new pony.events.Event(args,this.target));
  3189. }
  3190. ,buildListenerEmpty: function() {
  3191. return this.buildListenerEvent(new pony.events.Event(null,this.target));
  3192. }
  3193. ,get_haveListeners: function() {
  3194. return !(this.listeners.data.length == 0);
  3195. }
  3196. ,sw: function(l1,l2,priority) {
  3197. if(priority == null) priority = 0;
  3198. this.once(l1,priority);
  3199. this.once((function($this) {
  3200. var $r;
  3201. var f;
  3202. {
  3203. var f1 = (function(f2,l11,l21,a1) {
  3204. return function() {
  3205. return f2(l11,l21,a1);
  3206. };
  3207. })($bind($this,$this.sw),l2,l1,priority);
  3208. f = pony._Function.Function_Impl_.from(f1,0);
  3209. }
  3210. $r = pony.events._Listener.Listener_Impl_._fromFunction(f);
  3211. return $r;
  3212. }(this)),priority);
  3213. return this;
  3214. }
  3215. ,enableSilent: function() {
  3216. this.silent = true;
  3217. }
  3218. ,disableSilent: function() {
  3219. this.silent = false;
  3220. }
  3221. ,get_listenersCount: function() {
  3222. return this.listeners.data.length;
  3223. }
  3224. ,destroy: function() {
  3225. if(this.parent != null) this.parent.removeSubSignal(this);
  3226. if(this.subMap != null) {
  3227. var $it0 = HxOverrides.iter(this.subMap.vs);
  3228. while( $it0.hasNext() ) {
  3229. var e = $it0.next();
  3230. e.destroy();
  3231. }
  3232. this.subMap.clear();
  3233. }
  3234. this;
  3235. if(this.bindMap != null) {
  3236. var $it1 = HxOverrides.iter(this.bindMap.vs);
  3237. while( $it1.hasNext() ) {
  3238. var e1 = $it1.next();
  3239. e1.destroy();
  3240. }
  3241. this.bindMap.clear();
  3242. }
  3243. this;
  3244. if(this.notMap != null) {
  3245. var $it2 = HxOverrides.iter(this.notMap.vs);
  3246. while( $it2.hasNext() ) {
  3247. var e2 = $it2.next();
  3248. e2.destroy();
  3249. }
  3250. this.notMap.clear();
  3251. }
  3252. this;
  3253. this.removeAllListeners();
  3254. if(this.takeListeners != null) {
  3255. var this1 = this.takeListeners;
  3256. this1.destroy();
  3257. this1.target;
  3258. this.takeListeners = null;
  3259. }
  3260. if(this.lostListeners != null) {
  3261. var this2 = this.lostListeners;
  3262. this2.destroy();
  3263. this2.target;
  3264. this.lostListeners = null;
  3265. }
  3266. }
  3267. ,debug: function() {
  3268. }
  3269. ,__class__: pony.events.Signal
  3270. };
  3271. pony.events._Signal0 = {};
  3272. pony.events._Signal0.Signal0_Impl_ = function() { };
  3273. pony.events._Signal0.Signal0_Impl_.__name__ = true;
  3274. pony.events._Signal0.Signal0_Impl_._new = function(s) {
  3275. return s;
  3276. };
  3277. pony.events._Signal0.Signal0_Impl_.get_silent = function(this1) {
  3278. return this1.silent;
  3279. };
  3280. pony.events._Signal0.Signal0_Impl_.set_silent = function(this1,b) {
  3281. return this1.silent = b;
  3282. };
  3283. pony.events._Signal0.Signal0_Impl_.get_lostListeners = function(this1) {
  3284. return this1.lostListeners;
  3285. };
  3286. pony.events._Signal0.Signal0_Impl_.get_takeListeners = function(this1) {
  3287. return this1.takeListeners;
  3288. };
  3289. pony.events._Signal0.Signal0_Impl_.get_haveListeners = function(this1) {
  3290. return !(this1.listeners.data.length == 0);
  3291. };
  3292. pony.events._Signal0.Signal0_Impl_.get_data = function(this1) {
  3293. return this1.data;
  3294. };
  3295. pony.events._Signal0.Signal0_Impl_.set_data = function(this1,d) {
  3296. return this1.data = d;
  3297. };
  3298. pony.events._Signal0.Signal0_Impl_.get_target = function(this1) {
  3299. return this1.target;
  3300. };
  3301. pony.events._Signal0.Signal0_Impl_.get_listenersCount = function(this1) {
  3302. return this1.listeners.data.length;
  3303. };
  3304. pony.events._Signal0.Signal0_Impl_.add = function(this1,listener,priority) {
  3305. if(priority == null) priority = 0;
  3306. this1.add(listener,priority);
  3307. return this1.target;
  3308. };
  3309. pony.events._Signal0.Signal0_Impl_.once = function(this1,listener,priority) {
  3310. if(priority == null) priority = 0;
  3311. this1.once(listener,priority);
  3312. return this1.target;
  3313. };
  3314. pony.events._Signal0.Signal0_Impl_.remove = function(this1,listener) {
  3315. this1.remove(listener);
  3316. return this1.target;
  3317. };
  3318. pony.events._Signal0.Signal0_Impl_.changePriority = function(this1,listener,priority) {
  3319. if(priority == null) priority = 0;
  3320. this1.listeners.changeElement(listener,priority);
  3321. this1;
  3322. return this1.target;
  3323. };
  3324. pony.events._Signal0.Signal0_Impl_.dispatch = function(this1) {
  3325. this1.dispatchEmpty();
  3326. return this1.target;
  3327. };
  3328. pony.events._Signal0.Signal0_Impl_.dispatchEvent = function(this1,event) {
  3329. this1.dispatchEvent(event);
  3330. return this1.target;
  3331. };
  3332. pony.events._Signal0.Signal0_Impl_.dispatchArgs = function(this1) {
  3333. this1.dispatchEmpty();
  3334. return this1.target;
  3335. };
  3336. pony.events._Signal0.Signal0_Impl_.dispatchEmpty = function(this1) {
  3337. this1.dispatchEmpty();
  3338. };
  3339. pony.events._Signal0.Signal0_Impl_.dispatchEmpty1 = function(this1,_) {
  3340. this1.dispatchEmpty();
  3341. };
  3342. pony.events._Signal0.Signal0_Impl_.bind = function(this1,a,b,c,d,e,f,g) {
  3343. if(g != null) return this1.bindArgs([a,b,c,d,e,f,g],0); else if(f != null) return this1.bindArgs([a,b,c,d,e,f],0); else if(e != null) return this1.bindArgs([a,b,c,d,e],0); else if(d != null) return this1.bindArgs([a,b,c,d],0); else if(c != null) return this1.bindArgs([a,b,c],0); else if(b != null) return this1.bindArgs([a,b],0); else return this1.bindArgs([a],0);
  3344. };
  3345. pony.events._Signal0.Signal0_Impl_.bindArgs = function(this1,args,priority) {
  3346. if(priority == null) priority = 0;
  3347. return this1.bindArgs(args,priority);
  3348. };
  3349. pony.events._Signal0.Signal0_Impl_.bind1 = function(this1,a,priority) {
  3350. if(priority == null) priority = 0;
  3351. var s = this1.bindArgs([a],priority);
  3352. return s;
  3353. };
  3354. pony.events._Signal0.Signal0_Impl_.bind2 = function(this1,a,b,priority) {
  3355. if(priority == null) priority = 0;
  3356. var s = this1.bindArgs([a,b],priority);
  3357. return s;
  3358. };
  3359. pony.events._Signal0.Signal0_Impl_.removeBindArgs = function(this1,args) {
  3360. this1.removeBindArgs(args);
  3361. return this1.target;
  3362. };
  3363. pony.events._Signal0.Signal0_Impl_.and = function(this1,s) {
  3364. return this1.and(s);
  3365. };
  3366. pony.events._Signal0.Signal0_Impl_.and0 = function(this1,s) {
  3367. var this2 = this1.and(s);
  3368. return this2;
  3369. };
  3370. pony.events._Signal0.Signal0_Impl_.and1 = function(this1,s) {
  3371. var this2 = this1.and(s);
  3372. return this2;
  3373. };
  3374. pony.events._Signal0.Signal0_Impl_.and2 = function(this1,s) {
  3375. var this2 = this1.and(s);
  3376. return this2;
  3377. };
  3378. pony.events._Signal0.Signal0_Impl_.or = function(this1,s) {
  3379. var s1 = this1.or(s);
  3380. return s1;
  3381. };
  3382. pony.events._Signal0.Signal0_Impl_.removeAllListeners = function(this1) {
  3383. this1.removeAllListeners();
  3384. return this1.target;
  3385. };
  3386. pony.events._Signal0.Signal0_Impl_.sw = function(this1,l1,l2) {
  3387. this1.sw(l1,l2);
  3388. return this1.target;
  3389. };
  3390. pony.events._Signal0.Signal0_Impl_.enableSilent = function(this1) {
  3391. this1.silent = true;
  3392. };
  3393. pony.events._Signal0.Signal0_Impl_.disableSilent = function(this1) {
  3394. this1.silent = false;
  3395. };
  3396. pony.events._Signal0.Signal0_Impl_.destroy = function(this1) {
  3397. this1.destroy();
  3398. return this1.target;
  3399. };
  3400. pony.events._Signal0.Signal0_Impl_.from = function(s) {
  3401. return s;
  3402. };
  3403. pony.events._Signal0.Signal0_Impl_.toDynamic = function(this1) {
  3404. return this1;
  3405. };
  3406. pony.events._Signal0.Signal0_Impl_.toTar = function(this1) {
  3407. return this1;
  3408. };
  3409. pony.events._Signal0.Signal0_Impl_.toFunction = function(this1) {
  3410. return (function(_e) {
  3411. return function() {
  3412. return pony.events._Signal0.Signal0_Impl_.dispatch(_e);
  3413. };
  3414. })(this1);
  3415. };
  3416. pony.events._Signal0.Signal0_Impl_.toFunction2 = function(this1) {
  3417. return (function(_e) {
  3418. return function(event) {
  3419. return pony.events._Signal0.Signal0_Impl_.dispatchEvent(_e,event);
  3420. };
  3421. })(this1);
  3422. };
  3423. pony.events._Signal0.Signal0_Impl_.debug = function(this1) {
  3424. null;
  3425. };
  3426. pony.events._Signal0.Signal0_Impl_.op_add = function(this1,listener) {
  3427. pony.events._Signal0.Signal0_Impl_.add(this1,listener);
  3428. return this1;
  3429. };
  3430. pony.events._Signal0.Signal0_Impl_.op_once = function(this1,listener) {
  3431. pony.events._Signal0.Signal0_Impl_.once(this1,listener);
  3432. return this1;
  3433. };
  3434. pony.events._Signal0.Signal0_Impl_.op_remove = function(this1,listener) {
  3435. pony.events._Signal0.Signal0_Impl_.remove(this1,listener);
  3436. return this1;
  3437. };
  3438. pony.events._Signal0.Signal0_Impl_.op_and0 = function(this1,s) {
  3439. var this2 = this1.and(s);
  3440. return this2;
  3441. };
  3442. pony.events._Signal0.Signal0_Impl_.op_and1 = function(this1,s) {
  3443. var this2 = this1.and(s);
  3444. return this2;
  3445. };
  3446. pony.events._Signal0.Signal0_Impl_.op_and2 = function(this1,s) {
  3447. var this2 = this1.and(s);
  3448. return this2;
  3449. };
  3450. pony.events._Signal0.Signal0_Impl_.op_or = function(this1,s) {
  3451. var s1 = this1.or(s);
  3452. return s1;
  3453. };
  3454. pony.events._Signal0.Signal0_Impl_.op_bind1 = function(this1,a) {
  3455. var s = this1.bindArgs([a],0);
  3456. return s;
  3457. };
  3458. pony.events._Signal1 = {};
  3459. pony.events._Signal1.Signal1_Impl_ = function() { };
  3460. pony.events._Signal1.Signal1_Impl_.__name__ = true;
  3461. pony.events._Signal1.Signal1_Impl_._new = function(s) {
  3462. return s;
  3463. };
  3464. pony.events._Signal1.Signal1_Impl_.get_silent = function(this1) {
  3465. return this1.silent;
  3466. };
  3467. pony.events._Signal1.Signal1_Impl_.set_silent = function(this1,b) {
  3468. return this1.silent = b;
  3469. };
  3470. pony.events._Signal1.Signal1_Impl_.get_lostListeners = function(this1) {
  3471. return this1.lostListeners;
  3472. };
  3473. pony.events._Signal1.Signal1_Impl_.get_takeListeners = function(this1) {
  3474. return this1.takeListeners;
  3475. };
  3476. pony.events._Signal1.Signal1_Impl_.get_haveListeners = function(this1) {
  3477. return !(this1.listeners.data.length == 0);
  3478. };
  3479. pony.events._Signal1.Signal1_Impl_.get_data = function(this1) {
  3480. return this1.data;
  3481. };
  3482. pony.events._Signal1.Signal1_Impl_.set_data = function(this1,d) {
  3483. return this1.data = d;
  3484. };
  3485. pony.events._Signal1.Signal1_Impl_.get_target = function(this1) {
  3486. return this1.target;
  3487. };
  3488. pony.events._Signal1.Signal1_Impl_.get_listenersCount = function(this1) {
  3489. return this1.listeners.data.length;
  3490. };
  3491. pony.events._Signal1.Signal1_Impl_.add = function(this1,listener,priority) {
  3492. if(priority == null) priority = 0;
  3493. this1.add(listener,priority);
  3494. return this1.target;
  3495. };
  3496. pony.events._Signal1.Signal1_Impl_.once = function(this1,listener,priority) {
  3497. if(priority == null) priority = 0;
  3498. this1.once(listener,priority);
  3499. return this1.target;
  3500. };
  3501. pony.events._Signal1.Signal1_Impl_.remove = function(this1,listener) {
  3502. this1.remove(listener);
  3503. return this1.target;
  3504. };
  3505. pony.events._Signal1.Signal1_Impl_.changePriority = function(this1,listener,priority) {
  3506. if(priority == null) priority = 0;
  3507. this1.listeners.changeElement(listener,priority);
  3508. this1;
  3509. return this1.target;
  3510. };
  3511. pony.events._Signal1.Signal1_Impl_.dispatch = function(this1,a) {
  3512. this1.dispatchEvent(new pony.events.Event([a],this1.target));
  3513. this1;
  3514. return this1.target;
  3515. };
  3516. pony.events._Signal1.Signal1_Impl_.dispatchEvent = function(this1,event) {
  3517. this1.dispatchEvent(event);
  3518. return this1.target;
  3519. };
  3520. pony.events._Signal1.Signal1_Impl_.dispatchArgs = function(this1,args) {
  3521. this1.dispatchEvent(new pony.events.Event(args,this1.target));
  3522. this1;
  3523. return this1.target;
  3524. };
  3525. pony.events._Signal1.Signal1_Impl_.sub = function(this1,a,priority) {
  3526. if(priority == null) priority = 0;
  3527. var s = this1.subArgs([a],priority);
  3528. return s;
  3529. };
  3530. pony.events._Signal1.Signal1_Impl_.subArgs = function(this1,args,priority) {
  3531. if(priority == null) priority = 0;
  3532. var s = this1.subArgs(args,priority);
  3533. return s;
  3534. };
  3535. pony.events._Signal1.Signal1_Impl_.removeSub = function(this1,a) {
  3536. this1.removeSubArgs([a]);
  3537. return this1.target;
  3538. };
  3539. pony.events._Signal1.Signal1_Impl_.removeSubArgs = function(this1,args) {
  3540. this1.removeSubArgs(args);
  3541. return this1.target;
  3542. };
  3543. pony.events._Signal1.Signal1_Impl_.removeAllSub = function(this1) {
  3544. if(this1.subMap != null) {
  3545. var $it0 = HxOverrides.iter(this1.subMap.vs);
  3546. while( $it0.hasNext() ) {
  3547. var e = $it0.next();
  3548. e.destroy();
  3549. }
  3550. this1.subMap.clear();
  3551. }
  3552. this1;
  3553. return this1.target;
  3554. };
  3555. pony.events._Signal1.Signal1_Impl_.removeAllBind = function(this1) {
  3556. if(this1.subMap != null) {
  3557. var $it0 = HxOverrides.iter(this1.subMap.vs);
  3558. while( $it0.hasNext() ) {
  3559. var e = $it0.next();
  3560. e.destroy();
  3561. }
  3562. this1.subMap.clear();
  3563. }
  3564. this1;
  3565. return this1.target;
  3566. };
  3567. pony.events._Signal1.Signal1_Impl_.not = function(this1,v,priority) {
  3568. if(priority == null) priority = 0;
  3569. var s = this1.notArgs([v],priority);
  3570. return s;
  3571. };
  3572. pony.events._Signal1.Signal1_Impl_.bind = function(this1,a,b,c,d,e,f,g) {
  3573. if(g != null) return this1.bindArgs([a,b,c,d,e,f,g],0); else if(f != null) return this1.bindArgs([a,b,c,d,e,f],0); else if(e != null) return this1.bindArgs([a,b,c,d,e],0); else if(d != null) return this1.bindArgs([a,b,c,d],0); else if(c != null) return this1.bindArgs([a,b,c],0); else if(b != null) return this1.bindArgs([a,b],0); else return this1.bindArgs([a],0);
  3574. };
  3575. pony.events._Signal1.Signal1_Impl_.bindArgs = function(this1,args,priority) {
  3576. if(priority == null) priority = 0;
  3577. return this1.bindArgs(args,priority);
  3578. };
  3579. pony.events._Signal1.Signal1_Impl_.bind1 = function(this1,a,priority) {
  3580. if(priority == null) priority = 0;
  3581. var s = this1.bindArgs([a],priority);
  3582. return s;
  3583. };
  3584. pony.events._Signal1.Signal1_Impl_.and = function(this1,s) {
  3585. return this1.and(s);
  3586. };
  3587. pony.events._Signal1.Signal1_Impl_.and0 = function(this1,s) {
  3588. var this2 = this1.and(s);
  3589. return this2;
  3590. };
  3591. pony.events._Signal1.Signal1_Impl_.and1 = function(this1,s) {
  3592. var this2 = this1.and(s);
  3593. return this2;
  3594. };
  3595. pony.events._Signal1.Signal1_Impl_.or = function(this1,s) {
  3596. var s1 = this1.or(s);
  3597. return s1;
  3598. };
  3599. pony.events._Signal1.Signal1_Impl_.removeAllListeners = function(this1) {
  3600. this1.removeAllListeners();
  3601. return this1.target;
  3602. };
  3603. pony.events._Signal1.Signal1_Impl_.sw = function(this1,l1,l2) {
  3604. this1.once(l1,null);
  3605. this1.once((function($this) {
  3606. var $r;
  3607. var f;
  3608. {
  3609. var f1 = (function(f2,l11,l21) {
  3610. return function() {
  3611. return f2(l11,l21);
  3612. };
  3613. })($bind(this1,this1.sw),l2,l1);
  3614. f = pony._Function.Function_Impl_.from(f1,0);
  3615. }
  3616. $r = pony.events._Listener.Listener_Impl_._fromFunction(f);
  3617. return $r;
  3618. }(this)),null);
  3619. return this1.target;
  3620. };
  3621. pony.events._Signal1.Signal1_Impl_.destroy = function(this1) {
  3622. this1.destroy();
  3623. return this1.target;
  3624. };
  3625. pony.events._Signal1.Signal1_Impl_.enableSilent = function(this1) {
  3626. this1.silent = true;
  3627. };
  3628. pony.events._Signal1.Signal1_Impl_.disableSilent = function(this1) {
  3629. this1.silent = false;
  3630. };
  3631. pony.events._Signal1.Signal1_Impl_.from = function(s) {
  3632. return s;
  3633. };
  3634. pony.events._Signal1.Signal1_Impl_.to = function(this1) {
  3635. return this1;
  3636. };
  3637. pony.events._Signal1.Signal1_Impl_.toListener = function(this1) {
  3638. var f = pony._Function.Function_Impl_.from($bind(this1,this1.dispatchEvent),1,true,true);
  3639. return pony.events._Listener.Listener_Impl_._fromFunction(f);
  3640. };
  3641. pony.events._Signal1.Signal1_Impl_.toFunction = function(this1) {
  3642. return (function(_e) {
  3643. return function(a) {
  3644. return pony.events._Signal1.Signal1_Impl_.dispatch(_e,a);
  3645. };
  3646. })(this1);
  3647. };
  3648. pony.events._Signal1.Signal1_Impl_.toFunction2 = function(this1) {
  3649. return (function(_e) {
  3650. return function(event) {
  3651. return pony.events._Signal1.Signal1_Impl_.dispatchEvent(_e,event);
  3652. };
  3653. })(this1);
  3654. };
  3655. pony.events._Signal1.Signal1_Impl_.debug = function(this1) {
  3656. null;
  3657. };
  3658. pony.events._Signal1.Signal1_Impl_.op_add = function(this1,listener) {
  3659. pony.events._Signal1.Signal1_Impl_.add(this1,listener);
  3660. return this1;
  3661. };
  3662. pony.events._Signal1.Signal1_Impl_.op_once = function(this1,listener) {
  3663. pony.events._Signal1.Signal1_Impl_.once(this1,listener);
  3664. return this1;
  3665. };
  3666. pony.events._Signal1.Signal1_Impl_.op_remove = function(this1,listener) {
  3667. pony.events._Signal1.Signal1_Impl_.remove(this1,listener);
  3668. return this1;
  3669. };
  3670. pony.events._Signal1.Signal1_Impl_.op_and0 = function(this1,s) {
  3671. var this2 = this1.and(s);
  3672. return this2;
  3673. };
  3674. pony.events._Signal1.Signal1_Impl_.op_and1 = function(this1,s) {
  3675. var this2 = this1.and(s);
  3676. return this2;
  3677. };
  3678. pony.events._Signal1.Signal1_Impl_.op_or = function(this1,s) {
  3679. var s1 = this1.or(s);
  3680. return s1;
  3681. };
  3682. pony.events._Signal1.Signal1_Impl_.op_bind = function(this1,a) {
  3683. var s = this1.bindArgs([a],0);
  3684. return s;
  3685. };
  3686. pony.events._Signal1.Signal1_Impl_.op_sub = function(this1,a) {
  3687. var s = this1.subArgs([a],0);
  3688. return s;
  3689. };
  3690. pony.events._Signal1.Signal1_Impl_.op_not = function(this1,a) {
  3691. var s = this1.notArgs([a],0);
  3692. return s;
  3693. };
  3694. pony.events._Signal2 = {};
  3695. pony.events._Signal2.Signal2_Impl_ = function() { };
  3696. pony.events._Signal2.Signal2_Impl_.__name__ = true;
  3697. pony.events._Signal2.Signal2_Impl_._new = function(s) {
  3698. return s;
  3699. };
  3700. pony.events._Signal2.Signal2_Impl_.get_silent = function(this1) {
  3701. return this1.silent;
  3702. };
  3703. pony.events._Signal2.Signal2_Impl_.set_silent = function(this1,b) {
  3704. return this1.silent = b;
  3705. };
  3706. pony.events._Signal2.Signal2_Impl_.get_lostListeners = function(this1) {
  3707. return this1.lostListeners;
  3708. };
  3709. pony.events._Signal2.Signal2_Impl_.get_takeListeners = function(this1) {
  3710. return this1.takeListeners;
  3711. };
  3712. pony.events._Signal2.Signal2_Impl_.get_haveListeners = function(this1) {
  3713. return !(this1.listeners.data.length == 0);
  3714. };
  3715. pony.events._Signal2.Signal2_Impl_.get_data = function(this1) {
  3716. return this1.data;
  3717. };
  3718. pony.events._Signal2.Signal2_Impl_.set_data = function(this1,d) {
  3719. return this1.data = d;
  3720. };
  3721. pony.events._Signal2.Signal2_Impl_.get_target = function(this1) {
  3722. return this1.target;
  3723. };
  3724. pony.events._Signal2.Signal2_Impl_.get_listenersCount = function(this1) {
  3725. return this1.listeners.data.length;
  3726. };
  3727. pony.events._Signal2.Signal2_Impl_.add = function(this1,listener,priority) {
  3728. if(priority == null) priority = 0;
  3729. this1.add(listener,priority);
  3730. return this1.target;
  3731. };
  3732. pony.events._Signal2.Signal2_Impl_.once = function(this1,listener,priority) {
  3733. if(priority == null) priority = 0;
  3734. this1.once(listener,priority);
  3735. return this1.target;
  3736. };
  3737. pony.events._Signal2.Signal2_Impl_.remove = function(this1,listener) {
  3738. this1.remove(listener);
  3739. return this1.target;
  3740. };
  3741. pony.events._Signal2.Signal2_Impl_.changePriority = function(this1,listener,priority) {
  3742. if(priority == null) priority = 0;
  3743. this1.listeners.changeElement(listener,priority);
  3744. this1;
  3745. return this1.target;
  3746. };
  3747. pony.events._Signal2.Signal2_Impl_.dispatch = function(this1,a,b) {
  3748. this1.dispatchEvent(new pony.events.Event([a,b],this1.target));
  3749. this1;
  3750. return this1.target;
  3751. };
  3752. pony.events._Signal2.Signal2_Impl_.dispatchEvent = function(this1,event) {
  3753. this1.dispatchEvent(event);
  3754. return this1.target;
  3755. };
  3756. pony.events._Signal2.Signal2_Impl_.dispatchArgs = function(this1,args) {
  3757. this1.dispatchEvent(new pony.events.Event(args,this1.target));
  3758. this1;
  3759. return this1.target;
  3760. };
  3761. pony.events._Signal2.Signal2_Impl_.sub = function(this1,a,b,priority) {
  3762. if(priority == null) priority = 0;
  3763. return this1.subArgs(b == null?[a]:[a,b],priority);
  3764. };
  3765. pony.events._Signal2.Signal2_Impl_.sub1 = function(this1,a,priority) {
  3766. if(priority == null) priority = 0;
  3767. var s = this1.subArgs([a],priority);
  3768. return s;
  3769. };
  3770. pony.events._Signal2.Signal2_Impl_.sub2 = function(this1,a,b,priority) {
  3771. if(priority == null) priority = 0;
  3772. var s = this1.subArgs([a,b],priority);
  3773. return s;
  3774. };
  3775. pony.events._Signal2.Signal2_Impl_.subArgs = function(this1,args,priority) {
  3776. if(priority == null) priority = 0;
  3777. return this1.subArgs(args,priority);
  3778. };
  3779. pony.events._Signal2.Signal2_Impl_.removeSub = function(this1,a,b) {
  3780. this1.removeSubArgs(b == null?[a]:[a,b]);
  3781. return this1.target;
  3782. };
  3783. pony.events._Signal2.Signal2_Impl_.removeSubArgs = function(this1,args) {
  3784. this1.removeSubArgs(args);
  3785. return this1.target;
  3786. };
  3787. pony.events._Signal2.Signal2_Impl_.removeAllSub = function(this1) {
  3788. if(this1.subMap != null) {
  3789. var $it0 = HxOverrides.iter(this1.subMap.vs);
  3790. while( $it0.hasNext() ) {
  3791. var e = $it0.next();
  3792. e.destroy();
  3793. }
  3794. this1.subMap.clear();
  3795. }
  3796. this1;
  3797. return this1.target;
  3798. };
  3799. pony.events._Signal2.Signal2_Impl_.not1 = function(this1,v,priority) {
  3800. if(priority == null) priority = 0;
  3801. var s = this1.notArgs([v],priority);
  3802. return s;
  3803. };
  3804. pony.events._Signal2.Signal2_Impl_.not2 = function(this1,v1,v2,priority) {
  3805. if(priority == null) priority = 0;
  3806. var s = this1.notArgs([v1,v2],priority);
  3807. return s;
  3808. };
  3809. pony.events._Signal2.Signal2_Impl_.removeAllListeners = function(this1) {
  3810. this1.removeAllListeners();
  3811. return this1.target;
  3812. };
  3813. pony.events._Signal2.Signal2_Impl_.sw = function(this1,l1,l2) {
  3814. this1.once(l1,null);
  3815. this1.once((function($this) {
  3816. var $r;
  3817. var f;
  3818. {
  3819. var f1 = (function(f2,l11,l21) {
  3820. return function() {
  3821. return f2(l11,l21);
  3822. };
  3823. })($bind(this1,this1.sw),l2,l1);
  3824. f = pony._Function.Function_Impl_.from(f1,0);
  3825. }
  3826. $r = pony.events._Listener.Listener_Impl_._fromFunction(f);
  3827. return $r;
  3828. }(this)),null);
  3829. return this1.target;
  3830. };
  3831. pony.events._Signal2.Signal2_Impl_.destroy = function(this1) {
  3832. this1.destroy();
  3833. return this1.target;
  3834. };
  3835. pony.events._Signal2.Signal2_Impl_.enableSilent = function(this1) {
  3836. this1.silent = true;
  3837. };
  3838. pony.events._Signal2.Signal2_Impl_.disableSilent = function(this1) {
  3839. this1.silent = false;
  3840. };
  3841. pony.events._Signal2.Signal2_Impl_.from = function(s) {
  3842. return s;
  3843. };
  3844. pony.events._Signal2.Signal2_Impl_.to = function(this1) {
  3845. return this1;
  3846. };
  3847. pony.events._Signal2.Signal2_Impl_.toFunction = function(this1) {
  3848. return (function(_e) {
  3849. return function(a,b) {
  3850. return pony.events._Signal2.Signal2_Impl_.dispatch(_e,a,b);
  3851. };
  3852. })(this1);
  3853. };
  3854. pony.events._Signal2.Signal2_Impl_.toFunction2 = function(this1) {
  3855. return (function(_e) {
  3856. return function(event) {
  3857. return pony.events._Signal2.Signal2_Impl_.dispatchEvent(_e,event);
  3858. };
  3859. })(this1);
  3860. };
  3861. pony.events._Signal2.Signal2_Impl_.debug = function(this1) {
  3862. null;
  3863. };
  3864. pony.events._Signal2.Signal2_Impl_.op_add = function(this1,listener) {
  3865. pony.events._Signal2.Signal2_Impl_.add(this1,listener);
  3866. return this1;
  3867. };
  3868. pony.events._Signal2.Signal2_Impl_.op_once = function(this1,listener) {
  3869. pony.events._Signal2.Signal2_Impl_.once(this1,listener);
  3870. return this1;
  3871. };
  3872. pony.events._Signal2.Signal2_Impl_.op_remove = function(this1,listener) {
  3873. pony.events._Signal2.Signal2_Impl_.remove(this1,listener);
  3874. return this1;
  3875. };
  3876. pony.events._Signal2.Signal2_Impl_.op_sub = function(this1,a) {
  3877. var s = this1.subArgs([a],0);
  3878. return s;
  3879. };
  3880. pony.events._Signal2.Signal2_Impl_.op_not = function(this1,a) {
  3881. var s = this1.notArgs([a],0);
  3882. return s;
  3883. };
  3884. pony.events._SignalTar = {};
  3885. pony.events._SignalTar.SignalTar_Impl_ = function() { };
  3886. pony.events._SignalTar.SignalTar_Impl_.__name__ = true;
  3887. pony.events._SignalTar.SignalTar_Impl_._new = function(s) {
  3888. return s;
  3889. };
  3890. pony.events._SignalTar.SignalTar_Impl_.to0 = function(this1) {
  3891. return this1;
  3892. };
  3893. pony.events._SignalTar.SignalTar_Impl_.to1 = function(this1) {
  3894. return this1;
  3895. };
  3896. pony.events._SignalTar.SignalTar_Impl_.to2 = function(this1) {
  3897. return this1;
  3898. };
  3899. pony.events._SignalTar.SignalTar_Impl_.tod0 = function(this1) {
  3900. return this1;
  3901. };
  3902. pony.events._SignalTar.SignalTar_Impl_.tod1 = function(this1) {
  3903. return this1;
  3904. };
  3905. pony.events._SignalTar.SignalTar_Impl_.tod2 = function(this1) {
  3906. return this1;
  3907. };
  3908. pony.events.Waiter = function() {
  3909. this.ready = false;
  3910. this.f = new List();
  3911. };
  3912. pony.events.Waiter.__name__ = true;
  3913. pony.events.Waiter.prototype = {
  3914. wait: function(cb) {
  3915. if(this.ready) cb(); else this.f.push(cb);
  3916. }
  3917. ,end: function() {
  3918. if(this.ready) throw "Double ready";
  3919. this.ready = true;
  3920. var _g_head = this.f.h;
  3921. var _g_val = null;
  3922. while(_g_head != null) {
  3923. var e;
  3924. _g_val = _g_head[0];
  3925. _g_head = _g_head[1];
  3926. e = _g_val;
  3927. e();
  3928. }
  3929. this.f = null;
  3930. }
  3931. ,__class__: pony.events.Waiter
  3932. };
  3933. pony.net = {};
  3934. pony.net.INet = function() { };
  3935. pony.net.INet.__name__ = true;
  3936. pony.net.INet.prototype = {
  3937. __class__: pony.net.INet
  3938. };
  3939. pony.net.ISocketClient = function() { };
  3940. pony.net.ISocketClient.__name__ = true;
  3941. pony.net.ISocketClient.__interfaces__ = [pony.net.INet];
  3942. pony.net.ISocketClient.prototype = {
  3943. __class__: pony.net.ISocketClient
  3944. };
  3945. pony.net.ISocketServer = function() { };
  3946. pony.net.ISocketServer.__name__ = true;
  3947. pony.net.ISocketServer.__interfaces__ = [pony.net.INet];
  3948. pony.net.ISocketServer.prototype = {
  3949. __class__: pony.net.ISocketServer
  3950. };
  3951. pony.net.SocketClientBase = function(host,port,reconnect,aIsWithLength) {
  3952. if(aIsWithLength == null) aIsWithLength = true;
  3953. if(reconnect == null) reconnect = -1;
  3954. this.reconnectDelay = -1;
  3955. pony.Logable.call(this);
  3956. this.connected = new pony.events.Waiter();
  3957. if(host == null) host = "127.0.0.1";
  3958. this.host = host;
  3959. this.port = port;
  3960. this.reconnectDelay = reconnect;
  3961. var this1 = pony.events.Signal.create(null);
  3962. this.onConnect = this1;
  3963. this.isWithLength = aIsWithLength;
  3964. this._init();
  3965. this.open();
  3966. };
  3967. pony.net.SocketClientBase.__name__ = true;
  3968. pony.net.SocketClientBase.__super__ = pony.Logable;
  3969. pony.net.SocketClientBase.prototype = $extend(pony.Logable.prototype,{
  3970. _init: function() {
  3971. this.closed = true;
  3972. this.id = -1;
  3973. var this1 = pony.events.Signal.create(this);
  3974. this.onData = this1;
  3975. this.onDisconnect = new pony.events.Signal(this);
  3976. }
  3977. ,reconnect: function() {
  3978. if(this.reconnectDelay == 0) {
  3979. haxe.Log.trace("Reconnect",{ fileName : "SocketClientBase.hx", lineNumber : 83, className : "pony.net.SocketClientBase", methodName : "reconnect"});
  3980. this.open();
  3981. } else if(this.reconnectDelay > 0) {
  3982. haxe.Log.trace("Reconnect after " + this.reconnectDelay + " ms",{ fileName : "SocketClientBase.hx", lineNumber : 88, className : "pony.net.SocketClientBase", methodName : "reconnect"});
  3983. haxe.Timer.delay($bind(this,this.open),this.reconnectDelay);
  3984. }
  3985. }
  3986. ,open: function() {
  3987. }
  3988. ,endInit: function() {
  3989. this.closed = false;
  3990. if(this.server != null) pony.events._Signal1.Signal1_Impl_.dispatch(this.server.onConnect,this);
  3991. }
  3992. ,init: function(server,id) {
  3993. this._init();
  3994. this.server = server;
  3995. this.id = id;
  3996. pony.events._Signal1.Signal1_Impl_.add(this.onData,(function($this) {
  3997. var $r;
  3998. var f = (function(_e) {
  3999. return function(event) {
  4000. return pony.events._Signal1.Signal1_Impl_.dispatchEvent(_e,event);
  4001. };
  4002. })(server.onData);
  4003. var l;
  4004. {
  4005. var f1 = pony._Function.Function_Impl_.from(f,1,false,true);
  4006. l = pony.events._Listener.Listener_Impl_._fromFunction(f1);
  4007. }
  4008. $r = l;
  4009. return $r;
  4010. }(this)));
  4011. this.onDisconnect.add((function($this) {
  4012. var $r;
  4013. var f2 = pony._Function.Function_Impl_.from(($_=server.onDisconnect,$bind($_,$_.dispatchEvent)),1,true,true);
  4014. $r = pony.events._Listener.Listener_Impl_._fromFunction(f2);
  4015. return $r;
  4016. }(this)));
  4017. }
  4018. ,send2other: function(data) {
  4019. this.server.send2other(data,this);
  4020. }
  4021. ,joinData: function(bi) {
  4022. if(this.server != null) this.isWithLength = this.server.isWithLength;
  4023. if(this.isWithLength) {
  4024. var size = bi.readInt32();
  4025. pony.events._Signal1.Signal1_Impl_.dispatch(this.onData,new haxe.io.BytesInput(bi.read(size)));
  4026. } else {
  4027. haxe.Log.trace(this.isWithLength,{ fileName : "SocketClientBase.hx", lineNumber : 121, className : "pony.net.SocketClientBase", methodName : "joinData"});
  4028. pony.events._Signal1.Signal1_Impl_.dispatch(this.onData,bi);
  4029. }
  4030. }
  4031. ,destroy: function() {
  4032. this.closed = true;
  4033. var this1 = this.onConnect;
  4034. this1.destroy();
  4035. this1.target;
  4036. this.onConnect = null;
  4037. var this2 = this.onData;
  4038. this2.destroy();
  4039. this2.target;
  4040. this.onData = null;
  4041. }
  4042. ,__class__: pony.net.SocketClientBase
  4043. });
  4044. pony.net.nodejs = {};
  4045. pony.net.nodejs.SocketClient = function(host,port,reconnect,aIsWithLength) {
  4046. pony.net.SocketClientBase.call(this,host,port,reconnect,aIsWithLength);
  4047. };
  4048. pony.net.nodejs.SocketClient.__name__ = true;
  4049. pony.net.nodejs.SocketClient.__super__ = pony.net.SocketClientBase;
  4050. pony.net.nodejs.SocketClient.prototype = $extend(pony.net.SocketClientBase.prototype,{
  4051. open: function() {
  4052. this.socket = js.Node.require("net").connect(this.port,this.host);
  4053. this.socket.on("connect",$bind(this,this.connectHandler));
  4054. this.nodejsInit(this.socket);
  4055. }
  4056. ,nodejsInit: function(s) {
  4057. this.q = new pony.Queue($bind(this,this._send));
  4058. this.socket = s;
  4059. s.on("data",$bind(this,this.dataHandler));
  4060. s.on("end",$bind(this,this.closeHandler));
  4061. s.on("error",$bind(this,this.reconnect));
  4062. this.closed = false;
  4063. if(this.server != null) pony.events._Signal1.Signal1_Impl_.dispatch(this.server.onConnect,this);
  4064. }
  4065. ,closeHandler: function() {
  4066. this.onDisconnect.dispatchArgs([]);
  4067. this.onDisconnect.destroy();
  4068. this.onDisconnect = null;
  4069. }
  4070. ,connectHandler: function() {
  4071. this.closed = false;
  4072. this.connected.end();
  4073. }
  4074. ,send: function(data) {
  4075. this.q.call(data);
  4076. }
  4077. ,_send: function(data) {
  4078. this.socket.write(data.getBytes().getData(),null,($_=this.q,$bind($_,$_.next)));
  4079. }
  4080. ,dataHandler: function(d) {
  4081. this.joinData(new haxe.io.BytesInput(haxe.io.Bytes.ofData(d)));
  4082. }
  4083. ,destroy: function() {
  4084. pony.net.SocketClientBase.prototype.destroy.call(this);
  4085. this.socket.end();
  4086. this.socket = null;
  4087. this.closed = true;
  4088. }
  4089. ,__class__: pony.net.nodejs.SocketClient
  4090. });
  4091. pony.net.SocketClient = function(host,port,reconnect,aIsWithLength) {
  4092. pony.net.nodejs.SocketClient.call(this,host,port,reconnect,aIsWithLength);
  4093. };
  4094. pony.net.SocketClient.__name__ = true;
  4095. pony.net.SocketClient.__interfaces__ = [pony.net.ISocketClient];
  4096. pony.net.SocketClient.__super__ = pony.net.nodejs.SocketClient;
  4097. pony.net.SocketClient.prototype = $extend(pony.net.nodejs.SocketClient.prototype,{
  4098. send: function(data) {
  4099. var bo = new haxe.io.BytesOutput();
  4100. if(this.isWithLength) bo.writeInt32(data.b.b.length);
  4101. bo.write(data.getBytes());
  4102. pony.net.nodejs.SocketClient.prototype.send.call(this,bo);
  4103. }
  4104. ,__class__: pony.net.SocketClient
  4105. });
  4106. pony.net.SocketServerBase = function() {
  4107. this.isWithLength = true;
  4108. this.isAbleToSend = false;
  4109. pony.Logable.call(this);
  4110. var this1 = pony.events.Signal.create(this);
  4111. this.onConnect = this1;
  4112. var this2 = pony.events.Signal.create(this);
  4113. this.onMessage = this2;
  4114. var this3 = pony.events.Signal.create(this);
  4115. this.onError = this3;
  4116. this.onDisconnect = new pony.events.Signal();
  4117. var this4 = pony.events.Signal.create(null);
  4118. this.onData = this4;
  4119. this.onClose = new pony.events.Signal(this);
  4120. this.clients = [];
  4121. this.onDisconnect.add((function($this) {
  4122. var $r;
  4123. var f = pony._Function.Function_Impl_.from($bind($this,$this.removeClient),1,false);
  4124. $r = pony.events._Listener.Listener_Impl_._fromFunction(f);
  4125. return $r;
  4126. }(this)));
  4127. };
  4128. pony.net.SocketServerBase.__name__ = true;
  4129. pony.net.SocketServerBase.__super__ = pony.Logable;
  4130. pony.net.SocketServerBase.prototype = $extend(pony.Logable.prototype,{
  4131. addClient: function() {
  4132. var cl = Type.createEmptyInstance(pony.net.SocketClient);
  4133. cl.isWithLength = this.isWithLength;
  4134. cl.init(this,this.clients.length);
  4135. this.clients.push(cl);
  4136. return cl;
  4137. }
  4138. ,removeClient: function(cl) {
  4139. HxOverrides.remove(this.clients,cl);
  4140. }
  4141. ,send: function(data) {
  4142. var bs = data.getBytes();
  4143. var _g = 0;
  4144. var _g1 = this.clients;
  4145. while(_g < _g1.length) {
  4146. var c = _g1[_g];
  4147. ++_g;
  4148. var b = new haxe.io.BytesOutput();
  4149. b.write(bs);
  4150. c.send(b);
  4151. }
  4152. }
  4153. ,send2other: function(data,exception) {
  4154. var bs = data.getBytes();
  4155. var _g = 0;
  4156. var _g1 = this.clients;
  4157. while(_g < _g1.length) {
  4158. var c = _g1[_g];
  4159. ++_g;
  4160. if(c == exception) continue;
  4161. var b = new haxe.io.BytesOutput();
  4162. b.write(bs);
  4163. c.send(b);
  4164. }
  4165. }
  4166. ,destroy: function() {
  4167. this.onClose.dispatchArgs([]);
  4168. var this1 = this.onData;
  4169. this1.destroy();
  4170. this1.target;
  4171. this.onData = null;
  4172. var this2 = this.onConnect;
  4173. this2.destroy();
  4174. this2.target;
  4175. this.onConnect = null;
  4176. this.onClose.destroy();
  4177. this.onClose = null;
  4178. this.onDisconnect.destroy();
  4179. this.onDisconnect = null;
  4180. }
  4181. ,__class__: pony.net.SocketServerBase
  4182. });
  4183. pony.net.nodejs.SocketServer = function(port) {
  4184. pony.net.SocketServerBase.call(this);
  4185. this.server = js.Node.require("net").createServer(null,null);
  4186. this.server.listen(port,null,$bind(this,this.bound));
  4187. this.server.on("connection",$bind(this,this.connectionHandler));
  4188. };
  4189. pony.net.nodejs.SocketServer.__name__ = true;
  4190. pony.net.nodejs.SocketServer.__super__ = pony.net.SocketServerBase;
  4191. pony.net.nodejs.SocketServer.prototype = $extend(pony.net.SocketServerBase.prototype,{
  4192. bound: function() {
  4193. pony.events._Signal1.Signal1_Impl_.dispatch(this.onMessage,"bound " + Std.string(this.server.address()));
  4194. }
  4195. ,connectionHandler: function(c) {
  4196. this.addClient().nodejsInit(c);
  4197. }
  4198. ,destroy: function() {
  4199. pony.net.SocketServerBase.prototype.destroy.call(this);
  4200. this.server.close(null);
  4201. this.server = null;
  4202. }
  4203. ,__class__: pony.net.nodejs.SocketServer
  4204. });
  4205. pony.net.SocketServer = function(port) {
  4206. pony.net.nodejs.SocketServer.call(this,port);
  4207. };
  4208. pony.net.SocketServer.__name__ = true;
  4209. pony.net.SocketServer.__interfaces__ = [pony.net.ISocketServer];
  4210. pony.net.SocketServer.__super__ = pony.net.nodejs.SocketServer;
  4211. pony.net.SocketServer.prototype = $extend(pony.net.nodejs.SocketServer.prototype,{
  4212. __class__: pony.net.SocketServer
  4213. });
  4214. pony.text = {};
  4215. pony.text.TextTools = function() { };
  4216. pony.text.TextTools.__name__ = true;
  4217. pony.text.TextTools.exists = function(s,ch) {
  4218. return s.indexOf(ch) != -1;
  4219. };
  4220. pony.text.TextTools.repeat = function(s,count) {
  4221. var r = "";
  4222. while(count-- > 0) r += s;
  4223. return r;
  4224. };
  4225. pony.text.TextTools.isTrue = function(s) {
  4226. return StringTools.trim(s.toLowerCase()) == "true";
  4227. };
  4228. pony.text.TextTools.explode = function(s,delimiters) {
  4229. var r = [s];
  4230. var _g = 0;
  4231. while(_g < delimiters.length) {
  4232. var d = delimiters[_g];
  4233. ++_g;
  4234. var sr = [];
  4235. var _g1 = 0;
  4236. while(_g1 < r.length) {
  4237. var e = r[_g1];
  4238. ++_g1;
  4239. var _g2 = 0;
  4240. var _g3 = e.split(d);
  4241. while(_g2 < _g3.length) {
  4242. var se = _g3[_g2];
  4243. ++_g2;
  4244. if(se != "") sr.push(se);
  4245. }
  4246. }
  4247. r = sr;
  4248. }
  4249. return r;
  4250. };
  4251. pony.text.TextTools.parsePercent = function(s) {
  4252. if(s.indexOf("%") != -1) return Std.parseFloat(HxOverrides.substr(s,0,s.length - 1)) / 100; else return Std.parseFloat(s);
  4253. };
  4254. pony.text.TextTools.last = function(s) {
  4255. return s.charAt(s.length - 1);
  4256. };
  4257. function $iterator(o) { if( o instanceof Array ) return function() { return HxOverrides.iter(o); }; return typeof(o.iterator) == 'function' ? $bind(o,o.iterator) : o.iterator; }
  4258. var $_, $fid = 0;
  4259. function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $fid++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = function(){ return f.method.apply(f.scope, arguments); }; f.scope = o; f.method = m; o.hx__closures__[m.__id__] = f; } return f; }
  4260. if(Array.prototype.indexOf) HxOverrides.indexOf = function(a,o,i) {
  4261. return Array.prototype.indexOf.call(a,o,i);
  4262. };
  4263. String.prototype.__class__ = String;
  4264. String.__name__ = true;
  4265. Array.__name__ = true;
  4266. var Int = { __name__ : ["Int"]};
  4267. var Dynamic = { __name__ : ["Dynamic"]};
  4268. var Float = Number;
  4269. Float.__name__ = ["Float"];
  4270. var Bool = Boolean;
  4271. Bool.__ename__ = ["Bool"];
  4272. var Class = { __name__ : ["Class"]};
  4273. var Enum = { };
  4274. if(Array.prototype.map == null) Array.prototype.map = function(f) {
  4275. var a = [];
  4276. var _g1 = 0;
  4277. var _g = this.length;
  4278. while(_g1 < _g) {
  4279. var i = _g1++;
  4280. a[i] = f(this[i]);
  4281. }
  4282. return a;
  4283. };
  4284. Xml.Element = "element";
  4285. Xml.PCData = "pcdata";
  4286. Xml.CData = "cdata";
  4287. Xml.Comment = "comment";
  4288. Xml.DocType = "doctype";
  4289. Xml.ProcessingInstruction = "processingInstruction";
  4290. Xml.Document = "document";
  4291. js.Node.setTimeout = setTimeout;
  4292. js.Node.clearTimeout = clearTimeout;
  4293. js.Node.setInterval = setInterval;
  4294. js.Node.clearInterval = clearInterval;
  4295. js.Node.global = global;
  4296. js.Node.process = process;
  4297. js.Node.require = require;
  4298. js.Node.console = console;
  4299. js.Node.module = module;
  4300. js.Node.stringify = JSON.stringify;
  4301. js.Node.parse = JSON.parse;
  4302. var version = HxOverrides.substr(js.Node.process.version,1,null).split(".").map(Std.parseInt);
  4303. if(version[0] > 0 || version[1] >= 9) {
  4304. js.Node.setImmediate = setImmediate;
  4305. js.Node.clearImmediate = clearImmediate;
  4306. }
  4307. pony._Function.Function_Impl_.unusedCount = 0;
  4308. pony._Function.Function_Impl_.list = new pony.Dictionary(1);
  4309. pony._Function.Function_Impl_.counter = -1;
  4310. pony._Function.Function_Impl_.searchFree = false;
  4311. pony.events._Listener.Listener_Impl_.flist = new haxe.ds.IntMap();
  4312. haxe.xml.Parser.escapes = (function($this) {
  4313. var $r;
  4314. var h = new haxe.ds.StringMap();
  4315. h.set("lt","<");
  4316. h.set("gt",">");
  4317. h.set("amp","&");
  4318. h.set("quot","\"");
  4319. h.set("apos","'");
  4320. h.set("nbsp",String.fromCharCode(160));
  4321. $r = h;
  4322. return $r;
  4323. }(this));
  4324. js.Boot.__toStr = {}.toString;
  4325. js.NodeC.UTF8 = "utf8";
  4326. js.NodeC.ASCII = "ascii";
  4327. js.NodeC.BINARY = "binary";
  4328. js.NodeC.BASE64 = "base64";
  4329. js.NodeC.HEX = "hex";
  4330. js.NodeC.EVENT_EVENTEMITTER_NEWLISTENER = "newListener";
  4331. js.NodeC.EVENT_EVENTEMITTER_ERROR = "error";
  4332. js.NodeC.EVENT_STREAM_DATA = "data";
  4333. js.NodeC.EVENT_STREAM_END = "end";
  4334. js.NodeC.EVENT_STREAM_ERROR = "error";
  4335. js.NodeC.EVENT_STREAM_CLOSE = "close";
  4336. js.NodeC.EVENT_STREAM_DRAIN = "drain";
  4337. js.NodeC.EVENT_STREAM_CONNECT = "connect";
  4338. js.NodeC.EVENT_STREAM_SECURE = "secure";
  4339. js.NodeC.EVENT_STREAM_TIMEOUT = "timeout";
  4340. js.NodeC.EVENT_STREAM_PIPE = "pipe";
  4341. js.NodeC.EVENT_PROCESS_EXIT = "exit";
  4342. js.NodeC.EVENT_PROCESS_UNCAUGHTEXCEPTION = "uncaughtException";
  4343. js.NodeC.EVENT_PROCESS_SIGINT = "SIGINT";
  4344. js.NodeC.EVENT_PROCESS_SIGUSR1 = "SIGUSR1";
  4345. js.NodeC.EVENT_CHILDPROCESS_EXIT = "exit";
  4346. js.NodeC.EVENT_HTTPSERVER_REQUEST = "request";
  4347. js.NodeC.EVENT_HTTPSERVER_CONNECTION = "connection";
  4348. js.NodeC.EVENT_HTTPSERVER_CLOSE = "close";
  4349. js.NodeC.EVENT_HTTPSERVER_UPGRADE = "upgrade";
  4350. js.NodeC.EVENT_HTTPSERVER_CLIENTERROR = "clientError";
  4351. js.NodeC.EVENT_HTTPSERVERREQUEST_DATA = "data";
  4352. js.NodeC.EVENT_HTTPSERVERREQUEST_END = "end";
  4353. js.NodeC.EVENT_CLIENTREQUEST_RESPONSE = "response";
  4354. js.NodeC.EVENT_CLIENTRESPONSE_DATA = "data";
  4355. js.NodeC.EVENT_CLIENTRESPONSE_END = "end";
  4356. js.NodeC.EVENT_NETSERVER_CONNECTION = "connection";
  4357. js.NodeC.EVENT_NETSERVER_CLOSE = "close";
  4358. js.NodeC.FILE_READ = "r";
  4359. js.NodeC.FILE_READ_APPEND = "r+";
  4360. js.NodeC.FILE_WRITE = "w";
  4361. js.NodeC.FILE_WRITE_APPEND = "a+";
  4362. js.NodeC.FILE_READWRITE = "a";
  4363. js.NodeC.FILE_READWRITE_APPEND = "a+";
  4364. Main.main();
  4365. })();