summaryrefslogtreecommitdiffstats
path: root/po/fake_c.pl
blob: c456c7f1626efe072d7291e86f3d989872b0dac1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/usr/bin/perl -lp

s|^(__?\()| $1|;		# add a blank at the beginning (?!)

s|_\(\[(.*),\s*(.*),\s*(.*)\]|ngettext($2,$3,$1)|; # special plural form handling

s,\Ws/#.*//,,;			# ugly special case

s,\$#\w+,,;			# $#xxx are removed
s,#([^+].*),"$1/*" . simpl($2) . "*/",e; 
                                # rewrite comments to C format except for:
                                # - ``#+ xxx'' comments which are kept
                                # - ``$#xxx'' which are not comments

s|//|/""/|g;			# ensure // or not understood as comments

s|$|\\n\\|;			# multi-line strings not handled in C

sub simpl {
    local $_ = $_[0];
    s,\*/,,g;
    $_;
}