diff options
author | Context Git Mirror Bot <phg42.2a@gmail.com> | 2016-09-01 22:11:47 +0200 |
---|---|---|
committer | Context Git Mirror Bot <phg42.2a@gmail.com> | 2016-09-01 22:11:47 +0200 |
commit | 1ee48eeafd4e46712a29c91ad704b882f00d765f (patch) | |
tree | a3f40107b2ec0a3c227ae736079d0cc4f7567f55 | |
parent | 7a738fba4cc14b31b0d9a3a88258e76de34ea1fb (diff) | |
download | context-1ee48eeafd4e46712a29c91ad704b882f00d765f.tar.gz |
2016-09-01 21:16:00
-rw-r--r-- | tex/context/base/context-version.pdf | bin | 4261 -> 4253 bytes | |||
-rw-r--r-- | tex/context/base/mkiv/cont-new.mkiv | 2 | ||||
-rw-r--r-- | tex/context/base/mkiv/context.mkiv | 2 | ||||
-rw-r--r-- | tex/context/base/mkiv/pack-rul.mkiv | 4 | ||||
-rw-r--r-- | tex/context/base/mkiv/status-files.pdf | bin | 9184 -> 9176 bytes | |||
-rw-r--r-- | tex/context/base/mkiv/status-lua.pdf | bin | 368151 -> 368144 bytes | |||
-rw-r--r-- | tex/context/base/mkiv/tabl-ntb.mkiv | 78 | ||||
-rw-r--r-- | tex/context/base/mkiv/util-sql-imp-sqlite.lua | 180 | ||||
-rw-r--r-- | tex/context/interface/mkiv/i-context.pdf | bin | 774735 -> 774729 bytes | |||
-rw-r--r-- | tex/context/interface/mkiv/i-readme.pdf | bin | 60796 -> 60792 bytes | |||
-rw-r--r-- | tex/generic/context/luatex/luatex-fonts-merged.lua | 2 |
11 files changed, 240 insertions, 28 deletions
diff --git a/tex/context/base/context-version.pdf b/tex/context/base/context-version.pdf Binary files differindex d553594bc..488b0a574 100644 --- a/tex/context/base/context-version.pdf +++ b/tex/context/base/context-version.pdf diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv index f796a920f..ffeb9087c 100644 --- a/tex/context/base/mkiv/cont-new.mkiv +++ b/tex/context/base/mkiv/cont-new.mkiv @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2016.09.01 19:33} +\newcontextversion{2016.09.01 21:11} %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/mkiv/context.mkiv b/tex/context/base/mkiv/context.mkiv index a0b600a16..d13f28bd4 100644 --- a/tex/context/base/mkiv/context.mkiv +++ b/tex/context/base/mkiv/context.mkiv @@ -39,7 +39,7 @@ %D up and the dependencies are more consistent. \edef\contextformat {\jobname} -\edef\contextversion{2016.09.01 19:33} +\edef\contextversion{2016.09.01 21:11} \edef\contextkind {beta} %D For those who want to use this: diff --git a/tex/context/base/mkiv/pack-rul.mkiv b/tex/context/base/mkiv/pack-rul.mkiv index 5c45ddc18..ce97a6bd9 100644 --- a/tex/context/base/mkiv/pack-rul.mkiv +++ b/tex/context/base/mkiv/pack-rul.mkiv @@ -142,7 +142,7 @@ [\c!width=\v!fit, \c!height=\v!broad, %\c!lines=, - \c!offset=.25ex, % \defaultframeoffset + \c!offset=.25\exheight, % \defaultframeoffset \c!empty=\v!no, \c!frame=\v!on, %\c!topframe=, @@ -176,7 +176,7 @@ \c!location=\v!normal, %\c!orientation=, \c!autowidth=\v!yes, - %\c!setups= + %\c!setups=, \c!loffset=\zeropoint, \c!roffset=\zeropoint, \c!toffset=\zeropoint, diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf Binary files differindex 4be380a83..5be73cee9 100644 --- a/tex/context/base/mkiv/status-files.pdf +++ b/tex/context/base/mkiv/status-files.pdf diff --git a/tex/context/base/mkiv/status-lua.pdf b/tex/context/base/mkiv/status-lua.pdf Binary files differindex 089686f63..a39c6a930 100644 --- a/tex/context/base/mkiv/status-lua.pdf +++ b/tex/context/base/mkiv/status-lua.pdf diff --git a/tex/context/base/mkiv/tabl-ntb.mkiv b/tex/context/base/mkiv/tabl-ntb.mkiv index 3f3a1d04e..eea743bfe 100644 --- a/tex/context/base/mkiv/tabl-ntb.mkiv +++ b/tex/context/base/mkiv/tabl-ntb.mkiv @@ -2052,41 +2052,73 @@ \appendtoks \setupTABLE [% - \c!frameoffset=.5\linewidth,% - \c!backgroundoffset=\v!frame,% - % \c!framecolor=\s!black,% - \c!frame=\v!on,% - \c!leftframe=\v!on,% - \c!rightframe=\v!on,% - \c!topframe=\v!on,% - \c!bottomframe=\v!on,% + % + % framed defaults + % \c!width=\v!fit,% \c!height=\v!fit,% - \c!autowidth=\v!yes,% + \c!lines=,% + \c!offset=.25\exheight,% + \c!empty=\v!no,% + \c!frame=\v!on,% + \c!topframe=,% + \c!bottomframe=,% + \c!leftframe=,% + \c!rightframe=,% + \c!radius=.5\bodyfontsize,% \c!rulethickness=\linewidth,% + \c!corner=\v!rectangular,% + \c!depth=\zeropoint,% + \c!foregroundcolor=,% + \c!foregroundstyle=,% + \c!background=,% + \c!backgroundcolor=,% + \c!backgroundoffset=\v!frame,% + \c!framecolor=,% + \c!frameoffset=.5\linewidth,% + % \c!backgroundcorner=\framedparameter\c!corner,% + % \c!backgrounddepth=\framedparameter\c!depth,% + % \c!backgroundradius=\framedparameter\c!radius,% + % \c!framecorner=\framedparameter\c!corner,% + % \c!framedepth=\framedparameter\c!depth,% + % \c!frameradius=\framedparameter\c!radius,% + \c!component=,% + \c!region=,% + \c!align=,% + \c!bottom=\vss,% + \c!top=,% \c!strut=\v!yes,% \c!autostrut=\v!no,% + \c!location=\v!normal,% + \c!orientation=,% + \c!autowidth=\v!yes,% + \c!setups=,% + \c!loffset=\zeropoint,% + \c!roffset=\zeropoint,% + \c!toffset=\zeropoint,% + \c!boffset=\zeropoint,% + % + % table specific % - \c!color=,% - \c!style=,% - \c!headstyle=\v!bold,% - \c!headcolor=,% \c!aligncharacter=\v!no,% \c!alignmentcharacter={,},% - \c!option=,% \v!stretch + \c!color=,% + \c!columndistance=\zeropoint,% each column (whole table) + \c!distance=\zeropoint,% individual column + \c!headcolor=,% \c!header=,% - \c!spaceinbetween=,% + \c!headstyle=\v!bold,% + \c!left=,% + \c!leftmargindistance=\zeropoint,% whole table \c!maxwidth=8\emwidth,% - \c!textwidth=\v!local,% was \hsize + \c!option=,% \v!stretch + \c!right=,% + \c!rightmargindistance=\zeropoint,% whole table + \c!spaceinbetween=,% \c!split=\v!auto,% \c!splitoffset=\zeropoint,% - \c!distance=\zeropoint,% individual column - \c!columndistance=\zeropoint,% each column (whole table) - \c!leftmargindistance=\zeropoint,% whole table - \c!rightmargindistance=\zeropoint,% whole table - \c!left=,% - \c!right=,% - \c!setups=% + \c!style=,% + \c!textwidth=\v!local,% was \hsize ]% \to \everyresetTABLEyes diff --git a/tex/context/base/mkiv/util-sql-imp-sqlite.lua b/tex/context/base/mkiv/util-sql-imp-sqlite.lua new file mode 100644 index 000000000..390e3aa29 --- /dev/null +++ b/tex/context/base/mkiv/util-sql-imp-sqlite.lua @@ -0,0 +1,180 @@ +if not modules then modules = { } end modules ['util-sql-imp-sqlite'] = { + version = 1.001, + comment = "companion to util-sql.lua", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +-- todo: make a converter + +require("util-sql") + +local rawset, setmetatable = rawset, setmetatable +local P, S, V, C, Cs, Ct, Cc, Cg, Cf, patterns, lpegmatch = lpeg.P, lpeg.S, lpeg.V, lpeg.C, lpeg.Cs, lpeg.Ct, lpeg.Cc, lpeg.Cg, lpeg.Cf, lpeg.patterns, lpeg.match + +local trace_sql = false trackers.register("sql.trace", function(v) trace_sql = v end) +local trace_queries = false trackers.register("sql.queries",function(v) trace_queries = v end) +local report_state = logs.reporter("sql","sqlite") + +local sql = utilities.sql +local helpers = sql.helpers +local methods = sql.methods +local validspecification = helpers.validspecification +local preparetemplate = helpers.preparetemplate +local splitdata = helpers.splitdata +local replacetemplate = utilities.templates.replace +local serialize = sql.serialize +local deserialize = sql.deserialize +local getserver = sql.getserver + +local sqlite = require("swiglib.sqlite.core") +local swighelpers = require("swiglib.helpers.core") + + +-- we can have a cache + +-- local preamble = t_preamble[getserver()] or t_preamble.mysql +-- if preamble then +-- preamble = replacetemplate(preamble,specification.variables,'sql') +-- query = preamble .. "\n" .. query +-- end + +-- print(sqlite.sqlite3_errmsg(dbh)) + +local get_list_item = sqlite.char_p_array_getitem +local is_okay = sqlite.SQLITE_OK +local execute_query = sqlite.sqlite3_exec_lua_callback +local error_message = sqlite.sqlite3_errmsg + +local new_db = sqlite.new_sqlite3_p_array +local open_db = sqlite.sqlite3_open +local get_db = sqlite.sqlite3_p_array_getitem +local close_db = sqlite.sqlite3_close +local dispose_db = sqlite.delete_sqlite3_p_array + +local cache = { } + +setmetatable(cache, { + __gc = function(t) + for k, v in next, t do + if trace_sql then + report_state("closing session %a",k) + end + close_db(v.dbh) + dispose_db(v.db) + end + end +}) + +local function execute(specification) + if trace_sql then + report_state("executing sqlite") + end + if not validspecification(specification) then + report_state("error in specification") + end + local query = preparetemplate(specification) + if not query then + report_state("error in preparation") + return + end + local base = specification.database -- or specification.presets and specification.presets.database + if not base then + report_state("no database specified") + return + end + base = file.addsuffix(base,"db") + local result = { } + local keys = { } + local id = specification.id + local db = nil + local dbh = nil + local okay = false + if id then + local session = cache[id] + if session then + dbh = session.dbh + okay = is_okay + else + db = new_db(1) + okay = open_db(base,db) + dbh = get_db(db,0) + if okay ~= is_okay then + report_state("no session database specified") + else + cache[id] = { + name = base, + db = db, + dbh = dbh, + } + end + end + else + db = new_db(1) + okay = open_db(base,db) + dbh = get_db(db,0) + end + if okay ~= is_okay then + report_state("no database opened") + else + local keysdone = false + local nofresults = 0 + local callback = function(data,nofcolumns,values,fields) + nofresults = nofresults + 1 + local r = { } + for i=0,nofcolumns-1 do + local field = get_list_item(fields,i) + local value = get_list_item(values,i) + r[field] = value + if not keysdone then + keys[i+1] = field + end + end + keysdone = true + result[nofresults] = r + return is_okay + end + local okay = execute_query(dbh,query,callback,nil,nil) + if okay ~= is_okay then + report_state(error_message(dbh)) + end + + end + if not id then + close_db(dbh) + dispose_db(db) + end + return result, keys +end + +local wraptemplate = [[ +local converters = utilities.sql.converters +local deserialize = utilities.sql.deserialize + +local tostring = tostring +local tonumber = tonumber +local booleanstring = string.booleanstring + +%s + +return function(data) + local target = %s -- data or { } + for i=1,#data do + local cells = data[i] + target[%s] = { + %s + } + end + return target +end +]] + +local celltemplate = "cells[%s]" + +methods.sqlite = { + execute = execute, + usesfiles = false, + wraptemplate = wraptemplate, + celltemplate = celltemplate, +} diff --git a/tex/context/interface/mkiv/i-context.pdf b/tex/context/interface/mkiv/i-context.pdf Binary files differindex f9e1e0519..301acb985 100644 --- a/tex/context/interface/mkiv/i-context.pdf +++ b/tex/context/interface/mkiv/i-context.pdf diff --git a/tex/context/interface/mkiv/i-readme.pdf b/tex/context/interface/mkiv/i-readme.pdf Binary files differindex 98d7cfc93..ebaef2f9b 100644 --- a/tex/context/interface/mkiv/i-readme.pdf +++ b/tex/context/interface/mkiv/i-readme.pdf diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 12b7fa4c5..a442ceab4 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 : c:/data/develop/context/sources/luatex-fonts-merged.lua -- parent file : c:/data/develop/context/sources/luatex-fonts.lua --- merge date : 09/01/16 19:33:12 +-- merge date : 09/01/16 21:11:58 do -- begin closure to overcome local limits and interference |