summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/context/perl/texexec.pl29
-rw-r--r--scripts/context/perl/texfont.pl17
-rw-r--r--scripts/context/ruby/ctxtools.rb57
-rw-r--r--scripts/context/ruby/texmfstart.rb91
4 files changed, 145 insertions, 49 deletions
diff --git a/scripts/context/perl/texexec.pl b/scripts/context/perl/texexec.pl
index daf640bbf..1ee2cc41b 100644
--- a/scripts/context/perl/texexec.pl
+++ b/scripts/context/perl/texexec.pl
@@ -81,7 +81,7 @@ my $TotalTime = time;
# if ( $RandomSeed > 1440 ) { $RandomSeed -= 1440 }
my ($sec, $min) = gmtime;
-my $RandomSeed = ($min * 60 + $sec) % 1440;
+my $RandomSeed = ($min * 60 + $sec) % 2880; # else still overflow
# See usage of $Random and $RandomSeed later on.
#
@@ -2758,37 +2758,12 @@ 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*This is (.*pdf(|e|x)TeX.*?)$/o and $texengine = $1 ;
/^\s*ConTeXt (.*int: ([a-z]+).*?)\s*$/o and $type = $1; }
$type =~ s/ int: ([a-z]+)//;
$texengine =~ s/ Version//;
diff --git a/scripts/context/perl/texfont.pl b/scripts/context/perl/texfont.pl
index 2b80a87d5..a39be0d94 100644
--- a/scripts/context/perl/texfont.pl
+++ b/scripts/context/perl/texfont.pl
@@ -8,6 +8,10 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' && eval 'exec perl -S $0 $
# todo : ttf (partially doen already)
+# added: $pattern in order to avoid fuzzy shelle expansion of
+# filenames (not consistent over perl and shells); i hate that
+# kind of out of control features.
+
#D \module
#D [ file=texfont.pl,
#D version=2004.02.06, % 2000.12.14
@@ -141,6 +145,7 @@ my $expert = 0 ;
my $trace = 0 ;
my $afmpl = 0 ;
my $trees = 'TEXMFFONTS,TEXMFLOCAL,TEXMFEXTRA,TEXMFMAIN' ;
+my $pattern = '' ;
my $fontsuffix = "" ;
my $namesuffix = "" ;
@@ -194,6 +199,7 @@ my @cleanup = () ; # atl: build list of generated files to delete
"afmpl" => \$afmpl,
"afm2pl" => \$afmpl,
"rootlist=s" => \$trees,
+ "pattern=s" => \$pattern,
"trace" => \$trace, # --verbose conflicts with --ve
"preproc" => \$preproc, # atl: trigger conversion to pfb
"lcdf" => \$lcdf ) ; # atl: trigger use of lcdf fonttoools
@@ -249,7 +255,7 @@ sub error {
# The banner.
print "\n" ;
-report ("TeXFont 2.2.0 - ConTeXt / PRAGMA ADE 2000-2004") ;
+report ("TeXFont 2.2.1 - ConTeXt / PRAGMA ADE 2000-2004") ;
print "\n" ;
# Handy for scripts: one can provide a preferred path, if it
@@ -629,7 +635,7 @@ if ($variant) { report "encoding variant : $variant" }
if ($install) { report "source path : $sourcepath" }
-my $fntlist = my $pattern = "" ;
+my $fntlist = "" ;
my $runpath = $sourcepath ;
@@ -691,9 +697,10 @@ sub globafmfiles
}
return @files }
-if ($ARGV[0])
- { $pattern = $ARGV[0] ;
- report ("processing files : all in pattern $ARGV[0]") ;
+if ($pattern eq '') { if ($ARGV[0]) { $pattern = $ARGV[0] } }
+
+if ($pattern ne '')
+ { report ("processing files : all in pattern $pattern") ;
@files = globafmfiles($runpath,$pattern) }
elsif ("$extend$narrow$slant$spaced$caps" ne "")
{ error ("transformation needs file spec") }
diff --git a/scripts/context/ruby/ctxtools.rb b/scripts/context/ruby/ctxtools.rb
index 5af38f25f..a7af031d1 100644
--- a/scripts/context/ruby/ctxtools.rb
+++ b/scripts/context/ruby/ctxtools.rb
@@ -8,6 +8,8 @@
# This script will harbor some handy manipulations on context
# related files.
+# todo: move scite here
+
banner = ['CtxTools', 'version 1.0', '2004', 'PRAGMA ADE/POD']
unless defined? ownpath
@@ -98,9 +100,61 @@ class Commands
end
+ def jeditinterface
+
+ return unless FileTest.file?("cont-en.xml")
+
+ interfaces = @commandline.arguments
+
+ if interfaces.empty? then
+ interfaces = ['en', 'cz','de','it','nl','ro']
+ end
+
+ interfaces.each do |interface|
+ begin
+ collection = Hash.new
+ mappings = Hash.new
+ if f = open("keys-#{interface}.xml") then
+ while str = f.gets do
+ if str =~ /\<cd\:command\s+name=\"(.*?)\"\s+value=\"(.*?)\".*?\>/o then
+ mappings[$1] = $2
+ end
+ end
+ f.close
+ if f = open("cont-en.xml") then
+ while str = f.gets do
+ if str =~ /\<cd\:command\s+name=\"(.*?)\"\s+type=\"environment\".*?\>/o then
+ collection["start#{mappings[$1]}"] = ''
+ collection["stop#{mappings[$1]}"] = ''
+ elsif str =~ /\<cd\:command\s+name=\"(.*?)\".*?\>/o then
+ collection["#{mappings[$1]}"] = ''
+ end
+ end
+ f.close
+ if f = open("context-jedit-#{interface}.xml", 'w') then
+ f.puts("<?xml version='1.0'?>\n\n")
+ f.puts("<!DOCTYPE MODE SYSTEM 'xmode.dtd'>\n\n")
+ f.puts("<MODE>\n")
+ f.puts(" <RULES>\n")
+ f.puts(" <KEYWORDS>\n")
+ collection.keys.sort.each do |name|
+ f.puts(" <KEYWORD2>\\#{name}</KEYWORD2>\n") unless name.empty?
+ end
+ f.puts(" </KEYWORDS>\n")
+ f.puts(" </RULES>\n")
+ f.puts("</MODE>\n")
+ f.close
+ end
+ end
+ end
+ end
+ end
+
+ end
+
def translateinterface
- # since we know what kind of file we're dealign with,
+ # since we know what kind of file we're dealing with,
# we do it quick and dirty instead of using rexml or
# xslt
@@ -200,6 +254,7 @@ commandline = CommandLine.new
commandline.registeraction('touchcontextfile', '')
commandline.registeraction('translateinterface', '')
+commandline.registeraction('jeditinterface', '')
commandline.registeraction('help')
commandline.registeraction('version')
diff --git a/scripts/context/ruby/texmfstart.rb b/scripts/context/ruby/texmfstart.rb
index bdf2aa212..74d9e3d24 100644
--- a/scripts/context/ruby/texmfstart.rb
+++ b/scripts/context/ruby/texmfstart.rb
@@ -2,7 +2,7 @@
# program : texmfstart
# copyright : PRAGMA Advanced Document Engineering
-# version : 1.04 - 2003/2004
+# version : 1.05 - 2003/2004
# author : Hans Hagen
#
# project : ConTeXt / eXaMpLe
@@ -20,10 +20,15 @@
# turning this into a service would be nice, so some day ...
+# --locate => provides location
+# --exec => exec instead of system
+# --iftouched=a,b => only if timestamp a<>b
+
require "rbconfig"
$mswindows = Config::CONFIG['host_os'] =~ /mswin/
$separator = File::PATH_SEPARATOR
+$version = "1.05"
if $mswindows then
@@ -83,6 +88,27 @@ else
end
+
+class File
+
+ def File.needsupdate(oldname,newname)
+ begin
+ return File.stat(oldname).mtime != File.stat(newname).mtime
+ rescue
+ return true
+ end
+ end
+
+ def File.syncmtimes(oldname,newname)
+ begin
+ t = File.mtime(oldname) # i'm not sure if the time is frozen, so we do it here
+ File.utime(0,t,newname)
+ rescue
+ end
+ end
+
+end
+
$applications = Hash.new
$suffixinputs = Hash.new
$predefined = Hash.new
@@ -99,9 +125,11 @@ $predefined['texfont'] = 'texfont.pl'
$predefined['examplex'] = 'examplex.rb'
$predefined['concheck'] = 'concheck.rb'
$predefined['textools'] = 'textools.rb'
+$predefined['ctxtools'] = 'ctxtools.rb'
$predefined['pdftools'] = 'pdftools.rb'
$predefined['exatools'] = 'exatools.rb'
$predefined['xmltools'] = 'xmltools.rb'
+$predefined['pstopdf'] = 'pstopdf.rb'
$scriptlist = 'rb|pl|py|jar'
$documentlist = 'pdf|ps|eps|htm|html'
@@ -163,7 +191,9 @@ def expanded(arg)
end
def runcommand(command)
- if $execute then
+ if $locate then
+ print(command)
+ elsif $execute then
report("using 'exec' instead of 'system' call") if $verbose
exec(command)
else
@@ -213,15 +243,17 @@ def report(str)
end
def usage
- print "version : 1.05 - 2003/2004 - www.pragma-ade.com\n"
+ print "version : #{$version} - 2003/2004 - www.pragma-ade.com\n"
print("\n")
print("usage : texmfstart [switches] filename [optional arguments]\n")
print("\n")
- print("switches : --verbose --report --browser --direct --execute\n")
+ print("switches : --verbose --report --browser --direct --execute --locate\n")
print(" --program --file --page --arguments\n")
print(" --make --lmake --wmake\n")
print("\n")
print("example : texmfstart pstopdf.rb cow.eps\n")
+ print(" texmfstart --locate examplex.rb\n")
+ print(" texmfstart --execute examplex.rb\n")
print(" texmfstart --browser examplap.pdf\n")
print(" texmfstart showcase.pdf\n")
print(" texmfstart --page=2 --file=showcase.pdf\n")
@@ -496,6 +528,7 @@ $report = $directives['report'] || false
$verbose = $directives['verbose'] || false
$arguments = $directives['arguments'] || ''
$execute = $directives['execute'] || $directives['exec'] || false
+$locate = $directives['locate'] || false
$make = $directives['make'] || false
$unix = $directives['unix'] || false
@@ -503,6 +536,8 @@ $windows = $directives['windows'] || false
$stubpath = $directives['stubpath'] || ''
$indirect = $directives['indirect'] || false
+$iftouched = $directives['iftouched'] || false
+
$applications['unknown'] = ''
$applications['perl'] = $applications['pl'] = 'perl'
$applications['ruby'] = $applications['rb'] = 'ruby'
@@ -522,20 +557,44 @@ end
$applications['htm'] = $applications['html']
$applications['eps'] = $applications['ps']
+def process(&block)
+
+ if $iftouched then
+ files = $directives['iftouched'].split(',')
+ oldname, newname = files[0], files[1]
+ if oldname && newname && File.needsupdate(oldname,newname) then
+ yield
+ File.syncmtimes(oldname,newname)
+ end
+ else
+ yield
+ end
+
+end
+
+# system("perl -V")
+
if $help || ! $filename || $filename.empty? then
usage
-elsif $make then
- if $windows then
- make($filename,true,false)
- elsif $unix then
- make($filename,false,true)
+else
+ report("texmfstart version #{$version}") if $verbose
+ if $make then
+ if $windows then
+ make($filename,true,false)
+ elsif $unix then
+ make($filename,false,true)
+ else
+ make($filename,$mswindows,!$mswindows)
+ end
+ elsif $browser && $filename =~ /^http\:\/\// then
+ launch($filename)
else
- make($filename,$mswindows,!$mswindows)
+ process do
+ if $direct || $filename =~ /^bin\:/ then
+ direct($filename)
+ else
+ run(find(shortpathname($filename),$program))
+ end
+ end
end
-elsif $browser && $filename =~ /^http\:\/\// then
- launch($filename)
-elsif $direct || $filename =~ /^bin\:/ then
- direct($filename)
-else
- run(find(shortpathname($filename),$program))
end