From 599c5089a184d1967ec8dc66307de52378e911d4 Mon Sep 17 00:00:00 2001 From: Hans Hagen Date: Mon, 12 Jul 2004 00:00:00 +0200 Subject: stable 2004.07.12 --- scripts/context/perl/mptopdf.pl | 80 +++++++++++++++++++------------------- scripts/context/perl/texexec.pl | 24 ++++++++---- scripts/context/ruby/texmfstart.rb | 2 +- 3 files changed, 57 insertions(+), 49 deletions(-) (limited to 'scripts') diff --git a/scripts/context/perl/mptopdf.pl b/scripts/context/perl/mptopdf.pl index 337869519..026d8d80b 100644 --- a/scripts/context/perl/mptopdf.pl +++ b/scripts/context/perl/mptopdf.pl @@ -1,7 +1,7 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' && eval 'exec perl -S $0 $argv:q' if 0; -# MikTeX users can set environment variable TEXSYSTEM to "miktex". +# MikTeX users can set environment variable TEXSYSTEM to "miktex". #D \module #D [ file=mptopdf.pl, @@ -17,24 +17,24 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' && eval 'exec perl -S $0 $ #C therefore copyrighted by \PRAGMA. See licen-en.pdf for #C details. -# use File::Copy ; # not in every perl +# use File::Copy ; # not in every perl use Config ; use Getopt::Long ; -use strict ; +use strict ; $Getopt::Long::passthrough = 1 ; # no error message $Getopt::Long::autoabbrev = 1 ; # partial switch accepted -my $Help = my $Latex = my $RawMP = 0 ; -my $PassOn = '' ; +my $Help = my $Latex = my $RawMP = 0 ; +my $PassOn = '' ; &GetOptions ( "help" => \$Help , - "rawmp" => \$RawMP, + "rawmp" => \$RawMP, "passon" => \$PassOn, "latex" => \$Latex ) ; - + my $program = "MPtoPDF 1.2" ; my $pattern = $ARGV[0] ; my $done = 0 ; @@ -44,41 +44,41 @@ my $latexswitch = " --tex=latex --format=latex " ; ## $dosish = ($Config{'osname'} =~ /dos|mswin/i) ; my $dosish = ($Config{'osname'} =~ /^(ms)?dos|^os\/2|^(ms|cyg)win/i) ; -my $miktex = ($ENV{"TEXSYSTEM"} =~ /miktex/io); +my $miktex = ($ENV{"TEXSYSTEM"} =~ /miktex/io); -my @files ; -my $command = my $mpbin = '' ; +my @files ; +my $command = my $mpbin = '' ; -sub CopyFile # agressive copy, works for open files like in gs - { my ($From,$To) = @_ ; - return unless open(INP,"<$From") ; binmode INP ; - return unless open(OUT,">$To") ; binmode OUT ; - while () { print OUT $_ } - close (INP) ; +sub CopyFile # agressive copy, works for open files like in gs + { my ($From,$To) = @_ ; + return unless open(INP,"<$From") ; binmode INP ; + return unless open(OUT,">$To") ; binmode OUT ; + while () { print OUT $_ } + close (INP) ; close (OUT) } if (($pattern eq '')||($Help)) { print "\n$program : provide MP output file (or pattern)\n" ; exit } -elsif ($pattern =~ /\.mp$/io) - { shift @ARGV ; my $rest = join(" ", @ARGV) ; +elsif ($pattern =~ /\.mp$/io) + { shift @ARGV ; my $rest = join(" ", @ARGV) ; if (open(INP,$pattern)) - { while () - { if (/(documentstyle|documentclass|begin\{document\})/io) - { $Latex = 1 ; last } } - close (INP) } - if ($Latex) - { $rest .= " $latexswitch" } + { while () + { if (/(documentstyle|documentclass|begin\{document\})/io) + { $Latex = 1 ; last } } + close (INP) } + if ($Latex) + { $rest .= " $latexswitch" } if ($RawMP) - { $mpbin = 'mpost' } + { $mpbin = 'mpost' } else - { $mpbin = 'texexec --mptex $PassOn' } + { $mpbin = 'texexec --mptex $PassOn' } my $error = system ("$mpbin $rest $pattern") ; - if ($error) - { print "\n$program : error while processing mp file\n" ; exit } - else - { $pattern =~ s/\.mp$//io ; - @files = glob "$pattern.*" } } + if ($error) + { print "\n$program : error while processing mp file\n" ; exit } + else + { $pattern =~ s/\.mp$//io ; + @files = glob "$pattern.*" } } elsif (-e $pattern) { @files = ($pattern) } elsif ($pattern =~ /.\../o) @@ -90,15 +90,15 @@ else foreach my $file (@files) { $_ = $file ; if (s/\.(\d+|mps)$// && -e $file) - { if ($miktex) - { if ($dosish) - { $command = "pdfetex &mptopdf" } + { if ($miktex) + { if ($dosish) + { $command = "pdfetex &mptopdf" } else { $command = "pdfetex \\&mptopdf" } } - else -# { $command = "pdfetex -progname=pdfetex -efmt=mptopdf" } - { $command = "pdfetex -progname=context -efmt=mptopdf" } - if ($dosish) + else +# { $command = "pdfetex -progname=pdfetex -efmt=mptopdf" } + { $command = "pdfetex -progname=context \&mptopdf" } + if ($dosish) { system ("$command \\relax $file") } else { system ("$command \\\\relax $file") } @@ -108,8 +108,8 @@ foreach my $file (@files) $report .= " $_-$1.pdf" ; ++$done } } -if ($report eq '') - { $report = '*' } +if ($report eq '') + { $report = '*' } if ($done) { print "\n$program : $pattern is converted to$report\n" } diff --git a/scripts/context/perl/texexec.pl b/scripts/context/perl/texexec.pl index a68135ded..eb1664357 100644 --- a/scripts/context/perl/texexec.pl +++ b/scripts/context/perl/texexec.pl @@ -182,7 +182,8 @@ my $AllPatterns = 0; my $ForceXML = 0; my $Random = 0; my $Filters = ''; -my $NoMapFiles = 0; +my $NoMapFiles = 0 ; +my $Foxet = 0 ; my $StartLine = 0 ; my $StartColumn = 0 ; @@ -283,6 +284,7 @@ my $MakeMpy = ''; "modefile=s" => \$ModeFile, # additional modes file "globalfile" => \$GlobalFile, "nomapfiles" => \$NoMapFiles, + "foxet" => \$Foxet, #### exxperiment "startline=s" => \$StartLine, "startcolumn=s" => \$StartColumn, @@ -290,6 +292,12 @@ 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 = "" } @@ -713,10 +721,10 @@ if ( $MpFormatFlag eq "" ) { #~ 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 } @@ -1527,7 +1535,7 @@ my $DummyFile = 0; sub isXMLfile { my $Name = shift; - if ( ($ForceXML) || ( $Name =~ /\.(xml|fo)$/io ) ) { return 1 } + if ( ($ForceXML) || ( $Name =~ /\.(xml|fo|fox)$/io ) ) { return 1 } else { open( XML, $Name ); my $str = ; @@ -1549,7 +1557,7 @@ sub RunConTeXtFile { system("pdfclose --all") unless $ok ; } if ( -e "$JobName.$JobSuffix" ) { - $DummyFile = ( ($ForceXML) || ( $JobSuffix =~ /(xml|fo)/io ) ); + $DummyFile = ( ($ForceXML) || ( $JobSuffix =~ /(xml|fo|fox)/io ) ); } # to be considered : # { $DummyFile = isXMLfile("$JobName.$JobSuffix") } @@ -1561,7 +1569,7 @@ sub RunConTeXtFile { } if ($DummyFile) { open( TMP, ">$JobName.run" ); - if ( ( $JobSuffix =~ /(xml|fo)/io ) || $ForceXML ) { + if ( ( $JobSuffix =~ /(xml|fo|fox)/io ) || $ForceXML ) { if ( $Filters ne "" ) { print " using xml filters : $Filters\n"; } diff --git a/scripts/context/ruby/texmfstart.rb b/scripts/context/ruby/texmfstart.rb index c1577679c..8d5175325 100644 --- a/scripts/context/ruby/texmfstart.rb +++ b/scripts/context/ruby/texmfstart.rb @@ -286,7 +286,7 @@ def find(filename,program) if suffix =~ /(#{$scriptlist})/ then begin report("using 'kpsewhich' to locate '#{filename}' in suffix space '#{suffix}' (1)") - fullname = `kpsewhich -progname=#{program} -format=scripts #{filename}.#{suffix}`.chomp + fullname = `kpsewhich -progname=#{program} -format=texmfscripts #{filename}.#{suffix}`.chomp rescue report("kpsewhich cannot locate '#{filename}' in suffix space '#{suffix}' (1)") fullname = nil -- cgit v1.2.3