summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/scripts
diff options
context:
space:
mode:
authorTaco Hoekwater <taco@elvenkind.com>2007-01-12 11:44:15 +0000
committerTaco Hoekwater <taco@elvenkind.com>2007-01-12 11:44:15 +0000
commit8cddf99e60bab275eabf8bf5a839b92acc21c51b (patch)
tree1f37486c6587127b60eac2e35c268d0aa38b22fe /Master/texmf-dist/scripts
parent1a82330969add4f649f154bc3fe175bbdf2df7fe (diff)
for context 20070112
git-svn-id: svn://tug.org/texlive/trunk@3378 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/scripts')
-rw-r--r--Master/texmf-dist/scripts/context/ruby/base/ctx.rb69
-rw-r--r--Master/texmf-dist/scripts/context/ruby/base/kpse.rb2
-rw-r--r--Master/texmf-dist/scripts/context/ruby/base/kpsefast.rb4
-rw-r--r--Master/texmf-dist/scripts/context/ruby/base/switch.rb19
-rw-r--r--Master/texmf-dist/scripts/context/ruby/base/tex.rb169
-rw-r--r--Master/texmf-dist/scripts/context/ruby/ctxtools.rb23
-rw-r--r--Master/texmf-dist/scripts/context/ruby/graphics/gs.rb83
-rw-r--r--Master/texmf-dist/scripts/context/ruby/pdftools.rb35
-rw-r--r--Master/texmf-dist/scripts/context/ruby/rlxtools.rb5
-rw-r--r--Master/texmf-dist/scripts/context/ruby/texexec.rb88
-rw-r--r--Master/texmf-dist/scripts/context/ruby/texmfstart.rb35
11 files changed, 344 insertions, 188 deletions
diff --git a/Master/texmf-dist/scripts/context/ruby/base/ctx.rb b/Master/texmf-dist/scripts/context/ruby/base/ctx.rb
index 4ee2715b88a..f86e92d18c0 100644
--- a/Master/texmf-dist/scripts/context/ruby/base/ctx.rb
+++ b/Master/texmf-dist/scripts/context/ruby/base/ctx.rb
@@ -43,6 +43,7 @@ class CtxRunner
@modules = Array.new
@filters = Array.new
@flags = Array.new
+ @local = false
end
def manipulate(ctxname=nil,defaultname=nil)
@@ -117,18 +118,18 @@ class CtxRunner
variables['job'] = @jobname
end
root = @xmldata.root
-REXML::XPath.each(root,"/ctx:job//ctx:flags/ctx:flag") do |flg|
- @flags << justtext(flg)
-end
-REXML::XPath.each(root,"/ctx:job//ctx:resources/ctx:environment") do |sty|
- @environments << justtext(sty)
-end
-REXML::XPath.each(root,"/ctx:job//ctx:resources/ctx:module") do |mod|
- @modules << justtext(mod)
-end
-REXML::XPath.each(root,"/ctx:job//ctx:resources/ctx:filter") do |fil|
- @filters << justtext(fil)
-end
+ REXML::XPath.each(root,"/ctx:job//ctx:flags/ctx:flag") do |flg|
+ @flags << justtext(flg)
+ end
+ REXML::XPath.each(root,"/ctx:job//ctx:resources/ctx:environment") do |sty|
+ @environments << justtext(sty)
+ end
+ REXML::XPath.each(root,"/ctx:job//ctx:resources/ctx:module") do |mod|
+ @modules << justtext(mod)
+ end
+ REXML::XPath.each(root,"/ctx:job//ctx:resources/ctx:filter") do |fil|
+ @filters << justtext(fil)
+ end
begin
REXML::XPath.each(root,"//ctx:block") do |blk|
if @jobname && blk.attributes['pattern'] then
@@ -154,9 +155,9 @@ end
REXML::XPath.each(root,"/ctx:job//ctx:process/ctx:resources/ctx:filter") do |fil|
@filters << justtext(fil)
end
-REXML::XPath.each(root,"/ctx:job//ctx:process/ctx:flags/ctx:flag") do |flg|
- @flags << justtext(flg)
-end
+ REXML::XPath.each(root,"/ctx:job//ctx:process/ctx:flags/ctx:flag") do |flg|
+ @flags << justtext(flg)
+ end
commands = Hash.new
REXML::XPath.each(root,"/ctx:job//ctx:preprocess/ctx:processors/ctx:processor") do |pre|
begin
@@ -172,6 +173,11 @@ end
else
if suffix && suffix.empty? then suffix = @@suffix end
end
+ if (REXML::XPath.first(root,"/ctx:job//ctx:preprocess/ctx:processors/@local").to_s =~ /(yes|true)/io rescue false) then
+ @local = true
+ else
+ @local = false
+ end
REXML::XPath.each(root,"/ctx:job//ctx:preprocess/ctx:files") do |files|
REXML::XPath.each(files,"ctx:file") do |pattern|
preprocessor = pattern.attributes['processor']
@@ -189,9 +195,14 @@ end
return
end
pattern = justtext(pattern)
- Dir.glob(pattern).each do |oldfile|
+ oldfiles = Dir.glob(pattern)
+ if oldfiles.length == 0 then
+ report("no files match #{pattern}")
+ end
+ oldfiles.each do |oldfile|
newfile = "#{oldfile}.#{suffix}"
- if File.needsupdate(oldfile,newfile) then
+ newfile = File.basename(newfile) if @local
+ if File.expand_path(oldfile) != File.expand_path(newfile) && File.needsupdate(oldfile,newfile) then
report("#{oldfile} needs preprocessing")
begin
File.delete(newfile)
@@ -205,14 +216,16 @@ end
command = REXML::Document.new(command.to_s) # don't infect original
command = command.elements["ctx:processor"]
begin
- if suf = command.attributes['suffix'] then
- newfile = "#{oldfile}.#{suf}"
- end
+ newfile = "#{oldfile}.#{suf}" if suf = command.attributes['suffix']
+ rescue
+ end
+ begin
+ newfile = File.basename(newfile) if @local
rescue
end
- report("preprocessing #{oldfile} into #{newfile} using #{pp}")
REXML::XPath.each(command,"ctx:old") do |value| replace(value,oldfile) end
REXML::XPath.each(command,"ctx:new") do |value| replace(value,newfile) end
+ report("preprocessing #{oldfile} into #{newfile} using #{pp}")
variables['old'] = oldfile
variables['new'] = newfile
REXML::XPath.each(command,"ctx:value") do |value|
@@ -225,15 +238,19 @@ end
unless ok = System.run(command) then
report("error in preprocessing file #{oldfile}")
end
+ begin
+ oldfile = File.basename(oldfile) if @local
+ rescue
+ end
end
end
if FileTest.file?(newfile) then
File.syncmtimes(oldfile,newfile)
else
- report("preprocessing #{oldfile} gave no #{newfile}")
+ report("check target location of #{newfile}")
end
else
- report("#{oldfile} needs no preprocessing")
+ report("#{oldfile} needs no preprocessing (same file)")
end
@prepfiles[oldfile] = FileTest.file?(newfile)
end
@@ -258,7 +275,11 @@ end
if @prepfiles.length > 0 then
if log = File.open(ctlname,'w') then
log << "<?xml version='1.0' standalone='yes'?>\n\n"
- log << "<ctx:preplist>\n"
+ if @local then
+ log << "<ctx:preplist local='yes'>\n"
+ else
+ log << "<ctx:preplist local='no'>\n"
+ end
@prepfiles.keys.sort.each do |prep|
# log << "\t<ctx:prepfile done='#{yes_or_no(@prepfiles[prep])}'>#{File.basename(prep)}</ctx:prepfile>\n"
log << "\t<ctx:prepfile done='#{yes_or_no(@prepfiles[prep])}'>#{prep}</ctx:prepfile>\n"
diff --git a/Master/texmf-dist/scripts/context/ruby/base/kpse.rb b/Master/texmf-dist/scripts/context/ruby/base/kpse.rb
index bff3cc1fae7..a4babae5505 100644
--- a/Master/texmf-dist/scripts/context/ruby/base/kpse.rb
+++ b/Master/texmf-dist/scripts/context/ruby/base/kpse.rb
@@ -197,7 +197,7 @@ module Kpse
[progname,format,filename].join('-')
end
- def Kpse.formatpath(engine='pdfetex',enginepath=true)
+ def Kpse.formatpath(engine='pdftex',enginepath=true)
# because engine support in distributions is not always
# as we expect, we need to check for it;
diff --git a/Master/texmf-dist/scripts/context/ruby/base/kpsefast.rb b/Master/texmf-dist/scripts/context/ruby/base/kpsefast.rb
index 24ff1a0fa7c..8a9f895933b 100644
--- a/Master/texmf-dist/scripts/context/ruby/base/kpsefast.rb
+++ b/Master/texmf-dist/scripts/context/ruby/base/kpsefast.rb
@@ -260,7 +260,7 @@ class KpseFast
@rootpath = ''
@treepath = ''
@progname = 'kpsewhich'
- @engine = 'pdfetex'
+ @engine = 'pdftex'
@variables = Hash.new
@expansions = Hash.new
@files = Hash.new
@@ -910,7 +910,7 @@ end
# puts k.expansion("$TEXMF")
# puts k.expanded_path("TEXINPUTS","context")
- # k.progname, k.engine, k.format = 'context', 'pdfetex', 'tfm'
+ # k.progname, k.engine, k.format = 'context', 'pdftex', 'tfm'
# k.scandisk = false # == must_exist
# k.expand_variables
diff --git a/Master/texmf-dist/scripts/context/ruby/base/switch.rb b/Master/texmf-dist/scripts/context/ruby/base/switch.rb
index 5187a795f03..19eced42495 100644
--- a/Master/texmf-dist/scripts/context/ruby/base/switch.rb
+++ b/Master/texmf-dist/scripts/context/ruby/base/switch.rb
@@ -86,7 +86,7 @@ module CommandBase
def initialize(commandline,logger,banner)
@commandline, @logger, @banner = commandline, logger, banner
- @forcenewline, @versiondone = false, false
+ @forcenewline, @versiondone, @error = false, false, false
version if @commandline.option('version')
end
@@ -117,6 +117,23 @@ module CommandBase
initlogger ; @logger.report(str)
end
+ def seterror
+ @error = true
+ end
+
+ def error?
+ return @error
+ end
+
+ def exit
+ if @error then Kernel.exit(1) else Kernel.exit(0) end
+ end
+
+ def execute(str=nil)
+ send(str || action || 'main')
+ exit
+ end
+
def debug(*str)
initlogger ; @logger.debug(str)
end
diff --git a/Master/texmf-dist/scripts/context/ruby/base/tex.rb b/Master/texmf-dist/scripts/context/ruby/base/tex.rb
index 1b526f6e56c..3870f198819 100644
--- a/Master/texmf-dist/scripts/context/ruby/base/tex.rb
+++ b/Master/texmf-dist/scripts/context/ruby/base/tex.rb
@@ -67,46 +67,49 @@ class TEX
include Variables
- @@texengines = Hash.new
- @@mpsengines = Hash.new
- @@backends = Hash.new
- @@mappaths = Hash.new
- @@runoptions = Hash.new
- @@texformats = Hash.new
- @@mpsformats = Hash.new
- @@prognames = Hash.new
- @@texmakestr = Hash.new
- @@texprocstr = Hash.new
- @@mpsmakestr = Hash.new
- @@mpsprocstr = Hash.new
-
- @@texmethods = Hash.new
- @@mpsmethods = Hash.new
-
- @@pdftex = 'pdftex' # new default, pdfetex is gone
-
- @@luafiles = "luafiles.tmp"
- @@luatarget = "lua/context"
-
- ENV['PATH'].split(File::PATH_SEPARATOR).each do |p|
- if System.unix? then
- pp, pe = "#{p}/pdftex" , "#{p}/pdfetex"
- else
- pp, pe = "#{p}/pdftex.exe", "#{p}/pdfetex.exe"
- end
- if FileTest.file?(pe) then
- # we assume no update
- @@pdftex = 'pdfetex'
- break
- elsif FileTest.file?(pp) then
- # we assume an update
- @@pdftex = 'pdftex'
- break
- end
- end
+ @@texengines = Hash.new
+ @@mpsengines = Hash.new
+ @@backends = Hash.new
+ @@mappaths = Hash.new
+ @@runoptions = Hash.new
+ @@draftoptions = Hash.new
+ @@texformats = Hash.new
+ @@mpsformats = Hash.new
+ @@prognames = Hash.new
+ @@texmakestr = Hash.new
+ @@texprocstr = Hash.new
+ @@mpsmakestr = Hash.new
+ @@mpsprocstr = Hash.new
+
+ @@texmethods = Hash.new
+ @@mpsmethods = Hash.new
+
+ @@pdftex = 'pdftex' # new default, pdfetex is gone
+
+ @@luafiles = "luafiles.tmp"
+ @@luatarget = "lua/context"
+
+ # we now drop pdfetex definitely
+
+ # ENV['PATH'].split(File::PATH_SEPARATOR).each do |p|
+ # if System.unix? then
+ # pp, pe = "#{p}/pdftex" , "#{p}/pdfetex"
+ # else
+ # pp, pe = "#{p}/pdftex.exe", "#{p}/pdfetex.exe"
+ # end
+ # if FileTest.file?(pe) then # we assume no update
+ # @@pdftex = 'pdfetex'
+ # break
+ # elsif FileTest.file?(pp) then # we assume an update
+ # @@pdftex = 'pdftex'
+ # break
+ # end
+ # end
- ['etex','pdfetex','standard'] .each do |e| @@texengines[e] = @@pdftex end
- ['tex','pdftex'] .each do |e| @@texengines[e] = 'pdftex' end
+ # ['etex','pdfetex','standard'] .each do |e| @@texengines[e] = @@pdftex end
+ # ['tex','pdftex'] .each do |e| @@texengines[e] = 'pdftex' end
+
+ ['tex','etex','pdftex','pdfetex','standard'] .each do |e| @@texengines[e] = 'pdftex' end
['aleph','omega'] .each do |e| @@texengines[e] = 'aleph' end
['xetex'] .each do |e| @@texengines[e] = 'xetex' end
['luatex'] .each do |e| @@texengines[e] = 'luatex' end
@@ -166,16 +169,18 @@ class TEX
'cont-fr','cont-cz','cont-ro','cont-uk'] .each do |f| @@texprocstr[f] = "\\emergencyend" end
# @@runoptions['xetex'] = ['--output-driver \\\"-d 4 -V 5\\\"'] # we need the pos pass
- @@runoptions['xetex'] = ['--8bit -no-pdf'] # from now on we assume (x)dvipdfmx to be used
- @@runoptions['pdfetex'] = ['--8bit ']
- @@runoptions['pdftex'] = ['--8bit '] # pdftex is now pdfetex
- @@runoptions['luatex'] = ['']
- @@runoptions['aleph'] = ['--8bit ']
- @@runoptions['mpost'] = ['--8bit ']
+ @@runoptions['xetex'] = ['--8bit','-no-pdf'] # from now on we assume (x)dvipdfmx to be used
+ @@runoptions['pdfetex'] = ['--8bit'] # obsolete
+ @@runoptions['pdftex'] = ['--8bit'] # pdftex is now pdfetex
+ @@runoptions['luatex'] = ['--file-line-error']
+ @@runoptions['aleph'] = ['--8bit']
+ @@runoptions['mpost'] = ['--8bit']
+
+ @@draftoptions['pdftex'] = ['--draftmode']
@@booleanvars = [
'batchmode', 'nonstopmode', 'fast', 'fastdisabled', 'silentmode', 'final',
- 'paranoid', 'notparanoid', 'nobanner', 'once', 'allpatterns',
+ 'paranoid', 'notparanoid', 'nobanner', 'once', 'allpatterns', 'draft',
'nompmode', 'nomprun', 'automprun', 'combine',
'nomapfiles', 'local',
'arrange', 'noarrange',
@@ -185,14 +190,15 @@ class TEX
'forcetexutil', 'texutil',
'globalfile', 'autopath',
'purge', 'purgeall', 'keep', 'autopdf', 'xpdf', 'simplerun', 'verbose',
- 'nooptionfile', 'nobackend', 'noctx', 'utfbom'
+ 'nooptionfile', 'nobackend', 'noctx', 'utfbom',
+ 'mkii',
]
@@stringvars = [
'modefile', 'result', 'suffix', 'response', 'path',
'filters', 'usemodules', 'environments', 'separation', 'setuppath',
'arguments', 'input', 'output', 'randomseed', 'modes', 'mode', 'filename',
'ctxfile', 'printformat', 'paperformat', 'paperoffset',
- 'timeout'
+ 'timeout', 'passon'
]
@@standardvars = [
'mainlanguage', 'bodyfont', 'language'
@@ -323,6 +329,7 @@ class TEX
str = '' # allocate
[name].flatten.each do |n|
if str = getvariable(n) then
+ str = str.join(" ") if str.class == Array
unless (str.class == String) && str.empty? then
report("option '#{n}' is set to '#{str}'")
end
@@ -377,7 +384,18 @@ class TEX
def mpsmethod(format) @@mpsmethods[str] || @@mpsmethods['standard'] end
def runoptions(engine)
- if @@runoptions.key?(engine) then @@runoptions[engine].join(' ') else '' end
+ options = if getvariable('draft') then @@draftoptions[engine] else [] end
+ begin
+ if str = getvariable('passon') then
+ options = [options,str.split(' ')].flatten
+ end
+ rescue
+ end
+ if @@runoptions.key?(engine) then
+ [options,@@runoptions[engine]].flatten.join(' ')
+ else
+ options.join(' ')
+ end
end
# private
@@ -421,10 +439,10 @@ class TEX
if str.class == String then str.split(',') else str.flatten end
end
- def validtexformat(str) validsomething(str,@@texformats,'tex') end
- def validmpsformat(str) validsomething(str,@@mpsformats,'mp' ) end
- def validtexengine(str) validsomething(str,@@texengines,'pdfetex') end
- def validmpsengine(str) validsomething(str,@@mpsengines,'mpost' ) end
+ def validtexformat(str) validsomething(str,@@texformats,'tex') end
+ def validmpsformat(str) validsomething(str,@@mpsformats,'mp' ) end
+ def validtexengine(str) validsomething(str,@@texengines,'pdftex') end
+ def validmpsengine(str) validsomething(str,@@mpsengines,'mpost' ) end
def validtexmethod(str) [validsomething(str,@@texmethods)].flatten.first end
def validmpsmethod(str) [validsomething(str,@@mpsmethods)].flatten.first end
@@ -594,16 +612,16 @@ class TEX
else
report('updating file database')
Kpse.update
- end
- if getvariable('luatex') then
- begin
- luatools = `texmfstart luatools --format=texmfscripts luatools.lua`.chomp.strip
- unless luatools.empty? then
- runcommand(["luatex","--luaonly=#{luatools}","--generate","--verbose"])
+ if getvariable('luatex') then
+ begin
+ luatools = `texmfstart luatools --format=texmfscripts luatools.lua`.chomp.strip
+ unless luatools.empty? then
+ runcommand(["luatex","--luaonly #{luatools}","--generate","--verbose"])
+ end
+ rescue
+ report("run 'luatex --luaonly pathto/luatools.lua --generate' manually")
+ exit
end
- rescue
- report("run 'luatex --luaonly=....../luatools.lua --generate' manually")
- exit
end
end
# goody
@@ -620,6 +638,7 @@ class TEX
# generate tex formats
unless texformats || mpsformats then
report('provide valid format (name.tex, name.mp, ...) or format id (metafun, en, nl, ...)')
+ setvariable('error','no format specified')
end
if texformats && texengine then
report("using tex engine #{texengine}")
@@ -636,7 +655,10 @@ class TEX
cleanupluafiles
texformats.each do |texformat|
report("generating tex format #{texformat}")
- run_luatools("--ini --compile #{texformat}")
+ flags = ['--ini','--compile']
+ flags << '--verbose' if getvariable('verbose')
+ flags << '--mkii' if getvariable('mkii')
+ run_luatools("#{flags.join(" ")} #{texformat}")
end
compileluafiles
else
@@ -663,11 +685,14 @@ class TEX
mpsformats.each do |mpsformat|
report("generating mps format #{mpsformat}")
progname = validprogname([getvariable('progname'),mpsformat,mpsengine])
- runcommand([quoted(mpsengine),prognameflag(progname),iniflag,tcxflag,runoptions(mpsengine),mpsformat,mpsmakeextras(mpsformat)])
+ if not runcommand([quoted(mpsengine),prognameflag(progname),iniflag,tcxflag,runoptions(mpsengine),mpsformat,mpsmakeextras(mpsformat)]) then
+ setvariable('error','no format made')
+ end
end
else
report("unable to make format due to lack of permissions")
mpsformatpath = ''
+ setvariable('error','file permission problem')
end
else
mpsformatpath = ''
@@ -1134,7 +1159,7 @@ class TEX
if path then
script = "#{path}/../lua/luatools.lua"
if FileTest.file?(script) then
- return runcommand("lua #{script} #{args}")
+ return runcommand("luatex --luaonly #{script} #{args}")
end
end
end
@@ -1510,12 +1535,12 @@ class TEX
report("tex format: #{texformat}")
if texengine && texformat then
fixbackendvars(@@mappaths[texengine])
-if texengine == "luatex" then
- run_luatools("--fmt=#{texformat} #{filename}")
-else
- progname = validprogname([getvariable('progname'),texformat,texengine])
- runcommand([quoted(texengine),prognameflag(progname),formatflag(texengine,texformat),tcxflag,runoptions(texengine),filename,texprocextras(texformat)])
-end
+ if texengine == "luatex" then
+ run_luatools("--fmt=#{texformat} #{filename}")
+ else
+ progname = validprogname([getvariable('progname'),texformat,texengine])
+ runcommand([quoted(texengine),prognameflag(progname),formatflag(texengine,texformat),tcxflag,runoptions(texengine),filename,texprocextras(texformat)])
+ end
# true
else
false
@@ -1665,7 +1690,7 @@ end
xdvfile = File.suffixed(rawname,'xdv')
if FileTest.file?(xdvfile) then
fixbackendvars('dvipdfm')
- runcommand("xdvipdfmx -d 4 -V 5 #{xdvfile}")
+ runcommand("xdvipdfmx -q -d 4 -V 5 -E #{xdvfile}")
end
when 'xdv2pdf' then
xdvfile = File.suffixed(rawname,'xdv')
diff --git a/Master/texmf-dist/scripts/context/ruby/ctxtools.rb b/Master/texmf-dist/scripts/context/ruby/ctxtools.rb
index 567c927a57c..b306ee5dc43 100644
--- a/Master/texmf-dist/scripts/context/ruby/ctxtools.rb
+++ b/Master/texmf-dist/scripts/context/ruby/ctxtools.rb
@@ -897,6 +897,7 @@ class Language
end
def load(filenames=@filenames)
+ found = false
begin
if filenames then
@filenames.each do |fileset|
@@ -907,8 +908,9 @@ class Language
@data += data.gsub(/\%.*$/, '').gsub(/\\message\{.*?\}/, '')
data.gsub!(/(\\patterns|\\hyphenation)\s*\{.*/mo) do '' end
@read += "\n% preamble of file #{fname}\n\n#{data}\n"
- report("file #{fname} is loaded")
@data.gsub!(/^[\s\n]+$/mois, '')
+ report("file #{fname} is loaded")
+ found = true
break # next fileset
end
rescue
@@ -919,6 +921,7 @@ class Language
end
rescue
end
+ return found
end
def valid?
@@ -1184,10 +1187,11 @@ class Language
commandline.report("processing language #{language}")
commandline.report("")
language = Language.new(commandline,language,filenames,encoding)
- language.load
- language.convert
- language.save
- commandline.report("")
+ if language.load then
+ language.convert
+ language.save
+ commandline.report("")
+ end
end
end
@@ -1604,15 +1608,16 @@ class Commands
# ghyphen.readme ghyph31.readme grphyph
@@languagedata['hr' ] = [ 'ec' , ['hrhyph.tex'] ]
@@languagedata['hu' ] = [ 'ec' , ['huhyphn.tex'] ]
- @@languagedata['en' ] = [ 'default' , [['ushyphmax.tex','ushyph.tex','hyphen.tex']] ]
- @@languagedata['us' ] = [ 'default' , [['ushyphmax.tex','ushyph.tex','hyphen.tex']] ]
+ @@languagedata['en' ] = [ 'default' , ['ushyphmax.tex'],['ushyph.tex'],['hyphen.tex'] ]
+ @@languagedata['us' ] = [ 'default' , ['ushyphmax.tex'],['ushyph.tex'],['hyphen.tex'] ]
# inhyph.tex
@@languagedata['is' ] = [ 'ec' , ['ishyph.tex'] ]
@@languagedata['it' ] = [ 'ec' , ['ithyph.tex'] ]
@@languagedata['la' ] = [ 'ec' , ['lahyph.tex'] ]
# mnhyph
@@languagedata['nl' ] = [ 'ec' , ['nehyph96.tex'] ]
- @@languagedata['no' ] = [ 'ec' , ['nohyph.tex'] ]
+ # @@languagedata['no' ] = [ 'ec' , ['nohyphbx.tex'],['nohyphb.tex'],['nohyph2.tex'],['nohyph1.tex'],['nohyph.tex'] ]
+ @@languagedata['no' ] = [ 'ec' , ['asxsx.tex','nohyphbx.tex'],['nohyphb.tex'],['nohyph2.tex'],['nohyph1.tex'],['nohyph.tex'] ]
@@languagedata['agr'] = [ 'agr' , [['grahyph4.tex','oldgrhyph.tex']] ] # new, todo
@@languagedata['pl' ] = [ 'ec' , ['plhyph.tex'] ]
@@languagedata['pt' ] = [ 'ec' , ['pthyph.tex'] ]
@@ -1623,7 +1628,7 @@ class Commands
# srhyphc.tex / cyrillic
@@languagedata['sv' ] = [ 'ec' , ['svhyph.tex'] ]
@@languagedata['tr' ] = [ 'ec' , ['tkhyph.tex'] ]
- @@languagedata['uk' ] = [ 'default' , [['ukhyphen.tex','ukhyph.tex']] ]
+ @@languagedata['uk' ] = [ 'default' , [['ukhyphen.tex'],['ukhyph.tex']] ]
# @@languagedata['ru' ] = [ 't2a' , ['ruhyphal.tex'] ] # t2a does not work
@@languagedata['ru' ] = [ 'cyr' , ['ruhyphal.tex'] ]
end
diff --git a/Master/texmf-dist/scripts/context/ruby/graphics/gs.rb b/Master/texmf-dist/scripts/context/ruby/graphics/gs.rb
index 2c1079d1a6b..070fd1be85a 100644
--- a/Master/texmf-dist/scripts/context/ruby/graphics/gs.rb
+++ b/Master/texmf-dist/scripts/context/ruby/graphics/gs.rb
@@ -243,7 +243,7 @@ class GhostScript
def pdfmethod? (str)
case method(str).to_i
- when 4, 5 then return true
+ when 3, 4, 5 then return true
end
return false
end
@@ -367,7 +367,13 @@ class GhostScript
@rs = Tool.line_separator(inpfile)
debug("platform mac") if @rs == "\r"
- return false unless tmp = open(inpfile, 'rb')
+ if FileTest.file?(outfile) and not File.writable?(outfile) then
+ report("output file cannot be written")
+ return false
+ elsif not tmp = open(inpfile, 'rb') then
+ report("input file cannot be opened")
+ return false
+ end
debug('opening pipe/file')
@@ -458,35 +464,50 @@ class GhostScript
end
- def convertcropped (inpfile, outfile)
+ # def convertcropped (inpfile, outfile)
+ # report("converting #{inpfile} cropped")
+ # do_convertbounded(inpfile, @@pdftempfile)
+ # return unless test(?e,@@pdftempfile)
+ # arguments = " --offset=#{@offset} #{@@pdftempfile} #{outfile}"
+ # report("calling #{@@pdftrimwhite}")
+ # unless ok = System.run(@@pdftrimwhite,arguments) then
+ # report('cropping failed')
+ # begin
+ # File.delete(outfile)
+ # rescue
+ # end
+ # begin
+ # File.move(@@pdftempfile,outfile)
+ # rescue
+ # File.copy(@@pdftempfile,outfile)
+ # File.delete(@@pdftempfile)
+ # end
+ # end
+ # return ok
+ # end
+ def convertcropped (inpfile, outfile)
report("converting #{inpfile} cropped")
-
- do_convertbounded(inpfile, @@pdftempfile)
-
- return unless test(?e,@@pdftempfile)
-
- arguments = " --offset=#{@offset} #{@@pdftempfile} #{outfile}"
-
- report("calling #{@@pdftrimwhite}")
- unless ok = System.run(@@pdftrimwhite,arguments) then
- report('cropping failed')
- begin
- File.delete(outfile)
- rescue
+ if File.expand_path(inpfile) == File.expand_path(outfile) then
+ report("output filename must be different")
+ elsif inpfile =~ /\.pdf$/io then
+ System.run("pdftops -eps #{inpfile} #{@@pstempfile}")
+ if getdimensions(@@pstempfile) then
+ report("tight boundingbox found")
end
- begin
- File.move(@@pdftempfile,outfile)
- rescue
- File.copy(@@pdftempfile,outfile)
- File.delete(@@pdftempfile)
+ do_convertbounded(@@pstempfile, outfile)
+ File.delete(@@pstempfile) if FileTest.file?(@@pstempfile)
+ else
+ if getdimensions(inpfile) then
+ report("tight boundingbox found")
end
+ do_convertbounded(inpfile, outfile)
end
-
- return ok
-
+ resetdimensions
+ return true
end
+
def pipebounded (eps, out)
epsbbox, skip, buffer = false, false, ''
@@ -501,12 +522,17 @@ class GhostScript
end
end
- debug('locating boundingbox')
-
# why no BeginData check
eps.rewind
+if dimensions? then
+
+ debug('using found boundingbox')
+
+else
+
+ debug('locating boundingbox')
while str = eps.gets(rs=@rs) do
case str
when /^%%Page:/io then
@@ -520,9 +546,10 @@ class GhostScript
setdimensions($1,$2,$3,$4)
end
end
-
debug('no boundingbox found') if @width == 0
+end
+
eps.rewind
while str = eps.gets(rs=@rs) do
@@ -595,6 +622,8 @@ class GhostScript
# report('process aborted, broken pipe, fatal error') unless ok
# return ok
+resetdimensions
+
return true
end
diff --git a/Master/texmf-dist/scripts/context/ruby/pdftools.rb b/Master/texmf-dist/scripts/context/ruby/pdftools.rb
index 6dfa47374d4..25e7250b67f 100644
--- a/Master/texmf-dist/scripts/context/ruby/pdftools.rb
+++ b/Master/texmf-dist/scripts/context/ruby/pdftools.rb
@@ -738,6 +738,40 @@ class Commands
end
+ # name type emb sub uni object ID
+ # ------------------------------------ ------------ --- --- --- ---------
+ # EOPLBP+TimesNewRomanPSMT TrueType yes yes no 167 0
+ # Times-Roman TrueType no no no 95 0
+ # EPBAAB+Helvetica Type 1C yes yes yes 108 0
+ # EPBMLE+Helvetica-Oblique Type 1C yes yes yes 111 0
+ # Helvetica TrueType no no no 112 0
+
+ def checkembedded
+ $stderr = $stdout
+ $stdout.flush
+ if @commandline.option('pattern') then
+ # **/*.pdf
+ filenames, n = globfiles(@commandline.option('pattern'),'pdf'), 0
+ else
+ filenames, n = findfiles('pdf'), 0
+ end
+ filenames.sort.each do |file|
+ report("= checking #{File.expand_path(file)}")
+ result = `pdffonts #{file}`.chomp
+ lines = result.split(/\n/)
+ if result =~ /emb\s+sub\s+uni/io then
+ lines.each do |line|
+ report("! #{line}") if line =~ /no\s+(no|yes)\s+(no|yes)/io
+ end
+ else
+ lines.each do |line|
+ report("? #{line}")
+ end
+ end
+ report("")
+ end
+ end
+
def countpages
if @commandline.option('pattern') then
filenames, n = globfiles(@commandline.option('pattern'),'pdf'), 0
@@ -802,6 +836,7 @@ commandline.registeraction('convertimage', 'filename [--retain --subpath]')
commandline.registeraction('downsampleimage', 'filename [--retain --subpath --lowres --normal]')
commandline.registeraction('info', 'filename')
commandline.registeraction('countpages', '[--pattern --threshold]')
+commandline.registeraction('checkembedded', '[--pattern]')
commandline.registeraction('analyzefile' , 'filename')
diff --git a/Master/texmf-dist/scripts/context/ruby/rlxtools.rb b/Master/texmf-dist/scripts/context/ruby/rlxtools.rb
index 40a45bd51a8..ea065612f0a 100644
--- a/Master/texmf-dist/scripts/context/ruby/rlxtools.rb
+++ b/Master/texmf-dist/scripts/context/ruby/rlxtools.rb
@@ -94,7 +94,8 @@ class Commands
report("processing record #{nofrecords} (#{variables['file'] || 'noname'}: #{variables.size} entries)")
if conversion = variables['conversion'] then
report("testing for conversion #{conversion}")
- if suffix = variables['suffix'].downcase then
+ if suffix = variables['suffix'] then
+ suffix.downcase!
if ! suffix.empty? && variables['file'] && variables['file'] !~ /\.([a-z]+)$/i then
variables['file'] += ".#{suffix}"
end
@@ -103,7 +104,7 @@ class Commands
else
report("conversion #{conversion} for suffix #{suffix}")
end
- pattern = "@name='#{conversion}' and @suffix='#{suffix.downcase}'"
+ pattern = "@name='#{conversion}' and @suffix='#{suffix}'"
if steps = REXML::XPath.first(proc.root,"/rl:manipulators/rl:manipulator[#{pattern}]") then
localsteps = steps.deep_clone
['rl:old','rl:new'].each do |tag|
diff --git a/Master/texmf-dist/scripts/context/ruby/texexec.rb b/Master/texmf-dist/scripts/context/ruby/texexec.rb
index 389a7a6ed09..f37cfd8c2b0 100644
--- a/Master/texmf-dist/scripts/context/ruby/texexec.rb
+++ b/Master/texmf-dist/scripts/context/ruby/texexec.rb
@@ -36,6 +36,7 @@ class Commands
end
job.makeformats
job.inspect && Kpse.inspect if @commandline.option('verbose')
+ seterror if job.error?
end
end
@@ -60,7 +61,7 @@ class Commands
prepare(job)
job.processtex
job.inspect && Kpse.inspect if @commandline.option('verbose')
- exit 1 if job.error?
+ seterror if job.error?
end
end
@@ -70,7 +71,7 @@ class Commands
prepare(job)
job.processmptex
job.inspect && Kpse.inspect if @commandline.option('verbose')
- exit 1 if job.error?
+ seterror if job.error?
end
end
@@ -80,7 +81,7 @@ class Commands
prepare(job)
job.processmpxtex
job.inspect && Kpse.inspect if @commandline.option('verbose')
- exit 1 if job.error?
+ seterror if job.error?
end
end
@@ -90,7 +91,7 @@ class Commands
prepare(job)
job.processmpgraphic
job.inspect && Kpse.inspect if @commandline.option('verbose')
- exit 1 if job.error?
+ seterror if job.error?
end
end
@@ -100,7 +101,7 @@ class Commands
prepare(job)
job.processmpstatic
job.inspect && Kpse.inspect if @commandline.option('verbose')
- exit 1 if job.error?
+ seterror if job.error?
end
end
@@ -216,11 +217,11 @@ class Commands
fnames.each do |ffname|
if msuffixes.include?(File.splitname(ffname)[1]) && FileTest.file?(ffname) then
if mod = File.open(job.tempfilename('tex'),'w') then
-if File.suffix(ffname) =~ /^(mkii|mkiv)$/o then
- markfile = $1
-else
- markfile = nil
-end
+ if File.suffix(ffname) =~ /^(mkii|mkiv)$/o then
+ markfile = $1
+ else
+ markfile = nil
+ end
Kpse.runscript('ctxtools',ffname,'--document')
if ted = File.silentopen(File.suffixed(ffname,'ted')) then
firstline = ted.gets
@@ -244,11 +245,11 @@ end
job.setvariable('simplerun',true)
# job.setvariable('nooptionfile',true)
job.setvariable('files',[job.tempfilename])
-result = File.unsuffixed(File.basename(ffname))
-if markfile then
- result = result+'-'+markfile
-end
-job.setvariable('result',result)
+ result = File.unsuffixed(File.basename(ffname))
+ if markfile then
+ result = result+'-'+markfile
+ end
+ job.setvariable('result',result)
job.processtex
# ["dvi", "pdf","ps"].each do |s|
# File.silentrename(job.tempfilename(s),File.suffixed(ffname,s));
@@ -437,30 +438,34 @@ job.setvariable('result',result)
f << "\\starttext\n"
files.each do |filename|
result = @commandline.checkedoption('result','texexec')
- if (filename !~ /^texexec/io) && (filename !~ /^#{result}/) then
- report("copying file: #{filename}")
- f << "\\getfiguredimensions\n"
- f << " [#{filename}]\n"
- f << " [scale=#{scale},\n"
- f << " page=1,\n"
- f << " size=trimbox\n" if trim
- f << "]\n"
- f << "\\definepapersize\n"
- f << " [copy]\n"
- f << " [width=\\figurewidth,\n"
- f << " height=\\figureheight]\n"
- f << "\\setuppapersize\n"
- f << " [copy][copy]\n"
- f << "\\setuplayout\n"
- f << " [page]\n"
- f << "\\setupexternalfigures\n"
- f << " [directory=]\n"
- f << "\\copypages\n"
- f << " [#{filename}]\n"
- f << " [scale=#{scale},\n"
- f << " marking=on,\n" if @commandline.option('markings')
- f << " size=trimbox,\n" if trim
- f << " offset=#{paperoffset}]\n"
+ begin
+ if (filename !~ /^texexec/io) && (filename !~ /^#{result}/) then
+ report("copying file: #{filename}")
+ f << "\\getfiguredimensions\n"
+ f << " [#{filename}]\n"
+ f << " [scale=#{scale},\n"
+ f << " page=1,\n"
+ f << " size=trimbox\n" if trim
+ f << "]\n"
+ f << "\\definepapersize\n"
+ f << " [copy]\n"
+ f << " [width=\\figurewidth,\n"
+ f << " height=\\figureheight]\n"
+ f << "\\setuppapersize\n"
+ f << " [copy][copy]\n"
+ f << "\\setuplayout\n"
+ f << " [page]\n"
+ f << "\\setupexternalfigures\n"
+ f << " [directory=]\n"
+ f << "\\copypages\n"
+ f << " [#{filename}]\n"
+ f << " [scale=#{scale},\n"
+ f << " marking=on,\n" if @commandline.option('markings')
+ f << " size=trimbox,\n" if trim
+ f << " offset=#{paperoffset}]\n"
+ end
+ rescue
+ report("wrong specification")
end
end
f << "\\stoptext\n"
@@ -568,7 +573,7 @@ job.setvariable('result',result)
if (str = @commandline.option('engine')) && ! str.standard? && ! str.empty? then
job.setvariable('texengine',str)
elsif @commandline.oneof('pdfetex','pdftex','pdf') then
- job.setvariable('texengine','pdfetex')
+ job.setvariable('texengine','pdftex')
elsif @commandline.oneof('xetex','xtx') then
job.setvariable('texengine','xetex')
elsif @commandline.oneof('aleph') then
@@ -596,6 +601,7 @@ job.setvariable('result',result)
else
case job.getvariable('texengine')
when 'pdfetex' then job.setvariable('backend','pdftex')
+ when 'pdftex' then job.setvariable('backend','pdftex')
when 'luatex' then job.setvariable('backend','pdftex')
when 'xetex' then job.setvariable('backend','xetex')
when 'aleph' then job.setvariable('backend','dvipdfmx')
@@ -763,4 +769,4 @@ commandline.registerflag('verbose')
commandline.expand
-Commands.new(commandline,logger,banner).send(commandline.action || 'main')
+Commands.new(commandline,logger,banner).execute(commandline.action || 'main') # or just execute()
diff --git a/Master/texmf-dist/scripts/context/ruby/texmfstart.rb b/Master/texmf-dist/scripts/context/ruby/texmfstart.rb
index de4a18d2eb5..4d1e2976145 100644
--- a/Master/texmf-dist/scripts/context/ruby/texmfstart.rb
+++ b/Master/texmf-dist/scripts/context/ruby/texmfstart.rb
@@ -425,7 +425,7 @@ class KpseFast
@rootpath = ''
@treepath = ''
@progname = 'kpsewhich'
- @engine = 'pdfetex'
+ @engine = 'pdftex'
@variables = Hash.new
@expansions = Hash.new
@files = Hash.new
@@ -1074,7 +1074,7 @@ end
# puts k.expansion("$TEXMF")
# puts k.expanded_path("TEXINPUTS","context")
- # k.progname, k.engine, k.format = 'context', 'pdfetex', 'tfm'
+ # k.progname, k.engine, k.format = 'context', 'pdftex', 'tfm'
# k.scandisk = false # == must_exist
# k.expand_variables
@@ -1520,7 +1520,7 @@ def set_applications(page=1)
$applications['perl'] = $applications['pl'] = 'perl'
$applications['ruby'] = $applications['rb'] = 'ruby'
$applications['python'] = $applications['py'] = 'python'
- $applications['lua'] = $applications['lua'] = 'lua'
+ $applications['lua'] = $applications['lua'] = 'luatex --luaonly'
$applications['java'] = $applications['jar'] = 'java'
if $mswindows then
@@ -2490,27 +2490,35 @@ def execute(arguments)
if $selfmerge then
output("ruby libraries are cleaned up") if SelfMerge::cleanup
output("ruby libraries are merged") if SelfMerge::merge
+ return true
elsif $selfcleanup then
output("ruby libraries are cleaned up") if SelfMerge::cleanup
+ return true
elsif $serve then
if ENV['KPSEMETHOD'] && ENV['KPSEPORT'] then
# # kpse_merge_done: require 'base/kpseremote'
begin
KpseRemote::start_server
rescue
+ return false
+ else
+ return true
end
else
usage
puts("")
puts("message : set 'KPSEMETHOD' and 'KPSEPORT' variables")
+ return false
end
elsif $help || ! $filename || $filename.empty? then
usage
loadtree($tree)
loadenvironment($environment)
show_environment()
+ return true
elsif $batch && $filename && ! $filename.empty? then
# todo, take commands from file and avoid multiple starts and checks
+ return false
else
report("texmfstart version #{$version}")
loadtree($tree)
@@ -2531,33 +2539,42 @@ def execute(arguments)
make(filename,$mswindows,!$mswindows,$remove)
end
end
+ return true # guess
elsif $browser && $filename =~ /^http\:\/\// then
- launch($filename)
+ return launch($filename)
else
begin
process do
if $direct || $filename =~ /^bin\:/ then
- direct($filename)
+ return direct($filename)
elsif $edit && ! $editor.empty? then
- edit($filename)
+ return edit($filename)
else # script: or no prefix
command = find(shortpathname($filename),$program)
if command then
register("THREAD",File.dirname(File.expand_path(command)))
- run(command)
+ return run(command)
else
report('unable to locate program')
+ return false
end
end
end
rescue
report('fatal error in starting process')
+ return false
end
end
end
end
-execute(ARGV)
+if execute(ARGV) then
+ report("\nexecution was successful") if $verbose
+ exit(0)
+else
+ report("\nexecution failed") if $verbose
+ exit(1)
+end
-exit (if ($?.to_i rescue 0) > 0 then 1 else 0 end)
+# exit (if ($?.to_i rescue 0) > 0 then 1 else 0 end)