summaryrefslogtreecommitdiff
path: root/context/perltk
diff options
context:
space:
mode:
Diffstat (limited to 'context/perltk')
-rw-r--r--context/perltk/texexec.pl46
-rw-r--r--context/perltk/texutil.pl21
2 files changed, 58 insertions, 9 deletions
diff --git a/context/perltk/texexec.pl b/context/perltk/texexec.pl
index e229601e5..e588318bf 100644
--- a/context/perltk/texexec.pl
+++ b/context/perltk/texexec.pl
@@ -134,6 +134,8 @@ my $TeXTranslation = '' ;
my $TextWidth = '0pt' ;
my $TopSpace = '0pt' ;
my $TypesetFigures = 0 ;
+my $ForceFullScreen = 0 ;
+my $ScreenSaver = 0 ;
my $TypesetListing = 0 ;
my $TypesetModule = 0 ;
my $UseColor = 0 ;
@@ -154,6 +156,10 @@ my $GlobalFile = 0 ;
my $AllPatterns = 0 ;
my $ForceXML = 0 ;
+# makempy :
+
+my $MakeMpy = '' ;
+
&GetOptions
( "arrange" => \$Arrange ,
"batch" => \$EnterBatchMode ,
@@ -179,6 +185,8 @@ my $ForceXML = 0 ;
"mode=s" => \$Mode ,
"module" => \$TypesetModule ,
"figures=s" => \$TypesetFigures ,
+ "fullscreen" => \$ForceFullScreen ,
+ "screensaver" => \$ScreenSaver ,
"listing" => \$TypesetListing ,
"mptex" => \$DoMPTeX ,
"mpxtex" => \$DoMPXTeX ,
@@ -228,6 +236,7 @@ my $ForceXML = 0 ;
"setfile=s" => \$SetFile ,
"purge" => \$Purge ,
#### yet undocumented #################
+ "makempy=s" => \$MakeMpy ,
"allpatterns" => \$AllPatterns ,
"separation=s" => \$Separation ,
"textree=s" => \$TeXTree ,
@@ -248,6 +257,11 @@ $SIG{INT} = "IGNORE" ;
if ($ARGV[0] =~ /\.mpx$/io) # catch -tex=.... bug in mpost
{ $TeXProgram = '' ; $DoMPXTeX = 1 ; $NoMPMode = 1 }
+if ($ScreenSaver)
+ { $ForceFullScreen = 1 ;
+ $TypesetFigures = 'c' ;
+ $Purge = 1 }
+
if ($DoMPTeX||$DoMPXTeX)
{ $RunOnce = 1 ;
$ProducePdfT = 0 ;
@@ -277,7 +291,8 @@ print "\n$Program\n\n" ;
if ($Verbose)
{ print " current path : " . cwd . "\n" }
-my $pathslash = '/' ; if ($0 =~ /\\/) { $pathslash = "\\" }
+## $pathslash = '/' ; if ($0 =~ /\\/) { $pathslash = "\\" }
+my $pathslash = '/' ; if ($FindBin::Bin =~ /\\/) { $pathslash = "\\" }
my $cur_path = ".$pathslash" ;
# $own_path = $0 ; $own_path =~ s/texexec(\.pl|\.bat|)//io ;
@@ -288,17 +303,18 @@ my $cur_path = ".$pathslash" ;
my $own_path = "$FindBin::Bin/" ;
my $own_type = $0 ;
+my $own_type = $FindBin::Script ;
my $own_quote = ($own_path =~ m/^[^\"].* / ? "\"" : "") ;
my $own_stub = "" ;
+if ($own_type =~ /(\.pl|perl)/oi)
+ { $own_stub = "perl " }
+
if ($own_type =~ /(\.(pl|bin|exe))$/io)
{ $own_type = $1 }
else
{ $own_type = '' }
-if ($own_type =~ /pl/oi)
- { $own_stub = "perl " }
-
sub checked_path
{ my $path = shift ;
if ((defined($path))&&($path ne ''))
@@ -1371,6 +1387,7 @@ sub RunTeX
else
{ $Problems = system ("$cmd") }
my $StopTime = time - $StartTime ;
+ print "\n return code : $Problems" ;
print "\n run time : $StopTime seconds\n" ;
return $Problems }
@@ -1385,9 +1402,8 @@ sub PushResult
if (-e "$Result.tuo")
{ unlink "$File.tuo" ;
rename "$Result.tuo", "$File.tuo" } }
-if ($Optimize)
- { unlink "$File.tuo" }
-}
+ if ($Optimize)
+ { unlink "$File.tuo" } }
sub PopResult
{ my $File = shift ; $File =~ s/\..*$//o ; $Result =~ s/\..*$//o ;
@@ -1428,7 +1444,8 @@ sub RunTeXutil
sub PurgeFiles
{ my $JobName = shift ;
print "\n purging files : $JobName\n" ;
- RunPerlScript($TeXUtil, "--purge $JobName" ) }
+ RunPerlScript($TeXUtil, "--purge $JobName" ) ;
+ unlink($Result . '.log') if (-f $Result . '.log') }
sub RunTeXMP
{ my $JobName = shift ;
@@ -1694,12 +1711,18 @@ sub RunFigures
print FIG " [topspace=1.5cm,backspace=1.5cm,\n" ;
print FIG " header=1.5cm,footer=0pt,\n" ;
print FIG " width=middle,height=middle]\n" ;
+ if ($ForceFullScreen)
+ { print FIG "\\setupinteraction\n" ;
+ print FIG " [state=start]\n" ;
+ print FIG "\\setupinteractionscreen\n" ;
+ print FIG " [option=max]\n" }
print FIG "\\starttext\n" ;
print FIG "\\showexternalfigures[alternative=$TypesetFigures,offset=$PaperOffset]\n" ;
print FIG "\\stoptext\n" ;
close(FIG) ;
$ConTeXtInterface = "en" ;
- RunConTeXtFile($FiguresFile, "tex") }
+ RunConTeXtFile($FiguresFile, "tex") ;
+ unlink ('texutil.tuf') if (-f 'texutil.tuf') }
# sub RunGetXMLFigures
# { return if (($Label eq "") or ($Base eq "") ;
@@ -2112,6 +2135,8 @@ my $mpochecksum = 0 ;
sub checkMPgraphics # also see makempy
{ my $MpName = shift ;
+ if ($MakeMpy != '')
+ { $MpName .= " --$MakeMpy " } # extra switches
if ($MpyForce)
{ $MpName .= " --force " } # dirty
else
@@ -2390,6 +2415,9 @@ figures typeset figure directory
=b just graphics
=c one (cropped) per page
paperoffset room left at paper border
+fullscreen force full screen mode (pdf)
+-----------
+screensaver turn graphic file into a (pdf) full screen file
-----------
final add a final run without skipping
-----------
diff --git a/context/perltk/texutil.pl b/context/perltk/texutil.pl
index 6609a102d..79c9979ec 100644
--- a/context/perltk/texutil.pl
+++ b/context/perltk/texutil.pl
@@ -124,6 +124,7 @@ my $dosish = ($Config{'osname'} =~ /^(ms)?dos|^os\/2|^(ms|cyg)win/i) ;
"purge" => \$PurgeFiles,
"purgeall" => \$PurgeAllFiles,
"analyze" => \$AnalyzeFile,
+ "filter" => \$FilterPages,
"help" => \$ProcessHelp,
"silent" => \$ProcessSilent,
"verbose" => \$ProcessVerbose,
@@ -2708,6 +2709,9 @@ sub PurgeFiles # no my in foreach
foreach $file (@dontaskprefixes)
{ if (-e $file)
{ RemoveContextFile($file) } }
+ foreach $file (@dontasksuffixes)
+ { if (-e $file)
+ { RemoveContextFile($file) } }
foreach $suffix (@dontasksuffixes)
{ foreach (@files)
{ if (/$suffix$/i)
@@ -2769,6 +2773,22 @@ sub AnalyzeFile
print " links : $Link ($Named named / $Script scripts / $Cross files)\n" ;
print " widgets : $Widget\n" }
+sub FilterPages # temp feature / no reporting
+ { my $filename = $ARGV[0] ;
+ return unless "$filename.pdf" || -f "$filename.pdf" ;
+ $old = '' ; $num = 0 ;
+ if (open(PDF,"<$filename.pdf") && open(TUO,">>$filename.tuo"))
+ { binmode PDF ;
+ while (<PDF>)
+ { chomp ;
+ if (($_ eq '/Type /Page') && ($old =~ /^(\d+)\s+0\s+obj/o))
+ { ++$n ; $p = $1 ;
+ print TUO "\\objectreference{PDFP}{$n}{$p}{$n}\n" }
+ else
+ { $old = $_ } }
+ close(PDF) ;
+ close(TUO) } }
+
#D We're done! All this actions and options are organized in
#D one large conditional:
@@ -2786,6 +2806,7 @@ elsif ($ProcessLogFile ) { HandleLogFile }
elsif ($PurgeFiles ) { PurgeFiles }
elsif ($PurgeAllFiles ) { PurgeFiles }
elsif ($AnalyzeFile ) { AnalyzeFile }
+elsif ($FilterPages ) { FilterPages }
elsif ($ProcessHelp ) { ShowHelpInfo } # redundant
else { ShowHelpInfo }