diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2011-01-02 19:20:23 +0000 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2011-01-02 19:20:23 +0000 |
commit | 800a2630497e1ec2c61199b3bc645d778c714529 (patch) | |
tree | 2edad02015bdb0995b6f95505deb51f866253f34 | |
parent | 73578276afa8d64128d10a4b0ff9b7246b178cc3 (diff) |
build: remove some obsolete support scripts
-rwxr-xr-x | build/i18n-html2lua.pl | 48 | ||||
-rw-r--r-- | build/i18n-lua-xhtml1.xsl | 238 | ||||
-rwxr-xr-x | build/i18n-lua2po.pl | 120 | ||||
-rwxr-xr-x | build/i18n-lua2xml.lua | 22 | ||||
-rw-r--r-- | build/i18n-xml2lua.sh | 38 | ||||
-rwxr-xr-x | build/mklar.pl | 119 |
6 files changed, 0 insertions, 585 deletions
diff --git a/build/i18n-html2lua.pl b/build/i18n-html2lua.pl deleted file mode 100755 index c6b893eee4..0000000000 --- a/build/i18n-html2lua.pl +++ /dev/null @@ -1,48 +0,0 @@ -#!/usr/bin/perl - -@ARGV || die "Usage: $0 template1.htm [... templateN.htm]\n"; - - -my %tags; - -foreach my $file ( @ARGV ) -{ - if( open F, "< $file" ) - { - local $/ = undef; - - my $data = <F>; - - while( $data =~ m/ <%: -? (\w+) (.*?) %> /sgx ) - { - my ( $key, $val ) = ( $1, $2 ); - - if( $key && $val ) - { - $val =~ s/\s+/ /sg; - $val =~ s/^\s+//; - $val =~ s/\s+$//; - - $tags{$key} = $val; - } - else - { - $tags{$key} ||= ''; - } - } - - close F; - } -} - -foreach my $key ( sort keys %tags ) -{ - if( $val =~ /'/ ) - { - printf "%s = [[%s]]\n", $key, $tags{$key}; - } - else - { - printf "%s = '%s'\n", $key, $tags{$key}; - } -} diff --git a/build/i18n-lua-xhtml1.xsl b/build/i18n-lua-xhtml1.xsl deleted file mode 100644 index 53bd7be9ae..0000000000 --- a/build/i18n-lua-xhtml1.xsl +++ /dev/null @@ -1,238 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- -Copyright (C) 2008 Alina Friedrichsen <x-alina@gmx.net> - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions -are met: -1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. -2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -SUCH DAMAGE. ---> - -<xsl:transform version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:i18n="http://luci.freifunk-halle.net/2008/i18n#" xmlns:h="http://www.w3.org/1999/xhtml" xmlns="http://www.w3.org/1999/xhtml" exclude-result-prefixes="i18n h"> -<xsl:output method="text" encoding="utf-8" media-type="text/x-lua" indent="no"/> - -<xsl:template match="/i18n:msgs"> - <xsl:apply-templates select="i18n:msg" /> -</xsl:template> - -<xsl:template match="i18n:msg"> - <xsl:if test="@xml:id != '' and translate(@xml:id, '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz', '') = ''"> - <xsl:if test="translate(substring(@xml:id, 0, 2), 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz', '') = ''"> - <xsl:if test="@xml:id != 'and' and @xml:id != 'break' and @xml:id != 'do' and @xml:id != 'else' and @xml:id != 'elseif' and @xml:id != 'end' and @xml:id != 'false' and @xml:id != 'for' and @xml:id != 'function' and @xml:id != 'if' and @xml:id != 'in' and @xml:id != 'local' and @xml:id != 'nil' and @xml:id != 'not' and @xml:id != 'or' and @xml:id != 'repeat' and @xml:id != 'return' and @xml:id != 'then' and @xml:id != 'true' and @xml:id != 'until' and @xml:id != 'while'"> - <xsl:value-of select="@xml:id"/> - <xsl:text> = '</xsl:text> - <xsl:choose> - <xsl:when test="@method = 'text'"> - <xsl:call-template name="escape-lua"> - <xsl:with-param name="string" select="."/> - </xsl:call-template> - </xsl:when> - <xsl:otherwise> - <xsl:apply-templates select="node()" mode="xhtml"/> - </xsl:otherwise> - </xsl:choose> - <xsl:text>' </xsl:text> - </xsl:if> - </xsl:if> - </xsl:if> -</xsl:template> - -<xsl:template match="h:*" priority="-1" mode="xhtml"> - <xsl:text><</xsl:text> - <xsl:value-of select="local-name(.)"/> - <xsl:apply-templates select="@*" mode="xhtml"/> - <xsl:text>></xsl:text> - <xsl:apply-templates mode="xhtml"/> - <xsl:text></</xsl:text> - <xsl:value-of select="local-name(.)"/> - <xsl:text>></xsl:text> -</xsl:template> - -<xsl:template match="*" priority="-2" mode="xhtml"> - <xsl:text><span class="</xsl:text> - <xsl:value-of select="local-name(.)"/> - <xsl:text>"</xsl:text> - <xsl:apply-templates select="@*" mode="xhtml"/> - <xsl:text>></xsl:text> - <xsl:apply-templates mode="xhtml"/> - <xsl:text></span></xsl:text> -</xsl:template> - -<xsl:template match="h:br" mode="xhtml"> - <xsl:text><br</xsl:text> - <xsl:apply-templates select="@*" mode="xhtml"/> - <xsl:text> /></xsl:text> -</xsl:template> - -<xsl:template match="h:img" mode="xhtml"> - <xsl:text><img</xsl:text> - <xsl:apply-templates select="@*" mode="xhtml"/> - <xsl:text> /></xsl:text> -</xsl:template> - -<xsl:template match="@*" priority="-1" mode="xhtml"> - <xsl:if test="namespace-uri(.) = '' and local-name(.) != 'lang' or namespace-uri(.) = 'http://www.w3.org/XML/1998/namespace'"> - <xsl:if test="namespace-uri(..) = 'http://www.w3.org/1999/xhtml' or local-name(.) != 'class'"> - <xsl:text> </xsl:text> - <xsl:if test="namespace-uri(.) = 'http://www.w3.org/XML/1998/namespace'"> - <xsl:text>xml:</xsl:text> - </xsl:if> - <xsl:value-of select="local-name(.)"/> - <xsl:text>="</xsl:text> - <xsl:variable name="escaped"> - <xsl:call-template name="escape-lua-xhtml1"> - <xsl:with-param name="string" select="."/> - </xsl:call-template> - </xsl:variable> - <xsl:value-of select="$escaped"/> - <xsl:text>"</xsl:text> - </xsl:if> - </xsl:if> -</xsl:template> - -<xsl:template match="@xml:lang" mode="xhtml"> - <xsl:variable name="escaped"> - <xsl:call-template name="escape-lua-xhtml1"> - <xsl:with-param name="string" select="."/> - </xsl:call-template> - </xsl:variable> - <xsl:text> xml:lang="</xsl:text> - <xsl:value-of select="$escaped"/> - <xsl:text>"</xsl:text> - <xsl:text> lang="</xsl:text> - <xsl:value-of select="$escaped"/> - <xsl:text>"</xsl:text> -</xsl:template> - -<xsl:template match="text()" priority="-1" mode="xhtml"> - <xsl:variable name="escaped"> - <xsl:call-template name="escape-lua-xhtml1"> - <xsl:with-param name="string" select="."/> - </xsl:call-template> - </xsl:variable> - <xsl:value-of select="$escaped"/> -</xsl:template> - -<xsl:template name="escape-xhtml1"> - <xsl:param name="string"/> - <xsl:variable name="escaped"> - <xsl:call-template name="replace"> - <xsl:with-param name="string" select="$string"/> - <xsl:with-param name="search" select="'&'"/> - <xsl:with-param name="replace" select="'&amp;'"/> - </xsl:call-template> - </xsl:variable> - <xsl:variable name="escaped1"> - <xsl:call-template name="replace"> - <xsl:with-param name="string" select="$escaped"/> - <xsl:with-param name="search" select="'"'"/> - <xsl:with-param name="replace" select="'&quot;'"/> - </xsl:call-template> - </xsl:variable> - <xsl:variable name="escaped2"> - <xsl:call-template name="replace"> - <xsl:with-param name="string" select="$escaped1"/> - <xsl:with-param name="search" select='"'"'/> - <xsl:with-param name="replace" select="'&#39;'"/> - </xsl:call-template> - </xsl:variable> - <xsl:variable name="escaped3"> - <xsl:call-template name="replace"> - <xsl:with-param name="string" select="$escaped2"/> - <xsl:with-param name="search" select="'<'"/> - <xsl:with-param name="replace" select="'&lt;'"/> - </xsl:call-template> - </xsl:variable> - <xsl:call-template name="replace"> - <xsl:with-param name="string" select="$escaped3"/> - <xsl:with-param name="search" select="'>'"/> - <xsl:with-param name="replace" select="'&gt;'"/> - </xsl:call-template> -</xsl:template> - -<xsl:template name="escape-lua"> - <xsl:param name="string"/> - <xsl:variable name="escaped"> - <xsl:call-template name="replace"> - <xsl:with-param name="string" select="$string"/> - <xsl:with-param name="search" select="'\'"/> - <xsl:with-param name="replace" select="'\\'"/> - </xsl:call-template> - </xsl:variable> - <xsl:variable name="escaped1"> - <xsl:call-template name="replace"> - <xsl:with-param name="string" select="$escaped"/> - <xsl:with-param name="search" select="' '"/> - <xsl:with-param name="replace" select="'\n'"/> - </xsl:call-template> - </xsl:variable> - <xsl:variable name="escaped2"> - <xsl:call-template name="replace"> - <xsl:with-param name="string" select="$escaped1"/> - <xsl:with-param name="search" select="' '"/> - <xsl:with-param name="replace" select="'\r'"/> - </xsl:call-template> - </xsl:variable> - <xsl:variable name="escaped3"> - <xsl:call-template name="replace"> - <xsl:with-param name="string" select="$escaped2"/> - <xsl:with-param name="search" select="'"'"/> - <xsl:with-param name="replace" select="'\"'"/> - </xsl:call-template> - </xsl:variable> - <xsl:call-template name="replace"> - <xsl:with-param name="string" select="$escaped3"/> - <xsl:with-param name="search" select='"'"'/> - <xsl:with-param name="replace" select='"\'"'/> - </xsl:call-template> -</xsl:template> - -<xsl:template name="escape-lua-xhtml1"> - <xsl:param name="string"/> - <xsl:variable name="escaped"> - <xsl:call-template name="escape-xhtml1"> - <xsl:with-param name="string" select="$string"/> - </xsl:call-template> - </xsl:variable> - <xsl:call-template name="escape-lua"> - <xsl:with-param name="string" select="$escaped"/> - </xsl:call-template> -</xsl:template> - -<xsl:template name="replace"> - <xsl:param name="string"/> - <xsl:param name="search"/> - <xsl:param name="replace"/> - <xsl:choose> - <xsl:when test="contains($string, $search)"> - <xsl:value-of select="substring-before($string, $search)"/> - <xsl:value-of select="$replace"/> - <xsl:call-template name="replace"> - <xsl:with-param name="string" select="substring-after($string, $search)"/> - <xsl:with-param name="search" select="$search"/> - <xsl:with-param name="replace" select="$replace"/> - </xsl:call-template> - </xsl:when> - <xsl:otherwise> - <xsl:value-of select="$string"/> - </xsl:otherwise> - </xsl:choose> -</xsl:template> - -</xsl:transform> diff --git a/build/i18n-lua2po.pl b/build/i18n-lua2po.pl deleted file mode 100755 index d72d2e9755..0000000000 --- a/build/i18n-lua2po.pl +++ /dev/null @@ -1,120 +0,0 @@ -#!/usr/bin/perl - -@ARGV >= 2 || die "Usage: $0 <source-dir> <dest-dir> [<target-language>]\n"; - -my $source_dir = shift @ARGV; -my $target_dir = shift @ARGV; -my $target_lang = shift @ARGV; -my $master_lang = "en"; - - -if( ! -d "$target_dir/" . ( $target_lang || 'templates' ) ) -{ - system('mkdir', '-p', "$target_dir/" . ( $target_lang || 'templates' )); -} - - -my %target_strings; - -if( $target_lang && open F, "find $source_dir -path '*/luasrc/i18n/*' -name '*.$target_lang.lua' |" ) -{ - while( chomp( my $file = readline F ) ) - { - if( open L, "< $file" ) - { - my ( $basename ) = $file =~ m{.+/([^/]+)\.[\w\-]+\.lua$}; - $target_strings{$basename} = { }; - - while( chomp( my $entry = readline L ) ) - { - my ( $k, $v ); - if( $entry =~ /^\s*(\w+)\s*=\s*\[\[(.+)\]\]/ ) - { - ( $k, $v ) = ( $1, $2 ); - } - elsif( $entry =~ /^\s*(\w+)\s*=\s*'(.+)'/ ) - { - ( $k, $v ) = ( $1, $2 ); - } - elsif( $entry =~ /^\s*(\w+)\s*=\s*"(.+)"/ ) - { - ( $k, $v ) = ( $1, $2 ); - } - - if( $k && $v ) - { - $v =~ s/"/\\"/g; - $v =~ s/\\\\"/\\"/g; - $target_strings{$basename}{$k} = $v; - } - } - - close L; - } - } - - close F; -} - - -if( open F, "find . -path '*/luasrc/i18n/*' -name '*.$master_lang.lua' |" ) -{ - my $destfile = sprintf '%s/%s/%%s.%s', - $target_dir, - $target_lang || 'templates', - $target_lang ? 'po' : 'pot' - ; - - while( chomp( my $file = readline F ) ) - { - if( open L, "< $file" ) - { - my ( $basename ) = $file =~ m{.+/([^/]+)\.\w+\.lua$}; - my $filename = sprintf $destfile, $basename; - - if( open T, "> $filename" ) - { - printf "Generating %-40s ", $filename; - - printf T "# %s.%s\n# generated from %s\n\nmsgid \"\"\n" . - "msgstr \"Content-Type: text/plain; charset=UTF-8\"\n\n", - $basename, $target_lang ? 'po' : 'pot', $file; - - while( chomp( my $entry = readline L ) ) - { - my ( $k, $v ); - if( $entry =~ /^\s*(\w+)\s*=\s*\[\[(.+)\]\]/ ) - { - ( $k, $v ) = ( $1, $2 ); - } - elsif( $entry =~ /^\s*(\w+)\s*=\s*'(.+)'/ ) - { - ( $k, $v ) = ( $1, $2 ); - } - elsif( $entry =~ /^\s*(\w+)\s*=\s*"(.+)"/ ) - { - ( $k, $v ) = ( $1, $2 ); - } - - if( $k && $v ) - { - $v =~ s/"/\\"/g; - $v =~ s/\\\\"/\\"/g; - printf T "#: %s:%d\n#. %s\nmsgid \"%s\"\nmsgstr \"%s\"\n\n", - $file, $., $v, $k, - ( $target_strings{$basename} && $target_strings{$basename}{$k} ) - ? $target_strings{$basename}{$k} : ""; - } - } - - close T; - - print "done\n"; - } - - close L; - } - } - - close F; -} diff --git a/build/i18n-lua2xml.lua b/build/i18n-lua2xml.lua deleted file mode 100755 index 674c8adb51..0000000000 --- a/build/i18n-lua2xml.lua +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/lua -local util = require "luci.util" - -assert(arg[1]) - -local x = {} -local f = loadfile(arg[1]) -setfenv(f, x) -f() - -print '<?xml version="1.0" encoding="utf-8"?>' -print '' -print '<i18n:msgs xmlns:i18n="http://luci.freifunk-halle.net/2008/i18n#" xmlns="http://www.w3.org/1999/xhtml">' -print '' - -for k, v in util.kspairs(x) do - print ('<i18n:msg xml:id="%s">%s</i18n:msg>' % {k, v}) -end - -print '' -print '</i18n:msgs>' - diff --git a/build/i18n-xml2lua.sh b/build/i18n-xml2lua.sh deleted file mode 100644 index d70e135de4..0000000000 --- a/build/i18n-xml2lua.sh +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/sh -# Copyright (C) 2008 Alina Friedrichsen <x-alina@gmx.net> -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -# SUCH DAMAGE. - -i18n_xml2lua() { - echo '<?xml version="1.0" encoding="utf-8"?>' - echo - echo '<i18n:msgs xmlns:i18n="http://luci.freifunk-halle.net/2008/i18n#" xmlns="http://www.w3.org/1999/xhtml">' - echo - LANG=C sed -e 's/^\s*\([A-Za-z][0-9A-Za-z_]*\)\s*[=]\s*\[\[/<i18n:msg xml:id="\1">/' -e 's/\]\]\s*$/<\/i18n:msg>/' -e 's/^\s*\([A-Za-z][0-9A-Za-z_]*\)\s*[=]\s*["]\(.*\)["]\s*$/<i18n:msg xml:id="\1">\2<\/i18n:msg>/' -e 's/^\s*$//' - echo - echo '</i18n:msgs>' - return 0 -} - -for file in "$@"; do - i18n_xml2lua < "$file" > "$(dirname "$file")/$(basename "$file" .lua).xml" || exit 1 -done diff --git a/build/mklar.pl b/build/mklar.pl deleted file mode 100755 index d91eaebef7..0000000000 --- a/build/mklar.pl +++ /dev/null @@ -1,119 +0,0 @@ -#!/usr/bin/perl - -use strict; -use File::Find; -use Digest::MD5 qw(md5 md5_hex); - -my @search = @ARGV; -if( !@search ) { - @search = ( - glob("libs/*"), - glob("applications/*"), - glob("i18n/*"), - glob("modules/*") - ); -} - - -sub depth { - my $p = shift; - my $d = 0; - $d++ while( $p =~ m{/}g ); - return $d; -}; - - -my @index; -my $offset = 0; - - -# -# Build File Members -# - -find( sub { - # Skip non-files - ( -f $_ ) || return; - - # Skip stuff not in /luasrc/ - ( $File::Find::name =~ m{/luasrc/} ) || return; - - # Skip .svn foo - ( $File::Find::name !~ m{/\.svn\b} ) || return; - - # Exclude luci-statistics and lucittpd for now - ( $File::Find::name !~ m{/luci-statistics/} && $File::Find::name !~ m{/lucittpd/} ) || return; - - - my $file = $File::Find::name; - $file =~ s{^.+/luasrc/}{luci/}; - - my $command = ( $File::Find::name =~ m{\.lua\z} && $ENV{LUAC} ) - ? "$ENV{LUAC} -o - $_ |" : "< $_"; - - if( open F, $command ) - { - warn sprintf "Member at 0x%08X: %s\n", $offset, $file; - push @index, [ ]; - - my $size = 0; - my $pad = 0; - - $index[-1][0] = $offset; - - while( read F, my $buffer, 4096 ) { - $size += length $buffer; - print $buffer; - } - - if( $size % 4 ) { - $pad = ( 4 - ( $size % 4 ) ); - } - - print "\0" x $pad; - - $index[-1][1] = $size; - $index[-1][2] = md5($file); - $index[-1][3] = 0x0000; - $index[-1][4] = $file; - - $offset += $size + $pad; - - close F; - } -}, @search ); - - -# -# Build File List Member -# - -my $filelist = join("\0", map $_->[4], @index) . "\0"; -my $listsize = length $filelist; -push @index, [ $offset, $listsize, "", 0xFFFF, undef ]; - -warn sprintf "Filelist at 0x%08X, length 0x%08X\n", $offset, $listsize; - -print $filelist; -$offset += $listsize; - -if( $listsize % 4 ) -{ - $offset += ( 4 - ($listsize % 4) ); - print "\0" x ( 4 - ($listsize % 4) ); -} - - -my $count = 1; -foreach my $file ( @index ) -{ - warn sprintf "Index[%4d]: 0x%08X 0x%08X 0x%04X 0x%04X %32s\n", - $count++, $file->[0], $file->[1], $file->[3], 0x0000, - $file->[4] ? md5_hex($file->[4]) : "0" x 32 - ; - - print pack "NNnna16", $file->[0], $file->[1], $file->[3], 0x0000, $file->[2]; -} - -warn sprintf "Index at 0x%08X, length 0x%08X\n", $offset, @index * 28; -print pack "N", $offset; |