1 | # po2tbl.sed - Convert Uniforum style .po file to lookup table for catgets
|
---|
2 | # Copyright (C) 1995 Free Software Foundation, Inc.
|
---|
3 | # Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
|
---|
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 2, or (at your option)
|
---|
8 | # 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, write to the Free Software
|
---|
17 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
---|
18 | #
|
---|
19 | 1 {
|
---|
20 | i\
|
---|
21 | /* Automatically generated by po2tbl.sed from @PACKAGE NAME@.pot. */\
|
---|
22 | \
|
---|
23 | #if HAVE_CONFIG_H\
|
---|
24 | # include <config.h>\
|
---|
25 | #endif\
|
---|
26 | \
|
---|
27 | #include "libgettext.h"\
|
---|
28 | \
|
---|
29 | const struct _msg_ent _msg_tbl[] = {
|
---|
30 | h
|
---|
31 | s/.*/0/
|
---|
32 | x
|
---|
33 | }
|
---|
34 | #
|
---|
35 | # Write msgid entries in C array form.
|
---|
36 | #
|
---|
37 | /^msgid/ {
|
---|
38 | s/msgid[ ]*\(".*"\)/ {\1/
|
---|
39 | tb
|
---|
40 | # Append the next line
|
---|
41 | :b
|
---|
42 | N
|
---|
43 | # Look whether second part is continuation line.
|
---|
44 | s/\(.*\)"\(\n\)"\(.*"\)/\1\2\3/
|
---|
45 | # Yes, then branch.
|
---|
46 | ta
|
---|
47 | # Because we assume that the input file correctly formed the line
|
---|
48 | # just read cannot be again be a msgid line. So it's safe to ignore
|
---|
49 | # it.
|
---|
50 | s/\(.*\)\n.*/\1/
|
---|
51 | bc
|
---|
52 | # We found a continuation line. But before printing insert '\'.
|
---|
53 | :a
|
---|
54 | s/\(.*\)\(\n.*\)/\1\\\2/
|
---|
55 | P
|
---|
56 | # We cannot use D here.
|
---|
57 | s/.*\n\(.*\)/\1/
|
---|
58 | # Some buggy seds do not clear the `successful substitution since last ``t'''
|
---|
59 | # flag on `N', so we do a `t' here to clear it.
|
---|
60 | tb
|
---|
61 | # Not reached
|
---|
62 | :c
|
---|
63 | x
|
---|
64 | # The following nice solution is by
|
---|
65 | # Bruno <Haible@ma2s2.mathematik.uni-karlsruhe.de>
|
---|
66 | td
|
---|
67 | # Increment a decimal number in pattern space.
|
---|
68 | # First hide trailing `9' digits.
|
---|
69 | :d
|
---|
70 | s/9\(_*\)$/_\1/
|
---|
71 | td
|
---|
72 | # Assure at least one digit is available.
|
---|
73 | s/^\(_*\)$/0\1/
|
---|
74 | # Increment the last digit.
|
---|
75 | s/8\(_*\)$/9\1/
|
---|
76 | s/7\(_*\)$/8\1/
|
---|
77 | s/6\(_*\)$/7\1/
|
---|
78 | s/5\(_*\)$/6\1/
|
---|
79 | s/4\(_*\)$/5\1/
|
---|
80 | s/3\(_*\)$/4\1/
|
---|
81 | s/2\(_*\)$/3\1/
|
---|
82 | s/1\(_*\)$/2\1/
|
---|
83 | s/0\(_*\)$/1\1/
|
---|
84 | # Convert the hidden `9' digits to `0's.
|
---|
85 | s/_/0/g
|
---|
86 | x
|
---|
87 | G
|
---|
88 | s/\(.*\)\n\([0-9]*\)/\1, \2},/
|
---|
89 | s/\(.*\)"$/\1/
|
---|
90 | p
|
---|
91 | }
|
---|
92 | #
|
---|
93 | # Last line.
|
---|
94 | #
|
---|
95 | $ {
|
---|
96 | i\
|
---|
97 | };\
|
---|
98 |
|
---|
99 | g
|
---|
100 | s/0*\(.*\)/int _msg_tbl_length = \1;/p
|
---|
101 | }
|
---|
102 | d
|
---|