Debian Codegraph @

tools/lou_debug.c

raw symbols SCIP
1 /* liblouis Braille Translation and Back-Translation Library
2
3 Based on BRLTTY, copyright (C) 1999-2006 by
4 The BRLTTY Team
5
6 Copyright (C) 2004, 2005, 2006, 2009
7 ViewPlus Technologies, Inc. www.viewplus.com and
8 JJB Software, Inc. www.jjb-software.com
9
10 This program is free software: you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation, either version 3 of the License, or
13 (at your option) any later version.
14
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
19
20 You should have received a copy of the GNU General Public License
21 along with this program. If not, see <http://www.gnu.org/licenses/>.
22 */
23
24 #include <config.h>cxx . . $ `<file>/liblouis/config.h`/
25
26 #include <stdio.h>cxx . . $ `<file>/tools/gnulib/stdio.h`/
27 #include <string.h>cxx . . $ `<file>/gnulib/string.h`/
28 #include <stdlib.h>cxx . . $ `<file>/gnulib/stdlib.h`/
29 #include "internal.h"cxx . . $ `<file>/liblouis/internal.h`/
30 #include <getopt.h>
31 #include "progname.h"cxx . . $ `<file>/tools/gnulib/progname.h`/
32 #include "unistr.h"cxx . . $ `<file>/tools/gnulib/unistr.h`/
33 #include "version-etc.h"cxx . . $ `<file>/tools/gnulib/version-etc.h`/
34
35 static const struct optioncxx . . $ option# longoptscxx . . $ longopts.[] = {
36 { "help", no_argumentcxx . . $ `<external>/1746263805473775960/getopt_ext.h:62:9`!, NULLcxx . . $ `<external>/16391990256953433862/stddef.h:419:9`!, 'h' },
37 { "version", no_argumentcxx . . $ `<external>/1746263805473775960/getopt_ext.h:62:9`!, NULLcxx . . $ `<external>/16391990256953433862/stddef.h:419:9`!, 'v' },
38 { NULLcxx . . $ `<external>/16391990256953433862/stddef.h:419:9`!, 0, NULLcxx . . $ `<external>/16391990256953433862/stddef.h:419:9`!, 0 },
39 };
40
41 const char version_etc_copyrightcxx . . $ version_etc_copyright.[] =
42 "Copyright %s %d ViewPlus Technologies, Inc. and JJB Software, Inc.";
43
44 #define AUTHORScxx . . $ `tools/lou_debug.c:44:9`! "John J. Boyer"
45
46 static void
47 print_helpcxx . . $ print_help(49f6e7a06ebc5aa8).(void) {
48 printfcxx . . $ printf(581fddd72a8db8fc).("\
49 Usage: %s [OPTIONS] TABLE[,TABLE,...]\n",
50 program_namecxx . . $ program_name.);
51
52 fputscxx . . $ fputs(874fa6a5e59ab9bd).("\
53 Examine and debug Braille translation tables. This program allows you\n\
54 to inspect liblouis translation tables and gather information about\n\
55 them, such as forward and backward rules, characters and dot patterns,\n\
56 specific opcodes, the size of a table, whether a hyphenation\n\
57 table is used, how many passes the translation takes and much\n\
58 more.\n\n",
59 stdoutcxx . . $ `<external>/232824719582829767/stdio.h:158:9`!);
60
61 fputscxx . . $ fputs(874fa6a5e59ab9bd).("\
62 -h, --help display this help and exit\n\
63 -v, --version display version information and exit\n",
64 stdoutcxx . . $ `<external>/232824719582829767/stdio.h:158:9`!);
65
66 printfcxx . . $ printf(581fddd72a8db8fc).("\n");
67 printfcxx . . $ printf(581fddd72a8db8fc).("Report bugs to %s.\n", PACKAGE_BUGREPORTcxx . . $ `liblouis/config.h:628:9`!);
68
69 #ifdef PACKAGE_PACKAGER_BUG_REPORTS
70 printf("Report %s bugs to: %s\n", PACKAGE_PACKAGER, PACKAGE_PACKAGER_BUG_REPORTS);
71 #endif
72 #ifdef PACKAGE_URLcxx . . $ `liblouis/config.h:649:9`!
73 printfcxx . . $ printf(581fddd72a8db8fc).("%s home page: <%s>\n", PACKAGE_NAMEcxx . . $ `liblouis/config.h:631:9`!, PACKAGE_URLcxx . . $ `liblouis/config.h:649:9`!);
74 #endif
75 }
76
77 #define BUFSIZEcxx . . $ `tools/lou_debug.c:77:9`! 256
78
79 static const TranslationTableHeadercxx . . $ TranslationTableHeader# *tablecxx . . $ table.;
80 static const DisplayTableHeadercxx . . $ DisplayTableHeader# *displayTablecxx . . $ displayTable.;
81 static char inputBuffercxx . . $ inputBuffer.[BUFSIZEcxx . . $ `tools/lou_debug.c:77:9`!];
82
83 static int
84 getInputcxx . . $ getInput(b126dc7c1de90089).(void) {
85 int inputLength;
86 inputBuffercxx . . $ inputBuffer.[0] = 0;
87 if (!fgetscxx . . $ fgets(efb0aaba7ac866ae).(inputBuffercxx . . $ inputBuffer., sizeof(inputBuffercxx . . $ inputBuffer.), stdincxx . . $ `<external>/232824719582829767/stdio.h:157:9`!)) exitcxx . . $ exit(3ca292c338df9bb3).(EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:96:9`!);
88 inputLength = strlencxx . . $ strlen(751346f8406fd082).(inputBuffercxx . . $ inputBuffer.) - 1;
89 if (inputLength < 0) /* EOF on script */
90 exitcxx . . $ exit(3ca292c338df9bb3).(EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:96:9`!);
91 inputBuffercxx . . $ inputBuffer.[inputLength] = 0;
92 return inputLength;
93 }
94
95 static char *
96 print_charscxx . . $ print_chars(2b06688909ca43e3).(const widecharcxx . . $ widechar# *buffer, int length) {
97 static uint8_tcxx . . $ uint8_t# result_buf[BUFSIZEcxx . . $ `tools/lou_debug.c:77:9`!];
98 size_tcxx . . $ size_t# result_len = BUFSIZEcxx . . $ `tools/lou_debug.c:77:9`! - 1;
99 #ifdef WIDECHARS_ARE_UCS4
100 u32_to_u8(buffer, length, result_buf, &result_len);
101 #else
102 u16_to_u8cxx . . $ u16_to_u8(e729bd8f99eea2d2).(buffer, length, result_buf, &result_len);
103 #endif
104 result_buf[result_len] = 0;
105 return result_buf;
106 }
107
108 static int
109 printRulecxx . . $ printRule(ffe2bb1e8f674926).(TranslationTableRulecxx . . $ TranslationTableRule# *thisRule, int mode) {
110 printfcxx . . $ printf(581fddd72a8db8fc).("Rule: ");
111 printfcxx . . $ printf(581fddd72a8db8fc).("opcode=%s, ", _lou_findOpcodeNamecxx . . $ _lou_findOpcodeName(f7c4f7b5a5e836b1).(thisRule->opcodecxx . . $ $anonymous_type_11b10485cb0df85e_5#opcode.));
112 if (thisRule->beforecxx . . $ $anonymous_type_11b10485cb0df85e_5#before.) printfcxx . . $ printf(581fddd72a8db8fc).("before=%llx, ", thisRule->beforecxx . . $ $anonymous_type_11b10485cb0df85e_5#before.);
113 if (thisRule->aftercxx . . $ $anonymous_type_11b10485cb0df85e_5#after.) printfcxx . . $ printf(581fddd72a8db8fc).("after=%llx, ", thisRule->aftercxx . . $ $anonymous_type_11b10485cb0df85e_5#after.);
114 switch (thisRule->opcodecxx . . $ $anonymous_type_11b10485cb0df85e_5#opcode.) {
115 case CTO_Contextcxx . . $ CTO_Context.:
116 case CTO_Correctcxx . . $ CTO_Correct.:
117 case CTO_SwapCdcxx . . $ CTO_SwapCd.:
118 case CTO_SwapDdcxx . . $ CTO_SwapDd.:
119 case CTO_Pass2cxx . . $ CTO_Pass2.:
120 case CTO_Pass3cxx . . $ CTO_Pass3.:
121 case CTO_Pass4cxx . . $ CTO_Pass4.:
122 printfcxx . . $ printf(581fddd72a8db8fc).("code=%s ",
123 print_charscxx . . $ print_chars(2b06688909ca43e3).(thisRule->charsdotscxx . . $ $anonymous_type_11b10485cb0df85e_5#charsdots., thisRule->charslencxx . . $ $anonymous_type_11b10485cb0df85e_5#charslen. + thisRule->dotslencxx . . $ $anonymous_type_11b10485cb0df85e_5#dotslen.));
124 break;
125 default:
126 if (mode == 0) {
127 printfcxx . . $ printf(581fddd72a8db8fc).("chars=%s, ", print_charscxx . . $ print_chars(2b06688909ca43e3).(thisRule->charsdotscxx . . $ $anonymous_type_11b10485cb0df85e_5#charsdots., thisRule->charslencxx . . $ $anonymous_type_11b10485cb0df85e_5#charslen.));
128 printfcxx . . $ printf(581fddd72a8db8fc).("dots=%s, ",
129 _lou_showDotscxx . . $ _lou_showDots(dfd108baace36870).(
130 &thisRule->charsdotscxx . . $ $anonymous_type_11b10485cb0df85e_5#charsdots.[thisRule->charslencxx . . $ $anonymous_type_11b10485cb0df85e_5#charslen.], thisRule->dotslencxx . . $ $anonymous_type_11b10485cb0df85e_5#dotslen.));
131 } else {
132 printfcxx . . $ printf(581fddd72a8db8fc).("dots=%s, ",
133 _lou_showDotscxx . . $ _lou_showDots(dfd108baace36870).(
134 &thisRule->charsdotscxx . . $ $anonymous_type_11b10485cb0df85e_5#charsdots.[thisRule->charslencxx . . $ $anonymous_type_11b10485cb0df85e_5#charslen.], thisRule->dotslencxx . . $ $anonymous_type_11b10485cb0df85e_5#dotslen.));
135 printfcxx . . $ printf(581fddd72a8db8fc).("chars=%s, ", print_charscxx . . $ print_chars(2b06688909ca43e3).(thisRule->charsdotscxx . . $ $anonymous_type_11b10485cb0df85e_5#charsdots., thisRule->charslencxx . . $ $anonymous_type_11b10485cb0df85e_5#charslen.));
136 }
137 break;
138 }
139 return 1;
140 }
141
142 static int
143 printCharactercxx . . $ printCharacter(48749250fc5e1445).(TranslationTableCharactercxx . . $ TranslationTableCharacter# *thisChar, int mode) {
144 TranslationTableRulecxx . . $ TranslationTableRule# *thisRule;
145 TranslationTableOffsetcxx . . $ TranslationTableOffset# nextRule;
146 if (mode == 0) {
147 printfcxx . . $ printf(581fddd72a8db8fc).("Char: ");
148 printfcxx . . $ printf(581fddd72a8db8fc).("value=%s, ", print_charscxx . . $ print_chars(2b06688909ca43e3).(&thisChar->valuecxx . . $ $anonymous_type_11b10485cb0df85e_3#value., 1));
149 } else
150 printfcxx . . $ printf(581fddd72a8db8fc).("Dots: value=%s, ", _lou_showDotscxx . . $ _lou_showDots(dfd108baace36870).(&thisChar->valuecxx . . $ $anonymous_type_11b10485cb0df85e_3#value., 1));
151 printfcxx . . $ printf(581fddd72a8db8fc).("attr=%s, ", _lou_showAttributescxx . . $ _lou_showAttributes(ee268fec028f830b).(thisChar->attributescxx . . $ $anonymous_type_11b10485cb0df85e_3#attributes.));
152 nextRule = thisChar->otherRulescxx . . $ $anonymous_type_11b10485cb0df85e_3#otherRules.;
153 while (nextRule) {
154 thisRule = (TranslationTableRulecxx . . $ TranslationTableRule# *)&tablecxx . . $ table.->ruleAreacxx . . $ $anonymous_type_11b10485cb0df85e_11#ruleArea.[nextRule];
155 if (nextRule == thisChar->definitionRulecxx . . $ $anonymous_type_11b10485cb0df85e_3#definitionRule.) printfcxx . . $ printf(581fddd72a8db8fc).("definition ");
156 printRulecxx . . $ printRule(ffe2bb1e8f674926).(thisRule, mode);
157 printfcxx . . $ printf(581fddd72a8db8fc).("\n");
158 if (mode == 0)
159 nextRule = thisRule->charsnextcxx . . $ $anonymous_type_11b10485cb0df85e_5#charsnext.;
160 else
161 nextRule = thisRule->dotsnextcxx . . $ $anonymous_type_11b10485cb0df85e_5#dotsnext.;
162 }
163 if (mode == 0 && thisChar->compRulecxx . . $ $anonymous_type_11b10485cb0df85e_3#compRule.) {
164 TranslationTableRulecxx . . $ TranslationTableRule# *compRule =
165 (TranslationTableRulecxx . . $ TranslationTableRule# *)&tablecxx . . $ table.->ruleAreacxx . . $ $anonymous_type_11b10485cb0df85e_11#ruleArea.[thisChar->compRulecxx . . $ $anonymous_type_11b10485cb0df85e_3#compRule.];
166 printfcxx . . $ printf(581fddd72a8db8fc).("comp6 ");
167 printRulecxx . . $ printRule(ffe2bb1e8f674926).(compRule, 0);
168 printfcxx . . $ printf(581fddd72a8db8fc).("\n");
169 }
170 return 1;
171 }
172
173 static int
174 show_characterscxx . . $ show_characters(7864480464b09eea).(int startHash) {
175 int k;
176 TranslationTableCharactercxx . . $ TranslationTableCharacter# *thisChar;
177 TranslationTableOffsetcxx . . $ TranslationTableOffset# nextChar;
178 printfcxx . . $ printf(581fddd72a8db8fc).("Press enter for next or (e)xit, next-(h)ash, then enter\n");
179 if (startHash < 0)
180 k = 0;
181 else
182 k = startHash;
183 for (; k < HASHNUMcxx . . $ `liblouis/internal.h:76:9`!; k++)
184 if (tablecxx . . $ table.->characterscxx . . $ $anonymous_type_11b10485cb0df85e_11#characters.[k]) {
185 printfcxx . . $ printf(581fddd72a8db8fc).("Hash=%d\n", k);
186 nextChar = tablecxx . . $ table.->characterscxx . . $ $anonymous_type_11b10485cb0df85e_11#characters.[k];
187 while (nextChar) {
188 thisChar = (TranslationTableCharactercxx . . $ TranslationTableCharacter# *)&tablecxx . . $ table.->ruleAreacxx . . $ $anonymous_type_11b10485cb0df85e_11#ruleArea.[nextChar];
189 printCharactercxx . . $ printCharacter(48749250fc5e1445).(thisChar, 0);
190 printfcxx . . $ printf(581fddd72a8db8fc).("=> ");
191 getInputcxx . . $ getInput(b126dc7c1de90089).();
192 if (*inputBuffercxx . . $ inputBuffer. == 'h') break;
193 if (*inputBuffercxx . . $ inputBuffer. == 'e') return 1;
194 nextChar = thisChar->nextcxx . . $ $anonymous_type_11b10485cb0df85e_3#next.;
195 }
196 }
197 return 1;
198 }
199
200 static int
201 show_dotscxx . . $ show_dots(7864480464b09eea).(int startHash) {
202 int k;
203 TranslationTableCharactercxx . . $ TranslationTableCharacter# *thisDots;
204 TranslationTableOffsetcxx . . $ TranslationTableOffset# nextDots;
205 printfcxx . . $ printf(581fddd72a8db8fc).("Press enter for next or (e)xit, next-(h)ash, then enter\n");
206 if (startHash < 0)
207 k = 0;
208 else
209 k = startHash;
210 for (; k < HASHNUMcxx . . $ `liblouis/internal.h:76:9`!; k++)
211 if (tablecxx . . $ table.->dotscxx . . $ $anonymous_type_11b10485cb0df85e_11#dots.[k]) {
212 printfcxx . . $ printf(581fddd72a8db8fc).("Hash=%d\n", k);
213 nextDots = tablecxx . . $ table.->dotscxx . . $ $anonymous_type_11b10485cb0df85e_11#dots.[k];
214 while (nextDots) {
215 thisDots = (TranslationTableCharactercxx . . $ TranslationTableCharacter# *)&tablecxx . . $ table.->ruleAreacxx . . $ $anonymous_type_11b10485cb0df85e_11#ruleArea.[nextDots];
216 printCharactercxx . . $ printCharacter(48749250fc5e1445).(thisDots, 1);
217 printfcxx . . $ printf(581fddd72a8db8fc).("=> ");
218 getInputcxx . . $ getInput(b126dc7c1de90089).();
219 if (*inputBuffercxx . . $ inputBuffer. == 'h') break;
220 if (*inputBuffercxx . . $ inputBuffer. == 'e') return 1;
221 nextDots = thisDots->nextcxx . . $ $anonymous_type_11b10485cb0df85e_3#next.;
222 }
223 }
224 return 1;
225 }
226
227 static int
228 show_forRulescxx . . $ show_forRules(7864480464b09eea).(int startHash) {
229 int k;
230 TranslationTableRulecxx . . $ TranslationTableRule# *thisRule;
231 TranslationTableOffsetcxx . . $ TranslationTableOffset# nextRule;
232 printfcxx . . $ printf(581fddd72a8db8fc).("Press enter for next or (e)xit, next-(h)ash, then enter\n");
233 if (startHash < 0)
234 k = 0;
235 else
236 k = startHash;
237 for (; k < HASHNUMcxx . . $ `liblouis/internal.h:76:9`!; k++)
238 if (tablecxx . . $ table.->forRulescxx . . $ $anonymous_type_11b10485cb0df85e_11#forRules.[k]) {
239 printfcxx . . $ printf(581fddd72a8db8fc).("Hash=%d\n", k);
240 nextRule = tablecxx . . $ table.->forRulescxx . . $ $anonymous_type_11b10485cb0df85e_11#forRules.[k];
241 while (nextRule) {
242 thisRule = (TranslationTableRulecxx . . $ TranslationTableRule# *)&tablecxx . . $ table.->ruleAreacxx . . $ $anonymous_type_11b10485cb0df85e_11#ruleArea.[nextRule];
243 printRulecxx . . $ printRule(ffe2bb1e8f674926).(thisRule, 0);
244 printfcxx . . $ printf(581fddd72a8db8fc).("=> ");
245 getInputcxx . . $ getInput(b126dc7c1de90089).();
246 if (*inputBuffercxx . . $ inputBuffer. == 'h') break;
247 if (*inputBuffercxx . . $ inputBuffer. == 'e') return 1;
248 nextRule = thisRule->charsnextcxx . . $ $anonymous_type_11b10485cb0df85e_5#charsnext.;
249 }
250 }
251 return 1;
252 }
253
254 static int
255 show_backRulescxx . . $ show_backRules(7864480464b09eea).(int startHash) {
256 int k;
257 TranslationTableRulecxx . . $ TranslationTableRule# *thisRule;
258 TranslationTableOffsetcxx . . $ TranslationTableOffset# nextRule;
259 printfcxx . . $ printf(581fddd72a8db8fc).("Press enter for next or (e)xit, next-(h)ash, then enter\n");
260 if (startHash < 0)
261 k = 0;
262 else
263 k = startHash;
264 for (; k < HASHNUMcxx . . $ `liblouis/internal.h:76:9`!; k++)
265 if (tablecxx . . $ table.->backRulescxx . . $ $anonymous_type_11b10485cb0df85e_11#backRules.[k]) {
266 printfcxx . . $ printf(581fddd72a8db8fc).("Hash=%d\n", k);
267 nextRule = tablecxx . . $ table.->backRulescxx . . $ $anonymous_type_11b10485cb0df85e_11#backRules.[k];
268 while (nextRule) {
269 thisRule = (TranslationTableRulecxx . . $ TranslationTableRule# *)&tablecxx . . $ table.->ruleAreacxx . . $ $anonymous_type_11b10485cb0df85e_11#ruleArea.[nextRule];
270 printRulecxx . . $ printRule(ffe2bb1e8f674926).(thisRule, 1);
271 printfcxx . . $ printf(581fddd72a8db8fc).("=> ");
272 getInputcxx . . $ getInput(b126dc7c1de90089).();
273 if (*inputBuffercxx . . $ inputBuffer. == 'h') break;
274 if (*inputBuffercxx . . $ inputBuffer. == 'e') return 1;
275 nextRule = thisRule->dotsnextcxx . . $ $anonymous_type_11b10485cb0df85e_5#dotsnext.;
276 }
277 }
278 return 1;
279 }
280
281 static int
282 print_brailleIndicatorcxx . . $ print_brailleIndicator(dbfc9165c1ea8dea).(TranslationTableOffsetcxx . . $ TranslationTableOffset# offset, const char *opcode) {
283 TranslationTableRulecxx . . $ TranslationTableRule# *thisRule;
284 if (!offset) return 0;
285 thisRule = (TranslationTableRulecxx . . $ TranslationTableRule# *)&tablecxx . . $ table.->ruleAreacxx . . $ $anonymous_type_11b10485cb0df85e_11#ruleArea.[offset];
286 printfcxx . . $ printf(581fddd72a8db8fc).("%s %s\n", opcode, _lou_showDotscxx . . $ _lou_showDots(dfd108baace36870).(&thisRule->charsdotscxx . . $ $anonymous_type_11b10485cb0df85e_5#charsdots.[0], thisRule->dotslencxx . . $ $anonymous_type_11b10485cb0df85e_5#dotslen.));
287 return 1;
288 }
289
290 static int
291 print_phraseLengthcxx . . $ print_phraseLength(dbfc9165c1ea8dea).(TranslationTableOffsetcxx . . $ TranslationTableOffset# offset, const char *opcode) {
292 if (!offset) return 0;
293 printfcxx . . $ printf(581fddd72a8db8fc).("%s %u\n", opcode, offset);
294 return 1;
295 }
296
297 static int
298 show_brailleIndicatorscxx . . $ show_brailleIndicators(b126dc7c1de90089).(void) {
299 char name[BUFSIZEcxx . . $ `tools/lou_debug.c:77:9`!];
300 const char *emphNames[] = { "begemphphrase %s", "endemphphrase %s before",
301 "endemphphrase %s after", "begemphword %s", "endemphword %s", "emphletter %s",
302 "begemph %s", "endemph %s", NULLcxx . . $ `<external>/16391990256953433862/stddef.h:419:9`! };
303 const char *capsNames[] = { "firstwordcaps", "lastwordcapsbefore",
304 "lastwordcapsafter", "begcaps", "endcaps", "capsletter", "capsword",
305 "capswordstop", NULLcxx . . $ `<external>/16391990256953433862/stddef.h:419:9`! };
306
307 // FIXME: update to include all UEB opcodes.
308
309 for (EmphCodeOffsetcxx . . $ EmphCodeOffset# offset = 0; capsNames[offset]; offset++) {
310 print_brailleIndicatorcxx . . $ print_brailleIndicator(dbfc9165c1ea8dea).(
311 tablecxx . . $ table.->emphRulescxx . . $ $anonymous_type_11b10485cb0df85e_11#emphRules.[MAX_EMPH_CLASSEScxx . . $ `liblouis/internal.h:81:9`!][offset], capsNames[offset]);
312 }
313 print_phraseLengthcxx . . $ print_phraseLength(dbfc9165c1ea8dea).(
314 tablecxx . . $ table.->emphRulescxx . . $ $anonymous_type_11b10485cb0df85e_11#emphRules.[MAX_EMPH_CLASSEScxx . . $ `liblouis/internal.h:81:9`!][lenPhraseOffsetcxx . . $ lenPhraseOffset.], "lencapsphrase");
315 print_brailleIndicatorcxx . . $ print_brailleIndicator(dbfc9165c1ea8dea).(tablecxx . . $ table.->letterSigncxx . . $ $anonymous_type_11b10485cb0df85e_11#letterSign., "letsign");
316 print_brailleIndicatorcxx . . $ print_brailleIndicator(dbfc9165c1ea8dea).(tablecxx . . $ table.->numberSigncxx . . $ $anonymous_type_11b10485cb0df85e_11#numberSign., "numsign");
317 print_brailleIndicatorcxx . . $ print_brailleIndicator(dbfc9165c1ea8dea).(tablecxx . . $ table.->noNumberSigncxx . . $ $anonymous_type_11b10485cb0df85e_11#noNumberSign., "nonumsign");
318 print_brailleIndicatorcxx . . $ print_brailleIndicator(dbfc9165c1ea8dea).(tablecxx . . $ table.->noContractSigncxx . . $ $anonymous_type_11b10485cb0df85e_11#noContractSign., "nocontractsign");
319
320 for (int i = 0; i < MAX_EMPH_CLASSEScxx . . $ `liblouis/internal.h:81:9`! && tablecxx . . $ table.->emphClassNamescxx . . $ $anonymous_type_11b10485cb0df85e_11#emphClassNames.[i]; i++) {
321 for (EmphCodeOffsetcxx . . $ EmphCodeOffset# offset = 0; emphNames[offset]; offset++) {
322 snprintfcxx . . $ snprintf(ea502d73e74c754c).(name, BUFSIZEcxx . . $ `tools/lou_debug.c:77:9`!, emphNames[offset], tablecxx . . $ table.->emphClassescxx . . $ $anonymous_type_11b10485cb0df85e_11#emphClasses.[i]);
323 print_brailleIndicatorcxx . . $ print_brailleIndicator(dbfc9165c1ea8dea).(tablecxx . . $ table.->emphRulescxx . . $ $anonymous_type_11b10485cb0df85e_11#emphRules.[i][offset], name);
324 }
325 snprintfcxx . . $ snprintf(ea502d73e74c754c).(name, BUFSIZEcxx . . $ `tools/lou_debug.c:77:9`!, "lenemphphrase %s", tablecxx . . $ table.->emphClassescxx . . $ $anonymous_type_11b10485cb0df85e_11#emphClasses.[i]);
326 print_phraseLengthcxx . . $ print_phraseLength(dbfc9165c1ea8dea).(tablecxx . . $ table.->emphRulescxx . . $ $anonymous_type_11b10485cb0df85e_11#emphRules.[i][lenPhraseOffsetcxx . . $ lenPhraseOffset.], name);
327 }
328 print_brailleIndicatorcxx . . $ print_brailleIndicator(dbfc9165c1ea8dea).(tablecxx . . $ table.->begCompcxx . . $ $anonymous_type_11b10485cb0df85e_11#begComp., "begcomp");
329 print_brailleIndicatorcxx . . $ print_brailleIndicator(dbfc9165c1ea8dea).(tablecxx . . $ table.->endCompcxx . . $ $anonymous_type_11b10485cb0df85e_11#endComp., "endcomp");
330 return 1;
331 }
332
333 static const char *
334 pickYNcxx . . $ pickYN(f7ae7e56280f18ae).(int a) {
335 if (!a) return "no";
336 return "yes";
337 }
338
339 static int
340 show_misccxx . . $ show_misc(b126dc7c1de90089).(void) {
341 printfcxx . . $ printf(581fddd72a8db8fc).("Table size: %u\n", tablecxx . . $ table.->tableSizecxx . . $ $anonymous_type_11b10485cb0df85e_11#tableSize.);
342 printfcxx . . $ printf(581fddd72a8db8fc).("Bytes used: %u\n", tablecxx . . $ table.->bytesUsedcxx . . $ $anonymous_type_11b10485cb0df85e_11#bytesUsed.);
343 printfcxx . . $ printf(581fddd72a8db8fc).("Number of passes: %d\n", tablecxx . . $ table.->numPassescxx . . $ $anonymous_type_11b10485cb0df85e_11#numPasses.);
344 printfcxx . . $ printf(581fddd72a8db8fc).("'correct' opcodes: %s\n", pickYNcxx . . $ pickYN(f7ae7e56280f18ae).(tablecxx . . $ table.->correctionscxx . . $ $anonymous_type_11b10485cb0df85e_11#corrections.));
345 printfcxx . . $ printf(581fddd72a8db8fc).("'syllable' opcodes: %s\n", pickYNcxx . . $ pickYN(f7ae7e56280f18ae).(tablecxx . . $ table.->syllablescxx . . $ $anonymous_type_11b10485cb0df85e_11#syllables.));
346 printfcxx . . $ printf(581fddd72a8db8fc).("'capsnocont' opcode: %s\n", pickYNcxx . . $ pickYN(f7ae7e56280f18ae).(tablecxx . . $ table.->capsNoContcxx . . $ $anonymous_type_11b10485cb0df85e_11#capsNoCont.));
347 printfcxx . . $ printf(581fddd72a8db8fc).("Hyphenation table: %s\n", pickYNcxx . . $ pickYN(f7ae7e56280f18ae).(tablecxx . . $ table.->hyphenStatesArraycxx . . $ $anonymous_type_11b10485cb0df85e_11#hyphenStatesArray.));
348 printfcxx . . $ printf(581fddd72a8db8fc).("noletsignbefore %s\n",
349 print_charscxx . . $ print_chars(2b06688909ca43e3).(&tablecxx . . $ table.->noLetsignBeforecxx . . $ $anonymous_type_11b10485cb0df85e_11#noLetsignBefore.[0], tablecxx . . $ table.->noLetsignBeforeCountcxx . . $ $anonymous_type_11b10485cb0df85e_11#noLetsignBeforeCount.));
350 printfcxx . . $ printf(581fddd72a8db8fc).("noletsign %s\n", print_charscxx . . $ print_chars(2b06688909ca43e3).(&tablecxx . . $ table.->noLetsigncxx . . $ $anonymous_type_11b10485cb0df85e_11#noLetsign.[0], tablecxx . . $ table.->noLetsignCountcxx . . $ $anonymous_type_11b10485cb0df85e_11#noLetsignCount.));
351 printfcxx . . $ printf(581fddd72a8db8fc).("noletsignafter %s\n",
352 print_charscxx . . $ print_chars(2b06688909ca43e3).(&tablecxx . . $ table.->noLetsignAftercxx . . $ $anonymous_type_11b10485cb0df85e_11#noLetsignAfter.[0], tablecxx . . $ table.->noLetsignAfterCountcxx . . $ $anonymous_type_11b10485cb0df85e_11#noLetsignAfterCount.));
353 return 1;
354 }
355
356 static int
357 show_charMapcxx . . $ show_charMap(7864480464b09eea).(int startHash) {
358 int k;
359 CharDotsMappingcxx . . $ CharDotsMapping# *thisChar;
360 TranslationTableOffsetcxx . . $ TranslationTableOffset# nextChar;
361 printfcxx . . $ printf(581fddd72a8db8fc).("Press enter for next or (e)xit, next-(h)ash, then enter\n");
362 if (startHash < 0)
363 k = 0;
364 else
365 k = startHash;
366 for (; k < HASHNUMcxx . . $ `liblouis/internal.h:76:9`!; k++)
367 if (displayTablecxx . . $ displayTable.->charToDotscxx . . $ $anonymous_type_11b10485cb0df85e_10#charToDots.[k]) {
368 printfcxx . . $ printf(581fddd72a8db8fc).("Hash=%d\n", k);
369 nextChar = displayTablecxx . . $ displayTable.->charToDotscxx . . $ $anonymous_type_11b10485cb0df85e_10#charToDots.[k];
370 while (nextChar) {
371 thisChar = (CharDotsMappingcxx . . $ CharDotsMapping# *)&displayTablecxx . . $ displayTable.->ruleAreacxx . . $ $anonymous_type_11b10485cb0df85e_10#ruleArea.[nextChar];
372 printfcxx . . $ printf(581fddd72a8db8fc).("Char: %s ", print_charscxx . . $ print_chars(2b06688909ca43e3).(&thisChar->lookForcxx . . $ $anonymous_type_11b10485cb0df85e_2#lookFor., 1));
373 printfcxx . . $ printf(581fddd72a8db8fc).("dots=%s\n", _lou_showDotscxx . . $ _lou_showDots(dfd108baace36870).(&thisChar->foundcxx . . $ $anonymous_type_11b10485cb0df85e_2#found., 1));
374 printfcxx . . $ printf(581fddd72a8db8fc).("=> ");
375 getInputcxx . . $ getInput(b126dc7c1de90089).();
376 if (*inputBuffercxx . . $ inputBuffer. == 'h') break;
377 if (*inputBuffercxx . . $ inputBuffer. == 'e') return 1;
378 nextChar = thisChar->nextcxx . . $ $anonymous_type_11b10485cb0df85e_2#next.;
379 }
380 }
381 return 1;
382 }
383
384 static int
385 show_dotsMapcxx . . $ show_dotsMap(7864480464b09eea).(int startHash) {
386 int k;
387 CharDotsMappingcxx . . $ CharDotsMapping# *thisDots;
388 TranslationTableOffsetcxx . . $ TranslationTableOffset# nextDots;
389 printfcxx . . $ printf(581fddd72a8db8fc).("Press enter for next or (e)xit, next-(h)ash, then enter\n");
390 if (startHash < 0)
391 k = 0;
392 else
393 k = startHash;
394 for (; k < HASHNUMcxx . . $ `liblouis/internal.h:76:9`!; k++)
395 if (displayTablecxx . . $ displayTable.->dotsToCharcxx . . $ $anonymous_type_11b10485cb0df85e_10#dotsToChar.[k]) {
396 printfcxx . . $ printf(581fddd72a8db8fc).("Hash=%d\n", k);
397 nextDots = displayTablecxx . . $ displayTable.->dotsToCharcxx . . $ $anonymous_type_11b10485cb0df85e_10#dotsToChar.[k];
398 while (nextDots) {
399 thisDots = (CharDotsMappingcxx . . $ CharDotsMapping# *)&displayTablecxx . . $ displayTable.->ruleAreacxx . . $ $anonymous_type_11b10485cb0df85e_10#ruleArea.[nextDots];
400 printfcxx . . $ printf(581fddd72a8db8fc).("Dots: %s ", _lou_showDotscxx . . $ _lou_showDots(dfd108baace36870).(&thisDots->lookForcxx . . $ $anonymous_type_11b10485cb0df85e_2#lookFor., 1));
401 printfcxx . . $ printf(581fddd72a8db8fc).("char=%s\n", print_charscxx . . $ print_chars(2b06688909ca43e3).(&thisDots->foundcxx . . $ $anonymous_type_11b10485cb0df85e_2#found., 1));
402 printfcxx . . $ printf(581fddd72a8db8fc).("=> ");
403 getInputcxx . . $ getInput(b126dc7c1de90089).();
404 if (*inputBuffercxx . . $ inputBuffer. == 'h') break;
405 if (*inputBuffercxx . . $ inputBuffer. == 'e') return 1;
406 nextDots = thisDots->nextcxx . . $ $anonymous_type_11b10485cb0df85e_2#next.;
407 }
408 }
409 return 1;
410 }
411
412 static void
413 part_paramLetterscxx . . $ part_paramLetters(49f6e7a06ebc5aa8).(void) {
414 printfcxx . . $ printf(581fddd72a8db8fc).("show particular hash chains.\n");
415 printfcxx . . $ printf(581fddd72a8db8fc).("show-(f)orward-rules, show-(b)ackward-rules, show-(c)haracters, \n");
416 printfcxx . . $ printf(581fddd72a8db8fc).("show-(d)ot-patterns, show-(C)har-to-dots, show-(D)ots-tochar\n");
417 printfcxx . . $ printf(581fddd72a8db8fc).("(h)elp, e(x)it\n");
418 }
419
420 static void
421 particularHelpcxx . . $ particularHelp(49f6e7a06ebc5aa8).(void) {
422 part_paramLetterscxx . . $ part_paramLetters(49f6e7a06ebc5aa8).();
423 }
424
425 static int
426 particularcxx . . $ particular(b126dc7c1de90089).(void) {
427 int startHash;
428 widecharcxx . . $ widechar# parsed[BUFSIZEcxx . . $ `tools/lou_debug.c:77:9`!];
429 part_paramLetterscxx . . $ part_paramLetters(49f6e7a06ebc5aa8).();
430 do {
431 printfcxx . . $ printf(581fddd72a8db8fc).("particular: ");
432 getInputcxx . . $ getInput(b126dc7c1de90089).();
433 switch (inputBuffercxx . . $ inputBuffer.[0]) {
434 case 0:
435 break;
436 case 'h':
437 particularHelpcxx . . $ particularHelp(49f6e7a06ebc5aa8).();
438 break;
439 case 'c':
440 printfcxx . . $ printf(581fddd72a8db8fc).("-> ");
441 getInputcxx . . $ getInput(b126dc7c1de90089).();
442 if (!_lou_extParseCharscxx . . $ _lou_extParseChars(c9bce2f4bcd31d4).(inputBuffercxx . . $ inputBuffer., parsed)) break;
443 startHash = _lou_charHashcxx . . $ _lou_charHash(4d816ca98c3799f5).(*parsed);
444 if (tablecxx . . $ table.->characterscxx . . $ $anonymous_type_11b10485cb0df85e_11#characters.[startHash] == 0) {
445 printfcxx . . $ printf(581fddd72a8db8fc).("Character not in table.\n");
446 break;
447 }
448 show_characterscxx . . $ show_characters(7864480464b09eea).(startHash);
449 break;
450 case 'd':
451 printfcxx . . $ printf(581fddd72a8db8fc).("-> ");
452 getInputcxx . . $ getInput(b126dc7c1de90089).();
453 if (!_lou_extParseDotscxx . . $ _lou_extParseDots(c9bce2f4bcd31d4).(inputBuffercxx . . $ inputBuffer., parsed)) break;
454 startHash = _lou_charHashcxx . . $ _lou_charHash(4d816ca98c3799f5).(*parsed);
455 if (tablecxx . . $ table.->dotscxx . . $ $anonymous_type_11b10485cb0df85e_11#dots.[startHash] == 0) {
456 printfcxx . . $ printf(581fddd72a8db8fc).("Dot pattern not in table.\n");
457 break;
458 }
459 show_dotscxx . . $ show_dots(7864480464b09eea).(startHash);
460 break;
461 case 'C':
462 printfcxx . . $ printf(581fddd72a8db8fc).("-> ");
463 getInputcxx . . $ getInput(b126dc7c1de90089).();
464 if (!_lou_extParseCharscxx . . $ _lou_extParseChars(c9bce2f4bcd31d4).(inputBuffercxx . . $ inputBuffer., parsed)) break;
465 startHash = _lou_charHashcxx . . $ _lou_charHash(4d816ca98c3799f5).(*parsed);
466 if (displayTablecxx . . $ displayTable.->charToDotscxx . . $ $anonymous_type_11b10485cb0df85e_10#charToDots.[startHash] == 0) {
467 printfcxx . . $ printf(581fddd72a8db8fc).("Character not in table.\n");
468 break;
469 }
470 show_charMapcxx . . $ show_charMap(7864480464b09eea).(startHash);
471 break;
472 case 'D':
473 printfcxx . . $ printf(581fddd72a8db8fc).("-> ");
474 getInputcxx . . $ getInput(b126dc7c1de90089).();
475 if (!_lou_extParseDotscxx . . $ _lou_extParseDots(c9bce2f4bcd31d4).(inputBuffercxx . . $ inputBuffer., parsed)) break;
476 startHash = _lou_charHashcxx . . $ _lou_charHash(4d816ca98c3799f5).(*parsed);
477 if (displayTablecxx . . $ displayTable.->dotsToCharcxx . . $ $anonymous_type_11b10485cb0df85e_10#dotsToChar.[startHash] == 0) {
478 printfcxx . . $ printf(581fddd72a8db8fc).("Dot pattern not in table.\n");
479 break;
480 }
481 show_dotsMapcxx . . $ show_dotsMap(7864480464b09eea).(startHash);
482 break;
483 case 'f':
484 printfcxx . . $ printf(581fddd72a8db8fc).("-> ");
485 getInputcxx . . $ getInput(b126dc7c1de90089).();
486 if (!_lou_extParseCharscxx . . $ _lou_extParseChars(c9bce2f4bcd31d4).(inputBuffercxx . . $ inputBuffer., parsed)) break;
487 startHash = _lou_stringHashcxx . . $ _lou_stringHash(e43bcb0e0095b9f7).(parsed, 0, NULLcxx . . $ `<external>/16391990256953433862/stddef.h:419:9`!);
488 if (tablecxx . . $ table.->forRulescxx . . $ $anonymous_type_11b10485cb0df85e_11#forRules.[startHash] == 0) {
489 printfcxx . . $ printf(581fddd72a8db8fc).("Character string not in table.\n");
490 break;
491 }
492 show_forRulescxx . . $ show_forRules(7864480464b09eea).(startHash);
493 break;
494 case 'b':
495 printfcxx . . $ printf(581fddd72a8db8fc).("-> ");
496 getInputcxx . . $ getInput(b126dc7c1de90089).();
497 if (!_lou_extParseDotscxx . . $ _lou_extParseDots(c9bce2f4bcd31d4).(inputBuffercxx . . $ inputBuffer., parsed)) break;
498 startHash = _lou_stringHashcxx . . $ _lou_stringHash(e43bcb0e0095b9f7).(parsed, 0, NULLcxx . . $ `<external>/16391990256953433862/stddef.h:419:9`!);
499 if (tablecxx . . $ table.->backRulescxx . . $ $anonymous_type_11b10485cb0df85e_11#backRules.[startHash] == 0) {
500 printfcxx . . $ printf(581fddd72a8db8fc).("Dot pattern not in table.\n");
501 break;
502 }
503 show_backRulescxx . . $ show_backRules(7864480464b09eea).(startHash);
504 break;
505 case 'x':
506 return 1;
507 default:
508 printfcxx . . $ printf(581fddd72a8db8fc).("Bad choice.\n");
509 break;
510 }
511 } while (inputBuffercxx . . $ inputBuffer.[0] != 'x');
512 return 1;
513 }
514
515 static void
516 paramLetterscxx . . $ paramLetters(49f6e7a06ebc5aa8).(void) {
517 printfcxx . . $ printf(581fddd72a8db8fc).("Press one of the letters in parentheses, then enter.\n");
518 printfcxx . . $ printf(581fddd72a8db8fc).("show-(f)orward-rules, show-(b)ackward-rules, show-(c)haracters, \n");
519 printfcxx . . $ printf(581fddd72a8db8fc).("show-(d)ot-patterns, show-(C)har-to-dots, show-(D)ots-tochar\n");
520 printfcxx . . $ printf(581fddd72a8db8fc).("show-(m)isc, show-braille(i)ndicators, show-(p)articulars\n");
521 printfcxx . . $ printf(581fddd72a8db8fc).("(h)elp, (q)uit\n");
522 }
523
524 static void
525 commandHelpcxx . . $ commandHelp(49f6e7a06ebc5aa8).(void) {
526 paramLetterscxx . . $ paramLetters(49f6e7a06ebc5aa8).();
527 }
528
529 static int
530 getCommandscxx . . $ getCommands(b126dc7c1de90089).(void) {
531 paramLetterscxx . . $ paramLetters(49f6e7a06ebc5aa8).();
532 do {
533 printfcxx . . $ printf(581fddd72a8db8fc).("Command: ");
534 getInputcxx . . $ getInput(b126dc7c1de90089).();
535 switch (inputBuffercxx . . $ inputBuffer.[0]) {
536 case 0:
537 break;
538 case 'h':
539 commandHelpcxx . . $ commandHelp(49f6e7a06ebc5aa8).();
540 break;
541 case 'C':
542 show_charMapcxx . . $ show_charMap(7864480464b09eea).(-1);
543 break;
544 case 'D':
545 show_dotsMapcxx . . $ show_dotsMap(7864480464b09eea).(-1);
546 break;
547 case 'c':
548 show_characterscxx . . $ show_characters(7864480464b09eea).(-1);
549 break;
550 case 'd':
551 show_dotscxx . . $ show_dots(7864480464b09eea).(-1);
552 break;
553 case 'f':
554 show_forRulescxx . . $ show_forRules(7864480464b09eea).(-1);
555 break;
556 case 'b':
557 show_backRulescxx . . $ show_backRules(7864480464b09eea).(-1);
558 break;
559 case 'i':
560 show_brailleIndicatorscxx . . $ show_brailleIndicators(b126dc7c1de90089).();
561 break;
562 case 'm':
563 show_misccxx . . $ show_misc(b126dc7c1de90089).();
564 break;
565 case 'p':
566 particularcxx . . $ particular(b126dc7c1de90089).();
567 break;
568 case 'q':
569 return 1;
570 default:
571 printfcxx . . $ printf(581fddd72a8db8fc).("Bad choice.\n");
572 break;
573 }
574 } while (inputBuffercxx . . $ inputBuffer.[0] != 'q');
575 return 1;
576 }
577
578 int
579 maincxx . . $ main(afcd3168fc1188a4).(int argc, char **argv) {
580 int optc;
581
582 set_program_namecxx . . $ set_program_name(85c52e162fed56f9).(argv[0]);
583
584 while ((optc = getopt_longcxx . . $ getopt_long(41f665c090816971).(argc, argv, "hv", longoptscxx . . $ longopts., NULLcxx . . $ `<external>/16391990256953433862/stddef.h:419:9`!)) != -1) switch (optc) {
585 /* --help and --version exit immediately, per GNU coding standards. */
586 case 'v':
587 version_etccxx . . $ version_etc(b5fd392babfe1cc5).(
588 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_debug.c:44:9`!, (char *)NULLcxx . . $ `<external>/16391990256953433862/stddef.h:419:9`!);
589 exitcxx . . $ exit(3ca292c338df9bb3).(EXIT_SUCCESScxx . . $ `<external>/10696550936717951914/stdlib.h:97:9`!);
590 break;
591 case 'h':
592 print_helpcxx . . $ print_help(49f6e7a06ebc5aa8).();
593 exitcxx . . $ exit(3ca292c338df9bb3).(EXIT_SUCCESScxx . . $ `<external>/10696550936717951914/stdlib.h:97:9`!);
594 break;
595 default:
596 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:159:9`!, "Try `%s --help' for more information.\n", program_namecxx . . $ program_name.);
597 exitcxx . . $ exit(3ca292c338df9bb3).(EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:96:9`!);
598 break;
599 }
600
601 if (optindcxx . . $ optind. != argc - 1) {
602 /* Print error message and exit. */
603 if (optindcxx . . $ optind. < argc - 1)
604 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:159:9`!, "%s: extra operand: %s\n", program_namecxx . . $ program_name., argv[optindcxx . . $ optind. + 1]);
605 else
606 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:159:9`!, "%s: no table specified\n", program_namecxx . . $ program_name.);
607 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:159:9`!, "Try `%s --help' for more information.\n", program_namecxx . . $ program_name.);
608 exitcxx . . $ exit(3ca292c338df9bb3).(EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:96:9`!);
609 }
610
611 _lou_getTablecxx . . $ _lou_getTable(990c38bc0a321f1d).(argv[optindcxx . . $ optind.], argv[optindcxx . . $ optind.], &tablecxx . . $ table., &displayTablecxx . . $ displayTable.);
612 if (!tablecxx . . $ table.) {
613 lou_freecxx . . $ lou_free(49f6e7a06ebc5aa8).();
614 exitcxx . . $ exit(3ca292c338df9bb3).(EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:96:9`!);
615 }
616 getCommandscxx . . $ getCommands(b126dc7c1de90089).();
617 lou_freecxx . . $ lou_free(49f6e7a06ebc5aa8).();
618 exitcxx . . $ exit(3ca292c338df9bb3).(EXIT_SUCCESScxx . . $ `<external>/10696550936717951914/stdlib.h:97:9`!);
619 }