| 1 | /* |
| 2 | * Extract translation strings |
| 3 | * |
| 4 | * Copyright 2008 by Robert Krawitz. |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify it |
| 7 | * under the terms of the GNU General Public License as published by the Free |
| 8 | * Software Foundation; either version 2 of the License, or (at your option) |
| 9 | * any later version. |
| 10 | * |
| 11 | * This program is distributed in the hope that it will be useful, but |
| 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY |
| 13 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
| 14 | * for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU General Public License |
| 17 | * along with this program. If not, see <https://www.gnu.org/licenses/>. |
| 18 | */ |
| 19 | |
| 20 | /* |
| 21 | * Include necessary headers... |
| 22 | */ |
| 23 | |
| 24 | #include <stdio.h> |
| 25 | #include <gutenprint/gutenprint.h>cxx . . $ `<file>/include/gutenprint/gutenprint.h`/ |
| 26 | #include <gutenprint/mxml.h>cxx . . $ `<file>/include/gutenprint/mxml.h`/ |
| 27 | #ifdef HAVE_CONFIG_Hcxx . . $ `<built-in>:411:9`! |
| 28 | #include "config.h"cxx . . $ `<file>/config.h`/ |
| 29 | #endif |
| 30 | |
| 31 | int |
| 32 | maincxx . . $ main(afcd3168fc1188a4).(int argc, char **argv) |
| 33 | { |
| 34 | int status = 0; |
| 35 | argv++; |
| 36 | printfcxx . . $ printf(581fddd72a8db8fc).("/*\n"); |
| 37 | printfcxx . . $ printf(581fddd72a8db8fc).(" * TRANSLATORS:\n"); |
| 38 | printfcxx . . $ printf(581fddd72a8db8fc).(" * All strings in this file must be no more than 80 bytes in length.\n"); |
| 39 | printfcxx . . $ printf(581fddd72a8db8fc).(" * Please take into account expansion due to multi-byte characters,\n"); |
| 40 | printfcxx . . $ printf(581fddd72a8db8fc).(" * as the limit is *bytes*, not characters!\n"); |
| 41 | printfcxx . . $ printf(581fddd72a8db8fc).(" */\n"); |
| 42 | while (*argv) |
| 43 | { |
| 44 | stp_mxml_node_tcxx . . $ stp_mxml_node_t# *top = |
| 45 | stp_mxmlLoadFromFilecxx . . $ stp_mxmlLoadFromFile(40d1ca7ef3f17308).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, *argv, STP_MXML_NO_CALLBACKcxx . . $ `include/gutenprint/mxml.h:48:11`!); |
| 46 | if (top) |
| 47 | { |
| 48 | stp_mxml_node_tcxx . . $ stp_mxml_node_t# *n = top; |
| 49 | stp_string_list_tcxx . . $ stp_string_list_t# *sl = stp_string_list_createcxx . . $ stp_string_list_create(f262b3b5e10fad14).(); |
| 50 | do |
| 51 | { |
| 52 | const char *attr = stp_mxmlElementGetAttrcxx . . $ stp_mxmlElementGetAttr(42933e0d82869bb1).(n, "translate"); |
| 53 | if (attr) |
| 54 | { |
| 55 | const char *str = stp_mxmlElementGetAttrcxx . . $ stp_mxmlElementGetAttr(42933e0d82869bb1).(n, attr); |
| 56 | if (! stp_string_list_is_presentcxx . . $ stp_string_list_is_present(bf726c32497cc2b).(sl, str)) |
| 57 | { |
| 58 | char *s; |
| 59 | stp_string_list_add_string_unsafecxx . . $ stp_string_list_add_string_unsafe(61ec312b340c2952).(sl, str, str); |
| 60 | stp_asprintfcxx . . $ stp_asprintf(816f0239e6d49b84).(&s, "N_(\"%s\");", str); |
| 61 | printfcxx . . $ printf(581fddd72a8db8fc).("%-40s /* %s */\n", s, *argv); |
| 62 | stp_freecxx . . $ stp_free(5d22bdacc48458e8).(s); |
| 63 | } |
| 64 | } |
| 65 | n = stp_mxmlWalkNextcxx . . $ stp_mxmlWalkNext(dc8e7a4515fe7c1a).(n, top, STP_MXML_DESCENDcxx . . $ `include/gutenprint/mxml.h:51:11`!); |
| 66 | } while (n); |
| 67 | stp_string_list_destroycxx . . $ stp_string_list_destroy(73d8582195bcdbb3).(sl); |
| 68 | stp_mxmlDeletecxx . . $ stp_mxmlDelete(6927777f14b5e2a1).(top); |
| 69 | } |
| 70 | else |
| 71 | { |
| 72 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Cannot read %s: %s\n", *argv, strerrorcxx . . $ strerror(ff224f080444ee45).(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!)); |
| 73 | status = 1; |
| 74 | } |
| 75 | argv++; |
| 76 | } |
| 77 | return status; |
| 78 | } |