aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/others/irrlicht-1.8.1/source/Irrlicht/bzip2/format.pl
diff options
context:
space:
mode:
Diffstat (limited to 'src/others/irrlicht-1.8.1/source/Irrlicht/bzip2/format.pl')
-rw-r--r--src/others/irrlicht-1.8.1/source/Irrlicht/bzip2/format.pl68
1 files changed, 68 insertions, 0 deletions
diff --git a/src/others/irrlicht-1.8.1/source/Irrlicht/bzip2/format.pl b/src/others/irrlicht-1.8.1/source/Irrlicht/bzip2/format.pl
new file mode 100644
index 0000000..f169fd9
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/source/Irrlicht/bzip2/format.pl
@@ -0,0 +1,68 @@
1#!/usr/bin/perl -w
2#
3# ------------------------------------------------------------------
4# This file is part of bzip2/libbzip2, a program and library for
5# lossless, block-sorting data compression.
6#
7# bzip2/libbzip2 version 1.0.6 of 6 September 2010
8# Copyright (C) 1996-2010 Julian Seward <jseward@bzip.org>
9#
10# Please read the WARNING, DISCLAIMER and PATENTS sections in the
11# README file.
12#
13# This program is released under the terms of the license contained
14# in the file LICENSE.
15# ------------------------------------------------------------------
16#
17use strict;
18
19# get command line values:
20if ( $#ARGV !=1 ) {
21 die "Usage: $0 xml_infile xml_outfile\n";
22}
23
24my $infile = shift;
25# check infile exists
26die "Can't find file \"$infile\""
27 unless -f $infile;
28# check we can read infile
29if (! -r $infile) {
30 die "Can't read input $infile\n";
31}
32# check we can open infile
33open( INFILE,"<$infile" ) or
34 die "Can't input $infile $!";
35
36#my $outfile = 'fmt-manual.xml';
37my $outfile = shift;
38#print "Infile: $infile, Outfile: $outfile\n";
39# check we can write to outfile
40open( OUTFILE,">$outfile" ) or
41 die "Can't output $outfile $! for writing";
42
43my ($prev, $curr, $str);
44$prev = ''; $curr = '';
45while ( <INFILE> ) {
46
47 print OUTFILE $prev;
48 $prev = $curr;
49 $curr = $_;
50 $str = '';
51
52 if ( $prev =~ /<programlisting>$|<screen>$/ ) {
53 chomp $prev;
54 $curr = join( '', $prev, "<![CDATA[", $curr );
55 $prev = '';
56 next;
57 }
58 elsif ( $curr =~ /<\/programlisting>|<\/screen>/ ) {
59 chomp $prev;
60 $curr = join( '', $prev, "]]>", $curr );
61 $prev = '';
62 next;
63 }
64}
65print OUTFILE $curr;
66close INFILE;
67close OUTFILE;
68exit;