cc6f6856c93966ff428aef4806a8103808feeb17
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)         }
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

214)         /*window.*/ console.log.apply(console, args);
Christian Fraß update

Christian Fraß authored 6 years ago

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)         }
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

225)         /*window.*/ console.info.apply(console, args);
Christian Fraß update

Christian Fraß authored 6 years ago

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)         }
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

236)         /*window.*/ console.warn.apply(console, args);
Christian Fraß update

Christian Fraß authored 6 years ago

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)         }
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

247)         /*window.*/ console.error.apply(console, args);
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

555)         }
556)         else {
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

558)         }
Christian Fraß update

Christian Fraß authored 6 years ago

559)     }
560)     lib_call.schedule = schedule;
561) })(lib_call || (lib_call = {}));
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

562) var lib_call;
563) (function (lib_call) {
Christian Fraß update

Christian Fraß authored 6 years ago

564)     /**
565)      * @author fenris
566)      */
567)     function timeout(function_, delay, ...params) {
568)         return (
569)         /*window.*/ setTimeout.apply(
570)         /*window.*/ setTimeout, [function_, delay].concat(params)));
571)     }
572)     lib_call.timeout = timeout;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

573)     /**
574)      * @desc a definition for a value being "defined"
575)      * @author neuc
576)      */
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

578)         return (!((typeof (obj) === "undefined") || (!null_is_valid && (obj === null))));
579)     }
580)     lib_call.is_def = is_def;
581)     /**
582)      * @desc returns the value if set and, when a type is specified, if the type is corret, if not return default_value
583)      * @author neuc
584)      */
Christian Fraß update

Christian Fraß authored 6 years ago

585)     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

586)         if (is_def(value, null_is_valid) && (is_def(type) ? ((typeof value === type) || ((value === null) && null_is_valid)) : true)) {
587)             return value;
588)         }
589)         else {
590)             return default_value;
591)         }
592)     }
593)     lib_call.def_val = def_val;
594)     ;
595)     /**
596)      * @desc just the empty function; useful for some callbacks etc.
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

598)      */
599)     function nothing() {
600)     }
601)     lib_call.nothing = nothing;
602)     /**
603)      * @desc just the identity; useful for some callbacks etc.
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

605)      */
606)     function id(x) {
607)         return x;
608)     }
609)     lib_call.id = id;
610)     /**
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

612)      */
613)     function use(input, function_) {
614)         return function_(input);
615)     }
616)     lib_call.use = use;
617)     /**
618)      * @desc outputs
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

620)      */
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

623)     }
624)     lib_call.output = output;
625)     /**
626)      * @desc converts the "arguments"-map into an array
627)      * @param {Object} args
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

629)      */
630)     function args2list(args) {
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

632)     }
633)     lib_call.args2list = args2list;
634)     /**
635)      * @desc provides the call for an attribute of a class as a regular function
636)      * @param {string} name the name of the attribute
637)      * @return {*}
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

639)      */
640)     function attribute(name) {
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

642)     }
643)     lib_call.attribute = attribute;
644)     /**
645)      * @desc provides a method of a class as a regular function
646)      * @param {string} name the name of the method
647)      * @return {function}
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

649)      */
650)     function method(name) {
651)         return (function (object) { return object[name].apply(object, args2list(arguments).slice(1)); });
652)     }
653)     lib_call.method = method;
654)     /**
655)      * @desc composes two functions (i.e. returns a function that return the result of the successive execution of both input-functions)
656)      * @param {function} function_f
657)      * @param {function} function_g
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

659)      */
660)     function compose(function_f, function_g) {
661)         return (function (x) {
662)             // return function_g(function_f(x));
663)             return function_g(function_f.apply(function_f, args2list(arguments)));
664)         });
665)     }
666)     lib_call.compose = compose;
667)     /**
668)      * @desc transforms a function with sequential input into a function with leveled input; example: add(2,3) = curryfy(add)(2)(3)
669)      * @param {function} f
670)      * @param {int} n (don't set manually)
671)      * @return {function} the currified version of the in put function
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

673)      */
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

675)         switch (n) {
676)             case 0: {
677)                 throw (new Error("[curryfy] impossible"));
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

679)             }
680)             case 1: {
681)                 return f;
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

683)             }
684)             default: {
685)                 return (function (x) {
686)                     return (curryfy(function () { return f.apply(f, [x].concat(args2list(arguments))); }, n - 1));
687)                 });
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

689)             }
690)         }
691)     }
692)     lib_call.curryfy = curryfy;
693)     /**
694)      * returns a function which goes through a process step by step
695)      * a process is an array of objects like { func : {function}, state : {string}}
696)      * trigger the start of the process by calling the returned function with one argument
697)      * which represents the parameters of the first function which is in the process
698)      * @param {Array<object>} _process
699)      * @param {function} on_stateChange called before the next function is called
700)      * @returns {function}
701)      */
Christian Fraß update

Christian Fraß authored 6 years ago

702)     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

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

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

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

Christian Fraß authored 6 years ago

708)                 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

709)             }
710)             else {
711)                 if (is_def(data_hashmap[pos]) && is_def(data_hashmap[pos].processed)) {
712)                     data = data_hashmap[pos];
713)                 }
714)             }
715)             if (pos < _process.length) {
716)                 var _func;
717)                 if (typeof (_process[pos]) !== "undefined") {
718)                     _func = _process[pos].func;
719)                 }
720)                 if (pos === 0) {
721)                     data = { processed: data };
722)                 }
723)                 if (_process[pos]) {
724)                     on_stateChange(_process[pos].state);
725)                 }
726)                 return (_func(data, function (processed_data) {
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

728)                 }, on_progress));
729)             }
730)             else {
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

732)             }
733)         };
734)         return _orchestrate;
735)     }
736)     lib_call.simple_process = simple_process;
737) })(lib_call || (lib_call = {}));
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

739) "use strict";
740) var lib_call;
741) (function (lib_call) {
742)     /**
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

744)      */
745)     function executor_resolve(result) {
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

747)     }
748)     lib_call.executor_resolve = executor_resolve;
749)     /**
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

751)      */
752)     function executor_reject(reason) {
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

754)     }
755)     lib_call.executor_reject = executor_reject;
756)     /**
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 executor_transform(executor, transform_result, transform_reason) {
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

762)         });
763)     }
764)     lib_call.executor_transform = executor_transform;
765)     /**
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

767)      */
Christian Fraß update

Christian Fraß authored 6 years ago

768)     function executor_transform_default(executor, transform_result, wrap_string = null) {
769)         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

770)         return (executor_transform(executor, transform_result, transform_reason));
771)     }
772)     lib_call.executor_transform_default = executor_transform_default;
773)     /**
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

775)      */
Christian Fraß update

Christian Fraß authored 6 years ago

776)     function executor_compose_sequential(first, second, deferred = undefined) {
777)         return ((resolve, reject) => {
778)             first(result => {
779)                 lib_call.schedule(() => second(result)(resolve, reject), deferred);
780)             }, reason => {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

781)                 reject(reason);
782)             });
783)         });
784)     }
785)     lib_call.executor_compose_sequential = executor_compose_sequential;
786)     /**
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

788)      */
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

791)             if (executors.length == 0) {
792)                 return resolve(state);
793)             }
794)             else {
Christian Fraß update

Christian Fraß authored 6 years ago

795)                 return executors[0](state)(result => {
796)                     /*
797)                     schedule(
798)                         () => executor_chain(result, executors.slice(1))(resolve, reject)
799)                     );
800)                      */
801)                     /*
802)                     setTimeout(
803)                         () => executor_chain(result, executors.slice(1))(resolve, reject),
804)                         0
805)                     );
806)                      */
807)                     executor_chain(result, executors.slice(1))(resolve, reject);
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

808)                 }, reject);
809)             }
810)         });
811)         /*
812)          */
813)         /*
814)         if (executors.length == 0) {
815)             return executor_resolve<type_state, type_error>(state);
816)         }
817)         else if (executors.length == 1) {
818)             return executors[0](state);
819)         }
820)         else {
821)             return (
822)                 executor_chain<type_state, type_error>(
823)                     state,
824)                     [
825)                         state => (resolve, reject) => executors[0](state)(result => executors[1](result)(resolve, reject), reject)
826)                     ].concat(executors.slice(2))
827)                 )
828)             );
829)         }
830)          */
831)         /*
832)         return (
833)             executors.reduce(
834)                 (chain, current) => executor_compose_sequential<type_state, type_state, type_error>(chain, current, deferred),
835)                 executor_resolve<type_state, type_error>(state)
836)             )
837)         );
838)          */
839)     }
840)     lib_call.executor_chain = executor_chain;
841)     /**
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

843)      */
844)     function executor_first(executors) {
845)         /*
846)         return (
847)             (resolve, reject) => {
848)                 if (executors.length == 0) {
849)                     reject(new Error("all failed"));
850)                 }
851)                 else {
852)                     executors[0](
853)                         result => {
854)                             resolve(result);
855)                         },
856)                         reason => {
857)                             executor_first<type_result, type_reason>(executors.slice(1))(resolve, reject);
858)                         }
859)                     )
860)                 }
861)             }
862)         );
863)          */
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

868)         });
869)     }
870)     lib_call.executor_first = executor_first;
871)     /**
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

873)      */
874)     function executor_condense(executors) {
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

878)     }
879)     lib_call.executor_condense = executor_condense;
880)     /**
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

882)      * @deprecated use condense
883)      */
884)     function executor_filter(executors, predicate) {
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

888)     }
889)     lib_call.executor_filter = executor_filter;
890)     /**
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

892)      * @deprecated use condense
893)      */
894)     function executor_map(executors, transformator) {
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

898)     }
899)     lib_call.executor_map = executor_map;
900)     /**
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

902)      * @deprecated use condense
903)      */
904)     function executor_reduce(executors, initial, accumulator) {
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

908)     }
909)     lib_call.executor_reduce = executor_reduce;
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

910)     /**
911)      * @desc useful for e.g. asynchronous singletons
912)      * @author fenris
913)      */
914)     class class_executor_initializer {
915)         /**
916)          * @author fenris
917)          */
918)         constructor(fetcher) {
919)             /**
920)              * @author fenris
921)              * 0 : initial
922)              * 1 : waiting
923)              * 2 : done, successful
924)              * 3 : done, failed
925)              */
926)             this.state = 0;
927)             this.fetcher = fetcher;
928)             this.state = 0;
929)             this.queue = [];
930)             this.output = null;
931)             this.error = null;
932)         }
933)         /**
934)          * @author fenris
935)          */
936)         actuate() {
937)             switch (this.state) {
938)                 case 2: {
939)                     this.queue.forEach(entry => entry.resolve(this.output));
940)                     break;
941)                 }
942)                 case 3: {
943)                     this.queue.forEach(entry => entry.reject(this.error));
944)                     break;
945)                 }
946)                 default: {
947)                     throw (new Error(`unhandled state ${this.state}`));
948)                     break;
949)                 }
950)             }
951)         }
952)         /**
953)          * @author fenris
954)          */
955)         reset() {
956)             this.state = 0;
957)             this.queue = [];
958)         }
959)         /**
960)          * @author fenris
961)          */
962)         get() {
963)             switch (this.state) {
964)                 case 0: {
965)                     this.state = 1;
966)                     return ((resolve, reject) => {
967)                         this.queue.push({ "resolve": resolve, "reject": reject });
968)                         this.fetcher(output => {
969)                             this.state = 2;
970)                             this.output = output;
971)                             this.actuate();
972)                         }, error => {
973)                             this.state = 3;
974)                             this.error = error;
975)                             this.actuate();
976)                         });
977)                     });
978)                     break;
979)                 }
980)                 case 1: {
981)                     return ((resolve, reject) => this.queue.push({ "resolve": resolve, "reject": reject }));
982)                     break;
983)                 }
984)                 case 2: {
985)                     return executor_resolve(this.output);
986)                     break;
987)                 }
988)                 case 3: {
989)                     return executor_reject(this.error);
990)                     break;
991)                 }
992)                 default: {
993)                     throw (new Error(`unhandled state ${this.state}`));
994)                     break;
995)                 }
996)             }
997)         }
998)         /**
999)          * @author fenris
1000)          */
1001)         get_sync() {
1002)             switch (this.state) {
1003)                 case 2: {
1004)                     return this.output;
1005)                     break;
1006)                 }
1007)                 case 3: {
1008)                     throw this.error;
1009)                     break;
1010)                 }
1011)                 default: {
1012)                     throw (new Error(`unhandled state ${this.state}`));
1013)                     break;
1014)                 }
1015)             }
1016)         }
1017)         /**
1018)          * @author fenris
1019)          */
1020)         set_sync(output) {
1021)             switch (this.state) {
1022)                 case 2: {
1023)                     this.output = output;
1024)                     break;
1025)                 }
1026)                 case 3: {
1027)                     this.state = 2;
1028)                     this.output = output;
1029)                     break;
1030)                 }
1031)                 default: {
1032)                     throw (new Error(`unhandled state ${this.state}`));
1033)                     break;
1034)                 }
1035)             }
1036)         }
1037)     }
1038)     lib_call.class_executor_initializer = class_executor_initializer;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

1039) })(lib_call || (lib_call = {}));
1040) var lib_call;
1041) (function (lib_call) {
1042)     /**
1043)      * @author fenris
1044)      */
1045)     var knot_loglevel_stack = [0];
1046)     /**
1047)      * @author fenris
1048)      */
1049)     function knot_loglevel_get() {
1050)         return knot_loglevel_stack.slice(-1)[0];
1051)     }
1052)     lib_call.knot_loglevel_get = knot_loglevel_get;
1053)     /**
1054)      * @author fenris
1055)      */
1056)     function knot_loglevel_push(loglevel) {
1057)         knot_loglevel_stack.push(loglevel);
1058)     }
1059)     lib_call.knot_loglevel_push = knot_loglevel_push;
1060)     /**
1061)      * @author fenris
1062)      */
1063)     function knot_loglevel_pop() {
1064)         knot_loglevel_stack.pop();
1065)     }
1066)     lib_call.knot_loglevel_pop = knot_loglevel_pop;
1067)     /**
1068)      * @author fenris
1069)      */
1070)     function knot_resolver(output) {
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

1072)     }
1073)     lib_call.knot_resolver = knot_resolver;
1074)     /**
1075)      * @author fenris
1076)      */
1077)     function knot_id() {
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

1079)     }
1080)     lib_call.knot_id = knot_id;
1081)     /**
1082)      * @author fenris
1083)      */
1084)     function knot_rejector(error) {
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

1086)     }
1087)     lib_call.knot_rejector = knot_rejector;
1088)     /**
1089)      * @author fenris
1090)      */
1091)     function knot_from_function(function_) {
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

1093)             try {
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

1096)             }
1097)             catch (exception) {
1098)                 reject((exception));
1099)             }
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

1101)     }
1102)     lib_call.knot_from_function = knot_from_function;
1103)     /**
1104)      * @author fenris
1105)      */
1106)     function knot_wrap(inner, convert_input, convert_output, convert_error) {
Christian Fraß update

Christian Fraß authored 6 years ago

1107)         return (input_outer => (resolve, reject) => {
1108)             let input_inner = convert_input(input_outer);
1109)             inner(input_inner)(output_inner => {
1110)                 let output_outer = convert_output(output_inner);
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

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

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

1114)                 return reject(error_outer);
1115)             });
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

1117)     }
1118)     lib_call.knot_wrap = knot_wrap;
1119)     /**
1120)      * @author fenris
1121)      */
1122)     function knot_wrap_log(inner) {
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

1125)             return input;
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

1128)             return output;
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

1131)             return error;
1132)         }));
1133)     }
1134)     lib_call.knot_wrap_log = knot_wrap_log;
1135)     /**
1136)      * @author fenris
1137)      */
1138)     function knot_compose_sequential(first, second) {
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

1140)             ? knot_wrap_log(second)
1141)             : second);
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

1145)     }
1146)     lib_call.knot_compose_sequential = knot_compose_sequential;
1147)     /**
1148)      * @author fenris
1149)      */
Christian Fraß update

Christian Fraß authored 6 years ago

1150)     function knot_chain(knots, logging = false) {
1151)         /*
1152)         return (
1153)             knots.reduce<type_knot<type_input, type_output, type_error>>(
1154)                 knot_compose_sequential,
1155)                 knot_id<any, type_error>()
1156)             )
1157)         );
1158)          */
1159)         let knots_ = (logging
1160)             ? knots.map(knot_wrap_log)
1161)             : knots);
1162)         if (knots_.length == 0) {
1163)             return (input => (resolve, reject) => {
1164)                 resolve(input);
1165)             });
1166)         }
1167)         else {
1168)             return (input => (resolve, reject) => {
1169)                 return knots_[0](input)(result => {
1170)                     return knot_chain(knots_.slice(1), false)(result)(resolve, reject);
1171)                 }, error => {
1172)                     return reject(error);
1173)                 });
1174)             });
1175)         }
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

1176)     }
1177)     lib_call.knot_chain = knot_chain;
1178)     /**
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

1180)      */
1181)     /*
1182)     export function knot_compose_parallel<>(
1183)         upper : type_knot<type_input, type_output_upper, type_error_upper>,
1184)         lower : type_knot<type_input, type_output_lower, type_error_lower>
1185)     ) {
1186)         return (
1187)             input => (resolve, reject) => {
1188)                 upper(input)(
1189)                 )
1190)                 lower(input)(
1191)                 )
1192)             }
1193)         );
1194)     }
1195)      */
1196)     /**
1197)      * @author fenris
1198)      */
1199)     function knot_bunch(knots) {
Christian Fraß update

Christian Fraß authored 6 years ago

1200)         return (input => (resolve, reject) => {
1201)             let done = false;
1202)             let master_output = {};
1203)             let ready = {};
1204)             let master_resolve = (id, output) => {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

1205)                 if (!done) {
1206)                     master_output[id] = output;
1207)                     ready[id] = true;
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

1209)                         done = true;
1210)                         resolve(master_output);
1211)                     }
1212)                     else {
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

1214)                     }
1215)                 }
1216)                 else {
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

1218)                 }
1219)             };
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

1221)                 if (!done) {
1222)                     done = true;
1223)                     reject(error);
1224)                 }
1225)                 else {
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

1227)                 }
1228)             };
Christian Fraß update

Christian Fraß authored 6 years ago

1229)             Object.keys(knots).forEach(id => {
1230)                 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

1231)             });
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

1233)     }
1234)     lib_call.knot_bunch = knot_bunch;
1235)     /**
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

1237)      */
1238)     function knot_condense(knots) {
Christian Fraß update

Christian Fraß authored 6 years ago

1239)         /*
1240)         return (
1241)             input => knot_chain<Array<type_output>, Array<type_output>, type_error>(
1242)                 knots.map<type_knot<Array<type_output>, Array<type_output>, type_error>>(
1243)                     knot => list => (resolve, reject) => {
1244)                         knot(input)(
1245)                             element => resolve(list.concat([element])),
1246)                             reject
1247)                         );
1248)                     }
1249)                 )
1250)             )([])
1251)         );
1252)          */
1253)         if (knots.length == 0) {
1254)             return (input => (resolve, reject) => {
1255)                 resolve([]);
1256)             });
1257)         }
1258)         else {
1259)             return (input => (resolve, reject) => {
1260)                 knots[0](input)(element => {
1261)                     knot_condense(knots.slice(1))(input)(restlist => {
1262)                         resolve([element].concat(restlist));
1263)                     }, reject);
1264)                 }, error => {
1265)                     reject(error);
1266)                 });
1267)             });
1268)         }
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

1269)     }
1270)     lib_call.knot_condense = knot_condense;
1271)     /**
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

1273)      */
Christian Fraß update

Christian Fraß authored 6 years ago

1274)     function knot_first(knots) {
1275)         return (input => (resolve, reject) => {
1276)             knot_condense(knots.map(knot => input_ => (resolve_, reject_) => knot(input)(reject_, resolve_)))(input)(reject, resolve);
1277)         });
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

1278)     }
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

1280)     /**
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

1282)      */
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

1288)     }
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

1290)     /**
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

1293)      */
Christian Fraß update

Christian Fraß authored 6 years ago

1294)     class class_knot_initializer {
1295)         /**
1296)          * @author fenris
1297)          */
1298)         constructor(fetcher) {
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

1299)             this.core = new lib_call.class_executor_initializer(fetcher(null));
Christian Fraß update

Christian Fraß authored 6 years ago

1300)         }
1301)         /**
1302)          * @author fenris
1303)          */
1304)         reset() {
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

1305)             this.core.reset();
Christian Fraß update

Christian Fraß authored 6 years ago

1306)         }
1307)         /**
1308)          * @author fenris
1309)          */
1310)         get(input) {
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

1311)             return (_ => this.core.get());
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

1312)         }
1313)     }
Christian Fraß update

Christian Fraß authored 6 years ago

1314)     lib_call.class_knot_initializer = class_knot_initializer;
1315) })(lib_call || (lib_call = {}));
1316) var lib_call;
1317) (function (lib_call) {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

1318)     /**
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

1320)      */
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

1323)     }
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

1325)     /**
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

1327)      */
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

1330)     }
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

1332)     /**
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

1334)      */
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

1337)     }
Christian Fraß update

Christian Fraß authored 6 years ago

1338)     lib_call.promise_make = promise_make;
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

1339)     /**
1340)      * @author fenris
1341)      */
1342)     function promise_then_close(promise, resolver, rejector) {
1343)         return (promise.then(resolver, rejector));
1344)     }
1345)     lib_call.promise_then_close = promise_then_close;
1346)     /**
1347)      * @author fenris
1348)      */
1349)     function promise_then_append(promise, resolver, rejector = null) {
1350)         if (rejector == null) {
1351)             rejector = (reason) => promise_reject(reason);
1352)         }
1353)         return (promise.then(resolver, rejector));
1354)     }
1355)     lib_call.promise_then_append = promise_then_append;
Christian Fraß update

Christian Fraß authored 6 years ago

1356)     /**
1357)      * @author fenris
1358)      */
1359)     function promise_all(promises) {
1360)         return Promise.all(promises);
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

1361)     }
Christian Fraß update

Christian Fraß authored 6 years ago

1362)     lib_call.promise_all = promise_all;
1363)     /**
1364)      * @author fenris
1365)      */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

1366)     function promise_chain(promises, start = undefined) {
1367)         return (promises.reduce((chain, promise) => promise_then_append(chain, promise), promise_resolve(start)));
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

1368)     }
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

1369)     lib_call.promise_chain = promise_chain;
Christian Fraß update

Christian Fraß authored 6 years ago

1370)     /**
1371)      * @author fenris
1372)      */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

1373)     function promise_wrap(promise, transformator_result, transformator_reason = lib_call.id) {
1374)         return (promise_make((resolve, reject) => {
1375)             promise_then_close(promise, result => resolve(transformator_result(result)), reason => reject(transformator_reason(reason)));
1376)         }));
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

1377)     }
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

1378)     lib_call.promise_wrap = promise_wrap;
Christian Fraß update

Christian Fraß authored 6 years ago

1379)     /**
1380)      * @author fenris
1381)      */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

1382)     function promise_show(label) {
1383)         return (result => promise_make((resolve, reject) => {
1384)             lib_log.info(label + ": " + instance_show(result));
1385)             resolve(result);
1386)         }));
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

1387)     }
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

1388)     lib_call.promise_show = promise_show;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

1389)     /**
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

1391)      */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

1392)     function promise_log(result) {
1393)         return promise_show("log");
Christian Fraß update

Christian Fraß authored 6 years ago

1394)     }
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

1395)     lib_call.promise_log = promise_log;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

1396)     /**
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

1398)      */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

1399)     function promise_attach(state, promise, name) {
1400)         return (promise_wrap(promise, result => {
1401)             state[name] = result;
1402)             return state;
1403)         }));
Christian Fraß update

Christian Fraß authored 6 years ago

1404)     }
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

1405)     lib_call.promise_attach = promise_attach;
1406) })(lib_call || (lib_call = {}));
1407) /**
1408)  * @author fenris
1409)  */
1410) var lib_trait;
1411) (function (lib_trait) {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

1412)     /**
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

1414)      */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

1415)     lib_trait._verbosity = 1;
1416)     /**
1417)      * @author fenris
1418)      */
1419)     function type_show(type) {
1420)         return JSON.stringify(type);
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

1422)     /**
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

1424)      */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

1425)     function type_resolve(raw, bindings) {
1426)         switch (raw.kind) {
1427)             case "variable": {
1428)                 var variable_name = raw.parameters["name"];
1429)                 if (variable_name in bindings) {
1430)                     return bindings[variable_name];
1431)                 }
1432)                 else {
1433)                     var message = "binding missing for variable '" + variable_name + "'";
1434)                     throw (new Error(message));
1435)                 }
1436)                 break;
1437)             }
1438)             case "object": {
1439)                 return {
1440)                     "kind": "object",
1441)                     "parameters": {
1442)                         "fields": raw.parameters["fields"].map(function (field) {
1443)                             return {
1444)                                 "name": field.name,
1445)                                 "type": type_resolve(field.type, bindings)
1446)                             };
1447)                         })
1448)                     }
1449)                 };
1450)                 break;
1451)             }
1452)             default: {
1453)                 return raw;
1454)                 break;
1455)             }
1456)         }
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

1457)     }
1458)     /**
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

1459)      * @desc holds all defined traits
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

1461)      */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

1462)     var _pool = {};
1463)     /**
1464)      * @author fenris
1465)      */
1466)     var _typechecker;
1467)     /**
1468)      * @author fenris
1469)      */
1470)     function set_typechecker(typechecker) {
1471)         _typechecker = typechecker;
1472)     }
1473)     lib_trait.set_typechecker = set_typechecker;
1474)     /**
1475)      * @author fenris
1476)      */
1477)     function domain_instance(domain, value) {
1478)         return { "domain": domain, "value": value };
1479)     }
1480)     lib_trait.domain_instance = domain_instance;
1481)     /**
1482)      * @desc adds a trait
1483)      * @author fenris
1484)      */
1485)     function describe(trait_id, variable_conditions, facet_signatures) {
1486)         if (trait_id in _pool) {
1487)             var error = new Error("trait '" + trait_id + "' already registered");
1488)             throw error;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

1489)         }
1490)         else {
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

1491)             var trait_1 = {
1492)                 "variables": {},
1493)                 "facets": {}
1494)             };
1495)             Object.keys(variable_conditions).forEach(function (variable_name) {
1496)                 var variable = {
1497)                     "conditions": variable_conditions[variable_name],
1498)                     "bindings": {}
1499)                 };
1500)                 trait_1.variables[variable_name] = variable;
Christian Fraß update

Christian Fraß authored 6 years ago

1501)             });
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

1502)             Object.keys(facet_signatures).forEach(function (facet_name) {
1503)                 var facet = {
1504)                     "signature": facet_signatures[facet_name],
1505)                     "handlers": {}
1506)                 };
1507)                 trait_1.facets[facet_name] = facet;
1508)             });
1509)             _pool[trait_id] = trait_1;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

1510)         }
1511)     }
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

1512)     lib_trait.describe = describe;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

1513)     /**
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

1514)      * @desc adhoc binding
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

1516)      */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

1517)     function assign(domain_kind, trait_id, bindings, handlers, strict_binding, strict_handling) {
1518)         if (strict_binding === void 0) { strict_binding = true; }
1519)         if (strict_handling === void 0) { strict_handling = true; }
1520)         if (trait_id in _pool) {
1521)             var trait_2 = _pool[trait_id];
1522)             // assignments
1523)             {
1524)                 // variables
1525)                 {
1526)                     Object.keys(bindings).forEach(function (variable_name) {
1527)                         if (variable_name in trait_2.variables) {
1528)                             var variable = trait_2.variables[variable_name];
1529)                             if (!(domain_kind in variable.bindings)) {
1530)                                 variable.bindings[domain_kind] = bindings[variable_name];
1531)                             }
1532)                             else {
1533)                                 var message = "variable '" + variable_name + "' already bound for domain '" + domain_kind + "' in trait '" + trait_id + "'";
1534)                                 throw (new Error(message));
1535)                             }
1536)                         }
1537)                         else {
1538)                             var message = "no variable '" + variable_name + "' to bind in trait '" + trait_id + "'";
1539)                             console.warn(message);
1540)                             // throw (new Error(message));
1541)                         }
1542)                     });
1543)                 }
1544)                 // facets
1545)                 {
1546)                     Object.keys(handlers).forEach(function (facet_name) {
1547)                         if (facet_name in trait_2.facets) {
1548)                             var facet = trait_2.facets[facet_name];
1549)                             if (!(domain_kind in facet.handlers)) {
1550)                                 facet.handlers[domain_kind] = handlers[facet_name];
1551)                             }
1552)                             else {
1553)                                 var message = "facet '" + facet_name + "' already implemented for domain '" + domain_kind + "' in trait '" + trait_id + "'";
1554)                                 throw (new Error(message));
1555)                             }
1556)                         }
1557)                         else {
1558)                             var message = "no facet '" + facet_name + "' to implement in trait '" + trait_id + "'";
1559)                             console.warn(message);
1560)                             // throw (new Error(message));
1561)                         }
1562)                     });
1563)                 }
1564)             }
1565)             // checks
1566)             {
1567)                 var messages_1 = [];
1568)                 if (strict_binding) {
1569)                     // variables
1570)                     {
1571)                         var variable_names_given_1 = Object.keys(bindings);
1572)                         var variable_names_present = Object.keys(trait_2.variables);
1573)                         var variable_names_missing = variable_names_present.filter(function (variable_name) { return !variable_names_given_1.some(function (variable_name_) { return (variable_name == variable_name_); }); });
1574)                         variable_names_missing.forEach(function (variable_name) {
1575)                             var message = "binding missing for variable '" + variable_name + "'";
1576)                             messages_1.push(message);
1577)                         });
1578)                     }
1579)                 }
1580)                 if (strict_handling) {
1581)                     // facets
1582)                     {
1583)                         var facet_names_given_1 = Object.keys(handlers);
1584)                         var facet_names_present = Object.keys(trait_2.facets);
1585)                         var facet_names_missing = facet_names_present.filter(function (facet_name) { return !facet_names_given_1.some(function (facet_name_) { return (facet_name == facet_name_); }); });
1586)                         facet_names_missing.forEach(function (facet_name) {
1587)                             var message = "implementations missing for the facet '" + facet_name + "'";
1588)                             messages_1.push(message);
1589)                         });
1590)                     }
1591)                     if (messages_1.length > 0) {
1592)                         var message = "assignment of domain '" + domain_kind + "' to trait '" + trait_id + "' incomplete: " + messages_1.join(", ");
1593)                         throw (new Error(message));
1594)                     }
1595)                 }
1596)             }
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

1597)         }
1598)         else {
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

1599)             var message = "no trait '" + trait_id + "'";
1600)             throw (new Error(message));
1601)         }
1602)     }
1603)     lib_trait.assign = assign;
1604)     /**
1605)      * @author fenris
1606)      */
1607)     function call(trait_id, facet_name, domain, input) {
1608)         if (trait_id in _pool) {
1609)             var trait_3 = _pool[trait_id];
1610)             if (facet_name in trait_3.facets) {
1611)                 var facet = trait_3.facets[facet_name];
1612)                 if (domain.kind in facet.handlers) {
1613)                     var handler = facet.handlers[domain.kind];
1614)                     var bindings_1 = {};
1615)                     Object.keys(trait_3.variables).forEach(function (variable_name) {
1616)                         bindings_1[variable_name] = trait_3.variables[variable_name].bindings[domain.kind];
1617)                     });
1618)                     if ((_typechecker != null) && (facet.signature.type_input != undefined)) {
1619)                         var type = type_resolve(facet.signature.type_input, bindings_1);
1620)                         var valid_input = _typechecker(input, type);
1621)                         if (!valid_input) {
1622)                             var message = "input '" + String(input) + "' for domain '" + domain.kind + "' implementing facet '" + facet_name + "' in trait '" + trait_id + "' doesn't match the expected type '" + type_show(type) + "'";
1623)                             console.warn(message);
1624)                         }
Christian Fraß update

Christian Fraß authored 6 years ago

1625)                     }
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

1626)                     var output = handler(domain.parameters)(input);
1627)                     if ((_typechecker != null) && (facet.signature.type_output != undefined)) {
1628)                         var type = type_resolve(facet.signature.type_output, bindings_1);
1629)                         var valid_output = _typechecker(output, type);
1630)                         if (!valid_output) {
1631)                             var message = "output '" + String(output) + "' for domain '" + domain.kind + "' implementing facet '" + facet_name + "' in trait '" + trait_id + "' doesn't match the expected type '" + type_show(type) + "'";
1632)                             console.warn(message);
1633)                         }
Christian Fraß update

Christian Fraß authored 6 years ago

1634)                     }
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

1635)                     return output;
Christian Fraß update

Christian Fraß authored 6 years ago

1636)                 }
1637)                 else {
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

1638)                     var message = "implementation for facet '" + facet_name + "' missing for domain '" + domain.kind + "' belonging to the trait '" + trait_id + "'";
1639)                     throw (new Error(message));
Christian Fraß update

Christian Fraß authored 6 years ago

1640)                 }
1641)             }
1642)             else {
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

1643)                 var message = "no facet '" + facet_name + "' in trait '" + trait_id + "'";
1644)                 throw (new Error(message));
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

1646)         }
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

1647)         else {
1648)             var message = "no trait '" + trait_id + "'";
1649)             throw (new Error(message));
1650)         }
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

1651)     }
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

1652)     lib_trait.call = call;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

1653)     /**
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

1655)      */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

1656)     function show() {
1657)         console.info(JSON.stringify(_pool, undefined, "\t"));
1658)         // console.info(_pool);
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

1659)     }
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

1660)     lib_trait.show = show;
1661) })(lib_trait || (lib_trait = {}));
1662) /**
1663)  * @author fenris
1664)  */
1665) var lib_trait;
1666) (function (lib_trait) {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

1667)     /**
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

1668)      * @desc the ability to check for equality with another element of the same domain
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

1670)      */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

1671)     function define_collatable() {
1672)         lib_trait.describe("collatable", {
1673)             "value": []
1674)         }, {
1675)             "collate": {
1676)                 "type_input": {
1677)                     "kind": "object",
1678)                     "parameters": {
1679)                         "fields": [
1680)                             {
1681)                                 "name": "left",
1682)                                 "type": {
1683)                                     "kind": "variable",
1684)                                     "parameters": {
1685)                                         "name": "value"
1686)                                     }
1687)                                 }
1688)                             },
1689)                             {
1690)                                 "name": "right",
1691)                                 "type": {
1692)                                     "kind": "variable",
1693)                                     "parameters": {
1694)                                         "name": "value"
1695)                                     }
1696)                                 }
1697)                             }
1698)                         ]
1699)                     }
1700)                 },
1701)                 "type_output": {
1702)                     "kind": "boolean"
1703)                 }
Christian Fraß update

Christian Fraß authored 6 years ago

1704)             }
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

1705)         });
1706)         lib_trait.assign("auto", "collatable", {
1707)             "value": {
1708)                 "kind": "any"
1709)             }
1710)         }, {
1711)             "collate": function (_) { return function (_a) {
1712)                 var x = _a["left"], y = _a["right"];
1713)                 if (typeof (x) === "object") {
1714)                     if (x == null) {
1715)                         return (y == null);
1716)                     }
1717)                     else {
1718)                         if ("_collate" in x) {
1719)                             return x["_collate"](y);
1720)                         }
1721)                         else {
1722)                             throw (new Error("[collate]" + " " + "object has no such method"));
1723)                         }
1724)                     }
Christian Fraß update

Christian Fraß authored 6 years ago

1725)                 }
1726)                 else {
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

1727)                     if (lib_trait._verbosity >= 1) {
1728)                         console.warn("[collate]" + " " + "primitive value; using default implementation");
1729)                     }
1730)                     return (x === y);
Christian Fraß update

Christian Fraß authored 6 years ago

1731)                 }
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

1732)             }; }
Christian Fraß update

Christian Fraß authored 6 years ago

1733)         });
1734)     }
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

1735)     lib_trait.define_collatable = define_collatable;
1736) })(lib_trait || (lib_trait = {}));
1737) /**
1738)  * @author fenris
1739)  */
1740) var lib_trait;
1741) (function (lib_trait) {
Christian Fraß update

Christian Fraß authored 6 years ago

1742)     /**
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

1743)      * @desc the ability to compare with another element of the same domain for determining if the first is "smaller than or equal to" the latter
Christian Fraß update

Christian Fraß authored 6 years ago

1744)      * @author fenris
1745)      */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

1746)     function define_comparable() {
1747)         lib_trait.describe("comparable", {
1748)             "value": []
1749)         }, {
1750)             "compare": {
1751)                 "type_input": {
1752)                     "kind": "object",
1753)                     "parameters": {
1754)                         "fields": [
1755)                             {
1756)                                 "name": "left",
1757)                                 "type": {
1758)                                     "kind": "variable",
1759)                                     "parameters": {
1760)                                         "name": "value"
1761)                                     }
Christian Fraß update

Christian Fraß authored 6 years ago

1762)                                 }
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

1763)                             },
1764)                             {
1765)                                 "name": "right",
1766)                                 "type": {
1767)                                     "kind": "variable",
1768)                                     "parameters": {
1769)                                         "name": "value"
1770)                                     }
Christian Fraß update

Christian Fraß authored 6 years ago

1771)                                 }
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

1772)                             }
1773)                         ]
1774)                     }
1775)                 },
1776)                 "type_output": {
1777)                     "kind": "boolean"
1778)                 }
1779)             }
1780)         });
1781)         lib_trait.assign("auto", "comparable", {
1782)             "value": {
1783)                 "kind": "any"
1784)             }
1785)         }, {
1786)             "compare": function (_) { return function (_a) {
1787)                 var x = _a["left"], y = _a["right"];
1788)                 if (typeof (x) === "object") {
1789)                     if ("_compare" in x) {
1790)                         return x["_compare"](y);
Christian Fraß update

Christian Fraß authored 6 years ago

1791)                     }
1792)                     else {
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

1793)                         throw (new Error("[compare]" + " " + "object has no such method"));
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

1795)                 }
1796)                 else {
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

1797)                     if (lib_trait._verbosity >= 1) {
1798)                         console.warn("[compare]" + " " + "primitive value; using default implementation");
Christian Fraß update

Christian Fraß authored 6 years ago

1799)                     }
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

1800)                     return (x <= y);
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

1801)                 }
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

1802)             }; }
1803)         });
Christian Fraß update

Christian Fraß authored 6 years ago

1804)     }
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

1805)     lib_trait.define_comparable = define_comparable;
1806) })(lib_trait || (lib_trait = {}));
1807) /**
1808)  * @author fenris
1809)  */
1810) var lib_trait;
1811) (function (lib_trait) {
Christian Fraß update

Christian Fraß authored 6 years ago

1812)     /**
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

1813)      * @desc the ability to create an exact copy
Christian Fraß update

Christian Fraß authored 6 years ago

1814)      * @author fenris
1815)      */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

1816)     function define_clonable() {
1817)         lib_trait.describe("clonable", {
1818)             "value": []
1819)         }, {
1820)             "clone": {
1821)                 "type_input": {
1822)                     "kind": "variable",
1823)                     "parameters": {
1824)                         "name": "value"
1825)                     }
1826)                 },
1827)                 "type_output": {
1828)                     "kind": "variable",
1829)                     "parameters": {
1830)                         "name": "value"
1831)                     }
1832)                 }
1833)             }
1834)         });
1835)         lib_trait.assign("auto", "clonable", {
1836)             "value": {
1837)                 "kind": "any"
1838)             }
1839)         }, {
1840)             "clone": function (_) { return function (x) {
1841)                 if (typeof (x) === "object") {
1842)                     if ("_clone" in x) {
1843)                         return x["_clone"]();
1844)                     }
1845)                     else {
1846)                         throw (new Error("[clone]" + " " + "object has no such method"));
1847)                     }
1848)                 }
1849)                 else {
1850)                     if (lib_trait._verbosity >= 1) {
1851)                         console.warn("[clone]" + " " + "primitive value; using default implementation");
1852)                     }
1853)                     return x;
1854)                 }
1855)             }; }
1856)         });
Christian Fraß update

Christian Fraß authored 6 years ago

1857)     }
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

1858)     lib_trait.define_clonable = define_clonable;
1859) })(lib_trait || (lib_trait = {}));
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

1860) /**
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

1862)  */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

1863) var lib_trait;
1864) (function (lib_trait) {
1865)     /**
1866)      * @desc the ability to generate a string out of the element, which identifies it to a high degree
1867)      * @author fenris
1868)      */
1869)     function define_hashable() {
1870)         lib_trait.describe("hashable", {
1871)             "value": []
1872)         }, {
1873)             "hash": {
1874)                 "type_input": {
1875)                     "kind": "variable",
1876)                     "parameters": {
1877)                         "name": "value"
1878)                     }
1879)                 },
1880)                 "type_output": {
1881)                     "kind": "string"
1882)                 }
1883)             }
1884)         });
1885)         lib_trait.assign("auto", "hashable", {
1886)             "value": {
1887)                 "kind": "any"
1888)             }
1889)         }, {
1890)             "hash": function (_) { return function (x) {
1891)                 if (typeof (x) === "object") {
1892)                     if ("_hash" in x) {
1893)                         return x["_hash"]();
Christian Fraß update

Christian Fraß authored 6 years ago

1894)                     }
1895)                     else {
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

1896)                         throw (new Error("[hash]" + " " + "object has no such method"));
Christian Fraß update

Christian Fraß authored 6 years ago

1897)                     }
1898)                 }
1899)                 else {
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

1900)                     if (lib_trait._verbosity >= 1) {
1901)                         console.warn("[hash]" + " " + "primitive value; using default implementation");
Christian Fraß update

Christian Fraß authored 6 years ago

1902)                     }
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

1903)                     return String(x);
1904)                 }
1905)             }; }
1906)         });
1907)     }
1908)     lib_trait.define_hashable = define_hashable;
1909) })(lib_trait || (lib_trait = {}));
1910) /**
1911)  * @author fenris
1912)  */
1913) var lib_trait;
1914) (function (lib_trait) {
1915)     /**
1916)      * @desc the ability to map the element to a textual representation (most likely not injective)
1917)      * @author fenris
1918)      */
1919)     function define_showable() {
1920)         lib_trait.describe("showable", {
1921)             "value": []
1922)         }, {
1923)             "show": {
1924)                 "type_input": {
1925)                     "kind": "variable",
1926)                     "parameters": {
1927)                         "name": "value"
Christian Fraß update

Christian Fraß authored 6 years ago

1928)                     }
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

1929)                 },
1930)                 "type_output": {
1931)                     "kind": "string"
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

1933)             }
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

1934)         });
1935)         lib_trait.assign("auto", "showable", {
1936)             "value": {
1937)                 "kind": "any"
1938)             }
1939)         }, {
1940)             "show": function (_) { return function (x) {
1941)                 if (typeof (x) === "object") {
1942)                     if (x == null) {
1943)                         return "NULL";
Christian Fraß update

Christian Fraß authored 6 years ago

1944)                     }
1945)                     else {
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

1946)                         if ("_show" in x) {
1947)                             return x["_show"]();
Christian Fraß update

Christian Fraß authored 6 years ago

1948)                         }
1949)                         else {
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

1950)                             // throw (new Error("[show]" + " " + "object has no such method"));
1951)                             return JSON.stringify(x);
Christian Fraß update

Christian Fraß authored 6 years ago

1952)                         }
1953)                     }
1954)                 }
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

1955)                 else {
1956)                     if (lib_trait._verbosity >= 1) {
1957)                         console.warn("[show]" + " " + "primitive value; using default implementation");
1958)                     }
1959)                     return String(x);
1960)                 }
1961)             }; }
1962)         });
1963)     }
1964)     lib_trait.define_showable = define_showable;
1965) })(lib_trait || (lib_trait = {}));
Christian Fraß update

Christian Fraß authored 6 years ago

1966) /**
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

1967)  * @author fenris
Christian Fraß update

Christian Fraß authored 6 years ago

1968)  */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

1969) var lib_trait;
1970) (function (lib_trait) {
1971)     /**
1972)      * @author fenris
1973)      */
1974)     function define_common() {
1975)         lib_trait.define_collatable();
1976)         lib_trait.define_comparable();
1977)         lib_trait.define_clonable();
1978)         lib_trait.define_hashable();
1979)         lib_trait.define_showable();
Christian Fraß update

Christian Fraß authored 6 years ago

1980)     }
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

1981)     lib_trait.define_common = define_common;
1982) })(lib_trait || (lib_trait = {}));
1983) ///<reference path="../../base/build/logic-decl.d.ts"/>
1984) var lib_object;
1985) (function (lib_object) {
1986)     /**
1987)      * @author fenris
1988)      */
1989)     function fetch(object, fieldname, fallback, escalation) {
1990)         if (fallback === void 0) { fallback = null; }
1991)         if (escalation === void 0) { escalation = 1; }
1992)         if ((fieldname in object) && (object[fieldname] !== undefined)) {
1993)             return object[fieldname];
1994)         }
1995)         else {
1996)             switch (escalation) {
1997)                 case 0: {
1998)                     return fallback;
1999)                     break;
2000)                 }
2001)                 case 1: {
2002)                     var message = ("field '" + fieldname + "' not in structure");
2003)                     message += ("; using fallback value '" + String(fallback) + "'");
2004)                     // console.warn(message);
2005)                     return fallback;
2006)                     break;
2007)                 }
2008)                 case 2: {
2009)                     var message = ("field '" + fieldname + "' not in structure");
2010)                     throw (new Error(message));
2011)                     break;
2012)                 }
2013)                 default: {
2014)                     throw (new Error("invalid escalation level " + escalation));
2015)                     break;
2016)                 }
2017)             }
2018)         }
Christian Fraß update

Christian Fraß authored 6 years ago

2019)     }
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

2020)     lib_object.fetch = fetch;
2021)     /**
2022)      * @author fenris
2023)      */
2024)     function map(object_from, transformator) {
2025)         var object_to = {};
2026)         Object.keys(object_from).forEach(function (key) { return (object_to[key] = transformator(object_from[key], key)); });
2027)         return object_to;
2028)     }
2029)     lib_object.map = map;
2030)     /**
2031)      * @author fenris
2032)      */
2033)     function filter(object_from, predicate) {
2034)         var object_to = {};
2035)         Object.keys(object_from).forEach(function (key) {
2036)             var value = object_from[key];
2037)             if (predicate(value, key)) {
2038)                 object_to[key] = value;
2039)             }
2040)         });
2041)         return object_to;
2042)     }
2043)     lib_object.filter = filter;
2044)     /**
2045)      * @author fenris
2046)      */
2047)     function from_array(array) {
2048)         var object = {};
2049)         array.forEach(function (entry) { return (object[entry.key] = entry.value); });
2050)         return object;
2051)     }
2052)     lib_object.from_array = from_array;
2053)     /**
2054)      * @author fenris
2055)      */
2056)     function to_array(object) {
2057)         var array = [];
2058)         Object.keys(object).forEach(function (key) { return array.push({ "key": key, "value": object[key] }); });
2059)         return array;
2060)     }
2061)     lib_object.to_array = to_array;
2062)     /**
2063)      * @author fenris
2064)      */
2065)     function keys(object) {
2066)         return Object.keys(object);
2067)     }
2068)     lib_object.keys = keys;
2069)     /**
2070)      * @author fenris
2071)      */
2072)     function values(object) {
2073)         return to_array(object).map(function (entry) { return entry.value; });
2074)     }
2075)     lib_object.values = values;
2076)     /**
2077)      * @author fenris
2078)      */
2079)     function path_read(object, path, fallback, escalation) {
2080)         if (fallback === void 0) { fallback = null; }
2081)         if (escalation === void 0) { escalation = 1; }
2082)         var steps = ((path.length == 0) ? [] : path.split("."));
2083)         if (steps.length == 0) {
2084)             throw (new Error("empty path"));
2085)         }
2086)         else {
2087)             var position_1 = object;
2088)             var reachable = (position_1 != null) && steps.slice(0, steps.length - 1).every(function (step) {
2089)                 position_1 = object_fetch(position_1, step, null, 0);
2090)                 return (position_1 != null);
2091)             });
2092)             if (reachable) {
2093)                 return object_fetch(position_1, steps[steps.length - 1], fallback, escalation);
Christian Fraß update

Christian Fraß authored 6 years ago

2094)             }
2095)             else {
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

2096)                 return object_fetch({}, "_dummy_", fallback, escalation);
Christian Fraß update

Christian Fraß authored 6 years ago

2097)             }
2098)         }
2099)     }
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

2100)     lib_object.path_read = path_read;
2101)     /**
2102)      * @author fenris
2103)      */
2104)     function path_write(object, path, value, construct) {
2105)         if (construct === void 0) { construct = true; }
2106)         var steps = ((path.length == 0) ? [] : path.split("."));
2107)         if (steps.length == 0) {
2108)             throw (new Error("empty path"));
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

2109)         }
2110)         else {
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

2111)             var position_2 = object;
2112)             var reachable = steps.slice(0, steps.length - 1).every(function (step) {
2113)                 var position_ = object_fetch(position_2, step, null, 0);
2114)                 if (position_ == null) {
2115)                     if (construct) {
2116)                         position_2[step] = {};
2117)                         position_2 = position_2[step];
2118)                         return true;
2119)                     }
2120)                     else {
2121)                         return false;
2122)                     }
2123)                 }
2124)                 else {
2125)                     position_2 = position_;
2126)                     return true;
2127)                 }
2128)             });
2129)             if (reachable) {
2130)                 position_2[steps[steps.length - 1]] = value;
Christian Fraß update

Christian Fraß authored 6 years ago

2131)             }
2132)             else {
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

2133)                 throw (new Error("path " + path + " does not exist and may not be constructed"));
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

2135)         }
Christian Fraß update

Christian Fraß authored 6 years ago

2136)     }
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

2137)     lib_object.path_write = path_write;
2138)     /**
2139)      * @author fenris
2140)      */
2141)     function matches(object, pattern, collate) {
2142)         if (collate === void 0) { collate = instance_collate; }
2143)         return Object.keys(pattern).every(function (key) { return collate(pattern[key], object[key]); });
2144)     }
2145)     lib_object.matches = matches;
2146)     /**
2147)      * @author fenris
2148)      */
2149)     function flatten(value) {
2150)         var integrate = function (result, key_, value_) {
2151)             if (value_ == null) {
2152)                 result[key_] = value_;
Christian Fraß update

Christian Fraß authored 6 years ago

2153)             }
2154)             else {
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

2155)                 if (typeof (value_) != "object") {
2156)                     result[key_] = value_;
2157)                 }
2158)                 else {
2159)                     var result_1 = flatten(value_);
2160)                     Object.keys(result_1).forEach(function (key__) {
2161)                         var value__ = result_1[key__];
2162)                         result[key_ + "." + key__] = value__;
2163)                     });
2164)                 }
Christian Fraß update

Christian Fraß authored 6 years ago

2165)             }
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

2166)         };
2167)         if (value == null) {
2168)             return null;
2169)         }
2170)         else {
2171)             var result_2 = {};
2172)             if (typeof (value) != "object") {
2173)                 result_2["value"] = value;
Christian Fraß update

Christian Fraß authored 6 years ago

2174)             }
2175)             else {
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

2176)                 if (value instanceof Array) {
2177)                     var array = (value);
2178)                     array.forEach(function (element, index) { return integrate(result_2, "element_" + index, element); });
2179)                 }
2180)                 else {
2181)                     var object_1 = (value);
2182)                     Object.keys(object_1).forEach(function (key) { return integrate(result_2, key, object_1[key]); });
2183)                 }
Christian Fraß update

Christian Fraß authored 6 years ago

2184)             }
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

2185)             return result_2;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

2186)         }
Christian Fraß update

Christian Fraß authored 6 years ago

2187)     }
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

2188)     lib_object.flatten = flatten;
2189)     /**
2190)      * @author fenris
2191)      */
2192)     function clash(x, y, _a) {
2193)         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;
2194)         if (hook_existing == null) {
2195)             (function (key, value_old, value_new) { return console.warn("field " + key + " already defined"); });
2196)         }
2197)         var z = {};
2198)         Object.keys(x).forEach(function (key) {
2199)             z[key] = x[key];
2200)         });
2201)         Object.keys(y).forEach(function (key) {
2202)             if (key in z) {
2203)                 hook_existing(key, z[key], y[key]);
2204)                 if (overwrite) {
2205)                     z[key] = y[key];
2206)                 }
Christian Fraß update

Christian Fraß authored 6 years ago

2207)             }
2208)             else {
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

2209)                 z[key] = y[key];
2210)             }
2211)         });
2212)         return z;
2213)     }
2214)     lib_object.clash = clash;
2215)     /**
2216)      * @author fenris
2217)      */
2218)     function patch(core, mantle, deep, path) {
2219)         if (deep === void 0) { deep = true; }
2220)         if (path === void 0) { path = null; }
2221)         if (mantle == null) {
2222)             console.warn("mantle is null; core was", core);
2223)         }
2224)         else {
2225)             Object.keys(mantle).forEach(function (key) {
2226)                 var path_ = ((path == null) ? key : path + "." + key);
2227)                 var value_mantle = mantle[key];
2228)                 if (!(key in core)) {
2229)                     if ((typeof (value_mantle) == "object") && (value_mantle != null) && deep) {
2230)                         if (value_mantle instanceof Array) {
2231)                             core[key] = [];
2232)                             value_mantle.forEach(function (element) {
2233)                                 if ((typeof (element) == "object") && (element != null)) {
2234)                                     var element_ = {};
2235)                                     patch(element_, element);
2236)                                     core[key].push(element_);
2237)                                 }
2238)                                 else {
2239)                                     core[key].push(element);
2240)                                 }
2241)                             });
2242)                         }
2243)                         else {
2244)                             core[key] = {};
2245)                             patch(core[key], value_mantle, deep, path_);
2246)                         }
2247)                     }
2248)                     else {
2249)                         core[key] = value_mantle;
2250)                     }
Christian Fraß update

Christian Fraß authored 6 years ago

2251)                 }
2252)                 else {
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

2253)                     var value_core = core[key];
2254)                     if (typeof (value_core) == typeof (value_mantle)) {
2255)                         if ((typeof (value_mantle) == "object") && (value_mantle != null) && deep) {
2256)                             patch(core[key], value_mantle, deep, path_);
2257)                         }
2258)                         else {
2259)                             core[key] = value_mantle;
2260)                         }
2261)                     }
2262)                     else {
2263)                         if ((value_core != null) && (value_mantle != null)) {
2264)                             var message = "objects have different shapes at path '" + path_ + "'; core has type '" + typeof (value_core) + "' and mantle has type '" + typeof (value_mantle) + "'";
2265)                             console.warn(message);
2266)                         }
2267)                         core[key] = value_mantle;
2268)                         // throw (new Error(message));
2269)                     }
Christian Fraß update

Christian Fraß authored 6 years ago

2270)                 }
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

2272)         }
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

2273)     }
2274)     lib_object.patch = patch;
2275)     /**
2276)      * @author fenris
2277)      */
2278)     function patched(core, mantle, deep) {
2279)         if (deep === void 0) { deep = undefined; }
2280)         var result = {};
2281)         patch(result, core, deep);
2282)         patch(result, mantle, deep);
2283)         return result;
2284)     }
2285)     lib_object.patched = patched;
2286)     /**
2287)      * @author fenris
2288)      */
2289)     function attached(object, key, value) {
2290)         var mantle = {};
2291)         mantle[key] = value;
2292)         return patched(object, mantle, false);
2293)     }
2294)     lib_object.attached = attached;
2295)     /**
2296)      * @author fenris
2297)      */
2298)     function copy(object) {
2299)         return patched({}, object);
2300)     }
2301)     lib_object.copy = copy;
2302) })(lib_object || (lib_object = {}));
2303) /**
2304)  * @desc adapters for old syntax
2305)  * @author fenris
2306)  */
2307) var object_fetch = lib_object.fetch;
2308) var object_map = lib_object.map;
2309) var object_a2o = lib_object.from_array;
2310) var object_o2a = lib_object.to_array;
2311) var object_matches = lib_object.matches;
2312) var object_clash = lib_object.clash;
2313) ///<reference path="../../base/build/logic-decl.d.ts"/>
2314) /**
2315)  * @param {Object} map
2316)  * @return {string}
2317)  * @author frac
2318)  */
2319) /*export*/ var object_map2string = function (map) {
2320)     return (" " + Object.keys(map)
2321)         .filter(function (key) { return (key != "isMapped"); })
2322)         .map(function (key) { return ("" + ((map[key] == null) ? "-" : map[key].toString()) + ""); })
2323)         .join(" ")
2324)         + "");
Christian Fraß update

Christian Fraß authored 6 years ago

2325) };
2326) /**
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

2327)  * @param {Array} array
2328)  * @return {string}
2329)  * @author frac
Christian Fraß update

Christian Fraß authored 6 years ago

2330)  */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

2331) /*export*/ var object_array2string = function (array) {
2332)     return ("" + array.map(function (element, index) {
2333)         switch (typeof (element)) {
2334)             case "object": return object_map2string(element);
2335)             default: return String(element);
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

2336)         }
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

2337)     }).join(",") + "");
Christian Fraß update

Christian Fraß authored 6 years ago

2338) };
2339) /**
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

2340)  * @desc follows a path in an object-tree
2341)  * @param {Object} object the object in which the path lies
2342)  * @param {string} path the steps
2343)  * @param {boolean} [create] whether to create not yet existing branches
2344)  * @return {Object} {'successful': successful, 'position': position} where the branch or leaf at the end of the path
2345)  * @author frac
Christian Fraß update

Christian Fraß authored 6 years ago

2346)  */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

2347) var object_path_walk = function (object, path, create, null_on_missing) {
2348)     if (create === void 0) { create = true; }
2349)     if (null_on_missing === void 0) { null_on_missing = false; }
2350)     var steps = ((path == "") ? [] : path.split("."));
2351)     if (steps.length == 0) {
2352)         return object;
2353)     }
2354)     else {
2355)         var head = steps[0];
2356)         // create
2357)         {
2358)             if (!(head in object)) {
2359)                 if (create) {
2360)                     var value = null;
2361)                     if (steps.length >= 2) {
2362)                         var next = steps[1];
2363)                         var index = parseInt(next);
2364)                         if (!isNaN(index)) {
2365)                             value = [];
2366)                         }
2367)                         else {
2368)                             value = {};
2369)                         }
2370)                     }
2371)                     else {
2372)                         value = {};
2373)                     }
2374)                     object[head] = value;
2375)                 }
2376)                 else {
2377)                     // console.info("[object_path_walk] object is ", object);
2378)                     var message = "[object_path_walk] can not walk step \u00BB" + head + "\u00AB in path \u00BB" + path + "\u00AB on object";
2379)                     if (null_on_missing) {
2380)                         console.warn(message);
2381)                         return null;
2382)                     }
2383)                     else {
2384)                         throw (new Error(message));
2385)                     }
2386)                 }
2387)             }
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

2388)         }
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

2389)         // execute rest
2390)         {
2391)             var object_ = object[head];
2392)             var path_ = steps.slice(1).join(".");
2393)             return object_path_walk(object_, path_, create, null_on_missing);
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

2394)         }
Christian Fraß update

Christian Fraß authored 6 years ago

2395)     }
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

2396)     /*
2397)     return (
2398)         string_split(path, ".").reduce(
2399)             function (position : any, step : string) : any {
2400)                 if (! lib_call.is_def(position[step], true)) {
2401)                     if (create) {
2402)                         position[step] = {};
2403)                     }
2404)                     else {
2405)                         // console.info("[object_path_walk] object is ", object);
2406)                         let message : string = sprintf("[object_path_walk] can not walk step »%s« in path »%s« on object", [step, path]);
2407)                         if (null_on_missing) {
2408)                             console.warn(message);
2409)                             return null;
2410)                         }
2411)                         else {
2412)                             throw (new Error(message));
2413)                         }
2414)                     }
2415)                 }
2416)                 return position[step];
2417)             },
2418)             object
2419)         )
2420)     );
2421)      */
2422) };
2423) /**
2424)  * @desc reads a branch/leaf from an object-tree
2425)  * @author frac
2426)  */
2427) /*export*/ var object_path_read = function (object, path, null_on_missing) {
2428)     if (null_on_missing === void 0) { null_on_missing = false; }
2429)     return object_path_walk(object, path, false, null_on_missing);
2430) };
2431) /**
2432)  * @desc writes a branch/leaf to an object-tree
2433)  * @author frac
2434)  */
2435) /*export*/ var object_path_write = function (object, path, value) {
2436)     // for "initializing" the object (important if the value to write is an entry in a yet not existing array)
2437)     /*let old : any = */ object_path_walk(object, path, true, true);
2438)     var steps = ((path == "") ? [] : path.split("."));
2439)     var position = object_path_walk(object, steps.slice(0, steps.length - 1).join("."), true);
2440)     if (position == undefined) {
2441)         console.warn("can't set \u00BB" + steps[steps.length - 1] + "\u00AB in undefined");
Christian Fraß update

Christian Fraß authored 6 years ago

2442)     }
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

2443)     else {
2444)         position[steps[steps.length - 1]] = value;
Christian Fraß update

Christian Fraß authored 6 years ago

2445)     }
2446) };
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

2447) /*export*/ var object_object_path_write_ex = function (obj, path, val) {
2448)     var ref = obj;
2449)     var paths = path.split(".");
2450)     var i;
2451)     for (i = 0; i < paths.length - 1; i++) {
2452)         if (ref[paths[i]] === void 0) {
2453)             if (/^(0|[1-9][0-9]*)$/.test(paths[i + 1])) {
2454)                 ref[paths[i]] = [];
Christian Fraß update

Christian Fraß authored 6 years ago

2455)             }
2456)             else {
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

2457)                 ref[paths[i]] = {};
Christian Fraß update

Christian Fraß authored 6 years ago

2458)             }
2459)         }
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

2460)         ref = ref[paths[i]];
Christian Fraß update

Christian Fraß authored 6 years ago

2461)     }
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

2462)     ref[paths[i]] = val;
Christian Fraß update

Christian Fraß authored 6 years ago

2463) };
2464) /**
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

2465)  * @desc filters branches from an object
2466)  * @param {Object} object the object to read from
2467)  * @param {Array} paths a list of string-lists, that are the paths to be propagated
2468)  * @return {Object} the object with only the selected branches
2469)  * @author frac
Christian Fraß update

Christian Fraß authored 6 years ago

2470)  */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

2471) /*export*/ var object_path_filter = function (object, paths) {
2472)     var result = {};
2473)     paths.forEach(function (path) {
2474)         var value = null;
2475)         try {
2476)             value = object_path_read(object, path);
2477)         }
2478)         catch (exception) {
2479)             console.warn(exception);
2480)         }
2481)         if (value != null) {
2482)             object_path_write(result, path, value);
Christian Fraß update

Christian Fraß authored 6 years ago

2483)         }
2484)         else {
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

2485)             console.warn("skipped path \"" + path + "\" while filtering");
Christian Fraß update

Christian Fraß authored 6 years ago

2486)         }
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

2487)     });
2488)     return result;
Christian Fraß update

Christian Fraß authored 6 years ago

2489) };
2490) /**
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

2491)  * @desc dunno… returns a list of object-paths?
2492)  * @param {Object} object
2493)  * @param {string} p
2494)  * @todo can probably be merged with getLeafg
Christian Fraß update

Christian Fraß authored 6 years ago

2495)  */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

2496) /*export*/ var object_path_list = function (object, path, visited) {
2497)     if (path === void 0) { path = null; }
2498)     if (visited === void 0) { visited = []; }
2499)     var result = [];
2500)     visited.push(object);
2501)     for (var key in object) {
2502)         var value = object[key];
2503)         if (visited.indexOf(value) === -1) {
2504)             var key_ = (path == null) ? key : (path + "." + key);
2505)             if (typeof (value) === "object") {
2506)                 result = result.concat(object_path_list(value, key_, visited));
2507)             }
2508)             else {
2509)                 result.push({ "key": key_, "value": value });
2510)             }
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

2511)         }
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

2512)     }
2513)     return result;
2514) };
2515) /**
2516)  * theroreticaly loop prof walk through all elements and subelements of an object
2517)  * and call a callback for each entry
2518)  * @param {object} obj object to iterate through
2519)  * @param {function} callback
2520)  */
2521) /*export*/ var object_iterate = function (obj, callback, leafs_only, path, visited) {
2522)     if (leafs_only === void 0) { leafs_only = false; }
2523)     if (visited === void 0) { visited = []; }
2524)     var have_seen = function (ob) {
2525)         return visited.some(function (e) { return ((typeof (ob) === "object") && (ob !== null) && (e === ob)); });
2526)     };
2527)     var next = [];
2528)     Object.keys(obj).forEach(function (key) {
2529)         var elem = obj[key];
2530)         if (!have_seen(elem)) {
2531)             visited.push(elem);
2532)             var _path = "";
2533)             if (typeof path === "undefined") {
2534)                 _path = key;
2535)             }
2536)             else {
2537)                 _path += [path, key].join(".");
2538)             }
2539)             if (!leafs_only)
2540)                 callback(_path, elem, key);
2541)             if (typeof (elem) === "object") {
2542)                 (function (elem_, callback_, _path_, visited_) {
2543)                     next.push(function () { object_iterate(elem_, callback_, leafs_only, _path_, visited_); });
2544)                 })(elem, callback, _path, visited);
2545)             }
2546)             else {
2547)                 if (leafs_only)
2548)                     callback(_path, elem, key);
2549)             }
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

2550)         }
Christian Fraß update

Christian Fraß authored 6 years ago

2551)     });
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

2552)     var func;
2553)     while (func = next.shift()) {
2554)         func();
Christian Fraß update

Christian Fraß authored 6 years ago

2555)     }
2556) };
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

2557) /**
2558)  * @desc get the leaf-nodes of an object
2559)  * @param {object} object
2560)  * @return {Array<string>} a list containing all leaf-nodes
2561)  * @author frac
2562)  */
2563) /*export*/ var getLeafs = function (object) {
2564)     var skip = {
2565)         "className": true,
2566)         "timeStamp": true,
2567)         "parentId": true,
2568)         "transactionID": true,
2569)         "guid": true,
2570)         "_id": true,
2571)         "parents": true,
2572)         "children": true
2573)     };
2574)     return (Object.keys(object).reduce(function (leafs, key) {
2575)         try {
2576)             var value = object[key];
2577)             if (key in skip) {
2578)                 console.warn("skipping field \"" + key + "\"");
2579)                 return leafs;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

2580)             }
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

2581)             else {
2582)                 if ((typeof (value) === "object") && (value != null)) {
2583)                     return leafs.concat(getLeafs(value).map(function (leaf) { return (key + "." + leaf); }));
2584)                 }
2585)                 else {
2586)                     return leafs.concat([key]);
2587)                 }
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

2588)             }
2589)         }
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

2590)         catch (exception) {
2591)             console.warn(exception);
2592)             console.info("key: ", key);
2593)             return null;
Christian Fraß update

Christian Fraß authored 6 years ago

2594)         }
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

2595)     }, new Array()));
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

2597) /**
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

2598)  *
2599)  * @desc merges two arrays by probing
2600)  * @param {Array} core
2601)  * @param {Array} mantle
2602)  * @param {function} match
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

2603)  */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

2604) /*export*/ var merge_array = function (core, mantle, match) {
2605)     if (match === void 0) { match = (function (x, y) { return (x === y); }); }
2606)     if ((core == undefined) || (mantle == undefined)) {
2607)         throw (new Error("Error: "
2608)             + ((core == undefined) ? " core must be an array and not '" + typeof (core) + "'" : "")
2609)             + ((mantle == undefined) ? " mantle must be an array and not '" + typeof (mantle) + "'" : "")));
2610)     }
2611)     var ret = core;
2612)     for (var i = 0; i < mantle.length; i++) {
2613)         var entry = mantle[i];
2614)         try {
2615)             var matching_index = core.find(function (element) { return match(element, entry); });
2616)             ret[matching_index] = object_merge_objects(core[matching_index], entry);
2617)         }
2618)         catch (e) {
2619)             ret.push(entry);
2620)         }
2621)     }
2622)     return ret;
Christian Fraß update

Christian Fraß authored 6 years ago

2623) };
2624) /**
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

2625)  * @desc merges two objects recursivly
2626)  * @param {Object} object1 core
2627)  * @param {Object} object2 mantle
2628)  * @param {Array} [ignore_keys]
2629)  * @param [do_not_overwrite_existing_values]
2630)  * @returns {Object} a clone of object1 will be returned
Christian Fraß update

Christian Fraß authored 6 years ago

2631)  */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

2632) /*export*/ var object_merge_objects = function (object1, object2, ignore_keys, do_not_overwrite_existing_values, ignore_null, path) {
2633)     if (object1 === void 0) { object1 = null; }
2634)     if (object2 === void 0) { object2 = null; }
2635)     if (ignore_keys === void 0) { ignore_keys = ["parents"]; }
2636)     if (do_not_overwrite_existing_values === void 0) { do_not_overwrite_existing_values = false; }
2637)     if (ignore_null === void 0) { ignore_null = false; }
2638)     if (path === void 0) { path = []; }
2639)     if (object1 == null) {
2640)         if (object2 instanceof Array) {
2641)             object1 = [];
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

2642)         }
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

2645)         }
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

2646)     }
2647)     var iteration_keys = Object.keys(object2);
2648)     if (ignore_keys === []) {
2649)         if (path.indexOf(object2) >= 0)
Christian Fraß update

Christian Fraß authored 6 years ago

2650)             return undefined;
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

2651)         path.push(object2);
2652)     }
2653)     //
2654)     for (var i = 0; i < iteration_keys.length; i += 1) {
2655)         var key = iteration_keys[i];
2656)         if (ignore_keys.some(function (k) {
2657)             return key == k;
2658)         })) {
2659)             //
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

2660)         }
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

2661)         else if (object2[key] === null) {
2662)             if (!ignore_null)
2663)                 object1[key] = null;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

2664)         }
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

2665)         else if ((typeof (object2[key]) === "object") && ((typeof (object1[key]) === "object") || (typeof (object1[key]) === "undefined"))) {
2666)             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

2667)         }
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

2668)         else {
2669)             if ((do_not_overwrite_existing_values === false) || (typeof (object1[key]) === "undefined")) {
2670)                 object1[key] = object2[key];
2671)             }
2672)         }
2673)     }
2674)     return object1;
Christian Fraß update

Christian Fraß authored 6 years ago

2675) };
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

2676) /*
2677)  * @param {object} recipie  ex: { "name" : { extract : function(o) { return o["name"]; }}}
2678)  * */
2679) var flatten_object = function (obj, recipie, drop_key) {
2680)     if (drop_key === void 0) { drop_key = (function (k) { return ["parents", "parent", "children"].indexOf(k) > -1; }); }
2681)     var ret = {};
2682)     for (var key in recipie) {
2683)         if (!drop_key(key)) {
2684)             var prefix = (recipie[key].prefix || "");
2685)             var recursive = (recipie[key].recursive || -1);
2686)             var extract = (recipie[key].extract || (function (x) { return x; }));
2687)             var _obj = extract(obj[key]);
2688)             if ((_obj !== null) && ((typeof _obj == "object") || (obj[key] instanceof Array)) && (!(recursive == 0))) {
2689)                 var tmp = {};
2690)                 var _recipie = {};
2691)                 for (var _i = 0, _a = Object.keys(_obj); _i < _a.length; _i++) {
2692)                     var k = _a[_i];
2693)                     _recipie[k] = {
2694)                         "prefix": (prefix + key + "."),
2695)                         "recursive": (recursive - 1),
2696)                         "extract": (function (x) { return x; })
2697)                     };
2698)                 }
2699)                 tmp = flatten_object(_obj, _recipie, drop_key);
2700)                 ret = object_merge_objects(ret, tmp);
2701)             }
2702)             else {
2703)                 ret[prefix + key] = _obj;
2704)             }
2705)         }
2706)     }
2707)     return ret;
2708) };
2709) /**
2710)  * use the complete path of an objects entry as key to make an one dimensional object
2711)  * @param {object} object the object which should be moade flat
2712)  * @param {string} [path] for the recursive call the current path
2713)  */
2714) /*export*/ var object_make_flat = function (object, path, filter, split_char, objects) {
2715)     if (path === void 0) { path = null; }
2716)     if (filter === void 0) { filter = ["parent", "children"]; }
2717)     if (split_char === void 0) { split_char = "."; }
2718)     if (objects === void 0) { objects = []; }
2719)     if (object.toFlat != undefined) {
2720)         return object.toFlat();
2721)     }
2722)     else {
2723)         var ret = {};
2724)         var default_visited_key = "___visited_path___";
2725)         var visited_key;
2726)         if (object != void 0) {
2727)             var iterate = function (key) {
2728)                 var newkey = key;
2729)                 if ((path != undefined) && (path !== "")) {
2730)                     newkey = path + split_char + newkey;
2731)                 }
2732)                 // do not touch objects we alrdy know
2733)                 if ((obj_ref[key] != undefined) && (!objects.some(function (e) { return (e === obj_ref); }))) {
2734)                     //if (lib_call.is_def(obj_ref[key]) && (! obj_ref[key].hasOwnProperty(visited_key)) && (key !== visited_key)) {
2735)                     if (typeof obj_ref[key] === "object") {
2736)                         ret = object_merge_objects(ret, object_make_flat(obj_ref[key], newkey, filter, split_char, objects.concat(object)));
2737)                     }
2738)                     else if (typeof obj_ref[key] === "function") {
2739)                         // o.O a function ... doing nothing might be the best choice
2740)                     }
2741)                     else {
2742)                         var value = obj_ref[key];
2743)                         ret[newkey] = value;
2744)                     }
2745)                 }
2746)             };
2747)             visited_key = default_visited_key;
2748)             //object[visited_key] = true;
2749)             var obj_ref = object;
2750)             Object.keys(object).filter(function (key) { return (filter.indexOf(key) < 0); }).forEach(iterate);
2751)             if (typeof object.getComputedValues == "function") {
2752)                 visited_key = default_visited_key + "_" + Math.random().toString();
2753)                 obj_ref = object.getComputedValues();
2754)                 obj_ref[visited_key] = true;
2755)                 Object.keys(obj_ref).filter(function (key) { return (filter.indexOf(key) < 0); }).forEach(iterate);
2756)             }
2757)         }
2758)         else {
2759)             //console.warn("something went wrong with that object: ", object, "on this path:", path);
2760)         }
2761)         return ret;
2762)     }
2763) };
2764) /**
2765)  * splits a flat oject into an array of objects if there are paths containing numbers, which indicates
2766)  * that there might be an array
2767)  * used for normalisation of imports
2768)  * @param entry
2769)  * @param number_replace_string
2770)  * @param {function} [match_function] how to test key if it causes a split
2771)  * @returns {Array}
2772)  */
2773) var object_split_flat_object = function (entry, number_replace_string, fab_function, match_function) {
2774)     if (typeof (match_function) === "undefined") {
2775)         match_function = function (key) {
2776)             return (!key.match(/^custom/)) && key.match(/\.[0-9]+\./);
2777)         };
2778)     }
2779)     if (typeof (fab_function) === "undefined") {
2780)         fab_function = function (obj, e) {
2781)             return obj;
2782)         };
2783)     }
2784)     if (typeof (number_replace_string) === "undefined") {
2785)         number_replace_string = "%d";
2786)     }
2787)     var ret = {};
2788)     var _ret = [];
2789)     var keys = Object.keys(entry);
2790)     var group_keys = keys.filter(match_function);
2791)     keys.forEach(function (key) {
2792)         var index = 0;
2793)         var nkey = key;
2794)         if (match_function(key)) {
2795)             index = Number(key.match(/[0-9]+/)[0]).valueOf();
2796)             nkey = key.replace(/\.[0-9]+\./, "." + number_replace_string + ".");
2797)         }
2798)         if (!ret[index]) {
2799)             ret[index] = {};
2800)         }
2801)         ret[index][nkey] = entry[key];
2802)     });
2803)     keys = Object.keys(ret).sort();
2804)     _ret.push(ret[0]);
2805)     for (var index = 1; index < keys.length; index++) {
2806)         _ret.push(fab_function(ret[keys[index]], entry));
2807)     }
2808)     _ret[0] = object_merge_objects(_ret[0], ret[0]);
2809)     return _ret;
2810) };
2811) // TODO: move to exporter, it's to specific
2812) // to normalize the objects convert paths of a tree-like structure to a
2813) // key-value list with complete paths as key
2814) // the info object is passed to the next function as it is
2815) // and a flat_object (key : value)
2816) /*export*/ var object_make_flat_async = function (data, callback, on_progress) {
2817)     setTimeout((function (_obj, _cb, _info) {
2818)         return (function () {
2819)             var ret = _obj.map(function (o) { return object_make_flat(o); });
2820)             _cb({ "flat_object": ret, "objects": ret, "info": _info });
2821)         });
2822)     })((typeof (data.processed.objects) === "undefined") ? data.processed.source_object : data.processed.objects, callback, data.processed.info), 0);
2823) };
2824) var object_flatten = function (object, paths, prefix) {
2825)     if (prefix === void 0) { prefix = ""; }
2826)     var ret = {};
2827)     var paths_ = paths.reduce(function (prev, current) {
2828)         if (current.split(".").some(function (x) { return (x === "%d"); })) {
2829)             var path = current.split(".%d").shift();
2830)             var len = object_path_read(object, path).length;
2831)             for (var i = 0; i < len; i++) {
2832)                 // prev.push(sprintf(current, [i]));
2833)                 prev.push(current.replace(new RegExp("%d"), i.toFixed(0)));
2834)             }
2835)         }
2836)         else {
2837)             prev.push(current);
2838)         }
2839)         return prev;
2840)     }, []);
2841)     for (var _i = 0, paths_1 = paths_; _i < paths_1.length; _i++) {
2842)         var path = paths_1[_i];
2843)         var tmp = object_path_read(object, path, true);
2844)         if ((tmp != undefined) && (tmp.toFlat != undefined)) {
2845)             var tmp_ = tmp.toFlat([path, "."].join(""));
2846)             for (var key in tmp_) {
2847)                 ret[key] = tmp_[key];
2848)             }
2849)         }
2850)         else {
2851)             ret[prefix + path] = tmp;
2852)         }
2853)     }
2854)     return ret;
2855) };
2856) /**
2857)  * parse
2858)  * @param {String} value
2859)  * @returns {Object}
2860)  */
2861) var object_parse = function (value) {
2862)     var content = JSON.parse(value);
2863)     var m = { "root": content };
2864)     (new Mapper()).mapClasses(m);
2865)     return m["root"];
2866) };
2867) /**
2868)  * stringify
2869)  *
2870)  * @description stringify object as JSON
2871)  */
2872) var object_stringify = function (object, readable) {
2873)     if (readable === void 0) { readable = false; }
2874)     return (JSON.stringify(object, function (key, value) {
2875)         if ((key == "parents") && (value !== null)) {
2876)             return null;
2877)         }
2878)         if (key == "changeActions") {
2879)             return undefined;
2880)         }
2881)         if (key == "observer") {
2882)             return undefined;
2883)         }
2884)         if (key == "isMapped") {
2885)             return undefined;
2886)         }
2887)         /*
2888)         if (value === null) {
2889)             return undefined;
2890)         }
2891)         */
2892)         return value;
2893)     }, readable ? 1 : 0));
2894) };
2895) var __extends = (this && this.__extends) || (function () {
2896)     var extendStatics = Object.setPrototypeOf ||
2897)         ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
2898)         function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
2899)     return function (d, b) {
2900)         extendStatics(d, b);
2901)         function __() { this.constructor = d; }
2902)         d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
2903)     };
2904) })();
2905) var lib_meta;
2906) (function (lib_meta) {
2907)     /**
2908)      * @author frac
Christian Fraß update

Christian Fraß authored 6 years ago

2909)      */
2910)     function type_toString(type) {
2911)         // return ("<" + type.id + ">");
2912)         return JSON.stringify(type);
2913)     }
2914)     lib_meta.type_toString = type_toString;
2915)     /**
2916)      * @author frac
2917)      */
2918)     var class_pool = {};
2919)     /**
2920)      * @author frac
2921)      */
2922)     function class_set(name, class_) {
2923)         class_pool[name] = class_;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

2924)     }
Christian Fraß update

Christian Fraß authored 6 years ago

2925)     lib_meta.class_set = class_set;
2926)     /**
2927)      * @author frac
2928)      */
2929)     function class_get(name) {
2930)         if (name in class_pool) {
2931)             return class_pool[name];
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

2932)         }
2933)         else {
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

2935)         }
2936)     }
Christian Fraß update

Christian Fraß authored 6 years ago

2937)     lib_meta.class_get = class_get;
2938)     /**
2939)      * @author frac
2940)      */
2941)     function transform_field(name, attributes) {
2942)         var type = attributes["type"];
2943)         var path = name;
2944)         var label = ((attributes["title"] != undefined) ? attributes["title"] : name);
2945)         var display = ((attributes["display"] != undefined) ? attributes["display"] : true);
2946)         return ({
2947)             "path": path,
2948)             "type": type,
2949)             "label": label,
2950)             "display": display
2951)         });
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

2952)     }
Christian Fraß update

Christian Fraß authored 6 years ago

2953)     lib_meta.transform_field = transform_field;
2954)     /**
2955)      * @author frac
2956)      */
2957)     function transform_description(label, description, groups_raw) {
2958)         if (groups_raw === void 0) { groups_raw = null; }
2959)         var fieldmap;
2960)         var fields = Object.keys(description).map(function (key) { return transform_field(key, description[key]); });
2961)         var groups = ((groups_raw == null)
2962)             ?
2963)                 null
2964)             :
2965)                 groups_raw.map(function (group_raw) {
2966)                     return {
2967)                         "label": group_raw["label"],
2968)                         "fields": group_raw["fields"].map(function (field_name) {
2969)                             var index = fields["findIndex"](function (field) { return (field.path == field_name); });
2970)                             if (index < 0) {
2971)                                 throw (new Error("field " + field_name + " not found in model-description"));
2972)                             }
2973)                             return index;
2974)                         })
2975)                     };
2976)                 }));
2977)         return {
2978)             "fields": fields,
2979)             "description": null,
2980)             "title": label,
2981)             "groups": groups
2982)         };
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

2983)     }
Christian Fraß update

Christian Fraß authored 6 years ago

2984)     lib_meta.transform_description = transform_description;
2985)     /**
2986)      * @author frac
2987)      */
2988)     function transform_description_groups(label, description_model, description_groups) {
2989)         return ({
2990)             "label": label,
2991)             "groups": description_groups.map(function (group_raw) {
2992)                 return {
2993)                     "label": group_raw["label"],
2994)                     "fields": group_raw["fields"].map(function (path) {
2995)                         var field_raw = description_model[path];
2996)                         return transform_field(path, field_raw);
2997)                     })
2998)                 };
2999)             })
3000)         });
3001)     }
3002)     lib_meta.transform_description_groups = transform_description_groups;
3003) })(lib_meta || (lib_meta = {}));
3004) /// <reference path="../../base/build/logic-decl.d.ts"/>
3005) /// <reference path="../../object/build/logic-decl.d.ts"/>
3006) var lib_meta;
3007) (function (lib_meta) {
3008)     /**
3009)      * @author fenris
3010)      */
3011)     lib_meta._logprefix = "[lib_meta] ";
3012)     /**
3013)      * @author fenris
3014)      */
3015)     lib_meta._verbosity = 1;
3016) })(lib_meta || (lib_meta = {}));
3017) var lib_meta;
3018) (function (lib_meta) {
3019)     /**
3020)      * @author fenris
3021)      */
3022)     var class_shape = (function () {
3023)         /**
3024)          * @desc [constructor]
3025)          * @author fenris
3026)          */
3027)         function class_shape(_a) {
3028)             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;
3029)             /*
3030)             if ((! soft) && (defaultvalue == null)) {
3031)                 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

3032)             }
Christian Fraß update

Christian Fraß authored 6 years ago

3033)              */
3034)             this.primitive = primitive;
3035)             this.soft = soft;
3036)             this.defaultvalue = defaultvalue;
3037)         }
3038)         /**
3039)          * @desc [accessor] [getter]
3040)          * @author fenris
3041)          */
3042)         class_shape.prototype.primitive_get = function () {
3043)             return this.primitive;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

3044)         };
Christian Fraß update

Christian Fraß authored 6 years ago

3045)         /**
3046)          * @desc [accessor] [getter]
3047)          * @author fenris
3048)          */
3049)         class_shape.prototype.soft_get = function () {
3050)             return this.soft;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

3051)         };
Christian Fraß update

Christian Fraß authored 6 years ago

3052)         /**
3053)          * @desc [accessor] [getter]
3054)          * @author fenris
3055)          */
3056)         class_shape.prototype.defaultvalue_get = function () {
3057)             return this.defaultvalue;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

3058)         };
Christian Fraß update

Christian Fraß authored 6 years ago

3059)         /**
3060)          * @desc [accessor]
3061)          * @author fenris
3062)          */
3063)         class_shape.prototype.inspect = function (value) {
3064)             var messages = [];
3065)             if ((!this.soft) && (value == null)) {
3066)                 messages.push("shape does not allow 'null' as value");
3067)             }
3068)             return messages;
3069)         };
3070)         /**
3071)          * @desc [accessor]
3072)          * @author fenris
3073)          */
3074)         class_shape.prototype.check = function (value) {
3075)             var messages = this.inspect(value);
3076)             if (lib_meta._verbosity >= 1) {
3077)                 messages.forEach(function (message) { return console.warn("" + lib_meta._logprefix + message); });
3078)             }
3079)             return (messages.length == 0);
3080)         };
3081)         return class_shape;
3082)     }());
3083)     lib_meta.class_shape = class_shape;
3084)     /**
3085)      * @author fenris
3086)      */
3087)     var class_shape_buildin = (function (_super) {
3088)         __extends(class_shape_buildin, _super);
3089)         /**
3090)          * @author fenris
3091)          */
3092)         function class_shape_buildin(_a) {
3093)             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;
3094)             var _this = _super.call(this, {
3095)                 "primitive": primitive,
3096)                 "soft": soft,
3097)                 "defaultvalue": defaultvalue
3098)             }) || this;
3099)             _this.typename = typename;
3100)             return _this;
3101)         }
3102)         /**
3103)          * @override
3104)          * @author fenris
3105)          */
3106)         class_shape_buildin.prototype.inspect = function (value) {
3107)             var messages = _super.prototype.inspect.call(this, value);
3108)             if ((!this.soft) && (typeof (value) != this.typename)) {
3109)                 messages.push("typename is not '" + this.typename + "'");
3110)             }
3111)             return messages;
3112)         };
3113)         /**
3114)          * @desc [implementation]
3115)          * @author fenris
3116)          */
3117)         class_shape_buildin.prototype._show = function () {
3118)             var str = "";
3119)             str = this.typename;
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

3120)             if (this.soft) {
Christian Fraß update

Christian Fraß authored 6 years ago

3121)                 str = str + "_or_null";
3122)             }
3123)             return str;
3124)         };
3125)         return class_shape_buildin;
3126)     }(class_shape));
3127)     lib_meta.class_shape_buildin = class_shape_buildin;
3128)     /**
3129)      * @author fenris
3130)      */
3131)     var _pool = {};
3132)     /**
3133)      * @author fenris
3134)      */
3135)     function register(id, factory) {
3136)         if (id in _pool) {
3137)             var message = "shape '" + id + "' already registered";
3138)             throw (new Error(message));
3139)         }
3140)         else {
3141)             _pool[id] = factory;
3142)         }
3143)     }
3144)     lib_meta.register = register;
3145)     /**
3146)      * @author fenris
3147)      */
3148)     function construct(id, parameters) {
3149)         if (parameters === void 0) { parameters = {}; }
3150)         if (!(id in _pool)) {
3151)             var message = "no shape found with id " + id;
3152)             throw (new Error(message));
3153)         }
3154)         else {
3155)             return _pool[id](parameters);
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

3156)         }
3157)     }
Christian Fraß update

Christian Fraß authored 6 years ago

3158)     lib_meta.construct = construct;
3159)     /**
3160)      * @author fenris
3161)      */
3162)     function from_raw(shape_raw) {
3163)         return construct(shape_raw.id, shape_raw.parameters);
3164)     }
3165)     lib_meta.from_raw = from_raw;
3166)     /**
3167)      * @author fenris
3168)      */
3169)     function define(id, shape_raw) {
3170)         register(id, function (parameters) { return from_raw(shape_raw); });
3171)     }
3172)     lib_meta.define = define;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

3173)     /**
3174)      * @author fenris
3175)      */
Christian Fraß update

Christian Fraß authored 6 years ago

3176)     function retrieve(id) {
3177)         return construct(id, {});
3178)     }
3179)     lib_meta.retrieve = retrieve;
3180) })(lib_meta || (lib_meta = {}));
3181) var lib_meta;
3182) (function (lib_meta) {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

3183)     /**
3184)      * @author fenris
3185)      */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

3186)     var class_shape_any = (function (_super) {
3187)         __extends(class_shape_any, _super);
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

3188)         /**
3189)          * @author fenris
3190)          */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

3191)         function class_shape_any(_a) {
3192)             var _b = _a["soft"], soft = _b === void 0 ? false : _b, _c = _a["defaultvalue"], defaultvalue = _c === void 0 ? 0 : _c;
Christian Fraß update

Christian Fraß authored 6 years ago

3193)             return _super.call(this, {
3194)                 "soft": soft,
3195)                 "defaultvalue": defaultvalue
3196)             }) || this;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

3197)         }
3198)         /**
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

3200)          * @author fenris
3201)          */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

3202)         class_shape_any.prototype.inspect = function (value) {
3203)             var messages = _super.prototype.inspect.call(this, value);
3204)             return messages;
3205)         };
3206)         /**
3207)          * @override
3208)          * @author fenris
3209)          */
3210)         class_shape_any.prototype.to_raw = function () {
Christian Fraß update

Christian Fraß authored 6 years ago

3211)             return {
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

3212)                 "id": "any",
Christian Fraß update

Christian Fraß authored 6 years ago

3213)                 "parameters": {
3214)                     "soft": this.soft
3215)                 }
3216)             };
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

3217)         };
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

3218)         /**
3219)          * @desc [implementation]
3220)          * @author fenris
3221)          */
3222)         class_shape_any.prototype._show = function () {
3223)             var str = "any";
3224)             return str;
3225)         };
3226)         return class_shape_any;
3227)     }(lib_meta.class_shape));
3228)     lib_meta.class_shape_any = class_shape_any;
3229)     lib_meta.register("any", function (parameters) {
3230)         return (new class_shape_any({
3231)             "soft": parameters["soft"]
3232)         }));
3233)     });
3234) })(lib_meta || (lib_meta = {}));
3235) var lib_meta;
3236) (function (lib_meta) {
3237)     /**
3238)      * @author fenris
3239)      */
3240)     var class_shape_boolean = (function (_super) {
3241)         __extends(class_shape_boolean, _super);
3242)         /**
3243)          * @author fenris
3244)          */
3245)         function class_shape_boolean(_a) {
3246)             var _b = _a["soft"], soft = _b === void 0 ? false : _b, _c = _a["defaultvalue"], defaultvalue = _c === void 0 ? false : _c;
3247)             return _super.call(this, {
3248)                 "typename": "boolean",
3249)                 "primitive": true,
3250)                 "soft": soft,
3251)                 "defaultvalue": defaultvalue
3252)             }) || this;
3253)         }
3254)         /**
3255)          * @override
3256)          * @author fenris
3257)          */
3258)         class_shape_boolean.prototype.to_raw = function () {
3259)             return {
3260)                 "id": "boolean",
3261)                 "parameters": {
3262)                     "soft": this.soft
3263)                 }
3264)             };
3265)         };
3266)         return class_shape_boolean;
3267)     }(lib_meta.class_shape_buildin));
3268)     lib_meta.class_shape_boolean = class_shape_boolean;
3269)     lib_meta.register("boolean", function (parameters) {
3270)         return (new class_shape_boolean({
3271)             "soft": parameters["soft"]
3272)         }));
3273)     });
Christian Fraß update

Christian Fraß authored 6 years ago

3274)     lib_meta.register("bool", function (parameters) { return lib_meta.construct("boolean", parameters); });
3275) })(lib_meta || (lib_meta = {}));
3276) var lib_meta;
3277) (function (lib_meta) {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

3278)     /**
3279)      * @author fenris
3280)      */
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

3283)         /**
3284)          * @author fenris
3285)          */
Christian Fraß update

Christian Fraß authored 6 years ago

3286)         function class_shape_integer(_a) {
3287)             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;
3288)             var _this = _super.call(this, {
3289)                 "typename": "number",
3290)                 "primitive": true,
3291)                 "soft": soft,
3292)                 "defaultvalue": defaultvalue
3293)             }) || this;
3294)             _this.min = min;
3295)             _this.max = max;
3296)             return _this;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

3297)         }
3298)         /**
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

3300)          * @author fenris
3301)          */
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

3304)         };
3305)         /**
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

3307)          * @author fenris
3308)          */
Christian Fraß update

Christian Fraß authored 6 years ago

3309)         class_shape_integer.prototype.max_get = function () {
3310)             return this.max;
3311)         };
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

3312)         /**
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

3314)          * @author fenris
3315)          */
Christian Fraß update

Christian Fraß authored 6 years ago

3316)         class_shape_integer.prototype.inspect = function (value) {
3317)             var messages = _super.prototype.inspect.call(this, value);
3318)             if (value != null) {
3319)                 if ((this.min != null) && (value < this.min)) {
3320)                     messages.push("value is below minimum of " + this.min.toString());
3321)                 }
3322)                 if ((this.max != null) && (value > this.max)) {
3323)                     messages.push("value is over maximum of " + this.max.toString());
3324)                 }
3325)             }
3326)             return messages;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

3327)         };
Christian Fraß update

Christian Fraß authored 6 years ago

3328)         /**
3329)          * @override
3330)          * @author fenris
3331)          */
3332)         class_shape_integer.prototype.to_raw = function () {
3333)             return {
3334)                 "id": "integer",
3335)                 "parameters": {
3336)                     "soft": this.soft,
3337)                     "min": this.min,
3338)                     "max": this.max
3339)                 }
3340)             };
3341)         };
3342)         return class_shape_integer;
3343)     }(lib_meta.class_shape_buildin));
3344)     lib_meta.class_shape_integer = class_shape_integer;
3345)     lib_meta.register("integer", function (parameters) {
3346)         return (new class_shape_integer({
3347)             "min": parameters["min"],
3348)             "max": parameters["max"],
3349)             "soft": parameters["soft"]
3350)         }));
3351)     });
3352)     lib_meta.register("int", function (parameters) { return lib_meta.construct("integer", parameters); });
3353) })(lib_meta || (lib_meta = {}));
3354) var lib_meta;
3355) (function (lib_meta) {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

3356)     /**
3357)      * @author fenris
3358)      */
Christian Fraß update

Christian Fraß authored 6 years ago

3359)     var class_shape_float = (function (_super) {
3360)         __extends(class_shape_float, _super);
3361)         /**
3362)          * @author fenris
3363)          */
3364)         function class_shape_float(_a) {
3365)             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;
3366)             var _this = _super.call(this, {
3367)                 "typename": "number",
3368)                 "primitive": true,
3369)                 "soft": soft,
3370)                 "defaultvalue": defaultvalue
3371)             }) || this;
3372)             _this.min = min;
3373)             _this.max = max;
3374)             return _this;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

3375)         }
Christian Fraß update

Christian Fraß authored 6 years ago

3376)         /**
3377)          * @desc [accessor] [getter]
3378)          * @author fenris
3379)          */
3380)         class_shape_float.prototype.min_get = function () {
3381)             return this.min;
3382)         };
3383)         /**
3384)          * @desc [accessor] [getter]
3385)          * @author fenris
3386)          */
3387)         class_shape_float.prototype.max_get = function () {
3388)             return this.max;
3389)         };
3390)         /**
3391)          * @override
3392)          * @author fenris
3393)          */
3394)         class_shape_float.prototype.inspect = function (value) {
3395)             var messages = _super.prototype.inspect.call(this, value);
3396)             if (value != null) {
3397)                 if ((this.min != null) && (value < this.min)) {
3398)                     messages.push("value is below minimum of " + this.min.toString());
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

3399)                 }
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

3402)                 }
3403)             }
Christian Fraß update

Christian Fraß authored 6 years ago

3404)             return messages;
3405)         };
3406)         /**
3407)          * @override
3408)          * @author fenris
3409)          */
3410)         class_shape_float.prototype.to_raw = function () {
3411)             return {
3412)                 "id": "float",
3413)                 "parameters": {
3414)                     "soft": this.soft,
3415)                     "min": this.min,
3416)                     "max": this.max
3417)                 }
3418)             };
3419)         };
3420)         return class_shape_float;
3421)     }(lib_meta.class_shape_buildin));
3422)     lib_meta.class_shape_float = class_shape_float;
3423)     lib_meta.register("float", function (parameters) {
3424)         return (new class_shape_float({
3425)             "min": parameters["min"],
3426)             "max": parameters["max"],
3427)             "soft": parameters["soft"]
3428)         }));
3429)     });
3430) })(lib_meta || (lib_meta = {}));
3431) var lib_meta;
3432) (function (lib_meta) {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

3433)     /**
3434)      * @author fenris
3435)      */
Christian Fraß update

Christian Fraß authored 6 years ago

3436)     var class_shape_string = (function (_super) {
3437)         __extends(class_shape_string, _super);
3438)         /**
3439)          * @author fenris
3440)          */
3441)         function class_shape_string(_a) {
3442)             var _b = _a["soft"], soft = _b === void 0 ? false : _b, _c = _a["defaultvalue"], defaultvalue = _c === void 0 ? "" : _c;
3443)             return _super.call(this, {
3444)                 "typename": "string",
3445)                 "primitive": true,
3446)                 "soft": soft,
3447)                 "defaultvalue": defaultvalue
3448)             }) || this;
3449)         }
3450)         /**
3451)          * @override
3452)          * @author fenris
3453)          */
3454)         class_shape_string.prototype.to_raw = function () {
3455)             return {
3456)                 "id": "string",
3457)                 "parameters": {
3458)                     "soft": this.soft
3459)                 }
3460)             };
3461)         };
3462)         return class_shape_string;
3463)     }(lib_meta.class_shape_buildin));
3464)     lib_meta.class_shape_string = class_shape_string;
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

3465)     /**
3466)      * @author fenris
3467)      */
Christian Fraß update

Christian Fraß authored 6 years ago

3468)     lib_meta.register("string", function (parameters) {
3469)         return (new class_shape_string({
3470)             "soft": parameters["soft"]
3471)         }));
3472)     });
3473)     lib_meta.register("str", function (parameters) { return lib_meta.construct("string", parameters); });
3474) })(lib_meta || (lib_meta = {}));
3475) var lib_meta;
3476) (function (lib_meta) {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

3477)     /**
3478)      * @author fenris
3479)      */
Christian Fraß update

Christian Fraß authored 6 years ago

3480)     var class_shape_email = (function (_super) {
3481)         __extends(class_shape_email, _super);
3482)         /**
3483)          * @author fenris
3484)          */
3485)         function class_shape_email(_a) {
3486)             var _b = _a["soft"], soft = _b === void 0 ? false : _b, _c = _a["defaultvalue"], defaultvalue = _c === void 0 ? "" : _c;
3487)             return _super.call(this, {
3488)                 "primitive": true,
3489)                 "soft": soft,
3490)                 "defaultvalue": defaultvalue
3491)             }) || this;
3492)         }
3493)         /**
3494)          * @override
3495)          * @author fenris
3496)          */
3497)         class_shape_email.prototype.to_raw = function () {
3498)             return {
3499)                 "id": "email",
3500)                 "parameters": {
3501)                     "soft": this.soft
3502)                 }
3503)             };
3504)         };
3505)         /**
3506)          * @desc [implementation]
3507)          * @author fenris
3508)          */
3509)         class_shape_email.prototype._show = function () {
3510)             var str = "email";
3511)             return str;
3512)         };
3513)         return class_shape_email;
3514)     }(lib_meta.class_shape));
3515)     lib_meta.class_shape_email = class_shape_email;
3516)     lib_meta.register("email", function (parameters) {
3517)         return (new class_shape_email({
3518)             "soft": parameters["soft"]
3519)         }));
3520)     });
3521) })(lib_meta || (lib_meta = {}));
3522) var lib_meta;
3523) (function (lib_meta) {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

3524)     /**
3525)      * @author fenris
3526)      */
Christian Fraß update

Christian Fraß authored 6 years ago

3527)     var class_shape_array = (function (_super) {
3528)         __extends(class_shape_array, _super);
3529)         /**
3530)          * @author fenris
3531)          */
3532)         function class_shape_array(_a) {
3533)             var shape_element = _a["shape_element"], _b = _a["soft"], soft = _b === void 0 ? false : _b, _c = _a["defaultvalue"], defaultvalue = _c === void 0 ? [] : _c;
3534)             var _this = _super.call(this, {
3535)                 "primitive": false,
3536)                 "soft": soft,
3537)                 "defaultvalue": defaultvalue
3538)             }) || this;
3539)             _this.shape_element = shape_element;
3540)             return _this;
3541)         }
3542)         /**
3543)          * @desc [accessor] [getter]
3544)          * @author fenris
3545)          */
3546)         class_shape_array.prototype.shape_element_get = function () {
3547)             return this.shape_element;
3548)         };
3549)         /**
3550)          * @override
3551)          * @author fenris
3552)          */
3553)         class_shape_array.prototype.inspect = function (value) {
3554)             var _this = this;
3555)             var messages = _super.prototype.inspect.call(this, value);
3556)             if (value != null) {
3557)                 if (!((typeof (value) == "object") && (value instanceof Array))) {
3558)                     messages.push("value is not an array");
3559)                 }
3560)                 else {
3561)                     var array = (value);
3562)                     array.forEach(function (element, index) {
3563)                         messages = messages.concat(_this.shape_element.inspect(element).map(function (message) { return "array element #" + index.toString() + ": " + message; }));
3564)                     });
3565)                 }
3566)             }
3567)             return messages;
3568)         };
3569)         /**
3570)          * @override
3571)          * @author fenris
3572)          */
3573)         class_shape_array.prototype.to_raw = function () {
3574)             return {
3575)                 "id": "array",
3576)                 "parameters": {
3577)                     "shape_element": this.shape_element.to_raw(),
3578)                     "soft": this.soft
3579)                 }
3580)             };
3581)         };
3582)         /**
3583)          * @desc [implementation]
3584)          * @author fenris
3585)          */
3586)         class_shape_array.prototype._show = function () {
3587)             var str = "array";
3588)             str += "<" + instance_show(this.shape_element) + ">";
3589)             return str;
3590)         };
3591)         return class_shape_array;
3592)     }(lib_meta.class_shape));
3593)     lib_meta.class_shape_array = class_shape_array;
3594)     lib_meta.register("array", function (parameters) {
3595)         var shape_element_raw = lib_object.fetch(parameters, "shape_element", null, 2);
3596)         var shape_element = lib_meta.from_raw(shape_element_raw);
3597)         return (new class_shape_array({
3598)             "shape_element": shape_element,
3599)             "soft": parameters["soft"]
3600)         }));
3601)     });
3602)     lib_meta.register("arr", function (parameters) { return lib_meta.construct("array", parameters); });
3603) })(lib_meta || (lib_meta = {}));
3604) var lib_meta;
3605) (function (lib_meta) {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

3606)     /**
3607)      * @author fenris
3608)      */
Christian Fraß update

Christian Fraß authored 6 years ago

3609)     var class_shape_object = (function (_super) {
3610)         __extends(class_shape_object, _super);
3611)         /**
3612)          * @author fenris
3613)          */
3614)         function class_shape_object(_a) {
3615)             var fields = _a["fields"], _b = _a["soft"], soft = _b === void 0 ? true : _b, _c = _a["defaultvalue"], defaultvalue = _c === void 0 ? null : _c;
3616)             var _this = this;
3617)             if (defaultvalue == null) {
3618)                 defaultvalue = {};
3619)                 fields.forEach(function (field) {
3620)                     defaultvalue[field.name] = field.shape.defaultvalue_get();
3621)                 });
3622)             }
3623)             _this = _super.call(this, {
3624)                 "typename": "object",
3625)                 "primitive": false,
3626)                 "soft": soft,
3627)                 "defaultvalue": defaultvalue
3628)             }) || this;
3629)             _this.fields = fields;
3630)             return _this;
3631)         }
3632)         /**
3633)          * @desc [accessor] [getter]
3634)          * @author fenris
3635)          */
3636)         class_shape_object.prototype.fields_get = function () {
3637)             return this.fields;
3638)         };
3639)         /**
3640)          * @override
3641)          * @author fenris
3642)          * @todo check for superfluous fields?
3643)          */
3644)         class_shape_object.prototype.inspect = function (value) {
3645)             var messages = _super.prototype.inspect.call(this, value);
3646)             if (value != null) {
3647)                 this.fields.forEach(function (field, index) {
3648)                     var value_ = value[field.name];
3649)                     messages = messages.concat(field.shape.inspect(value_).map(function (message) { return "object field '" + field.name + "': " + message; }));
3650)                 });
3651)             }
3652)             return messages;
3653)         };
3654)         /**
3655)          * @override
3656)          * @author fenris
3657)          */
3658)         class_shape_object.prototype.to_raw = function () {
3659)             return {
3660)                 "id": "object",
3661)                 "parameters": {
3662)                     "soft": this.soft,
3663)                     "fields": this.fields.map(function (field) {
3664)                         return {
3665)                             "name": field.name,
3666)                             "shape": field.shape.to_raw(),
3667)                             "label": field.label
3668)                         };
3669)                     })
3670)                 }
3671)             };
3672)         };
3673)         /**
3674)          * @desc [implementation]
3675)          * @author fenris
3676)          */
3677)         class_shape_object.prototype._show = function () {
3678)             var str = _super.prototype._show.call(this);
3679)             var str_ = this.fields.map(function (field) { return field.name + ":" + instance_show(field.shape); }).join(",");
3680)             str = str + "<" + str_ + ">";
3681)             return str;
3682)         };
3683)         return class_shape_object;
3684)     }(lib_meta.class_shape_buildin));
3685)     lib_meta.class_shape_object = class_shape_object;
3686)     lib_meta.register("object", function (parameters) {
3687)         var fields_ = lib_object.fetch(parameters, "fields", [], 1);
3688)         return (new class_shape_object({
3689)             "fields": fields_.map(function (field_) {
3690)                 var name = lib_object.fetch(field_, "name", null, 2);
3691)                 var shape_raw = lib_object.fetch(field_, "shape", null, 2);
3692)                 var shape = lib_meta.construct(shape_raw.id, shape_raw.parameters);
3693)                 var label = lib_object.fetch(field_, "label", null, 1);
3694)                 return {
3695)                     "name": name,
3696)                     "shape": shape,
3697)                     "label": label
3698)                 };
3699)             }),
3700)             "soft": parameters["soft"]
3701)         }));
3702)     });
3703)     lib_meta.register("obj", function (parameters) { return lib_meta.construct("object", parameters); });
3704) })(lib_meta || (lib_meta = {}));
3705) var lib_meta;
3706) (function (lib_meta) {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

3707)     /**
3708)      * @author fenris
3709)      */
Christian Fraß update

Christian Fraß authored 6 years ago

3710)     var class_shape_date = (function (_super) {
3711)         __extends(class_shape_date, _super);
3712)         /**
3713)          * @author fenris
3714)          */
3715)         function class_shape_date(_a) {
3716)             var _b = _a["soft"], soft = _b === void 0 ? false : _b, _c = _a["defaultvalue"], defaultvalue = _c === void 0 ? new Date(Date.now()) : _c;
3717)             return _super.call(this, {
3718)                 "primitive": true,
3719)                 "soft": soft,
3720)                 "defaultvalue": defaultvalue
3721)             }) || this;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

3722)         }
Christian Fraß update

Christian Fraß authored 6 years ago

3723)         /**
3724)          * @override
3725)          * @author fenris
3726)          */
3727)         class_shape_date.prototype.inspect = function (value) {
3728)             var messages = _super.prototype.inspect.call(this, value);
3729)             if (value != null) {
3730)                 if (!((typeof (value) == "object") && (value instanceof Date))) {
3731)                     messages.push("value is not a date");
3732)                 }
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

3733)             }
Christian Fraß update

Christian Fraß authored 6 years ago

3734)             return messages;
3735)         };
3736)         /**
3737)          * @override
3738)          * @author fenris
3739)          */
3740)         class_shape_date.prototype.to_raw = function () {
3741)             return {
3742)                 "id": "date",
3743)                 "parameters": {
3744)                     "soft": this.soft
3745)                 }
3746)             };
3747)         };
3748)         /**
3749)          * @desc [implementation]
3750)          * @author fenris
3751)          */
3752)         class_shape_date.prototype._show = function () {
3753)             var str = "date";
3754)             return str;
3755)         };
3756)         return class_shape_date;
3757)     }(lib_meta.class_shape));
3758)     lib_meta.class_shape_date = class_shape_date;
3759)     lib_meta.register("date", function (parameters) {
3760)         return (new class_shape_date({
3761)             "soft": parameters["soft"]
3762)         }));
3763)     });
3764) })(lib_meta || (lib_meta = {}));
3765) var lib_meta;
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

3766) (function (lib_meta) {
3767)     /**
3768)      * @desc represented as milliseconds of day
3769)      * @author fenris
3770)      */
3771)     var class_shape_time = (function (_super) {
3772)         __extends(class_shape_time, _super);
3773)         /**
3774)          * @author fenris
3775)          */
3776)         function class_shape_time(_a) {
3777)             var _b = _a["soft"], soft = _b === void 0 ? false : _b, _c = _a["defaultvalue"], defaultvalue = _c === void 0 ? class_shape_time.from_timestamp(Date.now()) : _c;
3778)             return _super.call(this, {
3779)                 "primitive": true,
3780)                 "soft": soft,
3781)                 "defaultvalue": defaultvalue
3782)             }) || this;
3783)         }
3784)         /**
3785)          * @override
3786)          * @author fenris
3787)          */
3788)         class_shape_time.prototype.inspect = function (value) {
3789)             var messages = _super.prototype.inspect.call(this, value);
3790)             if (value != null) {
3791)                 if (!(typeof (value) == "object")) {
3792)                     messages.push("value is not a time");
3793)                 }
3794)                 else {
3795)                     if (!("hours" in value)) {
3796)                         messages.push("hour is missing");
3797)                     }
3798)                     if (!("minutes" in value)) {
3799)                         messages.push("minutes is missing");
3800)                     }
3801)                     if (!("seconds" in value)) {
3802)                         messages.push("seconds is missing");
3803)                     }
3804)                 }
3805)             }
3806)             return messages;
3807)         };
3808)         /**
3809)          * @override
3810)          * @author fenris
3811)          */
3812)         class_shape_time.prototype.to_raw = function () {
3813)             return {
3814)                 "id": "time",
3815)                 "parameters": {
3816)                     "soft": this.soft
3817)                 }
3818)             };
3819)         };
3820)         /**
3821)          * @desc [implementation]
3822)          * @author fenris
3823)          */
3824)         class_shape_time.prototype._show = function () {
3825)             var str = "time";
3826)             return str;
3827)         };
3828)         /**
3829)          * @author fenris
3830)          */
3831)         class_shape_time.from_date = function (date) {
3832)             var hours = date.getHours();
3833)             var minutes = date.getMinutes();
3834)             var seconds = date.getSeconds();
3835)             return { "hours": hours, "minutes": minutes, "seconds": seconds };
3836)         };
3837)         /**
3838)          * @author fenris
3839)          */
3840)         class_shape_time.from_timestamp = function (timestamp) {
3841)             var date = new Date(timestamp);
3842)             return this.from_date(date);
3843)         };
3844)         /**
3845)          * @author fenris
3846)          */
3847)         class_shape_time.now = function () {
3848)             return this.from_timestamp(Date.now());
3849)         };
3850)         return class_shape_time;
3851)     }(lib_meta.class_shape));
3852)     lib_meta.class_shape_time = class_shape_time;
3853)     /**
3854)      * @author fenris
3855)      */
3856)     lib_meta.register("time", function (parameters) {
3857)         return (new class_shape_time({
3858)             "soft": parameters["soft"]
3859)         }));
3860)     });
3861) })(lib_meta || (lib_meta = {}));
3862) var lib_meta;
Christian Fraß update

Christian Fraß authored 6 years ago

3863) (function (lib_meta) {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

3864)     /**
3865)      * @author fenris
3866)      */
Christian Fraß update

Christian Fraß authored 6 years ago

3867)     var class_shape_enumeration = (function (_super) {
3868)         __extends(class_shape_enumeration, _super);
3869)         /**
3870)          * @author fenris
3871)          */
3872)         function class_shape_enumeration(_a) {
3873)             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;
3874)             var _this = this;
3875)             if (defaultvalue === undefined) {
3876)                 if (soft) {
3877)                     defaultvalue = null;
3878)                 }
3879)                 else {
3880)                     if (options.length == 0) {
3881)                         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

3882)                     }
3883)                     else {
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

3885)                     }
3886)                 }
Christian Fraß update

Christian Fraß authored 6 years ago

3887)             }
3888)             _this = _super.call(this, {
3889)                 "primitive": true,
3890)                 "soft": soft,
3891)                 "defaultvalue": defaultvalue
3892)             }) || this;
3893)             _this.shape_option = shape_option;
3894)             _this.options = options;
3895)             return _this;
3896)         }
3897)         /**
3898)          * @desc [accessor] [getter]
3899)          * @author fenris
3900)          */
3901)         class_shape_enumeration.prototype.shape_option_get = function () {
3902)             return this.shape_option;
3903)         };
3904)         /**
3905)          * @desc [accessor] [getter]
3906)          * @author fenris
3907)          */
3908)         class_shape_enumeration.prototype.options_get = function () {
3909)             return this.options;
3910)         };
3911)         /**
3912)          * @override
3913)          * @author fenris
3914)          */
3915)         class_shape_enumeration.prototype.inspect = function (value) {
3916)             var messages = _super.prototype.inspect.call(this, value);
3917)             if (value != null) {
3918)                 if (!this.shape_option.check(value)) {
3919)                     messages.push("value has not the specified option shape");
3920)                 }
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

3921)                 else {
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

3926)                 }
3927)             }
Christian Fraß update

Christian Fraß authored 6 years ago

3928)             return messages;
3929)         };
3930)         /**
3931)          * @override
3932)          * @author fenris
3933)          */
3934)         class_shape_enumeration.prototype.to_raw = function () {
3935)             return {
3936)                 "id": "enumeration",
3937)                 "parameters": {
3938)                     "shape_option": this.shape_option.to_raw(),
3939)                     "options": this.options.map(function (option) {
3940)                         return {
3941)                             "value": option.value,
3942)                             "label": option.label
3943)                         };
3944)                     }),
3945)                     "soft": this.soft
3946)                 }
3947)             };
3948)         };
3949)         /**
3950)          * @desc [implementation]
3951)          * @author fenris
3952)          */
3953)         class_shape_enumeration.prototype._show = function () {
3954)             var str = "enumeration";
3955)             {
3956)                 str = str + "<" + instance_show(this.shape_option) + ">";
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

3957)             }
Christian Fraß update

Christian Fraß authored 6 years ago

3958)             {
3959)                 var str_ = this.options.map(function (option) { return instance_show(option.value); }).join(",");
3960)                 str = str + "[" + str_ + "]";
3961)             }
3962)             return str;
3963)         };
3964)         return class_shape_enumeration;
3965)     }(lib_meta.class_shape));
3966)     lib_meta.class_shape_enumeration = class_shape_enumeration;
3967)     lib_meta.register("enumeration", function (parameters) {
3968)         var shape_option_raw = lib_object.fetch(parameters, "shape_option", null, 2);
3969)         var shape_option = lib_meta.from_raw(shape_option_raw);
3970)         var options = lib_object.fetch(parameters, "options", [], 2);
3971)         return (new class_shape_enumeration({
3972)             "shape_option": shape_option,
3973)             "options": options,
3974)             "soft": parameters["soft"]
3975)         }));
3976)     });
3977) })(lib_meta || (lib_meta = {}));
3978) var lib_meta;
3979) (function (lib_meta) {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

3980)     /**
3981)      * @author fenris
3982)      */
Christian Fraß update

Christian Fraß authored 6 years ago

3983)     var class_shape_map = (function (_super) {
3984)         __extends(class_shape_map, _super);
3985)         /**
3986)          * @author fenris
3987)          */
3988)         function class_shape_map(_a) {
3989)             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;
3990)             var _this = _super.call(this, {
3991)                 "primitive": true,
3992)                 "soft": soft,
3993)                 "defaultvalue": defaultvalue
3994)             }) || this;
3995)             _this.shape_key = shape_key;
3996)             _this.shape_value = shape_value;
3997)             return _this;
3998)         }
3999)         /**
4000)          * @desc [accessor] [getter]
4001)          * @author fenris
4002)          */
4003)         class_shape_map.prototype.shape_key_get = function () {
4004)             return this.shape_key;
4005)         };
4006)         /**
4007)          * @desc [accessor] [getter]
4008)          * @author fenris
4009)          */
4010)         class_shape_map.prototype.shape_value_get = function () {
4011)             return this.shape_value;
4012)         };
4013)         /**
4014)          * @override
4015)          * @author fenris
4016)          */
4017)         class_shape_map.prototype.inspect = function (value) {
4018)             var _this = this;
4019)             var messages = _super.prototype.inspect.call(this, value);
4020)             if (value != null) {
4021)                 if (typeof (value) != "object") {
4022)                     messages.push("value is not an object");
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4023)                 }
4024)                 else {
Christian Fraß update

Christian Fraß authored 6 years ago

4025)                     Object.keys(value).forEach(function (key, index) {
4026)                         var value_ = value[key];
4027)                         messages = messages.concat(_this.shape_key.inspect(key).map(function (message) { return "map entry #" + index.toString() + " key: " + message; }));
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

4028)                         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

4029)                     });
4030)                 }
4031)             }
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

4033)         };
Christian Fraß update

Christian Fraß authored 6 years ago

4034)         /**
4035)          * @override
4036)          * @author fenris
4037)          */
4038)         class_shape_map.prototype.to_raw = function () {
4039)             return {
4040)                 "id": "map",
4041)                 "parameters": {
4042)                     "shape_key": this.shape_key.to_raw(),
4043)                     "shape_value": this.shape_value.to_raw(),
4044)                     "soft": this.soft
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4045)                 }
Christian Fraß update

Christian Fraß authored 6 years ago

4046)             };
4047)         };
4048)         /**
4049)          * @desc [implementation]
4050)          * @author fenris
4051)          */
4052)         class_shape_map.prototype._show = function () {
4053)             var str = "map";
4054)             str += "<" + instance_show(this.shape_key) + "," + instance_show(this.shape_value) + ">";
4055)             return str;
4056)         };
4057)         return class_shape_map;
4058)     }(lib_meta.class_shape));
4059)     lib_meta.class_shape_map = class_shape_map;
4060)     lib_meta.register("map", function (parameters) {
4061)         var shape_key_raw = lib_object.fetch(parameters, "shape_key", null, 2);
4062)         var shape_key = lib_meta.construct(shape_key_raw.id, shape_key_raw.parameters);
4063)         var shape_value_raw = lib_object.fetch(parameters, "shape_value", null, 2);
4064)         var shape_value = lib_meta.from_raw(shape_value_raw);
4065)         return (new class_shape_map({
4066)             "shape_key": shape_key,
4067)             "shape_value": shape_value,
4068)             "soft": parameters["soft"]
4069)         }));
4070)     });
4071) })(lib_meta || (lib_meta = {}));
4072) var lib_meta;
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

4073) (function (lib_meta) {
4074)     /**
4075)      * @author fenris
4076)      */
4077)     var class_shape_function = (function (_super) {
4078)         __extends(class_shape_function, _super);
4079)         /**
4080)          * @author fenris
4081)          */
4082)         function class_shape_function(_a) {
4083)             var shape_input = _a["shape_input"], shape_output = _a["shape_output"], _b = _a["soft"], soft = _b === void 0 ? false : _b, _c = _a["defaultvalue"], defaultvalue = _c === void 0 ? {} : _c;
4084)             var _this = _super.call(this, {
4085)                 "primitive": true,
4086)                 "soft": soft,
4087)                 "defaultvalue": defaultvalue
4088)             }) || this;
4089)             _this.shape_input = shape_input;
4090)             _this.shape_output = shape_output;
4091)             return _this;
4092)         }
4093)         /**
4094)          * @desc [accessor] [getter]
4095)          * @author fenris
4096)          */
4097)         class_shape_function.prototype.shape_input_get = function () {
4098)             return this.shape_input;
4099)         };
4100)         /**
4101)          * @desc [accessor] [getter]
4102)          * @author fenris
4103)          */
4104)         class_shape_function.prototype.shape_output_get = function () {
4105)             return this.shape_output;
4106)         };
4107)         /**
4108)          * @override
4109)          * @author fenris
4110)          */
4111)         class_shape_function.prototype.inspect = function (value) {
4112)             var messages = _super.prototype.inspect.call(this, value);
4113)             if (value != null) {
4114)                 if (typeof (value) != "function") {
4115)                     messages.push("value is not an object");
4116)                 }
4117)                 else {
4118)                 }
4119)             }
4120)             return messages;
4121)         };
4122)         /**
4123)          * @override
4124)          * @author fenris
4125)          */
4126)         class_shape_function.prototype.to_raw = function () {
4127)             return {
4128)                 "id": "function",
4129)                 "parameters": {
4130)                     "shape_input": this.shape_input.to_raw(),
4131)                     "shape_output": this.shape_output.to_raw(),
4132)                     "soft": this.soft
4133)                 }
4134)             };
4135)         };
4136)         /**
4137)          * @desc [implementation]
4138)          * @author fenris
4139)          */
4140)         class_shape_function.prototype._show = function () {
4141)             var str = "function";
4142)             str += "<" + instance_show(this.shape_input) + "," + instance_show(this.shape_output) + ">";
4143)             return str;
4144)         };
4145)         return class_shape_function;
4146)     }(lib_meta.class_shape));
4147)     lib_meta.class_shape_function = class_shape_function;
4148)     lib_meta.register("function", function (parameters) {
4149)         var shape_input_raw = lib_object.fetch(parameters, "shape_input", null, 2);
4150)         var shape_input = lib_meta.construct(shape_input_raw.id, shape_input_raw.parameters);
4151)         var shape_output_raw = lib_object.fetch(parameters, "shape_output", null, 2);
4152)         var shape_output = lib_meta.from_raw(shape_output_raw);
4153)         return (new class_shape_function({
4154)             "shape_input": shape_input,
4155)             "shape_output": shape_output,
4156)             "soft": parameters["soft"]
4157)         }));
4158)     });
4159) })(lib_meta || (lib_meta = {}));
4160) var lib_meta;
Christian Fraß update

Christian Fraß authored 6 years ago

4161) (function (lib_meta) {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4162)     /**
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

4165)      */
Christian Fraß update

Christian Fraß authored 6 years ago

4166)     function adjust_labels(shape, transformator) {
4167)         if (false) {
4168)         }
4169)         else if (shape instanceof lib_meta.class_shape_enumeration) {
4170)             var shape_ = (shape);
4171)             return (new lib_meta.class_shape_enumeration({
4172)                 "shape_option": adjust_labels(shape_.shape_option_get(), transformator),
4173)                 "options": shape_.options_get().map(function (option) {
4174)                     return {
4175)                         "value": option.value,
4176)                         "label": transformator(option.label)
4177)                     };
4178)                 }),
4179)                 "soft": shape_.soft_get(),
4180)                 "defaultvalue": shape_.defaultvalue_get()
4181)             }));
4182)         }
4183)         else if (shape instanceof lib_meta.class_shape_array) {
4184)             var shape_ = (shape);
4185)             return (new lib_meta.class_shape_array({
4186)                 "shape_element": adjust_labels(shape_.shape_element_get(), transformator),
4187)                 "soft": shape_.soft_get(),
4188)                 "defaultvalue": shape_.defaultvalue_get()
4189)             }));
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4190)         }
Christian Fraß update

Christian Fraß authored 6 years ago

4191)         else if (shape instanceof lib_meta.class_shape_object) {
4192)             var shape_ = (shape);
4193)             return (new lib_meta.class_shape_object({
4194)                 "fields": shape_.fields_get().map(function (field) {
4195)                     return {
4196)                         "name": field.name,
4197)                         "shape": adjust_labels(field.shape, transformator),
4198)                         "label": transformator(field.label)
4199)                     };
4200)                 }),
4201)                 "soft": shape_.soft_get(),
4202)                 "defaultvalue": shape_.defaultvalue_get()
4203)             }));
4204)         }
4205)         else {
4206)             // shape["label"] = ((shape["label"] == null) ? null : transformator(shape["label"]));
4207)             return shape;
4208)         }
4209)     }
4210)     lib_meta.adjust_labels = adjust_labels;
4211) })(lib_meta || (lib_meta = {}));
4212) var plain_text_to_html = function (text) {
4213)     var ret = text;
4214)     ret = ret.replace(/  /g, "&nbsp;&nbsp;"); // convert multiple whitespace to forced ones
4215)     ret = ret.split("\n").join("<br/>");
4216)     return ret;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4217) };
4218) /**
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

4220)  */
Christian Fraß update

Christian Fraß authored 6 years ago

4221) var format_sentence = function (str, rtl, caseSense) {
4222)     if (rtl === void 0) { rtl = false; }
4223)     if (caseSense === void 0) { caseSense = true; }
4224)     if (str === "") {
4225)         return str;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4226)     }
4227)     else {
Christian Fraß update

Christian Fraß authored 6 years ago

4228)         var marks = {
4229)             ".": true,
4230)             "?": true,
4231)             "!": true
4232)         };
4233)         var default_mark = ".";
4234)         var ret = str.split("");
4235)         if (!rtl) {
4236)             ret[0] = ret[0].toLocaleUpperCase();
4237)             if (!(ret[ret.length - 1] in marks)) {
4238)                 ret.push(default_mark);
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4239)             }
4240)         }
Christian Fraß update

Christian Fraß authored 6 years ago

4241)         else {
4242)             ret[ret.length - 1] = ret[ret.length - 1].toLocaleUpperCase();
4243)             if (!(ret[0] in marks)) {
4244)                 ret.unshift(default_mark);
4245)             }
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4246)         }
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

4248)     }
4249) };
Christian Fraß update

Christian Fraß authored 6 years ago

4250) var fill_string_template = function (template_string, object, fabric, delimiter, default_string, sloppy) {
4251)     if (fabric === void 0) { fabric = function (object, key) { return object[key]; }; }
4252)     if (delimiter === void 0) { delimiter = "%"; }
4253)     if (default_string === void 0) { default_string = null; }
4254)     function get_tags(str) {
4255)         var r = new RegExp(delimiter + "[^\\s^" + delimiter + "]+" + delimiter, "gi");
4256)         return ((str.match(r) || []).map(function (e) {
4257)             return e.slice(delimiter.length, e.length - delimiter.length);
4258)         }));
4259)     }
4260)     function replace_tag(str, tag, value) {
4261)         var r = new RegExp(delimiter + tag + delimiter, "gi");
4262)         return str.replace(r, value);
4263)     }
4264)     function replace_tags(str, obj) {
4265)         return (get_tags(str).reduce(function (ret, key) {
4266)             var value = "";
4267)             try {
4268)                 value = fabric(obj, key);
4269)                 if ((!sloppy && (value === void 0)) || (sloppy && (value == void 0))) {
4270)                     value = default_string;
4271)                 }
4272)             }
4273)             catch (e) {
4274)                 console.warn("invalid placeholder " + key);
4275)                 value = default_string;
4276)             }
4277)             return replace_tag(ret, key, value);
4278)         }, str));
4279)     }
4280)     return replace_tags(template_string, object);
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4281) };
Christian Fraß update

Christian Fraß authored 6 years ago

4282) var make_string_template = function (_template, _fabrics) {
4283)     if (_fabrics === void 0) { _fabrics = {}; }
4284)     function replace_tag(str, tag, value) {
4285)         var r = new RegExp("%" + tag + "%", "gi");
4286)         return str.replace(r, value);
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4287)     }
Christian Fraß update

Christian Fraß authored 6 years ago

4288)     function replace_tags(str, obj) {
4289)         return (Object.keys(obj).reduce(function (ret, key) {
4290)             return replace_tag(ret, key, _fabrics[key] || obj[key]);
4291)         }, str));
4292)     }
4293)     return (function (tags) {
4294)         return replace_tags(_template, tags);
4295)     });
4296) };
4297) var make_eml_header = (function () {
4298)     var _template = "";
4299)     _template += "From: %from%\n";
4300)     _template += "To: %recipient%\n";
4301)     _template += "Subject: %subject%\n";
4302)     _template += "X-Mailer: greenscale-plankton.emlgen\n";
4303)     return make_string_template(_template);
4304) })();
4305) var make_eml_body = (function () {
4306)     var exports = {};
4307)     exports["simple_body"] = make_string_template("Content-Type: %contenttype%\n\n%body%\n\n");
4308)     // very basic implementation
4309)     // parts = [{contenttype:"text/html; charset=UTF-8", body: "<h1>foo</h1>" }, {...}]
4310)     exports["body_boundrary"] = function (parts, boundrary) {
4311)         var _template = "";
4312)         _template += "--%boundrary%\n";
4313)         _template += "Content-Type: %contenttype%\n\n%body%\n\n";
4314)         //_template += "--%boundrary%--\n\n";
4315)         var maker = make_string_template(_template);
4316)         return (parts.reduce(function (prev, curr) {
4317)             curr.boundrary = boundrary;
4318)             return [prev, maker(curr)].join("");
4319)         }, ""));
4320)     };
4321)     // body must be base64 encoded!
4322)     exports["attachment_boundrary"] = function (parts, boundrary) {
4323)         var _template = "";
4324)         _template += "--%boundrary%\n";
4325)         _template += "Content-Type: %contenttype%\n";
4326)         _template += "Content-Transfer-Encoding: base64\n";
4327)         _template += "Content-Disposition: %disposition%; filename=\"%name%\"\n\n";
4328)         _template += "%body%\n\n";
4329)         //_template += "--%boundrary%--\n\n";
4330)         var maker = make_string_template(_template);
4331)         return (parts.reduce(function (prev, curr) {
4332)             curr.boundrary = boundrary;
4333)             if (curr.disposition === void 0)
4334)                 curr.disposition = "inline";
4335)             return [prev, maker(curr)].join("");
4336)         }, ""));
4337)     };
4338)     exports["gen_boundrary"] = function () {
4339)         return ("xxxxxxxxxxxxxxxxxxxxxx".replace(/[xy]/g, function (c) {
4340)             var r = crypto.getRandomValues(new Uint8Array(1))[0] % 16 | 0, v = c == "x" ? r : (r & 0x3 | 0x8);
4341)             return v.toString(16);
4342)         }));
4343)     };
4344)     // simple implementation without alternatives (old rfc)
4345)     exports["complete_boundrary"] = function (bodyparts, attachments) {
4346)         var ret = "";
4347)         var boundrary = exports["gen_boundrary"]();
4348)         ret += exports["body_boundrary"](bodyparts, boundrary);
4349)         ret += exports["attachment_boundrary"](attachments, boundrary);
4350)         ret += "--" + boundrary + "--\n\nINVISIBLE!!!!";
4351)         return (exports["simple_body"]({
4352)             "contenttype": sprintf("multipart/mixed; boundary=%s", [boundrary]),
4353)             "body": ret
4354)         }));
4355)     };
4356)     return exports;
4357) })();
4358) ///<reference path="../../base/build/logic-decl.d.ts"/>
4359) var lib_string;
4360) (function (lib_string) {
4361)     /**
4362)      * @author frac
4363)      */
4364)     var hexdigits = 4;
4365)     /**
4366)      * @author frac
4367)      */
4368)     var index_max = 1 << (4 * hexdigits);
4369)     /**
4370)      * @author frac
4371)      */
4372)     var index_is = 0;
4373)     /**
4374)      * @author neuc,frac
4375)      */
4376)     function empty(str) {
4377)         var tmp = str.trim();
4378)         return (tmp === "");
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4379)     }
Christian Fraß update

Christian Fraß authored 6 years ago

4380)     lib_string.empty = empty;
4381)     /**
4382)      * @desc returns a unique string
4383)      * @param {string} prefix an optional prefix for the generated string
4384)      * @return {string}
4385)      * @author frac
4386)      */
4387)     function generate(prefix) {
4388)         if (prefix === void 0) { prefix = "string_"; }
4389)         if (index_is > index_max) {
4390)             throw (new Error("[string_generate] out of valid indices"));
4391)         }
4392)         else {
4393)             return lib_string.sprintf(prefix + "%0" + hexdigits.toString() + "X", [index_is++]);
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4394)         }
4395)     }
Christian Fraß update

Christian Fraß authored 6 years ago

4396)     lib_string.generate = generate;
4397)     /**
4398)      * @desc splits a string, but returns an empty list, if the string is empty
4399)      * @param {string} chain
4400)      * @param {string} separator
4401)      * @return {Array<string>}
4402)      * @author frac
4403)      */
4404)     function split(chain, separator) {
4405)         if (separator === void 0) { separator = " "; }
4406)         if (chain.length == 0) {
4407)             return [];
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4408)         }
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

4411)         }
Christian Fraß update

Christian Fraß authored 6 years ago

4412)     }
4413)     lib_string.split = split;
4414)     /**
4415)      * @desc concats a given word with itself n times
4416)      * @param {string} word
4417)      * @param {int}
4418)      * @return {string}
4419)      * @author frac
4420)      */
4421)     function repeat(word, count) {
4422)         return ((count == 0) ? "" : (word + repeat(word, count - 1)));
4423)     }
4424)     lib_string.repeat = repeat;
4425)     /**
4426)      * @desc lengthens a string by repeatedly appending or prepending another string
4427)      * @param {string} word the string to pad
4428)      * @param {int} length the length, which the result shall have
4429)      * @param {string} symbol the string, which will be added (multiple times)
4430)      * @param {boolean} [prepend]; whether to prepend (~true) or append (~false); default: false
4431)      * @return {string} the padded string
4432)      * @author frac
4433)      */
4434)     function pad(word, length, symbol, prepend) {
4435)         if (prepend === void 0) { prepend = false; }
4436)         if (prepend) {
4437)             while (word.length < length)
4438)                 word = symbol + word;
4439)             return word.substring(word.length - length);
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4440)         }
4441)         else {
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

4445)         }
Christian Fraß update

Christian Fraß authored 6 years ago

4446)     }
4447)     lib_string.pad = pad;
4448)     /**
4449)      * @desc checks if a given string conttains a certain substring
4450)      * @param {string} string
4451)      * @param {string} part
4452)      * @return {boolean}
4453)      * @author frac
4454)      */
4455)     function contains(chain, part) {
4456)         if (typeof (chain) !== "string")
4457)             return false;
4458)         return (chain.indexOf(part) >= 0);
4459)     }
4460)     lib_string.contains = contains;
4461)     /**
4462)      * @desc checks if a given string starts with a certain substring
4463)      * @param {string} string
4464)      * @param {string} part
4465)      * @return {boolean}
4466)      * @author frac
4467)      */
4468)     function startsWith(chain, part) {
4469)         if (typeof (chain) !== "string")
4470)             return false;
4471)         // return (string.indexOf(part) === 0);
4472)         return ((function (m, n) {
4473)             if (n == 0) {
4474)                 return true;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4475)             }
4476)             else {
Christian Fraß update

Christian Fraß authored 6 years ago

4477)                 if (m == 0) {
4478)                     return false;
4479)                 }
4480)                 else {
4481)                     return ((chain[0] == part[0]) && startsWith(chain.substring(1), part.substring(1)));
4482)                 }
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4483)             }
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

4485)     }
Christian Fraß update

Christian Fraß authored 6 years ago

4486)     lib_string.startsWith = startsWith;
4487)     /**
4488)      * @desc checks if a given string ends with a certain substring
4489)      * @param {string} string
4490)      * @param {string} part
4491)      * @return {boolean}
4492)      * @author frac
4493)      */
4494)     function endsWith(chain, part) {
4495)         if (typeof (chain) !== "string")
4496)             return false;
4497)         // return (string.lastIndexOf(part) === string.length-part.length);
4498)         return ((function (m, n) {
4499)             if (n == 0) {
4500)                 return true;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4501)             }
4502)             else {
Christian Fraß update

Christian Fraß authored 6 years ago

4503)                 if (m == 0) {
4504)                     return false;
4505)                 }
4506)                 else {
4507)                     // console.info(("(" + string[m-1] + " == " + part[n-1] + ")") + " = " + String(string[m-1] == part[n-1]));
4508)                     return ((chain[m - 1] == part[n - 1]) && endsWith(chain.substring(0, m - 1), part.substring(0, n - 1)));
4509)                 }
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4510)             }
Christian Fraß update

Christian Fraß authored 6 years ago

4511)         })(chain.length, part.length));
4512)     }
4513)     lib_string.endsWith = endsWith;
4514)     /**
4515)      * @desc count the occourrences of a string in a string
4516)      * @param string haystack_string the string wich should be examined
4517)      * @param string needle_string the string which should be counted
4518)      * @author neuc
4519)      */
4520)     function count_occourrences(haystack_string, needle_string, check_escape) {
4521)         var cnt = 0;
4522)         var pos = -1;
4523)         do {
4524)             pos = haystack_string.indexOf(needle_string, pos + 1);
4525)             if ((!check_escape) || (haystack_string[pos - 1] != "\\")) {
4526)                 cnt++;
4527)             }
4528)         } while (pos >= 0);
4529)         return cnt - 1;
4530)     }
4531)     lib_string.count_occourrences = count_occourrences;
4532)     ;
4533)     /**
4534)      * @author fenris
4535)      */
4536)     function stance(str, args) {
4537)         Object.keys(args).forEach(function (key) {
4538)             var value = args[key];
4539)             var regexp_argument = new RegExp("\\${" + key + "}");
4540)             str = str.replace(regexp_argument, value);
4541)         });
4542)         return str;
4543)     }
4544)     lib_string.stance = stance;
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

4545)     /**
4546)      * @author fenris
4547)      */
4548)     function make_url(_a) {
4549)         var _b = _a === void 0 ? {} : _a, _c = _b["protocol"], protocol = _c === void 0 ? null : _c, _d = _b["host"], host = _d === void 0 ? null : _d, _e = _b["port"], port = _e === void 0 ? null : _e, _f = _b["path"], path = _f === void 0 ? null : _f, _g = _b["arguments"], arguments_ = _g === void 0 ? null : _g;
4550)         var url = "";
4551)         // protocol
4552)         {
4553)             if (protocol != null) {
4554)                 url = protocol + ":" + url;
4555)             }
4556)         }
4557)         // host
4558)         {
4559)             if (host != null) {
4560)                 url = url + "//" + host;
4561)             }
4562)         }
4563)         // port
4564)         {
4565)             if (port != null) {
4566)                 url = url + ":" + port.toString();
4567)             }
4568)         }
4569)         // path
4570)         {
4571)             if (path != null) {
4572)                 url = url + "/" + path;
4573)             }
4574)         }
4575)         // arguments
4576)         {
4577)             if (arguments_ != null) {
4578)                 var suffix = Object.keys(arguments_).map(function (key) { return key + "=" + arguments_[key]; }).join("&");
4579)                 url = url + "?" + suffix;
4580)             }
4581)         }
4582)         return url;
4583)     }
4584)     lib_string.make_url = make_url;
Christian Fraß update

Christian Fraß authored 6 years ago

4585) })(lib_string || (lib_string = {}));
4586) /**
4587)  * @desc adapters for old syntax
4588)  */
4589) var string_generate = lib_string.generate;
4590) var string_split = lib_string.split;
4591) var string_repeat = lib_string.repeat;
4592) var string_pad = lib_string.pad;
4593) var string_contains = lib_string.contains;
4594) var string_startsWith = lib_string.startsWith;
4595) var string_endsWith = lib_string.endsWith;
4596) var string_count_occourrences = lib_string.count_occourrences;
4597) var lib_string;
4598) (function (lib_string) {
4599)     var pattern = /%([-+#0 ]*)([0-9]*)[\.]{0,1}([0-9]*)([\w]{1})/;
4600)     var gpattern = /%([-+#0 ]*)([0-9]*)[\.]{0,1}([0-9]*)([\w]{1})/g;
4601)     function split_format(format) {
4602)         var tmp = format.match(pattern);
4603)         if (tmp === null)
4604)             return null;
4605)         return {
4606)             'flags': tmp[1].split(""),
4607)             'width': Number(tmp[2]),
4608)             'precision': tmp[3] === '' ? null : Number(tmp[3]),
4609)             'specifier': tmp[4],
4610)             'string': format
4611)         };
4612)     }
4613)     function make_err(format, arg, should) {
4614)         return ("[sprintf]" + " " + "argument for '" + format.string + "' has to be '" + should + "' but '" + arg + "' is '" + typeof arg + "'!");
4615)     }
4616)     function test_arg(format, arg, should) {
4617)         if (typeof arg !== should) {
4618)             console.warn(make_err(format, arg, should));
4619)             return false;
4620)         }
4621)         return true;
4622)     }
4623)     function string_fill(str, char, len, left) {
4624)         while (str.length < len) {
4625)             if (left) {
4626)                 str += char;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4627)             }
4628)             else {
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

4630)             }
4631)         }
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

4633)     }
Christian Fraß update

Christian Fraß authored 6 years ago

4634)     /**
4635)      * the known_parameters are used to parse the different identifiers for the welln known syntax:
4636)      *          flag   width   precision   identifier
4637)      *      %{[0#+- ]}{[0-9]*}.{[0-9]*}[fFdiueEgGsoxXaAsn]
4638)      * flags:
4639)      * 0    -   fill with '0' instead of ' ' if the string length < width
4640)      * #    -   not implemented
4641)      * -    -   left-justified -> fill on the right side to reach width
4642)      * +    -   force using '+' on positive numbers
4643)      * ' '  -   add a single space before positive numbers
4644)      *
4645)      * identifiers
4646)      * %f, %F       -   interpret given number as float, width: the minimal total width (fill with ' ' or '0' if the
4647)      *                  resulting string is too short, precision: cut more then given decimal places
4648)      * %d, %i, %u   -   interpret number as integer, decimal places will be cut. width: like float, precision:
4649)      *                  fill with '0' on right side until length given in precision is reached
4650)      * %e           -   interpret as float and write as scientifical number, width & precision like in float
4651)      * %E           -   same es %e but uppercase 'E'
4652)      * %g           -   use the shortest string of %f or %e
4653)      * %G           -   use the shortest string of %E or %E
4654)      * %s           -   simply print a string
4655)      * %o           -   print the given number in octal notation
4656)      * %x           -   print the given number in hex notation
4657)      * %X           -   same as %x but with uppercase characters
4658)      * %a           -   alias to %x
4659)      * %A           -   alias to %X
4660)      * %n           -   just print nothing
4661)      * @type {{}}
4662)      */
4663)     var known_params = {};
4664)     known_params["f"] = function (format, arg) {
4665)         if (!test_arg(format, arg, "number"))
4666)             return "Ø";
4667)         var tmp = Math.abs(arg);
4668)         var sign = (arg < 0) ? -1 : 1;
4669)         var tmp_result = null;
4670)         if (format.precision !== null) {
4671)             tmp = Math.floor(Math.pow(10, format.precision) * tmp) / Math.pow(10, format.precision);
4672)             var tmp_ = (tmp * sign).toString().split(".");
4673)             if (tmp_.length === 1)
4674)                 tmp_.push("");
4675)             tmp_[1] = string_fill(tmp_[1], "0", format.precision, true);
4676)             tmp_result = tmp_.join(".");
4677)         }
4678)         else {
4679)             tmp_result = (sign * tmp).toString();
4680)         }
4681)         if ((format.flags.indexOf(" ") >= 0) && (arg >= 0)) {
4682)             tmp_result = " " + tmp;
4683)         }
4684)         else if ((format.flags.indexOf("+") >= 0) && (arg >= 0)) {
4685)             tmp_result = "+" + tmp;
4686)         }
4687)         tmp_result = string_fill(tmp, (format.flags.indexOf("0") >= 0) ? "0" : " ", format.width, (format.flags.indexOf("-") >= 0));
4688)         return tmp_result;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4689)     };
Christian Fraß update

Christian Fraß authored 6 years ago

4690)     known_params["F"] = known_params["f"];
4691)     known_params["d"] = function (format, arg) {
4692)         if (!test_arg(format, arg, 'number'))
4693)             return 'Ø';
4694)         var tmp = (((arg < 0 && format.specifier !== 'u') ? -1 : 1) * Math.floor(Math.abs(arg))).toString();
4695)         if ((format.specifier === 'd' || format.specifier === 'i') && format.flags.indexOf(' ') >= 0 && arg >= 0) {
4696)             tmp = ' ' + tmp;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4697)         }
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

4700)         }
Christian Fraß update

Christian Fraß authored 6 years ago

4701)         tmp = string_fill(tmp, format.flags.indexOf('0') >= 0 ? '0' : ' ', format.width, format.flags.indexOf('-') >= 0);
4702)         tmp = string_fill(tmp, '0', format.precision === null ? 0 : format.precision, false);
4703)         return tmp;
4704)     };
4705)     known_params["i"] = known_params["d"];
4706)     known_params["u"] = known_params["d"];
4707)     known_params["e"] = function (format, arg) {
4708)         if (!test_arg(format, arg, 'number'))
4709)             return 'Ø';
4710)         var tmp = arg.toExponential(format.precision === null ? undefined : format.precision).toString();
4711)         if (format.flags.indexOf(' ') >= 0 && arg >= 0) {
4712)             tmp = ' ' + tmp;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4713)         }
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

4716)         }
Christian Fraß update

Christian Fraß authored 6 years ago

4717)         tmp = string_fill(tmp, format.flags.indexOf('0') >= 0 ? '0' : ' ', format.width, format.flags.indexOf('-') >= 0);
4718)         return tmp;
4719)     };
4720)     known_params["E"] = function (format, arg) {
4721)         return known_params["e"](format, arg).toUpperCase();
4722)     };
4723)     known_params["g"] = function (format, arg) {
4724)         if (!test_arg(format, arg, 'number'))
4725)             return 'Ø';
4726)         var tmpf = known_params["f"](format, arg);
4727)         var tmpe = known_params["e"](format, arg);
4728)         if (tmpf.length < tmpe.length) {
4729)             return tmpf;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4730)         }
4731)         else {
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

4733)         }
Christian Fraß update

Christian Fraß authored 6 years ago

4734)     };
4735)     known_params["G"] = function (format, arg) {
4736)         return known_params["g"](format, arg).toUpperCase();
4737)     };
4738)     known_params["s"] = function (format, arg) {
4739)         if (!test_arg(format, arg, 'string'))
4740)             return 'o.O';
4741)         var tmp = format.precision !== null ? arg.substr(0, format.precision) : arg;
4742)         tmp = string_fill(tmp, format.flags.indexOf('0') >= 0 ? '0' : ' ', format.width, format.flags.indexOf('-') >= 0);
4743)         return tmp;
4744)     };
4745)     known_params["o"] = function (format, arg) {
4746)         if (!test_arg(format, arg, 'number'))
4747)             return 'Ø';
4748)         var tmp = Math.floor(Math.round(Math.abs(arg))) * ((arg < 0) ? -1 : 1);
4749)         return known_params["s"](format, tmp.toString(8));
4750)     };
4751)     known_params["x"] = function (format, arg) {
4752)         if (!test_arg(format, arg, 'number'))
4753)             return 'Ø';
4754)         var tmp = Math.floor(Math.round(Math.abs(arg))) * ((arg < 0) ? -1 : 1);
4755)         return known_params["s"](format, tmp.toString(16));
4756)     };
4757)     known_params["a"] = known_params["x"];
4758)     known_params["X"] = function (format, arg) {
4759)         if (!test_arg(format, arg, 'number'))
4760)             return 'Ø';
4761)         return known_params["x"](format, arg).toUpperCase();
4762)     };
4763)     known_params["A"] = known_params["X"];
4764)     known_params["c"] = function (format, arg) {
4765)         var tmp = "";
4766)         if (typeof arg === "number") {
4767)             tmp = String.fromCharCode(arg);
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4768)         }
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

4771)         }
Christian Fraß update

Christian Fraß authored 6 years ago

4772)         else {
4773)             console.warn(make_err(format, arg, "number|string") + " and if string it needs to have the length of 1!");
4774)         }
4775)         return known_params["s"](format, tmp);
4776)     };
4777)     known_params["n"] = function () {
4778)         return "";
4779)     };
4780)     var decompose = function (chain, regexp) {
4781)         var result = regexp.exec(chain);
4782)         if (result == null) {
4783)             return null;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4784)         }
4785)         else {
Christian Fraß update

Christian Fraß authored 6 years ago

4786)             var front = chain.substring(0, result.index);
4787)             var back = chain.substring(result.index + result[0].length);
4788)             return { "front": front, "match": result[0], "back": back };
4789)         }
4790)     };
4791)     /**
4792)      * an implementation of c sprintf
4793)      * @param {string} string format string
4794)      * @param {array} args arguments which should be filled into
4795)      * @returns {string}
4796)      */
4797)     lib_string.sprintf = function (input, args, original) {
4798)         if (args === void 0) { args = []; }
4799)         if (original === void 0) { original = null; }
4800)         if (original == null)
4801)             original = input;
4802)         var components = decompose(input, pattern);
4803)         if (components == null) {
4804)             if (args.length > 0) {
4805)                 console.warn("[sprintf] superfluous arguments while formatting '" + original + "': ", args);
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4806)             }
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

4808)         }
Christian Fraß update

Christian Fraß authored 6 years ago

4809)         else {
4810)             var arg;
4811)             var rest;
4812)             if (args.length > 0) {
4813)                 arg = args[0];
4814)                 rest = args.slice(1);
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4815)             }
4816)             else {
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

4821)             }
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

4826)         }
Christian Fraß update

Christian Fraß authored 6 years ago

4827)     };
4828)     /**
4829)      * an implementation of c printf
4830)      * @param {string} string format string
4831)      * @param {array} args arguments which should be filled into
4832)      * @returns {string}
4833)      */
4834)     function printf(format, args) {
4835)         console.log(lib_string.sprintf(format, args));
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4836)     }
Christian Fraß update

Christian Fraß authored 6 years ago

4837)     lib_string.printf = printf;
4838) })(lib_string || (lib_string = {}));
4839) var sprintf = lib_string.sprintf;
4840) var printf = lib_string.printf;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4841) /**
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

4843)  */
Christian Fraß update

Christian Fraß authored 6 years ago

4844) var strftime;
4845) (function (strftime) {
4846)     var currentDate = new Date();
4847)     var days = [
4848)         "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"
4849)     ];
4850)     var months = [
4851)         "January", "February", "March", "April", "May", "June", "July", "August", "September",
4852)         "October", "November", "December"
4853)     ];
4854)     function set_days(day_names) {
4855)         days = day_names;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4856)     }
Christian Fraß update

Christian Fraß authored 6 years ago

4857)     strftime.set_days = set_days;
4858)     function set_months(month_names) {
4859)         months = month_names;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4860)     }
Christian Fraß update

Christian Fraß authored 6 years ago

4861)     strftime.set_months = set_months;
4862)     // source: https://stackoverflow.com/questions/8619879/javascript-calculate-the-day-of-the-year-1-366
4863)     function helper_dayOfYear(date) {
4864)         var start = new Date(date.getFullYear(), 0, 0);
4865)         var diff = date - start;
4866)         var oneDay = 1000 * 60 * 60 * 24;
4867)         return Math.floor(diff / oneDay);
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4868)     }
Christian Fraß update

Christian Fraß authored 6 years ago

4869)     // source: http://weeknumber.net/how-to/javascript
4870)     function helper_weekOfYear(date_) {
4871)         var date = new Date(date_.getTime());
4872)         date.setHours(0, 0, 0, 0);
4873)         // Thursday in current week decides the year.
4874)         date.setDate(date.getDate() + 3 - (date.getDay() + 6) % 7);
4875)         // January 4 is always in week 1.
4876)         var week1 = new Date(date.getFullYear(), 0, 4);
4877)         // Adjust to Thursday in week 1 and count number of weeks from date to week1.
4878)         return 1 + Math.round(((date.getTime() - week1.getTime()) / 86400000
4879)             - 3 + (week1.getDay() + 6) % 7) / 7);
4880)     }
4881)     function helper_englishWeekOfYear(date) {
4882)         var nr = helper_weekOfYear(date);
4883)         if (date.getDay() === 0) {
4884)             nr = nr - 1;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4885)         }
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

4887)     }
Christian Fraß update

Christian Fraß authored 6 years ago

4888)     function set_currentDate(date) {
4889)         currentDate = date;
4890)     }
4891)     strftime.set_currentDate = set_currentDate;
4892)     function parse(format, date) {
4893)         if (!date) {
4894)             date = currentDate;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4895)         }
Christian Fraß update

Christian Fraß authored 6 years ago

4896)         var ret = format;
4897)         var re = new RegExp("%[a-z]", "gi");
4898)         var match;
4899)         while (match = re.exec(format)) {
4900)             ret = ret.replace(match[0], parse_segment(match[0], date));
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4901)         }
Christian Fraß update

Christian Fraß authored 6 years ago

4902)         return ret;
4903)     }
4904)     strftime.parse = parse;
4905)     function parse_segment(segment, date) {
4906)         if (!date) {
4907)             date = currentDate;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4908)         }
Christian Fraß update

Christian Fraß authored 6 years ago

4909)         var hm_segments = {
4910)             "%a": function () { return days[date.getDay()].slice(0, 3); },
4911)             "%A": function () { return days[date.getDay()]; },
4912)             "%b": function () { return days[date.getMonth()].slice(0, 3); },
4913)             "%B": function () { return days[date.getMonth()]; },
4914)             "%c": function () { return date.toLocaleString(); },
4915)             "%C": function () { return Math.floor((date.getFullYear()) / 100).toString(); },
4916)             "%d": function () { return sprintf("%02d", [date.getDate()]); },
4917)             "%D": function () { return parse("%m/%d/%y", date); },
4918)             "%e": function () { return sprintf("%2d", [date.getDate()]); },
4919)             "%F": function () { return parse("%Y-%m-%d", date); },
4920)             "%g": function () { return sprintf("%02d", [date.getFullYear() % 1000]); },
4921)             "%G": function () { return date.getFullYear().toString(); },
4922)             "%h": function () { return parse("%b", date); },
4923)             "%H": function () { return sprintf("%02d", [date.getHours()]); },
4924)             "%I": function () {
4925)                 return sprintf("%02d", [
4926)                     (date.getHours() > 12 ? date.getHours() - 12 : date.getHours())
4927)                 ]);
4928)             },
4929)             "%j": function () { return sprintf("%03d", [helper_dayOfYear(date)]); },
4930)             "%m": function () { return sprintf("%02d", [date.getMonth() + 1]); },
4931)             "%M": function () { return sprintf("%02d", [date.getMinutes()]); },
4932)             "%n": function () { return "\n"; },
4933)             "%p": function () { return (date.getHours() > 12 ? "PM" : "AM"); },
4934)             "%r": function () { return parse("%I:%M:%S %p", date); },
4935)             "%R": function () { return parse("%H:%M", date); },
4936)             "%S": function () { return date.getSeconds().toString(); },
4937)             "%t": function () { return "\t"; },
4938)             "%T": function () { return parse("%H:%M:%S", date); },
4939)             "%u": function () { return sprintf("%02d", [(date.getDay() === 0 ? 7 : date.getDay())]); },
4940)             "%U": function () { return sprintf("%02d", [helper_englishWeekOfYear(date)]); },
4941)             "%V": function () { return sprintf("%02d", [helper_weekOfYear(date)]); },
4942)             "%w": function () { return sprintf("%02d", [date.getDay().toString()]); },
4943)             "%W": function () { return parse("%w", date); },
4944)             "%x": function () { return parse("%m/%d/%G", date); },
4945)             "%X": function () { return parse("%T", date); },
4946)             "%y": function () { return parse("%g", date); },
4947)             "%Y": function () { return parse("%G", date); },
4948)             "%z": function () { return date.getTimezoneOffset().toString(); },
4949)             "%Z": function () { return date.toUTCString().split(' ').pop(); },
4950)             "%%": function () { return "%"; }
4951)         };
4952)         if (!(segment in hm_segments)) {
4953)             throw "unknown format argument '" + segment + "'";
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4954)         }
Christian Fraß update

Christian Fraß authored 6 years ago

4955)         return hm_segments[segment]();
4956)     }
4957) })(strftime || (strftime = {}));
4958) function locale_date(date, ignore_error) {
4959)     if (date === void 0) { date = new Date(); }
4960)     if (ignore_error === void 0) { ignore_error = false; }
4961)     if (!(date instanceof Date)) {
4962)         if (!ignore_error) {
4963)             throw new SyntaxError("date must be instance of Date");
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4964)         }
Christian Fraß update

Christian Fraß authored 6 years ago

4965)         else {
4966)             console.warn("'" + date + "' seems not to be instance of Date try to force convert.");
4967)             var tmp = date;
4968)             date = new Date(tmp);
4969)             if ((date.toString() === "Invalid Date") ||
4970)                 (!(date < new Date(0)) && !(date > new Date(0)))) {
4971)                 console.warn("conversion didn't work, returning default value");
4972)                 return "Ø";
4973)             }
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4974)         }
Christian Fraß update

Christian Fraß authored 6 years ago

4975)     }
4976)     var conf = global_config.get_value("date") || {
4977)         "use_locale_date": true,
4978)         "format_string": "%d.%m.%Y"
4979)     };
4980)     if (conf.use_locale_date) {
4981)         return date.toLocaleDateString();
4982)     }
4983)     else {
4984)         return strftime.parse(conf.format_string, date);
4985)     }
4986) }
4987) ;
4988) var make_logger = (function () {
4989)     var _loggers = {};
4990)     var make_logger = function (prefix, current_loglevel) {
4991)         var log = [];
4992)         var level = [
4993)             "LOG", "INFO", "WARNING", "DEBUG"
4994)         ];
4995)         var logger = function (obj, lvl) {
4996)             var txt = obj.txt || obj;
4997)             if (lvl == void 0)
4998)                 lvl = 0;
4999)             var date = new Date();
5000)             log.push({
5001)                 "message": sprintf("%s [%s:%s] %s", [date.toString(), level[lvl], prefix, txt]),
5002)                 "timeStamp": +(date)
5003)             });
5004)             if (lvl <= current_loglevel) {
5005)                 var msg = ["[" + prefix + "]", txt];
5006)                 if (obj.arg)
5007)                     msg = ["[" + prefix + "]"].concat(Array.prototype.slice.call(obj.arg));
5008)                 if (lvl === 0)
5009)                     console["_log"].apply(console, msg);
5010)                 else if (lvl === 1)
5011)                     console["_info"].apply(console, msg);
5012)                 else if (lvl === 2)
5013)                     console["_warn"].apply(console, msg);
5014)                 else if (lvl >= 3)
5015)                     console["_log"].apply(console, msg);
5016)             }
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

5017)         };
Christian Fraß update

Christian Fraß authored 6 years ago

5018)         _loggers[prefix] = {
5019)             "logger": logger,
5020)             "log": log
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

5021)         };
Christian Fraß update

Christian Fraß authored 6 years ago

5022)         return logger;
5023)     };
5024)     make_logger["loggers"] = _loggers;
5025)     make_logger["complete_log"] = function () {
5026)         var logs = Object.keys(_loggers)
5027)             .reduce(function (p, c) {
5028)             return [].concat(p, _loggers[c].log);
5029)         }, []);
5030)         logs.sort(function (x, y) {
5031)             return ((x.timeStamp > y.timeStamp) ? -1 : +1);
5032)         });
5033)         return logs.map(function (x, i, a) {
5034)             return x.message;
5035)         });
5036)     };
5037)     if (true) {
5038)         var _log_all = function (log, lvl, next) {
5039)             if (next === void 0) { next = function () { }; }
5040)             return function () {
5041)                 var msg = [];
5042)                 for (var i = 0; i < arguments.length; i++) {
5043)                     if (typeof arguments[i] === "string") {
5044)                         msg.push(arguments[i]);
5045)                     }
5046)                     else {
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

5047)                         msg.push(JSON.stringify(arguments[i]));
5048)                     }
5049)                 }
5050)                 var obj = {
5051)                     txt: msg.join("\t"),
5052)                     arg: arguments
5053)                 };
5054)                 log(obj, lvl);
5055)                 next();
5056)             };
5057)         };
5058)         {
5059)             var __warn = make_logger("deprecated console.warn", 99);
5060)             var __error = make_logger("deprecated console.error", 99);
5061)             var __log = make_logger("deprecated console.log", 99);
5062)             var __info = make_logger("deprecated console.info", 99);
5063)             // bad ass
5064)             console["_log"] = console.log;
5065)             console["_error"] = console.error;
5066)             console["_warn"] = console.warn;
5067)             console["_info"] = console.info;
5068)             /*
5069)             console["log"] = _log_all(__log, 0);
5070)             console["error"] = _log_all(__error, 2);
5071)             console["warn"] = _log_all(__warn, 2);
5072)             console["info"] = _log_all(__info, 0);
5073)              */
5074)         }
5075)         /*
5076)         {
5077)             make_logger["send_log"] = function(){
5078)                 eml_log(
5079)                     function () {
5080)                         alert("fehlerbericht wurde gesendet!");
5081)                     }
5082)                 );
5083)             };
5084)             var error_log = make_logger("global.error", 99);
5085)             window.onerror = _log_all(
5086)                 error_log,
5087)                 1,
5088)                 function(){
5089)                     if (global_config == undefined) {
5090)                         return false;
5091)                     }
5092)                     if (global_config.report_error) {
5093)                         make_logger["send_log"]();
5094)                     }
5095)                 }
5096)             );
5097)         }
5098)          */
5099)     }
5100)     return make_logger;
5101) })();
5102) var __extends = (this && this.__extends) || (function () {
5103)     var extendStatics = Object.setPrototypeOf ||
5104)         ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
5105)         function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
5106)     return function (d, b) {
5107)         extendStatics(d, b);
5108)         function __() { this.constructor = d; }
5109)         d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
5110)     };
5111) })();
5112) ///<reference path="../../base/build/logic-decl.d.ts"/>
5113) ///<reference path="../../string/build/logic-decl.d.ts"/>
5114) /**
5115)  * @author fenris
5116)  */
5117) var lib_xml;
5118) (function (lib_xml) {
5119)     /**
5120)      * @author fenris
5121)      */
5122)     var class_node = (function () {
5123)         function class_node() {
5124)         }
5125)         return class_node;
5126)     }());
5127)     lib_xml.class_node = class_node;
5128)     /**
5129)      * @author fenris
5130)      */
5131)     var class_node_text = (function (_super) {
5132)         __extends(class_node_text, _super);
5133)         /**
5134)          * @author fenris
5135)          */
5136)         function class_node_text(content) {
5137)             var _this = _super.call(this) || this;
5138)             _this.content = content;
5139)             return _this;
5140)         }
5141)         /**
5142)          * @author fenris
5143)          */
5144)         class_node_text.prototype.compile = function (depth) {
5145)             if (depth === void 0) { depth = 0; }
5146)             return (lib_string.repeat("\t", depth) + this.content + "\n");
5147)         };
5148)         return class_node_text;
5149)     }(class_node));
5150)     lib_xml.class_node_text = class_node_text;
5151)     /**
5152)      * @author fenris
5153)      */
5154)     var class_node_comment = (function (_super) {
5155)         __extends(class_node_comment, _super);
5156)         /**
5157)          * @author fenris
5158)          */
5159)         function class_node_comment(content) {
5160)             var _this = _super.call(this) || this;
5161)             _this.content = content;
5162)             return _this;
5163)         }
5164)         /**
5165)          * @author fenris
5166)          */
5167)         class_node_comment.prototype.compile = function (depth) {
5168)             if (depth === void 0) { depth = 0; }
5169)             return (lib_string.repeat("\t", depth) + "<!-- " + this.content + " -->" + "\n");
5170)         };
5171)         return class_node_comment;
5172)     }(class_node));
5173)     lib_xml.class_node_comment = class_node_comment;
5174)     /**
5175)      * @author fenris
5176)      */
5177)     var class_node_complex = (function (_super) {
5178)         __extends(class_node_complex, _super);
5179)         /**
5180)          * @author fenris
5181)          */
5182)         function class_node_complex(name, attributes, children) {
5183)             if (attributes === void 0) { attributes = {}; }
5184)             if (children === void 0) { children = []; }
5185)             var _this = _super.call(this) || this;
5186)             _this.name = name;
5187)             _this.attributes = attributes;
5188)             _this.children = children;
5189)             return _this;
5190)         }
5191)         /**
5192)          * @author fenris
5193)          */
5194)         class_node_complex.prototype.compile = function (depth) {
5195)             var _this = this;
5196)             if (depth === void 0) { depth = 0; }
5197)             var output = "";
5198)             var attributes = Object.keys(this.attributes).map(function (key) { return (" " + key + "=" + ("\"" + _this.attributes[key] + "\"")); }).join("");
5199)             output += (lib_string.repeat("\t", depth) + "<" + this.name + attributes + ">" + "\n");
5200)             this.children.forEach(function (child) { return (output += child.compile(depth + 1)); });
5201)             output += (lib_string.repeat("\t", depth) + "</" + this.name + ">" + "\n");
5202)             return output;
5203)         };
5204)         return class_node_complex;
5205)     }(class_node));
5206)     lib_xml.class_node_complex = class_node_complex;
5207) })(lib_xml || (lib_xml = {}));
5208) var __extends = (this && this.__extends) || (function () {
5209)     var extendStatics = Object.setPrototypeOf ||
5210)         ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
5211)         function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
5212)     return function (d, b) {
5213)         extendStatics(d, b);
5214)         function __() { this.constructor = d; }
5215)         d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
5216)     };
5217) })();
5218) var lib_path;
5219) (function (lib_path) {
5220)     /**
5221)      * @author fenris
5222)      */
5223)     var class_step = (function () {
5224)         function class_step() {
5225)         }
5226)         return class_step;
5227)     }());
5228)     lib_path.class_step = class_step;
5229)     /**
5230)      * @author fenris
5231)      */
5232)     var class_step_stay = (function (_super) {
5233)         __extends(class_step_stay, _super);
5234)         function class_step_stay() {
5235)             return _super !== null && _super.apply(this, arguments) || this;
5236)         }
5237)         /**
5238)          * @author fenris
5239)          */
5240)         class_step_stay.prototype.invert = function () {
5241)             return (new class_step_stay());
5242)         };
5243)         /**
5244)          * @author fenris
5245)          */
5246)         class_step_stay.prototype.toString = function () {
5247)             return ".";
5248)         };
5249)         return class_step_stay;
5250)     }(class_step));
5251)     lib_path.class_step_stay = class_step_stay;
5252)     /**
5253)      * @author fenris
5254)      */
5255)     var class_step_back = (function (_super) {
5256)         __extends(class_step_back, _super);
5257)         function class_step_back() {
5258)             return _super !== null && _super.apply(this, arguments) || this;
5259)         }
5260)         /**
5261)          * @author fenris
5262)          */
5263)         class_step_back.prototype.invert = function () {
5264)             throw (new Error("impossible"));
5265)         };
5266)         /**
5267)          * @author fenris
5268)          */
5269)         class_step_back.prototype.toString = function () {
5270)             return "..";
5271)         };
5272)         return class_step_back;
5273)     }(class_step));
5274)     lib_path.class_step_back = class_step_back;
5275)     /**
5276)      * @author fenris
5277)      */
5278)     var class_step_regular = (function (_super) {
5279)         __extends(class_step_regular, _super);
5280)         /**
5281)          * @author fenris
5282)          */
5283)         function class_step_regular(name) {
5284)             var _this = _super.call(this) || this;
5285)             _this.name = name;
5286)             return _this;
5287)         }
5288)         /**
5289)          * @author fenris
5290)          */
5291)         class_step_regular.prototype.invert = function () {
5292)             return (new class_step_back());
5293)         };
5294)         /**
5295)          * @author fenris
5296)          */
5297)         class_step_regular.prototype.toString = function () {
5298)             return this.name;
5299)         };
5300)         return class_step_regular;
5301)     }(class_step));
5302)     lib_path.class_step_regular = class_step_regular;
5303)     /**
5304)      * @author fenris
5305)      */
5306)     function step_read(s) {
5307)         switch (s) {
5308)             case ".": {
5309)                 return (new class_step_stay());
5310)                 // break;
5311)             }
5312)             case "..": {
5313)                 return (new class_step_back());
5314)                 // break;
5315)             }
5316)             default: {
5317)                 return (new class_step_regular(s));
5318)                 // break;
5319)             }
5320)         }
5321)     }
5322)     lib_path.step_read = step_read;
5323) })(lib_path || (lib_path = {}));
5324) ///<reference path="../../../plankton/object/build/logic-decl.d.ts"/>
5325) var lib_path;
5326) (function (lib_path) {
5327)     /**
5328)      * @author fenris
5329)      */
5330)     var class_chain = (function () {
5331)         /**
5332)          * @author fenris
5333)          */
5334)         function class_chain(steps) {
5335)             if (steps === void 0) { steps = []; }
5336)             this.steps = steps;
5337)         }
5338)         /**
5339)          * @author fenris
5340)          */
5341)         class_chain.splitter = function (system) {
5342)             if (system === void 0) { system = "linux"; }
5343)             return (object_fetch({
5344)                 "linux": "/",
5345)                 "bsd": "/",
5346)                 "win": "\\"
5347)             }, system, "/", 2));
5348)         };
5349)         /**
5350)          * @desc removes superfluent steps from the chain, e.g. infix ".."
5351)          * @author fenris
5352)          */
5353)         class_chain.prototype.normalize = function () {
5354)             var steps = this.steps;
5355)             // filter "stay"
5356)             {
5357)                 steps = steps.filter(function (step) { return (!(step instanceof lib_path.class_step_stay)); });
5358)             }
5359)             // filter "regular-back"
5360)             {
5361)                 var _loop_1 = function () {
5362)                     if (steps.length < 1) {
5363)                         return "break";
5364)                     }
5365)                     else {
5366)                         var last_1 = steps[0];
5367)                         var found = steps.slice(1).some(function (step, index) {
5368)                             if (step instanceof lib_path.class_step_back) {
5369)                                 if (last_1 instanceof lib_path.class_step_regular) {
5370)                                     steps.splice(index, 2);
5371)                                     return true;
5372)                                 }
5373)                             }
5374)                             last_1 = step;
5375)                             return false;
5376)                         });
5377)                         if (!found) {
5378)                             return "break";
5379)                         }
5380)                     }
5381)                 };
5382)                 while (true) {
5383)                     var state_1 = _loop_1();
5384)                     if (state_1 === "break")
5385)                         break;
5386)                 }
5387)             }
5388)             return (new class_chain(steps));
5389)         };
5390)         /**
5391)          * @author fenris
5392)          */
5393)         class_chain.prototype.invert = function () {
5394)             return (new class_chain(this.steps.map(function (step) { return step.invert(); })));
5395)         };
5396)         /**
5397)          * @author fenris
5398)          */
5399)         class_chain.prototype.add = function (step) {
5400)             return (new class_chain(this.steps.concat([step]))).normalize();
5401)         };
5402)         /**
5403)          * @author fenris
5404)          */
5405)         class_chain.prototype.extend = function (chain) {
5406)             return (new class_chain(this.steps.concat(chain.steps))).normalize();
5407)         };
5408)         /**
5409)          * @author fenris
5410)          */
5411)         class_chain.prototype.as_string = function (system) {
5412)             if (system === void 0) { system = "linux"; }
5413)             var splitter = class_chain.splitter(system);
5414)             return ((this.steps.length == 0) ? ("." + splitter) : this.steps.map(function (step) { return (step.toString() + splitter); }).join(""));
5415)         };
5416)         /**
5417)          * @author fenris
5418)          */
5419)         class_chain.prototype.toString = function () {
5420)             return this.as_string();
5421)         };
5422)         return class_chain;
5423)     }());
5424)     lib_path.class_chain = class_chain;
5425)     /**
5426)      * @author fenris
5427)      */
5428)     function chain_read(str, system) {
5429)         if (system === void 0) { system = "linux"; }
5430)         var splitter = class_chain.splitter(system);
5431)         var parts = str.split(splitter);
5432)         if (parts[parts.length - 1] == "")
5433)             parts.pop();
5434)         return (new class_chain(parts.map(lib_path.step_read)));
5435)     }
5436)     lib_path.chain_read = chain_read;
5437) })(lib_path || (lib_path = {}));
5438) ///<reference path="../../../plankton/object/build/logic-decl.d.ts"/>
5439) var lib_path;
5440) (function (lib_path) {
5441)     /**
5442)      * @author fenris
5443)      */
5444)     var class_location = (function () {
5445)         /**
5446)          * @author fenris
5447)          */
5448)         function class_location(anchor, chain) {
5449)             this.anchor = anchor;
5450)             this.chain = chain;
5451)         }
5452)         /**
5453)          * @author fenris
5454)          */
5455)         class_location.anchorpattern = function (system) {
5456)             if (system === void 0) { system = "linux"; }
5457)             return (object_fetch({
5458)                 "linux": new RegExp("/"),
5459)                 "bsd": new RegExp("/"),
5460)                 "win": new RegExp("[A-Z]:\\\\>")
5461)             }, system, new RegExp("/"), 1));
5462)         };
5463)         /**
5464)          * @desc [accessor]
5465)          * @author fenris
5466)          */
5467)         class_location.prototype.is_absolute = function () {
5468)             return (this.anchor != null);
5469)         };
5470)         /**
5471)          * @author fenris
5472)          */
5473)         class_location.prototype.normalize = function () {
5474)             return (new class_location(this.anchor, this.chain.normalize()));
5475)         };
5476)         /**
5477)          * @author fenris
5478)          */
5479)         class_location.prototype.extend = function (chain) {
5480)             return (new class_location(this.anchor, this.chain.extend(chain)));
5481)         };
5482)         /**
5483)          * @desc [accessor]
5484)          * @author fenris
5485)          */
5486)         class_location.prototype.relocate = function (location) {
5487)             if (this.is_absolute()) {
5488)                 return (new class_location(this.anchor, this.chain));
5489)             }
5490)             else {
5491)                 return location.extend(this.chain);
5492)             }
5493)         };
5494)         /**
5495)          * @author fenris
5496)          */
5497)         class_location.prototype.go_thither = function () {
5498)             // console.error(">>", this.toString());
5499)             process.chdir(this.toString());
5500)         };
5501)         /**
5502)          * @author fenris
5503)          */
5504)         class_location.prototype.expedition = function (core) {
5505)             var that = this;
5506)             var current = location_read(process.cwd());
5507)             function begin() {
5508)                 // (new class_message("changing directory to '" + that.toString() + "'")).stderr();
5509)                 that.go_thither();
5510)             }
5511)             function end() {
5512)                 // (new class_message("changing directory to '" + current.toString() + "'")).stderr();
5513)                 current.go_thither();
5514)             }
5515)             begin();
5516)             core(end);
5517)         };
5518)         /**
5519)          * @author fenris
5520)          */
5521)         class_location.prototype.as_string = function (system) {
5522)             if (system === void 0) { system = "linux"; }
5523)             return (((this.anchor != null) ? this.anchor : "") + this.chain.as_string(system));
5524)         };
5525)         /**
5526)          * @author fenris
5527)          */
5528)         class_location.prototype.toString = function () {
5529)             return this.as_string();
5530)         };
5531)         /**
5532)          * @author fenris
5533)          */
5534)         class_location.current = function () {
5535)             // return class_location.read(process.cwd());
5536)             return location_read(process.cwd());
5537)         };
5538)         /**
5539)          * @author fenris
5540)          */
5541)         class_location.tempfolder = function (system) {
5542)             if (system === void 0) { system = "linux"; }
5543)             return (object_fetch({
5544)                 "linux": new class_location("/", new lib_path.class_chain([new lib_path.class_step_regular("tmp")])),
5545)                 "bsd": new class_location("/", new lib_path.class_chain([new lib_path.class_step_regular("tmp")])),
5546)                 "win": new class_location(null, new lib_path.class_chain([new lib_path.class_step_regular("%TEMP%")]))
5547)             }, system, null, 2));
5548)         };
5549)         return class_location;
5550)     }());
5551)     lib_path.class_location = class_location;
5552)     /**
5553)      * @author fenris
5554)      */
5555)     function location_read(str, system) {
5556)         if (system === void 0) { system = "linux"; }
5557)         var regexp = class_location.anchorpattern(system);
5558)         var matching = regexp.exec(str);
5559)         if ((matching == null) || (matching.index > 0)) {
5560)             return (new class_location(null, lib_path.chain_read(str, system)));
5561)         }
5562)         else {
5563)             return (new class_location(matching[0], lib_path.chain_read(str.slice(matching[0].length), system)));
5564)         }
5565)     }
5566)     lib_path.location_read = location_read;
5567) })(lib_path || (lib_path = {}));
5568) var lib_path;
5569) (function (lib_path) {
5570)     /**
5571)      * @author fenris
5572)      */
5573)     var class_filepointer = (function () {
5574)         /**
5575)          * @author fenris
5576)          */
5577)         function class_filepointer(location, filename) {
5578)             this.location = location;
5579)             this.filename = filename;
5580)         }
5581)         /**
5582)          * @author fenris
5583)          */
5584)         class_filepointer.prototype.normalize = function () {
5585)             return (new class_filepointer(this.location.normalize(), this.filename));
5586)         };
5587)         /**
5588)          * @author fenris
5589)          */
5590)         class_filepointer.prototype.foo = function (filepointer) {
5591)             return (new class_filepointer(this.location.extend(filepointer.location.chain), filepointer.filename));
5592)         };
5593)         /**
5594)          * @desc [accessor]
5595)          * @author fenris
5596)          */
5597)         class_filepointer.prototype.relocate = function (location) {
5598)             return (new class_filepointer(this.location.relocate(location), this.filename));
5599)         };
5600)         /**
5601)          * @author fenris
5602)          */
5603)         class_filepointer.prototype.as_string = function (system) {
5604)             if (system === void 0) { system = "linux"; }
5605)             return (this.location.as_string(system) /* + "/"*/ + ((this.filename == null) ? "" : this.filename));
5606)         };
5607)         /**
5608)          * @author fenris
5609)          */
5610)         class_filepointer.prototype.toString = function () {
5611)             return this.as_string();
5612)         };
5613)         return class_filepointer;
5614)     }());
5615)     lib_path.class_filepointer = class_filepointer;
5616)     /**
5617)      * @author fenris
5618)      */
5619)     function filepointer_read(str, system) {
5620)         if (system === void 0) { system = "linux"; }
5621)         var splitter = lib_path.class_chain.splitter(system);
5622)         var parts = str.split(splitter);
5623)         var last = parts[parts.length - 1];
5624)         if (last == "") {
5625)             return (new class_filepointer(lib_path.location_read(parts.join(splitter), system), null));
5626)         }
5627)         else {
5628)             return (new class_filepointer(lib_path.location_read(parts.slice(0, parts.length - 1).join(splitter), system), last));
5629)         }
5630)     }
5631)     lib_path.filepointer_read = filepointer_read;
5632) })(lib_path || (lib_path = {}));
5633) ///<reference path="../../call/build/logic-decl.d.ts"/>
5634) var lib_file;
5635) (function (lib_file) {
5636)     /**
5637)      * @author fenris
5638)      */
5639)     class class_file_abstract {
5640)         /**
5641)          * @desc reads a json file
5642)          * @author fenris
5643)          */
5644)         read_json(path) {
5645)             return ((resolve, reject) => {
5646)                 lib_call.executor_chain({}, [
5647)                     state => (resolve_, reject_) => {
5648)                         this.read(path)(content => {
5649)                             state.content = content;
5650)                             resolve_(state);
5651)                         }, reject_);
5652)                     },
5653)                     state => (resolve_, reject_) => {
5654)                         let error;
5655)                         try {
5656)                             state.data = JSON.parse(state.content);
5657)                             error = null;
5658)                         }
5659)                         catch (exception) {
5660)                             error = new class_error("invalid json '" + path + "'", [exception]);
5661)                         }
5662)                         if (error == null) {
5663)                             resolve_(state);
5664)                         }
5665)                         else {
5666)                             reject_(error);
5667)                         }
5668)                     },
5669)                 ])(state => resolve(state.data), reject);
5670)             });
5671)         }
5672)         /**
5673)          * @desc writes a json file
5674)          * @author fenris
5675)          */
5676)         write_json(path, data) {
5677)             return this.write(path, JSON.stringify(data, undefined, "\t"));
5678)         }
5679)     }
5680)     lib_file.class_file_abstract = class_file_abstract;
5681) })(lib_file || (lib_file = {}));
5682) ///<reference path="../../call/build/logic-decl.d.ts"/>
5683) var lib_file;
5684) (function (lib_file) {
5685)     /**
5686)      * @author fenris
5687)      */
5688)     class class_file_node extends lib_file.class_file_abstract {
5689)         /**
5690)          * @author maspr
5691)          */
5692)         determine_handler(path) {
5693)             if (/^https?:\/\//.test(path)) {
5694)                 return "http";
5695)             }
5696)             else {
5697)                 return "file";
5698)             }
5699)         }
5700)         /**
5701)          * @override
5702)          * @author fenris,maspr
5703)          * @todo clear up if http(s)-handling belongs here or not
5704)          */
5705)         read(path, skip_error = false) {
5706)             switch (this.determine_handler(path)) {
5707)                 case "file":
5708)                     {
5709)                         let nm_fs = require("fs");
5710)                         return ((resolve, reject) => {
5711)                             nm_fs.readFile(path, {
5712)                                 "encoding": "utf8",
5713)                                 "flag": "r",
5714)                             }, (error, content) => {
5715)                                 if (error == null) {
5716)                                     resolve(content);
5717)                                 }
5718)                                 else {
5719)                                     reject(error);
5720)                                 }
5721)                             });
5722)                         });
5723)                     }
5724)                     break;
5725)                 case "http":
5726)                     {
5727)                         return (resolve, reject) => {
5728)                             let nm_http = require("http");
5729)                             let nm_https = require("https");
5730)                             let nm_url = require("url");
5731)                             let parsed_url = nm_url.parse(path, false, true);
5732)                             let client = (parsed_url.protocol == "https:") ? nm_https : nm_http;
5733)                             let default_port = ((parsed_url.protocol == "https:") ? 443 : 80);
5734)                             let options = {
5735)                                 hostname: parsed_url.hostname,
5736)                                 port: parsed_url.port || default_port,
5737)                                 path: parsed_url.path,
5738)                                 method: "GET"
5739)                             };
5740)                             let req = client.request(options, (res) => {
5741)                                 let data = ""; // @todo
5742)                                 res.on("data", (chunk) => {
5743)                                     data += chunk;
5744)                                 });
5745)                                 res.on("end", () => {
5746)                                     resolve(data);
5747)                                 });
5748)                             });
5749)                             req.end();
5750)                             req.on("error", (error) => {
5751)                                 reject(error);
5752)                             });
5753)                         };
5754)                     }
5755)                     break;
5756)                 default: {
5757)                     return ((resolve, reject) => reject(new Error("unhandled protocol")));
5758)                 }
5759)             }
5760)         }
5761)         /**
5762)          * @override
5763)          * @author fenris
5764)          */
5765)         write(path, content) {
5766)             let nm_fs = require("fs");
5767)             return ((resolve, reject) => {
5768)                 nm_fs.writeFile(path, content, {
5769)                     "encoding": "utf8",
5770)                     "flag": "w",
5771)                 }, (error) => {
5772)                     if (error == null) {
5773)                         resolve(undefined);
5774)                     }
5775)                     else {
5776)                         reject(error);
5777)                     }
5778)                 });
5779)             });
5780)         }
5781)     }
5782)     lib_file.class_file_node = class_file_node;
5783) })(lib_file || (lib_file = {}));
5784) ///<reference path="../../call/build/logic-decl.d.ts"/>
5785) var lib_file;
5786) (function (lib_file) {
5787)     /**
5788)      * @author fenris
5789)      * @todo move to a dedicated lib (e.g. "http", "transport", etc.)
5790)      */
5791)     function ajax({ "target": target /*: string*/, "data": data /*: {[key : string] : string}*/ = null, "method": method /* : string*/ = "GET" }) {
5792)         method = method.toLowerCase();
5793)         return ((resolve, reject) => {
5794)             let datastring = ((data == null) ? null : Object.keys(data).map(key => `${key}=${data[key]}`).join("&"));
5795)             let suffix = ((method == "get") ? ("?" + datastring) : "");
5796)             let sending = ((method == "get") ? null : datastring);
5797)             let request = new XMLHttpRequest();
5798)             request.open(method.toUpperCase(), target + suffix, true);
5799)             request.onreadystatechange = function () {
5800)                 if (request.readyState === 4) {
5801)                     if (request.status === 200) {
5802)                         resolve(request.responseText);
5803)                     }
5804)                     else {
5805)                         reject(new Error("XMLHttpRequest failed"));
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

5807)                 }
5808)             };
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

5809)             request.send(sending);
5810)         });
5811)     }
5812)     /**
5813)      * @author fenris
5814)      */
5815)     class class_file_web extends lib_file.class_file_abstract {
5816)         /**
5817)          * @override
5818)          * @author fenris
5819)          */
5820)         read(path, skip_error = false) {
5821)             return ((resolve, reject) => {
5822)                 ajax({
5823)                     "target": path,
5824)                     "method": "GET",
5825)                 })(resolve, reason => (skip_error ? resolve(null) : reject(reason)));
5826)             });
Christian Fraß update

Christian Fraß authored 6 years ago

5827)         }
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

5828)         /**
5829)          * @override
5830)          * @author fenris
5831)          */
5832)         write(path, content) {
5833)             return ((resolve, reject) => {
5834)                 reject(new Error("not implemented / not possible"));
5835)             });
5836)         }
5837)     }
5838)     lib_file.class_file_web = class_file_web;
5839) })(lib_file || (lib_file = {}));
5840) ///<reference path="../../base/build/logic-decl.d.ts"/>
5841) ///<reference path="../../call/build/logic-decl.d.ts"/>
5842) var lib_file;
5843) (function (lib_file) {
5844)     /**
5845)      * @desc selects the implementation which fits for the detected environment
5846)      * @author fenris
5847)      */
5848)     function auto() {
5849)         let environment = lib_base.environment();
5850)         switch (environment) {
5851)             case "node": {
5852)                 return (new lib_file.class_file_node());
5853)                 break;
5854)             }
5855)             case "web": {
5856)                 return (new lib_file.class_file_web());
5857)                 break;
5858)             }
5859)             default: {
5860)                 throw (new Error(`no implementation for environment '${environment}'`));
5861)                 break;
5862)             }
5863)         }
5864)     }
5865)     lib_file.auto = auto;
5866)     /**
5867)      * @author fenris
5868)      */
5869)     class class_file extends lib_file.class_file_abstract {
5870)         /**
5871)          * @author fenris
5872)          */
5873)         constructor() {
5874)             super();
5875)             this.core = auto();
5876)         }
5877)         /**
5878)          * @override
5879)          * @author fenris
5880)          */
5881)         read(path, skip_error = false) {
5882)             return this.core.read(path, skip_error);
Christian Fraß update

Christian Fraß authored 6 years ago

5883)         }
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

5884)         /**
5885)          * @override
5886)          * @author fenris
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

5887)          */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

5888)         write(path, content) {
5889)             return this.core.write(path, content);
5890)         }
Christian Fraß update

Christian Fraß authored 6 years ago

5891)     }
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

5892)     lib_file.class_file = class_file;
5893)     /**
5894)      * @author fenris
5895)      */
5896)     var instance = auto();
5897)     /**
5898)      * @author fenris
5899)      */
5900)     function read(path, skip_error = false) {
5901)         return instance.read(path, skip_error);
5902)     }
5903)     lib_file.read = read;
5904)     /**
5905)      * @author fenris
5906)      */
5907)     function write(path, content) {
5908)         return instance.write(path, content);
5909)     }
5910)     lib_file.write = write;
5911)     /**
5912)      * @author fenris
5913)      */
5914)     function read_json(path) {
5915)         return instance.read_json(path);
5916)     }
5917)     lib_file.read_json = read_json;
5918)     /**
5919)      * @author fenris
5920)      */
5921)     function write_json(path, data) {
5922)         return instance.write_json(path, data);
5923)     }
5924)     lib_file.write_json = write_json;
5925) })(lib_file || (lib_file = {}));
5926) var lib_dot;
5927) (function (lib_dot) {
5928)     /**
5929)      * @author fenris
5930)      */
5931)     function make_line(head, attributes) {
5932)         let list = ((object => {
5933)             let list = [];
5934)             Object.keys(object).forEach(key => (list.push({ "key": key, "value": object[key] })));
5935)             return list;
5936)         })(attributes));
5937)         let attributes_ = list
5938)             .filter(entry => (entry.value != null))
5939)             .map(entry => `${entry.key}="${entry.value}"`)
5940)             .join(", ");
5941)         return (`${head} [${attributes_}];`);
5942)     }
5943)     /**
5944)      * @author fenris
5945)      */
5946)     function format_line(line) {
5947)         return `\t${line}\n`;
5948)     }
5949)     /**
5950)      * @author fenris
5951)      */
5952)     function format_lines(lines) {
5953)         return lines.map(format_line).join("");
5954)     }
5955)     /**
5956)      * @author fenris
5957)      */
5958)     function generate_graph(graphdefinition) {
5959)         let attributes = {};
5960)         if (graphdefinition.fontname != undefined) {
5961)             attributes["fontname"] = graphdefinition.fontname;
5962)         }
5963)         if (graphdefinition.dimensions != undefined) {
5964)             attributes["dimen"] = graphdefinition.dimensions.toFixed(0);
5965)         }
5966)         if (graphdefinition.bgcolor != undefined) {
5967)             attributes["bgcolor"] = graphdefinition.bgcolor;
5968)         }
5969)         return format_lines([make_line("graph", attributes)]
5970)             .concat([]));
5971)     }
5972)     /**
5973)      * @author fenris
5974)      */
5975)     function generate_nodes(nodedefinition) {
5976)         return format_lines([make_line("node", nodedefinition.head)]
5977)             .concat(nodedefinition.list.map(node => make_line(node.id, node.attributes))));
5978)     }
5979)     /**
5980)      * @author fenris
5981)      */
5982)     function generate_edges(edgedefinition, directed) {
5983)         let connector = (directed ? "->" : "--");
5984)         return format_lines([make_line("edge", edgedefinition.head)]
5985)             .concat(edgedefinition.list.map(edge => make_line(`${edge.id_from} ${connector} ${edge.id_to}`, edge.attributes))));
5986)     }
5987)     /**
5988)      * @author fenris
5989)      */
5990)     function generate({ "name": name = null, "directed": directed = true, "common": graphdefinition = {}, "nodes": nodedefinition, "edges": edgedefinition } = {}) {
5991)         let output = "";
5992)         output += ((directed ? "digraph" : "graph") + ((name == null) ? "" : (" " + name)) + "\n");
5993)         output += `{\n`;
5994)         output += generate_graph(graphdefinition);
5995)         output += `\t\n`;
5996)         output += generate_nodes(nodedefinition);
5997)         output += `\t\n`;
5998)         output += generate_edges(edgedefinition, directed);
5999)         output += `}\n`;
6000)         return output;
6001)     }
6002)     lib_dot.generate = generate;
6003) })(lib_dot || (lib_dot = {}));
Christian Fraß update

Christian Fraß authored 6 years ago

6004) var __extends = (this && this.__extends) || (function () {
6005)     var extendStatics = Object.setPrototypeOf ||
6006)         ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6007)         function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
6008)     return function (d, b) {
6009)         extendStatics(d, b);
6010)         function __() { this.constructor = d; }
6011)         d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
6012)     };
6013) })();
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

6014) var lib_structures;
6015) (function (lib_structures) {
Christian Fraß update

Christian Fraß authored 6 years ago

6016)     /**
6017)      * @author fenris
6018)      */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

6019)     var class_pair = (function () {
6020)         /**
6021)          * @author fenris
6022)          */
6023)         function class_pair(first, second) {
6024)             this.first = first;
6025)             this.second = second;
Christian Fraß update

Christian Fraß authored 6 years ago

6026)         }
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

6027)         /**
6028)          * @desc [accessor] [getter]
6029)          * @author fenris
6030)          */
6031)         class_pair.prototype.first_get = function () {
6032)             return this.first;
6033)         };
6034)         /**
6035)          * @desc [accessor] [getter]
6036)          * @author fenris
6037)          */
6038)         class_pair.prototype.second_get = function () {
6039)             return this.second;
6040)         };
6041)         /**
6042)          * @desc [mutator] [setter]
6043)          * @author fenris
6044)          */
6045)         class_pair.prototype.first_set = function (first) {
6046)             this.first = first;
6047)         };
6048)         /**
6049)          * @desc [mutator] [setter]
6050)          * @author fenris
6051)          */
6052)         class_pair.prototype.second_set = function (second) {
6053)             this.second = second;
6054)         };
6055)         /**
6056)          * @desc [accessor]
6057)          * @author fenris
6058)          */
6059)         class_pair.prototype.swap = function () {
6060)             return (new class_pair(this.second, this.first));
6061)         };
6062)         /**
6063)          * @desc [accessor]
6064)          * @author fenris
6065)          */
6066)         class_pair.prototype.transform = function (transform_first, transform_second) {
6067)             return (new class_pair(transform_first(this.first), transform_second(this.second)));
6068)         };
6069)         /**
6070)          * @desc [accessor] [implementation]
6071)          * @author fenris
6072)          */
6073)         class_pair.prototype._clone = function () {
6074)             return (new class_pair(instance_clone(this.first), instance_clone(this.second)));
6075)         };
6076)         /**
6077)          * @desc [accessor] [implementation]
6078)          * @author fenris
6079)          */
6080)         class_pair.prototype._hash = function () {
6081)             return ("pair_" + instance_hash(this.first) + "_" + instance_hash(this.second) + "");
6082)         };
6083)         /**
6084)          * @desc [accessor] [implementation]
6085)          * @author fenris
6086)          */
6087)         class_pair.prototype._collate = function (pair) {
6088)             return (instance_collate(this.first, pair.first)
6089)                 &&
6090)                     instance_collate(this.second, pair.second));
6091)         };
6092)         /**
6093)          * @desc [accessor] [implementation]
6094)          * @author fenris
6095)          */
6096)         class_pair.prototype._show = function () {
6097)             return ("(" + instance_show(this.first) + "," + instance_show(this.second) + ")");
6098)         };
6099)         return class_pair;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6100)     }());
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

6101)     lib_structures.class_pair = class_pair;
6102) })(lib_structures || (lib_structures = {}));
6103) var lib_structures;
6104) (function (lib_structures) {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6105)     /**
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

6107)      */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

6109)         /**
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

6111)          */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

6112)         function class_set(elements_, equality /*<type_element>*/) {
6113)             if (elements_ === void 0) { elements_ = []; }
6114)             if (equality === void 0) { equality = instance_collate; } /*<type_element>*/
6115)             var _this = this;
6116)             this.elements = [];
6117)             this.equality = equality;
6118)             elements_.forEach(function (element) { return _this.add(element); });
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6119)         }
6120)         /**
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

6121)          * @desc [accessor]
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

6123)          */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

6124)         class_set.prototype.size = function () {
6125)             return this.elements.length;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6126)         };
6127)         /**
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

6128)          * @desc [accessor]
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

6130)          */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

6131)         class_set.prototype.has = function (element) {
6132)             var _this = this;
6133)             return this.elements.some(function (element_) { return _this.equality(element, element_); });
6134)         };
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6135)         /**
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

6136)          * @desc [mutator]
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

6138)          */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

6139)         class_set.prototype.add = function (element) {
6140)             if (!this.has(element)) {
6141)                 this.elements.push(element);
6142)             }
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6143)         };
6144)         /**
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

6145)          * @desc [mutator]
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

6147)          */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

6148)         class_set.prototype.pop = function () {
6149)             if (this.elements.length == 0) {
6150)                 return (new class_nothing());
6151)             }
6152)             else {
6153)                 return (new class_just(this.elements.pop()));
6154)             }
6155)         };
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6156)         /**
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

6157)          * @desc [accessor]
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

6159)          */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

6160)         class_set.prototype.forEach = function (function_) {
6161)             this.elements.forEach(function (element) { return function_(element); });
6162)         };
6163)         /**
6164)          * @desc [accessor]
6165)          * @author fenris
6166)          */
6167)         class_set.prototype.map = function (transformator) {
6168)             return (new class_set(this.elements.map(transformator)));
6169)         };
6170)         /**
6171)          * @desc [accessor]
6172)          * @author fenris
6173)          */
6174)         class_set.prototype.filter = function (predicate) {
6175)             return (new class_set(this.elements.filter(predicate)));
6176)         };
6177)         /**
6178)          * @desc [accessor]
6179)          * @author fenris
6180)          */
6181)         class_set.prototype.dump = function () {
6182)             return this.elements;
6183)         };
6184)         /**
6185)          * @desc [accessor]
6186)          * @author fenris
6187)          */
6188)         class_set.prototype.subset = function (set) {
Christian Fraß update

Christian Fraß authored 6 years ago

6189)             var _this = this;
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

6190)             return set.elements.every(function (element) { return _this.has(element); });
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6191)         };
6192)         /**
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

6194)          * @author fenris
6195)          */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

6196)         class_set.prototype.superset = function (set) {
6197)             return this.elements.every(function (element) { return set.has(element); });
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6198)         };
6199)         /**
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

6201)          * @author fenris
6202)          */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

6203)         class_set.prototype.equals = function (set) {
6204)             return (this.subset(set) && this.superset(set));
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6205)         };
6206)         /**
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

6208)          * @author fenris
6209)          */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

6210)         class_set.prototype.toString = function () {
6211)             return ("{" + this.elements.map(instance_show /*<type_element>*/).join(",") + "}");
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6212)         };
6213)         /**
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

6215)          * @author fenris
6216)          */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

6217)         class_set.prototype.empty = function () {
6218)             return (this.elements.length == 0);
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6219)         };
6220)         /**
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

6222)          * @author fenris
6223)          */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

6224)         class_set.prototype.union = function (set) {
6225)             var set_ = new class_set([], this.equality);
6226)             this.elements.forEach(function (element) { return set_.add(element); });
6227)             set.elements.forEach(function (element) { return set_.add(element); });
6228)             return set_;
6229)         };
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6230)         /**
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

6232)          * @author fenris
6233)          */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

6234)         class_set.prototype.intersection = function (set) {
6235)             var set_ = new class_set([], this.equality);
6236)             this.elements
6237)                 .filter(function (element) { return set.has(element); })
6238)                 .forEach(function (element) { return set_.add(element); });
6239)             return set_;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6240)         };
6241)         /**
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

6243)          * @author fenris
6244)          */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

6245)         class_set.prototype.difference = function (set) {
6246)             var set_ = new class_set([], this.equality);
6247)             this.elements
6248)                 .filter(function (element) { return !set.has(element); })
6249)                 .forEach(function (element) { return set_.add(element); });
6250)             return set_;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6251)         };
6252)         /**
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

6254)          * @author fenris
6255)          */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

6256)         class_set.prototype.symmetric_difference = function (set) {
6257)             return this.difference(set).union(set.difference(this));
6258)         };
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6259)         /**
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

6261)          * @author fenris
6262)          */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

6263)         class_set.prototype._collate = function (set) {
6264)             return this.equals(set);
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6265)         };
6266)         /**
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

6268)          * @author fenris
6269)          */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

6270)         class_set.prototype._show = function () {
6271)             return this.toString();
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6272)         };
6273)         /**
6274)          * @author fenris
6275)          */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

6276)         class_set.union_all = function (sets) {
6277)             return (sets.reduce(function (x, y) { return ((x == null) ? y : x.union(y)); }, null));
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6278)         };
6279)         /**
6280)          * @author fenris
6281)          */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

6282)         class_set.intersection_all = function (sets) {
6283)             return (sets.reduce(function (x, y) { return ((x == null) ? y : x.intersection(y)); }, null));
6284)         };
6285)         return class_set;
6286)     }());
6287)     lib_structures.class_set = class_set;
6288) })(lib_structures || (lib_structures = {}));
6289) var lib_structures;
6290) (function (lib_structures) {
6291)     /**
6292)      * @author fenris
6293)      */
6294)     var class_map_abstract = (function () {
6295)         function class_map_abstract() {
6296)         }
6297)         /**
6298)          * @desc [mutator] [syntactic sugar]
6299)          * @author fenris
6300)          */
6301)         class_map_abstract.prototype.del = function (key) {
6302)             return this["delete"](key);
6303)         };
6304)         /**
6305)          * @desc [accessor]
6306)          * @author fenris
6307)          */
6308)         class_map_abstract.prototype.map = function (transformator) {
6309)             var map_ = this.spawn();
6310)             this.forEach(function (value, key) {
6311)                 var value_ = transformator(value);
6312)                 map_.set(key, value_);
6313)             });
6314)             return map_;
6315)         };
6316)         /**
6317)          * @desc [accessor]
6318)          * @author fenris
6319)          */
6320)         class_map_abstract.prototype.filter = function (predicate) {
6321)             var map_ = this.spawn();
6322)             this.forEach(function (value, key) {
6323)                 if (predicate(value)) {
6324)                     map_.set(key, value);
6325)                 }
6326)             });
6327)             return map_;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6328)         };
6329)         /**
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

6331)          * @author fenris
6332)          */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

6333)         class_map_abstract.prototype.pairs = function () {
6334)             var set = new lib_structures.class_set();
6335)             this.forEach(function (value, key) {
6336)                 set.add(new lib_structures.class_pair(key, value));
6337)             });
6338)             return set;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6339)         };
6340)         /**
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

6342)          * @author fenris
6343)          */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

6344)         class_map_abstract.prototype.keys = function () {
6345)             var set = new lib_structures.class_set();
6346)             this.forEach(function (value, key) {
6347)                 set.add(key);
6348)             });
6349)             return set;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6350)         };
6351)         /**
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

6353)          * @author fenris
6354)          */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

6355)         class_map_abstract.prototype.values = function () {
6356)             var set = new lib_structures.class_set();
6357)             this.forEach(function (value, key) {
6358)                 set.add(value);
6359)             });
6360)             return set;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6361)         };
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

6362)         return class_map_abstract;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6363)     }());
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

6364)     lib_structures.class_map_abstract = class_map_abstract;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6365)     /**
6366)      * @author fenris
6367)      */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

6368)     var class_map_simple = (function (_super) {
6369)         __extends(class_map_simple, _super);
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6370)         /**
6371)          * @author fenris
6372)          */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

6373)         function class_map_simple() {
6374)             var _this = _super.call(this) || this;
6375)             _this.object = {};
6376)             return _this;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6377)         }
Christian Fraß update

Christian Fraß authored 6 years ago

6378)         /**
6379)          * @desc [accessor]
6380)          * @author fenris
6381)          */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

6382)         class_map_simple.from_object = function (object) {
6383)             var map = new class_map_simple();
6384)             Object.keys(object).forEach(function (key) { return map.set(key, object[key]); });
6385)             return map;
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

6387)         /**
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

6389)          * @author fenris
6390)          */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

6391)         class_map_simple.prototype.spawn = function () {
6392)             return (new class_map_simple());
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6393)         };
6394)         /**
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

6396)          * @author fenris
6397)          */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

6398)         class_map_simple.prototype.has = function (key) {
6399)             return (key in this.object);
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6400)         };
Christian Fraß update

Christian Fraß authored 6 years ago

6401)         /**
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

6402)          * @override
Christian Fraß update

Christian Fraß authored 6 years ago

6403)          * @author fenris
6404)          */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

6405)         class_map_simple.prototype.get = function (key, strict, fallback) {
6406)             if (this.has(key)) {
6407)                 return this.object[key];
Christian Fraß update

Christian Fraß authored 6 years ago

6408)             }
6409)             else {
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

6410)                 if (strict) {
6411)                     throw (new Error("key not found"));
6412)                 }
6413)                 else {
6414)                     return fallback;
6415)                 }
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

6418)         /**
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

6420)          * @author fenris
6421)          */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

6422)         class_map_simple.prototype.set = function (key, value) {
6423)             this.object[key] = value;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6424)         };
6425)         /**
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

6427)          * @author fenris
6428)          */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

6429)         class_map_simple.prototype.clear = function () {
6430)             this.object = {};
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6431)         };
6432)         /**
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

6433)          * @override
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6434)          * @author fenris
6435)          */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

6436)         class_map_simple.prototype["delete"] = function (key) {
6437)             delete this.object[key];
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

6439)         /**
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

6441)          * @author fenris
6442)          */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

6443)         class_map_simple.prototype.forEach = function (function_) {
6444)             var _this = this;
6445)             Object.keys(this.object).forEach(function (key) {
6446)                 var value = _this.object[key];
6447)                 function_(value, key);
6448)             });
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6449)         };
6450)         /**
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

6452)          * @author fenris
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

6453)          * @todo implement
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6454)          */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

6455)         /*
6456)         public equals(map : class_map_simple<type_value>) : boolean {
6457)             
6458)         }
6459)          */
6460)         /**
6461)          * @desc [accessor]
6462)          * @author fenris
6463)          */
6464)         class_map_simple.prototype.toString = function () {
6465)             return ("{" + this.pairs().map(function (pair) { return instance_show(pair.first_get()) + " -> " + instance_show(pair.second_get()); }).dump().join(", ") + "}");
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6466)         };
6467)         /**
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

6469)          * @author fenris
6470)          */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

6471)         class_map_simple.prototype._clone = function () {
6472)             return (this.map(function (value) { return instance_clone(value); }));
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6473)         };
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

6474)         /**
6475)          * @desc [accessor] [implementation]
6476)          * @author fenris
6477)          */
6478)         class_map_simple.prototype._show = function () {
6479)             return this.toString();
6480)         };
6481)         return class_map_simple;
6482)     }(class_map_abstract));
6483)     lib_structures.class_map_simple = class_map_simple;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6484)     /**
6485)      * @author fenris
6486)      */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

6487)     var class_map_equality = (function (_super) {
6488)         __extends(class_map_equality, _super);
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6489)         /**
6490)          * @author fenris
6491)          */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

6492)         function class_map_equality(collate /*<type_key>*/) {
6493)             if (collate === void 0) { collate = instance_collate; } /*<type_key>*/
6494)             var _this = _super.call(this) || this;
6495)             _this.pairs_ = [];
6496)             _this.collate = collate;
6497)             return _this;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6498)         }
6499)         /**
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

6500)          * @override
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6501)          * @author fenris
6502)          */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

6503)         class_map_equality.prototype.spawn = function () {
6504)             return (new class_map_equality(this.collate));
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

6506)         /**
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

6508)          * @author fenris
6509)          */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

6510)         class_map_equality.prototype.has = function (key) {
6511)             var _this = this;
6512)             return this.pairs_.some(function (pair) { return _this.collate(pair.first_get(), key); });
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6513)         };
Christian Fraß update

Christian Fraß authored 6 years ago

6514)         /**
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

6515)          * @override
Christian Fraß update

Christian Fraß authored 6 years ago

6516)          * @author fenris
6517)          */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

6518)         class_map_equality.prototype.get = function (key, strict, fallback) {
6519)             var _this = this;
6520)             if (strict === void 0) { strict = false; }
6521)             if (fallback === void 0) { fallback = null; }
6522)             var value;
6523)             var found = this.pairs_.some(function (pair) {
6524)                 if (_this.collate(pair.first_get(), key)) {
6525)                     value = pair.second_get();
6526)                     return true;
6527)                 }
6528)                 else {
6529)                     return false;
6530)                 }
6531)             });
6532)             if (!found) {
6533)                 if (strict) {
6534)                     throw (new Error("key not found"));
6535)                 }
6536)                 else {
6537)                     value = fallback;
6538)                 }
6539)             }
6540)             return value;
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

6542)         /**
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

6544)          * @author fenris
6545)          */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

6546)         class_map_equality.prototype.set = function (key, value) {
6547)             var _this = this;
6548)             var found = this.pairs_.some(function (pair) {
6549)                 if (_this.collate(pair.first_get(), key)) {
6550)                     pair.second_set(value);
6551)                     return true;
6552)                 }
6553)                 else {
6554)                     return false;
6555)                 }
6556)             });
6557)             if (!found) {
6558)                 this.pairs_.push(new lib_structures.class_pair(key, value));
6559)             }
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6560)         };
6561)         /**
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

6563)          * @author fenris
6564)          */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

6565)         class_map_equality.prototype.clear = function () {
6566)             this.pairs_ = [];
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6567)         };
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

6568)         /**
6569)          * @override
6570)          * @author fenris
6571)          */
6572)         class_map_equality.prototype["delete"] = function (key) {
6573)             var _this = this;
6574)             var index;
6575)             var found = this.pairs_.some(function (pair, index_) {
6576)                 if (_this.collate(pair.first_get(), key)) {
6577)                     index = index_;
6578)                     return true;
6579)                 }
6580)                 else {
6581)                     return false;
6582)                 }
6583)             });
6584)             if (found) {
6585)                 this.pairs_.splice(index, 1);
6586)             }
6587)         };
6588)         /**
6589)          * @desc [accessor]
6590)          * @author fenris
6591)          */
6592)         class_map_equality.prototype.forEach = function (function_) {
6593)             this.pairs_.forEach(function (pair) { return function_(pair.second_get(), pair.first_get()); });
6594)         };
6595)         return class_map_equality;
6596)     }(class_map_abstract));
6597)     lib_structures.class_map_equality = class_map_equality;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6598)     /**
6599)      * @author fenris
6600)      */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

6601)     var class_map = (function (_super) {
6602)         __extends(class_map, _super);
6603)         function class_map() {
6604)             return _super !== null && _super.apply(this, arguments) || this;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6605)         }
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

6606)         return class_map;
6607)     }(class_map_equality));
6608)     lib_structures.class_map = class_map;
6609) })(lib_structures || (lib_structures = {}));
6610) var lib_structures;
6611) (function (lib_structures) {
6612)     /**
6613)      * @author fenris
6614)      */
6615)     var class_store = (function () {
6616)         function class_store() {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6617)         }
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

6618)         return class_store;
6619)     }());
6620)     lib_structures.class_store = class_store;
6621) })(lib_structures || (lib_structures = {}));
6622) var lib_structures;
6623) (function (lib_structures) {
Christian Fraß update

Christian Fraß authored 6 years ago

6624)     /**
6625)      * @author fenris
6626)      */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

6627)     var class_stack = (function (_super) {
6628)         __extends(class_stack, _super);
Christian Fraß update

Christian Fraß authored 6 years ago

6629)         /**
6630)          * @author fenris
6631)          */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

6632)         function class_stack() {
6633)             var _this = _super.call(this) || this;
6634)             _this.elements = [];
6635)             return _this;
Christian Fraß update

Christian Fraß authored 6 years ago

6636)         }
6637)         /**
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

6638)          * @override
Christian Fraß update

Christian Fraß authored 6 years ago

6639)          * @author fenris
6640)          */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

6641)         class_stack.prototype.size = function () {
6642)             return this.elements.length;
6643)         };
Christian Fraß update

Christian Fraß authored 6 years ago

6644)         /**
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

6645)          * @override
6646)          * @author fenris
Christian Fraß update

Christian Fraß authored 6 years ago

6647)          */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

6648)         class_stack.prototype.scan = function () {
6649)             if (this.size() == 0) {
6650)                 throw (new Error("empty"));
Christian Fraß update

Christian Fraß authored 6 years ago

6651)             }
6652)             else {
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

6653)                 return this.elements[this.elements.length - 1];
Christian Fraß update

Christian Fraß authored 6 years ago

6654)             }
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

6655)         };
Christian Fraß update

Christian Fraß authored 6 years ago

6656)         /**
6657)          * @override
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

6658)          * @author fenris
Christian Fraß update

Christian Fraß authored 6 years ago

6659)          */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

6660)         class_stack.prototype.give = function (element) {
6661)             this.elements.push(element);
6662)         };
Christian Fraß update

Christian Fraß authored 6 years ago

6663)         /**
6664)          * @override
6665)          * @author fenris
6666)          */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

6667)         class_stack.prototype.take = function () {
6668)             var element = this.scan();
6669)             this.elements.pop();
6670)             return element;
6671)         };
6672)         return class_stack;
6673)     }(lib_structures.class_store));
6674)     lib_structures.class_stack = class_stack;
6675) })(lib_structures || (lib_structures = {}));
6676) var lib_structures;
6677) (function (lib_structures) {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6678)     /**
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

6680)      */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

6681)     var class_queue = (function (_super) {
6682)         __extends(class_queue, _super);
Christian Fraß update

Christian Fraß authored 6 years ago

6683)         /**
6684)          * @author fenris
6685)          */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

6686)         function class_queue() {
6687)             var _this = _super.call(this) || this;
6688)             _this.elements = [];
6689)             return _this;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6690)         }
Christian Fraß update

Christian Fraß authored 6 years ago

6691)         /**
6692)          * @override
6693)          * @author fenris
6694)          */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

6695)         class_queue.prototype.size = function () {
6696)             return this.elements.length;
6697)         };
6698)         /**
6699)          * @override
6700)          * @author fenris
6701)          */
6702)         class_queue.prototype.scan = function () {
6703)             if (this.size() == 0) {
6704)                 throw (new Error("empty"));
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6705)             }
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

6706)             else {
6707)                 return this.elements[0];
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6708)             }
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

6709)         };
6710)         /**
6711)          * @override
6712)          * @author fenris
6713)          */
6714)         class_queue.prototype.give = function (element) {
6715)             this.elements.push(element);
6716)         };
6717)         /**
6718)          * @override
6719)          * @author fenris
6720)          */
6721)         class_queue.prototype.take = function () {
6722)             var element = this.scan();
6723)             this.elements.shift();
6724)             return element;
6725)         };
6726)         return class_queue;
6727)     }(lib_structures.class_store));
6728)     lib_structures.class_queue = class_queue;
6729) })(lib_structures || (lib_structures = {}));
6730) var lib_structures;
6731) (function (lib_structures) {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6732)     /**
6733)      * @author fenris
6734)      */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

6735)     var class_graph = (function () {
Christian Fraß update

Christian Fraß authored 6 years ago

6736)         /**
6737)          * @author fenris
6738)          */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

6739)         function class_graph(equality, nodes, edges) {
6740)             if (equality === void 0) { equality = null; }
6741)             if (nodes === void 0) { nodes = []; }
6742)             if (edges === void 0) { edges = []; }
6743)             if (equality == null) {
6744)                 // equality = ((node1, node2) => lib_trait.call("collatable", "collate", {"kind": "auto"}, {"first": node1, "second": node2}));
6745)                 equality = instance_collate /*<type_node>*/;
6746)             }
6747)             this.equality = equality;
6748)             this.nodes = nodes;
6749)             this.edges = edges;
Christian Fraß update

Christian Fraß authored 6 years ago

6750)         }
6751)         /**
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

6752)          * @desc [accessor] [getter]
6753)          * @author fenris
6754)          */
6755)         class_graph.prototype.nodes_get = function () {
6756)             return this.nodes;
6757)         };
6758)         /**
6759)          * @desc [mutator]
6760)          * @author fenris
6761)          */
6762)         class_graph.prototype.add_node = function (node) {
6763)             this.nodes.push(node);
6764)         };
6765)         /**
6766)          * @desc [accessor] [getter]
6767)          * @author fenris
6768)          */
6769)         class_graph.prototype.edges_get = function () {
6770)             return this.edges;
6771)         };
6772)         /**
6773)          * @desc [mutator]
6774)          * @author fenris
6775)          */
6776)         class_graph.prototype.add_edge = function (edge) {
6777)             this.edges.push(edge);
6778)         };
6779)         /**
6780)          * @desc [accessor]
6781)          * @author fenris
6782)          */
6783)         class_graph.prototype.has = function (node) {
6784)             var _this = this;
6785)             return this.nodes.some(function (node_) { return _this.equality(node, node_); });
6786)         };
6787)         /**
6788)          * @desc [accessor]
6789)          * @author fenris
6790)          */
6791)         class_graph.prototype.outgoing = function (node) {
6792)             var _this = this;
6793)             return this.edges.filter(function (edge) { return _this.equality(edge.from, node); });
6794)         };
6795)         /**
6796)          * @desc [accessor]
6797)          * @author fenris
6798)          */
6799)         class_graph.prototype.incoming = function (node) {
6800)             var _this = this;
6801)             return this.edges.filter(function (edge) { return _this.equality(edge.to, node); });
6802)         };
6803)         /**
6804)          * @desc [accessor]
6805)          * @author fenris
6806)          */
6807)         class_graph.prototype.without = function (pivot) {
6808)             var _this = this;
6809)             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))); })));
6810)         };
6811)         /**
6812)          * @desc [accessor] returns the topologic sorting of the nodes (if it exists)
6813)          * @author fenris
6814)          */
6815)         class_graph.prototype.topsort = function () {
6816)             var _this = this;
6817)             var graph = this;
6818)             if (graph.nodes.length == 0) {
6819)                 return [];
6820)             }
6821)             else {
6822)                 var pivot_1;
6823)                 var found = graph.nodes.some(function (node) {
6824)                     var count = graph.edges.filter(function (edge) { return _this.equality(edge.to, node); }).length;
6825)                     if (count == 0) {
6826)                         pivot_1 = node;
6827)                         return true;
6828)                     }
6829)                     else {
6830)                         // console.info("'" + String(node) + "' has " + count.toString() + " incoming edges");
6831)                         return false;
6832)                     }
6833)                 });
6834)                 if (found) {
6835)                     return [pivot_1].concat(graph.without(pivot_1).topsort());
6836)                 }
6837)                 else {
6838)                     throw (new Error("circular dependencies found"));
6839)                 }
6840)             }
6841)         };
6842)         /**
6843)          * @desc [accessor] returns the reduced version of a graph representing an order relation (implicit transitivity)
Christian Fraß update

Christian Fraß authored 6 years ago

6844)          * @author fenris
6845)          */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

6846)         class_graph.prototype.hasse = function () {
6847)             var _this = this;
6848)             return (new class_graph(this.equality, this.nodes, this.edges.filter(function (edge) {
6849)                 var reachable = (_this.outgoing(edge.from).map(function (edge_) { return edge_.to; })
6850)                     .map(function (node) { return _this.outgoing(node).map(function (edge_) { return edge_.to; }); })
6851)                     .reduce(function (x, y) { return x.concat(y); }, []));
6852)                 return (!reachable.some(function (node) { return _this.equality(node, edge.to); }));
6853)             })));
6854)         };
Christian Fraß update

Christian Fraß authored 6 years ago

6855)         /**
6856)          * @author fenris
6857)          */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

6858)         class_graph.prototype.output_dot = function (_a) {
6859)             var _this = this;
6860)             var _b = _a === void 0 ? {} : _a, _c = _b["extract_id"], extract_id = _c === void 0 ? null : _c, _d = _b["extract_label"], extract_label = _d === void 0 ? null : _d;
6861)             var index = function (node) {
6862)                 var i = -1;
6863)                 var found = _this.nodes.some(function (node_, i_) {
6864)                     if (_this.equality(node, node_)) {
6865)                         i = i_;
6866)                         return true;
6867)                     }
6868)                     else {
6869)                         return false;
6870)                     }
6871)                 });
6872)                 return i;
6873)             };
6874)             if (extract_id == null) {
6875)                 // instance_hash
6876)                 extract_id = (function (node) { return index(node).toFixed(0); });
6877)             }
6878)             if (extract_label == null) {
6879)                 extract_label = instance_show;
6880)             }
6881)             var nodeid = function (node) {
6882)                 return ("node_" + extract_id(node));
6883)             };
6884)             return (lib_dot.generate({
6885)                 "common": {
6886)                     "fontname": "Monospace"
6887)                 },
6888)                 "nodes": {
6889)                     "head": {
6890)                         "fontname": "Monospace",
6891)                         "style": "filled",
6892)                         "fillcolor": "0.35+0.6+0.8"
6893)                     },
6894)                     "list": this.nodes_get()
6895)                         .map(function (node, index) {
6896)                         return {
6897)                             "id": nodeid(node),
6898)                             "attributes": {
6899)                                 "label": extract_label(node)
6900)                             }
6901)                         };
6902)                     })
6903)                 },
6904)                 "edges": {
6905)                     "head": {
6906)                         "fontname": "Monospace"
6907)                     },
6908)                     "list": this.edges_get()
6909)                         .map(function (edge, index) {
6910)                         return {
6911)                             "id_from": nodeid(edge.from),
6912)                             "id_to": nodeid(edge.to),
6913)                             "attributes": {}
6914)                         };
6915)                     })
6916)                 }
6917)             }));
6918)         };
6919)         return class_graph;
6920)     }());
6921)     lib_structures.class_graph = class_graph;
6922) })(lib_structures || (lib_structures = {}));
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6923) var lib_args;
6924) (function (lib_args) {
6925)     /**
6926)      * @author fenris
6927)      */
6928)     var class_argument = (function () {
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6929)         /**
6930)          * @author fenris
6931)          */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6932)         function class_argument(_a) {
6933)             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

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

Christian Fraß authored 7 years ago

6935)             this.type = type;
6936)             this.default_ = default_;
6937)             this.info = info;
6938)             this.mode = mode;
6939)             this.kind = kind;
6940)             this.parameters = parameters;
6941)             this.hidden = hidden;
6942)             if (!this.check()) {
6943)                 throw (new Error("invalid argument-setup"));
6944)             }
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6945)         }
6946)         /**
6947)          * @author fenris
6948)          */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

6954)         };
6955)         /**
6956)          * @author fenris
6957)          */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6958)         class_argument.prototype.name_get = function () {
6959)             return this.name;
6960)         };
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6961)         /**
6962)          * @author fenris
6963)          */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

6966)         };
6967)         /**
6968)          * @author fenris
6969)          */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

6972)         };
6973)         /**
6974)          * @author fenris
6975)          */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6976)         class_argument.prototype.kind_get = function () {
6977)             return this.kind;
6978)         };
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6979)         /**
6980)          * @author fenris
6981)          */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6982)         class_argument.prototype.parameters_get = function () {
6983)             return this.parameters;
6984)         };
6985)         /**
6986)          * @author fenris
6987)          */
6988)         class_argument.prototype.hidden_get = function () {
6989)             return this.hidden;
6990)         };
6991)         /**
6992)          * @author fenris
6993)          */
6994)         class_argument.prototype.toString = function () {
6995)             return "<" + this.name + ">";
6996)         };
6997)         /**
6998)          * @author fenris
6999)          */
7000)         class_argument.prototype.indicator_main = function () {
7001)             if (this.kind == "volatile") {
7002)                 return this.parameters["indicators_long"][0];
7003)             }
7004)             else {
7005)                 return null;
7006)             }
7007)         };
7008)         /**
7009)          * @author fenris
7010)          */
7011)         class_argument.prototype.pattern_value = function () {
7012)             switch (this.type) {
7013)                 case "boolean": {
7014)                     return "false|true";
7015)                     break;
7016)                 }
7017)                 case "int": {
7018)                     return "[0-9]+";
7019)                     break;
7020)                 }
7021)                 case "float": {
7022)                     return "\\d*(?:\\.\\d+)?";
7023)                     break;
7024)                 }
7025)                 case "string": {
7026)                     return "\\S+";
7027)                     break;
7028)                 }
7029)                 default: {
7030)                     throw (new Error("unhandled type " + this.type));
7031)                     break;
7032)                 }
7033)             }
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7034)         };
7035)         /**
7036)          * @author fenris
7037)          */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7038)         class_argument.prototype.extract = function (raw) {
7039)             switch (this.type) {
7040)                 case "boolean": {
7041)                     return (raw != "false");
7042)                     break;
7043)                 }
7044)                 case "int": {
7045)                     return parseInt(raw);
7046)                     break;
7047)                 }
7048)                 case "float": {
7049)                     return parseFloat(raw);
7050)                     break;
7051)                 }
7052)                 case "string": {
7053)                     return raw;
7054)                     break;
7055)                 }
7056)                 default: {
7057)                     throw (new Error("unhandled type " + this.type));
7058)                     break;
7059)                 }
7060)             }
7061)         };
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7062)         /**
7063)          * @author fenris
7064)          */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7065)         class_argument.prototype.assign = function (data, raw) {
7066)             var value = this.extract(raw);
7067)             switch (this.mode) {
7068)                 case "replace": {
7069)                     data[this.name] = value;
7070)                     break;
7071)                 }
7072)                 case "accumulate": {
7073)                     /*
7074)                     if (! (this.name in data)) {
7075)                         data[this.name] = [];
7076)                     }
7077)                      */
7078)                     data[this.name].push(value);
7079)                     break;
7080)                 }
7081)                 default: {
7082)                     throw (new Error("unhandled mode " + this.mode));
7083)                 }
7084)             }
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7085)         };
7086)         /**
7087)          * @author fenris
7088)          */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7089)         class_argument.prototype.make = function (data) {
7090)             var value = data[this.name];
7091)             return value.toString();
7092)         };
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7093)         /**
7094)          * @author fenris
7095)          */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7096)         class_argument.prototype.generate_help = function () {
7097)             var output = "";
7098)             {
7099)                 var line = "";
7100)                 line += "\t";
7101)                 line += "<" + this.name + ">";
7102)                 line += "\n";
7103)                 output += line;
7104)             }
7105)             {
7106)                 var line = "";
7107)                 line += "\t\t";
7108)                 var infotext = ((this.info == null) ? "(no info available)" : this.info);
7109)                 line += infotext;
7110)                 if ((this.type != "boolean") && (this.default_ != null)) {
7111)                     line += "; default: " + this.default_.toString();
7112)                 }
7113)                 line += "\n";
7114)                 output += line;
7115)             }
7116)             return output;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

7120)     lib_args.class_argument = class_argument;
7121) })(lib_args || (lib_args = {}));
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

7125)     /**
7126)      * @author fenris
7127)      */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7128)     var settings = {
7129)         "environment": {
7130)             "cli": {
7131)                 "symbols": {
7132)                     "delimiter": " ",
7133)                     "prefix": "--",
7134)                     "assignment": "="
7135)                 }
7136)             },
7137)             "url": {
7138)                 "symbols": {
7139)                     "delimiter": "&",
7140)                     "prefix": "",
7141)                     "assignment": "="
7142)                 }
7143)             }
7144)         }
7145)     };
7146)     /**
7147)      * @author fenris
7148)      */
7149)     lib_args.verbosity = 0;
7150)     /**
7151)      * @author fenris
7152)      * @todo check validity
7153)      */
7154)     var class_handler = (function () {
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7155)         /**
7156)          * @author fenris
7157)          */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

7160)         }
7161)         /**
7162)          * @author fenris
7163)          */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

7166)         };
7167)         /**
7168)          * @author fenris
7169)          */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7170)         class_handler.prototype.read = function (environment, input, data) {
7171)             var _this = this;
7172)             if (data === void 0) { data = {}; }
7173)             switch (environment) {
7174)                 case "cli":
7175)                 case "url": {
7176)                     // default values
7177)                     {
7178)                         this.arguments_.forEach(function (argument) {
7179)                             data[argument.name_get()] = argument.default_get();
7180)                         });
7181)                     }
7182)                     // preprocessing
7183)                     {
7184)                         // short indicators (lil hacky ...)
7185)                         {
7186)                             if (environment == "cli") {
7187)                                 this.filter("volatile").forEach(function (argument) {
7188)                                     // console.info(argument.parameters_get()["indicators_short"].join("|"));
7189)                                     var pattern_from = "";
7190)                                     {
7191)                                         pattern_from += "(?:^|" + settings["environment"][environment]["symbols"]["delimiter"] + ")";
7192)                                         pattern_from += "-" + argument.parameters_get()["indicators_short"].join("|");
7193)                                         pattern_from += "(?:$|" + settings["environment"][environment]["symbols"]["delimiter"] + ")";
7194)                                     }
7195)                                     var pattern_to = "";
7196)                                     {
7197)                                         pattern_to += settings["environment"][environment]["symbols"]["delimiter"];
7198)                                         pattern_to += settings["environment"][environment]["symbols"]["prefix"];
7199)                                         pattern_to += argument.indicator_main();
Christian Fraß update

Christian Fraß authored 6 years ago

7200)                                         if (argument.type_get() == "boolean") {
7201)                                             pattern_to += settings["environment"][environment]["symbols"]["delimiter"];
7202)                                         }
7203)                                         else {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7204)                                             pattern_to += settings["environment"][environment]["symbols"]["assignment"];
7205)                                         }
7206)                                     }
7207)                                     var result = input.replace(new RegExp(pattern_from, "g"), pattern_to);
7208)                                     if (lib_args.verbosity >= 3)
7209)                                         console.info("--", "replacing \"" + pattern_from + "\" by \"" + pattern_to + "\" in \"" + input + "\" to \"" + result + "\"");
7210)                                     input = result;
7211)                                 });
7212)                             }
7213)                         }
7214)                         if (lib_args.verbosity >= 3)
7215)                             console.info("--", "input is now \"" + input + "\"");
7216)                     }
7217)                     // parsing
7218)                     {
7219)                         var parts = input
7220)                             .split(settings["environment"][environment]["symbols"]["delimiter"])
7221)                             .filter(function (x) { return (x != ""); });
7222)                         var index_expected_1 = 0;
7223)                         parts.forEach(function (part) {
7224)                             if (lib_args.verbosity >= 2)
7225)                                 console.info("--", "analyzing \"" + part + "\"");
7226)                             var found = [
7227)                                 function () {
7228)                                     if (lib_args.verbosity >= 3)
7229)                                         console.info("--", "probing as volatile");
7230)                                     return (_this.filter("volatile")
7231)                                         .some(function (argument) {
7232)                                         if (lib_args.verbosity >= 4)
7233)                                             console.info("--", "trying as " + argument.toString());
7234)                                         var pattern = "";
7235)                                         {
7236)                                             var pattern_front = "";
7237)                                             pattern_front += "" + settings["environment"][environment]["symbols"]["prefix"];
7238)                                             pattern_front += "(?:" + argument.parameters_get()["indicators_long"].join("|") + ")";
7239)                                             pattern += pattern_front;
7240)                                         }
7241)                                         {
7242)                                             var pattern_back = "";
7243)                                             pattern_back += "" + settings["environment"][environment]["symbols"]["assignment"];
7244)                                             pattern_back += "(" + argument.pattern_value() + ")";
7245)                                             if (argument.type_get() == "boolean") {
7246)                                                 pattern_back = "(?:" + pattern_back + ")?";
7247)                                             }
7248)                                             pattern += pattern_back;
7249)                                         }
7250)                                         if (lib_args.verbosity >= 5)
7251)                                             console.info("--", "pattern: \"" + pattern + "\"");
7252)                                         var regexp = new RegExp(pattern);
7253)                                         var matching = regexp.exec(part);
7254)                                         if (lib_args.verbosity >= 5)
7255)                                             console.info("--", "matching:", matching);
7256)                                         if (matching == null) {
7257)                                             return false;
7258)                                         }
7259)                                         else {
7260)                                             argument.assign(data, matching[1]);
7261)                                             return true;
7262)                                         }
7263)                                     }));
7264)                                 },
7265)                                 function () {
7266)                                     if (lib_args.verbosity >= 3)
7267)                                         console.info("--", "probing as positional");
7268)                                     var positional = _this.filter("positional");
7269)                                     if (index_expected_1 >= positional.length) {
7270)                                         if (lib_args.verbosity >= 4)
7271)                                             console.info("--", "no positional arguments left");
7272)                                         return false;
7273)                                     }
7274)                                     else {
7275)                                         var argument = positional[index_expected_1];
7276)                                         if (lib_args.verbosity >= 4)
7277)                                             console.info("--", "trying as " + argument.toString());
7278)                                         var pattern = "";
7279)                                         {
7280)                                             var pattern_back = "";
7281)                                             pattern_back += "(" + argument.pattern_value() + ")";
7282)                                             pattern += pattern_back;
7283)                                         }
7284)                                         if (lib_args.verbosity >= 5)
7285)                                             console.info("--", "pattern: \"" + pattern + "\"");
7286)                                         var regexp = new RegExp(pattern);
7287)                                         var matching = regexp.exec(part);
7288)                                         if (lib_args.verbosity >= 5)
7289)                                             console.info("--", "matching:", matching);
7290)                                         if (matching == null) {
7291)                                             return false;
7292)                                         }
7293)                                         else {
7294)                                             argument.assign(data, matching[1]);
7295)                                             index_expected_1 += 1;
7296)                                             return true;
7297)                                         }
7298)                                     }
7299)                                 },
7300)                             ].some(function (x) { return x(); });
7301)                             if (!found) {
7302)                                 if (lib_args.verbosity >= 1)
7303)                                     console.warn("--", "couldn't parse \"" + part + "\"");
7304)                             }
7305)                         });
7306)                     }
7307)                     return data;
7308)                     break;
7309)                 }
7310)                 default: {
7311)                     throw (new Error("unhandled environment " + environment));
7312)                     break;
7313)                 }
7314)             }
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7315)         };
7316)         /**
7317)          * @author fenris
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7318)          * @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

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

Christian Fraß authored 7 years ago

7320)         class_handler.prototype.write = function (environment, data) {
7321)             switch (environment) {
7322)                 case "cli":
7323)                 case "url": {
7324)                     return (([]
7325)                         .concat(this.filter("volatile").map(function (argument) {
7326)                         var raw = "";
7327)                         {
7328)                             var raw_front = "";
7329)                             raw_front += settings["environment"][environment]["symbols"]["prefix"];
7330)                             raw_front += argument.parameters_get()["indicators_long"][0];
7331)                             raw += raw_front;
7332)                         }
7333)                         {
7334)                             var raw_back = "";
7335)                             raw_back += settings["environment"][environment]["symbols"]["assignment"];
7336)                             raw_back += argument.make(data);
7337)                             raw += raw_back;
7338)                         }
7339)                         return raw;
7340)                     }))
7341)                         .concat(this.filter("positional").map(function (argument) {
7342)                         var raw = "";
7343)                         {
7344)                             var raw_back = "";
7345)                             raw_back += argument.make(data);
7346)                             raw += raw_back;
7347)                         }
7348)                         return raw;
7349)                     })))
7350)                         .join(settings["environment"][environment]["symbols"]["delimiter"]));
7351)                     break;
7352)                 }
7353)                 default: {
7354)                     throw (new Error("unhandled environment " + environment));
7355)                     break;
7356)                 }
7357)             }
7358)         };
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

7363)         class_handler.prototype.generate_help = function (_a) {
7364)             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;
7365)             var environment = "cli";
7366)             var output = "";
7367)             {
7368)                 var section = "";
7369)                 {
7370)                     var line = "";
7371)                     line += "";
7372)                     line += "INFO";
7373)                     line += "\n";
7374)                     section += line;
7375)                 }
7376)                 {
7377)                     var line = "";
7378)                     line += "\t";
7379)                     line += programname + " -- " + description;
7380)                     line += "\n";
7381)                     section += line;
7382)                 }
7383)                 section += "\n";
7384)                 output += section;
7385)             }
7386)             {
7387)                 if (author != null) {
7388)                     var section = "";
7389)                     {
7390)                         var line = "";
7391)                         line += "";
7392)                         line += "AUTHOR";
7393)                         line += "\n";
7394)                         section += line;
7395)                     }
7396)                     {
7397)                         var line = "";
7398)                         line += "\t";
7399)                         line += "" + author;
7400)                         line += "\n";
7401)                         section += line;
7402)                     }
7403)                     section += "\n";
7404)                     output += section;
7405)                 }
7406)             }
7407)             {
7408)                 var section = "";
7409)                 {
7410)                     var line = "";
7411)                     line += "";
7412)                     line += "SYNOPSIS";
7413)                     line += "\n";
7414)                     section += line;
7415)                 }
7416)                 {
7417)                     var line = "";
7418)                     line += "\t";
7419)                     line += executable;
7420)                     line += settings["environment"][environment]["symbols"]["delimiter"];
7421)                     line += this.filter("positional")
7422)                         .map(function (argument) {
7423)                         var part = "";
7424)                         part += "<" + argument.name_get() + ">";
7425)                         return part;
7426)                     })
7427)                         .join(settings["environment"][environment]["symbols"]["delimiter"]);
7428)                     line += settings["environment"][environment]["symbols"]["delimiter"];
7429)                     line += this.filter("volatile")
7430)                         .filter(function (argument) { return (!argument.hidden_get()); })
7431)                         .map(function (argument) {
7432)                         var part = "";
7433)                         part += settings["environment"][environment]["symbols"]["prefix"];
7434)                         part += argument.parameters_get()["indicators_long"][0];
7435)                         if (argument.type_get() != "boolean") {
7436)                             part += settings["environment"][environment]["symbols"]["assignment"];
7437)                             part += "<" + argument.name_get() + ">";
7438)                         }
7439)                         part = "[" + part + "]";
7440)                         return part;
7441)                     })
7442)                         .join(settings["environment"][environment]["symbols"]["delimiter"]);
7443)                     line += "\n";
7444)                     section += line;
7445)                 }
7446)                 section += "\n";
7447)                 output += section;
7448)             }
7449)             {
7450)                 var section = "";
7451)                 {
7452)                     var line = "";
7453)                     line += "";
7454)                     line += "OPTIONS";
7455)                     line += "\n";
7456)                     section += line;
7457)                 }
7458)                 {
7459)                     section += (this.arguments_
7460)                         .filter(function (argument) { return (!argument.hidden_get()); })
7461)                         .map(function (argument) { return argument.generate_help(); })
7462)                         .join("\n"));
7463)                 }
7464)                 section += "\n";
7465)                 output += section;
7466)             }
7467)             return output;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

7471)     lib_args.class_handler = class_handler;
7472) })(lib_args || (lib_args = {}));
Christian Fraß update

Christian Fraß authored 6 years ago

7473) 
7474) var nm_child_process = require("child_process");
7475) var nm_fs = require("fs");
7476) /**
7477)  * @author fenris
7478)  */
7479) var globalvars = {
7480)     "configuration": {},
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7481) };
Christian Fraß update

Christian Fraß authored 6 years ago

7482) /**
7483)  * @author fenris
7484)  */
7485) function name_mark(name) {
7486)     return (globalvars.configuration.name_prefix + name);
7487) }
7488) /**
7489)  * @author fenris
7490)  */
7491) function dirwrap(location, core) {
7492)     if (location == null) {
7493)         return core;
7494)     }
7495)     else {
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

7496)         return `cd ${location.as_string(globalvars.configuration.system)} > /dev/null && ${core} ; cd - > /dev/null`;
Christian Fraß update

Christian Fraß authored 6 years ago

7497)     }
7498) }
7499) /**
7500)  * @author fenris
7501)  */
7502) function filepointer_adjust(filepointer, location) {
7503)     return ((location == null) ? filepointer : filepointer.relocate(location));
7504) }
7505) /**
7506)  * @author fenris
7507)  */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

7508) function path_augment(path, step, aggregate = true) {
Christian Fraß update

Christian Fraß authored 6 years ago

7509)     if (aggregate) {
7510)         return path.concat([step]);
7511)     }
7512)     else {
7513)         return [step];
7514)     }
7515) }
7516) /**
7517)  * @author fenris
7518)  */
7519) function path_dump(path) {
7520)     return path.join(globalvars.configuration.name_splitter);
7521) }
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7522) /**
7523)  * @author fenris
7524)  */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

7525) class class_message {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7526)     /**
7527)      * @author fenris
7528)      */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

7529)     constructor(content, parameters = {}) {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7530)         /**
7531)          * @author fenris
7532)          */
7533)         this.depth = 0;
7534)         this.content = content;
7535)         this.type = lib_object.fetch(parameters, "type", null, 0);
7536)         this.depth = lib_object.fetch(parameters, "depth", 0, 0);
7537)         this.prefix = lib_object.fetch(parameters, "prefix", null, 0);
7538)         this.linebreak = lib_object.fetch(parameters, "linebreak", false, 0);
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

7540)     /**
7541)      * @author fenris
7542)      */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

7543)     generate(with_type = true) {
7544)         let output = "";
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7545)         if (with_type) {
7546)             if (this.type != null) {
7547)                 output += ("[" + this.type + "]" + " ");
7548)             }
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

7552)         }
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

7554)         output += this.content;
7555)         if (this.linebreak) {
7556)             output += "\n";
7557)         }
7558)         return output;
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

7560)     /**
7561)      * @author fenris
7562)      */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

7563)     stdout() {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7564)         console.log(this.generate(true));
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

7566)     /**
7567)      * @author fenris
7568)      */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

7569)     stderr() {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7570)         console.error(this.generate(true));
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

7572)     /**
7573)      * @author fenris
7574)      */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

7575)     console() {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7576)         switch (this.type) {
7577)             case "log": {
7578)                 console.log(this.generate(false));
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7579)                 break;
7580)             }
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

7583)                 break;
7584)             }
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

7587)                 break;
7588)             }
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

7591)                 break;
7592)             }
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

7596)         }
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

7599) /**
7600)  * @author fenris
7601)  */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

7602) class class_cliout {
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7603)     /**
7604)      * @author fenris
7605)      */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

7606)     static stdout(content, depth = 0) {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7607)         console.log(lib_string.repeat("\t", depth) + content);
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

7609)     /**
7610)      * @author fenris
7611)      */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

7612)     static stderr(content, depth = 0) {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7613)         console.error(lib_string.repeat("\t", depth) + content);
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

7615)     /**
7616)      * @author fenris
7617)      */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

7618)     static log(content, depth = 0) {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7619)         this.stderr("-- " + content, depth);
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

7621)     /**
7622)      * @author fenris
7623)      */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

7624)     static info(content, depth = 0) {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7625)         this.stderr(">> " + content, depth);
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

7627)     /**
7628)      * @author fenris
7629)      */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

7630)     static warn(content, depth = 0) {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7631)         this.stderr(">> " + content, depth);
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

7633)     /**
7634)      * @author fenris
7635)      */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

7636)     static error(content, depth = 0) {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7637)         this.stderr(">> " + content, depth);
7638)     }
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

7640) /**
7641)  * @author fenris
7642)  */
7643) var lib_gnumake;
7644) (function (lib_gnumake) {
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7645)     /**
7646)      * @author fenris
7647)      */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

7648)     function macro_command({ "interpreter": interpreter = null, "path": path, "args": args = [], "output": output = null, "system": system = "linux", }) {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7649)         switch (system) {
Christian Fraß update

Christian Fraß authored 6 years ago

7650)             case "bsd":
7651)             case "linux": {
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

7652)                 let command = path;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7653)                 {
7654)                     if (interpreter != null) {
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

7655)                         command = `${interpreter} ${command}`;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7656)                     }
7657)                 }
7658)                 {
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

7659)                     let parts = [];
7660)                     args.forEach(arg => parts.push(arg));
7661)                     command = `${command} ${parts.join(" ")}`;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7662)                 }
7663)                 {
7664)                     if (output != null) {
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

7665)                         command = `${command} > ${output}`;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7666)                     }
7667)                 }
7668)                 return command;
7669)                 break;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

7671)             case "win": {
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

7672)                 let command = "cmd //c";
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7673)                 {
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

7674)                     command = `${command} ${path}`;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7675)                 }
7676)                 {
7677)                     if (interpreter != null) {
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

7678)                         command = `${command} ${interpreter}`;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7679)                     }
7680)                 }
7681)                 {
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

7682)                     let parts = [];
7683)                     args.forEach(arg => parts.push(arg));
7684)                     command = `${command} ${parts.join(" ")}`;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7685)                 }
7686)                 {
7687)                     if (output != null) {
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

7688)                         command = `${command} > ${output}`;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7689)                     }
7690)                 }
7691)                 return command;
7692)                 break;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7693)             }
7694)             default: {
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

7695)                 throw (new Error(`unhandled system '${system}'`));
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7696)                 break;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7697)             }
7698)         }
7699)     }
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

7701)     /**
7702)      * @author fenris
7703)      */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

7704)     class class_rule {
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7705)         /**
7706)          * @author fenris
7707)          */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7708)         // public constructor(name : string, dependencies : Array<string>, actions : Array<string>, phony : boolean = false) {
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

7709)         constructor(parameters = {}) {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7710)             this.name = object_fetch(parameters, "name", null, 2);
7711)             this.dependencies = object_fetch(parameters, "dependencies", [], 0);
7712)             this.actions = object_fetch(parameters, "actions", [], 0);
7713)             this.phony = object_fetch(parameters, "phony", false, 0);
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7714)         }
7715)         /**
7716)          * @author fenris
7717)          */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

7718)         actions_get() {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7719)             return this.actions;
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

7721)         /**
7722)          * @author fenris
7723)          */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

7724)         compile(silent = false) {
7725)             let output = "";
7726)             output += (`${this.name}: ${this.dependencies.map(dependency => (" " + dependency)).join("")}\n`);
7727)             this.actions.forEach(action => (output += `\t${(silent ? "@ " : "")}${action}\n`));
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7728)             if (this.phony) {
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

7729)                 output += (`.PHONY: ${this.name}\n`);
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7730)             }
7731)             return output;
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

7734)     lib_gnumake.class_rule = class_rule;
7735)     /**
7736)      * @author fenris
7737)      */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

7738)     class class_sheet {
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7739)         /**
7740)          * @author fenris
7741)          */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

7742)         constructor(rules, comments = []) {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7743)             this.rules = rules;
7744)             this.comments = comments;
7745)         }
Christian Fraß removed backup-data-files;...

Christian Fraß authored 7 years ago

7746)         /**
7747)          * @author fenris
7748)          */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

7749)         compile(silent = false) {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7750)             return ([]
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

7751)                 .concat(this.comments.map(comment => ("# " + comment)))
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7752)                 .concat([""])
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

7753)                 .concat(this.rules.map(rule => rule.compile(silent)))
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7754)                 .join("\n"));
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

7757)     lib_gnumake.class_sheet = class_sheet;
7758) })(lib_gnumake || (lib_gnumake = {}));
7759) /**
7760)  * @author fenris
7761)  */
7762) var lib_ant;
7763) (function (lib_ant) {
7764)     /**
7765)      * @author fenris
7766)      */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

7767)     class class_comment {
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7768)         /**
7769)          * @author fenris
7770)          */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

7771)         constructor(content) {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7772)             this.content = content;
7773)         }
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7774)         /**
7775)          * @author fenris
7776)          */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

7777)         compile() {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7778)             return (new lib_xml.class_node_comment(this.content));
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

7782)     /**
7783)      * @author fenris
7784)      */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

7785)     class class_action {
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7786)         /**
7787)          * @author fenris
7788)          */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

7789)         constructor(representation) {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7790)             this.representation = representation;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7791)         }
7792)         /**
7793)          * @author fenris
7794)          */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

7795)         compile() {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7796)             return this.representation;
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

7798)         /**
7799)          * @author fenris
7800)          */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

7801)         static macro_exec({ "interpreter": interpreter = null, "path": path, "args": args = [], "output": output = null, "system": system = "linux", }) {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7802)             switch (system) {
Christian Fraß update

Christian Fraß authored 6 years ago

7803)                 case "linux":
7804)                 case "bsd": {
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

7805)                     let attributes = {};
7806)                     let args_ = [];
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7807)                     if (interpreter == null) {
7808)                         attributes["executable"] = path;
7809)                     }
7810)                     else {
7811)                         attributes["executable"] = interpreter;
7812)                         args.push(path);
7813)                     }
7814)                     if (output != null) {
7815)                         attributes["output"] = output;
7816)                     }
7817)                     args_ = args_.concat(args);
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

7818)                     return (new lib_ant.class_action(new lib_xml.class_node_complex("exec", attributes, args_.map(arg => new lib_xml.class_node_complex("arg", { "value": arg })))));
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7819)                     break;
7820)                 }
7821)                 case "win": {
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

7822)                     let attributes = {};
7823)                     let args_ = [];
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7824)                     attributes["executable"] = "cmd";
7825)                     args_.push("/c");
7826)                     if (interpreter == null) {
7827)                     }
7828)                     else {
7829)                         args_.push(interpreter);
7830)                     }
7831)                     args_.push(path);
7832)                     args_ = args_.concat(args);
7833)                     if (output != null) {
7834)                         attributes["output"] = output;
7835)                     }
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

7836)                     return (new lib_ant.class_action(new lib_xml.class_node_complex("exec", attributes, args_.map(arg => new lib_xml.class_node_complex("arg", { "value": arg })))));
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7837)                     break;
7838)                 }
7839)                 default: {
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

7840)                     throw (new Error(`unhandled system ${system}`));
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7841)                     break;
7842)                 }
7843)             }
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

7845)         /**
7846)          * @author fenris
7847)          */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

7848)         static macro_command(cmdparams) { return this.macro_exec(cmdparams); }
7849)     }
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7850)     lib_ant.class_action = class_action;
7851)     /**
7852)      * @author fenris
7853)      */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

7854)     class class_target {
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7855)         /**
7856)          * @author fenris
7857)          */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

7858)         constructor(parameters = {}) {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7859)             this.name = object_fetch(parameters, "name", null, 2);
7860)             this.dependencies = object_fetch(parameters, "dependencies", [], 1);
7861)             this.actions = object_fetch(parameters, "actions", [], 0);
7862)         }
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7863)         /**
7864)          * @author fenris
7865)          */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

7866)         actions_get() {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7867)             return this.actions;
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

7869)         /**
7870)          * @author fenris
7871)          */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

7872)         compile() {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7873)             return (new lib_xml.class_node_complex("target", {
7874)                 "name": this.name,
7875)                 "depends": this.dependencies.join(",")
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

7876)             }, this.actions.map(action => action.compile())));
7877)         }
7878)     }
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

7880)     /**
7881)      * @author fenris
7882)      */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

7883)     class class_project {
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7884)         /**
7885)          * @author fenris
7886)          */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

7887)         constructor(parameters = {}) {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7888)             this.name = object_fetch(parameters, "name", null, 2);
7889)             this.default_ = object_fetch(parameters, "default", null, 2);
7890)             this.targets = object_fetch(parameters, "targets", [], 1);
7891)             this.comments = object_fetch(parameters, "comments", [], 0);
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7892)         }
Christian Fraß update

Christian Fraß authored 6 years ago

7893)         /**
7894)          * @author fenris
7895)          */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

7896)         compile() {
Christian Fraß update

Christian Fraß authored 6 years ago

7897)             return (new lib_xml.class_node_complex("project", {
7898)                 "name": this.name,
7899)                 "default": this.default_,
7900)             }, ([]
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

7901)                 .concat(this.comments.map(comment => comment.compile()))
Christian Fraß update

Christian Fraß authored 6 years ago

7902)                 .concat([
7903)                 new lib_xml.class_node_complex("property", {
7904)                     "environment": "env"
7905)                 }),
7906)             ])
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

7907)                 .concat(this.targets.map(target => target.compile())))));
7908)         }
7909)     }
Christian Fraß update

Christian Fraß authored 6 years ago

7910)     lib_ant.class_project = class_project;
7911) })(lib_ant || (lib_ant = {}));
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

7912) var lib_markdown;
7913) (function (lib_markdown) {
7914)     /**
7915)      * @author fenris
7916)      */
7917)     function italic(content) {
7918)         return ("_" + content + "_");
7919)     }
7920)     lib_markdown.italic = italic;
7921)     /**
7922)      * @author fenris
7923)      */
7924)     function bold(content) {
7925)         return ("__" + content + "__");
7926)     }
7927)     lib_markdown.bold = bold;
7928)     /**
7929)      * @author fenris
7930)      */
7931)     function code(content) {
7932)         return ("`" + content + "`");
7933)     }
7934)     lib_markdown.code = code;
7935)     /**
7936)      * @author fenris
7937)      */
7938)     function section(level, title) {
7939)         return ("#".repeat(level) + " " + title + "\n");
7940)     }
7941)     lib_markdown.section = section;
7942)     /**
7943)      * @author fenris
7944)      */
7945)     function paragraph(content = "") {
7946)         return (content + "\n");
7947)     }
7948)     lib_markdown.paragraph = paragraph;
7949)     /**
7950)      * @author fenris
7951)      */
7952)     function listitem(level, content) {
7953)         return ("    ".repeat(level - 1) + "* " + content + "\n");
7954)     }
7955)     lib_markdown.listitem = listitem;
7956) })(lib_markdown || (lib_markdown = {}));
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7957) /**
7958)  * @author fenris
7959)  */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

7960) class class_action {
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7961)     /**
7962)      * @author fenris
7963)      */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

7964)     constructor() {
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7965)     }
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

7966) }
Christian Fraß update

Christian Fraß authored 6 years ago

7967) /**
7968)  * @author fenris
7969)  */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

7970) class class_action_adhoc extends class_action {
Christian Fraß update

Christian Fraß authored 6 years ago

7971)     /**
7972)      * @author fenris
7973)      */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

7974)     constructor() {
7975)         super();
Christian Fraß update

Christian Fraß authored 6 years ago

7976)     }
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

7978) /**
7979)  * @author fenris
7980)  */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

7981) class class_action_exec extends class_action_adhoc {
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7982)     /**
7983)      * @author fenris
7984)      */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

7985)     constructor({ "inputs": inputs, "outputs": outputs, "path": path, "interpreter": interpreter, "workdir": workdir, }) {
7986)         super();
7987)         this.paths_input = inputs;
7988)         this.paths_output = outputs;
7989)         this.path_script = path;
7990)         this.path_interpreter = interpreter;
7991)         this.workdir = workdir;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7992)     }
7993)     /**
7994)      * @desc for defining directly how the action is to be converted into a target-piece
7995)      * @author fenris
7996)      */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

7997)     compilation(output_identifier) {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

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

Christian Fraß authored 6 years ago

8000)                 switch (globalvars.configuration.system) {
8001)                     case "linux":
8002)                     case "bsd":
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

8003)                     case "win": {
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

8004)                         let command = "";
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8005)                         {
Christian Fraß update

Christian Fraß authored 6 years ago

8006)                             command = lib_gnumake.macro_command({
8007)                                 "interpreter": ((this.path_interpreter != null) ? this.path_interpreter.as_string(globalvars.configuration.system) : null),
8008)                                 "path": this.path_script.as_string(globalvars.configuration.system),
8009)                                 "args": [
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

8010)                                     ("'" + this.paths_input.map(filepointer => filepointer.as_string(globalvars.configuration.system)).join(",") + "'"),
8011)                                     ("'" + this.paths_output.map(filepointer => filepointer.as_string(globalvars.configuration.system)).join(",") + "'"),
Christian Fraß update

Christian Fraß authored 6 years ago

8012)                                 ],
8013)                                 "system": globalvars.configuration.system,
8014)                             });
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8015)                         }
8016)                         {
Christian Fraß update

Christian Fraß authored 6 years ago

8017)                             if (this.workdir != null) {
8018)                                 // command = `pushd ${this.workdir.as_string(globalvars.configuration.system)} && ${command} ; popd`
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

8019)                                 command = `cd ${this.workdir.as_string(globalvars.configuration.system)} && ${command} ; cd -`;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

8021)                         }
Christian Fraß update

Christian Fraß authored 6 years ago

8022)                         return command;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

8023)                         break;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8024)                     }
8025)                     default: {
8026)                         throw (new Error("not implemented"));
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

8027)                         break;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8028)                     }
8029)                 }
8030)                 break;
8031)             }
8032)             case "ant": {
Christian Fraß update

Christian Fraß authored 6 years ago

8033)                 return (lib_ant.class_action.macro_exec({
8034)                     "interpreter": ((this.path_interpreter != null) ? this.path_interpreter.as_string(globalvars.configuration.system) : null),
8035)                     "path": this.path_script.as_string("linux"),
8036)                     "args": [
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

8037)                         ("'" + this.paths_input.map(filepointer => filepointer.as_string("linux")).join(",") + "'"),
8038)                         ("'" + this.paths_output.map(filepointer => filepointer.as_string("linux")).join(",") + "'"),
Christian Fraß update

Christian Fraß authored 6 years ago

8039)                     ],
8040)                     "system": globalvars.configuration.system,
8041)                 }));
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

8042)                 break;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8043)             }
8044)             default: {
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

8045)                 throw (new Error(`unhandled output '${output_identifier}'`));
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

8046)                 break;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8047)             }
8048)         }
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

8051) /**
8052)  * @author fenris
8053)  */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

8054) class class_action_echo extends class_action_adhoc {
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8055)     /**
8056)      * @author fenris
8057)      */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

8058)     constructor(message) {
8059)         super();
8060)         this.message = message;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8061)     }
8062)     /**
8063)      * @desc for defining directly how the action is to be converted into a target-piece
Christian Fraß update

Christian Fraß authored 6 years ago

8064)      * @todo escape message
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8065)      * @author fenris
8066)      */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

8067)     compilation(target_identifier) {
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8068)         switch (target_identifier) {
8069)             case "gnumake": {
Christian Fraß update

Christian Fraß authored 6 years ago

8070)                 switch (globalvars.configuration["system"]) {
8071)                     case "linux":
8072)                     case "bsd":
8073)                     case "win": {
8074)                         return (lib_gnumake.macro_command({
8075)                             "path": "echo",
8076)                             "args": ["\"" + this.message + "\""],
8077)                         }));
8078)                         break;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8079)                     }
8080)                     default: {
8081)                         throw (new Error("not implemented"));
Christian Fraß update

Christian Fraß authored 6 years ago

8082)                         break;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8083)                     }
8084)                 }
8085)                 break;
8086)             }
8087)             case "ant": {
Christian Fraß update

Christian Fraß authored 6 years ago

8088)                 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

8089)                 break;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8090)             }
8091)             default: {
8092)                 throw (new Error("unhandled target '" + target_identifier + "'"));
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

8093)                 break;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8094)             }
8095)         }
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

8098) /**
8099)  * @author fenris
8100)  */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

8101) class class_action_mkdir extends class_action_adhoc {
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8102)     /**
8103)      * @author fenris
8104)      */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

8105)     constructor(location) {
8106)         super();
8107)         this.location = location;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8108)     }
8109)     /**
8110)      * @desc for defining directly how the action is to be converted into a target-piece
8111)      * @author fenris
8112)      */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

8113)     compilation(target_identifier) {
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8114)         switch (target_identifier) {
8115)             case "gnumake": {
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

8116)                 let parts = [];
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

8117)                 parts.push("mkdir");
Christian Fraß update

Christian Fraß authored 6 years ago

8118)                 switch (globalvars.configuration["system"]) {
8119)                     case "linux": {
8120)                         parts.push("--parents");
8121)                         break;
8122)                     }
8123)                     case "bsd": {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

8124)                         parts.push("-p");
8125)                         break;
8126)                     }
8127)                     case "win": {
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8128)                         break;
8129)                     }
8130)                     default: {
8131)                         throw (new Error("not implemented"));
8132)                         break;
8133)                     }
8134)                 }
Christian Fraß update

Christian Fraß authored 6 years ago

8135)                 parts.push(this.location.as_string(globalvars.configuration["system"]));
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

8136)                 return parts.join(" ");
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8137)             }
8138)             case "ant": {
Christian Fraß update

Christian Fraß authored 6 years ago

8139)                 return (new lib_ant.class_action(new lib_xml.class_node_complex("mkdir", { "dir": this.location.as_string("linux") })));
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8140)             }
8141)             default: {
8142)                 throw (new Error("unhandled target '" + target_identifier + "'"));
8143)             }
8144)         }
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

8147) /**
8148)  * @author fenris
8149)  */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

8150) class class_action_touch extends class_action_adhoc {
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8151)     /**
8152)      * @author fenris
8153)      */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

8154)     constructor(filepointer) {
8155)         super();
8156)         this.filepointer = filepointer;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8157)     }
8158)     /**
8159)      * @desc for defining directly how the action is to be converted into a target-piece
8160)      * @author fenris
8161)      */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

8162)     compilation(target_identifier) {
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8163)         switch (target_identifier) {
8164)             case "gnumake": {
Christian Fraß update

Christian Fraß authored 6 years ago

8165)                 switch (globalvars.configuration["system"]) {
8166)                     case "bsd":
8167)                     case "linux": {
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

8168)                         let parts = [];
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8169)                         parts.push("touch");
8170)                         parts.push(this.filepointer.toString());
8171)                         return parts.join(" ");
8172)                     }
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

8173)                     case "win": {
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

8174)                         let parts = [];
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

8175)                         parts.push("echo.");
8176)                         parts.push(">");
8177)                         parts.push(this.filepointer.toString());
8178)                         return parts.join(" ");
8179)                     }
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8180)                     default: {
8181)                         throw (new Error("not implemented"));
8182)                     }
8183)                 }
8184)             }
8185)             case "ant": {
8186)                 return (new lib_ant.class_action(new lib_xml.class_node_complex("touch", { "file": this.filepointer.toString() })));
8187)             }
8188)             default: {
8189)                 throw (new Error("unhandled target '" + target_identifier + "'"));
8190)                 break;
8191)             }
8192)         }
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

8195) /**
8196)  * @author fenris
8197)  */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

8198) class class_action_copy extends class_action_adhoc {
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8199)     /**
8200)      * @author fenris
8201)      */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

8202)     constructor(filepointer_from, filepointer_to, folder) {
8203)         super();
8204)         this.filepointer_from = filepointer_from;
8205)         this.filepointer_to = filepointer_to;
8206)         this.folder = folder;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8207)     }
8208)     /**
8209)      * @desc for defining directly how the action is to be converted into a target-piece
8210)      * @author fenris
8211)      */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

8212)     compilation(target_identifier) {
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8213)         switch (target_identifier) {
8214)             case "gnumake": {
Christian Fraß update

Christian Fraß authored 6 years ago

8215)                 switch (globalvars.configuration.system) {
8216)                     case "linux": {
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

8217)                         let args = [];
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8218)                         if (this.folder) {
Christian Fraß update

Christian Fraß authored 6 years ago

8219)                             args.push("--recursive");
8220)                             args.push("--update");
8221)                             args.push("--verbose");
8222)                             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

8223)                         }
8224)                         else {
Christian Fraß update

Christian Fraß authored 6 years ago

8225)                             args.push(this.filepointer_from.as_string(globalvars.configuration.system));
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

8226)                         }
Christian Fraß update

Christian Fraß authored 6 years ago

8227)                         args.push(this.filepointer_to.as_string(globalvars.configuration.system));
8228)                         return (lib_gnumake.macro_command({
8229)                             "path": "cp",
8230)                             "args": args,
8231)                         }));
8232)                         break;
8233)                     }
8234)                     case "bsd": {
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

8235)                         let args = [];
Christian Fraß update

Christian Fraß authored 6 years ago

8236)                         if (this.folder) {
8237)                             args.push("-r");
8238)                             // args.push("-u");
8239)                             args.push("-v");
8240)                             args.push((new lib_path.class_filepointer(this.filepointer_from.location, "*")).as_string(globalvars.configuration.system));
8241)                         }
8242)                         else {
8243)                             args.push(this.filepointer_from.as_string(globalvars.configuration.system));
8244)                         }
8245)                         args.push(this.filepointer_to.as_string(globalvars.configuration.system));
8246)                         return (lib_gnumake.macro_command({
8247)                             "path": "cp",
8248)                             "args": args,
8249)                         }));
8250)                         break;
8251)                     }
8252)                     case "win": {
8253)                         throw (new Error("not implemented"));
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

8254)                         break;
8255)                     }
8256)                     default: {
8257)                         throw (new Error("not implemented"));
8258)                         break;
8259)                     }
8260)                 }
8261)                 break;
8262)             }
8263)             case "ant": {
8264)                 if (!this.folder) {
8265)                     return (new lib_ant.class_action(new lib_xml.class_node_complex("copy", {
Christian Fraß update

Christian Fraß authored 6 years ago

8266)                         "file": this.filepointer_from.as_string("linux"),
8267)                         "tofile": this.filepointer_to.as_string("linux"),
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

8268)                     })));
8269)                 }
8270)                 else {
8271)                     return (new lib_ant.class_action(new lib_xml.class_node_complex("copy", {
Christian Fraß update

Christian Fraß authored 6 years ago

8272)                         "todir": this.filepointer_to.as_string("linux"),
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

8273)                     }, [
8274)                         new lib_xml.class_node_complex("fileset", {
Christian Fraß update

Christian Fraß authored 6 years ago

8275)                             "dir": this.filepointer_from.as_string("linux"),
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

8276)                         })
8277)                     ])));
8278)                 }
8279)                 break;
8280)             }
8281)             default: {
8282)                 throw (new Error("unhandled target '" + target_identifier + "'"));
8283)                 break;
8284)             }
8285)         }
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

8288) /**
8289)  * @author fenris
8290)  */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

8291) class class_action_move extends class_action_adhoc {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

8292)     /**
8293)      * @author fenris
8294)      */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

8295)     constructor({ "from": from, "to": to, }) {
8296)         super();
8297)         this.from = from;
8298)         this.to = to;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

8299)     }
8300)     /**
8301)      * @desc for defining directly how the action is to be converted into a target-piece
8302)      * @author fenris
8303)      */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

8304)     compilation(output_identifier) {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

8305)         switch (output_identifier) {
8306)             case "gnumake": {
Christian Fraß update

Christian Fraß authored 6 years ago

8307)                 switch (globalvars.configuration.system) {
8308)                     case "linux":
8309)                     case "bsd":
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

8310)                     case "win": {
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

8311)                         let from = this.from.as_string(globalvars.configuration.system);
8312)                         let to = this.to.as_string(globalvars.configuration.system);
8313)                         let command = "";
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

8314)                         {
8315)                             command = lib_gnumake.macro_command({
8316)                                 "path": "mv",
Christian Fraß update

Christian Fraß authored 6 years ago

8317)                                 // "args": ["--verbose", from, to],
8318)                                 "args": [from, to],
8319)                                 "system": globalvars.configuration.system,
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

8320)                             });
8321)                         }
8322)                         {
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

8323)                             command = `[ "${from}" -ef "${to}" ] || ${command}`;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

8325)                         return command;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8326)                         break;
8327)                     }
8328)                     default: {
8329)                         throw (new Error("not implemented"));
8330)                         break;
8331)                     }
8332)                 }
8333)                 break;
8334)             }
8335)             case "ant": {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

8336)                 return (new lib_ant.class_action(new lib_xml.class_node_complex("move", {
Christian Fraß update

Christian Fraß authored 6 years ago

8337)                     "file": this.from.as_string("linux"),
8338)                     "tofile": this.to.as_string("linux"),
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

8340)                 break;
8341)             }
8342)             default: {
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

8343)                 throw (new Error(`unhandled output '${output_identifier}'`));
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8344)                 break;
8345)             }
8346)         }
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

8349) /**
8350)  * @author fenris
8351)  */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

8352) class class_action_concat extends class_action_adhoc {
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8353)     /**
8354)      * @author fenris
8355)      */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

8356)     constructor(sources, destination, schwamminput = null) {
8357)         super();
8358)         this.sources = sources;
8359)         this.destination = destination;
8360)         this.schwamminput = schwamminput;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8361)     }
8362)     /**
8363)      * @desc for defining directly how the action is to be converted into a target-piece
8364)      * @author fenris
8365)      */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

8366)     compilation(output_identifier) {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

8368)             case "gnumake": {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

8369)                 if (this.sources.length > 0) {
8370)                     return (lib_gnumake.macro_command({
8371)                         "path": {
Christian Fraß update

Christian Fraß authored 6 years ago

8372)                             "linux": "cat",
8373)                             "bsd": "cat",
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

8374)                             "win": "type",
Christian Fraß update

Christian Fraß authored 6 years ago

8375)                         }[globalvars.configuration.system],
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

8376)                         "args": this.sources.map(source => source.as_string(globalvars.configuration.system)),
Christian Fraß update

Christian Fraß authored 6 years ago

8377)                         "output": this.destination.as_string(globalvars.configuration.system),
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

8380)                 else {
8381)                     return (lib_gnumake.macro_command({
8382)                         "path": "touch",
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

8383)                         "args": [this.destination.as_string(globalvars.configuration.system)],
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

8384)                     }));
8385)                 }
8386)                 break;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8387)             }
8388)             case "ant": {
Christian Fraß update

Christian Fraß authored 6 years ago

8389)                 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

8390)                     new lib_xml.class_node_complex("filelist", { "dir": "." }, this.sources.map(function (source) {
Christian Fraß update

Christian Fraß authored 6 years ago

8391)                         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

8392)                     }))
8393)                 ])));
Christian Fraß update

Christian Fraß authored 6 years ago

8394)                 break;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8395)             }
8396)             default: {
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

8397)                 throw (new Error(`unhandled output '${output_identifier}'`));
Christian Fraß update

Christian Fraß authored 6 years ago

8398)                 break;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8399)             }
8400)         }
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

8403) /**
8404)  * @author fenris
8405)  */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

8406) class class_action_lessc extends class_action_adhoc {
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8407)     /**
8408)      * @author fenris
8409)      */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

8410)     constructor(filepointer_from, filepointer_to) {
8411)         super();
8412)         this.filepointer_from = filepointer_from;
8413)         this.filepointer_to = filepointer_to;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8414)     }
8415)     /**
Christian Fraß update

Christian Fraß authored 6 years ago

8416)      * @override
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8417)      * @author fenris
8418)      */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

8419)     compilation(output_identifier) {
8420)         let args = [];
Christian Fraß update

Christian Fraß authored 6 years ago

8421)         args.push(this.filepointer_from.as_string(globalvars.configuration.system));
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

8422)         let cmdparams = {
8423)             "path": globalvars.configuration.programpaths.lessc,
Christian Fraß update

Christian Fraß authored 6 years ago

8424)             "args": args,
8425)             "output": this.filepointer_to.as_string(globalvars.configuration.system),
8426)         };
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

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

Christian Fraß authored 6 years ago

8429)                 return lib_gnumake.macro_command(cmdparams);
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8430)                 break;
8431)             }
8432)             case "ant": {
Christian Fraß update

Christian Fraß authored 6 years ago

8433)                 return lib_ant.class_action.macro_command(cmdparams);
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8434)                 break;
8435)             }
8436)             default: {
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

8437)                 throw (new Error(`unhandled output '${output_identifier}'`));
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8438)                 break;
8439)             }
8440)         }
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

8443) /**
8444)  * @author neu3no
8445)  */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

8446) class class_action_babel extends class_action_adhoc {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

8447)     /**
8448)      * @author neu3no
8449)      */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

8450)     constructor(filepointers_from, filepointer_to, presets, plugins, minify) {
8451)         super();
8452)         this.filepointers_from = filepointers_from;
8453)         this.filepointer_to = filepointer_to;
8454)         this.presets = presets;
8455)         this.plugins = plugins;
8456)         this.minify = minify;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

8457)     }
8458)     /**
Christian Fraß update

Christian Fraß authored 6 years ago

8459)      * @override
8460)      * @author neu3no,fenris
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

8461)      */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

8462)     compilation(output_identifier) {
8463)         let args = [];
Christian Fraß update

Christian Fraß authored 6 years ago

8464)         args.push("--no-babelrc");
8465)         // input
8466)         {
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

8467)             this.filepointers_from.forEach(filepointer => args.push(filepointer.as_string(globalvars.configuration.system)));
Christian Fraß update

Christian Fraß authored 6 years ago

8468)         }
8469)         // output
8470)         {
8471)             args.push("--out-file");
8472)             args.push(this.filepointer_to.as_string(globalvars.configuration.system));
8473)         }
8474)         // presets
8475)         {
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

8476)             if ((this.presets !== null) && (this.presets.length > 0)) {
8477)                 args.push("--presets");
8478)                 args.push(this.presets.join(","));
8479)             }
8480)         }
8481)         // plugins
8482)         {
8483)             if ((this.plugins != null) && (this.plugins.length > 0)) {
8484)                 args.push("--plugins");
8485)                 args.push(this.plugins.join(","));
Christian Fraß update

Christian Fraß authored 6 years ago

8486)             }
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

8487)         }
8488)         // minify
8489)         {
Christian Fraß update

Christian Fraß authored 6 years ago

8490)             if (this.minify) {
8491)                 args.push("--minified");
8492)             }
8493)         }
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

8494)         let cmdparams = {
8495)             "path": globalvars.configuration.programpaths.babel,
Christian Fraß update

Christian Fraß authored 6 years ago

8496)             "args": args,
8497)             "output": this.filepointer_to.as_string(globalvars.configuration.system),
8498)         };
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

8499)         switch (output_identifier) {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

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

Christian Fraß authored 6 years ago

8501)                 return lib_gnumake.macro_command(cmdparams);
8502)                 break;
8503)             }
8504)             case "ant": {
8505)                 return lib_ant.class_action.macro_command(cmdparams);
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

8506)                 break;
8507)             }
8508)             default: {
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

8509)                 throw (new Error(`unhandled target '${output_identifier}'`));
Christian Fraß update

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

8511)             }
8512)         }
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

8515) /**
8516)  * @author fenris
8517)  */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

8518) class class_action_tsc extends class_action_adhoc {
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8519)     /**
8520)      * @author fenris
8521)      */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

8522)     constructor(paths_input, path_output, target, allowUnreachableCode, declaration) {
8523)         super();
8524)         this.paths_input = paths_input;
8525)         this.path_output = path_output;
8526)         this.target = target;
8527)         this.allowUnreachableCode = allowUnreachableCode;
8528)         this.declaration = declaration;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8529)     }
8530)     /**
8531)      * @author fenris
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

8532)      * @todo handle declarion-path
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8533)      */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

8534)     compilation(output_identifier) {
8535)         let args = [];
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

8536)         {
8537)             if (this.allowUnreachableCode) {
8538)                 args.push("--allowUnreachableCode");
8539)             }
8540)         }
8541)         {
8542)             if (this.target != null) {
8543)                 args.push("--target");
8544)                 args.push(this.target);
8545)             }
8546)         }
8547)         {
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

8548)             this.paths_input.forEach(filepointer => args.push(filepointer.as_string(globalvars.configuration.system)));
Christian Fraß update

Christian Fraß authored 6 years ago

8549)         }
8550)         {
8551)             if (this.declaration != null) {
8552)                 args.push("--declaration");
8553)             }
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

8554)         }
8555)         {
8556)             args.push("--outFile");
Christian Fraß update

Christian Fraß authored 6 years ago

8557)             args.push(this.path_output.as_string(globalvars.configuration.system));
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

8558)         }
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

8559)         let cmdparams = {
8560)             "path": globalvars.configuration.programpaths.tsc,
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

8561)             "args": args,
Christian Fraß update

Christian Fraß authored 6 years ago

8562)             "system": globalvars.configuration.system,
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

8563)         };
8564)         switch (output_identifier) {
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8565)             case "gnumake": {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

8566)                 return lib_gnumake.macro_command(cmdparams);
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8567)                 break;
8568)             }
8569)             case "ant": {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

8570)                 return lib_ant.class_action.macro_command(cmdparams);
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8571)                 break;
8572)             }
8573)             default: {
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

8574)                 throw (new Error(`unhandled output '${output_identifier}'`));
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8575)                 break;
8576)             }
8577)         }
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

8580) /**
8581)  * @author fenris
8582)  */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

8583) class class_action_php extends class_action_adhoc {
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8584)     /**
8585)      * @author fenris
8586)      */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

8587)     constructor(filepointers_from, filepointer_to, only_last) {
8588)         super();
8589)         this.filepointers_from = filepointers_from;
8590)         this.filepointer_to = filepointer_to;
8591)         this.only_last = only_last;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8592)     }
8593)     /**
8594)      * @desc for defining directly how the action is to be converted into a target-piece
8595)      * @author fenris
8596)      */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

8597)     compilation(output_identifier) {
8598)         let args = [];
8599)         {
8600)             if (this.only_last) {
8601)                 this.filepointers_from.slice(-1).forEach(filepointer => args.push(filepointer.as_string(globalvars.configuration.system)));
8602)             }
8603)             else {
8604)                 this.filepointers_from.forEach(filepointer => args.push(filepointer.as_string(globalvars.configuration.system)));
8605)             }
8606)         }
8607)         let cmdparams = {
8608)             "path": globalvars.configuration.programpaths.php,
8609)             "args": args,
8610)             "system": globalvars.configuration.system,
8611)             "output": this.filepointer_to.as_string(globalvars.configuration.system),
8612)         };
8613)         switch (output_identifier) {
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8614)             case "gnumake": {
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

8615)                 return lib_gnumake.macro_command(cmdparams);
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8616)                 break;
8617)             }
8618)             case "ant": {
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

8619)                 return lib_ant.class_action.macro_command(cmdparams);
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8620)                 break;
8621)             }
8622)             default: {
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

8623)                 throw (new Error(`unhandled output '${output_identifier}'`));
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8624)                 break;
8625)             }
8626)         }
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

8629) /**
8630)  * @author fenris
8631)  */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

8632) class class_action_gitpull extends class_action_adhoc {
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8633)     /**
8634)      * @author fenris
8635)      */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

8636)     constructor(url) {
8637)         super();
8638)         this.url = url;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8639)     }
8640)     /**
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

8641)      * @desc for defining directly how the action is to be converted into a target-piece
8642)      * @todo escape message
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8643)      * @author fenris
8644)      */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

8645)     compilation(target_identifier) {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

8646)         switch (target_identifier) {
8647)             case "gnumake": {
Christian Fraß update

Christian Fraß authored 6 years ago

8648)                 switch (globalvars.configuration["system"]) {
8649)                     case "linux":
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

8650)                     case "win": {
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

8651)                         let parts = [];
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

8652)                         parts.push("git pull");
8653)                         parts.push(this.url);
8654)                         return parts.join(" ");
8655)                         break;
8656)                     }
8657)                     default: {
8658)                         throw (new Error("not implemented"));
8659)                         break;
8660)                     }
8661)                 }
8662)                 break;
8663)             }
8664)             /*
8665)             case "ant": {
8666)                 return (
8667)                     new lib_ant.class_action(
8668)                         new lib_xml.class_node_complex(
8669)                             "echo",
8670)                             {"message": this.message}
8671)                         )
8672)                     )
8673)                 );
8674)                 break;
8675)             }
8676)              */
8677)             default: {
8678)                 throw (new Error("unhandled target '" + target_identifier + "'"));
8679)                 break;
8680)             }
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8681)         }
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

8682)     }
8683) }
Christian Fraß update

Christian Fraß authored 6 years ago

8684) /**
8685)  * @author fenris
8686)  */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

8687) class class_action_schwamm extends class_action_adhoc {
Christian Fraß update

Christian Fraß authored 6 years ago

8688)     /**
8689)      * @author fenris
8690)      */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

8691)     constructor(includes, inputs, save, dump_group = null, dump_filepointer = null) {
8692)         super();
8693)         this.includes = includes;
8694)         this.inputs = inputs;
8695)         this.save = save;
8696)         this.dump_group = dump_group;
8697)         this.dump_filepointer = dump_filepointer;
Christian Fraß update

Christian Fraß authored 6 years ago

8698)     }
8699)     /**
8700)      * @desc for defining directly how the action is to be converted into a target-piece
8701)      * @author fenris
8702)      */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

8703)     compilation(target_identifier) {
8704)         let args = [];
8705)         this.includes.forEach(include => {
8706)             args.push(`--include=${include.as_string(globalvars.configuration["system"])}`);
Christian Fraß update

Christian Fraß authored 6 years ago

8707)         });
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

8708)         lib_object.to_array(this.inputs).forEach(pair => {
8709)             pair.value.forEach(member => {
8710)                 let filepointer = member;
8711)                 args.push(`--input=${filepointer.as_string(globalvars.configuration["system"])}:${pair.key}`);
Christian Fraß update

Christian Fraß authored 6 years ago

8712)             });
8713)         });
8714)         // args.push(`--file=${this.output.as_string(globalvars.configuration["system"])}`);
8715)         // args.push(`--dir=${((this.dir != null) ? this.dir : this.output.location).as_string("system")}`);
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

8716)         let target;
Christian Fraß update

Christian Fraß authored 6 years ago

8717)         if (this.save != undefined) {
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

8718)             args.push(`--output=native`);
Christian Fraß update

Christian Fraß authored 6 years ago

8719)             target = this.save;
8720)         }
8721)         else if (this.dump_group != null) {
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

8722)             args.push(`--output=dump:${this.dump_group}`);
Christian Fraß update

Christian Fraß authored 6 years ago

8723)             target = this.dump_filepointer;
8724)         }
8725)         else {
8726)             console.warn("output missing?");
8727)         }
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

8728)         let cmdparams = {
8729)             "path": globalvars.configuration.programpaths.schwamm,
Christian Fraß update

Christian Fraß authored 6 years ago

8730)             "args": args,
8731)             "output": target.as_string(globalvars.configuration["system"]),
8732)         };
8733)         switch (target_identifier) {
8734)             case "gnumake": {
8735)                 return lib_gnumake.macro_command(cmdparams);
8736)                 break;
8737)             }
8738)             case "ant": {
8739)                 return lib_ant.class_action.macro_command(cmdparams);
8740)                 break;
8741)             }
8742)             default: {
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

8743)                 throw (new Error(`unhandled target '${target_identifier}'`));
Christian Fraß update

Christian Fraß authored 6 years ago

8744)                 break;
8745)             }
8746)         }
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

8749) /**
8750)  * @author fenris
8751)  */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

8752) class class_action_schwamm_create extends class_action_adhoc {
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8753)     /**
8754)      * @author fenris
8755)      */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

8756)     constructor(includes, adhoc, output, dir) {
8757)         super();
8758)         this.includes = includes;
8759)         this.adhoc = adhoc;
8760)         this.output = output;
8761)         this.dir = dir;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

8764)      * @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

8765)      * @author fenris
8766)      */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

8767)     compilation(target_identifier) {
8768)         let args = [];
8769)         this.includes.forEach(include => {
8770)             args.push(`--include=${include.as_string(globalvars.configuration["system"])}`);
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

8771)         });
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

8772)         Object.keys(this.adhoc).forEach(group => {
8773)             this.adhoc[group].forEach(member => {
8774)                 let filepointer = member;
8775)                 args.push(`--input=${filepointer.as_string(globalvars.configuration["system"])}:${group}`);
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

8776)             });
8777)         });
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

8778)         args.push(`--output=native`);
Christian Fraß update

Christian Fraß authored 6 years ago

8779)         // args.push(`--file=${this.output.as_string(globalvars.configuration["system"])}`);
8780)         // args.push(`--dir=${((this.dir != null) ? this.dir : this.output.location).as_string("linux")}`);
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

8781)         let cmdparams = {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

8782)             "path": "schwamm",
8783)             "args": args,
Christian Fraß update

Christian Fraß authored 6 years ago

8784)             "output": this.output.as_string(globalvars.configuration["system"]),
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

8785)         };
8786)         switch (target_identifier) {
8787)             case "gnumake": {
8788)                 return lib_gnumake.macro_command(cmdparams);
8789)                 break;
8790)             }
8791)             case "ant": {
8792)                 return lib_ant.class_action.macro_command(cmdparams);
8793)                 break;
8794)             }
8795)             default: {
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

8796)                 throw (new Error(`unhandled target '${target_identifier}'`));
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

8797)                 break;
8798)             }
8799)         }
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

8802) /**
8803)  * @author fenris
8804)  */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

8805) class class_action_schwamm_apply extends class_action_adhoc {
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8806)     /**
8807)      * @author fenris
8808)      */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

8809)     constructor(path, output_group, output_filepointer) {
8810)         super();
8811)         this.path = path;
8812)         this.output_group = output_group;
8813)         this.output_filepointer = output_filepointer;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8814)     }
8815)     /**
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

8816)      * @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

8817)      * @author fenris
8818)      */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

8819)     compilation(target_identifier) {
8820)         let args = [];
8821)         args.push(`--include=${this.path.as_string(globalvars.configuration["system"])}`);
8822)         args.push(`--output=dump:${this.output_group}`);
8823)         let filepointer = lib_path.filepointer_read(globalvars.configuration["path"]).foo(this.output_filepointer);
8824)         let cmdparams = {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

8825)             "path": "schwamm",
8826)             "args": args,
Christian Fraß update

Christian Fraß authored 6 years ago

8827)             "output": filepointer.as_string(globalvars.configuration["system"]),
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

8828)         };
8829)         switch (target_identifier) {
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8830)             case "gnumake": {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

8831)                 return lib_gnumake.macro_command(cmdparams);
8832)                 break;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8833)             }
8834)             case "ant": {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

8835)                 return lib_ant.class_action.macro_command(cmdparams);
8836)                 break;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8837)             }
8838)             default: {
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

8839)                 throw (new Error(`unhandled target '${target_identifier}'`));
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8840)                 break;
8841)             }
8842)         }
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

8845) /**
8846)  * @author fenris
8847)  */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

8848) class class_action_locmerge extends class_action_adhoc {
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8849)     /**
8850)      * @author fenris
8851)      */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

8852)     constructor(inputs, output) {
8853)         super();
8854)         this.inputs = inputs;
8855)         this.output = output;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8856)     }
8857)     /**
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

8858)      * @override
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8859)      * @author fenris
8860)      */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

8861)     compilation(output_identifier) {
8862)         let args = [];
8863)         // inputs
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

8864)         {
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

8865)             this.inputs.forEach(input => args.push(input.as_string(globalvars.configuration.system)));
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

8866)         }
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

8867)         let cmdparams = {
8868)             "path": globalvars.configuration.programpaths.locmerge,
8869)             "args": args,
8870)             "output": this.output.as_string(globalvars.configuration.system),
8871)         };
8872)         switch (output_identifier) {
8873)             case "gnumake": {
8874)                 return lib_gnumake.macro_command(cmdparams);
8875)                 break;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

8876)             }
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

8877)             case "ant": {
8878)                 return lib_ant.class_action.macro_command(cmdparams);
8879)                 break;
8880)             }
8881)             default: {
8882)                 throw (new Error(`unhandled target '${output_identifier}'`));
8883)                 break;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

8884)             }
8885)         }
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

8888) /**
8889)  * @author fenris
8890)  */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

8891) class class_task {
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8892)     /**
8893)      * @author fenris
8894)      */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

8895)     constructor({ "name": name = null, "active": active = true, "sub": sub = [], "inputs": _inputs = [], "outputs": _outputs = [], "actions": _actions = [], }) {
8896)         this.name = name;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

8897)         this.sub = sub;
8898)         this.active = active;
8899)         this._inputs = _inputs;
8900)         this._outputs = _outputs;
8901)         this._actions = _actions;
Christian Fraß update

Christian Fraß authored 6 years ago

8902)         this.context = null;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8903)     }
8904)     /**
Christian Fraß update

Christian Fraß authored 6 years ago

8905)      * @desc [accessor] [getter]
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8906)      * @author fenris
8907)      */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

8908)     name_get() {
8909)         return this.name;
8910)     }
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8911)     /**
Christian Fraß update

Christian Fraß authored 6 years ago

8912)      * @desc [accessor] [getter]
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8913)      * @author fenris
8914)      */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

8915)     sub_get() {
8916)         return this.sub;
8917)     }
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8918)     /**
Christian Fraß update

Christian Fraß authored 6 years ago

8919)      * @desc [accessor] [getter]
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

8920)      * @author fenris
8921)      */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

8922)     active_get() {
8923)         return this.active;
8924)     }
8925)     /**
8926)      * @desc [mutator] [setter]
8927)      * @author fenris
8928)      */
8929)     context_set(context) {
8930)         this.context = context;
8931)     }
8932)     /**
8933)      * @desc [accessor] [getter]
8934)      * @author fenris
8935)      */
8936)     context_get() {
8937)         return this.context;
8938)     }
8939)     /**
8940)      * @returns the subgraph of all active tasks
8941)      * @author fenris
8942)      */
8943)     clean(root = true) {
8944)         if (root && (!this.active)) {
8945)             throw (new Error("cant't clean inactive root"));
8946)         }
8947)         else {
8948)             this.sub = this.sub.filter(task_ => task_.active);
8949)             this.sub.forEach(task_ => task_.clean(false));
8950)         }
8951)     }
8952)     /**
8953)      * @desc [accessor] [getter]
8954)      * @author fenris
8955)      */
8956)     values(raw) {
8957)         return null;
8958)     }
8959)     /**
8960)      * @desc [accessor] [getter] a list of paths which represent input-files of the task
8961)      * @author fenris
8962)      */
8963)     inputs() {
8964)         return this._inputs;
8965)     }
8966)     /**
8967)      * @desc [accessor] [getter] a list of paths which represent output-files of the task
8968)      * @author fenris
8969)      */
8970)     outputs() {
8971)         return this._outputs;
8972)     }
8973)     /**
8974)      * @desc [accessor] [getter] generates all actions which have to be executed in order to fulfil the task
8975)      * @author fenris
8976)      */
8977)     actions() {
8978)         return this._actions;
8979)     }
8980) }
8981) /**
8982)  * @author fenris
8983)  */
8984) class class_taskparameter {
8985)     /**
8986)      * @author fenris
8987)      */
8988)     constructor({ "name": name, "extraction": extraction = lib_call.id, "shape": shape = lib_meta.from_raw({ "id": "any" }), "default": default_ = new class_nothing(), "description": description = null, }) {
8989)         this.name = name;
8990)         this.extraction = extraction;
8991)         this.shape = shape;
8992)         this.default_ = default_;
8993)         this.description = description;
8994)     }
8995)     /**
8996)      * @author fenris
8997)      */
8998)     static input_single({ "description": description = "the list of paths to the input files", "default": default_ = new class_nothing(), } = {}) {
8999)         return (new class_taskparameter({
9000)             "name": "input",
9001)             "extraction": raw => lib_path.filepointer_read(raw),
9002)             "shape": lib_meta.from_raw({
9003)                 "id": "string"
9004)             }),
9005)             "default": default_,
9006)             "description": description,
9007)         }));
9008)     }
9009)     /**
9010)      * @author fenris
9011)      */
9012)     static input_list({ "description": description = "the list of paths to the input files", "default": default_ = new class_nothing(), } = {}) {
9013)         return (new class_taskparameter({
9014)             "name": "inputs",
9015)             "extraction": raw => raw.map(x => lib_path.filepointer_read(x)),
9016)             "shape": lib_meta.from_raw({
9017)                 "id": "array",
9018)                 "parameters": {
9019)                     "shape_element": {
9020)                         "id": "string"
9021)                     }
9022)                 }
9023)             }),
9024)             "default": default_,
9025)             "description": description,
9026)         }));
9027)     }
9028)     /**
9029)      * @author fenris
9030)      */
9031)     static input_schwamm({ "description": description = "parameters for a schwamm which holds a list of files in a group", "default": default_ = new class_nothing(), } = {}) {
9032)         return (new class_taskparameter({
9033)             "name": "input_from_schwamm",
9034)             "extraction": raw => {
9035)                 if (raw == null) {
9036)                     return [];
9037)                 }
9038)                 else {
9039)                     let regexp;
9040)                     if (raw["filter"] != null) {
9041)                         regexp = new RegExp(raw["filter"]);
9042)                     }
9043)                     else {
9044)                         regexp = null;
9045)                     }
9046)                     let command = `schwamm --include=${raw["path"]} --output=list:${raw["group"]}`;
9047)                     let result = nm_child_process.execSync(command);
9048)                     let output = result.toString();
9049)                     let paths = output.split("\n");
9050)                     return (paths
9051)                         .filter(path => (path.trim().length > 0))
9052)                         .filter(path => ((regexp == null) ? true : regexp.test(path)))
9053)                         .map(path => lib_path.filepointer_read(path)));
9054)                 }
9055)             },
9056)             "shape": lib_meta.from_raw({
9057)                 "id": "object",
9058)                 "parameters": {
9059)                     "fields": [
9060)                         {
9061)                             "name": "path",
9062)                             "shape": {
9063)                                 "id": "string"
9064)                             }
9065)                         },
9066)                         {
9067)                             "name": "group",
9068)                             "shape": {
9069)                                 "id": "string"
9070)                             }
9071)                         },
9072)                         {
9073)                             "name": "filter",
9074)                             "shape": {
9075)                                 "id": "string",
9076)                                 "parameters": {
9077)                                     "soft": true
9078)                                 }
9079)                             }
9080)                         },
9081)                     ]
9082)                 }
9083)             }),
9084)             "default": default_,
9085)             "description": description,
9086)         }));
9087)     }
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

9088)     /**
9089)      * @author fenris
9090)      */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

9091)     static output_single({ "description": description = "the list of paths to the input files", } = {}) {
9092)         return (new class_taskparameter({
9093)             "name": "output",
9094)             "extraction": raw => lib_path.filepointer_read(raw),
9095)             "shape": lib_meta.from_raw({
9096)                 "id": "string"
9097)             }),
9098)             "default": new class_nothing(),
9099)             "description": description,
9100)         }));
9101)     }
Christian Fraß update

Christian Fraß authored 6 years ago

9102)     /**
9103)      * @author fenris
9104)      */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

9105)     static output_list({ "description": description = "the list of paths to the output files", "default": default_ = new class_just([]), } = {}) {
9106)         return (new class_taskparameter({
9107)             "name": "outputs",
9108)             "extraction": raw => raw.map(x => lib_path.filepointer_read(x)),
9109)             "shape": lib_meta.from_raw({
9110)                 "id": "array",
9111)                 "parameters": {
9112)                     "shape_element": {
9113)                         "id": "string"
9114)                     }
9115)                 }
9116)             }),
9117)             "default": default_,
9118)             "description": description,
9119)         }));
9120)     }
9121) }
9122) /**
9123)  * @desc defines how a raw task is converted into a real task and provides information to the user how to form the raw task
9124)  * @author fenris
9125)  */
9126) class class_tasktemplate {
Christian Fraß update

Christian Fraß authored 6 years ago

9127)     /**
9128)      * @author fenris
9129)      */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

9130)     constructor({ "description": description = null, "parameters": parameters = [], "factory": factory, }) {
9131)         this.description = description;
9132)         this.parameters = parameters;
9133)         this.factory = factory;
9134)     }
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

9135)     /**
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

9136)      * @desc converts raw parameter values to real ones
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

9137)      * @author fenris
9138)      */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

9139)     convert(object_raw, task_name) {
9140)         let object_ready = {};
9141)         this.parameters.forEach(parameter => {
9142)             let value_raw;
9143)             if ((object_raw != null) && (parameter.name in object_raw)) {
9144)                 value_raw = object_raw[parameter.name];
9145)             }
9146)             else {
9147)                 if (parameter.default_.is_nothing()) {
9148)                     throw (new Error(`mandatory parameter '${parameter.name}' is missing in task '${task_name}'`));
9149)                 }
9150)                 else {
9151)                     value_raw = parameter.default_.cull();
9152)                 }
9153)             }
9154)             let messages = parameter.shape.inspect(value_raw);
9155)             if (messages.length > 0) {
9156)                 let message = "";
9157)                 message += `given value '${instance_show(value_raw)}'`;
9158)                 message += ` for parameter '${parameter.name}'`;
9159)                 message += ` with shape '${instance_show(parameter.shape)}'`;
9160)                 message += ` is malformed`;
9161)                 message += `: ${messages.join("; ")}`;
9162)                 throw (new Error(message));
9163)             }
9164)             else {
9165)                 let value_ready = parameter.extraction(value_raw);
9166)                 object_ready[parameter.name] = value_ready;
9167)             }
9168)         });
9169)         if (object_raw != null) {
9170)             Object.keys(object_raw)
9171)                 .filter(key => (!this.parameters.some(parameter => (parameter.name == key))))
9172)                 .forEach(key => {
9173)                 (new class_message(`unrecognized parameter '${key}' in task '${task_name}'`, { "type": "warning", "prefix": "koralle" })).stderr();
9174)             });
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

9175)         }
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

9176)         return object_ready;
9177)     }
Christian Fraß update

Christian Fraß authored 6 years ago

9178)     /**
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

9179)      * @desc does the actual conversion to a real task
Christian Fraß update

Christian Fraß authored 6 years ago

9180)      * @author fenris
9181)      */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

9182)     create(rawtask, nameprefix = null) {
9183)         let data = this.convert(rawtask.parameters, rawtask.name);
9184)         let stuff = this.factory(data, rawtask);
9185)         let name = "";
9186)         {
9187)             name = ((rawtask.name != undefined) ? rawtask.name : lib_string.generate("task_"));
9188)             if (nameprefix != null) {
9189)                 name = `${nameprefix}-${name}`;
9190)             }
9191)         }
9192)         let active;
9193)         {
9194)             active = ((rawtask.active != undefined) ? rawtask.active : true);
9195)         }
9196)         let sub = [];
9197)         {
9198)             if (rawtask["sub"] != undefined) {
9199)                 sub = sub.concat(rawtask.sub.map(rawtask_ => class_tasktemplate.create(rawtask_, nameprefix)));
9200)             }
9201)             if (stuff["sub"] != undefined) {
9202)                 sub = sub.concat(stuff["sub"]);
9203)             }
9204)         }
9205)         let inputs = (stuff["inputs"] || []);
9206)         let outputs = (stuff["outputs"] || []);
9207)         let actions = (stuff["actions"] || []);
9208)         return (new class_task({
9209)             "name": name,
9210)             "active": active,
9211)             "sub": sub,
9212)             "inputs": inputs,
9213)             "outputs": outputs,
9214)             "actions": actions,
9215)         }));
9216)     }
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

9217)     /**
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

9218)      * @desc adds a tasktemplate to the pool
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

9219)      * @author fenris
9220)      */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

9221)     static register(id, tasktemplate) {
9222)         this.pool[id] = tasktemplate;
9223)     }
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

9224)     /**
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

9225)      * @desc retrieves a registered tasktemplate from the pool
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

9226)      * @author fenris
9227)      */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

9228)     static get(id) {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

9229)         if (id in this.pool) {
9230)             return this.pool[id];
9231)         }
9232)         else {
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

9233)             throw (new Error(`no task registered with name '${id}'`));
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

9234)         }
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

9236)     /**
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

9237)      * @desc searches for the corresponding registered tasktemplate and creates a real task
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

9238)      * @author fenris
9239)      */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

9240)     static create(rawtask, nameprefix = null) {
9241)         let tasktemplate = this.get(rawtask.type);
9242)         return tasktemplate.create(rawtask, nameprefix);
9243)     }
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

9244)     /**
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

9245)      * @desc returns an overview over all available tasktemplates in markdown format
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

9246)      * @author fenris
9247)      */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

9248)     static list() {
9249)         let str = "";
9250)         lib_object.to_array(this.pool).forEach(({ "key": id, "value": tasktemplate }) => {
9251)             str += lib_markdown.section(2, "Task '" + lib_markdown.code(id) + "'");
9252)             {
9253)                 str += lib_markdown.section(3, "Description");
9254)                 str += lib_markdown.paragraph(((tasktemplate.description != null) ? tasktemplate.description : "(missing)"));
9255)                 str += lib_markdown.paragraph();
9256)             }
9257)             {
9258)                 str += lib_markdown.section(3, "Parameters");
9259)                 tasktemplate.parameters.forEach(taskparameter => {
9260)                     let str_ = "";
9261)                     {
9262)                         // name
9263)                         {
9264)                             str_ += lib_markdown.paragraph(lib_markdown.code(taskparameter.name));
9265)                         }
9266)                         // shape
9267)                         {
9268)                             str_ += lib_markdown.listitem(2, "type: " + lib_markdown.italic(instance_show(taskparameter.shape)));
9269)                         }
9270)                         // kind
9271)                         {
9272)                             let content;
9273)                             if (taskparameter.default_.is_nothing()) {
9274)                                 content = "mandatory";
9275)                             }
9276)                             else {
9277)                                 content = ("optional (default: " + lib_markdown.code(instance_show(taskparameter.default_.cull())) + ")");
9278)                             }
9279)                             str_ += lib_markdown.listitem(2, "kind: " + content);
9280)                         }
9281)                         // description
9282)                         {
9283)                             str_ += lib_markdown.listitem(2, "description: " + ((taskparameter.description == null) ? "(missing)" : taskparameter.description));
9284)                         }
9285)                     }
9286)                     str += lib_markdown.listitem(1, str_);
9287)                 });
9288)                 str += lib_markdown.paragraph();
9289)             }
9290)         });
9291)         return str;
9292)     }
9293) }
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

9294) /**
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

9295)  * @desc holds the registered tasktemplates
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

9296)  * @author fenris
9297)  */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

9298) class_tasktemplate.pool = {};
Christian Fraß update

Christian Fraß authored 6 years ago

9299) /**
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

9300)  * @desc a tasktemplate for tasks which have a single input and a single output
Christian Fraß update

Christian Fraß authored 6 years ago

9301)  * @author fenris
9302)  */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

9303) class class_tasktemplate_transductor extends class_tasktemplate {
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

9304)     /**
9305)      * @author fenris
9306)      */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

9307)     constructor({ "description": description = null, "parameters_additional": parameters_additional = [], "factory": factory, }) {
9308)         super({
9309)             "description": description,
9310)             "parameters": ([
9311)                 class_taskparameter.input_single(),
9312)                 class_taskparameter.output_single(),
9313)             ]
9314)                 .concat(parameters_additional)),
9315)             "factory": factory,
9316)         });
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

9317)     }
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

9319) /**
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

9320)  * @desc a tasktemplate for tasks which have a list of inputs and a single output
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

9321)  * @author fenris
9322)  */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

9323) class class_tasktemplate_aggregator extends class_tasktemplate {
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

9324)     /**
9325)      * @author fenris
9326)      */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

9327)     constructor({ "description": description = null, "parameters_additional": parameters_additional = [], "factory": factory, }) {
9328)         super({
9329)             "description": description,
9330)             "parameters": ([
9331)                 class_taskparameter.input_single({ "default": new class_just("DUMMY") }),
9332)                 class_taskparameter.input_list({ "default": new class_just([]) }),
9333)                 class_taskparameter.input_schwamm({ "default": new class_just(null) }),
9334)                 class_taskparameter.output_single(),
9335)             ]
9336)                 .concat(parameters_additional)),
9337)             "factory": factory,
9338)         });
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

9340)     /**
9341)      * @author fenris
9342)      */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

9343)     static inputs_all(data) {
9344)         return ([]
9345)             .concat((data["input"].as_string().includes("DUMMY"))
9346)             ? []
9347)             : [data["input"]])
9348)             .concat(data["inputs"])
9349)             .concat((data["input_from_schwamm"] == null)
9350)             ? []
9351)             : data["input_from_schwamm"]));
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

9352)     }
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

9354) /**
9355)  * @author fenris
9356)  */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

9357) class_tasktemplate.register("group", new class_tasktemplate({
9358)     "description": "does nothing but executing the sub tasks",
9359)     "factory": (data) => {
9360)         return {};
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

9361)     }
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

9363) /**
9364)  * @author fenris
9365)  */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

9366) function task_each_generate_output(input_raw, output_description, index) {
9367)     switch (output_description.kind) {
9368)         case "replace": {
9369)             let regexp = new RegExp(output_description.parameters["from"]);
9370)             // let filter : boolean = ((output_description.parameters["filter"] == undefined) || (output_description.parameters["from"] == true));
9371)             let execute = true;
9372)             if (execute) {
9373)                 let output_raw = input_raw.replace(regexp, output_description.parameters["to"]);
9374)                 if (input_raw == output_raw) {
9375)                     (new class_message(`replacement for input '${input_raw}' resulted in the same string`, {
9376)                         "type": "warning",
9377)                         "prefix": "koralle"
9378)                     })).stderr();
9379)                 }
9380)                 return output_raw;
9381)             }
9382)             else {
9383)                 return null;
9384)             }
9385)             break;
9386)         }
9387)         case "enumerate": {
9388)             let folder = (output_description["parameters"]["folder"] || "build/");
9389)             let prefix = (output_description["parameters"]["prefix"] || "output_");
9390)             let suffix = (output_description["parameters"]["suffix"]);
9391)             let output_raw = (folder + "/" + prefix + index.toString() + ((suffix == null) ? "" : ("." + suffix)));
9392)             return output_raw;
9393)             break;
9394)         }
9395)         default: {
9396)             throw (new Error(`unhandled kind '${output_description.kind}'`));
9397)             break;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

9398)         }
9399)     }
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

9401) /**
9402)  * @author fenris
9403)  */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

9404) class_tasktemplate.register("each", new class_tasktemplate({
9405)     "description": "executes a specific task for a list of inputs",
9406)     "parameters": [
9407)         class_taskparameter.input_list({ "default": new class_just([]) }),
9408)         class_taskparameter.input_schwamm({ "default": new class_just(null) }),
9409)         new class_taskparameter({
9410)             "name": "element_type",
9411)             "shape": lib_meta.from_raw({ "id": "string" }),
9412)             "default": new class_nothing(),
9413)             "description": "the type of the inner task"
9414)         }),
9415)         new class_taskparameter({
9416)             "name": "element_parameters",
9417)             "shape": lib_meta.from_raw({ "id": "any" }),
9418)             "default": new class_just({}),
9419)             "description": "the parameters for the inner task"
9420)         }),
9421)         new class_taskparameter({
9422)             "name": "output_description",
9423)             "shape": lib_meta.from_raw({ "id": "any" }),
9424)             "default": new class_nothing(),
9425)             "description": "how the output paths are generated"
9426)         }),
9427)     ],
9428)     "factory": (data, rawtask) => {
9429)         let inputs = data["inputs"].concat(data["input_from_schwamm"]);
9430)         return {
9431)             "sub": inputs.map((input, index) => {
9432)                 let input_raw = input.as_string();
9433)                 let output_raw = task_each_generate_output(input_raw, data["output_description"], index);
9434)                 if (output_raw == null) {
9435)                     return null;
9436)                 }
9437)                 else {
9438)                     return (class_tasktemplate.create({
9439)                         "name": index.toString(),
9440)                         "type": data["element_type"],
9441)                         "parameters": lib_object.patched(data["element_parameters"], {
9442)                             "input": input_raw,
9443)                             "output": output_raw,
9444)                         })
9445)                     }, rawtask["name"]));
9446)                 }
9447)             }).filter(x => (x != null)),
9448)         };
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

9449)     }
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

9451) /**
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

9453)  */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

9454) class_tasktemplate.register("empty", new class_tasktemplate({
9455)     "description": "creates an empty output file",
9456)     "parameters": [
9457)         new class_taskparameter({
9458)             "name": "output",
9459)             "extraction": raw => lib_path.filepointer_read(raw),
9460)             "shape": lib_meta.from_raw({ "id": "string" }),
9461)             "default": new class_nothing(),
9462)             "description": "the path to the output file"
9463)         })
9464)     ],
9465)     "factory": (data) => {
9466)         return {
9467)             "outputs": [data["output"]],
9468)             "actions": [
9469)                 new class_action_mkdir(data["output"].location),
9470)                 new class_action_touch(data["output"]),
9471)             ],
9472)         };
9473)     }
9474) }));
9475) /**
9476)  * @author fenris
9477)  */
9478) class_tasktemplate.register("copy", new class_tasktemplate_transductor({
9479)     "description": "copies a file",
9480)     "parameters_additional": [
9481)         new class_taskparameter({
9482)             "name": "folder",
9483)             "default": new class_just(false),
9484)         }),
9485)     ],
9486)     "factory": (data) => {
9487)         return {
9488)             "inputs": [data["input"]],
9489)             "outputs": /*[data["output"]]*/ [],
9490)             "actions": [
9491)                 new class_action_mkdir(data["output"].location),
9492)                 new class_action_copy(data["input"], data["output"], data["folder"]),
9493)             ],
9494)         };
9495)     }
9496) }));
9497) /**
9498)  * @author fenris
9499)  */
9500) class_tasktemplate.register("concat", new class_tasktemplate_aggregator({
9501)     "description": "concatenates a list of files",
9502)     "factory": (data) => {
9503)         let inputs = class_tasktemplate_aggregator.inputs_all(data);
9504)         let output = data["output"];
9505)         return {
9506)             "inputs": inputs,
9507)             "outputs": [output],
9508)             "actions": [
9509)                 new class_action_mkdir(output.location),
9510)                 new class_action_concat(inputs, output),
9511)             ],
9512)         };
9513)     }
9514) }));
9515) /**
9516)  * @author fenris
9517)  */
9518) class_tasktemplate.register("typescript", new class_tasktemplate_aggregator({
9519)     "description": "compiles a list of typescript input files to a single javascript output file",
9520)     "parameters_additional": [
9521)         new class_taskparameter({
9522)             "name": "declaration",
9523)             "extraction": raw => ((raw == null) ? null : lib_path.filepointer_read(raw)),
9524)             "shape": lib_meta.from_raw({ "id": "string", "parameters": { "soft": true } }),
9525)             "default": new class_just(null),
9526)             "description": "the path of the file in which to write the declaration; if not set, no declaration-script will be created",
9527)         }),
9528)         new class_taskparameter({
9529)             "name": "target",
9530)             "shape": lib_meta.from_raw({ "id": "string", "parameters": { "soft": true } }),
9531)             "default": new class_just(null),
9532)             "description": "the tsc-switch 'target'; value NULL means 'don't specify'",
9533)         }),
9534)         new class_taskparameter({
9535)             "name": "allowUnreachableCode",
9536)             "shape": lib_meta.from_raw({ "id": "boolean", "parameters": { "soft": true } }),
9537)             "default": new class_just(null),
9538)             "description": "the tsc-switch 'allowUnreachableCode'; value NULL means 'don't specify'",
9539)         }),
9540)     ],
9541)     "factory": (data) => {
9542)         let inputs = class_tasktemplate_aggregator.inputs_all(data);
9543)         let outputs = [data["output"]];
9544)         let actions = [
9545)             new class_action_mkdir(data["output"].location),
9546)             new class_action_tsc(inputs, data["output"], data["target"], data["allowUnreachableCode"], data["declaration"]),
9547)         ];
9548)         if (data["declaration"] != null) {
9549)             outputs = outputs.concat([
9550)                 data["declaration"],
9551)             ]);
9552)             actions = actions.concat([
9553)                 new class_action_mkdir(data["declaration"].location),
9554)                 new class_action_move({
9555)                     "from": new lib_path.class_filepointer(data["output"].location, data["output"].filename.replace(new RegExp(".js$"), ".d.ts")),
9556)                     "to": data["declaration"],
9557)                 }),
9558)             ]);
9559)         }
9560)         return {
9561)             "inputs": inputs,
9562)             "outputs": outputs,
9563)             "actions": actions,
9564)         };
9565)     },
9566) }));
9567) /**
9568)  * @author fenris
9569)  */
9570) class_tasktemplate.register("lesscss", new class_tasktemplate_aggregator({
9571)     "description": "compiles a list of lesscss input files to a single css output file",
9572)     "factory": (data) => {
9573)         let filepointer_temp = new lib_path.class_filepointer(lib_path.location_read(globalvars.configuration["tempfolder"]), "_.less");
9574)         return {
9575)             "inputs": class_tasktemplate_aggregator.inputs_all(data),
9576)             "outputs": data["outputs"],
9577)             "actions": [
9578)                 new class_action_mkdir(data["output"].location),
9579)                 new class_action_concat(class_tasktemplate_aggregator.inputs_all(data), filepointer_temp),
9580)                 new class_action_lessc(filepointer_temp, data["output"]),
9581)             ],
9582)         };
9583)     },
9584) }));
9585) /**
9586)  * @author fenris
9587)  */
9588) class_tasktemplate.register("php", new class_tasktemplate_aggregator({
9589)     "description": "compiles a list of php input files to a single output file",
9590)     "parameters_additional": [
9591)         new class_taskparameter({
9592)             "name": "only_last",
9593)             "shape": lib_meta.from_raw({ "id": "boolean" }),
9594)             "default": new class_just(false),
9595)             "description": "only compile the last file in the list and use the others as dependencies",
9596)         }),
9597)     ],
9598)     "factory": (data) => {
9599)         let inputs = class_tasktemplate_aggregator.inputs_all(data);
9600)         return {
9601)             "inputs": inputs,
9602)             "outputs": data["outputs"],
9603)             "actions": [
9604)                 new class_action_mkdir(data["output"].location),
9605)                 new class_action_php(inputs, data["output"], data["only_last"]),
9606)             ],
9607)         };
9608)     },
9609) }));
9610) /**
9611)  * @author fenris,neu3no
9612)  */
9613) class_tasktemplate.register("babel", new class_tasktemplate_aggregator({
9614)     "description": "executes the babel transpiler",
9615)     "parameters_additional": [
9616)         new class_taskparameter({
9617)             "name": "preset",
9618)             "shape": lib_meta.from_raw({ "id": "string" }),
9619)             "default": new class_just(null),
9620)             "description": "[deprecated] single plugin; use 'presets' parameter instead (you can still use this parameter; its value is added to the plugin list)",
9621)         }),
9622)         new class_taskparameter({
9623)             "name": "presets",
9624)             "shape": lib_meta.from_raw({ "id": "array", "parameters": { "shape_element": { "id": "string" } } }),
9625)             "default": new class_just([]),
9626)             "description": "a list of presets to use",
9627)         }),
9628)         new class_taskparameter({
9629)             "name": "plugins",
9630)             "shape": lib_meta.from_raw({ "id": "array", "parameters": { "shape_element": { "id": "string" } } }),
9631)             "default": new class_just([]),
9632)             "description": "a list of plugins to use",
9633)         }),
9634)         new class_taskparameter({
9635)             "name": "minify",
9636)             "shape": lib_meta.from_raw({ "id": "boolean" }),
9637)             "default": new class_just(false),
9638)             "description": "whether to pass the 'minify' argument to the babel command",
9639)         }),
9640)     ],
9641)     "factory": (data) => {
9642)         let inputs = class_tasktemplate_aggregator.inputs_all(data);
9643)         return {
9644)             "inputs": inputs,
9645)             "outputs": [data["output"]],
9646)             "actions": [
9647)                 new class_action_mkdir(data["output"].location),
9648)                 new class_action_babel(inputs, data["output"], data["presets"].concat((data["preset"] == null) ? [] : [data["preset"]]), data["plugins"], data["minify"]),
9649)             ],
9650)         };
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

9651)     }
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

9652) }));
9653) /**
9654)  * @author fenris
9655)  */
9656) class_tasktemplate.register("schwamm", new class_tasktemplate({
9657)     "description": null,
9658)     "parameters": [
9659)         new class_taskparameter({
9660)             "name": "includes",
9661)             "extraction": raw => raw.map(path => lib_path.filepointer_read(path)),
9662)             "shape": lib_meta.from_raw({
9663)                 "id": "array",
9664)                 "parameters": {
9665)                     "shape_element": {
9666)                         "id": "string"
9667)                     }
9668)                 }
9669)             }),
9670)             "default": new class_just([]),
9671)         }),
9672)         new class_taskparameter({
9673)             "name": "inputs",
9674)             "extraction": raw => lib_object.map(raw, paths => paths.map(path => lib_path.filepointer_read(path))),
9675)             "shape": lib_meta.from_raw({
9676)                 "id": "map",
9677)                 "parameters": {
9678)                     "shape_key": {
9679)                         "id": "string"
9680)                     },
9681)                     "shape_value": {
9682)                         "id": "array",
9683)                         "parameters": {
9684)                             "shape_element": {
9685)                                 "id": "string"
9686)                             }
9687)                         }
9688)                     }
9689)                 }
9690)             }),
9691)             "default": new class_just({}),
9692)         }),
9693)         new class_taskparameter({
9694)             "name": "output",
9695)             "extraction": raw => {
9696)                 let result = {};
9697)                 if ("save" in raw) {
9698)                     result["save"] = lib_path.filepointer_read(raw["save"]);
9699)                 }
9700)                 if ("dump" in raw) {
9701)                     result["dump"] = lib_object.map(raw["dump"], path => lib_path.filepointer_read(path));
9702)                 }
9703)                 return result;
9704)             },
9705)             "shape": lib_meta.from_raw({
9706)                 "id": "object",
9707)                 "parameters": {
9708)                     "fields": [
9709)                         {
9710)                             "name": "save",
9711)                             "shape": {
9712)                                 "id": "string",
9713)                                 "parameters": {
9714)                                     "soft": true
9715)                                 }
9716)                             }
9717)                         },
9718)                         {
9719)                             "name": "dump",
9720)                             "shape": {
9721)                                 "id": "map",
9722)                                 "parameters": {
9723)                                     "shape_key": {
9724)                                         "id": "string"
9725)                                     },
9726)                                     "shape_value": {
9727)                                         "id": "string"
9728)                                     },
9729)                                     "soft": true
9730)                                 }
9731)                             }
9732)                         }
9733)                     ]
9734)                 }
9735)             }),
9736)         }),
9737)     ],
9738)     "factory": (data) => {
9739)         let inputs = [];
9740)         let outputs = [];
9741)         let actions = [];
9742)         // includes
9743)         {
9744)             inputs = inputs.concat(data["includes"]);
9745)         }
9746)         // inputs
9747)         {
9748)             inputs = inputs.concat(lib_object.values(data["inputs"]).reduce((x, y) => x.concat(y), []));
9749)         }
9750)         // output
9751)         {
9752)             if ("save" in data["output"]) {
9753)                 outputs = outputs.concat(data["output"]["save"]);
9754)                 actions = actions.concat([
9755)                     new class_action_mkdir(data["output"]["save"].location),
9756)                     new class_action_schwamm(data["includes"], data["inputs"], data["output"]["save"]),
9757)                 ]);
9758)             }
9759)             if ("dump" in data["output"]) {
9760)                 outputs = outputs.concat(lib_object.values(data["output"]["dump"]).reduce((x, y) => x.concat(y), []));
9761)                 actions = actions.concat(lib_object.to_array(data["output"]["dump"])
9762)                     .map(({ "key": key, "value": value }) => [
9763)                     new class_action_mkdir(value.location),
9764)                     new class_action_schwamm(data["includes"], data["inputs"], undefined, key, value),
9765)                 ])
9766)                     .reduce((x, y) => x.concat(y), []));
9767)             }
9768)         }
9769)         return {
9770)             "inputs": inputs,
9771)             "outputs": outputs,
9772)             "actions": actions,
9773)         };
9774)     },
9775) }));
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

9776) /**
9777)  * @author fenris
9778)  */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

9779) class_tasktemplate.register("schwamm-create", new class_tasktemplate({
9780)     "description": null,
9781)     "parameters": [
9782)         new class_taskparameter({
9783)             "name": "includes",
9784)             "extraction": raw => raw.map(path => lib_path.filepointer_read(path)),
9785)             "shape": lib_meta.from_raw({
9786)                 "id": "array",
9787)                 "parameters": {
9788)                     "shape_element": {
9789)                         "id": "string"
9790)                     }
9791)                 }
9792)             }),
9793)             "default": new class_just([]),
9794)         }),
9795)         new class_taskparameter({
9796)             "name": "adhoc",
9797)             "extraction": raw => lib_object.map(raw, paths => paths.map(path => lib_path.filepointer_read(path))),
9798)             "shape": lib_meta.from_raw({
9799)                 "id": "map",
9800)                 "parameters": {
9801)                     "shape_key": {
9802)                         "id": "string"
9803)                     },
9804)                     "shape_value": {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

9805)                         "id": "array",
9806)                         "parameters": {
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

9807)                             "shape_element": {
9808)                                 "id": "string"
9809)                             }
9810)                         }
9811)                     }
9812)                 }
9813)             }),
9814)             "default": new class_just({}),
9815)         }),
9816)         class_taskparameter.output_single(),
9817)     ],
9818)     "factory": (data) => {
9819)         let inputs = [];
9820)         let outputs = [];
9821)         let actions = [];
9822)         // includes
9823)         {
9824)             inputs = inputs.concat(data["includes"]);
9825)         }
9826)         // adhoc
9827)         {
9828)             inputs = inputs.concat(lib_object.values(data["adhoc"]).reduce((x, y) => x.concat(y), []));
9829)         }
9830)         // output
9831)         {
9832)             outputs = outputs.concat([data["output"]]);
9833)             actions = actions.concat([
9834)                 new class_action_mkdir(data["output"].location),
9835)                 new class_action_schwamm(data["includes"], data["adhoc"], data["output"]),
9836)             ]);
9837)         }
9838)         return {
9839)             "inputs": inputs,
9840)             "outputs": outputs,
9841)             "actions": actions,
9842)         };
9843)     },
9844) }));
Christian Fraß update

Christian Fraß authored 6 years ago

9845) /**
9846)  * @author fenris
9847)  */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

9848) class_tasktemplate.register("schwamm-apply", new class_tasktemplate({
9849)     "description": null,
9850)     "parameters": [
9851)         new class_taskparameter({
9852)             "name": "path",
9853)             "extraction": raw => lib_path.filepointer_read(raw),
9854)             "shape": lib_meta.from_raw({ "id": "string" }),
9855)         }),
9856)         new class_taskparameter({
9857)             "name": "outputs",
9858)             "extraction": raw => lib_object.map(raw, paths => paths.map(path => lib_path.filepointer_read(path))),
9859)             "shape": lib_meta.from_raw({
9860)                 "id": "map",
9861)                 "parameters": {
9862)                     "shape_key": {
9863)                         "id": "string"
9864)                     },
9865)                     "shape_value": {
9866)                         "id": "array",
9867)                         "parameters": {
9868)                             "shape_element": {
9869)                                 "id": "string"
9870)                             }
9871)                         }
9872)                     }
9873)                 }
9874)             }),
9875)             "default": new class_just({}),
9876)         }),
9877)     ],
9878)     "factory": (data) => {
9879)         let inputs = [];
9880)         let outputs = [];
9881)         let actions = [];
9882)         // path
9883)         {
9884)             inputs = inputs.concat([data["path"]]);
9885)         }
9886)         // output
9887)         {
9888)             outputs = outputs.concat(lib_object.values(data["output"]).reduce((x, y) => x.concat(y), []));
9889)             actions = actions.concat(lib_object.to_array(data["output"])
9890)                 .map(({ "key": key, "value": value }) => [
9891)                 new class_action_mkdir(value.location),
9892)                 new class_action_schwamm([data["path"]], {}, undefined, key, value),
Christian Fraß update

Christian Fraß authored 6 years ago

9893)             ])
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

9894)                 .reduce((x, y) => x.concat(y), []));
9895)         }
9896)         return {
9897)             "inputs": inputs,
9898)             "outputs": outputs,
9899)             "actions": actions,
9900)         };
9901)     },
9902) }));
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

9903) /**
9904)  * @author fenris
9905)  */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

9906) class_tasktemplate.register("locmerge", new class_tasktemplate_aggregator({
9907)     "description": "executes a locmerge command",
9908)     "parameters_additional": [],
9909)     "factory": (data) => {
9910)         let inputs = class_tasktemplate_aggregator.inputs_all(data);
9911)         return {
9912)             "inputs": inputs,
9913)             "outputs": [],
9914)             "actions": [
9915)                 new class_action_mkdir(data["output"].location),
9916)                 new class_action_locmerge(inputs, data["output"]),
9917)             ],
9918)         };
9919)     },
9920) }));
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

9921) /**
9922)  * @author fenris
9923)  */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

9924) class_tasktemplate.register("script", new class_tasktemplate({
9925)     "description": "executes an external script",
9926)     "parameters": [
9927)         class_taskparameter.input_list({ "default": new class_just([]) }),
9928)         class_taskparameter.output_list({ "default": new class_just([]) }),
9929)         new class_taskparameter({
9930)             "name": "path",
9931)             "extraction": raw => lib_path.filepointer_read(raw),
9932)             "shape": lib_meta.from_raw({ "id": "string" }),
9933)             "default": new class_nothing(),
9934)             "description": "the path to the script",
9935)         }),
9936)         new class_taskparameter({
9937)             "name": "interpreter",
9938)             "extraction": raw => ((raw == null) ? null : lib_path.filepointer_read(raw)),
9939)             "shape": lib_meta.from_raw({ "id": "string", "parameters": { "soft": true } }),
9940)             "default": new class_just(null),
9941)             "description": "the path to the interpreter to use; if value NULL is given, it is assumed that the script is self-executable",
9942)         }),
9943)         new class_taskparameter({
9944)             "name": "workdir",
9945)             "extraction": raw => ((raw == null) ? null : lib_path.location_read(raw)),
9946)             "shape": lib_meta.from_raw({ "id": "string", "parameters": { "soft": true } }),
9947)             "default": new class_just(null),
9948)             "description": "the path to the directory from where the script shall be executed; if value NULL is given, the workdir is the location of the script",
9949)         }),
9950)     ],
9951)     "factory": (data) => {
9952)         return {
9953)             "inputs": data["inputs"],
9954)             "outputs": data["outputs"],
9955)             "actions": ([]
9956)                 .concat(data["outputs"].map(output => new class_action_mkdir(output.location)))
9957)                 .concat([
9958)                 new class_action_exec({
9959)                     "inputs": data["inputs"],
9960)                     "outputs": data["outputs"],
9961)                     "path": data["path"],
9962)                     "interpreter": data["interpreter"],
9963)                     "workdir": data["workdir"],
9964)                 }),
9965)             ])),
9966)         };
9967)     },
9968) }));
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

9969) /**
9970)  * @author fenris
9971)  */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

9972) class class_target {
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

9973)     /**
9974)      * @author fenris
9975)      */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

9976)     constructor() {
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

9977)     }
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

9979) /**
9980)  * @author fenris
9981)  */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

9982) class class_target_regular extends class_target {
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

9983)     /**
9984)      * @author fenris
9985)      */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

9986)     constructor(identifier) {
9987)         super();
9988)         this.identifier = identifier;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

9989)     }
9990)     /**
9991)      * @author fenris
9992)      */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

9993)     compile_action(action) {
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

9994)         if (action instanceof class_action_adhoc) {
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

9995)             let action_ = (action);
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

9996)             return (action_.compilation(this.identifier));
9997)         }
9998)         else {
9999)             throw (new Error("no delegation for action '" + JSON.stringify(action) + "'"));
10000)         }
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

10003) /**
10004)  * @author fenris
10005)  */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

10006) class class_target_ant extends class_target_regular {
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

10007)     /**
10008)      * @author fenris
10009)      */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

10010)     constructor() {
10011)         super("ant");
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

10013)     /**
10014)      * @override
10015)      * @author fenris
10016)      */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

10017)     tempfolder() {
Christian Fraß update

Christian Fraß authored 6 years ago

10018)         switch (globalvars.configuration.system) {
10019)             case "linux": {
10020)                 return "/tmp/";
10021)                 break;
10022)             }
10023)             case "bsd": {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

10024)                 return "/tmp/";
10025)                 break;
10026)             }
10027)             case "win": {
10028)                 return "${env.TEMP}\\";
10029)                 break;
10030)             }
10031)             default: {
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

10032)                 throw (new Error(`invalid system '${globalvars.configuration.system}'`));
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

10033)                 break;
10034)             }
10035)         }
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

10037)     /**
10038)      * @author fenris
10039)      */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

10040)     compile_task({ "task": task, "path": path = [], "context": context = null, }) {
10041)         let aggregate = false;
10042)         let path_ = path_augment(path, task.name_get(), aggregate);
10043)         let targets_core = [
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

10044)             new lib_ant.class_target({
Christian Fraß update

Christian Fraß authored 6 years ago

10045)                 "name": path_dump(path_),
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

10046)                 "dependencies": (task.sub_get()
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

10047)                     .filter(task_ => task_.active_get())
10048)                     .map(task_ => path_dump(path_augment(path_, task_.name_get(), aggregate)))),
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

10049)                 "actions": ([]
Christian Fraß update

Christian Fraß authored 6 years ago

10050)                     .concat((context == null)
10051)                     ? ([]
10052)                         .concat(task.actions()
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

10053)                         .map(action => this.compile_action(action))))
Christian Fraß update

Christian Fraß authored 6 years ago

10054)                     : [
10055)                         new lib_ant.class_action(new lib_xml.class_node_complex("ant", {
10056)                             "antfile": "${ant.file}",
10057)                             "dir": context.as_string("linux"),
10058)                             "target": path_dump(path_augment(path_, name_mark("inner"))),
10059)                             "inheritAll": String(true),
10060)                             "inheritRefs": String(true),
10061)                         })),
10062)                     ]))
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

10063)             })
10064)         ];
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

10065)         let targets_sub = []
Christian Fraß update

Christian Fraß authored 6 years ago

10066)             .concat((context == null)
10067)             ? []
10068)             : [
10069)                 new lib_ant.class_target({
10070)                     "name": path_dump(path_augment(path_, name_mark("inner"))),
10071)                     "dependencies": [],
10072)                     "actions": (task.actions()
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

10073)                         .map(action => this.compile_action(action))),
Christian Fraß update

Christian Fraß authored 6 years ago

10074)                 })
10075)             ])
10076)             .concat(task.sub_get()
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

10077)             .map(task_ => this.compile_task({
Christian Fraß update

Christian Fraß authored 6 years ago

10078)             "task": task_,
10079)             "path": path_,
10080)             "context": ((context == null) ? task_.context_get() : ((task_.context_get() == null) ? context : context.relocate(task_.context_get()))),
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

10081)         }))
10082)             .reduce((x, y) => x.concat(y), []));
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

10083)         return [].concat(targets_core).concat(targets_sub);
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

10085)     /**
10086)      * @author fenris
10087)      */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

10088)     compile_project(project) {
10089)         let comments = [
10090)             `Project \"${project.name_get()}\"`,
10091)             `This build script was generated by Koralle ${globalvars.configuration.version}`,
10092)         ].map(x => new lib_ant.class_comment(x));
10093)         let targets = this.compile_task({ "task": project.roottask_get() });
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

10094)         return (new lib_ant.class_project({
10095)             "name": project.name_get(),
Christian Fraß update

Christian Fraß authored 6 years ago

10096)             "default": name_mark("root"),
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

10097)             "comments": comments,
10098)             "targets": targets,
10099)         }));
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

10101)     /**
10102)      * @override
10103)      * @author fenris
10104)      */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

10105)     compile_project_string(project) {
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

10106)         return this.compile_project(project).compile().compile();
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

10108)     /**
10109)      * @override
10110)      * @author fenris
10111)      */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

10112)     execute(filepointer, workdir = ".") {
10113)         return ((resolve, reject) => {
10114)             let cp = nm_child_process.spawn("ant", [
10115)                 `-f`,
10116)                 `${filepointer.as_string(globalvars.configuration.system)}`,
Christian Fraß update

Christian Fraß authored 6 years ago

10117)             ], {});
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

10118)             cp.stdout.on("data", [x => x.toString(), x => x.slice(0, x.length - 1), console.log].reduce(lib_call.compose));
10119)             cp.stderr.on("data", [x => x.toString(), x => x.slice(0, x.length - 1), console.error].reduce(lib_call.compose));
10120)             cp.on("error", error => reject(new class_error("subprocess not finish successfully", [error])));
10121)             cp.on("close", code => {
Christian Fraß update

Christian Fraß authored 6 years ago

10122)                 if (code == 0) {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

10123)                     resolve(undefined);
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

10124)                 }
10125)                 else {
Christian Fraß update

Christian Fraß authored 6 years ago

10126)                     reject(new Error("unknown error while subprocess execution"));
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

10127)                 }
10128)             });
10129)         });
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

10132) /**
10133)  * @author fenris
10134)  */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

10135) class class_target_gnumake extends class_target_regular {
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

10136)     /**
10137)      * @author fenris
10138)      */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

10139)     constructor() {
10140)         super("gnumake");
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

10142)     /**
10143)      * @override
10144)      * @author fenris
10145)      */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

10146)     tempfolder() {
Christian Fraß update

Christian Fraß authored 6 years ago

10147)         switch (globalvars.configuration.system) {
10148)             case "linux": {
10149)                 return "/tmp/";
10150)                 break;
10151)             }
10152)             case "bsd": {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

10153)                 return "/tmp/";
10154)                 break;
10155)             }
10156)             case "win": {
10157)                 return "%TEMP%\\";
10158)                 break;
10159)             }
10160)             default: {
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

10161)                 throw (new Error(`invalid system '${globalvars.configuration.system}'`));
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

10162)                 break;
10163)             }
10164)         }
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

10166)     /**
10167)      * @author fenris
10168)      */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

10169)     compile_task({ "task": task, "branch": branch = [], "depth": depth = 0, "context": context = null, "prefix": prefix = null }) {
10170)         let log_begin = true;
10171)         let log_end = false;
10172)         let aggregate = false;
10173)         let branch_ = path_augment(branch, task.name_get(), aggregate);
10174)         let logging_begin = new class_action_echo((new class_message(path_dump(branch_), { "type": "log", "depth": depth, "prefix": prefix })).generate());
10175)         let logging_end = new class_action_echo((new class_message("✔", { "type": "log", "depth": depth, "prefix": prefix })).generate());
10176)         let rules_core = [];
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

10177)         {
10178)             // meta rule
10179)             rules_core.push(new lib_gnumake.class_rule({
Christian Fraß update

Christian Fraß authored 6 years ago

10180)                 "name": path_dump(branch_),
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

10181)                 "dependencies": ([]
Christian Fraß update

Christian Fraß authored 6 years ago

10182)                     .concat(log_begin
10183)                     ? [path_dump(path_augment(branch_, name_mark("logging"), true))]
10184)                     : [])
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

10185)                     .concat(task.sub_get()
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

10186)                     .filter(task_ => task_.active_get())
10187)                     .map(task_ => path_dump(path_augment(branch_, task_.name_get(), aggregate))))
10188)                     .concat(task.outputs().map(filepointer => filepointer_adjust(filepointer, context).as_string(globalvars.configuration.system)))),
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

10189)                 "actions": ([]
Christian Fraß update

Christian Fraß authored 6 years ago

10190)                     .concat((task.outputs().length == 0)
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

10191)                     ? task.actions().map(action => dirwrap(context, this.compile_action(action)))
Christian Fraß update

Christian Fraß authored 6 years ago

10192)                     : [])
10193)                     .concat((log_end
10194)                     ? [logging_end]
10195)                     : [])
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

10196)                     .map(action => this.compile_action(action)))),
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

10197)                 "phony": true,
10198)             }));
10199)             // logging
Christian Fraß update

Christian Fraß authored 6 years ago

10200)             if (log_begin) {
10201)                 rules_core.push(new lib_gnumake.class_rule({
10202)                     "name": path_dump(path_augment(branch_, name_mark("logging"), true)),
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

10203)                     "actions": [logging_begin].map(action => this.compile_action(action)),
Christian Fraß update

Christian Fraß authored 6 years ago

10204)                     "phony": true,
10205)                 }));
10206)             }
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

10207)             // actual rule
10208)             if (task.outputs().length > 0) {
10209)                 rules_core.push(new lib_gnumake.class_rule({
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

10210)                     "name": task.outputs().map(filepointer => filepointer_adjust(filepointer, context).as_string(globalvars.configuration.system)).join(" "),
10211)                     "dependencies": task.inputs().map(filepointer => filepointer_adjust(filepointer, context).as_string(globalvars.configuration.system)),
10212)                     "actions": task.actions().map(action => this.compile_action(action)).map(x => dirwrap(context, x)),
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

10213)                     "phony": false,
10214)                 }));
10215)             }
10216)         }
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

10217)         let rules_sub = [];
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

10218)         {
10219)             rules_sub = task.sub_get()
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

10220)                 .map(task_ => this.compile_task({
Christian Fraß update

Christian Fraß authored 6 years ago

10221)                 "task": task_,
10222)                 "branch": branch_,
10223)                 "depth": depth + 1,
10224)                 "context": ((context == null) ? task_.context_get() : ((task_.context_get() == null) ? context : context.relocate(task_.context_get()))),
10225)                 "prefix": prefix,
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

10226)             }))
10227)                 .reduce((x, y) => x.concat(y), []);
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

10229)         return [].concat(rules_core).concat(rules_sub);
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

10231)     /**
10232)      * @author fenris
10233)      */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

10234)     compile_project(project) {
10235)         let comments = [
10236)             `Project \"${project.name_get()}\"`,
10237)             `This makefile was generated by Koralle ${globalvars.configuration.version}`,
10238)         ].map(x => x);
10239)         let rules = this.compile_task({
Christian Fraß update

Christian Fraß authored 6 years ago

10240)             "task": project.roottask_get(),
10241)             "prefix": project.name_get(),
10242)         });
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

10243)         return (new lib_gnumake.class_sheet(rules, comments));
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

10245)     /**
10246)      * @override
10247)      * @author fenris
10248)      */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

10249)     compile_project_string(project) {
Christian Fraß update

Christian Fraß authored 6 years ago

10250)         return (this.compile_project(project).compile(true));
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

10252)     /**
10253)      * @override
10254)      * @author fenris
10255)      */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

10256)     execute(filepointer, workdir = process.cwd()) {
10257)         return ((resolve, reject) => {
10258)             let cp = nm_child_process.spawn("make", [
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

10259)                 // `--directory=${workdir}`,
Christian Fraß update

Christian Fraß authored 6 years ago

10260)                 // `--file=${filepointer.as_string(globalvars.configuration.system)}`,
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

10261)                 `-f`,
10262)                 `${filepointer.as_string(globalvars.configuration.system)}`,
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

10263)             ], {});
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

10264)             cp.stdout.on("data", [x => x.toString(), x => x.slice(0, x.length - 1), console.log].reduce(lib_call.compose));
10265)             cp.stderr.on("data", [x => x.toString(), x => x.slice(0, x.length - 1), console.error].reduce(lib_call.compose));
10266)             cp.on("error", error => reject(new class_error("subprocess not finish successfully", [error])));
10267)             cp.on("close", code => {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

10268)                 if (code == 0) {
10269)                     resolve(undefined);
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

10270)                 }
10271)                 else {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

10272)                     reject(new Error("unknown error while subprocess execution"));
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

10273)                 }
10274)             });
10275)         });
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

10276)     }
10277) }
Christian Fraß update

Christian Fraß authored 6 years ago

10278) /**
10279)  * scans a project and its subprojects and constructs a dependency-graph (more precise: a depth first spanning tree)
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

10280)  * @param {type_depgraphnode} node the filepointer to the project.json, relative to the current working directory
Christian Fraß update

Christian Fraß authored 6 years ago

10281)  * @author fenris
10282)  */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

10283) function scan(node, graph = null, depth = 0) {
Christian Fraß update

Christian Fraß authored 6 years ago

10284)     log("exploring node " + JSON.stringify(node), 4);
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

10285)     let make_node = function (filepointer, rawproject = null) {
10286)         let node = {
10287)             "filepointer": filepointer,
10288)             "rawproject": rawproject
10289)         };
Christian Fraß update

Christian Fraß authored 6 years ago

10290)         return node;
10291)     };
10292)     if (graph == null) {
10293)         log("creating new graph", 4);
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

10294)         graph = new lib_structures.class_graph((x, y) => (x.filepointer.toString() == y.filepointer.toString()));
10295)         graph.add_node(node);
Christian Fraß update

Christian Fraß authored 6 years ago

10296)     }
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

10297)     return ((resolve, reject) => {
Christian Fraß update

Christian Fraß authored 6 years ago

10298)         log("reading description file", 4);
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

10299)         lib_file.read_json(node.filepointer.toString())(data => {
Christian Fraß update

Christian Fraß authored 6 years ago

10300)             log("got data", 4);
10301)             node.rawproject = data;
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

10302)             lib_call.executor_chain(graph, lib_object.fetch(lib_object.fetch(node, "rawproject", {}, 0), "dependencies", [], 0).map(path => graph_ => (resolve_, reject_) => {
Christian Fraß update

Christian Fraß authored 6 years ago

10303)                 log("looking through path " + path, 4);
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

10304)                 let node_ = make_node(node.filepointer.foo(lib_path.filepointer_read(path)));
10305)                 let edge = { "from": node_, "to": node };
10306)                 graph_.add_edge(edge);
Christian Fraß update

Christian Fraß authored 6 years ago

10307)                 if (graph.has(node_)) {
10308)                     // return lib_call.executor_resolve<class_graph<type_depgraphnode>, Error>(graph);
10309)                     resolve_(graph_);
10310)                 }
10311)                 else {
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

10312)                     graph.add_node(node_);
10313)                     scan(node_, graph_, depth + 1)(graph_ => {
Christian Fraß update

Christian Fraß authored 6 years ago

10314)                         resolve_(graph_ /*.hasse()*/);
10315)                     }, reject_);
10316)                 }
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

10317)             }))(resolve, reject);
10318)         }, reason => {
Christian Fraß update

Christian Fraß authored 6 years ago

10319)             reject(reason);
10320)         });
10321)     });
10322) }
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

10323) /**
10324)  * @author fenris
10325)  */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

10326) class class_project {
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

10327)     /**
10328)      * @author fenris
10329)      */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

10330)     constructor(name, version, task) {
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

10331)         this.name = name;
10332)         this.version = version;
Christian Fraß update

Christian Fraß authored 6 years ago

10333)         this.task = task;
10334)         this.graph = null;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

10335)     }
10336)     /**
10337)      * @author fenris
10338)      */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

10339)     name_get() {
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

10340)         return this.name;
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

10342)     /**
10343)      * @author fenris
10344)      */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

10345)     roottask_get() {
Christian Fraß update

Christian Fraß authored 6 years ago

10346)         return this.task;
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

10348)     /**
Christian Fraß update

Christian Fraß authored 6 years ago

10349)      * @desc [mutator] [setter]
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

10350)      * @author fenris
10351)      */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

10352)     graph_set(graph) {
Christian Fraß update

Christian Fraß authored 6 years ago

10353)         this.graph = graph;
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

10355)     /**
Christian Fraß update

Christian Fraß authored 6 years ago

10356)      * @desc [accessor] [getter]
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

10357)      * @author fenris
10358)      */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

10359)     graph_get() {
Christian Fraß update

Christian Fraß authored 6 years ago

10360)         return this.graph;
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

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

Christian Fraß authored 7 years ago

10362)     /**
10363)      * @author fenris
10364)      */
Christian Fraß update

Christian Fraß authored 6 years ago

10365)     /*
10366)     public dependencytasks(output : string) : Array<class_task> {
10367)         return (
10368)             this.dependencies_all.map(
10369)                 function (path : string, index : int) : class_task_dependency {
10370)                     return (
10371)                         new class_task_dependency(
10372)                             {
10373)                                 "name": `__dependency_${index.toString()}`,
10374)                                 "parameters": {
10375)                                     "path": path,
10376)                                     "output": output,
10377)                                     "raw": true,
10378)                                 },
10379)                             }
10380)                         )
10381)                     );
10382)                 }
10383)             )
10384)         );
10385)     }
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

10386)      */
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

10387)     /**
10388)      * @author fenris
10389)      */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

10390)     static create(filepointer, nameprefix = null) {
10391)         return ((resolve, reject) => {
10392)             let node = { "filepointer": filepointer, "rawproject": null };
Christian Fraß update

Christian Fraß authored 6 years ago

10393)             log("scanning dependencies", 3);
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

10394)             scan(node)(graph => {
Christian Fraß update

Christian Fraß authored 6 years ago

10395)                 log("got dependency graph", 3);
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

10396)                 let dependencynodes = null;
10397)                 let error = null;
Christian Fraß update

Christian Fraß authored 6 years ago

10398)                 try {
10399)                     log("applying topsort", 3);
10400)                     dependencynodes = graph
10401)                         .topsort()
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

10402)                         .filter(node => (node.filepointer.toString() != filepointer.toString()));
Christian Fraß update

Christian Fraß authored 6 years ago

10403)                     error = null;
10404)                 }
10405)                 catch (exception) {
10406)                     error = new class_error("could not sort dependencies; probably circular structure", [exception]);
10407)                 }
10408)                 if (error == null) {
10409)                     log("creating core task", 3);
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

10410)                     let core = class_tasktemplate.create(node.rawproject.roottask);
Christian Fraß update

Christian Fraß authored 6 years ago

10411)                     log("creating dependency tasks", 3);
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

10412)                     let dependencies = dependencynodes.map((node, index) => {
10413)                         let task = class_tasktemplate.create(node.rawproject.roottask, name_mark("dependency_" + (node.rawproject.name || lib_string.generate())));
Christian Fraß update

Christian Fraß authored 6 years ago

10414)                         task.context_set(node.filepointer.location);
10415)                         return task;
10416)                     });
10417)                     log("creating root task", 3);
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

10418)                     let task = new class_task({
Christian Fraß update

Christian Fraß authored 6 years ago

10419)                         "name": name_mark("root"),
10420)                         "sub": [
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

10421)                             new class_task({
Christian Fraß update

Christian Fraß authored 6 years ago

10422)                                 "name": name_mark("dependencies"),
10423)                                 "sub": dependencies,
10424)                             }),
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

10425)                             new class_task({
Christian Fraß update

Christian Fraß authored 6 years ago

10426)                                 "name": name_mark("core"),
10427)                                 "sub": [core],
10428)                             }),
10429)                         ]
10430)                     });
10431)                     log("creating project", 3);
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

10432)                     let project = new class_project(node.rawproject.name || "(nameless project)", node.rawproject.version || "0.0.0", task);
Christian Fraß update

Christian Fraß authored 6 years ago

10433)                     project.graph = graph;
10434)                     resolve(project);
10435)                 }
10436)                 else {
10437)                     reject(error);
10438)                 }
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

10439)             }, reason => reject(new class_error("scanning dependencies failed", [reason])));
Christian Fraß update

Christian Fraß authored 6 years ago

10440)         });
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

10441)     }
10442) }
Christian Fraß update

Christian Fraß authored 6 years ago

10443) globalvars.invocation = {
10444)     "interpreter": null,
10445)     "path": "koralle",
10446) };
10447) globalvars.configuration = {
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

10448)     "version": "0.2.1",
Christian Fraß update

Christian Fraß authored 6 years ago

10449)     "tempfolder": null,
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

10450)     "system": null,
Christian Fraß update

Christian Fraß authored 6 years ago

10451)     "execute": false,
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

10452)     "output_target": null,
10453)     "output_path": null,
10454)     "sheet_path": null,
Christian Fraß update

Christian Fraß authored 6 years ago

10455)     "showgraph": false,
10456)     "verbosity": 0,
10457)     "name_splitter": "_",
10458)     "name_prefix": "~",
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

10459)     "programpaths": {
10460)         "php": null,
10461)         "tsc": null,
10462)         "babel": null,
10463)         "lessc": null,
10464)         "schwamm": null,
10465)         "locmerge": null,
10466)     }
Christian Fraß update

Christian Fraß authored 6 years ago

10467) };
10468) /**
10469)  * @author fenris
10470)  */
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

10471) function log(message, level = 0) {
Christian Fraß update

Christian Fraß authored 6 years ago

10472)     if (level <= globalvars.configuration.verbosity) {
10473)         (new class_message(message, { "type": "log", "prefix": "koralle" })).stderr();
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

10474)     }
10475) }
10476) /**
10477)  * @author fenris
10478)  */
10479) function main(args) {
Christian Fraß update

Christian Fraß authored 6 years ago

10480)     log("starting", 2);
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

10481)     let arghandler = new lib_args.class_handler([
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

10482)         new lib_args.class_argument({
10483)             "name": "path",
10484)             "type": "string",
10485)             "default": "project.json",
10486)             "info": "the path of the project-description-file",
10487)             "kind": "positional",
10488)             "parameters": {},
10489)         }),
Christian Fraß update

Christian Fraß authored 6 years ago

10490)         new lib_args.class_argument({
10491)             "name": "verbosity",
10492)             "type": "int",
10493)             "info": "how much informational output shall be given",
10494)             "kind": "volatile",
10495)             "parameters": {
10496)                 "indicators_long": ["verbosity"],
10497)                 "indicators_short": ["b"],
10498)             },
10499)         }),
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

10500)         new lib_args.class_argument({
10501)             "name": "help",
10502)             "type": "boolean",
10503)             "info": "show this help and exit",
10504)             "kind": "volatile",
10505)             "parameters": {
10506)                 "indicators_long": ["help"],
10507)                 "indicators_short": ["h"],
10508)             },
10509)         }),
10510)         new lib_args.class_argument({
10511)             "name": "tasklist",
10512)             "type": "boolean",
10513)             "info": "show the list of available tasks and exit",
10514)             "kind": "volatile",
10515)             "parameters": {
10516)                 "indicators_long": ["tasklist"],
10517)                 "indicators_short": ["l"],
10518)             },
10519)         }),
10520)         new lib_args.class_argument({
10521)             "name": "version",
10522)             "type": "boolean",
10523)             "info": "print the version to stdout and exit",
10524)             "kind": "volatile",
10525)             "parameters": {
10526)                 "indicators_long": ["version"],
10527)                 "indicators_short": ["v"],
10528)             },
10529)         }),
10530)         new lib_args.class_argument({
10531)             "name": "output",
10532)             "type": "string",
10533)             "default": "gnumake",
Christian Fraß update

Christian Fraß authored 6 years ago

10534)             "info": "the output build system; valid values are 'gnumake', 'ant'",
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

10535)             "kind": "volatile",
10536)             "parameters": {
10537)                 "indicators_long": ["output"],
10538)                 "indicators_short": ["o"],
10539)             },
10540)         }),
10541)         new lib_args.class_argument({
10542)             "name": "system",
10543)             "type": "string",
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

10544)             "default": "own",
10545)             "info": "the target platform; valid values are 'own' (the system executing koralle), 'linux', 'bsd', 'win'",
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

10546)             "kind": "volatile",
10547)             "parameters": {
10548)                 "indicators_long": ["system"],
10549)                 "indicators_short": ["s"],
10550)             },
10551)         }),
10552)         new lib_args.class_argument({
10553)             "name": "file",
10554)             "type": "string",
10555)             "default": null,
10556)             "info": "the file in which the result build script shall be written",
10557)             "kind": "volatile",
10558)             "parameters": {
10559)                 "indicators_long": ["file"],
10560)                 "indicators_short": ["f"],
10561)             },
10562)         }),
10563)         new lib_args.class_argument({
10564)             "name": "execute",
10565)             "type": "boolean",
10566)             "info": "if set, the build script will be executed instead of being printed to stdout",
10567)             "kind": "volatile",
10568)             "parameters": {
10569)                 "indicators_long": ["execute"],
10570)                 "indicators_short": ["x"],
10571)             },
10572)         }),
10573)         new lib_args.class_argument({
10574)             "name": "showgraph",
10575)             "type": "boolean",
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

10576)             "info": "if set, the dot language description of the dependency graph is printed to stdout",
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

10577)             "kind": "volatile",
10578)             "parameters": {
10579)                 "indicators_long": ["showgraph"],
10580)                 "indicators_short": ["g"],
10581)             },
10582)         }),
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

10583)         new lib_args.class_argument({
10584)             "name": "path_php",
10585)             "type": "string",
10586)             "default": "php",
10587)             "info": "the path to the program 'php'",
10588)             "kind": "volatile",
10589)             "parameters": {
10590)                 "indicators_long": ["path-php"],
10591)                 "indicators_short": [],
10592)             },
10593)         }),
10594)         new lib_args.class_argument({
10595)             "name": "path_tsc",
10596)             "type": "string",
10597)             "default": "tsc",
10598)             "info": "the path to the program 'tsc'",
10599)             "kind": "volatile",
10600)             "parameters": {
10601)                 "indicators_long": ["path-tsc"],
10602)                 "indicators_short": [],
10603)             },
10604)         }),
10605)         new lib_args.class_argument({
10606)             "name": "path_babel",
10607)             "type": "string",
10608)             "default": "babel",
10609)             "info": "the path to the program 'babel'",
10610)             "kind": "volatile",
10611)             "parameters": {
10612)                 "indicators_long": ["path-babel"],
10613)                 "indicators_short": [],
10614)             },
10615)         }),
10616)         new lib_args.class_argument({
10617)             "name": "path_lessc",
10618)             "type": "string",
10619)             "default": "lessc",
10620)             "info": "the path to the program 'lessc'",
10621)             "kind": "volatile",
10622)             "parameters": {
10623)                 "indicators_long": ["path-lessc"],
10624)                 "indicators_short": [],
10625)             },
10626)         }),
10627)         new lib_args.class_argument({
10628)             "name": "path_schwamm",
10629)             "type": "string",
10630)             "default": "schwamm",
10631)             "info": "the path to the program 'schwamm'",
10632)             "kind": "volatile",
10633)             "parameters": {
10634)                 "indicators_long": ["path-schwamm"],
10635)                 "indicators_short": [],
10636)             },
10637)         }),
10638)         new lib_args.class_argument({
10639)             "name": "path_locmerge",
10640)             "type": "string",
10641)             "default": "locmerge",
10642)             "info": "the path to the program 'locmerge'",
10643)             "kind": "volatile",
10644)             "parameters": {
10645)                 "indicators_long": ["path-locmerge"],
10646)                 "indicators_short": [],
10647)             },
10648)         }),
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

10649)     ]);
10650)     // lib_args.verbosity = 5;
Christian Fraß update

Christian Fraß authored 6 years ago

10651)     log("reading command line arguments", 2);
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

10652)     let argdata = arghandler.read("cli", args.join(" "));
10653)     globalvars.configuration.sheet_path = argdata["path"];
10654)     {
10655)         // todo: auslagern (nach "plankton/base" vllt.)
10656)         let systemmap = {
10657)             "linux": "linux",
10658)             "freebsd": "bsd",
10659)             "openbsd": "bsd",
10660)             "win32": "win"
10661)         };
10662)         globalvars.configuration.system = (argdata["system"] == "own") ? systemmap[process.platform] : argdata["system"];
10663)     }
10664)     globalvars.configuration.output_target = argdata["output"];
10665)     globalvars.configuration.execute = argdata["execute"];
10666)     globalvars.configuration.show_help = argdata["help"];
10667)     globalvars.configuration.show_version = argdata["version"];
10668)     globalvars.configuration.show_tasklist = argdata["tasklist"];
10669)     globalvars.configuration.showgraph = argdata["showgraph"];
10670)     globalvars.configuration.output_path = argdata["file"];
10671)     globalvars.configuration.verbosity = argdata["verbosity"];
10672)     globalvars.configuration.programpaths.php = argdata["path_php"];
10673)     globalvars.configuration.programpaths.tsc = argdata["path_tsc"];
10674)     globalvars.configuration.programpaths.babel = argdata["path_babel"];
10675)     globalvars.configuration.programpaths.lessc = argdata["path_lessc"];
10676)     globalvars.configuration.programpaths.schwamm = argdata["path_schwamm"];
10677)     globalvars.configuration.programpaths.locmerge = argdata["path_locmerge"];
10678)     return (lib_call.promise_resolve({})
10679)         .then(state => {
10680)         // help
10681)         if (globalvars.configuration.show_help) {
10682)             let message = arghandler.generate_help({
10683)                 "programname": "Koralle Build System Abstractor",
10684)                 "executable": "koralle",
10685)                 "author": "Christian Fraß <frass@greenscale.de>",
10686)                 "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.",
10687)             });
10688)             (new class_message(message)).stdout();
10689)             return lib_call.promise_resolve(state);
10690)         }
10691)         else if (globalvars.configuration.show_version) {
10692)             (new class_message(globalvars.configuration.version.toString())).stdout();
10693)             return lib_call.promise_resolve(state);
10694)         }
10695)         else if (globalvars.configuration.show_tasklist) {
10696)             (new class_message(class_tasktemplate.list())).stdout();
10697)             return lib_call.promise_resolve(state);
10698)         }
10699)         else {
10700)             return (lib_call.promise_resolve(state)
10701)                 .then(state => lib_call.promise_make((resolve, reject) => {
Christian Fraß update

Christian Fraß authored 6 years ago

10702)                 log("setting up environment", 2);
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

10703)                 let sheet_filepointer = lib_path.filepointer_read(globalvars.configuration.sheet_path);
10704)                 // sheet_filepointer.location.go_thither();
10705)                 state.sheet_filepointer = sheet_filepointer;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

10706)                 resolve(state);
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

10707)             }))
10708)                 .then(state => lib_call.promise_make((resolve, reject) => {
Christian Fraß update

Christian Fraß authored 6 years ago

10709)                 log("setting up output", 2);
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

10710)                 let mapping = {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

10711)                     "ant": new class_target_ant(),
10712)                     "gnumake": new class_target_gnumake(),
10713)                     "make": new class_target_gnumake(),
10714)                 };
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

10715)                 let output_target = lib_object.fetch(mapping, globalvars.configuration.output_target, null, 0);
10716)                 if (output_target == null) {
10717)                     reject(new class_error(`no implementation found for output_target '${globalvars.configuration.output_target}'`));
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

10718)                 }
10719)                 else {
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

10720)                     state.output_target = output_target;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

10721)                     resolve(state);
10722)                 }
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

10723)             }))
10724)                 .then(state => lib_call.promise_make((resolve, reject) => {
Christian Fraß update

Christian Fraß authored 6 years ago

10725)                 log("setting up temp-folder", 2);
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

10726)                 try {
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

10727)                     globalvars.configuration.tempfolder = state.output_target.tempfolder();
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

10728)                     resolve(state);
10729)                 }
10730)                 catch (exception) {
10731)                     reject(new class_error("couldn't setup temp folder", [exception]));
10732)                 }
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

10733)             }))
10734)                 .then(state => lib_call.promise_make((resolve, reject) => {
Christian Fraß update

Christian Fraß authored 6 years ago

10735)                 log("setting up project", 2);
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

10736)                 class_project.create(state.sheet_filepointer)(project => {
Christian Fraß update

Christian Fraß authored 6 years ago

10737)                     state.project = project;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

10738)                     resolve(state);
Christian Fraß update

Christian Fraß authored 6 years ago

10739)                 }, reject);
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

10740)             }))
10741)                 .then(state => {
10742)                 // graph
Christian Fraß update

Christian Fraß authored 6 years ago

10743)                 if (globalvars.configuration.showgraph) {
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

10744)                     return (lib_call.promise_resolve(state)
10745)                         .then(state => lib_call.promise_make((resolve, reject) => {
10746)                         log("showing graph", 2);
10747)                         let output = (state.project.graph_get()
10748)                             .hasse()
10749)                             .output_dot({
10750)                             "extract_label": node => (node.rawproject.name || node.filepointer.toString())
10751)                         }));
10752)                         (new class_message(output)).stdout();
10753)                         resolve(state);
10754)                     })));
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

10755)                 }
10756)                 else {
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

10757)                     return (lib_call.promise_resolve(state)
10758)                         .then(state => lib_call.promise_make((resolve, reject) => {
10759)                         log("generating output", 2);
10760)                         try {
10761)                             let output_script = state.output_target.compile_project_string(state.project);
10762)                             state.output_script = output_script;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

10763)                             resolve(state);
10764)                         }
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

10765)                         catch (exception) {
10766)                             reject(new class_error("generating build script failed", [exception]));
10767)                         }
10768)                     }))
10769)                         .then(state => lib_call.promise_make((resolve, reject) => {
10770)                         log("writing to file", 2);
10771)                         let filepointer;
10772)                         if (globalvars.configuration.output_path == null) {
10773)                             if (!globalvars.configuration.execute) {
10774)                                 filepointer = null;
10775)                             }
10776)                             else {
10777)                                 filepointer = new lib_path.class_filepointer(
10778)                                 // new lib_path.class_location(null, new lib_path.class_path(["."])),
10779)                                 lib_path.location_read(globalvars.configuration.tempfolder, globalvars.configuration.system), 
10780)                                 // lib_path.class_location.tempfolder(globalvars.configuration.system),
10781)                                 "__koralle");
10782)                             }
10783)                         }
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

10784)                         else {
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

10785)                             filepointer = lib_path.filepointer_read(globalvars.configuration.output_path);
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

10786)                         }
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

10787)                         state.output_filepointer = filepointer;
10788)                         if (filepointer == null) {
10789)                             (new class_message(state.output_script)).stdout();
10790)                             resolve(state);
10791)                         }
10792)                         else {
10793)                             nm_fs.writeFile(filepointer.toString(), state.output_script, error => {
10794)                                 if (error == null) {
10795)                                     resolve(state);
10796)                                 }
10797)                                 else {
10798)                                     reject(new class_error("writing to file failed", [error]));
10799)                                 }
10800)                             });
10801)                         }
10802)                     }))
10803)                         .then(state => lib_call.promise_make((resolve, reject) => {
10804)                         log("executing", 2);
10805)                         if (!globalvars.configuration.execute) {
10806)                             resolve(state);
10807)                         }
10808)                         else {
10809)                             state.output_target.execute(state.output_filepointer)(result => resolve(state), reason => reject(new class_error("execution of build script failed", [reason])));
10810)                         }
10811)                     })));
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

10812)                 }
Christian Fraß updated build tool koralle

Christian Fraß authored 6 years ago

10813)             }));
10814)         }
10815)     }));
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

10816) }
Christian Fraß update

Christian Fraß authored 6 years ago

10817) log("intro", 2);
10818) globalvars.invocation = {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

10819)     "interpreter": process.argv[0],
10820)     "path": process.argv[1],
10821) };