diff options
author | Marius <mariausol@gmail.com> | 2013-02-26 01:40:31 +0200 |
---|---|---|
committer | Marius <mariausol@gmail.com> | 2013-02-26 01:40:31 +0200 |
commit | 0d5087c4edd28707b198afabd26016fe922c6e35 (patch) | |
tree | 4fb23acb74c0c046a91dc4d1006b689d89448d49 /tex | |
parent | f6b142ac209f26e0164dd37933dd622251f9564c (diff) | |
download | context-0d5087c4edd28707b198afabd26016fe922c6e35.tar.gz |
beta 2013.02.26 00:17
Diffstat (limited to 'tex')
24 files changed, 361 insertions, 190 deletions
diff --git a/tex/context/base/cont-new.mkii b/tex/context/base/cont-new.mkii index 3d7223fc4..beedc13a9 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{2013.02.20 14:35} +\newcontextversion{2013.02.26 00:17} %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 298c7cd14..c228612d4 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{2013.02.20 14:35} +\newcontextversion{2013.02.26 00:17} %D This file is loaded at runtime, thereby providing an excellent place for %D hacks, patches, extensions and new features. diff --git a/tex/context/base/context-version.pdf b/tex/context/base/context-version.pdf Binary files differindex 4306be443..a35b04918 100644 --- a/tex/context/base/context-version.pdf +++ b/tex/context/base/context-version.pdf diff --git a/tex/context/base/context-version.png b/tex/context/base/context-version.png Binary files differindex 38acb2773..7749d44b5 100644 --- a/tex/context/base/context-version.png +++ b/tex/context/base/context-version.png diff --git a/tex/context/base/context.mkii b/tex/context/base/context.mkii index f347b8494..ae4d20491 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{2013.02.20 14:35} +\edef\contextversion{2013.02.26 00:17} %D For those who want to use this: diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv index d5d34fe8f..a7a24eb0a 100644 --- a/tex/context/base/context.mkiv +++ b/tex/context/base/context.mkiv @@ -25,7 +25,7 @@ %D up and the dependencies are more consistent. \edef\contextformat {\jobname} -\edef\contextversion{2013.02.20 14:35} +\edef\contextversion{2013.02.26 00:17} %D For those who want to use this: diff --git a/tex/context/base/data-lua.lua b/tex/context/base/data-lua.lua index 49033461e..ab083d446 100644 --- a/tex/context/base/data-lua.lua +++ b/tex/context/base/data-lua.lua @@ -6,43 +6,26 @@ if not modules then modules = { } end modules ['data-lua'] = { license = "see context related readme files" } --- We overload the regular loader. We do so because we operate mostly in --- tds and use our own loader code. Alternatively we could use a more --- extensive definition of package.path and package.cpath but even then --- we're not done. Also, we now have better tracing. --- --- -- local mylib = require("libtest") --- -- local mysql = require("luasql.mysql") +-- This is now a plug in into l-lua (as we also use the extra paths elsewhere). -local searchers = package.searchers or package.loaders +local resolvers, package = resolvers, package +local gsub = string.gsub local concat = table.concat +local addsuffix = file.addsuffix -local trace_libraries = false - -trackers.register("resolvers.libraries", function(v) trace_libraries = v end) -trackers.register("resolvers.locating", function(v) trace_libraries = v end) - -local report_libraries = logs.reporter("resolvers","libraries") - -local gsub, insert = string.gsub, table.insert local P, Cs, lpegmatch = lpeg.P, lpeg.Cs, lpeg.match -local unpack = unpack or table.unpack -local is_readable = file.is_readable - -local resolvers, package = resolvers, package local libsuffixes = { 'tex', 'lua' } local clibsuffixes = { 'lib' } local libformats = { 'TEXINPUTS', 'LUAINPUTS' } local clibformats = { 'CLUAINPUTS' } +local helpers = package.helpers + +trackers.register("resolvers.libraries", function(v) helpers.trace = v end) +trackers.register("resolvers.locating", function(v) helpers.trace = v end) -local libpaths = nil -local clibpaths = nil -local libhash = { } -local clibhash = { } -local libextras = { } -local clibextras = { } +helpers.report = logs.reporter("resolvers","libraries") local pattern = Cs(P("!")^0 / "" * (P("/") * P(-1) / "/" + P("/")^1 / "/" + 1)^0) @@ -50,102 +33,53 @@ local function cleanpath(path) -- hm, don't we have a helper for this? return resolvers.resolve(lpegmatch(pattern,path)) end -local function getlibpaths() - if not libpaths then - libpaths = { } - for i=1,#libformats do - local paths = resolvers.expandedpathlistfromvariable(libformats[i]) - for i=1,#paths do - local path = cleanpath(paths[i]) - if not libhash[path] then - libpaths[#libpaths+1] = path - libhash[path] = true - end +helpers.cleanpath = cleanpath + +function helpers.libpaths(libhash) + local libpaths = { } + for i=1,#libformats do + local paths = resolvers.expandedpathlistfromvariable(libformats[i]) + for i=1,#paths do + local path = cleanpath(paths[i]) + if not libhash[path] then + libpaths[#libpaths+1] = path + libhash[path] = true end end end return libpaths end -local function getclibpaths() - if not clibpaths then - clibpaths = { } - for i=1,#clibformats do - local paths = resolvers.expandedpathlistfromvariable(clibformats[i]) - for i=1,#paths do - local path = cleanpath(paths[i]) - if not clibhash[path] then - clibpaths[#clibpaths+1] = path - clibhash[path] = true - end +function helpers.clibpaths(clibhash) + local clibpaths = { } + for i=1,#clibformats do + local paths = resolvers.expandedpathlistfromvariable(clibformats[i]) + for i=1,#paths do + local path = cleanpath(paths[i]) + if not clibhash[path] then + clibpaths[#clibpaths+1] = path + clibhash[path] = true end end end return clibpaths end -package.libpaths = getlibpaths -package.clibpaths = getclibpaths - -function package.extralibpath(...) - local libpaths = getlibpaths() - local paths = table.flattened { ... } - for i=1,#paths do - local path = cleanpath(paths[i]) - if not libhash[path] then - if trace_libraries then - report_libraries("! extra lua path '%s'",path) - end - libextras[#libextras+1] = path - libpaths[#libpaths +1] = path - end - end -end - -function package.extraclibpath(...) - local clibpaths = getclibpaths() - local paths = table.flattened { ... } - for i=1,#paths do - local path = cleanpath(paths[i]) - if not clibhash[path] then - if trace_libraries then - report_libraries("! extra lib path '%s'",path) - end - clibextras[#clibextras+1] = path - clibpaths[#clibpaths +1] = path - end - end -end - -if not searchers[-2] then - -- use package-path and package-cpath - searchers[-2] = searchers[2] -end - -local function loadedaslib(resolved,rawname) - return package.loadlib(resolved,"luaopen_" .. gsub(rawname,"%.","_")) -end - -local function loadedbylua(name) - if trace_libraries then - report_libraries("! locating %q using normal loader",name) - end - local resolved = searchers[-2](name) -end - -local function loadedbyformat(name,rawname,suffixes,islib) - if trace_libraries then - report_libraries("! locating %q as %q using formats %q",rawname,name,concat(suffixes)) +function helpers.loadedbyformat(name,rawname,suffixes,islib) + local trace = helpers.trace + local report = helpers.report + if trace then + report("! locating %q as %q using formats %q",rawname,name,concat(suffixes)) end for i=1,#suffixes do -- so we use findfile and not a lookup loop local format = suffixes[i] local resolved = resolvers.findfile(name,format) or "" - if trace_libraries then - report_libraries("! checking for %q' using format %q",name,format) + if trace then + report("! checking for %q' using format %q",name,format) end if resolved ~= "" then - if trace_libraries then - report_libraries("! lib %q located on %q",name,resolved) + if trace then + report("! lib %q located on %q",name,resolved) end if islib then return loadedaslib(resolved,rawname) @@ -156,50 +90,28 @@ local function loadedbyformat(name,rawname,suffixes,islib) end end -local function loadedbypath(name,rawname,paths,islib,what) - if trace_libraries then - report_libraries("! locating %q as %q on %q paths",rawname,name,what) - end - for p=1,#paths do - local path = paths[p] - local resolved = file.join(path,name) - if trace_libraries then -- mode detail - report_libraries("! checking for %q using %q path %q",name,what,path) - end - if is_readable(resolved) then - if trace_libraries then - report_libraries("! lib %q located on %q",name,resolved) - end - if islib then - return loadedaslib(resolved,rawname) - else - return loadfile(resolved) - end - end - end -end +local loadedaslib = helpers.loadedaslib +local loadedbylua = helpers.loadedbylua +local loadedbyformat = helpers.loadedbyformat +local loadedbypath = helpers.loadedbypath +local notloaded = helpers.notloaded -local function notloaded(name) - if trace_libraries then - report_libraries("? unable to locate library %q",name) - end -end +local getlibpaths = package.libpaths +local getclibpaths = package.clibpaths -searchers[2] = function(name) - local thename = gsub(name,"%.","/") - local luaname = file.addsuffix(thename,"lua") - local libname = file.addsuffix(thename,os.libsuffix) - return - loadedbyformat(luaname,name,libsuffixes, false) - or loadedbyformat(libname,name,clibsuffixes, true) - or loadedbypath (luaname,name,getlibpaths (),false,"lua") - or loadedbypath (luaname,name,getclibpaths(),false,"lua") - or loadedbypath (libname,name,getclibpaths(),true, "lib") - or loadedbylua (name) - or notloaded (name) +function helpers.loaded(name) + local thename = gsub(name,"%.","/") + local luaname = addsuffix(thename,"lua") + local libname = addsuffix(thename,os.libsuffix) + local libpaths = getlibpaths() + local clibpaths = getclibpaths() + return loadedbyformat(luaname,name,libsuffixes,false) + or loadedbyformat(libname,name,clibsuffixes,true) + or loadedbypath(luaname,name,libpaths,false,"lua") + or loadedbypath(luaname,name,clibpaths,false,"lua") + or loadedbypath(libname,name,clibpaths,true,"lib") + or loadedbylua(name) + or notloaded(name) end --- searchers[3] = nil --- searchers[4] = nil - resolvers.loadlualib = require diff --git a/tex/context/base/l-lpeg.lua b/tex/context/base/l-lpeg.lua index 9a08647f9..9bd9706bf 100644 --- a/tex/context/base/l-lpeg.lua +++ b/tex/context/base/l-lpeg.lua @@ -11,7 +11,7 @@ if not modules then modules = { } end modules ['l-lpeg'] = { -- move utf -> l-unicode -- move string -> l-string or keep it here -local lpeg = require("lpeg") +lpeg = require("lpeg") -- tracing (only used when we encounter a problem in integration of lpeg in luatex) diff --git a/tex/context/base/l-lua.lua b/tex/context/base/l-lua.lua index 7c78a4031..837f03d2a 100644 --- a/tex/context/base/l-lua.lua +++ b/tex/context/base/l-lua.lua @@ -147,3 +147,168 @@ function optionalrequire(...) return result end end + +-- Code moved from data-lua and changed into a plug-in. + +-- We overload the regular loader. We do so because we operate mostly in +-- tds and use our own loader code. Alternatively we could use a more +-- extensive definition of package.path and package.cpath but even then +-- we're not done. Also, we now have better tracing. +-- +-- -- local mylib = require("libtest") +-- -- local mysql = require("luasql.mysql") + +local gsub, format = string.gsub, string.format + +local package = package +local searchers = package.searchers or package.loaders + +local libpaths = nil +local clibpaths = nil +local libhash = { } +local clibhash = { } +local libextras = { } +local clibextras = { } + +-- dummies + +local filejoin = file and file.join or function(path,name) return path .. "/" .. name end +local isreadable = file and file.is_readable or function(name) local f = io.open(name) if f then f:close() return true end end +local addsuffix = file and file.addsuffix or function(name,suffix) return name .. "." .. suffix end + +-- + +local function cleanpath(path) -- hm, don't we have a helper for this? + return path +end + +local helpers = package.helpers or { + libpaths = function() return { } end, + clibpaths = function() return { } end, + cleanpath = cleanpath, + trace = false, + report = function(...) print(format(...)) end, +} +package.helpers = helpers + +local function getlibpaths() + return libpaths or helpers.libpaths(libhash) +end + +local function getclibpaths() + return clibpaths or helpers.clibpaths(clibhash) +end + +package.libpaths = getlibpaths +package.clibpaths = getclibpaths + +function package.extralibpath(...) + local libpaths = getlibpaths() + local pathlist = { ... } + local cleanpath = helpers.cleanpath + local trace = helpers.trace + local report = helpers.report + for p=1,#pathlist do + local paths = pathlist[p] + for i=1,#paths do + local path = cleanpath(paths[i]) + if not libhash[path] then + if trace then + libraries("! extra lua path '%s'",path) + end + libextras[#libextras+1] = path + libpaths [#libpaths +1] = path + end + end + end +end + +function package.extraclibpath(...) + local clibpaths = getclibpaths() + local pathlist = { ... } + local cleanpath = helpers.cleanpath + local trace = helpers.trace + local report = helpers.report + for p=1,#pathlist do + local paths = pathlist[p] + for i=1,#paths do + local path = cleanpath(paths[i]) + if not clibhash[path] then + if trace then + report("! extra lib path '%s'",path) + end + clibextras[#clibextras+1] = path + clibpaths [#clibpaths +1] = path + end + end + end +end + +if not searchers[-2] then + -- use package-path and package-cpath + searchers[-2] = searchers[2] +end + +searchers[2] = function(name) + return helpers.loaded(name) +end + +local function loadedaslib(resolved,rawname) + return package.loadlib(resolved,"luaopen_" .. gsub(rawname,"%.","_")) +end + +local function loadedbylua(name) + if helpers.trace then + helpers.report("! locating %q using normal loader",name) + end + return searchers[-2](name) +end + +local function loadedbypath(name,rawname,paths,islib,what) + local trace = helpers.trace + local report = helpers.report + if trace then + report("! locating %q as %q on %q paths",rawname,name,what) + end + for p=1,#paths do + local path = paths[p] + local resolved = filejoin(path,name) + if trace then -- mode detail + report("! checking for %q using %q path %q",name,what,path) + end + if isreadable(resolved) then + if trace then + report("! lib %q located on %q",name,resolved) + end + if islib then + return loadedaslib(resolved,rawname) + else + return loadfile(resolved) + end + end + end +end + +local function notloaded(name) + if helpers.trace then + helpers.report("? unable to locate library %q",name) + end +end + +helpers.loadedaslib = loadedaslib +helpers.loadedbylua = loadedbylua +helpers.loadedbypath = loadedbypath +helpers.notloaded = notloaded + +function helpers.loaded(name) + local thename = gsub(name,"%.","/") + local luaname = addsuffix(thename,"lua") + local libname = addsuffix(thename,os.libsuffix) + local libpaths = getlibpaths() + local clibpaths = getclibpaths() + return loadedbypath(luaname,name,libpaths,false,"lua") + or loadedbypath(luaname,name,clibpaths,false,"lua") + or loadedbypath(libname,name,clibpaths,true,"lib") + or loadedbylua(name) + or notloaded(name) +end diff --git a/tex/context/base/l-md5.lua b/tex/context/base/l-md5.lua index 01f17d924..8ac20a5a5 100644 --- a/tex/context/base/l-md5.lua +++ b/tex/context/base/l-md5.lua @@ -20,9 +20,10 @@ end local md5, file = md5, file local gsub, format, byte = string.gsub, string.format, string.byte +local md5sum = md5.sum local function convert(str,fmt) - return (gsub(md5.sum(str),".",function(chr) return format(fmt,byte(chr)) end)) + return (gsub(md5sum(str),".",function(chr) return format(fmt,byte(chr)) end)) end if not md5.HEX then function md5.HEX(str) return convert(str,"%02X") end end diff --git a/tex/context/base/math-ini.mkiv b/tex/context/base/math-ini.mkiv index 71263c06f..823ffaabd 100644 --- a/tex/context/base/math-ini.mkiv +++ b/tex/context/base/math-ini.mkiv @@ -1334,14 +1334,6 @@ \newconstant\c_math_styles_state_cramped \newconstant\c_math_styles_state_size -\def\math_style_add_to_cache - {\c_math_styles_state_style \zerocount - \c_math_styles_state_cramped\zerocount - \c_math_styles_state_size \zerocount - \rawprocesscommacommand[\m_math_style_asked]\math_style_collect - \global\expandafter\let\csname\??mathstylecache\m_math_style_asked\normalexpanded{\endcsname - \math_style_add_to_cache_choice}} - \def\math_style_add_to_cache_choice {% \ifcase\c_math_styles_state_size \ifcase\c_math_styles_state_style @@ -1423,12 +1415,6 @@ \let\setmathstyle\math_style_set -\def\math_style_set_indeed - {\ifcsname\??mathstylecache\m_math_style_asked\endcsname \else - \math_style_add_to_cache - \fi - \csname\??mathstylecache\m_math_style_asked\endcsname} - \def\installmathstyle#1#2% {\ifcsname\??mathstylecommand#1\endcsname \else \setvalue{\??mathstylecommand#1}{#2}% @@ -1463,6 +1449,76 @@ \fi} %D \startbuffer +%D \definemathstyle[mystyle][scriptscript] +%D +%D $text\startmathstyle[mystyle]scriptscript\stopmathstyle text$ +%D \stopbuffer +%D +%D \typebuffer \blank \start \getbuffer \stop \blank + +\installcorenamespace {mathstyle} + +\unexpanded\def\definemathstyle + {\dodoubleargument\math_style_define} + +\def\math_style_define[#1][#2]% + {\c_math_styles_state_style \zerocount + \c_math_styles_state_cramped\zerocount + \c_math_styles_state_size \zerocount + \rawprocesscommacommand[#2]\math_style_collect + \expandafter\let\csname\??mathstyle#1\normalexpanded{\endcsname\math_style_add_to_cache_choice}} + +% \def\math_style_set_indeed +% {\ifcsname\??mathstyle\m_math_style_asked\endcsname +% \csname\??mathstyle\m_math_style_asked\endcsname +% \else +% \math_style_set_indeed_cached +% \fi} +% +% \def\math_style_set_indeed_cached +% {\ifcsname\??mathstylecache\m_math_style_asked\endcsname +% % already in cache +% \else +% \math_style_add_to_cache +% \fi +% \csname\??mathstylecache\m_math_style_asked\endcsname} +% +% \def\math_style_add_to_cache +% {\c_math_styles_state_style \zerocount +% \c_math_styles_state_cramped\zerocount +% \c_math_styles_state_size \zerocount +% \rawprocesscommacommand[\m_math_style_asked]\math_style_collect +% \global\expandafter\let\csname\??mathstylecache\m_math_style_asked\normalexpanded{\endcsname\math_style_add_to_cache_choice}} +% +% ugly but more efficient (as called often) + +\def\math_style_set_indeed + {\csname\??mathstyle + \ifcsname\??mathstyle\m_math_style_asked\endcsname + \m_math_style_asked + \else + \??mathstyle + \fi + \endcsname} + +\setvalue{\??mathstyle\??mathstyle}% + {\csname\??mathstylecache + \ifcsname\??mathstylecache\m_math_style_asked\endcsname + \m_math_style_asked + \else + \??mathstylecache + \fi + \endcsname} + +\setvalue{\??mathstylecache\??mathstylecache}% + {\c_math_styles_state_style \zerocount + \c_math_styles_state_cramped\zerocount + \c_math_styles_state_size \zerocount + \rawprocesscommacommand[\m_math_style_asked]\math_style_collect + \global\expandafter\let\csname\??mathstylecache\m_math_style_asked\normalexpanded{\endcsname\math_style_add_to_cache_choice}% + \csname\??mathstylecache\m_math_style_asked\endcsname} + +%D \startbuffer %D $x\begingroup\setupmathstyle[script]x\endgroup x$ %D $x{\setupmathstyle[script]x}x$ %D $x\startmathstyle[script]x\stopmathstyle x$ diff --git a/tex/context/base/math-ttv.lua b/tex/context/base/math-ttv.lua index 9e86ca975..1f644e788 100644 --- a/tex/context/base/math-ttv.lua +++ b/tex/context/base/math-ttv.lua @@ -429,7 +429,7 @@ mathencodings["tex-sy"] = { [0x027E9] = 0x69, -- >, rangle [0x0007C] = 0x6A, -- |, mid, lvert, rvert [0x02225] = 0x6B, -- parallel - -- [0x02016] = 0x00, -- Vert, lVert, rVert, arrowvert, Arrowvert + -- [0x0 ] = 0x00, -- Vert, lVert, rVert, arrowvert, Arrowvert [0x02195] = 0x6C, -- updownarrow [0x021D5] = 0x6D, -- Updownarrow [0x0005C] = 0x6E, -- \, backslash, setminus diff --git a/tex/context/base/meta-fig.mkiv b/tex/context/base/meta-fig.mkiv index bee88ffef..7fbc33be9 100644 --- a/tex/context/base/meta-fig.mkiv +++ b/tex/context/base/meta-fig.mkiv @@ -44,7 +44,8 @@ \definefittingpage [MPpage] [\c!align=, - \c!command=\meta_process_graphic] + \c!command=\meta_process_graphic_instance{\fittingpageparameter\c!instance}, + \c!instance=] %D \macros %D {MPfigure} diff --git a/tex/context/base/meta-ini.mkiv b/tex/context/base/meta-ini.mkiv index 0ec3ed942..c3700bce6 100644 --- a/tex/context/base/meta-ini.mkiv +++ b/tex/context/base/meta-ini.mkiv @@ -53,6 +53,9 @@ % graphic % endfig +% The instance will be implemented stepwise ... I should redo some code in order to +% make the macros look better than they do now. + \writestatus{loading}{MetaPost Graphics / Initializations} \registerctxluafile{meta-ini}{1.001} @@ -262,6 +265,14 @@ {\egroup \meta_place_graphic} +\unexpanded\def\meta_process_graphic_instance#1% + {\edef\currentMPinstance{#1}% + \ifx\currentMPinstance\empty + \let\currentMPinstance\defaultMPinstance + \fi + \edef\currentMPformat{\MPinstanceparameter\s!format}% + \meta_process_graphic} + \unexpanded\def\meta_process_graphic#1% todo: extensions and inclusions outside beginfig {\meta_start_current_graphic \forgetall diff --git a/tex/context/base/mult-def.mkiv b/tex/context/base/mult-def.mkiv index f339e3632..600f9a5ce 100644 --- a/tex/context/base/mult-def.mkiv +++ b/tex/context/base/mult-def.mkiv @@ -52,6 +52,7 @@ \def\c!textalign {textalign} \def\c!up {up} \def\c!down {down} +\def\c!instance {instance} \def\v!compressseparator{compressseparator} \def\v!notation {notation} diff --git a/tex/context/base/page-mix.mkiv b/tex/context/base/page-mix.mkiv index 3335c87e2..a5c343fc7 100644 --- a/tex/context/base/page-mix.mkiv +++ b/tex/context/base/page-mix.mkiv @@ -220,7 +220,8 @@ %D hsize and vsize is among them. The calculation of the hsize is done elsewhere. \unexpanded\def\page_mix_command_set_hsize - {\hsize\d_page_mix_column_width} + {\hsize\d_page_mix_column_width + \textwidth\d_page_mul_used_width} % needs thinking ... grouping etc %D When setting the vsize we make sure that we collect a few more lines than needed %D so that we have enough to split over the columns. Collecting too much is somewhat diff --git a/tex/context/base/page-mul.mkiv b/tex/context/base/page-mul.mkiv index 1d1698764..c5c9f73df 100644 --- a/tex/context/base/page-mul.mkiv +++ b/tex/context/base/page-mul.mkiv @@ -196,6 +196,7 @@ \d_page_mul_available_width/\nofcolumns -\d_page_mul_offset*\plustwo \relax + \textwidth\d_page_mul_used_width % needs thinking ... grouping etc \hsize\d_page_mul_used_width} %D Torture test: diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf Binary files differindex 28ccc3ba4..64a2f340a 100644 --- a/tex/context/base/status-files.pdf +++ b/tex/context/base/status-files.pdf diff --git a/tex/context/base/status-lua.pdf b/tex/context/base/status-lua.pdf Binary files differindex 6125bcfed..096e0d6c0 100644 --- a/tex/context/base/status-lua.pdf +++ b/tex/context/base/status-lua.pdf diff --git a/tex/context/base/trac-lmx.lua b/tex/context/base/trac-lmx.lua index d20241735..501e7ec42 100644 --- a/tex/context/base/trac-lmx.lua +++ b/tex/context/base/trac-lmx.lua @@ -12,7 +12,7 @@ local type, tostring, rawget, loadstring, pcall = type, tostring, rawget, loadst local format, sub, gsub = string.format, string.sub, string.gsub local concat = table.concat local P, Cc, Cs, C, Carg, lpegmatch = lpeg.P, lpeg.Cc, lpeg.Cs, lpeg.C, lpeg.Carg, lpeg.match -local joinpath, replacesuffix = file.join, file.replacesuffix +local joinpath, replacesuffix, pathpart = file.join, file.replacesuffix, file.pathpart local allocate = utilities.storage.allocate local setmetatableindex = table.setmetatableindex @@ -151,6 +151,7 @@ lmx.loadedfile = loadedfile -- A few helpers (the next one could end up in l-lpeg): local usedpaths = { } +local givenpath = nil local pattern = lpeg.replacer { ["&"] = "&", @@ -213,6 +214,9 @@ end local function do_include(filename) local data = loadedsubfile(filename) + if (not data or data == "") and givenpath then + data = loadedsubfile(joinpath(givenpath,filename)) + end if (not data or data == "") and type(usedpaths) == "table" then for i=1,#usedpaths do data = loadedsubfile(joinpath(usedpaths[i],filename)) @@ -427,14 +431,15 @@ local function wrapper(converter,defaults,variables) end end -function lmxnew(data,defaults,nocache) -- todo: use defaults in calling routines +function lmxnew(data,defaults,nocache,path) -- todo: use defaults in calling routines data = data or "" local known = cache[data] if not known then -usedpaths = lmxvariables.includepath or { } -if type(usedpaths) == "string" then - usedpaths = { usedpaths } -end + givenpath = path + usedpaths = lmxvariables.includepath or { } + if type(usedpaths) == "string" then + usedpaths = { usedpaths } + end data = lpegmatch(pattern_1,data) data = lpegmatch(pattern_2,data,1,{}) data = lpegmatch(pattern_3,data) @@ -487,8 +492,8 @@ lmx.result = lmxresult local loadedfiles = { } -function lmx.convertstring(templatestring,variables,nocache) - return lmxresult(lmxnew(templatestring,nil,nocache),variables) +function lmx.convertstring(templatestring,variables,nocache,path) + return lmxresult(lmxnew(templatestring,nil,nocache,path),variables) end function lmx.convertfile(templatefile,variables,nocache) @@ -497,7 +502,7 @@ function lmx.convertfile(templatefile,variables,nocache) end local converter = loadedfiles[templatefile] if not converter then - converter = lmxnew(loadedfile(templatefile),nil,nocache) + converter = lmxnew(loadedfile(templatefile),nil,nocache,pathpart(templatefile)) loadedfiles[templatefile] = converter end return lmxresult(converter,variables) @@ -512,7 +517,7 @@ function lmxconvert(templatefile,resultfile,variables,nocache) -- or (templatefi end local converter = loadedfiles[templatefile] if not converter then - converter = lmxnew(loadedfile(templatefile),nil,nocache) + converter = lmxnew(loadedfile(templatefile),nil,nocache,pathpart(templatefile)) if cache_files then loadedfiles[templatefile] = converter end diff --git a/tex/context/base/util-prs.lua b/tex/context/base/util-prs.lua index 69d70fbc9..ab766d75a 100644 --- a/tex/context/base/util-prs.lua +++ b/tex/context/base/util-prs.lua @@ -341,7 +341,7 @@ local separator = S(' ,') local key = C((1-equal)^1) local value = dquote * C((1-dquote-escape*dquote)^0) * dquote -local pattern = Cf(Ct("") * Cg(key * equal * value) * separator^0,rawset)^0 +local pattern = Cf(Ct("") * Cg(key * equal * value) * separator^0,rawset)^0 * P(-1) patterns.keq_to_hash_c = pattern diff --git a/tex/context/base/util-sql-tickets.lua b/tex/context/base/util-sql-tickets.lua index 63bbf4d44..41010d265 100644 --- a/tex/context/base/util-sql-tickets.lua +++ b/tex/context/base/util-sql-tickets.lua @@ -229,6 +229,9 @@ function tickets.save(db,ticket) local data = db.serialize(ticket.data or { },"return") local status = ticket.status or s_error +-- print("SETTING") +-- inspect(data) + ticket.status = status ticket.accessed = time @@ -320,7 +323,7 @@ local template_yes =[[ FROM %basename% ORDER BY - `created` ; + `id` ; ]] local template_nop =[[ @@ -332,7 +335,7 @@ local template_nop =[[ FROM %basename% ORDER BY - `created` ; + `id` ; ]] function tickets.collect(db,nodata) @@ -375,7 +378,7 @@ local template_cleanup_yes =[[ WHERE `accessed` < %time% ORDER BY - `created` ; + `id` ; ]] .. template local template_cleanup_nop =[[ @@ -390,7 +393,7 @@ local template_cleanup_nop =[[ WHERE `accessed` < %time% ORDER BY - `created` ; + `id` ; ]] .. template function tickets.cleanupdb(db,delta,nodata) -- maybe delta in db @@ -426,7 +429,10 @@ local template =[[ FROM %basename% WHERE - `token` = '%token%' ; + `token` = '%token%' + ORDER BY + `id` + ; ]] function tickets.getstatus(db,token) @@ -451,7 +457,10 @@ local template =[[ FROM %basename% WHERE - `status` >= %rubish% OR `accessed` < %time% ; + `status` >= %rubish% OR `accessed` < %time% + ORDER BY + `id` + ; ]] function tickets.getobsolete(db,delta) @@ -685,7 +694,7 @@ local template =[[ WHERE `token` = '%token%' ORDER BY - `created` ; + `id` ; ]] function tickets.getticketsbytoken(db,token) @@ -712,7 +721,7 @@ local template =[[ WHERE `usertoken` = '%usertoken%' AND `status` < %rubish% ORDER BY - `created` ; + `id` ; ]] function tickets.getusertickets(db,usertoken) diff --git a/tex/context/base/util-sql-users.lua b/tex/context/base/util-sql-users.lua index 23bf9edb6..2b871acdc 100644 --- a/tex/context/base/util-sql-users.lua +++ b/tex/context/base/util-sql-users.lua @@ -108,6 +108,7 @@ local template =[[ CREATE TABLE `users` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(80) NOT NULL, + `fullname` varchar(80) NOT NULL, `password` varchar(50) DEFAULT NULL, `group` int(11) NOT NULL, `enabled` int(11) DEFAULT '1', @@ -123,6 +124,7 @@ local template =[[ local converter, fields = sql.makeconverter { { name = "id", type = "number" }, { name = "name", type = "string" }, + { name = "fullname", type = "string" }, { name = "password", type = "string" }, { name = "group", type = groupnames }, { name = "enabled", type = "boolean" }, @@ -203,6 +205,7 @@ end local template =[[ INSERT INTO %basename% ( `name`, + `fullname`, `password`, `group`, `enabled`, @@ -212,6 +215,7 @@ local template =[[ `data` ) VALUES ( '%[name]%', + '%[fullname]%', '%password%', '%group%', '%enabled%', @@ -237,6 +241,7 @@ function users.add(db,specification) variables = { basename = db.basename, name = name, + fullname = name or fullname, password = encryptpassword(specification.password or ""), group = groupnumbers[specification.group] or groupnumbers.guest, enabled = booleanstring(specification.enabled) and "1" or "0", @@ -305,6 +310,7 @@ local template =[[ UPDATE %basename% SET + `fullname` = '%fullname%', `password` = '%password%', `group` = '%group%', `enabled` = '%enabled%', @@ -331,6 +337,7 @@ function users.save(db,id,specification) return end + local fullname = specification.fullname == nil and user.fulname or specification.fullname local password = specification.password == nil and user.password or specification.password local group = specification.group == nil and user.group or specification.group local enabled = specification.enabled == nil and user.enabled or specification.enabled @@ -344,6 +351,7 @@ function users.save(db,id,specification) variables = { basename = db.basename, id = id, + fullname = fullname, password = encryptpassword(password), group = groupnumbers[group], enabled = booleanstring(enabled) and "1" or "0", diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 5fd322a73..4d843bd44 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 : 02/20/13 14:35:17 +-- merge date : 02/26/13 00:17:03 do -- begin closure to overcome local limits and interference @@ -11,7 +11,7 @@ if not modules then modules={} end modules ['l-lpeg']={ copyright="PRAGMA ADE / ConTeXt Development Team", license="see context related readme files" } -local lpeg=require("lpeg") +lpeg=require("lpeg") local report=texio and texio.write_nl or print local type,next,tostring=type,next,tostring local byte,char,gmatch,format=string.byte,string.char,string.gmatch,string.format |