1 /*
2 WARNING: This file was generated by the dkct program (see
3 http://dktools.sourceforge.net/ for details).
4 Changes you make here will be lost if dkct is run again!
5 You should modify the original source and run dkct on it.
6 Original source: test-gra.ctr
7 */
8
9 /** @file test-gra.c The test-gra module.
10 */
11
12
13 /** Choose between normal image inclusion and fig style.
14 */
15 #define USE_FIG_STYLE 0
16
17
18
19 #include "dk4conf.h"
20
21 #define _CRT_SECURE_NO_WARNINGS 1
22 #include <stdio.h>
23
24 #if DK4_HAVE_STDLIB_H
25 #ifndef STDLIB_H_INCLUDED
26 #include <stdlib.h>
27 #define DK4_HAVE_STDLIB_H 1
28 #endif
29 #endif
30
31 #include <libdk4graa/dk4graa.h>
32 #include <libdk4lata/dk4uc2la.h>
33 #include <libdk4base/dk4vers.h>
34 #include <libdk4c/dk4enc.h>
35
36
37
38
39
40 /** Patter number to use.
41 */
42 enum { PATNO = DK4_GRA_PATTERN_LARGE_FISH_SCALES } ;
43
44
45 /** Type of output file to produce.
46 */
47 static const int dr = DK4_GRA_DRIVER_PGF;
48
49
50 /** Language level when producing PostScript.
51 */
52 static const int psll = 2;
53
54
55 /** Write DSC comments when producing PostScript.
56 */
57 static const int psdsc = 1;
58
59
60 /** Create standalone file when producing PGF.
61 */
62 static const int pgfsa = 1;
63
64
65 /** Allow colored images.
66 */
67 static int acol = 1;
68
69
70 /** Application structure.
71 */
72 static dk4_app_t *app = NULL;
73
74
75 /** Unicode to LaTeX conversion structure.
76 */
77 static dk4_uc2l_t *uc2l = NULL;
78
79
80 /** Exit status code for main function.
81 */
82 static int exval = EXIT_FAILURE;
83
84
85 static
86 void
draw_elements(void)87 draw_elements(void)
88 {
89 dk4_bb_t bb;
90 dk4_gra_t *gra = NULL;
91 int ok = 0;
92 int psfl = 0;
93 int imgfl = 0;
94
95 if (2 == psll) {
96 psfl |= DK4_GRA_DOC_FLAG_PS2;
97 }
98 if (0 != psdsc) {
99 psfl |= DK4_GRA_DOC_FLAG_PS_DSC;
100 }
101 if (0 == acol) {
102 psfl |= DK4_GRA_DOC_FLAG_FORCE_GRAY;
103 }
104 if (0 != acol) {
105 imgfl |= DK4_GRA_IMG_FLAG_COLOR;
106 }
107 imgfl |= DK4_GRA_IMG_FLAG_INTERPOLATION;
108 imgfl |= DK4_GRA_IMG_FLAG_LZW;
109 imgfl |= DK4_GRA_IMG_FLAG_DCT;
110 imgfl |= DK4_GRA_IMG_FLAG_DCT_INTERPOLATION;
111 imgfl |= DK4_GRA_IMG_FLAG_ANALYZE_BPC;
112 imgfl |= DK4_GRA_IMG_FLAG_ANALYZE_COLOR;
113 imgfl |= DK4_GRA_IMG_FLAG_ANALYZE_ALPHA;
114 /* Open graphics.
115 */
116 switch (dr) {
117 case DK4_GRA_DRIVER_PDF : {
118 gra = dk4gra_app_open_pdf(dkT("test-gra.pdf"), 595, 842, psfl, app);
119 } break;
120 case DK4_GRA_DRIVER_EPS : {
121 psfl |= DK4_GRA_DOC_FLAG_EPS;
122 gra = dk4gra_app_open_ps(dkT("test-gra.eps"), 595, 842, psfl, app);
123 } break;
124 case DK4_GRA_DRIVER_PS : {
125 gra = dk4gra_app_open_ps(dkT("test-gra.ps"), 595, 842, psfl, app);
126 } break;
127 case DK4_GRA_DRIVER_PGF : {
128 gra = dk4gra_app_open_pgf(dkT("test-gra.tex"), 595, 842, psfl, pgfsa, app);
129 } break;
130 }
131 if (NULL == gra) {
132
133 goto finished;
134 }
135
136 ok = 1;
137
138 dk4gra_set_pattern_line_width(gra, 0.45);
139 dk4gra_app_set_gs_for_pattern_only(gra, 1, app);
140
141 /* Start new page.
142 */
143 dk4gra_app_page(gra, &ok, app);
144 if (0 == ok) {
145
146 goto finished;
147 }
148
149 dk4gra_app_set_line_width(gra, 0.9, &ok, app);
150 dk4gra_app_set_line_style(gra, DK4_GRA_LS_SOLID, 0.0, &ok, app);
151 dk4gra_app_set_line_cap(gra, DK4_GRA_LC_BUTTED, &ok, app);
152 dk4gra_app_set_line_join(gra, DK4_GRA_LJ_MITERED, 5.0, &ok, app);
153 dk4gra_app_set_stroke_rgb(gra, 0.75, 0.0, 0.0, &ok, app);
154 dk4gra_app_set_fill_rgb(gra, 0.0, 0.75, 0.0, &ok, app);
155
156 dk4gra_app_set_line_width(gra, 1.8, &ok, app);
157 dk4gra_app_prepare_stroke(gra, &ok, app);
158 dk4gra_app_newpath_moveto(gra, 10.0, 10.0, NULL, &ok, app);
159 dk4gra_app_lineto(gra, 50.0, 10.0, NULL, &ok, app);
160 dk4gra_app_lineto(gra, 50.0, 50.0, NULL, &ok, app);
161 dk4gra_app_closepath(gra, &ok, app);
162 dk4gra_app_stroke(gra, &ok, app);
163
164 dk4gra_app_prepare_stroke(gra, &ok, app);
165 dk4gra_app_newpath_moveto(gra, 10.0, 832.0, NULL, &ok, app);
166 dk4gra_app_lineto(gra, 585.0, 832.0, NULL, &ok, app);
167 dk4gra_app_stroke(gra, &ok, app);
168
169 dk4gra_app_set_line_style(gra, DK4_GRA_LS_DASH, 4.0, &ok, app);
170 dk4gra_app_prepare_stroke(gra, &ok, app);
171 dk4gra_app_newpath_moveto(gra, 10.0, 822.0, NULL, &ok, app);
172 dk4gra_app_lineto(gra, 585.0, 822.0, NULL, &ok, app);
173 dk4gra_app_stroke(gra, &ok, app);
174
175 dk4gra_app_set_line_style(gra, DK4_GRA_LS_DOT, 4.0, &ok, app);
176 dk4gra_app_prepare_stroke(gra, &ok, app);
177 dk4gra_app_newpath_moveto(gra, 10.0, 812.0, NULL, &ok, app);
178 dk4gra_app_lineto(gra, 585.0, 812.0, NULL, &ok, app);
179 dk4gra_app_stroke(gra, &ok, app);
180
181 dk4gra_app_set_line_style(gra, DK4_GRA_LS_DASH_DOT, 4.0, &ok, app);
182 dk4gra_app_prepare_stroke(gra, &ok, app);
183 dk4gra_app_newpath_moveto(gra, 10.0, 802.0, NULL, &ok, app);
184 dk4gra_app_lineto(gra, 585.0, 802.0, NULL, &ok, app);
185 dk4gra_app_stroke(gra, &ok, app);
186
187 dk4gra_app_set_line_style(gra, DK4_GRA_LS_DASH_DOT_DOT, 4.0, &ok, app);
188 dk4gra_app_prepare_stroke(gra, &ok, app);
189 dk4gra_app_newpath_moveto(gra, 10.0, 792.0, NULL, &ok, app);
190 dk4gra_app_lineto(gra, 585.0, 792.0, NULL, &ok, app);
191 dk4gra_app_stroke(gra, &ok, app);
192
193 dk4gra_app_set_line_style(gra, DK4_GRA_LS_DASH_DOT_DOT_DOT, 4.0, &ok, app);
194 dk4gra_app_prepare_stroke(gra, &ok, app);
195 dk4gra_app_newpath_moveto(gra, 10.0, 782.0, NULL, &ok, app);
196 dk4gra_app_lineto(gra, 585.0, 782.0, NULL, &ok, app);
197 dk4gra_app_stroke(gra, &ok, app);
198
199 dk4gra_app_set_line_style(gra, DK4_GRA_LS_SOLID, 4.0, &ok, app);
200 dk4gra_app_prepare_stroke(gra, &ok, app);
201 dk4gra_app_newpath_moveto(gra, 10.0, 772.0, NULL, &ok, app);
202 dk4gra_app_lineto(gra, 585.0, 772.0, NULL, &ok, app);
203 dk4gra_app_stroke(gra, &ok, app);
204
205 dk4gra_app_set_stroke_gray(gra, 0.0, &ok, app);
206 dk4gra_app_set_fill_gray(gra, 0.75, &ok, app);
207
208 #if 0
209 dk4gra_app_prepare_stroke(gra, app);
210 dk4gra_app_ellipse(gra, 297.5, 400, 200, 100, 30, NULL, app);
211 dk4gra_app_stroke(gra, app);
212 #endif
213
214 dk4bb_init(&bb);
215 dk4gra_app_prepare_fill(gra, &ok, app);
216 dk4gra_app_ellipse(gra, 297.5, 400, 200, 100, 30, &bb, &ok, app);
217 dk4gra_app_fill(gra, &ok, app);
218 dk4gra_app_gsave(gra, &ok, app);
219 dk4gra_app_ellipse(gra, 297.5, 400, 200, 100, 30, NULL, &ok, app);
220 dk4gra_app_clip(gra, &ok, app);
221 dk4gra_app_pattern(gra, bb.xmin, bb.xmax, bb.ymin, bb.ymax, PATNO, &ok, app);
222 dk4gra_app_grestore(gra, &ok, app);
223 dk4gra_app_prepare_stroke(gra, &ok, app);
224 dk4gra_app_ellipse(gra, 297.5, 400, 200, 100, 30, NULL, &ok, app);
225 dk4gra_app_stroke(gra, &ok, app);
226
227 dk4gra_app_set_stroke_rgb(gra, 0.0, 0.0, 0.5, &ok, app);
228 dk4gra_app_set_fill_rgb(gra, 1.0, 0.0, 0.0, &ok, app);
229 dk4bb_init(&bb);
230 dk4gra_app_prepare_fill(gra, &ok, app);
231 dk4gra_app_circle(gra, 297.5, 400, 75.0, &bb, &ok, app);
232 dk4gra_app_fill(gra, &ok, app);
233 dk4gra_app_gsave(gra, &ok, app);
234 dk4gra_app_circle(gra, 297.5, 400, 75.0, &bb, &ok, app);
235 dk4gra_app_clip(gra, &ok, app);
236 dk4gra_app_pattern(gra, bb.xmin, bb.xmax, bb.ymin, bb.ymax, PATNO, &ok, app);
237 dk4gra_app_grestore(gra, &ok, app);
238
239 dk4gra_app_prepare_stroke(gra, &ok, app);
240 dk4gra_app_rectangle(gra, 100, 300, 150, 250, 30, NULL, &ok, app);
241 dk4gra_app_stroke(gra, &ok, app);
242
243 dk4gra_app_prepare_stroke(gra, &ok, app);
244 dk4gra_app_rectangle(gra, 400, 570, 150, 250, 0.0, NULL, &ok, app);
245 dk4gra_app_stroke(gra, &ok, app);
246
247 #if 0
248 dk4gra_app_prepare_stroke(gra, app);
249 dk4gra_app_circle(gra, 299.5, 400, 75.0, &bb, app);
250 dk4gra_app_stroke(gra, app);
251 #endif
252
253
254
255
256 dk4gra_app_set_line_width(gra, 0.9, &ok, app);
257 dk4gra_app_set_line_style(gra, DK4_GRA_LS_SOLID, 0.0, &ok, app);
258 dk4gra_app_set_line_cap(gra, DK4_GRA_LC_BUTTED, &ok, app);
259 dk4gra_app_set_line_join(gra, DK4_GRA_LJ_MITERED, 5.0, &ok, app);
260 dk4gra_app_set_stroke_rgb(gra, 0.75, 0.0, 0.0, &ok, app);
261 dk4gra_app_set_fill_rgb(gra, 0.75, 0.75, 1.0, &ok, app);
262 #if 0
263 dk4gra_app_set_line_width(gra, 1.8, &ok, app);
264 #endif
265
266 if (0 != dk4gra_can_fill_and_stroke(gra)) {
267 dk4gra_app_prepare_fill_and_stroke(gra, &ok, app);
268 dk4gra_app_newpath_moveto(gra, 300.0, 10.0, NULL, &ok, app);
269 dk4gra_app_lineto(gra, 500.0, 10.0, NULL, &ok, app);
270 dk4gra_app_lineto(gra, 500.0, 110.0, NULL, &ok, app);
271 dk4gra_app_lineto(gra, 300.0, 110.0, NULL, &ok, app);
272 dk4gra_app_closepath(gra, &ok, app);
273 dk4gra_app_fill_and_stroke(gra, &ok, app);
274 }
275 else {
276 dk4gra_app_prepare_fill(gra, &ok, app);
277 dk4gra_app_newpath_moveto(gra, 300.0, 10.0, NULL, &ok, app);
278 dk4gra_app_lineto(gra, 500.0, 10.0, NULL, &ok, app);
279 dk4gra_app_lineto(gra, 500.0, 110.0, NULL, &ok, app);
280 dk4gra_app_lineto(gra, 300.0, 110.0, NULL, &ok, app);
281 dk4gra_app_closepath(gra, &ok, app);
282 dk4gra_app_fill(gra, &ok, app);
283
284 dk4gra_app_prepare_stroke(gra, &ok, app);
285 dk4gra_app_newpath_moveto(gra, 300.0, 10.0, NULL, &ok, app);
286 dk4gra_app_lineto(gra, 500.0, 10.0, NULL, &ok, app);
287 dk4gra_app_lineto(gra, 500.0, 110.0, NULL, &ok, app);
288 dk4gra_app_lineto(gra, 300.0, 110.0, NULL, &ok, app);
289 dk4gra_app_closepath(gra, &ok, app);
290 dk4gra_app_stroke(gra, &ok, app);
291 }
292
293
294
295 #if 1
296
297 /* Test embedded image.
298 */
299 #if USE_FIG_STYLE
300 dk4gra_app_fig_image(
301 #else
302 dk4gra_app_image(
303 #endif
304 gra /* output */ ,
305 50 /* x left */ ,
306 300 /* x right */ ,
307 525 /* y bottom */ ,
308 725 /* y top */ ,
309 dkT("../test-data/png/fbt.png") /* file name */ ,
310 0 /* frame number */ ,
311 NULL /* conversion context */ ,
312 #if USE_FIG_STYLE
313 0 /* Position */ ,
314 #endif
315 imgfl /* Image flags */ ,
316 NULL /* keep track of bounding box */ ,
317 &ok /* Success variable */ ,
318 app /* application */
319 );
320
321 #endif
322
323
324
325 #if 1
326
327 /* Test embedded image.
328 */
329 #if USE_FIG_STYLE
330 dk4gra_app_fig_image
331 #else
332 dk4gra_app_image(
333 #endif
334 gra /* output */ ,
335 350 /* x left */ ,
336 400 /* x right */ ,
337 625 /* y bottom */ ,
338 725 /* y top */ ,
339 dkT("../test-data/png/fbt.png") /* file name */ ,
340 0 /* frame number */ ,
341 NULL /* conversion context */ ,
342 #if USE_FIG_STYLE
343 0 /* Position */ ,
344 #endif
345 imgfl /* Image flags */ ,
346 NULL /* keep track of bounding box */ ,
347 &ok /* Success variable */ ,
348 app /* application */
349 );
350
351
352
353 #if 1
354
355 /* Test embedded image.
356 */
357 #if USE_FIG_STYLE
358 dk4gra_app_fig_image
359 #else
360 dk4gra_app_image(
361 #endif
362 gra /* output */ ,
363 350 /* x left */ ,
364 400 /* x right */ ,
365 225 /* y bottom */ ,
366 325 /* y top */ ,
367 dkT("/home/krause/work/dk4bif/1204uprecise.jpg") /* file name */ ,
368 0 /* frame number */ ,
369 NULL /* conversion context */ ,
370 #if USE_FIG_STYLE
371 0 /* Position */ ,
372 #endif
373 imgfl /* Image flags */ ,
374 NULL /* keep track of bounding box */ ,
375 &ok /* Success variable */ ,
376 app /* application */
377 );
378
379 #endif
380
381
382 #if 1
383
384 /* Test embedded image.
385 */
386 #if USE_FIG_STYLE
387 dk4gra_app_fig_image
388 #else
389 dk4gra_app_image(
390 #endif
391 gra /* output */ ,
392 50 /* x left */ ,
393 200 /* x right */ ,
394 225 /* y bottom */ ,
395 325 /* y top */ ,
396 dkT("/home/krause/work/dk4bif/1204uprecise.jpg") /* file name */ ,
397 0 /* frame number */ ,
398 NULL /* conversion context */ ,
399 #if USE_FIG_STYLE
400 0 /* Position */ ,
401 #endif
402 imgfl /* Image flags */ ,
403 NULL /* keep track of bounding box */ ,
404 &ok /* Success variable */ ,
405 app /* application */
406 );
407
408 #endif
409
410
411 #if 1
412
413 /* Test embedded image.
414 */
415 if (DK4_GRA_DRIVER_PGF != dr) {
416 #if USE_FIG_STYLE
417 dk4gra_app_fig_image
418 #else
419 dk4gra_app_image(
420 #endif
421 gra /* output */ ,
422 100 /* x left */ ,
423 200 /* x right */ ,
424 10 /* y bottom */ ,
425 210 /* y top */ ,
426 #if 1
427 dkT("../test-data/netpbm/testimg.ppm") /* file name */ ,
428 #else
429 NULL ,
430 #endif
431 0 /* frame number */ ,
432 NULL /* conversion context */ ,
433 #if USE_FIG_STYLE
434 0 /* Position */ ,
435 #endif
436 imgfl /* Image flags */ ,
437 NULL /* keep track of bounding box */ ,
438 &ok /* Success variable */ ,
439 app /* application */
440 );
441 }
442
443 #endif
444
445
446 #if 1
447
448 /* Test embedded image.
449 */
450 if (DK4_GRA_DRIVER_PGF != dr) {
451 #if USE_FIG_STYLE
452 dk4gra_app_fig_image
453 #else
454 dk4gra_app_image(
455 #endif
456 gra /* output */ ,
457 320 /* x left */ ,
458 360 /* x right */ ,
459 20 /* y bottom */ ,
460 60 /* y top */ ,
461 #if 1
462 dkT("../test-data/netpbm/unusual.pgm") /* file name */ ,
463 #else
464 NULL ,
465 #endif
466 0 /* frame number */ ,
467 NULL /* conversion context */ ,
468 #if USE_FIG_STYLE
469 0 /* Position */ ,
470 #endif
471 imgfl /* Image flags */ ,
472 NULL /* keep track of bounding box */ ,
473 &ok /* Success variable */ ,
474 app /* application */
475 );
476 }
477
478 #endif
479
480
481 #endif
482
483 dk4gra_app_prepare_stroke(gra, &ok, app);
484 dk4gra_app_arc(gra, 400, 600, 100, 5, 85, 0, NULL, &ok, app);
485 dk4gra_app_stroke(gra, &ok, app);
486
487 dk4gra_app_prepare_stroke(gra, &ok, app);
488 dk4gra_app_arc(gra, 400, 700, 100, 5, 85, 1, NULL, &ok, app);
489 dk4gra_app_stroke(gra, &ok, app);
490
491
492 dk4gra_app_set_line_width(gra, 0.45, &ok, app);
493 dk4gra_app_prepare_stroke(gra, &ok, app);
494 dk4gra_app_newpath_moveto(gra, 400.0, 600.0, NULL, &ok, app);
495 dk4gra_app_lineto(gra, 500.0, 600.0, NULL, &ok, app);
496 dk4gra_app_stroke(gra, &ok, app);
497
498 if (DK4_GRA_DRIVER_PGF == dr) {
499 #if 0
500 dk4gra_pgf_doc_font_size(gra, 9.5, &ok, NULL);
501 dk4gra_pgf_doc_preamble_line(
502 gra,
503 "\\usepackage{mathptmx}",
504 DK4_GRA_PREAMBLE_FONT, &ok, NULL
505 );
506 dk4gra_pgf_doc_preamble_line(
507 gra,
508 "\\usepackage{helvet}",
509 DK4_GRA_PREAMBLE_FONT, &ok, NULL
510 );
511 dk4gra_pgf_doc_preamble_line(
512 gra,
513 "\\usepackage{microtype}",
514 DK4_GRA_PREAMBLE_PACKAGE, &ok, NULL
515 );
516 dk4gra_pgf_doc_preamble_line(
517 gra,
518 "\\DeclareMathOperator{\\intd}{\\text{d}}",
519 DK4_GRA_PREAMBLE_OTHER, &ok, NULL
520 );
521 #endif
522 #if 1
523 dk4gra_app_set_fill_rgb(gra, 0.0, 0.0, 0.0, &ok, app);
524 dk4gra_app_pgf_simple_text(
525 gra, 450.0, 600.0, 0.0,
526 dkT("a,bg"), NULL, DK4_ENCODING_UTF8,
527 DK4_TEXT_ALIGN_H_CENTERED, DK4_TEXT_ALIGN_V_BASELINE,
528 0, 36.0, DK4_GRA_TF_NONE_NONE, uc2l, 0, &ok, app
529 );
530 #endif
531 #if 1
532 dk4gra_app_pgf_simple_text(
533 gra, 200.0, 180.0, 0.0,
534 dkT("Dies ist ein Test mit äöüÄÖÜß."), NULL, DK4_ENCODING_UTF8,
535 DK4_TEXT_ALIGN_H_LEFT, DK4_TEXT_ALIGN_V_BASELINE,
536 0, 12.0, DK4_GRA_TF_NONE_NONE, uc2l, 0, &ok, app
537 );
538 #endif
539 #if 1
540 dk4gra_app_pgf_simple_text(
541 gra, 200.0, 250.0, 0.0,
542 dkT("Dies ist noch ein Test."), NULL, DK4_ENCODING_UTF8,
543 DK4_TEXT_ALIGN_H_LEFT, DK4_TEXT_ALIGN_V_BASELINE,
544 0, 12.0, DK4_GRA_TF_EXACT_SIZE, uc2l, 0, &ok, app
545 );
546 #endif
547 #if 1
548 dk4gra_app_pgf_special_text(
549 gra, 200.0, 200.0, 30.0,
550 "\\(c^2=a^2+b^2+\\sqrt{d}\\)", NULL,
551 DK4_TEXT_ALIGN_H_RIGHT, DK4_TEXT_ALIGN_V_BASELINE,
552 0, 12.0, DK4_GRA_TF_NONE_NONE, 0, &ok, app
553 );
554 #endif
555 }
556
557 /* Produce output.
558 */
559 dk4gra_app_write_and_close(gra, &ok, NULL);
560 if (0 != ok) {
561 exval = EXIT_SUCCESS;
562 }
563 else {
564 }
565 gra = NULL;
566
567 /* Cleanup
568 */
569 finished:
570 if (NULL != gra) {
571 dk4gra_close(gra);
572 }
573
574 }
575
576
577 /** License terms.
578 */
579 static const dkChar * const testgra_license[] = {
580 /* 0 */
581 dkT("List of license terms."),
582
583 NULL
584
585 };
586
587
588 /** Help text.
589 */
590 static const dkChar * const testgra_help[] = {
591 /* 0 */
592 dkT(""),
593
594 /* 1 */
595 dkT("Test PPPT library."),
596
597 /* 2 */
598 dkT(""),
599
600 /* 3 */
601 dkT("testpppt [options]"),
602
603 /* 4 */
604 dkT(""),
605
606 /* 5 */
607 dkT("Options:"),
608
609 /* 6 */
610 dkT("-R\t\t\tReset (ignore preferences)."),
611
612 /* 7 */
613 dkT("-l <string>\t\tOutput language and options."),
614
615 /* 8 */
616 dkT(""),
617
618 NULL
619
620 };
621
622
623 /** Text keywords, no localized.
624 */
625 static const dkChar * const testgra_kwnl[] = {
626 /* 0 */
627 dkT("dktools"),
628
629 /* 1 */
630 dkT("testgra.txt"),
631
632 NULL
633
634 };
635
636
637 /** Options recognized by the program.
638 */
639 static const dk4_option_specification_t testgra_options[] = {
640 { dkT('R'), dkT("reset"), DK4_OPT_ARG_NONE },
641 { dkT('l'), dkT("language"), DK4_OPT_ARG_STRING }
642 };
643
644
645
646 /** Number of elements in testgra_options array.
647 */
648 size_t sz_testgra_options =
649 sizeof(testgra_options)/sizeof(dk4_option_specification_t);
650
651
652
653 /** The main function.
654 @param argc Number of command line arguments.
655 @param argv Command line arguments array.
656 @return EXIT_SUCCESS on success, EXIT_FAILURE on error.
657 */
658 #if DK4_CHAR_SIZE > 1
659 int
wmain(int argc,wchar_t * argv[])660 wmain(int argc, wchar_t *argv[])
661 #else
662 int
663 main(int argc, char *argv[])
664 #endif
665 {
666
667
668
669 app = dk4app_open_cmd(
670 argc, argv, testgra_options, sz_testgra_options,
671 testgra_kwnl[0], DKT_VERSION_DK, testgra_kwnl[1],
672 testgra_help, testgra_license
673 );
674 if (NULL != app) {
675 if (0 != dk4app_can_run_normally(app)) {
676 uc2l =
677 dk4uc2l_open_app_ex1(dkT("/usr/share/dktools/charmap"), app, 1);
678 if (NULL != uc2l) {
679 draw_elements();
680 dk4uc2l_close(uc2l);
681 }
682 else {
683 }
684 }
685 else {
686 if (0 != dk4app_help_version_license(app)) {
687 exval = EXIT_SUCCESS;
688 }
689 }
690 dk4app_close(app);
691 }
692 else {
693 }
694
695
696 return exval;
697 }
698
699
700 /* vim: set ai sw=4 ts=4 : */
701