Last change
on this file since 17591 was 13392, checked in by skela, 16 years ago |
i18n/conv*.pl: Generate Java code that compiles.
|
File size:
704 bytes
|
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 |
|
---|
8 | # This is a simple conversion and in no way a complete XML parser
|
---|
9 | # but it works with a default Perl installation
|
---|
10 |
|
---|
11 | # Print a header to write valid Java code. No line break,
|
---|
12 | # so that the input and output line numbers will match.
|
---|
13 | print "class trans_style { void tr(String s){} void f() {";
|
---|
14 |
|
---|
15 | while(my $line = <>)
|
---|
16 | {
|
---|
17 | chomp($line);
|
---|
18 | if($line =~ /<rules\s+name=(".*?")/)
|
---|
19 | {
|
---|
20 | print "tr($1); /* mappaint style named $1 */\n";
|
---|
21 | }
|
---|
22 | elsif($line =~ /colour="([^"]+)#/)
|
---|
23 | {
|
---|
24 | print "tr(\"$1\"); /* color $1 */\n";
|
---|
25 | }
|
---|
26 | else
|
---|
27 | {
|
---|
28 | print "/* $line */\n";
|
---|
29 | }
|
---|
30 | }
|
---|
31 |
|
---|
32 | print "}}\n";
|
---|
Note:
See
TracBrowser
for help on using the repository browser.