summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--context/data/type-buy.dat5
-rw-r--r--fonts/map/pdftex/context/pdftex.map1
-rw-r--r--scripts/context/perl/texexec.pl129
-rw-r--r--scripts/context/ruby/base/file.rb6
-rw-r--r--scripts/context/ruby/base/kpse.rb6
-rw-r--r--scripts/context/ruby/base/tex.rb513
-rw-r--r--scripts/context/ruby/base/texutil.rb790
-rw-r--r--scripts/context/ruby/base/variables.rb8
-rw-r--r--scripts/context/ruby/ctxtools.rb82
-rw-r--r--scripts/context/ruby/newtexexec.rb35
-rw-r--r--scripts/context/ruby/newtexutil.rb601
-rw-r--r--scripts/context/ruby/texmfstart.rb2
-rw-r--r--tex/context/base/colo-ini.tex7
-rw-r--r--tex/context/base/cont-new.tex385
-rw-r--r--tex/context/base/cont-old.tex42
-rw-r--r--tex/context/base/core-box.tex16
-rw-r--r--tex/context/base/core-des.tex2
-rw-r--r--tex/context/base/core-fig.tex4
-rw-r--r--tex/context/base/core-int.tex2
-rw-r--r--tex/context/base/core-itm.tex51
-rw-r--r--tex/context/base/core-job.tex4
-rw-r--r--tex/context/base/core-new.tex9
-rw-r--r--tex/context/base/core-rul.tex168
-rw-r--r--tex/context/base/core-sec.tex3
-rw-r--r--tex/context/base/core-spa.tex78
-rw-r--r--tex/context/base/enco-cyr.tex2
-rw-r--r--tex/context/base/enco-ini.tex16
-rw-r--r--tex/context/base/font-ini.tex53
-rw-r--r--tex/context/base/lang-ini.tex4
-rw-r--r--tex/context/base/mult-sys.tex1
-rw-r--r--tex/context/base/page-imp.tex2
-rw-r--r--tex/context/base/page-ini.tex6
-rw-r--r--tex/context/base/page-lin.tex48
-rw-r--r--tex/context/base/page-lyr.tex11
-rw-r--r--tex/context/base/page-mar.tex17
-rw-r--r--tex/context/base/page-mul.tex32
-rw-r--r--tex/context/base/page-one.tex34
-rw-r--r--tex/context/base/page-set.tex86
-rw-r--r--tex/context/base/s-pre-00.tex4
-rw-r--r--tex/context/base/s-pre-60.tex1
-rw-r--r--tex/context/base/s-pre-61.tex22
-rw-r--r--tex/context/base/spec-tpd.tex3
-rw-r--r--tex/context/base/supp-fil.tex24
-rw-r--r--tex/context/base/supp-pdf.tex60
-rw-r--r--tex/context/base/syst-ext.tex62
-rw-r--r--tex/context/base/syst-new.tex29
-rw-r--r--tex/context/base/type-buy.tex50
-rw-r--r--tex/context/base/type-cbg.tex14
-rw-r--r--tex/context/base/type-ini.tex24
-rw-r--r--tex/context/base/type-pre.tex5
-rw-r--r--tex/context/base/unic-033.tex138
-rw-r--r--tex/context/base/unic-034.tex311
-rw-r--r--tex/context/base/verb-ini.tex4
-rw-r--r--tex/context/base/xtag-ini.tex37
-rw-r--r--tex/context/base/xtag-map.tex7
-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
61 files changed, 2583 insertions, 1485 deletions
diff --git a/context/data/type-buy.dat b/context/data/type-buy.dat
index 8f8ac0a16..5036a713d 100644
--- a/context/data/type-buy.dat
+++ b/context/data/type-buy.dat
@@ -119,3 +119,8 @@
--en=? --ve=itc --co=bauhaus --re
--en=? --ve=itc --co=bauhaus --so=itc/bauhaus --ma --in
--en=? --ve=itc --co=bauhaus --so=itc/bauhaus --sl=* --pattern=bh*
+
+# ef swift
+
+--en=? --ve=ef --co=swift --re
+--en=? --ve=ef --co=swift --so=ef/swift --ma --in --pattern=sw*
diff --git a/fonts/map/pdftex/context/pdftex.map b/fonts/map/pdftex/context/pdftex.map
deleted file mode 100644
index 25e75fa06..000000000
--- a/fonts/map/pdftex/context/pdftex.map
+++ /dev/null
@@ -1 +0,0 @@
-% empty file
diff --git a/scripts/context/perl/texexec.pl b/scripts/context/perl/texexec.pl
index 263388a4c..9a8f2bff0 100644
--- a/scripts/context/perl/texexec.pl
+++ b/scripts/context/perl/texexec.pl
@@ -155,6 +155,7 @@ my $ProducePdfT = 0;
my $ProducePdfM = 0;
my $ProducePdfX = 0;
my $ProducePdfXTX = 0;
+my $ProducePs = 0;
my $Input = "";
my $Result = '';
my $Suffix = '';
@@ -263,6 +264,7 @@ my $MakeMpy = '';
"pdx" => \$ProducePdfX,
"dpx" => \$ProducePdfX,
"xtx" => \$ProducePdfXTX,
+ "ps" => \$ProducePs,
"pdfarrange" => \$PdfArrange,
"pdfselect" => \$PdfSelect,
"pdfcombine" => \$PdfCombine,
@@ -380,6 +382,7 @@ if ( $DoMPTeX || $DoMPXTeX ) {
$ProducePdfX = 0;
$ProducePdfM = 0;
$ProducePdfXTX = 0;
+ $ProducePs = 0;
}
if ( $PdfArrange || $PdfSelect || $PdfCopy || $PdfTrim || $PdfCombine ) {
@@ -391,6 +394,7 @@ if ($ProducePdfT) { $OutputFormat = "pdftex" }
elsif ($ProducePdfM) { $OutputFormat = "dvipdfm" }
elsif ($ProducePdfX) { $OutputFormat = "dvipdfmx" }
elsif ($ProducePdfXTX) { $OutputFormat = "xetex" }
+elsif ($ProducePs) { $OutputFormat = "dvips" }
if ( $ProducePdfXTX ) {
$TeXProgram = 'xetex' ; # ignore the default pdfetex engine
@@ -884,6 +888,7 @@ $OutputFormats{pdftex} = "pdftex"; $OutputFormats{pdf} = "pdftex";
$OutputFormats{dvipdfm} = "dvipdfm"; $OutputFormats{dpm} = "dvipdfm";
$OutputFormats{dvipdfmx} = "dvipdfmx"; $OutputFormats{dpx} = "dvipdfmx";
$OutputFormats{xetex} = "xetex"; $OutputFormats{xtx} = "xetex";
+$OutputFormats{dvips} = "dvips"; $OutputFormats{ps} = "dvips";
# kind of obsolete now that yandy is gone
@@ -1405,6 +1410,7 @@ sub ScanTeXPreamble {
$ProducePdfM = ($OutputFormat eq "dvipdfm") ;
$ProducePdfX = ($OutputFormat eq "dvipdfmx") ;
$ProducePdfXTX = ($OutputFormat eq "xetex") ;
+ $ProducePs = ($OutputFormat eq "dvips") ;
}
sub ScanContent {
@@ -1480,14 +1486,17 @@ sub PrepRunTeX {
return $cmd;
}
+my $emergencyend = "" ;
+#~ my $emergencyend = "\\emergencyend" ;
+
sub RunTeX {
my ( $JobName, $JobSuffix ) = @_;
my $StartTime = time;
my $cmd = PrepRunTeX($JobName, $JobSuffix, '');
if ($EnterBatchMode) {
- $Problems = System("$cmd");
+ $Problems = System("$cmd $emergencyend");
} else {
- $Problems = System("$cmd");
+ $Problems = System("$cmd $emergencyend");
}
my $StopTime = time - $StartTime;
print "\n return code : $Problems";
@@ -1729,7 +1738,7 @@ sub RunConTeXtFile {
} elsif (/\<\?context\-directive\s+(.+?)\s+(.+?)\s+(.+?)\s*\?\>/o) {
my ($class, $key, $value) = ($1, $2, $3) ;
if ($class eq 'job') {
- if ($key eq 'stylefile') {
+ if (($key eq 'stylefile') || ($key eq 'environment')) {
print TMP "\\environment $value\n" ;
} elsif ($key eq 'module') {
print TMP "\\usemodule[$value]\n" ;
@@ -1838,7 +1847,7 @@ sub RunConTeXtFile {
$tubchecksumafter = CheckTubChanges($JobName) ;
if ($AutoMPRun) { $mpchecksumafter = CheckMPChanges($JobName) }
if ( ( !$Problems ) && ( $NOfRuns > 1 ) ) {
- if ( !$NoMPMode ) {
+ unless ( $NoMPMode ) {
$MPrundone = RunTeXMP( $JobName, "mpgraph" );
$MPrundone = RunTeXMP( $JobName, "mprun" );
}
@@ -1879,6 +1888,21 @@ sub RunConTeXtFile {
$ENV{'backend'} = $ENV{'progname'} = 'xetex' ;
$ENV{'TEXFONTMAPS'} = '.;$TEXMF/fonts/map/{xetex,pdftex,dvips,}//' ;
System("xdv2pdf $JobName.xdv") ;
+ } elsif ($ProducePs) {
+ $ENV{'backend'} = $ENV{'progname'} = 'dvips' ;
+ $ENV{'TEXFONTMAPS'} = '.;$TEXMF/fonts/map/{dvips,pdftex,}//' ;
+ # temp hack, some day there will be map file loading in specials
+ my $mapfiles = '' ;
+ if (-f "$JobName.tui") {
+ open(TUI,"$JobName.tui") ;
+ while (<TUI>) {
+ if (/c \\usedmapfile\{.\}\{(.*?)\}/o) {
+ $mapfiles .= "-u +$1 " ;
+ }
+ }
+ close(TUI) ;
+ }
+ System("dvips $mapfiles $JobName.dvi") ;
}
PopResult($JobName);
}
@@ -1938,6 +1962,50 @@ sub RunModule {
# the next one can be more efficient: directly process ted
# file a la --use=abr-01,mod-01
+sub checktexformatpath {
+ # engine support is either broken of not implemented in some
+ # distributions, so we need to take care of it ourselves
+ my $texformats ;
+ if (defined($ENV{'TEXFORMATS'})) {
+ $texformats = $ENV{'TEXFORMATS'} ;
+ } else {
+ $texformats = '' ;
+ }
+ if ($texformats eq '') {
+ if ($UseEnginePath) {
+ if ($dosish) {
+ $texformats = `kpsewhich --engine=$TeXExecutable --expand-var=\$TEXFORMATS` ;
+ } else {
+ $texformats = `kpsewhich --engine=$TeXExecutable --expand-var=\\\$TEXFORMATS` ;
+ }
+ } else {
+ if ($dosish) {
+ $texformats = `kpsewhich --expand-var=\$TEXFORMATS` ;
+ } else {
+ $texformats = `kpsewhich --expand-var=\\\$TEXFORMATS` ;
+ }
+ }
+ chomp($texformats) ;
+ }
+ if (($texformats !~ /web2c\/.*$TeXExecutable/) && ($texformats !~ /web2c[\/\\].*\$engine/i)) {
+ $texformats =~ s/(web2c\/\{)(\,\})/$1\$engine$2/ ; # needed for empty engine flags
+ if ($texformats !~ /web2c[\/\\].*\$ENGINE/) {
+ $texformats =~ s/web2c/web2c\/{\$engine,}/ ; # needed for me
+ }
+ $ENV{'TEXFORMATS'} = $texformats ;
+ print " fixing texformat path : $ENV{'TEXFORMATS'}\n";
+ } else {
+ print " using texformat path : $ENV{'TEXFORMATS'}\n" if ($Verbose) ;
+ }
+ if (! defined($ENV{'ENGINE'})) {
+ if ($MpEngineSupport) {
+ $ENV{'ENGINE'} .= $MpExecutable ;
+ } ;
+ $ENV{'ENGINE'} = $TeXExecutable ;
+ print "fixing engine variable : $ENV{'ENGINE'}\n";
+ }
+}
+
sub DoRunModule {
my ( $FileName, $FileSuffix ) = @_;
RunPerlScript( $TeXUtil, "--documents $FileName.$FileSuffix" );
@@ -1959,8 +2027,8 @@ sub DoRunModule {
print MOD "\\readlocfile{$FileName.ted}{}{}\n";
print MOD "\\stoptext\n";
close(MOD);
+ checktexformatpath ;
RunConTeXtFile( $ModuleFile, "tex" );
-
if ( $FileName ne $ModuleFile ) {
foreach my $FileSuffix ( "dvi", "pdf", "tui", "tuo", "log" ) {
unlink("$FileName.$FileSuffix");
@@ -1998,6 +2066,7 @@ sub RunFigures {
print FIG "\\stoptext\n";
close(FIG);
$ConTeXtInterface = "en";
+ checktexformatpath ;
RunConTeXtFile( $FiguresFile, "tex" );
unlink('texutil.tuf') if ( -f 'texutil.tuf' );
}
@@ -2038,6 +2107,7 @@ sub RunListing {
print LIS "\\stoptext\n";
close(LIS);
$ConTeXtInterface = "en";
+ checktexformatpath ;
RunConTeXtFile( $ListingFile, "tex" );
}
@@ -2083,6 +2153,7 @@ sub RunArrange {
print ARR "\\stoptext\n";
close(ARR);
$ConTeXtInterface = "en";
+ checktexformatpath ;
RunConTeXtFile( $ModuleFile, "tex" );
}
@@ -2131,6 +2202,7 @@ sub RunSelect {
print SEL "\\stoptext\n";
close(SEL);
$ConTeXtInterface = "en";
+ checktexformatpath ;
RunConTeXtFile( $SelectFile, "tex" );
}
@@ -2181,6 +2253,7 @@ sub RunCopy {
print COP "\\stoptext\n";
close(COP);
$ConTeXtInterface = "en";
+ checktexformatpath ;
RunConTeXtFile( $CopyFile, "tex" );
}
@@ -2231,6 +2304,7 @@ sub RunCombine {
print COM "\\stoptext\n";
close(COM);
$ConTeXtInterface = "en";
+ checktexformatpath ;
RunConTeXtFile( $CombineFile, "tex" );
}
@@ -2432,50 +2506,6 @@ sub RunMpFormat {
my $dir = File::Temp::tempdir(CLEANUP=>1) ;
my ($fh, $filename) = File::Temp::tempfile(DIR=>$dir, UNLINK=>1);
-sub checktexformatpath {
- # engine support is either broken of not implemented in some
- # distributions, so we need to take care of it ourselves
- my $texformats ;
- if (defined($ENV{'TEXFORMATS'})) {
- $texformats = $ENV{'TEXFORMATS'} ;
- } else {
- $texformats = '' ;
- }
- if ($texformats eq '') {
- if ($UseEnginePath) {
- if ($dosish) {
- $texformats = `kpsewhich --engine=$TeXExecutable --expand-var=\$TEXFORMATS` ;
- } else {
- $texformats = `kpsewhich --engine=$TeXExecutable --expand-var=\\\$TEXFORMATS` ;
- }
- } else {
- if ($dosish) {
- $texformats = `kpsewhich --expand-var=\$TEXFORMATS` ;
- } else {
- $texformats = `kpsewhich --expand-var=\\\$TEXFORMATS` ;
- }
- }
- chomp($texformats) ;
- }
- if (($texformats !~ /web2c\/.*$TeXExecutable/) && ($texformats !~ /web2c[\/\\].*\$engine/i)) {
- $texformats =~ s/(web2c\/\{)(\,\})/$1\$engine$2/ ; # needed for empty engine flags
- if ($texformats !~ /web2c[\/\\].*\$ENGINE/) {
- $texformats =~ s/web2c/web2c\/{\$engine,}/ ; # needed for me
- }
- $ENV{'TEXFORMATS'} = $texformats ;
- print " fixing texformat path : $ENV{'TEXFORMATS'}\n";
- } else {
- print " using texformat path : $ENV{'TEXFORMATS'}\n" if ($Verbose) ;
- }
- if (! defined($ENV{'ENGINE'})) {
- if ($MpEngineSupport) {
- $ENV{'ENGINE'} .= $MpExecutable ;
- } ;
- $ENV{'ENGINE'} = $TeXExecutable ;
- print "fixing engine variable : $ENV{'ENGINE'}\n";
- }
-}
-
sub RunFiles {
my $currentpath = cwd() ;
my $oldrunpath = $RunPath ;
@@ -2819,6 +2849,7 @@ sub RunMPX {
open( TMP, ">>$MpTex" );
print TMP "\\end\n"; # to be sure
close(TMP);
+ checktexformatpath ;
if ( ( $Format eq '' ) || ( $Format =~ /^cont.*/io ) ) {
RunConTeXtFile( $MpTmp, "tex" );
} else {
diff --git a/scripts/context/ruby/base/file.rb b/scripts/context/ruby/base/file.rb
index b7170d555..f6189043c 100644
--- a/scripts/context/ruby/base/file.rb
+++ b/scripts/context/ruby/base/file.rb
@@ -4,7 +4,11 @@ class File
def File.suffixed(name,sufa,sufb=nil)
if sufb then
- unsuffixed(name) + "-#{sufa}.#{sufb}"
+ if sufa.empty? then
+ unsuffixed(name) + ".#{sufb}"
+ else
+ unsuffixed(name) + "-#{sufa}.#{sufb}"
+ end
else
unsuffixed(name) + ".#{sufa}"
end
diff --git a/scripts/context/ruby/base/kpse.rb b/scripts/context/ruby/base/kpse.rb
index 7073ad017..a5e2ecac2 100644
--- a/scripts/context/ruby/base/kpse.rb
+++ b/scripts/context/ruby/base/kpse.rb
@@ -284,12 +284,14 @@ module Kpse
def Kpse.runscript(name,filename=[],options=[])
setscript(name,`texmfstart --locate #{name}`) unless @@scripts.key?(name)
- system("#{@@scripts[name]} #{[options].flatten.join(' ')} #{[filename].flatten.join(' ')}")
+ 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)
- `#{@@scripts[name]} #{[options].flatten.join(' ')} #{[filename].flatten.join(' ')}`
+ cmd = "#{@@scripts[name]} #{[options].flatten.join(' ')} #{[filename].flatten.join(' ')}"
+ `#{cmd}`
end
private
diff --git a/scripts/context/ruby/base/tex.rb b/scripts/context/ruby/base/tex.rb
index cea6662ae..2be0548d3 100644
--- a/scripts/context/ruby/base/tex.rb
+++ b/scripts/context/ruby/base/tex.rb
@@ -11,6 +11,8 @@
# todo: write systemcall for mpost to file so that it can be run
# faster
+# report ?
+
require 'base/variables'
require 'base/kpse'
require 'base/system'
@@ -18,6 +20,30 @@ require 'base/state'
require 'base/pdf'
require 'base/file'
+class String
+
+ def standard?
+ begin
+ self == 'standard'
+ rescue
+ false
+ end
+ end
+
+end
+
+class Array
+
+ def standard?
+ begin
+ self.include?('standard')
+ rescue
+ false
+ end
+ end
+
+end
+
class TEX
# The make-part of this class was made on a rainy day while listening
@@ -33,42 +59,65 @@ class TEX
@@texformats = Hash.new
@@mpsformats = Hash.new
@@prognames = Hash.new
+ @@texmakestr = Hash.new
+ @@texprocstr = Hash.new
+ @@mpsmakestr = Hash.new
+ @@mpsprocstr = Hash.new
- ['tex','pdftex','pdfetex','standard'] .each do |e| @@texengines[e] = 'pdfetex' end
- ['aleph','omega'] .each do |e| @@texengines[e] = 'aleph' end
- ['xetex'] .each do |e| @@texengines[e] = 'xetex' end
+ @@texmethods = Hash.new
+ @@mpsmethods = Hash.new
- ['metapost','mpost','standard'] .each do |e| @@mpsengines[e] = 'mpost' end
+ ['tex','pdftex','pdfetex','standard'] .each do |e| @@texengines[e] = 'pdfetex' end
+ ['aleph','omega'] .each do |e| @@texengines[e] = 'aleph' end
+ ['xetex'] .each do |e| @@texengines[e] = 'xetex' end
- ['pdfetex','pdftex','pdf','pdftex','standard'] .each do |b| @@backends[b] = 'pdftex' end
- ['dvipdfmx','dvipdfm','dpx','dpm'] .each do |b| @@backends[b] = 'dvipdfmx' end
- ['xetex','xtx'] .each do |b| @@backends[b] = 'xetex' end
- ['dvips','ps'] .each do |b| @@backends[b] = 'dvips' end
- ['dvipsone'] .each do |b| @@backends[b] = 'dvipsone' end
- ['acrobat','adobe','distiller'] .each do |b| @@backends[b] = 'acrobat' end
+ ['metapost','mpost','standard'] .each do |e| @@mpsengines[e] = 'mpost' end
+
+ ['pdfetex','pdftex','pdf','pdftex','standard'] .each do |b| @@backends[b] = 'pdftex' end
+ ['dvipdfmx','dvipdfm','dpx','dpm'] .each do |b| @@backends[b] = 'dvipdfmx' end
+ ['xetex','xtx'] .each do |b| @@backends[b] = 'xetex' end
+ ['dvips','ps'] .each do |b| @@backends[b] = 'dvips' end
+ ['dvipsone'] .each do |b| @@backends[b] = 'dvipsone' end
+ ['acrobat','adobe','distiller'] .each do |b| @@backends[b] = 'acrobat' end
# 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-cz','cz','czech'] .each do |f| @@texformats[f] = 'cont-cz' end
- ['cont-ro','ro','romanian'] .each do |f| @@texformats[f] = 'cont-ro' end
- ['cont-uk','uk','brittish'] .each do |f| @@texformats[f] = 'cont-uk' 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' 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-cz','cz','czech'] .each do |f| @@texformats[f] = 'cont-cz' end
+ ['cont-ro','ro','romanian'] .each do |f| @@texformats[f] = 'cont-ro' end
+ ['cont-uk','uk','brittish'] .each do |f| @@texformats[f] = 'cont-uk' end
+ ['mptopdf'] .each do |f| @@texformats[f] = 'mptopdf' end
+
+ ['latex'] .each do |f| @@texformats[f] = 'latex.ltx' end
- ['plain','mpost'] .each do |f| @@mpsformats[f] = 'plain' end
- ['metafun','context','standard'] .each do |f| @@mpsformats[f] = 'metafun' end
+ ['plain','mpost'] .each do |f| @@mpsformats[f] = 'plain' end
+ ['metafun','context','standard'] .each do |f| @@mpsformats[f] = 'metafun' end
- ['pdfetex','aleph','omega'] .each do |p| @@prognames[p] = 'context' end
- ['mpost'] .each do |p| @@prognames[p] = 'metafun' end
+ ['pdfetex','aleph','omega'] .each do |p| @@prognames[p] = 'context' end
+ ['mpost'] .each do |p| @@prognames[p] = 'metafun' end
+
+ ['plain','default','standard','mptopdf'] .each do |f| @@texmethods[f] = 'plain' end
+ ['cont-en','cont-nl','cont-de','cont-it',
+ 'cont-cz','cont-ro','cont-uk'] .each do |f| @@texmethods[f] = 'context' end
+ ['latex'] .each do |f| @@texmethods[f] = 'latex' end
+
+ ['plain','default','standard'] .each do |f| @@mpsmethods[f] = 'plain' end
+ ['metafun'] .each do |f| @@mpsmethods[f] = 'metafun' end
+
+ @@texmakestr['plain'] = "\\dump"
+ @@mpsmakestr['plain'] = "\\dump"
+
+ ['cont-en','cont-nl','cont-de','cont-it',
+ 'cont-cz','cont-ro','cont-uk'] .each do |f| @@texprocstr[f] = "\\emergencyend" end
@@runoptions['xetex'] = ['--no-pdf']
@@booleanvars = [
- 'batchmode', 'nonstopmode', 'fastmode', 'fastdisabled', 'silentmode', 'final',
+ 'batchmode', 'nonstopmode', 'fast', 'fastdisabled', 'silentmode', 'final',
'paranoid', 'notparanoid', 'nobanner', 'once', 'allpatterrns',
'nompmode', 'nomprun', 'automprun',
'nomapfiles', 'local',
@@ -77,7 +126,7 @@ class TEX
'mpyforce', 'forcempy',
'forcetexutil', 'texutil',
'globalfile', 'autopath',
- 'purge', 'pdfopen', 'simplerun',
+ 'purge', 'pdfopen', 'simplerun', 'verbose',
]
@@stringvars = [
'modefile', 'result', 'suffix', 'response', 'path',
@@ -120,7 +169,15 @@ class TEX
@@temptexfile = 'texexec.tex'
def initialize(logger)
- @logger = logger
+ if @logger = logger then
+ def report(str='')
+ @logger.report(str)
+ end
+ else
+ def report(str='')
+ puts(str)
+ end
+ end
@cleanups = Array.new
@variables = Hash.new
@startuptime = Time.now
@@ -139,12 +196,16 @@ class TEX
setvariable('mpsformats', defaultmpsformats)
setvariable('progname', 'context')
setvariable('interface', 'standard')
- setvariable('engine', 'standard')
+ setvariable('engine', 'standard') # replaced by tex/mpsengine
setvariable('backend', 'pdftex')
setvariable('runs', '8')
- setvariable('randomseed', rand(1440))
+ setvariable('randomseed', rand(1440).to_s)
# files
- setvariable('files', [])
+ setvariable('files', [])
+ # defaults
+ setvariable('texengine', 'standard')
+ setvariable('mpsengine', 'standard')
+ setvariable('backend', 'standard')
end
def runtime
@@ -193,33 +254,23 @@ class TEX
end
end
- def texengines
- @@texengines.keys.sort
- end
+ def backends() @@backends.keys.sort end
- def mpsengines
- @@mpsengines.keys.sort
- end
+ def texengines() @@texengines.keys.sort end
+ def mpsengines() @@mpsengines.keys.sort end
+ def texformats() @@texformats.keys.sort end
+ def mpsformats() @@mpsformats.keys.sort end
- def backends
- @@backends.keys.sort
- end
+ def defaulttexformats() ['en','nl','mptopdf'] end
+ def defaultmpsformats() ['metafun'] end
- def texformats
- @@texformats.keys.sort
- end
+ def texmakeextras(format) @@texmakestr[format] || '' end
+ def mpsmakeextras(format) @@mpsmakestr[format] || '' end
+ def texprocextras(format) @@texprocstr[format] || '' end
+ def mpsprocextras(format) @@mpsprocstr[format] || '' end
- def mpsformats
- @@mpsformats.keys.sort
- end
-
- def defaulttexformats
- ['en','nl','mptopdf']
- end
-
- def defaultmpsformats
- ['metafun']
- end
+ def texmethod(format) @@texmethods[str] || @@texmethods['standard'] end
+ def mpsmethod(format) @@mpsmethods[str] || @@mpsmethods['standard'] end
def runoptions(engine)
if @@runoptions.key?(engine) then @@runoptions[engine].join(' ') else '' end
@@ -265,18 +316,14 @@ class TEX
if str.class == String then str.split(',') else str.flatten end
end
- def validtexformat(str)
- validsomething(str,@@texformats)
- end
- def validmpsformat(str)
- validsomething(str,@@mpsformats)
- end
- def validtexengine(str)
- validsomething(str,@@texengines)
- end
- def validmpsengine(str)
- validsomething(str,@@mpsengines)
- end
+ def validtexformat(str) validsomething(str,@@texformats) end
+ def validmpsformat(str) validsomething(str,@@mpsformats) end
+ def validtexengine(str) validsomething(str,@@texengines) end
+ def validmpsengine(str) validsomething(str,@@mpsengines) end
+
+ def validtexmethod(str) [validsomething(str,@@texmethods)].flatten.first end
+ def validmpsmethod(str) [validsomething(str,@@mpsmethods)].flatten.first end
+
def validsomething(str,something)
if str then
list = [str].flatten.collect do |s|
@@ -320,11 +367,11 @@ class TEX
else return ""
end
if format then
- if engine then
- "#{prefix}=#{engine}/#{format}"
- else
+ # if engine then
+ # "#{prefix}=#{engine}/#{format}"
+ # else
"#{prefix}=#{format}"
- end
+ # end
else
prefix
end
@@ -362,12 +409,8 @@ class TEX
end
end
- def iniflag
- "--ini"
- end
- def tcxflag
- "--translate-file=natural.tcx"
- end
+ def iniflag() "--ini" end
+ def tcxflag() "--translate-file=natural.tcx" end
def filestate(file)
File.mtime(file).strftime("%d/%m/%Y %H:%M:%S")
@@ -388,6 +431,12 @@ class TEX
end
def makeformats
+ if getvariable('fast') then
+ report('using existing database')
+ else
+ report('updating file database')
+ Kpse.update
+ end
# goody
if getvariable('texformats') == 'standard' then
setvariable('texformats',[getvariable('interface')]) unless getvariable('interface').empty?
@@ -413,14 +462,11 @@ class TEX
makeuserfile
makeresponsefile
end
- texformats.each do |format|
- if texformat = validtexformat(format) then
- report("generating tex format #{texformat}")
- # report("some texmf environment variables are fixed") if Kpse.fixtexmfvars(texengine)
- command = [quoted(texengine),prognameflag(progname),iniflag,tcxflag,prefixed(texformat,texengine)].join(' ')
- report(command) if getvariable('verbose')
- system(command)
- end
+ texformats.each do |texformat|
+ report("generating tex format #{texformat}")
+ command = [quoted(texengine),prognameflag(progname),iniflag,tcxflag,prefixed(texformat,texengine),texmakeextras(texformat)].join(' ')
+ report(command) if getvariable('verbose')
+ system(command)
end
else
texformatpath = ''
@@ -434,14 +480,11 @@ class TEX
Dir.chdir(mpsformatpath)
rescue
end
- mpsformats.each do |format|
- if mpsformat = validmpsformat(format) then
- report("generating mps format #{mpsformat}")
- # report("some texmf environment variables are fixed") if Kpse.fixtexmfvars(mpsengine)
- command = [quoted(mpsengine),prognameflag(progname),iniflag,tcxflag,mpsformat].join(' ')
- report(command) if getvariable('verbose')
- system(command)
- end
+ mpsformats.each do |mpsformat|
+ report("generating mps format #{mpsformat}")
+ command = [quoted(mpsengine),prognameflag(progname),iniflag,tcxflag,mpsformat,mpsmakeextras(mpsformat)].join(' ')
+ report(command) if getvariable('verbose')
+ system(command)
end
else
mpsformatpath = ''
@@ -482,11 +525,12 @@ class TEX
globpattern = "**/{#{formatpaths.join(',')}}/*/*.{fmt,efmt,ofmt,xfmt,mem}"
report("format path: #{formatpaths.join(' ')}")
# utilities
- report
+ report('start of analysis')
+ results = Array.new
['texexec','texutil','ctxtools'].each do |program|
result = `texmfstart #{program} --help`
result.sub!(/.*?(#{program}[^\n]+)\n.*/mi) do $1 end
- report("#{result}")
+ results.push("#{result}")
end
# formats
cleanuptemprunfiles
@@ -511,24 +555,23 @@ class TEX
case format
when /cont\-([a-z]+)/ then
interface = $1.sub(/cont\-/,'')
- report
- report("testing interface #{interface}")
+ results.push('')
+ results.push("testing interface #{interface}")
flags = ['--process','--batch','--once',"--interface=#{interface}",engineflag]
-# to be adapted !
-result = Kpse.pipescript('newtexexec',tempfilename,flags)
-# to just texexec
+ # result = Kpse.pipescript('newtexexec',tempfilename,flags)
+ result = runtexexec([tempfilename], flags, 1)
if FileTest.file?("#{@@temprunfile}.log") then
logdata = IO.read("#{@@temprunfile}.log")
if logdata =~ /^\s*This is (.*?)[\s\,]+(.*?)$/mois then
if validtexengine($1.downcase) then
- report("#{$1} #{$2.gsub(/\(format.*$/,'')}".strip)
+ results.push("#{$1} #{$2.gsub(/\(format.*$/,'')}".strip)
end
end
if logdata =~ /^\s*(ConTeXt)\s+(.*int:\s+[a-z]+.*?)\s*$/mois then
- report("#{$1} #{$2}".gsub(/\s+/,' ').strip)
+ results.push("#{$1} #{$2}".gsub(/\s+/,' ').strip)
end
else
- report("format #{format} does not work")
+ results.push("format #{format} does not work")
end
when /metafun/ then
# todo
@@ -536,12 +579,17 @@ result = Kpse.pipescript('newtexexec',tempfilename,flags)
# todo
end
else
- report("error in creating #{tempfilename('tex')}")
+ results.push("error in creating #{tempfilename('tex')}")
end
end
cleanuptemprunfiles
end
end
+ report('end of analysis')
+ report
+ results.each do |line|
+ report(line)
+ end
cleanuptemprunfiles
end
@@ -628,8 +676,8 @@ result = Kpse.pipescript('newtexexec',tempfilename,flags)
def scantexcontent(filename)
if tex = File.open(filename) then
- while str = tex.gets.chomp do
- case str
+ while str = tex.gets do
+ case str.chomp
when /^\%/o then
# next
when /\\(starttekst|stoptekst|startonderdeel|startdocument|startoverzicht)/o then
@@ -709,13 +757,16 @@ result = Kpse.pipescript('newtexexec',tempfilename,flags)
break
elsif line =~ /<\?context\-directive\s+(.+?)\s+(.+?)\s+(.+?)\s*\?>/o then
category, key, value = $1, $2, $3
- if category == 'job' then
- if key == 'stylefile' then
- tmp << "\\environment $value\n"
- elsif key == 'module' then
- tmp << "\\usemodule[$value]\n"
- elsif key == 'interface' then
- contextinterface = value
+ case category
+ when 'job' then
+ case key
+ when 'stylefile', 'environment' then
+ tmp << "\\environment $value\n"
+ when 'module' then
+ tmp << "\\usemodule[$value]\n"
+ when 'interface' then
+ contextinterface = value
+ end
end
end
end
@@ -742,7 +793,7 @@ class TEX
getarrayvariable('files').each do |filename|
setvariable('filename',filename)
report("processing document '#{filename}'")
- processcontextfile
+ processfile
end
reportruntime
end
@@ -804,7 +855,7 @@ class TEX
if getvariable('nompmode') || getvariable('nomprun') || getvariable('automprun') then
opt << "\\runMPgraphicsfalse\n"
end
- if getvariable('fastmode') && ! getvariable('fastdisabled') then
+ if getvariable('fast') && ! getvariable('fastdisabled') then
opt << "\\fastmode\n"
end
if getvariable('silent') then
@@ -942,7 +993,7 @@ class TEX
report("tex format: #{texformat}")
report("progname: #{progname}")
if texengine && texformat && progname then
- command = [quoted(texengine),prognameflag(progname),formatflag(texengine,texformat),runoptions(texengine),filename].join(' ')
+ command = [quoted(texengine),prognameflag(progname),formatflag(texengine,texformat),runoptions(texengine),filename,texprocextras(texformat)].join(' ')
report(command) if getvariable('verbose')
system(command)
else
@@ -955,7 +1006,7 @@ class TEX
mpsformat = validmpsformat(getarrayvariable('mpsformats').first)
progname = validprogname(getvariable('progname'))
if mpsengine && mpsformat && progname then
- command = [quoted(mpsengine),prognameflag(progname),formatflag(mpsengine,mpsformat),runoptions(mpsengine),filename].join(' ')
+ command = [quoted(mpsengine),prognameflag(progname),formatflag(mpsengine,mpsformat),runoptions(mpsengine),filename,mpsprocextras(mpsformat)].join(' ')
report(command) if getvariable('verbose')
system(command)
else
@@ -982,8 +1033,8 @@ class TEX
mpfile = File.suffixed(filename,filetype,'mp')
if File.atleast?(mpfile,25) && (data = File.silentread(mpfile)) then
textranslation = if data =~ /^\%\s+translate.*?\=([\w\d\-]+)/io then $1 else '' end
- mpjobname = if data =~ /collected graphics of job \"(.+)\"/io then $1 else '' end
- if File.unsuffixed(filename) =~ /#{mpjobname}/ then # don't optimize
+ mpjobname = if data =~ /collected graphics of job \"(.+?)\"/io then $1 else '' end
+ if ! mpjobname.empty? and File.unsuffixed(filename) =~ /#{mpjobname}/ then # don't optimize
options = Array.new
options.push("--mptex")
options.push("--nomp")
@@ -991,18 +1042,52 @@ class TEX
options.push("--translate=#{textranslation}") unless textranslation.empty?
options.push("--batch") if getvariable('batchmode')
options.push("--nonstop") if getvariable('nonstopmode')
- return runtexexec(mpfile,options)
+ options.push("--output=ps")
+ return runtexexec(mpfile,options,2)
end
end
return false
end
def runtexutil(filename=[], options=['--ref','--ij','--high'])
- Kpse.runscript('texutil',filename,options)
+ begin
+ filename.each do |fname|
+ logger = Logger.new('TeXUtil')
+ if tu = TeXUtil::Converter.new(logger) and tu.loaded(fname) then
+ tu.saved if tu.processed
+ end
+ end
+ rescue
+ Kpse.runscript('texutil',filename,options)
+ end
end
- def runtexexec(filename=[], options=[])
- Kpse.runscript('texexec',filename,options)
+ # 1=tex 2=mptex 3=mpxtex
+
+ def runtexexec(filename=[], options=[], mode=nil)
+ begin
+ if mode and job = TEX.new(@logger) then
+ options.each do |option|
+ if option=~ /^\-*(.*?)\=(.*)$/o then
+ job.setvariable($1,$2)
+ else
+ job.setvariable(option,true)
+ end
+ end
+ job.setvariable("files",filename)
+ case mode
+ when 1 then job.processtex
+ when 2 then job.processmptex
+ when 3 then job.processmpxtex
+ end
+ job.inspect && Kpse.inspect if getvariable('verbose')
+ return true
+ else
+ Kpse.runscript('texexec',filename,options)
+ end
+ rescue
+ Kpse.runscript('texexec',filename,options)
+ end
end
def fixbackendvars(backend)
@@ -1011,15 +1096,44 @@ class TEX
ENV['TEXFONTMAPS'] = ".;\$TEXMF/fonts/map/{#{backend},pdftex,dvips,}//"
end
- def processcontextfile
+ def runbackend(jobname)
+ case validbackend(getvariable('backend'))
+ when 'dvipdfmx' then
+ fixbackendvars('dvipdfm')
+ system("dvipdfmx -d 4 #{File.unsuffixed(jobname)}")
+ when 'xetex' then
+ fixbackendvars('xetex')
+ system("xdv2pdf #{File.suffixed(jobname,'xdv')}")
+ when 'dvips' then
+ fixbackendvars('dvips')
+ mapfiles = ''
+ begin
+ if tuifile = File.suffixed(jobname,'tui') and FileTest.file?(tuifile) then
+ IO.read(tuifile).scan(/^c \\usedmapfile\{.\}\{(.*?)\}\s*$/o) do
+ mapfiles += "-u +#{$1} " ;
+ end
+ end
+ rescue
+ mapfiles = ''
+ end
+ system("dvips #{mapfiles} #{File.unsuffixed(jobname)}")
+ when 'pdftex' then
+ # no need for postprocessing
+ else
+ report("no postprocessing needed")
+ end
+ end
+
+ def processfile
takeprecautions
jobname = getvariable('filename')
- suffix = getvariable('suffix')
- result = getvariable('result')
+ suffix = getvariable('suffix')
+ result = getvariable('result')
- final = getvariable('final')
+ runonce = getvariable('once')
+ finalrun = getvariable('final') || (getvariable('arrange') && ! getvariable('noarrange'))
if getvariable('autopath') then
jobname = File.basename(jobname)
@@ -1036,9 +1150,12 @@ class TEX
orisuffix = jobsuffix # still needed ?
+ setvariable('nomprun',true) if orisuffix == 'mpx' # else cylic run
+
PDFview.closeall if getvariable('pdfopen')
forcexml = jobsuffix === /(xml|fo|fox|rlg|exa|)/io # === returns true|false, =~ returns position
+
dummyfile = false
# fuzzy code snippet: (we kunnen kpse: prefix gebruiken)
@@ -1055,81 +1172,89 @@ class TEX
unless dummyfile # we don't need this for xml
scantexpreamble(File.suffixed(jobname,jobsuffix))
- scantexcontent(File.suffixed(jobname,jobsuffix)) if getvariable('texformat').standard?
+ scantexcontent(File.suffixed(jobname,jobsuffix)) if getvariable('texformats').standard?
end
result = File.suffixed(jobname,suffix) unless suffix.empty?
pushresult(jobname,result)
- if getvariable('simplerun') then
- makeoptionfile(jobname,orisuffix,true,true,3)
- problems = runtex(File.suffixed(jobname,jobsuffix))
- if problems then
- ok = runtexutil(jobname) if getvariable('texutil') || getvariable('forcetexutil')
- popresult(jobname,result)
- end
- File.silentrename(File.suffixed(jobname,'top'),File.suffixed(jobname,'tmp'))
- else
- mprundone, ok, stoprunning = false, true, false
- texruns, nofruns = 0, getvariable('runs').to_i
- state = FileState.new
- ['tub','tuo'].each do |s|
- state.register(File.suffixed(jobname,s))
- end
- ['mprun','mpgraph'].each do |s|
- state.register(File.suffixed(jobname,s,'mp'),'randomseed')
- # state.register(File.suffixed(jobname,s,'mpo'))
- end
- while ! stoprunning && (texruns < nofruns) && ok do
- texruns += 1
- report("TeX run #{texruns}")
- if texruns == 1 then
- makeoptionfile(jobname,orisuffix,false,false,1)
+ method = validtexmethod(validtexformat(getvariable('texformats')))
+
+ report("tex processing method: #{method}")
+
+ case method
+
+ when 'context' then
+
+ if getvariable('simplerun') || runonce then
+ makeoptionfile(jobname,orisuffix,true,true,3)
+ problems = runtex(File.suffixed(jobname,jobsuffix))
+ unless problems then
+ ok = runtexutil(jobname) if getvariable('texutil') || getvariable('forcetexutil')
+ runbackend(jobname)
+ popresult(jobname,result)
+ end
+ File.silentrename(File.suffixed(jobname,'top'),File.suffixed(jobname,'tmp'))
else
- makeoptionfile(jobname,orisuffix,false,false,2)
- end
- ok = runtex(File.suffixed(jobname,jobsuffix))
- if ok && (nofruns > 1) then
- unless getvariable('nomprun') then
- mprundone = runtexmpjob(jobname, "mpgraph")
- mprundone = runtexmpjob(jobname, "mprun")
+ mprundone, ok, stoprunning = false, true, false
+ texruns, nofruns = 0, getvariable('runs').to_i
+ state = FileState.new
+ ['tub','tuo'].each do |s|
+ state.register(File.suffixed(jobname,s))
+ end
+ if getvariable('automprun') then # check this
+ ['mprun','mpgraph'].each do |s|
+ state.register(File.suffixed(jobname,s,'mp'),'randomseed')
+ # state.register(File.suffixed(jobname,s,'mpo'))
+ end
+ end
+ while ! stoprunning && (texruns < nofruns) && ok do
+ texruns += 1
+ report("TeX run #{texruns}")
+ if texruns == 1 then
+ makeoptionfile(jobname,orisuffix,false,false,1)
+ else
+ makeoptionfile(jobname,orisuffix,false,false,2)
+ end
+ ok = runtex(File.suffixed(jobname,jobsuffix))
+ if ok && (nofruns > 1) then
+ unless getvariable('nompmode') then
+ mprundone = runtexmpjob(jobname, "mpgraph")
+ mprundone = runtexmpjob(jobname, "mprun")
+ end
+ ok = runtexutil(jobname)
+ state.update
+ stoprunning = state.stable?
+ end
+ end
+ ok = runtexutil(jobname) if (nofruns == 1) && getvariable('texutil')
+ if ! problems && finalrun && (nofruns > 1) then
+ makeoptionfile(jobname,orisuffix,true,finalrun,4)
+ report("final TeX run #{texruns}")
+ problems = runtex(File.suffixed(jobname,jobsuffix))
+ end
+ File.silentcopy(File.suffixed(jobname,'top'),File.suffixed(jobname,'tmp'))
+ ['tup','top'].each do |s| # previous tuo file / runtime option file
+ File.silentdelete(File.suffixed(jobname,s))
+ end
+ unless problems then
+ runbackend(jobname)
+ popresult(jobname,result)
end
- ok = runtexutil(jobname)
- state.update
- stoprunning = state.stable?
end
- end
- ok = runtexutil(jobname) if (nofruns == 1) && getvariable('texutil')
- finalrun = getvariable('arrange') && ! getvariable('noarrange')
- if ! problems && finalrun && (nofruns > 1) then
- makeoptionfile(jobname,orisuffix,true,finalrun,4)
- report("final TeX run #{texruns}")
+
+ Kpse.runscript('ctxtools',jobname,'--purge') if getvariable('purge')
+
+ when 'latex' then
+
problems = runtex(File.suffixed(jobname,jobsuffix))
- end
- File.silentcopy(File.suffixed(jobname,'top'),File.suffixed(jobname,'tmp'))
- ['tup','top'].each do |s| # previous tuo file / runtime option file
- File.silentdelete(File.suffixed(jobname,s))
- end
- case validbackend(getvariable('backend'))
- when 'dvipdfmx' then
- fixbackendvars('dvipdfm')
- system("dvipdfmx -d 4 #{File.unsuffixed(jobname)}")
- when 'xetex' then
- fixbackendvars('xetex')
- system("xdv2pdf #{File.suffixed(jobname,'xdv')}")
- when 'dvips' then
- fixbackendvars('dvips')
- system("dvips #{File.unsuffixed(jobname)}")
- when 'pdftex' then
- # no need for postprocessing
- else
- report("no postprocessing needed")
- end
- popresult(jobname,result)
- end
- Kpse.runscript('ctxtools',jobname,'--purge') if getvariable('purge')
+ else
+
+ problems = runtex(File.suffixed(jobname,jobsuffix))
+
+ end
begin
File.delete(File.suffixed(jobname,jobsuffix)) if dummyfile || forcexml
@@ -1290,15 +1415,3 @@ class TEX
end
end
-
-class String
-
- def standard?
- begin
- self == 'standard'
- rescue
- false
- end
- end
-
-end
diff --git a/scripts/context/ruby/base/texutil.rb b/scripts/context/ruby/base/texutil.rb
new file mode 100644
index 000000000..2e5fbaaad
--- /dev/null
+++ b/scripts/context/ruby/base/texutil.rb
@@ -0,0 +1,790 @@
+require "base/file"
+require "base/logger"
+
+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
+
+ def splitdata
+ if self =~ /^\s*(.*?)\s*\{(.*)\}\s*$/o then
+ first, second = $1, $2
+ if first.empty? then
+ [second.split(/\} \{/o)].flatten
+ else
+ [first.split(/\s+/o)] + [second.split(/\} \{/o)]
+ end
+ else
+ []
+ end
+ end
+
+end
+
+class Logger
+ def banner(str)
+ report(str)
+ return "%\n% #{str}\n%\n"
+ end
+end
+
+class TeXUtil
+
+ class Plugin
+
+ # we need to reset module data for each run; persistent data is
+ # possible, just don't reinitialize the data structures that need
+ # to be persistent; we reset afterwards becausethen we know what
+ # plugins are defined
+
+ def initialize(logger)
+ @plugins = Array.new
+ @logger = logger
+ end
+
+ def reset(name)
+ if @plugins.include?(name) then
+ begin
+ eval("#{name}").reset(@logger)
+ rescue Exception
+ @logger.report("fatal error in resetting plugin")
+ end
+ else
+ @logger.report("no plugin #{name}")
+ end
+ end
+
+ def resets
+ @plugins.each do |p|
+ reset(p)
+ end
+ end
+
+ def register(name, file=nil) # maybe also priority
+ if file then
+ begin
+ require("#{file.downcase.sub(/\.rb$/,'')}.rb")
+ rescue Exception
+ @logger.report("no plugin file #{file} for #{name}")
+ else
+ @plugins.push(name)
+ end
+ else
+ @plugins.push(name)
+ end
+ return self
+ end
+
+ def reader(name, data=[])
+ if @plugins.include?(name) then
+ begin
+ eval("#{name}").reader(@logger,data.flatten)
+ rescue Exception
+ @logger.report("fatal error in plugin reader #{name} (#{$!})")
+ end
+ else
+ @logger.report("no plugin #{name}")
+ end
+ end
+
+ def readers(data=[])
+ @plugins.each do |p|
+ reader(p,data.flatten)
+ end
+ end
+
+ def writers(handle)
+ @plugins.each do |p|
+ begin
+ eval("#{p}").writer(@logger,handle)
+ rescue Exception
+ @logger.report("fatal error in plugin writer #{p} (#{$!})")
+ end
+ end
+ end
+
+ def processors
+ @plugins.each do |p|
+ begin
+ eval("#{p}").processor(@logger)
+ rescue Exception
+ @logger.report("fatal error in plugin processor #{p} (#{$!})")
+ end
+ end
+ 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 replacer(from,to='') # and expand
+ @rep[from.escaped] = to || ''
+ end
+
+ # sorter.reducer('ch', 'c')
+ # sorter.reducer('ij', 'y')
+
+ def reducer(from,to='')
+ @map[from] = to || ''
+ end
+
+ # sorter.expander('aeligature', 'ae')
+ # sorter.expander('ijligature', 'y')
+
+ def expander(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)
+ replacer(from,to)
+ expander(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 @exp.key?(token) then
+ @exp[token].ljust(@max,' ')
+ elsif @map.key?(token) then
+ @map[token].ljust(@max,' ')
+ else
+ ''
+ end
+ end
+ end
+
+ def preset(shortcuts=[],expansions=[],reductions=[])
+ 'a'.upto('z') do |c|
+ expander(c)
+ end
+ shortcuts.each do |s| shortcut(s[0],s[1]) end
+ expansions.each do |e| expander(e[0],e[1]) end
+ reductions.each do |r| reducer(r[0],r[1]) end
+ 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 Plugin
+
+ module MyFiles
+
+ @@files = Hash.new
+
+ def MyFiles::reset(logger)
+ @@files = Hash.new
+ end
+
+ def MyFiles::reader(logger,data)
+ case data[0]
+ when 'b', 'e' then
+ if @@files.key?(data[1]) then
+ @@files[data[1]] += 1
+ else
+ @@files[data[1]] = 1
+ end
+ end
+ end
+
+ def MyFiles::writer(logger,handle)
+ handle << logger.banner("loaded files: #{@@files.size}")
+ @@files.keys.sort.each do |k|
+ handle << "% > #{k} #{@@files[k]/2}\n"
+ end
+ end
+
+ def MyFiles::processor(logger)
+ @@files.keys.sort.each do |k|
+ unless (@@files[k] % 2) == 0 then
+ logger.report("check loading of file #{k}, begin/end problem")
+ end
+ end
+ end
+
+ end
+
+ end
+
+ class Plugin
+
+ module MyCommands
+
+ @@commands = []
+
+ def MyCommands::reset(logger)
+ @@commands = []
+ end
+
+ def MyCommands::reader(logger,data)
+ @@commands.push(data.shift+data.collect do |d| "\{#{d}\}" end.join)
+ end
+
+ def MyCommands::writer(logger,handle)
+ handle << logger.banner("commands: #{@@commands.size}")
+ @@commands.each do |c|
+ handle << "#{c}\n"
+ end
+ end
+
+ def MyCommands::processor(logger)
+ end
+
+ end
+
+ end
+
+ class Plugin
+
+ module MyExtras
+
+ @@programs = []
+
+ def MyExtras::reset(logger)
+ @@programs = []
+ end
+
+ def MyExtras::reader(logger,data)
+ case data[0]
+ when 'p' then
+ @@programs.push(data[1]) if data[0]
+ end
+ end
+
+ def MyExtras::writer(logger,handle)
+ handle << logger.banner("programs: #{@@programs.size}")
+ @@programs.each do |p|
+ handle << "% #{p} (#{@@programs[p]})\n"
+ end
+ end
+
+ def MyExtras::processor(logger)
+ @@programs.each do |p|
+ cmd = "texmfstart #{@@programs[p]}"
+ logger.report("running #{cmd}")
+ system(cmd)
+ end
+ end
+
+ end
+
+ end
+
+ class Plugin
+
+ module MySynonyms
+
+ 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
+
+ @@synonyms = Hash.new
+
+ def MySynonyms::reset(logger)
+ @@synonyms = Hash.new
+ end
+
+ def MySynonyms::reader(logger,data)
+ if data[0] == 'e' then
+ @@synonyms[data[1]] = Array.new unless @@synonyms.key?(data[1])
+ @@synonyms[data[1]].push(Synonym.new(data[1],data[2],data[3],data[4]))
+ end
+ end
+
+ def MySynonyms::writer(logger,handle)
+ if @@synonyms.size > 0 then
+ @@synonyms.keys.sort.each do |s|
+ handle << logger.banner("synonyms: #{s} #{@@synonyms[s].size}")
+ Synonym.flush(@@synonyms[s],handle)
+ end
+ end
+ end
+
+ def MySynonyms::processor(logger)
+ sorter = Sorter.new
+ sorter.preset(eval("MyKeys").shortcuts,eval("MyKeys").expansions,eval("MyKeys").reductions)
+ sorter.prepare
+ @@synonyms.keys.each do |s|
+ @@synonyms[s].each_index do |i|
+ @@synonyms[s][i].build(sorter)
+ end
+ @@synonyms[s] = @@synonyms[s].sort
+ end
+ end
+
+ end
+
+ end
+
+ class Plugin
+
+ module MyRegisters
+
+ 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
+ @nofentries, @nofpages = 0, 0
+ 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)
+ end
+ end
+
+ end
+
+ @@registers = Hash.new
+
+ def MyRegisters::reset(logger)
+ @@registers = Hash.new
+ end
+
+ def MyRegisters::reader(logger,data)
+ case data[0]
+ when 'f' then
+ @@registers[data[1]] = Array.new unless @@registers.key?(data[1])
+ @@registers[data[1]].push(Register.new(1,data[1],data[2],data[3],data[4],nil,data[5],data[6]))
+ when 'e' then
+ @@registers[data[1]] = Array.new unless @@registers.key?(data[1])
+ @@registers[data[1]].push(Register.new(2,data[1],data[2],data[3],data[4],nil,data[5],data[6]))
+ when 't' then
+ @@registers[data[1]] = Array.new unless @@registers.key?(data[1])
+ @@registers[data[1]].push(Register.new(3,data[1],data[2],data[3],data[4],nil,data[5],data[6]))
+ when 's' then
+ @@registers[data[1]] = Array.new unless @@registers.key?(data[1])
+ @@registers[data[1]].push(Register.new(4,data[1],data[2],data[3],data[4],data[5],data[6],nil))
+ end
+ end
+
+ def MyRegisters::writer(logger,handle)
+ if @@registers.size > 0 then
+ @@registers.keys.sort.each do |s|
+ handle << logger.banner("registers: #{s} #{@@registers[s].size}")
+ Register.flush(@@registers[s],handle)
+ # report("register #{@@registers[s].class}: #{@@registers[s].@nofentries} entries and #{@@registers[s].@nofpages} pages")
+ end
+ end
+ end
+
+ def MyRegisters::processor(logger)
+ sorter = Sorter.new
+ sorter.preset(eval("MyKeys").shortcuts,eval("MyKeys").expansions,eval("MyKeys").reductions)
+ sorter.prepare
+ @@registers.keys.each do |s|
+ @@registers[s].each_index do |i|
+ @@registers[s][i].build(sorter)
+ end
+ @@registers[s] = @@registers[s].sort
+ end
+ end
+
+ end
+
+ end
+
+ class Plugin
+
+ module MyPlugins
+
+ @@plugins = nil
+
+ def MyPlugins::reset(logger)
+ @@plugins = nil
+ end
+
+ def MyPlugins::reader(logger,data)
+ @@plugins = Plugin.new(logger) unless @@plugins
+ case data[0]
+ when 'r' then
+ logger.report("registering plugin #{data[1]}")
+ @@plugins.register(data[1],data[2])
+ when 'd' then
+ begin
+ @@plugins.reader(data[1],data[2,data.length-1])
+ rescue
+ @@plugins.reader(data[1],['error'])
+ end
+ end
+ end
+
+ def MyPlugins::writer(logger,handle)
+ @@plugins.writers(handle) if @@plugins
+ end
+
+ def MyPlugins::processor(logger)
+ @@plugins.processors if @@plugins
+ end
+
+ end
+
+ end
+
+ class Plugin
+
+ module MyKeys
+
+ @@shortcuts = Array.new
+ @@expansions = Array.new
+ @@reductions = Array.new
+
+ def MyKeys::shortcuts
+ @@shortcuts
+ end
+ def MyKeys::expansions
+ @@expansions
+ end
+ def MyKeys::reductions
+ @@reductions
+ end
+
+ def MyKeys::reset(logger)
+ @@shortcuts = Array.new
+ @@expansions = Array.new
+ @@reductions = Array.new
+ end
+
+ def MyKeys::reader(logger,data)
+ key = data.shift
+ grp = data.shift # language code, todo
+ case key
+ when 's' then @@shortcuts.push(data)
+ when 'e' then @@expansions.push(data)
+ when 'r' then @@reductions.push(data)
+ end
+ end
+
+ def MyKeys::writer(logger,handle)
+ end
+
+ def MyKeys::processor(logger)
+ logger.report("shortcuts: #{@@shortcuts.size}") # logger.report(@@shortcuts.inspect)
+ logger.report("expansions: #{@@expansions.size}") # logger.report(@@expansions.inspect)
+ logger.report("reductions: #{@@reductions.size}") # logger.report(@@reductions.inspect)
+ end
+
+ end
+
+ end
+
+ class Converter
+
+ def initialize(logger=nil)
+ if @logger = logger then
+ def report(str)
+ @logger.report(str)
+ end
+ def banner(str)
+ @logger.banner(str)
+ end
+ else
+ @logger = self
+ def report(str)
+ puts(str)
+ end
+ def banner(str)
+ puts(str)
+ end
+ end
+ @filename = 'texutil'
+ @fatalerror = false
+ @plugins = Plugin.new(@logger)
+ ['MyFiles', 'MyCommands', 'MySynonyms', 'MyRegisters', 'MyExtras', 'MyPlugins', 'MyKeys'].each do |p|
+ @plugins.register(p)
+ end
+ end
+
+ def loaded(filename)
+ begin
+ report("parsing file #{filename}")
+ File.open(File.suffixed(filename,'tui')).each do |line|
+ case line.chomp
+ when /^f (.*)$/o then @plugins.reader('MyFiles', $1.splitdata)
+ when /^c (.*)$/o then @plugins.reader('MyCommands', $1.splitdata)
+ when /^e (.*)$/o then @plugins.reader('MyExtras', $1.splitdata)
+ when /^s (.*)$/o then @plugins.reader('MySynonyms', $1.splitdata)
+ when /^r (.*)$/o then @plugins.reader('MyRegisters',$1.splitdata)
+ when /^p (.*)$/o then @plugins.reader('MyPlugins', $1.splitdata)
+ when /^x (.*)$/o then @plugins.reader('MyKeys', $1.splitdata)
+ else report("unknown entry #{line[0,1]} in line #{line.chomp}")
+ end
+ end
+ rescue
+ report("fatal error in parsing file (#{$!})")
+ @filename = 'texutil'
+ else
+ @filename = filename
+ end
+ end
+
+ def processed
+ @plugins.processors
+ return true # for the moment
+ 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
+ @plugins.writers(f)
+ f.close
+ end
+ rescue
+ report("fatal error when saving file (#{$!})")
+ else
+ report("tuo file saved")
+ end
+ end
+ @plugins.resets
+ end
+
+ def reset
+ @plugins.resets
+ end
+
+ end
+
+end
diff --git a/scripts/context/ruby/base/variables.rb b/scripts/context/ruby/base/variables.rb
index 0c495d22d..5cbc5ba53 100644
--- a/scripts/context/ruby/base/variables.rb
+++ b/scripts/context/ruby/base/variables.rb
@@ -26,6 +26,14 @@ module Variables
if @variables.key?(key) then @variables[key] else default end
end
+ def checkedvariable(str,default='')
+ if @variables.key?(key) then
+ if @variables[key].empty? then default else @variables[key] end
+ else
+ default
+ end
+ end
+
def report(*str)
@logger.report(*str)
end
diff --git a/scripts/context/ruby/ctxtools.rb b/scripts/context/ruby/ctxtools.rb
index c90299b0a..c89b1a30b 100644
--- a/scripts/context/ruby/ctxtools.rb
+++ b/scripts/context/ruby/ctxtools.rb
@@ -31,6 +31,7 @@ require 'base/system'
require 'rexml/document'
require 'ftools'
+require 'kconv'
exit if defined?(REQUIRE2LIB)
@@ -746,12 +747,15 @@ class Language
@language = language
@filenames = filenames
@remapping = Array.new
+ @unicode = Hash.new
@encoding = encoding
@data = ''
@read = ''
preload_accents()
+ preload_unicode() if @commandline.option('utf8')
case @encoding.downcase
when 't1', 'ec', 'cork' then preload_vector('ec')
+ when 'y', 'texnansi' then preload_vector('texnansi')
end
end
@@ -773,15 +777,13 @@ class Language
@filenames.each do |fileset|
[fileset].flatten.each do |filename|
begin
- if filename = located(filename) then
- data = IO.read(filename)
+ if fname = located(filename) then
+ data = IO.read(fname)
@data += data.gsub(/\%.*$/, '')
data.gsub!(/(\\patterns|\\hyphenation)\s*\{.*/mo) do '' end
- @read += "\n% preamble of file #{filename}\n\n#{data}\n"
- report("file #{filename} is loaded")
+ @read += "\n% preamble of file #{fname}\n\n#{data}\n"
+ report("file #{fname} is loaded")
break # next fileset
- else
- report("file #{filename} is not found")
end
rescue
report("file #{filename} is not readable")
@@ -808,9 +810,17 @@ class Language
end
end
report("#{n} changes in patterns and exceptions")
- return n
+ if @commandline.option('utf8') then
+ n = 0
+ @data.gsub!(/\[(.*?)\]/o) do
+ n += 1
+ @unicode[$1] || $1
+ end
+ report("#{n} unicode utf8 entries")
+ end
+ return true
else
- return 0
+ return false
end
end
@@ -850,6 +860,22 @@ class Language
end
end
+ def triggerunicode
+ if @commandline.option('utf8') then
+ "% xetex needs utf8 encoded patterns and for patterns\n" +
+ "% coded as such we need to enable this regime when\n" +
+ "% not in xetex; this code will be moved into context\n" +
+ "% as soon as we've spread the generic patterns\n" +
+ "\n" +
+ "\\ifx\\XeTeXversion\\undefined \\else\n" +
+ " \\ifx\\enableregime\\undefined \\else\n" +
+ " \\enableregime[utf]\n" +
+ " \\fi\n" +
+ "\\fi\n" +
+ "\n"
+ end
+ end
+
def save
xml = @commandline.option("xml")
@@ -938,11 +964,13 @@ class Language
data += $1 + "\n"
end
data.gsub!(/(\s*\n\s*)+/mo, "\n")
+
f << banner
f << comment("context pattern file, see #{commentfile} for original comment")
f << comment("source of data: #{@filenames.join(' ')}")
f << description
f << comment("begin pattern data")
+ f << triggerunicode
f << content('patterns', data)
f << comment("end pattern data")
f.close
@@ -964,11 +992,12 @@ class Language
data.gsub!(/(\s*\n\s*)+/mo, "\n")
f << banner
f << comment("context hyphenation file, see #{commentfile} for original comment")
- f.<< comment("source of data: #{@filenames.join(' ')}")
+ f << comment("source of data: #{@filenames.join(' ')}")
f << description
- f.<< comment("begin hyphenation data")
+ f << comment("begin hyphenation data")
+ f << triggerunicode
f << content('hyphenation', data)
- f.<< comment("end hyphenation data")
+ f << comment("end hyphenation data")
f.close
report("exceptions saved in file #{hypname}")
else
@@ -1005,10 +1034,10 @@ class Language
def located(filename)
begin
- filename = `kpsewhich -progname=context #{filename}`.chomp
- if FileTest.file?(filename) then
- report("using file #{filename}")
- return filename
+ fname = `kpsewhich -progname=context #{filename}`.chomp
+ if FileTest.file?(fname) then
+ report("using file #{fname}")
+ return fname
else
report("file #{filename} is not present")
return nil
@@ -1041,6 +1070,26 @@ class Language
end
+ def preload_unicode
+
+ # \definecharacter Agrave {\uchar0{192}}
+
+ begin
+ if filename = located("enco-uc.tex") then
+ if data = IO.read(filename) then
+ report("preloading unicode conversions")
+ data.scan(/\\definecharacter\s*(.+?)\s*\{\\uchar\{*(\d+)\}*\s*\{(\d+)\}/o) do
+ one, two, three = $1, $2.to_i, $3.to_i
+ @unicode[one] = [(two*256 + three)].pack("U")
+ end
+ end
+ end
+ rescue
+ report("error in loading unicode mapping (#{$!})")
+ end
+
+ end
+
def preload_vector(encoding='')
# funny polish
@@ -1279,7 +1328,7 @@ commandline.registeraction('documentation', 'generate documentation [--type=] [f
commandline.registeraction('filterpages') # no help, hidden temporary feature
commandline.registeraction('purgeallfiles') # no help, compatibility feature
-commandline.registeraction('patternfiles', 'generate pattern files [--all] [languagecode]')
+commandline.registeraction('patternfiles', 'generate pattern files [--all --xml --utf8] [languagecode]')
commandline.registeraction('dpxmapfiles', 'convert pdftex mapfiles to dvipdfmx [--force] [texmfroot]')
@@ -1291,6 +1340,7 @@ commandline.registerflag('pipe')
commandline.registerflag('all')
commandline.registerflag('xml')
commandline.registerflag('log')
+commandline.registerflag('utf8')
# general
diff --git a/scripts/context/ruby/newtexexec.rb b/scripts/context/ruby/newtexexec.rb
index 758a42d89..0d9602312 100644
--- a/scripts/context/ruby/newtexexec.rb
+++ b/scripts/context/ruby/newtexexec.rb
@@ -1,4 +1,4 @@
-banner = ['TeXExec', 'version 6.0.1', '1997-2005', 'PRAGMA ADE/POD']
+banner = ['TeXExec', 'version 6.1.0', '1997-2005', 'PRAGMA ADE/POD']
unless defined? ownpath
ownpath = $0.sub(/[\\\/][a-z0-9\-]*?\.rb/i,'')
@@ -11,6 +11,7 @@ require 'base/variables'
require 'base/system'
require 'base/tex'
+require 'base/texutil'
require 'ftools' # needed ?
@@ -25,13 +26,6 @@ class Commands
def make
if job = TEX.new(logger) then
- # prepare, move to TEX ?
- if @commandline.option('fast') then
- report('using existing database')
- else
- report('updating file database')
- Kpse.update
- end
prepare(job)
# bonus, overloads language switch !
job.setvariable('language','all') if @commandline.option('all')
@@ -56,6 +50,14 @@ class Commands
end
end
+ def main
+ if @commandline.arguments.length>0 then
+ process
+ else
+ help
+ end
+ end
+
def process
if job = TEX.new(logger) then
job.setvariable('files',@commandline.arguments)
@@ -65,14 +67,6 @@ class Commands
end
end
- def main
- if @commandline.arguments.length>0 then
- process
- else
- help
- end
- end
-
def mptex
if job = TEX.new(logger) then
job.setvariable('files',@commandline.arguments)
@@ -181,11 +175,11 @@ class Commands
end
def modules
- msuffixes = ['tex','mp','pl','pm','rb']
if job = TEX.new(logger) then
prepare(job)
job.cleanuptemprunfiles
files = @commandline.arguments.sort
+ msuffixes = ['tex','mp','pl','pm','rb']
if files.length > 0 then
files.each do |fname|
fnames = Array.new
@@ -491,6 +485,8 @@ class Commands
job.setvariable('backend','xetex')
elsif @commandline.oneof('aleph') then
job.setvariable('backend','dvipdfmx')
+ elsif @commandline.oneof('dvips','ps') then
+ job.setvariable('backend','dvips')
else
job.setvariable('backend','standard')
end
@@ -512,8 +508,6 @@ end
logger = Logger.new(banner.shift)
commandline = CommandLine.new
-# actions
-
commandline.registeraction('make', 'make formats')
commandline.registeraction('check', 'check versions')
commandline.registeraction('process', 'process file')
@@ -572,6 +566,9 @@ commandline.registerflag('dvipdfm')
commandline.registerflag('dpx')
commandline.registerflag('dpm')
+commandline.registerflag('dvips')
+commandline.registerflag('ps')
+
commandline.registerflag('xetex')
commandline.registerflag('xtx')
diff --git a/scripts/context/ruby/newtexutil.rb b/scripts/context/ruby/newtexutil.rb
index 001bdde68..b8cc99ccf 100644
--- a/scripts/context/ruby/newtexutil.rb
+++ b/scripts/context/ruby/newtexutil.rb
@@ -1,557 +1,14 @@
-#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
+require 'base/logger'
+require 'base/texutil'
-# my $pm_path ;
+logger = Logger.new('TeXUtil')
-# BEGIN
- # { $pm_path = "$FindBin::Bin/" ;
- # if ($pm_path eq "") { $pm_path = "./" } }
+filename = ARGV[0] || 'tuitest'
-# 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)
+if tu = TeXUtil::Converter.new(logger) and tu.loaded(filename) then
+ tu.saved if tu.processed
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 }
@@ -563,49 +20,3 @@ end
# 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/texmfstart.rb b/scripts/context/ruby/texmfstart.rb
index c082b623d..d791ee1a4 100644
--- a/scripts/context/ruby/texmfstart.rb
+++ b/scripts/context/ruby/texmfstart.rb
@@ -361,7 +361,7 @@ def output(str)
end
def usage
- print "version : #{$version} - 2003/2004 - www.pragma-ade.com\n"
+ print "version : #{$version} - 2003/2005 - www.pragma-ade.com\n"
print("\n")
print("usage : texmfstart [switches] filename [optional arguments]\n")
print("\n")
diff --git a/tex/context/base/colo-ini.tex b/tex/context/base/colo-ini.tex
index 34e8a3494..b9fa01cfb 100644
--- a/tex/context/base/colo-ini.tex
+++ b/tex/context/base/colo-ini.tex
@@ -1384,8 +1384,13 @@
\startcolormode\maintextcolor
\fi}
+% \def\localstoptextcolor
+% {\stopcolormode}
+%
+% better:
+
\def\localstoptextcolor
- {\stopcolormode}
+ {\restorecolormode}
\def\restoretextcolor
{\ifx\maintextcolor\empty
diff --git a/tex/context/base/cont-new.tex b/tex/context/base/cont-new.tex
index 9f5e352b0..420f02f59 100644
--- a/tex/context/base/cont-new.tex
+++ b/tex/context/base/cont-new.tex
@@ -24,229 +24,9 @@
\writestatus{\m!systems}{beware: some patches loaded from cont-new.tex}
-\ifx\normalcompound\undefined \let\normalcompound=| \fi
+\let\cs\getvalue
-% accepts \head test \type{x{x}x} test ...
-
-\def\dostartitemattributes#1{\dostartattributes{\??op\currentitemgroup#1}}
-\def\dostopitemattributes {\dostopattributes}
-
-\def\complexdoitemgrouphead[#1]% beter in \complexdosom hangen met een if
- {\iffirstlist\else\doitembreak\allowbreak\fi
- \ifpackeditems\else\getitemparameter\itemlevel\c!beforehead\fi
- \iffirstlist\ifitemintro\else\ifcase\itemlevel % incr in \complexdosom
- \doitembreak\allowbreak
- \fi\fi\fi
- \complexdoitemgroupitem[#1]%
- \bgroup
- \dostartitemattributes\itemlevel\c!headstyle\c!headcolor\empty
- \ignorespaces
- \let\par\enditemhead} % brrrr but simple anyway
-
-\def\enditemhead
- {\removeunwantedspaces
- \dostopitemattributes
- \egroup
- \iftextitems
- \space\ignorespaces
- \else
- \par
- \fi
- \doitembreak\nobreak
- \ifpackeditems\else\getitemparameter\itemlevel\c!afterhead\fi
- \doitembreak\nobreak
- \noindentation}
-
-\def\greedysplitstring#1\at#2\to#3\and#4%
- {\edef\asciib{#1}%
- \let\asciic\asciib
- \let#3\empty
- \let#4\empty
- \doloop
- {\expandafter\splitstring\asciib\at#2\to\asciia\and\asciib
- \ifx\asciib\empty
- \exitloop
- \else
- % not \edef#3{\ifx#3\empty\else#3#2\fi\asciia} else
- % /root/path fails because then #3==empty
- \edef#3{\ifcase\recurselevel\or\else#3#2\fi\asciia}%
- \let#4\asciib
- \fi}%
- \ifx#3\empty\let#3\asciic\fi}
-
-% \splitfilename{oeps/test.pdf} [\splitoffpath\quad\splitoffname\quad\splitofftype]
-% \splitfilename{/oeps/test.pdf} [\splitoffpath\quad\splitoffname\quad\splitofftype]
-% \splitfilename{/test.pdf} [\splitoffpath\quad\splitoffname\quad\splitofftype]
-
-\def\splitfilename#1%
- {\edef\splitofffull{#1}% normally outside this call: \sanitizefilename#1\to\sanitizedfilename
- \greedysplitstring\splitofffull\at/\to\splitoffpath\and\splitoffbase
- \ifx\splitoffpath\splitofffull
- \let\splitoffpath\empty
- \fi
- \ifx\splitoffbase\empty
- \let\splitoffpath\empty
- \let\splitoffbase\splitofffull
- \fi
- \greedysplitstring\splitoffbase\at.\to\splitoffname\and\splitofftype
- \chardef\splitoffkind % can be used to test if pathpart was empty
- \ifx\splitoffpath\empty \zerocount \else
- \ifx\splitoffpath\splitoffroot \plusone \else
- \plustwo \fi\fi
- \ifx\splitoffname\empty\let\splitoffname\splitoffbase\fi
- \ifx\splitoffpath\empty\let\splitoffpath\splitoffroot\fi}
-
-\def\stoplocalframed
- {\dontshowcomposition
- \@@stopframedorientation
- \ifboxhasformat
- \ifx\localwidth\v!fit
- \ifreshapeframebox\doreshapeframedbox\fi
- \boxhaswidthfalse
- \else\ifx\localwidth\v!fixed
- \boxhaswidthfalse
- \else
- \resetshapeframebox
- \fi\fi
- \else
- \resetshapeframebox
- \fi
- \ifboxhaswidth
- \wd\framebox\!!widtha
- \fi
- \ifboxhasheight
- \ht\framebox\!!heighta
- \fi
- \doifvalue{\@@framed\c!empty}\v!yes
- {\setbox\scratchbox\null
- \wd\scratchbox\wd\framebox
- \ht\scratchbox\ht\framebox
- \dp\scratchbox\dp\framebox
- \setbox\framebox\box\scratchbox}%
- \stopregistercolor
- \docolorframebox
- \ifboxhasoffset
- \dooffsetframebox
- \fi
- \ifboxisoverlaid \else
- \dolocateframebox
- \fi
- \ifx\postprocessframebox\relax \else
- \let\next\postprocessframebox
- \let\postprocessframebox\relax % prevent nesting
- \next\framebox
- \fi
- \edef\overlaylinecolor{\framedparameter\c!framecolor}%
- \edef\overlaylinewidth{\the\ruledlinewidth}% \@@...
- \ifboxhasframe % real or invisible frame
- \doframedbox
- \fi
- \doifvaluesomething{\@@framed\c!background}\dobackedbox
- \handleframedlocator\@@locallocation
- \box\framebox
- \egroup
- \egroup}
-
-\def\installframedlocator#1#2%
- {\setvalue{\??ol:\c!location:#1}{#2}}
-
-\def\handleframedlocator#1%
- {\getvalue{\??ol:\c!location:#1}}
-
-\def\doprelocframedbox#1%
- {\scratchdimen#1\relax
- \advance\scratchdimen \ruledlinewidth
- \ifboxhasoffset
- \advance\scratchdimen \framedparameter\c!offset
- \fi
- \scratchskip\ht\framebox
- \advance\scratchskip-\scratchdimen}
-
-\installframedlocator \v!hanging % best with strut=no
- {\dp\framebox\ht\framebox
- \ht\framebox\zeropoint}
-
-\installframedlocator \v!depth
- {\scratchdimen\ht\framebox
- \advance\scratchdimen -\strutdp
- \ht\framebox\scratchdimen
- \dp\framebox\strutdp
- \box\framebox}
-
-\installframedlocator \v!height
- {\scratchdimen\ht\framebox
- \advance\scratchdimen -\strutht
- \ht\framebox\strutht
- \dp\framebox\scratchdimen
- \box\framebox}
-
-\installframedlocator \v!high
- {\doprelocframedbox\strutht
- \setbox\framebox\hbox{\lower\scratchskip\box\framebox}%
- \ht\framebox\strutht
- \dp\framebox\strutdp
- \hbox{\box\framebox}}
-
-\installframedlocator \v!line
- {\setbox\framebox\hbox{\lower.5\ht\framebox\box\framebox}%
- \ht\framebox.5\lineheight
- \dp\framebox.5\lineheight
- \hbox{\box\framebox}}
-
-\installframedlocator \v!low
- {\doprelocframedbox\strutdp
- \setbox\framebox\hbox{\lower\scratchdimen\box\framebox}%
- \ht\framebox\strutht
- \dp\framebox\strutdp
- \box\framebox}
-
-\installframedlocator \v!top
- {\doprelocframedbox\strutht
- \setbox\framebox\hbox{\lower\scratchskip\box\framebox}%
- \ht\framebox\scratchdimen
- \dp\framebox\scratchskip
- \hbox{\box\framebox}}
-
-\installframedlocator \v!middle
- {\scratchdimen.5\ht\framebox
- \setbox\framebox\hbox{\lower\scratchdimen\box\framebox}%
- \ht\framebox\scratchdimen
- \dp\framebox\scratchdimen
- \hbox{\box\framebox}}
-
-\installframedlocator \v!lohi
- {\handleframedlocator\v!middle}
-
-\installframedlocator \v!bottom
- {\doprelocframedbox\strutdp
- \setbox\framebox\hbox{\lower\scratchdimen\box\framebox}%
- \ht\framebox\scratchskip
- \dp\framebox\scratchdimen
- \hbox{\box\framebox}}
-
-% \starttext
-% \ruledhbox
-% {A
-% \framed[width=2cm,align=middle,location=hanging]{location\\equals\\hanging}
-% \framed[width=2cm,align=middle,location=depth] {location\\equals\\depth}
-% \framed[width=2cm,align=middle,location=height] {location\\equals\\height}
-% B}
-% \vskip2cm
-% \ruledhbox
-% {A
-% \framed[width=2cm,align=middle,location=low] {location\\equals\\low}
-% \framed[width=2cm,align=middle,location=line] {location\\equals\\line}
-% \framed[width=2cm,align=middle,location=high] {location\\equals\\high}
-% B}
-% \vskip2cm
-% \ruledhbox
-% {A
-% \framed[width=2cm,align=middle,location=top] {location\\equals\\top}
-% \framed[width=2cm,align=middle,location=bottom] {location\\equals\\bottom}
-% \framed[width=2cm,align=middle,location=lohi] {location\\equals\\lohi}
-% \framed[width=2cm,align=middle,location=middle] {location\\equals\\middle}
-% B}
-% \stoptext
+\ifx\normalcompound\undefined \let\normalcompound=| \fi
% experimental so this may change
@@ -342,66 +122,6 @@
%
% \shapesynonym{eacute}
-\def\OTRSETnobalance
- {\iflastcolumnfootnotes % testen ! optie
- % inhibit flush of floats !
- % todo: nothing if no footnotes, else empty page
- \dostepwiserecurse\mofcolumns\nofcolumns\plusone
- {\vskip-\struttotal\verticalstrut\vfill\eject}%
- \else
-\ifnum\mofcolumns>\plusone
- \donetrue
-\else\ifdim\pagetotal>\zeropoint % too dangerous, we loose data
- \donetrue
-\else
- \donefalse
-\fi\fi
- \ifdone
- \ifnum\mofcolumns=\nofcolumns
- \OTRSETflushfinalfootnotes
- \else
- % probably todo
- \fi
- \vfill
- \eject
- % brr, may result in empty page after nicely fit text
- % or if left, then lost of first column only text
- \ifnum\mofcolumns>\plusone
- \OTRSETdofinalflush
- \OTRSETdofinaloutput
- \fi
- \fi
- \fi}
-
-% move from page-mar -> cors-spa
-
-\beginETEX
-
- \def\keeplinestogether#1%
- {\xdef\restoreinterlinepenalty{\global\resetpenalties\interlinepenalties}%
- \global\setpenalties\interlinepenalties{#1}\!!tenthousand}
-
-\endETEX
-
-\beginTEX
-
- \def\keeplinestogether#1%
- {\xdef\restoreinterlinepenalty
- {\global\let\restoreinterlinepenalty\relax
- \global\interlinepenalty=\the\interlinepenalty}% keep = here
- \global\interlinepenalty\!!tenthousand}
-
-\endTEX
-
-\def\setmargincontentpenalties
- {\getnoflines\margincontentheight
- \keeplinestogether\noflines}
-
-\def\undepthed
- {\dowithnextbox{\nextboxdp\zeropoint\flushnextbox}\hbox}
-
-\def\rawsectionnumber#1{\countervalue{\??se#1}}
-
% new: \forcebaselinecorrection --> core-spa & core-grd
\chardef\baselinecorrectionmode\plusone
@@ -544,10 +264,6 @@
\egroup
-% in xtag-map:
-
-\unexpanded\def\xmlrent#1{\doXMLentity#1;}
-
% \page[left]
% \definecolumntextarea[intro][left][x=1,y=1,nx=4,ny=20,state=start,background=introlayer]
% \setupcolumntextareatext[intro][left][\setups{intro}]
@@ -675,88 +391,6 @@
{\XMLexpanded{\scratchtoks{\enableXML#2}}%
\expanded{\normalsetnormalmark{#1}{\the\scratchtoks}}}
-\def\checksoundtrack#1%
- {\iflocation
- \doifdefined{\??sd:#1}{\doifvaluesomething{\??sd:#1}
- {\doinsertsoundtrack{\getvalue{\??sd:#1}}{#1}\@@sdoption
- % brr, \..empty not really needed and maybe even wrong;
- % also, not here but in driver
- % well, no: sounds need to be reinitialize each time (i.e., be on page), so no
- }}% \letgvalueempty{\??sd:#1}}}%
- \fi}
-
-\def\placemargincontent
- {\ifcase\margintextcollected\else % was level check
- \bgroup
- \redoconvertfont % !!
- \chardef\graphicvadjustmode\zerocount
- \doflushmargincontents
- \egroup
- \fi}
-
-\def\noconvertfont#1% #2%
- {\doifdefinedelse{\@noletter@#1}
- {\doifelsenothing{#1}\gobbleoneargument\@@donoconvertfont}\gobbleoneargument
- {#1}} % {#2}}
-
-\appendtoks
- \spacing\!!plusone % new per 10/08/2004, else problems in otr / !! needed
-\to \everyforgetall
-
-% \dorecurse{50}
-% {[before normal] \input thuan
-% \placefigure{normal}{\framed[height=1cm,width=8cm]{}}
-% \placefigure{normal}{\framed[height=2cm,width=8cm]{}}
-% [before force] \input thuan
-% \placefigure[force]{force}{\framed[height=8cm,width=8cm]{}}}
-
-\chardef\fixedfloatmethod=3
-
-\def\OTRONEsomefixdfloat % [#1]
- {\docheckiffloatfits
- \ifroomforfloat\else
- \ifzeropt\pagetotal
- % let's assume that there is room
- \else
- \ifcase\fixedfloatmethod
- % disabled
- \or % 1 (old method)
- \goodbreak
- \or % 2 (safe method)
- \page
- \or % 3 (keeps in stream)
- \vskip-.5\floatheight % play safe
- \vskip\textheight
- \fi
- \fi
- \fi
- \showmessage\m!floatblocks9\empty
- \someherefloat} % [#1]
-
-%D \starttyping
-%D {\sanitizePDFdocencoding test \CONTEXT\ test \to\oeps\stripstring\oeps\tttf[\oeps]}
-%D \stoptyping
-
-\def\stripstring#1% #1 is \cs
- {\bgroup
- \convertcommand#1\to\ascii
- \global\let\globalascii\empty
- \donefalse
- \expandafter\handletokens\ascii\with\dostripstring
- \egroup
- \let#1\globalascii}
-
-\def\dostripstring#1%
- {\ifx#1\blankspace
- \donetrue
- \else
- \ifdone\ifx\globalascii\empty\else
- \xdef\globalascii{\globalascii\space}%
- \donefalse
- \fi\fi
- \xdef\globalascii{\globalascii#1}%
- \fi}
-
%D Ok, I got tired of making dedicated clean up macros using the
%D same mechanism again and again, so now we have:
%D
@@ -1033,21 +667,6 @@
% \defineXMLenvironment[showpardata] \startshowpardata \stopshowpardata
% \defineXMLsingular [showpardata] \showpardata
-\newskip\@@raggedskipa
-\newskip\@@raggedskipb
-
-\def\setraggedness#1%
- {\ifnum\tolerance<1500\relax % small values have
- \tolerance1500\relax % unwanted side effects
- \fi
- \ifx\dohyphens\relax
- % this code will be reconsidered / kind of fuzzy (and old)
- \@@raggedskipa 2.5\hsize
- \@@raggedskipb #1\relax
- \divide\@@raggedskipa \@@raggedskipb
- \hyphenpenalty\@@raggedskipa
- \fi}
-
% todo : test low level translation (nl->en) and optimize script
% \definestylecollection[mine]
diff --git a/tex/context/base/cont-old.tex b/tex/context/base/cont-old.tex
index 2e2825131..d0529c695 100644
--- a/tex/context/base/cont-old.tex
+++ b/tex/context/base/cont-old.tex
@@ -23,21 +23,6 @@
\def\substitutecommand#1#2%
{\gdef#1{\dosubstitutecommand{#1}{#2}}}
-%substitutecommand \stelopsomminginopniveau \stelopsommingin
-%substitutecommand \stelopsommingvolledigin \stelopsommingin
-%substitutecommand \stelsomsymboolin \definieersymbool
-%substitutecommand \somsymbool \symbool
-
-%substitutecommand \stelzetspiegelin \stellayoutin
-%substitutecommand \stelmargesin \stellayoutin
-%substitutecommand \steloffsetin \stellayoutin
-
- %def \edgewidth {\rightedgewidth}
-
-%substitutecommand \steldoordefinitiein \steldoordefinierenin
-%substitutecommand \steldoornummerin \steldoornummerenin
-%substitutecommand \steldoorsprongin \steldoorspringenin
-
\substitutecommand \volgendehoofdstuk {\setupheadnumber[hoofdstuk][+1]}
\substitutecommand \volgendeparagraaf {\setupheadnumber[paragraaf][+1]}
\substitutecommand \volgendesubparagraaf {\setupheadnumber[subparagraaf][+1]}
@@ -54,33 +39,8 @@
\substitutecommand \definieersynoniem \definesynonyms
-%substitutecommand \stelvoetnootin \stelvoetnotenin
-
-%substitutecommand \karakters \uitgerekt
-
-%substitutecommand \diepevoetnoot \voetnoot
-
-% english:
-
-%substitutecommand \setupformulas \setupformulae
-
-%substitutecommand \useexternalfigures \setupexternalfigures
-
\substitutecommand \setupintermezzos \setupintermezzi
-%substitutecommand \leftlined \leftaligned
-%substitutecommand \middlelined \midaligned
-%substitutecommand \rightlined \rightaligned
-
-%substitutecommand \setupcorps \setupbodyfont
-%substitutecommand \switchtocorps \switchtobodyfont
-%substitutecommand \definecorps \definebodyfont
-%substitutecommand \definecorpsenvironment \definebodyfontenvironment
-%substitutecommand \showcorps \showbodyfont
-%substitutecommand \showcorpsenvironment \showbodyfontenvironment
-
- %def \corpssize {\bodyfontsize}
-
-\substitutecommand \showencoding {\showaccents\showcharacters}
+\let \Everybodyfont \EveryBodyFont
\protect \endinput
diff --git a/tex/context/base/core-box.tex b/tex/context/base/core-box.tex
index 081954734..fa576b5cb 100644
--- a/tex/context/base/core-box.tex
+++ b/tex/context/base/core-box.tex
@@ -659,6 +659,22 @@
\definelayerpreset
[\v!middle\v!right]
[\c!location=\v!left,\c!hoffset=\layerwidth,\c!voffset=.5\layerheight]
+
+\definelayerpreset
+ [\v!middle\v!top]
+ [\c!location=\v!bottom,\c!corner=\v!top,\c!dx=.5\layerwidth]
+
+\definelayerpreset
+ [\v!middle\v!bottom]
+ [\c!location=\v!top,\c!corner=\v!bottom,\c!dx=.5\layerwidth]
+
+\definelayerpreset
+ [\v!middle\v!left]
+ [\c!location=\v!right,\c!corner=\v!left,\c!dy=.5\layerwidth]
+
+\definelayerpreset
+ [\v!middle\v!right]
+ [\c!location=\v!left,\c!corner=\v!right,\c!dy=.5\layerheight]
\def\alignedbox
{\dodoubleempty\doalignedbox[]}
diff --git a/tex/context/base/core-des.tex b/tex/context/base/core-des.tex
index c325f2279..8c4da5ecc 100644
--- a/tex/context/base/core-des.tex
+++ b/tex/context/base/core-des.tex
@@ -656,7 +656,7 @@
\else % Why was this strange expansion needed?
\edef\!!stringa{\showdnpuretext}% nog eens testen binnen \expanded
\expanded{\doattributes{\??dd\currentdescription}\noexpand\c!headstyle\noexpand\c!headcolor
- {\noexpand\descriptionparameter\c!command{\!!stringa}}}%
+ {\noexpand\descriptionparameter\noexpand\c!command{\!!stringa}}}%
\doifnot{#1}{-}{\rawreference\s!num{#1}{}}%
\fi}
diff --git a/tex/context/base/core-fig.tex b/tex/context/base/core-fig.tex
index ac55d603d..7053f2bc0 100644
--- a/tex/context/base/core-fig.tex
+++ b/tex/context/base/core-fig.tex
@@ -733,10 +733,6 @@
\or % lokaal,globaal / non empty gebied
\edef\figurepathlist{\f!currentpath\ifx\@@exdirectory\empty\else,\@@exdirectory\fi}%
\fi
-%
-\doifnotmode{\systemmodeprefix\v!first}% first cache, else no lowres etc
- {\ifx\@@excache\empty\else\edef\figurepathlist{\@@excache,\figurepathlist}\fi}%
-%
\ExpandBothAfter\doifinset\v!default\@@exlocation
{\edef\figurepathlist{\figurepathlist,}}% default tex path search
\ifx\@@exfile\empty
diff --git a/tex/context/base/core-int.tex b/tex/context/base/core-int.tex
index 78906426d..e08644ea9 100644
--- a/tex/context/base/core-int.tex
+++ b/tex/context/base/core-int.tex
@@ -1207,7 +1207,7 @@
{\limitatetext{#5}{\getvalue{\??li#2\c!maxwidth}}{\unknown}}% % needed !
[]}% normally the destination, catch by gobble
\@@amboxcommand\do@@amposition{#1}{#7}% beware, we pass the pagenumber
- {\ignorespaces\linklisttoelement{#2}{#3}{#6}{#7}{\box0}\unskip}\\}
+ {\ignorespaces\linklisttoelement{#3}{#6}{#7}{\box0}\unskip}\\}
% \scherm moet worden als \page
diff --git a/tex/context/base/core-itm.tex b/tex/context/base/core-itm.tex
index 12f85097b..ba6cb4a9f 100644
--- a/tex/context/base/core-itm.tex
+++ b/tex/context/base/core-itm.tex
@@ -760,16 +760,52 @@
\definecomplexorsimpleempty\item
\definecomplexorsimpleempty\doitemgroupitem
-\def\complexdoitemgrouphead[#1]#2\par% % beter in \complexdosom hangen met een if
+\def\complexhead[#1]#2\par#3\par
+ {\startitemgroup[#1]%
+ \complexdoitemgrouphead[]\ignorespaces#2\par#3\par
+ \stopitemgroup}
+
+% \def\complexdoitemgrouphead[#1]#2\par% % beter in \complexdosom hangen met een if
+% {\iffirstlist\else\doitembreak\allowbreak\fi
+% \ifpackeditems\else\getitemparameter\itemlevel\c!beforehead\fi
+% \iffirstlist\ifitemintro\else\ifcase\itemlevel % incr in \complexdosom
+% \doitembreak\allowbreak
+% \fi\fi\fi
+% \complexdoitemgroupitem[#1]{\doitemattributes\itemlevel\c!headstyle\c!headcolor
+% {\ignorespaces#2}}%
+% \iftextitems
+% \removeunwantedspaces\space\ignorespaces
+% \else
+% \par
+% \fi
+% \doitembreak\nobreak
+% \ifpackeditems\else\getitemparameter\itemlevel\c!afterhead\fi
+% \doitembreak\nobreak
+% \noindentation}
+%
+% the next solution accepts \head test \type{x{x}x} test ...
+
+\def\dostartitemattributes#1{\dostartattributes{\??op\currentitemgroup#1}}
+\def\dostopitemattributes {\dostopattributes}
+
+\def\complexdoitemgrouphead[#1]% beter in \complexdosom hangen met een if
{\iffirstlist\else\doitembreak\allowbreak\fi
\ifpackeditems\else\getitemparameter\itemlevel\c!beforehead\fi
\iffirstlist\ifitemintro\else\ifcase\itemlevel % incr in \complexdosom
- \doitembreak\allowbreak
+ \doitembreak\allowbreak
\fi\fi\fi
- \complexdoitemgroupitem[#1]{\doitemattributes\itemlevel\c!headstyle\c!headcolor
- {\ignorespaces#2}}%
+ \complexdoitemgroupitem[#1]%
+ \bgroup
+ \dostartitemattributes\itemlevel\c!headstyle\c!headcolor\empty
+ \ignorespaces
+ \let\par\enditemhead} % brrrr but simple anyway
+
+\def\enditemhead
+ {\removeunwantedspaces
+ \dostopitemattributes
+ \egroup
\iftextitems
- \removeunwantedspaces\space\ignorespaces
+ \space\ignorespaces
\else
\par
\fi
@@ -778,11 +814,6 @@
\doitembreak\nobreak
\noindentation}
-\def\complexhead[#1]#2\par#3\par
- {\startitemgroup[#1]%
- \complexdoitemgrouphead[]\ignorespaces#2\par#3\par
- \stopitemgroup}
-
\definecomplexorsimpleempty\head
\definecomplexorsimpleempty\doitemgrouphead
diff --git a/tex/context/base/core-job.tex b/tex/context/base/core-job.tex
index 0b75d6c3d..10c601786 100644
--- a/tex/context/base/core-job.tex
+++ b/tex/context/base/core-job.tex
@@ -263,6 +263,10 @@
\expandafter\normalend
\fi}
+\def\emergencyend
+ {\writestatus\m!systems{invalid \@EA\string\csname\e!start\v!text\endcsname...\@EA\string\csname\e!stop\v!text\endcsname\space structure}%
+ \stoptext}
+
\def\currentfile{\inputfilename}
\def\doexecutefileonce#1%
diff --git a/tex/context/base/core-new.tex b/tex/context/base/core-new.tex
index 43ebcc97c..ffaa98214 100644
--- a/tex/context/base/core-new.tex
+++ b/tex/context/base/core-new.tex
@@ -319,8 +319,11 @@
\def\dostartsetups
{\ifthirdargument\@EA\startsetupsC\else\@EA\startsetupsD\fi}
+% \long\def\dodostartsetups#1#2#3% watch out: not \grabuntil
+% {\dograbuntil#1{\egroup\long\setvalue{\??su#2:#3}}}
+
\long\def\dodostartsetups#1#2#3% watch out: not \grabuntil
- {\dograbuntil#1{\egroup\long\setvalue{\??su#2:#3}}}
+ {\dograbuntil#1{\egroup\dodoglobal\long\setvalue{\??su#2:#3}}} % \doglobal
\def\systemsetupsprefix{*}
@@ -328,9 +331,9 @@
\def\resetsetups[#1]% see x-fo for usage
{\ifundefined{\??su\ifgridsnapping\v!grid\fi:#1}%
- \letbeundefined{\??su:#1}%
+ \dodoglobal\letbeundefined{\??su:#1}%
\else
- \letbeundefined{\??su\ifgridsnapping\v!grid\fi:#1}%
+ \dodoglobal\letbeundefined{\??su\ifgridsnapping\v!grid\fi:#1}%
\fi}
% or
diff --git a/tex/context/base/core-rul.tex b/tex/context/base/core-rul.tex
index 26e1d8eaa..23ab32e7e 100644
--- a/tex/context/base/core-rul.tex
+++ b/tex/context/base/core-rul.tex
@@ -448,6 +448,8 @@
\def\backgroundwidth {\the\hsize}
\def\backgroundheight{\the\vsize}
+% todo: also \def\theforegroundbox{#1}
+
\def\dobackgroundbox#1\background#2\color#3\raster#4\offset#5\corner
#6\radius#7\depth#8\component#9\\%
{\vbox
@@ -953,6 +955,65 @@
%D ...,bottom=\kern0pt,...
%D \stoptyping
+% \def\stoplocalframed
+% {\dontshowcomposition
+% \@@stopframedorientation
+% \ifboxhasformat
+% \ifx\localwidth\v!fit
+% \ifreshapeframebox\doreshapeframedbox\fi
+% \boxhaswidthfalse
+% \else\ifx\localwidth\v!fixed
+% \boxhaswidthfalse
+% \else
+% \resetshapeframebox
+% \fi\fi
+% \else
+% \resetshapeframebox
+% \fi
+% \ifboxhaswidth
+% \wd\framebox\!!widtha
+% \fi
+% \ifboxhasheight
+% \ht\framebox\!!heighta
+% \fi
+% \doifvalue{\@@framed\c!empty}\v!yes
+% {\setbox\scratchbox\null
+% \wd\scratchbox\wd\framebox
+% \ht\scratchbox\ht\framebox
+% \dp\scratchbox\dp\framebox
+% \setbox\framebox\box\scratchbox}%
+% \stopregistercolor
+% \docolorframebox
+% \ifboxhasoffset
+% \dooffsetframebox
+% \fi
+% \ifboxisoverlaid \else
+% \dolocateframebox
+% \fi
+% \ifx\postprocessframebox\relax \else
+% \let\next\postprocessframebox
+% \let\postprocessframebox\relax % prevent nesting
+% \next\framebox
+% \fi
+% \edef\overlaylinecolor{\framedparameter\c!framecolor}%
+% \edef\overlaylinewidth{\the\ruledlinewidth}% \@@...
+% \ifboxhasframe % real or invisible frame
+% \doframedbox
+% \fi
+% \doifvaluesomething{\@@framed\c!background}\dobackedbox
+% \ifx\@@locallocation\v!low
+% \doinlineframedbox
+% \else\ifx\@@locallocation\v!depth
+% \doloweredframedbox
+% \else\ifx\@@locallocation\v!hanging
+% \dohangingframedbox
+% \fi\fi\fi
+% \box\framebox
+% \egroup
+% \egroup}
+%
+% new version, installable handler:
+
\def\stoplocalframed
{\dontshowcomposition
\@@stopframedorientation
@@ -999,17 +1060,110 @@
\doframedbox
\fi
\doifvaluesomething{\@@framed\c!background}\dobackedbox
- \ifx\@@locallocation\v!low
- \doinlineframedbox
- \else\ifx\@@locallocation\v!depth
- \doloweredframedbox
- \else\ifx\@@locallocation\v!hanging
- \dohangingframedbox
- \fi\fi\fi
+ \handleframedlocator\@@locallocation
\box\framebox
\egroup
\egroup}
+\def\installframedlocator#1#2%
+ {\setvalue{\??ol:\c!location:#1}{#2}}
+
+\def\handleframedlocator#1%
+ {\getvalue{\??ol:\c!location:#1}}
+
+\def\doprelocframedbox#1%
+ {\scratchdimen#1\relax
+ \advance\scratchdimen \ruledlinewidth
+ \ifboxhasoffset
+ \advance\scratchdimen \framedparameter\c!offset
+ \fi
+ \scratchskip\ht\framebox
+ \advance\scratchskip-\scratchdimen}
+
+% \ruledhbox
+% {A
+% \framed[width=2cm,align=middle,location=hanging]{location\\equals\\hanging}
+% \framed[width=2cm,align=middle,location=depth] {location\\equals\\depth}
+% \framed[width=2cm,align=middle,location=height] {location\\equals\\height}
+% B}
+% \vskip2cm
+% \ruledhbox
+% {A
+% \framed[width=2cm,align=middle,location=low] {location\\equals\\low}
+% \framed[width=2cm,align=middle,location=line] {location\\equals\\line}
+% \framed[width=2cm,align=middle,location=high] {location\\equals\\high}
+% B}
+% \vskip2cm
+% \ruledhbox
+% {A
+% \framed[width=2cm,align=middle,location=top] {location\\equals\\top}
+% \framed[width=2cm,align=middle,location=bottom] {location\\equals\\bottom}
+% \framed[width=2cm,align=middle,location=lohi] {location\\equals\\lohi}
+% \framed[width=2cm,align=middle,location=middle] {location\\equals\\middle}
+% B}
+
+\installframedlocator \v!hanging % best with strut=no
+ {\dp\framebox\ht\framebox
+ \ht\framebox\zeropoint}
+
+\installframedlocator \v!depth
+ {\scratchdimen\ht\framebox
+ \advance\scratchdimen -\strutdp
+ \ht\framebox\scratchdimen
+ \dp\framebox\strutdp
+ \box\framebox}
+
+\installframedlocator \v!height
+ {\scratchdimen\ht\framebox
+ \advance\scratchdimen -\strutht
+ \ht\framebox\strutht
+ \dp\framebox\scratchdimen
+ \box\framebox}
+
+\installframedlocator \v!high
+ {\doprelocframedbox\strutht
+ \setbox\framebox\hbox{\lower\scratchskip\box\framebox}%
+ \ht\framebox\strutht
+ \dp\framebox\strutdp
+ \hbox{\box\framebox}}
+
+\installframedlocator \v!line
+ {\setbox\framebox\hbox{\lower.5\ht\framebox\box\framebox}%
+ \ht\framebox.5\lineheight
+ \dp\framebox.5\lineheight
+ \hbox{\box\framebox}}
+
+\installframedlocator \v!low
+ {\doprelocframedbox\strutdp
+ \setbox\framebox\hbox{\lower\scratchdimen\box\framebox}%
+ \ht\framebox\strutht
+ \dp\framebox\strutdp
+ \box\framebox}
+
+\installframedlocator \v!top
+ {\doprelocframedbox\strutht
+ \setbox\framebox\hbox{\lower\scratchskip\box\framebox}%
+ \ht\framebox\scratchdimen
+ \dp\framebox\scratchskip
+ \hbox{\box\framebox}}
+
+\installframedlocator \v!middle
+ {\scratchdimen.5\ht\framebox
+ \setbox\framebox\hbox{\lower\scratchdimen\box\framebox}%
+ \ht\framebox\scratchdimen
+ \dp\framebox\scratchdimen
+ \hbox{\box\framebox}}
+
+\installframedlocator \v!lohi
+ {\handleframedlocator\v!middle}
+
+\installframedlocator \v!bottom
+ {\doprelocframedbox\strutdp
+ \setbox\framebox\hbox{\lower\scratchdimen\box\framebox}%
+ \ht\framebox\scratchskip
+ \dp\framebox\scratchdimen
+ \hbox{\box\framebox}}
+
% \let\@@startframedorientation\relax
% \let\@@stopframedorientation \relax
diff --git a/tex/context/base/core-sec.tex b/tex/context/base/core-sec.tex
index 310aefd66..74bb7814a 100644
--- a/tex/context/base/core-sec.tex
+++ b/tex/context/base/core-sec.tex
@@ -162,6 +162,9 @@
\dochecknummer{#1}%
\egroup}
+\def\rawsectionnumber#1%
+ {\countervalue{\??se#1}}
+
\def\domakeprecedingsectionnumber[#1]% will become ugly after speed up
{\bgroup % added
\globallet\precedingsectionnumber\empty
diff --git a/tex/context/base/core-spa.tex b/tex/context/base/core-spa.tex
index 2846332f4..24c4f6f1d 100644
--- a/tex/context/base/core-spa.tex
+++ b/tex/context/base/core-spa.tex
@@ -17,7 +17,7 @@
\unprotect
-\newevery \everybodyfont \Everybodyfont % just to be sure
+\newevery \everybodyfont \EveryBodyFont % just to be sure
\newevery \everyfontswitch \EveryFontSwitch % just to be sure
\newevery \everydefinedfont \relax % just to be sure
@@ -159,7 +159,7 @@
\fi
\let\minimumstrutheight \@@itminheight
\let\minimumstrutdepth \@@itmindepth
- \let\minimallinedistance\@@itdistance
+ \let\minimumlinedistance\@@itdistance
\let\normallineheight \@@itline % let ! ! ! ! ! ivm ex
\doifelse\@@ittop\v!height % new, topskip does more bad than good
{\let\topskipfactor \@@itheight}
@@ -1673,7 +1673,7 @@
\def\minimumstrutdepth {0pt}
\def\normallineheight {\baselinefactor ex}
-\def\minimallinedistance {\lineskip}
+\def\minimumlinedistance {\lineskip}
\def\strutheight {0pt}
\def\strutdepth {0pt}
@@ -1771,7 +1771,7 @@
% \normalbaselineskip\openlineheight
% \!!plus\baselinegluefactor\openlineheight
% \!!minus\baselinegluefactor\openlineheight
-% \normallineskip\minimallinedistance\relax % \onepoint\relax
+% \normallineskip\minimumlinedistance\relax % \onepoint\relax
% \normallineskiplimit\zeropoint\relax
% \normalbaselines}
@@ -1805,7 +1805,7 @@
\!!plus \baselinegluefactor\openlineheight
\!!minus\baselinegluefactor\openlineheight
\fi
- \normallineskip\minimallinedistance\relax % \onepoint\relax
+ \normallineskip\minimumlinedistance\relax % \onepoint\relax
\normallineskiplimit\zeropoint\relax
\normalbaselines}
@@ -1833,6 +1833,26 @@
\strutdimen#3\strutdimen % kan afwijken van de globale
\edef#1{\the\strutdimen}} % macro % strut
+%D Sometimes one needs to freeze the interlinespacing
+%D
+%D \starttyping
+%D \rm \freezeinterlinespace .... {\ss \frozeninterlinespace .... \endgraf}
+%D \stoptyping
+
+\let\restoreinterlinespace\relax
+
+\def\saveinterlinespace
+ {\edef\restoreinterlinespace
+ {\lineheight \the\lineheight
+ \openstrutheight \the\openstrutheight
+ \openstrutdepth \the\openstrutdepth
+ \openlineheight \the\openlineheight
+ \normalbaselineskip \the\normalbaselineskip
+ \normallineskip \the\normallineskip
+ \normallineskiplimit\the\normallineskiplimit
+ \noexpand\def\noexpand\normallineheight{\the\dimexpr\normallineheight\relax}%
+ \noexpand\normalbaselines}}
+
% plain definition:
%
% \def\strut{\relax\ifmmode\copy\strutbox\else\unhcopy\strutbox\fi}
@@ -2090,6 +2110,7 @@
\setstrut}
\ifx\setfontparameters\undefined
+ % problems ! ! ! !
\def\setfontparameters{\the\everybodyfont}
\fi
@@ -2187,6 +2208,29 @@
\endETEX
+%D \macros
+%D {keeplinestogether}
+%D
+%D Dirty hack, needed in margin content that can run of a page.
+
+\beginETEX
+
+ \def\keeplinestogether#1%
+ {\xdef\restoreinterlinepenalty{\global\resetpenalties\interlinepenalties}%
+ \global\setpenalties\interlinepenalties{#1}\!!tenthousand}
+
+\endETEX
+
+\beginTEX
+
+ \def\keeplinestogether#1%
+ {\xdef\restoreinterlinepenalty
+ {\global\let\restoreinterlinepenalty\relax
+ \global\interlinepenalty=\the\interlinepenalty}% keep = here
+ \global\interlinepenalty\!!tenthousand}
+
+\endTEX
+
\newif\ifgridsnapping % to be sure
\def\defaultwidowpenalty {2000} % was: 1000
@@ -2649,6 +2693,7 @@
\appendtoks \forgetparindent \to \everyforgetall
\appendtoks \forgetbothskips \to \everyforgetall
\appendtoks \forgetspacing \to \everyforgetall % i.v.m. funny spacing in pagebody
+\appendtoks \spacing\!!plusone \to \everyforgetall % new per 10/08/2004, else problems in otr / !! needed
\appendtoks \everypar\emptytoks \to \everyforgetall % indeed!
\def\localvbox#1#%
@@ -3267,15 +3312,30 @@
%D To prevent unwanted side effects, we also have to check
%D for hyphens here:
+% \def\setraggedness#1%
+% {\ifnum\tolerance<1500\relax % small values have
+% \tolerance1500\relax % unwanted side effects
+% \fi
+% \spaceskip2.5\hsize % we misuse these registers
+% \xspaceskip#1\relax % for temporary storage;
+% \divide\spaceskip \xspaceskip % they are changed anyway
+% \ifx\dohyphens\relax
+% \hyphenpenalty\spaceskip % \else no hyphens is active
+% \fi}
+
+\newskip\@@raggedskipa
+\newskip\@@raggedskipb
+
\def\setraggedness#1%
{\ifnum\tolerance<1500\relax % small values have
\tolerance1500\relax % unwanted side effects
\fi
- \spaceskip2.5\hsize % we misuse these registers
- \xspaceskip#1\relax % for temporary storage;
- \divide\spaceskip \xspaceskip % they are changed anyway
\ifx\dohyphens\relax
- \hyphenpenalty\spaceskip % \else no hyphens is active
+ % this code will be reconsidered / kind of fuzzy (and old)
+ \@@raggedskipa 2.5\hsize
+ \@@raggedskipb #1\relax
+ \divide\@@raggedskipa \@@raggedskipb
+ \hyphenpenalty\@@raggedskipa
\fi}
\let\updateraggedskips\relax
diff --git a/tex/context/base/enco-cyr.tex b/tex/context/base/enco-cyr.tex
index 9ee7f50b0..95ab42231 100644
--- a/tex/context/base/enco-cyr.tex
+++ b/tex/context/base/enco-cyr.tex
@@ -670,7 +670,7 @@
\startmapping[x2]
-\resetcaserange 0 to 255
+\resetcaserange 128 to 255
\definecasemaps 192 to 223 lc +32 uc 0 % base letters (russian)
\definecasemaps 224 to 255 lc 0 uc -32
diff --git a/tex/context/base/enco-ini.tex b/tex/context/base/enco-ini.tex
index 6e7ae5120..6b32bbf6c 100644
--- a/tex/context/base/enco-ini.tex
+++ b/tex/context/base/enco-ini.tex
@@ -179,12 +179,18 @@
\let\enabledregime\empty
+% \def\enableregime[#1]%
+% {\edef\characterregime{@#1@}%
+% \ifx\enabledregime\characterregime \else
+% \doifdefined{\@reg@\characterregime}
+% {\the\csname\@reg@\characterregime\endcsname}%
+% \let\enabledregime\characterregime
+% \fi}
+
\def\enableregime[#1]%
{\edef\characterregime{@#1@}%
\ifx\enabledregime\characterregime \else
- \doifdefined{\@reg@\characterregime}
- {\the\csname\@reg@\characterregime\endcsname}%
- \let\enabledregime\characterregime
+ \the\executeifdefined{\@reg@\characterregime}\emptytoks
\fi}
%D \macros
@@ -966,6 +972,10 @@
% we need to postpone catcode changes, e.g. hr patterns
% have \catcode" -> which fails when " is letter
+% new patterns, some day
+%
+% \enableregime[utf]%
+
\def\pathypsettings
{\ifx \enablepatterntokens\undefined
\defineactivecharacter [ {\handlepatterntoken}%
diff --git a/tex/context/base/font-ini.tex b/tex/context/base/font-ini.tex
index f459b99c0..06bf96366 100644
--- a/tex/context/base/font-ini.tex
+++ b/tex/context/base/font-ini.tex
@@ -2478,17 +2478,17 @@
\normalizebodyfontsize\scratchdimen\to\!!stringa
\letvalue{\??ft#1#2}\!!stringa}}
-\def\dodefineunknownbodyfont#1#2% see ***
- {\doifdefined{\s!default\s!default#2}
- {\donetrue
- \getvalue{\s!default\s!default#2}{#1}{#2}}}
-
-% needs to be as follows, but test first:
-%
% \def\dodefineunknownbodyfont#1#2% see ***
-% {\doifdefined{\s!default\fontclass#2}% was \s!default\s!default (related to change */*)
+% {\doifdefined{\s!default\s!default#2}
% {\donetrue
-% \getvalue{\s!default\fontclass#2}{#1}{#2}}}
+% \getvalue{\s!default\s!default#2}{#1}{#2}}}
+%
+% but ... it needs to be as follows:
+
+\def\dodefineunknownbodyfont#1#2% see ***
+ {\doifdefined{\s!default\fontclass#2}% was \s!default\s!default (related to change */*)
+ {\donetrue
+ \getvalue{\s!default\fontclass#2}{#1}{#2}}}
\def\dodefineunknownsubfont#1#2%
{\doifundefined{\@size@\getvalue{\??ft#1#2}}
@@ -2555,7 +2555,7 @@
%D garantees their handling.
\ifx\everybodyfont\undefined % permits reloading
- \newevery \everybodyfont \Everybodyfont
+ \newevery \everybodyfont \EveryBodyFont
\fi
%D At the system level one can initialize thing like:
@@ -2567,7 +2567,7 @@
%D While users can add their own non standard commands like:
%D
%D \starttyping
-%D \Everybodyfont{\message{changing to bodyfont \the\bodyfontsize}}
+%D \EveryBodyFont{\message{changing to bodyfont \the\bodyfontsize}}
%D \stoptyping
%D
%D Personnaly I never felt the need for such extensions, but
@@ -2682,6 +2682,8 @@
\let\fontstyle = \defaultfontstyle
\let\fontsize = \defaultfontsize
+%D {\em The following approach is obsolete.}
+%D
%D All things related to fonts are grouped into files with
%D names like \type{font-cmr}. These files are loaded by:
@@ -2719,7 +2721,6 @@
% {#2}% argument to \showmessage
% \stopreadingfile}}
-
%D When \type {\loadfontfileoncetrue}, such files are
%D only loaded once! This permits redundant loading, but at
%D the same time forced grouping when we want continuously mix
@@ -2801,12 +2802,13 @@
%D sequence of a session. After the loading job is done, the
%D macro relaxes itself and reset the signal.
-\def\preloadfonts
+\def\preloadfonts % never called, needs a clean up
{\showmessage\m!fonts6{\normalizedbodyfontsize\normalspace\fontstyle}%
\global\loadingfontsfalse
\doswitchpoints[\normalizedbodyfontsize]%
\doswitchstyle[\fontstyle]%
\the\everybodyfont
+ \saveinterlinespace
\global\let\preloadfonts\relax}
% \prependtoks \preloadfonts \to \everydump % saves .1 s on a DELL P60 - 2GHZ
@@ -3328,12 +3330,16 @@
%D Both macros look alike. The second one also has to take
%D all kind of keywords into account.
+\ifx\saveinterlinespace \undefined \let\saveinterlinespace \relax \fi
+\ifx\restoreinterlinespace\undefined \let\restoreinterlinespace\relax \fi
+
\chardef\bodyfontsetstate=0
\definecomplexorsimple\setupbodyfont
\def\simplesetupbodyfont
- {\restoreglobalbodyfont}
+ {\restoreglobalbodyfont
+ \saveinterlinespace}
\def\complexsetupbodyfont[#1]%
{\doifsomething{#1}
@@ -3343,6 +3349,7 @@
\let\globalfontstyle\fontstyle
\ifloadingfonts\else
\the\everybodyfont % indeed needed in case \dosetfont is not executed
+ \saveinterlinespace
\fi}}
\unexpanded\def\switchtobodyfont[#1]%
@@ -3452,8 +3459,11 @@
%D The next auxilliary macro is an alternative to \type
%D {\fontname}.
-\def\purefontname#1%
- {\expandafter\splitoffpurefontname\fontname#1 \\}
+% \def\purefontname#1{\expandafter\splitoffpurefontname\fontname#1 \\}
+%
+% extra level is needed:
+
+\def\purefontname#1{\@EA\splitoffpurefontname\@EA{\@EA{\@EA\unstringed\fontname#1}} \\}
\def\splitoffpurefontname#1 #2\\{#1}
@@ -3587,12 +3597,13 @@
\doswitchstyle[\fontstyle]}
\unexpanded\def\setsmallbodyfont{\setbodyfontstep\v!small\the\everybodyfont}
-\unexpanded\def\setbigbodyfont {\setbodyfontstep\v!big\the\everybodyfont}
+\unexpanded\def\setbigbodyfont {\setbodyfontstep\v!big \the\everybodyfont}
\unexpanded\def\setmainbodyfont
{\doswitchpoints[\normalizedbodyfontsize]%
\doswitchstyle[\fontstyle]%
- \the\everybodyfont}
+ \the\everybodyfont
+ \saveinterlinespace}
%D \macros
%D {restoreglobalbodyfont}
@@ -3612,14 +3623,16 @@
\doswitchpoints[\normalizedglobalbodyfontsize]%
\doswitchstyle[\globalfontstyle]%
\redoconvertfont % just in case a pagebreak occurs
- \tf \the\everybodyfont}
+ \tf \the\everybodyfont
+ \saveinterlinespace}
\def\partialrestoreglobalbodyfont
{\let\fontsize\defaultfontsize
\let\fontbody\defaultfontbody
\chardef\currentxfontsize\zerocount
\redoconvertfont
- \tf}
+ \tf
+ \saveinterlinespace}
\def\restoreglobalbodyfont % ook style etc
{\ifx\fontclass\globalfontclass
diff --git a/tex/context/base/lang-ini.tex b/tex/context/base/lang-ini.tex
index 7a7b14c09..ec4984baf 100644
--- a/tex/context/base/lang-ini.tex
+++ b/tex/context/base/lang-ini.tex
@@ -311,8 +311,12 @@
% better:
\let\synchronizepatterns\relax % needed?
\let\enabledmapping \empty % needed?
+ % old (original) patterns
\doifelsenothing{#3}{\enableencoding[\s!default]}{\enableencoding[#3]}%
\doifelsenothing{#4}{\enablemapping [\s!default]}{\enablemapping [#4]}%
+ % new patterns
+ % \enableregime[utf]%
+ %
\ifundefined{\??la\??la:\currentencoding:\currentmapping:#2}%
\let\showpatterns\relax
\edef\alreadyloadedlanguage
diff --git a/tex/context/base/mult-sys.tex b/tex/context/base/mult-sys.tex
index 5e8410ed3..91a552b96 100644
--- a/tex/context/base/mult-sys.tex
+++ b/tex/context/base/mult-sys.tex
@@ -546,6 +546,7 @@
\definesystemvariable {sn} % SubNummer
\definesystemvariable {so} % SOrteren
\definesystemvariable {sp} % SelecteerPapier
+\definesystemvariable {sr} % SpacehandleR
\definesystemvariable {ss} % Symbool
\definesystemvariable {st} % STickers
\definesystemvariable {su} % SetUp
diff --git a/tex/context/base/page-imp.tex b/tex/context/base/page-imp.tex
index 1525f3784..e36d90777 100644
--- a/tex/context/base/page-imp.tex
+++ b/tex/context/base/page-imp.tex
@@ -134,7 +134,7 @@
\newcount\shippedoutpages
\let\pagestoshipout\empty % {1,3,6}
-\chardef\whichpagetoshipout=0 % 0=all 1=odd 2=even
+\chardef\whichpagetoshipout=0 % 0=all 1=odd 2=even
\def\actualshipout#1%
{\global\advance\shippedoutpages\plusone
diff --git a/tex/context/base/page-ini.tex b/tex/context/base/page-ini.tex
index ffe29c4e3..f309761fe 100644
--- a/tex/context/base/page-ini.tex
+++ b/tex/context/base/page-ini.tex
@@ -969,6 +969,8 @@
\afterfinaloutput
\popproperties} % ... and here
+% beware: \ifverwerken is in use
+
\def\finaloutput#1#2%
{\checkpageversion
\ifverwerken
@@ -1870,8 +1872,8 @@
\def\doprocesspage[#1][#2]%
{\processaction
[#2]
- [ \v!yes=>\global\verwerkentrue,
- \v!no=>\global\verwerkenfalse]%
+ [\v!yes=>\global\verwerkentrue,
+ \v!no=>\global\verwerkenfalse]%
\gdef\selectie{#1}%
\global\selecterentrue
\global\geselecteerdfalse}
diff --git a/tex/context/base/page-lin.tex b/tex/context/base/page-lin.tex
index b31e46b58..83f8d3608 100644
--- a/tex/context/base/page-lin.tex
+++ b/tex/context/base/page-lin.tex
@@ -34,8 +34,8 @@
\whitespace
%\page[\v!preference]} gaat mis na koppen, nieuw: later \nobreak
\begingroup
- \def\@@rgstepyes{\parindent\zeropoint}%
- \def\@@rgstepno {\parindent\zeropoint}%
+ \def \@@rgstepyes {\parindent\zeropoint}%
+ \def \@@rgstepno {\parindent\zeropoint}%
\edef\@@rgparindent{\the\parindent}%
\globallet\@@rglinesteptoggle\!!plusone
\processaction
@@ -71,13 +71,47 @@
\@@rgstepno
\fi
\futurelet\next\dobetweenthelines}%
- % new
- \processaction
- [\@@rgspace]
- [ \v!on=>\obeyspaces\def\obeyedspace{\mathortext\normalspace{\dontleavehmode{\tt\controlspace}}},
- \v!yes=>\obeyspaces\def\obeyedspace{\mathortext\normalspace{\dontleavehmode\normalspace}}]%
+ \activatespacehandler\@@rgspace
\GotoPar}
+%D When spacing is active we need to handle commands in
+%D a special way:
+%D
+%D \starttyping
+%D \setuplines[space=on]
+%D
+%D \startlines
+%D Let's talk about this{\ttsl\gobbleoneargument or}that.
+%D \stoplines
+%D
+%D \startlines
+%D Let's talk about this{\getvalue{ttsl}or}that.
+%D \stoplines
+%D \stoptyping
+
+% this is not the natural place
+
+\def\installspacehandler#1#2% needs to set \obeyedspace
+ {\setvalue{\??sr#1}{#2}}
+
+\installspacehandler \v!on
+ {\obeyspaces
+ \def\obeyedspace{\mathortext\normalspace{\dontleavehmode{\tt\controlspace}}}%
+ \let\ =\obeyedspace}
+
+\installspacehandler \v!yes
+ {\obeyspaces
+ \def\obeyedspace{\mathortext\normalspace{\dontleavehmode \normalspace }}%
+ \let\ =\obeyedspace}
+
+\installspacehandler \v!off
+ {\normalspaces
+ \let\obeyedspace\normalspace
+ \let\ \normalspacetoken}
+
+\def\activatespacehandler#1%
+ {\executeifdefined{\??sr#1}{\activatespacehandler\v!off}}
+
% \def\dobetweenthelines%
% {\convertcommand \next \to\!!stringa % very ugly and fuzzy
% \convertargument\obeyedline\to\!!stringb % but needed anyway
diff --git a/tex/context/base/page-lyr.tex b/tex/context/base/page-lyr.tex
index 8f8ac24c6..42f989cc5 100644
--- a/tex/context/base/page-lyr.tex
+++ b/tex/context/base/page-lyr.tex
@@ -76,16 +76,16 @@
\def\definelayer
{\dodoubleargument\dodefinelayer}
-\def\dodefinelayer[#1][#2]%
+\def\dodefinelayer[#1][#2]% \zeropoint ipv \!!zeropoint
{\setuplayer
[#1]
[\c!doublesided=,\c!preset=,
\c!state=\v!start,\c!direction=\v!normal,\c!option=,
- \c!x=\!!zeropoint,\c!y=\!!zeropoint,\c!position=\v!no,
+ \c!x=\zeropoint,\c!y=\zeropoint,\c!position=\v!no,
\c!line=0,\c!column=0,
\c!width=\nextboxwd,\c!height=\nextboxht,
- \c!offset=\!!zeropoint,\c!rotation=, % geen 0 !
- \c!hoffset=\!!zeropoint,\c!voffset=\!!zeropoint,
+ \c!offset=\zeropoint,\c!rotation=, % geen 0 !
+ \c!hoffset=\zeropoint,\c!voffset=\zeropoint,
\c!dx=\zeropoint,\c!dy=\zeropoint,
\c!location=rb,\c!position=\v!no,\c!page=,
\c!method=\v!overlay,
@@ -486,10 +486,11 @@
\else
\if!!donec\box\else\copy\fi\layerbox % sorry for the delay due to copying
\fi
+ % todo: method=offset => overlayoffset right/down (handy for backgrounds with offset)
\iftracelayers \ruledvbox \else \vbox \fi \if!!donea to \overlayheight \fi
{\hbox \if!!donea to \overlaywidth \fi
{% klopt dit? #3 en niet #2 ?
- \doifvalue{\??ll#3\realfolio\c!position}\v!yes {\xypos{lyr:#3:\realfolio}}%
+ \doifvalue{\??ll#3\realfolio\c!position}\v!yes{\xypos{lyr:#3:\realfolio}}%
\doifoverlayelse{#3}
{\box\nextbox}
{\startlayoutcomponent{l:#3}{layer #3}\box\nextbox\stoplayoutcomponent}%
diff --git a/tex/context/base/page-mar.tex b/tex/context/base/page-mar.tex
index 856849408..4537a2920 100644
--- a/tex/context/base/page-mar.tex
+++ b/tex/context/base/page-mar.tex
@@ -673,6 +673,10 @@
\fi
\egroup}
+\def\setmargincontentpenalties
+ {\getnoflines\margincontentheight
+ \keeplinestogether\noflines}
+
\def\savemargincontentlines
{\bgroup
\advance\margincontentheight \margincontentextralines\lineheight % 1 by default
@@ -696,9 +700,20 @@
\global\chardef\margintextcollected\zerocount
\global\collectedmargintexts\emptytoks}
+% \def\placemargincontent
+% {\ifcase\margintextcollected\else
+% \bgroup
+% \chardef\graphicvadjustmode\zerocount
+% \doflushmargincontents
+% \egroup
+% \fi}
+%
+% font fix:
+
\def\placemargincontent
- {\ifcase\margintextcollected\else
+ {\ifcase\margintextcollected\else % was level check
\bgroup
+ \redoconvertfont % !!
\chardef\graphicvadjustmode\zerocount
\doflushmargincontents
\egroup
diff --git a/tex/context/base/page-mul.tex b/tex/context/base/page-mul.tex
index efeb81194..c68a4dcf2 100644
--- a/tex/context/base/page-mul.tex
+++ b/tex/context/base/page-mul.tex
@@ -144,7 +144,7 @@
%D \interface \type{\openlineheight} \\
%D the lineheight (including \type{\spacing}) \\
%D
-%D \interface \type{\Everybodyfont} \\
+%D \interface \type{\EveryBodyFont} \\
%D communication channel to font switching routines \\
%D
%D \interface \type{\global\settopskip} \\
@@ -380,13 +380,38 @@
\multiply\mcscratchdimen \plustwo
\advance\mcscratchdimen \columntextheight
\ifdim\precolumnboxheight>\zeropoint
- \advance\mcscratchdimen -\precolumnboxheight
+ \advance\mcscratchdimen -\precolumnboxheight
\fi
\settotalinsertionheight
\advance\mcscratchdimen -\totalinsertionheight
\getnoflines\mcscratchdimen
+ % added 30/7/2004
+ \ifnum\layoutlines>\zerocount \ifnum\noflines>\layoutlines
+ \noflines\layoutlines
+ \fi \fi
\nofcolumnlines\noflines}
+% probaby better, test first, don't replace yet
+%
+% \def\getmulticolumnlines
+% {\mcscratchdimen-\columntextoffset
+% \multiply\mcscratchdimen \plustwo
+% % \advance\mcscratchdimen \columntextheight
+% \ifdim\precolumnboxheight>\zeropoint
+% \advance\mcscratchdimen -\precolumnboxheight
+% \fi
+% \settotalinsertionheight
+% \advance\mcscratchdimen -\totalinsertionheight
+% \getnoflines\mcscratchdimen
+% \ifnum\layoutlines>\zerocount
+% \noflines-\noflines
+% \advance\noflines\layoutlines
+% \ifnum\noflines<\zerocount
+% \noflines\zerocount
+% \fi
+% \fi
+% \nofcolumnlines\noflines}
+
\def\setcolumnvsize
{\getmulticolumnlines
\mcscratchdimen\nofcolumnlines\openlineheight
@@ -450,7 +475,8 @@
\break % Sometimes fails
\fi
\appendtoks\topskip1\topskip\to\everybodyfont
- \the\everybodyfont
+ \the\everybodyfont % ugly here
+\saveinterlinespace % uglu here
\initializecolumns\nofcolumns
\hangafter\zerocount
\hangindent\zeropoint
diff --git a/tex/context/base/page-one.tex b/tex/context/base/page-one.tex
index ed4bc11d0..124232868 100644
--- a/tex/context/base/page-one.tex
+++ b/tex/context/base/page-one.tex
@@ -520,10 +520,42 @@
\doinsertfloatinfo
\dochecknextindentation\??bk}
+% \def\OTRONEsomefixdfloat % [#1]
+% {\docheckiffloatfits
+% \ifroomforfloat\else
+% \goodbreak
+% \fi
+% \showmessage\m!floatblocks9\empty
+% \someherefloat} % [#1]
+%
+% better:
+%
+% \dorecurse{50}
+% {[before normal] \input thuan
+% \placefigure{normal}{\framed[height=1cm,width=8cm]{}}
+% \placefigure{normal}{\framed[height=2cm,width=8cm]{}}
+% [before force] \input thuan
+% \placefigure[force]{force}{\framed[height=8cm,width=8cm]{}}}
+
+\chardef\fixedfloatmethod=3
+
\def\OTRONEsomefixdfloat % [#1]
{\docheckiffloatfits
\ifroomforfloat\else
- \goodbreak
+ \ifzeropt\pagetotal
+ % let's assume that there is room
+ \else
+ \ifcase\fixedfloatmethod
+ % disabled
+ \or % 1 (old method)
+ \goodbreak
+ \or % 2 (safe method)
+ \page
+ \or % 3 (keeps in stream)
+ \vskip-.5\floatheight % play safe
+ \vskip\textheight
+ \fi
+ \fi
\fi
\showmessage\m!floatblocks9\empty
\someherefloat} % [#1]
diff --git a/tex/context/base/page-set.tex b/tex/context/base/page-set.tex
index ea3d030a9..76866c563 100644
--- a/tex/context/base/page-set.tex
+++ b/tex/context/base/page-set.tex
@@ -84,11 +84,29 @@
% \startcolumnset [three] \dorecurse {1}{\input tufte \par} \stopcolumnset
% \stoptext
+%D test case of Vit Zika (context list):
+%D
+%D \starttyping
+%D \setuplayout[height=middle,width=middle,grid=yes]
+%D
+%D \starttext
+%D \startcolumnset
+%D \dorecurse{10}
+%D {\input thuan \endgraf
+%D \bgroup
+%D \ss\restoreinterlinespace
+%D \dorecurse{3}{\input hawking \endgraf}
+%D \egroup
+%D \input bryson \endgraf}
+%D \stopcolumnset
+%D \stoptext
+%D \stoptyping
+
\def\OTRSETsetcorrectnofcells#1%
{\bgroup
\!!counta#1\relax
\ifdim\globalbodyfontsize=\localbodyfontsize
- % already ok
+ \restoreinterlinespace
\else
\!!dimena-\!!counta\lineheight
\restoreglobalbodyfont % slow, we need a fast one
@@ -106,7 +124,7 @@
{\bgroup
\!!dimena-\strutht\relax
\ifdim\globalbodyfontsize=\localbodyfontsize
- % already ok
+ \restoreinterlinespace
\else
\restoreglobalbodyfont
\fi
@@ -1349,13 +1367,32 @@
\def\OTRSETstoreincolumnslotUNKNOWN#1%
{\OTRSETprepareforcolumnslot2{#1}\copy#1} % {} ?
+% \def\OTRSETprepareforcolumnslot#1#2% 1=hoog 2=midden 3=laag
+% {\dp#2\zeropoint
+% \ifcase\columnslotspacing\else
+% \scratchdimen\columnslotspacing\lineheight
+% \ifnum#1=2 \scratchdimen2\scratchdimen \fi
+% \setbox#2\vbox spread \scratchdimen
+% {\ifnum#1>1\vss\fi\box#2\relax\ifnum#1<3\vss\fi}%
+% \fi}
+
\def\OTRSETprepareforcolumnslot#1#2% 1=hoog 2=midden 3=laag
{\dp#2\zeropoint
\ifcase\columnslotspacing\else
\scratchdimen\columnslotspacing\lineheight
\ifnum#1=2 \scratchdimen2\scratchdimen \fi
- \setbox#2\vbox spread \scratchdimen
- {\ifnum#1>1\vss\fi\box#2\relax\ifnum#1<3\vss\fi}%
+ \begingroup
+ \advance\scratchdimen\ht#2\relax
+ \ifdim\scratchdimen<\columnmaxcells\lineheight
+ \endgroup \setbox#2\vbox spread \scratchdimen \bgroup
+ \else
+ \endgroup \setbox#2\vbox to \columnmaxcells\lineheight \bgroup
+ \vskip\strutdepth
+ \fi
+ \ifnum#1>1\vss\fi
+ \box#2\relax
+ \ifnum#1<3\vss\fi
+ \egroup
\fi}
\def\OTRSETdocheckiffloatfits % eigenlijk moet else float anders
@@ -1673,6 +1710,7 @@
\global\chardef\OTRSETfinish\zerocount
\ifnum\columnsetlevel=\plusone
\bgroup
+ \saveinterlinespace
\globallet\columnsetpage\!!plusone
\def\currentcolumnset{#2}%
\insidecolumnstrue % will be different flag
@@ -1805,6 +1843,30 @@
% so this will be changed
+% \def\OTRSETnobalance
+% {\iflastcolumnfootnotes % testen ! optie
+% % inhibit flush of floats !
+% % todo: nothing if no footnotes, else empty page
+% \dostepwiserecurse\mofcolumns\nofcolumns\plusone
+% {\vskip-\struttotal\verticalstrut\vfill\eject}%
+% \else
+% \ifdim\pagetotal>\zeropoint % no, see example **
+% \ifnum\mofcolumns=\nofcolumns
+% \OTRSETflushfinalfootnotes
+% \else
+% % probably todo
+% \fi
+% \vfill
+% \eject
+% % brr, may result in empty page after nicely fit text
+% % or if left, then lost of first column only text
+% \ifnum\mofcolumns>1
+% \OTRSETdofinalflush
+% \OTRSETdofinaloutput
+% \fi
+% \fi
+% \fi}
+
\def\OTRSETnobalance
{\iflastcolumnfootnotes % testen ! optie
% inhibit flush of floats !
@@ -1812,7 +1874,14 @@
\dostepwiserecurse\mofcolumns\nofcolumns\plusone
{\vskip-\struttotal\verticalstrut\vfill\eject}%
\else
- \ifdim\pagetotal>\zeropoint % no, see example **
+ \ifnum\mofcolumns>\plusone
+ \donetrue
+ \else\ifdim\pagetotal>\zeropoint % too dangerous, we loose data
+ \donetrue
+ \else
+ \donefalse
+ \fi\fi
+ \ifdone
\ifnum\mofcolumns=\nofcolumns
\OTRSETflushfinalfootnotes
\else
@@ -1822,7 +1891,7 @@
\eject
% brr, may result in empty page after nicely fit text
% or if left, then lost of first column only text
- \ifnum\mofcolumns>1
+ \ifnum\mofcolumns>\plusone
\OTRSETdofinalflush
\OTRSETdofinaloutput
\fi
@@ -1876,9 +1945,10 @@
\egroup}}
\OTRSEToutput
- {\OTRSETnaturalflush
+ {\dontcomplain % new, get rid of overfull message (to be sorted out)
+ \OTRSETnaturalflush
%\OTRSETstartnextpage
- \OTRSETdoflushfloats % zou eigenlijk in \flushsavedfloats moeten (gaat fout)
+ \OTRSETdoflushfloats % actually belongs in \flushsavedfloats (but goes wrong)
\OTRSETcheckfreelines
\OTRSETchecksidefloat}
diff --git a/tex/context/base/s-pre-00.tex b/tex/context/base/s-pre-00.tex
index 8e3eefc23..7b22e2fd9 100644
--- a/tex/context/base/s-pre-00.tex
+++ b/tex/context/base/s-pre-00.tex
@@ -48,7 +48,7 @@
[\vbox to \textheight
{\dopresentationstep1\box\presentationstack\vfill}]}
-\def\presentationstep%
+\def\presentationstep
{\dopresentationstep0}
\def\dopresentationstep#1% not ok yet
@@ -79,7 +79,7 @@
\definesymbol
[\presentationtag]
[\presentationshade]
- \def\presentationshade%
+ \def\presentationshade
{\presentationshield
[\c!width=\textwidth,\c!height=\presentationstepheight]{}}
\definefield[\presentationtag][check][presentation][\presentationtag,\v!none][\presentationtag]
diff --git a/tex/context/base/s-pre-60.tex b/tex/context/base/s-pre-60.tex
index 8170e5a22..baedffaa3 100644
--- a/tex/context/base/s-pre-60.tex
+++ b/tex/context/base/s-pre-60.tex
@@ -80,6 +80,7 @@
\setupinteraction
[openaction=SetupStepper,
+ closeaction=ResetStepper,
openpageaction=CheckStepper,
closepageaction=ResetStepper]
diff --git a/tex/context/base/s-pre-61.tex b/tex/context/base/s-pre-61.tex
index 59c21202e..4e772a0ce 100644
--- a/tex/context/base/s-pre-61.tex
+++ b/tex/context/base/s-pre-61.tex
@@ -142,10 +142,20 @@
StopPage ;
\stopuniqueMPgraphic
-\NormalizeFontHeight \HeadFont {\setstrut\strut\quad} {1.0\headerheight} {SansBold}
-\NormalizeFontHeight \TitleFont {\setstrut\strut\quad} {2.0\headerheight} {SansBold}
-\NormalizeFontHeight \SubTitleFont {\setstrut\strut\quad} {1.5\headerheight} {SansBold}
-\NormalizeFontHeight \SubSubTitleFont {\setstrut\strut\quad} {1.0\headerheight} {SansBold}
+% this needs to be sorted out !
+
+\appendtoks
+ \NormalizeFontHeight \HeadFont {\setstrut\strut\quad} {1.0\headerheight} {SansBold}
+ \NormalizeFontHeight \TitleFont {\setstrut\strut\quad} {2.0\headerheight} {SansBold}
+ \NormalizeFontHeight \SubTitleFont {\setstrut\strut\quad} {1.5\headerheight} {SansBold}
+ \NormalizeFontHeight \SubSubTitleFont {\setstrut\strut\quad} {1.0\headerheight} {SansBold}
+\to \everystarttext
+\appendtoks
+ \NormalizeFontHeight \HeadFont {\setstrut\strut\quad} {1.0\headerheight} {SansBold}
+ \NormalizeFontHeight \TitleFont {\setstrut\strut\quad} {2.0\headerheight} {SansBold}
+ \NormalizeFontHeight \SubTitleFont {\setstrut\strut\quad} {1.5\headerheight} {SansBold}
+ \NormalizeFontHeight \SubSubTitleFont {\setstrut\strut\quad} {1.0\headerheight} {SansBold}
+\to \everystoptext
\setuphead
[chapter]
@@ -170,7 +180,7 @@
\setupitemize
[each]
- [loose,serried,joinedup]
+ [loose,serried,joinedup,broad]
[symbol=emdash]
\setupalign
@@ -209,6 +219,8 @@
\doifnotmode{demo}{\endinput}
+\starttext
+
\TitlePage{Stepwise\\Refinement}
\Topics{Topics}
diff --git a/tex/context/base/spec-tpd.tex b/tex/context/base/spec-tpd.tex
index 2f81610d2..56fd9342c 100644
--- a/tex/context/base/spec-tpd.tex
+++ b/tex/context/base/spec-tpd.tex
@@ -207,6 +207,7 @@
%D This token register is flushed before an ximage is loaded.
\newevery \everyPDFximage \relax
+\let \everyPDFxform \everyPDFximage
%D \macros
%D {dosetuppaper}
@@ -970,6 +971,7 @@
% resources end up there; otherwise transparencies
% won't work in xforms; some day I will optimize
% this.
+ \the\everyPDFxform
\immediate\pdfxform
resources {\currentPDFresources\the\pdfpageresources}%
\nextbox
@@ -1006,6 +1008,7 @@
\setbox\nextbox\vbox\bgroup
\def\dodostopobject
{\egroup
+ \the\everyPDFxform
\pdfform\nextbox
\dosetobjectreference{#1}{#2}{\the\pdflastform}}}
diff --git a/tex/context/base/supp-fil.tex b/tex/context/base/supp-fil.tex
index a4041ad65..cd0c48150 100644
--- a/tex/context/base/supp-fil.tex
+++ b/tex/context/base/supp-fil.tex
@@ -650,9 +650,33 @@
\def\splitoffroot{.} \chardef\splitoffkind\zerocount
+% \def\splitfilename#1%
+% {\edef\splitofffull{#1}% normally outside this call: \sanitizefilename#1\to\sanitizedfilename
+% \greedysplitstring\splitofffull\at/\to\splitoffpath\and\splitoffbase
+% \ifx\splitoffbase\empty
+% \let\splitoffpath\empty
+% \let\splitoffbase\splitofffull
+% \fi
+% \greedysplitstring\splitoffbase\at.\to\splitoffname\and\splitofftype
+% \chardef\splitoffkind % can be used to test if pathpart was empty
+% \ifx\splitoffpath\empty \zerocount \else
+% \ifx\splitoffpath\splitoffroot \plusone \else
+% \plustwo \fi\fi
+% \ifx\splitoffname\empty\let\splitoffname\splitoffbase\fi
+% \ifx\splitoffpath\empty\let\splitoffpath\splitoffroot\fi}
+%
+% better, since it also handles leading /'s
+%
+% \splitfilename{oeps/test.pdf} [\splitoffpath\quad\splitoffname\quad\splitofftype]
+% \splitfilename{/oeps/test.pdf} [\splitoffpath\quad\splitoffname\quad\splitofftype]
+% \splitfilename{/test.pdf} [\splitoffpath\quad\splitoffname\quad\splitofftype]
+
\def\splitfilename#1%
{\edef\splitofffull{#1}% normally outside this call: \sanitizefilename#1\to\sanitizedfilename
\greedysplitstring\splitofffull\at/\to\splitoffpath\and\splitoffbase
+ \ifx\splitoffpath\splitofffull
+ \let\splitoffpath\empty
+ \fi
\ifx\splitoffbase\empty
\let\splitoffpath\empty
\let\splitoffbase\splitofffull
diff --git a/tex/context/base/supp-pdf.tex b/tex/context/base/supp-pdf.tex
index 184cfb815..4ef82cdb7 100644
--- a/tex/context/base/supp-pdf.tex
+++ b/tex/context/base/supp-pdf.tex
@@ -1248,41 +1248,42 @@
\def\MPreadjustdimen % acts on \MPscratchDim and MPscratchCnt
{\ifcase\MPscratchCnt
- \multiply\MPscratchDim 4
+ \multiply\scratchdimen 4
\or
- \multiply\MPscratchDim 2
+ \multiply\scratchdimen 2
\else
\expandafter\doMPreadjustdimen
\fi}
\def\doMPreadjustdimen
- {\ifnum\MPscratchCnt > 2
- \divide\MPscratchDim 2
+ {\ifnum\MPscratchCnt>2
+ \divide\scratchdimen 2
\advance\MPscratchCnt \minusone
\expandafter\doMPreadjustdimen
\fi}
\def\MPreciprocaldeterminant
- {\MPscratchDim\withoutpt\the\dimen0 \dimen6 % s_x*s_y
- \advance\MPscratchDim - \withoutpt\the\dimen2 \dimen4 % s_x*s_y - r_x*r_y
- \ifdim\MPscratchDim<\zeropoint % we need a positive dimension
- \MPscratchDim-\MPscratchDim % for \MPadjustdimen
+ {\scratchdimen\withoutpt\the\dimen0 \dimen6 % s_x*s_y
+ \advance\scratchdimen - \withoutpt\the\dimen2 \dimen4 % s_x*s_y - r_x*r_y
+ \ifdim\scratchdimen<\zeropoint % we need a positive dimension
+ \scratchdimen-\scratchdimen % for \MPadjustdimen (?)
\doMPreciprocal
- \MPscratchDim-\MPscratchDim
+ \scratchdimen-\scratchdimen
\else
\doMPreciprocal
- \fi}
+ \fi
+ \edef\MPreciprocal{\withoutpt\the\scratchdimen}}
\newcount\MPnumerator \MPnumerator = 1073741824 % 2^{30}
% todo: dimexpr
-\def\doMPreciprocal % replace \MPscratchDim with its reciprocal
- {\ifdim\MPscratchDim=\onepoint \else
+\def\doMPreciprocal % replace \scratchdimen with its reciprocal
+ {\ifdim\scratchdimen=\onepoint \else
\MPadjustdimen
\scratchcounter\MPnumerator
- \divide\scratchcounter\MPscratchDim
- \MPscratchDim1\scratchcounter % 1 needed !
+ \divide\scratchcounter\scratchdimen
+ \scratchdimen1\scratchcounter % 1 needed !
\MPreadjustdimen
\fi}
@@ -1579,6 +1580,21 @@
%D
%D If this should ever cause problems, the scale factors can be reduced.
+% \def\doMPconcat#1#2#3#4%
+% {\dimen12=#1pt % p_x % #1\onepoint
+% \dimen14=#3pt % p_y % #3\onepoint
+% \advance\dimen12 -\dimen8 % p_x - t_x
+% \advance\dimen14 -\dimen10 % p_y - t_y
+% \dimen18=\withoutpt\the\dimen6 \dimen12 % s_y(p_x - t_x)
+% \advance\dimen18 -\withoutpt\the\dimen4 \dimen14 % - r_y(p_y-t_y)
+% \dimen14=\withoutpt\the\dimen0 \dimen14 % s_x(p_y-t_y)
+% \advance\dimen14 -\withoutpt\the\dimen2 \dimen12 % - r_x(p_x-t_x)
+% % \MPscratchDim contains precomputed 1/D:
+% \dimen18=\withoutpt\the\MPscratchDim \dimen18
+% \dimen14=\withoutpt\the\MPscratchDim \dimen14
+% \edef#2{\withoutpt\the\dimen18}% % p_x^\prime
+% \edef#4{\withoutpt\the\dimen14}} % p_y^\prime
+
\def\doMPconcat#1#2#3#4%
{\dimen12=#1pt % p_x % #1\onepoint
\dimen14=#3pt % p_y % #3\onepoint
@@ -1588,12 +1604,22 @@
\advance\dimen18 -\withoutpt\the\dimen4 \dimen14 % - r_y(p_y-t_y)
\dimen14=\withoutpt\the\dimen0 \dimen14 % s_x(p_y-t_y)
\advance\dimen14 -\withoutpt\the\dimen2 \dimen12 % - r_x(p_x-t_x)
- % \MPscratchDim contains precomputed 1/D:
- \dimen18=\withoutpt\the\MPscratchDim \dimen18
- \dimen14=\withoutpt\the\MPscratchDim \dimen14
+ % \MPreciprocal contains precomputed 1/D:
+ \dimen18=\MPreciprocal\dimen18
+ \dimen14=\MPreciprocal\dimen14
\edef#2{\withoutpt\the\dimen18}% % p_x^\prime
\edef#4{\withoutpt\the\dimen14}} % p_y^\prime
+% faster but not that often used
+%
+% \def\doMPconcat#1#2#3#4%
+% {\dimen12\dimexpr#1\points-\dimen 8\relax % p_x-t_x
+% \dimen14\dimexpr#3\points-\dimen10\relax % p_y-t_y
+% \dimen18\dimexpr\withoutpt\the\dimen6\dimen12-\withoutpt\the\dimen4\dimen14\relax % s_y(p_x-t_x)-r_y(p_y-t_y)
+% \dimen14\dimexpr\withoutpt\the\dimen0\dimen14-\withoutpt\the\dimen2\dimen12\relax % s_x(p_y-t_y)-r_x(p_x-t_x)
+% \edef#2{\withoutpt\the\dimexpr\MPreciprocal\dimen18\relax}% % p_x^\prime
+% \edef#4{\withoutpt\the\dimexpr\MPreciprocal\dimen14\relax}} % p_y^\prime
+
%D One reason for Daniel to write this patch was that at small sizes
%D the accuracy was less than optimal. Here is a test that demonstrates
%D that his alternative is pretty good:
diff --git a/tex/context/base/syst-ext.tex b/tex/context/base/syst-ext.tex
index a87e5e272..50a8792e0 100644
--- a/tex/context/base/syst-ext.tex
+++ b/tex/context/base/syst-ext.tex
@@ -638,8 +638,11 @@
\endTEX
+\def\expandrecursecontent
+ {\csname\@@arecurse\recursedepth\endcsname}
+
\def\redostepwiserecurse
- {\csname\@@arecurse\recursedepth\endcsname\dodostepwiserecurse}
+ {\expandrecursecontent\dodostepwiserecurse}
\beginETEX \numexpr
@@ -668,7 +671,7 @@
\endTEX
\def\redostepwisereverse
- {\csname\@@arecurse\recursedepth\endcsname\dodostepwisereverse}
+ {\expandrecursecontent\dodostepwisereverse}
\def\exitstepwiserecurse
{\nodostepwiserecurse\relax}
@@ -752,7 +755,7 @@
\endTEX
\def\redorecurse
- {\csname\@@arecurse\recursedepth\endcsname\dodorecurse}
+ {\expandrecursecontent\dodorecurse}
\def\nodorecurse#1#2#3%
{\@EA\let\@EA\recurselevel\csname\@@irecurse\recursedepth\endcsname
@@ -897,7 +900,7 @@
\endTEX
\def\redoloop
- {\csname\@@arecurse\recursedepth\endcsname\endofloop}
+ {\expandrecursecontent\endofloop}
\def\nodoloop#1%
{\let\endofloop\dodoloop % new, permits nested \doloop's
@@ -2442,21 +2445,23 @@
\fi}%
\@EA\dosplitstring#1\empty\empty\empty#2\empty\empty\empty\\}
-\def\greedysplitstring#1\at#2\to#3\and#4%
- {\edef\asciib{#1}%
- \let\asciic\asciib
- \let#3\empty
- \let#4\empty
- \doloop
- {\expandafter\splitstring\asciib\at#2\to\asciia\and\asciib
- \ifx\asciib\empty
- \exitloop
- \else
- \edef#3{\ifx#3\empty\else#3#2\fi\asciia}%
- \let#4\asciib
- \fi}%
- \ifx#3\empty\let#3\asciic\fi}
-
+% Ok, but not for all cases:
+%
+% \def\greedysplitstring#1\at#2\to#3\and#4%
+% {\edef\asciib{#1}%
+% \let\asciic\asciib
+% \let#3\empty
+% \let#4\empty
+% \doloop
+% {\expandafter\splitstring\asciib\at#2\to\asciia\and\asciib
+% \ifx\asciib\empty
+% \exitloop
+% \else
+% \edef#3{\ifx#3\empty\else#3#2\fi\asciia}%
+% \let#4\asciib
+% \fi}%
+% \ifx#3\empty\let#3\asciic\fi}
+%
% The next one is some 25\% faster, but it hardly matters because
% we seldom use this macro.
%
@@ -2475,6 +2480,25 @@
% \fi}%
% \dogreedysplitstring
% \ifx#3\empty\let#3\asciic\fi}
+%
+% The better alternative:
+
+\def\greedysplitstring#1\at#2\to#3\and#4%
+ {\edef\asciib{#1}%
+ \let\asciic\asciib
+ \let#3\empty
+ \let#4\empty
+ \doloop
+ {\expandafter\splitstring\asciib\at#2\to\asciia\and\asciib
+ \ifx\asciib\empty
+ \exitloop
+ \else
+ % not \edef#3{\ifx#3\empty\else#3#2\fi\asciia} else
+ % /root/path fails because then #3==empty
+ \edef#3{\ifcase\recurselevel\or\else#3#2\fi\asciia}%
+ \let#4\asciib
+ \fi}%
+ \ifx#3\empty\let#3\asciic\fi}
%D \macros
%D {beforetestandsplitstring,
diff --git a/tex/context/base/syst-new.tex b/tex/context/base/syst-new.tex
index fb0200613..5c2f21c99 100644
--- a/tex/context/base/syst-new.tex
+++ b/tex/context/base/syst-new.tex
@@ -780,4 +780,33 @@
%D \test{1,,3,,4,,5,,8,,10,,11,}
%D \stoplines
+%D \macros
+%D {stripstring}
+%D
+%D Needed in bookmarks:
+%D
+%D \starttyping
+%D {\sanitizePDFdocencoding test \CONTEXT\ test \to\oeps\stripstring\oeps\tttf[\oeps]}
+%D \stoptyping
+
+\def\stripstring#1% #1 is \cs
+ {\bgroup
+ \convertcommand#1\to\ascii
+ \global\let\globalascii\empty
+ \donefalse
+ \expandafter\handletokens\ascii\with\dostripstring
+ \egroup
+ \let#1\globalascii}
+
+\def\dostripstring#1%
+ {\ifx#1\blankspace
+ \donetrue
+ \else
+ \ifdone\ifx\globalascii\empty\else
+ \xdef\globalascii{\globalascii\space}%
+ \donefalse
+ \fi\fi
+ \xdef\globalascii{\globalascii#1}%
+ \fi}
+
\protect \endinput
diff --git a/tex/context/base/type-buy.tex b/tex/context/base/type-buy.tex
index c9300a473..9bc16c079 100644
--- a/tex/context/base/type-buy.tex
+++ b/tex/context/base/type-buy.tex
@@ -811,6 +811,56 @@
\stoptypescript
+
+% ef swift
+%
+% texfont --enc=texnansi --ven=ef --col=swift type-buy.dat
+
+\starttypescript [map] [swift] [ec,texnansi]
+ \loadmapfile[\typescriptthree-itc-bauhaus.map]
+\stoptypescript
+
+\starttypescript [serif] [swift] [ec,texnansi]
+
+ \loadmapfile[\typescriptthree-ef-swift.map]
+
+ \definefontsynonym[SwiftEF-Light] [\typescriptthree-swlt] [encoding=\typescriptthree]
+ \definefontsynonym[SwiftEF-Regular] [\typescriptthree-swrg] [encoding=\typescriptthree]
+ \definefontsynonym[SwiftEF-Bold] [\typescriptthree-swbd] [encoding=\typescriptthree]
+ \definefontsynonym[SwiftEF-ExtraBold] [\typescriptthree-swxb] [encoding=\typescriptthree]
+
+ \definefontsynonym[SwiftEF-LightItalic] [\typescriptthree-swlti][encoding=\typescriptthree]
+ \definefontsynonym[SwiftEF-RegularItalic][\typescriptthree-swrgi][encoding=\typescriptthree]
+
+ \definefontsynonym[SwiftEF-BoldCondensed][\typescriptthree-swbdc][encoding=\typescriptthree]
+ \definefontsynonym[SwiftSCEF-Regular] [\typescriptthree-swrgs][encoding=\typescriptthree]
+
+\stoptypescript
+
+\starttypescript [serif] [swift] [name]
+
+ \definefontsynonym [Serif] [SwiftEF-Regular]
+ \definefontsynonym [SerifItalic] [SwiftEF-RegularItalic]
+ \definefontsynonym [SerifSlanted] [SwiftEF-RegularItalic]
+ \definefontsynonym [SerifBold] [SwiftEF-Bold]
+ \definefontsynonym [SerifBoldItalic] [SwiftEF-Bold]
+ \definefontsynonym [SerifBoldSlanted] [SwiftEF-Bold]
+ \definefontsynonym [SerifCaps] [SwiftSCEF-Regular]
+
+\stoptypescript
+
+\starttypescript [serif] [swift-light] [name]
+
+ \definefontsynonym [Serif] [SwiftEF-Light]
+ \definefontsynonym [SerifItalic] [SwiftEF-LightItalic]
+ \definefontsynonym [SerifSlanted] [SwiftEF-LightItalic]
+ \definefontsynonym [SerifBold] [SwiftEF-Regular]
+ \definefontsynonym [SerifBoldItalic] [SwiftEF-RegularItalic]
+ \definefontsynonym [SerifBoldSlanted] [SwiftEF-RegularItalic]
+ \definefontsynonym [SerifCaps] [SwiftSCEF-Regular]
+
+\stoptypescript
+
\stoptypescriptcollection
\endinput
diff --git a/tex/context/base/type-cbg.tex b/tex/context/base/type-cbg.tex
index c3b8fd586..1c041376b 100644
--- a/tex/context/base/type-cbg.tex
+++ b/tex/context/base/type-cbg.tex
@@ -74,13 +74,13 @@
\starttypescript [mono] [cbgreek] [name]
- \definefontsynonym [CBGreek-Mono-Medium-Normal] [gttn1000]
- \definefontsynonym [CBGreek-Mono-Medium-Oblique] [gtto1000]
- \definefontsynonym [CBGreek-Mono-Medium-Italic] [gtti1000]
- \definefontsynonym [CBGreek-Mono-Medium-UprightItalic] [gttu1000]
- \definefontsynonym [CBGreek-Mono-Medium-Caps] [gttc1000]
- \definefontsynonym [CBGreek-Mono-Medium-Leipzig] [gttl1000]
- \definefontsynonym [CBGreek-Mono-Medium-Roman] [gttr1000]
+ \definefontsynonym [CBGreek-Typewriter-Medium-Normal] [gttn1000]
+ \definefontsynonym [CBGreek-Typewriter-Medium-Oblique] [gtto1000]
+ \definefontsynonym [CBGreek-Typewriter-Medium-Italic] [gtti1000]
+ \definefontsynonym [CBGreek-Typewriter-Medium-UprightItalic] [gttu1000]
+ \definefontsynonym [CBGreek-Typewriter-Medium-Caps] [gttc1000]
+ \definefontsynonym [CBGreek-Typewriter-Medium-Leipzig] [gttl1000]
+ \definefontsynonym [CBGreek-Typewriter-Medium-Roman] [gttr1000]
\stoptypescript
diff --git a/tex/context/base/type-ini.tex b/tex/context/base/type-ini.tex
index a520a14da..645956065 100644
--- a/tex/context/base/type-ini.tex
+++ b/tex/context/base/type-ini.tex
@@ -423,6 +423,7 @@
\def\loadallfontmapfiles
{%\message{[\allfontmapsfiles]}%
\ifconditional\resettingmapfile
+ \writestatus\m!fonts{resetting map file list}%
\doresetmapfilelist
\global\setfalse\resettingmapfile
\fi
@@ -450,11 +451,24 @@
\fi}
% since this is driver dependent, and since we may set map files
-% before an output format is defined, we need to postpone it
-
-%appendtoks \loadallfontmapfiles \to \everyPDFximage
-\appendtoks \loadallfontmapfiles \to \everystarttext
-\appendtoks \loadallfontmapfiles \to \everybeforepagebody
+% before an output format is defined, we need to postpone it; we
+% cannot use starttext as hook because an output switch can be part
+% of a style; an alternative is to no longer permit driver switching
+% after the first \starttext, but that will break compatibility
+% because \startcomponent ... \environment ... is pretty legal.
+
+% the map directives need to end up in the right place in the stream
+
+% \appendtoks \loadallfontmapfiles \to \everyPDFximage
+% \appendtoks \loadallfontmapfiles \to \everystarttext
+% \appendtoks \loadallfontmapfiles \to \everybeforepagebody
+
+\everybeforeshipout \expandafter
+ {\expandafter\appendtoks
+ \expandafter\loadallfontmapfiles
+ \expandafter\to
+ \expandafter\pageboundsettings
+ \the\everybeforeshipout}
\newif\ifautoloadmapfiles
diff --git a/tex/context/base/type-pre.tex b/tex/context/base/type-pre.tex
index bb5a55e0f..a1fa0d1cf 100644
--- a/tex/context/base/type-pre.tex
+++ b/tex/context/base/type-pre.tex
@@ -11,6 +11,11 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
+%D This file is obsolete. We now have latin modern and proper
+%D typescripts. Forget about this file.
+
+\endinput
+
%D This file defines some typescripts that simulate the pre-typescript way
%D of defining fonts. This file will not be extended.
diff --git a/tex/context/base/unic-033.tex b/tex/context/base/unic-033.tex
index 5ff0d2e4d..26c5a23d7 100644
--- a/tex/context/base/unic-033.tex
+++ b/tex/context/base/unic-033.tex
@@ -5,25 +5,135 @@
%D subtitle=Vector 33,
%D author=Hans Hagen,
%D date=\currentdate,
-%D copyright={PRAGMA / Hans Hagen \& Ton Otten}]
+%D copyright={PRAGMA / Nikolai Weibull}]
%C
%C This module is part of the \CONTEXT\ macro||package and is
-%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
-%C details.
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
-\unprotect
+\unprotect
-\startunicodevector 33
- \ifcase\numexpr(#1-34)
- \@@unknownchar \else % TRADE MARK SIGN
- \@@unknownchar
- \fi
-\stopunicodevector
-
-%D For the moment:
+% \startunicodevector 33
+% \@@unknownchar
+% \stopunicodevector
\startunicodevector 33
- \@@unknownchar
+ \expandafter\strippedcsname
+ \ifcase\numexpr(#1-144+1) % space needed, terminates expr
+ \unknownchar \or % hack for getting leftarrow working
+ \leftarrow \or % LEFTWARDS ARROW
+ \uparrow \or % UPWARDS ARROW
+ \rightarrow \or % RIGHTWARDS ARROW
+ \downarrow \or % DOWNWARDS ARROW
+ \leftrightarrow \or % LEFT RIGHT ARROW
+ \updownarrow \or % UP DOWN ARROW
+ \nwarrow \or % NORTH WEST ARROW
+ \nearrow \or % NORTH EAST ARROW
+ \searrow \or % SOUTH EAST ARROW
+ \swarrow \or % SOUTH WEST ARROW
+ \nleftarrow \or % LEFTWARDS ARROW WITH STROKE
+ \nrightarrow \or % RIGHTWARDS ARROW WITH STROKE
+ \unknownchar \or % LEFTWARDS WAVE ARROW
+ \unknownchar \or % RIGHTWARDS WAVE ARROW
+ \twoheadedleftarrow \or % LEFTWARDS TWO HEADED ARROW
+ \unknownchar \or % UPWARDS TWO HEADED ARROW
+ \twoheadedrightarrow\or % RIGHTWARDS TWO HEADED ARROW
+ \unknownchar \or % DOWNWARDS TWO HEADED ARROW
+ \leftarrowtail \or % LEFTWARDS ARROW WITH TAIL
+ \rightarrowtail \or % RIGHTWARDS ARROW WITH TAIL
+ \mapsfrom \or % LEFTWARDS ARROW FROM BAR
+ \unknownchar \or % UPWARDS ARROW FROM BAR
+ \mapsto \or % RIGHTWARDS ARROW FROM BAR
+ \unknownchar \or % DOWNWARDS ARROW FROM BAR
+ \unknownchar \or % UP DOWN ARROW WITH BASE
+ \hookleftarrow \or % LEFTWARDS ARROW WITH HOOK
+ \hookrightarrow \or % RIGHTWARDS ARROW WITH HOOK
+ \loopleftarrow \or % LEFTWARDS ARROW WITH LOOP
+ \looprightarrow \or % RIGHTWARDS ARROW WITH LOOP
+ \unknownchar \or % LEFT RIGHT WAVE ARROW
+ \nleftrightarrow \or % LEFT RIGHT ARROW WITH STROKE
+ \lightning \or % DOWNWARDS ZIGZAG ARROW
+ \Lsh \or % UPWARDS ARROW WITH TIP LEFTWARDS
+ \Rsh \or % UPWARDS ARROW WITH TIP RIGHTWARDS
+ \unknownchar \or % DOWNWARDS ARROW WITH TIP LEFTWARDS
+ \unknownchar \or % DOWNWARDS ARROW WITH TIP RIGHTWARDS
+ \unknownchar \or % RIGHTWARDS ARROW WITH CORNER DOWNWARDS
+ \unknownchar \or % DOWNWARDS ARROW WITH CORNER LEFTWARDS
+ \curveleftarrow \or % ANTICLOCKWISE TOP SEMICIRCLE ARROW
+ \curverightarrow \or % CLOCKWISE TOP SEMICIRCLE ARROW
+ \unknownchar \or % NORTH WEST ARROW TO LONG BAR
+ \unknownchar \or % LEFTWARDS ARROW TO BAR OVER RIGHTWARDS ARROW TO BAR
+ \circlearrowleft \or % ANTICLOCKWISE OPEN CIRCLE ARROW
+ \circlearrowright \or % CLOCKWISE OPEN CIRCLE ARROW
+ \leftharpoonup \or % LEFTWARDS HARPOON WITH BARB UPWARDS
+ \leftharpoondown \or % LEFTWARDS HARPOON WITH BARB DOWNWARDS
+ \upharpoonright \or % UPWARDS HARPOON WITH BARB RIGHTWARDS
+ \upharpoonleft \or % UPWARDS HARPOON WITH BARB LEFTWARDS
+ \rightharpoonup \or % RIGHTWARDS HARPOON WITH BARB UPWARDS
+ \rightharpoondown \or % RIGHTWARDS HARPOON WITH BARB DOWNWARDS
+ \downharpoonright \or % DOWNWARDS HARPOON WITH BARB RIGHTWARDS
+ \downharpoonleft \or % DOWNWARDS HARPOON WITH BARB LEFTWARDS
+ \rightleftarrows \or % RIGHTWARDS ARROW OVER LEFTWARDS ARROW
+ \unknownchar \or % UPWARDS ARROW LEFTWARDS OF DOWNWARDS ARROW
+ \leftrightarrows \or % LEFTWARDS ARROW OVER RIGHTWARDS ARROW
+ \leftleftarrows \or % LEFTWARDS PAIRED ARROWS
+ \upuparrows \or % UPWARDS PAIRED ARROWS
+ \rightrightarrows \or % RIGHTWARDS PAIRED ARROWS
+ \downdownarrows \or % DOWNWARDS PAIRED ARROWS
+ \leftrightharpoons \or % LEFTWARDS HARPOON OVER RIGHTWARDS HARPOON
+ \rightleftharpoons \or % RIGHTWARDS HARPOON OVER LEFTWARDS HARPOON
+ \nLeftarrow \or % LEFTWARDS DOUBLE ARROW WITH STROKE
+ \nLeftrightarrow \or % LEFT RIGHT DOUBLE ARROW WITH STROKE
+ \nRightarrow \or % RIGHTWARDS DOUBLE ARROW WITH STROKE
+ \Leftarrow \or % LEFTWARDS DOUBLE ARROW
+ \Uparrow \or % UPWARDS DOUBLE ARROW
+ \Rightarrow \or % RIGHTWARDS DOUBLE ARROW
+ \Downarrow \or % DOWNWARDS DOUBLE ARROW
+ \Leftrightarrow \or % LEFT RIGHT DOUBLE ARROW
+ \Updownarrow \or % UP DOWN DOUBLE ARROW
+ \unknownchar \or % NORTH WEST DOUBLE ARROW
+ \unknownchar \or % NORTH EAST DOUBLE ARROW
+ \unknownchar \or % SOUTH EAST DOUBLE ARROW
+ \unknownchar \or % SOUTH WEST DOUBLE ARROW
+ \Lleftarrow \or % LEFTWARDS TRIPLE ARROW
+ \unknownchar \or % RIGHTWARDS TRIPLE ARROW
+ \leftsquidarrow \or % LEFTWARDS SQUIGGLE ARROW
+ \rightsquidarrow \or % RIGHTWARDS SQUIGGLE ARROW
+ \unknownchar \or % UPWARDS ARROW WITH DOUBLE STROKE
+ \unknownchar \or % DOWNWARDS ARROW WITH DOUBLE STROKE
+ \dashleftarrow \or % LEFTWARDS DASHED ARROW
+ \unknownchar \or % UPWARDS DASHED ARROW
+ \dashrightarrow \or % RIGHTWARDS DASHED ARROW
+ \unknownchar \or % DOWNWARDS DASHED ARROW
+ \unknownchar \or % LEFTWARDS ARROW TO BAR
+ \unknownchar \or % RIGHTWARDS ARROW TO BAR
+ \unknownchar \or % LEFTWARDS WHITE ARROW
+ \unknownchar \or % UPWARDS WHITE ARROW
+ \unknownchar \or % RIGHTWARDS WHITE ARROW
+ \unknownchar \or % DOWNWARDS WHITE ARROW
+ \unknownchar \or % UPWARDS WHITE ARROW FROM BAR
+ \unknownchar \or % UPWARDS WHITE ARROW ON PEDESTAL
+ \unknownchar \or % UPWARDS WHITE ARROW ON PEDESTAL WITH HORIZONTAL BAR
+ \unknownchar \or % UPWARDS WHITE ARROW ON PEDESTAL WITH VERTICAL BAR
+ \unknownchar \or % UPWARDS WHITE DOUBLE ARROW
+ \unknownchar \or % UPWARDS WHITE DOUBLE ARROW ON PEDESTAL
+ \unknownchar \or % RIGHTWARDS WHITE ARROW FROM WALL
+ \unknownchar \or % NORTH WEST ARROW TO CORNER
+ \unknownchar \or % SOUTH EAST ARROW TO CORNER
+ \unknownchar \or % UP DOWN WHITE ARROW
+ \unknownchar \or % RIGHT ARROW WITH SMALL CIRCLE
+ \unknownchar \or % DOWNWARDS ARROW LEFTWARDS OF UPWARDS ARROW
+ \unknownchar \or % THREE RIGHTWARDS ARROWS
+ \unknownchar \or % LEFTWARDS ARROW WITH VERTICAL STROKE
+ \unknownchar \or % RIGHTWARDS ARROW WITH VERTICAL STROKE
+ \unknownchar \or % LEFT RIGHT ARROW WITH VERTICAL STROKE
+ \unknownchar \or % LEFTWARDS ARROW WITH DOUBLE VERTICAL STROKE
+ \unknownchar \or % RIGHTWARDS ARROW WITH DOUBLE VERTICAL STROKE
+ \unknownchar \or % LEFT RIGHT ARROW WITH DOUBLE VERTICAL STROKE
+ \leftarrowtriangle \or % LEFTWARDS OPEN-HEADED ARROW
+ \rightarrowtriangle \else % RIGHTWARDS OPEN-HEADED ARROW
+ \leftrightarrowtriangle % LEFT RIGHT OPEN-HEADED ARROW
+ \fi
\stopunicodevector
-\protect \endinput
+\protect \endinput
diff --git a/tex/context/base/unic-034.tex b/tex/context/base/unic-034.tex
new file mode 100644
index 000000000..e43094943
--- /dev/null
+++ b/tex/context/base/unic-034.tex
@@ -0,0 +1,311 @@
+%D \module
+%D [ file=unic-034,
+%D version=2005.05.20,
+%D title=\CONTEXT\ \UNICODE\ Macros,
+%D subtitle=Vector 34,
+%D author=Nikolai Weibull,
+%D date=\currentdate,
+%D copyright={PRAGMA / Nikolai Weibull}]
+
+\unprotect
+
+% TODO NW: everything should be wrapped in \mathematics I suppose...
+% TODO HH: move definitions like this to a default vector
+
+\unexpanded\def\unic@nin {\not\in}
+\unexpanded\def\unic@nni {\not\ni}
+\unexpanded\def\unic@minus {-}
+\unexpanded\def\unic@divisionslash{/}
+\unexpanded\def\unic@cubesqrt {\sqrt^{3}}
+\unexpanded\def\unic@fourthsqrt {\sqrt^{4}}
+\unexpanded\def\unic@divides {\mathop{|}} % TODO
+\unexpanded\def\unic@ndivides {\mathrel{\mathop{\not|}}} % TODO: horrible
+\unexpanded\def\unic@dblint {\int\!\!\int}
+\unexpanded\def\unic@triint {\int\!\!\int\!\!\int}
+\unexpanded\def\unic@ratio {\mathrel{:}}
+\unexpanded\def\unic@proportion {\mathrel{::}}
+\unexpanded\def\unic@nsimeq {\not\simeq}
+\unexpanded\def\unic@napproxeq {\not\approxeq}
+\unexpanded\def\unic@napprox {\not\approx}
+\unexpanded\def\unic@correspondsto{\buildrel \frown \over =}
+\unexpanded\def\unic@estimates {\buildrel \wedge \over =}
+\unexpanded\def\unic@equiangularto{\buildrel \vee \over =}
+\unexpanded\def\unic@stareq {\buildrel \star \over =}
+\unexpanded\def\unic@eqbydef {\buildrel \rm def \over =}
+\unexpanded\def\unic@measuredby {\buildrel \rm m \over =}
+\unexpanded\def\unic@questionedeq {\buildrel \rm ? \over =}
+\unexpanded\def\unic@nequiv {\not\equiv}
+\unexpanded\def\unic@nasymp {\not\asymp}
+\unexpanded\def\unic@nlesssim {\not\lesssim}
+\unexpanded\def\unic@ngtrsim {\not\gtrsim}
+\unexpanded\def\unic@nlessgtr {\not\lessgtr}
+\unexpanded\def\unic@ngtrless {\not\gtrless}
+\unexpanded\def\unic@nsubset {\not\subset}
+\unexpanded\def\unic@nsupset {\not\supset}
+\unexpanded\def\unic@nsqsubseteq {\not\sqsubseteq}
+\unexpanded\def\unic@nsqsupseteq {\not\sqsupseteq}
+
+\startunicodevector 34
+ \expandafter\strippedcsname
+ \ifcase\numexpr(#1+1) % space needed, terminates expr
+ \unknownchar \or % hack for getting forall working
+ \forall \or % FOR ALL
+ \complement \or % COMPLEMENT
+ \partial \or % PARTIAL DIFFERENTIAL
+ \exists \or % THERE EXISTS
+ \nexists \or % THERE DOES NOT EXIST
+ \emptyset \or % EMPTY SET
+ \vartriangle \or % INCREMENT
+ \nabla \or % NABLA
+ \in \or % ELEMENT OF
+ \unic@nin \or % NOT AN ELEMENT OF
+ \unknownchar \or % SMALL ELEMENT OF
+ \ni \or % CONTAINS AS MEMBER
+ \unic@nni \or % DOES NOT CONTAIN AS MEMBER
+ \unknownchar \or % SMALL CONTAINS AS MEMBER
+ \QED \or % END OF PROOF
+ \prod \or % N-ARY PRODUCT
+ \coprod \or % N-ARY COPRODUCT
+ \sum \or % N-ARY SUMMATION
+ \unic@minus \or % MINUS SIGN
+ \mp \or % MINUS-OR-PLUS SIGN
+ \dotplus \or % DOT PLUS
+ \unic@divisionslash \or % DIVISION SLASH
+ \setminus \or % SET MINUS
+ \ast \or % ASTERISK OPERATOR
+ \circ \or % RING OPERATOR
+ \bullet \or % BULLET OPERATOR
+ \sqrt \or % SQUARE ROOT
+ \unic@cubesqrt \or % CUBE ROOT
+ \unic@fourthsqrt \or % FOURTH ROOT
+ \propto \or % PROPORTIONAL TO
+ \infty \or % INFINITY
+ \unknownchar \or % RIGHT ANGLE
+ \angle \or % ANGLE
+ \measuredangle \or % MEASURED ANGLE
+ \sphericalangle \or % SPHERICAL ANGLE
+ \unic@divides \or % DIVIDES
+ \unic@ndivides \or % DOES NOT DIVIDE
+ \parallel \or % PARALLEL TO
+ \nparallel \or % NOT PARALLEL TO
+ \land \or % LOGICAL AND
+ \lor \or % LOGICAL OR
+ \cap \or % INTERSECTION
+ \cup \or % UNION
+ \int \or % INTEGRAL
+ \unic@dblint \or % DOUBLE INTEGRAL
+ \unic@triint \or % TRIPLE INTEGRAL
+ \oint \or % CONTOUR INTEGRAL
+ \unknownchar \or % SURFACE INTEGRAL
+ \unknownchar \or % VOLUME INTEGRAL
+ \unknownchar \or % CLOCKWISE INTEGRAL
+ \unknownchar \or % CLOCKWISE CONTOUR INTEGRAL
+ \unknownchar \or % ANTICLOCKWISE CONTOUR INTEGRAL
+ \therefore \or % THEREFORE
+ \because \or % BECAUSE
+ \unic@ratio \or % RATIO
+ \unic@proportion \or % PROPORTION
+ \unknownchar \or % DOT MINUS
+ \mathop{-\!\!:} \or % EXCESS
+ \mathop{:\!\!\!-\!\!\!:} \or % GEOMETRIC PROPORTION
+ \mathop{\sim\!\!\!:}\or % HOMOTHETIC
+ \sim \or % TILDE OPERATOR
+ \backsim \or % REVERSED TILDE
+ \unknownchar \or % INVERTED LAZY S
+ \unknownchar \or % SINE WAVE
+ \wr \or % WREATH PRODUCT
+ \nsim \or % NOT TILDE
+ \eqsim \or % MINUS TILDE
+ \simeq \or % ASYMPTOTICALLY EQUAL TO
+ \nsimeq \or % NOT ASYMPTOTICALLY EQUAL TO
+ \approxeq \or % APPROXIMATELY EQUAL TO
+ \cong \or % APPROXIMATELY BUT NOT ACTUALLY EQUAL TO
+ \unic@napproxeq \or % NEITHER APPROXIMATELY NOR ACTUALLY EQUAL TO
+ \approx \or % ALMOST EQUAL TO
+ \unic@napprox \or % NOT ALMOST EQUAL TO
+ \approxeq \or % ALMOST EQUAL OR EQUAL TO
+ \unknownchar \or % TRIPLE TILDE
+ \unknownchar \or % ALL EQUAL TO
+ \asymp \or % EQUIVALENT TO
+ \Bumpeq \or % GEOMETRICALLY EQUIVALENT TO
+ \bumpeq \or % DIFFERENCE BETWEEN
+ \doteq \or % APPROACHES THE LIMIT
+ \doteqdot \or % GEOMETRICALLY EQUAL TO
+ \fallingdotseq \or % APPROXIMATELY EQUAL TO OR THE IMAGE OF
+ \risingdotseq \or % IMAGE OF OR APPROXIMATELY EQUAL TO
+ \unknownchar \or % COLON EQUALS
+ \unknownchar \or % EQUALS COLON
+ \eqcirc \or % RING IN EQUAL TO
+ \circeq \or % RING EQUAL TO
+ \unic@correspondsto \or % CORRESPONDS TO
+ \unic@estimates \or % ESTIMATES
+ \unic@equiangularto \or % EQUIANGULAR TO
+ \unic@stareq \or % STAR EQUALS
+ \unic@triangleq \or % DELTA EQUAL TO
+ \unic@eqbydef \or % EQUAL TO BY DEFINITION
+ \unic@measuredby \or % MEASURED BY
+ \unic@questionedeq \or % QUESTIONED EQUAL TO
+ \neq \or % NOT EQUAL TO
+ \equiv \or % IDENTICAL TO
+ \unic@nequiv \or % NOT IDENTICAL TO
+ \unknownchar \or % STRICTLY EQUIVALENT TO
+ \leq \or % LESS-THAN OR EQUAL TO
+ \geq \or % GREATER-THAN OR EQUAL TO
+ \leqq \or % LESS-THAN OVER EQUAL TO
+ \geqq \or % GREATER-THAN OVER EQUAL TO
+ \lneqq \or % LESS-THAN BUT NOT EQUAL TO
+ \gneqq \or % GREATER-THAN BUT NOT EQUAL TO
+ \ll \or % MUCH LESS-THAN
+ \gg \or % MUCH GREATER-THAN
+ \between \or % BETWEEN
+ \nasymp \or % NOT EQUIVALENT TO
+ \nless \or % NOT LESS-THAN
+ \ngtr \or % NOT GREATER-THAN
+ \nleq \or % NEITHER LESS-THAN NOR EQUAL TO
+ \ngeq \or % NEITHER GREATER-THAN NOR EQUAL TO
+ \lesssim \or % LESS-THAN OR EQUIVALENT TO
+ \gtrsim \or % GREATER-THAN OR EQUIVALENT TO
+ \unic@nlesssim \or % NEITHER LESS-THAN NOR EQUIVALENT TO
+ \unic@ngtrsim \or % NEITHER GREATER-THAN NOR EQUIVALENT TO
+ \lessgtr \or % LESS-THAN OR GREATER-THAN
+ \gtrless \or % GREATER-THAN OR LESS-THAN
+ \unic@nlessgtr \or % NEITHER LESS-THAN NOR GREATER-THAN
+ \unic@ngtrless \or % NEITHER GREATER-THAN NOR LESS-THAN
+ \prec \or % PRECEDES
+ \succ \or % SUCCEEDS
+ \preceq \or % PRECEDES OR EQUAL TO
+ \succeq \or % SUCCEEDS OR EQUAL TO
+ \precsim \or % PRECEDES OR EQUIVALENT TO
+ \succsim \or % SUCCEEDS OR EQUIVALENT TO
+ \nprec \or % DOES NOT PRECEDE
+ \nsucc \or % DOES NOT SUCCEED
+ \subset \or % SUBSET OF
+ \supset \or % SUPERSET OF
+ \unic@nsubset \or % NOT A SUBSET OF
+ \unic@nsupset \or % NOT A SUPERSET OF
+ \subseteq \or % SUBSET OF OR EQUAL TO
+ \supseteq \or % SUPERSET OF OR EQUAL TO
+ \nsubseteq \or % NEITHER A SUBSET OF NOR EQUAL TO
+ \nsupseteq \or % NEITHER A SUPERSET OF NOR EQUAL TO
+ \subsetneq \or % SUBSET OF WITH NOT EQUAL TO
+ \supsetneq \or % SUPERSET OF WITH NOT EQUAL TO
+ \unknownchar \or % MULTISET
+ \unknownchar \or % MULTISET MULTIPLICATION
+ \biguplus \or % MULTISET UNION
+ \sqsubset \or % SQUARE IMAGE OF
+ \sqsupset \or % SQUARE ORIGINAL OF
+ \sqsubseteq \or % SQUARE IMAGE OF OR EQUAL TO
+ \sqsupseteq \or % SQUARE ORIGINAL OF OR EQUAL TO
+ \sqcap \or % SQUARE CAP
+ \sqcup \or % SQUARE CUP
+ \oplus \or % CIRCLED PLUS
+ \ominus \or % CIRCLED MINUS
+ \otimes \or % CIRCLED TIMES
+ \oslash \or % CIRCLED DIVISION SLASH
+ \odot \or % CIRCLED DOT OPERATOR
+ \circledcirc \or % CIRCLED RING OPERATOR
+ \circledast \or % CIRCLED ASTERISK OPERATOR
+ \unknownchar \or % CIRCLED EQUALS
+ \circleddash \or % CIRCLED DASH
+ \boxplus \or % SQUARED PLUS
+ \boxminus \or % SQUARED MINUS
+ \boxtimes \or % SQUARED TIMES
+ \boxdot \or % SQUARED DOT OPERATOR
+ \vdash \or % RIGHT TACK
+ \dashv \or % LEFT TACK
+ \top \or % DOWN TACK
+ \bot \or % UP TACK
+ \unknownchar \or % ASSERTION
+ \models \or % MODELS
+ \vDash \or % TRUE
+ \unknownchar \or % FORCES
+ \Vvdash \or % TRIPLE VERTICAL BAR RIGHT TURNSTILE
+ \unknownchar \or % DOUBLE VERTICAL BAR DOUBLE RIGHT TURNSTILE
+ \nvdash \or % DOES NOT PROVE
+ \nvDash \or % NOT TRUE
+ \unknownchar \or % DOES NOT FORCE
+ \unknownchar \or % NEGATED DOUBLE VERTICAL BAR DOUBLE RIGHT TURNSTILE
+ \unknownchar \or % PRECEDES UNDER RELATION
+ \unknownchar \or % SUCCEEDS UNDER RELATION
+ \lhd \or % NORMAL SUBGROUP OF
+ \rhd \or % CONTAINS AS NORMAL SUBGROUP
+ \unlhd \or % NORMAL SUBGROUP OF OR EQUAL TO
+ \unrhd \or % CONTAINS AS NORMAL SUBGROUP OR EQUAL TO
+ \unknownchar \or % ORIGINAL OF
+ \unknownchar \or % IMAGE OF
+ \unknownchar \or % MULTIMAP
+ \unknownchar \or % HERMITIAN CONJUGATE MATRIX
+ \unknownchar \or % INTERCALATE
+ \veebar \or % XOR
+ \barwedge \or % NAND
+ \unknownchar \or % NOR
+ \unknownchar \or % RIGHT ANGLE WITH ARC
+ \unknownchar \or % RIGHT TRIANGLE
+ \bigwedge \or % N-ARY LOGICAL AND
+ \bigvee \or % N-ARY LOGICAL OR
+ \bigcap \or % N-ARY INTERSECTION
+ \bigcup \or % N-ARY UNION
+ \diamond \or % DIAMOND OPERATOR
+ \cdot \or % DOT OPERATOR
+ \star \or % STAR OPERATOR
+ \divideontimes \or % DIVISION TIMES
+ \bowtie \or % BOWTIE
+ \ltimes \or % LEFT NORMAL FACTOR SEMIDIRECT PRODUCT
+ \rtimes \or % RIGHT NORMAL FACTOR SEMIDIRECT PRODUCT
+ \leftthreetimes \or % LEFT SEMIDIRECT PRODUCT
+ \rightthreetimes \or % RIGHT SEMIDIRECT PRODUCT
+ \backsimeq \or % REVERSED TILDE EQUALS
+ \unknownchar \or % CURLY LOGICAL OR
+ \unknownchar \or % CURLY LOGICAL AND
+ \Subset \or % DOUBLE SUBSET
+ \Supset \or % DOUBLE SUPERSET
+ \Cap \or % DOUBLE INTERSECTION
+ \Cup \or % DOUBLE UNION
+ \pitchfork \or % PITCHFORK
+ \unknownchar \or % EQUAL AND PARALLEL TO
+ \unknownchar \or % LESS-THAN WITH DOT
+ \unknownchar \or % GREATER-THAN WITH DOT
+ \lll \or % VERY MUCH LESS-THAN
+ \ggg \or % VERY MUCH GREATER-THAN
+ \lesseqgtr \or % LESS-THAN EQUAL TO OR GREATER-THAN
+ \gtreqless \or % GREATER-THAN EQUAL TO OR LESS-THAN
+ \unknownchar \or % EQUAL TO OR LESS-THAN
+ \unknownchar \or % EQUAL TO OR GREATER-THAN
+ \curlyeqprec \or % EQUAL TO OR PRECEDES
+ \curlyeqsucc \or % EQUAL TO OR SUCCEEDS
+ \npreceq \or % DOES NOT PRECEDE OR EQUAL
+ \nsucceq \or % DOES NOT SUCCEED OR EQUAL
+ \unic@nsqsubseteq \or % NOT SQUARE IMAGE OF OR EQUAL TO
+ \unic@nsqsupseteq \or % NOT SQUARE ORIGINAL OF OR EQUAL TO
+ \unknownchar \or % SQUARE IMAGE OF OR NOT EQUAL TO
+ \unknownchar \or % SQUARE ORIGINAL OF OR NOT EQUAL TO
+ \lnsim \or % LESS-THAN BUT NOT EQUIVALENT TO
+ \gnsim \or % GREATER-THAN BUT NOT EQUIVALENT TO
+ \precnsim \or % PRECEDES BUT NOT EQUIVALENT TO
+ \succnsim \or % SUCCEEDS BUT NOT EQUIVALENT TO
+ \ntriangleleft \or % NOT NORMAL SUBGROUP OF
+ \ntriangleright \or % DOES NOT CONTAIN AS NORMAL SUBGROUP
+ \ntrianglelefteq \or % NOT NORMAL SUBGROUP OF OR EQUAL TO
+ \ntrianglerighteq \or % DOES NOT CONTAIN AS NORMAL SUBGROUP OR EQUAL
+ \vdots \or % VERTICAL ELLIPSIS
+ \cdots \or % MIDLINE HORIZONTAL ELLIPSIS
+ \unknownchar \or % UP RIGHT DIAGONAL ELLIPSIS
+ \ddots \or % DOWN RIGHT DIAGONAL ELLIPSIS
+ \unknownchar \or % ELEMENT OF WITH LONG HORIZONTAL STROKE
+ \unknownchar \or % ELEMENT OF WITH VERTICAL BAR AT END OF HORIZONTAL STROKE
+ \unknownchar \or % SMALL ELEMENT OF WITH VERTICAL BAR AT END OF HORIZONTAL STROKE
+ \unknownchar \or % ELEMENT OF WITH DOT ABOVE
+ \unknownchar \or % ELEMENT OF WITH OVERBAR
+ \unknownchar \or % SMALL ELEMENT OF WITH OVERBAR
+ \unknownchar \or % ELEMENT OF WITH UNDERBAR
+ \unknownchar \or % ELEMENT OF WITH TWO HORIZONTAL STROKES
+ \unknownchar \or % CONTAINS WITH LONG HORIZONTAL STROKE
+ \unknownchar \or % CONTAINS WITH VERTICAL BAR AT END OF HORIZONTAL STROKE
+ \unknownchar \or % SMALL CONTAINS WITH VERTICAL BAR AT END OF HORIZONTAL STROKE
+ \unknownchar \or % CONTAINS WITH OVERBAR
+ \unknownchar \else % SMALL CONTAINS WITH OVERBAR
+ \unknownchar % Z NOTATION BAG MEMBERSHIP
+ \fi
+\stopunicodevector
+
+\protect \endinput
diff --git a/tex/context/base/verb-ini.tex b/tex/context/base/verb-ini.tex
index aa04c4c21..022cb84d7 100644
--- a/tex/context/base/verb-ini.tex
+++ b/tex/context/base/verb-ini.tex
@@ -123,7 +123,9 @@
%D spaces (control spaces) we only have to adapt the definition
%D of \type{\obeyedspace} to:
-\def\controlspace {\hbox{\char32}}
+\def\controlspace{\hbox{\char32}}
+\let\normalspacetoken=\
+\def\normalspaces{\catcode`\ =\@@space}
\bgroup
\catcode`\ =\@@active
diff --git a/tex/context/base/xtag-ini.tex b/tex/context/base/xtag-ini.tex
index 49104030a..a3a83a918 100644
--- a/tex/context/base/xtag-ini.tex
+++ b/tex/context/base/xtag-ini.tex
@@ -307,17 +307,30 @@
.catcode`.|=.@@active
E
-.gdef.entitleXMLescapetokens
- B.activateXMLescapetokens
- .def#B&tex-hash;E*
- .def$B&tex-dollar;E*
- .def%B&tex-percent;E*
- .def\B&tex-backslash;E*
- .def^B&tex-hat;E*
- .def_B&tex-underscore;E*
- .def{B&tex-leftbrace;E*
- .def}B&tex-rightbrace;E*
- .def|B&tex-bar;E*
+* .gdef.entitleXMLescapetokens
+* B.activateXMLescapetokens
+* .def#B&tex-hash;E*
+* .def$B&tex-dollar;E*
+* .def%B&tex-percent;E*
+* .def\B&tex-backslash;E*
+* .def^B&tex-hat;E*
+* .def_B&tex-underscore;E*
+* .def{B&tex-leftbrace;E*
+* .def}B&tex-rightbrace;E*
+* .def|B&tex-bar;E*
+* E
+
+.xdef.entitleXMLescapetokens
+ B.noexpand.activateXMLescapetokens
+ .noexpand.def.noexpand#B.noexpand&.string#035;E*
+ .noexpand.def.noexpand$B.noexpand&.string#036;E*
+ .noexpand.def.noexpand%B.noexpand&.string#037;E*
+ .noexpand.def.noexpand\B.noexpand&.string#092;E*
+ .noexpand.def.noexpand^B.noexpand&.string#094;E*
+ .noexpand.def.noexpand_B.noexpand&.string#095;E*
+ .noexpand.def.noexpand{B.noexpand&.string#123;E*
+ .noexpand.def.noexpand}B.noexpand&.string#125;E*
+ .noexpand.def.noexpand|B.noexpand&.string#124;E*
E
.gdef.reduceXMLescapetokens
@@ -883,7 +896,7 @@
% \fi}
\def\XMLpureancestor#1%
- {\ifnum\numexpr\XMLdepth-#1\relax>\zerocount
+ {\ifcase\numexpr\XMLdepth-#1\relax\or
\csname\@@XMLdepth:\the\numexpr\XMLdepth-#1\relax\endcsname
\fi}
diff --git a/tex/context/base/xtag-map.tex b/tex/context/base/xtag-map.tex
index 077bca13e..76d2cfd21 100644
--- a/tex/context/base/xtag-map.tex
+++ b/tex/context/base/xtag-map.tex
@@ -376,8 +376,13 @@
\def\doremapXMLentity
{\xmlrent}
+% \unexpanded\def\xmlrent#1%
+% {\getXMLentity{#1}}
+%
+% replaced by:
+
\unexpanded\def\xmlrent#1%
- {\getXMLentity{#1}}
+ {\doXMLentity#1;}
%D The remapping is taken care of by the following macro,
%D which takes three arguments.
diff --git a/tex/context/interface/keys-cz.xml b/tex/context/interface/keys-cz.xml
index 6284f36ff..6a72dbabf 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.07">
+<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="cz" version="2005.06.21">
<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 ca03949b4..26a76a7c0 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.07">
+<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="de" version="2005.06.21">
<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 7a65adf12..3daec8981 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.07">
+<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="en" version="2005.06.21">
<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 9fd7a06be..f272ee751 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.07">
+<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="it" version="2005.06.21">
<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 c6ea1b19c..9a6b21cfe 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.07">
+<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="nl" version="2005.06.21">
<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 bd0c5e0dc..517160b28 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.07">
+<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="ro" version="2005.06.21">
<cd:variables>
<cd:variable name="one" value="unu"/>