8794e319de05611d80218f8a3f07fa1992d0c228
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) 
22) var __extends = (this && this.__extends) || function (d, b) {
23)     for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
24)     function __() { this.constructor = d; }
25)     d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
26) };
27) // module lib_base {
28) // }
29) var lib_base;
30) (function (lib_base) {
31)     /**
32)      * @author frac
33)      */
34)     function environment() {
35)         var entries = [
36)             {
37)                 "id": "web",
38)                 "name": "Web",
39)                 "predicate": function () { return (typeof (document) !== "undefined"); }
40)             },
41)             {
42)                 "id": "node",
43)                 "name": "Node.js",
44)                 "predicate": function () { return (typeof (process) !== "undefined"); }
45)             },
46)             {
47)                 "id": "rhino",
48)                 "name": "Rhino",
49)                 "predicate": function () { return (typeof (java) !== "undefined"); }
50)             },
51)         ];
52)         var id;
53)         var found = entries.some(function (entry) {
54)             if (entry.predicate()) {
55)                 id = entry.id;
56)                 return true;
57)             }
58)             else {
59)                 return false;
60)             }
61)         });
62)         if (found) {
63)             return id;
64)         }
65)         else {
66)             throw (new Error("unknown environment"));
67)         }
68)     }
69)     lib_base.environment = environment;
70) })(lib_base || (lib_base = {}));
71) function hash(value) {
72)     if (typeof (value) === "object") {
73)         if ("hash" in value)
74)             return value.hash();
75)         else
76)             throw (new Error("[hash]" + " " + "object has no hash-method"));
77)     }
78)     else {
79)         return value.toString();
80)     }
81) }
82) function equals(value_x, value_y) {
83)     if (typeof (value_x) === "object") {
84)         if ("equals" in value_x)
85)             return value_x.equals(value_y);
86)         else
87)             throw (new Error("[equals]" + " " + "object has no equals-method"));
88)     }
89)     else {
90)         return (value_x === value_y);
91)     }
92) }
93) function show(value) {
94)     if (typeof (value) === "object") {
95)         if ("show" in value)
96)             return value.show();
97)         else
98)             throw (new Error("[show]" + " " + "object has no show-method"));
99)     }
100)     else {
101)         return value.toString();
102)     }
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

103) }
104) /**
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

111)     function class_observer() {
112)         this.counter = 0;
113)         this.actions = {};
114)         this.buffer = [];
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

115)     }
116)     /**
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

119)     class_observer.prototype.empty = function () {
120)         return (Object.keys(this.actions).length == 0);
121)     };
122)     /**
123)      * @author frac
124)      */
125)     class_observer.prototype.flush = function () {
126)         this.actions = {};
127)     };
128)     /**
129)      * @author frac
130)      */
131)     class_observer.prototype.set = function (id, action) {
132)         this.actions[id] = action;
133)     };
134)     /**
135)      * @author frac
136)      */
137)     class_observer.prototype.del = function (id) {
138)         delete this.actions[id];
139)     };
140)     /**
141)      * @author frac
142)      */
143)     class_observer.prototype.add = function (action) {
144)         this.set((this.counter++).toString(), action);
145)     };
146)     /**
147)      * @author frac
148)      */
149)     class_observer.prototype.notify = function (information, delayed) {
150)         var _this = this;
151)         if (information === void 0) { information = {}; }
152)         if (delayed === void 0) { delayed = false; }
153)         if (delayed) {
154)             this.buffer.push(information);
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

156)         else {
157)             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

158)         }
159)     };
160)     /**
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

163)     class_observer.prototype.rollout = function () {
164)         var _this = this;
165)         this.buffer.forEach(function (information) { return _this.notify(information, false); });
166)         this.buffer = [];
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

168)     return class_observer;
169) }());
170) /**
171)  * @author frac
172)  */
173) /*
174) export interface interface_readable<type_value> {
175) 
176)     |**
177)      * @author frac
178)      *|
179)     read() : type_executor<type_value, Error>;
180) 
181) }
182)  */
183) /**
184)  * @author frac
185)  */
186) /*
187) export interface interface_writeable<type_value> {
188) 
189)     |**
190)      * @author frac
191)      *|
192)     write(value : type_value) : type_executor<void, Error>;
193) 
194) }
195)  */
196) /**
197)  * @author frac
198)  */
199) /*export*/ var class_maybe = (function () {
200)     function class_maybe() {
201)     }
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

203)      * @desc whether the wrapper is nothing
204)      * @author frac
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

208)     };
209)     /**
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

210)      * @desc whether the wrapper is just
211)      * @author frac
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

216)     /**
217)      * @desc return the value, stored in the maybe-wrapper
218)      * @author frac
219)      */
220)     class_maybe.prototype.cull = function () {
221)         throw (new Error("not implemented: class_maybe.cull"));
222)     };
223)     /**
224)      * @author frac
225)      */
226)     class_maybe.prototype.distinguish = function (action_just, action_nothing) {
227)         if (action_nothing === void 0) { action_nothing = function () { }; }
228)         throw (new Error("not implemented: class_maybe.distinguish"));
229)     };
230)     /**
231)      * @author frac
232)      */
233)     class_maybe.prototype.propagate = function (action) {
234)         throw (new Error("not implemented: class_maybe.propagate"));
235)     };
236)     return class_maybe;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

237) }());
238) /**
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

241) /*export*/ var class_nothing = (function (_super) {
242)     __extends(class_nothing, _super);
243)     /**
244)      * @author frac
245)      */
246)     function class_nothing(reason) {
247)         if (reason === void 0) { reason = null; }
248)         _super.call(this);
249)         this.reason = reason;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

250)     }
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)     class_nothing.prototype.is_nothing = function () {
255)         return true;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

260)     class_nothing.prototype.is_just = function () {
261)         return false;
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_nothing.prototype.cull = function () {
267)         return null;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

268)     };
269)     /**
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

275)     };
276)     /**
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

282)     return class_nothing;
283) }(class_maybe));
284) /**
285)  * @author frac
286)  */
287) /*export*/ var class_just = (function (_super) {
288)     __extends(class_just, _super);
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

292)     function class_just(value) {
293)         _super.call(this);
294)         this.value = value;
295)     }
296)     /**
297)      * @author frac
298)      */
299)     class_just.prototype.is_nothing = function () {
300)         return false;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

302)     /**
303)      * @author frac
304)      */
305)     class_just.prototype.is_just = function () {
306)         return true;
307)     };
308)     /**
309)      * @author frac
310)      */
311)     class_just.prototype.cull = function () {
312)         return this.value;
313)     };
314)     /**
315)      * @author frac
316)      */
317)     class_just.prototype.distinguish = function (action_just, action_nothing) {
318)         if (action_nothing === void 0) { action_nothing = function () { }; }
319)         action_just(this.value);
320)     };
321)     /**
322)      * @author frac
323)      */
324)     class_just.prototype.propagate = function (action) {
325)         return action(this.value);
326)     };
327)     return class_just;
328) }(class_maybe));
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

337)     function class_error(message, suberrors) {
338)         if (suberrors === void 0) { suberrors = []; }
339)         _super.call(this, message);
340)         this.suberrors = suberrors;
341)         this.mess = message;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

342)     }
343)     /**
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

347)     class_error.prototype.toString = function () {
348)         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

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

Christian Fraß authored 7 years ago

350)     return class_error;
351) }(Error));
352) // module lib_base {
353) // import _instances = require("instances");
354) // declare var hash;
355) // declare var equals;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

359) /*export*/ var Pair = (function () {
360)     function Pair(first, second) {
361)         this.first = first;
362)         this.second = second;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

364)     Pair.prototype.equals = function (pair) {
365)         var first_equals;
366)         var second_equals;
367)         var exceptions = new Array();
368)         try {
369)             first_equals = equals(this.first, pair.first);
370)         }
371)         catch (exception) {
372)             exceptions.push(exception);
373)         }
374)         try {
375)             second_equals = equals(this.second, pair.second);
376)         }
377)         catch (exception) {
378)             exceptions.push(exception);
379)         }
380)         if (exceptions.length == 0) {
381)             return (first_equals && second_equals);
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

382)         }
383)         else {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

384)             throw (new Exception("Pair:equals:components", "Missing equality-implementation for components while trying to compute equality of pairs", exceptions));
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

386)     };
387)     Pair.prototype.hash = function () {
388)         var first_hash;
389)         var second_hash;
390)         var exceptions = new Array();
391)         try {
392)             first_hash = hash(this.first);
393)         }
394)         catch (exception) {
395)             exceptions.push(exception);
396)         }
397)         try {
398)             second_hash = hash(this.second);
399)         }
400)         catch (exception) {
401)             exceptions.push(exception);
402)         }
403)         if (exceptions.length == 0) {
404)             return (first_hash + "_" + second_hash);
405)         }
406)         else {
407)             throw (new Exception("Pair:hash:components", "Missing hash for components while trying to retrieve hash of pair", exceptions));
408)         }
409)     };
410)     Pair.prototype.toString = function () {
411)         return ("(" + this.first.toString() + ", " + this.second.toString() + ")");
412)     };
413)     return Pair;
414) }());
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

418) /*export*/ var AbstractMap = (function () {
419)     function AbstractMap() {
420)         this.size = 0;
421)     }
422)     AbstractMap.prototype.get = function (key) {
423)         throw (new ExceptionAbstract("Map:get"));
424)     };
425)     AbstractMap.prototype.get_fallback = function (key, fallback) {
426)         if (fallback === void 0) { fallback = null; }
427)         try {
428)             return this.get(key);
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

430)         catch (exception) {
431)             if (exception_is(exception, "Map:get:not_found"))
432)                 return fallback;
433)             else
434)                 throw exception;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

