]> git.saurik.com Git - bison.git/blame - intl/po2tbl.sed.in
* lib/malloc.c, lib/realloc.c: New, from the fileutils 4.0.37.
[bison.git] / intl / po2tbl.sed.in
CommitLineData
705db0b5
AD
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#
191 {
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\
29const 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# Escape trigraphs.
56 s/[?][?]\([-=(/)'<!>]\)/?\\?\1/g
57 P
58# We cannot use D here.
59 s/.*\n\(.*\)/\1/
60# Some buggy seds do not clear the `successful substitution since last ``t'''
61# flag on `N', so we do a `t' here to clear it.
62 tb
63# Not reached
64 :c
65 x
66# The following nice solution is by
67# Bruno <Haible@ma2s2.mathematik.uni-karlsruhe.de>
68 td
69# Increment a decimal number in pattern space.
70# First hide trailing `9' digits.
71 :d
72 s/9\(_*\)$/_\1/
73 td
74# Assure at least one digit is available.
75 s/^\(_*\)$/0\1/
76# Increment the last digit.
77 s/8\(_*\)$/9\1/
78 s/7\(_*\)$/8\1/
79 s/6\(_*\)$/7\1/
80 s/5\(_*\)$/6\1/
81 s/4\(_*\)$/5\1/
82 s/3\(_*\)$/4\1/
83 s/2\(_*\)$/3\1/
84 s/1\(_*\)$/2\1/
85 s/0\(_*\)$/1\1/
86# Convert the hidden `9' digits to `0's.
87 s/_/0/g
88 x
89 G
90 s/\(.*\)\n\([0-9]*\)/\1, \2},/
91 s/\(.*\)"$/\1/
92# Escape trigraphs.
93 s/[?][?]\([-=(/)'<!>]\)/?\\?\1/g
94 p
95}
96#
97# Last line.
98#
99$ {
100 i\
101};\
102
103 g
104 s/0*\(.*\)/int _msg_tbl_length = \1;/p
105}
106d