1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284 |
- var pas = {};
- var rtl = {
- quiet: false,
- debug_load_units: false,
- debug_rtti: false,
- debug: function(){
- if (rtl.quiet || !console || !console.log) return;
- console.log(arguments);
- },
- error: function(s){
- rtl.debug('Error: ',s);
- throw s;
- },
- warn: function(s){
- rtl.debug('Warn: ',s);
- },
- hasString: function(s){
- return rtl.isString(s) && (s.length>0);
- },
- isArray: function(a) {
- return Array.isArray(a);
- },
- isFunction: function(f){
- return typeof(f)==="function";
- },
- isModule: function(m){
- return rtl.isObject(m) && rtl.hasString(m.$name) && (pas[m.$name]===m);
- },
- isImplementation: function(m){
- return rtl.isObject(m) && rtl.isModule(m.$module) && (m.$module.$impl===m);
- },
- isNumber: function(n){
- return typeof(n)==="number";
- },
- isObject: function(o){
- var s=typeof(o);
- return (typeof(o)==="object") && (o!=null);
- },
- isString: function(s){
- return typeof(s)==="string";
- },
- getNumber: function(n){
- return typeof(n)==="number"?n:NaN;
- },
- getChar: function(c){
- return ((typeof(c)==="string") && (c.length===1)) ? c : "";
- },
- getObject: function(o){
- return ((typeof(o)==="object") || (typeof(o)==='function')) ? o : null;
- },
- isPasClass: function(type){
- return (rtl.isObject(type) && type.hasOwnProperty('$classname') && rtl.isObject(type.$module));
- },
- isPasClassInstance: function(type){
- return (rtl.isObject(type) && rtl.isPasClass(type.$class));
- },
- hexStr: function(n,digits){
- return ("000000000000000"+n.toString(16).toUpperCase()).slice(-digits);
- },
- m_loading: 0,
- m_loading_intf: 1,
- m_intf_loaded: 2,
- m_loading_impl: 3, // loading all used unit
- m_initializing: 4, // running initialization
- m_initialized: 5,
- module: function(module_name, intfuseslist, intfcode, impluseslist, implcode){
- if (rtl.debug_load_units) rtl.debug('rtl.module name="'+module_name+'" intfuses='+intfuseslist+' impluses='+impluseslist+' hasimplcode='+rtl.isFunction(implcode));
- if (!rtl.hasString(module_name)) rtl.error('invalid module name "'+module_name+'"');
- if (!rtl.isArray(intfuseslist)) rtl.error('invalid interface useslist of "'+module_name+'"');
- if (!rtl.isFunction(intfcode)) rtl.error('invalid interface code of "'+module_name+'"');
- if (!(impluseslist==undefined) && !rtl.isArray(impluseslist)) rtl.error('invalid implementation useslist of "'+module_name+'"');
- if (!(implcode==undefined) && !rtl.isFunction(implcode)) rtl.error('invalid implementation code of "'+module_name+'"');
- if (pas[module_name])
- rtl.error('module "'+module_name+'" is already registered');
- var module = pas[module_name] = {
- $name: module_name,
- $intfuseslist: intfuseslist,
- $impluseslist: impluseslist,
- $state: rtl.m_loading,
- $intfcode: intfcode,
- $implcode: implcode,
- $impl: null,
- $rtti: Object.create(rtl.tSectionRTTI)
- };
- module.$rtti.$module = module;
- if (implcode) module.$impl = {
- $module: module,
- $rtti: module.$rtti
- };
- },
- exitcode: 0,
- run: function(module_name){
-
- function doRun(){
- if (!rtl.hasString(module_name)) module_name='program';
- if (rtl.debug_load_units) rtl.debug('rtl.run module="'+module_name+'"');
- rtl.initRTTI();
- var module = pas[module_name];
- if (!module) rtl.error('rtl.run module "'+module_name+'" missing');
- rtl.loadintf(module);
- rtl.loadimpl(module);
- if (module_name=='program'){
- if (rtl.debug_load_units) rtl.debug('running $main');
- var r = pas.program.$main();
- if (rtl.isNumber(r)) rtl.exitcode = r;
- }
- }
-
- if (rtl.showUncaughtExceptions) {
- try{
- doRun();
- } catch(re) {
- var errMsg = re.hasOwnProperty('$class') ? re.$class.$classname : '';
- errMsg += ((errMsg) ? ': ' : '') + (re.hasOwnProperty('fMessage') ? re.fMessage : re);
- alert('Uncaught Exception : '+errMsg);
- rtl.exitCode = 216;
- }
- } else {
- doRun();
- }
- return rtl.exitcode;
- },
- loadintf: function(module){
- if (module.$state>rtl.m_loading_intf) return; // already finished
- if (rtl.debug_load_units) rtl.debug('loadintf: "'+module.$name+'"');
- if (module.$state===rtl.m_loading_intf)
- rtl.error('unit cycle detected "'+module.$name+'"');
- module.$state=rtl.m_loading_intf;
- // load interfaces of interface useslist
- rtl.loaduseslist(module,module.$intfuseslist,rtl.loadintf);
- // run interface
- if (rtl.debug_load_units) rtl.debug('loadintf: run intf of "'+module.$name+'"');
- module.$intfcode(module.$intfuseslist);
- // success
- module.$state=rtl.m_intf_loaded;
- // Note: units only used in implementations are not yet loaded (not even their interfaces)
- },
- loaduseslist: function(module,useslist,f){
- if (useslist==undefined) return;
- for (var i in useslist){
- var unitname=useslist[i];
- if (rtl.debug_load_units) rtl.debug('loaduseslist of "'+module.$name+'" uses="'+unitname+'"');
- if (pas[unitname]==undefined)
- rtl.error('module "'+module.$name+'" misses "'+unitname+'"');
- f(pas[unitname]);
- }
- },
- loadimpl: function(module){
- if (module.$state>=rtl.m_loading_impl) return; // already processing
- if (module.$state<rtl.m_intf_loaded) rtl.error('loadimpl: interface not loaded of "'+module.$name+'"');
- if (rtl.debug_load_units) rtl.debug('loadimpl: load uses of "'+module.$name+'"');
- module.$state=rtl.m_loading_impl;
- // load interfaces of implementation useslist
- rtl.loaduseslist(module,module.$impluseslist,rtl.loadintf);
- // load implementation of interfaces useslist
- rtl.loaduseslist(module,module.$intfuseslist,rtl.loadimpl);
- // load implementation of implementation useslist
- rtl.loaduseslist(module,module.$impluseslist,rtl.loadimpl);
- // Note: At this point all interfaces used by this unit are loaded. If
- // there are implementation uses cycles some used units might not yet be
- // initialized. This is by design.
- // run implementation
- if (rtl.debug_load_units) rtl.debug('loadimpl: run impl of "'+module.$name+'"');
- if (rtl.isFunction(module.$implcode)) module.$implcode(module.$impluseslist);
- // run initialization
- if (rtl.debug_load_units) rtl.debug('loadimpl: run init of "'+module.$name+'"');
- module.$state=rtl.m_initializing;
- if (rtl.isFunction(module.$init)) module.$init();
- // unit initialized
- module.$state=rtl.m_initialized;
- },
- createCallback: function(scope, fn){
- var cb;
- if (typeof(fn)==='string'){
- cb = function(){
- return scope[fn].apply(scope,arguments);
- };
- } else {
- cb = function(){
- return fn.apply(scope,arguments);
- };
- };
- cb.scope = scope;
- cb.fn = fn;
- return cb;
- },
- cloneCallback: function(cb){
- return rtl.createCallback(cb.scope,cb.fn);
- },
- eqCallback: function(a,b){
- // can be a function or a function wrapper
- if (a==b){
- return true;
- } else {
- return (a!=null) && (b!=null) && (a.fn) && (a.scope===b.scope) && (a.fn==b.fn);
- }
- },
- initClass: function(c,parent,name,initfn){
- parent[name] = c;
- c.$classname = name;
- if ((parent.$module) && (parent.$module.$impl===parent)) parent=parent.$module;
- c.$parent = parent;
- c.$fullname = parent.$name+'.'+name;
- if (rtl.isModule(parent)){
- c.$module = parent;
- c.$name = name;
- } else {
- c.$module = parent.$module;
- c.$name = parent.name+'.'+name;
- };
- // rtti
- if (rtl.debug_rtti) rtl.debug('initClass '+c.$fullname);
- var t = c.$module.$rtti.$Class(c.$name,{ "class": c, module: parent });
- c.$rtti = t;
- if (rtl.isObject(c.$ancestor)) t.ancestor = c.$ancestor.$rtti;
- if (!t.ancestor) t.ancestor = null;
- // init members
- initfn.call(c);
- },
- createClass: function(parent,name,ancestor,initfn){
- // create a normal class,
- // ancestor must be null or a normal class,
- // the root ancestor can be an external class
- var c = null;
- if (ancestor != null){
- c = Object.create(ancestor);
- c.$ancestor = ancestor;
- // Note:
- // if root is an "object" then c.$ancestor === Object.getPrototypeOf(c)
- // if root is a "function" then c.$ancestor === c.__proto__, Object.getPrototypeOf(c) returns the root
- } else {
- c = {};
- c.$create = function(fnname,args){
- if (args == undefined) args = [];
- var o = Object.create(this);
- o.$class = this; // Note: o.$class === Object.getPrototypeOf(o)
- o.$init();
- try{
- o[fnname].apply(o,args);
- o.AfterConstruction();
- } catch($e){
- o.$destroy;
- throw $e;
- }
- return o;
- };
- c.$destroy = function(fnname){
- this.BeforeDestruction();
- this[fnname]();
- this.$final;
- };
- };
- rtl.initClass(c,parent,name,initfn);
- },
- createClassExt: function(parent,name,ancestor,newinstancefnname,initfn){
- // Create a class using an external ancestor.
- // If newinstancefnname is given, use that function to create the new object.
- // If exist call BeforeDestruction and AfterConstruction.
- var c = null;
- c = Object.create(ancestor);
- c.$create = function(fnname,args){
- if (args == undefined) args = [];
- var o = null;
- if (newinstancefnname.length>0){
- o = this[newinstancefnname](fnname,args);
- } else {
- o = Object.create(this);
- }
- o.$class = this; // Note: o.$class === Object.getPrototypeOf(o)
- o.$init();
- try{
- o[fnname].apply(o,args);
- if (o.AfterConstruction) o.AfterConstruction();
- } catch($e){
- o.$destroy;
- throw $e;
- }
- return o;
- };
- c.$destroy = function(fnname){
- if (this.BeforeDestruction) this.BeforeDestruction();
- this[fnname]();
- this.$final;
- };
- rtl.initClass(c,parent,name,initfn);
- },
- tObjectDestroy: "Destroy",
- free: function(obj,name){
- if (obj[name]==null) return;
- obj[name].$destroy(rtl.tObjectDestroy);
- obj[name]=null;
- },
- freeLoc: function(obj){
- if (obj==null) return;
- obj.$destroy(rtl.tObjectDestroy);
- return null;
- },
- is: function(instance,type){
- return type.isPrototypeOf(instance) || (instance===type);
- },
- isExt: function(instance,type,mode){
- // mode===1 means instance must be a Pascal class instance
- // mode===2 means instance must be a Pascal class
- // Notes:
- // isPrototypeOf and instanceof return false on equal
- // isPrototypeOf does not work for Date.isPrototypeOf(new Date())
- // so if isPrototypeOf is false test with instanceof
- // instanceof needs a function on right side
- if (instance == null) return false; // Note: ==null checks for undefined too
- if ((typeof(type) !== 'object') && (typeof(type) !== 'function')) return false;
- if (instance === type){
- if (mode===1) return false;
- if (mode===2) return rtl.isPasClass(instance);
- return true;
- }
- if (type.isPrototypeOf && type.isPrototypeOf(instance)){
- if (mode===1) return rtl.isPasClassInstance(instance);
- if (mode===2) return rtl.isPasClass(instance);
- return true;
- }
- if ((typeof type == 'function') && (instance instanceof type)) return true;
- return false;
- },
- Exception: null,
- EInvalidCast: null,
- EAbstractError: null,
- ERangeError: null,
- raiseE: function(typename){
- var t = rtl[typename];
- if (t==null){
- var mod = pas.SysUtils;
- if (!mod) mod = pas.sysutils;
- if (mod){
- t = mod[typename];
- if (!t) t = mod[typename.toLowerCase()];
- if (!t) t = mod['Exception'];
- if (!t) t = mod['exception'];
- }
- }
- if (t){
- if (t.Create){
- throw t.$create("Create");
- } else if (t.create){
- throw t.$create("create");
- }
- }
- if (typename === "EInvalidCast") throw "invalid type cast";
- if (typename === "EAbstractError") throw "Abstract method called";
- if (typename === "ERangeError") throw "range error";
- throw typename;
- },
- as: function(instance,type){
- if((instance === null) || rtl.is(instance,type)) return instance;
- rtl.raiseE("EInvalidCast");
- },
- asExt: function(instance,type,mode){
- if((instance === null) || rtl.isExt(instance,type,mode)) return instance;
- rtl.raiseE("EInvalidCast");
- },
- createInterface: function(module, name, guid, fnnames, ancestor, initfn){
- //console.log('createInterface name="'+name+'" guid="'+guid+'" names='+fnnames);
- var i = ancestor?Object.create(ancestor):{};
- module[name] = i;
- i.$module = module;
- i.$name = name;
- i.$fullname = module.$name+'.'+name;
- i.$guid = guid;
- i.$guidr = null;
- i.$names = fnnames?fnnames:[];
- if (rtl.isFunction(initfn)){
- // rtti
- if (rtl.debug_rtti) rtl.debug('createInterface '+i.$fullname);
- var t = i.$module.$rtti.$Interface(name,{ "interface": i, module: module });
- i.$rtti = t;
- if (ancestor) t.ancestor = ancestor.$rtti;
- if (!t.ancestor) t.ancestor = null;
- initfn.call(i);
- }
- return i;
- },
- strToGUIDR: function(s,g){
- var p = 0;
- function n(l){
- var h = s.substr(p,l);
- p+=l;
- return parseInt(h,16);
- }
- p+=1; // skip {
- g.D1 = n(8);
- p+=1; // skip -
- g.D2 = n(4);
- p+=1; // skip -
- g.D3 = n(4);
- p+=1; // skip -
- if (!g.D4) g.D4=[];
- g.D4[0] = n(2);
- g.D4[1] = n(2);
- p+=1; // skip -
- for(var i=2; i<8; i++) g.D4[i] = n(2);
- return g;
- },
- guidrToStr: function(g){
- if (g.$intf) return g.$intf.$guid;
- var h = rtl.hexStr;
- var s='{'+h(g.D1,8)+'-'+h(g.D2,4)+'-'+h(g.D3,4)+'-'+h(g.D4[0],2)+h(g.D4[1],2)+'-';
- for (var i=2; i<8; i++) s+=h(g.D4[i],2);
- s+='}';
- return s;
- },
- createTGUID: function(guid){
- var TGuid = (pas.System)?pas.System.TGuid:pas.system.tguid;
- var g = rtl.strToGUIDR(guid,new TGuid());
- return g;
- },
- getIntfGUIDR: function(intfTypeOrVar){
- if (!intfTypeOrVar) return null;
- if (!intfTypeOrVar.$guidr){
- var g = rtl.createTGUID(intfTypeOrVar.$guid);
- if (!intfTypeOrVar.hasOwnProperty('$guid')) intfTypeOrVar = Object.getPrototypeOf(intfTypeOrVar);
- g.$intf = intfTypeOrVar;
- intfTypeOrVar.$guidr = g;
- }
- return intfTypeOrVar.$guidr;
- },
- addIntf: function (aclass, intf, map){
- function jmp(fn){
- if (typeof(fn)==="function"){
- return function(){ return fn.apply(this.$o,arguments); };
- } else {
- return function(){ rtl.raiseE('EAbstractError'); };
- }
- }
- if(!map) map = {};
- var t = intf;
- var item = Object.create(t);
- aclass.$intfmaps[intf.$guid] = item;
- do{
- var names = t.$names;
- if (!names) break;
- for (var i=0; i<names.length; i++){
- var intfname = names[i];
- var fnname = map[intfname];
- if (!fnname) fnname = intfname;
- //console.log('addIntf: intftype='+t.$name+' index='+i+' intfname="'+intfname+'" fnname="'+fnname+'" proc='+typeof(fn));
- item[intfname] = jmp(aclass[fnname]);
- }
- t = Object.getPrototypeOf(t);
- }while(t!=null);
- },
- getIntfG: function (obj, guid, query){
- if (!obj) return null;
- //console.log('getIntfG: obj='+obj.$classname+' guid='+guid+' query='+query);
- // search
- var maps = obj.$intfmaps;
- if (!maps) return null;
- var item = maps[guid];
- if (!item) return null;
- // check delegation
- //console.log('getIntfG: obj='+obj.$classname+' guid='+guid+' query='+query+' item='+typeof(item));
- if (typeof item === 'function') return item.call(obj); // COM: contains _AddRef
- // check cache
- var intf = null;
- if (obj.$interfaces){
- intf = obj.$interfaces[guid];
- //console.log('getIntfG: obj='+obj.$classname+' guid='+guid+' cache='+typeof(intf));
- }
- if (!intf){ // intf can be undefined!
- intf = Object.create(item);
- intf.$o = obj;
- if (!obj.$interfaces) obj.$interfaces = {};
- obj.$interfaces[guid] = intf;
- }
- if (typeof(query)==='object'){
- // called by queryIntfT
- var o = null;
- if (intf.QueryInterface(rtl.getIntfGUIDR(query),
- {get:function(){ return o; }, set:function(v){ o=v; }}) === 0){
- return o;
- } else {
- return null;
- }
- } else if(query===2){
- // called by TObject.GetInterfaceByStr
- if (intf.$kind === 'com') intf._AddRef();
- }
- return intf;
- },
- getIntfT: function(obj,intftype){
- return rtl.getIntfG(obj,intftype.$guid);
- },
- queryIntfT: function(obj,intftype){
- return rtl.getIntfG(obj,intftype.$guid,intftype);
- },
- queryIntfIsT: function(obj,intftype){
- var i = rtl.queryIntfG(obj,intftype.$guid);
- if (!i) return false;
- if (i.$kind === 'com') i._Release();
- return true;
- },
- asIntfT: function (obj,intftype){
- var i = rtl.getIntfG(obj,intftype.$guid);
- if (i!==null) return i;
- rtl.raiseEInvalidCast();
- },
- intfIsClass: function(intf,classtype){
- return (intf!=null) && (rtl.is(intf.$o,classtype));
- },
- intfAsClass: function(intf,classtype){
- if (intf==null) return null;
- return rtl.as(intf.$o,classtype);
- },
- intfToClass: function(intf,classtype){
- if ((intf!==null) && rtl.is(intf.$o,classtype)) return intf.$o;
- return null;
- },
- // interface reference counting
- intfRefs: { // base object for temporary interface variables
- ref: function(id,intf){
- // called for temporary interface references needing delayed release
- var old = this[id];
- //console.log('rtl.intfRefs.ref: id='+id+' old="'+(old?old.$name:'null')+'" intf="'+(intf?intf.$name:'null'));
- if (old){
- // called again, e.g. in a loop
- delete this[id];
- old._Release(); // may fail
- }
- this[id]=intf;
- return intf;
- },
- free: function(){
- //console.log('rtl.intfRefs.free...');
- for (var id in this){
- if (this.hasOwnProperty(id)) this[id]._Release;
- }
- }
- },
- createIntfRefs: function(){
- //console.log('rtl.createIntfRefs');
- return Object.create(rtl.intfRefs);
- },
- setIntfP: function(path,name,value,skipAddRef){
- var old = path[name];
- //console.log('rtl.setIntfP path='+path+' name='+name+' old="'+(old?old.$name:'null')+'" value="'+(value?value.$name:'null')+'"');
- if (old === value) return;
- if (old !== null){
- path[name]=null;
- old._Release();
- }
- if (value !== null){
- if (!skipAddRef) value._AddRef();
- path[name]=value;
- }
- },
- setIntfL: function(old,value,skipAddRef){
- //console.log('rtl.setIntfL old="'+(old?old.$name:'null')+'" value="'+(value?value.$name:'null')+'"');
- if (old !== value){
- if (value!==null){
- if (!skipAddRef) value._AddRef();
- }
- if (old!==null){
- old._Release(); // Release after AddRef, to avoid double Release if Release creates an exception
- }
- } else if (skipAddRef){
- if (old!==null){
- old._Release(); // value has an AddRef
- }
- }
- return value;
- },
- _AddRef: function(intf){
- //if (intf) console.log('rtl._AddRef intf="'+(intf?intf.$name:'null')+'"');
- if (intf) intf._AddRef();
- return intf;
- },
- _Release: function(intf){
- //if (intf) console.log('rtl._Release intf="'+(intf?intf.$name:'null')+'"');
- if (intf) intf._Release();
- return intf;
- },
- checkMethodCall: function(obj,type){
- if (rtl.isObject(obj) && rtl.is(obj,type)) return;
- rtl.raiseE("EInvalidCast");
- },
- rc: function(i,minval,maxval){
- // range check integer
- if ((Math.floor(i)===i) && (i>=minval) && (i<=maxval)) return i;
- rtl.raiseE('ERangeError');
- },
- rcc: function(c,minval,maxval){
- // range check char
- if ((typeof(c)==='string') && (c.length===1)){
- var i = c.charCodeAt(0);
- if ((i>=minval) && (i<=maxval)) return c;
- }
- rtl.raiseE('ERangeError');
- },
- rcSetCharAt: function(s,index,c){
- // range check setCharAt
- if ((typeof(s)!=='string') || (index<0) || (index>=s.length)) rtl.raiseE('ERangeError');
- return rtl.setCharAt(s,index,c);
- },
- rcCharAt: function(s,index){
- // range check charAt
- if ((typeof(s)!=='string') || (index<0) || (index>=s.length)) rtl.raiseE('ERangeError');
- return s.charAt(index);
- },
- rcArrR: function(arr,index){
- // range check read array
- if (Array.isArray(arr) && (typeof(index)==='number') && (index>=0) && (index<arr.length)){
- if (arguments.length>2){
- // arr,index1,index2,...
- arr=arr[index];
- for (var i=2; i<arguments.length; i++) arr=rtl.rcArrR(arr,arguments[i]);
- return arr;
- }
- return arr[index];
- }
- rtl.raiseE('ERangeError');
- },
- rcArrW: function(arr,index,value){
- // range check write array
- // arr,index1,index2,...,value
- for (var i=3; i<arguments.length; i++){
- arr=rtl.rcArrR(arr,index);
- index=arguments[i-1];
- value=arguments[i];
- }
- if (Array.isArray(arr) && (typeof(index)==='number') && (index>=0) && (index<arr.length)){
- return arr[index]=value;
- }
- rtl.raiseE('ERangeError');
- },
- length: function(arr){
- return (arr == null) ? 0 : arr.length;
- },
- arraySetLength: function(arr,defaultvalue,newlength){
- // multi dim: (arr,defaultvalue,dim1,dim2,...)
- if (arr == null) arr = [];
- var p = arguments;
- function setLength(a,argNo){
- var oldlen = a.length;
- var newlen = p[argNo];
- if (oldlen!==newlength){
- a.length = newlength;
- if (argNo === p.length-1){
- if (rtl.isArray(defaultvalue)){
- for (var i=oldlen; i<newlen; i++) a[i]=[]; // nested array
- } else if (rtl.isFunction(defaultvalue)){
- for (var i=oldlen; i<newlen; i++) a[i]=new defaultvalue(); // e.g. record
- } else if (rtl.isObject(defaultvalue)) {
- for (var i=oldlen; i<newlen; i++) a[i]={}; // e.g. set
- } else {
- for (var i=oldlen; i<newlen; i++) a[i]=defaultvalue;
- }
- } else {
- for (var i=oldlen; i<newlen; i++) a[i]=[]; // nested array
- }
- }
- if (argNo < p.length-1){
- // multi argNo
- for (var i=0; i<newlen; i++) a[i]=setLength(a[i],argNo+1);
- }
- return a;
- }
- return setLength(arr,2);
- },
- arrayEq: function(a,b){
- if (a===null) return b===null;
- if (b===null) return false;
- if (a.length!==b.length) return false;
- for (var i=0; i<a.length; i++) if (a[i]!==b[i]) return false;
- return true;
- },
- arrayClone: function(type,src,srcpos,end,dst,dstpos){
- // type: 0 for references, "refset" for calling refSet(), a function for new type()
- // src must not be null
- // This function does not range check.
- if (rtl.isFunction(type)){
- for (; srcpos<end; srcpos++) dst[dstpos++] = new type(src[srcpos]); // clone record
- } else if((typeof(type)==="string") && (type === 'refSet')) {
- for (; srcpos<end; srcpos++) dst[dstpos++] = rtl.refSet(src[srcpos]); // ref set
- } else {
- for (; srcpos<end; srcpos++) dst[dstpos++] = src[srcpos]; // reference
- };
- },
- arrayConcat: function(type){
- // type: see rtl.arrayClone
- var a = [];
- var l = 0;
- for (var i=1; i<arguments.length; i++) l+=arguments[i].length;
- a.length = l;
- l=0;
- for (var i=1; i<arguments.length; i++){
- var src = arguments[i];
- if (src == null) continue;
- rtl.arrayClone(type,src,0,src.length,a,l);
- l+=src.length;
- };
- return a;
- },
- arrayCopy: function(type, srcarray, index, count){
- // type: see rtl.arrayClone
- // if count is missing, use srcarray.length
- if (srcarray == null) return [];
- if (index < 0) index = 0;
- if (count === undefined) count=srcarray.length;
- var end = index+count;
- if (end>srcarray.length) end = srcarray.length;
- if (index>=end) return [];
- if (type===0){
- return srcarray.slice(index,end);
- } else {
- var a = [];
- a.length = end-index;
- rtl.arrayClone(type,srcarray,index,end,a,0);
- return a;
- }
- },
- setCharAt: function(s,index,c){
- return s.substr(0,index)+c+s.substr(index+1);
- },
- getResStr: function(mod,name){
- var rs = mod.$resourcestrings[name];
- return rs.current?rs.current:rs.org;
- },
- createSet: function(){
- var s = {};
- for (var i=0; i<arguments.length; i++){
- if (arguments[i]!=null){
- s[arguments[i]]=true;
- } else {
- var first=arguments[i+=1];
- var last=arguments[i+=1];
- for(var j=first; j<=last; j++) s[j]=true;
- }
- }
- return s;
- },
- cloneSet: function(s){
- var r = {};
- for (var key in s) r[key]=true;
- return r;
- },
- refSet: function(s){
- s.$shared = true;
- return s;
- },
- includeSet: function(s,enumvalue){
- if (s.$shared) s = rtl.cloneSet(s);
- s[enumvalue] = true;
- return s;
- },
- excludeSet: function(s,enumvalue){
- if (s.$shared) s = rtl.cloneSet(s);
- delete s[enumvalue];
- return s;
- },
- diffSet: function(s,t){
- var r = {};
- for (var key in s) if (!t[key]) r[key]=true;
- delete r.$shared;
- return r;
- },
- unionSet: function(s,t){
- var r = {};
- for (var key in s) r[key]=true;
- for (var key in t) r[key]=true;
- delete r.$shared;
- return r;
- },
- intersectSet: function(s,t){
- var r = {};
- for (var key in s) if (t[key]) r[key]=true;
- delete r.$shared;
- return r;
- },
- symDiffSet: function(s,t){
- var r = {};
- for (var key in s) if (!t[key]) r[key]=true;
- for (var key in t) if (!s[key]) r[key]=true;
- delete r.$shared;
- return r;
- },
- eqSet: function(s,t){
- for (var key in s) if (!t[key] && (key!='$shared')) return false;
- for (var key in t) if (!s[key] && (key!='$shared')) return false;
- return true;
- },
- neSet: function(s,t){
- return !rtl.eqSet(s,t);
- },
- leSet: function(s,t){
- for (var key in s) if (!t[key] && (key!='$shared')) return false;
- return true;
- },
- geSet: function(s,t){
- for (var key in t) if (!s[key] && (key!='$shared')) return false;
- return true;
- },
- strSetLength: function(s,newlen){
- var oldlen = s.length;
- if (oldlen > newlen){
- return s.substring(0,newlen);
- } else if (s.repeat){
- // Note: repeat needs ECMAScript6!
- return s+' '.repeat(newlen-oldlen);
- } else {
- while (oldlen<newlen){
- s+=' ';
- oldlen++;
- };
- return s;
- }
- },
- spaceLeft: function(s,width){
- var l=s.length;
- if (l>=width) return s;
- if (s.repeat){
- // Note: repeat needs ECMAScript6!
- return ' '.repeat(width-l) + s;
- } else {
- while (l<width){
- s=' '+s;
- l++;
- };
- };
- },
- floatToStr : function(d,w,p){
- // input 1-3 arguments: double, width, precision
- if (arguments.length>2){
- return rtl.spaceLeft(d.toFixed(p),w);
- } else {
- // exponent width
- var pad = "";
- var ad = Math.abs(d);
- if (ad<1.0e+10) {
- pad='00';
- } else if (ad<1.0e+100) {
- pad='0';
- }
- if (arguments.length<2) {
- w=9;
- } else if (w<9) {
- w=9;
- }
- var p = w-8;
- var s=(d>0 ? " " : "" ) + d.toExponential(p);
- s=s.replace(/e(.)/,'E$1'+pad);
- return rtl.spaceLeft(s,w);
- }
- },
- initRTTI: function(){
- if (rtl.debug_rtti) rtl.debug('initRTTI');
- // base types
- rtl.tTypeInfo = { name: "tTypeInfo" };
- function newBaseTI(name,kind,ancestor){
- if (!ancestor) ancestor = rtl.tTypeInfo;
- if (rtl.debug_rtti) rtl.debug('initRTTI.newBaseTI "'+name+'" '+kind+' ("'+ancestor.name+'")');
- var t = Object.create(ancestor);
- t.name = name;
- t.kind = kind;
- rtl[name] = t;
- return t;
- };
- function newBaseInt(name,minvalue,maxvalue,ordtype){
- var t = newBaseTI(name,1 /* tkInteger */,rtl.tTypeInfoInteger);
- t.minvalue = minvalue;
- t.maxvalue = maxvalue;
- t.ordtype = ordtype;
- return t;
- };
- newBaseTI("tTypeInfoInteger",1 /* tkInteger */);
- newBaseInt("shortint",-0x80,0x7f,0);
- newBaseInt("byte",0,0xff,1);
- newBaseInt("smallint",-0x8000,0x7fff,2);
- newBaseInt("word",0,0xffff,3);
- newBaseInt("longint",-0x80000000,0x7fffffff,4);
- newBaseInt("longword",0,0xffffffff,5);
- newBaseInt("nativeint",-0x10000000000000,0xfffffffffffff,6);
- newBaseInt("nativeuint",0,0xfffffffffffff,7);
- newBaseTI("char",2 /* tkChar */);
- newBaseTI("string",3 /* tkString */);
- newBaseTI("tTypeInfoEnum",4 /* tkEnumeration */,rtl.tTypeInfoInteger);
- newBaseTI("tTypeInfoSet",5 /* tkSet */);
- newBaseTI("double",6 /* tkDouble */);
- newBaseTI("boolean",7 /* tkBool */);
- newBaseTI("tTypeInfoProcVar",8 /* tkProcVar */);
- newBaseTI("tTypeInfoMethodVar",9 /* tkMethod */,rtl.tTypeInfoProcVar);
- newBaseTI("tTypeInfoArray",10 /* tkArray */);
- newBaseTI("tTypeInfoDynArray",11 /* tkDynArray */);
- newBaseTI("tTypeInfoPointer",15 /* tkPointer */);
- var t = newBaseTI("pointer",15 /* tkPointer */,rtl.tTypeInfoPointer);
- t.reftype = null;
- newBaseTI("jsvalue",16 /* tkJSValue */);
- newBaseTI("tTypeInfoRefToProcVar",17 /* tkRefToProcVar */,rtl.tTypeInfoProcVar);
- // member kinds
- rtl.tTypeMember = {};
- function newMember(name,kind){
- var m = Object.create(rtl.tTypeMember);
- m.name = name;
- m.kind = kind;
- rtl[name] = m;
- };
- newMember("tTypeMemberField",1); // tmkField
- newMember("tTypeMemberMethod",2); // tmkMethod
- newMember("tTypeMemberProperty",3); // tmkProperty
- // base object for storing members: a simple object
- rtl.tTypeMembers = {};
- // tTypeInfoStruct - base object for tTypeInfoClass, tTypeInfoRecord, tTypeInfoInterface
- var tis = newBaseTI("tTypeInfoStruct",0);
- tis.$addMember = function(name,ancestor,options){
- if (rtl.debug_rtti){
- if (!rtl.hasString(name) || (name.charAt()==='$')) throw 'invalid member "'+name+'", this="'+this.name+'"';
- if (!rtl.is(ancestor,rtl.tTypeMember)) throw 'invalid ancestor "'+ancestor+':'+ancestor.name+'", "'+this.name+'.'+name+'"';
- if ((options!=undefined) && (typeof(options)!='object')) throw 'invalid options "'+options+'", "'+this.name+'.'+name+'"';
- };
- var t = Object.create(ancestor);
- t.name = name;
- this.members[name] = t;
- this.names.push(name);
- if (rtl.isObject(options)){
- for (var key in options) if (options.hasOwnProperty(key)) t[key] = options[key];
- };
- return t;
- };
- tis.addField = function(name,type,options){
- var t = this.$addMember(name,rtl.tTypeMemberField,options);
- if (rtl.debug_rtti){
- if (!rtl.is(type,rtl.tTypeInfo)) throw 'invalid type "'+type+'", "'+this.name+'.'+name+'"';
- };
- t.typeinfo = type;
- this.fields.push(name);
- return t;
- };
- tis.addFields = function(){
- var i=0;
- while(i<arguments.length){
- var name = arguments[i++];
- var type = arguments[i++];
- if ((i<arguments.length) && (typeof(arguments[i])==='object')){
- this.addField(name,type,arguments[i++]);
- } else {
- this.addField(name,type);
- };
- };
- };
- tis.addMethod = function(name,methodkind,params,result,options){
- var t = this.$addMember(name,rtl.tTypeMemberMethod,options);
- t.methodkind = methodkind;
- t.procsig = rtl.newTIProcSig(params);
- t.procsig.resulttype = result?result:null;
- this.methods.push(name);
- return t;
- };
- tis.addProperty = function(name,flags,result,getter,setter,options){
- var t = this.$addMember(name,rtl.tTypeMemberProperty,options);
- t.flags = flags;
- t.typeinfo = result;
- t.getter = getter;
- t.setter = setter;
- // Note: in options: params, stored, defaultvalue
- if (rtl.isArray(t.params)) t.params = rtl.newTIParams(t.params);
- this.properties.push(name);
- if (!rtl.isString(t.stored)) t.stored = "";
- return t;
- };
- tis.getField = function(index){
- return this.members[this.fields[index]];
- };
- tis.getMethod = function(index){
- return this.members[this.methods[index]];
- };
- tis.getProperty = function(index){
- return this.members[this.properties[index]];
- };
- newBaseTI("tTypeInfoRecord",12 /* tkRecord */,rtl.tTypeInfoStruct);
- newBaseTI("tTypeInfoClass",13 /* tkClass */,rtl.tTypeInfoStruct);
- newBaseTI("tTypeInfoClassRef",14 /* tkClassRef */);
- newBaseTI("tTypeInfoInterface",15 /* tkInterface */,rtl.tTypeInfoStruct);
- },
- tSectionRTTI: {
- $module: null,
- $inherited: function(name,ancestor,o){
- if (rtl.debug_rtti){
- rtl.debug('tSectionRTTI.newTI "'+(this.$module?this.$module.$name:"(no module)")
- +'"."'+name+'" ('+ancestor.name+') '+(o?'init':'forward'));
- };
- var t = this[name];
- if (t){
- if (!t.$forward) throw 'duplicate type "'+name+'"';
- if (!ancestor.isPrototypeOf(t)) throw 'typeinfo ancestor mismatch "'+name+'" ancestor="'+ancestor.name+'" t.name="'+t.name+'"';
- } else {
- t = Object.create(ancestor);
- t.name = name;
- t.module = this.module;
- this[name] = t;
- }
- if (o){
- delete t.$forward;
- for (var key in o) if (o.hasOwnProperty(key)) t[key]=o[key];
- } else {
- t.$forward = true;
- }
- return t;
- },
- $Scope: function(name,ancestor,o){
- var t=this.$inherited(name,ancestor,o);
- t.members = {};
- t.names = [];
- t.fields = [];
- t.methods = [];
- t.properties = [];
- return t;
- },
- $TI: function(name,kind,o){ var t=this.$inherited(name,rtl.tTypeInfo,o); t.kind = kind; return t; },
- $Int: function(name,o){ return this.$inherited(name,rtl.tTypeInfoInteger,o); },
- $Enum: function(name,o){ return this.$inherited(name,rtl.tTypeInfoEnum,o); },
- $Set: function(name,o){ return this.$inherited(name,rtl.tTypeInfoSet,o); },
- $StaticArray: function(name,o){ return this.$inherited(name,rtl.tTypeInfoArray,o); },
- $DynArray: function(name,o){ return this.$inherited(name,rtl.tTypeInfoDynArray,o); },
- $ProcVar: function(name,o){ return this.$inherited(name,rtl.tTypeInfoProcVar,o); },
- $RefToProcVar: function(name,o){ return this.$inherited(name,rtl.tTypeInfoRefToProcVar,o); },
- $MethodVar: function(name,o){ return this.$inherited(name,rtl.tTypeInfoMethodVar,o); },
- $Record: function(name,o){ return this.$Scope(name,rtl.tTypeInfoRecord,o); },
- $Class: function(name,o){ return this.$Scope(name,rtl.tTypeInfoClass,o); },
- $ClassRef: function(name,o){ return this.$inherited(name,rtl.tTypeInfoClassRef,o); },
- $Pointer: function(name,o){ return this.$inherited(name,rtl.tTypeInfoPointer,o); },
- $Interface: function(name,o){ return this.$Scope(name,rtl.tTypeInfoInterface,o); }
- },
- newTIParam: function(param){
- // param is an array, 0=name, 1=type, 2=optional flags
- var t = {
- name: param[0],
- typeinfo: param[1],
- flags: (rtl.isNumber(param[2]) ? param[2] : 0)
- };
- return t;
- },
- newTIParams: function(list){
- // list: optional array of [paramname,typeinfo,optional flags]
- var params = [];
- if (rtl.isArray(list)){
- for (var i=0; i<list.length; i++) params.push(rtl.newTIParam(list[i]));
- };
- return params;
- },
- newTIProcSig: function(params,result,flags){
- var s = {
- params: rtl.newTIParams(params),
- resulttype: result,
- flags: flags
- };
- return s;
- }
- }
- rtl.module("System",[],function () {
- "use strict";
- var $mod = this;
- var $impl = $mod.$impl;
- this.LineEnding = "\n";
- this.sLineBreak = $mod.LineEnding;
- this.MaxSmallint = 32767;
- this.MinSmallint = -32768;
- this.MaxShortInt = 127;
- this.MinShortInt = -128;
- this.MaxByte = 0xFF;
- this.MaxWord = 0xFFFF;
- this.MaxLongint = 0x7fffffff;
- this.MaxCardinal = 0xffffffff;
- this.Maxint = 2147483647;
- this.IsMultiThread = false;
- this.TTextLineBreakStyle = {"0": "tlbsLF", tlbsLF: 0, "1": "tlbsCRLF", tlbsCRLF: 1, "2": "tlbsCR", tlbsCR: 2};
- this.TGuid = function (s) {
- if (s) {
- this.D1 = s.D1;
- this.D2 = s.D2;
- this.D3 = s.D3;
- this.D4 = s.D4.slice(0);
- } else {
- this.D1 = 0;
- this.D2 = 0;
- this.D3 = 0;
- this.D4 = rtl.arraySetLength(null,0,8);
- };
- this.$equal = function (b) {
- return (this.D1 === b.D1) && ((this.D2 === b.D2) && ((this.D3 === b.D3) && rtl.arrayEq(this.D4,b.D4)));
- };
- };
- rtl.createClass($mod,"TObject",null,function () {
- this.$init = function () {
- };
- this.$final = function () {
- };
- this.Create = function () {
- };
- this.Destroy = function () {
- };
- this.Free = function () {
- this.$destroy("Destroy");
- };
- this.ClassType = function () {
- return this;
- };
- this.ClassNameIs = function (Name) {
- var Result = false;
- Result = $impl.SameText(Name,this.$classname);
- return Result;
- };
- this.InheritsFrom = function (aClass) {
- return (aClass!=null) && ((this==aClass) || aClass.isPrototypeOf(this));
- };
- this.AfterConstruction = function () {
- };
- this.BeforeDestruction = function () {
- };
- this.GetInterface = function (iid, obj) {
- var Result = false;
- var i = iid.$intf;
- if (i){
- i = rtl.getIntfG(this,i.$guid,2);
- if (i){
- obj.set(i);
- return true;
- }
- };
- Result = this.GetInterfaceByStr(rtl.guidrToStr(iid),obj);
- return Result;
- };
- this.GetInterface$1 = function (iidstr, obj) {
- var Result = false;
- Result = this.GetInterfaceByStr(iidstr,obj);
- return Result;
- };
- this.GetInterfaceByStr = function (iidstr, obj) {
- var Result = false;
- if ($mod.IObjectInstance.$equal(rtl.createTGUID(iidstr))) {
- obj.set(this);
- return true;
- };
- var i = rtl.getIntfG(this,iidstr,2);
- obj.set(i);
- return i!==null;
- Result = false;
- return Result;
- };
- this.GetInterfaceWeak = function (iid, obj) {
- var Result = false;
- Result = this.GetInterface(iid,obj);
- if (Result){
- var o = obj.get();
- if (o.$kind==='com'){
- o._Release();
- }
- };
- return Result;
- };
- this.Equals = function (Obj) {
- var Result = false;
- Result = Obj === this;
- return Result;
- };
- this.ToString = function () {
- var Result = "";
- Result = this.$classname;
- return Result;
- };
- });
- this.S_OK = 0;
- this.S_FALSE = 1;
- this.E_NOINTERFACE = -2147467262;
- this.E_UNEXPECTED = -2147418113;
- this.E_NOTIMPL = -2147467263;
- rtl.createInterface($mod,"IUnknown","{00000000-0000-0000-C000-000000000046}",["QueryInterface","_AddRef","_Release"],null,function () {
- this.$kind = "com";
- var $r = this.$rtti;
- $r.addMethod("QueryInterface",1,[["iid",$mod.$rtti["TGuid"],2],["obj",null,4]],rtl.longint);
- $r.addMethod("_AddRef",1,null,rtl.longint);
- $r.addMethod("_Release",1,null,rtl.longint);
- });
- rtl.createInterface($mod,"IInvokable","{88387EF6-BCEE-3E17-9E85-5D491ED4FC10}",[],$mod.IUnknown,function () {
- });
- rtl.createInterface($mod,"IEnumerator","{ECEC7568-4E50-30C9-A2F0-439342DE2ADB}",["GetCurrent","MoveNext","Reset"],$mod.IUnknown);
- rtl.createInterface($mod,"IEnumerable","{9791C368-4E51-3424-A3CE-D4911D54F385}",["GetEnumerator"],$mod.IUnknown);
- rtl.createClass($mod,"TInterfacedObject",$mod.TObject,function () {
- this.$init = function () {
- $mod.TObject.$init.call(this);
- this.fRefCount = 0;
- };
- this.QueryInterface = function (iid, obj) {
- var Result = 0;
- if (this.GetInterface(iid,obj)) {
- Result = 0}
- else Result = -2147467262;
- return Result;
- };
- this._AddRef = function () {
- var Result = 0;
- this.fRefCount += 1;
- Result = this.fRefCount;
- return Result;
- };
- this._Release = function () {
- var Result = 0;
- this.fRefCount -= 1;
- Result = this.fRefCount;
- if (this.fRefCount === 0) this.$destroy("Destroy");
- return Result;
- };
- this.BeforeDestruction = function () {
- if (this.fRefCount !== 0) rtl.raiseE('EHeapMemoryError');
- };
- this.$intfmaps = {};
- rtl.addIntf(this,$mod.IUnknown);
- });
- rtl.createClass($mod,"TAggregatedObject",$mod.TObject,function () {
- this.$init = function () {
- $mod.TObject.$init.call(this);
- this.fController = null;
- };
- this.GetController = function () {
- var Result = null;
- var $ok = false;
- try {
- Result = rtl.setIntfL(Result,this.fController);
- $ok = true;
- } finally {
- if (!$ok) rtl._Release(Result);
- };
- return Result;
- };
- this.QueryInterface = function (iid, obj) {
- var Result = 0;
- Result = this.fController.QueryInterface(iid,obj);
- return Result;
- };
- this._AddRef = function () {
- var Result = 0;
- Result = this.fController._AddRef();
- return Result;
- };
- this._Release = function () {
- var Result = 0;
- Result = this.fController._Release();
- return Result;
- };
- this.Create$1 = function (aController) {
- $mod.TObject.Create.call(this);
- this.fController = aController;
- };
- });
- rtl.createClass($mod,"TContainedObject",$mod.TAggregatedObject,function () {
- this.QueryInterface = function (iid, obj) {
- var Result = 0;
- if (this.GetInterface(iid,obj)) {
- Result = 0}
- else Result = -2147467262;
- return Result;
- };
- this.$intfmaps = {};
- rtl.addIntf(this,$mod.IUnknown);
- });
- this.IObjectInstance = new $mod.TGuid({D1: 0xD91C9AF4, D2: 0x3C93, D3: 0x420F, D4: [0xA3,0x03,0xBF,0x5B,0xA8,0x2B,0xFD,0x23]});
- this.IsConsole = false;
- this.OnParamCount = null;
- this.OnParamStr = null;
- this.ParamCount = function () {
- var Result = 0;
- if ($mod.OnParamCount != null) {
- Result = $mod.OnParamCount()}
- else Result = 0;
- return Result;
- };
- this.ParamStr = function (Index) {
- var Result = "";
- if ($mod.OnParamStr != null) {
- Result = $mod.OnParamStr(Index)}
- else if (Index === 0) {
- Result = "js"}
- else Result = "";
- return Result;
- };
- this.Frac = function (A) {
- return A % 1;
- };
- this.Odd = function (A) {
- return A&1 != 0;
- };
- this.Random = function (Range) {
- return Math.floor(Math.random()*Range);
- };
- this.Sqr = function (A) {
- return A*A;
- };
- this.Sqr$1 = function (A) {
- return A*A;
- };
- this.Trunc = function (A) {
- if (!Math.trunc) {
- Math.trunc = function(v) {
- v = +v;
- if (!isFinite(v)) return v;
- return (v - v % 1) || (v < 0 ? -0 : v === 0 ? v : 0);
- };
- }
- $mod.Trunc = Math.trunc;
- return Math.trunc(A);
- };
- this.DefaultTextLineBreakStyle = $mod.TTextLineBreakStyle.tlbsLF;
- this.Int = function (A) {
- var Result = 0.0;
- Result = Math.trunc(A);
- return Result;
- };
- this.Copy = function (S, Index, Size) {
- if (Index<1) Index = 1;
- return (Size>0) ? S.substring(Index-1,Index+Size-1) : "";
- };
- this.Copy$1 = function (S, Index) {
- if (Index<1) Index = 1;
- return S.substr(Index-1);
- };
- this.Delete = function (S, Index, Size) {
- var h = "";
- if (((Index < 1) || (Index > S.get().length)) || (Size <= 0)) return;
- h = S.get();
- S.set($mod.Copy(h,1,Index - 1) + $mod.Copy$1(h,Index + Size));
- };
- this.Pos = function (Search, InString) {
- return InString.indexOf(Search)+1;
- };
- this.Pos$1 = function (Search, InString, StartAt) {
- return InString.indexOf(Search,StartAt-1)+1;
- };
- this.Insert = function (Insertion, Target, Index) {
- var t = "";
- if (Insertion === "") return;
- t = Target.get();
- if (Index < 1) {
- Target.set(Insertion + t)}
- else if (Index > t.length) {
- Target.set(t + Insertion)}
- else Target.set(($mod.Copy(t,1,Index - 1) + Insertion) + $mod.Copy(t,Index,t.length));
- };
- this.upcase = function (c) {
- return c.toUpperCase();
- };
- this.val = function (S, NI, Code) {
- var x = 0.0;
- Code.set(0);
- x = Number(S);
- if (isNaN(x) || (x !== $mod.Int(x))) {
- Code.set(1)}
- else NI.set($mod.Trunc(x));
- };
- this.val$1 = function (S, SI, Code) {
- var X = 0.0;
- Code.set(0);
- X = Number(S);
- if (isNaN(X) || (X !== $mod.Int(X))) {
- Code.set(1)}
- else if ((X < -128) || (X > 127)) {
- Code.set(2)}
- else SI.set($mod.Trunc(X));
- };
- this.val$2 = function (S, B, Code) {
- var x = 0.0;
- Code.set(0);
- x = Number(S);
- if (isNaN(x) || (x !== $mod.Int(x))) {
- Code.set(1)}
- else if ((x < 0) || (x > 255)) {
- Code.set(2)}
- else B.set($mod.Trunc(x));
- };
- this.val$3 = function (S, SI, Code) {
- var x = 0.0;
- Code.set(0);
- x = Number(S);
- if (isNaN(x) || (x !== $mod.Int(x))) {
- Code.set(1)}
- else if ((x < -32768) || (x > 32767)) {
- Code.set(2)}
- else SI.set($mod.Trunc(x));
- };
- this.val$4 = function (S, W, Code) {
- var x = 0.0;
- Code.set(0);
- x = Number(S);
- if (isNaN(x)) {
- Code.set(1)}
- else if ((x < 0) || (x > 65535)) {
- Code.set(2)}
- else W.set($mod.Trunc(x));
- };
- this.val$5 = function (S, I, Code) {
- var x = 0.0;
- Code.set(0);
- x = Number(S);
- if (isNaN(x)) {
- Code.set(1)}
- else if (x > 2147483647) {
- Code.set(2)}
- else I.set($mod.Trunc(x));
- };
- this.val$6 = function (S, C, Code) {
- var x = 0.0;
- Code.set(0);
- x = Number(S);
- if (isNaN(x) || (x !== $mod.Int(x))) {
- Code.set(1)}
- else if ((x < 0) || (x > 4294967295)) {
- Code.set(2)}
- else C.set($mod.Trunc(x));
- };
- this.val$7 = function (S, d, Code) {
- var x = 0.0;
- x = Number(S);
- if (isNaN(x)) {
- Code.set(1)}
- else {
- Code.set(0);
- d.set(x);
- };
- };
- this.StringOfChar = function (c, l) {
- var Result = "";
- var i = 0;
- Result = "";
- for (var $l1 = 1, $end2 = l; $l1 <= $end2; $l1++) {
- i = $l1;
- Result = Result + c;
- };
- return Result;
- };
- this.Write = function () {
- var i = 0;
- for (var $l1 = 0, $end2 = rtl.length(arguments) - 1; $l1 <= $end2; $l1++) {
- i = $l1;
- if ($impl.WriteCallBack != null) {
- $impl.WriteCallBack(arguments[i],false)}
- else $impl.WriteBuf = $impl.WriteBuf + ("" + arguments[i]);
- };
- };
- this.Writeln = function () {
- var i = 0;
- var l = 0;
- var s = "";
- l = rtl.length(arguments) - 1;
- if ($impl.WriteCallBack != null) {
- for (var $l1 = 0, $end2 = l; $l1 <= $end2; $l1++) {
- i = $l1;
- $impl.WriteCallBack(arguments[i],i === l);
- };
- } else {
- s = $impl.WriteBuf;
- for (var $l3 = 0, $end4 = l; $l3 <= $end4; $l3++) {
- i = $l3;
- s = s + ("" + arguments[i]);
- };
- console.log(s);
- $impl.WriteBuf = "";
- };
- };
- this.SetWriteCallBack = function (H) {
- var Result = null;
- Result = $impl.WriteCallBack;
- $impl.WriteCallBack = H;
- return Result;
- };
- this.Assigned = function (V) {
- return (V!=undefined) && (V!=null) && (!rtl.isArray(V) || (V.length > 0));
- };
- this.StrictEqual = function (A, B) {
- return A === B;
- };
- this.StrictInequal = function (A, B) {
- return A !== B;
- };
- $mod.$init = function () {
- rtl.exitcode = 0;
- };
- },null,function () {
- "use strict";
- var $mod = this;
- var $impl = $mod.$impl;
- $impl.SameText = function (s1, s2) {
- return s1.toLowerCase() == s2.toLowerCase();
- };
- $impl.WriteBuf = "";
- $impl.WriteCallBack = null;
- });
- rtl.module("Types",["System"],function () {
- "use strict";
- var $mod = this;
- this.TDirection = {"0": "FromBeginning", FromBeginning: 0, "1": "FromEnd", FromEnd: 1};
- this.TDuplicates = {"0": "dupIgnore", dupIgnore: 0, "1": "dupAccept", dupAccept: 1, "2": "dupError", dupError: 2};
- this.TSize = function (s) {
- if (s) {
- this.cx = s.cx;
- this.cy = s.cy;
- } else {
- this.cx = 0;
- this.cy = 0;
- };
- this.$equal = function (b) {
- return (this.cx === b.cx) && (this.cy === b.cy);
- };
- };
- this.TPoint = function (s) {
- if (s) {
- this.x = s.x;
- this.y = s.y;
- } else {
- this.x = 0;
- this.y = 0;
- };
- this.$equal = function (b) {
- return (this.x === b.x) && (this.y === b.y);
- };
- };
- this.TRect = function (s) {
- if (s) {
- this.Left = s.Left;
- this.Top = s.Top;
- this.Right = s.Right;
- this.Bottom = s.Bottom;
- } else {
- this.Left = 0;
- this.Top = 0;
- this.Right = 0;
- this.Bottom = 0;
- };
- this.$equal = function (b) {
- return (this.Left === b.Left) && ((this.Top === b.Top) && ((this.Right === b.Right) && (this.Bottom === b.Bottom)));
- };
- };
- this.EqualRect = function (r1, r2) {
- var Result = false;
- Result = (((r1.Left === r2.Left) && (r1.Right === r2.Right)) && (r1.Top === r2.Top)) && (r1.Bottom === r2.Bottom);
- return Result;
- };
- this.Rect = function (Left, Top, Right, Bottom) {
- var Result = new $mod.TRect();
- Result.Left = Left;
- Result.Top = Top;
- Result.Right = Right;
- Result.Bottom = Bottom;
- return Result;
- };
- this.Bounds = function (ALeft, ATop, AWidth, AHeight) {
- var Result = new $mod.TRect();
- Result.Left = ALeft;
- Result.Top = ATop;
- Result.Right = ALeft + AWidth;
- Result.Bottom = ATop + AHeight;
- return Result;
- };
- this.Point = function (x, y) {
- var Result = new $mod.TPoint();
- Result.x = x;
- Result.y = y;
- return Result;
- };
- this.PtInRect = function (aRect, p) {
- var Result = false;
- Result = (((p.y >= aRect.Top) && (p.y < aRect.Bottom)) && (p.x >= aRect.Left)) && (p.x < aRect.Right);
- return Result;
- };
- this.IntersectRect = function (aRect, R1, R2) {
- var Result = false;
- var lRect = new $mod.TRect();
- lRect = new $mod.TRect(R1);
- if (R2.Left > R1.Left) lRect.Left = R2.Left;
- if (R2.Top > R1.Top) lRect.Top = R2.Top;
- if (R2.Right < R1.Right) lRect.Right = R2.Right;
- if (R2.Bottom < R1.Bottom) lRect.Bottom = R2.Bottom;
- if ($mod.IsRectEmpty(lRect)) {
- aRect.set(new $mod.TRect($mod.Rect(0,0,0,0)));
- Result = false;
- } else {
- Result = true;
- aRect.set(new $mod.TRect(lRect));
- };
- return Result;
- };
- this.UnionRect = function (aRect, R1, R2) {
- var Result = false;
- var lRect = new $mod.TRect();
- lRect = new $mod.TRect(R1);
- if (R2.Left < R1.Left) lRect.Left = R2.Left;
- if (R2.Top < R1.Top) lRect.Top = R2.Top;
- if (R2.Right > R1.Right) lRect.Right = R2.Right;
- if (R2.Bottom > R1.Bottom) lRect.Bottom = R2.Bottom;
- if ($mod.IsRectEmpty(lRect)) {
- aRect.set(new $mod.TRect($mod.Rect(0,0,0,0)));
- Result = false;
- } else {
- aRect.set(new $mod.TRect(lRect));
- Result = true;
- };
- return Result;
- };
- this.IsRectEmpty = function (aRect) {
- var Result = false;
- Result = (aRect.Right <= aRect.Left) || (aRect.Bottom <= aRect.Top);
- return Result;
- };
- this.OffsetRect = function (aRect, DX, DY) {
- var Result = false;
- var $with1 = aRect.get();
- $with1.Left += DX;
- $with1.Top += DY;
- $with1.Right += DX;
- $with1.Bottom += DY;
- Result = true;
- return Result;
- };
- this.CenterPoint = function (aRect) {
- var Result = new $mod.TPoint();
- function Avg(a, b) {
- var Result = 0;
- if (a < b) {
- Result = a + ((b - a) >>> 1)}
- else Result = b + ((a - b) >>> 1);
- return Result;
- };
- Result.x = Avg(aRect.Left,aRect.Right);
- Result.y = Avg(aRect.Top,aRect.Bottom);
- return Result;
- };
- this.InflateRect = function (aRect, dx, dy) {
- var Result = false;
- var $with1 = aRect.get();
- $with1.Left -= dx;
- $with1.Top -= dy;
- $with1.Right += dx;
- $with1.Bottom += dy;
- Result = true;
- return Result;
- };
- this.Size = function (AWidth, AHeight) {
- var Result = new $mod.TSize();
- Result.cx = AWidth;
- Result.cy = AHeight;
- return Result;
- };
- this.Size$1 = function (aRect) {
- var Result = new $mod.TSize();
- Result.cx = aRect.Right - aRect.Left;
- Result.cy = aRect.Bottom - aRect.Top;
- return Result;
- };
- });
- rtl.module("JS",["System","Types"],function () {
- "use strict";
- var $mod = this;
- rtl.createClass($mod,"EJS",pas.System.TObject,function () {
- this.$init = function () {
- pas.System.TObject.$init.call(this);
- this.FMessage = "";
- };
- this.Create$1 = function (Msg) {
- this.FMessage = Msg;
- };
- });
- this.TLocaleCompareOptions = function (s) {
- if (s) {
- this.localematched = s.localematched;
- this.usage = s.usage;
- this.sensitivity = s.sensitivity;
- this.ignorePunctuation = s.ignorePunctuation;
- this.numeric = s.numeric;
- this.caseFirst = s.caseFirst;
- } else {
- this.localematched = "";
- this.usage = "";
- this.sensitivity = "";
- this.ignorePunctuation = false;
- this.numeric = false;
- this.caseFirst = "";
- };
- this.$equal = function (b) {
- return (this.localematched === b.localematched) && ((this.usage === b.usage) && ((this.sensitivity === b.sensitivity) && ((this.ignorePunctuation === b.ignorePunctuation) && ((this.numeric === b.numeric) && (this.caseFirst === b.caseFirst)))));
- };
- };
- this.New = function (aElements) {
- var Result = null;
- var L = 0;
- var I = 0;
- var S = "";
- L = rtl.length(aElements);
- if ((L % 2) === 1) throw $mod.EJS.$create("Create$1",["Number of arguments must be even"]);
- I = 0;
- while (I < L) {
- if (!rtl.isString(aElements[I])) {
- S = String(I);
- throw $mod.EJS.$create("Create$1",[("Argument " + S) + " must be a string."]);
- };
- I += 2;
- };
- I = 0;
- Result = new Object();
- while (I < L) {
- S = "" + aElements[I];
- Result[S] = aElements[I + 1];
- I += 2;
- };
- return Result;
- };
- this.hasValue = function (v) {
- if(v){ return true; } else { return false; };
- };
- this.isBoolean = function (v) {
- return typeof(v) == 'boolean';
- };
- this.isCallback = function (v) {
- return rtl.isObject(v) && rtl.isObject(v.scope) && (rtl.isString(v.fn) || rtl.isFunction(v.fn));
- };
- this.isChar = function (v) {
- return (typeof(v)!="string") && (v.length==1);
- };
- this.isClass = function (v) {
- return (typeof(v)=="object") && (v!=null) && (v.$class == v);
- };
- this.isClassInstance = function (v) {
- return (typeof(v)=="object") && (v!=null) && (v.$class == Object.getPrototypeOf(v));
- };
- this.isInteger = function (v) {
- return Math.floor(v)===v;
- };
- this.isNull = function (v) {
- return v === null;
- };
- this.isRecord = function (v) {
- return (typeof(v)=="function") && (typeof(v.$create) == "function");
- };
- this.isUndefined = function (v) {
- return v == undefined;
- };
- this.isDefined = function (v) {
- return !(v == undefined);
- };
- this.isUTF16Char = function (v) {
- if (typeof(v)!="string") return false;
- if ((v.length==0) || (v.length>2)) return false;
- var code = v.charCodeAt(0);
- if (code < 0xD800){
- if (v.length == 1) return true;
- } else if (code <= 0xDBFF){
- if (v.length==2){
- code = v.charCodeAt(1);
- if (code >= 0xDC00 && code <= 0xDFFF) return true;
- };
- };
- return false;
- };
- this.jsInstanceOf = function (aFunction, aFunctionWithPrototype) {
- return aFunction instanceof aFunctionWithPrototype;
- };
- this.toNumber = function (v) {
- return v-0;
- };
- this.toInteger = function (v) {
- var Result = 0;
- if ($mod.isInteger(v)) {
- Result = Math.floor(v)}
- else Result = 0;
- return Result;
- };
- this.toObject = function (Value) {
- var Result = null;
- if (rtl.isObject(Value)) {
- Result = rtl.getObject(Value)}
- else Result = null;
- return Result;
- };
- this.toArray = function (Value) {
- var Result = null;
- if (rtl.isArray(Value)) {
- Result = rtl.getObject(Value)}
- else Result = null;
- return Result;
- };
- this.toBoolean = function (Value) {
- var Result = false;
- if ($mod.isBoolean(Value)) {
- Result = !(Value == false)}
- else Result = false;
- return Result;
- };
- this.ToString = function (Value) {
- var Result = "";
- if (rtl.isString(Value)) {
- Result = "" + Value}
- else Result = "";
- return Result;
- };
- 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 (JS) {
- var Result = 0;
- var t = "";
- if ($mod.isNull(JS)) {
- Result = $mod.TJSValueType.jvtNull}
- else {
- t = typeof(JS);
- if (t === "string") {
- Result = $mod.TJSValueType.jvtString}
- else if (t === "boolean") {
- Result = $mod.TJSValueType.jvtBoolean}
- else if (t === "object") {
- if (rtl.isArray(JS)) {
- Result = $mod.TJSValueType.jvtArray}
- else Result = $mod.TJSValueType.jvtObject;
- } else if (t === "number") if ($mod.isInteger(JS)) {
- Result = $mod.TJSValueType.jvtInteger}
- else Result = $mod.TJSValueType.jvtFloat;
- };
- return Result;
- };
- });
- rtl.module("Web",["System","Types","JS"],function () {
- "use strict";
- var $mod = this;
- this.TJSClientRect = function (s) {
- if (s) {
- this.left = s.left;
- this.top = s.top;
- this.right = s.right;
- this.bottom = s.bottom;
- } else {
- this.left = 0.0;
- this.top = 0.0;
- this.right = 0.0;
- this.bottom = 0.0;
- };
- this.$equal = function (b) {
- return (this.left === b.left) && ((this.top === b.top) && ((this.right === b.right) && (this.bottom === b.bottom)));
- };
- };
- this.TJSElementCreationOptions = function (s) {
- if (s) {
- this.named = s.named;
- } else {
- this.named = "";
- };
- this.$equal = function (b) {
- return this.named === b.named;
- };
- };
- this.TJSEventInit = function (s) {
- if (s) {
- this.bubbles = s.bubbles;
- this.cancelable = s.cancelable;
- this.scoped = s.scoped;
- this.composed = s.composed;
- } else {
- this.bubbles = false;
- this.cancelable = false;
- this.scoped = false;
- this.composed = false;
- };
- this.$equal = function (b) {
- return (this.bubbles === b.bubbles) && ((this.cancelable === b.cancelable) && ((this.scoped === b.scoped) && (this.composed === b.composed)));
- };
- };
- rtl.createClassExt($mod,"TJSAnimationEvent",Event,"",function () {
- this.$init = function () {
- };
- this.$final = function () {
- };
- });
- rtl.createClassExt($mod,"TJSLoadEvent",Event,"",function () {
- this.$init = function () {
- };
- this.$final = function () {
- };
- });
- rtl.createClassExt($mod,"TJsPageTransitionEvent",Event,"",function () {
- this.$init = function () {
- };
- this.$final = function () {
- };
- });
- rtl.createClass($mod,"TJSIDBTransactionMode",pas.System.TObject,function () {
- this.readonly = "readonly";
- this.readwrite = "readwrite";
- this.versionchange = "versionchange";
- });
- this.TJSIDBIndexParameters = function (s) {
- if (s) {
- this.unique = s.unique;
- this.multiEntry = s.multiEntry;
- this.locale = s.locale;
- } else {
- this.unique = false;
- this.multiEntry = false;
- this.locale = "";
- };
- this.$equal = function (b) {
- return (this.unique === b.unique) && ((this.multiEntry === b.multiEntry) && (this.locale === b.locale));
- };
- };
- this.TJSCreateObjectStoreOptions = function (s) {
- if (s) {
- this.keyPath = s.keyPath;
- this.autoIncrement = s.autoIncrement;
- } else {
- this.keyPath = undefined;
- this.autoIncrement = false;
- };
- this.$equal = function (b) {
- return (this.keyPath === b.keyPath) && (this.autoIncrement === b.autoIncrement);
- };
- };
- this.TJSPositionError = function (s) {
- if (s) {
- this.code = s.code;
- this.message = s.message;
- } else {
- this.code = 0;
- this.message = "";
- };
- this.$equal = function (b) {
- return (this.code === b.code) && (this.message === b.message);
- };
- };
- this.TJSPositionOptions = function (s) {
- if (s) {
- this.enableHighAccuracy = s.enableHighAccuracy;
- this.timeout = s.timeout;
- this.maximumAge = s.maximumAge;
- } else {
- this.enableHighAccuracy = false;
- this.timeout = 0;
- this.maximumAge = 0;
- };
- this.$equal = function (b) {
- return (this.enableHighAccuracy === b.enableHighAccuracy) && ((this.timeout === b.timeout) && (this.maximumAge === b.maximumAge));
- };
- };
- this.TJSCoordinates = function (s) {
- if (s) {
- this.latitude = s.latitude;
- this.longitude = s.longitude;
- this.altitude = s.altitude;
- this.accuracy = s.accuracy;
- this.altitudeAccuracy = s.altitudeAccuracy;
- this.heading = s.heading;
- this.speed = s.speed;
- } else {
- this.latitude = 0.0;
- this.longitude = 0.0;
- this.altitude = 0.0;
- this.accuracy = 0.0;
- this.altitudeAccuracy = 0.0;
- this.heading = 0.0;
- this.speed = 0.0;
- };
- this.$equal = function (b) {
- return (this.latitude === b.latitude) && ((this.longitude === b.longitude) && ((this.altitude === b.altitude) && ((this.accuracy === b.accuracy) && ((this.altitudeAccuracy === b.altitudeAccuracy) && ((this.heading === b.heading) && (this.speed === b.speed))))));
- };
- };
- this.TJSPosition = function (s) {
- if (s) {
- this.coords = new $mod.TJSCoordinates(s.coords);
- this.timestamp = s.timestamp;
- } else {
- this.coords = new $mod.TJSCoordinates();
- this.timestamp = "";
- };
- this.$equal = function (b) {
- return this.coords.$equal(b.coords) && (this.timestamp === b.timestamp);
- };
- };
- this.TJSServiceWorkerContainerOptions = function (s) {
- if (s) {
- this.scope = s.scope;
- } else {
- this.scope = "";
- };
- this.$equal = function (b) {
- return this.scope === b.scope;
- };
- };
- this.TJSTextMetrics = function (s) {
- if (s) {
- this.width = s.width;
- this.actualBoundingBoxLeft = s.actualBoundingBoxLeft;
- this.actualBoundingBoxRight = s.actualBoundingBoxRight;
- this.fontBoundingBoxAscent = s.fontBoundingBoxAscent;
- this.fontBoundingBoxDescent = s.fontBoundingBoxDescent;
- this.actualBoundingBoxAscent = s.actualBoundingBoxAscent;
- this.actualBoundingBoxDescent = s.actualBoundingBoxDescent;
- this.emHeightAscent = s.emHeightAscent;
- this.emHeightDescent = s.emHeightDescent;
- this.hangingBaseline = s.hangingBaseline;
- this.alphabeticBaseline = s.alphabeticBaseline;
- this.ideographicBaseline = s.ideographicBaseline;
- } else {
- this.width = 0.0;
- this.actualBoundingBoxLeft = 0.0;
- this.actualBoundingBoxRight = 0.0;
- this.fontBoundingBoxAscent = 0.0;
- this.fontBoundingBoxDescent = 0.0;
- this.actualBoundingBoxAscent = 0.0;
- this.actualBoundingBoxDescent = 0.0;
- this.emHeightAscent = 0.0;
- this.emHeightDescent = 0.0;
- this.hangingBaseline = 0.0;
- this.alphabeticBaseline = 0.0;
- this.ideographicBaseline = 0.0;
- };
- this.$equal = function (b) {
- return (this.width === b.width) && ((this.actualBoundingBoxLeft === b.actualBoundingBoxLeft) && ((this.actualBoundingBoxRight === b.actualBoundingBoxRight) && ((this.fontBoundingBoxAscent === b.fontBoundingBoxAscent) && ((this.fontBoundingBoxDescent === b.fontBoundingBoxDescent) && ((this.actualBoundingBoxAscent === b.actualBoundingBoxAscent) && ((this.actualBoundingBoxDescent === b.actualBoundingBoxDescent) && ((this.emHeightAscent === b.emHeightAscent) && ((this.emHeightDescent === b.emHeightDescent) && ((this.hangingBaseline === b.hangingBaseline) && ((this.alphabeticBaseline === b.alphabeticBaseline) && (this.ideographicBaseline === b.ideographicBaseline)))))))))));
- };
- };
- this.TJSWheelEventInit = function (s) {
- if (s) {
- this.deltaX = s.deltaX;
- this.deltaY = s.deltaY;
- this.deltaZ = s.deltaZ;
- this.deltaMode = s.deltaMode;
- } else {
- this.deltaX = 0.0;
- this.deltaY = 0.0;
- this.deltaZ = 0.0;
- this.deltaMode = 0;
- };
- this.$equal = function (b) {
- return (this.deltaX === b.deltaX) && ((this.deltaY === b.deltaY) && ((this.deltaZ === b.deltaZ) && (this.deltaMode === b.deltaMode)));
- };
- };
- rtl.createClass($mod,"TJSKeyNames",pas.System.TObject,function () {
- this.Alt = "Alt";
- this.AltGraph = "AltGraph";
- this.CapsLock = "CapsLock";
- this.Control = "Control";
- this.Fn = "Fn";
- this.FnLock = "FnLock";
- this.Hyper = "Hyper";
- this.Meta = "Meta";
- this.NumLock = "NumLock";
- this.ScrollLock = "ScrollLock";
- this.Shift = "Shift";
- this.Super = "Super";
- this.symbol = "Symbol";
- this.SymbolLock = "SymbolLock";
- this.Enter = "Enter";
- this.Tab = "Tab";
- this.Space = " ";
- this.ArrowDown = "ArrowDown";
- this.ArrowLeft = "ArrowLeft";
- this.ArrowRight = "ArrowRight";
- this.ArrowUp = "ArrowUp";
- this._End = "End";
- this.Home = "Home";
- this.PageDown = "PageDown";
- this.PageUp = "PageUp";
- this.BackSpace = "Backspace";
- this.Clear = "Clear";
- this.Copy = "Copy";
- this.CrSel = "CrSel";
- this.Cut = "Cut";
- this.Delete = "Delete";
- this.EraseEof = "EraseEof";
- this.ExSel = "ExSel";
- this.Insert = "Insert";
- this.Paste = "Paste";
- this.Redo = "Redo";
- this.Undo = "Undo";
- this.Accept = "Accept";
- this.Again = "Again";
- this.Attn = "Attn";
- this.Cancel = "Cancel";
- this.ContextMenu = "Contextmenu";
- this.Escape = "Escape";
- this.Execute = "Execute";
- this.Find = "Find";
- this.Finish = "Finish";
- this.Help = "Help";
- this.Pause = "Pause";
- this.Play = "Play";
- this.Props = "Props";
- this.Select = "Select";
- this.ZoomIn = "ZoomIn";
- this.ZoomOut = "ZoomOut";
- this.BrightnessDown = "BrightnessDown";
- this.BrightnessUp = "BrightnessUp";
- this.Eject = "Eject";
- this.LogOff = "LogOff";
- this.Power = "Power";
- this.PowerOff = "PowerOff";
- this.PrintScreen = "PrintScreen";
- this.Hibernate = "Hibernate";
- this.Standby = "Standby";
- this.WakeUp = "WakeUp";
- this.AllCandidates = "AllCandidates";
- this.Alphanumeric = "Alphanumeric";
- this.CodeInput = "CodeInput";
- this.Compose = "Compose";
- this.Convert = "Convert";
- this.Dead = "Dead";
- this.FinalMode = "FinalMode";
- this.GroupFirst = "GroupFirst";
- this.GroupLast = "GroupLast";
- this.GroupNext = "GroupNext";
- this.GroupPrevious = "GroupPrevious";
- this.ModelChange = "ModelChange";
- this.NextCandidate = "NextCandidate";
- this.NonConvert = "NonConvert";
- this.PreviousCandidate = "PreviousCandidate";
- this.Process = "Process";
- this.SingleCandidate = "SingleCandidate";
- this.HangulMode = "HangulMode";
- this.HanjaMode = "HanjaMode";
- this.JunjaMode = "JunjaMode";
- this.Eisu = "Eisu";
- this.Hankaku = "Hankaku";
- this.Hiranga = "Hiranga";
- this.HirangaKatakana = "HirangaKatakana";
- this.KanaMode = "KanaMode";
- this.Katakana = "Katakana";
- this.Romaji = "Romaji";
- this.Zenkaku = "Zenkaku";
- this.ZenkakuHanaku = "ZenkakuHanaku";
- this.F1 = "F1";
- this.F2 = "F2";
- this.F3 = "F3";
- this.F4 = "F4";
- this.F5 = "F5";
- this.F6 = "F6";
- this.F7 = "F7";
- this.F8 = "F8";
- this.F9 = "F9";
- this.F10 = "F10";
- this.F11 = "F11";
- this.F12 = "F12";
- this.F13 = "F13";
- this.F14 = "F14";
- this.F15 = "F15";
- this.F16 = "F16";
- this.F17 = "F17";
- this.F18 = "F18";
- this.F19 = "F19";
- this.F20 = "F20";
- this.Soft1 = "Soft1";
- this.Soft2 = "Soft2";
- this.Soft3 = "Soft3";
- this.Soft4 = "Soft4";
- this.Decimal = "Decimal";
- this.Key11 = "Key11";
- this.Key12 = "Key12";
- this.Multiply = "Multiply";
- this.Add = "Add";
- this.NumClear = "Clear";
- this.Divide = "Divide";
- this.Subtract = "Subtract";
- this.Separator = "Separator";
- this.AppSwitch = "AppSwitch";
- this.Call = "Call";
- this.Camera = "Camera";
- this.CameraFocus = "CameraFocus";
- this.EndCall = "EndCall";
- this.GoBack = "GoBack";
- this.GoHome = "GoHome";
- this.HeadsetHook = "HeadsetHook";
- this.LastNumberRedial = "LastNumberRedial";
- this.Notification = "Notification";
- this.MannerMode = "MannerMode";
- this.VoiceDial = "VoiceDial";
- });
- });
- rtl.module("webgl",["System","JS","Web"],function () {
- "use strict";
- var $mod = this;
- });
- rtl.module("WebGL2",["System","webgl","JS","Web"],function () {
- "use strict";
- var $mod = this;
- });
|