summaryrefslogtreecommitdiff
path: root/scripts/context/perl/texexec.pl
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/context/perl/texexec.pl')
-rw-r--r--scripts/context/perl/texexec.pl430
1 files changed, 75 insertions, 355 deletions
diff --git a/scripts/context/perl/texexec.pl b/scripts/context/perl/texexec.pl
index 9a1d31bdc..0e1d4c0ab 100644
--- a/scripts/context/perl/texexec.pl
+++ b/scripts/context/perl/texexec.pl
@@ -3,7 +3,7 @@ eval '(exit $?0)' && eval 'exec perl -w -S $0 ${1+"$@"}' && eval 'exec perl -w -
#D \module
#D [ file=texexec.pl,
-#D version=2004.08.29,
+#D version=2003.09.16,
#D title=running \ConTeXt,
#D subtitle=\TEXEXEC,
#D author=Hans Hagen,
@@ -33,7 +33,6 @@ eval '(exit $?0)' && eval 'exec perl -w -S $0 ${1+"$@"}' && eval 'exec perl -w -
#D everything. Well, the result is a messy script like this ... Sorry.
use strict ;
-#~ use warnings ; # strange warnings, todo
# todo: second run of checksum of mp file with --nomprun changes
# todo: warning if no args
@@ -118,7 +117,6 @@ my $FinalMode = 0;
my $Format = '';
my $MpDoFormat = '';
my $HelpAsked = 0;
-my $Version = 0;
my $MainBodyFont = 'standard';
my $MainLanguage = 'standard';
my $MainResponse = 'standard';
@@ -170,7 +168,6 @@ my $PdfCopy = 0;
my $LogFile = "";
my $MpyForce = 0;
my $InpPath = "";
-my $AutoPath = 0;
my $RunPath = "";
my $Arguments = "";
my $Pretty = 0;
@@ -185,9 +182,7 @@ my $AllPatterns = 0;
my $ForceXML = 0;
my $Random = 0;
my $Filters = '';
-my $NoMapFiles = 0 ;
-my $Foxet = 0 ;
-my $TheEnginePath = 0 ;
+my $NoMapFiles = 0;
my $StartLine = 0 ;
my $StartColumn = 0 ;
@@ -214,7 +209,6 @@ my $MakeMpy = '';
"format=s" => \$Format,
"mpformat=s" => \$MpDoFormat,
"help" => \$HelpAsked,
- "version" => \$Version,
"interface=s" => \$ConTeXtInterface,
"language=s" => \$MainLanguage,
"bodyfont=s" => \$MainBodyFont,
@@ -240,7 +234,6 @@ my $MakeMpy = '';
"paper=s" => \$PaperFormat,
"passon=s" => \$PassOn,
"path=s" => \$InpPath,
- "autopath" => \$AutoPath,
"pdf" => \$ProducePdfT,
"pdm" => \$ProducePdfM,
"pdx" => \$ProducePdfX,
@@ -290,8 +283,6 @@ my $MakeMpy = '';
"modefile=s" => \$ModeFile, # additional modes file
"globalfile" => \$GlobalFile,
"nomapfiles" => \$NoMapFiles,
- "foxet" => \$Foxet,
- "engine" => \$TheEnginePath,
#### exxperiment
"startline=s" => \$StartLine,
"startcolumn=s" => \$StartColumn,
@@ -299,12 +290,6 @@ my $MakeMpy = '';
"endcolumn=s" => \$EndColumn
); # don't check name
-if ($Foxet) {
- $ProducePdfT = 1 ;
- $ForceXML = 1 ;
- $Modules = "foxet" ;
-}
-
# a set file (like blabla.bat) can set paths now
if ( $SetFile ne "" ) { load_set_file( $SetFile, $Verbose ); $SetFile = "" }
@@ -354,7 +339,7 @@ if ( ( $LogFile ne '' ) && ( $LogFile =~ /\w+\.log$/io ) ) {
*STDERR = *LOGFILE;
}
-my $Program = " TeXExec 5.0 - ConTeXt / PRAGMA ADE 1997-2004";
+my $Program = " TeXExec 4.3 - ConTeXt / PRAGMA ADE 1997-2004";
print "\n$Program\n\n";
@@ -652,11 +637,6 @@ if ( open( INI, $IniPath ) ) {
sub IniValue {
my ( $Key, $Default ) = @_;
if ( defined( $Done{$Key} ) ) { $Default = $Done{$Key} }
- if ($Default =~ /^(true|yes|on)$/io) {
- $Default = 1 ;
- } elsif ($Default =~ /^(false|no|off)$/io) {
- $Default = 0 ;
- }
if ($Verbose) { print " used setting : $Key = $Default\n" }
return $Default;
}
@@ -676,10 +656,10 @@ my $TeXScriptsPath = IniValue( 'TeXScriptsPath', '' );
my $TeXHashExecutable = IniValue( 'TeXHashExecutable', '' );
my $TeXExecutable = IniValue( 'TeXExecutable', 'tex' );
my $TeXVirginFlag = IniValue( 'TeXVirginFlag', '-ini' );
-my $TeXBatchFlag = IniValue( 'TeXBatchFlag', '-interaction=batchmode' );
-my $TeXNonStopFlag = IniValue( 'TeXNonStopFlag', '-interaction=nonstopmode' );
-my $MpBatchFlag = IniValue( 'MpBatchFlag', '-interaction=batchmode' );
-my $MpNonStopFlag = IniValue( 'MpNonStopFlag', '-interaction=nonstopmode' );
+my $TeXBatchFlag = IniValue( 'TeXBatchFlag', '-int=batchmode' );
+my $TeXNonStopFlag = IniValue( 'TeXNonStopFlag', '-int=nonstopmode' );
+my $MpBatchFlag = IniValue( 'MpBatchFlag', '-int=batchmode' );
+my $MpNonStopFlag = IniValue( 'MpNonStopFlag', '-int=nonstopmode' );
my $TeXPassString = IniValue( 'TeXPassString', '' );
my $TeXFormatFlag = IniValue( 'TeXFormatFlag', '' );
my $MpFormatFlag = IniValue( 'MpFormatFlag', '' );
@@ -687,14 +667,12 @@ my $MpVirginFlag = IniValue( 'MpVirginFlag', '-ini' );
my $MpPassString = IniValue( 'MpPassString', '' );
my $MpFormat = IniValue( 'MpFormat', $MetaFun );
my $MpFormatPath = IniValue( 'MpFormatPath', $TeXFormatPath );
-my $UseEnginePath = IniValue( 'UseEnginePath', $TheEnginePath);
my $FmtLanguage = IniValue( 'FmtLanguage', '' );
my $FmtBodyFont = IniValue( 'FmtBodyFont', '' );
my $FmtResponse = IniValue( 'FmtResponse', '' );
my $TcXPath = IniValue( 'TcXPath', '' );
-
$SetFile = IniValue( 'SetFile', $SetFile );
if ( ($Verbose) && ( $kpsewhich ne '' ) ) {
@@ -732,29 +710,20 @@ if ( $MpFormatFlag eq "" ) {
$MpFormatFlag = "-mem=" ;
}
-if ($UseEnginePath && (! $MakeFormats)) {
- $MpFormatFlag .= $MpExecutable . '/' ;
- $TeXFormatFlag .= $TeXExecutable . '/' ;
-}
-
#~ if ( $TeXFormatFlag eq "" ) { $TeXFormatFlag = "&" }
#~ if ( $MpFormatFlag eq "" ) { $MpFormatFlag = "&" }
-unless ( $dosish && !$escapeshell ) {
- if ( $TeXFormatFlag eq "&" ) { $TeXFormatFlag = "\\&" }
- if ( $MpFormatFlag eq "&" ) { $MpFormatFlag = "\\&" }
-}
+#~ unless ( $dosish && !$escapeshell ) {
+ #~ if ( $TeXFormatFlag eq "&" ) { $TeXFormatFlag = "\\&" }
+ #~ if ( $MpFormatFlag eq "&" ) { $MpFormatFlag = "\\&" }
+#~ }
if ($TeXProgram) { $TeXExecutable = $TeXProgram }
my $fmtutil = '';
-# for the moment forget about fmtutil, since it does not support $engine subpaths
-
-$Alone = 1 ;
-
if ( $MakeFormats || $Verbose ) {
- if ($Alone || $UseEnginePath) {
+ if ($Alone) {
if ($Verbose) { print " generating format : not using fmtutil\n" }
} elsif ( $TeXShell =~ /tetex|fptex/i ) {
foreach (@paths) {
@@ -762,7 +731,7 @@ if ( $MakeFormats || $Verbose ) {
if ( -e $p ) { $fmtutil = $p; last }
elsif ( -e $p . '.exe' ) { $fmtutil = $p . '.exe'; last }
}
- $fmtutil = ($fmtutil =~ m/^[^\"].* / ? "\"$fmtutil\"" : "$fmtutil") ;
+ $fmtutil = ($fmtutil =~ m/^[^\"].* / ? "\"$fmtutil\"" : "$fmtutil") ;
if ($Verbose) {
if ( $fmtutil eq '' ) {
print " locating fmtutil : not found in path\n";
@@ -944,14 +913,11 @@ sub print_opt {
sub show_help_options {
print # "\n" .
- " --help overview of all options and their values\n"
+ " --help overview of all options and their values\n"
. " --help all all about all options\n"
. " --help short just the main options\n"
. " --help mode ... pdf all about a few options\n"
- . " --help '*.pdf' all about options containing 'pdf'\n"
- . "\n"
- . " more info http://www.pragma-ade.com/general/manuals/mtexexec.pdf\n"
- . " http://www.ntg.nl/mailman/listinfo/ntg-context\n";
+ . " --help '*.pdf' all about options containing 'pdf'\n";
}
# determine what user wants to see
@@ -1021,10 +987,7 @@ sub RunPerlScript {
} else {
$cmd = "$ScriptName $Options";
}
- unless ( $cmd eq "" ) {
- print $cmd if ($Verbose) ;
- system($cmd) ;
- }
+ unless ( $cmd eq "" ) { system($cmd) }
}
my $FullFormat = '';
@@ -1046,7 +1009,7 @@ sub CheckOutputFormat {
if ( !$Ok ) {
print $Help{'output'};
} elsif ($FullFormat) {
- # print OPT "\\setupoutput[$FullFormat]\n";
+ print OPT "\\setupoutput[$FullFormat]\n";
}
}
unless ($FullFormat) { $FullFormat = $OutputFormat }
@@ -1057,8 +1020,6 @@ sub MakeOptionFile {
open( OPT, ">$JobName.top" );
print OPT "\% $JobName.top\n";
print OPT "\\unprotect\n";
- $ModeFile =~ s/\\/\//gio ; # do this at top of file
- $Result =~ s/\\/\//gio ; # do this at top of file
if ( $ModeFile ne '' ) { print OPT "\\readlocfile{$ModeFile}{}{}" }
if ( $Result ne '' ) { print OPT "\\setupsystem[file=$Result]\n" }
elsif ($Suffix) { print OPT "\\setupsystem[file=$JobName$Suffix]\n" }
@@ -1083,16 +1044,16 @@ sub MakeOptionFile {
}
if ($EnterBatchMode) { print OPT "\\batchmode\n" }
if ($EnterNonStopMode) { print OPT "\\nonstopmode\n" }
- if ($UseColor) { print OPT "\\setupcolors[\\c!state=\\v!start]\n" }
+ if ($UseColor) { print OPT "\\setupcolors[\\c!status=\\v!start]\n" }
if ( $NoMPMode || $NoMPRun || $AutoMPRun ) {
print OPT "\\runMPgraphicsfalse\n";
}
if ( ($FastMode) && ( !$FastDisabled ) ) { print OPT "\\fastmode\n" }
if ($SilentMode) { print OPT "\\silentmode\n" }
if ( $Separation ne "" ) {
- print OPT "\\setupcolors[\\c!split=$Separation]\n";
+ print OPT "\\setupcolors[\\c!splitsen=$Separation]\n";
}
- if ($SetupPath) { print OPT "\\setupsystem[\\c!directory=\{$SetupPath\}]\n" }
+ if ($SetupPath) { print OPT "\\setupsystem[\\c!gebied=\{$SetupPath\}]\n" }
print OPT "\\setupsystem[\\c!n=$KindOfRun]\n";
$_ = $PaperFormat;
#unless (($PdfArrange)||($PdfSelect)||($PdfCombine)||($PdfCopy))
@@ -1112,41 +1073,41 @@ sub MakeOptionFile {
{
print " background graphic : $Background\n";
print OPT "\\defineoverlay[whatever][{\\externalfigure[$Background][\\c!factor=\\v!max]}]\n";
- print OPT "\\setupbackgrounds[\\v!page][\\c!background=whatever]\n";
+ print OPT "\\setupbackgrounds[\\v!pagina][\\c!achtergrond=whatever]\n";
}
if ($CenterPage) {
print OPT
- "\\setuplayout[\\c!location=\\v!middle,\\c!marking=\\v!on]\n";
+ "\\setuplayout[\\c!plaats=\\v!midden,\\c!markering=\\v!aan]\n";
}
if ($NoMapFiles) {
print OPT "\\disablemapfiles\n";
}
- if ($NoArrange) { print OPT "\\setuparranging[\\v!disable]\n" }
+ if ($NoArrange) { print OPT "\\setuparranging[\\v!blokkeer]\n" }
elsif ( $Arrange || $PdfArrange ) {
$FinalRunNeeded = 1;
if ($FinalRun) {
my $DupStr;
if ($NoDuplex) { $DupStr = "" }
- else { $DupStr = ",\\v!doublesided" }
+ else { $DupStr = ",\\v!dubbelzijdig" }
if ( $PrintFormat eq '' ) {
- print OPT "\\setuparranging[\\v!normal]\n";
+ print OPT "\\setuparranging[\\v!normaal]\n";
} elsif ( $PrintFormat =~ /.*up/goi ) {
- print OPT "\\setuparranging[2UP,\\v!rotated$DupStr]\n";
+ print OPT "\\setuparranging[2UP,\\v!geroteerd$DupStr]\n";
} elsif ( $PrintFormat =~ /.*down/goi ) {
- print OPT "\\setuparranging[2DOWN,\\v!rotated$DupStr]\n";
+ print OPT "\\setuparranging[2DOWN,\\v!geroteerd$DupStr]\n";
} elsif ( $PrintFormat =~ /.*side/goi ) {
- print OPT "\\setuparranging[2SIDE,\\v!rotated$DupStr]\n";
+ print OPT "\\setuparranging[2SIDE,\\v!geroteerd$DupStr]\n";
} else {
print OPT "\\setuparranging[$PrintFormat]\n";
}
} else {
- print OPT "\\setuparranging[\\v!disable]\n";
+ print OPT "\\setuparranging[\\v!blokkeer]\n";
}
}
if ($Arguments) { print OPT "\\setupenv[$Arguments]\n" }
if ($Input) { print OPT "\\setupsystem[inputfile=$Input]\n" }
else { print OPT "\\setupsystem[inputfile=$JobName.$JobSuffix]\n" }
- if ($Random) { print OPT "\\setupsystem[\\c!random=$RandomSeed]\n" }
+ if ($Random) { print OPT "\\setupsystem[\\c!willekeur=$RandomSeed]\n" }
if ($Mode) { print OPT "\\enablemode[$Mode]\n" }
if ($Pages) {
if ( lc $Pages eq "odd" ) {
@@ -1209,7 +1170,7 @@ sub MakeUserFile {
if ( $MainLanguage ne 'standard' ) {
@MainLanguages = split( /\,/, $MainLanguage );
foreach (@MainLanguages) {
- print USR "\\installlanguage[\\s!$_][\\c!state=\\v!start]\n";
+ print USR "\\installlanguage[\\s!$_][\\c!status=\\v!start]\n";
}
$MainLanguage = $MainLanguages[0];
print USR "\\setupcurrentlanguage[\\s!$MainLanguage]\n";
@@ -1266,7 +1227,7 @@ sub CheckPositions { }
my $ConTeXtVersion = "unknown";
my $ConTeXtModes = '';
-sub ScanTeXPreamble {
+sub ScanPreamble {
my ($FileName) = @_;
open( TEX, $FileName );
while (<TEX>) {
@@ -1294,19 +1255,12 @@ sub ScanTeXPreamble {
}
}
close(TEX);
-
- # handy later on
-
- $ProducePdfT = ($OutputFormat eq "pdftex") ;
- $ProducePdfM = ($OutputFormat eq "dvipdfm") ;
- $ProducePdfX = ($OutputFormat eq "dvipdfmx") ;
}
sub ScanContent {
my ($ConTeXtInput) = @_;
open( TEX, $ConTeXtInput );
while (<TEX>) {
- next if (/^\%/) ;
if (
/\\(starttekst|stoptekst|startonderdeel|startdocument|startoverzicht)/
)
@@ -1349,65 +1303,9 @@ if ( $ConTeXtInterfaces{$ConTeXtInterface} ) {
my $Problems = my $Ok = 0;
-#~ sub RunTeX {
- #~ my ( $JobName, $JobSuffix ) = @_;
- #~ my $StartTime = time;
- #~ my $cmd;
- #~ my $TeXProgNameFlag = '';
- #~ if ( !$dosish ) # we assume tetex on linux
- #~ {
- #~ $TeXProgramPath = '';
- #~ $TeXFormatPath = '';
- #~ if ( !$TeXProgNameFlag
- #~ && ( $Format =~ /^cont/ )
- #~ && ( $TeXPassString !~ /progname/io ) )
- #~ {
- #~ $TeXProgNameFlag = "-progname=context";
- #~ }
- #~ }
- #~ $own_quote = ($TeXProgramPath =~ m/^[^\"].* / ? "\"" : "") ;
- #~ $cmd = join( ' ',
- #~ "$own_quote$TeXProgramPath$TeXExecutable$own_quote",
- #~ $TeXProgNameFlag, $TeXPassString, $PassOn, "" );
- #~ if ($EnterBatchMode) { $cmd .= "$TeXBatchFlag " }
- #~ if ($EnterNonStopMode) { $cmd .= "$TeXNonStopFlag " }
- #~ if ( $TeXTranslation ne '' ) { $cmd .= "-translate-file=$TeXTranslation " }
- #~ $cmd .= "$TeXFormatFlag$TeXFormatPath$Format $JobName.$JobSuffix";
- #~ if ($Verbose) { print "\n$cmd\n\n" }
- #~ if ($EnterBatchMode) {
- #~ $Problems = system("$cmd");
- #~ } else {
- #~ $Problems = system("$cmd");
- #~ }
- #~ # generate formats if needed and retry
- #~ #
- #~ # well, this used to work ok, until a engines started to use the same suffix
- #~ # and no robust check was possible any more
- #~ #
- #~ # if ($Problems) {
- #~ # my $efmt = `$kpsewhich cont-en.efmt` ;
- #~ # chomp $efmt ;
- #~ # if ($efmt eq "") {
- #~ # print "\n";
- #~ # print " emergency action : generate all formats\n";
- #~ # system("texexec --make --alone --all") ;
- #~ # print "\n";
- #~ # print " emergency action : retry processing file\n";
- #~ # if ($EnterBatchMode) {
- #~ # $Problems = system("$cmd");
- #~ # } else {
- #~ # $Problems = system("$cmd");
- #~ # }
- #~ # }
- #~ # }
- #~ my $StopTime = time - $StartTime;
- #~ print "\n return code : $Problems";
- #~ print "\n run time : $StopTime seconds\n";
- #~ return $Problems;
-#~ }
-
-sub PrepRunTeX {
- my ( $JobName, $JobSuffix, $PipeString ) = @_;
+sub RunTeX {
+ my ( $JobName, $JobSuffix ) = @_;
+ my $StartTime = time;
my $cmd;
my $TeXProgNameFlag = '';
if ( !$dosish ) # we assume tetex on linux
@@ -1428,15 +1326,8 @@ sub PrepRunTeX {
if ($EnterBatchMode) { $cmd .= "$TeXBatchFlag " }
if ($EnterNonStopMode) { $cmd .= "$TeXNonStopFlag " }
if ( $TeXTranslation ne '' ) { $cmd .= "-translate-file=$TeXTranslation " }
- $cmd .= "$TeXFormatFlag$TeXFormatPath$Format $JobName.$JobSuffix $PipeString";
+ $cmd .= "$TeXFormatFlag$TeXFormatPath$Format $JobName.$JobSuffix";
if ($Verbose) { print "\n$cmd\n\n" }
- return $cmd;
-}
-
-sub RunTeX {
- my ( $JobName, $JobSuffix ) = @_;
- my $StartTime = time;
- my $cmd = PrepRunTeX($JobName, $JobSuffix, '');
if ($EnterBatchMode) {
$Problems = system("$cmd");
} else {
@@ -1463,7 +1354,6 @@ sub RunTeX {
# }
# }
# }
-
my $StopTime = time - $StartTime;
print "\n return code : $Problems";
print "\n run time : $StopTime seconds\n";
@@ -1634,7 +1524,7 @@ my $DummyFile = 0;
sub isXMLfile {
my $Name = shift;
- if ( ($ForceXML) || ( $Name =~ /\.(xml|fo|fox)$/io ) ) { return 1 }
+ if ( ($ForceXML) || ( $Name =~ /\.xml$/io ) ) { return 1 }
else {
open( XML, $Name );
my $str = <XML>;
@@ -1645,23 +1535,9 @@ sub isXMLfile {
sub RunConTeXtFile {
my ( $JobName, $JobSuffix ) = @_;
-if ($AutoPath) {
- if ($JobName =~ /^(.*)[\/\\](.*?)$/o) {
- $InpPath = $1 ;
- $JobName = $2 ;
- }
-}
$JobName =~ s/\\/\//goi;
$InpPath =~ s/\\/\//goi;
my $OriSuffix = $JobSuffix;
-if ($JobSuffix =~ /\_fo$/i) {
- if (! -f $JobName) {
- print "stripping funny suffix : _fo\n";
- $JobName =~ s/\_fo$//io ;
- $JobSuffix =~ s/\_fo$//io ;
- $OriSuffix =~ s/\_fo$//io ;
- }
-}
if (($dosish) && ($PdfClose)) {
my $ok = system("pdfclose --file $JobName.pdf") if -e "$JobName.pdf" ;
if (($Result ne '') && (-e "$Result.pdf")) {
@@ -1670,7 +1546,7 @@ if ($JobSuffix =~ /\_fo$/i) {
system("pdfclose --all") unless $ok ;
}
if ( -e "$JobName.$JobSuffix" ) {
- $DummyFile = ( ($ForceXML) || ( $JobSuffix =~ /(xml|fo|fox)/io ) );
+ $DummyFile = ( ($ForceXML) || ( $JobSuffix =~ /xml/io ) );
}
# to be considered :
# { $DummyFile = isXMLfile("$JobName.$JobSuffix") }
@@ -1682,26 +1558,7 @@ if ($JobSuffix =~ /\_fo$/i) {
}
if ($DummyFile) {
open( TMP, ">$JobName.run" );
- if ( ( $JobSuffix =~ /(xml|fo|fox)/io ) || $ForceXML ) {
- # scan xml preamble
- open(XML,"<$JobName.$JobSuffix") ;
- while (<XML>) {
- if (/\<[a-z]+/io) {
- last ;
- } elsif (/\<\?context\-directive\s+(.+?)\s+(.+?)\s+(.+?)\s*\?\>/o) {
- my ($class, $key, $value) = ($1, $2, $3) ;
- if ($class eq 'job') {
- if ($key eq 'stylefile') {
- print TMP "\\environment $value\n" ;
- } elsif ($key eq 'module') {
- print TMP "\\usemodule[$value]\n" ;
- } elsif ($key eq 'interface') {
- $ConTeXtInterface = $value ;
- }
- }
- }
- }
- close(XML) ;
+ if ( ( $JobSuffix =~ /xml/io ) || $ForceXML ) {
if ( $Filters ne "" ) {
print " using xml filters : $Filters\n";
}
@@ -1717,8 +1574,9 @@ if ($JobSuffix =~ /\_fo$/i) {
$JobSuffix = "run";
}
if ( ( -e "$JobName.$JobSuffix" ) || ($GlobalFile) ) {
- unless ($DummyFile) { # we don't need this for xml
- ScanTeXPreamble("$JobName.$JobSuffix");
+ unless ($DummyFile) # we don't need this for xml
+ {
+ ScanPreamble("$JobName.$JobSuffix");
if ( $ConTeXtInterface eq "unknown" ) {
ScanContent("$JobName.$JobSuffix");
}
@@ -1823,11 +1681,6 @@ if ($JobSuffix =~ /\_fo$/i) {
CopyFile( "$JobName.top", "$JobName.tmp" );
unlink "$JobName.tup"; # previous tuo file
unlink "$JobName.top"; # runtime option file
- if ($ProducePdfX) {
- system("dvipdfmx -f dvipdfmx.map -d 4 $JobName") ;
- } elsif ($ProducePdfM) {
- system("dvipdfm $JobName") ;
- }
PopResult($JobName);
}
if ($Purge) { PurgeFiles($JobName) }
@@ -1867,19 +1720,15 @@ my $CombineFile = "texexec";
sub RunModule {
my @FileNames = sort @_;
- if ($FileNames[0]) {
- unless ( -e $FileNames[0] ) {
- my $Name = $FileNames[0];
- @FileNames = ( "$Name.tex", "$Name.mp", "$Name.pl", "$Name.pm" );
- }
- foreach my $FileName (@FileNames) {
- next unless -e $FileName;
- my ( $Name, $Suffix ) = split( /\./, $FileName );
- next unless $Suffix =~ /(tex|mp|pl|pm)/io;
- DoRunModule( $Name, $Suffix );
- }
- } else {
- print " module : no modules found\n\n";
+ unless ( -e $FileNames[0] ) {
+ my $Name = $FileNames[0];
+ @FileNames = ( "$Name.tex", "$Name.mp", "$Name.pl", "$Name.pm" );
+ }
+ foreach my $FileName (@FileNames) {
+ next unless -e $FileName;
+ my ( $Name, $Suffix ) = split( /\./, $FileName );
+ next unless $Suffix =~ /(tex|mp|pl|pm)/io;
+ DoRunModule( $Name, $Suffix );
}
}
@@ -1895,17 +1744,14 @@ sub DoRunModule {
open( TED, "$FileName.ted" );
my $firstline = <TED>;
close(TED);
- if ( $firstline =~ /interface=/ ) {
- print MOD $firstline ;
- } else {
- print MOD "% interface=en\n" ;
- }
+ if ( $firstline =~ /interface=en/ ) { print MOD $firstline }
+ else { print MOD "% interface=nl\n" }
# so far
print MOD "\\usemodule[abr-01,mod-01]\n";
print MOD "\\def\\ModuleNumber{1}\n";
- print MOD "\\starttext\n";
+ print MOD "\\starttekst\n";
print MOD "\\readlocfile{$FileName.ted}{}{}\n";
- print MOD "\\stoptext\n";
+ print MOD "\\stoptekst\n";
close(MOD);
RunConTeXtFile( $ModuleFile, "tex" );
@@ -2176,7 +2022,6 @@ sub RunCombine {
sub LocatedFormatPath {
my $FormatPath = shift;
- my $EnginePath = shift;
if ( ( $FormatPath eq '' ) && ( $kpsewhich ne '' ) ) {
$FormatPath = `$kpsewhich --show-path=fmt`;
chomp $FormatPath;
@@ -2192,14 +2037,6 @@ sub LocatedFormatPath {
print " located formatpath : $FormatPath\n";
}
}
-
- if ($UseEnginePath && ($FormatPath ne '' && ($FormatPath !~ /$EnginePath\/$/))) {
- $FormatPath .= $EnginePath . '/' ;
- unless (-d $FormatPath) {
- mkdir $FormatPath ;
- }
- }
-
return $FormatPath;
}
@@ -2208,7 +2045,6 @@ sub RunOneFormat {
my @TeXFormatPath;
my $TeXPrefix = "";
if ( ( $fmtutil ne "" ) && ( $FormatName !~ /metafun|mptopdf/io ) ) {
-# could not happen, not supported any more
my $cmd = "$fmtutil --byfmt $FormatName";
if ($Verbose) { print "\n$cmd\n\n" }
MakeUserFile; # this works only when the path is kept
@@ -2221,15 +2057,15 @@ sub RunOneFormat {
}
if ($Problems) {
$Problems = 0;
- if ( $TeXExecutable =~ /etex|eetex|pdfetex|pdfeetex|pdfxtex|xpdfetex|eomega|aleph|xetex/io ) {
+ if ( $TeXExecutable =~ /etex|eetex|pdfetex|pdfeetex|pdfxtex|xpdfetex|eomega|aleph/io ) {
$TeXPrefix = "*";
}
my $CurrentPath = cwd();
- my $TheTeXFormatPath = LocatedFormatPath($TeXFormatPath, $TeXExecutable);
- if ( $TheTeXFormatPath ne '' ) { chdir $TheTeXFormatPath }
+ $TeXFormatPath = LocatedFormatPath($TeXFormatPath);
+ if ( $TeXFormatPath ne '' ) { chdir $TeXFormatPath }
MakeUserFile;
MakeResponseFile;
- $own_quote = ($TeXProgramPath =~ m/^[^\"].* / ? "\"" : "") ;
+ $own_quote = ($TeXProgramPath =~ m/^[^\"].* / ? "\"" : "") ;
my $cmd =
"$own_quote$TeXProgramPath$TeXExecutable$own_quote $TeXVirginFlag "
. "$TeXPassString $PassOn ${TeXPrefix}$FormatName";
@@ -2238,7 +2074,7 @@ sub RunOneFormat {
RemoveResponseFile;
RestoreUserFile;
- if ( ( $TheTeXFormatPath ne '' ) && ( $CurrentPath ne '' ) ) {
+ if ( ( $TeXFormatPath ne '' ) && ( $CurrentPath ne '' ) ) {
chdir $CurrentPath;
}
}
@@ -2283,15 +2119,15 @@ sub RunMpFormat {
my $MpFormat = shift;
return if ( $MpFormat eq '' );
my $CurrentPath = cwd();
- my $TheMpFormatPath = LocatedFormatPath($MpFormatPath, $MpExecutable);
- if ( $TheMpFormatPath ne '' ) { chdir $TheMpFormatPath }
+ $MpFormatPath = LocatedFormatPath($MpFormatPath);
+ if ( $MpFormatPath ne '' ) { chdir "$MpFormatPath" }
$own_quote = ($MpExecutable =~ m/^[^\"].* / ? "\"" : "") ;
my $cmd =
"$own_quote$MpExecutable$own_quote $MpVirginFlag $MpPassString $MpFormat";
if ($Verbose) { print "\n$cmd\n\n" }
system($cmd ) ;
- if ( ( $TheMpFormatPath ne '' ) && ( $CurrentPath ne '' ) ) {
+ if ( ( $MpFormatPath ne '' ) && ( $CurrentPath ne '' ) ) {
chdir $CurrentPath;
}
}
@@ -2448,40 +2284,17 @@ sub checkMPgraphics { # also see makempy
sub checkMPlabels {
my $MpName = shift;
- return 0 unless ((-f "$MpName.mpt") && ((-s "$MpName.mpt")>10) );
+ return 0 unless ( -s "$MpName.mpt" > 10 );
return 0 unless open( MP, "$MpName.mpt" );
my $n = 0;
- my $t = "" ;
while (<MP>) {
- if (/% setup : (.*)/o) {
- $t = $1 ;
- } else {
- $t = "" ;
- }
- if (/% figure (\d+) : (.*)/o) {
- if ($t ne "") {
- $mpbetex{$1} .= "$t\n" ;
- $t = "" ;
- }
- $mpbetex{$1} .= "$2\n";
- ++$n ;
- }
+ if (/% figure (\d+) : (.*)/o) { $mpbetex{$1} .= "$2\n"; ++$n }
}
close(MP);
print " second MP run needed : $n tex labels found\n" if $n;
return $n;
}
-sub doMergeMP {
- # make sure that the verbatimtex ends up before btex etc
- my ($n,$str) = @_ ;
- if ($str =~ /(.*?)(verbatimtex.*?etex)\s*\;(.*)/mois) {
- return "beginfig($n)\;\n$1$2\;\n$mpbetex{$n}\n$3\;endfig\;\n" ;
- } else {
- return "beginfig($n)\;\n$mpbetex{$n}\n$str\;endfig\;\n" ;
- }
-}
-
sub doRunMP { ###########
my ( $MpName, $MergeBE ) = @_;
my $TexFound = 0;
@@ -2513,21 +2326,17 @@ sub doRunMP { ###########
s/(\".*?)\@\@\@(.*?\")/$1\;$2/gmois; # added
# merge labels
if ($MergeBE) {
- # i hate this indirect (sub regexp) mess
- s/beginfig\s*\((\d+)\)\s*\;(.*?)endfig\s*\;/doMergeMP($1,$2)/gems ;
- }
- unless (/beginfig\s*\(\s*0\s*\)/gmois) {
- if (defined($mpbetex{0})) { # test added, warning
- print MP $mpbetex{0} ;
- }
+ s/beginfig\s*\((\d+)\)\s*\;/beginfig($1)\;\n$mpbetex{$1}\n/goims;
}
+ # flush
+ unless (/beginfig\s*\(\s*0\s*\)/gmois) { print MP $mpbetex{0} }
print MP $_;
print MP "\n" . "end" . "\n";
close(MP);
}
if ($TexFound) {
print " metapost to tex : $MpName\n";
- $own_quote = ($MpToTeXExecutable =~ m/^[^\"].* / ? "\"" : "") ;
+ $own_quote = ($MpToTeXExecutable =~ m/^[^\"].* / ? "\"" : "") ;
$Problems =
system("$own_quote$MpToTeXExecutable$own_quote $MpFile > $MpTex");
if ( -e $MpTex && !$Problems ) {
@@ -2569,7 +2378,6 @@ sub doRunMP { ###########
print " error in metapost run : $MpName.mp:$1\n";
}
}
- close(MPL) ;
unlink "mptrace.tmp";
rename( $MpFile, "mptrace.tmp" );
if ( -e $MpKep ) {
@@ -2592,7 +2400,7 @@ sub RunMPX {
local $/ = "\0777";
$_ = <MP>;
close(MP);
- if (/(btex|etex|verbatimtex)/mos) {
+ if (/(btex|etex|verbatimtex)/o) {
print " generating mpx file : $MpName\n";
$own_quote = ($MpToTeXExecutable =~ m/^[^\"].* / ? "\"" : "") ;
$Problems =
@@ -2695,92 +2503,10 @@ if ( $SetFile ne "" ) { load_set_file( $SetFile, $Verbose ) }
sub check_texmf_root { }
sub check_texmf_tree { }
-#~ sub AnalyzeVersion
- #~ { my ($texengine,$type);
- #~ open (LOG, "<texvers.log") ;
- #~ while (<LOG>)
- #~ { /^\s*This is (.*pdf(|e)TeX.*?) \(format.*$/o and $texengine = $1 ;
- #~ /^\s*ConTeXt (.*int: ([a-z]+).*?)\s*$/o and $type = $1; }
- #~ $type =~ s/ int: ([a-z]+)//;
- #~ $texengine =~ s/ Version//;
- #~ close (LOG);
- #~ return ($texengine,$type) }
-
-#~ sub AnalyzeVersion
- #~ { my $str = join("\n", @_) ;
- #~ my ($texengine,$type);
- #~ if ($str =~ /^\s*This is (.*pdf(|e)TeX.*?) \(format.*$/mos) {
- #~ $texengine = $1 ;
- #~ }
- #~ if ($str =~ /^\s*ConTeXt (.*int: ([a-z]+).*?)\s*$/mos) {
- #~ $type = $1 ;
- #~ }
- #~ $type =~ s/ int: ([a-z]+)//;
- #~ $texengine =~ s/ Version//;
- #~ return ($texengine,$type) }
-
-
-sub AnalyzeVersion
- { my $str = join("\n", @_) ;
- my ($texengine,$type) = ('unknown', 'unknown');
- open (LOG, "<texvers.log") ;
- while (<LOG>)
- { /^\s*This is (.*pdf(|e)TeX.*?)$/o and $texengine = $1 ;
- /^\s*ConTeXt (.*int: ([a-z]+).*?)\s*$/o and $type = $1; }
- $type =~ s/ int: ([a-z]+)//;
- $texengine =~ s/ Version//;
- $texengine =~ s/ \(format.*$//;
- close (LOG);
- return ($texengine,$type) }
-
-sub show_version_info {
- my ($texengine,$type);
- open (TEX,">texvers.tex") ;
- print TEX "\\bye " ;
- close (TEX) ;
- my $texutil = `$TeXUtil --help`;
- $texutil =~ s/.*(TeXUtil[^\n]+)\n.*?$/$1/s;
- print " texexec :$Program\n" ;
- print " texutil : $texutil" ;
- my $contexttext = `$kpsewhich context.tex`;
- my $contextversion = "<not found>";
- if ($contexttext) {
- chop $contexttext;
- { local $/;
- open (IN,"<$contexttext");
- $contextversion = <IN>;
- close IN;
- }
- $contextversion =~ s/.*contextversion\{([0-9.]+)\}.*/$1/s;
- }
- $EnterBatchMode = 1;
- $Format = 'cont-en';
- my $cmd = PrepRunTeX("texvers","tex",'') ;
- #~ my $ok = system("$cmd");
- ($texengine,$type) = AnalyzeVersion(`$cmd`) ;
- print " tex : $texengine\n" ;
- print " context : ver: $contextversion\n" ;
- print " cont-en : $type\n" ;
- foreach my $a (qw(cz de it nl ro uk)) {
- my $test = `$kpsewhich -format='fmt' cont-$a`;
- if (defined $test && $test) {
- $Format = 'cont-' . $a;
- $cmd = PrepRunTeX("texvers","tex",'');
- #~ my $ok = system("$cmd");
- ($texengine,$type) = AnalyzeVersion(`$cmd`) ;
- print " cont-$a : $type\n" ;
- }
- }
- unlink <texvers.*>;
-}
-
# the main thing
-if ($HelpAsked) {
- show_help_info
-} elsif ($Version) {
- show_version_info
-} elsif ($TypesetListing) {
+if ($HelpAsked) { show_help_info }
+elsif ($TypesetListing) {
check_texmf_root;
check_texmf_tree;
RunListing(@ARGV);
@@ -2799,12 +2525,8 @@ if ($HelpAsked) {
} elsif ($MakeFormats) {
check_texmf_root;
check_texmf_tree;
- if ( $MpDoFormat ne '' ) {
- RunMpFormat($MpDoFormat) ;
- }
- else {
- RunFormats ;
- }
+ if ( $MpDoFormat ne '' ) { RunMpFormat($MpDoFormat) }
+ else { RunFormats }
} elsif (@ARGV) {
check_texmf_root;
check_texmf_tree;
@@ -3002,6 +2724,4 @@ alone bypass utilities (e.g. fmtutil for non-standard fmt's)
-----------
texutil force TeXUtil run
-----------
-version display various version information
------------
-setfile load environment (batch) file
+setfile load environment (batch) file \ No newline at end of file