Last change
on this file since 15725 was 13392, checked in by skela, 16 years ago |
i18n/conv*.pl: Generate Java code that compiles.
|
File size:
723 bytes
|
Rev | Line | |
---|
[12334] | 1 | #! /usr/bin/perl -w
|
---|
| 2 |
|
---|
| 3 | # Written by Dirk Stöcker <openstreetmap@dstoecker.de>
|
---|
| 4 | # Public domain, no rights reserved.
|
---|
| 5 |
|
---|
| 6 | use strict;
|
---|
| 7 |
|
---|
| 8 | my $item;
|
---|
| 9 | my $comment = 0;
|
---|
| 10 |
|
---|
| 11 | # This is a simple conversion and in no way a complete XML parser
|
---|
| 12 | # but it works with a default Perl installation
|
---|
| 13 |
|
---|
[13392] | 14 | # Print a header to write valid Java code. No line break,
|
---|
| 15 | # so that the input and output line numbers will match.
|
---|
| 16 | print "class trans_wms { void tr(String s){} void f() {";
|
---|
| 17 |
|
---|
[12334] | 18 | while(my $line = <>)
|
---|
| 19 | {
|
---|
| 20 | chomp($line);
|
---|
| 21 | if($line =~ /^#(.*)$/)
|
---|
| 22 | {
|
---|
| 23 | print "//$1\n";
|
---|
| 24 | }
|
---|
| 25 | elsif($line =~ /^$/)
|
---|
| 26 | {
|
---|
| 27 | print "\n";
|
---|
| 28 | }
|
---|
| 29 | elsif($line =~ /^(.*?);(.*?);(.*)$/)
|
---|
| 30 | {
|
---|
[13392] | 31 | print "tr(\"$2\"); // $3\n";
|
---|
[12334] | 32 | }
|
---|
| 33 | else
|
---|
| 34 | {
|
---|
| 35 | print "/* $line */\n";
|
---|
| 36 | }
|
---|
| 37 | }
|
---|
[13392] | 38 |
|
---|
| 39 | print "}}\n";
|
---|
Note:
See
TracBrowser
for help on using the repository browser.