Line | |
---|
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 | use LWP::Simple;
|
---|
8 |
|
---|
9 | my $item;
|
---|
10 | my $comment = 0;
|
---|
11 |
|
---|
12 | # This is a simple conversion and in no way a complete XML parser
|
---|
13 | # but it works with a default Perl installation
|
---|
14 |
|
---|
15 | # Print a header to write valid Java code. No line break,
|
---|
16 | # so that the input and output line numbers will match.
|
---|
17 | print "class trans_wms { void tr(String s){} void f() {";
|
---|
18 |
|
---|
19 | my @lines;
|
---|
20 | if($ARGV[0] && $ARGV[0] =~ /^http:\/\//)
|
---|
21 | {
|
---|
22 | @lines = split("\r?\n", get($ARGV[0]));
|
---|
23 | }
|
---|
24 | else
|
---|
25 | {
|
---|
26 | @lines = <>;
|
---|
27 | }
|
---|
28 |
|
---|
29 | for my $line (@lines)
|
---|
30 | {
|
---|
31 | $line =~ s/\r//g;
|
---|
32 | chomp($line);
|
---|
33 | if($line =~ /^#(.*)$/)
|
---|
34 | {
|
---|
35 | print "/* $1 */\n";
|
---|
36 | }
|
---|
37 | elsif($line =~ /^$/)
|
---|
38 | {
|
---|
39 | print "\n";
|
---|
40 | }
|
---|
41 | elsif($line =~ /^(.*?);(.*?);(.*)$/)
|
---|
42 | {
|
---|
43 | print "/* $3 */ tr(\"$2\");\n";
|
---|
44 | }
|
---|
45 | else
|
---|
46 | {
|
---|
47 | print "/* $line */\n";
|
---|
48 | }
|
---|
49 | }
|
---|
50 |
|
---|
51 | print "}}\n";
|
---|
Note:
See
TracBrowser
for help on using the repository browser.