summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2005-06-07 00:00:00 +0200
committerHans Hagen <pragma@wxs.nl>2005-06-07 00:00:00 +0200
commitdfec7488b8da12222bdaa42df6f5585b2b89fd70 (patch)
tree030829e7a439c387abf81dadb0cc6b7f248218da
parentaf0834c7d9f8d76f86b00ff31fc2d469684637f0 (diff)
downloadcontext-dfec7488b8da12222bdaa42df6f5585b2b89fd70.tar.gz
stable 2005.06.07
-rw-r--r--scripts/context/ruby/ctxtools.rb90
-rw-r--r--scripts/context/ruby/newtexutil.rb611
-rw-r--r--scripts/context/ruby/textools.rb4
-rw-r--r--tex/context/base/context.tex2
-rw-r--r--tex/context/base/core-fnt.tex4
-rw-r--r--tex/context/base/core-reg.tex8
-rw-r--r--tex/context/base/core-ver.tex2
-rw-r--r--tex/context/base/enco-ini.tex2
-rw-r--r--tex/context/base/font-ini.tex26
-rw-r--r--tex/context/base/lang-dis.tex4
-rw-r--r--tex/context/base/spec-tr.tex6
-rw-r--r--tex/context/interface/keys-cz.xml2
-rw-r--r--tex/context/interface/keys-de.xml2
-rw-r--r--tex/context/interface/keys-en.xml2
-rw-r--r--tex/context/interface/keys-it.xml2
-rw-r--r--tex/context/interface/keys-nl.xml2
-rw-r--r--tex/context/interface/keys-ro.xml2
-rw-r--r--web2c/context.cnf6
18 files changed, 686 insertions, 91 deletions
diff --git a/scripts/context/ruby/ctxtools.rb b/scripts/context/ruby/ctxtools.rb
index 4e69d9534..c90299b0a 100644
--- a/scripts/context/ruby/ctxtools.rb
+++ b/scripts/context/ruby/ctxtools.rb
@@ -767,31 +767,6 @@ class Language
@remapping.push([from,to])
end
- # def load(filenames=@filenames)
- # begin
- # if filenames then
- # @filenames = [filenames].flatten
- # @filenames.each do |filename|
- # begin
- # if filename = located(filename) then
- # data = IO.read(filename)
- # @data += data.gsub(/\%.*$/, '')
- # data.gsub!(/(\\patterns|\\hyphenation)\s*\{.*/mo) do '' end
- # @read += "\n% preamble of file #{filename}\n\n#{data}\n"
- # else
- # report("file #{filename} is not found")
- # end
- # rescue
- # report("file #{filename} is not readable")
- # else
- # report("file #{filename} is loaded")
- # end
- # end
- # end
- # rescue
- # end
- # end
-
def load(filenames=@filenames)
begin
if filenames then
@@ -1146,51 +1121,54 @@ class Commands
languages = []
end
languages.each do |language|
- files = @@languagedata[language][0] || ''
- encoding = @@languagedata[language][1] || ''
+ encoding = @@languagedata[language][0] || ''
+ files = @@languagedata[language][1] || []
Language::generate(self,language,files,encoding)
end
end
private
- # todo: take fallback list from context
+ # todo: filter the fallback list from context
+
+ # The first entry in the array is the encoding which will be used
+ # when interpreting th eraw patterns. The second entry is a list of
+ # filesets (string|aray), each first match of a set is taken.
- @@languagedata['ba' ] = [['bahyph.tex'], 'ec']
- @@languagedata['ca' ] = [['cahyph.tex'], 'ec']
- @@languagedata['cy' ] = [['cyhyph.tex'], 'ec']
- @@languagedata['cz' ] = [['czhyphen.tex','czhyphen.ex'], 'ec']
- @@languagedata['de' ] = [['dehyphn.tex'], 'ec']
- @@languagedata['deo'] = [['dehypht.tex'], 'ec']
- @@languagedata['da' ] = [['dkspecial.tex','dkcommon.tex'], 'ec']
+ @@languagedata['ba' ] = [ 'ec' , ['bahyph.tex'] ]
+ @@languagedata['ca' ] = [ 'ec' , ['cahyph.tex'] ]
+ @@languagedata['cy' ] = [ 'ec' , ['cyhyph.tex'] ]
+ @@languagedata['cz' ] = [ 'ec' , ['czhyphen.tex','czhyphen.ex'] ]
+ @@languagedata['de' ] = [ 'ec' , ['dehyphn.tex'] ]
+ @@languagedata['deo'] = [ 'ec' , ['dehypht.tex'] ]
+ @@languagedata['da' ] = [ 'ec' , ['dkspecial.tex','dkcommon.tex'] ]
# elhyph.tex
- @@languagedata['es' ] = [['eshyph.tex'], 'ec']
- @@languagedata['fi' ] = [['ethyph.tex'], 'ec']
- @@languagedata['fi' ] = [['fihyph.tex'], 'ec']
- @@languagedata['fr' ] = [['frhyph.tex'], 'ec']
+ @@languagedata['es' ] = [ 'ec' , ['eshyph.tex'] ]
+ @@languagedata['fi' ] = [ 'ec' , ['ethyph.tex'] ]
+ @@languagedata['fi' ] = [ 'ec' , ['fihyph.tex'] ]
+ @@languagedata['fr' ] = [ 'ec' , ['frhyph.tex'] ]
# ghyphen.readme ghyph31.readme grphyph
- @@languagedata['hr' ] = [['hrhyph.tex'], 'ec']
- @@languagedata['hu' ] = [['huhyphn.tex'], 'ec']
- @@languagedata['en' ] = [[['ushyph','hyphen.tex']], 'default']
- @@languagedata['en' ] = [['ushyph.tex'], 'default']
+ @@languagedata['hr' ] = [ 'ec' , ['hrhyph.tex'] ]
+ @@languagedata['hu' ] = [ 'ec' , ['huhyphn.tex'] ]
+ @@languagedata['en' ] = [ 'default' , [['ushyphmax.tex','ushyph.tex','hyphen.tex']] ]
# inhyph.tex
- @@languagedata['is' ] = [['ishyph.tex'], 'ec']
- @@languagedata['it' ] = [['ithyph.tex'], 'ec']
- @@languagedata['la' ] = [['lahyph.tex'], 'ec']
+ @@languagedata['is' ] = [ 'ec' , ['ishyph.tex'] ]
+ @@languagedata['it' ] = [ 'ec' , ['ithyph.tex'] ]
+ @@languagedata['la' ] = [ 'ec' , ['lahyph.tex'] ]
# mnhyph
- @@languagedata['nl' ] = [['nehyph96.tex'], 'ec']
- @@languagedata['no' ] = [['nohyph.tex'], 'ec']
+ @@languagedata['nl' ] = [ 'ec' , ['nehyph96.tex'] ]
+ @@languagedata['no' ] = [ 'ec' , ['nohyph.tex'] ]
# oldgrhyph.tex
- @@languagedata['pl' ] = [['plhyph.tex'], 'ec']
- @@languagedata['pt' ] = [['pthyph.tex'], 'ec']
- @@languagedata['ro' ] = [['rohyph.tex'], 'ec']
- @@languagedata['sl' ] = [['sihyph.tex'], 'ec']
- @@languagedata['sk' ] = [['skhyphen.tex','skhyphen.ex'], 'ec']
+ @@languagedata['pl' ] = [ 'ec' , ['plhyph.tex'] ]
+ @@languagedata['pt' ] = [ 'ec' , ['pthyph.tex'] ]
+ @@languagedata['ro' ] = [ 'ec' , ['rohyph.tex'] ]
+ @@languagedata['sl' ] = [ 'ec' , ['sihyph.tex'] ]
+ @@languagedata['sk' ] = [ 'ec' , ['skhyphen.tex','skhyphen.ex'] ]
# sorhyph.tex / upper sorbian
# srhyphc.tex / cyrillic
- @@languagedata['sv' ] = [['svhyph.tex'], 'ec']
- @@languagedata['tr' ] = [['tkhyph.tex'], 'ec']
- @@languagedata['uk' ] = [[['ukhyph','ukhyphen.tex']], 'default']
+ @@languagedata['sv' ] = [ 'ec' , ['svhyph.tex'] ]
+ @@languagedata['tr' ] = [ 'ec' , ['tkhyph.tex'] ]
+ @@languagedata['uk' ] = [ 'default' , [['ukhyphen.tex','ukhyph.tex']] ]
end
diff --git a/scripts/context/ruby/newtexutil.rb b/scripts/context/ruby/newtexutil.rb
new file mode 100644
index 000000000..001bdde68
--- /dev/null
+++ b/scripts/context/ruby/newtexutil.rb
@@ -0,0 +1,611 @@
+#D Plugins
+#D
+#D test.pm:
+#D
+#D \starttypen
+#D see plugtest.pm
+#D \stoptypen
+#D
+#D utility format:
+#D
+#D \starttypen
+#D p u {name} {data} {data} ...
+#D \stoptypen
+
+# my $pm_path ;
+
+# BEGIN
+ # { $pm_path = "$FindBin::Bin/" ;
+ # if ($pm_path eq "") { $pm_path = "./" } }
+
+# use lib $pm_path ;
+
+# my %UserPlugIns ;
+
+# sub HandlePlugIn
+ # { if ($RestOfLine =~ /\s*u\s*\{(.*?)\}\s*(.*)\s*/io)
+ # { my $tag = $1 ;
+ # my $arg = $2 ;
+ # if (! defined($UserPlugIns{$tag}))
+ # { $UserPlugIns{$tag} = 1 ;
+ # eval("use $tag") ;
+ # my $result = $tag->identify ;
+ # if ($result ne "")
+ # { Report ("PlugInInit", "$tag -> $result") }
+ # else
+ # { Report ("PlugInInit", $tag ) }
+ # $tag->initialize() }
+ # if (defined($UserPlugIns{$tag}))
+ # { $arg =~ s/\{(.*)\}/$1/o ;
+ # my @args = split(/\}\s*\{/o, $arg) ;
+ # $tag->handle(@args) } } }
+
+# sub FlushPlugIns
+ # { foreach my $tag (keys %UserPlugIns)
+ # { my @report = $tag->report ;
+ # foreach $rep (@report)
+ # { my ($key,$val) = split (/\s*\:\s*/,$rep) ;
+ # if ($val ne "")
+ # { Report ("PlugInReport", "$tag -> $key -> $val") }
+ # else
+ # { Report ("PlugInReport", "$tag -> $key") } }
+ # $tag->process ;
+ # print TUO "%\n" . "% $Program / " . $tag->identify . "\n" . "%\n" ;
+ # foreach my $str ($tag->results)
+ # { print TUO "\\plugincommand\{$str\}\n" } } }
+
+require "base/file"
+
+def report(str)
+ puts(str)
+end
+
+class String
+
+ # real dirty, but inspect does a pretty good escaping but
+ # unfortunately puts quotes around the string so we need
+ # to strip these
+
+ # def escaped
+ # self.inspect[1,self.inspect.size-2]
+ # end
+
+ def escaped
+ str = self.inspect ; str[1,str.size-2]
+ end
+
+end
+
+class Sorter
+
+ def initialize(max=12)
+ @rep, @map, @exp = Hash.new, Hash.new, Hash.new
+ @max = max
+ @rexa, @rexb = nil, nil
+ end
+
+ def replace(from,to='') # and expand
+ @rep[from.escaped] = to || ''
+ end
+
+ # sorter.reduce('ch', 'c')
+ # sorter.reduce('ij', 'y')
+
+ def reduce(from,to='')
+ @map[from] = to || ''
+ end
+
+ # sorter.expand('aeligature', 'ae')
+ # sorter.expand('ijligature', 'y')
+
+ def expand(from,to=nil)
+ @exp[from] = to || from || ''
+ end
+
+ # shortcut("\\ab\\cd\\e\\f", 'iacute')
+ # shortcut("\\\'\\i", 'iacute')
+ # shortcut("\\\'i", 'iacute')
+ # shortcut("\\\"e", 'ediaeresis')
+ # shortcut("\\\'o", 'oacute')
+
+ def shortcut(from,to)
+ replace(from,to)
+ expand(to)
+ end
+
+ def prepare
+ @rexa = /(#{@rep.keys.join('|')})/o
+ if @map.size > 0 then
+ # watch out, order of match matters
+ @rexb = /(\\[a-zA-Z]+|#{@map.keys.join('|')}|.)\s*/o
+ else
+ @rexb = /(\\[a-zA-Z]+|.)\s*/o
+ end
+ end
+
+ def remap(str)
+ str.gsub(@rexa) do
+ @rep[$1.escaped]
+ end.gsub(@rexb) do
+ token = $1.sub(/\\/o, '')
+ if @map.key?(token) then
+ @map[token].ljust(@max,' ')
+ elsif @exp.key?(token) then
+ @exp[token].split('').collect do |t|
+ t.ljust(@max,' ')
+ end.join('')
+ else
+ ''
+ end
+ end
+ end
+
+ def remap(str)
+ str.gsub(@rexa) do
+ @rep[$1.escaped]
+ end.gsub(@rexb) do
+ token = $1.sub(/\\/o, '')
+ if @exp.key?(token) then
+ @exp[token].ljust(@max,' ')
+ elsif @map.key?(token) then
+ @map[token].ljust(@max,' ')
+ else
+ ''
+ end
+ end
+ end
+
+ def preset(language='')
+ 'a'.upto('z') do |c|
+ expand(c)
+ end
+ shortcut("\\\'\\i", 'iacute')
+ shortcut("\\\'i", 'iacute')
+ shortcut("\\\"e", 'ediaeresis')
+ shortcut("\\\'o", 'oacute')
+ expand('aeligature', 'ae')
+ expand('ijligature', 'y')
+ expand('eacute')
+ expand('egrave')
+ expand('ediaeresis')
+ # reduce('ch', 'c')
+ # reduce('ij', 'y')
+ # expand('aeligature', 'ae')
+ # expand('ijligature', 'y')
+ # expand('tex')
+ end
+
+ def simplify(str)
+ s = str.dup
+ # ^^
+ # s.gsub!(/\^\^([a-f0-9][a-f0-9])/o, $1.hex.chr)
+ # \- ||
+ s.gsub!(/(\\\-|\|\|)/o) do '-' end
+ # {}
+ s.gsub!(/\{\}/o) do '' end
+ # <*..> (internal xml entity)
+ s.gsub!(/<\*(.*?)>/o) do $1 end
+ # entities
+ s.gsub!(/\\getXMLentity\s*\{(.*?)\}/o) do $1 end
+ # elements
+ s.gsub!(/\<.*?>/o) do '' end
+ # what to do with xml and utf-8
+ # \"e etc
+ # unknown \cs
+ s.gsub!(/\\[a-z][a-z]+\s*\{(.*?)\}/o) do $1 end
+ return s
+ end
+
+end
+
+class Synonym
+
+ @@debug = true
+
+ def initialize(t, c, k, d)
+ @type, @command, @key, @sortkey, @data = t, c, k, k, d
+ end
+
+ attr_reader :type, :command, :key, :data
+ attr_reader :sortkey
+ attr_writer :sortkey
+
+ def build(sorter)
+ @sortkey = sorter.remap(sorter.simplify(@key.downcase))
+ if @sortkey.empty? then
+ @sortkey = sorter.remap(@command.downcase)
+ end
+ end
+
+ def <=> (other)
+ @sortkey <=> other.sortkey
+ end
+
+ def Synonym.flush(list,handle)
+ if @@debug then
+ list.each do |entry|
+ handle << "% [#{entry.sortkey}]\n"
+ end
+ end
+ list.each do |entry|
+ handle << "\\synonymentry{#{entry.type}}{#{entry.command}}{#{entry.key}}{#{entry.data}}\n"
+ end
+ end
+
+end
+
+class Register
+
+ @@debug = true
+
+ @@howto = /^(.*?)\:\:(.*)$/o
+ @@split = ' && '
+
+ def initialize(state, t, l, k, e, s, p, r)
+ @state, @type, @location, @key, @entry, @seetoo, @page, @realpage = state, t, l, k, e, s, p, r
+ if @key =~ @@howto then @pagehowto, @key = $1, $2 else @pagehowto = '' end
+ if @entry =~ @@howto then @texthowto, @entry = $1, $2 else @texthowto = '' end
+ @key = @entry.dup if @key.empty?
+ @sortkey = @key.dup
+ end
+
+ attr_reader :state, :type, :location, :key, :entry, :seetoo, :page, :realpage, :texthowto, :pagehowto
+ attr_reader :sortkey
+ attr_writer :sortkey
+
+ def build(sorter)
+ @entry, @key = [@entry, @key].collect do |target|
+ # +a+b+c &a&b&c a+b+c a&b&c
+ case target[0,1]
+ when '&' then target = target.sub(/^./o,'').gsub(/([^\\])\&/o) do "#{$1}#{@@split}" end
+ when '+' then target = target.sub(/^./o,'').gsub(/([^\\])\+/o) do "#{$1}#{@@split}" end
+ else target = target .gsub(/([^\\])[\&\+]/o) do "#{$1}#{@@split}" end
+ end
+ # {a}{b}{c}
+ if target =~ /^\{(.*)\}$/o then
+ $1.split(/\} \{/o).join(@@split) # space between } { is mandate
+ else
+ target
+ end
+ end
+ @sortkey = sorter.simplify(@key)
+ @sortkey = @sortkey.split(@@split).collect do |c| sorter.remap(c) end.join(@@split)
+ # if ($Key eq "") { $Key = SanitizedString($Entry) }
+ # if ($ProcessHigh){ $Key = HighConverted($Key) }
+ @sortkey = [
+ @sortkey.downcase,
+ @sortkey,
+ @texthowto.ljust(10,' '),
+ @state,
+ @realpage.rjust(6,' '),
+ @pagehowto
+ ].join(@@split)
+ end
+
+ def <=> (other)
+ @sortkey <=> other.sortkey
+ end
+
+ # more module like
+
+ @@savedhowto, @@savedfrom, @@savedto, @@savedentry = '', '', '', '', ''
+ @@collapse = false
+
+ def Register.flushsavedline(handle)
+ if @@collapse && ! @@savedfrom.empty? then
+ if ! @@savedto.empty? then
+ handle << "\\registerfrom#{@@savedfrom}"
+ handle << "\\registerto#{@@savedto}"
+ else
+ handle << "\\registerpage#{@@savedfrom}"
+ end
+ end
+ @@savedhowto, @@savedfrom, @@savedto, @@savedentry = '', '', '', ''
+ end
+
+ def Register.flush(list,handle)
+ #
+ # alphaclass can go, now flushed per class
+ #
+ if list.size > 0 then
+ nofentries, nofpages = 0, 0
+ current, previous, howto = Array.new, Array.new, Array.new
+ lastpage, lastrealpage = '', ''
+ alphaclass, alpha = '', ''
+ @@savedhowto, @@savedfrom, @@savedto, @@savedentry = '', '', '', ''
+
+ if @@debug then
+ list.each do |entry|
+ handle << "% [#{entry.sortkey[0,1]}] [#{entry.sortkey.gsub(/#{@@split}/o,'] [')}]\n"
+ end
+ end
+ list.each do |entry|
+ testalpha = entry.sortkey[0,1].downcase
+ if testalpha != alpha.downcase or alphaclass != entry.class then
+ alpha = testalpha
+ alphaclass = entry.class
+ if alpha != ' ' then
+ flushsavedline(handle)
+ character = alpha.sub(/([^a-zA-Z])/o) do "\\" + $1 end
+ handle << "\\registerentry{#{entry.type}}{#{character}}\n"
+ end
+ end
+ current = [entry.entry.split(@@split),'','',''].flatten
+ howto = current.collect do |e|
+ e + '::' + entry.texthowto
+ end
+ if howto[0] == previous[0] then
+ current[0] = ''
+ else
+ previous[0] = howto[0].dup
+ previous[1] = ''
+ previous[2] = ''
+ end
+ if howto[1] == previous[1] then
+ current[1] = ''
+ else
+ previous[1] = howto[1].dup
+ previous[2] = ''
+ end
+ if howto[2] == previous[2] then
+ current[2] = ''
+ else
+ previous[2] = howto[2].dup
+ end
+ copied = false
+ unless current[0].empty? then
+ Register.flushsavedline(handle)
+ handle << "\\registerentrya{#{entry.type}}{#{current[0]}}\n"
+ copied = true
+ end
+ unless current[1].empty? then
+ Register.flushsavedline(handle)
+ handle << "\\registerentryb{#{entry.type}}{#{current[1]}}\n"
+ copied = true
+ end
+ unless current[2].empty? then
+ Register.flushsavedline(handle)
+ handle << "\\registerentryc{#{entry.type}}{#{current[2]}}\n"
+ copied = true
+ end
+ nofentries += 1 if copied
+ if entry.realpage.to_i == 0 then
+ Register.flushsavedline(handle)
+ handle << "\\registersee{#{entry.type}}{#{entry.pagehowto},#{entry.texthowto}}{#{entry.seetoo}}{#{entry.page}}\n" ;
+ lastpage, lastrealpage = entry.page, entry.realpage
+ elsif @@savedhowto != entry.pagehowto and ! entry.pagehowto.empty? then
+ @@savedhowto = entry.pagehowto
+ end
+ if copied || ! ((lastpage == entry.page) && (lastrealpage == entry.realpage)) then
+ nextentry = "{#{entry.type}}{#{previous[0]}}{#{previous[1]}}{#{previous[2]}}{#{entry.pagehowto},#{entry.texthowto}}"
+ savedline = "{#{entry.type}}{#{@@savedhowto},#{entry.texthowto}}{#{entry.location}}{#{entry.page}}{#{entry.realpage}}"
+ if entry.state == 1 then # from
+ Register.flushsavedline(handle)
+ handle << "\\registerfrom#{savedline}\n"
+ elsif entry.state == 3 then # to
+ Register.flushsavedline(handle)
+ handle << "\\registerto#{savedline}\n"
+ elsif @@collapse then
+ if savedentry != nextentry then
+ savedFrom = savedline
+ else
+ savedTo, savedentry = savedline, nextentry
+ end
+ else
+ handle << "\\registerpage#{savedline}\n"
+ end
+ nofpages += 1
+ lastpage, lastrealpage = entry.page, entry.realpage
+ end
+ end
+ Register.flushsavedline(handle)
+ report("register #{list[0].class}: #{nofentries} entries and #{nofpages} pages")
+ end
+ end
+
+end
+
+class TeXUtil
+
+ # how to deal with encoding:
+ #
+ # load context enco-* file
+
+ def initialize
+ @commands = []
+ @programs = []
+ @synonyms = Hash.new
+ @registers = Hash.new
+ @files = Hash.new
+ @filename = 'texutil'
+ @fatalerror = false
+ end
+
+ def loaded(filename)
+ # begin
+ File.open(File.suffixed(filename,'tui')).each do |line|
+ case line.chomp
+ # f b|e {filename}
+ when /^f (b|e) \{(.*)\}$/o then
+ if @files.key?($2) then @files[$2] += 1 else @files[$2] = 1 end
+ # c commmand
+ when /^c (.*)$/o then
+ @commands.push($1)
+ # e p {program data}
+ when /^e p \{(.*)\}$/o then
+ @programs.push($1)
+ # s e {type}{command}{key}{associated data}
+ when /^s e \{(.*)\}\s*\{(.*)\}\s*\{(.*)\}\s*\{(.*)\}\s*$/o then
+ @synonyms[$1] = Array.new unless @synonyms.key?($1)
+ @synonyms[$1].push(Synonym.new($1,$2,$3,$4))
+ # from: r f
+ when /^r f \{(.*)\}\s*\{(.*)\}\s*\{(.*)\}\s*\{(.*)\}\s*\{(.*)\}\s*\{(.*)\}\s*/o then
+ @registers[$1] = Array.new unless @registers.key?($1)
+ @registers[$1].push(Register.new(1,$1,$2,$3,$4,nil,$5,$6))
+ # entry: r e {type}{location}{key}{entry}{page}{realpage}
+ when /^r e \{(.*)\}\s*\{(.*)\}\s*\{(.*)\}\s*\{(.*)\}\s*\{(.*)\}\s*\{(.*)\}\s*/o then
+ @registers[$1] = Array.new unless @registers.key?($1)
+ @registers[$1].push(Register.new(2,$1,$2,$3,$4,nil,$5,$6))
+ # from: r t
+ when /^r t \{(.*)\}\s*\{(.*)\}\s*\{(.*)\}\s*\{(.*)\}\s*\{(.*)\}\s*\{(.*)\}\s*/o then
+ @registers[$1] = Array.new unless @registers.key?($1)
+ @registers[$1].push(Register.new(3,$1,$2,$3,$4,nil,$5,$6))
+ # see: r s {type}{location}{key}{entry}{seetoo}{page}
+ when /^r s \{(.*)\}\s*\{(.*)\}\s*\{(.*)\}\s*\{(.*)\}\s*\{(.*)\}\s*\{(.*)\}\s*/o then
+ @registers[$1] = Array.new unless @registers.key?($1)
+ @registers[$1].push(Register.new(4,$1,$2,$3,$4,$5,$6,nil))
+ when /^k /o then
+ # key
+ when /^p /o then
+ # plugin
+ when /^q/o then
+ break
+ else
+ report("unknown entry #{line}")
+ end
+ end
+ # rescue
+ # report("error in parsing file (#{$!})")
+ # @filename = 'texutil'
+ # else
+ @filename = filename
+ # end
+ end
+
+ def sorted
+ sorter = Sorter.new
+ sorter.preset
+ sorter.prepare
+ [@synonyms,@registers].each do |target|
+ target.keys.each do |s|
+ target[s].each_index do |i|
+ target[s][i].build(sorter)
+ end
+ target[s] = target[s].sort
+ end
+ end
+ end
+
+ def banner(str)
+ report(str)
+ return "%\n% #{str}\n%\n"
+ end
+
+ def saved(filename=@filename)
+ if @fatalerror then
+ report("fatal error, no tuo file saved")
+ else
+ # begin
+ if f = File.open(File.suffixed(filename,'tuo'),'w') then
+ if @files.size > 0 then
+ f << banner("loaded files: #{@files.size}")
+ @files.keys.sort.each do |k|
+ unless (@files[k] % 2) == 0 then
+ report("check loading of file #{k}, begin/end problem")
+ end
+ f << "% > #{k} #{@files[k]/2}\n"
+ end
+ end
+ if @commands.size > 0 then
+ f << banner("commands: #{@commands.size}")
+ @commands.each do |c|
+ f << "#{c}\n"
+ end
+ end
+ if @synonyms.size > 0 then
+ @synonyms.keys.sort.each do |s|
+ f << banner("synonyms: #{s} #{@synonyms[s].size}")
+ Synonym.flush(@synonyms[s],f)
+ end
+ end
+ if @registers.size > 0 then
+ @registers.keys.sort.each do |s|
+ f << banner("registers: #{s} #{@registers[s].size}")
+ Register.flush(@registers[s],f)
+ end
+ end
+ if @programs.size > 0 then
+ f << banner("programs: #{@programs.size}")
+ @programs.each do |p|
+ f << "% #{p} (#{@programs[p]})\n"
+ end
+ end
+ f.close
+ @programs.each do |p|
+ cmd = "texmfstart #{@programs[p]}"
+ report("running #{cmd}")
+ system(cmd)
+ end
+ end
+ # rescue
+ # report("fatal error when saving file (#{$!})")
+ # end
+ end
+ end
+
+end
+
+if tu = TeXUtil.new and tu.loaded('tuitest') then
+ tu.sorted
+ tu.saved
+end
+
+ # ShowBanner ;
+
+# if ($UnknownOptions ) { ShowHelpInfo } # not yet done
+# elsif ($ProcessReferences) { HandleReferences }
+# elsif ($ProcessFigures ) { HandleFigures }
+# elsif ($ProcessLogFile ) { HandleLogFile }
+# elsif ($PurgeFiles ) { my $args = @ARGV.join(' ') ; system("texmfstart ctxtools --purge $args") }
+# elsif ($PurgeAllFiles ) { my $args = @ARGV.join(' ') ; system("texmfstart ctxtools --purgeall $args") }
+# elsif ($ProcessDocuments ) { my $args = @ARGV.join(' ') ; system("texmfstart ctxtools --document $args") }
+# elsif ($AnalyzeFile ) { my $args = @ARGV.join(' ') ; system("texmfstart pdftools --analyze $args") }
+# elsif ($FilterPages ) { my $args = @ARGV.join(' ') ; system("texmfstart ctxtools --filter $args") }
+# elsif ($ProcessHelp ) { ShowHelpInfo } # redundant
+# else { ShowHelpInfo }
+
+#D So far.
+
+
+# # # # keep
+
+# sorter = Sorter.new
+# sorter.reduce('ch', 'c')
+# sorter.reduce('ij', 'y')
+
+# sorter.expand('aeligature', 'ae')
+# sorter.expand('ijligature', 'y')
+
+# str = Array.new
+
+# str.push 'aex c abc'
+# str.push 'aex h abc'
+# str.push 'aex ch abc'
+# str.push 'aex a abc'
+# str.push 'aex b abc'
+# str.push 'aex c def'
+# str.push 'aex h def'
+# str.push 'aex ch def'
+# str.push 'aex a def'
+# str.push 'aex b def'
+# str.push 'a\eacute x'
+# str.push 'a\egrave x'
+# str.push 'a\ediaeresis x'
+# str.push 'a\ediaeresis'
+# str.push '\aeligature xx'
+# str.push '+abc'
+# str.push 'ijs'
+# str.push 'ijverig'
+# str.push '\ijligature verig'
+# str.push 'ypsilon'
+
+# old = str.dup
+
+# str.collect! do |s|
+ # sorter.remap(s)
+# end
+
+# str.sort.each do |i|
+ # puts i
+# end
+
diff --git a/scripts/context/ruby/textools.rb b/scripts/context/ruby/textools.rb
index 9057e318c..a0a98e8c2 100644
--- a/scripts/context/ruby/textools.rb
+++ b/scripts/context/ruby/textools.rb
@@ -723,7 +723,7 @@ class Commands
public
- def merge
+ def mergeupdate
nocheck = @commandline.option('nocheck')
force = @commandline.option('force')
@@ -811,7 +811,7 @@ commandline.registeraction('fixafmfiles' , '[pattern] [--recurse]')
commandline.registeraction('mactodos' , '[pattern] [--recurse]')
commandline.registeraction('fixtexmftrees' , '[texmfroot] [--force]')
commandline.registeraction('replace' , 'filename [--force]')
-commandline.registeraction('merge' , 'fromroot toroot [--force --nocheck]')
+commandline.registeraction('mergeupdate' , 'fromroot toroot [--force --nocheck]')
commandline.registeraction('downcasefilenames', '[--recurse] [--force]') # not yet documented
commandline.registeraction('stripformfeeds' , '[--recurse] [--force]') # not yet documented
commandline.registeraction('showfont' , 'filename')
diff --git a/tex/context/base/context.tex b/tex/context/base/context.tex
index 8bc75f1ae..05b9cf46a 100644
--- a/tex/context/base/context.tex
+++ b/tex/context/base/context.tex
@@ -31,7 +31,7 @@
%D 2004.8.30 the low level interface is english. Watch out and adapt
%D your styles an modules.
-\def\contextversion{2005.06.03}
+\def\contextversion{2005.06.07}
%D Welcome to the main module. When this module is ran through
%D \type{initex} or \type {tex -i} or \type {whatevertex} using
diff --git a/tex/context/base/core-fnt.tex b/tex/context/base/core-fnt.tex
index befb41369..7d0fe57a5 100644
--- a/tex/context/base/core-fnt.tex
+++ b/tex/context/base/core-fnt.tex
@@ -167,10 +167,10 @@
\doifelse\@@kktitle\v!yes
{\definealternativestyle[\v!capital][\normalsmallcapped][\normalsmallcapped]%
\definealternativestyle[\v!smallcaps][\sc][\sc]%
- \let\smallcapped\normalsmallcapped}
+ \unexpanded\def\smallcapped{\normalsmallcapped}}
{\definealternativestyle[\v!capital][\normalsmallcapped][\uppercased]%
\definealternativestyle[\v!smallcaps][\sc][\uppercased]%
- \def\smallcapped{\doconvertfont\v!capital}}%
+ \unexpanded\def\smallcapped{\doconvertfont\v!capital}}%
\doifelse\@@kksc\v!yes
\userealcaps
\usepseudocaps}
diff --git a/tex/context/base/core-reg.tex b/tex/context/base/core-reg.tex
index 3ac39782c..4341a85c7 100644
--- a/tex/context/base/core-reg.tex
+++ b/tex/context/base/core-reg.tex
@@ -86,10 +86,10 @@
\ifduplicate\getlastregisterentry{#3}\fi
\convertexpanded{\registerparameter\c!keyexpansion}{#1}\asciiregisterentryA
\convertexpanded{\registerparameter\c!expansion }{#3}\asciiregisterentryB
-\doifsomething{\registerparameter\c!keyexpansion}
- {\ifx\asciiregisterentryA\empty
- \convertexpanded{\registerparameter\c!keyexpansion}{#3}\asciiregisterentryA
- \fi}%
+ \doifsomething{\registerparameter\c!keyexpansion}
+ {\ifx\asciiregisterentryA\empty
+ \convertexpanded{\registerparameter\c!keyexpansion}{#3}\asciiregisterentryA
+ \fi}%
\makesectionformat
\doifelse{\registerparameter\c!ownnumber}\v!yes
\donetrue\donefalse
diff --git a/tex/context/base/core-ver.tex b/tex/context/base/core-ver.tex
index df4baf807..4add36b8d 100644
--- a/tex/context/base/core-ver.tex
+++ b/tex/context/base/core-ver.tex
@@ -152,7 +152,7 @@
{\doifvalue{#1\c!tab}\s!ascii
{\chardef\tabskipmode\plustwo % quit on >127
\def\obeytabs{\settabskips}}%
- {}}
+ {}}%
%
\ignorehyphens % default
\ExpandFirstAfter\processaction
diff --git a/tex/context/base/enco-ini.tex b/tex/context/base/enco-ini.tex
index e8b79143c..6e7ae5120 100644
--- a/tex/context/base/enco-ini.tex
+++ b/tex/context/base/enco-ini.tex
@@ -822,7 +822,7 @@
{\let\doautosetregime\gobbletwoarguments}
{\def\characterregime{@#2@}}}
-\def\stopencoding%
+\def\stopencoding
{\popmacro\doautosetregime
\popmacro\definesortkey
\popmacro\dohandlecommand % still needed?
diff --git a/tex/context/base/font-ini.tex b/tex/context/base/font-ini.tex
index 88b6b5939..f459b99c0 100644
--- a/tex/context/base/font-ini.tex
+++ b/tex/context/base/font-ini.tex
@@ -4510,25 +4510,25 @@
\definefontsize[\c!a] \definefontsize[\c!b]
\definefontsize[\c!c] \definefontsize[\c!d]
-\definealternativestyle [\v!mediaeval] [\os] []
-\definealternativestyle [\v!normal] [\tf] []
-\definealternativestyle [\v!bold] [\bf] []
-\definealternativestyle [\v!type] [\tt] []
-\definealternativestyle [\v!slanted] [\sl] []
-\definealternativestyle [\v!italic] [\it] []
+\definealternativestyle [\v!mediaeval] [\os] []
+\definealternativestyle [\v!normal] [\tf] []
+\definealternativestyle [\v!bold] [\bf] []
+\definealternativestyle [\v!type] [\tt] []
+\definealternativestyle [\v!slanted] [\sl] []
+\definealternativestyle [\v!italic] [\it] []
\definealternativestyle [\v!boldslanted,\v!slantedbold] [\bs] []
-\definealternativestyle [\v!bolditalic,\v!italicbold] [\bi] []
-\definealternativestyle [\v!small,\v!smallnormal] [\tfx] []
-\definealternativestyle [\v!smallbold] [\bfx] []
-\definealternativestyle [\v!smalltype] [\ttx] []
-\definealternativestyle [\v!smallslanted] [\slx] []
+\definealternativestyle [\v!bolditalic,\v!italicbold] [\bi] []
+\definealternativestyle [\v!small,\v!smallnormal] [\tfx] []
+\definealternativestyle [\v!smallbold] [\bfx] []
+\definealternativestyle [\v!smalltype] [\ttx] []
+\definealternativestyle [\v!smallslanted] [\slx] []
\definealternativestyle [\v!smallboldslanted,\v!smallslantedbold] [\bsx] []
-\definealternativestyle [\v!smallbolditalic,\v!smallitalicbold] [\bix] []
+\definealternativestyle [\v!smallbolditalic,\v!smallitalicbold] [\bix] []
%D Slow but handy:
\definealternativestyle [\v!smallbodyfont] [\setsmallbodyfont] []
-\definealternativestyle [\v!bigbodyfont] [\setbigbodyfont] []
+\definealternativestyle [\v!bigbodyfont] [\setbigbodyfont] []
%D We treat {\sc Small Caps} and \cap {Pseudo Caps} a bit
%D different. We also provide an \WORD {uppercase} style.
diff --git a/tex/context/base/lang-dis.tex b/tex/context/base/lang-dis.tex
index 43a8e015f..58b95f681 100644
--- a/tex/context/base/lang-dis.tex
+++ b/tex/context/base/lang-dis.tex
@@ -45,8 +45,8 @@
\definefilefallback [lang-sv.pat] [svhyph.tex,sehyph.tex]
\definefilefallback [lang-tr.pat] [tkhyph.tex,trhyph.tex]
\definefilefallback [lang-ua.pat] [ukrenhyp.tex]
-\definefilefallback [lang-uk.pat] [ukhyph.tex,ukhyphmax.tex,ukhyph1.tex,ukhyph2.tex,hyphen.tex]
-\definefilefallback [lang-us.pat] [ushyph.tex,ushyphmax.tex,ushyph1.tex,ushyph2.tex,hyphen.tex]
+\definefilefallback [lang-uk.pat] [ukhyphen.tex,ukhyph.tex]
+\definefilefallback [lang-us.pat] [ushyphmax.tex,ushyph.tex,ushyph1.tex,ushyph2.tex,hyphen.tex]
\definefilefallback [lang-nl.pat] [nehyph96.tex,dutch96.pat,nehyph.tex]
\definefilefallback [lang-cz.pat] [czhyphen.tex,czhyph.pat]
\definefilefallback [lang-sk.pat] [skhyphen.tex,skhyph.pat]
diff --git a/tex/context/base/spec-tr.tex b/tex/context/base/spec-tr.tex
index 34e5ac257..2631f399e 100644
--- a/tex/context/base/spec-tr.tex
+++ b/tex/context/base/spec-tr.tex
@@ -107,7 +107,11 @@
%D Relatively new:
\definespecial\dosetuppaper#1#2#3%
- {\special{papersize=#2,#3}}
+ {\begingroup
+ \!!dimena#2%
+ \!!dimenb#3%
+ \special{papersize=\the\!!dimena,\the\!!dimenb}%
+ \endgroup}
\stopspecials
diff --git a/tex/context/interface/keys-cz.xml b/tex/context/interface/keys-cz.xml
index cab46b7c0..6284f36ff 100644
--- a/tex/context/interface/keys-cz.xml
+++ b/tex/context/interface/keys-cz.xml
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
-<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="cz" version="2005.06.03">
+<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="cz" version="2005.06.07">
<cd:variables>
<cd:variable name="one" value="jedna"/>
diff --git a/tex/context/interface/keys-de.xml b/tex/context/interface/keys-de.xml
index 3f8fa46c4..ca03949b4 100644
--- a/tex/context/interface/keys-de.xml
+++ b/tex/context/interface/keys-de.xml
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
-<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="de" version="2005.06.03">
+<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="de" version="2005.06.07">
<cd:variables>
<cd:variable name="one" value="eins"/>
diff --git a/tex/context/interface/keys-en.xml b/tex/context/interface/keys-en.xml
index 16791d296..7a65adf12 100644
--- a/tex/context/interface/keys-en.xml
+++ b/tex/context/interface/keys-en.xml
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
-<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="en" version="2005.06.03">
+<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="en" version="2005.06.07">
<cd:variables>
<cd:variable name="one" value="one"/>
diff --git a/tex/context/interface/keys-it.xml b/tex/context/interface/keys-it.xml
index 393e87259..9fd7a06be 100644
--- a/tex/context/interface/keys-it.xml
+++ b/tex/context/interface/keys-it.xml
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
-<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="it" version="2005.06.03">
+<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="it" version="2005.06.07">
<cd:variables>
<cd:variable name="one" value="uno"/>
diff --git a/tex/context/interface/keys-nl.xml b/tex/context/interface/keys-nl.xml
index ef03ee44f..c6ea1b19c 100644
--- a/tex/context/interface/keys-nl.xml
+++ b/tex/context/interface/keys-nl.xml
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
-<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="nl" version="2005.06.03">
+<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="nl" version="2005.06.07">
<cd:variables>
<cd:variable name="one" value="een"/>
diff --git a/tex/context/interface/keys-ro.xml b/tex/context/interface/keys-ro.xml
index 212dde427..bd0c5e0dc 100644
--- a/tex/context/interface/keys-ro.xml
+++ b/tex/context/interface/keys-ro.xml
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
-<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="ro" version="2005.06.03">
+<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="ro" version="2005.06.07">
<cd:variables>
<cd:variable name="one" value="unu"/>
diff --git a/web2c/context.cnf b/web2c/context.cnf
index 0cf35914a..d0635ed5c 100644
--- a/web2c/context.cnf
+++ b/web2c/context.cnf
@@ -43,6 +43,8 @@ WEB2C = $TEXMF/web2c
OSFONTDIR =
+TEXPSHEADERS = .;$TEXMF/{fonts/{enc,map,type1,truetype},dvips,pdftex,tex}//;$TEXMF/{etex,tex,pdftex,dvips,fonts/type1}//
+
TEXFONTMAPS.dvipdfm = .;$TEXMF/fonts/map/{dvipdfm,dvips,}//
TEXFONTMAPS.dvipdfmx = .;$TEXMF/fonts/map/{dvipdfm,dvips,}//
TEXFONTMAPS.pdftex = .;$TEXMF/fonts/map/{pdftex,dvips,}//
@@ -50,8 +52,8 @@ TEXFONTMAPS.pdfetex = .;$TEXMF/fonts/map/{pdftex,dvips,}//
TEXFONTMAPS.xetex = .;$TEXMF/fonts/map/{xetex,pdftex,dvips,}//
TEXFONTMAPS.dvips = .;$TEXMF/fonts/map/{dvips,pdftex,}//
-TEXPSHEADERS = .;$TEXMF/{fonts/{enc,map,type1,truetype},dvips,pdftex,tex}//;$TEXMF/{etex,tex,pdftex,dvips,fonts/type1}//
-TEXFONTMAPS = .;$TEXMF/{fonts/map/{$backend,pdftex,dvips,}//,fontname};$TEXMF/{pdftex,dvips}/config;$TEXMF/{pdftex,dvips}//
+# TEXFONTMAPS = .;$TEXMF/fonts/map/{$backend,pdftex,dvips,}//;$TEXMF/{$progname,pdftex,dvips}/{config,}//
+TEXFONTMAPS = .;$TEXMF/fonts/map/{$progname,pdftex,dvips,}//;$TEXMF/{$progname,pdftex,dvips}/{config,}//
VFFONTS = .;$TEXMF/fonts/vf//
TFMFONTS = .;{$TEXMF/fonts,$VARTEXFONTS}/tfm//