Christian Fraß commited on 2021-03-08 23:02:57
Zeige 25 geänderte Dateien mit 16822 Einfügungen und 0 Löschungen.
... | ... |
@@ -0,0 +1,861 @@ |
1 |
+Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
2 |
+<info@greenscale.de> |
|
3 |
+ |
|
4 |
+»bacterio-plankton:base« is free software: you can redistribute it and/or modify |
|
5 |
+it under the terms of the GNU Lesser General Public License as published by |
|
6 |
+the Free Software Foundation, either version 3 of the License, or |
|
7 |
+(at your option) any later version. |
|
8 |
+ |
|
9 |
+»bacterio-plankton:base« is distributed in the hope that it will be useful, |
|
10 |
+but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 |
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 |
+GNU Lesser General Public License for more details. |
|
13 |
+ |
|
14 |
+You should have received a copy of the GNU Lesser General Public License |
|
15 |
+along with »bacterio-plankton:base«. If not, see <http://www.gnu.org/licenses/>. |
|
16 |
+ |
|
17 |
+ |
|
18 |
+ |
|
19 |
+ GNU GENERAL PUBLIC LICENSE |
|
20 |
+ Version 3, 29 June 2007 |
|
21 |
+ |
|
22 |
+ Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/> |
|
23 |
+ Everyone is permitted to copy and distribute verbatim copies |
|
24 |
+ of this license document, but changing it is not allowed. |
|
25 |
+ |
|
26 |
+ Preamble |
|
27 |
+ |
|
28 |
+ The GNU General Public License is a free, copyleft license for |
|
29 |
+software and other kinds of works. |
|
30 |
+ |
|
31 |
+ The licenses for most software and other practical works are designed |
|
32 |
+to take away your freedom to share and change the works. By contrast, |
|
33 |
+the GNU General Public License is intended to guarantee your freedom to |
|
34 |
+share and change all versions of a program--to make sure it remains free |
|
35 |
+software for all its users. We, the Free Software Foundation, use the |
|
36 |
+GNU General Public License for most of our software; it applies also to |
|
37 |
+any other work released this way by its authors. You can apply it to |
|
38 |
+your programs, too. |
|
39 |
+ |
|
40 |
+ When we speak of free software, we are referring to freedom, not |
|
41 |
+price. Our General Public Licenses are designed to make sure that you |
|
42 |
+have the freedom to distribute copies of free software (and charge for |
|
43 |
+them if you wish), that you receive source code or can get it if you |
|
44 |
+want it, that you can change the software or use pieces of it in new |
|
45 |
+free programs, and that you know you can do these things. |
|
46 |
+ |
|
47 |
+ To protect your rights, we need to prevent others from denying you |
|
48 |
+these rights or asking you to surrender the rights. Therefore, you have |
|
49 |
+certain responsibilities if you distribute copies of the software, or if |
|
50 |
+you modify it: responsibilities to respect the freedom of others. |
|
51 |
+ |
|
52 |
+ For example, if you distribute copies of such a program, whether |
|
53 |
+gratis or for a fee, you must pass on to the recipients the same |
|
54 |
+freedoms that you received. You must make sure that they, too, receive |
|
55 |
+or can get the source code. And you must show them these terms so they |
|
56 |
+know their rights. |
|
57 |
+ |
|
58 |
+ Developers that use the GNU GPL protect your rights with two steps: |
|
59 |
+(1) assert copyright on the software, and (2) offer you this License |
|
60 |
+giving you legal permission to copy, distribute and/or modify it. |
|
61 |
+ |
|
62 |
+ For the developers' and authors' protection, the GPL clearly explains |
|
63 |
+that there is no warranty for this free software. For both users' and |
|
64 |
+authors' sake, the GPL requires that modified versions be marked as |
|
65 |
+changed, so that their problems will not be attributed erroneously to |
|
66 |
+authors of previous versions. |
|
67 |
+ |
|
68 |
+ Some devices are designed to deny users access to install or run |
|
69 |
+modified versions of the software inside them, although the manufacturer |
|
70 |
+can do so. This is fundamentally incompatible with the aim of |
|
71 |
+protecting users' freedom to change the software. The systematic |
|
72 |
+pattern of such abuse occurs in the area of products for individuals to |
|
73 |
+use, which is precisely where it is most unacceptable. Therefore, we |
|
74 |
+have designed this version of the GPL to prohibit the practice for those |
|
75 |
+products. If such problems arise substantially in other domains, we |
|
76 |
+stand ready to extend this provision to those domains in future versions |
|
77 |
+of the GPL, as needed to protect the freedom of users. |
|
78 |
+ |
|
79 |
+ Finally, every program is threatened constantly by software patents. |
|
80 |
+States should not allow patents to restrict development and use of |
|
81 |
+software on general-purpose computers, but in those that do, we wish to |
|
82 |
+avoid the special danger that patents applied to a free program could |
|
83 |
+make it effectively proprietary. To prevent this, the GPL assures that |
|
84 |
+patents cannot be used to render the program non-free. |
|
85 |
+ |
|
86 |
+ The precise terms and conditions for copying, distribution and |
|
87 |
+modification follow. |
|
88 |
+ |
|
89 |
+ TERMS AND CONDITIONS |
|
90 |
+ |
|
91 |
+ 0. Definitions. |
|
92 |
+ |
|
93 |
+ "This License" refers to version 3 of the GNU General Public License. |
|
94 |
+ |
|
95 |
+ "Copyright" also means copyright-like laws that apply to other kinds of |
|
96 |
+works, such as semiconductor masks. |
|
97 |
+ |
|
98 |
+ "The Program" refers to any copyrightable work licensed under this |
|
99 |
+License. Each licensee is addressed as "you". "Licensees" and |
|
100 |
+"recipients" may be individuals or organizations. |
|
101 |
+ |
|
102 |
+ To "modify" a work means to copy from or adapt all or part of the work |
|
103 |
+in a fashion requiring copyright permission, other than the making of an |
|
104 |
+exact copy. The resulting work is called a "modified version" of the |
|
105 |
+earlier work or a work "based on" the earlier work. |
|
106 |
+ |
|
107 |
+ A "covered work" means either the unmodified Program or a work based |
|
108 |
+on the Program. |
|
109 |
+ |
|
110 |
+ To "propagate" a work means to do anything with it that, without |
|
111 |
+permission, would make you directly or secondarily liable for |
|
112 |
+infringement under applicable copyright law, except executing it on a |
|
113 |
+computer or modifying a private copy. Propagation includes copying, |
|
114 |
+distribution (with or without modification), making available to the |
|
115 |
+public, and in some countries other activities as well. |
|
116 |
+ |
|
117 |
+ To "convey" a work means any kind of propagation that enables other |
|
118 |
+parties to make or receive copies. Mere interaction with a user through |
|
119 |
+a computer network, with no transfer of a copy, is not conveying. |
|
120 |
+ |
|
121 |
+ An interactive user interface displays "Appropriate Legal Notices" |
|
122 |
+to the extent that it includes a convenient and prominently visible |
|
123 |
+feature that (1) displays an appropriate copyright notice, and (2) |
|
124 |
+tells the user that there is no warranty for the work (except to the |
|
125 |
+extent that warranties are provided), that licensees may convey the |
|
126 |
+work under this License, and how to view a copy of this License. If |
|
127 |
+the interface presents a list of user commands or options, such as a |
|
128 |
+menu, a prominent item in the list meets this criterion. |
|
129 |
+ |
|
130 |
+ 1. Source Code. |
|
131 |
+ |
|
132 |
+ The "source code" for a work means the preferred form of the work |
|
133 |
+for making modifications to it. "Object code" means any non-source |
|
134 |
+form of a work. |
|
135 |
+ |
|
136 |
+ A "Standard Interface" means an interface that either is an official |
|
137 |
+standard defined by a recognized standards body, or, in the case of |
|
138 |
+interfaces specified for a particular programming language, one that |
|
139 |
+is widely used among developers working in that language. |
|
140 |
+ |
|
141 |
+ The "System Libraries" of an executable work include anything, other |
|
142 |
+than the work as a whole, that (a) is included in the normal form of |
|
143 |
+packaging a Major Component, but which is not part of that Major |
|
144 |
+Component, and (b) serves only to enable use of the work with that |
|
145 |
+Major Component, or to implement a Standard Interface for which an |
|
146 |
+implementation is available to the public in source code form. A |
|
147 |
+"Major Component", in this context, means a major essential component |
|
148 |
+(kernel, window system, and so on) of the specific operating system |
|
149 |
+(if any) on which the executable work runs, or a compiler used to |
|
150 |
+produce the work, or an object code interpreter used to run it. |
|
151 |
+ |
|
152 |
+ The "Corresponding Source" for a work in object code form means all |
|
153 |
+the source code needed to generate, install, and (for an executable |
|
154 |
+work) run the object code and to modify the work, including scripts to |
|
155 |
+control those activities. However, it does not include the work's |
|
156 |
+System Libraries, or general-purpose tools or generally available free |
|
157 |
+programs which are used unmodified in performing those activities but |
|
158 |
+which are not part of the work. For example, Corresponding Source |
|
159 |
+includes interface definition files associated with source files for |
|
160 |
+the work, and the source code for shared libraries and dynamically |
|
161 |
+linked subprograms that the work is specifically designed to require, |
|
162 |
+such as by intimate data communication or control flow between those |
|
163 |
+subprograms and other parts of the work. |
|
164 |
+ |
|
165 |
+ The Corresponding Source need not include anything that users |
|
166 |
+can regenerate automatically from other parts of the Corresponding |
|
167 |
+Source. |
|
168 |
+ |
|
169 |
+ The Corresponding Source for a work in source code form is that |
|
170 |
+same work. |
|
171 |
+ |
|
172 |
+ 2. Basic Permissions. |
|
173 |
+ |
|
174 |
+ All rights granted under this License are granted for the term of |
|
175 |
+copyright on the Program, and are irrevocable provided the stated |
|
176 |
+conditions are met. This License explicitly affirms your unlimited |
|
177 |
+permission to run the unmodified Program. The output from running a |
|
178 |
+covered work is covered by this License only if the output, given its |
|
179 |
+content, constitutes a covered work. This License acknowledges your |
|
180 |
+rights of fair use or other equivalent, as provided by copyright law. |
|
181 |
+ |
|
182 |
+ You may make, run and propagate covered works that you do not |
|
183 |
+convey, without conditions so long as your license otherwise remains |
|
184 |
+in force. You may convey covered works to others for the sole purpose |
|
185 |
+of having them make modifications exclusively for you, or provide you |
|
186 |
+with facilities for running those works, provided that you comply with |
|
187 |
+the terms of this License in conveying all material for which you do |
|
188 |
+not control copyright. Those thus making or running the covered works |
|
189 |
+for you must do so exclusively on your behalf, under your direction |
|
190 |
+and control, on terms that prohibit them from making any copies of |
|
191 |
+your copyrighted material outside their relationship with you. |
|
192 |
+ |
|
193 |
+ Conveying under any other circumstances is permitted solely under |
|
194 |
+the conditions stated below. Sublicensing is not allowed; section 10 |
|
195 |
+makes it unnecessary. |
|
196 |
+ |
|
197 |
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law. |
|
198 |
+ |
|
199 |
+ No covered work shall be deemed part of an effective technological |
|
200 |
+measure under any applicable law fulfilling obligations under article |
|
201 |
+11 of the WIPO copyright treaty adopted on 20 December 1996, or |
|
202 |
+similar laws prohibiting or restricting circumvention of such |
|
203 |
+measures. |
|
204 |
+ |
|
205 |
+ When you convey a covered work, you waive any legal power to forbid |
|
206 |
+circumvention of technological measures to the extent such circumvention |
|
207 |
+is effected by exercising rights under this License with respect to |
|
208 |
+the covered work, and you disclaim any intention to limit operation or |
|
209 |
+modification of the work as a means of enforcing, against the work's |
|
210 |
+users, your or third parties' legal rights to forbid circumvention of |
|
211 |
+technological measures. |
|
212 |
+ |
|
213 |
+ 4. Conveying Verbatim Copies. |
|
214 |
+ |
|
215 |
+ You may convey verbatim copies of the Program's source code as you |
|
216 |
+receive it, in any medium, provided that you conspicuously and |
|
217 |
+appropriately publish on each copy an appropriate copyright notice; |
|
218 |
+keep intact all notices stating that this License and any |
|
219 |
+non-permissive terms added in accord with section 7 apply to the code; |
|
220 |
+keep intact all notices of the absence of any warranty; and give all |
|
221 |
+recipients a copy of this License along with the Program. |
|
222 |
+ |
|
223 |
+ You may charge any price or no price for each copy that you convey, |
|
224 |
+and you may offer support or warranty protection for a fee. |
|
225 |
+ |
|
226 |
+ 5. Conveying Modified Source Versions. |
|
227 |
+ |
|
228 |
+ You may convey a work based on the Program, or the modifications to |
|
229 |
+produce it from the Program, in the form of source code under the |
|
230 |
+terms of section 4, provided that you also meet all of these conditions: |
|
231 |
+ |
|
232 |
+ a) The work must carry prominent notices stating that you modified |
|
233 |
+ it, and giving a relevant date. |
|
234 |
+ |
|
235 |
+ b) The work must carry prominent notices stating that it is |
|
236 |
+ released under this License and any conditions added under section |
|
237 |
+ 7. This requirement modifies the requirement in section 4 to |
|
238 |
+ "keep intact all notices". |
|
239 |
+ |
|
240 |
+ c) You must license the entire work, as a whole, under this |
|
241 |
+ License to anyone who comes into possession of a copy. This |
|
242 |
+ License will therefore apply, along with any applicable section 7 |
|
243 |
+ additional terms, to the whole of the work, and all its parts, |
|
244 |
+ regardless of how they are packaged. This License gives no |
|
245 |
+ permission to license the work in any other way, but it does not |
|
246 |
+ invalidate such permission if you have separately received it. |
|
247 |
+ |
|
248 |
+ d) If the work has interactive user interfaces, each must display |
|
249 |
+ Appropriate Legal Notices; however, if the Program has interactive |
|
250 |
+ interfaces that do not display Appropriate Legal Notices, your |
|
251 |
+ work need not make them do so. |
|
252 |
+ |
|
253 |
+ A compilation of a covered work with other separate and independent |
|
254 |
+works, which are not by their nature extensions of the covered work, |
|
255 |
+and which are not combined with it such as to form a larger program, |
|
256 |
+in or on a volume of a storage or distribution medium, is called an |
|
257 |
+"aggregate" if the compilation and its resulting copyright are not |
|
258 |
+used to limit the access or legal rights of the compilation's users |
|
259 |
+beyond what the individual works permit. Inclusion of a covered work |
|
260 |
+in an aggregate does not cause this License to apply to the other |
|
261 |
+parts of the aggregate. |
|
262 |
+ |
|
263 |
+ 6. Conveying Non-Source Forms. |
|
264 |
+ |
|
265 |
+ You may convey a covered work in object code form under the terms |
|
266 |
+of sections 4 and 5, provided that you also convey the |
|
267 |
+machine-readable Corresponding Source under the terms of this License, |
|
268 |
+in one of these ways: |
|
269 |
+ |
|
270 |
+ a) Convey the object code in, or embodied in, a physical product |
|
271 |
+ (including a physical distribution medium), accompanied by the |
|
272 |
+ Corresponding Source fixed on a durable physical medium |
|
273 |
+ customarily used for software interchange. |
|
274 |
+ |
|
275 |
+ b) Convey the object code in, or embodied in, a physical product |
|
276 |
+ (including a physical distribution medium), accompanied by a |
|
277 |
+ written offer, valid for at least three years and valid for as |
|
278 |
+ long as you offer spare parts or customer support for that product |
|
279 |
+ model, to give anyone who possesses the object code either (1) a |
|
280 |
+ copy of the Corresponding Source for all the software in the |
|
281 |
+ product that is covered by this License, on a durable physical |
|
282 |
+ medium customarily used for software interchange, for a price no |
|
283 |
+ more than your reasonable cost of physically performing this |
|
284 |
+ conveying of source, or (2) access to copy the |
|
285 |
+ Corresponding Source from a network server at no charge. |
|
286 |
+ |
|
287 |
+ c) Convey individual copies of the object code with a copy of the |
|
288 |
+ written offer to provide the Corresponding Source. This |
|
289 |
+ alternative is allowed only occasionally and noncommercially, and |
|
290 |
+ only if you received the object code with such an offer, in accord |
|
291 |
+ with subsection 6b. |
|
292 |
+ |
|
293 |
+ d) Convey the object code by offering access from a designated |
|
294 |
+ place (gratis or for a charge), and offer equivalent access to the |
|
295 |
+ Corresponding Source in the same way through the same place at no |
|
296 |
+ further charge. You need not require recipients to copy the |
|
297 |
+ Corresponding Source along with the object code. If the place to |
|
298 |
+ copy the object code is a network server, the Corresponding Source |
|
299 |
+ may be on a different server (operated by you or a third party) |
|
300 |
+ that supports equivalent copying facilities, provided you maintain |
|
301 |
+ clear directions next to the object code saying where to find the |
|
302 |
+ Corresponding Source. Regardless of what server hosts the |
|
303 |
+ Corresponding Source, you remain obligated to ensure that it is |
|
304 |
+ available for as long as needed to satisfy these requirements. |
|
305 |
+ |
|
306 |
+ e) Convey the object code using peer-to-peer transmission, provided |
|
307 |
+ you inform other peers where the object code and Corresponding |
|
308 |
+ Source of the work are being offered to the general public at no |
|
309 |
+ charge under subsection 6d. |
|
310 |
+ |
|
311 |
+ A separable portion of the object code, whose source code is excluded |
|
312 |
+from the Corresponding Source as a System Library, need not be |
|
313 |
+included in conveying the object code work. |
|
314 |
+ |
|
315 |
+ A "User Product" is either (1) a "consumer product", which means any |
|
316 |
+tangible personal property which is normally used for personal, family, |
|
317 |
+or household purposes, or (2) anything designed or sold for incorporation |
|
318 |
+into a dwelling. In determining whether a product is a consumer product, |
|
319 |
+doubtful cases shall be resolved in favor of coverage. For a particular |
|
320 |
+product received by a particular user, "normally used" refers to a |
|
321 |
+typical or common use of that class of product, regardless of the status |
|
322 |
+of the particular user or of the way in which the particular user |
|
323 |
+actually uses, or expects or is expected to use, the product. A product |
|
324 |
+is a consumer product regardless of whether the product has substantial |
|
325 |
+commercial, industrial or non-consumer uses, unless such uses represent |
|
326 |
+the only significant mode of use of the product. |
|
327 |
+ |
|
328 |
+ "Installation Information" for a User Product means any methods, |
|
329 |
+procedures, authorization keys, or other information required to install |
|
330 |
+and execute modified versions of a covered work in that User Product from |
|
331 |
+a modified version of its Corresponding Source. The information must |
|
332 |
+suffice to ensure that the continued functioning of the modified object |
|
333 |
+code is in no case prevented or interfered with solely because |
|
334 |
+modification has been made. |
|
335 |
+ |
|
336 |
+ If you convey an object code work under this section in, or with, or |
|
337 |
+specifically for use in, a User Product, and the conveying occurs as |
|
338 |
+part of a transaction in which the right of possession and use of the |
|
339 |
+User Product is transferred to the recipient in perpetuity or for a |
|
340 |
+fixed term (regardless of how the transaction is characterized), the |
|
341 |
+Corresponding Source conveyed under this section must be accompanied |
|
342 |
+by the Installation Information. But this requirement does not apply |
|
343 |
+if neither you nor any third party retains the ability to install |
|
344 |
+modified object code on the User Product (for example, the work has |
|
345 |
+been installed in ROM). |
|
346 |
+ |
|
347 |
+ The requirement to provide Installation Information does not include a |
|
348 |
+requirement to continue to provide support service, warranty, or updates |
|
349 |
+for a work that has been modified or installed by the recipient, or for |
|
350 |
+the User Product in which it has been modified or installed. Access to a |
|
351 |
+network may be denied when the modification itself materially and |
|
352 |
+adversely affects the operation of the network or violates the rules and |
|
353 |
+protocols for communication across the network. |
|
354 |
+ |
|
355 |
+ Corresponding Source conveyed, and Installation Information provided, |
|
356 |
+in accord with this section must be in a format that is publicly |
|
357 |
+documented (and with an implementation available to the public in |
|
358 |
+source code form), and must require no special password or key for |
|
359 |
+unpacking, reading or copying. |
|
360 |
+ |
|
361 |
+ 7. Additional Terms. |
|
362 |
+ |
|
363 |
+ "Additional permissions" are terms that supplement the terms of this |
|
364 |
+License by making exceptions from one or more of its conditions. |
|
365 |
+Additional permissions that are applicable to the entire Program shall |
|
366 |
+be treated as though they were included in this License, to the extent |
|
367 |
+that they are valid under applicable law. If additional permissions |
|
368 |
+apply only to part of the Program, that part may be used separately |
|
369 |
+under those permissions, but the entire Program remains governed by |
|
370 |
+this License without regard to the additional permissions. |
|
371 |
+ |
|
372 |
+ When you convey a copy of a covered work, you may at your option |
|
373 |
+remove any additional permissions from that copy, or from any part of |
|
374 |
+it. (Additional permissions may be written to require their own |
|
375 |
+removal in certain cases when you modify the work.) You may place |
|
376 |
+additional permissions on material, added by you to a covered work, |
|
377 |
+for which you have or can give appropriate copyright permission. |
|
378 |
+ |
|
379 |
+ Notwithstanding any other provision of this License, for material you |
|
380 |
+add to a covered work, you may (if authorized by the copyright holders of |
|
381 |
+that material) supplement the terms of this License with terms: |
|
382 |
+ |
|
383 |
+ a) Disclaiming warranty or limiting liability differently from the |
|
384 |
+ terms of sections 15 and 16 of this License; or |
|
385 |
+ |
|
386 |
+ b) Requiring preservation of specified reasonable legal notices or |
|
387 |
+ author attributions in that material or in the Appropriate Legal |
|
388 |
+ Notices displayed by works containing it; or |
|
389 |
+ |
|
390 |
+ c) Prohibiting misrepresentation of the origin of that material, or |
|
391 |
+ requiring that modified versions of such material be marked in |
|
392 |
+ reasonable ways as different from the original version; or |
|
393 |
+ |
|
394 |
+ d) Limiting the use for publicity purposes of names of licensors or |
|
395 |
+ authors of the material; or |
|
396 |
+ |
|
397 |
+ e) Declining to grant rights under trademark law for use of some |
|
398 |
+ trade names, trademarks, or service marks; or |
|
399 |
+ |
|
400 |
+ f) Requiring indemnification of licensors and authors of that |
|
401 |
+ material by anyone who conveys the material (or modified versions of |
|
402 |
+ it) with contractual assumptions of liability to the recipient, for |
|
403 |
+ any liability that these contractual assumptions directly impose on |
|
404 |
+ those licensors and authors. |
|
405 |
+ |
|
406 |
+ All other non-permissive additional terms are considered "further |
|
407 |
+restrictions" within the meaning of section 10. If the Program as you |
|
408 |
+received it, or any part of it, contains a notice stating that it is |
|
409 |
+governed by this License along with a term that is a further |
|
410 |
+restriction, you may remove that term. If a license document contains |
|
411 |
+a further restriction but permits relicensing or conveying under this |
|
412 |
+License, you may add to a covered work material governed by the terms |
|
413 |
+of that license document, provided that the further restriction does |
|
414 |
+not survive such relicensing or conveying. |
|
415 |
+ |
|
416 |
+ If you add terms to a covered work in accord with this section, you |
|
417 |
+must place, in the relevant source files, a statement of the |
|
418 |
+additional terms that apply to those files, or a notice indicating |
|
419 |
+where to find the applicable terms. |
|
420 |
+ |
|
421 |
+ Additional terms, permissive or non-permissive, may be stated in the |
|
422 |
+form of a separately written license, or stated as exceptions; |
|
423 |
+the above requirements apply either way. |
|
424 |
+ |
|
425 |
+ 8. Termination. |
|
426 |
+ |
|
427 |
+ You may not propagate or modify a covered work except as expressly |
|
428 |
+provided under this License. Any attempt otherwise to propagate or |
|
429 |
+modify it is void, and will automatically terminate your rights under |
|
430 |
+this License (including any patent licenses granted under the third |
|
431 |
+paragraph of section 11). |
|
432 |
+ |
|
433 |
+ However, if you cease all violation of this License, then your |
|
434 |
+license from a particular copyright holder is reinstated (a) |
|
435 |
+provisionally, unless and until the copyright holder explicitly and |
|
436 |
+finally terminates your license, and (b) permanently, if the copyright |
|
437 |
+holder fails to notify you of the violation by some reasonable means |
|
438 |
+prior to 60 days after the cessation. |
|
439 |
+ |
|
440 |
+ Moreover, your license from a particular copyright holder is |
|
441 |
+reinstated permanently if the copyright holder notifies you of the |
|
442 |
+violation by some reasonable means, this is the first time you have |
|
443 |
+received notice of violation of this License (for any work) from that |
|
444 |
+copyright holder, and you cure the violation prior to 30 days after |
|
445 |
+your receipt of the notice. |
|
446 |
+ |
|
447 |
+ Termination of your rights under this section does not terminate the |
|
448 |
+licenses of parties who have received copies or rights from you under |
|
449 |
+this License. If your rights have been terminated and not permanently |
|
450 |
+reinstated, you do not qualify to receive new licenses for the same |
|
451 |
+material under section 10. |
|
452 |
+ |
|
453 |
+ 9. Acceptance Not Required for Having Copies. |
|
454 |
+ |
|
455 |
+ You are not required to accept this License in order to receive or |
|
456 |
+run a copy of the Program. Ancillary propagation of a covered work |
|
457 |
+occurring solely as a consequence of using peer-to-peer transmission |
|
458 |
+to receive a copy likewise does not require acceptance. However, |
|
459 |
+nothing other than this License grants you permission to propagate or |
|
460 |
+modify any covered work. These actions infringe copyright if you do |
|
461 |
+not accept this License. Therefore, by modifying or propagating a |
|
462 |
+covered work, you indicate your acceptance of this License to do so. |
|
463 |
+ |
|
464 |
+ 10. Automatic Licensing of Downstream Recipients. |
|
465 |
+ |
|
466 |
+ Each time you convey a covered work, the recipient automatically |
|
467 |
+receives a license from the original licensors, to run, modify and |
|
468 |
+propagate that work, subject to this License. You are not responsible |
|
469 |
+for enforcing compliance by third parties with this License. |
|
470 |
+ |
|
471 |
+ An "entity transaction" is a transaction transferring control of an |
|
472 |
+organization, or substantially all assets of one, or subdividing an |
|
473 |
+organization, or merging organizations. If propagation of a covered |
|
474 |
+work results from an entity transaction, each party to that |
|
475 |
+transaction who receives a copy of the work also receives whatever |
|
476 |
+licenses to the work the party's predecessor in interest had or could |
|
477 |
+give under the previous paragraph, plus a right to possession of the |
|
478 |
+Corresponding Source of the work from the predecessor in interest, if |
|
479 |
+the predecessor has it or can get it with reasonable efforts. |
|
480 |
+ |
|
481 |
+ You may not impose any further restrictions on the exercise of the |
|
482 |
+rights granted or affirmed under this License. For example, you may |
|
483 |
+not impose a license fee, royalty, or other charge for exercise of |
|
484 |
+rights granted under this License, and you may not initiate litigation |
|
485 |
+(including a cross-claim or counterclaim in a lawsuit) alleging that |
|
486 |
+any patent claim is infringed by making, using, selling, offering for |
|
487 |
+sale, or importing the Program or any portion of it. |
|
488 |
+ |
|
489 |
+ 11. Patents. |
|
490 |
+ |
|
491 |
+ A "contributor" is a copyright holder who authorizes use under this |
|
492 |
+License of the Program or a work on which the Program is based. The |
|
493 |
+work thus licensed is called the contributor's "contributor version". |
|
494 |
+ |
|
495 |
+ A contributor's "essential patent claims" are all patent claims |
|
496 |
+owned or controlled by the contributor, whether already acquired or |
|
497 |
+hereafter acquired, that would be infringed by some manner, permitted |
|
498 |
+by this License, of making, using, or selling its contributor version, |
|
499 |
+but do not include claims that would be infringed only as a |
|
500 |
+consequence of further modification of the contributor version. For |
|
501 |
+purposes of this definition, "control" includes the right to grant |
|
502 |
+patent sublicenses in a manner consistent with the requirements of |
|
503 |
+this License. |
|
504 |
+ |
|
505 |
+ Each contributor grants you a non-exclusive, worldwide, royalty-free |
|
506 |
+patent license under the contributor's essential patent claims, to |
|
507 |
+make, use, sell, offer for sale, import and otherwise run, modify and |
|
508 |
+propagate the contents of its contributor version. |
|
509 |
+ |
|
510 |
+ In the following three paragraphs, a "patent license" is any express |
|
511 |
+agreement or commitment, however denominated, not to enforce a patent |
|
512 |
+(such as an express permission to practice a patent or covenant not to |
|
513 |
+sue for patent infringement). To "grant" such a patent license to a |
|
514 |
+party means to make such an agreement or commitment not to enforce a |
|
515 |
+patent against the party. |
|
516 |
+ |
|
517 |
+ If you convey a covered work, knowingly relying on a patent license, |
|
518 |
+and the Corresponding Source of the work is not available for anyone |
|
519 |
+to copy, free of charge and under the terms of this License, through a |
|
520 |
+publicly available network server or other readily accessible means, |
|
521 |
+then you must either (1) cause the Corresponding Source to be so |
|
522 |
+available, or (2) arrange to deprive yourself of the benefit of the |
|
523 |
+patent license for this particular work, or (3) arrange, in a manner |
|
524 |
+consistent with the requirements of this License, to extend the patent |
|
525 |
+license to downstream recipients. "Knowingly relying" means you have |
|
526 |
+actual knowledge that, but for the patent license, your conveying the |
|
527 |
+covered work in a country, or your recipient's use of the covered work |
|
528 |
+in a country, would infringe one or more identifiable patents in that |
|
529 |
+country that you have reason to believe are valid. |
|
530 |
+ |
|
531 |
+ If, pursuant to or in connection with a single transaction or |
|
532 |
+arrangement, you convey, or propagate by procuring conveyance of, a |
|
533 |
+covered work, and grant a patent license to some of the parties |
|
534 |
+receiving the covered work authorizing them to use, propagate, modify |
|
535 |
+or convey a specific copy of the covered work, then the patent license |
|
536 |
+you grant is automatically extended to all recipients of the covered |
|
537 |
+work and works based on it. |
|
538 |
+ |
|
539 |
+ A patent license is "discriminatory" if it does not include within |
|
540 |
+the scope of its coverage, prohibits the exercise of, or is |
|
541 |
+conditioned on the non-exercise of one or more of the rights that are |
|
542 |
+specifically granted under this License. You may not convey a covered |
|
543 |
+work if you are a party to an arrangement with a third party that is |
|
544 |
+in the business of distributing software, under which you make payment |
|
545 |
+to the third party based on the extent of your activity of conveying |
|
546 |
+the work, and under which the third party grants, to any of the |
|
547 |
+parties who would receive the covered work from you, a discriminatory |
|
548 |
+patent license (a) in connection with copies of the covered work |
|
549 |
+conveyed by you (or copies made from those copies), or (b) primarily |
|
550 |
+for and in connection with specific products or compilations that |
|
551 |
+contain the covered work, unless you entered into that arrangement, |
|
552 |
+or that patent license was granted, prior to 28 March 2007. |
|
553 |
+ |
|
554 |
+ Nothing in this License shall be construed as excluding or limiting |
|
555 |
+any implied license or other defenses to infringement that may |
|
556 |
+otherwise be available to you under applicable patent law. |
|
557 |
+ |
|
558 |
+ 12. No Surrender of Others' Freedom. |
|
559 |
+ |
|
560 |
+ If conditions are imposed on you (whether by court order, agreement or |
|
561 |
+otherwise) that contradict the conditions of this License, they do not |
|
562 |
+excuse you from the conditions of this License. If you cannot convey a |
|
563 |
+covered work so as to satisfy simultaneously your obligations under this |
|
564 |
+License and any other pertinent obligations, then as a consequence you may |
|
565 |
+not convey it at all. For example, if you agree to terms that obligate you |
|
566 |
+to collect a royalty for further conveying from those to whom you convey |
|
567 |
+the Program, the only way you could satisfy both those terms and this |
|
568 |
+License would be to refrain entirely from conveying the Program. |
|
569 |
+ |
|
570 |
+ 13. Use with the GNU Affero General Public License. |
|
571 |
+ |
|
572 |
+ Notwithstanding any other provision of this License, you have |
|
573 |
+permission to link or combine any covered work with a work licensed |
|
574 |
+under version 3 of the GNU Affero General Public License into a single |
|
575 |
+combined work, and to convey the resulting work. The terms of this |
|
576 |
+License will continue to apply to the part which is the covered work, |
|
577 |
+but the special requirements of the GNU Affero General Public License, |
|
578 |
+section 13, concerning interaction through a network will apply to the |
|
579 |
+combination as such. |
|
580 |
+ |
|
581 |
+ 14. Revised Versions of this License. |
|
582 |
+ |
|
583 |
+ The Free Software Foundation may publish revised and/or new versions of |
|
584 |
+the GNU General Public License from time to time. Such new versions will |
|
585 |
+be similar in spirit to the present version, but may differ in detail to |
|
586 |
+address new problems or concerns. |
|
587 |
+ |
|
588 |
+ Each version is given a distinguishing version number. If the |
|
589 |
+Program specifies that a certain numbered version of the GNU General |
|
590 |
+Public License "or any later version" applies to it, you have the |
|
591 |
+option of following the terms and conditions either of that numbered |
|
592 |
+version or of any later version published by the Free Software |
|
593 |
+Foundation. If the Program does not specify a version number of the |
|
594 |
+GNU General Public License, you may choose any version ever published |
|
595 |
+by the Free Software Foundation. |
|
596 |
+ |
|
597 |
+ If the Program specifies that a proxy can decide which future |
|
598 |
+versions of the GNU General Public License can be used, that proxy's |
|
599 |
+public statement of acceptance of a version permanently authorizes you |
|
600 |
+to choose that version for the Program. |
|
601 |
+ |
|
602 |
+ Later license versions may give you additional or different |
|
603 |
+permissions. However, no additional obligations are imposed on any |
|
604 |
+author or copyright holder as a result of your choosing to follow a |
|
605 |
+later version. |
|
606 |
+ |
|
607 |
+ 15. Disclaimer of Warranty. |
|
608 |
+ |
|
609 |
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY |
|
610 |
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT |
|
611 |
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY |
|
612 |
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, |
|
613 |
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
|
614 |
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM |
|
615 |
+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF |
|
616 |
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION. |
|
617 |
+ |
|
618 |
+ 16. Limitation of Liability. |
|
619 |
+ |
|
620 |
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING |
|
621 |
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS |
|
622 |
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY |
|
623 |
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE |
|
624 |
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF |
|
625 |
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD |
|
626 |
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), |
|
627 |
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF |
|
628 |
+SUCH DAMAGES. |
|
629 |
+ |
|
630 |
+ 17. Interpretation of Sections 15 and 16. |
|
631 |
+ |
|
632 |
+ If the disclaimer of warranty and limitation of liability provided |
|
633 |
+above cannot be given local legal effect according to their terms, |
|
634 |
+reviewing courts shall apply local law that most closely approximates |
|
635 |
+an absolute waiver of all civil liability in connection with the |
|
636 |
+Program, unless a warranty or assumption of liability accompanies a |
|
637 |
+copy of the Program in return for a fee. |
|
638 |
+ |
|
639 |
+ END OF TERMS AND CONDITIONS |
|
640 |
+ |
|
641 |
+ How to Apply These Terms to Your New Programs |
|
642 |
+ |
|
643 |
+ If you develop a new program, and you want it to be of the greatest |
|
644 |
+possible use to the public, the best way to achieve this is to make it |
|
645 |
+free software which everyone can redistribute and change under these terms. |
|
646 |
+ |
|
647 |
+ To do so, attach the following notices to the program. It is safest |
|
648 |
+to attach them to the start of each source file to most effectively |
|
649 |
+state the exclusion of warranty; and each file should have at least |
|
650 |
+the "copyright" line and a pointer to where the full notice is found. |
|
651 |
+ |
|
652 |
+ <one line to give the program's name and a brief idea of what it does.> |
|
653 |
+ Copyright (C) <year> <name of author> |
|
654 |
+ |
|
655 |
+ This program is free software: you can redistribute it and/or modify |
|
656 |
+ it under the terms of the GNU General Public License as published by |
|
657 |
+ the Free Software Foundation, either version 3 of the License, or |
|
658 |
+ (at your option) any later version. |
|
659 |
+ |
|
660 |
+ This program is distributed in the hope that it will be useful, |
|
661 |
+ but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
662 |
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
663 |
+ GNU General Public License for more details. |
|
664 |
+ |
|
665 |
+ You should have received a copy of the GNU General Public License |
|
666 |
+ along with this program. If not, see <https://www.gnu.org/licenses/>. |
|
667 |
+ |
|
668 |
+Also add information on how to contact you by electronic and paper mail. |
|
669 |
+ |
|
670 |
+ If the program does terminal interaction, make it output a short |
|
671 |
+notice like this when it starts in an interactive mode: |
|
672 |
+ |
|
673 |
+ <program> Copyright (C) <year> <name of author> |
|
674 |
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. |
|
675 |
+ This is free software, and you are welcome to redistribute it |
|
676 |
+ under certain conditions; type `show c' for details. |
|
677 |
+ |
|
678 |
+The hypothetical commands `show w' and `show c' should show the appropriate |
|
679 |
+parts of the General Public License. Of course, your program's commands |
|
680 |
+might be different; for a GUI interface, you would use an "about box". |
|
681 |
+ |
|
682 |
+ You should also get your employer (if you work as a programmer) or school, |
|
683 |
+if any, to sign a "copyright disclaimer" for the program, if necessary. |
|
684 |
+For more information on this, and how to apply and follow the GNU GPL, see |
|
685 |
+<https://www.gnu.org/licenses/>. |
|
686 |
+ |
|
687 |
+ The GNU General Public License does not permit incorporating your program |
|
688 |
+into proprietary programs. If your program is a subroutine library, you |
|
689 |
+may consider it more useful to permit linking proprietary applications with |
|
690 |
+the library. If this is what you want to do, use the GNU Lesser General |
|
691 |
+Public License instead of this License. But first, please read |
|
692 |
+<https://www.gnu.org/licenses/why-not-lgpl.html>. |
|
693 |
+ |
|
694 |
+ |
|
695 |
+ |
|
696 |
+ GNU LESSER GENERAL PUBLIC LICENSE |
|
697 |
+ Version 3, 29 June 2007 |
|
698 |
+ |
|
699 |
+ Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/> |
|
700 |
+ Everyone is permitted to copy and distribute verbatim copies |
|
701 |
+ of this license document, but changing it is not allowed. |
|
702 |
+ |
|
703 |
+ |
|
704 |
+ This version of the GNU Lesser General Public License incorporates |
|
705 |
+the terms and conditions of version 3 of the GNU General Public |
|
706 |
+License, supplemented by the additional permissions listed below. |
|
707 |
+ |
|
708 |
+ 0. Additional Definitions. |
|
709 |
+ |
|
710 |
+ As used herein, "this License" refers to version 3 of the GNU Lesser |
|
711 |
+General Public License, and the "GNU GPL" refers to version 3 of the GNU |
|
712 |
+General Public License. |
|
713 |
+ |
|
714 |
+ "The Library" refers to a covered work governed by this License, |
|
715 |
+other than an Application or a Combined Work as defined below. |
|
716 |
+ |
|
717 |
+ An "Application" is any work that makes use of an interface provided |
|
718 |
+by the Library, but which is not otherwise based on the Library. |
|
719 |
+Defining a subclass of a class defined by the Library is deemed a mode |
|
720 |
+of using an interface provided by the Library. |
|
721 |
+ |
|
722 |
+ A "Combined Work" is a work produced by combining or linking an |
|
723 |
+Application with the Library. The particular version of the Library |
|
724 |
+with which the Combined Work was made is also called the "Linked |
|
725 |
+Version". |
|
726 |
+ |
|
727 |
+ The "Minimal Corresponding Source" for a Combined Work means the |
|
728 |
+Corresponding Source for the Combined Work, excluding any source code |
|
729 |
+for portions of the Combined Work that, considered in isolation, are |
|
730 |
+based on the Application, and not on the Linked Version. |
|
731 |
+ |
|
732 |
+ The "Corresponding Application Code" for a Combined Work means the |
|
733 |
+object code and/or source code for the Application, including any data |
|
734 |
+and utility programs needed for reproducing the Combined Work from the |
|
735 |
+Application, but excluding the System Libraries of the Combined Work. |
|
736 |
+ |
|
737 |
+ 1. Exception to Section 3 of the GNU GPL. |
|
738 |
+ |
|
739 |
+ You may convey a covered work under sections 3 and 4 of this License |
|
740 |
+without being bound by section 3 of the GNU GPL. |
|
741 |
+ |
|
742 |
+ 2. Conveying Modified Versions. |
|
743 |
+ |
|
744 |
+ If you modify a copy of the Library, and, in your modifications, a |
|
745 |
+facility refers to a function or data to be supplied by an Application |
|
746 |
+that uses the facility (other than as an argument passed when the |
|
747 |
+facility is invoked), then you may convey a copy of the modified |
|
748 |
+version: |
|
749 |
+ |
|
750 |
+ a) under this License, provided that you make a good faith effort to |
|
751 |
+ ensure that, in the event an Application does not supply the |
|
752 |
+ function or data, the facility still operates, and performs |
|
753 |
+ whatever part of its purpose remains meaningful, or |
|
754 |
+ |
|
755 |
+ b) under the GNU GPL, with none of the additional permissions of |
|
756 |
+ this License applicable to that copy. |
|
757 |
+ |
|
758 |
+ 3. Object Code Incorporating Material from Library Header Files. |
|
759 |
+ |
|
760 |
+ The object code form of an Application may incorporate material from |
|
761 |
+a header file that is part of the Library. You may convey such object |
|
762 |
+code under terms of your choice, provided that, if the incorporated |
|
763 |
+material is not limited to numerical parameters, data structure |
|
764 |
+layouts and accessors, or small macros, inline functions and templates |
|
765 |
+(ten or fewer lines in length), you do both of the following: |
|
766 |
+ |
|
767 |
+ a) Give prominent notice with each copy of the object code that the |
|
768 |
+ Library is used in it and that the Library and its use are |
|
769 |
+ covered by this License. |
|
770 |
+ |
|
771 |
+ b) Accompany the object code with a copy of the GNU GPL and this license |
|
772 |
+ document. |
|
773 |
+ |
|
774 |
+ 4. Combined Works. |
|
775 |
+ |
|
776 |
+ You may convey a Combined Work under terms of your choice that, |
|
777 |
+taken together, effectively do not restrict modification of the |
|
778 |
+portions of the Library contained in the Combined Work and reverse |
|
779 |
+engineering for debugging such modifications, if you also do each of |
|
780 |
+the following: |
|
781 |
+ |
|
782 |
+ a) Give prominent notice with each copy of the Combined Work that |
|
783 |
+ the Library is used in it and that the Library and its use are |
|
784 |
+ covered by this License. |
|
785 |
+ |
|
786 |
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license |
|
787 |
+ document. |
|
788 |
+ |
|
789 |
+ c) For a Combined Work that displays copyright notices during |
|
790 |
+ execution, include the copyright notice for the Library among |
|
791 |
+ these notices, as well as a reference directing the user to the |
|
792 |
+ copies of the GNU GPL and this license document. |
|
793 |
+ |
|
794 |
+ d) Do one of the following: |
|
795 |
+ |
|
796 |
+ 0) Convey the Minimal Corresponding Source under the terms of this |
|
797 |
+ License, and the Corresponding Application Code in a form |
|
798 |
+ suitable for, and under terms that permit, the user to |
|
799 |
+ recombine or relink the Application with a modified version of |
|
800 |
+ the Linked Version to produce a modified Combined Work, in the |
|
801 |
+ manner specified by section 6 of the GNU GPL for conveying |
|
802 |
+ Corresponding Source. |
|
803 |
+ |
|
804 |
+ 1) Use a suitable shared library mechanism for linking with the |
|
805 |
+ Library. A suitable mechanism is one that (a) uses at run time |
|
806 |
+ a copy of the Library already present on the user's computer |
|
807 |
+ system, and (b) will operate properly with a modified version |
|
808 |
+ of the Library that is interface-compatible with the Linked |
|
809 |
+ Version. |
|
810 |
+ |
|
811 |
+ e) Provide Installation Information, but only if you would otherwise |
|
812 |
+ be required to provide such information under section 6 of the |
|
813 |
+ GNU GPL, and only to the extent that such information is |
|
814 |
+ necessary to install and execute a modified version of the |
|
815 |
+ Combined Work produced by recombining or relinking the |
|
816 |
+ Application with a modified version of the Linked Version. (If |
|
817 |
+ you use option 4d0, the Installation Information must accompany |
|
818 |
+ the Minimal Corresponding Source and Corresponding Application |
|
819 |
+ Code. If you use option 4d1, you must provide the Installation |
|
820 |
+ Information in the manner specified by section 6 of the GNU GPL |
|
821 |
+ for conveying Corresponding Source.) |
|
822 |
+ |
|
823 |
+ 5. Combined Libraries. |
|
824 |
+ |
|
825 |
+ You may place library facilities that are a work based on the |
|
826 |
+Library side by side in a single library together with other library |
|
827 |
+facilities that are not Applications and are not covered by this |
|
828 |
+License, and convey such a combined library under terms of your |
|
829 |
+choice, if you do both of the following: |
|
830 |
+ |
|
831 |
+ a) Accompany the combined library with a copy of the same work based |
|
832 |
+ on the Library, uncombined with any other library facilities, |
|
833 |
+ conveyed under the terms of this License. |
|
834 |
+ |
|
835 |
+ b) Give prominent notice with the combined library that part of it |
|
836 |
+ is a work based on the Library, and explaining where to find the |
|
837 |
+ accompanying uncombined form of the same work. |
|
838 |
+ |
|
839 |
+ 6. Revised Versions of the GNU Lesser General Public License. |
|
840 |
+ |
|
841 |
+ The Free Software Foundation may publish revised and/or new versions |
|
842 |
+of the GNU Lesser General Public License from time to time. Such new |
|
843 |
+versions will be similar in spirit to the present version, but may |
|
844 |
+differ in detail to address new problems or concerns. |
|
845 |
+ |
|
846 |
+ Each version is given a distinguishing version number. If the |
|
847 |
+Library as you received it specifies that a certain numbered version |
|
848 |
+of the GNU Lesser General Public License "or any later version" |
|
849 |
+applies to it, you have the option of following the terms and |
|
850 |
+conditions either of that published version or of any later version |
|
851 |
+published by the Free Software Foundation. If the Library as you |
|
852 |
+received it does not specify a version number of the GNU Lesser |
|
853 |
+General Public License, you may choose any version of the GNU Lesser |
|
854 |
+General Public License ever published by the Free Software Foundation. |
|
855 |
+ |
|
856 |
+ If the Library as you received it specifies that a proxy can decide |
|
857 |
+whether future versions of the GNU Lesser General Public License shall |
|
858 |
+apply, that proxy's public statement of acceptance of any version is |
|
859 |
+permanent authorization for you to choose that version for the |
|
860 |
+Library. |
|
861 |
+ |
... | ... |
@@ -0,0 +1,388 @@ |
1 |
+/** |
|
2 |
+ * @author fenris |
|
3 |
+ */ |
|
4 |
+declare type int = number; |
|
5 |
+/** |
|
6 |
+ * @author fenris |
|
7 |
+ */ |
|
8 |
+declare type float = number; |
|
9 |
+/** |
|
10 |
+ * @author fenris |
|
11 |
+ */ |
|
12 |
+declare type type_time = { |
|
13 |
+ hours: int; |
|
14 |
+ minutes: int; |
|
15 |
+ seconds: int; |
|
16 |
+}; |
|
17 |
+/** |
|
18 |
+ * @author fenris |
|
19 |
+ */ |
|
20 |
+declare type type_pseudopointer<type_value> = { |
|
21 |
+ value: type_value; |
|
22 |
+}; |
|
23 |
+/** |
|
24 |
+ * @author fenris |
|
25 |
+ */ |
|
26 |
+declare function pseudopointer_null<type_value>(): type_pseudopointer<type_value>; |
|
27 |
+/** |
|
28 |
+ * @author fenris |
|
29 |
+ */ |
|
30 |
+declare function pseudopointer_make<type_value>(value: type_value): type_pseudopointer<type_value>; |
|
31 |
+/** |
|
32 |
+ * @author fenris |
|
33 |
+ */ |
|
34 |
+declare function pseudopointer_isset<type_value>(pseudopointer: type_pseudopointer<type_value>): boolean; |
|
35 |
+/** |
|
36 |
+ * @author fenris |
|
37 |
+ */ |
|
38 |
+declare function pseudopointer_read<type_value>(pseudopointer: type_pseudopointer<type_value>): type_value; |
|
39 |
+/** |
|
40 |
+ * @author fenris |
|
41 |
+ */ |
|
42 |
+declare function pseudopointer_write<type_value>(pseudopointer: type_pseudopointer<type_value>, value: type_value): void; |
|
43 |
+/* |
|
44 |
+declare var process: any; |
|
45 |
+declare var require: any; |
|
46 |
+declare class Buffer { |
|
47 |
+ constructor(x: string, modifier?: string); |
|
48 |
+ toString(modifier?: string): string; |
|
49 |
+} |
|
50 |
+ */ |
|
51 |
+declare var java: any; |
|
52 |
+declare module lib_base { |
|
53 |
+ /** |
|
54 |
+ * @author fenris |
|
55 |
+ */ |
|
56 |
+ function environment(): string; |
|
57 |
+} |
|
58 |
+/** |
|
59 |
+ * @author fenris |
|
60 |
+ */ |
|
61 |
+declare var instance_verbosity: int; |
|
62 |
+/** |
|
63 |
+ * @desc the ability to check for equality with another element of the same domain |
|
64 |
+ * @author fenris |
|
65 |
+ */ |
|
66 |
+interface interface_collatable<type_value> { |
|
67 |
+ /** |
|
68 |
+ * @author fenris |
|
69 |
+ */ |
|
70 |
+ _collate(value: type_value): boolean; |
|
71 |
+} |
|
72 |
+/** |
|
73 |
+ * @author fenris |
|
74 |
+ */ |
|
75 |
+declare function instance_collate<type_value>(value1: type_value, value2: type_value): boolean; |
|
76 |
+/** |
|
77 |
+ * @desc the ability to compare with another element of the same domain for determining if the first is "smaller than or equal to" the latter |
|
78 |
+ * @author fenris |
|
79 |
+ */ |
|
80 |
+interface interface_comparable<type_value> { |
|
81 |
+ /** |
|
82 |
+ * @author fenris |
|
83 |
+ */ |
|
84 |
+ _compare(value: type_value): boolean; |
|
85 |
+} |
|
86 |
+/** |
|
87 |
+ * @author fenris |
|
88 |
+ */ |
|
89 |
+declare function instance_compare<type_value>(value1: type_value, value2: type_value): boolean; |
|
90 |
+/** |
|
91 |
+ * @desc the ability to create an exact copy |
|
92 |
+ * @author fenris |
|
93 |
+ */ |
|
94 |
+interface interface_cloneable<type_value> { |
|
95 |
+ /** |
|
96 |
+ * @author fenris |
|
97 |
+ */ |
|
98 |
+ _clone(): type_value; |
|
99 |
+} |
|
100 |
+/** |
|
101 |
+ * @author fenris |
|
102 |
+ */ |
|
103 |
+declare function instance_clone<type_value>(value: type_value): type_value; |
|
104 |
+/** |
|
105 |
+ * @author fenris |
|
106 |
+ */ |
|
107 |
+interface interface_hashable { |
|
108 |
+ /** |
|
109 |
+ * @author fenris |
|
110 |
+ */ |
|
111 |
+ _hash(): string; |
|
112 |
+} |
|
113 |
+/** |
|
114 |
+ * @desc the ability to generate a string out of the element, which identifies it to a high degree |
|
115 |
+ * @author fenris |
|
116 |
+ */ |
|
117 |
+declare function instance_hash<type_value>(value: type_value): string; |
|
118 |
+/** |
|
119 |
+ * @author fenris |
|
120 |
+ */ |
|
121 |
+interface interface_showable { |
|
122 |
+ /** |
|
123 |
+ * @author fenris |
|
124 |
+ */ |
|
125 |
+ _show(): string; |
|
126 |
+} |
|
127 |
+/** |
|
128 |
+ * @desc the ability to map the element to a textual representation (most likely not injective) |
|
129 |
+ * @author fenris |
|
130 |
+ */ |
|
131 |
+declare function instance_show<type_value>(value: type_value): string; |
|
132 |
+/** |
|
133 |
+ * @todo outsource to dedicated plankton-lib |
|
134 |
+ */ |
|
135 |
+declare module lib_log { |
|
136 |
+ /** |
|
137 |
+ * @author fenris |
|
138 |
+ */ |
|
139 |
+ function log(...args: Array<any>): void; |
|
140 |
+ /** |
|
141 |
+ * @author fenris |
|
142 |
+ */ |
|
143 |
+ function info(...args: Array<any>): void; |
|
144 |
+ /** |
|
145 |
+ * @author fenris |
|
146 |
+ */ |
|
147 |
+ function warn(...args: Array<any>): void; |
|
148 |
+ /** |
|
149 |
+ * @author fenris |
|
150 |
+ */ |
|
151 |
+ function error(...args: Array<any>): void; |
|
152 |
+} |
|
153 |
+/** |
|
154 |
+ * @author frac |
|
155 |
+ */ |
|
156 |
+interface interface_decorator<type_core> { |
|
157 |
+ /** |
|
158 |
+ * @author frac |
|
159 |
+ */ |
|
160 |
+ core: type_core; |
|
161 |
+} |
|
162 |
+/** |
|
163 |
+ * @author frac |
|
164 |
+ */ |
|
165 |
+declare class class_observer { |
|
166 |
+ /** |
|
167 |
+ * @author frac |
|
168 |
+ */ |
|
169 |
+ protected counter: int; |
|
170 |
+ /** |
|
171 |
+ * @author frac |
|
172 |
+ */ |
|
173 |
+ protected actions: { |
|
174 |
+ [id: string]: (information: Object) => void; |
|
175 |
+ }; |
|
176 |
+ /** |
|
177 |
+ * @author frac |
|
178 |
+ */ |
|
179 |
+ protected buffer: Array<Object>; |
|
180 |
+ /** |
|
181 |
+ * @author frac |
|
182 |
+ */ |
|
183 |
+ constructor(); |
|
184 |
+ /** |
|
185 |
+ * @author frac |
|
186 |
+ */ |
|
187 |
+ empty(): boolean; |
|
188 |
+ /** |
|
189 |
+ * @author frac |
|
190 |
+ */ |
|
191 |
+ flush(): void; |
|
192 |
+ /** |
|
193 |
+ * @author frac |
|
194 |
+ */ |
|
195 |
+ set(id: string, action: (information: Object) => void): void; |
|
196 |
+ /** |
|
197 |
+ * @author frac |
|
198 |
+ */ |
|
199 |
+ del(id: string): void; |
|
200 |
+ /** |
|
201 |
+ * @author frac |
|
202 |
+ */ |
|
203 |
+ add(action: (information: Object) => void): void; |
|
204 |
+ /** |
|
205 |
+ * @author frac |
|
206 |
+ */ |
|
207 |
+ notify(information?: Object, delayed?: boolean): void; |
|
208 |
+ /** |
|
209 |
+ * @author frac |
|
210 |
+ */ |
|
211 |
+ rollout(): void; |
|
212 |
+} |
|
213 |
+/** |
|
214 |
+ * @author frac |
|
215 |
+ */ |
|
216 |
+/** |
|
217 |
+ * @author frac |
|
218 |
+ */ |
|
219 |
+declare module lib_maybe { |
|
220 |
+ /** |
|
221 |
+ * @author fenris |
|
222 |
+ */ |
|
223 |
+ type type_maybe<type_value> = { |
|
224 |
+ kind: string; |
|
225 |
+ parameters: Object; |
|
226 |
+ }; |
|
227 |
+ /** |
|
228 |
+ * @author fenris |
|
229 |
+ */ |
|
230 |
+ function make_nothing<type_value>(): type_maybe<type_value>; |
|
231 |
+ /** |
|
232 |
+ * @author fenris |
|
233 |
+ */ |
|
234 |
+ function make_just<type_value>(value: type_value): type_maybe<type_value>; |
|
235 |
+ /** |
|
236 |
+ * @author fenris |
|
237 |
+ */ |
|
238 |
+ function is_nothing<type_value>(maybe: type_maybe<type_value>): boolean; |
|
239 |
+ /** |
|
240 |
+ * @author fenris |
|
241 |
+ */ |
|
242 |
+ function is_just<type_value>(maybe: type_maybe<type_value>): boolean; |
|
243 |
+ /** |
|
244 |
+ * @author fenris |
|
245 |
+ */ |
|
246 |
+ function cull<type_value>(maybe: type_maybe<type_value>): type_value; |
|
247 |
+ /** |
|
248 |
+ * @author fenris |
|
249 |
+ */ |
|
250 |
+ function propagate<type_value, type_value_>(maybe: type_maybe<type_value>, function_: (value: type_value) => type_maybe<type_value_>): type_maybe<type_value_>; |
|
251 |
+} |
|
252 |
+/** |
|
253 |
+ * @author fenris |
|
254 |
+ */ |
|
255 |
+declare class class_maybe<type_value> implements interface_showable { |
|
256 |
+ /** |
|
257 |
+ * @desc whether the wrapper is nothing |
|
258 |
+ * @author fenris |
|
259 |
+ */ |
|
260 |
+ is_nothing(): boolean; |
|
261 |
+ /** |
|
262 |
+ * @desc whether the wrapper is just |
|
263 |
+ * @author fenris |
|
264 |
+ */ |
|
265 |
+ is_just(): boolean; |
|
266 |
+ /** |
|
267 |
+ * @desc return the value, stored in the maybe-wrapper |
|
268 |
+ * @author fenris |
|
269 |
+ */ |
|
270 |
+ cull(): type_value; |
|
271 |
+ /** |
|
272 |
+ * @author fenris |
|
273 |
+ */ |
|
274 |
+ toString(): string; |
|
275 |
+ /** |
|
276 |
+ * @author fenris |
|
277 |
+ */ |
|
278 |
+ distinguish(action_just: (value?: type_value) => void, action_nothing?: (reason?: string) => void): void; |
|
279 |
+ /** |
|
280 |
+ * @author fenris |
|
281 |
+ */ |
|
282 |
+ propagate<type_value_>(action: (value: type_value) => class_maybe<type_value_>): class_maybe<type_value_>; |
|
283 |
+ /** |
|
284 |
+ * @desc [implementation] |
|
285 |
+ * @author fenris |
|
286 |
+ */ |
|
287 |
+ _show(): string; |
|
288 |
+} |
|
289 |
+/** |
|
290 |
+ * @author fenris |
|
291 |
+ */ |
|
292 |
+declare class class_nothing<type_value> extends class_maybe<type_value> { |
|
293 |
+ /** |
|
294 |
+ * @author fenris |
|
295 |
+ */ |
|
296 |
+ private reason; |
|
297 |
+ /** |
|
298 |
+ * @author fenris |
|
299 |
+ */ |
|
300 |
+ constructor(reason?: string); |
|
301 |
+ /** |
|
302 |
+ * @author fenris |
|
303 |
+ */ |
|
304 |
+ is_nothing(): boolean; |
|
305 |
+ /** |
|
306 |
+ * @author fenris |
|
307 |
+ */ |
|
308 |
+ is_just(): boolean; |
|
309 |
+ /** |
|
310 |
+ * @author fenris |
|
311 |
+ */ |
|
312 |
+ cull(): type_value; |
|
313 |
+ /** |
|
314 |
+ * @author fenris |
|
315 |
+ */ |
|
316 |
+ toString(): string; |
|
317 |
+ /** |
|
318 |
+ * @author fenris |
|
319 |
+ */ |
|
320 |
+ reason_get(): string; |
|
321 |
+ /** |
|
322 |
+ * @author fenris |
|
323 |
+ */ |
|
324 |
+ distinguish(action_just: (value?: type_value) => void, action_nothing?: (reason?: string) => void): void; |
|
325 |
+ /** |
|
326 |
+ * @author fenris |
|
327 |
+ */ |
|
328 |
+ propagate<type_value_>(action: (value: type_value) => class_maybe<type_value_>): class_maybe<type_value_>; |
|
329 |
+} |
|
330 |
+/** |
|
331 |
+ * @author fenris |
|
332 |
+ */ |
|
333 |
+declare class class_just<type_value> extends class_maybe<type_value> { |
|
334 |
+ /** |
|
335 |
+ * @author fenris |
|
336 |
+ */ |
|
337 |
+ private value; |
|
338 |
+ /** |
|
339 |
+ * @author fenris |
|
340 |
+ */ |
|
341 |
+ constructor(value: type_value); |
|
342 |
+ /** |
|
343 |
+ * @author fenris |
|
344 |
+ */ |
|
345 |
+ is_nothing(): boolean; |
|
346 |
+ /** |
|
347 |
+ * @author fenris |
|
348 |
+ */ |
|
349 |
+ is_just(): boolean; |
|
350 |
+ /** |
|
351 |
+ * @author fenris |
|
352 |
+ */ |
|
353 |
+ cull(): type_value; |
|
354 |
+ /** |
|
355 |
+ * @author fenris |
|
356 |
+ */ |
|
357 |
+ toString(): string; |
|
358 |
+ /** |
|
359 |
+ * @author fenris |
|
360 |
+ */ |
|
361 |
+ distinguish(action_just: (value?: type_value) => void, action_nothing?: (reason?: string) => void): void; |
|
362 |
+ /** |
|
363 |
+ * @author fenris |
|
364 |
+ */ |
|
365 |
+ propagate<type_value_>(action: (value: type_value) => class_maybe<type_value_>): class_maybe<type_value_>; |
|
366 |
+} |
|
367 |
+/** |
|
368 |
+ * @author frac |
|
369 |
+ */ |
|
370 |
+declare class class_error extends Error { |
|
371 |
+ /** |
|
372 |
+ * @author frac |
|
373 |
+ */ |
|
374 |
+ protected suberrors: Array<Error>; |
|
375 |
+ /** |
|
376 |
+ * @author frac |
|
377 |
+ */ |
|
378 |
+ protected mess: string; |
|
379 |
+ /** |
|
380 |
+ * @author frac |
|
381 |
+ */ |
|
382 |
+ constructor(message: string, suberrors?: Array<Error>); |
|
383 |
+ /** |
|
384 |
+ * @override |
|
385 |
+ * @author frac |
|
386 |
+ */ |
|
387 |
+ toString(): string; |
|
388 |
+} |
... | ... |
@@ -0,0 +1,768 @@ |
1 |
+var __extends = (this && this.__extends) || (function () { |
|
2 |
+ var extendStatics = function (d, b) { |
|
3 |
+ extendStatics = Object.setPrototypeOf || |
|
4 |
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || |
|
5 |
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; |
|
6 |
+ return extendStatics(d, b); |
|
7 |
+ }; |
|
8 |
+ return function (d, b) { |
|
9 |
+ extendStatics(d, b); |
|
10 |
+ function __() { this.constructor = d; } |
|
11 |
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); |
|
12 |
+ }; |
|
13 |
+})(); |
|
14 |
+/* |
|
15 |
+This file is part of »bacterio-plankton:base«. |
|
16 |
+ |
|
17 |
+Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
18 |
+<info@greenscale.de> |
|
19 |
+ |
|
20 |
+»bacterio-plankton:base« is free software: you can redistribute it and/or modify |
|
21 |
+it under the terms of the GNU Lesser General Public License as published by |
|
22 |
+the Free Software Foundation, either version 3 of the License, or |
|
23 |
+(at your option) any later version. |
|
24 |
+ |
|
25 |
+»bacterio-plankton:base« is distributed in the hope that it will be useful, |
|
26 |
+but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
27 |
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
28 |
+GNU Lesser General Public License for more details. |
|
29 |
+ |
|
30 |
+You should have received a copy of the GNU Lesser General Public License |
|
31 |
+along with »bacterio-plankton:base«. If not, see <http://www.gnu.org/licenses/>. |
|
32 |
+ */ |
|
33 |
+// } |
|
34 |
+/* |
|
35 |
+This file is part of »bacterio-plankton:base«. |
|
36 |
+ |
|
37 |
+Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
38 |
+<info@greenscale.de> |
|
39 |
+ |
|
40 |
+»bacterio-plankton:base« is free software: you can redistribute it and/or modify |
|
41 |
+it under the terms of the GNU Lesser General Public License as published by |
|
42 |
+the Free Software Foundation, either version 3 of the License, or |
|
43 |
+(at your option) any later version. |
|
44 |
+ |
|
45 |
+»bacterio-plankton:base« is distributed in the hope that it will be useful, |
|
46 |
+but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
47 |
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
48 |
+GNU Lesser General Public License for more details. |
|
49 |
+ |
|
50 |
+You should have received a copy of the GNU Lesser General Public License |
|
51 |
+along with »bacterio-plankton:base«. If not, see <http://www.gnu.org/licenses/>. |
|
52 |
+ */ |
|
53 |
+/** |
|
54 |
+ * @author fenris |
|
55 |
+ */ |
|
56 |
+/*export*/ function pseudopointer_null() { |
|
57 |
+ return { |
|
58 |
+ "value": null |
|
59 |
+ }; |
|
60 |
+} |
|
61 |
+/** |
|
62 |
+ * @author fenris |
|
63 |
+ */ |
|
64 |
+/*export*/ function pseudopointer_make(value) { |
|
65 |
+ return { |
|
66 |
+ "value": value |
|
67 |
+ }; |
|
68 |
+} |
|
69 |
+/** |
|
70 |
+ * @author fenris |
|
71 |
+ */ |
|
72 |
+/*export*/ function pseudopointer_isset(pseudopointer) { |
|
73 |
+ return (pseudopointer.value != null); |
|
74 |
+} |
|
75 |
+/** |
|
76 |
+ * @author fenris |
|
77 |
+ */ |
|
78 |
+/*export*/ function pseudopointer_read(pseudopointer) { |
|
79 |
+ if (pseudopointer.value != null) { |
|
80 |
+ return pseudopointer.value; |
|
81 |
+ } |
|
82 |
+ else { |
|
83 |
+ var message = "nullpointer dereferencation"; |
|
84 |
+ throw (new Error(message)); |
|
85 |
+ } |
|
86 |
+} |
|
87 |
+/** |
|
88 |
+ * @author fenris |
|
89 |
+ */ |
|
90 |
+/*export*/ function pseudopointer_write(pseudopointer, value) { |
|
91 |
+ pseudopointer.value = value; |
|
92 |
+} |
|
93 |
+/* |
|
94 |
+This file is part of »bacterio-plankton:base«. |
|
95 |
+ |
|
96 |
+Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
97 |
+<info@greenscale.de> |
|
98 |
+ |
|
99 |
+»bacterio-plankton:base« is free software: you can redistribute it and/or modify |
|
100 |
+it under the terms of the GNU Lesser General Public License as published by |
|
101 |
+the Free Software Foundation, either version 3 of the License, or |
|
102 |
+(at your option) any later version. |
|
103 |
+ |
|
104 |
+»bacterio-plankton:base« is distributed in the hope that it will be useful, |
|
105 |
+but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
106 |
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
107 |
+GNU Lesser General Public License for more details. |
|
108 |
+ |
|
109 |
+You should have received a copy of the GNU Lesser General Public License |
|
110 |
+along with »bacterio-plankton:base«. If not, see <http://www.gnu.org/licenses/>. |
|
111 |
+ */ |
|
112 |
+; |
|
113 |
+var lib_base; |
|
114 |
+(function (lib_base) { |
|
115 |
+ /** |
|
116 |
+ * @author fenris |
|
117 |
+ */ |
|
118 |
+ function environment() { |
|
119 |
+ var entries = [ |
|
120 |
+ { |
|
121 |
+ "id": "web", |
|
122 |
+ "name": "Web", |
|
123 |
+ "predicate": function () { return (typeof (document) !== "undefined"); }, |
|
124 |
+ }, |
|
125 |
+ { |
|
126 |
+ "id": "node", |
|
127 |
+ "name": "Node.js", |
|
128 |
+ "predicate": function () { return (typeof (process) !== "undefined"); }, |
|
129 |
+ }, |
|
130 |
+ { |
|
131 |
+ "id": "rhino", |
|
132 |
+ "name": "Rhino", |
|
133 |
+ "predicate": function () { return (typeof (java) !== "undefined"); }, |
|
134 |
+ }, |
|
135 |
+ { |
|
136 |
+ "id": "webworker", |
|
137 |
+ "name": "WebWorker", |
|
138 |
+ "predicate": function () { return (typeof (self["WorkerNavigator"]) !== "undefined"); } |
|
139 |
+ } |
|
140 |
+ ]; |
|
141 |
+ var id; |
|
142 |
+ var found = entries.some(function (entry) { |
|
143 |
+ if (entry.predicate()) { |
|
144 |
+ id = entry.id; |
|
145 |
+ return true; |
|
146 |
+ } |
|
147 |
+ else { |
|
148 |
+ return false; |
|
149 |
+ } |
|
150 |
+ }); |
|
151 |
+ if (found) { |
|
152 |
+ return id; |
|
153 |
+ } |
|
154 |
+ else { |
|
155 |
+ throw (new Error("unknown environment")); |
|
156 |
+ } |
|
157 |
+ } |
|
158 |
+ lib_base.environment = environment; |
|
159 |
+})(lib_base || (lib_base = {})); |
|
160 |
+/* |
|
161 |
+This file is part of »bacterio-plankton:base«. |
|
162 |
+ |
|
163 |
+Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
164 |
+<info@greenscale.de> |
|
165 |
+ |
|
166 |
+»bacterio-plankton:base« is free software: you can redistribute it and/or modify |
|
167 |
+it under the terms of the GNU Lesser General Public License as published by |
|
168 |
+the Free Software Foundation, either version 3 of the License, or |
|
169 |
+(at your option) any later version. |
|
170 |
+ |
|
171 |
+»bacterio-plankton:base« is distributed in the hope that it will be useful, |
|
172 |
+but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
173 |
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
174 |
+GNU Lesser General Public License for more details. |
|
175 |
+ |
|
176 |
+You should have received a copy of the GNU Lesser General Public License |
|
177 |
+along with »bacterio-plankton:base«. If not, see <http://www.gnu.org/licenses/>. |
|
178 |
+ */ |
|
179 |
+/** |
|
180 |
+ * @author fenris |
|
181 |
+ */ |
|
182 |
+var instance_verbosity = 0; |
|
183 |
+/** |
|
184 |
+ * @author fenris |
|
185 |
+ */ |
|
186 |
+function instance_collate(value1, value2) { |
|
187 |
+ if (typeof (value1) === "object") { |
|
188 |
+ if (value1 == null) { |
|
189 |
+ return (value2 == null); |
|
190 |
+ } |
|
191 |
+ else { |
|
192 |
+ if ("_collate" in value1) { |
|
193 |
+ return value1["_collate"](value2); |
|
194 |
+ } |
|
195 |
+ else { |
|
196 |
+ throw (new Error("[collate]" + " " + "object has no such method")); |
|
197 |
+ } |
|
198 |
+ } |
|
199 |
+ } |
|
200 |
+ else { |
|
201 |
+ if (instance_verbosity >= 1) { |
|
202 |
+ lib_log.warn("[collate]" + " " + "primitive value; using default implementation"); |
|
203 |
+ } |
|
204 |
+ return (value1 === value2); |
|
205 |
+ } |
|
206 |
+} |
|
207 |
+/** |
|
208 |
+ * @author fenris |
|
209 |
+ */ |
|
210 |
+function instance_compare(value1, value2) { |
|
211 |
+ if (typeof (value1) === "object") { |
|
212 |
+ if ("_compare" in value1) { |
|
213 |
+ return value1["_compare"](value2); |
|
214 |
+ } |
|
215 |
+ else { |
|
216 |
+ throw (new Error("[compare]" + " " + "object has no such method")); |
|
217 |
+ } |
|
218 |
+ } |
|
219 |
+ else { |
|
220 |
+ if (instance_verbosity >= 1) { |
|
221 |
+ lib_log.warn("[compare]" + " " + "primitive value; using default implementation"); |
|
222 |
+ } |
|
223 |
+ return (value1 <= value2); |
|
224 |
+ } |
|
225 |
+} |
|
226 |
+/** |
|
227 |
+ * @author fenris |
|
228 |
+ */ |
|
229 |
+function instance_clone(value) { |
|
230 |
+ if (typeof (value) === "object") { |
|
231 |
+ if ("_clone" in value) { |
|
232 |
+ return value["_clone"](); |
|
233 |
+ } |
|
234 |
+ else { |
|
235 |
+ throw (new Error("[clone]" + " " + "object has no such method")); |
|
236 |
+ } |
|
237 |
+ } |
|
238 |
+ else { |
|
239 |
+ if (instance_verbosity >= 1) { |
|
240 |
+ lib_log.warn("[clone]" + " " + "primitive value; using default implementation"); |
|
241 |
+ } |
|
242 |
+ return value; |
|
243 |
+ } |
|
244 |
+} |
|
245 |
+/** |
|
246 |
+ * @desc the ability to generate a string out of the element, which identifies it to a high degree |
|
247 |
+ * @author fenris |
|
248 |
+ */ |
|
249 |
+function instance_hash(value) { |
|
250 |
+ if (typeof (value) === "object") { |
|
251 |
+ if ("_hash" in value) { |
|
252 |
+ return value["_hash"](); |
|
253 |
+ } |
|
254 |
+ else { |
|
255 |
+ throw (new Error("[hash]" + " " + "object has no such method")); |
|
256 |
+ } |
|
257 |
+ } |
|
258 |
+ else { |
|
259 |
+ if (instance_verbosity >= 1) { |
|
260 |
+ lib_log.warn("[hash]" + " " + "primitive value; using default implementation"); |
|
261 |
+ } |
|
262 |
+ return String(value); |
|
263 |
+ } |
|
264 |
+} |
|
265 |
+/** |
|
266 |
+ * @desc the ability to map the element to a textual representation (most likely not injective) |
|
267 |
+ * @author fenris |
|
268 |
+ */ |
|
269 |
+function instance_show(value) { |
|
270 |
+ if (typeof (value) === "object") { |
|
271 |
+ if (value == null) { |
|
272 |
+ return "NULL"; |
|
273 |
+ } |
|
274 |
+ else { |
|
275 |
+ if ("_show" in value) { |
|
276 |
+ return value["_show"](); |
|
277 |
+ } |
|
278 |
+ else { |
|
279 |
+ // throw (new Error("[show]" + " " + "object has no such method")); |
|
280 |
+ return JSON.stringify(value); |
|
281 |
+ } |
|
282 |
+ } |
|
283 |
+ } |
|
284 |
+ else { |
|
285 |
+ if (instance_verbosity >= 1) { |
|
286 |
+ lib_log.warn("[show]" + " " + "primitive value; using default implementation"); |
|
287 |
+ } |
|
288 |
+ return String(value); |
|
289 |
+ } |
|
290 |
+} |
|
291 |
+/* |
|
292 |
+This file is part of »bacterio-plankton:base«. |
|
293 |
+ |
|
294 |
+Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
295 |
+<info@greenscale.de> |
|
296 |
+ |
|
297 |
+»bacterio-plankton:base« is free software: you can redistribute it and/or modify |
|
298 |
+it under the terms of the GNU Lesser General Public License as published by |
|
299 |
+the Free Software Foundation, either version 3 of the License, or |
|
300 |
+(at your option) any later version. |
|
301 |
+ |
|
302 |
+»bacterio-plankton:base« is distributed in the hope that it will be useful, |
|
303 |
+but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
304 |
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
305 |
+GNU Lesser General Public License for more details. |
|
306 |
+ |
|
307 |
+You should have received a copy of the GNU Lesser General Public License |
|
308 |
+along with »bacterio-plankton:base«. If not, see <http://www.gnu.org/licenses/>. |
|
309 |
+ */ |
|
310 |
+/** |
|
311 |
+ * @todo outsource to dedicated plankton-lib |
|
312 |
+ */ |
|
313 |
+var lib_log; |
|
314 |
+(function (lib_log) { |
|
315 |
+ /** |
|
316 |
+ * @author fenris |
|
317 |
+ */ |
|
318 |
+ function log() { |
|
319 |
+ var args = []; |
|
320 |
+ for (var _i = 0; _i < arguments.length; _i++) { |
|
321 |
+ args[_i] = arguments[_i]; |
|
322 |
+ } |
|
323 |
+ /*window.*/ console.log.apply(console, args); |
|
324 |
+ } |
|
325 |
+ lib_log.log = log; |
|
326 |
+ /** |
|
327 |
+ * @author fenris |
|
328 |
+ */ |
|
329 |
+ function info() { |
|
330 |
+ var args = []; |
|
331 |
+ for (var _i = 0; _i < arguments.length; _i++) { |
|
332 |
+ args[_i] = arguments[_i]; |
|
333 |
+ } |
|
334 |
+ /*window.*/ console.info.apply(console, args); |
|
335 |
+ } |
|
336 |
+ lib_log.info = info; |
|
337 |
+ /** |
|
338 |
+ * @author fenris |
|
339 |
+ */ |
|
340 |
+ function warn() { |
|
341 |
+ var args = []; |
|
342 |
+ for (var _i = 0; _i < arguments.length; _i++) { |
|
343 |
+ args[_i] = arguments[_i]; |
|
344 |
+ } |
|
345 |
+ /*window.*/ console.warn.apply(console, args); |
|
346 |
+ } |
|
347 |
+ lib_log.warn = warn; |
|
348 |
+ /** |
|
349 |
+ * @author fenris |
|
350 |
+ */ |
|
351 |
+ function error() { |
|
352 |
+ var args = []; |
|
353 |
+ for (var _i = 0; _i < arguments.length; _i++) { |
|
354 |
+ args[_i] = arguments[_i]; |
|
355 |
+ } |
|
356 |
+ /*window.*/ console.error.apply(console, args); |
|
357 |
+ } |
|
358 |
+ lib_log.error = error; |
|
359 |
+})(lib_log || (lib_log = {})); |
|
360 |
+/* |
|
361 |
+This file is part of »bacterio-plankton:base«. |
|
362 |
+ |
|
363 |
+Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
364 |
+<info@greenscale.de> |
|
365 |
+ |
|
366 |
+»bacterio-plankton:base« is free software: you can redistribute it and/or modify |
|
367 |
+it under the terms of the GNU Lesser General Public License as published by |
|
368 |
+the Free Software Foundation, either version 3 of the License, or |
|
369 |
+(at your option) any later version. |
|
370 |
+ |
|
371 |
+»bacterio-plankton:base« is distributed in the hope that it will be useful, |
|
372 |
+but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
373 |
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
374 |
+GNU Lesser General Public License for more details. |
|
375 |
+ |
|
376 |
+You should have received a copy of the GNU Lesser General Public License |
|
377 |
+along with »bacterio-plankton:base«. If not, see <http://www.gnu.org/licenses/>. |
|
378 |
+ */ |
|
379 |
+/** |
|
380 |
+ * @author frac |
|
381 |
+ */ |
|
382 |
+var class_observer = /** @class */ (function () { |
|
383 |
+ /** |
|
384 |
+ * @author frac |
|
385 |
+ */ |
|
386 |
+ function class_observer() { |
|
387 |
+ this.counter = 0; |
|
388 |
+ this.actions = {}; |
|
389 |
+ this.buffer = []; |
|
390 |
+ } |
|
391 |
+ /** |
|
392 |
+ * @author frac |
|
393 |
+ */ |
|
394 |
+ class_observer.prototype.empty = function () { |
|
395 |
+ return (Object.keys(this.actions).length == 0); |
|
396 |
+ }; |
|
397 |
+ /** |
|
398 |
+ * @author frac |
|
399 |
+ */ |
|
400 |
+ class_observer.prototype.flush = function () { |
|
401 |
+ this.actions = {}; |
|
402 |
+ }; |
|
403 |
+ /** |
|
404 |
+ * @author frac |
|
405 |
+ */ |
|
406 |
+ class_observer.prototype.set = function (id, action) { |
|
407 |
+ this.actions[id] = action; |
|
408 |
+ }; |
|
409 |
+ /** |
|
410 |
+ * @author frac |
|
411 |
+ */ |
|
412 |
+ class_observer.prototype.del = function (id) { |
|
413 |
+ delete this.actions[id]; |
|
414 |
+ }; |
|
415 |
+ /** |
|
416 |
+ * @author frac |
|
417 |
+ */ |
|
418 |
+ class_observer.prototype.add = function (action) { |
|
419 |
+ this.set((this.counter++).toString(), action); |
|
420 |
+ }; |
|
421 |
+ /** |
|
422 |
+ * @author frac |
|
423 |
+ */ |
|
424 |
+ class_observer.prototype.notify = function (information, delayed) { |
|
425 |
+ var _this = this; |
|
426 |
+ if (information === void 0) { information = {}; } |
|
427 |
+ if (delayed === void 0) { delayed = false; } |
|
428 |
+ if (delayed) { |
|
429 |
+ this.buffer.push(information); |
|
430 |
+ } |
|
431 |
+ else { |
|
432 |
+ Object.keys(this.actions).forEach(function (id) { return _this.actions[id](information); }); |
|
433 |
+ } |
|
434 |
+ }; |
|
435 |
+ /** |
|
436 |
+ * @author frac |
|
437 |
+ */ |
|
438 |
+ class_observer.prototype.rollout = function () { |
|
439 |
+ var _this = this; |
|
440 |
+ this.buffer.forEach(function (information) { return _this.notify(information, false); }); |
|
441 |
+ this.buffer = []; |
|
442 |
+ }; |
|
443 |
+ return class_observer; |
|
444 |
+}()); |
|
445 |
+/** |
|
446 |
+ * @author frac |
|
447 |
+ */ |
|
448 |
+/* |
|
449 |
+export interface interface_readable<type_value> { |
|
450 |
+ |
|
451 |
+ |** |
|
452 |
+ * @author frac |
|
453 |
+ *| |
|
454 |
+ read() : type_executor<type_value, Error>; |
|
455 |
+ |
|
456 |
+} |
|
457 |
+ */ |
|
458 |
+/** |
|
459 |
+ * @author frac |
|
460 |
+ */ |
|
461 |
+/* |
|
462 |
+export interface interface_writeable<type_value> { |
|
463 |
+ |
|
464 |
+ |** |
|
465 |
+ * @author frac |
|
466 |
+ *| |
|
467 |
+ write(value : type_value) : type_executor<void, Error>; |
|
468 |
+ |
|
469 |
+} |
|
470 |
+ */ |
|
471 |
+/* |
|
472 |
+This file is part of »bacterio-plankton:base«. |
|
473 |
+ |
|
474 |
+Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
475 |
+<info@greenscale.de> |
|
476 |
+ |
|
477 |
+»bacterio-plankton:base« is free software: you can redistribute it and/or modify |
|
478 |
+it under the terms of the GNU Lesser General Public License as published by |
|
479 |
+the Free Software Foundation, either version 3 of the License, or |
|
480 |
+(at your option) any later version. |
|
481 |
+ |
|
482 |
+»bacterio-plankton:base« is distributed in the hope that it will be useful, |
|
483 |
+but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
484 |
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
485 |
+GNU Lesser General Public License for more details. |
|
486 |
+ |
|
487 |
+You should have received a copy of the GNU Lesser General Public License |
|
488 |
+along with »bacterio-plankton:base«. If not, see <http://www.gnu.org/licenses/>. |
|
489 |
+ */ |
|
490 |
+var lib_maybe; |
|
491 |
+(function (lib_maybe) { |
|
492 |
+ /** |
|
493 |
+ * @author fenris |
|
494 |
+ */ |
|
495 |
+ function make_nothing() { |
|
496 |
+ return { |
|
497 |
+ "kind": "nothing", |
|
498 |
+ "parameters": {} |
|
499 |
+ }; |
|
500 |
+ } |
|
501 |
+ lib_maybe.make_nothing = make_nothing; |
|
502 |
+ /** |
|
503 |
+ * @author fenris |
|
504 |
+ */ |
|
505 |
+ function make_just(value) { |
|
506 |
+ return { |
|
507 |
+ "kind": "just", |
|
508 |
+ "parameters": { |
|
509 |
+ "value": value |
|
510 |
+ } |
|
511 |
+ }; |
|
512 |
+ } |
|
513 |
+ lib_maybe.make_just = make_just; |
|
514 |
+ /** |
|
515 |
+ * @author fenris |
|
516 |
+ */ |
|
517 |
+ function is_nothing(maybe) { |
|
518 |
+ return (maybe.kind === "nothing"); |
|
519 |
+ } |
|
520 |
+ lib_maybe.is_nothing = is_nothing; |
|
521 |
+ /** |
|
522 |
+ * @author fenris |
|
523 |
+ */ |
|
524 |
+ function is_just(maybe) { |
|
525 |
+ return (maybe.kind === "just"); |
|
526 |
+ } |
|
527 |
+ lib_maybe.is_just = is_just; |
|
528 |
+ /** |
|
529 |
+ * @author fenris |
|
530 |
+ */ |
|
531 |
+ function cull(maybe) { |
|
532 |
+ if (!is_just(maybe)) { |
|
533 |
+ var message = "cull from nothing"; |
|
534 |
+ throw (new Error(message)); |
|
535 |
+ } |
|
536 |
+ else { |
|
537 |
+ var value = maybe.parameters["value"]; |
|
538 |
+ return value; |
|
539 |
+ } |
|
540 |
+ } |
|
541 |
+ lib_maybe.cull = cull; |
|
542 |
+ /** |
|
543 |
+ * @author fenris |
|
544 |
+ */ |
|
545 |
+ function propagate(maybe, function_) { |
|
546 |
+ if (!is_just(maybe)) { |
|
547 |
+ } |
|
548 |
+ else { |
|
549 |
+ var value = maybe.parameters["value"]; |
|
550 |
+ var maybe_ = function_(value); |
|
551 |
+ return maybe_; |
|
552 |
+ } |
|
553 |
+ } |
|
554 |
+ lib_maybe.propagate = propagate; |
|
555 |
+})(lib_maybe || (lib_maybe = {})); |
|
556 |
+/** |
|
557 |
+ * @author fenris |
|
558 |
+ */ |
|
559 |
+/*export*/ var class_maybe = /** @class */ (function () { |
|
560 |
+ function class_maybe() { |
|
561 |
+ } |
|
562 |
+ /** |
|
563 |
+ * @desc whether the wrapper is nothing |
|
564 |
+ * @author fenris |
|
565 |
+ */ |
|
566 |
+ class_maybe.prototype.is_nothing = function () { |
|
567 |
+ throw (new Error("not implemented: class_maybe.is_nothing")); |
|
568 |
+ }; |
|
569 |
+ /** |
|
570 |
+ * @desc whether the wrapper is just |
|
571 |
+ * @author fenris |
|
572 |
+ */ |
|
573 |
+ class_maybe.prototype.is_just = function () { |
|
574 |
+ throw (new Error("not implemented: class_maybe.is_just")); |
|
575 |
+ }; |
|
576 |
+ /** |
|
577 |
+ * @desc return the value, stored in the maybe-wrapper |
|
578 |
+ * @author fenris |
|
579 |
+ */ |
|
580 |
+ class_maybe.prototype.cull = function () { |
|
581 |
+ throw (new Error("not implemented: class_maybe.cull")); |
|
582 |
+ }; |
|
583 |
+ /** |
|
584 |
+ * @author fenris |
|
585 |
+ */ |
|
586 |
+ class_maybe.prototype.toString = function () { |
|
587 |
+ throw (new Error("not implemented: class_maybe.cull")); |
|
588 |
+ }; |
|
589 |
+ /** |
|
590 |
+ * @author fenris |
|
591 |
+ */ |
|
592 |
+ class_maybe.prototype.distinguish = function (action_just, action_nothing) { |
|
593 |
+ if (action_nothing === void 0) { action_nothing = function () { }; } |
|
594 |
+ throw (new Error("not implemented: class_maybe.distinguish")); |
|
595 |
+ }; |
|
596 |
+ /** |
|
597 |
+ * @author fenris |
|
598 |
+ */ |
|
599 |
+ class_maybe.prototype.propagate = function (action) { |
|
600 |
+ throw (new Error("not implemented: class_maybe.propagate")); |
|
601 |
+ }; |
|
602 |
+ /** |
|
603 |
+ * @desc [implementation] |
|
604 |
+ * @author fenris |
|
605 |
+ */ |
|
606 |
+ class_maybe.prototype._show = function () { |
|
607 |
+ return this.toString(); |
|
608 |
+ }; |
|
609 |
+ return class_maybe; |
|
610 |
+}()); |
|
611 |
+/** |
|
612 |
+ * @author fenris |
|
613 |
+ */ |
|
614 |
+/*export*/ var class_nothing = /** @class */ (function (_super) { |
|
615 |
+ __extends(class_nothing, _super); |
|
616 |
+ /** |
|
617 |
+ * @author fenris |
|
618 |
+ */ |
|
619 |
+ function class_nothing(reason) { |
|
620 |
+ if (reason === void 0) { reason = null; } |
|
621 |
+ var _this = _super.call(this) || this; |
|
622 |
+ _this.reason = reason; |
|
623 |
+ return _this; |
|
624 |
+ } |
|
625 |
+ /** |
|
626 |
+ * @author fenris |
|
627 |
+ */ |
|
628 |
+ class_nothing.prototype.is_nothing = function () { |
|
629 |
+ return true; |
|
630 |
+ }; |
|
631 |
+ /** |
|
632 |
+ * @author fenris |
|
633 |
+ */ |
|
634 |
+ class_nothing.prototype.is_just = function () { |
|
635 |
+ return false; |
|
636 |
+ }; |
|
637 |
+ /** |
|
638 |
+ * @author fenris |
|
639 |
+ */ |
|
640 |
+ class_nothing.prototype.cull = function () { |
|
641 |
+ var message = "you shouldn't cull a nothing-value …"; |
|
642 |
+ lib_log.warn(message); |
|
643 |
+ return null; |
|
644 |
+ }; |
|
645 |
+ /** |
|
646 |
+ * @author fenris |
|
647 |
+ */ |
|
648 |
+ class_nothing.prototype.toString = function () { |
|
649 |
+ return "<\u00B7>"; |
|
650 |
+ }; |
|
651 |
+ /** |
|
652 |
+ * @author fenris |
|
653 |
+ */ |
|
654 |
+ class_nothing.prototype.reason_get = function () { |
|
655 |
+ var content = ((this.reason == null) ? "·" : this.reason); |
|
656 |
+ return "<- " + content + " ->"; |
|
657 |
+ }; |
|
658 |
+ /** |
|
659 |
+ * @author fenris |
|
660 |
+ */ |
|
661 |
+ class_nothing.prototype.distinguish = function (action_just, action_nothing) { |
|
662 |
+ if (action_nothing === void 0) { action_nothing = function () { }; } |
|
663 |
+ action_nothing(this.reason); |
|
664 |
+ }; |
|
665 |
+ /** |
|
666 |
+ * @author fenris |
|
667 |
+ */ |
|
668 |
+ class_nothing.prototype.propagate = function (action) { |
|
669 |
+ return (new class_nothing(this.reason)); |
|
670 |
+ }; |
|
671 |
+ return class_nothing; |
|
672 |
+}(class_maybe)); |
|
673 |
+/** |
|
674 |
+ * @author fenris |
|
675 |
+ */ |
|
676 |
+/*export*/ var class_just = /** @class */ (function (_super) { |
|
677 |
+ __extends(class_just, _super); |
|
678 |
+ /** |
|
679 |
+ * @author fenris |
|
680 |
+ */ |
|
681 |
+ function class_just(value) { |
|
682 |
+ var _this = _super.call(this) || this; |
|
683 |
+ _this.value = value; |
|
684 |
+ return _this; |
|
685 |
+ } |
|
686 |
+ /** |
|
687 |
+ * @author fenris |
|
688 |
+ */ |
|
689 |
+ class_just.prototype.is_nothing = function () { |
|
690 |
+ return false; |
|
691 |
+ }; |
|
692 |
+ /** |
|
693 |
+ * @author fenris |
|
694 |
+ */ |
|
695 |
+ class_just.prototype.is_just = function () { |
|
696 |
+ return true; |
|
697 |
+ }; |
|
698 |
+ /** |
|
699 |
+ * @author fenris |
|
700 |
+ */ |
|
701 |
+ class_just.prototype.cull = function () { |
|
702 |
+ return this.value; |
|
703 |
+ }; |
|
704 |
+ /** |
|
705 |
+ * @author fenris |
|
706 |
+ */ |
|
707 |
+ class_just.prototype.toString = function () { |
|
708 |
+ var content = instance_show(this.value); |
|
709 |
+ return "<+ " + content + " +>"; |
|
710 |
+ }; |
|
711 |
+ /** |
|
712 |
+ * @author fenris |
|
713 |
+ */ |
|
714 |
+ class_just.prototype.distinguish = function (action_just, action_nothing) { |
|
715 |
+ if (action_nothing === void 0) { action_nothing = function () { }; } |
|
716 |
+ action_just(this.value); |
|
717 |
+ }; |
|
718 |
+ /** |
|
719 |
+ * @author fenris |
|
720 |
+ */ |
|
721 |
+ class_just.prototype.propagate = function (action) { |
|
722 |
+ return action(this.value); |
|
723 |
+ }; |
|
724 |
+ return class_just; |
|
725 |
+}(class_maybe)); |
|
726 |
+/* |
|
727 |
+This file is part of »bacterio-plankton:base«. |
|
728 |
+ |
|
729 |
+Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
730 |
+<info@greenscale.de> |
|
731 |
+ |
|
732 |
+»bacterio-plankton:base« is free software: you can redistribute it and/or modify |
|
733 |
+it under the terms of the GNU Lesser General Public License as published by |
|
734 |
+the Free Software Foundation, either version 3 of the License, or |
|
735 |
+(at your option) any later version. |
|
736 |
+ |
|
737 |
+»bacterio-plankton:base« is distributed in the hope that it will be useful, |
|
738 |
+but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
739 |
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
740 |
+GNU Lesser General Public License for more details. |
|
741 |
+ |
|
742 |
+You should have received a copy of the GNU Lesser General Public License |
|
743 |
+along with »bacterio-plankton:base«. If not, see <http://www.gnu.org/licenses/>. |
|
744 |
+ */ |
|
745 |
+/** |
|
746 |
+ * @author frac |
|
747 |
+ */ |
|
748 |
+var class_error = /** @class */ (function (_super) { |
|
749 |
+ __extends(class_error, _super); |
|
750 |
+ /** |
|
751 |
+ * @author frac |
|
752 |
+ */ |
|
753 |
+ function class_error(message, suberrors) { |
|
754 |
+ if (suberrors === void 0) { suberrors = []; } |
|
755 |
+ var _this = _super.call(this, message) || this; |
|
756 |
+ _this.suberrors = suberrors; |
|
757 |
+ _this.mess = message; |
|
758 |
+ return _this; |
|
759 |
+ } |
|
760 |
+ /** |
|
761 |
+ * @override |
|
762 |
+ * @author frac |
|
763 |
+ */ |
|
764 |
+ class_error.prototype.toString = function () { |
|
765 |
+ return ( /*super.toString()*/this.mess + " " + ("[" + this.suberrors.map(function (x) { return x.toString(); }).join(",") + "]")); |
|
766 |
+ }; |
|
767 |
+ return class_error; |
|
768 |
+}(Error)); |
... | ... |
@@ -0,0 +1,861 @@ |
1 |
+Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
2 |
+<info@greenscale.de> |
|
3 |
+ |
|
4 |
+»bacterio-plankton:call« is free software: you can redistribute it and/or modify |
|
5 |
+it under the terms of the GNU Lesser General Public License as published by |
|
6 |
+the Free Software Foundation, either version 3 of the License, or |
|
7 |
+(at your option) any later version. |
|
8 |
+ |
|
9 |
+»bacterio-plankton:call« is distributed in the hope that it will be useful, |
|
10 |
+but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 |
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 |
+GNU Lesser General Public License for more details. |
|
13 |
+ |
|
14 |
+You should have received a copy of the GNU Lesser General Public License |
|
15 |
+along with »bacterio-plankton:call«. If not, see <http://www.gnu.org/licenses/>. |
|
16 |
+ |
|
17 |
+ |
|
18 |
+ |
|
19 |
+ GNU GENERAL PUBLIC LICENSE |
|
20 |
+ Version 3, 29 June 2007 |
|
21 |
+ |
|
22 |
+ Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/> |
|
23 |
+ Everyone is permitted to copy and distribute verbatim copies |
|
24 |
+ of this license document, but changing it is not allowed. |
|
25 |
+ |
|
26 |
+ Preamble |
|
27 |
+ |
|
28 |
+ The GNU General Public License is a free, copyleft license for |
|
29 |
+software and other kinds of works. |
|
30 |
+ |
|
31 |
+ The licenses for most software and other practical works are designed |
|
32 |
+to take away your freedom to share and change the works. By contrast, |
|
33 |
+the GNU General Public License is intended to guarantee your freedom to |
|
34 |
+share and change all versions of a program--to make sure it remains free |
|
35 |
+software for all its users. We, the Free Software Foundation, use the |
|
36 |
+GNU General Public License for most of our software; it applies also to |
|
37 |
+any other work released this way by its authors. You can apply it to |
|
38 |
+your programs, too. |
|
39 |
+ |
|
40 |
+ When we speak of free software, we are referring to freedom, not |
|
41 |
+price. Our General Public Licenses are designed to make sure that you |
|
42 |
+have the freedom to distribute copies of free software (and charge for |
|
43 |
+them if you wish), that you receive source code or can get it if you |
|
44 |
+want it, that you can change the software or use pieces of it in new |
|
45 |
+free programs, and that you know you can do these things. |
|
46 |
+ |
|
47 |
+ To protect your rights, we need to prevent others from denying you |
|
48 |
+these rights or asking you to surrender the rights. Therefore, you have |
|
49 |
+certain responsibilities if you distribute copies of the software, or if |
|
50 |
+you modify it: responsibilities to respect the freedom of others. |
|
51 |
+ |
|
52 |
+ For example, if you distribute copies of such a program, whether |
|
53 |
+gratis or for a fee, you must pass on to the recipients the same |
|
54 |
+freedoms that you received. You must make sure that they, too, receive |
|
55 |
+or can get the source code. And you must show them these terms so they |
|
56 |
+know their rights. |
|
57 |
+ |
|
58 |
+ Developers that use the GNU GPL protect your rights with two steps: |
|
59 |
+(1) assert copyright on the software, and (2) offer you this License |
|
60 |
+giving you legal permission to copy, distribute and/or modify it. |
|
61 |
+ |
|
62 |
+ For the developers' and authors' protection, the GPL clearly explains |
|
63 |
+that there is no warranty for this free software. For both users' and |
|
64 |
+authors' sake, the GPL requires that modified versions be marked as |
|
65 |
+changed, so that their problems will not be attributed erroneously to |
|
66 |
+authors of previous versions. |
|
67 |
+ |
|
68 |
+ Some devices are designed to deny users access to install or run |
|
69 |
+modified versions of the software inside them, although the manufacturer |
|
70 |
+can do so. This is fundamentally incompatible with the aim of |
|
71 |
+protecting users' freedom to change the software. The systematic |
|
72 |
+pattern of such abuse occurs in the area of products for individuals to |
|
73 |
+use, which is precisely where it is most unacceptable. Therefore, we |
|
74 |
+have designed this version of the GPL to prohibit the practice for those |
|
75 |
+products. If such problems arise substantially in other domains, we |
|
76 |
+stand ready to extend this provision to those domains in future versions |
|
77 |
+of the GPL, as needed to protect the freedom of users. |
|
78 |
+ |
|
79 |
+ Finally, every program is threatened constantly by software patents. |
|
80 |
+States should not allow patents to restrict development and use of |
|
81 |
+software on general-purpose computers, but in those that do, we wish to |
|
82 |
+avoid the special danger that patents applied to a free program could |
|
83 |
+make it effectively proprietary. To prevent this, the GPL assures that |
|
84 |
+patents cannot be used to render the program non-free. |
|
85 |
+ |
|
86 |
+ The precise terms and conditions for copying, distribution and |
|
87 |
+modification follow. |
|
88 |
+ |
|
89 |
+ TERMS AND CONDITIONS |
|
90 |
+ |
|
91 |
+ 0. Definitions. |
|
92 |
+ |
|
93 |
+ "This License" refers to version 3 of the GNU General Public License. |
|
94 |
+ |
|
95 |
+ "Copyright" also means copyright-like laws that apply to other kinds of |
|
96 |
+works, such as semiconductor masks. |
|
97 |
+ |
|
98 |
+ "The Program" refers to any copyrightable work licensed under this |
|
99 |
+License. Each licensee is addressed as "you". "Licensees" and |
|
100 |
+"recipients" may be individuals or organizations. |
|
101 |
+ |
|
102 |
+ To "modify" a work means to copy from or adapt all or part of the work |
|
103 |
+in a fashion requiring copyright permission, other than the making of an |
|
104 |
+exact copy. The resulting work is called a "modified version" of the |
|
105 |
+earlier work or a work "based on" the earlier work. |
|
106 |
+ |
|
107 |
+ A "covered work" means either the unmodified Program or a work based |
|
108 |
+on the Program. |
|
109 |
+ |
|
110 |
+ To "propagate" a work means to do anything with it that, without |
|
111 |
+permission, would make you directly or secondarily liable for |
|
112 |
+infringement under applicable copyright law, except executing it on a |
|
113 |
+computer or modifying a private copy. Propagation includes copying, |
|
114 |
+distribution (with or without modification), making available to the |
|
115 |
+public, and in some countries other activities as well. |
|
116 |
+ |
|
117 |
+ To "convey" a work means any kind of propagation that enables other |
|
118 |
+parties to make or receive copies. Mere interaction with a user through |
|
119 |
+a computer network, with no transfer of a copy, is not conveying. |
|
120 |
+ |
|
121 |
+ An interactive user interface displays "Appropriate Legal Notices" |
|
122 |
+to the extent that it includes a convenient and prominently visible |
|
123 |
+feature that (1) displays an appropriate copyright notice, and (2) |
|
124 |
+tells the user that there is no warranty for the work (except to the |
|
125 |
+extent that warranties are provided), that licensees may convey the |
|
126 |
+work under this License, and how to view a copy of this License. If |
|
127 |
+the interface presents a list of user commands or options, such as a |
|
128 |
+menu, a prominent item in the list meets this criterion. |
|
129 |
+ |
|
130 |
+ 1. Source Code. |
|
131 |
+ |
|
132 |
+ The "source code" for a work means the preferred form of the work |
|
133 |
+for making modifications to it. "Object code" means any non-source |
|
134 |
+form of a work. |
|
135 |
+ |
|
136 |
+ A "Standard Interface" means an interface that either is an official |
|
137 |
+standard defined by a recognized standards body, or, in the case of |
|
138 |
+interfaces specified for a particular programming language, one that |
|
139 |
+is widely used among developers working in that language. |
|
140 |
+ |
|
141 |
+ The "System Libraries" of an executable work include anything, other |
|
142 |
+than the work as a whole, that (a) is included in the normal form of |
|
143 |
+packaging a Major Component, but which is not part of that Major |
|
144 |
+Component, and (b) serves only to enable use of the work with that |
|
145 |
+Major Component, or to implement a Standard Interface for which an |
|
146 |
+implementation is available to the public in source code form. A |
|
147 |
+"Major Component", in this context, means a major essential component |
|
148 |
+(kernel, window system, and so on) of the specific operating system |
|
149 |
+(if any) on which the executable work runs, or a compiler used to |
|
150 |
+produce the work, or an object code interpreter used to run it. |
|
151 |
+ |
|
152 |
+ The "Corresponding Source" for a work in object code form means all |
|
153 |
+the source code needed to generate, install, and (for an executable |
|
154 |
+work) run the object code and to modify the work, including scripts to |
|
155 |
+control those activities. However, it does not include the work's |
|
156 |
+System Libraries, or general-purpose tools or generally available free |
|
157 |
+programs which are used unmodified in performing those activities but |
|
158 |
+which are not part of the work. For example, Corresponding Source |
|
159 |
+includes interface definition files associated with source files for |
|
160 |
+the work, and the source code for shared libraries and dynamically |
|
161 |
+linked subprograms that the work is specifically designed to require, |
|
162 |
+such as by intimate data communication or control flow between those |
|
163 |
+subprograms and other parts of the work. |
|
164 |
+ |
|
165 |
+ The Corresponding Source need not include anything that users |
|
166 |
+can regenerate automatically from other parts of the Corresponding |
|
167 |
+Source. |
|
168 |
+ |
|
169 |
+ The Corresponding Source for a work in source code form is that |
|
170 |
+same work. |
|
171 |
+ |
|
172 |
+ 2. Basic Permissions. |
|
173 |
+ |
|
174 |
+ All rights granted under this License are granted for the term of |
|
175 |
+copyright on the Program, and are irrevocable provided the stated |
|
176 |
+conditions are met. This License explicitly affirms your unlimited |
|
177 |
+permission to run the unmodified Program. The output from running a |
|
178 |
+covered work is covered by this License only if the output, given its |
|
179 |
+content, constitutes a covered work. This License acknowledges your |
|
180 |
+rights of fair use or other equivalent, as provided by copyright law. |
|
181 |
+ |
|
182 |
+ You may make, run and propagate covered works that you do not |
|
183 |
+convey, without conditions so long as your license otherwise remains |
|
184 |
+in force. You may convey covered works to others for the sole purpose |
|
185 |
+of having them make modifications exclusively for you, or provide you |
|
186 |
+with facilities for running those works, provided that you comply with |
|
187 |
+the terms of this License in conveying all material for which you do |
|
188 |
+not control copyright. Those thus making or running the covered works |
|
189 |
+for you must do so exclusively on your behalf, under your direction |
|
190 |
+and control, on terms that prohibit them from making any copies of |
|
191 |
+your copyrighted material outside their relationship with you. |
|
192 |
+ |
|
193 |
+ Conveying under any other circumstances is permitted solely under |
|
194 |
+the conditions stated below. Sublicensing is not allowed; section 10 |
|
195 |
+makes it unnecessary. |
|
196 |
+ |
|
197 |
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law. |
|
198 |
+ |
|
199 |
+ No covered work shall be deemed part of an effective technological |
|
200 |
+measure under any applicable law fulfilling obligations under article |
|
201 |
+11 of the WIPO copyright treaty adopted on 20 December 1996, or |
|
202 |
+similar laws prohibiting or restricting circumvention of such |
|
203 |
+measures. |
|
204 |
+ |
|
205 |
+ When you convey a covered work, you waive any legal power to forbid |
|
206 |
+circumvention of technological measures to the extent such circumvention |
|
207 |
+is effected by exercising rights under this License with respect to |
|
208 |
+the covered work, and you disclaim any intention to limit operation or |
|
209 |
+modification of the work as a means of enforcing, against the work's |
|
210 |
+users, your or third parties' legal rights to forbid circumvention of |
|
211 |
+technological measures. |
|
212 |
+ |
|
213 |
+ 4. Conveying Verbatim Copies. |
|
214 |
+ |
|
215 |
+ You may convey verbatim copies of the Program's source code as you |
|
216 |
+receive it, in any medium, provided that you conspicuously and |
|
217 |
+appropriately publish on each copy an appropriate copyright notice; |
|
218 |
+keep intact all notices stating that this License and any |
|
219 |
+non-permissive terms added in accord with section 7 apply to the code; |
|
220 |
+keep intact all notices of the absence of any warranty; and give all |
|
221 |
+recipients a copy of this License along with the Program. |
|
222 |
+ |
|
223 |
+ You may charge any price or no price for each copy that you convey, |
|
224 |
+and you may offer support or warranty protection for a fee. |
|
225 |
+ |
|
226 |
+ 5. Conveying Modified Source Versions. |
|
227 |
+ |
|
228 |
+ You may convey a work based on the Program, or the modifications to |
|
229 |
+produce it from the Program, in the form of source code under the |
|
230 |
+terms of section 4, provided that you also meet all of these conditions: |
|
231 |
+ |
|
232 |
+ a) The work must carry prominent notices stating that you modified |
|
233 |
+ it, and giving a relevant date. |
|
234 |
+ |
|
235 |
+ b) The work must carry prominent notices stating that it is |
|
236 |
+ released under this License and any conditions added under section |
|
237 |
+ 7. This requirement modifies the requirement in section 4 to |
|
238 |
+ "keep intact all notices". |
|
239 |
+ |
|
240 |
+ c) You must license the entire work, as a whole, under this |
|
241 |
+ License to anyone who comes into possession of a copy. This |
|
242 |
+ License will therefore apply, along with any applicable section 7 |
|
243 |
+ additional terms, to the whole of the work, and all its parts, |
|
244 |
+ regardless of how they are packaged. This License gives no |
|
245 |
+ permission to license the work in any other way, but it does not |
|
246 |
+ invalidate such permission if you have separately received it. |
|
247 |
+ |
|
248 |
+ d) If the work has interactive user interfaces, each must display |
|
249 |
+ Appropriate Legal Notices; however, if the Program has interactive |
|
250 |
+ interfaces that do not display Appropriate Legal Notices, your |
|
251 |
+ work need not make them do so. |
|
252 |
+ |
|
253 |
+ A compilation of a covered work with other separate and independent |
|
254 |
+works, which are not by their nature extensions of the covered work, |
|
255 |
+and which are not combined with it such as to form a larger program, |
|
256 |
+in or on a volume of a storage or distribution medium, is called an |
|
257 |
+"aggregate" if the compilation and its resulting copyright are not |
|
258 |
+used to limit the access or legal rights of the compilation's users |
|
259 |
+beyond what the individual works permit. Inclusion of a covered work |
|
260 |
+in an aggregate does not cause this License to apply to the other |
|
261 |
+parts of the aggregate. |
|
262 |
+ |
|
263 |
+ 6. Conveying Non-Source Forms. |
|
264 |
+ |
|
265 |
+ You may convey a covered work in object code form under the terms |
|
266 |
+of sections 4 and 5, provided that you also convey the |
|
267 |
+machine-readable Corresponding Source under the terms of this License, |
|
268 |
+in one of these ways: |
|
269 |
+ |
|
270 |
+ a) Convey the object code in, or embodied in, a physical product |
|
271 |
+ (including a physical distribution medium), accompanied by the |
|
272 |
+ Corresponding Source fixed on a durable physical medium |
|
273 |
+ customarily used for software interchange. |
|
274 |
+ |
|
275 |
+ b) Convey the object code in, or embodied in, a physical product |
|
276 |
+ (including a physical distribution medium), accompanied by a |
|
277 |
+ written offer, valid for at least three years and valid for as |
|
278 |
+ long as you offer spare parts or customer support for that product |
|
279 |
+ model, to give anyone who possesses the object code either (1) a |
|
280 |
+ copy of the Corresponding Source for all the software in the |
|
281 |
+ product that is covered by this License, on a durable physical |
|
282 |
+ medium customarily used for software interchange, for a price no |
|
283 |
+ more than your reasonable cost of physically performing this |
|
284 |
+ conveying of source, or (2) access to copy the |
|
285 |
+ Corresponding Source from a network server at no charge. |
|
286 |
+ |
|
287 |
+ c) Convey individual copies of the object code with a copy of the |
|
288 |
+ written offer to provide the Corresponding Source. This |
|
289 |
+ alternative is allowed only occasionally and noncommercially, and |
|
290 |
+ only if you received the object code with such an offer, in accord |
|
291 |
+ with subsection 6b. |
|
292 |
+ |
|
293 |
+ d) Convey the object code by offering access from a designated |
|
294 |
+ place (gratis or for a charge), and offer equivalent access to the |
|
295 |
+ Corresponding Source in the same way through the same place at no |
|
296 |
+ further charge. You need not require recipients to copy the |
|
297 |
+ Corresponding Source along with the object code. If the place to |
|
298 |
+ copy the object code is a network server, the Corresponding Source |
|
299 |
+ may be on a different server (operated by you or a third party) |
|
300 |
+ that supports equivalent copying facilities, provided you maintain |
|
301 |
+ clear directions next to the object code saying where to find the |
|
302 |
+ Corresponding Source. Regardless of what server hosts the |
|
303 |
+ Corresponding Source, you remain obligated to ensure that it is |
|
304 |
+ available for as long as needed to satisfy these requirements. |
|
305 |
+ |
|
306 |
+ e) Convey the object code using peer-to-peer transmission, provided |
|
307 |
+ you inform other peers where the object code and Corresponding |
|
308 |
+ Source of the work are being offered to the general public at no |
|
309 |
+ charge under subsection 6d. |
|
310 |
+ |
|
311 |
+ A separable portion of the object code, whose source code is excluded |
|
312 |
+from the Corresponding Source as a System Library, need not be |
|
313 |
+included in conveying the object code work. |
|
314 |
+ |
|
315 |
+ A "User Product" is either (1) a "consumer product", which means any |
|
316 |
+tangible personal property which is normally used for personal, family, |
|
317 |
+or household purposes, or (2) anything designed or sold for incorporation |
|
318 |
+into a dwelling. In determining whether a product is a consumer product, |
|
319 |
+doubtful cases shall be resolved in favor of coverage. For a particular |
|
320 |
+product received by a particular user, "normally used" refers to a |
|
321 |
+typical or common use of that class of product, regardless of the status |
|
322 |
+of the particular user or of the way in which the particular user |
|
323 |
+actually uses, or expects or is expected to use, the product. A product |
|
324 |
+is a consumer product regardless of whether the product has substantial |
|
325 |
+commercial, industrial or non-consumer uses, unless such uses represent |
|
326 |
+the only significant mode of use of the product. |
|
327 |
+ |
|
328 |
+ "Installation Information" for a User Product means any methods, |
|
329 |
+procedures, authorization keys, or other information required to install |
|
330 |
+and execute modified versions of a covered work in that User Product from |
|
331 |
+a modified version of its Corresponding Source. The information must |
|
332 |
+suffice to ensure that the continued functioning of the modified object |
|
333 |
+code is in no case prevented or interfered with solely because |
|
334 |
+modification has been made. |
|
335 |
+ |
|
336 |
+ If you convey an object code work under this section in, or with, or |
|
337 |
+specifically for use in, a User Product, and the conveying occurs as |
|
338 |
+part of a transaction in which the right of possession and use of the |
|
339 |
+User Product is transferred to the recipient in perpetuity or for a |
|
340 |
+fixed term (regardless of how the transaction is characterized), the |
|
341 |
+Corresponding Source conveyed under this section must be accompanied |
|
342 |
+by the Installation Information. But this requirement does not apply |
|
343 |
+if neither you nor any third party retains the ability to install |
|
344 |
+modified object code on the User Product (for example, the work has |
|
345 |
+been installed in ROM). |
|
346 |
+ |
|
347 |
+ The requirement to provide Installation Information does not include a |
|
348 |
+requirement to continue to provide support service, warranty, or updates |
|
349 |
+for a work that has been modified or installed by the recipient, or for |
|
350 |
+the User Product in which it has been modified or installed. Access to a |
|
351 |
+network may be denied when the modification itself materially and |
|
352 |
+adversely affects the operation of the network or violates the rules and |
|
353 |
+protocols for communication across the network. |
|
354 |
+ |
|
355 |
+ Corresponding Source conveyed, and Installation Information provided, |
|
356 |
+in accord with this section must be in a format that is publicly |
|
357 |
+documented (and with an implementation available to the public in |
|
358 |
+source code form), and must require no special password or key for |
|
359 |
+unpacking, reading or copying. |
|
360 |
+ |
|
361 |
+ 7. Additional Terms. |
|
362 |
+ |
|
363 |
+ "Additional permissions" are terms that supplement the terms of this |
|
364 |
+License by making exceptions from one or more of its conditions. |
|
365 |
+Additional permissions that are applicable to the entire Program shall |
|
366 |
+be treated as though they were included in this License, to the extent |
|
367 |
+that they are valid under applicable law. If additional permissions |
|
368 |
+apply only to part of the Program, that part may be used separately |
|
369 |
+under those permissions, but the entire Program remains governed by |
|
370 |
+this License without regard to the additional permissions. |
|
371 |
+ |
|
372 |
+ When you convey a copy of a covered work, you may at your option |
|
373 |
+remove any additional permissions from that copy, or from any part of |
|
374 |
+it. (Additional permissions may be written to require their own |
|
375 |
+removal in certain cases when you modify the work.) You may place |
|
376 |
+additional permissions on material, added by you to a covered work, |
|
377 |
+for which you have or can give appropriate copyright permission. |
|
378 |
+ |
|
379 |
+ Notwithstanding any other provision of this License, for material you |
|
380 |
+add to a covered work, you may (if authorized by the copyright holders of |
|
381 |
+that material) supplement the terms of this License with terms: |
|
382 |
+ |
|
383 |
+ a) Disclaiming warranty or limiting liability differently from the |
|
384 |
+ terms of sections 15 and 16 of this License; or |
|
385 |
+ |
|
386 |
+ b) Requiring preservation of specified reasonable legal notices or |
|
387 |
+ author attributions in that material or in the Appropriate Legal |
|
388 |
+ Notices displayed by works containing it; or |
|
389 |
+ |
|
390 |
+ c) Prohibiting misrepresentation of the origin of that material, or |
|
391 |
+ requiring that modified versions of such material be marked in |
|
392 |
+ reasonable ways as different from the original version; or |
|
393 |
+ |
|
394 |
+ d) Limiting the use for publicity purposes of names of licensors or |
|
395 |
+ authors of the material; or |
|
396 |
+ |
|
397 |
+ e) Declining to grant rights under trademark law for use of some |
|
398 |
+ trade names, trademarks, or service marks; or |
|
399 |
+ |
|
400 |
+ f) Requiring indemnification of licensors and authors of that |
|
401 |
+ material by anyone who conveys the material (or modified versions of |
|
402 |
+ it) with contractual assumptions of liability to the recipient, for |
|
403 |
+ any liability that these contractual assumptions directly impose on |
|
404 |
+ those licensors and authors. |
|
405 |
+ |
|
406 |
+ All other non-permissive additional terms are considered "further |
|
407 |
+restrictions" within the meaning of section 10. If the Program as you |
|
408 |
+received it, or any part of it, contains a notice stating that it is |
|
409 |
+governed by this License along with a term that is a further |
|
410 |
+restriction, you may remove that term. If a license document contains |
|
411 |
+a further restriction but permits relicensing or conveying under this |
|
412 |
+License, you may add to a covered work material governed by the terms |
|
413 |
+of that license document, provided that the further restriction does |
|
414 |
+not survive such relicensing or conveying. |
|
415 |
+ |
|
416 |
+ If you add terms to a covered work in accord with this section, you |
|
417 |
+must place, in the relevant source files, a statement of the |
|
418 |
+additional terms that apply to those files, or a notice indicating |
|
419 |
+where to find the applicable terms. |
|
420 |
+ |
|
421 |
+ Additional terms, permissive or non-permissive, may be stated in the |
|
422 |
+form of a separately written license, or stated as exceptions; |
|
423 |
+the above requirements apply either way. |
|
424 |
+ |
|
425 |
+ 8. Termination. |
|
426 |
+ |
|
427 |
+ You may not propagate or modify a covered work except as expressly |
|
428 |
+provided under this License. Any attempt otherwise to propagate or |
|
429 |
+modify it is void, and will automatically terminate your rights under |
|
430 |
+this License (including any patent licenses granted under the third |
|
431 |
+paragraph of section 11). |
|
432 |
+ |
|
433 |
+ However, if you cease all violation of this License, then your |
|
434 |
+license from a particular copyright holder is reinstated (a) |
|
435 |
+provisionally, unless and until the copyright holder explicitly and |
|
436 |
+finally terminates your license, and (b) permanently, if the copyright |
|
437 |
+holder fails to notify you of the violation by some reasonable means |
|
438 |
+prior to 60 days after the cessation. |
|
439 |
+ |
|
440 |
+ Moreover, your license from a particular copyright holder is |
|
441 |
+reinstated permanently if the copyright holder notifies you of the |
|
442 |
+violation by some reasonable means, this is the first time you have |
|
443 |
+received notice of violation of this License (for any work) from that |
|
444 |
+copyright holder, and you cure the violation prior to 30 days after |
|
445 |
+your receipt of the notice. |
|
446 |
+ |
|
447 |
+ Termination of your rights under this section does not terminate the |
|
448 |
+licenses of parties who have received copies or rights from you under |
|
449 |
+this License. If your rights have been terminated and not permanently |
|
450 |
+reinstated, you do not qualify to receive new licenses for the same |
|
451 |
+material under section 10. |
|
452 |
+ |
|
453 |
+ 9. Acceptance Not Required for Having Copies. |
|
454 |
+ |
|
455 |
+ You are not required to accept this License in order to receive or |
|
456 |
+run a copy of the Program. Ancillary propagation of a covered work |
|
457 |
+occurring solely as a consequence of using peer-to-peer transmission |
|
458 |
+to receive a copy likewise does not require acceptance. However, |
|
459 |
+nothing other than this License grants you permission to propagate or |
|
460 |
+modify any covered work. These actions infringe copyright if you do |
|
461 |
+not accept this License. Therefore, by modifying or propagating a |
|
462 |
+covered work, you indicate your acceptance of this License to do so. |
|
463 |
+ |
|
464 |
+ 10. Automatic Licensing of Downstream Recipients. |
|
465 |
+ |
|
466 |
+ Each time you convey a covered work, the recipient automatically |
|
467 |
+receives a license from the original licensors, to run, modify and |
|
468 |
+propagate that work, subject to this License. You are not responsible |
|
469 |
+for enforcing compliance by third parties with this License. |
|
470 |
+ |
|
471 |
+ An "entity transaction" is a transaction transferring control of an |
|
472 |
+organization, or substantially all assets of one, or subdividing an |
|
473 |
+organization, or merging organizations. If propagation of a covered |
|
474 |
+work results from an entity transaction, each party to that |
|
475 |
+transaction who receives a copy of the work also receives whatever |
|
476 |
+licenses to the work the party's predecessor in interest had or could |
|
477 |
+give under the previous paragraph, plus a right to possession of the |
|
478 |
+Corresponding Source of the work from the predecessor in interest, if |
|
479 |
+the predecessor has it or can get it with reasonable efforts. |
|
480 |
+ |
|
481 |
+ You may not impose any further restrictions on the exercise of the |
|
482 |
+rights granted or affirmed under this License. For example, you may |
|
483 |
+not impose a license fee, royalty, or other charge for exercise of |
|
484 |
+rights granted under this License, and you may not initiate litigation |
|
485 |
+(including a cross-claim or counterclaim in a lawsuit) alleging that |
|
486 |
+any patent claim is infringed by making, using, selling, offering for |
|
487 |
+sale, or importing the Program or any portion of it. |
|
488 |
+ |
|
489 |
+ 11. Patents. |
|
490 |
+ |
|
491 |
+ A "contributor" is a copyright holder who authorizes use under this |
|
492 |
+License of the Program or a work on which the Program is based. The |
|
493 |
+work thus licensed is called the contributor's "contributor version". |
|
494 |
+ |
|
495 |
+ A contributor's "essential patent claims" are all patent claims |
|
496 |
+owned or controlled by the contributor, whether already acquired or |
|
497 |
+hereafter acquired, that would be infringed by some manner, permitted |
|
498 |
+by this License, of making, using, or selling its contributor version, |
|
499 |
+but do not include claims that would be infringed only as a |
|
500 |
+consequence of further modification of the contributor version. For |
|
501 |
+purposes of this definition, "control" includes the right to grant |
|
502 |
+patent sublicenses in a manner consistent with the requirements of |
|
503 |
+this License. |
|
504 |
+ |
|
505 |
+ Each contributor grants you a non-exclusive, worldwide, royalty-free |
|
506 |
+patent license under the contributor's essential patent claims, to |
|
507 |
+make, use, sell, offer for sale, import and otherwise run, modify and |
|
508 |
+propagate the contents of its contributor version. |
|
509 |
+ |
|
510 |
+ In the following three paragraphs, a "patent license" is any express |
|
511 |
+agreement or commitment, however denominated, not to enforce a patent |
|
512 |
+(such as an express permission to practice a patent or covenant not to |
|
513 |
+sue for patent infringement). To "grant" such a patent license to a |
|
514 |
+party means to make such an agreement or commitment not to enforce a |
|
515 |
+patent against the party. |
|
516 |
+ |
|
517 |
+ If you convey a covered work, knowingly relying on a patent license, |
|
518 |
+and the Corresponding Source of the work is not available for anyone |
|
519 |
+to copy, free of charge and under the terms of this License, through a |
|
520 |
+publicly available network server or other readily accessible means, |
|
521 |
+then you must either (1) cause the Corresponding Source to be so |
|
522 |
+available, or (2) arrange to deprive yourself of the benefit of the |
|
523 |
+patent license for this particular work, or (3) arrange, in a manner |
|
524 |
+consistent with the requirements of this License, to extend the patent |
|
525 |
+license to downstream recipients. "Knowingly relying" means you have |
|
526 |
+actual knowledge that, but for the patent license, your conveying the |
|
527 |
+covered work in a country, or your recipient's use of the covered work |
|
528 |
+in a country, would infringe one or more identifiable patents in that |
|
529 |
+country that you have reason to believe are valid. |
|
530 |
+ |
|
531 |
+ If, pursuant to or in connection with a single transaction or |
|
532 |
+arrangement, you convey, or propagate by procuring conveyance of, a |
|
533 |
+covered work, and grant a patent license to some of the parties |
|
534 |
+receiving the covered work authorizing them to use, propagate, modify |
|
535 |
+or convey a specific copy of the covered work, then the patent license |
|
536 |
+you grant is automatically extended to all recipients of the covered |
|
537 |
+work and works based on it. |
|
538 |
+ |
|
539 |
+ A patent license is "discriminatory" if it does not include within |
|
540 |
+the scope of its coverage, prohibits the exercise of, or is |
|
541 |
+conditioned on the non-exercise of one or more of the rights that are |
|
542 |
+specifically granted under this License. You may not convey a covered |
|
543 |
+work if you are a party to an arrangement with a third party that is |
|
544 |
+in the business of distributing software, under which you make payment |
|
545 |
+to the third party based on the extent of your activity of conveying |
|
546 |
+the work, and under which the third party grants, to any of the |
|
547 |
+parties who would receive the covered work from you, a discriminatory |
|
548 |
+patent license (a) in connection with copies of the covered work |
|
549 |
+conveyed by you (or copies made from those copies), or (b) primarily |
|
550 |
+for and in connection with specific products or compilations that |
|
551 |
+contain the covered work, unless you entered into that arrangement, |
|
552 |
+or that patent license was granted, prior to 28 March 2007. |
|
553 |
+ |
|
554 |
+ Nothing in this License shall be construed as excluding or limiting |
|
555 |
+any implied license or other defenses to infringement that may |
|
556 |
+otherwise be available to you under applicable patent law. |
|
557 |
+ |
|
558 |
+ 12. No Surrender of Others' Freedom. |
|
559 |
+ |
|
560 |
+ If conditions are imposed on you (whether by court order, agreement or |
|
561 |
+otherwise) that contradict the conditions of this License, they do not |
|
562 |
+excuse you from the conditions of this License. If you cannot convey a |
|
563 |
+covered work so as to satisfy simultaneously your obligations under this |
|
564 |
+License and any other pertinent obligations, then as a consequence you may |
|
565 |
+not convey it at all. For example, if you agree to terms that obligate you |
|
566 |
+to collect a royalty for further conveying from those to whom you convey |
|
567 |
+the Program, the only way you could satisfy both those terms and this |
|
568 |
+License would be to refrain entirely from conveying the Program. |
|
569 |
+ |
|
570 |
+ 13. Use with the GNU Affero General Public License. |
|
571 |
+ |
|
572 |
+ Notwithstanding any other provision of this License, you have |
|
573 |
+permission to link or combine any covered work with a work licensed |
|
574 |
+under version 3 of the GNU Affero General Public License into a single |
|
575 |
+combined work, and to convey the resulting work. The terms of this |
|
576 |
+License will continue to apply to the part which is the covered work, |
|
577 |
+but the special requirements of the GNU Affero General Public License, |
|
578 |
+section 13, concerning interaction through a network will apply to the |
|
579 |
+combination as such. |
|
580 |
+ |
|
581 |
+ 14. Revised Versions of this License. |
|
582 |
+ |
|
583 |
+ The Free Software Foundation may publish revised and/or new versions of |
|
584 |
+the GNU General Public License from time to time. Such new versions will |
|
585 |
+be similar in spirit to the present version, but may differ in detail to |
|
586 |
+address new problems or concerns. |
|
587 |
+ |
|
588 |
+ Each version is given a distinguishing version number. If the |
|
589 |
+Program specifies that a certain numbered version of the GNU General |
|
590 |
+Public License "or any later version" applies to it, you have the |
|
591 |
+option of following the terms and conditions either of that numbered |
|
592 |
+version or of any later version published by the Free Software |
|
593 |
+Foundation. If the Program does not specify a version number of the |
|
594 |
+GNU General Public License, you may choose any version ever published |
|
595 |
+by the Free Software Foundation. |
|
596 |
+ |
|
597 |
+ If the Program specifies that a proxy can decide which future |
|
598 |
+versions of the GNU General Public License can be used, that proxy's |
|
599 |
+public statement of acceptance of a version permanently authorizes you |
|
600 |
+to choose that version for the Program. |
|
601 |
+ |
|
602 |
+ Later license versions may give you additional or different |
|
603 |
+permissions. However, no additional obligations are imposed on any |
|
604 |
+author or copyright holder as a result of your choosing to follow a |
|
605 |
+later version. |
|
606 |
+ |
|
607 |
+ 15. Disclaimer of Warranty. |
|
608 |
+ |
|
609 |
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY |
|
610 |
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT |
|
611 |
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY |
|
612 |
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, |
|
613 |
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
|
614 |
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM |
|
615 |
+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF |
|
616 |
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION. |
|
617 |
+ |
|
618 |
+ 16. Limitation of Liability. |
|
619 |
+ |
|
620 |
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING |
|
621 |
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS |
|
622 |
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY |
|
623 |
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE |
|
624 |
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF |
|
625 |
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD |
|
626 |
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), |
|
627 |
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF |
|
628 |
+SUCH DAMAGES. |
|
629 |
+ |
|
630 |
+ 17. Interpretation of Sections 15 and 16. |
|
631 |
+ |
|
632 |
+ If the disclaimer of warranty and limitation of liability provided |
|
633 |
+above cannot be given local legal effect according to their terms, |
|
634 |
+reviewing courts shall apply local law that most closely approximates |
|
635 |
+an absolute waiver of all civil liability in connection with the |
|
636 |
+Program, unless a warranty or assumption of liability accompanies a |
|
637 |
+copy of the Program in return for a fee. |
|
638 |
+ |
|
639 |
+ END OF TERMS AND CONDITIONS |
|
640 |
+ |
|
641 |
+ How to Apply These Terms to Your New Programs |
|
642 |
+ |
|
643 |
+ If you develop a new program, and you want it to be of the greatest |
|
644 |
+possible use to the public, the best way to achieve this is to make it |
|
645 |
+free software which everyone can redistribute and change under these terms. |
|
646 |
+ |
|
647 |
+ To do so, attach the following notices to the program. It is safest |
|
648 |
+to attach them to the start of each source file to most effectively |
|
649 |
+state the exclusion of warranty; and each file should have at least |
|
650 |
+the "copyright" line and a pointer to where the full notice is found. |
|
651 |
+ |
|
652 |
+ <one line to give the program's name and a brief idea of what it does.> |
|
653 |
+ Copyright (C) <year> <name of author> |
|
654 |
+ |
|
655 |
+ This program is free software: you can redistribute it and/or modify |
|
656 |
+ it under the terms of the GNU General Public License as published by |
|
657 |
+ the Free Software Foundation, either version 3 of the License, or |
|
658 |
+ (at your option) any later version. |
|
659 |
+ |
|
660 |
+ This program is distributed in the hope that it will be useful, |
|
661 |
+ but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
662 |
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
663 |
+ GNU General Public License for more details. |
|
664 |
+ |
|
665 |
+ You should have received a copy of the GNU General Public License |
|
666 |
+ along with this program. If not, see <https://www.gnu.org/licenses/>. |
|
667 |
+ |
|
668 |
+Also add information on how to contact you by electronic and paper mail. |
|
669 |
+ |
|
670 |
+ If the program does terminal interaction, make it output a short |
|
671 |
+notice like this when it starts in an interactive mode: |
|
672 |
+ |
|
673 |
+ <program> Copyright (C) <year> <name of author> |
|
674 |
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. |
|
675 |
+ This is free software, and you are welcome to redistribute it |
|
676 |
+ under certain conditions; type `show c' for details. |
|
677 |
+ |
|
678 |
+The hypothetical commands `show w' and `show c' should show the appropriate |
|
679 |
+parts of the General Public License. Of course, your program's commands |
|
680 |
+might be different; for a GUI interface, you would use an "about box". |
|
681 |
+ |
|
682 |
+ You should also get your employer (if you work as a programmer) or school, |
|
683 |
+if any, to sign a "copyright disclaimer" for the program, if necessary. |
|
684 |
+For more information on this, and how to apply and follow the GNU GPL, see |
|
685 |
+<https://www.gnu.org/licenses/>. |
|
686 |
+ |
|
687 |
+ The GNU General Public License does not permit incorporating your program |
|
688 |
+into proprietary programs. If your program is a subroutine library, you |
|
689 |
+may consider it more useful to permit linking proprietary applications with |
|
690 |
+the library. If this is what you want to do, use the GNU Lesser General |
|
691 |
+Public License instead of this License. But first, please read |
|
692 |
+<https://www.gnu.org/licenses/why-not-lgpl.html>. |
|
693 |
+ |
|
694 |
+ |
|
695 |
+ |
|
696 |
+ GNU LESSER GENERAL PUBLIC LICENSE |
|
697 |
+ Version 3, 29 June 2007 |
|
698 |
+ |
|
699 |
+ Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/> |
|
700 |
+ Everyone is permitted to copy and distribute verbatim copies |
|
701 |
+ of this license document, but changing it is not allowed. |
|
702 |
+ |
|
703 |
+ |
|
704 |
+ This version of the GNU Lesser General Public License incorporates |
|
705 |
+the terms and conditions of version 3 of the GNU General Public |
|
706 |
+License, supplemented by the additional permissions listed below. |
|
707 |
+ |
|
708 |
+ 0. Additional Definitions. |
|
709 |
+ |
|
710 |
+ As used herein, "this License" refers to version 3 of the GNU Lesser |
|
711 |
+General Public License, and the "GNU GPL" refers to version 3 of the GNU |
|
712 |
+General Public License. |
|
713 |
+ |
|
714 |
+ "The Library" refers to a covered work governed by this License, |
|
715 |
+other than an Application or a Combined Work as defined below. |
|
716 |
+ |
|
717 |
+ An "Application" is any work that makes use of an interface provided |
|
718 |
+by the Library, but which is not otherwise based on the Library. |
|
719 |
+Defining a subclass of a class defined by the Library is deemed a mode |
|
720 |
+of using an interface provided by the Library. |
|
721 |
+ |
|
722 |
+ A "Combined Work" is a work produced by combining or linking an |
|
723 |
+Application with the Library. The particular version of the Library |
|
724 |
+with which the Combined Work was made is also called the "Linked |
|
725 |
+Version". |
|
726 |
+ |
|
727 |
+ The "Minimal Corresponding Source" for a Combined Work means the |
|
728 |
+Corresponding Source for the Combined Work, excluding any source code |
|
729 |
+for portions of the Combined Work that, considered in isolation, are |
|
730 |
+based on the Application, and not on the Linked Version. |
|
731 |
+ |
|
732 |
+ The "Corresponding Application Code" for a Combined Work means the |
|
733 |
+object code and/or source code for the Application, including any data |
|
734 |
+and utility programs needed for reproducing the Combined Work from the |
|
735 |
+Application, but excluding the System Libraries of the Combined Work. |
|
736 |
+ |
|
737 |
+ 1. Exception to Section 3 of the GNU GPL. |
|
738 |
+ |
|
739 |
+ You may convey a covered work under sections 3 and 4 of this License |
|
740 |
+without being bound by section 3 of the GNU GPL. |
|
741 |
+ |
|
742 |
+ 2. Conveying Modified Versions. |
|
743 |
+ |
|
744 |
+ If you modify a copy of the Library, and, in your modifications, a |
|
745 |
+facility refers to a function or data to be supplied by an Application |
|
746 |
+that uses the facility (other than as an argument passed when the |
|
747 |
+facility is invoked), then you may convey a copy of the modified |
|
748 |
+version: |
|
749 |
+ |
|
750 |
+ a) under this License, provided that you make a good faith effort to |
|
751 |
+ ensure that, in the event an Application does not supply the |
|
752 |
+ function or data, the facility still operates, and performs |
|
753 |
+ whatever part of its purpose remains meaningful, or |
|
754 |
+ |
|
755 |
+ b) under the GNU GPL, with none of the additional permissions of |
|
756 |
+ this License applicable to that copy. |
|
757 |
+ |
|
758 |
+ 3. Object Code Incorporating Material from Library Header Files. |
|
759 |
+ |
|
760 |
+ The object code form of an Application may incorporate material from |
|
761 |
+a header file that is part of the Library. You may convey such object |
|
762 |
+code under terms of your choice, provided that, if the incorporated |
|
763 |
+material is not limited to numerical parameters, data structure |
|
764 |
+layouts and accessors, or small macros, inline functions and templates |
|
765 |
+(ten or fewer lines in length), you do both of the following: |
|
766 |
+ |
|
767 |
+ a) Give prominent notice with each copy of the object code that the |
|
768 |
+ Library is used in it and that the Library and its use are |
|
769 |
+ covered by this License. |
|
770 |
+ |
|
771 |
+ b) Accompany the object code with a copy of the GNU GPL and this license |
|
772 |
+ document. |
|
773 |
+ |
|
774 |
+ 4. Combined Works. |
|
775 |
+ |
|
776 |
+ You may convey a Combined Work under terms of your choice that, |
|
777 |
+taken together, effectively do not restrict modification of the |
|
778 |
+portions of the Library contained in the Combined Work and reverse |
|
779 |
+engineering for debugging such modifications, if you also do each of |
|
780 |
+the following: |
|
781 |
+ |
|
782 |
+ a) Give prominent notice with each copy of the Combined Work that |
|
783 |
+ the Library is used in it and that the Library and its use are |
|
784 |
+ covered by this License. |
|
785 |
+ |
|
786 |
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license |
|
787 |
+ document. |
|
788 |
+ |
|
789 |
+ c) For a Combined Work that displays copyright notices during |
|
790 |
+ execution, include the copyright notice for the Library among |
|
791 |
+ these notices, as well as a reference directing the user to the |
|
792 |
+ copies of the GNU GPL and this license document. |
|
793 |
+ |
|
794 |
+ d) Do one of the following: |
|
795 |
+ |
|
796 |
+ 0) Convey the Minimal Corresponding Source under the terms of this |
|
797 |
+ License, and the Corresponding Application Code in a form |
|
798 |
+ suitable for, and under terms that permit, the user to |
|
799 |
+ recombine or relink the Application with a modified version of |
|
800 |
+ the Linked Version to produce a modified Combined Work, in the |
|
801 |
+ manner specified by section 6 of the GNU GPL for conveying |
|
802 |
+ Corresponding Source. |
|
803 |
+ |
|
804 |
+ 1) Use a suitable shared library mechanism for linking with the |
|
805 |
+ Library. A suitable mechanism is one that (a) uses at run time |
|
806 |
+ a copy of the Library already present on the user's computer |
|
807 |
+ system, and (b) will operate properly with a modified version |
|
808 |
+ of the Library that is interface-compatible with the Linked |
|
809 |
+ Version. |
|
810 |
+ |
|
811 |
+ e) Provide Installation Information, but only if you would otherwise |
|
812 |
+ be required to provide such information under section 6 of the |
|
813 |
+ GNU GPL, and only to the extent that such information is |
|
814 |
+ necessary to install and execute a modified version of the |
|
815 |
+ Combined Work produced by recombining or relinking the |
|
816 |
+ Application with a modified version of the Linked Version. (If |
|
817 |
+ you use option 4d0, the Installation Information must accompany |
|
818 |
+ the Minimal Corresponding Source and Corresponding Application |
|
819 |
+ Code. If you use option 4d1, you must provide the Installation |
|
820 |
+ Information in the manner specified by section 6 of the GNU GPL |
|
821 |
+ for conveying Corresponding Source.) |
|
822 |
+ |
|
823 |
+ 5. Combined Libraries. |
|
824 |
+ |
|
825 |
+ You may place library facilities that are a work based on the |
|
826 |
+Library side by side in a single library together with other library |
|
827 |
+facilities that are not Applications and are not covered by this |
|
828 |
+License, and convey such a combined library under terms of your |
|
829 |
+choice, if you do both of the following: |
|
830 |
+ |
|
831 |
+ a) Accompany the combined library with a copy of the same work based |
|
832 |
+ on the Library, uncombined with any other library facilities, |
|
833 |
+ conveyed under the terms of this License. |
|
834 |
+ |
|
835 |
+ b) Give prominent notice with the combined library that part of it |
|
836 |
+ is a work based on the Library, and explaining where to find the |
|
837 |
+ accompanying uncombined form of the same work. |
|
838 |
+ |
|
839 |
+ 6. Revised Versions of the GNU Lesser General Public License. |
|
840 |
+ |
|
841 |
+ The Free Software Foundation may publish revised and/or new versions |
|
842 |
+of the GNU Lesser General Public License from time to time. Such new |
|
843 |
+versions will be similar in spirit to the present version, but may |
|
844 |
+differ in detail to address new problems or concerns. |
|
845 |
+ |
|
846 |
+ Each version is given a distinguishing version number. If the |
|
847 |
+Library as you received it specifies that a certain numbered version |
|
848 |
+of the GNU Lesser General Public License "or any later version" |
|
849 |
+applies to it, you have the option of following the terms and |
|
850 |
+conditions either of that published version or of any later version |
|
851 |
+published by the Free Software Foundation. If the Library as you |
|
852 |
+received it does not specify a version number of the GNU Lesser |
|
853 |
+General Public License, you may choose any version of the GNU Lesser |
|
854 |
+General Public License ever published by the Free Software Foundation. |
|
855 |
+ |
|
856 |
+ If the Library as you received it specifies that a proxy can decide |
|
857 |
+whether future versions of the GNU Lesser General Public License shall |
|
858 |
+apply, that proxy's public statement of acceptance of any version is |
|
859 |
+permanent authorization for you to choose that version for the |
|
860 |
+Library. |
|
861 |
+ |
... | ... |
@@ -0,0 +1,394 @@ |
1 |
+declare module lib_call { |
|
2 |
+ /** |
|
3 |
+ * @desc hacked class for postfix function application |
|
4 |
+ * @author fenris |
|
5 |
+ */ |
|
6 |
+ class class_valuewrapper<type_value> { |
|
7 |
+ /** |
|
8 |
+ * @author fenris |
|
9 |
+ */ |
|
10 |
+ protected value: type_value; |
|
11 |
+ /** |
|
12 |
+ * @desc [constructor] |
|
13 |
+ * @author fenris |
|
14 |
+ */ |
|
15 |
+ constructor(value: type_value); |
|
16 |
+ /** |
|
17 |
+ * @desc [accessor] applies a function and returns a new valuewrapper |
|
18 |
+ * @author fenris |
|
19 |
+ */ |
|
20 |
+ pass<type_value_>(function_: (value: type_value) => type_value_): class_valuewrapper<type_value_>; |
|
21 |
+ /** |
|
22 |
+ * @desc [accessor] gives the wrapped value |
|
23 |
+ * @author fenris |
|
24 |
+ */ |
|
25 |
+ extract(): type_value; |
|
26 |
+ } |
|
27 |
+ /** |
|
28 |
+ * @desc shortcut for constructing a valuewrapper-object |
|
29 |
+ * @author fenris |
|
30 |
+ */ |
|
31 |
+ function vw<type_value>(value: type_value): class_valuewrapper<type_value>; |
|
32 |
+ /** |
|
33 |
+ * @author fenris |
|
34 |
+ */ |
|
35 |
+ function use<type_input, type_output>(input: type_input, function_: (input: type_input) => type_output): type_output; |
|
36 |
+ /** |
|
37 |
+ * @desc just the identity; useful for some callbacks etc. |
|
38 |
+ * @author fenris |
|
39 |
+ */ |
|
40 |
+ function id<type_value>(x: type_value): type_value; |
|
41 |
+ /** |
|
42 |
+ * @desc composes two functions (i.e. returns a function that return the result of the successive execution of both input-functions) |
|
43 |
+ * @param {function} function_f |
|
44 |
+ * @param {function} function_g |
|
45 |
+ * @author fenris |
|
46 |
+ */ |
|
47 |
+ function compose<type_x, type_y, type_z>(function_f: (type_x: any) => type_y, function_g: (type_y: any) => type_z): (value: type_x) => type_z; |
|
48 |
+ /** |
|
49 |
+ * @desc transforms a function with sequential input into a function with leveled input; example: add(2,3) = curryfy(add)(2)(3) |
|
50 |
+ * @param {function} f |
|
51 |
+ * @param {int} n (don't set manually) |
|
52 |
+ * @return {function} the currified version of the in put function |
|
53 |
+ * @author fenris |
|
54 |
+ */ |
|
55 |
+ function curryfy(f: Function, n?: int): Function; |
|
56 |
+} |
|
57 |
+declare module lib_call { |
|
58 |
+ /** |
|
59 |
+ * @author fenris |
|
60 |
+ */ |
|
61 |
+ type type_executor<type_result, type_reason> = ((resolve: (result?: type_result) => any, reject?: (reason?: type_reason) => void) => void); |
|
62 |
+ /** |
|
63 |
+ * @author fenris |
|
64 |
+ */ |
|
65 |
+ function executor_resolve<type_result, type_reason>(result: type_result): type_executor<type_result, type_reason>; |
|
66 |
+ /** |
|
67 |
+ * @author fenris |
|
68 |
+ */ |
|
69 |
+ function executor_reject<type_result, type_reason>(reason: type_reason): type_executor<type_result, type_reason>; |
|
70 |
+ /** |
|
71 |
+ * @author fenris |
|
72 |
+ */ |
|
73 |
+ function executor_transform<type_result_from, type_error_from, type_result_to, type_error_to>(executor: type_executor<type_result_from, type_error_from>, transform_result: (result_from: type_result_from) => type_result_to, transform_reason: (error_from: type_error_from) => type_error_to): type_executor<type_result_to, type_error_to>; |
|
74 |
+ /** |
|
75 |
+ * @author fenris |
|
76 |
+ */ |
|
77 |
+ function executor_transform_default<type_result_from, type_result_to>(executor: type_executor<type_result_from, Error>, transform_result: (result_from: type_result_from) => type_result_to, wrap_string?: string): type_executor<type_result_to, Error>; |
|
78 |
+ /** |
|
79 |
+ * @author fenris |
|
80 |
+ */ |
|
81 |
+ function executor_compose_sequential<type_result_first, type_result_second, type_reason>(first: type_executor<type_result_first, type_reason>, second: (result: type_result_first) => type_executor<type_result_second, type_reason>): type_executor<type_result_second, type_reason>; |
|
82 |
+ /** |
|
83 |
+ * @author fenris |
|
84 |
+ */ |
|
85 |
+ function executor_chain<type_state, type_error>(state: type_state, executors: Array<(state: type_state) => type_executor<type_state, type_error>>): type_executor<type_state, type_error>; |
|
86 |
+ /** |
|
87 |
+ * @author fenris |
|
88 |
+ */ |
|
89 |
+ function executor_first<type_result, type_reason>(executors: Array<type_executor<type_result, type_reason>>): type_executor<type_result, Array<type_reason>>; |
|
90 |
+ /** |
|
91 |
+ * @author fenris |
|
92 |
+ */ |
|
93 |
+ function executor_condense<type_element>(executors: Array<type_executor<type_element, Error>>): type_executor<Array<type_element>, Error>; |
|
94 |
+ /** |
|
95 |
+ * @author fenris |
|
96 |
+ * @deprecated use condense |
|
97 |
+ */ |
|
98 |
+ function executor_filter<type_element>(executors: Array<type_executor<type_element, Error>>, predicate: (element: type_element) => boolean): type_executor<Array<type_element>, Error>; |
|
99 |
+ /** |
|
100 |
+ * @author fenris |
|
101 |
+ * @deprecated use condense |
|
102 |
+ */ |
|
103 |
+ function executor_map<type_element1, type_element2>(executors: Array<type_executor<type_element1, Error>>, transformator: (element1: type_element1) => type_element2): type_executor<Array<type_element2>, Error>; |
|
104 |
+ /** |
|
105 |
+ * @author fenris |
|
106 |
+ * @deprecated use condense |
|
107 |
+ */ |
|
108 |
+ function executor_reduce<type_element, type_result>(executors: Array<type_executor<type_element, Error>>, initial: type_result, accumulator: (result: type_result, element: type_element) => type_result): type_executor<type_result, Error>; |
|
109 |
+} |
|
110 |
+declare module lib_call { |
|
111 |
+ /** |
|
112 |
+ * @author fenris |
|
113 |
+ */ |
|
114 |
+ type type_promise<type_result, type_reason> = Promise<type_result>; |
|
115 |
+ /** |
|
116 |
+ * @author fenris |
|
117 |
+ */ |
|
118 |
+ function promise_reject<type_result, type_reason>(reason: type_reason): type_promise<type_result, type_reason>; |
|
119 |
+ /** |
|
120 |
+ * @author fenris |
|
121 |
+ */ |
|
122 |
+ function promise_resolve<type_result, type_reason>(result: type_result): type_promise<type_result, type_reason>; |
|
123 |
+ /** |
|
124 |
+ * @author fenris |
|
125 |
+ */ |
|
126 |
+ function promise_make<type_result, type_reason>(executor: (resolve: (result?: type_result) => void, reject: (reason?: type_reason) => void) => void): type_promise<type_result, type_reason>; |
|
127 |
+ /** |
|
128 |
+ * @author fenris |
|
129 |
+ */ |
|
130 |
+ function promise_then_close<type_result, type_reason>(promise: type_promise<type_result, type_reason>, resolver: (result: type_result) => void, rejector: (reason: type_reason) => void): void; |
|
131 |
+ /** |
|
132 |
+ * @author fenris |
|
133 |
+ */ |
|
134 |
+ function promise_then_append<type_result, type_reason, type_result_>(promise: type_promise<type_result, type_reason>, resolver: (result: type_result) => type_promise<type_result_, type_reason>, rejector?: (reason: type_reason) => type_promise<type_result_, type_reason>): type_promise<type_result_, type_result>; |
|
135 |
+ /** |
|
136 |
+ * @author fenris |
|
137 |
+ */ |
|
138 |
+ function promise_all<type_result, type_reason>(promises: Array<type_promise<type_result, type_reason>>): type_promise<Array<type_result>, type_reason>; |
|
139 |
+ /** |
|
140 |
+ * @author fenris |
|
141 |
+ */ |
|
142 |
+ function promise_chain<type_result, type_reason>(promises: Array<(input: type_result) => type_promise<type_result, type_reason>>, start?: type_result): type_promise<type_result, type_reason>; |
|
143 |
+ /** |
|
144 |
+ * @author fenris |
|
145 |
+ */ |
|
146 |
+ function promise_condense<type_element, type_reason>(promises: Array<() => type_promise<type_element, type_reason>>): type_promise<Array<type_element>, type_reason>; |
|
147 |
+ /** |
|
148 |
+ * @author fenris |
|
149 |
+ */ |
|
150 |
+ function promise_group<type_reason>(promises: { |
|
151 |
+ [name: string]: () => type_promise<any, type_reason>; |
|
152 |
+ }, serial?: boolean): type_promise<{ |
|
153 |
+ [name: string]: any; |
|
154 |
+ }, type_reason>; |
|
155 |
+ /** |
|
156 |
+ * @author fenris |
|
157 |
+ */ |
|
158 |
+ function promise_wrap<type_result_inner, type_result_outer, type_reason>(promise: type_promise<type_result_inner, type_reason>, transformator_result: (reason: type_result_inner) => type_result_outer, transformator_reason?: (reason: type_reason) => type_reason): Promise<type_result_outer>; |
|
159 |
+ /** |
|
160 |
+ * @author fenris |
|
161 |
+ */ |
|
162 |
+ function promise_show<type_result, type_reason>(label: string): (result: type_result) => type_promise<type_result, type_reason>; |
|
163 |
+ /** |
|
164 |
+ * @author fenris |
|
165 |
+ */ |
|
166 |
+ function promise_log<type_result, type_reason>(result: type_result): (result: type_result) => type_promise<type_result, type_reason>; |
|
167 |
+ /** |
|
168 |
+ * @author fenris |
|
169 |
+ */ |
|
170 |
+ function promise_attach<type_reason>(state: { |
|
171 |
+ [name: string]: any; |
|
172 |
+ }, promise: type_promise<any, type_reason>, name: string): type_promise<{ |
|
173 |
+ [name: string]: any; |
|
174 |
+ }, type_reason>; |
|
175 |
+ /** |
|
176 |
+ * @author fenris |
|
177 |
+ */ |
|
178 |
+ function promise_delay<type_result, type_reason>(promise: type_promise<type_result, type_reason>, delay: int): Promise<type_result>; |
|
179 |
+ /** |
|
180 |
+ * @author fenris |
|
181 |
+ */ |
|
182 |
+ function promise_to_executor<type_result, type_reason>(promise: type_promise<type_result, type_reason>): type_executor<type_result, type_reason>; |
|
183 |
+} |
|
184 |
+declare module lib_call { |
|
185 |
+ /** |
|
186 |
+ * @author fenris |
|
187 |
+ */ |
|
188 |
+ type type_initializer_state = int; |
|
189 |
+ const initializer_state_initial: type_initializer_state; |
|
190 |
+ const initializer_state_waiting: type_initializer_state; |
|
191 |
+ const initializer_state_successful: type_initializer_state; |
|
192 |
+ const initializer_state_failed: type_initializer_state; |
|
193 |
+ /** |
|
194 |
+ * @author fenris |
|
195 |
+ */ |
|
196 |
+ type type_initializer<type_result, type_reason> = { |
|
197 |
+ fetcher: () => type_promise<type_result, type_reason>; |
|
198 |
+ state?: type_initializer_state; |
|
199 |
+ queue: Array<{ |
|
200 |
+ resolve: (result?: type_result) => void; |
|
201 |
+ reject: (reason?: type_reason) => void; |
|
202 |
+ }>; |
|
203 |
+ result?: type_result; |
|
204 |
+ reason?: type_reason; |
|
205 |
+ }; |
|
206 |
+ /** |
|
207 |
+ * @author fenris |
|
208 |
+ */ |
|
209 |
+ function initializer_make<type_result, type_reason>(fetcher: () => type_promise<type_result, type_reason>): type_initializer<type_result, type_reason>; |
|
210 |
+ /** |
|
211 |
+ * @author fenris |
|
212 |
+ */ |
|
213 |
+ function initializer_reset<type_result, type_reason>(subject: type_initializer<type_result, type_reason>): void; |
|
214 |
+ /** |
|
215 |
+ * @author fenris |
|
216 |
+ */ |
|
217 |
+ function initializer_state<type_result, type_reason>(subject: type_initializer<type_result, type_reason>): type_initializer_state; |
|
218 |
+ /** |
|
219 |
+ * @author fenris |
|
220 |
+ */ |
|
221 |
+ function initializer_get<type_result, type_reason>(subject: type_initializer<type_result, type_reason>): type_promise<type_result, type_reason>; |
|
222 |
+} |
|
223 |
+declare module lib_call { |
|
224 |
+ /** |
|
225 |
+ * @author fenris |
|
226 |
+ */ |
|
227 |
+ type type_deferral<type_input, type_output> = { |
|
228 |
+ representation: (input: type_input) => Promise<type_output>; |
|
229 |
+ }; |
|
230 |
+ /** |
|
231 |
+ * @author fenris |
|
232 |
+ * @desc activates the deferral and handles its output according to a given procedure |
|
233 |
+ * @param {(value : type_value)=>void} procedure a function which receives the output of the deferral as argument |
|
234 |
+ */ |
|
235 |
+ function deferral_use<type_input, type_output>(deferral: type_deferral<type_input, type_output>, input: type_input, procedure: (output: type_output) => void): void; |
|
236 |
+ /** |
|
237 |
+ * @author fenris |
|
238 |
+ * @desc creates a deferral-subject (similar to "new Promise", where "convey" reflects "resolve"/"reject") |
|
239 |
+ */ |
|
240 |
+ function deferral_make<type_input, type_output>(handler: (input: type_input, convey: (output: type_output) => void) => void): type_deferral<type_input, type_output>; |
|
241 |
+ /** |
|
242 |
+ * @author fenris |
|
243 |
+ * @desc wraps a simple function into a deferral (similar to "Promise.resolve"/"Promise.reject") |
|
244 |
+ */ |
|
245 |
+ function deferral_wrap<type_input, type_output>(function_: (input: type_input) => type_output): type_deferral<type_input, type_output>; |
|
246 |
+ /** |
|
247 |
+ * @author fenris |
|
248 |
+ */ |
|
249 |
+ function deferral_id<type_value>(): type_deferral<type_value, type_value>; |
|
250 |
+ /** |
|
251 |
+ * @author fenris |
|
252 |
+ */ |
|
253 |
+ function deferral_const<type_value>(value: type_value): type_deferral<type_value, type_value>; |
|
254 |
+ /** |
|
255 |
+ * @author fenris |
|
256 |
+ */ |
|
257 |
+ function deferral_delay<type_output>(output: type_output, delay: int): type_deferral<any, type_output>; |
|
258 |
+ /** |
|
259 |
+ * @author fenris |
|
260 |
+ * @desc connects two deferrals to form a new one; the output of the first is taken as input for the second |
|
261 |
+ * (similar to "Promise.then" when passing a function which returns a new promise) |
|
262 |
+ * @param {type_deferral<type_value1>} first a simple deferral |
|
263 |
+ * @param {(value1 : type_value1)=>type_deferral<type_value2>} second a function depending from a value returning a deferral |
|
264 |
+ */ |
|
265 |
+ function deferral_compose_serial<type_input, type_between, type_output>(first: type_deferral<type_input, type_between>, second: type_deferral<type_between, type_output>): type_deferral<type_input, type_output>; |
|
266 |
+ /** |
|
267 |
+ * @author fenris |
|
268 |
+ */ |
|
269 |
+ function deferral_compose_parallel<type_input, type_output_left, type_output_right>({ "left": deferral_left, "right": deferral_right, }: { |
|
270 |
+ left: type_deferral<type_input, type_output_left>; |
|
271 |
+ right: type_deferral<type_input, type_output_right>; |
|
272 |
+ }): type_deferral<type_input, { |
|
273 |
+ left: type_output_left; |
|
274 |
+ right: type_output_right; |
|
275 |
+ }>; |
|
276 |
+ /** |
|
277 |
+ * @author fenris |
|
278 |
+ * @desc repeatedly applied serial composition |
|
279 |
+ */ |
|
280 |
+ function deferral_chain<type_value>(members: Array<type_deferral<type_value, type_value>>): type_deferral<type_value, type_value>; |
|
281 |
+ /** |
|
282 |
+ * @author fenris |
|
283 |
+ */ |
|
284 |
+} |
|
285 |
+declare module lib_call { |
|
286 |
+ /** |
|
287 |
+ * @author fenris |
|
288 |
+ */ |
|
289 |
+ class class_deferral<type_input, type_output> { |
|
290 |
+ /** |
|
291 |
+ * @author fenris |
|
292 |
+ */ |
|
293 |
+ private subject; |
|
294 |
+ /** |
|
295 |
+ * @author fenris |
|
296 |
+ */ |
|
297 |
+ private constructor(); |
|
298 |
+ /** |
|
299 |
+ * @author fenris |
|
300 |
+ */ |
|
301 |
+ private static _cram; |
|
302 |
+ /** |
|
303 |
+ * @author fenris |
|
304 |
+ */ |
|
305 |
+ private static _tear; |
|
306 |
+ /** |
|
307 |
+ * @author fenris |
|
308 |
+ */ |
|
309 |
+ static make<type_input, type_output>(handler: (input: type_input, convey: (value: type_output) => void) => void): class_deferral<type_input, type_output>; |
|
310 |
+ /** |
|
311 |
+ * @author fenris |
|
312 |
+ */ |
|
313 |
+ use(input: type_input, procedure: (value: type_output) => void): void; |
|
314 |
+ /** |
|
315 |
+ * @author fenris |
|
316 |
+ */ |
|
317 |
+ compose_serial<type_output_>(second: class_deferral<type_output, type_output_>): class_deferral<type_input, type_output_>; |
|
318 |
+ /** |
|
319 |
+ * @author fenris |
|
320 |
+ */ |
|
321 |
+ static chain<type_value>(members: Array<class_deferral<type_value, type_value>>): class_deferral<type_value, type_value>; |
|
322 |
+ /** |
|
323 |
+ * @author fenris |
|
324 |
+ */ |
|
325 |
+ static wrap<type_input, type_output>(function_: (input: type_input) => type_output): class_deferral<type_input, type_output>; |
|
326 |
+ /** |
|
327 |
+ * @author fenris |
|
328 |
+ */ |
|
329 |
+ static const_<type_value>(value: type_value): class_deferral<type_value, type_value>; |
|
330 |
+ /** |
|
331 |
+ * @author fenris |
|
332 |
+ */ |
|
333 |
+ static delay<type_output>(output: type_output, delay: int): class_deferral<any, type_output>; |
|
334 |
+ } |
|
335 |
+} |
|
336 |
+declare module lib_call { |
|
337 |
+ /** |
|
338 |
+ * @author fenris |
|
339 |
+ */ |
|
340 |
+ function timeout(function_: () => void, delay: int): int; |
|
341 |
+ /** |
|
342 |
+ * @desc a definition for a value being "defined" |
|
343 |
+ * @author neuc |
|
344 |
+ */ |
|
345 |
+ function is_def<type_value>(obj: type_value, null_is_valid?: boolean): boolean; |
|
346 |
+ /** |
|
347 |
+ * @desc returns the value if set and, when a type is specified, if the type is correct, if not return default_value |
|
348 |
+ * @author neuc |
|
349 |
+ */ |
|
350 |
+ function def_val(value: any, default_value: any, type?: string, null_is_valid?: boolean): any; |
|
351 |
+ /** |
|
352 |
+ * @desc just the empty function; useful for some callbacks etc. |
|
353 |
+ * @author fenris |
|
354 |
+ */ |
|
355 |
+ function nothing(): void; |
|
356 |
+ /** |
|
357 |
+ * @desc outputs |
|
358 |
+ * @author fenris |
|
359 |
+ */ |
|
360 |
+ function output(...args: Array<any>): void; |
|
361 |
+ /** |
|
362 |
+ * @desc converts the "arguments"-map into an array |
|
363 |
+ * @param {Object} args |
|
364 |
+ * @author fenris |
|
365 |
+ */ |
|
366 |
+ function args2list(args: any): Array<any>; |
|
367 |
+ /** |
|
368 |
+ * @desc provides the call for an attribute of a class as a regular function |
|
369 |
+ * @param {string} name the name of the attribute |
|
370 |
+ * @return {*} |
|
371 |
+ * @author fenris |
|
372 |
+ */ |
|
373 |
+ function attribute<type_object, type_attribute>(name: string): (object: type_object) => type_attribute; |
|
374 |
+ /** |
|
375 |
+ * @desc provides a method of a class as a regular function |
|
376 |
+ * @param {string} name the name of the method |
|
377 |
+ * @return {function} |
|
378 |
+ * @author fenris |
|
379 |
+ */ |
|
380 |
+ function method<type_object, type_output>(name: string): (object: type_object) => type_output; |
|
381 |
+ /** |
|
382 |
+ * @author fenris |
|
383 |
+ */ |
|
384 |
+ type type_unival = { |
|
385 |
+ kind: string; |
|
386 |
+ data?: any; |
|
387 |
+ }; |
|
388 |
+ /** |
|
389 |
+ * @author fenris |
|
390 |
+ */ |
|
391 |
+ function distinguish(unival: type_unival, handlers: { |
|
392 |
+ [kind: string]: (data?: any) => any; |
|
393 |
+ }, fallback?: (unival?: type_unival) => any): any; |
|
394 |
+} |
... | ... |
@@ -0,0 +1,992 @@ |
1 |
+/* |
|
2 |
+This file is part of »bacterio-plankton:call«. |
|
3 |
+ |
|
4 |
+Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
5 |
+<info@greenscale.de> |
|
6 |
+ |
|
7 |
+»bacterio-plankton:call« is free software: you can redistribute it and/or modify |
|
8 |
+it under the terms of the GNU Lesser General Public License as published by |
|
9 |
+the Free Software Foundation, either version 3 of the License, or |
|
10 |
+(at your option) any later version. |
|
11 |
+ |
|
12 |
+»bacterio-plankton:call« is distributed in the hope that it will be useful, |
|
13 |
+but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
14 |
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
15 |
+GNU Lesser General Public License for more details. |
|
16 |
+ |
|
17 |
+You should have received a copy of the GNU Lesser General Public License |
|
18 |
+along with »bacterio-plankton:call«. If not, see <http://www.gnu.org/licenses/>. |
|
19 |
+ */ |
|
20 |
+"use strict"; |
|
21 |
+/* |
|
22 |
+This file is part of »bacterio-plankton:call«. |
|
23 |
+ |
|
24 |
+Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
25 |
+<info@greenscale.de> |
|
26 |
+ |
|
27 |
+»bacterio-plankton:call« is free software: you can redistribute it and/or modify |
|
28 |
+it under the terms of the GNU Lesser General Public License as published by |
|
29 |
+the Free Software Foundation, either version 3 of the License, or |
|
30 |
+(at your option) any later version. |
|
31 |
+ |
|
32 |
+»bacterio-plankton:call« is distributed in the hope that it will be useful, |
|
33 |
+but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
34 |
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
35 |
+GNU Lesser General Public License for more details. |
|
36 |
+ |
|
37 |
+You should have received a copy of the GNU Lesser General Public License |
|
38 |
+along with »bacterio-plankton:call«. If not, see <http://www.gnu.org/licenses/>. |
|
39 |
+ */ |
|
40 |
+var lib_call; |
|
41 |
+(function (lib_call) { |
|
42 |
+ /** |
|
43 |
+ * @desc hacked class for postfix function application |
|
44 |
+ * @author fenris |
|
45 |
+ */ |
|
46 |
+ class class_valuewrapper { |
|
47 |
+ /** |
|
48 |
+ * @desc [constructor] |
|
49 |
+ * @author fenris |
|
50 |
+ */ |
|
51 |
+ constructor(value) { |
|
52 |
+ this.value = value; |
|
53 |
+ } |
|
54 |
+ /** |
|
55 |
+ * @desc [accessor] applies a function and returns a new valuewrapper |
|
56 |
+ * @author fenris |
|
57 |
+ */ |
|
58 |
+ pass(function_) { |
|
59 |
+ return (new class_valuewrapper(function_(this.value))); |
|
60 |
+ } |
|
61 |
+ /** |
|
62 |
+ * @desc [accessor] gives the wrapped value |
|
63 |
+ * @author fenris |
|
64 |
+ */ |
|
65 |
+ extract() { |
|
66 |
+ return this.value; |
|
67 |
+ } |
|
68 |
+ } |
|
69 |
+ lib_call.class_valuewrapper = class_valuewrapper; |
|
70 |
+ /** |
|
71 |
+ * @desc shortcut for constructing a valuewrapper-object |
|
72 |
+ * @author fenris |
|
73 |
+ */ |
|
74 |
+ function vw(value) { |
|
75 |
+ return (new class_valuewrapper(value)); |
|
76 |
+ } |
|
77 |
+ lib_call.vw = vw; |
|
78 |
+ /** |
|
79 |
+ * @author fenris |
|
80 |
+ */ |
|
81 |
+ function use(input, function_) { |
|
82 |
+ return function_(input); |
|
83 |
+ } |
|
84 |
+ lib_call.use = use; |
|
85 |
+ /** |
|
86 |
+ * @desc just the identity; useful for some callbacks etc. |
|
87 |
+ * @author fenris |
|
88 |
+ */ |
|
89 |
+ function id(x) { |
|
90 |
+ return x; |
|
91 |
+ } |
|
92 |
+ lib_call.id = id; |
|
93 |
+ /** |
|
94 |
+ * @desc composes two functions (i.e. returns a function that return the result of the successive execution of both input-functions) |
|
95 |
+ * @param {function} function_f |
|
96 |
+ * @param {function} function_g |
|
97 |
+ * @author fenris |
|
98 |
+ */ |
|
99 |
+ function compose(function_f, function_g) { |
|
100 |
+ return (function (x) { |
|
101 |
+ // return function_g(function_f(x)); |
|
102 |
+ return function_g(function_f.apply(function_f, lib_call.args2list(arguments))); |
|
103 |
+ }); |
|
104 |
+ } |
|
105 |
+ lib_call.compose = compose; |
|
106 |
+ /** |
|
107 |
+ * @desc transforms a function with sequential input into a function with leveled input; example: add(2,3) = curryfy(add)(2)(3) |
|
108 |
+ * @param {function} f |
|
109 |
+ * @param {int} n (don't set manually) |
|
110 |
+ * @return {function} the currified version of the in put function |
|
111 |
+ * @author fenris |
|
112 |
+ */ |
|
113 |
+ function curryfy(f, n = f.length) { |
|
114 |
+ switch (n) { |
|
115 |
+ case 0: { |
|
116 |
+ throw (new Error("[curryfy] impossible")); |
|
117 |
+ // break; |
|
118 |
+ } |
|
119 |
+ case 1: { |
|
120 |
+ return f; |
|
121 |
+ // break; |
|
122 |
+ } |
|
123 |
+ default: { |
|
124 |
+ return (function (x) { |
|
125 |
+ return (curryfy(function () { return f.apply(f, [x].concat(lib_call.args2list(arguments))); }, n - 1)); |
|
126 |
+ }); |
|
127 |
+ // break; |
|
128 |
+ } |
|
129 |
+ } |
|
130 |
+ } |
|
131 |
+ lib_call.curryfy = curryfy; |
|
132 |
+})(lib_call || (lib_call = {})); |
|
133 |
+var lib_call; |
|
134 |
+(function (lib_call) { |
|
135 |
+ /** |
|
136 |
+ * @author fenris |
|
137 |
+ */ |
|
138 |
+ function executor_resolve(result) { |
|
139 |
+ return ((resolve, reject) => resolve(result)); |
|
140 |
+ } |
|
141 |
+ lib_call.executor_resolve = executor_resolve; |
|
142 |
+ /** |
|
143 |
+ * @author fenris |
|
144 |
+ */ |
|
145 |
+ function executor_reject(reason) { |
|
146 |
+ return ((resolve, reject) => reject(reason)); |
|
147 |
+ } |
|
148 |
+ lib_call.executor_reject = executor_reject; |
|
149 |
+ /** |
|
150 |
+ * @author fenris |
|
151 |
+ */ |
|
152 |
+ function executor_transform(executor, transform_result, transform_reason) { |
|
153 |
+ return ((resolve, reject) => { |
|
154 |
+ executor(result => resolve(transform_result(result)), reason => reject(transform_reason(reason))); |
|
155 |
+ }); |
|
156 |
+ } |
|
157 |
+ lib_call.executor_transform = executor_transform; |
|
158 |
+ /** |
|
159 |
+ * @author fenris |
|
160 |
+ */ |
|
161 |
+ function executor_transform_default(executor, transform_result, wrap_string = null) { |
|
162 |
+ let transform_reason = (error => ((wrap_string == null) ? error : new class_error(wrap_string, [error]))); |
|
163 |
+ return (executor_transform(executor, transform_result, transform_reason)); |
|
164 |
+ } |
|
165 |
+ lib_call.executor_transform_default = executor_transform_default; |
|
166 |
+ /** |
|
167 |
+ * @author fenris |
|
168 |
+ */ |
|
169 |
+ function executor_compose_sequential(first, second) { |
|
170 |
+ return ((resolve, reject) => { |
|
171 |
+ first(result => { |
|
172 |
+ second(result)(resolve, reject); |
|
173 |
+ }, reason => { |
|
174 |
+ reject(reason); |
|
175 |
+ }); |
|
176 |
+ }); |
|
177 |
+ } |
|
178 |
+ lib_call.executor_compose_sequential = executor_compose_sequential; |
|
179 |
+ /** |
|
180 |
+ * @author fenris |
|
181 |
+ */ |
|
182 |
+ function executor_chain(state, executors) { |
|
183 |
+ return ((resolve, reject) => { |
|
184 |
+ if (executors.length == 0) { |
|
185 |
+ return resolve(state); |
|
186 |
+ } |
|
187 |
+ else { |
|
188 |
+ return executors[0](state)(result => { |
|
189 |
+ executor_chain(result, executors.slice(1))(resolve, reject); |
|
190 |
+ }, reject); |
|
191 |
+ } |
|
192 |
+ }); |
|
193 |
+ /* |
|
194 |
+ */ |
|
195 |
+ /* |
|
196 |
+ if (executors.length == 0) { |
|
197 |
+ return executor_resolve<type_state, type_error>(state); |
|
198 |
+ } |
|
199 |
+ else if (executors.length == 1) { |
|
200 |
+ return executors[0](state); |
|
201 |
+ } |
|
202 |
+ else { |
|
203 |
+ return ( |
|
204 |
+ executor_chain<type_state, type_error>( |
|
205 |
+ state, |
|
206 |
+ [ |
|
207 |
+ state => (resolve, reject) => executors[0](state)(result => executors[1](result)(resolve, reject), reject) |
|
208 |
+ ].concat(executors.slice(2)) |
|
209 |
+ ) |
|
210 |
+ ); |
|
211 |
+ } |
|
212 |
+ */ |
|
213 |
+ /* |
|
214 |
+ return ( |
|
215 |
+ executors.reduce( |
|
216 |
+ (chain, current) => executor_compose_sequential<type_state, type_state, type_error>(chain, current, deferred), |
|
217 |
+ executor_resolve<type_state, type_error>(state) |
|
218 |
+ ) |
|
219 |
+ ); |
|
220 |
+ */ |
|
221 |
+ } |
|
222 |
+ lib_call.executor_chain = executor_chain; |
|
223 |
+ /** |
|
224 |
+ * @author fenris |
|
225 |
+ */ |
|
226 |
+ function executor_first(executors) { |
|
227 |
+ /* |
|
228 |
+ return ( |
|
229 |
+ (resolve, reject) => { |
|
230 |
+ if (executors.length == 0) { |
|
231 |
+ reject(new Error("all failed")); |
|
232 |
+ } |
|
233 |
+ else { |
|
234 |
+ executors[0]( |
|
235 |
+ result => { |
|
236 |
+ resolve(result); |
|
237 |
+ }, |
|
238 |
+ reason => { |
|
239 |
+ executor_first<type_result, type_reason>(executors.slice(1))(resolve, reject); |
|
240 |
+ } |
|
241 |
+ ) |
|
242 |
+ } |
|
243 |
+ } |
|
244 |
+ ); |
|
245 |
+ */ |
|
246 |
+ return ((resolve, reject) => { |
|
247 |
+ executor_chain([], executors.map(executor => reasons => (resolve_, reject_) => { |
|
248 |
+ executor(result => reject_(result), reason => resolve_(reasons.concat([reason]))); |
|
249 |
+ }))(errors => reject(errors), result => resolve(result)); |
|
250 |
+ }); |
|
251 |
+ } |
|
252 |
+ lib_call.executor_first = executor_first; |
|
253 |
+ /** |
|
254 |
+ * @author fenris |
|
255 |
+ */ |
|
256 |
+ function executor_condense(executors) { |
|
257 |
+ return (executor_chain([], executors.map(executor => result => (resolve, reject) => { |
|
258 |
+ executor(element => resolve(result.concat([element])), reject); |
|
259 |
+ }))); |
|
260 |
+ } |
|
261 |
+ lib_call.executor_condense = executor_condense; |
|
262 |
+ /** |
|
263 |
+ * @author fenris |
|
264 |
+ * @deprecated use condense |
|
265 |
+ */ |
|
266 |
+ function executor_filter(executors, predicate) { |
|
267 |
+ return (executor_chain([], executors.map(executor => result => (resolve, reject) => { |
|
268 |
+ executor(element => resolve(predicate(element) ? result.concat([element]) : result), reject); |
|
269 |
+ }))); |
|
270 |
+ } |
|
271 |
+ lib_call.executor_filter = executor_filter; |
|
272 |
+ /** |
|
273 |
+ * @author fenris |
|
274 |
+ * @deprecated use condense |
|
275 |
+ */ |
|
276 |
+ function executor_map(executors, transformator) { |
|
277 |
+ return (executor_chain([], executors.map(executor => result => (resolve, reject) => { |
|
278 |
+ executor(element1 => resolve(result.concat([transformator(element1)])), reject); |
|
279 |
+ }))); |
|
280 |
+ } |
|
281 |
+ lib_call.executor_map = executor_map; |
|
282 |
+ /** |
|
283 |
+ * @author fenris |
|
284 |
+ * @deprecated use condense |
|
285 |
+ */ |
|
286 |
+ function executor_reduce(executors, initial, accumulator) { |
|
287 |
+ return (executor_chain(initial, executors.map(executor => result => (resolve, reject) => { |
|
288 |
+ executor(element => resolve(accumulator(result, element)), reject); |
|
289 |
+ }))); |
|
290 |
+ } |
|
291 |
+ lib_call.executor_reduce = executor_reduce; |
|
292 |
+})(lib_call || (lib_call = {})); |
|
293 |
+/* |
|
294 |
+This file is part of »bacterio-plankton:call«. |
|
295 |
+ |
|
296 |
+Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
297 |
+<info@greenscale.de> |
|
298 |
+ |
|
299 |
+»bacterio-plankton:call« is free software: you can redistribute it and/or modify |
|
300 |
+it under the terms of the GNU Lesser General Public License as published by |
|
301 |
+the Free Software Foundation, either version 3 of the License, or |
|
302 |
+(at your option) any later version. |
|
303 |
+ |
|
304 |
+»bacterio-plankton:call« is distributed in the hope that it will be useful, |
|
305 |
+but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
306 |
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
307 |
+GNU Lesser General Public License for more details. |
|
308 |
+ |
|
309 |
+You should have received a copy of the GNU Lesser General Public License |
|
310 |
+along with »bacterio-plankton:call«. If not, see <http://www.gnu.org/licenses/>. |
|
311 |
+ */ |
|
312 |
+var lib_call; |
|
313 |
+(function (lib_call) { |
|
314 |
+ /** |
|
315 |
+ * @author fenris |
|
316 |
+ */ |
|
317 |
+ function promise_reject(reason) { |
|
318 |
+ return Promise.reject(reason); |
|
319 |
+ } |
|
320 |
+ lib_call.promise_reject = promise_reject; |
|
321 |
+ /** |
|
322 |
+ * @author fenris |
|
323 |
+ */ |
|
324 |
+ function promise_resolve(result) { |
|
325 |
+ return Promise.resolve(result); |
|
326 |
+ } |
|
327 |
+ lib_call.promise_resolve = promise_resolve; |
|
328 |
+ /** |
|
329 |
+ * @author fenris |
|
330 |
+ */ |
|
331 |
+ function promise_make(executor) { |
|
332 |
+ return (new Promise(executor)); |
|
333 |
+ } |
|
334 |
+ lib_call.promise_make = promise_make; |
|
335 |
+ /** |
|
336 |
+ * @author fenris |
|
337 |
+ */ |
|
338 |
+ function promise_then_close(promise, resolver, rejector) { |
|
339 |
+ promise.then(resolver, rejector); |
|
340 |
+ } |
|
341 |
+ lib_call.promise_then_close = promise_then_close; |
|
342 |
+ /** |
|
343 |
+ * @author fenris |
|
344 |
+ */ |
|
345 |
+ function promise_then_append(promise, resolver, rejector = null) { |
|
346 |
+ if (rejector == null) { |
|
347 |
+ rejector = (reason) => promise_reject(reason); |
|
348 |
+ } |
|
349 |
+ return (promise.then(resolver, rejector)); |
|
350 |
+ } |
|
351 |
+ lib_call.promise_then_append = promise_then_append; |
|
352 |
+ /** |
|
353 |
+ * @author fenris |
|
354 |
+ */ |
|
355 |
+ function promise_all(promises) { |
|
356 |
+ return Promise.all(promises); |
|
357 |
+ } |
|
358 |
+ lib_call.promise_all = promise_all; |
|
359 |
+ /** |
|
360 |
+ * @author fenris |
|
361 |
+ */ |
|
362 |
+ function promise_chain(promises, start = undefined) { |
|
363 |
+ return (promises.reduce((chain, promise) => promise_then_append(chain, promise), promise_resolve(start))); |
|
364 |
+ } |
|
365 |
+ lib_call.promise_chain = promise_chain; |
|
366 |
+ /** |
|
367 |
+ * @author fenris |
|
368 |
+ */ |
|
369 |
+ function promise_condense(promises) { |
|
370 |
+ return (promise_chain(promises.map(promise => result => promise_then_append(promise(), element => promise_resolve(result.concat([element])))), [])); |
|
371 |
+ } |
|
372 |
+ lib_call.promise_condense = promise_condense; |
|
373 |
+ /** |
|
374 |
+ * @author fenris |
|
375 |
+ */ |
|
376 |
+ function promise_group(promises, serial = false) { |
|
377 |
+ const decorate = function (promise, name) { |
|
378 |
+ return (() => promise_then_append(promise(), value => promise_resolve({ "key": name, "value": value }))); |
|
379 |
+ }; |
|
380 |
+ const convert = function (array) { |
|
381 |
+ let object = {}; |
|
382 |
+ array.forEach(({ "key": key, "value": value }) => { object[key] = value; }); |
|
383 |
+ return object; |
|
384 |
+ }; |
|
385 |
+ if (serial) { |
|
386 |
+ return (promise_then_append(promise_condense(Object.keys(promises) |
|
387 |
+ .map(name => decorate(promises[name], name))), list => promise_resolve(convert(list)))); |
|
388 |
+ } |
|
389 |
+ else { |
|
390 |
+ return (promise_then_append(promise_all(Object.keys(promises) |
|
391 |
+ .map(name => decorate(promises[name], name)) |
|
392 |
+ .map(promise => promise())), list => promise_resolve(convert(list)))); |
|
393 |
+ } |
|
394 |
+ } |
|
395 |
+ lib_call.promise_group = promise_group; |
|
396 |
+ /** |
|
397 |
+ * @author fenris |
|
398 |
+ */ |
|
399 |
+ function promise_wrap(promise, transformator_result, transformator_reason = lib_call.id) { |
|
400 |
+ return (promise_make((resolve, reject) => { |
|
401 |
+ promise_then_close(promise, result => resolve(transformator_result(result)), reason => reject(transformator_reason(reason))); |
|
402 |
+ })); |
|
403 |
+ } |
|
404 |
+ lib_call.promise_wrap = promise_wrap; |
|
405 |
+ /** |
|
406 |
+ * @author fenris |
|
407 |
+ */ |
|
408 |
+ function promise_show(label) { |
|
409 |
+ return (result => promise_make((resolve, reject) => { |
|
410 |
+ lib_log.info(label + ": " + instance_show(result)); |
|
411 |
+ resolve(result); |
|
412 |
+ })); |
|
413 |
+ } |
|
414 |
+ lib_call.promise_show = promise_show; |
|
415 |
+ /** |
|
416 |
+ * @author fenris |
|
417 |
+ */ |
|
418 |
+ function promise_log(result) { |
|
419 |
+ return promise_show("log"); |
|
420 |
+ } |
|
421 |
+ lib_call.promise_log = promise_log; |
|
422 |
+ /** |
|
423 |
+ * @author fenris |
|
424 |
+ */ |
|
425 |
+ function promise_attach(state, promise, name) { |
|
426 |
+ return (promise_wrap(promise, result => { |
|
427 |
+ state[name] = result; |
|
428 |
+ return state; |
|
429 |
+ })); |
|
430 |
+ } |
|
431 |
+ lib_call.promise_attach = promise_attach; |
|
432 |
+ /** |
|
433 |
+ * @author fenris |
|
434 |
+ */ |
|
435 |
+ function promise_delay(promise, delay) { |
|
436 |
+ return promise_make((resolve, reject) => { |
|
437 |
+ lib_call.timeout(() => { |
|
438 |
+ promise_then_close(promise, resolve, reject); |
|
439 |
+ return null; |
|
440 |
+ }, delay); |
|
441 |
+ }); |
|
442 |
+ } |
|
443 |
+ lib_call.promise_delay = promise_delay; |
|
444 |
+ /** |
|
445 |
+ * @author fenris |
|
446 |
+ */ |
|
447 |
+ function promise_to_executor(promise) { |
|
448 |
+ return ((resolve, reject) => promise.then(resolve, reject)); |
|
449 |
+ } |
|
450 |
+ lib_call.promise_to_executor = promise_to_executor; |
|
451 |
+})(lib_call || (lib_call = {})); |
|
452 |
+/* |
|
453 |
+This file is part of »bacterio-plankton:call«. |
|
454 |
+ |
|
455 |
+Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
456 |
+<info@greenscale.de> |
|
457 |
+ |
|
458 |
+»bacterio-plankton:call« is free software: you can redistribute it and/or modify |
|
459 |
+it under the terms of the GNU Lesser General Public License as published by |
|
460 |
+the Free Software Foundation, either version 3 of the License, or |
|
461 |
+(at your option) any later version. |
|
462 |
+ |
|
463 |
+»bacterio-plankton:call« is distributed in the hope that it will be useful, |
|
464 |
+but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
465 |
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
466 |
+GNU Lesser General Public License for more details. |
|
467 |
+ |
|
468 |
+You should have received a copy of the GNU Lesser General Public License |
|
469 |
+along with »bacterio-plankton:call«. If not, see <http://www.gnu.org/licenses/>. |
|
470 |
+ */ |
|
471 |
+var lib_call; |
|
472 |
+(function (lib_call) { |
|
473 |
+ lib_call.initializer_state_initial = 0; |
|
474 |
+ lib_call.initializer_state_waiting = 1; |
|
475 |
+ lib_call.initializer_state_successful = 2; |
|
476 |
+ lib_call.initializer_state_failed = 3; |
|
477 |
+ /** |
|
478 |
+ * @author fenris |
|
479 |
+ */ |
|
480 |
+ function initializer_make(fetcher) { |
|
481 |
+ let subject = { |
|
482 |
+ "fetcher": fetcher, |
|
483 |
+ "state": lib_call.initializer_state_initial, |
|
484 |
+ "queue": [], |
|
485 |
+ "result": undefined, |
|
486 |
+ "reason": undefined, |
|
487 |
+ }; |
|
488 |
+ return subject; |
|
489 |
+ } |
|
490 |
+ lib_call.initializer_make = initializer_make; |
|
491 |
+ /** |
|
492 |
+ * @author fenris |
|
493 |
+ */ |
|
494 |
+ function initializer_actuate(subject) { |
|
495 |
+ switch (subject.state) { |
|
496 |
+ case lib_call.initializer_state_successful: { |
|
497 |
+ subject.queue.forEach(entry => entry.resolve(subject.result)); |
|
498 |
+ break; |
|
499 |
+ } |
|
500 |
+ case lib_call.initializer_state_failed: { |
|
501 |
+ subject.queue.forEach(entry => entry.reject(subject.reason)); |
|
502 |
+ break; |
|
503 |
+ } |
|
504 |
+ default: { |
|
505 |
+ let message = `unhandled state ${subject.state}`; |
|
506 |
+ throw (new Error(message)); |
|
507 |
+ break; |
|
508 |
+ } |
|
509 |
+ } |
|
510 |
+ } |
|
511 |
+ /** |
|
512 |
+ * @author fenris |
|
513 |
+ */ |
|
514 |
+ function initializer_reset(subject) { |
|
515 |
+ subject.state = lib_call.initializer_state_initial; |
|
516 |
+ subject.queue = []; |
|
517 |
+ } |
|
518 |
+ lib_call.initializer_reset = initializer_reset; |
|
519 |
+ /** |
|
520 |
+ * @author fenris |
|
521 |
+ */ |
|
522 |
+ function initializer_state(subject) { |
|
523 |
+ return subject.state; |
|
524 |
+ } |
|
525 |
+ lib_call.initializer_state = initializer_state; |
|
526 |
+ /** |
|
527 |
+ * @author fenris |
|
528 |
+ */ |
|
529 |
+ function initializer_get(subject) { |
|
530 |
+ switch (subject.state) { |
|
531 |
+ case lib_call.initializer_state_initial: { |
|
532 |
+ subject.state = lib_call.initializer_state_waiting; |
|
533 |
+ return (lib_call.promise_make((resolve, reject) => { |
|
534 |
+ subject.queue.push({ "resolve": resolve, "reject": reject }); |
|
535 |
+ subject.fetcher().then(result => { |
|
536 |
+ subject.state = lib_call.initializer_state_successful; |
|
537 |
+ subject.result = result; |
|
538 |
+ initializer_actuate(subject); |
|
539 |
+ }, reason => { |
|
540 |
+ subject.state = lib_call.initializer_state_failed; |
|
541 |
+ subject.reason = reason; |
|
542 |
+ initializer_actuate(subject); |
|
543 |
+ }); |
|
544 |
+ })); |
|
545 |
+ break; |
|
546 |
+ } |
|
547 |
+ case lib_call.initializer_state_waiting: { |
|
548 |
+ return (lib_call.promise_make((resolve, reject) => { |
|
549 |
+ subject.queue.push({ "resolve": resolve, "reject": reject }); |
|
550 |
+ })); |
|
551 |
+ break; |
|
552 |
+ } |
|
553 |
+ case lib_call.initializer_state_successful: { |
|
554 |
+ return (lib_call.promise_resolve(subject.result)); |
|
555 |
+ break; |
|
556 |
+ } |
|
557 |
+ case lib_call.initializer_state_failed: { |
|
558 |
+ return (lib_call.promise_reject(subject.reason)); |
|
559 |
+ break; |
|
560 |
+ } |
|
561 |
+ default: { |
|
562 |
+ let message = `unhandled state ${subject.state}`; |
|
563 |
+ throw (new Error(message)); |
|
564 |
+ break; |
|
565 |
+ } |
|
566 |
+ } |
|
567 |
+ } |
|
568 |
+ lib_call.initializer_get = initializer_get; |
|
569 |
+ /** |
|
570 |
+ * @author fenris |
|
571 |
+ */ |
|
572 |
+ function initializer_get_sync(subject) { |
|
573 |
+ switch (subject.state) { |
|
574 |
+ case lib_call.initializer_state_successful: { |
|
575 |
+ return subject.result; |
|
576 |
+ break; |
|
577 |
+ } |
|
578 |
+ case lib_call.initializer_state_failed: { |
|
579 |
+ throw subject.reason; |
|
580 |
+ break; |
|
581 |
+ } |
|
582 |
+ default: { |
|
583 |
+ let message = `unhandled state ${subject.state}`; |
|
584 |
+ throw (new Error(message)); |
|
585 |
+ break; |
|
586 |
+ } |
|
587 |
+ } |
|
588 |
+ } |
|
589 |
+ /** |
|
590 |
+ * @author fenris |
|
591 |
+ */ |
|
592 |
+ function initializer_set_sync(subject, result) { |
|
593 |
+ switch (subject.state) { |
|
594 |
+ case lib_call.initializer_state_successful: { |
|
595 |
+ subject.result = result; |
|
596 |
+ break; |
|
597 |
+ } |
|
598 |
+ case lib_call.initializer_state_failed: { |
|
599 |
+ subject.state = lib_call.initializer_state_successful; |
|
600 |
+ subject.result = result; |
|
601 |
+ break; |
|
602 |
+ } |
|
603 |
+ default: { |
|
604 |
+ let message = `unhandled state ${subject.state}`; |
|
605 |
+ throw (new Error(message)); |
|
606 |
+ break; |
|
607 |
+ } |
|
608 |
+ } |
|
609 |
+ } |
|
610 |
+})(lib_call || (lib_call = {})); |
|
611 |
+/* |
|
612 |
+This file is part of »bacterio-plankton:call«. |
|
613 |
+ |
|
614 |
+Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
615 |
+<info@greenscale.de> |
|
616 |
+ |
|
617 |
+»bacterio-plankton:call« is free software: you can redistribute it and/or modify |
|
618 |
+it under the terms of the GNU Lesser General Public License as published by |
|
619 |
+the Free Software Foundation, either version 3 of the License, or |
|
620 |
+(at your option) any later version. |
|
621 |
+ |
|
622 |
+»bacterio-plankton:call« is distributed in the hope that it will be useful, |
|
623 |
+but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
624 |
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
625 |
+GNU Lesser General Public License for more details. |
|
626 |
+ |
|
627 |
+You should have received a copy of the GNU Lesser General Public License |
|
628 |
+along with »bacterio-plankton:call«. If not, see <http://www.gnu.org/licenses/>. |
|
629 |
+ */ |
|
630 |
+var lib_call; |
|
631 |
+(function (lib_call) { |
|
632 |
+ /* |
|
633 |
+ The core idea of this library is to provide means for asynchronous program flow. The old-school way to do is, |
|
634 |
+ is to use callbacks. While this approach is simple and easy to understand, it has some disadvantages. As an |
|
635 |
+ attempt to relief and improve this, the promise-system was introduced. In principle it solves most of the |
|
636 |
+ problems found in the callback-approach; however it has some downsides as well: |
|
637 |
+ |
|
638 |
+ - Convolution of multiple principles |
|
639 |
+ Promises unite the ideas of asynchronous program flow and error handling. |
|
640 |
+ |
|
641 |
+ - Instant execution |
|
642 |
+ Creating a promise results in the instant execution of the given executor prodecure. While this might be |
|
643 |
+ convenient in some cases, it can be quite disturbing and counter-intuitive in others. |
|
644 |
+ |
|
645 |
+ - Broken typing |
|
646 |
+ The Promise system doesn't distinguish between an appending "then" (i.e. passing a function, which returns a |
|
647 |
+ new promise) and a closing "then" (i.e. passing a function, which has no return value). On top of that it |
|
648 |
+ allows returning simple values in an appending "then", which results in an implicit call of the executors |
|
649 |
+ "resolve"-function. The price for these "pragmatic" features is that the whole system can't be typed well. |
|
650 |
+ And even though JavaScript is not a strictly typed language, it was a quite questionable decision to design |
|
651 |
+ the promise system in a way, which breaks typing from the start. |
|
652 |
+ |
|
653 |
+ The deferral-system forseeks to solve these issues while retaining the advantages of the promise-system. |
|
654 |
+ */ |
|
655 |
+ /** |
|
656 |
+ * @author fenris |
|
657 |
+ * @desc activates the deferral and handles its output according to a given procedure |
|
658 |
+ * @param {(value : type_value)=>void} procedure a function which receives the output of the deferral as argument |
|
659 |
+ */ |
|
660 |
+ function deferral_use(deferral, input, procedure) { |
|
661 |
+ deferral.representation(input).then(value => { |
|
662 |
+ procedure(value); |
|
663 |
+ }, reason => { |
|
664 |
+ throw reason; |
|
665 |
+ }); |
|
666 |
+ } |
|
667 |
+ lib_call.deferral_use = deferral_use; |
|
668 |
+ /** |
|
669 |
+ * @author fenris |
|
670 |
+ * @desc creates a deferral-subject (similar to "new Promise", where "convey" reflects "resolve"/"reject") |
|
671 |
+ */ |
|
672 |
+ function deferral_make(handler) { |
|
673 |
+ return ({ |
|
674 |
+ "representation": ((input) => (new Promise((resolve, reject) => { |
|
675 |
+ handler(input, resolve); |
|
676 |
+ }))) |
|
677 |
+ }); |
|
678 |
+ } |
|
679 |
+ lib_call.deferral_make = deferral_make; |
|
680 |
+ /** |
|
681 |
+ * @author fenris |
|
682 |
+ * @desc wraps a simple function into a deferral (similar to "Promise.resolve"/"Promise.reject") |
|
683 |
+ */ |
|
684 |
+ function deferral_wrap(function_) { |
|
685 |
+ return (deferral_make((input, convey) => convey(function_(input)))); |
|
686 |
+ } |
|
687 |
+ lib_call.deferral_wrap = deferral_wrap; |
|
688 |
+ /** |
|
689 |
+ * @author fenris |
|
690 |
+ */ |
|
691 |
+ function deferral_id() { |
|
692 |
+ return (deferral_make((input, convey) => convey(input))); |
|
693 |
+ } |
|
694 |
+ lib_call.deferral_id = deferral_id; |
|
695 |
+ /** |
|
696 |
+ * @author fenris |
|
697 |
+ */ |
|
698 |
+ function deferral_const(value) { |
|
699 |
+ return (deferral_make((input, convey) => convey(value))); |
|
700 |
+ } |
|
701 |
+ lib_call.deferral_const = deferral_const; |
|
702 |
+ /** |
|
703 |
+ * @author fenris |
|
704 |
+ */ |
|
705 |
+ function deferral_delay(output, delay) { |
|
706 |
+ return (deferral_make((input, convey) => { |
|
707 |
+ setTimeout(() => convey(output), delay); |
|
708 |
+ })); |
|
709 |
+ } |
|
710 |
+ lib_call.deferral_delay = deferral_delay; |
|
711 |
+ /** |
|
712 |
+ * @author fenris |
|
713 |
+ * @desc connects two deferrals to form a new one; the output of the first is taken as input for the second |
|
714 |
+ * (similar to "Promise.then" when passing a function which returns a new promise) |
|
715 |
+ * @param {type_deferral<type_value1>} first a simple deferral |
|
716 |
+ * @param {(value1 : type_value1)=>type_deferral<type_value2>} second a function depending from a value returning a deferral |
|
717 |
+ */ |
|
718 |
+ function deferral_compose_serial(first, second) { |
|
719 |
+ return { |
|
720 |
+ "representation": ((input) => first.representation(input).then((between) => second.representation(between))) |
|
721 |
+ }; |
|
722 |
+ } |
|
723 |
+ lib_call.deferral_compose_serial = deferral_compose_serial; |
|
724 |
+ /** |
|
725 |
+ * @author fenris |
|
726 |
+ */ |
|
727 |
+ function deferral_compose_parallel({ "left": deferral_left, "right": deferral_right, }) { |
|
728 |
+ return (deferral_make((input, convey) => { |
|
729 |
+ let object = { |
|
730 |
+ "left": lib_maybe.make_nothing(), |
|
731 |
+ "right": lib_maybe.make_nothing(), |
|
732 |
+ }; |
|
733 |
+ let finish = function () { |
|
734 |
+ if (lib_maybe.is_just(object.left) |
|
735 |
+ && |
|
736 |
+ lib_maybe.is_just(object.right)) { |
|
737 |
+ let result = { |
|
738 |
+ "left": lib_maybe.cull(object.left), |
|
739 |
+ "right": lib_maybe.cull(object.right), |
|
740 |
+ }; |
|
741 |
+ convey(result); |
|
742 |
+ } |
|
743 |
+ else { |
|
744 |
+ // do nothing |
|
745 |
+ } |
|
746 |
+ }; |
|
747 |
+ deferral_use(deferral_left, input, output_left => { |
|
748 |
+ object.left = lib_maybe.make_just(output_left); |
|
749 |
+ finish(); |
|
750 |
+ }); |
|
751 |
+ deferral_use(deferral_right, input, output_right => { |
|
752 |
+ object.right = lib_maybe.make_just(output_right); |
|
753 |
+ finish(); |
|
754 |
+ }); |
|
755 |
+ })); |
|
756 |
+ } |
|
757 |
+ lib_call.deferral_compose_parallel = deferral_compose_parallel; |
|
758 |
+ /** |
|
759 |
+ * @author fenris |
|
760 |
+ * @desc repeatedly applied serial composition |
|
761 |
+ */ |
|
762 |
+ function deferral_chain(members) { |
|
763 |
+ return (members.reduce( |
|
764 |
+ // (result, current) => deferral_compose_serial<type_value, type_value, type_value>(result, current), |
|
765 |
+ deferral_compose_serial, deferral_id())); |
|
766 |
+ } |
|
767 |
+ lib_call.deferral_chain = deferral_chain; |
|
768 |
+ /** |
|
769 |
+ * @author fenris |
|
770 |
+ */ |
|
771 |
+ /* |
|
772 |
+ export function deferral_bunch<type_input, type_output>( |
|
773 |
+ members : {[name : string] : type_deferral<type_input, type_output>} |
|
774 |
+ ) : type_deferral<type_input, {[name : string] : type_output}> { |
|
775 |
+ |
|
776 |
+ } |
|
777 |
+ */ |
|
778 |
+})(lib_call || (lib_call = {})); |
|
779 |
+/* |
|
780 |
+This file is part of »bacterio-plankton:call«. |
|
781 |
+ |
|
782 |
+Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
783 |
+<info@greenscale.de> |
|
784 |
+ |
|
785 |
+»bacterio-plankton:call« is free software: you can redistribute it and/or modify |
|
786 |
+it under the terms of the GNU Lesser General Public License as published by |
|
787 |
+the Free Software Foundation, either version 3 of the License, or |
|
788 |
+(at your option) any later version. |
|
789 |
+ |
|
790 |
+»bacterio-plankton:call« is distributed in the hope that it will be useful, |
|
791 |
+but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
792 |
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
793 |
+GNU Lesser General Public License for more details. |
|
794 |
+ |
|
795 |
+You should have received a copy of the GNU Lesser General Public License |
|
796 |
+along with »bacterio-plankton:call«. If not, see <http://www.gnu.org/licenses/>. |
|
797 |
+ */ |
|
798 |
+var lib_call; |
|
799 |
+(function (lib_call) { |
|
800 |
+ /** |
|
801 |
+ * @author fenris |
|
802 |
+ */ |
|
803 |
+ class class_deferral { |
|
804 |
+ /** |
|
805 |
+ * @author fenris |
|
806 |
+ */ |
|
807 |
+ constructor(subject) { |
|
808 |
+ this.subject = subject; |
|
809 |
+ } |
|
810 |
+ /** |
|
811 |
+ * @author fenris |
|
812 |
+ */ |
|
813 |
+ static _cram(subject) { |
|
814 |
+ return (new class_deferral(subject)); |
|
815 |
+ } |
|
816 |
+ /** |
|
817 |
+ * @author fenris |
|
818 |
+ */ |
|
819 |
+ static _tear(instance) { |
|
820 |
+ return instance.subject; |
|
821 |
+ } |
|
822 |
+ /** |
|
823 |
+ * @author fenris |
|
824 |
+ */ |
|
825 |
+ static make(handler) { |
|
826 |
+ return (class_deferral._cram(lib_call.deferral_make(handler))); |
|
827 |
+ } |
|
828 |
+ /** |
|
829 |
+ * @author fenris |
|
830 |
+ */ |
|
831 |
+ use(input, procedure) { |
|
832 |
+ return (lib_call.deferral_use(class_deferral._tear(this), input, procedure)); |
|
833 |
+ } |
|
834 |
+ /** |
|
835 |
+ * @author fenris |
|
836 |
+ */ |
|
837 |
+ compose_serial(second) { |
|
838 |
+ return (class_deferral._cram(lib_call.deferral_compose_serial(class_deferral._tear(this), class_deferral._tear(second)))); |
|
839 |
+ } |
|
840 |
+ /** |
|
841 |
+ * @author fenris |
|
842 |
+ */ |
|
843 |
+ static chain(members) { |
|
844 |
+ return (class_deferral._cram(lib_call.deferral_chain(members.map(member => class_deferral._tear(member))))); |
|
845 |
+ } |
|
846 |
+ /** |
|
847 |
+ * @author fenris |
|
848 |
+ */ |
|
849 |
+ static wrap(function_) { |
|
850 |
+ return (class_deferral._cram(lib_call.deferral_wrap(function_))); |
|
851 |
+ } |
|
852 |
+ /** |
|
853 |
+ * @author fenris |
|
854 |
+ */ |
|
855 |
+ static const_(value) { |
|
856 |
+ return (class_deferral._cram(lib_call.deferral_const(value))); |
|
857 |
+ } |
|
858 |
+ /** |
|
859 |
+ * @author fenris |
|
860 |
+ */ |
|
861 |
+ static delay(output, delay) { |
|
862 |
+ return (class_deferral._cram(lib_call.deferral_delay(output, delay))); |
|
863 |
+ } |
|
864 |
+ } |
|
865 |
+ lib_call.class_deferral = class_deferral; |
|
866 |
+})(lib_call || (lib_call = {})); |
|
867 |
+/* |
|
868 |
+This file is part of »bacterio-plankton:call«. |
|
869 |
+ |
|
870 |
+Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
871 |
+<info@greenscale.de> |
|
872 |
+ |
|
873 |
+»bacterio-plankton:call« is free software: you can redistribute it and/or modify |
|
874 |
+it under the terms of the GNU Lesser General Public License as published by |
|
875 |
+the Free Software Foundation, either version 3 of the License, or |
|
876 |
+(at your option) any later version. |
|
877 |
+ |
|
878 |
+»bacterio-plankton:call« is distributed in the hope that it will be useful, |
|
879 |
+but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
880 |
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
881 |
+GNU Lesser General Public License for more details. |
|
882 |
+ |
|
883 |
+You should have received a copy of the GNU Lesser General Public License |
|
884 |
+along with »bacterio-plankton:call«. If not, see <http://www.gnu.org/licenses/>. |
|
885 |
+ */ |
|
886 |
+var lib_call; |
|
887 |
+(function (lib_call) { |
|
888 |
+ /** |
|
889 |
+ * @author fenris |
|
890 |
+ */ |
|
891 |
+ function timeout(function_, delay) { |
|
892 |
+ return ( |
|
893 |
+ /*window.*/ setTimeout(function_, delay)); |
|
894 |
+ } |
|
895 |
+ lib_call.timeout = timeout; |
|
896 |
+ /** |
|
897 |
+ * @desc a definition for a value being "defined" |
|
898 |
+ * @author neuc |
|
899 |
+ */ |
|
900 |
+ function is_def(obj, null_is_valid = false) { |
|
901 |
+ return (!((typeof (obj) === "undefined") |
|
902 |
+ || |
|
903 |
+ (!null_is_valid && (obj === null)))); |
|
904 |
+ } |
|
905 |
+ lib_call.is_def = is_def; |
|
906 |
+ /** |
|
907 |
+ * @desc returns the value if set and, when a type is specified, if the type is correct, if not return default_value |
|
908 |
+ * @author neuc |
|
909 |
+ */ |
|
910 |
+ function def_val(value, default_value, type = null, null_is_valid = false) { |
|
911 |
+ if (is_def(value, null_is_valid) |
|
912 |
+ && |
|
913 |
+ (is_def(type) |
|
914 |
+ ? ((typeof value === type) |
|
915 |
+ || |
|
916 |
+ ((value === null) |
|
917 |
+ && |
|
918 |
+ null_is_valid)) |
|
919 |
+ : true)) { |
|
920 |
+ return value; |
|
921 |
+ } |
|
922 |
+ else { |
|
923 |
+ return default_value; |
|
924 |
+ } |
|
925 |
+ } |
|
926 |
+ lib_call.def_val = def_val; |
|
927 |
+ ; |
|
928 |
+ /** |
|
929 |
+ * @desc just the empty function; useful for some callbacks etc. |
|
930 |
+ * @author fenris |
|
931 |
+ */ |
|
932 |
+ function nothing() { |
|
933 |
+ } |
|
934 |
+ lib_call.nothing = nothing; |
|
935 |
+ /** |
|
936 |
+ * @desc outputs |
|
937 |
+ * @author fenris |
|
938 |
+ */ |
|
939 |
+ function output(...args) { |
|
940 |
+ lib_log.info.apply(lib_log, args); |
|
941 |
+ } |
|
942 |
+ lib_call.output = output; |
|
943 |
+ /** |
|
944 |
+ * @desc converts the "arguments"-map into an array |
|
945 |
+ * @param {Object} args |
|
946 |
+ * @author fenris |
|
947 |
+ */ |
|
948 |
+ function args2list(args) { |
|
949 |
+ return Object.keys(args).map(key => args[key]); |
|
950 |
+ } |
|
951 |
+ lib_call.args2list = args2list; |
|
952 |
+ /** |
|
953 |
+ * @desc provides the call for an attribute of a class as a regular function |
|
954 |
+ * @param {string} name the name of the attribute |
|
955 |
+ * @return {*} |
|
956 |
+ * @author fenris |
|
957 |
+ */ |
|
958 |
+ function attribute(name) { |
|
959 |
+ return ((object) => object[name]); |
|
960 |
+ } |
|
961 |
+ lib_call.attribute = attribute; |
|
962 |
+ /** |
|
963 |
+ * @desc provides a method of a class as a regular function |
|
964 |
+ * @param {string} name the name of the method |
|
965 |
+ * @return {function} |
|
966 |
+ * @author fenris |
|
967 |
+ */ |
|
968 |
+ function method(name) { |
|
969 |
+ return (function (object) { return object[name].apply(object, args2list(arguments).slice(1)); }); |
|
970 |
+ } |
|
971 |
+ lib_call.method = method; |
|
972 |
+ /** |
|
973 |
+ * @author fenris |
|
974 |
+ */ |
|
975 |
+ function distinguish(unival, handlers, fallback = null) { |
|
976 |
+ if (unival.kind in handlers) { |
|
977 |
+ let handler = handlers[unival.kind]; |
|
978 |
+ return handler(unival.data); |
|
979 |
+ } |
|
980 |
+ else { |
|
981 |
+ let message = ("unhandled kind '" + unival.kind + "'"); |
|
982 |
+ if (fallback !== null) { |
|
983 |
+ console.warn(message); |
|
984 |
+ return fallback(unival); |
|
985 |
+ } |
|
986 |
+ else { |
|
987 |
+ throw (new Error(message)); |
|
988 |
+ } |
|
989 |
+ } |
|
990 |
+ } |
|
991 |
+ lib_call.distinguish = distinguish; |
|
992 |
+})(lib_call || (lib_call = {})); |
... | ... |
@@ -0,0 +1,861 @@ |
1 |
+Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
2 |
+<info@greenscale.de> |
|
3 |
+ |
|
4 |
+»bacterio-plankton:code« is free software: you can redistribute it and/or modify |
|
5 |
+it under the terms of the GNU Lesser General Public License as published by |
|
6 |
+the Free Software Foundation, either version 3 of the License, or |
|
7 |
+(at your option) any later version. |
|
8 |
+ |
|
9 |
+»bacterio-plankton:code« is distributed in the hope that it will be useful, |
|
10 |
+but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 |
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 |
+GNU Lesser General Public License for more details. |
|
13 |
+ |
|
14 |
+You should have received a copy of the GNU Lesser General Public License |
|
15 |
+along with »bacterio-plankton:code«. If not, see <http://www.gnu.org/licenses/>. |
|
16 |
+ |
|
17 |
+ |
|
18 |
+ |
|
19 |
+ GNU GENERAL PUBLIC LICENSE |
|
20 |
+ Version 3, 29 June 2007 |
|
21 |
+ |
|
22 |
+ Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/> |
|
23 |
+ Everyone is permitted to copy and distribute verbatim copies |
|
24 |
+ of this license document, but changing it is not allowed. |
|
25 |
+ |
|
26 |
+ Preamble |
|
27 |
+ |
|
28 |
+ The GNU General Public License is a free, copyleft license for |
|
29 |
+software and other kinds of works. |
|
30 |
+ |
|
31 |
+ The licenses for most software and other practical works are designed |
|
32 |
+to take away your freedom to share and change the works. By contrast, |
|
33 |
+the GNU General Public License is intended to guarantee your freedom to |
|
34 |
+share and change all versions of a program--to make sure it remains free |
|
35 |
+software for all its users. We, the Free Software Foundation, use the |
|
36 |
+GNU General Public License for most of our software; it applies also to |
|
37 |
+any other work released this way by its authors. You can apply it to |
|
38 |
+your programs, too. |
|
39 |
+ |
|
40 |
+ When we speak of free software, we are referring to freedom, not |
|
41 |
+price. Our General Public Licenses are designed to make sure that you |
|
42 |
+have the freedom to distribute copies of free software (and charge for |
|
43 |
+them if you wish), that you receive source code or can get it if you |
|
44 |
+want it, that you can change the software or use pieces of it in new |
|
45 |
+free programs, and that you know you can do these things. |
|
46 |
+ |
|
47 |
+ To protect your rights, we need to prevent others from denying you |
|
48 |
+these rights or asking you to surrender the rights. Therefore, you have |
|
49 |
+certain responsibilities if you distribute copies of the software, or if |
|
50 |
+you modify it: responsibilities to respect the freedom of others. |
|
51 |
+ |
|
52 |
+ For example, if you distribute copies of such a program, whether |
|
53 |
+gratis or for a fee, you must pass on to the recipients the same |
|
54 |
+freedoms that you received. You must make sure that they, too, receive |
|
55 |
+or can get the source code. And you must show them these terms so they |
|
56 |
+know their rights. |
|
57 |
+ |
|
58 |
+ Developers that use the GNU GPL protect your rights with two steps: |
|
59 |
+(1) assert copyright on the software, and (2) offer you this License |
|
60 |
+giving you legal permission to copy, distribute and/or modify it. |
|
61 |
+ |
|
62 |
+ For the developers' and authors' protection, the GPL clearly explains |
|
63 |
+that there is no warranty for this free software. For both users' and |
|
64 |
+authors' sake, the GPL requires that modified versions be marked as |
|
65 |
+changed, so that their problems will not be attributed erroneously to |
|
66 |
+authors of previous versions. |
|
67 |
+ |
|
68 |
+ Some devices are designed to deny users access to install or run |
|
69 |
+modified versions of the software inside them, although the manufacturer |
|
70 |
+can do so. This is fundamentally incompatible with the aim of |
|
71 |
+protecting users' freedom to change the software. The systematic |
|
72 |
+pattern of such abuse occurs in the area of products for individuals to |
|
73 |
+use, which is precisely where it is most unacceptable. Therefore, we |
|
74 |
+have designed this version of the GPL to prohibit the practice for those |
|
75 |
+products. If such problems arise substantially in other domains, we |
|
76 |
+stand ready to extend this provision to those domains in future versions |
|
77 |
+of the GPL, as needed to protect the freedom of users. |
|
78 |
+ |
|
79 |
+ Finally, every program is threatened constantly by software patents. |
|
80 |
+States should not allow patents to restrict development and use of |
|
81 |
+software on general-purpose computers, but in those that do, we wish to |
|
82 |
+avoid the special danger that patents applied to a free program could |
|
83 |
+make it effectively proprietary. To prevent this, the GPL assures that |
|
84 |
+patents cannot be used to render the program non-free. |
|
85 |
+ |
|
86 |
+ The precise terms and conditions for copying, distribution and |
|
87 |
+modification follow. |
|
88 |
+ |
|
89 |
+ TERMS AND CONDITIONS |
|
90 |
+ |
|
91 |
+ 0. Definitions. |
|
92 |
+ |
|
93 |
+ "This License" refers to version 3 of the GNU General Public License. |
|
94 |
+ |
|
95 |
+ "Copyright" also means copyright-like laws that apply to other kinds of |
|
96 |
+works, such as semiconductor masks. |
|
97 |
+ |
|
98 |
+ "The Program" refers to any copyrightable work licensed under this |
|
99 |
+License. Each licensee is addressed as "you". "Licensees" and |
|
100 |
+"recipients" may be individuals or organizations. |
|
101 |
+ |
|
102 |
+ To "modify" a work means to copy from or adapt all or part of the work |
|
103 |
+in a fashion requiring copyright permission, other than the making of an |
|
104 |
+exact copy. The resulting work is called a "modified version" of the |
|
105 |
+earlier work or a work "based on" the earlier work. |
|
106 |
+ |
|
107 |
+ A "covered work" means either the unmodified Program or a work based |
|
108 |
+on the Program. |
|
109 |
+ |
|
110 |
+ To "propagate" a work means to do anything with it that, without |
|
111 |
+permission, would make you directly or secondarily liable for |
|
112 |
+infringement under applicable copyright law, except executing it on a |
|
113 |
+computer or modifying a private copy. Propagation includes copying, |
|
114 |
+distribution (with or without modification), making available to the |
|
115 |
+public, and in some countries other activities as well. |
|
116 |
+ |
|
117 |
+ To "convey" a work means any kind of propagation that enables other |
|
118 |
+parties to make or receive copies. Mere interaction with a user through |
|
119 |
+a computer network, with no transfer of a copy, is not conveying. |
|
120 |
+ |
|
121 |
+ An interactive user interface displays "Appropriate Legal Notices" |
|
122 |
+to the extent that it includes a convenient and prominently visible |
|
123 |
+feature that (1) displays an appropriate copyright notice, and (2) |
|
124 |
+tells the user that there is no warranty for the work (except to the |
|
125 |
+extent that warranties are provided), that licensees may convey the |
|
126 |
+work under this License, and how to view a copy of this License. If |
|
127 |
+the interface presents a list of user commands or options, such as a |
|
128 |
+menu, a prominent item in the list meets this criterion. |
|
129 |
+ |
|
130 |
+ 1. Source Code. |
|
131 |
+ |
|
132 |
+ The "source code" for a work means the preferred form of the work |
|
133 |
+for making modifications to it. "Object code" means any non-source |
|
134 |
+form of a work. |
|
135 |
+ |
|
136 |
+ A "Standard Interface" means an interface that either is an official |
|
137 |
+standard defined by a recognized standards body, or, in the case of |
|
138 |
+interfaces specified for a particular programming language, one that |
|
139 |
+is widely used among developers working in that language. |
|
140 |
+ |
|
141 |
+ The "System Libraries" of an executable work include anything, other |
|
142 |
+than the work as a whole, that (a) is included in the normal form of |
|
143 |
+packaging a Major Component, but which is not part of that Major |
|
144 |
+Component, and (b) serves only to enable use of the work with that |
|
145 |
+Major Component, or to implement a Standard Interface for which an |
|
146 |
+implementation is available to the public in source code form. A |
|
147 |
+"Major Component", in this context, means a major essential component |
|
148 |
+(kernel, window system, and so on) of the specific operating system |
|
149 |
+(if any) on which the executable work runs, or a compiler used to |
|
150 |
+produce the work, or an object code interpreter used to run it. |
|
151 |
+ |
|
152 |
+ The "Corresponding Source" for a work in object code form means all |
|
153 |
+the source code needed to generate, install, and (for an executable |
|
154 |
+work) run the object code and to modify the work, including scripts to |
|
155 |
+control those activities. However, it does not include the work's |
|
156 |
+System Libraries, or general-purpose tools or generally available free |
|
157 |
+programs which are used unmodified in performing those activities but |
|
158 |
+which are not part of the work. For example, Corresponding Source |
|
159 |
+includes interface definition files associated with source files for |
|
160 |
+the work, and the source code for shared libraries and dynamically |
|
161 |
+linked subprograms that the work is specifically designed to require, |
|
162 |
+such as by intimate data communication or control flow between those |
|
163 |
+subprograms and other parts of the work. |
|
164 |
+ |
|
165 |
+ The Corresponding Source need not include anything that users |
|
166 |
+can regenerate automatically from other parts of the Corresponding |
|
167 |
+Source. |
|
168 |
+ |
|
169 |
+ The Corresponding Source for a work in source code form is that |
|
170 |
+same work. |
|
171 |
+ |
|
172 |
+ 2. Basic Permissions. |
|
173 |
+ |
|
174 |
+ All rights granted under this License are granted for the term of |
|
175 |
+copyright on the Program, and are irrevocable provided the stated |
|
176 |
+conditions are met. This License explicitly affirms your unlimited |
|
177 |
+permission to run the unmodified Program. The output from running a |
|
178 |
+covered work is covered by this License only if the output, given its |
|
179 |
+content, constitutes a covered work. This License acknowledges your |
|
180 |
+rights of fair use or other equivalent, as provided by copyright law. |
|
181 |
+ |
|
182 |
+ You may make, run and propagate covered works that you do not |
|
183 |
+convey, without conditions so long as your license otherwise remains |
|
184 |
+in force. You may convey covered works to others for the sole purpose |
|
185 |
+of having them make modifications exclusively for you, or provide you |
|
186 |
+with facilities for running those works, provided that you comply with |
|
187 |
+the terms of this License in conveying all material for which you do |
|
188 |
+not control copyright. Those thus making or running the covered works |
|
189 |
+for you must do so exclusively on your behalf, under your direction |
|
190 |
+and control, on terms that prohibit them from making any copies of |
|
191 |
+your copyrighted material outside their relationship with you. |
|
192 |
+ |
|
193 |
+ Conveying under any other circumstances is permitted solely under |
|
194 |
+the conditions stated below. Sublicensing is not allowed; section 10 |
|
195 |
+makes it unnecessary. |
|
196 |
+ |
|
197 |
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law. |
|
198 |
+ |
|
199 |
+ No covered work shall be deemed part of an effective technological |
|
200 |
+measure under any applicable law fulfilling obligations under article |
|
201 |
+11 of the WIPO copyright treaty adopted on 20 December 1996, or |
|
202 |
+similar laws prohibiting or restricting circumvention of such |
|
203 |
+measures. |
|
204 |
+ |
|
205 |
+ When you convey a covered work, you waive any legal power to forbid |
|
206 |
+circumvention of technological measures to the extent such circumvention |
|
207 |
+is effected by exercising rights under this License with respect to |
|
208 |
+the covered work, and you disclaim any intention to limit operation or |
|
209 |
+modification of the work as a means of enforcing, against the work's |
|
210 |
+users, your or third parties' legal rights to forbid circumvention of |
|
211 |
+technological measures. |
|
212 |
+ |
|
213 |
+ 4. Conveying Verbatim Copies. |
|
214 |
+ |
|
215 |
+ You may convey verbatim copies of the Program's source code as you |
|
216 |
+receive it, in any medium, provided that you conspicuously and |
|
217 |
+appropriately publish on each copy an appropriate copyright notice; |
|
218 |
+keep intact all notices stating that this License and any |
|
219 |
+non-permissive terms added in accord with section 7 apply to the code; |
|
220 |
+keep intact all notices of the absence of any warranty; and give all |
|
221 |
+recipients a copy of this License along with the Program. |
|
222 |
+ |
|
223 |
+ You may charge any price or no price for each copy that you convey, |
|
224 |
+and you may offer support or warranty protection for a fee. |
|
225 |
+ |
|
226 |
+ 5. Conveying Modified Source Versions. |
|
227 |
+ |
|
228 |
+ You may convey a work based on the Program, or the modifications to |
|
229 |
+produce it from the Program, in the form of source code under the |
|
230 |
+terms of section 4, provided that you also meet all of these conditions: |
|
231 |
+ |
|
232 |
+ a) The work must carry prominent notices stating that you modified |
|
233 |
+ it, and giving a relevant date. |
|
234 |
+ |
|
235 |
+ b) The work must carry prominent notices stating that it is |
|
236 |
+ released under this License and any conditions added under section |
|
237 |
+ 7. This requirement modifies the requirement in section 4 to |
|
238 |
+ "keep intact all notices". |
|
239 |
+ |
|
240 |
+ c) You must license the entire work, as a whole, under this |
|
241 |
+ License to anyone who comes into possession of a copy. This |
|
242 |
+ License will therefore apply, along with any applicable section 7 |
|
243 |
+ additional terms, to the whole of the work, and all its parts, |
|
244 |
+ regardless of how they are packaged. This License gives no |
|
245 |
+ permission to license the work in any other way, but it does not |
|
246 |
+ invalidate such permission if you have separately received it. |
|
247 |
+ |
|
248 |
+ d) If the work has interactive user interfaces, each must display |
|
249 |
+ Appropriate Legal Notices; however, if the Program has interactive |
|
250 |
+ interfaces that do not display Appropriate Legal Notices, your |
|
251 |
+ work need not make them do so. |
|
252 |
+ |
|
253 |
+ A compilation of a covered work with other separate and independent |
|
254 |
+works, which are not by their nature extensions of the covered work, |
|
255 |
+and which are not combined with it such as to form a larger program, |
|
256 |
+in or on a volume of a storage or distribution medium, is called an |
|
257 |
+"aggregate" if the compilation and its resulting copyright are not |
|
258 |
+used to limit the access or legal rights of the compilation's users |
|
259 |
+beyond what the individual works permit. Inclusion of a covered work |
|
260 |
+in an aggregate does not cause this License to apply to the other |
|
261 |
+parts of the aggregate. |
|
262 |
+ |
|
263 |
+ 6. Conveying Non-Source Forms. |
|
264 |
+ |
|
265 |
+ You may convey a covered work in object code form under the terms |
|
266 |
+of sections 4 and 5, provided that you also convey the |
|
267 |
+machine-readable Corresponding Source under the terms of this License, |
|
268 |
+in one of these ways: |
|
269 |
+ |
|
270 |
+ a) Convey the object code in, or embodied in, a physical product |
|
271 |
+ (including a physical distribution medium), accompanied by the |
|
272 |
+ Corresponding Source fixed on a durable physical medium |
|
273 |
+ customarily used for software interchange. |
|
274 |
+ |
|
275 |
+ b) Convey the object code in, or embodied in, a physical product |
|
276 |
+ (including a physical distribution medium), accompanied by a |
|
277 |
+ written offer, valid for at least three years and valid for as |
|
278 |
+ long as you offer spare parts or customer support for that product |
|
279 |
+ model, to give anyone who possesses the object code either (1) a |
|
280 |
+ copy of the Corresponding Source for all the software in the |
|
281 |
+ product that is covered by this License, on a durable physical |
|
282 |
+ medium customarily used for software interchange, for a price no |
|
283 |
+ more than your reasonable cost of physically performing this |
|
284 |
+ conveying of source, or (2) access to copy the |
|
285 |
+ Corresponding Source from a network server at no charge. |
|
286 |
+ |
|
287 |
+ c) Convey individual copies of the object code with a copy of the |
|
288 |
+ written offer to provide the Corresponding Source. This |
|
289 |
+ alternative is allowed only occasionally and noncommercially, and |
|
290 |
+ only if you received the object code with such an offer, in accord |
|
291 |
+ with subsection 6b. |
|
292 |
+ |
|
293 |
+ d) Convey the object code by offering access from a designated |
|
294 |
+ place (gratis or for a charge), and offer equivalent access to the |
|
295 |
+ Corresponding Source in the same way through the same place at no |
|
296 |
+ further charge. You need not require recipients to copy the |
|
297 |
+ Corresponding Source along with the object code. If the place to |
|
298 |
+ copy the object code is a network server, the Corresponding Source |
|
299 |
+ may be on a different server (operated by you or a third party) |
|
300 |
+ that supports equivalent copying facilities, provided you maintain |
|
301 |
+ clear directions next to the object code saying where to find the |
|
302 |
+ Corresponding Source. Regardless of what server hosts the |
|
303 |
+ Corresponding Source, you remain obligated to ensure that it is |
|
304 |
+ available for as long as needed to satisfy these requirements. |
|
305 |
+ |
|
306 |
+ e) Convey the object code using peer-to-peer transmission, provided |
|
307 |
+ you inform other peers where the object code and Corresponding |
|
308 |
+ Source of the work are being offered to the general public at no |
|
309 |
+ charge under subsection 6d. |
|
310 |
+ |
|
311 |
+ A separable portion of the object code, whose source code is excluded |
|
312 |
+from the Corresponding Source as a System Library, need not be |
|
313 |
+included in conveying the object code work. |
|
314 |
+ |
|
315 |
+ A "User Product" is either (1) a "consumer product", which means any |
|
316 |
+tangible personal property which is normally used for personal, family, |
|
317 |
+or household purposes, or (2) anything designed or sold for incorporation |
|
318 |
+into a dwelling. In determining whether a product is a consumer product, |
|
319 |
+doubtful cases shall be resolved in favor of coverage. For a particular |
|
320 |
+product received by a particular user, "normally used" refers to a |
|
321 |
+typical or common use of that class of product, regardless of the status |
|
322 |
+of the particular user or of the way in which the particular user |
|
323 |
+actually uses, or expects or is expected to use, the product. A product |
|
324 |
+is a consumer product regardless of whether the product has substantial |
|
325 |
+commercial, industrial or non-consumer uses, unless such uses represent |
|
326 |
+the only significant mode of use of the product. |
|
327 |
+ |
|
328 |
+ "Installation Information" for a User Product means any methods, |
|
329 |
+procedures, authorization keys, or other information required to install |
|
330 |
+and execute modified versions of a covered work in that User Product from |
|
331 |
+a modified version of its Corresponding Source. The information must |
|
332 |
+suffice to ensure that the continued functioning of the modified object |
|
333 |
+code is in no case prevented or interfered with solely because |
|
334 |
+modification has been made. |
|
335 |
+ |
|
336 |
+ If you convey an object code work under this section in, or with, or |
|
337 |
+specifically for use in, a User Product, and the conveying occurs as |
|
338 |
+part of a transaction in which the right of possession and use of the |
|
339 |
+User Product is transferred to the recipient in perpetuity or for a |
|
340 |
+fixed term (regardless of how the transaction is characterized), the |
|
341 |
+Corresponding Source conveyed under this section must be accompanied |
|
342 |
+by the Installation Information. But this requirement does not apply |
|
343 |
+if neither you nor any third party retains the ability to install |
|
344 |
+modified object code on the User Product (for example, the work has |
|
345 |
+been installed in ROM). |
|
346 |
+ |
|
347 |
+ The requirement to provide Installation Information does not include a |
|
348 |
+requirement to continue to provide support service, warranty, or updates |
|
349 |
+for a work that has been modified or installed by the recipient, or for |
|
350 |
+the User Product in which it has been modified or installed. Access to a |
|
351 |
+network may be denied when the modification itself materially and |
|
352 |
+adversely affects the operation of the network or violates the rules and |
|
353 |
+protocols for communication across the network. |
|
354 |
+ |
|
355 |
+ Corresponding Source conveyed, and Installation Information provided, |
|
356 |
+in accord with this section must be in a format that is publicly |
|
357 |
+documented (and with an implementation available to the public in |
|
358 |
+source code form), and must require no special password or key for |
|
359 |
+unpacking, reading or copying. |
|
360 |
+ |
|
361 |
+ 7. Additional Terms. |
|
362 |
+ |
|
363 |
+ "Additional permissions" are terms that supplement the terms of this |
|
364 |
+License by making exceptions from one or more of its conditions. |
|
365 |
+Additional permissions that are applicable to the entire Program shall |
|
366 |
+be treated as though they were included in this License, to the extent |
|
367 |
+that they are valid under applicable law. If additional permissions |
|
368 |
+apply only to part of the Program, that part may be used separately |
|
369 |
+under those permissions, but the entire Program remains governed by |
|
370 |
+this License without regard to the additional permissions. |
|
371 |
+ |
|
372 |
+ When you convey a copy of a covered work, you may at your option |
|
373 |
+remove any additional permissions from that copy, or from any part of |
|
374 |
+it. (Additional permissions may be written to require their own |
|
375 |
+removal in certain cases when you modify the work.) You may place |
|
376 |
+additional permissions on material, added by you to a covered work, |
|
377 |
+for which you have or can give appropriate copyright permission. |
|
378 |
+ |
|
379 |
+ Notwithstanding any other provision of this License, for material you |
|
380 |
+add to a covered work, you may (if authorized by the copyright holders of |
|
381 |
+that material) supplement the terms of this License with terms: |
|
382 |
+ |
|
383 |
+ a) Disclaiming warranty or limiting liability differently from the |
|
384 |
+ terms of sections 15 and 16 of this License; or |
|
385 |
+ |
|
386 |
+ b) Requiring preservation of specified reasonable legal notices or |
|
387 |
+ author attributions in that material or in the Appropriate Legal |
|
388 |
+ Notices displayed by works containing it; or |
|
389 |
+ |
|
390 |
+ c) Prohibiting misrepresentation of the origin of that material, or |
|
391 |
+ requiring that modified versions of such material be marked in |
|
392 |
+ reasonable ways as different from the original version; or |
|
393 |
+ |
|
394 |
+ d) Limiting the use for publicity purposes of names of licensors or |
|
395 |
+ authors of the material; or |
|
396 |
+ |
|
397 |
+ e) Declining to grant rights under trademark law for use of some |
|
398 |
+ trade names, trademarks, or service marks; or |
|
399 |
+ |
|
400 |
+ f) Requiring indemnification of licensors and authors of that |
|
401 |
+ material by anyone who conveys the material (or modified versions of |
|
402 |
+ it) with contractual assumptions of liability to the recipient, for |
|
403 |
+ any liability that these contractual assumptions directly impose on |
|
404 |
+ those licensors and authors. |
|
405 |
+ |
|
406 |
+ All other non-permissive additional terms are considered "further |
|
407 |
+restrictions" within the meaning of section 10. If the Program as you |
|
408 |
+received it, or any part of it, contains a notice stating that it is |
|
409 |
+governed by this License along with a term that is a further |
|
410 |
+restriction, you may remove that term. If a license document contains |
|
411 |
+a further restriction but permits relicensing or conveying under this |
|
412 |
+License, you may add to a covered work material governed by the terms |
|
413 |
+of that license document, provided that the further restriction does |
|
414 |
+not survive such relicensing or conveying. |
|
415 |
+ |
|
416 |
+ If you add terms to a covered work in accord with this section, you |
|
417 |
+must place, in the relevant source files, a statement of the |
|
418 |
+additional terms that apply to those files, or a notice indicating |
|
419 |
+where to find the applicable terms. |
|
420 |
+ |
|
421 |
+ Additional terms, permissive or non-permissive, may be stated in the |
|
422 |
+form of a separately written license, or stated as exceptions; |
|
423 |
+the above requirements apply either way. |
|
424 |
+ |
|
425 |
+ 8. Termination. |
|
426 |
+ |
|
427 |
+ You may not propagate or modify a covered work except as expressly |
|
428 |
+provided under this License. Any attempt otherwise to propagate or |
|
429 |
+modify it is void, and will automatically terminate your rights under |
|
430 |
+this License (including any patent licenses granted under the third |
|
431 |
+paragraph of section 11). |
|
432 |
+ |
|
433 |
+ However, if you cease all violation of this License, then your |
|
434 |
+license from a particular copyright holder is reinstated (a) |
|
435 |
+provisionally, unless and until the copyright holder explicitly and |
|
436 |
+finally terminates your license, and (b) permanently, if the copyright |
|
437 |
+holder fails to notify you of the violation by some reasonable means |
|
438 |
+prior to 60 days after the cessation. |
|
439 |
+ |
|
440 |
+ Moreover, your license from a particular copyright holder is |
|
441 |
+reinstated permanently if the copyright holder notifies you of the |
|
442 |
+violation by some reasonable means, this is the first time you have |
|
443 |
+received notice of violation of this License (for any work) from that |
|
444 |
+copyright holder, and you cure the violation prior to 30 days after |
|
445 |
+your receipt of the notice. |
|
446 |
+ |
|
447 |
+ Termination of your rights under this section does not terminate the |
|
448 |
+licenses of parties who have received copies or rights from you under |
|
449 |
+this License. If your rights have been terminated and not permanently |
|
450 |
+reinstated, you do not qualify to receive new licenses for the same |
|
451 |
+material under section 10. |
|
452 |
+ |
|
453 |
+ 9. Acceptance Not Required for Having Copies. |
|
454 |
+ |
|
455 |
+ You are not required to accept this License in order to receive or |
|
456 |
+run a copy of the Program. Ancillary propagation of a covered work |
|
457 |
+occurring solely as a consequence of using peer-to-peer transmission |
|
458 |
+to receive a copy likewise does not require acceptance. However, |
|
459 |
+nothing other than this License grants you permission to propagate or |
|
460 |
+modify any covered work. These actions infringe copyright if you do |
|
461 |
+not accept this License. Therefore, by modifying or propagating a |
|
462 |
+covered work, you indicate your acceptance of this License to do so. |
|
463 |
+ |
|
464 |
+ 10. Automatic Licensing of Downstream Recipients. |
|
465 |
+ |
|
466 |
+ Each time you convey a covered work, the recipient automatically |
|
467 |
+receives a license from the original licensors, to run, modify and |
|
468 |
+propagate that work, subject to this License. You are not responsible |
|
469 |
+for enforcing compliance by third parties with this License. |
|
470 |
+ |
|
471 |
+ An "entity transaction" is a transaction transferring control of an |
|
472 |
+organization, or substantially all assets of one, or subdividing an |
|
473 |
+organization, or merging organizations. If propagation of a covered |
|
474 |
+work results from an entity transaction, each party to that |
|
475 |
+transaction who receives a copy of the work also receives whatever |
|
476 |
+licenses to the work the party's predecessor in interest had or could |
|
477 |
+give under the previous paragraph, plus a right to possession of the |
|
478 |
+Corresponding Source of the work from the predecessor in interest, if |
|
479 |
+the predecessor has it or can get it with reasonable efforts. |
|
480 |
+ |
|
481 |
+ You may not impose any further restrictions on the exercise of the |
|
482 |
+rights granted or affirmed under this License. For example, you may |
|
483 |
+not impose a license fee, royalty, or other charge for exercise of |
|
484 |
+rights granted under this License, and you may not initiate litigation |
|
485 |
+(including a cross-claim or counterclaim in a lawsuit) alleging that |
|
486 |
+any patent claim is infringed by making, using, selling, offering for |
|
487 |
+sale, or importing the Program or any portion of it. |
|
488 |
+ |
|
489 |
+ 11. Patents. |
|
490 |
+ |
|
491 |
+ A "contributor" is a copyright holder who authorizes use under this |
|
492 |
+License of the Program or a work on which the Program is based. The |
|
493 |
+work thus licensed is called the contributor's "contributor version". |
|
494 |
+ |
|
495 |
+ A contributor's "essential patent claims" are all patent claims |
|
496 |
+owned or controlled by the contributor, whether already acquired or |
|
497 |
+hereafter acquired, that would be infringed by some manner, permitted |
|
498 |
+by this License, of making, using, or selling its contributor version, |
|
499 |
+but do not include claims that would be infringed only as a |
|
500 |
+consequence of further modification of the contributor version. For |
|
501 |
+purposes of this definition, "control" includes the right to grant |
|
502 |
+patent sublicenses in a manner consistent with the requirements of |
|
503 |
+this License. |
|
504 |
+ |
|
505 |
+ Each contributor grants you a non-exclusive, worldwide, royalty-free |
|
506 |
+patent license under the contributor's essential patent claims, to |
|
507 |
+make, use, sell, offer for sale, import and otherwise run, modify and |
|
508 |
+propagate the contents of its contributor version. |
|
509 |
+ |
|
510 |
+ In the following three paragraphs, a "patent license" is any express |
|
511 |
+agreement or commitment, however denominated, not to enforce a patent |
|
512 |
+(such as an express permission to practice a patent or covenant not to |
|
513 |
+sue for patent infringement). To "grant" such a patent license to a |
|
514 |
+party means to make such an agreement or commitment not to enforce a |
|
515 |
+patent against the party. |
|
516 |
+ |
|
517 |
+ If you convey a covered work, knowingly relying on a patent license, |
|
518 |
+and the Corresponding Source of the work is not available for anyone |
|
519 |
+to copy, free of charge and under the terms of this License, through a |
|
520 |
+publicly available network server or other readily accessible means, |
|
521 |
+then you must either (1) cause the Corresponding Source to be so |
|
522 |
+available, or (2) arrange to deprive yourself of the benefit of the |
|
523 |
+patent license for this particular work, or (3) arrange, in a manner |
|
524 |
+consistent with the requirements of this License, to extend the patent |
|
525 |
+license to downstream recipients. "Knowingly relying" means you have |
|
526 |
+actual knowledge that, but for the patent license, your conveying the |
|
527 |
+covered work in a country, or your recipient's use of the covered work |
|
528 |
+in a country, would infringe one or more identifiable patents in that |
|
529 |
+country that you have reason to believe are valid. |
|
530 |
+ |
|
531 |
+ If, pursuant to or in connection with a single transaction or |
|
532 |
+arrangement, you convey, or propagate by procuring conveyance of, a |
|
533 |
+covered work, and grant a patent license to some of the parties |
|
534 |
+receiving the covered work authorizing them to use, propagate, modify |
|
535 |
+or convey a specific copy of the covered work, then the patent license |
|
536 |
+you grant is automatically extended to all recipients of the covered |
|
537 |
+work and works based on it. |
|
538 |
+ |
|
539 |
+ A patent license is "discriminatory" if it does not include within |
|
540 |
+the scope of its coverage, prohibits the exercise of, or is |
|
541 |
+conditioned on the non-exercise of one or more of the rights that are |
|
542 |
+specifically granted under this License. You may not convey a covered |
|
543 |
+work if you are a party to an arrangement with a third party that is |
|
544 |
+in the business of distributing software, under which you make payment |
|
545 |
+to the third party based on the extent of your activity of conveying |
|
546 |
+the work, and under which the third party grants, to any of the |
|
547 |
+parties who would receive the covered work from you, a discriminatory |
|
548 |
+patent license (a) in connection with copies of the covered work |
|
549 |
+conveyed by you (or copies made from those copies), or (b) primarily |
|
550 |
+for and in connection with specific products or compilations that |
|
551 |
+contain the covered work, unless you entered into that arrangement, |
|
552 |
+or that patent license was granted, prior to 28 March 2007. |
|
553 |
+ |
|
554 |
+ Nothing in this License shall be construed as excluding or limiting |
|
555 |
+any implied license or other defenses to infringement that may |
|
556 |
+otherwise be available to you under applicable patent law. |
|
557 |
+ |
|
558 |
+ 12. No Surrender of Others' Freedom. |
|
559 |
+ |
|
560 |
+ If conditions are imposed on you (whether by court order, agreement or |
|
561 |
+otherwise) that contradict the conditions of this License, they do not |
|
562 |
+excuse you from the conditions of this License. If you cannot convey a |
|
563 |
+covered work so as to satisfy simultaneously your obligations under this |
|
564 |
+License and any other pertinent obligations, then as a consequence you may |
|
565 |
+not convey it at all. For example, if you agree to terms that obligate you |
|
566 |
+to collect a royalty for further conveying from those to whom you convey |
|
567 |
+the Program, the only way you could satisfy both those terms and this |
|
568 |
+License would be to refrain entirely from conveying the Program. |
|
569 |
+ |
|
570 |
+ 13. Use with the GNU Affero General Public License. |
|
571 |
+ |
|
572 |
+ Notwithstanding any other provision of this License, you have |
|
573 |
+permission to link or combine any covered work with a work licensed |
|
574 |
+under version 3 of the GNU Affero General Public License into a single |
|
575 |
+combined work, and to convey the resulting work. The terms of this |
|
576 |
+License will continue to apply to the part which is the covered work, |
|
577 |
+but the special requirements of the GNU Affero General Public License, |
|
578 |
+section 13, concerning interaction through a network will apply to the |
|
579 |
+combination as such. |
|
580 |
+ |
|
581 |
+ 14. Revised Versions of this License. |
|
582 |
+ |
|
583 |
+ The Free Software Foundation may publish revised and/or new versions of |
|
584 |
+the GNU General Public License from time to time. Such new versions will |
|
585 |
+be similar in spirit to the present version, but may differ in detail to |
|
586 |
+address new problems or concerns. |
|
587 |
+ |
|
588 |
+ Each version is given a distinguishing version number. If the |
|
589 |
+Program specifies that a certain numbered version of the GNU General |
|
590 |
+Public License "or any later version" applies to it, you have the |
|
591 |
+option of following the terms and conditions either of that numbered |
|
592 |
+version or of any later version published by the Free Software |
|
593 |
+Foundation. If the Program does not specify a version number of the |
|
594 |
+GNU General Public License, you may choose any version ever published |
|
595 |
+by the Free Software Foundation. |
|
596 |
+ |
|
597 |
+ If the Program specifies that a proxy can decide which future |
|
598 |
+versions of the GNU General Public License can be used, that proxy's |
|
599 |
+public statement of acceptance of a version permanently authorizes you |
|
600 |
+to choose that version for the Program. |
|
601 |
+ |
|
602 |
+ Later license versions may give you additional or different |
|
603 |
+permissions. However, no additional obligations are imposed on any |
|
604 |
+author or copyright holder as a result of your choosing to follow a |
|
605 |
+later version. |
|
606 |
+ |
|
607 |
+ 15. Disclaimer of Warranty. |
|
608 |
+ |
|
609 |
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY |
|
610 |
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT |
|
611 |
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY |
|
612 |
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, |
|
613 |
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
|
614 |
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM |
|
615 |
+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF |
|
616 |
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION. |
|
617 |
+ |
|
618 |
+ 16. Limitation of Liability. |
|
619 |
+ |
|
620 |
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING |
|
621 |
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS |
|
622 |
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY |
|
623 |
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE |
|
624 |
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF |
|
625 |
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD |
|
626 |
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), |
|
627 |
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF |
|
628 |
+SUCH DAMAGES. |
|
629 |
+ |
|
630 |
+ 17. Interpretation of Sections 15 and 16. |
|
631 |
+ |
|
632 |
+ If the disclaimer of warranty and limitation of liability provided |
|
633 |
+above cannot be given local legal effect according to their terms, |
|
634 |
+reviewing courts shall apply local law that most closely approximates |
|
635 |
+an absolute waiver of all civil liability in connection with the |
|
636 |
+Program, unless a warranty or assumption of liability accompanies a |
|
637 |
+copy of the Program in return for a fee. |
|
638 |
+ |
|
639 |
+ END OF TERMS AND CONDITIONS |
|
640 |
+ |
|
641 |
+ How to Apply These Terms to Your New Programs |
|
642 |
+ |
|
643 |
+ If you develop a new program, and you want it to be of the greatest |
|
644 |
+possible use to the public, the best way to achieve this is to make it |
|
645 |
+free software which everyone can redistribute and change under these terms. |
|
646 |
+ |
|
647 |
+ To do so, attach the following notices to the program. It is safest |
|
648 |
+to attach them to the start of each source file to most effectively |
|
649 |
+state the exclusion of warranty; and each file should have at least |
|
650 |
+the "copyright" line and a pointer to where the full notice is found. |
|
651 |
+ |
|
652 |
+ <one line to give the program's name and a brief idea of what it does.> |
|
653 |
+ Copyright (C) <year> <name of author> |
|
654 |
+ |
|
655 |
+ This program is free software: you can redistribute it and/or modify |
|
656 |
+ it under the terms of the GNU General Public License as published by |
|
657 |
+ the Free Software Foundation, either version 3 of the License, or |
|
658 |
+ (at your option) any later version. |
|
659 |
+ |
|
660 |
+ This program is distributed in the hope that it will be useful, |
|
661 |
+ but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
662 |
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
663 |
+ GNU General Public License for more details. |
|
664 |
+ |
|
665 |
+ You should have received a copy of the GNU General Public License |
|
666 |
+ along with this program. If not, see <https://www.gnu.org/licenses/>. |
|
667 |
+ |
|
668 |
+Also add information on how to contact you by electronic and paper mail. |
|
669 |
+ |
|
670 |
+ If the program does terminal interaction, make it output a short |
|
671 |
+notice like this when it starts in an interactive mode: |
|
672 |
+ |
|
673 |
+ <program> Copyright (C) <year> <name of author> |
|
674 |
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. |
|
675 |
+ This is free software, and you are welcome to redistribute it |
|
676 |
+ under certain conditions; type `show c' for details. |
|
677 |
+ |
|
678 |
+The hypothetical commands `show w' and `show c' should show the appropriate |
|
679 |
+parts of the General Public License. Of course, your program's commands |
|
680 |
+might be different; for a GUI interface, you would use an "about box". |
|
681 |
+ |
|
682 |
+ You should also get your employer (if you work as a programmer) or school, |
|
683 |
+if any, to sign a "copyright disclaimer" for the program, if necessary. |
|
684 |
+For more information on this, and how to apply and follow the GNU GPL, see |
|
685 |
+<https://www.gnu.org/licenses/>. |
|
686 |
+ |
|
687 |
+ The GNU General Public License does not permit incorporating your program |
|
688 |
+into proprietary programs. If your program is a subroutine library, you |
|
689 |
+may consider it more useful to permit linking proprietary applications with |
|
690 |
+the library. If this is what you want to do, use the GNU Lesser General |
|
691 |
+Public License instead of this License. But first, please read |
|
692 |
+<https://www.gnu.org/licenses/why-not-lgpl.html>. |
|
693 |
+ |
|
694 |
+ |
|
695 |
+ |
|
696 |
+ GNU LESSER GENERAL PUBLIC LICENSE |
|
697 |
+ Version 3, 29 June 2007 |
|
698 |
+ |
|
699 |
+ Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/> |
|
700 |
+ Everyone is permitted to copy and distribute verbatim copies |
|
701 |
+ of this license document, but changing it is not allowed. |
|
702 |
+ |
|
703 |
+ |
|
704 |
+ This version of the GNU Lesser General Public License incorporates |
|
705 |
+the terms and conditions of version 3 of the GNU General Public |
|
706 |
+License, supplemented by the additional permissions listed below. |
|
707 |
+ |
|
708 |
+ 0. Additional Definitions. |
|
709 |
+ |
|
710 |
+ As used herein, "this License" refers to version 3 of the GNU Lesser |
|
711 |
+General Public License, and the "GNU GPL" refers to version 3 of the GNU |
|
712 |
+General Public License. |
|
713 |
+ |
|
714 |
+ "The Library" refers to a covered work governed by this License, |
|
715 |
+other than an Application or a Combined Work as defined below. |
|
716 |
+ |
|
717 |
+ An "Application" is any work that makes use of an interface provided |
|
718 |
+by the Library, but which is not otherwise based on the Library. |
|
719 |
+Defining a subclass of a class defined by the Library is deemed a mode |
|
720 |
+of using an interface provided by the Library. |
|
721 |
+ |
|
722 |
+ A "Combined Work" is a work produced by combining or linking an |
|
723 |
+Application with the Library. The particular version of the Library |
|
724 |
+with which the Combined Work was made is also called the "Linked |
|
725 |
+Version". |
|
726 |
+ |
|
727 |
+ The "Minimal Corresponding Source" for a Combined Work means the |
|
728 |
+Corresponding Source for the Combined Work, excluding any source code |
|
729 |
+for portions of the Combined Work that, considered in isolation, are |
|
730 |
+based on the Application, and not on the Linked Version. |
|
731 |
+ |
|
732 |
+ The "Corresponding Application Code" for a Combined Work means the |
|
733 |
+object code and/or source code for the Application, including any data |
|
734 |
+and utility programs needed for reproducing the Combined Work from the |
|
735 |
+Application, but excluding the System Libraries of the Combined Work. |
|
736 |
+ |
|
737 |
+ 1. Exception to Section 3 of the GNU GPL. |
|
738 |
+ |
|
739 |
+ You may convey a covered work under sections 3 and 4 of this License |
|
740 |
+without being bound by section 3 of the GNU GPL. |
|
741 |
+ |
|
742 |
+ 2. Conveying Modified Versions. |
|
743 |
+ |
|
744 |
+ If you modify a copy of the Library, and, in your modifications, a |
|
745 |
+facility refers to a function or data to be supplied by an Application |
|
746 |
+that uses the facility (other than as an argument passed when the |
|
747 |
+facility is invoked), then you may convey a copy of the modified |
|
748 |
+version: |
|
749 |
+ |
|
750 |
+ a) under this License, provided that you make a good faith effort to |
|
751 |
+ ensure that, in the event an Application does not supply the |
|
752 |
+ function or data, the facility still operates, and performs |
|
753 |
+ whatever part of its purpose remains meaningful, or |
|
754 |
+ |
|
755 |
+ b) under the GNU GPL, with none of the additional permissions of |
|
756 |
+ this License applicable to that copy. |
|
757 |
+ |
|
758 |
+ 3. Object Code Incorporating Material from Library Header Files. |
|
759 |
+ |
|
760 |
+ The object code form of an Application may incorporate material from |
|
761 |
+a header file that is part of the Library. You may convey such object |
|
762 |
+code under terms of your choice, provided that, if the incorporated |
|
763 |
+material is not limited to numerical parameters, data structure |
|
764 |
+layouts and accessors, or small macros, inline functions and templates |
|
765 |
+(ten or fewer lines in length), you do both of the following: |
|
766 |
+ |
|
767 |
+ a) Give prominent notice with each copy of the object code that the |
|
768 |
+ Library is used in it and that the Library and its use are |
|
769 |
+ covered by this License. |
|
770 |
+ |
|
771 |
+ b) Accompany the object code with a copy of the GNU GPL and this license |
|
772 |
+ document. |
|
773 |
+ |
|
774 |
+ 4. Combined Works. |
|
775 |
+ |
|
776 |
+ You may convey a Combined Work under terms of your choice that, |
|
777 |
+taken together, effectively do not restrict modification of the |
|
778 |
+portions of the Library contained in the Combined Work and reverse |
|
779 |
+engineering for debugging such modifications, if you also do each of |
|
780 |
+the following: |
|
781 |
+ |
|
782 |
+ a) Give prominent notice with each copy of the Combined Work that |
|
783 |
+ the Library is used in it and that the Library and its use are |
|
784 |
+ covered by this License. |
|
785 |
+ |
|
786 |
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license |
|
787 |
+ document. |
|
788 |
+ |
|
789 |
+ c) For a Combined Work that displays copyright notices during |
|
790 |
+ execution, include the copyright notice for the Library among |
|
791 |
+ these notices, as well as a reference directing the user to the |
|
792 |
+ copies of the GNU GPL and this license document. |
|
793 |
+ |
|
794 |
+ d) Do one of the following: |
|
795 |
+ |
|
796 |
+ 0) Convey the Minimal Corresponding Source under the terms of this |
|
797 |
+ License, and the Corresponding Application Code in a form |
|
798 |
+ suitable for, and under terms that permit, the user to |
|
799 |
+ recombine or relink the Application with a modified version of |
|
800 |
+ the Linked Version to produce a modified Combined Work, in the |
|
801 |
+ manner specified by section 6 of the GNU GPL for conveying |
|
802 |
+ Corresponding Source. |
|
803 |
+ |
|
804 |
+ 1) Use a suitable shared library mechanism for linking with the |
|
805 |
+ Library. A suitable mechanism is one that (a) uses at run time |
|
806 |
+ a copy of the Library already present on the user's computer |
|
807 |
+ system, and (b) will operate properly with a modified version |
|
808 |
+ of the Library that is interface-compatible with the Linked |
|
809 |
+ Version. |
|
810 |
+ |
|
811 |
+ e) Provide Installation Information, but only if you would otherwise |
|
812 |
+ be required to provide such information under section 6 of the |
|
813 |
+ GNU GPL, and only to the extent that such information is |
|
814 |
+ necessary to install and execute a modified version of the |
|
815 |
+ Combined Work produced by recombining or relinking the |
|
816 |
+ Application with a modified version of the Linked Version. (If |
|
817 |
+ you use option 4d0, the Installation Information must accompany |
|
818 |
+ the Minimal Corresponding Source and Corresponding Application |
|
819 |
+ Code. If you use option 4d1, you must provide the Installation |
|
820 |
+ Information in the manner specified by section 6 of the GNU GPL |
|
821 |
+ for conveying Corresponding Source.) |
|
822 |
+ |
|
823 |
+ 5. Combined Libraries. |
|
824 |
+ |
|
825 |
+ You may place library facilities that are a work based on the |
|
826 |
+Library side by side in a single library together with other library |
|
827 |
+facilities that are not Applications and are not covered by this |
|
828 |
+License, and convey such a combined library under terms of your |
|
829 |
+choice, if you do both of the following: |
|
830 |
+ |
|
831 |
+ a) Accompany the combined library with a copy of the same work based |
|
832 |
+ on the Library, uncombined with any other library facilities, |
|
833 |
+ conveyed under the terms of this License. |
|
834 |
+ |
|
835 |
+ b) Give prominent notice with the combined library that part of it |
|
836 |
+ is a work based on the Library, and explaining where to find the |
|
837 |
+ accompanying uncombined form of the same work. |
|
838 |
+ |
|
839 |
+ 6. Revised Versions of the GNU Lesser General Public License. |
|
840 |
+ |
|
841 |
+ The Free Software Foundation may publish revised and/or new versions |
|
842 |
+of the GNU Lesser General Public License from time to time. Such new |
|
843 |
+versions will be similar in spirit to the present version, but may |
|
844 |
+differ in detail to address new problems or concerns. |
|
845 |
+ |
|
846 |
+ Each version is given a distinguishing version number. If the |
|
847 |
+Library as you received it specifies that a certain numbered version |
|
848 |
+of the GNU Lesser General Public License "or any later version" |
|
849 |
+applies to it, you have the option of following the terms and |
|
850 |
+conditions either of that published version or of any later version |
|
851 |
+published by the Free Software Foundation. If the Library as you |
|
852 |
+received it does not specify a version number of the GNU Lesser |
|
853 |
+General Public License, you may choose any version of the GNU Lesser |
|
854 |
+General Public License ever published by the Free Software Foundation. |
|
855 |
+ |
|
856 |
+ If the Library as you received it specifies that a proxy can decide |
|
857 |
+whether future versions of the GNU Lesser General Public License shall |
|
858 |
+apply, that proxy's public statement of acceptance of any version is |
|
859 |
+permanent authorization for you to choose that version for the |
|
860 |
+Library. |
|
861 |
+ |
... | ... |
@@ -0,0 +1,391 @@ |
1 |
+declare module lib_code { |
|
2 |
+ /** |
|
3 |
+ * @author fenris |
|
4 |
+ */ |
|
5 |
+ interface interface_code<type_from, type_to> { |
|
6 |
+ /** |
|
7 |
+ * @author fenris |
|
8 |
+ */ |
|
9 |
+ encode(x: type_from): type_to; |
|
10 |
+ /** |
|
11 |
+ * @author fenris |
|
12 |
+ */ |
|
13 |
+ decode(x: type_to): type_from; |
|
14 |
+ } |
|
15 |
+} |
|
16 |
+declare module lib_code { |
|
17 |
+} |
|
18 |
+declare module lib_code { |
|
19 |
+ /** |
|
20 |
+ * @author Christian Fraß <frass@greenscale.de> |
|
21 |
+ */ |
|
22 |
+ function custom_encode<type_from, type_to>(function_: (from: type_from) => type_to, from: type_from): type_to; |
|
23 |
+ /** |
|
24 |
+ * @author Christian Fraß <frass@greenscale.de> |
|
25 |
+ */ |
|
26 |
+ function custom_decode<type_from, type_to>(function_: (to: type_to) => type_from, to: type_to): type_from; |
|
27 |
+} |
|
28 |
+declare module lib_code { |
|
29 |
+ /** |
|
30 |
+ * @author fenris |
|
31 |
+ */ |
|
32 |
+ class class_code_custom<type_from, type_to> implements interface_code<type_from, type_to> { |
|
33 |
+ /** |
|
34 |
+ * @author fenris |
|
35 |
+ */ |
|
36 |
+ private encodefunc; |
|
37 |
+ /** |
|
38 |
+ * @author fenris |
|
39 |
+ */ |
|
40 |
+ private decodefunc; |
|
41 |
+ /** |
|
42 |
+ * @author fenris |
|
43 |
+ */ |
|
44 |
+ constructor(encodefunc: (from: type_from) => type_to, decodefunc: (to: type_to) => type_from); |
|
45 |
+ /** |
|
46 |
+ * @implementation |
|
47 |
+ * @author fenris |
|
48 |
+ */ |
|
49 |
+ encode(x: type_from): type_to; |
|
50 |
+ /** |
|
51 |
+ * @implementation |
|
52 |
+ * @author fenris |
|
53 |
+ */ |
|
54 |
+ decode(x: type_to): type_from; |
|
55 |
+ } |
|
56 |
+} |
|
57 |
+declare module lib_code { |
|
58 |
+ /** |
|
59 |
+ * @author fenris |
|
60 |
+ */ |
|
61 |
+ function inverse_encode<type_from, type_to>(decode: (to: type_to) => type_from, to: type_to): type_from; |
|
62 |
+ /** |
|
63 |
+ * @author fenris |
|
64 |
+ */ |
|
65 |
+ function inverse_decode<type_from, type_to>(encode: (from: type_from) => type_to, from: type_from): type_to; |
|
66 |
+} |
|
67 |
+declare module lib_code { |
|
68 |
+} |
|
69 |
+declare module lib_code { |
|
70 |
+ /** |
|
71 |
+ * @author fenris |
|
72 |
+ */ |
|
73 |
+ class class_code_inverse<type_from, type_to> implements interface_code<type_to, type_from> { |
|
74 |
+ /** |
|
75 |
+ * @author fenris |
|
76 |
+ */ |
|
77 |
+ protected subject: interface_code<type_from, type_to>; |
|
78 |
+ /** |
|
79 |
+ * @author fenris |
|
80 |
+ */ |
|
81 |
+ constructor(subject: interface_code<type_from, type_to>); |
|
82 |
+ /** |
|
83 |
+ * @implementation |
|
84 |
+ * @author fenris |
|
85 |
+ */ |
|
86 |
+ encode(to: type_to): type_from; |
|
87 |
+ /** |
|
88 |
+ * @implementation |
|
89 |
+ * @author fenris |
|
90 |
+ */ |
|
91 |
+ decode(from: type_from): type_to; |
|
92 |
+ } |
|
93 |
+} |
|
94 |
+declare module lib_code { |
|
95 |
+ /** |
|
96 |
+ * @author fenris |
|
97 |
+ */ |
|
98 |
+ function pair_encode<type_from, type_between, type_to>(encode_first: (from: type_from) => type_between, encode_second: (between: type_between) => type_to, from: type_from): type_to; |
|
99 |
+ /** |
|
100 |
+ * @author fenris |
|
101 |
+ */ |
|
102 |
+ function pair_decode<type_from, type_between, type_to>(decode_first: (between: type_between) => type_from, decode_second: (to: type_to) => type_between, to: type_to): type_from; |
|
103 |
+} |
|
104 |
+declare module lib_code { |
|
105 |
+} |
|
106 |
+declare module lib_code { |
|
107 |
+ /** |
|
108 |
+ * @author fenris |
|
109 |
+ */ |
|
110 |
+ class class_code_pair<type_from, type_between, type_to> implements interface_code<type_from, type_to> { |
|
111 |
+ /** |
|
112 |
+ * @author fenris |
|
113 |
+ */ |
|
114 |
+ protected first: interface_code<type_from, type_between>; |
|
115 |
+ /** |
|
116 |
+ * @author fenris |
|
117 |
+ */ |
|
118 |
+ protected second: interface_code<type_between, type_to>; |
|
119 |
+ /** |
|
120 |
+ * @author fenris |
|
121 |
+ */ |
|
122 |
+ constructor(first: interface_code<type_from, type_between>, second: interface_code<type_between, type_to>); |
|
123 |
+ /** |
|
124 |
+ * @implementation |
|
125 |
+ * @author fenris |
|
126 |
+ */ |
|
127 |
+ encode(from: type_from): type_to; |
|
128 |
+ /** |
|
129 |
+ * @implementation |
|
130 |
+ * @author fenris |
|
131 |
+ */ |
|
132 |
+ decode(to: type_to): type_from; |
|
133 |
+ } |
|
134 |
+} |
|
135 |
+declare module lib_code { |
|
136 |
+ /** |
|
137 |
+ * @author fenris |
|
138 |
+ */ |
|
139 |
+ function chain_encode(encode_links: Array<(from: any) => any>, from: any): any; |
|
140 |
+ /** |
|
141 |
+ * @author fenris |
|
142 |
+ */ |
|
143 |
+ function chain_decode(decode_links: Array<(to: any) => any>, to: any): any; |
|
144 |
+} |
|
145 |
+declare module lib_code { |
|
146 |
+ /** |
|
147 |
+ * @author fenris |
|
148 |
+ */ |
|
149 |
+ class class_code_chain implements interface_code<any, any> { |
|
150 |
+ /** |
|
151 |
+ * @author fenris |
|
152 |
+ */ |
|
153 |
+ protected links: Array<interface_code<any, any>>; |
|
154 |
+ /** |
|
155 |
+ * @author fenris |
|
156 |
+ */ |
|
157 |
+ constructor(links: Array<interface_code<any, any>>); |
|
158 |
+ /** |
|
159 |
+ * @implementation |
|
160 |
+ * @author fenris |
|
161 |
+ */ |
|
162 |
+ encode(from: any): any; |
|
163 |
+ /** |
|
164 |
+ * @implementation |
|
165 |
+ * @author fenris |
|
166 |
+ */ |
|
167 |
+ decode(to: any): any; |
|
168 |
+ } |
|
169 |
+} |
|
170 |
+declare module lib_code { |
|
171 |
+ /** |
|
172 |
+ * @author Christian Fraß <frass@greenscale.de> |
|
173 |
+ */ |
|
174 |
+ type type_flatten_from = Array<{ |
|
175 |
+ [name: string]: any; |
|
176 |
+ }>; |
|
177 |
+ /** |
|
178 |
+ * @author Christian Fraß <frass@greenscale.de> |
|
179 |
+ */ |
|
180 |
+ type type_flatten_to = { |
|
181 |
+ keys: Array<string>; |
|
182 |
+ data: Array<Array<any>>; |
|
183 |
+ }; |
|
184 |
+ /** |
|
185 |
+ * @author Christian Fraß <frass@greenscale.de> |
|
186 |
+ */ |
|
187 |
+ function flatten_encode(from: type_flatten_from, keys?: Array<string>): type_flatten_to; |
|
188 |
+ /** |
|
189 |
+ * @author Christian Fraß <frass@greenscale.de> |
|
190 |
+ */ |
|
191 |
+ function flatten_decode(to: type_flatten_to): type_flatten_from; |
|
192 |
+} |
|
193 |
+declare module lib_code { |
|
194 |
+ /** |
|
195 |
+ * @author fenris |
|
196 |
+ */ |
|
197 |
+ class class_code_flatten implements interface_code<type_flatten_from, type_flatten_to> { |
|
198 |
+ /** |
|
199 |
+ * @author fenris |
|
200 |
+ */ |
|
201 |
+ constructor(); |
|
202 |
+ /** |
|
203 |
+ * @implementation |
|
204 |
+ * @author fenris |
|
205 |
+ */ |
|
206 |
+ encode(x: type_flatten_from): type_flatten_to; |
|
207 |
+ /** |
|
208 |
+ * @implementation |
|
209 |
+ * @author fenris |
|
210 |
+ */ |
|
211 |
+ decode(x: type_flatten_to): type_flatten_from; |
|
212 |
+ } |
|
213 |
+} |
|
214 |
+declare module lib_code { |
|
215 |
+ /** |
|
216 |
+ * @author fenris |
|
217 |
+ */ |
|
218 |
+ function jsdate_encode(date: Date): string; |
|
219 |
+ /** |
|
220 |
+ * @author fenris |
|
221 |
+ */ |
|
222 |
+ function jsdate_decode(date_: string): Date; |
|
223 |
+} |
|
224 |
+declare module lib_code { |
|
225 |
+} |
|
226 |
+declare module lib_code { |
|
227 |
+ /** |
|
228 |
+ * @author fenris |
|
229 |
+ */ |
|
230 |
+ class class_code_jsdate implements interface_code<Date, string> { |
|
231 |
+ /** |
|
232 |
+ * @author fenris |
|
233 |
+ */ |
|
234 |
+ constructor(); |
|
235 |
+ /** |
|
236 |
+ * @implementation |
|
237 |
+ * @author fenris |
|
238 |
+ */ |
|
239 |
+ encode(x: Date): string; |
|
240 |
+ /** |
|
241 |
+ * @implementation |
|
242 |
+ * @author fenris |
|
243 |
+ */ |
|
244 |
+ decode(x: string): Date; |
|
245 |
+ } |
|
246 |
+} |
|
247 |
+declare module lib_code { |
|
248 |
+ /** |
|
249 |
+ * @author fenris |
|
250 |
+ */ |
|
251 |
+ function json_encode(x: any, formatted?: boolean): string; |
|
252 |
+ /** |
|
253 |
+ * @author fenris |
|
254 |
+ */ |
|
255 |
+ function json_decode(x: string): any; |
|
256 |
+} |
|
257 |
+declare module lib_code { |
|
258 |
+} |
|
259 |
+declare module lib_code { |
|
260 |
+ /** |
|
261 |
+ * @author fenris |
|
262 |
+ */ |
|
263 |
+ class class_code_json implements interface_code<any, string> { |
|
264 |
+ /** |
|
265 |
+ * @author fenris |
|
266 |
+ */ |
|
267 |
+ constructor(); |
|
268 |
+ /** |
|
269 |
+ * @implementation |
|
270 |
+ * @author fenris |
|
271 |
+ */ |
|
272 |
+ encode(x: any): string; |
|
273 |
+ /** |
|
274 |
+ * @implementation |
|
275 |
+ * @author fenris |
|
276 |
+ */ |
|
277 |
+ decode(x: string): any; |
|
278 |
+ } |
|
279 |
+} |
|
280 |
+declare module lib_code { |
|
281 |
+ /** |
|
282 |
+ * @author Christian Fraß <frass@greenscale.de> |
|
283 |
+ */ |
|
284 |
+ type type_csv_from = { |
|
285 |
+ head: Array<string>; |
|
286 |
+ data: Array<Array<string>>; |
|
287 |
+ }; |
|
288 |
+ /** |
|
289 |
+ * @author Christian Fraß <frass@greenscale.de> |
|
290 |
+ * @todo escaping |
|
291 |
+ */ |
|
292 |
+ function csv_encode(from: type_csv_from, { "delimiter": delimiter, "linebreak": linebreak, }?: { |
|
293 |
+ delimiter?: string; |
|
294 |
+ linebreak?: string; |
|
295 |
+ }): string; |
|
296 |
+ /** |
|
297 |
+ * @author Christian Fraß <frass@greenscale.de> |
|
298 |
+ */ |
|
299 |
+ function csv_decode(to: string, { "delimiter": delimiter, "linebreak": linebreak, "with_head": with_head, }?: { |
|
300 |
+ delimiter?: string; |
|
301 |
+ linebreak?: string; |
|
302 |
+ with_head?: boolean; |
|
303 |
+ }): type_csv_from; |
|
304 |
+} |
|
305 |
+declare module lib_code { |
|
306 |
+ /** |
|
307 |
+ * @author fenris |
|
308 |
+ */ |
|
309 |
+ class class_code_csv implements interface_code<type_csv_from, string> { |
|
310 |
+ /** |
|
311 |
+ * @author fenris |
|
312 |
+ */ |
|
313 |
+ constructor(); |
|
314 |
+ /** |
|
315 |
+ * @implementation |
|
316 |
+ * @author fenris |
|
317 |
+ */ |
|
318 |
+ encode(x: type_csv_from): string; |
|
319 |
+ /** |
|
320 |
+ * @implementation |
|
321 |
+ * @author fenris |
|
322 |
+ */ |
|
323 |
+ decode(x: string): type_csv_from; |
|
324 |
+ } |
|
325 |
+} |
|
326 |
+declare module lib_code { |
|
327 |
+ /** |
|
328 |
+ * @author fenris |
|
329 |
+ */ |
|
330 |
+ function uri_encode(x: string): string; |
|
331 |
+ /** |
|
332 |
+ * @author fenris |
|
333 |
+ */ |
|
334 |
+ function uri_decode(x: string): string; |
|
335 |
+} |
|
336 |
+declare module lib_code { |
|
337 |
+} |
|
338 |
+declare module lib_code { |
|
339 |
+ /** |
|
340 |
+ * @author fenris |
|
341 |
+ */ |
|
342 |
+ class class_code_uri implements interface_code<string, string> { |
|
343 |
+ /** |
|
344 |
+ * @author fenris |
|
345 |
+ */ |
|
346 |
+ constructor(); |
|
347 |
+ /** |
|
348 |
+ * @implementation |
|
349 |
+ * @author fenris |
|
350 |
+ */ |
|
351 |
+ encode(x: string): string; |
|
352 |
+ /** |
|
353 |
+ * @implementation |
|
354 |
+ * @author fenris |
|
355 |
+ */ |
|
356 |
+ decode(x: string): string; |
|
357 |
+ } |
|
358 |
+} |
|
359 |
+declare module lib_code { |
|
360 |
+ /** |
|
361 |
+ * @author fenris |
|
362 |
+ */ |
|
363 |
+ function base64_encode(x: string): string; |
|
364 |
+ /** |
|
365 |
+ * @author fenris |
|
366 |
+ */ |
|
367 |
+ function base64_decode(x: string): string; |
|
368 |
+} |
|
369 |
+declare module lib_code { |
|
370 |
+} |
|
371 |
+declare module lib_code { |
|
372 |
+ /** |
|
373 |
+ * @author fenris |
|
374 |
+ */ |
|
375 |
+ class class_code_base64 implements interface_code<string, string> { |
|
376 |
+ /** |
|
377 |
+ * @author fenris |
|
378 |
+ */ |
|
379 |
+ constructor(); |
|
380 |
+ /** |
|
381 |
+ * @implementation |
|
382 |
+ * @author fenris |
|
383 |
+ */ |
|
384 |
+ encode(x: string): string; |
|
385 |
+ /** |
|
386 |
+ * @implementation |
|
387 |
+ * @author fenris |
|
388 |
+ */ |
|
389 |
+ decode(x: string): string; |
|
390 |
+ } |
|
391 |
+} |
... | ... |
@@ -0,0 +1,1236 @@ |
1 |
+/* |
|
2 |
+This file is part of »bacterio-plankton:code«. |
|
3 |
+ |
|
4 |
+Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
5 |
+<info@greenscale.de> |
|
6 |
+ |
|
7 |
+»bacterio-plankton:code« is free software: you can redistribute it and/or modify |
|
8 |
+it under the terms of the GNU Lesser General Public License as published by |
|
9 |
+the Free Software Foundation, either version 3 of the License, or |
|
10 |
+(at your option) any later version. |
|
11 |
+ |
|
12 |
+»bacterio-plankton:code« is distributed in the hope that it will be useful, |
|
13 |
+but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
14 |
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
15 |
+GNU Lesser General Public License for more details. |
|
16 |
+ |
|
17 |
+You should have received a copy of the GNU Lesser General Public License |
|
18 |
+along with »bacterio-plankton:code«. If not, see <http://www.gnu.org/licenses/>. |
|
19 |
+ */ |
|
20 |
+/* |
|
21 |
+This file is part of »bacterio-plankton:code«. |
|
22 |
+ |
|
23 |
+Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
24 |
+<info@greenscale.de> |
|
25 |
+ |
|
26 |
+»bacterio-plankton:code« is free software: you can redistribute it and/or modify |
|
27 |
+it under the terms of the GNU Lesser General Public License as published by |
|
28 |
+the Free Software Foundation, either version 3 of the License, or |
|
29 |
+(at your option) any later version. |
|
30 |
+ |
|
31 |
+»bacterio-plankton:code« is distributed in the hope that it will be useful, |
|
32 |
+but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
33 |
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
34 |
+GNU Lesser General Public License for more details. |
|
35 |
+ |
|
36 |
+You should have received a copy of the GNU Lesser General Public License |
|
37 |
+along with »bacterio-plankton:code«. If not, see <http://www.gnu.org/licenses/>. |
|
38 |
+ */ |
|
39 |
+var lib_code; |
|
40 |
+(function (lib_code) { |
|
41 |
+ /** |
|
42 |
+ * @author fenris |
|
43 |
+ */ |
|
44 |
+ lib_trait.define("code", { |
|
45 |
+ "from": null, |
|
46 |
+ "to": null |
|
47 |
+ }, { |
|
48 |
+ "encode": { |
|
49 |
+ "shape": { |
|
50 |
+ "name": "function", |
|
51 |
+ "parameters": { |
|
52 |
+ "shape_input": { |
|
53 |
+ "name": "variable", |
|
54 |
+ "parameters": { |
|
55 |
+ "name": "from" |
|
56 |
+ } |
|
57 |
+ }, |
|
58 |
+ "shape_output": { |
|
59 |
+ "name": "variable", |
|
60 |
+ "parameters": { |
|
61 |
+ "name": "to" |
|
62 |
+ } |
|
63 |
+ } |
|
64 |
+ } |
|
65 |
+ } |
|
66 |
+ }, |
|
67 |
+ "decode": { |
|
68 |
+ "shape": { |
|
69 |
+ "name": "function", |
|
70 |
+ "parameters": { |
|
71 |
+ "shape_input": { |
|
72 |
+ "name": "variable", |
|
73 |
+ "parameters": { |
|
74 |
+ "name": "to" |
|
75 |
+ } |
|
76 |
+ }, |
|
77 |
+ "shape_output": { |
|
78 |
+ "name": "variable", |
|
79 |
+ "parameters": { |
|
80 |
+ "name": "from" |
|
81 |
+ } |
|
82 |
+ } |
|
83 |
+ } |
|
84 |
+ } |
|
85 |
+ } |
|
86 |
+ }); |
|
87 |
+})(lib_code || (lib_code = {})); |
|
88 |
+/* |
|
89 |
+This file is part of »bacterio-plankton:code«. |
|
90 |
+ |
|
91 |
+Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
92 |
+<info@greenscale.de> |
|
93 |
+ |
|
94 |
+»bacterio-plankton:code« is free software: you can redistribute it and/or modify |
|
95 |
+it under the terms of the GNU Lesser General Public License as published by |
|
96 |
+the Free Software Foundation, either version 3 of the License, or |
|
97 |
+(at your option) any later version. |
|
98 |
+ |
|
99 |
+»bacterio-plankton:code« is distributed in the hope that it will be useful, |
|
100 |
+but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
101 |
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
102 |
+GNU Lesser General Public License for more details. |
|
103 |
+ |
|
104 |
+You should have received a copy of the GNU Lesser General Public License |
|
105 |
+along with »bacterio-plankton:code«. If not, see <http://www.gnu.org/licenses/>. |
|
106 |
+ */ |
|
107 |
+var lib_code; |
|
108 |
+(function (lib_code) { |
|
109 |
+ /** |
|
110 |
+ * @author Christian Fraß <frass@greenscale.de> |
|
111 |
+ */ |
|
112 |
+ function custom_encode(function_, from) { |
|
113 |
+ return function_(from); |
|
114 |
+ } |
|
115 |
+ lib_code.custom_encode = custom_encode; |
|
116 |
+ /** |
|
117 |
+ * @author Christian Fraß <frass@greenscale.de> |
|
118 |
+ */ |
|
119 |
+ function custom_decode(function_, to) { |
|
120 |
+ return function_(to); |
|
121 |
+ } |
|
122 |
+ lib_code.custom_decode = custom_decode; |
|
123 |
+})(lib_code || (lib_code = {})); |
|
124 |
+/* |
|
125 |
+This file is part of »bacterio-plankton:code«. |
|
126 |
+ |
|
127 |
+Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
128 |
+<info@greenscale.de> |
|
129 |
+ |
|
130 |
+»bacterio-plankton:code« is free software: you can redistribute it and/or modify |
|
131 |
+it under the terms of the GNU Lesser General Public License as published by |
|
132 |
+the Free Software Foundation, either version 3 of the License, or |
|
133 |
+(at your option) any later version. |
|
134 |
+ |
|
135 |
+»bacterio-plankton:code« is distributed in the hope that it will be useful, |
|
136 |
+but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
137 |
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
138 |
+GNU Lesser General Public License for more details. |
|
139 |
+ |
|
140 |
+You should have received a copy of the GNU Lesser General Public License |
|
141 |
+along with »bacterio-plankton:code«. If not, see <http://www.gnu.org/licenses/>. |
|
142 |
+ */ |
|
143 |
+var lib_code; |
|
144 |
+(function (lib_code) { |
|
145 |
+ /** |
|
146 |
+ * @author fenris |
|
147 |
+ */ |
|
148 |
+ class class_code_custom { |
|
149 |
+ /** |
|
150 |
+ * @author fenris |
|
151 |
+ */ |
|
152 |
+ constructor(encodefunc, decodefunc) { |
|
153 |
+ this.encodefunc = encodefunc; |
|
154 |
+ this.decodefunc = decodefunc; |
|
155 |
+ } |
|
156 |
+ /** |
|
157 |
+ * @implementation |
|
158 |
+ * @author fenris |
|
159 |
+ */ |
|
160 |
+ encode(x) { |
|
161 |
+ return lib_code.custom_encode(this.encodefunc, x); |
|
162 |
+ } |
|
163 |
+ /** |
|
164 |
+ * @implementation |
|
165 |
+ * @author fenris |
|
166 |
+ */ |
|
167 |
+ decode(x) { |
|
168 |
+ return lib_code.custom_decode(this.decodefunc, x); |
|
169 |
+ } |
|
170 |
+ } |
|
171 |
+ lib_code.class_code_custom = class_code_custom; |
|
172 |
+})(lib_code || (lib_code = {})); |
|
173 |
+/* |
|
174 |
+This file is part of »bacterio-plankton:code«. |
|
175 |
+ |
|
176 |
+Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
177 |
+<info@greenscale.de> |
|
178 |
+ |
|
179 |
+»bacterio-plankton:code« is free software: you can redistribute it and/or modify |
|
180 |
+it under the terms of the GNU Lesser General Public License as published by |
|
181 |
+the Free Software Foundation, either version 3 of the License, or |
|
182 |
+(at your option) any later version. |
|
183 |
+ |
|
184 |
+»bacterio-plankton:code« is distributed in the hope that it will be useful, |
|
185 |
+but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
186 |
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
187 |
+GNU Lesser General Public License for more details. |
|
188 |
+ |
|
189 |
+You should have received a copy of the GNU Lesser General Public License |
|
190 |
+along with »bacterio-plankton:code«. If not, see <http://www.gnu.org/licenses/>. |
|
191 |
+ */ |
|
192 |
+var lib_code; |
|
193 |
+(function (lib_code) { |
|
194 |
+ /** |
|
195 |
+ * @author fenris |
|
196 |
+ */ |
|
197 |
+ function inverse_encode(decode, to) { |
|
198 |
+ return decode(to); |
|
199 |
+ } |
|
200 |
+ lib_code.inverse_encode = inverse_encode; |
|
201 |
+ /** |
|
202 |
+ * @author fenris |
|
203 |
+ */ |
|
204 |
+ function inverse_decode(encode, from) { |
|
205 |
+ return encode(from); |
|
206 |
+ } |
|
207 |
+ lib_code.inverse_decode = inverse_decode; |
|
208 |
+})(lib_code || (lib_code = {})); |
|
209 |
+/* |
|
210 |
+This file is part of »bacterio-plankton:code«. |
|
211 |
+ |
|
212 |
+Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
213 |
+<info@greenscale.de> |
|
214 |
+ |
|
215 |
+»bacterio-plankton:code« is free software: you can redistribute it and/or modify |
|
216 |
+it under the terms of the GNU Lesser General Public License as published by |
|
217 |
+the Free Software Foundation, either version 3 of the License, or |
|
218 |
+(at your option) any later version. |
|
219 |
+ |
|
220 |
+»bacterio-plankton:code« is distributed in the hope that it will be useful, |
|
221 |
+but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
222 |
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
223 |
+GNU Lesser General Public License for more details. |
|
224 |
+ |
|
225 |
+You should have received a copy of the GNU Lesser General Public License |
|
226 |
+along with »bacterio-plankton:code«. If not, see <http://www.gnu.org/licenses/>. |
|
227 |
+ */ |
|
228 |
+var lib_code; |
|
229 |
+(function (lib_code) { |
|
230 |
+ /** |
|
231 |
+ * @author fenris |
|
232 |
+ */ |
|
233 |
+ lib_trait.attend("code", "inverse", { |
|
234 |
+ "from": { |
|
235 |
+ "name": "any" |
|
236 |
+ }, |
|
237 |
+ "to": { |
|
238 |
+ "name": "any" |
|
239 |
+ } |
|
240 |
+ }, { |
|
241 |
+ "encode": (domain_parameters) => (x) => { |
|
242 |
+ return (lib_code.inverse_encode(y_ => lib_trait.call("code", "decode", domain_parameters.domain_subject)(y_), x)); |
|
243 |
+ }, |
|
244 |
+ "decode": (domain_parameters) => (y) => { |
|
245 |
+ return (lib_code.inverse_decode(x_ => lib_trait.call("code", "encode", domain_parameters.domain_subject)(x_), y)); |
|
246 |
+ } |
|
247 |
+ }); |
|
248 |
+})(lib_code || (lib_code = {})); |
|
249 |
+/* |
|
250 |
+This file is part of »bacterio-plankton:code«. |
|
251 |
+ |
|
252 |
+Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
253 |
+<info@greenscale.de> |
|
254 |
+ |
|
255 |
+»bacterio-plankton:code« is free software: you can redistribute it and/or modify |
|
256 |
+it under the terms of the GNU Lesser General Public License as published by |
|
257 |
+the Free Software Foundation, either version 3 of the License, or |
|
258 |
+(at your option) any later version. |
|
259 |
+ |
|
260 |
+»bacterio-plankton:code« is distributed in the hope that it will be useful, |
|
261 |
+but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
262 |
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
263 |
+GNU Lesser General Public License for more details. |
|
264 |
+ |
|
265 |
+You should have received a copy of the GNU Lesser General Public License |
|
266 |
+along with »bacterio-plankton:code«. If not, see <http://www.gnu.org/licenses/>. |
|
267 |
+ */ |
|
268 |
+var lib_code; |
|
269 |
+(function (lib_code) { |
|
270 |
+ /** |
|
271 |
+ * @author fenris |
|
272 |
+ */ |
|
273 |
+ class class_code_inverse { |
|
274 |
+ /** |
|
275 |
+ * @author fenris |
|
276 |
+ */ |
|
277 |
+ constructor(subject) { |
|
278 |
+ this.subject = subject; |
|
279 |
+ } |
|
280 |
+ /** |
|
281 |
+ * @implementation |
|
282 |
+ * @author fenris |
|
283 |
+ */ |
|
284 |
+ encode(to) { |
|
285 |
+ return lib_code.inverse_encode(x => this.subject.decode(x), to); |
|
286 |
+ } |
|
287 |
+ /** |
|
288 |
+ * @implementation |
|
289 |
+ * @author fenris |
|
290 |
+ */ |
|
291 |
+ decode(from) { |
|
292 |
+ return lib_code.inverse_decode(x => this.subject.encode(x), from); |
|
293 |
+ } |
|
294 |
+ } |
|
295 |
+ lib_code.class_code_inverse = class_code_inverse; |
|
296 |
+})(lib_code || (lib_code = {})); |
|
297 |
+/* |
|
298 |
+This file is part of »bacterio-plankton:code«. |
|
299 |
+ |
|
300 |
+Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
301 |
+<info@greenscale.de> |
|
302 |
+ |
|
303 |
+»bacterio-plankton:code« is free software: you can redistribute it and/or modify |
|
304 |
+it under the terms of the GNU Lesser General Public License as published by |
|
305 |
+the Free Software Foundation, either version 3 of the License, or |
|
306 |
+(at your option) any later version. |
|
307 |
+ |
|
308 |
+»bacterio-plankton:code« is distributed in the hope that it will be useful, |
|
309 |
+but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
310 |
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
311 |
+GNU Lesser General Public License for more details. |
|
312 |
+ |
|
313 |
+You should have received a copy of the GNU Lesser General Public License |
|
314 |
+along with »bacterio-plankton:code«. If not, see <http://www.gnu.org/licenses/>. |
|
315 |
+ */ |
|
316 |
+var lib_code; |
|
317 |
+(function (lib_code) { |
|
318 |
+ /** |
|
319 |
+ * @author fenris |
|
320 |
+ */ |
|
321 |
+ function pair_encode(encode_first, encode_second, from) { |
|
322 |
+ let between = encode_first(from); |
|
323 |
+ let to = encode_second(between); |
|
324 |
+ return to; |
|
325 |
+ } |
|
326 |
+ lib_code.pair_encode = pair_encode; |
|
327 |
+ /** |
|
328 |
+ * @author fenris |
|
329 |
+ */ |
|
330 |
+ function pair_decode(decode_first, decode_second, to) { |
|
331 |
+ let between = decode_second(to); |
|
332 |
+ let from = decode_first(between); |
|
333 |
+ return from; |
|
334 |
+ } |
|
335 |
+ lib_code.pair_decode = pair_decode; |
|
336 |
+})(lib_code || (lib_code = {})); |
|
337 |
+/* |
|
338 |
+This file is part of »bacterio-plankton:code«. |
|
339 |
+ |
|
340 |
+Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
341 |
+<info@greenscale.de> |
|
342 |
+ |
|
343 |
+»bacterio-plankton:code« is free software: you can redistribute it and/or modify |
|
344 |
+it under the terms of the GNU Lesser General Public License as published by |
|
345 |
+the Free Software Foundation, either version 3 of the License, or |
|
346 |
+(at your option) any later version. |
|
347 |
+ |
|
348 |
+»bacterio-plankton:code« is distributed in the hope that it will be useful, |
|
349 |
+but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
350 |
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
351 |
+GNU Lesser General Public License for more details. |
|
352 |
+ |
|
353 |
+You should have received a copy of the GNU Lesser General Public License |
|
354 |
+along with »bacterio-plankton:code«. If not, see <http://www.gnu.org/licenses/>. |
|
355 |
+ */ |
|
356 |
+var lib_code; |
|
357 |
+(function (lib_code) { |
|
358 |
+ /** |
|
359 |
+ * @author fenris |
|
360 |
+ */ |
|
361 |
+ lib_trait.attend("code", "pair", { |
|
362 |
+ "from": { |
|
363 |
+ "name": "any" |
|
364 |
+ }, |
|
365 |
+ "to": { |
|
366 |
+ "name": "any" |
|
367 |
+ } |
|
368 |
+ }, { |
|
369 |
+ "encode": (domain_parameters) => (x) => { |
|
370 |
+ return (lib_code.pair_encode(x_ => lib_trait.call("code", "encode", domain_parameters.domain_first)(x_), x_ => lib_trait.call("code", "encode", domain_parameters.domain_second)(x_), x)); |
|
371 |
+ }, |
|
372 |
+ "decode": (domain_parameters) => (y) => { |
|
373 |
+ return (lib_code.pair_decode(y_ => lib_trait.call("code", "decode", domain_parameters.domain_first)(y_), y_ => lib_trait.call("code", "decode", domain_parameters.domain_second)(y_), y)); |
|
374 |
+ } |
|
375 |
+ }); |
|
376 |
+})(lib_code || (lib_code = {})); |
|
377 |
+/* |
|
378 |
+This file is part of »bacterio-plankton:code«. |
|
379 |
+ |
|
380 |
+Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
381 |
+<info@greenscale.de> |
|
382 |
+ |
|
383 |
+»bacterio-plankton:code« is free software: you can redistribute it and/or modify |
|
384 |
+it under the terms of the GNU Lesser General Public License as published by |
|
385 |
+the Free Software Foundation, either version 3 of the License, or |
|
386 |
+(at your option) any later version. |
|
387 |
+ |
|
388 |
+»bacterio-plankton:code« is distributed in the hope that it will be useful, |
|
389 |
+but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
390 |
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
391 |
+GNU Lesser General Public License for more details. |
|
392 |
+ |
|
393 |
+You should have received a copy of the GNU Lesser General Public License |
|
394 |
+along with »bacterio-plankton:code«. If not, see <http://www.gnu.org/licenses/>. |
|
395 |
+ */ |
|
396 |
+var lib_code; |
|
397 |
+(function (lib_code) { |
|
398 |
+ /** |
|
399 |
+ * @author fenris |
|
400 |
+ */ |
|
401 |
+ class class_code_pair { |
|
402 |
+ /** |
|
403 |
+ * @author fenris |
|
404 |
+ */ |
|
405 |
+ constructor(first, second) { |
|
406 |
+ this.first = first; |
|
407 |
+ this.second = second; |
|
408 |
+ } |
|
409 |
+ /** |
|
410 |
+ * @implementation |
|
411 |
+ * @author fenris |
|
412 |
+ */ |
|
413 |
+ encode(from) { |
|
414 |
+ return lib_code.pair_encode(x => this.first.encode(x), x => this.second.encode(x), from); |
|
415 |
+ } |
|
416 |
+ /** |
|
417 |
+ * @implementation |
|
418 |
+ * @author fenris |
|
419 |
+ */ |
|
420 |
+ decode(to) { |
|
421 |
+ return lib_code.pair_decode(x => this.first.decode(x), x => this.second.decode(x), to); |
|
422 |
+ } |
|
423 |
+ } |
|
424 |
+ lib_code.class_code_pair = class_code_pair; |
|
425 |
+})(lib_code || (lib_code = {})); |
|
426 |
+/* |
|
427 |
+This file is part of »bacterio-plankton:code«. |
|
428 |
+ |
|
429 |
+Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
430 |
+<info@greenscale.de> |
|
431 |
+ |
|
432 |
+»bacterio-plankton:code« is free software: you can redistribute it and/or modify |
|
433 |
+it under the terms of the GNU Lesser General Public License as published by |
|
434 |
+the Free Software Foundation, either version 3 of the License, or |
|
435 |
+(at your option) any later version. |
|
436 |
+ |
|
437 |
+»bacterio-plankton:code« is distributed in the hope that it will be useful, |
|
438 |
+but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
439 |
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
440 |
+GNU Lesser General Public License for more details. |
|
441 |
+ |
|
442 |
+You should have received a copy of the GNU Lesser General Public License |
|
443 |
+along with »bacterio-plankton:code«. If not, see <http://www.gnu.org/licenses/>. |
|
444 |
+ */ |
|
445 |
+var lib_code; |
|
446 |
+(function (lib_code) { |
|
447 |
+ /** |
|
448 |
+ * @author fenris |
|
449 |
+ */ |
|
450 |
+ function chain_encode(encode_links, from) { |
|
451 |
+ let value = from; |
|
452 |
+ encode_links |
|
453 |
+ .forEach((link) => { |
|
454 |
+ value = link(value); |
|
455 |
+ }); |
|
456 |
+ return value; |
|
457 |
+ } |
|
458 |
+ lib_code.chain_encode = chain_encode; |
|
459 |
+ /** |
|
460 |
+ * @author fenris |
|
461 |
+ */ |
|
462 |
+ function chain_decode(decode_links, to) { |
|
463 |
+ let value = to; |
|
464 |
+ decode_links |
|
465 |
+ .reverse() |
|
466 |
+ .forEach((link) => { |
|
467 |
+ value = link(value); |
|
468 |
+ }); |
|
469 |
+ return value; |
|
470 |
+ } |
|
471 |
+ lib_code.chain_decode = chain_decode; |
|
472 |
+})(lib_code || (lib_code = {})); |
|
473 |
+/* |
|
474 |
+This file is part of »bacterio-plankton:code«. |
|
475 |
+ |
|
476 |
+Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
477 |
+<info@greenscale.de> |
|
478 |
+ |
|
479 |
+»bacterio-plankton:code« is free software: you can redistribute it and/or modify |
|
480 |
+it under the terms of the GNU Lesser General Public License as published by |
|
481 |
+the Free Software Foundation, either version 3 of the License, or |
|
482 |
+(at your option) any later version. |
|
483 |
+ |
|
484 |
+»bacterio-plankton:code« is distributed in the hope that it will be useful, |
|
485 |
+but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
486 |
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
487 |
+GNU Lesser General Public License for more details. |
|
488 |
+ |
|
489 |
+You should have received a copy of the GNU Lesser General Public License |
|
490 |
+along with »bacterio-plankton:code«. If not, see <http://www.gnu.org/licenses/>. |
|
491 |
+ */ |
|
492 |
+var lib_code; |
|
493 |
+(function (lib_code) { |
|
494 |
+ /** |
|
495 |
+ * @author fenris |
|
496 |
+ */ |
|
497 |
+ class class_code_chain { |
|
498 |
+ /** |
|
499 |
+ * @author fenris |
|
500 |
+ */ |
|
501 |
+ constructor(links) { |
|
502 |
+ this.links = links; |
|
503 |
+ } |
|
504 |
+ /** |
|
505 |
+ * @implementation |
|
506 |
+ * @author fenris |
|
507 |
+ */ |
|
508 |
+ encode(from) { |
|
509 |
+ return lib_code.chain_encode(this.links.map((link) => (x => link.encode(x))), from); |
|
510 |
+ } |
|
511 |
+ /** |
|
512 |
+ * @implementation |
|
513 |
+ * @author fenris |
|
514 |
+ */ |
|
515 |
+ decode(to) { |
|
516 |
+ return lib_code.chain_decode(this.links.map((link) => (x => link.decode(x))), to); |
|
517 |
+ } |
|
518 |
+ } |
|
519 |
+ lib_code.class_code_chain = class_code_chain; |
|
520 |
+})(lib_code || (lib_code = {})); |
|
521 |
+/* |
|
522 |
+This file is part of »bacterio-plankton:code«. |
|
523 |
+ |
|
524 |
+Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
525 |
+<info@greenscale.de> |
|
526 |
+ |
|
527 |
+»bacterio-plankton:code« is free software: you can redistribute it and/or modify |
|
528 |
+it under the terms of the GNU Lesser General Public License as published by |
|
529 |
+the Free Software Foundation, either version 3 of the License, or |
|
530 |
+(at your option) any later version. |
|
531 |
+ |
|
532 |
+»bacterio-plankton:code« is distributed in the hope that it will be useful, |
|
533 |
+but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
534 |
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
535 |
+GNU Lesser General Public License for more details. |
|
536 |
+ |
|
537 |
+You should have received a copy of the GNU Lesser General Public License |
|
538 |
+along with »bacterio-plankton:code«. If not, see <http://www.gnu.org/licenses/>. |
|
539 |
+ */ |
|
540 |
+var lib_code; |
|
541 |
+(function (lib_code) { |
|
542 |
+ /** |
|
543 |
+ * @author Christian Fraß <frass@greenscale.de> |
|
544 |
+ */ |
|
545 |
+ function flatten_encode(from, keys = null) { |
|
546 |
+ if (keys === null) { |
|
547 |
+ if (from.length > 0) { |
|
548 |
+ keys = Object.keys(from[0]); |
|
549 |
+ } |
|
550 |
+ else { |
|
551 |
+ throw (new Error("encoding impossible")); |
|
552 |
+ } |
|
553 |
+ } |
|
554 |
+ return { |
|
555 |
+ "keys": keys, |
|
556 |
+ "data": from.map((line) => keys.map((name) => line[name])), |
|
557 |
+ }; |
|
558 |
+ } |
|
559 |
+ lib_code.flatten_encode = flatten_encode; |
|
560 |
+ /** |
|
561 |
+ * @author Christian Fraß <frass@greenscale.de> |
|
562 |
+ */ |
|
563 |
+ function flatten_decode(to) { |
|
564 |
+ return (to.data |
|
565 |
+ .map((dataset) => { |
|
566 |
+ let dataset_ = {}; |
|
567 |
+ dataset |
|
568 |
+ .forEach((value, index) => { |
|
569 |
+ const name = to.keys[index]; |
|
570 |
+ dataset_[name] = value; |
|
571 |
+ }); |
|
572 |
+ return dataset_; |
|
573 |
+ })); |
|
574 |
+ } |
|
575 |
+ lib_code.flatten_decode = flatten_decode; |
|
576 |
+})(lib_code || (lib_code = {})); |
|
577 |
+/* |
|
578 |
+This file is part of »bacterio-plankton:code«. |
|
579 |
+ |
|
580 |
+Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
581 |
+<info@greenscale.de> |
|
582 |
+ |
|
583 |
+»bacterio-plankton:code« is free software: you can redistribute it and/or modify |
|
584 |
+it under the terms of the GNU Lesser General Public License as published by |
|
585 |
+the Free Software Foundation, either version 3 of the License, or |
|
586 |
+(at your option) any later version. |
|
587 |
+ |
|
588 |
+»bacterio-plankton:code« is distributed in the hope that it will be useful, |
|
589 |
+but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
590 |
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
591 |
+GNU Lesser General Public License for more details. |
|
592 |
+ |
|
593 |
+You should have received a copy of the GNU Lesser General Public License |
|
594 |
+along with »bacterio-plankton:code«. If not, see <http://www.gnu.org/licenses/>. |
|
595 |
+ */ |
|
596 |
+var lib_code; |
|
597 |
+(function (lib_code) { |
|
598 |
+ /** |
|
599 |
+ * @author fenris |
|
600 |
+ */ |
|
601 |
+ class class_code_flatten { |
|
602 |
+ /** |
|
603 |
+ * @author fenris |
|
604 |
+ */ |
|
605 |
+ constructor() { |
|
606 |
+ } |
|
607 |
+ /** |
|
608 |
+ * @implementation |
|
609 |
+ * @author fenris |
|
610 |
+ */ |
|
611 |
+ encode(x) { |
|
612 |
+ return lib_code.flatten_encode(x); |
|
613 |
+ } |
|
614 |
+ /** |
|
615 |
+ * @implementation |
|
616 |
+ * @author fenris |
|
617 |
+ */ |
|
618 |
+ decode(x) { |
|
619 |
+ return lib_code.flatten_decode(x); |
|
620 |
+ } |
|
621 |
+ } |
|
622 |
+ lib_code.class_code_flatten = class_code_flatten; |
|
623 |
+})(lib_code || (lib_code = {})); |
|
624 |
+/* |
|
625 |
+This file is part of »bacterio-plankton:code«. |
|
626 |
+ |
|
627 |
+Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
628 |
+<info@greenscale.de> |
|
629 |
+ |
|
630 |
+»bacterio-plankton:code« is free software: you can redistribute it and/or modify |
|
631 |
+it under the terms of the GNU Lesser General Public License as published by |
|
632 |
+the Free Software Foundation, either version 3 of the License, or |
|
633 |
+(at your option) any later version. |
|
634 |
+ |
|
635 |
+»bacterio-plankton:code« is distributed in the hope that it will be useful, |
|
636 |
+but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
637 |
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
638 |
+GNU Lesser General Public License for more details. |
|
639 |
+ |
|
640 |
+You should have received a copy of the GNU Lesser General Public License |
|
641 |
+along with »bacterio-plankton:code«. If not, see <http://www.gnu.org/licenses/>. |
|
642 |
+ */ |
|
643 |
+var lib_code; |
|
644 |
+(function (lib_code) { |
|
645 |
+ /** |
|
646 |
+ * @author fenris |
|
647 |
+ */ |
|
648 |
+ const _prefix = "DATE:"; |
|
649 |
+ /** |
|
650 |
+ * @author fenris |
|
651 |
+ */ |
|
652 |
+ function jsdate_encode(date) { |
|
653 |
+ let isostring = date.toISOString(); |
|
654 |
+ let date_ = (_prefix + isostring); |
|
655 |
+ return date_; |
|
656 |
+ } |
|
657 |
+ lib_code.jsdate_encode = jsdate_encode; |
|
658 |
+ /** |
|
659 |
+ * @author fenris |
|
660 |
+ */ |
|
661 |
+ function jsdate_decode(date_) { |
|
662 |
+ if ((typeof (date_) === "string") && (date_.startsWith(_prefix))) { |
|
663 |
+ let isostring = date_.slice(_prefix.length); |
|
664 |
+ let timestamp = Date.parse(isostring); |
|
665 |
+ if (!isNaN(timestamp)) { |
|
666 |
+ let date = (new Date(timestamp)); |
|
667 |
+ return date; |
|
668 |
+ } |
|
669 |
+ else { |
|
670 |
+ let message = ("'" + isostring + "' does not seem to be an ISO-string of a date"); |
|
671 |
+ throw (new Error(message)); |
|
672 |
+ } |
|
673 |
+ } |
|
674 |
+ else { |
|
675 |
+ let message = ("expected an encoded date object to be a string starting with '" + _prefix + "'"); |
|
676 |
+ throw (new Error(message)); |
|
677 |
+ } |
|
678 |
+ } |
|
679 |
+ lib_code.jsdate_decode = jsdate_decode; |
|
680 |
+})(lib_code || (lib_code = {})); |
|
681 |
+/* |
|
682 |
+This file is part of »bacterio-plankton:code«. |
|
683 |
+ |
|
684 |
+Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
685 |
+<info@greenscale.de> |
|
686 |
+ |
|
687 |
+»bacterio-plankton:code« is free software: you can redistribute it and/or modify |
|
688 |
+it under the terms of the GNU Lesser General Public License as published by |
|
689 |
+the Free Software Foundation, either version 3 of the License, or |
|
690 |
+(at your option) any later version. |
|
691 |
+ |
|
692 |
+»bacterio-plankton:code« is distributed in the hope that it will be useful, |
|
693 |
+but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
694 |
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
695 |
+GNU Lesser General Public License for more details. |
|
696 |
+ |
|
697 |
+You should have received a copy of the GNU Lesser General Public License |
|
698 |
+along with »bacterio-plankton:code«. If not, see <http://www.gnu.org/licenses/>. |
|
699 |
+ */ |
|
700 |
+var lib_code; |
|
701 |
+(function (lib_code) { |
|
702 |
+ /** |
|
703 |
+ * @author fenris |
|
704 |
+ */ |
|
705 |
+ lib_trait.attend("code", "jsdate", { |
|
706 |
+ "from": { |
|
707 |
+ "name": "date" |
|
708 |
+ }, |
|
709 |
+ "to": { |
|
710 |
+ "name": "string" |
|
711 |
+ } |
|
712 |
+ }, { |
|
713 |
+ "encode": () => (x) => { |
|
714 |
+ return lib_code.jsdate_encode(x); |
|
715 |
+ }, |
|
716 |
+ "decode": () => (y) => { |
|
717 |
+ return lib_code.jsdate_decode(y); |
|
718 |
+ } |
|
719 |
+ }); |
|
720 |
+})(lib_code || (lib_code = {})); |
|
721 |
+/* |
|
722 |
+This file is part of »bacterio-plankton:code«. |
|
723 |
+ |
|
724 |
+Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
725 |
+<info@greenscale.de> |
|
726 |
+ |
|
727 |
+»bacterio-plankton:code« is free software: you can redistribute it and/or modify |
|
728 |
+it under the terms of the GNU Lesser General Public License as published by |
|
729 |
+the Free Software Foundation, either version 3 of the License, or |
|
730 |
+(at your option) any later version. |
|
731 |
+ |
|
732 |
+»bacterio-plankton:code« is distributed in the hope that it will be useful, |
|
733 |
+but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
734 |
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
735 |
+GNU Lesser General Public License for more details. |
|
736 |
+ |
|
737 |
+You should have received a copy of the GNU Lesser General Public License |
|
738 |
+along with »bacterio-plankton:code«. If not, see <http://www.gnu.org/licenses/>. |
|
739 |
+ */ |
|
740 |
+var lib_code; |
|
741 |
+(function (lib_code) { |
|
742 |
+ /** |
|
743 |
+ * @author fenris |
|
744 |
+ */ |
|
745 |
+ class class_code_jsdate { |
|
746 |
+ /** |
|
747 |
+ * @author fenris |
|
748 |
+ */ |
|
749 |
+ constructor() { |
|
750 |
+ } |
|
751 |
+ /** |
|
752 |
+ * @implementation |
|
753 |
+ * @author fenris |
|
754 |
+ */ |
|
755 |
+ encode(x) { |
|
756 |
+ return lib_code.jsdate_encode(x); |
|
757 |
+ } |
|
758 |
+ /** |
|
759 |
+ * @implementation |
|
760 |
+ * @author fenris |
|
761 |
+ */ |
|
762 |
+ decode(x) { |
|
763 |
+ return lib_code.jsdate_decode(x); |
|
764 |
+ } |
|
765 |
+ } |
|
766 |
+ lib_code.class_code_jsdate = class_code_jsdate; |
|
767 |
+})(lib_code || (lib_code = {})); |
|
768 |
+/* |
|
769 |
+This file is part of »bacterio-plankton:code«. |
|
770 |
+ |
|
771 |
+Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
772 |
+<info@greenscale.de> |
|
773 |
+ |
|
774 |
+»bacterio-plankton:code« is free software: you can redistribute it and/or modify |
|
775 |
+it under the terms of the GNU Lesser General Public License as published by |
|
776 |
+the Free Software Foundation, either version 3 of the License, or |
|
777 |
+(at your option) any later version. |
|
778 |
+ |
|
779 |
+»bacterio-plankton:code« is distributed in the hope that it will be useful, |
|
780 |
+but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
781 |
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
782 |
+GNU Lesser General Public License for more details. |
|
783 |
+ |
|
784 |
+You should have received a copy of the GNU Lesser General Public License |
|
785 |
+along with »bacterio-plankton:code«. If not, see <http://www.gnu.org/licenses/>. |
|
786 |
+ */ |
|
787 |
+var lib_code; |
|
788 |
+(function (lib_code) { |
|
789 |
+ /** |
|
790 |
+ * @author fenris |
|
791 |
+ */ |
|
792 |
+ function json_encode(x, formatted = false) { |
|
793 |
+ return JSON.stringify(x, undefined, formatted ? "\t" : undefined); |
|
794 |
+ } |
|
795 |
+ lib_code.json_encode = json_encode; |
|
796 |
+ /** |
|
797 |
+ * @author fenris |
|
798 |
+ */ |
|
799 |
+ function json_decode(x) { |
|
800 |
+ return JSON.parse(x); |
|
801 |
+ } |
|
802 |
+ lib_code.json_decode = json_decode; |
|
803 |
+})(lib_code || (lib_code = {})); |
|
804 |
+/* |
|
805 |
+This file is part of »bacterio-plankton:code«. |
|
806 |
+ |
|
807 |
+Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
808 |
+<info@greenscale.de> |
|
809 |
+ |
|
810 |
+»bacterio-plankton:code« is free software: you can redistribute it and/or modify |
|
811 |
+it under the terms of the GNU Lesser General Public License as published by |
|
812 |
+the Free Software Foundation, either version 3 of the License, or |
|
813 |
+(at your option) any later version. |
|
814 |
+ |
|
815 |
+»bacterio-plankton:code« is distributed in the hope that it will be useful, |
|
816 |
+but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
817 |
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
818 |
+GNU Lesser General Public License for more details. |
|
819 |
+ |
|
820 |
+You should have received a copy of the GNU Lesser General Public License |
|
821 |
+along with »bacterio-plankton:code«. If not, see <http://www.gnu.org/licenses/>. |
|
822 |
+ */ |
|
823 |
+var lib_code; |
|
824 |
+(function (lib_code) { |
|
825 |
+ /** |
|
826 |
+ * @author fenris |
|
827 |
+ */ |
|
828 |
+ lib_trait.attend("code", "json", { |
|
829 |
+ "from": { |
|
830 |
+ "name": "any" |
|
831 |
+ }, |
|
832 |
+ "to": { |
|
833 |
+ "name": "string" |
|
834 |
+ } |
|
835 |
+ }, { |
|
836 |
+ "encode": () => (x) => { |
|
837 |
+ return lib_code.json_encode(x); |
|
838 |
+ }, |
|
839 |
+ "decode": () => (y) => { |
|
840 |
+ return lib_code.json_decode(y); |
|
841 |
+ } |
|
842 |
+ }); |
|
843 |
+})(lib_code || (lib_code = {})); |
|
844 |
+/* |
|
845 |
+This file is part of »bacterio-plankton:code«. |
|
846 |
+ |
|
847 |
+Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
848 |
+<info@greenscale.de> |
|
849 |
+ |
|
850 |
+»bacterio-plankton:code« is free software: you can redistribute it and/or modify |
|
851 |
+it under the terms of the GNU Lesser General Public License as published by |
|
852 |
+the Free Software Foundation, either version 3 of the License, or |
|
853 |
+(at your option) any later version. |
|
854 |
+ |
|
855 |
+»bacterio-plankton:code« is distributed in the hope that it will be useful, |
|
856 |
+but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
857 |
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
858 |
+GNU Lesser General Public License for more details. |
|
859 |
+ |
|
860 |
+You should have received a copy of the GNU Lesser General Public License |
|
861 |
+along with »bacterio-plankton:code«. If not, see <http://www.gnu.org/licenses/>. |
|
862 |
+ */ |
|
863 |
+var lib_code; |
|
864 |
+(function (lib_code) { |
|
865 |
+ /** |
|
866 |
+ * @author fenris |
|
867 |
+ */ |
|
868 |
+ class class_code_json { |
|
869 |
+ /** |
|
870 |
+ * @author fenris |
|
871 |
+ */ |
|
872 |
+ constructor() { |
|
873 |
+ } |
|
874 |
+ /** |
|
875 |
+ * @implementation |
|
876 |
+ * @author fenris |
|
877 |
+ */ |
|
878 |
+ encode(x) { |
|
879 |
+ return lib_code.json_encode(x); |
|
880 |
+ } |
|
881 |
+ /** |
|
882 |
+ * @implementation |
|
883 |
+ * @author fenris |
|
884 |
+ */ |
|
885 |
+ decode(x) { |
|
886 |
+ return lib_code.json_decode(x); |
|
887 |
+ } |
|
888 |
+ } |
|
889 |
+ lib_code.class_code_json = class_code_json; |
|
890 |
+})(lib_code || (lib_code = {})); |
|
891 |
+/* |
|
892 |
+This file is part of »bacterio-plankton:code«. |
|
893 |
+ |
|
894 |
+Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
895 |
+<info@greenscale.de> |
|
896 |
+ |
|
897 |
+»bacterio-plankton:code« is free software: you can redistribute it and/or modify |
|
898 |
+it under the terms of the GNU Lesser General Public License as published by |
|
899 |
+the Free Software Foundation, either version 3 of the License, or |
|
900 |
+(at your option) any later version. |
|
901 |
+ |
|
902 |
+»bacterio-plankton:code« is distributed in the hope that it will be useful, |
|
903 |
+but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
904 |
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
905 |
+GNU Lesser General Public License for more details. |
|
906 |
+ |
|
907 |
+You should have received a copy of the GNU Lesser General Public License |
|
908 |
+along with »bacterio-plankton:code«. If not, see <http://www.gnu.org/licenses/>. |
|
909 |
+ */ |
|
910 |
+var lib_code; |
|
911 |
+(function (lib_code) { |
|
912 |
+ /** |
|
913 |
+ * @author Christian Fraß <frass@greenscale.de> |
|
914 |
+ * @todo escaping |
|
915 |
+ */ |
|
916 |
+ function csv_encode(from, { "delimiter": delimiter = ",", "linebreak": linebreak = "\n", } = {}) { |
|
917 |
+ return (([] |
|
918 |
+ .concat((from.head !== null) |
|
919 |
+ ? [from.head] |
|
920 |
+ : []) |
|
921 |
+ .concat(from.data)) |
|
922 |
+ .map((dataset) => dataset.join(delimiter)) |
|
923 |
+ .join(linebreak)); |
|
924 |
+ } |
|
925 |
+ lib_code.csv_encode = csv_encode; |
|
926 |
+ /** |
|
927 |
+ * @author Christian Fraß <frass@greenscale.de> |
|
928 |
+ */ |
|
929 |
+ function csv_decode(to, { "delimiter": delimiter = ",", "linebreak": linebreak = "\n", "with_head": with_head = true, } = {}) { |
|
930 |
+ const array = (to.split(linebreak) |
|
931 |
+ .map((line) => line.split(delimiter))); |
|
932 |
+ return (with_head |
|
933 |
+ ? ({ |
|
934 |
+ "head": array[0], |
|
935 |
+ "data": array.slice(1), |
|
936 |
+ }) |
|
937 |
+ : ({ |
|
938 |
+ "head": null, |
|
939 |
+ "data": array, |
|
940 |
+ })); |
|
941 |
+ } |
|
942 |
+ lib_code.csv_decode = csv_decode; |
|
943 |
+})(lib_code || (lib_code = {})); |
|
944 |
+/* |
|
945 |
+This file is part of »bacterio-plankton:code«. |
|
946 |
+ |
|
947 |
+Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
948 |
+<info@greenscale.de> |
|
949 |
+ |
|
950 |
+»bacterio-plankton:code« is free software: you can redistribute it and/or modify |
|
951 |
+it under the terms of the GNU Lesser General Public License as published by |
|
952 |
+the Free Software Foundation, either version 3 of the License, or |
|
953 |
+(at your option) any later version. |
|
954 |
+ |
|
955 |
+»bacterio-plankton:code« is distributed in the hope that it will be useful, |
|
956 |
+but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
957 |
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
958 |
+GNU Lesser General Public License for more details. |
|
959 |
+ |
|
960 |
+You should have received a copy of the GNU Lesser General Public License |
|
961 |
+along with »bacterio-plankton:code«. If not, see <http://www.gnu.org/licenses/>. |
|
962 |
+ */ |
|
963 |
+var lib_code; |
|
964 |
+(function (lib_code) { |
|
965 |
+ /** |
|
966 |
+ * @author fenris |
|
967 |
+ */ |
|
968 |
+ class class_code_csv { |
|
969 |
+ /** |
|
970 |
+ * @author fenris |
|
971 |
+ */ |
|
972 |
+ constructor() { |
|
973 |
+ } |
|
974 |
+ /** |
|
975 |
+ * @implementation |
|
976 |
+ * @author fenris |
|
977 |
+ */ |
|
978 |
+ encode(x) { |
|
979 |
+ return lib_code.csv_encode(x); |
|
980 |
+ } |
|
981 |
+ /** |
|
982 |
+ * @implementation |
|
983 |
+ * @author fenris |
|
984 |
+ */ |
|
985 |
+ decode(x) { |
|
986 |
+ return lib_code.csv_decode(x); |
|
987 |
+ } |
|
988 |
+ } |
|
989 |
+ lib_code.class_code_csv = class_code_csv; |
|
990 |
+})(lib_code || (lib_code = {})); |
|
991 |
+/* |
|
992 |
+This file is part of »bacterio-plankton:code«. |
|
993 |
+ |
|
994 |
+Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
995 |
+<info@greenscale.de> |
|
996 |
+ |
|
997 |
+»bacterio-plankton:code« is free software: you can redistribute it and/or modify |
|
998 |
+it under the terms of the GNU Lesser General Public License as published by |
|
999 |
+the Free Software Foundation, either version 3 of the License, or |
|
1000 |
+(at your option) any later version. |
|
1001 |
+ |
|
1002 |
+»bacterio-plankton:code« is distributed in the hope that it will be useful, |
|
1003 |
+but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
1004 |
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
1005 |
+GNU Lesser General Public License for more details. |
|
1006 |
+ |
|
1007 |
+You should have received a copy of the GNU Lesser General Public License |
|
1008 |
+along with »bacterio-plankton:code«. If not, see <http://www.gnu.org/licenses/>. |
|
1009 |
+ */ |
|
1010 |
+var lib_code; |
|
1011 |
+(function (lib_code) { |
|
1012 |
+ /** |
|
1013 |
+ * @author fenris |
|
1014 |
+ */ |
|
1015 |
+ function uri_encode(x) { |
|
1016 |
+ return encodeURIComponent(x); |
|
1017 |
+ } |
|
1018 |
+ lib_code.uri_encode = uri_encode; |
|
1019 |
+ /** |
|
1020 |
+ * @author fenris |
|
1021 |
+ */ |
|
1022 |
+ function uri_decode(x) { |
|
1023 |
+ return decodeURIComponent(x); |
|
1024 |
+ } |
|
1025 |
+ lib_code.uri_decode = uri_decode; |
|
1026 |
+})(lib_code || (lib_code = {})); |
|
1027 |
+/* |
|
1028 |
+This file is part of »bacterio-plankton:code«. |
|
1029 |
+ |
|
1030 |
+Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
1031 |
+<info@greenscale.de> |
|
1032 |
+ |
|
1033 |
+»bacterio-plankton:code« is free software: you can redistribute it and/or modify |
|
1034 |
+it under the terms of the GNU Lesser General Public License as published by |
|
1035 |
+the Free Software Foundation, either version 3 of the License, or |
|
1036 |
+(at your option) any later version. |
|
1037 |
+ |
|
1038 |
+»bacterio-plankton:code« is distributed in the hope that it will be useful, |
|
1039 |
+but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
1040 |
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
1041 |
+GNU Lesser General Public License for more details. |
|
1042 |
+ |
|
1043 |
+You should have received a copy of the GNU Lesser General Public License |
|
1044 |
+along with »bacterio-plankton:code«. If not, see <http://www.gnu.org/licenses/>. |
|
1045 |
+ */ |
|
1046 |
+var lib_code; |
|
1047 |
+(function (lib_code) { |
|
1048 |
+ /** |
|
1049 |
+ * @author fenris |
|
1050 |
+ */ |
|
1051 |
+ lib_trait.attend("code", "uri", { |
|
1052 |
+ "from": { |
|
1053 |
+ "name": "string" |
|
1054 |
+ }, |
|
1055 |
+ "to": { |
|
1056 |
+ "name": "string" |
|
1057 |
+ } |
|
1058 |
+ }, { |
|
1059 |
+ "encode": () => (x) => { |
|
1060 |
+ return lib_code.uri_encode(x); |
|
1061 |
+ }, |
|
1062 |
+ "decode": () => (y) => { |
|
1063 |
+ return lib_code.uri_decode(y); |
|
1064 |
+ } |
|
1065 |
+ }); |
|
1066 |
+})(lib_code || (lib_code = {})); |
|
1067 |
+/* |
|
1068 |
+This file is part of »bacterio-plankton:code«. |
|
1069 |
+ |
|
1070 |
+Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
1071 |
+<info@greenscale.de> |
|
1072 |
+ |
|
1073 |
+»bacterio-plankton:code« is free software: you can redistribute it and/or modify |
|
1074 |
+it under the terms of the GNU Lesser General Public License as published by |
|
1075 |
+the Free Software Foundation, either version 3 of the License, or |
|
1076 |
+(at your option) any later version. |
|
1077 |
+ |
|
1078 |
+»bacterio-plankton:code« is distributed in the hope that it will be useful, |
|
1079 |
+but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
1080 |
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
1081 |
+GNU Lesser General Public License for more details. |
|
1082 |
+ |
|
1083 |
+You should have received a copy of the GNU Lesser General Public License |
|
1084 |
+along with »bacterio-plankton:code«. If not, see <http://www.gnu.org/licenses/>. |
|
1085 |
+ */ |
|
1086 |
+var lib_code; |
|
1087 |
+(function (lib_code) { |
|
1088 |
+ /** |
|
1089 |
+ * @author fenris |
|
1090 |
+ */ |
|
1091 |
+ class class_code_uri { |
|
1092 |
+ /** |
|
1093 |
+ * @author fenris |
|
1094 |
+ */ |
|
1095 |
+ constructor() { |
|
1096 |
+ } |
|
1097 |
+ /** |
|
1098 |
+ * @implementation |
|
1099 |
+ * @author fenris |
|
1100 |
+ */ |
|
1101 |
+ encode(x) { |
|
1102 |
+ return lib_code.uri_encode(x); |
|
1103 |
+ } |
|
1104 |
+ /** |
|
1105 |
+ * @implementation |
|
1106 |
+ * @author fenris |
|
1107 |
+ */ |
|
1108 |
+ decode(x) { |
|
1109 |
+ return lib_code.uri_decode(x); |
|
1110 |
+ } |
|
1111 |
+ } |
|
1112 |
+ lib_code.class_code_uri = class_code_uri; |
|
1113 |
+})(lib_code || (lib_code = {})); |
|
1114 |
+/* |
|
1115 |
+This file is part of »bacterio-plankton:code«. |
|
1116 |
+ |
|
1117 |
+Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
1118 |
+<info@greenscale.de> |
|
1119 |
+ |
|
1120 |
+»bacterio-plankton:code« is free software: you can redistribute it and/or modify |
|
1121 |
+it under the terms of the GNU Lesser General Public License as published by |
|
1122 |
+the Free Software Foundation, either version 3 of the License, or |
|
1123 |
+(at your option) any later version. |
|
1124 |
+ |
|
1125 |
+»bacterio-plankton:code« is distributed in the hope that it will be useful, |
|
1126 |
+but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
1127 |
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
1128 |
+GNU Lesser General Public License for more details. |
|
1129 |
+ |
|
1130 |
+You should have received a copy of the GNU Lesser General Public License |
|
1131 |
+along with »bacterio-plankton:code«. If not, see <http://www.gnu.org/licenses/>. |
|
1132 |
+ */ |
|
1133 |
+var lib_code; |
|
1134 |
+(function (lib_code) { |
|
1135 |
+ /** |
|
1136 |
+ * @author fenris |
|
1137 |
+ */ |
|
1138 |
+ function base64_encode(x) { |
|
1139 |
+ return (new Buffer(x)).toString("base64"); |
|
1140 |
+ } |
|
1141 |
+ lib_code.base64_encode = base64_encode; |
|
1142 |
+ /** |
|
1143 |
+ * @author fenris |
|
1144 |
+ */ |
|
1145 |
+ function base64_decode(x) { |
|
1146 |
+ return (new Buffer(x, "base64")).toString(); |
|
1147 |
+ } |
|
1148 |
+ lib_code.base64_decode = base64_decode; |
|
1149 |
+})(lib_code || (lib_code = {})); |
|
1150 |
+/* |
|
1151 |
+This file is part of »bacterio-plankton:code«. |
|
1152 |
+ |
|
1153 |
+Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
1154 |
+<info@greenscale.de> |
|
1155 |
+ |
|
1156 |
+»bacterio-plankton:code« is free software: you can redistribute it and/or modify |
|
1157 |
+it under the terms of the GNU Lesser General Public License as published by |
|
1158 |
+the Free Software Foundation, either version 3 of the License, or |
|
1159 |
+(at your option) any later version. |
|
1160 |
+ |
|
1161 |
+»bacterio-plankton:code« is distributed in the hope that it will be useful, |
|
1162 |
+but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
1163 |
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
1164 |
+GNU Lesser General Public License for more details. |
|
1165 |
+ |
|
1166 |
+You should have received a copy of the GNU Lesser General Public License |
|
1167 |
+along with »bacterio-plankton:code«. If not, see <http://www.gnu.org/licenses/>. |
|
1168 |
+ */ |
|
1169 |
+var lib_code; |
|
1170 |
+(function (lib_code) { |
|
1171 |
+ /** |
|
1172 |
+ * @author fenris |
|
1173 |
+ */ |
|
1174 |
+ lib_trait.attend("code", "base64", { |
|
1175 |
+ "from": { |
|
1176 |
+ "name": "string" |
|
1177 |
+ }, |
|
1178 |
+ "to": { |
|
1179 |
+ "name": "string" |
|
1180 |
+ } |
|
1181 |
+ }, { |
|
1182 |
+ "encode": () => (x) => { |
|
1183 |
+ return lib_code.base64_encode(x); |
|
1184 |
+ }, |
|
1185 |
+ "decode": () => (y) => { |
|
1186 |
+ return lib_code.base64_decode(y); |
|
1187 |
+ } |
|
1188 |
+ }); |
|
1189 |
+})(lib_code || (lib_code = {})); |
|
1190 |
+/* |
|
1191 |
+This file is part of »bacterio-plankton:code«. |
|
1192 |
+ |
|
1193 |
+Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
1194 |
+<info@greenscale.de> |
|
1195 |
+ |
|
1196 |
+»bacterio-plankton:code« is free software: you can redistribute it and/or modify |
|
1197 |
+it under the terms of the GNU Lesser General Public License as published by |
|
1198 |
+the Free Software Foundation, either version 3 of the License, or |
|
1199 |
+(at your option) any later version. |
|
1200 |
+ |
|
1201 |
+»bacterio-plankton:code« is distributed in the hope that it will be useful, |
|
1202 |
+but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
1203 |
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
1204 |
+GNU Lesser General Public License for more details. |
|
1205 |
+ |
|
1206 |
+You should have received a copy of the GNU Lesser General Public License |
|
1207 |
+along with »bacterio-plankton:code«. If not, see <http://www.gnu.org/licenses/>. |
|
1208 |
+ */ |
|
1209 |
+var lib_code; |
|
1210 |
+(function (lib_code) { |
|
1211 |
+ /** |
|
1212 |
+ * @author fenris |
|
1213 |
+ */ |
|
1214 |
+ class class_code_base64 { |
|
1215 |
+ /** |
|
1216 |
+ * @author fenris |
|
1217 |
+ */ |
|
1218 |
+ constructor() { |
|
1219 |
+ } |
|
1220 |
+ /** |
|
1221 |
+ * @implementation |
|
1222 |
+ * @author fenris |
|
1223 |
+ */ |
|
1224 |
+ encode(x) { |
|
1225 |
+ return lib_code.base64_encode(x); |
|
1226 |
+ } |
|
1227 |
+ /** |
|
1228 |
+ * @implementation |
|
1229 |
+ * @author fenris |
|
1230 |
+ */ |
|
1231 |
+ decode(x) { |
|
1232 |
+ return lib_code.base64_decode(x); |
|
1233 |
+ } |
|
1234 |
+ } |
|
1235 |
+ lib_code.class_code_base64 = class_code_base64; |
|
1236 |
+})(lib_code || (lib_code = {})); |
... | ... |
@@ -0,0 +1,861 @@ |
1 |
+Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
2 |
+<info@greenscale.de> |
|
3 |
+ |
|
4 |
+»bacterio-plankton:comm-server« is free software: you can redistribute it and/or modify |
|
5 |
+it under the terms of the GNU Lesser General Public License as published by |
|
6 |
+the Free Software Foundation, either version 3 of the License, or |
|
7 |
+(at your option) any later version. |
|
8 |
+ |
|
9 |
+»bacterio-plankton:comm-server« is distributed in the hope that it will be useful, |
|
10 |
+but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 |
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 |
+GNU Lesser General Public License for more details. |
|
13 |
+ |
|
14 |
+You should have received a copy of the GNU Lesser General Public License |
|
15 |
+along with »bacterio-plankton:comm-server«. If not, see <http://www.gnu.org/licenses/>. |
|
16 |
+ |
|
17 |
+ |
|
18 |
+ |
|
19 |
+ GNU GENERAL PUBLIC LICENSE |
|
20 |
+ Version 3, 29 June 2007 |
|
21 |
+ |
|
22 |
+ Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/> |
|
23 |
+ Everyone is permitted to copy and distribute verbatim copies |
|
24 |
+ of this license document, but changing it is not allowed. |
|
25 |
+ |
|
26 |
+ Preamble |
|
27 |
+ |
|
28 |
+ The GNU General Public License is a free, copyleft license for |
|
29 |
+software and other kinds of works. |
|
30 |
+ |
|
31 |
+ The licenses for most software and other practical works are designed |
|
32 |
+to take away your freedom to share and change the works. By contrast, |
|
33 |
+the GNU General Public License is intended to guarantee your freedom to |
|
34 |
+share and change all versions of a program--to make sure it remains free |
|
35 |
+software for all its users. We, the Free Software Foundation, use the |
|
36 |
+GNU General Public License for most of our software; it applies also to |
|
37 |
+any other work released this way by its authors. You can apply it to |
|
38 |
+your programs, too. |
|
39 |
+ |
|
40 |
+ When we speak of free software, we are referring to freedom, not |
|
41 |
+price. Our General Public Licenses are designed to make sure that you |
|
42 |
+have the freedom to distribute copies of free software (and charge for |
|
43 |
+them if you wish), that you receive source code or can get it if you |
|
44 |
+want it, that you can change the software or use pieces of it in new |
|
45 |
+free programs, and that you know you can do these things. |
|
46 |
+ |
|
47 |
+ To protect your rights, we need to prevent others from denying you |
|
48 |
+these rights or asking you to surrender the rights. Therefore, you have |
|
49 |
+certain responsibilities if you distribute copies of the software, or if |
|
50 |
+you modify it: responsibilities to respect the freedom of others. |
|
51 |
+ |
|
52 |
+ For example, if you distribute copies of such a program, whether |
|
53 |
+gratis or for a fee, you must pass on to the recipients the same |
|
54 |
+freedoms that you received. You must make sure that they, too, receive |
|
55 |
+or can get the source code. And you must show them these terms so they |
|
56 |
+know their rights. |
|
57 |
+ |
|
58 |
+ Developers that use the GNU GPL protect your rights with two steps: |
|
59 |
+(1) assert copyright on the software, and (2) offer you this License |
|
60 |
+giving you legal permission to copy, distribute and/or modify it. |
|
61 |
+ |
|
62 |
+ For the developers' and authors' protection, the GPL clearly explains |
|
63 |
+that there is no warranty for this free software. For both users' and |
|
64 |
+authors' sake, the GPL requires that modified versions be marked as |
|
65 |
+changed, so that their problems will not be attributed erroneously to |
|
66 |
+authors of previous versions. |
|
67 |
+ |
|
68 |
+ Some devices are designed to deny users access to install or run |
|
69 |
+modified versions of the software inside them, although the manufacturer |
|
70 |
+can do so. This is fundamentally incompatible with the aim of |
|
71 |
+protecting users' freedom to change the software. The systematic |
|
72 |
+pattern of such abuse occurs in the area of products for individuals to |
|
73 |
+use, which is precisely where it is most unacceptable. Therefore, we |
|
74 |
+have designed this version of the GPL to prohibit the practice for those |
|
75 |
+products. If such problems arise substantially in other domains, we |
|
76 |
+stand ready to extend this provision to those domains in future versions |
|
77 |
+of the GPL, as needed to protect the freedom of users. |
|
78 |
+ |
|
79 |
+ Finally, every program is threatened constantly by software patents. |
|
80 |
+States should not allow patents to restrict development and use of |
|
81 |
+software on general-purpose computers, but in those that do, we wish to |
|
82 |
+avoid the special danger that patents applied to a free program could |
|
83 |
+make it effectively proprietary. To prevent this, the GPL assures that |
|
84 |
+patents cannot be used to render the program non-free. |
|
85 |
+ |
|
86 |
+ The precise terms and conditions for copying, distribution and |
|
87 |
+modification follow. |
|
88 |
+ |
|
89 |
+ TERMS AND CONDITIONS |
|
90 |
+ |
|
91 |
+ 0. Definitions. |
|
92 |
+ |
|
93 |
+ "This License" refers to version 3 of the GNU General Public License. |
|
94 |
+ |
|
95 |
+ "Copyright" also means copyright-like laws that apply to other kinds of |
|
96 |
+works, such as semiconductor masks. |
|
97 |
+ |
|
98 |
+ "The Program" refers to any copyrightable work licensed under this |
|
99 |
+License. Each licensee is addressed as "you". "Licensees" and |
|
100 |
+"recipients" may be individuals or organizations. |
|
101 |
+ |
|
102 |
+ To "modify" a work means to copy from or adapt all or part of the work |
|
103 |
+in a fashion requiring copyright permission, other than the making of an |
|
104 |
+exact copy. The resulting work is called a "modified version" of the |
|
105 |
+earlier work or a work "based on" the earlier work. |
|
106 |
+ |
|
107 |
+ A "covered work" means either the unmodified Program or a work based |
|
108 |
+on the Program. |
|
109 |
+ |
|
110 |
+ To "propagate" a work means to do anything with it that, without |
|
111 |
+permission, would make you directly or secondarily liable for |
|
112 |
+infringement under applicable copyright law, except executing it on a |
|
113 |
+computer or modifying a private copy. Propagation includes copying, |
|
114 |
+distribution (with or without modification), making available to the |
|
115 |
+public, and in some countries other activities as well. |
|
116 |
+ |
|
117 |
+ To "convey" a work means any kind of propagation that enables other |
|
118 |
+parties to make or receive copies. Mere interaction with a user through |
|
119 |
+a computer network, with no transfer of a copy, is not conveying. |
|
120 |
+ |
|
121 |
+ An interactive user interface displays "Appropriate Legal Notices" |
|
122 |
+to the extent that it includes a convenient and prominently visible |
|
123 |
+feature that (1) displays an appropriate copyright notice, and (2) |
|
124 |
+tells the user that there is no warranty for the work (except to the |
|
125 |
+extent that warranties are provided), that licensees may convey the |
|
126 |
+work under this License, and how to view a copy of this License. If |
|
127 |
+the interface presents a list of user commands or options, such as a |
|
128 |
+menu, a prominent item in the list meets this criterion. |
|
129 |
+ |
|
130 |
+ 1. Source Code. |
|
131 |
+ |
|
132 |
+ The "source code" for a work means the preferred form of the work |
|
133 |
+for making modifications to it. "Object code" means any non-source |
|
134 |
+form of a work. |
|
135 |
+ |
|
136 |
+ A "Standard Interface" means an interface that either is an official |
|
137 |
+standard defined by a recognized standards body, or, in the case of |
|
138 |
+interfaces specified for a particular programming language, one that |
|
139 |
+is widely used among developers working in that language. |
|
140 |
+ |
|
141 |
+ The "System Libraries" of an executable work include anything, other |
|
142 |
+than the work as a whole, that (a) is included in the normal form of |
|
143 |
+packaging a Major Component, but which is not part of that Major |
|
144 |
+Component, and (b) serves only to enable use of the work with that |
|
145 |
+Major Component, or to implement a Standard Interface for which an |
|
146 |
+implementation is available to the public in source code form. A |
|
147 |
+"Major Component", in this context, means a major essential component |
|
148 |
+(kernel, window system, and so on) of the specific operating system |
|
149 |
+(if any) on which the executable work runs, or a compiler used to |
|
150 |
+produce the work, or an object code interpreter used to run it. |
|
151 |
+ |
|
152 |
+ The "Corresponding Source" for a work in object code form means all |
|
153 |
+the source code needed to generate, install, and (for an executable |
|
154 |
+work) run the object code and to modify the work, including scripts to |
|
155 |
+control those activities. However, it does not include the work's |
|
156 |
+System Libraries, or general-purpose tools or generally available free |
|
157 |
+programs which are used unmodified in performing those activities but |
|
158 |
+which are not part of the work. For example, Corresponding Source |
|
159 |
+includes interface definition files associated with source files for |
|
160 |
+the work, and the source code for shared libraries and dynamically |
|
161 |
+linked subprograms that the work is specifically designed to require, |
|
162 |
+such as by intimate data communication or control flow between those |
|
163 |
+subprograms and other parts of the work. |
|
164 |
+ |
|
165 |
+ The Corresponding Source need not include anything that users |
|
166 |
+can regenerate automatically from other parts of the Corresponding |
|
167 |
+Source. |
|
168 |
+ |
|
169 |
+ The Corresponding Source for a work in source code form is that |
|
170 |
+same work. |
|
171 |
+ |
|
172 |
+ 2. Basic Permissions. |
|
173 |
+ |
|
174 |
+ All rights granted under this License are granted for the term of |
|
175 |
+copyright on the Program, and are irrevocable provided the stated |
|
176 |
+conditions are met. This License explicitly affirms your unlimited |
|
177 |
+permission to run the unmodified Program. The output from running a |
|
178 |
+covered work is covered by this License only if the output, given its |
|
179 |
+content, constitutes a covered work. This License acknowledges your |
|
180 |
+rights of fair use or other equivalent, as provided by copyright law. |
|
181 |
+ |
|
182 |
+ You may make, run and propagate covered works that you do not |
|
183 |
+convey, without conditions so long as your license otherwise remains |
|
184 |
+in force. You may convey covered works to others for the sole purpose |
|
185 |
+of having them make modifications exclusively for you, or provide you |
|
186 |
+with facilities for running those works, provided that you comply with |
|
187 |
+the terms of this License in conveying all material for which you do |
|
188 |
+not control copyright. Those thus making or running the covered works |
|
189 |
+for you must do so exclusively on your behalf, under your direction |
|
190 |
+and control, on terms that prohibit them from making any copies of |
|
191 |
+your copyrighted material outside their relationship with you. |
|
192 |
+ |
|
193 |
+ Conveying under any other circumstances is permitted solely under |
|
194 |
+the conditions stated below. Sublicensing is not allowed; section 10 |
|
195 |
+makes it unnecessary. |
|
196 |
+ |
|
197 |
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law. |
|
198 |
+ |
|
199 |
+ No covered work shall be deemed part of an effective technological |
|
200 |
+measure under any applicable law fulfilling obligations under article |
|
201 |
+11 of the WIPO copyright treaty adopted on 20 December 1996, or |
|
202 |
+similar laws prohibiting or restricting circumvention of such |
|
203 |
+measures. |
|
204 |
+ |
|
205 |
+ When you convey a covered work, you waive any legal power to forbid |
|
206 |
+circumvention of technological measures to the extent such circumvention |
|
207 |
+is effected by exercising rights under this License with respect to |
|
208 |
+the covered work, and you disclaim any intention to limit operation or |
|
209 |
+modification of the work as a means of enforcing, against the work's |
|
210 |
+users, your or third parties' legal rights to forbid circumvention of |
|
211 |
+technological measures. |
|
212 |
+ |
|
213 |
+ 4. Conveying Verbatim Copies. |
|
214 |
+ |
|
215 |
+ You may convey verbatim copies of the Program's source code as you |
|
216 |
+receive it, in any medium, provided that you conspicuously and |
|
217 |
+appropriately publish on each copy an appropriate copyright notice; |
|
218 |
+keep intact all notices stating that this License and any |
|
219 |
+non-permissive terms added in accord with section 7 apply to the code; |
|
220 |
+keep intact all notices of the absence of any warranty; and give all |
|
221 |
+recipients a copy of this License along with the Program. |
|
222 |
+ |
|
223 |
+ You may charge any price or no price for each copy that you convey, |
|
224 |
+and you may offer support or warranty protection for a fee. |
|
225 |
+ |
|
226 |
+ 5. Conveying Modified Source Versions. |
|
227 |
+ |
|
228 |
+ You may convey a work based on the Program, or the modifications to |
|
229 |
+produce it from the Program, in the form of source code under the |
|
230 |
+terms of section 4, provided that you also meet all of these conditions: |
|
231 |
+ |
|
232 |
+ a) The work must carry prominent notices stating that you modified |
|
233 |
+ it, and giving a relevant date. |
|
234 |
+ |
|
235 |
+ b) The work must carry prominent notices stating that it is |
|
236 |
+ released under this License and any conditions added under section |
|
237 |
+ 7. This requirement modifies the requirement in section 4 to |
|
238 |
+ "keep intact all notices". |
|
239 |
+ |
|
240 |
+ c) You must license the entire work, as a whole, under this |
|
241 |
+ License to anyone who comes into possession of a copy. This |
|
242 |
+ License will therefore apply, along with any applicable section 7 |
|
243 |
+ additional terms, to the whole of the work, and all its parts, |
|
244 |
+ regardless of how they are packaged. This License gives no |
|
245 |
+ permission to license the work in any other way, but it does not |
|
246 |
+ invalidate such permission if you have separately received it. |
|
247 |
+ |
|
248 |
+ d) If the work has interactive user interfaces, each must display |
|
249 |
+ Appropriate Legal Notices; however, if the Program has interactive |
|
250 |
+ interfaces that do not display Appropriate Legal Notices, your |
|
251 |
+ work need not make them do so. |
|
252 |
+ |
|
253 |
+ A compilation of a covered work with other separate and independent |
|
254 |
+works, which are not by their nature extensions of the covered work, |
|
255 |
+and which are not combined with it such as to form a larger program, |
|
256 |
+in or on a volume of a storage or distribution medium, is called an |
|
257 |
+"aggregate" if the compilation and its resulting copyright are not |
|
258 |
+used to limit the access or legal rights of the compilation's users |
|
259 |
+beyond what the individual works permit. Inclusion of a covered work |
|
260 |
+in an aggregate does not cause this License to apply to the other |
|
261 |
+parts of the aggregate. |
|
262 |
+ |
|
263 |
+ 6. Conveying Non-Source Forms. |
|
264 |
+ |
|
265 |
+ You may convey a covered work in object code form under the terms |
|
266 |
+of sections 4 and 5, provided that you also convey the |
|
267 |
+machine-readable Corresponding Source under the terms of this License, |
|
268 |
+in one of these ways: |
|
269 |
+ |
|
270 |
+ a) Convey the object code in, or embodied in, a physical product |
|
271 |
+ (including a physical distribution medium), accompanied by the |
|
272 |
+ Corresponding Source fixed on a durable physical medium |
|
273 |
+ customarily used for software interchange. |
|
274 |
+ |
|
275 |
+ b) Convey the object code in, or embodied in, a physical product |
|
276 |
+ (including a physical distribution medium), accompanied by a |
|
277 |
+ written offer, valid for at least three years and valid for as |
|
278 |
+ long as you offer spare parts or customer support for that product |
|
279 |
+ model, to give anyone who possesses the object code either (1) a |
|
280 |
+ copy of the Corresponding Source for all the software in the |
|
281 |
+ product that is covered by this License, on a durable physical |
|
282 |
+ medium customarily used for software interchange, for a price no |
|
283 |
+ more than your reasonable cost of physically performing this |
|
284 |
+ conveying of source, or (2) access to copy the |
|
285 |
+ Corresponding Source from a network server at no charge. |
|
286 |
+ |
|
287 |
+ c) Convey individual copies of the object code with a copy of the |
|
288 |
+ written offer to provide the Corresponding Source. This |
|
289 |
+ alternative is allowed only occasionally and noncommercially, and |
|
290 |
+ only if you received the object code with such an offer, in accord |
|
291 |
+ with subsection 6b. |
|
292 |
+ |
|
293 |
+ d) Convey the object code by offering access from a designated |
|
294 |
+ place (gratis or for a charge), and offer equivalent access to the |
|
295 |
+ Corresponding Source in the same way through the same place at no |
|
296 |
+ further charge. You need not require recipients to copy the |
|
297 |
+ Corresponding Source along with the object code. If the place to |
|
298 |
+ copy the object code is a network server, the Corresponding Source |
|
299 |
+ may be on a different server (operated by you or a third party) |
|
300 |
+ that supports equivalent copying facilities, provided you maintain |
|
301 |
+ clear directions next to the object code saying where to find the |
|
302 |
+ Corresponding Source. Regardless of what server hosts the |
|
303 |
+ Corresponding Source, you remain obligated to ensure that it is |
|
304 |
+ available for as long as needed to satisfy these requirements. |
|
305 |
+ |
|
306 |
+ e) Convey the object code using peer-to-peer transmission, provided |
|
307 |
+ you inform other peers where the object code and Corresponding |
|
308 |
+ Source of the work are being offered to the general public at no |
|
309 |
+ charge under subsection 6d. |
|
310 |
+ |
|
311 |
+ A separable portion of the object code, whose source code is excluded |
|
312 |
+from the Corresponding Source as a System Library, need not be |
|
313 |
+included in conveying the object code work. |
|
314 |
+ |
|
315 |
+ A "User Product" is either (1) a "consumer product", which means any |
|
316 |
+tangible personal property which is normally used for personal, family, |
|
317 |
+or household purposes, or (2) anything designed or sold for incorporation |
|
318 |
+into a dwelling. In determining whether a product is a consumer product, |
|
319 |
+doubtful cases shall be resolved in favor of coverage. For a particular |
|
320 |
+product received by a particular user, "normally used" refers to a |
|
321 |
+typical or common use of that class of product, regardless of the status |
|
322 |
+of the particular user or of the way in which the particular user |
|
323 |
+actually uses, or expects or is expected to use, the product. A product |
|
324 |
+is a consumer product regardless of whether the product has substantial |
|
325 |
+commercial, industrial or non-consumer uses, unless such uses represent |
|
326 |
+the only significant mode of use of the product. |
|
327 |
+ |
|
328 |
+ "Installation Information" for a User Product means any methods, |
|
329 |
+procedures, authorization keys, or other information required to install |
|
330 |
+and execute modified versions of a covered work in that User Product from |
|
331 |
+a modified version of its Corresponding Source. The information must |
|
332 |
+suffice to ensure that the continued functioning of the modified object |
|
333 |
+code is in no case prevented or interfered with solely because |
|
334 |
+modification has been made. |
|
335 |
+ |
|
336 |
+ If you convey an object code work under this section in, or with, or |
|
337 |
+specifically for use in, a User Product, and the conveying occurs as |
|
338 |
+part of a transaction in which the right of possession and use of the |
|
339 |
+User Product is transferred to the recipient in perpetuity or for a |
|
340 |
+fixed term (regardless of how the transaction is characterized), the |
|
341 |
+Corresponding Source conveyed under this section must be accompanied |
|
342 |
+by the Installation Information. But this requirement does not apply |
|
343 |
+if neither you nor any third party retains the ability to install |
|
344 |
+modified object code on the User Product (for example, the work has |
|
345 |
+been installed in ROM). |
|
346 |
+ |
|
347 |
+ The requirement to provide Installation Information does not include a |
|
348 |
+requirement to continue to provide support service, warranty, or updates |
|
349 |
+for a work that has been modified or installed by the recipient, or for |
|
350 |
+the User Product in which it has been modified or installed. Access to a |
|
351 |
+network may be denied when the modification itself materially and |
|
352 |
+adversely affects the operation of the network or violates the rules and |
|
353 |
+protocols for communication across the network. |
|
354 |
+ |
|
355 |
+ Corresponding Source conveyed, and Installation Information provided, |
|
356 |
+in accord with this section must be in a format that is publicly |
|
357 |
+documented (and with an implementation available to the public in |
|
358 |
+source code form), and must require no special password or key for |
|
359 |
+unpacking, reading or copying. |
|
360 |
+ |
|
361 |
+ 7. Additional Terms. |
|
362 |
+ |
|
363 |
+ "Additional permissions" are terms that supplement the terms of this |
|
364 |
+License by making exceptions from one or more of its conditions. |
|
365 |
+Additional permissions that are applicable to the entire Program shall |
|
366 |
+be treated as though they were included in this License, to the extent |
|
367 |
+that they are valid under applicable law. If additional permissions |
|
368 |
+apply only to part of the Program, that part may be used separately |
|
369 |
+under those permissions, but the entire Program remains governed by |
|
370 |
+this License without regard to the additional permissions. |
|
371 |
+ |
|
372 |
+ When you convey a copy of a covered work, you may at your option |
|
373 |
+remove any additional permissions from that copy, or from any part of |
|
374 |
+it. (Additional permissions may be written to require their own |
|
375 |
+removal in certain cases when you modify the work.) You may place |
|
376 |
+additional permissions on material, added by you to a covered work, |
|
377 |
+for which you have or can give appropriate copyright permission. |
|
378 |
+ |
|
379 |
+ Notwithstanding any other provision of this License, for material you |
|
380 |
+add to a covered work, you may (if authorized by the copyright holders of |
|
381 |
+that material) supplement the terms of this License with terms: |
|
382 |
+ |
|
383 |
+ a) Disclaiming warranty or limiting liability differently from the |
|
384 |
+ terms of sections 15 and 16 of this License; or |
|
385 |
+ |
|
386 |
+ b) Requiring preservation of specified reasonable legal notices or |
|
387 |
+ author attributions in that material or in the Appropriate Legal |
|
388 |
+ Notices displayed by works containing it; or |
|
389 |
+ |
|
390 |
+ c) Prohibiting misrepresentation of the origin of that material, or |
|
391 |
+ requiring that modified versions of such material be marked in |
|
392 |
+ reasonable ways as different from the original version; or |
|
393 |
+ |
|
394 |
+ d) Limiting the use for publicity purposes of names of licensors or |
|
395 |
+ authors of the material; or |
|
396 |
+ |
|
397 |
+ e) Declining to grant rights under trademark law for use of some |
|
398 |
+ trade names, trademarks, or service marks; or |
|
399 |
+ |
|
400 |
+ f) Requiring indemnification of licensors and authors of that |
|
401 |
+ material by anyone who conveys the material (or modified versions of |
|
402 |
+ it) with contractual assumptions of liability to the recipient, for |
|
403 |
+ any liability that these contractual assumptions directly impose on |
|
404 |
+ those licensors and authors. |
|
405 |
+ |
|
406 |
+ All other non-permissive additional terms are considered "further |
|
407 |
+restrictions" within the meaning of section 10. If the Program as you |
|
408 |
+received it, or any part of it, contains a notice stating that it is |
|
409 |
+governed by this License along with a term that is a further |
|
410 |
+restriction, you may remove that term. If a license document contains |
|
411 |
+a further restriction but permits relicensing or conveying under this |
|
412 |
+License, you may add to a covered work material governed by the terms |
|
413 |
+of that license document, provided that the further restriction does |
|
414 |
+not survive such relicensing or conveying. |
|
415 |
+ |
|
416 |
+ If you add terms to a covered work in accord with this section, you |
|
417 |
+must place, in the relevant source files, a statement of the |
|
418 |
+additional terms that apply to those files, or a notice indicating |
|
419 |
+where to find the applicable terms. |
|
420 |
+ |
|
421 |
+ Additional terms, permissive or non-permissive, may be stated in the |
|
422 |
+form of a separately written license, or stated as exceptions; |
|
423 |
+the above requirements apply either way. |
|
424 |
+ |
|
425 |
+ 8. Termination. |
|
426 |
+ |
|
427 |
+ You may not propagate or modify a covered work except as expressly |
|
428 |
+provided under this License. Any attempt otherwise to propagate or |
|
429 |
+modify it is void, and will automatically terminate your rights under |
|
430 |
+this License (including any patent licenses granted under the third |
|
431 |
+paragraph of section 11). |
|
432 |
+ |
|
433 |
+ However, if you cease all violation of this License, then your |
|
434 |
+license from a particular copyright holder is reinstated (a) |
|
435 |
+provisionally, unless and until the copyright holder explicitly and |
|
436 |
+finally terminates your license, and (b) permanently, if the copyright |
|
437 |
+holder fails to notify you of the violation by some reasonable means |
|
438 |
+prior to 60 days after the cessation. |
|
439 |
+ |
|
440 |
+ Moreover, your license from a particular copyright holder is |
|
441 |
+reinstated permanently if the copyright holder notifies you of the |
|
442 |
+violation by some reasonable means, this is the first time you have |
|
443 |
+received notice of violation of this License (for any work) from that |
|
444 |
+copyright holder, and you cure the violation prior to 30 days after |
|
445 |
+your receipt of the notice. |
|
446 |
+ |
|
447 |
+ Termination of your rights under this section does not terminate the |
|
448 |
+licenses of parties who have received copies or rights from you under |
|
449 |
+this License. If your rights have been terminated and not permanently |
|
450 |
+reinstated, you do not qualify to receive new licenses for the same |
|
451 |
+material under section 10. |
|
452 |
+ |
|
453 |
+ 9. Acceptance Not Required for Having Copies. |
|
454 |
+ |
|
455 |
+ You are not required to accept this License in order to receive or |
|
456 |
+run a copy of the Program. Ancillary propagation of a covered work |
|
457 |
+occurring solely as a consequence of using peer-to-peer transmission |
|
458 |
+to receive a copy likewise does not require acceptance. However, |
|
459 |
+nothing other than this License grants you permission to propagate or |
|
460 |
+modify any covered work. These actions infringe copyright if you do |
|
461 |
+not accept this License. Therefore, by modifying or propagating a |
|
462 |
+covered work, you indicate your acceptance of this License to do so. |
|
463 |
+ |
|
464 |
+ 10. Automatic Licensing of Downstream Recipients. |
|
465 |
+ |
|
466 |
+ Each time you convey a covered work, the recipient automatically |
|
467 |
+receives a license from the original licensors, to run, modify and |
|
468 |
+propagate that work, subject to this License. You are not responsible |
|
469 |
+for enforcing compliance by third parties with this License. |
|
470 |
+ |
|
471 |
+ An "entity transaction" is a transaction transferring control of an |
|
472 |
+organization, or substantially all assets of one, or subdividing an |
|
473 |
+organization, or merging organizations. If propagation of a covered |
|
474 |
+work results from an entity transaction, each party to that |
|
475 |
+transaction who receives a copy of the work also receives whatever |
|
476 |
+licenses to the work the party's predecessor in interest had or could |
|
477 |
+give under the previous paragraph, plus a right to possession of the |
|
478 |
+Corresponding Source of the work from the predecessor in interest, if |
|
479 |
+the predecessor has it or can get it with reasonable efforts. |
|
480 |
+ |
|
481 |
+ You may not impose any further restrictions on the exercise of the |
|
482 |
+rights granted or affirmed under this License. For example, you may |
|
483 |
+not impose a license fee, royalty, or other charge for exercise of |
|
484 |
+rights granted under this License, and you may not initiate litigation |
|
485 |
+(including a cross-claim or counterclaim in a lawsuit) alleging that |
|
486 |
+any patent claim is infringed by making, using, selling, offering for |
|
487 |
+sale, or importing the Program or any portion of it. |
|
488 |
+ |
|
489 |
+ 11. Patents. |
|
490 |
+ |
|
491 |
+ A "contributor" is a copyright holder who authorizes use under this |
|
492 |
+License of the Program or a work on which the Program is based. The |
|
493 |
+work thus licensed is called the contributor's "contributor version". |
|
494 |
+ |
|
495 |
+ A contributor's "essential patent claims" are all patent claims |
|
496 |
+owned or controlled by the contributor, whether already acquired or |
|
497 |
+hereafter acquired, that would be infringed by some manner, permitted |
|
498 |
+by this License, of making, using, or selling its contributor version, |
|
499 |
+but do not include claims that would be infringed only as a |
|
500 |
+consequence of further modification of the contributor version. For |
|
501 |
+purposes of this definition, "control" includes the right to grant |
|
502 |
+patent sublicenses in a manner consistent with the requirements of |
|
503 |
+this License. |
|
504 |
+ |
|
505 |
+ Each contributor grants you a non-exclusive, worldwide, royalty-free |
|
506 |
+patent license under the contributor's essential patent claims, to |
|
507 |
+make, use, sell, offer for sale, import and otherwise run, modify and |
|
508 |
+propagate the contents of its contributor version. |
|
509 |
+ |
|
510 |
+ In the following three paragraphs, a "patent license" is any express |
|
511 |
+agreement or commitment, however denominated, not to enforce a patent |
|
512 |
+(such as an express permission to practice a patent or covenant not to |
|
513 |
+sue for patent infringement). To "grant" such a patent license to a |
|
514 |
+party means to make such an agreement or commitment not to enforce a |
|
515 |
+patent against the party. |
|
516 |
+ |
|
517 |
+ If you convey a covered work, knowingly relying on a patent license, |
|
518 |
+and the Corresponding Source of the work is not available for anyone |
|
519 |
+to copy, free of charge and under the terms of this License, through a |
|
520 |
+publicly available network server or other readily accessible means, |
|
521 |
+then you must either (1) cause the Corresponding Source to be so |
|
522 |
+available, or (2) arrange to deprive yourself of the benefit of the |
|
523 |
+patent license for this particular work, or (3) arrange, in a manner |
|
524 |
+consistent with the requirements of this License, to extend the patent |
|
525 |
+license to downstream recipients. "Knowingly relying" means you have |
|
526 |
+actual knowledge that, but for the patent license, your conveying the |
|
527 |
+covered work in a country, or your recipient's use of the covered work |
|
528 |
+in a country, would infringe one or more identifiable patents in that |
|
529 |
+country that you have reason to believe are valid. |
|
530 |
+ |
|
531 |
+ If, pursuant to or in connection with a single transaction or |
|
532 |
+arrangement, you convey, or propagate by procuring conveyance of, a |
|
533 |
+covered work, and grant a patent license to some of the parties |
|
534 |
+receiving the covered work authorizing them to use, propagate, modify |
|
535 |
+or convey a specific copy of the covered work, then the patent license |
|
536 |
+you grant is automatically extended to all recipients of the covered |
|
537 |
+work and works based on it. |
|
538 |
+ |
|
539 |
+ A patent license is "discriminatory" if it does not include within |
|
540 |
+the scope of its coverage, prohibits the exercise of, or is |
|
541 |
+conditioned on the non-exercise of one or more of the rights that are |
|
542 |
+specifically granted under this License. You may not convey a covered |
|
543 |
+work if you are a party to an arrangement with a third party that is |
|
544 |
+in the business of distributing software, under which you make payment |
|
545 |
+to the third party based on the extent of your activity of conveying |
|
546 |
+the work, and under which the third party grants, to any of the |
|
547 |
+parties who would receive the covered work from you, a discriminatory |
|
548 |
+patent license (a) in connection with copies of the covered work |
|
549 |
+conveyed by you (or copies made from those copies), or (b) primarily |
|
550 |
+for and in connection with specific products or compilations that |
|
551 |
+contain the covered work, unless you entered into that arrangement, |
|
552 |
+or that patent license was granted, prior to 28 March 2007. |
|
553 |
+ |
|
554 |
+ Nothing in this License shall be construed as excluding or limiting |
|
555 |
+any implied license or other defenses to infringement that may |
|
556 |
+otherwise be available to you under applicable patent law. |
|
557 |
+ |
|
558 |
+ 12. No Surrender of Others' Freedom. |
|
559 |
+ |
|
560 |
+ If conditions are imposed on you (whether by court order, agreement or |
|
561 |
+otherwise) that contradict the conditions of this License, they do not |
|
562 |
+excuse you from the conditions of this License. If you cannot convey a |
|
563 |
+covered work so as to satisfy simultaneously your obligations under this |
|
564 |
+License and any other pertinent obligations, then as a consequence you may |
|
565 |
+not convey it at all. For example, if you agree to terms that obligate you |
|
566 |
+to collect a royalty for further conveying from those to whom you convey |
|
567 |
+the Program, the only way you could satisfy both those terms and this |
|
568 |
+License would be to refrain entirely from conveying the Program. |
|
569 |
+ |
|
570 |
+ 13. Use with the GNU Affero General Public License. |
|
571 |
+ |
|
572 |
+ Notwithstanding any other provision of this License, you have |
|
573 |
+permission to link or combine any covered work with a work licensed |
|
574 |
+under version 3 of the GNU Affero General Public License into a single |
|
575 |
+combined work, and to convey the resulting work. The terms of this |
|
576 |
+License will continue to apply to the part which is the covered work, |
|
577 |
+but the special requirements of the GNU Affero General Public License, |
|
578 |
+section 13, concerning interaction through a network will apply to the |
|
579 |
+combination as such. |
|
580 |
+ |
|
581 |
+ 14. Revised Versions of this License. |
|
582 |
+ |
|
583 |
+ The Free Software Foundation may publish revised and/or new versions of |
|
584 |
+the GNU General Public License from time to time. Such new versions will |
|
585 |
+be similar in spirit to the present version, but may differ in detail to |
|
586 |
+address new problems or concerns. |
|
587 |
+ |
|
588 |
+ Each version is given a distinguishing version number. If the |
|
589 |
+Program specifies that a certain numbered version of the GNU General |
|
590 |
+Public License "or any later version" applies to it, you have the |
|
591 |
+option of following the terms and conditions either of that numbered |
|
592 |
+version or of any later version published by the Free Software |
|
593 |
+Foundation. If the Program does not specify a version number of the |
|
594 |
+GNU General Public License, you may choose any version ever published |
|
595 |
+by the Free Software Foundation. |
|
596 |
+ |
|
597 |
+ If the Program specifies that a proxy can decide which future |
|
598 |
+versions of the GNU General Public License can be used, that proxy's |
|
599 |
+public statement of acceptance of a version permanently authorizes you |
|
600 |
+to choose that version for the Program. |
|
601 |
+ |
|
602 |
+ Later license versions may give you additional or different |
|
603 |
+permissions. However, no additional obligations are imposed on any |
|
604 |
+author or copyright holder as a result of your choosing to follow a |
|
605 |
+later version. |
|
606 |
+ |
|
607 |
+ 15. Disclaimer of Warranty. |
|
608 |
+ |
|
609 |
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY |
|
610 |
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT |
|
611 |
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY |
|
612 |
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, |
|
613 |
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
|
614 |
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM |
|
615 |
+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF |
|
616 |
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION. |
|
617 |
+ |
|
618 |
+ 16. Limitation of Liability. |
|
619 |
+ |
|
620 |
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING |
|
621 |
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS |
|
622 |
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY |
|
623 |
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE |
|
624 |
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF |
|
625 |
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD |
|
626 |
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), |
|
627 |
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF |
|
628 |
+SUCH DAMAGES. |
|
629 |
+ |
|
630 |
+ 17. Interpretation of Sections 15 and 16. |
|
631 |
+ |
|
632 |
+ If the disclaimer of warranty and limitation of liability provided |
|
633 |
+above cannot be given local legal effect according to their terms, |
|
634 |
+reviewing courts shall apply local law that most closely approximates |
|
635 |
+an absolute waiver of all civil liability in connection with the |
|
636 |
+Program, unless a warranty or assumption of liability accompanies a |
|
637 |
+copy of the Program in return for a fee. |
|
638 |
+ |
|
639 |
+ END OF TERMS AND CONDITIONS |
|
640 |
+ |
|
641 |
+ How to Apply These Terms to Your New Programs |
|
642 |
+ |
|
643 |
+ If you develop a new program, and you want it to be of the greatest |
|
644 |
+possible use to the public, the best way to achieve this is to make it |
|
645 |
+free software which everyone can redistribute and change under these terms. |
|
646 |
+ |
|
647 |
+ To do so, attach the following notices to the program. It is safest |
|
648 |
+to attach them to the start of each source file to most effectively |
|
649 |
+state the exclusion of warranty; and each file should have at least |
|
650 |
+the "copyright" line and a pointer to where the full notice is found. |
|
651 |
+ |
|
652 |
+ <one line to give the program's name and a brief idea of what it does.> |
|
653 |
+ Copyright (C) <year> <name of author> |
|
654 |
+ |
|
655 |
+ This program is free software: you can redistribute it and/or modify |
|
656 |
+ it under the terms of the GNU General Public License as published by |
|
657 |
+ the Free Software Foundation, either version 3 of the License, or |
|
658 |
+ (at your option) any later version. |
|
659 |
+ |
|
660 |
+ This program is distributed in the hope that it will be useful, |
|
661 |
+ but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
662 |
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
663 |
+ GNU General Public License for more details. |
|
664 |
+ |
|
665 |
+ You should have received a copy of the GNU General Public License |
|
666 |
+ along with this program. If not, see <https://www.gnu.org/licenses/>. |
|
667 |
+ |
|
668 |
+Also add information on how to contact you by electronic and paper mail. |
|
669 |
+ |
|
670 |
+ If the program does terminal interaction, make it output a short |
|
671 |
+notice like this when it starts in an interactive mode: |
|
672 |
+ |
|
673 |
+ <program> Copyright (C) <year> <name of author> |
|
674 |
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. |
|
675 |
+ This is free software, and you are welcome to redistribute it |
|
676 |
+ under certain conditions; type `show c' for details. |
|
677 |
+ |
|
678 |
+The hypothetical commands `show w' and `show c' should show the appropriate |
|
679 |
+parts of the General Public License. Of course, your program's commands |
|
680 |
+might be different; for a GUI interface, you would use an "about box". |
|
681 |
+ |
|
682 |
+ You should also get your employer (if you work as a programmer) or school, |
|
683 |
+if any, to sign a "copyright disclaimer" for the program, if necessary. |
|
684 |
+For more information on this, and how to apply and follow the GNU GPL, see |
|
685 |
+<https://www.gnu.org/licenses/>. |
|
686 |
+ |
|
687 |
+ The GNU General Public License does not permit incorporating your program |
|
688 |
+into proprietary programs. If your program is a subroutine library, you |
|
689 |
+may consider it more useful to permit linking proprietary applications with |
|
690 |
+the library. If this is what you want to do, use the GNU Lesser General |
|
691 |
+Public License instead of this License. But first, please read |
|
692 |
+<https://www.gnu.org/licenses/why-not-lgpl.html>. |
|
693 |
+ |
|
694 |
+ |
|
695 |
+ |
|
696 |
+ GNU LESSER GENERAL PUBLIC LICENSE |
|
697 |
+ Version 3, 29 June 2007 |
|
698 |
+ |
|
699 |
+ Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/> |
|
700 |
+ Everyone is permitted to copy and distribute verbatim copies |
|
701 |
+ of this license document, but changing it is not allowed. |
|
702 |
+ |
|
703 |
+ |
|
704 |
+ This version of the GNU Lesser General Public License incorporates |
|
705 |
+the terms and conditions of version 3 of the GNU General Public |
|
706 |
+License, supplemented by the additional permissions listed below. |
|
707 |
+ |
|
708 |
+ 0. Additional Definitions. |
|
709 |
+ |
|
710 |
+ As used herein, "this License" refers to version 3 of the GNU Lesser |
|
711 |
+General Public License, and the "GNU GPL" refers to version 3 of the GNU |
|
712 |
+General Public License. |
|
713 |
+ |
|
714 |
+ "The Library" refers to a covered work governed by this License, |
|
715 |
+other than an Application or a Combined Work as defined below. |
|
716 |
+ |
|
717 |
+ An "Application" is any work that makes use of an interface provided |
|
718 |
+by the Library, but which is not otherwise based on the Library. |
|
719 |
+Defining a subclass of a class defined by the Library is deemed a mode |
|
720 |
+of using an interface provided by the Library. |
|
721 |
+ |
|
722 |
+ A "Combined Work" is a work produced by combining or linking an |
|
723 |
+Application with the Library. The particular version of the Library |
|
724 |
+with which the Combined Work was made is also called the "Linked |
|
725 |
+Version". |
|
726 |
+ |
|
727 |
+ The "Minimal Corresponding Source" for a Combined Work means the |
|
728 |
+Corresponding Source for the Combined Work, excluding any source code |
|
729 |
+for portions of the Combined Work that, considered in isolation, are |
|
730 |
+based on the Application, and not on the Linked Version. |
|
731 |
+ |
|
732 |
+ The "Corresponding Application Code" for a Combined Work means the |
|
733 |
+object code and/or source code for the Application, including any data |
|
734 |
+and utility programs needed for reproducing the Combined Work from the |
|
735 |
+Application, but excluding the System Libraries of the Combined Work. |
|
736 |
+ |
|
737 |
+ 1. Exception to Section 3 of the GNU GPL. |
|
738 |
+ |
|
739 |
+ You may convey a covered work under sections 3 and 4 of this License |
|
740 |
+without being bound by section 3 of the GNU GPL. |
|
741 |
+ |
|
742 |
+ 2. Conveying Modified Versions. |
|
743 |
+ |
|
744 |
+ If you modify a copy of the Library, and, in your modifications, a |
|
745 |
+facility refers to a function or data to be supplied by an Application |
|
746 |
+that uses the facility (other than as an argument passed when the |
|
747 |
+facility is invoked), then you may convey a copy of the modified |
|
748 |
+version: |
|
749 |
+ |
|
750 |
+ a) under this License, provided that you make a good faith effort to |
|
751 |
+ ensure that, in the event an Application does not supply the |
|
752 |
+ function or data, the facility still operates, and performs |
|
753 |
+ whatever part of its purpose remains meaningful, or |
|
754 |
+ |
|
755 |
+ b) under the GNU GPL, with none of the additional permissions of |
|
756 |
+ this License applicable to that copy. |
|
757 |
+ |
|
758 |
+ 3. Object Code Incorporating Material from Library Header Files. |
|
759 |
+ |
|
760 |
+ The object code form of an Application may incorporate material from |
|
761 |
+a header file that is part of the Library. You may convey such object |
|
762 |
+code under terms of your choice, provided that, if the incorporated |
|
763 |
+material is not limited to numerical parameters, data structure |
|
764 |
+layouts and accessors, or small macros, inline functions and templates |
|
765 |
+(ten or fewer lines in length), you do both of the following: |
|
766 |
+ |
|
767 |
+ a) Give prominent notice with each copy of the object code that the |
|
768 |
+ Library is used in it and that the Library and its use are |
|
769 |
+ covered by this License. |
|
770 |
+ |
|
771 |
+ b) Accompany the object code with a copy of the GNU GPL and this license |
|
772 |
+ document. |
|
773 |
+ |
|
774 |
+ 4. Combined Works. |
|
775 |
+ |
|
776 |
+ You may convey a Combined Work under terms of your choice that, |
|
777 |
+taken together, effectively do not restrict modification of the |
|
778 |
+portions of the Library contained in the Combined Work and reverse |
|
779 |
+engineering for debugging such modifications, if you also do each of |
|
780 |
+the following: |
|
781 |
+ |
|
782 |
+ a) Give prominent notice with each copy of the Combined Work that |
|
783 |
+ the Library is used in it and that the Library and its use are |
|
784 |
+ covered by this License. |
|
785 |
+ |
|
786 |
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license |
|
787 |
+ document. |
|
788 |
+ |
|
789 |
+ c) For a Combined Work that displays copyright notices during |
|
790 |
+ execution, include the copyright notice for the Library among |
|
791 |
+ these notices, as well as a reference directing the user to the |
|
792 |
+ copies of the GNU GPL and this license document. |
|
793 |
+ |
|
794 |
+ d) Do one of the following: |
|
795 |
+ |
|
796 |
+ 0) Convey the Minimal Corresponding Source under the terms of this |
|
797 |
+ License, and the Corresponding Application Code in a form |
|
798 |
+ suitable for, and under terms that permit, the user to |
|
799 |
+ recombine or relink the Application with a modified version of |
|
800 |
+ the Linked Version to produce a modified Combined Work, in the |
|
801 |
+ manner specified by section 6 of the GNU GPL for conveying |
|
802 |
+ Corresponding Source. |
|
803 |
+ |
|
804 |
+ 1) Use a suitable shared library mechanism for linking with the |
|
805 |
+ Library. A suitable mechanism is one that (a) uses at run time |
|
806 |
+ a copy of the Library already present on the user's computer |
|
807 |
+ system, and (b) will operate properly with a modified version |
|
808 |
+ of the Library that is interface-compatible with the Linked |
|
809 |
+ Version. |
|
810 |
+ |
|
811 |
+ e) Provide Installation Information, but only if you would otherwise |
|
812 |
+ be required to provide such information under section 6 of the |
|
813 |
+ GNU GPL, and only to the extent that such information is |
|
814 |
+ necessary to install and execute a modified version of the |
|
815 |
+ Combined Work produced by recombining or relinking the |
|
816 |
+ Application with a modified version of the Linked Version. (If |
|
817 |
+ you use option 4d0, the Installation Information must accompany |
|
818 |
+ the Minimal Corresponding Source and Corresponding Application |
|
819 |
+ Code. If you use option 4d1, you must provide the Installation |
|
820 |
+ Information in the manner specified by section 6 of the GNU GPL |
|
821 |
+ for conveying Corresponding Source.) |
|
822 |
+ |
|
823 |
+ 5. Combined Libraries. |
|
824 |
+ |
|
825 |
+ You may place library facilities that are a work based on the |
|
826 |
+Library side by side in a single library together with other library |
|
827 |
+facilities that are not Applications and are not covered by this |
|
828 |
+License, and convey such a combined library under terms of your |
|
829 |
+choice, if you do both of the following: |
|
830 |
+ |
|
831 |
+ a) Accompany the combined library with a copy of the same work based |
|
832 |
+ on the Library, uncombined with any other library facilities, |
|
833 |
+ conveyed under the terms of this License. |
|
834 |
+ |
|
835 |
+ b) Give prominent notice with the combined library that part of it |
|
836 |
+ is a work based on the Library, and explaining where to find the |
|
837 |
+ accompanying uncombined form of the same work. |
|
838 |
+ |
|
839 |
+ 6. Revised Versions of the GNU Lesser General Public License. |
|
840 |
+ |
|
841 |
+ The Free Software Foundation may publish revised and/or new versions |
|
842 |
+of the GNU Lesser General Public License from time to time. Such new |
|
843 |
+versions will be similar in spirit to the present version, but may |
|
844 |
+differ in detail to address new problems or concerns. |
|
845 |
+ |
|
846 |
+ Each version is given a distinguishing version number. If the |
|
847 |
+Library as you received it specifies that a certain numbered version |
|
848 |
+of the GNU Lesser General Public License "or any later version" |
|
849 |
+applies to it, you have the option of following the terms and |
|
850 |
+conditions either of that published version or of any later version |
|
851 |
+published by the Free Software Foundation. If the Library as you |
|
852 |
+received it does not specify a version number of the GNU Lesser |
|
853 |
+General Public License, you may choose any version of the GNU Lesser |
|
854 |
+General Public License ever published by the Free Software Foundation. |
|
855 |
+ |
|
856 |
+ If the Library as you received it specifies that a proxy can decide |
|
857 |
+whether future versions of the GNU Lesser General Public License shall |
|
858 |
+apply, that proxy's public statement of acceptance of any version is |
|
859 |
+permanent authorization for you to choose that version for the |
|
860 |
+Library. |
|
861 |
+ |
... | ... |
@@ -0,0 +1,164 @@ |
1 |
+declare module lib_comm { |
|
2 |
+ /** |
|
3 |
+ * @author fenris |
|
4 |
+ */ |
|
5 |
+ type type_answering_executor<type_message_in, type_message_out> = (message: type_message_in) => lib_call.type_executor<type_message_out, Error>; |
|
6 |
+ /** |
|
7 |
+ * @author fenris |
|
8 |
+ */ |
|
9 |
+ type type_answering_promise<type_message_in, type_message_out> = (message: type_message_in) => lib_call.type_promise<type_message_out, Error>; |
|
10 |
+ /** |
|
11 |
+ * @author fenris |
|
12 |
+ */ |
|
13 |
+ type type_answering<type_message_in, type_message_out> = type_answering_promise<type_message_in, type_message_out>; |
|
14 |
+} |
|
15 |
+declare module lib_comm { |
|
16 |
+} |
|
17 |
+declare module lib_comm { |
|
18 |
+ /** |
|
19 |
+ * @author fenris |
|
20 |
+ */ |
|
21 |
+ interface interface_server<type_message_in, type_message_out> { |
|
22 |
+ /** |
|
23 |
+ * @desc this method shall prepare the server to a point, where it just needs to be started afterwards |
|
24 |
+ * @param {type_answering<type_message_in, type_message_out>} answering specifies how the server should handle incoming messages to formulate an answer |
|
25 |
+ * @author fenris |
|
26 |
+ */ |
|
27 |
+ setup(answering: type_answering<type_message_in, type_message_out>): lib_call.type_promise<void, Error>; |
|
28 |
+ /** |
|
29 |
+ * @desc starts to listen |
|
30 |
+ * @author fenris |
|
31 |
+ */ |
|
32 |
+ run(): void; |
|
33 |
+ } |
|
34 |
+} |
|
35 |
+declare module lib_comm { |
|
36 |
+ /** |
|
37 |
+ * @author fenris |
|
38 |
+ */ |
|
39 |
+ type type_response_server_http = { |
|
40 |
+ code: int; |
|
41 |
+ text: string; |
|
42 |
+ }; |
|
43 |
+ /** |
|
44 |
+ * @author fenris |
|
45 |
+ */ |
|
46 |
+ type type_parameters_server_http = { |
|
47 |
+ protocol?: string; |
|
48 |
+ port?: int; |
|
49 |
+ headers?: { |
|
50 |
+ [name: string]: string; |
|
51 |
+ }; |
|
52 |
+ ssl_key?: string; |
|
53 |
+ ssl_cert?: string; |
|
54 |
+ ssl_ca?: string; |
|
55 |
+ }; |
|
56 |
+ /** |
|
57 |
+ * @author fenris |
|
58 |
+ */ |
|
59 |
+ var default_parameters_server_http: type_parameters_server_http; |
|
60 |
+} |
|
61 |
+declare module lib_comm { |
|
62 |
+ /** |
|
63 |
+ * @author fenris |
|
64 |
+ */ |
|
65 |
+ type type_server_http = { |
|
66 |
+ parameters: type_parameters_server_http; |
|
67 |
+ answering: type_answering<string, type_response_server_http>; |
|
68 |
+ serverinstance: any; |
|
69 |
+ }; |
|
70 |
+ /** |
|
71 |
+ * @author fenris |
|
72 |
+ */ |
|
73 |
+ function server_http_construct(parameters?: type_parameters_server_http): type_server_http; |
|
74 |
+ /** |
|
75 |
+ * @author fenris |
|
76 |
+ */ |
|
77 |
+ function server_http_setup(subject: type_server_http, answering: type_answering<string, type_response_server_http>): lib_call.type_promise<void, Error>; |
|
78 |
+ /** |
|
79 |
+ * @author fenris |
|
80 |
+ */ |
|
81 |
+ function server_http_run(subject: type_server_http): void; |
|
82 |
+} |
|
83 |
+declare module lib_comm { |
|
84 |
+} |
|
85 |
+declare module lib_comm { |
|
86 |
+ /** |
|
87 |
+ * @author fenris |
|
88 |
+ */ |
|
89 |
+ class class_server_http implements interface_server<string, type_response_server_http> { |
|
90 |
+ /** |
|
91 |
+ * @author fenris |
|
92 |
+ */ |
|
93 |
+ protected subject: type_server_http; |
|
94 |
+ /** |
|
95 |
+ * @author fenris |
|
96 |
+ */ |
|
97 |
+ constructor(parameters?: type_parameters_server_http); |
|
98 |
+ /** |
|
99 |
+ * @author fenris |
|
100 |
+ * @implementation |
|
101 |
+ */ |
|
102 |
+ setup(answering: type_answering<string, type_response_server_http>): lib_call.type_promise<void, Error>; |
|
103 |
+ /** |
|
104 |
+ * @author fenris |
|
105 |
+ * @implementation |
|
106 |
+ */ |
|
107 |
+ run(): void; |
|
108 |
+ } |
|
109 |
+} |
|
110 |
+declare module lib_comm { |
|
111 |
+ /** |
|
112 |
+ * @author fenris |
|
113 |
+ */ |
|
114 |
+ class class_server_mhttp implements interface_server<string, string> { |
|
115 |
+ /** |
|
116 |
+ * @author fenris |
|
117 |
+ */ |
|
118 |
+ protected core: class_server_http; |
|
119 |
+ /** |
|
120 |
+ * @author fenris |
|
121 |
+ */ |
|
122 |
+ constructor(parameters?: type_parameters_server_http); |
|
123 |
+ /** |
|
124 |
+ * @author fenris |
|
125 |
+ * @implementation |
|
126 |
+ */ |
|
127 |
+ setup(answering: type_answering<string, string>): lib_call.type_promise<void, Error>; |
|
128 |
+ /** |
|
129 |
+ * @author fenris |
|
130 |
+ * @implementation |
|
131 |
+ */ |
|
132 |
+ run(): void; |
|
133 |
+ } |
|
134 |
+} |
|
135 |
+declare module lib_comm { |
|
136 |
+ /** |
|
137 |
+ * @desc wrapper for string-based servers |
|
138 |
+ * @author fenris |
|
139 |
+ */ |
|
140 |
+ class class_server_complex implements interface_server<any, any> { |
|
141 |
+ /** |
|
142 |
+ * @author fenris |
|
143 |
+ */ |
|
144 |
+ protected core: interface_server<string, string>; |
|
145 |
+ /** |
|
146 |
+ * @author fenris |
|
147 |
+ */ |
|
148 |
+ protected code: lib_code.interface_code<any, string>; |
|
149 |
+ /** |
|
150 |
+ * @author fenris |
|
151 |
+ */ |
|
152 |
+ constructor(core: interface_server<string, string>, code?: lib_code.interface_code<any, string>); |
|
153 |
+ /** |
|
154 |
+ * @author fenris |
|
155 |
+ * @implementation |
|
156 |
+ */ |
|
157 |
+ setup(answering: type_answering<any, any>): lib_call.type_promise<void, Error>; |
|
158 |
+ /** |
|
159 |
+ * @author fenris |
|
160 |
+ * @implementation |
|
161 |
+ */ |
|
162 |
+ run(): void; |
|
163 |
+ } |
|
164 |
+} |
... | ... |
@@ -0,0 +1,479 @@ |
1 |
+/* |
|
2 |
+This file is part of »bacterio-plankton:comm-server«. |
|
3 |
+ |
|
4 |
+Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
5 |
+<info@greenscale.de> |
|
6 |
+ |
|
7 |
+»bacterio-plankton:comm-server« is free software: you can redistribute it and/or modify |
|
8 |
+it under the terms of the GNU Lesser General Public License as published by |
|
9 |
+the Free Software Foundation, either version 3 of the License, or |
|
10 |
+(at your option) any later version. |
|
11 |
+ |
|
12 |
+»bacterio-plankton:comm-server« is distributed in the hope that it will be useful, |
|
13 |
+but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
14 |
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
15 |
+GNU Lesser General Public License for more details. |
|
16 |
+ |
|
17 |
+You should have received a copy of the GNU Lesser General Public License |
|
18 |
+along with »bacterio-plankton:comm-server«. If not, see <http://www.gnu.org/licenses/>. |
|
19 |
+ */ |
|
20 |
+/* |
|
21 |
+This file is part of »bacterio-plankton:comm-server«. |
|
22 |
+ |
|
23 |
+Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
24 |
+<info@greenscale.de> |
|
25 |
+ |
|
26 |
+»bacterio-plankton:comm-server« is free software: you can redistribute it and/or modify |
|
27 |
+it under the terms of the GNU Lesser General Public License as published by |
|
28 |
+the Free Software Foundation, either version 3 of the License, or |
|
29 |
+(at your option) any later version. |
|
30 |
+ |
|
31 |
+»bacterio-plankton:comm-server« is distributed in the hope that it will be useful, |
|
32 |
+but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
33 |
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
34 |
+GNU Lesser General Public License for more details. |
|
35 |
+ |
|
36 |
+You should have received a copy of the GNU Lesser General Public License |
|
37 |
+along with »bacterio-plankton:comm-server«. If not, see <http://www.gnu.org/licenses/>. |
|
38 |
+ */ |
|
39 |
+var lib_comm; |
|
40 |
+(function (lib_comm) { |
|
41 |
+ /** |
|
42 |
+ * @author fenris |
|
43 |
+ */ |
|
44 |
+ lib_trait.define("comm-server", { |
|
45 |
+ "state": null, |
|
46 |
+ "message_in": null, |
|
47 |
+ "message_out": null |
|
48 |
+ }, { |
|
49 |
+ "setup": { |
|
50 |
+ "shape": { |
|
51 |
+ "name": "function", |
|
52 |
+ "parameters": { |
|
53 |
+ "shape_input": { |
|
54 |
+ "name": "variable", |
|
55 |
+ "parameters": { |
|
56 |
+ "name": "state" |
|
57 |
+ } |
|
58 |
+ }, |
|
59 |
+ "shape_output": { |
|
60 |
+ "name": "function", |
|
61 |
+ "parameters": { |
|
62 |
+ "shape_input": { |
|
63 |
+ "name": "any" |
|
64 |
+ }, |
|
65 |
+ "shape_output": { |
|
66 |
+ "name": "promise", |
|
67 |
+ "parameters": { |
|
68 |
+ "shape_result": { |
|
69 |
+ "name": "variable", |
|
70 |
+ "parameters": { |
|
71 |
+ "name": "state" |
|
72 |
+ } |
|
73 |
+ }, |
|
74 |
+ "shape_reason": { |
|
75 |
+ "name": "any" |
|
76 |
+ } |
|
77 |
+ } |
|
78 |
+ } |
|
79 |
+ } |
|
80 |
+ } |
|
81 |
+ } |
|
82 |
+ } |
|
83 |
+ }, |
|
84 |
+ "run": { |
|
85 |
+ "shape": { |
|
86 |
+ "name": "function", |
|
87 |
+ "parameters": { |
|
88 |
+ "shape_input": { |
|
89 |
+ "name": "variable", |
|
90 |
+ "parameters": { |
|
91 |
+ "name": "state" |
|
92 |
+ } |
|
93 |
+ }, |
|
94 |
+ "shape_output": { |
|
95 |
+ "name": "void" |
|
96 |
+ } |
|
97 |
+ } |
|
98 |
+ } |
|
99 |
+ } |
|
100 |
+ }); |
|
101 |
+})(lib_comm || (lib_comm = {})); |
|
102 |
+/* |
|
103 |
+This file is part of »bacterio-plankton:comm-server«. |
|
104 |
+ |
|
105 |
+Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
106 |
+<info@greenscale.de> |
|
107 |
+ |
|
108 |
+»bacterio-plankton:comm-server« is free software: you can redistribute it and/or modify |
|
109 |
+it under the terms of the GNU Lesser General Public License as published by |
|
110 |
+the Free Software Foundation, either version 3 of the License, or |
|
111 |
+(at your option) any later version. |
|
112 |
+ |
|
113 |
+»bacterio-plankton:comm-server« is distributed in the hope that it will be useful, |
|
114 |
+but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
115 |
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
116 |
+GNU Lesser General Public License for more details. |
|
117 |
+ |
|
118 |
+You should have received a copy of the GNU Lesser General Public License |
|
119 |
+along with »bacterio-plankton:comm-server«. If not, see <http://www.gnu.org/licenses/>. |
|
120 |
+ */ |
|
121 |
+/* |
|
122 |
+This file is part of »bacterio-plankton:comm-server«. |
|
123 |
+ |
|
124 |
+Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
125 |
+<info@greenscale.de> |
|
126 |
+ |
|
127 |
+»bacterio-plankton:comm-server« is free software: you can redistribute it and/or modify |
|
128 |
+it under the terms of the GNU Lesser General Public License as published by |
|
129 |
+the Free Software Foundation, either version 3 of the License, or |
|
130 |
+(at your option) any later version. |
|
131 |
+ |
|
132 |
+»bacterio-plankton:comm-server« is distributed in the hope that it will be useful, |
|
133 |
+but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
134 |
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
135 |
+GNU Lesser General Public License for more details. |
|
136 |
+ |
|
137 |
+You should have received a copy of the GNU Lesser General Public License |
|
138 |
+along with »bacterio-plankton:comm-server«. If not, see <http://www.gnu.org/licenses/>. |
|
139 |
+ */ |
|
140 |
+var lib_comm; |
|
141 |
+(function (lib_comm) { |
|
142 |
+ /** |
|
143 |
+ * @author fenris |
|
144 |
+ */ |
|
145 |
+ lib_comm.default_parameters_server_http = { |
|
146 |
+ "protocol": "http", |
|
147 |
+ "port": 80, |
|
148 |
+ "headers": { |
|
149 |
+ "Access-Control-Allow-Methods": "OPTIONS, POST", |
|
150 |
+ "Access-Control-Allow-Origin": "*", |
|
151 |
+ "Access-Control-Allow-Headers": "origin, content-type", |
|
152 |
+ "Access-Control-Allow-Credentials": null, |
|
153 |
+ "Content-Type": "plain/text; charset=utf-8", |
|
154 |
+ } |
|
155 |
+ }; |
|
156 |
+})(lib_comm || (lib_comm = {})); |
|
157 |
+/* |
|
158 |
+This file is part of »bacterio-plankton:comm-server«. |
|
159 |
+ |
|
160 |
+Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
161 |
+<info@greenscale.de> |
|
162 |
+ |
|
163 |
+»bacterio-plankton:comm-server« is free software: you can redistribute it and/or modify |
|
164 |
+it under the terms of the GNU Lesser General Public License as published by |
|
165 |
+the Free Software Foundation, either version 3 of the License, or |
|
166 |
+(at your option) any later version. |
|
167 |
+ |
|
168 |
+»bacterio-plankton:comm-server« is distributed in the hope that it will be useful, |
|
169 |
+but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
170 |
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
171 |
+GNU Lesser General Public License for more details. |
|
172 |
+ |
|
173 |
+You should have received a copy of the GNU Lesser General Public License |
|
174 |
+along with »bacterio-plankton:comm-server«. If not, see <http://www.gnu.org/licenses/>. |
|
175 |
+ */ |
|
176 |
+var lib_comm; |
|
177 |
+(function (lib_comm) { |
|
178 |
+ /** |
|
179 |
+ * @author fenris |
|
180 |
+ */ |
|
181 |
+ function server_http_construct(parameters = {}) { |
|
182 |
+ return { |
|
183 |
+ "parameters": lib_object.patched(lib_comm.default_parameters_server_http, parameters), |
|
184 |
+ "answering": null, |
|
185 |
+ "serverinstance": null, |
|
186 |
+ }; |
|
187 |
+ } |
|
188 |
+ lib_comm.server_http_construct = server_http_construct; |
|
189 |
+ /** |
|
190 |
+ * @author fenris |
|
191 |
+ */ |
|
192 |
+ function server_http_setup(subject, answering) { |
|
193 |
+ subject.answering = answering; |
|
194 |
+ let factory; |
|
195 |
+ switch (subject.parameters.protocol) { |
|
196 |
+ case undefined: |
|
197 |
+ case "http": { |
|
198 |
+ factory = ((options, listener) => require("http").createServer(listener)); |
|
199 |
+ break; |
|
200 |
+ } |
|
201 |
+ case "https": { |
|
202 |
+ factory = ((options, listener) => require("https").createServer(options, listener)); |
|
203 |
+ break; |
|
204 |
+ } |
|
205 |
+ default: { |
|
206 |
+ return lib_call.promise_reject(new Error(`no module for protocol '${subject.parameters.protocol}'`)); |
|
207 |
+ break; |
|
208 |
+ } |
|
209 |
+ } |
|
210 |
+ const listener = (request, response) => { |
|
211 |
+ // headers |
|
212 |
+ { |
|
213 |
+ Object.keys(subject.parameters.headers) |
|
214 |
+ .forEach((name) => { |
|
215 |
+ const value = subject.parameters.headers[name]; |
|
216 |
+ if (value != null) { |
|
217 |
+ response.setHeader(name, value); |
|
218 |
+ } |
|
219 |
+ }); |
|
220 |
+ } |
|
221 |
+ let message = null; |
|
222 |
+ request.on("data", (buffer) => { |
|
223 |
+ message = buffer.toString(); |
|
224 |
+ }); |
|
225 |
+ request.on("end", () => { |
|
226 |
+ switch (request.method) { |
|
227 |
+ case "OPTIONS": { |
|
228 |
+ response.writeHead(200); |
|
229 |
+ response.end("options-echo"); |
|
230 |
+ break; |
|
231 |
+ } |
|
232 |
+ case "POST": { |
|
233 |
+ lib_call.promise_then_close(subject.answering(message), (answer) => { |
|
234 |
+ response.writeHead(answer.code); |
|
235 |
+ response.end(answer.text); |
|
236 |
+ }, (error) => { |
|
237 |
+ console.error(error); |
|
238 |
+ response.writeHead(500); |
|
239 |
+ response.end("internal error"); |
|
240 |
+ }); |
|
241 |
+ break; |
|
242 |
+ } |
|
243 |
+ default: { |
|
244 |
+ response.writeHead(500); |
|
245 |
+ response.end(`unhandled method ${request.method}`); |
|
246 |
+ break; |
|
247 |
+ } |
|
248 |
+ } |
|
249 |
+ }); |
|
250 |
+ }; |
|
251 |
+ const _fs = require("fs"); |
|
252 |
+ let options = {}; |
|
253 |
+ if (subject.parameters.ssl_key !== undefined) { |
|
254 |
+ options["key"] = _fs.readFileSync(subject.parameters.ssl_key); |
|
255 |
+ } |
|
256 |
+ if (subject.parameters.ssl_cert !== undefined) { |
|
257 |
+ options["cert"] = _fs.readFileSync(subject.parameters.ssl_cert); |
|
258 |
+ } |
|
259 |
+ if (subject.parameters.ssl_ca !== undefined) { |
|
260 |
+ options["ca"] = _fs.readFileSync(subject.parameters.ssl_ca); |
|
261 |
+ } |
|
262 |
+ // setup server instance |
|
263 |
+ subject.serverinstance = factory(options, listener); |
|
264 |
+ subject.serverinstance.on("clientError", (error, socket) => { |
|
265 |
+ socket.end("HTTP/1.1 400 Bad Request\r\n\r\n"); |
|
266 |
+ }); |
|
267 |
+ return lib_call.promise_resolve(undefined); |
|
268 |
+ } |
|
269 |
+ lib_comm.server_http_setup = server_http_setup; |
|
270 |
+ /** |
|
271 |
+ * @author fenris |
|
272 |
+ */ |
|
273 |
+ function server_http_run(subject) { |
|
274 |
+ subject.serverinstance.listen(subject.parameters.port); |
|
275 |
+ } |
|
276 |
+ lib_comm.server_http_run = server_http_run; |
|
277 |
+})(lib_comm || (lib_comm = {})); |
|
278 |
+/* |
|
279 |
+This file is part of »bacterio-plankton:comm-server«. |
|
280 |
+ |
|
281 |
+Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
282 |
+<info@greenscale.de> |
|
283 |
+ |
|
284 |
+»bacterio-plankton:comm-server« is free software: you can redistribute it and/or modify |
|
285 |
+it under the terms of the GNU Lesser General Public License as published by |
|
286 |
+the Free Software Foundation, either version 3 of the License, or |
|
287 |
+(at your option) any later version. |
|
288 |
+ |
|
289 |
+»bacterio-plankton:comm-server« is distributed in the hope that it will be useful, |
|
290 |
+but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
291 |
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
292 |
+GNU Lesser General Public License for more details. |
|
293 |
+ |
|
294 |
+You should have received a copy of the GNU Lesser General Public License |
|
295 |
+along with »bacterio-plankton:comm-server«. If not, see <http://www.gnu.org/licenses/>. |
|
296 |
+ */ |
|
297 |
+var lib_comm; |
|
298 |
+(function (lib_comm) { |
|
299 |
+ /** |
|
300 |
+ * @author fenris |
|
301 |
+ */ |
|
302 |
+ lib_trait.attend("comm-server", "http", { |
|
303 |
+ "state": { |
|
304 |
+ "name": "any" |
|
305 |
+ }, |
|
306 |
+ "message_in": { |
|
307 |
+ "name": "string" |
|
308 |
+ }, |
|
309 |
+ "message_out": { |
|
310 |
+ "name": "any" // type_response_http |
|
311 |
+ } |
|
312 |
+ }, { |
|
313 |
+ "setup": () => (state) => (answering) => { |
|
314 |
+ return lib_comm.server_http_setup(state, answering).then(() => lib_call.promise_resolve(state)); |
|
315 |
+ }, |
|
316 |
+ "run": () => (state) => { |
|
317 |
+ return lib_comm.server_http_run(state); |
|
318 |
+ } |
|
319 |
+ }); |
|
320 |
+})(lib_comm || (lib_comm = {})); |
|
321 |
+/* |
|
322 |
+This file is part of »bacterio-plankton:comm-server«. |
|
323 |
+ |
|
324 |
+Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
325 |
+<info@greenscale.de> |
|
326 |
+ |
|
327 |
+»bacterio-plankton:comm-server« is free software: you can redistribute it and/or modify |
|
328 |
+it under the terms of the GNU Lesser General Public License as published by |
|
329 |
+the Free Software Foundation, either version 3 of the License, or |
|
330 |
+(at your option) any later version. |
|
331 |
+ |
|
332 |
+»bacterio-plankton:comm-server« is distributed in the hope that it will be useful, |
|
333 |
+but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
334 |
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
335 |
+GNU Lesser General Public License for more details. |
|
336 |
+ |
|
337 |
+You should have received a copy of the GNU Lesser General Public License |
|
338 |
+along with »bacterio-plankton:comm-server«. If not, see <http://www.gnu.org/licenses/>. |
|
339 |
+ */ |
|
340 |
+var lib_comm; |
|
341 |
+(function (lib_comm) { |
|
342 |
+ /** |
|
343 |
+ * @author fenris |
|
344 |
+ */ |
|
345 |
+ class class_server_http { |
|
346 |
+ /** |
|
347 |
+ * @author fenris |
|
348 |
+ */ |
|
349 |
+ constructor(parameters = lib_comm.default_parameters_server_http) { |
|
350 |
+ this.subject = lib_comm.server_http_construct(parameters); |
|
351 |
+ } |
|
352 |
+ /** |
|
353 |
+ * @author fenris |
|
354 |
+ * @implementation |
|
355 |
+ */ |
|
356 |
+ setup(answering) { |
|
357 |
+ return lib_comm.server_http_setup(this.subject, answering); |
|
358 |
+ } |
|
359 |
+ /** |
|
360 |
+ * @author fenris |
|
361 |
+ * @implementation |
|
362 |
+ */ |
|
363 |
+ run() { |
|
364 |
+ return lib_comm.server_http_run(this.subject); |
|
365 |
+ } |
|
366 |
+ } |
|
367 |
+ lib_comm.class_server_http = class_server_http; |
|
368 |
+})(lib_comm || (lib_comm = {})); |
|
369 |
+/* |
|
370 |
+This file is part of »bacterio-plankton:comm-server«. |
|
371 |
+ |
|
372 |
+Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
373 |
+<info@greenscale.de> |
|
374 |
+ |
|
375 |
+»bacterio-plankton:comm-server« is free software: you can redistribute it and/or modify |
|
376 |
+it under the terms of the GNU Lesser General Public License as published by |
|
377 |
+the Free Software Foundation, either version 3 of the License, or |
|
378 |
+(at your option) any later version. |
|
379 |
+ |
|
380 |
+»bacterio-plankton:comm-server« is distributed in the hope that it will be useful, |
|
381 |
+but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
382 |
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
383 |
+GNU Lesser General Public License for more details. |
|
384 |
+ |
|
385 |
+You should have received a copy of the GNU Lesser General Public License |
|
386 |
+along with »bacterio-plankton:comm-server«. If not, see <http://www.gnu.org/licenses/>. |
|
387 |
+ */ |
|
388 |
+var lib_comm; |
|
389 |
+(function (lib_comm) { |
|
390 |
+ /** |
|
391 |
+ * @author fenris |
|
392 |
+ */ |
|
393 |
+ class class_server_mhttp { |
|
394 |
+ /** |
|
395 |
+ * @author fenris |
|
396 |
+ */ |
|
397 |
+ constructor(parameters = lib_comm.default_parameters_server_http) { |
|
398 |
+ this.core = new lib_comm.class_server_http(parameters); |
|
399 |
+ } |
|
400 |
+ /** |
|
401 |
+ * @author fenris |
|
402 |
+ * @implementation |
|
403 |
+ */ |
|
404 |
+ setup(answering) { |
|
405 |
+ return (this.core.setup((message) => (answering(message) |
|
406 |
+ .then((text) => { |
|
407 |
+ let response = { "code": 200, "text": text }; |
|
408 |
+ return lib_call.promise_resolve(response); |
|
409 |
+ })))); |
|
410 |
+ } |
|
411 |
+ /** |
|
412 |
+ * @author fenris |
|
413 |
+ * @implementation |
|
414 |
+ */ |
|
415 |
+ run() { |
|
416 |
+ this.core.run(); |
|
417 |
+ } |
|
418 |
+ } |
|
419 |
+ lib_comm.class_server_mhttp = class_server_mhttp; |
|
420 |
+})(lib_comm || (lib_comm = {})); |
|
421 |
+/* |
|
422 |
+This file is part of »bacterio-plankton:comm-server«. |
|
423 |
+ |
|
424 |
+Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
425 |
+<info@greenscale.de> |
|
426 |
+ |
|
427 |
+»bacterio-plankton:comm-server« is free software: you can redistribute it and/or modify |
|
428 |
+it under the terms of the GNU Lesser General Public License as published by |
|
429 |
+the Free Software Foundation, either version 3 of the License, or |
|
430 |
+(at your option) any later version. |
|
431 |
+ |
|
432 |
+»bacterio-plankton:comm-server« is distributed in the hope that it will be useful, |
|
433 |
+but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
434 |
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
435 |
+GNU Lesser General Public License for more details. |
|
436 |
+ |
|
437 |
+You should have received a copy of the GNU Lesser General Public License |
|
438 |
+along with »bacterio-plankton:comm-server«. If not, see <http://www.gnu.org/licenses/>. |
|
439 |
+ */ |
|
440 |
+var lib_comm; |
|
441 |
+(function (lib_comm) { |
|
442 |
+ /** |
|
443 |
+ * @desc wrapper for string-based servers |
|
444 |
+ * @author fenris |
|
445 |
+ */ |
|
446 |
+ class class_server_complex { |
|
447 |
+ /** |
|
448 |
+ * @author fenris |
|
449 |
+ */ |
|
450 |
+ constructor(core, code = new lib_code.class_code_pair(new lib_code.class_code_json(), new lib_code.class_code_uri())) { |
|
451 |
+ this.core = core; |
|
452 |
+ this.code = code; |
|
453 |
+ } |
|
454 |
+ /** |
|
455 |
+ * @author fenris |
|
456 |
+ * @implementation |
|
457 |
+ */ |
|
458 |
+ setup(answering) { |
|
459 |
+ return (this.core.setup((message_in_raw) => { |
|
460 |
+ const message_in = ((message_in_raw == null) |
|
461 |
+ ? null |
|
462 |
+ : this.code.decode(message_in_raw)); |
|
463 |
+ return (answering(message_in) |
|
464 |
+ .then((message_out) => { |
|
465 |
+ const message_out_raw = this.code.encode(message_out); |
|
466 |
+ return lib_call.promise_resolve(message_out_raw); |
|
467 |
+ })); |
|
468 |
+ })); |
|
469 |
+ } |
|
470 |
+ /** |
|
471 |
+ * @author fenris |
|
472 |
+ * @implementation |
|
473 |
+ */ |
|
474 |
+ run() { |
|
475 |
+ this.core.run(); |
|
476 |
+ } |
|
477 |
+ } |
|
478 |
+ lib_comm.class_server_complex = class_server_complex; |
|
479 |
+})(lib_comm || (lib_comm = {})); |
... | ... |
@@ -0,0 +1,861 @@ |
1 |
+Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
2 |
+<info@greenscale.de> |
|
3 |
+ |
|
4 |
+»bacterio-plankton:object« is free software: you can redistribute it and/or modify |
|
5 |
+it under the terms of the GNU Lesser General Public License as published by |
|
6 |
+the Free Software Foundation, either version 3 of the License, or |
|
7 |
+(at your option) any later version. |
|
8 |
+ |
|
9 |
+»bacterio-plankton:object« is distributed in the hope that it will be useful, |
|
10 |
+but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 |
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 |
+GNU Lesser General Public License for more details. |
|
13 |
+ |
|
14 |
+You should have received a copy of the GNU Lesser General Public License |
|
15 |
+along with »bacterio-plankton:object«. If not, see <http://www.gnu.org/licenses/>. |
|
16 |
+ |
|
17 |
+ |
|
18 |
+ |
|
19 |
+ GNU GENERAL PUBLIC LICENSE |
|
20 |
+ Version 3, 29 June 2007 |
|
21 |
+ |
|
22 |
+ Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/> |
|
23 |
+ Everyone is permitted to copy and distribute verbatim copies |
|
24 |
+ of this license document, but changing it is not allowed. |
|
25 |
+ |
|
26 |
+ Preamble |
|
27 |
+ |
|
28 |
+ The GNU General Public License is a free, copyleft license for |
|
29 |
+software and other kinds of works. |
|
30 |
+ |
|
31 |
+ The licenses for most software and other practical works are designed |
|
32 |
+to take away your freedom to share and change the works. By contrast, |
|
33 |
+the GNU General Public License is intended to guarantee your freedom to |
|
34 |
+share and change all versions of a program--to make sure it remains free |
|
35 |
+software for all its users. We, the Free Software Foundation, use the |
|
36 |
+GNU General Public License for most of our software; it applies also to |
|
37 |
+any other work released this way by its authors. You can apply it to |
|
38 |
+your programs, too. |
|
39 |
+ |
|
40 |
+ When we speak of free software, we are referring to freedom, not |
|
41 |
+price. Our General Public Licenses are designed to make sure that you |
|
42 |
+have the freedom to distribute copies of free software (and charge for |
|
43 |
+them if you wish), that you receive source code or can get it if you |
|
44 |
+want it, that you can change the software or use pieces of it in new |
|
45 |
+free programs, and that you know you can do these things. |
|
46 |
+ |
|
47 |
+ To protect your rights, we need to prevent others from denying you |
|
48 |
+these rights or asking you to surrender the rights. Therefore, you have |
|
49 |
+certain responsibilities if you distribute copies of the software, or if |
|
50 |
+you modify it: responsibilities to respect the freedom of others. |
|
51 |
+ |
|
52 |
+ For example, if you distribute copies of such a program, whether |
|
53 |
+gratis or for a fee, you must pass on to the recipients the same |
|
54 |
+freedoms that you received. You must make sure that they, too, receive |
|
55 |
+or can get the source code. And you must show them these terms so they |
|
56 |
+know their rights. |
|
57 |
+ |
|
58 |
+ Developers that use the GNU GPL protect your rights with two steps: |
|
59 |
+(1) assert copyright on the software, and (2) offer you this License |
|
60 |
+giving you legal permission to copy, distribute and/or modify it. |
|
61 |
+ |
|
62 |
+ For the developers' and authors' protection, the GPL clearly explains |
|
63 |
+that there is no warranty for this free software. For both users' and |
|
64 |
+authors' sake, the GPL requires that modified versions be marked as |
|
65 |
+changed, so that their problems will not be attributed erroneously to |
|
66 |
+authors of previous versions. |
|
67 |
+ |
|
68 |
+ Some devices are designed to deny users access to install or run |
|
69 |
+modified versions of the software inside them, although the manufacturer |
|
70 |
+can do so. This is fundamentally incompatible with the aim of |
|
71 |
+protecting users' freedom to change the software. The systematic |
|
72 |
+pattern of such abuse occurs in the area of products for individuals to |
|
73 |
+use, which is precisely where it is most unacceptable. Therefore, we |
|
74 |
+have designed this version of the GPL to prohibit the practice for those |
|
75 |
+products. If such problems arise substantially in other domains, we |
|
76 |
+stand ready to extend this provision to those domains in future versions |
|
77 |
+of the GPL, as needed to protect the freedom of users. |
|
78 |
+ |
|
79 |
+ Finally, every program is threatened constantly by software patents. |
|
80 |
+States should not allow patents to restrict development and use of |
|
81 |
+software on general-purpose computers, but in those that do, we wish to |
|
82 |
+avoid the special danger that patents applied to a free program could |
|
83 |
+make it effectively proprietary. To prevent this, the GPL assures that |
|
84 |
+patents cannot be used to render the program non-free. |
|
85 |
+ |
|
86 |
+ The precise terms and conditions for copying, distribution and |
|
87 |
+modification follow. |
|
88 |
+ |
|
89 |
+ TERMS AND CONDITIONS |
|
90 |
+ |
|
91 |
+ 0. Definitions. |
|
92 |
+ |
|
93 |
+ "This License" refers to version 3 of the GNU General Public License. |
|
94 |
+ |
|
95 |
+ "Copyright" also means copyright-like laws that apply to other kinds of |
|
96 |
+works, such as semiconductor masks. |
|
97 |
+ |
|
98 |
+ "The Program" refers to any copyrightable work licensed under this |
|
99 |
+License. Each licensee is addressed as "you". "Licensees" and |
|
100 |
+"recipients" may be individuals or organizations. |
|
101 |
+ |
|
102 |
+ To "modify" a work means to copy from or adapt all or part of the work |
|
103 |
+in a fashion requiring copyright permission, other than the making of an |
|
104 |
+exact copy. The resulting work is called a "modified version" of the |
|
105 |
+earlier work or a work "based on" the earlier work. |
|
106 |
+ |
|
107 |
+ A "covered work" means either the unmodified Program or a work based |
|
108 |
+on the Program. |
|
109 |
+ |
|
110 |
+ To "propagate" a work means to do anything with it that, without |
|
111 |
+permission, would make you directly or secondarily liable for |
|
112 |
+infringement under applicable copyright law, except executing it on a |
|
113 |
+computer or modifying a private copy. Propagation includes copying, |
|
114 |
+distribution (with or without modification), making available to the |
|
115 |
+public, and in some countries other activities as well. |
|
116 |
+ |
|
117 |
+ To "convey" a work means any kind of propagation that enables other |
|
118 |
+parties to make or receive copies. Mere interaction with a user through |
|
119 |
+a computer network, with no transfer of a copy, is not conveying. |
|
120 |
+ |
|
121 |
+ An interactive user interface displays "Appropriate Legal Notices" |
|
122 |
+to the extent that it includes a convenient and prominently visible |
|
123 |
+feature that (1) displays an appropriate copyright notice, and (2) |
|
124 |
+tells the user that there is no warranty for the work (except to the |
|
125 |
+extent that warranties are provided), that licensees may convey the |
|
126 |
+work under this License, and how to view a copy of this License. If |
|
127 |
+the interface presents a list of user commands or options, such as a |
|
128 |
+menu, a prominent item in the list meets this criterion. |
|
129 |
+ |
|
130 |
+ 1. Source Code. |
|
131 |
+ |
|
132 |
+ The "source code" for a work means the preferred form of the work |
|
133 |
+for making modifications to it. "Object code" means any non-source |
|
134 |
+form of a work. |
|
135 |
+ |
|
136 |
+ A "Standard Interface" means an interface that either is an official |
|
137 |
+standard defined by a recognized standards body, or, in the case of |
|
138 |
+interfaces specified for a particular programming language, one that |
|
139 |
+is widely used among developers working in that language. |
|
140 |
+ |
|
141 |
+ The "System Libraries" of an executable work include anything, other |
|
142 |
+than the work as a whole, that (a) is included in the normal form of |
|
143 |
+packaging a Major Component, but which is not part of that Major |
|
144 |
+Component, and (b) serves only to enable use of the work with that |
|
145 |
+Major Component, or to implement a Standard Interface for which an |
|
146 |
+implementation is available to the public in source code form. A |
|
147 |
+"Major Component", in this context, means a major essential component |
|
148 |
+(kernel, window system, and so on) of the specific operating system |
|
149 |
+(if any) on which the executable work runs, or a compiler used to |
|
150 |
+produce the work, or an object code interpreter used to run it. |
|
151 |
+ |
|
152 |
+ The "Corresponding Source" for a work in object code form means all |
|
153 |
+the source code needed to generate, install, and (for an executable |
|
154 |
+work) run the object code and to modify the work, including scripts to |
|
155 |
+control those activities. However, it does not include the work's |
|
156 |
+System Libraries, or general-purpose tools or generally available free |
|
157 |
+programs which are used unmodified in performing those activities but |
|
158 |
+which are not part of the work. For example, Corresponding Source |
|
159 |
+includes interface definition files associated with source files for |
|
160 |
+the work, and the source code for shared libraries and dynamically |
|
161 |
+linked subprograms that the work is specifically designed to require, |
|
162 |
+such as by intimate data communication or control flow between those |
|
163 |
+subprograms and other parts of the work. |
|
164 |
+ |
|
165 |
+ The Corresponding Source need not include anything that users |
|
166 |
+can regenerate automatically from other parts of the Corresponding |
|
167 |
+Source. |
|
168 |
+ |
|
169 |
+ The Corresponding Source for a work in source code form is that |
|
170 |
+same work. |
|
171 |
+ |
|
172 |
+ 2. Basic Permissions. |
|
173 |
+ |
|
174 |
+ All rights granted under this License are granted for the term of |
|
175 |
+copyright on the Program, and are irrevocable provided the stated |
|
176 |
+conditions are met. This License explicitly affirms your unlimited |
|
177 |
+permission to run the unmodified Program. The output from running a |
|
178 |
+covered work is covered by this License only if the output, given its |
|
179 |
+content, constitutes a covered work. This License acknowledges your |
|
180 |
+rights of fair use or other equivalent, as provided by copyright law. |
|
181 |
+ |
|
182 |
+ You may make, run and propagate covered works that you do not |
|
183 |
+convey, without conditions so long as your license otherwise remains |
|
184 |
+in force. You may convey covered works to others for the sole purpose |
|
185 |
+of having them make modifications exclusively for you, or provide you |
|
186 |
+with facilities for running those works, provided that you comply with |
|
187 |
+the terms of this License in conveying all material for which you do |
|
188 |
+not control copyright. Those thus making or running the covered works |
|
189 |
+for you must do so exclusively on your behalf, under your direction |
|
190 |
+and control, on terms that prohibit them from making any copies of |
|
191 |
+your copyrighted material outside their relationship with you. |
|
192 |
+ |
|
193 |
+ Conveying under any other circumstances is permitted solely under |
|
194 |
+the conditions stated below. Sublicensing is not allowed; section 10 |
|
195 |
+makes it unnecessary. |
|
196 |
+ |
|
197 |
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law. |
|
198 |
+ |
|
199 |
+ No covered work shall be deemed part of an effective technological |
|
200 |
+measure under any applicable law fulfilling obligations under article |
|
201 |
+11 of the WIPO copyright treaty adopted on 20 December 1996, or |
|
202 |
+similar laws prohibiting or restricting circumvention of such |
|
203 |
+measures. |
|
204 |
+ |
|
205 |
+ When you convey a covered work, you waive any legal power to forbid |
|
206 |
+circumvention of technological measures to the extent such circumvention |
|
207 |
+is effected by exercising rights under this License with respect to |
|
208 |
+the covered work, and you disclaim any intention to limit operation or |
|
209 |
+modification of the work as a means of enforcing, against the work's |
|
210 |
+users, your or third parties' legal rights to forbid circumvention of |
|
211 |
+technological measures. |
|
212 |
+ |
|
213 |
+ 4. Conveying Verbatim Copies. |
|
214 |
+ |
|
215 |
+ You may convey verbatim copies of the Program's source code as you |
|
216 |
+receive it, in any medium, provided that you conspicuously and |
|
217 |
+appropriately publish on each copy an appropriate copyright notice; |
|
218 |
+keep intact all notices stating that this License and any |
|
219 |
+non-permissive terms added in accord with section 7 apply to the code; |
|
220 |
+keep intact all notices of the absence of any warranty; and give all |
|
221 |
+recipients a copy of this License along with the Program. |
|
222 |
+ |
|
223 |
+ You may charge any price or no price for each copy that you convey, |
|
224 |
+and you may offer support or warranty protection for a fee. |
|
225 |
+ |
|
226 |
+ 5. Conveying Modified Source Versions. |
|
227 |
+ |
|
228 |
+ You may convey a work based on the Program, or the modifications to |
|
229 |
+produce it from the Program, in the form of source code under the |
|
230 |
+terms of section 4, provided that you also meet all of these conditions: |
|
231 |
+ |
|
232 |
+ a) The work must carry prominent notices stating that you modified |
|
233 |
+ it, and giving a relevant date. |
|
234 |
+ |
|
235 |
+ b) The work must carry prominent notices stating that it is |
|
236 |
+ released under this License and any conditions added under section |
|
237 |
+ 7. This requirement modifies the requirement in section 4 to |
|
238 |
+ "keep intact all notices". |
|
239 |
+ |
|
240 |
+ c) You must license the entire work, as a whole, under this |
|
241 |
+ License to anyone who comes into possession of a copy. This |
|
242 |
+ License will therefore apply, along with any applicable section 7 |
|
243 |
+ additional terms, to the whole of the work, and all its parts, |
|
244 |
+ regardless of how they are packaged. This License gives no |
|
245 |
+ permission to license the work in any other way, but it does not |
|
246 |
+ invalidate such permission if you have separately received it. |
|
247 |
+ |
|
248 |
+ d) If the work has interactive user interfaces, each must display |
|
249 |
+ Appropriate Legal Notices; however, if the Program has interactive |
|
250 |
+ interfaces that do not display Appropriate Legal Notices, your |
|
251 |
+ work need not make them do so. |
|
252 |
+ |
|
253 |
+ A compilation of a covered work with other separate and independent |
|
254 |
+works, which are not by their nature extensions of the covered work, |
|
255 |
+and which are not combined with it such as to form a larger program, |
|
256 |
+in or on a volume of a storage or distribution medium, is called an |
|
257 |
+"aggregate" if the compilation and its resulting copyright are not |
|
258 |
+used to limit the access or legal rights of the compilation's users |
|
259 |
+beyond what the individual works permit. Inclusion of a covered work |
|
260 |
+in an aggregate does not cause this License to apply to the other |
|
261 |
+parts of the aggregate. |
|
262 |
+ |
|
263 |
+ 6. Conveying Non-Source Forms. |
|
264 |
+ |
|
265 |
+ You may convey a covered work in object code form under the terms |
|
266 |
+of sections 4 and 5, provided that you also convey the |
|
267 |
+machine-readable Corresponding Source under the terms of this License, |
|
268 |
+in one of these ways: |
|
269 |
+ |
|
270 |
+ a) Convey the object code in, or embodied in, a physical product |
|
271 |
+ (including a physical distribution medium), accompanied by the |
|
272 |
+ Corresponding Source fixed on a durable physical medium |
|
273 |
+ customarily used for software interchange. |
|
274 |
+ |
|
275 |
+ b) Convey the object code in, or embodied in, a physical product |
|
276 |
+ (including a physical distribution medium), accompanied by a |
|
277 |
+ written offer, valid for at least three years and valid for as |
|
278 |
+ long as you offer spare parts or customer support for that product |
|
279 |
+ model, to give anyone who possesses the object code either (1) a |
|
280 |
+ copy of the Corresponding Source for all the software in the |
|
281 |
+ product that is covered by this License, on a durable physical |
|
282 |
+ medium customarily used for software interchange, for a price no |
|
283 |
+ more than your reasonable cost of physically performing this |
|
284 |
+ conveying of source, or (2) access to copy the |
|
285 |
+ Corresponding Source from a network server at no charge. |
|
286 |
+ |
|
287 |
+ c) Convey individual copies of the object code with a copy of the |
|
288 |
+ written offer to provide the Corresponding Source. This |
|
289 |
+ alternative is allowed only occasionally and noncommercially, and |
|
290 |
+ only if you received the object code with such an offer, in accord |
|
291 |
+ with subsection 6b. |
|
292 |
+ |
|
293 |
+ d) Convey the object code by offering access from a designated |
|
294 |
+ place (gratis or for a charge), and offer equivalent access to the |
|
295 |
+ Corresponding Source in the same way through the same place at no |
|
296 |
+ further charge. You need not require recipients to copy the |
|
297 |
+ Corresponding Source along with the object code. If the place to |
|
298 |
+ copy the object code is a network server, the Corresponding Source |
|
299 |
+ may be on a different server (operated by you or a third party) |
|
300 |
+ that supports equivalent copying facilities, provided you maintain |
|
301 |
+ clear directions next to the object code saying where to find the |
|
302 |
+ Corresponding Source. Regardless of what server hosts the |
|
303 |
+ Corresponding Source, you remain obligated to ensure that it is |
|
304 |
+ available for as long as needed to satisfy these requirements. |
|
305 |
+ |
|
306 |
+ e) Convey the object code using peer-to-peer transmission, provided |
|
307 |
+ you inform other peers where the object code and Corresponding |
|
308 |
+ Source of the work are being offered to the general public at no |
|
309 |
+ charge under subsection 6d. |
|
310 |
+ |
|
311 |
+ A separable portion of the object code, whose source code is excluded |
|
312 |
+from the Corresponding Source as a System Library, need not be |
|
313 |
+included in conveying the object code work. |
|
314 |
+ |
|
315 |
+ A "User Product" is either (1) a "consumer product", which means any |
|
316 |
+tangible personal property which is normally used for personal, family, |
|
317 |
+or household purposes, or (2) anything designed or sold for incorporation |
|
318 |
+into a dwelling. In determining whether a product is a consumer product, |
|
319 |
+doubtful cases shall be resolved in favor of coverage. For a particular |
|
320 |
+product received by a particular user, "normally used" refers to a |
|
321 |
+typical or common use of that class of product, regardless of the status |
|
322 |
+of the particular user or of the way in which the particular user |
|
323 |
+actually uses, or expects or is expected to use, the product. A product |
|
324 |
+is a consumer product regardless of whether the product has substantial |
|
325 |
+commercial, industrial or non-consumer uses, unless such uses represent |
|
326 |
+the only significant mode of use of the product. |
|
327 |
+ |
|
328 |
+ "Installation Information" for a User Product means any methods, |
|
329 |
+procedures, authorization keys, or other information required to install |
|
330 |
+and execute modified versions of a covered work in that User Product from |
|
331 |
+a modified version of its Corresponding Source. The information must |
|
332 |
+suffice to ensure that the continued functioning of the modified object |
|
333 |
+code is in no case prevented or interfered with solely because |
|
334 |
+modification has been made. |
|
335 |
+ |
|
336 |
+ If you convey an object code work under this section in, or with, or |
|
337 |
+specifically for use in, a User Product, and the conveying occurs as |
|
338 |
+part of a transaction in which the right of possession and use of the |
|
339 |
+User Product is transferred to the recipient in perpetuity or for a |
|
340 |
+fixed term (regardless of how the transaction is characterized), the |
|
341 |
+Corresponding Source conveyed under this section must be accompanied |
|
342 |
+by the Installation Information. But this requirement does not apply |
|
343 |
+if neither you nor any third party retains the ability to install |
|
344 |
+modified object code on the User Product (for example, the work has |
|
345 |
+been installed in ROM). |
|
346 |
+ |
|
347 |
+ The requirement to provide Installation Information does not include a |
|
348 |
+requirement to continue to provide support service, warranty, or updates |
|
349 |
+for a work that has been modified or installed by the recipient, or for |
|
350 |
+the User Product in which it has been modified or installed. Access to a |
|
351 |
+network may be denied when the modification itself materially and |
|
352 |
+adversely affects the operation of the network or violates the rules and |
|
353 |
+protocols for communication across the network. |
|
354 |
+ |
|
355 |
+ Corresponding Source conveyed, and Installation Information provided, |
|
356 |
+in accord with this section must be in a format that is publicly |
|
357 |
+documented (and with an implementation available to the public in |
|
358 |
+source code form), and must require no special password or key for |
|
359 |
+unpacking, reading or copying. |
|
360 |
+ |
|
361 |
+ 7. Additional Terms. |
|
362 |
+ |
|
363 |
+ "Additional permissions" are terms that supplement the terms of this |
|
364 |
+License by making exceptions from one or more of its conditions. |
|
365 |
+Additional permissions that are applicable to the entire Program shall |
|
366 |
+be treated as though they were included in this License, to the extent |
|
367 |
+that they are valid under applicable law. If additional permissions |
|
368 |
+apply only to part of the Program, that part may be used separately |
|
369 |
+under those permissions, but the entire Program remains governed by |
|
370 |
+this License without regard to the additional permissions. |
|
371 |
+ |
|
372 |
+ When you convey a copy of a covered work, you may at your option |
|
373 |
+remove any additional permissions from that copy, or from any part of |
|
374 |
+it. (Additional permissions may be written to require their own |
|
375 |
+removal in certain cases when you modify the work.) You may place |
|
376 |
+additional permissions on material, added by you to a covered work, |
|
377 |
+for which you have or can give appropriate copyright permission. |
|
378 |
+ |
|
379 |
+ Notwithstanding any other provision of this License, for material you |
|
380 |
+add to a covered work, you may (if authorized by the copyright holders of |
|
381 |
+that material) supplement the terms of this License with terms: |
|
382 |
+ |
|
383 |
+ a) Disclaiming warranty or limiting liability differently from the |
|
384 |
+ terms of sections 15 and 16 of this License; or |
|
385 |
+ |
|
386 |
+ b) Requiring preservation of specified reasonable legal notices or |
|
387 |
+ author attributions in that material or in the Appropriate Legal |
|
388 |
+ Notices displayed by works containing it; or |
|
389 |
+ |
|
390 |
+ c) Prohibiting misrepresentation of the origin of that material, or |
|
391 |
+ requiring that modified versions of such material be marked in |
|
392 |
+ reasonable ways as different from the original version; or |
|
393 |
+ |
|
394 |
+ d) Limiting the use for publicity purposes of names of licensors or |
|
395 |
+ authors of the material; or |
|
396 |
+ |
|
397 |
+ e) Declining to grant rights under trademark law for use of some |
|
398 |
+ trade names, trademarks, or service marks; or |
|
399 |
+ |
|
400 |
+ f) Requiring indemnification of licensors and authors of that |
|
401 |
+ material by anyone who conveys the material (or modified versions of |
|
402 |
+ it) with contractual assumptions of liability to the recipient, for |
|
403 |
+ any liability that these contractual assumptions directly impose on |
|
404 |
+ those licensors and authors. |
|
405 |
+ |
|
406 |
+ All other non-permissive additional terms are considered "further |
|
407 |
+restrictions" within the meaning of section 10. If the Program as you |
|
408 |
+received it, or any part of it, contains a notice stating that it is |
|
409 |
+governed by this License along with a term that is a further |
|
410 |
+restriction, you may remove that term. If a license document contains |
|
411 |
+a further restriction but permits relicensing or conveying under this |
|
412 |
+License, you may add to a covered work material governed by the terms |
|
413 |
+of that license document, provided that the further restriction does |
|
414 |
+not survive such relicensing or conveying. |
|
415 |
+ |
|
416 |
+ If you add terms to a covered work in accord with this section, you |
|
417 |
+must place, in the relevant source files, a statement of the |
|
418 |
+additional terms that apply to those files, or a notice indicating |
|
419 |
+where to find the applicable terms. |
|
420 |
+ |
|
421 |
+ Additional terms, permissive or non-permissive, may be stated in the |
|
422 |
+form of a separately written license, or stated as exceptions; |
|
423 |
+the above requirements apply either way. |
|
424 |
+ |
|
425 |
+ 8. Termination. |
|
426 |
+ |
|
427 |
+ You may not propagate or modify a covered work except as expressly |
|
428 |
+provided under this License. Any attempt otherwise to propagate or |
|
429 |
+modify it is void, and will automatically terminate your rights under |
|
430 |
+this License (including any patent licenses granted under the third |
|
431 |
+paragraph of section 11). |
|
432 |
+ |
|
433 |
+ However, if you cease all violation of this License, then your |
|
434 |
+license from a particular copyright holder is reinstated (a) |
|
435 |
+provisionally, unless and until the copyright holder explicitly and |
|
436 |
+finally terminates your license, and (b) permanently, if the copyright |
|
437 |
+holder fails to notify you of the violation by some reasonable means |
|
438 |
+prior to 60 days after the cessation. |
|
439 |
+ |
|
440 |
+ Moreover, your license from a particular copyright holder is |
|
441 |
+reinstated permanently if the copyright holder notifies you of the |
|
442 |
+violation by some reasonable means, this is the first time you have |
|
443 |
+received notice of violation of this License (for any work) from that |
|
444 |
+copyright holder, and you cure the violation prior to 30 days after |
|
445 |
+your receipt of the notice. |
|
446 |
+ |
|
447 |
+ Termination of your rights under this section does not terminate the |
|
448 |
+licenses of parties who have received copies or rights from you under |
|
449 |
+this License. If your rights have been terminated and not permanently |
|
450 |
+reinstated, you do not qualify to receive new licenses for the same |
|
451 |
+material under section 10. |
|
452 |
+ |
|
453 |
+ 9. Acceptance Not Required for Having Copies. |
|
454 |
+ |
|
455 |
+ You are not required to accept this License in order to receive or |
|
456 |
+run a copy of the Program. Ancillary propagation of a covered work |
|
457 |
+occurring solely as a consequence of using peer-to-peer transmission |
|
458 |
+to receive a copy likewise does not require acceptance. However, |
|
459 |
+nothing other than this License grants you permission to propagate or |
|
460 |
+modify any covered work. These actions infringe copyright if you do |
|
461 |
+not accept this License. Therefore, by modifying or propagating a |
|
462 |
+covered work, you indicate your acceptance of this License to do so. |
|
463 |
+ |
|
464 |
+ 10. Automatic Licensing of Downstream Recipients. |
|
465 |
+ |
|
466 |
+ Each time you convey a covered work, the recipient automatically |
|
467 |
+receives a license from the original licensors, to run, modify and |
|
468 |
+propagate that work, subject to this License. You are not responsible |
|
469 |
+for enforcing compliance by third parties with this License. |
|
470 |
+ |
|
471 |
+ An "entity transaction" is a transaction transferring control of an |
|
472 |
+organization, or substantially all assets of one, or subdividing an |
|
473 |
+organization, or merging organizations. If propagation of a covered |
|
474 |
+work results from an entity transaction, each party to that |
|
475 |
+transaction who receives a copy of the work also receives whatever |
|
476 |
+licenses to the work the party's predecessor in interest had or could |
|
477 |
+give under the previous paragraph, plus a right to possession of the |
|
478 |
+Corresponding Source of the work from the predecessor in interest, if |
|
479 |
+the predecessor has it or can get it with reasonable efforts. |
|
480 |
+ |
|
481 |
+ You may not impose any further restrictions on the exercise of the |
|
482 |
+rights granted or affirmed under this License. For example, you may |
|
483 |
+not impose a license fee, royalty, or other charge for exercise of |
|
484 |
+rights granted under this License, and you may not initiate litigation |
|
485 |
+(including a cross-claim or counterclaim in a lawsuit) alleging that |
|
486 |
+any patent claim is infringed by making, using, selling, offering for |
|
487 |
+sale, or importing the Program or any portion of it. |
|
488 |
+ |
|
489 |
+ 11. Patents. |
|
490 |
+ |
|
491 |
+ A "contributor" is a copyright holder who authorizes use under this |
|
492 |
+License of the Program or a work on which the Program is based. The |
|
493 |
+work thus licensed is called the contributor's "contributor version". |
|
494 |
+ |
|
495 |
+ A contributor's "essential patent claims" are all patent claims |
|
496 |
+owned or controlled by the contributor, whether already acquired or |
|
497 |
+hereafter acquired, that would be infringed by some manner, permitted |
|
498 |
+by this License, of making, using, or selling its contributor version, |
|
499 |
+but do not include claims that would be infringed only as a |
|
500 |
+consequence of further modification of the contributor version. For |
|
501 |
+purposes of this definition, "control" includes the right to grant |
|
502 |
+patent sublicenses in a manner consistent with the requirements of |
|
503 |
+this License. |
|
504 |
+ |
|
505 |
+ Each contributor grants you a non-exclusive, worldwide, royalty-free |
|
506 |
+patent license under the contributor's essential patent claims, to |
|
507 |
+make, use, sell, offer for sale, import and otherwise run, modify and |
|
508 |
+propagate the contents of its contributor version. |
|
509 |
+ |
|
510 |
+ In the following three paragraphs, a "patent license" is any express |
|
511 |
+agreement or commitment, however denominated, not to enforce a patent |
|
512 |
+(such as an express permission to practice a patent or covenant not to |
|
513 |
+sue for patent infringement). To "grant" such a patent license to a |
|
514 |
+party means to make such an agreement or commitment not to enforce a |
|
515 |
+patent against the party. |
|
516 |
+ |
|
517 |
+ If you convey a covered work, knowingly relying on a patent license, |
|
518 |
+and the Corresponding Source of the work is not available for anyone |
|
519 |
+to copy, free of charge and under the terms of this License, through a |
|
520 |
+publicly available network server or other readily accessible means, |
|
521 |
+then you must either (1) cause the Corresponding Source to be so |
|
522 |
+available, or (2) arrange to deprive yourself of the benefit of the |
|
523 |
+patent license for this particular work, or (3) arrange, in a manner |
|
524 |
+consistent with the requirements of this License, to extend the patent |
|
525 |
+license to downstream recipients. "Knowingly relying" means you have |
|
526 |
+actual knowledge that, but for the patent license, your conveying the |
|
527 |
+covered work in a country, or your recipient's use of the covered work |
|
528 |
+in a country, would infringe one or more identifiable patents in that |
|
529 |
+country that you have reason to believe are valid. |
|
530 |
+ |
|
531 |
+ If, pursuant to or in connection with a single transaction or |
|
532 |
+arrangement, you convey, or propagate by procuring conveyance of, a |
|
533 |
+covered work, and grant a patent license to some of the parties |
|
534 |
+receiving the covered work authorizing them to use, propagate, modify |
|
535 |
+or convey a specific copy of the covered work, then the patent license |
|
536 |
+you grant is automatically extended to all recipients of the covered |
|
537 |
+work and works based on it. |
|
538 |
+ |
|
539 |
+ A patent license is "discriminatory" if it does not include within |
|
540 |
+the scope of its coverage, prohibits the exercise of, or is |
|
541 |
+conditioned on the non-exercise of one or more of the rights that are |
|
542 |
+specifically granted under this License. You may not convey a covered |
|
543 |
+work if you are a party to an arrangement with a third party that is |
|
544 |
+in the business of distributing software, under which you make payment |
|
545 |
+to the third party based on the extent of your activity of conveying |
|
546 |
+the work, and under which the third party grants, to any of the |
|
547 |
+parties who would receive the covered work from you, a discriminatory |
|
548 |
+patent license (a) in connection with copies of the covered work |
|
549 |
+conveyed by you (or copies made from those copies), or (b) primarily |
|
550 |
+for and in connection with specific products or compilations that |
|
551 |
+contain the covered work, unless you entered into that arrangement, |
|
552 |
+or that patent license was granted, prior to 28 March 2007. |
|
553 |
+ |
|
554 |
+ Nothing in this License shall be construed as excluding or limiting |
|
555 |
+any implied license or other defenses to infringement that may |
|
556 |
+otherwise be available to you under applicable patent law. |
|
557 |
+ |
|
558 |
+ 12. No Surrender of Others' Freedom. |
|
559 |
+ |
|
560 |
+ If conditions are imposed on you (whether by court order, agreement or |
|
561 |
+otherwise) that contradict the conditions of this License, they do not |
|
562 |
+excuse you from the conditions of this License. If you cannot convey a |
|
563 |
+covered work so as to satisfy simultaneously your obligations under this |
|
564 |
+License and any other pertinent obligations, then as a consequence you may |
|
565 |
+not convey it at all. For example, if you agree to terms that obligate you |
|
566 |
+to collect a royalty for further conveying from those to whom you convey |
|
567 |
+the Program, the only way you could satisfy both those terms and this |
|
568 |
+License would be to refrain entirely from conveying the Program. |
|
569 |
+ |
|
570 |
+ 13. Use with the GNU Affero General Public License. |
|
571 |
+ |
|
572 |
+ Notwithstanding any other provision of this License, you have |
|
573 |
+permission to link or combine any covered work with a work licensed |
|
574 |
+under version 3 of the GNU Affero General Public License into a single |
|
575 |
+combined work, and to convey the resulting work. The terms of this |
|
576 |
+License will continue to apply to the part which is the covered work, |
|
577 |
+but the special requirements of the GNU Affero General Public License, |
|
578 |
+section 13, concerning interaction through a network will apply to the |
|
579 |
+combination as such. |
|
580 |
+ |
|
581 |
+ 14. Revised Versions of this License. |
|
582 |
+ |
|
583 |
+ The Free Software Foundation may publish revised and/or new versions of |
|
584 |
+the GNU General Public License from time to time. Such new versions will |
|
585 |
+be similar in spirit to the present version, but may differ in detail to |
|
586 |
+address new problems or concerns. |
|
587 |
+ |
|
588 |
+ Each version is given a distinguishing version number. If the |
|
589 |
+Program specifies that a certain numbered version of the GNU General |
|
590 |
+Public License "or any later version" applies to it, you have the |
|
591 |
+option of following the terms and conditions either of that numbered |
|
592 |
+version or of any later version published by the Free Software |
|
593 |
+Foundation. If the Program does not specify a version number of the |
|
594 |
+GNU General Public License, you may choose any version ever published |
|
595 |
+by the Free Software Foundation. |
|
596 |
+ |
|
597 |
+ If the Program specifies that a proxy can decide which future |
|
598 |
+versions of the GNU General Public License can be used, that proxy's |
|
599 |
+public statement of acceptance of a version permanently authorizes you |
|
600 |
+to choose that version for the Program. |
|
601 |
+ |
|
602 |
+ Later license versions may give you additional or different |
|
603 |
+permissions. However, no additional obligations are imposed on any |
|
604 |
+author or copyright holder as a result of your choosing to follow a |
|
605 |
+later version. |
|
606 |
+ |
|
607 |
+ 15. Disclaimer of Warranty. |
|
608 |
+ |
|
609 |
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY |
|
610 |
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT |
|
611 |
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY |
|
612 |
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, |
|
613 |
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
|
614 |
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM |
|
615 |
+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF |
|
616 |
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION. |
|
617 |
+ |
|
618 |
+ 16. Limitation of Liability. |
|
619 |
+ |
|
620 |
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING |
|
621 |
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS |
|
622 |
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY |
|
623 |
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE |
|
624 |
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF |
|
625 |
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD |
|
626 |
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), |
|
627 |
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF |
|
628 |
+SUCH DAMAGES. |
|
629 |
+ |
|
630 |
+ 17. Interpretation of Sections 15 and 16. |
|
631 |
+ |
|
632 |
+ If the disclaimer of warranty and limitation of liability provided |
|
633 |
+above cannot be given local legal effect according to their terms, |
|
634 |
+reviewing courts shall apply local law that most closely approximates |
|
635 |
+an absolute waiver of all civil liability in connection with the |
|
636 |
+Program, unless a warranty or assumption of liability accompanies a |
|
637 |
+copy of the Program in return for a fee. |
|
638 |
+ |
|
639 |
+ END OF TERMS AND CONDITIONS |
|
640 |
+ |
|
641 |
+ How to Apply These Terms to Your New Programs |
|
642 |
+ |
|
643 |
+ If you develop a new program, and you want it to be of the greatest |
|
644 |
+possible use to the public, the best way to achieve this is to make it |
|
645 |
+free software which everyone can redistribute and change under these terms. |
|
646 |
+ |
|
647 |
+ To do so, attach the following notices to the program. It is safest |
|
648 |
+to attach them to the start of each source file to most effectively |
|
649 |
+state the exclusion of warranty; and each file should have at least |
|
650 |
+the "copyright" line and a pointer to where the full notice is found. |
|
651 |
+ |
|
652 |
+ <one line to give the program's name and a brief idea of what it does.> |
|
653 |
+ Copyright (C) <year> <name of author> |
|
654 |
+ |
|
655 |
+ This program is free software: you can redistribute it and/or modify |
|
656 |
+ it under the terms of the GNU General Public License as published by |
|
657 |
+ the Free Software Foundation, either version 3 of the License, or |
|
658 |
+ (at your option) any later version. |
|
659 |
+ |
|
660 |
+ This program is distributed in the hope that it will be useful, |
|
661 |
+ but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
662 |
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
663 |
+ GNU General Public License for more details. |
|
664 |
+ |
|
665 |
+ You should have received a copy of the GNU General Public License |
|
666 |
+ along with this program. If not, see <https://www.gnu.org/licenses/>. |
|
667 |
+ |
|
668 |
+Also add information on how to contact you by electronic and paper mail. |
|
669 |
+ |
|
670 |
+ If the program does terminal interaction, make it output a short |
|
671 |
+notice like this when it starts in an interactive mode: |
|
672 |
+ |
|
673 |
+ <program> Copyright (C) <year> <name of author> |
|
674 |
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. |
|
675 |
+ This is free software, and you are welcome to redistribute it |
|
676 |
+ under certain conditions; type `show c' for details. |
|
677 |
+ |
|
678 |
+The hypothetical commands `show w' and `show c' should show the appropriate |
|
679 |
+parts of the General Public License. Of course, your program's commands |
|
680 |
+might be different; for a GUI interface, you would use an "about box". |
|
681 |
+ |
|
682 |
+ You should also get your employer (if you work as a programmer) or school, |
|
683 |
+if any, to sign a "copyright disclaimer" for the program, if necessary. |
|
684 |
+For more information on this, and how to apply and follow the GNU GPL, see |
|
685 |
+<https://www.gnu.org/licenses/>. |
|
686 |
+ |
|
687 |
+ The GNU General Public License does not permit incorporating your program |
|
688 |
+into proprietary programs. If your program is a subroutine library, you |
|
689 |
+may consider it more useful to permit linking proprietary applications with |
|
690 |
+the library. If this is what you want to do, use the GNU Lesser General |
|
691 |
+Public License instead of this License. But first, please read |
|
692 |
+<https://www.gnu.org/licenses/why-not-lgpl.html>. |
|
693 |
+ |
|
694 |
+ |
|
695 |
+ |
|
696 |
+ GNU LESSER GENERAL PUBLIC LICENSE |
|
697 |
+ Version 3, 29 June 2007 |
|
698 |
+ |
|
699 |
+ Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/> |
|
700 |
+ Everyone is permitted to copy and distribute verbatim copies |
|
701 |
+ of this license document, but changing it is not allowed. |
|
702 |
+ |
|
703 |
+ |
|
704 |
+ This version of the GNU Lesser General Public License incorporates |
|
705 |
+the terms and conditions of version 3 of the GNU General Public |
|
706 |
+License, supplemented by the additional permissions listed below. |
|
707 |
+ |
|
708 |
+ 0. Additional Definitions. |
|
709 |
+ |
|
710 |
+ As used herein, "this License" refers to version 3 of the GNU Lesser |
|
711 |
+General Public License, and the "GNU GPL" refers to version 3 of the GNU |
|
712 |
+General Public License. |
|
713 |
+ |
|
714 |
+ "The Library" refers to a covered work governed by this License, |
|
715 |
+other than an Application or a Combined Work as defined below. |
|
716 |
+ |
|
717 |
+ An "Application" is any work that makes use of an interface provided |
|
718 |
+by the Library, but which is not otherwise based on the Library. |
|
719 |
+Defining a subclass of a class defined by the Library is deemed a mode |
|
720 |
+of using an interface provided by the Library. |
|
721 |
+ |
|
722 |
+ A "Combined Work" is a work produced by combining or linking an |
|
723 |
+Application with the Library. The particular version of the Library |
|
724 |
+with which the Combined Work was made is also called the "Linked |
|
725 |
+Version". |
|
726 |
+ |
|
727 |
+ The "Minimal Corresponding Source" for a Combined Work means the |
|
728 |
+Corresponding Source for the Combined Work, excluding any source code |
|
729 |
+for portions of the Combined Work that, considered in isolation, are |
|
730 |
+based on the Application, and not on the Linked Version. |
|
731 |
+ |
|
732 |
+ The "Corresponding Application Code" for a Combined Work means the |
|
733 |
+object code and/or source code for the Application, including any data |
|
734 |
+and utility programs needed for reproducing the Combined Work from the |
|
735 |
+Application, but excluding the System Libraries of the Combined Work. |
|
736 |
+ |
|
737 |
+ 1. Exception to Section 3 of the GNU GPL. |
|
738 |
+ |
|
739 |
+ You may convey a covered work under sections 3 and 4 of this License |
|
740 |
+without being bound by section 3 of the GNU GPL. |
|
741 |
+ |
|
742 |
+ 2. Conveying Modified Versions. |
|
743 |
+ |
|
744 |
+ If you modify a copy of the Library, and, in your modifications, a |
|
745 |
+facility refers to a function or data to be supplied by an Application |
|
746 |
+that uses the facility (other than as an argument passed when the |
|
747 |
+facility is invoked), then you may convey a copy of the modified |
|
748 |
+version: |
|
749 |
+ |
|
750 |
+ a) under this License, provided that you make a good faith effort to |
|
751 |
+ ensure that, in the event an Application does not supply the |
|
752 |
+ function or data, the facility still operates, and performs |
|
753 |
+ whatever part of its purpose remains meaningful, or |
|
754 |
+ |
|
755 |
+ b) under the GNU GPL, with none of the additional permissions of |
|
756 |
+ this License applicable to that copy. |
|
757 |
+ |
|
758 |
+ 3. Object Code Incorporating Material from Library Header Files. |
|
759 |
+ |
|
760 |
+ The object code form of an Application may incorporate material from |
|
761 |
+a header file that is part of the Library. You may convey such object |
|
762 |
+code under terms of your choice, provided that, if the incorporated |
|
763 |
+material is not limited to numerical parameters, data structure |
|
764 |
+layouts and accessors, or small macros, inline functions and templates |
|
765 |
+(ten or fewer lines in length), you do both of the following: |
|
766 |
+ |
|
767 |
+ a) Give prominent notice with each copy of the object code that the |
|
768 |
+ Library is used in it and that the Library and its use are |
|
769 |
+ covered by this License. |
|
770 |
+ |
|
771 |
+ b) Accompany the object code with a copy of the GNU GPL and this license |
|
772 |
+ document. |
|
773 |
+ |
|
774 |
+ 4. Combined Works. |
|
775 |
+ |
|
776 |
+ You may convey a Combined Work under terms of your choice that, |
|
777 |
+taken together, effectively do not restrict modification of the |
|
778 |
+portions of the Library contained in the Combined Work and reverse |
|
779 |
+engineering for debugging such modifications, if you also do each of |
|
780 |
+the following: |
|
781 |
+ |
|
782 |
+ a) Give prominent notice with each copy of the Combined Work that |
|
783 |
+ the Library is used in it and that the Library and its use are |
|
784 |
+ covered by this License. |
|
785 |
+ |
|
786 |
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license |
|
787 |
+ document. |
|
788 |
+ |
|
789 |
+ c) For a Combined Work that displays copyright notices during |
|
790 |
+ execution, include the copyright notice for the Library among |
|
791 |
+ these notices, as well as a reference directing the user to the |
|
792 |
+ copies of the GNU GPL and this license document. |
|
793 |
+ |
|
794 |
+ d) Do one of the following: |
|
795 |
+ |
|
796 |
+ 0) Convey the Minimal Corresponding Source under the terms of this |
|
797 |
+ License, and the Corresponding Application Code in a form |
|
798 |
+ suitable for, and under terms that permit, the user to |
|
799 |
+ recombine or relink the Application with a modified version of |
|
800 |
+ the Linked Version to produce a modified Combined Work, in the |
|
801 |
+ manner specified by section 6 of the GNU GPL for conveying |
|
802 |
+ Corresponding Source. |
|
803 |
+ |
|
804 |
+ 1) Use a suitable shared library mechanism for linking with the |
|
805 |
+ Library. A suitable mechanism is one that (a) uses at run time |
|
806 |
+ a copy of the Library already present on the user's computer |
|
807 |
+ system, and (b) will operate properly with a modified version |
|
808 |
+ of the Library that is interface-compatible with the Linked |
|
809 |
+ Version. |
|
810 |
+ |
|
811 |
+ e) Provide Installation Information, but only if you would otherwise |
|
812 |
+ be required to provide such information under section 6 of the |
|
813 |
+ GNU GPL, and only to the extent that such information is |
|
814 |
+ necessary to install and execute a modified version of the |
|
815 |
+ Combined Work produced by recombining or relinking the |
|
816 |
+ Application with a modified version of the Linked Version. (If |
|
817 |
+ you use option 4d0, the Installation Information must accompany |
|
818 |
+ the Minimal Corresponding Source and Corresponding Application |
|
819 |
+ Code. If you use option 4d1, you must provide the Installation |
|
820 |
+ Information in the manner specified by section 6 of the GNU GPL |
|
821 |
+ for conveying Corresponding Source.) |
|
822 |
+ |
|
823 |
+ 5. Combined Libraries. |
|
824 |
+ |
|
825 |
+ You may place library facilities that are a work based on the |
|
826 |
+Library side by side in a single library together with other library |
|
827 |
+facilities that are not Applications and are not covered by this |
|
828 |
+License, and convey such a combined library under terms of your |
|
829 |
+choice, if you do both of the following: |
|
830 |
+ |
|
831 |
+ a) Accompany the combined library with a copy of the same work based |
|
832 |
+ on the Library, uncombined with any other library facilities, |
|
833 |
+ conveyed under the terms of this License. |
|
834 |
+ |
|
835 |
+ b) Give prominent notice with the combined library that part of it |
|
836 |
+ is a work based on the Library, and explaining where to find the |
|
837 |
+ accompanying uncombined form of the same work. |
|
838 |
+ |
|
839 |
+ 6. Revised Versions of the GNU Lesser General Public License. |
|
840 |
+ |
|
841 |
+ The Free Software Foundation may publish revised and/or new versions |
|
842 |
+of the GNU Lesser General Public License from time to time. Such new |
|
843 |
+versions will be similar in spirit to the present version, but may |
|
844 |
+differ in detail to address new problems or concerns. |
|
845 |
+ |
|
846 |
+ Each version is given a distinguishing version number. If the |
|
847 |
+Library as you received it specifies that a certain numbered version |
|
848 |
+of the GNU Lesser General Public License "or any later version" |
|
849 |
+applies to it, you have the option of following the terms and |
|
850 |
+conditions either of that published version or of any later version |
|
851 |
+published by the Free Software Foundation. If the Library as you |
|
852 |
+received it does not specify a version number of the GNU Lesser |
|
853 |
+General Public License, you may choose any version of the GNU Lesser |
|
854 |
+General Public License ever published by the Free Software Foundation. |
|
855 |
+ |
|
856 |
+ If the Library as you received it specifies that a proxy can decide |
|
857 |
+whether future versions of the GNU Lesser General Public License shall |
|
858 |
+apply, that proxy's public statement of acceptance of any version is |
|
859 |
+permanent authorization for you to choose that version for the |
|
860 |
+Library. |
|
861 |
+ |
... | ... |
@@ -0,0 +1,122 @@ |
1 |
+declare module lib_object { |
|
2 |
+ /** |
|
3 |
+ * @author fenris |
|
4 |
+ */ |
|
5 |
+ function fetch<type_value>(object: Object, fieldname: string, fallback?: type_value, escalation?: int): type_value; |
|
6 |
+ /** |
|
7 |
+ * @author fenris |
|
8 |
+ */ |
|
9 |
+ function map<type_from, type_to>(object_from: { |
|
10 |
+ [key: string]: type_from; |
|
11 |
+ }, transformator: (value_from: type_from, key?: string) => type_to): { |
|
12 |
+ [key: string]: type_to; |
|
13 |
+ }; |
|
14 |
+ /** |
|
15 |
+ * @desc gibt ein Objekt mit bestimmten Einträgen des Eingabe-Objekts zurück |
|
16 |
+ * @author fenris |
|
17 |
+ */ |
|
18 |
+ function filter<type_value>(object_from: { |
|
19 |
+ [key: string]: type_value; |
|
20 |
+ }, predicate: (value_from: type_value, key?: string) => boolean): { |
|
21 |
+ [key: string]: type_value; |
|
22 |
+ }; |
|
23 |
+ /** |
|
24 |
+ * @desc wandelt ein Array mit Einträgen der Form {key,value} in ein entsprechendes Objekt um |
|
25 |
+ * @author fenris |
|
26 |
+ */ |
|
27 |
+ function from_array<type_value>(array: Array<{ |
|
28 |
+ key: string; |
|
29 |
+ value: type_value; |
|
30 |
+ }>): { |
|
31 |
+ [key: string]: type_value; |
|
32 |
+ }; |
|
33 |
+ /** |
|
34 |
+ * @desc wandelt ein Objekt in ein entsprechendes Array mit Einträgen der Form {key,value} um |
|
35 |
+ * @author fenris |
|
36 |
+ */ |
|
37 |
+ function to_array<type_value>(object: { |
|
38 |
+ [key: string]: type_value; |
|
39 |
+ }): Array<{ |
|
40 |
+ key: string; |
|
41 |
+ value: type_value; |
|
42 |
+ }>; |
|
43 |
+ /** |
|
44 |
+ * @desc gibt eine Liste von Schlüsseln eines Objekts zurück |
|
45 |
+ * @author fenris |
|
46 |
+ */ |
|
47 |
+ function keys(object: { |
|
48 |
+ [key: string]: any; |
|
49 |
+ }): Array<string>; |
|
50 |
+ /** |
|
51 |
+ * @desc gibt eine Liste von Werten eines Objekts zurück |
|
52 |
+ * @author fenris |
|
53 |
+ */ |
|
54 |
+ function values<type_value>(object: { |
|
55 |
+ [key: string]: type_value; |
|
56 |
+ }): Array<type_value>; |
|
57 |
+ /** |
|
58 |
+ * @desc liest ein Baum-artiges Objekt an einer bestimmten Stelle aus |
|
59 |
+ * @author fenris |
|
60 |
+ */ |
|
61 |
+ function path_read<type_value>(object: Object, path: string, fallback?: type_value, escalation?: int): type_value; |
|
62 |
+ /** |
|
63 |
+ * @desc schreibt einen Wert an eine bestimmte Stelle in einem Baum-artigen Objekt |
|
64 |
+ * @author fenris |
|
65 |
+ */ |
|
66 |
+ function path_write<type_value>(object: Object, path: string, value: type_value, construct?: boolean): void; |
|
67 |
+ /** |
|
68 |
+ * @desc prüft ob ein Objekt einem bestimmten Muster entspricht |
|
69 |
+ * @param {Object} object das zu prüfende Objekt |
|
70 |
+ * @param {Object} pattern das einzuhaltende Muster |
|
71 |
+ * @param {Function} connlate eine Funktion zum Feststellen der Gleichheit von Einzelwerten |
|
72 |
+ * @author fenris |
|
73 |
+ */ |
|
74 |
+ function matches(object: Object, pattern: Object, collate?: typeof instance_collate): boolean; |
|
75 |
+ /** |
|
76 |
+ * @desc erzeugt eine Projektion eines Baum-artigen Objekts in ein Listen-artiges Objekt |
|
77 |
+ * @param {string} [separator] welches Zeichen als Trenner zwischen zwei Pfad-Schritten verwendet werden soll |
|
78 |
+ * @author fenris |
|
79 |
+ */ |
|
80 |
+ function flatten(value: any, separator?: string, key_for_element?: (index: int) => string): Object; |
|
81 |
+ /** |
|
82 |
+ * @author fenris |
|
83 |
+ */ |
|
84 |
+ function clash(x: { |
|
85 |
+ [key: string]: any; |
|
86 |
+ }, y: { |
|
87 |
+ [key: string]: any; |
|
88 |
+ }, { "overwrite": overwrite, "hooks": { "existing": hook_existing, }, }?: { |
|
89 |
+ overwrite?: boolean; |
|
90 |
+ hooks?: { |
|
91 |
+ existing?: (key?: string, value_old?: any, value_new?: any) => void; |
|
92 |
+ }; |
|
93 |
+ }): { |
|
94 |
+ [key: string]: any; |
|
95 |
+ }; |
|
96 |
+ /** |
|
97 |
+ * @author fenris |
|
98 |
+ */ |
|
99 |
+ function patch(core: Object, mantle: Object, deep?: boolean, path?: string): void; |
|
100 |
+ /** |
|
101 |
+ * @author fenris |
|
102 |
+ */ |
|
103 |
+ function patched(core: Object, mantle: Object, deep?: boolean): Object; |
|
104 |
+ /** |
|
105 |
+ * @author fenris |
|
106 |
+ */ |
|
107 |
+ function attached(object: Object, key: string, value: any): Object; |
|
108 |
+ /** |
|
109 |
+ * @author fenris |
|
110 |
+ */ |
|
111 |
+ function copy(object: Object): Object; |
|
112 |
+} |
|
113 |
+/** |
|
114 |
+ * @desc adapters for old syntax |
|
115 |
+ * @author fenris |
|
116 |
+ */ |
|
117 |
+declare var object_fetch: typeof lib_object.fetch; |
|
118 |
+declare var object_map: typeof lib_object.map; |
|
119 |
+declare var object_a2o: typeof lib_object.from_array; |
|
120 |
+declare var object_o2a: typeof lib_object.to_array; |
|
121 |
+declare var object_matches: typeof lib_object.matches; |
|
122 |
+declare var object_clash: typeof lib_object.clash; |
... | ... |
@@ -0,0 +1,376 @@ |
1 |
+/* |
|
2 |
+This file is part of »bacterio-plankton:object«. |
|
3 |
+ |
|
4 |
+Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
5 |
+<info@greenscale.de> |
|
6 |
+ |
|
7 |
+»bacterio-plankton:object« is free software: you can redistribute it and/or modify |
|
8 |
+it under the terms of the GNU Lesser General Public License as published by |
|
9 |
+the Free Software Foundation, either version 3 of the License, or |
|
10 |
+(at your option) any later version. |
|
11 |
+ |
|
12 |
+»bacterio-plankton:object« is distributed in the hope that it will be useful, |
|
13 |
+but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
14 |
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
15 |
+GNU Lesser General Public License for more details. |
|
16 |
+ |
|
17 |
+You should have received a copy of the GNU Lesser General Public License |
|
18 |
+along with »bacterio-plankton:object«. If not, see <http://www.gnu.org/licenses/>. |
|
19 |
+ */ |
|
20 |
+var lib_object; |
|
21 |
+(function (lib_object) { |
|
22 |
+ /** |
|
23 |
+ * @author fenris |
|
24 |
+ */ |
|
25 |
+ function fetch(object, fieldname, fallback, escalation) { |
|
26 |
+ if (fallback === void 0) { fallback = null; } |
|
27 |
+ if (escalation === void 0) { escalation = 1; } |
|
28 |
+ if ((fieldname in object) && (object[fieldname] !== undefined)) { |
|
29 |
+ return object[fieldname]; |
|
30 |
+ } |
|
31 |
+ else { |
|
32 |
+ switch (escalation) { |
|
33 |
+ case 0: { |
|
34 |
+ return fallback; |
|
35 |
+ break; |
|
36 |
+ } |
|
37 |
+ case 1: { |
|
38 |
+ var message = ("field '" + fieldname + "' not in structure"); |
|
39 |
+ message += ("; using fallback value '" + String(fallback) + "'"); |
|
40 |
+ // console.warn(message); |
|
41 |
+ return fallback; |
|
42 |
+ break; |
|
43 |
+ } |
|
44 |
+ case 2: { |
|
45 |
+ var message = ("field '" + fieldname + "' not in structure"); |
|
46 |
+ throw (new Error(message)); |
|
47 |
+ break; |
|
48 |
+ } |
|
49 |
+ default: { |
|
50 |
+ throw (new Error("invalid escalation level " + escalation)); |
|
51 |
+ break; |
|
52 |
+ } |
|
53 |
+ } |
|
54 |
+ } |
|
55 |
+ } |
|
56 |
+ lib_object.fetch = fetch; |
|
57 |
+ /** |
|
58 |
+ * @author fenris |
|
59 |
+ */ |
|
60 |
+ function map(object_from, transformator) { |
|
61 |
+ var object_to = {}; |
|
62 |
+ Object.keys(object_from).forEach(function (key) { return (object_to[key] = transformator(object_from[key], key)); }); |
|
63 |
+ return object_to; |
|
64 |
+ } |
|
65 |
+ lib_object.map = map; |
|
66 |
+ /** |
|
67 |
+ * @desc gibt ein Objekt mit bestimmten Einträgen des Eingabe-Objekts zurück |
|
68 |
+ * @author fenris |
|
69 |
+ */ |
|
70 |
+ function filter(object_from, predicate) { |
|
71 |
+ var object_to = {}; |
|
72 |
+ Object.keys(object_from).forEach(function (key) { |
|
73 |
+ var value = object_from[key]; |
|
74 |
+ if (predicate(value, key)) { |
|
75 |
+ object_to[key] = value; |
|
76 |
+ } |
|
77 |
+ }); |
|
78 |
+ return object_to; |
|
79 |
+ } |
|
80 |
+ lib_object.filter = filter; |
|
81 |
+ /** |
|
82 |
+ * @desc wandelt ein Array mit Einträgen der Form {key,value} in ein entsprechendes Objekt um |
|
83 |
+ * @author fenris |
|
84 |
+ */ |
|
85 |
+ function from_array(array) { |
|
86 |
+ var object = {}; |
|
87 |
+ array.forEach(function (entry) { return (object[entry.key] = entry.value); }); |
|
88 |
+ return object; |
|
89 |
+ } |
|
90 |
+ lib_object.from_array = from_array; |
|
91 |
+ /** |
|
92 |
+ * @desc wandelt ein Objekt in ein entsprechendes Array mit Einträgen der Form {key,value} um |
|
93 |
+ * @author fenris |
|
94 |
+ */ |
|
95 |
+ function to_array(object) { |
|
96 |
+ var array = []; |
|
97 |
+ Object.keys(object).forEach(function (key) { return array.push({ "key": key, "value": object[key] }); }); |
|
98 |
+ return array; |
|
99 |
+ } |
|
100 |
+ lib_object.to_array = to_array; |
|
101 |
+ /** |
|
102 |
+ * @desc gibt eine Liste von Schlüsseln eines Objekts zurück |
|
103 |
+ * @author fenris |
|
104 |
+ */ |
|
105 |
+ function keys(object) { |
|
106 |
+ return Object.keys(object); |
|
107 |
+ } |
|
108 |
+ lib_object.keys = keys; |
|
109 |
+ /** |
|
110 |
+ * @desc gibt eine Liste von Werten eines Objekts zurück |
|
111 |
+ * @author fenris |
|
112 |
+ */ |
|
113 |
+ function values(object) { |
|
114 |
+ return to_array(object).map(function (entry) { return entry.value; }); |
|
115 |
+ } |
|
116 |
+ lib_object.values = values; |
|
117 |
+ /** |
|
118 |
+ * @desc liest ein Baum-artiges Objekt an einer bestimmten Stelle aus |
|
119 |
+ * @author fenris |
|
120 |
+ */ |
|
121 |
+ function path_read(object, path, fallback, escalation) { |
|
122 |
+ if (fallback === void 0) { fallback = null; } |
|
123 |
+ if (escalation === void 0) { escalation = 1; } |
|
124 |
+ var steps = ((path.length == 0) ? [] : path.split(".")); |
|
125 |
+ if (steps.length == 0) { |
|
126 |
+ throw (new Error("empty path")); |
|
127 |
+ } |
|
128 |
+ else { |
|
129 |
+ var position_1 = object; |
|
130 |
+ var reachable = (position_1 != null) && steps.slice(0, steps.length - 1).every(function (step) { |
|
131 |
+ position_1 = object_fetch(position_1, step, null, 0); |
|
132 |
+ return (position_1 != null); |
|
133 |
+ }); |
|
134 |
+ if (reachable) { |
|
135 |
+ return object_fetch(position_1, steps[steps.length - 1], fallback, escalation); |
|
136 |
+ } |
|
137 |
+ else { |
|
138 |
+ return object_fetch({}, "_dummy_", fallback, escalation); |
|
139 |
+ } |
|
140 |
+ } |
|
141 |
+ } |
|
142 |
+ lib_object.path_read = path_read; |
|
143 |
+ /** |
|
144 |
+ * @desc schreibt einen Wert an eine bestimmte Stelle in einem Baum-artigen Objekt |
|
145 |
+ * @author fenris |
|
146 |
+ */ |
|
147 |
+ function path_write(object, path, value, construct) { |
|
148 |
+ if (construct === void 0) { construct = true; } |
|
149 |
+ var steps = ((path.length == 0) ? [] : path.split(".")); |
|
150 |
+ if (steps.length == 0) { |
|
151 |
+ throw (new Error("empty path")); |
|
152 |
+ } |
|
153 |
+ else { |
|
154 |
+ var position_2 = object; |
|
155 |
+ var reachable = steps.slice(0, steps.length - 1).every(function (step) { |
|
156 |
+ var position_ = object_fetch(position_2, step, null, 0); |
|
157 |
+ if (position_ == null) { |
|
158 |
+ if (construct) { |
|
159 |
+ position_2[step] = {}; |
|
160 |
+ position_2 = position_2[step]; |
|
161 |
+ return true; |
|
162 |
+ } |
|
163 |
+ else { |
|
164 |
+ return false; |
|
165 |
+ } |
|
166 |
+ } |
|
167 |
+ else { |
|
168 |
+ position_2 = position_; |
|
169 |
+ return true; |
|
170 |
+ } |
|
171 |
+ }); |
|
172 |
+ if (reachable) { |
|
173 |
+ position_2[steps[steps.length - 1]] = value; |
|
174 |
+ } |
|
175 |
+ else { |
|
176 |
+ var message = ("path '" + path + "' does not exist and may not be constructed"); |
|
177 |
+ throw (new Error(message)); |
|
178 |
+ } |
|
179 |
+ } |
|
180 |
+ } |
|
181 |
+ lib_object.path_write = path_write; |
|
182 |
+ /** |
|
183 |
+ * @desc prüft ob ein Objekt einem bestimmten Muster entspricht |
|
184 |
+ * @param {Object} object das zu prüfende Objekt |
|
185 |
+ * @param {Object} pattern das einzuhaltende Muster |
|
186 |
+ * @param {Function} connlate eine Funktion zum Feststellen der Gleichheit von Einzelwerten |
|
187 |
+ * @author fenris |
|
188 |
+ */ |
|
189 |
+ function matches(object, pattern, collate) { |
|
190 |
+ if (collate === void 0) { collate = instance_collate; } |
|
191 |
+ return Object.keys(pattern).every(function (key) { return collate(pattern[key], object[key]); }); |
|
192 |
+ } |
|
193 |
+ lib_object.matches = matches; |
|
194 |
+ /** |
|
195 |
+ * @desc erzeugt eine Projektion eines Baum-artigen Objekts in ein Listen-artiges Objekt |
|
196 |
+ * @param {string} [separator] welches Zeichen als Trenner zwischen zwei Pfad-Schritten verwendet werden soll |
|
197 |
+ * @author fenris |
|
198 |
+ */ |
|
199 |
+ function flatten(value, separator, key_for_element) { |
|
200 |
+ if (separator === void 0) { separator = "."; } |
|
201 |
+ if (key_for_element === void 0) { key_for_element = (function (index) { return ("element_" + index.toFixed(0)); }); } |
|
202 |
+ var integrate = function (result, key_, value_) { |
|
203 |
+ if (value_ == null) { |
|
204 |
+ result[key_] = value_; |
|
205 |
+ } |
|
206 |
+ else { |
|
207 |
+ // primitive Werte direkt übernehmen |
|
208 |
+ if (typeof (value_) != "object") { |
|
209 |
+ result[key_] = value_; |
|
210 |
+ } |
|
211 |
+ // sonst durch rekursiven Aufruf die flache Variante des Wertes ermitteln und einarbeiten |
|
212 |
+ else { |
|
213 |
+ var result_1 = flatten(value_); |
|
214 |
+ Object.keys(result_1) |
|
215 |
+ .forEach(function (key__) { |
|
216 |
+ var value__ = result_1[key__]; |
|
217 |
+ var key_new = (key_ + separator + key__); |
|
218 |
+ result[key_new] = value__; |
|
219 |
+ }); |
|
220 |
+ } |
|
221 |
+ } |
|
222 |
+ }; |
|
223 |
+ if ((value === null) || (value === undefined)) { |
|
224 |
+ return null; |
|
225 |
+ } |
|
226 |
+ else { |
|
227 |
+ var result_2 = {}; |
|
228 |
+ if (typeof (value) != "object") { |
|
229 |
+ result_2["value"] = value; |
|
230 |
+ } |
|
231 |
+ else { |
|
232 |
+ if (value instanceof Array) { |
|
233 |
+ var array = (value); |
|
234 |
+ array |
|
235 |
+ .forEach(function (element, index) { |
|
236 |
+ integrate(result_2, key_for_element(index), element); |
|
237 |
+ }); |
|
238 |
+ } |
|
239 |
+ else { |
|
240 |
+ var object_1 = (value); |
|
241 |
+ Object.keys(object_1) |
|
242 |
+ .forEach(function (key) { |
|
243 |
+ integrate(result_2, key, object_1[key]); |
|
244 |
+ }); |
|
245 |
+ } |
|
246 |
+ } |
|
247 |
+ return result_2; |
|
248 |
+ } |
|
249 |
+ } |
|
250 |
+ lib_object.flatten = flatten; |
|
251 |
+ /** |
|
252 |
+ * @author fenris |
|
253 |
+ */ |
|
254 |
+ function clash(x, y, _a) { |
|
255 |
+ var _b = _a === void 0 ? {} : _a, _c = _b["overwrite"], overwrite = _c === void 0 ? true : _c, _d = _b["hooks"], _e = (_d === void 0 ? {} : _d)["existing"], hook_existing = _e === void 0 ? null : _e; |
|
256 |
+ if (hook_existing == null) { |
|
257 |
+ (function (key, value_old, value_new) { return console.warn("field " + key + " already defined"); }); |
|
258 |
+ } |
|
259 |
+ var z = {}; |
|
260 |
+ Object.keys(x).forEach(function (key) { |
|
261 |
+ z[key] = x[key]; |
|
262 |
+ }); |
|
263 |
+ Object.keys(y).forEach(function (key) { |
|
264 |
+ if (key in z) { |
|
265 |
+ if (hook_existing != null) { |
|
266 |
+ hook_existing(key, z[key], y[key]); |
|
267 |
+ } |
|
268 |
+ if (overwrite) { |
|
269 |
+ z[key] = y[key]; |
|
270 |
+ } |
|
271 |
+ } |
|
272 |
+ else { |
|
273 |
+ z[key] = y[key]; |
|
274 |
+ } |
|
275 |
+ }); |
|
276 |
+ return z; |
|
277 |
+ } |
|
278 |
+ lib_object.clash = clash; |
|
279 |
+ /** |
|
280 |
+ * @author fenris |
|
281 |
+ */ |
|
282 |
+ function patch(core, mantle, deep, path) { |
|
283 |
+ if (deep === void 0) { deep = true; } |
|
284 |
+ if (path === void 0) { path = null; } |
|
285 |
+ if (mantle == null) { |
|
286 |
+ console.warn("mantle is null; core was", core); |
|
287 |
+ } |
|
288 |
+ else { |
|
289 |
+ Object.keys(mantle).forEach(function (key) { |
|
290 |
+ var path_ = ((path == null) ? key : path + "." + key); |
|
291 |
+ var value_mantle = mantle[key]; |
|
292 |
+ if (!(key in core)) { |
|
293 |
+ if ((typeof (value_mantle) == "object") && (value_mantle != null) && deep) { |
|
294 |
+ if (value_mantle instanceof Array) { |
|
295 |
+ core[key] = []; |
|
296 |
+ value_mantle.forEach(function (element) { |
|
297 |
+ if ((typeof (element) == "object") && (element != null)) { |
|
298 |
+ var element_ = {}; |
|
299 |
+ patch(element_, element); |
|
300 |
+ core[key].push(element_); |
|
301 |
+ } |
|
302 |
+ else { |
|
303 |
+ core[key].push(element); |
|
304 |
+ } |
|
305 |
+ }); |
|
306 |
+ } |
|
307 |
+ else { |
|
308 |
+ core[key] = {}; |
|
309 |
+ patch(core[key], value_mantle, deep, path_); |
|
310 |
+ } |
|
311 |
+ } |
|
312 |
+ else { |
|
313 |
+ core[key] = value_mantle; |
|
314 |
+ } |
|
315 |
+ } |
|
316 |
+ else { |
|
317 |
+ var value_core = core[key]; |
|
318 |
+ if (typeof (value_core) == typeof (value_mantle)) { |
|
319 |
+ if ((typeof (value_mantle) == "object") && (value_mantle != null) && deep) { |
|
320 |
+ patch(core[key], value_mantle, deep, path_); |
|
321 |
+ } |
|
322 |
+ else { |
|
323 |
+ core[key] = value_mantle; |
|
324 |
+ } |
|
325 |
+ } |
|
326 |
+ else { |
|
327 |
+ if ((value_core != null) && (value_mantle != null)) { |
|
328 |
+ var message = "objects have different shapes at path '" + path_ + "'; core has type '" + typeof (value_core) + "' and mantle has type '" + typeof (value_mantle) + "'"; |
|
329 |
+ console.warn(message); |
|
330 |
+ } |
|
331 |
+ core[key] = value_mantle; |
|
332 |
+ // throw (new Error(message)); |
|
333 |
+ } |
|
334 |
+ } |
|
335 |
+ }); |
|
336 |
+ } |
|
337 |
+ } |
|
338 |
+ lib_object.patch = patch; |
|
339 |
+ /** |
|
340 |
+ * @author fenris |
|
341 |
+ */ |
|
342 |
+ function patched(core, mantle, deep) { |
|
343 |
+ if (deep === void 0) { deep = undefined; } |
|
344 |
+ var result = {}; |
|
345 |
+ patch(result, core, deep); |
|
346 |
+ patch(result, mantle, deep); |
|
347 |
+ return result; |
|
348 |
+ } |
|
349 |
+ lib_object.patched = patched; |
|
350 |
+ /** |
|
351 |
+ * @author fenris |
|
352 |
+ */ |
|
353 |
+ function attached(object, key, value) { |
|
354 |
+ var mantle = {}; |
|
355 |
+ mantle[key] = value; |
|
356 |
+ return patched(object, mantle, false); |
|
357 |
+ } |
|
358 |
+ lib_object.attached = attached; |
|
359 |
+ /** |
|
360 |
+ * @author fenris |
|
361 |
+ */ |
|
362 |
+ function copy(object) { |
|
363 |
+ return patched({}, object); |
|
364 |
+ } |
|
365 |
+ lib_object.copy = copy; |
|
366 |
+})(lib_object || (lib_object = {})); |
|
367 |
+/** |
|
368 |
+ * @desc adapters for old syntax |
|
369 |
+ * @author fenris |
|
370 |
+ */ |
|
371 |
+var object_fetch = lib_object.fetch; |
|
372 |
+var object_map = lib_object.map; |
|
373 |
+var object_a2o = lib_object.from_array; |
|
374 |
+var object_o2a = lib_object.to_array; |
|
375 |
+var object_matches = lib_object.matches; |
|
376 |
+var object_clash = lib_object.clash; |
... | ... |
@@ -0,0 +1,22 @@ |
1 |
+{ |
|
2 |
+ "logic-decl": [ |
|
3 |
+ "/home/fenris/projekte/folksprak/words/lib/plankton/./base/logic-decl.d.ts", |
|
4 |
+ "/home/fenris/projekte/folksprak/words/lib/plankton/./call/logic-decl.d.ts", |
|
5 |
+ "/home/fenris/projekte/folksprak/words/lib/plankton/./object/logic-decl.d.ts", |
|
6 |
+ "/home/fenris/projekte/folksprak/words/lib/plankton/./shape/logic-decl.d.ts", |
|
7 |
+ "/home/fenris/projekte/folksprak/words/lib/plankton/./trait/logic-decl.d.ts", |
|
8 |
+ "/home/fenris/projekte/folksprak/words/lib/plankton/./code/logic-decl.d.ts", |
|
9 |
+ "/home/fenris/projekte/folksprak/words/lib/plankton/./string/logic-decl.d.ts", |
|
10 |
+ "/home/fenris/projekte/folksprak/words/lib/plankton/./comm-server/logic-decl.d.ts" |
|
11 |
+ ], |
|
12 |
+ "logic-impl": [ |
|
13 |
+ "/home/fenris/projekte/folksprak/words/lib/plankton/./base/logic-impl.js", |
|
14 |
+ "/home/fenris/projekte/folksprak/words/lib/plankton/./call/logic-impl.js", |
|
15 |
+ "/home/fenris/projekte/folksprak/words/lib/plankton/./object/logic-impl.js", |
|
16 |
+ "/home/fenris/projekte/folksprak/words/lib/plankton/./shape/logic-impl.js", |
|
17 |
+ "/home/fenris/projekte/folksprak/words/lib/plankton/./trait/logic-impl.js", |
|
18 |
+ "/home/fenris/projekte/folksprak/words/lib/plankton/./code/logic-impl.js", |
|
19 |
+ "/home/fenris/projekte/folksprak/words/lib/plankton/./string/logic-impl.js", |
|
20 |
+ "/home/fenris/projekte/folksprak/words/lib/plankton/./comm-server/logic-impl.js" |
|
21 |
+ ] |
|
22 |
+} |
... | ... |
@@ -0,0 +1,861 @@ |
1 |
+Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
2 |
+<info@greenscale.de> |
|
3 |
+ |
|
4 |
+»bacterio-plankton:shape« is free software: you can redistribute it and/or modify |
|
5 |
+it under the terms of the GNU Lesser General Public License as published by |
|
6 |
+the Free Software Foundation, either version 3 of the License, or |
|
7 |
+(at your option) any later version. |
|
8 |
+ |
|
9 |
+»bacterio-plankton:shape« is distributed in the hope that it will be useful, |
|
10 |
+but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 |
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 |
+GNU Lesser General Public License for more details. |
|
13 |
+ |
|
14 |
+You should have received a copy of the GNU Lesser General Public License |
|
15 |
+along with »bacterio-plankton:shape«. If not, see <http://www.gnu.org/licenses/>. |
|
16 |
+ |
|
17 |
+ |
|
18 |
+ |
|
19 |
+ GNU GENERAL PUBLIC LICENSE |
|
20 |
+ Version 3, 29 June 2007 |
|
21 |
+ |
|
22 |
+ Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/> |
|
23 |
+ Everyone is permitted to copy and distribute verbatim copies |
|
24 |
+ of this license document, but changing it is not allowed. |
|
25 |
+ |
|
26 |
+ Preamble |
|
27 |
+ |
|
28 |
+ The GNU General Public License is a free, copyleft license for |
|
29 |
+software and other kinds of works. |
|
30 |
+ |
|
31 |
+ The licenses for most software and other practical works are designed |
|
32 |
+to take away your freedom to share and change the works. By contrast, |
|
33 |
+the GNU General Public License is intended to guarantee your freedom to |
|
34 |
+share and change all versions of a program--to make sure it remains free |
|
35 |
+software for all its users. We, the Free Software Foundation, use the |
|
36 |
+GNU General Public License for most of our software; it applies also to |
|
37 |
+any other work released this way by its authors. You can apply it to |
|
38 |
+your programs, too. |
|
39 |
+ |
|
40 |
+ When we speak of free software, we are referring to freedom, not |
|
41 |
+price. Our General Public Licenses are designed to make sure that you |
|
42 |
+have the freedom to distribute copies of free software (and charge for |
|
43 |
+them if you wish), that you receive source code or can get it if you |
|
44 |
+want it, that you can change the software or use pieces of it in new |
|
45 |
+free programs, and that you know you can do these things. |
|
46 |
+ |
|
47 |
+ To protect your rights, we need to prevent others from denying you |
|
48 |
+these rights or asking you to surrender the rights. Therefore, you have |
|
49 |
+certain responsibilities if you distribute copies of the software, or if |
|
50 |
+you modify it: responsibilities to respect the freedom of others. |
|
51 |
+ |
|
52 |
+ For example, if you distribute copies of such a program, whether |
|
53 |
+gratis or for a fee, you must pass on to the recipients the same |
|
54 |
+freedoms that you received. You must make sure that they, too, receive |
|
55 |
+or can get the source code. And you must show them these terms so they |
|
56 |
+know their rights. |
|
57 |
+ |
|
58 |
+ Developers that use the GNU GPL protect your rights with two steps: |
|
59 |
+(1) assert copyright on the software, and (2) offer you this License |
|
60 |
+giving you legal permission to copy, distribute and/or modify it. |
|
61 |
+ |
|
62 |
+ For the developers' and authors' protection, the GPL clearly explains |
|
63 |
+that there is no warranty for this free software. For both users' and |
|
64 |
+authors' sake, the GPL requires that modified versions be marked as |
|
65 |
+changed, so that their problems will not be attributed erroneously to |
|
66 |
+authors of previous versions. |
|
67 |
+ |
|
68 |
+ Some devices are designed to deny users access to install or run |
|
69 |
+modified versions of the software inside them, although the manufacturer |
|
70 |
+can do so. This is fundamentally incompatible with the aim of |
|
71 |
+protecting users' freedom to change the software. The systematic |
|
72 |
+pattern of such abuse occurs in the area of products for individuals to |
|
73 |
+use, which is precisely where it is most unacceptable. Therefore, we |
|
74 |
+have designed this version of the GPL to prohibit the practice for those |
|
75 |
+products. If such problems arise substantially in other domains, we |
|
76 |
+stand ready to extend this provision to those domains in future versions |
|
77 |
+of the GPL, as needed to protect the freedom of users. |
|
78 |
+ |
|
79 |
+ Finally, every program is threatened constantly by software patents. |
|
80 |
+States should not allow patents to restrict development and use of |
|
81 |
+software on general-purpose computers, but in those that do, we wish to |
|
82 |
+avoid the special danger that patents applied to a free program could |
|
83 |
+make it effectively proprietary. To prevent this, the GPL assures that |
|
84 |
+patents cannot be used to render the program non-free. |
|
85 |
+ |
|
86 |
+ The precise terms and conditions for copying, distribution and |
|
87 |
+modification follow. |
|
88 |
+ |
|
89 |
+ TERMS AND CONDITIONS |
|
90 |
+ |
|
91 |
+ 0. Definitions. |
|
92 |
+ |
|
93 |
+ "This License" refers to version 3 of the GNU General Public License. |
|
94 |
+ |
|
95 |
+ "Copyright" also means copyright-like laws that apply to other kinds of |
|
96 |
+works, such as semiconductor masks. |
|
97 |
+ |
|
98 |
+ "The Program" refers to any copyrightable work licensed under this |
|
99 |
+License. Each licensee is addressed as "you". "Licensees" and |
|
100 |
+"recipients" may be individuals or organizations. |
|
101 |
+ |
|
102 |
+ To "modify" a work means to copy from or adapt all or part of the work |
|
103 |
+in a fashion requiring copyright permission, other than the making of an |
|
104 |
+exact copy. The resulting work is called a "modified version" of the |
|
105 |
+earlier work or a work "based on" the earlier work. |
|
106 |
+ |
|
107 |
+ A "covered work" means either the unmodified Program or a work based |
|
108 |
+on the Program. |
|
109 |
+ |
|
110 |
+ To "propagate" a work means to do anything with it that, without |
|
111 |
+permission, would make you directly or secondarily liable for |
|
112 |
+infringement under applicable copyright law, except executing it on a |
|
113 |
+computer or modifying a private copy. Propagation includes copying, |
|
114 |
+distribution (with or without modification), making available to the |
|
115 |
+public, and in some countries other activities as well. |
|
116 |
+ |
|
117 |
+ To "convey" a work means any kind of propagation that enables other |
|
118 |
+parties to make or receive copies. Mere interaction with a user through |
|
119 |
+a computer network, with no transfer of a copy, is not conveying. |
|
120 |
+ |
|
121 |
+ An interactive user interface displays "Appropriate Legal Notices" |
|
122 |
+to the extent that it includes a convenient and prominently visible |
|
123 |
+feature that (1) displays an appropriate copyright notice, and (2) |
|
124 |
+tells the user that there is no warranty for the work (except to the |
|
125 |
+extent that warranties are provided), that licensees may convey the |
|
126 |
+work under this License, and how to view a copy of this License. If |
|
127 |
+the interface presents a list of user commands or options, such as a |
|
128 |
+menu, a prominent item in the list meets this criterion. |
|
129 |
+ |
|
130 |
+ 1. Source Code. |
|
131 |
+ |
|
132 |
+ The "source code" for a work means the preferred form of the work |
|
133 |
+for making modifications to it. "Object code" means any non-source |
|
134 |
+form of a work. |
|
135 |
+ |
|
136 |
+ A "Standard Interface" means an interface that either is an official |
|
137 |
+standard defined by a recognized standards body, or, in the case of |
|
138 |
+interfaces specified for a particular programming language, one that |
|
139 |
+is widely used among developers working in that language. |
|
140 |
+ |
|
141 |
+ The "System Libraries" of an executable work include anything, other |
|
142 |
+than the work as a whole, that (a) is included in the normal form of |
|
143 |
+packaging a Major Component, but which is not part of that Major |
|
144 |
+Component, and (b) serves only to enable use of the work with that |
|
145 |
+Major Component, or to implement a Standard Interface for which an |
|
146 |
+implementation is available to the public in source code form. A |
|
147 |
+"Major Component", in this context, means a major essential component |
|
148 |
+(kernel, window system, and so on) of the specific operating system |
|
149 |
+(if any) on which the executable work runs, or a compiler used to |
|
150 |
+produce the work, or an object code interpreter used to run it. |
|
151 |
+ |
|
152 |
+ The "Corresponding Source" for a work in object code form means all |
|
153 |
+the source code needed to generate, install, and (for an executable |
|
154 |
+work) run the object code and to modify the work, including scripts to |
|
155 |
+control those activities. However, it does not include the work's |
|
156 |
+System Libraries, or general-purpose tools or generally available free |
|
157 |
+programs which are used unmodified in performing those activities but |
|
158 |
+which are not part of the work. For example, Corresponding Source |
|
159 |
+includes interface definition files associated with source files for |
|
160 |
+the work, and the source code for shared libraries and dynamically |
|
161 |
+linked subprograms that the work is specifically designed to require, |
|
162 |
+such as by intimate data communication or control flow between those |
|
163 |
+subprograms and other parts of the work. |
|
164 |
+ |
|
165 |
+ The Corresponding Source need not include anything that users |
|
166 |
+can regenerate automatically from other parts of the Corresponding |
|
167 |
+Source. |
|
168 |
+ |
|
169 |
+ The Corresponding Source for a work in source code form is that |
|
170 |
+same work. |
|
171 |
+ |
|
172 |
+ 2. Basic Permissions. |
|
173 |
+ |
|
174 |
+ All rights granted under this License are granted for the term of |
|
175 |
+copyright on the Program, and are irrevocable provided the stated |
|
176 |
+conditions are met. This License explicitly affirms your unlimited |
|
177 |
+permission to run the unmodified Program. The output from running a |
|
178 |
+covered work is covered by this License only if the output, given its |
|
179 |
+content, constitutes a covered work. This License acknowledges your |
|
180 |
+rights of fair use or other equivalent, as provided by copyright law. |
|
181 |
+ |
|
182 |
+ You may make, run and propagate covered works that you do not |
|
183 |
+convey, without conditions so long as your license otherwise remains |
|
184 |
+in force. You may convey covered works to others for the sole purpose |
|
185 |
+of having them make modifications exclusively for you, or provide you |
|
186 |
+with facilities for running those works, provided that you comply with |
|
187 |
+the terms of this License in conveying all material for which you do |
|
188 |
+not control copyright. Those thus making or running the covered works |
|
189 |
+for you must do so exclusively on your behalf, under your direction |
|
190 |
+and control, on terms that prohibit them from making any copies of |
|
191 |
+your copyrighted material outside their relationship with you. |
|
192 |
+ |
|
193 |
+ Conveying under any other circumstances is permitted solely under |
|
194 |
+the conditions stated below. Sublicensing is not allowed; section 10 |
|
195 |
+makes it unnecessary. |
|
196 |
+ |
|
197 |
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law. |
|
198 |
+ |
|
199 |
+ No covered work shall be deemed part of an effective technological |
|
200 |
+measure under any applicable law fulfilling obligations under article |
|
201 |
+11 of the WIPO copyright treaty adopted on 20 December 1996, or |
|
202 |
+similar laws prohibiting or restricting circumvention of such |
|
203 |
+measures. |
|
204 |
+ |
|
205 |
+ When you convey a covered work, you waive any legal power to forbid |
|
206 |
+circumvention of technological measures to the extent such circumvention |
|
207 |
+is effected by exercising rights under this License with respect to |
|
208 |
+the covered work, and you disclaim any intention to limit operation or |
|
209 |
+modification of the work as a means of enforcing, against the work's |
|
210 |
+users, your or third parties' legal rights to forbid circumvention of |
|
211 |
+technological measures. |
|
212 |
+ |
|
213 |
+ 4. Conveying Verbatim Copies. |
|
214 |
+ |
|
215 |
+ You may convey verbatim copies of the Program's source code as you |
|
216 |
+receive it, in any medium, provided that you conspicuously and |
|
217 |
+appropriately publish on each copy an appropriate copyright notice; |
|
218 |
+keep intact all notices stating that this License and any |
|
219 |
+non-permissive terms added in accord with section 7 apply to the code; |
|
220 |
+keep intact all notices of the absence of any warranty; and give all |
|
221 |
+recipients a copy of this License along with the Program. |
|
222 |
+ |
|
223 |
+ You may charge any price or no price for each copy that you convey, |
|
224 |
+and you may offer support or warranty protection for a fee. |
|
225 |
+ |
|
226 |
+ 5. Conveying Modified Source Versions. |
|
227 |
+ |
|
228 |
+ You may convey a work based on the Program, or the modifications to |
|
229 |
+produce it from the Program, in the form of source code under the |
|
230 |
+terms of section 4, provided that you also meet all of these conditions: |
|
231 |
+ |
|
232 |
+ a) The work must carry prominent notices stating that you modified |
|
233 |
+ it, and giving a relevant date. |
|
234 |
+ |
|
235 |
+ b) The work must carry prominent notices stating that it is |
|
236 |
+ released under this License and any conditions added under section |
|
237 |
+ 7. This requirement modifies the requirement in section 4 to |
|
238 |
+ "keep intact all notices". |
|
239 |
+ |
|
240 |
+ c) You must license the entire work, as a whole, under this |
|
241 |
+ License to anyone who comes into possession of a copy. This |
|
242 |
+ License will therefore apply, along with any applicable section 7 |
|
243 |
+ additional terms, to the whole of the work, and all its parts, |
|
244 |
+ regardless of how they are packaged. This License gives no |
|
245 |
+ permission to license the work in any other way, but it does not |
|
246 |
+ invalidate such permission if you have separately received it. |
|
247 |
+ |
|
248 |
+ d) If the work has interactive user interfaces, each must display |
|
249 |
+ Appropriate Legal Notices; however, if the Program has interactive |
|
250 |
+ interfaces that do not display Appropriate Legal Notices, your |
|
251 |
+ work need not make them do so. |
|
252 |
+ |
|
253 |
+ A compilation of a covered work with other separate and independent |
|
254 |
+works, which are not by their nature extensions of the covered work, |
|
255 |
+and which are not combined with it such as to form a larger program, |
|
256 |
+in or on a volume of a storage or distribution medium, is called an |
|
257 |
+"aggregate" if the compilation and its resulting copyright are not |
|
258 |
+used to limit the access or legal rights of the compilation's users |
|
259 |
+beyond what the individual works permit. Inclusion of a covered work |
|
260 |
+in an aggregate does not cause this License to apply to the other |
|
261 |
+parts of the aggregate. |
|
262 |
+ |
|
263 |
+ 6. Conveying Non-Source Forms. |
|
264 |
+ |
|
265 |
+ You may convey a covered work in object code form under the terms |
|
266 |
+of sections 4 and 5, provided that you also convey the |
|
267 |
+machine-readable Corresponding Source under the terms of this License, |
|
268 |
+in one of these ways: |
|
269 |
+ |
|
270 |
+ a) Convey the object code in, or embodied in, a physical product |
|
271 |
+ (including a physical distribution medium), accompanied by the |
|
272 |
+ Corresponding Source fixed on a durable physical medium |
|
273 |
+ customarily used for software interchange. |
|
274 |
+ |
|
275 |
+ b) Convey the object code in, or embodied in, a physical product |
|
276 |
+ (including a physical distribution medium), accompanied by a |
|
277 |
+ written offer, valid for at least three years and valid for as |
|
278 |
+ long as you offer spare parts or customer support for that product |
|
279 |
+ model, to give anyone who possesses the object code either (1) a |
|
280 |
+ copy of the Corresponding Source for all the software in the |
|
281 |
+ product that is covered by this License, on a durable physical |
|
282 |
+ medium customarily used for software interchange, for a price no |
|
283 |
+ more than your reasonable cost of physically performing this |
|
284 |
+ conveying of source, or (2) access to copy the |
|
285 |
+ Corresponding Source from a network server at no charge. |
|
286 |
+ |
|
287 |
+ c) Convey individual copies of the object code with a copy of the |
|
288 |
+ written offer to provide the Corresponding Source. This |
|
289 |
+ alternative is allowed only occasionally and noncommercially, and |
|
290 |
+ only if you received the object code with such an offer, in accord |
|
291 |
+ with subsection 6b. |
|
292 |
+ |
|
293 |
+ d) Convey the object code by offering access from a designated |
|
294 |
+ place (gratis or for a charge), and offer equivalent access to the |
|
295 |
+ Corresponding Source in the same way through the same place at no |
|
296 |
+ further charge. You need not require recipients to copy the |
|
297 |
+ Corresponding Source along with the object code. If the place to |
|
298 |
+ copy the object code is a network server, the Corresponding Source |
|
299 |
+ may be on a different server (operated by you or a third party) |
|
300 |
+ that supports equivalent copying facilities, provided you maintain |
|
301 |
+ clear directions next to the object code saying where to find the |
|
302 |
+ Corresponding Source. Regardless of what server hosts the |
|
303 |
+ Corresponding Source, you remain obligated to ensure that it is |
|
304 |
+ available for as long as needed to satisfy these requirements. |
|
305 |
+ |
|
306 |
+ e) Convey the object code using peer-to-peer transmission, provided |
|
307 |
+ you inform other peers where the object code and Corresponding |
|
308 |
+ Source of the work are being offered to the general public at no |
|
309 |
+ charge under subsection 6d. |
|
310 |
+ |
|
311 |
+ A separable portion of the object code, whose source code is excluded |
|
312 |
+from the Corresponding Source as a System Library, need not be |
|
313 |
+included in conveying the object code work. |
|
314 |
+ |
|
315 |
+ A "User Product" is either (1) a "consumer product", which means any |
|
316 |
+tangible personal property which is normally used for personal, family, |
|
317 |
+or household purposes, or (2) anything designed or sold for incorporation |
|
318 |
+into a dwelling. In determining whether a product is a consumer product, |
|
319 |
+doubtful cases shall be resolved in favor of coverage. For a particular |
|
320 |
+product received by a particular user, "normally used" refers to a |
|
321 |
+typical or common use of that class of product, regardless of the status |
|
322 |
+of the particular user or of the way in which the particular user |
|
323 |
+actually uses, or expects or is expected to use, the product. A product |
|
324 |
+is a consumer product regardless of whether the product has substantial |
|
325 |
+commercial, industrial or non-consumer uses, unless such uses represent |
|
326 |
+the only significant mode of use of the product. |
|
327 |
+ |
|
328 |
+ "Installation Information" for a User Product means any methods, |
|
329 |
+procedures, authorization keys, or other information required to install |
|
330 |
+and execute modified versions of a covered work in that User Product from |
|
331 |
+a modified version of its Corresponding Source. The information must |
|
332 |
+suffice to ensure that the continued functioning of the modified object |
|
333 |
+code is in no case prevented or interfered with solely because |
|
334 |
+modification has been made. |
|
335 |
+ |
|
336 |
+ If you convey an object code work under this section in, or with, or |
|
337 |
+specifically for use in, a User Product, and the conveying occurs as |
|
338 |
+part of a transaction in which the right of possession and use of the |
|
339 |
+User Product is transferred to the recipient in perpetuity or for a |
|
340 |
+fixed term (regardless of how the transaction is characterized), the |
|
341 |
+Corresponding Source conveyed under this section must be accompanied |
|
342 |
+by the Installation Information. But this requirement does not apply |
|
343 |
+if neither you nor any third party retains the ability to install |
|
344 |
+modified object code on the User Product (for example, the work has |
|
345 |
+been installed in ROM). |
|
346 |
+ |
|
347 |
+ The requirement to provide Installation Information does not include a |
|
348 |
+requirement to continue to provide support service, warranty, or updates |
|
349 |
+for a work that has been modified or installed by the recipient, or for |
|
350 |
+the User Product in which it has been modified or installed. Access to a |
|
351 |
+network may be denied when the modification itself materially and |
|
352 |
+adversely affects the operation of the network or violates the rules and |
|
353 |
+protocols for communication across the network. |
|
354 |
+ |
|
355 |
+ Corresponding Source conveyed, and Installation Information provided, |
|
356 |
+in accord with this section must be in a format that is publicly |
|
357 |
+documented (and with an implementation available to the public in |
|
358 |
+source code form), and must require no special password or key for |
|
359 |
+unpacking, reading or copying. |
|
360 |
+ |
|
361 |
+ 7. Additional Terms. |
|
362 |
+ |
|
363 |
+ "Additional permissions" are terms that supplement the terms of this |
|
364 |
+License by making exceptions from one or more of its conditions. |
|
365 |
+Additional permissions that are applicable to the entire Program shall |
|
366 |
+be treated as though they were included in this License, to the extent |
|
367 |
+that they are valid under applicable law. If additional permissions |
|
368 |
+apply only to part of the Program, that part may be used separately |
|
369 |
+under those permissions, but the entire Program remains governed by |
|
370 |
+this License without regard to the additional permissions. |
|
371 |
+ |
|
372 |
+ When you convey a copy of a covered work, you may at your option |
|
373 |
+remove any additional permissions from that copy, or from any part of |
|
374 |
+it. (Additional permissions may be written to require their own |
|
375 |
+removal in certain cases when you modify the work.) You may place |
|
376 |
+additional permissions on material, added by you to a covered work, |
|
377 |
+for which you have or can give appropriate copyright permission. |
|
378 |
+ |
|
379 |
+ Notwithstanding any other provision of this License, for material you |
|
380 |
+add to a covered work, you may (if authorized by the copyright holders of |
|
381 |
+that material) supplement the terms of this License with terms: |
|
382 |
+ |
|
383 |
+ a) Disclaiming warranty or limiting liability differently from the |
|
384 |
+ terms of sections 15 and 16 of this License; or |
|
385 |
+ |
|
386 |
+ b) Requiring preservation of specified reasonable legal notices or |
|
387 |
+ author attributions in that material or in the Appropriate Legal |
|
388 |
+ Notices displayed by works containing it; or |
|
389 |
+ |
|
390 |
+ c) Prohibiting misrepresentation of the origin of that material, or |
|
391 |
+ requiring that modified versions of such material be marked in |
|
392 |
+ reasonable ways as different from the original version; or |
|
393 |
+ |
|
394 |
+ d) Limiting the use for publicity purposes of names of licensors or |
|
395 |
+ authors of the material; or |
|
396 |
+ |
|
397 |
+ e) Declining to grant rights under trademark law for use of some |
|
398 |
+ trade names, trademarks, or service marks; or |
|
399 |
+ |
|
400 |
+ f) Requiring indemnification of licensors and authors of that |
|
401 |
+ material by anyone who conveys the material (or modified versions of |
|
402 |
+ it) with contractual assumptions of liability to the recipient, for |
|
403 |
+ any liability that these contractual assumptions directly impose on |
|
404 |
+ those licensors and authors. |
|
405 |
+ |
|
406 |
+ All other non-permissive additional terms are considered "further |
|
407 |
+restrictions" within the meaning of section 10. If the Program as you |
|
408 |
+received it, or any part of it, contains a notice stating that it is |
|
409 |
+governed by this License along with a term that is a further |
|
410 |
+restriction, you may remove that term. If a license document contains |
|
411 |
+a further restriction but permits relicensing or conveying under this |
|
412 |
+License, you may add to a covered work material governed by the terms |
|
413 |
+of that license document, provided that the further restriction does |
|
414 |
+not survive such relicensing or conveying. |
|
415 |
+ |
|
416 |
+ If you add terms to a covered work in accord with this section, you |
|
417 |
+must place, in the relevant source files, a statement of the |
|
418 |
+additional terms that apply to those files, or a notice indicating |
|
419 |
+where to find the applicable terms. |
|
420 |
+ |
|
421 |
+ Additional terms, permissive or non-permissive, may be stated in the |
|
422 |
+form of a separately written license, or stated as exceptions; |
|
423 |
+the above requirements apply either way. |
|
424 |
+ |
|
425 |
+ 8. Termination. |
|
426 |
+ |
|
427 |
+ You may not propagate or modify a covered work except as expressly |
|
428 |
+provided under this License. Any attempt otherwise to propagate or |
|
429 |
+modify it is void, and will automatically terminate your rights under |
|
430 |
+this License (including any patent licenses granted under the third |
|
431 |
+paragraph of section 11). |
|
432 |
+ |
|
433 |
+ However, if you cease all violation of this License, then your |
|
434 |
+license from a particular copyright holder is reinstated (a) |
|
435 |
+provisionally, unless and until the copyright holder explicitly and |
|
436 |
+finally terminates your license, and (b) permanently, if the copyright |
|
437 |
+holder fails to notify you of the violation by some reasonable means |
|
438 |
+prior to 60 days after the cessation. |
|
439 |
+ |
|
440 |
+ Moreover, your license from a particular copyright holder is |
|
441 |
+reinstated permanently if the copyright holder notifies you of the |
|
442 |
+violation by some reasonable means, this is the first time you have |
|
443 |
+received notice of violation of this License (for any work) from that |
|
444 |
+copyright holder, and you cure the violation prior to 30 days after |
|
445 |
+your receipt of the notice. |
|
446 |
+ |
|
447 |
+ Termination of your rights under this section does not terminate the |
|
448 |
+licenses of parties who have received copies or rights from you under |
|
449 |
+this License. If your rights have been terminated and not permanently |
|
450 |
+reinstated, you do not qualify to receive new licenses for the same |
|
451 |
+material under section 10. |
|
452 |
+ |
|
453 |
+ 9. Acceptance Not Required for Having Copies. |
|
454 |
+ |
|
455 |
+ You are not required to accept this License in order to receive or |
|
456 |
+run a copy of the Program. Ancillary propagation of a covered work |
|
457 |
+occurring solely as a consequence of using peer-to-peer transmission |
|
458 |
+to receive a copy likewise does not require acceptance. However, |
|
459 |
+nothing other than this License grants you permission to propagate or |
|
460 |
+modify any covered work. These actions infringe copyright if you do |
|
461 |
+not accept this License. Therefore, by modifying or propagating a |
|
462 |
+covered work, you indicate your acceptance of this License to do so. |
|
463 |
+ |
|
464 |
+ 10. Automatic Licensing of Downstream Recipients. |
|
465 |
+ |
|
466 |
+ Each time you convey a covered work, the recipient automatically |
|
467 |
+receives a license from the original licensors, to run, modify and |
|
468 |
+propagate that work, subject to this License. You are not responsible |
|
469 |
+for enforcing compliance by third parties with this License. |
|
470 |
+ |
|
471 |
+ An "entity transaction" is a transaction transferring control of an |
|
472 |
+organization, or substantially all assets of one, or subdividing an |
|
473 |
+organization, or merging organizations. If propagation of a covered |
|
474 |
+work results from an entity transaction, each party to that |
|
475 |
+transaction who receives a copy of the work also receives whatever |
|
476 |
+licenses to the work the party's predecessor in interest had or could |
|
477 |
+give under the previous paragraph, plus a right to possession of the |
|
478 |
+Corresponding Source of the work from the predecessor in interest, if |
|
479 |
+the predecessor has it or can get it with reasonable efforts. |
|
480 |
+ |
|
481 |
+ You may not impose any further restrictions on the exercise of the |
|
482 |
+rights granted or affirmed under this License. For example, you may |
|
483 |
+not impose a license fee, royalty, or other charge for exercise of |
|
484 |
+rights granted under this License, and you may not initiate litigation |
|
485 |
+(including a cross-claim or counterclaim in a lawsuit) alleging that |
|
486 |
+any patent claim is infringed by making, using, selling, offering for |
|
487 |
+sale, or importing the Program or any portion of it. |
|
488 |
+ |
|
489 |
+ 11. Patents. |
|
490 |
+ |
|
491 |
+ A "contributor" is a copyright holder who authorizes use under this |
|
492 |
+License of the Program or a work on which the Program is based. The |
|
493 |
+work thus licensed is called the contributor's "contributor version". |
|
494 |
+ |
|
495 |
+ A contributor's "essential patent claims" are all patent claims |
|
496 |
+owned or controlled by the contributor, whether already acquired or |
|
497 |
+hereafter acquired, that would be infringed by some manner, permitted |
|
498 |
+by this License, of making, using, or selling its contributor version, |
|
499 |
+but do not include claims that would be infringed only as a |
|
500 |
+consequence of further modification of the contributor version. For |
|
501 |
+purposes of this definition, "control" includes the right to grant |
|
502 |
+patent sublicenses in a manner consistent with the requirements of |
|
503 |
+this License. |
|
504 |
+ |
|
505 |
+ Each contributor grants you a non-exclusive, worldwide, royalty-free |
|
506 |
+patent license under the contributor's essential patent claims, to |
|
507 |
+make, use, sell, offer for sale, import and otherwise run, modify and |
|
508 |
+propagate the contents of its contributor version. |
|
509 |
+ |
|
510 |
+ In the following three paragraphs, a "patent license" is any express |
|
511 |
+agreement or commitment, however denominated, not to enforce a patent |
|
512 |
+(such as an express permission to practice a patent or covenant not to |
|
513 |
+sue for patent infringement). To "grant" such a patent license to a |
|
514 |
+party means to make such an agreement or commitment not to enforce a |
|
515 |
+patent against the party. |
|
516 |
+ |
|
517 |
+ If you convey a covered work, knowingly relying on a patent license, |
|
518 |
+and the Corresponding Source of the work is not available for anyone |
|
519 |
+to copy, free of charge and under the terms of this License, through a |
|
520 |
+publicly available network server or other readily accessible means, |
|
521 |
+then you must either (1) cause the Corresponding Source to be so |
|
522 |
+available, or (2) arrange to deprive yourself of the benefit of the |
|
523 |
+patent license for this particular work, or (3) arrange, in a manner |
|
524 |
+consistent with the requirements of this License, to extend the patent |
|
525 |
+license to downstream recipients. "Knowingly relying" means you have |
|
526 |
+actual knowledge that, but for the patent license, your conveying the |
|
527 |
+covered work in a country, or your recipient's use of the covered work |
|
528 |
+in a country, would infringe one or more identifiable patents in that |
|
529 |
+country that you have reason to believe are valid. |
|
530 |
+ |
|
531 |
+ If, pursuant to or in connection with a single transaction or |
|
532 |
+arrangement, you convey, or propagate by procuring conveyance of, a |
|
533 |
+covered work, and grant a patent license to some of the parties |
|
534 |
+receiving the covered work authorizing them to use, propagate, modify |
|
535 |
+or convey a specific copy of the covered work, then the patent license |
|
536 |
+you grant is automatically extended to all recipients of the covered |
|
537 |
+work and works based on it. |
|
538 |
+ |
|
539 |
+ A patent license is "discriminatory" if it does not include within |
|
540 |
+the scope of its coverage, prohibits the exercise of, or is |
|
541 |
+conditioned on the non-exercise of one or more of the rights that are |
|
542 |
+specifically granted under this License. You may not convey a covered |
|
543 |
+work if you are a party to an arrangement with a third party that is |
|
544 |
+in the business of distributing software, under which you make payment |
|
545 |
+to the third party based on the extent of your activity of conveying |
|
546 |
+the work, and under which the third party grants, to any of the |
|
547 |
+parties who would receive the covered work from you, a discriminatory |
|
548 |
+patent license (a) in connection with copies of the covered work |
|
549 |
+conveyed by you (or copies made from those copies), or (b) primarily |
|
550 |
+for and in connection with specific products or compilations that |
|
551 |
+contain the covered work, unless you entered into that arrangement, |
|
552 |
+or that patent license was granted, prior to 28 March 2007. |
|
553 |
+ |
|
554 |
+ Nothing in this License shall be construed as excluding or limiting |
|
555 |
+any implied license or other defenses to infringement that may |
|
556 |
+otherwise be available to you under applicable patent law. |
|
557 |
+ |
|
558 |
+ 12. No Surrender of Others' Freedom. |
|
559 |
+ |
|
560 |
+ If conditions are imposed on you (whether by court order, agreement or |
|
561 |
+otherwise) that contradict the conditions of this License, they do not |
|
562 |
+excuse you from the conditions of this License. If you cannot convey a |
|
563 |
+covered work so as to satisfy simultaneously your obligations under this |
|
564 |
+License and any other pertinent obligations, then as a consequence you may |
|
565 |
+not convey it at all. For example, if you agree to terms that obligate you |
|
566 |
+to collect a royalty for further conveying from those to whom you convey |
|
567 |
+the Program, the only way you could satisfy both those terms and this |
|
568 |
+License would be to refrain entirely from conveying the Program. |
|
569 |
+ |
|
570 |
+ 13. Use with the GNU Affero General Public License. |
|
571 |
+ |
|
572 |
+ Notwithstanding any other provision of this License, you have |
|
573 |
+permission to link or combine any covered work with a work licensed |
|
574 |
+under version 3 of the GNU Affero General Public License into a single |
|
575 |
+combined work, and to convey the resulting work. The terms of this |
|
576 |
+License will continue to apply to the part which is the covered work, |
|
577 |
+but the special requirements of the GNU Affero General Public License, |
|
578 |
+section 13, concerning interaction through a network will apply to the |
|
579 |
+combination as such. |
|
580 |
+ |
|
581 |
+ 14. Revised Versions of this License. |
|
582 |
+ |
|
583 |
+ The Free Software Foundation may publish revised and/or new versions of |
|
584 |
+the GNU General Public License from time to time. Such new versions will |
|
585 |
+be similar in spirit to the present version, but may differ in detail to |
|
586 |
+address new problems or concerns. |
|
587 |
+ |
|
588 |
+ Each version is given a distinguishing version number. If the |
|
589 |
+Program specifies that a certain numbered version of the GNU General |
|
590 |
+Public License "or any later version" applies to it, you have the |
|
591 |
+option of following the terms and conditions either of that numbered |
|
592 |
+version or of any later version published by the Free Software |
|
593 |
+Foundation. If the Program does not specify a version number of the |
|
594 |
+GNU General Public License, you may choose any version ever published |
|
595 |
+by the Free Software Foundation. |
|
596 |
+ |
|
597 |
+ If the Program specifies that a proxy can decide which future |
|
598 |
+versions of the GNU General Public License can be used, that proxy's |
|
599 |
+public statement of acceptance of a version permanently authorizes you |
|
600 |
+to choose that version for the Program. |
|
601 |
+ |
|
602 |
+ Later license versions may give you additional or different |
|
603 |
+permissions. However, no additional obligations are imposed on any |
|
604 |
+author or copyright holder as a result of your choosing to follow a |
|
605 |
+later version. |
|
606 |
+ |
|
607 |
+ 15. Disclaimer of Warranty. |
|
608 |
+ |
|
609 |
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY |
|
610 |
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT |
|
611 |
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY |
|
612 |
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, |
|
613 |
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
|
614 |
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM |
|
615 |
+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF |
|
616 |
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION. |
|
617 |
+ |
|
618 |
+ 16. Limitation of Liability. |
|
619 |
+ |
|
620 |
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING |
|
621 |
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS |
|
622 |
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY |
|
623 |
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE |
|
624 |
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF |
|
625 |
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD |
|
626 |
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), |
|
627 |
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF |
|
628 |
+SUCH DAMAGES. |
|
629 |
+ |
|
630 |
+ 17. Interpretation of Sections 15 and 16. |
|
631 |
+ |
|
632 |
+ If the disclaimer of warranty and limitation of liability provided |
|
633 |
+above cannot be given local legal effect according to their terms, |
|
634 |
+reviewing courts shall apply local law that most closely approximates |
|
635 |
+an absolute waiver of all civil liability in connection with the |
|
636 |
+Program, unless a warranty or assumption of liability accompanies a |
|
637 |
+copy of the Program in return for a fee. |
|
638 |
+ |
|
639 |
+ END OF TERMS AND CONDITIONS |
|
640 |
+ |
|
641 |
+ How to Apply These Terms to Your New Programs |
|
642 |
+ |
|
643 |
+ If you develop a new program, and you want it to be of the greatest |
|
644 |
+possible use to the public, the best way to achieve this is to make it |
|
645 |
+free software which everyone can redistribute and change under these terms. |
|
646 |
+ |
|
647 |
+ To do so, attach the following notices to the program. It is safest |
|
648 |
+to attach them to the start of each source file to most effectively |
|
649 |
+state the exclusion of warranty; and each file should have at least |
|
650 |
+the "copyright" line and a pointer to where the full notice is found. |
|
651 |
+ |
|
652 |
+ <one line to give the program's name and a brief idea of what it does.> |
|
653 |
+ Copyright (C) <year> <name of author> |
|
654 |
+ |
|
655 |
+ This program is free software: you can redistribute it and/or modify |
|
656 |
+ it under the terms of the GNU General Public License as published by |
|
657 |
+ the Free Software Foundation, either version 3 of the License, or |
|
658 |
+ (at your option) any later version. |
|
659 |
+ |
|
660 |
+ This program is distributed in the hope that it will be useful, |
|
661 |
+ but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
662 |
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
663 |
+ GNU General Public License for more details. |
|
664 |
+ |
|
665 |
+ You should have received a copy of the GNU General Public License |
|
666 |
+ along with this program. If not, see <https://www.gnu.org/licenses/>. |
|
667 |
+ |
|
668 |
+Also add information on how to contact you by electronic and paper mail. |
|
669 |
+ |
|
670 |
+ If the program does terminal interaction, make it output a short |
|
671 |
+notice like this when it starts in an interactive mode: |
|
672 |
+ |
|
673 |
+ <program> Copyright (C) <year> <name of author> |
|
674 |
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. |
|
675 |
+ This is free software, and you are welcome to redistribute it |
|
676 |
+ under certain conditions; type `show c' for details. |
|
677 |
+ |
|
678 |
+The hypothetical commands `show w' and `show c' should show the appropriate |
|
679 |
+parts of the General Public License. Of course, your program's commands |
|
680 |
+might be different; for a GUI interface, you would use an "about box". |
|
681 |
+ |
|
682 |
+ You should also get your employer (if you work as a programmer) or school, |
|
683 |
+if any, to sign a "copyright disclaimer" for the program, if necessary. |
|
684 |
+For more information on this, and how to apply and follow the GNU GPL, see |
|
685 |
+<https://www.gnu.org/licenses/>. |
|
686 |
+ |
|
687 |
+ The GNU General Public License does not permit incorporating your program |
|
688 |
+into proprietary programs. If your program is a subroutine library, you |
|
689 |
+may consider it more useful to permit linking proprietary applications with |
|
690 |
+the library. If this is what you want to do, use the GNU Lesser General |
|
691 |
+Public License instead of this License. But first, please read |
|
692 |
+<https://www.gnu.org/licenses/why-not-lgpl.html>. |
|
693 |
+ |
|
694 |
+ |
|
695 |
+ |
|
696 |
+ GNU LESSER GENERAL PUBLIC LICENSE |
|
697 |
+ Version 3, 29 June 2007 |
|
698 |
+ |
|
699 |
+ Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/> |
|
700 |
+ Everyone is permitted to copy and distribute verbatim copies |
|
701 |
+ of this license document, but changing it is not allowed. |
|
702 |
+ |
|
703 |
+ |
|
704 |
+ This version of the GNU Lesser General Public License incorporates |
|
705 |
+the terms and conditions of version 3 of the GNU General Public |
|
706 |
+License, supplemented by the additional permissions listed below. |
|
707 |
+ |
|
708 |
+ 0. Additional Definitions. |
|
709 |
+ |
|
710 |
+ As used herein, "this License" refers to version 3 of the GNU Lesser |
|
711 |
+General Public License, and the "GNU GPL" refers to version 3 of the GNU |
|
712 |
+General Public License. |
|
713 |
+ |
|
714 |
+ "The Library" refers to a covered work governed by this License, |
|
715 |
+other than an Application or a Combined Work as defined below. |
|
716 |
+ |
|
717 |
+ An "Application" is any work that makes use of an interface provided |
|
718 |
+by the Library, but which is not otherwise based on the Library. |
|
719 |
+Defining a subclass of a class defined by the Library is deemed a mode |
|
720 |
+of using an interface provided by the Library. |
|
721 |
+ |
|
722 |
+ A "Combined Work" is a work produced by combining or linking an |
|
723 |
+Application with the Library. The particular version of the Library |
|
724 |
+with which the Combined Work was made is also called the "Linked |
|
725 |
+Version". |
|
726 |
+ |
|
727 |
+ The "Minimal Corresponding Source" for a Combined Work means the |
|
728 |
+Corresponding Source for the Combined Work, excluding any source code |
|
729 |
+for portions of the Combined Work that, considered in isolation, are |
|
730 |
+based on the Application, and not on the Linked Version. |
|
731 |
+ |
|
732 |
+ The "Corresponding Application Code" for a Combined Work means the |
|
733 |
+object code and/or source code for the Application, including any data |
|
734 |
+and utility programs needed for reproducing the Combined Work from the |
|
735 |
+Application, but excluding the System Libraries of the Combined Work. |
|
736 |
+ |
|
737 |
+ 1. Exception to Section 3 of the GNU GPL. |
|
738 |
+ |
|
739 |
+ You may convey a covered work under sections 3 and 4 of this License |
|
740 |
+without being bound by section 3 of the GNU GPL. |
|
741 |
+ |
|
742 |
+ 2. Conveying Modified Versions. |
|
743 |
+ |
|
744 |
+ If you modify a copy of the Library, and, in your modifications, a |
|
745 |
+facility refers to a function or data to be supplied by an Application |
|
746 |
+that uses the facility (other than as an argument passed when the |
|
747 |
+facility is invoked), then you may convey a copy of the modified |
|
748 |
+version: |
|
749 |
+ |
|
750 |
+ a) under this License, provided that you make a good faith effort to |
|
751 |
+ ensure that, in the event an Application does not supply the |
|
752 |
+ function or data, the facility still operates, and performs |
|
753 |
+ whatever part of its purpose remains meaningful, or |
|
754 |
+ |
|
755 |
+ b) under the GNU GPL, with none of the additional permissions of |
|
756 |
+ this License applicable to that copy. |
|
757 |
+ |
|
758 |
+ 3. Object Code Incorporating Material from Library Header Files. |
|
759 |
+ |
|
760 |
+ The object code form of an Application may incorporate material from |
|
761 |
+a header file that is part of the Library. You may convey such object |
|
762 |
+code under terms of your choice, provided that, if the incorporated |
|
763 |
+material is not limited to numerical parameters, data structure |
|
764 |
+layouts and accessors, or small macros, inline functions and templates |
|
765 |
+(ten or fewer lines in length), you do both of the following: |
|
766 |
+ |
|
767 |
+ a) Give prominent notice with each copy of the object code that the |
|
768 |
+ Library is used in it and that the Library and its use are |
|
769 |
+ covered by this License. |
|
770 |
+ |
|
771 |
+ b) Accompany the object code with a copy of the GNU GPL and this license |
|
772 |
+ document. |
|
773 |
+ |
|
774 |
+ 4. Combined Works. |
|
775 |
+ |
|
776 |
+ You may convey a Combined Work under terms of your choice that, |
|
777 |
+taken together, effectively do not restrict modification of the |
|
778 |
+portions of the Library contained in the Combined Work and reverse |
|
779 |
+engineering for debugging such modifications, if you also do each of |
|
780 |
+the following: |
|
781 |
+ |
|
782 |
+ a) Give prominent notice with each copy of the Combined Work that |
|
783 |
+ the Library is used in it and that the Library and its use are |
|
784 |
+ covered by this License. |
|
785 |
+ |
|
786 |
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license |
|
787 |
+ document. |
|
788 |
+ |
|
789 |
+ c) For a Combined Work that displays copyright notices during |
|
790 |
+ execution, include the copyright notice for the Library among |
|
791 |
+ these notices, as well as a reference directing the user to the |
|
792 |
+ copies of the GNU GPL and this license document. |
|
793 |
+ |
|
794 |
+ d) Do one of the following: |
|
795 |
+ |
|
796 |
+ 0) Convey the Minimal Corresponding Source under the terms of this |
|
797 |
+ License, and the Corresponding Application Code in a form |
|
798 |
+ suitable for, and under terms that permit, the user to |
|
799 |
+ recombine or relink the Application with a modified version of |
|
800 |
+ the Linked Version to produce a modified Combined Work, in the |
|
801 |
+ manner specified by section 6 of the GNU GPL for conveying |
|
802 |
+ Corresponding Source. |
|
803 |
+ |
|
804 |
+ 1) Use a suitable shared library mechanism for linking with the |
|
805 |
+ Library. A suitable mechanism is one that (a) uses at run time |
|
806 |
+ a copy of the Library already present on the user's computer |
|
807 |
+ system, and (b) will operate properly with a modified version |
|
808 |
+ of the Library that is interface-compatible with the Linked |
|
809 |
+ Version. |
|
810 |
+ |
|
811 |
+ e) Provide Installation Information, but only if you would otherwise |
|
812 |
+ be required to provide such information under section 6 of the |
|
813 |
+ GNU GPL, and only to the extent that such information is |
|
814 |
+ necessary to install and execute a modified version of the |
|
815 |
+ Combined Work produced by recombining or relinking the |
|
816 |
+ Application with a modified version of the Linked Version. (If |
|
817 |
+ you use option 4d0, the Installation Information must accompany |
|
818 |
+ the Minimal Corresponding Source and Corresponding Application |
|
819 |
+ Code. If you use option 4d1, you must provide the Installation |
|
820 |
+ Information in the manner specified by section 6 of the GNU GPL |
|
821 |
+ for conveying Corresponding Source.) |
|
822 |
+ |
|
823 |
+ 5. Combined Libraries. |
|
824 |
+ |
|
825 |
+ You may place library facilities that are a work based on the |
|
826 |
+Library side by side in a single library together with other library |
|
827 |
+facilities that are not Applications and are not covered by this |
|
828 |
+License, and convey such a combined library under terms of your |
|
829 |
+choice, if you do both of the following: |
|
830 |
+ |
|
831 |
+ a) Accompany the combined library with a copy of the same work based |
|
832 |
+ on the Library, uncombined with any other library facilities, |
|
833 |
+ conveyed under the terms of this License. |
|
834 |
+ |
|
835 |
+ b) Give prominent notice with the combined library that part of it |
|
836 |
+ is a work based on the Library, and explaining where to find the |
|
837 |
+ accompanying uncombined form of the same work. |
|
838 |
+ |
|
839 |
+ 6. Revised Versions of the GNU Lesser General Public License. |
|
840 |
+ |
|
841 |
+ The Free Software Foundation may publish revised and/or new versions |
|
842 |
+of the GNU Lesser General Public License from time to time. Such new |
|
843 |
+versions will be similar in spirit to the present version, but may |
|
844 |
+differ in detail to address new problems or concerns. |
|
845 |
+ |
|
846 |
+ Each version is given a distinguishing version number. If the |
|
847 |
+Library as you received it specifies that a certain numbered version |
|
848 |
+of the GNU Lesser General Public License "or any later version" |
|
849 |
+applies to it, you have the option of following the terms and |
|
850 |
+conditions either of that published version or of any later version |
|
851 |
+published by the Free Software Foundation. If the Library as you |
|
852 |
+received it does not specify a version number of the GNU Lesser |
|
853 |
+General Public License, you may choose any version of the GNU Lesser |
|
854 |
+General Public License ever published by the Free Software Foundation. |
|
855 |
+ |
|
856 |
+ If the Library as you received it specifies that a proxy can decide |
|
857 |
+whether future versions of the GNU Lesser General Public License shall |
|
858 |
+apply, that proxy's public statement of acceptance of any version is |
|
859 |
+permanent authorization for you to choose that version for the |
|
860 |
+Library. |
|
861 |
+ |
... | ... |
@@ -0,0 +1,133 @@ |
1 |
+declare module lib_shape { |
|
2 |
+ /** |
|
3 |
+ * @author fenris |
|
4 |
+ */ |
|
5 |
+ type type_inspection = { |
|
6 |
+ messages: Array<string>; |
|
7 |
+ }; |
|
8 |
+ /** |
|
9 |
+ * @author fenris |
|
10 |
+ */ |
|
11 |
+ type type_shape = { |
|
12 |
+ name: string; |
|
13 |
+ parameters?: Object; |
|
14 |
+ }; |
|
15 |
+ /** |
|
16 |
+ * @author fenris |
|
17 |
+ */ |
|
18 |
+ function list(): Array<string>; |
|
19 |
+ /** |
|
20 |
+ * @author fenris |
|
21 |
+ */ |
|
22 |
+ function inspection_create(): type_inspection; |
|
23 |
+ /** |
|
24 |
+ * @author fenris |
|
25 |
+ */ |
|
26 |
+ function inspection_add(main: type_inspection, message: string): void; |
|
27 |
+ /** |
|
28 |
+ * @author fenris |
|
29 |
+ */ |
|
30 |
+ function inspection_extend(main: type_inspection, prefix: string, sub: type_inspection): void; |
|
31 |
+ /** |
|
32 |
+ * @author fenris |
|
33 |
+ * @todo check for existing |
|
34 |
+ */ |
|
35 |
+ function register({ "name": name, "make": make, "inspect": _inspect, "stance": _stance, "show": _show, }: { |
|
36 |
+ name: string; |
|
37 |
+ make: (raw: Object, _make?: (raw: Object) => type_shape) => Object; |
|
38 |
+ inspect: (parameters: Object, value: any, _inspect?: (shape: type_shape, value: any) => type_inspection) => type_inspection; |
|
39 |
+ stance: (parameters: Object, bindings: { |
|
40 |
+ [name: string]: type_shape; |
|
41 |
+ }, _stance?: (shape: type_shape, bindings: { |
|
42 |
+ [name: string]: type_shape; |
|
43 |
+ }) => type_shape) => type_shape; |
|
44 |
+ show: (parameters: Object, _show?: (shape: type_shape) => string) => string; |
|
45 |
+ }): void; |
|
46 |
+ /** |
|
47 |
+ * @author fenris |
|
48 |
+ * @todo check for existing |
|
49 |
+ */ |
|
50 |
+ function define_alias({ "name": name, "target": target, }: { |
|
51 |
+ name: string; |
|
52 |
+ target: type_shape; |
|
53 |
+ }): void; |
|
54 |
+ /** |
|
55 |
+ * @author fenris |
|
56 |
+ * @todo check for existing |
|
57 |
+ */ |
|
58 |
+ /** |
|
59 |
+ * @author fenris |
|
60 |
+ */ |
|
61 |
+ function make(raw: Object): type_shape; |
|
62 |
+ /** |
|
63 |
+ * @author fenris |
|
64 |
+ */ |
|
65 |
+ function inspect(shape: type_shape, value: any): type_inspection; |
|
66 |
+ /** |
|
67 |
+ * @author fenris |
|
68 |
+ */ |
|
69 |
+ function check(shape: type_shape, value: any): boolean; |
|
70 |
+ /** |
|
71 |
+ * @author fenris |
|
72 |
+ */ |
|
73 |
+ function stance(shape: type_shape, bindings: { |
|
74 |
+ [name: string]: type_shape; |
|
75 |
+ }): type_shape; |
|
76 |
+ /** |
|
77 |
+ * @author fenris |
|
78 |
+ */ |
|
79 |
+ function show(shape: type_shape): string; |
|
80 |
+} |
|
81 |
+declare module lib_shape { |
|
82 |
+} |
|
83 |
+declare module lib_shape { |
|
84 |
+} |
|
85 |
+declare module lib_shape { |
|
86 |
+} |
|
87 |
+declare module lib_shape { |
|
88 |
+} |
|
89 |
+declare module lib_shape { |
|
90 |
+} |
|
91 |
+declare module lib_shape { |
|
92 |
+} |
|
93 |
+declare module lib_shape { |
|
94 |
+} |
|
95 |
+declare module lib_shape { |
|
96 |
+} |
|
97 |
+declare module lib_shape { |
|
98 |
+} |
|
99 |
+declare module lib_shape { |
|
100 |
+} |
|
101 |
+declare module lib_shape { |
|
102 |
+} |
|
103 |
+declare module lib_shape { |
|
104 |
+} |
|
105 |
+declare module lib_shape { |
|
106 |
+} |
|
107 |
+declare module lib_shape { |
|
108 |
+} |
|
109 |
+declare module lib_shape { |
|
110 |
+} |
|
111 |
+declare module lib_shape { |
|
112 |
+} |
|
113 |
+declare module lib_shape { |
|
114 |
+} |
|
115 |
+declare module lib_shape { |
|
116 |
+} |
|
117 |
+declare module lib_shape { |
|
118 |
+} |
|
119 |
+declare module lib_shape { |
|
120 |
+ /** |
|
121 |
+ * @author fenris |
|
122 |
+ * @todo use a treemap-function (but first make one :P) |
|
123 |
+ */ |
|
124 |
+ function adjust_labels(shape: type_shape, transformator: (label_old: string) => string): type_shape; |
|
125 |
+ /** |
|
126 |
+ * @author fenris |
|
127 |
+ */ |
|
128 |
+ function register_(id: string, factory: (parameters: Object) => type_shape): void; |
|
129 |
+ /** |
|
130 |
+ * @author fenris |
|
131 |
+ */ |
|
132 |
+ function retrieve_(id: string): type_shape; |
|
133 |
+} |
... | ... |
@@ -0,0 +1,2282 @@ |
1 |
+/* |
|
2 |
+This file is part of »bacterio-plankton:shape«. |
|
3 |
+ |
|
4 |
+Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
5 |
+<info@greenscale.de> |
|
6 |
+ |
|
7 |
+»bacterio-plankton:shape« is free software: you can redistribute it and/or modify |
|
8 |
+it under the terms of the GNU Lesser General Public License as published by |
|
9 |
+the Free Software Foundation, either version 3 of the License, or |
|
10 |
+(at your option) any later version. |
|
11 |
+ |
|
12 |
+»bacterio-plankton:shape« is distributed in the hope that it will be useful, |
|
13 |
+but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
14 |
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
15 |
+GNU Lesser General Public License for more details. |
|
16 |
+ |
|
17 |
+You should have received a copy of the GNU Lesser General Public License |
|
18 |
+along with »bacterio-plankton:shape«. If not, see <http://www.gnu.org/licenses/>. |
|
19 |
+ */ |
|
20 |
+var lib_shape; |
|
21 |
+(function (lib_shape) { |
|
22 |
+ /** |
|
23 |
+ * @author fenris |
|
24 |
+ */ |
|
25 |
+ var _pool = {}; |
|
26 |
+ /** |
|
27 |
+ * @author fenris |
|
28 |
+ */ |
|
29 |
+ var _aliases = {}; |
|
30 |
+ /** |
|
31 |
+ * @author fenris |
|
32 |
+ */ |
|
33 |
+ function list() { |
|
34 |
+ return [].concat(Object.keys(_pool)).concat(Object.keys(_aliases)); |
|
35 |
+ } |
|
36 |
+ lib_shape.list = list; |
|
37 |
+ /** |
|
38 |
+ * @author fenris |
|
39 |
+ */ |
|
40 |
+ function inspection_create() { |
|
41 |
+ return { |
|
42 |
+ "messages": [] |
|
43 |
+ }; |
|
44 |
+ } |
|
45 |
+ lib_shape.inspection_create = inspection_create; |
|
46 |
+ /** |
|
47 |
+ * @author fenris |
|
48 |
+ */ |
|
49 |
+ function inspection_add(main, message) { |
|
50 |
+ main.messages.push(message); |
|
51 |
+ } |
|
52 |
+ lib_shape.inspection_add = inspection_add; |
|
53 |
+ /** |
|
54 |
+ * @author fenris |
|
55 |
+ */ |
|
56 |
+ function inspection_extend(main, prefix, sub) { |
|
57 |
+ main.messages = main.messages.concat(sub.messages.map(message => `${prefix}: ${message}`)); |
|
58 |
+ } |
|
59 |
+ lib_shape.inspection_extend = inspection_extend; |
|
60 |
+ /** |
|
61 |
+ * @author fenris |
|
62 |
+ * @todo check for existing |
|
63 |
+ */ |
|
64 |
+ function register({ "name": name, "make": make, "inspect": _inspect, "stance": _stance, "show": _show, }) { |
|
65 |
+ const entry = { |
|
66 |
+ "name": name, |
|
67 |
+ "make": make, |
|
68 |
+ "inspect": _inspect, |
|
69 |
+ "stance": _stance, |
|
70 |
+ "show": _show, |
|
71 |
+ }; |
|
72 |
+ _pool[name] = entry; |
|
73 |
+ } |
|
74 |
+ lib_shape.register = register; |
|
75 |
+ /** |
|
76 |
+ * @author fenris |
|
77 |
+ * @todo check for existing |
|
78 |
+ */ |
|
79 |
+ function define_alias({ "name": name, "target": target, }) { |
|
80 |
+ const entry = { |
|
81 |
+ "name": "alias", |
|
82 |
+ "target": target, |
|
83 |
+ }; |
|
84 |
+ _aliases[name] = entry; |
|
85 |
+ } |
|
86 |
+ lib_shape.define_alias = define_alias; |
|
87 |
+ /** |
|
88 |
+ * @author fenris |
|
89 |
+ * @todo check for existing |
|
90 |
+ */ |
|
91 |
+ /* |
|
92 |
+ export function inspect_jstype( |
|
93 |
+ inspection, |
|
94 |
+ jstype_expected : string, |
|
95 |
+ value : any |
|
96 |
+ ) : void { |
|
97 |
+ let jstype_actual : string = typeof(value); |
|
98 |
+ if (jstype_actual === jstype_expected) { |
|
99 |
+ // all good |
|
100 |
+ } |
|
101 |
+ else { |
|
102 |
+ inspection_add(inspection, `expected JS-type '${jstype_expected}' but got '${jstype_actual}'`); |
|
103 |
+ } |
|
104 |
+ } |
|
105 |
+ */ |
|
106 |
+ /** |
|
107 |
+ * @author fenris |
|
108 |
+ */ |
|
109 |
+ function make(raw) { |
|
110 |
+ const name = raw["name"]; |
|
111 |
+ if (_aliases.hasOwnProperty(name)) { |
|
112 |
+ const alias = _aliases[name]; |
|
113 |
+ return alias.target; |
|
114 |
+ } |
|
115 |
+ else { |
|
116 |
+ if (_pool.hasOwnProperty(name)) { |
|
117 |
+ const entry = _pool[name]; |
|
118 |
+ const parameters = entry.make(raw["parameters"] || {}, make); |
|
119 |
+ return { |
|
120 |
+ "name": name, |
|
121 |
+ "parameters": parameters, |
|
122 |
+ }; |
|
123 |
+ } |
|
124 |
+ else { |
|
125 |
+ const message = `no shape registered with name '${name}'`; |
|
126 |
+ throw (new Error(message)); |
|
127 |
+ } |
|
128 |
+ } |
|
129 |
+ } |
|
130 |
+ lib_shape.make = make; |
|
131 |
+ /** |
|
132 |
+ * @author fenris |
|
133 |
+ */ |
|
134 |
+ function inspect(shape, value) { |
|
135 |
+ if (_pool.hasOwnProperty(shape.name)) { |
|
136 |
+ const entry = _pool[shape.name]; |
|
137 |
+ return entry.inspect(shape.parameters, value, inspect); |
|
138 |
+ } |
|
139 |
+ else { |
|
140 |
+ const message = `no shape registered with name '${shape.name}'`; |
|
141 |
+ throw (new Error(message)); |
|
142 |
+ } |
|
143 |
+ } |
|
144 |
+ lib_shape.inspect = inspect; |
|
145 |
+ /** |
|
146 |
+ * @author fenris |
|
147 |
+ */ |
|
148 |
+ function check(shape, value) { |
|
149 |
+ if (_pool.hasOwnProperty(shape.name)) { |
|
150 |
+ const entry = _pool[shape.name]; |
|
151 |
+ const inspection = inspect(shape, value); |
|
152 |
+ inspection.messages |
|
153 |
+ .forEach((message) => { console.warn(message); }); |
|
154 |
+ return (inspection.messages.length === 0); |
|
155 |
+ } |
|
156 |
+ else { |
|
157 |
+ const message = `no shape registered with name '${shape.name}'`; |
|
158 |
+ throw (new Error(message)); |
|
159 |
+ } |
|
160 |
+ } |
|
161 |
+ lib_shape.check = check; |
|
162 |
+ /** |
|
163 |
+ * @author fenris |
|
164 |
+ */ |
|
165 |
+ function stance(shape, bindings) { |
|
166 |
+ if (_pool.hasOwnProperty(shape.name)) { |
|
167 |
+ const entry = _pool[shape.name]; |
|
168 |
+ return entry.stance(shape.parameters, bindings, stance); |
|
169 |
+ } |
|
170 |
+ else { |
|
171 |
+ const message = `no shape registered with name '${shape.name}'`; |
|
172 |
+ throw (new Error(message)); |
|
173 |
+ } |
|
174 |
+ } |
|
175 |
+ lib_shape.stance = stance; |
|
176 |
+ /** |
|
177 |
+ * @author fenris |
|
178 |
+ */ |
|
179 |
+ function show(shape) { |
|
180 |
+ if (_pool.hasOwnProperty(shape.name)) { |
|
181 |
+ const entry = _pool[shape.name]; |
|
182 |
+ return entry.show(shape.parameters, show); |
|
183 |
+ } |
|
184 |
+ else { |
|
185 |
+ const message = `no shape registered with name '${shape.name}'`; |
|
186 |
+ throw (new Error(message)); |
|
187 |
+ } |
|
188 |
+ } |
|
189 |
+ lib_shape.show = show; |
|
190 |
+})(lib_shape || (lib_shape = {})); |
|
191 |
+/* |
|
192 |
+This file is part of »bacterio-plankton:shape«. |
|
193 |
+ |
|
194 |
+Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
195 |
+<info@greenscale.de> |
|
196 |
+ |
|
197 |
+»bacterio-plankton:shape« is free software: you can redistribute it and/or modify |
|
198 |
+it under the terms of the GNU Lesser General Public License as published by |
|
199 |
+the Free Software Foundation, either version 3 of the License, or |
|
200 |
+(at your option) any later version. |
|
201 |
+ |
|
202 |
+»bacterio-plankton:shape« is distributed in the hope that it will be useful, |
|
203 |
+but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
204 |
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
205 |
+GNU Lesser General Public License for more details. |
|
206 |
+ |
|
207 |
+You should have received a copy of the GNU Lesser General Public License |
|
208 |
+along with »bacterio-plankton:shape«. If not, see <http://www.gnu.org/licenses/>. |
|
209 |
+ */ |
|
210 |
+var lib_shape; |
|
211 |
+(function (lib_shape) { |
|
212 |
+ /** |
|
213 |
+ * @author fenris |
|
214 |
+ */ |
|
215 |
+ function variable_make({ "name": name }) { |
|
216 |
+ if (name == undefined) { |
|
217 |
+ let message = `mandatory parameter 'name' missing`; |
|
218 |
+ throw (new Error(message)); |
|
219 |
+ } |
|
220 |
+ else { |
|
221 |
+ return { |
|
222 |
+ "name": name, |
|
223 |
+ }; |
|
224 |
+ } |
|
225 |
+ } |
|
226 |
+ /** |
|
227 |
+ * @author fenris |
|
228 |
+ */ |
|
229 |
+ function variable_inspect(parameters, value, _inspect) { |
|
230 |
+ let inspection = lib_shape.inspection_create(); |
|
231 |
+ let message = "cannot inspect a value against a type variable"; |
|
232 |
+ console.warn(message + "; will just pass ..."); |
|
233 |
+ // throw (new Error(message)); |
|
234 |
+ return inspection; |
|
235 |
+ } |
|
236 |
+ /** |
|
237 |
+ * @author fenris |
|
238 |
+ */ |
|
239 |
+ function variable_stance(parameters, bindings, _stance) { |
|
240 |
+ if (parameters.name in bindings) { |
|
241 |
+ return bindings[parameters.name]; |
|
242 |
+ } |
|
243 |
+ else { |
|
244 |
+ return { |
|
245 |
+ "name": "variable", |
|
246 |
+ "parameters": parameters |
|
247 |
+ }; |
|
248 |
+ } |
|
249 |
+ } |
|
250 |
+ /** |
|
251 |
+ * @author fenris |
|
252 |
+ */ |
|
253 |
+ function variable_show(parameters, _show) { |
|
254 |
+ let str; |
|
255 |
+ // core |
|
256 |
+ { |
|
257 |
+ str = ("$" + parameters.name); |
|
258 |
+ } |
|
259 |
+ return str; |
|
260 |
+ } |
|
261 |
+ /** |
|
262 |
+ * @author fenris |
|
263 |
+ */ |
|
264 |
+ lib_shape.register({ |
|
265 |
+ "name": "variable", |
|
266 |
+ "make": variable_make, |
|
267 |
+ "inspect": variable_inspect, |
|
268 |
+ "stance": variable_stance, |
|
269 |
+ "show": variable_show, |
|
270 |
+ }); |
|
271 |
+})(lib_shape || (lib_shape = {})); |
|
272 |
+/* |
|
273 |
+This file is part of »bacterio-plankton:shape«. |
|
274 |
+ |
|
275 |
+Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
276 |
+<info@greenscale.de> |
|
277 |
+ |
|
278 |
+»bacterio-plankton:shape« is free software: you can redistribute it and/or modify |
|
279 |
+it under the terms of the GNU Lesser General Public License as published by |
|
280 |
+the Free Software Foundation, either version 3 of the License, or |
|
281 |
+(at your option) any later version. |
|
282 |
+ |
|
283 |
+»bacterio-plankton:shape« is distributed in the hope that it will be useful, |
|
284 |
+but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
285 |
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
286 |
+GNU Lesser General Public License for more details. |
|
287 |
+ |
|
288 |
+You should have received a copy of the GNU Lesser General Public License |
|
289 |
+along with »bacterio-plankton:shape«. If not, see <http://www.gnu.org/licenses/>. |
|
290 |
+ */ |
|
291 |
+var lib_shape; |
|
292 |
+(function (lib_shape) { |
|
293 |
+ /** |
|
294 |
+ * @author fenris |
|
295 |
+ */ |
|
296 |
+ function function_make({ "soft": soft = false, "shape_input": shape_input, "shape_output": shape_output, "defaultvalue": defaultvalue = undefined, }, _make) { |
|
297 |
+ if (shape_input === undefined) { |
|
298 |
+ let message = `mandatory parameter 'shape_input' missing`; |
|
299 |
+ throw (new Error(message)); |
|
300 |
+ } |
|
301 |
+ if (shape_output === undefined) { |
|
302 |
+ let message = `mandatory parameter 'shape_output' missing`; |
|
303 |
+ throw (new Error(message)); |
|
304 |
+ } |
|
305 |
+ if (defaultvalue === undefined) { |
|
306 |
+ defaultvalue = (soft ? null : (x => x)); |
|
307 |
+ } |
|
308 |
+ return { |
|
309 |
+ "soft": soft, |
|
310 |
+ "shape_input": _make(shape_input), |
|
311 |
+ "shape_output": _make(shape_output), |
|
312 |
+ "defaultvalue": defaultvalue, |
|
313 |
+ }; |
|
314 |
+ } |
|
315 |
+ /** |
|
316 |
+ * @author fenris |
|
317 |
+ */ |
|
318 |
+ function function_stance(parameters, bindings, _stance) { |
|
319 |
+ return { |
|
320 |
+ "name": "function", |
|
321 |
+ "parameters": { |
|
322 |
+ "soft": parameters.soft, |
|
323 |
+ "shape_input": _stance(parameters.shape_input, bindings), |
|
324 |
+ "shape_output": _stance(parameters.shape_output, bindings) |
|
325 |
+ } |
|
326 |
+ }; |
|
327 |
+ } |
|
328 |
+ /** |
|
329 |
+ * @author fenris |
|
330 |
+ * @todo closer look not possible? |
|
331 |
+ */ |
|
332 |
+ function function_inspect(parameters, value, _inspect) { |
|
333 |
+ let inspection = lib_shape.inspection_create(); |
|
334 |
+ if (value == undefined) { |
|
335 |
+ if (parameters.soft) { |
|
336 |
+ // all good |
|
337 |
+ } |
|
338 |
+ else { |
|
339 |
+ lib_shape.inspection_add(inspection, "null is not allowed"); |
|
340 |
+ } |
|
341 |
+ } |
|
342 |
+ else { |
|
343 |
+ let jstype_actual = typeof (value); |
|
344 |
+ let jstype_expected = "function"; |
|
345 |
+ if (jstype_actual === jstype_expected) { |
|
346 |
+ // all good? |
|
347 |
+ } |
|
348 |
+ else { |
|
349 |
+ lib_shape.inspection_add(inspection, `expected JS-type '${jstype_expected}' but got '${jstype_actual}'`); |
|
350 |
+ } |
|
351 |
+ } |
|
352 |
+ return inspection; |
|
353 |
+ } |
|
354 |
+ /** |
|
355 |
+ * @author fenris |
|
356 |
+ */ |
|
357 |
+ function function_show(parameters, _show) { |
|
358 |
+ let str; |
|
359 |
+ /* |
|
360 |
+ // core |
|
361 |
+ { |
|
362 |
+ str = "function"; |
|
363 |
+ } |
|
364 |
+ // in/out |
|
365 |
+ { |
|
366 |
+ str += ( |
|
367 |
+ "<" |
|
368 |
+ + |
|
369 |
+ [ |
|
370 |
+ _show(parameters.shape_input), |
|
371 |
+ _show(parameters.shape_output), |
|
372 |
+ ].join(",") |
|
373 |
+ + |
|
374 |
+ ">" |
|
375 |
+ ); |
|
376 |
+ } |
|
377 |
+ */ |
|
378 |
+ str = ""; |
|
379 |
+ str += ("(" + _show(parameters.shape_input) + " => " + _show(parameters.shape_output) + ")"); |
|
380 |
+ // soft |
|
381 |
+ { |
|
382 |
+ if (parameters.soft) { |
|
383 |
+ str = `~${str}`; |
|
384 |
+ } |
|
385 |
+ } |
|
386 |
+ return str; |
|
387 |
+ } |
|
388 |
+ /** |
|
389 |
+ * @author fenris |
|
390 |
+ */ |
|
391 |
+ lib_shape.register({ |
|
392 |
+ "name": "function", |
|
393 |
+ "make": function_make, |
|
394 |
+ "inspect": function_inspect, |
|
395 |
+ "stance": function_stance, |
|
396 |
+ "show": function_show, |
|
397 |
+ }); |
|
398 |
+})(lib_shape || (lib_shape = {})); |
|
399 |
+/* |
|
400 |
+This file is part of »bacterio-plankton:shape«. |
|
401 |
+ |
|
402 |
+Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
403 |
+<info@greenscale.de> |
|
404 |
+ |
|
405 |
+»bacterio-plankton:shape« is free software: you can redistribute it and/or modify |
|
406 |
+it under the terms of the GNU Lesser General Public License as published by |
|
407 |
+the Free Software Foundation, either version 3 of the License, or |
|
408 |
+(at your option) any later version. |
|
409 |
+ |
|
410 |
+»bacterio-plankton:shape« is distributed in the hope that it will be useful, |
|
411 |
+but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
412 |
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
413 |
+GNU Lesser General Public License for more details. |
|
414 |
+ |
|
415 |
+You should have received a copy of the GNU Lesser General Public License |
|
416 |
+along with »bacterio-plankton:shape«. If not, see <http://www.gnu.org/licenses/>. |
|
417 |
+ */ |
|
418 |
+var lib_shape; |
|
419 |
+(function (lib_shape) { |
|
420 |
+ /** |
|
421 |
+ * @author fenris |
|
422 |
+ */ |
|
423 |
+ function void_make({ "soft": soft = true, }) { |
|
424 |
+ return { |
|
425 |
+ "soft": soft, |
|
426 |
+ }; |
|
427 |
+ } |
|
428 |
+ /** |
|
429 |
+ * @author fenris |
|
430 |
+ */ |
|
431 |
+ function void_inspect(parameters, value, _inspect) { |
|
432 |
+ let inspection = lib_shape.inspection_create(); |
|
433 |
+ if (value == undefined) { |
|
434 |
+ if (parameters.soft) { |
|
435 |
+ // all good |
|
436 |
+ } |
|
437 |
+ else { |
|
438 |
+ lib_shape.inspection_add(inspection, "null is not allowed"); |
|
439 |
+ } |
|
440 |
+ } |
|
441 |
+ else { |
|
442 |
+ // all good |
|
443 |
+ } |
|
444 |
+ return inspection; |
|
445 |
+ } |
|
446 |
+ /** |
|
447 |
+ * @author fenris |
|
448 |
+ */ |
|
449 |
+ function void_stance(parameters, bindings, _stance) { |
|
450 |
+ return { |
|
451 |
+ "name": "void", |
|
452 |
+ "parameters": parameters |
|
453 |
+ }; |
|
454 |
+ } |
|
455 |
+ /** |
|
456 |
+ * @author fenris |
|
457 |
+ */ |
|
458 |
+ function void_show(parameters, _show) { |
|
459 |
+ let str; |
|
460 |
+ // core |
|
461 |
+ { |
|
462 |
+ str = "void"; |
|
463 |
+ } |
|
464 |
+ // soft |
|
465 |
+ { |
|
466 |
+ if (parameters.soft) { |
|
467 |
+ str = `~${str}`; |
|
468 |
+ } |
|
469 |
+ } |
|
470 |
+ return str; |
|
471 |
+ } |
|
472 |
+ /** |
|
473 |
+ * @author fenris |
|
474 |
+ */ |
|
475 |
+ lib_shape.register({ |
|
476 |
+ "name": "void", |
|
477 |
+ "make": void_make, |
|
478 |
+ "inspect": void_inspect, |
|
479 |
+ "stance": void_stance, |
|
480 |
+ "show": void_show, |
|
481 |
+ }); |
|
482 |
+})(lib_shape || (lib_shape = {})); |
|
483 |
+/* |
|
484 |
+This file is part of »bacterio-plankton:shape«. |
|
485 |
+ |
|
486 |
+Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
487 |
+<info@greenscale.de> |
|
488 |
+ |
|
489 |
+»bacterio-plankton:shape« is free software: you can redistribute it and/or modify |
|
490 |
+it under the terms of the GNU Lesser General Public License as published by |
|
491 |
+the Free Software Foundation, either version 3 of the License, or |
|
492 |
+(at your option) any later version. |
|
493 |
+ |
|
494 |
+»bacterio-plankton:shape« is distributed in the hope that it will be useful, |
|
495 |
+but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
496 |
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
497 |
+GNU Lesser General Public License for more details. |
|
498 |
+ |
|
499 |
+You should have received a copy of the GNU Lesser General Public License |
|
500 |
+along with »bacterio-plankton:shape«. If not, see <http://www.gnu.org/licenses/>. |
|
501 |
+ */ |
|
502 |
+var lib_shape; |
|
503 |
+(function (lib_shape) { |
|
504 |
+ /** |
|
505 |
+ * @author fenris |
|
506 |
+ */ |
|
507 |
+ function any_make({ "soft": soft = true, "mutable": mutable = true, "defaultvalue": defaultvalue = null, }) { |
|
508 |
+ return { |
|
509 |
+ "soft": soft, |
|
510 |
+ "mutable": mutable, |
|
511 |
+ "defaultvalue": defaultvalue, |
|
512 |
+ }; |
|
513 |
+ } |
|
514 |
+ /** |
|
515 |
+ * @author fenris |
|
516 |
+ */ |
|
517 |
+ function any_inspect(parameters, value, _inspect) { |
|
518 |
+ let inspection = lib_shape.inspection_create(); |
|
519 |
+ if (value == undefined) { |
|
520 |
+ if (parameters.soft) { |
|
521 |
+ // all good |
|
522 |
+ } |
|
523 |
+ else { |
|
524 |
+ lib_shape.inspection_add(inspection, "null is not allowed"); |
|
525 |
+ } |
|
526 |
+ } |
|
527 |
+ else { |
|
528 |
+ // all good |
|
529 |
+ } |
|
530 |
+ return inspection; |
|
531 |
+ } |
|
532 |
+ /** |
|
533 |
+ * @author fenris |
|
534 |
+ */ |
|
535 |
+ function any_stance(parameters, bindings, _stance) { |
|
536 |
+ return { |
|
537 |
+ "name": "any", |
|
538 |
+ "parameters": parameters |
|
539 |
+ }; |
|
540 |
+ } |
|
541 |
+ /** |
|
542 |
+ * @author fenris |
|
543 |
+ */ |
|
544 |
+ function any_show(parameters, _show) { |
|
545 |
+ let str; |
|
546 |
+ // core |
|
547 |
+ { |
|
548 |
+ str = "any"; |
|
549 |
+ } |
|
550 |
+ // soft |
|
551 |
+ { |
|
552 |
+ if (parameters.soft) { |
|
553 |
+ str = `~${str}`; |
|
554 |
+ } |
|
555 |
+ } |
|
556 |
+ return str; |
|
557 |
+ } |
|
558 |
+ /** |
|
559 |
+ * @author fenris |
|
560 |
+ */ |
|
561 |
+ lib_shape.register({ |
|
562 |
+ "name": "any", |
|
563 |
+ "make": any_make, |
|
564 |
+ "inspect": any_inspect, |
|
565 |
+ "stance": any_stance, |
|
566 |
+ "show": any_show, |
|
567 |
+ }); |
|
568 |
+})(lib_shape || (lib_shape = {})); |
|
569 |
+/* |
|
570 |
+This file is part of »bacterio-plankton:shape«. |
|
571 |
+ |
|
572 |
+Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
573 |
+<info@greenscale.de> |
|
574 |
+ |
|
575 |
+»bacterio-plankton:shape« is free software: you can redistribute it and/or modify |
|
576 |
+it under the terms of the GNU Lesser General Public License as published by |
|
577 |
+the Free Software Foundation, either version 3 of the License, or |
|
578 |
+(at your option) any later version. |
|
579 |
+ |
|
580 |
+»bacterio-plankton:shape« is distributed in the hope that it will be useful, |
|
581 |
+but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
582 |
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
583 |
+GNU Lesser General Public License for more details. |
|
584 |
+ |
|
585 |
+You should have received a copy of the GNU Lesser General Public License |
|
586 |
+along with »bacterio-plankton:shape«. If not, see <http://www.gnu.org/licenses/>. |
|
587 |
+ */ |
|
588 |
+var lib_shape; |
|
589 |
+(function (lib_shape) { |
|
590 |
+ /** |
|
591 |
+ * @author fenris |
|
592 |
+ */ |
|
593 |
+ function boolean_make({ "soft": soft = false, "mutable": mutable = true, "defaultvalue": defaultvalue = undefined, }) { |
|
594 |
+ if (defaultvalue === undefined) { |
|
595 |
+ defaultvalue = (soft ? null : false); |
|
596 |
+ } |
|
597 |
+ return { |
|
598 |
+ "soft": soft, |
|
599 |
+ "mutable": mutable, |
|
600 |
+ "defaultvalue": defaultvalue, |
|
601 |
+ }; |
|
602 |
+ } |
|
603 |
+ /** |
|
604 |
+ * @author fenris |
|
605 |
+ */ |
|
606 |
+ function boolean_inspect(parameters, value, _inspect) { |
|
607 |
+ let inspection = lib_shape.inspection_create(); |
|
608 |
+ if (value == undefined) { |
|
609 |
+ if (parameters.soft) { |
|
610 |
+ // all good |
|
611 |
+ } |
|
612 |
+ else { |
|
613 |
+ lib_shape.inspection_add(inspection, "null is not allowed"); |
|
614 |
+ } |
|
615 |
+ } |
|
616 |
+ else { |
|
617 |
+ let jstype_actual = typeof (value); |
|
618 |
+ let jstype_expected = "boolean"; |
|
619 |
+ if (jstype_actual === jstype_expected) { |
|
620 |
+ // all good |
|
621 |
+ } |
|
622 |
+ else { |
|
623 |
+ lib_shape.inspection_add(inspection, `expected JS-type '${jstype_expected}' but got '${jstype_actual}'`); |
|
624 |
+ } |
|
625 |
+ } |
|
626 |
+ return inspection; |
|
627 |
+ } |
|
628 |
+ /** |
|
629 |
+ * @author fenris |
|
630 |
+ */ |
|
631 |
+ function boolean_stance(parameters, bindings, _stance) { |
|
632 |
+ return { |
|
633 |
+ "name": "boolean", |
|
634 |
+ "parameters": parameters |
|
635 |
+ }; |
|
636 |
+ } |
|
637 |
+ /** |
|
638 |
+ * @author fenris |
|
639 |
+ */ |
|
640 |
+ function boolean_show(parameters, _show) { |
|
641 |
+ let str; |
|
642 |
+ // core |
|
643 |
+ { |
|
644 |
+ str = "boolean"; |
|
645 |
+ } |
|
646 |
+ // soft |
|
647 |
+ { |
|
648 |
+ if (parameters.soft) { |
|
649 |
+ str = `~${str}`; |
|
650 |
+ } |
|
651 |
+ } |
|
652 |
+ return str; |
|
653 |
+ } |
|
654 |
+ /** |
|
655 |
+ * @author fenris |
|
656 |
+ */ |
|
657 |
+ lib_shape.register({ |
|
658 |
+ "name": "boolean", |
|
659 |
+ "make": boolean_make, |
|
660 |
+ "inspect": boolean_inspect, |
|
661 |
+ "stance": boolean_stance, |
|
662 |
+ "show": boolean_show, |
|
663 |
+ }); |
|
664 |
+})(lib_shape || (lib_shape = {})); |
|
665 |
+/* |
|
666 |
+This file is part of »bacterio-plankton:shape«. |
|
667 |
+ |
|
668 |
+Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
669 |
+<info@greenscale.de> |
|
670 |
+ |
|
671 |
+»bacterio-plankton:shape« is free software: you can redistribute it and/or modify |
|
672 |
+it under the terms of the GNU Lesser General Public License as published by |
|
673 |
+the Free Software Foundation, either version 3 of the License, or |
|
674 |
+(at your option) any later version. |
|
675 |
+ |
|
676 |
+»bacterio-plankton:shape« is distributed in the hope that it will be useful, |
|
677 |
+but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
678 |
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
679 |
+GNU Lesser General Public License for more details. |
|
680 |
+ |
|
681 |
+You should have received a copy of the GNU Lesser General Public License |
|
682 |
+along with »bacterio-plankton:shape«. If not, see <http://www.gnu.org/licenses/>. |
|
683 |
+ */ |
|
684 |
+var lib_shape; |
|
685 |
+(function (lib_shape) { |
|
686 |
+ /** |
|
687 |
+ * @author fenris |
|
688 |
+ */ |
|
689 |
+ function int_make({ "soft": soft = false, "mutable": mutable = true, "defaultvalue": defaultvalue = undefined, "minimum": minimum = null, "maximum": maximum = null, }) { |
|
690 |
+ if (defaultvalue === undefined) { |
|
691 |
+ defaultvalue = (soft ? null : 0); |
|
692 |
+ } |
|
693 |
+ return { |
|
694 |
+ "soft": soft, |
|
695 |
+ "mutable": mutable, |
|
696 |
+ "defaultvalue": defaultvalue, |
|
697 |
+ "minimum": minimum, |
|
698 |
+ "maximum": maximum, |
|
699 |
+ }; |
|
700 |
+ } |
|
701 |
+ /** |
|
702 |
+ * @author fenris |
|
703 |
+ */ |
|
704 |
+ function int_inspect(parameters, value, _inspect) { |
|
705 |
+ let inspection = lib_shape.inspection_create(); |
|
706 |
+ if (value == undefined) { |
|
707 |
+ if (parameters.soft) { |
|
708 |
+ // all good |
|
709 |
+ } |
|
710 |
+ else { |
|
711 |
+ lib_shape.inspection_add(inspection, "null is not allowed"); |
|
712 |
+ } |
|
713 |
+ } |
|
714 |
+ else { |
|
715 |
+ let jstype_actual = typeof (value); |
|
716 |
+ let jstype_expected = "number"; |
|
717 |
+ if (jstype_actual === jstype_expected) { |
|
718 |
+ if (!isNaN(parseInt(value))) { |
|
719 |
+ if ((parameters.minimum === null) || (value >= parameters.minimum)) { |
|
720 |
+ if ((parameters.maximum === null) || (value <= parameters.maximum)) { |
|
721 |
+ // all good |
|
722 |
+ } |
|
723 |
+ else { |
|
724 |
+ lib_shape.inspection_add(inspection, `value is beyond maximum`); |
|
725 |
+ } |
|
726 |
+ } |
|
727 |
+ else { |
|
728 |
+ lib_shape.inspection_add(inspection, `value is below minimum`); |
|
729 |
+ } |
|
730 |
+ } |
|
731 |
+ else { |
|
732 |
+ lib_shape.inspection_add(inspection, `value is not parsable into a valid int`); |
|
733 |
+ } |
|
734 |
+ } |
|
735 |
+ else { |
|
736 |
+ lib_shape.inspection_add(inspection, `expected JS-type '${jstype_expected}' but got '${jstype_actual}'`); |
|
737 |
+ } |
|
738 |
+ } |
|
739 |
+ return inspection; |
|
740 |
+ } |
|
741 |
+ /** |
|
742 |
+ * @author fenris |
|
743 |
+ */ |
|
744 |
+ function int_stance(parameters, bindings, _stance) { |
|
745 |
+ return { |
|
746 |
+ "name": "int", |
|
747 |
+ "parameters": parameters |
|
748 |
+ }; |
|
749 |
+ } |
|
750 |
+ /** |
|
751 |
+ * @author fenris |
|
752 |
+ */ |
|
753 |
+ function int_show(parameters, _show) { |
|
754 |
+ let str; |
|
755 |
+ // core |
|
756 |
+ { |
|
757 |
+ str = "int"; |
|
758 |
+ } |
|
759 |
+ // soft |
|
760 |
+ { |
|
761 |
+ if (parameters.soft) { |
|
762 |
+ str = `~${str}`; |
|
763 |
+ } |
|
764 |
+ } |
|
765 |
+ return str; |
|
766 |
+ } |
|
767 |
+ /** |
|
768 |
+ * @author fenris |
|
769 |
+ */ |
|
770 |
+ lib_shape.register({ |
|
771 |
+ "name": "int", |
|
772 |
+ "make": int_make, |
|
773 |
+ "inspect": int_inspect, |
|
774 |
+ "stance": int_stance, |
|
775 |
+ "show": int_show, |
|
776 |
+ }); |
|
777 |
+})(lib_shape || (lib_shape = {})); |
|
778 |
+/* |
|
779 |
+This file is part of »bacterio-plankton:shape«. |
|
780 |
+ |
|
781 |
+Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
782 |
+<info@greenscale.de> |
|
783 |
+ |
|
784 |
+»bacterio-plankton:shape« is free software: you can redistribute it and/or modify |
|
785 |
+it under the terms of the GNU Lesser General Public License as published by |
|
786 |
+the Free Software Foundation, either version 3 of the License, or |
|
787 |
+(at your option) any later version. |
|
788 |
+ |
|
789 |
+»bacterio-plankton:shape« is distributed in the hope that it will be useful, |
|
790 |
+but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
791 |
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
792 |
+GNU Lesser General Public License for more details. |
|
793 |
+ |
|
794 |
+You should have received a copy of the GNU Lesser General Public License |
|
795 |
+along with »bacterio-plankton:shape«. If not, see <http://www.gnu.org/licenses/>. |
|
796 |
+ */ |
|
797 |
+var lib_shape; |
|
798 |
+(function (lib_shape) { |
|
799 |
+ /** |
|
800 |
+ * @author fenris |
|
801 |
+ */ |
|
802 |
+ function float_make({ "soft": soft = false, "mutable": mutable = true, "defaultvalue": defaultvalue = undefined, }) { |
|
803 |
+ if (defaultvalue === undefined) { |
|
804 |
+ defaultvalue = (soft ? null : 0.0); |
|
805 |
+ } |
|
806 |
+ return { |
|
807 |
+ "soft": soft, |
|
808 |
+ "mutable": mutable, |
|
809 |
+ "defaultvalue": defaultvalue, |
|
810 |
+ }; |
|
811 |
+ } |
|
812 |
+ /** |
|
813 |
+ * @author fenris |
|
814 |
+ */ |
|
815 |
+ function float_inspect(parameters, value, _inspect) { |
|
816 |
+ let inspection = lib_shape.inspection_create(); |
|
817 |
+ if (value == undefined) { |
|
818 |
+ if (parameters.soft) { |
|
819 |
+ // all good |
|
820 |
+ } |
|
821 |
+ else { |
|
822 |
+ lib_shape.inspection_add(inspection, "null is not allowed"); |
|
823 |
+ } |
|
824 |
+ } |
|
825 |
+ else { |
|
826 |
+ let jstype_actual = typeof (value); |
|
827 |
+ let jstype_expected = "number"; |
|
828 |
+ if (jstype_actual === jstype_expected) { |
|
829 |
+ if (!isNaN(parseFloat(value))) { |
|
830 |
+ // all good |
|
831 |
+ } |
|
832 |
+ else { |
|
833 |
+ lib_shape.inspection_add(inspection, `value is not parsable into a valid float`); |
|
834 |
+ } |
|
835 |
+ } |
|
836 |
+ else { |
|
837 |
+ lib_shape.inspection_add(inspection, `expected JS-type '${jstype_expected}' but got '${jstype_actual}'`); |
|
838 |
+ } |
|
839 |
+ } |
|
840 |
+ return inspection; |
|
841 |
+ } |
|
842 |
+ /** |
|
843 |
+ * @author fenris |
|
844 |
+ */ |
|
845 |
+ function float_stance(parameters, bindings, _stance) { |
|
846 |
+ return { |
|
847 |
+ "name": "float", |
|
848 |
+ "parameters": parameters |
|
849 |
+ }; |
|
850 |
+ } |
|
851 |
+ /** |
|
852 |
+ * @author fenris |
|
853 |
+ */ |
|
854 |
+ function float_show(parameters, _show) { |
|
855 |
+ let str; |
|
856 |
+ // core |
|
857 |
+ { |
|
858 |
+ str = "float"; |
|
859 |
+ } |
|
860 |
+ // soft |
|
861 |
+ { |
|
862 |
+ if (parameters.soft) { |
|
863 |
+ str = `~${str}`; |
|
864 |
+ } |
|
865 |
+ } |
|
866 |
+ return str; |
|
867 |
+ } |
|
868 |
+ /** |
|
869 |
+ * @author fenris |
|
870 |
+ */ |
|
871 |
+ lib_shape.register({ |
|
872 |
+ "name": "float", |
|
873 |
+ "make": float_make, |
|
874 |
+ "inspect": float_inspect, |
|
875 |
+ "stance": float_stance, |
|
876 |
+ "show": float_show, |
|
877 |
+ }); |
|
878 |
+})(lib_shape || (lib_shape = {})); |
|
879 |
+/* |
|
880 |
+This file is part of »bacterio-plankton:shape«. |
|
881 |
+ |
|
882 |
+Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
883 |
+<info@greenscale.de> |
|
884 |
+ |
|
885 |
+»bacterio-plankton:shape« is free software: you can redistribute it and/or modify |
|
886 |
+it under the terms of the GNU Lesser General Public License as published by |
|
887 |
+the Free Software Foundation, either version 3 of the License, or |
|
888 |
+(at your option) any later version. |
|
889 |
+ |
|
890 |
+»bacterio-plankton:shape« is distributed in the hope that it will be useful, |
|
891 |
+but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
892 |
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
893 |
+GNU Lesser General Public License for more details. |
|
894 |
+ |
|
895 |
+You should have received a copy of the GNU Lesser General Public License |
|
896 |
+along with »bacterio-plankton:shape«. If not, see <http://www.gnu.org/licenses/>. |
|
897 |
+ */ |
|
898 |
+var lib_shape; |
|
899 |
+(function (lib_shape) { |
|
900 |
+ /** |
|
901 |
+ * @author fenris |
|
902 |
+ */ |
|
903 |
+ function string_make({ "soft": soft = false, "mutable": mutable = true, "defaultvalue": defaultvalue = undefined, "long": long = false, }) { |
|
904 |
+ if (defaultvalue === undefined) { |
|
905 |
+ defaultvalue = (soft ? null : ""); |
|
906 |
+ } |
|
907 |
+ return { |
|
908 |
+ "soft": soft, |
|
909 |
+ "mutable": mutable, |
|
910 |
+ "defaultvalue": defaultvalue, |
|
911 |
+ "long": long, |
|
912 |
+ }; |
|
913 |
+ } |
|
914 |
+ /** |
|
915 |
+ * @author fenris |
|
916 |
+ */ |
|
917 |
+ function string_inspect(parameters, value, _inspect) { |
|
918 |
+ let inspection = lib_shape.inspection_create(); |
|
919 |
+ if (value == undefined) { |
|
920 |
+ if (parameters.soft) { |
|
921 |
+ // all good |
|
922 |
+ } |
|
923 |
+ else { |
|
924 |
+ lib_shape.inspection_add(inspection, "null is not allowed"); |
|
925 |
+ } |
|
926 |
+ } |
|
927 |
+ else { |
|
928 |
+ let jstype_actual = typeof (value); |
|
929 |
+ let jstype_expected = "string"; |
|
930 |
+ if (jstype_actual === jstype_expected) { |
|
931 |
+ // all good |
|
932 |
+ } |
|
933 |
+ else { |
|
934 |
+ lib_shape.inspection_add(inspection, `expected JS-type '${jstype_expected}' but got '${jstype_actual}'`); |
|
935 |
+ } |
|
936 |
+ } |
|
937 |
+ return inspection; |
|
938 |
+ } |
|
939 |
+ /** |
|
940 |
+ * @author fenris |
|
941 |
+ */ |
|
942 |
+ function string_stance(parameters, bindings, _stance) { |
|
943 |
+ return { |
|
944 |
+ "name": "string", |
|
945 |
+ "parameters": parameters |
|
946 |
+ }; |
|
947 |
+ } |
|
948 |
+ /** |
|
949 |
+ * @author fenris |
|
950 |
+ */ |
|
951 |
+ function string_show(parameters, _show) { |
|
952 |
+ let str; |
|
953 |
+ // core |
|
954 |
+ { |
|
955 |
+ str = "string"; |
|
956 |
+ } |
|
957 |
+ // soft |
|
958 |
+ { |
|
959 |
+ if (parameters.soft) { |
|
960 |
+ str = `~${str}`; |
|
961 |
+ } |
|
962 |
+ } |
|
963 |
+ return str; |
|
964 |
+ } |
|
965 |
+ /** |
|
966 |
+ * @author fenris |
|
967 |
+ */ |
|
968 |
+ lib_shape.register({ |
|
969 |
+ "name": "string", |
|
970 |
+ "make": string_make, |
|
971 |
+ "inspect": string_inspect, |
|
972 |
+ "stance": string_stance, |
|
973 |
+ "show": string_show, |
|
974 |
+ }); |
|
975 |
+})(lib_shape || (lib_shape = {})); |
|
976 |
+/* |
|
977 |
+This file is part of »bacterio-plankton:shape«. |
|
978 |
+ |
|
979 |
+Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
980 |
+<info@greenscale.de> |
|
981 |
+ |
|
982 |
+»bacterio-plankton:shape« is free software: you can redistribute it and/or modify |
|
983 |
+it under the terms of the GNU Lesser General Public License as published by |
|
984 |
+the Free Software Foundation, either version 3 of the License, or |
|
985 |
+(at your option) any later version. |
|
986 |
+ |
|
987 |
+»bacterio-plankton:shape« is distributed in the hope that it will be useful, |
|
988 |
+but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
989 |
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
990 |
+GNU Lesser General Public License for more details. |
|
991 |
+ |
|
992 |
+You should have received a copy of the GNU Lesser General Public License |
|
993 |
+along with »bacterio-plankton:shape«. If not, see <http://www.gnu.org/licenses/>. |
|
994 |
+ */ |
|
995 |
+var lib_shape; |
|
996 |
+(function (lib_shape) { |
|
997 |
+ /** |
|
998 |
+ * @author fenris |
|
999 |
+ */ |
|
1000 |
+ function email_make({ "soft": soft = false, "mutable": mutable = true, "defaultvalue": defaultvalue = undefined, }) { |
|
1001 |
+ if (defaultvalue === undefined) { |
|
1002 |
+ defaultvalue = (soft ? null : ""); |
|
1003 |
+ } |
|
1004 |
+ return { |
|
1005 |
+ "soft": soft, |
|
1006 |
+ "mutable": mutable, |
|
1007 |
+ "defaultvalue": defaultvalue, |
|
1008 |
+ }; |
|
1009 |
+ } |
|
1010 |
+ /** |
|
1011 |
+ * @author fenris |
|
1012 |
+ */ |
|
1013 |
+ function email_inspect(parameters, value, _inspect) { |
|
1014 |
+ let inspection = lib_shape.inspection_create(); |
|
1015 |
+ if (value == undefined) { |
|
1016 |
+ if (parameters.soft) { |
|
1017 |
+ // all good |
|
1018 |
+ } |
|
1019 |
+ else { |
|
1020 |
+ lib_shape.inspection_add(inspection, "null is not allowed"); |
|
1021 |
+ } |
|
1022 |
+ } |
|
1023 |
+ else { |
|
1024 |
+ let jstype_actual = typeof (value); |
|
1025 |
+ let jstype_expected = "string"; |
|
1026 |
+ if (jstype_actual === jstype_expected) { |
|
1027 |
+ // all good |
|
1028 |
+ } |
|
1029 |
+ else { |
|
1030 |
+ lib_shape.inspection_add(inspection, `expected JS-type '${jstype_expected}' but got '${jstype_actual}'`); |
|
1031 |
+ } |
|
1032 |
+ } |
|
1033 |
+ return inspection; |
|
1034 |
+ } |
|
1035 |
+ /** |
|
1036 |
+ * @author fenris |
|
1037 |
+ */ |
|
1038 |
+ function email_stance(parameters, bindings, _stance) { |
|
1039 |
+ return { |
|
1040 |
+ "name": "email", |
|
1041 |
+ "parameters": parameters |
|
1042 |
+ }; |
|
1043 |
+ } |
|
1044 |
+ /** |
|
1045 |
+ * @author fenris |
|
1046 |
+ */ |
|
1047 |
+ function email_show(parameters, _show) { |
|
1048 |
+ let str; |
|
1049 |
+ // core |
|
1050 |
+ { |
|
1051 |
+ str = "email"; |
|
1052 |
+ } |
|
1053 |
+ // soft |
|
1054 |
+ { |
|
1055 |
+ if (parameters.soft) { |
|
1056 |
+ str = `~${str}`; |
|
1057 |
+ } |
|
1058 |
+ } |
|
1059 |
+ return str; |
|
1060 |
+ } |
|
1061 |
+ /** |
|
1062 |
+ * @author fenris |
|
1063 |
+ */ |
|
1064 |
+ lib_shape.register({ |
|
1065 |
+ "name": "email", |
|
1066 |
+ "make": email_make, |
|
1067 |
+ "inspect": email_inspect, |
|
1068 |
+ "stance": email_stance, |
|
1069 |
+ "show": email_show, |
|
1070 |
+ }); |
|
1071 |
+})(lib_shape || (lib_shape = {})); |
|
1072 |
+/* |
|
1073 |
+This file is part of »bacterio-plankton:shape«. |
|
1074 |
+ |
|
1075 |
+Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
1076 |
+<info@greenscale.de> |
|
1077 |
+ |
|
1078 |
+»bacterio-plankton:shape« is free software: you can redistribute it and/or modify |
|
1079 |
+it under the terms of the GNU Lesser General Public License as published by |
|
1080 |
+the Free Software Foundation, either version 3 of the License, or |
|
1081 |
+(at your option) any later version. |
|
1082 |
+ |
|
1083 |
+»bacterio-plankton:shape« is distributed in the hope that it will be useful, |
|
1084 |
+but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
1085 |
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
1086 |
+GNU Lesser General Public License for more details. |
|
1087 |
+ |
|
1088 |
+You should have received a copy of the GNU Lesser General Public License |
|
1089 |
+along with »bacterio-plankton:shape«. If not, see <http://www.gnu.org/licenses/>. |
|
1090 |
+ */ |
|
1091 |
+var lib_shape; |
|
1092 |
+(function (lib_shape) { |
|
1093 |
+ /** |
|
1094 |
+ * @author fenris |
|
1095 |
+ */ |
|
1096 |
+ function url_make({ "soft": soft = false, "mutable": mutable = true, "defaultvalue": defaultvalue = undefined, "type": type = "link", }) { |
|
1097 |
+ if (defaultvalue === undefined) { |
|
1098 |
+ defaultvalue = (soft ? null : ""); |
|
1099 |
+ } |
|
1100 |
+ return { |
|
1101 |
+ "soft": soft, |
|
1102 |
+ "mutable": mutable, |
|
1103 |
+ "defaultvalue": defaultvalue, |
|
1104 |
+ "type": type, |
|
1105 |
+ }; |
|
1106 |
+ } |
|
1107 |
+ /** |
|
1108 |
+ * @author fenris |
|
1109 |
+ */ |
|
1110 |
+ function url_inspect(parameters, value, _inspect) { |
|
1111 |
+ let inspection = lib_shape.inspection_create(); |
|
1112 |
+ if (value == undefined) { |
|
1113 |
+ if (parameters.soft) { |
|
1114 |
+ // all good |
|
1115 |
+ } |
|
1116 |
+ else { |
|
1117 |
+ lib_shape.inspection_add(inspection, "null is not allowed"); |
|
1118 |
+ } |
|
1119 |
+ } |
|
1120 |
+ else { |
|
1121 |
+ let jstype_actual = typeof (value); |
|
1122 |
+ let jstype_expected = "string"; |
|
1123 |
+ if (jstype_actual === jstype_expected) { |
|
1124 |
+ // all good |
|
1125 |
+ } |
|
1126 |
+ else { |
|
1127 |
+ lib_shape.inspection_add(inspection, `expected JS-type '${jstype_expected}' but got '${jstype_actual}'`); |
|
1128 |
+ } |
|
1129 |
+ } |
|
1130 |
+ return inspection; |
|
1131 |
+ } |
|
1132 |
+ /** |
|
1133 |
+ * @author fenris |
|
1134 |
+ */ |
|
1135 |
+ function url_stance(parameters, bindings, _stance) { |
|
1136 |
+ return { |
|
1137 |
+ "name": "url", |
|
1138 |
+ "parameters": parameters |
|
1139 |
+ }; |
|
1140 |
+ } |
|
1141 |
+ /** |
|
1142 |
+ * @author fenris |
|
1143 |
+ */ |
|
1144 |
+ function url_show(parameters, _show) { |
|
1145 |
+ let str; |
|
1146 |
+ // core |
|
1147 |
+ { |
|
1148 |
+ str = "url"; |
|
1149 |
+ } |
|
1150 |
+ // soft |
|
1151 |
+ { |
|
1152 |
+ if (parameters.soft) { |
|
1153 |
+ str = `~${str}`; |
|
1154 |
+ } |
|
1155 |
+ } |
|
1156 |
+ return str; |
|
1157 |
+ } |
|
1158 |
+ /** |
|
1159 |
+ * @author fenris |
|
1160 |
+ */ |
|
1161 |
+ lib_shape.register({ |
|
1162 |
+ "name": "url", |
|
1163 |
+ "make": url_make, |
|
1164 |
+ "inspect": url_inspect, |
|
1165 |
+ "stance": url_stance, |
|
1166 |
+ "show": url_show, |
|
1167 |
+ }); |
|
1168 |
+})(lib_shape || (lib_shape = {})); |
|
1169 |
+/* |
|
1170 |
+This file is part of »bacterio-plankton:shape«. |
|
1171 |
+ |
|
1172 |
+Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
1173 |
+<info@greenscale.de> |
|
1174 |
+ |
|
1175 |
+»bacterio-plankton:shape« is free software: you can redistribute it and/or modify |
|
1176 |
+it under the terms of the GNU Lesser General Public License as published by |
|
1177 |
+the Free Software Foundation, either version 3 of the License, or |
|
1178 |
+(at your option) any later version. |
|
1179 |
+ |
|
1180 |
+»bacterio-plankton:shape« is distributed in the hope that it will be useful, |
|
1181 |
+but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
1182 |
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
1183 |
+GNU Lesser General Public License for more details. |
|
1184 |
+ |
|
1185 |
+You should have received a copy of the GNU Lesser General Public License |
|
1186 |
+along with »bacterio-plankton:shape«. If not, see <http://www.gnu.org/licenses/>. |
|
1187 |
+ */ |
|
1188 |
+var lib_shape; |
|
1189 |
+(function (lib_shape) { |
|
1190 |
+ /** |
|
1191 |
+ * @author fenris |
|
1192 |
+ */ |
|
1193 |
+ function markdown_make({ "soft": soft = false, "mutable": mutable = true, "defaultvalue": defaultvalue = undefined, "type": type = "link", }) { |
|
1194 |
+ if (defaultvalue === undefined) { |
|
1195 |
+ defaultvalue = (soft ? null : ""); |
|
1196 |
+ } |
|
1197 |
+ return { |
|
1198 |
+ "soft": soft, |
|
1199 |
+ "mutable": mutable, |
|
1200 |
+ "defaultvalue": defaultvalue, |
|
1201 |
+ "type": type, |
|
1202 |
+ }; |
|
1203 |
+ } |
|
1204 |
+ /** |
|
1205 |
+ * @author fenris |
|
1206 |
+ */ |
|
1207 |
+ function markdown_inspect(parameters, value, _inspect) { |
|
1208 |
+ let inspection = lib_shape.inspection_create(); |
|
1209 |
+ if (value == undefined) { |
|
1210 |
+ if (parameters.soft) { |
|
1211 |
+ // all good |
|
1212 |
+ } |
|
1213 |
+ else { |
|
1214 |
+ lib_shape.inspection_add(inspection, "null is not allowed"); |
|
1215 |
+ } |
|
1216 |
+ } |
|
1217 |
+ else { |
|
1218 |
+ let jstype_actual = typeof (value); |
|
1219 |
+ let jstype_expected = "string"; |
|
1220 |
+ if (jstype_actual === jstype_expected) { |
|
1221 |
+ // all good |
|
1222 |
+ } |
|
1223 |
+ else { |
|
1224 |
+ lib_shape.inspection_add(inspection, `expected JS-type '${jstype_expected}' but got '${jstype_actual}'`); |
|
1225 |
+ } |
|
1226 |
+ } |
|
1227 |
+ return inspection; |
|
1228 |
+ } |
|
1229 |
+ /** |
|
1230 |
+ * @author fenris |
|
1231 |
+ */ |
|
1232 |
+ function markdown_stance(parameters, bindings, _stance) { |
|
1233 |
+ return { |
|
1234 |
+ "name": "markdown", |
|
1235 |
+ "parameters": parameters |
|
1236 |
+ }; |
|
1237 |
+ } |
|
1238 |
+ /** |
|
1239 |
+ * @author fenris |
|
1240 |
+ */ |
|
1241 |
+ function markdown_show(parameters, _show) { |
|
1242 |
+ let str; |
|
1243 |
+ // core |
|
1244 |
+ { |
|
1245 |
+ str = "markdown"; |
|
1246 |
+ } |
|
1247 |
+ // soft |
|
1248 |
+ { |
|
1249 |
+ if (parameters.soft) { |
|
1250 |
+ str = `~${str}`; |
|
1251 |
+ } |
|
1252 |
+ } |
|
1253 |
+ return str; |
|
1254 |
+ } |
|
1255 |
+ /** |
|
1256 |
+ * @author fenris |
|
1257 |
+ */ |
|
1258 |
+ lib_shape.register({ |
|
1259 |
+ "name": "markdown", |
|
1260 |
+ "make": markdown_make, |
|
1261 |
+ "inspect": markdown_inspect, |
|
1262 |
+ "stance": markdown_stance, |
|
1263 |
+ "show": markdown_show, |
|
1264 |
+ }); |
|
1265 |
+})(lib_shape || (lib_shape = {})); |
|
1266 |
+/* |
|
1267 |
+This file is part of »bacterio-plankton:shape«. |
|
1268 |
+ |
|
1269 |
+Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
1270 |
+<info@greenscale.de> |
|
1271 |
+ |
|
1272 |
+»bacterio-plankton:shape« is free software: you can redistribute it and/or modify |
|
1273 |
+it under the terms of the GNU Lesser General Public License as published by |
|
1274 |
+the Free Software Foundation, either version 3 of the License, or |
|
1275 |
+(at your option) any later version. |
|
1276 |
+ |
|
1277 |
+»bacterio-plankton:shape« is distributed in the hope that it will be useful, |
|
1278 |
+but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
1279 |
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
1280 |
+GNU Lesser General Public License for more details. |
|
1281 |
+ |
|
1282 |
+You should have received a copy of the GNU Lesser General Public License |
|
1283 |
+along with »bacterio-plankton:shape«. If not, see <http://www.gnu.org/licenses/>. |
|
1284 |
+ */ |
|
1285 |
+var lib_shape; |
|
1286 |
+(function (lib_shape) { |
|
1287 |
+ /** |
|
1288 |
+ * @author fenris |
|
1289 |
+ */ |
|
1290 |
+ function time_make({ "soft": soft = false, "mutable": mutable = true, "defaultvalue": defaultvalue = undefined, }) { |
|
1291 |
+ if (defaultvalue === undefined) { |
|
1292 |
+ defaultvalue = (soft ? null : ""); |
|
1293 |
+ } |
|
1294 |
+ return { |
|
1295 |
+ "soft": soft, |
|
1296 |
+ "mutable": mutable, |
|
1297 |
+ "defaultvalue": defaultvalue, |
|
1298 |
+ }; |
|
1299 |
+ } |
|
1300 |
+ /** |
|
1301 |
+ * @author fenris |
|
1302 |
+ */ |
|
1303 |
+ function time_inspect(parameters, value, _inspect) { |
|
1304 |
+ let inspection = lib_shape.inspection_create(); |
|
1305 |
+ if (value == undefined) { |
|
1306 |
+ if (parameters.soft) { |
|
1307 |
+ // all good |
|
1308 |
+ } |
|
1309 |
+ else { |
|
1310 |
+ lib_shape.inspection_add(inspection, "null is not allowed"); |
|
1311 |
+ } |
|
1312 |
+ } |
|
1313 |
+ else { |
|
1314 |
+ let jstype_actual = typeof (value); |
|
1315 |
+ let jstype_expected = "object"; |
|
1316 |
+ if (jstype_actual === jstype_expected) { |
|
1317 |
+ // all good? |
|
1318 |
+ } |
|
1319 |
+ else { |
|
1320 |
+ lib_shape.inspection_add(inspection, `expected JS-type '${jstype_expected}' but got '${jstype_actual}'`); |
|
1321 |
+ } |
|
1322 |
+ } |
|
1323 |
+ return inspection; |
|
1324 |
+ } |
|
1325 |
+ /** |
|
1326 |
+ * @author fenris |
|
1327 |
+ */ |
|
1328 |
+ function time_stance(parameters, bindings, _stance) { |
|
1329 |
+ return { |
|
1330 |
+ "name": "time", |
|
1331 |
+ "parameters": parameters |
|
1332 |
+ }; |
|
1333 |
+ } |
|
1334 |
+ /** |
|
1335 |
+ * @author fenris |
|
1336 |
+ */ |
|
1337 |
+ function time_show(parameters, _show) { |
|
1338 |
+ let str; |
|
1339 |
+ // core |
|
1340 |
+ { |
|
1341 |
+ str = "time"; |
|
1342 |
+ } |
|
1343 |
+ // soft |
|
1344 |
+ { |
|
1345 |
+ if (parameters.soft) { |
|
1346 |
+ str = `~${str}`; |
|
1347 |
+ } |
|
1348 |
+ } |
|
1349 |
+ return str; |
|
1350 |
+ } |
|
1351 |
+ /** |
|
1352 |
+ * @author fenris |
|
1353 |
+ */ |
|
1354 |
+ lib_shape.register({ |
|
1355 |
+ "name": "time", |
|
1356 |
+ "make": time_make, |
|
1357 |
+ "inspect": time_inspect, |
|
1358 |
+ "stance": time_stance, |
|
1359 |
+ "show": time_show, |
|
1360 |
+ }); |
|
1361 |
+})(lib_shape || (lib_shape = {})); |
|
1362 |
+/* |
|
1363 |
+This file is part of »bacterio-plankton:shape«. |
|
1364 |
+ |
|
1365 |
+Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
1366 |
+<info@greenscale.de> |
|
1367 |
+ |
|
1368 |
+»bacterio-plankton:shape« is free software: you can redistribute it and/or modify |
|
1369 |
+it under the terms of the GNU Lesser General Public License as published by |
|
1370 |
+the Free Software Foundation, either version 3 of the License, or |
|
1371 |
+(at your option) any later version. |
|
1372 |
+ |
|
1373 |
+»bacterio-plankton:shape« is distributed in the hope that it will be useful, |
|
1374 |
+but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
1375 |
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
1376 |
+GNU Lesser General Public License for more details. |
|
1377 |
+ |
|
1378 |
+You should have received a copy of the GNU Lesser General Public License |
|
1379 |
+along with »bacterio-plankton:shape«. If not, see <http://www.gnu.org/licenses/>. |
|
1380 |
+ */ |
|
1381 |
+var lib_shape; |
|
1382 |
+(function (lib_shape) { |
|
1383 |
+ /** |
|
1384 |
+ * @author fenris |
|
1385 |
+ */ |
|
1386 |
+ function array_make({ "soft": soft = false, "mutable": mutable = true, "shape_element": shape_element, "defaultvalue": defaultvalue = undefined, }, _make) { |
|
1387 |
+ if (shape_element === undefined) { |
|
1388 |
+ let message = `mandatory parameter 'shape_element' missing`; |
|
1389 |
+ throw (new Error(message)); |
|
1390 |
+ } |
|
1391 |
+ if (defaultvalue === undefined) { |
|
1392 |
+ defaultvalue = (soft ? null : []); |
|
1393 |
+ } |
|
1394 |
+ return { |
|
1395 |
+ "soft": soft, |
|
1396 |
+ "mutable": mutable, |
|
1397 |
+ "shape_element": _make(shape_element), |
|
1398 |
+ "defaultvalue": defaultvalue, |
|
1399 |
+ }; |
|
1400 |
+ } |
|
1401 |
+ /** |
|
1402 |
+ * @author fenris |
|
1403 |
+ */ |
|
1404 |
+ function array_inspect(parameters, value, _inspect) { |
|
1405 |
+ let inspection = lib_shape.inspection_create(); |
|
1406 |
+ if (value == undefined) { |
|
1407 |
+ if (parameters.soft) { |
|
1408 |
+ // all good |
|
1409 |
+ } |
|
1410 |
+ else { |
|
1411 |
+ lib_shape.inspection_add(inspection, "null is not allowed"); |
|
1412 |
+ } |
|
1413 |
+ } |
|
1414 |
+ else { |
|
1415 |
+ let jstype_actual = typeof (value); |
|
1416 |
+ let jstype_expected = "object"; |
|
1417 |
+ if (jstype_actual === jstype_expected) { |
|
1418 |
+ if (value instanceof Array) { |
|
1419 |
+ value.forEach((element, index) => { |
|
1420 |
+ lib_shape.inspection_extend(inspection, `element #${index.toFixed(0)}`, _inspect(parameters.shape_element, element)); |
|
1421 |
+ }); |
|
1422 |
+ } |
|
1423 |
+ else { |
|
1424 |
+ lib_shape.inspection_add(inspection, `value does not seem to be an array-instance`); |
|
1425 |
+ } |
|
1426 |
+ } |
|
1427 |
+ else { |
|
1428 |
+ lib_shape.inspection_add(inspection, `expected JS-type '${jstype_expected}' but got '${jstype_actual}'`); |
|
1429 |
+ } |
|
1430 |
+ } |
|
1431 |
+ return inspection; |
|
1432 |
+ } |
|
1433 |
+ /** |
|
1434 |
+ * @author fenris |
|
1435 |
+ */ |
|
1436 |
+ function array_stance(parameters, bindings, _stance) { |
|
1437 |
+ return { |
|
1438 |
+ "name": "array", |
|
1439 |
+ "parameters": { |
|
1440 |
+ "soft": parameters.soft, |
|
1441 |
+ "shape_element": _stance(parameters.shape_element, bindings) |
|
1442 |
+ } |
|
1443 |
+ }; |
|
1444 |
+ } |
|
1445 |
+ /** |
|
1446 |
+ * @author fenris |
|
1447 |
+ */ |
|
1448 |
+ function array_show(parameters, _show) { |
|
1449 |
+ let str; |
|
1450 |
+ // core |
|
1451 |
+ { |
|
1452 |
+ str = "array"; |
|
1453 |
+ } |
|
1454 |
+ // shape_element |
|
1455 |
+ { |
|
1456 |
+ str += ("<" |
|
1457 |
+ + |
|
1458 |
+ _show(parameters.shape_element) |
|
1459 |
+ + |
|
1460 |
+ ">"); |
|
1461 |
+ } |
|
1462 |
+ // soft |
|
1463 |
+ { |
|
1464 |
+ if (parameters.soft) { |
|
1465 |
+ str = `~${str}`; |
|
1466 |
+ } |
|
1467 |
+ } |
|
1468 |
+ return str; |
|
1469 |
+ } |
|
1470 |
+ /** |
|
1471 |
+ * @author fenris |
|
1472 |
+ */ |
|
1473 |
+ lib_shape.register({ |
|
1474 |
+ "name": "array", |
|
1475 |
+ "make": array_make, |
|
1476 |
+ "inspect": array_inspect, |
|
1477 |
+ "stance": array_stance, |
|
1478 |
+ "show": array_show, |
|
1479 |
+ }); |
|
1480 |
+})(lib_shape || (lib_shape = {})); |
|
1481 |
+/* |
|
1482 |
+This file is part of »bacterio-plankton:shape«. |
|
1483 |
+ |
|
1484 |
+Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
1485 |
+<info@greenscale.de> |
|
1486 |
+ |
|
1487 |
+»bacterio-plankton:shape« is free software: you can redistribute it and/or modify |
|
1488 |
+it under the terms of the GNU Lesser General Public License as published by |
|
1489 |
+the Free Software Foundation, either version 3 of the License, or |
|
1490 |
+(at your option) any later version. |
|
1491 |
+ |
|
1492 |
+»bacterio-plankton:shape« is distributed in the hope that it will be useful, |
|
1493 |
+but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
1494 |
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
1495 |
+GNU Lesser General Public License for more details. |
|
1496 |
+ |
|
1497 |
+You should have received a copy of the GNU Lesser General Public License |
|
1498 |
+along with »bacterio-plankton:shape«. If not, see <http://www.gnu.org/licenses/>. |
|
1499 |
+ */ |
|
1500 |
+var lib_shape; |
|
1501 |
+(function (lib_shape) { |
|
1502 |
+ /** |
|
1503 |
+ * @author fenris |
|
1504 |
+ */ |
|
1505 |
+ function enumeration_make({ "soft": soft = false, "mutable": mutable = true, "shape_option": shape_option, "options": options, "defaultvalue": defaultvalue = undefined, }, _make) { |
|
1506 |
+ if (shape_option === undefined) { |
|
1507 |
+ let message = `mandatory parameter 'shape_option' missing`; |
|
1508 |
+ throw (new Error(message)); |
|
1509 |
+ } |
|
1510 |
+ if (options === undefined) { |
|
1511 |
+ let message = `mandatory parameter 'options' missing`; |
|
1512 |
+ throw (new Error(message)); |
|
1513 |
+ } |
|
1514 |
+ if (defaultvalue === undefined) { |
|
1515 |
+ defaultvalue = (soft ? null : options[0].value); |
|
1516 |
+ } |
|
1517 |
+ return { |
|
1518 |
+ "soft": soft, |
|
1519 |
+ "mutable": mutable, |
|
1520 |
+ "shape_option": _make(shape_option), |
|
1521 |
+ "options": options, |
|
1522 |
+ "defaultvalue": defaultvalue, |
|
1523 |
+ }; |
|
1524 |
+ } |
|
1525 |
+ /** |
|
1526 |
+ * @author fenris |
|
1527 |
+ */ |
|
1528 |
+ function enumeration_inspect(parameters, value, _inspect) { |
|
1529 |
+ let inspection = lib_shape.inspection_create(); |
|
1530 |
+ if (value == undefined) { |
|
1531 |
+ if (parameters.soft) { |
|
1532 |
+ // all good |
|
1533 |
+ } |
|
1534 |
+ else { |
|
1535 |
+ lib_shape.inspection_add(inspection, "null is not allowed"); |
|
1536 |
+ } |
|
1537 |
+ } |
|
1538 |
+ else { |
|
1539 |
+ lib_shape.inspection_extend(inspection, `given value for enumeration`, _inspect(parameters.shape_option, value)); |
|
1540 |
+ // TODO: check if corresponding option exists |
|
1541 |
+ } |
|
1542 |
+ return inspection; |
|
1543 |
+ } |
|
1544 |
+ /** |
|
1545 |
+ * @author fenris |
|
1546 |
+ */ |
|
1547 |
+ function enumeration_stance(parameters, bindings, _stance) { |
|
1548 |
+ return { |
|
1549 |
+ "name": "enumeration", |
|
1550 |
+ "parameters": { |
|
1551 |
+ "soft": parameters.soft, |
|
1552 |
+ "shape_option": _stance(parameters.shape_option, bindings), |
|
1553 |
+ "options": parameters.options, |
|
1554 |
+ } |
|
1555 |
+ }; |
|
1556 |
+ } |
|
1557 |
+ /** |
|
1558 |
+ * @author fenris |
|
1559 |
+ */ |
|
1560 |
+ function enumeration_show(parameters, _show) { |
|
1561 |
+ let str; |
|
1562 |
+ // core |
|
1563 |
+ { |
|
1564 |
+ str = "enumeration"; |
|
1565 |
+ } |
|
1566 |
+ // shape_option |
|
1567 |
+ { |
|
1568 |
+ str += ("<" |
|
1569 |
+ + |
|
1570 |
+ parameters.options.map(option => String(option)).join(",") + ":" + _show(parameters.shape_option) |
|
1571 |
+ + |
|
1572 |
+ ">"); |
|
1573 |
+ } |
|
1574 |
+ // soft |
|
1575 |
+ { |
|
1576 |
+ if (parameters.soft) { |
|
1577 |
+ str = `~${str}`; |
|
1578 |
+ } |
|
1579 |
+ } |
|
1580 |
+ return str; |
|
1581 |
+ } |
|
1582 |
+ /** |
|
1583 |
+ * @author fenris |
|
1584 |
+ */ |
|
1585 |
+ lib_shape.register({ |
|
1586 |
+ "name": "enumeration", |
|
1587 |
+ "make": enumeration_make, |
|
1588 |
+ "inspect": enumeration_inspect, |
|
1589 |
+ "stance": enumeration_stance, |
|
1590 |
+ "show": enumeration_show, |
|
1591 |
+ }); |
|
1592 |
+})(lib_shape || (lib_shape = {})); |
|
1593 |
+/* |
|
1594 |
+This file is part of »bacterio-plankton:shape«. |
|
1595 |
+ |
|
1596 |
+Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
1597 |
+<info@greenscale.de> |
|
1598 |
+ |
|
1599 |
+»bacterio-plankton:shape« is free software: you can redistribute it and/or modify |
|
1600 |
+it under the terms of the GNU Lesser General Public License as published by |
|
1601 |
+the Free Software Foundation, either version 3 of the License, or |
|
1602 |
+(at your option) any later version. |
|
1603 |
+ |
|
1604 |
+»bacterio-plankton:shape« is distributed in the hope that it will be useful, |
|
1605 |
+but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
1606 |
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
1607 |
+GNU Lesser General Public License for more details. |
|
1608 |
+ |
|
1609 |
+You should have received a copy of the GNU Lesser General Public License |
|
1610 |
+along with »bacterio-plankton:shape«. If not, see <http://www.gnu.org/licenses/>. |
|
1611 |
+ */ |
|
1612 |
+var lib_shape; |
|
1613 |
+(function (lib_shape) { |
|
1614 |
+ /** |
|
1615 |
+ * @author fenris |
|
1616 |
+ */ |
|
1617 |
+ function date_make({ "soft": soft = false, "mutable": mutable = true, "defaultvalue": defaultvalue = undefined, }) { |
|
1618 |
+ if (defaultvalue === undefined) { |
|
1619 |
+ defaultvalue = (soft ? null : (new Date(Date.now()))); |
|
1620 |
+ } |
|
1621 |
+ return { |
|
1622 |
+ "soft": soft, |
|
1623 |
+ "mutable": mutable, |
|
1624 |
+ "defaultvalue": defaultvalue, |
|
1625 |
+ }; |
|
1626 |
+ } |
|
1627 |
+ /** |
|
1628 |
+ * @author fenris |
|
1629 |
+ */ |
|
1630 |
+ function date_inspect(parameters, value, _inspect) { |
|
1631 |
+ let inspection = lib_shape.inspection_create(); |
|
1632 |
+ if (value == undefined) { |
|
1633 |
+ if (parameters.soft) { |
|
1634 |
+ // all good |
|
1635 |
+ } |
|
1636 |
+ else { |
|
1637 |
+ lib_shape.inspection_add(inspection, "null is not allowed"); |
|
1638 |
+ } |
|
1639 |
+ } |
|
1640 |
+ else { |
|
1641 |
+ let jstype_actual = typeof (value); |
|
1642 |
+ let jstype_expected = "object"; |
|
1643 |
+ if (jstype_actual === jstype_expected) { |
|
1644 |
+ if (value instanceof Date) { |
|
1645 |
+ // all gode |
|
1646 |
+ } |
|
1647 |
+ else { |
|
1648 |
+ lib_shape.inspection_add(inspection, `value does not seem to be a date-instance`); |
|
1649 |
+ } |
|
1650 |
+ } |
|
1651 |
+ else { |
|
1652 |
+ lib_shape.inspection_add(inspection, `expected JS-type '${jstype_expected}' but got '${jstype_actual}'`); |
|
1653 |
+ } |
|
1654 |
+ } |
|
1655 |
+ return inspection; |
|
1656 |
+ } |
|
1657 |
+ /** |
|
1658 |
+ * @author fenris |
|
1659 |
+ */ |
|
1660 |
+ function date_stance(parameters, bindings, _stance) { |
|
1661 |
+ return { |
|
1662 |
+ "name": "date", |
|
1663 |
+ "parameters": parameters |
|
1664 |
+ }; |
|
1665 |
+ } |
|
1666 |
+ /** |
|
1667 |
+ * @author fenris |
|
1668 |
+ */ |
|
1669 |
+ function date_show(parameters, _show) { |
|
1670 |
+ let str; |
|
1671 |
+ // core |
|
1672 |
+ { |
|
1673 |
+ str = "date"; |
|
1674 |
+ } |
|
1675 |
+ // soft |
|
1676 |
+ { |
|
1677 |
+ if (parameters.soft) { |
|
1678 |
+ str = `~${str}`; |
|
1679 |
+ } |
|
1680 |
+ } |
|
1681 |
+ return str; |
|
1682 |
+ } |
|
1683 |
+ /** |
|
1684 |
+ * @author fenris |
|
1685 |
+ */ |
|
1686 |
+ lib_shape.register({ |
|
1687 |
+ "name": "date", |
|
1688 |
+ "make": date_make, |
|
1689 |
+ "inspect": date_inspect, |
|
1690 |
+ "stance": date_stance, |
|
1691 |
+ "show": date_show, |
|
1692 |
+ }); |
|
1693 |
+})(lib_shape || (lib_shape = {})); |
|
1694 |
+/* |
|
1695 |
+This file is part of »bacterio-plankton:shape«. |
|
1696 |
+ |
|
1697 |
+Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
1698 |
+<info@greenscale.de> |
|
1699 |
+ |
|
1700 |
+»bacterio-plankton:shape« is free software: you can redistribute it and/or modify |
|
1701 |
+it under the terms of the GNU Lesser General Public License as published by |
|
1702 |
+the Free Software Foundation, either version 3 of the License, or |
|
1703 |
+(at your option) any later version. |
|
1704 |
+ |
|
1705 |
+»bacterio-plankton:shape« is distributed in the hope that it will be useful, |
|
1706 |
+but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
1707 |
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
1708 |
+GNU Lesser General Public License for more details. |
|
1709 |
+ |
|
1710 |
+You should have received a copy of the GNU Lesser General Public License |
|
1711 |
+along with »bacterio-plankton:shape«. If not, see <http://www.gnu.org/licenses/>. |
|
1712 |
+ */ |
|
1713 |
+var lib_shape; |
|
1714 |
+(function (lib_shape) { |
|
1715 |
+ /** |
|
1716 |
+ * @author fenris |
|
1717 |
+ */ |
|
1718 |
+ function record_make({ "soft": soft = false, "mutable": mutable = true, "fields": fields = [], "defaultvalue": defaultvalue = undefined, }, _make) { |
|
1719 |
+ let fields_ = (fields |
|
1720 |
+ .map((field) => ({ "name": field.name, "shape": _make(field.shape) }))); |
|
1721 |
+ if (defaultvalue === undefined) { |
|
1722 |
+ if (soft) { |
|
1723 |
+ defaultvalue = null; |
|
1724 |
+ } |
|
1725 |
+ else { |
|
1726 |
+ defaultvalue = {}; |
|
1727 |
+ fields_.forEach(field => { |
|
1728 |
+ defaultvalue[field.name] = field.shape.parameters["defaultvalue"]; |
|
1729 |
+ }); |
|
1730 |
+ } |
|
1731 |
+ } |
|
1732 |
+ return { |
|
1733 |
+ "soft": soft, |
|
1734 |
+ "mutable": mutable, |
|
1735 |
+ "fields": fields_, |
|
1736 |
+ "defaultvalue": defaultvalue, |
|
1737 |
+ }; |
|
1738 |
+ } |
|
1739 |
+ /** |
|
1740 |
+ * @author fenris |
|
1741 |
+ */ |
|
1742 |
+ function record_inspect(parameters, value, _inspect) { |
|
1743 |
+ let inspection = lib_shape.inspection_create(); |
|
1744 |
+ if (value == undefined) { |
|
1745 |
+ if (parameters.soft) { |
|
1746 |
+ // all good |
|
1747 |
+ } |
|
1748 |
+ else { |
|
1749 |
+ lib_shape.inspection_add(inspection, "null is not allowed"); |
|
1750 |
+ } |
|
1751 |
+ } |
|
1752 |
+ else { |
|
1753 |
+ let jstype_actual = typeof (value); |
|
1754 |
+ let jstype_expected = "object"; |
|
1755 |
+ if (jstype_actual === jstype_expected) { |
|
1756 |
+ parameters.fields.forEach(field => { |
|
1757 |
+ let value_ = value[field.name]; |
|
1758 |
+ lib_shape.inspection_extend(inspection, `field '${field.name}'`, _inspect(field.shape, value_)); |
|
1759 |
+ }); |
|
1760 |
+ } |
|
1761 |
+ else { |
|
1762 |
+ lib_shape.inspection_add(inspection, `expected JS-type '${jstype_expected}' but got '${jstype_actual}'`); |
|
1763 |
+ } |
|
1764 |
+ } |
|
1765 |
+ return inspection; |
|
1766 |
+ } |
|
1767 |
+ /** |
|
1768 |
+ * @author fenris |
|
1769 |
+ */ |
|
1770 |
+ function record_stance(parameters, bindings, _stance) { |
|
1771 |
+ return { |
|
1772 |
+ "name": "record", |
|
1773 |
+ "parameters": { |
|
1774 |
+ "soft": parameters.soft, |
|
1775 |
+ "fields": parameters.fields.map(field => { |
|
1776 |
+ return { |
|
1777 |
+ "name": field.name, |
|
1778 |
+ "shape": _stance(field.shape, bindings) |
|
1779 |
+ }; |
|
1780 |
+ }) |
|
1781 |
+ } |
|
1782 |
+ }; |
|
1783 |
+ } |
|
1784 |
+ /** |
|
1785 |
+ * @author fenris |
|
1786 |
+ */ |
|
1787 |
+ function record_show(parameters, _show) { |
|
1788 |
+ let str; |
|
1789 |
+ // core |
|
1790 |
+ { |
|
1791 |
+ str = "record"; |
|
1792 |
+ } |
|
1793 |
+ // fields |
|
1794 |
+ { |
|
1795 |
+ str += ("<" |
|
1796 |
+ + |
|
1797 |
+ parameters.fields.map(field => (field.name + ":" + _show(field.shape))).join(",") |
|
1798 |
+ + |
|
1799 |
+ ">"); |
|
1800 |
+ } |
|
1801 |
+ // soft |
|
1802 |
+ { |
|
1803 |
+ if (parameters.soft) { |
|
1804 |
+ str = `~${str}`; |
|
1805 |
+ } |
|
1806 |
+ } |
|
1807 |
+ return str; |
|
1808 |
+ } |
|
1809 |
+ /** |
|
1810 |
+ * @author fenris |
|
1811 |
+ */ |
|
1812 |
+ lib_shape.register({ |
|
1813 |
+ "name": "record", |
|
1814 |
+ "make": record_make, |
|
1815 |
+ "inspect": record_inspect, |
|
1816 |
+ "stance": record_stance, |
|
1817 |
+ "show": record_show, |
|
1818 |
+ }); |
|
1819 |
+})(lib_shape || (lib_shape = {})); |
|
1820 |
+/* |
|
1821 |
+This file is part of »bacterio-plankton:shape«. |
|
1822 |
+ |
|
1823 |
+Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
1824 |
+<info@greenscale.de> |
|
1825 |
+ |
|
1826 |
+»bacterio-plankton:shape« is free software: you can redistribute it and/or modify |
|
1827 |
+it under the terms of the GNU Lesser General Public License as published by |
|
1828 |
+the Free Software Foundation, either version 3 of the License, or |
|
1829 |
+(at your option) any later version. |
|
1830 |
+ |
|
1831 |
+»bacterio-plankton:shape« is distributed in the hope that it will be useful, |
|
1832 |
+but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
1833 |
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
1834 |
+GNU Lesser General Public License for more details. |
|
1835 |
+ |
|
1836 |
+You should have received a copy of the GNU Lesser General Public License |
|
1837 |
+along with »bacterio-plankton:shape«. If not, see <http://www.gnu.org/licenses/>. |
|
1838 |
+ */ |
|
1839 |
+var lib_shape; |
|
1840 |
+(function (lib_shape) { |
|
1841 |
+ /** |
|
1842 |
+ * @author fenris |
|
1843 |
+ */ |
|
1844 |
+ function map_make({ "soft": soft = false, "mutable": mutable = true, "shape_key": shape_key, "shape_value": shape_value, "defaultvalue": defaultvalue = undefined, }, _make) { |
|
1845 |
+ if (shape_key === undefined) { |
|
1846 |
+ let message = `mandatory parameter 'shape_key' missing`; |
|
1847 |
+ throw (new Error(message)); |
|
1848 |
+ } |
|
1849 |
+ if (shape_value === undefined) { |
|
1850 |
+ let message = `mandatory parameter 'shape_value' missing`; |
|
1851 |
+ throw (new Error(message)); |
|
1852 |
+ } |
|
1853 |
+ if (defaultvalue === undefined) { |
|
1854 |
+ defaultvalue = (soft ? null : {}); |
|
1855 |
+ } |
|
1856 |
+ return { |
|
1857 |
+ "soft": soft, |
|
1858 |
+ "mutable": mutable, |
|
1859 |
+ "shape_key": _make(shape_key), |
|
1860 |
+ "shape_value": _make(shape_value), |
|
1861 |
+ "defaultvalue": defaultvalue, |
|
1862 |
+ }; |
|
1863 |
+ } |
|
1864 |
+ /** |
|
1865 |
+ * @author fenris |
|
1866 |
+ */ |
|
1867 |
+ function map_stance(parameters, bindings, _stance) { |
|
1868 |
+ return { |
|
1869 |
+ "name": "map", |
|
1870 |
+ "parameters": { |
|
1871 |
+ "soft": parameters.soft, |
|
1872 |
+ "shape_key": _stance(parameters.shape_key, bindings), |
|
1873 |
+ "shape_value": _stance(parameters.shape_value, bindings) |
|
1874 |
+ } |
|
1875 |
+ }; |
|
1876 |
+ } |
|
1877 |
+ /** |
|
1878 |
+ * @author fenris |
|
1879 |
+ * @todo closer look not possible? |
|
1880 |
+ */ |
|
1881 |
+ function map_inspect(parameters, value, _inspect) { |
|
1882 |
+ let inspection = lib_shape.inspection_create(); |
|
1883 |
+ if (value == undefined) { |
|
1884 |
+ if (parameters.soft) { |
|
1885 |
+ // all good |
|
1886 |
+ } |
|
1887 |
+ else { |
|
1888 |
+ lib_shape.inspection_add(inspection, "null is not allowed"); |
|
1889 |
+ } |
|
1890 |
+ } |
|
1891 |
+ else { |
|
1892 |
+ let jstype_actual = typeof (value); |
|
1893 |
+ let jstype_expected = "object"; |
|
1894 |
+ if (jstype_actual === jstype_expected) { |
|
1895 |
+ Object.keys(value).forEach(key => { |
|
1896 |
+ lib_shape.inspection_extend(inspection, `key '${key}'`, _inspect(parameters.shape_key, key)); |
|
1897 |
+ let value_ = value[key]; |
|
1898 |
+ lib_shape.inspection_extend(inspection, `value for key '${key}'`, _inspect(parameters.shape_value, value_)); |
|
1899 |
+ }); |
|
1900 |
+ } |
|
1901 |
+ else { |
|
1902 |
+ lib_shape.inspection_add(inspection, `expected JS-type '${jstype_expected}' but got '${jstype_actual}'`); |
|
1903 |
+ } |
|
1904 |
+ } |
|
1905 |
+ return inspection; |
|
1906 |
+ } |
|
1907 |
+ /** |
|
1908 |
+ * @author fenris |
|
1909 |
+ */ |
|
1910 |
+ function map_show(parameters, _show) { |
|
1911 |
+ let str; |
|
1912 |
+ // core |
|
1913 |
+ { |
|
1914 |
+ str = "map"; |
|
1915 |
+ } |
|
1916 |
+ // in/out |
|
1917 |
+ { |
|
1918 |
+ str += ("<" |
|
1919 |
+ + |
|
1920 |
+ [ |
|
1921 |
+ _show(parameters.shape_key), |
|
1922 |
+ _show(parameters.shape_value), |
|
1923 |
+ ].join(",") |
|
1924 |
+ + |
|
1925 |
+ ">"); |
|
1926 |
+ } |
|
1927 |
+ // soft |
|
1928 |
+ { |
|
1929 |
+ if (parameters.soft) { |
|
1930 |
+ str = `~${str}`; |
|
1931 |
+ } |
|
1932 |
+ } |
|
1933 |
+ return str; |
|
1934 |
+ } |
|
1935 |
+ /** |
|
1936 |
+ * @author fenris |
|
1937 |
+ */ |
|
1938 |
+ lib_shape.register({ |
|
1939 |
+ "name": "map", |
|
1940 |
+ "make": map_make, |
|
1941 |
+ "inspect": map_inspect, |
|
1942 |
+ "stance": map_stance, |
|
1943 |
+ "show": map_show, |
|
1944 |
+ }); |
|
1945 |
+})(lib_shape || (lib_shape = {})); |
|
1946 |
+/* |
|
1947 |
+This file is part of »bacterio-plankton:shape«. |
|
1948 |
+ |
|
1949 |
+Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
1950 |
+<info@greenscale.de> |
|
1951 |
+ |
|
1952 |
+»bacterio-plankton:shape« is free software: you can redistribute it and/or modify |
|
1953 |
+it under the terms of the GNU Lesser General Public License as published by |
|
1954 |
+the Free Software Foundation, either version 3 of the License, or |
|
1955 |
+(at your option) any later version. |
|
1956 |
+ |
|
1957 |
+»bacterio-plankton:shape« is distributed in the hope that it will be useful, |
|
1958 |
+but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
1959 |
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
1960 |
+GNU Lesser General Public License for more details. |
|
1961 |
+ |
|
1962 |
+You should have received a copy of the GNU Lesser General Public License |
|
1963 |
+along with »bacterio-plankton:shape«. If not, see <http://www.gnu.org/licenses/>. |
|
1964 |
+ */ |
|
1965 |
+var lib_shape; |
|
1966 |
+(function (lib_shape) { |
|
1967 |
+ /** |
|
1968 |
+ * @author fenris |
|
1969 |
+ */ |
|
1970 |
+ function maybe_make({ "soft": soft = false, "shape_value": shape_value, "defaultvalue": defaultvalue = undefined, }, _make) { |
|
1971 |
+ if (shape_value === undefined) { |
|
1972 |
+ let message = `mandatory parameter 'shape_value' missing`; |
|
1973 |
+ throw (new Error(message)); |
|
1974 |
+ } |
|
1975 |
+ if (defaultvalue === undefined) { |
|
1976 |
+ defaultvalue = (soft ? null : { "kind": "nothing" }); |
|
1977 |
+ } |
|
1978 |
+ return { |
|
1979 |
+ "soft": soft, |
|
1980 |
+ "shape_value": _make(shape_value), |
|
1981 |
+ "defaultvalue": defaultvalue, |
|
1982 |
+ }; |
|
1983 |
+ } |
|
1984 |
+ /** |
|
1985 |
+ * @author fenris |
|
1986 |
+ */ |
|
1987 |
+ function maybe_inspect(parameters, value, _inspect) { |
|
1988 |
+ let inspection = lib_shape.inspection_create(); |
|
1989 |
+ if (value == undefined) { |
|
1990 |
+ if (parameters.soft) { |
|
1991 |
+ // all good |
|
1992 |
+ } |
|
1993 |
+ else { |
|
1994 |
+ lib_shape.inspection_add(inspection, "null is not allowed"); |
|
1995 |
+ } |
|
1996 |
+ } |
|
1997 |
+ else { |
|
1998 |
+ let jstype_actual = typeof (value); |
|
1999 |
+ let jstype_expected = "object"; |
|
2000 |
+ if (jstype_actual === jstype_expected) { |
|
2001 |
+ if ("kind" in value) { |
|
2002 |
+ // all good? |
|
2003 |
+ } |
|
2004 |
+ else { |
|
2005 |
+ lib_shape.inspection_add(inspection, `field 'kind' missing`); |
|
2006 |
+ } |
|
2007 |
+ } |
|
2008 |
+ else { |
|
2009 |
+ lib_shape.inspection_add(inspection, `expected JS-type '${jstype_expected}' but got '${jstype_actual}'`); |
|
2010 |
+ } |
|
2011 |
+ } |
|
2012 |
+ return inspection; |
|
2013 |
+ } |
|
2014 |
+ /** |
|
2015 |
+ * @author fenris |
|
2016 |
+ */ |
|
2017 |
+ function maybe_stance(parameters, bindings, _stance) { |
|
2018 |
+ return { |
|
2019 |
+ "name": "maybe", |
|
2020 |
+ "parameters": { |
|
2021 |
+ "soft": parameters.soft, |
|
2022 |
+ "shape_value": _stance(parameters.shape_value, bindings) |
|
2023 |
+ } |
|
2024 |
+ }; |
|
2025 |
+ } |
|
2026 |
+ /** |
|
2027 |
+ * @author fenris |
|
2028 |
+ */ |
|
2029 |
+ function maybe_show(parameters, _show) { |
|
2030 |
+ let str; |
|
2031 |
+ // core |
|
2032 |
+ { |
|
2033 |
+ str = "maybe"; |
|
2034 |
+ } |
|
2035 |
+ // shape_value |
|
2036 |
+ { |
|
2037 |
+ str += ("<" |
|
2038 |
+ + |
|
2039 |
+ _show(parameters.shape_value) |
|
2040 |
+ + |
|
2041 |
+ ">"); |
|
2042 |
+ } |
|
2043 |
+ // soft |
|
2044 |
+ { |
|
2045 |
+ if (parameters.soft) { |
|
2046 |
+ str = `~${str}`; |
|
2047 |
+ } |
|
2048 |
+ } |
|
2049 |
+ return str; |
|
2050 |
+ } |
|
2051 |
+ /** |
|
2052 |
+ * @author fenris |
|
2053 |
+ */ |
|
2054 |
+ lib_shape.register({ |
|
2055 |
+ "name": "maybe", |
|
2056 |
+ "make": maybe_make, |
|
2057 |
+ "inspect": maybe_inspect, |
|
2058 |
+ "stance": maybe_stance, |
|
2059 |
+ "show": maybe_show, |
|
2060 |
+ }); |
|
2061 |
+})(lib_shape || (lib_shape = {})); |
|
2062 |
+/* |
|
2063 |
+This file is part of »bacterio-plankton:shape«. |
|
2064 |
+ |
|
2065 |
+Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
2066 |
+<info@greenscale.de> |
|
2067 |
+ |
|
2068 |
+»bacterio-plankton:shape« is free software: you can redistribute it and/or modify |
|
2069 |
+it under the terms of the GNU Lesser General Public License as published by |
|
2070 |
+the Free Software Foundation, either version 3 of the License, or |
|
2071 |
+(at your option) any later version. |
|
2072 |
+ |
|
2073 |
+»bacterio-plankton:shape« is distributed in the hope that it will be useful, |
|
2074 |
+but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
2075 |
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
2076 |
+GNU Lesser General Public License for more details. |
|
2077 |
+ |
|
2078 |
+You should have received a copy of the GNU Lesser General Public License |
|
2079 |
+along with »bacterio-plankton:shape«. If not, see <http://www.gnu.org/licenses/>. |
|
2080 |
+ */ |
|
2081 |
+var lib_shape; |
|
2082 |
+(function (lib_shape) { |
|
2083 |
+ /** |
|
2084 |
+ * @author fenris |
|
2085 |
+ */ |
|
2086 |
+ function promise_make({ "soft": soft = false, "shape_result": shape_result, "shape_reason": shape_reason, "defaultvalue": defaultvalue = undefined, }, _make) { |
|
2087 |
+ if (shape_result === undefined) { |
|
2088 |
+ let message = `mandatory parameter 'shape_result' missing`; |
|
2089 |
+ throw (new Error(message)); |
|
2090 |
+ } |
|
2091 |
+ if (shape_reason === undefined) { |
|
2092 |
+ let message = `mandatory parameter 'shape_reason' missing`; |
|
2093 |
+ throw (new Error(message)); |
|
2094 |
+ } |
|
2095 |
+ if (defaultvalue === undefined) { |
|
2096 |
+ defaultvalue = (soft ? null : Promise.resolve(null)); |
|
2097 |
+ } |
|
2098 |
+ return { |
|
2099 |
+ "soft": soft, |
|
2100 |
+ "shape_result": _make(shape_result), |
|
2101 |
+ "shape_reason": _make(shape_reason), |
|
2102 |
+ "defaultvalue": defaultvalue, |
|
2103 |
+ }; |
|
2104 |
+ } |
|
2105 |
+ /** |
|
2106 |
+ * @author fenris |
|
2107 |
+ */ |
|
2108 |
+ function promise_stance(parameters, bindings, _stance) { |
|
2109 |
+ return { |
|
2110 |
+ "name": "promise", |
|
2111 |
+ "parameters": { |
|
2112 |
+ "soft": parameters.soft, |
|
2113 |
+ "shape_result": _stance(parameters.shape_result, bindings), |
|
2114 |
+ "shape_reason": _stance(parameters.shape_reason, bindings) |
|
2115 |
+ } |
|
2116 |
+ }; |
|
2117 |
+ } |
|
2118 |
+ /** |
|
2119 |
+ * @author fenris |
|
2120 |
+ * @todo closer look not possible? |
|
2121 |
+ */ |
|
2122 |
+ function promise_inspect(parameters, value, _inspect) { |
|
2123 |
+ let inspection = lib_shape.inspection_create(); |
|
2124 |
+ if (value == undefined) { |
|
2125 |
+ if (parameters.soft) { |
|
2126 |
+ // all good |
|
2127 |
+ } |
|
2128 |
+ else { |
|
2129 |
+ lib_shape.inspection_add(inspection, "null is not allowed"); |
|
2130 |
+ } |
|
2131 |
+ } |
|
2132 |
+ else { |
|
2133 |
+ let jstype_actual = typeof (value); |
|
2134 |
+ let jstype_expected = "object"; |
|
2135 |
+ if (jstype_actual === jstype_expected) { |
|
2136 |
+ if (value instanceof Promise /*<any, any>*/) { |
|
2137 |
+ // all good? |
|
2138 |
+ } |
|
2139 |
+ else { |
|
2140 |
+ lib_shape.inspection_add(inspection, `values is not an Promise-instance`); |
|
2141 |
+ } |
|
2142 |
+ } |
|
2143 |
+ else { |
|
2144 |
+ lib_shape.inspection_add(inspection, `expected JS-type '${jstype_expected}' but got '${jstype_actual}'`); |
|
2145 |
+ } |
|
2146 |
+ } |
|
2147 |
+ return inspection; |
|
2148 |
+ } |
|
2149 |
+ /** |
|
2150 |
+ * @author fenris |
|
2151 |
+ */ |
|
2152 |
+ function promise_show(parameters, _show) { |
|
2153 |
+ let str; |
|
2154 |
+ // core |
|
2155 |
+ { |
|
2156 |
+ str = "promise"; |
|
2157 |
+ } |
|
2158 |
+ // in/out |
|
2159 |
+ { |
|
2160 |
+ str += ("<" |
|
2161 |
+ + |
|
2162 |
+ [ |
|
2163 |
+ _show(parameters.shape_result), |
|
2164 |
+ _show(parameters.shape_reason), |
|
2165 |
+ ].join(",") |
|
2166 |
+ + |
|
2167 |
+ ">"); |
|
2168 |
+ } |
|
2169 |
+ // soft |
|
2170 |
+ { |
|
2171 |
+ if (parameters.soft) { |
|
2172 |
+ str = `~${str}`; |
|
2173 |
+ } |
|
2174 |
+ } |
|
2175 |
+ return str; |
|
2176 |
+ } |
|
2177 |
+ /** |
|
2178 |
+ * @author fenris |
|
2179 |
+ */ |
|
2180 |
+ lib_shape.register({ |
|
2181 |
+ "name": "promise", |
|
2182 |
+ "make": promise_make, |
|
2183 |
+ "inspect": promise_inspect, |
|
2184 |
+ "stance": promise_stance, |
|
2185 |
+ "show": promise_show, |
|
2186 |
+ }); |
|
2187 |
+})(lib_shape || (lib_shape = {})); |
|
2188 |
+/* |
|
2189 |
+This file is part of »bacterio-plankton:shape«. |
|
2190 |
+ |
|
2191 |
+Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
2192 |
+<info@greenscale.de> |
|
2193 |
+ |
|
2194 |
+»bacterio-plankton:shape« is free software: you can redistribute it and/or modify |
|
2195 |
+it under the terms of the GNU Lesser General Public License as published by |
|
2196 |
+the Free Software Foundation, either version 3 of the License, or |
|
2197 |
+(at your option) any later version. |
|
2198 |
+ |
|
2199 |
+»bacterio-plankton:shape« is distributed in the hope that it will be useful, |
|
2200 |
+but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
2201 |
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
2202 |
+GNU Lesser General Public License for more details. |
|
2203 |
+ |
|
2204 |
+You should have received a copy of the GNU Lesser General Public License |
|
2205 |
+along with »bacterio-plankton:shape«. If not, see <http://www.gnu.org/licenses/>. |
|
2206 |
+ */ |
|
2207 |
+var lib_shape; |
|
2208 |
+(function (lib_shape) { |
|
2209 |
+ /** |
|
2210 |
+ * @author fenris |
|
2211 |
+ * @todo use a treemap-function (but first make one :P) |
|
2212 |
+ */ |
|
2213 |
+ function adjust_labels(shape, transformator) { |
|
2214 |
+ if (false) { |
|
2215 |
+ } |
|
2216 |
+ else if (shape.name === "enumeration") { |
|
2217 |
+ return { |
|
2218 |
+ "name": "enumeration", |
|
2219 |
+ "parameters": { |
|
2220 |
+ "soft": shape.parameters["soft"], |
|
2221 |
+ "shape_option": adjust_labels(shape.parameters["shape_option"], transformator), |
|
2222 |
+ "options": shape.parameters["options"].map(option => { |
|
2223 |
+ return { |
|
2224 |
+ "value": option.value, |
|
2225 |
+ "label": transformator(option.label), |
|
2226 |
+ }; |
|
2227 |
+ }), |
|
2228 |
+ "defaultvalue": shape.parameters["defaultvalue"], |
|
2229 |
+ } |
|
2230 |
+ }; |
|
2231 |
+ } |
|
2232 |
+ else if (shape.name === "array") { |
|
2233 |
+ return { |
|
2234 |
+ "name": "array", |
|
2235 |
+ "parameters": { |
|
2236 |
+ "soft": shape.parameters["soft"], |
|
2237 |
+ "shape_element": adjust_labels(shape.parameters["shape_element"], transformator), |
|
2238 |
+ "defaultvalue": shape.parameters["defaultvalue"], |
|
2239 |
+ } |
|
2240 |
+ }; |
|
2241 |
+ } |
|
2242 |
+ else if (shape.name === "record") { |
|
2243 |
+ return { |
|
2244 |
+ "name": "record", |
|
2245 |
+ "parameters": { |
|
2246 |
+ "soft": shape.parameters["soft"], |
|
2247 |
+ "fields": shape.parameters["fields"].map(field => { |
|
2248 |
+ return { |
|
2249 |
+ "name": field.name, |
|
2250 |
+ "shape": adjust_labels(field.shape, transformator), |
|
2251 |
+ "label": transformator(field.label), |
|
2252 |
+ }; |
|
2253 |
+ }), |
|
2254 |
+ "defaultvalue": shape.parameters["defaultvalue"], |
|
2255 |
+ } |
|
2256 |
+ }; |
|
2257 |
+ } |
|
2258 |
+ // lil' hacky … |
|
2259 |
+ else { |
|
2260 |
+ // shape["label"] = ((shape["label"] == null) ? null : transformator(shape["label"])); |
|
2261 |
+ return shape; |
|
2262 |
+ } |
|
2263 |
+ } |
|
2264 |
+ lib_shape.adjust_labels = adjust_labels; |
|
2265 |
+ /** |
|
2266 |
+ * @author fenris |
|
2267 |
+ */ |
|
2268 |
+ function register_(id, factory) { |
|
2269 |
+ const message = "not implemented; dummy impl"; |
|
2270 |
+ console.warn(message); |
|
2271 |
+ } |
|
2272 |
+ lib_shape.register_ = register_; |
|
2273 |
+ /** |
|
2274 |
+ * @author fenris |
|
2275 |
+ */ |
|
2276 |
+ function retrieve_(id) { |
|
2277 |
+ const message = "not implemented; returning dummy"; |
|
2278 |
+ console.warn(message); |
|
2279 |
+ return { "name": "any" }; |
|
2280 |
+ } |
|
2281 |
+ lib_shape.retrieve_ = retrieve_; |
|
2282 |
+})(lib_shape || (lib_shape = {})); |
... | ... |
@@ -0,0 +1,861 @@ |
1 |
+Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
2 |
+<info@greenscale.de> |
|
3 |
+ |
|
4 |
+»bacterio-plankton:string« is free software: you can redistribute it and/or modify |
|
5 |
+it under the terms of the GNU Lesser General Public License as published by |
|
6 |
+the Free Software Foundation, either version 3 of the License, or |
|
7 |
+(at your option) any later version. |
|
8 |
+ |
|
9 |
+»bacterio-plankton:string« is distributed in the hope that it will be useful, |
|
10 |
+but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 |
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 |
+GNU Lesser General Public License for more details. |
|
13 |
+ |
|
14 |
+You should have received a copy of the GNU Lesser General Public License |
|
15 |
+along with »bacterio-plankton:string«. If not, see <http://www.gnu.org/licenses/>. |
|
16 |
+ |
|
17 |
+ |
|
18 |
+ |
|
19 |
+ GNU GENERAL PUBLIC LICENSE |
|
20 |
+ Version 3, 29 June 2007 |
|
21 |
+ |
|
22 |
+ Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/> |
|
23 |
+ Everyone is permitted to copy and distribute verbatim copies |
|
24 |
+ of this license document, but changing it is not allowed. |
|
25 |
+ |
|
26 |
+ Preamble |
|
27 |
+ |
|
28 |
+ The GNU General Public License is a free, copyleft license for |
|
29 |
+software and other kinds of works. |
|
30 |
+ |
|
31 |
+ The licenses for most software and other practical works are designed |
|
32 |
+to take away your freedom to share and change the works. By contrast, |
|
33 |
+the GNU General Public License is intended to guarantee your freedom to |
|
34 |
+share and change all versions of a program--to make sure it remains free |
|
35 |
+software for all its users. We, the Free Software Foundation, use the |
|
36 |
+GNU General Public License for most of our software; it applies also to |
|
37 |
+any other work released this way by its authors. You can apply it to |
|
38 |
+your programs, too. |
|
39 |
+ |
|
40 |
+ When we speak of free software, we are referring to freedom, not |
|
41 |
+price. Our General Public Licenses are designed to make sure that you |
|
42 |
+have the freedom to distribute copies of free software (and charge for |
|
43 |
+them if you wish), that you receive source code or can get it if you |
|
44 |
+want it, that you can change the software or use pieces of it in new |
|
45 |
+free programs, and that you know you can do these things. |
|
46 |
+ |
|
47 |
+ To protect your rights, we need to prevent others from denying you |
|
48 |
+these rights or asking you to surrender the rights. Therefore, you have |
|
49 |
+certain responsibilities if you distribute copies of the software, or if |
|
50 |
+you modify it: responsibilities to respect the freedom of others. |
|
51 |
+ |
|
52 |
+ For example, if you distribute copies of such a program, whether |
|
53 |
+gratis or for a fee, you must pass on to the recipients the same |
|
54 |
+freedoms that you received. You must make sure that they, too, receive |
|
55 |
+or can get the source code. And you must show them these terms so they |
|
56 |
+know their rights. |
|
57 |
+ |
|
58 |
+ Developers that use the GNU GPL protect your rights with two steps: |
|
59 |
+(1) assert copyright on the software, and (2) offer you this License |
|
60 |
+giving you legal permission to copy, distribute and/or modify it. |
|
61 |
+ |
|
62 |
+ For the developers' and authors' protection, the GPL clearly explains |
|
63 |
+that there is no warranty for this free software. For both users' and |
|
64 |
+authors' sake, the GPL requires that modified versions be marked as |
|
65 |
+changed, so that their problems will not be attributed erroneously to |
|
66 |
+authors of previous versions. |
|
67 |
+ |
|
68 |
+ Some devices are designed to deny users access to install or run |
|
69 |
+modified versions of the software inside them, although the manufacturer |
|
70 |
+can do so. This is fundamentally incompatible with the aim of |
|
71 |
+protecting users' freedom to change the software. The systematic |
|
72 |
+pattern of such abuse occurs in the area of products for individuals to |
|
73 |
+use, which is precisely where it is most unacceptable. Therefore, we |
|
74 |
+have designed this version of the GPL to prohibit the practice for those |
|
75 |
+products. If such problems arise substantially in other domains, we |
|
76 |
+stand ready to extend this provision to those domains in future versions |
|
77 |
+of the GPL, as needed to protect the freedom of users. |
|
78 |
+ |
|
79 |
+ Finally, every program is threatened constantly by software patents. |
|
80 |
+States should not allow patents to restrict development and use of |
|
81 |
+software on general-purpose computers, but in those that do, we wish to |
|
82 |
+avoid the special danger that patents applied to a free program could |
|
83 |
+make it effectively proprietary. To prevent this, the GPL assures that |
|
84 |
+patents cannot be used to render the program non-free. |
|
85 |
+ |
|
86 |
+ The precise terms and conditions for copying, distribution and |
|
87 |
+modification follow. |
|
88 |
+ |
|
89 |
+ TERMS AND CONDITIONS |
|
90 |
+ |
|
91 |
+ 0. Definitions. |
|
92 |
+ |
|
93 |
+ "This License" refers to version 3 of the GNU General Public License. |
|
94 |
+ |
|
95 |
+ "Copyright" also means copyright-like laws that apply to other kinds of |
|
96 |
+works, such as semiconductor masks. |
|
97 |
+ |
|
98 |
+ "The Program" refers to any copyrightable work licensed under this |
|
99 |
+License. Each licensee is addressed as "you". "Licensees" and |
|
100 |
+"recipients" may be individuals or organizations. |
|
101 |
+ |
|
102 |
+ To "modify" a work means to copy from or adapt all or part of the work |
|
103 |
+in a fashion requiring copyright permission, other than the making of an |
|
104 |
+exact copy. The resulting work is called a "modified version" of the |
|
105 |
+earlier work or a work "based on" the earlier work. |
|
106 |
+ |
|
107 |
+ A "covered work" means either the unmodified Program or a work based |
|
108 |
+on the Program. |
|
109 |
+ |
|
110 |
+ To "propagate" a work means to do anything with it that, without |
|
111 |
+permission, would make you directly or secondarily liable for |
|
112 |
+infringement under applicable copyright law, except executing it on a |
|
113 |
+computer or modifying a private copy. Propagation includes copying, |
|
114 |
+distribution (with or without modification), making available to the |
|
115 |
+public, and in some countries other activities as well. |
|
116 |
+ |
|
117 |
+ To "convey" a work means any kind of propagation that enables other |
|
118 |
+parties to make or receive copies. Mere interaction with a user through |
|
119 |
+a computer network, with no transfer of a copy, is not conveying. |
|
120 |
+ |
|
121 |
+ An interactive user interface displays "Appropriate Legal Notices" |
|
122 |
+to the extent that it includes a convenient and prominently visible |
|
123 |
+feature that (1) displays an appropriate copyright notice, and (2) |
|
124 |
+tells the user that there is no warranty for the work (except to the |
|
125 |
+extent that warranties are provided), that licensees may convey the |
|
126 |
+work under this License, and how to view a copy of this License. If |
|
127 |
+the interface presents a list of user commands or options, such as a |
|
128 |
+menu, a prominent item in the list meets this criterion. |
|
129 |
+ |
|
130 |
+ 1. Source Code. |
|
131 |
+ |
|
132 |
+ The "source code" for a work means the preferred form of the work |
|
133 |
+for making modifications to it. "Object code" means any non-source |
|
134 |
+form of a work. |
|
135 |
+ |
|
136 |
+ A "Standard Interface" means an interface that either is an official |
|
137 |
+standard defined by a recognized standards body, or, in the case of |
|
138 |
+interfaces specified for a particular programming language, one that |
|
139 |
+is widely used among developers working in that language. |
|
140 |
+ |
|
141 |
+ The "System Libraries" of an executable work include anything, other |
|
142 |
+than the work as a whole, that (a) is included in the normal form of |
|
143 |
+packaging a Major Component, but which is not part of that Major |
|
144 |
+Component, and (b) serves only to enable use of the work with that |
|
145 |
+Major Component, or to implement a Standard Interface for which an |
|
146 |
+implementation is available to the public in source code form. A |
|
147 |
+"Major Component", in this context, means a major essential component |
|
148 |
+(kernel, window system, and so on) of the specific operating system |
|
149 |
+(if any) on which the executable work runs, or a compiler used to |
|
150 |
+produce the work, or an object code interpreter used to run it. |
|
151 |
+ |
|
152 |
+ The "Corresponding Source" for a work in object code form means all |
|
153 |
+the source code needed to generate, install, and (for an executable |
|
154 |
+work) run the object code and to modify the work, including scripts to |
|
155 |
+control those activities. However, it does not include the work's |
|
156 |
+System Libraries, or general-purpose tools or generally available free |
|
157 |
+programs which are used unmodified in performing those activities but |
|
158 |
+which are not part of the work. For example, Corresponding Source |
|
159 |
+includes interface definition files associated with source files for |
|
160 |
+the work, and the source code for shared libraries and dynamically |
|
161 |
+linked subprograms that the work is specifically designed to require, |
|
162 |
+such as by intimate data communication or control flow between those |
|
163 |
+subprograms and other parts of the work. |
|
164 |
+ |
|
165 |
+ The Corresponding Source need not include anything that users |
|
166 |
+can regenerate automatically from other parts of the Corresponding |
|
167 |
+Source. |
|
168 |
+ |
|
169 |
+ The Corresponding Source for a work in source code form is that |
|
170 |
+same work. |
|
171 |
+ |
|
172 |
+ 2. Basic Permissions. |
|
173 |
+ |
|
174 |
+ All rights granted under this License are granted for the term of |
|
175 |
+copyright on the Program, and are irrevocable provided the stated |
|
176 |
+conditions are met. This License explicitly affirms your unlimited |
|
177 |
+permission to run the unmodified Program. The output from running a |
|
178 |
+covered work is covered by this License only if the output, given its |
|
179 |
+content, constitutes a covered work. This License acknowledges your |
|
180 |
+rights of fair use or other equivalent, as provided by copyright law. |
|
181 |
+ |
|
182 |
+ You may make, run and propagate covered works that you do not |
|
183 |
+convey, without conditions so long as your license otherwise remains |
|
184 |
+in force. You may convey covered works to others for the sole purpose |
|
185 |
+of having them make modifications exclusively for you, or provide you |
|
186 |
+with facilities for running those works, provided that you comply with |
|
187 |
+the terms of this License in conveying all material for which you do |
|
188 |
+not control copyright. Those thus making or running the covered works |
|
189 |
+for you must do so exclusively on your behalf, under your direction |
|
190 |
+and control, on terms that prohibit them from making any copies of |
|
191 |
+your copyrighted material outside their relationship with you. |
|
192 |
+ |
|
193 |
+ Conveying under any other circumstances is permitted solely under |
|
194 |
+the conditions stated below. Sublicensing is not allowed; section 10 |
|
195 |
+makes it unnecessary. |
|
196 |
+ |
|
197 |
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law. |
|
198 |
+ |
|
199 |
+ No covered work shall be deemed part of an effective technological |
|
200 |
+measure under any applicable law fulfilling obligations under article |
|
201 |
+11 of the WIPO copyright treaty adopted on 20 December 1996, or |
|
202 |
+similar laws prohibiting or restricting circumvention of such |
|
203 |
+measures. |
|
204 |
+ |
|
205 |
+ When you convey a covered work, you waive any legal power to forbid |
|
206 |
+circumvention of technological measures to the extent such circumvention |
|
207 |
+is effected by exercising rights under this License with respect to |
|
208 |
+the covered work, and you disclaim any intention to limit operation or |
|
209 |
+modification of the work as a means of enforcing, against the work's |
|
210 |
+users, your or third parties' legal rights to forbid circumvention of |
|
211 |
+technological measures. |
|
212 |
+ |
|
213 |
+ 4. Conveying Verbatim Copies. |
|
214 |
+ |
|
215 |
+ You may convey verbatim copies of the Program's source code as you |
|
216 |
+receive it, in any medium, provided that you conspicuously and |
|
217 |
+appropriately publish on each copy an appropriate copyright notice; |
|
218 |
+keep intact all notices stating that this License and any |
|
219 |
+non-permissive terms added in accord with section 7 apply to the code; |
|
220 |
+keep intact all notices of the absence of any warranty; and give all |
|
221 |
+recipients a copy of this License along with the Program. |
|
222 |
+ |
|
223 |
+ You may charge any price or no price for each copy that you convey, |
|
224 |
+and you may offer support or warranty protection for a fee. |
|
225 |
+ |
|
226 |
+ 5. Conveying Modified Source Versions. |
|
227 |
+ |
|
228 |
+ You may convey a work based on the Program, or the modifications to |
|
229 |
+produce it from the Program, in the form of source code under the |
|
230 |
+terms of section 4, provided that you also meet all of these conditions: |
|
231 |
+ |
|
232 |
+ a) The work must carry prominent notices stating that you modified |
|
233 |
+ it, and giving a relevant date. |
|
234 |
+ |
|
235 |
+ b) The work must carry prominent notices stating that it is |
|
236 |
+ released under this License and any conditions added under section |
|
237 |
+ 7. This requirement modifies the requirement in section 4 to |
|
238 |
+ "keep intact all notices". |
|
239 |
+ |
|
240 |
+ c) You must license the entire work, as a whole, under this |
|
241 |
+ License to anyone who comes into possession of a copy. This |
|
242 |
+ License will therefore apply, along with any applicable section 7 |
|
243 |
+ additional terms, to the whole of the work, and all its parts, |
|
244 |
+ regardless of how they are packaged. This License gives no |
|
245 |
+ permission to license the work in any other way, but it does not |
|
246 |
+ invalidate such permission if you have separately received it. |
|
247 |
+ |
|
248 |
+ d) If the work has interactive user interfaces, each must display |
|
249 |
+ Appropriate Legal Notices; however, if the Program has interactive |
|
250 |
+ interfaces that do not display Appropriate Legal Notices, your |
|
251 |
+ work need not make them do so. |
|
252 |
+ |
|
253 |
+ A compilation of a covered work with other separate and independent |
|
254 |
+works, which are not by their nature extensions of the covered work, |
|
255 |
+and which are not combined with it such as to form a larger program, |
|
256 |
+in or on a volume of a storage or distribution medium, is called an |
|
257 |
+"aggregate" if the compilation and its resulting copyright are not |
|
258 |
+used to limit the access or legal rights of the compilation's users |
|
259 |
+beyond what the individual works permit. Inclusion of a covered work |
|
260 |
+in an aggregate does not cause this License to apply to the other |
|
261 |
+parts of the aggregate. |
|
262 |
+ |
|
263 |
+ 6. Conveying Non-Source Forms. |
|
264 |
+ |
|
265 |
+ You may convey a covered work in object code form under the terms |
|
266 |
+of sections 4 and 5, provided that you also convey the |
|
267 |
+machine-readable Corresponding Source under the terms of this License, |
|
268 |
+in one of these ways: |
|
269 |
+ |
|
270 |
+ a) Convey the object code in, or embodied in, a physical product |
|
271 |
+ (including a physical distribution medium), accompanied by the |
|
272 |
+ Corresponding Source fixed on a durable physical medium |
|
273 |
+ customarily used for software interchange. |
|
274 |
+ |
|
275 |
+ b) Convey the object code in, or embodied in, a physical product |
|
276 |
+ (including a physical distribution medium), accompanied by a |
|
277 |
+ written offer, valid for at least three years and valid for as |
|
278 |
+ long as you offer spare parts or customer support for that product |
|
279 |
+ model, to give anyone who possesses the object code either (1) a |
|
280 |
+ copy of the Corresponding Source for all the software in the |
|
281 |
+ product that is covered by this License, on a durable physical |
|
282 |
+ medium customarily used for software interchange, for a price no |
|
283 |
+ more than your reasonable cost of physically performing this |
|
284 |
+ conveying of source, or (2) access to copy the |
|
285 |
+ Corresponding Source from a network server at no charge. |
|
286 |
+ |
|
287 |
+ c) Convey individual copies of the object code with a copy of the |
|
288 |
+ written offer to provide the Corresponding Source. This |
|
289 |
+ alternative is allowed only occasionally and noncommercially, and |
|
290 |
+ only if you received the object code with such an offer, in accord |
|
291 |
+ with subsection 6b. |
|
292 |
+ |
|
293 |
+ d) Convey the object code by offering access from a designated |
|
294 |
+ place (gratis or for a charge), and offer equivalent access to the |
|
295 |
+ Corresponding Source in the same way through the same place at no |
|
296 |
+ further charge. You need not require recipients to copy the |
|
297 |
+ Corresponding Source along with the object code. If the place to |
|
298 |
+ copy the object code is a network server, the Corresponding Source |
|
299 |
+ may be on a different server (operated by you or a third party) |
|
300 |
+ that supports equivalent copying facilities, provided you maintain |
|
301 |
+ clear directions next to the object code saying where to find the |
|
302 |
+ Corresponding Source. Regardless of what server hosts the |
|
303 |
+ Corresponding Source, you remain obligated to ensure that it is |
|
304 |
+ available for as long as needed to satisfy these requirements. |
|
305 |
+ |
|
306 |
+ e) Convey the object code using peer-to-peer transmission, provided |
|
307 |
+ you inform other peers where the object code and Corresponding |
|
308 |
+ Source of the work are being offered to the general public at no |
|
309 |
+ charge under subsection 6d. |
|
310 |
+ |
|
311 |
+ A separable portion of the object code, whose source code is excluded |
|
312 |
+from the Corresponding Source as a System Library, need not be |
|
313 |
+included in conveying the object code work. |
|
314 |
+ |
|
315 |
+ A "User Product" is either (1) a "consumer product", which means any |
|
316 |
+tangible personal property which is normally used for personal, family, |
|
317 |
+or household purposes, or (2) anything designed or sold for incorporation |
|
318 |
+into a dwelling. In determining whether a product is a consumer product, |
|
319 |
+doubtful cases shall be resolved in favor of coverage. For a particular |
|
320 |
+product received by a particular user, "normally used" refers to a |
|
321 |
+typical or common use of that class of product, regardless of the status |
|
322 |
+of the particular user or of the way in which the particular user |
|
323 |
+actually uses, or expects or is expected to use, the product. A product |
|
324 |
+is a consumer product regardless of whether the product has substantial |
|
325 |
+commercial, industrial or non-consumer uses, unless such uses represent |
|
326 |
+the only significant mode of use of the product. |
|
327 |
+ |
|
328 |
+ "Installation Information" for a User Product means any methods, |
|
329 |
+procedures, authorization keys, or other information required to install |
|
330 |
+and execute modified versions of a covered work in that User Product from |
|
331 |
+a modified version of its Corresponding Source. The information must |
|
332 |
+suffice to ensure that the continued functioning of the modified object |
|
333 |
+code is in no case prevented or interfered with solely because |
|
334 |
+modification has been made. |
|
335 |
+ |
|
336 |
+ If you convey an object code work under this section in, or with, or |
|
337 |
+specifically for use in, a User Product, and the conveying occurs as |
|
338 |
+part of a transaction in which the right of possession and use of the |
|
339 |
+User Product is transferred to the recipient in perpetuity or for a |
|
340 |
+fixed term (regardless of how the transaction is characterized), the |
|
341 |
+Corresponding Source conveyed under this section must be accompanied |
|
342 |
+by the Installation Information. But this requirement does not apply |
|
343 |
+if neither you nor any third party retains the ability to install |
|
344 |
+modified object code on the User Product (for example, the work has |
|
345 |
+been installed in ROM). |
|
346 |
+ |
|
347 |
+ The requirement to provide Installation Information does not include a |
|
348 |
+requirement to continue to provide support service, warranty, or updates |
|
349 |
+for a work that has been modified or installed by the recipient, or for |
|
350 |
+the User Product in which it has been modified or installed. Access to a |
|
351 |
+network may be denied when the modification itself materially and |
|
352 |
+adversely affects the operation of the network or violates the rules and |
|
353 |
+protocols for communication across the network. |
|
354 |
+ |
|
355 |
+ Corresponding Source conveyed, and Installation Information provided, |
|
356 |
+in accord with this section must be in a format that is publicly |
|
357 |
+documented (and with an implementation available to the public in |
|
358 |
+source code form), and must require no special password or key for |
|
359 |
+unpacking, reading or copying. |
|
360 |
+ |
|
361 |
+ 7. Additional Terms. |
|
362 |
+ |
|
363 |
+ "Additional permissions" are terms that supplement the terms of this |
|
364 |
+License by making exceptions from one or more of its conditions. |
|
365 |
+Additional permissions that are applicable to the entire Program shall |
|
366 |
+be treated as though they were included in this License, to the extent |
|
367 |
+that they are valid under applicable law. If additional permissions |
|
368 |
+apply only to part of the Program, that part may be used separately |
|
369 |
+under those permissions, but the entire Program remains governed by |
|
370 |
+this License without regard to the additional permissions. |
|
371 |
+ |
|
372 |
+ When you convey a copy of a covered work, you may at your option |
|
373 |
+remove any additional permissions from that copy, or from any part of |
|
374 |
+it. (Additional permissions may be written to require their own |
|
375 |
+removal in certain cases when you modify the work.) You may place |
|
376 |
+additional permissions on material, added by you to a covered work, |
|
377 |
+for which you have or can give appropriate copyright permission. |
|
378 |
+ |
|
379 |
+ Notwithstanding any other provision of this License, for material you |
|
380 |
+add to a covered work, you may (if authorized by the copyright holders of |
|
381 |
+that material) supplement the terms of this License with terms: |
|
382 |
+ |
|
383 |
+ a) Disclaiming warranty or limiting liability differently from the |
|
384 |
+ terms of sections 15 and 16 of this License; or |
|
385 |
+ |
|
386 |
+ b) Requiring preservation of specified reasonable legal notices or |
|
387 |
+ author attributions in that material or in the Appropriate Legal |
|
388 |
+ Notices displayed by works containing it; or |
|
389 |
+ |
|
390 |
+ c) Prohibiting misrepresentation of the origin of that material, or |
|
391 |
+ requiring that modified versions of such material be marked in |
|
392 |
+ reasonable ways as different from the original version; or |
|
393 |
+ |
|
394 |
+ d) Limiting the use for publicity purposes of names of licensors or |
|
395 |
+ authors of the material; or |
|
396 |
+ |
|
397 |
+ e) Declining to grant rights under trademark law for use of some |
|
398 |
+ trade names, trademarks, or service marks; or |
|
399 |
+ |
|
400 |
+ f) Requiring indemnification of licensors and authors of that |
|
401 |
+ material by anyone who conveys the material (or modified versions of |
|
402 |
+ it) with contractual assumptions of liability to the recipient, for |
|
403 |
+ any liability that these contractual assumptions directly impose on |
|
404 |
+ those licensors and authors. |
|
405 |
+ |
|
406 |
+ All other non-permissive additional terms are considered "further |
|
407 |
+restrictions" within the meaning of section 10. If the Program as you |
|
408 |
+received it, or any part of it, contains a notice stating that it is |
|
409 |
+governed by this License along with a term that is a further |
|
410 |
+restriction, you may remove that term. If a license document contains |
|
411 |
+a further restriction but permits relicensing or conveying under this |
|
412 |
+License, you may add to a covered work material governed by the terms |
|
413 |
+of that license document, provided that the further restriction does |
|
414 |
+not survive such relicensing or conveying. |
|
415 |
+ |
|
416 |
+ If you add terms to a covered work in accord with this section, you |
|
417 |
+must place, in the relevant source files, a statement of the |
|
418 |
+additional terms that apply to those files, or a notice indicating |
|
419 |
+where to find the applicable terms. |
|
420 |
+ |
|
421 |
+ Additional terms, permissive or non-permissive, may be stated in the |
|
422 |
+form of a separately written license, or stated as exceptions; |
|
423 |
+the above requirements apply either way. |
|
424 |
+ |
|
425 |
+ 8. Termination. |
|
426 |
+ |
|
427 |
+ You may not propagate or modify a covered work except as expressly |
|
428 |
+provided under this License. Any attempt otherwise to propagate or |
|
429 |
+modify it is void, and will automatically terminate your rights under |
|
430 |
+this License (including any patent licenses granted under the third |
|
431 |
+paragraph of section 11). |
|
432 |
+ |
|
433 |
+ However, if you cease all violation of this License, then your |
|
434 |
+license from a particular copyright holder is reinstated (a) |
|
435 |
+provisionally, unless and until the copyright holder explicitly and |
|
436 |
+finally terminates your license, and (b) permanently, if the copyright |
|
437 |
+holder fails to notify you of the violation by some reasonable means |
|
438 |
+prior to 60 days after the cessation. |
|
439 |
+ |
|
440 |
+ Moreover, your license from a particular copyright holder is |
|
441 |
+reinstated permanently if the copyright holder notifies you of the |
|
442 |
+violation by some reasonable means, this is the first time you have |
|
443 |
+received notice of violation of this License (for any work) from that |
|
444 |
+copyright holder, and you cure the violation prior to 30 days after |
|
445 |
+your receipt of the notice. |
|
446 |
+ |
|
447 |
+ Termination of your rights under this section does not terminate the |
|
448 |
+licenses of parties who have received copies or rights from you under |
|
449 |
+this License. If your rights have been terminated and not permanently |
|
450 |
+reinstated, you do not qualify to receive new licenses for the same |
|
451 |
+material under section 10. |
|
452 |
+ |
|
453 |
+ 9. Acceptance Not Required for Having Copies. |
|
454 |
+ |
|
455 |
+ You are not required to accept this License in order to receive or |
|
456 |
+run a copy of the Program. Ancillary propagation of a covered work |
|
457 |
+occurring solely as a consequence of using peer-to-peer transmission |
|
458 |
+to receive a copy likewise does not require acceptance. However, |
|
459 |
+nothing other than this License grants you permission to propagate or |
|
460 |
+modify any covered work. These actions infringe copyright if you do |
|
461 |
+not accept this License. Therefore, by modifying or propagating a |
|
462 |
+covered work, you indicate your acceptance of this License to do so. |
|
463 |
+ |
|
464 |
+ 10. Automatic Licensing of Downstream Recipients. |
|
465 |
+ |
|
466 |
+ Each time you convey a covered work, the recipient automatically |
|
467 |
+receives a license from the original licensors, to run, modify and |
|
468 |
+propagate that work, subject to this License. You are not responsible |
|
469 |
+for enforcing compliance by third parties with this License. |
|
470 |
+ |
|
471 |
+ An "entity transaction" is a transaction transferring control of an |
|
472 |
+organization, or substantially all assets of one, or subdividing an |
|
473 |
+organization, or merging organizations. If propagation of a covered |
|
474 |
+work results from an entity transaction, each party to that |
|
475 |
+transaction who receives a copy of the work also receives whatever |
|
476 |
+licenses to the work the party's predecessor in interest had or could |
|
477 |
+give under the previous paragraph, plus a right to possession of the |
|
478 |
+Corresponding Source of the work from the predecessor in interest, if |
|
479 |
+the predecessor has it or can get it with reasonable efforts. |
|
480 |
+ |
|
481 |
+ You may not impose any further restrictions on the exercise of the |
|
482 |
+rights granted or affirmed under this License. For example, you may |
|
483 |
+not impose a license fee, royalty, or other charge for exercise of |
|
484 |
+rights granted under this License, and you may not initiate litigation |
|
485 |
+(including a cross-claim or counterclaim in a lawsuit) alleging that |
|
486 |
+any patent claim is infringed by making, using, selling, offering for |
|
487 |
+sale, or importing the Program or any portion of it. |
|
488 |
+ |
|
489 |
+ 11. Patents. |
|
490 |
+ |
|
491 |
+ A "contributor" is a copyright holder who authorizes use under this |
|
492 |
+License of the Program or a work on which the Program is based. The |
|
493 |
+work thus licensed is called the contributor's "contributor version". |
|
494 |
+ |
|
495 |
+ A contributor's "essential patent claims" are all patent claims |
|
496 |
+owned or controlled by the contributor, whether already acquired or |
|
497 |
+hereafter acquired, that would be infringed by some manner, permitted |
|
498 |
+by this License, of making, using, or selling its contributor version, |
|
499 |
+but do not include claims that would be infringed only as a |
|
500 |
+consequence of further modification of the contributor version. For |
|
501 |
+purposes of this definition, "control" includes the right to grant |
|
502 |
+patent sublicenses in a manner consistent with the requirements of |
|
503 |
+this License. |
|
504 |
+ |
|
505 |
+ Each contributor grants you a non-exclusive, worldwide, royalty-free |
|
506 |
+patent license under the contributor's essential patent claims, to |
|
507 |
+make, use, sell, offer for sale, import and otherwise run, modify and |
|
508 |
+propagate the contents of its contributor version. |
|
509 |
+ |
|
510 |
+ In the following three paragraphs, a "patent license" is any express |
|
511 |
+agreement or commitment, however denominated, not to enforce a patent |
|
512 |
+(such as an express permission to practice a patent or covenant not to |
|
513 |
+sue for patent infringement). To "grant" such a patent license to a |
|
514 |
+party means to make such an agreement or commitment not to enforce a |
|
515 |
+patent against the party. |
|
516 |
+ |
|
517 |
+ If you convey a covered work, knowingly relying on a patent license, |
|
518 |
+and the Corresponding Source of the work is not available for anyone |
|
519 |
+to copy, free of charge and under the terms of this License, through a |
|
520 |
+publicly available network server or other readily accessible means, |
|
521 |
+then you must either (1) cause the Corresponding Source to be so |
|
522 |
+available, or (2) arrange to deprive yourself of the benefit of the |
|
523 |
+patent license for this particular work, or (3) arrange, in a manner |
|
524 |
+consistent with the requirements of this License, to extend the patent |
|
525 |
+license to downstream recipients. "Knowingly relying" means you have |
|
526 |
+actual knowledge that, but for the patent license, your conveying the |
|
527 |
+covered work in a country, or your recipient's use of the covered work |
|
528 |
+in a country, would infringe one or more identifiable patents in that |
|
529 |
+country that you have reason to believe are valid. |
|
530 |
+ |
|
531 |
+ If, pursuant to or in connection with a single transaction or |
|
532 |
+arrangement, you convey, or propagate by procuring conveyance of, a |
|
533 |
+covered work, and grant a patent license to some of the parties |
|
534 |
+receiving the covered work authorizing them to use, propagate, modify |
|
535 |
+or convey a specific copy of the covered work, then the patent license |
|
536 |
+you grant is automatically extended to all recipients of the covered |
|
537 |
+work and works based on it. |
|
538 |
+ |
|
539 |
+ A patent license is "discriminatory" if it does not include within |
|
540 |
+the scope of its coverage, prohibits the exercise of, or is |
|
541 |
+conditioned on the non-exercise of one or more of the rights that are |
|
542 |
+specifically granted under this License. You may not convey a covered |
|
543 |
+work if you are a party to an arrangement with a third party that is |
|
544 |
+in the business of distributing software, under which you make payment |
|
545 |
+to the third party based on the extent of your activity of conveying |
|
546 |
+the work, and under which the third party grants, to any of the |
|
547 |
+parties who would receive the covered work from you, a discriminatory |
|
548 |
+patent license (a) in connection with copies of the covered work |
|
549 |
+conveyed by you (or copies made from those copies), or (b) primarily |
|
550 |
+for and in connection with specific products or compilations that |
|
551 |
+contain the covered work, unless you entered into that arrangement, |
|
552 |
+or that patent license was granted, prior to 28 March 2007. |
|
553 |
+ |
|
554 |
+ Nothing in this License shall be construed as excluding or limiting |
|
555 |
+any implied license or other defenses to infringement that may |
|
556 |
+otherwise be available to you under applicable patent law. |
|
557 |
+ |
|
558 |
+ 12. No Surrender of Others' Freedom. |
|
559 |
+ |
|
560 |
+ If conditions are imposed on you (whether by court order, agreement or |
|
561 |
+otherwise) that contradict the conditions of this License, they do not |
|
562 |
+excuse you from the conditions of this License. If you cannot convey a |
|
563 |
+covered work so as to satisfy simultaneously your obligations under this |
|
564 |
+License and any other pertinent obligations, then as a consequence you may |
|
565 |
+not convey it at all. For example, if you agree to terms that obligate you |
|
566 |
+to collect a royalty for further conveying from those to whom you convey |
|
567 |
+the Program, the only way you could satisfy both those terms and this |
|
568 |
+License would be to refrain entirely from conveying the Program. |
|
569 |
+ |
|
570 |
+ 13. Use with the GNU Affero General Public License. |
|
571 |
+ |
|
572 |
+ Notwithstanding any other provision of this License, you have |
|
573 |
+permission to link or combine any covered work with a work licensed |
|
574 |
+under version 3 of the GNU Affero General Public License into a single |
|
575 |
+combined work, and to convey the resulting work. The terms of this |
|
576 |
+License will continue to apply to the part which is the covered work, |
|
577 |
+but the special requirements of the GNU Affero General Public License, |
|
578 |
+section 13, concerning interaction through a network will apply to the |
|
579 |
+combination as such. |
|
580 |
+ |
|
581 |
+ 14. Revised Versions of this License. |
|
582 |
+ |
|
583 |
+ The Free Software Foundation may publish revised and/or new versions of |
|
584 |
+the GNU General Public License from time to time. Such new versions will |
|
585 |
+be similar in spirit to the present version, but may differ in detail to |
|
586 |
+address new problems or concerns. |
|
587 |
+ |
|
588 |
+ Each version is given a distinguishing version number. If the |
|
589 |
+Program specifies that a certain numbered version of the GNU General |
|
590 |
+Public License "or any later version" applies to it, you have the |
|
591 |
+option of following the terms and conditions either of that numbered |
|
592 |
+version or of any later version published by the Free Software |
|
593 |
+Foundation. If the Program does not specify a version number of the |
|
594 |
+GNU General Public License, you may choose any version ever published |
|
595 |
+by the Free Software Foundation. |
|
596 |
+ |
|
597 |
+ If the Program specifies that a proxy can decide which future |
|
598 |
+versions of the GNU General Public License can be used, that proxy's |
|
599 |
+public statement of acceptance of a version permanently authorizes you |
|
600 |
+to choose that version for the Program. |
|
601 |
+ |
|
602 |
+ Later license versions may give you additional or different |
|
603 |
+permissions. However, no additional obligations are imposed on any |
|
604 |
+author or copyright holder as a result of your choosing to follow a |
|
605 |
+later version. |
|
606 |
+ |
|
607 |
+ 15. Disclaimer of Warranty. |
|
608 |
+ |
|
609 |
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY |
|
610 |
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT |
|
611 |
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY |
|
612 |
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, |
|
613 |
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
|
614 |
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM |
|
615 |
+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF |
|
616 |
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION. |
|
617 |
+ |
|
618 |
+ 16. Limitation of Liability. |
|
619 |
+ |
|
620 |
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING |
|
621 |
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS |
|
622 |
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY |
|
623 |
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE |
|
624 |
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF |
|
625 |
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD |
|
626 |
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), |
|
627 |
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF |
|
628 |
+SUCH DAMAGES. |
|
629 |
+ |
|
630 |
+ 17. Interpretation of Sections 15 and 16. |
|
631 |
+ |
|
632 |
+ If the disclaimer of warranty and limitation of liability provided |
|
633 |
+above cannot be given local legal effect according to their terms, |
|
634 |
+reviewing courts shall apply local law that most closely approximates |
|
635 |
+an absolute waiver of all civil liability in connection with the |
|
636 |
+Program, unless a warranty or assumption of liability accompanies a |
|
637 |
+copy of the Program in return for a fee. |
|
638 |
+ |
|
639 |
+ END OF TERMS AND CONDITIONS |
|
640 |
+ |
|
641 |
+ How to Apply These Terms to Your New Programs |
|
642 |
+ |
|
643 |
+ If you develop a new program, and you want it to be of the greatest |
|
644 |
+possible use to the public, the best way to achieve this is to make it |
|
645 |
+free software which everyone can redistribute and change under these terms. |
|
646 |
+ |
|
647 |
+ To do so, attach the following notices to the program. It is safest |
|
648 |
+to attach them to the start of each source file to most effectively |
|
649 |
+state the exclusion of warranty; and each file should have at least |
|
650 |
+the "copyright" line and a pointer to where the full notice is found. |
|
651 |
+ |
|
652 |
+ <one line to give the program's name and a brief idea of what it does.> |
|
653 |
+ Copyright (C) <year> <name of author> |
|
654 |
+ |
|
655 |
+ This program is free software: you can redistribute it and/or modify |
|
656 |
+ it under the terms of the GNU General Public License as published by |
|
657 |
+ the Free Software Foundation, either version 3 of the License, or |
|
658 |
+ (at your option) any later version. |
|
659 |
+ |
|
660 |
+ This program is distributed in the hope that it will be useful, |
|
661 |
+ but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
662 |
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
663 |
+ GNU General Public License for more details. |
|
664 |
+ |
|
665 |
+ You should have received a copy of the GNU General Public License |
|
666 |
+ along with this program. If not, see <https://www.gnu.org/licenses/>. |
|
667 |
+ |
|
668 |
+Also add information on how to contact you by electronic and paper mail. |
|
669 |
+ |
|
670 |
+ If the program does terminal interaction, make it output a short |
|
671 |
+notice like this when it starts in an interactive mode: |
|
672 |
+ |
|
673 |
+ <program> Copyright (C) <year> <name of author> |
|
674 |
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. |
|
675 |
+ This is free software, and you are welcome to redistribute it |
|
676 |
+ under certain conditions; type `show c' for details. |
|
677 |
+ |
|
678 |
+The hypothetical commands `show w' and `show c' should show the appropriate |
|
679 |
+parts of the General Public License. Of course, your program's commands |
|
680 |
+might be different; for a GUI interface, you would use an "about box". |
|
681 |
+ |
|
682 |
+ You should also get your employer (if you work as a programmer) or school, |
|
683 |
+if any, to sign a "copyright disclaimer" for the program, if necessary. |
|
684 |
+For more information on this, and how to apply and follow the GNU GPL, see |
|
685 |
+<https://www.gnu.org/licenses/>. |
|
686 |
+ |
|
687 |
+ The GNU General Public License does not permit incorporating your program |
|
688 |
+into proprietary programs. If your program is a subroutine library, you |
|
689 |
+may consider it more useful to permit linking proprietary applications with |
|
690 |
+the library. If this is what you want to do, use the GNU Lesser General |
|
691 |
+Public License instead of this License. But first, please read |
|
692 |
+<https://www.gnu.org/licenses/why-not-lgpl.html>. |
|
693 |
+ |
|
694 |
+ |
|
695 |
+ |
|
696 |
+ GNU LESSER GENERAL PUBLIC LICENSE |
|
697 |
+ Version 3, 29 June 2007 |
|
698 |
+ |
|
699 |
+ Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/> |
|
700 |
+ Everyone is permitted to copy and distribute verbatim copies |
|
701 |
+ of this license document, but changing it is not allowed. |
|
702 |
+ |
|
703 |
+ |
|
704 |
+ This version of the GNU Lesser General Public License incorporates |
|
705 |
+the terms and conditions of version 3 of the GNU General Public |
|
706 |
+License, supplemented by the additional permissions listed below. |
|
707 |
+ |
|
708 |
+ 0. Additional Definitions. |
|
709 |
+ |
|
710 |
+ As used herein, "this License" refers to version 3 of the GNU Lesser |
|
711 |
+General Public License, and the "GNU GPL" refers to version 3 of the GNU |
|
712 |
+General Public License. |
|
713 |
+ |
|
714 |
+ "The Library" refers to a covered work governed by this License, |
|
715 |
+other than an Application or a Combined Work as defined below. |
|
716 |
+ |
|
717 |
+ An "Application" is any work that makes use of an interface provided |
|
718 |
+by the Library, but which is not otherwise based on the Library. |
|
719 |
+Defining a subclass of a class defined by the Library is deemed a mode |
|
720 |
+of using an interface provided by the Library. |
|
721 |
+ |
|
722 |
+ A "Combined Work" is a work produced by combining or linking an |
|
723 |
+Application with the Library. The particular version of the Library |
|
724 |
+with which the Combined Work was made is also called the "Linked |
|
725 |
+Version". |
|
726 |
+ |
|
727 |
+ The "Minimal Corresponding Source" for a Combined Work means the |
|
728 |
+Corresponding Source for the Combined Work, excluding any source code |
|
729 |
+for portions of the Combined Work that, considered in isolation, are |
|
730 |
+based on the Application, and not on the Linked Version. |
|
731 |
+ |
|
732 |
+ The "Corresponding Application Code" for a Combined Work means the |
|
733 |
+object code and/or source code for the Application, including any data |
|
734 |
+and utility programs needed for reproducing the Combined Work from the |
|
735 |
+Application, but excluding the System Libraries of the Combined Work. |
|
736 |
+ |
|
737 |
+ 1. Exception to Section 3 of the GNU GPL. |
|
738 |
+ |
|
739 |
+ You may convey a covered work under sections 3 and 4 of this License |
|
740 |
+without being bound by section 3 of the GNU GPL. |
|
741 |
+ |
|
742 |
+ 2. Conveying Modified Versions. |
|
743 |
+ |
|
744 |
+ If you modify a copy of the Library, and, in your modifications, a |
|
745 |
+facility refers to a function or data to be supplied by an Application |
|
746 |
+that uses the facility (other than as an argument passed when the |
|
747 |
+facility is invoked), then you may convey a copy of the modified |
|
748 |
+version: |
|
749 |
+ |
|
750 |
+ a) under this License, provided that you make a good faith effort to |
|
751 |
+ ensure that, in the event an Application does not supply the |
|
752 |
+ function or data, the facility still operates, and performs |
|
753 |
+ whatever part of its purpose remains meaningful, or |
|
754 |
+ |
|
755 |
+ b) under the GNU GPL, with none of the additional permissions of |
|
756 |
+ this License applicable to that copy. |
|
757 |
+ |
|
758 |
+ 3. Object Code Incorporating Material from Library Header Files. |
|
759 |
+ |
|
760 |
+ The object code form of an Application may incorporate material from |
|
761 |
+a header file that is part of the Library. You may convey such object |
|
762 |
+code under terms of your choice, provided that, if the incorporated |
|
763 |
+material is not limited to numerical parameters, data structure |
|
764 |
+layouts and accessors, or small macros, inline functions and templates |
|
765 |
+(ten or fewer lines in length), you do both of the following: |
|
766 |
+ |
|
767 |
+ a) Give prominent notice with each copy of the object code that the |
|
768 |
+ Library is used in it and that the Library and its use are |
|
769 |
+ covered by this License. |
|
770 |
+ |
|
771 |
+ b) Accompany the object code with a copy of the GNU GPL and this license |
|
772 |
+ document. |
|
773 |
+ |
|
774 |
+ 4. Combined Works. |
|
775 |
+ |
|
776 |
+ You may convey a Combined Work under terms of your choice that, |
|
777 |
+taken together, effectively do not restrict modification of the |
|
778 |
+portions of the Library contained in the Combined Work and reverse |
|
779 |
+engineering for debugging such modifications, if you also do each of |
|
780 |
+the following: |
|
781 |
+ |
|
782 |
+ a) Give prominent notice with each copy of the Combined Work that |
|
783 |
+ the Library is used in it and that the Library and its use are |
|
784 |
+ covered by this License. |
|
785 |
+ |
|
786 |
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license |
|
787 |
+ document. |
|
788 |
+ |
|
789 |
+ c) For a Combined Work that displays copyright notices during |
|
790 |
+ execution, include the copyright notice for the Library among |
|
791 |
+ these notices, as well as a reference directing the user to the |
|
792 |
+ copies of the GNU GPL and this license document. |
|
793 |
+ |
|
794 |
+ d) Do one of the following: |
|
795 |
+ |
|
796 |
+ 0) Convey the Minimal Corresponding Source under the terms of this |
|
797 |
+ License, and the Corresponding Application Code in a form |
|
798 |
+ suitable for, and under terms that permit, the user to |
|
799 |
+ recombine or relink the Application with a modified version of |
|
800 |
+ the Linked Version to produce a modified Combined Work, in the |
|
801 |
+ manner specified by section 6 of the GNU GPL for conveying |
|
802 |
+ Corresponding Source. |
|
803 |
+ |
|
804 |
+ 1) Use a suitable shared library mechanism for linking with the |
|
805 |
+ Library. A suitable mechanism is one that (a) uses at run time |
|
806 |
+ a copy of the Library already present on the user's computer |
|
807 |
+ system, and (b) will operate properly with a modified version |
|
808 |
+ of the Library that is interface-compatible with the Linked |
|
809 |
+ Version. |
|
810 |
+ |
|
811 |
+ e) Provide Installation Information, but only if you would otherwise |
|
812 |
+ be required to provide such information under section 6 of the |
|
813 |
+ GNU GPL, and only to the extent that such information is |
|
814 |
+ necessary to install and execute a modified version of the |
|
815 |
+ Combined Work produced by recombining or relinking the |
|
816 |
+ Application with a modified version of the Linked Version. (If |
|
817 |
+ you use option 4d0, the Installation Information must accompany |
|
818 |
+ the Minimal Corresponding Source and Corresponding Application |
|
819 |
+ Code. If you use option 4d1, you must provide the Installation |
|
820 |
+ Information in the manner specified by section 6 of the GNU GPL |
|
821 |
+ for conveying Corresponding Source.) |
|
822 |
+ |
|
823 |
+ 5. Combined Libraries. |
|
824 |
+ |
|
825 |
+ You may place library facilities that are a work based on the |
|
826 |
+Library side by side in a single library together with other library |
|
827 |
+facilities that are not Applications and are not covered by this |
|
828 |
+License, and convey such a combined library under terms of your |
|
829 |
+choice, if you do both of the following: |
|
830 |
+ |
|
831 |
+ a) Accompany the combined library with a copy of the same work based |
|
832 |
+ on the Library, uncombined with any other library facilities, |
|
833 |
+ conveyed under the terms of this License. |
|
834 |
+ |
|
835 |
+ b) Give prominent notice with the combined library that part of it |
|
836 |
+ is a work based on the Library, and explaining where to find the |
|
837 |
+ accompanying uncombined form of the same work. |
|
838 |
+ |
|
839 |
+ 6. Revised Versions of the GNU Lesser General Public License. |
|
840 |
+ |
|
841 |
+ The Free Software Foundation may publish revised and/or new versions |
|
842 |
+of the GNU Lesser General Public License from time to time. Such new |
|
843 |
+versions will be similar in spirit to the present version, but may |
|
844 |
+differ in detail to address new problems or concerns. |
|
845 |
+ |
|
846 |
+ Each version is given a distinguishing version number. If the |
|
847 |
+Library as you received it specifies that a certain numbered version |
|
848 |
+of the GNU Lesser General Public License "or any later version" |
|
849 |
+applies to it, you have the option of following the terms and |
|
850 |
+conditions either of that published version or of any later version |
|
851 |
+published by the Free Software Foundation. If the Library as you |
|
852 |
+received it does not specify a version number of the GNU Lesser |
|
853 |
+General Public License, you may choose any version of the GNU Lesser |
|
854 |
+General Public License ever published by the Free Software Foundation. |
|
855 |
+ |
|
856 |
+ If the Library as you received it specifies that a proxy can decide |
|
857 |
+whether future versions of the GNU Lesser General Public License shall |
|
858 |
+apply, that proxy's public statement of acceptance of any version is |
|
859 |
+permanent authorization for you to choose that version for the |
|
860 |
+Library. |
|
861 |
+ |
... | ... |
@@ -0,0 +1,144 @@ |
1 |
+declare var plain_text_to_html: (text: string) => string; |
|
2 |
+/** |
|
3 |
+ * @desc makes a valid |
|
4 |
+ */ |
|
5 |
+declare var format_sentence: (str: string, rtl?: boolean, caseSense?: boolean) => string; |
|
6 |
+declare var fill_string_template: (template_string: string, object: any, fabric: Function, delimiter: string, default_string: string, sloppy: boolean) => string; |
|
7 |
+declare var make_string_template: (_template: string, _fabrics?: Object) => (object: { |
|
8 |
+ [key: string]: string; |
|
9 |
+}) => string; |
|
10 |
+declare var make_eml_header: (object: { |
|
11 |
+ [key: string]: string; |
|
12 |
+}) => string; |
|
13 |
+declare var make_eml_body: Object; |
|
14 |
+declare module lib_string { |
|
15 |
+ /** |
|
16 |
+ * @author neuc,frac |
|
17 |
+ */ |
|
18 |
+ function empty(str: string): boolean; |
|
19 |
+ /** |
|
20 |
+ * @desc returns a unique string |
|
21 |
+ * @param {string} prefix an optional prefix for the generated string |
|
22 |
+ * @return {string} |
|
23 |
+ * @author fenris |
|
24 |
+ */ |
|
25 |
+ function generate(prefix?: string): string; |
|
26 |
+ /** |
|
27 |
+ * @desc splits a string, but returns an empty list, if the string is empty |
|
28 |
+ * @param {string} chain |
|
29 |
+ * @param {string} separator |
|
30 |
+ * @return {Array<string>} |
|
31 |
+ * @author fenris |
|
32 |
+ */ |
|
33 |
+ function split(chain: string, separator?: string): Array<string>; |
|
34 |
+ /** |
|
35 |
+ * @author neu3no |
|
36 |
+ */ |
|
37 |
+ function explode(str: string, needle: string, max: int): Array<string>; |
|
38 |
+ /** |
|
39 |
+ * @desc concats a given word with itself n times |
|
40 |
+ * @param {string} word |
|
41 |
+ * @param {int} |
|
42 |
+ * @return {string} |
|
43 |
+ * @author fenris |
|
44 |
+ */ |
|
45 |
+ function repeat(word: string, count: int): string; |
|
46 |
+ /** |
|
47 |
+ * @desc lengthens a string by repeatedly appending or prepending another string |
|
48 |
+ * @param {string} word the string to pad |
|
49 |
+ * @param {int} length the length, which the result shall have |
|
50 |
+ * @param {string} symbol the string, which will be added (multiple times) |
|
51 |
+ * @param {boolean} [prepend]; whether to prepend (~true) or append (~false); default: false |
|
52 |
+ * @return {string} the padded string |
|
53 |
+ * @author fenris |
|
54 |
+ */ |
|
55 |
+ function pad(word: string, length: int, symbol?: string, mode?: string): string; |
|
56 |
+ /** |
|
57 |
+ * @desc checks if a given string conttains a certain substring |
|
58 |
+ * @param {string} string |
|
59 |
+ * @param {string} part |
|
60 |
+ * @return {boolean} |
|
61 |
+ * @author fenris |
|
62 |
+ */ |
|
63 |
+ function contains(chain: string, part: string): boolean; |
|
64 |
+ /** |
|
65 |
+ * @desc checks if a given string starts with a certain substring |
|
66 |
+ * @param {string} string |
|
67 |
+ * @param {string} part |
|
68 |
+ * @return {boolean} |
|
69 |
+ * @author fenris |
|
70 |
+ */ |
|
71 |
+ function startsWith(chain: string, part: string): boolean; |
|
72 |
+ /** |
|
73 |
+ * @desc checks if a given string ends with a certain substring |
|
74 |
+ * @param {string} string |
|
75 |
+ * @param {string} part |
|
76 |
+ * @return {boolean} |
|
77 |
+ * @author fenris |
|
78 |
+ */ |
|
79 |
+ function endsWith(chain: string, part: string): boolean; |
|
80 |
+ /** |
|
81 |
+ * @desc count the occourrences of a string in a string |
|
82 |
+ * @param string haystack_string the string wich should be examined |
|
83 |
+ * @param string needle_string the string which should be counted |
|
84 |
+ * @author neuc |
|
85 |
+ */ |
|
86 |
+ function count_occourrences(haystack_string: string, needle_string: string, check_escape: boolean): int; |
|
87 |
+ /** |
|
88 |
+ * @desc replaces occurences of "${name}" in a string by the corresponding values of an argument object |
|
89 |
+ * @author fenris |
|
90 |
+ */ |
|
91 |
+ function coin(str: string, args: { |
|
92 |
+ [id: string]: string; |
|
93 |
+ }): string; |
|
94 |
+ /** |
|
95 |
+ * @author fenris |
|
96 |
+ */ |
|
97 |
+ var stance: typeof coin; |
|
98 |
+ /** |
|
99 |
+ * @author fenris |
|
100 |
+ */ |
|
101 |
+ function url_encode({ "protocol": protocol, "host": host, "port": port, "path": path, "arguments": arguments_, }?: { |
|
102 |
+ protocol?: string; |
|
103 |
+ host?: string; |
|
104 |
+ port?: int; |
|
105 |
+ path?: string; |
|
106 |
+ arguments?: { |
|
107 |
+ [key: string]: string; |
|
108 |
+ }; |
|
109 |
+ }): string; |
|
110 |
+ /** |
|
111 |
+ * @author fenris |
|
112 |
+ */ |
|
113 |
+ var make_url: typeof url_encode; |
|
114 |
+ /** |
|
115 |
+ * @author fenris |
|
116 |
+ * @todo arguments |
|
117 |
+ */ |
|
118 |
+ function url_decode(url: string): Object; |
|
119 |
+ /** |
|
120 |
+ * @author fenris |
|
121 |
+ */ |
|
122 |
+ function cut(str: string, length: int, delimiter?: string): string; |
|
123 |
+} |
|
124 |
+declare module lib_string { |
|
125 |
+ /** |
|
126 |
+ * an implementation of c sprintf |
|
127 |
+ * @param {string} string format string |
|
128 |
+ * @param {array} args arguments which should be filled into |
|
129 |
+ * @returns {string} |
|
130 |
+ */ |
|
131 |
+ var sprintf: (input: string, args?: any[], original?: any) => string; |
|
132 |
+ /** |
|
133 |
+ * an implementation of c printf |
|
134 |
+ * @param {string} string format string |
|
135 |
+ * @param {array} args arguments which should be filled into |
|
136 |
+ * @returns {string} |
|
137 |
+ */ |
|
138 |
+ function printf(format: any, args: any): void; |
|
139 |
+} |
|
140 |
+declare var sprintf: (input: string, args?: any[], original?: any) => string; |
|
141 |
+declare var printf: typeof lib_string.printf; |
|
142 |
+declare var eml_log: any; |
|
143 |
+declare var track_exports: any; |
|
144 |
+declare var make_logger: (prefix: any, current_loglevel: any) => (obj: any, lvl: any) => void; |
... | ... |
@@ -0,0 +1,906 @@ |
1 |
+/* |
|
2 |
+This file is part of »bacterio-plankton:string«. |
|
3 |
+ |
|
4 |
+Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
5 |
+<info@greenscale.de> |
|
6 |
+ |
|
7 |
+»bacterio-plankton:string« is free software: you can redistribute it and/or modify |
|
8 |
+it under the terms of the GNU Lesser General Public License as published by |
|
9 |
+the Free Software Foundation, either version 3 of the License, or |
|
10 |
+(at your option) any later version. |
|
11 |
+ |
|
12 |
+»bacterio-plankton:string« is distributed in the hope that it will be useful, |
|
13 |
+but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
14 |
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
15 |
+GNU Lesser General Public License for more details. |
|
16 |
+ |
|
17 |
+You should have received a copy of the GNU Lesser General Public License |
|
18 |
+along with »bacterio-plankton:string«. If not, see <http://www.gnu.org/licenses/>. |
|
19 |
+ */ |
|
20 |
+var plain_text_to_html = function (text) { |
|
21 |
+ var ret = text; |
|
22 |
+ ret = ret.replace(/ /g, " "); // convert multiple whitespace to forced ones |
|
23 |
+ ret = ret.split("\n").join("<br/>"); |
|
24 |
+ return ret; |
|
25 |
+}; |
|
26 |
+/** |
|
27 |
+ * @desc makes a valid |
|
28 |
+ */ |
|
29 |
+var format_sentence = function (str, rtl, caseSense) { |
|
30 |
+ if (rtl === void 0) { rtl = false; } |
|
31 |
+ if (caseSense === void 0) { caseSense = true; } |
|
32 |
+ if (str === "") { |
|
33 |
+ return str; |
|
34 |
+ } |
|
35 |
+ else { |
|
36 |
+ var marks = { |
|
37 |
+ ".": true, |
|
38 |
+ "?": true, |
|
39 |
+ "!": true |
|
40 |
+ }; |
|
41 |
+ var default_mark = "."; |
|
42 |
+ var ret = str.split(""); |
|
43 |
+ if (!rtl) { |
|
44 |
+ ret[0] = ret[0].toLocaleUpperCase(); |
|
45 |
+ if (!(ret[ret.length - 1] in marks)) { |
|
46 |
+ ret.push(default_mark); |
|
47 |
+ } |
|
48 |
+ } |
|
49 |
+ else { |
|
50 |
+ ret[ret.length - 1] = ret[ret.length - 1].toLocaleUpperCase(); |
|
51 |
+ if (!(ret[0] in marks)) { |
|
52 |
+ ret.unshift(default_mark); |
|
53 |
+ } |
|
54 |
+ } |
|
55 |
+ return ret.join(""); |
|
56 |
+ } |
|
57 |
+}; |
|
58 |
+var fill_string_template = function (template_string, object, fabric, delimiter, default_string, sloppy) { |
|
59 |
+ if (fabric === void 0) { fabric = function (object, key) { return object[key]; }; } |
|
60 |
+ if (delimiter === void 0) { delimiter = "%"; } |
|
61 |
+ if (default_string === void 0) { default_string = null; } |
|
62 |
+ function get_tags(str) { |
|
63 |
+ var r = new RegExp(delimiter + "[^\\s^" + delimiter + "]+" + delimiter, "gi"); |
|
64 |
+ return ((str.match(r) || []).map(function (e) { |
|
65 |
+ return e.slice(delimiter.length, e.length - delimiter.length); |
|
66 |
+ })); |
|
67 |
+ } |
|
68 |
+ function replace_tag(str, tag, value) { |
|
69 |
+ var r = new RegExp(delimiter + tag + delimiter, "gi"); |
|
70 |
+ return str.replace(r, value); |
|
71 |
+ } |
|
72 |
+ function replace_tags(str, obj) { |
|
73 |
+ return (get_tags(str).reduce(function (ret, key) { |
|
74 |
+ var value = ""; |
|
75 |
+ try { |
|
76 |
+ value = fabric(obj, key); |
|
77 |
+ if ((!sloppy && (value === void 0)) || (sloppy && (value == void 0))) { |
|
78 |
+ value = default_string; |
|
79 |
+ } |
|
80 |
+ } |
|
81 |
+ catch (e) { |
|
82 |
+ console.warn("invalid placeholder " + key); |
|
83 |
+ value = default_string; |
|
84 |
+ } |
|
85 |
+ return replace_tag(ret, key, value); |
|
86 |
+ }, str)); |
|
87 |
+ } |
|
88 |
+ return replace_tags(template_string, object); |
|
89 |
+}; |
|
90 |
+var make_string_template = function (_template, _fabrics) { |
|
91 |
+ if (_fabrics === void 0) { _fabrics = {}; } |
|
92 |
+ function replace_tag(str, tag, value) { |
|
93 |
+ var r = new RegExp("%" + tag + "%", "gi"); |
|
94 |
+ return str.replace(r, value); |
|
95 |
+ } |
|
96 |
+ function replace_tags(str, obj) { |
|
97 |
+ return (Object.keys(obj).reduce(function (ret, key) { |
|
98 |
+ return replace_tag(ret, key, _fabrics[key] || obj[key]); |
|
99 |
+ }, str)); |
|
100 |
+ } |
|
101 |
+ return (function (tags) { |
|
102 |
+ return replace_tags(_template, tags); |
|
103 |
+ }); |
|
104 |
+}; |
|
105 |
+var make_eml_header = (function () { |
|
106 |
+ var _template = ""; |
|
107 |
+ _template += "From: %from%\n"; |
|
108 |
+ _template += "To: %recipient%\n"; |
|
109 |
+ _template += "Subject: %subject%\n"; |
|
110 |
+ _template += "X-Mailer: greenscale-plankton.emlgen\n"; |
|
111 |
+ return make_string_template(_template); |
|
112 |
+})(); |
|
113 |
+var make_eml_body = (function () { |
|
114 |
+ var exports = {}; |
|
115 |
+ exports["simple_body"] = make_string_template("Content-Type: %contenttype%\n\n%body%\n\n"); |
|
116 |
+ // very basic implementation |
|
117 |
+ // parts = [{contenttype:"text/html; charset=UTF-8", body: "<h1>foo</h1>" }, {...}] |
|
118 |
+ exports["body_boundrary"] = function (parts, boundrary) { |
|
119 |
+ var _template = ""; |
|
120 |
+ _template += "--%boundrary%\n"; |
|
121 |
+ _template += "Content-Type: %contenttype%\n\n%body%\n\n"; |
|
122 |
+ //_template += "--%boundrary%--\n\n"; |
|
123 |
+ var maker = make_string_template(_template); |
|
124 |
+ return (parts.reduce(function (prev, curr) { |
|
125 |
+ curr.boundrary = boundrary; |
|
126 |
+ return [prev, maker(curr)].join(""); |
|
127 |
+ }, "")); |
|
128 |
+ }; |
|
129 |
+ // body must be base64 encoded! |
|
130 |
+ exports["attachment_boundrary"] = function (parts, boundrary) { |
|
131 |
+ var _template = ""; |
|
132 |
+ _template += "--%boundrary%\n"; |
|
133 |
+ _template += "Content-Type: %contenttype%\n"; |
|
134 |
+ _template += "Content-Transfer-Encoding: base64\n"; |
|
135 |
+ _template += "Content-Disposition: %disposition%; filename=\"%name%\"\n\n"; |
|
136 |
+ _template += "%body%\n\n"; |
|
137 |
+ //_template += "--%boundrary%--\n\n"; |
|
138 |
+ var maker = make_string_template(_template); |
|
139 |
+ return (parts.reduce(function (prev, curr) { |
|
140 |
+ curr.boundrary = boundrary; |
|
141 |
+ if (curr.disposition === void 0) |
|
142 |
+ curr.disposition = "inline"; |
|
143 |
+ return [prev, maker(curr)].join(""); |
|
144 |
+ }, "")); |
|
145 |
+ }; |
|
146 |
+ exports["gen_boundrary"] = function () { |
|
147 |
+ return ("xxxxxxxxxxxxxxxxxxxxxx".replace(/[xy]/g, function (c) { |
|
148 |
+ var r = crypto.getRandomValues(new Uint8Array(1))[0] % 16 | 0, v = c == "x" ? r : (r & 0x3 | 0x8); |
|
149 |
+ return v.toString(16); |
|
150 |
+ })); |
|
151 |
+ }; |
|
152 |
+ // simple implementation without alternatives (old rfc) |
|
153 |
+ exports["complete_boundrary"] = function (bodyparts, attachments) { |
|
154 |
+ var ret = ""; |
|
155 |
+ var boundrary = exports["gen_boundrary"](); |
|
156 |
+ ret += exports["body_boundrary"](bodyparts, boundrary); |
|
157 |
+ ret += exports["attachment_boundrary"](attachments, boundrary); |
|
158 |
+ ret += "--" + boundrary + "--\n\nINVISIBLE!!!!"; |
|
159 |
+ return (exports["simple_body"]({ |
|
160 |
+ "contenttype": sprintf("multipart/mixed; boundary=%s", [boundrary]), |
|
161 |
+ "body": ret |
|
162 |
+ })); |
|
163 |
+ }; |
|
164 |
+ return exports; |
|
165 |
+})(); |
|
166 |
+/* |
|
167 |
+This file is part of »bacterio-plankton:string«. |
|
168 |
+ |
|
169 |
+Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
170 |
+<info@greenscale.de> |
|
171 |
+ |
|
172 |
+»bacterio-plankton:string« is free software: you can redistribute it and/or modify |
|
173 |
+it under the terms of the GNU Lesser General Public License as published by |
|
174 |
+the Free Software Foundation, either version 3 of the License, or |
|
175 |
+(at your option) any later version. |
|
176 |
+ |
|
177 |
+»bacterio-plankton:string« is distributed in the hope that it will be useful, |
|
178 |
+but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
179 |
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
180 |
+GNU Lesser General Public License for more details. |
|
181 |
+ |
|
182 |
+You should have received a copy of the GNU Lesser General Public License |
|
183 |
+along with »bacterio-plankton:string«. If not, see <http://www.gnu.org/licenses/>. |
|
184 |
+ */ |
|
185 |
+var lib_string; |
|
186 |
+(function (lib_string) { |
|
187 |
+ /** |
|
188 |
+ * @author fenris |
|
189 |
+ */ |
|
190 |
+ var hexdigits = 4; |
|
191 |
+ /** |
|
192 |
+ * @author fenris |
|
193 |
+ */ |
|
194 |
+ var index_max = (1 << (4 * hexdigits)); |
|
195 |
+ /** |
|
196 |
+ * @author fenris |
|
197 |
+ */ |
|
198 |
+ var index_is = 0; |
|
199 |
+ /** |
|
200 |
+ * @author neuc,frac |
|
201 |
+ */ |
|
202 |
+ function empty(str) { |
|
203 |
+ return (str.trim() === ""); |
|
204 |
+ } |
|
205 |
+ lib_string.empty = empty; |
|
206 |
+ /** |
|
207 |
+ * @desc returns a unique string |
|
208 |
+ * @param {string} prefix an optional prefix for the generated string |
|
209 |
+ * @return {string} |
|
210 |
+ * @author fenris |
|
211 |
+ */ |
|
212 |
+ function generate(prefix) { |
|
213 |
+ if (prefix === void 0) { prefix = "string_"; } |
|
214 |
+ if (index_is > index_max) { |
|
215 |
+ throw (new Error("[string_generate] out of valid indices")); |
|
216 |
+ } |
|
217 |
+ else { |
|
218 |
+ return lib_string.sprintf(prefix + "%0" + hexdigits.toString() + "X", [index_is++]); |
|
219 |
+ } |
|
220 |
+ } |
|
221 |
+ lib_string.generate = generate; |
|
222 |
+ /** |
|
223 |
+ * @desc splits a string, but returns an empty list, if the string is empty |
|
224 |
+ * @param {string} chain |
|
225 |
+ * @param {string} separator |
|
226 |
+ * @return {Array<string>} |
|
227 |
+ * @author fenris |
|
228 |
+ */ |
|
229 |
+ function split(chain, separator) { |
|
230 |
+ if (separator === void 0) { separator = " "; } |
|
231 |
+ if (chain.length == 0) { |
|
232 |
+ return []; |
|
233 |
+ } |
|
234 |
+ else { |
|
235 |
+ return chain.split(separator); |
|
236 |
+ } |
|
237 |
+ } |
|
238 |
+ lib_string.split = split; |
|
239 |
+ /** |
|
240 |
+ * @author neu3no |
|
241 |
+ */ |
|
242 |
+ function explode(str, needle, max) { |
|
243 |
+ var temp = str.split(needle); |
|
244 |
+ var right = temp.splice(max - 1); |
|
245 |
+ temp.push(right.join(needle)); |
|
246 |
+ return temp; |
|
247 |
+ } |
|
248 |
+ lib_string.explode = explode; |
|
249 |
+ /** |
|
250 |
+ * @desc concats a given word with itself n times |
|
251 |
+ * @param {string} word |
|
252 |
+ * @param {int} |
|
253 |
+ * @return {string} |
|
254 |
+ * @author fenris |
|
255 |
+ */ |
|
256 |
+ function repeat(word, count) { |
|
257 |
+ // return ((count == 0) ? "" : (word + repeat(word, count-1))); |
|
258 |
+ var result = ""; |
|
259 |
+ for (var n = 0; n < count; n += 1) { |
|
260 |
+ result += word; |
|
261 |
+ } |
|
262 |
+ return result; |
|
263 |
+ } |
|
264 |
+ lib_string.repeat = repeat; |
|
265 |
+ /** |
|
266 |
+ * @desc lengthens a string by repeatedly appending or prepending another string |
|
267 |
+ * @param {string} word the string to pad |
|
268 |
+ * @param {int} length the length, which the result shall have |
|
269 |
+ * @param {string} symbol the string, which will be added (multiple times) |
|
270 |
+ * @param {boolean} [prepend]; whether to prepend (~true) or append (~false); default: false |
|
271 |
+ * @return {string} the padded string |
|
272 |
+ * @author fenris |
|
273 |
+ */ |
|
274 |
+ function pad(word, length, symbol, mode) { |
|
275 |
+ if (symbol === void 0) { symbol = " "; } |
|
276 |
+ if (mode === void 0) { mode = "append"; } |
|
277 |
+ switch (mode) { |
|
278 |
+ case "prepend": { |
|
279 |
+ // insert symbols only at the beginning |
|
280 |
+ while (word.length < length) |
|
281 |
+ word = symbol + word; |
|
282 |
+ return word.substring(word.length - length); |
|
283 |
+ break; |
|
284 |
+ } |
|
285 |
+ case "append": { |
|
286 |
+ // insert symbols only at the end |
|
287 |
+ while (word.length < length) |
|
288 |
+ word = word + symbol; |
|
289 |
+ return word.substring(0, length); |
|
290 |
+ break; |
|
291 |
+ } |
|
292 |
+ case "widen": { |
|
293 |
+ // insert symbols at both sides |
|
294 |
+ var left = (((length - word.length) & 1) === 0); |
|
295 |
+ while (word.length < length) { |
|
296 |
+ word = (left |
|
297 |
+ ? (symbol + word) |
|
298 |
+ : (word + symbol)); |
|
299 |
+ left = (!left); |
|
300 |
+ } |
|
301 |
+ return word.substring(0, length); |
|
302 |
+ break; |
|
303 |
+ } |
|
304 |
+ default: { |
|
305 |
+ var message = ("unhandled mode '" + mode + "'"); |
|
306 |
+ console.warn(message); |
|
307 |
+ return word; |
|
308 |
+ break; |
|
309 |
+ } |
|
310 |
+ } |
|
311 |
+ } |
|
312 |
+ lib_string.pad = pad; |
|
313 |
+ /** |
|
314 |
+ * @desc checks if a given string conttains a certain substring |
|
315 |
+ * @param {string} string |
|
316 |
+ * @param {string} part |
|
317 |
+ * @return {boolean} |
|
318 |
+ * @author fenris |
|
319 |
+ */ |
|
320 |
+ function contains(chain, part) { |
|
321 |
+ if (typeof (chain) !== "string") { |
|
322 |
+ return false; |
|
323 |
+ } |
|
324 |
+ return (chain.indexOf(part) >= 0); |
|
325 |
+ } |
|
326 |
+ lib_string.contains = contains; |
|
327 |
+ /** |
|
328 |
+ * @desc checks if a given string starts with a certain substring |
|
329 |
+ * @param {string} string |
|
330 |
+ * @param {string} part |
|
331 |
+ * @return {boolean} |
|
332 |
+ * @author fenris |
|
333 |
+ */ |
|
334 |
+ function startsWith(chain, part) { |
|
335 |
+ if (typeof (chain) !== "string") { |
|
336 |
+ return false; |
|
337 |
+ } |
|
338 |
+ // return (string.indexOf(part) === 0); |
|
339 |
+ return ((function (m, n) { |
|
340 |
+ if (n === 0) { |
|
341 |
+ return true; |
|
342 |
+ } |
|
343 |
+ else { |
|
344 |
+ if (m === 0) { |
|
345 |
+ return false; |
|
346 |
+ } |
|
347 |
+ else { |
|
348 |
+ return ((chain[0] == part[0]) |
|
349 |
+ && |
|
350 |
+ startsWith(chain.substring(1), part.substring(1))); |
|
351 |
+ } |
|
352 |
+ } |
|
353 |
+ })(chain.length, part.length)); |
|
354 |
+ } |
|
355 |
+ lib_string.startsWith = startsWith; |
|
356 |
+ /** |
|
357 |
+ * @desc checks if a given string ends with a certain substring |
|
358 |
+ * @param {string} string |
|
359 |
+ * @param {string} part |
|
360 |
+ * @return {boolean} |
|
361 |
+ * @author fenris |
|
362 |
+ */ |
|
363 |
+ function endsWith(chain, part) { |
|
364 |
+ if (typeof (chain) !== "string") { |
|
365 |
+ return false; |
|
366 |
+ } |
|
367 |
+ // return (string.lastIndexOf(part) === string.length-part.length); |
|
368 |
+ return ((function (m, n) { |
|
369 |
+ if (n === 0) { |
|
370 |
+ return true; |
|
371 |
+ } |
|
372 |
+ else { |
|
373 |
+ if (m === 0) { |
|
374 |
+ return false; |
|
375 |
+ } |
|
376 |
+ else { |
|
377 |
+ // console.info(("(" + string[m-1] + " == " + part[n-1] + ")") + " = " + String(string[m-1] == part[n-1])); |
|
378 |
+ return ((chain[m - 1] === part[n - 1]) |
|
379 |
+ && |
|
380 |
+ endsWith(chain.substring(0, m - 1), part.substring(0, n - 1))); |
|
381 |
+ } |
|
382 |
+ } |
|
383 |
+ })(chain.length, part.length)); |
|
384 |
+ } |
|
385 |
+ lib_string.endsWith = endsWith; |
|
386 |
+ /** |
|
387 |
+ * @desc count the occourrences of a string in a string |
|
388 |
+ * @param string haystack_string the string wich should be examined |
|
389 |
+ * @param string needle_string the string which should be counted |
|
390 |
+ * @author neuc |
|
391 |
+ */ |
|
392 |
+ function count_occourrences(haystack_string, needle_string, check_escape) { |
|
393 |
+ var cnt = 0; |
|
394 |
+ var pos = -1; |
|
395 |
+ do { |
|
396 |
+ pos = haystack_string.indexOf(needle_string, pos + 1); |
|
397 |
+ if ((!check_escape) || (haystack_string[pos - 1] != "\\")) { |
|
398 |
+ cnt++; |
|
399 |
+ } |
|
400 |
+ } while (pos >= 0); |
|
401 |
+ return (cnt - 1); |
|
402 |
+ } |
|
403 |
+ lib_string.count_occourrences = count_occourrences; |
|
404 |
+ /** |
|
405 |
+ * @desc replaces occurences of "${name}" in a string by the corresponding values of an argument object |
|
406 |
+ * @author fenris |
|
407 |
+ */ |
|
408 |
+ function coin(str, args) { |
|
409 |
+ Object.keys(args).forEach(function (key) { |
|
410 |
+ // old syntax |
|
411 |
+ { |
|
412 |
+ var value = args[key]; |
|
413 |
+ var regexp_argument = new RegExp("\\${" + key + "}"); |
|
414 |
+ str = str.replace(regexp_argument, value); |
|
415 |
+ } |
|
416 |
+ // new syntax |
|
417 |
+ { |
|
418 |
+ var value = args[key]; |
|
419 |
+ var regexp_argument = new RegExp("{{" + key + "}}"); |
|
420 |
+ str = str.replace(regexp_argument, value); |
|
421 |
+ } |
|
422 |
+ }); |
|
423 |
+ return str; |
|
424 |
+ } |
|
425 |
+ lib_string.coin = coin; |
|
426 |
+ /** |
|
427 |
+ * @author fenris |
|
428 |
+ */ |
|
429 |
+ lib_string.stance = coin; |
|
430 |
+ /** |
|
431 |
+ * @author fenris |
|
432 |
+ */ |
|
433 |
+ function url_encode(_a) { |
|
434 |
+ var _b = _a === void 0 ? {} : _a, _c = _b["protocol"], protocol = _c === void 0 ? null : _c, _d = _b["host"], host = _d === void 0 ? null : _d, _e = _b["port"], port = _e === void 0 ? null : _e, _f = _b["path"], path = _f === void 0 ? null : _f, _g = _b["arguments"], arguments_ = _g === void 0 ? null : _g; |
|
435 |
+ var url = ""; |
|
436 |
+ // protocol |
|
437 |
+ { |
|
438 |
+ if (protocol != null) { |
|
439 |
+ url = protocol + ":" + url; |
|
440 |
+ } |
|
441 |
+ } |
|
442 |
+ // host |
|
443 |
+ { |
|
444 |
+ if (host != null) { |
|
445 |
+ url = url + "//" + host; |
|
446 |
+ } |
|
447 |
+ } |
|
448 |
+ // port |
|
449 |
+ { |
|
450 |
+ if (port != null) { |
|
451 |
+ url = url + ":" + port.toString(); |
|
452 |
+ } |
|
453 |
+ } |
|
454 |
+ // path |
|
455 |
+ { |
|
456 |
+ if (path != null) { |
|
457 |
+ var path_ = encodeURI(path); |
|
458 |
+ url = "" + url + path_; |
|
459 |
+ } |
|
460 |
+ } |
|
461 |
+ // arguments |
|
462 |
+ { |
|
463 |
+ if (arguments_ != null) { |
|
464 |
+ var suffix = Object.keys(arguments_).map(function (key) { return key + "=" + arguments_[key]; }).join("&"); |
|
465 |
+ var suffix_ = encodeURI(suffix); |
|
466 |
+ url = url + "?" + suffix_; |
|
467 |
+ } |
|
468 |
+ } |
|
469 |
+ return url; |
|
470 |
+ } |
|
471 |
+ lib_string.url_encode = url_encode; |
|
472 |
+ /** |
|
473 |
+ * @author fenris |
|
474 |
+ */ |
|
475 |
+ lib_string.make_url = url_encode; |
|
476 |
+ /** |
|
477 |
+ * @author fenris |
|
478 |
+ * @todo arguments |
|
479 |
+ */ |
|
480 |
+ function url_decode(url) { |
|
481 |
+ var regexp = new RegExp("^([^:]*)://([^:]*):([^/]*)/(.*)$"); |
|
482 |
+ var matching = regexp.exec(url); |
|
483 |
+ if (matching === null) { |
|
484 |
+ return null; |
|
485 |
+ } |
|
486 |
+ else { |
|
487 |
+ var components = { |
|
488 |
+ "protocol": matching[1], |
|
489 |
+ "host": matching[2], |
|
490 |
+ "port": parseInt(matching[3]), |
|
491 |
+ "path": ("/" + matching[4]) |
|
492 |
+ }; |
|
493 |
+ return components; |
|
494 |
+ } |
|
495 |
+ } |
|
496 |
+ lib_string.url_decode = url_decode; |
|
497 |
+ /** |
|
498 |
+ * @author fenris |
|
499 |
+ */ |
|
500 |
+ function cut(str, length, delimiter) { |
|
501 |
+ if (delimiter === void 0) { delimiter = "…"; } |
|
502 |
+ if (str.length <= length) { |
|
503 |
+ return str; |
|
504 |
+ } |
|
505 |
+ else { |
|
506 |
+ return (str.slice(0, length - delimiter.length) + delimiter); |
|
507 |
+ } |
|
508 |
+ } |
|
509 |
+ lib_string.cut = cut; |
|
510 |
+})(lib_string || (lib_string = {})); |
|
511 |
+/* |
|
512 |
+This file is part of »bacterio-plankton:string«. |
|
513 |
+ |
|
514 |
+Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
515 |
+<info@greenscale.de> |
|
516 |
+ |
|
517 |
+»bacterio-plankton:string« is free software: you can redistribute it and/or modify |
|
518 |
+it under the terms of the GNU Lesser General Public License as published by |
|
519 |
+the Free Software Foundation, either version 3 of the License, or |
|
520 |
+(at your option) any later version. |
|
521 |
+ |
|
522 |
+»bacterio-plankton:string« is distributed in the hope that it will be useful, |
|
523 |
+but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
524 |
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
525 |
+GNU Lesser General Public License for more details. |
|
526 |
+ |
|
527 |
+You should have received a copy of the GNU Lesser General Public License |
|
528 |
+along with »bacterio-plankton:string«. If not, see <http://www.gnu.org/licenses/>. |
|
529 |
+ */ |
|
530 |
+var lib_string; |
|
531 |
+(function (lib_string) { |
|
532 |
+ var pattern = /%([-+#0 ]*)([0-9]*)[\.]{0,1}([0-9]*)([\w]{1})/; |
|
533 |
+ var gpattern = /%([-+#0 ]*)([0-9]*)[\.]{0,1}([0-9]*)([\w]{1})/g; |
|
534 |
+ function split_format(format) { |
|
535 |
+ var tmp = format.match(pattern); |
|
536 |
+ if (tmp === null) |
|
537 |
+ return null; |
|
538 |
+ return { |
|
539 |
+ 'flags': tmp[1].split(""), |
|
540 |
+ 'width': Number(tmp[2]), |
|
541 |
+ 'precision': tmp[3] === '' ? null : Number(tmp[3]), |
|
542 |
+ 'specifier': tmp[4], |
|
543 |
+ 'string': format |
|
544 |
+ }; |
|
545 |
+ } |
|
546 |
+ function make_err(format, arg, should) { |
|
547 |
+ return ("[sprintf]" + " " + "argument for '" + format.string + "' has to be '" + should + "' but '" + arg + "' is '" + typeof arg + "'!"); |
|
548 |
+ } |
|
549 |
+ function test_arg(format, arg, should) { |
|
550 |
+ if (typeof arg !== should) { |
|
551 |
+ console.warn(make_err(format, arg, should)); |
|
552 |
+ return false; |
|
553 |
+ } |
|
554 |
+ return true; |
|
555 |
+ } |
|
556 |
+ function string_fill(str, char, len, left) { |
|
557 |
+ while (str.length < len) { |
|
558 |
+ if (left) { |
|
559 |
+ str += char; |
|
560 |
+ } |
|
561 |
+ else { |
|
562 |
+ str = char + str; |
|
563 |
+ } |
|
564 |
+ } |
|
565 |
+ return str; |
|
566 |
+ } |
|
567 |
+ /** |
|
568 |
+ * the known_parameters are used to parse the different identifiers for the welln known syntax: |
|
569 |
+ * flag width precision identifier |
|
570 |
+ * %{[0#+- ]}{[0-9]*}.{[0-9]*}[fFdiueEgGsoxXaAsn] |
|
571 |
+ * flags: |
|
572 |
+ * 0 - fill with '0' instead of ' ' if the string length < width |
|
573 |
+ * # - not implemented |
|
574 |
+ * - - left-justified -> fill on the right side to reach width |
|
575 |
+ * + - force using '+' on positive numbers |
|
576 |
+ * ' ' - add a single space before positive numbers |
|
577 |
+ * |
|
578 |
+ * identifiers |
|
579 |
+ * %f, %F - interpret given number as float, width: the minimal total width (fill with ' ' or '0' if the |
|
580 |
+ * resulting string is too short, precision: cut more then given decimal places |
|
581 |
+ * %d, %i, %u - interpret number as integer, decimal places will be cut. width: like float, precision: |
|
582 |
+ * fill with '0' on right side until length given in precision is reached |
|
583 |
+ * %e - interpret as float and write as scientifical number, width & precision like in float |
|
584 |
+ * %E - same es %e but uppercase 'E' |
|
585 |
+ * %g - use the shortest string of %f or %e |
|
586 |
+ * %G - use the shortest string of %E or %E |
|
587 |
+ * %s - simply print a string |
|
588 |
+ * %o - print the given number in octal notation |
|
589 |
+ * %x - print the given number in hex notation |
|
590 |
+ * %X - same as %x but with uppercase characters |
|
591 |
+ * %a - alias to %x |
|
592 |
+ * %A - alias to %X |
|
593 |
+ * %n - just print nothing |
|
594 |
+ * @type {{}} |
|
595 |
+ */ |
|
596 |
+ var known_params = {}; |
|
597 |
+ known_params["f"] = function (format, arg) { |
|
598 |
+ if (!test_arg(format, arg, "number")) |
|
599 |
+ return "Ø"; |
|
600 |
+ var tmp = Math.abs(arg); |
|
601 |
+ var sign = (arg < 0) ? -1 : 1; |
|
602 |
+ var tmp_result = null; |
|
603 |
+ if (format.precision !== null) { |
|
604 |
+ tmp = Math.floor(Math.pow(10, format.precision) * tmp) / Math.pow(10, format.precision); |
|
605 |
+ var tmp_ = (tmp * sign).toString().split("."); |
|
606 |
+ if (tmp_.length === 1) |
|
607 |
+ tmp_.push(""); |
|
608 |
+ tmp_[1] = string_fill(tmp_[1], "0", format.precision, true); |
|
609 |
+ tmp_result = tmp_.join("."); |
|
610 |
+ } |
|
611 |
+ else { |
|
612 |
+ tmp_result = (sign * tmp).toString(); |
|
613 |
+ } |
|
614 |
+ if ((format.flags.indexOf(" ") >= 0) && (arg >= 0)) { |
|
615 |
+ tmp_result = " " + tmp; |
|
616 |
+ } |
|
617 |
+ else if ((format.flags.indexOf("+") >= 0) && (arg >= 0)) { |
|
618 |
+ tmp_result = "+" + tmp; |
|
619 |
+ } |
|
620 |
+ tmp_result = string_fill(tmp, (format.flags.indexOf("0") >= 0) ? "0" : " ", format.width, (format.flags.indexOf("-") >= 0)); |
|
621 |
+ return tmp_result; |
|
622 |
+ }; |
|
623 |
+ known_params["F"] = known_params["f"]; |
|
624 |
+ known_params["d"] = function (format, arg) { |
|
625 |
+ if (!test_arg(format, arg, 'number')) |
|
626 |
+ return 'Ø'; |
|
627 |
+ var tmp = (((arg < 0 && format.specifier !== 'u') ? -1 : 1) * Math.floor(Math.abs(arg))).toString(); |
|
628 |
+ if ((format.specifier === 'd' || format.specifier === 'i') && format.flags.indexOf(' ') >= 0 && arg >= 0) { |
|
629 |
+ tmp = ' ' + tmp; |
|
630 |
+ } |
|
631 |
+ else if ((format.specifier === 'd' || format.specifier === 'i') && format.flags.indexOf('+') >= 0 && arg >= 0) { |
|
632 |
+ tmp = '+' + tmp; |
|
633 |
+ } |
|
634 |
+ tmp = string_fill(tmp, format.flags.indexOf('0') >= 0 ? '0' : ' ', format.width, format.flags.indexOf('-') >= 0); |
|
635 |
+ tmp = string_fill(tmp, '0', format.precision === null ? 0 : format.precision, false); |
|
636 |
+ return tmp; |
|
637 |
+ }; |
|
638 |
+ known_params["i"] = known_params["d"]; |
|
639 |
+ known_params["u"] = known_params["d"]; |
|
640 |
+ known_params["e"] = function (format, arg) { |
|
641 |
+ if (!test_arg(format, arg, 'number')) |
|
642 |
+ return 'Ø'; |
|
643 |
+ var tmp = arg.toExponential(format.precision === null ? undefined : format.precision).toString(); |
|
644 |
+ if (format.flags.indexOf(' ') >= 0 && arg >= 0) { |
|
645 |
+ tmp = ' ' + tmp; |
|
646 |
+ } |
|
647 |
+ else if (format.flags.indexOf('+') >= 0 && arg >= 0) { |
|
648 |
+ tmp = '+' + tmp; |
|
649 |
+ } |
|
650 |
+ tmp = string_fill(tmp, format.flags.indexOf('0') >= 0 ? '0' : ' ', format.width, format.flags.indexOf('-') >= 0); |
|
651 |
+ return tmp; |
|
652 |
+ }; |
|
653 |
+ known_params["E"] = function (format, arg) { |
|
654 |
+ return known_params["e"](format, arg).toUpperCase(); |
|
655 |
+ }; |
|
656 |
+ known_params["g"] = function (format, arg) { |
|
657 |
+ if (!test_arg(format, arg, 'number')) |
|
658 |
+ return 'Ø'; |
|
659 |
+ var tmpf = known_params["f"](format, arg); |
|
660 |
+ var tmpe = known_params["e"](format, arg); |
|
661 |
+ if (tmpf.length < tmpe.length) { |
|
662 |
+ return tmpf; |
|
663 |
+ } |
|
664 |
+ else { |
|
665 |
+ return tmpe; |
|
666 |
+ } |
|
667 |
+ }; |
|
668 |
+ known_params["G"] = function (format, arg) { |
|
669 |
+ return known_params["g"](format, arg).toUpperCase(); |
|
670 |
+ }; |
|
671 |
+ known_params["s"] = function (format, arg) { |
|
672 |
+ if (!test_arg(format, arg, 'string')) |
|
673 |
+ return 'o.O'; |
|
674 |
+ var tmp = format.precision !== null ? arg.substr(0, format.precision) : arg; |
|
675 |
+ tmp = string_fill(tmp, format.flags.indexOf('0') >= 0 ? '0' : ' ', format.width, format.flags.indexOf('-') >= 0); |
|
676 |
+ return tmp; |
|
677 |
+ }; |
|
678 |
+ known_params["o"] = function (format, arg) { |
|
679 |
+ if (!test_arg(format, arg, 'number')) |
|
680 |
+ return 'Ø'; |
|
681 |
+ var tmp = Math.floor(Math.round(Math.abs(arg))) * ((arg < 0) ? -1 : 1); |
|
682 |
+ return known_params["s"](format, tmp.toString(8)); |
|
683 |
+ }; |
|
684 |
+ known_params["x"] = function (format, arg) { |
|
685 |
+ if (!test_arg(format, arg, 'number')) |
|
686 |
+ return 'Ø'; |
|
687 |
+ var tmp = Math.floor(Math.round(Math.abs(arg))) * ((arg < 0) ? -1 : 1); |
|
688 |
+ return known_params["s"](format, tmp.toString(16)); |
|
689 |
+ }; |
|
690 |
+ known_params["a"] = known_params["x"]; |
|
691 |
+ known_params["X"] = function (format, arg) { |
|
692 |
+ if (!test_arg(format, arg, 'number')) |
|
693 |
+ return 'Ø'; |
|
694 |
+ return known_params["x"](format, arg).toUpperCase(); |
|
695 |
+ }; |
|
696 |
+ known_params["A"] = known_params["X"]; |
|
697 |
+ known_params["c"] = function (format, arg) { |
|
698 |
+ var tmp = ""; |
|
699 |
+ if (typeof arg === "number") { |
|
700 |
+ tmp = String.fromCharCode(arg); |
|
701 |
+ } |
|
702 |
+ else if ((typeof arg === "string") && (arg.length === 1)) { |
|
703 |
+ tmp = arg[0]; |
|
704 |
+ } |
|
705 |
+ else { |
|
706 |
+ console.warn(make_err(format, arg, "number|string") + " and if string it needs to have the length of 1!"); |
|
707 |
+ } |
|
708 |
+ return known_params["s"](format, tmp); |
|
709 |
+ }; |
|
710 |
+ known_params["n"] = function () { |
|
711 |
+ return ""; |
|
712 |
+ }; |
|
713 |
+ var decompose = function (chain, regexp) { |
|
714 |
+ var result = regexp.exec(chain); |
|
715 |
+ if (result == null) { |
|
716 |
+ return null; |
|
717 |
+ } |
|
718 |
+ else { |
|
719 |
+ var front = chain.substring(0, result.index); |
|
720 |
+ var back = chain.substring(result.index + result[0].length); |
|
721 |
+ return { "front": front, "match": result[0], "back": back }; |
|
722 |
+ } |
|
723 |
+ }; |
|
724 |
+ /** |
|
725 |
+ * an implementation of c sprintf |
|
726 |
+ * @param {string} string format string |
|
727 |
+ * @param {array} args arguments which should be filled into |
|
728 |
+ * @returns {string} |
|
729 |
+ */ |
|
730 |
+ lib_string.sprintf = function (input, args, original) { |
|
731 |
+ if (args === void 0) { args = []; } |
|
732 |
+ if (original === void 0) { original = null; } |
|
733 |
+ if (original == null) |
|
734 |
+ original = input; |
|
735 |
+ var components = decompose(input, pattern); |
|
736 |
+ if (components == null) { |
|
737 |
+ if (args.length > 0) { |
|
738 |
+ console.warn("[sprintf] superfluous arguments while formatting '" + original + "': ", args); |
|
739 |
+ } |
|
740 |
+ return input; |
|
741 |
+ } |
|
742 |
+ else { |
|
743 |
+ var arg; |
|
744 |
+ var rest; |
|
745 |
+ if (args.length > 0) { |
|
746 |
+ arg = args[0]; |
|
747 |
+ rest = args.slice(1); |
|
748 |
+ } |
|
749 |
+ else { |
|
750 |
+ console.warn("[sprintf] out of arguments while formatting '" + original + "'"); |
|
751 |
+ arg = null; |
|
752 |
+ rest = []; |
|
753 |
+ return input; |
|
754 |
+ } |
|
755 |
+ var fmt = split_format(components["match"]); |
|
756 |
+ return (components["front"] |
|
757 |
+ + known_params[fmt.specifier](fmt, arg) |
|
758 |
+ + lib_string.sprintf(components["back"], rest, original)); |
|
759 |
+ } |
|
760 |
+ }; |
|
761 |
+ /** |
|
762 |
+ * an implementation of c printf |
|
763 |
+ * @param {string} string format string |
|
764 |
+ * @param {array} args arguments which should be filled into |
|
765 |
+ * @returns {string} |
|
766 |
+ */ |
|
767 |
+ function printf(format, args) { |
|
768 |
+ console.log(lib_string.sprintf(format, args)); |
|
769 |
+ } |
|
770 |
+ lib_string.printf = printf; |
|
771 |
+})(lib_string || (lib_string = {})); |
|
772 |
+var sprintf = lib_string.sprintf; |
|
773 |
+var printf = lib_string.printf; |
|
774 |
+/* |
|
775 |
+This file is part of »bacterio-plankton:string«. |
|
776 |
+ |
|
777 |
+Copyright 2016-2018 'Christian Fraß, Christian Neubauer, Martin Springwald GbR' |
|
778 |
+<info@greenscale.de> |
|
779 |
+ |
|
780 |
+»bacterio-plankton:string« is free software: you can redistribute it and/or modify |
|
781 |
+it under the terms of the GNU Lesser General Public License as published by |
|
782 |
+the Free Software Foundation, either version 3 of the License, or |
|
783 |
+(at your option) any later version. |
|
784 |
+ |
|
785 |
+»bacterio-plankton:string« is distributed in the hope that it will be useful, |
|
786 |
+but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
787 |
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
788 |
+GNU Lesser General Public License for more details. |
|
789 |
+ |
|
790 |
+You should have received a copy of the GNU Lesser General Public License |
|
791 |
+along with »bacterio-plankton:string«. If not, see <http://www.gnu.org/licenses/>. |
|
792 |
+ */ |
|
793 |
+var make_logger = (function () { |
|
794 |
+ var _loggers = {}; |
|
795 |
+ var make_logger = function (prefix, current_loglevel) { |
|
796 |
+ var log = []; |
|
797 |
+ var level = [ |
|
798 |
+ "LOG", "INFO", "WARNING", "DEBUG" |
|
799 |
+ ]; |
|
800 |
+ var logger = function (obj, lvl) { |
|
801 |
+ var txt = obj.txt || obj; |
|
802 |
+ if (lvl == void 0) |
|
803 |
+ lvl = 0; |
|
804 |
+ var date = new Date(); |
|
805 |
+ log.push({ |
|
806 |
+ "message": sprintf("%s [%s:%s] %s", [date.toString(), level[lvl], prefix, txt]), |
|
807 |
+ "timeStamp": +(date) |
|
808 |
+ }); |
|
809 |
+ if (lvl <= current_loglevel) { |
|
810 |
+ var msg = ["[" + prefix + "]", txt]; |
|
811 |
+ if (obj.arg) |
|
812 |
+ msg = ["[" + prefix + "]"].concat(Array.prototype.slice.call(obj.arg)); |
|
813 |
+ if (lvl === 0) |
|
814 |
+ console["_log"].apply(console, msg); |
|
815 |
+ else if (lvl === 1) |
|
816 |
+ console["_info"].apply(console, msg); |
|
817 |
+ else if (lvl === 2) |
|
818 |
+ console["_warn"].apply(console, msg); |
|
819 |
+ else if (lvl >= 3) |
|
820 |
+ console["_log"].apply(console, msg); |
|
821 |
+ } |
|
822 |
+ }; |
|
823 |
+ _loggers[prefix] = { |
|
824 |
+ "logger": logger, |
|
825 |
+ "log": log |
|
826 |
+ }; |
|
827 |
+ return logger; |
|
828 |
+ }; |
|
829 |
+ make_logger["loggers"] = _loggers; |
|
830 |
+ make_logger["complete_log"] = function () { |
|
831 |
+ var logs = Object.keys(_loggers) |
|
832 |
+ .reduce(function (p, c) { |
|
833 |
+ return [].concat(p, _loggers[c].log); |
|
834 |
+ }, []); |
|
835 |
+ logs.sort(function (x, y) { |
|
836 |
+ return ((x.timeStamp > y.timeStamp) ? -1 : +1); |
|
837 |
+ }); |
|
838 |
+ return logs.map(function (x, i, a) { |
|
839 |
+ return x.message; |
|
840 |
+ }); |
|
841 |
+ }; |
|
842 |
+ if ( /*!track_exports*/true) { |
|
843 |
+ var _log_all = function (log, lvl, next) { |
|
844 |
+ if (next === void 0) { next = function () { }; } |
|
845 |
+ return function () { |
|
846 |
+ var msg = []; |
|
847 |
+ for (var i = 0; i < arguments.length; i++) { |
|
848 |
+ if (typeof arguments[i] === "string") { |
|
849 |
+ msg.push(arguments[i]); |
|
850 |
+ } |
|
851 |
+ else { |
|
852 |
+ msg.push(JSON.stringify(arguments[i])); |
|
853 |
+ } |
|
854 |
+ } |
|
855 |
+ var obj = { |
|
856 |
+ txt: msg.join("\t"), |
|
857 |
+ arg: arguments |
|
858 |
+ }; |
|
859 |
+ log(obj, lvl); |
|
860 |
+ next(); |
|
861 |
+ }; |
|
862 |
+ }; |
|
863 |
+ { |
|
864 |
+ var __warn = make_logger("deprecated console.warn", 99); |
|
865 |
+ var __error = make_logger("deprecated console.error", 99); |
|
866 |
+ var __log = make_logger("deprecated console.log", 99); |
|
867 |
+ var __info = make_logger("deprecated console.info", 99); |
|
868 |
+ // bad ass |
|
869 |
+ console["_log"] = console.log; |
|
870 |
+ console["_error"] = console.error; |
|
871 |
+ console["_warn"] = console.warn; |
|
872 |
+ console["_info"] = console.info; |
|
873 |
+ /* |
|
874 |
+ console["log"] = _log_all(__log, 0); |
|
875 |
+ console["error"] = _log_all(__error, 2); |
|
876 |
+ console["warn"] = _log_all(__warn, 2); |
|
877 |
+ console["info"] = _log_all(__info, 0); |
|
878 |
+ */ |
|
879 |
+ } |
|
880 |
+ /* |
|
881 |
+ { |
|
882 |
+ make_logger["send_log"] = function(){ |
|
883 |
+ eml_log( |
|
884 |
+ function () { |
|
885 |
+ alert("fehlerbericht wurde gesendet!"); |
|
886 |
+ } |
|
887 |
+ ); |
|
888 |
+ }; |
|
889 |
+ var error_log = make_logger("global.error", 99); |
|
890 |
+ window.onerror = _log_all( |
|
891 |
+ error_log, |
|
892 |
+ 1, |
|
893 |
+ function(){ |
|
894 |
+ if (global_config == undefined) { |
|
895 |
+ return false; |
|
896 |
+ } |
|
897 |
+ if (global_config.report_error) { |
|
898 |
+ make_logger["send_log"](); |
|
899 |
+ } |
|
900 |
+ } |
|
901 |
+ ); |
|
902 |
+ } |
|
903 |
+ */ |
|
904 |
+ } |
|
905 |
+ return make_logger; |
|
906 |
+})(); |
... | ... |
@@ -0,0 +1,860 @@ |
1 |
+Copyright 2016-2018 greenscale <info@greenscale.de> |
|
2 |
+ |
|
3 |
+»bacterio-plankton:trait« is free software: you can redistribute it and/or modify |
|
4 |
+it under the terms of the GNU Lesser General Public License as published by |
|
5 |
+the Free Software Foundation, either version 3 of the License, or |
|
6 |
+(at your option) any later version. |
|
7 |
+ |
|
8 |
+»bacterio-plankton:trait« is distributed in the hope that it will be useful, |
|
9 |
+but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
10 |
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
11 |
+GNU Lesser General Public License for more details. |
|
12 |
+ |
|
13 |
+You should have received a copy of the GNU Lesser General Public License |
|
14 |
+along with »bacterio-plankton:trait«. If not, see <http://www.gnu.org/licenses/>. |
|
15 |
+ |
|
16 |
+ |
|
17 |
+ |
|
18 |
+ GNU GENERAL PUBLIC LICENSE |
|
19 |
+ Version 3, 29 June 2007 |
|
20 |
+ |
|
21 |
+ Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/> |
|
22 |
+ Everyone is permitted to copy and distribute verbatim copies |
|
23 |
+ of this license document, but changing it is not allowed. |
|
24 |
+ |
|
25 |
+ Preamble |
|
26 |
+ |
|
27 |
+ The GNU General Public License is a free, copyleft license for |
|
28 |
+software and other kinds of works. |
|
29 |
+ |
|
30 |
+ The licenses for most software and other practical works are designed |
|
31 |
+to take away your freedom to share and change the works. By contrast, |
|
32 |
+the GNU General Public License is intended to guarantee your freedom to |
|
33 |
+share and change all versions of a program--to make sure it remains free |
|
34 |
+software for all its users. We, the Free Software Foundation, use the |
|
35 |
+GNU General Public License for most of our software; it applies also to |
|
36 |
+any other work released this way by its authors. You can apply it to |
|
37 |
+your programs, too. |
|
38 |
+ |
|
39 |
+ When we speak of free software, we are referring to freedom, not |
|
40 |
+price. Our General Public Licenses are designed to make sure that you |
|
41 |
+have the freedom to distribute copies of free software (and charge for |
|
42 |
+them if you wish), that you receive source code or can get it if you |
|
43 |
+want it, that you can change the software or use pieces of it in new |
|
44 |
+free programs, and that you know you can do these things. |
|
45 |
+ |
|
46 |
+ To protect your rights, we need to prevent others from denying you |
|
47 |
+these rights or asking you to surrender the rights. Therefore, you have |
|
48 |
+certain responsibilities if you distribute copies of the software, or if |
|
49 |
+you modify it: responsibilities to respect the freedom of others. |
|
50 |
+ |
|
51 |
+ For example, if you distribute copies of such a program, whether |
|
52 |
+gratis or for a fee, you must pass on to the recipients the same |
|
53 |
+freedoms that you received. You must make sure that they, too, receive |
|
54 |
+or can get the source code. And you must show them these terms so they |
|
55 |
+know their rights. |
|
56 |
+ |
|
57 |
+ Developers that use the GNU GPL protect your rights with two steps: |
|
58 |
+(1) assert copyright on the software, and (2) offer you this License |
|
59 |
+giving you legal permission to copy, distribute and/or modify it. |
|
60 |
+ |
|
61 |
+ For the developers' and authors' protection, the GPL clearly explains |
|
62 |
+that there is no warranty for this free software. For both users' and |
|
63 |
+authors' sake, the GPL requires that modified versions be marked as |
|
64 |
+changed, so that their problems will not be attributed erroneously to |
|
65 |
+authors of previous versions. |
|
66 |
+ |
|
67 |
+ Some devices are designed to deny users access to install or run |
|
68 |
+modified versions of the software inside them, although the manufacturer |
|
69 |
+can do so. This is fundamentally incompatible with the aim of |
|
70 |
+protecting users' freedom to change the software. The systematic |
|
71 |
+pattern of such abuse occurs in the area of products for individuals to |
|
72 |
+use, which is precisely where it is most unacceptable. Therefore, we |
|
73 |
+have designed this version of the GPL to prohibit the practice for those |
|
74 |
+products. If such problems arise substantially in other domains, we |
|
75 |
+stand ready to extend this provision to those domains in future versions |
|
76 |
+of the GPL, as needed to protect the freedom of users. |
|
77 |
+ |
|
78 |
+ Finally, every program is threatened constantly by software patents. |
|
79 |
+States should not allow patents to restrict development and use of |
|
80 |
+software on general-purpose computers, but in those that do, we wish to |
|
81 |
+avoid the special danger that patents applied to a free program could |
|
82 |
+make it effectively proprietary. To prevent this, the GPL assures that |
|
83 |
+patents cannot be used to render the program non-free. |
|
84 |
+ |
|
85 |
+ The precise terms and conditions for copying, distribution and |
|
86 |
+modification follow. |
|
87 |
+ |
|
88 |
+ TERMS AND CONDITIONS |
|
89 |
+ |
|
90 |
+ 0. Definitions. |
|
91 |
+ |
|
92 |
+ "This License" refers to version 3 of the GNU General Public License. |
|
93 |
+ |
|
94 |
+ "Copyright" also means copyright-like laws that apply to other kinds of |
|
95 |
+works, such as semiconductor masks. |
|
96 |
+ |
|
97 |
+ "The Program" refers to any copyrightable work licensed under this |
|
98 |
+License. Each licensee is addressed as "you". "Licensees" and |
|
99 |
+"recipients" may be individuals or organizations. |
|
100 |
+ |
|
101 |
+ To "modify" a work means to copy from or adapt all or part of the work |
|
102 |
+in a fashion requiring copyright permission, other than the making of an |
|
103 |
+exact copy. The resulting work is called a "modified version" of the |
|
104 |
+earlier work or a work "based on" the earlier work. |
|
105 |
+ |
|
106 |
+ A "covered work" means either the unmodified Program or a work based |
|
107 |
+on the Program. |
|
108 |
+ |
|
109 |
+ To "propagate" a work means to do anything with it that, without |
|
110 |
+permission, would make you directly or secondarily liable for |
|
111 |
+infringement under applicable copyright law, except executing it on a |
|
112 |
+computer or modifying a private copy. Propagation includes copying, |
|
113 |
+distribution (with or without modification), making available to the |
|
114 |
+public, and in some countries other activities as well. |
|
115 |
+ |
|
116 |
+ To "convey" a work means any kind of propagation that enables other |
|
117 |
+parties to make or receive copies. Mere interaction with a user through |
|
118 |
+a computer network, with no transfer of a copy, is not conveying. |
|
119 |
+ |
|
120 |
+ An interactive user interface displays "Appropriate Legal Notices" |
|
121 |
+to the extent that it includes a convenient and prominently visible |
|
122 |
+feature that (1) displays an appropriate copyright notice, and (2) |
|
123 |
+tells the user that there is no warranty for the work (except to the |
|
124 |
+extent that warranties are provided), that licensees may convey the |
|
125 |
+work under this License, and how to view a copy of this License. If |
|
126 |
+the interface presents a list of user commands or options, such as a |
|
127 |
+menu, a prominent item in the list meets this criterion. |
|
128 |
+ |
|
129 |
+ 1. Source Code. |
|
130 |
+ |
|
131 |
+ The "source code" for a work means the preferred form of the work |
|
132 |
+for making modifications to it. "Object code" means any non-source |
|
133 |
+form of a work. |
|
134 |
+ |
|
135 |
+ A "Standard Interface" means an interface that either is an official |
|
136 |
+standard defined by a recognized standards body, or, in the case of |
|
137 |
+interfaces specified for a particular programming language, one that |
|
138 |
+is widely used among developers working in that language. |
|
139 |
+ |
|
140 |
+ The "System Libraries" of an executable work include anything, other |
|
141 |
+than the work as a whole, that (a) is included in the normal form of |
|
142 |
+packaging a Major Component, but which is not part of that Major |
|
143 |
+Component, and (b) serves only to enable use of the work with that |
|
144 |
+Major Component, or to implement a Standard Interface for which an |
|
145 |
+implementation is available to the public in source code form. A |
|
146 |
+"Major Component", in this context, means a major essential component |
|
147 |
+(kernel, window system, and so on) of the specific operating system |
|
148 |
+(if any) on which the executable work runs, or a compiler used to |
|
149 |
+produce the work, or an object code interpreter used to run it. |
|
150 |
+ |
|
151 |
+ The "Corresponding Source" for a work in object code form means all |
|
152 |
+the source code needed to generate, install, and (for an executable |
|
153 |
+work) run the object code and to modify the work, including scripts to |
|
154 |
+control those activities. However, it does not include the work's |
|
155 |
+System Libraries, or general-purpose tools or generally available free |
|
156 |
+programs which are used unmodified in performing those activities but |
|
157 |
+which are not part of the work. For example, Corresponding Source |
|
158 |
+includes interface definition files associated with source files for |
|
159 |
+the work, and the source code for shared libraries and dynamically |
|
160 |
+linked subprograms that the work is specifically designed to require, |
|
161 |
+such as by intimate data communication or control flow between those |
|
162 |
+subprograms and other parts of the work. |
|
163 |
+ |
|
164 |
+ The Corresponding Source need not include anything that users |
|
165 |
+can regenerate automatically from other parts of the Corresponding |
|
166 |
+Source. |
|
167 |
+ |
|
168 |
+ The Corresponding Source for a work in source code form is that |
|
169 |
+same work. |
|
170 |
+ |
|
171 |
+ 2. Basic Permissions. |
|
172 |
+ |
|
173 |
+ All rights granted under this License are granted for the term of |
|
174 |
+copyright on the Program, and are irrevocable provided the stated |
|
175 |
+conditions are met. This License explicitly affirms your unlimited |
|
176 |
+permission to run the unmodified Program. The output from running a |
|
177 |
+covered work is covered by this License only if the output, given its |
|
178 |
+content, constitutes a covered work. This License acknowledges your |
|
179 |
+rights of fair use or other equivalent, as provided by copyright law. |
|
180 |
+ |
|
181 |
+ You may make, run and propagate covered works that you do not |
|
182 |
+convey, without conditions so long as your license otherwise remains |
|
183 |
+in force. You may convey covered works to others for the sole purpose |
|
184 |
+of having them make modifications exclusively for you, or provide you |
|
185 |
+with facilities for running those works, provided that you comply with |
|
186 |
+the terms of this License in conveying all material for which you do |
|
187 |
+not control copyright. Those thus making or running the covered works |
|
188 |
+for you must do so exclusively on your behalf, under your direction |
|
189 |
+and control, on terms that prohibit them from making any copies of |
|
190 |
+your copyrighted material outside their relationship with you. |
|
191 |
+ |
|
192 |
+ Conveying under any other circumstances is permitted solely under |
|
193 |
+the conditions stated below. Sublicensing is not allowed; section 10 |
|
194 |
+makes it unnecessary. |
|
195 |
+ |
|
196 |
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law. |
|
197 |
+ |
|
198 |
+ No covered work shall be deemed part of an effective technological |
|
199 |
+measure under any applicable law fulfilling obligations under article |
|
200 |
+11 of the WIPO copyright treaty adopted on 20 December 1996, or |
|
201 |
+similar laws prohibiting or restricting circumvention of such |
|
202 |
+measures. |
|
203 |
+ |
|
204 |
+ When you convey a covered work, you waive any legal power to forbid |
|
205 |
+circumvention of technological measures to the extent such circumvention |
|
206 |
+is effected by exercising rights under this License with respect to |
|
207 |
+the covered work, and you disclaim any intention to limit operation or |
|
208 |
+modification of the work as a means of enforcing, against the work's |
|
209 |
+users, your or third parties' legal rights to forbid circumvention of |
|
210 |
+technological measures. |
|
211 |
+ |
|
212 |
+ 4. Conveying Verbatim Copies. |
|
213 |
+ |
|
214 |
+ You may convey verbatim copies of the Program's source code as you |
|
215 |
+receive it, in any medium, provided that you conspicuously and |
|
216 |
+appropriately publish on each copy an appropriate copyright notice; |
|
217 |
+keep intact all notices stating that this License and any |
|
218 |
+non-permissive terms added in accord with section 7 apply to the code; |
|
219 |
+keep intact all notices of the absence of any warranty; and give all |
|
220 |
+recipients a copy of this License along with the Program. |
|
221 |
+ |
|
222 |
+ You may charge any price or no price for each copy that you convey, |
|
223 |
+and you may offer support or warranty protection for a fee. |
|
224 |
+ |
|
225 |
+ 5. Conveying Modified Source Versions. |
|
226 |
+ |
|
227 |
+ You may convey a work based on the Program, or the modifications to |
|
228 |
+produce it from the Program, in the form of source code under the |
|
229 |
+terms of section 4, provided that you also meet all of these conditions: |
|
230 |
+ |
|
231 |
+ a) The work must carry prominent notices stating that you modified |
|
232 |
+ it, and giving a relevant date. |
|
233 |
+ |
|
234 |
+ b) The work must carry prominent notices stating that it is |
|
235 |
+ released under this License and any conditions added under section |
|
236 |
+ 7. This requirement modifies the requirement in section 4 to |
|
237 |
+ "keep intact all notices". |
|
238 |
+ |
|
239 |
+ c) You must license the entire work, as a whole, under this |
|
240 |
+ License to anyone who comes into possession of a copy. This |
|
241 |
+ License will therefore apply, along with any applicable section 7 |
|
242 |
+ additional terms, to the whole of the work, and all its parts, |
|
243 |
+ regardless of how they are packaged. This License gives no |
|
244 |
+ permission to license the work in any other way, but it does not |
|
245 |
+ invalidate such permission if you have separately received it. |
|
246 |
+ |
|
247 |
+ d) If the work has interactive user interfaces, each must display |
|
248 |
+ Appropriate Legal Notices; however, if the Program has interactive |
|
249 |
+ interfaces that do not display Appropriate Legal Notices, your |
|
250 |
+ work need not make them do so. |
|
251 |
+ |
|
252 |
+ A compilation of a covered work with other separate and independent |
|
253 |
+works, which are not by their nature extensions of the covered work, |
|
254 |
+and which are not combined with it such as to form a larger program, |
|
255 |
+in or on a volume of a storage or distribution medium, is called an |
|
256 |
+"aggregate" if the compilation and its resulting copyright are not |
|
257 |
+used to limit the access or legal rights of the compilation's users |
|
258 |
+beyond what the individual works permit. Inclusion of a covered work |
|
259 |
+in an aggregate does not cause this License to apply to the other |
|
260 |
+parts of the aggregate. |
|
261 |
+ |
|
262 |
+ 6. Conveying Non-Source Forms. |
|
263 |
+ |
|
264 |
+ You may convey a covered work in object code form under the terms |
|
265 |
+of sections 4 and 5, provided that you also convey the |
|
266 |
+machine-readable Corresponding Source under the terms of this License, |
|
267 |
+in one of these ways: |
|
268 |
+ |
|
269 |
+ a) Convey the object code in, or embodied in, a physical product |
|
270 |
+ (including a physical distribution medium), accompanied by the |
|
271 |
+ Corresponding Source fixed on a durable physical medium |
|
272 |
+ customarily used for software interchange. |
|
273 |
+ |
|
274 |
+ b) Convey the object code in, or embodied in, a physical product |
|
275 |
+ (including a physical distribution medium), accompanied by a |
|
276 |
+ written offer, valid for at least three years and valid for as |
|
277 |
+ long as you offer spare parts or customer support for that product |
|
278 |
+ model, to give anyone who possesses the object code either (1) a |
|
279 |
+ copy of the Corresponding Source for all the software in the |
|
280 |
+ product that is covered by this License, on a durable physical |
|
281 |
+ medium customarily used for software interchange, for a price no |
|
282 |
+ more than your reasonable cost of physically performing this |
|
283 |
+ conveying of source, or (2) access to copy the |
|
284 |
+ Corresponding Source from a network server at no charge. |
|
285 |
+ |
|
286 |
+ c) Convey individual copies of the object code with a copy of the |
|
287 |
+ written offer to provide the Corresponding Source. This |
|
288 |
+ alternative is allowed only occasionally and noncommercially, and |
|
289 |
+ only if you received the object code with such an offer, in accord |
|
290 |
+ with subsection 6b. |
|
291 |
+ |
|
292 |
+ d) Convey the object code by offering access from a designated |
|
293 |
+ place (gratis or for a charge), and offer equivalent access to the |
|
294 |
+ Corresponding Source in the same way through the same place at no |
|
295 |
+ further charge. You need not require recipients to copy the |
|
296 |
+ Corresponding Source along with the object code. If the place to |
|
297 |
+ copy the object code is a network server, the Corresponding Source |
|
298 |
+ may be on a different server (operated by you or a third party) |
|
299 |
+ that supports equivalent copying facilities, provided you maintain |
|
300 |
+ clear directions next to the object code saying where to find the |
|
301 |
+ Corresponding Source. Regardless of what server hosts the |
|
302 |
+ Corresponding Source, you remain obligated to ensure that it is |
|
303 |
+ available for as long as needed to satisfy these requirements. |
|
304 |
+ |
|
305 |
+ e) Convey the object code using peer-to-peer transmission, provided |
|
306 |
+ you inform other peers where the object code and Corresponding |
|
307 |
+ Source of the work are being offered to the general public at no |
|
308 |
+ charge under subsection 6d. |
|
309 |
+ |
|
310 |
+ A separable portion of the object code, whose source code is excluded |
|
311 |
+from the Corresponding Source as a System Library, need not be |
|
312 |
+included in conveying the object code work. |
|
313 |
+ |
|
314 |
+ A "User Product" is either (1) a "consumer product", which means any |
|
315 |
+tangible personal property which is normally used for personal, family, |
|
316 |
+or household purposes, or (2) anything designed or sold for incorporation |
|
317 |
+into a dwelling. In determining whether a product is a consumer product, |
|
318 |
+doubtful cases shall be resolved in favor of coverage. For a particular |
|
319 |
+product received by a particular user, "normally used" refers to a |
|
320 |
+typical or common use of that class of product, regardless of the status |
|
321 |
+of the particular user or of the way in which the particular user |
|
322 |
+actually uses, or expects or is expected to use, the product. A product |
|
323 |
+is a consumer product regardless of whether the product has substantial |
|
324 |
+commercial, industrial or non-consumer uses, unless such uses represent |
|
325 |
+the only significant mode of use of the product. |
|
326 |
+ |
|
327 |
+ "Installation Information" for a User Product means any methods, |
|
328 |
+procedures, authorization keys, or other information required to install |
|
329 |
+and execute modified versions of a covered work in that User Product from |
|
330 |
+a modified version of its Corresponding Source. The information must |
|
331 |
+suffice to ensure that the continued functioning of the modified object |
|
332 |
+code is in no case prevented or interfered with solely because |
|
333 |
+modification has been made. |
|
334 |
+ |
|
335 |
+ If you convey an object code work under this section in, or with, or |
|
336 |
+specifically for use in, a User Product, and the conveying occurs as |
|
337 |
+part of a transaction in which the right of possession and use of the |
|
338 |
+User Product is transferred to the recipient in perpetuity or for a |
|
339 |
+fixed term (regardless of how the transaction is characterized), the |
|
340 |
+Corresponding Source conveyed under this section must be accompanied |
|
341 |
+by the Installation Information. But this requirement does not apply |
|
342 |
+if neither you nor any third party retains the ability to install |
|
343 |
+modified object code on the User Product (for example, the work has |
|
344 |
+been installed in ROM). |
|
345 |
+ |
|
346 |
+ The requirement to provide Installation Information does not include a |
|
347 |
+requirement to continue to provide support service, warranty, or updates |
|
348 |
+for a work that has been modified or installed by the recipient, or for |
|
349 |
+the User Product in which it has been modified or installed. Access to a |
|
350 |
+network may be denied when the modification itself materially and |
|
351 |
+adversely affects the operation of the network or violates the rules and |
|
352 |
+protocols for communication across the network. |
|
353 |
+ |
|
354 |
+ Corresponding Source conveyed, and Installation Information provided, |
|
355 |
+in accord with this section must be in a format that is publicly |
|
356 |
+documented (and with an implementation available to the public in |
|
357 |
+source code form), and must require no special password or key for |
|
358 |
+unpacking, reading or copying. |
|
359 |
+ |
|
360 |
+ 7. Additional Terms. |
|
361 |
+ |
|
362 |
+ "Additional permissions" are terms that supplement the terms of this |
|
363 |
+License by making exceptions from one or more of its conditions. |
|
364 |
+Additional permissions that are applicable to the entire Program shall |
|
365 |
+be treated as though they were included in this License, to the extent |
|
366 |
+that they are valid under applicable law. If additional permissions |
|
367 |
+apply only to part of the Program, that part may be used separately |
|
368 |
+under those permissions, but the entire Program remains governed by |
|
369 |
+this License without regard to the additional permissions. |
|
370 |
+ |
|
371 |
+ When you convey a copy of a covered work, you may at your option |
|
372 |
+remove any additional permissions from that copy, or from any part of |
|
373 |
+it. (Additional permissions may be written to require their own |
|
374 |
+removal in certain cases when you modify the work.) You may place |
|
375 |
+additional permissions on material, added by you to a covered work, |
|
376 |
+for which you have or can give appropriate copyright permission. |
|
377 |
+ |
|
378 |
+ Notwithstanding any other provision of this License, for material you |
|
379 |
+add to a covered work, you may (if authorized by the copyright holders of |
|
380 |
+that material) supplement the terms of this License with terms: |
|
381 |
+ |
|
382 |
+ a) Disclaiming warranty or limiting liability differently from the |
|
383 |
+ terms of sections 15 and 16 of this License; or |
|
384 |
+ |
|
385 |
+ b) Requiring preservation of specified reasonable legal notices or |
|
386 |
+ author attributions in that material or in the Appropriate Legal |
|
387 |
+ Notices displayed by works containing it; or |
|
388 |
+ |
|
389 |
+ c) Prohibiting misrepresentation of the origin of that material, or |
|
390 |
+ requiring that modified versions of such material be marked in |
|
391 |
+ reasonable ways as different from the original version; or |
|
392 |
+ |
|
393 |
+ d) Limiting the use for publicity purposes of names of licensors or |
|
394 |
+ authors of the material; or |
|
395 |
+ |
|
396 |
+ e) Declining to grant rights under trademark law for use of some |
|
397 |
+ trade names, trademarks, or service marks; or |
|
398 |
+ |
|
399 |
+ f) Requiring indemnification of licensors and authors of that |
|
400 |
+ material by anyone who conveys the material (or modified versions of |
|
401 |
+ it) with contractual assumptions of liability to the recipient, for |
|
402 |
+ any liability that these contractual assumptions directly impose on |
|
403 |
+ those licensors and authors. |
|
404 |
+ |
|
405 |
+ All other non-permissive additional terms are considered "further |
|
406 |
+restrictions" within the meaning of section 10. If the Program as you |
|
407 |
+received it, or any part of it, contains a notice stating that it is |
|
408 |
+governed by this License along with a term that is a further |
|
409 |
+restriction, you may remove that term. If a license document contains |
|
410 |
+a further restriction but permits relicensing or conveying under this |
|
411 |
+License, you may add to a covered work material governed by the terms |
|
412 |
+of that license document, provided that the further restriction does |
|
413 |
+not survive such relicensing or conveying. |
|
414 |
+ |
|
415 |
+ If you add terms to a covered work in accord with this section, you |
|
416 |
+must place, in the relevant source files, a statement of the |
|
417 |
+additional terms that apply to those files, or a notice indicating |
|
418 |
+where to find the applicable terms. |
|
419 |
+ |
|
420 |
+ Additional terms, permissive or non-permissive, may be stated in the |
|
421 |
+form of a separately written license, or stated as exceptions; |
|
422 |
+the above requirements apply either way. |
|
423 |
+ |
|
424 |
+ 8. Termination. |
|
425 |
+ |
|
426 |
+ You may not propagate or modify a covered work except as expressly |
|
427 |
+provided under this License. Any attempt otherwise to propagate or |
|
428 |
+modify it is void, and will automatically terminate your rights under |
|
429 |
+this License (including any patent licenses granted under the third |
|
430 |
+paragraph of section 11). |
|
431 |
+ |
|
432 |
+ However, if you cease all violation of this License, then your |
|
433 |
+license from a particular copyright holder is reinstated (a) |
|
434 |
+provisionally, unless and until the copyright holder explicitly and |
|
435 |
+finally terminates your license, and (b) permanently, if the copyright |
|
436 |
+holder fails to notify you of the violation by some reasonable means |
|
437 |
+prior to 60 days after the cessation. |
|
438 |
+ |
|
439 |
+ Moreover, your license from a particular copyright holder is |
|
440 |
+reinstated permanently if the copyright holder notifies you of the |
|
441 |
+violation by some reasonable means, this is the first time you have |
|
442 |
+received notice of violation of this License (for any work) from that |
|
443 |
+copyright holder, and you cure the violation prior to 30 days after |
|
444 |
+your receipt of the notice. |
|
445 |
+ |
|
446 |
+ Termination of your rights under this section does not terminate the |
|
447 |
+licenses of parties who have received copies or rights from you under |
|
448 |
+this License. If your rights have been terminated and not permanently |
|
449 |
+reinstated, you do not qualify to receive new licenses for the same |
|
450 |
+material under section 10. |
|
451 |
+ |
|
452 |
+ 9. Acceptance Not Required for Having Copies. |
|
453 |
+ |
|
454 |
+ You are not required to accept this License in order to receive or |
|
455 |
+run a copy of the Program. Ancillary propagation of a covered work |
|
456 |
+occurring solely as a consequence of using peer-to-peer transmission |
|
457 |
+to receive a copy likewise does not require acceptance. However, |
|
458 |
+nothing other than this License grants you permission to propagate or |
|
459 |
+modify any covered work. These actions infringe copyright if you do |
|
460 |
+not accept this License. Therefore, by modifying or propagating a |
|
461 |
+covered work, you indicate your acceptance of this License to do so. |
|
462 |
+ |
|
463 |
+ 10. Automatic Licensing of Downstream Recipients. |
|
464 |
+ |
|
465 |
+ Each time you convey a covered work, the recipient automatically |
|
466 |
+receives a license from the original licensors, to run, modify and |
|
467 |
+propagate that work, subject to this License. You are not responsible |
|
468 |
+for enforcing compliance by third parties with this License. |
|
469 |
+ |
|
470 |
+ An "entity transaction" is a transaction transferring control of an |
|
471 |
+organization, or substantially all assets of one, or subdividing an |
|
472 |
+organization, or merging organizations. If propagation of a covered |
|
473 |
+work results from an entity transaction, each party to that |
|
474 |
+transaction who receives a copy of the work also receives whatever |
|
475 |
+licenses to the work the party's predecessor in interest had or could |
|
476 |
+give under the previous paragraph, plus a right to possession of the |
|
477 |
+Corresponding Source of the work from the predecessor in interest, if |
|
478 |
+the predecessor has it or can get it with reasonable efforts. |
|
479 |
+ |
|
480 |
+ You may not impose any further restrictions on the exercise of the |
|
481 |
+rights granted or affirmed under this License. For example, you may |
|
482 |
+not impose a license fee, royalty, or other charge for exercise of |
|
483 |
+rights granted under this License, and you may not initiate litigation |
|
484 |
+(including a cross-claim or counterclaim in a lawsuit) alleging that |
|
485 |
+any patent claim is infringed by making, using, selling, offering for |
|
486 |
+sale, or importing the Program or any portion of it. |
|
487 |
+ |
|
488 |
+ 11. Patents. |
|
489 |
+ |
|
490 |
+ A "contributor" is a copyright holder who authorizes use under this |
|
491 |
+License of the Program or a work on which the Program is based. The |
|
492 |
+work thus licensed is called the contributor's "contributor version". |
|
493 |
+ |
|
494 |
+ A contributor's "essential patent claims" are all patent claims |
|
495 |
+owned or controlled by the contributor, whether already acquired or |
|
496 |
+hereafter acquired, that would be infringed by some manner, permitted |
|
497 |
+by this License, of making, using, or selling its contributor version, |
|
498 |
+but do not include claims that would be infringed only as a |
|
499 |
+consequence of further modification of the contributor version. For |
|
500 |
+purposes of this definition, "control" includes the right to grant |
|
501 |
+patent sublicenses in a manner consistent with the requirements of |
|
502 |
+this License. |
|
503 |
+ |
|
504 |
+ Each contributor grants you a non-exclusive, worldwide, royalty-free |
|
505 |
+patent license under the contributor's essential patent claims, to |
|
506 |
+make, use, sell, offer for sale, import and otherwise run, modify and |
|
507 |
+propagate the contents of its contributor version. |
|
508 |
+ |
|
509 |
+ In the following three paragraphs, a "patent license" is any express |
|
510 |
+agreement or commitment, however denominated, not to enforce a patent |
|
511 |
+(such as an express permission to practice a patent or covenant not to |
|
512 |
+sue for patent infringement). To "grant" such a patent license to a |
|
513 |
+party means to make such an agreement or commitment not to enforce a |
|
514 |
+patent against the party. |
|
515 |
+ |
|
516 |
+ If you convey a covered work, knowingly relying on a patent license, |
|
517 |
+and the Corresponding Source of the work is not available for anyone |
|
518 |
+to copy, free of charge and under the terms of this License, through a |
|
519 |
+publicly available network server or other readily accessible means, |
|
520 |
+then you must either (1) cause the Corresponding Source to be so |
|
521 |
+available, or (2) arrange to deprive yourself of the benefit of the |
|
522 |
+patent license for this particular work, or (3) arrange, in a manner |
|
523 |
+consistent with the requirements of this License, to extend the patent |
|
524 |
+license to downstream recipients. "Knowingly relying" means you have |
|
525 |
+actual knowledge that, but for the patent license, your conveying the |
|
526 |
+covered work in a country, or your recipient's use of the covered work |
|
527 |
+in a country, would infringe one or more identifiable patents in that |
|
528 |
+country that you have reason to believe are valid. |
|
529 |
+ |
|
530 |
+ If, pursuant to or in connection with a single transaction or |
|
531 |
+arrangement, you convey, or propagate by procuring conveyance of, a |
|
532 |
+covered work, and grant a patent license to some of the parties |
|
533 |
+receiving the covered work authorizing them to use, propagate, modify |
|
534 |
+or convey a specific copy of the covered work, then the patent license |
|
535 |
+you grant is automatically extended to all recipients of the covered |
|
536 |
+work and works based on it. |
|
537 |
+ |
|
538 |
+ A patent license is "discriminatory" if it does not include within |
|
539 |
+the scope of its coverage, prohibits the exercise of, or is |
|
540 |
+conditioned on the non-exercise of one or more of the rights that are |
|
541 |
+specifically granted under this License. You may not convey a covered |
|
542 |
+work if you are a party to an arrangement with a third party that is |
|
543 |
+in the business of distributing software, under which you make payment |
|
544 |
+to the third party based on the extent of your activity of conveying |
|
545 |
+the work, and under which the third party grants, to any of the |
|
546 |
+parties who would receive the covered work from you, a discriminatory |
|
547 |
+patent license (a) in connection with copies of the covered work |
|
548 |
+conveyed by you (or copies made from those copies), or (b) primarily |
|
549 |
+for and in connection with specific products or compilations that |
|
550 |
+contain the covered work, unless you entered into that arrangement, |
|
551 |
+or that patent license was granted, prior to 28 March 2007. |
|
552 |
+ |
|
553 |
+ Nothing in this License shall be construed as excluding or limiting |
|
554 |
+any implied license or other defenses to infringement that may |
|
555 |
+otherwise be available to you under applicable patent law. |
|
556 |
+ |
|
557 |
+ 12. No Surrender of Others' Freedom. |
|
558 |
+ |
|
559 |
+ If conditions are imposed on you (whether by court order, agreement or |
|
560 |
+otherwise) that contradict the conditions of this License, they do not |
|
561 |
+excuse you from the conditions of this License. If you cannot convey a |
|
562 |
+covered work so as to satisfy simultaneously your obligations under this |
|
563 |
+License and any other pertinent obligations, then as a consequence you may |
|
564 |
+not convey it at all. For example, if you agree to terms that obligate you |
|
565 |
+to collect a royalty for further conveying from those to whom you convey |
|
566 |
+the Program, the only way you could satisfy both those terms and this |
|
567 |
+License would be to refrain entirely from conveying the Program. |
|
568 |
+ |
|
569 |
+ 13. Use with the GNU Affero General Public License. |
|
570 |
+ |
|
571 |
+ Notwithstanding any other provision of this License, you have |
|
572 |
+permission to link or combine any covered work with a work licensed |
|
573 |
+under version 3 of the GNU Affero General Public License into a single |
|
574 |
+combined work, and to convey the resulting work. The terms of this |
|
575 |
+License will continue to apply to the part which is the covered work, |
|
576 |
+but the special requirements of the GNU Affero General Public License, |
|
577 |
+section 13, concerning interaction through a network will apply to the |
|
578 |
+combination as such. |
|
579 |
+ |
|
580 |
+ 14. Revised Versions of this License. |
|
581 |
+ |
|
582 |
+ The Free Software Foundation may publish revised and/or new versions of |
|
583 |
+the GNU General Public License from time to time. Such new versions will |
|
584 |
+be similar in spirit to the present version, but may differ in detail to |
|
585 |
+address new problems or concerns. |
|
586 |
+ |
|
587 |
+ Each version is given a distinguishing version number. If the |
|
588 |
+Program specifies that a certain numbered version of the GNU General |
|
589 |
+Public License "or any later version" applies to it, you have the |
|
590 |
+option of following the terms and conditions either of that numbered |
|
591 |
+version or of any later version published by the Free Software |
|
592 |
+Foundation. If the Program does not specify a version number of the |
|
593 |
+GNU General Public License, you may choose any version ever published |
|
594 |
+by the Free Software Foundation. |
|
595 |
+ |
|
596 |
+ If the Program specifies that a proxy can decide which future |
|
597 |
+versions of the GNU General Public License can be used, that proxy's |
|
598 |
+public statement of acceptance of a version permanently authorizes you |
|
599 |
+to choose that version for the Program. |
|
600 |
+ |
|
601 |
+ Later license versions may give you additional or different |
|
602 |
+permissions. However, no additional obligations are imposed on any |
|
603 |
+author or copyright holder as a result of your choosing to follow a |
|
604 |
+later version. |
|
605 |
+ |
|
606 |
+ 15. Disclaimer of Warranty. |
|
607 |
+ |
|
608 |
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY |
|
609 |
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT |
|
610 |
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY |
|
611 |
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, |
|
612 |
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
|
613 |
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM |
|
614 |
+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF |
|
615 |
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION. |
|
616 |
+ |
|
617 |
+ 16. Limitation of Liability. |
|
618 |
+ |
|
619 |
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING |
|
620 |
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS |
|
621 |
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY |
|
622 |
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE |
|
623 |
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF |
|
624 |
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD |
|
625 |
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), |
|
626 |
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF |
|
627 |
+SUCH DAMAGES. |
|
628 |
+ |
|
629 |
+ 17. Interpretation of Sections 15 and 16. |
|
630 |
+ |
|
631 |
+ If the disclaimer of warranty and limitation of liability provided |
|
632 |
+above cannot be given local legal effect according to their terms, |
|
633 |
+reviewing courts shall apply local law that most closely approximates |
|
634 |
+an absolute waiver of all civil liability in connection with the |
|
635 |
+Program, unless a warranty or assumption of liability accompanies a |
|
636 |
+copy of the Program in return for a fee. |
|
637 |
+ |
|
638 |
+ END OF TERMS AND CONDITIONS |
|
639 |
+ |
|
640 |
+ How to Apply These Terms to Your New Programs |
|
641 |
+ |
|
642 |
+ If you develop a new program, and you want it to be of the greatest |
|
643 |
+possible use to the public, the best way to achieve this is to make it |
|
644 |
+free software which everyone can redistribute and change under these terms. |
|
645 |
+ |
|
646 |
+ To do so, attach the following notices to the program. It is safest |
|
647 |
+to attach them to the start of each source file to most effectively |
|
648 |
+state the exclusion of warranty; and each file should have at least |
|
649 |
+the "copyright" line and a pointer to where the full notice is found. |
|
650 |
+ |
|
651 |
+ <one line to give the program's name and a brief idea of what it does.> |
|
652 |
+ Copyright (C) <year> <name of author> |
|
653 |
+ |
|
654 |
+ This program is free software: you can redistribute it and/or modify |
|
655 |
+ it under the terms of the GNU General Public License as published by |
|
656 |
+ the Free Software Foundation, either version 3 of the License, or |
|
657 |
+ (at your option) any later version. |
|
658 |
+ |
|
659 |
+ This program is distributed in the hope that it will be useful, |
|
660 |
+ but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
661 |
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
662 |
+ GNU General Public License for more details. |
|
663 |
+ |
|
664 |
+ You should have received a copy of the GNU General Public License |
|
665 |
+ along with this program. If not, see <https://www.gnu.org/licenses/>. |
|
666 |
+ |
|
667 |
+Also add information on how to contact you by electronic and paper mail. |
|
668 |
+ |
|
669 |
+ If the program does terminal interaction, make it output a short |
|
670 |
+notice like this when it starts in an interactive mode: |
|
671 |
+ |
|
672 |
+ <program> Copyright (C) <year> <name of author> |
|
673 |
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. |
|
674 |
+ This is free software, and you are welcome to redistribute it |
|
675 |
+ under certain conditions; type `show c' for details. |
|
676 |
+ |
|
677 |
+The hypothetical commands `show w' and `show c' should show the appropriate |
|
678 |
+parts of the General Public License. Of course, your program's commands |
|
679 |
+might be different; for a GUI interface, you would use an "about box". |
|
680 |
+ |
|
681 |
+ You should also get your employer (if you work as a programmer) or school, |
|
682 |
+if any, to sign a "copyright disclaimer" for the program, if necessary. |
|
683 |
+For more information on this, and how to apply and follow the GNU GPL, see |
|
684 |
+<https://www.gnu.org/licenses/>. |
|
685 |
+ |
|
686 |
+ The GNU General Public License does not permit incorporating your program |
|
687 |
+into proprietary programs. If your program is a subroutine library, you |
|
688 |
+may consider it more useful to permit linking proprietary applications with |
|
689 |
+the library. If this is what you want to do, use the GNU Lesser General |
|
690 |
+Public License instead of this License. But first, please read |
|
691 |
+<https://www.gnu.org/licenses/why-not-lgpl.html>. |
|
692 |
+ |
|
693 |
+ |
|
694 |
+ |
|
695 |
+ GNU LESSER GENERAL PUBLIC LICENSE |
|
696 |
+ Version 3, 29 June 2007 |
|
697 |
+ |
|
698 |
+ Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/> |
|
699 |
+ Everyone is permitted to copy and distribute verbatim copies |
|
700 |
+ of this license document, but changing it is not allowed. |
|
701 |
+ |
|
702 |
+ |
|
703 |
+ This version of the GNU Lesser General Public License incorporates |
|
704 |
+the terms and conditions of version 3 of the GNU General Public |
|
705 |
+License, supplemented by the additional permissions listed below. |
|
706 |
+ |
|
707 |
+ 0. Additional Definitions. |
|
708 |
+ |
|
709 |
+ As used herein, "this License" refers to version 3 of the GNU Lesser |
|
710 |
+General Public License, and the "GNU GPL" refers to version 3 of the GNU |
|
711 |
+General Public License. |
|
712 |
+ |
|
713 |
+ "The Library" refers to a covered work governed by this License, |
|
714 |
+other than an Application or a Combined Work as defined below. |
|
715 |
+ |
|
716 |
+ An "Application" is any work that makes use of an interface provided |
|
717 |
+by the Library, but which is not otherwise based on the Library. |
|
718 |
+Defining a subclass of a class defined by the Library is deemed a mode |
|
719 |
+of using an interface provided by the Library. |
|
720 |
+ |
|
721 |
+ A "Combined Work" is a work produced by combining or linking an |
|
722 |
+Application with the Library. The particular version of the Library |
|
723 |
+with which the Combined Work was made is also called the "Linked |
|
724 |
+Version". |
|
725 |
+ |
|
726 |
+ The "Minimal Corresponding Source" for a Combined Work means the |
|
727 |
+Corresponding Source for the Combined Work, excluding any source code |
|
728 |
+for portions of the Combined Work that, considered in isolation, are |
|
729 |
+based on the Application, and not on the Linked Version. |
|
730 |
+ |
|
731 |
+ The "Corresponding Application Code" for a Combined Work means the |
|
732 |
+object code and/or source code for the Application, including any data |
|
733 |
+and utility programs needed for reproducing the Combined Work from the |
|
734 |
+Application, but excluding the System Libraries of the Combined Work. |
|
735 |
+ |
|
736 |
+ 1. Exception to Section 3 of the GNU GPL. |
|
737 |
+ |
|
738 |
+ You may convey a covered work under sections 3 and 4 of this License |
|
739 |
+without being bound by section 3 of the GNU GPL. |
|
740 |
+ |
|
741 |
+ 2. Conveying Modified Versions. |
|
742 |
+ |
|
743 |
+ If you modify a copy of the Library, and, in your modifications, a |
|
744 |
+facility refers to a function or data to be supplied by an Application |
|
745 |
+that uses the facility (other than as an argument passed when the |
|
746 |
+facility is invoked), then you may convey a copy of the modified |
|
747 |
+version: |
|
748 |
+ |
|
749 |
+ a) under this License, provided that you make a good faith effort to |
|
750 |
+ ensure that, in the event an Application does not supply the |
|
751 |
+ function or data, the facility still operates, and performs |
|
752 |
+ whatever part of its purpose remains meaningful, or |
|
753 |
+ |
|
754 |
+ b) under the GNU GPL, with none of the additional permissions of |
|
755 |
+ this License applicable to that copy. |
|
756 |
+ |
|
757 |
+ 3. Object Code Incorporating Material from Library Header Files. |
|
758 |
+ |
|
759 |
+ The object code form of an Application may incorporate material from |
|
760 |
+a header file that is part of the Library. You may convey such object |
|
761 |
+code under terms of your choice, provided that, if the incorporated |
|
762 |
+material is not limited to numerical parameters, data structure |
|
763 |
+layouts and accessors, or small macros, inline functions and templates |
|
764 |
+(ten or fewer lines in length), you do both of the following: |
|
765 |
+ |
|
766 |
+ a) Give prominent notice with each copy of the object code that the |
|
767 |
+ Library is used in it and that the Library and its use are |
|
768 |
+ covered by this License. |
|
769 |
+ |
|
770 |
+ b) Accompany the object code with a copy of the GNU GPL and this license |
|
771 |
+ document. |
|
772 |
+ |
|
773 |
+ 4. Combined Works. |
|
774 |
+ |
|
775 |
+ You may convey a Combined Work under terms of your choice that, |
|
776 |
+taken together, effectively do not restrict modification of the |
|
777 |
+portions of the Library contained in the Combined Work and reverse |
|
778 |
+engineering for debugging such modifications, if you also do each of |
|
779 |
+the following: |
|
780 |
+ |
|
781 |
+ a) Give prominent notice with each copy of the Combined Work that |
|
782 |
+ the Library is used in it and that the Library and its use are |
|
783 |
+ covered by this License. |
|
784 |
+ |
|
785 |
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license |
|
786 |
+ document. |
|
787 |
+ |
|
788 |
+ c) For a Combined Work that displays copyright notices during |
|
789 |
+ execution, include the copyright notice for the Library among |
|
790 |
+ these notices, as well as a reference directing the user to the |
|
791 |
+ copies of the GNU GPL and this license document. |
|
792 |
+ |
|
793 |
+ d) Do one of the following: |
|
794 |
+ |
|
795 |
+ 0) Convey the Minimal Corresponding Source under the terms of this |
|
796 |
+ License, and the Corresponding Application Code in a form |
|
797 |
+ suitable for, and under terms that permit, the user to |
|
798 |
+ recombine or relink the Application with a modified version of |
|
799 |
+ the Linked Version to produce a modified Combined Work, in the |
|
800 |
+ manner specified by section 6 of the GNU GPL for conveying |
|
801 |
+ Corresponding Source. |
|
802 |
+ |
|
803 |
+ 1) Use a suitable shared library mechanism for linking with the |
|
804 |
+ Library. A suitable mechanism is one that (a) uses at run time |
|
805 |
+ a copy of the Library already present on the user's computer |
|
806 |
+ system, and (b) will operate properly with a modified version |
|
807 |
+ of the Library that is interface-compatible with the Linked |
|
808 |
+ Version. |
|
809 |
+ |
|
810 |
+ e) Provide Installation Information, but only if you would otherwise |
|
811 |
+ be required to provide such information under section 6 of the |
|
812 |
+ GNU GPL, and only to the extent that such information is |
|
813 |
+ necessary to install and execute a modified version of the |
|
814 |
+ Combined Work produced by recombining or relinking the |
|
815 |
+ Application with a modified version of the Linked Version. (If |
|
816 |
+ you use option 4d0, the Installation Information must accompany |
|
817 |
+ the Minimal Corresponding Source and Corresponding Application |
|
818 |
+ Code. If you use option 4d1, you must provide the Installation |
|
819 |
+ Information in the manner specified by section 6 of the GNU GPL |
|
820 |
+ for conveying Corresponding Source.) |
|
821 |
+ |
|
822 |
+ 5. Combined Libraries. |
|
823 |
+ |
|
824 |
+ You may place library facilities that are a work based on the |
|
825 |
+Library side by side in a single library together with other library |
|
826 |
+facilities that are not Applications and are not covered by this |
|
827 |
+License, and convey such a combined library under terms of your |
|
828 |
+choice, if you do both of the following: |
|
829 |
+ |
|
830 |
+ a) Accompany the combined library with a copy of the same work based |
|
831 |
+ on the Library, uncombined with any other library facilities, |
|
832 |
+ conveyed under the terms of this License. |
|
833 |
+ |
|
834 |
+ b) Give prominent notice with the combined library that part of it |
|
835 |
+ is a work based on the Library, and explaining where to find the |
|
836 |
+ accompanying uncombined form of the same work. |
|
837 |
+ |
|
838 |
+ 6. Revised Versions of the GNU Lesser General Public License. |
|
839 |
+ |
|
840 |
+ The Free Software Foundation may publish revised and/or new versions |
|
841 |
+of the GNU Lesser General Public License from time to time. Such new |
|
842 |
+versions will be similar in spirit to the present version, but may |
|
843 |
+differ in detail to address new problems or concerns. |
|
844 |
+ |
|
845 |
+ Each version is given a distinguishing version number. If the |
|
846 |
+Library as you received it specifies that a certain numbered version |
|
847 |
+of the GNU Lesser General Public License "or any later version" |
|
848 |
+applies to it, you have the option of following the terms and |
|
849 |
+conditions either of that published version or of any later version |
|
850 |
+published by the Free Software Foundation. If the Library as you |
|
851 |
+received it does not specify a version number of the GNU Lesser |
|
852 |
+General Public License, you may choose any version of the GNU Lesser |
|
853 |
+General Public License ever published by the Free Software Foundation. |
|
854 |
+ |
|
855 |
+ If the Library as you received it specifies that a proxy can decide |
|
856 |
+whether future versions of the GNU Lesser General Public License shall |
|
857 |
+apply, that proxy's public statement of acceptance of any version is |
|
858 |
+permanent authorization for you to choose that version for the |
|
859 |
+Library. |
|
860 |
+ |
... | ... |
@@ -0,0 +1,174 @@ |
1 |
+declare module lib_trait { |
|
2 |
+} |
|
3 |
+/** |
|
4 |
+ * @author fenris |
|
5 |
+ */ |
|
6 |
+declare module lib_trait { |
|
7 |
+ /** |
|
8 |
+ * @author fenris |
|
9 |
+ */ |
|
10 |
+ var _verbosity: number; |
|
11 |
+ /** |
|
12 |
+ * @author fenris |
|
13 |
+ */ |
|
14 |
+ var _logprefix: string; |
|
15 |
+ /** |
|
16 |
+ * @author fenris |
|
17 |
+ */ |
|
18 |
+ type type_domainparameters = { |
|
19 |
+ [key: string]: any; |
|
20 |
+ }; |
|
21 |
+ /** |
|
22 |
+ * @author fenris |
|
23 |
+ */ |
|
24 |
+ type type_domain = { |
|
25 |
+ kind: string; |
|
26 |
+ parameters?: type_domainparameters; |
|
27 |
+ }; |
|
28 |
+ /** |
|
29 |
+ * @author fenris |
|
30 |
+ */ |
|
31 |
+ type type_instance<type_value> = { |
|
32 |
+ domain: type_domain; |
|
33 |
+ value: type_value; |
|
34 |
+ }; |
|
35 |
+ /** |
|
36 |
+ * @author fenris |
|
37 |
+ */ |
|
38 |
+ type type_handler = (domain_parameters?: type_domainparameters) => any; |
|
39 |
+ /** |
|
40 |
+ * @author fenris |
|
41 |
+ */ |
|
42 |
+ type type_facet_raw = { |
|
43 |
+ shape?: lib_shape.type_shape; |
|
44 |
+ description?: string; |
|
45 |
+ implementation?: Function; |
|
46 |
+ }; |
|
47 |
+ /** |
|
48 |
+ * @author fenris |
|
49 |
+ */ |
|
50 |
+ type type_condition = (attends: (trait_id: string, domain: type_domain) => boolean) => ((domain_parameters: type_domainparameters) => boolean); |
|
51 |
+ /** |
|
52 |
+ * @author fenris |
|
53 |
+ */ |
|
54 |
+ type type_typechecker = (value: any, shape: lib_shape.type_shape, logger: (message: string) => void) => boolean; |
|
55 |
+ /** |
|
56 |
+ * @author fenris |
|
57 |
+ */ |
|
58 |
+ function set_typechecker(typechecker: type_typechecker): void; |
|
59 |
+ /** |
|
60 |
+ * @author fenris |
|
61 |
+ */ |
|
62 |
+ function domain_instance<type_value>(domain: type_domain, value: type_value): type_instance<type_value>; |
|
63 |
+ /** |
|
64 |
+ * @desc adds a trait |
|
65 |
+ * @author fenris |
|
66 |
+ */ |
|
67 |
+ function define(trait_id: string, variable_conditions: { |
|
68 |
+ [variable_name: string]: Array<string>; |
|
69 |
+ }, facets_raw: { |
|
70 |
+ [facet_name: string]: type_facet_raw; |
|
71 |
+ }): void; |
|
72 |
+ /** |
|
73 |
+ * @desc adhoc binding |
|
74 |
+ * @author fenris |
|
75 |
+ */ |
|
76 |
+ function attend(trait_id: string, domain_kind: string, bindings: { |
|
77 |
+ [variable_name: string]: lib_shape.type_shape; |
|
78 |
+ }, handlers: { |
|
79 |
+ [facet_name: string]: type_handler; |
|
80 |
+ }, condition?: type_condition): void; |
|
81 |
+ /** |
|
82 |
+ * @desc calls a facet from a trait according to a given domain |
|
83 |
+ * @author fenris |
|
84 |
+ */ |
|
85 |
+ function call(trait_id: string, facet_name: string, domain: type_domain, check?: boolean): any; |
|
86 |
+ /** |
|
87 |
+ * @author fenris |
|
88 |
+ */ |
|
89 |
+ function explain(trait_id: string): string; |
|
90 |
+ /** |
|
91 |
+ * @author fenris |
|
92 |
+ */ |
|
93 |
+ function explain_all(): string; |
|
94 |
+} |
|
95 |
+/** |
|
96 |
+ * @author fenris |
|
97 |
+ */ |
|
98 |
+declare module lib_trait { |
|
99 |
+ /** |
|
100 |
+ * @desc the ability to check for equality with another element of the same domain |
|
101 |
+ * @author fenris |
|
102 |
+ */ |
|
103 |
+ function define_collatable(): void; |
|
104 |
+ /** |
|
105 |
+ * @author fenris |
|
106 |
+ */ |
|
107 |
+ function _collate(instance: any, other: any, domain?: { |
|
108 |
+ "kind": string; |
|
109 |
+ }): boolean; |
|
110 |
+} |
|
111 |
+/** |
|
112 |
+ * @author fenris |
|
113 |
+ */ |
|
114 |
+declare module lib_trait { |
|
115 |
+ /** |
|
116 |
+ * @desc the ability to compare with another element of the same domain for determining if the first is "smaller than or equal to" the latter |
|
117 |
+ * @author fenris |
|
118 |
+ */ |
|
119 |
+ function define_comparable(): void; |
|
120 |
+ /** |
|
121 |
+ * @author fenris |
|
122 |
+ */ |
|
123 |
+ function _compare(instance: any, other: any, domain?: { |
|
124 |
+ "kind": string; |
|
125 |
+ }): boolean; |
|
126 |
+} |
|
127 |
+/** |
|
128 |
+ * @author fenris |
|
129 |
+ */ |
|
130 |
+declare module lib_trait { |
|
131 |
+ /** |
|
132 |
+ * @desc the ability to create an exact copy |
|
133 |
+ * @author fenris |
|
134 |
+ */ |
|
135 |
+ function define_clonable(): void; |
|
136 |
+ /** |
|
137 |
+ * @author fenris |
|
138 |
+ */ |
|
139 |
+ function _clone(instance: any, domain?: { |
|
140 |
+ "kind": string; |
|
141 |
+ }): any; |
|
142 |
+} |
|
143 |
+/** |
|
144 |
+ * @author fenris |
|
145 |
+ */ |
|
146 |
+declare module lib_trait { |
|
147 |
+ /** |
|
148 |
+ * @desc the ability to generate a string out of the element, which identifies it to a high degree |
|
149 |
+ * @author fenris |
|
150 |
+ */ |
|
151 |
+ function define_hashable(): void; |
|
152 |
+ /** |
|
153 |
+ * @author fenris |
|
154 |
+ */ |
|
155 |
+ function _hash(instance: any, domain?: { |
|
156 |
+ "kind": string; |
|
157 |
+ }): string; |
|
158 |
+} |
|
159 |
+/** |
|
160 |
+ * @author fenris |
|
161 |
+ */ |
|
162 |
+declare module lib_trait { |
|
163 |
+ /** |
|
164 |
+ * @desc the ability to map the element to a textual representation (most likely not injective) |
|
165 |
+ * @author fenris |
|
166 |
+ */ |
|
167 |
+ function define_showable(): void; |
|
168 |
+ /** |
|
169 |
+ * @author fenris |
|
170 |
+ */ |
|
171 |
+ function _show(instance: any, domain?: { |
|
172 |
+ "kind": string; |
|
173 |
+ }): string; |
|
174 |
+} |
... | ... |
@@ -0,0 +1,964 @@ |
1 |
+/* |
|
2 |
+This file is part of »bacterio-plankton:trait«. |
|
3 |
+ |
|
4 |
+Copyright 2016-2018 greenscale <info@greenscale.de> |
|
5 |
+ |
|
6 |
+»bacterio-plankton:trait« is free software: you can redistribute it and/or modify |
|
7 |
+it under the terms of the GNU Lesser General Public License as published by |
|
8 |
+the Free Software Foundation, either version 3 of the License, or |
|
9 |
+(at your option) any later version. |
|
10 |
+ |
|
11 |
+»bacterio-plankton:trait« is distributed in the hope that it will be callful, |
|
12 |
+but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
+GNU Lesser General Public License for more details. |
|
15 |
+ |
|
16 |
+You should have received a copy of the GNU Lesser General Public License |
|
17 |
+along with »bacterio-plankton:trait«. If not, see <http://www.gnu.org/licenses/>. |
|
18 |
+ */ |
|
19 |
+var lib_trait; |
|
20 |
+(function (lib_trait) { |
|
21 |
+ /** |
|
22 |
+ * @author fenris |
|
23 |
+ */ |
|
24 |
+ function domain_make(_a, _make) { |
|
25 |
+ var _b = _a["soft"], soft = _b === void 0 ? false : _b, kind = _a["kind"]; |
|
26 |
+ return { |
|
27 |
+ "soft": soft, |
|
28 |
+ "kind": kind |
|
29 |
+ }; |
|
30 |
+ } |
|
31 |
+ /** |
|
32 |
+ * @author fenris |
|
33 |
+ */ |
|
34 |
+ function domain_inspect(parameters, value, _inspect) { |
|
35 |
+ var inspection = lib_shape.inspection_create(); |
|
36 |
+ if (value == undefined) { |
|
37 |
+ if (parameters.soft) { |
|
38 |
+ // all good |
|
39 |
+ } |
|
40 |
+ else { |
|
41 |
+ lib_shape.inspection_add(inspection, "null is not allowed"); |
|
42 |
+ } |
|
43 |
+ } |
|
44 |
+ else { |
|
45 |
+ var jstype_actual = typeof (value); |
|
46 |
+ var jstype_expected = "object"; |
|
47 |
+ if (jstype_actual === jstype_expected) { |
|
48 |
+ if ("domain" in value) { |
|
49 |
+ var domain_actual = value["domain"]["kind"]; |
|
50 |
+ var domain_expected = parameters.kind; |
|
51 |
+ if (domain_actual == domain_expected) { |
|
52 |
+ // all good? |
|
53 |
+ } |
|
54 |
+ else { |
|
55 |
+ lib_shape.inspection_add(inspection, "expected domain-kind '" + domain_expected + "' but got '" + domain_actual + "'"); |
|
56 |
+ } |
|
57 |
+ } |
|
58 |
+ else { |
|
59 |
+ lib_shape.inspection_add(inspection, "field 'domain' missing"); |
|
60 |
+ } |
|
61 |
+ } |
|
62 |
+ else { |
|
63 |
+ lib_shape.inspection_add(inspection, "expected JS-type '" + jstype_expected + "' but got '" + jstype_actual + "'"); |
|
64 |
+ } |
|
65 |
+ } |
|
66 |
+ return inspection; |
|
67 |
+ } |
|
68 |
+ /** |
|
69 |
+ * @author fenris |
|
70 |
+ */ |
|
71 |
+ function domain_stance(parameters, bindings, _stance) { |
|
72 |
+ return { |
|
73 |
+ "name": "domain", |
|
74 |
+ "parameters": { |
|
75 |
+ "soft": parameters.soft, |
|
76 |
+ "kind": parameters.kind |
|
77 |
+ } |
|
78 |
+ }; |
|
79 |
+ } |
|
80 |
+ /** |
|
81 |
+ * @author fenris |
|
82 |
+ */ |
|
83 |
+ function domain_show(parameters, _show) { |
|
84 |
+ var str; |
|
85 |
+ // core |
|
86 |
+ { |
|
87 |
+ str = ("#" + parameters.kind); |
|
88 |
+ } |
|
89 |
+ /* |
|
90 |
+ // parameters |
|
91 |
+ { |
|
92 |
+ str += (":" + JSON.stringify(parameters.parameters)) |
|
93 |
+ } |
|
94 |
+ */ |
|
95 |
+ // soft |
|
96 |
+ { |
|
97 |
+ if (parameters.soft) { |
|
98 |
+ str = "~" + str; |
|
99 |
+ } |
|
100 |
+ } |
|
101 |
+ return str; |
|
102 |
+ } |
|
103 |
+ /** |
|
104 |
+ * @author fenris |
|
105 |
+ */ |
|
106 |
+ lib_shape.register({ |
|
107 |
+ "name": "domain", |
|
108 |
+ "make": domain_make, |
|
109 |
+ "inspect": domain_inspect, |
|
110 |
+ "stance": domain_stance, |
|
111 |
+ "show": domain_show |
|
112 |
+ }); |
|
113 |
+})(lib_trait || (lib_trait = {})); |
|
114 |
+/* |
|
115 |
+This file is part of »bacterio-plankton:trait«. |
|
116 |
+ |
|
117 |
+Copyright 2016-2018 greenscale <info@greenscale.de> |
|
118 |
+ |
|
119 |
+»bacterio-plankton:trait« is free software: you can redistribute it and/or modify |
|
120 |
+it under the terms of the GNU Lesser General Public License as published by |
|
121 |
+the Free Software Foundation, either version 3 of the License, or |
|
122 |
+(at your option) any later version. |
|
123 |
+ |
|
124 |
+»bacterio-plankton:trait« is distributed in the hope that it will be callful, |
|
125 |
+but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
126 |
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
127 |
+GNU Lesser General Public License for more details. |
|
128 |
+ |
|
129 |
+You should have received a copy of the GNU Lesser General Public License |
|
130 |
+along with »bacterio-plankton:trait«. If not, see <http://www.gnu.org/licenses/>. |
|
131 |
+ */ |
|
132 |
+/** |
|
133 |
+ * @author fenris |
|
134 |
+ */ |
|
135 |
+var lib_trait; |
|
136 |
+(function (lib_trait) { |
|
137 |
+ /** |
|
138 |
+ * @author fenris |
|
139 |
+ */ |
|
140 |
+ lib_trait._verbosity = 1; |
|
141 |
+ /** |
|
142 |
+ * @author fenris |
|
143 |
+ */ |
|
144 |
+ lib_trait._logprefix = "[lib_trait] "; |
|
145 |
+ /** |
|
146 |
+ * @desc holds all defined traits |
|
147 |
+ * @author fenris |
|
148 |
+ */ |
|
149 |
+ var _pool = {}; |
|
150 |
+ /** |
|
151 |
+ * @author fenris |
|
152 |
+ */ |
|
153 |
+ var _typechecker = function (value, shape, logger) { |
|
154 |
+ var messages = lib_shape.inspect(shape, value).messages; |
|
155 |
+ messages.forEach(logger); |
|
156 |
+ return (messages.length === 0); |
|
157 |
+ }; |
|
158 |
+ /** |
|
159 |
+ * @author fenris |
|
160 |
+ */ |
|
161 |
+ function log(_a) { |
|
162 |
+ var message = _a["message"], _b = _a["kind"], kind = _b === void 0 ? "log" : _b, _c = _a["level"], level = _c === void 0 ? 0 : _c; |
|
163 |
+ if (level <= lib_trait._verbosity) { |
|
164 |
+ var message_ = "" + lib_trait._logprefix + message; |
|
165 |
+ switch (kind) { |
|
166 |
+ default: |
|
167 |
+ case "log": { |
|
168 |
+ console.log(message_); |
|
169 |
+ break; |
|
170 |
+ } |
|
171 |
+ case "information": |
|
172 |
+ case "info": { |
|
173 |
+ console.info(message_); |
|
174 |
+ break; |
|
175 |
+ } |
|
176 |
+ case "warning": |
|
177 |
+ case "warn": { |
|
178 |
+ console.warn(message_); |
|
179 |
+ break; |
|
180 |
+ } |
|
181 |
+ case "error": |
|
182 |
+ case "err": { |
|
183 |
+ console.error(message_); |
|
184 |
+ break; |
|
185 |
+ } |
|
186 |
+ } |
|
187 |
+ } |
|
188 |
+ } |
|
189 |
+ /** |
|
190 |
+ * @author fenris |
|
191 |
+ */ |
|
192 |
+ function set_typechecker(typechecker) { |
|
193 |
+ _typechecker = typechecker; |
|
194 |
+ } |
|
195 |
+ lib_trait.set_typechecker = set_typechecker; |
|
196 |
+ /** |
|
197 |
+ * @author fenris |
|
198 |
+ */ |
|
199 |
+ function domain_instance(domain, value) { |
|
200 |
+ return { "domain": domain, "value": value }; |
|
201 |
+ } |
|
202 |
+ lib_trait.domain_instance = domain_instance; |
|
203 |
+ /** |
|
204 |
+ * @desc adds a trait |
|
205 |
+ * @author fenris |
|
206 |
+ */ |
|
207 |
+ function define(trait_id, variable_conditions, facets_raw) { |
|
208 |
+ if (trait_id in _pool) { |
|
209 |
+ var message = "trait '" + trait_id + "' already registered"; |
|
210 |
+ throw (new Error(message)); |
|
211 |
+ } |
|
212 |
+ else { |
|
213 |
+ var trait_1 = { |
|
214 |
+ "variables": {}, |
|
215 |
+ "facets": {}, |
|
216 |
+ "attendants": {} |
|
217 |
+ }; |
|
218 |
+ Object.keys(variable_conditions).forEach(function (variable_name) { |
|
219 |
+ var variable = { |
|
220 |
+ "conditions": variable_conditions[variable_name], |
|
221 |
+ "bindings": {} |
|
222 |
+ }; |
|
223 |
+ trait_1.variables[variable_name] = variable; |
|
224 |
+ }); |
|
225 |
+ Object.keys(facets_raw).forEach(function (facet_name) { |
|
226 |
+ var facet_raw = facets_raw[facet_name]; |
|
227 |
+ var facet = { |
|
228 |
+ "shape": lib_shape.make(facet_raw.shape || { "name": "any" }), |
|
229 |
+ "description": facet_raw.description, |
|
230 |
+ "implementation": facet_raw.implementation, |
|
231 |
+ "handlers": {} |
|
232 |
+ }; |
|
233 |
+ trait_1.facets[facet_name] = facet; |
|
234 |
+ }); |
|
235 |
+ _pool[trait_id] = trait_1; |
|
236 |
+ } |
|
237 |
+ } |
|
238 |
+ lib_trait.define = define; |
|
239 |
+ /** |
|
240 |
+ * @desc adhoc binding |
|
241 |
+ * @author fenris |
|
242 |
+ */ |
|
243 |
+ function attend(trait_id, domain_kind, bindings, handlers, condition) { |
|
244 |
+ if (condition === void 0) { condition = null; } |
|
245 |
+ var strict_binding = true; |
|
246 |
+ var strict_handling = true; |
|
247 |
+ if (!_pool.hasOwnProperty(trait_id)) { |
|
248 |
+ var message = "no trait '" + trait_id + "'"; |
|
249 |
+ throw (new Error(message)); |
|
250 |
+ } |
|
251 |
+ else { |
|
252 |
+ var trait_2 = _pool[trait_id]; |
|
253 |
+ // assignments |
|
254 |
+ { |
|
255 |
+ // variables |
|
256 |
+ { |
|
257 |
+ Object.keys(bindings).forEach(function (variable_name) { |
|
258 |
+ if (!trait_2.variables.hasOwnProperty(variable_name)) { |
|
259 |
+ var message = ""; |
|
260 |
+ message += "no variable '" + variable_name + "'"; |
|
261 |
+ message += " to bind in trait '" + trait_id + "'"; |
|
262 |
+ log({ "message": message, "kind": "warning" }); |
|
263 |
+ // throw (new Error(message)); |
|
264 |
+ } |
|
265 |
+ else { |
|
266 |
+ var variable = trait_2.variables[variable_name]; |
|
267 |
+ if (variable.bindings.hasOwnProperty(domain_kind)) { |
|
268 |
+ var message = ""; |
|
269 |
+ message += "variable '" + variable_name + "'"; |
|
270 |
+ message += " already bound for domain '" + domain_kind + "'"; |
|
271 |
+ message += " in trait '" + trait_id + "'"; |
|
272 |
+ throw (new Error(message)); |
|
273 |
+ } |
|
274 |
+ else { |
|
275 |
+ variable.bindings[domain_kind] = lib_shape.make(bindings[variable_name]); |
|
276 |
+ } |
|
277 |
+ } |
|
278 |
+ }); |
|
279 |
+ } |
|
280 |
+ // facets |
|
281 |
+ { |
|
282 |
+ Object.keys(handlers).forEach(function (facet_name) { |
|
283 |
+ if (!trait_2.facets.hasOwnProperty(facet_name)) { |
|
284 |
+ var message = ""; |
|
285 |
+ message += "no facet '" + facet_name + "'"; |
|
286 |
+ message += " to implement at trait '" + trait_id + "'"; |
|
287 |
+ log({ "kind": "warning", "message": message }); |
|
288 |
+ // throw (new Error(message)); |
|
289 |
+ } |
|
290 |
+ else { |
|
291 |
+ var facet = trait_2.facets[facet_name]; |
|
292 |
+ var intrinsic = (facet.implementation != undefined); |
|
293 |
+ if (intrinsic) { |
|
294 |
+ var message = "shadowing intrinsic facet '" + facet_name + "'"; |
|
295 |
+ console.warn(message); |
|
296 |
+ } |
|
297 |
+ else { |
|
298 |
+ // do nothing |
|
299 |
+ } |
|
300 |
+ if (facet.handlers.hasOwnProperty(domain_kind)) { |
|
301 |
+ var message = ""; |
|
302 |
+ message += "facet '" + facet_name + "'"; |
|
303 |
+ message += " already implemented in domain '" + domain_kind + "'"; |
|
304 |
+ message += " at trait '" + trait_id + "'"; |
|
305 |
+ throw (new Error(message)); |
|
306 |
+ } |
|
307 |
+ else { |
|
308 |
+ facet.handlers[domain_kind] = handlers[facet_name]; |
|
309 |
+ } |
|
310 |
+ } |
|
311 |
+ }); |
|
312 |
+ } |
|
313 |
+ // attendants |
|
314 |
+ { |
|
315 |
+ trait_2.attendants[domain_kind] = { |
|
316 |
+ "condition": condition |
|
317 |
+ }; |
|
318 |
+ } |
|
319 |
+ } |
|
320 |
+ // checks |
|
321 |
+ { |
|
322 |
+ var messages_1 = []; |
|
323 |
+ // variables |
|
324 |
+ { |
|
325 |
+ if (strict_binding) { |
|
326 |
+ var variable_names_given_1 = Object.keys(bindings); |
|
327 |
+ var variable_names_present = Object.keys(trait_2.variables); |
|
328 |
+ var variable_names_missing = variable_names_present.filter(function (variable_name) { return (!variable_names_given_1.some(function (variable_name_) { return (variable_name == variable_name_); })); }); |
|
329 |
+ variable_names_missing.forEach(function (variable_name) { |
|
330 |
+ var message = "binding missing for variable '" + variable_name + "'"; |
|
331 |
+ messages_1.push(message); |
|
332 |
+ }); |
|
333 |
+ } |
|
334 |
+ else { |
|
335 |
+ // do nothing |
|
336 |
+ } |
|
337 |
+ } |
|
338 |
+ // facets |
|
339 |
+ { |
|
340 |
+ if (strict_handling) { |
|
341 |
+ var facet_names_given_1 = Object.keys(handlers); |
|
342 |
+ var facet_names_needed = (Object.keys(trait_2.facets).filter(function (facet_name) { return (trait_2.facets[facet_name].implementation == undefined); })); |
|
343 |
+ var facet_names_missing = (facet_names_needed.filter(function (facet_name) { return (!facet_names_given_1.some(function (facet_name_) { return (facet_name === facet_name_); })); })); |
|
344 |
+ facet_names_missing.forEach(function (facet_name) { |
|
345 |
+ var message = "implementation missing for the facet '" + facet_name + "'"; |
|
346 |
+ messages_1.push(message); |
|
347 |
+ }); |
|
348 |
+ } |
|
349 |
+ else { |
|
350 |
+ // do nothing |
|
351 |
+ } |
|
352 |
+ } |
|
353 |
+ if (messages_1.length > 0) { |
|
354 |
+ var message = ""; |
|
355 |
+ message += "assignment of domain '" + domain_kind + "'"; |
|
356 |
+ message += " to trait '" + trait_id + "'"; |
|
357 |
+ message += " incomplete: " + messages_1.join(", "); |
|
358 |
+ throw (new Error(message)); |
|
359 |
+ } |
|
360 |
+ } |
|
361 |
+ } |
|
362 |
+ } |
|
363 |
+ lib_trait.attend = attend; |
|
364 |
+ /** |
|
365 |
+ * @desc calls a facet from a trait according to a given domain |
|
366 |
+ * @author fenris |
|
367 |
+ */ |
|
368 |
+ function call(trait_id, facet_name, domain, check) { |
|
369 |
+ if (check === void 0) { check = true; } |
|
370 |
+ if (!_pool.hasOwnProperty(trait_id)) { |
|
371 |
+ var message = "no trait '" + trait_id + "'"; |
|
372 |
+ throw (new Error(message)); |
|
373 |
+ } |
|
374 |
+ else { |
|
375 |
+ var trait_3 = _pool[trait_id]; |
|
376 |
+ if (!trait_3.facets.hasOwnProperty(facet_name)) { |
|
377 |
+ var message = "no facet '" + facet_name + "' in trait '" + trait_id + "'"; |
|
378 |
+ throw (new Error(message)); |
|
379 |
+ } |
|
380 |
+ else { |
|
381 |
+ var facet = trait_3.facets[facet_name]; |
|
382 |
+ var intrinsic = (facet.implementation !== undefined); |
|
383 |
+ var result = void 0; |
|
384 |
+ if (intrinsic) { |
|
385 |
+ result = facet.implementation(function (facet_name_) { return call(trait_id, facet_name_, domain, check); }); |
|
386 |
+ } |
|
387 |
+ else { |
|
388 |
+ if (!facet.handlers.hasOwnProperty(domain.kind)) { |
|
389 |
+ var message = ""; |
|
390 |
+ message += "implementation missing"; |
|
391 |
+ message += " at trait '" + trait_id + "'"; |
|
392 |
+ message += " for facet '" + facet_name + "'"; |
|
393 |
+ message += " in domain '" + domain.kind + "'"; |
|
394 |
+ throw (new Error(message)); |
|
395 |
+ } |
|
396 |
+ else { |
|
397 |
+ var show_shape = (function (shape) { return lib_shape.show(shape); }); |
|
398 |
+ var handler = facet.handlers[domain.kind]; |
|
399 |
+ var bindings_1 = {}; |
|
400 |
+ Object.keys(trait_3.variables).forEach(function (variable_name) { |
|
401 |
+ bindings_1[variable_name] = trait_3.variables[variable_name].bindings[domain.kind]; |
|
402 |
+ }); |
|
403 |
+ result = handler(domain.parameters); |
|
404 |
+ if (check |
|
405 |
+ && |
|
406 |
+ (_typechecker !== null) |
|
407 |
+ && |
|
408 |
+ (facet.shape !== undefined)) { |
|
409 |
+ var shape = lib_shape.stance(facet.shape, bindings_1); |
|
410 |
+ // console.info("expected shape of result: " + lib_shape.show(shape)); console.info("result: ", result); |
|
411 |
+ var valid = _typechecker(result, shape, function (message) { return log({ "kind": "warning", "message": "[typechecker] [result] " + message }); }); |
|
412 |
+ if (!valid) { |
|
413 |
+ var message = ""; |
|
414 |
+ message += "result '" + instance_show(result) + "'"; |
|
415 |
+ message += " doesn't match the expected type '" + show_shape(shape) + "'"; |
|
416 |
+ message += " at trait '" + trait_id + "'"; |
|
417 |
+ message += " for facet '" + facet_name + "'"; |
|
418 |
+ message += " in domain '" + domain.kind + "'"; |
|
419 |
+ log({ "kind": "warning", "message": message }); |
|
420 |
+ } |
|
421 |
+ { |
|
422 |
+ var condition = trait_3.attendants[domain.kind].condition; |
|
423 |
+ if (condition != null) { |
|
424 |
+ var attends = function (trait_id_, domain_) { |
|
425 |
+ return (_pool.hasOwnProperty(trait_id_) && _pool[trait_id_].attendants.hasOwnProperty(domain_.kind)); |
|
426 |
+ }; |
|
427 |
+ if (!condition(attends)(domain.parameters)) { |
|
428 |
+ var message = ""; |
|
429 |
+ message += "condition not fulfilled"; |
|
430 |
+ message += " at trait '" + trait_id + "'"; |
|
431 |
+ message += " for facet '" + facet_name + "'"; |
|
432 |
+ message += " in domain '" + domain.kind + "'"; |
|
433 |
+ log({ "kind": "warning", "message": message }); |
|
434 |
+ } |
|
435 |
+ else { |
|
436 |
+ // do nothing |
|
437 |
+ } |
|
438 |
+ } |
|
439 |
+ else { |
|
440 |
+ // do nothing |
|
441 |
+ } |
|
442 |
+ } |
|
443 |
+ } |
|
444 |
+ } |
|
445 |
+ } |
|
446 |
+ return result; |
|
447 |
+ } |
|
448 |
+ } |
|
449 |
+ } |
|
450 |
+ lib_trait.call = call; |
|
451 |
+ /** |
|
452 |
+ * @author fenris |
|
453 |
+ */ |
|
454 |
+ function explain(trait_id) { |
|
455 |
+ if (!_pool.hasOwnProperty(trait_id)) { |
|
456 |
+ var message = "no trait '" + trait_id + "'"; |
|
457 |
+ throw (new Error(message)); |
|
458 |
+ } |
|
459 |
+ else { |
|
460 |
+ var trait_4 = _pool[trait_id]; |
|
461 |
+ var str_1 = ""; |
|
462 |
+ // head |
|
463 |
+ { |
|
464 |
+ str_1 += "<<" + trait_id + ">>"; |
|
465 |
+ str_1 += (" " |
|
466 |
+ + |
|
467 |
+ "(" |
|
468 |
+ + |
|
469 |
+ (Object.keys(trait_4.variables) |
|
470 |
+ .map(function (variable_name) { |
|
471 |
+ var shape = lib_shape.make({ |
|
472 |
+ "name": "variable", |
|
473 |
+ "parameters": { |
|
474 |
+ "name": variable_name |
|
475 |
+ } |
|
476 |
+ }); |
|
477 |
+ return lib_shape.show(shape); |
|
478 |
+ }) |
|
479 |
+ .join(",")) |
|
480 |
+ + |
|
481 |
+ ")"); |
|
482 |
+ str_1 += "\n"; |
|
483 |
+ } |
|
484 |
+ // facets |
|
485 |
+ { |
|
486 |
+ Object.keys(trait_4.facets) |
|
487 |
+ .forEach(function (facet_name) { |
|
488 |
+ var facet = trait_4.facets[facet_name]; |
|
489 |
+ // str += "\t"; |
|
490 |
+ str_1 += "* "; |
|
491 |
+ str_1 += ((facet.implementation != undefined) ? ("[" + facet_name + "]") : facet_name); |
|
492 |
+ str_1 += (" : " + lib_shape.show(facet.shape)); |
|
493 |
+ if (facet.description !== undefined) { |
|
494 |
+ str_1 += (" ~ " + "" + facet.description + ""); |
|
495 |
+ } |
|
496 |
+ str_1 += "\n"; |
|
497 |
+ }); |
|
498 |
+ } |
|
499 |
+ return str_1; |
|
500 |
+ } |
|
501 |
+ } |
|
502 |
+ lib_trait.explain = explain; |
|
503 |
+ /** |
|
504 |
+ * @author fenris |
|
505 |
+ */ |
|
506 |
+ function explain_all() { |
|
507 |
+ return Object.keys(_pool).map(function (trait_id) { return explain(trait_id); }).join("\n"); |
|
508 |
+ } |
|
509 |
+ lib_trait.explain_all = explain_all; |
|
510 |
+})(lib_trait || (lib_trait = {})); |
|
511 |
+/* |
|
512 |
+This file is part of »bacterio-plankton:trait«. |
|
513 |
+ |
|
514 |
+Copyright 2016-2018 greenscale <info@greenscale.de> |
|
515 |
+ |
|
516 |
+»bacterio-plankton:trait« is free software: you can redistribute it and/or modify |
|
517 |
+it under the terms of the GNU Lesser General Public License as published by |
|
518 |
+the Free Software Foundation, either version 3 of the License, or |
|
519 |
+(at your option) any later version. |
|
520 |
+ |
|
521 |
+»bacterio-plankton:trait« is distributed in the hope that it will be callful, |
|
522 |
+but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
523 |
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
524 |
+GNU Lesser General Public License for more details. |
|
525 |
+ |
|
526 |
+You should have received a copy of the GNU Lesser General Public License |
|
527 |
+along with »bacterio-plankton:trait«. If not, see <http://www.gnu.org/licenses/>. |
|
528 |
+ */ |
|
529 |
+/** |
|
530 |
+ * @author fenris |
|
531 |
+ */ |
|
532 |
+var lib_trait; |
|
533 |
+(function (lib_trait) { |
|
534 |
+ /** |
|
535 |
+ * @desc the ability to check for equality with another element of the same domain |
|
536 |
+ * @author fenris |
|
537 |
+ */ |
|
538 |
+ function define_collatable() { |
|
539 |
+ lib_trait.define("collatable", { |
|
540 |
+ "value": [] |
|
541 |
+ }, { |
|
542 |
+ "collate": { |
|
543 |
+ "shape": { |
|
544 |
+ "name": "function", |
|
545 |
+ "parameters": { |
|
546 |
+ "shape_input": { |
|
547 |
+ "name": "variable", |
|
548 |
+ "parameters": { |
|
549 |
+ "name": "value" |
|
550 |
+ } |
|
551 |
+ }, |
|
552 |
+ "shape_output": { |
|
553 |
+ "name": "function", |
|
554 |
+ "parameters": { |
|
555 |
+ "shape_input": { |
|
556 |
+ "name": "variable", |
|
557 |
+ "parameters": { |
|
558 |
+ "name": "value" |
|
559 |
+ } |
|
560 |
+ }, |
|
561 |
+ "shape_output": { |
|
562 |
+ "name": "boolean" |
|
563 |
+ } |
|
564 |
+ } |
|
565 |
+ } |
|
566 |
+ } |
|
567 |
+ } |
|
568 |
+ } |
|
569 |
+ }); |
|
570 |
+ lib_trait.attend("collatable", "crude", { |
|
571 |
+ "value": { |
|
572 |
+ "name": "any" |
|
573 |
+ } |
|
574 |
+ }, { |
|
575 |
+ "collate": function () { return function (instance) { return function (other) { |
|
576 |
+ if (typeof (instance) === "object") { |
|
577 |
+ if (instance == null) { |
|
578 |
+ return (other == null); |
|
579 |
+ } |
|
580 |
+ else { |
|
581 |
+ if ("_collate" in instance) { |
|
582 |
+ return instance["_collate"](other); |
|
583 |
+ } |
|
584 |
+ else { |
|
585 |
+ var message = ("[collate]" + " " + "object has no such method"); |
|
586 |
+ throw (new Error(message)); |
|
587 |
+ } |
|
588 |
+ } |
|
589 |
+ } |
|
590 |
+ else { |
|
591 |
+ if (lib_trait._verbosity >= 1) { |
|
592 |
+ var message = ("[collate]" + " " + "primitive value; using default implementation"); |
|
593 |
+ console.warn(message); |
|
594 |
+ } |
|
595 |
+ return (instance === other); |
|
596 |
+ } |
|
597 |
+ }; }; } |
|
598 |
+ }); |
|
599 |
+ } |
|
600 |
+ lib_trait.define_collatable = define_collatable; |
|
601 |
+ /** |
|
602 |
+ * @author fenris |
|
603 |
+ */ |
|
604 |
+ function _collate(instance, other, domain) { |
|
605 |
+ if (domain === void 0) { domain = { "kind": "crude" }; } |
|
606 |
+ return lib_trait.call("collatable", "collate", domain)(instance)(other); |
|
607 |
+ } |
|
608 |
+ lib_trait._collate = _collate; |
|
609 |
+ define_collatable(); |
|
610 |
+})(lib_trait || (lib_trait = {})); |
|
611 |
+/* |
|
612 |
+This file is part of »bacterio-plankton:trait«. |
|
613 |
+ |
|
614 |
+Copyright 2016-2018 greenscale <info@greenscale.de> |
|
615 |
+ |
|
616 |
+»bacterio-plankton:trait« is free software: you can redistribute it and/or modify |
|
617 |
+it under the terms of the GNU Lesser General Public License as published by |
|
618 |
+the Free Software Foundation, either version 3 of the License, or |
|
619 |
+(at your option) any later version. |
|
620 |
+ |
|
621 |
+»bacterio-plankton:trait« is distributed in the hope that it will be callful, |
|
622 |
+but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
623 |
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
624 |
+GNU Lesser General Public License for more details. |
|
625 |
+ |
|
626 |
+You should have received a copy of the GNU Lesser General Public License |
|
627 |
+along with »bacterio-plankton:trait«. If not, see <http://www.gnu.org/licenses/>. |
|
628 |
+ */ |
|
629 |
+/** |
|
630 |
+ * @author fenris |
|
631 |
+ */ |
|
632 |
+var lib_trait; |
|
633 |
+(function (lib_trait) { |
|
634 |
+ /** |
|
635 |
+ * @desc the ability to compare with another element of the same domain for determining if the first is "smaller than or equal to" the latter |
|
636 |
+ * @author fenris |
|
637 |
+ */ |
|
638 |
+ function define_comparable() { |
|
639 |
+ lib_trait.define("comparable", { |
|
640 |
+ "value": [] |
|
641 |
+ }, { |
|
642 |
+ "compare": { |
|
643 |
+ "shape": { |
|
644 |
+ "name": "function", |
|
645 |
+ "parameters": { |
|
646 |
+ "shape_input": { |
|
647 |
+ "name": "variable", |
|
648 |
+ "parameters": { |
|
649 |
+ "name": "value" |
|
650 |
+ } |
|
651 |
+ }, |
|
652 |
+ "shape_output": { |
|
653 |
+ "name": "function", |
|
654 |
+ "parameters": { |
|
655 |
+ "shape_input": { |
|
656 |
+ "name": "variable", |
|
657 |
+ "parameters": { |
|
658 |
+ "name": "value" |
|
659 |
+ } |
|
660 |
+ }, |
|
661 |
+ "shape_output": { |
|
662 |
+ "name": "boolean" |
|
663 |
+ } |
|
664 |
+ } |
|
665 |
+ } |
|
666 |
+ } |
|
667 |
+ } |
|
668 |
+ } |
|
669 |
+ }); |
|
670 |
+ lib_trait.attend("comparable", "crude", { |
|
671 |
+ "value": { |
|
672 |
+ "name": "any" |
|
673 |
+ } |
|
674 |
+ }, { |
|
675 |
+ "compare": function () { return function (instance) { return function (other) { |
|
676 |
+ if (typeof (instance) === "object") { |
|
677 |
+ if ("_compare" in instance) { |
|
678 |
+ return instance["_compare"](other); |
|
679 |
+ } |
|
680 |
+ else { |
|
681 |
+ throw (new Error("[compare]" + " " + "object has no such method")); |
|
682 |
+ } |
|
683 |
+ } |
|
684 |
+ else { |
|
685 |
+ if (lib_trait._verbosity >= 1) { |
|
686 |
+ console.warn("[compare]" + " " + "primitive value; using default implementation"); |
|
687 |
+ } |
|
688 |
+ return (instance <= other); |
|
689 |
+ } |
|
690 |
+ }; }; } |
|
691 |
+ }); |
|
692 |
+ } |
|
693 |
+ lib_trait.define_comparable = define_comparable; |
|
694 |
+ /** |
|
695 |
+ * @author fenris |
|
696 |
+ */ |
|
697 |
+ function _compare(instance, other, domain) { |
|
698 |
+ if (domain === void 0) { domain = { "kind": "crude" }; } |
|
699 |
+ return lib_trait.call("comparable", "compare", domain)(instance)(other); |
|
700 |
+ } |
|
701 |
+ lib_trait._compare = _compare; |
|
702 |
+ define_comparable(); |
|
703 |
+})(lib_trait || (lib_trait = {})); |
|
704 |
+/* |
|
705 |
+This file is part of »bacterio-plankton:trait«. |
|
706 |
+ |
|
707 |
+Copyright 2016-2018 greenscale <info@greenscale.de> |
|
708 |
+ |
|
709 |
+»bacterio-plankton:trait« is free software: you can redistribute it and/or modify |
|
710 |
+it under the terms of the GNU Lesser General Public License as published by |
|
711 |
+the Free Software Foundation, either version 3 of the License, or |
|
712 |
+(at your option) any later version. |
|
713 |
+ |
|
714 |
+»bacterio-plankton:trait« is distributed in the hope that it will be callful, |
|
715 |
+but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
716 |
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
717 |
+GNU Lesser General Public License for more details. |
|
718 |
+ |
|
719 |
+You should have received a copy of the GNU Lesser General Public License |
|
720 |
+along with »bacterio-plankton:trait«. If not, see <http://www.gnu.org/licenses/>. |
|
721 |
+ */ |
|
722 |
+/** |
|
723 |
+ * @author fenris |
|
724 |
+ */ |
|
725 |
+var lib_trait; |
|
726 |
+(function (lib_trait) { |
|
727 |
+ /** |
|
728 |
+ * @desc the ability to create an exact copy |
|
729 |
+ * @author fenris |
|
730 |
+ */ |
|
731 |
+ function define_clonable() { |
|
732 |
+ lib_trait.define("clonable", { |
|
733 |
+ "value": [] |
|
734 |
+ }, { |
|
735 |
+ "clone": { |
|
736 |
+ "shape": { |
|
737 |
+ "name": "function", |
|
738 |
+ "parameters": { |
|
739 |
+ "shape_input": { |
|
740 |
+ "name": "variable", |
|
741 |
+ "parameters": { |
|
742 |
+ "name": "value" |
|
743 |
+ } |
|
744 |
+ }, |
|
745 |
+ "shape_output": { |
|
746 |
+ "name": "variable", |
|
747 |
+ "parameters": { |
|
748 |
+ "name": "value" |
|
749 |
+ } |
|
750 |
+ } |
|
751 |
+ } |
|
752 |
+ } |
|
753 |
+ } |
|
754 |
+ }); |
|
755 |
+ lib_trait.attend("clonable", "crude", { |
|
756 |
+ "value": { |
|
757 |
+ "name": "any" |
|
758 |
+ } |
|
759 |
+ }, { |
|
760 |
+ "clone": function () { return function (instance) { |
|
761 |
+ if (typeof (instance) === "object") { |
|
762 |
+ if ("_clone" in instance) { |
|
763 |
+ return instance["_clone"](); |
|
764 |
+ } |
|
765 |
+ else { |
|
766 |
+ throw (new Error("[clone]" + " " + "object has no such method")); |
|
767 |
+ } |
|
768 |
+ } |
|
769 |
+ else { |
|
770 |
+ if (lib_trait._verbosity >= 1) { |
|
771 |
+ console.warn("[clone]" + " " + "primitive value; using default implementation"); |
|
772 |
+ } |
|
773 |
+ return instance; |
|
774 |
+ } |
|
775 |
+ }; } |
|
776 |
+ }); |
|
777 |
+ } |
|
778 |
+ lib_trait.define_clonable = define_clonable; |
|
779 |
+ /** |
|
780 |
+ * @author fenris |
|
781 |
+ */ |
|
782 |
+ function _clone(instance, domain) { |
|
783 |
+ if (domain === void 0) { domain = { "kind": "crude" }; } |
|
784 |
+ return lib_trait.call("clonable", "clone", domain)(instance); |
|
785 |
+ } |
|
786 |
+ lib_trait._clone = _clone; |
|
787 |
+ define_clonable(); |
|
788 |
+})(lib_trait || (lib_trait = {})); |
|
789 |
+/* |
|
790 |
+This file is part of »bacterio-plankton:trait«. |
|
791 |
+ |
|
792 |
+Copyright 2016-2018 greenscale <info@greenscale.de> |
|
793 |
+ |
|
794 |
+»bacterio-plankton:trait« is free software: you can redistribute it and/or modify |
|
795 |
+it under the terms of the GNU Lesser General Public License as published by |
|
796 |
+the Free Software Foundation, either version 3 of the License, or |
|
797 |
+(at your option) any later version. |
|
798 |
+ |
|
799 |
+»bacterio-plankton:trait« is distributed in the hope that it will be callful, |
|
800 |
+but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
801 |
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
802 |
+GNU Lesser General Public License for more details. |
|
803 |
+ |
|
804 |
+You should have received a copy of the GNU Lesser General Public License |
|
805 |
+along with »bacterio-plankton:trait«. If not, see <http://www.gnu.org/licenses/>. |
|
806 |
+ */ |
|
807 |
+/** |
|
808 |
+ * @author fenris |
|
809 |
+ */ |
|
810 |
+var lib_trait; |
|
811 |
+(function (lib_trait) { |
|
812 |
+ /** |
|
813 |
+ * @desc the ability to generate a string out of the element, which identifies it to a high degree |
|
814 |
+ * @author fenris |
|
815 |
+ */ |
|
816 |
+ function define_hashable() { |
|
817 |
+ lib_trait.define("hashable", { |
|
818 |
+ "value": [] |
|
819 |
+ }, { |
|
820 |
+ "hash": { |
|
821 |
+ "shape": { |
|
822 |
+ "name": "function", |
|
823 |
+ "parameters": { |
|
824 |
+ "shape_input": { |
|
825 |
+ "name": "variable", |
|
826 |
+ "parameters": { |
|
827 |
+ "name": "value" |
|
828 |
+ } |
|
829 |
+ }, |
|
830 |
+ "shape_output": { |
|
831 |
+ "name": "string" |
|
832 |
+ } |
|
833 |
+ } |
|
834 |
+ } |
|
835 |
+ } |
|
836 |
+ }); |
|
837 |
+ lib_trait.attend("hashable", "crude", { |
|
838 |
+ "value": { |
|
839 |
+ "name": "any" |
|
840 |
+ } |
|
841 |
+ }, { |
|
842 |
+ "hash": function () { return function (thing) { |
|
843 |
+ if (typeof (thing) === "object") { |
|
844 |
+ if ("_hash" in thing) { |
|
845 |
+ return thing["_hash"](); |
|
846 |
+ } |
|
847 |
+ else { |
|
848 |
+ var message = ("[hash]" + " " + "object has no such method"); |
|
849 |
+ throw (new Error(message)); |
|
850 |
+ } |
|
851 |
+ } |
|
852 |
+ else { |
|
853 |
+ if (lib_trait._verbosity >= 1) { |
|
854 |
+ var message = ("[hash]" + " " + "primitive value; using default implementation"); |
|
855 |
+ console.warn(message); |
|
856 |
+ } |
|
857 |
+ return String(thing); |
|
858 |
+ } |
|
859 |
+ }; } |
|
860 |
+ }); |
|
861 |
+ } |
|
862 |
+ lib_trait.define_hashable = define_hashable; |
|
863 |
+ /** |
|
864 |
+ * @author fenris |
|
865 |
+ */ |
|
866 |
+ function _hash(instance, domain) { |
|
867 |
+ if (domain === void 0) { domain = { "kind": "crude" }; } |
|
868 |
+ return lib_trait.call("hashable", "hash", domain)(instance); |
|
869 |
+ } |
|
870 |
+ lib_trait._hash = _hash; |
|
871 |
+ define_hashable(); |
|
872 |
+})(lib_trait || (lib_trait = {})); |
|
873 |
+/* |
|
874 |
+This file is part of »bacterio-plankton:trait«. |
|
875 |
+ |
|
876 |
+Copyright 2016-2018 greenscale <info@greenscale.de> |
|
877 |
+ |
|
878 |
+»bacterio-plankton:trait« is free software: you can redistribute it and/or modify |
|
879 |
+it under the terms of the GNU Lesser General Public License as published by |
|
880 |
+the Free Software Foundation, either version 3 of the License, or |
|
881 |
+(at your option) any later version. |
|
882 |
+ |
|
883 |
+»bacterio-plankton:trait« is distributed in the hope that it will be callful, |
|
884 |
+but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
885 |
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
886 |
+GNU Lesser General Public License for more details. |
|
887 |
+ |
|
888 |
+You should have received a copy of the GNU Lesser General Public License |
|
889 |
+along with »bacterio-plankton:trait«. If not, see <http://www.gnu.org/licenses/>. |
|
890 |
+ */ |
|
891 |
+/** |
|
892 |
+ * @author fenris |
|
893 |
+ */ |
|
894 |
+var lib_trait; |
|
895 |
+(function (lib_trait) { |
|
896 |
+ /** |
|
897 |
+ * @desc the ability to map the element to a textual representation (most likely not injective) |
|
898 |
+ * @author fenris |
|
899 |
+ */ |
|
900 |
+ function define_showable() { |
|
901 |
+ lib_trait.define("showable", { |
|
902 |
+ "value": [] |
|
903 |
+ }, { |
|
904 |
+ "show": { |
|
905 |
+ "shape": { |
|
906 |
+ "name": "function", |
|
907 |
+ "parameters": { |
|
908 |
+ "shape_input": { |
|
909 |
+ "name": "variable", |
|
910 |
+ "parameters": { |
|
911 |
+ "name": "value" |
|
912 |
+ } |
|
913 |
+ }, |
|
914 |
+ "shape_output": { |
|
915 |
+ "name": "string", |
|
916 |
+ "parameters": { |
|
917 |
+ "soft": false |
|
918 |
+ } |
|
919 |
+ } |
|
920 |
+ } |
|
921 |
+ } |
|
922 |
+ } |
|
923 |
+ }); |
|
924 |
+ lib_trait.attend("showable", "crude", { |
|
925 |
+ "value": { |
|
926 |
+ "name": "any" |
|
927 |
+ } |
|
928 |
+ }, { |
|
929 |
+ "show": function () { return function (instance) { |
|
930 |
+ if (typeof (instance) === "object") { |
|
931 |
+ if (instance == null) { |
|
932 |
+ return "NULL"; |
|
933 |
+ } |
|
934 |
+ else { |
|
935 |
+ if ("_show" in instance) { |
|
936 |
+ return instance["_show"](); |
|
937 |
+ } |
|
938 |
+ else { |
|
939 |
+ // throw (new Error("[show]" + " " + "object has no such method")); |
|
940 |
+ return JSON.stringify(instance); |
|
941 |
+ } |
|
942 |
+ } |
|
943 |
+ } |
|
944 |
+ else { |
|
945 |
+ if (lib_trait._verbosity >= 1) { |
|
946 |
+ var message = ("[show]" + " " + "primitive value; using default implementation"); |
|
947 |
+ // console.warn(message); |
|
948 |
+ } |
|
949 |
+ return String(instance); |
|
950 |
+ } |
|
951 |
+ }; } |
|
952 |
+ }); |
|
953 |
+ } |
|
954 |
+ lib_trait.define_showable = define_showable; |
|
955 |
+ /** |
|
956 |
+ * @author fenris |
|
957 |
+ */ |
|
958 |
+ function _show(instance, domain) { |
|
959 |
+ if (domain === void 0) { domain = { "kind": "crude" }; } |
|
960 |
+ return lib_trait.call("showable", "show", domain)(instance); |
|
961 |
+ } |
|
962 |
+ lib_trait._show = _show; |
|
963 |
+ define_showable(); |
|
964 |
+})(lib_trait || (lib_trait = {})); |
|
0 | 965 |