|
|
Here is the Perl script I use to insert them. It looks for #declare, and
appends a semicolon only if there is no " or { in the line. This means that if
you put your opening brace on the same line as your #declare it will not
append the semicolon, if your opening brace is on the line below your #declare
it will append the semicolon, messing up your declaration. The script saves
the converted file as .P31, preserving the original in case there is a problem
with the conversion. The script should be portable to all Perl
implementations.
#!/usr/bin/perl
#***********************************************************************
#
# FILENAME: declsemi.pl
#
# USAGE: declsemi.pl <list of files>
#
# DESCRIPTION:
# This Perl script places a semicolon at the end of #declare statements
# IF the statement does not contain a '{' or '"'
#
# The modified file is saved as a .P31 file. You can then inspect the
# differences.
#
# REVISION HISTORY:
# 10/2/98 - Initial revision. pma### [at] teleportcom, pat### [at] fltdyncom
#***********************************************************************
#
# Process each file in the list
#
foreach $i (0 .. $#ARGV)
{
#
# Open the input file and a output file
#
$inFileName = $ARGV[$i];
$outFileName = substr($inFileName,0,index($inFileName,'.')) . ".P31";
open(inFile," $inFileName") || die "Can't open $inFileName\n";
open(outFile,"> $outFileName") || die "Can't open $outFileName\n";
#
# Read each line from the file
#
while (<inFile>)
{
#
# Does the line include a #declare?
#
if (/\#declare/)
{
#
# Ok to add semicolon?
#
if ((index($_,'{')<0) && (index($_,'"')<0))
{
#
# Chop off the EOL, Append semicolon and EOL
#
chop;
$_ = $_ . ';' . "\n";
}
}
#
# Send the line to the output file
#
print outFile $_;
}
#
# Close the input and output files
#
close(inFile);
close(outFile);
}
Nathan Kopp wrote:
> I do know that my lens flare is also not currently compatible with POV 3.1
> (only because of missing semi-colons, though). Does anyone know of a good
> utility/script to insert those crazy semicolons?
>
> BTW, I will eventually be upgrading my lens flare and will also eventually
> have a web page for it again. Hopefully soon.
>
> -Nathan Kopp
Post a reply to this message
|
|