summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/scripts/context/ruby
diff options
context:
space:
mode:
authorTaco Hoekwater <taco@elvenkind.com>2011-06-01 08:54:21 +0000
committerTaco Hoekwater <taco@elvenkind.com>2011-06-01 08:54:21 +0000
commitd7ccb42582f85acf30568913610ccf4d602023fb (patch)
tree7292e3545a420676878e7451b68892d360c62cb6 /Master/texmf-dist/scripts/context/ruby
parent2d62a6fe9b80def59c392268022f1f9a2d6e358f (diff)
commit context 2011.05.18
git-svn-id: svn://tug.org/texlive/trunk@22719 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/scripts/context/ruby')
-rw-r--r--Master/texmf-dist/scripts/context/ruby/base/kpse.rb18
-rw-r--r--Master/texmf-dist/scripts/context/ruby/base/tex.rb200
-rw-r--r--Master/texmf-dist/scripts/context/ruby/ctxtools.rb9
-rw-r--r--Master/texmf-dist/scripts/context/ruby/fcd_start.rb2
-rw-r--r--Master/texmf-dist/scripts/context/ruby/mtxtools.rb475
-rw-r--r--Master/texmf-dist/scripts/context/ruby/rslibtool.rb114
-rw-r--r--Master/texmf-dist/scripts/context/ruby/texexec.rb19
-rwxr-xr-xMaster/texmf-dist/scripts/context/ruby/texmfstart.rb8
8 files changed, 187 insertions, 658 deletions
diff --git a/Master/texmf-dist/scripts/context/ruby/base/kpse.rb b/Master/texmf-dist/scripts/context/ruby/base/kpse.rb
index 0f986878413..313ebbe6286 100644
--- a/Master/texmf-dist/scripts/context/ruby/base/kpse.rb
+++ b/Master/texmf-dist/scripts/context/ruby/base/kpse.rb
@@ -351,15 +351,25 @@ module Kpse
end
end
+ # def Kpse.runscript(name,filename=[],options=[])
+ # setscript(name,`texmfstart --locate #{name}`) unless @@scripts.key?(name)
+ # cmd = "#{@@scripts[name]} #{[options].flatten.join(' ')} #{[filename].flatten.join(' ')}"
+ # system(cmd)
+ # end
+
+ # def Kpse.pipescript(name,filename=[],options=[])
+ # setscript(name,`texmfstart --locate #{name}`) unless @@scripts.key?(name)
+ # cmd = "#{@@scripts[name]} #{[options].flatten.join(' ')} #{[filename].flatten.join(' ')}"
+ # `#{cmd}`
+ # end
+
def Kpse.runscript(name,filename=[],options=[])
- setscript(name,`texmfstart --locate #{name}`) unless @@scripts.key?(name)
- cmd = "#{@@scripts[name]} #{[options].flatten.join(' ')} #{[filename].flatten.join(' ')}"
+ cmd = "mtxrun --script #{name} #{[options].flatten.join(' ')} #{[filename].flatten.join(' ')}"
system(cmd)
end
def Kpse.pipescript(name,filename=[],options=[])
- setscript(name,`texmfstart --locate #{name}`) unless @@scripts.key?(name)
- cmd = "#{@@scripts[name]} #{[options].flatten.join(' ')} #{[filename].flatten.join(' ')}"
+ cmd = "mtxrun --script #{name} #{[options].flatten.join(' ')} #{[filename].flatten.join(' ')}"
`#{cmd}`
end
diff --git a/Master/texmf-dist/scripts/context/ruby/base/tex.rb b/Master/texmf-dist/scripts/context/ruby/base/tex.rb
index 84025693b01..2184447ce84 100644
--- a/Master/texmf-dist/scripts/context/ruby/base/tex.rb
+++ b/Master/texmf-dist/scripts/context/ruby/base/tex.rb
@@ -87,8 +87,6 @@ class TEX
@@texmethods = Hash.new
@@mpsmethods = Hash.new
@@pdftex = 'pdftex' # new default, pdfetex is gone
- @@luafiles = "luafiles.tmp"
- @@luatarget = "lua/context"
@@platformslash = if System.unix? then "\\\\" else "\\" end
@@ -96,7 +94,6 @@ class TEX
['aleph','omega'] .each do |e| @@texengines[e] = 'aleph' end
['xetex'] .each do |e| @@texengines[e] = 'xetex' end
['petex'] .each do |e| @@texengines[e] = 'petex' end
- ['luatex'] .each do |e| @@texengines[e] = 'luatex' end
['metapost','mpost', 'standard'] .each do |e| @@mpsengines[e] = 'mpost' end
@@ -118,18 +115,16 @@ class TEX
# todo norwegian (no)
- ['plain'] .each do |f| @@texformats[f] = 'plain' end
- ['cont-en','en','english','context','standard'].each do |f| @@texformats[f] = 'cont-en' end
- ['cont-nl','nl','dutch'] .each do |f| @@texformats[f] = 'cont-nl' end
- ['cont-de','de','german'] .each do |f| @@texformats[f] = 'cont-de' end
- ['cont-it','it','italian'] .each do |f| @@texformats[f] = 'cont-it' end
- ['cont-fr','fr','french'] .each do |f| @@texformats[f] = 'cont-fr' end
- ['cont-cs','cs','cont-cz','cz','czech'] .each do |f| @@texformats[f] = 'cont-cs' end
- ['cont-ro','ro','romanian'] .each do |f| @@texformats[f] = 'cont-ro' end
- ['cont-gb','gb','cont-uk','uk','british'] .each do |f| @@texformats[f] = 'cont-gb' end
- ['cont-pe','pe','persian'] .each do |f| @@texformats[f] = 'cont-pe' end
- ['cont-xp','xp','experimental'] .each do |f| @@texformats[f] = 'cont-xp' end
- ['mptopdf'] .each do |f| @@texformats[f] = 'mptopdf' end
+ ['plain'] .each do |f| @@texformats[f] = 'plain' end
+ ['cont-en','en','english','context','standard'].each do |f| @@texformats[f] = 'cont-en.mkii' end
+ ['cont-nl','nl','dutch'] .each do |f| @@texformats[f] = 'cont-nl.mkii' end
+ ['cont-de','de','german'] .each do |f| @@texformats[f] = 'cont-de.mkii' end
+ ['cont-it','it','italian'] .each do |f| @@texformats[f] = 'cont-it.mkii' end
+ ['cont-fr','fr','french'] .each do |f| @@texformats[f] = 'cont-fr.mkii' end
+ ['cont-cs','cs','cont-cz','cz','czech'] .each do |f| @@texformats[f] = 'cont-cs.mkii' end
+ ['cont-ro','ro','romanian'] .each do |f| @@texformats[f] = 'cont-ro.mkii' end
+ ['cont-gb','gb','cont-uk','uk','british'] .each do |f| @@texformats[f] = 'cont-gb.mkii' end
+ ['mptopdf'] .each do |f| @@texformats[f] = 'mptopdf' end
['latex'] .each do |f| @@texformats[f] = 'latex.ltx' end
@@ -137,15 +132,20 @@ class TEX
['metafun','context','standard'] .each do |f| @@mpsformats[f] = 'metafun' end
['pdftex','pdfetex','aleph','omega','petex',
- 'xetex','luatex'] .each do |p| @@prognames[p] = 'context' end
+ 'xetex'] .each do |p| @@prognames[p] = 'context' end
['mpost'] .each do |p| @@prognames[p] = 'metafun' end
['latex','pdflatex'] .each do |p| @@prognames[p] = 'latex' end
['plain','default','standard','mptopdf'] .each do |f| @@texmethods[f] = 'plain' end
- ['cont-en','cont-nl','cont-de','cont-it',
- 'cont-fr','cont-cs','cont-ro','cont-gb',
- 'cont-pe','cont-xp'] .each do |f| @@texmethods[f] = 'context' end
- ['latex','pdflatex'] .each do |f| @@texmethods[f] = 'latex' end
+ ['cont-en','cont-en.mkii',
+ 'cont-nl','cont-nl.mkii',
+ 'cont-de','cont-de.mkii',
+ 'cont-it','cont-it.mkii',
+ 'cont-fr','cont-fr.mkii',
+ 'cont-cs','cont-cs.mkii',
+ 'cont-ro','cont-ro.mkii',
+ 'cont-gb','cont-gb.mkii'] .each do |f| @@texmethods[f] = 'context' end
+ ['latex','latex.ltx','pdflatex'] .each do |f| @@texmethods[f] = 'latex' end # untested
['plain','default','standard'] .each do |f| @@mpsmethods[f] = 'plain' end
['metafun'] .each do |f| @@mpsmethods[f] = 'metafun' end
@@ -158,7 +158,6 @@ class TEX
'cont-pe','cont-xp'] .each do |f| @@texprocstr[f] = @@platformslash + "emergencyend" end
@@runoptions['aleph'] = ['--8bit']
- @@runoptions['luatex'] = ['--file-line-error']
@@runoptions['mpost'] = ['--8bit']
@@runoptions['pdfetex'] = ['--8bit'] # obsolete
@@runoptions['pdftex'] = ['--8bit'] # pdftex is now pdfetex
@@ -166,11 +165,9 @@ class TEX
@@runoptions['xetex'] = ['--8bit','-output-driver="xdvipdfmx -E -d 4 -V 5"']
@@draftoptions['pdftex'] = ['--draftmode']
@@synctexcoptions['pdftex'] = ['--synctex=1']
- @@synctexcoptions['luatex'] = ['--synctex=1']
@@synctexcoptions['xetex'] = ['--synctex=1']
@@tcxflag['aleph'] = true
- @@tcxflag['luatex'] = false
@@tcxflag['mpost'] = false
@@tcxflag['pdfetex'] = true
@@tcxflag['pdftex'] = true
@@ -184,7 +181,7 @@ class TEX
'nomapfiles', 'local',
'arrange', 'noarrange',
'forcexml', 'foxet',
- 'alpha', 'beta', 'luatex',
+ 'alpha', 'beta',
'mpyforce', 'forcempy',
'forcetexutil', 'texutil',
'globalfile', 'autopath',
@@ -198,7 +195,7 @@ class TEX
'filters', 'usemodules', 'environments', 'separation', 'setuppath',
'arguments', 'input', 'output', 'randomseed', 'modes', 'mode', 'filename',
'ctxfile', 'printformat', 'paperformat', 'paperoffset',
- 'timeout', 'passon'
+ 'timeout', 'passon', 'pdftitle'
]
@@mainstandardvars = [
'mainlanguage', 'bodyfont', 'language'
@@ -362,9 +359,9 @@ class TEX
end
rescue
end
- ['mpgraph.mp'].each do |file|
- (File.delete(file) if (FileTest.size?(file) rescue 10) < 10) rescue false
- end
+ # ['mpgraph.mp'].each do |file|
+ # (File.delete(file) if (FileTest.size?(file) rescue 10) < 10) rescue false
+ # end
end
def backends() @@backends.keys.sort end
@@ -426,7 +423,7 @@ class TEX
def prefixed(format,engine)
# format
case engine
- when /etex|pdftex|pdfetex|aleph|xetex|luatex/io then
+ when /etex|pdftex|pdfetex|aleph|xetex/io then
"*#{format}"
else
format
@@ -442,14 +439,6 @@ 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,'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
-
def validsomething(str,something,type=nil)
if str then
list = [str].flatten.collect do |s|
@@ -471,6 +460,15 @@ class TEX
end
end
+ def validtexformat(str) validsomething(str,@@texformats,'tex') ||
+ validsomething(str,@@texformats,'mkii') 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
+
def validbackend(str)
if str && @@backends.key?(str) then
@@backends[str]
@@ -562,7 +560,7 @@ class TEX
# will go to context/process context/listing etc
def contextversion # ook elders gebruiken
- filename = Kpse.found('context.tex')
+ filename = Kpse.found('context.mkii')
version = 'unknown'
begin
if FileTest.file?(filename) && IO.read(filename).match(/\\contextversion\{(\d+\.\d+\.\d+.*?)\}/) then
@@ -573,39 +571,6 @@ class TEX
return version
end
- def cleanupluafiles
- File.delete(@@luafiles) rescue false
- end
-
- def compileluafiles
- begin
- Dir.glob("lua/context/*.luc").each do |luc|
- File.delete(luc) rescue false
- end
- rescue
- end
- if data = (IO.readlines(@@luafiles) rescue nil) then
- report("compiling lua files (using #{File.expand_path(@@luafiles)})")
- begin
- FileUtils.makedirs(@@luatarget) rescue false
- data.each do |line|
- luafile = line.chomp
- lucfile = File.basename(luafile).gsub(/\..*?$/,'') + ".luc"
- if runcommand(["luac","-s","-o",quoted(File.join(Dir.getwd,@@luatarget,lucfile)),quoted(luafile)]) then
- report("#{File.basename(luafile)} converted to #{File.basename(lucfile)}")
- else
- report("#{File.basename(luafile)} not converted to #{File.basename(lucfile)}")
- end
- end
- rescue
- report("fatal error in compilation")
- end
- else
- report("no lua compilations needed")
- end
- File.delete(@@luafiles) rescue false
- end
-
# we need engine methods
def makeformats
@@ -618,14 +583,6 @@ class TEX
else
report('updating file database')
Kpse.update # obsolete here
- if getvariable('luatex') then
- begin
- runcommand(["luatools","--generate","--verbose"])
- rescue
- report("run 'luatools --generate' manualy")
- exit
- end
- end
end
# goody
if getvariable('texformats') == 'standard' then
@@ -658,22 +615,10 @@ class TEX
# makeuserfile
# makeresponsefile
# end
- if texengine == 'luatex' then
- cleanupluafiles
- texformats.each do |texformat|
- report("generating tex format #{texformat}")
- flags = ['--ini','--compile']
- flags << '--verbose' if getvariable('verbose')
- flags << '--mkii' if getvariable('mkii')
- run_luatools("#{flags.join(" ")} #{texformat}")
- end
- compileluafiles
- else
- texformats.each do |texformat|
- report("generating tex format #{texformat}")
- progname = validprogname([getvariable('progname'),texformat,texengine])
- runcommand([quoted(texengine),prognameflag(progname),iniflag,tcxflag(texengine),prefixed(texformat,texengine),texmakeextras(texformat)])
- end
+ texformats.each do |texformat|
+ report("generating tex format #{texformat}")
+ progname = validprogname([getvariable('progname'),texformat,texengine])
+ runcommand([quoted(texengine),prognameflag(progname),iniflag,tcxflag(texengine),prefixed(texformat,texengine),texmakeextras(texformat)])
end
else
report("unable to make format due to lack of permissions")
@@ -728,15 +673,6 @@ class TEX
end
end
end
- begin
- lucdir = File.join(texformatpath,@@luatarget)
- Dir.chdir(lucdir)
- rescue
- else
- Dir.glob("*.luc").each do |file|
- report("luc: #{filestate(file)} > #{File.expand_path(file)} (#{File.size(file)})")
- end
- end
# to be sure, go back to current path
begin
Dir.chdir(savedpath)
@@ -781,7 +717,7 @@ class TEX
f.close
if FileTest.file?(tempfilename('tex')) then
format = File.basename(name)
- engine = if name =~ /(pdftex|pdfetex|aleph|xetex|luatex)[\/\\]#{format}/ then $1 else '' end
+ engine = if name =~ /(pdftex|pdfetex|aleph|xetex)[\/\\]#{format}/ then $1 else '' end
if engine.empty? then
engineflag = ""
else
@@ -831,7 +767,7 @@ class TEX
private
- def makeuserfile # not used in luatex (yet)
+ def makeuserfile
language = getvariable('language')
mainlanguage = getvariable('mainlanguage')
bodyfont = getvariable('bodyfont')
@@ -1179,24 +1115,6 @@ class TEX
public
- # def run_luatools(args)
- # dirty trick: we know that the lua path is relative to the ruby path; of course this
- # will not work well when stubs are used
- # [(ENV["_CTX_K_S_texexec_"] or ENV["_CTX_K_S_THREAD_"] or ENV["TEXMFSTART.THREAD"]), File.dirname($0)].each do |path|
- # if path then
- # script = "#{path}/../lua/luatools.lua"
- # if FileTest.file?(script) then
- # return runcommand("luatex --luaonly #{script} #{args}")
- # end
- # end
- # end
- # return runcommand("texmfstart luatools #{args}")
- # end
-
- def run_luatools(args)
- return runcommand("luatools #{args}")
- end
-
def processmpgraphic
getarrayvariable('files').each do |filename|
setvariable('filename',filename)
@@ -1584,17 +1502,8 @@ end
report("tex format: #{texformat}")
if texengine && texformat then
fixbackendvars(@@mappaths[texengine])
- if texengine == "luatex" then
- # currently we use luatools to start luatex but some day we should
- # find a clever way to directly call luatex (problem is that we need
- # to feed the explicit location of the format and lua initialization
- # file)
- run_luatools("--fmt=#{texformat} #{filename}")
- else
- progname = validprogname([getvariable('progname'),texformat,texengine])
- runcommand([quoted(texengine),prognameflag(progname),formatflag(texengine,texformat),tcxflag(texengine),runoptions(texengine),filename,texprocextras(texformat)])
- end
- # true
+ progname = validprogname([getvariable('progname'),texformat,texengine])
+ runcommand([quoted(texengine),prognameflag(progname),formatflag(texengine,texformat),tcxflag(texengine),runoptions(texengine),filename,texprocextras(texformat)])
else
false
end
@@ -1673,24 +1582,6 @@ end
end
end
- def runluacheck(jobname)
- if false then
- # test-pos.tex / 6 meg tua file: 18.6 runtime
- old, new = File.suffixed(jobname,'tua'), File.suffixed(jobname,'tuc')
- if FileTest.file?(old) then
- report("converting #{old} into #{new}")
- system("luac -s -o #{new} #{old}")
- end
- else
- # test-pos.tex / 6 meg tua file: 17.5 runtime
- old, new = File.suffixed(jobname,'tua'), File.suffixed(jobname,'tuc')
- if FileTest.file?(old) then
- report("renaming #{old} into #{new}")
- File.rename(old,new) rescue false
- end
- end
- end
-
# 1=tex 2=mptex 3=mpxtex 4=mpgraphic 5=mpstatic
def runtexexec(filename=[], options=[], mode=nil)
@@ -1928,7 +1819,6 @@ end
ok = runtex(if dummyfile || forcexml then rawbase else rawname end)
if ok then
ok = runtexutil(rawbase) if getvariable('texutil') || getvariable('forcetexutil')
- runluacheck(rawbase)
runbackend(rawbase)
popresult(rawbase,result)
end
@@ -1979,7 +1869,6 @@ end
mprundone = runtexmpjob(rawbase, "mprun")
end
ok = runtexutil(rawbase)
- runluacheck(rawbase)
state.update
stoprunning = state.stable?
end
@@ -1989,7 +1878,6 @@ end
end
if (nofruns == 1) && getvariable('texutil') then
ok = runtexutil(rawbase)
- runluacheck(rawbase)
end
if ok && finalrun && (nofruns > 1) then
makeoptionfile(rawbase,jobname,orisuffix,true,finalrun,4,texruns) unless getvariable('nooptionfile')
diff --git a/Master/texmf-dist/scripts/context/ruby/ctxtools.rb b/Master/texmf-dist/scripts/context/ruby/ctxtools.rb
index 67baaab39c4..339f3d4906a 100644
--- a/Master/texmf-dist/scripts/context/ruby/ctxtools.rb
+++ b/Master/texmf-dist/scripts/context/ruby/ctxtools.rb
@@ -1,4 +1,5 @@
#!/usr/bin/env ruby
+#encoding: ASCII-8BIT
# program : ctxtools
# copyright : PRAGMA Advanced Document Engineering
@@ -553,7 +554,7 @@ class Commands
"tuo", "tub", "top", "tuc"
]
$dummyfiles = [
- "mpgraph"
+ # "mpgraph"
]
def removecontextfile (filename)
@@ -1852,8 +1853,6 @@ class Commands
ok = data.add_shebang(filename,'perl')
when /\.py$/ then
ok = data.add_shebang(filename,'python')
- when /\.lua$/ then
- ok = data.add_shebang(filename,'lua')
when /\.tex$/ then
ok = data.add_directive(filename,'tex')
when /\.mp$/ then
@@ -2696,11 +2695,7 @@ class Commands
def remakeformats
system("mktexlsr")
- system("luatools --selfupdate")
- system("mtxrun --selfupdate")
- system("luatools --generate")
system("texmfstart texexec --make --all --fast --pdftex")
- system("texmfstart texexec --make --all --fast --luatex")
system("texmfstart texexec --make --all --fast --xetex")
return true
end
diff --git a/Master/texmf-dist/scripts/context/ruby/fcd_start.rb b/Master/texmf-dist/scripts/context/ruby/fcd_start.rb
index 28f407c761e..b1fa42a2a69 100644
--- a/Master/texmf-dist/scripts/context/ruby/fcd_start.rb
+++ b/Master/texmf-dist/scripts/context/ruby/fcd_start.rb
@@ -38,6 +38,8 @@
# fcd [--find] whatever . (last choice with this pattern)
# fcd --list
+# todo: HOMEDRIVE\HOMEPATH
+
require 'rbconfig'
class FastCD
diff --git a/Master/texmf-dist/scripts/context/ruby/mtxtools.rb b/Master/texmf-dist/scripts/context/ruby/mtxtools.rb
deleted file mode 100644
index 41d0f7085b1..00000000000
--- a/Master/texmf-dist/scripts/context/ruby/mtxtools.rb
+++ /dev/null
@@ -1,475 +0,0 @@
-#!/usr/bin/env ruby
-
-# program : mtxtools
-# copyright : PRAGMA Advanced Document Engineering
-# version : 2004-2005
-# author : Hans Hagen
-#
-# info : j.hagen@xs4all.nl
-# www : www.pragma-ade.com
-
-# This script hosts MetaTeX related features.
-
-banner = ['MtxTools', 'version 1.0.0', '2006', 'PRAGMA ADE/POD']
-
-$: << File.expand_path(File.dirname($0)) ; $: << File.join($:.last,'lib') ; $:.uniq!
-
-require 'base/switch'
-require 'base/logger'
-require 'base/system'
-require 'base/kpse'
-
-class Reporter
- def report(str)
- puts(str)
- end
-end
-
-module ConTeXt
-
- def ConTeXt::banner(filename,companionname,compact=false)
- "-- filename : #{File.basename(filename)}\n" +
- "-- comment : companion to #{File.basename(companionname)} (in ConTeXt)\n" +
- "-- author : Hans Hagen, PRAGMA-ADE, Hasselt NL\n" +
- "-- copyright: PRAGMA ADE / ConTeXt Development Team\n" +
- "-- license : see context related readme files\n" +
- if compact then "\n-- remark : compact version\n" else "" end
- end
-
-end
-
-class UnicodeTables
-
- @@version = "1.001"
-
- @@shape_a = /^((GREEK|LATIN|HEBREW)\s*(SMALL|CAPITAL|)\s*LETTER\s*[A-Z]+)$/
- @@shape_b = /^((GREEK|LATIN|HEBREW)\s*(SMALL|CAPITAL|)\s*LETTER\s*[A-Z]+)\s*(.+)$/
-
- @@shape_a = /^(.*\s*LETTER\s*[A-Z]+)$/
- @@shape_b = /^(.*\s*LETTER\s*[A-Z]+)\s+WITH\s+(.+)$/
-
- attr_accessor :context, :comment
-
- def initialize(logger=Reporter.new)
- @data = Array.new
- @logger = logger
- @error = false
- @context = true
- @comment = true
- @shapes = Hash.new
- end
-
- def load_unicode_data(filename='unicodedata.txt')
- # beware, the unicodedata table is bugged, sometimes ending
- @logger.report("reading base data from #{filename}") if @logger
- begin
- IO.readlines(filename).each do |line|
- if line =~ /^[0-9A-F]{4,4}/ then
- d = line.chomp.sub(/\;$/, '').split(';')
- if d then
- while d.size < 15 do d << '' end
- n = d[0].hex
- @data[n] = d
- if d[1] =~ @@shape_a then
- @shapes[$1] = d[0]
- end
- end
- end
- end
- rescue
- @error = true
- @logger.report("error while reading base data from #{filename}") if @logger
- end
- end
-
- def load_context_data(filename='contextnames.txt')
- @logger.report("reading data from #{filename}") if @logger
- begin
- IO.readlines(filename).each do |line|
- if line =~ /^[0-9A-F]{4,4}/ then
- d = line.chomp.split(';')
- if d then
- n = d[0].hex
- if @data[n] then
- @data[d[0].hex] << d[1] # adobename == 15
- @data[d[0].hex] << d[2] # contextname == 16
- else
- @logger.report("missing information about #{d} in #{filename}") if @logger
- end
- end
- end
- end
- rescue
- @error = true
- @logger.report("error while reading context data from #{filename}") if @logger
- end
- end
-
- def save_metatex_data(filename='char-def.lua',compact=false)
- if not @error then
- begin
- File.open(filename,'w') do |f|
- @logger.report("saving data in #{filename}") if @logger
- f << ConTeXt::banner(filename,'char-def.tex',compact)
- f << "\n"
- f << "\nif not versions then versions = { } end versions['#{filename.gsub(/\..*?$/,'')}'] = #{@@version}\n"
- f << "\n"
- f << "if not characters then characters = { } end\n"
- f << "if not characters.data then characters.data = { } end\n"
- f << "\n"
- f << "characters.data = {\n" if compact
- @data.each do |d|
- if d then
- r = metatex_data(d)
- if compact then
- f << "\t" << "[0x#{d[0]}]".rjust(8,' ') << " = { #{r.join(", ").gsub(/\t/,'')} }, \n"
- else
- f << "characters.define { -- #{d[0].hex}" << "\n"
- f << r.join(",\n") << "\n"
- f << "}" << "\n"
- end
- end
- end
- f << "}\n" if compact
- end
- rescue
- @logger.report("error while saving data in #{filename}") if @logger
- else
- @logger.report("#{@data.size} (#{sprintf('%X',@data.size)}) entries saved in #{filename}") if @logger
- end
- else
- @logger.report("not saving data in #{filename} due to previous error") if @logger
- end
- end
-
- def metatex_data(d)
- r = Array.new
- r << "\tunicodeslot=0x#{d[0]}"
- if d[2] && ! d[2].empty? then
- r << "\tcategory='#{d[2].downcase}'"
- end
- if @context then
- if d[15] && ! d[15].empty? then
- r << "\tadobename='#{d[15]}'"
- end
- if d[16] && ! d[16].empty? then
- r << "\tcontextname='#{d[16]}'"
- end
- end
- if @comment then
- if d[1] == "<control>" then
- r << "\tdescription='#{d[10]}'" unless d[10].empty?
- else
- r << "\tdescription='#{d[1]}'" unless d[1].empty?
- end
- end
- if d[1] =~ @@shape_b then
- r << "\tshcode=0x#{@shapes[$1]}" if @shapes[$1]
- end
- if d[12] && ! d[12].empty? then
- r << "\tuccode=0x#{d[12]}"
- elsif d[14] && ! d[14].empty? then
- r << "\tuccode=0x#{d[14]}"
- end
- if d[13] && ! d[13].empty? then
- r << "\tlccode=0x#{d[13]}"
- end
- if d[5] && ! d[5].empty? then
- special, specials = '', Array.new
- c = d[5].split(/\s+/).collect do |cc|
- if cc =~ /^\<(.*)\>$/io then
- special = $1.downcase
- else
- specials << "0x#{cc}"
- end
- end
- if specials.size > 0 then
- special = 'char' if special.empty?
- r << "\tspecials={'#{special}',#{specials.join(',')}}"
- end
- end
- return r
- end
-
- def save_xetex_data(filename='enco-utf.tex')
- if not @error then
- begin
- minnumber, maxnumber, n = 0x001F, 0xFFFF, 0
- File.open(filename,'w') do |f|
- @logger.report("saving data in #{filename}") if @logger
- f << "% filename : #{filename}\n"
- f << "% comment : poor man's alternative for a proper enco file\n"
- f << "% this file is generated by mtxtools and can be\n"
- f << "% used in xetex and luatex mkii mode\n"
- f << "% author : Hans Hagen, PRAGMA-ADE, Hasselt NL\n"
- f << "% copyright: PRAGMA ADE / ConTeXt Development Team\n"
- f << "% license : see context related readme files\n"
- f << "\n"
- f << "\\ifx\\setcclcucx\\undefined\n"
- f << "\n"
- f << " \\def\\setcclcucx #1 #2 #3 %\n"
- f << " {\\global\\catcode\"#1=11 \n"
- f << " \\global\\lccode \"#1=\"#2 \n"
- f << " \\global\\uccode \"#1=\"#3 }\n"
- f << "\n"
- f << "\\fi\n"
- f << "\n"
- @data.each do |d|
- if d then
- number, type = d[0], d[2].downcase
- if number.hex >= minnumber && number.hex <= maxnumber && type =~ /^l(l|u|t)$/o then
- if d[13] && ! d[13].empty? then
- lc = d[13]
- else
- lc = number
- end
- if d[12] && ! d[12].empty? then
- uc = d[12]
- elsif d[14] && ! d[14].empty? then
- uc = d[14]
- else
- uc = number
- end
- if @comment then
- f << "\\setcclcuc #{number} #{lc} #{uc} % #{d[1]}\n"
- else
- f << "\\setcclcuc #{number} #{lc} #{uc} \n"
- end
- n += 1
- end
- end
- end
- f << "\n"
- f << "\\endinput\n"
- end
- rescue
- @logger.report("error while saving data in #{filename}") if @logger
- else
- @logger.report("#{n} entries saved in #{filename}") if @logger
- end
- else
- @logger.report("not saving data in #{filename} due to previous error") if @logger
- end
- end
-
-end
-
-class RegimeTables
-
- @@version = "1.001"
-
- def initialize(logger=Reporter.new)
- @logger = logger
- reset
- end
-
- def reset
- @code, @regime, @filename, @loaded = Array.new(256), '', '', false
- (32..127).each do |i|
- @code[i] = [sprintf('%04X',i), i.chr]
- end
- end
-
- def load(filename)
- begin
- reset
- if filename =~ /regi\-(ini|run|uni|utf|syn)/ then
- report("skipping #{filename}")
- else
- report("loading file #{filename}")
- @regime, unicodeset = File.basename(filename).sub(/\..*?$/,''), false
- IO.readlines(filename).each do |line|
- case line
- when /^\#/ then
- # skip
- when /^(0x[0-9A-F]+)\s+(0x[0-9A-F]+)\s+\#\s+(.*)$/ then
- @code[$1.hex], unicodeset = [$2, $3], true
- when /^(0x[0-9A-F]+)\s+(0x[0-9A-F]+)\s+/ then
- @code[$1.hex], unicodeset = [$2, ''], true
- end
- end
- reset if not unicodeset
- end
- rescue
- report("problem in loading file #{filename}")
- reset
- else
- if ! @regime.empty? then
- @loaded = true
- else
- reset
- end
- end
- end
-
- def save(filename,compact=false)
- begin
- if @loaded && ! @regime.empty? then
- if File.expand_path(filename) == File.expand_path(@filename) then
- report("saving in #{filename} is blocked")
- else
- report("saving file #{filename}")
- File.open(filename,'w') do |f|
- f << ConTeXt::banner(filename,'regi-ini.tex',compact)
- f << "\n"
- f << "\nif not versions then versions = { } end versions['#{filename.gsub(/\..*?$/,'')}'] = #{@@version}\n"
- f << "\n"
- f << "if not regimes then regimes = { } end\n"
- f << "if not regimes.data then regimes.data = { } end\n"
- f << "\n"
- if compact then
- f << "regimes.data[\"#{@regime}\"] = { [0] = \n\t"
- i = 17
- @code.each_index do |c|
- if (i-=1) == 0 then
- i = 16
- f << "\n\t"
- end
- if @code[c] then
- f << @code[c][0].rjust(6,' ')
- else
- f << "0x0000".rjust(6,' ')
- end
- f << ', ' if c<@code.length-1
- end
- f << "\n}\n"
- else
- @code.each_index do |c|
- if @code[c] then
- f << someregimeslot(@regime,c,@code[c][0],@code[c][1])
- else
- f << someregimeslot(@regime,c,'','')
- end
- end
- end
- end
- end
- end
- rescue
- report("problem in saving file #{filename} #{$!}")
- end
- end
-
- def report(str)
- @logger.report(str)
- end
-
- private
-
- def someregimeslot(regime,slot,unicodeslot,comment)
- "regimes.define { #{if comment.empty? then '' else '-- ' end} #{comment}\n" +
- "\tregime='#{regime}',\n" +
- "\tslot='#{sprintf('0x%02X',slot)}',\n" +
- "\tunicodeslot='#{if unicodeslot.empty? then '0x0000' else unicodeslot end}'\n" +
- "}\n"
- end
-
- public
-
- def RegimeTables::convert(filenames,compact=false)
- filenames.each do |filename|
- txtfile = File.expand_path(filename)
- luafile = File.join(File.dirname(txtfile),'regi-'+File.basename(txtfile.sub(/\..*?$/, '.lua')))
- unless txtfile == luafile then
- regime = RegimeTables.new
- regime.load(txtfile)
- regime.save(luafile,compact)
- end
- end
- end
-
-end
-
-class Commands
-
- include CommandBase
-
- def unicodetable
- unicode = UnicodeTables.new(logger)
- unicode.load_unicode_data
- unicode.load_context_data
- unicode.save_metatex_data('char-def.lua',@commandline.option('compact'))
- end
-
- def xetextable
- unicode = UnicodeTables.new(logger)
- unicode.load_unicode_data
- unicode.load_context_data
- # unicode.comment = false
- unicode.save_xetex_data
- end
-
- def regimetable
- if @commandline.arguments.length > 0 then
- RegimeTables::convert(@commandline.arguments, @commandline.option('compact'))
- else
- RegimeTables::convert(Dir.glob("cp*.txt") , @commandline.option('compact'))
- RegimeTables::convert(Dir.glob("8859*.txt") , @commandline.option('compact'))
- end
- end
-
- def pdftextable
- # instead of directly saving the data, we use luatex (kind of test)
- pdfrdef = 'pdfr-def.tex'
- tmpfile = 'mtxtools.tmp'
- File.delete(pdfrdef) rescue false
- if f = File.open(tmpfile,'w') then
- f << "\\starttext\n"
- f << "\\ctxlua{characters.pdftex.make_pdf_to_unicodetable('#{pdfrdef}')}\n"
- f << "\\stoptext\n"
- f.close()
- system("texmfstart texexec --luatex --once --purge mtxtools.tmp")
- report("vecor saved in #{pdfrdef}")
- end
- File.delete(tmpfile) rescue false
- end
-
- def xmlmapfile
- # instead of directly saving the data, we use luatex (kind of test)
- tmpfile = 'mtxtools.tmp'
- xmlsuffix = 'frx'
- @commandline.arguments.each do |mapname|
- if f = File.open(tmpfile,'w') then
- xmlname = mapname.gsub(/\.map$/,".#{xmlsuffix}")
- File.delete(xmlname) rescue false
- f << "\\starttext\n"
- f << "\\ctxlua{\n"
- f << " mapname = input.find_file(texmf.instance,'#{mapname}') or ''\n"
- f << " xmlname = '#{xmlname}'\n"
- f << " if mapname and not mapname:is_empty() then\n"
- f << " ctx.fonts.map.convert_file(mapname,xmlname)\n"
- f << " end\n"
- f << "}\n"
- f << "\\stoptext\n"
- f.close()
- system("texmfstart texexec --luatex --once --purge mtxtools.tmp")
- if FileTest.file?(xmlname) then
- report("map file #{mapname} converted to #{xmlname}")
- else
- report("no valid map file #{mapname}")
- end
- end
- end
- File.delete(tmpfile) rescue false
- end
-
-end
-
-logger = Logger.new(banner.shift)
-commandline = CommandLine.new
-
-commandline.registeraction('unicodetable', 'create unicode table for metatex/luatex')
-commandline.registeraction('regimetable' , 'create regime table(s) for metatex/luatex [--compact]')
-commandline.registeraction('xetextable' , 'create unicode table for xetex')
-commandline.registeraction('pdftextable' , 'create unicode table for xetex')
-commandline.registeraction('xmlmapfile' , 'convert traditional mapfile to xml font resourse')
-
-# general
-
-commandline.registeraction('help')
-commandline.registeraction('version')
-commandline.registerflag('compact')
-
-commandline.expand
-
-Commands.new(commandline,logger,banner).send(commandline.action || 'help')
diff --git a/Master/texmf-dist/scripts/context/ruby/rslibtool.rb b/Master/texmf-dist/scripts/context/ruby/rslibtool.rb
new file mode 100644
index 00000000000..7ae5efb647e
--- /dev/null
+++ b/Master/texmf-dist/scripts/context/ruby/rslibtool.rb
@@ -0,0 +1,114 @@
+# program : rslibtool
+# copyright : PRAGMA Publishing On Demand
+# version : 1.00 - 2002
+# author : Hans Hagen
+#
+# project : eXaMpLe
+# concept : Hans Hagen
+# info : j.hagen@xs4all.nl
+# www : www.pragma-pod.com / www.pragma-ade.com
+
+# --add --base=filename --path=directory pattern
+# --remove --base=filename --path=directory label
+# --sort --base=filename --path=directory
+# --purge --base=filename --path=directory
+# --dummy --base=filename
+# --namespace
+
+# rewrite
+
+unless defined? ownpath
+ ownpath = $0.sub(/[\\\/]\w*?\.rb/i,'')
+ $: << ownpath
+end
+
+require 'rslb/base'
+require 'xmpl/base'
+require 'xmpl/switch'
+
+session = Example.new('rslbtool', '1.0', 'PRAGMA POD')
+
+session.identify
+
+commandline = CommandLine.new
+
+commandline.registerflag('add')
+commandline.registerflag('remove')
+commandline.registerflag('delete')
+commandline.registerflag('sort')
+commandline.registerflag('purge')
+commandline.registerflag('dummy')
+commandline.registerflag('process')
+commandline.registerflag('namespace')
+
+commandline.registervalue('prefix')
+commandline.registervalue('base')
+commandline.registervalue('path')
+commandline.registervalue('result')
+commandline.registervalue('texexec')
+commandline.registervalue('zipalso')
+
+commandline.expand
+
+session.inherit(commandline)
+
+base = session.get('option.base')
+path = session.get('option.path')
+
+base = 'rslbtool.xml' if base.empty?
+
+# when path is given, assume that arg list is list of
+# suffixes, else assume it is a list of globbed filespec
+
+if path.empty?
+ base += '.xml' unless base =~ /\..+$/
+ list = commandline.arguments
+else
+ Dir.chdir(File.dirname(path))
+ list = Dir.glob("*.{#{commandline.arguments.join(',')}}")
+end
+
+begin
+ reslib = Resource.new(base,session.get('option.namespace'))
+ reslib.load(base)
+rescue
+ session.error('problems with loading base')
+ exit
+end
+
+unless session.get('option.texexec').empty?
+ reslib.set_texexec(session.get('option.texexec'))
+end
+
+if session.get('option.add')
+
+ session.report('adding records', list)
+ reslib.add_figures(list,session.get('option.prefix'))
+
+elsif session.get('option.remove') or session.get('option.delete')
+
+ session.report('removing records')
+ reslib.delete_figures(list)
+
+elsif session.get('option.sort')
+
+ session.report('sorting records')
+ reslib.sort_figures()
+
+elsif session.get('option.purge')
+
+ session.report('purging records')
+ reslib.purge_figures()
+
+elsif session.get('option.dummy')
+
+ session.report('creating dummy records')
+ reslib.create_dummies(session.get('option.process'),session.get('option.result'),session.get('option.zipalso'))
+
+else
+
+ session.warning('provide action')
+
+end
+
+reslib.save(base)
diff --git a/Master/texmf-dist/scripts/context/ruby/texexec.rb b/Master/texmf-dist/scripts/context/ruby/texexec.rb
index 94b14e4283c..32c9d0ca538 100644
--- a/Master/texmf-dist/scripts/context/ruby/texexec.rb
+++ b/Master/texmf-dist/scripts/context/ruby/texexec.rb
@@ -164,7 +164,8 @@ class Commands
if fast or (files.length > 0) then
if f = File.open(job.tempfilename('tex'),'w') then
files.delete("texexec.pdf")
- Kpse.runscript('rlxtools', ['--identify','--collect'], files.join(' ')) unless fast
+ # Kpse.runscript('rlxtools', ['--identify','--collect'], files.join(' ')) unless fast
+ system("texmfstart rlxtools --identify --collect #{files.join(' ')}")
figures = @commandline.checkedoption('method', 'a').downcase
paperoffset = @commandline.checkedoption('paperoffset', '0pt')
backspace = @commandline.checkedoption('backspace', '1.5cm')
@@ -226,7 +227,8 @@ class Commands
else
markfile = nil
end
- Kpse.runscript('ctxtools',ffname,'--document')
+ # Kpse.runscript('ctxtools',['--document'],ffname)
+ system("texmfstart ctxtools --document #{ffname}")
if ted = File.silentopen(File.suffixed(ffname,'ted')) then
firstline = ted.gets
if firstline =~ /interface=/o then
@@ -506,6 +508,7 @@ class Commands
combination = @commandline.checkedoption('combination','2*2').split(/[\*x]/o)
paperformat = @commandline.checkedoption('paperformat', 'A4*A4').split(/[\*x]/o)
bannerheight = @commandline.checkedoption('bannerheight', '')
+ pdftitle = @commandline.checkedoption('pdftitle', '')
nx, ny = combination[0] || '2', combination[1] || combination[0] || '2'
from, to = paperformat[0] || 'A4', paperformat[1] || paperformat[0] || 'A4'
f << "\\setuppapersize[#{from}][#{to}]\n"
@@ -523,8 +526,10 @@ class Commands
f << "\\setuplayout[footer=0cm]\n"
f << "\\setupbackgrounds[page][background=]\n"
end
- f << "\\setupexternalfigures\n"
- f << " [directory=]\n"
+ f << "\\setupexternalfigures[directory=]\n"
+ if not pdftitle.empty? then
+ f << "\\setupinteraction[state=start,title={#{pdftitle}}]\n"
+ end
f << "\\starttext\n"
files.each do |filename|
result = @commandline.checkedoption('result','texexec')
@@ -582,8 +587,6 @@ job.setvariable('given.backend',job.getvariable('backend'))
if (str = @commandline.option('engine')) && ! str.standard? && ! str.empty? then
job.setvariable('texengine',str)
- elsif @commandline.oneof('luatex') then
- job.setvariable('texengine','luatex')
elsif @commandline.oneof('pdfetex','pdftex','pdf') then
job.setvariable('texengine','pdftex')
elsif @commandline.oneof('xetex','xtx') then
@@ -598,7 +601,7 @@ job.setvariable('given.backend',job.getvariable('backend'))
if (str = @commandline.option('backend')) && ! str.standard? && ! str.empty? then
job.setvariable('backend',str)
- elsif @commandline.oneof('pdfetex','pdftex','pdf','luatex') then
+ elsif @commandline.oneof('pdfetex','pdftex','pdf') then
job.setvariable('backend','pdftex')
elsif @commandline.oneof('dvipdfmx','dvipdfm','dpx','dpm') then
job.setvariable('backend','dvipdfmx')
@@ -616,7 +619,6 @@ job.setvariable('given.backend',job.getvariable('backend'))
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 'petex' then job.setvariable('backend','dvipdfmx')
when 'aleph' then job.setvariable('backend','dvipdfmx')
@@ -756,7 +758,6 @@ end
commandline.registerflag('pdf')
commandline.registerflag('pdftex')
commandline.registerflag('pdfetex')
-commandline.registerflag('luatex')
commandline.registerflag('dvipdfmx')
commandline.registerflag('dvipdfm')
diff --git a/Master/texmf-dist/scripts/context/ruby/texmfstart.rb b/Master/texmf-dist/scripts/context/ruby/texmfstart.rb
index 97087c3ae40..be892c83ced 100755
--- a/Master/texmf-dist/scripts/context/ruby/texmfstart.rb
+++ b/Master/texmf-dist/scripts/context/ruby/texmfstart.rb
@@ -158,7 +158,6 @@ $runners = Hash.new
$suffixinputs['pl'] = 'PERLINPUTS'
$suffixinputs['rb'] = 'RUBYINPUTS'
$suffixinputs['py'] = 'PYTHONINPUTS'
-$suffixinputs['lua'] = 'LUAINPUTS'
$suffixinputs['jar'] = 'JAVAINPUTS'
$suffixinputs['pdf'] = 'PDFINPUTS'
@@ -183,7 +182,6 @@ $predefined['pdftools'] = 'pdftools.rb'
$predefined['mpstools'] = 'mpstools.rb'
# $predefined['exatools'] = 'exatools.rb'
$predefined['xmltools'] = 'xmltools.rb'
-# $predefined['luatools'] = 'luatools.lua'
# $predefined['mtxtools'] = 'mtxtools.rb'
$predefined['newpstopdf'] = 'pstopdf.rb'
@@ -213,12 +211,11 @@ $makelist = [
'texfind',
'texshow'
#
- # no 'luatools',
# no 'mtxtools',
# no, 'texmfstart'
]
-$scriptlist = 'rb|pl|py|lua|jar'
+$scriptlist = 'rb|pl|py|jar'
$documentlist = 'pdf|ps|eps|htm|html'
$editor = ENV['TEXMFSTART_EDITOR'] || ENV['EDITOR'] || ENV['editor'] || 'scite'
@@ -230,7 +227,6 @@ def set_applications(page=1)
$applications['unknown'] = ''
$applications['ruby'] = $applications['rb'] = 'ruby'
- $applications['lua'] = $applications['lua'] = 'lua'
$applications['perl'] = $applications['pl'] = 'perl'
$applications['python'] = $applications['py'] = 'python'
$applications['java'] = $applications['jar'] = 'java'
@@ -248,8 +244,6 @@ def set_applications(page=1)
$applications['htm'] = $applications['html']
$applications['eps'] = $applications['ps']
- $runners['lua'] = "texlua"
-
end
set_applications()