| 1 | /* liblouis Braille Translation and Back-Translation Library |
| 2 | |
| 3 | Copyright (C) 2012 Swiss Library for the Blind, Visually Impaired and Print Disabled |
| 4 | |
| 5 | This program is free software: you can redistribute it and/or modify |
| 6 | it under the terms of the GNU General Public License as published by |
| 7 | the Free Software Foundation, either version 3 of the License, or |
| 8 | (at your option) any later version. |
| 9 | |
| 10 | This program is distributed in the hope that it will be useful, |
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | GNU General Public License for more details. |
| 14 | |
| 15 | You should have received a copy of the GNU General Public License |
| 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 17 | */ |
| 18 | |
| 19 | #include <config.h>cxx . . $ `<file>/liblouis/config.h`/ |
| 20 | |
| 21 | #include <stdio.h>cxx . . $ `<file>/tools/gnulib/stdio.h`/ |
| 22 | #include <string.h>cxx . . $ `<file>/gnulib/string.h`/ |
| 23 | #include <stdlib.h>cxx . . $ `<file>/gnulib/stdlib.h`/ |
| 24 | #include "internal.h"cxx . . $ `<file>/liblouis/internal.h`/ |
| 25 | #include <getopt.h> |
| 26 | #include "progname.h"cxx . . $ `<file>/tools/gnulib/progname.h`/ |
| 27 | #include "unistr.h"cxx . . $ `<file>/tools/gnulib/unistr.h`/ |
| 28 | #include "version-etc.h"cxx . . $ `<file>/tools/gnulib/version-etc.h`/ |
| 29 | |
| 30 | const char version_etc_copyrightcxx . . $ version_etc_copyright.[] = |
| 31 | "Copyright %s %d Swiss Library for the Blind, Visually Impaired and Print " |
| 32 | "Disabled."; |
| 33 | |
| 34 | #define AUTHORScxx . . $ `tools/lou_trace.c:34:9`! "Bert Frees" |
| 35 | |
| 36 | static void |
| 37 | print_helpcxx . . $ print_help(49f6e7a06ebc5aa8).(void) { |
| 38 | printfcxx . . $ printf(581fddd72a8db8fc).("\ |
| 39 | Usage: %s [OPTIONS] TABLE[,TABLE,...]\n", |
| 40 | program_namecxx . . $ program_name.); |
| 41 | fputscxx . . $ fputs(874fa6a5e59ab9bd).("\ |
| 42 | Examine and debug Braille translation tables. This program allows you\n\ |
| 43 | to inspect liblouis translation tables by printing out the list of\n\ |
| 44 | applied translation rules for a given input.\n\n", |
| 45 | stdoutcxx . . $ `<external>/232824719582829767/stdio.h:158:9`!); |
| 46 | fputscxx . . $ fputs(874fa6a5e59ab9bd).("\ |
| 47 | -h, --help display this help and exit\n\ |
| 48 | -v, --version display version information and exit\n\ |
| 49 | -f, --forward forward translation using the given table\n\ |
| 50 | -b, --backward backward translation using the given table\n\ |
| 51 | --noContractions Use no contractions\n\ |
| 52 | --dotsIO Display dot patterns\n\ |
| 53 | --ucBrl Use Unicode Braille patterns\n\ |
| 54 | --noUndefined Disable output of undefined dot numbers during back-translation\n\ |
| 55 | --partialTrans Use partial back-translation\n\ |
| 56 | If neither -f nor -b are specified forward translation\n\ |
| 57 | is assumed\n", |
| 58 | stdoutcxx . . $ `<external>/232824719582829767/stdio.h:158:9`!); |
| 59 | printfcxx . . $ printf(581fddd72a8db8fc).("Report bugs to %s.\n", PACKAGE_BUGREPORTcxx . . $ `liblouis/config.h:628:9`!); |
| 60 | #ifdef PACKAGE_PACKAGER_BUG_REPORTS |
| 61 | printf("Report %s bugs to: %s\n", PACKAGE_PACKAGER, PACKAGE_PACKAGER_BUG_REPORTS); |
| 62 | #endif |
| 63 | #ifdef PACKAGE_URLcxx . . $ `liblouis/config.h:649:9`! |
| 64 | printfcxx . . $ printf(581fddd72a8db8fc).("%s home page: <%s>\n", PACKAGE_NAMEcxx . . $ `liblouis/config.h:631:9`!, PACKAGE_URLcxx . . $ `liblouis/config.h:649:9`!); |
| 65 | #endif |
| 66 | } |
| 67 | |
| 68 | #define BUFSIZEcxx . . $ `tools/lou_trace.c:68:9`! 512 |
| 69 | #define RULESSIZEcxx . . $ `tools/lou_trace.c:69:9`! 512 |
| 70 | |
| 71 | static char * |
| 72 | get_inputcxx . . $ get_input(41208ce6ca65dd58).(void) { |
| 73 | static char input_buffer[BUFSIZEcxx . . $ `tools/lou_trace.c:68:9`!]; |
| 74 | size_tcxx . . $ size_t# input_length; |
| 75 | input_buffer[0] = 0; |
| 76 | if (!fgetscxx . . $ fgets(efb0aaba7ac866ae).(input_buffer, sizeof(input_buffer), stdincxx . . $ `<external>/232824719582829767/stdio.h:157:9`!)) exitcxx . . $ exit(3ca292c338df9bb3).(EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:96:9`!); |
| 77 | input_length = strlencxx . . $ strlen(751346f8406fd082).(input_buffer) - 1; |
| 78 | if (input_length < 0) exitcxx . . $ exit(3ca292c338df9bb3).(0); |
| 79 | input_buffer[input_length] = 0; |
| 80 | return input_buffer; |
| 81 | } |
| 82 | |
| 83 | static int |
| 84 | get_wide_inputcxx . . $ get_wide_input(910e03eb156beb90).(widecharcxx . . $ widechar# *buffer) { |
| 85 | return _lou_extParseCharscxx . . $ _lou_extParseChars(c9bce2f4bcd31d4).(get_inputcxx . . $ get_input(41208ce6ca65dd58).(), buffer); |
| 86 | } |
| 87 | |
| 88 | static char * |
| 89 | print_charscxx . . $ print_chars(2b06688909ca43e3).(const widecharcxx . . $ widechar# *buffer, int length) { |
| 90 | static uint8_tcxx . . $ uint8_t# result_buf[BUFSIZEcxx . . $ `tools/lou_trace.c:68:9`!]; |
| 91 | size_tcxx . . $ size_t# result_len = BUFSIZEcxx . . $ `tools/lou_trace.c:68:9`! - 1; |
| 92 | #ifdef WIDECHARS_ARE_UCS4 |
| 93 | u32_to_u8(buffer, length, result_buf, &result_len); |
| 94 | #else |
| 95 | u16_to_u8cxx . . $ u16_to_u8(e729bd8f99eea2d2).(buffer, length, result_buf, &result_len); |
| 96 | #endif |
| 97 | result_buf[result_len] = 0; |
| 98 | return result_buf; |
| 99 | } |
| 100 | |
| 101 | static char * |
| 102 | print_dotscxx . . $ print_dots(2b06688909ca43e3).(const widecharcxx . . $ widechar# *buffer, int length) { |
| 103 | static char dots[BUFSIZEcxx . . $ `tools/lou_trace.c:68:9`!]; |
| 104 | strcpycxx . . $ strcpy(b7b3a83273496486).(dots, _lou_showDotscxx . . $ _lou_showDots(dfd108baace36870).(buffer, length)); |
| 105 | return dots; |
| 106 | } |
| 107 | |
| 108 | static char * |
| 109 | print_numbercxx . . $ print_number(8ec792acdff827a3).(widecharcxx . . $ widechar# c) { |
| 110 | static char number[BUFSIZEcxx . . $ `tools/lou_trace.c:68:9`!]; |
| 111 | sprintfcxx . . $ sprintf(26c8642d26409d6d).(number, "%d", c); |
| 112 | return number; |
| 113 | } |
| 114 | |
| 115 | static char * |
| 116 | print_attributescxx . . $ print_attributes(ee268fec028f830b).(unsigned long long a) { |
| 117 | static char attr[BUFSIZEcxx . . $ `tools/lou_trace.c:68:9`!]; |
| 118 | strcpycxx . . $ strcpy(b7b3a83273496486).(attr, _lou_showAttributescxx . . $ _lou_showAttributes(ee268fec028f830b).(a)); |
| 119 | return attr; |
| 120 | } |
| 121 | |
| 122 | static void |
| 123 | append_charcxx . . $ append_char(d26beb4b1fc1272b).(char *destination, int *length, char source) { |
| 124 | destination[(*length)++] = source; |
| 125 | } |
| 126 | |
| 127 | static void |
| 128 | append_stringcxx . . $ append_string(a6a44d5f27d172a5).(char *destination, int *length, char *source) { |
| 129 | strcpycxx . . $ strcpy(b7b3a83273496486).(&destination[(*length)], source); |
| 130 | (*length) += strlencxx . . $ strlen(751346f8406fd082).(source); |
| 131 | } |
| 132 | |
| 133 | static char * |
| 134 | print_scriptcxx . . $ print_script(bb02236e6a13405b).(const widecharcxx . . $ widechar# *buffer, int length, const TranslationTableHeadercxx . . $ TranslationTableHeader# *table) { |
| 135 | static char script[BUFSIZEcxx . . $ `tools/lou_trace.c:68:9`!]; |
| 136 | int i = 0; |
| 137 | int j = 0; |
| 138 | while (i < length) { |
| 139 | switch (buffer[i]) { |
| 140 | case pass_firstcxx . . $ pass_first.: |
| 141 | case pass_lastcxx . . $ pass_last.: |
| 142 | case pass_notcxx . . $ pass_not.: |
| 143 | case pass_startReplacecxx . . $ pass_startReplace.: |
| 144 | case pass_endReplacecxx . . $ pass_endReplace.: |
| 145 | case pass_searchcxx . . $ pass_search.: |
| 146 | case pass_copycxx . . $ pass_copy.: |
| 147 | case pass_omitcxx . . $ pass_omit.: |
| 148 | append_charcxx . . $ append_char(d26beb4b1fc1272b).(script, &j, buffer[i++]); |
| 149 | break; |
| 150 | case pass_lookbackcxx . . $ pass_lookback.: |
| 151 | append_charcxx . . $ append_char(d26beb4b1fc1272b).(script, &j, buffer[i++]); |
| 152 | if (buffer[i] > 1) append_stringcxx . . $ append_string(a6a44d5f27d172a5).(script, &j, print_numbercxx . . $ print_number(8ec792acdff827a3).(buffer[i++])); |
| 153 | break; |
| 154 | case pass_stringcxx . . $ pass_string.: |
| 155 | append_charcxx . . $ append_char(d26beb4b1fc1272b).(script, &j, buffer[i]); |
| 156 | append_stringcxx . . $ append_string(a6a44d5f27d172a5).(script, &j, print_charscxx . . $ print_chars(2b06688909ca43e3).(&buffer[i + 2], buffer[i + 1])); |
| 157 | append_charcxx . . $ append_char(d26beb4b1fc1272b).(script, &j, buffer[i]); |
| 158 | i += (2 + buffer[i + 1]); |
| 159 | break; |
| 160 | case pass_dotscxx . . $ pass_dots.: |
| 161 | append_charcxx . . $ append_char(d26beb4b1fc1272b).(script, &j, buffer[i++]); |
| 162 | append_stringcxx . . $ append_string(a6a44d5f27d172a5).(script, &j, print_dotscxx . . $ print_dots(2b06688909ca43e3).(&buffer[i + 1], buffer[i])); |
| 163 | i += (1 + buffer[i]); |
| 164 | break; |
| 165 | case pass_eqcxx . . $ pass_eq.: |
| 166 | case pass_ltcxx . . $ pass_lt.: |
| 167 | case pass_gtcxx . . $ pass_gt.: |
| 168 | case pass_lteqcxx . . $ pass_lteq.: |
| 169 | case pass_gteqcxx . . $ pass_gteq.: |
| 170 | append_charcxx . . $ append_char(d26beb4b1fc1272b).(script, &j, '#'); |
| 171 | append_stringcxx . . $ append_string(a6a44d5f27d172a5).(script, &j, print_numbercxx . . $ print_number(8ec792acdff827a3).(buffer[i + 1])); |
| 172 | append_charcxx . . $ append_char(d26beb4b1fc1272b).(script, &j, buffer[i]); |
| 173 | append_stringcxx . . $ append_string(a6a44d5f27d172a5).(script, &j, print_numbercxx . . $ print_number(8ec792acdff827a3).(buffer[i + 2])); |
| 174 | i += 3; |
| 175 | break; |
| 176 | case pass_hyphencxx . . $ pass_hyphen.: |
| 177 | case pass_pluscxx . . $ pass_plus.: |
| 178 | append_charcxx . . $ append_char(d26beb4b1fc1272b).(script, &j, '#'); |
| 179 | append_stringcxx . . $ append_string(a6a44d5f27d172a5).(script, &j, print_numbercxx . . $ print_number(8ec792acdff827a3).(buffer[i + 1])); |
| 180 | append_charcxx . . $ append_char(d26beb4b1fc1272b).(script, &j, buffer[i]); |
| 181 | i += 2; |
| 182 | break; |
| 183 | case pass_attributescxx . . $ pass_attributes.: |
| 184 | append_charcxx . . $ append_char(d26beb4b1fc1272b).(script, &j, buffer[i++]); |
| 185 | int attr_start = j - 1; |
| 186 | unsigned long long a = buffer[i++]; |
| 187 | a <<= 16; |
| 188 | a |= buffer[i++]; |
| 189 | a <<= 16; |
| 190 | a |= buffer[i++]; |
| 191 | a <<= 16; |
| 192 | a |= buffer[i++]; |
| 193 | append_stringcxx . . $ append_string(a6a44d5f27d172a5).(script, &j, print_attributescxx . . $ print_attributes(ee268fec028f830b).(a)); |
| 194 | // If this returned "$", "$w", "$x", "$y" or "$z", we're dealing with a single |
| 195 | // custom attribute. In this case look up the name of the attribute and use |
| 196 | // the "%xxx" syntax. |
| 197 | if (j - attr_start == 1 || |
| 198 | (j - attr_start == 2 && script[j - 1] >= 'w' && |
| 199 | script[j - 1] <= 'z')) { |
| 200 | j = attr_start; |
| 201 | append_charcxx . . $ append_char(d26beb4b1fc1272b).(script, &j, '%'); |
| 202 | const CharacterClasscxx . . $ CharacterClass# *class = table->characterClassescxx . . $ $anonymous_type_11b10485cb0df85e_11#characterClasses.; |
| 203 | while (class) { |
| 204 | if (class->attributecxx . . $ CharacterClass#attribute. == a) { |
| 205 | append_stringcxx . . $ append_string(a6a44d5f27d172a5).( |
| 206 | script, &j, print_charscxx . . $ print_chars(2b06688909ca43e3).(class->namecxx . . $ CharacterClass#name., class->lengthcxx . . $ CharacterClass#length.)); |
| 207 | break; |
| 208 | } |
| 209 | class = class->nextcxx . . $ CharacterClass#next.; |
| 210 | } |
| 211 | } |
| 212 | if (buffer[i] == 1 && buffer[i + 1] == 1) { |
| 213 | } else if (buffer[i] == 1 && buffer[i + 1] == 0xffff) |
| 214 | append_charcxx . . $ append_char(d26beb4b1fc1272b).(script, &j, pass_untilcxx . . $ pass_until.); |
| 215 | else if (buffer[i] == buffer[i + 1]) |
| 216 | append_stringcxx . . $ append_string(a6a44d5f27d172a5).(script, &j, print_numbercxx . . $ print_number(8ec792acdff827a3).(buffer[i])); |
| 217 | else { |
| 218 | append_stringcxx . . $ append_string(a6a44d5f27d172a5).(script, &j, print_numbercxx . . $ print_number(8ec792acdff827a3).(buffer[i])); |
| 219 | append_charcxx . . $ append_char(d26beb4b1fc1272b).(script, &j, '-'); |
| 220 | append_stringcxx . . $ append_string(a6a44d5f27d172a5).(script, &j, print_numbercxx . . $ print_number(8ec792acdff827a3).(buffer[i + 1])); |
| 221 | } |
| 222 | i += 2; |
| 223 | break; |
| 224 | case pass_swapcxx . . $ pass_swap.: |
| 225 | append_charcxx . . $ append_char(d26beb4b1fc1272b).(script, &j, buffer[i++]); |
| 226 | TranslationTableOffsetcxx . . $ TranslationTableOffset# swapRuleOffset = buffer[i++]; |
| 227 | swapRuleOffset <<= 16; |
| 228 | swapRuleOffset |= buffer[i++]; |
| 229 | const RuleNamecxx . . $ RuleName# *nameRule = table->ruleNamescxx . . $ $anonymous_type_11b10485cb0df85e_11#ruleNames.; |
| 230 | while (nameRule) { |
| 231 | if (nameRule->ruleOffsetcxx . . $ RuleName#ruleOffset. == swapRuleOffset) { |
| 232 | append_stringcxx . . $ append_string(a6a44d5f27d172a5).( |
| 233 | script, &j, print_charscxx . . $ print_chars(2b06688909ca43e3).(nameRule->namecxx . . $ RuleName#name., nameRule->lengthcxx . . $ RuleName#length.)); |
| 234 | break; |
| 235 | } |
| 236 | nameRule = nameRule->nextcxx . . $ RuleName#next.; |
| 237 | } |
| 238 | break; |
| 239 | case pass_endTestcxx . . $ pass_endTest.: |
| 240 | append_charcxx . . $ append_char(d26beb4b1fc1272b).(script, &j, '\t'); |
| 241 | i++; |
| 242 | break; |
| 243 | case pass_groupstartcxx . . $ pass_groupstart.: |
| 244 | case pass_groupendcxx . . $ pass_groupend.: |
| 245 | case pass_groupreplacecxx . . $ pass_groupreplace.: |
| 246 | /* TBD */ |
| 247 | default: |
| 248 | i++; |
| 249 | break; |
| 250 | } |
| 251 | } |
| 252 | script[j] = 0; |
| 253 | return script; |
| 254 | } |
| 255 | |
| 256 | static void |
| 257 | print_rulecxx . . $ print_rule(6111912ac7a84f4b).(const TranslationTableRulecxx . . $ TranslationTableRule# *rule, const TranslationTableHeadercxx . . $ TranslationTableHeader# *table) { |
| 258 | const char *opcode = _lou_findOpcodeNamecxx . . $ _lou_findOpcodeName(f7c4f7b5a5e836b1).(rule->opcodecxx . . $ $anonymous_type_11b10485cb0df85e_5#opcode.); |
| 259 | char *chars; |
| 260 | char *dots; |
| 261 | char *script; |
| 262 | switch (rule->opcodecxx . . $ $anonymous_type_11b10485cb0df85e_5#opcode.) { |
| 263 | case CTO_Contextcxx . . $ CTO_Context.: |
| 264 | case CTO_Correctcxx . . $ CTO_Correct.: |
| 265 | case CTO_SwapCdcxx . . $ CTO_SwapCd.: |
| 266 | case CTO_SwapDdcxx . . $ CTO_SwapDd.: |
| 267 | case CTO_Pass2cxx . . $ CTO_Pass2.: |
| 268 | case CTO_Pass3cxx . . $ CTO_Pass3.: |
| 269 | case CTO_Pass4cxx . . $ CTO_Pass4.: |
| 270 | script = print_scriptcxx . . $ print_script(bb02236e6a13405b).(&rule->charsdotscxx . . $ $anonymous_type_11b10485cb0df85e_5#charsdots.[rule->charslencxx . . $ $anonymous_type_11b10485cb0df85e_5#charslen.], rule->dotslencxx . . $ $anonymous_type_11b10485cb0df85e_5#dotslen., table); |
| 271 | printfcxx . . $ printf(581fddd72a8db8fc).("%s\t%s\n", opcode, script); |
| 272 | break; |
| 273 | default: |
| 274 | chars = print_charscxx . . $ print_chars(2b06688909ca43e3).(rule->charsdotscxx . . $ $anonymous_type_11b10485cb0df85e_5#charsdots., rule->charslencxx . . $ $anonymous_type_11b10485cb0df85e_5#charslen.); |
| 275 | dots = print_dotscxx . . $ print_dots(2b06688909ca43e3).(&rule->charsdotscxx . . $ $anonymous_type_11b10485cb0df85e_5#charsdots.[rule->charslencxx . . $ $anonymous_type_11b10485cb0df85e_5#charslen.], rule->dotslencxx . . $ $anonymous_type_11b10485cb0df85e_5#dotslen.); |
| 276 | printfcxx . . $ printf(581fddd72a8db8fc).("%s\t%s\t%s\n", opcode, chars, dots); |
| 277 | break; |
| 278 | } |
| 279 | } |
| 280 | |
| 281 | static void |
| 282 | main_loopcxx . . $ main_loop(99469d7ff9a1485a).(int backward_translation, char *table, int mode) { |
| 283 | widecharcxx . . $ widechar# inbuf[BUFSIZEcxx . . $ `tools/lou_trace.c:68:9`!]; |
| 284 | widecharcxx . . $ widechar# outbuf[BUFSIZEcxx . . $ `tools/lou_trace.c:68:9`!]; |
| 285 | int inlen; |
| 286 | int outlen; |
| 287 | const TranslationTableHeadercxx . . $ TranslationTableHeader# *translationTable; |
| 288 | const DisplayTableHeadercxx . . $ DisplayTableHeader# *displayTable; |
| 289 | const TranslationTableRulecxx . . $ TranslationTableRule# **rules = malloccxx . . $ malloc(bfcfa4d6b7f7ef64).(512 * sizeof(TranslationTableRulecxx . . $ TranslationTableRule#)); |
| 290 | int ruleslen; |
| 291 | int i, j; |
| 292 | while (1) { |
| 293 | inlen = get_wide_inputcxx . . $ get_wide_input(910e03eb156beb90).(inbuf); |
| 294 | outlen = BUFSIZEcxx . . $ `tools/lou_trace.c:68:9`!; |
| 295 | ruleslen = RULESSIZEcxx . . $ `tools/lou_trace.c:69:9`!; |
| 296 | _lou_getTablecxx . . $ _lou_getTable(990c38bc0a321f1d).(table, table, &translationTable, &displayTable); |
| 297 | if (backward_translation) { |
| 298 | if (!_lou_backTranslatecxx . . $ _lou_backTranslate(5fc2ab337e0d897c).(table, table, inbuf, &inlen, outbuf, &outlen, NULLcxx . . $ `<external>/16391990256953433862/stddef.h:419:9`!, |
| 299 | NULLcxx . . $ `<external>/16391990256953433862/stddef.h:419:9`!, NULLcxx . . $ `<external>/16391990256953433862/stddef.h:419:9`!, NULLcxx . . $ `<external>/16391990256953433862/stddef.h:419:9`!, NULLcxx . . $ `<external>/16391990256953433862/stddef.h:419:9`!, mode, rules, &ruleslen)) |
| 300 | break; |
| 301 | } else if (!_lou_translatecxx . . $ _lou_translate(5fc2ab337e0d897c).(table, table, inbuf, &inlen, outbuf, &outlen, NULLcxx . . $ `<external>/16391990256953433862/stddef.h:419:9`!, |
| 302 | NULLcxx . . $ `<external>/16391990256953433862/stddef.h:419:9`!, NULLcxx . . $ `<external>/16391990256953433862/stddef.h:419:9`!, NULLcxx . . $ `<external>/16391990256953433862/stddef.h:419:9`!, NULLcxx . . $ `<external>/16391990256953433862/stddef.h:419:9`!, mode, rules, &ruleslen)) |
| 303 | break; |
| 304 | if ((mode & dotsIOcxx . . $ dotsIO.) && !backward_translation) |
| 305 | printfcxx . . $ printf(581fddd72a8db8fc).("Dot patterns: %s\n", _lou_showDotscxx . . $ _lou_showDots(dfd108baace36870).(outbuf, outlen)); |
| 306 | else |
| 307 | printfcxx . . $ printf(581fddd72a8db8fc).("%s\n", print_charscxx . . $ print_chars(2b06688909ca43e3).(outbuf, outlen)); |
| 308 | j = 0; |
| 309 | for (i = 0; i < ruleslen; i++) { |
| 310 | if (rules[i]->opcodecxx . . $ $anonymous_type_11b10485cb0df85e_5#opcode. < 0 || rules[i]->opcodecxx . . $ $anonymous_type_11b10485cb0df85e_5#opcode. >= CTO_Nonecxx . . $ CTO_None.) continue; |
| 311 | printfcxx . . $ printf(581fddd72a8db8fc).("%d.\t", ++j); |
| 312 | print_rulecxx . . $ print_rule(6111912ac7a84f4b).(rules[i], translationTable); |
| 313 | } |
| 314 | } |
| 315 | } |
| 316 | |
| 317 | int |
| 318 | maincxx . . $ main(afcd3168fc1188a4).(int argc, char **argv) { |
| 319 | int optc; |
| 320 | char *table; |
| 321 | |
| 322 | int forward_flag = 0; |
| 323 | int backward_flag = 0; |
| 324 | int mode = 0; |
| 325 | int noContractionsMode = 0; |
| 326 | int dotsIOMode = 0; |
| 327 | int ucBrlMode = 0; |
| 328 | int noUndefinedMode = 0; |
| 329 | int noUndefinedDotsMode = 0; |
| 330 | int partialTransMode = 0; |
| 331 | |
| 332 | const struct optioncxx . . $ option# longopts[] = { |
| 333 | { "help", no_argumentcxx . . $ `<external>/1746263805473775960/getopt_ext.h:62:9`!, NULLcxx . . $ `<external>/16391990256953433862/stddef.h:419:9`!, 'h' }, |
| 334 | { "version", no_argumentcxx . . $ `<external>/1746263805473775960/getopt_ext.h:62:9`!, NULLcxx . . $ `<external>/16391990256953433862/stddef.h:419:9`!, 'v' }, |
| 335 | { "forward", no_argumentcxx . . $ `<external>/1746263805473775960/getopt_ext.h:62:9`!, NULLcxx . . $ `<external>/16391990256953433862/stddef.h:419:9`!, 'f' }, |
| 336 | { "backward", no_argumentcxx . . $ `<external>/1746263805473775960/getopt_ext.h:62:9`!, NULLcxx . . $ `<external>/16391990256953433862/stddef.h:419:9`!, 'b' }, |
| 337 | { "noContractions", no_argumentcxx . . $ `<external>/1746263805473775960/getopt_ext.h:62:9`!, &noContractionsMode, noContractionscxx . . $ noContractions. }, |
| 338 | { "dotsIO", no_argumentcxx . . $ `<external>/1746263805473775960/getopt_ext.h:62:9`!, &dotsIOMode, dotsIOcxx . . $ dotsIO. }, |
| 339 | { "ucBrl", no_argumentcxx . . $ `<external>/1746263805473775960/getopt_ext.h:62:9`!, &ucBrlMode, ucBrlcxx . . $ ucBrl. }, |
| 340 | { "noUndefined", no_argumentcxx . . $ `<external>/1746263805473775960/getopt_ext.h:62:9`!, &noUndefinedMode, noUndefinedcxx . . $ noUndefined. }, |
| 341 | { "noUndefinedDots", no_argumentcxx . . $ `<external>/1746263805473775960/getopt_ext.h:62:9`!, &noUndefinedDotsMode, noUndefinedcxx . . $ noUndefined. }, |
| 342 | { "partialTrans", no_argumentcxx . . $ `<external>/1746263805473775960/getopt_ext.h:62:9`!, &partialTransMode, partialTranscxx . . $ partialTrans. }, |
| 343 | { NULLcxx . . $ `<external>/16391990256953433862/stddef.h:419:9`!, 0, NULLcxx . . $ `<external>/16391990256953433862/stddef.h:419:9`!, 0 }, |
| 344 | }; |
| 345 | |
| 346 | set_program_namecxx . . $ set_program_name(85c52e162fed56f9).(argv[0]); |
| 347 | while ((optc = getopt_longcxx . . $ getopt_long(41f665c090816971).(argc, argv, "hvfb", longopts, NULLcxx . . $ `<external>/16391990256953433862/stddef.h:419:9`!)) != -1) { |
| 348 | switch (optc) { |
| 349 | case 'v': |
| 350 | version_etccxx . . $ version_etc(b5fd392babfe1cc5).( |
| 351 | 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_trace.c:34:9`!, (char *)NULLcxx . . $ `<external>/16391990256953433862/stddef.h:419:9`!); |
| 352 | exitcxx . . $ exit(3ca292c338df9bb3).(EXIT_SUCCESScxx . . $ `<external>/10696550936717951914/stdlib.h:97:9`!); |
| 353 | break; |
| 354 | case 'h': |
| 355 | print_helpcxx . . $ print_help(49f6e7a06ebc5aa8).(); |
| 356 | exitcxx . . $ exit(3ca292c338df9bb3).(EXIT_SUCCESScxx . . $ `<external>/10696550936717951914/stdlib.h:97:9`!); |
| 357 | break; |
| 358 | case 'f': |
| 359 | forward_flag = 1; |
| 360 | break; |
| 361 | case 'b': |
| 362 | backward_flag = 1; |
| 363 | break; |
| 364 | case 0: |
| 365 | break; |
| 366 | default: |
| 367 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:159:9`!, "Try `%s --help' for more information.\n", program_namecxx . . $ program_name.); |
| 368 | exitcxx . . $ exit(3ca292c338df9bb3).(EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:96:9`!); |
| 369 | break; |
| 370 | } |
| 371 | } |
| 372 | if (noUndefinedDotsMode) { |
| 373 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:159:9`!, "%s: did you mean --noUndefined?\n", program_namecxx . . $ program_name.); |
| 374 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:159:9`!, "Try `%s --help' for more information.\n", program_namecxx . . $ program_name.); |
| 375 | exitcxx . . $ exit(3ca292c338df9bb3).(EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:96:9`!); |
| 376 | } |
| 377 | mode |= noContractionsMode | dotsIOMode | ucBrlMode | noUndefinedMode | |
| 378 | partialTransMode; |
| 379 | if (forward_flag && backward_flag) { |
| 380 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:159:9`!, "%s: specify either -f or -b but not both\n", program_namecxx . . $ program_name.); |
| 381 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:159:9`!, "Try `%s --help' for more information.\n", program_namecxx . . $ program_name.); |
| 382 | exitcxx . . $ exit(3ca292c338df9bb3).(EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:96:9`!); |
| 383 | } |
| 384 | if (optindcxx . . $ optind. != argc - 1) { |
| 385 | if (optindcxx . . $ optind. < argc - 1) |
| 386 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:159:9`!, "%s: extra operand: %s\n", program_namecxx . . $ program_name., argv[optindcxx . . $ optind. + 1]); |
| 387 | else |
| 388 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:159:9`!, "%s: no table specified\n", program_namecxx . . $ program_name.); |
| 389 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:159:9`!, "Try `%s --help' for more information.\n", program_namecxx . . $ program_name.); |
| 390 | exitcxx . . $ exit(3ca292c338df9bb3).(EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:96:9`!); |
| 391 | } |
| 392 | table = argv[optindcxx . . $ optind.]; |
| 393 | if (!lou_getTablecxx . . $ lou_getTable(fb668cd7b4a39b42).(table)) { |
| 394 | lou_freecxx . . $ lou_free(49f6e7a06ebc5aa8).(); |
| 395 | exitcxx . . $ exit(3ca292c338df9bb3).(EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:96:9`!); |
| 396 | } |
| 397 | main_loopcxx . . $ main_loop(99469d7ff9a1485a).(backward_flag, table, mode); |
| 398 | lou_freecxx . . $ lou_free(49f6e7a06ebc5aa8).(); |
| 399 | exitcxx . . $ exit(3ca292c338df9bb3).(EXIT_SUCCESScxx . . $ `<external>/10696550936717951914/stdlib.h:97:9`!); |
| 400 | } |