#!/usr/bin/env perl use warnings; use strict; use Carp; my @scripts = qw( Twin_beams anharmonic anharmonic_p breathingMode canonical_bose cgaugenoisethetaphi doublewell_wigner full3d heinzen parosc parosc_p radsym raman_wigner_diff thetaphinoise total_energy_bigger ); open(AAP, ">main.aap") or die "$!"; print AAP ":print Executing scripts/main.aap\n"; print AAP "Files = \n"; foreach my $scriptName ( @scripts ) { # generating the html using enscript my $command = join('', 'enscript -Ehtml --lang=html -o ', $scriptName, '_temp.html --color --title=', $scriptName, '.xmds ', $scriptName, '.xmds'); print "Processing: $scriptName.xmds\n"; my $result = system($command); if ($result != 0) { carp "$scriptName.xmds unable to be processed\n"; } # grabbing the generated html my $fname = join('', $scriptName, '_temp.html'); open(FIN, "<$fname") or die "$!"; my @scriptHtml = ; close(FIN) or die "$!"; unlink($fname); # writing the title part $fname = join('', $scriptName, '_title.part'); print "Writing: $fname\n"; open(FOUT, ">$fname") or die "$!"; print FOUT @scriptHtml[0..4]; close(FOUT) or die "$!"; # writing the body part $fname = join('', $scriptName, '_body.part'); print "Writing: $fname\n"; open(FOUT, ">$fname") or die "$!"; print FOUT @scriptHtml[6..8]; print FOUT "Script source: $scriptName.xmds.gz\n"; print FOUT "
\n
\n"; for (my $i=9; $i<@scriptHtml-2; $i++) { print FOUT $scriptHtml[$i]; } close(FOUT) or die "$!"; # generating the .gz print "Generating: $scriptName.xmds.gz\n\n"; system("cat $scriptName.xmds | gzip -c > $scriptName.xmds.gz"); # making the next line of the aap file print AAP "\t$scriptName.html\n"; } print AAP ' all: $Files :rule %.html : %_title.part scripts_header.part %_body.part scripts_footer.part :cat $source >! $target ', "\n"; close(AAP) or die "$!"; print "Done!\n";