Debian Codegraph @

tools/lou_checkyaml.c

raw symbols SCIP
1 /* liblouis Braille Translation and Back-Translation Library
2
3 Copyright (C) 2015, 2016 Christian Egli, Swiss Library for the Blind, Visually Impaired
4 and Print Disabled
5 Copyright (C) 2017 Bert Frees
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, either version 3 of the License, or
10 (at your option) any later version.
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 General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>.
19 */
20
21 #include <config.h>cxx . . $ `<file>/liblouis/config.h`/
22
23 #include <assert.h>
24 #include <getopt.h>
25 #include <stdio.h>cxx . . $ `<file>/tools/gnulib/stdio.h`/
26 #include <stdlib.h>cxx . . $ `<file>/gnulib/stdlib.h`/
27 #include <unistd.h>cxx . . $ `<file>/gnulib/unistd.h`/
28 #include <string.h>cxx . . $ `<file>/gnulib/string.h`/
29 #include "internal.h"cxx . . $ `<file>/liblouis/internal.h`/
30 #include "error.h"cxx . . $ `<file>/tools/gnulib/error.h`/
31 #include "errno.h"
32 #include "progname.h"cxx . . $ `<file>/tools/gnulib/progname.h`/
33 #include "version-etc.h"cxx . . $ `<file>/tools/gnulib/version-etc.h`/
34 #include "brl_checks.h"cxx . . $ `<file>/tools/brl_checks.h`/
35
36 static int verbosecxx . . $ verbose. = 0;
37 static const struct optioncxx . . $ option# longoptscxx . . $ longopts.[] = {
38 { "help", no_argumentcxx . . $ `<external>/1746263805473775960/getopt_ext.h:62:9`!, NULLcxx . . $ `<external>/16391990256953433862/stddef.h:419:9`!, 'h' },
39 { "version", no_argumentcxx . . $ `<external>/1746263805473775960/getopt_ext.h:62:9`!, NULLcxx . . $ `<external>/16391990256953433862/stddef.h:419:9`!, 'v' },
40 { "verbose", no_argumentcxx . . $ `<external>/1746263805473775960/getopt_ext.h:62:9`!, &verbosecxx . . $ verbose., 1 },
41 { NULLcxx . . $ `<external>/16391990256953433862/stddef.h:419:9`!, 0, NULLcxx . . $ `<external>/16391990256953433862/stddef.h:419:9`!, 0 },
42 };
43
44 const char version_etc_copyrightcxx . . $ version_etc_copyright.[] =
45 "Copyright %s %d Swiss Library for the Blind, Visually Impaired and Print "
46 "Disabled";
47
48 #define AUTHORScxx . . $ `tools/lou_checkyaml.c:48:9`! "Christian Egli"
49
50 #define MODE_TRANSLATION_FORWARDcxx . . $ `tools/lou_checkyaml.c:50:9`! 0
51 #define MODE_TRANSLATION_BACKWARDcxx . . $ `tools/lou_checkyaml.c:51:9`! 1
52 #define MODE_TRANSLATION_BOTH_DIRECTIONScxx . . $ `tools/lou_checkyaml.c:52:9`! 2
53 #define MODE_HYPHENATIONcxx . . $ `tools/lou_checkyaml.c:53:9`! 3
54 #define MODE_HYPHENATION_BRAILLEcxx . . $ `tools/lou_checkyaml.c:54:9`! 4
55 #define MODE_DISPLAYcxx . . $ `tools/lou_checkyaml.c:55:9`! 5
56 #define MODE_DEFAULTcxx . . $ `tools/lou_checkyaml.c:56:9`! MODE_TRANSLATION_FORWARDcxx . . $ `tools/lou_checkyaml.c:50:9`!
57
58 static void
59 print_helpcxx . . $ print_help(49f6e7a06ebc5aa8).(void) {
60 printfcxx . . $ printf(581fddd72a8db8fc).("\
61 Usage: %s YAML_TEST_FILE\n",
62 program_namecxx . . $ program_name.);
63
64 fputscxx . . $ fputs(874fa6a5e59ab9bd).("\
65 Run the tests defined in the YAML_TEST_FILE. Return 0 if all tests pass\n\
66 or 1 if any of the tests fail. The details of failing tests are printed\n\
67 to stderr.\n\n",
68 stdoutcxx . . $ `<external>/232824719582829767/stdio.h:158:9`!);
69
70 fputscxx . . $ fputs(874fa6a5e59ab9bd).("\
71 -h, --help display this help and exit\n\
72 -v, --version display version information and exit\n\
73 --verbose report expected failures\n",
74 stdoutcxx . . $ `<external>/232824719582829767/stdio.h:158:9`!);
75
76 printfcxx . . $ printf(581fddd72a8db8fc).("\n");
77 printfcxx . . $ printf(581fddd72a8db8fc).("Report bugs to %s.\n", PACKAGE_BUGREPORTcxx . . $ `liblouis/config.h:628:9`!);
78
79 #ifdef PACKAGE_PACKAGER_BUG_REPORTS
80 printf("Report %s bugs to: %s\n", PACKAGE_PACKAGER, PACKAGE_PACKAGER_BUG_REPORTS);
81 #endif
82 #ifdef PACKAGE_URLcxx . . $ `liblouis/config.h:649:9`!
83 printfcxx . . $ printf(581fddd72a8db8fc).("%s home page: <%s>\n", PACKAGE_NAMEcxx . . $ `liblouis/config.h:631:9`!, PACKAGE_URLcxx . . $ `liblouis/config.h:649:9`!);
84 #endif
85 }
86
87 #define EXIT_SKIPPEDcxx . . $ `tools/lou_checkyaml.c:87:9`! 77
88
89 #ifdef HAVE_LIBYAMLcxx . . $ `liblouis/config.h:334:9`!
90 #include <yaml.h>
91
92 typedef structcxx . . $ $anonymous_type_282a937687b3c082_0# {
93 const char *namecxx . . $ $anonymous_type_282a937687b3c082_0#name.;
94 const char *contentcxx . . $ $anonymous_type_282a937687b3c082_0#content.; // table content in case of an inline table; NULL means name is
95 // a file
96 int locationcxx . . $ $anonymous_type_282a937687b3c082_0#location.; // location in YAML file (line number) where table is defined
97 int is_displaycxx . . $ $anonymous_type_282a937687b3c082_0#is_display.; // whether the table is a display table or a translation table
98 } table_valuecxx . . $ table_value#;
99
100 const char *event_namescxx . . $ event_names.[] = { "YAML_NO_EVENT", "YAML_STREAM_START_EVENT",
101 "YAML_STREAM_END_EVENT", "YAML_DOCUMENT_START_EVENT", "YAML_DOCUMENT_END_EVENT",
102 "YAML_ALIAS_EVENT", "YAML_SCALAR_EVENT", "YAML_SEQUENCE_START_EVENT",
103 "YAML_SEQUENCE_END_EVENT", "YAML_MAPPING_START_EVENT", "YAML_MAPPING_END_EVENT" };
104 const char *encoding_namescxx . . $ encoding_names.[] = { "YAML_ANY_ENCODING", "YAML_UTF8_ENCODING",
105 "YAML_UTF16LE_ENCODING", "YAML_UTF16BE_ENCODING" };
106
107 const char *inline_table_prefixcxx . . $ inline_table_prefix. = "checkyaml_inline_table_at_line_";
108
109 char *file_namecxx . . $ file_name.;
110
111 int errorscxx . . $ errors. = 0;
112 int countcxx . . $ count. = 0;
113
114 static char const **emph_classescxx . . $ emph_classes. = NULLcxx . . $ `<external>/16391990256953433862/stddef.h:419:9`!;
115
116 static void
117 simple_errorcxx . . $ simple_error(3e4c1fd2975b5693).(const char *msg, yaml_parser_tcxx . . $ yaml_parser_t# *parser, yaml_event_tcxx . . $ yaml_event_t# *event) {
118 error_at_linecxx . . $ `tools/gnulib/error.h:530:12`!(EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:96:9`!, 0, file_name,
119 event->start_mark.line ? event->start_mark.line + 1
120 : parser->problem_mark.line + 1,
121 "%s", msg);
122 }
123
124 static void
125 yaml_parse_errorcxx . . $ yaml_parse_error(40d81e724c2bc0e).(yaml_parser_tcxx . . $ yaml_parser_t# *parser) {
126 error_at_linecxx . . $ `tools/gnulib/error.h:530:12`!(EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:96:9`!, 0, file_name, parser->problem_mark.line + 1, "%s",
127 parser->problem);
128 }
129
130 static void
131 yaml_errorcxx . . $ yaml_error(e19e85592414518d).(yaml_event_type_tcxx . . $ yaml_event_type_t# expected, yaml_event_tcxx . . $ yaml_event_t# *event) {
132 error_at_linecxx . . $ `tools/gnulib/error.h:530:12`!(EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:96:9`!, 0, file_name, event->start_mark.line + 1,
133 "Expected %s (actual %s)", event_names[expected], event_names[event->type]);
134 }
135
136 static char *
137 read_table_querycxx . . $ read_table_query(69eb3b38ff4d2ba0).(yaml_parser_tcxx . . $ yaml_parser_t# *parser, const char **table_file_name_check) {
138 yaml_event_tcxx . . $ yaml_event_t# event;
139 char *query_as_string = malloccxx . . $ malloc(bfcfa4d6b7f7ef64).(sizeof(char) * MAXSTRINGcxx . . $ `liblouis/internal.h:79:9`!);
140 char *p = query_as_string;
141 query_as_string[0] = '\0';
142 while (1) {
143 if (!yaml_parser_parsecxx . . $ yaml_parser_parse(9fcd0b122d7bfbea).(parser, &event)) yaml_errorcxx . . $ yaml_error(e19e85592414518d).(YAML_SCALAR_EVENTcxx . . $ YAML_SCALAR_EVENT., &event);
144 if (event.typecxx . . $ yaml_event_s#type. == YAML_SCALAR_EVENTcxx . . $ YAML_SCALAR_EVENT.) {
145
146 // (temporary) feature to check whether the table query matches an expected
147 // table
148 if (!strcmpcxx . . $ strcmp(5ae29d726ae57f88).((const char *)event.datacxx . . $ yaml_event_s#data..scalarcxx . . $ yaml_event_s#$anonymous_type_8#scalar..valuecxx . . $ yaml_event_s#$anonymous_type_8#$anonymous_type_14#value., "__assert-match")) {
149 yaml_event_deletecxx . . $ yaml_event_delete(a38ec22d89279e03).(&event);
150 if (!yaml_parser_parsecxx . . $ yaml_parser_parse(9fcd0b122d7bfbea).(parser, &event) ||
151 (event.typecxx . . $ yaml_event_s#type. != YAML_SCALAR_EVENTcxx . . $ YAML_SCALAR_EVENT.))
152 yaml_errorcxx . . $ yaml_error(e19e85592414518d).(YAML_SCALAR_EVENTcxx . . $ YAML_SCALAR_EVENT., &event);
153 *table_file_name_check = strdupcxx . . $ strdup(a8b8e32347182212).((const char *)event.datacxx . . $ yaml_event_s#data..scalarcxx . . $ yaml_event_s#$anonymous_type_8#scalar..valuecxx . . $ yaml_event_s#$anonymous_type_8#$anonymous_type_14#value.);
154 yaml_event_deletecxx . . $ yaml_event_delete(a38ec22d89279e03).(&event);
155 } else {
156 if (query_as_string != p) strcatcxx . . $ strcat(b7b3a83273496486).(p++, " ");
157 strcatcxx . . $ strcat(b7b3a83273496486).(p, (const char *)event.datacxx . . $ yaml_event_s#data..scalarcxx . . $ yaml_event_s#$anonymous_type_8#scalar..valuecxx . . $ yaml_event_s#$anonymous_type_8#$anonymous_type_14#value.);
158 p += event.datacxx . . $ yaml_event_s#data..scalarcxx . . $ yaml_event_s#$anonymous_type_8#scalar..lengthcxx . . $ yaml_event_s#$anonymous_type_8#$anonymous_type_14#length.;
159 strcatcxx . . $ strcat(b7b3a83273496486).(p++, ":");
160 yaml_event_deletecxx . . $ yaml_event_delete(a38ec22d89279e03).(&event);
161 if (!yaml_parser_parsecxx . . $ yaml_parser_parse(9fcd0b122d7bfbea).(parser, &event) ||
162 (event.typecxx . . $ yaml_event_s#type. != YAML_SCALAR_EVENTcxx . . $ YAML_SCALAR_EVENT.))
163 yaml_errorcxx . . $ yaml_error(e19e85592414518d).(YAML_SCALAR_EVENTcxx . . $ YAML_SCALAR_EVENT., &event);
164 strcatcxx . . $ strcat(b7b3a83273496486).(p, (const char *)event.datacxx . . $ yaml_event_s#data..scalarcxx . . $ yaml_event_s#$anonymous_type_8#scalar..valuecxx . . $ yaml_event_s#$anonymous_type_8#$anonymous_type_14#value.);
165 p += event.datacxx . . $ yaml_event_s#data..scalarcxx . . $ yaml_event_s#$anonymous_type_8#scalar..lengthcxx . . $ yaml_event_s#$anonymous_type_8#$anonymous_type_14#length.;
166 yaml_event_deletecxx . . $ yaml_event_delete(a38ec22d89279e03).(&event);
167 }
168 } else if (event.typecxx . . $ yaml_event_s#type. == YAML_MAPPING_END_EVENTcxx . . $ YAML_MAPPING_END_EVENT.) {
169 yaml_event_deletecxx . . $ yaml_event_delete(a38ec22d89279e03).(&event);
170 break;
171 } else
172 yaml_errorcxx . . $ yaml_error(e19e85592414518d).(YAML_SCALAR_EVENTcxx . . $ YAML_SCALAR_EVENT., &event);
173 }
174 return query_as_string;
175 }
176
177 static void
178 compile_inline_tablecxx . . $ compile_inline_table(a5d3e952d81e7576).(const table_valuecxx . . $ table_value# *table) {
179 int location = table->locationcxx . . $ $anonymous_type_282a937687b3c082_0#location.;
180 char *p = (char *)table->contentcxx . . $ $anonymous_type_282a937687b3c082_0#content.;
181 char *line_start = p;
182 int line_len = 0;
183 while (*p) {
184 if (*p == 10 || *p == 13) {
185 char *line = strndupcxx . . $ strndup(eabdfdef77619b3d).((const char *)line_start, line_len);
186 int error = 0;
187 if (!table->is_displaycxx . . $ $anonymous_type_282a937687b3c082_0#is_display.)
188 error = !_lou_compileTranslationRulecxx . . $ _lou_compileTranslationRule(5ae29d726ae57f88).(table->namecxx . . $ $anonymous_type_282a937687b3c082_0#name., line);
189 else
190 error = !_lou_compileDisplayRulecxx . . $ _lou_compileDisplayRule(5ae29d726ae57f88).(table->namecxx . . $ $anonymous_type_282a937687b3c082_0#name., line);
191 if (error)
192 error_at_linecxx . . $ `tools/gnulib/error.h:530:12`!(EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:96:9`!, 0, file_name, location, "Error in table %s",
193 table->name);
194 location++;
195 freecxx . . $ free(5d22bdacc48458e8).(line);
196 line_start = p + 1;
197 line_len = 0;
198 } else {
199 line_len++;
200 }
201 p++;
202 }
203 }
204
205 static table_valuecxx . . $ table_value# *
206 read_table_valuecxx . . $ read_table_value(6cf88f50b10c690a).(yaml_parser_tcxx . . $ yaml_parser_t# *parser, int start_line, int is_display) {
207 table_valuecxx . . $ table_value# *table;
208 char *table_name = malloccxx . . $ malloc(bfcfa4d6b7f7ef64).(sizeof(char) * MAXSTRINGcxx . . $ `liblouis/internal.h:79:9`!);
209 char *table_content = NULLcxx . . $ `<external>/16391990256953433862/stddef.h:419:9`!;
210 yaml_event_tcxx . . $ yaml_event_t# event;
211 table_name[0] = '\0';
212 if (!yaml_parser_parsecxx . . $ yaml_parser_parse(9fcd0b122d7bfbea).(parser, &event) ||
213 !(event.typecxx . . $ yaml_event_s#type. == YAML_SEQUENCE_START_EVENTcxx . . $ YAML_SEQUENCE_START_EVENT. ||
214 event.typecxx . . $ yaml_event_s#type. == YAML_SCALAR_EVENTcxx . . $ YAML_SCALAR_EVENT. ||
215 event.typecxx . . $ yaml_event_s#type. == YAML_MAPPING_START_EVENTcxx . . $ YAML_MAPPING_START_EVENT.))
216 error_at_linecxx . . $ `tools/gnulib/error.h:530:12`!(EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:96:9`!, 0, file_name, event.start_mark.line + 1,
217 "Expected %s, %s or %s (actual %s)",
218 event_names[YAML_SEQUENCE_START_EVENT], event_names[YAML_SCALAR_EVENT],
219 event_names[YAML_MAPPING_START_EVENT], event_names[event.type]);
220 if (event.typecxx . . $ yaml_event_s#type. == YAML_SEQUENCE_START_EVENTcxx . . $ YAML_SEQUENCE_START_EVENT.) {
221 yaml_event_deletecxx . . $ yaml_event_delete(a38ec22d89279e03).(&event);
222 int done = 0;
223 char *p = table_name;
224 while (!done) {
225 if (!yaml_parser_parsecxx . . $ yaml_parser_parse(9fcd0b122d7bfbea).(parser, &event)) {
226 yaml_parse_errorcxx . . $ yaml_parse_error(40d81e724c2bc0e).(parser);
227 }
228 if (event.typecxx . . $ yaml_event_s#type. == YAML_SEQUENCE_END_EVENTcxx . . $ YAML_SEQUENCE_END_EVENT.) {
229 done = 1;
230 } else if (event.typecxx . . $ yaml_event_s#type. == YAML_SCALAR_EVENTcxx . . $ YAML_SCALAR_EVENT.) {
231 if (table_name != p) strcatcxx . . $ strcat(b7b3a83273496486).(p++, ",");
232 strcatcxx . . $ strcat(b7b3a83273496486).(p, (const char *)event.datacxx . . $ yaml_event_s#data..scalarcxx . . $ yaml_event_s#$anonymous_type_8#scalar..valuecxx . . $ yaml_event_s#$anonymous_type_8#$anonymous_type_14#value.);
233 p += event.datacxx . . $ yaml_event_s#data..scalarcxx . . $ yaml_event_s#$anonymous_type_8#scalar..lengthcxx . . $ yaml_event_s#$anonymous_type_8#$anonymous_type_14#length.;
234 }
235 yaml_event_deletecxx . . $ yaml_event_delete(a38ec22d89279e03).(&event);
236 }
237 } else if (event.typecxx . . $ yaml_event_s#type. == YAML_SCALAR_EVENTcxx . . $ YAML_SCALAR_EVENT.) {
238 yaml_char_tcxx . . $ yaml_char_t# *p = event.datacxx . . $ yaml_event_s#data..scalarcxx . . $ yaml_event_s#$anonymous_type_8#scalar..valuecxx . . $ yaml_event_s#$anonymous_type_8#$anonymous_type_14#value.;
239 if (*p)
240 while (p[1]) p++;
241 if (*p == 10 || *p == 13) {
242 // If the scalar ends with a newline, assume it is a block
243 // scalar, so treat as an inline table. (Is there a proper way
244 // to check for a block scalar?)
245 sprintfcxx . . $ sprintf(26c8642d26409d6d).(table_name, "%s%d", inline_table_prefixcxx . . $ inline_table_prefix., start_line);
246 table_content = strdupcxx . . $ strdup(a8b8e32347182212).((const char *)event.datacxx . . $ yaml_event_s#data..scalarcxx . . $ yaml_event_s#$anonymous_type_8#scalar..valuecxx . . $ yaml_event_s#$anonymous_type_8#$anonymous_type_14#value.);
247 } else {
248 strcatcxx . . $ strcat(b7b3a83273496486).(table_name, (const char *)event.datacxx . . $ yaml_event_s#data..scalarcxx . . $ yaml_event_s#$anonymous_type_8#scalar..valuecxx . . $ yaml_event_s#$anonymous_type_8#$anonymous_type_14#value.);
249 }
250 yaml_event_deletecxx . . $ yaml_event_delete(a38ec22d89279e03).(&event);
251 } else { // event.type == YAML_MAPPING_START_EVENT
252 char *query;
253 const char *table_file_name_check = NULLcxx . . $ `<external>/16391990256953433862/stddef.h:419:9`!;
254 yaml_event_deletecxx . . $ yaml_event_delete(a38ec22d89279e03).(&event);
255 query = read_table_querycxx . . $ read_table_query(69eb3b38ff4d2ba0).(parser, &table_file_name_check);
256 freecxx . . $ free(5d22bdacc48458e8).(table_name);
257 table_name = lou_findTablecxx . . $ lou_findTable(a8b8e32347182212).(query);
258 freecxx . . $ free(5d22bdacc48458e8).(query);
259 if (!table_name)
260 error_at_linecxx . . $ `tools/gnulib/error.h:530:12`!(EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:96:9`!, 0, file_name, start_line,
261 "Table query did not match a table");
262 if (table_file_name_check) {
263 const char *table_file_name = table_name;
264 do {
265 table_file_name++;
266 } while (*table_file_name);
267 while (table_file_name >= table_name && *table_file_name != '/' &&
268 *table_file_name != '\\')
269 table_file_name--;
270 if (strcmpcxx . . $ strcmp(5ae29d726ae57f88).(table_file_name_check, table_file_name + 1))
271 error_at_linecxx . . $ `tools/gnulib/error.h:530:12`!(EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:96:9`!, 0, file_name, start_line,
272 "Table query did not match expected table: expected '%s' but got "
273 "'%s'",
274 table_file_name_check, table_file_name + 1);
275 freecxx . . $ free(5d22bdacc48458e8).(table_file_name_check);
276 }
277 }
278 table = malloccxx . . $ malloc(bfcfa4d6b7f7ef64).(sizeof(table_valuecxx . . $ table_value#));
279 table->namecxx . . $ $anonymous_type_282a937687b3c082_0#name. = table_name;
280 table->contentcxx . . $ $anonymous_type_282a937687b3c082_0#content. = table_content;
281 table->locationcxx . . $ $anonymous_type_282a937687b3c082_0#location. = start_line + 1;
282 table->is_displaycxx . . $ $anonymous_type_282a937687b3c082_0#is_display. = is_display;
283 return table;
284 }
285
286 static void
287 free_table_valuecxx . . $ free_table_value(6a2f85743fb3a12c).(table_valuecxx . . $ table_value# *table) {
288 if (table) {
289 freecxx . . $ free(5d22bdacc48458e8).((char *)table->namecxx . . $ $anonymous_type_282a937687b3c082_0#name.);
290 if (table->contentcxx . . $ $anonymous_type_282a937687b3c082_0#content.) freecxx . . $ free(5d22bdacc48458e8).((char *)table->contentcxx . . $ $anonymous_type_282a937687b3c082_0#content.);
291 freecxx . . $ free(5d22bdacc48458e8).(table);
292 }
293 }
294
295 static char *
296 read_tablecxx . . $ read_table(e30c107d3a945738).(yaml_event_tcxx . . $ yaml_event_t# *start_event, yaml_parser_tcxx . . $ yaml_parser_t# *parser, const char *display_table) {
297 table_valuecxx . . $ table_value# *v = NULLcxx . . $ `<external>/16391990256953433862/stddef.h:419:9`!;
298 char *table_name = NULLcxx . . $ `<external>/16391990256953433862/stddef.h:419:9`!;
299 if (start_event->typecxx . . $ yaml_event_s#type. != YAML_SCALAR_EVENTcxx . . $ YAML_SCALAR_EVENT. ||
300 strcmpcxx . . $ strcmp(5ae29d726ae57f88).((const char *)start_event->datacxx . . $ yaml_event_s#data..scalarcxx . . $ yaml_event_s#$anonymous_type_8#scalar..valuecxx . . $ yaml_event_s#$anonymous_type_8#$anonymous_type_14#value., "table"))
301 return 0;
302 v = read_table_valuecxx . . $ read_table_value(6cf88f50b10c690a).(parser, start_event->start_markcxx . . $ yaml_event_s#start_mark..linecxx . . $ yaml_mark_s#line. + 1, 0);
303 if (v->contentcxx . . $ $anonymous_type_282a937687b3c082_0#content.)
304 compile_inline_tablecxx . . $ compile_inline_table(a5d3e952d81e7576).(v);
305 else if (!_lou_getTranslationTablecxx . . $ _lou_getTranslationTable(22611657cc90d98f).(v->namecxx . . $ $anonymous_type_282a937687b3c082_0#name.))
306 error_at_linecxx . . $ `tools/gnulib/error.h:530:12`!(EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:96:9`!, 0, file_name, start_event->start_mark.line + 1,
307 "Table %s not valid", v->name);
308 freecxx . . $ free(5d22bdacc48458e8).(emph_classescxx . . $ emph_classes.);
309 emph_classescxx . . $ emph_classes. = lou_getEmphClassescxx . . $ lou_getEmphClasses(76b8a7a12769b574).(v->namecxx . . $ $anonymous_type_282a937687b3c082_0#name.); // get declared emphasis classes
310 if (emph_classescxx . . $ emph_classes. == NULLcxx . . $ `<external>/16391990256953433862/stddef.h:419:9`!) {
311 error_at_linecxx . . $ `tools/gnulib/error.h:530:12`!(EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:96:9`!, 0, file_name, start_event->start_mark.line + 1,
312 "Failed to fetch the emphasis classes list in table %s", v->name);
313 }
314 table_name = strdupcxx . . $ strdup(a8b8e32347182212).((char *)v->namecxx . . $ $anonymous_type_282a937687b3c082_0#name.);
315 if (!display_table) {
316 if (v->contentcxx . . $ $anonymous_type_282a937687b3c082_0#content.) {
317 v->is_displaycxx . . $ $anonymous_type_282a937687b3c082_0#is_display. = 1;
318 compile_inline_tablecxx . . $ compile_inline_table(a5d3e952d81e7576).(v);
319 } else if (!_lou_getDisplayTablecxx . . $ _lou_getDisplayTable(78757538624ff90f).(v->namecxx . . $ $anonymous_type_282a937687b3c082_0#name.))
320 error_at_linecxx . . $ `tools/gnulib/error.h:530:12`!(EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:96:9`!, 0, file_name, start_event->start_mark.line + 1,
321 "Table %s not valid", v->name);
322 }
323 free_table_valuecxx . . $ free_table_value(6a2f85743fb3a12c).(v);
324 return table_name;
325 }
326
327 static void
328 read_flagscxx . . $ read_flags(afafab9d960b0dae).(yaml_parser_tcxx . . $ yaml_parser_t# *parser, int *testmode) {
329 yaml_event_tcxx . . $ yaml_event_t# event;
330 int parse_error = 1;
331
332 *testmode = MODE_DEFAULTcxx . . $ `tools/lou_checkyaml.c:56:9`!;
333
334 if (!yaml_parser_parsecxx . . $ yaml_parser_parse(9fcd0b122d7bfbea).(parser, &event) || (event.typecxx . . $ yaml_event_s#type. != YAML_MAPPING_START_EVENTcxx . . $ YAML_MAPPING_START_EVENT.))
335 yaml_errorcxx . . $ yaml_error(e19e85592414518d).(YAML_MAPPING_START_EVENTcxx . . $ YAML_MAPPING_START_EVENT., &event);
336
337 yaml_event_deletecxx . . $ yaml_event_delete(a38ec22d89279e03).(&event);
338
339 while ((parse_error = yaml_parser_parsecxx . . $ yaml_parser_parse(9fcd0b122d7bfbea).(parser, &event)) &&
340 (event.typecxx . . $ yaml_event_s#type. == YAML_SCALAR_EVENTcxx . . $ YAML_SCALAR_EVENT.)) {
341 if (!strcmpcxx . . $ strcmp(5ae29d726ae57f88).((const char *)event.datacxx . . $ yaml_event_s#data..scalarcxx . . $ yaml_event_s#$anonymous_type_8#scalar..valuecxx . . $ yaml_event_s#$anonymous_type_8#$anonymous_type_14#value., "testmode")) {
342 yaml_event_deletecxx . . $ yaml_event_delete(a38ec22d89279e03).(&event);
343 if (!yaml_parser_parsecxx . . $ yaml_parser_parse(9fcd0b122d7bfbea).(parser, &event) || (event.typecxx . . $ yaml_event_s#type. != YAML_SCALAR_EVENTcxx . . $ YAML_SCALAR_EVENT.))
344 yaml_errorcxx . . $ yaml_error(e19e85592414518d).(YAML_SCALAR_EVENTcxx . . $ YAML_SCALAR_EVENT., &event);
345 if (!strcmpcxx . . $ strcmp(5ae29d726ae57f88).((const char *)event.datacxx . . $ yaml_event_s#data..scalarcxx . . $ yaml_event_s#$anonymous_type_8#scalar..valuecxx . . $ yaml_event_s#$anonymous_type_8#$anonymous_type_14#value., "forward")) {
346 *testmode = MODE_TRANSLATION_FORWARDcxx . . $ `tools/lou_checkyaml.c:50:9`!;
347 } else if (!strcmpcxx . . $ strcmp(5ae29d726ae57f88).((const char *)event.datacxx . . $ yaml_event_s#data..scalarcxx . . $ yaml_event_s#$anonymous_type_8#scalar..valuecxx . . $ yaml_event_s#$anonymous_type_8#$anonymous_type_14#value., "backward")) {
348 *testmode = MODE_TRANSLATION_BACKWARDcxx . . $ `tools/lou_checkyaml.c:51:9`!;
349 } else if (!strcmpcxx . . $ strcmp(5ae29d726ae57f88).((const char *)event.datacxx . . $ yaml_event_s#data..scalarcxx . . $ yaml_event_s#$anonymous_type_8#scalar..valuecxx . . $ yaml_event_s#$anonymous_type_8#$anonymous_type_14#value., "bothDirections")) {
350 *testmode = MODE_TRANSLATION_BOTH_DIRECTIONScxx . . $ `tools/lou_checkyaml.c:52:9`!;
351 } else if (!strcmpcxx . . $ strcmp(5ae29d726ae57f88).((const char *)event.datacxx . . $ yaml_event_s#data..scalarcxx . . $ yaml_event_s#$anonymous_type_8#scalar..valuecxx . . $ yaml_event_s#$anonymous_type_8#$anonymous_type_14#value., "hyphenate")) {
352 *testmode = MODE_HYPHENATIONcxx . . $ `tools/lou_checkyaml.c:53:9`!;
353 } else if (!strcmpcxx . . $ strcmp(5ae29d726ae57f88).((const char *)event.datacxx . . $ yaml_event_s#data..scalarcxx . . $ yaml_event_s#$anonymous_type_8#scalar..valuecxx . . $ yaml_event_s#$anonymous_type_8#$anonymous_type_14#value.,
354 "hyphenateBraille")) {
355 *testmode = MODE_HYPHENATION_BRAILLEcxx . . $ `tools/lou_checkyaml.c:54:9`!;
356 } else if (!strcmpcxx . . $ strcmp(5ae29d726ae57f88).((const char *)event.datacxx . . $ yaml_event_s#data..scalarcxx . . $ yaml_event_s#$anonymous_type_8#scalar..valuecxx . . $ yaml_event_s#$anonymous_type_8#$anonymous_type_14#value., "display")) {
357 *testmode = MODE_DISPLAYcxx . . $ `tools/lou_checkyaml.c:55:9`!;
358 } else {
359 error_at_linecxx . . $ `tools/gnulib/error.h:530:12`!(EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:96:9`!, 0, file_name, event.start_mark.line + 1,
360 "Testmode '%s' not supported\n", event.data.scalar.value);
361 }
362 } else {
363 error_at_linecxx . . $ `tools/gnulib/error.h:530:12`!(EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:96:9`!, 0, file_name, event.start_mark.line + 1,
364 "Flag '%s' not supported\n", event.data.scalar.value);
365 }
366 yaml_event_deletecxx . . $ yaml_event_delete(a38ec22d89279e03).(&event);
367 }
368 if (!parse_error) yaml_parse_errorcxx . . $ yaml_parse_error(40d81e724c2bc0e).(parser);
369 if (event.typecxx . . $ yaml_event_s#type. != YAML_MAPPING_END_EVENTcxx . . $ YAML_MAPPING_END_EVENT.) yaml_errorcxx . . $ yaml_error(e19e85592414518d).(YAML_MAPPING_END_EVENTcxx . . $ YAML_MAPPING_END_EVENT., &event);
370 yaml_event_deletecxx . . $ yaml_event_delete(a38ec22d89279e03).(&event);
371 }
372
373 #define XFAIL_NONEcxx . . $ `tools/lou_checkyaml.c:373:9`! 0
374 #define XFAIL_FORWARDcxx . . $ `tools/lou_checkyaml.c:374:9`! 1
375 #define XFAIL_BACKWARDcxx . . $ `tools/lou_checkyaml.c:375:9`! 2
376 #define XFAIL_BOTHcxx . . $ `tools/lou_checkyaml.c:376:9`! 3
377
378 static int
379 read_xfail_valuecxx . . $ read_xfail_value(3cfc1e679d24aa99).(yaml_parser_tcxx . . $ yaml_parser_t# *parser) {
380 yaml_event_tcxx . . $ yaml_event_t# event;
381 int xfail = 1; // assume a truthy value
382
383 if (!yaml_parser_parsecxx . . $ yaml_parser_parse(9fcd0b122d7bfbea).(parser, &event) || (event.typecxx . . $ yaml_event_s#type. != YAML_SCALAR_EVENTcxx . . $ YAML_SCALAR_EVENT.))
384 yaml_errorcxx . . $ yaml_error(e19e85592414518d).(YAML_SCALAR_EVENTcxx . . $ YAML_SCALAR_EVENT., &event);
385 if (!strcmpcxx . . $ strcmp(5ae29d726ae57f88).((const char *)event.datacxx . . $ yaml_event_s#data..scalarcxx . . $ yaml_event_s#$anonymous_type_8#scalar..valuecxx . . $ yaml_event_s#$anonymous_type_8#$anonymous_type_14#value., "false") ||
386 !strcmpcxx . . $ strcmp(5ae29d726ae57f88).((const char *)event.datacxx . . $ yaml_event_s#data..scalarcxx . . $ yaml_event_s#$anonymous_type_8#scalar..valuecxx . . $ yaml_event_s#$anonymous_type_8#$anonymous_type_14#value., "off"))
387 xfail = 0; // only "false" and "off" are falsy values
388 yaml_event_deletecxx . . $ yaml_event_delete(a38ec22d89279e03).(&event);
389 return xfail;
390 }
391
392 static int
393 read_xfailcxx . . $ read_xfail(3cfc1e679d24aa99).(yaml_parser_tcxx . . $ yaml_parser_t# *parser) {
394 yaml_event_tcxx . . $ yaml_event_t# event;
395 if (!yaml_parser_parsecxx . . $ yaml_parser_parse(9fcd0b122d7bfbea).(parser, &event) ||
396 !(event.typecxx . . $ yaml_event_s#type. == YAML_SCALAR_EVENTcxx . . $ YAML_SCALAR_EVENT. || event.typecxx . . $ yaml_event_s#type. == YAML_MAPPING_START_EVENTcxx . . $ YAML_MAPPING_START_EVENT.))
397 error_at_linecxx . . $ `tools/gnulib/error.h:530:12`!(EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:96:9`!, 0, file_name, event.start_mark.line + 1,
398 "Expected %s or %s (actual %s)", event_names[YAML_SCALAR_EVENT],
399 event_names[YAML_MAPPING_START_EVENT], event_names[event.type]);
400
401 /* xfail can be either a scalar value (`true` or any string, typically
402 the failure reason) */
403 if (event.typecxx . . $ yaml_event_s#type. == YAML_SCALAR_EVENTcxx . . $ YAML_SCALAR_EVENT.) {
404 /* assume xfail both if there is an xfail key */
405 int xfail = XFAIL_BOTHcxx . . $ `tools/lou_checkyaml.c:376:9`!;
406 if (!strcmpcxx . . $ strcmp(5ae29d726ae57f88).((const char *)event.datacxx . . $ yaml_event_s#data..scalarcxx . . $ yaml_event_s#$anonymous_type_8#scalar..valuecxx . . $ yaml_event_s#$anonymous_type_8#$anonymous_type_14#value., "false") ||
407 !strcmpcxx . . $ strcmp(5ae29d726ae57f88).((const char *)event.datacxx . . $ yaml_event_s#data..scalarcxx . . $ yaml_event_s#$anonymous_type_8#scalar..valuecxx . . $ yaml_event_s#$anonymous_type_8#$anonymous_type_14#value., "off"))
408 xfail = XFAIL_NONEcxx . . $ `tools/lou_checkyaml.c:373:9`!;
409 yaml_event_deletecxx . . $ yaml_event_delete(a38ec22d89279e03).(&event);
410 return xfail;
411
412 /* or xfail can be a map such as {forward: true, backward: false} */
413 } else { // event.type == YAML_MAPPING_START_EVENT
414 int parse_error = 1;
415 int xfail_forward = 0; /* if either direction is not specified `false` */
416 int xfail_backward = 0; /* is assumed */
417 while ((parse_error = yaml_parser_parsecxx . . $ yaml_parser_parse(9fcd0b122d7bfbea).(parser, &event)) &&
418 (event.typecxx . . $ yaml_event_s#type. == YAML_SCALAR_EVENTcxx . . $ YAML_SCALAR_EVENT.)) {
419 if (strcmpcxx . . $ strcmp(5ae29d726ae57f88).((const char *)event.datacxx . . $ yaml_event_s#data..scalarcxx . . $ yaml_event_s#$anonymous_type_8#scalar..valuecxx . . $ yaml_event_s#$anonymous_type_8#$anonymous_type_14#value., "forward") == 0) {
420 yaml_event_deletecxx . . $ yaml_event_delete(a38ec22d89279e03).(&event);
421 xfail_forward = read_xfail_valuecxx . . $ read_xfail_value(3cfc1e679d24aa99).(parser);
422 } else if (strcmpcxx . . $ strcmp(5ae29d726ae57f88).((const char *)event.datacxx . . $ yaml_event_s#data..scalarcxx . . $ yaml_event_s#$anonymous_type_8#scalar..valuecxx . . $ yaml_event_s#$anonymous_type_8#$anonymous_type_14#value., "backward") == 0) {
423 yaml_event_deletecxx . . $ yaml_event_delete(a38ec22d89279e03).(&event);
424 xfail_backward = read_xfail_valuecxx . . $ read_xfail_value(3cfc1e679d24aa99).(parser);
425 } else {
426 error_at_linecxx . . $ `tools/gnulib/error.h:530:12`!(EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:96:9`!, 0, file_name, event.start_mark.line + 1,
427 "Direction '%s' is not valid\n", event.data.scalar.value);
428 yaml_event_deletecxx . . $ yaml_event_delete(a38ec22d89279e03).(&event);
429 break;
430 }
431 }
432 if (!parse_error) yaml_parse_errorcxx . . $ yaml_parse_error(40d81e724c2bc0e).(parser);
433
434 if (event.typecxx . . $ yaml_event_s#type. != YAML_MAPPING_END_EVENTcxx . . $ YAML_MAPPING_END_EVENT.)
435 yaml_errorcxx . . $ yaml_error(e19e85592414518d).(YAML_MAPPING_END_EVENTcxx . . $ YAML_MAPPING_END_EVENT., &event);
436 yaml_event_deletecxx . . $ yaml_event_delete(a38ec22d89279e03).(&event);
437
438 if (xfail_forward && xfail_backward) {
439 return XFAIL_BOTHcxx . . $ `tools/lou_checkyaml.c:376:9`!;
440 } else if (xfail_forward) {
441 return XFAIL_FORWARDcxx . . $ `tools/lou_checkyaml.c:374:9`!;
442 } else if (xfail_backward) {
443 return XFAIL_BACKWARDcxx . . $ `tools/lou_checkyaml.c:375:9`!;
444 } else {
445 return XFAIL_NONEcxx . . $ `tools/lou_checkyaml.c:373:9`!;
446 }
447 }
448 }
449
450 static translationModescxx . . $ translationModes#
451 read_modecxx . . $ read_mode(5a20f3f56e3ba57).(yaml_parser_tcxx . . $ yaml_parser_t# *parser) {
452 yaml_event_tcxx . . $ yaml_event_t# event;
453 translationModescxx . . $ translationModes# mode = 0;
454 int parse_error = 1;
455
456 if (!yaml_parser_parsecxx . . $ yaml_parser_parse(9fcd0b122d7bfbea).(parser, &event) || (event.typecxx . . $ yaml_event_s#type. != YAML_SEQUENCE_START_EVENTcxx . . $ YAML_SEQUENCE_START_EVENT.))
457 yaml_errorcxx . . $ yaml_error(e19e85592414518d).(YAML_SEQUENCE_START_EVENTcxx . . $ YAML_SEQUENCE_START_EVENT., &event);
458 yaml_event_deletecxx . . $ yaml_event_delete(a38ec22d89279e03).(&event);
459
460 while ((parse_error = yaml_parser_parsecxx . . $ yaml_parser_parse(9fcd0b122d7bfbea).(parser, &event)) &&
461 (event.typecxx . . $ yaml_event_s#type. == YAML_SCALAR_EVENTcxx . . $ YAML_SCALAR_EVENT.)) {
462 if (!strcmpcxx . . $ strcmp(5ae29d726ae57f88).((const char *)event.datacxx . . $ yaml_event_s#data..scalarcxx . . $ yaml_event_s#$anonymous_type_8#scalar..valuecxx . . $ yaml_event_s#$anonymous_type_8#$anonymous_type_14#value., "noContractions")) {
463 mode |= noContractionscxx . . $ noContractions.;
464 } else if (!strcmpcxx . . $ strcmp(5ae29d726ae57f88).((const char *)event.datacxx . . $ yaml_event_s#data..scalarcxx . . $ yaml_event_s#$anonymous_type_8#scalar..valuecxx . . $ yaml_event_s#$anonymous_type_8#$anonymous_type_14#value., "compbrlAtCursor")) {
465 mode |= compbrlAtCursorcxx . . $ compbrlAtCursor.;
466 } else if (!strcmpcxx . . $ strcmp(5ae29d726ae57f88).((const char *)event.datacxx . . $ yaml_event_s#data..scalarcxx . . $ yaml_event_s#$anonymous_type_8#scalar..valuecxx . . $ yaml_event_s#$anonymous_type_8#$anonymous_type_14#value., "dotsIO")) {
467 mode |= dotsIOcxx . . $ dotsIO.;
468 } else if (!strcmpcxx . . $ strcmp(5ae29d726ae57f88).((const char *)event.datacxx . . $ yaml_event_s#data..scalarcxx . . $ yaml_event_s#$anonymous_type_8#scalar..valuecxx . . $ yaml_event_s#$anonymous_type_8#$anonymous_type_14#value., "compbrlLeftCursor")) {
469 mode |= compbrlLeftCursorcxx . . $ compbrlLeftCursor.;
470 } else if (!strcmpcxx . . $ strcmp(5ae29d726ae57f88).((const char *)event.datacxx . . $ yaml_event_s#data..scalarcxx . . $ yaml_event_s#$anonymous_type_8#scalar..valuecxx . . $ yaml_event_s#$anonymous_type_8#$anonymous_type_14#value., "ucBrl")) {
471 mode |= ucBrlcxx . . $ ucBrl.;
472 } else if (!strcmpcxx . . $ strcmp(5ae29d726ae57f88).((const char *)event.datacxx . . $ yaml_event_s#data..scalarcxx . . $ yaml_event_s#$anonymous_type_8#scalar..valuecxx . . $ yaml_event_s#$anonymous_type_8#$anonymous_type_14#value., "noUndefined")) {
473 mode |= noUndefinedcxx . . $ noUndefined.;
474 } else if (!strcmpcxx . . $ strcmp(5ae29d726ae57f88).((const char *)event.datacxx . . $ yaml_event_s#data..scalarcxx . . $ yaml_event_s#$anonymous_type_8#scalar..valuecxx . . $ yaml_event_s#$anonymous_type_8#$anonymous_type_14#value., "partialTrans")) {
475 mode |= partialTranscxx . . $ partialTrans.;
476 } else {
477 error_at_linecxx . . $ `tools/gnulib/error.h:530:12`!(EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:96:9`!, 0, file_name, event.start_mark.line + 1,
478 "Mode '%s' not supported\n", event.data.scalar.value);
479 }
480 yaml_event_deletecxx . . $ yaml_event_delete(a38ec22d89279e03).(&event);
481 }
482 if (!parse_error) yaml_parse_errorcxx . . $ yaml_parse_error(40d81e724c2bc0e).(parser);
483 if (event.typecxx . . $ yaml_event_s#type. != YAML_SEQUENCE_END_EVENTcxx . . $ YAML_SEQUENCE_END_EVENT.)
484 yaml_errorcxx . . $ yaml_error(e19e85592414518d).(YAML_SEQUENCE_END_EVENTcxx . . $ YAML_SEQUENCE_END_EVENT., &event);
485 yaml_event_deletecxx . . $ yaml_event_delete(a38ec22d89279e03).(&event);
486 return mode;
487 }
488
489 static int
490 parse_numbercxx . . $ parse_number(f0be30763a490cce).(const char *number, const char *name, int file_line) {
491 char *tail;
492 errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`! = 0;
493
494 int val = strtolcxx . . $ strtol(44bbb87609b212fc).(number, &tail, 0);
495 if (errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`! != 0)
496 error_at_linecxx . . $ `tools/gnulib/error.h:530:12`!(EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:96:9`!, 0, file_name, file_line,
497 "Not a valid %s '%s'. Must be a number\n", name, number);
498 if (number == tail)
499 error_at_linecxx . . $ `tools/gnulib/error.h:530:12`!(EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:96:9`!, 0, file_name, file_line,
500 "No digits found in %s '%s'. Must be a number\n", name, number);
501 return val;
502 }
503
504 static int *
505 read_inPoscxx . . $ read_inPos(36b8fd79d3600c16).(yaml_parser_tcxx . . $ yaml_parser_t# *parser, int translen) {
506 int *pos = malloccxx . . $ malloc(bfcfa4d6b7f7ef64).(sizeof(int) * translen);
507 int i = 0;
508 yaml_event_tcxx . . $ yaml_event_t# event;
509 int parse_error = 1;
510
511 if (!yaml_parser_parsecxx . . $ yaml_parser_parse(9fcd0b122d7bfbea).(parser, &event) || (event.typecxx . . $ yaml_event_s#type. != YAML_SEQUENCE_START_EVENTcxx . . $ YAML_SEQUENCE_START_EVENT.))
512 yaml_errorcxx . . $ yaml_error(e19e85592414518d).(YAML_SEQUENCE_START_EVENTcxx . . $ YAML_SEQUENCE_START_EVENT., &event);
513 yaml_event_deletecxx . . $ yaml_event_delete(a38ec22d89279e03).(&event);
514
515 while ((parse_error = yaml_parser_parsecxx . . $ yaml_parser_parse(9fcd0b122d7bfbea).(parser, &event)) &&
516 (event.typecxx . . $ yaml_event_s#type. == YAML_SCALAR_EVENTcxx . . $ YAML_SCALAR_EVENT.)) {
517 if (i >= translen)
518 error_at_linecxx . . $ `tools/gnulib/error.h:530:12`!(EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:96:9`!, 0, file_name, event.start_mark.line + 1,
519 "Too many input positions for translation of length %d.", translen);
520
521 pos[i++] = parse_numbercxx . . $ parse_number(f0be30763a490cce).((const char *)event.datacxx . . $ yaml_event_s#data..scalarcxx . . $ yaml_event_s#$anonymous_type_8#scalar..valuecxx . . $ yaml_event_s#$anonymous_type_8#$anonymous_type_14#value., "input position",
522 event.start_markcxx . . $ yaml_event_s#start_mark..linecxx . . $ yaml_mark_s#line. + 1);
523 yaml_event_deletecxx . . $ yaml_event_delete(a38ec22d89279e03).(&event);
524 }
525 if (i < translen)
526 error_at_linecxx . . $ `tools/gnulib/error.h:530:12`!(EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:96:9`!, 0, file_name, event.start_mark.line + 1,
527 "Too few input positions (%i) for translation of length %i\n", i,
528 translen);
529 if (!parse_error) yaml_parse_errorcxx . . $ yaml_parse_error(40d81e724c2bc0e).(parser);
530 if (event.typecxx . . $ yaml_event_s#type. != YAML_SEQUENCE_END_EVENTcxx . . $ YAML_SEQUENCE_END_EVENT.)
531 yaml_errorcxx . . $ yaml_error(e19e85592414518d).(YAML_SEQUENCE_END_EVENTcxx . . $ YAML_SEQUENCE_END_EVENT., &event);
532 yaml_event_deletecxx . . $ yaml_event_delete(a38ec22d89279e03).(&event);
533 return pos;
534 }
535
536 static int *
537 read_outPoscxx . . $ read_outPos(6704c40eda59416f).(yaml_parser_tcxx . . $ yaml_parser_t# *parser, int wrdlen, int translen) {
538 int *pos = malloccxx . . $ malloc(bfcfa4d6b7f7ef64).(sizeof(int) * wrdlen);
539 int i = 0;
540 yaml_event_tcxx . . $ yaml_event_t# event;
541 int parse_error = 1;
542
543 if (!yaml_parser_parsecxx . . $ yaml_parser_parse(9fcd0b122d7bfbea).(parser, &event) || (event.typecxx . . $ yaml_event_s#type. != YAML_SEQUENCE_START_EVENTcxx . . $ YAML_SEQUENCE_START_EVENT.))
544 yaml_errorcxx . . $ yaml_error(e19e85592414518d).(YAML_SEQUENCE_START_EVENTcxx . . $ YAML_SEQUENCE_START_EVENT., &event);
545 yaml_event_deletecxx . . $ yaml_event_delete(a38ec22d89279e03).(&event);
546
547 while ((parse_error = yaml_parser_parsecxx . . $ yaml_parser_parse(9fcd0b122d7bfbea).(parser, &event)) &&
548 (event.typecxx . . $ yaml_event_s#type. == YAML_SCALAR_EVENTcxx . . $ YAML_SCALAR_EVENT.)) {
549 if (i >= wrdlen)
550 error_at_linecxx . . $ `tools/gnulib/error.h:530:12`!(EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:96:9`!, 0, file_name, event.start_mark.line + 1,
551 "Too many output positions for input string of length %d.", translen);
552
553 pos[i++] = parse_numbercxx . . $ parse_number(f0be30763a490cce).((const char *)event.datacxx . . $ yaml_event_s#data..scalarcxx . . $ yaml_event_s#$anonymous_type_8#scalar..valuecxx . . $ yaml_event_s#$anonymous_type_8#$anonymous_type_14#value., "output position",
554 event.start_markcxx . . $ yaml_event_s#start_mark..linecxx . . $ yaml_mark_s#line. + 1);
555 yaml_event_deletecxx . . $ yaml_event_delete(a38ec22d89279e03).(&event);
556 }
557 if (i < wrdlen)
558 error_at_linecxx . . $ `tools/gnulib/error.h:530:12`!(EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:96:9`!, 0, file_name, event.start_mark.line + 1,
559 "Too few output positions (%i) for input string of length %i\n", i,
560 wrdlen);
561 if (!parse_error) yaml_parse_errorcxx . . $ yaml_parse_error(40d81e724c2bc0e).(parser);
562 if (event.typecxx . . $ yaml_event_s#type. != YAML_SEQUENCE_END_EVENTcxx . . $ YAML_SEQUENCE_END_EVENT.)
563 yaml_errorcxx . . $ yaml_error(e19e85592414518d).(YAML_SEQUENCE_END_EVENTcxx . . $ YAML_SEQUENCE_END_EVENT., &event);
564 yaml_event_deletecxx . . $ yaml_event_delete(a38ec22d89279e03).(&event);
565 return pos;
566 }
567
568 static void
569 read_cursorPoscxx . . $ read_cursorPos(49b3cdc6ce1dc9af).(yaml_parser_tcxx . . $ yaml_parser_t# *parser, int *cursorPos, int *expected_cursorPos, int wrdlen,
570 int translen) {
571 yaml_event_tcxx . . $ yaml_event_t# event;
572
573 if (!yaml_parser_parsecxx . . $ yaml_parser_parse(9fcd0b122d7bfbea).(parser, &event) ||
574 !(event.typecxx . . $ yaml_event_s#type. == YAML_SEQUENCE_START_EVENTcxx . . $ YAML_SEQUENCE_START_EVENT. || event.typecxx . . $ yaml_event_s#type. == YAML_SCALAR_EVENTcxx . . $ YAML_SCALAR_EVENT.))
575 error_at_linecxx . . $ `tools/gnulib/error.h:530:12`!(EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:96:9`!, 0, file_name, event.start_mark.line + 1,
576 "Expected %s or %s (actual %s)", event_names[YAML_SEQUENCE_START_EVENT],
577 event_names[YAML_SCALAR_EVENT], event_names[event.type]);
578
579 if (event.typecxx . . $ yaml_event_s#type. == YAML_SEQUENCE_START_EVENTcxx . . $ YAML_SEQUENCE_START_EVENT.) {
580 /* it's a sequence: read the two cursor positions (before and after) */
581 yaml_event_deletecxx . . $ yaml_event_delete(a38ec22d89279e03).(&event);
582 if (!yaml_parser_parsecxx . . $ yaml_parser_parse(9fcd0b122d7bfbea).(parser, &event) || (event.typecxx . . $ yaml_event_s#type. != YAML_SCALAR_EVENTcxx . . $ YAML_SCALAR_EVENT.))
583 yaml_errorcxx . . $ yaml_error(e19e85592414518d).(YAML_SCALAR_EVENTcxx . . $ YAML_SCALAR_EVENT., &event);
584 *cursorPos = parse_numbercxx . . $ parse_number(f0be30763a490cce).((const char *)event.datacxx . . $ yaml_event_s#data..scalarcxx . . $ yaml_event_s#$anonymous_type_8#scalar..valuecxx . . $ yaml_event_s#$anonymous_type_8#$anonymous_type_14#value.,
585 "cursor position", event.start_markcxx . . $ yaml_event_s#start_mark..linecxx . . $ yaml_mark_s#line. + 1);
586 if ((0 > *cursorPos) || (*cursorPos >= wrdlen))
587 error_at_linecxx . . $ `tools/gnulib/error.h:530:12`!(EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:96:9`!, 0, file_name, event.start_mark.line + 1,
588 "Cursor position (%i) outside of input string of length %i\n",
589 *cursorPos, wrdlen);
590 yaml_event_deletecxx . . $ yaml_event_delete(a38ec22d89279e03).(&event);
591 if (!yaml_parser_parsecxx . . $ yaml_parser_parse(9fcd0b122d7bfbea).(parser, &event) || (event.typecxx . . $ yaml_event_s#type. != YAML_SCALAR_EVENTcxx . . $ YAML_SCALAR_EVENT.))
592 error_at_linecxx . . $ `tools/gnulib/error.h:530:12`!(EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:96:9`!, 0, file_name, event.start_mark.line + 1,
593 "Too few cursor positions, 2 are expected (before and after)\n");
594 *expected_cursorPos = parse_numbercxx . . $ parse_number(f0be30763a490cce).((const char *)event.datacxx . . $ yaml_event_s#data..scalarcxx . . $ yaml_event_s#$anonymous_type_8#scalar..valuecxx . . $ yaml_event_s#$anonymous_type_8#$anonymous_type_14#value.,
595 "expected cursor position", event.start_markcxx . . $ yaml_event_s#start_mark..linecxx . . $ yaml_mark_s#line. + 1);
596 if ((0 > *expected_cursorPos) || (*expected_cursorPos >= wrdlen))
597 error_at_linecxx . . $ `tools/gnulib/error.h:530:12`!(EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:96:9`!, 0, file_name, event.start_mark.line + 1,
598 "Expected cursor position (%i) outside of output string of length "
599 "%i\n",
600 *expected_cursorPos, translen);
601 yaml_event_deletecxx . . $ yaml_event_delete(a38ec22d89279e03).(&event);
602 if (!yaml_parser_parsecxx . . $ yaml_parser_parse(9fcd0b122d7bfbea).(parser, &event) || (event.typecxx . . $ yaml_event_s#type. != YAML_SEQUENCE_END_EVENTcxx . . $ YAML_SEQUENCE_END_EVENT.))
603 error_at_linecxx . . $ `tools/gnulib/error.h:530:12`!(EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:96:9`!, 0, file_name, event.start_mark.line + 1,
604 "Too many cursor positions, only 2 are expected (before and "
605 "after)\n");
606 yaml_event_deletecxx . . $ yaml_event_delete(a38ec22d89279e03).(&event);
607 } else { // YAML_SCALAR_EVENT
608 /* it's just a single value: just read the initial cursor position */
609 *cursorPos = parse_numbercxx . . $ parse_number(f0be30763a490cce).((const char *)event.datacxx . . $ yaml_event_s#data..scalarcxx . . $ yaml_event_s#$anonymous_type_8#scalar..valuecxx . . $ yaml_event_s#$anonymous_type_8#$anonymous_type_14#value.,
610 "cursor position before", event.start_markcxx . . $ yaml_event_s#start_mark..linecxx . . $ yaml_mark_s#line. + 1);
611 if ((0 > *cursorPos) || (*cursorPos >= wrdlen))
612 error_at_linecxx . . $ `tools/gnulib/error.h:530:12`!(EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:96:9`!, 0, file_name, event.start_mark.line + 1,
613 "Cursor position (%i) outside of input string of length %i\n",
614 *cursorPos, wrdlen);
615 *expected_cursorPos = -1;
616 yaml_event_deletecxx . . $ yaml_event_delete(a38ec22d89279e03).(&event);
617 }
618 }
619
620 static void
621 read_typeform_stringcxx . . $ read_typeform_string(422a7c4679b67073).(yaml_parser_tcxx . . $ yaml_parser_t# *parser, formtypecxx . . $ formtype# *typeform, typeformscxx . . $ typeforms# kind, int len) {
622 yaml_event_tcxx . . $ yaml_event_t# event;
623 int typeform_len;
624
625 if (!yaml_parser_parsecxx . . $ yaml_parser_parse(9fcd0b122d7bfbea).(parser, &event) || (event.typecxx . . $ yaml_event_s#type. != YAML_SCALAR_EVENTcxx . . $ YAML_SCALAR_EVENT.))
626 yaml_errorcxx . . $ yaml_error(e19e85592414518d).(YAML_SCALAR_EVENTcxx . . $ YAML_SCALAR_EVENT., &event);
627 typeform_len = strlencxx . . $ strlen(751346f8406fd082).((const char *)event.datacxx . . $ yaml_event_s#data..scalarcxx . . $ yaml_event_s#$anonymous_type_8#scalar..valuecxx . . $ yaml_event_s#$anonymous_type_8#$anonymous_type_14#value.);
628 if (typeform_len != len)
629 error_at_linecxx . . $ `tools/gnulib/error.h:530:12`!(EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:96:9`!, 0, file_name, event.start_mark.line + 1,
630 "Too many or too few typeforms (%i) for word of length %i\n",
631 typeform_len, len);
632 update_typeformcxx . . $ update_typeform(7f194a4a3ee1ceb8).((const char *)event.datacxx . . $ yaml_event_s#data..scalarcxx . . $ yaml_event_s#$anonymous_type_8#scalar..valuecxx . . $ yaml_event_s#$anonymous_type_8#$anonymous_type_14#value., typeform, kind);
633 yaml_event_deletecxx . . $ yaml_event_delete(a38ec22d89279e03).(&event);
634 }
635
636 static formtypecxx . . $ formtype# *
637 read_typeformscxx . . $ read_typeforms(6977e33061a1e269).(yaml_parser_tcxx . . $ yaml_parser_t# *parser, int len) {
638 yaml_event_tcxx . . $ yaml_event_t# event;
639 formtypecxx . . $ formtype# *typeform = calloccxx . . $ calloc(63a7bf2941bfcd7a).(len, sizeof(formtypecxx . . $ formtype#));
640 int parse_error = 1;
641
642 if (!yaml_parser_parsecxx . . $ yaml_parser_parse(9fcd0b122d7bfbea).(parser, &event) || (event.typecxx . . $ yaml_event_s#type. != YAML_MAPPING_START_EVENTcxx . . $ YAML_MAPPING_START_EVENT.))
643 yaml_errorcxx . . $ yaml_error(e19e85592414518d).(YAML_MAPPING_START_EVENTcxx . . $ YAML_MAPPING_START_EVENT., &event);
644 yaml_event_deletecxx . . $ yaml_event_delete(a38ec22d89279e03).(&event);
645
646 while ((parse_error = yaml_parser_parsecxx . . $ yaml_parser_parse(9fcd0b122d7bfbea).(parser, &event)) &&
647 (event.typecxx . . $ yaml_event_s#type. == YAML_SCALAR_EVENTcxx . . $ YAML_SCALAR_EVENT.)) {
648 if (strcmpcxx . . $ strcmp(5ae29d726ae57f88).((const char *)event.datacxx . . $ yaml_event_s#data..scalarcxx . . $ yaml_event_s#$anonymous_type_8#scalar..valuecxx . . $ yaml_event_s#$anonymous_type_8#$anonymous_type_14#value., "computer_braille") == 0) {
649 yaml_event_deletecxx . . $ yaml_event_delete(a38ec22d89279e03).(&event);
650 read_typeform_stringcxx . . $ read_typeform_string(422a7c4679b67073).(parser, typeform, computer_braillecxx . . $ computer_braille., len);
651 } else if (strcmpcxx . . $ strcmp(5ae29d726ae57f88).((const char *)event.datacxx . . $ yaml_event_s#data..scalarcxx . . $ yaml_event_s#$anonymous_type_8#scalar..valuecxx . . $ yaml_event_s#$anonymous_type_8#$anonymous_type_14#value., "no_translate") == 0) {
652 yaml_event_deletecxx . . $ yaml_event_delete(a38ec22d89279e03).(&event);
653 read_typeform_stringcxx . . $ read_typeform_string(422a7c4679b67073).(parser, typeform, no_translatecxx . . $ no_translate., len);
654 } else if (strcmpcxx . . $ strcmp(5ae29d726ae57f88).((const char *)event.datacxx . . $ yaml_event_s#data..scalarcxx . . $ yaml_event_s#$anonymous_type_8#scalar..valuecxx . . $ yaml_event_s#$anonymous_type_8#$anonymous_type_14#value., "no_contract") == 0) {
655 yaml_event_deletecxx . . $ yaml_event_delete(a38ec22d89279e03).(&event);
656 read_typeform_stringcxx . . $ read_typeform_string(422a7c4679b67073).(parser, typeform, no_contractcxx . . $ no_contract., len);
657 } else {
658 int i;
659 typeformscxx . . $ typeforms# kind = plain_textcxx . . $ plain_text.;
660 for (i = 0; emph_classescxx . . $ emph_classes.[i]; i++) {
661 if (strcmpcxx . . $ strcmp(5ae29d726ae57f88).((const char *)event.datacxx . . $ yaml_event_s#data..scalarcxx . . $ yaml_event_s#$anonymous_type_8#scalar..valuecxx . . $ yaml_event_s#$anonymous_type_8#$anonymous_type_14#value., emph_classescxx . . $ emph_classes.[i]) == 0) {
662 yaml_event_deletecxx . . $ yaml_event_delete(a38ec22d89279e03).(&event);
663 kind = italiccxx . . $ `liblouis/liblouis.h:88:9`! << i;
664 if (kind > emph_10cxx . . $ emph_10.)
665 error_at_linecxx . . $ `tools/gnulib/error.h:530:12`!(EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:96:9`!, 0, file_name,
666 event.start_mark.line + 1,
667 "Typeform '%s' was not declared\n",
668 event.data.scalar.value);
669 read_typeform_stringcxx . . $ read_typeform_string(422a7c4679b67073).(parser, typeform, kind, len);
670 break;
671 }
672 }
673 }
674 yaml_event_deletecxx . . $ yaml_event_delete(a38ec22d89279e03).(&event);
675 }
676 if (!parse_error) yaml_parse_errorcxx . . $ yaml_parse_error(40d81e724c2bc0e).(parser);
677
678 if (event.typecxx . . $ yaml_event_s#type. != YAML_MAPPING_END_EVENTcxx . . $ YAML_MAPPING_END_EVENT.) yaml_errorcxx . . $ yaml_error(e19e85592414518d).(YAML_MAPPING_END_EVENTcxx . . $ YAML_MAPPING_END_EVENT., &event);
679 yaml_event_deletecxx . . $ yaml_event_delete(a38ec22d89279e03).(&event);
680 return typeform;
681 }
682
683 static void
684 read_optionscxx . . $ read_options(e96121a4760df8cc).(yaml_parser_tcxx . . $ yaml_parser_t# *parser, int testmode, int wordLen, int translationLen,
685 int *xfail, translationModescxx . . $ translationModes# *mode, formtypecxx . . $ formtype# **typeform,
686 formtypecxx . . $ formtype# **expected_typeform, int **inPos, int **outPos, int *cursorPos,
687 int *cursorOutPos, int *maxOutputLen, int *realInputLen) {
688 yaml_event_tcxx . . $ yaml_event_t# event;
689 char *option_name;
690 int parse_error = 1;
691
692 *mode = 0;
693 *xfail = XFAIL_NONEcxx . . $ `tools/lou_checkyaml.c:373:9`!;
694 *typeform = NULLcxx . . $ `<external>/16391990256953433862/stddef.h:419:9`!;
695 *expected_typeform = NULLcxx . . $ `<external>/16391990256953433862/stddef.h:419:9`!;
696 *inPos = NULLcxx . . $ `<external>/16391990256953433862/stddef.h:419:9`!;
697 *outPos = NULLcxx . . $ `<external>/16391990256953433862/stddef.h:419:9`!;
698
699 while ((parse_error = yaml_parser_parsecxx . . $ yaml_parser_parse(9fcd0b122d7bfbea).(parser, &event)) &&
700 (event.typecxx . . $ yaml_event_s#type. == YAML_SCALAR_EVENTcxx . . $ YAML_SCALAR_EVENT.)) {
701 option_name =
702 strndupcxx . . $ strndup(eabdfdef77619b3d).((const char *)event.datacxx . . $ yaml_event_s#data..scalarcxx . . $ yaml_event_s#$anonymous_type_8#scalar..valuecxx . . $ yaml_event_s#$anonymous_type_8#$anonymous_type_14#value., event.datacxx . . $ yaml_event_s#data..scalarcxx . . $ yaml_event_s#$anonymous_type_8#scalar..lengthcxx . . $ yaml_event_s#$anonymous_type_8#$anonymous_type_14#length.);
703
704 if (!strcmpcxx . . $ strcmp(5ae29d726ae57f88).(option_name, "xfail")) {
705 yaml_event_deletecxx . . $ yaml_event_delete(a38ec22d89279e03).(&event);
706 *xfail = read_xfailcxx . . $ read_xfail(3cfc1e679d24aa99).(parser);
707 } else if (!strcmpcxx . . $ strcmp(5ae29d726ae57f88).(option_name, "mode")) {
708 yaml_event_deletecxx . . $ yaml_event_delete(a38ec22d89279e03).(&event);
709 *mode = read_modecxx . . $ read_mode(5a20f3f56e3ba57).(parser);
710 } else if (!strcmpcxx . . $ strcmp(5ae29d726ae57f88).(option_name, "typeform")) {
711 if (testmode != MODE_TRANSLATION_FORWARDcxx . . $ `tools/lou_checkyaml.c:50:9`!) {
712 error_at_linecxx . . $ `tools/gnulib/error.h:530:12`!(EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:96:9`!, 0, file_name, event.start_mark.line + 1,
713 "typeform only supported with testmode 'forward'\n");
714 }
715 yaml_event_deletecxx . . $ yaml_event_delete(a38ec22d89279e03).(&event);
716 *typeform = read_typeformscxx . . $ read_typeforms(6977e33061a1e269).(parser, wordLen);
717 } else if (!strcmpcxx . . $ strcmp(5ae29d726ae57f88).(option_name, "expected_typeform")) {
718 if (testmode != MODE_TRANSLATION_BACKWARDcxx . . $ `tools/lou_checkyaml.c:51:9`!) {
719 error_at_linecxx . . $ `tools/gnulib/error.h:530:12`!(EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:96:9`!, 0, file_name, event.start_mark.line + 1,
720 "expected_typeform only supported with testmode 'backward'\n");
721 }
722 yaml_event_deletecxx . . $ yaml_event_delete(a38ec22d89279e03).(&event);
723 *expected_typeform = read_typeformscxx . . $ read_typeforms(6977e33061a1e269).(parser, translationLen);
724 } else if (!strcmpcxx . . $ strcmp(5ae29d726ae57f88).(option_name, "inputPos")) {
725 yaml_event_deletecxx . . $ yaml_event_delete(a38ec22d89279e03).(&event);
726 *inPos = read_inPoscxx . . $ read_inPos(36b8fd79d3600c16).(parser, translationLen);
727 } else if (!strcmpcxx . . $ strcmp(5ae29d726ae57f88).(option_name, "outputPos")) {
728 yaml_event_deletecxx . . $ yaml_event_delete(a38ec22d89279e03).(&event);
729 *outPos = read_outPoscxx . . $ read_outPos(6704c40eda59416f).(parser, wordLen, translationLen);
730 } else if (!strcmpcxx . . $ strcmp(5ae29d726ae57f88).(option_name, "cursorPos")) {
731 if (testmode == MODE_TRANSLATION_BOTH_DIRECTIONScxx . . $ `tools/lou_checkyaml.c:52:9`!) {
732 error_at_linecxx . . $ `tools/gnulib/error.h:530:12`!(EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:96:9`!, 0, file_name, event.start_mark.line + 1,
733 "cursorPos not supported with testmode 'bothDirections'\n");
734 }
735 yaml_event_deletecxx . . $ yaml_event_delete(a38ec22d89279e03).(&event);
736 read_cursorPoscxx . . $ read_cursorPos(49b3cdc6ce1dc9af).(parser, cursorPos, cursorOutPos, wordLen, translationLen);
737 } else if (!strcmpcxx . . $ strcmp(5ae29d726ae57f88).(option_name, "maxOutputLength")) {
738 if (testmode == MODE_TRANSLATION_BOTH_DIRECTIONScxx . . $ `tools/lou_checkyaml.c:52:9`!) {
739 error_at_linecxx . . $ `tools/gnulib/error.h:530:12`!(EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:96:9`!, 0, file_name, event.start_mark.line + 1,
740 "maxOutputLength not supported with testmode 'bothDirections'\n");
741 }
742 yaml_event_deletecxx . . $ yaml_event_delete(a38ec22d89279e03).(&event);
743 if (!yaml_parser_parsecxx . . $ yaml_parser_parse(9fcd0b122d7bfbea).(parser, &event) || (event.typecxx . . $ yaml_event_s#type. != YAML_SCALAR_EVENTcxx . . $ YAML_SCALAR_EVENT.))
744 yaml_errorcxx . . $ yaml_error(e19e85592414518d).(YAML_SCALAR_EVENTcxx . . $ YAML_SCALAR_EVENT., &event);
745 *maxOutputLen = parse_numbercxx . . $ parse_number(f0be30763a490cce).((const char *)event.datacxx . . $ yaml_event_s#data..scalarcxx . . $ yaml_event_s#$anonymous_type_8#scalar..valuecxx . . $ yaml_event_s#$anonymous_type_8#$anonymous_type_14#value.,
746 "Maximum output length", event.start_markcxx . . $ yaml_event_s#start_mark..linecxx . . $ yaml_mark_s#line. + 1);
747 if (*maxOutputLen <= 0)
748 error_at_linecxx . . $ `tools/gnulib/error.h:530:12`!(EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:96:9`!, 0, file_name, event.start_mark.line + 1,
749 "Maximum output length (%i) must be a positive number\n",
750 *maxOutputLen);
751 if (*maxOutputLen < translationLen)
752 error_at_linecxx . . $ `tools/gnulib/error.h:530:12`!(EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:96:9`!, 0, file_name, event.start_mark.line + 1,
753 "Expected translation length (%i) must not exceed maximum output "
754 "length (%i)\n",
755 translationLen, *maxOutputLen);
756 yaml_event_deletecxx . . $ yaml_event_delete(a38ec22d89279e03).(&event);
757 } else if (!strcmpcxx . . $ strcmp(5ae29d726ae57f88).(option_name, "realInputLength")) {
758 yaml_event_deletecxx . . $ yaml_event_delete(a38ec22d89279e03).(&event);
759 if (!yaml_parser_parsecxx . . $ yaml_parser_parse(9fcd0b122d7bfbea).(parser, &event) || (event.typecxx . . $ yaml_event_s#type. != YAML_SCALAR_EVENTcxx . . $ YAML_SCALAR_EVENT.))
760 yaml_errorcxx . . $ yaml_error(e19e85592414518d).(YAML_SCALAR_EVENTcxx . . $ YAML_SCALAR_EVENT., &event);
761 *realInputLen = parse_numbercxx . . $ parse_number(f0be30763a490cce).((const char *)event.datacxx . . $ yaml_event_s#data..scalarcxx . . $ yaml_event_s#$anonymous_type_8#scalar..valuecxx . . $ yaml_event_s#$anonymous_type_8#$anonymous_type_14#value.,
762 "Real input length", event.start_markcxx . . $ yaml_event_s#start_mark..linecxx . . $ yaml_mark_s#line. + 1);
763 if (*realInputLen < 0)
764 error_at_linecxx . . $ `tools/gnulib/error.h:530:12`!(EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:96:9`!, 0, file_name, event.start_mark.line + 1,
765 "Real input length (%i) must not be a negative number\n",
766 *realInputLen);
767 if (*realInputLen > wordLen)
768 error_at_linecxx . . $ `tools/gnulib/error.h:530:12`!(EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:96:9`!, 0, file_name, event.start_mark.line + 1,
769 "Real input length (%i) must not exceed total input "
770 "length (%i)\n",
771 *realInputLen, wordLen);
772 yaml_event_deletecxx . . $ yaml_event_delete(a38ec22d89279e03).(&event);
773 } else {
774 error_at_linecxx . . $ `tools/gnulib/error.h:530:12`!(EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:96:9`!, 0, file_name, event.start_mark.line + 1,
775 "Unsupported option %s", option_name);
776 }
777 freecxx . . $ free(5d22bdacc48458e8).(option_name);
778 }
779 if (!parse_error) yaml_parse_errorcxx . . $ yaml_parse_error(40d81e724c2bc0e).(parser);
780 if (event.typecxx . . $ yaml_event_s#type. != YAML_MAPPING_END_EVENTcxx . . $ YAML_MAPPING_END_EVENT.) yaml_errorcxx . . $ yaml_error(e19e85592414518d).(YAML_MAPPING_END_EVENTcxx . . $ YAML_MAPPING_END_EVENT., &event);
781 yaml_event_deletecxx . . $ yaml_event_delete(a38ec22d89279e03).(&event);
782 }
783
784 static void
785 check_translationcxx . . $ check_translation(b3c7ca04e0d8a60d).(yaml_event_tcxx . . $ yaml_event_t# event, char *table, char *word, char *translation,
786 const char *display_table, char *description, formtypecxx . . $ formtype# *typeform,
787 formtypecxx . . $ formtype# *expected_typeform, translationModescxx . . $ translationModes# mode, int *expected_inputPos,
788 int *expected_outputPos, int cursorPos, int expected_cursorPos, int max_outlen,
789 int real_inlen, int direction, int xfail) {
790 int r = 0;
791 // FIXME: Note that the typeform array was constructed using the
792 // emphasis classes mapping of the last compiled table. This
793 // means that if we are testing multiple tables at the same time
794 // they must have the same mapping (i.e. the emphasis classes
795 // must be defined in the same order).
796 r = checkcxx . . $ `tools/brl_checks.h:94:9`!(table, word, translation, .display_table = display_table,
797 .typeform = typeform, .expected_typeform = expected_typeform, .mode = mode,
798 .expected_inputPos = expected_inputPos,
799 .expected_outputPos = expected_outputPos, .cursorPos = cursorPos,
800 .expected_cursorPos = expected_cursorPos, .max_outlen = max_outlen,
801 .real_inlen = real_inlen, .direction = direction, .diagnostics = !xfail);
802
803 if (xfail != r) {
804 // FAIL or XPASS
805 if (description) fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:159:9`!, "%s\n", description);
806 error_at_linecxx . . $ `tools/gnulib/error.h:530:12`!(0, 0, file_name, event.start_mark.line + 1,
807 (xfail ? "Unexpected Pass" : "Failure"));
808 errorscxx . . $ errors.++;
809 // on error print the table name, as it isn't always clear
810 // which table we are testing. You can can define a test
811 // for multiple tables.
812 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:159:9`!, "Table: %s\n", table);
813 if (display_table) fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:159:9`!, "Display table: %s\n", display_table);
814 // add an empty line after each error
815 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:159:9`!, "\n");
816 } else if (xfail && r && verbosecxx . . $ verbose.) {
817 // XFAIL
818 // in verbose mode print expected failures
819 if (description) fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:159:9`!, "%s\n", description);
820 error_at_linecxx . . $ `tools/gnulib/error.h:530:12`!(0, 0, file_name, event.start_mark.line + 1, "Expected Failure");
821 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:159:9`!, "Table: %s\n", table);
822 if (display_table) fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:159:9`!, "Display table: %s\n", display_table);
823 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:159:9`!, "\n");
824 }
825 }
826
827 static void
828 read_testcxx . . $ read_test(4be7213f5bb38eb9).(yaml_parser_tcxx . . $ yaml_parser_t# *parser, char **tables, const char *display_table, int testmode) {
829 yaml_event_tcxx . . $ yaml_event_t# event;
830 char *description = NULLcxx . . $ `<external>/16391990256953433862/stddef.h:419:9`!;
831 char *word;
832 char *translation;
833 int xfail = XFAIL_NONEcxx . . $ `tools/lou_checkyaml.c:373:9`!;
834 translationModescxx . . $ translationModes# mode = 0;
835 formtypecxx . . $ formtype# *typeform = NULLcxx . . $ `<external>/16391990256953433862/stddef.h:419:9`!;
836 formtypecxx . . $ formtype# *expected_typeform = NULLcxx . . $ `<external>/16391990256953433862/stddef.h:419:9`!;
837 int *inPos = NULLcxx . . $ `<external>/16391990256953433862/stddef.h:419:9`!;
838 int *outPos = NULLcxx . . $ `<external>/16391990256953433862/stddef.h:419:9`!;
839 int cursorPos = -1;
840 int cursorOutPos = -1;
841 int maxOutputLen = -1;
842 int realInputLen = -1;
843
844 if (!yaml_parser_parsecxx . . $ yaml_parser_parse(9fcd0b122d7bfbea).(parser, &event) || (event.typecxx . . $ yaml_event_s#type. != YAML_SCALAR_EVENTcxx . . $ YAML_SCALAR_EVENT.))
845 simple_errorcxx . . $ simple_error(3e4c1fd2975b5693).("Word expected", parser, &event);
846
847 word = strndupcxx . . $ strndup(eabdfdef77619b3d).((const char *)event.datacxx . . $ yaml_event_s#data..scalarcxx . . $ yaml_event_s#$anonymous_type_8#scalar..valuecxx . . $ yaml_event_s#$anonymous_type_8#$anonymous_type_14#value., event.datacxx . . $ yaml_event_s#data..scalarcxx . . $ yaml_event_s#$anonymous_type_8#scalar..lengthcxx . . $ yaml_event_s#$anonymous_type_8#$anonymous_type_14#length.);
848 yaml_event_deletecxx . . $ yaml_event_delete(a38ec22d89279e03).(&event);
849
850 if (!yaml_parser_parsecxx . . $ yaml_parser_parse(9fcd0b122d7bfbea).(parser, &event) || (event.typecxx . . $ yaml_event_s#type. != YAML_SCALAR_EVENTcxx . . $ YAML_SCALAR_EVENT.))
851 simple_errorcxx . . $ simple_error(3e4c1fd2975b5693).("Translation expected", parser, &event);
852
853 translation =
854 strndupcxx . . $ strndup(eabdfdef77619b3d).((const char *)event.datacxx . . $ yaml_event_s#data..scalarcxx . . $ yaml_event_s#$anonymous_type_8#scalar..valuecxx . . $ yaml_event_s#$anonymous_type_8#$anonymous_type_14#value., event.datacxx . . $ yaml_event_s#data..scalarcxx . . $ yaml_event_s#$anonymous_type_8#scalar..lengthcxx . . $ yaml_event_s#$anonymous_type_8#$anonymous_type_14#length.);
855 yaml_event_deletecxx . . $ yaml_event_delete(a38ec22d89279e03).(&event);
856
857 if (!yaml_parser_parsecxx . . $ yaml_parser_parse(9fcd0b122d7bfbea).(parser, &event)) yaml_parse_errorcxx . . $ yaml_parse_error(40d81e724c2bc0e).(parser);
858
859 /* Handle an optional description */
860 if (event.typecxx . . $ yaml_event_s#type. == YAML_SCALAR_EVENTcxx . . $ YAML_SCALAR_EVENT.) {
861 description = word;
862 word = translation;
863 translation =
864 strndupcxx . . $ strndup(eabdfdef77619b3d).((const char *)event.datacxx . . $ yaml_event_s#data..scalarcxx . . $ yaml_event_s#$anonymous_type_8#scalar..valuecxx . . $ yaml_event_s#$anonymous_type_8#$anonymous_type_14#value., event.datacxx . . $ yaml_event_s#data..scalarcxx . . $ yaml_event_s#$anonymous_type_8#scalar..lengthcxx . . $ yaml_event_s#$anonymous_type_8#$anonymous_type_14#length.);
865 yaml_event_deletecxx . . $ yaml_event_delete(a38ec22d89279e03).(&event);
866
867 if (!yaml_parser_parsecxx . . $ yaml_parser_parse(9fcd0b122d7bfbea).(parser, &event)) yaml_parse_errorcxx . . $ yaml_parse_error(40d81e724c2bc0e).(parser);
868 }
869
870 if (event.typecxx . . $ yaml_event_s#type. == YAML_MAPPING_START_EVENTcxx . . $ YAML_MAPPING_START_EVENT.) {
871 yaml_event_deletecxx . . $ yaml_event_delete(a38ec22d89279e03).(&event);
872 read_optionscxx . . $ read_options(e96121a4760df8cc).(parser, testmode, parsed_strlencxx . . $ parsed_strlen(1ef8e6ec083aabb9).(word), parsed_strlencxx . . $ parsed_strlen(1ef8e6ec083aabb9).(translation),
873 &xfail, &mode, &typeform, &expected_typeform, &inPos, &outPos, &cursorPos,
874 &cursorOutPos, &maxOutputLen, &realInputLen);
875
876 if (!yaml_parser_parsecxx . . $ yaml_parser_parse(9fcd0b122d7bfbea).(parser, &event) || (event.typecxx . . $ yaml_event_s#type. != YAML_SEQUENCE_END_EVENTcxx . . $ YAML_SEQUENCE_END_EVENT.))
877 yaml_errorcxx . . $ yaml_error(e19e85592414518d).(YAML_SEQUENCE_END_EVENTcxx . . $ YAML_SEQUENCE_END_EVENT., &event);
878 } else if (event.typecxx . . $ yaml_event_s#type. != YAML_SEQUENCE_END_EVENTcxx . . $ YAML_SEQUENCE_END_EVENT.) {
879 error_at_linecxx . . $ `tools/gnulib/error.h:530:12`!(EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:96:9`!, 0, file_name, event.start_mark.line + 1,
880 "Expected %s or %s (actual %s)", event_names[YAML_MAPPING_START_EVENT],
881 event_names[YAML_SEQUENCE_END_EVENT], event_names[event.type]);
882 }
883
884 char **table = tables;
885 int xfail_forward = (xfail == XFAIL_FORWARDcxx . . $ `tools/lou_checkyaml.c:374:9`! || xfail == XFAIL_BOTHcxx . . $ `tools/lou_checkyaml.c:376:9`!);
886 int xfail_backward = (xfail == XFAIL_BACKWARDcxx . . $ `tools/lou_checkyaml.c:375:9`! || xfail == XFAIL_BOTHcxx . . $ `tools/lou_checkyaml.c:376:9`!);
887 while (*table) {
888 switch (testmode) {
889 case MODE_HYPHENATIONcxx . . $ `tools/lou_checkyaml.c:53:9`!:
890 case MODE_HYPHENATION_BRAILLEcxx . . $ `tools/lou_checkyaml.c:54:9`!:
891 check_hyphenationcxx . . $ check_hyphenation(f37f69d9dd87ffca).(
892 *table, word, translation, testmode == MODE_HYPHENATION_BRAILLEcxx . . $ `tools/lou_checkyaml.c:54:9`!);
893 break;
894 case MODE_DISPLAYcxx . . $ `tools/lou_checkyaml.c:55:9`!:
895 check_displaycxx . . $ check_display(a8ee6f950d471de8).(*table, word, translation);
896 break;
897 case MODE_TRANSLATION_FORWARDcxx . . $ `tools/lou_checkyaml.c:50:9`!:
898 check_translationcxx . . $ check_translation(b3c7ca04e0d8a60d).(event, *table, word, translation, display_table,
899 description, typeform, NULLcxx . . $ `<external>/16391990256953433862/stddef.h:419:9`!, mode, inPos, outPos, cursorPos,
900 cursorOutPos, maxOutputLen, realInputLen, DIRECTION_FORWARDcxx . . $ `tools/brl_checks.h:48:9`!,
901 xfail_forward);
902 break;
903 case MODE_TRANSLATION_BACKWARDcxx . . $ `tools/lou_checkyaml.c:51:9`!:
904 check_translationcxx . . $ check_translation(b3c7ca04e0d8a60d).(event, *table, word, translation, display_table,
905 description, NULLcxx . . $ `<external>/16391990256953433862/stddef.h:419:9`!, expected_typeform, mode, inPos, outPos, cursorPos,
906 cursorOutPos, maxOutputLen, realInputLen, DIRECTION_BACKWARDcxx . . $ `tools/brl_checks.h:49:9`!,
907 xfail_backward);
908 break;
909 case MODE_TRANSLATION_BOTH_DIRECTIONScxx . . $ `tools/lou_checkyaml.c:52:9`!:
910 check_translationcxx . . $ check_translation(b3c7ca04e0d8a60d).(event, *table, word, translation, display_table,
911 description, typeform, NULLcxx . . $ `<external>/16391990256953433862/stddef.h:419:9`!, mode, inPos, outPos, cursorPos,
912 cursorOutPos, maxOutputLen, realInputLen, DIRECTION_FORWARDcxx . . $ `tools/brl_checks.h:48:9`!,
913 xfail_forward);
914 check_translationcxx . . $ check_translation(b3c7ca04e0d8a60d).(event, *table, translation, word, display_table,
915 description, NULLcxx . . $ `<external>/16391990256953433862/stddef.h:419:9`!, expected_typeform, mode, outPos, inPos, cursorPos,
916 cursorOutPos, maxOutputLen, realInputLen, DIRECTION_BACKWARDcxx . . $ `tools/brl_checks.h:49:9`!,
917 xfail_backward);
918 break;
919 }
920 table++;
921 countcxx . . $ count.++;
922 }
923 yaml_event_deletecxx . . $ yaml_event_delete(a38ec22d89279e03).(&event);
924
925 freecxx . . $ free(5d22bdacc48458e8).(description);
926 freecxx . . $ free(5d22bdacc48458e8).(word);
927 freecxx . . $ free(5d22bdacc48458e8).(translation);
928 freecxx . . $ free(5d22bdacc48458e8).(typeform);
929 freecxx . . $ free(5d22bdacc48458e8).(expected_typeform);
930 freecxx . . $ free(5d22bdacc48458e8).(inPos);
931 freecxx . . $ free(5d22bdacc48458e8).(outPos);
932 }
933
934 static void
935 read_testscxx . . $ read_tests(4be7213f5bb38eb9).(
936 yaml_parser_tcxx . . $ yaml_parser_t# *parser, char **tables, const char *display_table, int testmode) {
937 yaml_event_tcxx . . $ yaml_event_t# event;
938 if (!yaml_parser_parsecxx . . $ yaml_parser_parse(9fcd0b122d7bfbea).(parser, &event) || (event.typecxx . . $ yaml_event_s#type. != YAML_SEQUENCE_START_EVENTcxx . . $ YAML_SEQUENCE_START_EVENT.))
939 yaml_errorcxx . . $ yaml_error(e19e85592414518d).(YAML_SEQUENCE_START_EVENTcxx . . $ YAML_SEQUENCE_START_EVENT., &event);
940
941 yaml_event_deletecxx . . $ yaml_event_delete(a38ec22d89279e03).(&event);
942
943 int done = 0;
944 while (!done) {
945 if (!yaml_parser_parsecxx . . $ yaml_parser_parse(9fcd0b122d7bfbea).(parser, &event)) {
946 yaml_parse_errorcxx . . $ yaml_parse_error(40d81e724c2bc0e).(parser);
947 }
948 if (event.typecxx . . $ yaml_event_s#type. == YAML_SEQUENCE_END_EVENTcxx . . $ YAML_SEQUENCE_END_EVENT.) {
949 done = 1;
950 yaml_event_deletecxx . . $ yaml_event_delete(a38ec22d89279e03).(&event);
951 } else if (event.typecxx . . $ yaml_event_s#type. == YAML_SEQUENCE_START_EVENTcxx . . $ YAML_SEQUENCE_START_EVENT.) {
952 yaml_event_deletecxx . . $ yaml_event_delete(a38ec22d89279e03).(&event);
953 read_testcxx . . $ read_test(4be7213f5bb38eb9).(parser, tables, display_table, testmode);
954 } else {
955 error_at_linecxx . . $ `tools/gnulib/error.h:530:12`!(EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:96:9`!, 0, file_name, event.start_mark.line + 1,
956 "Expected %s or %s (actual %s)", event_names[YAML_SEQUENCE_END_EVENT],
957 event_names[YAML_SEQUENCE_START_EVENT], event_names[event.type]);
958 }
959 }
960 }
961
962 /*
963 * This custom table resolver handles magic table names that represent
964 * inline tables.
965 */
966 static char **
967 customTableResolvercxx . . $ customTableResolver(e1b84bebe5b3f68b).(const char *tableList, const char *base) {
968 static char *dummy_table[1];
969 static char **ret;
970 char *p = (char *)tableList;
971 while (*p != '\0') {
972 if (strncmpcxx . . $ strncmp(fd278af2f295fa2e).(p, inline_table_prefixcxx . . $ inline_table_prefix., strlencxx . . $ strlen(751346f8406fd082).(inline_table_prefixcxx . . $ inline_table_prefix.)) == 0)
973 return dummy_table;
974 while (*p != '\0' && *p != ',') p++;
975 if (*p == ',') p++;
976 }
977 if (ret) {
978 for (int i = 0; ret[i]; i++) freecxx . . $ free(5d22bdacc48458e8).(ret[i]);
979 freecxx . . $ free(5d22bdacc48458e8).(ret);
980 }
981 ret = _lou_defaultTableResolvercxx . . $ _lou_defaultTableResolver(e1b84bebe5b3f68b).(tableList, base);
982 return ret;
983 }
984
985 #endif // HAVE_LIBYAML
986
987 int
988 maincxx . . $ main(afcd3168fc1188a4).(int argc, char *argv[]) {
989 int optc;
990
991 set_program_namecxx . . $ set_program_name(85c52e162fed56f9).(argv[0]);
992
993 while ((optc = getopt_longcxx . . $ getopt_long(41f665c090816971).(argc, argv, "hv", longoptscxx . . $ longopts., NULLcxx . . $ `<external>/16391990256953433862/stddef.h:419:9`!)) != -1) switch (optc) {
994 /* --help and --version exit immediately, per GNU coding standards. */
995 case 'v':
996 version_etccxx . . $ version_etc(b5fd392babfe1cc5).(
997 stdoutcxx . . $ `<external>/232824719582829767/stdio.h:158:9`!, program_namecxx . . $ program_name., PACKAGE_NAMEcxx . . $ `liblouis/config.h:631:9`!, VERSIONcxx . . $ `liblouis/config.h:804:9`!, AUTHORScxx . . $ `tools/lou_checkyaml.c:48:9`!, (char *)NULLcxx . . $ `<external>/16391990256953433862/stddef.h:419:9`!);
998 exitcxx . . $ exit(3ca292c338df9bb3).(EXIT_SUCCESScxx . . $ `<external>/10696550936717951914/stdlib.h:97:9`!);
999 break;
1000 case 'h':
1001 print_helpcxx . . $ print_help(49f6e7a06ebc5aa8).();
1002 exitcxx . . $ exit(3ca292c338df9bb3).(EXIT_SUCCESScxx . . $ `<external>/10696550936717951914/stdlib.h:97:9`!);
1003 break;
1004 default:
1005 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:159:9`!, "Try `%s --help' for more information.\n", program_namecxx . . $ program_name.);
1006 exitcxx . . $ exit(3ca292c338df9bb3).(EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:96:9`!);
1007 break;
1008 }
1009
1010 if (optindcxx . . $ optind. != argc - 1) {
1011 /* Print error message and exit. */
1012 if (optindcxx . . $ optind. < argc - 1)
1013 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:159:9`!, "%s: extra operand: %s\n", program_namecxx . . $ program_name., argv[optindcxx . . $ optind. + 1]);
1014 else
1015 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:159:9`!, "%s: no YAML test file specified\n", program_namecxx . . $ program_name.);
1016
1017 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:159:9`!, "Try `%s --help' for more information.\n", program_namecxx . . $ program_name.);
1018 exitcxx . . $ exit(3ca292c338df9bb3).(EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:96:9`!);
1019 }
1020
1021 #ifdef WITHOUT_YAML
1022 fprintf(stderr,
1023 "Skipping tests for %s as yaml was disabled in configure with "
1024 "--without-yaml\n",
1025 argv[1]);
1026 return EXIT_SKIPPED;
1027 #else
1028 #ifndef HAVE_LIBYAMLcxx . . $ `liblouis/config.h:334:9`!
1029 fprintf(stderr, "Skipping tests for %s as libyaml was not found\n", argv[1]);
1030 return EXIT_SKIPPED;
1031 #endif // not HAVE_LIBYAML
1032 #endif // WITHOUT_YAML
1033
1034 #ifndef WITHOUT_YAML
1035 #ifdef HAVE_LIBYAMLcxx . . $ `liblouis/config.h:334:9`!
1036
1037 FILEcxx . . $ FILE# *file;
1038 yaml_parser_tcxx . . $ yaml_parser_t# parser;
1039 yaml_event_tcxx . . $ yaml_event_t# event;
1040
1041 file_namecxx . . $ file_name. = argv[1];
1042 file = fopencxx . . $ fopen(82ec0787cd37e0a3).(file_namecxx . . $ file_name., "rb");
1043 if (!file) {
1044 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:159:9`!, "%s: file not found: %s\n", program_namecxx . . $ program_name., file_namecxx . . $ file_name.);
1045 exitcxx . . $ exit(3ca292c338df9bb3).(3);
1046 }
1047
1048 char *dir_name = strdupcxx . . $ strdup(a8b8e32347182212).(file_namecxx . . $ file_name.);
1049 int i = strlencxx . . $ strlen(751346f8406fd082).(dir_name);
1050 while (i > 0) {
1051 if (dir_name[i - 1] == '/' || dir_name[i - 1] == '\\') {
1052 i--;
1053 break;
1054 }
1055 i--;
1056 }
1057 dir_name[i] = '\0';
1058 // FIXME: problem with this is that
1059 // LOUIS_TABLEPATH=$(top_srcdir)/tables,... does not work anymore because
1060 // $(top_srcdir) == .. (not an absolute path)
1061 if (i > 0)
1062 if (chdircxx . . $ chdir(5c4306d8553b3696).(dir_name))
1063 errorcxx . . $ `tools/gnulib/error.h:470:12`!(EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:96:9`!, EIOcxx . . $ `<external>/8987895939074593727/errno-base.h:9:9`!, "Cannot change directory to %s", dir_name);
1064 freecxx . . $ free(5d22bdacc48458e8).(dir_name);
1065
1066 // register custom table resolver
1067 lou_registerTableResolvercxx . . $ lou_registerTableResolver(379c0bc4a854a49b).(&customTableResolvercxx . . $ customTableResolver(e1b84bebe5b3f68b).);
1068
1069 assertcxx . . $ `<external>/4398592474888995393/assert.h:156:12`!(yaml_parser_initialize(&parser));
1070
1071 yaml_parser_set_input_filecxx . . $ yaml_parser_set_input_file(4779686601ea6eb).(&parser, file);
1072
1073 if (!yaml_parser_parsecxx . . $ yaml_parser_parse(9fcd0b122d7bfbea).(&parser, &event) || (event.typecxx . . $ yaml_event_s#type. != YAML_STREAM_START_EVENTcxx . . $ YAML_STREAM_START_EVENT.)) {
1074 yaml_errorcxx . . $ yaml_error(e19e85592414518d).(YAML_STREAM_START_EVENTcxx . . $ YAML_STREAM_START_EVENT., &event);
1075 }
1076
1077 if (event.datacxx . . $ yaml_event_s#data..stream_startcxx . . $ yaml_event_s#$anonymous_type_8#stream_start..encodingcxx . . $ yaml_event_s#$anonymous_type_8#$anonymous_type_9#encoding. != YAML_UTF8_ENCODINGcxx . . $ YAML_UTF8_ENCODING.)
1078 error_at_linecxx . . $ `tools/gnulib/error.h:530:12`!(EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:96:9`!, 0, file_name, event.start_mark.line + 1,
1079 "UTF-8 encoding expected (actual %s)",
1080 encoding_names[event.data.stream_start.encoding]);
1081 yaml_event_deletecxx . . $ yaml_event_delete(a38ec22d89279e03).(&event);
1082
1083 if (!yaml_parser_parsecxx . . $ yaml_parser_parse(9fcd0b122d7bfbea).(&parser, &event) ||
1084 (event.typecxx . . $ yaml_event_s#type. != YAML_DOCUMENT_START_EVENTcxx . . $ YAML_DOCUMENT_START_EVENT.)) {
1085 yaml_errorcxx . . $ yaml_error(e19e85592414518d).(YAML_DOCUMENT_START_EVENTcxx . . $ YAML_DOCUMENT_START_EVENT., &event);
1086 }
1087 yaml_event_deletecxx . . $ yaml_event_delete(a38ec22d89279e03).(&event);
1088
1089 if (!yaml_parser_parsecxx . . $ yaml_parser_parse(9fcd0b122d7bfbea).(&parser, &event) || (event.typecxx . . $ yaml_event_s#type. != YAML_MAPPING_START_EVENTcxx . . $ YAML_MAPPING_START_EVENT.)) {
1090 yaml_errorcxx . . $ yaml_error(e19e85592414518d).(YAML_MAPPING_START_EVENTcxx . . $ YAML_MAPPING_START_EVENT., &event);
1091 }
1092 yaml_event_deletecxx . . $ yaml_event_delete(a38ec22d89279e03).(&event);
1093
1094 if (!yaml_parser_parsecxx . . $ yaml_parser_parse(9fcd0b122d7bfbea).(&parser, &event))
1095 simple_errorcxx . . $ simple_error(3e4c1fd2975b5693).("table expected", &parser, &event);
1096
1097 int MAXTABLES = 400;
1098 char *tables[MAXTABLES + 1];
1099 char *display_table = NULLcxx . . $ `<external>/16391990256953433862/stddef.h:419:9`!;
1100 while (1) {
1101 if (event.typecxx . . $ yaml_event_s#type. == YAML_SCALAR_EVENTcxx . . $ YAML_SCALAR_EVENT. &&
1102 !strcmpcxx . . $ strcmp(5ae29d726ae57f88).((const char *)event.datacxx . . $ yaml_event_s#data..scalarcxx . . $ yaml_event_s#$anonymous_type_8#scalar..valuecxx . . $ yaml_event_s#$anonymous_type_8#$anonymous_type_14#value., "display")) {
1103 table_valuecxx . . $ table_value# *v;
1104 freecxx . . $ free(5d22bdacc48458e8).(display_table);
1105 v = read_table_valuecxx . . $ read_table_value(6cf88f50b10c690a).(&parser, event.start_markcxx . . $ yaml_event_s#start_mark..linecxx . . $ yaml_mark_s#line. + 1, 1);
1106 display_table = strdupcxx . . $ strdup(a8b8e32347182212).((char *)v->namecxx . . $ $anonymous_type_282a937687b3c082_0#name.);
1107 if (v->contentcxx . . $ $anonymous_type_282a937687b3c082_0#content.)
1108 compile_inline_tablecxx . . $ compile_inline_table(a5d3e952d81e7576).(v);
1109 else if (!_lou_getDisplayTablecxx . . $ _lou_getDisplayTable(78757538624ff90f).(display_table))
1110 error_at_linecxx . . $ `tools/gnulib/error.h:530:12`!(EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:96:9`!, 0, file_name, event.start_mark.line + 1,
1111 "Display table %s not valid", display_table);
1112 free_table_valuecxx . . $ free_table_value(6a2f85743fb3a12c).(v);
1113 yaml_event_deletecxx . . $ yaml_event_delete(a38ec22d89279e03).(&event);
1114 if (!yaml_parser_parsecxx . . $ yaml_parser_parse(9fcd0b122d7bfbea).(&parser, &event))
1115 simple_errorcxx . . $ simple_error(3e4c1fd2975b5693).("table expected", &parser, &event);
1116 }
1117 if (!(tables[0] = read_tablecxx . . $ read_table(e30c107d3a945738).(&event, &parser, display_table))) break;
1118 yaml_event_deletecxx . . $ yaml_event_delete(a38ec22d89279e03).(&event);
1119 int k = 1;
1120 while (1) {
1121 if (!yaml_parser_parsecxx . . $ yaml_parser_parse(9fcd0b122d7bfbea).(&parser, &event))
1122 error_at_linecxx . . $ `tools/gnulib/error.h:530:12`!(EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:96:9`!, 0, file_name, event.start_mark.line + 1,
1123 "Expected table or %s (actual %s)",
1124 event_names[YAML_SCALAR_EVENT], event_names[event.type]);
1125 if ((tables[k++] = read_tablecxx . . $ read_table(e30c107d3a945738).(&event, &parser, display_table))) {
1126 if (k == MAXTABLES)
1127 error_at_linecxx . . $ `tools/gnulib/error.h:530:12`!(EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:96:9`!, 0, file_name, event.start_mark.line + 1,
1128 "Only %d tables in one YAML test supported", MAXTABLES);
1129 yaml_event_deletecxx . . $ yaml_event_delete(a38ec22d89279e03).(&event);
1130 } else
1131 break;
1132 }
1133
1134 if (event.typecxx . . $ yaml_event_s#type. != YAML_SCALAR_EVENTcxx . . $ YAML_SCALAR_EVENT.) yaml_errorcxx . . $ yaml_error(e19e85592414518d).(YAML_SCALAR_EVENTcxx . . $ YAML_SCALAR_EVENT., &event);
1135
1136 int haveRunTests = 0;
1137 while (1) {
1138 int testmode = MODE_DEFAULTcxx . . $ `tools/lou_checkyaml.c:56:9`!;
1139 if (!strcmpcxx . . $ strcmp(5ae29d726ae57f88).((const char *)event.datacxx . . $ yaml_event_s#data..scalarcxx . . $ yaml_event_s#$anonymous_type_8#scalar..valuecxx . . $ yaml_event_s#$anonymous_type_8#$anonymous_type_14#value., "flags")) {
1140 yaml_event_deletecxx . . $ yaml_event_delete(a38ec22d89279e03).(&event);
1141 read_flagscxx . . $ read_flags(afafab9d960b0dae).(&parser, &testmode);
1142
1143 if (!yaml_parser_parsecxx . . $ yaml_parser_parse(9fcd0b122d7bfbea).(&parser, &event) ||
1144 (event.typecxx . . $ yaml_event_s#type. != YAML_SCALAR_EVENTcxx . . $ YAML_SCALAR_EVENT.) ||
1145 strcmpcxx . . $ strcmp(5ae29d726ae57f88).((const char *)event.datacxx . . $ yaml_event_s#data..scalarcxx . . $ yaml_event_s#$anonymous_type_8#scalar..valuecxx . . $ yaml_event_s#$anonymous_type_8#$anonymous_type_14#value., "tests")) {
1146 simple_errorcxx . . $ simple_error(3e4c1fd2975b5693).("tests expected", &parser, &event);
1147 }
1148 yaml_event_deletecxx . . $ yaml_event_delete(a38ec22d89279e03).(&event);
1149 read_testscxx . . $ read_tests(4be7213f5bb38eb9).(&parser, tables, display_table, testmode);
1150 haveRunTests = 1;
1151
1152 } else if (!strcmpcxx . . $ strcmp(5ae29d726ae57f88).((const char *)event.datacxx . . $ yaml_event_s#data..scalarcxx . . $ yaml_event_s#$anonymous_type_8#scalar..valuecxx . . $ yaml_event_s#$anonymous_type_8#$anonymous_type_14#value., "tests")) {
1153 yaml_event_deletecxx . . $ yaml_event_delete(a38ec22d89279e03).(&event);
1154 read_testscxx . . $ read_tests(4be7213f5bb38eb9).(&parser, tables, display_table, testmode);
1155 haveRunTests = 1;
1156 } else {
1157 if (haveRunTests) {
1158 break;
1159 } else {
1160 simple_errorcxx . . $ simple_error(3e4c1fd2975b5693).("flags or tests expected", &parser, &event);
1161 }
1162 }
1163 if (!yaml_parser_parsecxx . . $ yaml_parser_parse(9fcd0b122d7bfbea).(&parser, &event))
1164 error_at_linecxx . . $ `tools/gnulib/error.h:530:12`!(EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:96:9`!, 0, file_name, event.start_mark.line + 1,
1165 "Expected table, flags, tests or %s (actual %s)",
1166 event_names[YAML_MAPPING_END_EVENT], event_names[event.type]);
1167 if (event.typecxx . . $ yaml_event_s#type. != YAML_SCALAR_EVENTcxx . . $ YAML_SCALAR_EVENT.) break;
1168 }
1169
1170 char **p = tables;
1171 while (*p) freecxx . . $ free(5d22bdacc48458e8).(*(p++));
1172 }
1173 if (event.typecxx . . $ yaml_event_s#type. != YAML_MAPPING_END_EVENTcxx . . $ YAML_MAPPING_END_EVENT.) yaml_errorcxx . . $ yaml_error(e19e85592414518d).(YAML_MAPPING_END_EVENTcxx . . $ YAML_MAPPING_END_EVENT., &event);
1174 yaml_event_deletecxx . . $ yaml_event_delete(a38ec22d89279e03).(&event);
1175
1176 if (!yaml_parser_parsecxx . . $ yaml_parser_parse(9fcd0b122d7bfbea).(&parser, &event) || (event.typecxx . . $ yaml_event_s#type. != YAML_DOCUMENT_END_EVENTcxx . . $ YAML_DOCUMENT_END_EVENT.)) {
1177 yaml_errorcxx . . $ yaml_error(e19e85592414518d).(YAML_DOCUMENT_END_EVENTcxx . . $ YAML_DOCUMENT_END_EVENT., &event);
1178 }
1179 yaml_event_deletecxx . . $ yaml_event_delete(a38ec22d89279e03).(&event);
1180
1181 if (!yaml_parser_parsecxx . . $ yaml_parser_parse(9fcd0b122d7bfbea).(&parser, &event) || (event.typecxx . . $ yaml_event_s#type. != YAML_STREAM_END_EVENTcxx . . $ YAML_STREAM_END_EVENT.)) {
1182 yaml_errorcxx . . $ yaml_error(e19e85592414518d).(YAML_STREAM_END_EVENTcxx . . $ YAML_STREAM_END_EVENT., &event);
1183 }
1184 yaml_event_deletecxx . . $ yaml_event_delete(a38ec22d89279e03).(&event);
1185
1186 yaml_parser_deletecxx . . $ yaml_parser_delete(40d81e724c2bc0e).(&parser);
1187
1188 freecxx . . $ free(5d22bdacc48458e8).(emph_classescxx . . $ emph_classes.);
1189 freecxx . . $ free(5d22bdacc48458e8).(display_table);
1190 lou_freecxx . . $ lou_free(49f6e7a06ebc5aa8).();
1191
1192 assertcxx . . $ `<external>/4398592474888995393/assert.h:156:12`!(!fclose(file));
1193
1194 printfcxx . . $ printf(581fddd72a8db8fc).("%s (%d tests, %d failure%s)\n", (errorscxx . . $ errors. ? "FAILURE" : "SUCCESS"), countcxx . . $ count.,
1195 errorscxx . . $ errors., ((errorscxx . . $ errors. != 1) ? "s" : ""));
1196
1197 return errorscxx . . $ errors. ? 1 : 0;
1198
1199 #endif // HAVE_LIBYAML
1200 #endif // not WITHOUT_YAML
1201 }