436)     };
437)     AbstractMap.prototype.has = function (key) {
438)         throw (new ExceptionAbstract("Map:has"));
439)     };
440)     AbstractMap.prototype.set = function (key, value) {
441)         throw (new ExceptionAbstract("Map:set"));
442)     };
443)     AbstractMap.prototype.extend = function (map) {
444)         (function (this_) {
445)             map.forEach(function (value, key) {
446)                 this_.set(key, value);
447)             });
448)         })(this);
449)     };
450)     AbstractMap.prototype.delete = function (key) {
451)         throw (new ExceptionAbstract("Map:delete"));
452)     };
453)     AbstractMap.prototype.clear = function () {
454)         throw (new ExceptionAbstract("Map:clear"));
455)     };
456)     AbstractMap.prototype.forEach = function (action) {
457)         throw (new ExceptionAbstract("Map:get"));
458)     };
459)     AbstractMap.prototype.pairs = function () {
460)         var pairs = new Array();
461)         this.forEach(function (value, key) {
462)             pairs.push(new Pair(key, value));
463)         });
464)         return pairs;
465)     };
466)     AbstractMap.prototype.toString = function () {
467)         return ("{" + this.pairs().map(function (pair) { return (pair.first.toString() + ": " + pair.second.toString()); }).join(", ") + "}");
468)     };
469)     return AbstractMap;
470) }());
471) /**
472)  * @author frac
473)  */
474) /*export*/ var EqualityMap = (function (_super) {
475)     __extends(EqualityMap, _super);
476)     function EqualityMap() {
477)         _super.call(this);
478)         this.clear();
479)     }
480)     EqualityMap.prototype.get_index = function (key) {
481)         var index = this.pairs_["findIndex"](function (pair) { return equals(pair.first, key); });
482)         return ((index < 0) ? null : index);
483)     };
484)     EqualityMap.prototype.get_pair = function (key) {
485)         var index = this.get_index(key);
486)         return ((index == null) ? null : this.pairs_[index]);
487)     };
488)     EqualityMap.prototype.get = function (key) {
489)         return this.get_pair(key).second;
490)     };
491)     EqualityMap.prototype.has = function (key) {
492)         try {
493)             this.get(key);
494)             return true;
495)         }
496)         catch (exception) {
497)             if (exception_is(exception, "Map:get:not_found"))
498)                 return false;
499)             else
500)                 throw exception;
501)         }
502)     };
503)     EqualityMap.prototype.set = function (key, value) {
504)         var pair = this.get_pair(key);
505)         if (pair != null) {
506)             console.warn("overwriting value for the following key: ", key);
507)             pair.second = value;
508)         }
509)         else {
510)             this.pairs_.push(new Pair(key, value));
511)             this.size += 1;
512)         }
513)         return this;
514)     };
515)     EqualityMap.prototype.delete = function (key) {
516)         var index;
517)         var present;
518)         try {
519)             index = this.get_index(key);
520)             present = true;
521)         }
522)         catch (exception) {
523)             if (exception_is(exception, "Map:get:not_found"))
524)                 present = false;
525)             else
526)                 throw exception;
527)         }
528)         if (present) {
529)             this.pairs_ = this.pairs_.splice(index, 1);
530)             this.size -= 1;
531)             return true;
532)         }
533)         else {
534)             return false;
535)         }
536)     };
537)     EqualityMap.prototype.clear = function () {
538)         this.pairs_ = new Array();
539)         this.size = 0;
540)     };
541)     EqualityMap.prototype.forEach = function (action) {
542)         (function (this_) {
543)             this_.pairs_.forEach(function (pair) {
544)                 action(pair.second, pair.first, this_);
545)             });
546)         })(this);
547)     };
548)     return EqualityMap;
549) }(AbstractMap));
550) /**
551)  * @author frac
552)  */
553) /*export*/ var HashMap = (function (_super) {
554)     __extends(HashMap, _super);
555)     function HashMap() {
556)         _super.call(this);
557)         this.clear();
558)     }
559)     HashMap.prototype.get = function (key) {
560)         var hashvalue = hash(key);
561)         if (hashvalue in this.object)
562)             return this.object[hashvalue];
563)         else
564)             throw (new Exception("Map:get:not_found", "no entry for the given key (hashvalue: '" + hashvalue + "')"));
565)     };
566)     HashMap.prototype.has = function (key) {
567)         return (hash(key) in this.object);
568)     };
569)     HashMap.prototype.set = function (key, value) {
570)         var hashvalue = hash(key);
571)         if (hashvalue in this.object) {
572)             console.warn("overwriting value for key with hashvalue '" + hashvalue + "'");
573)             this.object[hashvalue] = value;
574)         }
575)         else {
576)             this.keys_original.push(key);
577)             this.object[hashvalue] = value;
578)             this.size += 1;
579)         }
580)         return this;
581)     };
582)     HashMap.prototype.delete = function (key) {
583)         var hashvalue = hash(key);
584)         if (hashvalue in this.object) {
585)             this.keys_original = this.keys_original.filter(function (key_) {
586)                 return (hash(key_) != hashvalue);
587)             });
588)             delete this.object[hashvalue];
589)             this.size -= 1;
590)             return true;
591)         }
592)         else {
593)             return false;
594)         }
595)     };
596)     HashMap.prototype.clear = function () {
597)         this.keys_original = new Array();
598)         this.object = {};
599)         this.size = 0;
600)     };
601)     HashMap.prototype.forEach = function (action) {
602)         (function (this_) {
603)             this_.keys_original.forEach(function (key) {
604)                 var hashvalue = hash(key);
605)                 var value = this_.object[hashvalue];
606)                 action(value, key, this_);
607)             });
608)         })(this);
609)     };
610)     return HashMap;
611) }(AbstractMap));
612) /**
613)  * @author frac
614)  */
615) /*exports*/ var SimpleMap = (function (_super) {
616)     __extends(SimpleMap, _super);
617)     function SimpleMap() {
618)         _super.call(this);
619)     }
620)     return SimpleMap;
621) }(HashMap));
622) /**
623)  * @author frac
624)  */
625) /*export*/ var Tree = (function () {
626)     // constructors
627)     function Tree(parent, value, children) {
628)         if (parent === void 0) { parent = null; }
629)         if (value === void 0) { value = null; }
630)         if (children === void 0) { children = new Array(); }
631)         this.parent = parent;
632)         this.value = value;
633)         this.children = children;
634)         var this_ = this;
635)         if (children != null)
636)             this.children.forEach(function (tree) { tree.parent = this_; });
637)     }
638)     // accessors
639)     Tree.prototype.value_get = function () {
640)         return this.value;
641)     };
642)     Tree.prototype.map = function (transformator, parent) {
643)         if (parent === void 0) { parent = null; }
644)         var tree = new Tree(parent, transformator(this.value));
645)         tree.children = this.children.map(function (tree_) { return tree_.map(transformator, tree); });
646)         return tree;
647)     };
648)     /*
649)     public children_iterate():void
650)     {
651)         this.children.forEach(function (tree:Tree<Value>) {yield tree;});
652)     }
653)     */
654)     Tree.prototype.flatten = function (postorder) {
655)         if (postorder === void 0) { postorder = false; }
656)         var reduce = postorder ? 'reduceRight' : 'reduce';
657)         return this.children[reduce](function (list, tree) { return list.concat(tree.flatten(postorder)); }, [this]);
658)     };
659)     Tree.prototype.traverse = function (postorder) {
660)         if (postorder === void 0) { postorder = false; }
661)         return this.flatten().map(function (tree) { return tree.value; });
662)     };
663)     Tree.prototype.graph = function (prefix) {
664)         if (prefix === void 0) { prefix = "x"; }
665)         var vertices = new Array();
666)         var edges = new Array();
667)         vertices.push(new Pair(prefix, this.value));
668)         this.children.forEach(function (tree, index) {
669)             var prefix_ = prefix + "_" + index.toString();
670)             edges.push(new Pair(new Pair(prefix, prefix_), null));
671)             var graph = tree.graph(prefix_);
672)             vertices = vertices.concat(graph.get_vertices());
673)             edges = edges.concat(graph.get_edges());
674)         });
675)         return new Graph(vertices, edges);
676)     };
677)     // mutators
678)     Tree.prototype.value_set = function (value) {
679)         this.value = value;
680)     };
681)     Tree.prototype.children_add = function (tree) {
682)         this.children.push(tree);
683)         tree.parent = this;
684)     };
685)     return Tree;
686) }());
687) /**
688)  * @author frac
689)  */
690) /*export*/ var Graph = (function () {
691)     function Graph(vertices, edges) {
692)         // [ToDo] check consistency
693)         this.vertices = vertices;
694)         this.edges = edges;
695)     }
696)     Graph.prototype.get_vertices = function () {
697)         return this.vertices;
698)     };
699)     Graph.prototype.get_edges = function () {
700)         return this.edges;
701)     };
702)     Graph.prototype.graphviz = function (name) {
703)         if (name === void 0) { name = "conversion"; }
704)         var script = "";
705)         script += ("digraph " + name + "\n");
706)         script += ("{\n");
707)         this.vertices.forEach(function (vertex) {
708)             var line = "";
709)             line += ("\t" + vertex.first);
710)             var parameters = new HashMap();
711)             parameters.set("shape", "circle");
712)             if (vertex.first != null)
713)                 parameters.set("label", vertex.second.toString());
714)             line += (" [" + parameters.pairs().map(function (pair) { return (pair.first + "='" + pair.second + "'"); }).join(",") + "]");
715)             line += "\n";
716)             script += line;
717)         });
718)         script += ("\t\n");
719)         this.edges.forEach(function (edge) {
720)             var line = "";
721)             line += ("\t" + edge.first.first + " -> " + edge.first.second);
722)             var parameters = new HashMap();
723)             if (edge.second != null)
724)                 parameters.set("label", edge.second.toString());
725)             line += (" [" + parameters.pairs().map(function (pair) { return (pair.first + "='" + pair.second + "'"); }).join(",") + "]");
726)             line += "\n";
727)             script += line;
728)         });
729)         script += ("}\n");
730)         return script;
731)     };
732)     return Graph;
733) }());
734) /*export*/ function tree_test() {
735)     var tree = new Tree(null, 3, [
736)         new Tree(null, 1, [
737)             new Tree(null, 0),
738)             new Tree(null, 2),
739)         ]),
740)         new Tree(null, 5, [
741)             new Tree(null, 4),
742)             new Tree(null, 6),
743)         ]),
744)     ]);
745)     return tree;
746) }
747) /*
748) */
749) // }
750) /**
751)  * @author frac
752)  */
753) var class_set = (function () {
754)     /**
755)      * @author frac
756)      */
757)     function class_set(elements) {
758)         var _this = this;
759)         if (elements === void 0) { elements = []; }
760)         this.elements = [];
761)         elements.forEach(function (element) { return _this.add(element); });
762)     }
763)     /**
764)      * @author frac
765)      */
766)     class_set.prototype.elements_get = function () {
767)         return this.elements;
768)     };
769)     /**
770)      * @author frac
771)      */
772)     class_set.prototype.add = function (element) {
773)         if (this.elements.indexOf(element) < 0) {
774)             this.elements.push(element);
775)         }
776)     };
777)     /**
778)      * @author frac
779)      */
780)     class_set.prototype.forEach = function (action) {
781)         this.elements.forEach(action);
782)     };
783)     return class_set;
784) }());
785) var __extends = (this && this.__extends) || function (d, b) {
786)     for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
787)     function __() { this.constructor = d; }
788)     d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
789) };
790) var lib_call;
791) (function (lib_call) {
792)     /**
793)      * @desc this is kind of an ugly hack; the motivation is, that the JS-interpreter of many Gecko-based browsers
794)      *    (e.g. Firefox) won't accept a larger number of stack-frames, which come up when using executor-chains often.
795)      *    This can be circumvented by deferring inner calls, such that they are moved outside the own stack-frame. This
796)      *    is possible due to the asynchronous nature of executors. However this does also significantly increase the
797)      *    overall-time for a long executor-chain (or rather executor-tree) to finish. Therefore it is not recommended
798)      *    to do this by default.
799)      * @author frac
800)      */
801)     lib_call.default_deferred = ((typeof (navigator) === "undefined") ? false : (navigator.userAgent.indexOf("Firefox") >= 0));
802)     /**
803)      * @author fenris
804)      */
805)     function schedule(function_, deferred) {
806)         if (deferred === void 0) { deferred = lib_call.default_deferred; }
807)         if (!deferred) {
808)             function_();
809)         }
810)         else {
811)             setTimeout(function_, 0);
812)         }
813)     }
814)     lib_call.schedule = schedule;
815) })(lib_call || (lib_call = {}));
816) ///<reference path="../../base/build/logic.d.ts"/>
817) var lib_call;
818) (function (lib_call) {
819)     /**
820)      * @author frac
821)      * @todo could possibly be replaced by Promise-system
822)      */
823)     var class_wait = (function () {
824)         function class_wait() {
825)         }
826)         return class_wait;
827)     }());
828)     lib_call.class_wait = class_wait;
829)     /**
830)      * @author frac
831)      * @todo could possibly be replaced by Promise-system
832)      */
833)     var class_wait_sequential = (function (_super) {
834)         __extends(class_wait_sequential, _super);
835)         /**
836)          * @author frac
837)          */
838)         function class_wait_sequential(dependencies, action) {
839)             if (action === void 0) { action = function () { console.log("all done"); }; }
840)             _super.call(this);
841)             this.dependencies = dependencies;
842)             this.action = action;
843)         }
844)         /**
845)          * @author frac
846)          */
847)         class_wait_sequential.prototype.run_ = function (dependencies) {
848)             var _this = this;
849)             if (dependencies.length > 0) {
850)                 dependencies[0](function () { return _this.run_(dependencies.slice(1)); });
851)             }
852)             else {
853)                 this.action();
854)             }
855)         };
856)         /**
857)          * @author frac
858)          */
859)         class_wait_sequential.prototype.run = function () {
860)             this.run_(this.dependencies);
861)         };
862)         return class_wait_sequential;
863)     }(class_wait));
864)     lib_call.class_wait_sequential = class_wait_sequential;
865)     /**
866)      * @author frac
867)      * @todo could possibly be replaced by Promise-system
868)      */
869)     var class_wait_parallel = (function (_super) {
870)         __extends(class_wait_parallel, _super);
871)         /**
872)          * @author frac
873)          */
874)         function class_wait_parallel(dependencies, action) {
875)             var _this = this;
876)             if (action === void 0) { action = function () { console.log("all done"); }; }
877)             _super.call(this);
878)             this.index = 0;
879)             this.dependencies = {};
880)             this.action = action;
881)             dependencies.forEach(function (dependency) { return _this.add_dependency(dependency); });
882)         }
883)         /**
884)          * @author frac
885)          */
886)         class_wait_parallel.prototype.add_dependency = function (dependency) {
887)             this.dependencies["dependency_" + this.index.toString()] = dependency;
888)             this.index += 1;
889)         };
890)         /**
891)          * @author frac
892)          */
893)         class_wait_parallel.prototype.remove_dependency = function (id) {
894)             if (!(id in this.dependencies)) {
895)                 throw (new Error("dependency does not exist"));
896)             }
897)             else {
898)                 delete this.dependencies[id];
899)                 if (Object.keys(this.dependencies).length == 0) {
900)                     this.action();
901)                 }
902)             }
903)         };
904)         /**
905)          * @author frac
906)          */
907)         class_wait_parallel.prototype.run = function () {
908)             var that = this;
909)             if (Object.keys(this.dependencies).length == 0) {
910)                 this.action();
911)             }
912)             else {
913)                 Object.keys(this.dependencies).forEach(function (id) {
914)                     var dependency = that.dependencies[id];
915)                     dependency(function () {
916)                         that.remove_dependency(id);
917)                     });
918)                 });
919)             }
920)         };
921)         return class_wait_parallel;
922)     }(class_wait));
923)     lib_call.class_wait_parallel = class_wait_parallel;
924) })(lib_call || (lib_call = {}));
925) ///<reference path="../../base/build/logic.d.ts"/>
926) var lib_call;
927) (function (lib_call) {
928)     /**
929)      * @desc a definition for a value being "defined"
930)      * @author neuc
931)      */
932)     function is_def(obj, null_is_valid) {
933)         if (null_is_valid === void 0) { null_is_valid = false; }
934)         return (!((typeof (obj) === "undefined") || (!null_is_valid && (obj === null))));
935)     }
936)     lib_call.is_def = is_def;
937)     /**
938)      * @desc returns the value if set and, when a type is specified, if the type is corret, if not return default_value
939)      * @author neuc
940)      */
941)     function def_val(value, default_value, type, null_is_valid) {
942)         if (type === void 0) { type = null; }
943)         if (null_is_valid === void 0) { null_is_valid = false; }
944)         if (is_def(value, null_is_valid) && (is_def(type) ? ((typeof value === type) || ((value === null) && null_is_valid)) : true)) {
945)             return value;
946)         }
947)         else {
948)             return default_value;
949)         }
950)     }
951)     lib_call.def_val = def_val;
952)     ;
953)     /**
954)      * @desc just the empty function; useful for some callbacks etc.
955)      * @author frac
956)      */
957)     function nothing() {
958)     }
959)     lib_call.nothing = nothing;
960)     /**
961)      * @desc just the identity; useful for some callbacks etc.
962)      * @author frac
963)      */
964)     function id(x) {
965)         return x;
966)     }
967)     lib_call.id = id;
968)     /**
969)      * @author frac
970)      */
971)     function use(input, function_) {
972)         return function_(input);
973)     }
974)     lib_call.use = use;
975)     /**
976)      * @desc outputs
977)      * @author frac
978)      */
979)     function output(x) {
980)         console["_info"].apply(console, arguments);
981)     }
982)     lib_call.output = output;
983)     /**
984)      * @desc converts the "arguments"-map into an array
985)      * @param {Object} args
986)      * @author frac
987)      */
988)     function args2list(args) {
989)         return Object.keys(args).map(function (key) { return args[key]; });
990)     }
991)     lib_call.args2list = args2list;
992)     /**
993)      * @desc provides the call for an attribute of a class as a regular function
994)      * @param {string} name the name of the attribute
995)      * @return {*}
996)      * @author frac
997)      */
998)     function attribute(name) {
999)         return (function (object) { return object[name]; });
1000)     }
1001)     lib_call.attribute = attribute;
1002)     /**
1003)      * @desc provides a method of a class as a regular function
1004)      * @param {string} name the name of the method
1005)      * @return {function}
1006)      * @author frac
1007)      */
1008)     function method(name) {
1009)         return (function (object) { return object[name].apply(object, args2list(arguments).slice(1)); });
1010)     }
1011)     lib_call.method = method;
1012)     /**
1013)      * @desc composes two functions (i.e. returns a function that return the result of the successive execution of both input-functions)
1014)      * @param {function} function_f
1015)      * @param {function} function_g
1016)      * @author frac
1017)      */
1018)     function compose(function_f, function_g) {
1019)         return (function (x) {
1020)             // return function_g(function_f(x));
1021)             return function_g(function_f.apply(function_f, args2list(arguments)));
1022)         });
1023)     }
1024)     lib_call.compose = compose;
1025)     /**
1026)      * @desc transforms a function with sequential input into a function with leveled input; example: add(2,3) = curryfy(add)(2)(3)
1027)      * @param {function} f
1028)      * @param {int} n (don't set manually)
1029)      * @return {function} the currified version of the in put function
1030)      * @author frac
1031)      */
1032)     function curryfy(f, n) {
1033)         if (n === void 0) { n = f.length; }
1034)         switch (n) {
1035)             case 0: {
1036)                 throw (new Error("[curryfy] impossible"));
1037)             }
1038)             case 1: {
1039)                 return f;
1040)             }
1041)             default: {
1042)                 return (function (x) {
1043)                     return (curryfy(function () { return f.apply(f, [x].concat(args2list(arguments))); }, n - 1));
1044)                 });
1045)             }
1046)         }
1047)     }
1048)     lib_call.curryfy = curryfy;
1049)     /**
1050)      * @desc adapter for old syntax
1051)      * @author frac
1052)      */
1053)     function wait(dependencies, action, parallel) {
1054)         if (action === void 0) { action = function () { console.log("all done"); }; }
1055)         if (parallel === void 0) { parallel = true; }
1056)         var wait = (parallel ? (new lib_call.class_wait_parallel(dependencies, action)) : (new lib_call.class_wait_sequential(dependencies, action)));
1057)         wait.run();
1058)     }
1059)     lib_call.wait = wait;
1060)     /**
1061)      * returns a function which goes through a process step by step
1062)      * a process is an array of objects like { func : {function}, state : {string}}
1063)      * trigger the start of the process by calling the returned function with one argument
1064)      * which represents the parameters of the first function which is in the process
1065)      * @param {Array<object>} _process
1066)      * @param {function} on_stateChange called before the next function is called
1067)      * @returns {function}
1068)      */
1069)     function simple_process(_process, on_stateChange, on_progress) {
1070)         if (on_stateChange === void 0) { on_stateChange = function (msg) { console.info("State changed " + msg); }; }
1071)         if (on_progress === void 0) { on_progress = function (msg, pos, max) { console.info("Progress '" + msg + "' " + pos + "/" + max); }; }
1072)         var data_hashmap = {};
1073)         var _orchestrate = function (data, pos) {
1074)             if (pos === void 0) { pos = 0; }
1075)             if (is_def(data)) {
1076)                 // data_hashmap[pos] = object_merge_objects({}, data, ["parents", "parent", "children"]);
1077)                 data_hashmap[pos] = {};
1078)                 Object.keys(data).filter(function (key) { return (["parents", "parent", "children"].indexOf(key) < 0); }).forEach(function (key) { return (data_hashmap[pos][key] = data[key]); });
1079)             }
1080)             else {
1081)                 if (is_def(data_hashmap[pos]) && is_def(data_hashmap[pos].processed)) {
1082)                     data = data_hashmap[pos];
1083)                 }
1084)             }
1085)             if (pos < _process.length) {
1086)                 var _func;
1087)                 if (typeof (_process[pos]) !== "undefined") {
1088)                     _func = _process[pos].func;
1089)                 }
1090)                 if (pos === 0) {
1091)                     data = { processed: data };
1092)                 }
1093)                 if (_process[pos]) {
1094)                     on_stateChange(_process[pos].state);
1095)                 }
1096)                 return (_func(data, function (processed_data) {
1097)                     setTimeout(_orchestrate({ "processed": processed_data }, pos + 1), 0);
1098)                 }, on_progress));
1099)             }
1100)             else {
1101)                 console.error("o.O.");
1102)             }
1103)         };
1104)         return _orchestrate;
1105)     }
1106)     lib_call.simple_process = simple_process;
1107) })(lib_call || (lib_call = {}));
1108) ///<reference path="../../base/build/logic.d.ts"/>
1109) "use strict";
1110) var lib_call;
1111) (function (lib_call) {
1112)     /**
1113)      * @author frac
1114)      */
1115)     function executor_resolve(result) {
1116)         return (function (resolve, reject) { return resolve(result); });
1117)     }
1118)     lib_call.executor_resolve = executor_resolve;
1119)     /**
1120)      * @author frac
1121)      */
1122)     function executor_reject(reason) {
1123)         return (function (resolve, reject) { return reject(reason); });
1124)     }
1125)     lib_call.executor_reject = executor_reject;
1126)     /**
1127)      * @author frac
1128)      */
1129)     function executor_transform(executor, transform_result, transform_reason) {
1130)         return (function (resolve, reject) {
1131)             executor(function (result) { return resolve(transform_result(result)); }, function (reason) { return reject(transform_reason(reason)); });
1132)         });
1133)     }
1134)     lib_call.executor_transform = executor_transform;
1135)     /**
1136)      * @author frac
1137)      */
1138)     function executor_transform_default(executor, transform_result, wrap_string) {
1139)         if (wrap_string === void 0) { wrap_string = null; }
1140)         var transform_reason = (function (error) { return ((wrap_string == null) ? error : new class_error(wrap_string, [error])); });
1141)         return (executor_transform(executor, transform_result, transform_reason));
1142)     }
1143)     lib_call.executor_transform_default = executor_transform_default;
1144)     /**
1145)      * @author frac
1146)      */
1147)     function executor_compose_sequential(first, second, deferred) {
1148)         if (deferred === void 0) { deferred = undefined; }
1149)         return (function (resolve, reject) {
1150)             first(function (result) {
1151)                 lib_call.schedule(function () { return second(result)(resolve, reject); }, deferred);
1152)             }, function (reason) {
1153)                 reject(reason);
1154)             });
1155)         });
1156)     }
1157)     lib_call.executor_compose_sequential = executor_compose_sequential;
1158)     /**
1159)      * @author frac
1160)      */
1161)     function executor_chain(state, executors, deferred) {
1162)         if (deferred === void 0) { deferred = lib_call.default_deferred; }
1163)         return (function (resolve, reject) {
1164)             if (executors.length == 0) {
1165)                 return resolve(state);
1166)             }
1167)             else {
1168)                 return executors[0](state)(function (result) {
1169)                     lib_call.schedule(function () { return executor_chain(result, executors.slice(1))(resolve, reject); });
1170)                 }, reject);
1171)             }
1172)         });
1173)         /*
1174)          */
1175)         /*
1176)         if (executors.length == 0) {
1177)             return executor_resolve<type_state, type_error>(state);
1178)         }
1179)         else if (executors.length == 1) {
1180)             return executors[0](state);
1181)         }
1182)         else {
1183)             return (
1184)                 executor_chain<type_state, type_error>(
1185)                     state,
1186)                     [
1187)                         state => (resolve, reject) => executors[0](state)(result => executors[1](result)(resolve, reject), reject)
1188)                     ].concat(executors.slice(2))
1189)                 )
1190)             );
1191)         }
1192)          */
1193)         /*
1194)         return (
1195)             executors.reduce(
1196)                 (chain, current) => executor_compose_sequential<type_state, type_state, type_error>(chain, current, deferred),
1197)                 executor_resolve<type_state, type_error>(state)
1198)             )
1199)         );
1200)          */
1201)     }
1202)     lib_call.executor_chain = executor_chain;
1203)     /**
1204)      * @author frac
1205)      */
1206)     function executor_first(executors) {
1207)         /*
1208)         return (
1209)             (resolve, reject) => {
1210)                 if (executors.length == 0) {
1211)                     reject(new Error("all failed"));
1212)                 }
1213)                 else {
1214)                     executors[0](
1215)                         result => {
1216)                             resolve(result);
1217)                         },
1218)                         reason => {
1219)                             executor_first<type_result, type_reason>(executors.slice(1))(resolve, reject);
1220)                         }
1221)                     )
1222)                 }
1223)             }
1224)         );
1225)          */
1226)         return (function (resolve, reject) {
1227)             executor_chain([], executors.map(function (executor) { return function (reasons) { return function (resolve_, reject_) {
1228)                 executor(function (result) { return reject_(result); }, function (reason) { return resolve_(reasons.concat([reason])); });
1229)             }; }; }))(function (errors) { return reject(errors); }, function (result) { return resolve(result); });
1230)         });
1231)     }
1232)     lib_call.executor_first = executor_first;
1233)     /**
1234)      * @author frac
1235)      */
1236)     function executor_condense(executors) {
1237)         return (executor_chain([], executors.map(function (executor) { return function (result) { return function (resolve, reject) {
1238)             executor(function (element) { return resolve(result.concat([element])); }, reject);
1239)         }; }; })));
1240)     }
1241)     lib_call.executor_condense = executor_condense;
1242)     /**
1243)      * @author frac
1244)      * @deprecated use condense
1245)      */
1246)     function executor_filter(executors, predicate) {
1247)         return (executor_chain([], executors.map(function (executor) { return function (result) { return function (resolve, reject) {
1248)             executor(function (element) { return resolve(predicate(element) ? result.concat([element]) : result); }, reject);
1249)         }; }; })));
1250)     }
1251)     lib_call.executor_filter = executor_filter;
1252)     /**
1253)      * @author frac
1254)      * @deprecated use condense
1255)      */
1256)     function executor_map(executors, transformator) {
1257)         return (executor_chain([], executors.map(function (executor) { return function (result) { return function (resolve, reject) {
1258)             executor(function (element1) { return resolve(result.concat([transformator(element1)])); }, reject);
1259)         }; }; })));
1260)     }
1261)     lib_call.executor_map = executor_map;
1262)     /**
1263)      * @author frac
1264)      * @deprecated use condense
1265)      */
1266)     function executor_reduce(executors, initial, accumulator) {
1267)         return (executor_chain(initial, executors.map(function (executor) { return function (result) { return function (resolve, reject) {
1268)             executor(function (element) { return resolve(accumulator(result, element)); }, reject);
1269)         }; }; })));
1270)     }
1271)     lib_call.executor_reduce = executor_reduce;
1272) })(lib_call || (lib_call = {}));
1273) var lib_call;
1274) (function (lib_call) {
1275)     /**
1276)      * @author fenris
1277)      */
1278)     var knot_loglevel_stack = [0];
1279)     /**
1280)      * @author fenris
1281)      */
1282)     function knot_loglevel_get() {
1283)         return knot_loglevel_stack.slice(-1)[0];
1284)     }
1285)     lib_call.knot_loglevel_get = knot_loglevel_get;
1286)     /**
1287)      * @author fenris
1288)      */
1289)     function knot_loglevel_push(loglevel) {
1290)         knot_loglevel_stack.push(loglevel);
1291)     }
1292)     lib_call.knot_loglevel_push = knot_loglevel_push;
1293)     /**
1294)      * @author fenris
1295)      */
1296)     function knot_loglevel_pop() {
1297)         knot_loglevel_stack.pop();
1298)     }
1299)     lib_call.knot_loglevel_pop = knot_loglevel_pop;
1300)     /**
1301)      * @author fenris
1302)      */
1303)     function knot_resolver(output) {
1304)         return (function (input) { return function (resolve, reject) { return resolve(output); }; });
1305)     }
1306)     lib_call.knot_resolver = knot_resolver;
1307)     /**
1308)      * @author fenris
1309)      */
1310)     function knot_id() {
1311)         return (function (input) { return function (resolve, reject) { return resolve(input); }; });
1312)     }
1313)     lib_call.knot_id = knot_id;
1314)     /**
1315)      * @author fenris
1316)      */
1317)     function knot_rejector(error) {
1318)         return (function (input) { return function (resolve, reject) { return reject(error); }; });
1319)     }
1320)     lib_call.knot_rejector = knot_rejector;
1321)     /**
1322)      * @author fenris
1323)      */
1324)     function knot_from_function(function_) {
1325)         return (function (input) { return function (resolve, reject) {
1326)             try {
1327)                 var output_1 = function_(input);
1328)                 resolve(output_1);
1329)             }
1330)             catch (exception) {
1331)                 reject((exception));
1332)             }
1333)         }; });
1334)     }
1335)     lib_call.knot_from_function = knot_from_function;
1336)     /**
1337)      * @author fenris
1338)      */
1339)     function knot_wrap(inner, convert_input, convert_output, convert_error) {
1340)         return (function (input_outer) { return function (resolve, reject) {
1341)             var input_inner = convert_input(input_outer);
1342)             inner(input_inner)(function (output_inner) {
1343)                 var output_outer = convert_output(output_inner);
1344)                 return resolve(output_outer);
1345)             }, function (error_inner) {
1346)                 var error_outer = convert_error(error_inner);
1347)                 return reject(error_outer);
1348)             });
1349)         }; });
1350)     }
1351)     lib_call.knot_wrap = knot_wrap;
1352)     /**
1353)      * @author fenris
1354)      */
1355)     function knot_wrap_log(inner) {
1356)         return (knot_wrap(inner, function (input) {
1357)             console.error("--", "input:", JSON.stringify(input));
1358)             return input;
1359)         }, function (output) {
1360)             console.error("--", "output:", JSON.stringify(output));
1361)             return output;
1362)         }, function (error) {
1363)             console.error("--", "error:", JSON.stringify(error));
1364)             return error;
1365)         }));
1366)     }
1367)     lib_call.knot_wrap_log = knot_wrap_log;
1368)     /**
1369)      * @author fenris
1370)      */
1371)     function knot_compose_sequential(first, second) {
1372)         var second_ = ((knot_loglevel_get() >= 1)
1373)             ? knot_wrap_log(second)
1374)             : second);
1375)         return (function (input) { return function (resolve, reject) {
1376)             first(input)(function (between) { return lib_call.schedule(function () { return second_(between)(resolve, reject); }); }, reject);
1377)         }; });
1378)     }
1379)     lib_call.knot_compose_sequential = knot_compose_sequential;
1380)     /**
1381)      * @author fenris
1382)      */
1383)     function knot_chain(knots) {
1384)         return (knots.reduce(knot_compose_sequential, knot_id()));
1385)     }
1386)     lib_call.knot_chain = knot_chain;
1387)     /**
1388)      * @author frac
1389)      */
1390)     /*
1391)     export function knot_compose_parallel<>(
1392)         upper : type_knot<type_input, type_output_upper, type_error_upper>,
1393)         lower : type_knot<type_input, type_output_lower, type_error_lower>
1394)     ) {
1395)         return (
1396)             input => (resolve, reject) => {
1397)                 upper(input)(
1398)                 )
1399)                 lower(input)(
1400)                 )
1401)             }
1402)         );
1403)     }
1404)      */
1405)     /**
1406)      * @author fenris
1407)      */
1408)     function knot_bunch(knots) {
1409)         return (function (input) { return function (resolve, reject) {
1410)             var done = false;
1411)             var master_output = {};
1412)             var ready = {};
1413)             var master_resolve = function (id, output) {
1414)                 if (!done) {
1415)                     master_output[id] = output;
1416)                     ready[id] = true;
1417)                     if (Object.keys(knots).every(function (id) { return (id in ready); })) {
1418)                         done = true;
1419)                         resolve(master_output);
1420)                     }
1421)                     else {
1422)                     }
1423)                 }
1424)                 else {
1425)                 }
1426)             };
1427)             var master_reject = function (id, error) {
1428)                 if (!done) {
1429)                     done = true;
1430)                     reject(error);
1431)                 }
1432)                 else {
1433)                 }
1434)             };
1435)             Object.keys(knots).forEach(function (id) {
1436)                 knots[id](input)(function (output) { return master_resolve(id, output); }, function (error) { return master_reject(id, error); });
1437)             });
1438)         }; });
1439)     }
1440)     lib_call.knot_bunch = knot_bunch;
1441)     /**
1442)      * @author frac
1443)      */
1444)     function knot_condense(knots) {
1445)         return (function (input) { return knot_chain(knots.map(function (knot) { return function (list) { return function (resolve, reject) {
1446)             knot(input)(function (element) { return resolve(list.concat([element])); }, reject);
1447)         }; }; }))([]); });
1448)     }
1449)     lib_call.knot_condense = knot_condense;
1450) })(lib_call || (lib_call = {}));
1451) var lib_meta;
1452) (function (lib_meta) {
1453)     /**
1454)      * @author frac
1455)      */
1456)     function type_toString(type) {
1457)         return ("<" + type.id + ">");
1458)     }
1459)     lib_meta.type_toString = type_toString;
1460)     /**
1461)      * @author frac
1462)      */
1463)     var class_pool = {};
1464)     /**
1465)      * @author frac
1466)      */
1467)     function class_set(name, class_) {
1468)         class_pool[name] = class_;
1469)     }
1470)     lib_meta.class_set = class_set;
1471)     /**
1472)      * @author frac
1473)      */
1474)     function class_get(name) {
1475)         if (name in class_pool) {
1476)             return class_pool[name];
1477)         }
1478)         else {
1479)             throw (new Error("no class registered for name '" + name + "'"));
1480)         }
1481)     }
1482)     lib_meta.class_get = class_get;
1483)     /**
1484)      * @author frac
1485)      */
1486)     function transform_field(name, attributes) {
1487)         var type = attributes["type"];
1488)         var path = name;
1489)         var label = ((attributes["title"] != undefined) ? attributes["title"] : name);
1490)         var display = ((attributes["display"] != undefined) ? attributes["display"] : true);
1491)         return ({
1492)             "path": path,
1493)             "type": type,
1494)             "label": label,
1495)             "display": display
1496)         });
1497)     }
1498)     lib_meta.transform_field = transform_field;
1499)     /**
1500)      * @author frac
1501)      */
1502)     function transform_description(label, description, groups_raw) {
1503)         if (groups_raw === void 0) { groups_raw = null; }
1504)         var fieldmap;
1505)         var fields = Object.keys(description).map(function (key) { return transform_field(key, description[key]); });
1506)         var groups = ((groups_raw == null)
1507)             ?
1508)                 null
1509)             :
1510)                 groups_raw.map(function (group_raw) {
1511)                     return {
1512)                         "label": group_raw["label"],
1513)                         "fields": group_raw["fields"].map(function (field_name) {
1514)                             var index = fields["findIndex"](function (field) { return (field.path == field_name); });
1515)                             if (index < 0) {
1516)                                 throw (new Error("field " + field_name + " not found in model-description"));
1517)                             }
1518)                             return index;
1519)                         })
1520)                     };
1521)                 }));
1522)         return {
1523)             "fields": fields,
1524)             "description": null,
1525)             "title": label,
1526)             "groups": groups
1527)         };
1528)     }
1529)     lib_meta.transform_description = transform_description;
1530)     /**
1531)      * @author frac
1532)      */
1533)     function transform_description_groups(label, description_model, description_groups) {
1534)         return ({
1535)             "label": label,
1536)             "groups": description_groups.map(function (group_raw) {
1537)                 return {
1538)                     "label": group_raw["label"],
1539)                     "fields": group_raw["fields"].map(function (path) {
1540)                         var field_raw = description_model[path];
1541)                         return transform_field(path, field_raw);
1542)                     })
1543)                 };
1544)             })
1545)         });
1546)     }
1547)     lib_meta.transform_description_groups = transform_description_groups;
1548) })(lib_meta || (lib_meta = {}));
1549) var plain_text_to_html = function (text) {
1550)     var ret = text;
1551)     ret = ret.replace(/  /g, "&nbsp;&nbsp;"); // convert multiple whitespace to forced ones
1552)     ret = ret.split("\n").join("<br/>");
1553)     return ret;
1554) };
1555) /**
1556)  * @desc makes a valid
1557)  */
1558) var format_sentence = function (str, rtl, caseSense) {
1559)     if (rtl === void 0) { rtl = false; }
1560)     if (caseSense === void 0) { caseSense = true; }
1561)     if (str === "") {
1562)         return str;
1563)     }
1564)     else {
1565)         var marks = {
1566)             ".": true,
1567)             "?": true,
1568)             "!": true
1569)         };
1570)         var default_mark = ".";
1571)         var ret = str.split("");
1572)         if (!rtl) {
1573)             ret[0] = ret[0].toLocaleUpperCase();
1574)             if (!(ret[ret.length - 1] in marks)) {
1575)                 ret.push(default_mark);
1576)             }
1577)         }
1578)         else {
1579)             ret[ret.length - 1] = ret[ret.length - 1].toLocaleUpperCase();
1580)             if (!(ret[0] in marks)) {
1581)                 ret.unshift(default_mark);
1582)             }
1583)         }
1584)         return ret.join("");
1585)     }
1586) };
1587) var fill_string_template = function (template_string, object, fabric, delimiter, default_string) {
1588)     if (fabric === void 0) { fabric = function (object, key) { return object[key]; }; }
1589)     if (delimiter === void 0) { delimiter = "%"; }
1590)     if (default_string === void 0) { default_string = null; }
1591)     function get_tags(str) {
1592)         var r = new RegExp(delimiter + "[^\\s^" + delimiter + "]+" + delimiter, "gi");
1593)         return ((str.match(r) || []).map(function (e) {
1594)             return e.slice(delimiter.length, e.length - delimiter.length);
1595)         }));
1596)     }
1597)     function replace_tag(str, tag, value) {
1598)         var r = new RegExp(delimiter + tag + delimiter, "gi");
1599)         return str.replace(r, value);
1600)     }
1601)     function replace_tags(str, obj) {
1602)         return (get_tags(str).reduce(function (ret, key) {
1603)             var value = "";
1604)             try {
1605)                 value = fabric(obj, key);
1606)                 if (value === void 0) {
1607)                     value = default_string;
1608)                 }
1609)             }
1610)             catch (e) {
1611)                 console.warn("invalid placeholder " + key);
1612)                 value = default_string;
1613)             }
1614)             return replace_tag(ret, key, value);
1615)         }, str));
1616)     }
1617)     return replace_tags(template_string, object);
1618) };
1619) var make_string_template = function (_template, _fabrics) {
1620)     if (_fabrics === void 0) { _fabrics = {}; }
1621)     function replace_tag(str, tag, value) {
1622)         var r = new RegExp("%" + tag + "%", "gi");
1623)         return str.replace(r, value);
1624)     }
1625)     function replace_tags(str, obj) {
1626)         return (Object.keys(obj).reduce(function (ret, key) {
1627)             return replace_tag(ret, key, _fabrics[key] || obj[key]);
1628)         }, str));
1629)     }
1630)     return (function (tags) {
1631)         return replace_tags(_template, tags);
1632)     });
1633) };
1634) var make_eml_header = (function () {
1635)     var _template = "";
1636)     _template += "From: %from%\n";
1637)     _template += "To: %recipient%\n";
1638)     _template += "Subject: %subject%\n";
1639)     _template += "X-Mailer: greenscale-plankton.emlgen\n";
1640)     return make_string_template(_template);
1641) })();
1642) var make_eml_body = (function () {
1643)     var exports = {};
1644)     exports["simple_body"] = make_string_template("Content-Type: %contenttype%\n\n%body%\n\n");
1645)     // very basic implementation
1646)     // parts = [{contenttype:"text/html; charset=UTF-8", body: "<h1>foo</h1>" }, {...}]
1647)     exports["body_boundrary"] = function (parts, boundrary) {
1648)         var _template = "";
1649)         _template += "--%boundrary%\n";
1650)         _template += "Content-Type: %contenttype%\n\n%body%\n\n";
1651)         //_template += "--%boundrary%--\n\n";
1652)         var maker = make_string_template(_template);
1653)         return (parts.reduce(function (prev, curr) {
1654)             curr.boundrary = boundrary;
1655)             return [prev, maker(curr)].join("");
1656)         }, ""));
1657)     };
1658)     // body must be base64 encoded!
1659)     exports["attachment_boundrary"] = function (parts, boundrary) {
1660)         var _template = "";
1661)         _template += "--%boundrary%\n";
1662)         _template += "Content-Type: %contenttype%\n";
1663)         _template += "Content-Transfer-Encoding: base64\n";
1664)         _template += "Content-Disposition: %disposition%; filename=\"%name%\"\n\n";
1665)         _template += "%body%\n\n";
1666)         //_template += "--%boundrary%--\n\n";
1667)         var maker = make_string_template(_template);
1668)         return (parts.reduce(function (prev, curr) {
1669)             curr.boundrary = boundrary;
1670)             if (curr.disposition === void 0)
1671)                 curr.disposition = "inline";
1672)             return [prev, maker(curr)].join("");
1673)         }, ""));
1674)     };
1675)     exports["gen_boundrary"] = function () {
1676)         return ("xxxxxxxxxxxxxxxxxxxxxx".replace(/[xy]/g, function (c) {
1677)             var r = crypto.getRandomValues(new Uint8Array(1))[0] % 16 | 0, v = c == "x" ? r : (r & 0x3 | 0x8);
1678)             return v.toString(16);
1679)         }));
1680)     };
1681)     // simple implementation without alternatives (old rfc)
1682)     exports["complete_boundrary"] = function (bodyparts, attachments) {
1683)         var ret = "";
1684)         var boundrary = exports["gen_boundrary"]();
1685)         ret += exports["body_boundrary"](bodyparts, boundrary);
1686)         ret += exports["attachment_boundrary"](attachments, boundrary);
1687)         ret += "--" + boundrary + "--\n\nINVISIBLE!!!!";
1688)         return (exports["simple_body"]({
1689)             "contenttype": sprintf("multipart/mixed; boundary=%s", [boundrary]),
1690)             "body": ret
1691)         }));
1692)     };
1693)     return exports;
1694) })();
1695) ///<reference path="../../base/build/logic.d.ts"/>
1696) var lib_string;
1697) (function (lib_string) {
1698)     /**
1699)      * @author frac
1700)      */
1701)     var hexdigits = 4;
1702)     /**
1703)      * @author frac
1704)      */
1705)     var index_max = 1 << (4 * hexdigits);
1706)     /**
1707)      * @author frac
1708)      */
1709)     var index_is = 0;
1710)     /**
1711)      * @author neuc,frac
1712)      */
1713)     function empty(str) {
1714)         var tmp = str.trim();
1715)         return (tmp === "");
1716)     }
1717)     lib_string.empty = empty;
1718)     /**
1719)      * @desc returns a unique string
1720)      * @param {string} prefix an optional prefix for the generated string
1721)      * @return {string}
1722)      * @author frac
1723)      */
1724)     function generate(prefix) {
1725)         if (prefix === void 0) { prefix = "string_"; }
1726)         if (index_is > index_max) {
1727)             throw (new Error("[string_generate] out of valid indices"));
1728)         }
1729)         else {
1730)             return lib_string.sprintf(prefix + "%0" + hexdigits.toString() + "X", [index_is++]);
1731)         }
1732)     }
1733)     lib_string.generate = generate;
1734)     /**
1735)      * @desc splits a string, but returns an empty list, if the string is empty
1736)      * @param {string} chain
1737)      * @param {string} separator
1738)      * @return {Array<string>}
1739)      * @author frac
1740)      */
1741)     function split(chain, separator) {
1742)         if (separator === void 0) { separator = " "; }
1743)         if (chain.length == 0) {
1744)             return [];
1745)         }
1746)         else {
1747)             return chain.split(separator);
1748)         }
1749)     }
1750)     lib_string.split = split;
1751)     /**
1752)      * @desc concats a given word with itself n times
1753)      * @param {string} word
1754)      * @param {int}
1755)      * @return {string}
1756)      * @author frac
1757)      */
1758)     function repeat(word, count) {
1759)         return ((count == 0) ? "" : (word + repeat(word, count - 1)));
1760)     }
1761)     lib_string.repeat = repeat;
1762)     /**
1763)      * @desc lengthens a string by repeatedly appending or prepending another string
1764)      * @param {string} word the string to pad
1765)      * @param {int} length the length, which the result shall have
1766)      * @param {string} symbol the string, which will be added (multiple times)
1767)      * @param {boolean} [prepend]; whether to prepend (~true) or append (~false); default: false
1768)      * @return {string} the padded string
1769)      * @author frac
1770)      */
1771)     function pad(word, length, symbol, prepend) {
1772)         if (prepend === void 0) { prepend = false; }
1773)         if (prepend) {
1774)             while (word.length < length)
1775)                 word = symbol + word;
1776)             return word.substring(word.length - length);
1777)         }
1778)         else {
1779)             while (word.length < length)
1780)                 word = word + symbol;
1781)             return word.substring(0, length);
1782)         }
1783)     }
1784)     lib_string.pad = pad;
1785)     /**
1786)      * @desc checks if a given string conttains a certain substring
1787)      * @param {string} string
1788)      * @param {string} part
1789)      * @return {boolean}
1790)      * @author frac
1791)      */
1792)     function contains(chain, part) {
1793)         if (typeof (chain) !== "string")
1794)             return false;
1795)         return (chain.indexOf(part) >= 0);
1796)     }
1797)     lib_string.contains = contains;
1798)     /**
1799)      * @desc checks if a given string starts with a certain substring
1800)      * @param {string} string
1801)      * @param {string} part
1802)      * @return {boolean}
1803)      * @author frac
1804)      */
1805)     function startsWith(chain, part) {
1806)         if (typeof (chain) !== "string")
1807)             return false;
1808)         // return (string.indexOf(part) === 0);
1809)         return ((function (m, n) {
1810)             if (n == 0) {
1811)                 return true;
1812)             }
1813)             else {
1814)                 if (m == 0) {
1815)                     return false;
1816)                 }
1817)                 else {
1818)                     return ((chain[0] == part[0]) && startsWith(chain.substring(1), part.substring(1)));
1819)                 }
1820)             }
1821)         })(chain.length, part.length));
1822)     }
1823)     lib_string.startsWith = startsWith;
1824)     /**
1825)      * @desc checks if a given string ends with a certain substring
1826)      * @param {string} string
1827)      * @param {string} part
1828)      * @return {boolean}
1829)      * @author frac
1830)      */
1831)     function endsWith(chain, part) {
1832)         if (typeof (chain) !== "string")
1833)             return false;
1834)         // return (string.lastIndexOf(part) === string.length-part.length);
1835)         return ((function (m, n) {
1836)             if (n == 0) {
1837)                 return true;
1838)             }
1839)             else {
1840)                 if (m == 0) {
1841)                     return false;
1842)                 }
1843)                 else {
1844)                     // console.info(("(" + string[m-1] + " == " + part[n-1] + ")") + " = " + String(string[m-1] == part[n-1]));
1845)                     return ((chain[m - 1] == part[n - 1]) && endsWith(chain.substring(0, m - 1), part.substring(0, n - 1)));
1846)                 }
1847)             }
1848)         })(chain.length, part.length));
1849)     }
1850)     lib_string.endsWith = endsWith;
1851)     /**
1852)      * @desc count the occourrences of a string in a string
1853)      * @param string haystack_string the string wich should be examined
1854)      * @param string needle_string the string which should be counted
1855)      * @author neuc
1856)      */
1857)     function count_occourrences(haystack_string, needle_string, check_escape) {
1858)         var cnt = 0;
1859)         var pos = -1;
1860)         do {
1861)             pos = haystack_string.indexOf(needle_string, pos + 1);
1862)             if ((!check_escape) || (haystack_string[pos - 1] != "\\")) {
1863)                 cnt++;
1864)             }
1865)         } while (pos >= 0);
1866)         return cnt - 1;
1867)     }
1868)     lib_string.count_occourrences = count_occourrences;
1869)     ;
1870) })(lib_string || (lib_string = {}));
1871) /**
1872)  * @desc adapters for old syntax
1873)  */
1874) var string_generate = lib_string.generate;
1875) var string_split = lib_string.split;
1876) var string_repeat = lib_string.repeat;
1877) var string_pad = lib_string.pad;
1878) var string_contains = lib_string.contains;
1879) var string_startsWith = lib_string.startsWith;
1880) var string_endsWith = lib_string.endsWith;
1881) var string_count_occourrences = lib_string.count_occourrences;
1882) var lib_string;
1883) (function (lib_string) {
1884)     var pattern = /%([-+#0 ]*)([0-9]*)[\.]{0,1}([0-9]*)([\w]{1})/;
1885)     var gpattern = /%([-+#0 ]*)([0-9]*)[\.]{0,1}([0-9]*)([\w]{1})/g;
1886)     function split_format(format) {
1887)         var tmp = format.match(pattern);
1888)         if (tmp === null)
1889)             return null;
1890)         return {
1891)             'flags': tmp[1].split(""),
1892)             'width': Number(tmp[2]),
1893)             'precision': tmp[3] === '' ? null : Number(tmp[3]),
1894)             'specifier': tmp[4],
1895)             'string': format
1896)         };
1897)     }
1898)     function make_err(format, arg, should) {
1899)         return ("[sprintf]" + " " + "argument for '" + format.string + "' has to be '" + should + "' but '" + arg + "' is '" + typeof arg + "'!");
1900)     }
1901)     function test_arg(format, arg, should) {
1902)         if (typeof arg !== should) {
1903)             console.warn(make_err(format, arg, should));
1904)             return false;
1905)         }
1906)         return true;
1907)     }
1908)     function string_fill(str, char, len, left) {
1909)         while (str.length < len) {
1910)             if (left) {
1911)                 str += char;
1912)             }
1913)             else {
1914)                 str = char + str;
1915)             }
1916)         }
1917)         return str;
1918)     }
1919)     /**
1920)      * the known_parameters are used to parse the different identifiers for the welln known syntax:
1921)      *          flag   width   precision   identifier
1922)      *      %{[0#+- ]}{[0-9]*}.{[0-9]*}[fFdiueEgGsoxXaAsn]
1923)      * flags:
1924)      * 0    -   fill with '0' instead of ' ' if the string length < width
1925)      * #    -   not implemented
1926)      * -    -   left-justified -> fill on the right side to reach width
1927)      * +    -   force using '+' on positive numbers
1928)      * ' '  -   add a single space before positive numbers
1929)      *
1930)      * identifiers
1931)      * %f, %F       -   interpret given number as float, width: the minimal total width (fill with ' ' or '0' if the
1932)      *                  resulting string is too short, precision: cut more then given decimal places
1933)      * %d, %i, %u   -   interpret number as integer, decimal places will be cut. width: like float, precision:
1934)      *                  fill with '0' on right side until length given in precision is reached
1935)      * %e           -   interpret as float and write as scientifical number, width & precision like in float
1936)      * %E           -   same es %e but uppercase 'E'
1937)      * %g           -   use the shortest string of %f or %e
1938)      * %G           -   use the shortest string of %E or %E
1939)      * %s           -   simply print a string
1940)      * %o           -   print the given number in octal notation
1941)      * %x           -   print the given number in hex notation
1942)      * %X           -   same as %x but with uppercase characters
1943)      * %a           -   alias to %x
1944)      * %A           -   alias to %X
1945)      * %n           -   just print nothing
1946)      * @type {{}}
1947)      */
1948)     var known_params = {};
1949)     known_params["f"] = function (format, arg) {
1950)         if (!test_arg(format, arg, "number"))
1951)             return "Ø";
1952)         var tmp = Math.abs(arg);
1953)         var sign = (arg < 0) ? -1 : 1;
1954)         var tmp_result = null;
1955)         if (format.precision !== null) {
1956)             tmp = Math.floor(Math.pow(10, format.precision) * tmp) / Math.pow(10, format.precision);
1957)             var tmp_ = (tmp * sign).toString().split(".");
1958)             if (tmp_.length === 1)
1959)                 tmp_.push("");
1960)             tmp_[1] = string_fill(tmp_[1], "0", format.precision, true);
1961)             tmp_result = tmp_.join(".");
1962)         }
1963)         else {
1964)             tmp_result = (sign * tmp).toString();
1965)         }
1966)         if ((format.flags.indexOf(" ") >= 0) && (arg >= 0)) {
1967)             tmp_result = " " + tmp;
1968)         }
1969)         else if ((format.flags.indexOf("+") >= 0) && (arg >= 0)) {
1970)             tmp_result = "+" + tmp;
1971)         }
1972)         tmp_result = string_fill(tmp, (format.flags.indexOf("0") >= 0) ? "0" : " ", format.width, (format.flags.indexOf("-") >= 0));
1973)         return tmp_result;
1974)     };
1975)     known_params["F"] = known_params["f"];
1976)     known_params["d"] = function (format, arg) {
1977)         if (!test_arg(format, arg, 'number'))
1978)             return 'Ø';
1979)         var tmp = (((arg < 0 && format.specifier !== 'u') ? -1 : 1) * Math.floor(Math.abs(arg))).toString();
1980)         if ((format.specifier === 'd' || format.specifier === 'i') && format.flags.indexOf(' ') >= 0 && arg >= 0) {
1981)             tmp = ' ' + tmp;
1982)         }
1983)         else if ((format.specifier === 'd' || format.specifier === 'i') && format.flags.indexOf('+') >= 0 && arg >= 0) {
1984)             tmp = '+' + tmp;
1985)         }
1986)         tmp = string_fill(tmp, format.flags.indexOf('0') >= 0 ? '0' : ' ', format.width, format.flags.indexOf('-') >= 0);
1987)         tmp = string_fill(tmp, '0', format.precision === null ? 0 : format.precision, false);
1988)         return tmp;
1989)     };
1990)     known_params["i"] = known_params["d"];
1991)     known_params["u"] = known_params["d"];
1992)     known_params["e"] = function (format, arg) {
1993)         if (!test_arg(format, arg, 'number'))
1994)             return 'Ø';
1995)         var tmp = arg.toExponential(format.precision === null ? undefined : format.precision).toString();
1996)         if (format.flags.indexOf(' ') >= 0 && arg >= 0) {
1997)             tmp = ' ' + tmp;
1998)         }
1999)         else if (format.flags.indexOf('+') >= 0 && arg >= 0) {
2000)             tmp = '+' + tmp;
2001)         }
2002)         tmp = string_fill(tmp, format.flags.indexOf('0') >= 0 ? '0' : ' ', format.width, format.flags.indexOf('-') >= 0);
2003)         return tmp;
2004)     };
2005)     known_params["E"] = function (format, arg) {
2006)         return known_params["e"](format, arg).toUpperCase();
2007)     };
2008)     known_params["g"] = function (format, arg) {
2009)         if (!test_arg(format, arg, 'number'))
2010)             return 'Ø';
2011)         var tmpf = known_params["f"](format, arg);
2012)         var tmpe = known_params["e"](format, arg);
2013)         if (tmpf.length < tmpe.length) {
2014)             return tmpf;
2015)         }
2016)         else {
2017)             return tmpe;
2018)         }
2019)     };
2020)     known_params["G"] = function (format, arg) {
2021)         return known_params["g"](format, arg).toUpperCase();
2022)     };
2023)     known_params["s"] = function (format, arg) {
2024)         if (!test_arg(format, arg, 'string'))
2025)             return 'o.O';
2026)         var tmp = format.precision !== null ? arg.substr(0, format.precision) : arg;
2027)         tmp = string_fill(tmp, format.flags.indexOf('0') >= 0 ? '0' : ' ', format.width, format.flags.indexOf('-') >= 0);
2028)         return tmp;
2029)     };
2030)     known_params["o"] = function (format, arg) {
2031)         if (!test_arg(format, arg, 'number'))
2032)             return 'Ø';
2033)         var tmp = Math.floor(Math.round(Math.abs(arg))) * ((arg < 0) ? -1 : 1);
2034)         return known_params["s"](format, tmp.toString(8));
2035)     };
2036)     known_params["x"] = function (format, arg) {
2037)         if (!test_arg(format, arg, 'number'))
2038)             return 'Ø';
2039)         var tmp = Math.floor(Math.round(Math.abs(arg))) * ((arg < 0) ? -1 : 1);
2040)         return known_params["s"](format, tmp.toString(16));
2041)     };
2042)     known_params["a"] = known_params["x"];
2043)     known_params["X"] = function (format, arg) {
2044)         if (!test_arg(format, arg, 'number'))
2045)             return 'Ø';
2046)         return known_params["x"](format, arg).toUpperCase();
2047)     };
2048)     known_params["A"] = known_params["X"];
2049)     known_params["c"] = function (format, arg) {
2050)         var tmp = "";
2051)         if (typeof arg === "number") {
2052)             tmp = String.fromCharCode(arg);
2053)         }
2054)         else if ((typeof arg === "string") && (arg.length === 1)) {
2055)             tmp = arg[0];
2056)         }
2057)         else {
2058)             console.warn(make_err(format, arg, "number|string") + " and if string it needs to have the length of 1!");
2059)         }
2060)         return known_params["s"](format, tmp);
2061)     };
2062)     known_params["n"] = function () {
2063)         return "";
2064)     };
2065)     var decompose = function (chain, regexp) {
2066)         var result = regexp.exec(chain);
2067)         if (result == null) {
2068)             return null;
2069)         }
2070)         else {
2071)             var front = chain.substring(0, result.index);
2072)             var back = chain.substring(result.index + result[0].length);
2073)             return { "front": front, "match": result[0], "back": back };
2074)         }
2075)     };
2076)     /**
2077)      * an implementation of c sprintf
2078)      * @param {string} string format string
2079)      * @param {array} args arguments which should be filled into
2080)      * @returns {string}
2081)      */
2082)     lib_string.sprintf = function (input, args, original) {
2083)         if (args === void 0) { args = []; }
2084)         if (original === void 0) { original = null; }
2085)         if (original == null)
2086)             original = input;
2087)         var components = decompose(input, pattern);
2088)         if (components == null) {
2089)             if (args.length > 0) {
2090)                 console.warn("[sprintf] superfluous arguments while formatting '" + original + "': ", args);
2091)             }
2092)             return input;
2093)         }
2094)         else {
2095)             var arg;
2096)             var rest;
2097)             if (args.length > 0) {
2098)                 arg = args[0];
2099)                 rest = args.slice(1);
2100)             }
2101)             else {
2102)                 console.warn("[sprintf] out of arguments while formatting '" + original + "'");
2103)                 arg = null;
2104)                 rest = [];
2105)                 return input;
2106)             }
2107)             var fmt = split_format(components["match"]);
2108)             return (components["front"]
2109)                 + known_params[fmt.specifier](fmt, arg)
2110)                 + lib_string.sprintf(components["back"], rest, original));
2111)         }
2112)     };
2113)     /**
2114)      * an implementation of c printf
2115)      * @param {string} string format string
2116)      * @param {array} args arguments which should be filled into
2117)      * @returns {string}
2118)      */
2119)     function printf(format, args) {
2120)         console.log(lib_string.sprintf(format, args));
2121)     }
2122)     lib_string.printf = printf;
2123) })(lib_string || (lib_string = {}));
2124) var sprintf = lib_string.sprintf;
2125) var printf = lib_string.printf;
2126) /**
2127)  * @author neuc
2128)  */
2129) var strftime;
2130) (function (strftime) {
2131)     var currentDate = new Date();
2132)     var days = [
2133)         "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"
2134)     ];
2135)     var months = [
2136)         "January", "February", "March", "April", "May", "June", "July", "August", "September",
2137)         "October", "November", "December"
2138)     ];
2139)     function set_days(day_names) {
2140)         days = day_names;
2141)     }
2142)     strftime.set_days = set_days;
2143)     function set_months(month_names) {
2144)         months = month_names;
2145)     }
2146)     strftime.set_months = set_months;
2147)     // source: https://stackoverflow.com/questions/8619879/javascript-calculate-the-day-of-the-year-1-366
2148)     function helper_dayOfYear(date) {
2149)         var start = new Date(date.getFullYear(), 0, 0);
2150)         var diff = date - start;
2151)         var oneDay = 1000 * 60 * 60 * 24;
2152)         return Math.floor(diff / oneDay);
2153)     }
2154)     // source: http://weeknumber.net/how-to/javascript
2155)     function helper_weekOfYear(date_) {
2156)         var date = new Date(date_.getTime());
2157)         date.setHours(0, 0, 0, 0);
2158)         // Thursday in current week decides the year.
2159)         date.setDate(date.getDate() + 3 - (date.getDay() + 6) % 7);
2160)         // January 4 is always in week 1.
2161)         var week1 = new Date(date.getFullYear(), 0, 4);
2162)         // Adjust to Thursday in week 1 and count number of weeks from date to week1.
2163)         return 1 + Math.round(((date.getTime() - week1.getTime()) / 86400000
2164)             - 3 + (week1.getDay() + 6) % 7) / 7);
2165)     }
2166)     function helper_englishWeekOfYear(date) {
2167)         var nr = helper_weekOfYear(date);
2168)         if (date.getDay() === 0) {
2169)             nr = nr - 1;
2170)         }
2171)         return nr;
2172)     }
2173)     function set_currentDate(date) {
2174)         currentDate = date;
2175)     }
2176)     strftime.set_currentDate = set_currentDate;
2177)     function parse(format, date) {
2178)         if (!date) {
2179)             date = currentDate;
2180)         }
2181)         var ret = format;
2182)         var re = new RegExp("%[a-z]", "gi");
2183)         var match;
2184)         while (match = re.exec(format)) {
2185)             ret = ret.replace(match[0], parse_segment(match[0], date));
2186)         }
2187)         return ret;
2188)     }
2189)     strftime.parse = parse;
2190)     function parse_segment(segment, date) {
2191)         if (!date) {
2192)             date = currentDate;
2193)         }
2194)         var hm_segments = {
2195)             "%a": function () { return days[date.getDay()].slice(0, 3); },
2196)             "%A": function () { return days[date.getDay()]; },
2197)             "%b": function () { return days[date.getMonth()].slice(0, 3); },
2198)             "%B": function () { return days[date.getMonth()]; },
2199)             "%c": function () { return date.toLocaleString(); },
2200)             "%C": function () { return Math.floor((date.getFullYear()) / 100).toString(); },
2201)             "%d": function () { return sprintf("%02d", [date.getDate()]); },
2202)             "%D": function () { return parse("%m/%d/%y", date); },
2203)             "%e": function () { return sprintf("%2d", [date.getDate()]); },
2204)             "%F": function () { return parse("%Y-%m-%d", date); },
2205)             "%g": function () { return sprintf("%02d", [date.getFullYear() % 1000]); },
2206)             "%G": function () { return date.getFullYear().toString(); },
2207)             "%h": function () { return parse("%b", date); },
2208)             "%H": function () { return sprintf("%02d", [date.getHours()]); },
2209)             "%I": function () {
2210)                 return sprintf("%02d", [
2211)                     (date.getHours() > 12 ? date.getHours() - 12 : date.getHours())
2212)                 ]);
2213)             },
2214)             "%j": function () { return sprintf("%03d", [helper_dayOfYear(date)]); },
2215)             "%m": function () { return sprintf("%02d", [date.getMonth() + 1]); },
2216)             "%M": function () { return sprintf("%02d", [date.getMinutes()]); },
2217)             "%n": function () { return "\n"; },
2218)             "%p": function () { return (date.getHours() > 12 ? "PM" : "AM"); },
2219)             "%r": function () { return parse("%I:%M:%S %p", date); },
2220)             "%R": function () { return parse("%H:%M", date); },
2221)             "%S": function () { return date.getSeconds().toString(); },
2222)             "%t": function () { return "\t"; },
2223)             "%T": function () { return parse("%H:%M:%S", date); },
2224)             "%u": function () { return sprintf("%02d", [(date.getDay() === 0 ? 7 : date.getDay())]); },
2225)             "%U": function () { return sprintf("%02d", [helper_englishWeekOfYear(date)]); },
2226)             "%V": function () { return sprintf("%02d", [helper_weekOfYear(date)]); },
2227)             "%w": function () { return sprintf("%02d", [date.getDay().toString()]); },
2228)             "%W": function () { return parse("%w", date); },
2229)             "%x": function () { return parse("%m/%d/%G", date); },
2230)             "%X": function () { return parse("%T", date); },
2231)             "%y": function () { return parse("%g", date); },
2232)             "%Y": function () { return parse("%G", date); },
2233)             "%z": function () { return date.getTimezoneOffset().toString(); },
2234)             "%Z": function () { return date.toUTCString().split(' ').pop(); },
2235)             "%%": function () { return "%"; }
2236)         };
2237)         if (!(segment in hm_segments)) {
2238)             throw "unknown format argument '" + segment + "'";
2239)         }
2240)         return hm_segments[segment]();
2241)     }
2242) })(strftime || (strftime = {}));
2243) function locale_date(date, ignore_error) {
2244)     if (date === void 0) { date = new Date(); }
2245)     if (ignore_error === void 0) { ignore_error = false; }
2246)     if (!(date instanceof Date)) {
2247)         if (!ignore_error) {
2248)             throw new SyntaxError("date must be instance of Date");
2249)         }
2250)         else {
2251)             console.warn("'" + date + "' seems not to be instance of Date try to force convert.");
2252)             var tmp = date;
2253)             date = new Date(tmp);
2254)             if ((date.toString() === "Invalid Date") ||
2255)                 (!(date < new Date(0)) && !(date > new Date(0)))) {
2256)                 console.warn("conversion didn't work, returning default value");
2257)                 return "Ø";
2258)             }
2259)         }
2260)     }
2261)     var conf = global_config.get_value("date") || {
2262)         "use_locale_date": true,
2263)         "format_string": "%d.%m.%Y"
2264)     };
2265)     if (conf.use_locale_date) {
2266)         return date.toLocaleDateString();
2267)     }
2268)     else {
2269)         return strftime.parse(conf.format_string, date);
2270)     }
2271) }
2272) ;
2273) ///<reference path="../../call/build/logic.d.ts"/>
2274) var make_logger = (function () {
2275)     var _loggers = {};
2276)     var make_logger = function (prefix, current_loglevel) {
2277)         var log = [];
2278)         var level = [
2279)             "LOG", "INFO", "WARNING", "DEBUG"
2280)         ];
2281)         var logger = function (obj, lvl) {
2282)             var txt = obj.txt || obj;
2283)             if (!lib_call.is_def(lvl))
2284)                 lvl = 0;
2285)             var date = new Date();
2286)             log.push({
2287)                 "message": sprintf("%s [%s:%s] %s", [date.toString(), level[lvl], prefix, txt]),
2288)                 "timeStamp": +(date)
2289)             });
2290)             if (lvl <= current_loglevel) {
2291)                 var msg = ["[" + prefix + "]", txt];
2292)                 if (obj.arg)
2293)                     msg = ["[" + prefix + "]"].concat(Array.prototype.slice.call(obj.arg));
2294)                 if (lvl === 0)
2295)                     console["_log"].apply(console, msg);
2296)                 else if (lvl === 1)
2297)                     console["_info"].apply(console, msg);
2298)                 else if (lvl === 2)
2299)                     console["_warn"].apply(console, msg);
2300)                 else if (lvl >= 3)
2301)                     console["_log"].apply(console, msg);
2302)             }
2303)         };
2304)         _loggers[prefix] = {
2305)             "logger": logger,
2306)             "log": log
2307)         };
2308)         return logger;
2309)     };
2310)     make_logger["loggers"] = _loggers;
2311)     make_logger["complete_log"] = function () {
2312)         var logs = Object.keys(_loggers)
2313)             .reduce(function (p, c) {
2314)             return [].concat(p, _loggers[c].log);
2315)         }, []);
2316)         logs.sort(function (x, y) {
2317)             return ((x.timeStamp > y.timeStamp) ? -1 : +1);
2318)         });
2319)         return logs.map(function (x, i, a) {
2320)             return x.message;
2321)         });
2322)     };
2323)     if (true) {
2324)         var _log_all = function (log, lvl, next) {
2325)             if (next === void 0) { next = function () { }; }
2326)             return function () {
2327)                 var msg = [];
2328)                 for (var i = 0; i < arguments.length; i++) {
2329)                     if (typeof arguments[i] === "string") {
2330)                         msg.push(arguments[i]);
2331)                     }
2332)                     else {
2333)                         msg.push(JSON.stringify(arguments[i]));
2334)                     }
2335)                 }
2336)                 var obj = {
2337)                     txt: msg.join("\t"),
2338)                     arg: arguments
2339)                 };
2340)                 log(obj, lvl);
2341)                 next();
2342)             };
2343)         };
2344)         {
2345)             var __warn = make_logger("deprecated console.warn", 99);
2346)             var __error = make_logger("deprecated console.error", 99);
2347)             var __log = make_logger("deprecated console.log", 99);
2348)             var __info = make_logger("deprecated console.info", 99);
2349)             // bad ass
2350)             console["_log"] = console.log;
2351)             console["_error"] = console.error;
2352)             console["_warn"] = console.warn;
2353)             console["_info"] = console.info;
2354)         }
2355)     }
2356)     return make_logger;
2357) })();
2358) var __extends = (this && this.__extends) || function (d, b) {
2359)     for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
2360)     function __() { this.constructor = d; }
2361)     d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
2362) };
2363) ///<reference path="../../base/build/logic.d.ts"/>
2364) ///<reference path="../../string/build/logic.d.ts"/>
2365) /**
2366)  * @author fenris
2367)  */
2368) var lib_xml;
2369) (function (lib_xml) {
2370)     /**
2371)      * @author fenris
2372)      */
2373)     var class_node = (function () {
2374)         function class_node() {
2375)         }
2376)         return class_node;
2377)     }());
2378)     lib_xml.class_node = class_node;
2379)     /**
2380)      * @author fenris
2381)      */
2382)     var class_node_text = (function (_super) {
2383)         __extends(class_node_text, _super);
2384)         /**
2385)          * @author fenris
2386)          */
2387)         function class_node_text(content) {
2388)             _super.call(this);
2389)             this.content = content;
2390)         }
2391)         /**
2392)          * @author fenris
2393)          */
2394)         class_node_text.prototype.compile = function (depth) {
2395)             if (depth === void 0) { depth = 0; }
2396)             return (lib_string.repeat("\t", depth) + this.content + "\n");
2397)         };
2398)         return class_node_text;
2399)     }(class_node));
2400)     lib_xml.class_node_text = class_node_text;
2401)     /**
2402)      * @author fenris
2403)      */
2404)     var class_node_comment = (function (_super) {
2405)         __extends(class_node_comment, _super);
2406)         /**
2407)          * @author fenris
2408)          */
2409)         function class_node_comment(content) {
2410)             _super.call(this);
2411)             this.content = content;
2412)         }
2413)         /**
2414)          * @author fenris
2415)          */
2416)         class_node_comment.prototype.compile = function (depth) {
2417)             if (depth === void 0) { depth = 0; }
2418)             return (lib_string.repeat("\t", depth) + "<!-- " + this.content + " -->" + "\n");
2419)         };
2420)         return class_node_comment;
2421)     }(class_node));
2422)     lib_xml.class_node_comment = class_node_comment;
2423)     /**
2424)      * @author fenris
2425)      */
2426)     var class_node_complex = (function (_super) {
2427)         __extends(class_node_complex, _super);
2428)         /**
2429)          * @author fenris
2430)          */
2431)         function class_node_complex(name, attributes, children) {
2432)             if (attributes === void 0) { attributes = {}; }
2433)             if (children === void 0) { children = []; }
2434)             _super.call(this);
2435)             this.name = name;
2436)             this.attributes = attributes;
2437)             this.children = children;
2438)         }
2439)         /**
2440)          * @author fenris
2441)          */
2442)         class_node_complex.prototype.compile = function (depth) {
2443)             var _this = this;
2444)             if (depth === void 0) { depth = 0; }
2445)             var output = "";
2446)             var attributes = Object.keys(this.attributes).map(function (key) { return (" " + key + "=" + ("\"" + _this.attributes[key] + "\"")); }).join("");
2447)             output += (lib_string.repeat("\t", depth) + "<" + this.name + attributes + ">" + "\n");
2448)             this.children.forEach(function (child) { return (output += child.compile(depth + 1)); });
2449)             output += (lib_string.repeat("\t", depth) + "</" + this.name + ">" + "\n");
2450)             return output;
2451)         };
2452)         return class_node_complex;
2453)     }(class_node));
2454)     lib_xml.class_node_complex = class_node_complex;
2455) })(lib_xml || (lib_xml = {}));
2456) ///<reference path="../../base/build/logic.d.ts"/>
2457) var lib_object;
2458) (function (lib_object) {
2459)     /**
2460)      * @author fenris
2461)      */
2462)     function fetch(object, fieldname, fallback, escalation) {
2463)         if (fallback === void 0) { fallback = null; }
2464)         if (escalation === void 0) { escalation = 1; }
2465)         if ((fieldname in object) && (object[fieldname] !== undefined)) {
2466)             return object[fieldname];
2467)         }
2468)         else {
2469)             switch (escalation) {
2470)                 case 0: {
2471)                     return fallback;
2472)                     break;
2473)                 }
2474)                 case 1: {
2475)                     var message = ("field '" + fieldname + "' not in structure");
2476)                     message += ("; using fallback value '" + String(fallback) + "'");
2477)                     // console.warn(message);
2478)                     return fallback;
2479)                     break;
2480)                 }
2481)                 case 2: {
2482)                     var message = ("field '" + fieldname + "' not in structure");
2483)                     throw (new Error(message));
2484)                     break;
2485)                 }
2486)                 default: {
2487)                     throw (new Error("invalid escalation level " + escalation));
2488)                     break;
2489)                 }
2490)             }
2491)         }
2492)     }
2493)     lib_object.fetch = fetch;
2494)     /**
2495)      * @author fenris
2496)      */
2497)     function map(object_from, transformator) {
2498)         var object_to = {};
2499)         Object.keys(object_from).forEach(function (key) { return (object_to[key] = transformator(object_from[key], key)); });
2500)         return object_to;
2501)     }
2502)     lib_object.map = map;
2503)     /**
2504)      * @author fenris
2505)      */
2506)     function from_array(array) {
2507)         var object = {};
2508)         array.forEach(function (entry) { return (object[entry.key] = entry.value); });
2509)         return object;
2510)     }
2511)     lib_object.from_array = from_array;
2512)     /**
2513)      * @author fenris
2514)      */
2515)     function to_array(object) {
2516)         var array = [];
2517)         Object.keys(object).forEach(function (key) { return array.push({ "key": key, "value": object[key] }); });
2518)         return array;
2519)     }
2520)     lib_object.to_array = to_array;
2521)     /**
2522)      * @author fenris
2523)      */
2524)     function values(object) {
2525)         return to_array(object).map(function (entry) { return entry.value; });
2526)     }
2527)     lib_object.values = values;
2528)     /**
2529)      * @author fenris
2530)      */
2531)     function path_read(object, path, fallback, escalation) {
2532)         if (fallback === void 0) { fallback = null; }
2533)         if (escalation === void 0) { escalation = 1; }
2534)         var steps = ((path.length == 0) ? [] : path.split("."));
2535)         if (steps.length == 0) {
2536)             throw (new Error("empty path"));
2537)         }
2538)         else {
2539)             var position_1 = object;
2540)             var reachable = steps.slice(0, steps.length - 1).every(function (step) {
2541)                 position_1 = object_fetch(position_1, step, null, 0);
2542)                 return (position_1 != null);
2543)             });
2544)             if (reachable) {
2545)                 return object_fetch(position_1, steps[steps.length - 1], fallback, escalation);
2546)             }
2547)             else {
2548)                 return object_fetch({}, "_dummy_", fallback, escalation);
2549)             }
2550)         }
2551)     }
2552)     lib_object.path_read = path_read;
2553)     /**
2554)      * @author fenris
2555)      */
2556)     function path_write(object, path, value, construct) {
2557)         if (construct === void 0) { construct = true; }
2558)         var steps = ((path.length == 0) ? [] : path.split("."));
2559)         if (steps.length == 0) {
2560)             throw (new Error("empty path"));
2561)         }
2562)         else {
2563)             var position_2 = object;
2564)             var reachable = steps.slice(0, steps.length - 1).every(function (step) {
2565)                 var position_ = object_fetch(position_2, step, null, 0);
2566)                 if (position_ == null) {
2567)                     if (construct) {
2568)                         position_2[step] = {};
2569)                         position_2 = position_2[step];
2570)                         return true;
2571)                     }
2572)                     else {
2573)                         return false;
2574)                     }
2575)                 }
2576)                 else {
2577)                     position_2 = position_;
2578)                     return true;
2579)                 }
2580)             });
2581)             if (reachable) {
2582)                 position_2[steps[steps.length - 1]] = value;
2583)             }
2584)             else {
2585)                 throw (new Error("path " + path + " does not exist and may not be constructed"));
2586)             }
2587)         }
2588)     }
2589)     lib_object.path_write = path_write;
2590)     /**
2591)      * @author fenris
2592)      */
2593)     function matches(object, pattern) {
2594)         return Object.keys(pattern).every(function (key) { return (pattern[key] == object[key]); });
2595)     }
2596)     lib_object.matches = matches;
2597)     /**
2598)      * @author fenris
2599)      */
2600)     function flatten(value) {
2601)         var integrate = function (result, key_, value_) {
2602)             if (value_ == null) {
2603)                 result[key_] = value_;
2604)             }
2605)             else {
2606)                 if (typeof (value_) != "object") {
2607)                     result[key_] = value_;
2608)                 }
2609)                 else {
2610)                     var result_1 = flatten(value_);
2611)                     Object.keys(result_1).forEach(function (key__) {
2612)                         var value__ = result_1[key__];
2613)                         result[(key_ + "." + key__)] = value__;
2614)                     });
2615)                 }
2616)             }
2617)         };
2618)         if (value == null) {
2619)             return null;
2620)         }
2621)         else {
2622)             var result_2 = {};
2623)             if (typeof (value) != "object") {
2624)                 result_2["value"] = value;
2625)             }
2626)             else {
2627)                 if (value instanceof Array) {
2628)                     var array = (value);
2629)                     array.forEach(function (element, index) { return integrate(result_2, "element_" + index, element); });
2630)                 }
2631)                 else {
2632)                     var object_1 = (value);
2633)                     Object.keys(object_1).forEach(function (key) { return integrate(result_2, key, object_1[key]); });
2634)                 }
2635)             }
2636)             return result_2;
2637)         }
2638)     }
2639)     lib_object.flatten = flatten;
2640)     /**
2641)      * @author frac
2642)      */
2643)     function clash(x, y) {
2644)         var z = {};
2645)         Object.keys(x).forEach(function (key) { return (z[key] = x[key]); });
2646)         Object.keys(y).forEach(function (key) { return (z[key] = y[key]); });
2647)         return z;
2648)     }
2649)     lib_object.clash = clash;
2650) })(lib_object || (lib_object = {}));
2651) /**
2652)  * @desc adapters for old syntax
2653)  * @author fenris
2654)  */
2655) var object_fetch = lib_object.fetch;
2656) var object_map = lib_object.map;
2657) var object_a2o = lib_object.from_array;
2658) var object_o2a = lib_object.to_array;
2659) var object_matches = lib_object.matches;
2660) var object_clash = lib_object.clash;
2661) ///<reference path="../../base/build/logic.d.ts"/>
2662) ///<reference path="../../string/build/logic.d.ts"/>
2663) /**
2664)  * @param {Object} map
2665)  * @return {string}
2666)  * @author frac
2667)  */
2668) /*export*/ var object_map2string = function (map) {
2669)     return (" " + Object.keys(map)
2670)         .filter(function (key) { return (key != "isMapped"); })
2671)         .map(function (key) { return ("" + ((map[key] == null) ? "-" : map[key].toString()) + ""); })
2672)         .join(" ")
2673)         + "");
2674) };
2675) /**
2676)  * @param {Array} array
2677)  * @return {string}
2678)  * @author frac
2679)  */
2680) /*export*/ var object_array2string = function (array) {
2681)     return ("" + array.map(function (element, index) {
2682)         switch (typeof (element)) {
2683)             case "object": return object_map2string(element);
2684)             default: return String(element);
2685)         }
2686)     }).join(",") + "");
2687) };
2688) /**
2689)  * @desc follows a path in an object-tree
2690)  * @param {Object} object the object in which the path lies
2691)  * @param {string} path the steps
2692)  * @param {boolean} [create] whether to create not yet existing branches
2693)  * @return {Object} {'successful': successful, 'position': position} where the branch or leaf at the end of the path
2694)  * @author frac
2695)  */
2696) var object_path_walk = function (object, path, create, null_on_missing) {
2697)     if (create === void 0) { create = true; }
2698)     if (null_on_missing === void 0) { null_on_missing = false; }
2699)     var steps = ((path == "") ? [] : path.split("."));
2700)     if (steps.length == 0) {
2701)         return object;
2702)     }
2703)     else {
2704)         var head = steps[0];
2705)         // create
2706)         {
2707)             if (!(head in object)) {
2708)                 if (create) {
2709)                     var value = null;
2710)                     if (steps.length >= 2) {
2711)                         var next = steps[1];
2712)                         var index = parseInt(next);
2713)                         if (!isNaN(index)) {
2714)                             value = [];
2715)                         }
2716)                         else {
2717)                             value = {};
2718)                         }
2719)                     }
2720)                     else {
2721)                         value = {};
2722)                     }
2723)                     object[head] = value;
2724)                 }
2725)                 else {
2726)                     // console.info("[object_path_walk] object is ", object);
2727)                     var message = "[object_path_walk] can not walk step \u00BB" + head + "\u00AB in path \u00BB" + path + "\u00AB on object";
2728)                     if (null_on_missing) {
2729)                         console.warn(message);
2730)                         return null;
2731)                     }
2732)                     else {
2733)                         throw (new Error(message));
2734)                     }
2735)                 }
2736)             }
2737)         }
2738)         // execute rest
2739)         {
2740)             var object_ = object[head];
2741)             var path_ = steps.slice(1).join(".");
2742)             return object_path_walk(object_, path_, create, null_on_missing);
2743)         }
2744)     }
2745)     /*
2746)     return (
2747)         string_split(path, ".").reduce(
2748)             function (position : any, step : string) : any {
2749)                 if (! lib_call.is_def(position[step], true)) {
2750)                     if (create) {
2751)                         position[step] = {};
2752)                     }
2753)                     else {
2754)                         // console.info("[object_path_walk] object is ", object);
2755)                         let message : string = sprintf("[object_path_walk] can not walk step »%s« in path »%s« on object", [step, path]);
2756)                         if (null_on_missing) {
2757)                             console.warn(message);
2758)                             return null;
2759)                         }
2760)                         else {
2761)                             throw (new Error(message));
2762)                         }
2763)                     }
2764)                 }
2765)                 return position[step];
2766)             },
2767)             object
2768)         )
2769)     );
2770)      */
2771) };
2772) /**
2773)  * @desc reads a branch/leaf from an object-tree
2774)  * @author frac
2775)  */
2776) /*export*/ var object_path_read = function (object, path, null_on_missing) {
2777)     if (null_on_missing === void 0) { null_on_missing = false; }
2778)     return object_path_walk(object, path, false, null_on_missing);
2779) };
2780) /**
2781)  * @desc writes a branch/leaf to an object-tree
2782)  * @author frac
2783)  */
2784) /*export*/ var object_path_write = function (object, path, value) {
2785)     // for "initializing" the object (important if the value to write is an entry in a yet not existing array)
2786)     /*let old : any = */ object_path_walk(object, path, true, true);
2787)     var steps = ((path == "") ? [] : path.split("."));
2788)     var position = object_path_walk(object, steps.slice(0, steps.length - 1).join("."), true);
2789)     if (position == undefined) {
2790)         console.warn("can't set \u00BB" + steps[steps.length - 1] + "\u00AB in undefined");
2791)     }
2792)     else {
2793)         position[steps[steps.length - 1]] = value;
2794)     }
2795) };
2796) /*export*/ var object_object_path_write_ex = function (obj, path, val) {
2797)     var ref = obj;
2798)     var paths = path.split(".");
2799)     var i;
2800)     for (i = 0; i < paths.length - 1; i++) {
2801)         if (ref[paths[i]] === void 0) {
2802)             if (/^(0|[1-9][0-9]*)$/.test(paths[i + 1])) {
2803)                 ref[paths[i]] = [];
2804)             }
2805)             else {
2806)                 ref[paths[i]] = {};
2807)             }
2808)         }
2809)         ref = ref[paths[i]];
2810)     }
2811)     ref[paths[i]] = val;
2812) };
2813) /**
2814)  * @desc filters branches from an object
2815)  * @param {Object} object the object to read from
2816)  * @param {Array} paths a list of string-lists, that are the paths to be propagated
2817)  * @return {Object} the object with only the selected branches
2818)  * @author frac
2819)  */
2820) /*export*/ var object_path_filter = function (object, paths) {
2821)     var result = {};
2822)     paths.forEach(function (path) {
2823)         var value = null;
2824)         try {
2825)             value = object_path_read(object, path);
2826)         }
2827)         catch (exception) {
2828)             console.warn(exception);
2829)         }
2830)         if (value != null) {
2831)             object_path_write(result, path, value);
2832)         }
2833)         else {
2834)             console.warn("skipped path \"" + path + "\" while filtering");
2835)         }
2836)     });
2837)     return result;
2838) };
2839) /**
2840)  * @desc dunno… returns a list of object-paths?
2841)  * @param {Object} object
2842)  * @param {string} p
2843)  * @todo can probably be merged with getLeafg
2844)  */
2845) /*export*/ var object_path_list = function (object, path, visited) {
2846)     if (path === void 0) { path = null; }
2847)     if (visited === void 0) { visited = []; }
2848)     var result = [];
2849)     visited.push(object);
2850)     for (var key in object) {
2851)         var value = object[key];
2852)         if (visited.indexOf(value) === -1) {
2853)             var key_ = (path == null) ? key : (path + "." + key);
2854)             if (typeof (value) === "object") {
2855)                 result = result.concat(object_path_list(value, key_, visited));
2856)             }
2857)             else {
2858)                 result.push({ "key": key_, "value": value });
2859)             }
2860)         }
2861)     }
2862)     return result;
2863) };
2864) /**
2865)  * theroreticaly loop prof walk through all elements and subelements of an object
2866)  * and call a callback for each entry
2867)  * @param {object} obj object to iterate through
2868)  * @param {function} callback
2869)  */
2870) /*export*/ var object_iterate = function (obj, callback, leafs_only, path, visited) {
2871)     if (leafs_only === void 0) { leafs_only = false; }
2872)     if (visited === void 0) { visited = []; }
2873)     var have_seen = function (ob) {
2874)         return visited.some(function (e) { return ((typeof ob === "Object") && (ob !== null) && (e === ob)); });
2875)     };
2876)     var next = [];
2877)     Object.keys(obj).forEach(function (key) {
2878)         var elem = obj[key];
2879)         if (!have_seen(elem)) {
2880)             visited.push(elem);
2881)             var _path = "";
2882)             if (typeof path === "undefined") {
2883)                 _path = key;
2884)             }
2885)             else {
2886)                 _path += [path, key].join(".");
2887)             }
2888)             if (!leafs_only)
2889)                 callback(_path, elem, key);
2890)             if (typeof (elem) === "object") {
2891)                 (function (elem_, callback_, _path_, visited_) {
2892)                     next.push(function () { object_iterate(elem_, callback_, leafs_only, _path_, visited_); });
2893)                 })(elem, callback, _path, visited);
2894)             }
2895)             else {
2896)                 if (leafs_only)
2897)                     callback(_path, elem, key);
2898)             }
2899)         }
2900)     });
2901)     var func;
2902)     while (func = next.shift()) {
2903)         func();
2904)     }
2905) };
2906) /**
2907)  * @desc get the leaf-nodes of an object
2908)  * @param {object} object
2909)  * @return {Array<string>} a list containing all leaf-nodes
2910)  * @author frac
2911)  */
2912) /*export*/ var getLeafs = function (object) {
2913)     var skip = {
2914)         "className": true,
2915)         "timeStamp": true,
2916)         "parentId": true,
2917)         "transactionID": true,
2918)         "guid": true,
2919)         "_id": true,
2920)         "parents": true,
2921)         "children": true
2922)     };
2923)     return (Object.keys(object).reduce(function (leafs, key) {
2924)         try {
2925)             var value = object[key];
2926)             if (key in skip) {
2927)                 console.warn("skipping field \"" + key + "\"");
2928)                 return leafs;
2929)             }
2930)             else {
2931)                 if ((typeof (value) === "object") && (value != null)) {
2932)                     return leafs.concat(getLeafs(value).map(function (leaf) { return (key + "." + leaf); }));
2933)                 }
2934)                 else {
2935)                     return leafs.concat([key]);
2936)                 }
2937)             }
2938)         }
2939)         catch (exception) {
2940)             console.warn(exception);
2941)             console.info("key: ", key);
2942)             return null;
2943)         }
2944)     }, new Array()));
2945) };
2946) /**
2947)  *
2948)  * @desc merges two arrays by probing
2949)  * @param {Array} core
2950)  * @param {Array} mantle
2951)  * @param {function} match
2952)  */
2953) /*export*/ var merge_array = function (core, mantle, match) {
2954)     if (match === void 0) { match = (function (x, y) { return (x === y); }); }
2955)     if ((core == undefined) || (mantle == undefined)) {
2956)         throw (new Error("Error: "
2957)             + ((core == undefined) ? " core must be an array and not '" + typeof (core) + "'" : "")
2958)             + ((mantle == undefined) ? " mantle must be an array and not '" + typeof (mantle) + "'" : "")));
2959)     }
2960)     var ret = core;
2961)     for (var i = 0; i < mantle.length; i++) {
2962)         var entry = mantle[i];
2963)         try {
2964)             var matching_index = core.find(function (element) { return match(element, entry); });
2965)             ret[matching_index] = object_merge_objects(core[matching_index], entry);
2966)         }
2967)         catch (e) {
2968)             ret.push(entry);
2969)         }
2970)     }
2971)     return ret;
2972) };
2973) /**
2974)  * @desc merges two objects recursivly
2975)  * @param {Object} object1 core
2976)  * @param {Object} object2 mantle
2977)  * @param {Array} [ignore_keys]
2978)  * @param [do_not_overwrite_existing_values]
2979)  * @returns {Object} a clone of object1 will be returned
2980)  */
2981) /*export*/ var object_merge_objects = function (object1, object2, ignore_keys, do_not_overwrite_existing_values, ignore_null, path) {
2982)     if (object1 === void 0) { object1 = null; }
2983)     if (object2 === void 0) { object2 = null; }
2984)     if (ignore_keys === void 0) { ignore_keys = ["parents"]; }
2985)     if (do_not_overwrite_existing_values === void 0) { do_not_overwrite_existing_values = false; }
2986)     if (ignore_null === void 0) { ignore_null = false; }
2987)     if (path === void 0) { path = []; }
2988)     if (object1 == null) {
2989)         if (object2 instanceof Array) {
2990)             object1 = [];
2991)         }
2992)         else {
2993)             object1 = {};
2994)         }
2995)     }
2996)     var iteration_keys = Object.keys(object2);
2997)     if (ignore_keys === []) {
2998)         if (path.indexOf(object2) >= 0)
2999)             return undefined;
3000)         path.push(object2);
3001)     }
3002)     //
3003)     for (var i = 0; i < iteration_keys.length; i += 1) {
3004)         var key = iteration_keys[i];
3005)         if (ignore_keys.some(function (k) {
3006)             return key == k;
3007)         })) {
3008)         }
3009)         else if (object2[key] === null) {
3010)             if (!ignore_null)
3011)                 object1[key] = null;
3012)         }
3013)         else if ((typeof (object2[key]) === "object") && ((typeof (object1[key]) === "object") || (typeof (object1[key]) === "undefined"))) {
3014)             object1[key] = object_merge_objects(object1[key], object2[key], ignore_keys, do_not_overwrite_existing_values, ignore_null, path);
3015)         }
3016)         else {
3017)             if ((do_not_overwrite_existing_values === false) || (typeof (object1[key]) === "undefined")) {
3018)                 object1[key] = object2[key];
3019)             }
3020)         }
3021)     }
3022)     return object1;
3023) };
3024) /*
3025)  * @param {object} recipie  ex: { "name" : { extract : function(o) { return o["name"]; }}}
3026)  * */
3027) var flatten_object = function (obj, recipie, drop_key) {
3028)     if (drop_key === void 0) { drop_key = (function (k) { return ["parents", "parent", "children"].indexOf(k) > -1; }); }
3029)     var ret = {};
3030)     for (var key in recipie) {
3031)         if (!drop_key(key)) {
3032)             var prefix = (recipie[key].prefix || "");
3033)             var recursive = (recipie[key].recursive || -1);
3034)             var extract = (recipie[key].extract || (function (x) { return x; }));
3035)             var _obj = extract(obj[key]);
3036)             if ((_obj !== null) && ((typeof _obj == "object") || (obj[key] instanceof Array)) && (!(recursive == 0))) {
3037)                 var tmp = {};
3038)                 var _recipie = {};
3039)                 for (var _i = 0, _a = Object.keys(_obj); _i < _a.length; _i++) {
3040)                     var k = _a[_i];
3041)                     _recipie[k] = {
3042)                         "prefix": (prefix + key + "."),
3043)                         "recursive": (recursive - 1),
3044)                         "extract": (function (x) { return x; })
3045)                     };
3046)                 }
3047)                 tmp = flatten_object(_obj, _recipie, drop_key);
3048)                 ret = object_merge_objects(ret, tmp);
3049)             }
3050)             else {
3051)                 ret[prefix + key] = _obj;
3052)             }
3053)         }
3054)     }
3055)     return ret;
3056) };
3057) /**
3058)  * use the complete path of an objects entry as key to make an one dimensional object
3059)  * @param {object} object the object which should be moade flat
3060)  * @param {string} [path] for the recursive call the current path
3061)  */
3062) /*export*/ var object_make_flat = function (object, path, filter, split_char, objects) {
3063)     if (path === void 0) { path = null; }
3064)     if (filter === void 0) { filter = ["parent", "children"]; }
3065)     if (split_char === void 0) { split_char = "."; }
3066)     if (objects === void 0) { objects = []; }
3067)     if (object.toFlat != undefined) {
3068)         return object.toFlat();
3069)     }
3070)     else {
3071)         var ret = {};
3072)         var default_visited_key = "___visited_path___";
3073)         var visited_key;
3074)         if (object != void 0) {
3075)             var iterate = function (key) {
3076)                 var newkey = key;
3077)                 if ((path != undefined) && (path !== "")) {
3078)                     newkey = path + split_char + newkey;
3079)                 }
3080)                 // do not touch objects we alrdy know
3081)                 if ((obj_ref[key] != undefined) && (!objects.some(function (e) { return (e === obj_ref); }))) {
3082)                     //if (lib_call.is_def(obj_ref[key]) && (! obj_ref[key].hasOwnProperty(visited_key)) && (key !== visited_key)) {
3083)                     if (typeof obj_ref[key] === "object") {
3084)                         ret = object_merge_objects(ret, object_make_flat(obj_ref[key], newkey, filter, split_char, objects.concat(object)));
3085)                     }
3086)                     else if (typeof obj_ref[key] === "function") {
3087)                     }
3088)                     else {
3089)                         var value = obj_ref[key];
3090)                         ret[newkey] = value;
3091)                     }
3092)                 }
3093)             };
3094)             visited_key = default_visited_key;
3095)             //object[visited_key] = true;
3096)             var obj_ref = object;
3097)             Object.keys(object).filter(function (key) { return (filter.indexOf(key) < 0); }).forEach(iterate);
3098)             if (typeof object.getComputedValues == "function") {
3099)                 visited_key = default_visited_key + "_" + Math.random().toString();
3100)                 obj_ref = object.getComputedValues();
3101)                 obj_ref[visited_key] = true;
3102)                 Object.keys(obj_ref).filter(function (key) { return (filter.indexOf(key) < 0); }).forEach(iterate);
3103)             }
3104)         }
3105)         else {
3106)         }
3107)         return ret;
3108)     }
3109) };
3110) /**
3111)  * splits a flat oject into an array of objects if there are paths containing numbers, which indicates
3112)  * that there might be an array
3113)  * used for normalisation of imports
3114)  * @param entry
3115)  * @param number_replace_string
3116)  * @param {function} [match_function] how to test key if it causes a split
3117)  * @returns {Array}
3118)  */
3119) var object_split_flat_object = function (entry, number_replace_string, fab_function, match_function) {
3120)     if (typeof (match_function) === "undefined") {
3121)         match_function = function (key) {
3122)             return (!key.match(/^custom/)) && key.match(/\.[0-9]+\./);
3123)         };
3124)     }
3125)     if (typeof (fab_function) === "undefined") {
3126)         fab_function = function (obj, e) {
3127)             return obj;
3128)         };
3129)     }
3130)     if (typeof (number_replace_string) === "undefined") {
3131)         number_replace_string = "%d";
3132)     }
3133)     var ret = {};
3134)     var _ret = [];
3135)     var keys = Object.keys(entry);
3136)     var group_keys = keys.filter(match_function);
3137)     keys.forEach(function (key) {
3138)         var index = 0;
3139)         var nkey = key;
3140)         if (match_function(key)) {
3141)             index = Number(key.match(/[0-9]+/)[0]).valueOf();
3142)             nkey = key.replace(/\.[0-9]+\./, "." + number_replace_string + ".");
3143)         }
3144)         if (!ret[index]) {
3145)             ret[index] = {};
3146)         }
3147)         ret[index][nkey] = entry[key];
3148)     });
3149)     keys = Object.keys(ret).sort();
3150)     _ret.push(ret[0]);
3151)     for (var index = 1; index < keys.length; index++) {
3152)         _ret.push(fab_function(ret[keys[index]], entry));
3153)     }
3154)     _ret[0] = object_merge_objects(_ret[0], ret[0]);
3155)     return _ret;
3156) };
3157) // TODO: move to exporter, it's to specific
3158) // to normalize the objects convert paths of a tree-like structure to a
3159) // key-value list with complete paths as key
3160) // the info object is passed to the next function as it is
3161) // and a flat_object (key : value)
3162) /*export*/ var object_make_flat_async = function (data, callback, on_progress) {
3163)     setTimeout((function (_obj, _cb, _info) {
3164)         return (function () {
3165)             var ret = _obj.map(function (o) { return object_make_flat(o); });
3166)             _cb({ "flat_object": ret, "objects": ret, "info": _info });
3167)         });
3168)     })((typeof (data.processed.objects) === "undefined") ? data.processed.source_object : data.processed.objects, callback, data.processed.info), 0);
3169) };
3170) var object_flatten = function (object, paths, prefix) {
3171)     if (prefix === void 0) { prefix = ""; }
3172)     var ret = {};
3173)     var paths_ = paths.reduce(function (prev, current) {
3174)         if (current.split(".").some(function (x) { return (x === "%d"); })) {
3175)             var path = current.split(".%d").shift();
3176)             var len = object_path_read(object, path).length;
3177)             for (var i = 0; i < len; i++) {
3178)                 prev.push(sprintf(current, [i]));
3179)             }
3180)         }
3181)         else {
3182)             prev.push(current);
3183)         }
3184)         return prev;
3185)     }, []);
3186)     for (var _i = 0, paths_1 = paths_; _i < paths_1.length; _i++) {
3187)         var path = paths_1[_i];
3188)         var tmp = object_path_read(object, path, true);
3189)         if ((tmp != undefined) && (tmp.toFlat != undefined)) {
3190)             var tmp_ = tmp.toFlat([path, "."].join(""));
3191)             for (var key in tmp_) {
3192)                 ret[key] = tmp_[key];
3193)             }
3194)         }
3195)         else {
3196)             ret[prefix + path] = tmp;
3197)         }
3198)     }
3199)     return ret;
3200) };
3201) /**
3202)  * parse
3203)  * @param {String} value
3204)  * @returns {Object}
3205)  */
3206) var object_parse = function (value) {
3207)     var content = JSON.parse(value);
3208)     var m = { "root": content };
3209)     (new Mapper()).mapClasses(m);
3210)     return m["root"];
3211) };
3212) /**
3213)  * stringify
3214)  *
3215)  * @description stringify object as JSON
3216)  */
3217) var object_stringify = function (object, readable) {
3218)     if (readable === void 0) { readable = false; }
3219)     return (JSON.stringify(object, function (key, value) {
3220)         if ((key == "parents") && (value !== null)) {
3221)             return null;
3222)         }
3223)         if (key == "changeActions") {
3224)             return undefined;
3225)         }
3226)         if (key == "observer") {
3227)             return undefined;
3228)         }
3229)         if (key == "isMapped") {
3230)             return undefined;
3231)         }
3232)         /*
3233)         if (value === null) {
3234)             return undefined;
3235)         }
3236)         */
3237)         return value;
3238)     }, readable ? 1 : 0));
3239) };
3240) var lib_object;
3241) (function (lib_object) {
3242)     /**
3243)      * @author frac
3244)      */
3245)     var class_relation = (function () {
3246)         /**
3247)          * @author frac
3248)          */
3249)         /*protected*/ function class_relation(id, parameters) {
3250)             this.id = id;
3251)             this.symbol = lib_object.fetch(parameters, "symbol", null, 1);
3252)             this.name = lib_object.fetch(parameters, "name", null, 1);
3253)             this.predicate = lib_object.fetch(parameters, "predicate", null, 2);
3254)         }
3255)         /**
3256)          * @author frac
3257)          */
3258)         class_relation.prototype.check = function (value, reference) {
3259)             return this.predicate(value, reference);
3260)         };
3261)         /**
3262)          * @author frac
3263)          */
3264)         class_relation.prototype.id_get = function () {
3265)             return this.id;
3266)         };
3267)         /**
3268)          * @author frac
3269)          */
3270)         class_relation.prototype.symbol_get = function () {
3271)             return this.symbol;
3272)         };
3273)         /**
3274)          * @author frac
3275)          */
3276)         class_relation.prototype.name_get = function () {
3277)             return this.name;
3278)         };
3279)         /**
3280)          * @author frac
3281)          */
3282)         class_relation.pool = function () {
3283)             return {
3284)                 "eq": {
3285)                     "symbol": "=",
3286)                     "name": "gleich",
3287)                     "predicate": function (value, reference) { return (value == reference); }
3288)                 },
3289)                 "ne": {
3290)                     "symbol": "≠",
3291)                     "name": "ungleich",
3292)                     "predicate": function (value, reference) { return (value != reference); }
3293)                 },
3294)                 "gt": {
3295)                     "symbol": ">",
3296)                     "name": "größer",
3297)                     "predicate": function (value, reference) { return (value > reference); }
3298)                 },
3299)                 "ge": {
3300)                     "symbol": "≥",
3301)                     "name": "größer oder gleich",
3302)                     "predicate": function (value, reference) { return (value >= reference); }
3303)                 },
3304)                 "lt": {
3305)                     "symbol": "<",
3306)                     "name": "kleiner",
3307)                     "predicate": function (value, reference) { return (value < reference); }
3308)                 },
3309)                 "le": {
3310)                     "symbol": "≤",
3311)                     "name": "kleiner oder gleich",
3312)                     "predicate": function (value, reference) { return (value <= reference); }
3313)                 }
3314)             };
3315)         };
3316)         /**
3317)          * @author frac
3318)          */
3319)         class_relation.get = function (id) {
3320)             var parameters = lib_object.fetch(this.pool(), id, null, 2);
3321)             return (new class_relation(id, parameters));
3322)         };
3323)         /**
3324)          * @author frac
3325)          */
3326)         class_relation.available = function () {
3327)             return Object.keys(this.pool());
3328)         };
3329)         return class_relation;
3330)     }());
3331)     lib_object.class_relation = class_relation;
3332)     /**
3333)      * @author frac
3334)      */
3335)     var class_filtrationitem = (function () {
3336)         /**
3337)          * @author frac
3338)          */
3339)         function class_filtrationitem(parameters) {
3340)             this.extract = lib_object.fetch(parameters, "extract", null, 2);
3341)             this.relation = lib_object.fetch(parameters, "relation", null, 2);
3342)             this.reference = lib_object.fetch(parameters, "reference", null, 2);
3343)         }
3344)         /**
3345)          * @author frac
3346)          */
3347)         class_filtrationitem.prototype.check = function (dataset) {
3348)             var value = this.extract(dataset);
3349)             return this.relation.check(value, this.reference);
3350)         };
3351)         return class_filtrationitem;
3352)     }());
3353)     lib_object.class_filtrationitem = class_filtrationitem;
3354)     /**
3355)      * @author frac
3356)      */
3357)     var class_filtration = (function () {
3358)         /**
3359)          * @author frac
3360)          */
3361)         function class_filtration(clauses) {
3362)             this.clauses = clauses;
3363)         }
3364)         /**
3365)          * @author frac
3366)          */
3367)         class_filtration.prototype.check = function (dataset) {
3368)             return (this.clauses.some(function (clause) { return clause.every(function (literal) { return literal.check(dataset); }); }));
3369)         };
3370)         /**
3371)          * @author frac
3372)          */
3373)         class_filtration.prototype.use = function (datasets) {
3374)             var _this = this;
3375)             return datasets.filter(function (dataset) { return _this.check(dataset); });
3376)         };
3377)         /**
3378)          * @author frac
3379)          */
3380)         class_filtration.test = function () {
3381)             var filtration = new class_filtration([
3382)                 [
3383)                     new class_filtrationitem({
3384)                         "extract": function (dataset) { return dataset["qux"]; },
3385)                         "relation": class_relation.get("eq"),
3386)                         "reference": "a"
3387)                     }),
3388)                 ],
3389)                 [
3390)                     new class_filtrationitem({
3391)                         "extract": function (dataset) { return dataset["qux"]; },
3392)                         "relation": class_relation.get("eq"),
3393)                         "reference": "c"
3394)                     }),
3395)                 ],
3396)             ]);
3397)             var datasets = pivot_demo_data0;
3398)             var datasets_ = filtration.use(datasets);
3399)             console.info(datasets);
3400)             console.info(datasets_);
3401)         };
3402)         return class_filtration;
3403)     }());
3404)     lib_object.class_filtration = class_filtration;
3405) })(lib_object || (lib_object = {}));
3406) var __extends = (this && this.__extends) || function (d, b) {
3407)     for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
3408)     function __() { this.constructor = d; }
3409)     d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
3410) };
3411) var lib_path;
3412) (function (lib_path) {
3413)     /**
3414)      * @author fenris
3415)      */
3416)     var class_step = (function () {
3417)         function class_step() {
3418)         }
3419)         return class_step;
3420)     }());
3421)     lib_path.class_step = class_step;
3422)     /**
3423)      * @author fenris
3424)      */
3425)     var class_step_stay = (function (_super) {
3426)         __extends(class_step_stay, _super);
3427)         function class_step_stay() {
3428)             _super.apply(this, arguments);
3429)         }
3430)         /**
3431)          * @author fenris
3432)          */
3433)         class_step_stay.prototype.invert = function () {
3434)             return (new class_step_stay());
3435)         };
3436)         /**
3437)          * @author fenris
3438)          */
3439)         class_step_stay.prototype.toString = function () {
3440)             return ".";
3441)         };
3442)         return class_step_stay;
3443)     }(class_step));
3444)     lib_path.class_step_stay = class_step_stay;
3445)     /**
3446)      * @author fenris
3447)      */
3448)     var class_step_back = (function (_super) {
3449)         __extends(class_step_back, _super);
3450)         function class_step_back() {
3451)             _super.apply(this, arguments);
3452)         }
3453)         /**
3454)          * @author fenris
3455)          */
3456)         class_step_back.prototype.invert = function () {
3457)             throw (new Error("impossible"));
3458)         };
3459)         /**
3460)          * @author fenris
3461)          */
3462)         class_step_back.prototype.toString = function () {
3463)             return "..";
3464)         };
3465)         return class_step_back;
3466)     }(class_step));
3467)     lib_path.class_step_back = class_step_back;
3468)     /**
3469)      * @author fenris
3470)      */
3471)     var class_step_regular = (function (_super) {
3472)         __extends(class_step_regular, _super);
3473)         /**
3474)          * @author fenris
3475)          */
3476)         function class_step_regular(name) {
3477)             _super.call(this);
3478)             this.name = name;
3479)         }
3480)         /**
3481)          * @author fenris
3482)          */
3483)         class_step_regular.prototype.invert = function () {
3484)             return (new class_step_back());
3485)         };
3486)         /**
3487)          * @author fenris
3488)          */
3489)         class_step_regular.prototype.toString = function () {
3490)             return this.name;
3491)         };
3492)         return class_step_regular;
3493)     }(class_step));
3494)     lib_path.class_step_regular = class_step_regular;
3495)     /**
3496)      * @author fenris
3497)      */
3498)     function step_read(s) {
3499)         switch (s) {
3500)             case ".": {
3501)                 return (new class_step_stay());
3502)             }
3503)             case "..": {
3504)                 return (new class_step_back());
3505)             }
3506)             default: {
3507)                 return (new class_step_regular(s));
3508)             }
3509)         }
3510)     }
3511)     lib_path.step_read = step_read;
3512) })(lib_path || (lib_path = {}));
3513) ///<reference path="../../../plankton/object/build/logic.d.ts"/>
3514) var lib_path;
3515) (function (lib_path) {
3516)     /**
3517)      * @author fenris
3518)      */
3519)     var class_chain = (function () {
3520)         /**
3521)          * @author fenris
3522)          */
3523)         function class_chain(steps) {
3524)             if (steps === void 0) { steps = []; }
3525)             this.steps = steps;
3526)         }
3527)         /**
3528)          * @author fenris
3529)          */
3530)         class_chain.splitter = function (system) {
3531)             if (system === void 0) { system = "unix"; }
3532)             return (object_fetch({
3533)                 "unix": "/",
3534)                 "win": "\\"
3535)             }, system, "/", 2));
3536)         };
3537)         /**
3538)          * @desc removes superfluent steps from the chain, e.g. infix ".."
3539)          * @author fenris
3540)          */
3541)         class_chain.prototype.normalize = function () {
3542)             var steps = this.steps;
3543)             // filter "stay"
3544)             {
3545)                 steps = steps.filter(function (step) { return (!(step instanceof lib_path.class_step_stay)); });
3546)             }
3547)             // filter "regular-back"
3548)             {
3549)                 var _loop_1 = function() {
3550)                     if (steps.length < 1) {
3551)                         return "break";
3552)                     }
3553)                     else {
3554)                         var last_1 = steps[0];
3555)                         var found = steps.slice(1).some(function (step, index) {
3556)                             if (step instanceof lib_path.class_step_back) {
3557)                                 if (last_1 instanceof lib_path.class_step_regular) {
3558)                                     steps.splice(index, 2);
3559)                                     return true;
3560)                                 }
3561)                             }
3562)                             last_1 = step;
3563)                             return false;
3564)                         });
3565)                         if (!found) {
3566)                             return "break";
3567)                         }
3568)                     }
3569)                 };
3570)                 while (true) {
3571)                     var state_1 = _loop_1();
3572)                     if (state_1 === "break") break;
3573)                 }
3574)             }
3575)             return (new class_chain(steps));
3576)         };
3577)         /**
3578)          * @author fenris
3579)          */
3580)         class_chain.prototype.invert = function () {
3581)             return (new class_chain(this.steps.map(function (step) { return step.invert(); })));
3582)         };
3583)         /**
3584)          * @author fenris
3585)          */
3586)         class_chain.prototype.add = function (step) {
3587)             return (new class_chain(this.steps.concat([step]))).normalize();
3588)         };
3589)         /**
3590)          * @author fenris
3591)          */
3592)         class_chain.prototype.extend = function (chain) {
3593)             return (new class_chain(this.steps.concat(chain.steps))).normalize();
3594)         };
3595)         /**
3596)          * @author fenris
3597)          */
3598)         class_chain.prototype.as_string = function (system) {
3599)             if (system === void 0) { system = "unix"; }
3600)             var splitter = class_chain.splitter(system);
3601)             return ((this.steps.length == 0) ? ("." + splitter) : this.steps.map(function (step) { return (step.toString() + splitter); }).join(""));
3602)         };
3603)         /**
3604)          * @author fenris
3605)          */
3606)         class_chain.prototype.toString = function () {
3607)             return this.as_string();
3608)         };
3609)         return class_chain;
3610)     }());
3611)     lib_path.class_chain = class_chain;
3612)     /**
3613)      * @author fenris
3614)      */
3615)     function chain_read(str, system) {
3616)         if (system === void 0) { system = "unix"; }
3617)         var splitter = class_chain.splitter(system);
3618)         var parts = str.split(splitter);
3619)         if (parts[parts.length - 1] == "")
3620)             parts.pop();
3621)         return (new class_chain(parts.map(lib_path.step_read)));
3622)     }
3623)     lib_path.chain_read = chain_read;
3624) })(lib_path || (lib_path = {}));
3625) ///<reference path="../../../plankton/object/build/logic.d.ts"/>
3626) var lib_path;
3627) (function (lib_path) {
3628)     /**
3629)      * @author fenris
3630)      */
3631)     var class_location = (function () {
3632)         /**
3633)          * @author fenris
3634)          */
3635)         function class_location(anchor, chain) {
3636)             this.anchor = anchor;
3637)             this.chain = chain;
3638)         }
3639)         /**
3640)          * @author fenris
3641)          */
3642)         class_location.anchorpattern = function (system) {
3643)             if (system === void 0) { system = "unix"; }
3644)             return (object_fetch({
3645)                 "unix": new RegExp("/"),
3646)                 "win": new RegExp("[A-Z]:\\\\>")
3647)             }, system, new RegExp("/"), 1));
3648)         };
3649)         /**
3650)          * @author fenris
3651)          */
3652)         class_location.prototype.normalize = function () {
3653)             return (new class_location(this.anchor, this.chain.normalize()));
3654)         };
3655)         /**
3656)          * @author fenris
3657)          */
3658)         class_location.prototype.extend = function (chain) {
3659)             return (new class_location(this.anchor, this.chain.extend(chain)));
3660)         };
3661)         /**
3662)          * @author fenris
3663)          */
3664)         class_location.prototype.go_thither = function () {
3665)             // console.error(">>", this.toString());
3666)             process.chdir(this.toString());
3667)         };
3668)         /**
3669)          * @author fenris
3670)          */
3671)         class_location.prototype.expedition = function (core) {
3672)             var that = this;
3673)             var current = location_read(process.cwd());
3674)             function begin() {
3675)                 // (new class_message("changing directory to '" + that.toString() + "'")).stderr();
3676)                 that.go_thither();
3677)             }
3678)             function end() {
3679)                 // (new class_message("changing directory to '" + current.toString() + "'")).stderr();
3680)                 current.go_thither();
3681)             }
3682)             begin();
3683)             core(end);
3684)         };
3685)         /**
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

3688)         class_location.prototype.as_string = function (system) {
3689)             if (system === void 0) { system = "unix"; }
3690)             return (((this.anchor != null) ? this.anchor : "") + this.chain.as_string(system));
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

3692)         /**
3693)          * @author fenris
3694)          */
3695)         class_location.prototype.toString = function () {
3696)             return this.as_string();
3697)         };
3698)         /**
3699)          * @author fenris
3700)          */
3701)         class_location.current = function () {
3702)             // return class_location.read(process.cwd());
3703)             return location_read(process.cwd());
3704)         };
3705)         /**
3706)          * @author fenris
3707)          */
3708)         class_location.tempfolder = function (system) {
3709)             if (system === void 0) { system = "unix"; }
3710)             return (object_fetch({
3711)                 "unix": new class_location("/", new lib_path.class_chain([new lib_path.class_step_regular("tmp")])),
3712)                 "win": new class_location(null, new lib_path.class_chain([new lib_path.class_step_regular("%TEMP%")]))
3713)             }, system, null, 2));
3714)         };
3715)         return class_location;
3716)     }());
3717)     lib_path.class_location = class_location;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

