summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2005-07-27 00:00:00 +0200
committerHans Hagen <pragma@wxs.nl>2005-07-27 00:00:00 +0200
commitc2162354d613eee96e411440beaabfabcacca582 (patch)
tree11ccf61e2738c2b6d8481b2c5b03f93f3644f449 /scripts
parent695613d847705c7c7f4f308722e8c2a67099d944 (diff)
downloadcontext-c2162354d613eee96e411440beaabfabcacca582.tar.gz
stable 2005.07.27
Diffstat (limited to 'scripts')
-rw-r--r--scripts/context/perl/texexec.pl111
-rw-r--r--scripts/context/ruby/base/kpse.rb2
-rw-r--r--scripts/context/ruby/base/pdf.rb2
-rw-r--r--scripts/context/ruby/ctxtools.rb1
-rw-r--r--scripts/context/ruby/newtexexec.rb2
-rw-r--r--scripts/context/ruby/texmfstart.rb4
6 files changed, 87 insertions, 35 deletions
diff --git a/scripts/context/perl/texexec.pl b/scripts/context/perl/texexec.pl
index 9a8f2bff0..6335e6900 100644
--- a/scripts/context/perl/texexec.pl
+++ b/scripts/context/perl/texexec.pl
@@ -51,6 +51,7 @@ use Class::Struct; # needed for help subsystem
use FindBin;
use File::Compare;
use File::Temp;
+use Digest::MD5;
#~ use IO::Handle; autoflush STDOUT 1;
@@ -428,7 +429,7 @@ if ( ( $LogFile ne '' ) && ( $LogFile =~ /\w+\.log$/io ) ) {
*STDERR = *LOGFILE;
}
-my $Program = " TeXExec 5.4.2 - ConTeXt / PRAGMA ADE 1997-2005";
+my $Program = " TeXExec 5.4.3 - ConTeXt / PRAGMA ADE 1997-2005";
print "\n$Program\n\n";
@@ -1641,42 +1642,69 @@ sub CopyFile { # agressive copy, works for open files like in gs
close(OUT);
}
+#~ sub CheckMPChanges {
+ #~ my $JobName = shift;
+ #~ my $checksum = 0;
+ #~ my $MPJobName = MPJobName( $JobName, "mpgraph" );
+ #~ if ( open( MP, $MPJobName ) ) {
+ #~ while (<MP>) {
+ #~ unless (/random/oi) {
+ #~ $checksum += do { unpack( "%32C*", <MP> ) % 65535 }
+ #~ }
+ #~ }
+ #~ close(MP);
+ #~ }
+ #~ $MPJobName = MPJobName( $JobName, "mprun" );
+ #~ if ( open( MP, $MPJobName ) ) {
+ #~ while (<MP>) {
+ #~ unless (/random/oi) {
+ #~ $checksum += do { unpack( "%32C*", <MP> ) % 65535 }
+ #~ }
+ #~ }
+ #~ close(MP);
+ #~ }
+ #~ print " mpgraph/mprun : $checksum\n";
+ #~ return $checksum;
+#~ }
+
sub CheckMPChanges {
- my $JobName = shift;
- my $checksum = 0;
+ my $JobName = shift; my $str = '' ;
my $MPJobName = MPJobName( $JobName, "mpgraph" );
if ( open( MP, $MPJobName ) ) {
- while (<MP>) {
- unless (/random/oi) {
- $checksum += do { unpack( "%32C*", <MP> ) % 65535 }
- }
- }
- close(MP);
+ $str .= do { local $/ ; <MP> ; } ;
+ close(MP) ;
}
$MPJobName = MPJobName( $JobName, "mprun" );
if ( open( MP, $MPJobName ) ) {
- while (<MP>) {
- unless (/random/oi) {
- $checksum += do { unpack( "%32C*", <MP> ) % 65535 }
- }
- }
- close(MP);
+ $str .= do { local $/ ; <MP> ; } ;
+ close(MP) ;
}
- return $checksum;
+ $str =~ s/^.*?random.*?$//oim ;
+ return Digest::MD5::md5_hex($str) ;
}
+#~ sub CheckTubChanges {
+ #~ my $JobName = shift;
+ #~ my $checksum = 0;
+ #~ if ( open( TUB, "$JobName.tub" ) ) {
+ #~ while (<TUB>) {
+ #~ $checksum += do { unpack( "%32C*", <TUB> ) % 65535 }
+ #~ }
+ #~ close(TUB);
+ #~ }
+ #~ return $checksum;
+#~ }
+
sub CheckTubChanges {
- my $JobName = shift;
- my $checksum = 0;
+ my $JobName = shift; my $str = '' ;
if ( open( TUB, "$JobName.tub" ) ) {
- while (<TUB>) {
- $checksum += do { unpack( "%32C*", <TUB> ) % 65535 }
- }
+ $str = do { local $/ ; <TUB> ; } ;
close(TUB);
}
- return $checksum;
+ return Digest::MD5::md5_hex($str);
}
+
my $DummyFile = 0;
sub isXMLfile {
@@ -1839,8 +1867,8 @@ sub RunConTeXtFile {
MakeOptionFile( 0, 0, $JobName, $OriSuffix, 2 );
}
print " TeX run : $TeXRuns\n\n";
- my ( $mpchecksumbefore, $mpchecksumafter ) = ( 0, 0 );
- my ( $tubchecksumbefore, $tubchecksumafter ) = ( 0, 0 );
+ my ( $mpchecksumbefore, $mpchecksumafter ) = ( '', '' );
+ my ( $tubchecksumbefore, $tubchecksumafter ) = ( '', '' );
if ($AutoMPRun) { $mpchecksumbefore = CheckMPChanges($JobName) }
$tubchecksumbefore = CheckTubChanges($JobName) ;
$Problems = RunTeX( $JobName, $JobSuffix );
@@ -1855,11 +1883,11 @@ sub RunConTeXtFile {
if ($AutoMPRun) {
$StopRunning =
( $StopRunning
- && ( $mpchecksumafter == $mpchecksumbefore ) );
+ && ( $mpchecksumafter eq $mpchecksumbefore ) );
}
$StopRunning =
( $StopRunning
- && ( $tubchecksumafter == $tubchecksumbefore ) );
+ && ( $tubchecksumafter eq $tubchecksumbefore ) );
}
}
if ( ( $NOfRuns == 1 ) && $ForceTeXutil ) {
@@ -2669,7 +2697,30 @@ sub RunMP { ###########
}
}
-my $mpochecksum = 0;
+my $mpochecksum = '';
+
+#~ sub checkMPgraphics { # also see makempy
+ #~ my $MpName = shift;
+ #~ if ( $MakeMpy ne '' ) { $MpName .= " --$MakeMpy " } # extra switches
+ #~ if ($MpyForce) { $MpName .= " --force " } # dirty
+ #~ else {
+ #~ return 0 unless -s "$MpName.mpo" > 32;
+ #~ return 0 unless ( open( MPO, "$MpName.mpo" ) );
+ #~ $mpochecksum = do { local $/; unpack( "%32C*", <MPO> ) % 65535 };
+ #~ close(MPO);
+ #~ if ( open( MPY, "$MpName.mpy" ) ) {
+ #~ my $str = <MPY>;
+ #~ chomp $str;
+ #~ close(MPY);
+ #~ if ( $str =~ /^\%\s*mpochecksum\s*\:\s*(\d+)/o ) {
+ #~ return 0 if ( ( $mpochecksum eq $1 ) && ( $mpochecksum ne 0 ) );
+ #~ }
+ #~ }
+ #~ }
+ #~ RunPerlScript( "makempy", "$MpName" );
+ #~ print " second MP run needed : text graphics found\n";
+ #~ return 1;
+#~ }
sub checkMPgraphics { # also see makempy
my $MpName = shift;
@@ -2678,14 +2729,14 @@ sub checkMPgraphics { # also see makempy
else {
return 0 unless -s "$MpName.mpo" > 32;
return 0 unless ( open( MPO, "$MpName.mpo" ) );
- $mpochecksum = do { local $/; unpack( "%32C*", <MPO> ) % 65535 };
+ $mpochecksum = do { local $/; Digest::MD5::md5_hex(<MPO>) ; };
close(MPO);
if ( open( MPY, "$MpName.mpy" ) ) {
my $str = <MPY>;
chomp $str;
close(MPY);
- if ( $str =~ /^\%\s*mpochecksum\s*\:\s*(\d+)/o ) {
- return 0 if ( ( $mpochecksum eq $1 ) && ( $mpochecksum ne 0 ) );
+ if ( $str =~ /^\%\s*mpochecksum\s*\:\s*([a-fA-F0-9]+)/o ) {
+ return 0 if ( ( $mpochecksum eq $1 ) && ( $mpochecksum ne '' ) );
}
}
}
diff --git a/scripts/context/ruby/base/kpse.rb b/scripts/context/ruby/base/kpse.rb
index bfd2baa30..3c3cc21df 100644
--- a/scripts/context/ruby/base/kpse.rb
+++ b/scripts/context/ruby/base/kpse.rb
@@ -198,6 +198,8 @@ module Kpse
end
end
end
+ # needed !
+ begin File.makedirs(formatpath) ; rescue ; end ;
# fall back to current path
formatpath = '.' if formatpath.empty? || ! FileTest.writable?(formatpath)
# append engine but prevent duplicates
diff --git a/scripts/context/ruby/base/pdf.rb b/scripts/context/ruby/base/pdf.rb
index 49d177b5d..d8cbf9e05 100644
--- a/scripts/context/ruby/base/pdf.rb
+++ b/scripts/context/ruby/base/pdf.rb
@@ -45,8 +45,6 @@ module PDFview
end
-puts ('' || false)
-
# PDFview.open("t:/document/show-exa.pdf")
# PDFview.open("t:/document/show-gra.pdf")
# PDFview.close("t:/document/show-exa.pdf")
diff --git a/scripts/context/ruby/ctxtools.rb b/scripts/context/ruby/ctxtools.rb
index d55f27065..10cff23cf 100644
--- a/scripts/context/ruby/ctxtools.rb
+++ b/scripts/context/ruby/ctxtools.rb
@@ -17,7 +17,6 @@
#
# todo: move kpse call to kpse class/module
-
banner = ['CtxTools', 'version 1.2.2', '2004/2005', 'PRAGMA ADE/POD']
unless defined? ownpath
diff --git a/scripts/context/ruby/newtexexec.rb b/scripts/context/ruby/newtexexec.rb
index 9d9c880bd..9f0084efe 100644
--- a/scripts/context/ruby/newtexexec.rb
+++ b/scripts/context/ruby/newtexexec.rb
@@ -16,7 +16,7 @@ require 'base/texutil'
require 'ftools' # needed ?
require 'base/kpse' # needed ?
-require 'base/pdf' # needed ?
+# require 'base/pdf' # needed ?
require 'base/state' # needed ?
require 'base/file' # needed ?
diff --git a/scripts/context/ruby/texmfstart.rb b/scripts/context/ruby/texmfstart.rb
index fabcee2f9..083e7532b 100644
--- a/scripts/context/ruby/texmfstart.rb
+++ b/scripts/context/ruby/texmfstart.rb
@@ -57,6 +57,7 @@ $predefined = Hash.new
$suffixinputs['pl'] = 'PERLINPUTS'
$suffixinputs['rb'] = 'RUBYINPUTS'
$suffixinputs['py'] = 'PYTHONINPUTS'
+$suffixinputs['lua'] = 'LUAINPUTS'
$suffixinputs['jar'] = 'JAVAINPUTS'
$suffixinputs['pdf'] = 'PDFINPUTS'
@@ -80,7 +81,7 @@ if ENV['TEXMFSTART_MODE'] = 'experimental' then
$predefined['pstopdf'] = 'newpstopdf.rb'
end
-$scriptlist = 'rb|pl|py|jar'
+$scriptlist = 'rb|pl|py|lua|jar'
$documentlist = 'pdf|ps|eps|htm|html'
$editor = ENV['EDITOR'] || ENV['editor'] || 'scite'
@@ -91,6 +92,7 @@ $applications['unknown'] = ''
$applications['perl'] = $applications['pl'] = 'perl'
$applications['ruby'] = $applications['rb'] = 'ruby'
$applications['python'] = $applications['py'] = 'python'
+$applications['lua'] = $applications['lua'] = 'lua'
$applications['java'] = $applications['jar'] = 'java'
if $mswindows then