Debian Codegraph @

src/lib/helper/renderer/check_renderer_default.c

raw
1 /* 'checkit_tiff' is a conformance checker for baseline TIFFs
2 *
3 * author: Andreas Romeyke, 2015-2022
4 * licensed under conditions of libtiff
5 * (see http://libtiff.maptools.org/misc.html)
6 *
7 */
8
9 #include "check_renderer.h"
10 #include "ctstring.h"
11 #include <assert.h>
12
13
14 stringbuf_t renderer_default ( const retmsg_t * ret ) {
15 assert (ret != NULL);
16 stringbuf_t res = empty_stringbuf();
17 const retmsg_t * startp = ret;
18 rc_tristate_t rc_is_valid = rc_undef;
19 // print header
20 res = secstrcat_cstr(res, "\n");
21 res = secstrcat_cstr(res, "result IFD/tag \t--> rule description [; ");
22 res = secstrcat_cstr(res, "expected specific values");
23 res = secstrcat_cstr(res, "] [");
24 res = secstrcat_cstr(res, "error description");
25 res = secstrcat_cstr(res, "] ");
26 res = secstrcat_cstr(res, "(lineno in config)");
27 res = secstrcat_cstr(res, "\n");
28 res = secstrcat_cstr( res, "----------------------------------------------------------------------------\n");
29 while (NULL != startp) {
30 if (startp->rm_type == rm_is_valid) {rc_is_valid = rc_valid;}
31 else if (startp->rm_type == rm_error || startp->rm_type == rm_hard_error) {rc_is_valid = rc_invalid;;}
32 if ( check_if_quiet(startp, rc_is_valid) ) { /*do nothing */ }
33 else {
34 switch (startp->rm_type) {
35 case rm_rule:
36 res = secstrcat_cstr(res, "\t--> ");
37 res = secstrcat_string(res, startp->rm_msg);
38 break;
39 case rm_tag:
40 case rm_mode:
41 res = secstrcat_cstr(res, "\t");
42 res = secstrcat_string(res, startp->rm_msg);
43 break;
44 case rm_value:
45 if (startp->rm_msg.len > 0) {
46 res = secstrcat_cstr(res, "; found: ");
47 res = secstrcat_string(res, startp->rm_msg);
48 }
49 break;
50 case rm_expected:
51 if (startp->rm_msg.len > 0) {
52 res = secstrcat_cstr(res, "; expected: ");
53 res = secstrcat_string(res, startp->rm_msg);
54 }
55 break;
56 case rm_hard_error:
57 res = secstrcat_cstr(res, "(HE)");
58 res = secstrcat_string(res, startp->rm_msg);
59 break;
60 case rm_error:
61 res = secstrcat_cstr(res, "(EE)");
62 res = secstrcat_string(res, startp->rm_msg);
63 break;
64 case rm_error_description:
65 res = secstrcat_cstr(res, " ");
66 res = secstrcat_string(res, startp->rm_msg);
67 break;
68 case rm_warning:
69 res = secstrcat_cstr(res, "(WW)");
70 res = secstrcat_string(res, startp->rm_msg);
71 break;
72 case rm_logicalor_error:
73 res = secstrcat_cstr(res, "(LE)");
74 res = secstrcat_string(res, startp->rm_msg);
75 break;
76 case rm_file:
77 res = secstrcat_cstr(res, "file: ");
78 res = secstrcat_string(res, startp->rm_msg);
79 res = secstrcat_cstr(res, "\n");
80 break;
81 case rm_lineno:
82 res = secstrcat_cstr(res, " (lineno: ");
83 res = secstrcat_string(res, startp->rm_msg);
84 res = secstrcat_cstr(res, ")");
85 break;
86 case rm_endrule:
87 case rm_endtiff:
88 res = secstrcat_cstr(res, "\n");
89 rc_is_valid = rc_undef;;
90 break;
91 case rm_is_valid:
92 res = secstrcat_cstr(res, "(./)");
93 rc_is_valid = rc_valid;
94 break;
95 case rm_count_valid:
96 res = secstrcat_string(res, startp->rm_msg);
97 res = secstrcat_cstr(res, "\n");
98 break;
99 case rm_count_invalid:
100 res = secstrcat_string(res, startp->rm_msg);
101 res = secstrcat_cstr(res, "\n");
102 break;
103 case rm_summary_valid:
104 res = secstrcat_cstr(res, "\n(./) ");
105 res = secstrcat_string(res, startp->rm_msg);
106 break;
107 case rm_summary_invalid:
108 res = secstrcat_cstr(res, "\n(EE)");
109 res = secstrcat_string(res, startp->rm_msg);
110 break;
111 default:
112 res = secstrcat_string(res, startp->rm_msg);
113 }
114 }
115 startp = startp->next;
116 }
117 res=secstrcat_cstr( res, "\n");
118 return res;
119 }
120 /* vim: set tabstop=2 softtabstop=2 shiftwidth=2 smarttab expandtab :*/