3718)     /**
3719)      * @author fenris
3720)      */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

3721)     function location_read(str, system) {
3722)         if (system === void 0) { system = "unix"; }
3723)         var regexp = class_location.anchorpattern(system);
3724)         var matching = regexp.exec(str);
3725)         if ((matching == null) || (matching.index > 0)) {
3726)             return (new class_location(null, lib_path.chain_read(str, system)));
3727)         }
3728)         else {
3729)             return (new class_location(matching[0], lib_path.chain_read(str.slice(matching[0].length), system)));
3730)         }
3731)     }
3732)     lib_path.location_read = location_read;
3733) })(lib_path || (lib_path = {}));
3734) var lib_path;
3735) (function (lib_path) {
3736)     /**
3737)      * @author fenris
3738)      */
3739)     var class_filepointer = (function () {
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

3740)         /**
3741)          * @author fenris
3742)          */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

3743)         function class_filepointer(location, filename) {
3744)             this.location = location;
3745)             this.filename = filename;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

3746)         }
3747)         /**
3748)          * @author fenris
3749)          */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

3753)         /**
3754)          * @author fenris
3755)          */
3756)         class_filepointer.prototype.foo = function (filepointer) {
3757)             return (new class_filepointer(this.location.extend(filepointer.location.chain), filepointer.filename));
3758)         };
3759)         /**
3760)          * @author fenris
3761)          */
3762)         class_filepointer.prototype.as_string = function (system) {
3763)             if (system === void 0) { system = "unix"; }
3764)             return (this.location.as_string(system) /* + "/"*/ + ((this.filename == null) ? "" : this.filename));
3765)         };
3766)         /**
3767)          * @author fenris
3768)          */
3769)         class_filepointer.prototype.toString = function () {
3770)             return this.as_string();
3771)         };
3772)         return class_filepointer;
3773)     }());
3774)     lib_path.class_filepointer = class_filepointer;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

