PageRenderTime 43ms CodeModel.GetById 7ms RepoModel.GetById 0ms app.codeStats 1ms

/socketTests/bin/main.js

http://github.com/AxGord/Pony
JavaScript | 2649 lines | 2646 code | 1 blank | 2 comment | 620 complexity | a449031d7d88e3397f5fb60f53a8c915 MD5 | raw file
Possible License(s): MIT

Large files files are truncated, but you can click here to view the full file

  1. // Generated by Haxe
  2. (function (console, $global) { "use strict";
  3. var $estr = function() { return js_Boot.__string_rec(this,''); };
  4. function $extend(from, fields) {
  5. function Inherit() {} Inherit.prototype = from; var proto = new Inherit();
  6. for (var name in fields) proto[name] = fields[name];
  7. if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString;
  8. return proto;
  9. }
  10. var EReg = function(r,opt) {
  11. opt = opt.split("u").join("");
  12. this.r = new RegExp(r,opt);
  13. };
  14. EReg.__name__ = ["EReg"];
  15. EReg.prototype = {
  16. r: null
  17. ,match: function(s) {
  18. if(this.r.global) this.r.lastIndex = 0;
  19. this.r.m = this.r.exec(s);
  20. this.r.s = s;
  21. return this.r.m != null;
  22. }
  23. ,matched: function(n) {
  24. var tmp;
  25. if(this.r.m != null && n >= 0 && n < this.r.m.length) tmp = this.r.m[n]; else throw new js__$Boot_HaxeError("EReg::matched");
  26. return tmp;
  27. }
  28. ,__class__: EReg
  29. };
  30. var HxOverrides = function() { };
  31. HxOverrides.__name__ = ["HxOverrides"];
  32. HxOverrides.cca = function(s,index) {
  33. var x = s.charCodeAt(index);
  34. if(x != x) return undefined;
  35. return x;
  36. };
  37. HxOverrides.substr = function(s,pos,len) {
  38. if(len == null) len = s.length; else if(len < 0) {
  39. if(pos == 0) len = s.length + len; else return "";
  40. }
  41. if(pos < 0) {
  42. pos = s.length + pos;
  43. if(pos < 0) pos = 0;
  44. }
  45. return s.substr(pos,len);
  46. };
  47. HxOverrides.indexOf = function(a,obj,i) {
  48. var len = a.length;
  49. if(i < 0) {
  50. i += len;
  51. if(i < 0) i = 0;
  52. }
  53. while(i < len) {
  54. if(a[i] === obj) return i;
  55. i++;
  56. }
  57. return -1;
  58. };
  59. HxOverrides.remove = function(a,obj) {
  60. var i = HxOverrides.indexOf(a,obj,0);
  61. if(i == -1) return false;
  62. a.splice(i,1);
  63. return true;
  64. };
  65. HxOverrides.iter = function(a) {
  66. return { cur : 0, arr : a, hasNext : function() {
  67. return this.cur < this.arr.length;
  68. }, next : function() {
  69. return this.arr[this.cur++];
  70. }};
  71. };
  72. var IntIterator = function(min,max) {
  73. this.min = min;
  74. this.max = max;
  75. };
  76. IntIterator.__name__ = ["IntIterator"];
  77. IntIterator.prototype = {
  78. min: null
  79. ,max: null
  80. ,__class__: IntIterator
  81. };
  82. var Lambda = function() { };
  83. Lambda.__name__ = ["Lambda"];
  84. Lambda.exists = function(it,f) {
  85. var $it0 = $iterator(it)();
  86. while( $it0.hasNext() ) {
  87. var x = $it0.next();
  88. if(f(x)) return true;
  89. }
  90. return false;
  91. };
  92. var List = function() {
  93. this.length = 0;
  94. };
  95. List.__name__ = ["List"];
  96. List.prototype = {
  97. h: null
  98. ,q: null
  99. ,length: null
  100. ,add: function(item) {
  101. var x = [item];
  102. if(this.h == null) this.h = x; else this.q[1] = x;
  103. this.q = x;
  104. this.length++;
  105. }
  106. ,push: function(item) {
  107. var x = [item,this.h];
  108. this.h = x;
  109. if(this.q == null) this.q = x;
  110. this.length++;
  111. }
  112. ,pop: function() {
  113. if(this.h == null) return null;
  114. var x = this.h[0];
  115. this.h = this.h[1];
  116. if(this.h == null) this.q = null;
  117. this.length--;
  118. return x;
  119. }
  120. ,remove: function(v) {
  121. var prev = null;
  122. var l = this.h;
  123. while(l != null) {
  124. if(l[0] == v) {
  125. if(prev == null) this.h = l[1]; else prev[1] = l[1];
  126. if(this.q == l) this.q = prev;
  127. this.length--;
  128. return true;
  129. }
  130. prev = l;
  131. l = l[1];
  132. }
  133. return false;
  134. }
  135. ,iterator: function() {
  136. return new _$List_ListIterator(this.h);
  137. }
  138. ,__class__: List
  139. };
  140. var _$List_ListIterator = function(head) {
  141. this.head = head;
  142. this.val = null;
  143. };
  144. _$List_ListIterator.__name__ = ["_List","ListIterator"];
  145. _$List_ListIterator.prototype = {
  146. head: null
  147. ,val: null
  148. ,hasNext: function() {
  149. return this.head != null;
  150. }
  151. ,next: function() {
  152. this.val = this.head[0];
  153. this.head = this.head[1];
  154. return this.val;
  155. }
  156. ,__class__: _$List_ListIterator
  157. };
  158. var Main = function() { };
  159. Main.__name__ = ["Main"];
  160. Main.main = function() {
  161. js_Node.require("source-map-support").install();
  162. haxe_Log.trace("Zero part",{ fileName : "Main.hx", lineNumber : 38, className : "Main", methodName : "main"});
  163. var serv = null;
  164. var cl = new pony_net_SocketClient(null,13579,100);
  165. var tmp;
  166. if(cl.eLog == null) {
  167. var tmp1;
  168. var this2;
  169. this2 = new pony_Priority(null,false,true);
  170. this2.compare = pony_events__$Event2_Event2_$Impl_$.compare;
  171. tmp1 = this2;
  172. tmp = cl.eLog = tmp1;
  173. } else tmp = cl.eLog;
  174. var this1 = tmp;
  175. var listener = { once : false, listener : pony_events_Listener2Type.LFunction2(haxe_Log.trace)};
  176. this1.add(listener);
  177. var tmp2;
  178. if(cl.eError == null) {
  179. var tmp3;
  180. var this4;
  181. this4 = new pony_Priority(null,false,true);
  182. this4.compare = pony_events__$Event2_Event2_$Impl_$.compare;
  183. tmp3 = this4;
  184. tmp2 = cl.eError = tmp3;
  185. } else tmp2 = cl.eError;
  186. var this3 = tmp2;
  187. var listener1 = { once : false, listener : pony_events_Listener2Type.LFunction2(haxe_Log.trace)};
  188. this3.add(listener1);
  189. var tmp4;
  190. if(cl.eConnect == null) {
  191. var tmp5;
  192. var this6;
  193. this6 = new pony_Priority(null,false,true);
  194. this6.compare = pony_events__$Event1_Event1_$Impl_$.compare;
  195. tmp5 = this6;
  196. tmp4 = cl.eConnect = tmp5;
  197. } else tmp4 = cl.eConnect;
  198. var this5 = tmp4;
  199. var listener2 = { once : false, listener : pony_events_Listener1Type.LFunction0(function() {
  200. haxe_Log.trace("Connected",{ fileName : "Main.hx", lineNumber : 45, className : "Main", methodName : "main"});
  201. cl.destroy();
  202. serv.destroy();
  203. if(Main.testCount % 4 != 0) throw new js__$Boot_HaxeError("Wrong test count");
  204. pony_tests_AsyncTests.init(Main.testCount);
  205. Main.firstTest();
  206. })};
  207. this5.add(listener2);
  208. haxe_Timer.delay(function() {
  209. serv = new pony_net_SocketServer(13579);
  210. },100);
  211. };
  212. Main.firstTest = function() {
  213. haxe_Log.trace("First part",{ fileName : "Main.hx", lineNumber : 63, className : "Main", methodName : "firstTest"});
  214. var server = Main.createServer(6001);
  215. var _g1 = 0;
  216. var _g = Main.partCount;
  217. while(_g1 < _g) {
  218. var i = _g1++;
  219. var tmp;
  220. var i1 = [i];
  221. tmp = (function(i1) {
  222. return function() {
  223. return Main.createClient(i1[0]);
  224. };
  225. })(i1);
  226. haxe_Timer.delay(tmp,Main.delay + Main.delay * i);
  227. }
  228. pony_tests_AsyncTests.wait(new IntIterator(0,Main.blockCount),function() {
  229. haxe_Log.trace("Second part",{ fileName : "Main.hx", lineNumber : 68, className : "Main", methodName : "firstTest"});
  230. server.destroy();
  231. var server1 = Main.createServer(6002);
  232. var _g11 = Main.blockCount;
  233. var _g2 = Main.blockCount + Main.partCount;
  234. while(_g11 < _g2) {
  235. var i2 = _g11++;
  236. var tmp1;
  237. var i3 = [i2];
  238. tmp1 = (function(i3) {
  239. return function() {
  240. return Main.createClient(i3[0]);
  241. };
  242. })(i3);
  243. haxe_Timer.delay(tmp1,Main.delay + Main.delay * (i2 - Main.blockCount));
  244. }
  245. pony_tests_AsyncTests.wait(new IntIterator(Main.blockCount,Main.testCount),function() {
  246. server1.destroy();
  247. Main.finish = true;
  248. });
  249. });
  250. };
  251. Main.createServer = function(aPort) {
  252. Main.port = aPort;
  253. var server = new pony_net_SocketServer(aPort);
  254. var listener = { once : false, listener : pony_events_Listener1Type.LFunction1(function(cl) {
  255. var bo = new haxe_io_BytesOutput();
  256. bo.writeString("hi world");
  257. cl.send(bo);
  258. })};
  259. server.eConnect.add(listener);
  260. var listener1 = { once : false, listener : pony_events_Listener2Type.LFunction1(function(bi) {
  261. var i = bi.readInt32();
  262. var b = pony_Tools.readStr(bi);
  263. pony_tests_AsyncTests.assertList.push({ a : "hello user", b : b, pos : { fileName : "Main.hx", lineNumber : 92, className : "Main", methodName : "createServer"}});
  264. pony_tests_AsyncTests.setFlag(Main.partCount + i,{ fileName : "Main.hx", lineNumber : 93, className : "Main", methodName : "createServer"});
  265. })};
  266. server.eData.add(listener1);
  267. return server;
  268. };
  269. Main.createClient = function(i) {
  270. var client = new pony_net_SocketClient(null,Main.port);
  271. var listener = { once : false, listener : pony_events_Listener2Type.LFunction1(function(s) {
  272. pony_tests_AsyncTests.assertList.push({ a : s, b : "hi world", pos : { fileName : "Main.hx", lineNumber : 102, className : "Main", methodName : "createClient"}});
  273. var bo = new haxe_io_BytesOutput();
  274. bo.writeInt32(i);
  275. bo.writeInt32("hello user".length);
  276. bo.writeString("hello user");
  277. client.send(bo);
  278. pony_tests_AsyncTests.setFlag(i,{ fileName : "Main.hx", lineNumber : 107, className : "Main", methodName : "createClient"});
  279. client.destroy();
  280. client = null;
  281. })};
  282. listener.once = true;
  283. client.eString.add(listener,0);
  284. return client;
  285. };
  286. Math.__name__ = ["Math"];
  287. var Reflect = function() { };
  288. Reflect.__name__ = ["Reflect"];
  289. Reflect.field = function(o,field) {
  290. try {
  291. return o[field];
  292. } catch( e ) {
  293. haxe_CallStack.lastException = e;
  294. if (e instanceof js__$Boot_HaxeError) e = e.val;
  295. return null;
  296. }
  297. };
  298. Reflect.isFunction = function(f) {
  299. return typeof(f) == "function" && !(f.__name__ || f.__ename__);
  300. };
  301. Reflect.makeVarArgs = function(f) {
  302. return function() {
  303. var a = Array.prototype.slice.call(arguments);
  304. return f(a);
  305. };
  306. };
  307. var Std = function() { };
  308. Std.__name__ = ["Std"];
  309. Std.string = function(s) {
  310. return js_Boot.__string_rec(s,"");
  311. };
  312. Std.parseInt = function(x) {
  313. var v = parseInt(x,10);
  314. if(v == 0 && (HxOverrides.cca(x,1) == 120 || HxOverrides.cca(x,1) == 88)) v = parseInt(x);
  315. if(isNaN(v)) return null;
  316. return v;
  317. };
  318. var StringBuf = function() {
  319. this.b = "";
  320. };
  321. StringBuf.__name__ = ["StringBuf"];
  322. StringBuf.prototype = {
  323. b: null
  324. ,__class__: StringBuf
  325. };
  326. var StringTools = function() { };
  327. StringTools.__name__ = ["StringTools"];
  328. StringTools.htmlEscape = function(s,quotes) {
  329. s = s.split("&").join("&amp;").split("<").join("&lt;").split(">").join("&gt;");
  330. return quotes?s.split("\"").join("&quot;").split("'").join("&#039;"):s;
  331. };
  332. StringTools.startsWith = function(s,start) {
  333. return s.length >= start.length && HxOverrides.substr(s,0,start.length) == start;
  334. };
  335. StringTools.isSpace = function(s,pos) {
  336. var c = HxOverrides.cca(s,pos);
  337. return c > 8 && c < 14 || c == 32;
  338. };
  339. StringTools.ltrim = function(s) {
  340. var l = s.length;
  341. var r = 0;
  342. while(r < l && StringTools.isSpace(s,r)) r++;
  343. if(r > 0) return HxOverrides.substr(s,r,l - r); else return s;
  344. };
  345. StringTools.rtrim = function(s) {
  346. var l = s.length;
  347. var r = 0;
  348. while(r < l && StringTools.isSpace(s,l - r - 1)) r++;
  349. if(r > 0) return HxOverrides.substr(s,0,l - r); else return s;
  350. };
  351. StringTools.trim = function(s) {
  352. return StringTools.ltrim(StringTools.rtrim(s));
  353. };
  354. var Type = function() { };
  355. Type.__name__ = ["Type"];
  356. Type.getClassName = function(c) {
  357. var a = c.__name__;
  358. if(a == null) return null;
  359. return a.join(".");
  360. };
  361. Type.createEmptyInstance = function(cl) {
  362. function empty() {}; empty.prototype = cl.prototype;
  363. return new empty();
  364. };
  365. Type.getInstanceFields = function(c) {
  366. var a = [];
  367. for(var i in c.prototype) a.push(i);
  368. HxOverrides.remove(a,"__class__");
  369. HxOverrides.remove(a,"__properties__");
  370. return a;
  371. };
  372. var _$UInt_UInt_$Impl_$ = {};
  373. _$UInt_UInt_$Impl_$.__name__ = ["_UInt","UInt_Impl_"];
  374. _$UInt_UInt_$Impl_$.gt = function(a,b) {
  375. var aNeg = a < 0;
  376. var bNeg = b < 0;
  377. return aNeg != bNeg?aNeg:a > b;
  378. };
  379. _$UInt_UInt_$Impl_$.gte = function(a,b) {
  380. var aNeg = a < 0;
  381. var bNeg = b < 0;
  382. return aNeg != bNeg?aNeg:a >= b;
  383. };
  384. var haxe_StackItem = { __ename__ : true, __constructs__ : ["CFunction","Module","FilePos","Method","LocalFunction"] };
  385. haxe_StackItem.CFunction = ["CFunction",0];
  386. haxe_StackItem.CFunction.toString = $estr;
  387. haxe_StackItem.CFunction.__enum__ = haxe_StackItem;
  388. haxe_StackItem.Module = function(m) { var $x = ["Module",1,m]; $x.__enum__ = haxe_StackItem; $x.toString = $estr; return $x; };
  389. haxe_StackItem.FilePos = function(s,file,line) { var $x = ["FilePos",2,s,file,line]; $x.__enum__ = haxe_StackItem; $x.toString = $estr; return $x; };
  390. haxe_StackItem.Method = function(classname,method) { var $x = ["Method",3,classname,method]; $x.__enum__ = haxe_StackItem; $x.toString = $estr; return $x; };
  391. haxe_StackItem.LocalFunction = function(v) { var $x = ["LocalFunction",4,v]; $x.__enum__ = haxe_StackItem; $x.toString = $estr; return $x; };
  392. var haxe_CallStack = function() { };
  393. haxe_CallStack.__name__ = ["haxe","CallStack"];
  394. haxe_CallStack.getStack = function(e) {
  395. if(e == null) return [];
  396. var oldValue = Error.prepareStackTrace;
  397. Error.prepareStackTrace = function(error,callsites) {
  398. var stack = [];
  399. var _g = 0;
  400. while(_g < callsites.length) {
  401. var site = callsites[_g];
  402. ++_g;
  403. if(haxe_CallStack.wrapCallSite != null) site = haxe_CallStack.wrapCallSite(site);
  404. var method = null;
  405. var fullName = site.getFunctionName();
  406. if(fullName != null) {
  407. var idx = fullName.lastIndexOf(".");
  408. if(idx >= 0) {
  409. var className = HxOverrides.substr(fullName,0,idx);
  410. var methodName = HxOverrides.substr(fullName,idx + 1,null);
  411. method = haxe_StackItem.Method(className,methodName);
  412. }
  413. }
  414. stack.push(haxe_StackItem.FilePos(method,site.getFileName(),site.getLineNumber()));
  415. }
  416. return stack;
  417. };
  418. var a = haxe_CallStack.makeStack(e.stack);
  419. Error.prepareStackTrace = oldValue;
  420. return a;
  421. };
  422. haxe_CallStack.exceptionStack = function() {
  423. return haxe_CallStack.getStack(haxe_CallStack.lastException);
  424. };
  425. haxe_CallStack.toString = function(stack) {
  426. var b = new StringBuf();
  427. var _g = 0;
  428. while(_g < stack.length) {
  429. var s = stack[_g];
  430. ++_g;
  431. b.b += "\nCalled from ";
  432. haxe_CallStack.itemToString(b,s);
  433. }
  434. return b.b;
  435. };
  436. haxe_CallStack.itemToString = function(b,s) {
  437. switch(s[1]) {
  438. case 0:
  439. b.b += "a C function";
  440. break;
  441. case 1:
  442. var m = s[2];
  443. b.b += "module ";
  444. b.b += m == null?"null":"" + m;
  445. break;
  446. case 2:
  447. var line = s[4];
  448. var file = s[3];
  449. var s1 = s[2];
  450. if(s1 != null) {
  451. haxe_CallStack.itemToString(b,s1);
  452. b.b += " (";
  453. }
  454. b.b += file == null?"null":"" + file;
  455. b.b += " line ";
  456. b.b += line == null?"null":"" + line;
  457. if(s1 != null) b.b += ")";
  458. break;
  459. case 3:
  460. var meth = s[3];
  461. var cname = s[2];
  462. b.b += cname == null?"null":"" + cname;
  463. b.b += ".";
  464. b.b += meth == null?"null":"" + meth;
  465. break;
  466. case 4:
  467. var n = s[2];
  468. b.b += "local function #";
  469. b.b += n == null?"null":"" + n;
  470. break;
  471. }
  472. };
  473. haxe_CallStack.makeStack = function(s) {
  474. if(s == null) return []; else if(typeof(s) == "string") {
  475. var stack = s.split("\n");
  476. if(stack[0] == "Error") stack.shift();
  477. var m = [];
  478. var rie10 = new EReg("^ at ([A-Za-z0-9_. ]+) \\(([^)]+):([0-9]+):([0-9]+)\\)$","");
  479. var _g = 0;
  480. while(_g < stack.length) {
  481. var line = stack[_g];
  482. ++_g;
  483. if(rie10.match(line)) {
  484. var path = rie10.matched(1).split(".");
  485. var meth = path.pop();
  486. var file = rie10.matched(2);
  487. var line1 = Std.parseInt(rie10.matched(3));
  488. m.push(haxe_StackItem.FilePos(meth == "Anonymous function"?haxe_StackItem.LocalFunction():meth == "Global code"?null:haxe_StackItem.Method(path.join("."),meth),file,line1));
  489. } else m.push(haxe_StackItem.Module(StringTools.trim(line)));
  490. }
  491. return m;
  492. } else return s;
  493. };
  494. var haxe_IMap = function() { };
  495. haxe_IMap.__name__ = ["haxe","IMap"];
  496. var haxe_Log = function() { };
  497. haxe_Log.__name__ = ["haxe","Log"];
  498. haxe_Log.trace = function(v,infos) {
  499. js_Boot.__trace(v,infos);
  500. };
  501. var haxe_Timer = function(time_ms) {
  502. var me = this;
  503. this.id = setInterval(function() {
  504. me.run();
  505. },time_ms);
  506. };
  507. haxe_Timer.__name__ = ["haxe","Timer"];
  508. haxe_Timer.delay = function(f,time_ms) {
  509. var t = new haxe_Timer(time_ms);
  510. t.run = function() {
  511. t.stop();
  512. f();
  513. };
  514. return t;
  515. };
  516. haxe_Timer.prototype = {
  517. id: null
  518. ,stop: function() {
  519. if(this.id == null) return;
  520. clearInterval(this.id);
  521. this.id = null;
  522. }
  523. ,run: function() {
  524. }
  525. ,__class__: haxe_Timer
  526. };
  527. var haxe_ds_IntMap = function() {
  528. this.h = { };
  529. };
  530. haxe_ds_IntMap.__name__ = ["haxe","ds","IntMap"];
  531. haxe_ds_IntMap.__interfaces__ = [haxe_IMap];
  532. haxe_ds_IntMap.prototype = {
  533. h: null
  534. ,remove: function(key) {
  535. if(!this.h.hasOwnProperty(key)) return false;
  536. delete(this.h[key]);
  537. return true;
  538. }
  539. ,keys: function() {
  540. var a = [];
  541. for( var key in this.h ) {
  542. if(this.h.hasOwnProperty(key)) a.push(key | 0);
  543. }
  544. return HxOverrides.iter(a);
  545. }
  546. ,iterator: function() {
  547. return { ref : this.h, it : this.keys(), hasNext : function() {
  548. return this.it.hasNext();
  549. }, next : function() {
  550. var i = this.it.next();
  551. return this.ref[i];
  552. }};
  553. }
  554. ,__class__: haxe_ds_IntMap
  555. };
  556. var haxe_io_Bytes = function(length,b) {
  557. this.length = length;
  558. this.b = b;
  559. };
  560. haxe_io_Bytes.__name__ = ["haxe","io","Bytes"];
  561. haxe_io_Bytes.alloc = function(length) {
  562. return new haxe_io_Bytes(length,new Buffer(length));
  563. };
  564. haxe_io_Bytes.ofString = function(s) {
  565. var nb = new Buffer(s,"utf8");
  566. return new haxe_io_Bytes(nb.length,nb);
  567. };
  568. haxe_io_Bytes.ofData = function(b) {
  569. return new haxe_io_Bytes(b.length,b);
  570. };
  571. haxe_io_Bytes.prototype = {
  572. length: null
  573. ,b: null
  574. ,getString: function(pos,len) {
  575. if(pos < 0 || len < 0 || pos + len > this.length) throw new js__$Boot_HaxeError(haxe_io_Error.OutsideBounds);
  576. var s = "";
  577. var b = this.b;
  578. var fcc = String.fromCharCode;
  579. var i = pos;
  580. var max = pos + len;
  581. while(i < max) {
  582. var c = b[i++];
  583. if(c < 128) {
  584. if(c == 0) break;
  585. s += fcc(c);
  586. } else if(c < 224) s += fcc((c & 63) << 6 | b[i++] & 127); else if(c < 240) {
  587. var c2 = b[i++];
  588. s += fcc((c & 31) << 12 | (c2 & 127) << 6 | b[i++] & 127);
  589. } else {
  590. var c21 = b[i++];
  591. var c3 = b[i++];
  592. s += fcc((c & 15) << 18 | (c21 & 127) << 12 | c3 << 6 & 127 | b[i++] & 127);
  593. }
  594. }
  595. return s;
  596. }
  597. ,toString: function() {
  598. return this.getString(0,this.length);
  599. }
  600. ,__class__: haxe_io_Bytes
  601. };
  602. var haxe_io_BytesBuffer = function() {
  603. this.b = [];
  604. };
  605. haxe_io_BytesBuffer.__name__ = ["haxe","io","BytesBuffer"];
  606. haxe_io_BytesBuffer.prototype = {
  607. b: null
  608. ,getBytes: function() {
  609. var nb = new Buffer(this.b);
  610. var bytes = new haxe_io_Bytes(nb.length,nb);
  611. this.b = null;
  612. return bytes;
  613. }
  614. ,__class__: haxe_io_BytesBuffer
  615. };
  616. var haxe_io_Input = function() { };
  617. haxe_io_Input.__name__ = ["haxe","io","Input"];
  618. haxe_io_Input.prototype = {
  619. bigEndian: null
  620. ,readByte: function() {
  621. throw new js__$Boot_HaxeError("Not implemented");
  622. }
  623. ,readBytes: function(s,pos,len) {
  624. var k = len;
  625. var b = s.b;
  626. if(pos < 0 || len < 0 || pos + len > s.length) throw new js__$Boot_HaxeError(haxe_io_Error.OutsideBounds);
  627. while(k > 0) {
  628. b[pos] = this.readByte();
  629. pos++;
  630. k--;
  631. }
  632. return len;
  633. }
  634. ,readFullBytes: function(s,pos,len) {
  635. while(len > 0) {
  636. var k = this.readBytes(s,pos,len);
  637. pos += k;
  638. len -= k;
  639. }
  640. }
  641. ,read: function(nbytes) {
  642. var s = haxe_io_Bytes.alloc(nbytes);
  643. var p = 0;
  644. while(nbytes > 0) {
  645. var k = this.readBytes(s,p,nbytes);
  646. if(k == 0) throw new js__$Boot_HaxeError(haxe_io_Error.Blocked);
  647. p += k;
  648. nbytes -= k;
  649. }
  650. return s;
  651. }
  652. ,readInt32: function() {
  653. var ch1 = this.readByte();
  654. var ch2 = this.readByte();
  655. var ch3 = this.readByte();
  656. var ch4 = this.readByte();
  657. return this.bigEndian?ch4 | ch3 << 8 | ch2 << 16 | ch1 << 24:ch1 | ch2 << 8 | ch3 << 16 | ch4 << 24;
  658. }
  659. ,readString: function(len) {
  660. var b = haxe_io_Bytes.alloc(len);
  661. this.readFullBytes(b,0,len);
  662. return b.toString();
  663. }
  664. ,__class__: haxe_io_Input
  665. };
  666. var haxe_io_BytesInput = function(b,pos,len) {
  667. if(pos == null) pos = 0;
  668. if(len == null) len = b.length - pos;
  669. if(pos < 0 || len < 0 || pos + len > b.length) throw new js__$Boot_HaxeError(haxe_io_Error.OutsideBounds);
  670. this.b = b.b;
  671. this.pos = pos;
  672. this.len = len;
  673. this.totlen = len;
  674. };
  675. haxe_io_BytesInput.__name__ = ["haxe","io","BytesInput"];
  676. haxe_io_BytesInput.__super__ = haxe_io_Input;
  677. haxe_io_BytesInput.prototype = $extend(haxe_io_Input.prototype,{
  678. b: null
  679. ,pos: null
  680. ,len: null
  681. ,totlen: null
  682. ,readByte: function() {
  683. if(this.len == 0) throw new js__$Boot_HaxeError(new haxe_io_Eof());
  684. this.len--;
  685. return this.b[this.pos++];
  686. }
  687. ,readBytes: function(buf,pos,len) {
  688. if(pos < 0 || len < 0 || pos + len > buf.length) throw new js__$Boot_HaxeError(haxe_io_Error.OutsideBounds);
  689. if(this.len == 0 && len > 0) throw new js__$Boot_HaxeError(new haxe_io_Eof());
  690. if(this.len < len) len = this.len;
  691. var b1 = this.b;
  692. var b2 = buf.b;
  693. var _g = 0;
  694. while(_g < len) {
  695. var i = _g++;
  696. b2[pos + i] = b1[this.pos + i];
  697. }
  698. this.pos += len;
  699. this.len -= len;
  700. return len;
  701. }
  702. ,__class__: haxe_io_BytesInput
  703. });
  704. var haxe_io_Output = function() { };
  705. haxe_io_Output.__name__ = ["haxe","io","Output"];
  706. haxe_io_Output.prototype = {
  707. bigEndian: null
  708. ,writeByte: function(c) {
  709. throw new js__$Boot_HaxeError("Not implemented");
  710. }
  711. ,writeBytes: function(s,pos,len) {
  712. var k = len;
  713. var b = s.b;
  714. if(pos < 0 || len < 0 || pos + len > s.length) throw new js__$Boot_HaxeError(haxe_io_Error.OutsideBounds);
  715. while(k > 0) {
  716. this.writeByte(b[pos]);
  717. pos++;
  718. k--;
  719. }
  720. return len;
  721. }
  722. ,write: function(s) {
  723. var l = s.length;
  724. var p = 0;
  725. while(l > 0) {
  726. var k = this.writeBytes(s,p,l);
  727. if(k == 0) throw new js__$Boot_HaxeError(haxe_io_Error.Blocked);
  728. p += k;
  729. l -= k;
  730. }
  731. }
  732. ,writeFullBytes: function(s,pos,len) {
  733. while(len > 0) {
  734. var k = this.writeBytes(s,pos,len);
  735. pos += k;
  736. len -= k;
  737. }
  738. }
  739. ,writeInt32: function(x) {
  740. if(this.bigEndian) {
  741. this.writeByte(x >>> 24);
  742. this.writeByte(x >> 16 & 255);
  743. this.writeByte(x >> 8 & 255);
  744. this.writeByte(x & 255);
  745. } else {
  746. this.writeByte(x & 255);
  747. this.writeByte(x >> 8 & 255);
  748. this.writeByte(x >> 16 & 255);
  749. this.writeByte(x >>> 24);
  750. }
  751. }
  752. ,writeString: function(s) {
  753. var b = haxe_io_Bytes.ofString(s);
  754. this.writeFullBytes(b,0,b.length);
  755. }
  756. ,__class__: haxe_io_Output
  757. };
  758. var haxe_io_BytesOutput = function() {
  759. this.b = new haxe_io_BytesBuffer();
  760. };
  761. haxe_io_BytesOutput.__name__ = ["haxe","io","BytesOutput"];
  762. haxe_io_BytesOutput.__super__ = haxe_io_Output;
  763. haxe_io_BytesOutput.prototype = $extend(haxe_io_Output.prototype,{
  764. b: null
  765. ,writeByte: function(c) {
  766. this.b.b.push(c);
  767. }
  768. ,writeBytes: function(buf,pos,len) {
  769. var _this = this.b;
  770. if(pos < 0 || len < 0 || pos + len > buf.length) throw new js__$Boot_HaxeError(haxe_io_Error.OutsideBounds);
  771. var b2 = buf.b;
  772. var _g1 = pos;
  773. var _g = pos + len;
  774. while(_g1 < _g) {
  775. var i = _g1++;
  776. _this.b.push(b2[i]);
  777. }
  778. return len;
  779. }
  780. ,getBytes: function() {
  781. return this.b.getBytes();
  782. }
  783. ,__class__: haxe_io_BytesOutput
  784. });
  785. var haxe_io_Eof = function() {
  786. };
  787. haxe_io_Eof.__name__ = ["haxe","io","Eof"];
  788. haxe_io_Eof.prototype = {
  789. toString: function() {
  790. return "Eof";
  791. }
  792. ,__class__: haxe_io_Eof
  793. };
  794. var haxe_io_Error = { __ename__ : true, __constructs__ : ["Blocked","Overflow","OutsideBounds","Custom"] };
  795. haxe_io_Error.Blocked = ["Blocked",0];
  796. haxe_io_Error.Blocked.toString = $estr;
  797. haxe_io_Error.Blocked.__enum__ = haxe_io_Error;
  798. haxe_io_Error.Overflow = ["Overflow",1];
  799. haxe_io_Error.Overflow.toString = $estr;
  800. haxe_io_Error.Overflow.__enum__ = haxe_io_Error;
  801. haxe_io_Error.OutsideBounds = ["OutsideBounds",2];
  802. haxe_io_Error.OutsideBounds.toString = $estr;
  803. haxe_io_Error.OutsideBounds.__enum__ = haxe_io_Error;
  804. haxe_io_Error.Custom = function(e) { var $x = ["Custom",3,e]; $x.__enum__ = haxe_io_Error; $x.toString = $estr; return $x; };
  805. var haxe_unit_TestCase = function() {
  806. };
  807. haxe_unit_TestCase.__name__ = ["haxe","unit","TestCase"];
  808. haxe_unit_TestCase.prototype = {
  809. currentTest: null
  810. ,setup: function() {
  811. }
  812. ,tearDown: function() {
  813. }
  814. ,print: function(v) {
  815. haxe_unit_TestRunner.print(v);
  816. }
  817. ,assertTrue: function(b,c) {
  818. this.currentTest.done = true;
  819. if(b != true) {
  820. this.currentTest.success = false;
  821. this.currentTest.error = "expected true but was false";
  822. this.currentTest.posInfos = c;
  823. throw new js__$Boot_HaxeError(this.currentTest);
  824. }
  825. }
  826. ,assertFalse: function(b,c) {
  827. this.currentTest.done = true;
  828. if(b == true) {
  829. this.currentTest.success = false;
  830. this.currentTest.error = "expected false but was true";
  831. this.currentTest.posInfos = c;
  832. throw new js__$Boot_HaxeError(this.currentTest);
  833. }
  834. }
  835. ,assertEquals: function(expected,actual,c) {
  836. this.currentTest.done = true;
  837. if(actual != expected) {
  838. this.currentTest.success = false;
  839. this.currentTest.error = "expected '" + Std.string(expected) + "' but was '" + Std.string(actual) + "'";
  840. this.currentTest.posInfos = c;
  841. throw new js__$Boot_HaxeError(this.currentTest);
  842. }
  843. }
  844. ,__class__: haxe_unit_TestCase
  845. };
  846. var haxe_unit_TestResult = function() {
  847. this.m_tests = new List();
  848. this.success = true;
  849. };
  850. haxe_unit_TestResult.__name__ = ["haxe","unit","TestResult"];
  851. haxe_unit_TestResult.prototype = {
  852. m_tests: null
  853. ,success: null
  854. ,add: function(t) {
  855. this.m_tests.add(t);
  856. if(!t.success) this.success = false;
  857. }
  858. ,toString: function() {
  859. var buf_b = "";
  860. var failures = 0;
  861. var _g_head = this.m_tests.h;
  862. var _g_val = null;
  863. while(_g_head != null) {
  864. var tmp;
  865. _g_val = _g_head[0];
  866. _g_head = _g_head[1];
  867. tmp = _g_val;
  868. var test = tmp;
  869. if(test.success == false) {
  870. buf_b += "* ";
  871. buf_b += test.classname == null?"null":"" + test.classname;
  872. buf_b += "::";
  873. buf_b += test.method == null?"null":"" + test.method;
  874. buf_b += "()";
  875. buf_b += "\n";
  876. buf_b += "ERR: ";
  877. if(test.posInfos != null) {
  878. buf_b += Std.string(test.posInfos.fileName);
  879. buf_b += ":";
  880. buf_b += Std.string(test.posInfos.lineNumber);
  881. buf_b += "(";
  882. buf_b += Std.string(test.posInfos.className);
  883. buf_b += ".";
  884. buf_b += Std.string(test.posInfos.methodName);
  885. buf_b += ") - ";
  886. }
  887. buf_b += test.error == null?"null":"" + test.error;
  888. buf_b += "\n";
  889. if(test.backtrace != null) {
  890. buf_b += test.backtrace == null?"null":"" + test.backtrace;
  891. buf_b += "\n";
  892. }
  893. buf_b += "\n";
  894. failures++;
  895. }
  896. }
  897. buf_b += "\n";
  898. if(failures == 0) buf_b += "OK "; else buf_b += "FAILED ";
  899. buf_b += Std.string(this.m_tests.length);
  900. buf_b += " tests, ";
  901. buf_b += failures == null?"null":"" + failures;
  902. buf_b += " failed, ";
  903. buf_b += Std.string(this.m_tests.length - failures);
  904. buf_b += " success";
  905. buf_b += "\n";
  906. return buf_b;
  907. }
  908. ,__class__: haxe_unit_TestResult
  909. };
  910. var haxe_unit_TestRunner = function() {
  911. this.result = new haxe_unit_TestResult();
  912. this.cases = new List();
  913. };
  914. haxe_unit_TestRunner.__name__ = ["haxe","unit","TestRunner"];
  915. haxe_unit_TestRunner.print = function(v) {
  916. var msg = js_Boot.__string_rec(v,"");
  917. var d;
  918. if(typeof(document) != "undefined" && (d = document.getElementById("haxe:trace")) != null) {
  919. msg = StringTools.htmlEscape(msg).split("\n").join("<br/>");
  920. d.innerHTML += msg + "<br/>";
  921. } else if(typeof process != "undefined" && process.stdout != null && process.stdout.write != null) process.stdout.write(msg); else if(typeof console != "undefined" && console.log != null) console.log(msg);
  922. };
  923. haxe_unit_TestRunner.customTrace = function(v,p) {
  924. haxe_unit_TestRunner.print(p.fileName + ":" + p.lineNumber + ": " + Std.string(v) + "\n");
  925. };
  926. haxe_unit_TestRunner.prototype = {
  927. result: null
  928. ,cases: null
  929. ,add: function(c) {
  930. this.cases.add(c);
  931. }
  932. ,run: function() {
  933. this.result = new haxe_unit_TestResult();
  934. var _g_head = this.cases.h;
  935. var _g_val = null;
  936. while(_g_head != null) {
  937. var tmp;
  938. _g_val = _g_head[0];
  939. _g_head = _g_head[1];
  940. tmp = _g_val;
  941. var c = tmp;
  942. this.runCase(c);
  943. }
  944. haxe_unit_TestRunner.print(this.result.toString());
  945. return this.result.success;
  946. }
  947. ,runCase: function(t) {
  948. var old = haxe_Log.trace;
  949. haxe_Log.trace = haxe_unit_TestRunner.customTrace;
  950. var cl = t == null?null:js_Boot.getClass(t);
  951. var fields = Type.getInstanceFields(cl);
  952. haxe_unit_TestRunner.print("Class: " + Type.getClassName(cl) + " ");
  953. var _g = 0;
  954. while(_g < fields.length) {
  955. var f = fields[_g];
  956. ++_g;
  957. var field = Reflect.field(t,f);
  958. if(StringTools.startsWith(f,"test") && Reflect.isFunction(field)) {
  959. t.currentTest = new haxe_unit_TestStatus();
  960. t.currentTest.classname = Type.getClassName(cl);
  961. t.currentTest.method = f;
  962. t.setup();
  963. try {
  964. var args = [];
  965. field.apply(t,args);
  966. if(t.currentTest.done) {
  967. t.currentTest.success = true;
  968. haxe_unit_TestRunner.print(".");
  969. } else {
  970. t.currentTest.success = false;
  971. t.currentTest.error = "(warning) no assert";
  972. haxe_unit_TestRunner.print("W");
  973. }
  974. } catch( $e0 ) {
  975. haxe_CallStack.lastException = $e0;
  976. if ($e0 instanceof js__$Boot_HaxeError) $e0 = $e0.val;
  977. if( js_Boot.__instanceof($e0,haxe_unit_TestStatus) ) {
  978. var e = $e0;
  979. haxe_unit_TestRunner.print("F");
  980. t.currentTest.backtrace = haxe_CallStack.toString(haxe_CallStack.exceptionStack());
  981. } else {
  982. var e1 = $e0;
  983. haxe_unit_TestRunner.print("E");
  984. if(e1.message != null) t.currentTest.error = "exception thrown : " + Std.string(e1) + " [" + Std.string(e1.message) + "]"; else t.currentTest.error = "exception thrown : " + Std.string(e1);
  985. t.currentTest.backtrace = haxe_CallStack.toString(haxe_CallStack.exceptionStack());
  986. }
  987. }
  988. this.result.add(t.currentTest);
  989. t.tearDown();
  990. }
  991. }
  992. haxe_unit_TestRunner.print("\n");
  993. haxe_Log.trace = old;
  994. }
  995. ,__class__: haxe_unit_TestRunner
  996. };
  997. var haxe_unit_TestStatus = function() {
  998. this.done = false;
  999. this.success = false;
  1000. };
  1001. haxe_unit_TestStatus.__name__ = ["haxe","unit","TestStatus"];
  1002. haxe_unit_TestStatus.prototype = {
  1003. done: null
  1004. ,success: null
  1005. ,error: null
  1006. ,method: null
  1007. ,classname: null
  1008. ,posInfos: null
  1009. ,backtrace: null
  1010. ,__class__: haxe_unit_TestStatus
  1011. };
  1012. var js__$Boot_HaxeError = function(val) {
  1013. Error.call(this);
  1014. this.val = val;
  1015. this.message = String(val);
  1016. if(Error.captureStackTrace) Error.captureStackTrace(this,js__$Boot_HaxeError);
  1017. };
  1018. js__$Boot_HaxeError.__name__ = ["js","_Boot","HaxeError"];
  1019. js__$Boot_HaxeError.__super__ = Error;
  1020. js__$Boot_HaxeError.prototype = $extend(Error.prototype,{
  1021. val: null
  1022. ,__class__: js__$Boot_HaxeError
  1023. });
  1024. var js_Boot = function() { };
  1025. js_Boot.__name__ = ["js","Boot"];
  1026. js_Boot.__unhtml = function(s) {
  1027. return s.split("&").join("&amp;").split("<").join("&lt;").split(">").join("&gt;");
  1028. };
  1029. js_Boot.__trace = function(v,i) {
  1030. var msg = i != null?i.fileName + ":" + i.lineNumber + ": ":"";
  1031. msg += js_Boot.__string_rec(v,"");
  1032. if(i != null && i.customParams != null) {
  1033. var _g = 0;
  1034. var _g1 = i.customParams;
  1035. while(_g < _g1.length) {
  1036. var v1 = _g1[_g];
  1037. ++_g;
  1038. msg += "," + js_Boot.__string_rec(v1,"");
  1039. }
  1040. }
  1041. var d;
  1042. 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);
  1043. };
  1044. js_Boot.getClass = function(o) {
  1045. if((o instanceof Array) && o.__enum__ == null) return Array; else {
  1046. var cl = o.__class__;
  1047. if(cl != null) return cl;
  1048. var name = js_Boot.__nativeClassName(o);
  1049. if(name != null) return js_Boot.__resolveNativeClass(name);
  1050. return null;
  1051. }
  1052. };
  1053. js_Boot.__string_rec = function(o,s) {
  1054. if(o == null) return "null";
  1055. if(s.length >= 5) return "<...>";
  1056. var t = typeof(o);
  1057. if(t == "function" && (o.__name__ || o.__ename__)) t = "object";
  1058. switch(t) {
  1059. case "object":
  1060. if(o instanceof Array) {
  1061. if(o.__enum__) {
  1062. if(o.length == 2) return o[0];
  1063. var str2 = o[0] + "(";
  1064. s += "\t";
  1065. var _g1 = 2;
  1066. var _g = o.length;
  1067. while(_g1 < _g) {
  1068. var i1 = _g1++;
  1069. if(i1 != 2) str2 += "," + js_Boot.__string_rec(o[i1],s); else str2 += js_Boot.__string_rec(o[i1],s);
  1070. }
  1071. return str2 + ")";
  1072. }
  1073. var l = o.length;
  1074. var i;
  1075. var str1 = "[";
  1076. s += "\t";
  1077. var _g2 = 0;
  1078. while(_g2 < l) {
  1079. var i2 = _g2++;
  1080. str1 += (i2 > 0?",":"") + js_Boot.__string_rec(o[i2],s);
  1081. }
  1082. str1 += "]";
  1083. return str1;
  1084. }
  1085. var tostr;
  1086. try {
  1087. tostr = o.toString;
  1088. } catch( e ) {
  1089. haxe_CallStack.lastException = e;
  1090. if (e instanceof js__$Boot_HaxeError) e = e.val;
  1091. return "???";
  1092. }
  1093. if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") {
  1094. var s2 = o.toString();
  1095. if(s2 != "[object Object]") return s2;
  1096. }
  1097. var k = null;
  1098. var str = "{\n";
  1099. s += "\t";
  1100. var hasp = o.hasOwnProperty != null;
  1101. for( var k in o ) {
  1102. if(hasp && !o.hasOwnProperty(k)) {
  1103. continue;
  1104. }
  1105. if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") {
  1106. continue;
  1107. }
  1108. if(str.length != 2) str += ", \n";
  1109. str += s + k + " : " + js_Boot.__string_rec(o[k],s);
  1110. }
  1111. s = s.substring(1);
  1112. str += "\n" + s + "}";
  1113. return str;
  1114. case "function":
  1115. return "<function>";
  1116. case "string":
  1117. return o;
  1118. default:
  1119. return String(o);
  1120. }
  1121. };
  1122. js_Boot.__interfLoop = function(cc,cl) {
  1123. if(cc == null) return false;
  1124. if(cc == cl) return true;
  1125. var intf = cc.__interfaces__;
  1126. if(intf != null) {
  1127. var _g1 = 0;
  1128. var _g = intf.length;
  1129. while(_g1 < _g) {
  1130. var i = _g1++;
  1131. var i1 = intf[i];
  1132. if(i1 == cl || js_Boot.__interfLoop(i1,cl)) return true;
  1133. }
  1134. }
  1135. return js_Boot.__interfLoop(cc.__super__,cl);
  1136. };
  1137. js_Boot.__instanceof = function(o,cl) {
  1138. if(cl == null) return false;
  1139. switch(cl) {
  1140. case Int:
  1141. return (o|0) === o;
  1142. case Float:
  1143. return typeof(o) == "number";
  1144. case Bool:
  1145. return typeof(o) == "boolean";
  1146. case String:
  1147. return typeof(o) == "string";
  1148. case Array:
  1149. return (o instanceof Array) && o.__enum__ == null;
  1150. case Dynamic:
  1151. return true;
  1152. default:
  1153. if(o != null) {
  1154. if(typeof(cl) == "function") {
  1155. if(o instanceof cl) return true;
  1156. if(js_Boot.__interfLoop(js_Boot.getClass(o),cl)) return true;
  1157. } else if(typeof(cl) == "object" && js_Boot.__isNativeObj(cl)) {
  1158. if(o instanceof cl) return true;
  1159. }
  1160. } else return false;
  1161. if(cl == Class && o.__name__ != null) return true;
  1162. if(cl == Enum && o.__ename__ != null) return true;
  1163. return o.__enum__ == cl;
  1164. }
  1165. };
  1166. js_Boot.__nativeClassName = function(o) {
  1167. var name = js_Boot.__toStr.call(o).slice(8,-1);
  1168. if(name == "Object" || name == "Function" || name == "Math" || name == "JSON") return null;
  1169. return name;
  1170. };
  1171. js_Boot.__isNativeObj = function(o) {
  1172. return js_Boot.__nativeClassName(o) != null;
  1173. };
  1174. js_Boot.__resolveNativeClass = function(name) {
  1175. return $global[name];
  1176. };
  1177. var js_Node = function() { };
  1178. js_Node.__name__ = ["js","Node"];
  1179. var pony_ILogable = function() { };
  1180. pony_ILogable.__name__ = ["pony","ILogable"];
  1181. pony_ILogable.prototype = {
  1182. __class__: pony_ILogable
  1183. };
  1184. var pony_magic_HasSignal = function() { };
  1185. pony_magic_HasSignal.__name__ = ["pony","magic","HasSignal"];
  1186. var pony_Logable = function() {
  1187. };
  1188. pony_Logable.__name__ = ["pony","Logable"];
  1189. pony_Logable.__interfaces__ = [pony_magic_HasSignal,pony_ILogable];
  1190. pony_Logable.prototype = {
  1191. error: function(s,p) {
  1192. pony_events__$Event2_Event2_$Impl_$.dispatch(this.eError,s,p);
  1193. }
  1194. ,eLog: null
  1195. ,eError: null
  1196. ,__class__: pony_Logable
  1197. };
  1198. var pony_Priority = function(data,$double,addAfter) {
  1199. if(addAfter == null) addAfter = false;
  1200. if($double == null) $double = false;
  1201. this.addAfter = addAfter;
  1202. this.hash = new haxe_ds_IntMap();
  1203. this.data = [];
  1204. this.counters = [0];
  1205. this["double"] = $double;
  1206. if(data != null) {
  1207. this.data = data;
  1208. this.hash = new haxe_ds_IntMap();
  1209. this.hash.h[0] = this.data.length;
  1210. }
  1211. };
  1212. pony_Priority.__name__ = ["pony","Priority"];
  1213. pony_Priority.__interfaces__ = [pony_magic_HasSignal];
  1214. pony_Priority.prototype = {
  1215. 'double': null
  1216. ,data: null
  1217. ,hash: null
  1218. ,counters: null
  1219. ,addAfter: null
  1220. ,add: function(e,priority) {
  1221. if(priority == null) priority = 0;
  1222. var tmp;
  1223. if(!this["double"]) {
  1224. var tmp1;
  1225. var f = $bind(this,this.compare);
  1226. var a = e;
  1227. tmp1 = function(b) {
  1228. return f(a,b);
  1229. };
  1230. tmp = Lambda.exists(this.data,tmp1);
  1231. } else tmp = false;
  1232. if(tmp) return this;
  1233. var needOnTake = this.data.length == 0;
  1234. var s = this.hash.h.hasOwnProperty(priority)?this.hash.h[priority]:0;
  1235. var c = 0;
  1236. var $it0 = this.hash.keys();
  1237. while( $it0.hasNext() ) {
  1238. var k = $it0.next();
  1239. if(k < priority) c += this.hash.h[k];
  1240. }
  1241. c += s;
  1242. this.data.splice(c,0,e);
  1243. var _g1 = 0;
  1244. var _g = this.counters.length;
  1245. while(_g1 < _g) {
  1246. var k1 = _g1++;
  1247. if(this.addAfter || c < this.counters[k1]) this.counters[k1]++;
  1248. }
  1249. this.hash.h[priority] = s + 1;
  1250. if(needOnTake) pony_events__$Event0_Event0_$Impl_$.dispatch(this.eTake);
  1251. return this;
  1252. }
  1253. ,iterator: function() {
  1254. var _g = this;
  1255. var n = this.counters.push(0) - 1;
  1256. var i = 0;
  1257. return { hasNext : function() {
  1258. if(_g.counters == null) return false;
  1259. if(_g.counters.length < n) _g.counters.push(i);
  1260. if(_g.data.length > _g.counters[n]) return true; else {
  1261. _g.counters.splice(n,1);
  1262. return false;
  1263. }
  1264. }, next : function() {
  1265. return _g.data[_g.counters[n]++];
  1266. }};
  1267. }
  1268. ,compare: function(a,b) {
  1269. return a == b;
  1270. }
  1271. ,asort: function(x,y) {
  1272. return x - y;
  1273. }
  1274. ,remove: function(e) {
  1275. var tmp;
  1276. var f = $bind(this,this.compare);
  1277. var a1 = e;
  1278. tmp = function(b) {
  1279. return f(a1,b);
  1280. };
  1281. var i = pony_ArrayTools.fIndexOf(this.data,tmp);
  1282. if(i == -1) return false;
  1283. var needOnLost = !(this.data.length == 0);
  1284. var _g1 = 0;
  1285. var _g = this.counters.length;
  1286. while(_g1 < _g) {
  1287. var k = _g1++;
  1288. if(i < this.counters[k]) this.counters[k]--;
  1289. }
  1290. this.data.splice(i,1);
  1291. var tmp1;
  1292. var _g2 = [];
  1293. var $it0 = this.hash.keys();
  1294. while( $it0.hasNext() ) {
  1295. var k1 = $it0.next();
  1296. _g2.push(k1);
  1297. }
  1298. tmp1 = _g2;
  1299. var a = tmp1;
  1300. a.sort($bind(this,this.asort));
  1301. var _g11 = 0;
  1302. while(_g11 < a.length) {
  1303. var k2 = a[_g11];
  1304. ++_g11;
  1305. var n = this.hash.h[k2];
  1306. if(i > 0) i -= n; else {
  1307. if(n > 1) this.hash.h[k2] = n - 1; else this.hash.remove(k2);
  1308. break;
  1309. }
  1310. }
  1311. if(needOnLost && this.data.length == 0) pony_events__$Event0_Event0_$Impl_$.dispatch(this.eLost);
  1312. if(this["double"]) this.remove(e);
  1313. return true;
  1314. }
  1315. ,eTake: null
  1316. ,eLost: null
  1317. ,__class__: pony_Priority
  1318. };
  1319. var pony_Queue = function(method) {
  1320. this.busy = false;
  1321. this.method = method;
  1322. this.list = new List();
  1323. this.call = Reflect.makeVarArgs($bind(this,this._call));
  1324. };
  1325. pony_Queue.__name__ = ["pony","Queue"];
  1326. pony_Queue.prototype = {
  1327. list: null
  1328. ,busy: null
  1329. ,call: null
  1330. ,method: null
  1331. ,_call: function(a) {
  1332. if(!this.busy) {
  1333. this.busy = true;
  1334. this.method.apply(null,a);
  1335. } else this.list.add(a);
  1336. }
  1337. ,next: function() {
  1338. if(this.list.length > 0) {
  1339. var args = this.list.pop();
  1340. this.method.apply(null,args);
  1341. } else this.busy = false;
  1342. }
  1343. ,__class__: pony_Queue
  1344. };
  1345. var pony_Tools = function() { };
  1346. pony_Tools.__name__ = ["pony","Tools"];
  1347. pony_Tools.readStr = function(b) {
  1348. try {
  1349. return b.readString(b.readInt32());
  1350. } catch( _ ) {
  1351. haxe_CallStack.lastException = _;
  1352. if (_ instanceof js__$Boot_HaxeError) _ = _.val;
  1353. return null;
  1354. }
  1355. };
  1356. var pony_ArrayTools = function() { };
  1357. pony_ArrayTools.__name__ = ["pony","ArrayTools"];
  1358. pony_ArrayTools.fIndexOf = function(a,f) {
  1359. var i = 0;
  1360. var _g = 0;
  1361. while(_g < a.length) {
  1362. var e = a[_g];
  1363. ++_g;
  1364. if(f(e)) return i;
  1365. i++;
  1366. }
  1367. return -1;
  1368. };
  1369. var pony_events__$Event0_Event0_$Impl_$ = {};
  1370. pony_events__$Event0_Event0_$Impl_$.__name__ = ["pony","events","_Event0","Event0_Impl_"];
  1371. pony_events__$Event0_Event0_$Impl_$.compare = function(a,b) {
  1372. var tmp;
  1373. var _g = a.listener;
  1374. var _g1 = b.listener;
  1375. switch(_g[1]) {
  1376. case 0:
  1377. switch(_g1[1]) {
  1378. case 0:
  1379. tmp = _g[2] == _g1[2];
  1380. break;
  1381. default:
  1382. tmp = false;
  1383. }
  1384. break;
  1385. case 1:
  1386. switch(_g1[1]) {
  1387. case 1:
  1388. tmp = _g[2] == _g1[2];
  1389. break;
  1390. default:
  1391. tmp = false;
  1392. }
  1393. break;
  1394. }
  1395. return tmp;
  1396. };
  1397. pony_events__$Event0_Event0_$Impl_$.dispatch = function(this1,safe) {
  1398. if(safe == null) safe = false;
  1399. if(this1 == null || this1.data == null || safe && this1.counters.length > 1) return false;
  1400. var $it0 = this1.iterator();
  1401. while( $it0.hasNext() ) {
  1402. var e = $it0.next();
  1403. var tmp;
  1404. var _g = e.listener;
  1405. switch(_g[1]) {
  1406. case 0:
  1407. tmp = _g[2]();
  1408. break;
  1409. case 1:
  1410. tmp = pony_events__$Event0_Event0_$Impl_$.dispatch(_g[2],_g[3] || safe);
  1411. break;
  1412. }
  1413. if(tmp) {
  1414. if(this1.counters != null) this1.counters.splice(1,this1.counters.length);
  1415. return true;
  1416. }
  1417. if(!(this1.data == null) && e.once) this1.remove(e);
  1418. }
  1419. return false;
  1420. };
  1421. var pony_events__$Event1_Event1_$Impl_$ = {};
  1422. pony_events__$Event1_Event1_$Impl_$.__name__ = ["pony","events","_Event1","Event1_Impl_"];
  1423. pony_events__$Event1_Event1_$Impl_$.compare = function(a,b) {
  1424. var tmp;
  1425. var _g = a.listener;
  1426. var _g1 = b.listener;
  1427. switch(_g[1]) {
  1428. case 0:
  1429. switch(_g1[1]) {
  1430. case 0:
  1431. tmp = _g[2] == _g1[2];
  1432. break;
  1433. default:
  1434. tmp = false;
  1435. }
  1436. break;
  1437. case 1:
  1438. switch(_g1[1]) {
  1439. case 1:
  1440. tmp = _g[2] == _g1[2];
  1441. break;
  1442. default:
  1443. tmp = false;
  1444. }
  1445. break;
  1446. case 2:
  1447. switch(_g1[1]) {
  1448. case 2:
  1449. tmp = _g[2] == _g1[2];
  1450. break;
  1451. default:
  1452. tmp = false;
  1453. }
  1454. break;
  1455. case 3:
  1456. switch(_g1[1]) {
  1457. case 3:
  1458. tmp = _g[2] == _g1[2];
  1459. break;
  1460. default:
  1461. tmp = false;
  1462. }
  1463. break;
  1464. case 4:
  1465. switch(_g1[1]) {
  1466. case 4:
  1467. tmp = _g[3] == _g1[3];
  1468. break;
  1469. default:
  1470. tmp = false;
  1471. }
  1472. break;
  1473. case 5:
  1474. switch(_g1[1]) {
  1475. case 5:
  1476. tmp = _g[3] == _g1[3];
  1477. break;
  1478. default:
  1479. tmp = false;
  1480. }
  1481. break;
  1482. }
  1483. return tmp;
  1484. };
  1485. pony_events__$Event1_Event1_$Impl_$.dispatch = function(this1,a1,safe) {
  1486. if(safe == null) safe = false;
  1487. if(this1 == null || this1.data == null || safe && this1.counters.length > 1) return false;
  1488. var $it0 = this1.iterator();
  1489. while( $it0.hasNext() ) {
  1490. var e = $it0.next();
  1491. var tmp;
  1492. var _g = e.listener;
  1493. switch(_g[1]) {
  1494. case 0:
  1495. tmp = _g[2]();
  1496. break;
  1497. case 1:
  1498. tmp = _g[2](a1);
  1499. break;
  1500. case 2:
  1501. tmp = pony_events__$Event0_Event0_$Impl_$.dispatch(_g[2],_g[3] || safe);
  1502. break;
  1503. case 3:
  1504. tmp = pony_events__$Event1_Event1_$Impl_$.dispatch(_g[2],a1,_g[3] || safe);
  1505. break;
  1506. case 4:
  1507. if(_g[3] == a1) tmp = pony_events__$Event0_Event0_$Impl_$.dispatch(_g[2],safe); else tmp = false;
  1508. break;
  1509. case 5:
  1510. if(_g[3] != a1) tmp = pony_events__$Event1_Event1_$Impl_$.dispatch(_g[2],a1,safe); else tmp = false;
  1511. break;
  1512. default:
  1513. tmp = false;
  1514. }
  1515. if(tmp) {
  1516. if(this1.counters != null) this1.counters.splice(1,this1.counters.length);
  1517. return true;
  1518. }
  1519. if(!(this1.data == null) && e.once) this1.remove(e);
  1520. }
  1521. return false;
  1522. };
  1523. var pony_events__$Event2_Event2_$Impl_$ = {};
  1524. pony_events__$Event2_Event2_$Impl_$.__name__ = ["pony","events","_Event2","Event2_Impl_"];
  1525. pony_events__$Event2_Event2_$Impl_$.compare = function(a,b) {
  1526. var tmp;
  1527. var _g = a.listener;
  1528. var _g1 = b.listener;
  1529. switch(_g[1]) {
  1530. case 0:
  1531. switch(_g1[1]) {
  1532. case 0:
  1533. tmp = _g[2] == _g1[2];
  1534. break;
  1535. default:
  1536. tmp = false;
  1537. }
  1538. break;
  1539. case 1:
  1540. switch(_g1[1]) {
  1541. case 1:
  1542. tmp = _g[2] == _g1[2];
  1543. break;
  1544. default:
  1545. tmp = false;
  1546. }
  1547. break;
  1548. case 2:
  1549. switch(_g1[1]) {
  1550. case 2:
  1551. tmp = _g[2] == _g1[2];
  1552. break;
  1553. default:
  1554. tmp = false;
  1555. }
  1556. break;
  1557. case 3:
  1558. switch(_g1[1]) {
  1559. case 3:
  1560. tmp = _g[2] == _g1[2];
  1561. break;
  1562. default:
  1563. tmp = false;
  1564. }
  1565. break;
  1566. case 4:
  1567. switch(_g1[1]) {
  1568. case 4:
  1569. tmp = _g[2] == _g1[2];
  1570. break;
  1571. default:
  1572. tmp = false;
  1573. }
  1574. break;
  1575. case 5:
  1576. switch(_g1[1]) {
  1577. case 5:
  1578. tmp = _g[2] == _g1[2];
  1579. break;
  1580. default:
  1581. tmp = false;
  1582. }
  1583. break;
  1584. case 6:
  1585. switch(_g1[1]) {
  1586. case 6:
  1587. if(_g[3] == _g1[3]) tmp = _g[4] == _g1[4]; else tmp = false;
  1588. break;
  1589. default:
  1590. tmp = false;
  1591. }
  1592. break;
  1593. case 7:
  1594. switch(_g1[1]) {
  1595. case 7:
  1596. tmp = _g[3] == _g1[3];
  1597. break;
  1598. default:
  1599. tmp = false;
  1600. }
  1601. break;
  1602. case 8:
  1603. switch(_g1[1]) {
  1604. case 8:
  1605. tmp = _g[3] == _g1[3];
  1606. break;
  1607. default:
  1608. tmp = false;
  1609. }
  1610. break;
  1611. case 9:
  1612. switch(_g1[1]) {
  1613. case 9:
  1614. if(_g[3] == _g1[3]) tmp = _g[4] == _g1[4]; else tmp = false;
  1615. break;
  1616. default:
  1617. tmp = false;
  1618. }
  1619. break;
  1620. case 10:
  1621. switch(_g1[1]) {
  1622. case 10:
  1623. tmp = _g[3] == _g1[3];
  1624. break;
  1625. default:
  1626. tmp = false;
  1627. }
  1628. break;
  1629. case 11:
  1630. switch(_g1[1]) {
  1631. case 11:
  1632. tmp = _g[3] == _g1[3];
  1633. break;
  1634. default:
  1635. tmp = false;
  1636. }
  1637. break;
  1638. }
  1639. return tmp;
  1640. };
  1641. pony_events__$Event2_Event2_$Impl_$.dispatch = function(this1,a1,a2,safe) {
  1642. if(safe == null) safe = false;
  1643. if(this1 == null || this1.data == null || safe && this1.counters.length > 1) return false;
  1644. var $it0 = this1.iterator();
  1645. while( $it0.hasNext() ) {
  1646. var e = $it0.next();
  1647. var tmp;
  1648. var _g = e.listener;
  1649. switch(_g[1]) {
  1650. case 0:
  1651. tmp = _g[2]();
  1652. break;
  1653. case 1:
  1654. tmp = _g[2](a1);
  1655. break;
  1656. case 2:
  1657. tmp = _g[2](a1,a2);
  1658. break;
  1659. case 3:
  1660. tmp = pony_events__$Event0_Event0_$Impl_$.dispatch(_g[2],_g[3] || safe);
  1661. break;
  1662. case 4:
  1663. tmp = pony_events__$Event1_Event1_$Impl_$.dispatch(_g[2],a1,_g[3] || safe);
  1664. break;
  1665. case 5:
  1666. tmp = pony_events__$Event2_Event2_$Impl_$.dispatch(_g[2],a1,a2,_g[3] || safe);
  1667. break;
  1668. case 6:
  1669. if(_g[3] == a1 && _g[4] == a2) tmp = pony_events__$Event0_Event0_$Impl_$.dispatch(_g[2],safe); else tmp = false;
  1670. break;
  1671. case 7:
  1672. if(_g[3] == a1) tmp = pony_events__$Event1_Event1_$Impl_$.dispatch(_g[2],a2,safe); else tmp = false;
  1673. break;
  1674. case 8:
  1675. if(_g[3] == a2) tmp = pony_events__$Event1_Event1_$Impl_$.dispatch(_g[2],a1,safe); else tmp = false;
  1676. break;
  1677. case 9:
  1678. if(_g[3] != a1 && _g[4] != a2) tmp = pony_events__$Event2_Event2_$Impl_$.dispatch(_g[2],a1,a2,safe); else tmp = false;
  1679. break;
  1680. case 10:
  1681. if(_g[3] != a1) tmp = pony_events__$Event2_Event2_$Impl_$.dispatch(_g[2],a1,a2,safe); else tmp = false;
  1682. break;
  1683. case 11:
  1684. if(_g[3] != a2) tmp = pony_events__$Event2_Event2_$Impl_$.dispatch(_g[2],a1,a2,safe); else tmp = false;
  1685. break;
  1686. default:
  1687. tmp = false;
  1688. }
  1689. if(tmp) {
  1690. if(this1.counters != null) this1.counters.splice(1,this1.counters.length);
  1691. return true;
  1692. }
  1693. if(!(this1.data == null) && e.once) this1.remove(e);
  1694. }
  1695. return false;
  1696. };
  1697. var pony_events_Listener0Type = { __ename__ : true, __constructs__ : ["LFunction0","LEvent0"] };
  1698. pony_events_Listener0Type.LFunction0 = function(f) { var $x = ["LFunction0",0,f]; $x.__enum__ = pony_events_Listener0Type; $x.toString = $estr; return $x; };
  1699. pony_events_Listener0Type.LEvent0 = function(s,safe) { var $x = ["LEvent0",1,s,safe]; $x.__enum__ = pony_events_Listener0Type; $x.toString = $estr; return $x; };
  1700. var pony_events_Listener1Type = { __ename__ : true, __constructs__ : ["LFunction0","LFunction1","LEvent0","LEvent1","LSub","LNot"] };
  1701. pony_events_Listener1Type.LFunction0 = function(f) { var $x = ["LFunction0",0,f]; $x.__enum__ = pony_events_Listener1Type; $x.toString = $estr; return $x; };
  1702. pony_events_Listener1Type.LFunction1 = function(f) { var $x = ["LFunction1",1,f]; $x.__enum__ = pony_events_Listener1Type; $x.toString = $estr; return $x; };
  1703. pony_events_Listener1Type.LEvent0 = function(s,safe) { var $x = ["LEvent0",2,s,safe]; $x.__enum__ = pony_events_Listener1Type; $x.toString = $estr; return $x; };
  1704. pony_events_Listener1Type.LEvent1 = function(s,safe) { var $x = ["LEvent1",3,s,safe]; $x.__enum__ = pony_events_Listener1Type; $x.toString = $estr; return $x; };
  1705. pony_events_Listener1Type.LSub = function(s,v) { var $x = ["LSub",4,s,v]; $x.__enum__ = pony_events_Listener1Type; $x.toString = $estr; return $x; };
  1706. pony_events_Listener1Type.LNot = function(s,v) { var $x = ["LNot",5,s,v]; $x.__enum__ = pony_events_Listener1Type; $x.toString = $estr; return $x; };
  1707. var pony_events_Listener2Type = { __ename__ : true, __constructs__ : ["LFunction0","LFunction1","LFunction2","LEvent0","LEvent1","LEvent2","LSub","LSub1","LSub2","LNot","LNot1","LNot2"] };
  1708. pony_events_Listener2Type.LFunction0 = function(f) { var $x = ["LFunction0",0,f]; $x.__enum__ = pony_events_Listener2Type; $x.toString = $estr; return $x; };
  1709. pony_events_Listener2Type.LFunction1 = function(f) { var $x = ["LFunction1",1,f]; $x.__enum__ = pony_events_Listener2Type; $x.toString = $estr; return $x; };
  1710. pony_events_Listener2Type.LFunction2 = function(f) { var $x = ["LFunction2",2,f]; $x.__enum__ = pony_events_Listener2Type; $x.toString = $estr; return $x; };
  1711. pony_events_Listener2Type.LEvent0 = function(s,safe) { var $x = ["LEvent0",3,s,safe]; $x.__enum__ = pony_events_Listener2Type; $x.toString = $estr; return $x; };
  1712. pony_events_Listener2Type.LEvent1 = function(s,safe) { var $x = ["LEvent1",4,s,safe]; $x.__enum__ = pony_events_Listener2Type; $x.toString = $estr; return $x; };
  1713. pony_events_Listener2Type.LEvent2 = function(s,safe) { var $x = ["LEvent2",5,s,safe]; $x.__enum__ = pony_events_Listener2Type; $x.toString = $estr; return $x; };
  1714. pony_events_Listener2Type.LSub = function(s,v1,v2) { var $x = ["LSub",6,s,v1,v2]; $x.__enum__ = pony_events_Listener2Type; $x.toString = $estr; return $x; };
  1715. pony_events_Listener2Type.LSub1 = function(s,v) { var $x = ["LSub1",7,s,v]; $x.__enum__ = pony_events_Listener2Type; $x.toString = $estr; return $x; };
  1716. pony_events_Listener2Type.LSub2 = function(s,v) { var $x = ["LSub2",8,s,v]; $x.__enum__ = pony_events_Listener2Type; $x.toString = $estr; return $x; };
  1717. pony_events_Listener2Type.LNot = function(s,v1,v2) { var $x = ["LNot",9,s,v1,v2]; $x.__enum__ = pony_events_Listener2Type; $x.toString = $estr; return $x; };
  1718. pony_events_Listener2Type.LNot1 = function(s,v) { var $x = ["LNot1",10,s,v]; $x.__enum__ = pony_events_Listener2Type; $x.toString = $estr; return $x; };
  1719. pony_events_Listener2Type.LNot2 = function(s,v) { var $x = ["LNot2",11,s,v]; $x.__enum__ = pony_events_Listener2Type; $x.toString = $estr; return $x; };
  1720. var pony_net_INet = function() { };
  1721. pony_net_INet.__name__ = ["pony","net","INet"];
  1722. var pony_net_ISocketClient = function() { };
  1723. pony_net_ISocketClient.__name__ = ["pony","net","ISocketClient"];
  1724. pony_net_ISocketClient.__interfaces__ = [pony_net_INet];
  1725. var pony_net_ISocketServer = function() { };
  1726. pony_net_ISocketServer.__name__ = ["pony","net","ISocketServer"];
  1727. pony_net_ISocketServer.__interfaces__ = [pony_net_INet];
  1728. var pony_net_SocketClientBase = function(host,port,reconnect,tryCount,aIsWithLength,maxSize) {
  1729. if(maxSize == null) maxSize = 1024;
  1730. if(aIsWithLength == null) aIsWithLength = true;
  1731. if(tryCount == null) tryCount = 0;
  1732. if(reconnect == null) reconnect = -1;
  1733. this.eDisconnect = (function($this) {
  1734. var $r;
  1735. var this1;
  1736. this1 = new pony_Priority(null,false,true);
  1737. this1.compare = pony_events__$Event1_Event1_$Impl_$.compare;
  1738. $r = this1;
  1739. return $r;
  1740. }(this));
  1741. this.eClose = (function($this) {
  1742. var $r;
  1743. var this1;
  1744. this1 = new pony_Priority(null,false,true);
  1745. this1.compare = pony_events__$Event0_Event0_$Impl_$.compare;
  1746. $r = this1;
  1747. return $r;
  1748. }(this));
  1749. this.eString = (function($this) {
  1750. var $r;
  1751. var this1;
  1752. this1 = new pony_Priority(null,false,true);
  1753. this1.compare = pony_events__$Event2_Event2_$Impl_$.compare;
  1754. $r = this1;
  1755. return $r;
  1756. }(this));
  1757. this.eData = (function($this) {
  1758. var $r;
  1759. var this1;
  1760. this1 = new pony_Priority(null,false,true);
  1761. this1.compare = pony_events__$Event2_Event2_$Impl_$.compare;
  1762. $r = this1;
  1763. return $r;
  1764. }(this));
  1765. this.tryCou

Large files files are truncated, but you can click here to view the full file