Last active
October 22, 2019 03:50
-
-
Save Akira13641/71fc6b5511a2023f4b2a7ff3c1ea3a52 to your computer and use it in GitHub Desktop.
Paskal to Teh Skropt example (the JabbaSkript file is the standalone single-file-output version, hence the size)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| program LolNoadJayEss; | |
| {$mode Delphi} | |
| uses SysUtils, JS, NodeJS, NodeJSApp, NodeJSFS; | |
| type | |
| TMyApplication = class(TNodeJSApplication) | |
| procedure DoRun; override; | |
| end; | |
| TStringArray = TGJSArray<String>; | |
| procedure TMyApplication.DoRun; | |
| var I: NativeInt; | |
| begin | |
| if ParamCount > 0 then with NJS_FS.CreateWriteStream('./test.txt') do begin | |
| for I := 1 to StrToInt(ParamStr(1)) do Write(IntToStr(I) + SLineBreak); | |
| _End('Fred Paskell >> Lol Teh Script'); | |
| end; | |
| TStringArray._Of('AA', 'BB', 'CC', 'DD', | |
| 'EE', 'FF', 'GG', 'HH', | |
| 'II', 'JJ', 'KK', 'LL').Map( | |
| function(Element: String; Index: NativeInt; AnArray: TStringArray): String | |
| begin | |
| Console.Log(JSTypeOf(Element)); | |
| Result := Element + Element; | |
| end | |
| ).Map( | |
| function(Element: String; Index: NativeInt; AnArray: TStringArray): String | |
| begin | |
| Console.Log(JSTypeOf(Element)); | |
| Result := 'bloop ' + Element + ' blop'; | |
| end | |
| ).ForEach( | |
| procedure(Element: String; Index: NativeInt; AnArray: TStringArray) | |
| begin | |
| Console.Log(Element + ' lololololol'); | |
| end | |
| ); | |
| Terminate; | |
| end; | |
| begin | |
| with TMyApplication.Create(nil) do begin | |
| Initialize; | |
| Run; | |
| Free; | |
| end; | |
| end. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| "use strict"; | |
| var pas = {}, | |
| rtl = { | |
| version: 10501, | |
| quiet: !1, | |
| debug_load_units: !1, | |
| debug_rtti: !1, | |
| debug: function() { | |
| !rtl.quiet && console && console.log && console.log(arguments); | |
| }, | |
| error: function(a) { | |
| rtl.debug("Error: ", a); | |
| throw a; | |
| }, | |
| warn: function(a) { | |
| rtl.debug("Warn: ", a); | |
| }, | |
| checkVersion: function(a) { | |
| if (rtl.version != a) | |
| throw "expected rtl version " + a + ", but found " + rtl.version; | |
| }, | |
| hiInt: Math.pow(2, 53), | |
| hasString: function(a) { | |
| return rtl.isString(a) && 0 < a.length; | |
| }, | |
| isArray: function(a) { | |
| return Array.isArray(a); | |
| }, | |
| isFunction: function(a) { | |
| return "function" === typeof a; | |
| }, | |
| isModule: function(a) { | |
| return rtl.isObject(a) && rtl.hasString(a.$name) && pas[a.$name] === a; | |
| }, | |
| isImplementation: function(a) { | |
| return ( | |
| rtl.isObject(a) && rtl.isModule(a.$module) && a.$module.$impl === a | |
| ); | |
| }, | |
| isNumber: function(a) { | |
| return "number" === typeof a; | |
| }, | |
| isObject: function(a) { | |
| return "object" === typeof a && null != a; | |
| }, | |
| isString: function(a) { | |
| return "string" === typeof a; | |
| }, | |
| getNumber: function(a) { | |
| return "number" === typeof a ? a : NaN; | |
| }, | |
| getChar: function(a) { | |
| return "string" === typeof a && 1 === a.length ? a : ""; | |
| }, | |
| getObject: function(a) { | |
| return "object" === typeof a || "function" === typeof a ? a : null; | |
| }, | |
| isTRecord: function(a) { | |
| return ( | |
| rtl.isObject(a) && | |
| a.hasOwnProperty("$new") && | |
| "function" === typeof a.$new | |
| ); | |
| }, | |
| isPasClass: function(a) { | |
| return ( | |
| rtl.isObject(a) && | |
| a.hasOwnProperty("$classname") && | |
| rtl.isObject(a.$module) | |
| ); | |
| }, | |
| isPasClassInstance: function(a) { | |
| return rtl.isObject(a) && rtl.isPasClass(a.$class); | |
| }, | |
| hexStr: function(a, b) { | |
| return ("000000000000000" + a.toString(16).toUpperCase()).slice(-b); | |
| }, | |
| m_loading: 0, | |
| m_loading_intf: 1, | |
| m_intf_loaded: 2, | |
| m_loading_impl: 3, | |
| m_initializing: 4, | |
| m_initialized: 5, | |
| module: function(a, b, c, d, e) { | |
| rtl.debug_load_units && | |
| rtl.debug( | |
| 'rtl.module name="' + | |
| a + | |
| '" intfuses=' + | |
| b + | |
| " impluses=" + | |
| d + | |
| " hasimplcode=" + | |
| rtl.isFunction(e) | |
| ); | |
| rtl.hasString(a) || rtl.error('invalid module name "' + a + '"'); | |
| rtl.isArray(b) || rtl.error('invalid interface useslist of "' + a + '"'); | |
| rtl.isFunction(c) || rtl.error('invalid interface code of "' + a + '"'); | |
| void 0 == d || | |
| rtl.isArray(d) || | |
| rtl.error('invalid implementation useslist of "' + a + '"'); | |
| void 0 == e || | |
| rtl.isFunction(e) || | |
| rtl.error('invalid implementation code of "' + a + '"'); | |
| pas[a] && rtl.error('module "' + a + '" is already registered'); | |
| a = pas[a] = { | |
| $name: a, | |
| $intfuseslist: b, | |
| $impluseslist: d, | |
| $state: rtl.m_loading, | |
| $intfcode: c, | |
| $implcode: e, | |
| $impl: null, | |
| $rtti: Object.create(rtl.tSectionRTTI) | |
| }; | |
| a.$rtti.$module = a; | |
| e && (a.$impl = { $module: a, $rtti: a.$rtti }); | |
| }, | |
| exitcode: 0, | |
| run: function(a) { | |
| function b() { | |
| rtl.hasString(a) || (a = "program"); | |
| rtl.debug_load_units && rtl.debug('rtl.run module="' + a + '"'); | |
| rtl.initRTTI(); | |
| var b = pas[a]; | |
| b || rtl.error('rtl.run module "' + a + '" missing'); | |
| rtl.loadintf(b); | |
| rtl.loadimpl(b); | |
| "program" == a && | |
| (rtl.debug_load_units && rtl.debug("running $main"), | |
| (b = pas.program.$main()), | |
| rtl.isNumber(b) && (rtl.exitcode = b)); | |
| } | |
| if (rtl.showUncaughtExceptions) | |
| try { | |
| b(); | |
| } catch (d) { | |
| var c = rtl.hasString(d.$classname) ? d.$classname : ""; | |
| c += | |
| (c ? ": " : "") + (d.hasOwnProperty("fMessage") ? d.fMessage : d); | |
| alert("Uncaught Exception : " + c); | |
| rtl.exitCode = 216; | |
| } | |
| else b(); | |
| return rtl.exitcode; | |
| }, | |
| loadintf: function(a) { | |
| a.$state > rtl.m_loading_intf || | |
| (rtl.debug_load_units && rtl.debug('loadintf: "' + a.$name + '"'), | |
| a.$state === rtl.m_loading_intf && | |
| rtl.error('unit cycle detected "' + a.$name + '"'), | |
| (a.$state = rtl.m_loading_intf), | |
| rtl.loaduseslist(a, a.$intfuseslist, rtl.loadintf), | |
| rtl.debug_load_units && | |
| rtl.debug('loadintf: run intf of "' + a.$name + '"'), | |
| a.$intfcode(a.$intfuseslist), | |
| (a.$state = rtl.m_intf_loaded)); | |
| }, | |
| loaduseslist: function(a, b, c) { | |
| if (void 0 != b) | |
| for (var d = b.length, e = 0; e < d; e++) { | |
| var f = b[e]; | |
| rtl.debug_load_units && | |
| rtl.debug('loaduseslist of "' + a.$name + '" uses="' + f + '"'); | |
| void 0 == pas[f] && | |
| rtl.error('module "' + a.$name + '" misses "' + f + '"'); | |
| c(pas[f]); | |
| } | |
| }, | |
| loadimpl: function(a) { | |
| a.$state >= rtl.m_loading_impl || | |
| (a.$state < rtl.m_intf_loaded && | |
| rtl.error('loadimpl: interface not loaded of "' + a.$name + '"'), | |
| rtl.debug_load_units && | |
| rtl.debug('loadimpl: load uses of "' + a.$name + '"'), | |
| (a.$state = rtl.m_loading_impl), | |
| rtl.loaduseslist(a, a.$impluseslist, rtl.loadintf), | |
| rtl.loaduseslist(a, a.$intfuseslist, rtl.loadimpl), | |
| rtl.loaduseslist(a, a.$impluseslist, rtl.loadimpl), | |
| rtl.debug_load_units && | |
| rtl.debug('loadimpl: run impl of "' + a.$name + '"'), | |
| rtl.isFunction(a.$implcode) && a.$implcode(a.$impluseslist), | |
| rtl.debug_load_units && | |
| rtl.debug('loadimpl: run init of "' + a.$name + '"'), | |
| (a.$state = rtl.m_initializing), | |
| rtl.isFunction(a.$init) && a.$init(), | |
| (a.$state = rtl.m_initialized)); | |
| }, | |
| createCallback: function(a, b) { | |
| var c = | |
| "string" === typeof b | |
| ? function() { | |
| return a[b].apply(a, arguments); | |
| } | |
| : function() { | |
| return b.apply(a, arguments); | |
| }; | |
| c.scope = a; | |
| c.fn = b; | |
| return c; | |
| }, | |
| cloneCallback: function(a) { | |
| return rtl.createCallback(a.scope, a.fn); | |
| }, | |
| eqCallback: function(a, b) { | |
| return a == b | |
| ? !0 | |
| : null != a && null != b && a.fn && a.scope === b.scope && a.fn == b.fn; | |
| }, | |
| initStruct: function(a, b, c) { | |
| b.$module && b.$module.$impl === b && (b = b.$module); | |
| a.$parent = b; | |
| rtl.isModule(b) | |
| ? ((a.$module = b), (a.$name = c)) | |
| : ((a.$module = b.$module), (a.$name = b.$name + "." + c)); | |
| return b; | |
| }, | |
| initClass: function(a, b, c, d) { | |
| b[c] = a; | |
| a.$class = a; | |
| a.$classname = c; | |
| b = rtl.initStruct(a, b, c); | |
| a.$fullname = b.$name + "." + c; | |
| rtl.debug_rtti && rtl.debug("initClass " + a.$fullname); | |
| b = a.$module.$rtti.$Class(a.$name, { class: a }); | |
| a.$rtti = b; | |
| rtl.isObject(a.$ancestor) && (b.ancestor = a.$ancestor.$rtti); | |
| b.ancestor || (b.ancestor = null); | |
| d.call(a); | |
| }, | |
| createClass: function(a, b, c, d) { | |
| var e = null; | |
| null != c | |
| ? ((e = Object.create(c)), (e.$ancestor = c)) | |
| : (e = { | |
| $ancestor: null, | |
| $create: function(a, b) { | |
| void 0 == b && (b = []); | |
| var c = Object.create(this); | |
| c.$init(); | |
| try { | |
| "string" === typeof a ? c[a].apply(c, b) : a.apply(c, b), | |
| c.AfterConstruction(); | |
| } catch (l) { | |
| throw (c.Destroy && c.Destroy(), c.$final(), l); | |
| } | |
| return c; | |
| }, | |
| $destroy: function(a) { | |
| this.BeforeDestruction(); | |
| if (this[a]) this[a](); | |
| this.$final(); | |
| } | |
| }); | |
| rtl.initClass(e, a, b, d); | |
| }, | |
| createClassExt: function(a, b, c, d, e) { | |
| c = Object.create(c); | |
| c.$create = function(a, b) { | |
| void 0 == b && (b = []); | |
| var c = 0 < d.length ? this[d](a, b) : Object.create(this); | |
| c.$init && c.$init(); | |
| try { | |
| "string" === typeof a ? c[a].apply(c, b) : a.apply(c, b), | |
| c.AfterConstruction && c.AfterConstruction(); | |
| } catch (l) { | |
| throw (c.Destroy && c.Destroy(), c.$final && this.$final(), l); | |
| } | |
| return c; | |
| }; | |
| c.$destroy = function(a) { | |
| this.BeforeDestruction && this.BeforeDestruction(); | |
| if (this[a]) this[a](); | |
| this.$final && this.$final(); | |
| }; | |
| rtl.initClass(c, a, b, e); | |
| }, | |
| createHelper: function(a, b, c, d) { | |
| if (null != c) { | |
| var e = Object.create(c); | |
| e.$ancestor = c; | |
| } else e = { $ancestor: null }; | |
| a[b] = e; | |
| e.$class = e; | |
| e.$classname = b; | |
| a = rtl.initStruct(e, a, b); | |
| e.$fullname = a.$name + "." + b; | |
| a = e.$module.$rtti.$Helper(e.$name, { helper: e }); | |
| e.$rtti = a; | |
| rtl.isObject(c) && (a.ancestor = c.$rtti); | |
| a.ancestor || (a.ancestor = null); | |
| d.call(e); | |
| }, | |
| tObjectDestroy: "Destroy", | |
| free: function(a, b) { | |
| if (null == a[b]) return null; | |
| a[b].$destroy(rtl.tObjectDestroy); | |
| a[b] = null; | |
| }, | |
| freeLoc: function(a) { | |
| if (null == a) return null; | |
| a.$destroy(rtl.tObjectDestroy); | |
| return null; | |
| }, | |
| recNewT: function(a, b, c, d) { | |
| function e(a) { | |
| Object.defineProperty(f, a, { enumerable: !1 }); | |
| } | |
| var f = {}; | |
| a && (a[b] = f); | |
| d && | |
| (rtl.initStruct(f, a, b), | |
| (f.$record = f), | |
| e("$record"), | |
| e("$name"), | |
| e("$parent"), | |
| e("$module")); | |
| c.call(f); | |
| f.$new || | |
| (f.$new = function() { | |
| return Object.create(this); | |
| }); | |
| f.$clone = function(a) { | |
| return this.$new().$assign(a); | |
| }; | |
| e("$new"); | |
| e("$clone"); | |
| e("$eq"); | |
| e("$assign"); | |
| return f; | |
| }, | |
| is: function(a, b) { | |
| return b.isPrototypeOf(a) || a === b; | |
| }, | |
| isExt: function(a, b, c) { | |
| return null == a || ("object" !== typeof b && "function" !== typeof b) | |
| ? !1 | |
| : a === b | |
| ? 1 === c | |
| ? !1 | |
| : 2 === c | |
| ? rtl.isPasClass(a) | |
| : !0 | |
| : b.isPrototypeOf && b.isPrototypeOf(a) | |
| ? 1 === c | |
| ? rtl.isPasClassInstance(a) | |
| : 2 === c | |
| ? rtl.isPasClass(a) | |
| : !0 | |
| : "function" == typeof b && a instanceof b | |
| ? !0 | |
| : !1; | |
| }, | |
| Exception: null, | |
| EInvalidCast: null, | |
| EAbstractError: null, | |
| ERangeError: null, | |
| EIntOverflow: null, | |
| EPropWriteOnly: null, | |
| raiseE: function(a) { | |
| var b = rtl[a]; | |
| if (null == b) { | |
| var c = pas.SysUtils; | |
| c || (c = pas.sysutils); | |
| c && | |
| ((b = c[a]) || (b = c[a.toLowerCase()]), | |
| b || (b = c.Exception), | |
| b || (b = c.exception)); | |
| } | |
| if (b) { | |
| if (b.Create) throw b.$create("Create"); | |
| if (b.create) throw b.$create("create"); | |
| } | |
| if ("EInvalidCast" === a) throw "invalid type cast"; | |
| if ("EAbstractError" === a) throw "Abstract method called"; | |
| if ("ERangeError" === a) throw "range error"; | |
| throw a; | |
| }, | |
| as: function(a, b) { | |
| if (null === a || rtl.is(a, b)) return a; | |
| rtl.raiseE("EInvalidCast"); | |
| }, | |
| asExt: function(a, b, c) { | |
| if (null === a || rtl.isExt(a, b, c)) return a; | |
| rtl.raiseE("EInvalidCast"); | |
| }, | |
| createInterface: function(a, b, c, d, e, f) { | |
| var g = e ? Object.create(e) : {}; | |
| a[b] = g; | |
| g.$module = a; | |
| g.$name = b; | |
| g.$fullname = a.$name + "." + b; | |
| g.$guid = c; | |
| g.$guidr = null; | |
| g.$names = d ? d : []; | |
| rtl.isFunction(f) && | |
| (rtl.debug_rtti && rtl.debug("createInterface " + g.$fullname), | |
| (a = g.$module.$rtti.$Interface(b, { interface: g, module: a })), | |
| (g.$rtti = a), | |
| e && (a.ancestor = e.$rtti), | |
| a.ancestor || (a.ancestor = null), | |
| f.call(g)); | |
| return g; | |
| }, | |
| strToGUIDR: function(a, b) { | |
| function c(b) { | |
| var c = a.substr(d, b); | |
| d += b; | |
| return parseInt(c, 16); | |
| } | |
| var d = 0; | |
| d += 1; | |
| b.D1 = c(8); | |
| d += 1; | |
| b.D2 = c(4); | |
| d += 1; | |
| b.D3 = c(4); | |
| d += 1; | |
| b.D4 || (b.D4 = []); | |
| b.D4[0] = c(2); | |
| b.D4[1] = c(2); | |
| d += 1; | |
| for (var e = 2; 8 > e; e++) b.D4[e] = c(2); | |
| return b; | |
| }, | |
| guidrToStr: function(a) { | |
| if (a.$intf) return a.$intf.$guid; | |
| for ( | |
| var b = rtl.hexStr, | |
| c = | |
| "{" + | |
| b(a.D1, 8) + | |
| "-" + | |
| b(a.D2, 4) + | |
| "-" + | |
| b(a.D3, 4) + | |
| "-" + | |
| b(a.D4[0], 2) + | |
| b(a.D4[1], 2) + | |
| "-", | |
| d = 2; | |
| 8 > d; | |
| d++ | |
| ) | |
| c += b(a.D4[d], 2); | |
| return c + "}"; | |
| }, | |
| createTGUID: function(a) { | |
| return rtl.strToGUIDR( | |
| a, | |
| (pas.System ? pas.System.TGuid : pas.system.tguid).$new() | |
| ); | |
| }, | |
| getIntfGUIDR: function(a) { | |
| if (!a) return null; | |
| if (!a.$guidr) { | |
| var b = rtl.createTGUID(a.$guid); | |
| a.hasOwnProperty("$guid") || (a = Object.getPrototypeOf(a)); | |
| b.$intf = a; | |
| a.$guidr = b; | |
| } | |
| return a.$guidr; | |
| }, | |
| addIntf: function(a, b, c) { | |
| function d(a) { | |
| return "function" === typeof a | |
| ? function() { | |
| return a.apply(this.$o, arguments); | |
| } | |
| : function() { | |
| rtl.raiseE("EAbstractError"); | |
| }; | |
| } | |
| c || (c = {}); | |
| var e = b, | |
| f = Object.create(e); | |
| a.hasOwnProperty("$intfmaps") || (a.$intfmaps = {}); | |
| a.$intfmaps[b.$guid] = f; | |
| do { | |
| b = e.$names; | |
| if (!b) break; | |
| for (var g = 0; g < b.length; g++) { | |
| var h = b[g], | |
| l = c[h]; | |
| l || (l = h); | |
| f[h] = d(a[l]); | |
| } | |
| e = Object.getPrototypeOf(e); | |
| } while (null != e); | |
| }, | |
| getIntfG: function(a, b, c) { | |
| if (!a) return null; | |
| var d = a.$intfmaps; | |
| if (!d) return null; | |
| d = d[b]; | |
| if (!d) return null; | |
| if ("function" === typeof d) return d.call(a); | |
| var e = null; | |
| a.$interfaces && (e = a.$interfaces[b]); | |
| e || | |
| ((e = Object.create(d)), | |
| (e.$o = a), | |
| a.$interfaces || (a.$interfaces = {}), | |
| (a.$interfaces[b] = e)); | |
| if ("object" === typeof c) { | |
| var f = null; | |
| return 0 === | |
| e.QueryInterface(rtl.getIntfGUIDR(c), { | |
| get: function() { | |
| return f; | |
| }, | |
| set: function(a) { | |
| f = a; | |
| } | |
| }) | |
| ? f | |
| : null; | |
| } | |
| 2 === c && "com" === e.$kind && e._AddRef(); | |
| return e; | |
| }, | |
| getIntfT: function(a, b) { | |
| return rtl.getIntfG(a, b.$guid); | |
| }, | |
| queryIntfT: function(a, b) { | |
| return rtl.getIntfG(a, b.$guid, b); | |
| }, | |
| queryIntfIsT: function(a, b) { | |
| a = rtl.getIntfG(a, b.$guid); | |
| if (!a) return !1; | |
| "com" === a.$kind && a._Release(); | |
| return !0; | |
| }, | |
| asIntfT: function(a, b) { | |
| a = rtl.getIntfG(a, b.$guid); | |
| if (null !== a) return a; | |
| rtl.raiseEInvalidCast(); | |
| }, | |
| intfIsIntfT: function(a, b) { | |
| return null !== a && rtl.queryIntfIsT(a.$o, b); | |
| }, | |
| intfAsIntfT: function(a, b) { | |
| if (a && ((a = rtl.getIntfG(a.$o, b.$guid)), null !== a)) return a; | |
| rtl.raiseEInvalidCast(); | |
| }, | |
| intfIsClass: function(a, b) { | |
| return null != a && rtl.is(a.$o, b); | |
| }, | |
| intfAsClass: function(a, b) { | |
| return null == a ? null : rtl.as(a.$o, b); | |
| }, | |
| intfToClass: function(a, b) { | |
| return null !== a && rtl.is(a.$o, b) ? a.$o : null; | |
| }, | |
| intfRefs: { | |
| ref: function(a, b) { | |
| var c = this[a]; | |
| c && (delete this[a], c._Release()); | |
| return (this[a] = b); | |
| }, | |
| free: function() { | |
| for (var a in this) this.hasOwnProperty(a) && this[a]._Release(); | |
| } | |
| }, | |
| createIntfRefs: function() { | |
| return Object.create(rtl.intfRefs); | |
| }, | |
| setIntfP: function(a, b, c, d) { | |
| var e = a[b]; | |
| e !== c && | |
| (null !== e && ((a[b] = null), e._Release()), | |
| null !== c && (d || c._AddRef(), (a[b] = c))); | |
| }, | |
| setIntfL: function(a, b, c) { | |
| a !== b | |
| ? (null !== b && (c || b._AddRef()), null !== a && a._Release()) | |
| : c && null !== a && a._Release(); | |
| return b; | |
| }, | |
| _AddRef: function(a) { | |
| a && a._AddRef(); | |
| return a; | |
| }, | |
| _Release: function(a) { | |
| a && a._Release(); | |
| return a; | |
| }, | |
| checkMethodCall: function(a, b) { | |
| (rtl.isObject(a) && rtl.is(a, b)) || rtl.raiseE("EInvalidCast"); | |
| }, | |
| oc: function(a) { | |
| if ( | |
| Math.floor(a) === a && | |
| -9007199254740991 <= a && | |
| 9007199254740991 >= a | |
| ) | |
| return a; | |
| rtl.raiseE("EIntOverflow"); | |
| }, | |
| rc: function(a, b, c) { | |
| if (Math.floor(a) === a && a >= b && a <= c) return a; | |
| rtl.raiseE("ERangeError"); | |
| }, | |
| rcc: function(a, b, c) { | |
| if ("string" === typeof a && 1 === a.length) { | |
| var d = a.charCodeAt(0); | |
| if (d >= b && d <= c) return a; | |
| } | |
| rtl.raiseE("ERangeError"); | |
| }, | |
| rcSetCharAt: function(a, b, c) { | |
| ("string" !== typeof a || 0 > b || b >= a.length) && | |
| rtl.raiseE("ERangeError"); | |
| return rtl.setCharAt(a, b, c); | |
| }, | |
| rcCharAt: function(a, b) { | |
| ("string" !== typeof a || 0 > b || b >= a.length) && | |
| rtl.raiseE("ERangeError"); | |
| return a.charAt(b); | |
| }, | |
| rcArrR: function(a, b) { | |
| if (Array.isArray(a) && "number" === typeof b && 0 <= b && b < a.length) { | |
| if (2 < arguments.length) { | |
| a = a[b]; | |
| for (var c = 2; c < arguments.length; c++) | |
| a = rtl.rcArrR(a, arguments[c]); | |
| return a; | |
| } | |
| return a[b]; | |
| } | |
| rtl.raiseE("ERangeError"); | |
| }, | |
| rcArrW: function(a, b, c) { | |
| for (var d = 3; d < arguments.length; d++) | |
| (a = rtl.rcArrR(a, b)), (b = arguments[d - 1]), (c = arguments[d]); | |
| if (Array.isArray(a) && "number" === typeof b && 0 <= b && b < a.length) | |
| return (a[b] = c); | |
| rtl.raiseE("ERangeError"); | |
| }, | |
| length: function(a) { | |
| return null == a ? 0 : a.length; | |
| }, | |
| arraySetLength: function(a, b, c) { | |
| for (var d = [], e = 2; e < arguments.length; e++) | |
| d.push({ dim: arguments[e] + 0, a: null, i: 0, src: null }); | |
| var f = d.length - 1, | |
| g = 0, | |
| h = d[f].dim, | |
| l = a; | |
| do { | |
| var k = []; | |
| 0 < g && | |
| ((e = d[g - 1]), | |
| (e.a[e.i] = k), | |
| (l = e.src && e.src.length > e.i ? e.src[e.i] : null), | |
| e.i++); | |
| if (g < f) (e = d[g]), (e.a = k), (e.i = 0), (e.src = l), g++; | |
| else { | |
| var r = l ? l.length : 0; | |
| if (rtl.isArray(b)) for (e = 0; e < h; e++) k[e] = e < r ? l[e] : []; | |
| else if (rtl.isObject(b)) | |
| if (rtl.isTRecord(b)) | |
| for (e = 0; e < h; e++) k[e] = e < r ? b.$clone(l[e]) : b.$new(); | |
| else for (e = 0; e < h; e++) k[e] = e < r ? rtl.refSet(l[e]) : {}; | |
| else for (e = 0; e < h; e++) k[e] = e < r ? l[e] : b; | |
| for (; 0 < g && d[g - 1].i >= d[g - 1].dim; ) g--; | |
| if (0 === g) return 0 === f ? k : d[0].a; | |
| } | |
| } while (1); | |
| }, | |
| arrayEq: function(a, b) { | |
| if (null === a) return null === b; | |
| if (null === b || a.length !== b.length) return !1; | |
| for (var c = 0; c < a.length; c++) if (a[c] !== b[c]) return !1; | |
| return !0; | |
| }, | |
| arrayClone: function(a, b, c, d, e, f) { | |
| if ("refSet" === a) for (; c < d; c++) e[f++] = rtl.refSet(b[c]); | |
| else if (rtl.isTRecord(a)) for (; c < d; c++) e[f++] = a.$clone(b[c]); | |
| else for (; c < d; c++) e[f++] = b[c]; | |
| }, | |
| arrayConcat: function(a) { | |
| for (var b = [], c = 0, d = 1; d < arguments.length; d++) { | |
| var e = arguments[d]; | |
| null !== e && (c += e.length); | |
| } | |
| b.length = c; | |
| c = 0; | |
| for (d = 1; d < arguments.length; d++) | |
| (e = arguments[d]), | |
| null !== e && | |
| (rtl.arrayClone(a, e, 0, e.length, b, c), (c += e.length)); | |
| return b; | |
| }, | |
| arrayConcatN: function() { | |
| for (var a = null, b = 1; b < arguments.length; b++) { | |
| var c = arguments[b]; | |
| null !== c && (a = null === a ? c : a.concat(c)); | |
| } | |
| return a; | |
| }, | |
| arrayCopy: function(a, b, c, d) { | |
| if (null === b) return []; | |
| 0 > c && (c = 0); | |
| void 0 === d && (d = b.length); | |
| d = c + d; | |
| d > b.length && (d = b.length); | |
| if (c >= d) return []; | |
| if (0 === a) return b.slice(c, d); | |
| var e = []; | |
| e.length = d - c; | |
| rtl.arrayClone(a, b, c, d, e, 0); | |
| return e; | |
| }, | |
| setCharAt: function(a, b, c) { | |
| return a.substr(0, b) + c + a.substr(b + 1); | |
| }, | |
| getResStr: function(a, b) { | |
| a = a.$resourcestrings[b]; | |
| return a.current ? a.current : a.org; | |
| }, | |
| createSet: function() { | |
| for (var a = {}, b = 0; b < arguments.length; b++) | |
| if (null != arguments[b]) a[arguments[b]] = !0; | |
| else | |
| for ( | |
| var c = arguments[(b += 1)], d = arguments[(b += 1)]; | |
| c <= d; | |
| c++ | |
| ) | |
| a[c] = !0; | |
| return a; | |
| }, | |
| cloneSet: function(a) { | |
| var b = {}, | |
| c; | |
| for (c in a) b[c] = !0; | |
| return b; | |
| }, | |
| refSet: function(a) { | |
| Object.defineProperty(a, "$shared", { | |
| enumerable: !1, | |
| configurable: !0, | |
| writable: !0, | |
| value: !0 | |
| }); | |
| return a; | |
| }, | |
| includeSet: function(a, b) { | |
| a.$shared && (a = rtl.cloneSet(a)); | |
| a[b] = !0; | |
| return a; | |
| }, | |
| excludeSet: function(a, b) { | |
| a.$shared && (a = rtl.cloneSet(a)); | |
| delete a[b]; | |
| return a; | |
| }, | |
| diffSet: function(a, b) { | |
| var c = {}, | |
| d; | |
| for (d in a) b[d] || (c[d] = !0); | |
| return c; | |
| }, | |
| unionSet: function(a, b) { | |
| var c = {}, | |
| d; | |
| for (d in a) c[d] = !0; | |
| for (d in b) c[d] = !0; | |
| return c; | |
| }, | |
| intersectSet: function(a, b) { | |
| var c = {}, | |
| d; | |
| for (d in a) b[d] && (c[d] = !0); | |
| return c; | |
| }, | |
| symDiffSet: function(a, b) { | |
| var c = {}, | |
| d; | |
| for (d in a) b[d] || (c[d] = !0); | |
| for (d in b) a[d] || (c[d] = !0); | |
| return c; | |
| }, | |
| eqSet: function(a, b) { | |
| for (var c in a) if (!b[c]) return !1; | |
| for (c in b) if (!a[c]) return !1; | |
| return !0; | |
| }, | |
| neSet: function(a, b) { | |
| return !rtl.eqSet(a, b); | |
| }, | |
| leSet: function(a, b) { | |
| for (var c in a) if (!b[c]) return !1; | |
| return !0; | |
| }, | |
| geSet: function(a, b) { | |
| for (var c in b) if (!a[c]) return !1; | |
| return !0; | |
| }, | |
| strSetLength: function(a, b) { | |
| var c = a.length; | |
| if (c > b) return a.substring(0, b); | |
| if (a.repeat) return a + " ".repeat(b - c); | |
| for (; c < b; ) (a += " "), c++; | |
| return a; | |
| }, | |
| spaceLeft: function(a, b) { | |
| var c = a.length; | |
| if (c >= b) return a; | |
| if (a.repeat) return " ".repeat(b - c) + a; | |
| for (; c < b; ) (a = " " + a), c++; | |
| return a; | |
| }, | |
| floatToStr: function(a, b, c) { | |
| if (2 < arguments.length) return rtl.spaceLeft(a.toFixed(c), b); | |
| var d = "", | |
| e = Math.abs(a); | |
| 1e10 > e ? (d = "00") : 1e100 > e && (d = "0"); | |
| 2 > arguments.length ? (b = 9) : 9 > b && (b = 9); | |
| e = (0 < a ? " " : "") + a.toExponential(b - 8); | |
| e = e.replace(/e(.)/, "E$1" + d); | |
| return rtl.spaceLeft(e, b); | |
| }, | |
| valEnum: function(a, b, c) { | |
| a = a.toLowerCase(); | |
| for (var d in b) | |
| if ("string" === typeof d && d.toLowerCase() === a) return c(0), b[d]; | |
| c(1); | |
| return 0; | |
| }, | |
| lw: function(a) { | |
| return 0 > a ? a + 4294967296 : a; | |
| }, | |
| and: function(a, b) { | |
| return ( | |
| 2147483648 * ((a / 2147483648) & (b / 2147483648)) + | |
| (a & 2147483647 & b & 2147483647) | |
| ); | |
| }, | |
| or: function(a, b) { | |
| return ( | |
| 2147483648 * ((a / 2147483648) | (b / 2147483648)) + | |
| ((a & 2147483647) | (b & 2147483647)) | |
| ); | |
| }, | |
| xor: function(a, b) { | |
| return ( | |
| 2147483648 * ((a / 2147483648) ^ (b / 2147483648)) + | |
| ((a & 2147483647) ^ (b & 2147483647)) | |
| ); | |
| }, | |
| shr: function(a, b) { | |
| 0 > a && (a += rtl.hiInt); | |
| return 2147483648 > a | |
| ? a >> b | |
| : 0 >= b | |
| ? a | |
| : 54 < b | |
| ? 0 | |
| : Math.floor(a / Math.pow(2, b)); | |
| }, | |
| shl: function(a, b) { | |
| 0 > a && (a += rtl.hiInt); | |
| if (0 >= b) return a; | |
| if (54 < b) return 0; | |
| a *= Math.pow(2, b); | |
| return a <= rtl.hiInt ? a : a % rtl.hiInt; | |
| }, | |
| initRTTI: function() { | |
| function a(a, b, c) { | |
| c || (c = rtl.tTypeInfo); | |
| rtl.debug_rtti && | |
| rtl.debug( | |
| 'initRTTI.newBaseTI "' + a + '" ' + b + ' ("' + c.name + '")' | |
| ); | |
| c = Object.create(c); | |
| c.name = a; | |
| c.kind = b; | |
| return (rtl[a] = c); | |
| } | |
| function b(b, c, d, h) { | |
| b = a(b, 1, rtl.tTypeInfoInteger); | |
| b.minvalue = c; | |
| b.maxvalue = d; | |
| b.ordtype = h; | |
| return b; | |
| } | |
| function c(a, b) { | |
| var c = Object.create(rtl.tTypeMember); | |
| c.name = a; | |
| c.kind = b; | |
| rtl[a] = c; | |
| } | |
| rtl.debug_rtti && rtl.debug("initRTTI"); | |
| rtl.tTypeInfo = { name: "tTypeInfo" }; | |
| a("tTypeInfoInteger", 1); | |
| b("shortint", -128, 127, 0); | |
| b("byte", 0, 255, 1); | |
| b("smallint", -32768, 32767, 2); | |
| b("word", 0, 65535, 3); | |
| b("longint", -2147483648, 2147483647, 4); | |
| b("longword", 0, 4294967295, 5); | |
| b("nativeint", -4503599627370496, 0xfffffffffffff, 6); | |
| b("nativeuint", 0, 0xfffffffffffff, 7); | |
| a("char", 2); | |
| a("string", 3); | |
| a("tTypeInfoEnum", 4, rtl.tTypeInfoInteger); | |
| a("tTypeInfoSet", 5); | |
| a("double", 6); | |
| a("boolean", 7); | |
| a("tTypeInfoProcVar", 8); | |
| a("tTypeInfoMethodVar", 9, rtl.tTypeInfoProcVar); | |
| a("tTypeInfoArray", 10); | |
| a("tTypeInfoDynArray", 11); | |
| a("tTypeInfoPointer", 15); | |
| a("pointer", 15, rtl.tTypeInfoPointer).reftype = null; | |
| a("jsvalue", 16); | |
| a("tTypeInfoRefToProcVar", 17, rtl.tTypeInfoProcVar); | |
| rtl.tTypeMember = {}; | |
| c("tTypeMemberField", 1); | |
| c("tTypeMemberMethod", 2); | |
| c("tTypeMemberProperty", 3); | |
| rtl.tTypeMembers = {}; | |
| var d = a("tTypeInfoStruct", 0); | |
| d.$addMember = function(a, b, c) { | |
| if (rtl.debug_rtti) { | |
| if (!rtl.hasString(a) || "$" === a.charAt()) | |
| throw 'invalid member "' + a + '", this="' + this.name + '"'; | |
| if (!rtl.is(b, rtl.tTypeMember)) | |
| throw 'invalid ancestor "' + | |
| b + | |
| ":" + | |
| b.name + | |
| '", "' + | |
| this.name + | |
| "." + | |
| a + | |
| '"'; | |
| if (void 0 != c && "object" != typeof c) | |
| throw 'invalid options "' + c + '", "' + this.name + "." + a + '"'; | |
| } | |
| b = Object.create(b); | |
| b.name = a; | |
| this.members[a] = b; | |
| this.names.push(a); | |
| if (rtl.isObject(c)) | |
| for (var d in c) c.hasOwnProperty(d) && (b[d] = c[d]); | |
| return b; | |
| }; | |
| d.addField = function(a, b, c) { | |
| c = this.$addMember(a, rtl.tTypeMemberField, c); | |
| if (rtl.debug_rtti && !rtl.is(b, rtl.tTypeInfo)) | |
| throw 'invalid type "' + b + '", "' + this.name + "." + a + '"'; | |
| c.typeinfo = b; | |
| this.fields.push(a); | |
| return c; | |
| }; | |
| d.addFields = function() { | |
| for (var a = 0; a < arguments.length; ) { | |
| var b = arguments[a++], | |
| c = arguments[a++]; | |
| a < arguments.length && "object" === typeof arguments[a] | |
| ? this.addField(b, c, arguments[a++]) | |
| : this.addField(b, c); | |
| } | |
| }; | |
| d.addMethod = function(a, b, c, d, l) { | |
| l = this.$addMember(a, rtl.tTypeMemberMethod, l); | |
| l.methodkind = b; | |
| l.procsig = rtl.newTIProcSig(c); | |
| l.procsig.resulttype = d ? d : null; | |
| this.methods.push(a); | |
| return l; | |
| }; | |
| d.addProperty = function(a, b, c, d, l, k) { | |
| k = this.$addMember(a, rtl.tTypeMemberProperty, k); | |
| k.flags = b; | |
| k.typeinfo = c; | |
| k.getter = d; | |
| k.setter = l; | |
| rtl.isArray(k.params) && (k.params = rtl.newTIParams(k.params)); | |
| this.properties.push(a); | |
| rtl.isString(k.stored) || (k.stored = ""); | |
| return k; | |
| }; | |
| d.getField = function(a) { | |
| return this.members[this.fields[a]]; | |
| }; | |
| d.getMethod = function(a) { | |
| return this.members[this.methods[a]]; | |
| }; | |
| d.getProperty = function(a) { | |
| return this.members[this.properties[a]]; | |
| }; | |
| a("tTypeInfoRecord", 12, rtl.tTypeInfoStruct); | |
| a("tTypeInfoClass", 13, rtl.tTypeInfoStruct); | |
| a("tTypeInfoClassRef", 14); | |
| a("tTypeInfoInterface", 18, rtl.tTypeInfoStruct); | |
| a("tTypeInfoHelper", 19, rtl.tTypeInfoStruct); | |
| }, | |
| tSectionRTTI: { | |
| $module: null, | |
| $inherited: function(a, b, c) { | |
| rtl.debug_rtti && | |
| rtl.debug( | |
| 'tSectionRTTI.newTI "' + | |
| (this.$module ? this.$module.$name : "(no module)") + | |
| '"."' + | |
| a + | |
| '" (' + | |
| b.name + | |
| ") " + | |
| (c ? "init" : "forward") | |
| ); | |
| var d = this[a]; | |
| if (d) { | |
| if (!d.$forward) throw 'duplicate type "' + a + '"'; | |
| if (!b.isPrototypeOf(d)) | |
| throw 'typeinfo ancestor mismatch "' + | |
| a + | |
| '" ancestor="' + | |
| b.name + | |
| '" t.name="' + | |
| d.name + | |
| '"'; | |
| } else | |
| (d = Object.create(b)), | |
| (d.name = a), | |
| (d.$module = this.$module), | |
| (this[a] = d); | |
| if (c) { | |
| delete d.$forward; | |
| for (var e in c) c.hasOwnProperty(e) && (d[e] = c[e]); | |
| } else d.$forward = !0; | |
| return d; | |
| }, | |
| $Scope: function(a, b, c) { | |
| a = this.$inherited(a, b, c); | |
| a.members = {}; | |
| a.names = []; | |
| a.fields = []; | |
| a.methods = []; | |
| a.properties = []; | |
| return a; | |
| }, | |
| $TI: function(a, b, c) { | |
| a = this.$inherited(a, rtl.tTypeInfo, c); | |
| a.kind = b; | |
| return a; | |
| }, | |
| $Int: function(a, b) { | |
| return this.$inherited(a, rtl.tTypeInfoInteger, b); | |
| }, | |
| $Enum: function(a, b) { | |
| return this.$inherited(a, rtl.tTypeInfoEnum, b); | |
| }, | |
| $Set: function(a, b) { | |
| return this.$inherited(a, rtl.tTypeInfoSet, b); | |
| }, | |
| $StaticArray: function(a, b) { | |
| return this.$inherited(a, rtl.tTypeInfoArray, b); | |
| }, | |
| $DynArray: function(a, b) { | |
| return this.$inherited(a, rtl.tTypeInfoDynArray, b); | |
| }, | |
| $ProcVar: function(a, b) { | |
| return this.$inherited(a, rtl.tTypeInfoProcVar, b); | |
| }, | |
| $RefToProcVar: function(a, b) { | |
| return this.$inherited(a, rtl.tTypeInfoRefToProcVar, b); | |
| }, | |
| $MethodVar: function(a, b) { | |
| return this.$inherited(a, rtl.tTypeInfoMethodVar, b); | |
| }, | |
| $Record: function(a, b) { | |
| return this.$Scope(a, rtl.tTypeInfoRecord, b); | |
| }, | |
| $Class: function(a, b) { | |
| return this.$Scope(a, rtl.tTypeInfoClass, b); | |
| }, | |
| $ClassRef: function(a, b) { | |
| return this.$inherited(a, rtl.tTypeInfoClassRef, b); | |
| }, | |
| $Pointer: function(a, b) { | |
| return this.$inherited(a, rtl.tTypeInfoPointer, b); | |
| }, | |
| $Interface: function(a, b) { | |
| return this.$Scope(a, rtl.tTypeInfoInterface, b); | |
| }, | |
| $Helper: function(a, b) { | |
| return this.$Scope(a, rtl.tTypeInfoHelper, b); | |
| } | |
| }, | |
| newTIParam: function(a) { | |
| return { | |
| name: a[0], | |
| typeinfo: a[1], | |
| flags: rtl.isNumber(a[2]) ? a[2] : 0 | |
| }; | |
| }, | |
| newTIParams: function(a) { | |
| var b = []; | |
| if (rtl.isArray(a)) | |
| for (var c = 0; c < a.length; c++) b.push(rtl.newTIParam(a[c])); | |
| return b; | |
| }, | |
| newTIProcSig: function(a, b, c) { | |
| return { params: rtl.newTIParams(a), resulttype: b, flags: c }; | |
| } | |
| }; | |
| rtl.module( | |
| "System", | |
| [], | |
| function() { | |
| var a = this, | |
| b = a.$impl; | |
| this.sLineBreak = this.LineEnding = "\n"; | |
| rtl.createClass(a, "TObject", null, function() { | |
| this.$init = function() {}; | |
| this.$final = function() {}; | |
| this.Create = function() { | |
| return this; | |
| }; | |
| this.Destroy = function() {}; | |
| this.Free = function() { | |
| this.$destroy("Destroy"); | |
| }; | |
| this.FieldAddress = function(a) { | |
| if ("" === a) return null; | |
| var b = a.toLowerCase(); | |
| for (a = this.$class; null !== a; ) { | |
| var c = a.$rtti; | |
| for (var f = 0, g = c.fields.length - 1; f <= g; f++) { | |
| var h = f; | |
| h = c.getField(h); | |
| if (h.name.toLowerCase() === b) return h; | |
| } | |
| a = a.$ancestor ? a.$ancestor : null; | |
| } | |
| return null; | |
| }; | |
| this.AfterConstruction = function() {}; | |
| this.BeforeDestruction = function() {}; | |
| }); | |
| this.IsConsole = !0; | |
| this.OnParamStr = this.OnParamCount = null; | |
| this.ParamCount = function() { | |
| return null != a.OnParamCount ? a.OnParamCount() : 0; | |
| }; | |
| this.ParamStr = function(b) { | |
| return null != a.OnParamStr ? a.OnParamStr(b) : 0 === b ? "js" : ""; | |
| }; | |
| this.Trunc = function(b) { | |
| Math.trunc || | |
| (Math.trunc = function(a) { | |
| a = +a; | |
| return isFinite(a) | |
| ? a - (a % 1) || (0 > a ? -0 : 0 === a ? a : 0) | |
| : a; | |
| }); | |
| a.Trunc = Math.trunc; | |
| return Math.trunc(b); | |
| }; | |
| this.Int = function(b) { | |
| return a.Trunc(b); | |
| }; | |
| this.Copy = function(a, b, e) { | |
| 1 > b && (b = 1); | |
| return 0 < e ? a.substring(b - 1, b + e - 1) : ""; | |
| }; | |
| this.Copy$1 = function(a, b) { | |
| 1 > b && (b = 1); | |
| return a.substr(b - 1); | |
| }; | |
| this.Delete = function(b, d, e) { | |
| if (!(1 > d || d > b.get().length || 0 >= e)) { | |
| var c = b.get(); | |
| b.set(a.Copy(c, 1, d - 1) + a.Copy$1(c, d + e)); | |
| } | |
| }; | |
| this.Pos = function(a, b) { | |
| return b.indexOf(a) + 1; | |
| }; | |
| this.Insert = function(b, d, e) { | |
| if ("" !== b) { | |
| var c = d.get(); | |
| 1 > e | |
| ? d.set(b + c) | |
| : e > c.length | |
| ? d.set(c + b) | |
| : d.set(a.Copy(c, 1, e - 1) + b + a.Copy(c, e, c.length)); | |
| } | |
| }; | |
| this.upcase = function(a) { | |
| return a.toUpperCase(); | |
| }; | |
| this.val = function(a, d, e) { | |
| d.set(b.valint(a, -9007199254740991, 9007199254740991, e)); | |
| }; | |
| this.StringOfChar = function(a, b) { | |
| var c = ""; | |
| if (0 < b && a.repeat) return a.repeat(b); | |
| for (var d = 1; d <= b; d++) c += a; | |
| return c; | |
| }; | |
| this.Writeln = function() { | |
| var a; | |
| var d = arguments.length - 1; | |
| if (null != b.WriteCallBack) | |
| for (a = 0; a <= d; a++) { | |
| var e = a; | |
| b.WriteCallBack(arguments[e], e === d); | |
| } | |
| else { | |
| a = b.WriteBuf; | |
| for (var f = 0; f <= d; f++) (e = f), (a += "" + arguments[e]); | |
| console.log(a); | |
| b.WriteBuf = ""; | |
| } | |
| }; | |
| a.$init = function() { | |
| rtl.exitcode = 0; | |
| }; | |
| }, | |
| null, | |
| function() { | |
| var a = this, | |
| b = a.$impl; | |
| b.WriteBuf = ""; | |
| b.WriteCallBack = null; | |
| b.valint = function(b, d, e, f) { | |
| var c = 0; | |
| var h = Number(b); | |
| if (isNaN(h)) | |
| if (((h = a.Copy(b, 1, 1)), "$" === h)) | |
| h = Number("0x" + a.Copy$1(b, 2)); | |
| else if ("&" === h) h = Number("0o" + a.Copy$1(b, 2)); | |
| else if ("%" === h) h = Number("0b" + a.Copy$1(b, 2)); | |
| else return f.set(1), c; | |
| isNaN(h) || h !== a.Int(h) | |
| ? f.set(1) | |
| : h < d || h > e | |
| ? f.set(2) | |
| : ((c = a.Trunc(h)), f.set(0)); | |
| return c; | |
| }; | |
| } | |
| ); | |
| rtl.module("RTLConsts", ["System"], function() { | |
| this.$resourcestrings = { | |
| SArgumentMissing: { org: 'Missing argument in format "%s"' }, | |
| SInvalidFormat: { org: 'Invalid format specifier : "%s"' }, | |
| SInvalidArgIndex: { org: 'Invalid argument index in format: "%s"' }, | |
| SListCapacityError: { org: "List capacity (%s) exceeded." }, | |
| SListCountError: { org: "List count (%s) out of bounds." }, | |
| SListIndexError: { org: "List index (%s) out of bounds" }, | |
| SSortedListError: { org: "Operation not allowed on sorted list" }, | |
| SDuplicateString: { org: "String list does not allow duplicates" }, | |
| SErrFindNeedsSortedList: { org: "Cannot use find on unsorted list" }, | |
| SInvalidName: { org: 'Invalid component name: "%s"' }, | |
| SInvalidBoolean: { org: '"%s" is not a valid boolean.' }, | |
| SDuplicateName: { org: 'Duplicate component name: "%s"' }, | |
| SErrInvalidDate: { org: 'Invalid date: "%s"' }, | |
| SErrInvalidTimeFormat: { org: 'Invalid time format: "%s"' }, | |
| SInvalidDateFormat: { org: 'Invalid date format: "%s"' }, | |
| SCantReadPropertyS: { org: 'Cannot read property "%s"' }, | |
| SCantWritePropertyS: { org: 'Cannot write property "%s"' }, | |
| SErrPropertyNotFound: { org: 'Unknown property: "%s"' }, | |
| SIndexedPropertyNeedsParams: { | |
| org: 'Indexed property "%s" needs parameters' | |
| }, | |
| SErrInvalidTypecast: { org: "Invalid class typecast" }, | |
| SErrInvalidInteger: { org: 'Invalid integer value: "%s"' }, | |
| SErrInvalidFloat: { org: 'Invalid floating-point value: "%s"' }, | |
| SInvalidDateTime: { org: "Invalid date-time value: %s" }, | |
| SInvalidCurrency: { org: "Invalid currency value: %s" }, | |
| SErrInvalidDayOfWeek: { org: "%d is not a valid day of the week" }, | |
| SErrInvalidTimeStamp: { org: 'Invalid date/timestamp : "%s"' }, | |
| SErrInvalidDateWeek: { org: "%d %d %d is not a valid dateweek" }, | |
| SErrInvalidDayOfYear: { org: "Year %d does not have a day number %d" }, | |
| SErrInvalidDateMonthWeek: { | |
| org: "Year %d, month %d, Week %d and day %d is not a valid date." | |
| }, | |
| SErrInvalidDayOfWeekInMonth: { | |
| org: "Year %d Month %d NDow %d DOW %d is not a valid date" | |
| }, | |
| SInvalidJulianDate: { | |
| org: "%f Julian cannot be represented as a DateTime" | |
| }, | |
| SErrInvalidHourMinuteSecMsec: { | |
| org: "%d:%d:%d.%d is not a valid time specification" | |
| }, | |
| SInvalidGUID: { org: '"%s" is not a valid GUID value' }, | |
| SEmptyStreamIllegalReader: { | |
| org: "Illegal Nil stream for TReader constructor" | |
| }, | |
| SInvalidPropertyValue: { org: "Invalid value for property" }, | |
| SInvalidImage: { org: "Invalid stream format" }, | |
| SUnknownProperty: { org: 'Unknown property: "%s"' }, | |
| SUnknownPropertyType: { org: "Unknown property type %d" }, | |
| SAncestorNotFound: { org: 'Ancestor class for "%s" not found.' }, | |
| SUnsupportedPropertyVariantType: { | |
| org: "Unsupported property variant type %d" | |
| }, | |
| SPropertyException: { org: "Error reading %s%s%s: %s" }, | |
| SInvalidPropertyPath: { org: "Invalid property path" }, | |
| SReadOnlyProperty: { org: "Property is read-only" }, | |
| SClassNotFound: { org: 'Class "%s" not found' }, | |
| SEmptyStreamIllegalWriter: { | |
| org: "Illegal Nil stream for TWriter constructor" | |
| }, | |
| SErrInvalidPropertyType: { | |
| org: "Invalid property type from streamed property: %d" | |
| }, | |
| SParserExpected: { org: "Wrong token type: %s expected" }, | |
| SParserInvalidFloat: { org: "Invalid floating point number: %s" }, | |
| SParserInvalidInteger: { org: "Invalid integer number: %s" }, | |
| SParserUnterminatedString: { org: "Unterminated string" }, | |
| SParserWrongTokenType: { | |
| org: "Wrong token type: %s expected but %s found" | |
| }, | |
| SParserWrongTokenSymbol: { | |
| org: "Wrong token symbol: %s expected but %s found" | |
| }, | |
| SParserLocInfo: { org: " (at %d,%d, stream offset %.8x)" }, | |
| SParserUnterminatedBinValue: { org: "Unterminated byte value" }, | |
| SParserInvalidProperty: { org: "Invalid property" } | |
| }; | |
| }); | |
| rtl.module("Types", ["System"], function() {}); | |
| rtl.module("JS", ["System", "Types"], function() { | |
| var a = this; | |
| this.isInteger = function(a) { | |
| return Math.floor(a) === a; | |
| }; | |
| this.isNull = function(a) { | |
| return null === a; | |
| }; | |
| this.TJSValueType = { | |
| 0: "jvtNull", | |
| jvtNull: 0, | |
| 1: "jvtBoolean", | |
| jvtBoolean: 1, | |
| 2: "jvtInteger", | |
| jvtInteger: 2, | |
| 3: "jvtFloat", | |
| jvtFloat: 3, | |
| 4: "jvtString", | |
| jvtString: 4, | |
| 5: "jvtObject", | |
| jvtObject: 5, | |
| 6: "jvtArray", | |
| jvtArray: 6 | |
| }; | |
| this.GetValueType = function(b) { | |
| var c = 0; | |
| if (a.isNull(b)) c = 0; | |
| else { | |
| var d = typeof b; | |
| "string" === d | |
| ? (c = 4) | |
| : "boolean" === d | |
| ? (c = 1) | |
| : "object" === d | |
| ? (c = rtl.isArray(b) ? 6 : 5) | |
| : "number" === d && (c = a.isInteger(b) ? 2 : 3); | |
| } | |
| return c; | |
| }; | |
| }); | |
| rtl.module( | |
| "SysUtils", | |
| ["System", "RTLConsts", "JS"], | |
| function() { | |
| var a = this, | |
| b = a.$impl; | |
| this.FreeAndNil = function(a) { | |
| var b = a.get(); | |
| null !== b && (a.set(null), b.$destroy("Destroy")); | |
| }; | |
| rtl.createClass(a, "Exception", pas.System.TObject, function() { | |
| this.LogMessageOnCreate = !1; | |
| this.$init = function() { | |
| pas.System.TObject.$init.call(this); | |
| this.fMessage = ""; | |
| this.FNodeJSError = null; | |
| }; | |
| this.$final = function() { | |
| this.FNodeJSError = void 0; | |
| pas.System.TObject.$final.call(this); | |
| }; | |
| this.Create$1 = function(a) { | |
| this.fMessage = a; | |
| this.FNodeJSError = Error(); | |
| this.LogMessageOnCreate && | |
| pas.System.Writeln( | |
| "Created exception ", | |
| this.$classname, | |
| " with message: ", | |
| a | |
| ); | |
| return this; | |
| }; | |
| this.CreateFmt = function(b, c) { | |
| this.Create$1(a.Format(b, c)); | |
| return this; | |
| }; | |
| }); | |
| rtl.createClass(a, "EConvertError", a.Exception, function() {}); | |
| this.TrimLeft = function(a) { | |
| return a.replace(/^[\s\uFEFF\xA0\x00-\x1f]+/, ""); | |
| }; | |
| this.LowerCase = function(a) { | |
| return a.toLowerCase(); | |
| }; | |
| this.CompareText = function(a, b) { | |
| a = a.toLowerCase(); | |
| b = b.toLowerCase(); | |
| return a > b ? 1 : a < b ? -1 : 0; | |
| }; | |
| this.Format = function(c, d) { | |
| function e() { | |
| function a() { | |
| var a = 0, | |
| e = 0; | |
| if (-1 === f) { | |
| for ( | |
| r = k; | |
| k <= v && "9" >= c.charAt(k - 1) && "0" <= c.charAt(k - 1); | |
| ) | |
| k += 1; | |
| k > v && b.DoFormatError(1, c); | |
| "*" === c.charAt(k - 1) | |
| ? (-1 === n ? (e = w) : ((e = n), (n += 1)), | |
| (k > r || e > rtl.length(d) - 1) && b.DoFormatError(1, c), | |
| (w = e + 1), | |
| rtl.isNumber(d[e]) && pas.JS.isInteger(d[e]) | |
| ? (f = Math.floor(d[e])) | |
| : b.DoFormatError(1, c), | |
| (k += 1)) | |
| : r < k | |
| ? (pas.System.val( | |
| pas.System.Copy(c, r, k - r), | |
| { | |
| get: function() { | |
| return f; | |
| }, | |
| set: function(a) { | |
| f = a; | |
| } | |
| }, | |
| { | |
| get: function() { | |
| return a; | |
| }, | |
| set: function(b) { | |
| a = b; | |
| } | |
| } | |
| ), | |
| 0 < a && b.DoFormatError(1, c)) | |
| : (f = -1); | |
| } | |
| } | |
| var e = "", | |
| f = 0; | |
| f = q = u = n = -1; | |
| k += 1; | |
| if ("%" === c.charAt(k - 1)) return "%"; | |
| ":" !== c.charAt(k - 1) ? a() : (f = 0); | |
| ":" === c.charAt(k - 1) && | |
| (-1 === f && b.DoFormatError(2, c), (n = f), (f = -1), (k += 1)); | |
| "-" === c.charAt(k - 1) ? ((x = !0), (k += 1)) : (x = !1); | |
| a(); | |
| -1 !== f && ((u = f), (f = -1)); | |
| "." === c.charAt(k - 1) && | |
| ((k += 1), a(), -1 === f && (f = 0), (q = f)); | |
| return (e = pas.System.upcase(c.charAt(k - 1))); | |
| } | |
| function f(a, e) { | |
| t = -1 === n ? w : n; | |
| w = t + 1; | |
| return t > rtl.length(d) - 1 || pas.JS.GetValueType(d[t]) !== a | |
| ? (e && b.DoFormatError(3, c), --w, !1) | |
| : !0; | |
| } | |
| var l = "", | |
| k = 0, | |
| r = 0, | |
| w = 0, | |
| t = 0, | |
| v = 0, | |
| p = "", | |
| m = "", | |
| n = 0, | |
| u = 0, | |
| q = 0, | |
| x = !1; | |
| p = ""; | |
| p = 0; | |
| l = ""; | |
| v = c.length; | |
| r = k = 1; | |
| for (w = 0; k <= v; ) { | |
| for (; k <= v && "%" !== c.charAt(k - 1); ) k += 1; | |
| k > r && (l += pas.System.Copy(c, r, k - r)); | |
| if (k < v) { | |
| p = e(); | |
| if ("D" === p) | |
| f(2, !0), | |
| (m = a.IntToStr(Math.floor(d[t]))), | |
| (u = Math.abs(u)), | |
| (n = q - m.length), | |
| "-" !== m.charAt(0) | |
| ? (m = pas.System.StringOfChar("0", n) + m) | |
| : pas.System.Insert( | |
| pas.System.StringOfChar("0", n + 1), | |
| { | |
| get: function() { | |
| return m; | |
| }, | |
| set: function(a) { | |
| m = a; | |
| } | |
| }, | |
| 2 | |
| ); | |
| else if ("U" === p) | |
| f(2, !0), | |
| 0 > Math.floor(d[t]) && b.DoFormatError(3, c), | |
| (m = a.IntToStr(Math.floor(d[t]))), | |
| (u = Math.abs(u)), | |
| (n = q - m.length), | |
| (m = pas.System.StringOfChar("0", n) + m); | |
| else if ("E" === p) { | |
| if (f(3, !1) || f(2, !0)) | |
| m = a.FloatToStrF(rtl.getNumber(d[t]), 0, 9999, q); | |
| } else if ("F" === p) { | |
| if (f(3, !1) || f(2, !0)) | |
| m = a.FloatToStrF(rtl.getNumber(d[t]), 0, 9999, q); | |
| } else if ("G" === p) { | |
| if (f(3, !1) || f(2, !0)) | |
| m = a.FloatToStrF(rtl.getNumber(d[t]), 1, q, 3); | |
| } else if ("N" === p) { | |
| if (f(3, !1) || f(2, !0)) | |
| m = a.FloatToStrF(rtl.getNumber(d[t]), 3, 9999, q); | |
| } else if ("M" === p) { | |
| if (f(3, !1) || f(2, !0)) | |
| m = a.FloatToStrF(rtl.getNumber(d[t]), 4, 9999, q); | |
| } else if ("S" === p) | |
| f(4, !0), | |
| (p = "" + d[t]), | |
| (n = p.length), | |
| -1 !== q && n > q && (n = q), | |
| (m = pas.System.Copy(p, 1, n)); | |
| else if ("P" === p) f(2, !0), (m = a.IntToHex(Math.floor(d[t]), 31)); | |
| else if ("X" === p) | |
| if ((f(2, !0), (p = Math.floor(d[t])), (n = 31), q > n)) | |
| m = a.IntToHex(p, n); | |
| else { | |
| for (n = 1; 1 << (4 * n) <= p && 16 > n; ) n += 1; | |
| n > q && (q = n); | |
| m = a.IntToHex(p, q); | |
| } | |
| else "%" === p && (m = "%"); | |
| -1 !== u && | |
| m.length < u && | |
| (m = x | |
| ? m + pas.System.StringOfChar(" ", u - m.length) | |
| : pas.System.StringOfChar(" ", u - m.length) + m); | |
| l += m; | |
| } | |
| r = k += 1; | |
| } | |
| return l; | |
| }; | |
| var c = rtl.createSet(null, 65, 90, null, 97, 122, 95), | |
| d = rtl.unionSet(c, rtl.createSet(null, 48, 57)); | |
| this.IsValidIdent = function(a, b, g) { | |
| var e; | |
| var f = a.length; | |
| if (1 > f) return !1; | |
| var k = !0; | |
| for (e = 1; e <= f; ) { | |
| if (k) { | |
| if (!(a.charCodeAt(e - 1) in c)) return !1; | |
| k = !1; | |
| } else if (b && "." === a.charAt(e - 1)) { | |
| if (g) { | |
| if (e >= f) return !1; | |
| k = !0; | |
| } | |
| } else if (!(a.charCodeAt(e - 1) in d)) return !1; | |
| e += 1; | |
| } | |
| return !0; | |
| }; | |
| this.IntToStr = function(a) { | |
| return "" + a; | |
| }; | |
| this.TryStrToInt$1 = function(a, b) { | |
| var c = !1; | |
| c = 10; | |
| var d = "", | |
| e = void 0; | |
| d = a; | |
| a = pas.System.Copy(d, 1, 1); | |
| "$" === a ? (c = 16) : "&" === a ? (c = 8) : "%" === a && (c = 2); | |
| 10 !== c && | |
| pas.System.Delete( | |
| { | |
| get: function() { | |
| return d; | |
| }, | |
| set: function(a) { | |
| d = a; | |
| } | |
| }, | |
| 1, | |
| 1 | |
| ); | |
| e = parseInt(d, c); | |
| (c = !isNaN(e)) && b.set(Math.floor(e)); | |
| return c; | |
| }; | |
| this.StrToInt = function(b) { | |
| var c = 0; | |
| if ( | |
| !a.TryStrToInt$1(b, { | |
| get: function() { | |
| return c; | |
| }, | |
| set: function(a) { | |
| c = a; | |
| } | |
| }) | |
| ) | |
| throw a.EConvertError.$create("CreateFmt", [ | |
| rtl.getResStr(pas.RTLConsts, "SErrInvalidInteger"), | |
| [b] | |
| ]); | |
| return c; | |
| }; | |
| this.IntToHex = function(a, b) { | |
| var c; | |
| 0 === b && (b = 1); | |
| for (c = ""; 0 < a; ) | |
| (c = "0123456789ABCDEF".charAt((a & 15) + 1 - 1) + c), | |
| (a = Math.floor(a / 16)); | |
| for (; c.length < b; ) c = "0" + c; | |
| return c; | |
| }; | |
| this.TFloatFormat = { | |
| 0: "ffFixed", | |
| ffFixed: 0, | |
| 1: "ffGeneral", | |
| ffGeneral: 1, | |
| 2: "ffExponent", | |
| ffExponent: 2, | |
| 3: "ffNumber", | |
| ffNumber: 3, | |
| 4: "ffCurrency", | |
| ffCurrency: 4 | |
| }; | |
| this.FloatToStrF = function(c, d, g, h) { | |
| var e = "", | |
| f = ""; | |
| f = a.DecimalSeparator; | |
| 1 === d | |
| ? (e = b.FormatGeneralFloat(c, g, f)) | |
| : 2 === d | |
| ? (e = b.FormatExponentFloat(c, g, h, f)) | |
| : 0 === d | |
| ? (e = b.FormatFixedFloat(c, h, f)) | |
| : 3 === d | |
| ? (e = b.FormatNumberFloat(c, h, f, a.ThousandSeparator)) | |
| : 4 === d && | |
| (e = b.FormatNumberCurrency(1e4 * c, h, f, a.ThousandSeparator)); | |
| 4 !== d && | |
| 1 < e.length && | |
| "-" === e.charAt(0) && | |
| b.RemoveLeadingNegativeSign( | |
| { | |
| get: function() { | |
| return e; | |
| }, | |
| set: function(a) { | |
| e = a; | |
| } | |
| }, | |
| f | |
| ); | |
| return e; | |
| }; | |
| this.OnGetEnvironmentVariableCount = this.OnGetEnvironmentString = this.OnGetEnvironmentVariable = null; | |
| this.DecimalSeparator = "."; | |
| this.ThousandSeparator = ""; | |
| rtl.recNewT(a, "TFormatSettings", function() { | |
| this.$eq = function(a) { | |
| return !0; | |
| }; | |
| this.$assign = function(a) { | |
| return this; | |
| }; | |
| }); | |
| this.FormatSettings = a.TFormatSettings.$new(); | |
| this.NegCurrFormat = this.CurrencyFormat = 0; | |
| this.CurrencyDecimals = 2; | |
| this.CurrencyString = "$"; | |
| a.$init = function() { | |
| a.FormatSettings.$assign(a.TFormatSettings.$new()); | |
| }; | |
| }, | |
| null, | |
| function() { | |
| var a = this, | |
| b = a.$impl; | |
| b.feInvalidFormat = 1; | |
| b.feMissingArgument = 2; | |
| b.feInvalidArgIndex = 3; | |
| b.DoFormatError = function(b, d) { | |
| if (1 === b) | |
| throw a.EConvertError.$create("CreateFmt", [ | |
| rtl.getResStr(pas.RTLConsts, "SInvalidFormat"), | |
| [d] | |
| ]); | |
| if (2 === b) | |
| throw a.EConvertError.$create("CreateFmt", [ | |
| rtl.getResStr(pas.RTLConsts, "SArgumentMissing"), | |
| [d] | |
| ]); | |
| if (3 === b) | |
| throw a.EConvertError.$create("CreateFmt", [ | |
| rtl.getResStr(pas.RTLConsts, "SInvalidArgIndex"), | |
| [d] | |
| ]); | |
| }; | |
| b.maxdigits = 15; | |
| b.ReplaceDecimalSep = function(a, b) { | |
| var c = pas.System.Pos(".", a); | |
| return 0 < c | |
| ? pas.System.Copy(a, 1, c - 1) + | |
| b + | |
| pas.System.Copy(a, c + 1, a.length - c) | |
| : a; | |
| }; | |
| b.FormatGeneralFloat = function(c, d, e) { | |
| var f = "", | |
| g = 0, | |
| h = 0, | |
| l = 0, | |
| k = 0; | |
| if (-1 === d || 15 < d) d = 15; | |
| f = rtl.floatToStr(c, d + 7); | |
| f = a.TrimLeft(f); | |
| g = pas.System.Pos(".", f); | |
| if (0 === g) return f; | |
| h = pas.System.Pos("E", f); | |
| if (0 === h) return (f = b.ReplaceDecimalSep(f, e)); | |
| l = h + 2; | |
| for (k = 0; l <= f.length; ) | |
| (k = 10 * k + f.charCodeAt(l - 1) - 48), (l += 1); | |
| "-" === f.charAt(h + 1 - 1) && (k = -k); | |
| if (g + k < h && -6 < k) { | |
| f = rtl.strSetLength(f, h - 1); | |
| if (0 <= k) { | |
| c = 0; | |
| for (--k; c <= k; c++) | |
| (l = c), | |
| (f = rtl.setCharAt(f, g - 1, f.charAt(g + 1 - 1))), | |
| (g += 1); | |
| f = rtl.setCharAt(f, g - 1, "."); | |
| g = 1; | |
| for ( | |
| "-" === f.charAt(g - 1) && (g += 1); | |
| "0" === f.charAt(g - 1) && | |
| g < f.length && | |
| pas.System.Copy(f, g + 1, e.length) !== e; | |
| ) | |
| pas.System.Delete( | |
| { | |
| get: function() { | |
| return f; | |
| }, | |
| set: function(a) { | |
| f = a; | |
| } | |
| }, | |
| g, | |
| 1 | |
| ); | |
| } else | |
| pas.System.Insert( | |
| pas.System.Copy("00000", 1, -k), | |
| { | |
| get: function() { | |
| return f; | |
| }, | |
| set: function(a) { | |
| f = a; | |
| } | |
| }, | |
| g - 1 | |
| ), | |
| (f = rtl.setCharAt(f, g - k - 1, f.charAt(g - k - 1 - 1))), | |
| (f = rtl.setCharAt(f, g - 1, ".")), | |
| -1 !== k && (f = rtl.setCharAt(f, g - k - 1 - 1, "0")); | |
| for (l = f.length; 0 < l && "0" === f.charAt(l - 1); ) --l; | |
| "." === f.charAt(l - 1) && --l; | |
| f = | |
| 0 === l || (1 === l && "-" === f.charAt(0)) | |
| ? "0" | |
| : rtl.strSetLength(f, l); | |
| } else { | |
| for (; "0" === f.charAt(h - 1 - 1); ) | |
| pas.System.Delete( | |
| { | |
| get: function() { | |
| return f; | |
| }, | |
| set: function(a) { | |
| f = a; | |
| } | |
| }, | |
| h - 1, | |
| 1 | |
| ), | |
| --h; | |
| f.charAt(h - 1 - 1) === e && | |
| (pas.System.Delete( | |
| { | |
| get: function() { | |
| return f; | |
| }, | |
| set: function(a) { | |
| f = a; | |
| } | |
| }, | |
| h - 1, | |
| 1 | |
| ), | |
| --h); | |
| for ( | |
| "+" === f.charAt(h + 1 - 1) | |
| ? pas.System.Delete( | |
| { | |
| get: function() { | |
| return f; | |
| }, | |
| set: function(a) { | |
| f = a; | |
| } | |
| }, | |
| h + 1, | |
| 1 | |
| ) | |
| : (h += 1); | |
| "0" === f.charAt(h + 1 - 1); | |
| ) | |
| pas.System.Delete( | |
| { | |
| get: function() { | |
| return f; | |
| }, | |
| set: function(a) { | |
| f = a; | |
| } | |
| }, | |
| h + 1, | |
| 1 | |
| ); | |
| } | |
| return (f = b.ReplaceDecimalSep(f, e)); | |
| }; | |
| b.FormatExponentFloat = function(c, d, e, f) { | |
| var g = "", | |
| h = 0; | |
| f = a.DecimalSeparator; | |
| if (-1 === d || 15 < d) d = 15; | |
| for (g = rtl.floatToStr(c, d + 7); " " === g.charAt(0); ) | |
| pas.System.Delete( | |
| { | |
| get: function() { | |
| return g; | |
| }, | |
| set: function(a) { | |
| g = a; | |
| } | |
| }, | |
| 1, | |
| 1 | |
| ); | |
| h = pas.System.Pos("E", g); | |
| if (0 === h) return (g = b.ReplaceDecimalSep(g, f)); | |
| h += 2; | |
| 4 < e && (e = 4); | |
| e = g.length - h - e + 1; | |
| if (0 > e) | |
| pas.System.Insert( | |
| pas.System.Copy("0000", 1, -e), | |
| { | |
| get: function() { | |
| return g; | |
| }, | |
| set: function(a) { | |
| g = a; | |
| } | |
| }, | |
| h | |
| ); | |
| else | |
| for (; 0 < e && "0" === g.charAt(h - 1); ) { | |
| pas.System.Delete( | |
| { | |
| get: function() { | |
| return g; | |
| }, | |
| set: function(a) { | |
| g = a; | |
| } | |
| }, | |
| h, | |
| 1 | |
| ); | |
| if (h > g.length) { | |
| pas.System.Delete( | |
| { | |
| get: function() { | |
| return g; | |
| }, | |
| set: function(a) { | |
| g = a; | |
| } | |
| }, | |
| h - 2, | |
| 2 | |
| ); | |
| break; | |
| } | |
| --e; | |
| } | |
| return (g = b.ReplaceDecimalSep(g, f)); | |
| }; | |
| b.FormatFixedFloat = function(a, d, e) { | |
| var c = ""; | |
| -1 === d ? (d = 2) : 18 < d && (d = 18); | |
| c = rtl.floatToStr(a, 0, d); | |
| "" !== c && | |
| " " === c.charAt(0) && | |
| pas.System.Delete( | |
| { | |
| get: function() { | |
| return c; | |
| }, | |
| set: function(a) { | |
| c = a; | |
| } | |
| }, | |
| 1, | |
| 1 | |
| ); | |
| return (c = b.ReplaceDecimalSep(c, e)); | |
| }; | |
| b.FormatNumberFloat = function(a, d, e, f) { | |
| var c = "", | |
| h = 0; | |
| -1 === d ? (d = 2) : 15 < d && (d = 15); | |
| c = rtl.floatToStr(a, 0, d); | |
| "" !== c && | |
| " " === c.charAt(0) && | |
| pas.System.Delete( | |
| { | |
| get: function() { | |
| return c; | |
| }, | |
| set: function(a) { | |
| c = a; | |
| } | |
| }, | |
| 1, | |
| 1 | |
| ); | |
| h = pas.System.Pos(".", c); | |
| c = b.ReplaceDecimalSep(c, e); | |
| h -= 3; | |
| if ("" !== f && "\x00" !== f) | |
| for (; 1 < h; ) | |
| "-" !== c.charAt(h - 1 - 1) && | |
| pas.System.Insert( | |
| f, | |
| { | |
| get: function() { | |
| return c; | |
| }, | |
| set: function(a) { | |
| c = a; | |
| } | |
| }, | |
| h | |
| ), | |
| (h -= 3); | |
| return c; | |
| }; | |
| b.RemoveLeadingNegativeSign = function(b, d) { | |
| var c = !1; | |
| var f = a.ThousandSeparator; | |
| for ( | |
| var g = 2, h = b.get().length; | |
| g <= h && | |
| ((c = g), | |
| (c = | |
| b.get().charCodeAt(c - 1) in | |
| rtl.createSet(48, d.charCodeAt(), 69, 43) || | |
| b.get().charAt(c - 1) === f), | |
| c); | |
| g++ | |
| ); | |
| c && "-" === b.get().charAt(0) && pas.System.Delete(b, 1, 1); | |
| return c; | |
| }; | |
| b.FormatNumberCurrency = function(c, d, e, f) { | |
| var g = "", | |
| h = !1, | |
| l = 0; | |
| -1 === d ? (d = a.CurrencyDecimals) : 18 < d && (d = 18); | |
| g = rtl.floatToStr(c / 1e4, 0, d); | |
| (h = "-" === g.charAt(0)) && | |
| pas.System.Delete( | |
| { | |
| get: function() { | |
| return g; | |
| }, | |
| set: function(a) { | |
| g = a; | |
| } | |
| }, | |
| 1, | |
| 1 | |
| ); | |
| l = pas.System.Pos(".", g); | |
| if ("" !== f) | |
| for ( | |
| 0 !== l ? (g = b.ReplaceDecimalSep(g, e)) : (l = g.length + 1), | |
| l -= 3; | |
| 1 < l; | |
| ) | |
| pas.System.Insert( | |
| f, | |
| { | |
| get: function() { | |
| return g; | |
| }, | |
| set: function(a) { | |
| g = a; | |
| } | |
| }, | |
| l | |
| ), | |
| (l -= 3); | |
| h && | |
| b.RemoveLeadingNegativeSign( | |
| { | |
| get: function() { | |
| return g; | |
| }, | |
| set: function(a) { | |
| g = a; | |
| } | |
| }, | |
| e | |
| ); | |
| h | |
| ? ((c = a.NegCurrFormat), | |
| 0 === c | |
| ? (g = "(" + a.CurrencyString + g + ")") | |
| : 1 === c | |
| ? (g = "-" + a.CurrencyString + g) | |
| : 2 === c | |
| ? (g = a.CurrencyString + "-" + g) | |
| : 3 === c | |
| ? (g = a.CurrencyString + g + "-") | |
| : 4 === c | |
| ? (g = "(" + g + a.CurrencyString + ")") | |
| : 5 === c | |
| ? (g = "-" + g + a.CurrencyString) | |
| : 6 === c | |
| ? (g = g + "-" + a.CurrencyString) | |
| : 7 === c | |
| ? (g = g + a.CurrencyString + "-") | |
| : 8 === c | |
| ? (g = "-" + g + " " + a.CurrencyString) | |
| : 9 === c | |
| ? (g = "-" + a.CurrencyString + " " + g) | |
| : 10 === c | |
| ? (g = g + " " + a.CurrencyString + "-") | |
| : 11 === c | |
| ? (g = a.CurrencyString + " " + g + "-") | |
| : 12 === c | |
| ? (g = a.CurrencyString + " -" + g) | |
| : 13 === c | |
| ? (g = g + "- " + a.CurrencyString) | |
| : 14 === c | |
| ? (g = "(" + a.CurrencyString + " " + g + ")") | |
| : 15 === c && (g = "(" + g + " " + a.CurrencyString + ")")) | |
| : ((c = a.CurrencyFormat), | |
| 0 === c | |
| ? (g = a.CurrencyString + g) | |
| : 1 === c | |
| ? (g += a.CurrencyString) | |
| : 2 === c | |
| ? (g = a.CurrencyString + " " + g) | |
| : 3 === c && (g = g + " " + a.CurrencyString)); | |
| return g; | |
| }; | |
| } | |
| ); | |
| rtl.module("NodeJS", ["System", "JS", "Types"], function() { | |
| var a = this; | |
| this.NJS_OS = null; | |
| a.$init = function() { | |
| a.NJS_OS = rtl.getObject(require("os")); | |
| pas.System.LineEnding = a.NJS_OS.EOL; | |
| pas.System.sLineBreak = a.NJS_OS.EOL; | |
| }; | |
| }); | |
| rtl.module( | |
| "Classes", | |
| ["System", "RTLConsts", "Types", "SysUtils", "JS"], | |
| function() { | |
| var a = this, | |
| b = a.$impl; | |
| rtl.createClass(a, "EListError", pas.SysUtils.Exception, function() {}); | |
| rtl.createClass( | |
| a, | |
| "EComponentError", | |
| pas.SysUtils.Exception, | |
| function() {} | |
| ); | |
| rtl.createClass(a, "TFPList", pas.System.TObject, function() { | |
| this.$init = function() { | |
| pas.System.TObject.$init.call(this); | |
| this.FList = []; | |
| this.FCapacity = this.FCount = 0; | |
| }; | |
| this.$final = function() { | |
| this.FList = void 0; | |
| pas.System.TObject.$final.call(this); | |
| }; | |
| this.Get = function(a) { | |
| (0 > a || a >= this.FCount) && this.RaiseIndexError(a); | |
| return this.FList[a]; | |
| }; | |
| this.SetCapacity = function(a) { | |
| a < this.FCount && | |
| this.$class.Error( | |
| rtl.getResStr(pas.RTLConsts, "SListCapacityError"), | |
| "" + a | |
| ); | |
| a !== this.FCapacity && | |
| ((this.FList = rtl.arraySetLength(this.FList, void 0, a)), | |
| (this.FCapacity = a)); | |
| }; | |
| this.SetCount = function(a) { | |
| 0 > a && | |
| this.$class.Error( | |
| rtl.getResStr(pas.RTLConsts, "SListCountError"), | |
| "" + a | |
| ); | |
| a > this.FCount && a > this.FCapacity && this.SetCapacity(a); | |
| this.FCount = a; | |
| }; | |
| this.RaiseIndexError = function(a) { | |
| this.$class.Error( | |
| rtl.getResStr(pas.RTLConsts, "SListIndexError"), | |
| "" + a | |
| ); | |
| }; | |
| this.Destroy = function() { | |
| this.Clear(); | |
| pas.System.TObject.Destroy.call(this); | |
| }; | |
| this.Add = function(a) { | |
| this.FCount === this.FCapacity && this.Expand(); | |
| this.FList[this.FCount] = a; | |
| a = this.FCount; | |
| this.FCount += 1; | |
| return a; | |
| }; | |
| this.Clear = function() { | |
| 0 < rtl.length(this.FList) && (this.SetCount(0), this.SetCapacity(0)); | |
| }; | |
| this.Delete = function(a) { | |
| (0 > a || a >= this.FCount) && | |
| this.$class.Error( | |
| rtl.getResStr(pas.RTLConsts, "SListIndexError"), | |
| "" + a | |
| ); | |
| --this.FCount; | |
| this.FList.splice(a, 1); | |
| --this.FCapacity; | |
| }; | |
| this.Error = function(b, d) { | |
| throw a.EListError.$create("CreateFmt", [b, [d]]); | |
| }; | |
| this.Expand = function() { | |
| if (this.FCount < this.FCapacity) return this; | |
| var a = 4; | |
| 3 < this.FCapacity && (a += 4); | |
| 8 < this.FCapacity && (a += 8); | |
| 127 < this.FCapacity && (a += this.FCapacity >>> 2); | |
| this.SetCapacity(this.FCapacity + a); | |
| return this; | |
| }; | |
| this.IndexOf = function(a) { | |
| var b = 0, | |
| c; | |
| for (c = this.FCount; b < c && this.FList[b] != a; ) b += 1; | |
| return b >= c ? -1 : b; | |
| }; | |
| this.Last = function() { | |
| return 0 === this.FCount ? null : this.Get(this.FCount - 1); | |
| }; | |
| this.Remove = function(a) { | |
| a = this.IndexOf(a); | |
| -1 !== a && this.Delete(a); | |
| return a; | |
| }; | |
| }); | |
| rtl.createClass(a, "TPersistent", pas.System.TObject, function() {}); | |
| this.TOperation = { | |
| 0: "opInsert", | |
| opInsert: 0, | |
| 1: "opRemove", | |
| opRemove: 1 | |
| }; | |
| this.TComponentStateItem = { | |
| 0: "csLoading", | |
| csLoading: 0, | |
| 1: "csReading", | |
| csReading: 1, | |
| 2: "csWriting", | |
| csWriting: 2, | |
| 3: "csDestroying", | |
| csDestroying: 3, | |
| 4: "csDesigning", | |
| csDesigning: 4, | |
| 5: "csAncestor", | |
| csAncestor: 5, | |
| 6: "csUpdating", | |
| csUpdating: 6, | |
| 7: "csFixups", | |
| csFixups: 7, | |
| 8: "csFreeNotification", | |
| csFreeNotification: 8, | |
| 9: "csInline", | |
| csInline: 9, | |
| 10: "csDesignInstance", | |
| csDesignInstance: 10 | |
| }; | |
| this.TComponentStyleItem = { | |
| 0: "csInheritable", | |
| csInheritable: 0, | |
| 1: "csCheckPropAvail", | |
| csCheckPropAvail: 1, | |
| 2: "csSubComponent", | |
| csSubComponent: 2, | |
| 3: "csTransient", | |
| csTransient: 3 | |
| }; | |
| rtl.createClass(a, "TComponent", a.TPersistent, function() { | |
| this.$init = function() { | |
| a.TPersistent.$init.call(this); | |
| this.FOwner = null; | |
| this.FName = ""; | |
| this.FTag = 0; | |
| this.FFreeNotifies = this.FComponents = null; | |
| this.FComponentState = {}; | |
| this.FComponentStyle = {}; | |
| }; | |
| this.$final = function() { | |
| this.FComponentStyle = this.FComponentState = this.FFreeNotifies = this.FComponents = this.FOwner = void 0; | |
| a.TPersistent.$final.call(this); | |
| }; | |
| this.Insert = function(b) { | |
| null == this.FComponents && | |
| (this.FComponents = a.TFPList.$create("Create")); | |
| this.FComponents.Add(b); | |
| b.FOwner = this; | |
| }; | |
| this.Remove = function(a) { | |
| a.FOwner = null; | |
| null != this.FComponents && | |
| (this.FComponents.Remove(a), | |
| 0 === this.FComponents.FCount && | |
| (this.FComponents.$destroy("Destroy"), (this.FComponents = null))); | |
| }; | |
| this.RemoveNotification = function(a) { | |
| null !== this.FFreeNotifies && | |
| (this.FFreeNotifies.Remove(a), | |
| 0 === this.FFreeNotifies.FCount && | |
| (this.FFreeNotifies.$destroy("Destroy"), | |
| (this.FFreeNotifies = null), | |
| (this.FComponentState = rtl.excludeSet(this.FComponentState, 8)))); | |
| }; | |
| this.SetReference = function(a) { | |
| if ("" !== this.FName && null != this.FOwner) { | |
| var b = this.FOwner; | |
| var c = this.FOwner.$class.FieldAddress(this.FName); | |
| null != c && (b["" + c.name] = a ? this : null); | |
| } | |
| }; | |
| this.ChangeName = function(a) { | |
| this.FName = a; | |
| }; | |
| this.Notification = function(a, b) { | |
| var c; | |
| 1 === b && this.RemoveFreeNotification(a); | |
| if (null != this.FComponents) | |
| for (c = this.FComponents.FCount - 1; 0 <= c; ) | |
| rtl.getObject(this.FComponents.Get(c)).Notification(a, b), | |
| --c, | |
| c >= this.FComponents.FCount && (c = this.FComponents.FCount - 1); | |
| }; | |
| this.SetDesigning = function(a, b) { | |
| this.FComponentState = a | |
| ? rtl.includeSet(this.FComponentState, 4) | |
| : rtl.excludeSet(this.FComponentState, 4); | |
| if (null != this.FComponents && b) | |
| for (var c = 0, d = this.FComponents.FCount - 1; c <= d; c++) | |
| (b = c), rtl.getObject(this.FComponents.Get(b)).SetDesigning(a, !0); | |
| }; | |
| this.SetName = function(b) { | |
| if (this.FName !== b) { | |
| if ("" !== b && !pas.SysUtils.IsValidIdent(b, !1, !1)) | |
| throw a.EComponentError.$create("CreateFmt", [ | |
| rtl.getResStr(pas.RTLConsts, "SInvalidName"), | |
| [b] | |
| ]); | |
| null != this.FOwner | |
| ? this.FOwner.ValidateRename(this, this.FName, b) | |
| : this.ValidateRename(null, this.FName, b); | |
| this.SetReference(!1); | |
| this.ChangeName(b); | |
| this.SetReference(!0); | |
| } | |
| }; | |
| this.ValidateRename = function(b, c, f) { | |
| if ( | |
| null !== b && | |
| 0 !== pas.SysUtils.CompareText(c, f) && | |
| b.FOwner === this && | |
| null !== this.FindComponent(f) | |
| ) | |
| throw a.EComponentError.$create("CreateFmt", [ | |
| rtl.getResStr(pas.RTLConsts, "SDuplicateName"), | |
| [f] | |
| ]); | |
| 4 in this.FComponentState && | |
| null !== this.FOwner && | |
| this.FOwner.ValidateRename(b, c, f); | |
| }; | |
| this.ValidateContainer = function(a) { | |
| a.ValidateInsert(this); | |
| }; | |
| this.ValidateInsert = function(a) {}; | |
| this.Create$1 = function(a) { | |
| this.FComponentStyle = rtl.createSet(0); | |
| null != a && a.InsertComponent(this); | |
| return this; | |
| }; | |
| this.Destroy = function() { | |
| var a = 0, | |
| b = null; | |
| this.Destroying(); | |
| if (null != this.FFreeNotifies) { | |
| for (a = this.FFreeNotifies.FCount - 1; 0 <= a; ) | |
| (b = rtl.getObject(this.FFreeNotifies.Get(a))), | |
| this.FFreeNotifies.Delete(a), | |
| b.Notification(this, 1), | |
| null === this.FFreeNotifies | |
| ? (a = 0) | |
| : a > this.FFreeNotifies.FCount && | |
| (a = this.FFreeNotifies.FCount), | |
| --a; | |
| pas.SysUtils.FreeAndNil({ | |
| p: this, | |
| get: function() { | |
| return this.p.FFreeNotifies; | |
| }, | |
| set: function(a) { | |
| this.p.FFreeNotifies = a; | |
| } | |
| }); | |
| } | |
| this.DestroyComponents(); | |
| null !== this.FOwner && this.FOwner.RemoveComponent(this); | |
| pas.System.TObject.Destroy.call(this); | |
| }; | |
| this.BeforeDestruction = function() { | |
| 3 in this.FComponentState || this.Destroying(); | |
| }; | |
| this.DestroyComponents = function() { | |
| for (var a; null != this.FComponents; ) | |
| (a = rtl.getObject(this.FComponents.Last())), | |
| this.Remove(a), | |
| a.$destroy("Destroy"); | |
| }; | |
| this.Destroying = function() { | |
| if ( | |
| !(3 in this.FComponentState) && | |
| ((this.FComponentState = rtl.includeSet(this.FComponentState, 3)), | |
| null != this.FComponents) | |
| ) | |
| for (var a = 0, b = this.FComponents.FCount - 1; a <= b; a++) { | |
| var c = a; | |
| rtl.getObject(this.FComponents.Get(c)).Destroying(); | |
| } | |
| }; | |
| this.FindComponent = function(a) { | |
| var b = null; | |
| if ("" === a || null == this.FComponents) return b; | |
| for (var c = 0, d = this.FComponents.FCount - 1; c <= d; c++) { | |
| var h = c; | |
| if ( | |
| 0 === | |
| pas.SysUtils.CompareText( | |
| rtl.getObject(this.FComponents.Get(h)).FName, | |
| a | |
| ) | |
| ) { | |
| b = rtl.getObject(this.FComponents.Get(h)); | |
| break; | |
| } | |
| } | |
| return b; | |
| }; | |
| this.RemoveFreeNotification = function(a) { | |
| this.RemoveNotification(a); | |
| a.RemoveNotification(this); | |
| }; | |
| this.InsertComponent = function(a) { | |
| a.ValidateContainer(this); | |
| this.ValidateRename(a, "", a.FName); | |
| this.Insert(a); | |
| 4 in this.FComponentState && a.SetDesigning(!0, !0); | |
| this.Notification(a, 0); | |
| }; | |
| this.RemoveComponent = function(a) { | |
| this.Notification(a, 1); | |
| this.Remove(a); | |
| a.SetDesigning(!1, !0); | |
| this.ValidateRename(a, a.FName, ""); | |
| }; | |
| var b = this.$rtti; | |
| b.addProperty("Name", 6, rtl.string, "FName", "SetName"); | |
| b.addProperty("Tag", 0, rtl.nativeint, "FTag", "FTag", { Default: 0 }); | |
| }); | |
| a.$init = function() { | |
| b.ClassList = Object.create(null); | |
| }; | |
| }, | |
| [], | |
| function() { | |
| this.$impl.ClassList = null; | |
| } | |
| ); | |
| rtl.module( | |
| "CustApp", | |
| ["System", "Classes", "SysUtils", "Types", "JS"], | |
| function() { | |
| rtl.createClass( | |
| this, | |
| "TCustomApplication", | |
| pas.Classes.TComponent, | |
| function() { | |
| this.$init = function() { | |
| pas.Classes.TComponent.$init.call(this); | |
| this.FExceptObjectJS = void 0; | |
| this.FTerminated = !1; | |
| this.FOptionChar = ""; | |
| this.FStopOnException = this.FCaseSensitiveOptions = !1; | |
| this.FExceptionExitCode = 0; | |
| this.FExceptObject = null; | |
| }; | |
| this.$final = function() { | |
| this.FExceptObject = void 0; | |
| pas.Classes.TComponent.$final.call(this); | |
| }; | |
| this.GetParamCount = function() { | |
| return pas.System.ParamCount(); | |
| }; | |
| this.Create$1 = function(a) { | |
| pas.Classes.TComponent.Create$1.call(this, a); | |
| this.FOptionChar = "-"; | |
| this.FCaseSensitiveOptions = !0; | |
| this.FStopOnException = !1; | |
| return this; | |
| }; | |
| this.HandleException = function(a) { | |
| this.ShowException(this.FExceptObject); | |
| this.FStopOnException && this.Terminate$1(this.FExceptionExitCode); | |
| }; | |
| this.Initialize = function() { | |
| this.FTerminated = !1; | |
| }; | |
| this.Run = function() { | |
| do { | |
| this.FExceptObjectJS = this.FExceptObject = null; | |
| try { | |
| this.DoRun(); | |
| } catch (b) { | |
| if (pas.SysUtils.Exception.isPrototypeOf(b)) { | |
| var a = b; | |
| this.FExceptObjectJS = this.FExceptObject = a; | |
| this.HandleException(this); | |
| } else (this.FExceptObject = null), (this.FExceptObjectJS = b); | |
| } | |
| break; | |
| } while (!this.FTerminated); | |
| }; | |
| this.Terminate = function() { | |
| this.Terminate$1(rtl.exitcode); | |
| }; | |
| this.Terminate$1 = function(a) { | |
| this.FTerminated = !0; | |
| rtl.exitcode = a; | |
| }; | |
| } | |
| ); | |
| } | |
| ); | |
| rtl.module( | |
| "NodeJSApp", | |
| "System NodeJS Classes SysUtils Types JS CustApp".split(" "), | |
| function() { | |
| var a = this, | |
| b = a.$impl; | |
| rtl.createClass( | |
| a, | |
| "TNodeJSApplication", | |
| pas.CustApp.TCustomApplication, | |
| function() { | |
| this.DoRun = function() {}; | |
| this.ShowException = function(a) { | |
| null !== a | |
| ? pas.System.Writeln(a.$classname, ": ", a.fMessage) | |
| : this.FExceptObjectJS && pas.System.Writeln(this.FExceptObjectJS); | |
| }; | |
| this.HandleException = function(a) { | |
| pas.SysUtils.Exception.isPrototypeOf(this.FExceptObject) && | |
| this.ShowException(this.FExceptObject); | |
| pas.CustApp.TCustomApplication.HandleException.call(this, a); | |
| }; | |
| } | |
| ); | |
| this.ReloadEnvironmentStrings = function() { | |
| b.EnvNames = Object.getOwnPropertyNames(process.env); | |
| }; | |
| a.$init = function() { | |
| pas.System.IsConsole = !0; | |
| pas.System.OnParamCount = b.GetParamCount; | |
| pas.System.OnParamStr = b.GetParamStr; | |
| a.ReloadEnvironmentStrings(); | |
| pas.SysUtils.OnGetEnvironmentVariable = b.MyGetEnvironmentVariable; | |
| pas.SysUtils.OnGetEnvironmentVariableCount = | |
| b.MyGetEnvironmentVariableCount; | |
| pas.SysUtils.OnGetEnvironmentString = b.MyGetEnvironmentString; | |
| }; | |
| }, | |
| null, | |
| function() { | |
| var a = this.$impl; | |
| a.EnvNames = []; | |
| a.GetParamCount = function() { | |
| return rtl.length(process.argv) - 2; | |
| }; | |
| a.GetParamStr = function(a) { | |
| return process.argv[a + 1]; | |
| }; | |
| a.MyGetEnvironmentVariable = function(a) { | |
| a = process.env[a]; | |
| return rtl.isString(a) ? "" + a : ""; | |
| }; | |
| a.MyGetEnvironmentVariableCount = function() { | |
| return rtl.length(a.EnvNames); | |
| }; | |
| a.MyGetEnvironmentString = function(b) { | |
| return a.EnvNames[b]; | |
| }; | |
| } | |
| ); | |
| rtl.module( | |
| "NodeJSFS", | |
| ["System", "JS", "NodeJS", "Types", "SysUtils"], | |
| function() { | |
| var a = this; | |
| this.DirectorySeparator = "/"; | |
| this.DriveSeparator = ""; | |
| this.PathSeparator = ":"; | |
| this.AllowDirectorySeparators = rtl.createSet(92, 47); | |
| this.AllowDriveSeparators = {}; | |
| this.AllDirectorySeparators = rtl.createSet(92, 47); | |
| this.MaxPathLen = 4096; | |
| this.PathDelim = "/"; | |
| this.PathSep = ":"; | |
| this.MAX_PATH = 4096; | |
| this.NJS_Path = this.NJS_FS = null; | |
| a.$init = function() { | |
| a.NJS_FS = rtl.getObject(require("fs")); | |
| a.NJS_Path = rtl.getObject(require("path")); | |
| a.PathDelim = a.NJS_Path.sep; | |
| a.PathSeparator = a.NJS_Path.delimiter; | |
| a.DirectorySeparator = a.NJS_Path.sep; | |
| a.PathSep = a.NJS_Path.delimiter; | |
| "win32" === pas.SysUtils.LowerCase(pas.NodeJS.NJS_OS.platform()) && | |
| ((a.DriveSeparator = ":"), | |
| (a.AllowDriveSeparators = rtl.createSet(58)), | |
| (a.MaxPathLen = 260), | |
| (a.MAX_PATH = a.MaxPathLen)); | |
| a.AllDirectorySeparators = rtl.unionSet( | |
| a.AllowDirectorySeparators, | |
| a.AllowDriveSeparators | |
| ); | |
| }; | |
| } | |
| ); | |
| rtl.module( | |
| "program", | |
| "System SysUtils JS NodeJS NodeJSApp NodeJSFS".split(" "), | |
| function() { | |
| var a = this; | |
| rtl.createClass( | |
| a, | |
| "TMyApplication", | |
| pas.NodeJSApp.TNodeJSApplication, | |
| function() { | |
| this.DoRun = function() { | |
| var a = 0; | |
| if (0 < this.GetParamCount()) { | |
| for ( | |
| var c = pas.NodeJSFS.NJS_FS.createWriteStream("./test.txt"), | |
| d = 1, | |
| e = pas.SysUtils.StrToInt(pas.System.ParamStr(1)); | |
| d <= e; | |
| d++ | |
| ) | |
| (a = d), | |
| c.write(pas.SysUtils.IntToStr(a) + pas.System.sLineBreak); | |
| c.end("Fred Paskell >> Lol Teh Script"); | |
| } | |
| Array.of( | |
| "AA", | |
| "BB", | |
| "CC", | |
| "DD", | |
| "EE", | |
| "FF", | |
| "GG", | |
| "HH", | |
| "II", | |
| "JJ", | |
| "KK", | |
| "LL" | |
| ) | |
| .map(function(a, b, c) { | |
| console.log(typeof a); | |
| return a + a; | |
| }) | |
| .map(function(a, b, c) { | |
| console.log(typeof a); | |
| return "bloop " + a + " blop"; | |
| }) | |
| .forEach(function(a, b, c) { | |
| console.log(a + " lololololol"); | |
| }); | |
| this.Terminate(); | |
| }; | |
| this.$rtti.addMethod("DoRun", 0, null); | |
| } | |
| ); | |
| a.$main = function() { | |
| var b = a.TMyApplication.$create("Create$1", [null]); | |
| b.Initialize(); | |
| b.Run(); | |
| rtl.freeLoc(b); | |
| }; | |
| } | |
| ); | |
| rtl.run(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment