v1.0.0
Stefan Schuermans

Stefan Schuermans commited on 2011-09-11 17:13:15
Showing 31 changed files, with 4001 additions and 0 deletions.

... ...
@@ -0,0 +1,674 @@
1
+                    GNU GENERAL PUBLIC LICENSE
2
+                       Version 3, 29 June 2007
3
+
4
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
5
+ Everyone is permitted to copy and distribute verbatim copies
6
+ of this license document, but changing it is not allowed.
7
+
8
+                            Preamble
9
+
10
+  The GNU General Public License is a free, copyleft license for
11
+software and other kinds of works.
12
+
13
+  The licenses for most software and other practical works are designed
14
+to take away your freedom to share and change the works.  By contrast,
15
+the GNU General Public License is intended to guarantee your freedom to
16
+share and change all versions of a program--to make sure it remains free
17
+software for all its users.  We, the Free Software Foundation, use the
18
+GNU General Public License for most of our software; it applies also to
19
+any other work released this way by its authors.  You can apply it to
20
+your programs, too.
21
+
22
+  When we speak of free software, we are referring to freedom, not
23
+price.  Our General Public Licenses are designed to make sure that you
24
+have the freedom to distribute copies of free software (and charge for
25
+them if you wish), that you receive source code or can get it if you
26
+want it, that you can change the software or use pieces of it in new
27
+free programs, and that you know you can do these things.
28
+
29
+  To protect your rights, we need to prevent others from denying you
30
+these rights or asking you to surrender the rights.  Therefore, you have
31
+certain responsibilities if you distribute copies of the software, or if
32
+you modify it: responsibilities to respect the freedom of others.
33
+
34
+  For example, if you distribute copies of such a program, whether
35
+gratis or for a fee, you must pass on to the recipients the same
36
+freedoms that you received.  You must make sure that they, too, receive
37
+or can get the source code.  And you must show them these terms so they
38
+know their rights.
39
+
40
+  Developers that use the GNU GPL protect your rights with two steps:
41
+(1) assert copyright on the software, and (2) offer you this License
42
+giving you legal permission to copy, distribute and/or modify it.
43
+
44
+  For the developers' and authors' protection, the GPL clearly explains
45
+that there is no warranty for this free software.  For both users' and
46
+authors' sake, the GPL requires that modified versions be marked as
47
+changed, so that their problems will not be attributed erroneously to
48
+authors of previous versions.
49
+
50
+  Some devices are designed to deny users access to install or run
51
+modified versions of the software inside them, although the manufacturer
52
+can do so.  This is fundamentally incompatible with the aim of
53
+protecting users' freedom to change the software.  The systematic
54
+pattern of such abuse occurs in the area of products for individuals to
55
+use, which is precisely where it is most unacceptable.  Therefore, we
56
+have designed this version of the GPL to prohibit the practice for those
57
+products.  If such problems arise substantially in other domains, we
58
+stand ready to extend this provision to those domains in future versions
59
+of the GPL, as needed to protect the freedom of users.
60
+
61
+  Finally, every program is threatened constantly by software patents.
62
+States should not allow patents to restrict development and use of
63
+software on general-purpose computers, but in those that do, we wish to
64
+avoid the special danger that patents applied to a free program could
65
+make it effectively proprietary.  To prevent this, the GPL assures that
66
+patents cannot be used to render the program non-free.
67
+
68
+  The precise terms and conditions for copying, distribution and
69
+modification follow.
70
+
71
+                       TERMS AND CONDITIONS
72
+
73
+  0. Definitions.
74
+
75
+  "This License" refers to version 3 of the GNU General Public License.
76
+
77
+  "Copyright" also means copyright-like laws that apply to other kinds of
78
+works, such as semiconductor masks.
79
+
80
+  "The Program" refers to any copyrightable work licensed under this
81
+License.  Each licensee is addressed as "you".  "Licensees" and
82
+"recipients" may be individuals or organizations.
83
+
84
+  To "modify" a work means to copy from or adapt all or part of the work
85
+in a fashion requiring copyright permission, other than the making of an
86
+exact copy.  The resulting work is called a "modified version" of the
87
+earlier work or a work "based on" the earlier work.
88
+
89
+  A "covered work" means either the unmodified Program or a work based
90
+on the Program.
91
+
92
+  To "propagate" a work means to do anything with it that, without
93
+permission, would make you directly or secondarily liable for
94
+infringement under applicable copyright law, except executing it on a
95
+computer or modifying a private copy.  Propagation includes copying,
96
+distribution (with or without modification), making available to the
97
+public, and in some countries other activities as well.
98
+
99
+  To "convey" a work means any kind of propagation that enables other
100
+parties to make or receive copies.  Mere interaction with a user through
101
+a computer network, with no transfer of a copy, is not conveying.
102
+
103
+  An interactive user interface displays "Appropriate Legal Notices"
104
+to the extent that it includes a convenient and prominently visible
105
+feature that (1) displays an appropriate copyright notice, and (2)
106
+tells the user that there is no warranty for the work (except to the
107
+extent that warranties are provided), that licensees may convey the
108
+work under this License, and how to view a copy of this License.  If
109
+the interface presents a list of user commands or options, such as a
110
+menu, a prominent item in the list meets this criterion.
111
+
112
+  1. Source Code.
113
+
114
+  The "source code" for a work means the preferred form of the work
115
+for making modifications to it.  "Object code" means any non-source
116
+form of a work.
117
+
118
+  A "Standard Interface" means an interface that either is an official
119
+standard defined by a recognized standards body, or, in the case of
120
+interfaces specified for a particular programming language, one that
121
+is widely used among developers working in that language.
122
+
123
+  The "System Libraries" of an executable work include anything, other
124
+than the work as a whole, that (a) is included in the normal form of
125
+packaging a Major Component, but which is not part of that Major
126
+Component, and (b) serves only to enable use of the work with that
127
+Major Component, or to implement a Standard Interface for which an
128
+implementation is available to the public in source code form.  A
129
+"Major Component", in this context, means a major essential component
130
+(kernel, window system, and so on) of the specific operating system
131
+(if any) on which the executable work runs, or a compiler used to
132
+produce the work, or an object code interpreter used to run it.
133
+
134
+  The "Corresponding Source" for a work in object code form means all
135
+the source code needed to generate, install, and (for an executable
136
+work) run the object code and to modify the work, including scripts to
137
+control those activities.  However, it does not include the work's
138
+System Libraries, or general-purpose tools or generally available free
139
+programs which are used unmodified in performing those activities but
140
+which are not part of the work.  For example, Corresponding Source
141
+includes interface definition files associated with source files for
142
+the work, and the source code for shared libraries and dynamically
143
+linked subprograms that the work is specifically designed to require,
144
+such as by intimate data communication or control flow between those
145
+subprograms and other parts of the work.
146
+
147
+  The Corresponding Source need not include anything that users
148
+can regenerate automatically from other parts of the Corresponding
149
+Source.
150
+
151
+  The Corresponding Source for a work in source code form is that
152
+same work.
153
+
154
+  2. Basic Permissions.
155
+
156
+  All rights granted under this License are granted for the term of
157
+copyright on the Program, and are irrevocable provided the stated
158
+conditions are met.  This License explicitly affirms your unlimited
159
+permission to run the unmodified Program.  The output from running a
160
+covered work is covered by this License only if the output, given its
161
+content, constitutes a covered work.  This License acknowledges your
162
+rights of fair use or other equivalent, as provided by copyright law.
163
+
164
+  You may make, run and propagate covered works that you do not
165
+convey, without conditions so long as your license otherwise remains
166
+in force.  You may convey covered works to others for the sole purpose
167
+of having them make modifications exclusively for you, or provide you
168
+with facilities for running those works, provided that you comply with
169
+the terms of this License in conveying all material for which you do
170
+not control copyright.  Those thus making or running the covered works
171
+for you must do so exclusively on your behalf, under your direction
172
+and control, on terms that prohibit them from making any copies of
173
+your copyrighted material outside their relationship with you.
174
+
175
+  Conveying under any other circumstances is permitted solely under
176
+the conditions stated below.  Sublicensing is not allowed; section 10
177
+makes it unnecessary.
178
+
179
+  3. Protecting Users' Legal Rights From Anti-Circumvention Law.
180
+
181
+  No covered work shall be deemed part of an effective technological
182
+measure under any applicable law fulfilling obligations under article
183
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
184
+similar laws prohibiting or restricting circumvention of such
185
+measures.
186
+
187
+  When you convey a covered work, you waive any legal power to forbid
188
+circumvention of technological measures to the extent such circumvention
189
+is effected by exercising rights under this License with respect to
190
+the covered work, and you disclaim any intention to limit operation or
191
+modification of the work as a means of enforcing, against the work's
192
+users, your or third parties' legal rights to forbid circumvention of
193
+technological measures.
194
+
195
+  4. Conveying Verbatim Copies.
196
+
197
+  You may convey verbatim copies of the Program's source code as you
198
+receive it, in any medium, provided that you conspicuously and
199
+appropriately publish on each copy an appropriate copyright notice;
200
+keep intact all notices stating that this License and any
201
+non-permissive terms added in accord with section 7 apply to the code;
202
+keep intact all notices of the absence of any warranty; and give all
203
+recipients a copy of this License along with the Program.
204
+
205
+  You may charge any price or no price for each copy that you convey,
206
+and you may offer support or warranty protection for a fee.
207
+
208
+  5. Conveying Modified Source Versions.
209
+
210
+  You may convey a work based on the Program, or the modifications to
211
+produce it from the Program, in the form of source code under the
212
+terms of section 4, provided that you also meet all of these conditions:
213
+
214
+    a) The work must carry prominent notices stating that you modified
215
+    it, and giving a relevant date.
216
+
217
+    b) The work must carry prominent notices stating that it is
218
+    released under this License and any conditions added under section
219
+    7.  This requirement modifies the requirement in section 4 to
220
+    "keep intact all notices".
221
+
222
+    c) You must license the entire work, as a whole, under this
223
+    License to anyone who comes into possession of a copy.  This
224
+    License will therefore apply, along with any applicable section 7
225
+    additional terms, to the whole of the work, and all its parts,
226
+    regardless of how they are packaged.  This License gives no
227
+    permission to license the work in any other way, but it does not
228
+    invalidate such permission if you have separately received it.
229
+
230
+    d) If the work has interactive user interfaces, each must display
231
+    Appropriate Legal Notices; however, if the Program has interactive
232
+    interfaces that do not display Appropriate Legal Notices, your
233
+    work need not make them do so.
234
+
235
+  A compilation of a covered work with other separate and independent
236
+works, which are not by their nature extensions of the covered work,
237
+and which are not combined with it such as to form a larger program,
238
+in or on a volume of a storage or distribution medium, is called an
239
+"aggregate" if the compilation and its resulting copyright are not
240
+used to limit the access or legal rights of the compilation's users
241
+beyond what the individual works permit.  Inclusion of a covered work
242
+in an aggregate does not cause this License to apply to the other
243
+parts of the aggregate.
244
+
245
+  6. Conveying Non-Source Forms.
246
+
247
+  You may convey a covered work in object code form under the terms
248
+of sections 4 and 5, provided that you also convey the
249
+machine-readable Corresponding Source under the terms of this License,
250
+in one of these ways:
251
+
252
+    a) Convey the object code in, or embodied in, a physical product
253
+    (including a physical distribution medium), accompanied by the
254
+    Corresponding Source fixed on a durable physical medium
255
+    customarily used for software interchange.
256
+
257
+    b) Convey the object code in, or embodied in, a physical product
258
+    (including a physical distribution medium), accompanied by a
259
+    written offer, valid for at least three years and valid for as
260
+    long as you offer spare parts or customer support for that product
261
+    model, to give anyone who possesses the object code either (1) a
262
+    copy of the Corresponding Source for all the software in the
263
+    product that is covered by this License, on a durable physical
264
+    medium customarily used for software interchange, for a price no
265
+    more than your reasonable cost of physically performing this
266
+    conveying of source, or (2) access to copy the
267
+    Corresponding Source from a network server at no charge.
268
+
269
+    c) Convey individual copies of the object code with a copy of the
270
+    written offer to provide the Corresponding Source.  This
271
+    alternative is allowed only occasionally and noncommercially, and
272
+    only if you received the object code with such an offer, in accord
273
+    with subsection 6b.
274
+
275
+    d) Convey the object code by offering access from a designated
276
+    place (gratis or for a charge), and offer equivalent access to the
277
+    Corresponding Source in the same way through the same place at no
278
+    further charge.  You need not require recipients to copy the
279
+    Corresponding Source along with the object code.  If the place to
280
+    copy the object code is a network server, the Corresponding Source
281
+    may be on a different server (operated by you or a third party)
282
+    that supports equivalent copying facilities, provided you maintain
283
+    clear directions next to the object code saying where to find the
284
+    Corresponding Source.  Regardless of what server hosts the
285
+    Corresponding Source, you remain obligated to ensure that it is
286
+    available for as long as needed to satisfy these requirements.
287
+
288
+    e) Convey the object code using peer-to-peer transmission, provided
289
+    you inform other peers where the object code and Corresponding
290
+    Source of the work are being offered to the general public at no
291
+    charge under subsection 6d.
292
+
293
+  A separable portion of the object code, whose source code is excluded
294
+from the Corresponding Source as a System Library, need not be
295
+included in conveying the object code work.
296
+
297
+  A "User Product" is either (1) a "consumer product", which means any
298
+tangible personal property which is normally used for personal, family,
299
+or household purposes, or (2) anything designed or sold for incorporation
300
+into a dwelling.  In determining whether a product is a consumer product,
301
+doubtful cases shall be resolved in favor of coverage.  For a particular
302
+product received by a particular user, "normally used" refers to a
303
+typical or common use of that class of product, regardless of the status
304
+of the particular user or of the way in which the particular user
305
+actually uses, or expects or is expected to use, the product.  A product
306
+is a consumer product regardless of whether the product has substantial
307
+commercial, industrial or non-consumer uses, unless such uses represent
308
+the only significant mode of use of the product.
309
+
310
+  "Installation Information" for a User Product means any methods,
311
+procedures, authorization keys, or other information required to install
312
+and execute modified versions of a covered work in that User Product from
313
+a modified version of its Corresponding Source.  The information must
314
+suffice to ensure that the continued functioning of the modified object
315
+code is in no case prevented or interfered with solely because
316
+modification has been made.
317
+
318
+  If you convey an object code work under this section in, or with, or
319
+specifically for use in, a User Product, and the conveying occurs as
320
+part of a transaction in which the right of possession and use of the
321
+User Product is transferred to the recipient in perpetuity or for a
322
+fixed term (regardless of how the transaction is characterized), the
323
+Corresponding Source conveyed under this section must be accompanied
324
+by the Installation Information.  But this requirement does not apply
325
+if neither you nor any third party retains the ability to install
326
+modified object code on the User Product (for example, the work has
327
+been installed in ROM).
328
+
329
+  The requirement to provide Installation Information does not include a
330
+requirement to continue to provide support service, warranty, or updates
331
+for a work that has been modified or installed by the recipient, or for
332
+the User Product in which it has been modified or installed.  Access to a
333
+network may be denied when the modification itself materially and
334
+adversely affects the operation of the network or violates the rules and
335
+protocols for communication across the network.
336
+
337
+  Corresponding Source conveyed, and Installation Information provided,
338
+in accord with this section must be in a format that is publicly
339
+documented (and with an implementation available to the public in
340
+source code form), and must require no special password or key for
341
+unpacking, reading or copying.
342
+
343
+  7. Additional Terms.
344
+
345
+  "Additional permissions" are terms that supplement the terms of this
346
+License by making exceptions from one or more of its conditions.
347
+Additional permissions that are applicable to the entire Program shall
348
+be treated as though they were included in this License, to the extent
349
+that they are valid under applicable law.  If additional permissions
350
+apply only to part of the Program, that part may be used separately
351
+under those permissions, but the entire Program remains governed by
352
+this License without regard to the additional permissions.
353
+
354
+  When you convey a copy of a covered work, you may at your option
355
+remove any additional permissions from that copy, or from any part of
356
+it.  (Additional permissions may be written to require their own
357
+removal in certain cases when you modify the work.)  You may place
358
+additional permissions on material, added by you to a covered work,
359
+for which you have or can give appropriate copyright permission.
360
+
361
+  Notwithstanding any other provision of this License, for material you
362
+add to a covered work, you may (if authorized by the copyright holders of
363
+that material) supplement the terms of this License with terms:
364
+
365
+    a) Disclaiming warranty or limiting liability differently from the
366
+    terms of sections 15 and 16 of this License; or
367
+
368
+    b) Requiring preservation of specified reasonable legal notices or
369
+    author attributions in that material or in the Appropriate Legal
370
+    Notices displayed by works containing it; or
371
+
372
+    c) Prohibiting misrepresentation of the origin of that material, or
373
+    requiring that modified versions of such material be marked in
374
+    reasonable ways as different from the original version; or
375
+
376
+    d) Limiting the use for publicity purposes of names of licensors or
377
+    authors of the material; or
378
+
379
+    e) Declining to grant rights under trademark law for use of some
380
+    trade names, trademarks, or service marks; or
381
+
382
+    f) Requiring indemnification of licensors and authors of that
383
+    material by anyone who conveys the material (or modified versions of
384
+    it) with contractual assumptions of liability to the recipient, for
385
+    any liability that these contractual assumptions directly impose on
386
+    those licensors and authors.
387
+
388
+  All other non-permissive additional terms are considered "further
389
+restrictions" within the meaning of section 10.  If the Program as you
390
+received it, or any part of it, contains a notice stating that it is
391
+governed by this License along with a term that is a further
392
+restriction, you may remove that term.  If a license document contains
393
+a further restriction but permits relicensing or conveying under this
394
+License, you may add to a covered work material governed by the terms
395
+of that license document, provided that the further restriction does
396
+not survive such relicensing or conveying.
397
+
398
+  If you add terms to a covered work in accord with this section, you
399
+must place, in the relevant source files, a statement of the
400
+additional terms that apply to those files, or a notice indicating
401
+where to find the applicable terms.
402
+
403
+  Additional terms, permissive or non-permissive, may be stated in the
404
+form of a separately written license, or stated as exceptions;
405
+the above requirements apply either way.
406
+
407
+  8. Termination.
408
+
409
+  You may not propagate or modify a covered work except as expressly
410
+provided under this License.  Any attempt otherwise to propagate or
411
+modify it is void, and will automatically terminate your rights under
412
+this License (including any patent licenses granted under the third
413
+paragraph of section 11).
414
+
415
+  However, if you cease all violation of this License, then your
416
+license from a particular copyright holder is reinstated (a)
417
+provisionally, unless and until the copyright holder explicitly and
418
+finally terminates your license, and (b) permanently, if the copyright
419
+holder fails to notify you of the violation by some reasonable means
420
+prior to 60 days after the cessation.
421
+
422
+  Moreover, your license from a particular copyright holder is
423
+reinstated permanently if the copyright holder notifies you of the
424
+violation by some reasonable means, this is the first time you have
425
+received notice of violation of this License (for any work) from that
426
+copyright holder, and you cure the violation prior to 30 days after
427
+your receipt of the notice.
428
+
429
+  Termination of your rights under this section does not terminate the
430
+licenses of parties who have received copies or rights from you under
431
+this License.  If your rights have been terminated and not permanently
432
+reinstated, you do not qualify to receive new licenses for the same
433
+material under section 10.
434
+
435
+  9. Acceptance Not Required for Having Copies.
436
+
437
+  You are not required to accept this License in order to receive or
438
+run a copy of the Program.  Ancillary propagation of a covered work
439
+occurring solely as a consequence of using peer-to-peer transmission
440
+to receive a copy likewise does not require acceptance.  However,
441
+nothing other than this License grants you permission to propagate or
442
+modify any covered work.  These actions infringe copyright if you do
443
+not accept this License.  Therefore, by modifying or propagating a
444
+covered work, you indicate your acceptance of this License to do so.
445
+
446
+  10. Automatic Licensing of Downstream Recipients.
447
+
448
+  Each time you convey a covered work, the recipient automatically
449
+receives a license from the original licensors, to run, modify and
450
+propagate that work, subject to this License.  You are not responsible
451
+for enforcing compliance by third parties with this License.
452
+
453
+  An "entity transaction" is a transaction transferring control of an
454
+organization, or substantially all assets of one, or subdividing an
455
+organization, or merging organizations.  If propagation of a covered
456
+work results from an entity transaction, each party to that
457
+transaction who receives a copy of the work also receives whatever
458
+licenses to the work the party's predecessor in interest had or could
459
+give under the previous paragraph, plus a right to possession of the
460
+Corresponding Source of the work from the predecessor in interest, if
461
+the predecessor has it or can get it with reasonable efforts.
462
+
463
+  You may not impose any further restrictions on the exercise of the
464
+rights granted or affirmed under this License.  For example, you may
465
+not impose a license fee, royalty, or other charge for exercise of
466
+rights granted under this License, and you may not initiate litigation
467
+(including a cross-claim or counterclaim in a lawsuit) alleging that
468
+any patent claim is infringed by making, using, selling, offering for
469
+sale, or importing the Program or any portion of it.
470
+
471
+  11. Patents.
472
+
473
+  A "contributor" is a copyright holder who authorizes use under this
474
+License of the Program or a work on which the Program is based.  The
475
+work thus licensed is called the contributor's "contributor version".
476
+
477
+  A contributor's "essential patent claims" are all patent claims
478
+owned or controlled by the contributor, whether already acquired or
479
+hereafter acquired, that would be infringed by some manner, permitted
480
+by this License, of making, using, or selling its contributor version,
481
+but do not include claims that would be infringed only as a
482
+consequence of further modification of the contributor version.  For
483
+purposes of this definition, "control" includes the right to grant
484
+patent sublicenses in a manner consistent with the requirements of
485
+this License.
486
+
487
+  Each contributor grants you a non-exclusive, worldwide, royalty-free
488
+patent license under the contributor's essential patent claims, to
489
+make, use, sell, offer for sale, import and otherwise run, modify and
490
+propagate the contents of its contributor version.
491
+
492
+  In the following three paragraphs, a "patent license" is any express
493
+agreement or commitment, however denominated, not to enforce a patent
494
+(such as an express permission to practice a patent or covenant not to
495
+sue for patent infringement).  To "grant" such a patent license to a
496
+party means to make such an agreement or commitment not to enforce a
497
+patent against the party.
498
+
499
+  If you convey a covered work, knowingly relying on a patent license,
500
+and the Corresponding Source of the work is not available for anyone
501
+to copy, free of charge and under the terms of this License, through a
502
+publicly available network server or other readily accessible means,
503
+then you must either (1) cause the Corresponding Source to be so
504
+available, or (2) arrange to deprive yourself of the benefit of the
505
+patent license for this particular work, or (3) arrange, in a manner
506
+consistent with the requirements of this License, to extend the patent
507
+license to downstream recipients.  "Knowingly relying" means you have
508
+actual knowledge that, but for the patent license, your conveying the
509
+covered work in a country, or your recipient's use of the covered work
510
+in a country, would infringe one or more identifiable patents in that
511
+country that you have reason to believe are valid.
512
+
513
+  If, pursuant to or in connection with a single transaction or
514
+arrangement, you convey, or propagate by procuring conveyance of, a
515
+covered work, and grant a patent license to some of the parties
516
+receiving the covered work authorizing them to use, propagate, modify
517
+or convey a specific copy of the covered work, then the patent license
518
+you grant is automatically extended to all recipients of the covered
519
+work and works based on it.
520
+
521
+  A patent license is "discriminatory" if it does not include within
522
+the scope of its coverage, prohibits the exercise of, or is
523
+conditioned on the non-exercise of one or more of the rights that are
524
+specifically granted under this License.  You may not convey a covered
525
+work if you are a party to an arrangement with a third party that is
526
+in the business of distributing software, under which you make payment
527
+to the third party based on the extent of your activity of conveying
528
+the work, and under which the third party grants, to any of the
529
+parties who would receive the covered work from you, a discriminatory
530
+patent license (a) in connection with copies of the covered work
531
+conveyed by you (or copies made from those copies), or (b) primarily
532
+for and in connection with specific products or compilations that
533
+contain the covered work, unless you entered into that arrangement,
534
+or that patent license was granted, prior to 28 March 2007.
535
+
536
+  Nothing in this License shall be construed as excluding or limiting
537
+any implied license or other defenses to infringement that may
538
+otherwise be available to you under applicable patent law.
539
+
540
+  12. No Surrender of Others' Freedom.
541
+
542
+  If conditions are imposed on you (whether by court order, agreement or
543
+otherwise) that contradict the conditions of this License, they do not
544
+excuse you from the conditions of this License.  If you cannot convey a
545
+covered work so as to satisfy simultaneously your obligations under this
546
+License and any other pertinent obligations, then as a consequence you may
547
+not convey it at all.  For example, if you agree to terms that obligate you
548
+to collect a royalty for further conveying from those to whom you convey
549
+the Program, the only way you could satisfy both those terms and this
550
+License would be to refrain entirely from conveying the Program.
551
+
552
+  13. Use with the GNU Affero General Public License.
553
+
554
+  Notwithstanding any other provision of this License, you have
555
+permission to link or combine any covered work with a work licensed
556
+under version 3 of the GNU Affero General Public License into a single
557
+combined work, and to convey the resulting work.  The terms of this
558
+License will continue to apply to the part which is the covered work,
559
+but the special requirements of the GNU Affero General Public License,
560
+section 13, concerning interaction through a network will apply to the
561
+combination as such.
562
+
563
+  14. Revised Versions of this License.
564
+
565
+  The Free Software Foundation may publish revised and/or new versions of
566
+the GNU General Public License from time to time.  Such new versions will
567
+be similar in spirit to the present version, but may differ in detail to
568
+address new problems or concerns.
569
+
570
+  Each version is given a distinguishing version number.  If the
571
+Program specifies that a certain numbered version of the GNU General
572
+Public License "or any later version" applies to it, you have the
573
+option of following the terms and conditions either of that numbered
574
+version or of any later version published by the Free Software
575
+Foundation.  If the Program does not specify a version number of the
576
+GNU General Public License, you may choose any version ever published
577
+by the Free Software Foundation.
578
+
579
+  If the Program specifies that a proxy can decide which future
580
+versions of the GNU General Public License can be used, that proxy's
581
+public statement of acceptance of a version permanently authorizes you
582
+to choose that version for the Program.
583
+
584
+  Later license versions may give you additional or different
585
+permissions.  However, no additional obligations are imposed on any
586
+author or copyright holder as a result of your choosing to follow a
587
+later version.
588
+
589
+  15. Disclaimer of Warranty.
590
+
591
+  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
592
+APPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
593
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
594
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
595
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
596
+PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
597
+IS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
598
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
599
+
600
+  16. Limitation of Liability.
601
+
602
+  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
603
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
604
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
605
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
606
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
607
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
608
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
609
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
610
+SUCH DAMAGES.
611
+
612
+  17. Interpretation of Sections 15 and 16.
613
+
614
+  If the disclaimer of warranty and limitation of liability provided
615
+above cannot be given local legal effect according to their terms,
616
+reviewing courts shall apply local law that most closely approximates
617
+an absolute waiver of all civil liability in connection with the
618
+Program, unless a warranty or assumption of liability accompanies a
619
+copy of the Program in return for a fee.
620
+
621
+                     END OF TERMS AND CONDITIONS
622
+
623
+            How to Apply These Terms to Your New Programs
624
+
625
+  If you develop a new program, and you want it to be of the greatest
626
+possible use to the public, the best way to achieve this is to make it
627
+free software which everyone can redistribute and change under these terms.
628
+
629
+  To do so, attach the following notices to the program.  It is safest
630
+to attach them to the start of each source file to most effectively
631
+state the exclusion of warranty; and each file should have at least
632
+the "copyright" line and a pointer to where the full notice is found.
633
+
634
+    <one line to give the program's name and a brief idea of what it does.>
635
+    Copyright (C) <year>  <name of author>
636
+
637
+    This program is free software: you can redistribute it and/or modify
638
+    it under the terms of the GNU General Public License as published by
639
+    the Free Software Foundation, version 3 of the License.
640
+   
641
+
642
+    This program is distributed in the hope that it will be useful,
643
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
644
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
645
+    GNU General Public License for more details.
646
+
647
+    You should have received a copy of the GNU General Public License
648
+    along with this program.  If not, see <http://www.gnu.org/licenses/>.
649
+
650
+Also add information on how to contact you by electronic and paper mail.
651
+
652
+  If the program does terminal interaction, make it output a short
653
+notice like this when it starts in an interactive mode:
654
+
655
+    <program>  Copyright (C) <year>  <name of author>
656
+    This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657
+    This is free software, and you are welcome to redistribute it
658
+    under certain conditions; type `show c' for details.
659
+
660
+The hypothetical commands `show w' and `show c' should show the appropriate
661
+parts of the General Public License.  Of course, your program's commands
662
+might be different; for a GUI interface, you would use an "about box".
663
+
664
+  You should also get your employer (if you work as a programmer) or school,
665
+if any, to sign a "copyright disclaimer" for the program, if necessary.
666
+For more information on this, and how to apply and follow the GNU GPL, see
667
+<http://www.gnu.org/licenses/>.
668
+
669
+  The GNU General Public License does not permit incorporating your program
670
+into proprietary programs.  If your program is a subroutine library, you
671
+may consider it more useful to permit linking proprietary applications with
672
+the library.  If this is what you want to do, use the GNU Lesser General
673
+Public License instead of this License.  But first, please read
674
+<http://www.gnu.org/philosophy/why-not-lgpl.html>.
... ...
@@ -0,0 +1,165 @@
1
+                   GNU LESSER GENERAL PUBLIC LICENSE
2
+                       Version 3, 29 June 2007
3
+
4
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
5
+ Everyone is permitted to copy and distribute verbatim copies
6
+ of this license document, but changing it is not allowed.
7
+
8
+
9
+  This version of the GNU Lesser General Public License incorporates
10
+the terms and conditions of version 3 of the GNU General Public
11
+License, supplemented by the additional permissions listed below.
12
+
13
+  0. Additional Definitions.
14
+
15
+  As used herein, "this License" refers to version 3 of the GNU Lesser
16
+General Public License, and the "GNU GPL" refers to version 3 of the GNU
17
+General Public License.
18
+
19
+  "The Library" refers to a covered work governed by this License,
20
+other than an Application or a Combined Work as defined below.
21
+
22
+  An "Application" is any work that makes use of an interface provided
23
+by the Library, but which is not otherwise based on the Library.
24
+Defining a subclass of a class defined by the Library is deemed a mode
25
+of using an interface provided by the Library.
26
+
27
+  A "Combined Work" is a work produced by combining or linking an
28
+Application with the Library.  The particular version of the Library
29
+with which the Combined Work was made is also called the "Linked
30
+Version".
31
+
32
+  The "Minimal Corresponding Source" for a Combined Work means the
33
+Corresponding Source for the Combined Work, excluding any source code
34
+for portions of the Combined Work that, considered in isolation, are
35
+based on the Application, and not on the Linked Version.
36
+
37
+  The "Corresponding Application Code" for a Combined Work means the
38
+object code and/or source code for the Application, including any data
39
+and utility programs needed for reproducing the Combined Work from the
40
+Application, but excluding the System Libraries of the Combined Work.
41
+
42
+  1. Exception to Section 3 of the GNU GPL.
43
+
44
+  You may convey a covered work under sections 3 and 4 of this License
45
+without being bound by section 3 of the GNU GPL.
46
+
47
+  2. Conveying Modified Versions.
48
+
49
+  If you modify a copy of the Library, and, in your modifications, a
50
+facility refers to a function or data to be supplied by an Application
51
+that uses the facility (other than as an argument passed when the
52
+facility is invoked), then you may convey a copy of the modified
53
+version:
54
+
55
+   a) under this License, provided that you make a good faith effort to
56
+   ensure that, in the event an Application does not supply the
57
+   function or data, the facility still operates, and performs
58
+   whatever part of its purpose remains meaningful, or
59
+
60
+   b) under the GNU GPL, with none of the additional permissions of
61
+   this License applicable to that copy.
62
+
63
+  3. Object Code Incorporating Material from Library Header Files.
64
+
65
+  The object code form of an Application may incorporate material from
66
+a header file that is part of the Library.  You may convey such object
67
+code under terms of your choice, provided that, if the incorporated
68
+material is not limited to numerical parameters, data structure
69
+layouts and accessors, or small macros, inline functions and templates
70
+(ten or fewer lines in length), you do both of the following:
71
+
72
+   a) Give prominent notice with each copy of the object code that the
73
+   Library is used in it and that the Library and its use are
74
+   covered by this License.
75
+
76
+   b) Accompany the object code with a copy of the GNU GPL and this license
77
+   document.
78
+
79
+  4. Combined Works.
80
+
81
+  You may convey a Combined Work under terms of your choice that,
82
+taken together, effectively do not restrict modification of the
83
+portions of the Library contained in the Combined Work and reverse
84
+engineering for debugging such modifications, if you also do each of
85
+the following:
86
+
87
+   a) Give prominent notice with each copy of the Combined Work that
88
+   the Library is used in it and that the Library and its use are
89
+   covered by this License.
90
+
91
+   b) Accompany the Combined Work with a copy of the GNU GPL and this license
92
+   document.
93
+
94
+   c) For a Combined Work that displays copyright notices during
95
+   execution, include the copyright notice for the Library among
96
+   these notices, as well as a reference directing the user to the
97
+   copies of the GNU GPL and this license document.
98
+
99
+   d) Do one of the following:
100
+
101
+       0) Convey the Minimal Corresponding Source under the terms of this
102
+       License, and the Corresponding Application Code in a form
103
+       suitable for, and under terms that permit, the user to
104
+       recombine or relink the Application with a modified version of
105
+       the Linked Version to produce a modified Combined Work, in the
106
+       manner specified by section 6 of the GNU GPL for conveying
107
+       Corresponding Source.
108
+
109
+       1) Use a suitable shared library mechanism for linking with the
110
+       Library.  A suitable mechanism is one that (a) uses at run time
111
+       a copy of the Library already present on the user's computer
112
+       system, and (b) will operate properly with a modified version
113
+       of the Library that is interface-compatible with the Linked
114
+       Version.
115
+
116
+   e) Provide Installation Information, but only if you would otherwise
117
+   be required to provide such information under section 6 of the
118
+   GNU GPL, and only to the extent that such information is
119
+   necessary to install and execute a modified version of the
120
+   Combined Work produced by recombining or relinking the
121
+   Application with a modified version of the Linked Version. (If
122
+   you use option 4d0, the Installation Information must accompany
123
+   the Minimal Corresponding Source and Corresponding Application
124
+   Code. If you use option 4d1, you must provide the Installation
125
+   Information in the manner specified by section 6 of the GNU GPL
126
+   for conveying Corresponding Source.)
127
+
128
+  5. Combined Libraries.
129
+
130
+  You may place library facilities that are a work based on the
131
+Library side by side in a single library together with other library
132
+facilities that are not Applications and are not covered by this
133
+License, and convey such a combined library under terms of your
134
+choice, if you do both of the following:
135
+
136
+   a) Accompany the combined library with a copy of the same work based
137
+   on the Library, uncombined with any other library facilities,
138
+   conveyed under the terms of this License.
139
+
140
+   b) Give prominent notice with the combined library that part of it
141
+   is a work based on the Library, and explaining where to find the
142
+   accompanying uncombined form of the same work.
143
+
144
+  6. Revised Versions of the GNU Lesser General Public License.
145
+
146
+  The Free Software Foundation may publish revised and/or new versions
147
+of the GNU Lesser General Public License from time to time. Such new
148
+versions will be similar in spirit to the present version, but may
149
+differ in detail to address new problems or concerns.
150
+
151
+  Each version is given a distinguishing version number. If the
152
+Library as you received it specifies that a certain numbered version
153
+of the GNU Lesser General Public License "or any later version"
154
+applies to it, you have the option of following the terms and
155
+conditions either of that published version or of any later version
156
+published by the Free Software Foundation. If the Library as you
157
+received it does not specify a version number of the GNU Lesser
158
+General Public License, you may choose any version of the GNU Lesser
159
+General Public License ever published by the Free Software Foundation.
160
+
161
+  If the Library as you received it specifies that a proxy can decide
162
+whether future versions of the GNU Lesser General Public License shall
163
+apply, that proxy's public statement of acceptance of any version is
164
+permanent authorization for you to choose that version for the
165
+Library.
... ...
@@ -0,0 +1,3 @@
1
+1.0.0 2010-07-31
2
+----------------
3
+created first version
... ...
@@ -0,0 +1,142 @@
1
+# FlexiPix library
2
+# !version: 1.0.0! !date: 2010-07-31!
3
+#
4
+# Copyright 2010 Stefan Schuermans <stefan schuermans info>
5
+#
6
+# This program is free software: you can redistribute it and/or modify
7
+# it under the terms of the GNU General Public License as published by
8
+# the Free Software Foundation, version 3 of the License.
9
+#
10
+#
11
+# This program is distributed in the hope that it will be useful,
12
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
+# GNU General Public License for more details.
15
+#
16
+# You should have received a copy of the GNU Lesser General Public License
17
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
18
+
19
+LIBTARGET=libflexipix
20
+VER=1
21
+VERMIN=0
22
+VERREV=0
23
+
24
+SRCS=$(wildcard src/*.c)
25
+EX_SRCS=$(wildcard examples/src/*.c)
26
+
27
+CC=gcc
28
+AR=ar
29
+RANLIB=ranlib
30
+INSTALL=install
31
+
32
+CFLAGS=-W -Wall -fPIC -O3
33
+DEFINES=-DFLP_VER_MAJ=$(VER) -DFLP_VER_MIN=$(VERMIN) -DFLP_VER_REV=$(VERREV)
34
+INCLUDES=-Iinclude
35
+LDFLAGS=-Llib
36
+LIBS=-lm -lpthread -lflexipix
37
+
38
+SRCS_BASE=$(patsubst %.c,%,$(SRCS))
39
+DEPS=$(addsuffix .d,$(SRCS_BASE))
40
+OBJS=$(addsuffix .o,$(SRCS_BASE))
41
+EX_SRCS_BASE=$(patsubst %.c,%,$(EX_SRCS))
42
+EX_DEPS=$(addsuffix .d,$(EX_SRCS_BASE))
43
+EX_OBJS=$(addsuffix .o,$(EX_SRCS_BASE))
44
+EX_TARGETS=$(EX_SRCS_BASE)
45
+
46
+LIBTGA = lib/$(LIBTARGET).a
47
+LIBTGSO = lib/$(LIBTARGET).so.$(VER)
48
+LIBTGSOM = $(LIBTGSO).$(VERMIN)
49
+LIBTGSOR = $(LIBTGSOM).$(VERREV)
50
+
51
+VERSION = $(VER).$(VERMIN).$(VERREV)
52
+DATE := $(shell date +%Y-%m-%d)
53
+PACKNAME = $(LIBTARGET)-$(VERSION)_$(DATE)
54
+PACKDATA = ChangeLog COPYING COPYING.LESSER Makefile \
55
+           examples include README src
56
+
57
+ENV_PREFIX=$(shell echo $$PREFIX)
58
+STOW_DIR=/usr/local/stow
59
+STOW_PREFIX=$(STOW_DIR)/$(PACKNAME)
60
+DEF_PREFIX=/usr/local
61
+ifneq ($(ENV_PREFIX),)
62
+  PREFIX=$(ENV_PREFIX)
63
+else
64
+  ifeq ($(shell if [ -d $(STOW_DIR) ]; then echo stow; fi),stow)
65
+    PREFIX=$(STOW_PREFIX)
66
+  else
67
+    PREFIX=$(DEF_PREFIX)
68
+  endif
69
+endif
70
+
71
+.PHONY: all clean pack install uninstall
72
+.SECONDARY:
73
+.SUFFIXES:
74
+
75
+all: deps $(LIBTGA) $(LIBTGSO) $(EX_TARGETS)
76
+
77
+ifneq ($(MAKECMDGOALS),clean)
78
+  include deps
79
+endif
80
+
81
+deps: $(DEPS) $(EX_DEPS)
82
+	cat /dev/null $+ >$@
83
+
84
+%.d: %.c
85
+	$(CC) $(CFLAGS) $(DEFINES) $(INCLUDES) -M -o $@ $<
86
+	sed -i 's!^$(basename $(notdir $<))!$(dir $<)&!' $@
87
+
88
+%.o: %.c
89
+	$(CC) $(CFLAGS) $(DEFINES) $(INCLUDES) -c -o $@ $<
90
+
91
+%: %.o $(LIBTGA) $(LIBTGSO)
92
+	$(CC) $(LDFLAGS) -o $@ $< $(LIBS)
93
+
94
+lib:
95
+	mkdir -p lib
96
+
97
+$(LIBTGA): $(OBJS) lib
98
+	$(AR) cr $@ $(filter-out lib,$+)
99
+	$(RANLIB) $@
100
+
101
+$(LIBTGSOR): $(OBJS)
102
+	$(CC) -shared -Wl,-soname,$(LIBTARGET).so.$(VER) $(LDFLAGS) \
103
+	      -o $@ $+
104
+
105
+$(LIBTGSOM): $(LIBTGSOR)
106
+	rm -f $@
107
+	ln -s $(notdir $<) $@
108
+
109
+$(LIBTGSO): $(LIBTGSOM)
110
+	rm -f $@
111
+	ln -s $(notdir $<) $@
112
+
113
+clean:
114
+	rm -rf deps $(DEPS) $(OBJS) lib $(EX_DEPS) $(EX_SRC) $(EX_TARGETS) \
115
+	       pack
116
+
117
+pack:
118
+	$(MAKE) clean
119
+	$(MAKE)
120
+	$(MAKE) clean
121
+	mkdir -p pack/$(PACKNAME)
122
+	cp -r $(PACKDATA) pack/$(PACKNAME)
123
+	sed -i 's/!version: 1.0.0!]*!/!version: 1.0.0!/g' $$(find pack -type f)
124
+	sed -i 's/!date: 2010-07-31!]*!/!date: 2010-07-31!/g' $$(find pack -type f)
125
+	cd pack; tar jcf ../$(PACKNAME).tar.bz2 $(PACKNAME)
126
+	$(MAKE) clean
127
+
128
+install: all
129
+	$(INSTALL) -d $(PREFIX)/include/flexipix
130
+	$(INSTALL) -m 644 -t $(PREFIX)/include/flexipix $(wildcard include/flexipix/*.h)
131
+	$(INSTALL) -d $(PREFIX)/lib
132
+	$(INSTALL) -m 644 -t $(PREFIX)/lib $(LIBTGA) $(LIBTGSO)
133
+	ln -sf $(notdir $(LIBTGSO)) $(PREFIX)/lib/$(notdir $(LIBTGSOM))
134
+	ln -sf $(notdir $(LIBTGSOM)) $(PREFIX)/lib/$(notdir $(LIBTGSOR))
135
+
136
+uninstall:
137
+	rm -f $(PREFIX)/lib/$(notdir $(LIBTGA))
138
+	rm -f $(PREFIX)/lib/$(notdir $(LIBTGSOR))
139
+	rm -f $(PREFIX)/lib/$(notdir $(LIBTGSOM))
140
+	rm -f $(PREFIX)/lib/$(notdir $(LIBTGSO))
141
+	rm -rf $(PREFIX)/include/flexipix
142
+
... ...
@@ -0,0 +1,26 @@
1
+FlexiPix library
2
+!version: 1.0.0! !date: 2010-07-31!
3
+
4
+FlexPix is a large scale display architecure that is driven using UDP/IP.
5
+It consists of single pixels that are connected to chains. A number of those
6
+pixel chains is then connected to a so called distributor module that
7
+receives data over ethernet and distributes it to the pixel chains.
8
+
9
+The protocol used on UDP is MCUF (microcontroller unit frame, see
10
+http://wiki.blinkenarea.org/index.php/MicroControllerUnitFrame). However,
11
+as FlexiPix displays can have more than 65536 pixels, multiple MCUF packets
12
+are sent for one frame - a single MCUF frame to every distributor.
13
+The coordinates of the pixels in the MCUF packets do not correspond to pixel
14
+locations, but to pixel addresses. The y coordinate is the number of the
15
+output of the distributor and the x coordinate is the number of the pixel
16
+in the chain. The number of channels is always 3 (RGB) and the maximum value
17
+is always 255 (8 bit per channel).
18
+
19
+This library can be used to send the required UDP packets to the FlexiPix
20
+display to make it show images and/or videos.
21
+As the libarary has to know how the pixels are wired and where there are
22
+located (i.e. which pixel in the source image they represent), a rather
23
+complex config file is needed. Examples of config files can be found in
24
+"examples/config" and example code showing how to use the library is
25
+located in "examples/src".
26
+
... ...
@@ -0,0 +1,325 @@
1
+# FlexiPix configuration file
2
+
3
+# the address to bind the local socket to
4
+#  - the FlexiPix network 10.70.80.0/16 must be reachable from this address
5
+bindAddr = 0.0.0.0:0
6
+
7
+# the size of the display
8
+#  - <width>,<height> in pixels
9
+size = 195,32
10
+
11
+# this line adds a new distributor
12
+#  - the general format is: distributor <distributor number> = <number of outputs>,<number of pixel per output>
13
+distributor 0 = 6,64
14
+distributor 1 = 6,64
15
+distributor 2 = 6,64
16
+distributor 3 = 6,64
17
+distributor 4 = 24,16
18
+distributor 5 = 24,16
19
+distributor 6 = 24,16
20
+distributor 7 = 24,16
21
+distributor 8 = 24,16
22
+distributor 9 = 24,16
23
+distributor 10 = 24,16
24
+distributor 11 = 24,16
25
+distributor 12 = 6,64
26
+distributor 13 = 6,64
27
+distributor 14 = 6,64
28
+distributor 15 = 6,64
29
+
30
+# those lines introduce a mapping between the channel values in the video and the values transmitted to the display
31
+#  - mapping is done per distributor and applies to all pixels connected to it
32
+#  - the general format is: mapping <distributor number> (red|green|blue) = <base> <factor> <gamma>
33
+#  - the mapping formula is: <display value> := <base> + <factor> * <original value> ^ (1 / <gamma>)
34
+mapping 0 red = 0.005 0.99 1.0
35
+mapping 0 green = 0.005 0.99 1.0
36
+mapping 0 blue = 0.005 0.99 1.0
37
+mapping 1 red = 0.005 0.99 1.0
38
+mapping 1 green = 0.005 0.99 1.0
39
+mapping 1 blue = 0.005 0.99 1.0
40
+mapping 2 red = 0.005 0.99 1.0
41
+mapping 2 green = 0.005 0.99 1.0
42
+mapping 2 blue = 0.005 0.99 1.0
43
+mapping 3 red = 0.005 0.99 1.0
44
+mapping 3 green = 0.005 0.99 1.0
45
+mapping 3 blue = 0.005 0.99 1.0
46
+mapping 4 red = 0.005 0.99 1.0
47
+mapping 4 green = 0.005 0.99 1.0
48
+mapping 4 blue = 0.005 0.99 1.0
49
+mapping 5 red = 0.005 0.99 1.0
50
+mapping 5 green = 0.005 0.99 1.0
51
+mapping 5 blue = 0.005 0.99 1.0
52
+mapping 6 red = 0.005 0.99 1.0
53
+mapping 6 green = 0.005 0.99 1.0
54
+mapping 6 blue = 0.005 0.99 1.0
55
+mapping 7 red = 0.005 0.99 1.0
56
+mapping 7 green = 0.005 0.99 1.0
57
+mapping 7 blue = 0.005 0.99 1.0
58
+mapping 8 red = 0.005 0.99 1.0
59
+mapping 8 green = 0.005 0.99 1.0
60
+mapping 8 blue = 0.005 0.99 1.0
61
+mapping 9 red = 0.005 0.99 1.0
62
+mapping 9 green = 0.005 0.99 1.0
63
+mapping 9 blue = 0.005 0.99 1.0
64
+mapping 10 red = 0.005 0.99 1.0
65
+mapping 10 green = 0.005 0.99 1.0
66
+mapping 10 blue = 0.005 0.99 1.0
67
+mapping 11 red = 0.005 0.99 1.0
68
+mapping 11 green = 0.005 0.99 1.0
69
+mapping 11 blue = 0.005 0.99 1.0
70
+mapping 12 red = 0.005 0.99 1.0
71
+mapping 12 green = 0.005 0.99 1.0
72
+mapping 12 blue = 0.005 0.99 1.0
73
+mapping 13 red = 0.005 0.99 1.0
74
+mapping 13 green = 0.005 0.99 1.0
75
+mapping 13 blue = 0.005 0.99 1.0
76
+mapping 14 red = 0.005 0.99 1.0
77
+mapping 14 green = 0.005 0.99 1.0
78
+mapping 14 blue = 0.005 0.99 1.0
79
+mapping 15 red = 0.005 0.99 1.0
80
+mapping 15 green = 0.005 0.99 1.0
81
+mapping 15 blue = 0.005 0.99 1.0
82
+
83
+# these lines specify the logical positions of the pixels at an output in movie coordinates
84
+#  - the general format is: output <distributor number>,<output number> = <pixel x>,<pixel y> ...
85
+#  - the order of the pixels is the order they are connected in the chain
86
+output 0,0 = 0,31 0,30 0,29 0,28 0,27 0,26 0,25 0,24 0,23 0,22 0,21 0,20 0,19 0,18 0,17 0,16 0,15 0,14 0,13 0,12 0,11 0,10 0,9 0,8 0,7 0,6 0,5 0,4 0,3 0,2 0,1 0,0 1,0 1,1 1,2 1,3 1,4 1,5 1,6 1,7 1,8 1,9 1,10 1,11 1,12 1,13 1,14 1,15 1,16 1,17 1,18 1,19 1,20 1,21 1,22 1,23 1,24 1,25 1,26 1,27 1,28 1,29 1,30 1,31
87
+output 0,1 = 2,31 2,30 2,29 2,28 2,27 2,26 2,25 2,24 2,23 2,22 2,21 2,20 2,19 2,18 2,17 2,16 2,15 2,14 2,13 2,12 2,11 2,10 2,9 2,8 2,7 2,6 2,5 2,4 2,3 2,2 2,1 2,0 3,0 3,1 3,2 3,3 3,4 3,5 3,6 3,7 3,8 3,9 3,10 3,11 3,12 3,13 3,14 3,15 3,16 3,17 3,18 3,19 3,20 3,21 3,22 3,23 3,24 3,25 3,26 3,27 3,28 3,29 3,30 3,31
88
+output 0,2 = 4,31 4,30 4,29 4,28 4,27 4,26 4,25 4,24 4,23 4,22 4,21 4,20 4,19 4,18 4,17 4,16 4,15 4,14 4,13 4,12 4,11 4,10 4,9 4,8 4,7 4,6 4,5 4,4 4,3 4,2 4,1 4,0 5,0 5,1 5,2 5,3 5,4 5,5 5,6 5,7 5,8 5,9 5,10 5,11 5,12 5,13 5,14 5,15 5,16 5,17 5,18 5,19 5,20 5,21 5,22 5,23 5,24 5,25 5,26 5,27 5,28 5,29 5,30 5,31
89
+output 0,3 = 6,31 6,30 6,29 6,28 6,27 6,26 6,25 6,24 6,23 6,22 6,21 6,20 6,19 6,18 6,17 6,16 6,15 6,14 6,13 6,12 6,11 6,10 6,9 6,8 6,7 6,6 6,5 6,4 6,3 6,2 6,1 6,0 7,0 7,1 7,2 7,3 7,4 7,5 7,6 7,7 7,8 7,9 7,10 7,11 7,12 7,13 7,14 7,15 7,16 7,17 7,18 7,19 7,20 7,21 7,22 7,23 7,24 7,25 7,26 7,27 7,28 7,29 7,30 7,31
90
+output 0,4 = 8,31 8,30 8,29 8,28 8,27 8,26 8,25 8,24 8,23 8,22 8,21 8,20 8,19 8,18 8,17 8,16 8,15 8,14 8,13 8,12 8,11 8,10 8,9 8,8 8,7 8,6 8,5 8,4 8,3 8,2 8,1 8,0 9,0 9,1 9,2 9,3 9,4 9,5 9,6 9,7 9,8 9,9 9,10 9,11 9,12 9,13 9,14 9,15 9,16 9,17 9,18 9,19 9,20 9,21 9,22 9,23 9,24 9,25 9,26 9,27 9,28 9,29 9,30 9,31
91
+output 0,5 = 10,31 10,30 10,29 10,28 10,27 10,26 10,25 10,24 10,23 10,22 10,21 10,20 10,19 10,18 10,17 10,16 10,15 10,14 10,13 10,12 10,11 10,10 10,9 10,8 10,7 10,6 10,5 10,4 10,3 10,2 10,1 10,0 11,0 11,1 11,2 11,3 11,4 11,5 11,6 11,7 11,8 11,9 11,10 11,11 11,12 11,13 11,14 11,15 11,16 11,17 11,18 11,19 11,20 11,21 11,22 11,23 11,24 11,25 11,26 11,27 11,28 11,29 11,30 11,31
92
+output 1,0 = 12,31 12,30 12,29 12,28 12,27 12,26 12,25 12,24 12,23 12,22 12,21 12,20 12,19 12,18 12,17 12,16 12,15 12,14 12,13 12,12 12,11 12,10 12,9 12,8 12,7 12,6 12,5 12,4 12,3 12,2 12,1 12,0 13,0 13,1 13,2 13,3 13,4 13,5 13,6 13,7 13,8 13,9 13,10 13,11 13,12 13,13 13,14 13,15 13,16 13,17 13,18 13,19 13,20 13,21 13,22 13,23 13,24 13,25 13,26 13,27 13,28 13,29 13,30 13,31
93
+output 1,1 = 14,31 14,30 14,29 14,28 14,27 14,26 14,25 14,24 14,23 14,22 14,21 14,20 14,19 14,18 14,17 14,16 14,15 14,14 14,13 14,12 14,11 14,10 14,9 14,8 14,7 14,6 14,5 14,4 14,3 14,2 14,1 14,0 15,0 15,1 15,2 15,3 15,4 15,5 15,6 15,7 15,8 15,9 15,10 15,11 15,12 15,13 15,14 15,15 15,16 15,17 15,18 15,19 15,20 15,21 15,22 15,23 15,24 15,25 15,26 15,27 15,28 15,29 15,30 15,31
94
+output 1,2 = 16,31 16,30 16,29 16,28 16,27 16,26 16,25 16,24 16,23 16,22 16,21 16,20 16,19 16,18 16,17 16,16 16,15 16,14 16,13 16,12 16,11 16,10 16,9 16,8 16,7 16,6 16,5 16,4 16,3 16,2 16,1 16,0 17,0 17,1 17,2 17,3 17,4 17,5 17,6 17,7 17,8 17,9 17,10 17,11 17,12 17,13 17,14 17,15 17,16 17,17 17,18 17,19 17,20 17,21 17,22 17,23 17,24 17,25 17,26 17,27 17,28 17,29 17,30 17,31
95
+output 1,3 = 18,31 18,30 18,29 18,28 18,27 18,26 18,25 18,24 18,23 18,22 18,21 18,20 18,19 18,18 18,17 18,16 18,15 18,14 18,13 18,12 18,11 18,10 18,9 18,8 18,7 18,6 18,5 18,4 18,3 18,2 18,1 18,0 19,0 19,1 19,2 19,3 19,4 19,5 19,6 19,7 19,8 19,9 19,10 19,11 19,12 19,13 19,14 19,15 19,16 19,17 19,18 19,19 19,20 19,21 19,22 19,23 19,24 19,25 19,26 19,27 19,28 19,29 19,30 19,31
96
+output 1,4 = 20,31 20,30 20,29 20,28 20,27 20,26 20,25 20,24 20,23 20,22 20,21 20,20 20,19 20,18 20,17 20,16 20,15 20,14 20,13 20,12 20,11 20,10 20,9 20,8 20,7 20,6 20,5 20,4 20,3 20,2 20,1 20,0 21,0 21,1 21,2 21,3 21,4 21,5 21,6 21,7 21,8 21,9 21,10 21,11 21,12 21,13 21,14 21,15 21,16 21,17 21,18 21,19 21,20 21,21 21,22 21,23 21,24 21,25 21,26 21,27 21,28 21,29 21,30 21,31
97
+output 1,5 = 22,31 22,30 22,29 22,28 22,27 22,26 22,25 22,24 22,23 22,22 22,21 22,20 22,19 22,18 22,17 22,16 22,15 22,14 22,13 22,12 22,11 22,10 22,9 22,8 22,7 22,6 22,5 22,4 22,3 22,2 22,1 22,0 23,0 23,1 23,2 23,3 23,4 23,5 23,6 23,7 23,8 23,9 23,10 23,11 23,12 23,13 23,14 23,15 23,16 23,17 23,18 23,19 23,20 23,21 23,22 23,23 23,24 23,25 23,26 23,27 23,28 23,29 23,30 23,31
98
+output 2,0 = 24,31 24,30 24,29 24,28 24,27 24,26 24,25 24,24 24,23 24,22 24,21 24,20 24,19 24,18 24,17 24,16 24,15 24,14 24,13 24,12 24,11 24,10 24,9 24,8 24,7 24,6 24,5 24,4 24,3 24,2 24,1 24,0 25,0 25,1 25,2 25,3 25,4 25,5 25,6 25,7 25,8 25,9 25,10 25,11 25,12 25,13 25,14 25,15 25,16 25,17 25,18 25,19 25,20 25,21 25,22 25,23 25,24 25,25 25,26 25,27 25,28 25,29 25,30 25,31
99
+output 2,1 = 26,31 26,30 26,29 26,28 26,27 26,26 26,25 26,24 26,23 26,22 26,21 26,20 26,19 26,18 26,17 26,16 26,15 26,14 26,13 26,12 26,11 26,10 26,9 26,8 26,7 26,6 26,5 26,4 26,3 26,2 26,1 26,0 27,0 27,1 27,2 27,3 27,4 27,5 27,6 27,7 27,8 27,9 27,10 27,11 27,12 27,13 27,14 27,15 27,16 27,17 27,18 27,19 27,20 27,21 27,22 27,23 27,24 27,25 27,26 27,27 27,28 27,29 27,30 27,31
100
+output 2,2 = 28,31 28,30 28,29 28,28 28,27 28,26 28,25 28,24 28,23 28,22 28,21 28,20 28,19 28,18 28,17 28,16 28,15 28,14 28,13 28,12 28,11 28,10 28,9 28,8 28,7 28,6 28,5 28,4 28,3 28,2 28,1 28,0 29,0 29,1 29,2 29,3 29,4 29,5 29,6 29,7 29,8 29,9 29,10 29,11 29,12 29,13 29,14 29,15 29,16 29,17 29,18 29,19 29,20 29,21 29,22 29,23 29,24 29,25 29,26 29,27 29,28 29,29 29,30 29,31
101
+output 2,3 = 30,31 30,30 30,29 30,28 30,27 30,26 30,25 30,24 30,23 30,22 30,21 30,20 30,19 30,18 30,17 30,16 30,15 30,14 30,13 30,12 30,11 30,10 30,9 30,8 30,7 30,6 30,5 30,4 30,3 30,2 30,1 30,0 31,0 31,1 31,2 31,3 31,4 31,5 31,6 31,7 31,8 31,9 31,10 31,11 31,12 31,13 31,14 31,15 31,16 31,17 31,18 31,19 31,20 31,21 31,22 31,23 31,24 31,25 31,26 31,27 31,28 31,29 31,30 31,31
102
+output 2,4 = 32,31 32,30 32,29 32,28 32,27 32,26 32,25 32,24 32,23 32,22 32,21 32,20 32,19 32,18 32,17 32,16 32,15 32,14 32,13 32,12 32,11 32,10 32,9 32,8 32,7 32,6 32,5 32,4 32,3 32,2 32,1 32,0 33,0 33,1 33,2 33,3 33,4 33,5 33,6 33,7 33,8 33,9 33,10 33,11 33,12 33,13 33,14 33,15 33,16 33,17 33,18 33,19 33,20 33,21 33,22 33,23 33,24 33,25 33,26 33,27 33,28 33,29 33,30 33,31
103
+output 2,5 = 34,31 34,30 34,29 34,28 34,27 34,26 34,25 34,24 34,23 34,22 34,21 34,20 34,19 34,18 34,17 34,16 34,15 34,14 34,13 34,12 34,11 34,10 34,9 34,8 34,7 34,6 34,5 34,4 34,3 34,2 34,1 34,0 35,0 35,1 35,2 35,3 35,4 35,5 35,6 35,7 35,8 35,9 35,10 35,11 35,12 35,13 35,14 35,15 35,16 35,17 35,18 35,19 35,20 35,21 35,22 35,23 35,24 35,25 35,26 35,27 35,28 35,29 35,30 35,31
104
+output 3,0 = 36,31 36,30 36,29 36,28 36,27 36,26 36,25 36,24 36,23 36,22 36,21 36,20 36,19 36,18 36,17 36,16 36,15 36,14 36,13 36,12 36,11 36,10 36,9 36,8 36,7 36,6 36,5 36,4 36,3 36,2 36,1 36,0 37,0 37,1 37,2 37,3 37,4 37,5 37,6 37,7 37,8 37,9 37,10 37,11 37,12 37,13 37,14 37,15 37,16 37,17 37,18 37,19 37,20 37,21 37,22 37,23 37,24 37,25 37,26 37,27 37,28 37,29 37,30 37,31
105
+output 3,1 = 38,31 38,30 38,29 38,28 38,27 38,26 38,25 38,24 38,23 38,22 38,21 38,20 38,19 38,18 38,17 38,16 38,15 38,14 38,13 38,12 38,11 38,10 38,9 38,8 38,7 38,6 38,5 38,4 38,3 38,2 38,1 38,0 39,0 39,1 39,2 39,3 39,4 39,5 39,6 39,7 39,8 39,9 39,10 39,11 39,12 39,13 39,14 39,15 39,16 39,17 39,18 39,19 39,20 39,21 39,22 39,23 39,24 39,25 39,26 39,27 39,28 39,29 39,30 39,31
106
+output 3,2 = 40,31 40,30 40,29 40,28 40,27 40,26 40,25 40,24 40,23 40,22 40,21 40,20 40,19 40,18 40,17 40,16 40,15 40,14 40,13 40,12 40,11 40,10 40,9 40,8 40,7 40,6 40,5 40,4 40,3 40,2 40,1 40,0 41,0 41,1 41,2 41,3 41,4 41,5 41,6 41,7 41,8 41,9 41,10 41,11 41,12 41,13 41,14 41,15 41,16 41,17 41,18 41,19 41,20 41,21 41,22 41,23 41,24 41,25 41,26 41,27 41,28 41,29 41,30 41,31
107
+output 3,3 = 42,31 42,30 42,29 42,28 42,27 42,26 42,25 42,24 42,23 42,22 42,21 42,20 42,19 42,18 42,17 42,16 42,15 42,14 42,13 42,12 42,11 42,10 42,9 42,8 42,7 42,6 42,5 42,4 42,3 42,2 42,1 42,0 43,0 43,1 43,2 43,3 43,4 43,5 43,6 43,7 43,8 43,9 43,10 43,11 43,12 43,13 43,14 43,15 43,16 43,17 43,18 43,19 43,20 43,21 43,22 43,23 43,24 43,25 43,26 43,27 43,28 43,29 43,30 43,31
108
+output 3,4 = 44,31 44,30 44,29 44,28 44,27 44,26 44,25 44,24 44,23 44,22 44,21 44,20 44,19 44,18 44,17 44,16 44,15 44,14 44,13 44,12 44,11 44,10 44,9 44,8 44,7 44,6 44,5 44,4 44,3 44,2 44,1 44,0 45,0 45,1 45,2 45,3 45,4 45,5 45,6 45,7 45,8 45,9 45,10 45,11 45,12 45,13 45,14 45,15 45,16 45,17 45,18 45,19 45,20 45,21 45,22 45,23 45,24 45,25 45,26 45,27 45,28 45,29 45,30 45,31
109
+output 3,5 = 46,31 46,30 46,29 46,28 46,27 46,26 46,25 46,24 46,23 46,22 46,21 46,20 46,19 46,18 46,17 46,16 46,15 46,14 46,13 46,12 46,11 46,10 46,9 46,8 46,7 46,6 46,5 46,4 46,3 46,2 46,1 46,0 47,0 47,1 47,2 47,3 47,4 47,5 47,6 47,7 47,8 47,9 47,10 47,11 47,12 47,13 47,14 47,15 47,16 47,17 47,18 47,19 47,20 47,21 47,22 47,23 47,24 47,25 47,26 47,27 47,28 47,29 47,30 47,31
110
+output 4,0 = 72,31 72,30 72,29 72,28 72,27 72,26 72,25 72,24 72,23 72,22 72,21 72,20 72,19 72,18 72,17 72,16
111
+output 4,1 = 71,31 71,30 71,29 71,28 71,27 71,26 71,25 71,24 71,23 71,22 71,21 71,20 71,19 71,18 71,17 71,16
112
+output 4,2 = 70,31 70,30 70,29 70,28 70,27 70,26 70,25 70,24 70,23 70,22 70,21 70,20 70,19 70,18 70,17 70,16
113
+output 4,3 = 69,31 69,30 69,29 69,28 69,27 69,26 69,25 69,24 69,23 69,22 69,21 69,20 69,19 69,18 69,17 69,16
114
+output 4,4 = 68,31 68,30 68,29 68,28 68,27 68,26 68,25 68,24 68,23 68,22 68,21 68,20 68,19 68,18 68,17 68,16
115
+output 4,5 = 67,31 67,30 67,29 67,28 67,27 67,26 67,25 67,24 67,23 67,22 67,21 67,20 67,19 67,18 67,17 67,16
116
+output 4,6 = 66,31 66,30 66,29 66,28 66,27 66,26 66,25 66,24 66,23 66,22 66,21 66,20 66,19 66,18 66,17 66,16
117
+output 4,7 = 65,31 65,30 65,29 65,28 65,27 65,26 65,25 65,24 65,23 65,22 65,21 65,20 65,19 65,18 65,17 65,16
118
+output 4,8 = 64,31 64,30 64,29 64,28 64,27 64,26 64,25 64,24 64,23 64,22 64,21 64,20 64,19 64,18 64,17 64,16
119
+output 4,9 = 63,31 63,30 63,29 63,28 63,27 63,26 63,25 63,24 63,23 63,22 63,21 63,20 63,19 63,18 63,17 63,16
120
+output 4,10 = 62,31 62,30 62,29 62,28 62,27 62,26 62,25 62,24 62,23 62,22 62,21 62,20 62,19 62,18 62,17 62,16
121
+output 4,11 = 61,31 61,30 61,29 61,28 61,27 61,26 61,25 61,24 61,23 61,22 61,21 61,20 61,19 61,18 61,17 61,16
122
+output 4,12 = 60,31 60,30 60,29 60,28 60,27 60,26 60,25 60,24 60,23 60,22 60,21 60,20 60,19 60,18 60,17 60,16
123
+output 4,13 = 59,31 59,30 59,29 59,28 59,27 59,26 59,25 59,24 59,23 59,22 59,21 59,20 59,19 59,18 59,17 59,16
124
+output 4,14 = 58,31 58,30 58,29 58,28 58,27 58,26 58,25 58,24 58,23 58,22 58,21 58,20 58,19 58,18 58,17 58,16
125
+output 4,15 = 57,31 57,30 57,29 57,28 57,27 57,26 57,25 57,24 57,23 57,22 57,21 57,20 57,19 57,18 57,17 57,16
126
+output 4,16 = 56,31 56,30 56,29 56,28 56,27 56,26 56,25 56,24 56,23 56,22 56,21 56,20 56,19 56,18 56,17 56,16
127
+output 4,17 = 55,31 55,30 55,29 55,28 55,27 55,26 55,25 55,24 55,23 55,22 55,21 55,20 55,19 55,18 55,17 55,16
128
+output 4,18 = 54,31 54,30 54,29 54,28 54,27 54,26 54,25 54,24 54,23 54,22 54,21 54,20 54,19 54,18 54,17 54,16
129
+output 4,19 = 53,31 53,30 53,29 53,28 53,27 53,26 53,25 53,24 53,23 53,22 53,21 53,20 53,19 53,18 53,17 53,16
130
+output 4,20 = 52,31 52,30 52,29 52,28 52,27 52,26 52,25 52,24 52,23 52,22 52,21 52,20 52,19 52,18 52,17 52,16
131
+output 4,21 = 51,31 51,30 51,29 51,28 51,27 51,26 51,25 51,24 51,23 51,22 51,21 51,20 51,19 51,18 51,17 51,16
132
+output 4,22 = 50,31 50,30 50,29 50,28 50,27 50,26 50,25 50,24 50,23 50,22 50,21 50,20 50,19 50,18 50,17 50,16
133
+output 4,23 = 49,31 49,30 49,29 49,28 49,27 49,26 49,25 49,24 49,23 49,22 49,21 49,20 49,19 49,18 49,17 49,16
134
+output 5,0 = 72,0 72,1 72,2 72,3 72,4 72,5 72,6 72,7 72,8 72,9 72,10 72,11 72,12 72,13 72,14 72,15
135
+output 5,1 = 71,0 71,1 71,2 71,3 71,4 71,5 71,6 71,7 71,8 71,9 71,10 71,11 71,12 71,13 71,14 71,15
136
+output 5,2 = 70,0 70,1 70,2 70,3 70,4 70,5 70,6 70,7 70,8 70,9 70,10 70,11 70,12 70,13 70,14 70,15
137
+output 5,3 = 69,0 69,1 69,2 69,3 69,4 69,5 69,6 69,7 69,8 69,9 69,10 69,11 69,12 69,13 69,14 69,15
138
+output 5,4 = 68,0 68,1 68,2 68,3 68,4 68,5 68,6 68,7 68,8 68,9 68,10 68,11 68,12 68,13 68,14 68,15
139
+output 5,5 = 67,0 67,1 67,2 67,3 67,4 67,5 67,6 67,7 67,8 67,9 67,10 67,11 67,12 67,13 67,14 67,15
140
+output 5,6 = 66,0 66,1 66,2 66,3 66,4 66,5 66,6 66,7 66,8 66,9 66,10 66,11 66,12 66,13 66,14 66,15
141
+output 5,7 = 65,0 65,1 65,2 65,3 65,4 65,5 65,6 65,7 65,8 65,9 65,10 65,11 65,12 65,13 65,14 65,15
142
+output 5,8 = 64,0 64,1 64,2 64,3 64,4 64,5 64,6 64,7 64,8 64,9 64,10 64,11 64,12 64,13 64,14 64,15
143
+output 5,9 = 63,0 63,1 63,2 63,3 63,4 63,5 63,6 63,7 63,8 63,9 63,10 63,11 63,12 63,13 63,14 63,15
144
+output 5,10 = 62,0 62,1 62,2 62,3 62,4 62,5 62,6 62,7 62,8 62,9 62,10 62,11 62,12 62,13 62,14 62,15
145
+output 5,11 = 61,0 61,1 61,2 61,3 61,4 61,5 61,6 61,7 61,8 61,9 61,10 61,11 61,12 61,13 61,14 61,15
146
+output 5,12 = 60,0 60,1 60,2 60,3 60,4 60,5 60,6 60,7 60,8 60,9 60,10 60,11 60,12 60,13 60,14 60,15
147
+output 5,13 = 59,0 59,1 59,2 59,3 59,4 59,5 59,6 59,7 59,8 59,9 59,10 59,11 59,12 59,13 59,14 59,15
148
+output 5,14 = 58,0 58,1 58,2 58,3 58,4 58,5 58,6 58,7 58,8 58,9 58,10 58,11 58,12 58,13 58,14 58,15
149
+output 5,15 = 57,0 57,1 57,2 57,3 57,4 57,5 57,6 57,7 57,8 57,9 57,10 57,11 57,12 57,13 57,14 57,15
150
+output 5,16 = 56,0 56,1 56,2 56,3 56,4 56,5 56,6 56,7 56,8 56,9 56,10 56,11 56,12 56,13 56,14 56,15
151
+output 5,17 = 55,0 55,1 55,2 55,3 55,4 55,5 55,6 55,7 55,8 55,9 55,10 55,11 55,12 55,13 55,14 55,15
152
+output 5,18 = 54,0 54,1 54,2 54,3 54,4 54,5 54,6 54,7 54,8 54,9 54,10 54,11 54,12 54,13 54,14 54,15
153
+output 5,19 = 53,0 53,1 53,2 53,3 53,4 53,5 53,6 53,7 53,8 53,9 53,10 53,11 53,12 53,13 53,14 53,15
154
+output 5,20 = 52,0 52,1 52,2 52,3 52,4 52,5 52,6 52,7 52,8 52,9 52,10 52,11 52,12 52,13 52,14 52,15
155
+output 5,21 = 51,0 51,1 51,2 51,3 51,4 51,5 51,6 51,7 51,8 51,9 51,10 51,11 51,12 51,13 51,14 51,15
156
+output 5,22 = 50,0 50,1 50,2 50,3 50,4 50,5 50,6 50,7 50,8 50,9 50,10 50,11 50,12 50,13 50,14 50,15
157
+output 5,23 = 49,0 49,1 49,2 49,3 49,4 49,5 49,6 49,7 49,8 49,9 49,10 49,11 49,12 49,13 49,14 49,15
158
+output 6,0 = 96,31 96,30 96,29 96,28 96,27 96,26 96,25 96,24 96,23 96,22 96,21 96,20 96,19 96,18 96,17 96,16
159
+output 6,1 = 95,31 95,30 95,29 95,28 95,27 95,26 95,25 95,24 95,23 95,22 95,21 95,20 95,19 95,18 95,17 95,16
160
+output 6,2 = 94,31 94,30 94,29 94,28 94,27 94,26 94,25 94,24 94,23 94,22 94,21 94,20 94,19 94,18 94,17 94,16
161
+output 6,3 = 93,31 93,30 93,29 93,28 93,27 93,26 93,25 93,24 93,23 93,22 93,21 93,20 93,19 93,18 93,17 93,16
162
+output 6,4 = 92,31 92,30 92,29 92,28 92,27 92,26 92,25 92,24 92,23 92,22 92,21 92,20 92,19 92,18 92,17 92,16
163
+output 6,5 = 91,31 91,30 91,29 91,28 91,27 91,26 91,25 91,24 91,23 91,22 91,21 91,20 91,19 91,18 91,17 91,16
164
+output 6,6 = 90,31 90,30 90,29 90,28 90,27 90,26 90,25 90,24 90,23 90,22 90,21 90,20 90,19 90,18 90,17 90,16
165
+output 6,7 = 89,31 89,30 89,29 89,28 89,27 89,26 89,25 89,24 89,23 89,22 89,21 89,20 89,19 89,18 89,17 89,16
166
+output 6,8 = 88,31 88,30 88,29 88,28 88,27 88,26 88,25 88,24 88,23 88,22 88,21 88,20 88,19 88,18 88,17 88,16
167
+output 6,9 = 87,31 87,30 87,29 87,28 87,27 87,26 87,25 87,24 87,23 87,22 87,21 87,20 87,19 87,18 87,17 87,16
168
+output 6,10 = 86,31 86,30 86,29 86,28 86,27 86,26 86,25 86,24 86,23 86,22 86,21 86,20 86,19 86,18 86,17 86,16
169
+output 6,11 = 85,31 85,30 85,29 85,28 85,27 85,26 85,25 85,24 85,23 85,22 85,21 85,20 85,19 85,18 85,17 85,16
170
+output 6,12 = 84,31 84,30 84,29 84,28 84,27 84,26 84,25 84,24 84,23 84,22 84,21 84,20 84,19 84,18 84,17 84,16
171
+output 6,13 = 83,31 83,30 83,29 83,28 83,27 83,26 83,25 83,24 83,23 83,22 83,21 83,20 83,19 83,18 83,17 83,16
172
+output 6,14 = 82,31 82,30 82,29 82,28 82,27 82,26 82,25 82,24 82,23 82,22 82,21 82,20 82,19 82,18 82,17 82,16
173
+output 6,15 = 81,31 81,30 81,29 81,28 81,27 81,26 81,25 81,24 81,23 81,22 81,21 81,20 81,19 81,18 81,17 81,16
174
+output 6,16 = 80,31 80,30 80,29 80,28 80,27 80,26 80,25 80,24 80,23 80,22 80,21 80,20 80,19 80,18 80,17 80,16
175
+output 6,17 = 79,31 79,30 79,29 79,28 79,27 79,26 79,25 79,24 79,23 79,22 79,21 79,20 79,19 79,18 79,17 79,16
176
+output 6,18 = 78,31 78,30 78,29 78,28 78,27 78,26 78,25 78,24 78,23 78,22 78,21 78,20 78,19 78,18 78,17 78,16
177
+output 6,19 = 77,31 77,30 77,29 77,28 77,27 77,26 77,25 77,24 77,23 77,22 77,21 77,20 77,19 77,18 77,17 77,16
178
+output 6,20 = 76,31 76,30 76,29 76,28 76,27 76,26 76,25 76,24 76,23 76,22 76,21 76,20 76,19 76,18 76,17 76,16
179
+output 6,21 = 75,31 75,30 75,29 75,28 75,27 75,26 75,25 75,24 75,23 75,22 75,21 75,20 75,19 75,18 75,17 75,16
180
+output 6,22 = 74,31 74,30 74,29 74,28 74,27 74,26 74,25 74,24 74,23 74,22 74,21 74,20 74,19 74,18 74,17 74,16
181
+output 6,23 = 73,31 73,30 73,29 73,28 73,27 73,26 73,25 73,24 73,23 73,22 73,21 73,20 73,19 73,18 73,17 73,16
182
+output 7,0 = 96,0 96,1 96,2 96,3 96,4 96,5 96,6 96,7 96,8 96,9 96,10 96,11 96,12 96,13 96,14 96,15
183
+output 7,1 = 95,0 95,1 95,2 95,3 95,4 95,5 95,6 95,7 95,8 95,9 95,10 95,11 95,12 95,13 95,14 95,15
184
+output 7,2 = 94,0 94,1 94,2 94,3 94,4 94,5 94,6 94,7 94,8 94,9 94,10 94,11 94,12 94,13 94,14 94,15
185
+output 7,3 = 93,0 93,1 93,2 93,3 93,4 93,5 93,6 93,7 93,8 93,9 93,10 93,11 93,12 93,13 93,14 93,15
186
+output 7,4 = 92,0 92,1 92,2 92,3 92,4 92,5 92,6 92,7 92,8 92,9 92,10 92,11 92,12 92,13 92,14 92,15
187
+output 7,5 = 91,0 91,1 91,2 91,3 91,4 91,5 91,6 91,7 91,8 91,9 91,10 91,11 91,12 91,13 91,14 91,15
188
+output 7,6 = 90,0 90,1 90,2 90,3 90,4 90,5 90,6 90,7 90,8 90,9 90,10 90,11 90,12 90,13 90,14 90,15
189
+output 7,7 = 89,0 89,1 89,2 89,3 89,4 89,5 89,6 89,7 89,8 89,9 89,10 89,11 89,12 89,13 89,14 89,15
190
+output 7,8 = 88,0 88,1 88,2 88,3 88,4 88,5 88,6 88,7 88,8 88,9 88,10 88,11 88,12 88,13 88,14 88,15
191
+output 7,9 = 87,0 87,1 87,2 87,3 87,4 87,5 87,6 87,7 87,8 87,9 87,10 87,11 87,12 87,13 87,14 87,15
192
+output 7,10 = 86,0 86,1 86,2 86,3 86,4 86,5 86,6 86,7 86,8 86,9 86,10 86,11 86,12 86,13 86,14 86,15
193
+output 7,11 = 85,0 85,1 85,2 85,3 85,4 85,5 85,6 85,7 85,8 85,9 85,10 85,11 85,12 85,13 85,14 85,15
194
+output 7,12 = 84,0 84,1 84,2 84,3 84,4 84,5 84,6 84,7 84,8 84,9 84,10 84,11 84,12 84,13 84,14 84,15
195
+output 7,13 = 83,0 83,1 83,2 83,3 83,4 83,5 83,6 83,7 83,8 83,9 83,10 83,11 83,12 83,13 83,14 83,15
196
+output 7,14 = 82,0 82,1 82,2 82,3 82,4 82,5 82,6 82,7 82,8 82,9 82,10 82,11 82,12 82,13 82,14 82,15
197
+output 7,15 = 81,0 81,1 81,2 81,3 81,4 81,5 81,6 81,7 81,8 81,9 81,10 81,11 81,12 81,13 81,14 81,15
198
+output 7,16 = 80,0 80,1 80,2 80,3 80,4 80,5 80,6 80,7 80,8 80,9 80,10 80,11 80,12 80,13 80,14 80,15
199
+output 7,17 = 79,0 79,1 79,2 79,3 79,4 79,5 79,6 79,7 79,8 79,9 79,10 79,11 79,12 79,13 79,14 79,15
200
+output 7,18 = 78,0 78,1 78,2 78,3 78,4 78,5 78,6 78,7 78,8 78,9 78,10 78,11 78,12 78,13 78,14 78,15
201
+output 7,19 = 77,0 77,1 77,2 77,3 77,4 77,5 77,6 77,7 77,8 77,9 77,10 77,11 77,12 77,13 77,14 77,15
202
+output 7,20 = 76,0 76,1 76,2 76,3 76,4 76,5 76,6 76,7 76,8 76,9 76,10 76,11 76,12 76,13 76,14 76,15
203
+output 7,21 = 75,0 75,1 75,2 75,3 75,4 75,5 75,6 75,7 75,8 75,9 75,10 75,11 75,12 75,13 75,14 75,15
204
+output 7,22 = 74,0 74,1 74,2 74,3 74,4 74,5 74,6 74,7 74,8 74,9 74,10 74,11 74,12 74,13 74,14 74,15
205
+output 7,23 = 73,0 73,1 73,2 73,3 73,4 73,5 73,6 73,7 73,8 73,9 73,10 73,11 73,12 73,13 73,14 73,15
206
+output 8,0 = 98,31 98,30 98,29 98,28 98,27 98,26 98,25 98,24 98,23 98,22 98,21 98,20 98,19 98,18 98,17 98,16
207
+output 8,1 = 99,31 99,30 99,29 99,28 99,27 99,26 99,25 99,24 99,23 99,22 99,21 99,20 99,19 99,18 99,17 99,16
208
+output 8,2 = 100,31 100,30 100,29 100,28 100,27 100,26 100,25 100,24 100,23 100,22 100,21 100,20 100,19 100,18 100,17 100,16
209
+output 8,3 = 101,31 101,30 101,29 101,28 101,27 101,26 101,25 101,24 101,23 101,22 101,21 101,20 101,19 101,18 101,17 101,16
210
+output 8,4 = 102,31 102,30 102,29 102,28 102,27 102,26 102,25 102,24 102,23 102,22 102,21 102,20 102,19 102,18 102,17 102,16
211
+output 8,5 = 103,31 103,30 103,29 103,28 103,27 103,26 103,25 103,24 103,23 103,22 103,21 103,20 103,19 103,18 103,17 103,16
212
+output 8,6 = 104,31 104,30 104,29 104,28 104,27 104,26 104,25 104,24 104,23 104,22 104,21 104,20 104,19 104,18 104,17 104,16
213
+output 8,7 = 105,31 105,30 105,29 105,28 105,27 105,26 105,25 105,24 105,23 105,22 105,21 105,20 105,19 105,18 105,17 105,16
214
+output 8,8 = 106,31 106,30 106,29 106,28 106,27 106,26 106,25 106,24 106,23 106,22 106,21 106,20 106,19 106,18 106,17 106,16
215
+output 8,9 = 107,31 107,30 107,29 107,28 107,27 107,26 107,25 107,24 107,23 107,22 107,21 107,20 107,19 107,18 107,17 107,16
216
+output 8,10 = 108,31 108,30 108,29 108,28 108,27 108,26 108,25 108,24 108,23 108,22 108,21 108,20 108,19 108,18 108,17 108,16
217
+output 8,11 = 109,31 109,30 109,29 109,28 109,27 109,26 109,25 109,24 109,23 109,22 109,21 109,20 109,19 109,18 109,17 109,16
218
+output 8,12 = 110,31 110,30 110,29 110,28 110,27 110,26 110,25 110,24 110,23 110,22 110,21 110,20 110,19 110,18 110,17 110,16
219
+output 8,13 = 111,31 111,30 111,29 111,28 111,27 111,26 111,25 111,24 111,23 111,22 111,21 111,20 111,19 111,18 111,17 111,16
220
+output 8,14 = 112,31 112,30 112,29 112,28 112,27 112,26 112,25 112,24 112,23 112,22 112,21 112,20 112,19 112,18 112,17 112,16
221
+output 8,15 = 113,31 113,30 113,29 113,28 113,27 113,26 113,25 113,24 113,23 113,22 113,21 113,20 113,19 113,18 113,17 113,16
222
+output 8,16 = 114,31 114,30 114,29 114,28 114,27 114,26 114,25 114,24 114,23 114,22 114,21 114,20 114,19 114,18 114,17 114,16
223
+output 8,17 = 115,31 115,30 115,29 115,28 115,27 115,26 115,25 115,24 115,23 115,22 115,21 115,20 115,19 115,18 115,17 115,16
224
+output 8,18 = 116,31 116,30 116,29 116,28 116,27 116,26 116,25 116,24 116,23 116,22 116,21 116,20 116,19 116,18 116,17 116,16
225
+output 8,19 = 117,31 117,30 117,29 117,28 117,27 117,26 117,25 117,24 117,23 117,22 117,21 117,20 117,19 117,18 117,17 117,16
226
+output 8,20 = 118,31 118,30 118,29 118,28 118,27 118,26 118,25 118,24 118,23 118,22 118,21 118,20 118,19 118,18 118,17 118,16
227
+output 8,21 = 119,31 119,30 119,29 119,28 119,27 119,26 119,25 119,24 119,23 119,22 119,21 119,20 119,19 119,18 119,17 119,16
228
+output 8,22 = 120,31 120,30 120,29 120,28 120,27 120,26 120,25 120,24 120,23 120,22 120,21 120,20 120,19 120,18 120,17 120,16
229
+output 8,23 = 121,31 121,30 121,29 121,28 121,27 121,26 121,25 121,24 121,23 121,22 121,21 121,20 121,19 121,18 121,17 121,16
230
+output 9,0 = 98,0 98,1 98,2 98,3 98,4 98,5 98,6 98,7 98,8 98,9 98,10 98,11 98,12 98,13 98,14 98,15
231
+output 9,1 = 99,0 99,1 99,2 99,3 99,4 99,5 99,6 99,7 99,8 99,9 99,10 99,11 99,12 99,13 99,14 99,15
232
+output 9,2 = 100,0 100,1 100,2 100,3 100,4 100,5 100,6 100,7 100,8 100,9 100,10 100,11 100,12 100,13 100,14 100,15
233
+output 9,3 = 101,0 101,1 101,2 101,3 101,4 101,5 101,6 101,7 101,8 101,9 101,10 101,11 101,12 101,13 101,14 101,15
234
+output 9,4 = 102,0 102,1 102,2 102,3 102,4 102,5 102,6 102,7 102,8 102,9 102,10 102,11 102,12 102,13 102,14 102,15
235
+output 9,5 = 103,0 103,1 103,2 103,3 103,4 103,5 103,6 103,7 103,8 103,9 103,10 103,11 103,12 103,13 103,14 103,15
236
+output 9,6 = 104,0 104,1 104,2 104,3 104,4 104,5 104,6 104,7 104,8 104,9 104,10 104,11 104,12 104,13 104,14 104,15
237
+output 9,7 = 105,0 105,1 105,2 105,3 105,4 105,5 105,6 105,7 105,8 105,9 105,10 105,11 105,12 105,13 105,14 105,15
238
+output 9,8 = 106,0 106,1 106,2 106,3 106,4 106,5 106,6 106,7 106,8 106,9 106,10 106,11 106,12 106,13 106,14 106,15
239
+output 9,9 = 107,0 107,1 107,2 107,3 107,4 107,5 107,6 107,7 107,8 107,9 107,10 107,11 107,12 107,13 107,14 107,15
240
+output 9,10 = 108,0 108,1 108,2 108,3 108,4 108,5 108,6 108,7 108,8 108,9 108,10 108,11 108,12 108,13 108,14 108,15
241
+output 9,11 = 109,0 109,1 109,2 109,3 109,4 109,5 109,6 109,7 109,8 109,9 109,10 109,11 109,12 109,13 109,14 109,15
242
+output 9,12 = 110,0 110,1 110,2 110,3 110,4 110,5 110,6 110,7 110,8 110,9 110,10 110,11 110,12 110,13 110,14 110,15
243
+output 9,13 = 111,0 111,1 111,2 111,3 111,4 111,5 111,6 111,7 111,8 111,9 111,10 111,11 111,12 111,13 111,14 111,15
244
+output 9,14 = 112,0 112,1 112,2 112,3 112,4 112,5 112,6 112,7 112,8 112,9 112,10 112,11 112,12 112,13 112,14 112,15
245
+output 9,15 = 113,0 113,1 113,2 113,3 113,4 113,5 113,6 113,7 113,8 113,9 113,10 113,11 113,12 113,13 113,14 113,15
246
+output 9,16 = 114,0 114,1 114,2 114,3 114,4 114,5 114,6 114,7 114,8 114,9 114,10 114,11 114,12 114,13 114,14 114,15
247
+output 9,17 = 115,0 115,1 115,2 115,3 115,4 115,5 115,6 115,7 115,8 115,9 115,10 115,11 115,12 115,13 115,14 115,15
248
+output 9,18 = 116,0 116,1 116,2 116,3 116,4 116,5 116,6 116,7 116,8 116,9 116,10 116,11 116,12 116,13 116,14 116,15
249
+output 9,19 = 117,0 117,1 117,2 117,3 117,4 117,5 117,6 117,7 117,8 117,9 117,10 117,11 117,12 117,13 117,14 117,15
250
+output 9,20 = 118,0 118,1 118,2 118,3 118,4 118,5 118,6 118,7 118,8 118,9 118,10 118,11 118,12 118,13 118,14 118,15
251
+output 9,21 = 119,0 119,1 119,2 119,3 119,4 119,5 119,6 119,7 119,8 119,9 119,10 119,11 119,12 119,13 119,14 119,15
252
+output 9,22 = 120,0 120,1 120,2 120,3 120,4 120,5 120,6 120,7 120,8 120,9 120,10 120,11 120,12 120,13 120,14 120,15
253
+output 9,23 = 121,0 121,1 121,2 121,3 121,4 121,5 121,6 121,7 121,8 121,9 121,10 121,11 121,12 121,13 121,14 121,15
254
+output 10,0 = 122,31 122,30 122,29 122,28 122,27 122,26 122,25 122,24 122,23 122,22 122,21 122,20 122,19 122,18 122,17 122,16
255
+output 10,1 = 123,31 123,30 123,29 123,28 123,27 123,26 123,25 123,24 123,23 123,22 123,21 123,20 123,19 123,18 123,17 123,16
256
+output 10,2 = 124,31 124,30 124,29 124,28 124,27 124,26 124,25 124,24 124,23 124,22 124,21 124,20 124,19 124,18 124,17 124,16
257
+output 10,3 = 125,31 125,30 125,29 125,28 125,27 125,26 125,25 125,24 125,23 125,22 125,21 125,20 125,19 125,18 125,17 125,16
258
+output 10,4 = 126,31 126,30 126,29 126,28 126,27 126,26 126,25 126,24 126,23 126,22 126,21 126,20 126,19 126,18 126,17 126,16
259
+output 10,5 = 127,31 127,30 127,29 127,28 127,27 127,26 127,25 127,24 127,23 127,22 127,21 127,20 127,19 127,18 127,17 127,16
260
+output 10,6 = 128,31 128,30 128,29 128,28 128,27 128,26 128,25 128,24 128,23 128,22 128,21 128,20 128,19 128,18 128,17 128,16
261
+output 10,7 = 129,31 129,30 129,29 129,28 129,27 129,26 129,25 129,24 129,23 129,22 129,21 129,20 129,19 129,18 129,17 129,16
262
+output 10,8 = 130,31 130,30 130,29 130,28 130,27 130,26 130,25 130,24 130,23 130,22 130,21 130,20 130,19 130,18 130,17 130,16
263
+output 10,9 = 131,31 131,30 131,29 131,28 131,27 131,26 131,25 131,24 131,23 131,22 131,21 131,20 131,19 131,18 131,17 131,16
264
+output 10,10 = 132,31 132,30 132,29 132,28 132,27 132,26 132,25 132,24 132,23 132,22 132,21 132,20 132,19 132,18 132,17 132,16
265
+output 10,11 = 133,31 133,30 133,29 133,28 133,27 133,26 133,25 133,24 133,23 133,22 133,21 133,20 133,19 133,18 133,17 133,16
266
+output 10,12 = 134,31 134,30 134,29 134,28 134,27 134,26 134,25 134,24 134,23 134,22 134,21 134,20 134,19 134,18 134,17 134,16
267
+output 10,13 = 135,31 135,30 135,29 135,28 135,27 135,26 135,25 135,24 135,23 135,22 135,21 135,20 135,19 135,18 135,17 135,16
268
+output 10,14 = 136,31 136,30 136,29 136,28 136,27 136,26 136,25 136,24 136,23 136,22 136,21 136,20 136,19 136,18 136,17 136,16
269
+output 10,15 = 137,31 137,30 137,29 137,28 137,27 137,26 137,25 137,24 137,23 137,22 137,21 137,20 137,19 137,18 137,17 137,16
270
+output 10,16 = 138,31 138,30 138,29 138,28 138,27 138,26 138,25 138,24 138,23 138,22 138,21 138,20 138,19 138,18 138,17 138,16
271
+output 10,17 = 139,31 139,30 139,29 139,28 139,27 139,26 139,25 139,24 139,23 139,22 139,21 139,20 139,19 139,18 139,17 139,16
272
+output 10,18 = 140,31 140,30 140,29 140,28 140,27 140,26 140,25 140,24 140,23 140,22 140,21 140,20 140,19 140,18 140,17 140,16
273
+output 10,19 = 141,31 141,30 141,29 141,28 141,27 141,26 141,25 141,24 141,23 141,22 141,21 141,20 141,19 141,18 141,17 141,16
274
+output 10,20 = 142,31 142,30 142,29 142,28 142,27 142,26 142,25 142,24 142,23 142,22 142,21 142,20 142,19 142,18 142,17 142,16
275
+output 10,21 = 143,31 143,30 143,29 143,28 143,27 143,26 143,25 143,24 143,23 143,22 143,21 143,20 143,19 143,18 143,17 143,16
276
+output 10,22 = 144,31 144,30 144,29 144,28 144,27 144,26 144,25 144,24 144,23 144,22 144,21 144,20 144,19 144,18 144,17 144,16
277
+output 10,23 = 145,31 145,30 145,29 145,28 145,27 145,26 145,25 145,24 145,23 145,22 145,21 145,20 145,19 145,18 145,17 145,16
278
+output 11,0 = 122,0 122,1 122,2 122,3 122,4 122,5 122,6 122,7 122,8 122,9 122,10 122,11 122,12 122,13 122,14 122,15
279
+output 11,1 = 123,0 123,1 123,2 123,3 123,4 123,5 123,6 123,7 123,8 123,9 123,10 123,11 123,12 123,13 123,14 123,15
280
+output 11,2 = 124,0 124,1 124,2 124,3 124,4 124,5 124,6 124,7 124,8 124,9 124,10 124,11 124,12 124,13 124,14 124,15
281
+output 11,3 = 125,0 125,1 125,2 125,3 125,4 125,5 125,6 125,7 125,8 125,9 125,10 125,11 125,12 125,13 125,14 125,15
282
+output 11,4 = 126,0 126,1 126,2 126,3 126,4 126,5 126,6 126,7 126,8 126,9 126,10 126,11 126,12 126,13 126,14 126,15
283
+output 11,5 = 127,0 127,1 127,2 127,3 127,4 127,5 127,6 127,7 127,8 127,9 127,10 127,11 127,12 127,13 127,14 127,15
284
+output 11,6 = 128,0 128,1 128,2 128,3 128,4 128,5 128,6 128,7 128,8 128,9 128,10 128,11 128,12 128,13 128,14 128,15
285
+output 11,7 = 129,0 129,1 129,2 129,3 129,4 129,5 129,6 129,7 129,8 129,9 129,10 129,11 129,12 129,13 129,14 129,15
286
+output 11,8 = 130,0 130,1 130,2 130,3 130,4 130,5 130,6 130,7 130,8 130,9 130,10 130,11 130,12 130,13 130,14 130,15
287
+output 11,9 = 131,0 131,1 131,2 131,3 131,4 131,5 131,6 131,7 131,8 131,9 131,10 131,11 131,12 131,13 131,14 131,15
288
+output 11,10 = 132,0 132,1 132,2 132,3 132,4 132,5 132,6 132,7 132,8 132,9 132,10 132,11 132,12 132,13 132,14 132,15
289
+output 11,11 = 133,0 133,1 133,2 133,3 133,4 133,5 133,6 133,7 133,8 133,9 133,10 133,11 133,12 133,13 133,14 133,15
290
+output 11,12 = 134,0 134,1 134,2 134,3 134,4 134,5 134,6 134,7 134,8 134,9 134,10 134,11 134,12 134,13 134,14 134,15
291
+output 11,13 = 135,0 135,1 135,2 135,3 135,4 135,5 135,6 135,7 135,8 135,9 135,10 135,11 135,12 135,13 135,14 135,15
292
+output 11,14 = 136,0 136,1 136,2 136,3 136,4 136,5 136,6 136,7 136,8 136,9 136,10 136,11 136,12 136,13 136,14 136,15
293
+output 11,15 = 137,0 137,1 137,2 137,3 137,4 137,5 137,6 137,7 137,8 137,9 137,10 137,11 137,12 137,13 137,14 137,15
294
+output 11,16 = 138,0 138,1 138,2 138,3 138,4 138,5 138,6 138,7 138,8 138,9 138,10 138,11 138,12 138,13 138,14 138,15
295
+output 11,17 = 139,0 139,1 139,2 139,3 139,4 139,5 139,6 139,7 139,8 139,9 139,10 139,11 139,12 139,13 139,14 139,15
296
+output 11,18 = 140,0 140,1 140,2 140,3 140,4 140,5 140,6 140,7 140,8 140,9 140,10 140,11 140,12 140,13 140,14 140,15
297
+output 11,19 = 141,0 141,1 141,2 141,3 141,4 141,5 141,6 141,7 141,8 141,9 141,10 141,11 141,12 141,13 141,14 141,15
298
+output 11,20 = 142,0 142,1 142,2 142,3 142,4 142,5 142,6 142,7 142,8 142,9 142,10 142,11 142,12 142,13 142,14 142,15
299
+output 11,21 = 143,0 143,1 143,2 143,3 143,4 143,5 143,6 143,7 143,8 143,9 143,10 143,11 143,12 143,13 143,14 143,15
300
+output 11,22 = 144,0 144,1 144,2 144,3 144,4 144,5 144,6 144,7 144,8 144,9 144,10 144,11 144,12 144,13 144,14 144,15
301
+output 11,23 = 145,0 145,1 145,2 145,3 145,4 145,5 145,6 145,7 145,8 145,9 145,10 145,11 145,12 145,13 145,14 145,15
302
+output 12,0 = 157,31 157,30 157,29 157,28 157,27 157,26 157,25 157,24 157,23 157,22 157,21 157,20 157,19 157,18 157,17 157,16 157,15 157,14 157,13 157,12 157,11 157,10 157,9 157,8 157,7 157,6 157,5 157,4 157,3 157,2 157,1 157,0 158,0 158,1 158,2 158,3 158,4 158,5 158,6 158,7 158,8 158,9 158,10 158,11 158,12 158,13 158,14 158,15 158,16 158,17 158,18 158,19 158,20 158,21 158,22 158,23 158,24 158,25 158,26 158,27 158,28 158,29 158,30 158,31
303
+output 12,1 = 155,31 155,30 155,29 155,28 155,27 155,26 155,25 155,24 155,23 155,22 155,21 155,20 155,19 155,18 155,17 155,16 155,15 155,14 155,13 155,12 155,11 155,10 155,9 155,8 155,7 155,6 155,5 155,4 155,3 155,2 155,1 155,0 156,0 156,1 156,2 156,3 156,4 156,5 156,6 156,7 156,8 156,9 156,10 156,11 156,12 156,13 156,14 156,15 156,16 156,17 156,18 156,19 156,20 156,21 156,22 156,23 156,24 156,25 156,26 156,27 156,28 156,29 156,30 156,31
304
+output 12,2 = 153,31 153,30 153,29 153,28 153,27 153,26 153,25 153,24 153,23 153,22 153,21 153,20 153,19 153,18 153,17 153,16 153,15 153,14 153,13 153,12 153,11 153,10 153,9 153,8 153,7 153,6 153,5 153,4 153,3 153,2 153,1 153,0 154,0 154,1 154,2 154,3 154,4 154,5 154,6 154,7 154,8 154,9 154,10 154,11 154,12 154,13 154,14 154,15 154,16 154,17 154,18 154,19 154,20 154,21 154,22 154,23 154,24 154,25 154,26 154,27 154,28 154,29 154,30 154,31
305
+output 12,3 = 151,31 151,30 151,29 151,28 151,27 151,26 151,25 151,24 151,23 151,22 151,21 151,20 151,19 151,18 151,17 151,16 151,15 151,14 151,13 151,12 151,11 151,10 151,9 151,8 151,7 151,6 151,5 151,4 151,3 151,2 151,1 151,0 152,0 152,1 152,2 152,3 152,4 152,5 152,6 152,7 152,8 152,9 152,10 152,11 152,12 152,13 152,14 152,15 152,16 152,17 152,18 152,19 152,20 152,21 152,22 152,23 152,24 152,25 152,26 152,27 152,28 152,29 152,30 152,31
306
+output 12,4 = 149,31 149,30 149,29 149,28 149,27 149,26 149,25 149,24 149,23 149,22 149,21 149,20 149,19 149,18 149,17 149,16 149,15 149,14 149,13 149,12 149,11 149,10 149,9 149,8 149,7 149,6 149,5 149,4 149,3 149,2 149,1 149,0 150,0 150,1 150,2 150,3 150,4 150,5 150,6 150,7 150,8 150,9 150,10 150,11 150,12 150,13 150,14 150,15 150,16 150,17 150,18 150,19 150,20 150,21 150,22 150,23 150,24 150,25 150,26 150,27 150,28 150,29 150,30 150,31
307
+output 12,5 = 147,31 147,30 147,29 147,28 147,27 147,26 147,25 147,24 147,23 147,22 147,21 147,20 147,19 147,18 147,17 147,16 147,15 147,14 147,13 147,12 147,11 147,10 147,9 147,8 147,7 147,6 147,5 147,4 147,3 147,2 147,1 147,0 148,0 148,1 148,2 148,3 148,4 148,5 148,6 148,7 148,8 148,9 148,10 148,11 148,12 148,13 148,14 148,15 148,16 148,17 148,18 148,19 148,20 148,21 148,22 148,23 148,24 148,25 148,26 148,27 148,28 148,29 148,30 148,31
308
+output 13,0 = 169,31 169,30 169,29 169,28 169,27 169,26 169,25 169,24 169,23 169,22 169,21 169,20 169,19 169,18 169,17 169,16 169,15 169,14 169,13 169,12 169,11 169,10 169,9 169,8 169,7 169,6 169,5 169,4 169,3 169,2 169,1 169,0 170,0 170,1 170,2 170,3 170,4 170,5 170,6 170,7 170,8 170,9 170,10 170,11 170,12 170,13 170,14 170,15 170,16 170,17 170,18 170,19 170,20 170,21 170,22 170,23 170,24 170,25 170,26 170,27 170,28 170,29 170,30 170,31
309
+output 13,1 = 167,31 167,30 167,29 167,28 167,27 167,26 167,25 167,24 167,23 167,22 167,21 167,20 167,19 167,18 167,17 167,16 167,15 167,14 167,13 167,12 167,11 167,10 167,9 167,8 167,7 167,6 167,5 167,4 167,3 167,2 167,1 167,0 168,0 168,1 168,2 168,3 168,4 168,5 168,6 168,7 168,8 168,9 168,10 168,11 168,12 168,13 168,14 168,15 168,16 168,17 168,18 168,19 168,20 168,21 168,22 168,23 168,24 168,25 168,26 168,27 168,28 168,29 168,30 168,31
310
+output 13,2 = 165,31 165,30 165,29 165,28 165,27 165,26 165,25 165,24 165,23 165,22 165,21 165,20 165,19 165,18 165,17 165,16 165,15 165,14 165,13 165,12 165,11 165,10 165,9 165,8 165,7 165,6 165,5 165,4 165,3 165,2 165,1 165,0 166,0 166,1 166,2 166,3 166,4 166,5 166,6 166,7 166,8 166,9 166,10 166,11 166,12 166,13 166,14 166,15 166,16 166,17 166,18 166,19 166,20 166,21 166,22 166,23 166,24 166,25 166,26 166,27 166,28 166,29 166,30 166,31
311
+output 13,3 = 163,31 163,30 163,29 163,28 163,27 163,26 163,25 163,24 163,23 163,22 163,21 163,20 163,19 163,18 163,17 163,16 163,15 163,14 163,13 163,12 163,11 163,10 163,9 163,8 163,7 163,6 163,5 163,4 163,3 163,2 163,1 163,0 164,0 164,1 164,2 164,3 164,4 164,5 164,6 164,7 164,8 164,9 164,10 164,11 164,12 164,13 164,14 164,15 164,16 164,17 164,18 164,19 164,20 164,21 164,22 164,23 164,24 164,25 164,26 164,27 164,28 164,29 164,30 164,31
312
+output 13,4 = 161,31 161,30 161,29 161,28 161,27 161,26 161,25 161,24 161,23 161,22 161,21 161,20 161,19 161,18 161,17 161,16 161,15 161,14 161,13 161,12 161,11 161,10 161,9 161,8 161,7 161,6 161,5 161,4 161,3 161,2 161,1 161,0 162,0 162,1 162,2 162,3 162,4 162,5 162,6 162,7 162,8 162,9 162,10 162,11 162,12 162,13 162,14 162,15 162,16 162,17 162,18 162,19 162,20 162,21 162,22 162,23 162,24 162,25 162,26 162,27 162,28 162,29 162,30 162,31
313
+output 13,5 = 159,31 159,30 159,29 159,28 159,27 159,26 159,25 159,24 159,23 159,22 159,21 159,20 159,19 159,18 159,17 159,16 159,15 159,14 159,13 159,12 159,11 159,10 159,9 159,8 159,7 159,6 159,5 159,4 159,3 159,2 159,1 159,0 160,0 160,1 160,2 160,3 160,4 160,5 160,6 160,7 160,8 160,9 160,10 160,11 160,12 160,13 160,14 160,15 160,16 160,17 160,18 160,19 160,20 160,21 160,22 160,23 160,24 160,25 160,26 160,27 160,28 160,29 160,30 160,31
314
+output 14,0 = 181,31 181,30 181,29 181,28 181,27 181,26 181,25 181,24 181,23 181,22 181,21 181,20 181,19 181,18 181,17 181,16 181,15 181,14 181,13 181,12 181,11 181,10 181,9 181,8 181,7 181,6 181,5 181,4 181,3 181,2 181,1 181,0 182,0 182,1 182,2 182,3 182,4 182,5 182,6 182,7 182,8 182,9 182,10 182,11 182,12 182,13 182,14 182,15 182,16 182,17 182,18 182,19 182,20 182,21 182,22 182,23 182,24 182,25 182,26 182,27 182,28 182,29 182,30 182,31
315
+output 14,1 = 179,31 179,30 179,29 179,28 179,27 179,26 179,25 179,24 179,23 179,22 179,21 179,20 179,19 179,18 179,17 179,16 179,15 179,14 179,13 179,12 179,11 179,10 179,9 179,8 179,7 179,6 179,5 179,4 179,3 179,2 179,1 179,0 180,0 180,1 180,2 180,3 180,4 180,5 180,6 180,7 180,8 180,9 180,10 180,11 180,12 180,13 180,14 180,15 180,16 180,17 180,18 180,19 180,20 180,21 180,22 180,23 180,24 180,25 180,26 180,27 180,28 180,29 180,30 180,31
316
+output 14,2 = 177,31 177,30 177,29 177,28 177,27 177,26 177,25 177,24 177,23 177,22 177,21 177,20 177,19 177,18 177,17 177,16 177,15 177,14 177,13 177,12 177,11 177,10 177,9 177,8 177,7 177,6 177,5 177,4 177,3 177,2 177,1 177,0 178,0 178,1 178,2 178,3 178,4 178,5 178,6 178,7 178,8 178,9 178,10 178,11 178,12 178,13 178,14 178,15 178,16 178,17 178,18 178,19 178,20 178,21 178,22 178,23 178,24 178,25 178,26 178,27 178,28 178,29 178,30 178,31
317
+output 14,3 = 175,31 175,30 175,29 175,28 175,27 175,26 175,25 175,24 175,23 175,22 175,21 175,20 175,19 175,18 175,17 175,16 175,15 175,14 175,13 175,12 175,11 175,10 175,9 175,8 175,7 175,6 175,5 175,4 175,3 175,2 175,1 175,0 176,0 176,1 176,2 176,3 176,4 176,5 176,6 176,7 176,8 176,9 176,10 176,11 176,12 176,13 176,14 176,15 176,16 176,17 176,18 176,19 176,20 176,21 176,22 176,23 176,24 176,25 176,26 176,27 176,28 176,29 176,30 176,31
318
+output 14,4 = 173,31 173,30 173,29 173,28 173,27 173,26 173,25 173,24 173,23 173,22 173,21 173,20 173,19 173,18 173,17 173,16 173,15 173,14 173,13 173,12 173,11 173,10 173,9 173,8 173,7 173,6 173,5 173,4 173,3 173,2 173,1 173,0 174,0 174,1 174,2 174,3 174,4 174,5 174,6 174,7 174,8 174,9 174,10 174,11 174,12 174,13 174,14 174,15 174,16 174,17 174,18 174,19 174,20 174,21 174,22 174,23 174,24 174,25 174,26 174,27 174,28 174,29 174,30 174,31
319
+output 14,5 = 171,31 171,30 171,29 171,28 171,27 171,26 171,25 171,24 171,23 171,22 171,21 171,20 171,19 171,18 171,17 171,16 171,15 171,14 171,13 171,12 171,11 171,10 171,9 171,8 171,7 171,6 171,5 171,4 171,3 171,2 171,1 171,0 172,0 172,1 172,2 172,3 172,4 172,5 172,6 172,7 172,8 172,9 172,10 172,11 172,12 172,13 172,14 172,15 172,16 172,17 172,18 172,19 172,20 172,21 172,22 172,23 172,24 172,25 172,26 172,27 172,28 172,29 172,30 172,31
320
+output 15,0 = 193,31 193,30 193,29 193,28 193,27 193,26 193,25 193,24 193,23 193,22 193,21 193,20 193,19 193,18 193,17 193,16 193,15 193,14 193,13 193,12 193,11 193,10 193,9 193,8 193,7 193,6 193,5 193,4 193,3 193,2 193,1 193,0 194,0 194,1 194,2 194,3 194,4 194,5 194,6 194,7 194,8 194,9 194,10 194,11 194,12 194,13 194,14 194,15 194,16 194,17 194,18 194,19 194,20 194,21 194,22 194,23 194,24 194,25 194,26 194,27 194,28 194,29 194,30 194,31
321
+output 15,1 = 191,31 191,30 191,29 191,28 191,27 191,26 191,25 191,24 191,23 191,22 191,21 191,20 191,19 191,18 191,17 191,16 191,15 191,14 191,13 191,12 191,11 191,10 191,9 191,8 191,7 191,6 191,5 191,4 191,3 191,2 191,1 191,0 192,0 192,1 192,2 192,3 192,4 192,5 192,6 192,7 192,8 192,9 192,10 192,11 192,12 192,13 192,14 192,15 192,16 192,17 192,18 192,19 192,20 192,21 192,22 192,23 192,24 192,25 192,26 192,27 192,28 192,29 192,30 192,31
322
+output 15,2 = 189,31 189,30 189,29 189,28 189,27 189,26 189,25 189,24 189,23 189,22 189,21 189,20 189,19 189,18 189,17 189,16 189,15 189,14 189,13 189,12 189,11 189,10 189,9 189,8 189,7 189,6 189,5 189,4 189,3 189,2 189,1 189,0 190,0 190,1 190,2 190,3 190,4 190,5 190,6 190,7 190,8 190,9 190,10 190,11 190,12 190,13 190,14 190,15 190,16 190,17 190,18 190,19 190,20 190,21 190,22 190,23 190,24 190,25 190,26 190,27 190,28 190,29 190,30 190,31
323
+output 15,3 = 187,31 187,30 187,29 187,28 187,27 187,26 187,25 187,24 187,23 187,22 187,21 187,20 187,19 187,18 187,17 187,16 187,15 187,14 187,13 187,12 187,11 187,10 187,9 187,8 187,7 187,6 187,5 187,4 187,3 187,2 187,1 187,0 188,0 188,1 188,2 188,3 188,4 188,5 188,6 188,7 188,8 188,9 188,10 188,11 188,12 188,13 188,14 188,15 188,16 188,17 188,18 188,19 188,20 188,21 188,22 188,23 188,24 188,25 188,26 188,27 188,28 188,29 188,30 188,31
324
+output 15,4 = 185,31 185,30 185,29 185,28 185,27 185,26 185,25 185,24 185,23 185,22 185,21 185,20 185,19 185,18 185,17 185,16 185,15 185,14 185,13 185,12 185,11 185,10 185,9 185,8 185,7 185,6 185,5 185,4 185,3 185,2 185,1 185,0 186,0 186,1 186,2 186,3 186,4 186,5 186,6 186,7 186,8 186,9 186,10 186,11 186,12 186,13 186,14 186,15 186,16 186,17 186,18 186,19 186,20 186,21 186,22 186,23 186,24 186,25 186,26 186,27 186,28 186,29 186,30 186,31
325
+output 15,5 = 183,31 183,30 183,29 183,28 183,27 183,26 183,25 183,24 183,23 183,22 183,21 183,20 183,19 183,18 183,17 183,16 183,15 183,14 183,13 183,12 183,11 183,10 183,9 183,8 183,7 183,6 183,5 183,4 183,3 183,2 183,1 183,0 184,0 184,1 184,2 184,3 184,4 184,5 184,6 184,7 184,8 184,9 184,10 184,11 184,12 184,13 184,14 184,15 184,16 184,17 184,18 184,19 184,20 184,21 184,22 184,23 184,24 184,25 184,26 184,27 184,28 184,29 184,30 184,31
... ...
@@ -0,0 +1,27 @@
1
+# FlexiPix configuration file
2
+
3
+# the address to bind the local socket to
4
+#  - the FlexiPix network 10.70.80.0/16 must be reachable from this address
5
+bindAddr = 0.0.0.0:0
6
+
7
+# the size of the display
8
+#  - <width>,<height> in pixels
9
+size = 8,8
10
+
11
+# this line adds a new distributor
12
+#  - the general format is: distributor <distributor number> = <number of outputs>,<number of pixel per output>
13
+distributor 0 = 6,64
14
+
15
+# those lines introduce a mapping between the channel values in the video and the values transmitted to the display
16
+#  - mapping is done per distributor and applies to all pixels connected to it
17
+#  - the general format is: mapping <distributor number> (red|green|blue) = <base> <factor> <gamma>
18
+#  - the mapping formula is: <display value> := <base> + <factor> * <original value> ^ (1 / <gamma>)
19
+mapping 0 red = 0.0 1.0 1.0
20
+mapping 0 green = 0.0 1.0 1.0
21
+mapping 0 blue = 0.0 1.0 1.0
22
+
23
+# these lines specify the logical positions of the pixels at an output in movie coordinates
24
+#  - the general format is: output <distributor number>,<output number> = <pixel x>,<pixel y> ...
25
+#  - the order of the pixels is the order they are connected in the chain
26
+output 0,0 = 0,0 1,0 2,0 3,0 4,0 5,0 6,0 7,0 7,1 6,1 5,1 4,1 3,1 2,1 1,1 0,1 0,2 1,2 2,2 3,2 4,2 5,2 6,2 7,2 7,3 6,3 5,3 4,3 3,3 2,3 1,3 0,3 0,4 1,4 2,4 3,4 4,4 5,4 6,4 7,4 7,5 6,5 5,5 4,5 3,5 2,5 1,5 0,5 0,6 1,6 2,6 3,6 4,6 5,6 6,6 7,6 7,7 6,7 5,7 4,7 3,7 2,7 1,7 0,7
27
+
... ...
@@ -0,0 +1,92 @@
1
+#include <stdarg.h>
2
+#include <stdio.h>
3
+#include <unistd.h>
4
+
5
+#include <flexipix/flexipix.h>
6
+
7
+/* just an exmaple for some data */
8
+typedef struct userdata_s {
9
+  int i;
10
+  float f;
11
+  char c;
12
+} userdata_t;
13
+
14
+/* callback function called during display creation,
15
+   the p_ctx parameter is the userdata supplied in the call
16
+   to flp_display_create() */
17
+void msg(void *p_ctx, flp_msg_type_t type, const char *fmt, ...)
18
+{
19
+  userdata_t *p_userdata = (userdata_t *)p_ctx;
20
+  va_list va;
21
+
22
+  printf("msg (%d %f %c): ",
23
+         p_userdata->i, p_userdata->f,
24
+         p_userdata->c); /* make use of the userdata */
25
+
26
+  /* type tells if the message is an error, a warning or an information */
27
+  switch (type) {
28
+    case flp_msg_type_err:
29
+      printf("ERROR: ");
30
+      break;
31
+    case flp_msg_type_warn:
32
+      printf("WARNING: ");
33
+      break;
34
+    case flp_msg_type_info:
35
+      printf("INFORMATION: ");
36
+      break;
37
+  }
38
+
39
+  /* fmt is a printf-style format string,
40
+     the arguments are passed exactly as for printf */
41
+  va_start(va, fmt);
42
+  vprintf(fmt, va);
43
+  va_end(va);
44
+}
45
+
46
+int main(int argc, char *argv[])
47
+{
48
+  const char *config;
49
+  userdata_t userdata = { 42, 42.0, '!' }; /* just an exmaple */
50
+  flp_display_t *p_display;
51
+  unsigned int width, height, i;
52
+  flp_u8_t white[3] = { 255, 255, 255 };
53
+
54
+  if (argc < 2) {
55
+    printf("usage: %s <config.flp>\n", argv[0]);
56
+    return -1;
57
+  }
58
+  config = argv[1];
59
+
60
+  /* create a display, take the configuration from a file,
61
+     deliver messages to the callback function msg(),
62
+     the last parameter is passed as first parameter to msg()
63
+     and can be used to supply some user defined data */
64
+  p_display = flp_display_create(config, msg, (void *)&userdata);
65
+  if (!p_display) {
66
+    printf("could not create display\n");
67
+    return -1;
68
+  }
69
+
70
+  flp_display_get_size(p_display, &width, &height);
71
+  printf("width:  %5u\nheight: %5u\n", width, height);
72
+
73
+  printf("blink\n");
74
+  for (i = 0; i < 5; ++i) {
75
+
76
+    printf("on\n");
77
+    flp_display_data(p_display, white, 0, 0, 0, 0, width, height);
78
+    flp_display_send(p_display);
79
+    usleep(100000);
80
+
81
+    printf("off\n");
82
+    flp_display_data_clear(p_display);
83
+    flp_display_send(p_display);
84
+    usleep(500000);
85
+
86
+  } /* for (i ...) */
87
+  printf("done\n");
88
+
89
+  flp_display_free(p_display);
90
+  return 0;
91
+}
92
+
... ...
@@ -0,0 +1,130 @@
1
+#include <stdarg.h>
2
+#include <stdio.h>
3
+#include <stdlib.h>
4
+
5
+#include <flexipix/flexipix.h>
6
+
7
+/* just an exmaple for some data */
8
+typedef struct userdata_s {
9
+  int i;
10
+  float f;
11
+  char c;
12
+} userdata_t;
13
+
14
+/* callback function called during display creation,
15
+   the p_ctx parameter is the userdata supplied in the call
16
+   to flp_display_create() */
17
+void msg(void *p_ctx, flp_msg_type_t type, const char *fmt, ...)
18
+{
19
+  userdata_t *p_userdata = (userdata_t *)p_ctx;
20
+  va_list va;
21
+
22
+  printf("msg (%d %f %c): ",
23
+         p_userdata->i, p_userdata->f,
24
+         p_userdata->c); /* make use of the userdata */
25
+
26
+  /* type tells if the message is an error, a warning or an information */
27
+  switch (type) {
28
+    case flp_msg_type_err:
29
+      printf("ERROR: ");
30
+      break;
31
+    case flp_msg_type_warn:
32
+      printf("WARNING: ");
33
+      break;
34
+    case flp_msg_type_info:
35
+      printf("INFORMATION: ");
36
+      break;
37
+  }
38
+
39
+  /* fmt is a printf-style format string,
40
+     the arguments are passed exactly as for printf */
41
+  va_start(va, fmt);
42
+  vprintf(fmt, va);
43
+  va_end(va);
44
+}
45
+
46
+int main(int argc, char *argv[])
47
+{
48
+  const char *config;
49
+  userdata_t userdata = { 42, 42.0, '!' }; /* just an exmaple */
50
+  flp_displayer_t *p_displayer;
51
+  unsigned int width, height, i, j, c, x, y;
52
+  flp_u8_t *p_image;
53
+  char line[64];
54
+
55
+  if (argc < 2) {
56
+    printf("usage: %s <config.flp>\n", argv[0]);
57
+    return -1;
58
+  }
59
+  config = argv[1];
60
+
61
+  /* create a displayer that manages a display in the background
62
+     and takes care that data is sent periodically to the distributors
63
+     to prevent that the pixels turn off after a timeout,
64
+     take the configuration from a file,
65
+     deliver messages to the callback function msg(),
66
+     the last parameter is passed as first parameter to msg()
67
+     and can be used to supply some user defined data */
68
+  p_displayer = flp_displayer_create(config, msg, (void *)&userdata);
69
+  if (!p_displayer) {
70
+    printf("could not create displayer\n");
71
+    return -1;
72
+  }
73
+
74
+  flp_displayer_get_size(p_displayer, &width, &height);
75
+  printf("width:  %5u\nheight: %5u\n", width, height);
76
+
77
+  /* create a buffer for the image */
78
+  p_image = (flp_u8_t *)malloc(height * width * 3);
79
+  if (!p_image) {
80
+    flp_displayer_free(p_displayer);
81
+    printf("out of memory\n");
82
+    return -1;
83
+  }
84
+
85
+  /* make displayer start sending data to distributors */
86
+  flp_displayer_activate(p_displayer);
87
+
88
+  /* The following loop will spent most waiting for user input.
89
+     While it is waiting, the displayer will periodically sent
90
+     data to the distributors. */
91
+
92
+  printf("enter something, \".\" for end\n");
93
+  while (1) {
94
+
95
+    /* wait for user input */
96
+    printf("> ");
97
+    scanf("%50s", line);
98
+    if (line[0] == 0 || (line[0] == '.' && line[1] == 0))
99
+      break;
100
+
101
+    /* create some image from entered text
102
+       (this is just creating some image out of the entered data,
103
+        it does not do any useful processing) */
104
+    i = 0;
105
+    j = 0;
106
+    for (y = 0; y < height; ++y) {
107
+      for (x = 0; x < width; ++x) {
108
+        for (c = 0; c < 3; ++c) {
109
+          p_image[i++] = (line[j++] & 0xF) * 0x11;
110
+          if (line[j] == 0)
111
+            j = 0;
112
+        }
113
+      }
114
+    }
115
+
116
+    /* set new image */
117
+    flp_displayer_data(p_displayer, p_image,
118
+                       3, /* consecutive pixels are 3 bytes apart */
119
+                       width*3, /* consecutive lines are width*3 bytes apart */
120
+                       0, 0, width, height);
121
+    /* force sending data to distris immediately */
122
+    flp_displayer_send(p_displayer);
123
+
124
+  } /* while (1) */
125
+
126
+  free(p_image);
127
+  flp_displayer_free(p_displayer);
128
+  return 0;
129
+}
130
+
... ...
@@ -0,0 +1,102 @@
1
+#include <stdarg.h>
2
+#include <stdio.h>
3
+#include <stdlib.h>
4
+
5
+#include <flexipix/flexipix.h>
6
+
7
+/* just an exmaple for some data */
8
+typedef struct userdata_s {
9
+  int i;
10
+  float f;
11
+  char c;
12
+} userdata_t;
13
+
14
+/* callback function called during display creation,
15
+   the p_ctx parameter is the userdata supplied in the call
16
+   to flp_display_create() */
17
+void msg(void *p_ctx, flp_msg_type_t type, const char *fmt, ...)
18
+{
19
+  userdata_t *p_userdata = (userdata_t *)p_ctx;
20
+  va_list va;
21
+
22
+  printf("msg (%d %f %c): ",
23
+         p_userdata->i, p_userdata->f,
24
+         p_userdata->c); /* make use of the userdata */
25
+
26
+  /* type tells if the message is an error, a warning or an information */
27
+  switch (type) {
28
+    case flp_msg_type_err:
29
+      printf("ERROR: ");
30
+      break;
31
+    case flp_msg_type_warn:
32
+      printf("WARNING: ");
33
+      break;
34
+    case flp_msg_type_info:
35
+      printf("INFORMATION: ");
36
+      break;
37
+  }
38
+
39
+  /* fmt is a printf-style format string,
40
+     the arguments are passed exactly as for printf */
41
+  va_start(va, fmt);
42
+  vprintf(fmt, va);
43
+  va_end(va);
44
+}
45
+
46
+int main(int argc, char *argv[])
47
+{
48
+  const char *config;
49
+  userdata_t userdata = { 42, 42.0, '!' }; /* just an exmaple */
50
+  flp_display_t *p_display;
51
+  unsigned int width, height, i, x, y;
52
+  flp_u8_t *p_image;
53
+
54
+  if (argc < 2) {
55
+    printf("usage: %s <config.flp>\n", argv[0]);
56
+    return -1;
57
+  }
58
+  config = argv[1];
59
+
60
+  /* create a display, take the configuration from a file,
61
+     deliver messages to the callback function msg(),
62
+     the last parameter is passed as first parameter to msg()
63
+     and can be used to supply some user defined data */
64
+  p_display = flp_display_create(config, msg, (void *)&userdata);
65
+  if (!p_display) {
66
+    printf("could not create display\n");
67
+    return -1;
68
+  }
69
+
70
+  flp_display_get_size(p_display, &width, &height);
71
+  printf("width:  %5u\nheight: %5u\n", width, height);
72
+
73
+  /* create an image with a nice fade:
74
+     black to red from left to right,
75
+     black to green from top to bottom */
76
+  p_image = (flp_u8_t *)malloc(height * width * 3);
77
+  if (!p_image) {
78
+    flp_display_free(p_display);
79
+    printf("out of memory\n");
80
+    return -1;
81
+  }
82
+  i = 0;
83
+  for (y = 0; y < height; ++y) {
84
+    for (x = 0; x < width; ++x) {
85
+      p_image[i++] = (flp_u8_t)(255.0*x/(width-1)+0.5); /* red */
86
+      p_image[i++] = (flp_u8_t)(255.0*y/(height-1)+0.5); /* green */
87
+      p_image[i++] = 0; /* no blue */
88
+    }
89
+  }
90
+
91
+  /* output image */
92
+  flp_display_data(p_display, p_image,
93
+                   3, /* consecutive pixels are 3 bytes apart */
94
+                   width*3, /* consecutive lines are width*3 bytes apart */
95
+                   0, 0, width, height);
96
+  flp_display_send(p_display);
97
+
98
+  free(p_image);
99
+  flp_display_free(p_display);
100
+  return 0;
101
+}
102
+
... ...
@@ -0,0 +1,100 @@
1
+/*
2
+ * FlexiPix library
3
+ * !version: 1.0.0! !date: 2010-07-31!
4
+ *
5
+ * Copyright 2010 Stefan Schuermans <stefan schuermans info>
6
+ *
7
+ * This program is free software: you can redistribute it and/or modify
8
+ * it under the terms of the GNU General Public License as published by
9
+ * the Free Software Foundation, version 3 of the License.
10
+ *
11
+ *
12
+ * This program is distributed in the hope that it will be useful,
13
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
+ * GNU General Public License for more details.
16
+ *
17
+ * You should have received a copy of the GNU Lesser General Public License
18
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
19
+ */
20
+
21
+#ifndef FLP_INC_DISPLAY_H
22
+#define FLP_INC_DISPLAY_H
23
+
24
+#include <flexipix/msg.h>
25
+#include <flexipix/types.h>
26
+
27
+/**
28
+ * \brief create a new FlexiPix display
29
+ *
30
+ * \param[in] sz_config_file name of config file to read
31
+ * \param[in] p_msg_func message callback function or NULL
32
+ * \param[in] p_msg_ctx user context for message callback
33
+ * \return pointer to new FlexiPix display on success
34
+ *         or NULL on error
35
+ */
36
+flp_display_t *flp_display_create(const char *sz_config_file,
37
+                                  flp_msg_func_p_t p_msg_func,
38
+                                  void *p_msg_ctx);
39
+
40
+/**
41
+ * \brief free a FlexiPix display
42
+ *
43
+ * \param[in] p_display pointer to FlexiPix display
44
+ */
45
+void flp_display_free(flp_display_t *p_display);
46
+
47
+/**
48
+ * \brief get size of display
49
+ *
50
+ * \param[in] p_display pointer to FlexiPix display
51
+ * \param[out] p_width width of display
52
+ * \param[out] p_height height of display
53
+ */
54
+void flp_display_get_size(flp_display_t *p_display,
55
+                          unsigned int *p_width, unsigned int *p_height);
56
+
57
+/**
58
+ * \brief clear image data to output on FlexiPix display
59
+ *
60
+ * clears the stored image data,
61
+ * stored image data can later be sent to the distributors using
62
+ * flp_display_send()
63
+ *
64
+ * \param[in] p_display pointer to FlexiPix display
65
+ */
66
+void flp_display_data_clear(flp_display_t *p_display);
67
+
68
+/**
69
+ * \brief set image data to output on FlexiPix display
70
+ *
71
+ * updates (part of) the stored image data,
72
+ * stored image data can later be sent to the distributors using
73
+ * flp_display_send()
74
+ *
75
+ * \param[in] p_display pointer to FlexiPix display
76
+ * \param[in] p_data pointer to rectangular section of image data,
77
+ *                   pixels need to be in R8G8B8 format
78
+ * \param[in] stride_x stride between two pixels in X direction
79
+ * \param[in] stride_y stride between two pixels in Y direction
80
+ * \param[in] x X coordinate of left side of rectangular area
81
+ * \param[in] y Y coordinate of top side of rectangular area
82
+ * \param[in] width with of rectangular area
83
+ * \param[in] height height of rectangular area
84
+ */
85
+void flp_display_data(flp_display_t *p_display, flp_u8_t *p_data,
86
+                      int stride_x, int stride_y,
87
+                      unsigned int x, unsigned int y,
88
+                      unsigned int width, unsigned int height);
89
+
90
+/**
91
+ * \brief send image data to distributors
92
+ *
93
+ * sends the currently stored image data to all configured distributors
94
+ *
95
+ * \param[in] p_display pointer to FlexiPix display
96
+ */
97
+void flp_display_send(flp_display_t *p_display);
98
+
99
+#endif /* #ifndef FLP_INC_DISPLAY_H */
100
+
... ...
@@ -0,0 +1,125 @@
1
+/*
2
+ * FlexiPix library
3
+ * !version: 1.0.0! !date: 2010-07-31!
4
+ *
5
+ * Copyright 2010 Stefan Schuermans <stefan schuermans info>
6
+ *
7
+ * This program is free software: you can redistribute it and/or modify
8
+ * it under the terms of the GNU General Public License as published by
9
+ * the Free Software Foundation, version 3 of the License.
10
+ *
11
+ *
12
+ * This program is distributed in the hope that it will be useful,
13
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
+ * GNU General Public License for more details.
16
+ *
17
+ * You should have received a copy of the GNU Lesser General Public License
18
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
19
+ */
20
+
21
+#ifndef FLP_INC_DISPLAYER_H
22
+#define FLP_INC_DISPLAYER_H
23
+
24
+#include <flexipix/msg.h>
25
+#include <flexipix/types.h>
26
+
27
+/**
28
+ * \brief create a new FlexiPix displayer
29
+ *
30
+ * A displayer manages a display and ensures that a the current
31
+ * image data is sent often enough to the distributors so
32
+ * that the pixels do detect a timeout and turn off automatically.
33
+ * The displayer uses a thread to do this.
34
+ * Initially, the new displayer is inactive and has to be activated
35
+ * using flp_displayer_activate().
36
+ *
37
+ * \param[in] sz_config_file name of config file to read
38
+ * \param[in] p_msg_func message callback function or NULL
39
+ * \param[in] p_msg_ctx user context for message callback
40
+ * \return pointer to new FlexiPix displayer on success
41
+ *         or NULL on error
42
+ */
43
+flp_displayer_t *flp_displayer_create(const char *sz_config_file,
44
+                                      flp_msg_func_p_t p_msg_func,
45
+                                      void *p_msg_ctx);
46
+
47
+/**
48
+ * \brief free a FlexiPix displayer
49
+ *
50
+ * \param[in] p_displayer pointer to FlexiPix displayer
51
+ */
52
+void flp_displayer_free(flp_displayer_t *p_displayer);
53
+
54
+/**
55
+ * \brief get size of display managed by displayer
56
+ *
57
+ * \param[in] p_displayer pointer to FlexiPix displayer
58
+ * \param[out] p_width width of display
59
+ * \param[out] p_height height of display
60
+ */
61
+void flp_displayer_get_size(flp_displayer_t *p_displayer,
62
+                            unsigned int *p_width, unsigned int *p_height);
63
+
64
+/**
65
+ * \brief activate the displayer
66
+ *
67
+ * set the displayer to active, i.e. make it send image data
68
+ * to the distributors automatically,
69
+ * this function might trigger sending of data if the last
70
+ * sending time was too long ago
71
+ *
72
+ * \param[in] p_displayer pointer to FlexiPix displayer
73
+ */
74
+void flp_displayer_activate(flp_displayer_t *p_displayer);
75
+
76
+/**
77
+ * \brief deactivate the displayer
78
+ *
79
+ * set the displayer to deactive, i.e. prevent it from sening image
80
+ * data to the distributors automatically,
81
+ *
82
+ * \param[in] p_displayer pointer to FlexiPix displayer
83
+ */
84
+void flp_displayer_deactivate(flp_displayer_t *p_displayer);
85
+
86
+/**
87
+ * \brief clear image data to output on FlexiPix displayer
88
+ *
89
+ * clears the stored image data
90
+ *
91
+ * \param[in] p_displayer pointer to FlexiPix displayer
92
+ */
93
+void flp_displayer_data_clear(flp_displayer_t *p_displayer);
94
+
95
+/**
96
+ * \brief set image data to output on FlexiPix display
97
+ *
98
+ * updates (part of) the stored image data
99
+ *
100
+ * \param[in] p_displayer pointer to FlexiPix displayer
101
+ * \param[in] p_data pointer to rectangular section of image data,
102
+ *                   pixels need to be in R8G8B8 format
103
+ * \param[in] stride_x stride between two pixels in X direction
104
+ * \param[in] stride_y stride between two pixels in Y direction
105
+ * \param[in] x X coordinate of left side of rectangular area
106
+ * \param[in] y Y coordinate of top side of rectangular area
107
+ * \param[in] width with of rectangular area
108
+ * \param[in] height height of rectangular area
109
+ */
110
+void flp_displayer_data(flp_displayer_t *p_displayer, flp_u8_t *p_data,
111
+                        int stride_x, int stride_y,
112
+                        unsigned int x, unsigned int y,
113
+                        unsigned int width, unsigned int height);
114
+
115
+/**
116
+ * \brief trigger immediate sending of new image data to distributors
117
+ *
118
+ * this only works if the displayer is active
119
+ *
120
+ * \param[in] p_displayer pointer to FlexiPix displayer
121
+ */
122
+void flp_displayer_send(flp_displayer_t *p_displayer);
123
+
124
+#endif /* #ifndef FLP_INC_DISPLAYER_H */
125
+
... ...
@@ -0,0 +1,31 @@
1
+/*
2
+ * FlexiPix library
3
+ * !version: 1.0.0! !date: 2010-07-31!
4
+ *
5
+ * Copyright 2010 Stefan Schuermans <stefan schuermans info>
6
+ *
7
+ * This program is free software: you can redistribute it and/or modify
8
+ * it under the terms of the GNU General Public License as published by
9
+ * the Free Software Foundation, version 3 of the License.
10
+ *
11
+ *
12
+ * This program is distributed in the hope that it will be useful,
13
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
+ * GNU General Public License for more details.
16
+ *
17
+ * You should have received a copy of the GNU Lesser General Public License
18
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
19
+ */
20
+
21
+#ifndef FLP_INC_FLEXIPIX_H
22
+#define FLP_INC_FLEXIPIX_H
23
+
24
+#include <flexipix/display.h>
25
+#include <flexipix/displayer.h>
26
+#include <flexipix/info.h>
27
+#include <flexipix/msg.h>
28
+#include <flexipix/types.h>
29
+
30
+#endif /* #ifndef FLP_INC_FLEXIPIX_H */
31
+
... ...
@@ -0,0 +1,35 @@
1
+/*
2
+ * FlexiPix library
3
+ * !version: 1.0.0! !date: 2010-07-31!
4
+ *
5
+ * Copyright 2010 Stefan Schuermans <stefan schuermans info>
6
+ *
7
+ * This program is free software: you can redistribute it and/or modify
8
+ * it under the terms of the GNU General Public License as published by
9
+ * the Free Software Foundation, version 3 of the License.
10
+ *
11
+ *
12
+ * This program is distributed in the hope that it will be useful,
13
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
+ * GNU General Public License for more details.
16
+ *
17
+ * You should have received a copy of the GNU Lesser General Public License
18
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
19
+ */
20
+
21
+#ifndef FLP_INC_INFO_H
22
+#define FLP_INC_INFO_H
23
+
24
+/**
25
+ * \brief get version of the library
26
+ *
27
+ * \param[out] p_major major version
28
+ * \param[out] p_minor minor version
29
+ * \param[out] p_revision revision number
30
+ */
31
+void flp_get_version(unsigned int *p_major, unsigned int *p_minor,
32
+                     unsigned int *p_revision);
33
+
34
+#endif /* #ifndef FLP_INC_INC_H */
35
+
... ...
@@ -0,0 +1,47 @@
1
+/*
2
+ * FlexiPix library
3
+ * !version: 1.0.0! !date: 2010-07-31!
4
+ *
5
+ * Copyright 2010 Stefan Schuermans <stefan schuermans info>
6
+ *
7
+ * This program is free software: you can redistribute it and/or modify
8
+ * it under the terms of the GNU General Public License as published by
9
+ * the Free Software Foundation, version 3 of the License.
10
+ *
11
+ *
12
+ * This program is distributed in the hope that it will be useful,
13
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
+ * GNU General Public License for more details.
16
+ *
17
+ * You should have received a copy of the GNU Lesser General Public License
18
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
19
+ */
20
+
21
+#ifndef FLP_INC_MSG_H
22
+#define FLP_INC_MSG_H
23
+
24
+/** message type */
25
+typedef enum flp_msg_type_s {
26
+  flp_msg_type_err, /**< error message */
27
+  flp_msg_type_warn, /**< warning message */
28
+  flp_msg_type_info, /**< information message */
29
+} flp_msg_type_t;
30
+
31
+/**
32
+ * \brief type for message callback function
33
+ *
34
+ * \param[in] p_ctx user context
35
+ * \param[in] type message type
36
+ * \param[in] sz_fmt format string
37
+ * \param[in] ... arguments for format string
38
+ */
39
+typedef void (*flp_msg_func_p_t)(void *p_ctx, flp_msg_type_t type,
40
+                                 const char *sz_fmt, ...)
41
+#ifdef __GNUC__
42
+                              __attribute__ ((format (printf, 3, 4)))
43
+#endif
44
+                               ;
45
+
46
+#endif /* #ifndef FLP_INC_MSG_H */
47
+
... ...
@@ -0,0 +1,40 @@
1
+/*
2
+ * FlexiPix library
3
+ * !version: 1.0.0! !date: 2010-07-31!
4
+ *
5
+ * Copyright 2010 Stefan Schuermans <stefan schuermans info>
6
+ *
7
+ * This program is free software: you can redistribute it and/or modify
8
+ * it under the terms of the GNU General Public License as published by
9
+ * the Free Software Foundation, version 3 of the License.
10
+ *
11
+ *
12
+ * This program is distributed in the hope that it will be useful,
13
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
+ * GNU General Public License for more details.
16
+ *
17
+ * You should have received a copy of the GNU Lesser General Public License
18
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
19
+ */
20
+
21
+#ifndef FLP_INC_TYPES_H
22
+#define FLP_INC_TYPES_H
23
+
24
+#include <stdint.h>
25
+
26
+/** a single byte */
27
+typedef uint8_t flp_u8_t;
28
+
29
+/** a FlexiPix display */
30
+typedef struct flp_display_s flp_display_t;
31
+
32
+/**
33
+ * \brief a displayer
34
+ *
35
+ * sends pictures to a display whenever the maximum interval expired
36
+ */
37
+typedef struct flp_displayer_s flp_displayer_t;
38
+
39
+#endif /* #ifndef FLP_INC_TYPES_H */
40
+
... ...
@@ -0,0 +1,118 @@
1
+/*
2
+ * FlexiPix library
3
+ * !version: 1.0.0! !date: 2010-07-31!
4
+ *
5
+ * Copyright 2010 Stefan Schuermans <stefan schuermans info>
6
+ *
7
+ * This program is free software: you can redistribute it and/or modify
8
+ * it under the terms of the GNU General Public License as published by
9
+ * the Free Software Foundation, version 3 of the License.
10
+ *
11
+ *
12
+ * This program is distributed in the hope that it will be useful,
13
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
+ * GNU General Public License for more details.
16
+ *
17
+ * You should have received a copy of the GNU Lesser General Public License
18
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
19
+ */
20
+
21
+#ifndef FLP_CONFIG_H
22
+#define FLP_CONFIG_H
23
+
24
+#include <flexipix/msg.h>
25
+#include <flexipix/types.h>
26
+#include <intern/types.h>
27
+
28
+/** context information for processing config file */
29
+typedef struct flp_config_ctx_s
30
+{
31
+  flp_display_t *p_display;    /**< display to configure */
32
+  unsigned int line_no;        /**< current line in config file */
33
+  flp_msg_func_p_t p_msg_func; /**< message callback function or NULL */
34
+  void *p_msg_ctx;             /**< user context for message callback */
35
+} flp_config_ctx_t;
36
+
37
+/**
38
+ * \brief process distributor from config file
39
+ *
40
+ * \param[in,out] p_ctx context information
41
+ * \param[in] p_setting_part2 second half of setting to process
42
+ * \param[in] p_value value of setting
43
+ * \return 0 in case of success, -1 in case of error
44
+ */
45
+int flp_config_proc_distri(flp_config_ctx_t *p_ctx, char *p_setting_part2,
46
+                           char *value);
47
+
48
+/**
49
+ * \brief process mapping from config file
50
+ *
51
+ * \param[in,out] p_ctx context information
52
+ * \param[in] p_setting_part2 second half of setting to process
53
+ * \param[in] p_value value of setting
54
+ * \return 0 in case of success, -1 in case of error
55
+ */
56
+int flp_config_proc_mapping(flp_config_ctx_t *p_ctx, char *p_setting_part2,
57
+                            char *value);
58
+
59
+/**
60
+ * \brief process pixel from config file
61
+ *
62
+ * \param[in,out] p_ctx context information
63
+ * \param[in] sz_pixel text of pixel to process
64
+ * \param[in] distri number of distributor
65
+ * \param[in] out number of output
66
+ * \param[in] pix number of pixel
67
+ * \return 0 in case of success, -1 in case of error
68
+ */
69
+int flp_config_proc_pixel(flp_config_ctx_t *p_ctx, char *sz_pixel,
70
+                          unsigned int distri, unsigned int out,
71
+                          unsigned int pix);
72
+
73
+/**
74
+ * \brief process output from config file
75
+ *
76
+ * \param[in,out] p_ctx context information
77
+ * \param[in] p_setting_part2 second half of setting to process
78
+ * \param[in] p_value value of setting
79
+ * \return 0 in case of success, -1 in case of error
80
+ */
81
+int flp_config_proc_output(flp_config_ctx_t *p_ctx, char *p_setting_part2,
82
+                           char *value);
83
+
84
+/**
85
+ * \brief process setting from config file
86
+ *
87
+ * \param[in,out] p_ctx context information
88
+ * \param[in] p_setting setting to process
89
+ * \param[in] p_value value of setting
90
+ * \return 0 in case of success, -1 in case of error
91
+ */
92
+int flp_config_proc_setting(flp_config_ctx_t *p_ctx, char *p_setting,
93
+                            char *p_value);
94
+
95
+/**
96
+ * \brief process line from config file
97
+ *
98
+ * \param[in,out] p_ctx context information
99
+ * \param[in] p_line line to process
100
+ * \return 0 in case of success, -1 in case of error
101
+ */
102
+int flp_config_proc_line(flp_config_ctx_t *p_ctx, char *p_line);
103
+
104
+/**
105
+ * \brief process config file
106
+ *
107
+ * \param[in,out] p_display display to configure
108
+ * \param[in] sz_config_file name of config file to read
109
+ * \param[in] p_msg_func message callback function or NULL
110
+ * \param[in] p_msg_ctx user context for message callback
111
+ * \return 0 in case of success, -1 in case of error
112
+ */
113
+int flp_config_proc_file(flp_display_t *p_display,
114
+                         const char *sz_config_file,
115
+                         flp_msg_func_p_t p_msg_func, void *p_msg_ctx);
116
+
117
+#endif /* #ifndef FLP_CONFIG_H */
118
+
... ...
@@ -0,0 +1,31 @@
1
+/*
2
+ * FlexiPix library
3
+ * !version: 1.0.0! !date: 2010-07-31!
4
+ *
5
+ * Copyright 2010 Stefan Schuermans <stefan schuermans info>
6
+ *
7
+ * This program is free software: you can redistribute it and/or modify
8
+ * it under the terms of the GNU General Public License as published by
9
+ * the Free Software Foundation, version 3 of the License.
10
+ *
11
+ *
12
+ * This program is distributed in the hope that it will be useful,
13
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
+ * GNU General Public License for more details.
16
+ *
17
+ * You should have received a copy of the GNU Lesser General Public License
18
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
19
+ */
20
+
21
+#ifndef FLP_CONST_DATA_H
22
+#define FLP_CONST_DATA_H
23
+
24
+#include <flexipix/types.h>
25
+#include <intern/types.h>
26
+
27
+/** data of MCUF header */
28
+extern const flp_u8_t flp_mcuf_hdr[FLP_MCUF_HDR_LEN];
29
+
30
+#endif /* #ifndef FLP_CONST_DATA_H */
31
+
... ...
@@ -0,0 +1,65 @@
1
+/*
2
+ * FlexiPix library
3
+ * !version: 1.0.0! !date: 2010-07-31!
4
+ *
5
+ * Copyright 2010 Stefan Schuermans <stefan schuermans info>
6
+ *
7
+ * This program is free software: you can redistribute it and/or modify
8
+ * it under the terms of the GNU General Public License as published by
9
+ * the Free Software Foundation, version 3 of the License.
10
+ *
11
+ *
12
+ * This program is distributed in the hope that it will be useful,
13
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
+ * GNU General Public License for more details.
16
+ *
17
+ * You should have received a copy of the GNU Lesser General Public License
18
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
19
+ */
20
+
21
+#ifndef FLP_CONSTANTS_H
22
+#define FLP_CONSTANTS_H
23
+
24
+/* FlexiPix hardware constants */
25
+#define FLP_DISTRI_MAX_CNT (4096) /**< maximum number of distributors
26
+                                   *   that can be in the system,
27
+                                   *   number of distributor addresses
28
+                                   *   available */
29
+#define FLP_OUTPUT_MAX_CNT (128)  /**< maximum number of outputs per
30
+                                   *   distributor */
31
+#define FLP_PIXEL_MAX_CNT  (128)  /**< maximum number of pixels that can
32
+                                   *   be connected to an output of a
33
+                                   *   distributor */
34
+
35
+/* MCUF constants */
36
+#define FLP_MCUF_HDR ("\x23\x54\x26\x66" \
37
+                      "\x00\x00\x00\x00" \
38
+                      "\x00\x03\x00\xFF")     /**< data of MCUF header */
39
+#define FLP_MCUF_HDR_LEN              (12)    /**< length of MCUF header */
40
+#define FLP_MCUF_HDR_OFS_OUTPUTS      (5)     /**< offset of output count
41
+                                               *   in MCUF data */
42
+#define FLP_MCUF_HDR_OFS_PIXELS       (7)     /**< offset of pixel count
43
+                                               *   in MCUF data */
44
+#define FLP_MCUF_MAX_FRAME_INTERVAL_MS (1000) /**< maximum interval between
45
+                                                   two MCUF frames */
46
+
47
+/* fixed settings constants */
48
+#define FLP_DEST_IP_BASE (0x0A465000) /**< base IP address of distributors,
49
+                                       *   i.e. IP address of distributor 0,
50
+                                       *   10.70.80.0 */
51
+#define FLP_DEST_IP_STEP (0x00000001) /**< IP adress step of distributors,
52
+                                       *   i.e. increment of IP address for
53
+                                       *   every distributor address,
54
+                                       *   0.0.0.1 */
55
+#define FLP_DEST_PORT    (2323)       /**< UDP port the distributors
56
+                                       *   listen on */
57
+
58
+/* default settings constants */
59
+#define FLP_BIND_IP   (0x00000000) /**< default IP to bind to
60
+                                    *   (first IP octect in LSB) */
61
+#define FLP_BIND_PORT (0)          /**< default port to bind to */
62
+
63
+
64
+#endif /* #ifndef FLP_CONSTANTS_H */
65
+
... ...
@@ -0,0 +1,33 @@
1
+/*
2
+ * FlexiPix library
3
+ * !version: 1.0.0! !date: 2010-07-31!
4
+ *
5
+ * Copyright 2010 Stefan Schuermans <stefan schuermans info>
6
+ *
7
+ * This program is free software: you can redistribute it and/or modify
8
+ * it under the terms of the GNU General Public License as published by
9
+ * the Free Software Foundation, version 3 of the License.
10
+ *
11
+ *
12
+ * This program is distributed in the hope that it will be useful,
13
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
+ * GNU General Public License for more details.
16
+ *
17
+ * You should have received a copy of the GNU Lesser General Public License
18
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
19
+ */
20
+
21
+#ifndef FLP_DISPLAYER_H
22
+#define FLP_DISPLAYER_H
23
+
24
+/**
25
+ * \brief output thread of displayer object
26
+ *
27
+ * \param[in] vp_displayer pointer to displayer object
28
+ * \return unused, always NULL
29
+ */
30
+void * flp_displayer_thread(void *vp_displayer);
31
+
32
+#endif /* #ifndef FLP_DISPLAYER_H */
33
+
... ...
@@ -0,0 +1,36 @@
1
+/*
2
+ * FlexiPix library
3
+ * !version: 1.0.0! !date: 2010-07-31!
4
+ *
5
+ * Copyright 2010 Stefan Schuermans <stefan schuermans info>
6
+ *
7
+ * This program is free software: you can redistribute it and/or modify
8
+ * it under the terms of the GNU General Public License as published by
9
+ * the Free Software Foundation, version 3 of the License.
10
+ *
11
+ *
12
+ * This program is distributed in the hope that it will be useful,
13
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
+ * GNU General Public License for more details.
16
+ *
17
+ * You should have received a copy of the GNU Lesser General Public License
18
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
19
+ */
20
+
21
+#ifndef FLP_MAPPING_H
22
+#define FLP_MAPPING_H
23
+
24
+#include <intern/types.h>
25
+
26
+/**
27
+ * \brief precalculate mapping table
28
+ *
29
+ * updates the internal lookup table according to the parameters
30
+ *
31
+ * \param[in,out] p_mapping mapping to precalculate
32
+ */
33
+void flp_mapping_precalc(flp_mapping_t *p_mapping);
34
+
35
+#endif /* #ifndef FLP_MAPPING_H */
36
+
... ...
@@ -0,0 +1,36 @@
1
+/*
2
+ * FlexiPix library
3
+ * !version: 1.0.0! !date: 2010-07-31!
4
+ *
5
+ * Copyright 2010 Stefan Schuermans <stefan schuermans info>
6
+ *
7
+ * This program is free software: you can redistribute it and/or modify
8
+ * it under the terms of the GNU General Public License as published by
9
+ * the Free Software Foundation, version 3 of the License.
10
+ *
11
+ *
12
+ * This program is distributed in the hope that it will be useful,
13
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
+ * GNU General Public License for more details.
16
+ *
17
+ * You should have received a copy of the GNU Lesser General Public License
18
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
19
+ */
20
+
21
+#ifndef FLP_NET_H
22
+#define FLP_NET_H
23
+
24
+#ifdef WINDOWS
25
+#include <winsock2.h>
26
+#else
27
+#define closesocket close
28
+#include <arpa/inet.h>
29
+#include <netdb.h>
30
+#include <netinet/in.h>
31
+#include <sys/socket.h>
32
+#include <unistd.h>
33
+#endif
34
+
35
+#endif /* #ifndef FLP_NET_H */
36
+
... ...
@@ -0,0 +1,48 @@
1
+/*
2
+ * FlexiPix library
3
+ * !version: 1.0.0! !date: 2010-07-31!
4
+ *
5
+ * Copyright 2010 Stefan Schuermans <stefan schuermans info>
6
+ *
7
+ * This program is free software: you can redistribute it and/or modify
8
+ * it under the terms of the GNU General Public License as published by
9
+ * the Free Software Foundation, version 3 of the License.
10
+ *
11
+ *
12
+ * This program is distributed in the hope that it will be useful,
13
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
+ * GNU General Public License for more details.
16
+ *
17
+ * You should have received a copy of the GNU Lesser General Public License
18
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
19
+ */
20
+
21
+#ifndef FLP_PARSE_H
22
+#define FLP_PARSE_H
23
+
24
+#include <intern/net.h>
25
+
26
+/**
27
+ * \brief parse two comma-separated numbers
28
+ *
29
+ * \param[in] text text to parse
30
+ * \param[out] no1 first number parsed from text
31
+ * \param[out] no2 second number parsed from text
32
+ * \param[out] end location in text where parsing ended
33
+ * \return 0 in case of success, -1 in case of error
34
+ */
35
+int flp_parse_two_nos(char *text, unsigned int *no1, unsigned int *no2,
36
+                      char **end);
37
+
38
+/**
39
+ * \brief parse an address
40
+ *
41
+ * \param[in] test test to parse
42
+ * \param[out] addr address parsed from text
43
+ * \return 0 in case of success, -1 in case of error
44
+ */
45
+int flp_parse_addr(char *text, struct sockaddr_in *addr);
46
+
47
+#endif /* #ifndef FLP_PARSE_H */
48
+
... ...
@@ -0,0 +1,94 @@
1
+/*
2
+ * FlexiPix library
3
+ * !version: 1.0.0! !date: 2010-07-31!
4
+ *
5
+ * Copyright 2010 Stefan Schuermans <stefan schuermans info>
6
+ *
7
+ * This program is free software: you can redistribute it and/or modify
8
+ * it under the terms of the GNU General Public License as published by
9
+ * the Free Software Foundation, version 3 of the License.
10
+ *
11
+ *
12
+ * This program is distributed in the hope that it will be useful,
13
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
+ * GNU General Public License for more details.
16
+ *
17
+ * You should have received a copy of the GNU Lesser General Public License
18
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
19
+ */
20
+
21
+#ifndef FLP_TYPES_H
22
+#define FLP_TYPES_H
23
+
24
+#include <pthread.h>
25
+
26
+#include <flexipix/types.h>
27
+#include <intern/constants.h>
28
+#include <intern/net.h>
29
+
30
+/** mapping information
31
+ *
32
+ *  values of channels are mapped according to following formula:
33
+ *  <display value> := <base> + <factor> * <original value> ^ (1 / <gamma>)
34
+ */
35
+typedef struct flp_mapping_s {
36
+  double base;         /**< base constant for brightness correction */
37
+  double factor;       /**< factor for contrast modification */
38
+  double gamma;        /**< gamma correction factor, must be > 0.0 */
39
+  flp_u8_t table[256]; /**< precalculated mapping table,
40
+                        *   index: source image value
41
+                        *   value: display value */
42
+} flp_mapping_t;
43
+
44
+/** information about a pixel */
45
+typedef struct flp_pixel_s {
46
+  int x, y; /**< coordinates of pixel in movie (-1 if unknown yet) */
47
+} flp_pixel_t;
48
+
49
+/** information about a distributor */
50
+typedef struct flp_distri_s {
51
+  unsigned int distri;      /**< number of this distributor */
52
+  unsigned int output_cnt;  /**< number of outputs of this distributor */
53
+  unsigned int pixel_cnt;   /**< number of pixels connected to every output */
54
+  flp_mapping_t mapping[3]; /**< mapping information for red, green
55
+                             *   and blue channel */
56
+  flp_pixel_t *p_pixels;    /**< array with information about pixels
57
+                             *   of this distributor,
58
+                             *   index = output * pixel_cnt + pixel,
59
+                             *   malloc-ed */
60
+  unsigned int msg_len;     /**< size of a message to send to distributor */
61
+  flp_u8_t *p_msg_buf;      /**< buffer for current message to send
62
+                             *   to distributor,
63
+                             *   malloc-ed */
64
+} flp_distri_t;
65
+
66
+/** information about a display */
67
+struct flp_display_s {
68
+  struct sockaddr_in bind_addr;       /**< local network address to bind to */
69
+  flp_pixel_t size;                   /**< size of display */
70
+  flp_distri_t *distri_ptrs
71
+                [FLP_DISTRI_MAX_CNT]; /**< information about distributors,
72
+                                       *   distributors are malloc-ed */
73
+  unsigned int distri_cnt;            /**< total number of distris */
74
+  unsigned int output_cnt;            /**< total number of outputs */
75
+  unsigned long pixel_cnt;            /**< total number of pixels */
76
+  int sock;                           /**< socket to send UDP packets */
77
+};
78
+
79
+/** a displayer
80
+ *
81
+ * sends pictures to a display whenever the maximum interval expired
82
+ */
83
+struct flp_displayer_s {
84
+  flp_display_t *p_display; /**< display managed by this displayer */
85
+  pthread_mutex_t mtx;      /**< mutex to lock msg_buf of distris */
86
+  pthread_cond_t cond;      /**< condition to wake up thread on new frame */
87
+  pthread_t tid;            /**< id of output thread */
88
+  volatile int active;      /**< if to output to distris */
89
+  volatile int send;        /**< set to force immediate sending to distris */
90
+  volatile int end;         /**< set to signal end to thread */
91
+};
92
+
93
+#endif /* #ifndef FLP_TYPES_H */
94
+
... ...
@@ -0,0 +1,654 @@
1
+/*
2
+ * FlexiPix library
3
+ * !version: 1.0.0! !date: 2010-07-31!
4
+ *
5
+ * Copyright 2010 Stefan Schuermans <stefan schuermans info>
6
+ *
7
+ * This program is free software: you can redistribute it and/or modify
8
+ * it under the terms of the GNU General Public License as published by
9
+ * the Free Software Foundation, version 3 of the License.
10
+ *
11
+ *
12
+ * This program is distributed in the hope that it will be useful,
13
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
+ * GNU General Public License for more details.
16
+ *
17
+ * You should have received a copy of the GNU Lesser General Public License
18
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
19
+ */
20
+
21
+#include <errno.h>
22
+#include <stdio.h>
23
+#include <stdlib.h>
24
+#include <string.h>
25
+
26
+#include <flexipix/msg.h>
27
+#include <flexipix/types.h>
28
+#include <intern/const_data.h>
29
+#include <intern/constants.h>
30
+#include <intern/config.h>
31
+#include <intern/mapping.h>
32
+#include <intern/net.h>
33
+#include <intern/parse.h>
34
+#include <intern/types.h>
35
+
36
+/**
37
+ * \brief process distributor from config file
38
+ *
39
+ * \param[in,out] p_ctx context information
40
+ * \param[in] p_setting_part2 second half of setting to process
41
+ * \param[in] p_value value of setting
42
+ * \return 0 in case of success, -1 in case of error
43
+ */
44
+int flp_config_proc_distri(flp_config_ctx_t *p_ctx, char *p_setting_part2,
45
+                           char *value)
46
+{
47
+  char *ptr;
48
+  unsigned long val;
49
+  unsigned int distri, out, pix, i;
50
+  flp_distri_t *p_distri;
51
+
52
+  /* get distributor number */
53
+  val = strtoul(p_setting_part2, &ptr, 0);
54
+  if (ptr == p_setting_part2 || *ptr != 0 || val >= FLP_DISTRI_MAX_CNT) {
55
+    if (p_ctx->p_msg_func)
56
+      p_ctx->p_msg_func(p_ctx->p_msg_ctx, flp_msg_type_err,
57
+                        "invalid distributor number \"%s\""
58
+                        " in line %u of config file\n",
59
+                        p_setting_part2, p_ctx->line_no);
60
+    return -1;
61
+  }
62
+  distri = (unsigned int)val;
63
+
64
+  /* get number of outputs and pixels */
65
+  if (flp_parse_two_nos(value, &out, &pix, &ptr) || *ptr != 0) {
66
+    if (p_ctx->p_msg_func)
67
+      p_ctx->p_msg_func(p_ctx->p_msg_ctx, flp_msg_type_err,
68
+                        "invalid distributor size \"%s\""
69
+                        " in line %u of config file\n",
70
+                        value, p_ctx->line_no);
71
+    return -1;
72
+  }
73
+  if (out >= FLP_OUTPUT_MAX_CNT) {
74
+    if (p_ctx->p_msg_func)
75
+      p_ctx->p_msg_func(p_ctx->p_msg_ctx, flp_msg_type_err,
76
+                        "invalid number of outputs \"%u\""
77
+                        " in line %u of config file\n",
78
+                        out, p_ctx->line_no);
79
+    return -1;
80
+  }
81
+  if (pix >= FLP_PIXEL_MAX_CNT) {
82
+    if (p_ctx->p_msg_func)
83
+      p_ctx->p_msg_func(p_ctx->p_msg_ctx, flp_msg_type_err,
84
+                        "invalid number of pixels \"%u\""
85
+                        " in line %u of config file\n",
86
+                        pix, p_ctx->line_no);
87
+    return -1;
88
+  }
89
+
90
+  /* check if distributor is already present */
91
+  if (p_ctx->p_display->distri_ptrs[distri]) {
92
+    if (p_ctx->p_msg_func)
93
+      p_ctx->p_msg_func(p_ctx->p_msg_ctx, flp_msg_type_err,
94
+                        "duplicate definition of distributor \"%u\""
95
+                        " in line %u of config file\n",
96
+                        distri, p_ctx->line_no);
97
+    return -1;
98
+  }
99
+
100
+  /* create a new distributor */
101
+  p_distri = (flp_distri_t *)malloc(sizeof (flp_distri_t));
102
+  if (!p_distri) {
103
+    if (p_ctx->p_msg_func)
104
+      p_ctx->p_msg_func(p_ctx->p_msg_ctx, flp_msg_type_err, "out of memory\n");
105
+    return -1;
106
+  }
107
+  p_distri->distri = distri;
108
+  p_distri->output_cnt = out;
109
+  p_distri->pixel_cnt = pix;
110
+  /* initialize mapping information */
111
+  for (i = 0; i < 3; i++) {
112
+    p_distri->mapping[i].base = 0.0;
113
+    p_distri->mapping[i].gamma = 1.0;
114
+    p_distri->mapping[i].factor = 1.0;
115
+    flp_mapping_precalc(&p_distri->mapping[i]);
116
+  }
117
+  /* create and initialize pixel array */
118
+  p_distri->p_pixels =
119
+    (flp_pixel_t *)malloc(out * pix * sizeof (flp_pixel_t));
120
+  if (!p_distri->p_pixels) {
121
+    free(p_distri);
122
+    if (p_ctx->p_msg_func)
123
+      p_ctx->p_msg_func(p_ctx->p_msg_ctx, flp_msg_type_err, "out of memory\n");
124
+    return -1;
125
+  }
126
+  for (i = 0; i < out * pix; i++) {
127
+    p_distri->p_pixels[i].x = -1;
128
+    p_distri->p_pixels[i].y = -1;
129
+  }
130
+  /* create and initialize message buffer */
131
+  p_distri->msg_len = FLP_MCUF_HDR_LEN + out * pix * 3;
132
+  p_distri->p_msg_buf = (flp_u8_t *)malloc(p_distri->msg_len);
133
+  if (!p_distri->p_msg_buf) {
134
+    free(p_distri->p_pixels);
135
+    free(p_distri);
136
+    if (p_ctx->p_msg_func)
137
+      p_ctx->p_msg_func(p_ctx->p_msg_ctx, flp_msg_type_err, "out of memory\n");
138
+    return -1;
139
+  }
140
+  memset(p_distri->p_msg_buf, 0, p_distri->msg_len);
141
+  memcpy(p_distri->p_msg_buf, flp_mcuf_hdr, FLP_MCUF_HDR_LEN);
142
+  p_distri->p_msg_buf[FLP_MCUF_HDR_OFS_OUTPUTS] = (flp_u8_t)out;
143
+  p_distri->p_msg_buf[FLP_MCUF_HDR_OFS_PIXELS] = (flp_u8_t)pix;
144
+  /* store pointer to distributor */
145
+  p_ctx->p_display->distri_ptrs[distri] = p_distri;
146
+
147
+  /* count distributors */
148
+  p_ctx->p_display->distri_cnt++;
149
+
150
+  return 0;
151
+}
152
+
153
+/**
154
+ * \brief process mapping from config file
155
+ *
156
+ * \param[in,out] p_ctx context information
157
+ * \param[in] p_setting_part2 second half of setting to process
158
+ * \param[in] p_value value of setting
159
+ * \return 0 in case of success, -1 in case of error
160
+ */
161
+int flp_config_proc_mapping(flp_config_ctx_t *p_ctx, char *p_setting_part2,
162
+                            char *value)
163
+{
164
+  char *ptr, *ptr2;
165
+  unsigned long val;
166
+  unsigned int distri, chan;
167
+  flp_distri_t *p_distri;
168
+  double base, factor, gamma;
169
+
170
+  /* get distributor number */
171
+  val = strtoul(p_setting_part2, &ptr, 0);
172
+  if (ptr == p_setting_part2
173
+      || (*ptr != 0 && *ptr != ' ' && *ptr != '\t'
174
+          && *ptr != '\r' && *ptr != '\n')) {
175
+    if (p_ctx->p_msg_func)
176
+      p_ctx->p_msg_func(p_ctx->p_msg_ctx, flp_msg_type_err,
177
+                        "invalid mapping specifier \"%s\""
178
+                        " in line %u of config file\n",
179
+                        p_setting_part2, p_ctx->line_no);
180
+    return -1;
181
+  }
182
+  distri = (unsigned int)val;
183
+  if (distri >= FLP_DISTRI_MAX_CNT) {
184
+    if (p_ctx->p_msg_func)
185
+      p_ctx->p_msg_func(p_ctx->p_msg_ctx, flp_msg_type_err,
186
+                        "invalid distributor number \"%u\""
187
+                        " in line %u of config file\n",
188
+                        distri, p_ctx->line_no);
189
+    return -1;
190
+  }
191
+
192
+  /* get channel */
193
+  while (*ptr == ' ' || *ptr == '\t' || *ptr == '\r' || *ptr == '\n')
194
+    ptr++;
195
+  if (!strcmp(ptr, "red"))
196
+    chan = 0;
197
+  else if (!strcmp(ptr, "green"))
198
+    chan = 1;
199
+  else if (!strcmp(ptr, "blue"))
200
+    chan = 2;
201
+  else {
202
+    if (p_ctx->p_msg_func)
203
+      p_ctx->p_msg_func(p_ctx->p_msg_ctx, flp_msg_type_err,
204
+                        "invalid channel \"%s\""
205
+                        " in line %u of config file\n", ptr,
206
+                        p_ctx->line_no);
207
+    return -1;
208
+  }
209
+
210
+  /* get distributor */
211
+  p_distri = p_ctx->p_display->distri_ptrs[distri];
212
+  if (!p_distri) {
213
+    if (p_ctx->p_msg_func)
214
+      p_ctx->p_msg_func(p_ctx->p_msg_ctx, flp_msg_type_err,
215
+                        "no distributor with number \"%u\""
216
+                        " in line %u of config file\n",
217
+                        distri, p_ctx->line_no);
218
+    return -1;
219
+  }
220
+
221
+  /* get mapping parameters: base, factor, gamma */
222
+  base = strtod(value, &ptr);
223
+  if (ptr == value
224
+      || (*ptr != 0 && *ptr != ' ' && *ptr != '\t'
225
+          && *ptr != '\r' && *ptr != '\n')) {
226
+    if (p_ctx->p_msg_func)
227
+      p_ctx->p_msg_func(p_ctx->p_msg_ctx, flp_msg_type_err,
228
+                        "invalid mapping parameters \"%s\""
229
+                        " in line %u of config file\n",
230
+                        value, p_ctx->line_no);
231
+    return -1;
232
+  }
233
+  factor = strtod(ptr, &ptr2);
234
+  if (ptr2 == ptr
235
+      || (*ptr2 != 0 && *ptr2 != ' ' && *ptr2 != '\t'
236
+          && *ptr2 != '\r' && *ptr2 != '\n')) {
237
+    if (p_ctx->p_msg_func)
238
+      p_ctx->p_msg_func(p_ctx->p_msg_ctx, flp_msg_type_err,
239
+                        "invalid mapping parameters \"%s\""
240
+                        " in line %u of config file\n",
241
+                        value, p_ctx->line_no);
242
+    return -1;
243
+  }
244
+  gamma = strtod(ptr2, &ptr);
245
+  if (ptr == ptr2
246
+      || (*ptr != 0 && *ptr != ' ' && *ptr != '\t'
247
+          && *ptr != '\r' && *ptr != '\n')) {
248
+    if (p_ctx->p_msg_func)
249
+      p_ctx->p_msg_func(p_ctx->p_msg_ctx, flp_msg_type_err,
250
+                        "invalid mapping parameters \"%s\""
251
+                        " in line %u of config file\n",
252
+                        value, p_ctx->line_no);
253
+    return -1;
254
+  }
255
+  if (gamma <= 0.0) {
256
+    if (p_ctx->p_msg_func)
257
+      p_ctx->p_msg_func(p_ctx->p_msg_ctx, flp_msg_type_err,
258
+                        "invalid gamma value \"%f\""
259
+                        " in line %u of config file\n",
260
+                        gamma, p_ctx->line_no);
261
+    return -1;
262
+  }
263
+
264
+  /* store new mapping parameters and re-calculate mapping table */
265
+  p_distri->mapping[chan].base = base;
266
+  p_distri->mapping[chan].factor = factor;
267
+  p_distri->mapping[chan].gamma = gamma;
268
+  flp_mapping_precalc(&p_distri->mapping[chan]);
269
+
270
+  return 0;
271
+}
272
+
273
+/**
274
+ * \brief process pixel from config file
275
+ *
276
+ * \param[in,out] p_ctx context information
277
+ * \param[in] sz_pixel text of pixel to process
278
+ * \param[in] distri number of distributor
279
+ * \param[in] out number of output
280
+ * \param[in] pix number of pixel
281
+ * \return 0 in case of success, -1 in case of error
282
+ */
283
+int flp_config_proc_pixel(flp_config_ctx_t *p_ctx, char *sz_pixel,
284
+                          unsigned int distri, unsigned int out,
285
+                          unsigned int pix)
286
+{
287
+  flp_distri_t *p_distri = p_ctx->p_display->distri_ptrs[distri];
288
+  char *ptr;
289
+  unsigned int x, y, idx;
290
+
291
+  /* get coordinates of pixel */
292
+  if (flp_parse_two_nos(sz_pixel, &x, &y, &ptr) || *ptr != 0
293
+      || (int)x < 0 || (int)x >= p_ctx->p_display->size.x
294
+      || (int)y < 0 || (int)y >= p_ctx->p_display->size.y) {
295
+    if (p_ctx->p_msg_func)
296
+      p_ctx->p_msg_func(p_ctx->p_msg_ctx, flp_msg_type_err,
297
+                        "invalid pixel \"%s\""
298
+                        " in line %u of config file\n",
299
+                        sz_pixel, p_ctx->line_no);
300
+    return -1;
301
+  }
302
+
303
+  /* check pixel number */
304
+  if (pix >= FLP_PIXEL_MAX_CNT || pix >= p_distri->pixel_cnt) {
305
+    if (p_ctx->p_msg_func)
306
+      p_ctx->p_msg_func(p_ctx->p_msg_ctx, flp_msg_type_err,
307
+                        "too many pixels (more than %u)"
308
+                        " in line %u of config file\n",
309
+                        p_distri->pixel_cnt, p_ctx->line_no);
310
+    return -1;
311
+  }
312
+
313
+  /* check that pixel is not yet set */
314
+  idx = out * p_distri->pixel_cnt + pix;
315
+  if (p_distri->p_pixels[idx].x >= 0
316
+      && p_distri->p_pixels[idx].y >= 0) {
317
+    if (p_ctx->p_msg_func)
318
+      p_ctx->p_msg_func(p_ctx->p_msg_ctx, flp_msg_type_err,
319
+                        "pixel %u of output %u of distributor %u already set"
320
+                        " to pixel %u,%u in line %u of config file\n",
321
+                        pix, out, distri, p_distri->p_pixels[idx].x,
322
+                 p_distri->p_pixels[idx].y, p_ctx->line_no);
323
+    return -1;
324
+  }
325
+
326
+  /* set pixel coordinates */
327
+  p_distri->p_pixels[idx].x = x;
328
+  p_distri->p_pixels[idx].y = y;
329
+
330
+  /* count pixels in total */
331
+  p_ctx->p_display->pixel_cnt++;
332
+
333
+  return 0;
334
+}
335
+
336
+/**
337
+ * \brief process output from config file
338
+ *
339
+ * \param[in,out] p_ctx context information
340
+ * \param[in] p_setting_part2 second half of setting to process
341
+ * \param[in] p_value value of setting
342
+ * \return 0 in case of success, -1 in case of error
343
+ */
344
+int flp_config_proc_output(flp_config_ctx_t *p_ctx, char *p_setting_part2,
345
+                           char *value)
346
+{
347
+  char *ptr, *p_pos, *p_white, white;
348
+  unsigned int distri, out, pix;
349
+  flp_distri_t *p_distri;
350
+  int err;
351
+
352
+  /* get number of distributor and output */
353
+  if (flp_parse_two_nos(p_setting_part2, &distri, &out, &ptr) || *ptr != 0) {
354
+    if (p_ctx->p_msg_func)
355
+      p_ctx->p_msg_func(p_ctx->p_msg_ctx, flp_msg_type_err,
356
+                        "invalid output specifier \"%s\""
357
+                        " in line %u of config file\n",
358
+                        p_setting_part2, p_ctx->line_no);
359
+    return -1;
360
+  }
361
+  if (distri >= FLP_DISTRI_MAX_CNT) {
362
+    if (p_ctx->p_msg_func)
363
+      p_ctx->p_msg_func(p_ctx->p_msg_ctx, flp_msg_type_err,
364
+                        "invalid distributor number \"%u\""
365
+                        " in line %u of config file\n",
366
+                        distri, p_ctx->line_no);
367
+    return -1;
368
+  }
369
+  if (out >= FLP_OUTPUT_MAX_CNT) {
370
+    if (p_ctx->p_msg_func)
371
+      p_ctx->p_msg_func(p_ctx->p_msg_ctx, flp_msg_type_err,
372
+                        "invalid output number \"%u\""
373
+                        " in line %u of config file\n",
374
+                        out, p_ctx->line_no);
375
+    return -1;
376
+  }
377
+
378
+  /* get distributor */
379
+  p_distri = p_ctx->p_display->distri_ptrs[distri];
380
+  if (!p_distri) {
381
+    if (p_ctx->p_msg_func)
382
+      p_ctx->p_msg_func(p_ctx->p_msg_ctx, flp_msg_type_err,
383
+                        "no distributor with number \"%u\""
384
+                        " in line %u of config file\n",
385
+                        distri, p_ctx->line_no);
386
+    return -1;
387
+  }
388
+  /* check output number */
389
+  if (out >= p_distri->output_cnt) {
390
+    if (p_ctx->p_msg_func)
391
+      p_ctx->p_msg_func(p_ctx->p_msg_ctx, flp_msg_type_err,
392
+                        "no output with output number \"%u\""
393
+                        " in line %u of config file\n",
394
+                        out, p_ctx->line_no);
395
+    return -1;
396
+  }
397
+
398
+  /* count outputs */
399
+  p_ctx->p_display->output_cnt++;
400
+
401
+  /* process pixels */
402
+
403
+  /* process all parts separated by whitespace */
404
+  p_pos = value;
405
+  err = 0;
406
+  pix = 0;
407
+  while (*p_pos != 0) {
408
+
409
+    /* get end of item (first whitespace) */
410
+    for (p_white = p_pos;
411
+         *p_white && *p_white != ' ' && *p_white != '\t'
412
+         && *p_white != '\r' && *p_white != '\n'; p_white++);
413
+
414
+    /* process item: a pixel */
415
+    white = *p_white; /* terminate item */
416
+    *p_white = 0;
417
+    if (flp_config_proc_pixel(p_ctx, p_pos, distri, out, pix)) /* process */
418
+      err = -1;       /* remember errors */
419
+    pix++;            /* count pixels */
420
+    *p_white = white; /* undo termination */
421
+
422
+    /* skip whitespace and continue after it */
423
+    for (;
424
+         *p_white == ' ' || *p_white == '\t'
425
+         || *p_white == '\r' || *p_white == '\n'; p_white++);
426
+    p_pos = p_white;
427
+
428
+  } /* while (*p_pos != 0) */
429
+
430
+  return err;
431
+}
432
+
433
+/**
434
+ * \brief process setting from config file
435
+ *
436
+ * \param[in,out] p_ctx context information
437
+ * \param[in] p_setting setting to process
438
+ * \param[in] p_value value of setting
439
+ * \return 0 in case of success, -1 in case of error
440
+ */
441
+int flp_config_proc_setting(flp_config_ctx_t *p_ctx, char *p_setting,
442
+                            char *p_value)
443
+{
444
+  char *ptr;
445
+  unsigned int x, y;
446
+
447
+  /* replace all whitespace with spaces in setting */
448
+  while ((ptr = strchr(p_setting, '\t')))
449
+    *ptr = ' ';
450
+  while ((ptr = strchr(p_setting, '\r')))
451
+    *ptr = ' ';
452
+  while ((ptr = strchr(p_setting, '\n')))
453
+    *ptr = ' ';
454
+
455
+  /* bind address for UDP output */
456
+  if (!strcmp(p_setting, "bindAddr")) {
457
+    if (flp_parse_addr(p_value, &p_ctx->p_display->bind_addr)) {
458
+      if (p_ctx->p_msg_func)
459
+        p_ctx->p_msg_func(p_ctx->p_msg_ctx, flp_msg_type_err,
460
+                          "invalid address \"%s\" for \"%s\""
461
+                          " in line %u of config file\n",
462
+                          p_value, p_setting, p_ctx->line_no);
463
+      return -1;
464
+    }
465
+    if (p_ctx->p_msg_func)
466
+      p_ctx->p_msg_func(p_ctx->p_msg_ctx, flp_msg_type_info, "bind address: %s\n", p_value);
467
+    return 0;
468
+  }
469
+
470
+  /* size of display */
471
+  if (!strcmp(p_setting, "size")) {
472
+    if (flp_parse_two_nos(p_value, &x, &y, &ptr)
473
+        || (int)x <= 0 || (int)y <= 0) {
474
+      if (p_ctx->p_msg_func)
475
+        p_ctx->p_msg_func(p_ctx->p_msg_ctx, flp_msg_type_err,
476
+                          "invalid value \"%s\" for \"%s\""
477
+                          " in line %u of config file\n",
478
+                          p_value, p_setting, p_ctx->line_no);
479
+      return -1;
480
+    }
481
+    p_ctx->p_display->size.x = x;
482
+    p_ctx->p_display->size.y = y;
483
+    return 0;
484
+  }
485
+
486
+  /* distributor */
487
+  if (!strncmp(p_setting, "distributor ", 12))
488
+    return flp_config_proc_distri(p_ctx, p_setting + 12, p_value);
489
+
490
+  /* mapping */
491
+  if (!strncmp(p_setting, "mapping ", 8))
492
+    return flp_config_proc_mapping(p_ctx, p_setting + 8, p_value);
493
+
494
+  /* output */
495
+  if (!strncmp(p_setting, "output ", 7))
496
+    return flp_config_proc_output(p_ctx, p_setting + 7, p_value);
497
+
498
+  /* unknown setting */
499
+  if (p_ctx->p_msg_func)
500
+    p_ctx->p_msg_func(p_ctx->p_msg_ctx, flp_msg_type_warn,
501
+                      "unknown setting \"%s\""
502
+                      " in line %u of config file, ignored\n",
503
+                      p_setting, p_ctx->line_no);
504
+  return 0;
505
+}
506
+
507
+/**
508
+ * \brief process line from config file
509
+ *
510
+ * \param[in,out] p_ctx context information
511
+ * \param[in] p_line line to process
512
+ * \return 0 in case of success, -1 in case of error
513
+ */
514
+int flp_config_proc_line(flp_config_ctx_t *p_ctx, char *p_line)
515
+{
516
+  char *p_hash, *p_equal, *p_setting, *p_value;
517
+  int i;
518
+
519
+  /* remove comment */
520
+  p_hash = strchr(p_line, '#');
521
+  if (p_hash)
522
+    *p_hash = 0;
523
+
524
+  /* remove trailing whitespace */
525
+  for (i = strlen(p_line) - 1;
526
+       i >= 0 && (p_line[i] == ' ' || p_line[i] == '\t'
527
+                  || p_line[i] == '\r' || p_line[i] == '\n'); i--)
528
+    p_line[i] = 0;
529
+
530
+  /* remove leading whitespace */
531
+  for (; *p_line == ' ' || *p_line == '\t'
532
+         || *p_line == '\r' || *p_line == '\n'; p_line++);
533
+
534
+  /* ignore empty line */
535
+  if (!p_line[0])
536
+    return 0;
537
+
538
+  /* find equal sign */
539
+  p_equal = strchr(p_line, '=');
540
+  if (!p_equal) {               /* no equal sign found */
541
+    if (p_ctx->p_msg_func)
542
+      p_ctx->p_msg_func(p_ctx->p_msg_ctx, flp_msg_type_warn,
543
+                        "invalid line %u in config file, ignored\n",
544
+                        p_ctx->line_no);
545
+    return 0;
546
+  }
547
+
548
+  /* split string at equal sign */
549
+  *p_equal = 0;
550
+  p_setting = p_line;
551
+  p_value = p_equal + 1;
552
+
553
+  /* remove trailing whitespaces in setting name */
554
+  for (i = strlen(p_setting) - 1;
555
+       i >= 0 && (p_setting[i] == ' ' || p_setting[i] == '\t'
556
+                  || p_setting[i] == '\r' || p_setting[i] == '\n'); i--)
557
+    p_setting[i] = 0;
558
+
559
+  /* remove leading whitespaces in value */
560
+  for (; *p_value == ' ' || *p_value == '\t'
561
+         || *p_value == '\r' || *p_value == '\n'; p_value++);
562
+
563
+  /* process setting */
564
+  return flp_config_proc_setting(p_ctx, p_setting, p_value);
565
+}
566
+
567
+/**
568
+ * \brief process config file
569
+ *
570
+ * \param[in,out] p_display display to configure
571
+ * \param[in] sz_config_file name of config file to read
572
+ * \param[in] p_msg_func message callback function or NULL
573
+ * \param[in] p_msg_ctx user context for message callback
574
+ * \return 0 in case of success, -1 in case of error
575
+ */
576
+int flp_config_proc_file(flp_display_t *p_display,
577
+                         const char *sz_config_file,
578
+                         flp_msg_func_p_t p_msg_func, void *p_msg_ctx)
579
+{
580
+  flp_config_ctx_t ctx;
581
+  FILE *file;
582
+
583
+  /* set up context */
584
+  ctx.p_display = p_display;
585
+  ctx.p_msg_func = p_msg_func;
586
+  ctx.p_msg_ctx = p_msg_ctx;
587
+
588
+  /* check if file is present */
589
+  if (!sz_config_file || !sz_config_file[0]) {
590
+    if (p_msg_func)
591
+      p_msg_func(p_msg_ctx, flp_msg_type_err,
592
+                 "no config file specified\n");
593
+    return -1;
594
+  }
595
+
596
+  if (p_msg_func)
597
+    p_msg_func(p_msg_ctx, flp_msg_type_info,
598
+               "using config file \"%s\"\n",
599
+               sz_config_file);
600
+
601
+  /* open file */
602
+  file = fopen(sz_config_file, "rt");
603
+  if (!file) {
604
+    if (p_msg_func)
605
+      p_msg_func(p_msg_ctx, flp_msg_type_err,
606
+                 "cannot open config file \"%s\" for reading: %s\n",
607
+                 sz_config_file, strerror(errno));
608
+    return -1;
609
+  }
610
+
611
+  /* process lines in file */
612
+  ctx.line_no = 1;
613
+  while (!feof(file)) {
614
+    char line[4096], *p_lf;
615
+
616
+    /* read a line */
617
+    line[0] = 0;
618
+    fgets(line, sizeof (line), file);
619
+    p_lf = strchr(line, '\n'); /* find LF in line in replace it with 0 */
620
+    if (p_lf)
621
+      *p_lf = 0;
622
+    else {                     /* no LF in line */
623
+      if (!feof(file)) {       /* not at end of file */
624
+        char dummy[4096];
625
+        if (p_msg_func)
626
+          p_msg_func(p_msg_ctx, flp_msg_type_warn,
627
+                     "line %u too long in config file, truncated\n",
628
+                     ctx.line_no);
629
+        /* jump over in rest of line */
630
+        dummy[0] = 0;
631
+        while (!feof(file) && !strchr(dummy, '\n'))
632
+          fgets(dummy, sizeof (dummy), file);
633
+      }
634
+    }
635
+
636
+    /* process line from file */
637
+    if (flp_config_proc_line(&ctx, line))
638
+      return -1;
639
+
640
+    ctx.line_no++;
641
+  }
642
+
643
+  /* close file */
644
+  fclose(file);
645
+
646
+  if (p_msg_func)
647
+    p_msg_func(p_msg_ctx, flp_msg_type_info,
648
+               "%ux%u input format, %u distributors, %u outputs, %lu pixels\n",
649
+               p_display->size.x, p_display->size.y,
650
+               p_display->distri_cnt, p_display->output_cnt,
651
+               p_display->pixel_cnt);
652
+  return 0;
653
+}
654
+
... ...
@@ -0,0 +1,31 @@
1
+/*
2
+ * FlexiPix library
3
+ * !version: 1.0.0! !date: 2010-07-31!
4
+ *
5
+ * Copyright 2010 Stefan Schuermans <stefan schuermans info>
6
+ *
7
+ * This program is free software: you can redistribute it and/or modify
8
+ * it under the terms of the GNU General Public License as published by
9
+ * the Free Software Foundation, version 3 of the License.
10
+ *
11
+ *
12
+ * This program is distributed in the hope that it will be useful,
13
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
+ * GNU General Public License for more details.
16
+ *
17
+ * You should have received a copy of the GNU Lesser General Public License
18
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
19
+ */
20
+
21
+#include <flexipix/types.h>
22
+#include <intern/const_data.h>
23
+#include <intern/types.h>
24
+
25
+/** data of MCUF header */
26
+const flp_u8_t flp_mcuf_hdr[FLP_MCUF_HDR_LEN] = {
27
+  0x23, 0x54, 0x26, 0x66,
28
+  0x00, 0x00, 0x00, 0x00,
29
+  0x00, 0x03, 0x00, 0xFF
30
+};
31
+
... ...
@@ -0,0 +1,265 @@
1
+/*
2
+ * FlexiPix library
3
+ * !version: 1.0.0! !date: 2010-07-31!
4
+ *
5
+ * Copyright 2010 Stefan Schuermans <stefan schuermans info>
6
+ *
7
+ * This program is free software: you can redistribute it and/or modify
8
+ * it under the terms of the GNU General Public License as published by
9
+ * the Free Software Foundation, version 3 of the License.
10
+ *
11
+ *
12
+ * This program is distributed in the hope that it will be useful,
13
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
+ * GNU General Public License for more details.
16
+ *
17
+ * You should have received a copy of the GNU Lesser General Public License
18
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
19
+ */
20
+
21
+#include <errno.h>
22
+#include <stdlib.h>
23
+#include <string.h>
24
+
25
+#include <flexipix/display.h>
26
+#include <flexipix/msg.h>
27
+#include <flexipix/types.h>
28
+#include <intern/config.h>
29
+#include <intern/constants.h>
30
+#include <intern/net.h>
31
+#include <intern/types.h>
32
+
33
+/**
34
+ * \brief create a new FlexiPix display
35
+ *
36
+ * \param[in] sz_config_file name of config file to read
37
+ * \param[in] p_msg_func message callback function or NULL
38
+ * \param[in] p_msg_ctx user context for message callback
39
+ * \return pointer to new FlexiPix display on success
40
+ *         or NULL on error
41
+ */
42
+flp_display_t *flp_display_create(const char *sz_config_file,
43
+                                  flp_msg_func_p_t p_msg_func,
44
+                                  void *p_msg_ctx)
45
+{
46
+  flp_display_t *p_display;
47
+
48
+  /* basic display setup */
49
+
50
+  /* create display structure */
51
+  p_display = (flp_display_t *)calloc(1, sizeof (flp_display_t));
52
+  if (!p_display) {
53
+    if (p_msg_func)
54
+      p_msg_func(p_msg_ctx, flp_msg_type_err,
55
+                 "out of memory\n");
56
+    return NULL;
57
+  }
58
+
59
+  /* set default bind address */
60
+  p_display->bind_addr.sin_family = AF_INET;
61
+  p_display->bind_addr.sin_port = htons(FLP_BIND_PORT);
62
+  p_display->bind_addr.sin_addr.s_addr = htonl(FLP_BIND_IP);
63
+
64
+  /* no socket yet */
65
+  p_display->sock = -1;
66
+
67
+  /* config file */
68
+
69
+  /* read config file */
70
+  if(flp_config_proc_file(p_display, sz_config_file,
71
+                          p_msg_func, p_msg_ctx)) {
72
+    flp_display_free(p_display); /* cleanup everything that config file
73
+                                    processing might heave created already */
74
+    p_msg_func(p_msg_ctx, flp_msg_type_err, "reading config file failed\n");
75
+    return NULL;
76
+  }
77
+
78
+  /* set up UDP socket */
79
+
80
+  /* create socket */
81
+  p_display->sock = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
82
+  if (p_display->sock < 0) {
83
+    flp_display_free(p_display);
84
+    if (p_msg_func)
85
+      p_msg_func(p_msg_ctx, flp_msg_type_err,
86
+                 "could not create UDP socket: %s\n",
87
+                 strerror(errno));
88
+    return NULL;
89
+  }
90
+
91
+  /* bind socket */
92
+  if (bind(p_display->sock, (struct sockaddr *)&p_display->bind_addr,
93
+           sizeof (p_display->bind_addr))) {
94
+    flp_display_free(p_display);
95
+    if (p_msg_func)
96
+      p_msg_func(p_msg_ctx, flp_msg_type_err,
97
+                 "could not bind UDP socket to \"%s:%u\": %s\n",
98
+                 inet_ntoa(p_display->bind_addr.sin_addr),
99
+                 (unsigned int)ntohs(p_display->bind_addr.sin_port),
100
+                 strerror(errno));
101
+    return NULL;
102
+  }
103
+
104
+  /* clear display */
105
+
106
+  flp_display_data_clear(p_display);
107
+
108
+  return p_display;
109
+}
110
+
111
+/**
112
+ * \brief free a FlexiPix display
113
+ *
114
+ * \param[in] p_display pointer to FlexiPix display
115
+ */
116
+void flp_display_free(flp_display_t *p_display)
117
+{
118
+  int i;
119
+
120
+  if (p_display) {
121
+
122
+    /* free distributors */
123
+    for (i = 0; i < FLP_DISTRI_MAX_CNT; i++) {
124
+      if (p_display->distri_ptrs[i]) {
125
+        flp_distri_t *p_distri = p_display->distri_ptrs[i];
126
+        free(p_distri->p_pixels);
127
+        free(p_distri->p_msg_buf);
128
+        free(p_distri);
129
+      }
130
+    }
131
+
132
+    /* close network connection */
133
+    if (p_display->sock >= 0)
134
+      closesocket(p_display->sock);
135
+
136
+    /* free display structutre */
137
+    free(p_display);
138
+
139
+  } /* if (p_display) */
140
+}
141
+
142
+/**
143
+ * \brief get size of display
144
+ *
145
+ * \param[in] p_display pointer to FlexiPix display
146
+ * \param[out] p_width width of display
147
+ * \param[out] p_height height of display
148
+ */
149
+void flp_display_get_size(flp_display_t *p_display,
150
+                          unsigned int *p_width, unsigned int *p_height)
151
+{
152
+  *p_width = (unsigned int)p_display->size.x;
153
+  *p_height = (unsigned int)p_display->size.y;
154
+}
155
+
156
+/**
157
+ * \brief clear image data to output on FlexiPix display
158
+ *
159
+ * clears the stored image data,
160
+ * stored image data can later be sent to the distributors using
161
+ * flp_display_send()
162
+ *
163
+ * \param[in] p_display pointer to FlexiPix display
164
+ */
165
+void flp_display_data_clear(flp_display_t *p_display)
166
+{
167
+  flp_u8_t black[3] = { 0, 0, 0 };
168
+  flp_display_data(p_display, black, 0, 0,
169
+                   0, 0, p_display->size.x, p_display->size.y);
170
+}
171
+
172
+/**
173
+ * \brief set image data to output on FlexiPix display
174
+ *
175
+ * updates (part of) the stored image data,
176
+ * stored image data can later be sent to the distributors using
177
+ * flp_display_send()
178
+ *
179
+ * \param[in] p_display pointer to FlexiPix display
180
+ * \param[in] p_data pointer to rectangular section of image data,
181
+ *                   pixels need to be in R8G8B8 format
182
+ * \param[in] stride_x stride between two pixels in X direction
183
+ * \param[in] stride_y stride between two pixels in Y direction
184
+ * \param[in] x X coordinate of left side of rectangular area
185
+ * \param[in] y Y coordinate of top side of rectangular area
186
+ * \param[in] width with of rectangular area
187
+ * \param[in] height height of rectangular area
188
+ */
189
+void flp_display_data(flp_display_t *p_display, flp_u8_t *p_data,
190
+                      int stride_x, int stride_y,
191
+                      unsigned int x, unsigned int y,
192
+                      unsigned int width, unsigned int height)
193
+{
194
+  unsigned int distri, out, pix, i, c;
195
+  flp_distri_t *p_distri;
196
+  flp_u8_t *dest, *src;
197
+  flp_pixel_t *p_pixel;
198
+  int rx, ry;
199
+
200
+  /* set data for all distributors */
201
+  for (distri = 0; distri < FLP_DISTRI_MAX_CNT; distri++) {
202
+    p_distri = p_display->distri_ptrs[distri];
203
+    if (p_distri) {
204
+
205
+      /* set pointer to start of RGB data for pixels in message buffer
206
+         (header is already set up and stays the same) */
207
+      dest = p_distri->p_msg_buf + FLP_MCUF_HDR_LEN;
208
+
209
+      /* get RGB data of pixels for every output */
210
+      for (out = 0, i = 0; out < p_distri->output_cnt; out++) {
211
+        for (pix = 0; pix < p_distri->pixel_cnt; pix++, i++) {
212
+          p_pixel = &p_distri->p_pixels[i];
213
+
214
+          /* get pixel coordinates relative to rectangular area of image */
215
+          rx = p_pixel->x - (int)x;
216
+          ry = p_pixel->y - (int)y;
217
+          /* check if pixel is within rectangular area of image */
218
+          if (rx >= 0 && (unsigned int)rx < width
219
+              && ry >= 0 && (unsigned int)ry < height) {
220
+            /* get pixel data and map it */
221
+            src = (p_data + rx * stride_x + ry * stride_y);
222
+            for (c = 0; c < 3; c++)
223
+              dest[c] = p_distri->mapping[c].table[src[c]];              
224
+          }
225
+
226
+          dest += 3;
227
+        } /* for (pix ...) */
228
+      } /* for (out ...) */
229
+
230
+    } /* if (p_distri) */
231
+  } /* for (distri ...) */
232
+}
233
+
234
+/**
235
+ * \brief send image data to distributors
236
+ *
237
+ * sends the currently stored image data to all configured distributors
238
+ *
239
+ * \param[in] p_display pointer to FlexiPix display
240
+ */
241
+void flp_display_send(flp_display_t *p_display)
242
+{
243
+  unsigned int distri;
244
+  flp_distri_t *p_distri;
245
+  struct sockaddr_in dest_addr;
246
+
247
+  /* send data to all distributors */
248
+  for (distri = 0; distri < FLP_DISTRI_MAX_CNT; distri++) {
249
+    p_distri = p_display->distri_ptrs[distri];
250
+    if (p_distri) {
251
+
252
+      /* assemble destination address of distributor */
253
+      dest_addr.sin_family = AF_INET;
254
+      dest_addr.sin_port = htons(FLP_DEST_PORT);
255
+      dest_addr.sin_addr.s_addr =
256
+        htonl(FLP_DEST_IP_BASE + p_distri->distri * FLP_DEST_IP_STEP);
257
+
258
+      /* send message as UDP packet */
259
+      sendto(p_display->sock, p_distri->p_msg_buf, p_distri->msg_len, 0,
260
+             (struct sockaddr *)&dest_addr, sizeof (dest_addr));
261
+
262
+    } /* if (p_distri) */
263
+  } /* for (distri ...) */
264
+}
265
+
... ...
@@ -0,0 +1,312 @@
1
+/*
2
+ * FlexiPix library
3
+ * !version: 1.0.0! !date: 2010-07-31!
4
+ *
5
+ * Copyright 2010 Stefan Schuermans <stefan schuermans info>
6
+ *
7
+ * This program is free software: you can redistribute it and/or modify
8
+ * it under the terms of the GNU General Public License as published by
9
+ * the Free Software Foundation, version 3 of the License.
10
+ *
11
+ *
12
+ * This program is distributed in the hope that it will be useful,
13
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
+ * GNU General Public License for more details.
16
+ *
17
+ * You should have received a copy of the GNU Lesser General Public License
18
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
19
+ */
20
+
21
+#include <pthread.h>
22
+#include <sys/time.h>
23
+#include <stdlib.h>
24
+
25
+#include <flexipix/display.h>
26
+#include <flexipix/displayer.h>
27
+#include <flexipix/msg.h>
28
+#include <flexipix/types.h>
29
+#include <intern/displayer.h>
30
+#include <intern/types.h>
31
+
32
+/**
33
+ * \brief create a new FlexiPix displayer
34
+ *
35
+ * A displayer manages a display and ensures that a the current
36
+ * image data is sent often enough to the distributors so
37
+ * that the pixels do detect a timeout and turn off automatically.
38
+ * The displayer uses a thread to do this.
39
+ * Initially, the new displayer is inactive and has to be activated
40
+ * using flp_displayer_activate().
41
+ *
42
+ * \param[in] sz_config_file name of config file to read
43
+ * \param[in] p_msg_func message callback function or NULL
44
+ * \param[in] p_msg_ctx user context for message callback
45
+ * \return pointer to new FlexiPix displayer on success
46
+ *         or NULL on error
47
+ */
48
+flp_displayer_t *flp_displayer_create(const char *sz_config_file,
49
+                                      flp_msg_func_p_t p_msg_func,
50
+                                      void *p_msg_ctx)
51
+{
52
+  flp_displayer_t *p_displayer;
53
+
54
+  /* set up basic structure and display */
55
+
56
+  /* create displayer structure */
57
+  p_displayer = (flp_displayer_t *)calloc(1, sizeof (flp_displayer_t));
58
+  if (!p_displayer) {
59
+    if (p_msg_func)
60
+      p_msg_func(p_msg_ctx, flp_msg_type_err,
61
+                 "out of memory\n");
62
+    return NULL;
63
+  }
64
+
65
+  /* set up flags */
66
+  p_displayer->active = 0; /* not sending data to distributors */
67
+  p_displayer->send   = 1; /* send first data as soon as active */
68
+  p_displayer->end    = 0; /* do not end yet */
69
+
70
+  /* set up managed display */
71
+  p_displayer->p_display = flp_display_create(sz_config_file,
72
+                                              p_msg_func, p_msg_ctx);
73
+  if (!p_displayer->p_display) {
74
+    free(p_displayer);
75
+    if (p_msg_func)
76
+      p_msg_func(p_msg_ctx, flp_msg_type_err,
77
+                 "could not create display\n");
78
+    return NULL;
79
+  }
80
+
81
+  /* set up output thread */
82
+
83
+  /* initialize mutex */
84
+  if (pthread_mutex_init(&p_displayer->mtx, NULL)) {
85
+    flp_display_free(p_displayer->p_display);
86
+    free(p_displayer);
87
+    if (p_msg_func)
88
+      p_msg_func(p_msg_ctx, flp_msg_type_err,
89
+                 "could not initialize mutex\n");
90
+    return NULL;
91
+  }
92
+
93
+  /* initialize condition */
94
+  if (pthread_cond_init(&p_displayer->cond, NULL)) {
95
+    pthread_mutex_destroy(&p_displayer->mtx);
96
+    flp_display_free(p_displayer->p_display);
97
+    free(p_displayer);
98
+    if (p_msg_func)
99
+      p_msg_func(p_msg_ctx, flp_msg_type_err,
100
+                 "could not initialize condition\n");
101
+    return NULL;
102
+  }
103
+
104
+  /* create thread */
105
+  if (pthread_create(&p_displayer->tid, NULL,
106
+                     flp_displayer_thread, (void *)p_displayer)) {
107
+    pthread_cond_destroy(&p_displayer->cond);
108
+    pthread_mutex_destroy(&p_displayer->mtx);
109
+    flp_display_free(p_displayer->p_display);
110
+    free(p_displayer);
111
+    if (p_msg_func)
112
+      p_msg_func(p_msg_ctx, flp_msg_type_err,
113
+                 "could not create thread\n");
114
+    return NULL;
115
+  }
116
+
117
+  return p_displayer;
118
+}
119
+
120
+/**
121
+ * \brief free a FlexiPix displayer
122
+ *
123
+ * \param[in] p_displayer pointer to FlexiPix displayer
124
+ */
125
+void flp_displayer_free(flp_displayer_t *p_displayer)
126
+{
127
+  /* tear down thread */
128
+  p_displayer->end = 1;
129
+  pthread_cond_signal(&p_displayer->cond);
130
+  pthread_join(p_displayer->tid, NULL);
131
+  pthread_cond_destroy(&p_displayer->cond);
132
+  pthread_mutex_destroy(&p_displayer->mtx);
133
+
134
+  /* free managed display */
135
+  flp_display_free(p_displayer->p_display);
136
+
137
+  /* free basic structure */
138
+  free(p_displayer);
139
+}
140
+
141
+/**
142
+ * \brief get size of display managed by displayer
143
+ *
144
+ * \param[in] p_displayer pointer to FlexiPix displayer
145
+ * \param[out] p_width width of display
146
+ * \param[out] p_height height of display
147
+ */
148
+void flp_displayer_get_size(flp_displayer_t *p_displayer,
149
+                            unsigned int *p_width, unsigned int *p_height)
150
+{
151
+  pthread_mutex_lock(&p_displayer->mtx);
152
+  flp_display_get_size(p_displayer->p_display, p_width, p_height);
153
+  pthread_mutex_unlock(&p_displayer->mtx);
154
+}
155
+
156
+/**
157
+ * \brief activate the displayer
158
+ *
159
+ * set the displayer to active, i.e. make it send image data
160
+ * to the distributors automatically,
161
+ * this function might trigger sending of data if the last
162
+ * sending time was too long ago
163
+ *
164
+ * \param[in] p_displayer pointer to FlexiPix displayer
165
+ */
166
+void flp_displayer_activate(flp_displayer_t *p_displayer)
167
+{
168
+  p_displayer->active = 1;
169
+  pthread_cond_signal(&p_displayer->cond);
170
+}
171
+
172
+/**
173
+ * \brief deactivate the displayer
174
+ *
175
+ * set the displayer to deactive, i.e. prevent it from sening image
176
+ * data to the distributors automatically,
177
+ *
178
+ * \param[in] p_displayer pointer to FlexiPix displayer
179
+ */
180
+void flp_displayer_deactivate(flp_displayer_t *p_displayer)
181
+{
182
+  p_displayer->active = 0;
183
+  /* no need to signal condition: thread does not need to do something yet */
184
+}
185
+
186
+/**
187
+ * \brief clear image data to output on FlexiPix displayer
188
+ *
189
+ * clears the stored image data
190
+ *
191
+ * \param[in] p_displayer pointer to FlexiPix displayer
192
+ */
193
+void flp_displayer_data_clear(flp_displayer_t *p_displayer)
194
+{
195
+  pthread_mutex_lock(&p_displayer->mtx);
196
+  flp_display_data_clear(p_displayer->p_display);
197
+  pthread_mutex_unlock(&p_displayer->mtx);
198
+}
199
+
200
+/**
201
+ * \brief set image data to output on FlexiPix display
202
+ *
203
+ * updates (part of) the stored image data
204
+ *
205
+ * \param[in] p_displayer pointer to FlexiPix displayer
206
+ * \param[in] p_data pointer to rectangular section of image data,
207
+ *                   pixels need to be in R8G8B8 format
208
+ * \param[in] stride_x stride between two pixels in X direction
209
+ * \param[in] stride_y stride between two pixels in Y direction
210
+ * \param[in] x X coordinate of left side of rectangular area
211
+ * \param[in] y Y coordinate of top side of rectangular area
212
+ * \param[in] width with of rectangular area
213
+ * \param[in] height height of rectangular area
214
+ */
215
+void flp_displayer_data(flp_displayer_t *p_displayer, flp_u8_t *p_data,
216
+                        int stride_x, int stride_y,
217
+                        unsigned int x, unsigned int y,
218
+                        unsigned int width, unsigned int height)
219
+{
220
+  pthread_mutex_lock(&p_displayer->mtx);
221
+  flp_display_data(p_displayer->p_display, p_data, stride_x, stride_y,
222
+                   x, y, width, height);
223
+  pthread_mutex_unlock(&p_displayer->mtx);
224
+}
225
+
226
+/**
227
+ * \brief trigger immediate sending of new image data to distributors
228
+ *
229
+ * this only works if the displayer is active
230
+ *
231
+ * \param[in] p_displayer pointer to FlexiPix displayer
232
+ */
233
+void flp_displayer_send(flp_displayer_t *p_displayer)
234
+{
235
+  p_displayer->send = 1;
236
+  pthread_cond_signal(&p_displayer->cond);
237
+}
238
+
239
+#define FLP_MMFI_MS_S (FLP_MCUF_MAX_FRAME_INTERVAL_MS / 1000)
240
+#define FLP_MMFI_MS_US ((FLP_MCUF_MAX_FRAME_INTERVAL_MS % 1000) * 1000)
241
+#define FLP_MMFI_MS_NS ((FLP_MCUF_MAX_FRAME_INTERVAL_MS % 1000) * 1000000)
242
+
243
+/**
244
+ * \brief output thread of displayer object
245
+ *
246
+ * \param[in] vp_displayer pointer to displayer object
247
+ * \return unused, always NULL
248
+ */
249
+void * flp_displayer_thread(void *vp_displayer)
250
+{
251
+  flp_displayer_t *p_displayer = (flp_displayer_t *)vp_displayer;
252
+  struct timeval last, now, delta;
253
+  struct timespec until;
254
+  int timed_send;
255
+
256
+  pthread_mutex_lock(&p_displayer->mtx);
257
+
258
+  gettimeofday(&last, NULL); /* initialize last to some valid time */
259
+
260
+  /* while thread shall not end */
261
+  while (!p_displayer->end) {
262
+
263
+    /* active */
264
+    if (p_displayer->active) {
265
+
266
+      /* get current time */
267
+      gettimeofday(&now, NULL);
268
+      /* get time since sending last frame */
269
+      delta.tv_sec = now.tv_sec - last.tv_sec;
270
+      delta.tv_usec = now.tv_usec - last.tv_usec;
271
+      if (delta.tv_usec < 0) {
272
+        delta.tv_usec += 1000000;
273
+        ++delta.tv_sec;
274
+      }
275
+      /* check if late enough for timed send */
276
+      timed_send = delta.tv_sec > FLP_MMFI_MS_S
277
+                 || (delta.tv_sec == FLP_MMFI_MS_S
278
+                     && delta.tv_usec >= FLP_MMFI_MS_US);
279
+
280
+      /* send if send requested or late enough */
281
+      if (p_displayer->send || timed_send) {
282
+        flp_display_send(p_displayer->p_display); /* send */
283
+        last = now;                               /* remember last send time */
284
+        p_displayer->send = 0;                    /* clear send request */
285
+      }
286
+
287
+      /* sleep until next frame has to be sent */
288
+      until.tv_sec = last.tv_sec + FLP_MMFI_MS_S;
289
+      until.tv_nsec = last.tv_usec * 1000 + FLP_MMFI_MS_NS;
290
+      if (until.tv_nsec > 1000000000) {
291
+        until.tv_nsec -= 1000000000;
292
+        until.tv_sec++;
293
+      }
294
+      pthread_cond_timedwait(&p_displayer->cond, &p_displayer->mtx, &until);
295
+
296
+    } /* if (p_displayer->active) */
297
+
298
+    /* inactive */
299
+    else {
300
+
301
+      /* sleep */
302
+      pthread_cond_wait(&p_displayer->cond, &p_displayer->mtx);
303
+
304
+    } /* if (p_displayer->active) ... else */
305
+
306
+  } /* while(!p_displayer->end) */
307
+
308
+  pthread_mutex_unlock(&p_displayer->mtx);
309
+
310
+  return NULL;
311
+}
312
+
... ...
@@ -0,0 +1,37 @@
1
+/*
2
+ * FlexiPix library
3
+ * !version: 1.0.0! !date: 2010-07-31!
4
+ *
5
+ * Copyright 2010 Stefan Schuermans <stefan schuermans info>
6
+ *
7
+ * This program is free software: you can redistribute it and/or modify
8
+ * it under the terms of the GNU General Public License as published by
9
+ * the Free Software Foundation, version 3 of the License.
10
+ *
11
+ *
12
+ * This program is distributed in the hope that it will be useful,
13
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
+ * GNU General Public License for more details.
16
+ *
17
+ * You should have received a copy of the GNU Lesser General Public License
18
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
19
+ */
20
+
21
+#include <flexipix/info.h>
22
+
23
+/**
24
+ * \brief get version of the library
25
+ *
26
+ * \param[out] p_major major version
27
+ * \param[out] p_minor minor version
28
+ * \param[out] p_revision revision number
29
+ */
30
+void flp_get_version(unsigned int *p_major, unsigned int *p_minor,
31
+                     unsigned int *p_revision)
32
+{
33
+  *p_major = FLP_VER_MAJ;
34
+  *p_minor = FLP_VER_MIN;
35
+  *p_revision = FLP_VER_REV;
36
+}
37
+
... ...
@@ -0,0 +1,54 @@
1
+/*
2
+ * FlexiPix library
3
+ * !version: 1.0.0! !date: 2010-07-31!
4
+ *
5
+ * Copyright 2010 Stefan Schuermans <stefan schuermans info>
6
+ *
7
+ * This program is free software: you can redistribute it and/or modify
8
+ * it under the terms of the GNU General Public License as published by
9
+ * the Free Software Foundation, version 3 of the License.
10
+ *
11
+ *
12
+ * This program is distributed in the hope that it will be useful,
13
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
+ * GNU General Public License for more details.
16
+ *
17
+ * You should have received a copy of the GNU Lesser General Public License
18
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
19
+ */
20
+
21
+#include <math.h>
22
+
23
+#include <flexipix/types.h>
24
+#include <intern/mapping.h>
25
+#include <intern/types.h>
26
+
27
+/**
28
+ * \brief precalculate mapping table
29
+ *
30
+ * updates the internal lookup table according to the parameters
31
+ *
32
+ * \param[in,out] p_mapping mapping to precalculate
33
+ */
34
+void flp_mapping_precalc(flp_mapping_t *p_mapping)
35
+{
36
+  double gamma_1;
37
+  int v;
38
+
39
+  /* precalculate 1 / gamma */
40
+  gamma_1 = 1.0 / p_mapping->gamma;
41
+
42
+  /* map all values */
43
+  for (v = 0; v < 256; v++) {
44
+    double val = p_mapping->base
45
+               + p_mapping->factor * pow((double)v / 255.0, gamma_1);
46
+    if (val < 0.0)
47
+      p_mapping->table[v] = 0;
48
+    else if (val > 1.0)
49
+      p_mapping->table[v] = 255;
50
+    else
51
+      p_mapping->table[v] = (flp_u8_t)(val * 255.0 + 0.5);
52
+  }
53
+}
54
+
... ...
@@ -0,0 +1,123 @@
1
+/*
2
+ * FlexiPix library
3
+ * !version: 1.0.0! !date: 2010-07-31!
4
+ *
5
+ * Copyright 2010 Stefan Schuermans <stefan schuermans info>
6
+ *
7
+ * This program is free software: you can redistribute it and/or modify
8
+ * it under the terms of the GNU General Public License as published by
9
+ * the Free Software Foundation, version 3 of the License.
10
+ *
11
+ *
12
+ * This program is distributed in the hope that it will be useful,
13
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
+ * GNU General Public License for more details.
16
+ *
17
+ * You should have received a copy of the GNU Lesser General Public License
18
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
19
+ */
20
+
21
+#include <stdlib.h>
22
+#include <string.h>
23
+
24
+#include <intern/net.h>
25
+#include <intern/parse.h>
26
+
27
+/**
28
+ * \brief parse two comma-separated numbers
29
+ *
30
+ * \param[in] text text to parse
31
+ * \param[out] no1 first number parsed from text
32
+ * \param[out] no2 second number parsed from text
33
+ * \param[out] end location in text where parsing ended
34
+ * \return 0 in case of success, -1 in case of error
35
+ */
36
+int flp_parse_two_nos(char *text, unsigned int *no1, unsigned int *no2,
37
+                      char **end)
38
+{
39
+  char *ptr1, *ptr2;
40
+  unsigned long val1, val2;
41
+
42
+  /* parse first number */
43
+  val1 = strtoul(text, &ptr1, 0);
44
+  if (ptr1 == text || *ptr1 != ',')
45
+    return -1;
46
+
47
+  /* skip comma */
48
+  ptr1++;
49
+
50
+  /* parse second number */
51
+  val2 = strtoul(ptr1, &ptr2, 0);
52
+  if (ptr2 == ptr1
53
+      || (*ptr2 != 0 && *ptr2 != ' ' && *ptr2 != '\t' && *ptr2 != '\r'
54
+          && *ptr2 != '\n'))
55
+    return -1;
56
+
57
+  /* return numbers and pointer behind end */
58
+  *no1 = (unsigned int)val1;
59
+  *no2 = (unsigned int)val2;
60
+  *end = ptr2;
61
+  return 0;
62
+}
63
+
64
+/**
65
+ * \brief parse an address
66
+ *
67
+ * \param[in] test test to parse
68
+ * \param[out] addr address parsed from text
69
+ * \return 0 in case of success, -1 in case of error
70
+ */
71
+int flp_parse_addr(char *text, struct sockaddr_in *addr)
72
+{
73
+  char *p_colon, *p_host, *p_port, *p_port_end;
74
+  in_addr_t ip;
75
+  unsigned long port;
76
+  struct hostent *p_hostent;
77
+
78
+  /* split address into IP and port */
79
+  p_colon = strchr(text, ':');
80
+  if (p_colon) {
81
+    *p_colon = 0;
82
+    p_host = text;
83
+    p_port = p_colon + 1;
84
+  } else {
85
+    p_host = text;
86
+    p_port = text + strlen(text);
87
+  }
88
+
89
+  /* parse host */
90
+  ip = inet_addr(p_host);
91
+  if (ip == htonl(INADDR_NONE)) {
92
+    /* try to resolve host */
93
+    p_hostent = gethostbyname(p_host);
94
+    if (!p_hostent || !p_hostent->h_addr_list || !p_hostent->h_addr_list[0]) {
95
+      /* restore text before leaving */
96
+      if (p_colon)
97
+        *p_colon = ':';
98
+      return -1;
99
+    }
100
+    ip = *(in_addr_t *)p_hostent->h_addr_list[0];
101
+  }
102
+
103
+  /* parse port */
104
+  port = strtoul(p_port, &p_port_end, 0);
105
+  if (*p_port_end ||   /* not all characters of port were valid */
106
+      port > 65535) {  /* invalid port number */
107
+    /* restore text before leaving */
108
+    if (p_colon)
109
+      *p_colon = ':';
110
+    return -1;
111
+  }
112
+
113
+  /* construct address */
114
+  addr->sin_family = AF_INET;
115
+  addr->sin_port = htons((in_port_t) port);
116
+  addr->sin_addr.s_addr = ip;
117
+
118
+  /* restore text before leaving */
119
+  if (p_colon)
120
+    *p_colon = ':';
121
+  return 0;
122
+}
123
+
0 124