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