ba7fad35d8ff0ffc048840c16d5103a43f1f0c8e
Christian Fraß removed backup-data-files;...

Christian Fraß authored 7 years ago

1) /*
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

2) 	
3) 	Build system abstractor "Koralle"
4)     Copyright (C) 2016	Fenris Wolf, Christian Neubauer
5) 		(fenris@greenscale.de, neubauer@greenscale.de)
6) 	
Christian Fraß removed backup-data-files;...

Christian Fraß authored 7 years ago

7)     This program is free software: you can redistribute it and/or modify
8)     it under the terms of the GNU General Public License as published by
9)     the Free Software Foundation, either version 3 of the License, or
10)     (at your option) any later version.
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

11) 	
Christian Fraß removed backup-data-files;...

Christian Fraß authored 7 years ago

12)     This program is distributed in the hope that it will be useful,
13)     but WITHOUT ANY WARRANTY; without even the implied warranty of
14)     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15)     GNU General Public License for more details.
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

16) 	
Christian Fraß removed backup-data-files;...

Christian Fraß authored 7 years ago

17)     You should have received a copy of the GNU General Public License
18)     along with this program.  If not, see <http://www.gnu.org/licenses/>.
19)        
20) */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

21) 
Christian Fraß update

Christian Fraß authored 6 years ago

22) var __extends = (this && this.__extends) || (function () {
23)     var extendStatics = Object.setPrototypeOf ||
24)         ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
25)         function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
26)     return function (d, b) {
27)         extendStatics(d, b);
28)         function __() { this.constructor = d; }
29)         d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
30)     };
31) })();
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

32) // module lib_base {
33) // }
Christian Fraß update

Christian Fraß authored 6 years ago

34) // Web
35) /*
36) declare class Window {
37)     console : any;
38)     navigator : any;
39)     setTimeout : (function_ : (...params : Array<any>)=>void, delay : number, ...params : Array<any>)=>number;
40) };
41) declare var window : Window;
42) declare class Document {
43) };
44) declare var document : Document;
45)  */
46) ;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

47) var lib_base;
48) (function (lib_base) {
49)     /**
50)      * @author frac
51)      */
52)     function environment() {
53)         var entries = [
54)             {
55)                 "id": "web",
56)                 "name": "Web",
Christian Fraß update

Christian Fraß authored 6 years ago

57)                 "predicate": function () { return (typeof (document) !== "undefined"); },
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

58)             },
59)             {
60)                 "id": "node",
61)                 "name": "Node.js",
Christian Fraß update

Christian Fraß authored 6 years ago

62)                 "predicate": function () { return (typeof (process) !== "undefined"); },
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

63)             },
64)             {
65)                 "id": "rhino",
66)                 "name": "Rhino",
Christian Fraß update

Christian Fraß authored 6 years ago

67)                 "predicate": function () { return (typeof (java) !== "undefined"); },
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

68)             },
69)         ];
70)         var id;
71)         var found = entries.some(function (entry) {
72)             if (entry.predicate()) {
73)                 id = entry.id;
74)                 return true;
75)             }
76)             else {
77)                 return false;
78)             }
79)         });
80)         if (found) {
81)             return id;
82)         }
83)         else {
84)             throw (new Error("unknown environment"));
85)         }
86)     }
87)     lib_base.environment = environment;
88) })(lib_base || (lib_base = {}));
Christian Fraß update

Christian Fraß authored 6 years ago

89) /**
90)  * @author fenris
91)  */
92) var instance_verbosity = 0;
93) /**
94)  * @author fenris
95)  */
96) function instance_collate(value1, value2) {
97)     if (typeof (value1) === "object") {
98)         if (value1 == null) {
99)             return (value2 == null);
100)         }
101)         else {
102)             if ("_collate" in value1) {
103)                 return value1["_collate"](value2);
104)             }
105)             else {
106)                 throw (new Error("[collate]" + " " + "object has no such method"));
107)             }
108)         }
109)     }
110)     else {
111)         if (instance_verbosity >= 1) {
112)             lib_log.warn("[collate]" + " " + "primitive value; using default implementation");
113)         }
114)         return (value1 === value2);
115)     }
116) }
117) /**
118)  * @author fenris
119)  */
120) function instance_compare(value1, value2) {
121)     if (typeof (value1) === "object") {
122)         if ("_compare" in value1) {
123)             return value1["_compare"](value2);
124)         }
125)         else {
126)             throw (new Error("[compare]" + " " + "object has no such method"));
127)         }
128)     }
129)     else {
130)         if (instance_verbosity >= 1) {
131)             lib_log.warn("[compare]" + " " + "primitive value; using default implementation");
132)         }
133)         return (value1 <= value2);
134)     }
135) }
136) /**
137)  * @author fenris
138)  */
139) function instance_clone(value) {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

140)     if (typeof (value) === "object") {
Christian Fraß update

Christian Fraß authored 6 years ago

141)         if ("_clone" in value) {
142)             return value["_clone"]();
143)         }
144)         else {
145)             throw (new Error("[clone]" + " " + "object has no such method"));
146)         }
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

147)     }
148)     else {
Christian Fraß update

Christian Fraß authored 6 years ago

149)         if (instance_verbosity >= 1) {
150)             lib_log.warn("[clone]" + " " + "primitive value; using default implementation");
151)         }
152)         return value;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

153)     }
154) }
Christian Fraß update

Christian Fraß authored 6 years ago

155) /**
156)  * @desc the ability to generate a string out of the element, which identifies it to a high degree
157)  * @author fenris
158)  */
159) function instance_hash(value) {
160)     if (typeof (value) === "object") {
161)         if ("_hash" in value) {
162)             return value["_hash"]();
163)         }
164)         else {
165)             throw (new Error("[hash]" + " " + "object has no such method"));
166)         }
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

167)     }
168)     else {
Christian Fraß update

Christian Fraß authored 6 years ago

169)         if (instance_verbosity >= 1) {
170)             lib_log.warn("[hash]" + " " + "primitive value; using default implementation");
171)         }
172)         return String(value);
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

173)     }
174) }
Christian Fraß update

Christian Fraß authored 6 years ago

175) /**
176)  * @desc the ability to map the element to a textual representation (most likely not injective)
177)  * @author fenris
178)  */
179) function instance_show(value) {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

180)     if (typeof (value) === "object") {
Christian Fraß update

Christian Fraß authored 6 years ago

181)         if (value == null) {
182)             return "NULL";
183)         }
184)         else {
185)             if ("_show" in value) {
186)                 return value["_show"]();
187)             }
188)             else {
189)                 // throw (new Error("[show]" + " " + "object has no such method"));
190)                 return JSON.stringify(value);
191)             }
192)         }
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

193)     }
194)     else {
Christian Fraß update

Christian Fraß authored 6 years ago

195)         if (instance_verbosity >= 1) {
196)             lib_log.warn("[show]" + " " + "primitive value; using default implementation");
197)         }
198)         return String(value);
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

199)     }
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

200) }
Christian Fraß update

Christian Fraß authored 6 years ago

201) /**
202)  * @todo outsource to dedicated plankton-lib
203)  */
204) var lib_log;
205) (function (lib_log) {
206)     /**
207)      * @author fenris
208)      */
209)     function log() {
210)         var args = [];
211)         for (var _i = 0; _i < arguments.length; _i++) {
212)             args[_i] = arguments[_i];
213)         }
214)         /*window.*/ console.log(args);
215)     }
216)     lib_log.log = log;
217)     /**
218)      * @author fenris
219)      */
220)     function info() {
221)         var args = [];
222)         for (var _i = 0; _i < arguments.length; _i++) {
223)             args[_i] = arguments[_i];
224)         }
225)         /*window.*/ console.info(args);
226)     }
227)     lib_log.info = info;
228)     /**
229)      * @author fenris
230)      */
231)     function warn() {
232)         var args = [];
233)         for (var _i = 0; _i < arguments.length; _i++) {
234)             args[_i] = arguments[_i];
235)         }
236)         /*window.*/ console.warn(args);
237)     }
238)     lib_log.warn = warn;
239)     /**
240)      * @author fenris
241)      */
242)     function error() {
243)         var args = [];
244)         for (var _i = 0; _i < arguments.length; _i++) {
245)             args[_i] = arguments[_i];
246)         }
247)         /*window.*/ console.error(args);
248)     }
249)     lib_log.error = error;
250) })(lib_log || (lib_log = {}));
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

251) /**
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

252)  * @author frac
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

253)  */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

254) var class_observer = (function () {
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

255)     /**
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

256)      * @author frac
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

257)      */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

258)     function class_observer() {
259)         this.counter = 0;
260)         this.actions = {};
261)         this.buffer = [];
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

262)     }
263)     /**
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

264)      * @author frac
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

265)      */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

266)     class_observer.prototype.empty = function () {
267)         return (Object.keys(this.actions).length == 0);
268)     };
269)     /**
270)      * @author frac
271)      */
272)     class_observer.prototype.flush = function () {
273)         this.actions = {};
274)     };
275)     /**
276)      * @author frac
277)      */
278)     class_observer.prototype.set = function (id, action) {
279)         this.actions[id] = action;
280)     };
281)     /**
282)      * @author frac
283)      */
284)     class_observer.prototype.del = function (id) {
285)         delete this.actions[id];
286)     };
287)     /**
288)      * @author frac
289)      */
290)     class_observer.prototype.add = function (action) {
291)         this.set((this.counter++).toString(), action);
292)     };
293)     /**
294)      * @author frac
295)      */
296)     class_observer.prototype.notify = function (information, delayed) {
297)         var _this = this;
298)         if (information === void 0) { information = {}; }
299)         if (delayed === void 0) { delayed = false; }
300)         if (delayed) {
301)             this.buffer.push(information);
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

302)         }
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

303)         else {
304)             Object.keys(this.actions).forEach(function (id) { return _this.actions[id](information); });
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

305)         }
306)     };
307)     /**
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

308)      * @author frac
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

309)      */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

310)     class_observer.prototype.rollout = function () {
311)         var _this = this;
312)         this.buffer.forEach(function (information) { return _this.notify(information, false); });
313)         this.buffer = [];
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

314)     };
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

315)     return class_observer;
316) }());
317) /**
318)  * @author frac
319)  */
320) /*
321) export interface interface_readable<type_value> {
322) 
323)     |**
324)      * @author frac
325)      *|
326)     read() : type_executor<type_value, Error>;
327) 
328) }
329)  */
330) /**
331)  * @author frac
332)  */
333) /*
334) export interface interface_writeable<type_value> {
335) 
336)     |**
337)      * @author frac
338)      *|
339)     write(value : type_value) : type_executor<void, Error>;
340) 
341) }
342)  */
343) /**
Christian Fraß update

Christian Fraß authored 6 years ago

344)  * @author fenris
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

345)  */
346) /*export*/ var class_maybe = (function () {
347)     function class_maybe() {
348)     }
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

349)     /**
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

350)      * @desc whether the wrapper is nothing
Christian Fraß update

Christian Fraß authored 6 years ago

351)      * @author fenris
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

352)      */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

353)     class_maybe.prototype.is_nothing = function () {
354)         throw (new Error("not implemented: class_maybe.is_nothing"));
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

355)     };
356)     /**
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

357)      * @desc whether the wrapper is just
Christian Fraß update

Christian Fraß authored 6 years ago

358)      * @author fenris
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

359)      */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

360)     class_maybe.prototype.is_just = function () {
361)         throw (new Error("not implemented: class_maybe.is_just"));
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

362)     };
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

363)     /**
364)      * @desc return the value, stored in the maybe-wrapper
Christian Fraß update

Christian Fraß authored 6 years ago

365)      * @author fenris
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

366)      */
367)     class_maybe.prototype.cull = function () {
368)         throw (new Error("not implemented: class_maybe.cull"));
369)     };
370)     /**
Christian Fraß update

Christian Fraß authored 6 years ago

371)      * @author fenris
372)      */
373)     class_maybe.prototype.toString = function () {
374)         throw (new Error("not implemented: class_maybe.cull"));
375)     };
376)     /**
377)      * @author fenris
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

378)      */
379)     class_maybe.prototype.distinguish = function (action_just, action_nothing) {
380)         if (action_nothing === void 0) { action_nothing = function () { }; }
381)         throw (new Error("not implemented: class_maybe.distinguish"));
382)     };
383)     /**
Christian Fraß update

Christian Fraß authored 6 years ago

384)      * @author fenris
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

385)      */
386)     class_maybe.prototype.propagate = function (action) {
387)         throw (new Error("not implemented: class_maybe.propagate"));
388)     };
Christian Fraß update

Christian Fraß authored 6 years ago

389)     /**
390)      * @desc [implementation]
391)      * @author fenris
392)      */
393)     class_maybe.prototype._show = function () {
394)         return this.toString();
395)     };
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

396)     return class_maybe;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

397) }());
398) /**
Christian Fraß update

Christian Fraß authored 6 years ago

399)  * @author fenris
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

400)  */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

401) /*export*/ var class_nothing = (function (_super) {
402)     __extends(class_nothing, _super);
403)     /**
Christian Fraß update

Christian Fraß authored 6 years ago

404)      * @author fenris
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

405)      */
406)     function class_nothing(reason) {
407)         if (reason === void 0) { reason = null; }
Christian Fraß update

Christian Fraß authored 6 years ago

408)         var _this = _super.call(this) || this;
409)         _this.reason = reason;
410)         return _this;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

411)     }
412)     /**
Christian Fraß update

Christian Fraß authored 6 years ago

413)      * @author fenris
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

414)      */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

415)     class_nothing.prototype.is_nothing = function () {
416)         return true;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

417)     };
418)     /**
Christian Fraß update

Christian Fraß authored 6 years ago

419)      * @author fenris
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

420)      */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

421)     class_nothing.prototype.is_just = function () {
422)         return false;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

423)     };
424)     /**
Christian Fraß update

Christian Fraß authored 6 years ago

425)      * @author fenris
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

426)      */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

427)     class_nothing.prototype.cull = function () {
Christian Fraß update

Christian Fraß authored 6 years ago

428)         var message = "you shouldn't cull a nothing-value …";
429)         lib_log.warn(message);
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

430)         return null;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

431)     };
432)     /**
Christian Fraß update

Christian Fraß authored 6 years ago

433)      * @author fenris
434)      */
435)     class_nothing.prototype.toString = function () {
436)         return "<\u00B7>";
437)     };
438)     /**
439)      * @author fenris
440)      */
441)     class_nothing.prototype.reason_get = function () {
442)         var content = ((this.reason == null) ? "·" : this.reason);
443)         return "<- " + content + " ->";
444)     };
445)     /**
446)      * @author fenris
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

447)      */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

448)     class_nothing.prototype.distinguish = function (action_just, action_nothing) {
449)         if (action_nothing === void 0) { action_nothing = function () { }; }
450)         action_nothing(this.reason);
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

451)     };
452)     /**
Christian Fraß update

Christian Fraß authored 6 years ago

453)      * @author fenris
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

454)      */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

455)     class_nothing.prototype.propagate = function (action) {
456)         return (new class_nothing(this.reason));
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

457)     };
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

458)     return class_nothing;
459) }(class_maybe));
460) /**
Christian Fraß update

Christian Fraß authored 6 years ago

461)  * @author fenris
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

462)  */
463) /*export*/ var class_just = (function (_super) {
464)     __extends(class_just, _super);
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

465)     /**
Christian Fraß update

Christian Fraß authored 6 years ago

466)      * @author fenris
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

467)      */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

468)     function class_just(value) {
Christian Fraß update

Christian Fraß authored 6 years ago

469)         var _this = _super.call(this) || this;
470)         _this.value = value;
471)         return _this;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

472)     }
473)     /**
Christian Fraß update

Christian Fraß authored 6 years ago

474)      * @author fenris
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

475)      */
476)     class_just.prototype.is_nothing = function () {
477)         return false;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

478)     };
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

479)     /**
Christian Fraß update

Christian Fraß authored 6 years ago

480)      * @author fenris
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

481)      */
482)     class_just.prototype.is_just = function () {
483)         return true;
484)     };
485)     /**
Christian Fraß update

Christian Fraß authored 6 years ago

486)      * @author fenris
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

487)      */
488)     class_just.prototype.cull = function () {
489)         return this.value;
490)     };
491)     /**
Christian Fraß update

Christian Fraß authored 6 years ago

492)      * @author fenris
493)      */
494)     class_just.prototype.toString = function () {
495)         var content = instance_show(this.value);
496)         return "<+ " + content + " +>";
497)     };
498)     /**
499)      * @author fenris
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

500)      */
501)     class_just.prototype.distinguish = function (action_just, action_nothing) {
502)         if (action_nothing === void 0) { action_nothing = function () { }; }
503)         action_just(this.value);
504)     };
505)     /**
Christian Fraß update

Christian Fraß authored 6 years ago

506)      * @author fenris
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

507)      */
508)     class_just.prototype.propagate = function (action) {
509)         return action(this.value);
510)     };
511)     return class_just;
512) }(class_maybe));
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

513) /**
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

514)  * @author frac
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

515)  */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

516) var class_error = (function (_super) {
517)     __extends(class_error, _super);
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

518)     /**
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

519)      * @author frac
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

520)      */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

521)     function class_error(message, suberrors) {
522)         if (suberrors === void 0) { suberrors = []; }
Christian Fraß update

Christian Fraß authored 6 years ago

523)         var _this = _super.call(this, message) || this;
524)         _this.suberrors = suberrors;
525)         _this.mess = message;
526)         return _this;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

527)     }
528)     /**
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

529)      * @override
530)      * @author frac
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

531)      */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

532)     class_error.prototype.toString = function () {
533)         return (this.mess + " " + ("[" + this.suberrors.map(function (x) { return x.toString(); }).join(",") + "]"));
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

534)     };
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

535)     return class_error;
536) }(Error));
Christian Fraß update

Christian Fraß authored 6 years ago

537) ///<reference path="../../base/build/logic-decl.d.ts"/>
538) var lib_call;
539) (function (lib_call) {
540)     /**
541)      * @desc this is kind of an ugly hack; the motivation is, that the JS-interpreter of many Gecko-based browsers
542)      *    (e.g. Firefox) won't accept a larger number of stack-frames, which come up when using executor-chains often.
543)      *    This can be circumvented by deferring inner calls, such that they are moved outside the own stack-frame. This
544)      *    is possible due to the asynchronous nature of executors. However this does also significantly increase the
545)      *    overall-time for a long executor-chain (or rather executor-tree) to finish. Therefore it is not recommended
546)      *    to do this by default.
547)      * @author frac
548)      */
549)     lib_call.default_deferred = ((lib_base.environment() == "web") && (window.navigator.userAgent.indexOf("Firefox") >= 0));
550)     /**
551)      * @author fenris
552)      */
553)     function schedule(function_, deferred = lib_call.default_deferred) {
554)         if (!deferred) {
555)             function_();
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

556)         }
557)         else {
Christian Fraß update

Christian Fraß authored 6 years ago

558)             setTimeout(function_, 0);
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

559)         }
Christian Fraß update

Christian Fraß authored 6 years ago

560)     }
561)     lib_call.schedule = schedule;
562) })(lib_call || (lib_call = {}));
563) ///<reference path="../../base/build/logic-decl.d.ts"/>
564) var lib_call;
565) (function (lib_call) {
566)     /**
567)      * @author frac
568)      * @todo could possibly be replaced by Promise-system
569)      */
570)     class class_wait {
571)     }
572)     lib_call.class_wait = class_wait;
573)     /**
574)      * @author frac
575)      * @todo could possibly be replaced by Promise-system
576)      */
577)     class class_wait_sequential extends class_wait {
578)         /**
579)          * @author frac
580)          */
581)         constructor(dependencies, action = function () { lib_log.log("all done"); }) {
582)             super();
583)             this.dependencies = dependencies;
584)             this.action = action;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

585)         }
Christian Fraß update

Christian Fraß authored 6 years ago

586)         /**
587)          * @author frac
588)          */
589)         run_(dependencies) {
590)             if (dependencies.length > 0) {
591)                 dependencies[0](() => this.run_(dependencies.slice(1)));
592)             }
593)             else {
594)                 this.action();
595)             }
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

596)         }
Christian Fraß update

Christian Fraß authored 6 years ago

597)         /**
598)          * @author frac
599)          */
600)         run() {
601)             this.run_(this.dependencies);
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

602)         }
603)     }
Christian Fraß update

Christian Fraß authored 6 years ago

604)     lib_call.class_wait_sequential = class_wait_sequential;
605)     /**
606)      * @author frac
607)      * @todo could possibly be replaced by Promise-system
608)      */
609)     class class_wait_parallel extends class_wait {
610)         /**
611)          * @author frac
612)          */
613)         constructor(dependencies, action = function () { lib_log.log("all done"); }) {
614)             super();
615)             this.index = 0;
616)             this.dependencies = {};
617)             this.action = action;
618)             dependencies.forEach(dependency => this.add_dependency(dependency));
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

619)         }
Christian Fraß update

Christian Fraß authored 6 years ago

620)         /**
621)          * @author frac
622)          */
623)         add_dependency(dependency) {
624)             this.dependencies["dependency_" + this.index.toString()] = dependency;
625)             this.index += 1;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

626)         }
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

627)         /**
628)          * @author frac
629)          */
Christian Fraß update

Christian Fraß authored 6 years ago

630)         remove_dependency(id) {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

631)             if (!(id in this.dependencies)) {
632)                 throw (new Error("dependency does not exist"));
633)             }
634)             else {
635)                 delete this.dependencies[id];
636)                 if (Object.keys(this.dependencies).length == 0) {
637)                     this.action();
638)                 }
639)             }
Christian Fraß update

Christian Fraß authored 6 years ago

640)         }
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

641)         /**
642)          * @author frac
643)          */
Christian Fraß update

Christian Fraß authored 6 years ago

644)         run() {
645)             let that = this;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

646)             if (Object.keys(this.dependencies).length == 0) {
647)                 this.action();
648)             }
649)             else {
650)                 Object.keys(this.dependencies).forEach(function (id) {
Christian Fraß update

Christian Fraß authored 6 years ago

651)                     let dependency = that.dependencies[id];
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

652)                     dependency(function () {
653)                         that.remove_dependency(id);
654)                     });
655)                 });
656)             }
Christian Fraß update

Christian Fraß authored 6 years ago

657)         }
658)     }
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

659)     lib_call.class_wait_parallel = class_wait_parallel;
660) })(lib_call || (lib_call = {}));
661) var lib_call;
662) (function (lib_call) {
Christian Fraß update

Christian Fraß authored 6 years ago

663)     /**
664)      * @author fenris
665)      */
666)     function timeout(function_, delay, ...params) {
667)         return (
668)         /*window.*/ setTimeout.apply(
669)         /*window.*/ setTimeout, [function_, delay].concat(params)));
670)     }
671)     lib_call.timeout = timeout;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

672)     /**
673)      * @desc a definition for a value being "defined"
674)      * @author neuc
675)      */
Christian Fraß update

Christian Fraß authored 6 years ago

676)     function is_def(obj, null_is_valid = false) {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

677)         return (!((typeof (obj) === "undefined") || (!null_is_valid && (obj === null))));
678)     }
679)     lib_call.is_def = is_def;
680)     /**
681)      * @desc returns the value if set and, when a type is specified, if the type is corret, if not return default_value
682)      * @author neuc
683)      */
Christian Fraß update

Christian Fraß authored 6 years ago

684)     function def_val(value, default_value, type = null, null_is_valid = false) {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

685)         if (is_def(value, null_is_valid) && (is_def(type) ? ((typeof value === type) || ((value === null) && null_is_valid)) : true)) {
686)             return value;
687)         }
688)         else {
689)             return default_value;
690)         }
691)     }
692)     lib_call.def_val = def_val;
693)     ;
694)     /**
695)      * @desc just the empty function; useful for some callbacks etc.
Christian Fraß update

Christian Fraß authored 6 years ago

696)      * @author fenris
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

697)      */
698)     function nothing() {
699)     }
700)     lib_call.nothing = nothing;
701)     /**
702)      * @desc just the identity; useful for some callbacks etc.
Christian Fraß update

Christian Fraß authored 6 years ago

703)      * @author fenris
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

704)      */
705)     function id(x) {
706)         return x;
707)     }
708)     lib_call.id = id;
709)     /**
Christian Fraß update

Christian Fraß authored 6 years ago

710)      * @author fenris
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

711)      */
712)     function use(input, function_) {
713)         return function_(input);
714)     }
715)     lib_call.use = use;
716)     /**
717)      * @desc outputs
Christian Fraß update

Christian Fraß authored 6 years ago

718)      * @author fenris
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

719)      */
Christian Fraß update

Christian Fraß authored 6 years ago

720)     function output(...args) {
721)         lib_log.info.apply(lib_log, args);
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

722)     }
723)     lib_call.output = output;
724)     /**
725)      * @desc converts the "arguments"-map into an array
726)      * @param {Object} args
Christian Fraß update

Christian Fraß authored 6 years ago

727)      * @author fenris
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

728)      */
729)     function args2list(args) {
Christian Fraß update

Christian Fraß authored 6 years ago

730)         return Object.keys(args).map(key => args[key]);
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

731)     }
732)     lib_call.args2list = args2list;
733)     /**
734)      * @desc provides the call for an attribute of a class as a regular function
735)      * @param {string} name the name of the attribute
736)      * @return {*}
Christian Fraß update

Christian Fraß authored 6 years ago

737)      * @author fenris
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

738)      */
739)     function attribute(name) {
Christian Fraß update

Christian Fraß authored 6 years ago

740)         return ((object) => object[name]);
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

741)     }
742)     lib_call.attribute = attribute;
743)     /**
744)      * @desc provides a method of a class as a regular function
745)      * @param {string} name the name of the method
746)      * @return {function}
Christian Fraß update

Christian Fraß authored 6 years ago

747)      * @author fenris
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

748)      */
749)     function method(name) {
750)         return (function (object) { return object[name].apply(object, args2list(arguments).slice(1)); });
751)     }
752)     lib_call.method = method;
753)     /**
754)      * @desc composes two functions (i.e. returns a function that return the result of the successive execution of both input-functions)
755)      * @param {function} function_f
756)      * @param {function} function_g
Christian Fraß update

Christian Fraß authored 6 years ago

757)      * @author fenris
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

758)      */
759)     function compose(function_f, function_g) {
760)         return (function (x) {
761)             // return function_g(function_f(x));
762)             return function_g(function_f.apply(function_f, args2list(arguments)));
763)         });
764)     }
765)     lib_call.compose = compose;
766)     /**
767)      * @desc transforms a function with sequential input into a function with leveled input; example: add(2,3) = curryfy(add)(2)(3)
768)      * @param {function} f
769)      * @param {int} n (don't set manually)
770)      * @return {function} the currified version of the in put function
Christian Fraß update

Christian Fraß authored 6 years ago

771)      * @author fenris
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

772)      */
Christian Fraß update

Christian Fraß authored 6 years ago

773)     function curryfy(f, n = f.length) {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

774)         switch (n) {
775)             case 0: {
776)                 throw (new Error("[curryfy] impossible"));
Christian Fraß update

Christian Fraß authored 6 years ago

777)                 // break;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

778)             }
779)             case 1: {
780)                 return f;
Christian Fraß update

Christian Fraß authored 6 years ago

781)                 // break;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

782)             }
783)             default: {
784)                 return (function (x) {
785)                     return (curryfy(function () { return f.apply(f, [x].concat(args2list(arguments))); }, n - 1));
786)                 });
Christian Fraß update

Christian Fraß authored 6 years ago

787)                 // break;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

788)             }
789)         }
790)     }
791)     lib_call.curryfy = curryfy;
792)     /**
793)      * @desc adapter for old syntax
Christian Fraß update

Christian Fraß authored 6 years ago

794)      * @author fenris
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

795)      */
Christian Fraß update

Christian Fraß authored 6 years ago

796)     function wait(dependencies, action = function () { lib_log.log("all done"); }, parallel = true) {
797)         let wait = (parallel ? (new lib_call.class_wait_parallel(dependencies, action)) : (new lib_call.class_wait_sequential(dependencies, action)));
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

798)         wait.run();
799)     }
800)     lib_call.wait = wait;
801)     /**
802)      * returns a function which goes through a process step by step
803)      * a process is an array of objects like { func : {function}, state : {string}}
804)      * trigger the start of the process by calling the returned function with one argument
805)      * which represents the parameters of the first function which is in the process
806)      * @param {Array<object>} _process
807)      * @param {function} on_stateChange called before the next function is called
808)      * @returns {function}
809)      */
Christian Fraß update

Christian Fraß authored 6 years ago

810)     function simple_process(_process, on_stateChange = function (msg) { lib_log.info("State changed " + msg); }, on_progress = function (msg, pos, max) { lib_log.info("Progress '" + msg + "' " + pos + "/" + max); }) {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

811)         var data_hashmap = {};
Christian Fraß update

Christian Fraß authored 6 years ago

812)         var _orchestrate = function (data, pos = 0) {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

813)             if (is_def(data)) {
814)                 // data_hashmap[pos] = object_merge_objects({}, data, ["parents", "parent", "children"]);
815)                 data_hashmap[pos] = {};
Christian Fraß update

Christian Fraß authored 6 years ago

816)                 Object.keys(data).filter(key => (["parents", "parent", "children"].indexOf(key) < 0)).forEach(key => (data_hashmap[pos][key] = data[key]));
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

817)             }
818)             else {
819)                 if (is_def(data_hashmap[pos]) && is_def(data_hashmap[pos].processed)) {
820)                     data = data_hashmap[pos];
821)                 }
822)             }
823)             if (pos < _process.length) {
824)                 var _func;
825)                 if (typeof (_process[pos]) !== "undefined") {
826)                     _func = _process[pos].func;
827)                 }
828)                 if (pos === 0) {
829)                     data = { processed: data };
830)                 }
831)                 if (_process[pos]) {
832)                     on_stateChange(_process[pos].state);
833)                 }
834)                 return (_func(data, function (processed_data) {
Christian Fraß update

Christian Fraß authored 6 years ago

835)                     timeout(_orchestrate({ "processed": processed_data }, pos + 1), 0);
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

836)                 }, on_progress));
837)             }
838)             else {
Christian Fraß update

Christian Fraß authored 6 years ago

839)                 lib_log.error("o.O.");
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

840)             }
841)         };
842)         return _orchestrate;
843)     }
844)     lib_call.simple_process = simple_process;
845) })(lib_call || (lib_call = {}));
Christian Fraß update

Christian Fraß authored 6 years ago

846) ///<reference path="../../base/build/logic-decl.d.ts"/>
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

847) "use strict";
848) var lib_call;
849) (function (lib_call) {
850)     /**
Christian Fraß update

Christian Fraß authored 6 years ago

851)      * @author fenris
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

852)      */
853)     function executor_resolve(result) {
Christian Fraß update

Christian Fraß authored 6 years ago

854)         return ((resolve, reject) => resolve(result));
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

855)     }
856)     lib_call.executor_resolve = executor_resolve;
857)     /**
Christian Fraß update

Christian Fraß authored 6 years ago

858)      * @author fenris
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

859)      */
860)     function executor_reject(reason) {
Christian Fraß update

Christian Fraß authored 6 years ago

861)         return ((resolve, reject) => reject(reason));
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

862)     }
863)     lib_call.executor_reject = executor_reject;
864)     /**
Christian Fraß update

Christian Fraß authored 6 years ago

865)      * @author fenris
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

866)      */
867)     function executor_transform(executor, transform_result, transform_reason) {
Christian Fraß update

Christian Fraß authored 6 years ago

868)         return ((resolve, reject) => {
869)             executor(result => resolve(transform_result(result)), reason => reject(transform_reason(reason)));
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

870)         });
871)     }
872)     lib_call.executor_transform = executor_transform;
873)     /**
Christian Fraß update

Christian Fraß authored 6 years ago

874)      * @author fenris
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

875)      */
Christian Fraß update

Christian Fraß authored 6 years ago

876)     function executor_transform_default(executor, transform_result, wrap_string = null) {
877)         let transform_reason = (error => ((wrap_string == null) ? error : new class_error(wrap_string, [error])));
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

878)         return (executor_transform(executor, transform_result, transform_reason));
879)     }
880)     lib_call.executor_transform_default = executor_transform_default;
881)     /**
Christian Fraß update

Christian Fraß authored 6 years ago

882)      * @author fenris
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

883)      */
Christian Fraß update

Christian Fraß authored 6 years ago

884)     function executor_compose_sequential(first, second, deferred = undefined) {
885)         return ((resolve, reject) => {
886)             first(result => {
887)                 lib_call.schedule(() => second(result)(resolve, reject), deferred);
888)             }, reason => {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

889)                 reject(reason);
890)             });
891)         });
892)     }
893)     lib_call.executor_compose_sequential = executor_compose_sequential;
894)     /**
Christian Fraß update

Christian Fraß authored 6 years ago

895)      * @author fenris
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

896)      */
Christian Fraß update

Christian Fraß authored 6 years ago

897)     function executor_chain(state, executors, deferred = lib_call.default_deferred) {
898)         return ((resolve, reject) => {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

899)             if (executors.length == 0) {
900)                 return resolve(state);
901)             }
902)             else {
Christian Fraß update

Christian Fraß authored 6 years ago

903)                 return executors[0](state)(result => {
904)                     /*
905)                     schedule(
906)                         () => executor_chain(result, executors.slice(1))(resolve, reject)
907)                     );
908)                      */
909)                     /*
910)                     setTimeout(
911)                         () => executor_chain(result, executors.slice(1))(resolve, reject),
912)                         0
913)                     );
914)                      */
915)                     executor_chain(result, executors.slice(1))(resolve, reject);
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

916)                 }, reject);
917)             }
918)         });
919)         /*
920)          */
921)         /*
922)         if (executors.length == 0) {
923)             return executor_resolve<type_state, type_error>(state);
924)         }
925)         else if (executors.length == 1) {
926)             return executors[0](state);
927)         }
928)         else {
929)             return (
930)                 executor_chain<type_state, type_error>(
931)                     state,
932)                     [
933)                         state => (resolve, reject) => executors[0](state)(result => executors[1](result)(resolve, reject), reject)
934)                     ].concat(executors.slice(2))
935)                 )
936)             );
937)         }
938)          */
939)         /*
940)         return (
941)             executors.reduce(
942)                 (chain, current) => executor_compose_sequential<type_state, type_state, type_error>(chain, current, deferred),
943)                 executor_resolve<type_state, type_error>(state)
944)             )
945)         );
946)          */
947)     }
948)     lib_call.executor_chain = executor_chain;
949)     /**
Christian Fraß update

Christian Fraß authored 6 years ago

950)      * @author fenris
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

951)      */
952)     function executor_first(executors) {
953)         /*
954)         return (
955)             (resolve, reject) => {
956)                 if (executors.length == 0) {
957)                     reject(new Error("all failed"));
958)                 }
959)                 else {
960)                     executors[0](
961)                         result => {
962)                             resolve(result);
963)                         },
964)                         reason => {
965)                             executor_first<type_result, type_reason>(executors.slice(1))(resolve, reject);
966)                         }
967)                     )
968)                 }
969)             }
970)         );
971)          */
Christian Fraß update

Christian Fraß authored 6 years ago

972)         return ((resolve, reject) => {
973)             executor_chain([], executors.map(executor => reasons => (resolve_, reject_) => {
974)                 executor(result => reject_(result), reason => resolve_(reasons.concat([reason])));
975)             }))(errors => reject(errors), result => resolve(result));
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

976)         });
977)     }
978)     lib_call.executor_first = executor_first;
979)     /**
Christian Fraß update

Christian Fraß authored 6 years ago

980)      * @author fenris
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

981)      */
982)     function executor_condense(executors) {
Christian Fraß update

Christian Fraß authored 6 years ago

983)         return (executor_chain([], executors.map(executor => result => (resolve, reject) => {
984)             executor(element => resolve(result.concat([element])), reject);
985)         })));
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

986)     }
987)     lib_call.executor_condense = executor_condense;
988)     /**
Christian Fraß update

Christian Fraß authored 6 years ago

989)      * @author fenris
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

990)      * @deprecated use condense
991)      */
992)     function executor_filter(executors, predicate) {
Christian Fraß update

Christian Fraß authored 6 years ago

993)         return (executor_chain([], executors.map(executor => result => (resolve, reject) => {
994)             executor(element => resolve(predicate(element) ? result.concat([element]) : result), reject);
995)         })));
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

996)     }
997)     lib_call.executor_filter = executor_filter;
998)     /**
Christian Fraß update

Christian Fraß authored 6 years ago

999)      * @author fenris
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

1000)      * @deprecated use condense
1001)      */
1002)     function executor_map(executors, transformator) {
Christian Fraß update

Christian Fraß authored 6 years ago

1003)         return (executor_chain([], executors.map(executor => result => (resolve, reject) => {
1004)             executor(element1 => resolve(result.concat([transformator(element1)])), reject);
1005)         })));
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

1006)     }
1007)     lib_call.executor_map = executor_map;
1008)     /**
Christian Fraß update

Christian Fraß authored 6 years ago

1009)      * @author fenris
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

1010)      * @deprecated use condense
1011)      */
1012)     function executor_reduce(executors, initial, accumulator) {
Christian Fraß update

Christian Fraß authored 6 years ago

1013)         return (executor_chain(initial, executors.map(executor => result => (resolve, reject) => {
1014)             executor(element => resolve(accumulator(result, element)), reject);
1015)         })));
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

1016)     }
1017)     lib_call.executor_reduce = executor_reduce;
1018) })(lib_call || (lib_call = {}));
1019) var lib_call;
1020) (function (lib_call) {
1021)     /**
1022)      * @author fenris
1023)      */
1024)     var knot_loglevel_stack = [0];
1025)     /**
1026)      * @author fenris
1027)      */
1028)     function knot_loglevel_get() {
1029)         return knot_loglevel_stack.slice(-1)[0];
1030)     }
1031)     lib_call.knot_loglevel_get = knot_loglevel_get;
1032)     /**
1033)      * @author fenris
1034)      */
1035)     function knot_loglevel_push(loglevel) {
1036)         knot_loglevel_stack.push(loglevel);
1037)     }
1038)     lib_call.knot_loglevel_push = knot_loglevel_push;
1039)     /**
1040)      * @author fenris
1041)      */
1042)     function knot_loglevel_pop() {
1043)         knot_loglevel_stack.pop();
1044)     }
1045)     lib_call.knot_loglevel_pop = knot_loglevel_pop;
1046)     /**
1047)      * @author fenris
1048)      */
1049)     function knot_resolver(output) {
Christian Fraß update

Christian Fraß authored 6 years ago

1050)         return (input => (resolve, reject) => resolve(output));
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

1051)     }
1052)     lib_call.knot_resolver = knot_resolver;
1053)     /**
1054)      * @author fenris
1055)      */
1056)     function knot_id() {
Christian Fraß update

Christian Fraß authored 6 years ago

1057)         return (input => (resolve, reject) => resolve(input));
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

1058)     }
1059)     lib_call.knot_id = knot_id;
1060)     /**
1061)      * @author fenris
1062)      */
1063)     function knot_rejector(error) {
Christian Fraß update

Christian Fraß authored 6 years ago

1064)         return (input => (resolve, reject) => reject(error));
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

1065)     }
1066)     lib_call.knot_rejector = knot_rejector;
1067)     /**
1068)      * @author fenris
1069)      */
1070)     function knot_from_function(function_) {
Christian Fraß update

Christian Fraß authored 6 years ago

1071)         return (input => (resolve, reject) => {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

1072)             try {
Christian Fraß update

Christian Fraß authored 6 years ago

1073)                 let output = function_(input);
1074)                 resolve(output);
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

1075)             }
1076)             catch (exception) {
1077)                 reject((exception));
1078)             }
Christian Fraß update

Christian Fraß authored 6 years ago

1079)         });
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

1080)     }
1081)     lib_call.knot_from_function = knot_from_function;
1082)     /**
1083)      * @author fenris
1084)      */
1085)     function knot_wrap(inner, convert_input, convert_output, convert_error) {
Christian Fraß update

Christian Fraß authored 6 years ago

1086)         return (input_outer => (resolve, reject) => {
1087)             let input_inner = convert_input(input_outer);
1088)             inner(input_inner)(output_inner => {
1089)                 let output_outer = convert_output(output_inner);
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

1090)                 return resolve(output_outer);
Christian Fraß update

Christian Fraß authored 6 years ago

1091)             }, error_inner => {
1092)                 let error_outer = convert_error(error_inner);
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

1093)                 return reject(error_outer);
1094)             });
Christian Fraß update

Christian Fraß authored 6 years ago

1095)         });
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

1096)     }
1097)     lib_call.knot_wrap = knot_wrap;
1098)     /**
1099)      * @author fenris
1100)      */
1101)     function knot_wrap_log(inner) {
Christian Fraß update

Christian Fraß authored 6 years ago

1102)         return (knot_wrap(inner, input => {
1103)             lib_log.error("--", "input:", JSON.stringify(input));
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

1104)             return input;
Christian Fraß update

Christian Fraß authored 6 years ago

1105)         }, output => {
1106)             lib_log.error("--", "output:", JSON.stringify(output));
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

1107)             return output;
Christian Fraß update

Christian Fraß authored 6 years ago

1108)         }, error => {
1109)             lib_log.error("--", "error:", JSON.stringify(error));
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

1110)             return error;
1111)         }));
1112)     }
1113)     lib_call.knot_wrap_log = knot_wrap_log;
1114)     /**
1115)      * @author fenris
1116)      */
1117)     function knot_compose_sequential(first, second) {
Christian Fraß update

Christian Fraß authored 6 years ago

1118)         let second_ = ((knot_loglevel_get() >= 1)
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

1119)             ? knot_wrap_log(second)
1120)             : second);
Christian Fraß update

Christian Fraß authored 6 years ago

1121)         return (input => (resolve, reject) => {
1122)             first(input)(between => lib_call.schedule(() => second_(between)(resolve, reject)), reject);
1123)         });
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

1124)     }
1125)     lib_call.knot_compose_sequential = knot_compose_sequential;
1126)     /**
1127)      * @author fenris
1128)      */
Christian Fraß update

Christian Fraß authored 6 years ago

1129)     function knot_chain(knots, logging = false) {
1130)         /*
1131)         return (
1132)             knots.reduce<type_knot<type_input, type_output, type_error>>(
1133)                 knot_compose_sequential,
1134)                 knot_id<any, type_error>()
1135)             )
1136)         );
1137)          */
1138)         let knots_ = (logging
1139)             ? knots.map(knot_wrap_log)
1140)             : knots);
1141)         if (knots_.length == 0) {
1142)             return (input => (resolve, reject) => {
1143)                 resolve(input);
1144)             });
1145)         }
1146)         else {
1147)             return (input => (resolve, reject) => {
1148)                 return knots_[0](input)(result => {
1149)                     return knot_chain(knots_.slice(1), false)(result)(resolve, reject);
1150)                 }, error => {
1151)                     return reject(error);
1152)                 });
1153)             });
1154)         }
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

1155)     }
1156)     lib_call.knot_chain = knot_chain;
1157)     /**
Christian Fraß update

Christian Fraß authored 6 years ago

1158)      * @author fenris
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

1159)      */
1160)     /*
1161)     export function knot_compose_parallel<>(
1162)         upper : type_knot<type_input, type_output_upper, type_error_upper>,
1163)         lower : type_knot<type_input, type_output_lower, type_error_lower>
1164)     ) {
1165)         return (
1166)             input => (resolve, reject) => {
1167)                 upper(input)(
1168)                 )
1169)                 lower(input)(
1170)                 )
1171)             }
1172)         );
1173)     }
1174)      */
1175)     /**
1176)      * @author fenris
1177)      */
1178)     function knot_bunch(knots) {
Christian Fraß update

Christian Fraß authored 6 years ago

1179)         return (input => (resolve, reject) => {
1180)             let done = false;
1181)             let master_output = {};
1182)             let ready = {};
1183)             let master_resolve = (id, output) => {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

1184)                 if (!done) {
1185)                     master_output[id] = output;
1186)                     ready[id] = true;
Christian Fraß update

Christian Fraß authored 6 years ago

1187)                     if (Object.keys(knots).every(id => (id in ready))) {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

1188)                         done = true;
1189)                         resolve(master_output);
1190)                     }
1191)                     else {
Christian Fraß update

Christian Fraß authored 6 years ago

1192)                         // nothing to do
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

1193)                     }
1194)                 }
1195)                 else {
Christian Fraß update

Christian Fraß authored 6 years ago

1196)                     // nothing to do
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

1197)                 }
1198)             };
Christian Fraß update

Christian Fraß authored 6 years ago

1199)             let master_reject = (id, error) => {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

1200)                 if (!done) {
1201)                     done = true;
1202)                     reject(error);
1203)                 }
1204)                 else {
Christian Fraß update

Christian Fraß authored 6 years ago

1205)                     // nothing to do
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

1206)                 }
1207)             };
Christian Fraß update

Christian Fraß authored 6 years ago

1208)             Object.keys(knots).forEach(id => {
1209)                 knots[id](input)(output => master_resolve(id, output), error => master_reject(id, error));
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

1210)             });
Christian Fraß update

Christian Fraß authored 6 years ago

1211)         });
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

1212)     }
1213)     lib_call.knot_bunch = knot_bunch;
1214)     /**
Christian Fraß update

Christian Fraß authored 6 years ago

1215)      * @author fenris
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

1216)      */
1217)     function knot_condense(knots) {
Christian Fraß update

Christian Fraß authored 6 years ago

1218)         /*
1219)         return (
1220)             input => knot_chain<Array<type_output>, Array<type_output>, type_error>(
1221)                 knots.map<type_knot<Array<type_output>, Array<type_output>, type_error>>(
1222)                     knot => list => (resolve, reject) => {
1223)                         knot(input)(
1224)                             element => resolve(list.concat([element])),
1225)                             reject
1226)                         );
1227)                     }
1228)                 )
1229)             )([])
1230)         );
1231)          */
1232)         if (knots.length == 0) {
1233)             return (input => (resolve, reject) => {
1234)                 resolve([]);
1235)             });
1236)         }
1237)         else {
1238)             return (input => (resolve, reject) => {
1239)                 knots[0](input)(element => {
1240)                     knot_condense(knots.slice(1))(input)(restlist => {
1241)                         resolve([element].concat(restlist));
1242)                     }, reject);
1243)                 }, error => {
1244)                     reject(error);
1245)                 });
1246)             });
1247)         }
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

1248)     }
1249)     lib_call.knot_condense = knot_condense;
1250)     /**
Christian Fraß update

Christian Fraß authored 6 years ago

1251)      * @author fenris
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

1252)      */
Christian Fraß update

Christian Fraß authored 6 years ago

1253)     function knot_first(knots) {
1254)         return (input => (resolve, reject) => {
1255)             knot_condense(knots.map(knot => input_ => (resolve_, reject_) => knot(input)(reject_, resolve_)))(input)(reject, resolve);
1256)         });
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

1257)     }
Christian Fraß update

Christian Fraß authored 6 years ago

1258)     lib_call.knot_first = knot_first;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

1259)     /**
Christian Fraß update

Christian Fraß authored 6 years ago

1260)      * @author fenris
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

1261)      */
Christian Fraß update

Christian Fraß authored 6 years ago

1262)     function knot_repeat(knot, attempts = 5, delay = (attempt => 250)) {
1263)         let seq = (n => ((n == 0) ? [] : seq(n - 1).concat([n - 1])));
1264)         return (knot_first(seq(attempts).map((_, attempt) => input => (resolve, reject) => knot(input)(resolve, error => {
1265)             setTimeout(() => reject(error), delay(attempt));
1266)         }))));
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

1267)     }
Christian Fraß update

Christian Fraß authored 6 years ago

1268)     lib_call.knot_repeat = knot_repeat;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

1269)     /**
Christian Fraß update

Christian Fraß authored 6 years ago

1270)      * @desc useful for e.g. asynchronous singletons
1271)      * @author fenris
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

1272)      */
Christian Fraß update

Christian Fraß authored 6 years ago

1273)     class class_knot_initializer {
1274)         /**
1275)          * @author fenris
1276)          */
1277)         constructor(fetcher) {
1278)             /**
1279)              * @author fenris
1280)              * 0 : initial
1281)              * 1 : waiting
1282)              * 2 : done, successful
1283)              * 3 : done, failed
1284)              */
1285)             this.state = 0;
1286)             /**
1287)              * @author fenris
1288)              */
1289)             this.output = null;
1290)             /**
1291)              * @author fenris
1292)              */
1293)             this.error = null;
1294)             this.fetcher = fetcher;
1295)             this.state = 0;
1296)             this.queue = [];
1297)             this.output = null;
1298)             this.error = null;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

1299)         }
Christian Fraß update

Christian Fraß authored 6 years ago

1300)         /**
1301)          * @author fenris
1302)          */
1303)         actuate() {
1304)             switch (this.state) {
1305)                 case 2: {
1306)                     this.queue.forEach(entry => entry.resolve(this.output));
1307)                     break;
1308)                 }
1309)                 case 3: {
1310)                     this.queue.forEach(entry => entry.reject(this.error));
1311)                     break;
1312)                 }
1313)                 default: {
1314)                     throw (new Error(`unhandled state ${this.state}`));
1315)                     break;
1316)                 }
1317)             }
1318)         }
1319)         /**
1320)          * @author fenris
1321)          */
1322)         reset() {
1323)             this.state = 0;
1324)             this.queue = [];
1325)         }
1326)         /**
1327)          * @author fenris
1328)          */
1329)         get(input) {
1330)             switch (this.state) {
1331)                 case 0: {
1332)                     this.state = 1;
1333)                     return (_ => (resolve, reject) => {
1334)                         this.queue.push({ "resolve": resolve, "reject": reject });
1335)                         this.fetcher(input)(output => {
1336)                             this.state = 2;
1337)                             this.output = output;
1338)                             this.actuate();
1339)                         }, error => {
1340)                             this.state = 3;
1341)                             this.error = error;
1342)                             this.actuate();
1343)                         });
1344)                     });
1345)                     break;
1346)                 }
1347)                 case 1: {
1348)                     return (_ => (resolve, reject) => this.queue.push({ "resolve": resolve, "reject": reject }));
1349)                     break;
1350)                 }
1351)                 case 2: {
1352)                     return knot_resolver(this.output);
1353)                     break;
1354)                 }
1355)                 case 3: {
1356)                     return knot_rejector(this.error);
1357)                     break;
1358)                 }
1359)                 default: {
1360)                     throw (new Error(`unhandled state ${this.state}`));
1361)                     break;
1362)                 }
1363)             }
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

1364)         }
1365)     }
Christian Fraß update

Christian Fraß authored 6 years ago

1366)     lib_call.class_knot_initializer = class_knot_initializer;
1367) })(lib_call || (lib_call = {}));
1368) var lib_call;
1369) (function (lib_call) {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

1370)     /**
Christian Fraß update

Christian Fraß authored 6 years ago

1371)      * @author fenris
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

1372)      */
Christian Fraß update

Christian Fraß authored 6 years ago

1373)     function promise_reject(reason) {
1374)         return Promise.reject(reason);
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

1375)     }
Christian Fraß update

Christian Fraß authored 6 years ago

1376)     lib_call.promise_reject = promise_reject;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

1377)     /**
Christian Fraß update

Christian Fraß authored 6 years ago

1378)      * @author fenris
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

1379)      */
Christian Fraß update

Christian Fraß authored 6 years ago

1380)     function promise_resolve(result) {
1381)         return Promise.resolve(result);
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

1382)     }
Christian Fraß update

Christian Fraß authored 6 years ago

1383)     lib_call.promise_resolve = promise_resolve;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

1384)     /**
Christian Fraß update

Christian Fraß authored 6 years ago

1385)      * @author fenris
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

1386)      */
Christian Fraß update

Christian Fraß authored 6 years ago

1387)     function promise_make(executor) {
1388)         return (new Promise(executor));
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

1389)     }
Christian Fraß update

Christian Fraß authored 6 years ago

1390)     lib_call.promise_make = promise_make;
1391)     /**
1392)      * @author fenris
1393)      */
1394)     function promise_all(promises) {
1395)         return Promise.all(promises);
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

1396)     }
Christian Fraß update

Christian Fraß authored 6 years ago

1397)     lib_call.promise_all = promise_all;
1398) })(lib_call || (lib_call = {}));
1399) 
1400) (function (exports) {
1401) 	
1402) 	/**
1403) 	 * @author fenris
1404) 	 */
1405) 	function promise_chain(
1406) 		microprograms
1407) 	) {
1408) 		return (
1409) 			input => microprograms.reduce(
1410) 				(x, y) => x.then(y),
1411) 				Promise.resolve(input)
1412) 			)
1413) 		);
1414) 	}
1415) 	exports.promise_chain = promise_chain;
1416) 	
1417) 
1418) 	/**
1419) 	 * @author fenris
1420) 	 */
1421) 	function promise_wrap(
1422) 		promise,
1423) 		transformator_result,
1424) 		transformator_reason = lib_call.id
1425) 	) {
1426) 		return (
1427) 			new Promise(
1428) 				(resolve, reject) => {
1429) 					promise.then(
1430) 						result => resolve(transformator_result(result)),
1431) 						reason => reject(transformator_reason(reason))
1432) 					)
1433) 				}
1434) 			)
1435) 		);
1436) 	}
1437) 	exports.promise_wrap = promise_wrap;
1438) 
1439) 
1440) 	/**
1441) 	 * @author fenris
1442) 	 */
1443) 	function promise_log(state) {
1444) 		return (
1445) 			new Promise(
1446) 				(resolve, reject) => {
1447) 					lib_log.info(state);
1448) 					resolve(state);
1449) 				}
1450) 			)
1451) 		);
1452) 	}
1453) 	exports.promise_log = promise_log;
1454) 
1455) 
1456) 	/**
1457) 	 * @author fenris
1458) 	 */
1459) 	function promise_attach(
1460) 		state,
1461) 		promise,
1462) 		name
1463) 	) {
1464) 		return (
1465) 			promise_wrap(
1466) 				promise,
1467) 				result => {
1468) 					state[name] = result;
1469) 					return state;
1470) 				}
1471) 			)
1472) 		);
1473) 	}
1474) 	exports.promise_attach = promise_attach;
1475) 	
1476) }) (lib_call || (lib_call == {}));
1477) 
1478) ///<reference path="../../base/build/logic-decl.d.ts"/>
1479) var lib_object;
1480) (function (lib_object) {
1481)     /**
1482)      * @author fenris
1483)      */
1484)     function fetch(object, fieldname, fallback, escalation) {
1485)         if (fallback === void 0) { fallback = null; }
1486)         if (escalation === void 0) { escalation = 1; }
1487)         if ((fieldname in object) && (object[fieldname] !== undefined)) {
1488)             return object[fieldname];
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

1489)         }
1490)         else {
Christian Fraß update

Christian Fraß authored 6 years ago

1491)             switch (escalation) {
1492)                 case 0: {
1493)                     return fallback;
1494)                     break;
1495)                 }
1496)                 case 1: {
1497)                     var message = ("field '" + fieldname + "' not in structure");
1498)                     message += ("; using fallback value '" + String(fallback) + "'");
1499)                     // console.warn(message);
1500)                     return fallback;
1501)                     break;
1502)                 }
1503)                 case 2: {
1504)                     var message = ("field '" + fieldname + "' not in structure");
1505)                     throw (new Error(message));
1506)                     break;
1507)                 }
1508)                 default: {
1509)                     throw (new Error("invalid escalation level " + escalation));
1510)                     break;
1511)                 }
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

1512)             }
1513)         }
1514)     }
Christian Fraß update

Christian Fraß authored 6 years ago

1515)     lib_object.fetch = fetch;
1516)     /**
1517)      * @author fenris
1518)      */
1519)     function map(object_from, transformator) {
1520)         var object_to = {};
1521)         Object.keys(object_from).forEach(function (key) { return (object_to[key] = transformator(object_from[key], key)); });
1522)         return object_to;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

1523)     }
Christian Fraß update

Christian Fraß authored 6 years ago

1524)     lib_object.map = map;
1525)     /**
1526)      * @author fenris
1527)      */
1528)     function filter(object_from, predicate) {
1529)         var object_to = {};
1530)         Object.keys(object_from).forEach(function (key) {
1531)             var value = object_from[key];
1532)             if (predicate(value, key)) {
1533)                 object_to[key] = value;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

1534)             }
Christian Fraß update

Christian Fraß authored 6 years ago

1535)         });
1536)         return object_to;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

1537)     }
Christian Fraß update

Christian Fraß authored 6 years ago

1538)     lib_object.filter = filter;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

1539)     /**
Christian Fraß update

Christian Fraß authored 6 years ago

1540)      * @author fenris
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

1541)      */
Christian Fraß update

Christian Fraß authored 6 years ago

1542)     function from_array(array) {
1543)         var object = {};
1544)         array.forEach(function (entry) { return (object[entry.key] = entry.value); });
1545)         return object;
1546)     }
1547)     lib_object.from_array = from_array;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

1548)     /**
Christian Fraß update

Christian Fraß authored 6 years ago

1549)      * @author fenris
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

1550)      */
Christian Fraß update

Christian Fraß authored 6 years ago

1551)     function to_array(object) {
1552)         var array = [];
1553)         Object.keys(object).forEach(function (key) { return array.push({ "key": key, "value": object[key] }); });
1554)         return array;
1555)     }
1556)     lib_object.to_array = to_array;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

1557)     /**
Christian Fraß update

Christian Fraß authored 6 years ago

1558)      * @author fenris
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

1559)      */
Christian Fraß update

Christian Fraß authored 6 years ago

1560)     function keys(object) {
1561)         return Object.keys(object);
1562)     }
1563)     lib_object.keys = keys;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

1564)     /**
Christian Fraß update

Christian Fraß authored 6 years ago

1565)      * @author fenris
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

1566)      */
Christian Fraß update

Christian Fraß authored 6 years ago

1567)     function values(object) {
1568)         return to_array(object).map(function (entry) { return entry.value; });
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

1569)     }
Christian Fraß update

Christian Fraß authored 6 years ago

1570)     lib_object.values = values;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

1571)     /**
Christian Fraß update

Christian Fraß authored 6 years ago

1572)      * @author fenris
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

1573)      */
Christian Fraß update

Christian Fraß authored 6 years ago

1574)     function path_read(object, path, fallback, escalation) {
1575)         if (fallback === void 0) { fallback = null; }
1576)         if (escalation === void 0) { escalation = 1; }
1577)         var steps = ((path.length == 0) ? [] : path.split("."));
1578)         if (steps.length == 0) {
1579)             throw (new Error("empty path"));
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

1580)         }
1581)         else {
Christian Fraß update

Christian Fraß authored 6 years ago

1582)             var position_1 = object;
1583)             var reachable = steps.slice(0, steps.length - 1).every(function (step) {
1584)                 position_1 = object_fetch(position_1, step, null, 0);
1585)                 return (position_1 != null);
1586)             });
1587)             if (reachable) {
1588)                 return object_fetch(position_1, steps[steps.length - 1], fallback, escalation);
1589)             }
1590)             else {
1591)                 return object_fetch({}, "_dummy_", fallback, escalation);
1592)             }
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

1593)         }
1594)     }
Christian Fraß update

Christian Fraß authored 6 years ago

1595)     lib_object.path_read = path_read;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

1596)     /**
Christian Fraß update

Christian Fraß authored 6 years ago

1597)      * @author fenris
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

1598)      */
Christian Fraß update

Christian Fraß authored 6 years ago

1599)     function path_write(object, path, value, construct) {
1600)         if (construct === void 0) { construct = true; }
1601)         var steps = ((path.length == 0) ? [] : path.split("."));
1602)         if (steps.length == 0) {
1603)             throw (new Error("empty path"));
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

1604)         }
1605)         else {
Christian Fraß update

Christian Fraß authored 6 years ago

1606)             var position_2 = object;
1607)             var reachable = steps.slice(0, steps.length - 1).every(function (step) {
1608)                 var position_ = object_fetch(position_2, step, null, 0);
1609)                 if (position_ == null) {
1610)                     if (construct) {
1611)                         position_2[step] = {};
1612)                         position_2 = position_2[step];
1613)                         return true;
1614)                     }
1615)                     else {
1616)                         return false;
1617)                     }
1618)                 }
1619)                 else {
1620)                     position_2 = position_;
1621)                     return true;
1622)                 }
1623)             });
1624)             if (reachable) {
1625)                 position_2[steps[steps.length - 1]] = value;
1626)             }
1627)             else {
1628)                 throw (new Error("path " + path + " does not exist and may not be constructed"));
1629)             }
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

1630)         }
1631)     }
Christian Fraß update

Christian Fraß authored 6 years ago

1632)     lib_object.path_write = path_write;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

1633)     /**
Christian Fraß update

Christian Fraß authored 6 years ago

1634)      * @author fenris
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

1635)      */
Christian Fraß update

Christian Fraß authored 6 years ago

1636)     function matches(object, pattern, collate) {
1637)         if (collate === void 0) { collate = instance_collate; }
1638)         return Object.keys(pattern).every(function (key) { return collate(pattern[key], object[key]); });
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

1639)     }
Christian Fraß update

Christian Fraß authored 6 years ago

1640)     lib_object.matches = matches;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

1641)     /**
Christian Fraß update

Christian Fraß authored 6 years ago

1642)      * @author fenris
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

1643)      */
Christian Fraß update

Christian Fraß authored 6 years ago

1644)     function flatten(value) {
1645)         var integrate = function (result, key_, value_) {
1646)             if (value_ == null) {
1647)                 result[key_] = value_;
1648)             }
1649)             else {
1650)                 if (typeof (value_) != "object") {
1651)                     result[key_] = value_;
1652)                 }
1653)                 else {
1654)                     var result_1 = flatten(value_);
1655)                     Object.keys(result_1).forEach(function (key__) {
1656)                         var value__ = result_1[key__];
1657)                         result[key_ + "." + key__] = value__;
1658)                     });
1659)                 }
1660)             }
1661)         };
1662)         if (value == null) {
1663)             return null;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

1664)         }
1665)         else {
Christian Fraß update

Christian Fraß authored 6 years ago

1666)             var result_2 = {};
1667)             if (typeof (value) != "object") {
1668)                 result_2["value"] = value;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

1669)             }
1670)             else {
Christian Fraß update

Christian Fraß authored 6 years ago

1671)                 if (value instanceof Array) {
1672)                     var array = (value);
1673)                     array.forEach(function (element, index) { return integrate(result_2, "element_" + index, element); });
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

1674)                 }
1675)                 else {
Christian Fraß update

Christian Fraß authored 6 years ago

1676)                     var object_1 = (value);
1677)                     Object.keys(object_1).forEach(function (key) { return integrate(result_2, key, object_1[key]); });
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

1678)                 }
1679)             }
Christian Fraß update

Christian Fraß authored 6 years ago

1680)             return result_2;
1681)         }
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

1682)     }
Christian Fraß update

Christian Fraß authored 6 years ago

1683)     lib_object.flatten = flatten;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

1684)     /**
Christian Fraß update

Christian Fraß authored 6 years ago

1685)      * @author fenris
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

1686)      */
Christian Fraß update

Christian Fraß authored 6 years ago

1687)     function clash(x, y, _a) {
1688)         var _b = _a === void 0 ? {} : _a, _c = _b["overwrite"], overwrite = _c === void 0 ? true : _c, _d = _b["hooks"]["existing"], hook_existing = _d === void 0 ? null : _d;
1689)         if (hook_existing == null) {
1690)             (function (key, value_old, value_new) { return console.warn("field " + key + " already defined"); });
1691)         }
1692)         var z = {};
1693)         Object.keys(x).forEach(function (key) {
1694)             z[key] = x[key];
1695)         });
1696)         Object.keys(y).forEach(function (key) {
1697)             if (key in z) {
1698)                 hook_existing(key, z[key], y[key]);
1699)                 if (overwrite) {
1700)                     z[key] = y[key];
1701)                 }
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

1702)             }
1703)             else {
Christian Fraß update

Christian Fraß authored 6 years ago

1704)                 z[key] = y[key];
1705)             }
1706)         });
1707)         return z;
1708)     }
1709)     lib_object.clash = clash;
1710)     /**
1711)      * @author fenris
1712)      */
1713)     function patch(core, mantle, deep, path) {
1714)         if (deep === void 0) { deep = true; }
1715)         if (path === void 0) { path = null; }
1716)         if (mantle == null) {
1717)             console.warn("mantle is null; core was", core);
1718)         }
1719)         else {
1720)             Object.keys(mantle).forEach(function (key) {
1721)                 var path_ = ((path == null) ? key : path + "." + key);
1722)                 var value_mantle = mantle[key];
1723)                 if (!(key in core)) {
1724)                     if ((typeof (value_mantle) == "object") && (value_mantle != null) && deep) {
1725)                         if (value_mantle instanceof Array) {
1726)                             core[key] = [];
1727)                             value_mantle.forEach(function (element) {
1728)                                 if ((typeof (element) == "object") && (element != null)) {
1729)                                     var element_ = {};
1730)                                     patch(element_, element);
1731)                                     core[key].push(element_);
1732)                                 }
1733)                                 else {
1734)                                     core[key].push(element);
1735)                                 }
1736)                             });
1737)                         }
1738)                         else {
1739)                             core[key] = {};
1740)                             patch(core[key], value_mantle, deep, path_);
1741)                         }
1742)                     }
1743)                     else {
1744)                         core[key] = value_mantle;
1745)                     }
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

1746)                 }
1747)                 else {
Christian Fraß update

Christian Fraß authored 6 years ago

1748)                     var value_core = core[key];
1749)                     if (typeof (value_mantle) == typeof (value_core)) {
1750)                         if ((typeof (value_mantle) == "object") && (value_mantle != null) && deep) {
1751)                             patch(core[key], value_mantle, deep, path_);
1752)                         }
1753)                         else {
1754)                             core[key] = value_mantle;
1755)                         }
1756)                     }
1757)                     else {
1758)                         var message = "objects have different shapes at path '" + path_ + "'; core has type '" + typeof (value_core) + "' and mantle has type '" + typeof (value_mantle) + "'";
1759)                         console.warn(message);
1760)                         core[key] = value_mantle;
1761)                         // throw (new Error(message));
1762)                     }
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

1763)                 }
Christian Fraß update

Christian Fraß authored 6 years ago

1764)             });
1765)         }
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

1766)     }
Christian Fraß update

Christian Fraß authored 6 years ago

1767)     lib_object.patch = patch;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

1768)     /**
Christian Fraß update

Christian Fraß authored 6 years ago

1769)      * @author fenris
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

1770)      */
Christian Fraß update

Christian Fraß authored 6 years ago

1771)     function patched(core, mantle, deep) {
1772)         if (deep === void 0) { deep = undefined; }
1773)         var result = {};
1774)         patch(result, core, deep);
1775)         patch(result, mantle, deep);
1776)         return result;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

1777)     }
Christian Fraß update

Christian Fraß authored 6 years ago

1778)     lib_object.patched = patched;
1779)     /**
1780)      * @author fenris
1781)      */
1782)     function attached(object, key, value) {
1783)         var mantle = {};
1784)         mantle[key] = value;
1785)         return patched(object, mantle, false);
1786)     }
1787)     lib_object.attached = attached;
1788)     /**
1789)      * @author fenris
1790)      */
1791)     function copy(object) {
1792)         return patched({}, object);
1793)     }
1794)     lib_object.copy = copy;
1795) })(lib_object || (lib_object = {}));
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

1796) /**
1797)  * @desc adapters for old syntax
Christian Fraß update

Christian Fraß authored 6 years ago

1798)  * @author fenris
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

1799)  */
Christian Fraß update

Christian Fraß authored 6 years ago

1800) var object_fetch = lib_object.fetch;
1801) var object_map = lib_object.map;
1802) var object_a2o = lib_object.from_array;
1803) var object_o2a = lib_object.to_array;
1804) var object_matches = lib_object.matches;
1805) var object_clash = lib_object.clash;
1806) ///<reference path="../../base/build/logic-decl.d.ts"/>
1807) /**
1808)  * @param {Object} map
1809)  * @return {string}
1810)  * @author frac
1811)  */
1812) /*export*/ var object_map2string = function (map) {
1813)     return (" " + Object.keys(map)
1814)         .filter(function (key) { return (key != "isMapped"); })
1815)         .map(function (key) { return ("" + ((map[key] == null) ? "-" : map[key].toString()) + ""); })
1816)         .join(" ")
1817)         + "");
1818) };
1819) /**
1820)  * @param {Array} array
1821)  * @return {string}
1822)  * @author frac
1823)  */
1824) /*export*/ var object_array2string = function (array) {
1825)     return ("" + array.map(function (element, index) {
1826)         switch (typeof (element)) {
1827)             case "object": return object_map2string(element);
1828)             default: return String(element);
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

1829)         }
Christian Fraß update

Christian Fraß authored 6 years ago

1830)     }).join(",") + "");
1831) };
1832) /**
1833)  * @desc follows a path in an object-tree
1834)  * @param {Object} object the object in which the path lies
1835)  * @param {string} path the steps
1836)  * @param {boolean} [create] whether to create not yet existing branches
1837)  * @return {Object} {'successful': successful, 'position': position} where the branch or leaf at the end of the path
1838)  * @author frac
1839)  */
1840) var object_path_walk = function (object, path, create, null_on_missing) {
1841)     if (create === void 0) { create = true; }
1842)     if (null_on_missing === void 0) { null_on_missing = false; }
1843)     var steps = ((path == "") ? [] : path.split("."));
1844)     if (steps.length == 0) {
1845)         return object;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

1846)     }
Christian Fraß update

Christian Fraß authored 6 years ago

1847)     else {
1848)         var head = steps[0];
1849)         // create
1850)         {
1851)             if (!(head in object)) {
1852)                 if (create) {
1853)                     var value = null;
1854)                     if (steps.length >= 2) {
1855)                         var next = steps[1];
1856)                         var index = parseInt(next);
1857)                         if (!isNaN(index)) {
1858)                             value = [];
1859)                         }
1860)                         else {
1861)                             value = {};
1862)                         }
1863)                     }
1864)                     else {
1865)                         value = {};
1866)                     }
1867)                     object[head] = value;
1868)                 }
1869)                 else {
1870)                     // console.info("[object_path_walk] object is ", object);
1871)                     var message = "[object_path_walk] can not walk step \u00BB" + head + "\u00AB in path \u00BB" + path + "\u00AB on object";
1872)                     if (null_on_missing) {
1873)                         console.warn(message);
1874)                         return null;
1875)                     }
1876)                     else {
1877)                         throw (new Error(message));
1878)                     }
1879)                 }
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

1880)             }
1881)         }
Christian Fraß update

Christian Fraß authored 6 years ago

1882)         // execute rest
1883)         {
1884)             var object_ = object[head];
1885)             var path_ = steps.slice(1).join(".");
1886)             return object_path_walk(object_, path_, create, null_on_missing);
1887)         }
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

1888)     }
Christian Fraß update

Christian Fraß authored 6 years ago

1889)     /*
1890)     return (
1891)         string_split(path, ".").reduce(
1892)             function (position : any, step : string) : any {
1893)                 if (! lib_call.is_def(position[step], true)) {
1894)                     if (create) {
1895)                         position[step] = {};
1896)                     }
1897)                     else {
1898)                         // console.info("[object_path_walk] object is ", object);
1899)                         let message : string = sprintf("[object_path_walk] can not walk step »%s« in path »%s« on object", [step, path]);
1900)                         if (null_on_missing) {
1901)                             console.warn(message);
1902)                             return null;
1903)                         }
1904)                         else {
1905)                             throw (new Error(message));
1906)                         }
1907)                     }
1908)                 }
1909)                 return position[step];
1910)             },
1911)             object
1912)         )
1913)     );
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

1914)      */
Christian Fraß update

Christian Fraß authored 6 years ago

1915) };
1916) /**
1917)  * @desc reads a branch/leaf from an object-tree
1918)  * @author frac
1919)  */
1920) /*export*/ var object_path_read = function (object, path, null_on_missing) {
1921)     if (null_on_missing === void 0) { null_on_missing = false; }
1922)     return object_path_walk(object, path, false, null_on_missing);
1923) };
1924) /**
1925)  * @desc writes a branch/leaf to an object-tree
1926)  * @author frac
1927)  */
1928) /*export*/ var object_path_write = function (object, path, value) {
1929)     // for "initializing" the object (important if the value to write is an entry in a yet not existing array)
1930)     /*let old : any = */ object_path_walk(object, path, true, true);
1931)     var steps = ((path == "") ? [] : path.split("."));
1932)     var position = object_path_walk(object, steps.slice(0, steps.length - 1).join("."), true);
1933)     if (position == undefined) {
1934)         console.warn("can't set \u00BB" + steps[steps.length - 1] + "\u00AB in undefined");
1935)     }
1936)     else {
1937)         position[steps[steps.length - 1]] = value;
1938)     }
1939) };
1940) /*export*/ var object_object_path_write_ex = function (obj, path, val) {
1941)     var ref = obj;
1942)     var paths = path.split(".");
1943)     var i;
1944)     for (i = 0; i < paths.length - 1; i++) {
1945)         if (ref[paths[i]] === void 0) {
1946)             if (/^(0|[1-9][0-9]*)$/.test(paths[i + 1])) {
1947)                 ref[paths[i]] = [];
1948)             }
1949)             else {
1950)                 ref[paths[i]] = {};
1951)             }
1952)         }
1953)         ref = ref[paths[i]];
1954)     }
1955)     ref[paths[i]] = val;
1956) };
1957) /**
1958)  * @desc filters branches from an object
1959)  * @param {Object} object the object to read from
1960)  * @param {Array} paths a list of string-lists, that are the paths to be propagated
1961)  * @return {Object} the object with only the selected branches
1962)  * @author frac
1963)  */
1964) /*export*/ var object_path_filter = function (object, paths) {
1965)     var result = {};
1966)     paths.forEach(function (path) {
1967)         var value = null;
1968)         try {
1969)             value = object_path_read(object, path);
1970)         }
1971)         catch (exception) {
1972)             console.warn(exception);
1973)         }
1974)         if (value != null) {
1975)             object_path_write(result, path, value);
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

1976)         }
1977)         else {
Christian Fraß update

Christian Fraß authored 6 years ago

1978)             console.warn("skipped path \"" + path + "\" while filtering");
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

1979)         }
Christian Fraß update

Christian Fraß authored 6 years ago

1980)     });
1981)     return result;
1982) };
1983) /**
1984)  * @desc dunno… returns a list of object-paths?
1985)  * @param {Object} object
1986)  * @param {string} p
1987)  * @todo can probably be merged with getLeafg
1988)  */
1989) /*export*/ var object_path_list = function (object, path, visited) {
1990)     if (path === void 0) { path = null; }
1991)     if (visited === void 0) { visited = []; }
1992)     var result = [];
1993)     visited.push(object);
1994)     for (var key in object) {
1995)         var value = object[key];
1996)         if (visited.indexOf(value) === -1) {
1997)             var key_ = (path == null) ? key : (path + "." + key);
1998)             if (typeof (value) === "object") {
1999)                 result = result.concat(object_path_list(value, key_, visited));
2000)             }
2001)             else {
2002)                 result.push({ "key": key_, "value": value });
2003)             }
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

2004)         }
Christian Fraß update

Christian Fraß authored 6 years ago

2005)     }
2006)     return result;
2007) };
2008) /**
2009)  * theroreticaly loop prof walk through all elements and subelements of an object
2010)  * and call a callback for each entry
2011)  * @param {object} obj object to iterate through
2012)  * @param {function} callback
2013)  */
2014) /*export*/ var object_iterate = function (obj, callback, leafs_only, path, visited) {
2015)     if (leafs_only === void 0) { leafs_only = false; }
2016)     if (visited === void 0) { visited = []; }
2017)     var have_seen = function (ob) {
2018)         return visited.some(function (e) { return ((typeof (ob) === "object") && (ob !== null) && (e === ob)); });
2019)     };
2020)     var next = [];
2021)     Object.keys(obj).forEach(function (key) {
2022)         var elem = obj[key];
2023)         if (!have_seen(elem)) {
2024)             visited.push(elem);
2025)             var _path = "";
2026)             if (typeof path === "undefined") {
2027)                 _path = key;
2028)             }
2029)             else {
2030)                 _path += [path, key].join(".");
2031)             }
2032)             if (!leafs_only)
2033)                 callback(_path, elem, key);
2034)             if (typeof (elem) === "object") {
2035)                 (function (elem_, callback_, _path_, visited_) {
2036)                     next.push(function () { object_iterate(elem_, callback_, leafs_only, _path_, visited_); });
2037)                 })(elem, callback, _path, visited);
2038)             }
2039)             else {
2040)                 if (leafs_only)
2041)                     callback(_path, elem, key);
2042)             }
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

2043)         }
Christian Fraß update

Christian Fraß authored 6 years ago

2044)     });
2045)     var func;
2046)     while (func = next.shift()) {
2047)         func();
2048)     }
2049) };
2050) /**
2051)  * @desc get the leaf-nodes of an object
2052)  * @param {object} object
2053)  * @return {Array<string>} a list containing all leaf-nodes
2054)  * @author frac
2055)  */
2056) /*export*/ var getLeafs = function (object) {
2057)     var skip = {
2058)         "className": true,
2059)         "timeStamp": true,
2060)         "parentId": true,
2061)         "transactionID": true,
2062)         "guid": true,
2063)         "_id": true,
2064)         "parents": true,
2065)         "children": true
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

2066)     };
Christian Fraß update

Christian Fraß authored 6 years ago

2067)     return (Object.keys(object).reduce(function (leafs, key) {
2068)         try {
2069)             var value = object[key];
2070)             if (key in skip) {
2071)                 console.warn("skipping field \"" + key + "\"");
2072)                 return leafs;
2073)             }
2074)             else {
2075)                 if ((typeof (value) === "object") && (value != null)) {
2076)                     return leafs.concat(getLeafs(value).map(function (leaf) { return (key + "." + leaf); }));
2077)                 }
2078)                 else {
2079)                     return leafs.concat([key]);
2080)                 }
2081)             }
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

2082)         }
Christian Fraß update

Christian Fraß authored 6 years ago

2083)         catch (exception) {
2084)             console.warn(exception);
2085)             console.info("key: ", key);
2086)             return null;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

2087)         }
Christian Fraß update

Christian Fraß authored 6 years ago

2088)     }, new Array()));
2089) };
2090) /**
2091)  *
2092)  * @desc merges two arrays by probing
2093)  * @param {Array} core
2094)  * @param {Array} mantle
2095)  * @param {function} match
2096)  */
2097) /*export*/ var merge_array = function (core, mantle, match) {
2098)     if (match === void 0) { match = (function (x, y) { return (x === y); }); }
2099)     if ((core == undefined) || (mantle == undefined)) {
2100)         throw (new Error("Error: "
2101)             + ((core == undefined) ? " core must be an array and not '" + typeof (core) + "'" : "")
2102)             + ((mantle == undefined) ? " mantle must be an array and not '" + typeof (mantle) + "'" : "")));
2103)     }
2104)     var ret = core;
2105)     for (var i = 0; i < mantle.length; i++) {
2106)         var entry = mantle[i];
2107)         try {
2108)             var matching_index = core.find(function (element) { return match(element, entry); });
2109)             ret[matching_index] = object_merge_objects(core[matching_index], entry);
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

2110)         }
Christian Fraß update

Christian Fraß authored 6 years ago

2111)         catch (e) {
2112)             ret.push(entry);
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

2113)         }
Christian Fraß update

Christian Fraß authored 6 years ago

2114)     }
2115)     return ret;
2116) };
2117) /**
2118)  * @desc merges two objects recursivly
2119)  * @param {Object} object1 core
2120)  * @param {Object} object2 mantle
2121)  * @param {Array} [ignore_keys]
2122)  * @param [do_not_overwrite_existing_values]
2123)  * @returns {Object} a clone of object1 will be returned
2124)  */
2125) /*export*/ var object_merge_objects = function (object1, object2, ignore_keys, do_not_overwrite_existing_values, ignore_null, path) {
2126)     if (object1 === void 0) { object1 = null; }
2127)     if (object2 === void 0) { object2 = null; }
2128)     if (ignore_keys === void 0) { ignore_keys = ["parents"]; }
2129)     if (do_not_overwrite_existing_values === void 0) { do_not_overwrite_existing_values = false; }
2130)     if (ignore_null === void 0) { ignore_null = false; }
2131)     if (path === void 0) { path = []; }
2132)     if (object1 == null) {
2133)         if (object2 instanceof Array) {
2134)             object1 = [];
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

2135)         }
2136)         else {
Christian Fraß update

Christian Fraß authored 6 years ago

2137)             object1 = {};
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

2138)         }
Christian Fraß update

Christian Fraß authored 6 years ago

2139)     }
2140)     var iteration_keys = Object.keys(object2);
2141)     if (ignore_keys === []) {
2142)         if (path.indexOf(object2) >= 0)
2143)             return undefined;
2144)         path.push(object2);
2145)     }
2146)     //
2147)     for (var i = 0; i < iteration_keys.length; i += 1) {
2148)         var key = iteration_keys[i];
2149)         if (ignore_keys.some(function (k) {
2150)             return key == k;
2151)         })) {
2152)             //
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

2153)         }
Christian Fraß update

Christian Fraß authored 6 years ago

2154)         else if (object2[key] === null) {
2155)             if (!ignore_null)
2156)                 object1[key] = null;
2157)         }
2158)         else if ((typeof (object2[key]) === "object") && ((typeof (object1[key]) === "object") || (typeof (object1[key]) === "undefined"))) {
2159)             object1[key] = object_merge_objects(object1[key], object2[key], ignore_keys, do_not_overwrite_existing_values, ignore_null, path);
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

2160)         }
2161)         else {
Christian Fraß update

Christian Fraß authored 6 years ago

2162)             if ((do_not_overwrite_existing_values === false) || (typeof (object1[key]) === "undefined")) {
2163)                 object1[key] = object2[key];
2164)             }
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

2165)         }
Christian Fraß update

Christian Fraß authored 6 years ago

2166)     }
2167)     return object1;
2168) };
2169) /*
2170)  * @param {object} recipie  ex: { "name" : { extract : function(o) { return o["name"]; }}}
2171)  * */
2172) var flatten_object = function (obj, recipie, drop_key) {
2173)     if (drop_key === void 0) { drop_key = (function (k) { return ["parents", "parent", "children"].indexOf(k) > -1; }); }
2174)     var ret = {};
2175)     for (var key in recipie) {
2176)         if (!drop_key(key)) {
2177)             var prefix = (recipie[key].prefix || "");
2178)             var recursive = (recipie[key].recursive || -1);
2179)             var extract = (recipie[key].extract || (function (x) { return x; }));
2180)             var _obj = extract(obj[key]);
2181)             if ((_obj !== null) && ((typeof _obj == "object") || (obj[key] instanceof Array)) && (!(recursive == 0))) {
2182)                 var tmp = {};
2183)                 var _recipie = {};
2184)                 for (var _i = 0, _a = Object.keys(_obj); _i < _a.length; _i++) {
2185)                     var k = _a[_i];
2186)                     _recipie[k] = {
2187)                         "prefix": (prefix + key + "."),
2188)                         "recursive": (recursive - 1),
2189)                         "extract": (function (x) { return x; })
2190)                     };
2191)                 }
2192)                 tmp = flatten_object(_obj, _recipie, drop_key);
2193)                 ret = object_merge_objects(ret, tmp);
2194)             }
2195)             else {
2196)                 ret[prefix + key] = _obj;
2197)             }
2198)         }
2199)     }
2200)     return ret;
2201) };
2202) /**
2203)  * use the complete path of an objects entry as key to make an one dimensional object
2204)  * @param {object} object the object which should be moade flat
2205)  * @param {string} [path] for the recursive call the current path
2206)  */
2207) /*export*/ var object_make_flat = function (object, path, filter, split_char, objects) {
2208)     if (path === void 0) { path = null; }
2209)     if (filter === void 0) { filter = ["parent", "children"]; }
2210)     if (split_char === void 0) { split_char = "."; }
2211)     if (objects === void 0) { objects = []; }
2212)     if (object.toFlat != undefined) {
2213)         return object.toFlat();
2214)     }
2215)     else {
2216)         var ret = {};
2217)         var default_visited_key = "___visited_path___";
2218)         var visited_key;
2219)         if (object != void 0) {
2220)             var iterate = function (key) {
2221)                 var newkey = key;
2222)                 if ((path != undefined) && (path !== "")) {
2223)                     newkey = path + split_char + newkey;
2224)                 }
2225)                 // do not touch objects we alrdy know
2226)                 if ((obj_ref[key] != undefined) && (!objects.some(function (e) { return (e === obj_ref); }))) {
2227)                     //if (lib_call.is_def(obj_ref[key]) && (! obj_ref[key].hasOwnProperty(visited_key)) && (key !== visited_key)) {
2228)                     if (typeof obj_ref[key] === "object") {
2229)                         ret = object_merge_objects(ret, object_make_flat(obj_ref[key], newkey, filter, split_char, objects.concat(object)));
2230)                     }
2231)                     else if (typeof obj_ref[key] === "function") {
2232)                         // o.O a function ... doing nothing might be the best choice
2233)                     }
2234)                     else {
2235)                         var value = obj_ref[key];
2236)                         ret[newkey] = value;
2237)                     }
2238)                 }
2239)             };
2240)             visited_key = default_visited_key;
2241)             //object[visited_key] = true;
2242)             var obj_ref = object;
2243)             Object.keys(object).filter(function (key) { return (filter.indexOf(key) < 0); }).forEach(iterate);
2244)             if (typeof object.getComputedValues == "function") {
2245)                 visited_key = default_visited_key + "_" + Math.random().toString();
2246)                 obj_ref = object.getComputedValues();
2247)                 obj_ref[visited_key] = true;
2248)                 Object.keys(obj_ref).filter(function (key) { return (filter.indexOf(key) < 0); }).forEach(iterate);
2249)             }
2250)         }
2251)         else {
2252)             //console.warn("something went wrong with that object: ", object, "on this path:", path);
2253)         }
2254)         return ret;
2255)     }
2256) };
2257) /**
2258)  * splits a flat oject into an array of objects if there are paths containing numbers, which indicates
2259)  * that there might be an array
2260)  * used for normalisation of imports
2261)  * @param entry
2262)  * @param number_replace_string
2263)  * @param {function} [match_function] how to test key if it causes a split
2264)  * @returns {Array}
2265)  */
2266) var object_split_flat_object = function (entry, number_replace_string, fab_function, match_function) {
2267)     if (typeof (match_function) === "undefined") {
2268)         match_function = function (key) {
2269)             return (!key.match(/^custom/)) && key.match(/\.[0-9]+\./);
2270)         };
2271)     }
2272)     if (typeof (fab_function) === "undefined") {
2273)         fab_function = function (obj, e) {
2274)             return obj;
2275)         };
2276)     }
2277)     if (typeof (number_replace_string) === "undefined") {
2278)         number_replace_string = "%d";
2279)     }
2280)     var ret = {};
2281)     var _ret = [];
2282)     var keys = Object.keys(entry);
2283)     var group_keys = keys.filter(match_function);
2284)     keys.forEach(function (key) {
2285)         var index = 0;
2286)         var nkey = key;
2287)         if (match_function(key)) {
2288)             index = Number(key.match(/[0-9]+/)[0]).valueOf();
2289)             nkey = key.replace(/\.[0-9]+\./, "." + number_replace_string + ".");
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

2290)         }
Christian Fraß update

Christian Fraß authored 6 years ago

2291)         if (!ret[index]) {
2292)             ret[index] = {};
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

2293)         }
Christian Fraß update

Christian Fraß authored 6 years ago

2294)         ret[index][nkey] = entry[key];
2295)     });
2296)     keys = Object.keys(ret).sort();
2297)     _ret.push(ret[0]);
2298)     for (var index = 1; index < keys.length; index++) {
2299)         _ret.push(fab_function(ret[keys[index]], entry));
2300)     }
2301)     _ret[0] = object_merge_objects(_ret[0], ret[0]);
2302)     return _ret;
2303) };
2304) // TODO: move to exporter, it's to specific
2305) // to normalize the objects convert paths of a tree-like structure to a
2306) // key-value list with complete paths as key
2307) // the info object is passed to the next function as it is
2308) // and a flat_object (key : value)
2309) /*export*/ var object_make_flat_async = function (data, callback, on_progress) {
2310)     setTimeout((function (_obj, _cb, _info) {
2311)         return (function () {
2312)             var ret = _obj.map(function (o) { return object_make_flat(o); });
2313)             _cb({ "flat_object": ret, "objects": ret, "info": _info });
2314)         });
2315)     })((typeof (data.processed.objects) === "undefined") ? data.processed.source_object : data.processed.objects, callback, data.processed.info), 0);
2316) };
2317) var object_flatten = function (object, paths, prefix) {
2318)     if (prefix === void 0) { prefix = ""; }
2319)     var ret = {};
2320)     var paths_ = paths.reduce(function (prev, current) {
2321)         if (current.split(".").some(function (x) { return (x === "%d"); })) {
2322)             var path = current.split(".%d").shift();
2323)             var len = object_path_read(object, path).length;
2324)             for (var i = 0; i < len; i++) {
2325)                 // prev.push(sprintf(current, [i]));
2326)                 prev.push(current.replace(new RegExp("%d"), i.toFixed(0)));
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

2327)             }
2328)         }
2329)         else {
Christian Fraß update

Christian Fraß authored 6 years ago

2330)             prev.push(current);
2331)         }
2332)         return prev;
2333)     }, []);
2334)     for (var _i = 0, paths_1 = paths_; _i < paths_1.length; _i++) {
2335)         var path = paths_1[_i];
2336)         var tmp = object_path_read(object, path, true);
2337)         if ((tmp != undefined) && (tmp.toFlat != undefined)) {
2338)             var tmp_ = tmp.toFlat([path, "."].join(""));
2339)             for (var key in tmp_) {
2340)                 ret[key] = tmp_[key];
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

2341)             }
2342)         }
Christian Fraß update

Christian Fraß authored 6 years ago

2343)         else {
2344)             ret[prefix + path] = tmp;
2345)         }
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

2346)     }
Christian Fraß update

Christian Fraß authored 6 years ago

2347)     return ret;
2348) };
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

2349) /**
Christian Fraß update

Christian Fraß authored 6 years ago

2350)  * parse
2351)  * @param {String} value
2352)  * @returns {Object}
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

2353)  */
Christian Fraß update

Christian Fraß authored 6 years ago

2354) var object_parse = function (value) {
2355)     var content = JSON.parse(value);
2356)     var m = { "root": content };
2357)     (new Mapper()).mapClasses(m);
2358)     return m["root"];
2359) };
2360) /**
2361)  * stringify
2362)  *
2363)  * @description stringify object as JSON
2364)  */
2365) var object_stringify = function (object, readable) {
2366)     if (readable === void 0) { readable = false; }
2367)     return (JSON.stringify(object, function (key, value) {
2368)         if ((key == "parents") && (value !== null)) {
2369)             return null;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

2370)         }
Christian Fraß update

Christian Fraß authored 6 years ago

2371)         if (key == "changeActions") {
2372)             return undefined;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

2373)         }
Christian Fraß update

Christian Fraß authored 6 years ago

2374)         if (key == "observer") {
2375)             return undefined;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

2376)         }
Christian Fraß update

Christian Fraß authored 6 years ago

2377)         if (key == "isMapped") {
2378)             return undefined;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

2379)         }
Christian Fraß update

Christian Fraß authored 6 years ago

2380)         /*
2381)         if (value === null) {
2382)             return undefined;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

2383)         }
Christian Fraß update

Christian Fraß authored 6 years ago

2384)         */
2385)         return value;
2386)     }, readable ? 1 : 0));
2387) };
2388) var __extends = (this && this.__extends) || (function () {
2389)     var extendStatics = Object.setPrototypeOf ||
2390)         ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
2391)         function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
2392)     return function (d, b) {
2393)         extendStatics(d, b);
2394)         function __() { this.constructor = d; }
2395)         d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
2396)     };
2397) })();
2398) var lib_meta;
2399) (function (lib_meta) {
2400)     /**
2401)      * @author frac
2402)      */
2403)     function type_toString(type) {
2404)         // return ("<" + type.id + ">");
2405)         return JSON.stringify(type);
2406)     }
2407)     lib_meta.type_toString = type_toString;
2408)     /**
2409)      * @author frac
2410)      */
2411)     var class_pool = {};
2412)     /**
2413)      * @author frac
2414)      */
2415)     function class_set(name, class_) {
2416)         class_pool[name] = class_;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

2417)     }
Christian Fraß update

Christian Fraß authored 6 years ago

2418)     lib_meta.class_set = class_set;
2419)     /**
2420)      * @author frac
2421)      */
2422)     function class_get(name) {
2423)         if (name in class_pool) {
2424)             return class_pool[name];
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

2425)         }
2426)         else {
Christian Fraß update

Christian Fraß authored 6 years ago

2427)             throw (new Error("no class registered for name '" + name + "'"));
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

2428)         }
2429)     }
Christian Fraß update

Christian Fraß authored 6 years ago

2430)     lib_meta.class_get = class_get;
2431)     /**
2432)      * @author frac
2433)      */
2434)     function transform_field(name, attributes) {
2435)         var type = attributes["type"];
2436)         var path = name;
2437)         var label = ((attributes["title"] != undefined) ? attributes["title"] : name);
2438)         var display = ((attributes["display"] != undefined) ? attributes["display"] : true);
2439)         return ({
2440)             "path": path,
2441)             "type": type,
2442)             "label": label,
2443)             "display": display
2444)         });
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

2445)     }
Christian Fraß update

Christian Fraß authored 6 years ago

2446)     lib_meta.transform_field = transform_field;
2447)     /**
2448)      * @author frac
2449)      */
2450)     function transform_description(label, description, groups_raw) {
2451)         if (groups_raw === void 0) { groups_raw = null; }
2452)         var fieldmap;
2453)         var fields = Object.keys(description).map(function (key) { return transform_field(key, description[key]); });
2454)         var groups = ((groups_raw == null)
2455)             ?
2456)                 null
2457)             :
2458)                 groups_raw.map(function (group_raw) {
2459)                     return {
2460)                         "label": group_raw["label"],
2461)                         "fields": group_raw["fields"].map(function (field_name) {
2462)                             var index = fields["findIndex"](function (field) { return (field.path == field_name); });
2463)                             if (index < 0) {
2464)                                 throw (new Error("field " + field_name + " not found in model-description"));
2465)                             }
2466)                             return index;
2467)                         })
2468)                     };
2469)                 }));
2470)         return {
2471)             "fields": fields,
2472)             "description": null,
2473)             "title": label,
2474)             "groups": groups
2475)         };
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

2476)     }
Christian Fraß update

Christian Fraß authored 6 years ago

2477)     lib_meta.transform_description = transform_description;
2478)     /**
2479)      * @author frac
2480)      */
2481)     function transform_description_groups(label, description_model, description_groups) {
2482)         return ({
2483)             "label": label,
2484)             "groups": description_groups.map(function (group_raw) {
2485)                 return {
2486)                     "label": group_raw["label"],
2487)                     "fields": group_raw["fields"].map(function (path) {
2488)                         var field_raw = description_model[path];
2489)                         return transform_field(path, field_raw);
2490)                     })
2491)                 };
2492)             })
2493)         });
2494)     }
2495)     lib_meta.transform_description_groups = transform_description_groups;
2496) })(lib_meta || (lib_meta = {}));
2497) /// <reference path="../../base/build/logic-decl.d.ts"/>
2498) /// <reference path="../../object/build/logic-decl.d.ts"/>
2499) var lib_meta;
2500) (function (lib_meta) {
2501)     /**
2502)      * @author fenris
2503)      */
2504)     lib_meta._logprefix = "[lib_meta] ";
2505)     /**
2506)      * @author fenris
2507)      */
2508)     lib_meta._verbosity = 1;
2509) })(lib_meta || (lib_meta = {}));
2510) var lib_meta;
2511) (function (lib_meta) {
2512)     /**
2513)      * @author fenris
2514)      */
2515)     var class_shape = (function () {
2516)         /**
2517)          * @desc [constructor]
2518)          * @author fenris
2519)          */
2520)         function class_shape(_a) {
2521)             var _b = _a["primitive"], primitive = _b === void 0 ? false : _b, _c = _a["soft"], soft = _c === void 0 ? true : _c, _d = _a["defaultvalue"], defaultvalue = _d === void 0 ? null : _d;
2522)             /*
2523)             if ((! soft) && (defaultvalue == null)) {
2524)                 throw (new Error("'null' is not a valid defaultvalue for hard shapes"));
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

2525)             }
Christian Fraß update

Christian Fraß authored 6 years ago

2526)              */
2527)             this.primitive = primitive;
2528)             this.soft = soft;
2529)             this.defaultvalue = defaultvalue;
2530)         }
2531)         /**
2532)          * @desc [accessor] [getter]
2533)          * @author fenris
2534)          */
2535)         class_shape.prototype.primitive_get = function () {
2536)             return this.primitive;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

2537)         };
Christian Fraß update

Christian Fraß authored 6 years ago

2538)         /**
2539)          * @desc [accessor] [getter]
2540)          * @author fenris
2541)          */
2542)         class_shape.prototype.soft_get = function () {
2543)             return this.soft;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

2544)         };
Christian Fraß update

Christian Fraß authored 6 years ago

2545)         /**
2546)          * @desc [accessor] [getter]
2547)          * @author fenris
2548)          */
2549)         class_shape.prototype.defaultvalue_get = function () {
2550)             return this.defaultvalue;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

2551)         };
Christian Fraß update

Christian Fraß authored 6 years ago

2552)         /**
2553)          * @desc [accessor]
2554)          * @author fenris
2555)          */
2556)         class_shape.prototype.inspect = function (value) {
2557)             var messages = [];
2558)             if ((!this.soft) && (value == null)) {
2559)                 messages.push("shape does not allow 'null' as value");
2560)             }
2561)             return messages;
2562)         };
2563)         /**
2564)          * @desc [accessor]
2565)          * @author fenris
2566)          */
2567)         class_shape.prototype.check = function (value) {
2568)             var messages = this.inspect(value);
2569)             if (lib_meta._verbosity >= 1) {
2570)                 messages.forEach(function (message) { return console.warn("" + lib_meta._logprefix + message); });
2571)             }
2572)             return (messages.length == 0);
2573)         };
2574)         return class_shape;
2575)     }());
2576)     lib_meta.class_shape = class_shape;
2577)     /**
2578)      * @author fenris
2579)      */
2580)     var class_shape_buildin = (function (_super) {
2581)         __extends(class_shape_buildin, _super);
2582)         /**
2583)          * @author fenris
2584)          */
2585)         function class_shape_buildin(_a) {
2586)             var typename = _a["typename"], _b = _a["primitive"], primitive = _b === void 0 ? undefined : _b, _c = _a["soft"], soft = _c === void 0 ? undefined : _c, _d = _a["defaultvalue"], defaultvalue = _d === void 0 ? undefined : _d;
2587)             var _this = _super.call(this, {
2588)                 "primitive": primitive,
2589)                 "soft": soft,
2590)                 "defaultvalue": defaultvalue
2591)             }) || this;
2592)             _this.typename = typename;
2593)             return _this;
2594)         }
2595)         /**
2596)          * @override
2597)          * @author fenris
2598)          */
2599)         class_shape_buildin.prototype.inspect = function (value) {
2600)             var messages = _super.prototype.inspect.call(this, value);
2601)             if ((!this.soft) && (typeof (value) != this.typename)) {
2602)                 messages.push("typename is not '" + this.typename + "'");
2603)             }
2604)             return messages;
2605)         };
2606)         /**
2607)          * @desc [implementation]
2608)          * @author fenris
2609)          */
2610)         class_shape_buildin.prototype._show = function () {
2611)             var str = "";
2612)             str = this.typename;
2613)             if (!this.soft) {
2614)                 str = str + "_or_null";
2615)             }
2616)             return str;
2617)         };
2618)         return class_shape_buildin;
2619)     }(class_shape));
2620)     lib_meta.class_shape_buildin = class_shape_buildin;
2621)     /**
2622)      * @author fenris
2623)      */
2624)     var _pool = {};
2625)     /**
2626)      * @author fenris
2627)      */
2628)     function register(id, factory) {
2629)         if (id in _pool) {
2630)             var message = "shape '" + id + "' already registered";
2631)             throw (new Error(message));
2632)         }
2633)         else {
2634)             _pool[id] = factory;
2635)         }
2636)     }
2637)     lib_meta.register = register;
2638)     /**
2639)      * @author fenris
2640)      */
2641)     function construct(id, parameters) {
2642)         if (parameters === void 0) { parameters = {}; }
2643)         if (!(id in _pool)) {
2644)             var message = "no shape found with id " + id;
2645)             throw (new Error(message));
2646)         }
2647)         else {
2648)             return _pool[id](parameters);
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

2649)         }
2650)     }
Christian Fraß update

Christian Fraß authored 6 years ago

2651)     lib_meta.construct = construct;
2652)     /**
2653)      * @author fenris
2654)      */
2655)     function from_raw(shape_raw) {
2656)         return construct(shape_raw.id, shape_raw.parameters);
2657)     }
2658)     lib_meta.from_raw = from_raw;
2659)     /**
2660)      * @author fenris
2661)      */
2662)     function define(id, shape_raw) {
2663)         register(id, function (parameters) { return from_raw(shape_raw); });
2664)     }
2665)     lib_meta.define = define;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

2666)     /**
2667)      * @author fenris
2668)      */
Christian Fraß update

Christian Fraß authored 6 years ago

2669)     function retrieve(id) {
2670)         return construct(id, {});
2671)     }
2672)     lib_meta.retrieve = retrieve;
2673) })(lib_meta || (lib_meta = {}));
2674) var lib_meta;
2675) (function (lib_meta) {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

2676)     /**
2677)      * @author fenris
2678)      */
Christian Fraß update

Christian Fraß authored 6 years ago

2679)     var class_shape_boolean = (function (_super) {
2680)         __extends(class_shape_boolean, _super);
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

2681)         /**
2682)          * @author fenris
2683)          */
Christian Fraß update

Christian Fraß authored 6 years ago

2684)         function class_shape_boolean(_a) {
2685)             var _b = _a["soft"], soft = _b === void 0 ? false : _b, _c = _a["defaultvalue"], defaultvalue = _c === void 0 ? false : _c;
2686)             return _super.call(this, {
2687)                 "typename": "boolean",
2688)                 "primitive": true,
2689)                 "soft": soft,
2690)                 "defaultvalue": defaultvalue
2691)             }) || this;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

2692)         }
2693)         /**
Christian Fraß update

Christian Fraß authored 6 years ago

2694)          * @override
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

2695)          * @author fenris
2696)          */
Christian Fraß update

Christian Fraß authored 6 years ago

2697)         class_shape_boolean.prototype.to_raw = function () {
2698)             return {
2699)                 "id": "boolean",
2700)                 "parameters": {
2701)                     "soft": this.soft
2702)                 }
2703)             };
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

2704)         };
Christian Fraß update

Christian Fraß authored 6 years ago

2705)         return class_shape_boolean;
2706)     }(lib_meta.class_shape_buildin));
2707)     lib_meta.class_shape_boolean = class_shape_boolean;
2708)     lib_meta.register("boolean", function (parameters) {
2709)         return (new class_shape_boolean({
2710)             "soft": parameters["soft"]
2711)         }));
2712)     });
2713)     lib_meta.register("bool", function (parameters) { return lib_meta.construct("boolean", parameters); });
2714) })(lib_meta || (lib_meta = {}));
2715) var lib_meta;
2716) (function (lib_meta) {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

2717)     /**
2718)      * @author fenris
2719)      */
Christian Fraß update

Christian Fraß authored 6 years ago

2720)     var class_shape_integer = (function (_super) {
2721)         __extends(class_shape_integer, _super);
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

2722)         /**
2723)          * @author fenris
2724)          */
Christian Fraß update

Christian Fraß authored 6 years ago

2725)         function class_shape_integer(_a) {
2726)             var _b = _a["soft"], soft = _b === void 0 ? false : _b, _c = _a["defaultvalue"], defaultvalue = _c === void 0 ? 0 : _c, _d = _a["min"], min = _d === void 0 ? null : _d, _e = _a["max"], max = _e === void 0 ? null : _e;
2727)             var _this = _super.call(this, {
2728)                 "typename": "number",
2729)                 "primitive": true,
2730)                 "soft": soft,
2731)                 "defaultvalue": defaultvalue
2732)             }) || this;
2733)             _this.min = min;
2734)             _this.max = max;
2735)             return _this;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

2736)         }
2737)         /**
Christian Fraß update

Christian Fraß authored 6 years ago

2738)          * @desc [accessor] [getter]
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

2739)          * @author fenris
2740)          */
Christian Fraß update

Christian Fraß authored 6 years ago

2741)         class_shape_integer.prototype.min_get = function () {
2742)             return this.min;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

2743)         };
2744)         /**
Christian Fraß update

Christian Fraß authored 6 years ago

2745)          * @desc [accessor] [getter]
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

2746)          * @author fenris
2747)          */
Christian Fraß update

Christian Fraß authored 6 years ago

2748)         class_shape_integer.prototype.max_get = function () {
2749)             return this.max;
2750)         };
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

2751)         /**
Christian Fraß update

Christian Fraß authored 6 years ago

2752)          * @override
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

2753)          * @author fenris
2754)          */
Christian Fraß update

Christian Fraß authored 6 years ago

2755)         class_shape_integer.prototype.inspect = function (value) {
2756)             var messages = _super.prototype.inspect.call(this, value);
2757)             if (value != null) {
2758)                 if ((this.min != null) && (value < this.min)) {
2759)                     messages.push("value is below minimum of " + this.min.toString());
2760)                 }
2761)                 if ((this.max != null) && (value > this.max)) {
2762)                     messages.push("value is over maximum of " + this.max.toString());
2763)                 }
2764)             }
2765)             return messages;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

2766)         };
Christian Fraß update

Christian Fraß authored 6 years ago

2767)         /**
2768)          * @override
2769)          * @author fenris
2770)          */
2771)         class_shape_integer.prototype.to_raw = function () {
2772)             return {
2773)                 "id": "integer",
2774)                 "parameters": {
2775)                     "soft": this.soft,
2776)                     "min": this.min,
2777)                     "max": this.max
2778)                 }
2779)             };
2780)         };
2781)         return class_shape_integer;
2782)     }(lib_meta.class_shape_buildin));
2783)     lib_meta.class_shape_integer = class_shape_integer;
2784)     lib_meta.register("integer", function (parameters) {
2785)         return (new class_shape_integer({
2786)             "min": parameters["min"],
2787)             "max": parameters["max"],
2788)             "soft": parameters["soft"]
2789)         }));
2790)     });
2791)     lib_meta.register("int", function (parameters) { return lib_meta.construct("integer", parameters); });
2792) })(lib_meta || (lib_meta = {}));
2793) var lib_meta;
2794) (function (lib_meta) {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

2795)     /**
2796)      * @author fenris
2797)      */
Christian Fraß update

Christian Fraß authored 6 years ago

2798)     var class_shape_float = (function (_super) {
2799)         __extends(class_shape_float, _super);
2800)         /**
2801)          * @author fenris
2802)          */
2803)         function class_shape_float(_a) {
2804)             var _b = _a["soft"], soft = _b === void 0 ? false : _b, _c = _a["defaultvalue"], defaultvalue = _c === void 0 ? 0.0 : _c, _d = _a["min"], min = _d === void 0 ? null : _d, _e = _a["max"], max = _e === void 0 ? null : _e;
2805)             var _this = _super.call(this, {
2806)                 "typename": "number",
2807)                 "primitive": true,
2808)                 "soft": soft,
2809)                 "defaultvalue": defaultvalue
2810)             }) || this;
2811)             _this.min = min;
2812)             _this.max = max;
2813)             return _this;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

2814)         }
Christian Fraß update

Christian Fraß authored 6 years ago

2815)         /**
2816)          * @desc [accessor] [getter]
2817)          * @author fenris
2818)          */
2819)         class_shape_float.prototype.min_get = function () {
2820)             return this.min;
2821)         };
2822)         /**
2823)          * @desc [accessor] [getter]
2824)          * @author fenris
2825)          */
2826)         class_shape_float.prototype.max_get = function () {
2827)             return this.max;
2828)         };
2829)         /**
2830)          * @override
2831)          * @author fenris
2832)          */
2833)         class_shape_float.prototype.inspect = function (value) {
2834)             var messages = _super.prototype.inspect.call(this, value);
2835)             if (value != null) {
2836)                 if ((this.min != null) && (value < this.min)) {
2837)                     messages.push("value is below minimum of " + this.min.toString());
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

2838)                 }
Christian Fraß update

Christian Fraß authored 6 years ago

2839)                 if ((this.max != null) && (value > this.max)) {
2840)                     messages.push("value is over maximum of " + this.max.toString());
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

2841)                 }
2842)             }
Christian Fraß update

Christian Fraß authored 6 years ago

2843)             return messages;
2844)         };
2845)         /**
2846)          * @override
2847)          * @author fenris
2848)          */
2849)         class_shape_float.prototype.to_raw = function () {
2850)             return {
2851)                 "id": "float",
2852)                 "parameters": {
2853)                     "soft": this.soft,
2854)                     "min": this.min,
2855)                     "max": this.max
2856)                 }
2857)             };
2858)         };
2859)         return class_shape_float;
2860)     }(lib_meta.class_shape_buildin));
2861)     lib_meta.class_shape_float = class_shape_float;
2862)     lib_meta.register("float", function (parameters) {
2863)         return (new class_shape_float({
2864)             "min": parameters["min"],
2865)             "max": parameters["max"],
2866)             "soft": parameters["soft"]
2867)         }));
2868)     });
2869) })(lib_meta || (lib_meta = {}));
2870) var lib_meta;
2871) (function (lib_meta) {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

2872)     /**
2873)      * @author fenris
2874)      */
Christian Fraß update

Christian Fraß authored 6 years ago

2875)     var class_shape_string = (function (_super) {
2876)         __extends(class_shape_string, _super);
2877)         /**
2878)          * @author fenris
2879)          */
2880)         function class_shape_string(_a) {
2881)             var _b = _a["soft"], soft = _b === void 0 ? false : _b, _c = _a["defaultvalue"], defaultvalue = _c === void 0 ? "" : _c;
2882)             return _super.call(this, {
2883)                 "typename": "string",
2884)                 "primitive": true,
2885)                 "soft": soft,
2886)                 "defaultvalue": defaultvalue
2887)             }) || this;
2888)         }
2889)         /**
2890)          * @override
2891)          * @author fenris
2892)          */
2893)         class_shape_string.prototype.to_raw = function () {
2894)             return {
2895)                 "id": "string",
2896)                 "parameters": {
2897)                     "soft": this.soft
2898)                 }
2899)             };
2900)         };
2901)         return class_shape_string;
2902)     }(lib_meta.class_shape_buildin));
2903)     lib_meta.class_shape_string = class_shape_string;
2904)     lib_meta.register("string", function (parameters) {
2905)         return (new class_shape_string({
2906)             "soft": parameters["soft"]
2907)         }));
2908)     });
2909)     lib_meta.register("str", function (parameters) { return lib_meta.construct("string", parameters); });
2910) })(lib_meta || (lib_meta = {}));
2911) var lib_meta;
2912) (function (lib_meta) {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

2913)     /**
2914)      * @author fenris
2915)      */
Christian Fraß update

Christian Fraß authored 6 years ago

2916)     var class_shape_email = (function (_super) {
2917)         __extends(class_shape_email, _super);
2918)         /**
2919)          * @author fenris
2920)          */
2921)         function class_shape_email(_a) {
2922)             var _b = _a["soft"], soft = _b === void 0 ? false : _b, _c = _a["defaultvalue"], defaultvalue = _c === void 0 ? "" : _c;
2923)             return _super.call(this, {
2924)                 "primitive": true,
2925)                 "soft": soft,
2926)                 "defaultvalue": defaultvalue
2927)             }) || this;
2928)         }
2929)         /**
2930)          * @override
2931)          * @author fenris
2932)          */
2933)         class_shape_email.prototype.to_raw = function () {
2934)             return {
2935)                 "id": "email",
2936)                 "parameters": {
2937)                     "soft": this.soft
2938)                 }
2939)             };
2940)         };
2941)         /**
2942)          * @desc [implementation]
2943)          * @author fenris
2944)          */
2945)         class_shape_email.prototype._show = function () {
2946)             var str = "email";
2947)             return str;
2948)         };
2949)         return class_shape_email;
2950)     }(lib_meta.class_shape));
2951)     lib_meta.class_shape_email = class_shape_email;
2952)     lib_meta.register("email", function (parameters) {
2953)         return (new class_shape_email({
2954)             "soft": parameters["soft"]
2955)         }));
2956)     });
2957) })(lib_meta || (lib_meta = {}));
2958) var lib_meta;
2959) (function (lib_meta) {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

2960)     /**
2961)      * @author fenris
2962)      */
Christian Fraß update

Christian Fraß authored 6 years ago

2963)     var class_shape_array = (function (_super) {
2964)         __extends(class_shape_array, _super);
2965)         /**
2966)          * @author fenris
2967)          */
2968)         function class_shape_array(_a) {
2969)             var shape_element = _a["shape_element"], _b = _a["soft"], soft = _b === void 0 ? false : _b, _c = _a["defaultvalue"], defaultvalue = _c === void 0 ? [] : _c;
2970)             var _this = _super.call(this, {
2971)                 "primitive": false,
2972)                 "soft": soft,
2973)                 "defaultvalue": defaultvalue
2974)             }) || this;
2975)             _this.shape_element = shape_element;
2976)             return _this;
2977)         }
2978)         /**
2979)          * @desc [accessor] [getter]
2980)          * @author fenris
2981)          */
2982)         class_shape_array.prototype.shape_element_get = function () {
2983)             return this.shape_element;
2984)         };
2985)         /**
2986)          * @override
2987)          * @author fenris
2988)          */
2989)         class_shape_array.prototype.inspect = function (value) {
2990)             var _this = this;
2991)             var messages = _super.prototype.inspect.call(this, value);
2992)             if (value != null) {
2993)                 if (!((typeof (value) == "object") && (value instanceof Array))) {
2994)                     messages.push("value is not an array");
2995)                 }
2996)                 else {
2997)                     var array = (value);
2998)                     array.forEach(function (element, index) {
2999)                         messages = messages.concat(_this.shape_element.inspect(element).map(function (message) { return "array element #" + index.toString() + ": " + message; }));
3000)                     });
3001)                 }
3002)             }
3003)             return messages;
3004)         };
3005)         /**
3006)          * @override
3007)          * @author fenris
3008)          */
3009)         class_shape_array.prototype.to_raw = function () {
3010)             return {
3011)                 "id": "array",
3012)                 "parameters": {
3013)                     "shape_element": this.shape_element.to_raw(),
3014)                     "soft": this.soft
3015)                 }
3016)             };
3017)         };
3018)         /**
3019)          * @desc [implementation]
3020)          * @author fenris
3021)          */
3022)         class_shape_array.prototype._show = function () {
3023)             var str = "array";
3024)             str += "<" + instance_show(this.shape_element) + ">";
3025)             return str;
3026)         };
3027)         return class_shape_array;
3028)     }(lib_meta.class_shape));
3029)     lib_meta.class_shape_array = class_shape_array;
3030)     lib_meta.register("array", function (parameters) {
3031)         var shape_element_raw = lib_object.fetch(parameters, "shape_element", null, 2);
3032)         var shape_element = lib_meta.from_raw(shape_element_raw);
3033)         return (new class_shape_array({
3034)             "shape_element": shape_element,
3035)             "soft": parameters["soft"]
3036)         }));
3037)     });
3038)     lib_meta.register("arr", function (parameters) { return lib_meta.construct("array", parameters); });
3039) })(lib_meta || (lib_meta = {}));
3040) var lib_meta;
3041) (function (lib_meta) {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

3042)     /**
3043)      * @author fenris
3044)      */
Christian Fraß update

Christian Fraß authored 6 years ago

3045)     var class_shape_object = (function (_super) {
3046)         __extends(class_shape_object, _super);
3047)         /**
3048)          * @author fenris
3049)          */
3050)         function class_shape_object(_a) {
3051)             var fields = _a["fields"], _b = _a["soft"], soft = _b === void 0 ? true : _b, _c = _a["defaultvalue"], defaultvalue = _c === void 0 ? null : _c;
3052)             var _this = this;
3053)             if (defaultvalue == null) {
3054)                 defaultvalue = {};
3055)                 fields.forEach(function (field) {
3056)                     defaultvalue[field.name] = field.shape.defaultvalue_get();
3057)                 });
3058)             }
3059)             _this = _super.call(this, {
3060)                 "typename": "object",
3061)                 "primitive": false,
3062)                 "soft": soft,
3063)                 "defaultvalue": defaultvalue
3064)             }) || this;
3065)             _this.fields = fields;
3066)             return _this;
3067)         }
3068)         /**
3069)          * @desc [accessor] [getter]
3070)          * @author fenris
3071)          */
3072)         class_shape_object.prototype.fields_get = function () {
3073)             return this.fields;
3074)         };
3075)         /**
3076)          * @override
3077)          * @author fenris
3078)          * @todo check for superfluous fields?
3079)          */
3080)         class_shape_object.prototype.inspect = function (value) {
3081)             var messages = _super.prototype.inspect.call(this, value);
3082)             if (value != null) {
3083)                 this.fields.forEach(function (field, index) {
3084)                     var value_ = value[field.name];
3085)                     messages = messages.concat(field.shape.inspect(value_).map(function (message) { return "object field '" + field.name + "': " + message; }));
3086)                 });
3087)             }
3088)             return messages;
3089)         };
3090)         /**
3091)          * @override
3092)          * @author fenris
3093)          */
3094)         class_shape_object.prototype.to_raw = function () {
3095)             return {
3096)                 "id": "object",
3097)                 "parameters": {
3098)                     "soft": this.soft,
3099)                     "fields": this.fields.map(function (field) {
3100)                         return {
3101)                             "name": field.name,
3102)                             "shape": field.shape.to_raw(),
3103)                             "label": field.label
3104)                         };
3105)                     })
3106)                 }
3107)             };
3108)         };
3109)         /**
3110)          * @desc [implementation]
3111)          * @author fenris
3112)          */
3113)         class_shape_object.prototype._show = function () {
3114)             var str = _super.prototype._show.call(this);
3115)             var str_ = this.fields.map(function (field) { return field.name + ":" + instance_show(field.shape); }).join(",");
3116)             str = str + "<" + str_ + ">";
3117)             return str;
3118)         };
3119)         return class_shape_object;
3120)     }(lib_meta.class_shape_buildin));
3121)     lib_meta.class_shape_object = class_shape_object;
3122)     lib_meta.register("object", function (parameters) {
3123)         var fields_ = lib_object.fetch(parameters, "fields", [], 1);
3124)         return (new class_shape_object({
3125)             "fields": fields_.map(function (field_) {
3126)                 var name = lib_object.fetch(field_, "name", null, 2);
3127)                 var shape_raw = lib_object.fetch(field_, "shape", null, 2);
3128)                 var shape = lib_meta.construct(shape_raw.id, shape_raw.parameters);
3129)                 var label = lib_object.fetch(field_, "label", null, 1);
3130)                 return {
3131)                     "name": name,
3132)                     "shape": shape,
3133)                     "label": label
3134)                 };
3135)             }),
3136)             "soft": parameters["soft"]
3137)         }));
3138)     });
3139)     lib_meta.register("obj", function (parameters) { return lib_meta.construct("object", parameters); });
3140) })(lib_meta || (lib_meta = {}));
3141) var lib_meta;
3142) (function (lib_meta) {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

3143)     /**
3144)      * @author fenris
3145)      */
Christian Fraß update

Christian Fraß authored 6 years ago

3146)     var class_shape_date = (function (_super) {
3147)         __extends(class_shape_date, _super);
3148)         /**
3149)          * @author fenris
3150)          */
3151)         function class_shape_date(_a) {
3152)             var _b = _a["soft"], soft = _b === void 0 ? false : _b, _c = _a["defaultvalue"], defaultvalue = _c === void 0 ? new Date(Date.now()) : _c;
3153)             return _super.call(this, {
3154)                 "primitive": true,
3155)                 "soft": soft,
3156)                 "defaultvalue": defaultvalue
3157)             }) || this;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

3158)         }
Christian Fraß update

Christian Fraß authored 6 years ago

3159)         /**
3160)          * @override
3161)          * @author fenris
3162)          */
3163)         class_shape_date.prototype.inspect = function (value) {
3164)             var messages = _super.prototype.inspect.call(this, value);
3165)             if (value != null) {
3166)                 if (!((typeof (value) == "object") && (value instanceof Date))) {
3167)                     messages.push("value is not a date");
3168)                 }
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

3169)             }
Christian Fraß update

Christian Fraß authored 6 years ago

3170)             return messages;
3171)         };
3172)         /**
3173)          * @override
3174)          * @author fenris
3175)          */
3176)         class_shape_date.prototype.to_raw = function () {
3177)             return {
3178)                 "id": "date",
3179)                 "parameters": {
3180)                     "soft": this.soft
3181)                 }
3182)             };
3183)         };
3184)         /**
3185)          * @desc [implementation]
3186)          * @author fenris
3187)          */
3188)         class_shape_date.prototype._show = function () {
3189)             var str = "date";
3190)             return str;
3191)         };
3192)         return class_shape_date;
3193)     }(lib_meta.class_shape));
3194)     lib_meta.class_shape_date = class_shape_date;
3195)     lib_meta.register("date", function (parameters) {
3196)         return (new class_shape_date({
3197)             "soft": parameters["soft"]
3198)         }));
3199)     });
3200) })(lib_meta || (lib_meta = {}));
3201) var lib_meta;
3202) (function (lib_meta) {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

3203)     /**
3204)      * @author fenris
3205)      */
Christian Fraß update

Christian Fraß authored 6 years ago

3206)     var class_shape_enumeration = (function (_super) {
3207)         __extends(class_shape_enumeration, _super);
3208)         /**
3209)          * @author fenris
3210)          */
3211)         function class_shape_enumeration(_a) {
3212)             var shape_option = _a["shape_option"], options = _a["options"], _b = _a["soft"], soft = _b === void 0 ? false : _b, _c = _a["defaultvalue"], defaultvalue = _c === void 0 ? undefined : _c;
3213)             var _this = this;
3214)             if (defaultvalue === undefined) {
3215)                 if (soft) {
3216)                     defaultvalue = null;
3217)                 }
3218)                 else {
3219)                     if (options.length == 0) {
3220)                         throw (new Error("a hard enumeration must have at least one option"));
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

3221)                     }
3222)                     else {
Christian Fraß update

Christian Fraß authored 6 years ago

3223)                         defaultvalue = options[0].value;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

3224)                     }
3225)                 }
Christian Fraß update

Christian Fraß authored 6 years ago

3226)             }
3227)             _this = _super.call(this, {
3228)                 "primitive": true,
3229)                 "soft": soft,
3230)                 "defaultvalue": defaultvalue
3231)             }) || this;
3232)             _this.shape_option = shape_option;
3233)             _this.options = options;
3234)             return _this;
3235)         }
3236)         /**
3237)          * @desc [accessor] [getter]
3238)          * @author fenris
3239)          */
3240)         class_shape_enumeration.prototype.shape_option_get = function () {
3241)             return this.shape_option;
3242)         };
3243)         /**
3244)          * @desc [accessor] [getter]
3245)          * @author fenris
3246)          */
3247)         class_shape_enumeration.prototype.options_get = function () {
3248)             return this.options;
3249)         };
3250)         /**
3251)          * @override
3252)          * @author fenris
3253)          */
3254)         class_shape_enumeration.prototype.inspect = function (value) {
3255)             var messages = _super.prototype.inspect.call(this, value);
3256)             if (value != null) {
3257)                 if (!this.shape_option.check(value)) {
3258)                     messages.push("value has not the specified option shape");
3259)                 }
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

3260)                 else {
Christian Fraß update

Christian Fraß authored 6 years ago

3261)                     var found = this.options.some(function (option) { return instance_collate(option.value, value); });
3262)                     if (!found) {
3263)                         messages.push("value is not one of the specified options");
3264)                     }
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

3265)                 }
3266)             }
Christian Fraß update

Christian Fraß authored 6 years ago

3267)             return messages;
3268)         };
3269)         /**
3270)          * @override
3271)          * @author fenris
3272)          */
3273)         class_shape_enumeration.prototype.to_raw = function () {
3274)             return {
3275)                 "id": "enumeration",
3276)                 "parameters": {
3277)                     "shape_option": this.shape_option.to_raw(),
3278)                     "options": this.options.map(function (option) {
3279)                         return {
3280)                             "value": option.value,
3281)                             "label": option.label
3282)                         };
3283)                     }),
3284)                     "soft": this.soft
3285)                 }
3286)             };
3287)         };
3288)         /**
3289)          * @desc [implementation]
3290)          * @author fenris
3291)          */
3292)         class_shape_enumeration.prototype._show = function () {
3293)             var str = "enumeration";
3294)             {
3295)                 str = str + "<" + instance_show(this.shape_option) + ">";
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

3296)             }
Christian Fraß update

Christian Fraß authored 6 years ago

3297)             {
3298)                 var str_ = this.options.map(function (option) { return instance_show(option.value); }).join(",");
3299)                 str = str + "[" + str_ + "]";
3300)             }
3301)             return str;
3302)         };
3303)         return class_shape_enumeration;
3304)     }(lib_meta.class_shape));
3305)     lib_meta.class_shape_enumeration = class_shape_enumeration;
3306)     lib_meta.register("enumeration", function (parameters) {
3307)         var shape_option_raw = lib_object.fetch(parameters, "shape_option", null, 2);
3308)         var shape_option = lib_meta.from_raw(shape_option_raw);
3309)         var options = lib_object.fetch(parameters, "options", [], 2);
3310)         return (new class_shape_enumeration({
3311)             "shape_option": shape_option,
3312)             "options": options,
3313)             "soft": parameters["soft"]
3314)         }));
3315)     });
3316) })(lib_meta || (lib_meta = {}));
3317) var lib_meta;
3318) (function (lib_meta) {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

3319)     /**
3320)      * @author fenris
3321)      */
Christian Fraß update

Christian Fraß authored 6 years ago

3322)     var class_shape_map = (function (_super) {
3323)         __extends(class_shape_map, _super);
3324)         /**
3325)          * @author fenris
3326)          */
3327)         function class_shape_map(_a) {
3328)             var shape_key = _a["shape_key"], shape_value = _a["shape_value"], _b = _a["soft"], soft = _b === void 0 ? false : _b, _c = _a["defaultvalue"], defaultvalue = _c === void 0 ? {} : _c;
3329)             var _this = _super.call(this, {
3330)                 "primitive": true,
3331)                 "soft": soft,
3332)                 "defaultvalue": defaultvalue
3333)             }) || this;
3334)             _this.shape_key = shape_key;
3335)             _this.shape_value = shape_value;
3336)             return _this;
3337)         }
3338)         /**
3339)          * @desc [accessor] [getter]
3340)          * @author fenris
3341)          */
3342)         class_shape_map.prototype.shape_key_get = function () {
3343)             return this.shape_key;
3344)         };
3345)         /**
3346)          * @desc [accessor] [getter]
3347)          * @author fenris
3348)          */
3349)         class_shape_map.prototype.shape_value_get = function () {
3350)             return this.shape_value;
3351)         };
3352)         /**
3353)          * @override
3354)          * @author fenris
3355)          */
3356)         class_shape_map.prototype.inspect = function (value) {
3357)             var _this = this;
3358)             var messages = _super.prototype.inspect.call(this, value);
3359)             if (value != null) {
3360)                 if (typeof (value) != "object") {
3361)                     messages.push("value is not an object");
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

3362)                 }
3363)                 else {
Christian Fraß update

Christian Fraß authored 6 years ago

3364)                     Object.keys(value).forEach(function (key, index) {
3365)                         var value_ = value[key];
3366)                         messages = messages.concat(_this.shape_key.inspect(key).map(function (message) { return "map entry #" + index.toString() + " key: " + message; }));
3367)                         messages = messages.concat(_this.shape_value.inspect(value).map(function (message) { return "map entry #" + index.toString() + " value: " + message; }));
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

3368)                     });
3369)                 }
3370)             }
Christian Fraß update

Christian Fraß authored 6 years ago

3371)             return messages;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

3372)         };
Christian Fraß update

Christian Fraß authored 6 years ago

3373)         /**
3374)          * @override
3375)          * @author fenris
3376)          */
3377)         class_shape_map.prototype.to_raw = function () {
3378)             return {
3379)                 "id": "map",
3380)                 "parameters": {
3381)                     "shape_key": this.shape_key.to_raw(),
3382)                     "shape_value": this.shape_value.to_raw(),
3383)                     "soft": this.soft
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

3384)                 }
Christian Fraß update

Christian Fraß authored 6 years ago

3385)             };
3386)         };
3387)         /**
3388)          * @desc [implementation]
3389)          * @author fenris
3390)          */
3391)         class_shape_map.prototype._show = function () {
3392)             var str = "map";
3393)             str += "<" + instance_show(this.shape_key) + "," + instance_show(this.shape_value) + ">";
3394)             return str;
3395)         };
3396)         return class_shape_map;
3397)     }(lib_meta.class_shape));
3398)     lib_meta.class_shape_map = class_shape_map;
3399)     lib_meta.register("map", function (parameters) {
3400)         var shape_key_raw = lib_object.fetch(parameters, "shape_key", null, 2);
3401)         var shape_key = lib_meta.construct(shape_key_raw.id, shape_key_raw.parameters);
3402)         var shape_value_raw = lib_object.fetch(parameters, "shape_value", null, 2);
3403)         var shape_value = lib_meta.from_raw(shape_value_raw);
3404)         return (new class_shape_map({
3405)             "shape_key": shape_key,
3406)             "shape_value": shape_value,
3407)             "soft": parameters["soft"]
3408)         }));
3409)     });
3410) })(lib_meta || (lib_meta = {}));
3411) var lib_meta;
3412) (function (lib_meta) {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

3413)     /**
Christian Fraß update

Christian Fraß authored 6 years ago

3414)      * @author fenris
3415)      * @todo use a treemap-function (but first make one :P)
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

3416)      */
Christian Fraß update

Christian Fraß authored 6 years ago

3417)     function adjust_labels(shape, transformator) {
3418)         if (false) {
3419)         }
3420)         else if (shape instanceof lib_meta.class_shape_enumeration) {
3421)             var shape_ = (shape);
3422)             return (new lib_meta.class_shape_enumeration({
3423)                 "shape_option": adjust_labels(shape_.shape_option_get(), transformator),
3424)                 "options": shape_.options_get().map(function (option) {
3425)                     return {
3426)                         "value": option.value,
3427)                         "label": transformator(option.label)
3428)                     };
3429)                 }),
3430)                 "soft": shape_.soft_get(),
3431)                 "defaultvalue": shape_.defaultvalue_get()
3432)             }));
3433)         }
3434)         else if (shape instanceof lib_meta.class_shape_array) {
3435)             var shape_ = (shape);
3436)             return (new lib_meta.class_shape_array({
3437)                 "shape_element": adjust_labels(shape_.shape_element_get(), transformator),
3438)                 "soft": shape_.soft_get(),
3439)                 "defaultvalue": shape_.defaultvalue_get()
3440)             }));
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

3441)         }
Christian Fraß update

Christian Fraß authored 6 years ago

3442)         else if (shape instanceof lib_meta.class_shape_object) {
3443)             var shape_ = (shape);
3444)             return (new lib_meta.class_shape_object({
3445)                 "fields": shape_.fields_get().map(function (field) {
3446)                     return {
3447)                         "name": field.name,
3448)                         "shape": adjust_labels(field.shape, transformator),
3449)                         "label": transformator(field.label)
3450)                     };
3451)                 }),
3452)                 "soft": shape_.soft_get(),
3453)                 "defaultvalue": shape_.defaultvalue_get()
3454)             }));
3455)         }
3456)         else {
3457)             // shape["label"] = ((shape["label"] == null) ? null : transformator(shape["label"]));
3458)             return shape;
3459)         }
3460)     }
3461)     lib_meta.adjust_labels = adjust_labels;
3462) })(lib_meta || (lib_meta = {}));
3463) var plain_text_to_html = function (text) {
3464)     var ret = text;
3465)     ret = ret.replace(/  /g, "&nbsp;&nbsp;"); // convert multiple whitespace to forced ones
3466)     ret = ret.split("\n").join("<br/>");
3467)     return ret;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

3468) };
3469) /**
Christian Fraß update

Christian Fraß authored 6 years ago

3470)  * @desc makes a valid
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

3471)  */
Christian Fraß update

Christian Fraß authored 6 years ago

3472) var format_sentence = function (str, rtl, caseSense) {
3473)     if (rtl === void 0) { rtl = false; }
3474)     if (caseSense === void 0) { caseSense = true; }
3475)     if (str === "") {
3476)         return str;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

3477)     }
3478)     else {
Christian Fraß update

Christian Fraß authored 6 years ago

3479)         var marks = {
3480)             ".": true,
3481)             "?": true,
3482)             "!": true
3483)         };
3484)         var default_mark = ".";
3485)         var ret = str.split("");
3486)         if (!rtl) {
3487)             ret[0] = ret[0].toLocaleUpperCase();
3488)             if (!(ret[ret.length - 1] in marks)) {
3489)                 ret.push(default_mark);
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

3490)             }
3491)         }
Christian Fraß update

Christian Fraß authored 6 years ago

3492)         else {
3493)             ret[ret.length - 1] = ret[ret.length - 1].toLocaleUpperCase();
3494)             if (!(ret[0] in marks)) {
3495)                 ret.unshift(default_mark);
3496)             }
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

3497)         }
Christian Fraß update

Christian Fraß authored 6 years ago

3498)         return ret.join("");
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

3499)     }
3500) };
Christian Fraß update

Christian Fraß authored 6 years ago

3501) var fill_string_template = function (template_string, object, fabric, delimiter, default_string, sloppy) {
3502)     if (fabric === void 0) { fabric = function (object, key) { return object[key]; }; }
3503)     if (delimiter === void 0) { delimiter = "%"; }
3504)     if (default_string === void 0) { default_string = null; }
3505)     function get_tags(str) {
3506)         var r = new RegExp(delimiter + "[^\\s^" + delimiter + "]+" + delimiter, "gi");
3507)         return ((str.match(r) || []).map(function (e) {
3508)             return e.slice(delimiter.length, e.length - delimiter.length);
3509)         }));
3510)     }
3511)     function replace_tag(str, tag, value) {
3512)         var r = new RegExp(delimiter + tag + delimiter, "gi");
3513)         return str.replace(r, value);
3514)     }
3515)     function replace_tags(str, obj) {
3516)         return (get_tags(str).reduce(function (ret, key) {
3517)             var value = "";
3518)             try {
3519)                 value = fabric(obj, key);
3520)                 if ((!sloppy && (value === void 0)) || (sloppy && (value == void 0))) {
3521)                     value = default_string;
3522)                 }
3523)             }
3524)             catch (e) {
3525)                 console.warn("invalid placeholder " + key);
3526)                 value = default_string;
3527)             }
3528)             return replace_tag(ret, key, value);
3529)         }, str));
3530)     }
3531)     return replace_tags(template_string, object);
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

3532) };
Christian Fraß update

Christian Fraß authored 6 years ago

3533) var make_string_template = function (_template, _fabrics) {
3534)     if (_fabrics === void 0) { _fabrics = {}; }
3535)     function replace_tag(str, tag, value) {
3536)         var r = new RegExp("%" + tag + "%", "gi");
3537)         return str.replace(r, value);
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

3538)     }
Christian Fraß update

Christian Fraß authored 6 years ago

3539)     function replace_tags(str, obj) {
3540)         return (Object.keys(obj).reduce(function (ret, key) {
3541)             return replace_tag(ret, key, _fabrics[key] || obj[key]);
3542)         }, str));
3543)     }
3544)     return (function (tags) {
3545)         return replace_tags(_template, tags);
3546)     });
3547) };
3548) var make_eml_header = (function () {
3549)     var _template = "";
3550)     _template += "From: %from%\n";
3551)     _template += "To: %recipient%\n";
3552)     _template += "Subject: %subject%\n";
3553)     _template += "X-Mailer: greenscale-plankton.emlgen\n";
3554)     return make_string_template(_template);
3555) })();
3556) var make_eml_body = (function () {
3557)     var exports = {};
3558)     exports["simple_body"] = make_string_template("Content-Type: %contenttype%\n\n%body%\n\n");
3559)     // very basic implementation
3560)     // parts = [{contenttype:"text/html; charset=UTF-8", body: "<h1>foo</h1>" }, {...}]
3561)     exports["body_boundrary"] = function (parts, boundrary) {
3562)         var _template = "";
3563)         _template += "--%boundrary%\n";
3564)         _template += "Content-Type: %contenttype%\n\n%body%\n\n";
3565)         //_template += "--%boundrary%--\n\n";
3566)         var maker = make_string_template(_template);
3567)         return (parts.reduce(function (prev, curr) {
3568)             curr.boundrary = boundrary;
3569)             return [prev, maker(curr)].join("");
3570)         }, ""));
3571)     };
3572)     // body must be base64 encoded!
3573)     exports["attachment_boundrary"] = function (parts, boundrary) {
3574)         var _template = "";
3575)         _template += "--%boundrary%\n";
3576)         _template += "Content-Type: %contenttype%\n";
3577)         _template += "Content-Transfer-Encoding: base64\n";
3578)         _template += "Content-Disposition: %disposition%; filename=\"%name%\"\n\n";
3579)         _template += "%body%\n\n";
3580)         //_template += "--%boundrary%--\n\n";
3581)         var maker = make_string_template(_template);
3582)         return (parts.reduce(function (prev, curr) {
3583)             curr.boundrary = boundrary;
3584)             if (curr.disposition === void 0)
3585)                 curr.disposition = "inline";
3586)             return [prev, maker(curr)].join("");
3587)         }, ""));
3588)     };
3589)     exports["gen_boundrary"] = function () {
3590)         return ("xxxxxxxxxxxxxxxxxxxxxx".replace(/[xy]/g, function (c) {
3591)             var r = crypto.getRandomValues(new Uint8Array(1))[0] % 16 | 0, v = c == "x" ? r : (r & 0x3 | 0x8);
3592)             return v.toString(16);
3593)         }));
3594)     };
3595)     // simple implementation without alternatives (old rfc)
3596)     exports["complete_boundrary"] = function (bodyparts, attachments) {
3597)         var ret = "";
3598)         var boundrary = exports["gen_boundrary"]();
3599)         ret += exports["body_boundrary"](bodyparts, boundrary);
3600)         ret += exports["attachment_boundrary"](attachments, boundrary);
3601)         ret += "--" + boundrary + "--\n\nINVISIBLE!!!!";
3602)         return (exports["simple_body"]({
3603)             "contenttype": sprintf("multipart/mixed; boundary=%s", [boundrary]),
3604)             "body": ret
3605)         }));
3606)     };
3607)     return exports;
3608) })();
3609) ///<reference path="../../base/build/logic-decl.d.ts"/>
3610) var lib_string;
3611) (function (lib_string) {
3612)     /**
3613)      * @author frac
3614)      */
3615)     var hexdigits = 4;
3616)     /**
3617)      * @author frac
3618)      */
3619)     var index_max = 1 << (4 * hexdigits);
3620)     /**
3621)      * @author frac
3622)      */
3623)     var index_is = 0;
3624)     /**
3625)      * @author neuc,frac
3626)      */
3627)     function empty(str) {
3628)         var tmp = str.trim();
3629)         return (tmp === "");
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

3630)     }
Christian Fraß update

Christian Fraß authored 6 years ago

3631)     lib_string.empty = empty;
3632)     /**
3633)      * @desc returns a unique string
3634)      * @param {string} prefix an optional prefix for the generated string
3635)      * @return {string}
3636)      * @author frac
3637)      */
3638)     function generate(prefix) {
3639)         if (prefix === void 0) { prefix = "string_"; }
3640)         if (index_is > index_max) {
3641)             throw (new Error("[string_generate] out of valid indices"));
3642)         }
3643)         else {
3644)             return lib_string.sprintf(prefix + "%0" + hexdigits.toString() + "X", [index_is++]);
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

3645)         }
3646)     }
Christian Fraß update

Christian Fraß authored 6 years ago

3647)     lib_string.generate = generate;
3648)     /**
3649)      * @desc splits a string, but returns an empty list, if the string is empty
3650)      * @param {string} chain
3651)      * @param {string} separator
3652)      * @return {Array<string>}
3653)      * @author frac
3654)      */
3655)     function split(chain, separator) {
3656)         if (separator === void 0) { separator = " "; }
3657)         if (chain.length == 0) {
3658)             return [];
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

3659)         }
Christian Fraß update

Christian Fraß authored 6 years ago

3660)         else {
3661)             return chain.split(separator);
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

3662)         }
Christian Fraß update

Christian Fraß authored 6 years ago

3663)     }
3664)     lib_string.split = split;
3665)     /**
3666)      * @desc concats a given word with itself n times
3667)      * @param {string} word
3668)      * @param {int}
3669)      * @return {string}
3670)      * @author frac
3671)      */
3672)     function repeat(word, count) {
3673)         return ((count == 0) ? "" : (word + repeat(word, count - 1)));
3674)     }
3675)     lib_string.repeat = repeat;
3676)     /**
3677)      * @desc lengthens a string by repeatedly appending or prepending another string
3678)      * @param {string} word the string to pad
3679)      * @param {int} length the length, which the result shall have
3680)      * @param {string} symbol the string, which will be added (multiple times)
3681)      * @param {boolean} [prepend]; whether to prepend (~true) or append (~false); default: false
3682)      * @return {string} the padded string
3683)      * @author frac
3684)      */
3685)     function pad(word, length, symbol, prepend) {
3686)         if (prepend === void 0) { prepend = false; }
3687)         if (prepend) {
3688)             while (word.length < length)
3689)                 word = symbol + word;
3690)             return word.substring(word.length - length);
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

3691)         }
3692)         else {
Christian Fraß update

Christian Fraß authored 6 years ago

3693)             while (word.length < length)
3694)                 word = word + symbol;
3695)             return word.substring(0, length);
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

3696)         }
Christian Fraß update

Christian Fraß authored 6 years ago

3697)     }
3698)     lib_string.pad = pad;
3699)     /**
3700)      * @desc checks if a given string conttains a certain substring
3701)      * @param {string} string
3702)      * @param {string} part
3703)      * @return {boolean}
3704)      * @author frac
3705)      */
3706)     function contains(chain, part) {
3707)         if (typeof (chain) !== "string")
3708)             return false;
3709)         return (chain.indexOf(part) >= 0);
3710)     }
3711)     lib_string.contains = contains;
3712)     /**
3713)      * @desc checks if a given string starts with a certain substring
3714)      * @param {string} string
3715)      * @param {string} part
3716)      * @return {boolean}
3717)      * @author frac
3718)      */
3719)     function startsWith(chain, part) {
3720)         if (typeof (chain) !== "string")
3721)             return false;
3722)         // return (string.indexOf(part) === 0);
3723)         return ((function (m, n) {
3724)             if (n == 0) {
3725)                 return true;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

3726)             }
3727)             else {
Christian Fraß update

Christian Fraß authored 6 years ago

3728)                 if (m == 0) {
3729)                     return false;
3730)                 }
3731)                 else {
3732)                     return ((chain[0] == part[0]) && startsWith(chain.substring(1), part.substring(1)));
3733)                 }
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

3734)             }
Christian Fraß update

Christian Fraß authored 6 years ago

3735)         })(chain.length, part.length));
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

3736)     }
Christian Fraß update

Christian Fraß authored 6 years ago

3737)     lib_string.startsWith = startsWith;
3738)     /**
3739)      * @desc checks if a given string ends with a certain substring
3740)      * @param {string} string
3741)      * @param {string} part
3742)      * @return {boolean}
3743)      * @author frac
3744)      */
3745)     function endsWith(chain, part) {
3746)         if (typeof (chain) !== "string")
3747)             return false;
3748)         // return (string.lastIndexOf(part) === string.length-part.length);
3749)         return ((function (m, n) {
3750)             if (n == 0) {
3751)                 return true;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

3752)             }
3753)             else {
Christian Fraß update

Christian Fraß authored 6 years ago

3754)                 if (m == 0) {
3755)                     return false;
3756)                 }
3757)                 else {
3758)                     // console.info(("(" + string[m-1] + " == " + part[n-1] + ")") + " = " + String(string[m-1] == part[n-1]));
3759)                     return ((chain[m - 1] == part[n - 1]) && endsWith(chain.substring(0, m - 1), part.substring(0, n - 1)));
3760)                 }
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

3761)             }
Christian Fraß update

Christian Fraß authored 6 years ago

3762)         })(chain.length, part.length));
3763)     }
3764)     lib_string.endsWith = endsWith;
3765)     /**
3766)      * @desc count the occourrences of a string in a string
3767)      * @param string haystack_string the string wich should be examined
3768)      * @param string needle_string the string which should be counted
3769)      * @author neuc
3770)      */
3771)     function count_occourrences(haystack_string, needle_string, check_escape) {
3772)         var cnt = 0;
3773)         var pos = -1;
3774)         do {
3775)             pos = haystack_string.indexOf(needle_string, pos + 1);
3776)             if ((!check_escape) || (haystack_string[pos - 1] != "\\")) {
3777)                 cnt++;
3778)             }
3779)         } while (pos >= 0);
3780)         return cnt - 1;
3781)     }
3782)     lib_string.count_occourrences = count_occourrences;
3783)     ;
3784)     /**
3785)      * @author fenris
3786)      */
3787)     function stance(str, args) {
3788)         Object.keys(args).forEach(function (key) {
3789)             var value = args[key];
3790)             var regexp_argument = new RegExp("\\${" + key + "}");
3791)             str = str.replace(regexp_argument, value);
3792)         });
3793)         return str;
3794)     }
3795)     lib_string.stance = stance;
3796) })(lib_string || (lib_string = {}));
3797) /**
3798)  * @desc adapters for old syntax
3799)  */
3800) var string_generate = lib_string.generate;
3801) var string_split = lib_string.split;
3802) var string_repeat = lib_string.repeat;
3803) var string_pad = lib_string.pad;
3804) var string_contains = lib_string.contains;
3805) var string_startsWith = lib_string.startsWith;
3806) var string_endsWith = lib_string.endsWith;
3807) var string_count_occourrences = lib_string.count_occourrences;
3808) var lib_string;
3809) (function (lib_string) {
3810)     var pattern = /%([-+#0 ]*)([0-9]*)[\.]{0,1}([0-9]*)([\w]{1})/;
3811)     var gpattern = /%([-+#0 ]*)([0-9]*)[\.]{0,1}([0-9]*)([\w]{1})/g;
3812)     function split_format(format) {
3813)         var tmp = format.match(pattern);
3814)         if (tmp === null)
3815)             return null;
3816)         return {
3817)             'flags': tmp[1].split(""),
3818)             'width': Number(tmp[2]),
3819)             'precision': tmp[3] === '' ? null : Number(tmp[3]),
3820)             'specifier': tmp[4],
3821)             'string': format
3822)         };
3823)     }
3824)     function make_err(format, arg, should) {
3825)         return ("[sprintf]" + " " + "argument for '" + format.string + "' has to be '" + should + "' but '" + arg + "' is '" + typeof arg + "'!");
3826)     }
3827)     function test_arg(format, arg, should) {
3828)         if (typeof arg !== should) {
3829)             console.warn(make_err(format, arg, should));
3830)             return false;
3831)         }
3832)         return true;
3833)     }
3834)     function string_fill(str, char, len, left) {
3835)         while (str.length < len) {
3836)             if (left) {
3837)                 str += char;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

3838)             }
3839)             else {
Christian Fraß update

Christian Fraß authored 6 years ago

3840)                 str = char + str;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

3841)             }
3842)         }
Christian Fraß update

Christian Fraß authored 6 years ago

3843)         return str;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

3844)     }
Christian Fraß update

Christian Fraß authored 6 years ago

3845)     /**
3846)      * the known_parameters are used to parse the different identifiers for the welln known syntax:
3847)      *          flag   width   precision   identifier
3848)      *      %{[0#+- ]}{[0-9]*}.{[0-9]*}[fFdiueEgGsoxXaAsn]
3849)      * flags:
3850)      * 0    -   fill with '0' instead of ' ' if the string length < width
3851)      * #    -   not implemented
3852)      * -    -   left-justified -> fill on the right side to reach width
3853)      * +    -   force using '+' on positive numbers
3854)      * ' '  -   add a single space before positive numbers
3855)      *
3856)      * identifiers
3857)      * %f, %F       -   interpret given number as float, width: the minimal total width (fill with ' ' or '0' if the
3858)      *                  resulting string is too short, precision: cut more then given decimal places
3859)      * %d, %i, %u   -   interpret number as integer, decimal places will be cut. width: like float, precision:
3860)      *                  fill with '0' on right side until length given in precision is reached
3861)      * %e           -   interpret as float and write as scientifical number, width & precision like in float
3862)      * %E           -   same es %e but uppercase 'E'
3863)      * %g           -   use the shortest string of %f or %e
3864)      * %G           -   use the shortest string of %E or %E
3865)      * %s           -   simply print a string
3866)      * %o           -   print the given number in octal notation
3867)      * %x           -   print the given number in hex notation
3868)      * %X           -   same as %x but with uppercase characters
3869)      * %a           -   alias to %x
3870)      * %A           -   alias to %X
3871)      * %n           -   just print nothing
3872)      * @type {{}}
3873)      */
3874)     var known_params = {};
3875)     known_params["f"] = function (format, arg) {
3876)         if (!test_arg(format, arg, "number"))
3877)             return "Ø";
3878)         var tmp = Math.abs(arg);
3879)         var sign = (arg < 0) ? -1 : 1;
3880)         var tmp_result = null;
3881)         if (format.precision !== null) {
3882)             tmp = Math.floor(Math.pow(10, format.precision) * tmp) / Math.pow(10, format.precision);
3883)             var tmp_ = (tmp * sign).toString().split(".");
3884)             if (tmp_.length === 1)
3885)                 tmp_.push("");
3886)             tmp_[1] = string_fill(tmp_[1], "0", format.precision, true);
3887)             tmp_result = tmp_.join(".");
3888)         }
3889)         else {
3890)             tmp_result = (sign * tmp).toString();
3891)         }
3892)         if ((format.flags.indexOf(" ") >= 0) && (arg >= 0)) {
3893)             tmp_result = " " + tmp;
3894)         }
3895)         else if ((format.flags.indexOf("+") >= 0) && (arg >= 0)) {
3896)             tmp_result = "+" + tmp;
3897)         }
3898)         tmp_result = string_fill(tmp, (format.flags.indexOf("0") >= 0) ? "0" : " ", format.width, (format.flags.indexOf("-") >= 0));
3899)         return tmp_result;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

3900)     };
Christian Fraß update

Christian Fraß authored 6 years ago

3901)     known_params["F"] = known_params["f"];
3902)     known_params["d"] = function (format, arg) {
3903)         if (!test_arg(format, arg, 'number'))
3904)             return 'Ø';
3905)         var tmp = (((arg < 0 && format.specifier !== 'u') ? -1 : 1) * Math.floor(Math.abs(arg))).toString();
3906)         if ((format.specifier === 'd' || format.specifier === 'i') && format.flags.indexOf(' ') >= 0 && arg >= 0) {
3907)             tmp = ' ' + tmp;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

3908)         }
Christian Fraß update

Christian Fraß authored 6 years ago

3909)         else if ((format.specifier === 'd' || format.specifier === 'i') && format.flags.indexOf('+') >= 0 && arg >= 0) {
3910)             tmp = '+' + tmp;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

3911)         }
Christian Fraß update

Christian Fraß authored 6 years ago

3912)         tmp = string_fill(tmp, format.flags.indexOf('0') >= 0 ? '0' : ' ', format.width, format.flags.indexOf('-') >= 0);
3913)         tmp = string_fill(tmp, '0', format.precision === null ? 0 : format.precision, false);
3914)         return tmp;
3915)     };
3916)     known_params["i"] = known_params["d"];
3917)     known_params["u"] = known_params["d"];
3918)     known_params["e"] = function (format, arg) {
3919)         if (!test_arg(format, arg, 'number'))
3920)             return 'Ø';
3921)         var tmp = arg.toExponential(format.precision === null ? undefined : format.precision).toString();
3922)         if (format.flags.indexOf(' ') >= 0 && arg >= 0) {
3923)             tmp = ' ' + tmp;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

3924)         }
Christian Fraß update

Christian Fraß authored 6 years ago

3925)         else if (format.flags.indexOf('+') >= 0 && arg >= 0) {
3926)             tmp = '+' + tmp;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

3927)         }
Christian Fraß update

Christian Fraß authored 6 years ago

3928)         tmp = string_fill(tmp, format.flags.indexOf('0') >= 0 ? '0' : ' ', format.width, format.flags.indexOf('-') >= 0);
3929)         return tmp;
3930)     };
3931)     known_params["E"] = function (format, arg) {
3932)         return known_params["e"](format, arg).toUpperCase();
3933)     };
3934)     known_params["g"] = function (format, arg) {
3935)         if (!test_arg(format, arg, 'number'))
3936)             return 'Ø';
3937)         var tmpf = known_params["f"](format, arg);
3938)         var tmpe = known_params["e"](format, arg);
3939)         if (tmpf.length < tmpe.length) {
3940)             return tmpf;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

3941)         }
3942)         else {
Christian Fraß update

Christian Fraß authored 6 years ago

3943)             return tmpe;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

3944)         }
Christian Fraß update

Christian Fraß authored 6 years ago

3945)     };
3946)     known_params["G"] = function (format, arg) {
3947)         return known_params["g"](format, arg).toUpperCase();
3948)     };
3949)     known_params["s"] = function (format, arg) {
3950)         if (!test_arg(format, arg, 'string'))
3951)             return 'o.O';
3952)         var tmp = format.precision !== null ? arg.substr(0, format.precision) : arg;
3953)         tmp = string_fill(tmp, format.flags.indexOf('0') >= 0 ? '0' : ' ', format.width, format.flags.indexOf('-') >= 0);
3954)         return tmp;
3955)     };
3956)     known_params["o"] = function (format, arg) {
3957)         if (!test_arg(format, arg, 'number'))
3958)             return 'Ø';
3959)         var tmp = Math.floor(Math.round(Math.abs(arg))) * ((arg < 0) ? -1 : 1);
3960)         return known_params["s"](format, tmp.toString(8));
3961)     };
3962)     known_params["x"] = function (format, arg) {
3963)         if (!test_arg(format, arg, 'number'))
3964)             return 'Ø';
3965)         var tmp = Math.floor(Math.round(Math.abs(arg))) * ((arg < 0) ? -1 : 1);
3966)         return known_params["s"](format, tmp.toString(16));
3967)     };
3968)     known_params["a"] = known_params["x"];
3969)     known_params["X"] = function (format, arg) {
3970)         if (!test_arg(format, arg, 'number'))
3971)             return 'Ø';
3972)         return known_params["x"](format, arg).toUpperCase();
3973)     };
3974)     known_params["A"] = known_params["X"];
3975)     known_params["c"] = function (format, arg) {
3976)         var tmp = "";
3977)         if (typeof arg === "number") {
3978)             tmp = String.fromCharCode(arg);
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

3979)         }
Christian Fraß update

Christian Fraß authored 6 years ago

3980)         else if ((typeof arg === "string") && (arg.length === 1)) {
3981)             tmp = arg[0];
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

3982)         }
Christian Fraß update

Christian Fraß authored 6 years ago

3983)         else {
3984)             console.warn(make_err(format, arg, "number|string") + " and if string it needs to have the length of 1!");
3985)         }
3986)         return known_params["s"](format, tmp);
3987)     };
3988)     known_params["n"] = function () {
3989)         return "";
3990)     };
3991)     var decompose = function (chain, regexp) {
3992)         var result = regexp.exec(chain);
3993)         if (result == null) {
3994)             return null;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

3995)         }
3996)         else {
Christian Fraß update

Christian Fraß authored 6 years ago

3997)             var front = chain.substring(0, result.index);
3998)             var back = chain.substring(result.index + result[0].length);
3999)             return { "front": front, "match": result[0], "back": back };
4000)         }
4001)     };
4002)     /**
4003)      * an implementation of c sprintf
4004)      * @param {string} string format string
4005)      * @param {array} args arguments which should be filled into
4006)      * @returns {string}
4007)      */
4008)     lib_string.sprintf = function (input, args, original) {
4009)         if (args === void 0) { args = []; }
4010)         if (original === void 0) { original = null; }
4011)         if (original == null)
4012)             original = input;
4013)         var components = decompose(input, pattern);
4014)         if (components == null) {
4015)             if (args.length > 0) {
4016)                 console.warn("[sprintf] superfluous arguments while formatting '" + original + "': ", args);
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4017)             }
Christian Fraß update

Christian Fraß authored 6 years ago

4018)             return input;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4019)         }
Christian Fraß update

Christian Fraß authored 6 years ago

4020)         else {
4021)             var arg;
4022)             var rest;
4023)             if (args.length > 0) {
4024)                 arg = args[0];
4025)                 rest = args.slice(1);
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4026)             }
4027)             else {
Christian Fraß update

Christian Fraß authored 6 years ago

4028)                 console.warn("[sprintf] out of arguments while formatting '" + original + "'");
4029)                 arg = null;
4030)                 rest = [];
4031)                 return input;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4032)             }
Christian Fraß update

Christian Fraß authored 6 years ago

4033)             var fmt = split_format(components["match"]);
4034)             return (components["front"]
4035)                 + known_params[fmt.specifier](fmt, arg)
4036)                 + lib_string.sprintf(components["back"], rest, original));
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4037)         }
Christian Fraß update

Christian Fraß authored 6 years ago

4038)     };
4039)     /**
4040)      * an implementation of c printf
4041)      * @param {string} string format string
4042)      * @param {array} args arguments which should be filled into
4043)      * @returns {string}
4044)      */
4045)     function printf(format, args) {
4046)         console.log(lib_string.sprintf(format, args));
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4047)     }
Christian Fraß update

Christian Fraß authored 6 years ago

4048)     lib_string.printf = printf;
4049) })(lib_string || (lib_string = {}));
4050) var sprintf = lib_string.sprintf;
4051) var printf = lib_string.printf;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4052) /**
Christian Fraß update

Christian Fraß authored 6 years ago

4053)  * @author neuc
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4054)  */
Christian Fraß update

Christian Fraß authored 6 years ago

4055) var strftime;
4056) (function (strftime) {
4057)     var currentDate = new Date();
4058)     var days = [
4059)         "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"
4060)     ];
4061)     var months = [
4062)         "January", "February", "March", "April", "May", "June", "July", "August", "September",
4063)         "October", "November", "December"
4064)     ];
4065)     function set_days(day_names) {
4066)         days = day_names;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4067)     }
Christian Fraß update

Christian Fraß authored 6 years ago

4068)     strftime.set_days = set_days;
4069)     function set_months(month_names) {
4070)         months = month_names;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4071)     }
Christian Fraß update

Christian Fraß authored 6 years ago

4072)     strftime.set_months = set_months;
4073)     // source: https://stackoverflow.com/questions/8619879/javascript-calculate-the-day-of-the-year-1-366
4074)     function helper_dayOfYear(date) {
4075)         var start = new Date(date.getFullYear(), 0, 0);
4076)         var diff = date - start;
4077)         var oneDay = 1000 * 60 * 60 * 24;
4078)         return Math.floor(diff / oneDay);
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4079)     }
Christian Fraß update

Christian Fraß authored 6 years ago

4080)     // source: http://weeknumber.net/how-to/javascript
4081)     function helper_weekOfYear(date_) {
4082)         var date = new Date(date_.getTime());
4083)         date.setHours(0, 0, 0, 0);
4084)         // Thursday in current week decides the year.
4085)         date.setDate(date.getDate() + 3 - (date.getDay() + 6) % 7);
4086)         // January 4 is always in week 1.
4087)         var week1 = new Date(date.getFullYear(), 0, 4);
4088)         // Adjust to Thursday in week 1 and count number of weeks from date to week1.
4089)         return 1 + Math.round(((date.getTime() - week1.getTime()) / 86400000
4090)             - 3 + (week1.getDay() + 6) % 7) / 7);
4091)     }
4092)     function helper_englishWeekOfYear(date) {
4093)         var nr = helper_weekOfYear(date);
4094)         if (date.getDay() === 0) {
4095)             nr = nr - 1;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4096)         }
Christian Fraß update

Christian Fraß authored 6 years ago

4097)         return nr;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4098)     }
Christian Fraß update

Christian Fraß authored 6 years ago

4099)     function set_currentDate(date) {
4100)         currentDate = date;
4101)     }
4102)     strftime.set_currentDate = set_currentDate;
4103)     function parse(format, date) {
4104)         if (!date) {
4105)             date = currentDate;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4106)         }
Christian Fraß update

Christian Fraß authored 6 years ago

4107)         var ret = format;
4108)         var re = new RegExp("%[a-z]", "gi");
4109)         var match;
4110)         while (match = re.exec(format)) {
4111)             ret = ret.replace(match[0], parse_segment(match[0], date));
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4112)         }
Christian Fraß update

Christian Fraß authored 6 years ago

4113)         return ret;
4114)     }
4115)     strftime.parse = parse;
4116)     function parse_segment(segment, date) {
4117)         if (!date) {
4118)             date = currentDate;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4119)         }
Christian Fraß update

Christian Fraß authored 6 years ago

4120)         var hm_segments = {
4121)             "%a": function () { return days[date.getDay()].slice(0, 3); },
4122)             "%A": function () { return days[date.getDay()]; },
4123)             "%b": function () { return days[date.getMonth()].slice(0, 3); },
4124)             "%B": function () { return days[date.getMonth()]; },
4125)             "%c": function () { return date.toLocaleString(); },
4126)             "%C": function () { return Math.floor((date.getFullYear()) / 100).toString(); },
4127)             "%d": function () { return sprintf("%02d", [date.getDate()]); },
4128)             "%D": function () { return parse("%m/%d/%y", date); },
4129)             "%e": function () { return sprintf("%2d", [date.getDate()]); },
4130)             "%F": function () { return parse("%Y-%m-%d", date); },
4131)             "%g": function () { return sprintf("%02d", [date.getFullYear() % 1000]); },
4132)             "%G": function () { return date.getFullYear().toString(); },
4133)             "%h": function () { return parse("%b", date); },
4134)             "%H": function () { return sprintf("%02d", [date.getHours()]); },
4135)             "%I": function () {
4136)                 return sprintf("%02d", [
4137)                     (date.getHours() > 12 ? date.getHours() - 12 : date.getHours())
4138)                 ]);
4139)             },
4140)             "%j": function () { return sprintf("%03d", [helper_dayOfYear(date)]); },
4141)             "%m": function () { return sprintf("%02d", [date.getMonth() + 1]); },
4142)             "%M": function () { return sprintf("%02d", [date.getMinutes()]); },
4143)             "%n": function () { return "\n"; },
4144)             "%p": function () { return (date.getHours() > 12 ? "PM" : "AM"); },
4145)             "%r": function () { return parse("%I:%M:%S %p", date); },
4146)             "%R": function () { return parse("%H:%M", date); },
4147)             "%S": function () { return date.getSeconds().toString(); },
4148)             "%t": function () { return "\t"; },
4149)             "%T": function () { return parse("%H:%M:%S", date); },
4150)             "%u": function () { return sprintf("%02d", [(date.getDay() === 0 ? 7 : date.getDay())]); },
4151)             "%U": function () { return sprintf("%02d", [helper_englishWeekOfYear(date)]); },
4152)             "%V": function () { return sprintf("%02d", [helper_weekOfYear(date)]); },
4153)             "%w": function () { return sprintf("%02d", [date.getDay().toString()]); },
4154)             "%W": function () { return parse("%w", date); },
4155)             "%x": function () { return parse("%m/%d/%G", date); },
4156)             "%X": function () { return parse("%T", date); },
4157)             "%y": function () { return parse("%g", date); },
4158)             "%Y": function () { return parse("%G", date); },
4159)             "%z": function () { return date.getTimezoneOffset().toString(); },
4160)             "%Z": function () { return date.toUTCString().split(' ').pop(); },
4161)             "%%": function () { return "%"; }
4162)         };
4163)         if (!(segment in hm_segments)) {
4164)             throw "unknown format argument '" + segment + "'";
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4165)         }
Christian Fraß update

Christian Fraß authored 6 years ago

4166)         return hm_segments[segment]();
4167)     }
4168) })(strftime || (strftime = {}));
4169) function locale_date(date, ignore_error) {
4170)     if (date === void 0) { date = new Date(); }
4171)     if (ignore_error === void 0) { ignore_error = false; }
4172)     if (!(date instanceof Date)) {
4173)         if (!ignore_error) {
4174)             throw new SyntaxError("date must be instance of Date");
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4175)         }
Christian Fraß update

Christian Fraß authored 6 years ago

4176)         else {
4177)             console.warn("'" + date + "' seems not to be instance of Date try to force convert.");
4178)             var tmp = date;
4179)             date = new Date(tmp);
4180)             if ((date.toString() === "Invalid Date") ||
4181)                 (!(date < new Date(0)) && !(date > new Date(0)))) {
4182)                 console.warn("conversion didn't work, returning default value");
4183)                 return "Ø";
4184)             }
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4185)         }
Christian Fraß update

Christian Fraß authored 6 years ago

4186)     }
4187)     var conf = global_config.get_value("date") || {
4188)         "use_locale_date": true,
4189)         "format_string": "%d.%m.%Y"
4190)     };
4191)     if (conf.use_locale_date) {
4192)         return date.toLocaleDateString();
4193)     }
4194)     else {
4195)         return strftime.parse(conf.format_string, date);
4196)     }
4197) }
4198) ;
4199) var make_logger = (function () {
4200)     var _loggers = {};
4201)     var make_logger = function (prefix, current_loglevel) {
4202)         var log = [];
4203)         var level = [
4204)             "LOG", "INFO", "WARNING", "DEBUG"
4205)         ];
4206)         var logger = function (obj, lvl) {
4207)             var txt = obj.txt || obj;
4208)             if (lvl == void 0)
4209)                 lvl = 0;
4210)             var date = new Date();
4211)             log.push({
4212)                 "message": sprintf("%s [%s:%s] %s", [date.toString(), level[lvl], prefix, txt]),
4213)                 "timeStamp": +(date)
4214)             });
4215)             if (lvl <= current_loglevel) {
4216)                 var msg = ["[" + prefix + "]", txt];
4217)                 if (obj.arg)
4218)                     msg = ["[" + prefix + "]"].concat(Array.prototype.slice.call(obj.arg));
4219)                 if (lvl === 0)
4220)                     console["_log"].apply(console, msg);
4221)                 else if (lvl === 1)
4222)                     console["_info"].apply(console, msg);
4223)                 else if (lvl === 2)
4224)                     console["_warn"].apply(console, msg);
4225)                 else if (lvl >= 3)
4226)                     console["_log"].apply(console, msg);
4227)             }
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4228)         };
Christian Fraß update

Christian Fraß authored 6 years ago

4229)         _loggers[prefix] = {
4230)             "logger": logger,
4231)             "log": log
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4232)         };
Christian Fraß update

Christian Fraß authored 6 years ago

4233)         return logger;
4234)     };
4235)     make_logger["loggers"] = _loggers;
4236)     make_logger["complete_log"] = function () {
4237)         var logs = Object.keys(_loggers)
4238)             .reduce(function (p, c) {
4239)             return [].concat(p, _loggers[c].log);
4240)         }, []);
4241)         logs.sort(function (x, y) {
4242)             return ((x.timeStamp > y.timeStamp) ? -1 : +1);
4243)         });
4244)         return logs.map(function (x, i, a) {
4245)             return x.message;
4246)         });
4247)     };
4248)     if (true) {
4249)         var _log_all = function (log, lvl, next) {
4250)             if (next === void 0) { next = function () { }; }
4251)             return function () {
4252)                 var msg = [];
4253)                 for (var i = 0; i < arguments.length; i++) {
4254)                     if (typeof arguments[i] === "string") {
4255)                         msg.push(arguments[i]);
4256)                     }
4257)                     else {
4258)                         msg.push(JSON.stringify(arguments[i]));
4259)                     }
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4260)                 }
Christian Fraß update

Christian Fraß authored 6 years ago

4261)                 var obj = {
4262)                     txt: msg.join("\t"),
4263)                     arg: arguments
4264)                 };
4265)                 log(obj, lvl);
4266)                 next();
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4267)             };
4268)         };
Christian Fraß update

Christian Fraß authored 6 years ago

4269)         {
4270)             var __warn = make_logger("deprecated console.warn", 99);
4271)             var __error = make_logger("deprecated console.error", 99);
4272)             var __log = make_logger("deprecated console.log", 99);
4273)             var __info = make_logger("deprecated console.info", 99);
4274)             // bad ass
4275)             console["_log"] = console.log;
4276)             console["_error"] = console.error;
4277)             console["_warn"] = console.warn;
4278)             console["_info"] = console.info;
4279)             /*
4280)             console["log"] = _log_all(__log, 0);
4281)             console["error"] = _log_all(__error, 2);
4282)             console["warn"] = _log_all(__warn, 2);
4283)             console["info"] = _log_all(__info, 0);
4284)              */
4285)         }
4286)         /*
4287)         {
4288)             make_logger["send_log"] = function(){
4289)                 eml_log(
4290)                     function () {
4291)                         alert("fehlerbericht wurde gesendet!");
4292)                     }
4293)                 );
4294)             };
4295)             var error_log = make_logger("global.error", 99);
4296)             window.onerror = _log_all(
4297)                 error_log,
4298)                 1,
4299)                 function(){
4300)                     if (global_config == undefined) {
4301)                         return false;
4302)                     }
4303)                     if (global_config.report_error) {
4304)                         make_logger["send_log"]();
4305)                     }
4306)                 }
4307)             );
4308)         }
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4309)          */
Christian Fraß update

Christian Fraß authored 6 years ago

4310)     }
4311)     return make_logger;
4312) })();
4313) var __extends = (this && this.__extends) || (function () {
4314)     var extendStatics = Object.setPrototypeOf ||
4315)         ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
4316)         function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
4317)     return function (d, b) {
4318)         extendStatics(d, b);
4319)         function __() { this.constructor = d; }
4320)         d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
4321)     };
4322) })();
4323) ///<reference path="../../base/build/logic-decl.d.ts"/>
4324) ///<reference path="../../string/build/logic-decl.d.ts"/>
4325) /**
4326)  * @author fenris
4327)  */
4328) var lib_xml;
4329) (function (lib_xml) {
4330)     /**
4331)      * @author fenris
4332)      */
4333)     var class_node = (function () {
4334)         function class_node() {
4335)         }
4336)         return class_node;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4337)     }());
Christian Fraß update

Christian Fraß authored 6 years ago

4338)     lib_xml.class_node = class_node;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4339)     /**
Christian Fraß update

Christian Fraß authored 6 years ago

4340)      * @author fenris
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4341)      */
Christian Fraß update

Christian Fraß authored 6 years ago

4342)     var class_node_text = (function (_super) {
4343)         __extends(class_node_text, _super);
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4344)         /**
Christian Fraß update

Christian Fraß authored 6 years ago

4345)          * @author fenris
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4346)          */
Christian Fraß update

Christian Fraß authored 6 years ago

4347)         function class_node_text(content) {
4348)             var _this = _super.call(this) || this;
4349)             _this.content = content;
4350)             return _this;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4351)         }
4352)         /**
Christian Fraß update

Christian Fraß authored 6 years ago

4353)          * @author fenris
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4354)          */
Christian Fraß update

Christian Fraß authored 6 years ago

4355)         class_node_text.prototype.compile = function (depth) {
4356)             if (depth === void 0) { depth = 0; }
4357)             return (lib_string.repeat("\t", depth) + this.content + "\n");
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4358)         };
Christian Fraß update

Christian Fraß authored 6 years ago

4359)         return class_node_text;
4360)     }(class_node));
4361)     lib_xml.class_node_text = class_node_text;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4362)     /**
Christian Fraß update

Christian Fraß authored 6 years ago

4363)      * @author fenris
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4364)      */
Christian Fraß update

Christian Fraß authored 6 years ago

4365)     var class_node_comment = (function (_super) {
4366)         __extends(class_node_comment, _super);
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4367)         /**
Christian Fraß update

Christian Fraß authored 6 years ago

4368)          * @author fenris
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4369)          */
Christian Fraß update

Christian Fraß authored 6 years ago

4370)         function class_node_comment(content) {
4371)             var _this = _super.call(this) || this;
4372)             _this.content = content;
4373)             return _this;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4374)         }
4375)         /**
Christian Fraß update

Christian Fraß authored 6 years ago

4376)          * @author fenris
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4377)          */
Christian Fraß update

Christian Fraß authored 6 years ago

4378)         class_node_comment.prototype.compile = function (depth) {
4379)             if (depth === void 0) { depth = 0; }
4380)             return (lib_string.repeat("\t", depth) + "<!-- " + this.content + " -->" + "\n");
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4381)         };
Christian Fraß update

Christian Fraß authored 6 years ago

4382)         return class_node_comment;
4383)     }(class_node));
4384)     lib_xml.class_node_comment = class_node_comment;
4385)     /**
4386)      * @author fenris
4387)      */
4388)     var class_node_complex = (function (_super) {
4389)         __extends(class_node_complex, _super);
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4390)         /**
Christian Fraß update

Christian Fraß authored 6 years ago

4391)          * @author fenris
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4392)          */
Christian Fraß update

Christian Fraß authored 6 years ago

4393)         function class_node_complex(name, attributes, children) {
4394)             if (attributes === void 0) { attributes = {}; }
4395)             if (children === void 0) { children = []; }
4396)             var _this = _super.call(this) || this;
4397)             _this.name = name;
4398)             _this.attributes = attributes;
4399)             _this.children = children;
4400)             return _this;
4401)         }
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4402)         /**
Christian Fraß update

Christian Fraß authored 6 years ago

4403)          * @author fenris
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4404)          */
Christian Fraß update

Christian Fraß authored 6 years ago

4405)         class_node_complex.prototype.compile = function (depth) {
4406)             var _this = this;
4407)             if (depth === void 0) { depth = 0; }
4408)             var output = "";
4409)             var attributes = Object.keys(this.attributes).map(function (key) { return (" " + key + "=" + ("\"" + _this.attributes[key] + "\"")); }).join("");
4410)             output += (lib_string.repeat("\t", depth) + "<" + this.name + attributes + ">" + "\n");
4411)             this.children.forEach(function (child) { return (output += child.compile(depth + 1)); });
4412)             output += (lib_string.repeat("\t", depth) + "</" + this.name + ">" + "\n");
4413)             return output;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4414)         };
Christian Fraß update

Christian Fraß authored 6 years ago

4415)         return class_node_complex;
4416)     }(class_node));
4417)     lib_xml.class_node_complex = class_node_complex;
4418) })(lib_xml || (lib_xml = {}));
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4419) var __extends = (this && this.__extends) || function (d, b) {
4420)     for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
4421)     function __() { this.constructor = d; }
4422)     d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
4423) };
4424) var lib_path;
4425) (function (lib_path) {
4426)     /**
4427)      * @author fenris
4428)      */
4429)     var class_step = (function () {
4430)         function class_step() {
4431)         }
4432)         return class_step;
4433)     }());
4434)     lib_path.class_step = class_step;
4435)     /**
4436)      * @author fenris
4437)      */
4438)     var class_step_stay = (function (_super) {
4439)         __extends(class_step_stay, _super);
4440)         function class_step_stay() {
Christian Fraß update

Christian Fraß authored 6 years ago

4441)             return _super !== null && _super.apply(this, arguments) || this;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4442)         }
4443)         /**
4444)          * @author fenris
4445)          */
4446)         class_step_stay.prototype.invert = function () {
4447)             return (new class_step_stay());
4448)         };
4449)         /**
4450)          * @author fenris
4451)          */
4452)         class_step_stay.prototype.toString = function () {
4453)             return ".";
4454)         };
4455)         return class_step_stay;
4456)     }(class_step));
4457)     lib_path.class_step_stay = class_step_stay;
4458)     /**
4459)      * @author fenris
4460)      */
4461)     var class_step_back = (function (_super) {
4462)         __extends(class_step_back, _super);
4463)         function class_step_back() {
Christian Fraß update

Christian Fraß authored 6 years ago

4464)             return _super !== null && _super.apply(this, arguments) || this;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4465)         }
4466)         /**
4467)          * @author fenris
4468)          */
4469)         class_step_back.prototype.invert = function () {
4470)             throw (new Error("impossible"));
4471)         };
4472)         /**
4473)          * @author fenris
4474)          */
4475)         class_step_back.prototype.toString = function () {
4476)             return "..";
4477)         };
4478)         return class_step_back;
4479)     }(class_step));
4480)     lib_path.class_step_back = class_step_back;
4481)     /**
4482)      * @author fenris
4483)      */
4484)     var class_step_regular = (function (_super) {
4485)         __extends(class_step_regular, _super);
4486)         /**
4487)          * @author fenris
4488)          */
4489)         function class_step_regular(name) {
Christian Fraß update

Christian Fraß authored 6 years ago

4490)             var _this = _super.call(this) || this;
4491)             _this.name = name;
4492)             return _this;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4493)         }
4494)         /**
4495)          * @author fenris
4496)          */
4497)         class_step_regular.prototype.invert = function () {
4498)             return (new class_step_back());
4499)         };
4500)         /**
4501)          * @author fenris
4502)          */
4503)         class_step_regular.prototype.toString = function () {
4504)             return this.name;
4505)         };
4506)         return class_step_regular;
4507)     }(class_step));
4508)     lib_path.class_step_regular = class_step_regular;
4509)     /**
4510)      * @author fenris
4511)      */
4512)     function step_read(s) {
4513)         switch (s) {
4514)             case ".": {
4515)                 return (new class_step_stay());
4516)             }
4517)             case "..": {
4518)                 return (new class_step_back());
4519)             }
4520)             default: {
4521)                 return (new class_step_regular(s));
4522)             }
4523)         }
4524)     }
4525)     lib_path.step_read = step_read;
4526) })(lib_path || (lib_path = {}));
Christian Fraß update

Christian Fraß authored 6 years ago

4527) ///<reference path="../../../plankton/object/build/logic-decl.d.ts"/>
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4528) var lib_path;
4529) (function (lib_path) {
4530)     /**
4531)      * @author fenris
4532)      */
4533)     var class_chain = (function () {
4534)         /**
4535)          * @author fenris
4536)          */
4537)         function class_chain(steps) {
4538)             if (steps === void 0) { steps = []; }
4539)             this.steps = steps;
4540)         }
4541)         /**
4542)          * @author fenris
4543)          */
4544)         class_chain.splitter = function (system) {
Christian Fraß update

Christian Fraß authored 6 years ago

4545)             if (system === void 0) { system = "linux"; }
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4546)             return (object_fetch({
Christian Fraß update

Christian Fraß authored 6 years ago

4547)                 "linux": "/",
4548)                 "bsd": "/",
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4549)                 "win": "\\"
4550)             }, system, "/", 2));
4551)         };
4552)         /**
4553)          * @desc removes superfluent steps from the chain, e.g. infix ".."
4554)          * @author fenris
4555)          */
4556)         class_chain.prototype.normalize = function () {
4557)             var steps = this.steps;
4558)             // filter "stay"
4559)             {
4560)                 steps = steps.filter(function (step) { return (!(step instanceof lib_path.class_step_stay)); });
4561)             }
4562)             // filter "regular-back"
4563)             {
Christian Fraß update

Christian Fraß authored 6 years ago

4564)                 var _loop_1 = function () {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4565)                     if (steps.length < 1) {
4566)                         return "break";
4567)                     }
4568)                     else {
4569)                         var last_1 = steps[0];
4570)                         var found = steps.slice(1).some(function (step, index) {
4571)                             if (step instanceof lib_path.class_step_back) {
4572)                                 if (last_1 instanceof lib_path.class_step_regular) {
4573)                                     steps.splice(index, 2);
4574)                                     return true;
4575)                                 }
4576)                             }
4577)                             last_1 = step;
4578)                             return false;
4579)                         });
4580)                         if (!found) {
4581)                             return "break";
4582)                         }
4583)                     }
4584)                 };
4585)                 while (true) {
4586)                     var state_1 = _loop_1();
Christian Fraß update

Christian Fraß authored 6 years ago

4587)                     if (state_1 === "break")
4588)                         break;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4589)                 }
4590)             }
4591)             return (new class_chain(steps));
4592)         };
4593)         /**
4594)          * @author fenris
4595)          */
4596)         class_chain.prototype.invert = function () {
4597)             return (new class_chain(this.steps.map(function (step) { return step.invert(); })));
4598)         };
4599)         /**
4600)          * @author fenris
4601)          */
4602)         class_chain.prototype.add = function (step) {
4603)             return (new class_chain(this.steps.concat([step]))).normalize();
4604)         };
4605)         /**
4606)          * @author fenris
4607)          */
4608)         class_chain.prototype.extend = function (chain) {
4609)             return (new class_chain(this.steps.concat(chain.steps))).normalize();
4610)         };
4611)         /**
4612)          * @author fenris
4613)          */
4614)         class_chain.prototype.as_string = function (system) {
Christian Fraß update

Christian Fraß authored 6 years ago

4615)             if (system === void 0) { system = "linux"; }
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4616)             var splitter = class_chain.splitter(system);
4617)             return ((this.steps.length == 0) ? ("." + splitter) : this.steps.map(function (step) { return (step.toString() + splitter); }).join(""));
4618)         };
4619)         /**
4620)          * @author fenris
4621)          */
4622)         class_chain.prototype.toString = function () {
4623)             return this.as_string();
4624)         };
4625)         return class_chain;
4626)     }());
4627)     lib_path.class_chain = class_chain;
4628)     /**
4629)      * @author fenris
4630)      */
4631)     function chain_read(str, system) {
Christian Fraß update

Christian Fraß authored 6 years ago

4632)         if (system === void 0) { system = "linux"; }
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4633)         var splitter = class_chain.splitter(system);
4634)         var parts = str.split(splitter);
4635)         if (parts[parts.length - 1] == "")
4636)             parts.pop();
4637)         return (new class_chain(parts.map(lib_path.step_read)));
4638)     }
4639)     lib_path.chain_read = chain_read;
4640) })(lib_path || (lib_path = {}));
Christian Fraß update

Christian Fraß authored 6 years ago

4641) ///<reference path="../../../plankton/object/build/logic-decl.d.ts"/>
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4642) var lib_path;
4643) (function (lib_path) {
4644)     /**
4645)      * @author fenris
4646)      */
4647)     var class_location = (function () {
4648)         /**
4649)          * @author fenris
4650)          */
4651)         function class_location(anchor, chain) {
4652)             this.anchor = anchor;
4653)             this.chain = chain;
4654)         }
4655)         /**
4656)          * @author fenris
4657)          */
4658)         class_location.anchorpattern = function (system) {
Christian Fraß update

Christian Fraß authored 6 years ago

4659)             if (system === void 0) { system = "linux"; }
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4660)             return (object_fetch({
Christian Fraß update

Christian Fraß authored 6 years ago

4661)                 "linux": new RegExp("/"),
4662)                 "bsd": new RegExp("/"),
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4663)                 "win": new RegExp("[A-Z]:\\\\>")
4664)             }, system, new RegExp("/"), 1));
4665)         };
Christian Fraß update

Christian Fraß authored 6 years ago

4666)         /**
4667)          * @desc [accessor]
4668)          * @author fenris
4669)          */
4670)         class_location.prototype.is_absolute = function () {
4671)             return (this.anchor != null);
4672)         };
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4673)         /**
4674)          * @author fenris
4675)          */
4676)         class_location.prototype.normalize = function () {
4677)             return (new class_location(this.anchor, this.chain.normalize()));
4678)         };
4679)         /**
4680)          * @author fenris
4681)          */
4682)         class_location.prototype.extend = function (chain) {
4683)             return (new class_location(this.anchor, this.chain.extend(chain)));
4684)         };
Christian Fraß update

Christian Fraß authored 6 years ago

4685)         /**
4686)          * @desc [accessor]
4687)          * @author fenris
4688)          */
4689)         class_location.prototype.relocate = function (location) {
4690)             if (this.is_absolute()) {
4691)                 return (new class_location(this.anchor, this.chain));
4692)             }
4693)             else {
4694)                 return location.extend(this.chain);
4695)             }
4696)         };
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4697)         /**
4698)          * @author fenris
4699)          */
4700)         class_location.prototype.go_thither = function () {
4701)             // console.error(">>", this.toString());
4702)             process.chdir(this.toString());
4703)         };
4704)         /**
4705)          * @author fenris
4706)          */
4707)         class_location.prototype.expedition = function (core) {
4708)             var that = this;
4709)             var current = location_read(process.cwd());
4710)             function begin() {
4711)                 // (new class_message("changing directory to '" + that.toString() + "'")).stderr();
4712)                 that.go_thither();
4713)             }
4714)             function end() {
4715)                 // (new class_message("changing directory to '" + current.toString() + "'")).stderr();
4716)                 current.go_thither();
4717)             }
4718)             begin();
4719)             core(end);
4720)         };
4721)         /**
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

4722)          * @author fenris
4723)          */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4724)         class_location.prototype.as_string = function (system) {
Christian Fraß update

Christian Fraß authored 6 years ago

4725)             if (system === void 0) { system = "linux"; }
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4726)             return (((this.anchor != null) ? this.anchor : "") + this.chain.as_string(system));
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

4727)         };
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4728)         /**
4729)          * @author fenris
4730)          */
4731)         class_location.prototype.toString = function () {
4732)             return this.as_string();
4733)         };
4734)         /**
4735)          * @author fenris
4736)          */
4737)         class_location.current = function () {
4738)             // return class_location.read(process.cwd());
4739)             return location_read(process.cwd());
4740)         };
4741)         /**
4742)          * @author fenris
4743)          */
4744)         class_location.tempfolder = function (system) {
Christian Fraß update

Christian Fraß authored 6 years ago

4745)             if (system === void 0) { system = "linux"; }
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4746)             return (object_fetch({
Christian Fraß update

Christian Fraß authored 6 years ago

4747)                 "linux": new class_location("/", new lib_path.class_chain([new lib_path.class_step_regular("tmp")])),
4748)                 "bsd": new class_location("/", new lib_path.class_chain([new lib_path.class_step_regular("tmp")])),
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4749)                 "win": new class_location(null, new lib_path.class_chain([new lib_path.class_step_regular("%TEMP%")]))
4750)             }, system, null, 2));
4751)         };
4752)         return class_location;
4753)     }());
4754)     lib_path.class_location = class_location;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

4755)     /**
4756)      * @author fenris
4757)      */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4758)     function location_read(str, system) {
Christian Fraß update

Christian Fraß authored 6 years ago

4759)         if (system === void 0) { system = "linux"; }
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4760)         var regexp = class_location.anchorpattern(system);
4761)         var matching = regexp.exec(str);
4762)         if ((matching == null) || (matching.index > 0)) {
4763)             return (new class_location(null, lib_path.chain_read(str, system)));
4764)         }
4765)         else {
4766)             return (new class_location(matching[0], lib_path.chain_read(str.slice(matching[0].length), system)));
4767)         }
4768)     }
4769)     lib_path.location_read = location_read;
4770) })(lib_path || (lib_path = {}));
4771) var lib_path;
4772) (function (lib_path) {
4773)     /**
4774)      * @author fenris
4775)      */
4776)     var class_filepointer = (function () {
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

4777)         /**
4778)          * @author fenris
4779)          */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4780)         function class_filepointer(location, filename) {
4781)             this.location = location;
4782)             this.filename = filename;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

4783)         }
4784)         /**
4785)          * @author fenris
4786)          */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4787)         class_filepointer.prototype.normalize = function () {
4788)             return (new class_filepointer(this.location.normalize(), this.filename));
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

4789)         };
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4790)         /**
4791)          * @author fenris
4792)          */
4793)         class_filepointer.prototype.foo = function (filepointer) {
4794)             return (new class_filepointer(this.location.extend(filepointer.location.chain), filepointer.filename));
4795)         };
Christian Fraß update

Christian Fraß authored 6 years ago

4796)         /**
4797)          * @desc [accessor]
4798)          * @author fenris
4799)          */
4800)         class_filepointer.prototype.relocate = function (location) {
4801)             return (new class_filepointer(this.location.relocate(location), this.filename));
4802)         };
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4803)         /**
4804)          * @author fenris
4805)          */
4806)         class_filepointer.prototype.as_string = function (system) {
Christian Fraß update

Christian Fraß authored 6 years ago

4807)             if (system === void 0) { system = "linux"; }
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4808)             return (this.location.as_string(system) /* + "/"*/ + ((this.filename == null) ? "" : this.filename));
4809)         };
4810)         /**
4811)          * @author fenris
4812)          */
4813)         class_filepointer.prototype.toString = function () {
4814)             return this.as_string();
4815)         };
4816)         return class_filepointer;
4817)     }());
4818)     lib_path.class_filepointer = class_filepointer;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

4819)     /**
4820)      * @author fenris
4821)      */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4822)     function filepointer_read(str, system) {
Christian Fraß update

Christian Fraß authored 6 years ago

4823)         if (system === void 0) { system = "linux"; }
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4824)         var splitter = lib_path.class_chain.splitter(system);
4825)         var parts = str.split(splitter);
4826)         var last = parts[parts.length - 1];
4827)         if (last == "") {
4828)             return (new class_filepointer(lib_path.location_read(parts.join(splitter), system), null));
4829)         }
4830)         else {
4831)             return (new class_filepointer(lib_path.location_read(parts.slice(0, parts.length - 1).join(splitter), system), last));
4832)         }
4833)     }
4834)     lib_path.filepointer_read = filepointer_read;
4835) })(lib_path || (lib_path = {}));
Christian Fraß update

Christian Fraß authored 6 years ago

4836) ///<reference path="../../call/build/logic-decl.d.ts"/>
4837) var lib_file;
4838) (function (lib_file) {
4839)     /**
4840)      * @author fenris
4841)      */
4842)     class class_file_abstract {
4843)         /**
4844)          * @desc reads a json file
4845)          * @author fenris
4846)          */
4847)         read_json(path) {
4848)             return ((resolve, reject) => {
4849)                 lib_call.executor_chain({}, [
4850)                     state => (resolve_, reject_) => {
4851)                         this.read(path)(content => {
4852)                             state.content = content;
4853)                             resolve_(state);
4854)                         }, reject_);
4855)                     },
4856)                     state => (resolve_, reject_) => {
4857)                         let error;
4858)                         try {
4859)                             state.data = JSON.parse(state.content);
4860)                             error = null;
4861)                         }
4862)                         catch (exception) {
4863)                             error = new class_error("invalid json '" + path + "'", [exception]);
4864)                         }
4865)                         if (error == null) {
4866)                             resolve_(state);
4867)                         }
4868)                         else {
4869)                             reject_(error);
4870)                         }
4871)                     },
4872)                 ])(state => resolve(state.data), reject);
4873)             });
4874)         }
4875)         /**
4876)          * @desc writes a json file
4877)          * @author fenris
4878)          */
4879)         write_json(path, data) {
4880)             return this.write(path, JSON.stringify(data, undefined, "\t"));
4881)         }
4882)     }
4883)     lib_file.class_file_abstract = class_file_abstract;
4884) })(lib_file || (lib_file = {}));
4885) ///<reference path="../../call/build/logic-decl.d.ts"/>
4886) var lib_file;
4887) (function (lib_file) {
4888)     /**
4889)      * @author fenris
4890)      */
4891)     class class_file_node extends lib_file.class_file_abstract {
4892)         /**
4893)          * @author maspr
4894)          */
4895)         determine_handler(path) {
4896)             if (/^https?:\/\//.test(path)) {
4897)                 return "http";
4898)             }
4899)             else {
4900)                 return "file";
4901)             }
4902)         }
4903)         /**
4904)          * @override
4905)          * @author fenris,maspr
4906)          * @todo clear up if http(s)-handling belongs here or not
4907)          */
4908)         read(path, skip_error = false) {
4909)             switch (this.determine_handler(path)) {
4910)                 case "file":
4911)                     {
4912)                         let nm_fs = require("fs");
4913)                         return ((resolve, reject) => {
4914)                             nm_fs.readFile(path, {
4915)                                 "encoding": "utf8",
4916)                                 "flag": "r",
4917)                             }, (error, content) => {
4918)                                 if (error == null) {
4919)                                     resolve(content);
4920)                                 }
4921)                                 else {
4922)                                     reject(error);
4923)                                 }
4924)                             });
4925)                         });
4926)                     }
4927)                     break;
4928)                 case "http":
4929)                     {
4930)                         return (resolve, reject) => {
4931)                             let nm_http = require("http");
4932)                             let nm_https = require("https");
4933)                             let nm_url = require("url");
4934)                             let parsed_url = nm_url.parse(path, false, true);
4935)                             let client = (parsed_url.protocol == "https:") ? nm_https : nm_http;
4936)                             let default_port = ((parsed_url.protocol == "https:") ? 443 : 80);
4937)                             let options = {
4938)                                 hostname: parsed_url.hostname,
4939)                                 port: parsed_url.port || default_port,
4940)                                 path: parsed_url.path,
4941)                                 method: "GET"
4942)                             };
4943)                             let req = client.request(options, (res) => {
4944)                                 let data = ""; // @todo
4945)                                 res.on("data", (chunk) => {
4946)                                     data += chunk;
4947)                                 });
4948)                                 res.on("end", () => {
4949)                                     resolve(data);
4950)                                 });
4951)                             });
4952)                             req.end();
4953)                             req.on("error", (error) => {
4954)                                 reject(error);
4955)                             });
4956)                         };
4957)                     }
4958)                     break;
4959)                 default: {
4960)                     return ((resolve, reject) => reject(new Error("unhandled protocol")));
4961)                 }
4962)             }
4963)         }
4964)         /**
4965)          * @override
4966)          * @author fenris
4967)          */
4968)         write(path, content) {
4969)             let nm_fs = require("fs");
4970)             return ((resolve, reject) => {
4971)                 nm_fs.writeFile(path, content, {
4972)                     "encoding": "utf8",
4973)                     "flag": "w",
4974)                 }, (error) => {
4975)                     if (error == null) {
4976)                         resolve(undefined);
4977)                     }
4978)                     else {
4979)                         reject(error);
4980)                     }
4981)                 });
4982)             });
4983)         }
4984)     }
4985)     lib_file.class_file_node = class_file_node;
4986) })(lib_file || (lib_file = {}));
4987) ///<reference path="../../call/build/logic-decl.d.ts"/>
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4988) var lib_file;
4989) (function (lib_file) {
4990)     /**
4991)      * @author fenris
4992)      * @todo move to a dedicated lib (e.g. "http", "transport", etc.)
4993)      */
Christian Fraß update

Christian Fraß authored 6 years ago

4994)     function ajax({ "target": target /*: string*/, "data": data /*: {[key : string] : string}*/ = null, "method": method /* : string*/ = "GET" }) {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4995)         method = method.toLowerCase();
Christian Fraß update

Christian Fraß authored 6 years ago

4996)         return ((resolve, reject) => {
4997)             let datastring = ((data == null) ? null : Object.keys(data).map(key => `${key}=${data[key]}`).join("&"));
4998)             let suffix = ((method == "get") ? ("?" + datastring) : "");
4999)             let sending = ((method == "get") ? null : datastring);
5000)             let request = new XMLHttpRequest();
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

5001)             request.open(method.toUpperCase(), target + suffix, true);
5002)             request.onreadystatechange = function () {
5003)                 if (request.readyState === 4) {
5004)                     if (request.status === 200) {
5005)                         resolve(request.responseText);
5006)                     }
5007)                     else {
5008)                         reject(new Error("XMLHttpRequest failed"));
5009)                     }
5010)                 }
5011)             };
5012)             request.send(sending);
5013)         });
5014)     }
5015)     /**
Christian Fraß update

Christian Fraß authored 6 years ago

5016)      * @author fenris
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

5017)      */
Christian Fraß update

Christian Fraß authored 6 years ago

5018)     class class_file_web extends lib_file.class_file_abstract {
5019)         /**
5020)          * @override
5021)          * @author fenris
5022)          */
5023)         read(path, skip_error = false) {
5024)             return ((resolve, reject) => {
5025)                 ajax({
5026)                     "target": path,
5027)                     "method": "GET",
5028)                 })(resolve, reason => (skip_error ? resolve(null) : reject(reason)));
5029)             });
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

5030)         }
Christian Fraß update

Christian Fraß authored 6 years ago

5031)         /**
5032)          * @override
5033)          * @author fenris
5034)          */
5035)         write(path, content) {
5036)             return ((resolve, reject) => {
5037)                 reject(new Error("not implemented / not possible"));
5038)             });
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

5039)         }
5040)     }
Christian Fraß update

Christian Fraß authored 6 years ago

5041)     lib_file.class_file_web = class_file_web;
5042) })(lib_file || (lib_file = {}));
5043) ///<reference path="../../base/build/logic-decl.d.ts"/>
5044) ///<reference path="../../call/build/logic-decl.d.ts"/>
5045) var lib_file;
5046) (function (lib_file) {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

5047)     /**
Christian Fraß update

Christian Fraß authored 6 years ago

5048)      * @desc selects the implementation which fits for the detected environment
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

5049)      * @author fenris
5050)      */
Christian Fraß update

Christian Fraß authored 6 years ago

5051)     function auto() {
5052)         let environment = lib_base.environment();
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

5053)         switch (environment) {
Christian Fraß update

Christian Fraß authored 6 years ago

5054)             case "node": {
5055)                 return (new lib_file.class_file_node());
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

5056)                 break;
5057)             }
Christian Fraß update

Christian Fraß authored 6 years ago

5058)             case "web": {
5059)                 return (new lib_file.class_file_web());
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

5060)                 break;
5061)             }
5062)             default: {
Christian Fraß update

Christian Fraß authored 6 years ago

5063)                 throw (new Error(`no implementation for environment '${environment}'`));
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

5064)                 break;
5065)             }
5066)         }
5067)     }
Christian Fraß update

Christian Fraß authored 6 years ago

5068)     lib_file.auto = auto;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

5069)     /**
5070)      * @author fenris
5071)      */
Christian Fraß update

Christian Fraß authored 6 years ago

5072)     class class_file extends lib_file.class_file_abstract {
5073)         /**
5074)          * @author fenris
5075)          */
5076)         constructor() {
5077)             super();
5078)             this.core = auto();
5079)         }
5080)         /**
5081)          * @override
5082)          * @author fenris
5083)          */
5084)         read(path, skip_error = false) {
5085)             return this.core.read(path, skip_error);
5086)         }
5087)         /**
5088)          * @override
5089)          * @author fenris
5090)          */
5091)         write(path, content) {
5092)             return this.core.write(path, content);
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

5093)         }
5094)     }
Christian Fraß update

Christian Fraß authored 6 years ago

5095)     lib_file.class_file = class_file;
5096)     /**
5097)      * @author fenris
5098)      */
5099)     var instance = auto();
5100)     /**
5101)      * @author fenris
5102)      */
5103)     function read(path, skip_error = false) {
5104)         return instance.read(path, skip_error);
5105)     }
5106)     lib_file.read = read;
5107)     /**
5108)      * @author fenris
5109)      */
5110)     function write(path, content) {
5111)         return instance.write(path, content);
5112)     }
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

5113)     lib_file.write = write;
5114)     /**
Christian Fraß update

Christian Fraß authored 6 years ago

5115)      * @author fenris
5116)      */
5117)     function read_json(path) {
5118)         return instance.read_json(path);
5119)     }
5120)     lib_file.read_json = read_json;
5121)     /**
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

5122)      * @author fenris
5123)      */
5124)     function write_json(path, data) {
Christian Fraß update

Christian Fraß authored 6 years ago

5125)         return instance.write_json(path, data);
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

5126)     }
5127)     lib_file.write_json = write_json;
5128) })(lib_file || (lib_file = {}));
5129) var lib_args;
5130) (function (lib_args) {
5131)     /**
5132)      * @author fenris
5133)      */
5134)     var class_argument = (function () {
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

5135)         /**
5136)          * @author fenris
5137)          */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

5138)         function class_argument(_a) {
5139)             var name = _a["name"], _b = _a["type"], type = _b === void 0 ? "string" : _b, _c = _a["default"], default_ = _c === void 0 ? null : _c, _d = _a["info"], info = _d === void 0 ? null : _d, _e = _a["mode"], mode = _e === void 0 ? "replace" : _e, _f = _a["kind"], kind = _f === void 0 ? "positional" : _f, _g = _a["parameters"], parameters = _g === void 0 ? {} : _g, _h = _a["hidden"], hidden = _h === void 0 ? false : _h;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

5140)             this.name = name;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

5141)             this.type = type;
5142)             this.default_ = default_;
5143)             this.info = info;
5144)             this.mode = mode;
5145)             this.kind = kind;
5146)             this.parameters = parameters;
5147)             this.hidden = hidden;
5148)             if (!this.check()) {
5149)                 throw (new Error("invalid argument-setup"));
5150)             }
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

5151)         }
5152)         /**
5153)          * @author fenris
5154)          */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

5155)         class_argument.prototype.check = function () {
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

5156)             var _this = this;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

5157)             return [
5158)                 function () { return ((!(_this.kind == "volatile")) || (("indicators_long" in _this.parameters) && (_this.parameters["indicators_long"].length >= 0))); },
5159)             ].every(function (condition) { return condition(); });
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

5160)         };
5161)         /**
5162)          * @author fenris
5163)          */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

5164)         class_argument.prototype.name_get = function () {
5165)             return this.name;
5166)         };
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

5167)         /**
5168)          * @author fenris
5169)          */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

5170)         class_argument.prototype.type_get = function () {
5171)             return this.type;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

5172)         };
5173)         /**
5174)          * @author fenris
5175)          */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

5176)         class_argument.prototype.default_get = function () {
5177)             return this.default_;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

5178)         };
5179)         /**
5180)          * @author fenris
5181)          */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

5182)         class_argument.prototype.kind_get = function () {
5183)             return this.kind;
5184)         };
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

5185)         /**
5186)          * @author fenris
5187)          */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

5188)         class_argument.prototype.parameters_get = function () {
5189)             return this.parameters;
5190)         };
5191)         /**
5192)          * @author fenris
5193)          */
5194)         class_argument.prototype.hidden_get = function () {
5195)             return this.hidden;
5196)         };
5197)         /**
5198)          * @author fenris
5199)          */
5200)         class_argument.prototype.toString = function () {
5201)             return "<" + this.name + ">";
5202)         };
5203)         /**
5204)          * @author fenris
5205)          */
5206)         class_argument.prototype.indicator_main = function () {
5207)             if (this.kind == "volatile") {
5208)                 return this.parameters["indicators_long"][0];
5209)             }
5210)             else {
5211)                 return null;
5212)             }
5213)         };
5214)         /**
5215)          * @author fenris
5216)          */
5217)         class_argument.prototype.pattern_value = function () {
5218)             switch (this.type) {
5219)                 case "boolean": {
5220)                     return "false|true";
5221)                     break;
5222)                 }
5223)                 case "int": {
5224)                     return "[0-9]+";
5225)                     break;
5226)                 }
5227)                 case "float": {
5228)                     return "\\d*(?:\\.\\d+)?";
5229)                     break;
5230)                 }
5231)                 case "string": {
5232)                     return "\\S+";
5233)                     break;
5234)                 }
5235)                 default: {
5236)                     throw (new Error("unhandled type " + this.type));
5237)                     break;
5238)                 }
5239)             }
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

5240)         };
5241)         /**
5242)          * @author fenris
5243)          */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

5244)         class_argument.prototype.extract = function (raw) {
5245)             switch (this.type) {
5246)                 case "boolean": {
5247)                     return (raw != "false");
5248)                     break;
5249)                 }
5250)                 case "int": {
5251)                     return parseInt(raw);
5252)                     break;
5253)                 }
5254)                 case "float": {
5255)                     return parseFloat(raw);
5256)                     break;
5257)                 }
5258)                 case "string": {
5259)                     return raw;
5260)                     break;
5261)                 }
5262)                 default: {
5263)                     throw (new Error("unhandled type " + this.type));
5264)                     break;
5265)                 }
5266)             }
5267)         };
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

5268)         /**
5269)          * @author fenris
5270)          */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

5271)         class_argument.prototype.assign = function (data, raw) {
5272)             var value = this.extract(raw);
5273)             switch (this.mode) {
5274)                 case "replace": {
5275)                     data[this.name] = value;
5276)                     break;
5277)                 }
5278)                 case "accumulate": {
5279)                     /*
5280)                     if (! (this.name in data)) {
5281)                         data[this.name] = [];
5282)                     }
5283)                      */
5284)                     data[this.name].push(value);
5285)                     break;
5286)                 }
5287)                 default: {
5288)                     throw (new Error("unhandled mode " + this.mode));
5289)                 }
5290)             }
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

5291)         };
5292)         /**
5293)          * @author fenris
5294)          */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

5295)         class_argument.prototype.make = function (data) {
5296)             var value = data[this.name];
5297)             return value.toString();
5298)         };
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

5299)         /**
5300)          * @author fenris
5301)          */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

5302)         class_argument.prototype.generate_help = function () {
5303)             var output = "";
5304)             {
5305)                 var line = "";
5306)                 line += "\t";
5307)                 line += "<" + this.name + ">";
5308)                 line += "\n";
5309)                 output += line;
5310)             }
5311)             {
5312)                 var line = "";
5313)                 line += "\t\t";
5314)                 var infotext = ((this.info == null) ? "(no info available)" : this.info);
5315)                 line += infotext;
5316)                 if ((this.type != "boolean") && (this.default_ != null)) {
5317)                     line += "; default: " + this.default_.toString();
5318)                 }
5319)                 line += "\n";
5320)                 output += line;
5321)             }
5322)             return output;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

5323)         };
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

5324)         return class_argument;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

5325)     }());
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

5326)     lib_args.class_argument = class_argument;
5327) })(lib_args || (lib_args = {}));
Christian Fraß update

Christian Fraß authored 6 years ago

5328) ///<reference path="../../base/build/logic-decl.d.ts"/>
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

5329) var lib_args;
5330) (function (lib_args) {
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

5331)     /**
5332)      * @author fenris
5333)      */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

5334)     var settings = {
5335)         "environment": {
5336)             "cli": {
5337)                 "symbols": {
5338)                     "delimiter": " ",
5339)                     "prefix": "--",
5340)                     "assignment": "="
5341)                 }
5342)             },
5343)             "url": {
5344)                 "symbols": {
5345)                     "delimiter": "&",
5346)                     "prefix": "",
5347)                     "assignment": "="
5348)                 }
5349)             }
5350)         }
5351)     };
5352)     /**
5353)      * @author fenris
5354)      */
5355)     lib_args.verbosity = 0;
5356)     /**
5357)      * @author fenris
5358)      * @todo check validity
5359)      */
5360)     var class_handler = (function () {
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

5361)         /**
5362)          * @author fenris
5363)          */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

5364)         function class_handler(arguments_) {
5365)             this.arguments_ = arguments_;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

5366)         }
5367)         /**
5368)          * @author fenris
5369)          */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

5370)         class_handler.prototype.filter = function (kind) {
5371)             return this.arguments_.filter(function (argument) { return (argument.kind_get() == kind); });
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

5372)         };
5373)         /**
5374)          * @author fenris
5375)          */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

5376)         class_handler.prototype.read = function (environment, input, data) {
5377)             var _this = this;
5378)             if (data === void 0) { data = {}; }
5379)             switch (environment) {
5380)                 case "cli":
5381)                 case "url": {
5382)                     // default values
5383)                     {
5384)                         this.arguments_.forEach(function (argument) {
5385)                             data[argument.name_get()] = argument.default_get();
5386)                         });
5387)                     }
5388)                     // preprocessing
5389)                     {
5390)                         // short indicators (lil hacky ...)
5391)                         {
5392)                             if (environment == "cli") {
5393)                                 this.filter("volatile").forEach(function (argument) {
5394)                                     // console.info(argument.parameters_get()["indicators_short"].join("|"));
5395)                                     var pattern_from = "";
5396)                                     {
5397)                                         pattern_from += "(?:^|" + settings["environment"][environment]["symbols"]["delimiter"] + ")";
5398)                                         pattern_from += "-" + argument.parameters_get()["indicators_short"].join("|");
5399)                                         pattern_from += "(?:$|" + settings["environment"][environment]["symbols"]["delimiter"] + ")";
5400)                                     }
5401)                                     var pattern_to = "";
5402)                                     {
5403)                                         pattern_to += settings["environment"][environment]["symbols"]["delimiter"];
5404)                                         pattern_to += settings["environment"][environment]["symbols"]["prefix"];
5405)                                         pattern_to += argument.indicator_main();
Christian Fraß update

Christian Fraß authored 6 years ago

5406)                                         if (argument.type_get() == "boolean") {
5407)                                             pattern_to += settings["environment"][environment]["symbols"]["delimiter"];
5408)                                         }
5409)                                         else {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

5410)                                             pattern_to += settings["environment"][environment]["symbols"]["assignment"];
5411)                                         }
5412)                                     }
5413)                                     var result = input.replace(new RegExp(pattern_from, "g"), pattern_to);
5414)                                     if (lib_args.verbosity >= 3)
5415)                                         console.info("--", "replacing \"" + pattern_from + "\" by \"" + pattern_to + "\" in \"" + input + "\" to \"" + result + "\"");
5416)                                     input = result;
5417)                                 });
5418)                             }
5419)                         }
5420)                         if (lib_args.verbosity >= 3)
5421)                             console.info("--", "input is now \"" + input + "\"");
5422)                     }
5423)                     // parsing
5424)                     {
5425)                         var parts = input
5426)                             .split(settings["environment"][environment]["symbols"]["delimiter"])
5427)                             .filter(function (x) { return (x != ""); });
5428)                         var index_expected_1 = 0;
5429)                         parts.forEach(function (part) {
5430)                             if (lib_args.verbosity >= 2)
5431)                                 console.info("--", "analyzing \"" + part + "\"");
5432)                             var found = [
5433)                                 function () {
5434)                                     if (lib_args.verbosity >= 3)
5435)                                         console.info("--", "probing as volatile");
5436)                                     return (_this.filter("volatile")
5437)                                         .some(function (argument) {
5438)                                         if (lib_args.verbosity >= 4)
5439)                                             console.info("--", "trying as " + argument.toString());
5440)                                         var pattern = "";
5441)                                         {
5442)                                             var pattern_front = "";
5443)                                             pattern_front += "" + settings["environment"][environment]["symbols"]["prefix"];
5444)                                             pattern_front += "(?:" + argument.parameters_get()["indicators_long"].join("|") + ")";
5445)                                             pattern += pattern_front;
5446)                                         }
5447)                                         {
5448)                                             var pattern_back = "";
5449)                                             pattern_back += "" + settings["environment"][environment]["symbols"]["assignment"];
5450)                                             pattern_back += "(" + argument.pattern_value() + ")";
5451)                                             if (argument.type_get() == "boolean") {
5452)                                                 pattern_back = "(?:" + pattern_back + ")?";
5453)                                             }
5454)                                             pattern += pattern_back;
5455)                                         }
5456)                                         if (lib_args.verbosity >= 5)
5457)                                             console.info("--", "pattern: \"" + pattern + "\"");
5458)                                         var regexp = new RegExp(pattern);
5459)                                         var matching = regexp.exec(part);
5460)                                         if (lib_args.verbosity >= 5)
5461)                                             console.info("--", "matching:", matching);
5462)                                         if (matching == null) {
5463)                                             return false;
5464)                                         }
5465)                                         else {
5466)                                             argument.assign(data, matching[1]);
5467)                                             return true;
5468)                                         }
5469)                                     }));
5470)                                 },
5471)                                 function () {
5472)                                     if (lib_args.verbosity >= 3)
5473)                                         console.info("--", "probing as positional");
5474)                                     var positional = _this.filter("positional");
5475)                                     if (index_expected_1 >= positional.length) {
5476)                                         if (lib_args.verbosity >= 4)
5477)                                             console.info("--", "no positional arguments left");
5478)                                         return false;
5479)                                     }
5480)                                     else {
5481)                                         var argument = positional[index_expected_1];
5482)                                         if (lib_args.verbosity >= 4)
5483)                                             console.info("--", "trying as " + argument.toString());
5484)                                         var pattern = "";
5485)                                         {
5486)                                             var pattern_back = "";
5487)                                             pattern_back += "(" + argument.pattern_value() + ")";
5488)                                             pattern += pattern_back;
5489)                                         }
5490)                                         if (lib_args.verbosity >= 5)
5491)                                             console.info("--", "pattern: \"" + pattern + "\"");
5492)                                         var regexp = new RegExp(pattern);
5493)                                         var matching = regexp.exec(part);
5494)                                         if (lib_args.verbosity >= 5)
5495)                                             console.info("--", "matching:", matching);
5496)                                         if (matching == null) {
5497)                                             return false;
5498)                                         }
5499)                                         else {
5500)                                             argument.assign(data, matching[1]);
5501)                                             index_expected_1 += 1;
5502)                                             return true;
5503)                                         }
5504)                                     }
5505)                                 },
5506)                             ].some(function (x) { return x(); });
5507)                             if (!found) {
5508)                                 if (lib_args.verbosity >= 1)
5509)                                     console.warn("--", "couldn't parse \"" + part + "\"");
5510)                             }
5511)                         });
5512)                     }
5513)                     return data;
5514)                     break;
5515)                 }
5516)                 default: {
5517)                     throw (new Error("unhandled environment " + environment));
5518)                     break;
5519)                 }
5520)             }
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

5521)         };
5522)         /**
5523)          * @author fenris
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

5524)          * @todo handle if the data object doesn't have the required field or the type is wrong or sth.
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

5525)          */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

5526)         class_handler.prototype.write = function (environment, data) {
5527)             switch (environment) {
5528)                 case "cli":
5529)                 case "url": {
5530)                     return (([]
5531)                         .concat(this.filter("volatile").map(function (argument) {
5532)                         var raw = "";
5533)                         {
5534)                             var raw_front = "";
5535)                             raw_front += settings["environment"][environment]["symbols"]["prefix"];
5536)                             raw_front += argument.parameters_get()["indicators_long"][0];
5537)                             raw += raw_front;
5538)                         }
5539)                         {
5540)                             var raw_back = "";
5541)                             raw_back += settings["environment"][environment]["symbols"]["assignment"];
5542)                             raw_back += argument.make(data);
5543)                             raw += raw_back;
5544)                         }
5545)                         return raw;
5546)                     }))
5547)                         .concat(this.filter("positional").map(function (argument) {
5548)                         var raw = "";
5549)                         {
5550)                             var raw_back = "";
5551)                             raw_back += argument.make(data);
5552)                             raw += raw_back;
5553)                         }
5554)                         return raw;
5555)                     })))
5556)                         .join(settings["environment"][environment]["symbols"]["delimiter"]));
5557)                     break;
5558)                 }
5559)                 default: {
5560)                     throw (new Error("unhandled environment " + environment));
5561)                     break;
5562)                 }
5563)             }
5564)         };
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

5565)         /**
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

5566)          * @desc manpage-like info-sheet
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

5567)          * @author fenris
5568)          */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

5569)         class_handler.prototype.generate_help = function (_a) {
5570)             var _b = _a["programname"], programname = _b === void 0 ? null : _b, _c = _a["author"], author = _c === void 0 ? null : _c, _d = _a["description"], description = _d === void 0 ? null : _d, _e = _a["executable"], executable = _e === void 0 ? null : _e;
5571)             var environment = "cli";
5572)             var output = "";
5573)             {
5574)                 var section = "";
5575)                 {
5576)                     var line = "";
5577)                     line += "";
5578)                     line += "INFO";
5579)                     line += "\n";
5580)                     section += line;
5581)                 }
5582)                 {
5583)                     var line = "";
5584)                     line += "\t";
5585)                     line += programname + " -- " + description;
5586)                     line += "\n";
5587)                     section += line;
5588)                 }
5589)                 section += "\n";
5590)                 output += section;
5591)             }
5592)             {
5593)                 if (author != null) {
5594)                     var section = "";
5595)                     {
5596)                         var line = "";
5597)                         line += "";
5598)                         line += "AUTHOR";
5599)                         line += "\n";
5600)                         section += line;
5601)                     }
5602)                     {
5603)                         var line = "";
5604)                         line += "\t";
5605)                         line += "" + author;
5606)                         line += "\n";
5607)                         section += line;
5608)                     }
5609)                     section += "\n";
5610)                     output += section;
5611)                 }
5612)             }
5613)             {
5614)                 var section = "";
5615)                 {
5616)                     var line = "";
5617)                     line += "";
5618)                     line += "SYNOPSIS";
5619)                     line += "\n";
5620)                     section += line;
5621)                 }
5622)                 {
5623)                     var line = "";
5624)                     line += "\t";
5625)                     line += executable;
5626)                     line += settings["environment"][environment]["symbols"]["delimiter"];
5627)                     line += this.filter("positional")
5628)                         .map(function (argument) {
5629)                         var part = "";
5630)                         part += "<" + argument.name_get() + ">";
5631)                         return part;
5632)                     })
5633)                         .join(settings["environment"][environment]["symbols"]["delimiter"]);
5634)                     line += settings["environment"][environment]["symbols"]["delimiter"];
5635)                     line += this.filter("volatile")
5636)                         .filter(function (argument) { return (!argument.hidden_get()); })
5637)                         .map(function (argument) {
5638)                         var part = "";
5639)                         part += settings["environment"][environment]["symbols"]["prefix"];
5640)                         part += argument.parameters_get()["indicators_long"][0];
5641)                         if (argument.type_get() != "boolean") {
5642)                             part += settings["environment"][environment]["symbols"]["assignment"];
5643)                             part += "<" + argument.name_get() + ">";
5644)                         }
5645)                         part = "[" + part + "]";
5646)                         return part;
5647)                     })
5648)                         .join(settings["environment"][environment]["symbols"]["delimiter"]);
5649)                     line += "\n";
5650)                     section += line;
5651)                 }
5652)                 section += "\n";
5653)                 output += section;
5654)             }
5655)             {
5656)                 var section = "";
5657)                 {
5658)                     var line = "";
5659)                     line += "";
5660)                     line += "OPTIONS";
5661)                     line += "\n";
5662)                     section += line;
5663)                 }
5664)                 {
5665)                     section += (this.arguments_
5666)                         .filter(function (argument) { return (!argument.hidden_get()); })
5667)                         .map(function (argument) { return argument.generate_help(); })
5668)                         .join("\n"));
5669)                 }
5670)                 section += "\n";
5671)                 output += section;
5672)             }
5673)             return output;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

5674)         };
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

5675)         return class_handler;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

5676)     }());
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

5677)     lib_args.class_handler = class_handler;
5678) })(lib_args || (lib_args = {}));
Christian Fraß update

Christian Fraß authored 6 years ago

5679) 
5680) var __extends = (this && this.__extends) || (function () {
5681)     var extendStatics = Object.setPrototypeOf ||
5682)         ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
5683)         function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
5684)     return function (d, b) {
5685)         extendStatics(d, b);
5686)         function __() { this.constructor = d; }
5687)         d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
5688)     };
5689) })();
5690) var nm_child_process = require("child_process");
5691) var nm_fs = require("fs");
5692) /**
5693)  * @author fenris
5694)  */
5695) var globalvars = {
5696)     "configuration": {},
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

5697) };
Christian Fraß update

Christian Fraß authored 6 years ago

5698) /**
5699)  * @author fenris
5700)  */
5701) function name_mark(name) {
5702)     return (globalvars.configuration.name_prefix + name);
5703) }
5704) /**
5705)  * @author fenris
5706)  */
5707) function dirwrap(location, core) {
5708)     if (location == null) {
5709)         return core;
5710)     }
5711)     else {
5712)         return "cd " + location.as_string(globalvars.configuration.system) + " > /dev/null && " + core + " ; cd - > /dev/null";
5713)     }
5714) }
5715) /**
5716)  * @author fenris
5717)  */
5718) function filepointer_adjust(filepointer, location) {
5719)     return ((location == null) ? filepointer : filepointer.relocate(location));
5720) }
5721) /**
5722)  * @author fenris
5723)  */
5724) function path_augment(path, step, aggregate) {
5725)     if (aggregate === void 0) { aggregate = true; }
5726)     if (aggregate) {
5727)         return path.concat([step]);
5728)     }
5729)     else {
5730)         return [step];
5731)     }
5732) }
5733) /**
5734)  * @author fenris
5735)  */
5736) function path_dump(path) {
5737)     return path.join(globalvars.configuration.name_splitter);
5738) }
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

5739) /**
5740)  * @author fenris
5741)  */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

5742) var class_message = (function () {
5743)     /**
5744)      * @author fenris
5745)      */
5746)     function class_message(content, parameters) {
5747)         if (parameters === void 0) { parameters = {}; }
5748)         /**
5749)          * @author fenris
5750)          */
5751)         this.depth = 0;
5752)         this.content = content;
5753)         this.type = lib_object.fetch(parameters, "type", null, 0);
5754)         this.depth = lib_object.fetch(parameters, "depth", 0, 0);
5755)         this.prefix = lib_object.fetch(parameters, "prefix", null, 0);
5756)         this.linebreak = lib_object.fetch(parameters, "linebreak", false, 0);
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

5757)     }
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

5758)     /**
5759)      * @author fenris
5760)      */
5761)     class_message.prototype.generate = function (with_type) {
5762)         if (with_type === void 0) { with_type = true; }
5763)         var output = "";
5764)         if (with_type) {
5765)             if (this.type != null) {
5766)                 output += ("[" + this.type + "]" + " ");
5767)             }
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

5768)         }
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

5769)         if (this.prefix != null) {
5770)             output += ("<" + this.prefix + ">" + " ");
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

5771)         }
Christian Fraß update

Christian Fraß authored 6 years ago

5772)         output += lib_string.repeat("\t", this.depth);
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

5773)         output += this.content;
5774)         if (this.linebreak) {
5775)             output += "\n";
5776)         }
5777)         return output;
5778)     };
5779)     /**
5780)      * @author fenris
5781)      */
5782)     class_message.prototype.stdout = function () {
5783)         console.log(this.generate(true));
5784)     };
5785)     /**
5786)      * @author fenris
5787)      */
5788)     class_message.prototype.stderr = function () {
5789)         console.error(this.generate(true));
5790)     };
5791)     /**
5792)      * @author fenris
5793)      */
5794)     class_message.prototype.console = function () {
5795)         switch (this.type) {
5796)             case "log": {
5797)                 console.log(this.generate(false));
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

5798)                 break;
5799)             }
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

5800)             case "information": {
5801)                 console.info(this.generate(false));
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

5802)                 break;
5803)             }
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

5804)             case "warning": {
5805)                 console.warn(this.generate(false));
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

5806)                 break;
5807)             }
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

5808)             case "error": {
5809)                 console.error(this.generate(false));
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

5810)                 break;
5811)             }
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

5812)             default: {
5813)                 throw (new Error("unhandled type '" + this.type + "'"));
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

5814)             }
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

5815)         }
5816)     };
5817)     return class_message;
5818) }());
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

5819) /**
5820)  * @author fenris
5821)  */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

5822) var class_cliout = (function () {
5823)     function class_cliout() {
5824)     }
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

5825)     /**
5826)      * @author fenris
5827)      */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

5828)     class_cliout.stdout = function (content, depth) {
5829)         if (depth === void 0) { depth = 0; }
5830)         console.log(lib_string.repeat("\t", depth) + content);
5831)     };
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

5832)     /**
5833)      * @author fenris
5834)      */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

5835)     class_cliout.stderr = function (content, depth) {
5836)         if (depth === void 0) { depth = 0; }
5837)         console.error(lib_string.repeat("\t", depth) + content);
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

5838)     };
5839)     /**
5840)      * @author fenris
5841)      */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

5842)     class_cliout.log = function (content, depth) {
5843)         if (depth === void 0) { depth = 0; }
5844)         this.stderr("-- " + content, depth);
5845)     };
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

5846)     /**
5847)      * @author fenris
5848)      */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

5849)     class_cliout.info = function (content, depth) {
5850)         if (depth === void 0) { depth = 0; }
5851)         this.stderr(">> " + content, depth);
5852)     };
5853)     /**
5854)      * @author fenris
5855)      */
5856)     class_cliout.warn = function (content, depth) {
5857)         if (depth === void 0) { depth = 0; }
5858)         this.stderr(">> " + content, depth);
5859)     };
5860)     /**
5861)      * @author fenris
5862)      */
5863)     class_cliout.error = function (content, depth) {
5864)         if (depth === void 0) { depth = 0; }
5865)         this.stderr(">> " + content, depth);
5866)     };
5867)     return class_cliout;
5868) }());
5869) /**
5870)  * @author fenris
5871)  */
5872) var class_graph = (function () {
5873)     /**
5874)      * @author fenris
5875)      */
5876)     function class_graph(equality, nodes, edges) {
5877)         if (equality === void 0) { equality = (function (node1, node2) { return (node1 == node2); }); }
5878)         if (nodes === void 0) { nodes = []; }
5879)         if (edges === void 0) { edges = []; }
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

5880)         /**
5881)          * @author fenris
5882)          */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

5883)         this.equality = (function (node1, node2) { return (node1 == node2); });
5884)         this.equality = equality;
5885)         this.nodes = nodes;
5886)         this.edges = edges;
5887)     }
5888)     /**
5889)      * @author frac
5890)      */
5891)     class_graph.prototype.has = function (node) {
5892)         var _this = this;
5893)         return this.nodes.some(function (node_) { return _this.equality(node, node_); });
5894)     };
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

5895)     /**
5896)      * @author fenris
5897)      */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

5898)     class_graph.prototype.without = function (pivot) {
5899)         var _this = this;
5900)         return (new class_graph(this.equality, this.nodes.filter(function (node) { return (!_this.equality(node, pivot)); }), this.edges.filter(function (edge) { return ((!_this.equality(edge.from, pivot)) && (!_this.equality(edge.to, pivot))); })));
5901)     };
5902)     /**
5903)      * @author fenris
5904)      */
5905)     class_graph.prototype.outgoing = function (node) {
5906)         var _this = this;
5907)         return this.edges.filter(function (edge) { return _this.equality(edge.from, node); });
5908)     };
5909)     /**
5910)      * @author fenris
5911)      */
5912)     class_graph.prototype.incoming = function (node) {
5913)         var _this = this;
5914)         return this.edges.filter(function (edge) { return _this.equality(edge.to, node); });
5915)     };
5916)     /**
5917)      * @author fenris
5918)      */
5919)     class_graph.prototype.topsort = function () {
5920)         var _this = this;
5921)         var graph = this;
5922)         if (graph.nodes.length == 0) {
5923)             return [];
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

5924)         }
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

5925)         else {
5926)             var pivot_1;
5927)             var found = graph.nodes.some(function (node) {
5928)                 var count = graph.edges.filter(function (edge) { return _this.equality(edge.to, node); }).length;
5929)                 if (count == 0) {
5930)                     pivot_1 = node;
5931)                     return true;
5932)                 }
5933)                 else {
5934)                     // console.info("'" + String(node) + "' has " + count.toString() + " incoming edges");
5935)                     return false;
5936)                 }
5937)             });
5938)             if (found) {
5939)                 return [pivot_1].concat(graph.without(pivot_1).topsort());
5940)             }
5941)             else {
5942)                 throw (new Error("circular dependencies found"));
5943)             }
5944)         }
5945)     };
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

5946)     /**
5947)      * @author fenris
5948)      */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

5949)     class_graph.prototype.hasse = function () {
5950)         var _this = this;
5951)         return (new class_graph(this.equality, this.nodes, this.edges.filter(function (edge) {
5952)             var reachable = (_this.outgoing(edge.from).map(function (edge_) { return edge_.to; })
5953)                 .map(function (node) { return _this.outgoing(node).map(function (edge_) { return edge_.to; }); })
5954)                 .reduce(function (x, y) { return x.concat(y); }, []));
5955)             return (!reachable.some(function (node) { return _this.equality(node, edge.to); }));
5956)         })));
5957)     };
5958)     /**
5959)      * @author fenris
5960)      */
5961)     class_graph.prototype.output_graphviz = function (extract_label) {
5962)         if (extract_label === void 0) { extract_label = (function (node) { return String(node); }); }
5963)         var that = this;
5964)         function get_nodeindex(node) {
5965)             // return that.nodes.findIndex(node_ => that.equality(node, node_));
5966)             var index;
5967)             for (var index_1 = 0; index_1 < that.nodes.length; ++index_1) {
5968)                 if (that.equality(node, that.nodes[index_1])) {
5969)                     return index_1;
5970)                 }
5971)             }
5972)             return undefined;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

5973)         }
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

5974)         function nodeid(node) {
5975)             return "x_" + get_nodeindex(node).toString();
5976)         }
5977)         function nodelist() {
5978)             return (["\tnode [fontname=\"Monospace\", style=\"filled\", fillcolor=\"0.4+0.8+0.8\"];\n"]
5979)                 .concat(that.nodes
5980)                 .map(function (node, index) {
5981)                 return "\t" + nodeid(node) + " [label=\"" + extract_label(node) + "\"];\n";
5982)             }))
5983)                 .join(""));
5984)         }
5985)         function edgelist() {
5986)             return (["\tedge [fontname=\"Monospace\"];\n"]
5987)                 .concat(that.edges
5988)                 .map(function (edge, index) {
5989)                 return "\t" + nodeid(edge.from) + " -> " + nodeid(edge.to) + " [];\n";
5990)             }))
5991)                 .join(""));
5992)         }
5993)         var output = "digraph\n{\n\tgraph [fontname=\"Monospace\"];\n" + nodelist() + "\n" + edgelist() + "\n}\n";
5994)         return output;
5995)     };
5996)     return class_graph;
5997) }());
5998) /**
5999)  * @author fenris
6000)  */
6001) var lib_gnumake;
6002) (function (lib_gnumake) {
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6003)     /**
6004)      * @author fenris
6005)      */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6006)     function macro_command(_a) {
Christian Fraß update

Christian Fraß authored 6 years ago

6007)         var _b = _a["interpreter"], interpreter = _b === void 0 ? null : _b, path = _a["path"], _c = _a["args"], args = _c === void 0 ? [] : _c, _d = _a["output"], output = _d === void 0 ? null : _d, _e = _a["system"], system = _e === void 0 ? "linux" : _e;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6008)         switch (system) {
Christian Fraß update

Christian Fraß authored 6 years ago

6009)             case "bsd":
6010)             case "linux": {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6011)                 var command = path;
6012)                 {
6013)                     if (interpreter != null) {
6014)                         command = interpreter + " " + command;
6015)                     }
6016)                 }
6017)                 {
6018)                     var parts_1 = [];
6019)                     args.forEach(function (arg) { return parts_1.push(arg); });
6020)                     command = command + " " + parts_1.join(" ");
6021)                 }
6022)                 {
6023)                     if (output != null) {
6024)                         command = command + " > " + output;
6025)                     }
6026)                 }
6027)                 return command;
6028)                 break;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6029)             }
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6030)             case "win": {
6031)                 var command = "cmd //c";
6032)                 {
6033)                     command = command + " " + path;
6034)                 }
6035)                 {
6036)                     if (interpreter != null) {
6037)                         command = command + " " + interpreter;
6038)                     }
6039)                 }
6040)                 {
6041)                     var parts_2 = [];
6042)                     args.forEach(function (arg) { return parts_2.push(arg); });
6043)                     command = command + " " + parts_2.join(" ");
6044)                 }
6045)                 {
6046)                     if (output != null) {
6047)                         command = command + " > " + output;
6048)                     }
6049)                 }
6050)                 return command;
6051)                 break;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6052)             }
6053)             default: {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6054)                 throw (new Error("unhandled system '" + system + "'"));
6055)                 break;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6056)             }
6057)         }
6058)     }
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6059)     lib_gnumake.macro_command = macro_command;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6060)     /**
6061)      * @author fenris
6062)      */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6063)     var class_rule = (function () {
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6064)         /**
6065)          * @author fenris
6066)          */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6067)         // public constructor(name : string, dependencies : Array<string>, actions : Array<string>, phony : boolean = false) {
6068)         function class_rule(parameters) {
6069)             if (parameters === void 0) { parameters = {}; }
6070)             this.name = object_fetch(parameters, "name", null, 2);
6071)             this.dependencies = object_fetch(parameters, "dependencies", [], 0);
6072)             this.actions = object_fetch(parameters, "actions", [], 0);
6073)             this.phony = object_fetch(parameters, "phony", false, 0);
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6074)         }
6075)         /**
6076)          * @author fenris
6077)          */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6078)         class_rule.prototype.actions_get = function () {
6079)             return this.actions;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6080)         };
6081)         /**
6082)          * @author fenris
6083)          */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6084)         class_rule.prototype.compile = function (silent) {
6085)             if (silent === void 0) { silent = false; }
6086)             var output = "";
6087)             output += (this.name + ": " + this.dependencies.map(function (dependency) { return (" " + dependency); }).join("") + "\n");
6088)             this.actions.forEach(function (action) { return (output += "\t" + (silent ? "@ " : "") + action + "\n"); });
6089)             if (this.phony) {
6090)                 output += (".PHONY: " + this.name + "\n");
6091)             }
6092)             return output;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6093)         };
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6094)         return class_rule;
6095)     }());
6096)     lib_gnumake.class_rule = class_rule;
6097)     /**
6098)      * @author fenris
6099)      */
6100)     var class_sheet = (function () {
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6101)         /**
6102)          * @author fenris
6103)          */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6104)         function class_sheet(rules, comments) {
6105)             if (comments === void 0) { comments = []; }
6106)             this.rules = rules;
6107)             this.comments = comments;
6108)         }
Christian Fraß removed backup-data-files;...

Christian Fraß authored 7 years ago

6109)         /**
6110)          * @author fenris
6111)          */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6112)         class_sheet.prototype.compile = function (silent) {
6113)             if (silent === void 0) { silent = false; }
6114)             return ([]
6115)                 .concat(this.comments.map(function (comment) { return ("# " + comment); }))
6116)                 .concat([""])
6117)                 .concat(this.rules.map(function (rule) { return rule.compile(silent); }))
6118)                 .join("\n"));
Christian Fraß removed backup-data-files;...

Christian Fraß authored 7 years ago

6119)         };
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6120)         return class_sheet;
6121)     }());
6122)     lib_gnumake.class_sheet = class_sheet;
6123) })(lib_gnumake || (lib_gnumake = {}));
6124) /**
6125)  * @author fenris
6126)  */
6127) var lib_ant;
6128) (function (lib_ant) {
6129)     /**
6130)      * @author fenris
6131)      */
6132)     var class_comment = (function () {
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6133)         /**
6134)          * @author fenris
6135)          */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6136)         function class_comment(content) {
6137)             this.content = content;
6138)         }
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6139)         /**
6140)          * @author fenris
6141)          */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6142)         class_comment.prototype.compile = function () {
6143)             return (new lib_xml.class_node_comment(this.content));
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6144)         };
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6145)         return class_comment;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6146)     }());
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6147)     lib_ant.class_comment = class_comment;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6148)     /**
6149)      * @author fenris
6150)      */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6151)     var class_action = (function () {
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6152)         /**
6153)          * @author fenris
6154)          */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6155)         function class_action(representation) {
6156)             this.representation = representation;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6157)         }
6158)         /**
6159)          * @author fenris
6160)          */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6161)         class_action.prototype.compile = function () {
6162)             return this.representation;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6163)         };
6164)         /**
6165)          * @author fenris
6166)          */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6167)         class_action.macro_exec = function (_a) {
Christian Fraß update

Christian Fraß authored 6 years ago

6168)             var _b = _a["interpreter"], interpreter = _b === void 0 ? null : _b, path = _a["path"], _c = _a["args"], args = _c === void 0 ? [] : _c, _d = _a["output"], output = _d === void 0 ? null : _d, _e = _a["system"], system = _e === void 0 ? "linux" : _e;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6169)             switch (system) {
Christian Fraß update

Christian Fraß authored 6 years ago

6170)                 case "linux":
6171)                 case "bsd": {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6172)                     var attributes = {};
6173)                     var args_ = [];
6174)                     if (interpreter == null) {
6175)                         attributes["executable"] = path;
6176)                     }
6177)                     else {
6178)                         attributes["executable"] = interpreter;
6179)                         args.push(path);
6180)                     }
6181)                     if (output != null) {
6182)                         attributes["output"] = output;
6183)                     }
6184)                     args_ = args_.concat(args);
6185)                     return (new lib_ant.class_action(new lib_xml.class_node_complex("exec", attributes, args_.map(function (arg) { return new lib_xml.class_node_complex("arg", { "value": arg }); }))));
6186)                     break;
6187)                 }
6188)                 case "win": {
6189)                     var attributes = {};
6190)                     var args_ = [];
6191)                     attributes["executable"] = "cmd";
6192)                     args_.push("/c");
6193)                     if (interpreter == null) {
6194)                     }
6195)                     else {
6196)                         args_.push(interpreter);
6197)                     }
6198)                     args_.push(path);
6199)                     args_ = args_.concat(args);
6200)                     if (output != null) {
6201)                         attributes["output"] = output;
6202)                     }
6203)                     return (new lib_ant.class_action(new lib_xml.class_node_complex("exec", attributes, args_.map(function (arg) { return new lib_xml.class_node_complex("arg", { "value": arg }); }))));
6204)                     break;
6205)                 }
6206)                 default: {
6207)                     throw (new Error("unhandled system " + system));
6208)                     break;
6209)                 }
6210)             }
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6211)         };
6212)         /**
6213)          * @author fenris
6214)          */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6215)         class_action.macro_command = function (cmdparams) { return this.macro_exec(cmdparams); };
6216)         return class_action;
6217)     }());
6218)     lib_ant.class_action = class_action;
6219)     /**
6220)      * @author fenris
6221)      */
6222)     var class_target = (function () {
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6223)         /**
6224)          * @author fenris
6225)          */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6226)         function class_target(parameters) {
6227)             if (parameters === void 0) { parameters = {}; }
6228)             this.name = object_fetch(parameters, "name", null, 2);
6229)             this.dependencies = object_fetch(parameters, "dependencies", [], 1);
6230)             this.actions = object_fetch(parameters, "actions", [], 0);
6231)         }
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6232)         /**
6233)          * @author fenris
6234)          */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6235)         class_target.prototype.actions_get = function () {
6236)             return this.actions;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6237)         };
6238)         /**
6239)          * @author fenris
6240)          */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6241)         class_target.prototype.compile = function () {
6242)             return (new lib_xml.class_node_complex("target", {
6243)                 "name": this.name,
6244)                 "depends": this.dependencies.join(",")
6245)             }, this.actions.map(function (action) { return action.compile(); })));
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6246)         };
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6247)         return class_target;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6248)     }());
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6249)     lib_ant.class_target = class_target;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6250)     /**
6251)      * @author fenris
6252)      */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6253)     var class_project = (function () {
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6254)         /**
6255)          * @author fenris
6256)          */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6257)         function class_project(parameters) {
6258)             if (parameters === void 0) { parameters = {}; }
6259)             this.name = object_fetch(parameters, "name", null, 2);
6260)             this.default_ = object_fetch(parameters, "default", null, 2);
6261)             this.targets = object_fetch(parameters, "targets", [], 1);
6262)             this.comments = object_fetch(parameters, "comments", [], 0);
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6263)         }
Christian Fraß update

Christian Fraß authored 6 years ago

6264)         /**
6265)          * @author fenris
6266)          */
6267)         class_project.prototype.compile = function () {
6268)             return (new lib_xml.class_node_complex("project", {
6269)                 "name": this.name,
6270)                 "default": this.default_,
6271)             }, ([]
6272)                 .concat(this.comments.map(function (comment) { return comment.compile(); }))
6273)                 .concat([
6274)                 new lib_xml.class_node_complex("property", {
6275)                     "environment": "env"
6276)                 }),
6277)             ])
6278)                 .concat(this.targets.map(function (target) { return target.compile(); })))));
6279)         };
6280)         return class_project;
6281)     }());
6282)     lib_ant.class_project = class_project;
6283) })(lib_ant || (lib_ant = {}));
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6284) /**
6285)  * @author fenris
6286)  */
Christian Fraß update

Christian Fraß authored 6 years ago

6287) var class_action = (function () {
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6288)     /**
6289)      * @author fenris
6290)      */
Christian Fraß update

Christian Fraß authored 6 years ago

6291)     function class_action() {
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6292)     }
Christian Fraß update

Christian Fraß authored 6 years ago

6293)     return class_action;
6294) }());
6295) /**
6296)  * @author fenris
6297)  */
6298) var class_action_adhoc = (function (_super) {
6299)     __extends(class_action_adhoc, _super);
6300)     /**
6301)      * @author fenris
6302)      */
6303)     function class_action_adhoc() {
6304)         return _super.call(this) || this;
6305)     }
6306)     return class_action_adhoc;
6307) }(class_action));
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6308) /**
6309)  * @author fenris
6310)  */
Christian Fraß update

Christian Fraß authored 6 years ago

6311) var class_action_exec = (function (_super) {
6312)     __extends(class_action_exec, _super);
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6313)     /**
6314)      * @author fenris
6315)      */
Christian Fraß update

Christian Fraß authored 6 years ago

6316)     function class_action_exec(_a) {
6317)         var inputs = _a["inputs"], outputs = _a["outputs"], path = _a["path"], interpreter = _a["interpreter"], workdir = _a["workdir"];
6318)         var _this = _super.call(this) || this;
6319)         _this.paths_input = inputs;
6320)         _this.paths_output = outputs;
6321)         _this.path_script = path;
6322)         _this.path_interpreter = interpreter;
6323)         _this.workdir = workdir;
6324)         return _this;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6325)     }
6326)     /**
6327)      * @desc for defining directly how the action is to be converted into a target-piece
6328)      * @author fenris
6329)      */
Christian Fraß update

Christian Fraß authored 6 years ago

6330)     class_action_exec.prototype.compilation = function (output_identifier) {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6331)         switch (output_identifier) {
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6332)             case "gnumake": {
Christian Fraß update

Christian Fraß authored 6 years ago

6333)                 switch (globalvars.configuration.system) {
6334)                     case "linux":
6335)                     case "bsd":
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6336)                     case "win": {
Christian Fraß update

Christian Fraß authored 6 years ago

6337)                         var command = "";
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6338)                         {
Christian Fraß update

Christian Fraß authored 6 years ago

6339)                             command = lib_gnumake.macro_command({
6340)                                 "interpreter": ((this.path_interpreter != null) ? this.path_interpreter.as_string(globalvars.configuration.system) : null),
6341)                                 "path": this.path_script.as_string(globalvars.configuration.system),
6342)                                 "args": [
6343)                                     ("'" + this.paths_input.map(function (filepointer) { return filepointer.as_string(globalvars.configuration.system); }).join(",") + "'"),
6344)                                     ("'" + this.paths_output.map(function (filepointer) { return filepointer.as_string(globalvars.configuration.system); }).join(",") + "'"),
6345)                                 ],
6346)                                 "system": globalvars.configuration.system,
6347)                             });
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6348)                         }
6349)                         {
Christian Fraß update

Christian Fraß authored 6 years ago

6350)                             if (this.workdir != null) {
6351)                                 // command = `pushd ${this.workdir.as_string(globalvars.configuration.system)} && ${command} ; popd`
6352)                                 command = "cd " + this.workdir.as_string(globalvars.configuration.system) + " && " + command + " ; cd -";
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6353)                             }
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6354)                         }
Christian Fraß update

Christian Fraß authored 6 years ago

6355)                         return command;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6356)                         break;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6357)                     }
6358)                     default: {
6359)                         throw (new Error("not implemented"));
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6360)                         break;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6361)                     }
6362)                 }
6363)                 break;
6364)             }
6365)             case "ant": {
Christian Fraß update

Christian Fraß authored 6 years ago

6366)                 return (lib_ant.class_action.macro_exec({
6367)                     "interpreter": ((this.path_interpreter != null) ? this.path_interpreter.as_string(globalvars.configuration.system) : null),
6368)                     "path": this.path_script.as_string("linux"),
6369)                     "args": [
6370)                         ("'" + this.paths_input.map(function (filepointer) { return filepointer.as_string("linux"); }).join(",") + "'"),
6371)                         ("'" + this.paths_output.map(function (filepointer) { return filepointer.as_string("linux"); }).join(",") + "'"),
6372)                     ],
6373)                     "system": globalvars.configuration.system,
6374)                 }));
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6375)                 break;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6376)             }
6377)             default: {
Christian Fraß update

Christian Fraß authored 6 years ago

6378)                 throw (new Error("unhandled output '" + output_identifier + "'"));
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6379)                 break;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6380)             }
6381)         }
6382)     };
Christian Fraß update

Christian Fraß authored 6 years ago

6383)     return class_action_exec;
6384) }(class_action_adhoc));
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6385) /**
6386)  * @author fenris
6387)  */
Christian Fraß update

Christian Fraß authored 6 years ago

6388) var class_action_echo = (function (_super) {
6389)     __extends(class_action_echo, _super);
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6390)     /**
6391)      * @author fenris
6392)      */
Christian Fraß update

Christian Fraß authored 6 years ago

6393)     function class_action_echo(message) {
6394)         var _this = _super.call(this) || this;
6395)         _this.message = message;
6396)         return _this;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6397)     }
6398)     /**
6399)      * @desc for defining directly how the action is to be converted into a target-piece
Christian Fraß update

Christian Fraß authored 6 years ago

6400)      * @todo escape message
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6401)      * @author fenris
6402)      */
Christian Fraß update

Christian Fraß authored 6 years ago

6403)     class_action_echo.prototype.compilation = function (target_identifier) {
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6404)         switch (target_identifier) {
6405)             case "gnumake": {
Christian Fraß update

Christian Fraß authored 6 years ago

6406)                 switch (globalvars.configuration["system"]) {
6407)                     case "linux":
6408)                     case "bsd":
6409)                     case "win": {
6410)                         return (lib_gnumake.macro_command({
6411)                             "path": "echo",
6412)                             "args": ["\"" + this.message + "\""],
6413)                         }));
6414)                         break;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6415)                     }
6416)                     default: {
6417)                         throw (new Error("not implemented"));
Christian Fraß update

Christian Fraß authored 6 years ago

6418)                         break;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6419)                     }
6420)                 }
6421)                 break;
6422)             }
6423)             case "ant": {
Christian Fraß update

Christian Fraß authored 6 years ago

6424)                 return (new lib_ant.class_action(new lib_xml.class_node_complex("echo", { "message": this.message })));
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6425)                 break;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6426)             }
6427)             default: {
6428)                 throw (new Error("unhandled target '" + target_identifier + "'"));
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6429)                 break;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6430)             }
6431)         }
6432)     };
Christian Fraß update

Christian Fraß authored 6 years ago

6433)     return class_action_echo;
6434) }(class_action_adhoc));
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6435) /**
6436)  * @author fenris
6437)  */
6438) var class_action_mkdir = (function (_super) {
6439)     __extends(class_action_mkdir, _super);
6440)     /**
6441)      * @author fenris
6442)      */
6443)     function class_action_mkdir(location) {
Christian Fraß update

Christian Fraß authored 6 years ago

6444)         var _this = _super.call(this) || this;
6445)         _this.location = location;
6446)         return _this;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6447)     }
6448)     /**
6449)      * @desc for defining directly how the action is to be converted into a target-piece
6450)      * @author fenris
6451)      */
6452)     class_action_mkdir.prototype.compilation = function (target_identifier) {
6453)         switch (target_identifier) {
6454)             case "gnumake": {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6455)                 var parts = [];
6456)                 parts.push("mkdir");
Christian Fraß update

Christian Fraß authored 6 years ago

6457)                 switch (globalvars.configuration["system"]) {
6458)                     case "linux": {
6459)                         parts.push("--parents");
6460)                         break;
6461)                     }
6462)                     case "bsd": {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6463)                         parts.push("-p");
6464)                         break;
6465)                     }
6466)                     case "win": {
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6467)                         break;
6468)                     }
6469)                     default: {
6470)                         throw (new Error("not implemented"));
6471)                         break;
6472)                     }
6473)                 }
Christian Fraß update

Christian Fraß authored 6 years ago

6474)                 parts.push(this.location.as_string(globalvars.configuration["system"]));
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6475)                 return parts.join(" ");
Christian Fraß update

Christian Fraß authored 6 years ago

6476)                 // break;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6477)             }
6478)             case "ant": {
Christian Fraß update

Christian Fraß authored 6 years ago

6479)                 return (new lib_ant.class_action(new lib_xml.class_node_complex("mkdir", { "dir": this.location.as_string("linux") })));
6480)                 // break;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6481)             }
6482)             default: {
6483)                 throw (new Error("unhandled target '" + target_identifier + "'"));
Christian Fraß update

Christian Fraß authored 6 years ago

6484)                 // break;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6485)             }
6486)         }
6487)     };
6488)     return class_action_mkdir;
6489) }(class_action_adhoc));
6490) /**
6491)  * @author fenris
6492)  */
6493) var class_action_touch = (function (_super) {
6494)     __extends(class_action_touch, _super);
6495)     /**
6496)      * @author fenris
6497)      */
6498)     function class_action_touch(filepointer) {
Christian Fraß update

Christian Fraß authored 6 years ago

6499)         var _this = _super.call(this) || this;
6500)         _this.filepointer = filepointer;
6501)         return _this;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6502)     }
6503)     /**
6504)      * @desc for defining directly how the action is to be converted into a target-piece
6505)      * @author fenris
6506)      */
6507)     class_action_touch.prototype.compilation = function (target_identifier) {
6508)         switch (target_identifier) {
6509)             case "gnumake": {
Christian Fraß update

Christian Fraß authored 6 years ago

6510)                 switch (globalvars.configuration["system"]) {
6511)                     case "bsd":
6512)                     case "linux": {
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6513)                         var parts = [];
6514)                         parts.push("touch");
6515)                         parts.push(this.filepointer.toString());
6516)                         return parts.join(" ");
Christian Fraß update

Christian Fraß authored 6 years ago

6517)                         // break;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6518)                     }
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6519)                     case "win": {
6520)                         var parts = [];
6521)                         parts.push("echo.");
6522)                         parts.push(">");
6523)                         parts.push(this.filepointer.toString());
6524)                         return parts.join(" ");
Christian Fraß update

Christian Fraß authored 6 years ago

6525)                         // break;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6526)                     }
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6527)                     default: {
6528)                         throw (new Error("not implemented"));
Christian Fraß update

Christian Fraß authored 6 years ago

6529)                         // break;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6530)                     }
6531)                 }
Christian Fraß update

Christian Fraß authored 6 years ago

6532)                 // break;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6533)             }
6534)             case "ant": {
6535)                 return (new lib_ant.class_action(new lib_xml.class_node_complex("touch", { "file": this.filepointer.toString() })));
Christian Fraß update

Christian Fraß authored 6 years ago

6536)                 // break;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6537)             }
6538)             default: {
6539)                 throw (new Error("unhandled target '" + target_identifier + "'"));
6540)                 break;
6541)             }
6542)         }
6543)     };
6544)     return class_action_touch;
6545) }(class_action_adhoc));
6546) /**
6547)  * @author fenris
6548)  */
6549) var class_action_copy = (function (_super) {
6550)     __extends(class_action_copy, _super);
6551)     /**
6552)      * @author fenris
6553)      */
6554)     function class_action_copy(filepointer_from, filepointer_to, folder) {
Christian Fraß update

Christian Fraß authored 6 years ago

6555)         var _this = _super.call(this) || this;
6556)         _this.filepointer_from = filepointer_from;
6557)         _this.filepointer_to = filepointer_to;
6558)         _this.folder = folder;
6559)         return _this;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6560)     }
6561)     /**
6562)      * @desc for defining directly how the action is to be converted into a target-piece
6563)      * @author fenris
6564)      */
6565)     class_action_copy.prototype.compilation = function (target_identifier) {
6566)         switch (target_identifier) {
6567)             case "gnumake": {
Christian Fraß update

Christian Fraß authored 6 years ago

6568)                 switch (globalvars.configuration.system) {
6569)                     case "linux": {
6570)                         var args = [];
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6571)                         if (this.folder) {
Christian Fraß update

Christian Fraß authored 6 years ago

6572)                             args.push("--recursive");
6573)                             args.push("--update");
6574)                             args.push("--verbose");
6575)                             args.push((new lib_path.class_filepointer(this.filepointer_from.location, "*")).as_string(globalvars.configuration.system));
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6576)                         }
6577)                         else {
Christian Fraß update

Christian Fraß authored 6 years ago

6578)                             args.push(this.filepointer_from.as_string(globalvars.configuration.system));
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6579)                         }
Christian Fraß update

Christian Fraß authored 6 years ago

6580)                         args.push(this.filepointer_to.as_string(globalvars.configuration.system));
6581)                         return (lib_gnumake.macro_command({
6582)                             "path": "cp",
6583)                             "args": args,
6584)                         }));
6585)                         break;
6586)                     }
6587)                     case "bsd": {
6588)                         var args = [];
6589)                         if (this.folder) {
6590)                             args.push("-r");
6591)                             // args.push("-u");
6592)                             args.push("-v");
6593)                             args.push((new lib_path.class_filepointer(this.filepointer_from.location, "*")).as_string(globalvars.configuration.system));
6594)                         }
6595)                         else {
6596)                             args.push(this.filepointer_from.as_string(globalvars.configuration.system));
6597)                         }
6598)                         args.push(this.filepointer_to.as_string(globalvars.configuration.system));
6599)                         return (lib_gnumake.macro_command({
6600)                             "path": "cp",
6601)                             "args": args,
6602)                         }));
6603)                         break;
6604)                     }
6605)                     case "win": {
6606)                         throw (new Error("not implemented"));
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6607)                         break;
6608)                     }
6609)                     default: {
6610)                         throw (new Error("not implemented"));
6611)                         break;
6612)                     }
6613)                 }
6614)                 break;
6615)             }
6616)             case "ant": {
6617)                 if (!this.folder) {
6618)                     return (new lib_ant.class_action(new lib_xml.class_node_complex("copy", {
Christian Fraß update

Christian Fraß authored 6 years ago

6619)                         "file": this.filepointer_from.as_string("linux"),
6620)                         "tofile": this.filepointer_to.as_string("linux"),
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6621)                     })));
6622)                 }
6623)                 else {
6624)                     return (new lib_ant.class_action(new lib_xml.class_node_complex("copy", {
Christian Fraß update

Christian Fraß authored 6 years ago

6625)                         "todir": this.filepointer_to.as_string("linux"),
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6626)                     }, [
6627)                         new lib_xml.class_node_complex("fileset", {
Christian Fraß update

Christian Fraß authored 6 years ago

6628)                             "dir": this.filepointer_from.as_string("linux"),
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6629)                         })
6630)                     ])));
6631)                 }
6632)                 break;
6633)             }
6634)             default: {
6635)                 throw (new Error("unhandled target '" + target_identifier + "'"));
6636)                 break;
6637)             }
6638)         }
6639)     };
6640)     return class_action_copy;
6641) }(class_action_adhoc));
6642) /**
6643)  * @author fenris
6644)  */
6645) var class_action_move = (function (_super) {
6646)     __extends(class_action_move, _super);
6647)     /**
6648)      * @author fenris
6649)      */
6650)     function class_action_move(_a) {
6651)         var from = _a["from"], to = _a["to"];
Christian Fraß update

Christian Fraß authored 6 years ago

6652)         var _this = _super.call(this) || this;
6653)         _this.from = from;
6654)         _this.to = to;
6655)         return _this;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6656)     }
6657)     /**
6658)      * @desc for defining directly how the action is to be converted into a target-piece
6659)      * @author fenris
6660)      */
6661)     class_action_move.prototype.compilation = function (output_identifier) {
6662)         switch (output_identifier) {
6663)             case "gnumake": {
Christian Fraß update

Christian Fraß authored 6 years ago

6664)                 switch (globalvars.configuration.system) {
6665)                     case "linux":
6666)                     case "bsd":
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6667)                     case "win": {
Christian Fraß update

Christian Fraß authored 6 years ago

6668)                         var from = this.from.as_string(globalvars.configuration.system);
6669)                         var to = this.to.as_string(globalvars.configuration.system);
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6670)                         var command = "";
6671)                         {
6672)                             command = lib_gnumake.macro_command({
6673)                                 "path": "mv",
Christian Fraß update

Christian Fraß authored 6 years ago

6674)                                 // "args": ["--verbose", from, to],
6675)                                 "args": [from, to],
6676)                                 "system": globalvars.configuration.system,
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6677)                             });
6678)                         }
6679)                         {
6680)                             command = "[ \"" + from + "\" -ef \"" + to + "\" ] || " + command;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6681)                         }
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6682)                         return command;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6683)                         break;
6684)                     }
6685)                     default: {
6686)                         throw (new Error("not implemented"));
6687)                         break;
6688)                     }
6689)                 }
6690)                 break;
6691)             }
6692)             case "ant": {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6693)                 return (new lib_ant.class_action(new lib_xml.class_node_complex("move", {
Christian Fraß update

Christian Fraß authored 6 years ago

6694)                     "file": this.from.as_string("linux"),
6695)                     "tofile": this.to.as_string("linux"),
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6696)                 })));
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6697)                 break;
6698)             }
6699)             default: {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6700)                 throw (new Error("unhandled output '" + output_identifier + "'"));
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6701)                 break;
6702)             }
6703)         }
6704)     };
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6705)     return class_action_move;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6706) }(class_action_adhoc));
6707) /**
6708)  * @author fenris
6709)  */
6710) var class_action_concat = (function (_super) {
6711)     __extends(class_action_concat, _super);
6712)     /**
6713)      * @author fenris
6714)      */
Christian Fraß update

Christian Fraß authored 6 years ago

6715)     function class_action_concat(sources, destination, schwamminput) {
6716)         if (schwamminput === void 0) { schwamminput = null; }
6717)         var _this = _super.call(this) || this;
6718)         _this.sources = sources;
6719)         _this.destination = destination;
6720)         _this.schwamminput = schwamminput;
6721)         return _this;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6722)     }
6723)     /**
6724)      * @desc for defining directly how the action is to be converted into a target-piece
6725)      * @author fenris
6726)      */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6727)     class_action_concat.prototype.compilation = function (output_identifier) {
6728)         switch (output_identifier) {
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6729)             case "gnumake": {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6730)                 if (this.sources.length > 0) {
6731)                     return (lib_gnumake.macro_command({
6732)                         "path": {
Christian Fraß update

Christian Fraß authored 6 years ago

6733)                             "linux": "cat",
6734)                             "bsd": "cat",
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6735)                             "win": "type",
Christian Fraß update

Christian Fraß authored 6 years ago

6736)                         }[globalvars.configuration.system],
6737)                         "args": this.sources.map(function (source) { return source.as_string(globalvars.configuration.system); }),
6738)                         "output": this.destination.as_string(globalvars.configuration.system),
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6739)                     }));
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6740)                 }
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6741)                 else {
6742)                     return (lib_gnumake.macro_command({
6743)                         "path": "touch",
Christian Fraß update

Christian Fraß authored 6 years ago

6744)                         "output": this.destination.as_string(globalvars.configuration.system),
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6745)                     }));
6746)                 }
6747)                 break;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6748)             }
6749)             case "ant": {
Christian Fraß update

Christian Fraß authored 6 years ago

6750)                 return (new lib_ant.class_action(new lib_xml.class_node_complex("concat", { "destfile": this.destination.as_string("linux") }, [
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6751)                     new lib_xml.class_node_complex("filelist", { "dir": "." }, this.sources.map(function (source) {
Christian Fraß update

Christian Fraß authored 6 years ago

6752)                         return (new lib_xml.class_node_complex("file", { "name": source.as_string("linux") }));
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6753)                     }))
6754)                 ])));
Christian Fraß update

Christian Fraß authored 6 years ago

6755)                 break;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6756)             }
6757)             default: {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6758)                 throw (new Error("unhandled output '" + output_identifier + "'"));
Christian Fraß update

Christian Fraß authored 6 years ago

6759)                 break;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6760)             }
6761)         }
6762)     };
6763)     return class_action_concat;
6764) }(class_action_adhoc));
6765) /**
6766)  * @author fenris
6767)  */
6768) var class_action_lessc = (function (_super) {
6769)     __extends(class_action_lessc, _super);
6770)     /**
6771)      * @author fenris
6772)      */
6773)     function class_action_lessc(filepointer_from, filepointer_to) {
Christian Fraß update

Christian Fraß authored 6 years ago

6774)         var _this = _super.call(this) || this;
6775)         _this.filepointer_from = filepointer_from;
6776)         _this.filepointer_to = filepointer_to;
6777)         return _this;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6778)     }
6779)     /**
Christian Fraß update

Christian Fraß authored 6 years ago

6780)      * @override
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6781)      * @author fenris
6782)      */
6783)     class_action_lessc.prototype.compilation = function (target_identifier) {
Christian Fraß update

Christian Fraß authored 6 years ago

6784)         var args = [];
6785)         args.push(this.filepointer_from.as_string(globalvars.configuration.system));
6786)         var cmdparams = {
6787)             "path": "lessc",
6788)             "args": args,
6789)             "output": this.filepointer_to.as_string(globalvars.configuration.system),
6790)         };
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6791)         switch (target_identifier) {
6792)             case "gnumake": {
Christian Fraß update

Christian Fraß authored 6 years ago

6793)                 return lib_gnumake.macro_command(cmdparams);
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6794)                 break;
6795)             }
6796)             case "ant": {
Christian Fraß update

Christian Fraß authored 6 years ago

6797)                 return lib_ant.class_action.macro_command(cmdparams);
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6798)                 break;
6799)             }
6800)             default: {
6801)                 throw (new Error("unhandled target '" + target_identifier + "'"));
6802)                 break;
6803)             }
6804)         }
6805)     };
6806)     return class_action_lessc;
6807) }(class_action_adhoc));
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6808) /**
6809)  * @author neu3no
6810)  */
6811) var class_action_babel = (function (_super) {
6812)     __extends(class_action_babel, _super);
6813)     /**
6814)      * @author neu3no
6815)      */
6816)     function class_action_babel(filepointers_from, filepointer_to, preset, minify) {
Christian Fraß update

Christian Fraß authored 6 years ago

6817)         var _this = _super.call(this) || this;
6818)         _this.filepointers_from = filepointers_from;
6819)         _this.filepointer_to = filepointer_to;
6820)         _this.preset = preset;
6821)         _this.minify = minify;
6822)         return _this;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6823)     }
6824)     /**
Christian Fraß update

Christian Fraß authored 6 years ago

6825)      * @override
6826)      * @author neu3no,fenris
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6827)      */
6828)     class_action_babel.prototype.compilation = function (target_identifier) {
Christian Fraß update

Christian Fraß authored 6 years ago

6829)         var args = [];
6830)         args.push("--no-babelrc");
6831)         // input
6832)         {
6833)             this.filepointers_from.forEach(function (filepointer) { return args.push(filepointer.as_string(globalvars.configuration.system)); });
6834)         }
6835)         // output
6836)         {
6837)             args.push("--out-file");
6838)             args.push(this.filepointer_to.as_string(globalvars.configuration.system));
6839)         }
6840)         // presets
6841)         {
6842)             var presets = [];
6843)             if (this.preset !== null) {
6844)                 presets.push(this.preset);
6845)             }
6846)             if (this.minify) {
6847)                 args.push("--minified");
6848)             }
6849)             if (presets.length > 0) {
6850)                 args.push("--presets");
6851)                 args.push(presets.join(","));
6852)             }
6853)         }
6854)         var cmdparams = {
6855)             "path": "babel",
6856)             "args": args,
6857)             "output": this.filepointer_to.as_string(globalvars.configuration.system),
6858)         };
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6859)         switch (target_identifier) {
6860)             case "gnumake": {
Christian Fraß update

Christian Fraß authored 6 years ago

6861)                 return lib_gnumake.macro_command(cmdparams);
6862)                 break;
6863)             }
6864)             case "ant": {
6865)                 return lib_ant.class_action.macro_command(cmdparams);
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6866)                 break;
6867)             }
6868)             default: {
6869)                 throw (new Error("unhandled target '" + target_identifier + "'"));
Christian Fraß update

Christian Fraß authored 6 years ago

6870)                 break;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6871)             }
6872)         }
6873)     };
6874)     return class_action_babel;
6875) }(class_action_adhoc));
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6876) /**
6877)  * @author fenris
6878)  */
6879) var class_action_tsc = (function (_super) {
6880)     __extends(class_action_tsc, _super);
6881)     /**
6882)      * @author fenris
6883)      */
6884)     function class_action_tsc(paths_input, path_output, target, allowUnreachableCode, declaration) {
Christian Fraß update

Christian Fraß authored 6 years ago

6885)         var _this = _super.call(this) || this;
6886)         _this.paths_input = paths_input;
6887)         _this.path_output = path_output;
6888)         _this.target = target;
6889)         _this.allowUnreachableCode = allowUnreachableCode;
6890)         _this.declaration = declaration;
6891)         return _this;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6892)     }
6893)     /**
6894)      * @author fenris
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6895)      * @todo handle declarion-path
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6896)      */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6897)     class_action_tsc.prototype.compilation = function (output_identifier) {
6898)         var args = [];
6899)         {
6900)             if (this.allowUnreachableCode) {
6901)                 args.push("--allowUnreachableCode");
6902)             }
6903)         }
6904)         {
6905)             if (this.target != null) {
6906)                 args.push("--target");
6907)                 args.push(this.target);
6908)             }
6909)         }
6910)         {
Christian Fraß update

Christian Fraß authored 6 years ago

6911)             this.paths_input.forEach(function (filepointer) { return args.push(filepointer.as_string(globalvars.configuration.system)); });
6912)         }
6913)         {
6914)             if (this.declaration != null) {
6915)                 args.push("--declaration");
6916)             }
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6917)         }
6918)         {
6919)             args.push("--outFile");
Christian Fraß update

Christian Fraß authored 6 years ago

6920)             args.push(this.path_output.as_string(globalvars.configuration.system));
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6921)         }
6922)         var cmdparams = {
6923)             "path": "tsc",
6924)             "args": args,
Christian Fraß update

Christian Fraß authored 6 years ago

6925)             "system": globalvars.configuration.system,
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6926)         };
6927)         switch (output_identifier) {
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6928)             case "gnumake": {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6929)                 return lib_gnumake.macro_command(cmdparams);
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6930)                 break;
6931)             }
6932)             case "ant": {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6933)                 return lib_ant.class_action.macro_command(cmdparams);
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6934)                 break;
6935)             }
6936)             default: {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6937)                 throw (new Error("unhandled output '" + output_identifier + "'"));
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6938)                 break;
6939)             }
6940)         }
6941)     };
6942)     return class_action_tsc;
6943) }(class_action_adhoc));
6944) /**
6945)  * @author fenris
6946)  */
6947) var class_action_php = (function (_super) {
6948)     __extends(class_action_php, _super);
6949)     /**
6950)      * @author fenris
6951)      */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6952)     function class_action_php(filepointers_from, filepointer_to, only_first, only_last) {
Christian Fraß update

Christian Fraß authored 6 years ago

6953)         var _this = _super.call(this) || this;
6954)         _this.filepointers_from = filepointers_from;
6955)         _this.filepointer_to = filepointer_to;
6956)         _this.only_first = only_first;
6957)         _this.only_last = only_last;
6958)         return _this;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6959)     }
6960)     /**
6961)      * @desc for defining directly how the action is to be converted into a target-piece
6962)      * @author fenris
6963)      */
6964)     class_action_php.prototype.compilation = function (target_identifier) {
6965)         switch (target_identifier) {
6966)             case "gnumake": {
Christian Fraß update

Christian Fraß authored 6 years ago

6967)                 switch (globalvars.configuration.system) {
6968)                     case "bsd":
6969)                     case "linux": {
6970)                         var parts_3 = [];
6971)                         parts_3.push("php");
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6972)                         if (this.only_last) {
Christian Fraß update

Christian Fraß authored 6 years ago

6973)                             parts_3.push(this.filepointers_from.slice(-1)[0].toString());
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6974)                         }
6975)                         else {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6976)                             if (this.only_first) {
Christian Fraß update

Christian Fraß authored 6 years ago

6977)                                 parts_3.push(this.filepointers_from[0].toString());
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6978)                             }
6979)                             else {
Christian Fraß update

Christian Fraß authored 6 years ago

6980)                                 this.filepointers_from.forEach(function (filepointer) { return parts_3.push(filepointer.toString()); });
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6981)                             }
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6982)                         }
Christian Fraß update

Christian Fraß authored 6 years ago

6983)                         parts_3.push(">");
6984)                         parts_3.push(this.filepointer_to.toString());
6985)                         return parts_3.join(" ");
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6986)                         break;
6987)                     }
6988)                     default: {
6989)                         throw (new Error("not implemented"));
6990)                         break;
6991)                     }
6992)                 }
6993)                 break;
6994)             }
6995)             case "ant": {
6996)                 throw (new Error("not implemented"));
6997)                 break;
6998)             }
6999)             default: {
7000)                 throw (new Error("unhandled target '" + target_identifier + "'"));
7001)                 break;
7002)             }
7003)         }
7004)     };
7005)     return class_action_php;
7006) }(class_action_adhoc));
7007) /**
7008)  * @author fenris
7009)  */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7010) var class_action_gitpull = (function (_super) {
7011)     __extends(class_action_gitpull, _super);
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7012)     /**
7013)      * @author fenris
7014)      */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7015)     function class_action_gitpull(url) {
Christian Fraß update

Christian Fraß authored 6 years ago

7016)         var _this = _super.call(this) || this;
7017)         _this.url = url;
7018)         return _this;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7019)     }
7020)     /**
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7021)      * @desc for defining directly how the action is to be converted into a target-piece
7022)      * @todo escape message
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7023)      * @author fenris
7024)      */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7025)     class_action_gitpull.prototype.compilation = function (target_identifier) {
7026)         switch (target_identifier) {
7027)             case "gnumake": {
Christian Fraß update

Christian Fraß authored 6 years ago

7028)                 switch (globalvars.configuration["system"]) {
7029)                     case "linux":
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7030)                     case "win": {
7031)                         var parts = [];
7032)                         parts.push("git pull");
7033)                         parts.push(this.url);
7034)                         return parts.join(" ");
7035)                         break;
7036)                     }
7037)                     default: {
7038)                         throw (new Error("not implemented"));
7039)                         break;
7040)                     }
7041)                 }
7042)                 break;
7043)             }
7044)             /*
7045)             case "ant": {
7046)                 return (
7047)                     new lib_ant.class_action(
7048)                         new lib_xml.class_node_complex(
7049)                             "echo",
7050)                             {"message": this.message}
7051)                         )
7052)                     )
7053)                 );
7054)                 break;
7055)             }
7056)              */
7057)             default: {
7058)                 throw (new Error("unhandled target '" + target_identifier + "'"));
7059)                 break;
7060)             }
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7061)         }
7062)     };
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7063)     return class_action_gitpull;
7064) }(class_action_adhoc));
Christian Fraß update

Christian Fraß authored 6 years ago

7065) /**
7066)  * @author fenris
7067)  */
7068) var class_action_schwamm = (function (_super) {
7069)     __extends(class_action_schwamm, _super);
7070)     /**
7071)      * @author fenris
7072)      */
7073)     function class_action_schwamm(includes, inputs, save, dump_group, dump_filepointer, locmerge_domain, locmerge_identifier, locmerge_filepointer) {
7074)         if (dump_group === void 0) { dump_group = null; }
7075)         if (dump_filepointer === void 0) { dump_filepointer = null; }
7076)         if (locmerge_domain === void 0) { locmerge_domain = null; }
7077)         if (locmerge_identifier === void 0) { locmerge_identifier = null; }
7078)         if (locmerge_filepointer === void 0) { locmerge_filepointer = null; }
7079)         var _this = _super.call(this) || this;
7080)         _this.includes = includes;
7081)         _this.inputs = inputs;
7082)         _this.save = save;
7083)         _this.dump_group = dump_group;
7084)         _this.dump_filepointer = dump_filepointer;
7085)         _this.locmerge_domain = locmerge_domain;
7086)         _this.locmerge_identifier = locmerge_identifier;
7087)         _this.locmerge_filepointer = locmerge_filepointer;
7088)         return _this;
7089)     }
7090)     /**
7091)      * @desc for defining directly how the action is to be converted into a target-piece
7092)      * @author fenris
7093)      */
7094)     class_action_schwamm.prototype.compilation = function (target_identifier) {
7095)         var args = [];
7096)         this.includes.forEach(function (include) {
7097)             args.push("--include=" + include.as_string(globalvars.configuration["system"]));
7098)         });
7099)         lib_object.to_array(this.inputs).forEach(function (pair) {
7100)             pair.value.forEach(function (member) {
7101)                 var filepointer = member;
7102)                 args.push("--input=" + filepointer.as_string(globalvars.configuration["system"]) + ":" + pair.key);
7103)             });
7104)         });
7105)         // args.push(`--file=${this.output.as_string(globalvars.configuration["system"])}`);
7106)         // args.push(`--dir=${((this.dir != null) ? this.dir : this.output.location).as_string("system")}`);
7107)         var target;
7108)         if (this.save != undefined) {
7109)             args.push("--output=native");
7110)             target = this.save;
7111)         }
7112)         else if (this.dump_group != null) {
7113)             args.push("--output=dump:" + this.dump_group);
7114)             target = this.dump_filepointer;
7115)         }
7116)         else if (this.locmerge_domain != null) {
7117)             args.push("--output=locmerge:" + this.locmerge_domain + ":" + this.locmerge_identifier);
7118)             target = this.locmerge_filepointer;
7119)         }
7120)         else {
7121)             console.warn("output missing?");
7122)         }
7123)         var cmdparams = {
7124)             "path": "schwamm",
7125)             "args": args,
7126)             "output": target.as_string(globalvars.configuration["system"]),
7127)         };
7128)         switch (target_identifier) {
7129)             case "gnumake": {
7130)                 return lib_gnumake.macro_command(cmdparams);
7131)                 break;
7132)             }
7133)             case "ant": {
7134)                 return lib_ant.class_action.macro_command(cmdparams);
7135)                 break;
7136)             }
7137)             default: {
7138)                 throw (new Error("unhandled target '" + target_identifier + "'"));
7139)                 break;
7140)             }
7141)         }
7142)     };
7143)     return class_action_schwamm;
7144) }(class_action_adhoc));
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7145) /**
7146)  * @author fenris
7147)  */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7148) var class_action_schwamm_create = (function (_super) {
7149)     __extends(class_action_schwamm_create, _super);
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7150)     /**
7151)      * @author fenris
7152)      */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7153)     function class_action_schwamm_create(includes, adhoc, output, dir) {
Christian Fraß update

Christian Fraß authored 6 years ago

7154)         var _this = _super.call(this) || this;
7155)         _this.includes = includes;
7156)         _this.adhoc = adhoc;
7157)         _this.output = output;
7158)         _this.dir = dir;
7159)         return _this;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7160)     }
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7161)     /**
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7162)      * @desc for defining directly how the action is to be converted into a target-piece
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7163)      * @author fenris
7164)      */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7165)     class_action_schwamm_create.prototype.compilation = function (target_identifier) {
7166)         var _this = this;
7167)         var args = [];
7168)         this.includes.forEach(function (include) {
Christian Fraß update

Christian Fraß authored 6 years ago

7169)             args.push("--include=" + include.as_string(globalvars.configuration["system"]));
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7170)         });
7171)         Object.keys(this.adhoc).forEach(function (group) {
7172)             _this.adhoc[group].forEach(function (member) {
7173)                 var filepointer = member;
Christian Fraß update

Christian Fraß authored 6 years ago

7174)                 args.push("--input=" + filepointer.as_string(globalvars.configuration["system"]) + ":" + group);
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7175)             });
7176)         });
Christian Fraß update

Christian Fraß authored 6 years ago

7177)         args.push("--output=native");
7178)         // args.push(`--file=${this.output.as_string(globalvars.configuration["system"])}`);
7179)         // args.push(`--dir=${((this.dir != null) ? this.dir : this.output.location).as_string("linux")}`);
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7180)         var cmdparams = {
7181)             "path": "schwamm",
7182)             "args": args,
Christian Fraß update

Christian Fraß authored 6 years ago

7183)             "output": this.output.as_string(globalvars.configuration["system"]),
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7184)         };
7185)         switch (target_identifier) {
7186)             case "gnumake": {
7187)                 return lib_gnumake.macro_command(cmdparams);
7188)                 break;
7189)             }
7190)             case "ant": {
7191)                 return lib_ant.class_action.macro_command(cmdparams);
7192)                 break;
7193)             }
7194)             default: {
7195)                 throw (new Error("unhandled target '" + target_identifier + "'"));
7196)                 break;
7197)             }
7198)         }
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7199)     };
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7200)     return class_action_schwamm_create;
7201) }(class_action_adhoc));
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7202) /**
7203)  * @author fenris
7204)  */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7205) var class_action_schwamm_apply = (function (_super) {
7206)     __extends(class_action_schwamm_apply, _super);
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7207)     /**
7208)      * @author fenris
7209)      */
Christian Fraß update

Christian Fraß authored 6 years ago

7210)     function class_action_schwamm_apply(path, output_group, output_filepointer) {
7211)         var _this = _super.call(this) || this;
7212)         _this.path = path;
7213)         _this.output_group = output_group;
7214)         _this.output_filepointer = output_filepointer;
7215)         return _this;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7216)     }
7217)     /**
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7218)      * @desc for defining directly how the action is to be converted into a target-piece
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7219)      * @author fenris
7220)      */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7221)     class_action_schwamm_apply.prototype.compilation = function (target_identifier) {
7222)         var args = [];
Christian Fraß update

Christian Fraß authored 6 years ago

7223)         args.push("--include=" + this.path.as_string(globalvars.configuration["system"]));
7224)         args.push("--output=dump:" + this.output_group);
7225)         var filepointer = lib_path.filepointer_read(globalvars.configuration["path"]).foo(this.output_filepointer);
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7226)         var cmdparams = {
7227)             "path": "schwamm",
7228)             "args": args,
Christian Fraß update

Christian Fraß authored 6 years ago

7229)             "output": filepointer.as_string(globalvars.configuration["system"]),
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7230)         };
7231)         switch (target_identifier) {
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7232)             case "gnumake": {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7233)                 return lib_gnumake.macro_command(cmdparams);
7234)                 break;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7235)             }
7236)             case "ant": {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7237)                 return lib_ant.class_action.macro_command(cmdparams);
7238)                 break;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7239)             }
7240)             default: {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7241)                 throw (new Error("unhandled target '" + target_identifier + "'"));
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7242)                 break;
7243)             }
7244)         }
7245)     };
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7246)     return class_action_schwamm_apply;
7247) }(class_action_adhoc));
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7248) /**
7249)  * @author fenris
7250)  */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7251) var class_taskparameter = (function () {
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7252)     /**
7253)      * @author fenris
7254)      */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7255)     function class_taskparameter(_a) {
7256)         var type = _a["type"], name = _a["name"], key = _a["key"], mandatory = _a["mandatory"], default_ = _a["default"], description = _a["description"];
7257)         this.type = type;
7258)         this.name = name;
7259)         this.key = key;
7260)         this.mandatory = mandatory;
7261)         this.default_ = default_;
7262)         this.description = description;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7263)     }
7264)     /**
7265)      * @author fenris
7266)      */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7267)     class_taskparameter.prototype.toString = function () {
7268)         var str = "";
7269)         // name
7270)         {
7271)             str = "" + this.name;
7272)         }
7273)         // type
7274)         {
7275)             str = str + " : " + this.type.toString();
7276)         }
7277)         // mandatory & default
7278)         {
7279)             if (this.mandatory) {
7280)             }
7281)             else {
7282)                 str = "[" + str + " = " + String(this.default_) + "]";
7283)             }
7284)         }
7285)         // description
7286)         {
7287)             str = str + " -- " + this.description;
7288)         }
7289)         return str;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7290)     };
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7291)     return class_taskparameter;
7292) }());
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7293) /**
7294)  * @author fenris
7295)  */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7296) var class_task = (function () {
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7297)     /**
7298)      * @author fenris
7299)      */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7300)     function class_task(name, sub, active, _inputs, _outputs, _actions) {
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7301)         if (sub === void 0) { sub = []; }
7302)         if (active === void 0) { active = true; }
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7303)         if (_inputs === void 0) { _inputs = []; }
7304)         if (_outputs === void 0) { _outputs = []; }
7305)         if (_actions === void 0) { _actions = []; }
7306)         this.identifier = lib_string.generate("task_");
7307)         this.name = ((name != null) ? name : this.identifier);
7308)         this.sub = sub;
7309)         this.active = active;
7310)         this._inputs = _inputs;
7311)         this._outputs = _outputs;
7312)         this._actions = _actions;
7313)         // this.parameters = parameters;
Christian Fraß update

Christian Fraß authored 6 years ago

7314)         this.context = null;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7315)     }
7316)     /**
Christian Fraß update

Christian Fraß authored 6 years ago

7317)      * @desc [accessor] [getter]
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7318)      * @author fenris
7319)      */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7320)     class_task.prototype.identifier_get = function () {
7321)         return this.identifier;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7322)     };
7323)     /**
Christian Fraß update

Christian Fraß authored 6 years ago

7324)      * @desc [accessor] [getter]
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7325)      * @author fenris
7326)      */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7327)     class_task.prototype.name_get = function () {
7328)         return this.name;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7329)     };
7330)     /**
Christian Fraß update

Christian Fraß authored 6 years ago

7331)      * @desc [accessor] [getter]
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7332)      * @author fenris
7333)      */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7334)     class_task.prototype.sub_get = function () {
7335)         return this.sub;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7336)     };
7337)     /**
Christian Fraß update

Christian Fraß authored 6 years ago

7338)      * @desc [accessor] [getter]
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7339)      * @author fenris
7340)      */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7341)     class_task.prototype.active_get = function () {
7342)         return this.active;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7343)     };
Christian Fraß update

Christian Fraß authored 6 years ago

7344)     /**
7345)      * @desc [mutator] [setter]
7346)      * @author fenris
7347)      */
7348)     class_task.prototype.context_set = function (context) {
7349)         this.context = context;
7350)     };
7351)     /**
7352)      * @desc [accessor] [getter]
7353)      * @author fenris
7354)      */
7355)     class_task.prototype.context_get = function () {
7356)         return this.context;
7357)     };
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7358)     /**
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7359)      * @returns the subgraph of all active tasks
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7360)      * @author fenris
7361)      */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7362)     class_task.prototype.clean = function (root) {
7363)         if (root === void 0) { root = true; }
7364)         if (root && (!this.active)) {
7365)             throw (new Error("cant't clean inactive root"));
7366)         }
7367)         else {
7368)             this.sub = this.sub.filter(function (task_) { return task_.active; });
7369)             this.sub.forEach(function (task_) { return task_.clean(false); });
7370)         }
7371)     };
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7372)     /**
Christian Fraß update

Christian Fraß authored 6 years ago

7373)      * @desc [accessor] [getter]
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7374)      * @author fenris
7375)      */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7376)     class_task.prototype.values = function (raw) {
7377)         return null;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7378)     };
7379)     /**
Christian Fraß update

Christian Fraß authored 6 years ago

7380)      * @desc [accessor] [getter] a list of paths which represent input-files of the task
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7381)      * @author fenris
7382)      */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7383)     class_task.prototype.inputs = function () {
7384)         return this._inputs;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7385)     };
7386)     /**
Christian Fraß update

Christian Fraß authored 6 years ago

7387)      * @desc [accessor] [getter] a list of paths which represent output-files of the task
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7388)      * @author fenris
7389)      */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7390)     class_task.prototype.outputs = function () {
7391)         return this._outputs;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7392)     };
7393)     /**
Christian Fraß update

Christian Fraß authored 6 years ago

7394)      * @desc [accessor] [getter] generates all actions which have to be executed in order to fulfil the task
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7395)      * @author fenris
7396)      */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7397)     class_task.prototype.actions = function () {
7398)         return this._actions;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7399)     };
Christian Fraß update

Christian Fraß authored 6 years ago

7400)     /**
7401)      * @author fenris
7402)      */
7403)     class_task.create = function (_a, nameprefix) {
7404)         var _b = _a["name"], name = _b === void 0 ? null : _b, _c = _a["type"], type = _c === void 0 ? null : _c, _d = _a["sub"], sub = _d === void 0 ? [] : _d, _e = _a["active"], active = _e === void 0 ? true : _e, _f = _a["parameters"], parameters = _f === void 0 ? {} : _f;
7405)         if (nameprefix === void 0) { nameprefix = null; }
7406)         return (class_task.get(type)(((nameprefix == null) ? "" + name : nameprefix + "-" + name), sub.map(function (rawtask) { return class_task.create(rawtask, nameprefix); }), active, parameters));
7407)     };
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7408)     /**
7409)      * @author fenris
7410)      */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7411)     class_task.register = function (id, factory) {
7412)         this.pool[id] = factory;
7413)     };
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7414)     /**
7415)      * @author fenris
7416)      */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7417)     class_task.get = function (id) {
7418)         if (id in this.pool) {
7419)             return this.pool[id];
7420)         }
7421)         else {
7422)             throw (new Error("no task registered with id '" + id + "'"));
7423)         }
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7424)     };
7425)     /**
7426)      * @author fenris
7427)      */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7428)     class_task.list = function () {
7429)         return Object.keys(this.pool);
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7430)     };
7431)     /**
7432)      * @author fenris
7433)      */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7434)     class_task.errormessage_mandatoryparamater = function (type, name, fieldname) {
7435)         return "mandatory paramater '" + fieldname + "' missing in " + type + "-task '" + name + "'";
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7436)     };
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7437)     return class_task;
7438) }());
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7439) /**
7440)  * @author fenris
7441)  */
Christian Fraß update

Christian Fraß authored 6 years ago

7442) class_task.pool = {};
7443) /**
7444)  * @author fenris
7445)  */
7446) var class_task_empty = (function (_super) {
7447)     __extends(class_task_empty, _super);
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7448)     /**
7449)      * @author fenris
7450)      */
Christian Fraß update

Christian Fraß authored 6 years ago

7451)     function class_task_empty(_a) {
7452)         var name = _a["name"], sub = _a["sub"], active = _a["active"], _b = _a["parameters"]["output"], output_raw = _b === void 0 ? undefined : _b;
7453)         var _this = this;
7454)         if (output_raw == undefined) {
7455)             throw (new Error(class_task.errormessage_mandatoryparamater("empty", name, "output")));
7456)         }
7457)         var output = lib_call.use(output_raw, function (x) { return lib_path.filepointer_read(x); });
7458)         _this = _super.call(this, name, sub, active, [], [output], [
7459)             new class_action_mkdir(output.location),
7460)             new class_action_touch(output),
7461)         ]) || this;
7462)         return _this;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7463)     }
Christian Fraß update

Christian Fraß authored 6 years ago

7464)     return class_task_empty;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7465) }(class_task));
Christian Fraß update

Christian Fraß authored 6 years ago

7466) class_task.register("empty", function (name, sub, active, parameters) { return new class_task_empty({
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7467)     "name": name, "sub": sub, "active": active,
7468)     "parameters": parameters,
7469) }); });
7470) /**
7471)  * @author fenris
7472)  */
Christian Fraß update

Christian Fraß authored 6 years ago

7473) var class_task_group = (function (_super) {
7474)     __extends(class_task_group, _super);
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7475)     /**
7476)      * @author fenris
7477)      */
Christian Fraß update

Christian Fraß authored 6 years ago

7478)     function class_task_group(_a) {
7479)         var name = _a["name"], sub = _a["sub"], active = _a["active"], _b = _a["parameters"];
7480)         return _super.call(this, name, sub, active, [], [], []) || this;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7481)     }
Christian Fraß update

Christian Fraß authored 6 years ago

7482)     return class_task_group;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7483) }(class_task));
Christian Fraß update

Christian Fraß authored 6 years ago

7484) class_task.register("group", function (name, sub, active, parameters) { return new class_task_group({
7485)     "name": name, "sub": sub, "active": active,
7486)     "parameters": parameters,
7487) }); });
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7488) /**
7489)  * @author fenris
7490)  */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7491) var class_task_script = (function (_super) {
7492)     __extends(class_task_script, _super);
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7493)     /**
7494)      * @author fenris
7495)      */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7496)     function class_task_script(_a) {
7497)         var name = _a["name"], sub = _a["sub"], active = _a["active"], _b = _a["parameters"], _c = _b["path"], path_raw = _c === void 0 ? undefined : _c, _d = _b["interpreter"], interpreter_raw = _d === void 0 ? null : _d, _e = _b["workdir"], workdir_raw = _e === void 0 ? null : _e, _f = _b["inputs"], inputs_raw = _f === void 0 ? [] : _f, _g = _b["outputs"], outputs_raw = _g === void 0 ? [] : _g;
Christian Fraß update

Christian Fraß authored 6 years ago

7498)         var _this = this;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7499)         if (path_raw == undefined) {
7500)             throw (new Error(class_task.errormessage_mandatoryparamater("script", name, "path")));
7501)         }
7502)         var path = lib_call.use(path_raw, function (x) { return lib_path.filepointer_read(x); });
7503)         var workdir = lib_call.use(workdir_raw, function (x) { return ((x == null) ? null : lib_path.location_read(x)); });
7504)         var interpreter = lib_call.use(interpreter_raw, function (x) { return ((x == null) ? null : lib_path.filepointer_read(x)); });
7505)         var inputs = lib_call.use(inputs_raw, function (x) { return x.map(function (y) { return lib_path.filepointer_read(y); }); });
7506)         var outputs = lib_call.use(outputs_raw, function (x) { return x.map(function (y) { return lib_path.filepointer_read(y); }); });
Christian Fraß update

Christian Fraß authored 6 years ago

7507)         _this = _super.call(this, name, sub, active, inputs, outputs, ([]
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7508)             .concat(outputs.map(function (output) { return new class_action_mkdir(output.location); }))
7509)             .concat([
7510)             new class_action_exec({
7511)                 "inputs": inputs,
7512)                 "outputs": outputs,
7513)                 "path": path,
7514)                 "interpreter": interpreter,
7515)                 "workdir": workdir,
7516)             }),
Christian Fraß update

Christian Fraß authored 6 years ago

7517)         ]))) || this;
7518)         return _this;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7519)     }
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7520)     return class_task_script;
7521) }(class_task));
7522) class_task.register("script", function (name, sub, active, parameters) { return new class_task_script({
7523)     "name": name, "sub": sub, "active": active,
7524)     "parameters": parameters,
7525) }); });
7526) /**
7527)  * @author fenris
7528)  */
7529) var class_task_copy = (function (_super) {
7530)     __extends(class_task_copy, _super);
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7531)     /**
7532)      * @author fenris
7533)      */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7534)     function class_task_copy(_a) {
7535)         var name = _a["name"], sub = _a["sub"], active = _a["active"], _b = _a["parameters"], _c = _b["input"], input_raw = _c === void 0 ? null : _c, _d = _b["output"], output_raw = _d === void 0 ? null : _d, _e = _b["folder"], folder = _e === void 0 ? false : _e;
Christian Fraß update

Christian Fraß authored 6 years ago

7536)         var _this = this;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7537)         if (input_raw == undefined) {
7538)             throw (new Error(class_task.errormessage_mandatoryparamater("copy", name, "input")));
7539)         }
7540)         var input = lib_call.use(input_raw, function (x) { return lib_path.filepointer_read(x); });
7541)         if (output_raw == undefined) {
7542)             throw (new Error(class_task.errormessage_mandatoryparamater("copy", name, "output")));
7543)         }
7544)         var output = lib_call.use(output_raw, function (x) { return lib_path.filepointer_read(x); });
Christian Fraß update

Christian Fraß authored 6 years ago

7545)         _this = _super.call(this, name, sub, active, folder ? [] : [input], folder ? [] : [output], [
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7546)             new class_action_mkdir(output.location),
7547)             new class_action_copy(input, output, folder),
Christian Fraß update

Christian Fraß authored 6 years ago

7548)         ]) || this;
7549)         return _this;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7550)     }
7551)     return class_task_copy;
7552) }(class_task));
7553) class_task.register("copy", function (name, sub, active, parameters) { return new class_task_copy({
7554)     "name": name, "sub": sub, "active": active,
7555)     "parameters": parameters,
7556) }); });
7557) /**
7558)  * @author fenris
7559)  */
7560) var class_task_concat = (function (_super) {
7561)     __extends(class_task_concat, _super);
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7562)     /**
7563)      * @author fenris
7564)      */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7565)     function class_task_concat(_a) {
Christian Fraß update

Christian Fraß authored 6 years ago

7566)         var name = _a["name"], sub = _a["sub"], active = _a["active"], _b = _a["parameters"], _c = _b["inputs"], inputs_raw = _c === void 0 ? [] : _c, _d = _b["input_from_schwamm"], schwamminput_raw = _d === void 0 ? null : _d, _e = _b["output"], output_raw = _e === void 0 ? undefined : _e;
7567)         var _this = this;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7568)         if (inputs_raw == undefined) {
7569)             throw (new Error(class_task.errormessage_mandatoryparamater("concat", name, "inputs")));
7570)         }
7571)         var inputs = lib_call.use(inputs_raw, function (x) { return x.map(function (y) { return lib_path.filepointer_read(y); }); });
Christian Fraß update

Christian Fraß authored 6 years ago

7572)         var schwamminput = ((schwamminput_raw == null)
7573)             ? null
7574)             : {
7575)                 "path": lib_path.filepointer_read(schwamminput_raw.path),
7576)                 "group": schwamminput_raw.group,
7577)             });
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7578)         if (output_raw == undefined) {
7579)             throw (new Error(class_task.errormessage_mandatoryparamater("concat", name, "output")));
7580)         }
7581)         var output = lib_call.use(output_raw, function (x) { return lib_path.filepointer_read(x); });
Christian Fraß update

Christian Fraß authored 6 years ago

7582)         _this = _super.call(this, name, sub, active, ([]
7583)             .concat(inputs)
7584)             .concat((schwamminput == null)
7585)             ? []
7586)             : [schwamminput.path])), [output], [
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7587)             new class_action_mkdir(output.location),
7588)             new class_action_concat(inputs, output),
Christian Fraß update

Christian Fraß authored 6 years ago

7589)         ]) || this;
7590)         return _this;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7591)     }
7592)     return class_task_concat;
7593) }(class_task));
7594) class_task.register("concat", function (name, sub, active, parameters) { return new class_task_concat({
7595)     "name": name, "sub": sub, "active": active,
7596)     "parameters": parameters,
7597) }); });
7598) /**
7599)  * @author fenris
7600)  */
7601) var class_task_lesscss = (function (_super) {
7602)     __extends(class_task_lesscss, _super);
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7603)     /**
7604)      * @author fenris
7605)      */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7606)     function class_task_lesscss(_a) {
7607)         var name = _a["name"], sub = _a["sub"], active = _a["active"], _b = _a["parameters"], _c = _b["inputs"], inputs_raw = _c === void 0 ? [] : _c, _d = _b["output"], output_raw = _d === void 0 ? undefined : _d;
Christian Fraß update

Christian Fraß authored 6 years ago

7608)         var _this = this;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7609)         if (inputs_raw == undefined) {
7610)             throw (new Error(class_task.errormessage_mandatoryparamater("lesscss", name, "inputs")));
7611)         }
7612)         var inputs = lib_call.use(inputs_raw, function (x) { return x.map(function (y) { return lib_path.filepointer_read(y); }); });
7613)         if (output_raw == undefined) {
7614)             throw (new Error(class_task.errormessage_mandatoryparamater("lesscss", name, "output")));
7615)         }
7616)         var output = lib_call.use(output_raw, function (x) { return lib_path.filepointer_read(x); });
Christian Fraß update

Christian Fraß authored 6 years ago

7617)         var filepointer_temp = new lib_path.class_filepointer(lib_path.location_read(globalvars.configuration["tempfolder"]), "_.less");
7618)         _this = _super.call(this, name, sub, active, inputs, [output], [
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7619)             new class_action_mkdir(output.location),
7620)             new class_action_concat(inputs, filepointer_temp),
7621)             new class_action_lessc(filepointer_temp, output),
Christian Fraß update

Christian Fraß authored 6 years ago

7622)         ]) || this;
7623)         return _this;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7624)     }
7625)     return class_task_lesscss;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7626) }(class_task));
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7627) class_task.register("lesscss", function (name, sub, active, parameters) { return new class_task_lesscss({
7628)     "name": name, "sub": sub, "active": active,
7629)     "parameters": parameters,
7630) }); });
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7631) /**
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7632)  * @author neu3no
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7633)  */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7634) var class_task_babel = (function (_super) {
7635)     __extends(class_task_babel, _super);
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7636)     /**
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7637)      * @author neu3no
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7638)      */
Christian Fraß update

Christian Fraß authored 6 years ago

7639)     function class_task_babel(_a) {
7640)         var name = _a["name"], sub = _a["sub"], active = _a["active"], _b = _a["parameters"], minify = _b["minify"], preset = _b["preset"], inputs_raw = _b["inputs"], output_raw = _b["output"];
7641)         var _this = this;
7642)         if (inputs_raw == undefined) {
7643)             throw (new Error(class_task.errormessage_mandatoryparamater("babel", name, "inputs")));
7644)         }
7645)         var inputs = lib_call.use(inputs_raw, function (x) { return x.map(function (y) { return lib_path.filepointer_read(y); }); });
7646)         if (output_raw == undefined) {
7647)             throw (new Error(class_task.errormessage_mandatoryparamater("babel", name, "output")));
7648)         }
7649)         var output = lib_call.use(output_raw, function (x) { return lib_path.filepointer_read(x); });
7650)         _this = _super.call(this, name, sub, active, inputs, [output], [
7651)             new class_action_mkdir(output.location),
7652)             new class_action_babel(inputs, output, preset, minify),
7653)         ]) || this;
7654)         return _this;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7655)     }
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7656)     return class_task_babel;
7657) }(class_task));
Christian Fraß update

Christian Fraß authored 6 years ago

7658) class_task.register("babel", function (name, sub, active, parameters) { return new class_task_babel({
7659)     "name": name, "sub": sub, "active": active,
7660)     "parameters": parameters,
7661) }); });
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7662) /**
7663)  * @author fenris
7664)  */
7665) var class_task_typescript = (function (_super) {
7666)     __extends(class_task_typescript, _super);
7667)     /**
7668)      * @author fenris
7669)      */
7670)     function class_task_typescript(_a) {
7671)         var name = _a["name"], sub = _a["sub"], active = _a["active"], _b = _a["parameters"], _c = _b["inputs"], inputs_raw = _c === void 0 ? [] : _c, _d = _b["output"], output_raw = _d === void 0 ? null : _d, _e = _b["target"], target = _e === void 0 ? null : _e, _f = _b["allowUnreachableCode"], allowUnreachableCode = _f === void 0 ? null : _f, _g = _b["declaration"], declaration_raw = _g === void 0 ? null : _g;
Christian Fraß update

Christian Fraß authored 6 years ago

7672)         var _this = this;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7673)         /*
7674)         [
7675)             new class_taskparameter<Array<string>, Array<lib_path.class_filepointer>>(
7676)                 {
7677)                     "name": "inputs",
7678)                     "type": {
7679)                         "id": "array",
7680)                         "parameters": {
7681)                             "type_element": {
7682)                                 "id": "string",
7683)                             },
7684)                         },
7685)                     },
7686)                     "mandatory": false,
7687)                     "default": [],
7688)                     "key": "inputs",
7689)                     "extraction": raw => lib_call.use(
7690)                         raw,
7691)                         x => x.map(y => lib_path.filepointer_read(y))
7692)                     ),
7693)                     "description": "the paths of the source files",
7694)                 }
7695)             ),
7696)             new class_taskparameter<string>(
7697)                 {
7698)                     "type": {
7699)                         "id": "string",
7700)                     },
7701)                     "name": "output",
7702)                     "key": "output",
7703)                     "mandatory": true,
7704)                     "default": null,
7705)                     "description": "the path of the file in which to write the compilation",
7706)                 }
7707)             ),
7708)             new class_taskparameter<string>(
7709)                 {
7710)                     "type": {
7711)                         "id": "string",
7712)                     },
7713)                     "name": "declaration",
7714)                     "key": "declaration",
7715)                     "mandatory": false,
7716)                     "default": null,
7717)                     "description": "the path of the file in which to write the declaration; if not set, no declaration-script will be created",
7718)                 }
7719)             ),
7720)             new class_taskparameter<string>(
7721)                 {
7722)                     "type": {
7723)                         "id": "string",
7724)                     },
7725)                     "name": "target",
7726)                     "key": "target",
7727)                     "mandatory": false,
7728)                     "default": null,
7729)                     "description": "the tsc-switch 'target'; default: don't specify",
7730)                 }
7731)             ),
7732)             new class_taskparameter<boolean>(
7733)                 {
7734)                     "type": {
7735)                         "id": "boolean",
7736)                     },
7737)                     "name": "allowUnreachableCode",
7738)                     "key": "allow_unreachable_code",
7739)                     "mandatory": false,
7740)                     "default": null,
7741)                     "description": "the tsc-switch 'allowUnreachableCode'; default: don't specify",
7742)                 }
7743)             ),
7744)         ]
7745)          */
7746)         var inputs = lib_call.use(inputs_raw, function (x) { return x.map(function (y) { return lib_path.filepointer_read(y); }); });
7747)         if (output_raw == undefined) {
7748)             throw (new Error(class_task.errormessage_mandatoryparamater("typescript", name, "output")));
7749)         }
7750)         var output = lib_call.use(output_raw, function (x) { return lib_path.filepointer_read(x); });
7751)         var declaration = lib_call.use(declaration_raw, function (x) { return ((x == null) ? null : lib_path.filepointer_read(x)); });
7752)         var original = lib_call.use(output_raw, lib_call.compose(function (x) { return x.replace(new RegExp(".js$"), ".d.ts"); }, function (x) { return lib_path.filepointer_read(x); }));
Christian Fraß update

Christian Fraß authored 6 years ago

7753)         _this = _super.call(this, name, sub, active, inputs, ([]
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7754)             .concat([output])
7755)             .concat((declaration == null)
7756)             ? []
7757)             : [declaration])), ([]
7758)             .concat([
7759)             new class_action_mkdir(output.location),
7760)             new class_action_tsc(inputs, output, target, allowUnreachableCode, declaration),
7761)         ])
7762)             .concat((declaration == null)
7763)             ?
7764)                 []
7765)             :
7766)                 [
7767)                     new class_action_mkdir(declaration.location),
7768)                     new class_action_move({
7769)                         "from": original,
7770)                         "to": declaration,
7771)                     }),
Christian Fraß update

Christian Fraß authored 6 years ago

7772)                 ]))) || this;
7773)         return _this;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7774)     }
7775)     return class_task_typescript;
7776) }(class_task));
7777) class_task.register("typescript", function (name, sub, active, parameters) { return new class_task_typescript({
7778)     "name": name, "sub": sub, "active": active,
7779)     "parameters": parameters,
7780) }); });
7781) /**
7782)  * @author fenris
7783)  */
7784) var class_task_php = (function (_super) {
7785)     __extends(class_task_php, _super);
7786)     /**
7787)      * @author fenris
7788)      */
7789)     function class_task_php(_a) {
7790)         var name = _a["name"], sub = _a["sub"], active = _a["active"], _b = _a["parameters"], _c = _b["inputs"], inputs_raw = _c === void 0 ? [] : _c, _d = _b["output"], output_raw = _d === void 0 ? null : _d, _e = _b["only_first"], only_first = _e === void 0 ? false : _e, _f = _b["only_last"], only_last = _f === void 0 ? false : _f;
Christian Fraß update

Christian Fraß authored 6 years ago

7791)         var _this = this;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7792)         var inputs = lib_call.use(inputs_raw, function (x) { return x.map(function (y) { return lib_path.filepointer_read(y); }); });
7793)         if (output_raw == undefined) {
7794)             throw (new Error(class_task.errormessage_mandatoryparamater("php", name, "output")));
7795)         }
7796)         var output = lib_call.use(output_raw, function (x) { return lib_path.filepointer_read(x); });
Christian Fraß update

Christian Fraß authored 6 years ago

7797)         _this = _super.call(this, name, sub, active, inputs, [output], [
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7798)             new class_action_mkdir(output.location),
7799)             new class_action_php(inputs, output, only_first, only_last),
Christian Fraß update

Christian Fraß authored 6 years ago

7800)         ]) || this;
7801)         return _this;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7802)     }
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7803)     return class_task_php;
7804) }(class_task));
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7805) class_task.register("php", function (name, sub, active, parameters) { return new class_task_php({
7806)     "name": name, "sub": sub, "active": active,
7807)     "parameters": parameters,
7808) }); });
Christian Fraß update

Christian Fraß authored 6 years ago

7809) /**
7810)  * @author fenris
7811)  */
7812) var class_task_schwamm = (function (_super) {
7813)     __extends(class_task_schwamm, _super);
7814)     /**
7815)      * @author fenris
7816)      */
7817)     function class_task_schwamm(_a) {
7818)         var name = _a["name"], sub = _a["sub"], active = _a["active"], _b = _a["parameters"], _c = _b["includes"], includes_raw = _c === void 0 ? [] : _c, _d = _b["inputs"], inputs_raw = _d === void 0 ? {} : _d, _e = _b["output"], _f = _e["save"], save_raw = _f === void 0 ? null : _f, _g = _e["dump"], dump_raw = _g === void 0 ? {} : _g, _h = _e["locmerge"], locmerge_raw = _h === void 0 ? {} : _h;
7819)         var _this = this;
7820)         var includes = lib_call.use(includes_raw, function (x) { return x.map(function (y) { return lib_path.filepointer_read(y); }); });
7821)         var inputs = lib_call.use(inputs_raw, function (x) { return lib_object.map(x, function (members) { return members.map(function (member) { return lib_path.filepointer_read(member); }); }); });
7822)         var save = lib_call.use(save_raw, function (y) { return ((y == null) ? null : lib_path.filepointer_read(y)); });
7823)         var dump = lib_call.use(dump_raw, function (x) { return lib_object.map(x, function (y) { return lib_path.filepointer_read(y); }); });
7824)         var locmerge = lib_call.use(locmerge_raw, function (x) { return lib_object.map(x, function (y) { return lib_object.map(y, function (z) { return lib_path.filepointer_read(z); }); }); });
7825)         _this = _super.call(this, name, sub, active, ([]
7826)             .concat(includes)
7827)             .concat(lib_object.values(inputs).reduce(function (x, y) { return x.concat(y); }, []))), ([]
7828)             .concat((save == null)
7829)             ? []
7830)             : [save])
7831)             .concat(lib_object.values(dump).reduce(function (x, y) { return x.concat(y); }, []))
7832)             .concat(lib_object.values(locmerge)
7833)             .map(function (z) { return lib_object.values(z).reduce(function (x, y) { return x.concat(y); }, []); })
7834)             .reduce(function (x, y) { return x.concat(y); }, []))), ([]
7835)             .concat((save == null)
7836)             ? []
7837)             : [
7838)                 new class_action_mkdir(save.location),
7839)                 new class_action_schwamm(includes, inputs, save),
7840)             ])
7841)             .concat(lib_object.to_array(dump)
7842)             .map(function (pair) { return [
7843)             new class_action_mkdir(pair.value.location),
7844)             new class_action_schwamm(includes, inputs, undefined, pair.key, pair.value),
7845)         ]; })
7846)             .reduce(function (x, y) { return x.concat(y); }, []))
7847)             .concat(lib_object.to_array(locmerge)
7848)             .map(function (pair) { return lib_object.to_array(pair.value)
7849)             .map(function (pair_) { return [
7850)             new class_action_mkdir(pair_.value.location),
7851)             new class_action_schwamm(includes, inputs, undefined, undefined, undefined, pair.key, pair_.key, pair_.value),
7852)         ]; })
7853)             .reduce(function (x, y) { return x.concat(y); }, []); })
7854)             .reduce(function (x, y) { return x.concat(y); }, [])))) || this;
7855)         return _this;
7856)     }
7857)     return class_task_schwamm;
7858) }(class_task));
7859) class_task.register("schwamm", function (name, sub, active, parameters) { return new class_task_schwamm({
7860)     "name": name, "sub": sub, "active": active,
7861)     "parameters": parameters,
7862) }); });
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7863) /**
7864)  * @author fenris
7865)  */
7866) var class_task_schwamm_create = (function (_super) {
7867)     __extends(class_task_schwamm_create, _super);
7868)     /**
7869)      * @author fenris
7870)      */
7871)     function class_task_schwamm_create(_a) {
7872)         var name = _a["name"], sub = _a["sub"], active = _a["active"], _b = _a["parameters"], _c = _b["includes"], includes_raw = _c === void 0 ? [] : _c, _d = _b["adhoc"], adhoc_raw = _d === void 0 ? {} : _d, _e = _b["output"], output_raw = _e === void 0 ? null : _e, _f = _b["dir"], dir_raw = _f === void 0 ? null : _f;
Christian Fraß update

Christian Fraß authored 6 years ago

7873)         var _this = this;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7874)         var includes = lib_call.use(includes_raw, function (x) { return x.map(function (y) { return lib_path.filepointer_read(y); }); });
7875)         var adhoc = lib_call.use(adhoc_raw, function (x) { return lib_object.map(x, function (members) { return members.map(function (member) { return lib_path.filepointer_read(member); }); }); });
Christian Fraß update

Christian Fraß authored 6 years ago

7876)         if (output_raw == undefined) {
7877)             throw (new Error(class_task.errormessage_mandatoryparamater("schamm-create", name, "output")));
7878)         }
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7879)         var output = lib_call.use(output_raw, function (x) { return lib_path.filepointer_read(x); });
7880)         var dir = lib_call.use(dir_raw, function (x) { return ((x == null) ? null : lib_path.location_read(x)); });
Christian Fraß update

Christian Fraß authored 6 years ago

7881)         _this = _super.call(this, name, sub, active, includes.concat(lib_object.values(adhoc).reduce(function (x, y) { return x.concat(y); }, [])), [output], [
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7882)             new class_action_mkdir(output.location),
7883)             new class_action_schwamm_create(includes, adhoc, output, dir),
Christian Fraß update

Christian Fraß authored 6 years ago

7884)         ]) || this;
7885)         return _this;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7886)     }
7887)     return class_task_schwamm_create;
7888) }(class_task));
7889) class_task.register("schwamm-create", function (name, sub, active, parameters) { return new class_task_schwamm_create({
7890)     "name": name, "sub": sub, "active": active,
7891)     "parameters": parameters,
7892) }); });
7893) /**
7894)  * @author fenris
7895)  */
7896) var class_task_schwamm_apply = (function (_super) {
7897)     __extends(class_task_schwamm_apply, _super);
7898)     /**
7899)      * @author fenris
7900)      */
7901)     function class_task_schwamm_apply(_a) {
7902)         var name = _a["name"], sub = _a["sub"], active = _a["active"], _b = _a["parameters"], path_raw = _b["path"], _c = _b["outputs"], outputs_raw = _c === void 0 ? null : _c;
Christian Fraß update

Christian Fraß authored 6 years ago

7903)         var _this = this;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7904)         if (path_raw == undefined) {
7905)             throw (new Error(class_task.errormessage_mandatoryparamater("schamm-apply", name, "path")));
7906)         }
7907)         var path = lib_call.use(path_raw, function (x) { return lib_path.filepointer_read(x); });
7908)         if (outputs_raw == undefined) {
7909)             throw (new Error(class_task.errormessage_mandatoryparamater("schamm-apply", name, "outputs")));
7910)         }
7911)         var outputs = lib_call.use(outputs_raw, function (x) { return lib_object.map(x, function (output) { return lib_path.filepointer_read(output); }); });
Christian Fraß update

Christian Fraß authored 6 years ago

7912)         _this = _super.call(this, name, sub, active, [path], lib_object.to_array(outputs).map(function (x) { return x.value; }), (lib_object.to_array(outputs).map(function (pair) { return [
7913)             new class_action_mkdir(pair.value.location),
7914)             new class_action_schwamm_apply(path, pair.key, pair.value),
7915)         ]; })
7916)             .reduce(function (x, y) { return x.concat(y); }, []))) || this;
7917)         return _this;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7918)     }
7919)     return class_task_schwamm_apply;
7920) }(class_task));
7921) class_task.register("schwamm-apply", function (name, sub, active, parameters) { return new class_task_schwamm_apply({
7922)     "name": name, "sub": sub, "active": active,
7923)     "parameters": parameters,
7924) }); });
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7925) /**
7926)  * @author fenris
7927)  */
7928) var class_target = (function () {
7929)     /**
7930)      * @author fenris
7931)      */
7932)     function class_target() {
7933)     }
7934)     return class_target;
7935) }());
7936) /**
7937)  * @author fenris
7938)  */
7939) var class_target_regular = (function (_super) {
7940)     __extends(class_target_regular, _super);
7941)     /**
7942)      * @author fenris
7943)      */
7944)     function class_target_regular(identifier) {
Christian Fraß update

Christian Fraß authored 6 years ago

7945)         var _this = _super.call(this) || this;
7946)         _this.identifier = identifier;
7947)         return _this;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7948)     }
7949)     /**
7950)      * @author fenris
7951)      */
7952)     class_target_regular.prototype.compile_action = function (action) {
7953)         if (action instanceof class_action_adhoc) {
7954)             var action_ = (action);
7955)             return (action_.compilation(this.identifier));
7956)         }
7957)         else {
7958)             throw (new Error("no delegation for action '" + JSON.stringify(action) + "'"));
7959)         }
7960)     };
7961)     return class_target_regular;
7962) }(class_target));
7963) /**
7964)  * @author fenris
7965)  */
7966) var class_target_ant = (function (_super) {
7967)     __extends(class_target_ant, _super);
7968)     /**
7969)      * @author fenris
7970)      */
7971)     function class_target_ant() {
Christian Fraß update

Christian Fraß authored 6 years ago

7972)         return _super.call(this, "ant") || this;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7973)     }
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7974)     /**
7975)      * @override
7976)      * @author fenris
7977)      */
7978)     class_target_ant.prototype.tempfolder = function () {
Christian Fraß update

Christian Fraß authored 6 years ago

7979)         switch (globalvars.configuration.system) {
7980)             case "linux": {
7981)                 return "/tmp/";
7982)                 break;
7983)             }
7984)             case "bsd": {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7985)                 return "/tmp/";
7986)                 break;
7987)             }
7988)             case "win": {
7989)                 return "${env.TEMP}\\";
7990)                 break;
7991)             }
7992)             default: {
Christian Fraß update

Christian Fraß authored 6 years ago

7993)                 throw (new Error("invalid system '" + globalvars.configuration.system + "'"));
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7994)                 break;
7995)             }
7996)         }
7997)     };
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7998)     /**
7999)      * @author fenris
8000)      */
Christian Fraß update

Christian Fraß authored 6 years ago

8001)     class_target_ant.prototype.compile_task = function (_a) {
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8002)         var _this = this;
Christian Fraß update

Christian Fraß authored 6 years ago

8003)         var task = _a["task"], _b = _a["path"], path = _b === void 0 ? [] : _b, _c = _a["context"], context = _c === void 0 ? null : _c;
8004)         var aggregate = false;
8005)         var path_ = path_augment(path, task.name_get(), aggregate);
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8006)         var targets_core = [
8007)             new lib_ant.class_target({
Christian Fraß update

Christian Fraß authored 6 years ago

8008)                 "name": path_dump(path_),
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8009)                 "dependencies": (task.sub_get()
8010)                     .filter(function (task_) { return task_.active_get(); })
Christian Fraß update

Christian Fraß authored 6 years ago

8011)                     .map(function (task_) { return path_dump(path_augment(path_, task_.name_get(), aggregate)); })),
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8012)                 "actions": ([]
Christian Fraß update

Christian Fraß authored 6 years ago

8013)                     .concat((context == null)
8014)                     ? ([]
8015)                         .concat(task.actions()
8016)                         .map(function (action) { return _this.compile_action(action); })))
8017)                     : [
8018)                         new lib_ant.class_action(new lib_xml.class_node_complex("ant", {
8019)                             "antfile": "${ant.file}",
8020)                             "dir": context.as_string("linux"),
8021)                             "target": path_dump(path_augment(path_, name_mark("inner"))),
8022)                             "inheritAll": String(true),
8023)                             "inheritRefs": String(true),
8024)                         })),
8025)                     ]))
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8026)             })
8027)         ];
Christian Fraß update

Christian Fraß authored 6 years ago

8028)         var targets_sub = []
8029)             .concat((context == null)
8030)             ? []
8031)             : [
8032)                 new lib_ant.class_target({
8033)                     "name": path_dump(path_augment(path_, name_mark("inner"))),
8034)                     "dependencies": [],
8035)                     "actions": (task.actions()
8036)                         .map(function (action) { return _this.compile_action(action); })),
8037)                 })
8038)             ])
8039)             .concat(task.sub_get()
8040)             .map(function (task_) { return _this.compile_task({
8041)             "task": task_,
8042)             "path": path_,
8043)             "context": ((context == null) ? task_.context_get() : ((task_.context_get() == null) ? context : context.relocate(task_.context_get()))),
8044)         }); })
8045)             .reduce(function (x, y) { return x.concat(y); }, []));
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8046)         return [].concat(targets_core).concat(targets_sub);
8047)     };
8048)     /**
8049)      * @author fenris
8050)      */
Christian Fraß update

Christian Fraß authored 6 years ago

8051)     class_target_ant.prototype.compile_project = function (project) {
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8052)         var comments = [
Christian Fraß update

Christian Fraß authored 6 years ago

8053)             "Project \"" + project.name_get() + "\"",
8054)             "This build script was generated by Koralle " + globalvars.configuration.version,
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

8055)         ].map(function (x) { return new lib_ant.class_comment(x); });
Christian Fraß update

Christian Fraß authored 6 years ago

8056)         var targets = this.compile_task({ "task": project.roottask_get() });
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8057)         return (new lib_ant.class_project({
8058)             "name": project.name_get(),
Christian Fraß update

Christian Fraß authored 6 years ago

8059)             "default": name_mark("root"),
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8060)             "comments": comments,
8061)             "targets": targets,
8062)         }));
8063)     };
8064)     /**
8065)      * @override
8066)      * @author fenris
8067)      */
8068)     class_target_ant.prototype.compile_project_string = function (project) {
8069)         return this.compile_project(project).compile().compile();
8070)     };
8071)     /**
8072)      * @override
8073)      * @author fenris
8074)      */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

8075)     class_target_ant.prototype.execute = function (filepointer, workdir) {
8076)         if (workdir === void 0) { workdir = "."; }
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8077)         return (function (resolve, reject) {
Christian Fraß update

Christian Fraß authored 6 years ago

8078)             var cp = nm_child_process.spawn("ant", [
8079)                 "-f",
8080)                 "" + filepointer.as_string(globalvars.configuration.system),
8081)             ], {});
8082)             cp.stdout.on("data", [function (x) { return x.toString(); }, function (x) { return x.slice(0, x.length - 1); }, console.log].reduce(lib_call.compose));
8083)             cp.stderr.on("data", [function (x) { return x.toString(); }, function (x) { return x.slice(0, x.length - 1); }, console.error].reduce(lib_call.compose));
8084)             cp.on("error", function (error) { return reject(new class_error("subprocess not finish successfully", [error])); });
8085)             cp.on("close", function (code) {
8086)                 if (code == 0) {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

8087)                     resolve(undefined);
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8088)                 }
8089)                 else {
Christian Fraß update

Christian Fraß authored 6 years ago

8090)                     reject(new Error("unknown error while subprocess execution"));
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8091)                 }
8092)             });
8093)         });
8094)     };
8095)     return class_target_ant;
8096) }(class_target_regular));
8097) /**
8098)  * @author fenris
8099)  */
8100) var class_target_gnumake = (function (_super) {
8101)     __extends(class_target_gnumake, _super);
8102)     /**
8103)      * @author fenris
8104)      */
8105)     function class_target_gnumake() {
Christian Fraß update

Christian Fraß authored 6 years ago

8106)         return _super.call(this, "gnumake") || this;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8107)     }
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

8108)     /**
8109)      * @override
8110)      * @author fenris
8111)      */
8112)     class_target_gnumake.prototype.tempfolder = function () {
Christian Fraß update

Christian Fraß authored 6 years ago

8113)         switch (globalvars.configuration.system) {
8114)             case "linux": {
8115)                 return "/tmp/";
8116)                 break;
8117)             }
8118)             case "bsd": {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

8119)                 return "/tmp/";
8120)                 break;
8121)             }
8122)             case "win": {
8123)                 return "%TEMP%\\";
8124)                 break;
8125)             }
8126)             default: {
Christian Fraß update

Christian Fraß authored 6 years ago

8127)                 throw (new Error("invalid system '" + globalvars.configuration.system + "'"));
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

8128)                 break;
8129)             }
8130)         }
8131)     };
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8132)     /**
8133)      * @author fenris
8134)      */
Christian Fraß update

Christian Fraß authored 6 years ago

8135)     class_target_gnumake.prototype.compile_task = function (_a) {
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8136)         var _this = this;
Christian Fraß update

Christian Fraß authored 6 years ago

8137)         var task = _a["task"], _b = _a["branch"], branch = _b === void 0 ? [] : _b, _c = _a["depth"], depth = _c === void 0 ? 0 : _c, _d = _a["context"], context = _d === void 0 ? null : _d, _e = _a["prefix"], prefix = _e === void 0 ? null : _e;
8138)         var log_begin = true;
8139)         var log_end = false;
8140)         var aggregate = false;
8141)         var branch_ = path_augment(branch, task.name_get(), aggregate);
8142)         var logging_begin = new class_action_echo((new class_message(path_dump(branch_), { "type": "log", "depth": depth, "prefix": prefix })).generate());
8143)         var logging_end = new class_action_echo((new class_message("✔", { "type": "log", "depth": depth, "prefix": prefix })).generate());
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8144)         var rules_core = [];
8145)         {
8146)             // meta rule
8147)             rules_core.push(new lib_gnumake.class_rule({
Christian Fraß update

Christian Fraß authored 6 years ago

8148)                 "name": path_dump(branch_),
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8149)                 "dependencies": ([]
Christian Fraß update

Christian Fraß authored 6 years ago

8150)                     .concat(log_begin
8151)                     ? [path_dump(path_augment(branch_, name_mark("logging"), true))]
8152)                     : [])
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8153)                     .concat(task.sub_get()
8154)                     .filter(function (task_) { return task_.active_get(); })
Christian Fraß update

Christian Fraß authored 6 years ago

8155)                     .map(function (task_) { return path_dump(path_augment(branch_, task_.name_get(), aggregate)); }))
8156)                     .concat(task.outputs().map(function (filepointer) { return filepointer_adjust(filepointer, context).as_string(globalvars.configuration.system); }))),
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8157)                 "actions": ([]
Christian Fraß update

Christian Fraß authored 6 years ago

8158)                     .concat((task.outputs().length == 0)
8159)                     ? task.actions().map(function (action) { return dirwrap(context, _this.compile_action(action)); })
8160)                     : [])
8161)                     .concat((log_end
8162)                     ? [logging_end]
8163)                     : [])
8164)                     .map(function (action) { return _this.compile_action(action); }))),
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8165)                 "phony": true,
8166)             }));
8167)             // logging
Christian Fraß update

Christian Fraß authored 6 years ago

8168)             if (log_begin) {
8169)                 rules_core.push(new lib_gnumake.class_rule({
8170)                     "name": path_dump(path_augment(branch_, name_mark("logging"), true)),
8171)                     "actions": [logging_begin].map(function (action) { return _this.compile_action(action); }),
8172)                     "phony": true,
8173)                 }));
8174)             }
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8175)             // actual rule
8176)             if (task.outputs().length > 0) {
8177)                 rules_core.push(new lib_gnumake.class_rule({
Christian Fraß update

Christian Fraß authored 6 years ago

8178)                     "name": task.outputs().map(function (filepointer) { return filepointer_adjust(filepointer, context).as_string(globalvars.configuration.system); }).join(" "),
8179)                     "dependencies": task.inputs().map(function (filepointer) { return filepointer_adjust(filepointer, context).as_string(globalvars.configuration.system); }),
8180)                     "actions": task.actions().map(function (action) { return _this.compile_action(action); }).map(function (x) { return dirwrap(context, x); }),
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8181)                     "phony": false,
8182)                 }));
8183)             }
8184)         }
8185)         var rules_sub = [];
8186)         {
8187)             rules_sub = task.sub_get()
Christian Fraß update

Christian Fraß authored 6 years ago

8188)                 .map(function (task_) { return _this.compile_task({
8189)                 "task": task_,
8190)                 "branch": branch_,
8191)                 "depth": depth + 1,
8192)                 "context": ((context == null) ? task_.context_get() : ((task_.context_get() == null) ? context : context.relocate(task_.context_get()))),
8193)                 "prefix": prefix,
8194)             }); })
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8195)                 .reduce(function (x, y) { return x.concat(y); }, []);
8196)         }
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

8197)         return [].concat(rules_core).concat(rules_sub);
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8198)     };
8199)     /**
8200)      * @author fenris
8201)      */
Christian Fraß update

Christian Fraß authored 6 years ago

8202)     class_target_gnumake.prototype.compile_project = function (project) {
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8203)         var comments = [
Christian Fraß update

Christian Fraß authored 6 years ago

8204)             "Project \"" + project.name_get() + "\"",
8205)             "This makefile was generated by Koralle " + globalvars.configuration.version,
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

8206)         ].map(function (x) { return x; });
Christian Fraß update

Christian Fraß authored 6 years ago

8207)         var rules = this.compile_task({
8208)             "task": project.roottask_get(),
8209)             "prefix": project.name_get(),
8210)         });
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8211)         return (new lib_gnumake.class_sheet(rules, comments));
8212)     };
8213)     /**
8214)      * @override
8215)      * @author fenris
8216)      */
Christian Fraß update

Christian Fraß authored 6 years ago

8217)     class_target_gnumake.prototype.compile_project_string = function (project) {
8218)         return (this.compile_project(project).compile(true));
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8219)     };
8220)     /**
8221)      * @override
8222)      * @author fenris
8223)      */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

8224)     class_target_gnumake.prototype.execute = function (filepointer, workdir) {
8225)         if (workdir === void 0) { workdir = process.cwd(); }
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8226)         return (function (resolve, reject) {
Christian Fraß update

Christian Fraß authored 6 years ago

8227)             var cp = nm_child_process.spawn("make", [
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

8228)                 // `--directory=${workdir}`,
Christian Fraß update

Christian Fraß authored 6 years ago

8229)                 // `--file=${filepointer.as_string(globalvars.configuration.system)}`,
8230)                 "-f",
8231)                 "" + filepointer.as_string(globalvars.configuration.system),
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

8232)             ], {});
8233)             cp.stdout.on("data", [function (x) { return x.toString(); }, function (x) { return x.slice(0, x.length - 1); }, console.log].reduce(lib_call.compose));
8234)             cp.stderr.on("data", [function (x) { return x.toString(); }, function (x) { return x.slice(0, x.length - 1); }, console.error].reduce(lib_call.compose));
8235)             cp.on("error", function (error) { return reject(new class_error("subprocess not finish successfully", [error])); });
8236)             cp.on("close", function (code) {
8237)                 if (code == 0) {
8238)                     resolve(undefined);
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8239)                 }
8240)                 else {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

8241)                     reject(new Error("unknown error while subprocess execution"));
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8242)                 }
8243)             });
8244)         });
8245)     };
8246)     return class_target_gnumake;
8247) }(class_target_regular));
Christian Fraß update

Christian Fraß authored 6 years ago

8248) /**
8249)  * scans a project and its subprojects and constructs a dependency-graph (more precise: a depth first spanning tree)
8250)  * @param {class_filepointer} filepointet the filepointer to the project.json, relative to the current working directory
8251)  * @author fenris
8252)  */
8253) function scan(node, graph, depth) {
8254)     if (graph === void 0) { graph = null; }
8255)     if (depth === void 0) { depth = 0; }
8256)     log("exploring node " + JSON.stringify(node), 4);
8257)     var make_node = function (filepointer, rawproject) {
8258)         if (rawproject === void 0) { rawproject = null; }
8259)         var node = { "filepointer": filepointer, "rawproject": rawproject };
8260)         return node;
8261)     };
8262)     if (graph == null) {
8263)         log("creating new graph", 4);
8264)         graph = new class_graph(function (x, y) { return (x.filepointer.toString() == y.filepointer.toString()); });
8265)         graph.nodes.push(node);
8266)     }
8267)     return (function (resolve, reject) {
8268)         log("reading description file", 4);
8269)         lib_file.read_json(node.filepointer.toString())(function (data) {
8270)             log("got data", 4);
8271)             node.rawproject = data;
8272)             lib_call.executor_chain(graph, lib_object.fetch(lib_object.fetch(node, "rawproject", {}, 0), "dependencies", [], 0).map(function (path) { return function (graph_) { return function (resolve_, reject_) {
8273)                 log("looking through path " + path, 4);
8274)                 var node_ = make_node(node.filepointer.foo(lib_path.filepointer_read(path)));
8275)                 var edge = { "from": node_, "to": node };
8276)                 graph_.edges.push(edge);
8277)                 if (graph.has(node_)) {
8278)                     // return lib_call.executor_resolve<class_graph<type_depgraphnode>, Error>(graph);
8279)                     resolve_(graph_);
8280)                 }
8281)                 else {
8282)                     graph.nodes.push(node_);
8283)                     scan(node_, graph_, depth + 1)(function (graph_) {
8284)                         resolve_(graph_ /*.hasse()*/);
8285)                     }, reject_);
8286)                 }
8287)             }; }; }))(resolve, reject);
8288)         }, function (reason) {
8289)             reject(reason);
8290)         });
8291)     });
8292) }
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8293) /**
8294)  * @author fenris
8295)  */
8296) var class_project = (function () {
8297)     /**
8298)      * @author fenris
8299)      */
Christian Fraß update

Christian Fraß authored 6 years ago

8300)     function class_project(name, version, task) {
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8301)         this.name = name;
8302)         this.version = version;
Christian Fraß update

Christian Fraß authored 6 years ago

8303)         this.task = task;
8304)         this.graph = null;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8305)     }
8306)     /**
8307)      * @author fenris
8308)      */
8309)     class_project.prototype.name_get = function () {
8310)         return this.name;
8311)     };
8312)     /**
8313)      * @author fenris
8314)      */
Christian Fraß update

Christian Fraß authored 6 years ago

8315)     class_project.prototype.roottask_get = function () {
8316)         return this.task;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8317)     };
8318)     /**
Christian Fraß update

Christian Fraß authored 6 years ago

8319)      * @desc [mutator] [setter]
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8320)      * @author fenris
8321)      */
Christian Fraß update

Christian Fraß authored 6 years ago

8322)     class_project.prototype.graph_set = function (graph) {
8323)         this.graph = graph;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8324)     };
8325)     /**
Christian Fraß update

Christian Fraß authored 6 years ago

8326)      * @desc [accessor] [getter]
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8327)      * @author fenris
8328)      */
Christian Fraß update

Christian Fraß authored 6 years ago

8329)     class_project.prototype.graph_get = function () {
8330)         return this.graph;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8331)     };
8332)     /**
8333)      * @author fenris
8334)      */
Christian Fraß update

Christian Fraß authored 6 years ago

8335)     /*
8336)     public dependencytasks(output : string) : Array<class_task> {
8337)         return (
8338)             this.dependencies_all.map(
8339)                 function (path : string, index : int) : class_task_dependency {
8340)                     return (
8341)                         new class_task_dependency(
8342)                             {
8343)                                 "name": `__dependency_${index.toString()}`,
8344)                                 "parameters": {
8345)                                     "path": path,
8346)                                     "output": output,
8347)                                     "raw": true,
8348)                                 },
8349)                             }
8350)                         )
8351)                     );
8352)                 }
8353)             )
8354)         );
8355)     }
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

8356)      */
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8357)     /**
8358)      * @author fenris
8359)      */
Christian Fraß update

Christian Fraß authored 6 years ago

8360)     class_project.create = function (filepointer, nameprefix) {
8361)         if (nameprefix === void 0) { nameprefix = null; }
8362)         return (function (resolve, reject) {
8363)             var node = { "filepointer": filepointer, "rawproject": null };
8364)             log("scanning dependencies", 3);
8365)             scan(node)(function (graph) {
8366)                 log("got dependency graph", 3);
8367)                 var dependencynodes = null;
8368)                 var error = null;
8369)                 try {
8370)                     log("applying topsort", 3);
8371)                     dependencynodes = graph
8372)                         .topsort()
8373)                         .filter(function (node) { return (node.filepointer.toString() != filepointer.toString()); });
8374)                     error = null;
8375)                 }
8376)                 catch (exception) {
8377)                     error = new class_error("could not sort dependencies; probably circular structure", [exception]);
8378)                 }
8379)                 if (error == null) {
8380)                     log("creating core task", 3);
8381)                     var core = class_task.create(node.rawproject.roottask);
8382)                     log("creating dependency tasks", 3);
8383)                     var dependencies = dependencynodes.map(function (node, index) {
8384)                         var task = class_task.create(node.rawproject.roottask, name_mark("dependency_" + (node.rawproject.name || lib_string.generate())));
8385)                         task.context_set(node.filepointer.location);
8386)                         return task;
8387)                     });
8388)                     log("creating root task", 3);
8389)                     var task = new class_task_group({
8390)                         "name": name_mark("root"),
8391)                         "sub": [
8392)                             new class_task_group({
8393)                                 "name": name_mark("dependencies"),
8394)                                 "sub": dependencies,
8395)                             }),
8396)                             new class_task_group({
8397)                                 "name": name_mark("core"),
8398)                                 "sub": [core],
8399)                             }),
8400)                         ]
8401)                     });
8402)                     log("creating project", 3);
8403)                     var project = new class_project(node.rawproject.name || "(nameless project)", node.rawproject.version || "0.0.0", task);
8404)                     project.graph = graph;
8405)                     resolve(project);
8406)                 }
8407)                 else {
8408)                     reject(error);
8409)                 }
8410)             }, function (reason) { return reject(new class_error("scanning dependencies failed", [reason])); });
8411)         });
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8412)     };
8413)     return class_project;
8414) }());
Christian Fraß update

Christian Fraß authored 6 years ago

8415) globalvars.invocation = {
8416)     "interpreter": null,
8417)     "path": "koralle",
8418) };
8419) globalvars.configuration = {
8420)     "version": "0.1.1",
8421)     "tempfolder": null,
8422)     "path_source": "source",
8423)     "path_build": "build",
8424)     "system": "linux",
8425)     "execute": false,
8426)     "output": "gnumake",
8427)     "file": null,
8428)     "path": "project.json",
8429)     "showgraph": false,
8430)     "verbosity": 0,
8431)     "name_splitter": "_",
8432)     "name_prefix": "~",
8433) };
8434) /**
8435)  * @author fenris
8436)  */
8437) function log(message, level) {
8438)     if (level === void 0) { level = 0; }
8439)     if (level <= globalvars.configuration.verbosity) {
8440)         (new class_message(message, { "type": "log", "prefix": "koralle" })).stderr();
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8441)     }
8442) }
8443) /**
8444)  * @author fenris
8445)  */
8446) function main(args) {
Christian Fraß update

Christian Fraß authored 6 years ago

8447)     log("starting", 2);
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

8448)     var arghandler = new lib_args.class_handler([
8449)         new lib_args.class_argument({
8450)             "name": "path",
8451)             "type": "string",
8452)             "default": "project.json",
8453)             "info": "the path of the project-description-file",
8454)             "kind": "positional",
8455)             "parameters": {},
8456)         }),
Christian Fraß update

Christian Fraß authored 6 years ago

8457)         new lib_args.class_argument({
8458)             "name": "verbosity",
8459)             "type": "int",
8460)             "info": "how much informational output shall be given",
8461)             "kind": "volatile",
8462)             "parameters": {
8463)                 "indicators_long": ["verbosity"],
8464)                 "indicators_short": ["b"],
8465)             },
8466)         }),
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

8467)         new lib_args.class_argument({
8468)             "name": "help",
8469)             "type": "boolean",
8470)             "info": "show this help and exit",
8471)             "kind": "volatile",
8472)             "parameters": {
8473)                 "indicators_long": ["help"],
8474)                 "indicators_short": ["h"],
8475)             },
8476)         }),
8477)         new lib_args.class_argument({
8478)             "name": "tasklist",
8479)             "type": "boolean",
8480)             "info": "show the list of available tasks and exit",
8481)             "kind": "volatile",
8482)             "parameters": {
8483)                 "indicators_long": ["tasklist"],
8484)                 "indicators_short": ["l"],
8485)             },
8486)         }),
8487)         new lib_args.class_argument({
8488)             "name": "version",
8489)             "type": "boolean",
8490)             "info": "print the version to stdout and exit",
8491)             "kind": "volatile",
8492)             "parameters": {
8493)                 "indicators_long": ["version"],
8494)                 "indicators_short": ["v"],
8495)             },
8496)         }),
8497)         new lib_args.class_argument({
8498)             "name": "output",
8499)             "type": "string",
8500)             "default": "gnumake",
Christian Fraß update

Christian Fraß authored 6 years ago

8501)             "info": "the output build system; valid values are 'gnumake', 'ant'",
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

8502)             "kind": "volatile",
8503)             "parameters": {
8504)                 "indicators_long": ["output"],
8505)                 "indicators_short": ["o"],
8506)             },
8507)         }),
8508)         new lib_args.class_argument({
8509)             "name": "system",
8510)             "type": "string",
Christian Fraß update

Christian Fraß authored 6 years ago

8511)             "default": "linux",
8512)             "info": "the target platform; valid values are 'linux', 'bsd', 'win'",
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

8513)             "kind": "volatile",
8514)             "parameters": {
8515)                 "indicators_long": ["system"],
8516)                 "indicators_short": ["s"],
8517)             },
8518)         }),
8519)         new lib_args.class_argument({
8520)             "name": "file",
8521)             "type": "string",
8522)             "default": null,
8523)             "info": "the file in which the result build script shall be written",
8524)             "kind": "volatile",
8525)             "parameters": {
8526)                 "indicators_long": ["file"],
8527)                 "indicators_short": ["f"],
8528)             },
8529)         }),
8530)         new lib_args.class_argument({
8531)             "name": "execute",
8532)             "type": "boolean",
8533)             "info": "if set, the build script will be executed instead of being printed to stdout",
8534)             "kind": "volatile",
8535)             "parameters": {
8536)                 "indicators_long": ["execute"],
8537)                 "indicators_short": ["x"],
8538)             },
8539)         }),
8540)         new lib_args.class_argument({
8541)             "name": "showgraph",
8542)             "type": "boolean",
8543)             "info": "if set, the graphviz description of the dependency graph is written to stderr",
8544)             "kind": "volatile",
8545)             "parameters": {
8546)                 "indicators_long": ["showgraph"],
8547)                 "indicators_short": ["g"],
8548)             },
8549)         }),
8550)     ]);
8551)     // lib_args.verbosity = 5;
Christian Fraß update

Christian Fraß authored 6 years ago

8552)     log("reading command line arguments", 2);
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

8553)     var argdata = arghandler.read("cli", args.join(" "));
8554)     var procede = true;
8555)     if (argdata["help"]) {
8556)         (new class_message(arghandler.generate_help({
8557)             "programname": "Koralle Build System Abstractor",
8558)             "executable": "koralle",
8559)             "author": "Christian Fraß <frass@greenscale.de>",
8560)             "description": "Koralle is not a build-system itself. Instead it generates scripts for existing build-systems (e.g. GNU Make, Apache Ant, …) on base of a common json-description-file (usually named 'project.json'). Koralle is designed for reducing the amount of text needed to define the build-process.",
8561)         }))).stdout();
8562)         procede = false;
8563)     }
8564)     else if (argdata["version"]) {
Christian Fraß update

Christian Fraß authored 6 years ago

8565)         (new class_message(globalvars.configuration.version.toString())).stdout();
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

8566)         procede = false;
8567)     }
8568)     else if (argdata["tasklist"]) {
Christian Fraß update

Christian Fraß authored 6 years ago

8569)         new class_message(class_task.list().map(function (entry) { return "\t" + entry + "\n"; }).join("")).stdout();
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

8570)         procede = false;
8571)     }
8572)     else {
Christian Fraß update

Christian Fraß authored 6 years ago

8573)         globalvars.configuration.path = argdata["path"];
8574)         globalvars.configuration.system = argdata["system"];
8575)         globalvars.configuration.output = argdata["output"];
8576)         globalvars.configuration.execute = argdata["execute"];
8577)         globalvars.configuration.showgraph = argdata["showgraph"];
8578)         globalvars.configuration.file = argdata["file"];
8579)         globalvars.configuration.verbosity = argdata["verbosity"];
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

8580)         procede = true;
8581)     }
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8582)     if (procede) {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

8583)         lib_call.executor_chain({}, [
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8584)             // environment
8585)             function (state) { return function (resolve, reject) {
Christian Fraß update

Christian Fraß authored 6 years ago

8586)                 log("setting up environment", 2);
8587)                 var filepointer = lib_path.filepointer_read(globalvars.configuration.path);
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8588)                 filepointer.location.go_thither();
8589)                 state.filepointer = filepointer;
8590)                 resolve(state);
8591)             }; },
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

8592)             // setup output
8593)             function (state) { return function (resolve, reject) {
Christian Fraß update

Christian Fraß authored 6 years ago

8594)                 log("setting up output", 2);
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

8595)                 var mapping = {
8596)                     "ant": new class_target_ant(),
8597)                     "gnumake": new class_target_gnumake(),
8598)                     "make": new class_target_gnumake(),
8599)                 };
Christian Fraß update

Christian Fraß authored 6 years ago

8600)                 var output = lib_object.fetch(mapping, globalvars.configuration.output, null, 0);
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

8601)                 if (output == null) {
Christian Fraß update

Christian Fraß authored 6 years ago

8602)                     reject(new class_error("no implementation found for output '" + globalvars.configuration.output + "'"));
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

8603)                 }
8604)                 else {
8605)                     state.output = output;
8606)                     resolve(state);
8607)                 }
8608)             }; },
8609)             // setup temp-folder
8610)             function (state) { return function (resolve, reject) {
Christian Fraß update

Christian Fraß authored 6 years ago

8611)                 log("setting up temp-folder", 2);
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

8612)                 try {
Christian Fraß update

Christian Fraß authored 6 years ago

8613)                     globalvars.configuration.tempfolder = state.output.tempfolder();
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

8614)                     resolve(state);
8615)                 }
8616)                 catch (exception) {
8617)                     reject(new class_error("couldn't setup temp folder", [exception]));
8618)                 }
8619)             }; },
Christian Fraß update

Christian Fraß authored 6 years ago

8620)             // setup project
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8621)             function (state) { return function (resolve, reject) {
Christian Fraß update

Christian Fraß authored 6 years ago

8622)                 log("setting up project", 2);
8623)                 class_project.create(state.filepointer)(function (project) {
8624)                     state.project = project;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8625)                     resolve(state);
Christian Fraß update

Christian Fraß authored 6 years ago

8626)                 }, reject);
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8627)             }; },
Christian Fraß update

Christian Fraß authored 6 years ago

8628)             // show graph
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8629)             function (state) { return function (resolve, reject) {
Christian Fraß update

Christian Fraß authored 6 years ago

8630)                 log("showing graph?", 2);
8631)                 if (globalvars.configuration.showgraph) {
8632)                     var output = state.project.graph_get()
8633)                         .hasse()
8634)                         .output_graphviz(function (node) { return node.rawproject.name || node.filepointer.toString(); });
8635)                     (new class_message(output)).stderr();
8636)                 }
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

8637)                 resolve(state);
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8638)             }; },
8639)             // generate
8640)             function (state) { return function (resolve, reject) {
Christian Fraß update

Christian Fraß authored 6 years ago

8641)                 log("generating output", 2);
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8642)                 try {
Christian Fraß update

Christian Fraß authored 6 years ago

8643)                     var script = state.output.compile_project_string(state.project);
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8644)                     state.script = script;
8645)                     resolve(state);
8646)                 }
8647)                 catch (exception) {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

8648)                     reject(new class_error("generating build script failed", [exception]));
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8649)                 }
8650)             }; },
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

8651)             // write
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8652)             function (state) { return function (resolve, reject) {
Christian Fraß update

Christian Fraß authored 6 years ago

8653)                 log("writing to file", 2);
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8654)                 var filepointer;
Christian Fraß update

Christian Fraß authored 6 years ago

8655)                 if (globalvars.configuration.file == null) {
8656)                     if (!globalvars.configuration.execute) {
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8657)                         filepointer = null;
8658)                     }
8659)                     else {
8660)                         filepointer = new lib_path.class_filepointer(
8661)                         // new lib_path.class_location(null, new lib_path.class_path(["."])),
Christian Fraß update

Christian Fraß authored 6 years ago

8662)                         lib_path.location_read(globalvars.configuration.tempfolder, globalvars.configuration.system), 
8663)                         // lib_path.class_location.tempfolder(globalvars.configuration.system),
8664)                         "__koralle");
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8665)                     }
8666)                 }
8667)                 else {
Christian Fraß update

Christian Fraß authored 6 years ago

8668)                     filepointer = lib_path.filepointer_read(globalvars.configuration.file);
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8669)                 }
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

8670)                 state.file = filepointer;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8671)                 if (filepointer == null) {
8672)                     (new class_message(state.script)).stdout();
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

8673)                     resolve(state);
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8674)                 }
8675)                 else {
Christian Fraß update

Christian Fraß authored 6 years ago

8676)                     nm_fs.writeFile(filepointer.toString(), state.script, function (error) {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

8677)                         if (error == null) {
8678)                             resolve(state);
8679)                         }
8680)                         else {
8681)                             reject(new class_error("writing to file failed", [error]));
8682)                         }
8683)                     });
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8684)                 }
8685)             }; },
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

8686)             // execute
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8687)             function (state) { return function (resolve, reject) {
Christian Fraß update

Christian Fraß authored 6 years ago

8688)                 log("executing", 2);
8689)                 if (!globalvars.configuration.execute) {
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8690)                     resolve(state);
8691)                 }
8692)                 else {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

8693)                     state.output.execute(state.file)(function (result) { return resolve(state); }, function (reason) { return reject(new class_error("execution of build script failed", [reason])); });
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8694)                 }
8695)             }; },
8696)         ])(function (state) {
8697)             // (new class_message("successfull", {"type": "information", "prefix": "koralle"})).stderr();
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

8698)             process.exit(0);
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8699)         }, function (reason) {
8700)             // throw reason;
Christian Fraß update

Christian Fraß authored 6 years ago

8701)             console.error(reason);
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

8702)             (new class_message("the following error occured: '" + reason.toString() + "'", { "type": "error", "prefix": "koralle" })).stderr();
8703)             process.exit(-1);
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8704)         });
8705)     }
8706) }
Christian Fraß update

Christian Fraß authored 6 years ago

8707) log("intro", 2);
8708) globalvars.invocation = {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

8709)     "interpreter": process.argv[0],
8710)     "path": process.argv[1],
8711) };