Christian Fraß commited on 2016-11-27 17:30:26
Zeige 26 geänderte Dateien mit 6703 Einfügungen und 1645 Löschungen.
... | ... |
@@ -9,15 +9,18 @@ |
9 | 9 |
"name": "structure", |
10 | 10 |
"type": "php", |
11 | 11 |
"parameters": { |
12 |
+ "only_last": true, |
|
12 | 13 |
"inputs": [ |
13 |
- "source/content/draft.html.php", |
|
14 |
- "source/data/phonology_and_orthography.json", |
|
15 |
- "source/data/personal_pronouns.json", |
|
16 |
- "source/data/word_functions.json", |
|
17 |
- "source/data/timeforms.json", |
|
18 | 14 |
"source/data/adpositions.json", |
15 |
+ "source/data/common.json", |
|
19 | 16 |
"source/data/correlatives.json", |
20 | 17 |
"source/data/declension.json", |
18 |
+ "source/data/personal_pronouns.json", |
|
19 |
+ "source/data/phonology_and_orthography.json", |
|
20 |
+ "source/data/texts.json", |
|
21 |
+ "source/data/timeforms.json", |
|
22 |
+ "source/data/transitions.json", |
|
23 |
+ "source/data/word_functions.json", |
|
21 | 24 |
"source/logic/server/misc.php", |
22 | 25 |
"source/logic/server/data.php", |
23 | 26 |
"source/logic/server/settings.php", |
... | ... |
@@ -52,10 +55,10 @@ |
52 | 55 |
"source/content/dictionary.html.php", |
53 | 56 |
"source/content/examples.html.php", |
54 | 57 |
"source/content/example_sentences.html.php", |
55 |
- "source/content/example_texts.html.php" |
|
58 |
+ "source/content/example_texts.html.php", |
|
59 |
+ "source/content/draft.html.php" |
|
56 | 60 |
], |
57 |
- "output": "build/draft.html", |
|
58 |
- "only_first": true |
|
61 |
+ "output": "build/draft.html" |
|
59 | 62 |
} |
60 | 63 |
}, |
61 | 64 |
{ |
... | ... |
@@ -26,9 +26,9 @@ |
26 | 26 |
$data = sql_rename($data, "name", "type_name"); |
27 | 27 |
} |
28 | 28 |
{ |
29 |
- $data = sql_cross($data, $data_adpositions["kinds"]); |
|
30 |
- $data = sql_select($data, function ($row) {return ($row["kind_id"] == $row["id"]);}); |
|
31 |
- $data = sql_delete($data, ["kind_id", "id"]); |
|
29 |
+ $data = sql_cross($data, $data_adpositions["references"]); |
|
30 |
+ $data = sql_select($data, function ($row) {return ($row["reference_id"] == $row["id"]);}); |
|
31 |
+ $data = sql_delete($data, ["reference_id", "id"]); |
|
32 | 32 |
$data = sql_rename($data, "name", "kind_name"); |
33 | 33 |
} |
34 | 34 |
} |
... | ... |
@@ -44,7 +44,7 @@ |
44 | 44 |
], |
45 | 45 |
$data |
46 | 46 |
); |
47 |
- $table = $table->snap |
|
47 |
+ $table_ = $table->snap |
|
48 | 48 |
( |
49 | 49 |
[ |
50 | 50 |
"label_vertical" => function ($column) {return "";}, |
... | ... |
@@ -67,22 +67,17 @@ |
67 | 67 |
{ |
68 | 68 |
return $values; |
69 | 69 |
}, |
70 |
- "data_formatter" => function ($value) |
|
71 |
- { |
|
72 |
- return ( |
|
73 |
- _bar("word") |
|
70 |
+ "data_formatter" => function_chain |
|
74 | 71 |
( |
75 | 72 |
[ |
76 |
- "original" => $value[0]["words"], |
|
77 |
- "translated" => $value[1]["words"], |
|
73 |
+ object_from_array("language_id"), |
|
74 |
+ object_map(object_attribute("words")), |
|
75 |
+ format_correlation("type_word"), |
|
78 | 76 |
] |
79 |
- ) |
|
80 |
- ); |
|
81 |
- return json_encode($value); |
|
82 |
- }, |
|
77 |
+ ), |
|
83 | 78 |
] |
84 | 79 |
); |
85 |
- $table->generate(); |
|
80 |
+ $table_->generate(); |
|
86 | 81 |
?> |
87 | 82 |
</section> |
88 | 83 |
|
... | ... |
@@ -2,6 +2,6 @@ |
2 | 2 |
<header>Cases</header> |
3 | 3 |
<?php proposal(); ?> |
4 | 4 |
<p>The base form of noun is the <span class="grammarterm">nominative</span> |
5 |
- <p>Regular nouns can appear in two cases: <span class="grammarterm">nominative</span> and <span class="grammarterm">genitive</span>. The nominative doesn't receive any marker while the genitive is formed by appending the suffix <span class="word lang_fs">-(e)s</span> to the word, e.g. <span class="word lang_fs">huses</span> ~ <span class="word lang_en">houses</span>. The marker for the plural has to be applied first, e.g. <span class="word lang_fs">huser(e)s</span> ~ <span class="word lang_en">the houses'</span>.</p> |
|
5 |
+ <p>Regular nouns can appear in two cases: <span class="grammarterm">nominative</span> and <span class="grammarterm">genitive</span>. The nominative doesn't receive any marker while the genitive is formed by appending the suffix <?php echo(mark("-(e)s", ["type_word", "lang_fs"])); ?> to the word, e.g. <?php echo(format_correlation("type_word")(["fs" => ["huses"], "en" => ["houses"]])); ?>. The marker for the plural has to be applied first, e.g. <?php echo(format_correlation("type_word")(["fs" => ["huser(e)s"], "en" => ["houses'"]])); ?>.</p> |
|
6 | 6 |
</section> |
7 | 7 |
|
... | ... |
@@ -35,7 +35,7 @@ |
35 | 35 |
], |
36 | 36 |
$data |
37 | 37 |
); |
38 |
- $table = $table->snap |
|
38 |
+ $table_ = $table->snap |
|
39 | 39 |
( |
40 | 40 |
[ |
41 | 41 |
"label_vertical" => function ($column) {return "";}, |
... | ... |
@@ -50,32 +50,28 @@ |
50 | 50 |
], |
51 | 51 |
"columns_data" => |
52 | 52 |
[ |
53 |
+ $table->columns_get()[0], |
|
53 | 54 |
$table->columns_get()[3], |
54 | 55 |
], |
55 | 56 |
"data_aggregator" => function ($values) |
56 | 57 |
{ |
57 | 58 |
return $values; |
58 | 59 |
}, |
59 |
- "data_formatter" => function ($value) |
|
60 |
- { |
|
61 |
- return ( |
|
62 |
- _bar("word") |
|
60 |
+ "data_formatter" => function_chain |
|
63 | 61 |
( |
64 | 62 |
[ |
65 |
- "original" => $value[0]["words"], |
|
66 |
- "translated" => $value[1]["words"], |
|
63 |
+ object_from_array("language_id"), |
|
64 |
+ object_map(object_attribute("words")), |
|
65 |
+ format_correlation("type_word"), |
|
67 | 66 |
] |
68 |
- ) |
|
69 |
- ); |
|
70 |
- return json_encode($value); |
|
71 |
- }, |
|
67 |
+ ), |
|
72 | 68 |
] |
73 | 69 |
); |
74 |
- $table->generate(); |
|
70 |
+ $table_->generate(); |
|
75 | 71 |
?> |
76 | 72 |
<div class="note note_information"> |
77 | 73 |
<span class="note_content"> |
78 |
- <p>Some of these words are very unlikely to ever get used (e.g. <span class="word lang_fs">ni slag</span>). Nevertheless they exist and are listed for completeness.</p> |
|
74 |
+ <p>Some of these words are very unlikely to ever get used (e.g. <?php echo(mark("ni slag", ["type_word", "lang_fs"])); ?>). Nevertheless they exist and are listed for completeness.</p> |
|
79 | 75 |
</span> |
80 | 76 |
</div> |
81 | 77 |
</section> |
... | ... |
@@ -99,8 +99,8 @@ |
99 | 99 |
{ |
100 | 100 |
case 0: |
101 | 101 |
{ |
102 |
- return _baz($value[0]["words"], "word", "fs"); |
|
103 |
- // break; |
|
102 |
+ return format_list("type_word", "fs")($value[0]["words"]); |
|
103 |
+ break; |
|
104 | 104 |
} |
105 | 105 |
case 1: |
106 | 106 |
{ |
... | ... |
@@ -120,26 +120,25 @@ |
120 | 120 |
); |
121 | 121 |
} |
122 | 122 |
return ( |
123 |
- _bar("word") |
|
123 |
+ format_correlation("type_word") |
|
124 | 124 |
( |
125 | 125 |
[ |
126 |
- "original" => $value_["fs"], |
|
127 |
- "translated" => $value_[$configuration["target"]], |
|
126 |
+ "fs" => $value_["fs"], |
|
127 |
+ $configuration["target"] => $value_[$configuration["target"]], |
|
128 | 128 |
] |
129 | 129 |
) |
130 | 130 |
); |
131 |
- // break; |
|
131 |
+ break; |
|
132 | 132 |
} |
133 | 133 |
default: |
134 | 134 |
{ |
135 | 135 |
return json_encode($value); |
136 |
- // break; |
|
136 |
+ break; |
|
137 | 137 |
} |
138 | 138 |
} |
139 | 139 |
}, |
140 | 140 |
] |
141 | 141 |
)->generate(); |
142 | 142 |
?> |
143 |
-<p><span class="sentence lang_fs">Vi kön see de huses vindöger.</span> ~ <span class="sentence lang_en">We can see the houses' windows.</span></p> |
|
144 |
-</section> |
|
143 |
+<p><?php echo(format_correlation("type_sentence")(["fs" => ["Vi kön see de huses vindöger"], "en" => ["We can see the houses windows."]])); ?></p></section> |
|
145 | 144 |
|
... | ... |
@@ -1,7 +1,7 @@ |
1 | 1 |
<section class="subsection" id="definiteness"> |
2 | 2 |
<header>Definiteness</header> |
3 | 3 |
<?php proposal(); ?> |
4 |
- <p>The undefinite aspect of a singular noun is formed by using the article <span class="word lang_fs">en</span>, e.g. <span class="word lang_fs">en hus</span> ~ <span class="word lang_en">a house</span>. Undefinite plural nouns don't have an article, e.g. <span class="word lang_fs">huser</span> ~ <span class="word lang_en">houses</span>.</p> |
|
5 |
- <p>The definite aspect of both singular and plural nouns is formed by using the article <span class="word lang_fs">de</span>, e.g. <span class="word lang_fs">de hus</span> ~ <span class="word lang_en">the house</span>.</p> |
|
4 |
+ <p>The undefinite aspect of a singular noun is formed by using the article <?php echo(mark("en", ["type_word", "lang_fs"])); ?>, e.g. <?php echo(format_correlation("type_word")(["fs" => ["en hus"], "en" => ["a house"]])); ?>. Undefinite plural nouns don't have an article, e.g. <?php echo(format_correlation("type_word")(["fs" => ["huser"], "en" => ["houses"]])); ?>.</p> |
|
5 |
+ <p>The definite aspect of both singular and plural nouns is formed by using the article <?php echo(mark("de", ["type_word", "lang_fs"])); ?>, e.g. <?php echo(format_correlation("type_word")(["fs" => ["de hus"], "en" => ["the house"]])); ?>.</p> |
|
6 | 6 |
</section> |
7 | 7 |
|
... | ... |
@@ -21,6 +21,20 @@ |
21 | 21 |
titlepage |
22 | 22 |
--> |
23 | 23 |
<?php |
24 |
+ /* |
|
25 |
+ echo |
|
26 |
+ ( |
|
27 |
+ function_chain |
|
28 |
+ ( |
|
29 |
+ [ |
|
30 |
+ function ($x) {return $x+1;}, |
|
31 |
+ function ($x) {return $x*2;}, |
|
32 |
+ function ($x) {return $x/3;}, |
|
33 |
+ ] |
|
34 |
+ ) |
|
35 |
+ (5) |
|
36 |
+ ); |
|
37 |
+ */ |
|
24 | 38 |
compose |
25 | 39 |
( |
26 | 40 |
[ |
... | ... |
@@ -31,6 +45,8 @@ |
31 | 45 |
"examples", |
32 | 46 |
] |
33 | 47 |
); |
48 |
+ /* |
|
49 |
+ */ |
|
34 | 50 |
?> |
35 | 51 |
</div> |
36 | 52 |
</body> |
... | ... |
@@ -1,16 +1,24 @@ |
1 |
+<?php |
|
2 |
+ $data = read_json("source/data/texts.json"); |
|
3 |
+ ?> |
|
1 | 4 |
<section class="section" id="example_texts"> |
2 | 5 |
<header>Texts</header> |
3 |
- <section class="subsection" id="de_grot_diktator"> |
|
4 |
- <header>De grot diktator</header> |
|
5 |
- <span class="text lang_fs"> |
|
6 |
- <p>Ek bid fur fargivung, dok ek vil nit are de verlds herskar — ek ar nit solk en man. Ek vil nit beherske odar neddruyke et man, insted ek vil helpe de maner alvan and alvar: De judisk, de hejdisk, de fargig, de vit, …. Vi al skal helpe en de ander fur at vi koyn leve ine en beter verld. Vi vil nit hate odar farakte us. Dis verld hav plats fur al maner and ur erd ar so rik, at vi al koyn spise nok. De levrid koyn are so fri and skoyn; dok vi hav farlatet de veg.</p> |
|
7 |
- <p>Gridhed hav suykent de maners seler and hav fuylt de verld med hatrid; hit hav ledet us to elend and blutsketrid. Vi hav utvikelt raskhed, dok ur gester stan stil. Vi lat makiner verke fur us; ur vetrid hav makt us hokmudig and ur klughed hard and unfrendlik; vi denk altu mang and foyl altu lit. Dok mer den makiner vi treng manlikhed; mer den klughed vi treng frendlikhed and gudhed. An dis egenheder, ur levrid ar fruykridig and al ding ar lost.</p> |
|
8 |
- <p>Med de helprid av fluygtuyger and de radio vi ar narer en to de ander den et tid ruk. De manskap treng enhed and en alvar arend bruderlikhed fur tu bruke dis utfindunger gud. Selv no mang tused in der verld koyn hoyre min stem, mang tusend fartvivelt verer, kviner and smal kinder — ofarunger av en sistem, vilk fang and kvel unskuldig maner. Ek rup to al, vilk koyn hoyr mek no: Fartvivel nit! De elend skal farsvinde, van de gridhed farsvind and de biterhed av maner, vilk fruyk de manskaps forskritrid. De Maners hatrid skal farsvinde and diktarorer skal doye. Dan de kraft, vilk di hav takt fra de folk, skal kome bak to de folk. Selv ef mang blud ar sketet: Tu kempe fur de frihed ar en gud sak.</p> |
|
9 |
- <p>Kemparer: Kemp nit fur tiraner; maner, vilk farakt ju and mak ju to sklaver; vilk vertskat nit jer levrid, vilk seg to ju, vat je skal make, true and foyle! Di skend ju, foyd ju, behandel ju lik kanon-foydung. Kemp nit fur dis fardervt maner — makin-maner med makin-hoyvder and makin-herter! Je ar nit makiner, je ar nit direr, je ar maner. Lat de manlikhed blive ine jer herter! Je skal nit hate; bar de unlivt hat, de unlivt and de fardervt.</p> |
|
10 |
- <p>Kemperar: Kemp nit fur de sklavskap! Kemp fur de frihed! Ine de 17. avsniding av de hajlig Lukas ar skrivt: ‚God ar ine al maner.‘ — nit bar ine en grup av maner, insted ine al maner, ine ju. Je, de folk, hav de kraft; de kraft fur tu bue vapener, dok ok de kraft fur tu sprede gladhed. Je, de folk, hav de kraft fur tu make dis levrid fri and skoyn, fur tu make dis levrid en vunderfuylt sak. Darfur: Ine de nam av folkherskrid: Lat us bruke dis kraft! Lat us verde en! Lat us kempe fur en nuy verld, fur en beter verld, vilk giv to de maner magrid tu verke, vilk giv en eftertid to de jung and sikerhed to de eld. Ok de tiraner hav truent dis to us fur tu foe de vold, dok di hav luygt. Di mak nit sant dir luvung, di vil ni tid. Tiraner frien bar dim selv, dok de folk skal blive sklaver.</p> |
|
11 |
- <p>Lat us no kempe fur tu upfuyle dis luvung. Lat us kempe fur tu make de verld fri, fur tu uvervinde landmarker, gridhed, hatrid and de untillatrid. Lat us kempe fur en verld med farstanrid, en verld, var vetridskap and forskritrid skal lede to al mans gladhed.</p> |
|
12 |
- <p>Kemparer: Ine de nam av folkherskrid: Lat us al verde en!</p> |
|
13 |
- </span> |
|
6 |
+<?php |
|
7 |
+ $id = "de_grot_diktator"; |
|
8 |
+ $dataset = $data[$id]; |
|
9 |
+ ?> |
|
10 |
+ <section class="subsection" id="<?php echo($id); ?>"> |
|
11 |
+ <header><?php echo($dataset["title"]); ?></header> |
|
12 |
+<?php |
|
13 |
+ echo |
|
14 |
+ ( |
|
15 |
+ mark |
|
16 |
+ ( |
|
17 |
+ implode("", array_map(function ($paragraph) {return ("<p>${paragraph}</p>");}, $dataset["paragraphs"])), |
|
18 |
+ ["type_text", "lang_fs"] |
|
19 |
+ ) |
|
20 |
+ ); |
|
21 |
+ ?> |
|
14 | 22 |
<p>An attempt to translate the final speech from the famous Charlie Chaplin movie "The great dictator" (with some passages inspired by the German translation); the English original can be listened to <a href="https://www.youtube.com/watch?v=ibVpDhW6kDQ">on youtube</a>; or in case you'd like to hear a more heart-wrenching version: <a href="https://www.youtube.com/watch?v=Gaq62VCcnew">accompanied by "Hans Zimmer - Time"</a>.</p> |
15 | 23 |
<!-- |
16 | 24 |
<a href="https://www.youtube.com/watch?v=Gaq62VCcnew">With "Hans Zimmer -- Time"</a> |
... | ... |
@@ -1,8 +1,8 @@ |
1 | 1 |
<section class="subsection" id="infinite_verbforms"> |
2 | 2 |
<header>Infinite Verbforms</header> |
3 |
- <p>The <span class="grammarterm">infinitive</span> is formed by appending <span class="word lang_fs">-e</span> to the verb stem, e.g. <span class="word lang_fs">skrive</span> ~ <span class="word lang_en">to write</span>. In some cases it is mandatory to mark the infinitive with the special particle <span class="word lang_fs">tu</span> in order to form the <span class="grammarterm">extended intfinitive</span>, e.g.: <span class="sentence lang_fs">Han hop tu finde en svart sten.</span> ~ <span class="sentence lang_en">He hopes to find a black stone.</span>.</p> |
|
3 |
+ <p>The <span class="grammarterm">infinitive</span> is formed by appending <?php echo(mark("-e", ["type_word", "lang_fs"])); ?> to the verb stem, e.g. <?php echo(format_correlation("type_word")(["fs" => ["skrive"], "en" => ["to write"]])); ?>. In some cases it is mandatory to mark the infinitive with the special particle <?php echo(mark("tu", ["type_word", "lang_fs"])); ?> in order to form the <span class="grammarterm">extended intfinitive</span>, e.g.: <?php echo(format_correlation("type_sentence")(["fs" => ["Han hup tu finde en svart sten."], "en" => ["He hopes to find a black stone."]])); ?>.</p> |
|
4 | 4 |
<span class="todo">Specify cases for extended infinitive</span> |
5 |
- <p>The <span class="grammarterm">active participle</span> is formed by appending <span class="word lang_fs">-end</span> to the verb stem, e.g. <span class="word lang_fs">skrivend</span> ~ <span class="word lang_en">writing</span>.</p> |
|
6 |
- <p>The <span class="grammarterm">passive participle</span> is formed by appending <span class="word lang_fs">-et</span> to the verb stem, e.g. <span class="word lang_fs">skrivet</span> ~ <span class="word lang_en">written</span>. If pronouncable, the <span class="word lang_fs">e</span> in the ending can be omitted, e.g. <span class="word lang_fs">skrivt</span>.</p> |
|
5 |
+ <p>The <span class="grammarterm">active participle</span> is formed by appending <?php echo(mark("-end", ["type_word", "lang_fs"])); ?> to the verb stem, e.g. <?php echo(format_correlation("type_word")(["fs" => ["skrivend"], "en" => ["writing"]])); ?>.</p> |
|
6 |
+ <p>The <span class="grammarterm">passive participle</span> is formed by appending <?php echo(mark("-et", ["type_word", "lang_fs"])); ?> to the verb stem, e.g. <?php echo(format_correlation("type_word")(["fs" => ["skrivet"], "en" => ["written"]])); ?>. If pronouncable, the <?php echo(mark("e", ["type_letter", "lang_fs"])); ?> in the ending can be omitted, e.g. <?php echo(mark("skrivt", ["type_word", "lang_fs"])); ?>.</p> |
|
7 | 7 |
</section> |
8 | 8 |
|
... | ... |
@@ -6,20 +6,20 @@ |
6 | 6 |
<?php |
7 | 7 |
$entries = |
8 | 8 |
[ |
9 |
- ["original" => ["mute"], "translated" => ["to must"]], |
|
10 |
- ["original" => ["köne"], "translated" => ["to can"]], |
|
11 |
- ["original" => ["vile"], "translated" => ["to will"]], |
|
12 |
- ["original" => ["skale"], "translated" => ["to shall"]], |
|
13 |
- // ["original" => ["darfe"], "translated" => ["to be allowed to"]], |
|
9 |
+ ["fs" => ["mute"], "en" => ["to must"]], |
|
10 |
+ ["fs" => ["köne"], "en" => ["to can"]], |
|
11 |
+ ["fs" => ["vile"], "en" => ["to will"]], |
|
12 |
+ ["fs" => ["skale"], "en" => ["to shall"]], |
|
13 |
+ // ["fs" => ["darfe"], "en" => ["to be allowed to"]], |
|
14 | 14 |
]; |
15 | 15 |
foreach ($entries as $entry) |
16 | 16 |
{ |
17 | 17 |
?> |
18 |
- <li><?php echo(call_user_func(_bar("word"), $entry)); ?></li> |
|
18 |
+ <li><?php echo(format_correlation("type_word")($entry)); ?></li> |
|
19 | 19 |
<?php |
20 | 20 |
} |
21 | 21 |
?> |
22 | 22 |
</ul> |
23 |
- <p>Modal verbs in contrast to normal verbs never take an extended infinitive as object, e.g. <?php echo(call_user_func(_bar("sentence"), ["original" => ["Vi hop tu finde vater har."], "translated" => ["We hope to find water here."]])); ?>, but <?php echo(call_user_func(_bar("sentence"), ["original" => ["Vi kön finde vater har."], "translated" => ["We can find water here."]])); ?></p> |
|
23 |
+ <p>Modal verbs in contrast to normal verbs never take an extended infinitive as object, e.g. <?php echo(format_correlation("type_sentence")(["fs" => ["Vi hop tu finde vater har."], "en" => ["We hope to find water here."]])); ?>, but <?php echo(format_correlation("type_sentence")(["fs" => ["Vi kön finde vater har."], "en" => ["We can find water here."]])); ?></p> |
|
24 | 24 |
</section> |
25 | 25 |
|
... | ... |
@@ -1,9 +1,9 @@ |
1 | 1 |
<section class="subsection" id="negation"> |
2 | 2 |
<header>Negation</header> |
3 | 3 |
<?php proposal(); ?> |
4 |
- <p>In order to negate the meaning of a verb, one places the word <span class="word lang_fs">nit</span> after the verb. Example: <?php echo(call_user_func(_bar("sentence"), ["original" => ["Di se nit."], "translated" => ["They don't see."]])); ?></p> |
|
5 |
- <p>If the verb takes a direct object it is allowed to place the object before the <span class="word lang_fs">nit</span>. Example: <?php echo(call_user_func(_bar("sentence"), ["original" => ["Di se us nit."], "translated" => ["They don't see us."]])); ?></p> |
|
6 |
- <p>Negations can also be expressed implicitly by using negative correlatives. Example: <?php echo(call_user_func(_bar("sentence"), ["original" => ["Di se ing tid."], "translated" => ["They never see."]])); ?></p> |
|
7 |
- <p>Doubled negations (both explicit and implicit ones) cancel each other out. Example: <?php echo(call_user_func(_bar("sentence"), ["original" => ["Di se nit ing tid."], "translated" => ["They never don't see.", "They always see."]])); ?></p> |
|
4 |
+ <p>In order to negate the meaning of a verb, one places the word <?php echo(mark("nit", ["type_word", "lang_fs"])); ?> after the verb. Example: <?php echo(format_correlation("type_sentence")(["fs" => ["Di se nit."], "en" => ["They don't see."]])); ?></p> |
|
5 |
+ <p>If the verb takes a direct object it is allowed to place the object before the <?php echo(mark("nit", ["type_word", "lang_fs"])); ?>. Example: <?php echo(format_correlation("type_sentence")(["fs" => ["Di se us nit."], "en" => ["They don't see us."]])); ?></p> |
|
6 |
+ <p>Negations can also be expressed implicitly by using negative correlatives. Example: <?php echo(format_correlation("type_sentence")(["fs" => ["Di se ing tid."], "en" => ["They never see."]])); ?></p> |
|
7 |
+ <p>Doubled negations (both explicit and implicit ones) cancel each other out. Example: <?php echo(format_correlation("type_sentence")(["fs" => ["Di se nit ing tid."], "en" => ["They never don't see.", "They always see."]])); ?></p> |
|
8 | 8 |
</section> |
9 | 9 |
|
... | ... |
@@ -1,6 +1,6 @@ |
1 | 1 |
<section class="subsection" id="numeri"> |
2 | 2 |
<header>Numeri</header> |
3 | 3 |
<?php proposal(); ?> |
4 |
- <p>The plural of a noun is formed by appending the syllable <span class="word lang_fs">-er</span>, e.g. <span class="word lang_fs">huser</span> ~ <span class="word lang_en">houses</span>.</p> |
|
4 |
+ <p>The plural of a noun is formed by appending the syllable <?php echo(mark("-er", ["type_word", "lang_fs"])); ?>, e.g. <?php echo(format_correlation("type_word")(["fs" => ["huser"], "en" => ["houses"]])); ?>.</p> |
|
5 | 5 |
</section> |
6 | 6 |
|
... | ... |
@@ -129,66 +129,30 @@ function convert_genus($genus) {return [0 => "common", 1 => "masculine", 2 => "f |
129 | 129 |
{ |
130 | 130 |
return $values; |
131 | 131 |
}, |
132 |
- "data_formatter" => function ($value) |
|
133 |
- { |
|
134 |
- switch (1) |
|
135 |
- { |
|
136 |
- case 0: |
|
137 |
- { |
|
138 |
- return _baz($value[0]["words"], "word", "fs"); |
|
139 |
- // break; |
|
140 |
- } |
|
141 |
- case 1: |
|
142 |
- { |
|
143 |
- global $configuration; |
|
144 |
- $value_ = []; |
|
145 |
- foreach (["fs",$configuration["target"]] as $language_id) |
|
146 |
- { |
|
147 |
- $value_[$language_id] = array_reduce |
|
148 |
- ( |
|
149 |
- array_map |
|
150 |
- ( |
|
151 |
- function ($dataset) {return $dataset["words"];}, |
|
152 |
- array_filter($value, function ($dataset) use (&$language_id) {return ($dataset["language_id"] == $language_id);}) |
|
153 |
- ), |
|
154 |
- function ($x, $y) {return array_merge($x, $y);}, |
|
155 |
- [] |
|
156 |
- ); |
|
157 |
- } |
|
158 |
- return ( |
|
159 |
- _bar("word") |
|
132 |
+ "data_formatter" => function_chain |
|
160 | 133 |
( |
161 | 134 |
[ |
162 |
- "original" => $value_["fs"], |
|
163 |
- "translated" => $value_[$configuration["target"]], |
|
135 |
+ object_from_array("language_id"), |
|
136 |
+ object_map(object_attribute("words")), |
|
137 |
+ format_correlation("type_word"), |
|
164 | 138 |
] |
165 |
- ) |
|
166 |
- ); |
|
167 |
- // break; |
|
168 |
- } |
|
169 |
- default: |
|
170 |
- { |
|
171 |
- return json_encode($value); |
|
172 |
- // break; |
|
173 |
- } |
|
174 |
- } |
|
175 |
- }, |
|
139 |
+ ), |
|
176 | 140 |
] |
177 | 141 |
)->generate(); |
178 | 142 |
?> |
179 | 143 |
<div class="note note_information"> |
180 | 144 |
<span class="note_content"> |
181 |
- <p>Since the word <span class="word lang_fs">man</span> simply means <span class="word lang_en">human being</span>, it can be understood as an implicit way to express an abstract actor; similar words like <span class="word lang_fs">lüd</span> (<span class="word lang_en">people</span>) or <span class="word lang_fs">di</span> can be used as well.</p> |
|
145 |
+ <p>Since the word <?php echo(mark("man", ["type_word", "lang_fs"])); ?> simply means <?php echo(mark("human being", ["type_word", "lang_en"])); ?>, it can be understood as an implicit way to express an abstract actor; similar words like <?php echo(mark("lüd", ["type_word", "lang_fs"])); ?> (<?php echo(mark("people", ["type_word", "lang_en"])); ?>) or <?php echo(mark("di", ["type_word", "lang_fs"])); ?> can be used as well.</p> |
|
182 | 146 |
</span> |
183 | 147 |
</div> |
184 | 148 |
<div class="note note_information"> |
185 | 149 |
<span class="note_content"> |
186 |
- <p>The honorific salutation is expressed by the plural form <span class="word lang_fs">je</span>; however it should be avoided in usual speech in favor of the singular form <span class="word lang_fs">du</span>.</p> |
|
150 |
+ <p>The honorific salutation is expressed by the plural form <?php echo(mark("je", ["type_word", "lang_fs"])); ?>; however it should be avoided in usual speech in favor of the singular form <?php echo(mark("du", ["type_word", "lang_fs"])); ?>.</p> |
|
187 | 151 |
</span> |
188 | 152 |
</div> |
189 | 153 |
<div class="note note_information"> |
190 | 154 |
<span class="note_content"> |
191 |
- <p>A reflexive genitive can be formed by inserting the word <span class="word lang_fs">egen</span> (<span class="word lang_en">own</span>), for example <span class="sentence lang_fs">Han (A) hav givt to ham (B) hans egen buk.</span> ~ <span class="sentence lang_en">He (A) has given (to) him (B) his own book.</span> (A's book was given to B).</p> |
|
155 |
+ <p>A reflexive genitive can be formed by inserting the word <?php echo(mark("egen", ["word", "lang_fs"])); ?> (<?php echo(mark("own", ["type_word", "lang_en"])); ?>), for example <?php echo(format_correlation("type_sentence")(["fs" => ["Han (A) hav givt to ham (B) hans egen buk."], "en" => ["He (A) has given (to) him (B) his own book."]])); ?> (A's book was given to B).</p> |
|
192 | 156 |
</span> |
193 | 157 |
</div> |
194 | 158 |
<div class="note note_reasoning"> |
... | ... |
@@ -196,7 +160,7 @@ function convert_genus($genus) {return [0 => "common", 1 => "masculine", 2 => "f |
196 | 160 |
<label class="note_label note_label_show" for="note_02">show</label> |
197 | 161 |
<label class="note_label note_label_hide" for="note_02">hide</label> |
198 | 162 |
<span class="note_content"> |
199 |
- <p>When finding appropriate personal pronouns, the most intricate cases were the 3rd person singular and the 2nd person plural; both turned out to be very diverse among the modern Germanic languages. While for the 2nd person plural we could find a sufficient satisfying solution after a while, the 3rd person singular kept defying. In the end we came to the settlement to use a Swedish-like solution including the pronoun <span class="word lang_fs">hen</span>, which is not bound to any sexus so that it can be used for actors in general.</p> |
|
163 |
+ <p>When finding appropriate personal pronouns, the most intricate cases were the 3rd person singular and the 2nd person plural; both turned out to be very diverse among the modern Germanic languages. While for the 2nd person plural we could find a sufficient satisfying solution after a while, the 3rd person singular kept defying. In the end we came to the settlement to use a Swedish-like solution including the pronoun <?php echo(mark("hen", ["type_word", "lang_fs"])); ?>, which is not bound to any sexus so that it can be used for actors in general.</p> |
|
200 | 164 |
</span> |
201 | 165 |
</div> |
202 | 166 |
</section> |
... | ... |
@@ -87,7 +87,7 @@ |
87 | 87 |
?> |
88 | 88 |
<div class="note note_information"> |
89 | 89 |
<span class="note_content"> |
90 |
- <p>It is permitted to pronounce the sounds a little differently, for example <span class="letter lang_fs">v</span> as <span class="ipa">ʋ</span> or <span class="letter lang_fs">s</span> as <span class="ipa">z</span>, whilst the sounds from the table above are the default.</p> |
|
90 |
+ <p>It is permitted to pronounce the sounds a little differently, for example <?php echo(mark("v", ["type_letter", "lang_fs"])); ?> as <span class="ipa">ʋ</span> or <?php echo(mark("s", ["type_letter", "lang_fs"])); ?> as <span class="ipa">z</span>, whilst the sounds from the table above are the default.</p> |
|
91 | 91 |
</span> |
92 | 92 |
</div> |
93 | 93 |
<div class="note note_warning"> |
... | ... |
@@ -100,7 +100,7 @@ |
100 | 100 |
<label class="note_label note_label_show" for="note_00">show</label> |
101 | 101 |
<label class="note_label note_label_hide" for="note_00">hide</label> |
102 | 102 |
<span class="note_content"> |
103 |
- <p>We have discussed many times whether to include a <span class="ipa">x</span>-like sound. On one hand, without it, some words were not easy to derive (e.g. the Proto Germanic <span class="word lang_pg">nahts</span> (English: <span class="word lang_en">night</span>)). On the other hand we found that the sound is very disconcerting to those, who don't have it the phonology of their mother tongue. Eventually we have decided to exclude it from the draft, since it seemed to be too much of a trouble maker; finding words was not that much of an issue in the end.</p> |
|
103 |
+ <p>We have discussed many times whether to include a <span class="ipa">x</span>-like sound. On one hand, without it, some words were not easy to derive (e.g. the Proto Germanic <?php echo(mark("nahts", ["type_word", "lang_pg"])); ?> (English: <?php echo(mark("night", ["type_word", "lang_en"])); ?>)). On the other hand we found that the sound is very disconcerting to those, who don't have it in the phonology of their mother tongue. Eventually we have decided to exclude it from the draft, since it seemed to be too much of a trouble maker; finding words was not that much of an issue in the end.</p> |
|
104 | 104 |
</span> |
105 | 105 |
</div> |
106 | 106 |
<div class="note note_reasoning"> |
... | ... |
@@ -108,8 +108,8 @@ |
108 | 108 |
<label class="note_label note_label_show" for="note_01">show</label> |
109 | 109 |
<label class="note_label note_label_hide" for="note_01">hide</label> |
110 | 110 |
<span class="note_content"> |
111 |
- <p>The letters <span class="letter lang_fs">ö</span> and <span class="letter lang_fs">ü</span> were not included inconsiderately. Factually every Germanic language has an <span class="ipa">ø</span>-like sound in its phonology, but the main reason for the inclusion of these sounds was that altering the vowels of affected words to "near" vowels (e.g. <span class="ipa">i</span> ← <span class="ipa">y</span> → <span class="ipa">u</span>) most of the times resulted in disconcerting and unsatisfying creations. However the modern Germanic languages often feature vowel shifts throughout their natural evolution; some switching to the one and some switching to the other. Therefore we felt is was more convenient to have these sounds as compromises and connectors between the languages.</p> |
|
112 |
- <p>We also struggled to find proper written representations fo these sounds. One possibility was to use the IPA-like symbols <span class="letter lang_fs">ø</span> and <span class="letter lang_fs">y</span>, like e.g. Norwegian does. Unfortunatelly this had taken away the possibility to have the alternative writings <span class="letter lang_fs">oy</span> and <span class="letter lang_fs">uy</span>, which we considered important, since not everybody can easily type non-standard Latin letters. So we arranged to use diaeresis, like German and Swedish does.</p> |
|
111 |
+ <p>The letters <?php echo(mark("ö", ["type_letter", "lang_fs"])); ?> and <?php echo(mark("ü", ["type_letter", "lang_fs"])); ?> were not included inconsiderately. Effectively every Germanic language has an <span class="ipa">ø</span>-like sound in its phonology, but the main reason for the inclusion of these sounds was that altering the vowels of affected words to "near" vowels (e.g. <span class="ipa">i</span> ← <span class="ipa">y</span> → <span class="ipa">u</span>) most of the times resulted in disconcerting and unsatisfying creations. However the modern Germanic languages often feature vowel shifts throughout their natural evolution; some switching to the one and some switching to the other. Therefore we felt it was more convenient to have these sounds as compromises and connectors between the languages.</p> |
|
112 |
+ <p>We also struggled to find proper written representations of these sounds. One possibility was to use the IPA-like symbols <?php echo(mark("ø", ["type_letter", "lang_fs"])); ?> and <?php echo(mark("y", ["type_letter", "lang_fs"])); ?>, like e.g. Norwegian does. Unfortunatelly this had taken away the possibility to have the alternative writings <?php echo(mark("oy", ["type_letter", "lang_fs"])); ?> and <?php echo(mark("uy", ["type_letter", "lang_fs"])); ?>, which we considered important, since not everybody can easily type non-standard Latin letters. So we arranged to use diaeresis, like German and Swedish does.</p> |
|
113 | 113 |
</span> |
114 | 114 |
</div> |
115 | 115 |
</section> |
... | ... |
@@ -1,6 +1,97 @@ |
1 |
+<?php |
|
2 |
+global $configuration; |
|
3 |
+include_once("source/logic/server/data.php"); |
|
4 |
+include_once("source/logic/server/sql.php"); |
|
5 |
+include_once("source/logic/server/table.php"); |
|
6 |
+ ?> |
|
1 | 7 |
<section class="section" id="principles"> |
2 | 8 |
<header>Principles</header> |
3 | 9 |
<p>The word stock of Folksprak is ‐ with minor ‐ exceptions derived from the modern Germanic languages (e.g. English, German, Swedish, …) and/or their precursors (e.g. Old English, Old Norse, Proto Germanic, etc.). However branches, which no longer emerge today (e.g. the East Germanic languages like Gothic), were not incorporated.</p> |
4 |
- <span class="todo">more (e.g. typical transitions)</span> |
|
10 |
+ <p>The following table gives an overview about the typical phoneme-transitions with example words in square brackets:</p> |
|
11 |
+ <span class="todo">more entries</span> |
|
12 |
+<?php |
|
13 |
+ $data_transitions = read_json("source/data/transitions.json"); |
|
14 |
+ |
|
15 |
+ $data = $data_transitions["data"]; |
|
16 |
+ // $data = sql_select($data, function ($row) {return in_array($row["language_id"], ["pg","fs","en"]);}); |
|
17 |
+ |
|
18 |
+ $table = new class_table |
|
19 |
+ ( |
|
20 |
+ [ |
|
21 |
+ new class_column("Transition", "transition_id"), |
|
22 |
+ new class_column("Language", "language_id"), |
|
23 |
+ new class_column("Phonemes", "phonemes"), |
|
24 |
+ new class_column("Examples", "examples"), |
|
25 |
+ ], |
|
26 |
+ $data |
|
27 |
+ ); |
|
28 |
+ |
|
29 |
+ $table->snap |
|
30 |
+ ( |
|
31 |
+ [ |
|
32 |
+ "label_vertical" => function ($column) {return "";}, |
|
33 |
+ "columns_vertical" => |
|
34 |
+ [ |
|
35 |
+ $table->columns_get()[0], |
|
36 |
+ ], |
|
37 |
+ "label_horizontal" => function ($column, $value) {return $value;}, |
|
38 |
+ "columns_horizontal" => |
|
39 |
+ [ |
|
40 |
+ $table->columns_get()[1], |
|
41 |
+ ], |
|
42 |
+ "columns_data" => |
|
43 |
+ [ |
|
44 |
+ $table->columns_get()[1], |
|
45 |
+ $table->columns_get()[2], |
|
46 |
+ $table->columns_get()[3], |
|
47 |
+ ], |
|
48 |
+ "data_aggregator" => function ($values) |
|
49 |
+ { |
|
50 |
+ return $values; |
|
51 |
+ }, |
|
52 |
+ "data_formatter" => function ($values) |
|
53 |
+ { |
|
54 |
+ if (count($values) == 1) |
|
55 |
+ { |
|
56 |
+ $phonemes = implode( |
|
57 |
+ ", ", |
|
58 |
+ array_map |
|
59 |
+ ( |
|
60 |
+ function ($phoneme) use (&$values) |
|
61 |
+ { |
|
62 |
+ return mark($phoneme, ["type_word", "lang_" . $values[0]["language_id"]]); |
|
63 |
+ }, |
|
64 |
+ $values[0]["phonemes"] |
|
65 |
+ ) |
|
66 |
+ ); |
|
67 |
+ $examples = implode |
|
68 |
+ ( |
|
69 |
+ ", ", |
|
70 |
+ array_map |
|
71 |
+ ( |
|
72 |
+ function ($word) use (&$values) |
|
73 |
+ { |
|
74 |
+ return mark($word, ["type_word", "lang_" . $values[0]["language_id"]]); |
|
75 |
+ }, |
|
76 |
+ array_slice($values[0]["examples"], 0, 1) |
|
77 |
+ ) |
|
78 |
+ ); |
|
79 |
+ $output = $phonemes; |
|
80 |
+ if (count($values[0]["examples"]) > 0) |
|
81 |
+ { |
|
82 |
+ $break = true; |
|
83 |
+ $breaker = $break ? "<br/>" : " "; |
|
84 |
+ $output .= "${breaker}[${examples}]"; |
|
85 |
+ } |
|
86 |
+ return $output; |
|
87 |
+ } |
|
88 |
+ else |
|
89 |
+ { |
|
90 |
+ return "?"; |
|
91 |
+ } |
|
92 |
+ }, |
|
93 |
+ ] |
|
94 |
+ )->generate(); |
|
95 |
+ ?> |
|
5 | 96 |
</section> |
6 | 97 |
|
... | ... |
@@ -31,14 +31,14 @@ |
31 | 31 |
"scheme", |
32 | 32 |
function ($value) |
33 | 33 |
{ |
34 |
- return format($value, ["word", "lang_fs"]); |
|
34 |
+ return format($value, ["type_word", "lang_fs"]); |
|
35 | 35 |
} |
36 | 36 |
), |
37 | 37 |
new class_column |
38 | 38 |
( |
39 | 39 |
"Example", |
40 | 40 |
"example_", |
41 |
- _bar("sentence") |
|
41 |
+ _bar("type_sentence") |
|
42 | 42 |
), |
43 | 43 |
], |
44 | 44 |
sql_condense |
... | ... |
@@ -53,8 +53,8 @@ |
53 | 53 |
) |
54 | 54 |
))->generate(); |
55 | 55 |
?> |
56 |
- <p>Since these forms are built with auxiliary verbs, they can be combined straightforward to form complex expressions, e.g. <?php echo(call_user_func(_bar("sentence"), ["original" => ["Ek skal have skrivt."], "translated" => ["I will have written."]])); ?><!-- or <?php echo(call_user_func(_bar("sentence"), ["original" => ["Ek hav skalt skrive."], "translated" => ["I was going to write."]])); ?> -->.</p> |
|
57 |
- <p>The <span class="grammarterm">imperative</span> only exists in the present (with future meaning) for the 2nd person singular and plural. It is formed by using the bare stem of the verb, optionally followed by the personal pronoun (i.e. either <span class="word lang_fs">du</span> or <span class="word lang_fs">je</span>) in order to specify or emphasize the numerus. Examples: <span class="sentence lang_fs">skriv!</span>, <span class="sentence lang_fs">skriv, je!</span>.</p> |
|
56 |
+ <p>Since these forms are built with auxiliary verbs, they can be combined straightforward to form complex expressions, e.g. <?php echo(format_correlation("type_sentence")(["fs" => ["Ek skal have skrivt."], "en" => ["I will have written."]])); ?><!-- or <?php echo(format_correlation("type_sentence")(["fs" => ["Ek hav skalt skrive."], "en" => ["I was going to write."]])); ?> -->.</p> |
|
57 |
+ <p>The <span class="grammarterm">imperative</span> only exists in the present (with future meaning) for the 2nd person singular and plural. It is formed by using the bare stem of the verb, optionally followed by the personal pronoun (i.e. either <?php echo(mark("du", ["type_word", "lang_fs"])); ?> or <?php echo(mark("je", ["type_word", "lang_fs"])); ?>) in order to specify or emphasize the numerus. Examples: <?php echo(mark("skriv!", ["type_sentence", "lang_fs"])); ?>, <?php echo(mark("skriv, je!", ["type_sentence", "lang_fs"])); ?>.</p> |
|
58 | 58 |
<span class="todo">conjunctive</span> |
59 | 59 |
</section> |
60 | 60 |
|
... | ... |
@@ -17,7 +17,7 @@ |
17 | 17 |
"affix", |
18 | 18 |
function ($value) |
19 | 19 |
{ |
20 |
- return mark($value, ["word", "lang_fs"]); |
|
20 |
+ return mark($value, ["type_word", "lang_fs"]); |
|
21 | 21 |
} |
22 | 22 |
), |
23 | 23 |
new class_column |
... | ... |
@@ -70,6 +70,12 @@ |
70 | 70 |
"Example", |
71 | 71 |
"example_", |
72 | 72 |
_bar("word") |
73 |
+ /* |
|
74 |
+ function ($x) |
|
75 |
+ { |
|
76 |
+ return json_encode($x); |
|
77 |
+ } |
|
78 |
+ */ |
|
73 | 79 |
), |
74 | 80 |
], |
75 | 81 |
sql_condense |
... | ... |
@@ -89,10 +95,9 @@ |
89 | 95 |
<p> |
90 | 96 |
Some complex examples: |
91 | 97 |
<ul> |
92 |
- <?php $fun = _bar("word"); ?> |
|
93 |
- <li><?php echo($fun(["original" => ["unmanlikhed"], "translated" => ["inhumanity"]])); ?></li> |
|
94 |
- <li><?php echo($fun(["original" => ["seberenung"], "translated" => ["visualization"]])); ?></li> |
|
95 |
- <li><?php echo($fun(["original" => ["kraftigenar"], "translated" => ["fortifier"]])); ?></li> |
|
98 |
+ <li><?php echo(format_correlation("word")(["fs" => ["unmanlikhed"], "en" => ["inhumanity"]])); ?></li> |
|
99 |
+ <li><?php echo(format_correlation("word")(["fs" => ["seberenung"], "en" => ["visualization"]])); ?></li> |
|
100 |
+ <li><?php echo(format_correlation("word")(["fs" => ["kraftigenar"], "en" => ["fortifier"]])); ?></li> |
|
96 | 101 |
</ul> |
97 | 102 |
</p> |
98 | 103 |
</section> |
... | ... |
@@ -1,126 +1,156 @@ |
1 | 1 |
{ |
2 | 2 |
"situations": [ |
3 |
- {"id": "x00", "name": "x00"}, |
|
4 |
- {"id": "x01", "name": "x01"}, |
|
5 |
- {"id": "x02", "name": "x02"}, |
|
6 |
- {"id": "x03", "name": "x03"}, |
|
7 |
- {"id": "x04", "name": "x04"}, |
|
8 |
- {"id": "x05", "name": "x05"}, |
|
9 |
- {"id": "x06", "name": "x06"}, |
|
10 |
- {"id": "x07", "name": "x07"}, |
|
11 |
- {"id": "x08", "name": "x08"}, |
|
12 |
- {"id": "x09", "name": "x09"} |
|
3 |
+ {"id": "x00", "name": "fore"}, |
|
4 |
+ {"id": "x01", "name": "back"}, |
|
5 |
+ {"id": "x02", "name": "up"}, |
|
6 |
+ {"id": "x03", "name": "down"}, |
|
7 |
+ {"id": "x04", "name": "left"}, |
|
8 |
+ {"id": "x05", "name": "right"}, |
|
9 |
+ {"id": "x06", "name": "in"}, |
|
10 |
+ {"id": "x07", "name": "out"}, |
|
11 |
+ {"id": "x08", "name": "on"}, |
|
12 |
+ {"id": "x09", "name": "between"} |
|
13 | 13 |
], |
14 | 14 |
"types": [ |
15 | 15 |
{"id": "pos", "name": "Positive"}, |
16 | 16 |
{"id": "dir", "name": "Directive"} |
17 | 17 |
], |
18 |
- "kinds": [ |
|
18 |
+ "references": [ |
|
19 | 19 |
{"id": "abs", "name": "Absolute"}, |
20 | 20 |
{"id": "rel", "name": "Relative"}, |
21 | 21 |
{"id": "att", "name": "Attributive"} |
22 | 22 |
], |
23 | 23 |
"words": [ |
24 |
- {"language_id": "fs", "situation_id": "x00", "type_id": "pos", "kind_id": "abs", "words": ["for"]}, |
|
25 |
- {"language_id": "fs", "situation_id": "x00", "type_id": "pos", "kind_id": "rel", "words": ["for (lut)"]}, |
|
26 |
- {"language_id": "fs", "situation_id": "x00", "type_id": "pos", "kind_id": "att", "words": ["for arend"]}, |
|
27 |
- {"language_id": "fs", "situation_id": "x00", "type_id": "dir", "kind_id": "abs", "words": ["to for"]}, |
|
28 |
- {"language_id": "fs", "situation_id": "x00", "type_id": "dir", "kind_id": "rel", "words": ["to for (lut)"]}, |
|
29 |
- {"language_id": "fs", "situation_id": "x01", "type_id": "pos", "kind_id": "abs", "words": ["ruk"]}, |
|
30 |
- {"language_id": "fs", "situation_id": "x01", "type_id": "pos", "kind_id": "rel", "words": ["ruk (lut)"]}, |
|
31 |
- {"language_id": "fs", "situation_id": "x01", "type_id": "pos", "kind_id": "att", "words": ["ruk arend"]}, |
|
32 |
- {"language_id": "fs", "situation_id": "x01", "type_id": "dir", "kind_id": "abs", "words": ["to ruk"]}, |
|
33 |
- {"language_id": "fs", "situation_id": "x01", "type_id": "dir", "kind_id": "rel", "words": ["to ruk (lut)"]}, |
|
34 |
- {"language_id": "fs", "situation_id": "x02", "type_id": "pos", "kind_id": "abs", "words": ["top"]}, |
|
35 |
- {"language_id": "fs", "situation_id": "x02", "type_id": "pos", "kind_id": "rel", "words": ["top (lut)"]}, |
|
36 |
- {"language_id": "fs", "situation_id": "x02", "type_id": "pos", "kind_id": "att", "words": ["top arend"]}, |
|
37 |
- {"language_id": "fs", "situation_id": "x02", "type_id": "dir", "kind_id": "abs", "words": ["to top"]}, |
|
38 |
- {"language_id": "fs", "situation_id": "x02", "type_id": "dir", "kind_id": "rel", "words": ["to top (lut)"]}, |
|
39 |
- {"language_id": "fs", "situation_id": "x03", "type_id": "pos", "kind_id": "abs", "words": ["ned"]}, |
|
40 |
- {"language_id": "fs", "situation_id": "x03", "type_id": "pos", "kind_id": "rel", "words": ["ned (lut)"]}, |
|
41 |
- {"language_id": "fs", "situation_id": "x03", "type_id": "pos", "kind_id": "att", "words": ["ned arend"]}, |
|
42 |
- {"language_id": "fs", "situation_id": "x03", "type_id": "dir", "kind_id": "abs", "words": ["to ned"]}, |
|
43 |
- {"language_id": "fs", "situation_id": "x03", "type_id": "dir", "kind_id": "rel", "words": ["to ned (lut)"]}, |
|
44 |
- {"language_id": "fs", "situation_id": "x04", "type_id": "pos", "kind_id": "abs", "words": ["vinst"]}, |
|
45 |
- {"language_id": "fs", "situation_id": "x04", "type_id": "pos", "kind_id": "rel", "words": ["vinst (lut)"]}, |
|
46 |
- {"language_id": "fs", "situation_id": "x04", "type_id": "pos", "kind_id": "att", "words": ["vinst arend"]}, |
|
47 |
- {"language_id": "fs", "situation_id": "x04", "type_id": "dir", "kind_id": "abs", "words": ["to vinst"]}, |
|
48 |
- {"language_id": "fs", "situation_id": "x04", "type_id": "dir", "kind_id": "rel", "words": ["to vinst (lut)"]}, |
|
49 |
- {"language_id": "fs", "situation_id": "x05", "type_id": "pos", "kind_id": "abs", "words": ["hög"]}, |
|
50 |
- {"language_id": "fs", "situation_id": "x05", "type_id": "pos", "kind_id": "rel", "words": ["hög (lut)"]}, |
|
51 |
- {"language_id": "fs", "situation_id": "x05", "type_id": "pos", "kind_id": "att", "words": ["hög arend"]}, |
|
52 |
- {"language_id": "fs", "situation_id": "x05", "type_id": "dir", "kind_id": "abs", "words": ["to hög"]}, |
|
53 |
- {"language_id": "fs", "situation_id": "x05", "type_id": "dir", "kind_id": "rel", "words": ["to hög (lut)"]}, |
|
54 |
- {"language_id": "fs", "situation_id": "x06", "type_id": "pos", "kind_id": "abs", "words": ["ine"]}, |
|
55 |
- {"language_id": "fs", "situation_id": "x06", "type_id": "pos", "kind_id": "rel", "words": ["ine (lut)"]}, |
|
56 |
- {"language_id": "fs", "situation_id": "x06", "type_id": "pos", "kind_id": "att", "words": ["ine arend"]}, |
|
57 |
- {"language_id": "fs", "situation_id": "x06", "type_id": "dir", "kind_id": "abs", "words": ["in"]}, |
|
58 |
- {"language_id": "fs", "situation_id": "x06", "type_id": "dir", "kind_id": "rel", "words": ["in (lut)"]}, |
|
59 |
- {"language_id": "fs", "situation_id": "x07", "type_id": "pos", "kind_id": "abs", "words": ["ute"]}, |
|
60 |
- {"language_id": "fs", "situation_id": "x07", "type_id": "pos", "kind_id": "rel", "words": ["ute (lut)"]}, |
|
61 |
- {"language_id": "fs", "situation_id": "x07", "type_id": "pos", "kind_id": "att", "words": ["ute arend"]}, |
|
62 |
- {"language_id": "fs", "situation_id": "x07", "type_id": "dir", "kind_id": "abs", "words": ["ut"]}, |
|
63 |
- {"language_id": "fs", "situation_id": "x07", "type_id": "dir", "kind_id": "rel", "words": ["ut (lut)"]}, |
|
64 |
- {"language_id": "fs", "situation_id": "x08", "type_id": "pos", "kind_id": "abs", "words": ["upe"]}, |
|
65 |
- {"language_id": "fs", "situation_id": "x08", "type_id": "pos", "kind_id": "rel", "words": ["upe (lut)"]}, |
|
66 |
- {"language_id": "fs", "situation_id": "x08", "type_id": "pos", "kind_id": "att", "words": ["upe arend"]}, |
|
67 |
- {"language_id": "fs", "situation_id": "x08", "type_id": "dir", "kind_id": "abs", "words": ["up"]}, |
|
68 |
- {"language_id": "fs", "situation_id": "x08", "type_id": "dir", "kind_id": "rel", "words": ["up (lut)"]}, |
|
69 |
- {"language_id": "fs", "situation_id": "x09", "type_id": "pos", "kind_id": "abs", "words": ["mel"]}, |
|
70 |
- {"language_id": "fs", "situation_id": "x09", "type_id": "pos", "kind_id": "rel", "words": ["mel (lut)"]}, |
|
71 |
- {"language_id": "fs", "situation_id": "x09", "type_id": "pos", "kind_id": "att", "words": ["mel arend"]}, |
|
72 |
- {"language_id": "fs", "situation_id": "x09", "type_id": "dir", "kind_id": "abs", "words": ["to mel"]}, |
|
73 |
- {"language_id": "fs", "situation_id": "x09", "type_id": "dir", "kind_id": "rel", "words": ["to mel (lut)"]}, |
|
74 |
- {"language_id": "en", "situation_id": "x00", "type_id": "pos", "kind_id": "abs", "words": ["in front"]}, |
|
75 |
- {"language_id": "en", "situation_id": "x00", "type_id": "pos", "kind_id": "rel", "words": ["in front of"]}, |
|
76 |
- {"language_id": "en", "situation_id": "x00", "type_id": "pos", "kind_id": "att", "words": ["fore", "front"]}, |
|
77 |
- {"language_id": "en", "situation_id": "x00", "type_id": "dir", "kind_id": "abs", "words": ["forward"]}, |
|
78 |
- {"language_id": "en", "situation_id": "x00", "type_id": "dir", "kind_id": "rel", "words": ["in front of"]}, |
|
79 |
- {"language_id": "en", "situation_id": "x01", "type_id": "pos", "kind_id": "abs", "words": ["back"]}, |
|
80 |
- {"language_id": "en", "situation_id": "x01", "type_id": "pos", "kind_id": "rel", "words": ["behind"]}, |
|
81 |
- {"language_id": "en", "situation_id": "x01", "type_id": "pos", "kind_id": "att", "words": ["rear", "hind"]}, |
|
82 |
- {"language_id": "en", "situation_id": "x01", "type_id": "dir", "kind_id": "abs", "words": ["backward", "behind"]}, |
|
83 |
- {"language_id": "en", "situation_id": "x01", "type_id": "dir", "kind_id": "rel", "words": ["behind"]}, |
|
84 |
- {"language_id": "en", "situation_id": "x02", "type_id": "pos", "kind_id": "abs", "words": ["on top"]}, |
|
85 |
- {"language_id": "en", "situation_id": "x02", "type_id": "pos", "kind_id": "rel", "words": ["over", "above"]}, |
|
86 |
- {"language_id": "en", "situation_id": "x02", "type_id": "pos", "kind_id": "att", "words": ["upper"]}, |
|
87 |
- {"language_id": "en", "situation_id": "x02", "type_id": "dir", "kind_id": "abs", "words": ["up"]}, |
|
88 |
- {"language_id": "en", "situation_id": "x02", "type_id": "dir", "kind_id": "rel", "words": ["over", "above"]}, |
|
89 |
- {"language_id": "en", "situation_id": "x03", "type_id": "pos", "kind_id": "abs", "words": ["below"]}, |
|
90 |
- {"language_id": "en", "situation_id": "x03", "type_id": "pos", "kind_id": "rel", "words": ["under"]}, |
|
91 |
- {"language_id": "en", "situation_id": "x03", "type_id": "pos", "kind_id": "att", "words": ["lower"]}, |
|
92 |
- {"language_id": "en", "situation_id": "x03", "type_id": "dir", "kind_id": "abs", "words": ["down"]}, |
|
93 |
- {"language_id": "en", "situation_id": "x03", "type_id": "dir", "kind_id": "rel", "words": ["under"]}, |
|
94 |
- {"language_id": "en", "situation_id": "x04", "type_id": "pos", "kind_id": "abs", "words": ["left"]}, |
|
95 |
- {"language_id": "en", "situation_id": "x04", "type_id": "pos", "kind_id": "rel", "words": ["left from"]}, |
|
96 |
- {"language_id": "en", "situation_id": "x04", "type_id": "pos", "kind_id": "att", "words": ["left"]}, |
|
97 |
- {"language_id": "en", "situation_id": "x04", "type_id": "dir", "kind_id": "abs", "words": ["to the left"]}, |
|
98 |
- {"language_id": "en", "situation_id": "x04", "type_id": "dir", "kind_id": "rel", "words": ["to the left of"]}, |
|
99 |
- {"language_id": "en", "situation_id": "x05", "type_id": "pos", "kind_id": "abs", "words": ["right"]}, |
|
100 |
- {"language_id": "en", "situation_id": "x05", "type_id": "pos", "kind_id": "rel", "words": ["right from"]}, |
|
101 |
- {"language_id": "en", "situation_id": "x05", "type_id": "pos", "kind_id": "att", "words": ["right"]}, |
|
102 |
- {"language_id": "en", "situation_id": "x05", "type_id": "dir", "kind_id": "abs", "words": ["to the right"]}, |
|
103 |
- {"language_id": "en", "situation_id": "x05", "type_id": "dir", "kind_id": "rel", "words": ["to the right of"]}, |
|
104 |
- {"language_id": "en", "situation_id": "x06", "type_id": "pos", "kind_id": "abs", "words": ["inside"]}, |
|
105 |
- {"language_id": "en", "situation_id": "x06", "type_id": "pos", "kind_id": "rel", "words": ["in", "inside from"]}, |
|
106 |
- {"language_id": "en", "situation_id": "x06", "type_id": "pos", "kind_id": "att", "words": ["inner"]}, |
|
107 |
- {"language_id": "en", "situation_id": "x06", "type_id": "dir", "kind_id": "abs", "words": ["in"]}, |
|
108 |
- {"language_id": "en", "situation_id": "x06", "type_id": "dir", "kind_id": "rel", "words": ["into"]}, |
|
109 |
- {"language_id": "en", "situation_id": "x07", "type_id": "pos", "kind_id": "abs", "words": ["outside"]}, |
|
110 |
- {"language_id": "en", "situation_id": "x07", "type_id": "pos", "kind_id": "rel", "words": ["out", "outside from"]}, |
|
111 |
- {"language_id": "en", "situation_id": "x07", "type_id": "pos", "kind_id": "att", "words": ["outer"]}, |
|
112 |
- {"language_id": "en", "situation_id": "x07", "type_id": "dir", "kind_id": "abs", "words": ["out"]}, |
|
113 |
- {"language_id": "en", "situation_id": "x07", "type_id": "dir", "kind_id": "rel", "words": ["out of"]}, |
|
114 |
- {"language_id": "en", "situation_id": "x08", "type_id": "pos", "kind_id": "abs", "words": ["upon"]}, |
|
115 |
- {"language_id": "en", "situation_id": "x08", "type_id": "pos", "kind_id": "rel", "words": ["thereon"]}, |
|
116 |
- {"language_id": "en", "situation_id": "x08", "type_id": "pos", "kind_id": "att", "words": []}, |
|
117 |
- {"language_id": "en", "situation_id": "x08", "type_id": "dir", "kind_id": "abs", "words": ["on"]}, |
|
118 |
- {"language_id": "en", "situation_id": "x08", "type_id": "dir", "kind_id": "rel", "words": ["onto"]}, |
|
119 |
- {"language_id": "en", "situation_id": "x09", "type_id": "pos", "kind_id": "abs", "words": ["inbetween"]}, |
|
120 |
- {"language_id": "en", "situation_id": "x09", "type_id": "pos", "kind_id": "rel", "words": ["between"]}, |
|
121 |
- {"language_id": "en", "situation_id": "x09", "type_id": "pos", "kind_id": "att", "words": ["middle"]}, |
|
122 |
- {"language_id": "en", "situation_id": "x09", "type_id": "dir", "kind_id": "abs", "words": ["between"]}, |
|
123 |
- {"language_id": "en", "situation_id": "x09", "type_id": "dir", "kind_id": "rel", "words": ["between"]} |
|
24 |
+ {"language_id": "fs", "situation_id": "x00", "type_id": "pos", "reference_id": "abs", "words": ["for"]}, |
|
25 |
+ {"language_id": "fs", "situation_id": "x00", "type_id": "pos", "reference_id": "rel", "words": ["for (lut)"]}, |
|
26 |
+ {"language_id": "fs", "situation_id": "x00", "type_id": "pos", "reference_id": "att", "words": ["for arend"]}, |
|
27 |
+ {"language_id": "fs", "situation_id": "x00", "type_id": "dir", "reference_id": "abs", "words": ["to for"]}, |
|
28 |
+ {"language_id": "fs", "situation_id": "x00", "type_id": "dir", "reference_id": "rel", "words": ["to for (lut)"]}, |
|
29 |
+ {"language_id": "fs", "situation_id": "x01", "type_id": "pos", "reference_id": "abs", "words": ["bak"]}, |
|
30 |
+ {"language_id": "fs", "situation_id": "x01", "type_id": "pos", "reference_id": "rel", "words": ["bak (lut)"]}, |
|
31 |
+ {"language_id": "fs", "situation_id": "x01", "type_id": "pos", "reference_id": "att", "words": ["bak arend"]}, |
|
32 |
+ {"language_id": "fs", "situation_id": "x01", "type_id": "dir", "reference_id": "abs", "words": ["to bak"]}, |
|
33 |
+ {"language_id": "fs", "situation_id": "x01", "type_id": "dir", "reference_id": "rel", "words": ["to bak (lut)"]}, |
|
34 |
+ {"language_id": "fs", "situation_id": "x02", "type_id": "pos", "reference_id": "abs", "words": ["uver"]}, |
|
35 |
+ {"language_id": "fs", "situation_id": "x02", "type_id": "pos", "reference_id": "rel", "words": ["uver (lut)"]}, |
|
36 |
+ {"language_id": "fs", "situation_id": "x02", "type_id": "pos", "reference_id": "att", "words": ["uver arend"]}, |
|
37 |
+ {"language_id": "fs", "situation_id": "x02", "type_id": "dir", "reference_id": "abs", "words": ["to uver"]}, |
|
38 |
+ {"language_id": "fs", "situation_id": "x02", "type_id": "dir", "reference_id": "rel", "words": ["to uver (lut)"]}, |
|
39 |
+ {"language_id": "fs", "situation_id": "x03", "type_id": "pos", "reference_id": "abs", "words": ["neder"]}, |
|
40 |
+ {"language_id": "fs", "situation_id": "x03", "type_id": "pos", "reference_id": "rel", "words": ["neder (lut)"]}, |
|
41 |
+ {"language_id": "fs", "situation_id": "x03", "type_id": "pos", "reference_id": "att", "words": ["neder arend"]}, |
|
42 |
+ {"language_id": "fs", "situation_id": "x03", "type_id": "dir", "reference_id": "abs", "words": ["to neder"]}, |
|
43 |
+ {"language_id": "fs", "situation_id": "x03", "type_id": "dir", "reference_id": "rel", "words": ["to neder (lut)"]}, |
|
44 |
+ {"language_id": "fs", "situation_id": "x04", "type_id": "pos", "reference_id": "abs", "words": ["vinst"]}, |
|
45 |
+ {"language_id": "fs", "situation_id": "x04", "type_id": "pos", "reference_id": "rel", "words": ["vinst (lut)"]}, |
|
46 |
+ {"language_id": "fs", "situation_id": "x04", "type_id": "pos", "reference_id": "att", "words": ["vinst arend"]}, |
|
47 |
+ {"language_id": "fs", "situation_id": "x04", "type_id": "dir", "reference_id": "abs", "words": ["to vinst"]}, |
|
48 |
+ {"language_id": "fs", "situation_id": "x04", "type_id": "dir", "reference_id": "rel", "words": ["to vinst (lut)"]}, |
|
49 |
+ {"language_id": "fs", "situation_id": "x05", "type_id": "pos", "reference_id": "abs", "words": ["hög"]}, |
|
50 |
+ {"language_id": "fs", "situation_id": "x05", "type_id": "pos", "reference_id": "rel", "words": ["hög (lut)"]}, |
|
51 |
+ {"language_id": "fs", "situation_id": "x05", "type_id": "pos", "reference_id": "att", "words": ["hög arend"]}, |
|
52 |
+ {"language_id": "fs", "situation_id": "x05", "type_id": "dir", "reference_id": "abs", "words": ["to hög"]}, |
|
53 |
+ {"language_id": "fs", "situation_id": "x05", "type_id": "dir", "reference_id": "rel", "words": ["to hög (lut)"]}, |
|
54 |
+ {"language_id": "fs", "situation_id": "x06", "type_id": "pos", "reference_id": "abs", "words": ["ine"]}, |
|
55 |
+ {"language_id": "fs", "situation_id": "x06", "type_id": "pos", "reference_id": "rel", "words": ["ine (lut)"]}, |
|
56 |
+ {"language_id": "fs", "situation_id": "x06", "type_id": "pos", "reference_id": "att", "words": ["ine arend"]}, |
|
57 |
+ {"language_id": "fs", "situation_id": "x06", "type_id": "dir", "reference_id": "abs", "words": ["in"]}, |
|
58 |
+ {"language_id": "fs", "situation_id": "x06", "type_id": "dir", "reference_id": "rel", "words": ["in (lut)"]}, |
|
59 |
+ {"language_id": "fs", "situation_id": "x07", "type_id": "pos", "reference_id": "abs", "words": ["ute"]}, |
|
60 |
+ {"language_id": "fs", "situation_id": "x07", "type_id": "pos", "reference_id": "rel", "words": ["ute (lut)"]}, |
|
61 |
+ {"language_id": "fs", "situation_id": "x07", "type_id": "pos", "reference_id": "att", "words": ["ute arend"]}, |
|
62 |
+ {"language_id": "fs", "situation_id": "x07", "type_id": "dir", "reference_id": "abs", "words": ["ut"]}, |
|
63 |
+ {"language_id": "fs", "situation_id": "x07", "type_id": "dir", "reference_id": "rel", "words": ["ut (lut)"]}, |
|
64 |
+ {"language_id": "fs", "situation_id": "x08", "type_id": "pos", "reference_id": "abs", "words": ["upe"]}, |
|
65 |
+ {"language_id": "fs", "situation_id": "x08", "type_id": "pos", "reference_id": "rel", "words": ["upe (lut)"]}, |
|
66 |
+ {"language_id": "fs", "situation_id": "x08", "type_id": "pos", "reference_id": "att", "words": ["upe arend"]}, |
|
67 |
+ {"language_id": "fs", "situation_id": "x08", "type_id": "dir", "reference_id": "abs", "words": ["up"]}, |
|
68 |
+ {"language_id": "fs", "situation_id": "x08", "type_id": "dir", "reference_id": "rel", "words": ["up (lut)"]}, |
|
69 |
+ {"language_id": "fs", "situation_id": "x09", "type_id": "pos", "reference_id": "abs", "words": ["mel"]}, |
|
70 |
+ {"language_id": "fs", "situation_id": "x09", "type_id": "pos", "reference_id": "rel", "words": ["mel (lut)"]}, |
|
71 |
+ {"language_id": "fs", "situation_id": "x09", "type_id": "pos", "reference_id": "att", "words": ["mel arend"]}, |
|
72 |
+ {"language_id": "fs", "situation_id": "x09", "type_id": "dir", "reference_id": "abs", "words": ["to mel"]}, |
|
73 |
+ {"language_id": "fs", "situation_id": "x09", "type_id": "dir", "reference_id": "rel", "words": ["to mel (lut)"]}, |
|
74 |
+ {"language_id": "en", "situation_id": "x00", "type_id": "pos", "reference_id": "abs", "words": ["in front"]}, |
|
75 |
+ {"language_id": "en", "situation_id": "x00", "type_id": "pos", "reference_id": "rel", "words": ["in front of"]}, |
|
76 |
+ {"language_id": "en", "situation_id": "x00", "type_id": "pos", "reference_id": "att", "words": ["fore", "front"]}, |
|
77 |
+ {"language_id": "en", "situation_id": "x00", "type_id": "dir", "reference_id": "abs", "words": ["forward"]}, |
|
78 |
+ {"language_id": "en", "situation_id": "x00", "type_id": "dir", "reference_id": "rel", "words": ["in front of"]}, |
|
79 |
+ {"language_id": "en", "situation_id": "x01", "type_id": "pos", "reference_id": "abs", "words": ["back"]}, |
|
80 |
+ {"language_id": "en", "situation_id": "x01", "type_id": "pos", "reference_id": "rel", "words": ["behind"]}, |
|
81 |
+ {"language_id": "en", "situation_id": "x01", "type_id": "pos", "reference_id": "att", "words": ["rear", "hind"]}, |
|
82 |
+ {"language_id": "en", "situation_id": "x01", "type_id": "dir", "reference_id": "abs", "words": ["backward", "behind"]}, |
|
83 |
+ {"language_id": "en", "situation_id": "x01", "type_id": "dir", "reference_id": "rel", "words": ["behind"]}, |
|
84 |
+ {"language_id": "en", "situation_id": "x02", "type_id": "pos", "reference_id": "abs", "words": ["on top"]}, |
|
85 |
+ {"language_id": "en", "situation_id": "x02", "type_id": "pos", "reference_id": "rel", "words": ["over", "above"]}, |
|
86 |
+ {"language_id": "en", "situation_id": "x02", "type_id": "pos", "reference_id": "att", "words": ["upper"]}, |
|
87 |
+ {"language_id": "en", "situation_id": "x02", "type_id": "dir", "reference_id": "abs", "words": ["up"]}, |
|
88 |
+ {"language_id": "en", "situation_id": "x02", "type_id": "dir", "reference_id": "rel", "words": ["over", "above"]}, |
|
89 |
+ {"language_id": "en", "situation_id": "x03", "type_id": "pos", "reference_id": "abs", "words": ["below"]}, |
|
90 |
+ {"language_id": "en", "situation_id": "x03", "type_id": "pos", "reference_id": "rel", "words": ["under"]}, |
|
91 |
+ {"language_id": "en", "situation_id": "x03", "type_id": "pos", "reference_id": "att", "words": ["lower"]}, |
|
92 |
+ {"language_id": "en", "situation_id": "x03", "type_id": "dir", "reference_id": "abs", "words": ["down"]}, |
|
93 |
+ {"language_id": "en", "situation_id": "x03", "type_id": "dir", "reference_id": "rel", "words": ["under"]}, |
|
94 |
+ {"language_id": "en", "situation_id": "x04", "type_id": "pos", "reference_id": "abs", "words": ["left"]}, |
|
95 |
+ {"language_id": "en", "situation_id": "x04", "type_id": "pos", "reference_id": "rel", "words": ["left from"]}, |
|
96 |
+ {"language_id": "en", "situation_id": "x04", "type_id": "pos", "reference_id": "att", "words": ["left"]}, |
|
97 |
+ {"language_id": "en", "situation_id": "x04", "type_id": "dir", "reference_id": "abs", "words": ["to the left"]}, |
|
98 |
+ {"language_id": "en", "situation_id": "x04", "type_id": "dir", "reference_id": "rel", "words": ["to the left of"]}, |
|
99 |
+ {"language_id": "en", "situation_id": "x05", "type_id": "pos", "reference_id": "abs", "words": ["right"]}, |
|
100 |
+ {"language_id": "en", "situation_id": "x05", "type_id": "pos", "reference_id": "rel", "words": ["right from"]}, |
|
101 |
+ {"language_id": "en", "situation_id": "x05", "type_id": "pos", "reference_id": "att", "words": ["right"]}, |
|
102 |
+ {"language_id": "en", "situation_id": "x05", "type_id": "dir", "reference_id": "abs", "words": ["to the right"]}, |
|
103 |
+ {"language_id": "en", "situation_id": "x05", "type_id": "dir", "reference_id": "rel", "words": ["to the right of"]}, |
|
104 |
+ {"language_id": "en", "situation_id": "x06", "type_id": "pos", "reference_id": "abs", "words": ["inside"]}, |
|
105 |
+ {"language_id": "en", "situation_id": "x06", "type_id": "pos", "reference_id": "rel", "words": ["in", "inside from"]}, |
|
106 |
+ {"language_id": "en", "situation_id": "x06", "type_id": "pos", "reference_id": "att", "words": ["inner"]}, |
|
107 |
+ {"language_id": "en", "situation_id": "x06", "type_id": "dir", "reference_id": "abs", "words": ["in"]}, |
|
108 |
+ {"language_id": "en", "situation_id": "x06", "type_id": "dir", "reference_id": "rel", "words": ["into"]}, |
|
109 |
+ {"language_id": "en", "situation_id": "x07", "type_id": "pos", "reference_id": "abs", "words": ["outside"]}, |
|
110 |
+ {"language_id": "en", "situation_id": "x07", "type_id": "pos", "reference_id": "rel", "words": ["out", "outside from"]}, |
|
111 |
+ {"language_id": "en", "situation_id": "x07", "type_id": "pos", "reference_id": "att", "words": ["outer"]}, |
|
112 |
+ {"language_id": "en", "situation_id": "x07", "type_id": "dir", "reference_id": "abs", "words": ["out"]}, |
|
113 |
+ {"language_id": "en", "situation_id": "x07", "type_id": "dir", "reference_id": "rel", "words": ["out of"]}, |
|
114 |
+ {"language_id": "en", "situation_id": "x08", "type_id": "pos", "reference_id": "abs", "words": ["upon"]}, |
|
115 |
+ {"language_id": "en", "situation_id": "x08", "type_id": "pos", "reference_id": "rel", "words": ["thereon"]}, |
|
116 |
+ {"language_id": "en", "situation_id": "x08", "type_id": "pos", "reference_id": "att", "words": []}, |
|
117 |
+ {"language_id": "en", "situation_id": "x08", "type_id": "dir", "reference_id": "abs", "words": ["on"]}, |
|
118 |
+ {"language_id": "en", "situation_id": "x08", "type_id": "dir", "reference_id": "rel", "words": ["onto"]}, |
|
119 |
+ {"language_id": "en", "situation_id": "x09", "type_id": "pos", "reference_id": "abs", "words": ["inbetween"]}, |
|
120 |
+ {"language_id": "en", "situation_id": "x09", "type_id": "pos", "reference_id": "rel", "words": ["between"]}, |
|
121 |
+ {"language_id": "en", "situation_id": "x09", "type_id": "pos", "reference_id": "att", "words": ["middle"]}, |
|
122 |
+ {"language_id": "en", "situation_id": "x09", "type_id": "dir", "reference_id": "abs", "words": ["between"]}, |
|
123 |
+ {"language_id": "en", "situation_id": "x09", "type_id": "dir", "reference_id": "rel", "words": ["between"]}, |
|
124 |
+ {"language_id": "de", "situation_id": "x00", "type_id": "pos", "reference_id": "abs", "words": ["vorn(e)"]}, |
|
125 |
+ {"language_id": "de", "situation_id": "x00", "type_id": "pos", "reference_id": "rel", "words": ["vor (+dat.)"]}, |
|
126 |
+ {"language_id": "de", "situation_id": "x00", "type_id": "pos", "reference_id": "att", "words": ["vorder-er/e/es"]}, |
|
127 |
+ {"language_id": "de", "situation_id": "x00", "type_id": "dir", "reference_id": "abs", "words": ["vor","nach vorn"]}, |
|
128 |
+ {"language_id": "de", "situation_id": "x00", "type_id": "dir", "reference_id": "rel", "words": ["vor (+acc.)"]}, |
|
129 |
+ {"language_id": "de", "situation_id": "x01", "type_id": "pos", "reference_id": "abs", "words": ["hinten"]}, |
|
130 |
+ {"language_id": "de", "situation_id": "x01", "type_id": "pos", "reference_id": "rel", "words": ["hinter (+dat.)"]}, |
|
131 |
+ {"language_id": "de", "situation_id": "x01", "type_id": "pos", "reference_id": "att", "words": ["hinter-er/e/es"]}, |
|
132 |
+ {"language_id": "de", "situation_id": "x01", "type_id": "dir", "reference_id": "abs", "words": ["hinter","nach hinten"]}, |
|
133 |
+ {"language_id": "de", "situation_id": "x01", "type_id": "dir", "reference_id": "rel", "words": ["hinter (+acc.)"]}, |
|
134 |
+ {"language_id": "de", "situation_id": "x02", "type_id": "pos", "reference_id": "abs", "words": ["oben"]}, |
|
135 |
+ {"language_id": "de", "situation_id": "x02", "type_id": "pos", "reference_id": "rel", "words": ["über (+dat.)"]}, |
|
136 |
+ {"language_id": "de", "situation_id": "x02", "type_id": "pos", "reference_id": "att", "words": ["ober-er/e/es"]}, |
|
137 |
+ {"language_id": "de", "situation_id": "x02", "type_id": "dir", "reference_id": "abs", "words": ["hoch","nach oben"]}, |
|
138 |
+ {"language_id": "de", "situation_id": "x02", "type_id": "dir", "reference_id": "rel", "words": ["über (+acc.)"]}, |
|
139 |
+ {"language_id": "de", "situation_id": "x03", "type_id": "pos", "reference_id": "abs", "words": ["unten"]}, |
|
140 |
+ {"language_id": "de", "situation_id": "x03", "type_id": "pos", "reference_id": "rel", "words": ["unter (+dat.)"]}, |
|
141 |
+ {"language_id": "de", "situation_id": "x03", "type_id": "pos", "reference_id": "att", "words": ["unter-er/e/es"]}, |
|
142 |
+ {"language_id": "de", "situation_id": "x03", "type_id": "dir", "reference_id": "abs", "words": ["(hin-/her-)unter","nach unten"]}, |
|
143 |
+ {"language_id": "de", "situation_id": "x03", "type_id": "dir", "reference_id": "rel", "words": ["unter (+acc.)"]}, |
|
144 |
+ {"language_id": "de", "situation_id": "x02", "type_id": "pos", "reference_id": "abs", "words": ["links"]}, |
|
145 |
+ {"language_id": "de", "situation_id": "x02", "type_id": "pos", "reference_id": "rel", "words": ["links von (+dat.)"]}, |
|
146 |
+ {"language_id": "de", "situation_id": "x02", "type_id": "pos", "reference_id": "att", "words": ["link-er/e/es"]}, |
|
147 |
+ {"language_id": "de", "situation_id": "x02", "type_id": "dir", "reference_id": "abs", "words": ["nach links"]}, |
|
148 |
+ {"language_id": "de", "situation_id": "x02", "type_id": "dir", "reference_id": "rel", "words": []}, |
|
149 |
+ {"language_id": "de", "situation_id": "x02", "type_id": "pos", "reference_id": "abs", "words": ["rechts"]}, |
|
150 |
+ {"language_id": "de", "situation_id": "x02", "type_id": "pos", "reference_id": "rel", "words": ["rechts von (+dat.)"]}, |
|
151 |
+ {"language_id": "de", "situation_id": "x02", "type_id": "pos", "reference_id": "att", "words": ["recht-er/e/es"]}, |
|
152 |
+ {"language_id": "de", "situation_id": "x02", "type_id": "dir", "reference_id": "abs", "words": ["nach rechts"]}, |
|
153 |
+ {"language_id": "de", "situation_id": "x02", "type_id": "dir", "reference_id": "rel", "words": []} |
|
124 | 154 |
] |
125 | 155 |
} |
126 | 156 |
|
... | ... |
@@ -54,7 +54,7 @@ |
54 | 54 |
"runic": "'ᚷ'", |
55 | 55 |
"remark": null, |
56 | 56 |
"examples": { |
57 |
- "fs": "'_g_oa'", |
|
57 |
+ "fs": "'_g_ud'", |
|
58 | 58 |
"en": "'_g_olf'", |
59 | 59 |
"de": "'_G_eist'" |
60 | 60 |
} |
... | ... |
@@ -66,7 +66,7 @@ |
66 | 66 |
"runic": "'ᚲ'", |
67 | 67 |
"remark": null, |
68 | 68 |
"examples": { |
69 |
- "fs": "'_k_an'", |
|
69 |
+ "fs": "'_k_ome'", |
|
70 | 70 |
"en": "'_k_ilo'", |
71 | 71 |
"de": "'_K_uss'" |
72 | 72 |
} |
... | ... |
@@ -78,7 +78,7 @@ |
78 | 78 |
"runic": "'ᛒ'", |
79 | 79 |
"remark": null, |
80 | 80 |
"examples": { |
81 |
- "fs": "'_b_ua'", |
|
81 |
+ "fs": "'_b_ue'", |
|
82 | 82 |
"en": "'_b_ravo'", |
83 | 83 |
"de": "'_B_ahn'" |
84 | 84 |
} |
... | ... |
@@ -90,7 +90,7 @@ |
90 | 90 |
"runic": "'ᛈ'", |
91 | 91 |
"remark": null, |
92 | 92 |
"examples": { |
93 |
- "fs": "'di_p_'", |
|
93 |
+ "fs": "'ru_p_'", |
|
94 | 94 |
"en": "'_p_apa'", |
95 | 95 |
"de": "'_P_ark'" |
96 | 96 |
} |
... | ... |
@@ -147,7 +147,7 @@ |
147 | 147 |
"type": "fricative", |
148 | 148 |
"ipa": "/s/", |
149 | 149 |
"latin": "'S'/'s'", |
150 |
- "runic": "'ᛋ'", |
|
150 |
+ "runic": "'ᛊ'", |
|
151 | 151 |
"remark": null, |
152 | 152 |
"examples": { |
153 | 153 |
"fs": "'_s_mal'", |
... | ... |
@@ -0,0 +1,15 @@ |
1 |
+{ |
|
2 |
+ "de_grot_diktator": { |
|
3 |
+ "title": "De grot diktator", |
|
4 |
+ "paragraphs": [ |
|
5 |
+ "Ek bid fur fargiving, dok ek vil nit are de verlds herskar — ek ar nit solk en man. Ek vil nit beherske odar neddrüke et man, insted ek vil helpe de maner alvan and alvar: De judisk, de hejdisk, de fargig, de vit, …. Vi al skal helpe en de ander fur at vi kön leve ine en beter verld. Vi vil nit hate odar farakte us. Dis verld hav plats fur al maner and ur erd ar so rik, at vi al kön spise nok. De levrid kön are so fri and skön; dok vi hav farlatet de veg.", |
|
6 |
+ "Gridhed hav sükent de maners seler and hav fült de verld med hatrid; hit hav ledet us to elend and blutsketrid. Vi hav utvikelt raskhed, dok ur gester stan stil. Vi lat makiner verke fur us; ur vetrid hav makt us hokmudig and ur klughed hard and unfrendlik; vi denk altu mang and föl altu lit. Dok mer den makiner vi treng manlikhed; mer den klughed vi treng frendlikhed and gudhed. An dis egenheder, ur levrid ar frükridig and al ding ar lost.", |
|
7 |
+ "Med de helprid av flügtüger and de radio vi ar narer en to de ander den et tid ruk. De manskap treng enhed and en alvar arend bruderlikhed fur tu bruke dis utfindinger gud. Selv no mang tused in der verld kön höre min stem, mang tusend fartvivelt verer, kviner and smal kinder — ofaringer av en sistem, vilk fang and kvel unskuldig maner. Ek rup to al, vilk kön hör mek no: Fartvivel nit! De elend skal farsvinde, van de gridhed farsvind and de biterhed av maner, vilk frük de manskaps forskritrid. De Maners hatrid skal farsvinde and diktarorer skal döe. Dan de kraft, vilk di hav takt fra de folk, skal kome bak to de folk. Selv ef mang blud ar sketet: Tu kempe fur de frihed ar en gud sak.", |
|
8 |
+ "Kemparer: Kemp nit fur tiraner; maner, vilk farakt ju and mak ju to sklaver; vilk vertskat nit jer levrid, vilk seg to ju, vat je skal make, true and föle! Di skend ju, föd ju, behandel ju lik kanon-föding. Kemp nit fur dis fardervt maner — makin-maner med makin-hövder and makin-herter! Je ar nit makiner, je ar nit direr, je ar maner. Lat de manlikhed blive ine jer herter! Je skal nit hate; bar de unlivt hat, de unlivt and de fardervt.", |
|
9 |
+ "Kemperar: Kemp nit fur de sklavskap! Kemp fur de frihed! Ine de 17. avsniding av de hajlig Lukas ar skrivt: ‚God ar ine al maner.‘ — nit bar ine en grup av maner, insted ine al maner, ine ju. Je, de folk, hav de kraft; de kraft fur tu bue vapener, dok ok de kraft fur tu sprede gladhed. Je, de folk, hav de kraft fur tu make dis levrid fri and skön, fur tu make dis levrid en vunderfült sak. Darfur: Ine de nam av folkherskrid: Lat us bruke dis kraft! Lat us verde en! Lat us kempe fur en nü verld, fur en beter verld, vilk giv to de maner magrid tu verke, vilk giv en eftertid to de jung and sikerhed to de eld. Ok de tiraner hav truent dis to us fur tu foe de vold, dok di hav lügt. Di mak nit sant dir luving, di vil ni tid. Tiraner frien bar dim selv, dok de folk skal blive sklaver.", |
|
10 |
+ "Lat us no kempe fur tu upfüle dis luving. Lat us kempe fur tu make de verld fri, fur tu uvervinde landmarker, gridhed, hatrid and de untillatrid. Lat us kempe fur en verld med farstanrid, en verld, var vetridskap and forskritrid skal lede to al mans gladhed.", |
|
11 |
+ "Kemparer: Ine de nam av folkherskrid: Lat us al verde en!" |
|
12 |
+ ] |
|
13 |
+ } |
|
14 |
+} |
|
15 |
+ |
... | ... |
@@ -0,0 +1,81 @@ |
1 |
+{ |
|
2 |
+ "data": [ |
|
3 |
+ {"transition_id": "t00", "language_id": "pg", "phonemes": ["-au-"], "examples": ["braudą","raudaz","skauniz","augô","draumaz","baumaz"]}, |
|
4 |
+ {"transition_id": "t00", "language_id": "en", "phonemes": ["-ea-","-e-","-ey-"], "examples": ["bread","red","sheen","eye","dream","beam"]}, |
|
5 |
+ {"transition_id": "t00", "language_id": "af", "phonemes": ["-oo-","-o-"], "examples": ["brood"]}, |
|
6 |
+ {"transition_id": "t00", "language_id": "nl", "phonemes": ["-oo-","-o-"], "examples": ["brood"]}, |
|
7 |
+ {"transition_id": "t00", "language_id": "yi", "phonemes": ["-וי-"], "examples": ["ברויט"]}, |
|
8 |
+ {"transition_id": "t00", "language_id": "de", "phonemes": ["-au-","-o-","-ö-"], "examples": ["Brot","rot","schön","Auge","Traum","Baum"]}, |
|
9 |
+ {"transition_id": "t00", "language_id": "da", "phonemes": ["-ø-"], "examples": ["brød"]}, |
|
10 |
+ {"transition_id": "t00", "language_id": "nb", "phonemes": ["-ø-","-øy-"], "examples": ["brød","rød","skjønn","øye","drøm"]}, |
|
11 |
+ {"transition_id": "t00", "language_id": "sv", "phonemes": ["-ö-"], "examples": ["bröd","röd","skön","dröm"]}, |
|
12 |
+ {"transition_id": "t00", "language_id": "nn", "phonemes": ["-au-"], "examples": ["braud"]}, |
|
13 |
+ {"transition_id": "t00", "language_id": "is", "phonemes": ["-au-"], "examples": ["brauð"]}, |
|
14 |
+ {"transition_id": "t00", "language_id": "fs", "phonemes": ["-ö-"], "examples": ["bröd","röd","skön","ög","dröm"]}, |
|
15 |
+ |
|
16 |
+ {"transition_id": "t01", "language_id": "pg", "phonemes": ["-ō-"], "examples": ["grōniz","fōljaną"]}, |
|
17 |
+ {"transition_id": "t01", "language_id": "en", "phonemes": ["-ee-"], "examples": ["green","feel"]}, |
|
18 |
+ {"transition_id": "t01", "language_id": "af", "phonemes": ["-oe-"], "examples": ["groen"]}, |
|
19 |
+ {"transition_id": "t01", "language_id": "nl", "phonemes": ["-oe"], "examples": ["groen"]}, |
|
20 |
+ {"transition_id": "t01", "language_id": "yi", "phonemes": ["-ין-"], "examples": ["גרין"]}, |
|
21 |
+ {"transition_id": "t01", "language_id": "de", "phonemes": ["-ü-","-üh-"], "examples": ["grün","fühlen"]}, |
|
22 |
+ {"transition_id": "t01", "language_id": "da", "phonemes": ["-ø-"], "examples": ["grøn"]}, |
|
23 |
+ {"transition_id": "t01", "language_id": "nb", "phonemes": ["-ø-"], "examples": ["grønn"]}, |
|
24 |
+ {"transition_id": "t01", "language_id": "sv", "phonemes": ["-ö-"], "examples": ["grön"]}, |
|
25 |
+ {"transition_id": "t01", "language_id": "nn", "phonemes": ["-ø-"], "examples": ["grøn"]}, |
|
26 |
+ {"transition_id": "t01", "language_id": "is", "phonemes": ["-æ-"], "examples": ["grænn"]}, |
|
27 |
+ {"transition_id": "t01", "language_id": "fs", "phonemes": ["-ö-"], "examples": ["föl","grön"]}, |
|
28 |
+ |
|
29 |
+ {"transition_id": "t02", "language_id": "pg", "phonemes": ["-eu-"], "examples": ["deupaz","steuraz","leuþa","leuhtą","reukaną","teuhaną","fleuhaną","leuganą"]}, |
|
30 |
+ {"transition_id": "t02", "language_id": "en", "phonemes": ["-ee-","-i-","-ie-"], "examples": ["deep","steer","leed","tee","flee","lie"]}, |
|
31 |
+ {"transition_id": "t02", "language_id": "af", "phonemes": ["-ie-"], "examples": ["diep"]}, |
|
32 |
+ {"transition_id": "t02", "language_id": "nl", "phonemes": ["-ie-","-i-","-ui-","-ij-"], "examples": ["diep"]}, |
|
33 |
+ {"transition_id": "t02", "language_id": "yi", "phonemes": ["-י-"], "examples": ["טיף"]}, |
|
34 |
+ {"transition_id": "t02", "language_id": "de", "phonemes": ["-ie-","-i-","-ü-"], "examples": ["tief","steuern","Lied","Licht","riechen","ziehen","fliehen","lügen"]}, |
|
35 |
+ {"transition_id": "t02", "language_id": "da", "phonemes": ["-y-"], "examples": ["dyb"]}, |
|
36 |
+ {"transition_id": "t02", "language_id": "nb", "phonemes": ["-y-","-ju-"], "examples": ["dyp","styre"]}, |
|
37 |
+ {"transition_id": "t02", "language_id": "sv", "phonemes": ["-ju-","-y-"], "examples": ["djup"]}, |
|
38 |
+ {"transition_id": "t02", "language_id": "is", "phonemes": ["-jú-","-jó-"], "examples": ["djúpur"]}, |
|
39 |
+ {"transition_id": "t02", "language_id": "fs", "phonemes": ["-ü-"], "examples": ["düp","stüre","lüt","rüke","tüe","flüe","lüge"]}, |
|
40 |
+ |
|
41 |
+ {"transition_id": "t04", "language_id": "pg", "phonemes": ["-iu-"], "examples": ["diurijaz","liudiz","tiugiją"]}, |
|
42 |
+ {"transition_id": "t04", "language_id": "en", "phonemes": ["-ea-","-eu-"], "examples": ["dear","lede","toy"]}, |
|
43 |
+ {"transition_id": "t04", "language_id": "af", "phonemes": [], "examples": []}, |
|
44 |
+ {"transition_id": "t04", "language_id": "nl", "phonemes": ["-uu-","-ie"], "examples": ["duur"]}, |
|
45 |
+ {"transition_id": "t04", "language_id": "yi", "phonemes": [], "examples": []}, |
|
46 |
+ {"transition_id": "t04", "language_id": "de", "phonemes": ["-eu-"], "examples": ["teuer","Zeug","Leute"]}, |
|
47 |
+ {"transition_id": "t04", "language_id": "da", "phonemes": ["-y-"], "examples": ["dyr"]}, |
|
48 |
+ {"transition_id": "t04", "language_id": "nb", "phonemes": ["-y-"], "examples": ["dyr"]}, |
|
49 |
+ {"transition_id": "t04", "language_id": "sv", "phonemes": ["-y-"], "examples": ["dyr"]}, |
|
50 |
+ {"transition_id": "t04", "language_id": "nn", "phonemes": ["-y-"], "examples": ["dyr"]}, |
|
51 |
+ {"transition_id": "t04", "language_id": "is", "phonemes": ["-ý-"], "examples": ["dýr"]}, |
|
52 |
+ {"transition_id": "t04", "language_id": "fs", "phonemes": ["-ü-"], "examples": ["dür","tüg","lüd"]}, |
|
53 |
+ |
|
54 |
+ {"transition_id": "t05", "language_id": "pg", "phonemes": ["-sk-"], "examples": ["waskaną","skauniz"]}, |
|
55 |
+ {"transition_id": "t05", "language_id": "en", "phonemes": ["-sh-"], "examples": ["wash","sheen"]}, |
|
56 |
+ {"transition_id": "t05", "language_id": "af", "phonemes": [], "examples": ["was"]}, |
|
57 |
+ {"transition_id": "t05", "language_id": "nl", "phonemes": [], "examples": ["wassen"]}, |
|
58 |
+ {"transition_id": "t05", "language_id": "yi", "phonemes": [], "examples": []}, |
|
59 |
+ {"transition_id": "t05", "language_id": "de", "phonemes": ["-sch-"], "examples": ["waschen"]}, |
|
60 |
+ {"transition_id": "t05", "language_id": "da", "phonemes": ["-sk-"], "examples": ["vaske"]}, |
|
61 |
+ {"transition_id": "t05", "language_id": "nb", "phonemes": ["-sk-"], "examples": ["vaske"]}, |
|
62 |
+ {"transition_id": "t05", "language_id": "sv", "phonemes": ["-sk-"], "examples": ["vaska"]}, |
|
63 |
+ {"transition_id": "t05", "language_id": "nn", "phonemes": ["-sk-"], "examples": ["vaske"]}, |
|
64 |
+ {"transition_id": "t05", "language_id": "is", "phonemes": ["-sk-"], "examples": ["vaska"]}, |
|
65 |
+ {"transition_id": "t05", "language_id": "fs", "phonemes": ["-sk-"], "examples": ["vaske"]}, |
|
66 |
+ |
|
67 |
+ {"transition_id": "t06", "language_id": "pg", "phonemes": ["s-"], "examples": ["swiną"]}, |
|
68 |
+ {"transition_id": "t06", "language_id": "en", "phonemes": ["s-"], "examples": ["swine"]}, |
|
69 |
+ {"transition_id": "t06", "language_id": "af", "phonemes": ["s-"], "examples": ["swyn"]}, |
|
70 |
+ {"transition_id": "t06", "language_id": "nl", "phonemes": ["z-"], "examples": ["zwijn"]}, |
|
71 |
+ {"transition_id": "t06", "language_id": "yi", "phonemes": [], "examples": []}, |
|
72 |
+ {"transition_id": "t06", "language_id": "de", "phonemes": ["sch-"], "examples": ["Schwein"]}, |
|
73 |
+ {"transition_id": "t06", "language_id": "da", "phonemes": ["s-"], "examples": ["svin"]}, |
|
74 |
+ {"transition_id": "t06", "language_id": "nb", "phonemes": ["s-"], "examples": ["svin"]}, |
|
75 |
+ {"transition_id": "t06", "language_id": "sv", "phonemes": ["s-"], "examples": ["svin"]}, |
|
76 |
+ {"transition_id": "t06", "language_id": "nn", "phonemes": ["s-"], "examples": ["svin"]}, |
|
77 |
+ {"transition_id": "t06", "language_id": "is", "phonemes": ["s-"], "examples": ["svínx"]}, |
|
78 |
+ {"transition_id": "t06", "language_id": "fs", "phonemes": ["s-"], "examples": ["svin"]} |
|
79 |
+ ] |
|
80 |
+} |
|
81 |
+ |
... | ... |
@@ -1,4 +1,78 @@ |
1 | 1 |
<?php |
2 |
+ function function_feed($value) |
|
3 |
+ { |
|
4 |
+ return ( |
|
5 |
+ function ($function) use (&$value) |
|
6 |
+ { |
|
7 |
+ return $function($value); |
|
8 |
+ } |
|
9 |
+ ); |
|
10 |
+ } |
|
11 |
+ |
|
12 |
+ function function_compose($function1, $function2) |
|
13 |
+ { |
|
14 |
+ return ( |
|
15 |
+ function ($value) use (&$function1, &$function2) |
|
16 |
+ { |
|
17 |
+ return ($function2($function1($value))); |
|
18 |
+ } |
|
19 |
+ ); |
|
20 |
+ } |
|
21 |
+ |
|
22 |
+ function function_chain($functions) |
|
23 |
+ { |
|
24 |
+ return ( |
|
25 |
+ function ($value) use (&$functions) |
|
26 |
+ { |
|
27 |
+ /* |
|
28 |
+ return array_reduce($functions, function ($x, $y) {call_user_func("function_compose", $x, $y);}, $value); |
|
29 |
+ */ |
|
30 |
+ return ((count($functions) == 0) ? $value : function_feed($functions[0]($value))(function_chain(array_slice($functions, 1)))); |
|
31 |
+ } |
|
32 |
+ ); |
|
33 |
+ } |
|
34 |
+ |
|
35 |
+ function object_from_array($key_name) |
|
36 |
+ { |
|
37 |
+ return ( |
|
38 |
+ function ($list) use (&$key_name) |
|
39 |
+ { |
|
40 |
+ $object = []; |
|
41 |
+ foreach ($list as $element) |
|
42 |
+ { |
|
43 |
+ $key = $element[$key_name]; |
|
44 |
+ $object[$key] = $element; |
|
45 |
+ } |
|
46 |
+ return $object; |
|
47 |
+ } |
|
48 |
+ ); |
|
49 |
+ } |
|
50 |
+ |
|
51 |
+ function object_attribute($name) |
|
52 |
+ { |
|
53 |
+ return ( |
|
54 |
+ function ($object) use (&$name) |
|
55 |
+ { |
|
56 |
+ return $object[$name]; |
|
57 |
+ } |
|
58 |
+ ); |
|
59 |
+ } |
|
60 |
+ |
|
61 |
+ function object_map($function) |
|
62 |
+ { |
|
63 |
+ return ( |
|
64 |
+ function ($object) use (&$function) |
|
65 |
+ { |
|
66 |
+ $object_ = []; |
|
67 |
+ foreach ($object as $key => $value) |
|
68 |
+ { |
|
69 |
+ $object_[$key] = $function($value); |
|
70 |
+ } |
|
71 |
+ return $object_; |
|
72 |
+ } |
|
73 |
+ ); |
|
74 |
+ } |
|
75 |
+ |
|
2 | 76 |
function fetch($structure, $field, $fallback = null, $escalation = 1) |
3 | 77 |
{ |
4 | 78 |
if (array_key_exists($field, $structure)) |
... | ... |
@@ -48,10 +122,23 @@ |
48 | 122 |
|
49 | 123 |
function mark($core, $classes) |
50 | 124 |
{ |
125 |
+ global $configuration; |
|
126 |
+ if ($configuration["replace_fs_umlauts"]) |
|
127 |
+ { |
|
128 |
+ if (in_array("lang_fs", $classes) and !in_array("letter", $classes)) |
|
129 |
+ { |
|
130 |
+ $core = str_replace |
|
131 |
+ ( |
|
132 |
+ ["ö","ü"], |
|
133 |
+ ["oy","uy"], |
|
134 |
+ $core |
|
135 |
+ ); |
|
136 |
+ } |
|
137 |
+ } |
|
51 | 138 |
return ('<span class="' . implode(" ", $classes) . '">' . $core . '</span>'); |
52 | 139 |
} |
53 | 140 |
|
54 |
- function format($string, $classes = ["word", "lang_fs"]) |
|
141 |
+ function format($string, $classes = ["type_word", "lang_fs"]) |
|
55 | 142 |
{ |
56 | 143 |
if ($string == NULL) |
57 | 144 |
{ |
... | ... |
@@ -82,7 +169,7 @@ |
82 | 169 |
return ((count($words) == 0) ? "?" : implode(", ", array_map(function ($word) use (&$type,&$language) {return mark($word, [$type, "lang_" . $language]);}, $words))); |
83 | 170 |
} |
84 | 171 |
|
85 |
- function _bar($type = "word") |
|
172 |
+ function _bar($type = "type_word") |
|
86 | 173 |
{ |
87 | 174 |
return ( |
88 | 175 |
function ($value) use (&$type) |
... | ... |
@@ -97,6 +184,42 @@ |
97 | 184 |
); |
98 | 185 |
} |
99 | 186 |
|
187 |
+ function format_single($type, $language) |
|
188 |
+ { |
|
189 |
+ return ( |
|
190 |
+ function ($piece) use (&$type, &$language) |
|
191 |
+ { |
|
192 |
+ return mark($piece, [$type, "lang_" . $language]); |
|
193 |
+ } |
|
194 |
+ ); |
|
195 |
+ } |
|
196 |
+ |
|
197 |
+ function format_list($type, $language) |
|
198 |
+ { |
|
199 |
+ return ( |
|
200 |
+ function ($pieces) use (&$type, &$language) |
|
201 |
+ { |
|
202 |
+ return ((count($pieces) == 0) ? "?" : implode(", ", array_map(format_single($type, $language), $pieces))); |
|
203 |
+ } |
|
204 |
+ ); |
|
205 |
+ } |
|
206 |
+ |
|
207 |
+ function format_correlation($type, $language_from = "fs", $language_to = null) |
|
208 |
+ { |
|
209 |
+ global $configuration; |
|
210 |
+ if ($language_to == null) $language_to = $configuration["target"]; |
|
211 |
+ return ( |
|
212 |
+ function ($source) use (&$type, &$language_from, &$language_to) |
|
213 |
+ { |
|
214 |
+ $output = ""; |
|
215 |
+ $output .= format_list($type, $language_from)($source[$language_from]); |
|
216 |
+ $output .= " ~ "; |
|
217 |
+ $output .= format_list($type, $language_to)($source[$language_to]); |
|
218 |
+ return $output; |
|
219 |
+ } |
|
220 |
+ ); |
|
221 |
+ } |
|
222 |
+ |
|
100 | 223 |
function proposal() |
101 | 224 |
{ |
102 | 225 |
?> |
... | ... |
@@ -125,36 +125,32 @@ class class_table |
125 | 125 |
$columns_vertical = fetch($configuration, "columns_vertical", null, 2); |
126 | 126 |
$columns_horizontal = fetch($configuration, "columns_horizontal", null, 2); |
127 | 127 |
$columns_data = fetch($configuration, "columns_data", null, 2); |
128 |
+ $data_aggregator = fetch($configuration, "data_aggregator", function ($values) {return /*json_encode(*/$values/*)*/;}, 1); |
|
128 | 129 |
|
129 | 130 |
$columns_source = |
130 | 131 |
[ |
131 |
- new class_column("Vertical", "vertical"), |
|
132 |
- new class_column("Horizontal", "horizontal"), |
|
133 |
- new class_column("Data", "data"), |
|
132 |
+ new class_column("Vertical", "_vertical"), |
|
133 |
+ new class_column("Horizontal", "_horizontal"), |
|
134 |
+ new class_column("Data", "_data", function ($x) {return json_encode($x);}), |
|
134 | 135 |
]; |
136 |
+ // gather data for the three columns |
|
135 | 137 |
$rows_source = null; |
136 | 138 |
{ |
137 |
- $rows_source = $this->rows; |
|
138 |
- $rows_source = sql_condense |
|
139 |
+ $rows_source = array_map |
|
139 | 140 |
( |
140 |
- $rows_source, |
|
141 |
- array_map(function ($column) {return $column->field;}, $columns_vertical), |
|
142 |
- ["vertical"], |
|
143 |
- ["vertical" => function ($values) use (&$columns_vertical) {return implode("/", array_map(function ($column) use (&$values) {return $values[$column->field];}, $columns_vertical));}] |
|
144 |
- ); |
|
145 |
- $rows_source = sql_condense |
|
146 |
- ( |
|
147 |
- $rows_source, |
|
148 |
- array_map(function ($column) {return $column->field;}, $columns_horizontal), |
|
149 |
- ["horizontal"], |
|
150 |
- ["horizontal" => function ($values) use (&$columns_horizontal) {return implode("/", array_map(function ($column) use (&$values) {return $values[$column->field];}, $columns_horizontal));}] |
|
151 |
- ); |
|
152 |
- $rows_source = sql_condense |
|
153 |
- ( |
|
154 |
- $rows_source, |
|
155 |
- array_map(function ($column) {return $column->field;}, $columns_data), |
|
156 |
- ["data"], |
|
157 |
- ["data" => function ($values) use (&$configuration) {return fetch($configuration, "data_aggregator", function ($values) {return /*json_encode(*/$values/*)*/;}, 1)($values);}] |
|
141 |
+ function ($row) use (&$columns_vertical, &$columns_horizontal, &$columns_data, $data_aggregator) |
|
142 |
+ { |
|
143 |
+ $raw_vertical = []; foreach ($columns_vertical as $column) array_push($raw_vertical, $column->extract($row)); |
|
144 |
+ $raw_horizontal = []; foreach ($columns_horizontal as $column) array_push($raw_horizontal, $column->extract($row)); |
|
145 |
+ $raw_data = []; foreach ($columns_data as $column) $raw_data[$column->field] = $column->extract($row); |
|
146 |
+ |
|
147 |
+ $row_ = []; |
|
148 |
+ $row_["_vertical"] = implode("/", $raw_vertical); |
|
149 |
+ $row_["_horizontal"] = implode("/", $raw_horizontal); |
|
150 |
+ $row_["_data"] = $data_aggregator($raw_data); |
|
151 |
+ return $row_; |
|
152 |
+ }, |
|
153 |
+ $this->rows |
|
158 | 154 |
); |
159 | 155 |
} |
160 | 156 |
// return (new class_table($columns_source, $rows_source)); |
... | ... |
@@ -176,6 +172,7 @@ class class_table |
176 | 172 |
) |
177 | 173 |
); |
178 | 174 |
} |
175 |
+ // find groups |
|
179 | 176 |
$values = []; |
180 | 177 |
foreach ($rows_source as $row) |
181 | 178 |
{ |
... | ... |
@@ -201,7 +198,8 @@ class class_table |
201 | 198 |
array_push($values, $value); |
202 | 199 |
} |
203 | 200 |
} |
204 |
- $groups = sql_groups($rows_source, "vertical"); |
|
201 |
+ $groups = sql_groups($rows_source, "_vertical"); |
|
202 |
+// echo("<!-- " . json_encode($groups, JSON_PRETTY_PRINT) . " -->" . "\n"); |
|
205 | 203 |
$rows_result = array_map |
206 | 204 |
( |
207 | 205 |
function ($group) use (&$columns_vertical,&$columns_horizontal,&$columns_data,&$columns_source,&$columns_result,&$values) |
... | ... |
@@ -164,7 +164,7 @@ a |
164 | 164 |
font-weight: bold; |
165 | 165 |
} |
166 | 166 |
|
167 |
-.letter |
|
167 |
+.type_letter |
|
168 | 168 |
{ |
169 | 169 |
&.lang_fs |
170 | 170 |
{ |
... | ... |
@@ -176,17 +176,30 @@ a |
176 | 176 |
*/ |
177 | 177 |
} |
178 | 178 |
|
179 |
- &.lang_pg, |
|
180 |
- &.lang_de, |
|
179 |
+ &.lang_pg |
|
180 |
+ { |
|
181 |
+ text-decoration: underline; |
|
182 |
+ } |
|
183 |
+ |
|
181 | 184 |
&.lang_en, |
182 |
- &.lang_is, |
|
183 |
- &.lang_nb |
|
185 |
+ &.lang_af, |
|
186 |
+ &.lang_nl, |
|
187 |
+ &.lang_de, |
|
188 |
+ &.lang_da, |
|
189 |
+ &.lang_nb, |
|
190 |
+ &.lang_sv, |
|
191 |
+ &.lang_nn, |
|
192 |
+ &.lang_is |
|
184 | 193 |
{ |
185 | 194 |
font-style: italic; |
186 | 195 |
} |
196 |
+ |
|
197 |
+ &.lang_yi |
|
198 |
+ { |
|
199 |
+ } |
|
187 | 200 |
} |
188 | 201 |
|
189 |
-.word |
|
202 |
+.type_word |
|
190 | 203 |
{ |
191 | 204 |
&.lang_fs |
192 | 205 |
{ |
... | ... |
@@ -198,18 +211,34 @@ a |
198 | 211 |
*/ |
199 | 212 |
} |
200 | 213 |
|
201 |
- &.lang_pg, |
|
202 |
- &.lang_de, |
|
214 |
+ &.lang_pg |
|
215 |
+ { |
|
216 |
+ text-decoration: underline; |
|
217 |
+ } |
|
218 |
+ |
|
203 | 219 |
&.lang_en, |
204 |
- &.lang_is, |
|
205 |
- &.lang_nb |
|
220 |
+ &.lang_af, |
|
221 |
+ &.lang_nl, |
|
222 |
+ &.lang_de, |
|
223 |
+ &.lang_da, |
|
224 |
+ &.lang_nb, |
|
225 |
+ &.lang_sv, |
|
226 |
+ &.lang_nn, |
|
227 |
+ &.lang_is |
|
206 | 228 |
{ |
207 | 229 |
font-style: italic; |
208 | 230 |
} |
231 |
+ |
|
232 |
+ &.lang_yi |
|
233 |
+ { |
|
234 |
+ } |
|
209 | 235 |
} |
210 | 236 |
|
211 |
-.sentence |
|
237 |
+.type_sentence |
|
212 | 238 |
{ |
239 |
+ &:before {content: "\"";} |
|
240 |
+ &:after {content: "\"";} |
|
241 |
+ |
|
213 | 242 |
&.lang_fs |
214 | 243 |
{ |
215 | 244 |
font-weight: bold; |
... | ... |
@@ -218,24 +247,36 @@ a |
218 | 247 |
font-size: 1.2em; |
219 | 248 |
font-family: runic; |
220 | 249 |
*/ |
221 |
- &:before {content: "\"";} |
|
222 |
- &:after {content: "\"";} |
|
223 | 250 |
} |
224 | 251 |
|
225 |
- &.lang_pg, |
|
226 |
- &.lang_de, |
|
252 |
+ &.lang_pg |
|
253 |
+ { |
|
254 |
+ text-decoration: underline; |
|
255 |
+ } |
|
256 |
+ |
|
227 | 257 |
&.lang_en, |
228 |
- &.lang_is, |
|
229 |
- &.lang_nb |
|
258 |
+ &.lang_af, |
|
259 |
+ &.lang_nl, |
|
260 |
+ &.lang_de, |
|
261 |
+ &.lang_da, |
|
262 |
+ &.lang_nb, |
|
263 |
+ &.lang_sv, |
|
264 |
+ &.lang_nn, |
|
265 |
+ &.lang_is |
|
230 | 266 |
{ |
231 | 267 |
font-style: italic; |
232 |
- &:before {content: "\"";} |
|
233 |
- &:after {content: "\"";} |
|
268 |
+ } |
|
269 |
+ |
|
270 |
+ &.lang_yi |
|
271 |
+ { |
|
234 | 272 |
} |
235 | 273 |
} |
236 | 274 |
|
237 |
-.text |
|
275 |
+.type_text |
|
238 | 276 |
{ |
277 |
+ &:before {content: "„";} |
|
278 |
+ &:after {content: "“";} |
|
279 |
+ |
|
239 | 280 |
&.lang_fs |
240 | 281 |
{ |
241 | 282 |
font-style: italic; |
... | ... |
@@ -244,19 +285,28 @@ a |
244 | 285 |
font-size: 1.2em; |
245 | 286 |
font-family: runic; |
246 | 287 |
*/ |
247 |
- &:before {content: "„";} |
|
248 |
- &:after {content: "“";} |
|
249 | 288 |
} |
250 | 289 |
|
251 |
- &.lang_pg, |
|
252 |
- &.lang_de, |
|
290 |
+ &.lang_pg |
|
291 |
+ { |
|
292 |
+ text-decoration: underline; |
|
293 |
+ } |
|
294 |
+ |
|
253 | 295 |
&.lang_en, |
254 |
- &.lang_is, |
|
255 |
- &.lang_nb |
|
296 |
+ &.lang_af, |
|
297 |
+ &.lang_nl, |
|
298 |
+ &.lang_de, |
|
299 |
+ &.lang_da, |
|
300 |
+ &.lang_nb, |
|
301 |
+ &.lang_sv, |
|
302 |
+ &.lang_nn, |
|
303 |
+ &.lang_is |
|
256 | 304 |
{ |
257 | 305 |
font-style: italic; |
258 |
- &:before {content: "„";} |
|
259 |
- &:after {content: "“";} |
|
306 |
+ } |
|
307 |
+ |
|
308 |
+ &.lang_yi |
|
309 |
+ { |
|
260 | 310 |
} |
261 | 311 |
} |
262 | 312 |
|
... | ... |
@@ -1,12 +1,8 @@ |
1 |
-var __extends = (this && this.__extends) || function (d, b) { |
|
2 |
- for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; |
|
3 |
- function __() { this.constructor = d; } |
|
4 |
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); |
|
5 |
-}; |
|
6 | 1 |
/* |
7 | 2 |
|
8 | 3 |
Build system abstractor "Koralle" |
9 |
- Copyright (C) 2016 Fenris Wolf (fenris@greenscale.de) |
|
4 |
+ Copyright (C) 2016 Fenris Wolf, Christian Neubauer |
|
5 |
+ (fenris@greenscale.de, neubauer@greenscale.de) |
|
10 | 6 |
|
11 | 7 |
This program is free software: you can redistribute it and/or modify |
12 | 8 |
it under the terms of the GNU General Public License as published by |
... | ... |
@@ -22,884 +18,5093 @@ var __extends = (this && this.__extends) || function (d, b) { |
22 | 18 |
along with this program. If not, see <http://www.gnu.org/licenses/>. |
23 | 19 |
|
24 | 20 |
*/ |
25 |
-var _child_process = require("child_process"); |
|
26 |
-var _fs = require("fs"); |
|
27 |
-var configuration = {}; |
|
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) { |
|
28 | 31 |
/** |
29 |
- * @author fenris |
|
32 |
+ * @author frac |
|
30 | 33 |
*/ |
31 |
-function indentation(depth, symbol) { |
|
32 |
- if (symbol === void 0) { symbol = "\t"; } |
|
33 |
- return ((depth == 0) ? "" : (symbol + indentation(depth - 1, symbol))); |
|
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 |
+ } |
|
34 | 103 |
} |
35 | 104 |
/** |
36 |
- * @author fenris |
|
105 |
+ * @author frac |
|
37 | 106 |
*/ |
38 |
-var class_message = (function () { |
|
107 |
+var class_observer = (function () { |
|
39 | 108 |
/** |
40 |
- * @author fenris |
|
109 |
+ * @author frac |
|
41 | 110 |
*/ |
42 |
- function class_message(content, parameters) { |
|
43 |
- if (parameters === void 0) { parameters = {}; } |
|
111 |
+ function class_observer() { |
|
112 |
+ this.counter = 0; |
|
113 |
+ this.actions = {}; |
|
114 |
+ this.buffer = []; |
|
115 |
+ } |
|
44 | 116 |
/** |
45 |
- * @author fenris |
|
117 |
+ * @author frac |
|
46 | 118 |
*/ |
47 |
- this.depth = 0; |
|
48 |
- if (parameters.prefix == undefined) |
|
49 |
- parameters.prefix = null; |
|
50 |
- if (parameters.type == undefined) |
|
51 |
- parameters.type = null; |
|
52 |
- if (parameters.depth == undefined) |
|
53 |
- parameters.depth = 0; |
|
54 |
- if (parameters.linebreak == undefined) |
|
55 |
- parameters.linebreak = false; |
|
56 |
- this.content = content; |
|
57 |
- this.type = parameters.type; |
|
58 |
- this.depth = parameters.depth; |
|
59 |
- this.prefix = parameters.prefix; |
|
60 |
- this.linebreak = parameters.linebreak; |
|
61 |
- } |
|
119 |
+ class_observer.prototype.empty = function () { |
|
120 |
+ return (Object.keys(this.actions).length == 0); |
|
121 |
+ }; |
|
62 | 122 |
/** |
63 |
- * @author fenris |
|
123 |
+ * @author frac |
|
64 | 124 |
*/ |
65 |
- class_message.prototype.generate = function (with_type) { |
|
66 |
- if (with_type === void 0) { with_type = true; } |
|
67 |
- var output = ""; |
|
68 |
- output += indentation(this.depth); |
|
69 |
- if (with_type) { |
|
70 |
- if (this.type != null) { |
|
71 |
- output += ("[" + this.type + "]" + " "); |
|
72 |
- } |
|
73 |
- } |
|
74 |
- if (this.prefix != null) { |
|
75 |
- output += ("<" + this.prefix + ">" + " "); |
|
76 |
- } |
|
77 |
- output += this.content; |
|
78 |
- if (this.linebreak) { |
|
79 |
- output += "\n"; |
|
80 |
- } |
|
81 |
- return output; |
|
125 |
+ class_observer.prototype.flush = function () { |
|
126 |
+ this.actions = {}; |
|
82 | 127 |
}; |
83 | 128 |
/** |
84 |
- * @author fenris |
|
129 |
+ * @author frac |
|
85 | 130 |
*/ |
86 |
- class_message.prototype.stdout = function () { |
|
87 |
- console.log(this.generate(true)); |
|
131 |
+ class_observer.prototype.set = function (id, action) { |
|
132 |
+ this.actions[id] = action; |
|
88 | 133 |
}; |
89 | 134 |
/** |
90 |
- * @author fenris |
|
135 |
+ * @author frac |
|
91 | 136 |
*/ |
92 |
- class_message.prototype.stderr = function () { |
|
93 |
- console.error(this.generate(true)); |
|
137 |
+ class_observer.prototype.del = function (id) { |
|
138 |
+ delete this.actions[id]; |
|
94 | 139 |
}; |
95 | 140 |
/** |
96 |
- * @author fenris |
|
141 |
+ * @author frac |
|
97 | 142 |
*/ |
98 |
- class_message.prototype.console = function () { |
|
99 |
- switch (this.type) { |
|
100 |
- case "log": { |
|
101 |
- console.log(this.generate(false)); |
|
102 |
- break; |
|
103 |
- } |
|
104 |
- case "information": { |
|
105 |
- console.info(this.generate(false)); |
|
106 |
- break; |
|
107 |
- } |
|
108 |
- case "warning": { |
|
109 |
- console.warn(this.generate(false)); |
|
110 |
- break; |
|
111 |
- } |
|
112 |
- case "error": { |
|
113 |
- console.error(this.generate(false)); |
|
114 |
- break; |
|
115 |
- } |
|
116 |
- default: { |
|
117 |
- throw (new Error("unhandled type '" + this.type + "'")); |
|
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); |
|
118 | 155 |
} |
156 |
+ else { |
|
157 |
+ Object.keys(this.actions).forEach(function (id) { return _this.actions[id](information); }); |
|
119 | 158 |
} |
120 | 159 |
}; |
121 |
- return class_message; |
|
160 |
+ /** |
|
161 |
+ * @author frac |
|
162 |
+ */ |
|
163 |
+ class_observer.prototype.rollout = function () { |
|
164 |
+ var _this = this; |
|
165 |
+ this.buffer.forEach(function (information) { return _this.notify(information, false); }); |
|
166 |
+ this.buffer = []; |
|
167 |
+ }; |
|
168 |
+ return class_observer; |
|
122 | 169 |
}()); |
123 | 170 |
/** |
124 |
- * @author fenris |
|
171 |
+ * @author frac |
|
125 | 172 |
*/ |
126 |
-var class_cliout = (function () { |
|
127 |
- function class_cliout() { |
|
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 |
+ |
|
128 | 194 |
} |
195 |
+ */ |
|
129 | 196 |
/** |
130 |
- * @author fenris |
|
197 |
+ * @author frac |
|
131 | 198 |
*/ |
132 |
- class_cliout.stdout = function (content, depth) { |
|
133 |
- if (depth === void 0) { depth = 0; } |
|
134 |
- console.log(indentation(depth) + content); |
|
135 |
- }; |
|
199 |
+/*export*/ var class_maybe = (function () { |
|
200 |
+ function class_maybe() { |
|
201 |
+ } |
|
136 | 202 |
/** |
137 |
- * @author fenris |
|
203 |
+ * @desc whether the wrapper is nothing |
|
204 |
+ * @author frac |
|
138 | 205 |
*/ |
139 |
- class_cliout.stderr = function (content, depth) { |
|
140 |
- if (depth === void 0) { depth = 0; } |
|
141 |
- console.error(indentation(depth) + content); |
|
206 |
+ class_maybe.prototype.is_nothing = function () { |
|
207 |
+ throw (new Error("not implemented: class_maybe.is_nothing")); |
|
142 | 208 |
}; |
143 | 209 |
/** |
144 |
- * @author fenris |
|
210 |
+ * @desc whether the wrapper is just |
|
211 |
+ * @author frac |
|
145 | 212 |
*/ |
146 |
- class_cliout.log = function (content, depth) { |
|
147 |
- if (depth === void 0) { depth = 0; } |
|
148 |
- this.stderr("-- " + content, depth); |
|
213 |
+ class_maybe.prototype.is_just = function () { |
|
214 |
+ throw (new Error("not implemented: class_maybe.is_just")); |
|
149 | 215 |
}; |
150 | 216 |
/** |
151 |
- * @author fenris |
|
217 |
+ * @desc return the value, stored in the maybe-wrapper |
|
218 |
+ * @author frac |
|
152 | 219 |
*/ |
153 |
- class_cliout.info = function (content, depth) { |
|
154 |
- if (depth === void 0) { depth = 0; } |
|
155 |
- this.stderr(">> " + content, depth); |
|
220 |
+ class_maybe.prototype.cull = function () { |
|
221 |
+ throw (new Error("not implemented: class_maybe.cull")); |
|
156 | 222 |
}; |
157 | 223 |
/** |
158 |
- * @author fenris |
|
224 |
+ * @author frac |
|
159 | 225 |
*/ |
160 |
- class_cliout.warn = function (content, depth) { |
|
161 |
- if (depth === void 0) { depth = 0; } |
|
162 |
- this.stderr(">> " + content, depth); |
|
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")); |
|
163 | 229 |
}; |
164 | 230 |
/** |
165 |
- * @author fenris |
|
231 |
+ * @author frac |
|
166 | 232 |
*/ |
167 |
- class_cliout.error = function (content, depth) { |
|
168 |
- if (depth === void 0) { depth = 0; } |
|
169 |
- this.stderr(">> " + content, depth); |
|
233 |
+ class_maybe.prototype.propagate = function (action) { |
|
234 |
+ throw (new Error("not implemented: class_maybe.propagate")); |
|
170 | 235 |
}; |
171 |
- return class_cliout; |
|
236 |
+ return class_maybe; |
|
172 | 237 |
}()); |
173 | 238 |
/** |
174 |
- * @author fenris |
|
239 |
+ * @author frac |
|
175 | 240 |
*/ |
176 |
-var class_graph = (function () { |
|
241 |
+/*export*/ var class_nothing = (function (_super) { |
|
242 |
+ __extends(class_nothing, _super); |
|
177 | 243 |
/** |
178 |
- * @author fenris |
|
244 |
+ * @author frac |
|
179 | 245 |
*/ |
180 |
- function class_graph(nodes, edges) { |
|
181 |
- if (nodes === void 0) { nodes = []; } |
|
182 |
- if (edges === void 0) { edges = []; } |
|
183 |
- this.nodes = nodes; |
|
184 |
- this.edges = edges; |
|
246 |
+ function class_nothing(reason) { |
|
247 |
+ if (reason === void 0) { reason = null; } |
|
248 |
+ _super.call(this); |
|
249 |
+ this.reason = reason; |
|
185 | 250 |
} |
186 | 251 |
/** |
187 |
- * @author fenris |
|
252 |
+ * @author frac |
|
188 | 253 |
*/ |
189 |
- class_graph.prototype.without = function (pivot) { |
|
190 |
- return (new class_graph(this.nodes.filter(function (node) { return (node != pivot); }), this.edges.filter(function (edge) { return ((edge.from != pivot) && (edge.to != pivot)); }))); |
|
254 |
+ class_nothing.prototype.is_nothing = function () { |
|
255 |
+ return true; |
|
191 | 256 |
}; |
192 |
- return class_graph; |
|
193 |
-}()); |
|
194 | 257 |
/** |
195 |
- * @author fenris |
|
258 |
+ * @author frac |
|
196 | 259 |
*/ |
197 |
-function topsort(graph) { |
|
198 |
- if (graph.nodes.length == 0) { |
|
199 |
- return []; |
|
200 |
- } |
|
201 |
- else { |
|
202 |
- var pivot_1; |
|
203 |
- var found = graph.nodes.some(function (node) { |
|
204 |
- var count = graph.edges.filter(function (edge) { return (edge.to == node); }).length; |
|
205 |
- if (count == 0) { |
|
206 |
- pivot_1 = node; |
|
207 |
- return true; |
|
208 |
- } |
|
209 |
- else { |
|
210 |
- // console.info("'" + String(node) + "' has " + count.toString() + " incoming edges"); |
|
260 |
+ class_nothing.prototype.is_just = function () { |
|
211 | 261 |
return false; |
212 |
- } |
|
213 |
- }); |
|
214 |
- if (found) { |
|
215 |
- return [pivot_1].concat(topsort(graph.without(pivot_1))); |
|
216 |
- } |
|
217 |
- else { |
|
218 |
- throw (new Error("circular dependencies found")); |
|
219 |
- } |
|
220 |
- } |
|
221 |
-} |
|
262 |
+ }; |
|
222 | 263 |
/** |
223 |
- * @author fenris |
|
264 |
+ * @author frac |
|
224 | 265 |
*/ |
225 |
-var lib_xml; |
|
226 |
-(function (lib_xml) { |
|
266 |
+ class_nothing.prototype.cull = function () { |
|
267 |
+ return null; |
|
268 |
+ }; |
|
227 | 269 |
/** |
228 |
- * @author fenris |
|
270 |
+ * @author frac |
|
229 | 271 |
*/ |
230 |
- var class_node = (function () { |
|
231 |
- function class_node() { |
|
232 |
- } |
|
233 |
- return class_node; |
|
234 |
- }()); |
|
235 |
- lib_xml.class_node = class_node; |
|
272 |
+ class_nothing.prototype.distinguish = function (action_just, action_nothing) { |
|
273 |
+ if (action_nothing === void 0) { action_nothing = function () { }; } |
|
274 |
+ action_nothing(this.reason); |
|
275 |
+ }; |
|
236 | 276 |
/** |
237 |
- * @author fenris |
|
277 |
+ * @author frac |
|
238 | 278 |
*/ |
239 |
- var class_node_text = (function (_super) { |
|
240 |
- __extends(class_node_text, _super); |
|
279 |
+ class_nothing.prototype.propagate = function (action) { |
|
280 |
+ return (new class_nothing(this.reason)); |
|
281 |
+ }; |
|
282 |
+ return class_nothing; |
|
283 |
+}(class_maybe)); |
|
241 | 284 |
/** |
242 |
- * @author fenris |
|
285 |
+ * @author frac |
|
243 | 286 |
*/ |
244 |
- function class_node_text(content) { |
|
287 |
+/*export*/ var class_just = (function (_super) { |
|
288 |
+ __extends(class_just, _super); |
|
289 |
+ /** |
|
290 |
+ * @author frac |
|
291 |
+ */ |
|
292 |
+ function class_just(value) { |
|
245 | 293 |
_super.call(this); |
246 |
- this.content = content; |
|
294 |
+ this.value = value; |
|
247 | 295 |
} |
248 | 296 |
/** |
249 |
- * @author fenris |
|
297 |
+ * @author frac |
|
250 | 298 |
*/ |
251 |
- class_node_text.prototype.compile = function (depth) { |
|
252 |
- if (depth === void 0) { depth = 0; } |
|
253 |
- return (indentation(depth) + this.content + "\n"); |
|
299 |
+ class_just.prototype.is_nothing = function () { |
|
300 |
+ return false; |
|
254 | 301 |
}; |
255 |
- return class_node_text; |
|
256 |
- }(class_node)); |
|
257 |
- lib_xml.class_node_text = class_node_text; |
|
258 | 302 |
/** |
259 |
- * @author fenris |
|
303 |
+ * @author frac |
|
260 | 304 |
*/ |
261 |
- var class_node_comment = (function (_super) { |
|
262 |
- __extends(class_node_comment, _super); |
|
305 |
+ class_just.prototype.is_just = function () { |
|
306 |
+ return true; |
|
307 |
+ }; |
|
263 | 308 |
/** |
264 |
- * @author fenris |
|
309 |
+ * @author frac |
|
265 | 310 |
*/ |
266 |
- function class_node_comment(content) { |
|
267 |
- _super.call(this); |
|
268 |
- this.content = content; |
|
269 |
- } |
|
311 |
+ class_just.prototype.cull = function () { |
|
312 |
+ return this.value; |
|
313 |
+ }; |
|
270 | 314 |
/** |
271 |
- * @author fenris |
|
315 |
+ * @author frac |
|
272 | 316 |
*/ |
273 |
- class_node_comment.prototype.compile = function (depth) { |
|
274 |
- if (depth === void 0) { depth = 0; } |
|
275 |
- return (indentation(depth) + "<!-- " + this.content + " -->" + "\n"); |
|
317 |
+ class_just.prototype.distinguish = function (action_just, action_nothing) { |
|
318 |
+ if (action_nothing === void 0) { action_nothing = function () { }; } |
|
319 |
+ action_just(this.value); |
|
276 | 320 |
}; |
277 |
- return class_node_comment; |
|
278 |
- }(class_node)); |
|
279 |
- lib_xml.class_node_comment = class_node_comment; |
|
280 | 321 |
/** |
281 |
- * @author fenris |
|
322 |
+ * @author frac |
|
282 | 323 |
*/ |
283 |
- var class_node_complex = (function (_super) { |
|
284 |
- __extends(class_node_complex, _super); |
|
324 |
+ class_just.prototype.propagate = function (action) { |
|
325 |
+ return action(this.value); |
|
326 |
+ }; |
|
327 |
+ return class_just; |
|
328 |
+}(class_maybe)); |
|
285 | 329 |
/** |
286 |
- * @author fenris |
|
330 |
+ * @author frac |
|
287 | 331 |
*/ |
288 |
- function class_node_complex(name, attributes, children) { |
|
289 |
- if (attributes === void 0) { attributes = {}; } |
|
290 |
- if (children === void 0) { children = []; } |
|
291 |
- _super.call(this); |
|
292 |
- this.name = name; |
|
293 |
- this.attributes = attributes; |
|
294 |
- this.children = children; |
|
295 |
- } |
|
332 |
+var class_error = (function (_super) { |
|
333 |
+ __extends(class_error, _super); |
|
296 | 334 |
/** |
297 |
- * @author fenris |
|
335 |
+ * @author frac |
|
298 | 336 |
*/ |
299 |
- class_node_complex.prototype.compile = function (depth) { |
|
300 |
- var _this = this; |
|
301 |
- if (depth === void 0) { depth = 0; } |
|
302 |
- var output = ""; |
|
303 |
- var attributes = Object.keys(this.attributes).map(function (key) { return (" " + key + "=" + ("\"" + _this.attributes[key] + "\"")); }).join(""); |
|
304 |
- output += (indentation(depth) + "<" + this.name + attributes + ">" + "\n"); |
|
305 |
- this.children.forEach(function (child) { return (output += child.compile(depth + 1)); }); |
|
306 |
- output += (indentation(depth) + "</" + this.name + ">" + "\n"); |
|
307 |
- return output; |
|
308 |
- }; |
|
309 |
- return class_node_complex; |
|
310 |
- }(class_node)); |
|
311 |
- lib_xml.class_node_complex = class_node_complex; |
|
312 |
-})(lib_xml || (lib_xml = {})); |
|
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; |
|
342 |
+ } |
|
313 | 343 |
/** |
314 |
- * @author fenris |
|
344 |
+ * @override |
|
345 |
+ * @author frac |
|
315 | 346 |
*/ |
316 |
-var lib_gnumake; |
|
317 |
-(function (lib_gnumake) { |
|
347 |
+ class_error.prototype.toString = function () { |
|
348 |
+ return (this.mess + " " + ("[" + this.suberrors.map(function (x) { return x.toString(); }).join(",") + "]")); |
|
349 |
+ }; |
|
350 |
+ return class_error; |
|
351 |
+}(Error)); |
|
352 |
+// module lib_base { |
|
353 |
+// import _instances = require("instances"); |
|
354 |
+// declare var hash; |
|
355 |
+// declare var equals; |
|
356 |
+/** |
|
357 |
+ * @author frac |
|
358 |
+ */ |
|
359 |
+/*export*/ var Pair = (function () { |
|
360 |
+ function Pair(first, second) { |
|
361 |
+ this.first = first; |
|
362 |
+ this.second = second; |
|
363 |
+ } |
|
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); |
|
382 |
+ } |
|
383 |
+ else { |
|
384 |
+ throw (new Exception("Pair:equals:components", "Missing equality-implementation for components while trying to compute equality of pairs", exceptions)); |
|
385 |
+ } |
|
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 |
+}()); |
|
415 |
+/** |
|
416 |
+ * @author frac |
|
417 |
+ */ |
|
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); |
|
429 |
+ } |
|
430 |
+ catch (exception) { |
|
431 |
+ if (exception_is(exception, "Map:get:not_found")) |
|
432 |
+ return fallback; |
|
433 |
+ else |
|
434 |
+ throw exception; |
|
435 |
+ } |
|
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, " "); // 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 |
+ /** |
|
3686 |
+ * @author fenris |
|
3687 |
+ */ |
|
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)); |
|
3691 |
+ }; |
|
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; |
|
3718 |
+ /** |
|
3719 |
+ * @author fenris |
|
3720 |
+ */ |
|
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 () { |
|
3740 |
+ /** |
|
3741 |
+ * @author fenris |
|
3742 |
+ */ |
|
3743 |
+ function class_filepointer(location, filename) { |
|
3744 |
+ this.location = location; |
|
3745 |
+ this.filename = filename; |
|
3746 |
+ } |
|
3747 |
+ /** |
|
3748 |
+ * @author fenris |
|
3749 |
+ */ |
|
3750 |
+ class_filepointer.prototype.normalize = function () { |
|
3751 |
+ return (new class_filepointer(this.location.normalize(), this.filename)); |
|
3752 |
+ }; |
|
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; |
|
3775 |
+ /** |
|
3776 |
+ * @author fenris |
|
3777 |
+ */ |
|
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; |
|
318 | 3985 |
/** |
3986 |
+ * @desc writes a json file |
|
319 | 3987 |
* @author fenris |
320 | 3988 |
*/ |
321 |
- var class_rule = (function () { |
|
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) { |
|
322 | 3996 |
/** |
323 | 3997 |
* @author fenris |
324 | 3998 |
*/ |
325 |
- // public constructor(name : string, dependencies : Array<string>, actions : Array<string>, phony : boolean = false) { |
|
326 |
- function class_rule(parameters) { |
|
327 |
- if (parameters === void 0) { parameters = {}; } |
|
328 |
- this.name = fetch(parameters, "name", null, 2); |
|
329 |
- this.dependencies = fetch(parameters, "dependencies", [], 0); |
|
330 |
- this.actions = fetch(parameters, "actions", [], 0); |
|
331 |
- this.phony = fetch(parameters, "phony", false, 0); |
|
3999 |
+ var class_argument = (function () { |
|
4000 |
+ /** |
|
4001 |
+ * @author fenris |
|
4002 |
+ */ |
|
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; |
|
4005 |
+ this.name = name; |
|
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 |
+ } |
|
332 | 4016 |
} |
333 | 4017 |
/** |
334 | 4018 |
* @author fenris |
335 | 4019 |
*/ |
336 |
- class_rule.prototype.actions_get = function () { |
|
337 |
- return this.actions; |
|
4020 |
+ class_argument.prototype.check = function () { |
|
4021 |
+ var _this = this; |
|
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(); }); |
|
338 | 4025 |
}; |
339 | 4026 |
/** |
340 | 4027 |
* @author fenris |
341 | 4028 |
*/ |
342 |
- class_rule.prototype.compile = function (silent) { |
|
343 |
- if (silent === void 0) { silent = false; } |
|
344 |
- var output = ""; |
|
345 |
- output += (this.name + ":" + this.dependencies.map(function (dependency) { return (" " + dependency); }).join("") + "\n"); |
|
346 |
- this.actions.forEach(function (action) { return (output += "\t" + (silent ? "@ " : "") + action + "\n"); }); |
|
347 |
- if (this.phony) |
|
348 |
- output += (".PHONY: " + this.name + "\n"); |
|
349 |
- return output; |
|
4029 |
+ class_argument.prototype.name_get = function () { |
|
4030 |
+ return this.name; |
|
350 | 4031 |
}; |
351 |
- return class_rule; |
|
352 |
- }()); |
|
353 |
- lib_gnumake.class_rule = class_rule; |
|
354 | 4032 |
/** |
355 | 4033 |
* @author fenris |
356 | 4034 |
*/ |
357 |
- var class_sheet = (function () { |
|
4035 |
+ class_argument.prototype.type_get = function () { |
|
4036 |
+ return this.type; |
|
4037 |
+ }; |
|
358 | 4038 |
/** |
359 | 4039 |
* @author fenris |
360 | 4040 |
*/ |
361 |
- function class_sheet(rules, comments) { |
|
362 |
- if (comments === void 0) { comments = []; } |
|
363 |
- this.rules = rules; |
|
364 |
- this.comments = comments; |
|
365 |
- } |
|
4041 |
+ class_argument.prototype.default_get = function () { |
|
4042 |
+ return this.default_; |
|
4043 |
+ }; |
|
366 | 4044 |
/** |
367 | 4045 |
* @author fenris |
368 | 4046 |
*/ |
369 |
- class_sheet.prototype.compile = function (silent) { |
|
370 |
- if (silent === void 0) { silent = false; } |
|
371 |
- return ([] |
|
372 |
- .concat(this.comments.map(function (comment) { return ("# " + comment); })) |
|
373 |
- .concat([""]) |
|
374 |
- .concat(this.rules.map(function (rule) { return rule.compile(silent); })) |
|
375 |
- .join("\n")); |
|
4047 |
+ class_argument.prototype.kind_get = function () { |
|
4048 |
+ return this.kind; |
|
376 | 4049 |
}; |
377 |
- return class_sheet; |
|
378 |
- }()); |
|
379 |
- lib_gnumake.class_sheet = class_sheet; |
|
380 |
-})(lib_gnumake || (lib_gnumake = {})); |
|
381 | 4050 |
/** |
382 | 4051 |
* @author fenris |
383 | 4052 |
*/ |
384 |
-var lib_ant; |
|
385 |
-(function (lib_ant) { |
|
4053 |
+ class_argument.prototype.parameters_get = function () { |
|
4054 |
+ return this.parameters; |
|
4055 |
+ }; |
|
386 | 4056 |
/** |
387 | 4057 |
* @author fenris |
388 | 4058 |
*/ |
389 |
- var class_comment = (function () { |
|
4059 |
+ class_argument.prototype.hidden_get = function () { |
|
4060 |
+ return this.hidden; |
|
4061 |
+ }; |
|
390 | 4062 |
/** |
391 | 4063 |
* @author fenris |
392 | 4064 |
*/ |
393 |
- function class_comment(content) { |
|
394 |
- this.content = content; |
|
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; |
|
395 | 4077 |
} |
4078 |
+ }; |
|
396 | 4079 |
/** |
397 | 4080 |
* @author fenris |
398 | 4081 |
*/ |
399 |
- class_comment.prototype.compile = function () { |
|
400 |
- return (new lib_xml.class_node_comment(this.content)); |
|
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 |
+ } |
|
401 | 4105 |
}; |
402 |
- return class_comment; |
|
403 |
- }()); |
|
404 |
- lib_ant.class_comment = class_comment; |
|
405 | 4106 |
/** |
406 | 4107 |
* @author fenris |
407 | 4108 |
*/ |
408 |
- var class_action = (function () { |
|
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 |
+ }; |
|
409 | 4133 |
/** |
410 | 4134 |
* @author fenris |
411 | 4135 |
*/ |
412 |
- function class_action(representation) { |
|
413 |
- this.representation = representation; |
|
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)); |
|
414 | 4154 |
} |
4155 |
+ } |
|
4156 |
+ }; |
|
415 | 4157 |
/** |
416 | 4158 |
* @author fenris |
417 | 4159 |
*/ |
418 |
- class_action.prototype.compile = function () { |
|
419 |
- return this.representation; |
|
4160 |
+ class_argument.prototype.make = function (data) { |
|
4161 |
+ var value = data[this.name]; |
|
4162 |
+ return value.toString(); |
|
420 | 4163 |
}; |
421 |
- return class_action; |
|
4164 |
+ /** |
|
4165 |
+ * @author fenris |
|
4166 |
+ */ |
|
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; |
|
4188 |
+ }; |
|
4189 |
+ return class_argument; |
|
422 | 4190 |
}()); |
423 |
- lib_ant.class_action = class_action; |
|
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) { |
|
424 | 4196 |
/** |
425 | 4197 |
* @author fenris |
426 | 4198 |
*/ |
427 |
- var class_target = (function () { |
|
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 |
+ }; |
|
428 | 4217 |
/** |
429 | 4218 |
* @author fenris |
430 | 4219 |
*/ |
431 |
- function class_target(parameters) { |
|
432 |
- if (parameters === void 0) { parameters = {}; } |
|
433 |
- this.name = fetch(parameters, "name", null, 2); |
|
434 |
- this.dependencies = fetch(parameters, "dependencies", [], 1); |
|
435 |
- this.actions = fetch(parameters, "actions", [], 0); |
|
4220 |
+ lib_args.verbosity = 0; |
|
4221 |
+ /** |
|
4222 |
+ * @author fenris |
|
4223 |
+ * @todo check validity |
|
4224 |
+ */ |
|
4225 |
+ var class_handler = (function () { |
|
4226 |
+ /** |
|
4227 |
+ * @author fenris |
|
4228 |
+ */ |
|
4229 |
+ function class_handler(arguments_) { |
|
4230 |
+ this.arguments_ = arguments_; |
|
436 | 4231 |
} |
437 | 4232 |
/** |
438 | 4233 |
* @author fenris |
439 | 4234 |
*/ |
440 |
- class_target.prototype.actions_get = function () { |
|
441 |
- return this.actions; |
|
4235 |
+ class_handler.prototype.filter = function (kind) { |
|
4236 |
+ return this.arguments_.filter(function (argument) { return (argument.kind_get() == kind); }); |
|
442 | 4237 |
}; |
443 | 4238 |
/** |
444 | 4239 |
* @author fenris |
445 | 4240 |
*/ |
446 |
- class_target.prototype.compile = function () { |
|
447 |
- return (new lib_xml.class_node_complex("target", { |
|
448 |
- "name": this.name, |
|
449 |
- "depends": this.dependencies.join(",") |
|
450 |
- }, this.actions.map(function (action) { return action.compile(); }))); |
|
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 |
+ } |
|
451 | 4383 |
}; |
452 |
- return class_target; |
|
453 |
- }()); |
|
454 |
- lib_ant.class_target = class_target; |
|
455 | 4384 |
/** |
456 | 4385 |
* @author fenris |
4386 |
+ * @todo handle if the data object doesn't have the required field or the type is wrong or sth. |
|
457 | 4387 |
*/ |
458 |
- var class_project = (function () { |
|
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 |
+ }; |
|
459 | 4427 |
/** |
4428 |
+ * @desc manpage-like info-sheet |
|
460 | 4429 |
* @author fenris |
461 | 4430 |
*/ |
462 |
- function class_project(parameters) { |
|
463 |
- if (parameters === void 0) { parameters = {}; } |
|
464 |
- this.name = fetch(parameters, "name", null, 2); |
|
465 |
- this.default_ = fetch(parameters, "default", null, 2); |
|
466 |
- this.targets = fetch(parameters, "targets", [], 1); |
|
467 |
- this.comments = fetch(parameters, "comments", [], 0); |
|
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 |
+ } |
|
468 | 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; |
|
4536 |
+ }; |
|
4537 |
+ return class_handler; |
|
4538 |
+ }()); |
|
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 |
+}; |
|
469 | 4565 |
/** |
470 | 4566 |
* @author fenris |
471 | 4567 |
*/ |
472 |
- class_project.prototype.compile = function () { |
|
473 |
- return (new lib_xml.class_node_complex("project", { |
|
474 |
- "name": this.name, |
|
475 |
- "default": this.default_, |
|
476 |
- }, ([] |
|
477 |
- .concat(this.comments.map(function (comment) { return comment.compile(); })) |
|
478 |
- .concat(this.targets.map(function (target) { return target.compile(); }))))); |
|
479 |
- }; |
|
480 |
- return class_project; |
|
481 |
- }()); |
|
482 |
- lib_ant.class_project = class_project; |
|
483 |
-})(lib_ant || (lib_ant = {})); |
|
4568 |
+var class_message = (function () { |
|
484 | 4569 |
/** |
485 | 4570 |
* @author fenris |
486 | 4571 |
*/ |
487 |
-var __idcounter = 0; |
|
4572 |
+ function class_message(content, parameters) { |
|
4573 |
+ if (parameters === void 0) { parameters = {}; } |
|
488 | 4574 |
/** |
489 | 4575 |
* @author fenris |
490 | 4576 |
*/ |
491 |
-function genid(prefix) { |
|
492 |
- if (prefix === void 0) { prefix = ""; } |
|
493 |
- return (prefix + (__idcounter++).toString(16)); |
|
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); |
|
494 | 4583 |
} |
495 | 4584 |
/** |
496 | 4585 |
* @author fenris |
497 | 4586 |
*/ |
498 |
-function wait(dependencies, action) { |
|
499 |
- if (dependencies.length > 0) { |
|
500 |
- dependencies[0](function () { wait(dependencies.slice(1), action); }); |
|
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 + "]" + " "); |
|
501 | 4594 |
} |
502 |
- else { |
|
503 |
- action(); |
|
504 | 4595 |
} |
4596 |
+ if (this.prefix != null) { |
|
4597 |
+ output += ("<" + this.prefix + ">" + " "); |
|
4598 |
+ } |
|
4599 |
+ output += this.content; |
|
4600 |
+ if (this.linebreak) { |
|
4601 |
+ output += "\n"; |
|
505 | 4602 |
} |
4603 |
+ return output; |
|
4604 |
+ }; |
|
506 | 4605 |
/** |
507 | 4606 |
* @author fenris |
508 | 4607 |
*/ |
509 |
-function executor_chain(state, executors) { |
|
510 |
- if (state === void 0) { state = null; } |
|
511 |
- return (function (resolve, reject) { |
|
512 |
- if (executors.length == 0) { |
|
513 |
- resolve(state); |
|
514 |
- } |
|
515 |
- else { |
|
516 |
- executors[0](state)(function resolve_(state_) { |
|
517 |
- executor_chain(state_, executors.slice(1))(resolve, reject); |
|
518 |
- }, function reject_(reason_) { |
|
519 |
- reject(reason_); |
|
520 |
- }); |
|
521 |
- } |
|
522 |
- }); |
|
523 |
-} |
|
4608 |
+ class_message.prototype.stdout = function () { |
|
4609 |
+ console.log(this.generate(true)); |
|
4610 |
+ }; |
|
524 | 4611 |
/** |
525 | 4612 |
* @author fenris |
526 | 4613 |
*/ |
527 |
-function fetch(structure, fieldname, fallback, escalation) { |
|
528 |
- if (fallback === void 0) { fallback = undefined; } |
|
529 |
- if (escalation === void 0) { escalation = 1; } |
|
530 |
- if (fieldname in structure) { |
|
531 |
- return structure[fieldname]; |
|
532 |
- } |
|
533 |
- else { |
|
534 |
- var message = "field '" + fieldname + "' missing in structure"; |
|
535 |
- switch (escalation) { |
|
536 |
- case 0: { |
|
537 |
- return fallback; |
|
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)); |
|
538 | 4624 |
break; |
539 | 4625 |
} |
540 |
- case 1: { |
|
541 |
- message += ("; using fallback-value '" + String(fallback) + "'"); |
|
542 |
- (new class_message(message, { "type": "warning", "prefix": "koralle" })).stderr(); |
|
543 |
- return fallback; |
|
4626 |
+ case "information": { |
|
4627 |
+ console.info(this.generate(false)); |
|
544 | 4628 |
break; |
545 | 4629 |
} |
546 |
- case 2: { |
|
547 |
- throw (new Error(message)); |
|
4630 |
+ case "warning": { |
|
4631 |
+ console.warn(this.generate(false)); |
|
548 | 4632 |
break; |
549 | 4633 |
} |
550 |
- default: { |
|
4634 |
+ case "error": { |
|
4635 |
+ console.error(this.generate(false)); |
|
551 | 4636 |
break; |
552 | 4637 |
} |
4638 |
+ default: { |
|
4639 |
+ throw (new Error("unhandled type '" + this.type + "'")); |
|
553 | 4640 |
} |
554 | 4641 |
} |
555 |
-} |
|
4642 |
+ }; |
|
4643 |
+ return class_message; |
|
4644 |
+}()); |
|
556 | 4645 |
/** |
557 | 4646 |
* @author fenris |
558 | 4647 |
*/ |
559 |
-function read_json(path) { |
|
560 |
- return (function (resolve, reject) { |
|
561 |
- _fs.readFile(path, { |
|
562 |
- "encoding": "utf-8", |
|
563 |
- "flag": "r", |
|
564 |
- }, function (error, content) { |
|
565 |
- if (error != null) { |
|
566 |
- reject(error); |
|
567 |
- } |
|
568 |
- else { |
|
569 |
- try { |
|
570 |
- var data = JSON.parse(content); |
|
571 |
- resolve(data); |
|
572 |
- } |
|
573 |
- catch (exception) { |
|
574 |
- reject((exception)); |
|
575 |
- } |
|
576 |
- } |
|
577 |
- }); |
|
578 |
- }); |
|
4648 |
+var class_cliout = (function () { |
|
4649 |
+ function class_cliout() { |
|
579 | 4650 |
} |
580 | 4651 |
/** |
581 | 4652 |
* @author fenris |
582 | 4653 |
*/ |
583 |
-var class_error = (function (_super) { |
|
584 |
- __extends(class_error, _super); |
|
4654 |
+ class_cliout.stdout = function (content, depth) { |
|
4655 |
+ if (depth === void 0) { depth = 0; } |
|
4656 |
+ console.log(lib_string.repeat("\t", depth) + content); |
|
4657 |
+ }; |
|
585 | 4658 |
/** |
586 | 4659 |
* @author fenris |
587 | 4660 |
*/ |
588 |
- function class_error(text, sub) { |
|
589 |
- if (sub === void 0) { sub = []; } |
|
590 |
- _super.call(this, text); |
|
591 |
- this.text = text; |
|
592 |
- this.sub = sub; |
|
593 |
- } |
|
4661 |
+ class_cliout.stderr = function (content, depth) { |
|
4662 |
+ if (depth === void 0) { depth = 0; } |
|
4663 |
+ console.error(lib_string.repeat("\t", depth) + content); |
|
4664 |
+ }; |
|
594 | 4665 |
/** |
595 | 4666 |
* @author fenris |
596 | 4667 |
*/ |
597 |
- class_error.prototype.toString = function () { |
|
598 |
- return (this.text + " / " + this.sub.map(function (error) { return error.toString(); }).join(" ; ")); |
|
4668 |
+ class_cliout.log = function (content, depth) { |
|
4669 |
+ if (depth === void 0) { depth = 0; } |
|
4670 |
+ this.stderr("-- " + content, depth); |
|
599 | 4671 |
}; |
600 |
- return class_error; |
|
601 |
-}(Error)); |
|
602 | 4672 |
/** |
603 | 4673 |
* @author fenris |
604 | 4674 |
*/ |
605 |
-var lib_path; |
|
606 |
-(function (lib_path) { |
|
4675 |
+ class_cliout.info = function (content, depth) { |
|
4676 |
+ if (depth === void 0) { depth = 0; } |
|
4677 |
+ this.stderr(">> " + content, depth); |
|
4678 |
+ }; |
|
607 | 4679 |
/** |
608 | 4680 |
* @author fenris |
609 | 4681 |
*/ |
610 |
- var class_step = (function () { |
|
611 |
- function class_step() { |
|
612 |
- } |
|
613 |
- return class_step; |
|
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; |
|
614 | 4694 |
}()); |
615 | 4695 |
/** |
616 | 4696 |
* @author fenris |
617 | 4697 |
*/ |
618 |
- var class_step_stay = (function (_super) { |
|
619 |
- __extends(class_step_stay, _super); |
|
620 |
- function class_step_stay() { |
|
621 |
- _super.apply(this, arguments); |
|
622 |
- } |
|
4698 |
+var class_graph = (function () { |
|
623 | 4699 |
/** |
624 | 4700 |
* @author fenris |
625 | 4701 |
*/ |
626 |
- class_step_stay.prototype.toString = function () { |
|
627 |
- return "."; |
|
628 |
- }; |
|
629 |
- return class_step_stay; |
|
630 |
- }(class_step)); |
|
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 = []; } |
|
631 | 4706 |
/** |
632 | 4707 |
* @author fenris |
633 | 4708 |
*/ |
634 |
- var class_step_back = (function (_super) { |
|
635 |
- __extends(class_step_back, _super); |
|
636 |
- function class_step_back() { |
|
637 |
- _super.apply(this, arguments); |
|
4709 |
+ this.equality = (function (node1, node2) { return (node1 == node2); }); |
|
4710 |
+ this.equality = equality; |
|
4711 |
+ this.nodes = nodes; |
|
4712 |
+ this.edges = edges; |
|
638 | 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 |
+ }; |
|
639 | 4721 |
/** |
640 | 4722 |
* @author fenris |
641 | 4723 |
*/ |
642 |
- class_step_back.prototype.toString = function () { |
|
643 |
- return ".."; |
|
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))); }))); |
|
644 | 4727 |
}; |
645 |
- return class_step_back; |
|
646 |
- }(class_step)); |
|
647 | 4728 |
/** |
648 | 4729 |
* @author fenris |
649 | 4730 |
*/ |
650 |
- var class_step_regular = (function (_super) { |
|
651 |
- __extends(class_step_regular, _super); |
|
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 |
+ }; |
|
652 | 4735 |
/** |
653 | 4736 |
* @author fenris |
654 | 4737 |
*/ |
655 |
- function class_step_regular(name) { |
|
656 |
- _super.call(this); |
|
657 |
- this.name = name; |
|
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 []; |
|
4750 |
+ } |
|
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 |
+ } |
|
658 | 4770 |
} |
4771 |
+ }; |
|
659 | 4772 |
/** |
660 | 4773 |
* @author fenris |
661 | 4774 |
*/ |
662 |
- class_step_regular.prototype.toString = function () { |
|
663 |
- return this.name; |
|
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 |
+ }))); |
|
664 | 4783 |
}; |
665 |
- return class_step_regular; |
|
666 |
- }(class_step)); |
|
667 | 4784 |
/** |
668 | 4785 |
* @author fenris |
669 | 4786 |
*/ |
670 |
- function step_read(s) { |
|
671 |
- switch (s) { |
|
672 |
- case ".": { |
|
673 |
- return (new class_step_stay()); |
|
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; |
|
4799 |
+ } |
|
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) { |
|
4829 |
+ /** |
|
4830 |
+ * @author fenris |
|
4831 |
+ */ |
|
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; |
|
674 | 4850 |
} |
675 |
- case "..": { |
|
676 |
- return (new class_step_back()); |
|
4851 |
+ } |
|
4852 |
+ return command; |
|
4853 |
+ break; |
|
4854 |
+ } |
|
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; |
|
677 | 4877 |
} |
678 | 4878 |
default: { |
679 |
- return (new class_step_regular(s)); |
|
4879 |
+ throw (new Error("unhandled system '" + system + "'")); |
|
4880 |
+ break; |
|
680 | 4881 |
} |
681 | 4882 |
} |
682 | 4883 |
} |
4884 |
+ lib_gnumake.macro_command = macro_command; |
|
683 | 4885 |
/** |
684 | 4886 |
* @author fenris |
685 | 4887 |
*/ |
686 |
- var class_path = (function () { |
|
4888 |
+ var class_rule = (function () { |
|
687 | 4889 |
/** |
688 | 4890 |
* @author fenris |
689 | 4891 |
*/ |
690 |
- function class_path(steps) { |
|
691 |
- if (steps === void 0) { steps = []; } |
|
692 |
- this.steps = steps; |
|
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); |
|
693 | 4899 |
} |
694 | 4900 |
/** |
695 | 4901 |
* @author fenris |
696 | 4902 |
*/ |
697 |
- class_path.prototype.add = function (step) { |
|
698 |
- return (new class_path(this.steps.concat([step]))).normalize(); |
|
699 |
- }; |
|
700 |
- /** |
|
701 |
- * @author fenris |
|
702 |
- */ |
|
703 |
- class_path.prototype.extend = function (path) { |
|
704 |
- return (new class_path(this.steps.concat(path.steps))).normalize(); |
|
4903 |
+ class_rule.prototype.actions_get = function () { |
|
4904 |
+ return this.actions; |
|
705 | 4905 |
}; |
706 | 4906 |
/** |
707 | 4907 |
* @author fenris |
708 | 4908 |
*/ |
709 |
- class_path.prototype.normalize = function () { |
|
710 |
- var steps = this.steps; |
|
711 |
- // filter "stay" |
|
712 |
- { |
|
713 |
- steps = steps.filter(function (step) { return (!(step instanceof class_step_stay)); }); |
|
714 |
- } |
|
715 |
- // filter "regular-back" |
|
716 |
- { |
|
717 |
- var _loop_1 = function() { |
|
718 |
- // console.info(new class_path(steps).toString()); |
|
719 |
- if (steps.length < 1) { |
|
720 |
- return "break"; |
|
721 |
- } |
|
722 |
- else { |
|
723 |
- var last_1 = steps[0]; |
|
724 |
- var found = steps.slice(1).some(function (step, index) { |
|
725 |
- // console.info("--", step.toString()); |
|
726 |
- if (step instanceof class_step_back) { |
|
727 |
- if (last_1 instanceof class_step_regular) { |
|
728 |
- steps.splice(index, 2); |
|
729 |
- return true; |
|
730 |
- } |
|
731 |
- } |
|
732 |
- last_1 = step; |
|
733 |
- return false; |
|
734 |
- }); |
|
735 |
- if (!found) { |
|
736 |
- return "break"; |
|
737 |
- } |
|
738 |
- } |
|
739 |
- }; |
|
740 |
- while (true) { |
|
741 |
- var state_1 = _loop_1(); |
|
742 |
- if (state_1 === "break") break; |
|
743 |
- } |
|
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"); |
|
744 | 4916 |
} |
745 |
- return (new class_path(steps)); |
|
4917 |
+ return output; |
|
746 | 4918 |
}; |
4919 |
+ return class_rule; |
|
4920 |
+ }()); |
|
4921 |
+ lib_gnumake.class_rule = class_rule; |
|
747 | 4922 |
/** |
748 | 4923 |
* @author fenris |
749 | 4924 |
*/ |
750 |
- class_path.prototype.output = function (system) { |
|
751 |
- if (system === void 0) { system = "unix"; } |
|
752 |
- var splitter = { |
|
753 |
- "win": "\\", |
|
754 |
- "unix": "/", |
|
755 |
- }[system]; |
|
756 |
- return ((this.steps.length == 0) ? "./" : this.steps.map(function (step) { return (step.toString() + splitter); }).join("")); |
|
757 |
- }; |
|
4925 |
+ var class_sheet = (function () { |
|
758 | 4926 |
/** |
759 | 4927 |
* @author fenris |
760 | 4928 |
*/ |
761 |
- class_path.prototype.toString = function () { |
|
762 |
- return ((this.steps.length == 0) ? "./" : this.steps.map(function (step) { return (step.toString() + "/"); }).join("")); |
|
763 |
- }; |
|
4929 |
+ function class_sheet(rules, comments) { |
|
4930 |
+ if (comments === void 0) { comments = []; } |
|
4931 |
+ this.rules = rules; |
|
4932 |
+ this.comments = comments; |
|
4933 |
+ } |
|
764 | 4934 |
/** |
765 | 4935 |
* @author fenris |
766 | 4936 |
*/ |
767 |
- class_path.read = function (s) { |
|
768 |
- var parts = s.split("/"); |
|
769 |
- if (parts[parts.length - 1] == "") |
|
770 |
- parts.pop(); |
|
771 |
- return (new class_path(parts.map(step_read))); |
|
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")); |
|
772 | 4944 |
}; |
773 |
- return class_path; |
|
4945 |
+ return class_sheet; |
|
774 | 4946 |
}()); |
775 |
- lib_path.class_path = class_path; |
|
4947 |
+ lib_gnumake.class_sheet = class_sheet; |
|
4948 |
+})(lib_gnumake || (lib_gnumake = {})); |
|
776 | 4949 |
/** |
777 | 4950 |
* @author fenris |
778 | 4951 |
*/ |
779 |
- function path_read(s) { |
|
780 |
- return class_path.read(s); |
|
781 |
- } |
|
782 |
- lib_path.path_read = path_read; |
|
4952 |
+var lib_ant; |
|
4953 |
+(function (lib_ant) { |
|
783 | 4954 |
/** |
784 | 4955 |
* @author fenris |
785 | 4956 |
*/ |
786 |
- var class_location = (function () { |
|
4957 |
+ var class_comment = (function () { |
|
787 | 4958 |
/** |
788 | 4959 |
* @author fenris |
789 | 4960 |
*/ |
790 |
- function class_location(anchor, path) { |
|
791 |
- this.anchor = anchor; |
|
792 |
- this.path = path; |
|
4961 |
+ function class_comment(content) { |
|
4962 |
+ this.content = content; |
|
793 | 4963 |
} |
794 | 4964 |
/** |
795 | 4965 |
* @author fenris |
796 | 4966 |
*/ |
797 |
- class_location.prototype.extend = function (path) { |
|
798 |
- return (new class_location(this.anchor, this.path.extend(path))); |
|
4967 |
+ class_comment.prototype.compile = function () { |
|
4968 |
+ return (new lib_xml.class_node_comment(this.content)); |
|
799 | 4969 |
}; |
4970 |
+ return class_comment; |
|
4971 |
+ }()); |
|
4972 |
+ lib_ant.class_comment = class_comment; |
|
800 | 4973 |
/** |
801 | 4974 |
* @author fenris |
802 | 4975 |
*/ |
803 |
- class_location.prototype.go_thither = function () { |
|
804 |
- process.chdir(this.toString()); |
|
805 |
- }; |
|
4976 |
+ var class_action = (function () { |
|
806 | 4977 |
/** |
807 | 4978 |
* @author fenris |
808 | 4979 |
*/ |
809 |
- class_location.prototype.expedition = function (core) { |
|
810 |
- var that = this; |
|
811 |
- var current = location_read(process.cwd()); |
|
812 |
- function begin() { |
|
813 |
- // (new class_message("changing directory to '" + that.toString() + "'")).stderr(); |
|
814 |
- that.go_thither(); |
|
815 |
- } |
|
816 |
- function end() { |
|
817 |
- // (new class_message("changing directory to '" + current.toString() + "'")).stderr(); |
|
818 |
- current.go_thither(); |
|
4980 |
+ function class_action(representation) { |
|
4981 |
+ this.representation = representation; |
|
819 | 4982 |
} |
820 |
- begin(); |
|
821 |
- core(end); |
|
822 |
- }; |
|
823 | 4983 |
/** |
824 | 4984 |
* @author fenris |
825 | 4985 |
*/ |
826 |
- class_location.prototype.toString = function () { |
|
827 |
- return (((this.anchor != null) ? this.anchor : "") + this.path.toString()); |
|
4986 |
+ class_action.prototype.compile = function () { |
|
4987 |
+ return this.representation; |
|
828 | 4988 |
}; |
829 | 4989 |
/** |
830 | 4990 |
* @author fenris |
831 | 4991 |
*/ |
832 |
- class_location.read = function (s) { |
|
833 |
- if (s[0] == "/") { |
|
834 |
- return (new class_location("/", path_read(s.slice(1)))); |
|
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) { |
|
835 | 5018 |
} |
836 | 5019 |
else { |
837 |
- return (new class_location(null, path_read(s))); |
|
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 |
+ } |
|
838 | 5034 |
} |
839 | 5035 |
}; |
840 | 5036 |
/** |
841 | 5037 |
* @author fenris |
842 | 5038 |
*/ |
843 |
- class_location.current = function () { |
|
844 |
- return class_location.read(process.cwd()); |
|
845 |
- }; |
|
846 |
- return class_location; |
|
5039 |
+ class_action.macro_command = function (cmdparams) { return this.macro_exec(cmdparams); }; |
|
5040 |
+ return class_action; |
|
847 | 5041 |
}()); |
848 |
- lib_path.class_location = class_location; |
|
5042 |
+ lib_ant.class_action = class_action; |
|
849 | 5043 |
/** |
850 | 5044 |
* @author fenris |
851 | 5045 |
*/ |
852 |
- function location_read(s) { |
|
853 |
- return class_location.read(s); |
|
854 |
- } |
|
855 |
- lib_path.location_read = location_read; |
|
5046 |
+ var class_target = (function () { |
|
856 | 5047 |
/** |
857 | 5048 |
* @author fenris |
858 | 5049 |
*/ |
859 |
- var class_filepointer = (function () { |
|
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 |
+ } |
|
860 | 5056 |
/** |
861 | 5057 |
* @author fenris |
862 | 5058 |
*/ |
863 |
- function class_filepointer(location, filename) { |
|
864 |
- this.location = location; |
|
865 |
- this.filename = filename; |
|
866 |
- } |
|
5059 |
+ class_target.prototype.actions_get = function () { |
|
5060 |
+ return this.actions; |
|
5061 |
+ }; |
|
867 | 5062 |
/** |
868 | 5063 |
* @author fenris |
869 | 5064 |
*/ |
870 |
- class_filepointer.prototype.foo = function (filepointer) { |
|
871 |
- return (new class_filepointer(this.location.extend(filepointer.location.path), filepointer.filename)); |
|
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(); }))); |
|
872 | 5070 |
}; |
5071 |
+ return class_target; |
|
5072 |
+ }()); |
|
5073 |
+ lib_ant.class_target = class_target; |
|
873 | 5074 |
/** |
874 | 5075 |
* @author fenris |
875 | 5076 |
*/ |
876 |
- class_filepointer.prototype.toString = function () { |
|
877 |
- return (this.location.toString() /* + "/"*/ + ((this.filename == null) ? "" : this.filename)); |
|
878 |
- }; |
|
5077 |
+ var class_project = (function () { |
|
879 | 5078 |
/** |
880 | 5079 |
* @author fenris |
881 | 5080 |
*/ |
882 |
- class_filepointer.read = function (s) { |
|
883 |
- var parts = s.split("/"); |
|
884 |
- var last = parts[parts.length - 1]; |
|
885 |
- if (last == "") { |
|
886 |
- return (new class_filepointer(location_read(parts.join("/")), null)); |
|
887 |
- } |
|
888 |
- else { |
|
889 |
- return (new class_filepointer(location_read(parts.slice(0, parts.length - 1).join("/")), last)); |
|
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); |
|
890 | 5087 |
} |
891 |
- }; |
|
892 |
- return class_filepointer; |
|
893 |
- }()); |
|
894 |
- lib_path.class_filepointer = class_filepointer; |
|
895 | 5088 |
/** |
896 | 5089 |
* @author fenris |
897 | 5090 |
*/ |
898 |
- function filepointer_read(s) { |
|
899 |
- return class_filepointer.read(s); |
|
900 |
- } |
|
901 |
- lib_path.filepointer_read = filepointer_read; |
|
902 |
-})(lib_path || (lib_path = {})); |
|
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(); }))))); |
|
5103 |
+ }; |
|
5104 |
+ return class_project; |
|
5105 |
+ }()); |
|
5106 |
+ lib_ant.class_project = class_project; |
|
5107 |
+})(lib_ant || (lib_ant = {})); |
|
903 | 5108 |
/** |
904 | 5109 |
* @author fenris |
905 | 5110 |
*/ |
... | ... |
@@ -932,29 +5137,43 @@ var class_action_exec = (function (_super) { |
932 | 5137 |
/** |
933 | 5138 |
* @author fenris |
934 | 5139 |
*/ |
935 |
- function class_action_exec(paths_input, paths_output, path_script, path_interpreter) { |
|
5140 |
+ function class_action_exec(_a) { |
|
5141 |
+ var inputs = _a["inputs"], outputs = _a["outputs"], path = _a["path"], interpreter = _a["interpreter"], workdir = _a["workdir"]; |
|
936 | 5142 |
_super.call(this); |
937 |
- this.paths_input = paths_input; |
|
938 |
- this.paths_output = paths_output; |
|
939 |
- this.path_script = path_script; |
|
940 |
- this.path_interpreter = path_interpreter; |
|
5143 |
+ this.paths_input = inputs; |
|
5144 |
+ this.paths_output = outputs; |
|
5145 |
+ this.path_script = path; |
|
5146 |
+ this.path_interpreter = interpreter; |
|
5147 |
+ this.workdir = workdir; |
|
941 | 5148 |
} |
942 | 5149 |
/** |
943 | 5150 |
* @desc for defining directly how the action is to be converted into a target-piece |
944 | 5151 |
* @author fenris |
945 | 5152 |
*/ |
946 |
- class_action_exec.prototype.compilation = function (target_identifier) { |
|
947 |
- switch (target_identifier) { |
|
5153 |
+ class_action_exec.prototype.compilation = function (output_identifier) { |
|
5154 |
+ switch (output_identifier) { |
|
948 | 5155 |
case "gnumake": { |
949 |
- switch (configuration["system"]) { |
|
950 |
- case "unix": { |
|
951 |
- var parts = []; |
|
952 |
- if (this.path_interpreter != null) |
|
953 |
- parts.push(this.path_interpreter.toString()); |
|
954 |
- parts.push(this.path_script.toString()); |
|
955 |
- parts.push(this.paths_input.map(function (filepointer) { return filepointer.toString(); }).join(",")); |
|
956 |
- parts.push(this.paths_output.map(function (filepointer) { return filepointer.toString(); }).join(",")); |
|
957 |
- return parts.join(" "); |
|
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; |
|
958 | 5177 |
break; |
959 | 5178 |
} |
960 | 5179 |
default: { |
... | ... |
@@ -965,23 +5184,19 @@ var class_action_exec = (function (_super) { |
965 | 5184 |
break; |
966 | 5185 |
} |
967 | 5186 |
case "ant": { |
968 |
- if (this.path_interpreter == null) { |
|
969 |
- return (new lib_ant.class_action(new lib_xml.class_node_complex("exec", { "executable": this.path_script.toString() }, [ |
|
970 |
- new lib_xml.class_node_complex("arg", { "value": "'" + this.paths_input.map(function (filepointer) { return filepointer.toString(); }).join(",") + "'" }), |
|
971 |
- new lib_xml.class_node_complex("arg", { "value": "'" + this.paths_output.map(function (filepointer) { return filepointer.toString(); }).join(",") + "'" }), |
|
972 |
- ]))); |
|
973 |
- } |
|
974 |
- else { |
|
975 |
- return (new lib_ant.class_action(new lib_xml.class_node_complex("exec", { "executable": this.path_interpreter.toString() }, [ |
|
976 |
- new lib_xml.class_node_complex("arg", { "value": this.path_script.toString() }), |
|
977 |
- new lib_xml.class_node_complex("arg", { "value": "'" + this.paths_input.map(function (filepointer) { return filepointer.toString(); }).join(",") + "'" }), |
|
978 |
- new lib_xml.class_node_complex("arg", { "value": "'" + this.paths_output.map(function (filepointer) { return filepointer.toString(); }).join(",") + "'" }), |
|
979 |
- ]))); |
|
980 |
- } |
|
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 |
+ })); |
|
981 | 5196 |
break; |
982 | 5197 |
} |
983 | 5198 |
default: { |
984 |
- throw (new Error("unhandled target '" + target_identifier + "'")); |
|
5199 |
+ throw (new Error("unhandled output '" + output_identifier + "'")); |
|
985 | 5200 |
break; |
986 | 5201 |
} |
987 | 5202 |
} |
... | ... |
@@ -1009,10 +5224,11 @@ var class_action_echo = (function (_super) { |
1009 | 5224 |
switch (target_identifier) { |
1010 | 5225 |
case "gnumake": { |
1011 | 5226 |
switch (configuration["system"]) { |
1012 |
- case "unix": { |
|
5227 |
+ case "unix": |
|
5228 |
+ case "win": { |
|
1013 | 5229 |
var parts = []; |
1014 | 5230 |
parts.push("echo"); |
1015 |
- parts.push("'" + this.message + "'"); |
|
5231 |
+ parts.push("\"" + this.message + "\""); |
|
1016 | 5232 |
return parts.join(" "); |
1017 | 5233 |
break; |
1018 | 5234 |
} |
... | ... |
@@ -1043,57 +5259,75 @@ var class_action_koralle = (function (_super) { |
1043 | 5259 |
/** |
1044 | 5260 |
* @author fenris |
1045 | 5261 |
*/ |
1046 |
- function class_action_koralle(filepointer_in, filepointer_out, target, raw) { |
|
5262 |
+ function class_action_koralle(_a) { |
|
5263 |
+ var filepointer_in = _a["filepointer_in"], filepointer_out = _a["filepointer_out"], output = _a["output"], raw = _a["raw"]; |
|
1047 | 5264 |
_super.call(this); |
1048 | 5265 |
this.filepointer_in = filepointer_in; |
1049 | 5266 |
this.filepointer_out = filepointer_out; |
1050 |
- this.target = target; |
|
5267 |
+ this.output = output; |
|
1051 | 5268 |
this.raw = raw; |
1052 | 5269 |
} |
1053 | 5270 |
/** |
1054 |
- * @desc for defining directly how the action is to be converted into a target-piece |
|
5271 |
+ * @desc for defining directly how the action is to be converted into an output-piece |
|
1055 | 5272 |
* @author fenris |
1056 | 5273 |
*/ |
1057 |
- class_action_koralle.prototype.compilation = function (target_identifier) { |
|
1058 |
- switch (target_identifier) { |
|
5274 |
+ class_action_koralle.prototype.compilation = function (output_identifier) { |
|
5275 |
+ switch (output_identifier) { |
|
1059 | 5276 |
case "gnumake": { |
1060 |
- switch (configuration["system"]) { |
|
1061 |
- case "unix": { |
|
5277 |
+ switch (configuration.system) { |
|
5278 |
+ case "unix": |
|
5279 |
+ case "win": { |
|
1062 | 5280 |
var parts = []; |
1063 |
- parts.push("koralle"); |
|
1064 |
- parts.push("--target=" + this.target); |
|
1065 |
- if (this.raw) |
|
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) { |
|
1066 | 5289 |
parts.push("--raw"); |
1067 |
- parts.push(this.filepointer_in.toString()); |
|
1068 |
- return (parts.join(" ") + " > " + this.filepointer_out.toString()); |
|
5290 |
+ } |
|
5291 |
+ parts.push("--file=" + this.filepointer_out.as_string(configuration.system)); |
|
5292 |
+ return (parts.join(" ")); |
|
5293 |
+ break; |
|
1069 | 5294 |
} |
1070 | 5295 |
default: { |
1071 | 5296 |
throw (new Error("not implemented")); |
5297 |
+ break; |
|
1072 | 5298 |
} |
1073 | 5299 |
} |
1074 | 5300 |
break; |
1075 | 5301 |
} |
1076 | 5302 |
case "ant": { |
1077 |
- return (new lib_ant.class_action(new lib_xml.class_node_complex("exec", { |
|
1078 |
- "executable": "koralle", |
|
1079 |
- "output": this.filepointer_out.toString(), |
|
1080 |
- }, ([] |
|
1081 |
- .concat([ |
|
1082 |
- new lib_xml.class_node_complex("arg", { "value": "--target=" + this.target }) |
|
1083 |
- ]) |
|
1084 |
- .concat(this.raw |
|
1085 |
- ? |
|
1086 |
- [ |
|
1087 |
- new lib_xml.class_node_complex("arg", { "value": "--raw" }), |
|
1088 |
- ] |
|
1089 |
- : |
|
1090 |
- []) |
|
1091 |
- .concat([ |
|
1092 |
- new lib_xml.class_node_complex("arg", { "value": this.filepointer_in.toString() }) |
|
1093 |
- ]))))); |
|
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; |
|
1094 | 5320 |
} |
1095 | 5321 |
default: { |
1096 |
- throw (new Error("unhandled target '" + target_identifier + "'")); |
|
5322 |
+ throw (new Error("not implemented")); |
|
5323 |
+ break; |
|
5324 |
+ } |
|
5325 |
+ } |
|
5326 |
+ break; |
|
5327 |
+ } |
|
5328 |
+ default: { |
|
5329 |
+ throw (new Error("unhandled output '" + output_identifier + "'")); |
|
5330 |
+ break; |
|
1097 | 5331 |
} |
1098 | 5332 |
} |
1099 | 5333 |
}; |
... | ... |
@@ -1129,26 +5363,32 @@ var class_action_gnumake = (function (_super) { |
1129 | 5363 |
* @desc for defining directly how the action is to be converted into a target-piece |
1130 | 5364 |
* @author fenris |
1131 | 5365 |
*/ |
1132 |
- class_action_gnumake.prototype.compilation = function (target_identifier) { |
|
1133 |
- switch (target_identifier) { |
|
5366 |
+ class_action_gnumake.prototype.compilation = function (output_identifier) { |
|
5367 |
+ switch (output_identifier) { |
|
1134 | 5368 |
case "gnumake": { |
1135 |
- switch (configuration["system"]) { |
|
1136 |
- case "unix": { |
|
5369 |
+ switch (configuration.system) { |
|
5370 |
+ case "unix": |
|
5371 |
+ case "win": { |
|
1137 | 5372 |
// cmd_cd1 |
1138 | 5373 |
var cmd_cd1 = void 0; |
1139 | 5374 |
{ |
1140 | 5375 |
var parts = []; |
1141 |
- parts.push("cd"); |
|
1142 |
- parts.push(this.workdir.toString()); |
|
5376 |
+ parts.push("pushd"); |
|
5377 |
+ parts.push(this.workdir.as_string(configuration.system)); |
|
5378 |
+ if (configuration.system == "unix") { |
|
5379 |
+ parts.push("> /dev/null"); |
|
5380 |
+ } |
|
1143 | 5381 |
cmd_cd1 = parts.join(" "); |
1144 | 5382 |
} |
1145 | 5383 |
// cmd_cd2 |
1146 | 5384 |
var cmd_cd2 = void 0; |
1147 | 5385 |
{ |
1148 | 5386 |
var parts = []; |
1149 |
- parts.push("cd"); |
|
1150 |
- parts.push("-"); |
|
1151 |
- cmd_cd2 = parts.join(" ") + " > /dev/null"; |
|
5387 |
+ parts.push("popd"); |
|
5388 |
+ if (configuration.system == "unix") { |
|
5389 |
+ parts.push("> /dev/null"); |
|
5390 |
+ } |
|
5391 |
+ cmd_cd2 = parts.join(" "); |
|
1152 | 5392 |
} |
1153 | 5393 |
// cmd_make |
1154 | 5394 |
var cmd_make = void 0; |
... | ... |
@@ -1156,13 +5396,17 @@ var class_action_gnumake = (function (_super) { |
1156 | 5396 |
var parts = []; |
1157 | 5397 |
parts.push("make"); |
1158 | 5398 |
parts.push("--no-print-directory"); |
1159 |
- parts.push("--file=" + this.filepointer.toString()); |
|
5399 |
+ parts.push("--directory=" + this.workdir.as_string(configuration.system)); |
|
5400 |
+ parts.push("--file=" + this.filepointer.as_string(configuration.system)); |
|
1160 | 5401 |
cmd_make = parts.join(" "); |
1161 | 5402 |
} |
1162 |
- return ((this.workdir == null) ? [cmd_make] : [cmd_cd1, cmd_make, cmd_cd2]).join(" && "); |
|
5403 |
+ // return ((this.workdir == null) ? [cmd_make] : [cmd_cd1, cmd_make, cmd_cd2]).join(" && "); |
|
5404 |
+ return [cmd_make]; |
|
5405 |
+ break; |
|
1163 | 5406 |
} |
1164 | 5407 |
default: { |
1165 | 5408 |
throw (new Error("not implemented")); |
5409 |
+ break; |
|
1166 | 5410 |
} |
1167 | 5411 |
} |
1168 | 5412 |
break; |
... | ... |
@@ -1174,19 +5418,21 @@ var class_action_gnumake = (function (_super) { |
1174 | 5418 |
"executable": "make", |
1175 | 5419 |
}, [ |
1176 | 5420 |
new lib_xml.class_node_complex("arg", { "value": "--no-print-directory" }), |
1177 |
- new lib_xml.class_node_complex("arg", { "value": "--file=" + this.filepointer.toString() }), |
|
5421 |
+ new lib_xml.class_node_complex("arg", { "value": "--file=" + this.filepointer.as_string("unix") }), |
|
1178 | 5422 |
]) |
1179 | 5423 |
: |
1180 | 5424 |
new lib_xml.class_node_complex("exec", { |
1181 | 5425 |
"executable": "make", |
1182 |
- "dir": this.workdir.toString(), |
|
5426 |
+ "dir": this.workdir.as_string("unix"), |
|
1183 | 5427 |
}, [ |
1184 | 5428 |
new lib_xml.class_node_complex("arg", { "value": "--no-print-directory" }), |
1185 |
- new lib_xml.class_node_complex("arg", { "value": "--file=" + this.filepointer.toString() }), |
|
5429 |
+ new lib_xml.class_node_complex("arg", { "value": "--file=" + this.filepointer.as_string("unix") }), |
|
1186 | 5430 |
]))); |
5431 |
+ break; |
|
1187 | 5432 |
} |
1188 | 5433 |
default: { |
1189 |
- throw (new Error("unhandled target '" + target_identifier + "'")); |
|
5434 |
+ throw (new Error("unhandled target '" + output_identifier + "'")); |
|
5435 |
+ break; |
|
1190 | 5436 |
} |
1191 | 5437 |
} |
1192 | 5438 |
}; |
... | ... |
@@ -1255,9 +5501,11 @@ var class_action_ant = (function (_super) { |
1255 | 5501 |
"antfile": this.filepointer.toString(), |
1256 | 5502 |
"dir": this.workdir.toString(), |
1257 | 5503 |
}))); |
5504 |
+ break; |
|
1258 | 5505 |
} |
1259 | 5506 |
default: { |
1260 | 5507 |
throw (new Error("unhandled target '" + target_identifier + "'")); |
5508 |
+ break; |
|
1261 | 5509 |
} |
1262 | 5510 |
} |
1263 | 5511 |
}; |
... | ... |
@@ -1282,13 +5530,15 @@ var class_action_mkdir = (function (_super) { |
1282 | 5530 |
class_action_mkdir.prototype.compilation = function (target_identifier) { |
1283 | 5531 |
switch (target_identifier) { |
1284 | 5532 |
case "gnumake": { |
1285 |
- switch (configuration["system"]) { |
|
1286 |
- case "unix": { |
|
1287 | 5533 |
var parts = []; |
1288 | 5534 |
parts.push("mkdir"); |
1289 |
- parts.push("--parents"); |
|
1290 |
- parts.push(this.location.toString()); |
|
1291 |
- return parts.join(" "); |
|
5535 |
+ switch (configuration["system"]) { |
|
5536 |
+ case "unix": { |
|
5537 |
+ // parts.push("--parents"); |
|
5538 |
+ parts.push("-p"); |
|
5539 |
+ break; |
|
5540 |
+ } |
|
5541 |
+ case "win": { |
|
1292 | 5542 |
break; |
1293 | 5543 |
} |
1294 | 5544 |
default: { |
... | ... |
@@ -1296,15 +5546,14 @@ var class_action_mkdir = (function (_super) { |
1296 | 5546 |
break; |
1297 | 5547 |
} |
1298 | 5548 |
} |
1299 |
- break; |
|
5549 |
+ parts.push(this.location.as_string(configuration["system"])); |
|
5550 |
+ return parts.join(" "); |
|
1300 | 5551 |
} |
1301 | 5552 |
case "ant": { |
1302 |
- return (new lib_ant.class_action(new lib_xml.class_node_complex("mkdir", { "dir": this.location.toString() }))); |
|
1303 |
- break; |
|
5553 |
+ return (new lib_ant.class_action(new lib_xml.class_node_complex("mkdir", { "dir": this.location.as_string("unix") }))); |
|
1304 | 5554 |
} |
1305 | 5555 |
default: { |
1306 | 5556 |
throw (new Error("unhandled target '" + target_identifier + "'")); |
1307 |
- break; |
|
1308 | 5557 |
} |
1309 | 5558 |
} |
1310 | 5559 |
}; |
... | ... |
@@ -1336,6 +5585,13 @@ var class_action_touch = (function (_super) { |
1336 | 5585 |
parts.push(this.filepointer.toString()); |
1337 | 5586 |
return parts.join(" "); |
1338 | 5587 |
} |
5588 |
+ case "win": { |
|
5589 |
+ var parts = []; |
|
5590 |
+ parts.push("echo."); |
|
5591 |
+ parts.push(">"); |
|
5592 |
+ parts.push(this.filepointer.toString()); |
|
5593 |
+ return parts.join(" "); |
|
5594 |
+ } |
|
1339 | 5595 |
default: { |
1340 | 5596 |
throw (new Error("not implemented")); |
1341 | 5597 |
} |
... | ... |
@@ -1373,20 +5629,21 @@ var class_action_copy = (function (_super) { |
1373 | 5629 |
class_action_copy.prototype.compilation = function (target_identifier) { |
1374 | 5630 |
switch (target_identifier) { |
1375 | 5631 |
case "gnumake": { |
1376 |
- switch (configuration["system"]) { |
|
1377 |
- case "unix": { |
|
5632 |
+ switch (configuration.system) { |
|
5633 |
+ case "unix": |
|
5634 |
+ case "win": { |
|
1378 | 5635 |
var parts = []; |
1379 | 5636 |
parts.push("cp"); |
1380 | 5637 |
if (this.folder) { |
1381 | 5638 |
parts.push("--recursive"); |
1382 | 5639 |
parts.push("--update"); |
1383 | 5640 |
parts.push("--verbose"); |
1384 |
- parts.push((new lib_path.class_filepointer(this.filepointer_from.location, "*")).toString()); |
|
5641 |
+ parts.push((new lib_path.class_filepointer(this.filepointer_from.location, "*")).as_string(configuration.system)); |
|
1385 | 5642 |
} |
1386 | 5643 |
else { |
1387 |
- parts.push(this.filepointer_from.toString()); |
|
5644 |
+ parts.push(this.filepointer_from.as_string(configuration.system)); |
|
1388 | 5645 |
} |
1389 |
- parts.push(this.filepointer_to.toString()); |
|
5646 |
+ parts.push(this.filepointer_to.as_string(configuration.system)); |
|
1390 | 5647 |
return parts.join(" "); |
1391 | 5648 |
break; |
1392 | 5649 |
} |
... | ... |
@@ -1400,16 +5657,16 @@ var class_action_copy = (function (_super) { |
1400 | 5657 |
case "ant": { |
1401 | 5658 |
if (!this.folder) { |
1402 | 5659 |
return (new lib_ant.class_action(new lib_xml.class_node_complex("copy", { |
1403 |
- "file": this.filepointer_from.toString(), |
|
1404 |
- "tofile": this.filepointer_to.toString(), |
|
5660 |
+ "file": this.filepointer_from.as_string("unix"), |
|
5661 |
+ "tofile": this.filepointer_to.as_string("unix"), |
|
1405 | 5662 |
}))); |
1406 | 5663 |
} |
1407 | 5664 |
else { |
1408 | 5665 |
return (new lib_ant.class_action(new lib_xml.class_node_complex("copy", { |
1409 |
- "todir": this.filepointer_to.toString(), |
|
5666 |
+ "todir": this.filepointer_to.as_string("unix"), |
|
1410 | 5667 |
}, [ |
1411 | 5668 |
new lib_xml.class_node_complex("fileset", { |
1412 |
- "dir": this.filepointer_from.toString(), |
|
5669 |
+ "dir": this.filepointer_from.as_string("unix"), |
|
1413 | 5670 |
}) |
1414 | 5671 |
]))); |
1415 | 5672 |
} |
... | ... |
@@ -1426,46 +5683,112 @@ var class_action_copy = (function (_super) { |
1426 | 5683 |
/** |
1427 | 5684 |
* @author fenris |
1428 | 5685 |
*/ |
1429 |
-var class_action_concat = (function (_super) { |
|
1430 |
- __extends(class_action_concat, _super); |
|
5686 |
+var class_action_move = (function (_super) { |
|
5687 |
+ __extends(class_action_move, _super); |
|
1431 | 5688 |
/** |
1432 | 5689 |
* @author fenris |
1433 | 5690 |
*/ |
1434 |
- function class_action_concat(filepointers_from, filepointer_to) { |
|
5691 |
+ function class_action_move(_a) { |
|
5692 |
+ var from = _a["from"], to = _a["to"]; |
|
1435 | 5693 |
_super.call(this); |
1436 |
- this.filepointers_from = filepointers_from; |
|
1437 |
- this.filepointer_to = filepointer_to; |
|
5694 |
+ this.from = from; |
|
5695 |
+ this.to = to; |
|
1438 | 5696 |
} |
1439 | 5697 |
/** |
1440 | 5698 |
* @desc for defining directly how the action is to be converted into a target-piece |
1441 | 5699 |
* @author fenris |
1442 | 5700 |
*/ |
1443 |
- class_action_concat.prototype.compilation = function (target_identifier) { |
|
1444 |
- switch (target_identifier) { |
|
5701 |
+ class_action_move.prototype.compilation = function (output_identifier) { |
|
5702 |
+ switch (output_identifier) { |
|
1445 | 5703 |
case "gnumake": { |
1446 |
- switch (configuration["system"]) { |
|
1447 |
- case "unix": { |
|
1448 |
- var parts_1 = []; |
|
1449 |
- parts_1.push("cat"); |
|
1450 |
- this.filepointers_from.forEach(function (filepointer) { return parts_1.push(filepointer.toString()); }); |
|
1451 |
- parts_1.push(">"); |
|
1452 |
- parts_1.push(this.filepointer_to.toString()); |
|
1453 |
- return parts_1.join(" "); |
|
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; |
|
5719 |
+ } |
|
5720 |
+ return command; |
|
5721 |
+ break; |
|
1454 | 5722 |
} |
1455 | 5723 |
default: { |
1456 | 5724 |
throw (new Error("not implemented")); |
5725 |
+ break; |
|
5726 |
+ } |
|
5727 |
+ } |
|
5728 |
+ break; |
|
1457 | 5729 |
} |
5730 |
+ case "ant": { |
|
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 |
+ }))); |
|
5735 |
+ break; |
|
5736 |
+ } |
|
5737 |
+ default: { |
|
5738 |
+ throw (new Error("unhandled output '" + output_identifier + "'")); |
|
5739 |
+ break; |
|
5740 |
+ } |
|
5741 |
+ } |
|
5742 |
+ }; |
|
5743 |
+ return class_action_move; |
|
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 |
+ */ |
|
5753 |
+ function class_action_concat(sources, destination) { |
|
5754 |
+ _super.call(this); |
|
5755 |
+ this.sources = sources; |
|
5756 |
+ this.destination = destination; |
|
5757 |
+ } |
|
5758 |
+ /** |
|
5759 |
+ * @desc for defining directly how the action is to be converted into a target-piece |
|
5760 |
+ * @author fenris |
|
5761 |
+ */ |
|
5762 |
+ class_action_concat.prototype.compilation = function (output_identifier) { |
|
5763 |
+ switch (output_identifier) { |
|
5764 |
+ case "gnumake": { |
|
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 |
+ })); |
|
5774 |
+ } |
|
5775 |
+ else { |
|
5776 |
+ return (lib_gnumake.macro_command({ |
|
5777 |
+ "path": "touch", |
|
5778 |
+ "output": this.destination.as_string(configuration.system), |
|
5779 |
+ })); |
|
1458 | 5780 |
} |
5781 |
+ break; |
|
1459 | 5782 |
} |
1460 | 5783 |
case "ant": { |
1461 |
- return (new lib_ant.class_action(new lib_xml.class_node_complex("concat", { "destfile": this.filepointer_to.toString() }, [ |
|
1462 |
- new lib_xml.class_node_complex("filelist", { "dir": "." }, this.filepointers_from.map(function (filepointer) { |
|
1463 |
- return (new lib_xml.class_node_complex("file", { "name": filepointer.toString() })); |
|
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") })); |
|
1464 | 5787 |
})) |
1465 | 5788 |
]))); |
1466 | 5789 |
} |
1467 | 5790 |
default: { |
1468 |
- throw (new Error("unhandled target '" + target_identifier + "'")); |
|
5791 |
+ throw (new Error("unhandled output '" + output_identifier + "'")); |
|
1469 | 5792 |
} |
1470 | 5793 |
} |
1471 | 5794 |
}; |
... | ... |
@@ -1491,7 +5814,8 @@ var class_action_lessc = (function (_super) { |
1491 | 5814 |
switch (target_identifier) { |
1492 | 5815 |
case "gnumake": { |
1493 | 5816 |
switch (configuration["system"]) { |
1494 |
- case "unix": { |
|
5817 |
+ case "unix": |
|
5818 |
+ case "win": { |
|
1495 | 5819 |
var parts = []; |
1496 | 5820 |
parts.push("lessc"); |
1497 | 5821 |
parts.push(this.filepointer_from.toString()); |
... | ... |
@@ -1507,12 +5831,29 @@ var class_action_lessc = (function (_super) { |
1507 | 5831 |
break; |
1508 | 5832 |
} |
1509 | 5833 |
case "ant": { |
5834 |
+ switch (configuration["system"]) { |
|
5835 |
+ case "unix": { |
|
1510 | 5836 |
return (new lib_ant.class_action(new lib_xml.class_node_complex("exec", { |
1511 | 5837 |
"executable": "lessc", |
1512 | 5838 |
"output": this.filepointer_to.toString(), |
1513 | 5839 |
}, [ |
1514 | 5840 |
new lib_xml.class_node_complex("arg", { "value": this.filepointer_from.toString() }), |
1515 | 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 |
+ } |
|
1516 | 5857 |
break; |
1517 | 5858 |
} |
1518 | 5859 |
default: { |
... | ... |
@@ -1523,6 +5864,72 @@ var class_action_lessc = (function (_super) { |
1523 | 5864 |
}; |
1524 | 5865 |
return class_action_lessc; |
1525 | 5866 |
}(class_action_adhoc)); |
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)); |
|
1526 | 5933 |
/** |
1527 | 5934 |
* @author fenris |
1528 | 5935 |
*/ |
... | ... |
@@ -1541,62 +5948,49 @@ var class_action_tsc = (function (_super) { |
1541 | 5948 |
} |
1542 | 5949 |
/** |
1543 | 5950 |
* @author fenris |
5951 |
+ * @todo handle declarion-path |
|
1544 | 5952 |
*/ |
1545 |
- class_action_tsc.prototype.compilation = function (target_identifier) { |
|
1546 |
- switch (target_identifier) { |
|
1547 |
- case "gnumake": { |
|
1548 |
- switch (configuration["system"]) { |
|
1549 |
- case "unix": { |
|
1550 |
- var parts_2 = []; |
|
1551 |
- parts_2.push("tsc"); |
|
1552 |
- if (this.allowUnreachableCode) |
|
1553 |
- parts_2.push("--allowUnreachableCode"); |
|
1554 |
- if (this.declaration) |
|
1555 |
- parts_2.push("--declaration"); |
|
1556 |
- if (this.target != null) |
|
1557 |
- parts_2.push("--target"); |
|
1558 |
- parts_2.push(this.target); |
|
1559 |
- this.paths_input.forEach(function (filepointer) { return parts_2.push(filepointer.toString()); }); |
|
1560 |
- parts_2.push("--outFile"); |
|
1561 |
- parts_2.push(this.path_output.toString()); |
|
1562 |
- return parts_2.join(" "); |
|
1563 |
- break; |
|
5953 |
+ class_action_tsc.prototype.compilation = function (output_identifier) { |
|
5954 |
+ var args = []; |
|
5955 |
+ { |
|
5956 |
+ if (this.allowUnreachableCode) { |
|
5957 |
+ args.push("--allowUnreachableCode"); |
|
1564 | 5958 |
} |
1565 |
- default: { |
|
1566 |
- throw (new Error("not implemented")); |
|
1567 |
- break; |
|
5959 |
+ } |
|
5960 |
+ { |
|
5961 |
+ if (this.declaration != null) { |
|
5962 |
+ args.push("--declaration"); |
|
1568 | 5963 |
} |
1569 | 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) { |
|
5984 |
+ case "gnumake": { |
|
5985 |
+ return lib_gnumake.macro_command(cmdparams); |
|
1570 | 5986 |
break; |
1571 | 5987 |
} |
1572 | 5988 |
case "ant": { |
1573 |
- return (new lib_ant.class_action(new lib_xml.class_node_complex("exec", { "executable": "tsc" }, ([] |
|
1574 |
- .concat(this.paths_input.map(function (filepointer) { |
|
1575 |
- return (new lib_xml.class_node_complex("arg", { "value": filepointer.toString() })); |
|
1576 |
- })) |
|
1577 |
- .concat(this.allowUnreachableCode |
|
1578 |
- ? |
|
1579 |
- [ |
|
1580 |
- new lib_xml.class_node_complex("arg", { "value": "--allowUnreachableCode" }), |
|
1581 |
- ] |
|
1582 |
- : |
|
1583 |
- []) |
|
1584 |
- .concat((this.target != null) |
|
1585 |
- ? |
|
1586 |
- [ |
|
1587 |
- new lib_xml.class_node_complex("arg", { "value": "--target" }), |
|
1588 |
- new lib_xml.class_node_complex("arg", { "value": this.target }), |
|
1589 |
- ] |
|
1590 |
- : |
|
1591 |
- []) |
|
1592 |
- .concat([ |
|
1593 |
- new lib_xml.class_node_complex("arg", { "value": "--outFile" }), |
|
1594 |
- new lib_xml.class_node_complex("arg", { "value": this.path_output.toString() }), |
|
1595 |
- ]))))); |
|
5989 |
+ return lib_ant.class_action.macro_command(cmdparams); |
|
1596 | 5990 |
break; |
1597 | 5991 |
} |
1598 | 5992 |
default: { |
1599 |
- throw (new Error("unhandled target '" + target_identifier + "'")); |
|
5993 |
+ throw (new Error("unhandled output '" + output_identifier + "'")); |
|
1600 | 5994 |
break; |
1601 | 5995 |
} |
1602 | 5996 |
} |
... | ... |
@@ -1611,11 +6005,12 @@ var class_action_php = (function (_super) { |
1611 | 6005 |
/** |
1612 | 6006 |
* @author fenris |
1613 | 6007 |
*/ |
1614 |
- function class_action_php(filepointers_from, filepointer_to, only_first) { |
|
6008 |
+ function class_action_php(filepointers_from, filepointer_to, only_first, only_last) { |
|
1615 | 6009 |
_super.call(this); |
1616 | 6010 |
this.filepointers_from = filepointers_from; |
1617 | 6011 |
this.filepointer_to = filepointer_to; |
1618 | 6012 |
this.only_first = only_first; |
6013 |
+ this.only_last = only_last; |
|
1619 | 6014 |
} |
1620 | 6015 |
/** |
1621 | 6016 |
* @desc for defining directly how the action is to be converted into a target-piece |
... | ... |
@@ -1624,19 +6019,72 @@ var class_action_php = (function (_super) { |
1624 | 6019 |
class_action_php.prototype.compilation = function (target_identifier) { |
1625 | 6020 |
switch (target_identifier) { |
1626 | 6021 |
case "gnumake": { |
1627 |
- switch (configuration["system"]) { |
|
6022 |
+ switch (configuration.system) { |
|
1628 | 6023 |
case "unix": { |
1629 |
- var parts_3 = []; |
|
1630 |
- parts_3.push("php"); |
|
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()); |
|
6028 |
+ } |
|
6029 |
+ else { |
|
1631 | 6030 |
if (this.only_first) { |
1632 |
- parts_3.push(this.filepointers_from[0].toString()); |
|
6031 |
+ parts_4.push(this.filepointers_from[0].toString()); |
|
1633 | 6032 |
} |
1634 | 6033 |
else { |
1635 |
- this.filepointers_from.forEach(function (filepointer) { return parts_3.push(filepointer.toString()); }); |
|
6034 |
+ this.filepointers_from.forEach(function (filepointer) { return parts_4.push(filepointer.toString()); }); |
|
1636 | 6035 |
} |
1637 |
- parts_3.push(">"); |
|
1638 |
- parts_3.push(this.filepointer_to.toString()); |
|
1639 |
- return parts_3.join(" "); |
|
6036 |
+ } |
|
6037 |
+ parts_4.push(">"); |
|
6038 |
+ parts_4.push(this.filepointer_to.toString()); |
|
6039 |
+ return parts_4.join(" "); |
|
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 |
+ */ |
|
6064 |
+var class_action_gitpull = (function (_super) { |
|
6065 |
+ __extends(class_action_gitpull, _super); |
|
6066 |
+ /** |
|
6067 |
+ * @author fenris |
|
6068 |
+ */ |
|
6069 |
+ function class_action_gitpull(url) { |
|
6070 |
+ _super.call(this); |
|
6071 |
+ this.url = url; |
|
6072 |
+ } |
|
6073 |
+ /** |
|
6074 |
+ * @desc for defining directly how the action is to be converted into a target-piece |
|
6075 |
+ * @todo escape message |
|
6076 |
+ * @author fenris |
|
6077 |
+ */ |
|
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(" "); |
|
1640 | 6088 |
break; |
1641 | 6089 |
} |
1642 | 6090 |
default: { |
... | ... |
@@ -1646,8 +6094,120 @@ var class_action_php = (function (_super) { |
1646 | 6094 |
} |
1647 | 6095 |
break; |
1648 | 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 |
+ } |
|
6114 |
+ } |
|
6115 |
+ }; |
|
6116 |
+ return class_action_gitpull; |
|
6117 |
+}(class_action_adhoc)); |
|
6118 |
+/** |
|
6119 |
+ * @author fenris |
|
6120 |
+ */ |
|
6121 |
+var class_action_schwamm_create = (function (_super) { |
|
6122 |
+ __extends(class_action_schwamm_create, _super); |
|
6123 |
+ /** |
|
6124 |
+ * @author fenris |
|
6125 |
+ */ |
|
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 |
+ } |
|
6133 |
+ /** |
|
6134 |
+ * @desc for defining directly how the action is to be converted into a target-piece |
|
6135 |
+ * @author fenris |
|
6136 |
+ */ |
|
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 |
+ } |
|
6171 |
+ }; |
|
6172 |
+ return class_action_schwamm_create; |
|
6173 |
+}(class_action_adhoc)); |
|
6174 |
+/** |
|
6175 |
+ * @author fenris |
|
6176 |
+ */ |
|
6177 |
+var class_action_schwamm_apply = (function (_super) { |
|
6178 |
+ __extends(class_action_schwamm_apply, _super); |
|
6179 |
+ /** |
|
6180 |
+ * @author fenris |
|
6181 |
+ */ |
|
6182 |
+ function class_action_schwamm_apply(path, outputs) { |
|
6183 |
+ _super.call(this); |
|
6184 |
+ this.path = path; |
|
6185 |
+ this.outputs = outputs; |
|
6186 |
+ } |
|
6187 |
+ /** |
|
6188 |
+ * @desc for defining directly how the action is to be converted into a target-piece |
|
6189 |
+ * @author fenris |
|
6190 |
+ */ |
|
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) { |
|
6205 |
+ case "gnumake": { |
|
6206 |
+ return lib_gnumake.macro_command(cmdparams); |
|
6207 |
+ break; |
|
6208 |
+ } |
|
1649 | 6209 |
case "ant": { |
1650 |
- throw (new Error("not implemented")); |
|
6210 |
+ return lib_ant.class_action.macro_command(cmdparams); |
|
1651 | 6211 |
break; |
1652 | 6212 |
} |
1653 | 6213 |
default: { |
... | ... |
@@ -1656,8 +6216,53 @@ var class_action_php = (function (_super) { |
1656 | 6216 |
} |
1657 | 6217 |
} |
1658 | 6218 |
}; |
1659 |
- return class_action_php; |
|
6219 |
+ return class_action_schwamm_apply; |
|
1660 | 6220 |
}(class_action_adhoc)); |
6221 |
+/** |
|
6222 |
+ * @author fenris |
|
6223 |
+ */ |
|
6224 |
+var class_taskparameter = (function () { |
|
6225 |
+ /** |
|
6226 |
+ * @author fenris |
|
6227 |
+ */ |
|
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; |
|
6236 |
+ } |
|
6237 |
+ /** |
|
6238 |
+ * @author fenris |
|
6239 |
+ */ |
|
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; |
|
6263 |
+ }; |
|
6264 |
+ return class_taskparameter; |
|
6265 |
+}()); |
|
1661 | 6266 |
/** |
1662 | 6267 |
* @author fenris |
1663 | 6268 |
*/ |
... | ... |
@@ -1665,15 +6270,20 @@ var class_task = (function () { |
1665 | 6270 |
/** |
1666 | 6271 |
* @author fenris |
1667 | 6272 |
*/ |
1668 |
- function class_task(name, sub, active, parameters) { |
|
6273 |
+ function class_task(name, sub, active, _inputs, _outputs, _actions) { |
|
1669 | 6274 |
if (sub === void 0) { sub = []; } |
1670 | 6275 |
if (active === void 0) { active = true; } |
1671 |
- if (parameters === void 0) { parameters = {}; } |
|
1672 |
- this.identifier = genid("task_"); |
|
1673 |
- this.name = (name != null) ? name : this.identifier; |
|
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); |
|
1674 | 6281 |
this.sub = sub; |
1675 | 6282 |
this.active = active; |
1676 |
- this.parameters = parameters; |
|
6283 |
+ this._inputs = _inputs; |
|
6284 |
+ this._outputs = _outputs; |
|
6285 |
+ this._actions = _actions; |
|
6286 |
+ // this.parameters = parameters; |
|
1677 | 6287 |
} |
1678 | 6288 |
/** |
1679 | 6289 |
* @author fenris |
... | ... |
@@ -1716,121 +6326,134 @@ var class_task = (function () { |
1716 | 6326 |
/** |
1717 | 6327 |
* @author fenris |
1718 | 6328 |
*/ |
1719 |
- class_task.register = function (id, factory) { |
|
1720 |
- this.pool[id] = factory; |
|
6329 |
+ class_task.prototype.values = function (raw) { |
|
6330 |
+ return null; |
|
1721 | 6331 |
}; |
1722 | 6332 |
/** |
6333 |
+ * @desc a list of paths which represent input-files of the task |
|
1723 | 6334 |
* @author fenris |
1724 | 6335 |
*/ |
1725 |
- class_task.get = function (id) { |
|
1726 |
- return this.pool[id]; |
|
6336 |
+ class_task.prototype.inputs = function () { |
|
6337 |
+ return this._inputs; |
|
1727 | 6338 |
}; |
1728 | 6339 |
/** |
6340 |
+ * @desc a list of paths which represent output-files of the task |
|
1729 | 6341 |
* @author fenris |
1730 | 6342 |
*/ |
1731 |
- class_task.pool = {}; |
|
1732 |
- return class_task; |
|
1733 |
-}()); |
|
6343 |
+ class_task.prototype.outputs = function () { |
|
6344 |
+ return this._outputs; |
|
6345 |
+ }; |
|
1734 | 6346 |
/** |
6347 |
+ * @desc generates all actions which have to be executed in order to fulfil the task |
|
1735 | 6348 |
* @author fenris |
1736 | 6349 |
*/ |
1737 |
-var class_task_group = (function (_super) { |
|
1738 |
- __extends(class_task_group, _super); |
|
1739 |
- function class_task_group() { |
|
1740 |
- _super.apply(this, arguments); |
|
1741 |
- } |
|
6350 |
+ class_task.prototype.actions = function () { |
|
6351 |
+ return this._actions; |
|
6352 |
+ }; |
|
1742 | 6353 |
/** |
1743 | 6354 |
* @author fenris |
1744 | 6355 |
*/ |
1745 |
- class_task_group.create = function (name, sub, active, parameters) { |
|
1746 |
- return (new class_task_group(name, sub, active)); |
|
6356 |
+ class_task.register = function (id, factory) { |
|
6357 |
+ this.pool[id] = factory; |
|
1747 | 6358 |
}; |
1748 | 6359 |
/** |
1749 |
- * @override |
|
1750 | 6360 |
* @author fenris |
1751 | 6361 |
*/ |
1752 |
- class_task_group.prototype.inputs = function () { |
|
1753 |
- return []; |
|
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 |
+ } |
|
1754 | 6369 |
}; |
1755 | 6370 |
/** |
1756 |
- * @override |
|
1757 | 6371 |
* @author fenris |
1758 | 6372 |
*/ |
1759 |
- class_task_group.prototype.outputs = function () { |
|
1760 |
- return []; |
|
6373 |
+ class_task.list = function () { |
|
6374 |
+ return Object.keys(this.pool); |
|
1761 | 6375 |
}; |
1762 | 6376 |
/** |
1763 |
- * @override |
|
1764 | 6377 |
* @author fenris |
1765 | 6378 |
*/ |
1766 |
- class_task_group.prototype.actions = function () { |
|
1767 |
- return []; |
|
6379 |
+ class_task.errormessage_mandatoryparamater = function (type, name, fieldname) { |
|
6380 |
+ return "mandatory paramater '" + fieldname + "' missing in " + type + "-task '" + name + "'"; |
|
1768 | 6381 |
}; |
1769 |
- return class_task_group; |
|
1770 |
-}(class_task)); |
|
1771 |
-class_task.register("group", /*(name, sub, active, parameters) => */ class_task_group.create /*(name, sub, active, parameters)*/); |
|
1772 | 6382 |
/** |
1773 | 6383 |
* @author fenris |
1774 | 6384 |
*/ |
1775 |
-var class_task_dependency = (function (_super) { |
|
1776 |
- __extends(class_task_dependency, _super); |
|
6385 |
+ class_task.pool = {}; |
|
6386 |
+ return class_task; |
|
6387 |
+}()); |
|
1777 | 6388 |
/** |
1778 | 6389 |
* @author fenris |
1779 | 6390 |
*/ |
1780 |
- function class_task_dependency(name, sub, active, filepointer_project, target, raw, workdir // = null |
|
1781 |
- ) { |
|
1782 |
- if (name === void 0) { name = null; } |
|
1783 |
- if (sub === void 0) { sub = []; } |
|
1784 |
- if (active === void 0) { active = true; } |
|
1785 |
- if (filepointer_project === void 0) { filepointer_project = null; } |
|
1786 |
- if (target === void 0) { target = configuration["target"]; } |
|
1787 |
- if (raw === void 0) { raw = true; } |
|
1788 |
- if (workdir === void 0) { workdir = filepointer_project.location; } |
|
1789 |
- _super.call(this, name, sub, active); |
|
1790 |
- this.filepointer_project = filepointer_project; |
|
1791 |
- this.target = target; |
|
1792 |
- this.raw = raw; |
|
1793 |
- this.workdir = workdir; |
|
1794 |
- } |
|
6391 |
+var class_task_group = (function (_super) { |
|
6392 |
+ __extends(class_task_group, _super); |
|
1795 | 6393 |
/** |
1796 |
- * @override |
|
1797 | 6394 |
* @author fenris |
1798 | 6395 |
*/ |
1799 |
- class_task_dependency.prototype.inputs = function () { |
|
1800 |
- return [this.filepointer_project]; |
|
1801 |
- }; |
|
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, [], [], []); |
|
6399 |
+ } |
|
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 |
+}); }); |
|
1802 | 6406 |
/** |
1803 |
- * @override |
|
1804 | 6407 |
* @author fenris |
1805 | 6408 |
*/ |
1806 |
- class_task_dependency.prototype.outputs = function () { |
|
1807 |
- return []; |
|
1808 |
- }; |
|
6409 |
+var class_task_dependency = (function (_super) { |
|
6410 |
+ __extends(class_task_dependency, _super); |
|
1809 | 6411 |
/** |
1810 | 6412 |
* @author fenris |
1811 | 6413 |
*/ |
1812 |
- class_task_dependency.prototype.actions = function () { |
|
1813 |
- switch (this.target) { |
|
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) { |
|
1814 | 6423 |
case "gnumake": { |
1815 |
- var filepointer_buildfile = new lib_path.class_filepointer(configuration["tempfolder"], "makefile"); |
|
6424 |
+ var filepointer_buildfile = new lib_path.class_filepointer(lib_path.location_read(configuration.tempfolder, configuration.system), "makefile"); |
|
1816 | 6425 |
return [ |
1817 |
- new class_action_koralle(this.filepointer_project, filepointer_buildfile, this.target, this.raw), |
|
1818 |
- new class_action_gnumake(filepointer_buildfile, this.workdir), |
|
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), |
|
1819 | 6433 |
]; |
6434 |
+ break; |
|
1820 | 6435 |
} |
1821 | 6436 |
case "ant": { |
1822 |
- var filepointer_buildfile = new lib_path.class_filepointer(configuration["tempfolder"], "build.xml"); |
|
6437 |
+ var filepointer_buildfile = new lib_path.class_filepointer(lib_path.location_read(configuration.tempfolder, configuration.system), "build.xml"); |
|
1823 | 6438 |
return [ |
1824 |
- new class_action_koralle(this.filepointer_project, filepointer_buildfile, this.target, this.raw), |
|
1825 |
- new class_action_ant(filepointer_buildfile, this.workdir), |
|
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), |
|
1826 | 6446 |
]; |
6447 |
+ break; |
|
1827 | 6448 |
} |
1828 | 6449 |
default: { |
1829 |
- throw (new Error("unhandled target '" + this.target + "'")); |
|
6450 |
+ throw (new Error("unhandled target '${target}'")); |
|
1830 | 6451 |
break; |
1831 | 6452 |
} |
1832 | 6453 |
} |
1833 |
- }; |
|
6454 |
+ })(); |
|
6455 |
+ _super.call(this, name, sub, active, [path], [], actions); |
|
6456 |
+ } |
|
1834 | 6457 |
return class_task_dependency; |
1835 | 6458 |
}(class_task)); |
1836 | 6459 |
/** |
... | ... |
@@ -1841,52 +6464,34 @@ var class_task_script = (function (_super) { |
1841 | 6464 |
/** |
1842 | 6465 |
* @author fenris |
1843 | 6466 |
*/ |
1844 |
- function class_task_script(name, sub, active, inputs_, outputs_, path, interpreter) { |
|
1845 |
- if (name === void 0) { name = null; } |
|
1846 |
- if (sub === void 0) { sub = []; } |
|
1847 |
- if (active === void 0) { active = true; } |
|
1848 |
- if (interpreter === void 0) { interpreter = null; } |
|
1849 |
- _super.call(this, name, sub, active); |
|
1850 |
- this.inputs_ = inputs_; |
|
1851 |
- this.outputs_ = outputs_; |
|
1852 |
- this.path = path; |
|
1853 |
- this.interpreter = interpreter; |
|
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"))); |
|
1854 | 6471 |
} |
1855 |
- /** |
|
1856 |
- * @author fenris |
|
1857 |
- */ |
|
1858 |
- class_task_script.create = function (name, sub, active, parameters) { |
|
1859 |
- var interpreter_raw = fetch(parameters, "interpreter", null, 1); |
|
1860 |
- var interpreter = ((interpreter_raw == null) ? null : lib_path.class_filepointer.read(interpreter_raw)); |
|
1861 |
- return (new class_task_script(name, sub, active, fetch(parameters, "inputs", [], 1).map(function (s) { return lib_path.class_filepointer.read(s); }), fetch(parameters, "outputs", [], 1).map(function (s) { return lib_path.class_filepointer.read(s); }), lib_path.class_filepointer.read(fetch(parameters, "path", null, 2)), interpreter)); |
|
1862 |
- }; |
|
1863 |
- /** |
|
1864 |
- * @override |
|
1865 |
- * @author fenris |
|
1866 |
- */ |
|
1867 |
- class_task_script.prototype.inputs = function () { |
|
1868 |
- return this.inputs_; |
|
1869 |
- }; |
|
1870 |
- /** |
|
1871 |
- * @override |
|
1872 |
- * @author fenris |
|
1873 |
- */ |
|
1874 |
- class_task_script.prototype.outputs = function () { |
|
1875 |
- return this.outputs_; |
|
1876 |
- }; |
|
1877 |
- /** |
|
1878 |
- * @author fenris |
|
1879 |
- */ |
|
1880 |
- class_task_script.prototype.actions = function () { |
|
1881 |
- return ([] |
|
1882 |
- .concat(this.outputs_.map(function (output) { return new class_action_mkdir(output.location); })) |
|
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); })) |
|
1883 | 6479 |
.concat([ |
1884 |
- new class_action_exec(this.inputs_, this.outputs_, this.path, this.interpreter), |
|
1885 |
- ])); |
|
1886 |
- }; |
|
6480 |
+ new class_action_exec({ |
|
6481 |
+ "inputs": inputs, |
|
6482 |
+ "outputs": outputs, |
|
6483 |
+ "path": path, |
|
6484 |
+ "interpreter": interpreter, |
|
6485 |
+ "workdir": workdir, |
|
6486 |
+ }), |
|
6487 |
+ ]))); |
|
6488 |
+ } |
|
1887 | 6489 |
return class_task_script; |
1888 | 6490 |
}(class_task)); |
1889 |
-class_task.register("script", /*(name, sub, active, parameters) => */ class_task_script.create /*(name, sub, active, parameters)*/); |
|
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 |
+}); }); |
|
1890 | 6495 |
/** |
1891 | 6496 |
* @author fenris |
1892 | 6497 |
*/ |
... | ... |
@@ -1895,47 +6500,23 @@ var class_task_empty = (function (_super) { |
1895 | 6500 |
/** |
1896 | 6501 |
* @author fenris |
1897 | 6502 |
*/ |
1898 |
- function class_task_empty(name, sub, active, output_) { |
|
1899 |
- if (name === void 0) { name = null; } |
|
1900 |
- if (sub === void 0) { sub = []; } |
|
1901 |
- if (active === void 0) { active = true; } |
|
1902 |
- if (output_ === void 0) { output_ = null; } |
|
1903 |
- _super.call(this, name, sub, active); |
|
1904 |
- this.output_ = output_; |
|
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 |
+ ]); |
|
1905 | 6513 |
} |
1906 |
- /** |
|
1907 |
- * @author fenris |
|
1908 |
- */ |
|
1909 |
- class_task_empty.create = function (name, sub, active, parameters) { |
|
1910 |
- return (new class_task_empty(name, sub, active, lib_path.class_filepointer.read(fetch(parameters, "output", null, 2)))); |
|
1911 |
- }; |
|
1912 |
- /** |
|
1913 |
- * @override |
|
1914 |
- * @author fenris |
|
1915 |
- */ |
|
1916 |
- class_task_empty.prototype.inputs = function () { |
|
1917 |
- return []; |
|
1918 |
- }; |
|
1919 |
- /** |
|
1920 |
- * @override |
|
1921 |
- * @author fenris |
|
1922 |
- */ |
|
1923 |
- class_task_empty.prototype.outputs = function () { |
|
1924 |
- return [this.output_]; |
|
1925 |
- }; |
|
1926 |
- /** |
|
1927 |
- * @override |
|
1928 |
- * @author fenris |
|
1929 |
- */ |
|
1930 |
- class_task_empty.prototype.actions = function () { |
|
1931 |
- return [ |
|
1932 |
- new class_action_mkdir(this.output_.location), |
|
1933 |
- new class_action_touch(this.output_), |
|
1934 |
- ]; |
|
1935 |
- }; |
|
1936 | 6514 |
return class_task_empty; |
1937 | 6515 |
}(class_task)); |
1938 |
-class_task.register("empty", /*(name, sub, active, parameters) => */ class_task_empty.create /*(name, sub, active, parameters)*/); |
|
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 |
+}); }); |
|
1939 | 6520 |
/** |
1940 | 6521 |
* @author fenris |
1941 | 6522 |
*/ |
... | ... |
@@ -1944,50 +6525,27 @@ var class_task_copy = (function (_super) { |
1944 | 6525 |
/** |
1945 | 6526 |
* @author fenris |
1946 | 6527 |
*/ |
1947 |
- function class_task_copy(name, sub, active, input_, output_, folder) { |
|
1948 |
- if (name === void 0) { name = null; } |
|
1949 |
- if (sub === void 0) { sub = []; } |
|
1950 |
- if (active === void 0) { active = true; } |
|
1951 |
- if (input_ === void 0) { input_ = null; } |
|
1952 |
- if (output_ === void 0) { output_ = null; } |
|
1953 |
- if (folder === void 0) { folder = null; } |
|
1954 |
- _super.call(this, name, sub, active); |
|
1955 |
- this.input_ = input_; |
|
1956 |
- this.output_ = output_; |
|
1957 |
- this.folder = folder; |
|
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 |
+ ]); |
|
1958 | 6542 |
} |
1959 |
- /** |
|
1960 |
- * @author fenris |
|
1961 |
- */ |
|
1962 |
- class_task_copy.create = function (name, sub, active, parameters) { |
|
1963 |
- return (new class_task_copy(name, sub, active, lib_path.class_filepointer.read(fetch(parameters, "input", null, 2)), lib_path.class_filepointer.read(fetch(parameters, "output", null, 2)), fetch(parameters, "folder", false, 0))); |
|
1964 |
- }; |
|
1965 |
- /** |
|
1966 |
- * @override |
|
1967 |
- * @author fenris |
|
1968 |
- */ |
|
1969 |
- class_task_copy.prototype.inputs = function () { |
|
1970 |
- return [this.input_]; |
|
1971 |
- }; |
|
1972 |
- /** |
|
1973 |
- * @override |
|
1974 |
- * @author fenris |
|
1975 |
- */ |
|
1976 |
- class_task_copy.prototype.outputs = function () { |
|
1977 |
- return [this.output_]; |
|
1978 |
- }; |
|
1979 |
- /** |
|
1980 |
- * @author fenris |
|
1981 |
- */ |
|
1982 |
- class_task_copy.prototype.actions = function () { |
|
1983 |
- return [ |
|
1984 |
- new class_action_mkdir(this.output_.location), |
|
1985 |
- new class_action_copy(this.input_, this.output_, this.folder), |
|
1986 |
- ]; |
|
1987 |
- }; |
|
1988 | 6543 |
return class_task_copy; |
1989 | 6544 |
}(class_task)); |
1990 |
-class_task.register("copy", /*(name, sub, active, parameters) => */ class_task_copy.create /*(name, sub, active, parameters)*/); |
|
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 |
+}); }); |
|
1991 | 6549 |
/** |
1992 | 6550 |
* @author fenris |
1993 | 6551 |
*/ |
... | ... |
@@ -1996,157 +6554,229 @@ var class_task_concat = (function (_super) { |
1996 | 6554 |
/** |
1997 | 6555 |
* @author fenris |
1998 | 6556 |
*/ |
1999 |
- function class_task_concat(name, sub, active, inputs_, output_) { |
|
2000 |
- if (name === void 0) { name = null; } |
|
2001 |
- if (sub === void 0) { sub = []; } |
|
2002 |
- if (active === void 0) { active = true; } |
|
2003 |
- if (inputs_ === void 0) { inputs_ = null; } |
|
2004 |
- if (output_ === void 0) { output_ = null; } |
|
2005 |
- _super.call(this, name, sub, active); |
|
2006 |
- this.inputs_ = inputs_; |
|
2007 |
- this.output_ = output_; |
|
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"))); |
|
2008 | 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 |
+}); }); |
|
2009 | 6578 |
/** |
2010 | 6579 |
* @author fenris |
2011 | 6580 |
*/ |
2012 |
- class_task_concat.create = function (name, sub, active, parameters) { |
|
2013 |
- return (new class_task_concat(name, sub, active, fetch(parameters, "inputs", [], 2).map(function (s) { return lib_path.class_filepointer.read(s); }), lib_path.class_filepointer.read(fetch(parameters, "output", null, 2)))); |
|
2014 |
- }; |
|
2015 |
- /** |
|
2016 |
- * @override |
|
2017 |
- * @author fenris |
|
2018 |
- */ |
|
2019 |
- class_task_concat.prototype.inputs = function () { |
|
2020 |
- return this.inputs_; |
|
2021 |
- }; |
|
2022 |
- /** |
|
2023 |
- * @override |
|
2024 |
- * @author fenris |
|
2025 |
- */ |
|
2026 |
- class_task_concat.prototype.outputs = function () { |
|
2027 |
- return [this.output_]; |
|
2028 |
- }; |
|
6581 |
+var class_task_lesscss = (function (_super) { |
|
6582 |
+ __extends(class_task_lesscss, _super); |
|
2029 | 6583 |
/** |
2030 |
- * @override |
|
2031 | 6584 |
* @author fenris |
2032 | 6585 |
*/ |
2033 |
- class_task_concat.prototype.actions = function () { |
|
2034 |
- return [ |
|
2035 |
- new class_action_mkdir(this.output_.location), |
|
2036 |
- new class_action_concat(this.inputs_, this.output_), |
|
2037 |
- ]; |
|
2038 |
- }; |
|
2039 |
- return class_task_concat; |
|
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; |
|
2040 | 6604 |
}(class_task)); |
2041 |
-class_task.register("concat", /*(name, sub, active, parameters) => */ class_task_concat.create /*(name, sub, active, parameters)*/); |
|
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 |
+}); }); |
|
2042 | 6609 |
/** |
2043 |
- * @author fenris |
|
6610 |
+ * @author neu3no |
|
2044 | 6611 |
*/ |
2045 |
-var class_task_lesscss = (function (_super) { |
|
2046 |
- __extends(class_task_lesscss, _super); |
|
6612 |
+var class_task_babel = (function (_super) { |
|
6613 |
+ __extends(class_task_babel, _super); |
|
2047 | 6614 |
/** |
2048 |
- * @author fenris |
|
6615 |
+ * @author neu3no |
|
2049 | 6616 |
*/ |
2050 |
- function class_task_lesscss(name, sub, active, inputs_, output_) { |
|
6617 |
+ function class_task_babel(name, sub, active, inputs_, output_, preset, minify) { |
|
2051 | 6618 |
if (name === void 0) { name = null; } |
2052 | 6619 |
if (sub === void 0) { sub = []; } |
2053 | 6620 |
if (active === void 0) { active = true; } |
2054 |
- if (inputs_ === void 0) { inputs_ = null; } |
|
6621 |
+ if (inputs_ === void 0) { inputs_ = []; } |
|
2055 | 6622 |
if (output_ === void 0) { output_ = null; } |
6623 |
+ if (preset === void 0) { preset = null; } |
|
6624 |
+ if (minify === void 0) { minify = null; } |
|
2056 | 6625 |
_super.call(this, name, sub, active); |
2057 | 6626 |
this.inputs_ = inputs_; |
2058 | 6627 |
this.output_ = output_; |
6628 |
+ this.preset = preset; |
|
6629 |
+ this.minify = minify; |
|
2059 | 6630 |
} |
2060 | 6631 |
/** |
2061 |
- * @author fenris |
|
6632 |
+ * @author neu3no |
|
2062 | 6633 |
*/ |
2063 |
- class_task_lesscss.create = function (name, sub, active, parameters) { |
|
2064 |
- return (new class_task_lesscss(name, sub, active, fetch(parameters, "inputs", null, 2).map(function (s) { return lib_path.class_filepointer.read(s); }), lib_path.class_filepointer.read(fetch(parameters, "output", null, 2)))); |
|
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))); |
|
2065 | 6636 |
}; |
2066 | 6637 |
/** |
2067 | 6638 |
* @override |
2068 |
- * @author fenris |
|
6639 |
+ * @author neu3no |
|
2069 | 6640 |
*/ |
2070 |
- class_task_lesscss.prototype.inputs = function () { |
|
6641 |
+ class_task_babel.prototype.inputs = function () { |
|
2071 | 6642 |
return this.inputs_; |
2072 | 6643 |
}; |
2073 | 6644 |
/** |
2074 | 6645 |
* @override |
2075 |
- * @author fenris |
|
6646 |
+ * @author neu3no |
|
2076 | 6647 |
*/ |
2077 |
- class_task_lesscss.prototype.outputs = function () { |
|
6648 |
+ class_task_babel.prototype.outputs = function () { |
|
2078 | 6649 |
return [this.output_]; |
2079 | 6650 |
}; |
2080 | 6651 |
/** |
2081 |
- * @author fenris |
|
6652 |
+ * @author neu3no |
|
2082 | 6653 |
*/ |
2083 |
- class_task_lesscss.prototype.actions = function () { |
|
2084 |
- var filepointer_temp = new lib_path.class_filepointer(lib_path.class_location.read(configuration["tempfolder"]), "_.less"); |
|
6654 |
+ class_task_babel.prototype.actions = function () { |
|
2085 | 6655 |
return [ |
2086 | 6656 |
new class_action_mkdir(this.output_.location), |
2087 |
- new class_action_concat(this.inputs_, filepointer_temp), |
|
2088 |
- new class_action_lessc(filepointer_temp, this.output_), |
|
6657 |
+ new class_action_babel(this.inputs_, this.output_, this.preset, this.minify), |
|
2089 | 6658 |
]; |
2090 | 6659 |
}; |
2091 |
- return class_task_lesscss; |
|
6660 |
+ return class_task_babel; |
|
2092 | 6661 |
}(class_task)); |
2093 |
-class_task.register("lesscss", /*(name, sub, active, parameters) => */ class_task_lesscss.create /*(name, sub, active, parameters)*/); |
|
2094 |
-/** |
|
2095 |
- * @author fenris |
|
2096 |
- */ |
|
2097 |
-var class_task_typescript = (function (_super) { |
|
2098 |
- __extends(class_task_typescript, _super); |
|
2099 |
- /** |
|
2100 |
- * @author fenris |
|
2101 |
- */ |
|
2102 |
- function class_task_typescript(name, sub, active, inputs_, output_, target, allowUnreachableCode, declaration) { |
|
2103 |
- if (name === void 0) { name = null; } |
|
2104 |
- if (sub === void 0) { sub = []; } |
|
2105 |
- if (active === void 0) { active = true; } |
|
2106 |
- if (inputs_ === void 0) { inputs_ = null; } |
|
2107 |
- if (output_ === void 0) { output_ = null; } |
|
2108 |
- if (target === void 0) { target = null; } |
|
2109 |
- if (allowUnreachableCode === void 0) { allowUnreachableCode = null; } |
|
2110 |
- if (declaration === void 0) { declaration = null; } |
|
2111 |
- _super.call(this, name, sub, active); |
|
2112 |
- this.inputs_ = inputs_; |
|
2113 |
- this.output_ = output_; |
|
2114 |
- this.target = target; |
|
2115 |
- this.allowUnreachableCode = allowUnreachableCode; |
|
2116 |
- this.declaration = declaration; |
|
2117 |
- } |
|
2118 |
- /** |
|
2119 |
- * @author fenris |
|
2120 |
- */ |
|
2121 |
- class_task_typescript.create = function (name, sub, active, parameters) { |
|
2122 |
- return (new class_task_typescript(name, sub, active, fetch(parameters, "inputs", [], 1).map(function (s) { return lib_path.class_filepointer.read(s); }), lib_path.class_filepointer.read(fetch(parameters, "output", null, 2)), fetch(parameters, "target", null, 0), fetch(parameters, "allowUnreachableCode", false, 0), fetch(parameters, "declaration", false, 0))); |
|
2123 |
- }; |
|
2124 |
- /** |
|
2125 |
- * @override |
|
2126 |
- * @author fenris |
|
2127 |
- */ |
|
2128 |
- class_task_typescript.prototype.inputs = function () { |
|
2129 |
- return this.inputs_; |
|
2130 |
- }; |
|
6662 |
+class_task.register("babel", /*(name, sub, active, parameters) => */ class_task_babel.create /*(name, sub, active, parameters)*/); |
|
2131 | 6663 |
/** |
2132 |
- * @override |
|
2133 | 6664 |
* @author fenris |
2134 |
- */ |
|
2135 |
- class_task_typescript.prototype.outputs = function () { |
|
2136 |
- return [this.output_]; |
|
2137 |
- }; |
|
6665 |
+ */ |
|
6666 |
+var class_task_typescript = (function (_super) { |
|
6667 |
+ __extends(class_task_typescript, _super); |
|
2138 | 6668 |
/** |
2139 | 6669 |
* @author fenris |
2140 | 6670 |
*/ |
2141 |
- class_task_typescript.prototype.actions = function () { |
|
2142 |
- return [ |
|
2143 |
- new class_action_mkdir(this.output_.location), |
|
2144 |
- new class_action_tsc(this.inputs_, this.output_, this.target, this.allowUnreachableCode, this.declaration), |
|
2145 |
- ]; |
|
2146 |
- }; |
|
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 |
+ } |
|
2147 | 6774 |
return class_task_typescript; |
2148 | 6775 |
}(class_task)); |
2149 |
-class_task.register("typescript", /*(name, sub, active, parameters) => */ class_task_typescript.create /*(name, sub, active, parameters)*/); |
|
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 |
+}); }); |
|
2150 | 6780 |
/** |
2151 | 6781 |
* @author fenris |
2152 | 6782 |
*/ |
... | ... |
@@ -2155,50 +6785,79 @@ var class_task_php = (function (_super) { |
2155 | 6785 |
/** |
2156 | 6786 |
* @author fenris |
2157 | 6787 |
*/ |
2158 |
- function class_task_php(name, sub, active, inputs_, output_, only_first) { |
|
2159 |
- if (name === void 0) { name = null; } |
|
2160 |
- if (sub === void 0) { sub = []; } |
|
2161 |
- if (active === void 0) { active = true; } |
|
2162 |
- if (inputs_ === void 0) { inputs_ = null; } |
|
2163 |
- if (output_ === void 0) { output_ = null; } |
|
2164 |
- if (only_first === void 0) { only_first = null; } |
|
2165 |
- _super.call(this, name, sub, active); |
|
2166 |
- this.inputs_ = inputs_; |
|
2167 |
- this.output_ = output_; |
|
2168 |
- this.only_first = only_first; |
|
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"))); |
|
2169 | 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 |
+ } |
|
6800 |
+ return class_task_php; |
|
6801 |
+}(class_task)); |
|
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 |
+}); }); |
|
2170 | 6806 |
/** |
2171 | 6807 |
* @author fenris |
2172 | 6808 |
*/ |
2173 |
- class_task_php.create = function (name, sub, active, parameters) { |
|
2174 |
- return (new class_task_php(name, sub, active, fetch(parameters, "inputs", [], 2).map(function (s) { return lib_path.class_filepointer.read(s); }), lib_path.class_filepointer.read(fetch(parameters, "output", null, 2)), fetch(parameters, "only_first", false, 0))); |
|
2175 |
- }; |
|
6809 |
+var class_task_schwamm_create = (function (_super) { |
|
6810 |
+ __extends(class_task_schwamm_create, _super); |
|
2176 | 6811 |
/** |
2177 |
- * @override |
|
2178 | 6812 |
* @author fenris |
2179 | 6813 |
*/ |
2180 |
- class_task_php.prototype.inputs = function () { |
|
2181 |
- return this.inputs_; |
|
2182 |
- }; |
|
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 |
+}); }); |
|
2183 | 6831 |
/** |
2184 |
- * @override |
|
2185 | 6832 |
* @author fenris |
2186 | 6833 |
*/ |
2187 |
- class_task_php.prototype.outputs = function () { |
|
2188 |
- return [this.output_]; |
|
2189 |
- }; |
|
6834 |
+var class_task_schwamm_apply = (function (_super) { |
|
6835 |
+ __extends(class_task_schwamm_apply, _super); |
|
2190 | 6836 |
/** |
2191 | 6837 |
* @author fenris |
2192 | 6838 |
*/ |
2193 |
- class_task_php.prototype.actions = function () { |
|
2194 |
- return [ |
|
2195 |
- new class_action_mkdir(this.output_.location), |
|
2196 |
- new class_action_php(this.inputs_, this.output_, this.only_first), |
|
2197 |
- ]; |
|
2198 |
- }; |
|
2199 |
- return class_task_php; |
|
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; |
|
2200 | 6856 |
}(class_task)); |
2201 |
-class_task.register("php", /*(name, sub, active, parameters) => */ class_task_php.create /*(name, sub, active, parameters)*/); |
|
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 |
+}); }); |
|
2202 | 6861 |
/** |
2203 | 6862 |
* @author fenris |
2204 | 6863 |
*/ |
... | ... |
@@ -2247,6 +6906,26 @@ var class_target_ant = (function (_super) { |
2247 | 6906 |
function class_target_ant() { |
2248 | 6907 |
_super.call(this, "ant"); |
2249 | 6908 |
} |
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 |
+ }; |
|
2250 | 6929 |
/** |
2251 | 6930 |
* @author fenris |
2252 | 6931 |
*/ |
... | ... |
@@ -2277,14 +6956,11 @@ var class_target_ant = (function (_super) { |
2277 | 6956 |
class_target_ant.prototype.compile_project = function (project, without_dependencies) { |
2278 | 6957 |
var _this = this; |
2279 | 6958 |
if (without_dependencies === void 0) { without_dependencies = false; } |
2280 |
- var that = this; |
|
2281 | 6959 |
var comments = [ |
2282 |
- // new lib_ant.class_comment("Project \"" + project.name_get() + "\""), |
|
2283 |
- new lib_ant.class_comment("This build script was generated by Koralle " + configuration["version"]), |
|
2284 |
- ]; |
|
2285 |
- var dependencies = project.dependencies_get().map(function (path, index) { |
|
2286 |
- return (new class_task_dependency("__dependency_" + index.toString(), [], true, lib_path.class_filepointer.read(path), that.identifier, true, undefined)); |
|
2287 |
- }); |
|
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); |
|
2288 | 6964 |
var targets = [] |
2289 | 6965 |
.concat([ |
2290 | 6966 |
new lib_ant.class_target({ |
... | ... |
@@ -2324,18 +7000,19 @@ var class_target_ant = (function (_super) { |
2324 | 7000 |
* @override |
2325 | 7001 |
* @author fenris |
2326 | 7002 |
*/ |
2327 |
- class_target_ant.prototype.execute = function (filepointer) { |
|
7003 |
+ class_target_ant.prototype.execute = function (filepointer, workdir) { |
|
7004 |
+ if (workdir === void 0) { workdir = "."; } |
|
2328 | 7005 |
return (function (resolve, reject) { |
2329 | 7006 |
var command = [ |
2330 | 7007 |
"ant", |
2331 | 7008 |
"-file " + filepointer.toString(), |
2332 | 7009 |
].join(" "); |
2333 | 7010 |
_child_process.exec(command, {}, function (stdout, stderr, error) { |
2334 |
- if (error != null) { |
|
2335 |
- reject(error); |
|
7011 |
+ if (error == null) { |
|
7012 |
+ resolve(undefined); |
|
2336 | 7013 |
} |
2337 | 7014 |
else { |
2338 |
- resolve(undefined); |
|
7015 |
+ reject(error); |
|
2339 | 7016 |
} |
2340 | 7017 |
}); |
2341 | 7018 |
}); |
... | ... |
@@ -2353,28 +7030,48 @@ var class_target_gnumake = (function (_super) { |
2353 | 7030 |
function class_target_gnumake() { |
2354 | 7031 |
_super.call(this, "gnumake"); |
2355 | 7032 |
} |
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 |
+ }; |
|
2356 | 7053 |
/** |
2357 | 7054 |
* @author fenris |
2358 | 7055 |
*/ |
2359 |
- class_target_gnumake.prototype.compile_task = function (task, path, depth, prefix) { |
|
7056 |
+ class_target_gnumake.prototype.compile_task = function (task, branch, depth, prefix) { |
|
2360 | 7057 |
var _this = this; |
2361 |
- if (path === void 0) { path = []; } |
|
7058 |
+ if (branch === void 0) { branch = []; } |
|
2362 | 7059 |
if (depth === void 0) { depth = 0; } |
2363 | 7060 |
if (prefix === void 0) { prefix = null; } |
2364 |
- var path_ = [task.name_get()]; |
|
2365 |
- var logging_begin = new class_action_echo((new class_message("processing \"" + path_.join("-") + "\" ...", { "type": "log", "depth": depth, "prefix": prefix })).generate()); |
|
2366 |
- var logging_end = new class_action_echo((new class_message("... finished \"" + path_.join("-") + "\"", { "type": "log", "depth": depth, "prefix": prefix })).generate()); |
|
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()); |
|
2367 | 7064 |
var rules_core = []; |
2368 | 7065 |
{ |
2369 | 7066 |
// meta rule |
2370 | 7067 |
rules_core.push(new lib_gnumake.class_rule({ |
2371 |
- "name": path_.join("-"), |
|
7068 |
+ "name": branch_.join("-"), |
|
2372 | 7069 |
"dependencies": ([] |
2373 |
- .concat(["__logging_" + path_.join("-")]) |
|
7070 |
+ .concat(["__logging_" + branch_.join("-")]) |
|
2374 | 7071 |
.concat(task.sub_get() |
2375 | 7072 |
.filter(function (task_) { return task_.active_get(); }) |
2376 | 7073 |
.map(function (task_) { return [task_.name_get()] /*)*/.join("-"); })) |
2377 |
- .concat(task.outputs().map(function (filepointer) { return filepointer.toString(); }))), |
|
7074 |
+ .concat(task.outputs().map(function (filepointer) { return filepointer.as_string(configuration.system); }))), |
|
2378 | 7075 |
"actions": ([] |
2379 | 7076 |
.concat((task.outputs().length == 0) ? task.actions() : []) |
2380 | 7077 |
.map(function (action) { return _this.compile_action(action); })), |
... | ... |
@@ -2382,15 +7079,15 @@ var class_target_gnumake = (function (_super) { |
2382 | 7079 |
})); |
2383 | 7080 |
// logging |
2384 | 7081 |
rules_core.push(new lib_gnumake.class_rule({ |
2385 |
- "name": ("__logging_" + path_.join("-")), |
|
7082 |
+ "name": ("__logging_" + branch_.join("-")), |
|
2386 | 7083 |
"actions": [logging_begin].map(function (action) { return _this.compile_action(action); }), |
2387 | 7084 |
"phony": true, |
2388 | 7085 |
})); |
2389 | 7086 |
// actual rule |
2390 | 7087 |
if (task.outputs().length > 0) { |
2391 | 7088 |
rules_core.push(new lib_gnumake.class_rule({ |
2392 |
- "name": task.outputs().map(function (filepointer) { return filepointer.toString(); }).join(" "), |
|
2393 |
- "dependencies": task.inputs().map(function (filepointer) { return filepointer.toString(); }), |
|
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); }), |
|
2394 | 7091 |
"actions": task.actions().map(function (action) { return _this.compile_action(action); }), |
2395 | 7092 |
"phony": false, |
2396 | 7093 |
})); |
... | ... |
@@ -2399,10 +7096,10 @@ var class_target_gnumake = (function (_super) { |
2399 | 7096 |
var rules_sub = []; |
2400 | 7097 |
{ |
2401 | 7098 |
rules_sub = task.sub_get() |
2402 |
- .map(function (task_) { return _this.compile_task(task_, path_, depth + 1, prefix); }) |
|
7099 |
+ .map(function (task_) { return _this.compile_task(task_, branch_, depth + 1, prefix); }) |
|
2403 | 7100 |
.reduce(function (x, y) { return x.concat(y); }, []); |
2404 | 7101 |
} |
2405 |
- return ([].concat(rules_core).concat(rules_sub)); |
|
7102 |
+ return [].concat(rules_core).concat(rules_sub); |
|
2406 | 7103 |
}; |
2407 | 7104 |
/** |
2408 | 7105 |
* @author fenris |
... | ... |
@@ -2410,14 +7107,11 @@ var class_target_gnumake = (function (_super) { |
2410 | 7107 |
class_target_gnumake.prototype.compile_project = function (project, without_dependencies) { |
2411 | 7108 |
var _this = this; |
2412 | 7109 |
if (without_dependencies === void 0) { without_dependencies = false; } |
2413 |
- var that = this; |
|
2414 | 7110 |
var comments = [ |
2415 |
- "Project \"" + project.name_get() + "\"", |
|
2416 |
- "This makefile was generated by Koralle " + configuration["version"], |
|
2417 |
- ]; |
|
2418 |
- var dependencies = project.dependencies_get().map(function (path, index) { |
|
2419 |
- return (new class_task_dependency("__dependency_" + index.toString(), [], true, lib_path.class_filepointer.read(path), that.identifier, true, undefined)); |
|
2420 |
- }); |
|
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); |
|
2421 | 7115 |
var rules = [] |
2422 | 7116 |
.concat([ |
2423 | 7117 |
new lib_gnumake.class_rule({ |
... | ... |
@@ -2464,25 +7158,22 @@ var class_target_gnumake = (function (_super) { |
2464 | 7158 |
* @override |
2465 | 7159 |
* @author fenris |
2466 | 7160 |
*/ |
2467 |
- class_target_gnumake.prototype.execute = function (filepointer) { |
|
7161 |
+ class_target_gnumake.prototype.execute = function (filepointer, workdir) { |
|
7162 |
+ if (workdir === void 0) { workdir = process.cwd(); } |
|
2468 | 7163 |
return (function (resolve, reject) { |
2469 |
- var command = (["cd", filepointer.location].join(" ") |
|
2470 |
- + " && " |
|
2471 |
- + ["make", "--file=" + filepointer.filename].join(" ") |
|
2472 |
- + " ; " |
|
2473 |
- + ["cd", "-"].join(" ")); |
|
2474 |
- // (new class_message(command, {"prefix": "exec:command"})).stderr(); |
|
2475 |
- _child_process.exec(command, {}, function (stdout, stderr, error) { |
|
2476 |
- /* |
|
2477 |
- (new class_message(stdout, {"prefix": "exec:stdout"})).stderr(); |
|
2478 |
- (new class_message(stderr, {"prefix": "exec:stderr"})).stderr(); |
|
2479 |
- (new class_message(String(error), {"prefix": "exec:error"})).stderr(); |
|
2480 |
- */ |
|
2481 |
- if (error != null) { |
|
2482 |
- reject(error); |
|
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); |
|
2483 | 7174 |
} |
2484 | 7175 |
else { |
2485 |
- resolve(undefined); |
|
7176 |
+ reject(new Error("unknown error while subprocess execution")); |
|
2486 | 7177 |
} |
2487 | 7178 |
}); |
2488 | 7179 |
}); |
... | ... |
@@ -2531,352 +7222,344 @@ var class_project = (function () { |
2531 | 7222 |
* @author fenris |
2532 | 7223 |
*/ |
2533 | 7224 |
class_project.create_task = function (raw) { |
2534 |
- var type = fetch(raw, "type", null, 2); |
|
2535 |
- return (class_task.get(type)(fetch(raw, "name", null, 1), fetch(raw, "sub", [], 0).map(function (raw) { return class_project.create_task(raw); }), fetch(raw, "active", true, 0), fetch(raw, "parameters", {}, 0))); |
|
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 |
+ })); |
|
2536 | 7242 |
}; |
2537 | 7243 |
/** |
2538 | 7244 |
* @author fenris |
2539 | 7245 |
*/ |
2540 | 7246 |
class_project.create = function (project_raw) { |
2541 |
- var name = fetch(project_raw, "name", "(nameless project)", 1); |
|
2542 |
- var version = fetch(project_raw, "version", "0.0.0", 1); |
|
2543 |
- var dependencies = fetch(project_raw, "dependencies", [], 0); |
|
2544 |
- var roottask = class_project.create_task(fetch(project_raw, "roottask", null, 2)); |
|
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)); |
|
2545 | 7251 |
// roottask.clean(); |
2546 | 7252 |
return (new class_project(name, version, dependencies, roottask)); |
2547 | 7253 |
}; |
2548 | 7254 |
return class_project; |
2549 | 7255 |
}()); |
2550 |
-/** |
|
2551 |
- * @author fenris |
|
2552 |
- */ |
|
2553 |
-function read(path) { |
|
2554 |
- return (function (resolve, reject) { |
|
2555 |
- _fs.access(path, _fs.R_OK | _fs.W_OK, function (error) { |
|
2556 |
- if (error != null) { |
|
2557 |
- reject(new Error("project.json at '" + path + "' couldn't be read")); |
|
2558 |
- } |
|
2559 |
- else { |
|
2560 |
- read_json(path)(resolve, reject); |
|
7256 |
+function scan(filepointer, data, graph, depth) { |
|
7257 |
+ if (graph === void 0) { graph = null; } |
|
7258 |
+ if (depth === void 0) { depth = 0; } |
|
7259 |
+ if (graph == null) { |
|
7260 |
+ graph = new class_graph(function (x, y) { return (x.filepointer.toString() == y.filepointer.toString()); }); |
|
2561 | 7261 |
} |
2562 |
- }); |
|
2563 |
- }); |
|
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; |
|
2564 | 7266 |
} |
2565 |
-/** |
|
2566 |
- * @param path the path to the project.json relative to the current working directory |
|
2567 |
- * @param usage what to do with the result-graph |
|
2568 |
- * @author fenris |
|
2569 |
- */ |
|
2570 |
-function scan(filepointer, graph, depth) { |
|
2571 |
- if (graph === void 0) { graph = new class_graph(); } |
|
2572 |
- if (depth === void 0) { depth = 0; } |
|
2573 |
- if (graph.nodes.indexOf(filepointer.toString()) >= 0) { |
|
2574 |
- return (function (resolve, reject) { return resolve(graph); }); |
|
7267 |
+ var node = make_node(filepointer, data); |
|
7268 |
+ if (graph.has(node)) { |
|
7269 |
+ return lib_call.executor_resolve(graph); |
|
2575 | 7270 |
} |
2576 | 7271 |
else { |
2577 |
- return (function (resolve, reject) { |
|
2578 |
- executor_chain({ |
|
2579 |
- "graph": graph, |
|
2580 |
- "data": null, |
|
2581 |
- }, [ |
|
2582 |
- function (state_) { return function (resolve_, reject_) { |
|
2583 |
- state_.graph.nodes.push(filepointer.toString()); |
|
2584 |
- resolve_(state_); |
|
2585 |
- }; }, |
|
2586 |
- function (state_) { return function (resolve_, reject_) { |
|
2587 |
- read(filepointer.toString())(function (data) { state_.data = data; resolve_(state_); }, reject_); |
|
2588 |
- }; }, |
|
2589 |
- function (state_) { return executor_chain(state_, fetch(state_.data, "dependencies", [], 0).map(function (path) { return function (state__) { return function (resolve__, reject__) { |
|
2590 |
- // (new class_message("-- dep.-path is '" + path + "'", {"depth": depth})).stderr(); |
|
2591 |
- var filepointer_ = lib_path.filepointer_read(path); |
|
2592 |
- var filepointer__ = filepointer.foo(filepointer_); |
|
2593 |
- // (new class_message("-- combining " + ("'" + filepointer.toString() + "'") + " and " + ("'" + filepointer_.toString() + "'") + " to " + ("'" + filepointer__.toString() + "'"), {"depth": depth})).stderr(); |
|
2594 |
- var edge = { "from": filepointer__.toString(), "to": filepointer.toString() }; |
|
2595 |
- state__.graph.edges.push(edge); |
|
2596 |
- scan(filepointer__, state__.graph, depth + 1)(function (graph_) { state_.graph = graph_; resolve__(state__); }, reject__); |
|
2597 |
- }; }; })); }, |
|
2598 |
- ])(function (state) { return resolve(state.graph); }, reject); |
|
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); |
|
2599 | 7284 |
}); |
7285 |
+ }; }; }))); |
|
2600 | 7286 |
} |
2601 | 7287 |
} |
2602 | 7288 |
/** |
2603 | 7289 |
* @author fenris |
2604 | 7290 |
*/ |
2605 | 7291 |
function main(args) { |
2606 |
- configuration = { |
|
2607 |
- "version": "0.0.4", |
|
2608 |
- "tempfolder": "/tmp/", |
|
2609 |
- "path_source": "source", |
|
2610 |
- "path_build": "build", |
|
2611 |
- "target": "gnumake", |
|
2612 |
- "system": "unix", |
|
2613 |
- "raw": false, |
|
2614 |
- "execute": false, |
|
2615 |
- "output": null, |
|
2616 |
- "path": "project.json", |
|
2617 |
- }; |
|
2618 |
- /* |
|
2619 |
- let argumentparser : lib_arguments.class_argumentparser = new lib_arguments.class_parser( |
|
2620 |
- [ |
|
2621 |
- new lib_arguments.class_argument_volatile<string>( |
|
2622 |
- { |
|
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", |
|
2623 | 7333 |
"type": "string", |
2624 |
- "ids_long": ["target"], |
|
2625 |
- "ids_short": ["t"], |
|
2626 | 7334 |
"default": "gnumake", |
2627 |
- "info": "the target build system; valid values are 'gnumake','ant'", |
|
2628 |
- } |
|
2629 |
- ), |
|
2630 |
- new lib_arguments.class_argument_volatile<string>( |
|
2631 |
- { |
|
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", |
|
2632 | 7344 |
"type": "string", |
2633 |
- "ids_long": ["system"], |
|
2634 |
- "ids_short": ["s"], |
|
2635 | 7345 |
"default": "unix", |
2636 | 7346 |
"info": "the target platform; valid values are 'unix', 'win'; default is 'unix'", |
2637 |
- } |
|
2638 |
- ), |
|
2639 |
- new lib_arguments.class_argument_volatile_boolean( |
|
2640 |
- { |
|
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", |
|
2641 | 7366 |
"type": "boolean", |
2642 |
- "ids_long": ["raw"], |
|
2643 |
- "ids_short": ["r"], |
|
2644 |
- "default": false, |
|
2645 | 7367 |
"info": "if set, depedencies are ignored/excluded from the output", |
2646 |
- } |
|
2647 |
- ), |
|
2648 |
- new lib_arguments.class_argument_volatile<boolean>( |
|
2649 |
- { |
|
7368 |
+ "kind": "volatile", |
|
7369 |
+ "parameters": { |
|
7370 |
+ "indicators_long": ["raw"], |
|
7371 |
+ "indicators_short": ["r"], |
|
7372 |
+ }, |
|
7373 |
+ }), |
|
7374 |
+ new lib_args.class_argument({ |
|
7375 |
+ "name": "execute", |
|
2650 | 7376 |
"type": "boolean", |
2651 |
- "ids_long": ["execute"], |
|
2652 |
- "ids_short": ["x"], |
|
2653 |
- "default": false, |
|
2654 | 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; |
|
2655 | 7406 |
} |
2656 |
- ), |
|
2657 |
- ] |
|
2658 |
- ); |
|
2659 |
- */ |
|
2660 |
- var procede = args.every(function (arg) { |
|
2661 |
- if ((arg.indexOf("--") == 0) || (arg.indexOf("-") == 0)) { |
|
2662 |
- var parts = arg.split("="); |
|
2663 |
- switch (parts[0]) { |
|
2664 |
- case "--help": |
|
2665 |
- case "-h": { |
|
2666 |
- (new class_message("NAME")).stdout(); |
|
2667 |
- (new class_message("Koralle Build System Abstractor", { "depth": 1 })).stdout(); |
|
2668 |
- (new class_message("")).stdout(); |
|
2669 |
- { |
|
2670 |
- (new class_message("SYNOPSIS")).stdout(); |
|
2671 |
- (new class_message("koralle [--target=gnumake|ant] [--system=unix|win] <path-to-project.json>", { "depth": 1 })).stdout(); |
|
2672 |
- (new class_message("")).stdout(); |
|
2673 |
- } |
|
2674 |
- { |
|
2675 |
- (new class_message("DESCRIPTION")).stdout(); |
|
2676 |
- (new class_message("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').", { "depth": 1 })).stdout(); |
|
2677 |
- (new class_message("", { "depth": 1 })).stdout(); |
|
2678 |
- (new class_message("Koralle is designed for reducing the amount of text needed to define the build-process.", { "depth": 1 })).stdout(); |
|
2679 |
- (new class_message("")).stdout(); |
|
2680 |
- } |
|
2681 |
- { |
|
2682 |
- (new class_message("OPTIONS")).stdout(); |
|
2683 |
- { |
|
2684 |
- (new class_message("--target | -t", { "depth": 1 })).stdout(); |
|
2685 |
- (new class_message("the target build system; valid values are 'gnumake','ant'; default is 'gnumake'", { "depth": 2 })).stdout(); |
|
2686 |
- (new class_message("")).stdout(); |
|
2687 |
- } |
|
2688 |
- { |
|
2689 |
- (new class_message("--system | -s", { "depth": 1 })).stdout(); |
|
2690 |
- (new class_message("the target platform; valid values are 'unix', 'win'; default is 'unix'", { "depth": 2 })).stdout(); |
|
2691 |
- (new class_message("")).stdout(); |
|
2692 |
- } |
|
2693 |
- { |
|
2694 |
- (new class_message("--raw | -r", { "depth": 1 })).stdout(); |
|
2695 |
- (new class_message("if set, depedencies are ignored/excluded from the output", { "depth": 2 })).stdout(); |
|
2696 |
- (new class_message("")).stdout(); |
|
2697 |
- } |
|
2698 |
- { |
|
2699 |
- (new class_message("--execute | -x", { "depth": 1 })).stdout(); |
|
2700 |
- (new class_message("if set, the build script will be executed", { "depth": 2 })).stdout(); |
|
2701 |
- (new class_message("")).stdout(); |
|
2702 |
- } |
|
2703 |
- { |
|
2704 |
- (new class_message("--output | -o", { "depth": 1 })).stdout(); |
|
2705 |
- (new class_message("the path of the output file", { "depth": 2 })).stdout(); |
|
2706 |
- (new class_message("")).stdout(); |
|
2707 |
- } |
|
2708 |
- { |
|
2709 |
- (new class_message("--version | -v", { "depth": 1 })).stdout(); |
|
2710 |
- (new class_message("print the version and exit", { "depth": 2 })).stdout(); |
|
2711 |
- (new class_message("")).stdout(); |
|
2712 |
- } |
|
2713 |
- { |
|
2714 |
- (new class_message("--help | -h", { "depth": 1 })).stdout(); |
|
2715 |
- (new class_message("show this help and exit", { "depth": 2 })).stdout(); |
|
2716 |
- (new class_message("")).stdout(); |
|
2717 |
- } |
|
2718 |
- } |
|
2719 |
- { |
|
2720 |
- (new class_message("AUTHOR")).stdout(); |
|
2721 |
- (new class_message("Christian Fraß <frass@greenscale.de>", { "depth": 1 })).stdout(); |
|
2722 |
- (new class_message("")).stdout(); |
|
2723 |
- } |
|
2724 |
- return false; |
|
2725 |
- break; |
|
2726 |
- } |
|
2727 |
- case "--version": |
|
2728 |
- case "-v": { |
|
2729 |
- (new class_message(configuration["version"].toString())).stdout(); |
|
2730 |
- return false; |
|
2731 |
- break; |
|
2732 |
- } |
|
2733 |
- case "--target": |
|
2734 |
- case "-t": { |
|
2735 |
- configuration["target"] = parts[1]; |
|
2736 |
- return true; |
|
2737 |
- break; |
|
2738 |
- } |
|
2739 |
- case "--system": |
|
2740 |
- case "-s": { |
|
2741 |
- configuration["system"] = parts[1]; |
|
2742 |
- configuration["tempfolder"] = { |
|
2743 |
- "win": "%TEMP%/", |
|
2744 |
- "unix": "/tmp/", |
|
2745 |
- }[configuration["system"]]; |
|
2746 |
- return true; |
|
2747 |
- break; |
|
2748 |
- } |
|
2749 |
- case "--raw": |
|
2750 |
- case "-r": { |
|
2751 |
- configuration["raw"] = true; |
|
2752 |
- return true; |
|
2753 |
- break; |
|
2754 |
- } |
|
2755 |
- case "--output": |
|
2756 |
- case "-o": { |
|
2757 |
- configuration["output"] = parts[1]; |
|
2758 |
- return true; |
|
2759 |
- break; |
|
2760 |
- } |
|
2761 |
- case "--execute": |
|
2762 |
- case "-x": { |
|
2763 |
- configuration["execute"] = true; |
|
2764 |
- return true; |
|
2765 |
- break; |
|
2766 |
- } |
|
2767 |
- default: { |
|
2768 |
- return false; |
|
2769 |
- throw (new Error("unrecognized option '" + parts[0] + "'")); |
|
2770 |
- break; |
|
2771 |
- } |
|
7407 |
+ else if (argdata["version"]) { |
|
7408 |
+ (new class_message(configuration.version.toString())).stdout(); |
|
7409 |
+ procede = false; |
|
2772 | 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; |
|
2773 | 7414 |
} |
2774 | 7415 |
else { |
2775 |
- configuration["path"] = arg; |
|
2776 |
- return true; |
|
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; |
|
2777 | 7424 |
} |
2778 |
- }); |
|
2779 | 7425 |
if (procede) { |
2780 |
- executor_chain({}, [ |
|
7426 |
+ lib_call.executor_chain({}, [ |
|
2781 | 7427 |
// environment |
2782 | 7428 |
function (state) { return function (resolve, reject) { |
2783 |
- var filepointer = lib_path.filepointer_read(configuration["path"]); |
|
7429 |
+ var filepointer = lib_path.filepointer_read(configuration.path); |
|
2784 | 7430 |
filepointer.location.go_thither(); |
2785 | 7431 |
state.filepointer = filepointer; |
2786 | 7432 |
resolve(state); |
2787 | 7433 |
}; }, |
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 |
+ }; }, |
|
2788 | 7464 |
// scan dependencies |
2789 | 7465 |
function (state) { return function (resolve, reject) { |
2790 |
- if (configuration["raw"]) { |
|
7466 |
+ if (configuration.raw) { |
|
2791 | 7467 |
state.order = []; |
2792 | 7468 |
resolve(state); |
2793 | 7469 |
} |
2794 | 7470 |
else { |
2795 |
- scan(state.filepointer)(function (graph) { |
|
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 |
+ } |
|
2796 | 7478 |
try { |
2797 |
- var order = topsort(graph).filter(function (path) { return (path != state.filepointer.toString()); }); |
|
7479 |
+ var order = graph |
|
7480 |
+ .topsort() |
|
7481 |
+ .map(function (x) { return x.filepointer.toString(); }) |
|
7482 |
+ .filter(function (path) { return (path != state.filepointer.toString()); }); |
|
2798 | 7483 |
state.order = order; |
2799 | 7484 |
resolve(state); |
2800 | 7485 |
} |
2801 | 7486 |
catch (exception) { |
2802 | 7487 |
reject((exception)); |
2803 | 7488 |
} |
2804 |
- }, reject); |
|
7489 |
+ }, function (reason) { return reject(new class_error("scanning dependencies failed", [reason])); }); |
|
2805 | 7490 |
} |
2806 | 7491 |
}; }, |
2807 | 7492 |
// setup project |
2808 | 7493 |
function (state) { return function (resolve, reject) { |
2809 |
- read(state.filepointer.toString())(function (data) { state.project = class_project.create(data); resolve(state); }, reject); |
|
2810 |
- }; }, |
|
2811 |
- // setup target |
|
2812 |
- function (state) { return function (resolve, reject) { |
|
2813 |
- var mapping = { |
|
2814 |
- "ant": new class_target_ant(), |
|
2815 |
- "gnumake": new class_target_gnumake(), |
|
2816 |
- "make": new class_target_gnumake(), |
|
2817 |
- }; |
|
2818 |
- var target = fetch(mapping, configuration["target"], null, 0); |
|
2819 |
- if (target == null) { |
|
2820 |
- reject(new Error("no implementation found for target '" + configuration["target"] + "'")); |
|
2821 |
- } |
|
2822 |
- else { |
|
2823 |
- state.target = target; |
|
7494 |
+ state.project = class_project.create(state.project_raw); |
|
2824 | 7495 |
resolve(state); |
2825 |
- } |
|
2826 | 7496 |
}; }, |
2827 | 7497 |
// generate |
2828 | 7498 |
function (state) { return function (resolve, reject) { |
2829 | 7499 |
state.project.dependencies_set(state.order); |
2830 | 7500 |
try { |
2831 |
- var script = state.target.compile_project_string(state.project, configuration["raw"]); |
|
7501 |
+ var script = state.output.compile_project_string(state.project, configuration.raw); |
|
2832 | 7502 |
state.script = script; |
2833 | 7503 |
resolve(state); |
2834 | 7504 |
} |
2835 | 7505 |
catch (exception) { |
2836 |
- reject((exception)); |
|
7506 |
+ reject(new class_error("generating build script failed", [exception])); |
|
2837 | 7507 |
} |
2838 | 7508 |
}; }, |
2839 |
- // output |
|
7509 |
+ // write |
|
2840 | 7510 |
function (state) { return function (resolve, reject) { |
2841 | 7511 |
var filepointer; |
2842 |
- if (configuration["output"] == null) { |
|
2843 |
- if (!configuration["execute"]) { |
|
7512 |
+ if (configuration.file == null) { |
|
7513 |
+ if (!configuration.execute) { |
|
2844 | 7514 |
filepointer = null; |
2845 | 7515 |
} |
2846 | 7516 |
else { |
2847 | 7517 |
filepointer = new lib_path.class_filepointer( |
2848 | 7518 |
// new lib_path.class_location(null, new lib_path.class_path(["."])), |
2849 |
- lib_path.class_location.read(configuration["tempfolder"]), "_koralle_"); |
|
7519 |
+ lib_path.location_read(configuration.tempfolder, configuration.system), "_koralle_"); |
|
2850 | 7520 |
} |
2851 | 7521 |
} |
2852 | 7522 |
else { |
2853 |
- filepointer = lib_path.class_filepointer.read(configuration["output"]); |
|
7523 |
+ filepointer = lib_path.filepointer_read(configuration.file); |
|
2854 | 7524 |
} |
7525 |
+ state.file = filepointer; |
|
2855 | 7526 |
if (filepointer == null) { |
2856 | 7527 |
(new class_message(state.script)).stdout(); |
7528 |
+ resolve(state); |
|
2857 | 7529 |
} |
2858 | 7530 |
else { |
2859 |
- _fs.writeFile(filepointer.toString(), state.script); |
|
2860 |
- } |
|
2861 |
- state.output = filepointer; |
|
7531 |
+ _fs.writeFile(filepointer.toString(), state.script, function (error) { |
|
7532 |
+ if (error == null) { |
|
2862 | 7533 |
resolve(state); |
7534 |
+ } |
|
7535 |
+ else { |
|
7536 |
+ reject(new class_error("writing to file failed", [error])); |
|
7537 |
+ } |
|
7538 |
+ }); |
|
7539 |
+ } |
|
2863 | 7540 |
}; }, |
2864 |
- // execution |
|
7541 |
+ // execute |
|
2865 | 7542 |
function (state) { return function (resolve, reject) { |
2866 |
- if (!configuration["execute"]) { |
|
7543 |
+ if (!configuration.execute) { |
|
2867 | 7544 |
resolve(state); |
2868 | 7545 |
} |
2869 | 7546 |
else { |
2870 |
- state.target.execute(state.output)(function (result) { return resolve(state); }, reject); |
|
7547 |
+ state.output.execute(state.file)(function (result) { return resolve(state); }, function (reason) { return reject(new class_error("execution of build script failed", [reason])); }); |
|
2871 | 7548 |
} |
2872 | 7549 |
}; }, |
2873 | 7550 |
])(function (state) { |
2874 | 7551 |
// (new class_message("successfull", {"type": "information", "prefix": "koralle"})).stderr(); |
7552 |
+ process.exit(0); |
|
2875 | 7553 |
}, function (reason) { |
2876 | 7554 |
// throw reason; |
2877 |
- console.error(reason); |
|
2878 |
- (new class_message("an error occured: " + String(reason), { "type": "error", "prefix": "koralle" })).stderr(); |
|
7555 |
+ // console.error(reason); |
|
7556 |
+ (new class_message("the following error occured: '" + reason.toString() + "'", { "type": "error", "prefix": "koralle" })).stderr(); |
|
7557 |
+ process.exit(-1); |
|
2879 | 7558 |
}); |
2880 | 7559 |
} |
2881 | 7560 |
} |
7561 |
+configuration.invocation = { |
|
7562 |
+ "interpreter": process.argv[0], |
|
7563 |
+ "path": process.argv[1], |
|
7564 |
+}; |
|
2882 | 7565 |
main(process.argv.slice(2)); |
2883 | 7566 |