simple.cc - generated code example
[prop.git] / bin / prop-filter
blobb85ee79bce630c8f9a5ca459b187738290de52e5
1 #!/usr/bin/perl -p
3 $id = "[a-zA-Z_0-9]+";
5 sub translate
6 { local($ident) = @_;
7 if ($ident =~ /(XX.*XX)/)
8 { $text = $1;
9 $string = "";
10 for ($i = 0; $i < length($text); $i += 2)
11 { $token = substr($text,$i,2);
12 next if ($token eq "XX");
13 if ($token =~ /^_(.)/) { $string = "$string$1"; }
14 else
15 { $token =~ /^(.)(.)/;
16 $c = chr(hex($1) * 16 + hex($2));
17 $string = "$string$c";
20 return "\"$string\"";
22 return $ident;
25 while (<>)
26 { s/_(XX.*)__FP\d+(.*)/\1(\2 *)/go;
27 s/a_($id) \*/translate($1)/goe;
28 s/a_($id<[^\>]+>) \*/translate($1)/goe;
29 s/(XX.*XX)/translate($1)/goe;
30 print;