3775)     /**
3776)      * @author fenris
3777)      */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

3778)     function filepointer_read(str, system) {
3779)         if (system === void 0) { system = "unix"; }
3780)         var splitter = lib_path.class_chain.splitter(system);
3781)         var parts = str.split(splitter);
3782)         var last = parts[parts.length - 1];
3783)         if (last == "") {
3784)             return (new class_filepointer(lib_path.location_read(parts.join(splitter), system), null));
3785)         }
3786)         else {
3787)             return (new class_filepointer(lib_path.location_read(parts.slice(0, parts.length - 1).join(splitter), system), last));
3788)         }
3789)     }
3790)     lib_path.filepointer_read = filepointer_read;
3791) })(lib_path || (lib_path = {}));
3792) ///<reference path="../../base/build/logic.d.ts"/>
3793) ///<reference path="../../call/build/logic.d.ts"/>
3794) var lib_file;
3795) (function (lib_file) {
3796)     /**
3797)      * @author fenris
3798)      * @todo move to a dedicated lib (e.g. "http", "transport", etc.)
3799)      */
3800)     function ajax(_a) {
3801)         var target = _a["target"], _b = _a["data"], data /*: {[key : string] : string}*/ = _b === void 0 ? null : _b, _c = _a["method"], method /* : string*/ = _c === void 0 ? "GET" : _c;
3802)         method = method.toLowerCase();
3803)         return (function (resolve, reject) {
3804)             var datastring = ((data == null) ? null : Object.keys(data).map(function (key) { return (key + "=" + data[key]); }).join("&"));
3805)             var suffix = ((method == "get") ? ("?" + datastring) : "");
3806)             var sending = ((method == "get") ? null : datastring);
3807)             var request = new XMLHttpRequest();
3808)             request.open(method.toUpperCase(), target + suffix, true);
3809)             request.onreadystatechange = function () {
3810)                 if (request.readyState === 4) {
3811)                     if (request.status === 200) {
3812)                         resolve(request.responseText);
3813)                     }
3814)                     else {
3815)                         reject(new Error("XMLHttpRequest failed"));
3816)                     }
3817)                 }
3818)             };
3819)             request.send(sending);
3820)         });
3821)     }
3822)     lib_file.ajax = ajax;
3823)     /**
3824)      * @author maspr
3825)      */
3826)     function determine_handler(path) {
3827)         if (/^https?:\/\//.test(path)) {
3828)             return "http";
3829)         }
3830)         else {
3831)             return "file";
3832)         }
3833)     }
3834)     /**
3835)      * @desc reads a file
3836)      * @author fenris
3837)      */
3838)     function read(path, skip_error) {
3839)         if (skip_error === void 0) { skip_error = false; }
3840)         var environment = lib_base.environment();
3841)         switch (environment) {
3842)             case "web": {
3843)                 return (function (resolve, reject) {
3844)                     ajax({
3845)                         "target": path,
3846)                         "method": "GET",
3847)                     })(resolve, function (reason) { return (skip_error ? resolve(null) : reject(reason)); });
3848)                 });
3849)                 break;
3850)             }
3851)             case "node": {
3852)                 switch (determine_handler(path)) {
3853)                     case "file":
3854)                         {
3855)                             var _fs_1 = require("fs");
3856)                             return (function (resolve, reject) {
3857)                                 _fs_1.readFile(path, {
3858)                                     "encoding": "utf8",
3859)                                     "flag": "r",
3860)                                 }, function (error, content) {
3861)                                     if (error == null) {
3862)                                         resolve(content);
3863)                                     }
3864)                                     else {
3865)                                         reject(error);
3866)                                     }
3867)                                 });
3868)                             });
3869)                         }
3870)                         break;
3871)                     case "http":
3872)                         {
3873)                             return function (resolve, reject) {
3874)                                 var _http = require("http");
3875)                                 var _https = require("https");
3876)                                 var _url = require("url");
3877)                                 var parsed_url = _url.parse(path, false, true);
3878)                                 var client = (parsed_url.protocol == "https:") ? _https : _http;
3879)                                 var default_port = (parsed_url.protocol == "https:") ? 443 : 80;
3880)                                 var options = {
3881)                                     hostname: parsed_url.hostname,
3882)                                     port: parsed_url.port || default_port,
3883)                                     path: parsed_url.path,
3884)                                     method: "GET"
3885)                                 };
3886)                                 var req = client.request(options, function (res) {
3887)                                     var data = ""; // @todo
3888)                                     res.on("data", function (chunk) {
3889)                                         data += chunk;
3890)                                     });
3891)                                     res.on("end", function () {
3892)                                         resolve(data);
3893)                                     });
3894)                                 });
3895)                                 req.end();
3896)                                 req.on("error", function (error) {
3897)                                     reject(error);
3898)                                 });
3899)                             };
3900)                         }
3901)                         break;
3902)                     default: {
3903)                         return (function (resolve, reject) { return reject(new Error("unhandled protocol")); });
3904)                     }
3905)                 }
3906)                 break;
3907)             }
3908)             default: {
3909)                 return (function (resolve, reject) { return reject(new Error("unhandled environment")); });
3910)                 break;
3911)             }
3912)         }
3913)     }
3914)     lib_file.read = read;
3915)     /**
3916)      * @desc reads a json file
3917)      * @author fenris
3918)      */
3919)     function read_json(path) {
3920)         return (function (resolve, reject) {
3921)             lib_call.executor_chain({}, [
3922)                 function (state) { return function (resolve_, reject_) {
3923)                     read(path)(function (content) {
3924)                         state.content = content;
3925)                         resolve_(state);
3926)                     }, reject_);
3927)                 }; },
3928)                 function (state) { return function (resolve_, reject_) {
3929)                     var error;
3930)                     try {
3931)                         state.data = JSON.parse(state.content);
3932)                         error = null;
3933)                     }
3934)                     catch (exception) {
3935)                         error = new class_error("invalid json", [exception]);
3936)                     }
3937)                     if (error == null) {
3938)                         resolve_(state);
3939)                     }
3940)                     else {
3941)                         reject_(error);
3942)                     }
3943)                 }; },
3944)             ])(function (state) { return resolve(state.data); }, reject);
3945)         });
3946)     }
3947)     lib_file.read_json = read_json;
3948)     /**
3949)      * @desc writes a file
3950)      * @author fenris
3951)      */
3952)     function write(path, content) {
3953)         var environment = lib_base.environment();
3954)         switch (environment) {
3955)             case "web": {
3956)                 return (function (resolve, reject) {
3957)                     reject(new Error("not implemented / not possible"));
3958)                 });
3959)                 break;
3960)             }
3961)             case "node": {
3962)                 var _fs_2 = require("fs");
3963)                 return (function (resolve, reject) {
3964)                     _fs_2.writeFile(path, content, {
3965)                         "encoding": "utf8",
3966)                         "flag": "w",
3967)                     }, function (error) {
3968)                         if (error == null) {
3969)                             resolve(undefined);
3970)                         }
3971)                         else {
3972)                             reject(error);
3973)                         }
3974)                     });
3975)                 });
3976)                 break;
3977)             }
3978)             default: {
3979)                 return (function (resolve, reject) { return reject(new Error("unhandled environment")); });
3980)                 break;
3981)             }
3982)         }
3983)     }
3984)     lib_file.write = write;
3985)     /**
3986)      * @desc writes a json file
3987)      * @author fenris
3988)      */
3989)     function write_json(path, data) {
3990)         return write(path, JSON.stringify(data, undefined, "\t"));
3991)     }
3992)     lib_file.write_json = write_json;
3993) })(lib_file || (lib_file = {}));
3994) var lib_args;
3995) (function (lib_args) {
3996)     /**
3997)      * @author fenris
3998)      */
3999)     var class_argument = (function () {
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

4000)         /**
4001)          * @author fenris
4002)          */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4003)         function class_argument(_a) {
4004)             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

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

