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