summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2012-05-30 11:26:00 +0200
committerHans Hagen <pragma@wxs.nl>2012-05-30 11:26:00 +0200
commitc3efc6042c5a5a4d0f1a80bc3a097f0ae2963f7c (patch)
tree6bb75e016db19cd96e3bfd971e2b44abcede2474
parent48e2f23903816dbe8843329bfcd3e6658f22b139 (diff)
downloadcontext-c3efc6042c5a5a4d0f1a80bc3a097f0ae2963f7c.tar.gz
beta 2012.05.30 11:26
-rw-r--r--scripts/context/lua/mtxrun.lua22
-rw-r--r--scripts/context/stubs/mswin/mtxrun.lua22
-rwxr-xr-xscripts/context/stubs/unix/mtxrun22
-rw-r--r--tex/context/base/buff-imp-mp.lua8
-rw-r--r--tex/context/base/buff-imp-xml.lua4
-rw-r--r--tex/context/base/cont-new.mkii2
-rw-r--r--tex/context/base/cont-new.mkiv2
-rw-r--r--tex/context/base/context-version.pdfbin4131 -> 4128 bytes
-rw-r--r--tex/context/base/context-version.pngbin106219 -> 105721 bytes
-rw-r--r--tex/context/base/context.mkii2
-rw-r--r--tex/context/base/context.mkiv2
-rw-r--r--tex/context/base/grph-trf.mkiv23
-rw-r--r--tex/context/base/l-unicode.lua22
-rw-r--r--tex/context/base/status-files.pdfbin24421 -> 24413 bytes
-rw-r--r--tex/context/base/status-lua.pdfbin180131 -> 180149 bytes
-rw-r--r--tex/generic/context/luatex/luatex-fonts-merged.lua2
16 files changed, 108 insertions, 25 deletions
diff --git a/scripts/context/lua/mtxrun.lua b/scripts/context/lua/mtxrun.lua
index 644c1d9b2..108f2a8a1 100644
--- a/scripts/context/lua/mtxrun.lua
+++ b/scripts/context/lua/mtxrun.lua
@@ -4087,8 +4087,10 @@ local one = P(1)
local two = C(1) * C(1)
local four = C(R(utfchar(0xD8),utfchar(0xFF))) * C(1) * C(1) * C(1)
+-- actually one of them is already utf ... sort of useless this one
+
local pattern = P("\254\255") * Cs( (
- four / function(a,b,c,d)
+ four / function(a,b,c,d)
local ab = 0xFF * byte(a) + byte(b)
local cd = 0xFF * byte(c) + byte(d)
return utfchar((ab-0xD800)*0x400 + (cd-0xDC00) + 0x10000)
@@ -4099,7 +4101,7 @@ local pattern = P("\254\255") * Cs( (
+ one
)^1 )
+ P("\255\254") * Cs( (
- four / function(b,a,d,c)
+ four / function(b,a,d,c)
local ab = 0xFF * byte(a) + byte(b)
local cd = 0xFF * byte(c) + byte(d)
return utfchar((ab-0xD800)*0x400 + (cd-0xDC00) + 0x10000)
@@ -4114,6 +4116,22 @@ function string.toutf(s)
return lpegmatch(pattern,s) or s -- todo: utf32
end
+local validatedutf = Cs (
+ (
+ patterns.utf8one
+ + patterns.utf8two
+ + patterns.utf8three
+ + patterns.utf8four
+ + P(1) / "�"
+ )^0
+)
+
+patterns.validatedutf = validatedutf
+
+function string.validutf(str)
+ return lpegmatch(validatedutf,str)
+end
+
end -- of closure
diff --git a/scripts/context/stubs/mswin/mtxrun.lua b/scripts/context/stubs/mswin/mtxrun.lua
index 644c1d9b2..108f2a8a1 100644
--- a/scripts/context/stubs/mswin/mtxrun.lua
+++ b/scripts/context/stubs/mswin/mtxrun.lua
@@ -4087,8 +4087,10 @@ local one = P(1)
local two = C(1) * C(1)
local four = C(R(utfchar(0xD8),utfchar(0xFF))) * C(1) * C(1) * C(1)
+-- actually one of them is already utf ... sort of useless this one
+
local pattern = P("\254\255") * Cs( (
- four / function(a,b,c,d)
+ four / function(a,b,c,d)
local ab = 0xFF * byte(a) + byte(b)
local cd = 0xFF * byte(c) + byte(d)
return utfchar((ab-0xD800)*0x400 + (cd-0xDC00) + 0x10000)
@@ -4099,7 +4101,7 @@ local pattern = P("\254\255") * Cs( (
+ one
)^1 )
+ P("\255\254") * Cs( (
- four / function(b,a,d,c)
+ four / function(b,a,d,c)
local ab = 0xFF * byte(a) + byte(b)
local cd = 0xFF * byte(c) + byte(d)
return utfchar((ab-0xD800)*0x400 + (cd-0xDC00) + 0x10000)
@@ -4114,6 +4116,22 @@ function string.toutf(s)
return lpegmatch(pattern,s) or s -- todo: utf32
end
+local validatedutf = Cs (
+ (
+ patterns.utf8one
+ + patterns.utf8two
+ + patterns.utf8three
+ + patterns.utf8four
+ + P(1) / "�"
+ )^0
+)
+
+patterns.validatedutf = validatedutf
+
+function string.validutf(str)
+ return lpegmatch(validatedutf,str)
+end
+
end -- of closure
diff --git a/scripts/context/stubs/unix/mtxrun b/scripts/context/stubs/unix/mtxrun
index 644c1d9b2..108f2a8a1 100755
--- a/scripts/context/stubs/unix/mtxrun
+++ b/scripts/context/stubs/unix/mtxrun
@@ -4087,8 +4087,10 @@ local one = P(1)
local two = C(1) * C(1)
local four = C(R(utfchar(0xD8),utfchar(0xFF))) * C(1) * C(1) * C(1)
+-- actually one of them is already utf ... sort of useless this one
+
local pattern = P("\254\255") * Cs( (
- four / function(a,b,c,d)
+ four / function(a,b,c,d)
local ab = 0xFF * byte(a) + byte(b)
local cd = 0xFF * byte(c) + byte(d)
return utfchar((ab-0xD800)*0x400 + (cd-0xDC00) + 0x10000)
@@ -4099,7 +4101,7 @@ local pattern = P("\254\255") * Cs( (
+ one
)^1 )
+ P("\255\254") * Cs( (
- four / function(b,a,d,c)
+ four / function(b,a,d,c)
local ab = 0xFF * byte(a) + byte(b)
local cd = 0xFF * byte(c) + byte(d)
return utfchar((ab-0xD800)*0x400 + (cd-0xDC00) + 0x10000)
@@ -4114,6 +4116,22 @@ function string.toutf(s)
return lpegmatch(pattern,s) or s -- todo: utf32
end
+local validatedutf = Cs (
+ (
+ patterns.utf8one
+ + patterns.utf8two
+ + patterns.utf8three
+ + patterns.utf8four
+ + P(1) / "�"
+ )^0
+)
+
+patterns.validatedutf = validatedutf
+
+function string.validutf(str)
+ return lpegmatch(validatedutf,str)
+end
+
end -- of closure
diff --git a/tex/context/base/buff-imp-mp.lua b/tex/context/base/buff-imp-mp.lua
index f219df797..34e3459c6 100644
--- a/tex/context/base/buff-imp-mp.lua
+++ b/tex/context/base/buff-imp-mp.lua
@@ -13,6 +13,14 @@ if not modules then modules = { } end modules ['buff-imp-mp'] = {
-- the rendering and have a different way of nesting. It is no coincidence
-- that the coloring looks similar: both are derived from earlier lexing (in
-- texedit, mkii and the c++ scite lexer).
+--
+-- In the meantime we have lpeg based lexers in scite! And, as all this
+-- lexing boils down to the same principles (associating symbolic rendering
+-- with ranges of characters) and as the scite lexers do nesting, it makes
+-- sense at some point to share code. However, keep in mind that the pretty
+-- printers are also supposed to support invalid code (for educational
+-- purposes). The scite lexers are more recent and there a different color
+-- scheme is used. So, we might move away from the traditional coloring.
local P, S, V, patterns = lpeg.P, lpeg.S, lpeg.V, lpeg.patterns
diff --git a/tex/context/base/buff-imp-xml.lua b/tex/context/base/buff-imp-xml.lua
index baf290d4c..0c48ed3b0 100644
--- a/tex/context/base/buff-imp-xml.lua
+++ b/tex/context/base/buff-imp-xml.lua
@@ -99,11 +99,11 @@ local grammar = visualizers.newgrammar("default", { "visualizer",
* makepattern(handler,"boundary",closeend),
comment =
makepattern(handler,"boundary",opencomment)
- * (V("whitespace") + makepattern(handler,"comment",(1-closecomment)))^0 -- slow
+ * (V("whitespace") + makepattern(handler,"comment",(1-closecomment)^1))^0 -- slow
* makepattern(handler,"boundary",closecomment),
cdata =
makepattern(handler,"boundary",opencdata)
- * (V("whitespace") + makepattern(handler,"comment",(1-closecdata)))^0 -- slow
+ * (V("whitespace") + makepattern(handler,"comment",(1-closecdata)^1))^0 -- slow
* makepattern(handler,"boundary",closecdata),
instruction =
makepattern(handler,"boundary",openinstruction)
diff --git a/tex/context/base/cont-new.mkii b/tex/context/base/cont-new.mkii
index 39bef537a..b4958762f 100644
--- a/tex/context/base/cont-new.mkii
+++ b/tex/context/base/cont-new.mkii
@@ -11,7 +11,7 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-\newcontextversion{2012.05.29 18:43}
+\newcontextversion{2012.05.30 11:26}
%D This file is loaded at runtime, thereby providing an
%D excellent place for hacks, patches, extensions and new
diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv
index 929174025..5a28f8e29 100644
--- a/tex/context/base/cont-new.mkiv
+++ b/tex/context/base/cont-new.mkiv
@@ -11,7 +11,7 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-\newcontextversion{2012.05.29 18:43}
+\newcontextversion{2012.05.30 11:26}
%D This file is loaded at runtime, thereby providing an
%D excellent place for hacks, patches, extensions and new
diff --git a/tex/context/base/context-version.pdf b/tex/context/base/context-version.pdf
index aa5f54b0a..7b8733c88 100644
--- a/tex/context/base/context-version.pdf
+++ b/tex/context/base/context-version.pdf
Binary files differ
diff --git a/tex/context/base/context-version.png b/tex/context/base/context-version.png
index c236521cb..bb280817c 100644
--- a/tex/context/base/context-version.png
+++ b/tex/context/base/context-version.png
Binary files differ
diff --git a/tex/context/base/context.mkii b/tex/context/base/context.mkii
index 2cf8fd924..8cd02fd9e 100644
--- a/tex/context/base/context.mkii
+++ b/tex/context/base/context.mkii
@@ -20,7 +20,7 @@
%D your styles an modules.
\edef\contextformat {\jobname}
-\edef\contextversion{2012.05.29 18:43}
+\edef\contextversion{2012.05.30 11:26}
%D For those who want to use this:
diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv
index 426422c60..5044edae1 100644
--- a/tex/context/base/context.mkiv
+++ b/tex/context/base/context.mkiv
@@ -23,7 +23,7 @@
%D up and the dependencies are more consistent.
\edef\contextformat {\jobname}
-\edef\contextversion{2012.05.29 18:43}
+\edef\contextversion{2012.05.30 11:26}
%D For those who want to use this:
diff --git a/tex/context/base/grph-trf.mkiv b/tex/context/base/grph-trf.mkiv
index a33e5606d..5984c8a06 100644
--- a/tex/context/base/grph-trf.mkiv
+++ b/tex/context/base/grph-trf.mkiv
@@ -38,6 +38,7 @@
\newconditional\c_grph_scale_done
\newconditional\c_grph_scale_scaling_done
+\newconditional\c_grph_scale_limit_factors \settrue\c_grph_scale_limit_factors
\newdimen\d_grph_scale_wd
\newdimen\d_grph_scale_ht
@@ -232,14 +233,14 @@
% final values
\global\d_grph_scale_used_x_size \zeropoint % see note * (core-fig)
\global\d_grph_scale_used_y_size \zeropoint % see note * (core-fig)
- \c_grph_scale_used_x_scale \plusone % see note * (core-fig)
- \c_grph_scale_used_y_scale \plusone % see note * (core-fig)
+ \c_grph_scale_used_x_scale \plusone % see note * (core-fig)
+ \c_grph_scale_used_y_scale \plusone % see note * (core-fig)
% preparations
\setfalse\c_grph_scale_scaling_done
\grph_scale_check_parameters
% calculators
% beware, they operate in sequence, and calculate missing dimensions / messy
- %setscaleboxbynature % when? needed?
+ %grph_scale_by_nature % when? needed?
\ifconditional\c_grph_scale_scaling_done\else\grph_scale_by_factor \fi
\ifconditional\c_grph_scale_scaling_done\else\grph_scale_by_scale \fi
\ifconditional\c_grph_scale_scaling_done\else\grph_scale_by_dimension\fi
@@ -321,13 +322,15 @@
\def\grph_scale_by_factor_indeed
{\settrue\c_grph_scale_scaling_done
- \ifdim\d_grph_scale_used_x_size>\d_grph_scale_h_size
- \global\d_grph_scale_used_y_size\zeropoint
- \global\d_grph_scale_used_x_size\d_grph_scale_h_size
- \else\ifdim\d_grph_scale_used_y_size>\d_grph_scale_v_size
- \global\d_grph_scale_used_x_size\zeropoint
- \global\d_grph_scale_used_y_size\d_grph_scale_v_size
- \fi\fi
+ \ifconditional\c_grph_scale_limit_factors
+ \ifdim\d_grph_scale_used_x_size>\d_grph_scale_h_size
+ \global\d_grph_scale_used_y_size\zeropoint
+ \global\d_grph_scale_used_x_size\d_grph_scale_h_size
+ \else\ifdim\d_grph_scale_used_y_size>\d_grph_scale_v_size
+ \global\d_grph_scale_used_x_size\zeropoint
+ \global\d_grph_scale_used_y_size\d_grph_scale_v_size
+ \fi\fi
+ \fi
\grph_scale_by_dimension}
\def\grph_scale_by_scale
diff --git a/tex/context/base/l-unicode.lua b/tex/context/base/l-unicode.lua
index 246171aec..f4480e93c 100644
--- a/tex/context/base/l-unicode.lua
+++ b/tex/context/base/l-unicode.lua
@@ -437,8 +437,10 @@ local one = P(1)
local two = C(1) * C(1)
local four = C(R(utfchar(0xD8),utfchar(0xFF))) * C(1) * C(1) * C(1)
+-- actually one of them is already utf ... sort of useless this one
+
local pattern = P("\254\255") * Cs( (
- four / function(a,b,c,d)
+ four / function(a,b,c,d)
local ab = 0xFF * byte(a) + byte(b)
local cd = 0xFF * byte(c) + byte(d)
return utfchar((ab-0xD800)*0x400 + (cd-0xDC00) + 0x10000)
@@ -449,7 +451,7 @@ local pattern = P("\254\255") * Cs( (
+ one
)^1 )
+ P("\255\254") * Cs( (
- four / function(b,a,d,c)
+ four / function(b,a,d,c)
local ab = 0xFF * byte(a) + byte(b)
local cd = 0xFF * byte(c) + byte(d)
return utfchar((ab-0xD800)*0x400 + (cd-0xDC00) + 0x10000)
@@ -463,3 +465,19 @@ local pattern = P("\254\255") * Cs( (
function string.toutf(s)
return lpegmatch(pattern,s) or s -- todo: utf32
end
+
+local validatedutf = Cs (
+ (
+ patterns.utf8one
+ + patterns.utf8two
+ + patterns.utf8three
+ + patterns.utf8four
+ + P(1) / "�"
+ )^0
+)
+
+patterns.validatedutf = validatedutf
+
+function string.validutf(str)
+ return lpegmatch(validatedutf,str)
+end
diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf
index d9e0cb21f..8d2ac5857 100644
--- a/tex/context/base/status-files.pdf
+++ b/tex/context/base/status-files.pdf
Binary files differ
diff --git a/tex/context/base/status-lua.pdf b/tex/context/base/status-lua.pdf
index 96f1ea93a..0d58d1b16 100644
--- a/tex/context/base/status-lua.pdf
+++ b/tex/context/base/status-lua.pdf
Binary files differ
diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua
index e1f4e9966..ea509c338 100644
--- a/tex/generic/context/luatex/luatex-fonts-merged.lua
+++ b/tex/generic/context/luatex/luatex-fonts-merged.lua
@@ -1,6 +1,6 @@
-- merged file : luatex-fonts-merged.lua
-- parent file : luatex-fonts.lua
--- merge date : 05/29/12 18:43:34
+-- merge date : 05/30/12 11:26:34
do -- begin closure to overcome local limits and interference