Christian Fraß authored 7 years ago

4006)             this.type = type;
4007)             this.default_ = default_;
4008)             this.info = info;
4009)             this.mode = mode;
4010)             this.kind = kind;
4011)             this.parameters = parameters;
4012)             this.hidden = hidden;
4013)             if (!this.check()) {
4014)                 throw (new Error("invalid argument-setup"));
4015)             }
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

4016)         }
4017)         /**
4018)          * @author fenris
4019)          */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

4025)         };
4026)         /**
4027)          * @author fenris
4028)          */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4029)         class_argument.prototype.name_get = function () {
4030)             return this.name;
4031)         };
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

4032)         /**
4033)          * @author fenris
4034)          */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

4037)         };
4038)         /**
4039)          * @author fenris
4040)          */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

4043)         };
4044)         /**
4045)          * @author fenris
4046)          */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4047)         class_argument.prototype.kind_get = function () {
4048)             return this.kind;
4049)         };
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

4050)         /**
4051)          * @author fenris
4052)          */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4053)         class_argument.prototype.parameters_get = function () {
4054)             return this.parameters;
4055)         };
4056)         /**
4057)          * @author fenris
4058)          */
4059)         class_argument.prototype.hidden_get = function () {
4060)             return this.hidden;
4061)         };
4062)         /**
4063)          * @author fenris
4064)          */
4065)         class_argument.prototype.toString = function () {
4066)             return "<" + this.name + ">";
4067)         };
4068)         /**
4069)          * @author fenris
4070)          */
4071)         class_argument.prototype.indicator_main = function () {
4072)             if (this.kind == "volatile") {
4073)                 return this.parameters["indicators_long"][0];
4074)             }
4075)             else {
4076)                 return null;
4077)             }
4078)         };
4079)         /**
4080)          * @author fenris
4081)          */
4082)         class_argument.prototype.pattern_value = function () {
4083)             switch (this.type) {
4084)                 case "boolean": {
4085)                     return "false|true";
4086)                     break;
4087)                 }
4088)                 case "int": {
4089)                     return "[0-9]+";
4090)                     break;
4091)                 }
4092)                 case "float": {
4093)                     return "\\d*(?:\\.\\d+)?";
4094)                     break;
4095)                 }
4096)                 case "string": {
4097)                     return "\\S+";
4098)                     break;
4099)                 }
4100)                 default: {
4101)                     throw (new Error("unhandled type " + this.type));
4102)                     break;
4103)                 }
4104)             }
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

4105)         };
4106)         /**
4107)          * @author fenris
4108)          */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4109)         class_argument.prototype.extract = function (raw) {
4110)             switch (this.type) {
4111)                 case "boolean": {
4112)                     return (raw != "false");
4113)                     break;
4114)                 }
4115)                 case "int": {
4116)                     return parseInt(raw);
4117)                     break;
4118)                 }
4119)                 case "float": {
4120)                     return parseFloat(raw);
4121)                     break;
4122)                 }
4123)                 case "string": {
4124)                     return raw;
4125)                     break;
4126)                 }
4127)                 default: {
4128)                     throw (new Error("unhandled type " + this.type));
4129)                     break;
4130)                 }
4131)             }
4132)         };
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

4133)         /**
4134)          * @author fenris
4135)          */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4136)         class_argument.prototype.assign = function (data, raw) {
4137)             var value = this.extract(raw);
4138)             switch (this.mode) {
4139)                 case "replace": {
4140)                     data[this.name] = value;
4141)                     break;
4142)                 }
4143)                 case "accumulate": {
4144)                     /*
4145)                     if (! (this.name in data)) {
4146)                         data[this.name] = [];
4147)                     }
4148)                      */
4149)                     data[this.name].push(value);
4150)                     break;
4151)                 }
4152)                 default: {
4153)                     throw (new Error("unhandled mode " + this.mode));
4154)                 }
4155)             }
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

4156)         };
4157)         /**
4158)          * @author fenris
4159)          */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4160)         class_argument.prototype.make = function (data) {
4161)             var value = data[this.name];
4162)             return value.toString();
4163)         };
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

4164)         /**
4165)          * @author fenris
4166)          */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4167)         class_argument.prototype.generate_help = function () {
4168)             var output = "";
4169)             {
4170)                 var line = "";
4171)                 line += "\t";
4172)                 line += "<" + this.name + ">";
4173)                 line += "\n";
4174)                 output += line;
4175)             }
4176)             {
4177)                 var line = "";
4178)                 line += "\t\t";
4179)                 var infotext = ((this.info == null) ? "(no info available)" : this.info);
4180)                 line += infotext;
4181)                 if ((this.type != "boolean") && (this.default_ != null)) {
4182)                     line += "; default: " + this.default_.toString();
4183)                 }
4184)                 line += "\n";
4185)                 output += line;
4186)             }
4187)             return output;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

4191)     lib_args.class_argument = class_argument;
4192) })(lib_args || (lib_args = {}));
4193) ///<reference path="../../base/build/logic.d.ts"/>
4194) var lib_args;
4195) (function (lib_args) {
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

4196)     /**
4197)      * @author fenris
4198)      */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4199)     var settings = {
4200)         "environment": {
4201)             "cli": {
4202)                 "symbols": {
4203)                     "delimiter": " ",
4204)                     "prefix": "--",
4205)                     "assignment": "="
4206)                 }
4207)             },
4208)             "url": {
4209)                 "symbols": {
4210)                     "delimiter": "&",
4211)                     "prefix": "",
4212)                     "assignment": "="
4213)                 }
4214)             }
4215)         }
4216)     };
4217)     /**
4218)      * @author fenris
4219)      */
4220)     lib_args.verbosity = 0;
4221)     /**
4222)      * @author fenris
4223)      * @todo check validity
4224)      */
4225)     var class_handler = (function () {
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

4226)         /**
4227)          * @author fenris
4228)          */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

4231)         }
4232)         /**
4233)          * @author fenris
4234)          */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

4237)         };
4238)         /**
4239)          * @author fenris
4240)          */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4241)         class_handler.prototype.read = function (environment, input, data) {
4242)             var _this = this;
4243)             if (data === void 0) { data = {}; }
4244)             switch (environment) {
4245)                 case "cli":
4246)                 case "url": {
4247)                     // default values
4248)                     {
4249)                         this.arguments_.forEach(function (argument) {
4250)                             data[argument.name_get()] = argument.default_get();
4251)                         });
4252)                     }
4253)                     // preprocessing
4254)                     {
4255)                         // short indicators (lil hacky ...)
4256)                         {
4257)                             if (environment == "cli") {
4258)                                 this.filter("volatile").forEach(function (argument) {
4259)                                     // console.info(argument.parameters_get()["indicators_short"].join("|"));
4260)                                     var pattern_from = "";
4261)                                     {
4262)                                         pattern_from += "(?:^|" + settings["environment"][environment]["symbols"]["delimiter"] + ")";
4263)                                         pattern_from += "-" + argument.parameters_get()["indicators_short"].join("|");
4264)                                         pattern_from += "(?:$|" + settings["environment"][environment]["symbols"]["delimiter"] + ")";
4265)                                     }
4266)                                     var pattern_to = "";
4267)                                     {
4268)                                         pattern_to += settings["environment"][environment]["symbols"]["delimiter"];
4269)                                         pattern_to += settings["environment"][environment]["symbols"]["prefix"];
4270)                                         pattern_to += argument.indicator_main();
4271)                                         if (argument.type_get() != "boolean") {
4272)                                             pattern_to += settings["environment"][environment]["symbols"]["assignment"];
4273)                                         }
4274)                                     }
4275)                                     var result = input.replace(new RegExp(pattern_from, "g"), pattern_to);
4276)                                     if (lib_args.verbosity >= 3)
4277)                                         console.info("--", "replacing \"" + pattern_from + "\" by \"" + pattern_to + "\" in \"" + input + "\" to \"" + result + "\"");
4278)                                     input = result;
4279)                                 });
4280)                             }
4281)                         }
4282)                         if (lib_args.verbosity >= 3)
4283)                             console.info("--", "input is now \"" + input + "\"");
4284)                     }
4285)                     // parsing
4286)                     {
4287)                         var parts = input
4288)                             .split(settings["environment"][environment]["symbols"]["delimiter"])
4289)                             .filter(function (x) { return (x != ""); });
4290)                         var index_expected_1 = 0;
4291)                         parts.forEach(function (part) {
4292)                             if (lib_args.verbosity >= 2)
4293)                                 console.info("--", "analyzing \"" + part + "\"");
4294)                             var found = [
4295)                                 function () {
4296)                                     if (lib_args.verbosity >= 3)
4297)                                         console.info("--", "probing as volatile");
4298)                                     return (_this.filter("volatile")
4299)                                         .some(function (argument) {
4300)                                         if (lib_args.verbosity >= 4)
4301)                                             console.info("--", "trying as " + argument.toString());
4302)                                         var pattern = "";
4303)                                         {
4304)                                             var pattern_front = "";
4305)                                             pattern_front += "" + settings["environment"][environment]["symbols"]["prefix"];
4306)                                             pattern_front += "(?:" + argument.parameters_get()["indicators_long"].join("|") + ")";
4307)                                             pattern += pattern_front;
4308)                                         }
4309)                                         {
4310)                                             var pattern_back = "";
4311)                                             pattern_back += "" + settings["environment"][environment]["symbols"]["assignment"];
4312)                                             pattern_back += "(" + argument.pattern_value() + ")";
4313)                                             if (argument.type_get() == "boolean") {
4314)                                                 pattern_back = "(?:" + pattern_back + ")?";
4315)                                             }
4316)                                             pattern += pattern_back;
4317)                                         }
4318)                                         if (lib_args.verbosity >= 5)
4319)                                             console.info("--", "pattern: \"" + pattern + "\"");
4320)                                         var regexp = new RegExp(pattern);
4321)                                         var matching = regexp.exec(part);
4322)                                         if (lib_args.verbosity >= 5)
4323)                                             console.info("--", "matching:", matching);
4324)                                         if (matching == null) {
4325)                                             return false;
4326)                                         }
4327)                                         else {
4328)                                             argument.assign(data, matching[1]);
4329)                                             return true;
4330)                                         }
4331)                                     }));
4332)                                 },
4333)                                 function () {
4334)                                     if (lib_args.verbosity >= 3)
4335)                                         console.info("--", "probing as positional");
4336)                                     var positional = _this.filter("positional");
4337)                                     if (index_expected_1 >= positional.length) {
4338)                                         if (lib_args.verbosity >= 4)
4339)                                             console.info("--", "no positional arguments left");
4340)                                         return false;
4341)                                     }
4342)                                     else {
4343)                                         var argument = positional[index_expected_1];
4344)                                         if (lib_args.verbosity >= 4)
4345)                                             console.info("--", "trying as " + argument.toString());
4346)                                         var pattern = "";
4347)                                         {
4348)                                             var pattern_back = "";
4349)                                             pattern_back += "(" + argument.pattern_value() + ")";
4350)                                             pattern += pattern_back;
4351)                                         }
4352)                                         if (lib_args.verbosity >= 5)
4353)                                             console.info("--", "pattern: \"" + pattern + "\"");
4354)                                         var regexp = new RegExp(pattern);
4355)                                         var matching = regexp.exec(part);
4356)                                         if (lib_args.verbosity >= 5)
4357)                                             console.info("--", "matching:", matching);
4358)                                         if (matching == null) {
4359)                                             return false;
4360)                                         }
4361)                                         else {
4362)                                             argument.assign(data, matching[1]);
4363)                                             index_expected_1 += 1;
4364)                                             return true;
4365)                                         }
4366)                                     }
4367)                                 },
4368)                             ].some(function (x) { return x(); });
4369)                             if (!found) {
4370)                                 if (lib_args.verbosity >= 1)
4371)                                     console.warn("--", "couldn't parse \"" + part + "\"");
4372)                             }
4373)                         });
4374)                     }
4375)                     return data;
4376)                     break;
4377)                 }
4378)                 default: {
4379)                     throw (new Error("unhandled environment " + environment));
4380)                     break;
4381)                 }
4382)             }
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

4383)         };
4384)         /**
4385)          * @author fenris
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

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

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

Christian Fraß authored 7 years ago

4388)         class_handler.prototype.write = function (environment, data) {
4389)             switch (environment) {
4390)                 case "cli":
4391)                 case "url": {
4392)                     return (([]
4393)                         .concat(this.filter("volatile").map(function (argument) {
4394)                         var raw = "";
4395)                         {
4396)                             var raw_front = "";
4397)                             raw_front += settings["environment"][environment]["symbols"]["prefix"];
4398)                             raw_front += argument.parameters_get()["indicators_long"][0];
4399)                             raw += raw_front;
4400)                         }
4401)                         {
4402)                             var raw_back = "";
4403)                             raw_back += settings["environment"][environment]["symbols"]["assignment"];
4404)                             raw_back += argument.make(data);
4405)                             raw += raw_back;
4406)                         }
4407)                         return raw;
4408)                     }))
4409)                         .concat(this.filter("positional").map(function (argument) {
4410)                         var raw = "";
4411)                         {
4412)                             var raw_back = "";
4413)                             raw_back += argument.make(data);
4414)                             raw += raw_back;
4415)                         }
4416)                         return raw;
4417)                     })))
4418)                         .join(settings["environment"][environment]["symbols"]["delimiter"]));
4419)                     break;
4420)                 }
4421)                 default: {
4422)                     throw (new Error("unhandled environment " + environment));
4423)                     break;
4424)                 }
4425)             }
4426)         };
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

4431)         class_handler.prototype.generate_help = function (_a) {
4432)             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;
4433)             var environment = "cli";
4434)             var output = "";
4435)             {
4436)                 var section = "";
4437)                 {
4438)                     var line = "";
4439)                     line += "";
4440)                     line += "INFO";
4441)                     line += "\n";
4442)                     section += line;
4443)                 }
4444)                 {
4445)                     var line = "";
4446)                     line += "\t";
4447)                     line += programname + " -- " + description;
4448)                     line += "\n";
4449)                     section += line;
4450)                 }
4451)                 section += "\n";
4452)                 output += section;
4453)             }
4454)             {
4455)                 if (author != null) {
4456)                     var section = "";
4457)                     {
4458)                         var line = "";
4459)                         line += "";
4460)                         line += "AUTHOR";
4461)                         line += "\n";
4462)                         section += line;
4463)                     }
4464)                     {
4465)                         var line = "";
4466)                         line += "\t";
4467)                         line += "" + author;
4468)                         line += "\n";
4469)                         section += line;
4470)                     }
4471)                     section += "\n";
4472)                     output += section;
4473)                 }
4474)             }
4475)             {
4476)                 var section = "";
4477)                 {
4478)                     var line = "";
4479)                     line += "";
4480)                     line += "SYNOPSIS";
4481)                     line += "\n";
4482)                     section += line;
4483)                 }
4484)                 {
4485)                     var line = "";
4486)                     line += "\t";
4487)                     line += executable;
4488)                     line += settings["environment"][environment]["symbols"]["delimiter"];
4489)                     line += this.filter("positional")
4490)                         .map(function (argument) {
4491)                         var part = "";
4492)                         part += "<" + argument.name_get() + ">";
4493)                         return part;
4494)                     })
4495)                         .join(settings["environment"][environment]["symbols"]["delimiter"]);
4496)                     line += settings["environment"][environment]["symbols"]["delimiter"];
4497)                     line += this.filter("volatile")
4498)                         .filter(function (argument) { return (!argument.hidden_get()); })
4499)                         .map(function (argument) {
4500)                         var part = "";
4501)                         part += settings["environment"][environment]["symbols"]["prefix"];
4502)                         part += argument.parameters_get()["indicators_long"][0];
4503)                         if (argument.type_get() != "boolean") {
4504)                             part += settings["environment"][environment]["symbols"]["assignment"];
4505)                             part += "<" + argument.name_get() + ">";
4506)                         }
4507)                         part = "[" + part + "]";
4508)                         return part;
4509)                     })
4510)                         .join(settings["environment"][environment]["symbols"]["delimiter"]);
4511)                     line += "\n";
4512)                     section += line;
4513)                 }
4514)                 section += "\n";
4515)                 output += section;
4516)             }
4517)             {
4518)                 var section = "";
4519)                 {
4520)                     var line = "";
4521)                     line += "";
4522)                     line += "OPTIONS";
4523)                     line += "\n";
4524)                     section += line;
4525)                 }
4526)                 {
4527)                     section += (this.arguments_
4528)                         .filter(function (argument) { return (!argument.hidden_get()); })
4529)                         .map(function (argument) { return argument.generate_help(); })
4530)                         .join("\n"));
4531)                 }
4532)                 section += "\n";
4533)                 output += section;
4534)             }
4535)             return output;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

4539)     lib_args.class_handler = class_handler;
4540) })(lib_args || (lib_args = {}));
4541) var __extends = (this && this.__extends) || function (d, b) {
4542)     for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
4543)     function __() { this.constructor = d; }
4544)     d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
4545) };
4546) var _child_process = require("child_process");
4547) var _fs = require("fs");
4548) var configuration = {
4549)     "invocation": {
4550)         "interpreter": null,
4551)         "path": "koralle",
4552)     },
4553)     "version": "0.0.7",
4554)     "tempfolder": null,
4555)     "path_source": "source",
4556)     "path_build": "build",
4557)     "system": "unix",
4558)     "raw": false,
4559)     "execute": false,
4560)     "output": "gnumake",
4561)     "file": null,
4562)     "path": "project.json",
4563)     "showgraph": false,
4564) };
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

4565) /**
4566)  * @author fenris
4567)  */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4568) var class_message = (function () {
4569)     /**
4570)      * @author fenris
4571)      */
4572)     function class_message(content, parameters) {
4573)         if (parameters === void 0) { parameters = {}; }
4574)         /**
4575)          * @author fenris
4576)          */
4577)         this.depth = 0;
4578)         this.content = content;
4579)         this.type = lib_object.fetch(parameters, "type", null, 0);
4580)         this.depth = lib_object.fetch(parameters, "depth", 0, 0);
4581)         this.prefix = lib_object.fetch(parameters, "prefix", null, 0);
4582)         this.linebreak = lib_object.fetch(parameters, "linebreak", false, 0);
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

4584)     /**
4585)      * @author fenris
4586)      */
4587)     class_message.prototype.generate = function (with_type) {
4588)         if (with_type === void 0) { with_type = true; }
4589)         var output = "";
4590)         output += lib_string.repeat("\t", this.depth);
4591)         if (with_type) {
4592)             if (this.type != null) {
4593)                 output += ("[" + this.type + "]" + " ");
4594)             }
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

4599)         output += this.content;
4600)         if (this.linebreak) {
4601)             output += "\n";
4602)         }
4603)         return output;
4604)     };
4605)     /**
4606)      * @author fenris
4607)      */
4608)     class_message.prototype.stdout = function () {
4609)         console.log(this.generate(true));
4610)     };
4611)     /**
4612)      * @author fenris
4613)      */
4614)     class_message.prototype.stderr = function () {
4615)         console.error(this.generate(true));
4616)     };
4617)     /**
4618)      * @author fenris
4619)      */
4620)     class_message.prototype.console = function () {
4621)         switch (this.type) {
4622)             case "log": {
4623)                 console.log(this.generate(false));
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

4624)                 break;
4625)             }
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

4628)                 break;
4629)             }
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

4632)                 break;
4633)             }
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

4636)                 break;
4637)             }
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

4641)         }
4642)     };
4643)     return class_message;
4644) }());
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

4645) /**
4646)  * @author fenris
4647)  */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4648) var class_cliout = (function () {
4649)     function class_cliout() {
4650)     }
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

4651)     /**
4652)      * @author fenris
4653)      */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

4658)     /**
4659)      * @author fenris
4660)      */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

4664)     };
4665)     /**
4666)      * @author fenris
4667)      */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4668)     class_cliout.log = function (content, depth) {
4669)         if (depth === void 0) { depth = 0; }
4670)         this.stderr("-- " + content, depth);
4671)     };
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

4672)     /**
4673)      * @author fenris
4674)      */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4675)     class_cliout.info = function (content, depth) {
4676)         if (depth === void 0) { depth = 0; }
4677)         this.stderr(">> " + content, depth);
4678)     };
4679)     /**
4680)      * @author fenris
4681)      */
4682)     class_cliout.warn = function (content, depth) {
4683)         if (depth === void 0) { depth = 0; }
4684)         this.stderr(">> " + content, depth);
4685)     };
4686)     /**
4687)      * @author fenris
4688)      */
4689)     class_cliout.error = function (content, depth) {
4690)         if (depth === void 0) { depth = 0; }
4691)         this.stderr(">> " + content, depth);
4692)     };
4693)     return class_cliout;
4694) }());
4695) /**
4696)  * @author fenris
4697)  */
4698) var class_graph = (function () {
4699)     /**
4700)      * @author fenris
4701)      */
4702)     function class_graph(equality, nodes, edges) {
4703)         if (equality === void 0) { equality = (function (node1, node2) { return (node1 == node2); }); }
4704)         if (nodes === void 0) { nodes = []; }
4705)         if (edges === void 0) { edges = []; }
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

4706)         /**
4707)          * @author fenris
4708)          */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4709)         this.equality = (function (node1, node2) { return (node1 == node2); });
4710)         this.equality = equality;
4711)         this.nodes = nodes;
4712)         this.edges = edges;
4713)     }
4714)     /**
4715)      * @author frac
4716)      */
4717)     class_graph.prototype.has = function (node) {
4718)         var _this = this;
4719)         return this.nodes.some(function (node_) { return _this.equality(node, node_); });
4720)     };
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

4724)     class_graph.prototype.without = function (pivot) {
4725)         var _this = this;
4726)         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))); })));
4727)     };
4728)     /**
4729)      * @author fenris
4730)      */
4731)     class_graph.prototype.outgoing = function (node) {
4732)         var _this = this;
4733)         return this.edges.filter(function (edge) { return _this.equality(edge.from, node); });
4734)     };
4735)     /**
4736)      * @author fenris
4737)      */
4738)     class_graph.prototype.incoming = function (node) {
4739)         var _this = this;
4740)         return this.edges.filter(function (edge) { return _this.equality(edge.to, node); });
4741)     };
4742)     /**
4743)      * @author fenris
4744)      */
4745)     class_graph.prototype.topsort = function () {
4746)         var _this = this;
4747)         var graph = this;
4748)         if (graph.nodes.length == 0) {
4749)             return [];
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

4751)         else {
4752)             var pivot_1;
4753)             var found = graph.nodes.some(function (node) {
4754)                 var count = graph.edges.filter(function (edge) { return _this.equality(edge.to, node); }).length;
4755)                 if (count == 0) {
4756)                     pivot_1 = node;
4757)                     return true;
4758)                 }
4759)                 else {
4760)                     // console.info("'" + String(node) + "' has " + count.toString() + " incoming edges");
4761)                     return false;
4762)                 }
4763)             });
4764)             if (found) {
4765)                 return [pivot_1].concat(graph.without(pivot_1).topsort());
4766)             }
4767)             else {
4768)                 throw (new Error("circular dependencies found"));
4769)             }
4770)         }
4771)     };
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

4772)     /**
4773)      * @author fenris
4774)      */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4775)     class_graph.prototype.hasse = function () {
4776)         var _this = this;
4777)         return (new class_graph(this.equality, this.nodes, this.edges.filter(function (edge) {
4778)             var reachable = (_this.outgoing(edge.from).map(function (edge_) { return edge_.to; })
4779)                 .map(function (node) { return _this.outgoing(node).map(function (edge_) { return edge_.to; }); })
4780)                 .reduce(function (x, y) { return x.concat(y); }, []));
4781)             return (!reachable.some(function (node) { return _this.equality(node, edge.to); }));
4782)         })));
4783)     };
4784)     /**
4785)      * @author fenris
4786)      */
4787)     class_graph.prototype.output_graphviz = function (extract_label) {
4788)         if (extract_label === void 0) { extract_label = (function (node) { return String(node); }); }
4789)         var that = this;
4790)         function get_nodeindex(node) {
4791)             // return that.nodes.findIndex(node_ => that.equality(node, node_));
4792)             var index;
4793)             for (var index_1 = 0; index_1 < that.nodes.length; ++index_1) {
4794)                 if (that.equality(node, that.nodes[index_1])) {
4795)                     return index_1;
4796)                 }
4797)             }
4798)             return undefined;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

4800)         function nodeid(node) {
4801)             return "x_" + get_nodeindex(node).toString();
4802)         }
4803)         function nodelist() {
4804)             return (["\tnode [fontname=\"Monospace\", style=\"filled\", fillcolor=\"0.4+0.8+0.8\"];\n"]
4805)                 .concat(that.nodes
4806)                 .map(function (node, index) {
4807)                 return "\t" + nodeid(node) + " [label=\"" + extract_label(node) + "\"];\n";
4808)             }))
4809)                 .join(""));
4810)         }
4811)         function edgelist() {
4812)             return (["\tedge [fontname=\"Monospace\"];\n"]
4813)                 .concat(that.edges
4814)                 .map(function (edge, index) {
4815)                 return "\t" + nodeid(edge.from) + " -> " + nodeid(edge.to) + " [];\n";
4816)             }))
4817)                 .join(""));
4818)         }
4819)         var output = "digraph\n{\n\tgraph [fontname=\"Monospace\"];\n" + nodelist() + "\n" + edgelist() + "\n}\n";
4820)         return output;
4821)     };
4822)     return class_graph;
4823) }());
4824) /**
4825)  * @author fenris
4826)  */
4827) var lib_gnumake;
4828) (function (lib_gnumake) {
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

4829)     /**
4830)      * @author fenris
4831)      */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4832)     function macro_command(_a) {
4833)         var _b = _a["interpreter"], interpreter = _b === void 0 ? null : _b, path = _a["path"], _c = _a["args"], args = _c === void 0 ? [] : _c, _d = _a["output"], output = _d === void 0 ? null : _d, _e = _a["system"], system = _e === void 0 ? "unix" : _e;
4834)         switch (system) {
4835)             case "unix": {
4836)                 var command = path;
4837)                 {
4838)                     if (interpreter != null) {
4839)                         command = interpreter + " " + command;
4840)                     }
4841)                 }
4842)                 {
4843)                     var parts_1 = [];
4844)                     args.forEach(function (arg) { return parts_1.push(arg); });
4845)                     command = command + " " + parts_1.join(" ");
4846)                 }
4847)                 {
4848)                     if (output != null) {
4849)                         command = command + " > " + output;
4850)                     }
4851)                 }
4852)                 return command;
4853)                 break;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

4855)             case "win": {
4856)                 var command = "cmd //c";
4857)                 {
4858)                     command = command + " " + path;
4859)                 }
4860)                 {
4861)                     if (interpreter != null) {
4862)                         command = command + " " + interpreter;
4863)                     }
4864)                 }
4865)                 {
4866)                     var parts_2 = [];
4867)                     args.forEach(function (arg) { return parts_2.push(arg); });
4868)                     command = command + " " + parts_2.join(" ");
4869)                 }
4870)                 {
4871)                     if (output != null) {
4872)                         command = command + " > " + output;
4873)                     }
4874)                 }
4875)                 return command;
4876)                 break;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

4877)             }
4878)             default: {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

4881)             }
4882)         }
4883)     }
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

4885)     /**
4886)      * @author fenris
4887)      */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

