Debian Codegraph @

src/headers/config_parser.h

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 #ifndef FIXIT_TIFF_CONFIG_PARSER
10 #define FIXIT_TIFF_CONFIG_PARSER
11 #include "check.h"
12 #include "msg_parser.h"
13 #include "parser_types.h"
14 #include "parser_states.h"
15
16 #define MAXINCLUDEDEPTH 1
17
18 #define MAXSTACKDEPTH 65536u
19
20 typedef struct {
21 internal_stacktype_t type;
22 union{
23 unsigned int i;
24 /* values_t val; */
25 const char * regex;
26 } value;
27 } internal_stack_entry_t;
28
29
30
31 #define T internal_stack_entry_t
32 void print_st (int i, internal_stack_entry_t v);
33 #define PRINT_TYPE(a,b) print_st(a,b)
34 #include "template_stack.h"
35
36 typedef struct exe_entry_s {
37 int lineno;
38 bool is_precondition;
39 tag_t tag;
40 function_t function;
41 internal_stack_entry_t_stack_t * stack;
42 } exe_entry_t;
43
44 #define T full_res_t
45 void print_res (int i, full_res_t v);
46 #define PRINT_TYPE(a,b) print_res(a,b)
47 #include "template_stack.h"
48
49 #define T values_t
50 void print_val (int i, values_t v);
51 #define PRINT_TYPE(a,b) print_val(a,b)
52 #include "template_stack.h"
53
54 #define T exe_entry_t
55 void print_exe (int i, exe_entry_t v);
56 #define PRINT_TYPE(a,b) print_exe(a,b)
57 #include "template_stack.h"
58
59 typedef struct parser_state_s {
60 // TODO: Anzahl le-Werte für Tupel in Stack speichern
61 int lineno;
62 int valuelist;
63 tag_t tag;
64 tag_t tagref;
65 reference_t any_reference;
66 requirements_t req;
67 modes_t mode;
68 int logical_elements;
69 short int includedepth;
70 bool within_logical_or;
71 FILE * stream;
72 const char * cfg_filename;
73 const char * regex_string;
74 int called_tags[MAXTAGS];
75 full_res_t_stack_t * result_stack; /* stores results from exe */
76 values_t_stack_t * values_stack; /* stores expected value types */
77 internal_stack_entry_t_stack_t * intermediate_stack; /* stores intermediate values */
78 exe_entry_t_stack_t * exe_stack; /* stores exe function */
79 } parser_state_t;
80
81 static void helper_push_result(full_res_t res);
82 static full_res_t helper_pop_result(void);
83 static void helper_mark_top_n_results(int n, returncode_t type);
84 static full_res_t helper_get_nth(int n);
85 static ret_t call_exec_function(ctiff_t * ctif, ret_t * retp, const exe_entry_t * exep);
86 static void set_parse_error(const char * msg, char * yytext);
87 void execute_plan (ctiff_t * ctif);
88 void print_plan (void);
89 ret_t print_plan_results (retmsg_t *);
90 void clean_plan (void);
91 void parse_plan (void);
92 void parse_plan_via_stream (FILE * file, const char *optional_cfg_file);
93 void parse_plan_via_file (const char * cfg_file);
94 static void add_default_rules_to_plan(void);
95 static void set_include( const char *);
96 void exe_printstack_human_readable (void);
97 static void result_push(full_res_t);
98 #endif
99 /* _FIXIT_TIFF_CONFIG_PARSER */