From ffb751221e80d177efa86591be2fe93ef639f5a1 Mon Sep 17 00:00:00 2001 From: Paul Date: Tue, 9 Jan 2001 18:00:05 +0000 Subject: [PATCH] --- tools/Perl/pl/text_extract.pl | 81 +++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 tools/Perl/pl/text_extract.pl diff --git a/tools/Perl/pl/text_extract.pl b/tools/Perl/pl/text_extract.pl new file mode 100644 index 000000000..a9d004c98 --- /dev/null +++ b/tools/Perl/pl/text_extract.pl @@ -0,0 +1,81 @@ +#========================================================================= +# +# text_extract.pl +# +# Author: pkg@Climax +# Created: +# Project: SBSP +# Purpose: Extracts text ids from the translation header file and exports +# them to an in clude file. This is grabbing the ingame texts and +# putting them somewhere that the script compiler can use +# Usage: text_extract infile outfile tagprefix +# eg: text_extract trans.h scripts\defs\trans.h STR__INGAME__ +# +# Copyright (c) 2001 Climax Development Ltd +# +#=========================================================================== + + +local ($inFile,$outFile,$tagPrefix)=@ARGV; +#print "inFile: $inFile\n"; +#print "outFile: $outFile\n"; +#print "tagPrefix: $tagPrefix\n"; + + +# Open files +open INFILE, $inFile || die "Can't open input file '$inFile': $!\n"; +open OUTFILE, ">$outFile" || die "Can't open output file '$outFile': $!\n"; + + +# Output header +print OUTFILE < || die "End of file found while looking while looking for start of enum list!\n"; + if($line =~ /^\{/) + { + $done=1; + } +} + + +# Grab the ids +$done=0; +$textId=0; +while(!$done) +{ + $line= || die "End of file found before end of enum list!\n"; + chomp($line); + if($line=~/^\}/) + { + $done=1; + } + elsif($line=~/^\s*$/) + { + } + else + { + $line=~s/^\s*([\w]*).*/$1/; + if($line=~/^$tagPrefix/) + { + print OUTFILE "#define ",$line,"\t\t$textId\n"; + } + $textId++; + } +} + + +# Done! :) +close INFILE; +close OUTFILE; \ No newline at end of file