4889)         /**
4890)          * @author fenris
4891)          */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4892)         // public constructor(name : string, dependencies : Array<string>, actions : Array<string>, phony : boolean = false) {
4893)         function class_rule(parameters) {
4894)             if (parameters === void 0) { parameters = {}; }
4895)             this.name = object_fetch(parameters, "name", null, 2);
4896)             this.dependencies = object_fetch(parameters, "dependencies", [], 0);
4897)             this.actions = object_fetch(parameters, "actions", [], 0);
4898)             this.phony = object_fetch(parameters, "phony", false, 0);
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

4899)         }
4900)         /**
4901)          * @author fenris
4902)          */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

4905)         };
4906)         /**
4907)          * @author fenris
4908)          */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4909)         class_rule.prototype.compile = function (silent) {
4910)             if (silent === void 0) { silent = false; }
4911)             var output = "";
4912)             output += (this.name + ": " + this.dependencies.map(function (dependency) { return (" " + dependency); }).join("") + "\n");
4913)             this.actions.forEach(function (action) { return (output += "\t" + (silent ? "@ " : "") + action + "\n"); });
4914)             if (this.phony) {
4915)                 output += (".PHONY: " + this.name + "\n");
4916)             }
4917)             return output;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

4919)         return class_rule;
4920)     }());
4921)     lib_gnumake.class_rule = class_rule;
4922)     /**
4923)      * @author fenris
4924)      */
4925)     var class_sheet = (function () {
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

4926)         /**
4927)          * @author fenris
4928)          */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4929)         function class_sheet(rules, comments) {
4930)             if (comments === void 0) { comments = []; }
4931)             this.rules = rules;
4932)             this.comments = comments;
4933)         }
Christian Fraß removed backup-data-files;...

Christian Fraß authored 7 years ago

4934)         /**
4935)          * @author fenris
4936)          */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4937)         class_sheet.prototype.compile = function (silent) {
4938)             if (silent === void 0) { silent = false; }
4939)             return ([]
4940)                 .concat(this.comments.map(function (comment) { return ("# " + comment); }))
4941)                 .concat([""])
4942)                 .concat(this.rules.map(function (rule) { return rule.compile(silent); }))
4943)                 .join("\n"));
Christian Fraß removed backup-data-files;...

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

4945)         return class_sheet;
4946)     }());
4947)     lib_gnumake.class_sheet = class_sheet;
4948) })(lib_gnumake || (lib_gnumake = {}));
4949) /**
4950)  * @author fenris
4951)  */
4952) var lib_ant;
4953) (function (lib_ant) {
4954)     /**
4955)      * @author fenris
4956)      */
4957)     var class_comment = (function () {
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

4958)         /**
4959)          * @author fenris
4960)          */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4961)         function class_comment(content) {
4962)             this.content = content;
4963)         }
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

4964)         /**
4965)          * @author fenris
4966)          */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

4973)     /**
4974)      * @author fenris
4975)      */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

4977)         /**
4978)          * @author fenris
4979)          */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

4982)         }
4983)         /**
4984)          * @author fenris
4985)          */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

4988)         };
4989)         /**
4990)          * @author fenris
4991)          */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

4992)         class_action.macro_exec = function (_a) {
4993)             var _b = _a["interpreter"], interpreter = _b === void 0 ? null : _b, path = _a["path"], _c = _a["args"], args = _c === void 0 ? [] : _c, _d = _a["output"], output = _d === void 0 ? null : _d, _e = _a["system"], system = _e === void 0 ? "unix" : _e;
4994)             switch (system) {
4995)                 case "unix": {
4996)                     var attributes = {};
4997)                     var args_ = [];
4998)                     if (interpreter == null) {
4999)                         attributes["executable"] = path;
5000)                     }
5001)                     else {
5002)                         attributes["executable"] = interpreter;
5003)                         args.push(path);
5004)                     }
5005)                     if (output != null) {
5006)                         attributes["output"] = output;
5007)                     }
5008)                     args_ = args_.concat(args);
5009)                     return (new lib_ant.class_action(new lib_xml.class_node_complex("exec", attributes, args_.map(function (arg) { return new lib_xml.class_node_complex("arg", { "value": arg }); }))));
5010)                     break;
5011)                 }
5012)                 case "win": {
5013)                     var attributes = {};
5014)                     var args_ = [];
5015)                     attributes["executable"] = "cmd";
5016)                     args_.push("/c");
5017)                     if (interpreter == null) {
5018)                     }
5019)                     else {
5020)                         args_.push(interpreter);
5021)                     }
5022)                     args_.push(path);
5023)                     args_ = args_.concat(args);
5024)                     if (output != null) {
5025)                         attributes["output"] = output;
5026)                     }
5027)                     return (new lib_ant.class_action(new lib_xml.class_node_complex("exec", attributes, args_.map(function (arg) { return new lib_xml.class_node_complex("arg", { "value": arg }); }))));
5028)                     break;
5029)                 }
5030)                 default: {
5031)                     throw (new Error("unhandled system " + system));
5032)                     break;
5033)                 }
5034)             }
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

5035)         };
5036)         /**
5037)          * @author fenris
5038)          */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

5039)         class_action.macro_command = function (cmdparams) { return this.macro_exec(cmdparams); };
5040)         return class_action;
5041)     }());
5042)     lib_ant.class_action = class_action;
5043)     /**
5044)      * @author fenris
5045)      */
5046)     var class_target = (function () {
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

5047)         /**
5048)          * @author fenris
5049)          */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

5050)         function class_target(parameters) {
5051)             if (parameters === void 0) { parameters = {}; }
5052)             this.name = object_fetch(parameters, "name", null, 2);
5053)             this.dependencies = object_fetch(parameters, "dependencies", [], 1);
5054)             this.actions = object_fetch(parameters, "actions", [], 0);
5055)         }
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

5056)         /**
5057)          * @author fenris
5058)          */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

5061)         };
5062)         /**
5063)          * @author fenris
5064)          */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

5065)         class_target.prototype.compile = function () {
5066)             return (new lib_xml.class_node_complex("target", {
5067)                 "name": this.name,
5068)                 "depends": this.dependencies.join(",")
5069)             }, this.actions.map(function (action) { return action.compile(); })));
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

5074)     /**
5075)      * @author fenris
5076)      */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

5078)         /**
5079)          * @author fenris
5080)          */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

5081)         function class_project(parameters) {
5082)             if (parameters === void 0) { parameters = {}; }
5083)             this.name = object_fetch(parameters, "name", null, 2);
5084)             this.default_ = object_fetch(parameters, "default", null, 2);
5085)             this.targets = object_fetch(parameters, "targets", [], 1);
5086)             this.comments = object_fetch(parameters, "comments", [], 0);
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

5087)         }
5088)         /**
5089)          * @author fenris
5090)          */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

5091)         class_project.prototype.compile = function () {
5092)             return (new lib_xml.class_node_complex("project", {
5093)                 "name": this.name,
5094)                 "default": this.default_,
5095)             }, ([]
5096)                 .concat(this.comments.map(function (comment) { return comment.compile(); }))
5097)                 .concat([
5098)                 new lib_xml.class_node_complex("property", {
5099)                     "environment": "env"
5100)                 }),
5101)             ])
5102)                 .concat(this.targets.map(function (target) { return target.compile(); })))));
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

5104)         return class_project;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

5106)     lib_ant.class_project = class_project;
5107) })(lib_ant || (lib_ant = {}));
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

5108) /**
5109)  * @author fenris
5110)  */
5111) var class_action = (function () {
5112)     /**
5113)      * @author fenris
5114)      */
5115)     function class_action() {
5116)     }
5117)     return class_action;
5118) }());
5119) /**
5120)  * @author fenris
5121)  */
5122) var class_action_adhoc = (function (_super) {
5123)     __extends(class_action_adhoc, _super);
5124)     /**
5125)      * @author fenris
5126)      */
5127)     function class_action_adhoc() {
5128)         _super.call(this);
5129)     }
5130)     return class_action_adhoc;
5131) }(class_action));
5132) /**
5133)  * @author fenris
5134)  */
5135) var class_action_exec = (function (_super) {
5136)     __extends(class_action_exec, _super);
5137)     /**
5138)      * @author fenris
5139)      */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

5140)     function class_action_exec(_a) {
5141)         var inputs = _a["inputs"], outputs = _a["outputs"], path = _a["path"], interpreter = _a["interpreter"], workdir = _a["workdir"];
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

5142)         _super.call(this);
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

5143)         this.paths_input = inputs;
5144)         this.paths_output = outputs;
5145)         this.path_script = path;
5146)         this.path_interpreter = interpreter;
5147)         this.workdir = workdir;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

5148)     }
5149)     /**
5150)      * @desc for defining directly how the action is to be converted into a target-piece
5151)      * @author fenris
5152)      */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

5153)     class_action_exec.prototype.compilation = function (output_identifier) {
5154)         switch (output_identifier) {
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

5155)             case "gnumake": {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

5156)                 switch (configuration.system) {
5157)                     case "unix":
5158)                     case "win": {
5159)                         var command = "";
5160)                         {
5161)                             command = lib_gnumake.macro_command({
5162)                                 "interpreter": ((this.path_interpreter != null) ? this.path_interpreter.as_string(configuration.system) : null),
5163)                                 "path": this.path_script.as_string(configuration.system),
5164)                                 "args": [
5165)                                     ("'" + this.paths_input.map(function (filepointer) { return filepointer.as_string(configuration.system); }).join(",") + "'"),
5166)                                     ("'" + this.paths_output.map(function (filepointer) { return filepointer.as_string(configuration.system); }).join(",") + "'"),
5167)                                 ],
5168)                                 "system": configuration.system,
5169)                             });
5170)                         }
5171)                         {
5172)                             if (this.workdir != null) {
5173)                                 command = "pushd " + this.workdir.as_string(configuration.system) + " && " + command + " ; popd";
5174)                             }
5175)                         }
5176)                         return command;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

5177)                         break;
5178)                     }
5179)                     default: {
5180)                         throw (new Error("not implemented"));
5181)                         break;
5182)                     }
5183)                 }
5184)                 break;
5185)             }
5186)             case "ant": {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

5187)                 return (lib_ant.class_action.macro_exec({
5188)                     "interpreter": ((this.path_interpreter != null) ? this.path_interpreter.as_string(configuration.system) : null),
5189)                     "path": this.path_script.as_string("unix"),
5190)                     "args": [
5191)                         ("'" + this.paths_input.map(function (filepointer) { return filepointer.as_string("unix"); }).join(",") + "'"),
5192)                         ("'" + this.paths_output.map(function (filepointer) { return filepointer.as_string("unix"); }).join(",") + "'"),
5193)                     ],
5194)                     "system": configuration.system,
5195)                 }));
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

5196)                 break;
5197)             }
5198)             default: {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

5199)                 throw (new Error("unhandled output '" + output_identifier + "'"));
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

5200)                 break;
5201)             }
5202)         }
5203)     };
5204)     return class_action_exec;
5205) }(class_action_adhoc));
5206) /**
5207)  * @author fenris
5208)  */
5209) var class_action_echo = (function (_super) {
5210)     __extends(class_action_echo, _super);
5211)     /**
5212)      * @author fenris
5213)      */
5214)     function class_action_echo(message) {
5215)         _super.call(this);
5216)         this.message = message;
5217)     }
5218)     /**
5219)      * @desc for defining directly how the action is to be converted into a target-piece
5220)      * @todo escape message
5221)      * @author fenris
5222)      */
5223)     class_action_echo.prototype.compilation = function (target_identifier) {
5224)         switch (target_identifier) {
5225)             case "gnumake": {
5226)                 switch (configuration["system"]) {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

5227)                     case "unix":
5228)                     case "win": {
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

5229)                         var parts = [];
5230)                         parts.push("echo");
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

5231)                         parts.push("\"" + this.message + "\"");
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

5232)                         return parts.join(" ");
5233)                         break;
5234)                     }
5235)                     default: {
5236)                         throw (new Error("not implemented"));
5237)                         break;
5238)                     }
5239)                 }
5240)                 break;
5241)             }
5242)             case "ant": {
5243)                 return (new lib_ant.class_action(new lib_xml.class_node_complex("echo", { "message": this.message })));
5244)                 break;
5245)             }
5246)             default: {
5247)                 throw (new Error("unhandled target '" + target_identifier + "'"));
5248)                 break;
5249)             }
5250)         }
5251)     };
5252)     return class_action_echo;
5253) }(class_action_adhoc));
5254) /**
5255)  * @author fenris
5256)  */
5257) var class_action_koralle = (function (_super) {
5258)     __extends(class_action_koralle, _super);
5259)     /**
5260)      * @author fenris
5261)      */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

5262)     function class_action_koralle(_a) {
5263)         var filepointer_in = _a["filepointer_in"], filepointer_out = _a["filepointer_out"], output = _a["output"], raw = _a["raw"];
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

5264)         _super.call(this);
5265)         this.filepointer_in = filepointer_in;
5266)         this.filepointer_out = filepointer_out;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

5267)         this.output = output;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

5268)         this.raw = raw;
5269)     }
5270)     /**
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

5271)      * @desc for defining directly how the action is to be converted into an output-piece
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

5274)     class_action_koralle.prototype.compilation = function (output_identifier) {
5275)         switch (output_identifier) {
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

5276)             case "gnumake": {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

5277)                 switch (configuration.system) {
5278)                     case "unix":
5279)                     case "win": {
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

5280)                         var parts = [];
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

5281)                         if (configuration.invocation.interpreter != null) {
5282)                             parts.push(configuration.invocation.interpreter);
5283)                         }
5284)                         parts.push(configuration.invocation.path);
5285)                         parts.push(this.filepointer_in.as_string(configuration.system));
5286)                         parts.push("--output=" + this.output);
5287)                         parts.push("--system=" + configuration.system);
5288)                         if (this.raw) {
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

5289)                             parts.push("--raw");
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

5290)                         }
5291)                         parts.push("--file=" + this.filepointer_out.as_string(configuration.system));
5292)                         return (parts.join(" "));
5293)                         break;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

5294)                     }
5295)                     default: {
5296)                         throw (new Error("not implemented"));
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

5297)                         break;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

5298)                     }
5299)                 }
5300)                 break;
5301)             }
5302)             case "ant": {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

5303)                 switch (configuration.system) {
5304)                     case "unix":
5305)                     case "win": {
5306)                         var args = [];
5307)                         args.push(this.filepointer_in.as_string("unix"));
5308)                         args.push("--output=" + this.output);
5309)                         args.push("--system=" + configuration.system);
5310)                         if (this.raw) {
5311)                             args.push("--raw");
5312)                         }
5313)                         args.push("--file=" + this.filepointer_out.as_string(configuration.system));
5314)                         return (lib_ant.class_action.macro_exec({
5315)                             "path": configuration.invocation.path,
5316)                             "interpreter": configuration.invocation.interpreter,
5317)                             "args": args,
5318)                         }));
5319)                         break;
5320)                     }
5321)                     default: {
5322)                         throw (new Error("not implemented"));
5323)                         break;
5324)                     }
5325)                 }
5326)                 break;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

5327)             }
5328)             default: {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

5329)                 throw (new Error("unhandled output '" + output_identifier + "'"));
5330)                 break;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

5331)             }
5332)         }
5333)     };
5334)     return class_action_koralle;
5335) }(class_action_adhoc));
5336) /**
5337)  * @author fenris
5338)  */
5339) var class_action_build = (function (_super) {
5340)     __extends(class_action_build, _super);
5341)     /**
5342)      * @author fenris
5343)      */
5344)     function class_action_build(filepointer, workdir) {
5345)         _super.call(this);
5346)         this.filepointer = filepointer;
5347)         this.workdir = workdir;
5348)     }
5349)     return class_action_build;
5350) }(class_action_adhoc));
5351) /**
5352)  * @author fenris
5353)  */
5354) var class_action_gnumake = (function (_super) {
5355)     __extends(class_action_gnumake, _super);
5356)     /**
5357)      * @author fenris
5358)      */
5359)     function class_action_gnumake(filepointer, workdir) {
5360)         _super.call(this, filepointer, workdir);
5361)     }
5362)     /**
5363)      * @desc for defining directly how the action is to be converted into a target-piece
5364)      * @author fenris
5365)      */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

5366)     class_action_gnumake.prototype.compilation = function (output_identifier) {
5367)         switch (output_identifier) {
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

5368)             case "gnumake": {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

5369)                 switch (configuration.system) {
5370)                     case "unix":
5371)                     case "win": {
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

5372)                         // cmd_cd1
5373)                         var cmd_cd1 = void 0;
5374)                         {
5375)                             var parts = [];
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

5376)                             parts.push("pushd");
5377)                             parts.push(this.workdir.as_string(configuration.system));
5378)                             if (configuration.system == "unix") {
5379)                                 parts.push("> /dev/null");
5380)                             }
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

5381)                             cmd_cd1 = parts.join(" ");
5382)                         }
5383)                         // cmd_cd2
5384)                         var cmd_cd2 = void 0;
5385)                         {
5386)                             var parts = [];
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

5387)                             parts.push("popd");
5388)                             if (configuration.system == "unix") {
5389)                                 parts.push("> /dev/null");
5390)                             }
5391)                             cmd_cd2 = parts.join(" ");
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

5392)                         }
5393)                         // cmd_make
5394)                         var cmd_make = void 0;
5395)                         {
5396)                             var parts = [];
5397)                             parts.push("make");
5398)                             parts.push("--no-print-directory");
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

5399)                             parts.push("--directory=" + this.workdir.as_string(configuration.system));
5400)                             parts.push("--file=" + this.filepointer.as_string(configuration.system));
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

5401)                             cmd_make = parts.join(" ");
5402)                         }
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

5403)                         // return ((this.workdir == null) ? [cmd_make] : [cmd_cd1, cmd_make, cmd_cd2]).join(" && ");
5404)                         return [cmd_make];
5405)                         break;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

5406)                     }
5407)                     default: {
5408)                         throw (new Error("not implemented"));
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

5409)                         break;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

5410)                     }
5411)                 }
5412)                 break;
5413)             }
5414)             case "ant": {
5415)                 return (new lib_ant.class_action((this.workdir == null)
5416)                     ?
5417)                         new lib_xml.class_node_complex("exec", {
5418)                             "executable": "make",
5419)                         }, [
5420)                             new lib_xml.class_node_complex("arg", { "value": "--no-print-directory" }),
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

5421)                             new lib_xml.class_node_complex("arg", { "value": "--file=" + this.filepointer.as_string("unix") }),
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

5422)                         ])
5423)                     :
5424)                         new lib_xml.class_node_complex("exec", {
5425)                             "executable": "make",
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

5426)                             "dir": this.workdir.as_string("unix"),
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

5427)                         }, [
5428)                             new lib_xml.class_node_complex("arg", { "value": "--no-print-directory" }),
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

5429)                             new lib_xml.class_node_complex("arg", { "value": "--file=" + this.filepointer.as_string("unix") }),
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

5430)                         ])));
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

5431)                 break;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

5432)             }
5433)             default: {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

5434)                 throw (new Error("unhandled target '" + output_identifier + "'"));
5435)                 break;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

5436)             }
5437)         }
5438)     };
5439)     return class_action_gnumake;
5440) }(class_action_build));
5441) /**
5442)  * @author fenris
5443)  */
5444) var class_action_ant = (function (_super) {
5445)     __extends(class_action_ant, _super);
5446)     /**
5447)      * @author fenris
5448)      */
5449)     function class_action_ant(filepointer, workdir) {
5450)         _super.call(this, filepointer, workdir);
5451)     }
5452)     /**
5453)      * @desc for defining directly how the action is to be converted into a target-piece
5454)      * @author fenris
5455)      */
5456)     class_action_ant.prototype.compilation = function (target_identifier) {
5457)         switch (target_identifier) {
5458)             case "gnumake": {
5459)                 switch (configuration["system"]) {
5460)                     case "unix": {
5461)                         // cmd_cd1
5462)                         var cmd_cd1 = void 0;
5463)                         {
5464)                             var parts = [];
5465)                             parts.push("cd");
5466)                             parts.push(this.workdir.toString());
5467)                             cmd_cd1 = parts.join(" ");
5468)                         }
5469)                         // cmd_cd2
5470)                         var cmd_cd2 = void 0;
5471)                         {
5472)                             var parts = [];
5473)                             parts.push("cd");
5474)                             parts.push("-");
5475)                             cmd_cd2 = parts.join(" ") + " > /dev/null";
5476)                         }
5477)                         // cmd_ant
5478)                         var cmd_ant = void 0;
5479)                         {
5480)                             var parts = [];
5481)                             parts.push("ant");
5482)                             parts.push(this.filepointer.toString());
5483)                             cmd_ant = parts.join(" ");
5484)                         }
5485)                         return ((this.workdir == null) ? [cmd_ant] : [cmd_cd1, cmd_ant, cmd_cd2]).join(" && ");
5486)                     }
5487)                     default: {
5488)                         throw (new Error("not implemented"));
5489)                     }
5490)                 }
5491)                 break;
5492)             }
5493)             case "ant": {
5494)                 return (new lib_ant.class_action((this.workdir == null)
5495)                     ?
5496)                         new lib_xml.class_node_complex("ant", {
5497)                             "antfile": this.filepointer.toString(),
5498)                         })
5499)                     :
5500)                         new lib_xml.class_node_complex("ant", {
5501)                             "antfile": this.filepointer.toString(),
5502)                             "dir": this.workdir.toString(),
5503)                         })));
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

5504)                 break;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

5505)             }
5506)             default: {
5507)                 throw (new Error("unhandled target '" + target_identifier + "'"));
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

5508)                 break;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

5509)             }
5510)         }
5511)     };
5512)     return class_action_ant;
5513) }(class_action_build));
5514) /**
5515)  * @author fenris
5516)  */
5517) var class_action_mkdir = (function (_super) {
5518)     __extends(class_action_mkdir, _super);
5519)     /**
5520)      * @author fenris
5521)      */
5522)     function class_action_mkdir(location) {
5523)         _super.call(this);
5524)         this.location = location;
5525)     }
5526)     /**
5527)      * @desc for defining directly how the action is to be converted into a target-piece
5528)      * @author fenris
5529)      */
5530)     class_action_mkdir.prototype.compilation = function (target_identifier) {
5531)         switch (target_identifier) {
5532)             case "gnumake": {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

5533)                 var parts = [];
5534)                 parts.push("mkdir");
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

5535)                 switch (configuration["system"]) {
5536)                     case "unix": {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

5537)                         // parts.push("--parents");
5538)                         parts.push("-p");
5539)                         break;
5540)                     }
5541)                     case "win": {
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

5542)                         break;
5543)                     }
5544)                     default: {
5545)                         throw (new Error("not implemented"));
5546)                         break;
5547)                     }
5548)                 }
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

5549)                 parts.push(this.location.as_string(configuration["system"]));
5550)                 return parts.join(" ");
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

5551)             }
5552)             case "ant": {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

5553)                 return (new lib_ant.class_action(new lib_xml.class_node_complex("mkdir", { "dir": this.location.as_string("unix") })));
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

5554)             }
5555)             default: {
5556)                 throw (new Error("unhandled target '" + target_identifier + "'"));
5557)             }
5558)         }
5559)     };
5560)     return class_action_mkdir;
5561) }(class_action_adhoc));
5562) /**
5563)  * @author fenris
5564)  */
5565) var class_action_touch = (function (_super) {
5566)     __extends(class_action_touch, _super);
5567)     /**
5568)      * @author fenris
5569)      */
5570)     function class_action_touch(filepointer) {
5571)         _super.call(this);
5572)         this.filepointer = filepointer;
5573)     }
5574)     /**
5575)      * @desc for defining directly how the action is to be converted into a target-piece
5576)      * @author fenris
5577)      */
5578)     class_action_touch.prototype.compilation = function (target_identifier) {
5579)         switch (target_identifier) {
5580)             case "gnumake": {
5581)                 switch (configuration["system"]) {
5582)                     case "unix": {
5583)                         var parts = [];
5584)                         parts.push("touch");
5585)                         parts.push(this.filepointer.toString());
5586)                         return parts.join(" ");
5587)                     }
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

5588)                     case "win": {
5589)                         var parts = [];
5590)                         parts.push("echo.");
5591)                         parts.push(">");
5592)                         parts.push(this.filepointer.toString());
5593)                         return parts.join(" ");
5594)                     }
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

5595)                     default: {
5596)                         throw (new Error("not implemented"));
5597)                     }
5598)                 }
5599)             }
5600)             case "ant": {
5601)                 return (new lib_ant.class_action(new lib_xml.class_node_complex("touch", { "file": this.filepointer.toString() })));
5602)             }
5603)             default: {
5604)                 throw (new Error("unhandled target '" + target_identifier + "'"));
5605)                 break;
5606)             }
5607)         }
5608)     };
5609)     return class_action_touch;
5610) }(class_action_adhoc));
5611) /**
5612)  * @author fenris
5613)  */
5614) var class_action_copy = (function (_super) {
5615)     __extends(class_action_copy, _super);
5616)     /**
5617)      * @author fenris
5618)      */
5619)     function class_action_copy(filepointer_from, filepointer_to, folder) {
5620)         _super.call(this);
5621)         this.filepointer_from = filepointer_from;
5622)         this.filepointer_to = filepointer_to;
5623)         this.folder = folder;
5624)     }
5625)     /**
5626)      * @desc for defining directly how the action is to be converted into a target-piece
5627)      * @author fenris
5628)      */
5629)     class_action_copy.prototype.compilation = function (target_identifier) {
5630)         switch (target_identifier) {
5631)             case "gnumake": {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

5632)                 switch (configuration.system) {
5633)                     case "unix":
5634)                     case "win": {
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

5635)                         var parts = [];
5636)                         parts.push("cp");
5637)                         if (this.folder) {
5638)                             parts.push("--recursive");
5639)                             parts.push("--update");
5640)                             parts.push("--verbose");
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

5641)                             parts.push((new lib_path.class_filepointer(this.filepointer_from.location, "*")).as_string(configuration.system));
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

5642)                         }
5643)                         else {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

5644)                             parts.push(this.filepointer_from.as_string(configuration.system));
5645)                         }
5646)                         parts.push(this.filepointer_to.as_string(configuration.system));
5647)                         return parts.join(" ");
5648)                         break;
5649)                     }
5650)                     default: {
5651)                         throw (new Error("not implemented"));
5652)                         break;
5653)                     }
5654)                 }
5655)                 break;
5656)             }
5657)             case "ant": {
5658)                 if (!this.folder) {
5659)                     return (new lib_ant.class_action(new lib_xml.class_node_complex("copy", {
5660)                         "file": this.filepointer_from.as_string("unix"),
5661)                         "tofile": this.filepointer_to.as_string("unix"),
5662)                     })));
5663)                 }
5664)                 else {
5665)                     return (new lib_ant.class_action(new lib_xml.class_node_complex("copy", {
5666)                         "todir": this.filepointer_to.as_string("unix"),
5667)                     }, [
5668)                         new lib_xml.class_node_complex("fileset", {
5669)                             "dir": this.filepointer_from.as_string("unix"),
5670)                         })
5671)                     ])));
5672)                 }
5673)                 break;
5674)             }
5675)             default: {
5676)                 throw (new Error("unhandled target '" + target_identifier + "'"));
5677)                 break;
5678)             }
5679)         }
5680)     };
5681)     return class_action_copy;
5682) }(class_action_adhoc));
5683) /**
5684)  * @author fenris
5685)  */
5686) var class_action_move = (function (_super) {
5687)     __extends(class_action_move, _super);
5688)     /**
5689)      * @author fenris
5690)      */
5691)     function class_action_move(_a) {
5692)         var from = _a["from"], to = _a["to"];
5693)         _super.call(this);
5694)         this.from = from;
5695)         this.to = to;
5696)     }
5697)     /**
5698)      * @desc for defining directly how the action is to be converted into a target-piece
5699)      * @author fenris
5700)      */
5701)     class_action_move.prototype.compilation = function (output_identifier) {
5702)         switch (output_identifier) {
5703)             case "gnumake": {
5704)                 switch (configuration.system) {
5705)                     case "unix":
5706)                     case "win": {
5707)                         var from = this.from.as_string(configuration.system);
5708)                         var to = this.to.as_string(configuration.system);
5709)                         var command = "";
5710)                         {
5711)                             command = lib_gnumake.macro_command({
5712)                                 "path": "mv",
5713)                                 "args": ["--verbose", from, to],
5714)                                 "system": configuration.system,
5715)                             });
5716)                         }
5717)                         {
5718)                             command = "[ \"" + from + "\" -ef \"" + to + "\" ] || " + command;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

5720)                         return command;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

5721)                         break;
5722)                     }
5723)                     default: {
5724)                         throw (new Error("not implemented"));
5725)                         break;
5726)                     }
5727)                 }
5728)                 break;
5729)             }
5730)             case "ant": {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

5731)                 return (new lib_ant.class_action(new lib_xml.class_node_complex("move", {
5732)                     "file": this.from.as_string("unix"),
5733)                     "tofile": this.to.as_string("unix"),
5734)                 })));
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

5735)                 break;
5736)             }
5737)             default: {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

5738)                 throw (new Error("unhandled output '" + output_identifier + "'"));
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

5739)                 break;
5740)             }
5741)         }
5742)     };
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

5743)     return class_action_move;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

5744) }(class_action_adhoc));
5745) /**
5746)  * @author fenris
5747)  */
5748) var class_action_concat = (function (_super) {
5749)     __extends(class_action_concat, _super);
5750)     /**
5751)      * @author fenris
5752)      */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

5753)     function class_action_concat(sources, destination) {
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

5754)         _super.call(this);
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

5755)         this.sources = sources;
5756)         this.destination = destination;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

5757)     }
5758)     /**
5759)      * @desc for defining directly how the action is to be converted into a target-piece
5760)      * @author fenris
5761)      */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

5762)     class_action_concat.prototype.compilation = function (output_identifier) {
5763)         switch (output_identifier) {
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

5764)             case "gnumake": {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

5765)                 if (this.sources.length > 0) {
5766)                     return (lib_gnumake.macro_command({
5767)                         "path": {
5768)                             "unix": "cat",
5769)                             "win": "type",
5770)                         }[configuration.system],
5771)                         "args": this.sources.map(function (source) { return source.as_string(configuration.system); }),
5772)                         "output": this.destination.as_string(configuration.system),
5773)                     }));
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

5775)                 else {
5776)                     return (lib_gnumake.macro_command({
5777)                         "path": "touch",
5778)                         "output": this.destination.as_string(configuration.system),
5779)                     }));
5780)                 }
5781)                 break;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

5782)             }
5783)             case "ant": {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

5784)                 return (new lib_ant.class_action(new lib_xml.class_node_complex("concat", { "destfile": this.destination.as_string("unix") }, [
5785)                     new lib_xml.class_node_complex("filelist", { "dir": "." }, this.sources.map(function (source) {
5786)                         return (new lib_xml.class_node_complex("file", { "name": source.as_string("unix") }));
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

5787)                     }))
5788)                 ])));
5789)             }
5790)             default: {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

5791)                 throw (new Error("unhandled output '" + output_identifier + "'"));
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

5792)             }
5793)         }
5794)     };
5795)     return class_action_concat;
5796) }(class_action_adhoc));
5797) /**
5798)  * @author fenris
5799)  */
5800) var class_action_lessc = (function (_super) {
5801)     __extends(class_action_lessc, _super);
5802)     /**
5803)      * @author fenris
5804)      */
5805)     function class_action_lessc(filepointer_from, filepointer_to) {
5806)         _super.call(this);
5807)         this.filepointer_from = filepointer_from;
5808)         this.filepointer_to = filepointer_to;
5809)     }
5810)     /**
5811)      * @author fenris
5812)      */
5813)     class_action_lessc.prototype.compilation = function (target_identifier) {
5814)         switch (target_identifier) {
5815)             case "gnumake": {
5816)                 switch (configuration["system"]) {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

5817)                     case "unix":
5818)                     case "win": {
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

5819)                         var parts = [];
5820)                         parts.push("lessc");
5821)                         parts.push(this.filepointer_from.toString());
5822)                         parts.push(this.filepointer_to.toString());
5823)                         return parts.join(" ");
5824)                         break;
5825)                     }
5826)                     default: {
5827)                         throw (new Error("not implemented"));
5828)                         break;
5829)                     }
5830)                 }
5831)                 break;
5832)             }
5833)             case "ant": {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

5834)                 switch (configuration["system"]) {
5835)                     case "unix": {
5836)                         return (new lib_ant.class_action(new lib_xml.class_node_complex("exec", {
5837)                             "executable": "lessc",
5838)                             "output": this.filepointer_to.toString(),
5839)                         }, [
5840)                             new lib_xml.class_node_complex("arg", { "value": this.filepointer_from.toString() }),
5841)                         ])));
5842)                     }
5843)                     case "win": {
5844)                         return (new lib_ant.class_action(new lib_xml.class_node_complex("exec", {
5845)                             "executable": "cmd",
5846)                             "output": this.filepointer_to.toString(),
5847)                         }, [
5848)                             new lib_xml.class_node_complex("arg", { "value": "/c" }),
5849)                             new lib_xml.class_node_complex("arg", { "value": "lessc" }),
5850)                             new lib_xml.class_node_complex("arg", { "value": this.filepointer_from.toString() }),
5851)                         ])));
5852)                     }
5853)                     default: {
5854)                         throw (new Error("not implemented"));
5855)                     }
5856)                 }
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

