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;
|
---|
[25613] | 7 | use LWP::Simple;
|
---|
[12334] | 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 |
|
---|
[13392] | 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 |
|
---|
[25613] | 19 | my @lines;
|
---|
| 20 | if($ARGV[0] && $ARGV[0] =~ /^http:\/\//)
|
---|
[12334] | 21 | {
|
---|
[25613] | 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;
|
---|
[12334] | 32 | chomp($line);
|
---|
| 33 | if($line =~ /^#(.*)$/)
|
---|
| 34 | {
|
---|
[23091] | 35 | print "/* $1 */\n";
|
---|
[12334] | 36 | }
|
---|
| 37 | elsif($line =~ /^$/)
|
---|
| 38 | {
|
---|
| 39 | print "\n";
|
---|
| 40 | }
|
---|
| 41 | elsif($line =~ /^(.*?);(.*?);(.*)$/)
|
---|
| 42 | {
|
---|
[23091] | 43 | print "/* $3 */ tr(\"$2\");\n";
|
---|
[12334] | 44 | }
|
---|
| 45 | else
|
---|
| 46 | {
|
---|
| 47 | print "/* $line */\n";
|
---|
| 48 | }
|
---|
| 49 | }
|
---|
[13392] | 50 |
|
---|
| 51 | print "}}\n";
|
---|
Note:
See
TracBrowser
for help on using the repository browser.