5857)                 break;
5858)             }
5859)             default: {
5860)                 throw (new Error("unhandled target '" + target_identifier + "'"));
5861)                 break;
5862)             }
5863)         }
5864)     };
5865)     return class_action_lessc;
5866) }(class_action_adhoc));
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

5867) /**
5868)  * @author neu3no
5869)  */
5870) var class_action_babel = (function (_super) {
5871)     __extends(class_action_babel, _super);
5872)     /**
5873)      * @author neu3no
5874)      */
5875)     function class_action_babel(filepointers_from, filepointer_to, preset, minify) {
5876)         _super.call(this);
5877)         this.filepointers_from = filepointers_from;
5878)         this.filepointer_to = filepointer_to;
5879)         this.preset = preset;
5880)         this.minify = minify;
5881)     }
5882)     /**
5883)      * @desc for defining directly how the action is to be converted into a target-piece
5884)      * @author neu3no
5885)      */
5886)     class_action_babel.prototype.compilation = function (target_identifier) {
5887)         switch (target_identifier) {
5888)             case "gnumake": {
5889)                 var parts_3 = [];
5890)                 switch (configuration["system"]) {
5891)                     case "unix":
5892)                     case "win":
5893)                         parts_3.push("babel");
5894)                         parts_3.push("--no-babelrc");
5895)                         // input
5896)                         {
5897)                             this.filepointers_from.forEach(function (filepointer) { return parts_3.push(filepointer.as_string(configuration["system"])); });
5898)                         }
5899)                         // output
5900)                         {
5901)                             parts_3.push("--out-file");
5902)                             parts_3.push(this.filepointer_to.as_string(configuration["system"]));
5903)                         }
5904)                         // presets
5905)                         {
5906)                             var presets = [];
5907)                             if (this.preset !== null) {
5908)                                 presets.push(this.preset);
5909)                             }
5910)                             if (this.minify) {
5911)                                 parts_3.push("--minified");
5912)                             }
5913)                             if (presets.length > 0) {
5914)                                 parts_3.push("--presets");
5915)                                 parts_3.push(presets.join(","));
5916)                             }
5917)                         }
5918)                         return parts_3.join(" ");
5919)                         break;
5920)                     default: {
5921)                         throw (new Error("not implemented"));
5922)                     }
5923)                 }
5924)                 break;
5925)             }
5926)             default: {
5927)                 throw (new Error("unhandled target '" + target_identifier + "'"));
5928)             }
5929)         }
5930)     };
5931)     return class_action_babel;
5932) }(class_action_adhoc));
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

5933) /**
5934)  * @author fenris
5935)  */
5936) var class_action_tsc = (function (_super) {
5937)     __extends(class_action_tsc, _super);
5938)     /**
5939)      * @author fenris
5940)      */
5941)     function class_action_tsc(paths_input, path_output, target, allowUnreachableCode, declaration) {
5942)         _super.call(this);
5943)         this.paths_input = paths_input;
5944)         this.path_output = path_output;
5945)         this.target = target;
5946)         this.allowUnreachableCode = allowUnreachableCode;
5947)         this.declaration = declaration;
5948)     }
5949)     /**
5950)      * @author fenris
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

5951)      * @todo handle declarion-path
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

5953)     class_action_tsc.prototype.compilation = function (output_identifier) {
5954)         var args = [];
5955)         {
5956)             if (this.allowUnreachableCode) {
5957)                 args.push("--allowUnreachableCode");
5958)             }
5959)         }
5960)         {
5961)             if (this.declaration != null) {
5962)                 args.push("--declaration");
5963)             }
5964)         }
5965)         {
5966)             if (this.target != null) {
5967)                 args.push("--target");
5968)                 args.push(this.target);
5969)             }
5970)         }
5971)         {
5972)             this.paths_input.forEach(function (filepointer) { return args.push(filepointer.as_string(configuration.system)); });
5973)         }
5974)         {
5975)             args.push("--outFile");
5976)             args.push(this.path_output.as_string(configuration.system));
5977)         }
5978)         var cmdparams = {
5979)             "path": "tsc",
5980)             "args": args,
5981)             "system": configuration.system,
5982)         };
5983)         switch (output_identifier) {
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

5984)             case "gnumake": {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

5985)                 return lib_gnumake.macro_command(cmdparams);
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

5986)                 break;
5987)             }
5988)             case "ant": {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

5989)                 return lib_ant.class_action.macro_command(cmdparams);
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

5990)                 break;
5991)             }
5992)             default: {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

5993)                 throw (new Error("unhandled output '" + output_identifier + "'"));
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

5994)                 break;
5995)             }
5996)         }
5997)     };
5998)     return class_action_tsc;
5999) }(class_action_adhoc));
6000) /**
6001)  * @author fenris
6002)  */
6003) var class_action_php = (function (_super) {
6004)     __extends(class_action_php, _super);
6005)     /**
6006)      * @author fenris
6007)      */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6008)     function class_action_php(filepointers_from, filepointer_to, only_first, only_last) {
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6009)         _super.call(this);
6010)         this.filepointers_from = filepointers_from;
6011)         this.filepointer_to = filepointer_to;
6012)         this.only_first = only_first;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6013)         this.only_last = only_last;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6014)     }
6015)     /**
6016)      * @desc for defining directly how the action is to be converted into a target-piece
6017)      * @author fenris
6018)      */
6019)     class_action_php.prototype.compilation = function (target_identifier) {
6020)         switch (target_identifier) {
6021)             case "gnumake": {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6022)                 switch (configuration.system) {
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6023)                     case "unix": {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6024)                         var parts_4 = [];
6025)                         parts_4.push("php");
6026)                         if (this.only_last) {
6027)                             parts_4.push(this.filepointers_from.slice(-1)[0].toString());
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

6030)                             if (this.only_first) {
6031)                                 parts_4.push(this.filepointers_from[0].toString());
6032)                             }
6033)                             else {
6034)                                 this.filepointers_from.forEach(function (filepointer) { return parts_4.push(filepointer.toString()); });
6035)                             }
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

6037)                         parts_4.push(">");
6038)                         parts_4.push(this.filepointer_to.toString());
6039)                         return parts_4.join(" ");
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6040)                         break;
6041)                     }
6042)                     default: {
6043)                         throw (new Error("not implemented"));
6044)                         break;
6045)                     }
6046)                 }
6047)                 break;
6048)             }
6049)             case "ant": {
6050)                 throw (new Error("not implemented"));
6051)                 break;
6052)             }
6053)             default: {
6054)                 throw (new Error("unhandled target '" + target_identifier + "'"));
6055)                 break;
6056)             }
6057)         }
6058)     };
6059)     return class_action_php;
6060) }(class_action_adhoc));
6061) /**
6062)  * @author fenris
6063)  */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6064) var class_action_gitpull = (function (_super) {
6065)     __extends(class_action_gitpull, _super);
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

6069)     function class_action_gitpull(url) {
6070)         _super.call(this);
6071)         this.url = url;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6072)     }
6073)     /**
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6074)      * @desc for defining directly how the action is to be converted into a target-piece
6075)      * @todo escape message
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

6078)     class_action_gitpull.prototype.compilation = function (target_identifier) {
6079)         switch (target_identifier) {
6080)             case "gnumake": {
6081)                 switch (configuration["system"]) {
6082)                     case "unix":
6083)                     case "win": {
6084)                         var parts = [];
6085)                         parts.push("git pull");
6086)                         parts.push(this.url);
6087)                         return parts.join(" ");
6088)                         break;
6089)                     }
6090)                     default: {
6091)                         throw (new Error("not implemented"));
6092)                         break;
6093)                     }
6094)                 }
6095)                 break;
6096)             }
6097)             /*
6098)             case "ant": {
6099)                 return (
6100)                     new lib_ant.class_action(
6101)                         new lib_xml.class_node_complex(
6102)                             "echo",
6103)                             {"message": this.message}
6104)                         )
6105)                     )
6106)                 );
6107)                 break;
6108)             }
6109)              */
6110)             default: {
6111)                 throw (new Error("unhandled target '" + target_identifier + "'"));
6112)                 break;
6113)             }
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

6116)     return class_action_gitpull;
6117) }(class_action_adhoc));
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6118) /**
6119)  * @author fenris
6120)  */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6121) var class_action_schwamm_create = (function (_super) {
6122)     __extends(class_action_schwamm_create, _super);
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6123)     /**
6124)      * @author fenris
6125)      */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6126)     function class_action_schwamm_create(includes, adhoc, output, dir) {
6127)         _super.call(this);
6128)         this.includes = includes;
6129)         this.adhoc = adhoc;
6130)         this.output = output;
6131)         this.dir = dir;
6132)     }
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

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

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

Christian Fraß authored 7 years ago

6137)     class_action_schwamm_create.prototype.compilation = function (target_identifier) {
6138)         var _this = this;
6139)         var args = [];
6140)         args.push("create");
6141)         this.includes.forEach(function (include) {
6142)             args.push("--include=" + include.as_string(configuration["unix"]));
6143)         });
6144)         Object.keys(this.adhoc).forEach(function (group) {
6145)             _this.adhoc[group].forEach(function (member) {
6146)                 var filepointer = member;
6147)                 args.push("--adhoc=" + group + ":" + filepointer.as_string(configuration["unix"]));
6148)             });
6149)         });
6150)         // args.push(`--file=${this.output.as_string(configuration["system"])}`);
6151)         args.push("--dir=" + ((this.dir != null) ? this.dir : this.output.location).as_string("unix"));
6152)         var cmdparams = {
6153)             "path": "schwamm",
6154)             "args": args,
6155)             "output": this.output.as_string(configuration["unix"]),
6156)         };
6157)         switch (target_identifier) {
6158)             case "gnumake": {
6159)                 return lib_gnumake.macro_command(cmdparams);
6160)                 break;
6161)             }
6162)             case "ant": {
6163)                 return lib_ant.class_action.macro_command(cmdparams);
6164)                 break;
6165)             }
6166)             default: {
6167)                 throw (new Error("unhandled target '" + target_identifier + "'"));
6168)                 break;
6169)             }
6170)         }
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

6172)     return class_action_schwamm_create;
6173) }(class_action_adhoc));
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6174) /**
6175)  * @author fenris
6176)  */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6177) var class_action_schwamm_apply = (function (_super) {
6178)     __extends(class_action_schwamm_apply, _super);
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6179)     /**
6180)      * @author fenris
6181)      */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6182)     function class_action_schwamm_apply(path, outputs) {
6183)         _super.call(this);
6184)         this.path = path;
6185)         this.outputs = outputs;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6186)     }
6187)     /**
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

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

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

Christian Fraß authored 7 years ago

6191)     class_action_schwamm_apply.prototype.compilation = function (target_identifier) {
6192)         var _this = this;
6193)         var args = [];
6194)         args.push("apply");
6195)         args.push("--file=" + this.path.as_string(configuration["system"]));
6196)         Object.keys(this.outputs).forEach(function (groupname) {
6197)             var filepointer = lib_path.filepointer_read(configuration["path"]).foo(_this.outputs[groupname]);
6198)             args.push("--output=" + groupname + ":" + filepointer.as_string(configuration["system"]));
6199)         });
6200)         var cmdparams = {
6201)             "path": "schwamm",
6202)             "args": args,
6203)         };
6204)         switch (target_identifier) {
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6205)             case "gnumake": {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6206)                 return lib_gnumake.macro_command(cmdparams);
6207)                 break;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6208)             }
6209)             case "ant": {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6210)                 return lib_ant.class_action.macro_command(cmdparams);
6211)                 break;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6212)             }
6213)             default: {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6214)                 throw (new Error("unhandled target '" + target_identifier + "'"));
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6215)                 break;
6216)             }
6217)         }
6218)     };
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6219)     return class_action_schwamm_apply;
6220) }(class_action_adhoc));
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

6228)     function class_taskparameter(_a) {
6229)         var type = _a["type"], name = _a["name"], key = _a["key"], mandatory = _a["mandatory"], default_ = _a["default"], description = _a["description"];
6230)         this.type = type;
6231)         this.name = name;
6232)         this.key = key;
6233)         this.mandatory = mandatory;
6234)         this.default_ = default_;
6235)         this.description = description;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

6240)     class_taskparameter.prototype.toString = function () {
6241)         var str = "";
6242)         // name
6243)         {
6244)             str = "" + this.name;
6245)         }
6246)         // type
6247)         {
6248)             str = str + " : " + this.type.toString();
6249)         }
6250)         // mandatory & default
6251)         {
6252)             if (this.mandatory) {
6253)             }
6254)             else {
6255)                 str = "[" + str + " = " + String(this.default_) + "]";
6256)             }
6257)         }
6258)         // description
6259)         {
6260)             str = str + " -- " + this.description;
6261)         }
6262)         return str;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

6264)     return class_taskparameter;
6265) }());
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6266) /**
6267)  * @author fenris
6268)  */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

6270)     /**
6271)      * @author fenris
6272)      */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6273)     function class_task(name, sub, active, _inputs, _outputs, _actions) {
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6274)         if (sub === void 0) { sub = []; }
6275)         if (active === void 0) { active = true; }
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6276)         if (_inputs === void 0) { _inputs = []; }
6277)         if (_outputs === void 0) { _outputs = []; }
6278)         if (_actions === void 0) { _actions = []; }
6279)         this.identifier = lib_string.generate("task_");
6280)         this.name = ((name != null) ? name : this.identifier);
6281)         this.sub = sub;
6282)         this.active = active;
6283)         this._inputs = _inputs;
6284)         this._outputs = _outputs;
6285)         this._actions = _actions;
6286)         // this.parameters = parameters;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6287)     }
6288)     /**
6289)      * @author fenris
6290)      */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6291)     class_task.prototype.identifier_get = function () {
6292)         return this.identifier;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6293)     };
6294)     /**
6295)      * @author fenris
6296)      */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6297)     class_task.prototype.name_get = function () {
6298)         return this.name;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6299)     };
6300)     /**
6301)      * @author fenris
6302)      */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6303)     class_task.prototype.sub_get = function () {
6304)         return this.sub;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6305)     };
6306)     /**
6307)      * @author fenris
6308)      */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6309)     class_task.prototype.active_get = function () {
6310)         return this.active;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6311)     };
6312)     /**
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6313)      * @returns the subgraph of all active tasks
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

6316)     class_task.prototype.clean = function (root) {
6317)         if (root === void 0) { root = true; }
6318)         if (root && (!this.active)) {
6319)             throw (new Error("cant't clean inactive root"));
6320)         }
6321)         else {
6322)             this.sub = this.sub.filter(function (task_) { return task_.active; });
6323)             this.sub.forEach(function (task_) { return task_.clean(false); });
6324)         }
6325)     };
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6326)     /**
6327)      * @author fenris
6328)      */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6329)     class_task.prototype.values = function (raw) {
6330)         return null;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6331)     };
6332)     /**
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6333)      * @desc a list of paths which represent input-files of the task
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

6336)     class_task.prototype.inputs = function () {
6337)         return this._inputs;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6338)     };
6339)     /**
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6340)      * @desc a list of paths which represent output-files of the task
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

6343)     class_task.prototype.outputs = function () {
6344)         return this._outputs;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6345)     };
6346)     /**
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6347)      * @desc generates all actions which have to be executed in order to fulfil the task
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

6350)     class_task.prototype.actions = function () {
6351)         return this._actions;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6352)     };
6353)     /**
6354)      * @author fenris
6355)      */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6356)     class_task.register = function (id, factory) {
6357)         this.pool[id] = factory;
6358)     };
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6359)     /**
6360)      * @author fenris
6361)      */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6362)     class_task.get = function (id) {
6363)         if (id in this.pool) {
6364)             return this.pool[id];
6365)         }
6366)         else {
6367)             throw (new Error("no task registered with id '" + id + "'"));
6368)         }
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6369)     };
6370)     /**
6371)      * @author fenris
6372)      */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6373)     class_task.list = function () {
6374)         return Object.keys(this.pool);
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6375)     };
6376)     /**
6377)      * @author fenris
6378)      */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6379)     class_task.errormessage_mandatoryparamater = function (type, name, fieldname) {
6380)         return "mandatory paramater '" + fieldname + "' missing in " + type + "-task '" + name + "'";
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6381)     };
6382)     /**
6383)      * @author fenris
6384)      */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6385)     class_task.pool = {};
6386)     return class_task;
6387) }());
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6388) /**
6389)  * @author fenris
6390)  */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6391) var class_task_group = (function (_super) {
6392)     __extends(class_task_group, _super);
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6393)     /**
6394)      * @author fenris
6395)      */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6396)     function class_task_group(_a) {
6397)         var name = _a["name"], sub = _a["sub"], active = _a["active"], _b = _a["parameters"];
6398)         _super.call(this, name, sub, active, [], [], []);
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

6400)     return class_task_group;
6401) }(class_task));
6402) class_task.register("group", function (name, sub, active, parameters) { return new class_task_group({
6403)     "name": name, "sub": sub, "active": active,
6404)     "parameters": parameters,
6405) }); });
6406) /**
6407)  * @author fenris
6408)  */
6409) var class_task_dependency = (function (_super) {
6410)     __extends(class_task_dependency, _super);
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6411)     /**
6412)      * @author fenris
6413)      */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6414)     function class_task_dependency(_a) {
6415)         var name = _a["name"], sub = _a["sub"], active = _a["active"], _b = _a["parameters"], _c = _b["path"], path_raw = _c === void 0 ? null : _c, _d = _b["output"], output = _d === void 0 ? configuration["target"] : _d, _e = _b["raw"], raw = _e === void 0 ? true : _e, _f = _b["workdir"], workdir_raw = _f === void 0 ? null : _f;
6416)         if (path_raw == undefined) {
6417)             throw (new Error(class_task.errormessage_mandatoryparamater("dependency", name, "path")));
6418)         }
6419)         var path = lib_call.use(path_raw, function (x) { return ((x == null) ? null : lib_path.filepointer_read(x)); });
6420)         var workdir = lib_call.use(workdir_raw, function (x) { return ((x == null) ? path.location : lib_path.location_read(x)); });
6421)         var actions = (function () {
6422)             switch (output) {
6423)                 case "gnumake": {
6424)                     var filepointer_buildfile = new lib_path.class_filepointer(lib_path.location_read(configuration.tempfolder, configuration.system), "makefile");
6425)                     return [
6426)                         new class_action_koralle({
6427)                             "filepointer_in": path,
6428)                             "filepointer_out": filepointer_buildfile,
6429)                             "output": output,
6430)                             "raw": raw,
6431)                         }),
6432)                         new class_action_gnumake(filepointer_buildfile, workdir),
6433)                     ];
6434)                     break;
6435)                 }
6436)                 case "ant": {
6437)                     var filepointer_buildfile = new lib_path.class_filepointer(lib_path.location_read(configuration.tempfolder, configuration.system), "build.xml");
6438)                     return [
6439)                         new class_action_koralle({
6440)                             "filepointer_in": path,
6441)                             "filepointer_out": filepointer_buildfile,
6442)                             "output": output,
6443)                             "raw": raw,
6444)                         }),
6445)                         new class_action_ant(filepointer_buildfile, workdir),
6446)                     ];
6447)                     break;
6448)                 }
6449)                 default: {
6450)                     throw (new Error("unhandled target '${target}'"));
6451)                     break;
6452)                 }
6453)             }
6454)         })();
6455)         _super.call(this, name, sub, active, [path], [], actions);
6456)     }
6457)     return class_task_dependency;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6458) }(class_task));
6459) /**
6460)  * @author fenris
6461)  */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6462) var class_task_script = (function (_super) {
6463)     __extends(class_task_script, _super);
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6464)     /**
6465)      * @author fenris
6466)      */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6467)     function class_task_script(_a) {
6468)         var name = _a["name"], sub = _a["sub"], active = _a["active"], _b = _a["parameters"], _c = _b["path"], path_raw = _c === void 0 ? undefined : _c, _d = _b["interpreter"], interpreter_raw = _d === void 0 ? null : _d, _e = _b["workdir"], workdir_raw = _e === void 0 ? null : _e, _f = _b["inputs"], inputs_raw = _f === void 0 ? [] : _f, _g = _b["outputs"], outputs_raw = _g === void 0 ? [] : _g;
6469)         if (path_raw == undefined) {
6470)             throw (new Error(class_task.errormessage_mandatoryparamater("script", name, "path")));
6471)         }
6472)         var path = lib_call.use(path_raw, function (x) { return lib_path.filepointer_read(x); });
6473)         var workdir = lib_call.use(workdir_raw, function (x) { return ((x == null) ? null : lib_path.location_read(x)); });
6474)         var interpreter = lib_call.use(interpreter_raw, function (x) { return ((x == null) ? null : lib_path.filepointer_read(x)); });
6475)         var inputs = lib_call.use(inputs_raw, function (x) { return x.map(function (y) { return lib_path.filepointer_read(y); }); });
6476)         var outputs = lib_call.use(outputs_raw, function (x) { return x.map(function (y) { return lib_path.filepointer_read(y); }); });
6477)         _super.call(this, name, sub, active, inputs, outputs, ([]
6478)             .concat(outputs.map(function (output) { return new class_action_mkdir(output.location); }))
6479)             .concat([
6480)             new class_action_exec({
6481)                 "inputs": inputs,
6482)                 "outputs": outputs,
6483)                 "path": path,
6484)                 "interpreter": interpreter,
6485)                 "workdir": workdir,
6486)             }),
6487)         ])));
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

6489)     return class_task_script;
6490) }(class_task));
6491) class_task.register("script", function (name, sub, active, parameters) { return new class_task_script({
6492)     "name": name, "sub": sub, "active": active,
6493)     "parameters": parameters,
6494) }); });
6495) /**
6496)  * @author fenris
6497)  */
6498) var class_task_empty = (function (_super) {
6499)     __extends(class_task_empty, _super);
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6500)     /**
6501)      * @author fenris
6502)      */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6503)     function class_task_empty(_a) {
6504)         var name = _a["name"], sub = _a["sub"], active = _a["active"], _b = _a["parameters"]["output"], output_raw = _b === void 0 ? undefined : _b;
6505)         if (output_raw == undefined) {
6506)             throw (new Error(class_task.errormessage_mandatoryparamater("empty", name, "output")));
6507)         }
6508)         var output = lib_call.use(output_raw, function (x) { return lib_path.filepointer_read(x); });
6509)         _super.call(this, name, sub, active, [], [output], [
6510)             new class_action_mkdir(output.location),
6511)             new class_action_touch(output),
6512)         ]);
6513)     }
6514)     return class_task_empty;
6515) }(class_task));
6516) class_task.register("empty", function (name, sub, active, parameters) { return new class_task_empty({
6517)     "name": name, "sub": sub, "active": active,
6518)     "parameters": parameters,
6519) }); });
6520) /**
6521)  * @author fenris
6522)  */
6523) var class_task_copy = (function (_super) {
6524)     __extends(class_task_copy, _super);
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6525)     /**
6526)      * @author fenris
6527)      */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6528)     function class_task_copy(_a) {
6529)         var name = _a["name"], sub = _a["sub"], active = _a["active"], _b = _a["parameters"], _c = _b["input"], input_raw = _c === void 0 ? null : _c, _d = _b["output"], output_raw = _d === void 0 ? null : _d, _e = _b["folder"], folder = _e === void 0 ? false : _e;
6530)         if (input_raw == undefined) {
6531)             throw (new Error(class_task.errormessage_mandatoryparamater("copy", name, "input")));
6532)         }
6533)         var input = lib_call.use(input_raw, function (x) { return lib_path.filepointer_read(x); });
6534)         if (output_raw == undefined) {
6535)             throw (new Error(class_task.errormessage_mandatoryparamater("copy", name, "output")));
6536)         }
6537)         var output = lib_call.use(output_raw, function (x) { return lib_path.filepointer_read(x); });
6538)         _super.call(this, name, sub, active, folder ? [] : [input], folder ? [] : [output], [
6539)             new class_action_mkdir(output.location),
6540)             new class_action_copy(input, output, folder),
6541)         ]);
6542)     }
6543)     return class_task_copy;
6544) }(class_task));
6545) class_task.register("copy", function (name, sub, active, parameters) { return new class_task_copy({
6546)     "name": name, "sub": sub, "active": active,
6547)     "parameters": parameters,
6548) }); });
6549) /**
6550)  * @author fenris
6551)  */
6552) var class_task_concat = (function (_super) {
6553)     __extends(class_task_concat, _super);
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6554)     /**
6555)      * @author fenris
6556)      */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6557)     function class_task_concat(_a) {
6558)         var name = _a["name"], sub = _a["sub"], active = _a["active"], _b = _a["parameters"], _c = _b["inputs"], inputs_raw = _c === void 0 ? [] : _c, _d = _b["output"], output_raw = _d === void 0 ? undefined : _d;
6559)         if (inputs_raw == undefined) {
6560)             throw (new Error(class_task.errormessage_mandatoryparamater("concat", name, "inputs")));
6561)         }
6562)         var inputs = lib_call.use(inputs_raw, function (x) { return x.map(function (y) { return lib_path.filepointer_read(y); }); });
6563)         if (output_raw == undefined) {
6564)             throw (new Error(class_task.errormessage_mandatoryparamater("concat", name, "output")));
6565)         }
6566)         var output = lib_call.use(output_raw, function (x) { return lib_path.filepointer_read(x); });
6567)         _super.call(this, name, sub, active, inputs, [output], [
6568)             new class_action_mkdir(output.location),
6569)             new class_action_concat(inputs, output),
6570)         ]);
6571)     }
6572)     return class_task_concat;
6573) }(class_task));
6574) class_task.register("concat", function (name, sub, active, parameters) { return new class_task_concat({
6575)     "name": name, "sub": sub, "active": active,
6576)     "parameters": parameters,
6577) }); });
6578) /**
6579)  * @author fenris
6580)  */
6581) var class_task_lesscss = (function (_super) {
6582)     __extends(class_task_lesscss, _super);
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6583)     /**
6584)      * @author fenris
6585)      */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6586)     function class_task_lesscss(_a) {
6587)         var name = _a["name"], sub = _a["sub"], active = _a["active"], _b = _a["parameters"], _c = _b["inputs"], inputs_raw = _c === void 0 ? [] : _c, _d = _b["output"], output_raw = _d === void 0 ? undefined : _d;
6588)         if (inputs_raw == undefined) {
6589)             throw (new Error(class_task.errormessage_mandatoryparamater("lesscss", name, "inputs")));
6590)         }
6591)         var inputs = lib_call.use(inputs_raw, function (x) { return x.map(function (y) { return lib_path.filepointer_read(y); }); });
6592)         if (output_raw == undefined) {
6593)             throw (new Error(class_task.errormessage_mandatoryparamater("lesscss", name, "output")));
6594)         }
6595)         var output = lib_call.use(output_raw, function (x) { return lib_path.filepointer_read(x); });
6596)         var filepointer_temp = new lib_path.class_filepointer(lib_path.location_read(configuration["tempfolder"]), "_.less");
6597)         _super.call(this, name, sub, active, inputs, [output], [
6598)             new class_action_mkdir(output.location),
6599)             new class_action_concat(inputs, filepointer_temp),
6600)             new class_action_lessc(filepointer_temp, output),
6601)         ]);
6602)     }
6603)     return class_task_lesscss;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

6605) class_task.register("lesscss", function (name, sub, active, parameters) { return new class_task_lesscss({
6606)     "name": name, "sub": sub, "active": active,
6607)     "parameters": parameters,
6608) }); });
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

6610)  * @author neu3no
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

6612) var class_task_babel = (function (_super) {
6613)     __extends(class_task_babel, _super);
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

6615)      * @author neu3no
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

6617)     function class_task_babel(name, sub, active, inputs_, output_, preset, minify) {
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6618)         if (name === void 0) { name = null; }
6619)         if (sub === void 0) { sub = []; }
6620)         if (active === void 0) { active = true; }
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6621)         if (inputs_ === void 0) { inputs_ = []; }
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6622)         if (output_ === void 0) { output_ = null; }
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6623)         if (preset === void 0) { preset = null; }
6624)         if (minify === void 0) { minify = null; }
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6625)         _super.call(this, name, sub, active);
6626)         this.inputs_ = inputs_;
6627)         this.output_ = output_;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6628)         this.preset = preset;
6629)         this.minify = minify;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6630)     }
6631)     /**
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6632)      * @author neu3no
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

6634)     class_task_babel.create = function (name, sub, active, parameters) {
6635)         return (new class_task_babel(name, sub, active, object_fetch(parameters, "inputs", null, 2).map(function (x) { return lib_path.filepointer_read(x); }), lib_path.filepointer_read(object_fetch(parameters, "output", null, 2)), object_fetch(parameters, "preset", null, 0), object_fetch(parameters, "minify", false, 0)));
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6636)     };
6637)     /**
6638)      * @override
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6639)      * @author neu3no
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

6641)     class_task_babel.prototype.inputs = function () {
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6642)         return this.inputs_;
6643)     };
6644)     /**
6645)      * @override
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6646)      * @author neu3no
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

6648)     class_task_babel.prototype.outputs = function () {
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6649)         return [this.output_];
6650)     };
6651)     /**
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6652)      * @author neu3no
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

6654)     class_task_babel.prototype.actions = function () {
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6655)         return [
6656)             new class_action_mkdir(this.output_.location),
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6657)             new class_action_babel(this.inputs_, this.output_, this.preset, this.minify),
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6658)         ];
6659)     };
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6660)     return class_task_babel;
6661) }(class_task));
6662) class_task.register("babel", /*(name, sub, active, parameters) => */ class_task_babel.create /*(name, sub, active, parameters)*/);
6663) /**
6664)  * @author fenris
6665)  */
6666) var class_task_typescript = (function (_super) {
6667)     __extends(class_task_typescript, _super);
6668)     /**
6669)      * @author fenris
6670)      */
6671)     function class_task_typescript(_a) {
6672)         var name = _a["name"], sub = _a["sub"], active = _a["active"], _b = _a["parameters"], _c = _b["inputs"], inputs_raw = _c === void 0 ? [] : _c, _d = _b["output"], output_raw = _d === void 0 ? null : _d, _e = _b["target"], target = _e === void 0 ? null : _e, _f = _b["allowUnreachableCode"], allowUnreachableCode = _f === void 0 ? null : _f, _g = _b["declaration"], declaration_raw = _g === void 0 ? null : _g;
6673)         /*
6674)         [
6675)             new class_taskparameter<Array<string>, Array<lib_path.class_filepointer>>(
6676)                 {
6677)                     "name": "inputs",
6678)                     "type": {
6679)                         "id": "array",
6680)                         "parameters": {
6681)                             "type_element": {
6682)                                 "id": "string",
6683)                             },
6684)                         },
6685)                     },
6686)                     "mandatory": false,
6687)                     "default": [],
6688)                     "key": "inputs",
6689)                     "extraction": raw => lib_call.use(
6690)                         raw,
6691)                         x => x.map(y => lib_path.filepointer_read(y))
6692)                     ),
6693)                     "description": "the paths of the source files",
6694)                 }
6695)             ),
6696)             new class_taskparameter<string>(
6697)                 {
6698)                     "type": {
6699)                         "id": "string",
6700)                     },
6701)                     "name": "output",
6702)                     "key": "output",
6703)                     "mandatory": true,
6704)                     "default": null,
6705)                     "description": "the path of the file in which to write the compilation",
6706)                 }
6707)             ),
6708)             new class_taskparameter<string>(
6709)                 {
6710)                     "type": {
6711)                         "id": "string",
6712)                     },
6713)                     "name": "declaration",
6714)                     "key": "declaration",
6715)                     "mandatory": false,
6716)                     "default": null,
6717)                     "description": "the path of the file in which to write the declaration; if not set, no declaration-script will be created",
6718)                 }
6719)             ),
6720)             new class_taskparameter<string>(
6721)                 {
6722)                     "type": {
6723)                         "id": "string",
6724)                     },
6725)                     "name": "target",
6726)                     "key": "target",
6727)                     "mandatory": false,
6728)                     "default": null,
6729)                     "description": "the tsc-switch 'target'; default: don't specify",
6730)                 }
6731)             ),
6732)             new class_taskparameter<boolean>(
6733)                 {
6734)                     "type": {
6735)                         "id": "boolean",
6736)                     },
6737)                     "name": "allowUnreachableCode",
6738)                     "key": "allow_unreachable_code",
6739)                     "mandatory": false,
6740)                     "default": null,
6741)                     "description": "the tsc-switch 'allowUnreachableCode'; default: don't specify",
6742)                 }
6743)             ),
6744)         ]
6745)          */
6746)         var inputs = lib_call.use(inputs_raw, function (x) { return x.map(function (y) { return lib_path.filepointer_read(y); }); });
6747)         if (output_raw == undefined) {
6748)             throw (new Error(class_task.errormessage_mandatoryparamater("typescript", name, "output")));
6749)         }
6750)         var output = lib_call.use(output_raw, function (x) { return lib_path.filepointer_read(x); });
6751)         var declaration = lib_call.use(declaration_raw, function (x) { return ((x == null) ? null : lib_path.filepointer_read(x)); });
6752)         var original = lib_call.use(output_raw, lib_call.compose(function (x) { return x.replace(new RegExp(".js$"), ".d.ts"); }, function (x) { return lib_path.filepointer_read(x); }));
6753)         _super.call(this, name, sub, active, inputs, ([]
6754)             .concat([output])
6755)             .concat((declaration == null)
6756)             ? []
6757)             : [declaration])), ([]
6758)             .concat([
6759)             new class_action_mkdir(output.location),
6760)             new class_action_tsc(inputs, output, target, allowUnreachableCode, declaration),
6761)         ])
6762)             .concat((declaration == null)
6763)             ?
6764)                 []
6765)             :
6766)                 [
6767)                     new class_action_mkdir(declaration.location),
6768)                     new class_action_move({
6769)                         "from": original,
6770)                         "to": declaration,
6771)                     }),
6772)                 ])));
6773)     }
6774)     return class_task_typescript;
6775) }(class_task));
6776) class_task.register("typescript", function (name, sub, active, parameters) { return new class_task_typescript({
6777)     "name": name, "sub": sub, "active": active,
6778)     "parameters": parameters,
6779) }); });
6780) /**
6781)  * @author fenris
6782)  */
6783) var class_task_php = (function (_super) {
6784)     __extends(class_task_php, _super);
6785)     /**
6786)      * @author fenris
6787)      */
6788)     function class_task_php(_a) {
6789)         var name = _a["name"], sub = _a["sub"], active = _a["active"], _b = _a["parameters"], _c = _b["inputs"], inputs_raw = _c === void 0 ? [] : _c, _d = _b["output"], output_raw = _d === void 0 ? null : _d, _e = _b["only_first"], only_first = _e === void 0 ? false : _e, _f = _b["only_last"], only_last = _f === void 0 ? false : _f;
6790)         var inputs = lib_call.use(inputs_raw, function (x) { return x.map(function (y) { return lib_path.filepointer_read(y); }); });
6791)         if (output_raw == undefined) {
6792)             throw (new Error(class_task.errormessage_mandatoryparamater("php", name, "output")));
6793)         }
6794)         var output = lib_call.use(output_raw, function (x) { return lib_path.filepointer_read(x); });
6795)         _super.call(this, name, sub, active, inputs, [output], [
6796)             new class_action_mkdir(output.location),
6797)             new class_action_php(inputs, output, only_first, only_last),
6798)         ]);
6799)     }
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6800)     return class_task_php;
6801) }(class_task));
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6802) class_task.register("php", function (name, sub, active, parameters) { return new class_task_php({
6803)     "name": name, "sub": sub, "active": active,
6804)     "parameters": parameters,
6805) }); });
6806) /**
6807)  * @author fenris
6808)  */
6809) var class_task_schwamm_create = (function (_super) {
6810)     __extends(class_task_schwamm_create, _super);
6811)     /**
6812)      * @author fenris
6813)      */
6814)     function class_task_schwamm_create(_a) {
6815)         var name = _a["name"], sub = _a["sub"], active = _a["active"], _b = _a["parameters"], _c = _b["includes"], includes_raw = _c === void 0 ? [] : _c, _d = _b["adhoc"], adhoc_raw = _d === void 0 ? {} : _d, _e = _b["output"], output_raw = _e === void 0 ? null : _e, _f = _b["dir"], dir_raw = _f === void 0 ? null : _f;
6816)         var includes = lib_call.use(includes_raw, function (x) { return x.map(function (y) { return lib_path.filepointer_read(y); }); });
6817)         var adhoc = lib_call.use(adhoc_raw, function (x) { return lib_object.map(x, function (members) { return members.map(function (member) { return lib_path.filepointer_read(member); }); }); });
6818)         var output = lib_call.use(output_raw, function (x) { return lib_path.filepointer_read(x); });
6819)         var dir = lib_call.use(dir_raw, function (x) { return ((x == null) ? null : lib_path.location_read(x)); });
6820)         _super.call(this, name, sub, active, includes.concat(lib_object.values(adhoc).reduce(function (x, y) { return x.concat(y); }, [])), [output], [
6821)             new class_action_mkdir(output.location),
6822)             new class_action_schwamm_create(includes, adhoc, output, dir),
6823)         ]);
6824)     }
6825)     return class_task_schwamm_create;
6826) }(class_task));
6827) class_task.register("schwamm-create", function (name, sub, active, parameters) { return new class_task_schwamm_create({
6828)     "name": name, "sub": sub, "active": active,
6829)     "parameters": parameters,
6830) }); });
6831) /**
6832)  * @author fenris
6833)  */
6834) var class_task_schwamm_apply = (function (_super) {
6835)     __extends(class_task_schwamm_apply, _super);
6836)     /**
6837)      * @author fenris
6838)      */
6839)     function class_task_schwamm_apply(_a) {
6840)         var name = _a["name"], sub = _a["sub"], active = _a["active"], _b = _a["parameters"], path_raw = _b["path"], _c = _b["outputs"], outputs_raw = _c === void 0 ? null : _c;
6841)         if (path_raw == undefined) {
6842)             throw (new Error(class_task.errormessage_mandatoryparamater("schamm-apply", name, "path")));
6843)         }
6844)         var path = lib_call.use(path_raw, function (x) { return lib_path.filepointer_read(x); });
6845)         if (outputs_raw == undefined) {
6846)             throw (new Error(class_task.errormessage_mandatoryparamater("schamm-apply", name, "outputs")));
6847)         }
6848)         var outputs = lib_call.use(outputs_raw, function (x) { return lib_object.map(x, function (output) { return lib_path.filepointer_read(output); }); });
6849)         _super.call(this, name, sub, active, [path], lib_object.to_array(outputs).map(function (x) { return x.value; }), ([]
6850)             .concat(lib_object.to_array(outputs).map(function (pair) { return new class_action_mkdir(pair.value.location); }))
6851)             .concat([
6852)             new class_action_schwamm_apply(path, outputs),
6853)         ])));
6854)     }
6855)     return class_task_schwamm_apply;
6856) }(class_task));
6857) class_task.register("schwamm-apply", function (name, sub, active, parameters) { return new class_task_schwamm_apply({
6858)     "name": name, "sub": sub, "active": active,
6859)     "parameters": parameters,
6860) }); });
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6861) /**
6862)  * @author fenris
6863)  */
6864) var class_target = (function () {
6865)     /**
6866)      * @author fenris
6867)      */
6868)     function class_target() {
6869)     }
6870)     return class_target;
6871) }());
6872) /**
6873)  * @author fenris
6874)  */
6875) var class_target_regular = (function (_super) {
6876)     __extends(class_target_regular, _super);
6877)     /**
6878)      * @author fenris
6879)      */
6880)     function class_target_regular(identifier) {
6881)         _super.call(this);
6882)         this.identifier = identifier;
6883)     }
6884)     /**
6885)      * @author fenris
6886)      */
6887)     class_target_regular.prototype.compile_action = function (action) {
6888)         if (action instanceof class_action_adhoc) {
6889)             var action_ = (action);
6890)             return (action_.compilation(this.identifier));
6891)         }
6892)         else {
6893)             throw (new Error("no delegation for action '" + JSON.stringify(action) + "'"));
6894)         }
6895)     };
6896)     return class_target_regular;
6897) }(class_target));
6898) /**
6899)  * @author fenris
6900)  */
6901) var class_target_ant = (function (_super) {
6902)     __extends(class_target_ant, _super);
6903)     /**
6904)      * @author fenris
6905)      */
6906)     function class_target_ant() {
6907)         _super.call(this, "ant");
6908)     }
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6909)     /**
6910)      * @override
6911)      * @author fenris
6912)      */
6913)     class_target_ant.prototype.tempfolder = function () {
6914)         switch (configuration.system) {
6915)             case "unix": {
6916)                 return "/tmp/";
6917)                 break;
6918)             }
6919)             case "win": {
6920)                 return "${env.TEMP}\\";
6921)                 break;
6922)             }
6923)             default: {
6924)                 throw (new Error("invalid system '" + configuration.system + "'"));
6925)                 break;
6926)             }
6927)         }
6928)     };
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6929)     /**
6930)      * @author fenris
6931)      */
6932)     class_target_ant.prototype.compile_task = function (task, path) {
6933)         var _this = this;
6934)         if (path === void 0) { path = []; }
6935)         var path_ = [task.name_get()];
6936)         var targets_core = [
6937)             new lib_ant.class_target({
6938)                 "name": path_.join("-"),
6939)                 "dependencies": (task.sub_get()
6940)                     .filter(function (task_) { return task_.active_get(); })
6941)                     .map(function (task_) { return [task_.name_get()] /*)*/.join("-"); })),
6942)                 "actions": ([]
6943)                     .concat([new class_action_echo(task.name_get())])
6944)                     .concat(task.actions())
6945)                     .map(function (action) { return _this.compile_action(action); }))
6946)             })
6947)         ];
6948)         var targets_sub = task.sub_get()
6949)             .map(function (task_) { return _this.compile_task(task_, path_); })
6950)             .reduce(function (x, y) { return x.concat(y); }, []);
6951)         return [].concat(targets_core).concat(targets_sub);
6952)     };
6953)     /**
6954)      * @author fenris
6955)      */
6956)     class_target_ant.prototype.compile_project = function (project, without_dependencies) {
6957)         var _this = this;
6958)         if (without_dependencies === void 0) { without_dependencies = false; }
6959)         var comments = [
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

6960)             ("Project \"" + project.name_get() + "\""),
6961)             ("This build script was generated by Koralle " + configuration.version),
6962)         ].map(function (x) { return new lib_ant.class_comment(x); });
6963)         var dependencies = project.dependencytasks(this.identifier);
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

6964)         var targets = []
6965)             .concat([
6966)             new lib_ant.class_target({
6967)                 "name": "__root",
6968)                 "dependencies": ["__dependencies", "__core"],
6969)             })
6970)         ])
6971)             .concat([
6972)             new lib_ant.class_target({
6973)                 "name": "__dependencies",
6974)                 "dependencies": without_dependencies ? [] : dependencies.map(function (dependency) { return dependency.name_get(); }),
6975)             })
6976)         ])
6977)             .concat(dependencies.map(function (dependency) { return _this.compile_task(dependency); }).reduce(function (x, y) { return x.concat(y); }, []))
6978)             .concat([
6979)             new lib_ant.class_target({
6980)                 "name": "__core",
6981)                 "dependencies": [project.roottask_get().name_get()],
6982)             })
6983)         ])
6984)             .concat(this.compile_task(project.roottask_get()));
6985)         return (new lib_ant.class_project({
6986)             "name": project.name_get(),
6987)             "default": "__root",
6988)             "comments": comments,
6989)             "targets": targets,
6990)         }));
6991)     };
6992)     /**
6993)      * @override
6994)      * @author fenris
6995)      */
6996)     class_target_ant.prototype.compile_project_string = function (project) {
6997)         return this.compile_project(project).compile().compile();
6998)     };
6999)     /**
7000)      * @override
7001)      * @author fenris
7002)      */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7003)     class_target_ant.prototype.execute = function (filepointer, workdir) {
7004)         if (workdir === void 0) { workdir = "."; }
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7005)         return (function (resolve, reject) {
7006)             var command = [
7007)                 "ant",
7008)                 "-file " + filepointer.toString(),
7009)             ].join(" ");
7010)             _child_process.exec(command, {}, function (stdout, stderr, error) {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7011)                 if (error == null) {
7012)                     resolve(undefined);
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7013)                 }
7014)                 else {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7015)                     reject(error);
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7016)                 }
7017)             });
7018)         });
7019)     };
7020)     return class_target_ant;
7021) }(class_target_regular));
7022) /**
7023)  * @author fenris
7024)  */
7025) var class_target_gnumake = (function (_super) {
7026)     __extends(class_target_gnumake, _super);
7027)     /**
7028)      * @author fenris
7029)      */
7030)     function class_target_gnumake() {
7031)         _super.call(this, "gnumake");
7032)     }
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7033)     /**
7034)      * @override
7035)      * @author fenris
7036)      */
7037)     class_target_gnumake.prototype.tempfolder = function () {
7038)         switch (configuration.system) {
7039)             case "unix": {
7040)                 return "/tmp/";
7041)                 break;
7042)             }
7043)             case "win": {
7044)                 return "%TEMP%\\";
7045)                 break;
7046)             }
7047)             default: {
7048)                 throw (new Error("invalid system '" + configuration.system + "'"));
7049)                 break;
7050)             }
7051)         }
7052)     };
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7053)     /**
7054)      * @author fenris
7055)      */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7056)     class_target_gnumake.prototype.compile_task = function (task, branch, depth, prefix) {
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

7058)         if (branch === void 0) { branch = []; }
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7059)         if (depth === void 0) { depth = 0; }
7060)         if (prefix === void 0) { prefix = null; }
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7061)         var branch_ = [task.name_get()];
7062)         var logging_begin = new class_action_echo((new class_message("processing '" + branch_.join("-") + "' ...", { "type": "log", "depth": depth, "prefix": prefix })).generate());
7063)         var logging_end = new class_action_echo((new class_message("... finished '" + branch_.join("-") + "'", { "type": "log", "depth": depth, "prefix": prefix })).generate());
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7064)         var rules_core = [];
7065)         {
7066)             // meta rule
7067)             rules_core.push(new lib_gnumake.class_rule({
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7068)                 "name": branch_.join("-"),
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7069)                 "dependencies": ([]
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7070)                     .concat(["__logging_" + branch_.join("-")])
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7071)                     .concat(task.sub_get()
7072)                     .filter(function (task_) { return task_.active_get(); })
7073)                     .map(function (task_) { return [task_.name_get()] /*)*/.join("-"); }))
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7074)                     .concat(task.outputs().map(function (filepointer) { return filepointer.as_string(configuration.system); }))),
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7075)                 "actions": ([]
7076)                     .concat((task.outputs().length == 0) ? task.actions() : [])
7077)                     .map(function (action) { return _this.compile_action(action); })),
7078)                 "phony": true,
7079)             }));
7080)             // logging
7081)             rules_core.push(new lib_gnumake.class_rule({
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7082)                 "name": ("__logging_" + branch_.join("-")),
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7083)                 "actions": [logging_begin].map(function (action) { return _this.compile_action(action); }),
7084)                 "phony": true,
7085)             }));
7086)             // actual rule
7087)             if (task.outputs().length > 0) {
7088)                 rules_core.push(new lib_gnumake.class_rule({
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7089)                     "name": task.outputs().map(function (filepointer) { return filepointer.as_string(configuration.system); }).join(" "),
7090)                     "dependencies": task.inputs().map(function (filepointer) { return filepointer.as_string(configuration.system); }),
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7091)                     "actions": task.actions().map(function (action) { return _this.compile_action(action); }),
7092)                     "phony": false,
7093)                 }));
7094)             }
7095)         }
7096)         var rules_sub = [];
7097)         {
7098)             rules_sub = task.sub_get()
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7099)                 .map(function (task_) { return _this.compile_task(task_, branch_, depth + 1, prefix); })
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7100)                 .reduce(function (x, y) { return x.concat(y); }, []);
7101)         }
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7102)         return [].concat(rules_core).concat(rules_sub);
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7103)     };
7104)     /**
7105)      * @author fenris
7106)      */
7107)     class_target_gnumake.prototype.compile_project = function (project, without_dependencies) {
7108)         var _this = this;
7109)         if (without_dependencies === void 0) { without_dependencies = false; }
7110)         var comments = [
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7111)             ("Project \"" + project.name_get() + "\""),
7112)             ("This makefile was generated by Koralle " + configuration.version),
7113)         ].map(function (x) { return x; });
7114)         var dependencies = project.dependencytasks(this.identifier);
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7115)         var rules = []
7116)             .concat([
7117)             new lib_gnumake.class_rule({
7118)                 "name": "__default",
7119)                 "dependencies": ["__root"],
7120)                 "actions": [],
7121)                 "phony": true,
7122)             })
7123)         ])
7124)             .concat([
7125)             new lib_gnumake.class_rule({
7126)                 "name": "__root",
7127)                 "dependencies": ["__dependencies", "__core"],
7128)                 "phony": true,
7129)             })
7130)         ])
7131)             .concat([
7132)             new lib_gnumake.class_rule({
7133)                 "name": "__dependencies",
7134)                 "dependencies": without_dependencies ? [] : dependencies.map(function (dependency) { return dependency.name_get(); }),
7135)                 "phony": true,
7136)             })
7137)         ])
7138)             .concat(dependencies.map(function (dependency) { return _this.compile_task(dependency); }).reduce(function (x, y) { return x.concat(y); }, []))
7139)             .concat([
7140)             new lib_gnumake.class_rule({
7141)                 "name": "__core",
7142)                 "dependencies": [project.roottask_get().name_get()],
7143)                 "phony": true,
7144)             })
7145)         ])
7146)             .concat(this.compile_task(project.roottask_get(), undefined, undefined, project.name_get()));
7147)         return (new lib_gnumake.class_sheet(rules, comments));
7148)     };
7149)     /**
7150)      * @override
7151)      * @author fenris
7152)      */
7153)     class_target_gnumake.prototype.compile_project_string = function (project, without_dependencies) {
7154)         if (without_dependencies === void 0) { without_dependencies = false; }
7155)         return (this.compile_project(project, without_dependencies).compile(true));
7156)     };
7157)     /**
7158)      * @override
7159)      * @author fenris
7160)      */
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7161)     class_target_gnumake.prototype.execute = function (filepointer, workdir) {
7162)         if (workdir === void 0) { workdir = process.cwd(); }
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7163)         return (function (resolve, reject) {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7164)             var cp = _child_process.spawn("make", [
7165)                 // `--directory=${workdir}`,
7166)                 ("--file=" + filepointer.as_string(configuration.system)),
7167)             ], {});
7168)             cp.stdout.on("data", [function (x) { return x.toString(); }, function (x) { return x.slice(0, x.length - 1); }, console.log].reduce(lib_call.compose));
7169)             cp.stderr.on("data", [function (x) { return x.toString(); }, function (x) { return x.slice(0, x.length - 1); }, console.error].reduce(lib_call.compose));
7170)             cp.on("error", function (error) { return reject(new class_error("subprocess not finish successfully", [error])); });
7171)             cp.on("close", function (code) {
7172)                 if (code == 0) {
7173)                     resolve(undefined);
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7174)                 }
7175)                 else {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7176)                     reject(new Error("unknown error while subprocess execution"));
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7177)                 }
7178)             });
7179)         });
7180)     };
7181)     return class_target_gnumake;
7182) }(class_target_regular));
7183) /**
7184)  * @author fenris
7185)  */
7186) var class_project = (function () {
7187)     /**
7188)      * @author fenris
7189)      */
7190)     function class_project(name, version, dependencies_listed, roottask) {
7191)         this.name = name;
7192)         this.version = version;
7193)         this.dependencies_listed = dependencies_listed;
7194)         this.dependencies_all = null;
7195)         this.roottask = roottask;
7196)     }
7197)     /**
7198)      * @author fenris
7199)      */
7200)     class_project.prototype.name_get = function () {
7201)         return this.name;
7202)     };
7203)     /**
7204)      * @author fenris
7205)      */
7206)     class_project.prototype.dependencies_set = function (dependencies_all) {
7207)         this.dependencies_all = dependencies_all;
7208)     };
7209)     /**
7210)      * @author fenris
7211)      */
7212)     class_project.prototype.dependencies_get = function () {
7213)         return this.dependencies_all;
7214)     };
7215)     /**
7216)      * @author fenris
7217)      */
7218)     class_project.prototype.roottask_get = function () {
7219)         return this.roottask;
7220)     };
7221)     /**
7222)      * @author fenris
7223)      */
7224)     class_project.create_task = function (raw) {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7225)         var type = object_fetch(raw, "type", null, 2);
7226)         return (class_task.get(type)(object_fetch(raw, "name", null, 1), object_fetch(raw, "sub", [], 0).map(function (raw) { return class_project.create_task(raw); }), object_fetch(raw, "active", true, 0), object_fetch(raw, "parameters", {}, 0)));
7227)     };
7228)     /**
7229)      * @author fenris
7230)      */
7231)     class_project.prototype.dependencytasks = function (output) {
7232)         return (this.dependencies_all.map(function (path, index) {
7233)             return (new class_task_dependency({
7234)                 "name": "__dependency_" + index.toString(),
7235)                 "parameters": {
7236)                     "path": path,
7237)                     "output": output,
7238)                     "raw": true,
7239)                 },
7240)             }));
7241)         }));
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7242)     };
7243)     /**
7244)      * @author fenris
7245)      */
7246)     class_project.create = function (project_raw) {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7247)         var name = object_fetch(project_raw, "name", "(nameless project)", 1);
7248)         var version = object_fetch(project_raw, "version", "0.0.0", 1);
7249)         var dependencies = object_fetch(project_raw, "dependencies", [], 0);
7250)         var roottask = class_project.create_task(object_fetch(project_raw, "roottask", null, 2));
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7251)         // roottask.clean();
7252)         return (new class_project(name, version, dependencies, roottask));
7253)     };
7254)     return class_project;
7255) }());
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7256) function scan(filepointer, data, graph, depth) {
7257)     if (graph === void 0) { graph = null; }
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7258)     if (depth === void 0) { depth = 0; }
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7259)     if (graph == null) {
7260)         graph = new class_graph(function (x, y) { return (x.filepointer.toString() == y.filepointer.toString()); });
7261)     }
7262)     function make_node(filepointer, data) {
7263)         var name = lib_object.fetch(data, "name", filepointer.toString(), 1);
7264)         var node = { "filepointer": filepointer, "label": name };
7265)         return node;
7266)     }
7267)     var node = make_node(filepointer, data);
7268)     if (graph.has(node)) {
7269)         return lib_call.executor_resolve(graph);
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7270)     }
7271)     else {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7272)         graph.nodes.push(node);
7273)         return (lib_call.executor_chain(graph, lib_object.fetch(data, "dependencies", [], 0).map(function (path) { return function (graph_) { return function (resolve__, reject__) {
7274)             var filepointer_ = filepointer.foo(lib_path.filepointer_read(path));
7275)             lib_file.read_json(filepointer_.toString())(function (data_) {
7276)                 scan(filepointer_, data_, graph_, depth + 1)(function (graph_) {
7277)                     var node_ = make_node(filepointer_, data_);
7278)                     var edge = { "from": node_, "to": node };
7279)                     graph_.edges.push(edge);
7280)                     resolve__(graph_ /*.hasse()*/);
7281)                 }, reject__);
7282)             }, function (reason) {
7283)                 reject__(reason);
7284)             });
7285)         }; }; })));
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7286)     }
7287) }
7288) /**
7289)  * @author fenris
7290)  */
7291) function main(args) {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7292)     var arghandler = new lib_args.class_handler([
7293)         new lib_args.class_argument({
7294)             "name": "path",
7295)             "type": "string",
7296)             "default": "project.json",
7297)             "info": "the path of the project-description-file",
7298)             "kind": "positional",
7299)             "parameters": {},
7300)         }),
7301)         new lib_args.class_argument({
7302)             "name": "help",
7303)             "type": "boolean",
7304)             "info": "show this help and exit",
7305)             "kind": "volatile",
7306)             "parameters": {
7307)                 "indicators_long": ["help"],
7308)                 "indicators_short": ["h"],
7309)             },
7310)         }),
7311)         new lib_args.class_argument({
7312)             "name": "tasklist",
7313)             "type": "boolean",
7314)             "info": "show the list of available tasks and exit",
7315)             "kind": "volatile",
7316)             "parameters": {
7317)                 "indicators_long": ["tasklist"],
7318)                 "indicators_short": ["l"],
7319)             },
7320)         }),
7321)         new lib_args.class_argument({
7322)             "name": "version",
7323)             "type": "boolean",
7324)             "info": "print the version to stdout and exit",
7325)             "kind": "volatile",
7326)             "parameters": {
7327)                 "indicators_long": ["version"],
7328)                 "indicators_short": ["v"],
7329)             },
7330)         }),
7331)         new lib_args.class_argument({
7332)             "name": "output",
7333)             "type": "string",
7334)             "default": "gnumake",
7335)             "info": "the output build system; valid values are 'gnumake','ant'",
7336)             "kind": "volatile",
7337)             "parameters": {
7338)                 "indicators_long": ["output"],
7339)                 "indicators_short": ["o"],
7340)             },
7341)         }),
7342)         new lib_args.class_argument({
7343)             "name": "system",
7344)             "type": "string",
7345)             "default": "unix",
7346)             "info": "the target platform; valid values are 'unix', 'win'; default is 'unix'",
7347)             "kind": "volatile",
7348)             "parameters": {
7349)                 "indicators_long": ["system"],
7350)                 "indicators_short": ["s"],
7351)             },
7352)         }),
7353)         new lib_args.class_argument({
7354)             "name": "file",
7355)             "type": "string",
7356)             "default": null,
7357)             "info": "the file in which the result build script shall be written",
7358)             "kind": "volatile",
7359)             "parameters": {
7360)                 "indicators_long": ["file"],
7361)                 "indicators_short": ["f"],
7362)             },
7363)         }),
7364)         new lib_args.class_argument({
7365)             "name": "raw",
7366)             "type": "boolean",
7367)             "info": "if set, depedencies are ignored/excluded from the output",
7368)             "kind": "volatile",
7369)             "parameters": {
7370)                 "indicators_long": ["raw"],
7371)                 "indicators_short": ["r"],
7372)             },
7373)         }),
7374)         new lib_args.class_argument({
7375)             "name": "execute",
7376)             "type": "boolean",
7377)             "info": "if set, the build script will be executed instead of being printed to stdout",
7378)             "kind": "volatile",
7379)             "parameters": {
7380)                 "indicators_long": ["execute"],
7381)                 "indicators_short": ["x"],
7382)             },
7383)         }),
7384)         new lib_args.class_argument({
7385)             "name": "showgraph",
7386)             "type": "boolean",
7387)             "info": "if set, the graphviz description of the dependency graph is written to stderr",
7388)             "kind": "volatile",
7389)             "parameters": {
7390)                 "indicators_long": ["showgraph"],
7391)                 "indicators_short": ["g"],
7392)             },
7393)         }),
7394)     ]);
7395)     // lib_args.verbosity = 5;
7396)     var argdata = arghandler.read("cli", args.join(" "));
7397)     var procede = true;
7398)     if (argdata["help"]) {
7399)         (new class_message(arghandler.generate_help({
7400)             "programname": "Koralle Build System Abstractor",
7401)             "executable": "koralle",
7402)             "author": "Christian Fraß <frass@greenscale.de>",
7403)             "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.",
7404)         }))).stdout();
7405)         procede = false;
7406)     }
7407)     else if (argdata["version"]) {
7408)         (new class_message(configuration.version.toString())).stdout();
7409)         procede = false;
7410)     }
7411)     else if (argdata["tasklist"]) {
7412)         new class_message(class_task.list().map(function (entry) { return ("\t" + entry + "\n"); }).join("")).stdout();
7413)         procede = false;
7414)     }
7415)     else {
7416)         configuration.path = argdata["path"];
7417)         configuration.system = argdata["system"];
7418)         configuration.output = argdata["output"];
7419)         configuration.raw = argdata["raw"];
7420)         configuration.execute = argdata["execute"];
7421)         configuration.showgraph = argdata["showgraph"];
7422)         configuration.file = argdata["file"];
7423)         procede = true;
7424)     }
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7425)     if (procede) {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7426)         lib_call.executor_chain({}, [
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7427)             // environment
7428)             function (state) { return function (resolve, reject) {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7429)                 var filepointer = lib_path.filepointer_read(configuration.path);
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7430)                 filepointer.location.go_thither();
7431)                 state.filepointer = filepointer;
7432)                 resolve(state);
7433)             }; },
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7434)             // setup output
7435)             function (state) { return function (resolve, reject) {
7436)                 var mapping = {
7437)                     "ant": new class_target_ant(),
7438)                     "gnumake": new class_target_gnumake(),
7439)                     "make": new class_target_gnumake(),
7440)                 };
7441)                 var output = lib_object.fetch(mapping, configuration.output, null, 0);
7442)                 if (output == null) {
7443)                     reject(new class_error("no implementation found for output '" + configuration.output + "'"));
7444)                 }
7445)                 else {
7446)                     state.output = output;
7447)                     resolve(state);
7448)                 }
7449)             }; },
7450)             // setup temp-folder
7451)             function (state) { return function (resolve, reject) {
7452)                 try {
7453)                     configuration.tempfolder = state.output.tempfolder();
7454)                     resolve(state);
7455)                 }
7456)                 catch (exception) {
7457)                     reject(new class_error("couldn't setup temp folder", [exception]));
7458)                 }
7459)             }; },
7460)             // get jsondata
7461)             function (state) { return function (resolve, reject) {
7462)                 lib_file.read_json(state.filepointer.filename)(function (data) { state.project_raw = data; resolve(state); }, function (reason) { return reject(new class_error("project description file '" + state.filepointer.toString() + "' couldn't be read", [reason])); });
7463)             }; },
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7464)             // scan dependencies
7465)             function (state) { return function (resolve, reject) {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7466)                 if (configuration.raw) {
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7467)                     state.order = [];
7468)                     resolve(state);
7469)                 }
7470)                 else {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7471)                     scan(state.filepointer, state.project_raw)(function (graph) {
7472)                         if (configuration.showgraph) {
7473)                             var output = graph
7474)                                 .hasse()
7475)                                 .output_graphviz(function (node) { return node.label; });
7476)                             (new class_message(output)).stderr();
7477)                         }
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7478)                         try {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7479)                             var order = graph
7480)                                 .topsort()
7481)                                 .map(function (x) { return x.filepointer.toString(); })
7482)                                 .filter(function (path) { return (path != state.filepointer.toString()); });
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7483)                             state.order = order;
7484)                             resolve(state);
7485)                         }
7486)                         catch (exception) {
7487)                             reject((exception));
7488)                         }
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7489)                     }, function (reason) { return reject(new class_error("scanning dependencies failed", [reason])); });
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7490)                 }
7491)             }; },
7492)             // setup project
7493)             function (state) { return function (resolve, reject) {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7494)                 state.project = class_project.create(state.project_raw);
7495)                 resolve(state);
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7496)             }; },
7497)             // generate
7498)             function (state) { return function (resolve, reject) {
7499)                 state.project.dependencies_set(state.order);
7500)                 try {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7501)                     var script = state.output.compile_project_string(state.project, configuration.raw);
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7502)                     state.script = script;
7503)                     resolve(state);
7504)                 }
7505)                 catch (exception) {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7506)                     reject(new class_error("generating build script failed", [exception]));
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7507)                 }
7508)             }; },
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7509)             // write
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7510)             function (state) { return function (resolve, reject) {
7511)                 var filepointer;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7512)                 if (configuration.file == null) {
7513)                     if (!configuration.execute) {
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7514)                         filepointer = null;
7515)                     }
7516)                     else {
7517)                         filepointer = new lib_path.class_filepointer(
7518)                         // new lib_path.class_location(null, new lib_path.class_path(["."])),
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7519)                         lib_path.location_read(configuration.tempfolder, configuration.system), "_koralle_");
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7520)                     }
7521)                 }
7522)                 else {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7523)                     filepointer = lib_path.filepointer_read(configuration.file);
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

7525)                 state.file = filepointer;
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7526)                 if (filepointer == null) {
7527)                     (new class_message(state.script)).stdout();
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7528)                     resolve(state);
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7529)                 }
7530)                 else {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7531)                     _fs.writeFile(filepointer.toString(), state.script, function (error) {
7532)                         if (error == null) {
7533)                             resolve(state);
7534)                         }
7535)                         else {
7536)                             reject(new class_error("writing to file failed", [error]));
7537)                         }
7538)                     });
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

7541)             // execute
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7542)             function (state) { return function (resolve, reject) {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7543)                 if (!configuration.execute) {
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7544)                     resolve(state);
7545)                 }
7546)                 else {
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7547)                     state.output.execute(state.file)(function (result) { return resolve(state); }, function (reason) { return reject(new class_error("execution of build script failed", [reason])); });
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7548)                 }
7549)             }; },
7550)         ])(function (state) {
7551)             // (new class_message("successfull", {"type": "information", "prefix": "koralle"})).stderr();
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7552)             process.exit(0);
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

7553)         }, function (reason) {
7554)             // throw reason;
Christian Fraß added transition-data and t...

Christian Fraß authored 7 years ago

7555)             // console.error(reason);
7556)             (new class_message("the following error occured: '" + reason.toString() + "'", { "type": "error", "prefix": "koralle" })).stderr();
7557)             process.exit(-1);
Christian Fraß minor changes; move to kora...

Christian Fraß authored 7 years ago

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

Christian Fraß authored 7 years ago

7561) configuration.invocation = {
7562)     "interpreter": process.argv[0],
7563)     "path": process.argv[1],
7564) };