diff options
author | Hans Hagen <pragma@wxs.nl> | 2018-08-20 18:19:40 +0200 |
---|---|---|
committer | Context Git Mirror Bot <phg@phi-gamma.net> | 2018-08-20 18:19:40 +0200 |
commit | eac3559b6b0ef831294368a3a835070ecd7c44fc (patch) | |
tree | 1345e7e40d4311cb2667874f22b5701b6fc25ee7 /tex | |
parent | 7539371c37c02bc2bc6c5d7ebffa2ffc6fec36c3 (diff) | |
download | context-eac3559b6b0ef831294368a3a835070ecd7c44fc.tar.gz |
2018-08-20 17:54:00
Diffstat (limited to 'tex')
31 files changed, 205 insertions, 84 deletions
diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii index 3ef841bd7..00773c265 100644 --- a/tex/context/base/mkii/cont-new.mkii +++ b/tex/context/base/mkii/cont-new.mkii @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2018.08.19 12:52} +\newcontextversion{2018.08.20 17:47} %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/mkii/context.mkii b/tex/context/base/mkii/context.mkii index c541e2a5a..8d9b4eb27 100644 --- a/tex/context/base/mkii/context.mkii +++ b/tex/context/base/mkii/context.mkii @@ -20,7 +20,7 @@ %D your styles an modules. \edef\contextformat {\jobname} -\edef\contextversion{2018.08.19 12:52} +\edef\contextversion{2018.08.20 17:47} %D For those who want to use this: diff --git a/tex/context/base/mkii/strc-reg.mkii b/tex/context/base/mkii/strc-reg.mkii index 45be82525..a8d05fb78 100644 --- a/tex/context/base/mkii/strc-reg.mkii +++ b/tex/context/base/mkii/strc-reg.mkii @@ -18,7 +18,7 @@ % new: eigennummer=ja => eerste {} ipv pag nummer \unprotect - + %D Isolated but still indocumented. % Formaat tex-utility-input-file <jobname.tui>: @@ -1176,7 +1176,7 @@ \def\defineregister {\dodoubleargument\dodefineregister} - + \def\registerlengte{\utilityregisterlength} \def\utilityregisterlength{0} diff --git a/tex/context/base/mkiv/cldf-bas.lua b/tex/context/base/mkiv/cldf-bas.lua index 4ad0c5a48..b2c4b2623 100644 --- a/tex/context/base/mkiv/cldf-bas.lua +++ b/tex/context/base/mkiv/cldf-bas.lua @@ -185,7 +185,7 @@ do function context.latelua(f) local latelua = new_latelua(f) setattrlist(latelua,true) - ctx_flushnode(latelua) + ctx_flushnode(latelua,true) end end diff --git a/tex/context/base/mkiv/cldf-ini.lua b/tex/context/base/mkiv/cldf-ini.lua index d92003c51..da7f94922 100644 --- a/tex/context/base/mkiv/cldf-ini.lua +++ b/tex/context/base/mkiv/cldf-ini.lua @@ -710,10 +710,15 @@ local s_cldl_option_b = "[\\cldl" local s_cldl_option_f = "[\\cldl" -- add space (not needed) local s_cldl_option_e = "]" local s_cldl_option_s = "\\cldl" +local s_cldl_option_d = "\\cldd" local s_cldl_argument_b = "{\\cldl" local s_cldl_argument_f = "{\\cldl " local s_cldl_argument_e = "}" +if LUATEXFUNCTIONALITY < 6898 then + s_cldl_option_d = s_cldl_option_s +end + -- local s_cldl_option_b = "[" -- local s_cldl_option_f = "" -- add space (not needed) -- local s_cldl_option_s = "" @@ -1100,14 +1105,10 @@ end context.nodes = { -- todo store = storenode, flush = function(n) - if nodeflushmode then - if tonut(n) <= maxflushnodeindex then - flush(n) - else - flush(currentcatcodes,s_cldl_option_s,storenode(n)," ") - end + if nodeflushmode and tonut(n) <= maxflushnodeindex then + flush(n) else - flush(currentcatcodes,s_cldl_option_s,storenode(n)," ") + flush(currentcatcodes,d and s_cldl_option_d or s_cldl_option_s,storenode(n)," ") end end, } @@ -1116,15 +1117,11 @@ context.nuts = { -- todo store = function(n) return storenode(tonut(n)) end, - flush = function(n) - if nodeflushmode then - if n <= maxflushnodeindex then - flush(tonode(n)) - else - flush(currentcatcodes,s_cldl_option_s,storenode(tonode(n))," ") - end + flush = function(n,d) + if nodeflushmode and n <= maxflushnodeindex then + flush(tonode(n)) else - flush(currentcatcodes,s_cldl_option_s,storenode(tonode(n))," ") + flush(currentcatcodes,d and s_cldl_option_d or s_cldl_option_s,storenode(tonode(n))," ") end end, } diff --git a/tex/context/base/mkiv/cldf-ini.mkiv b/tex/context/base/mkiv/cldf-ini.mkiv index d19add0fe..67eea6892 100644 --- a/tex/context/base/mkiv/cldf-ini.mkiv +++ b/tex/context/base/mkiv/cldf-ini.mkiv @@ -43,6 +43,7 @@ % \fi \let\cldl\luafunction +\let\cldd\lateluafunction % \catcode`=\activecatcode \let\luafunction % saves 10% on the call diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv index d6e000f00..ef4bfc293 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{2018.08.19 12:52} +\newcontextversion{2018.08.20 17:47} %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 ba861fab5..ec61f78be 100644 --- a/tex/context/base/mkiv/context.mkiv +++ b/tex/context/base/mkiv/context.mkiv @@ -42,7 +42,7 @@ %D has to match \type {YYYY.MM.DD HH:MM} format. \edef\contextformat {\jobname} -\edef\contextversion{2018.08.19 12:52} +\edef\contextversion{2018.08.20 17:47} \edef\contextkind {beta} %D For those who want to use this: diff --git a/tex/context/base/mkiv/data-pre.lua b/tex/context/base/mkiv/data-pre.lua index 70b2e7354..5e3020b70 100644 --- a/tex/context/base/mkiv/data-pre.lua +++ b/tex/context/base/mkiv/data-pre.lua @@ -6,6 +6,25 @@ if not modules then modules = { } end modules ['data-pre'] = { license = "see context related readme files" } +-- filename : only the basename, including suffix (file:) +-- pathname : the pathpart (path:) +-- locate : lookup in database (full: kpse: loc:) +-- home : home path +-- jobpath : job path +-- relative : relative path ./ ../ ../.. (rel:) +-- auto : relatove or lookup +-- toppath : topmost path in input stack +-- selfautodir : rather tex specific +-- selfautoloc : rather tex specific +-- selfautoparent : rather tex specific +-- environment : expansion of variable (env:) +-- +-- nodename : computer name +-- machine : private, when set +-- sysname : operating system name +-- version : operating system version +-- release : operating system release + local resolvers = resolvers local prefixes = resolvers.prefixes @@ -140,7 +159,6 @@ resolvers.setdynamic("toppath") resolvers.setdynamic("jobpath") -- for a while (obsolete): - -prefixes.jobfile = prefixes.jobpath - -resolvers.setdynamic("jobfile") +-- +-- prefixes.jobfile = prefixes.jobpath +-- resolvers.setdynamic("jobfile") diff --git a/tex/context/base/mkiv/font-ctx.lua b/tex/context/base/mkiv/font-ctx.lua index 626ce51f2..82b6ae457 100644 --- a/tex/context/base/mkiv/font-ctx.lua +++ b/tex/context/base/mkiv/font-ctx.lua @@ -1016,25 +1016,33 @@ definers.registersplit(":",colonized,"direct") -- define (two steps) ------ space = P(" ") ------ spaces = space^0 -local leftparent = (P"(") -local rightparent = (P")") -local value = C((leftparent * (1-rightparent)^0 * rightparent + (1-space))^1) -local dimension = C((space/"" + P(1))^1) -local rest = C(P(1)^0) -local scale_none = Cc(0) -local scale_at = (P("at") +P("@")) * Cc(1) * spaces * dimension -- dimension -local scale_sa = P("sa") * Cc(2) * spaces * dimension -- number -local scale_mo = P("mo") * Cc(3) * spaces * dimension -- number -local scale_scaled = P("scaled") * Cc(4) * spaces * dimension -- number -local scale_ht = P("ht") * Cc(5) * spaces * dimension -- dimension -local scale_cp = P("cp") * Cc(6) * spaces * dimension -- dimension - -local specialscale = { [5] = "ht", [6] = "cp" } - -local sizepattern = spaces * (scale_at + scale_sa + scale_mo + scale_ht + scale_cp + scale_scaled + scale_none) -local splitpattern = spaces * value * spaces * rest +local sizepattern, splitpattern, specialscale do + + ----- space = P(" ") + ----- spaces = space^0 + local leftparent = (P"(") + local rightparent = (P")") + local leftbrace = (P"{") + local rightbrace = (P"}") + local withinparents = leftparent * (1-rightparent)^0 * rightparent + local withinbraces = leftbrace * (1-rightbrace )^0 * rightbrace + local value = C((withinparents + withinbraces + (1-space))^1) + local dimension = C((space/"" + P(1))^1) + local rest = C(P(1)^0) + local scale_none = Cc(0) + local scale_at = (P("at") +P("@")) * Cc(1) * spaces * dimension -- dimension + local scale_sa = P("sa") * Cc(2) * spaces * dimension -- number + local scale_mo = P("mo") * Cc(3) * spaces * dimension -- number + local scale_scaled = P("scaled") * Cc(4) * spaces * dimension -- number + local scale_ht = P("ht") * Cc(5) * spaces * dimension -- dimension + local scale_cp = P("cp") * Cc(6) * spaces * dimension -- dimension + + specialscale = { [5] = "ht", [6] = "cp" } + + sizepattern = spaces * (scale_at + scale_sa + scale_mo + scale_ht + scale_cp + scale_scaled + scale_none) + splitpattern = spaces * value * spaces * rest + +end function helpers.splitfontpattern(str) local name, size = lpegmatch(splitpattern,str) diff --git a/tex/context/base/mkiv/grph-rul.lua b/tex/context/base/mkiv/grph-rul.lua index 809854986..b30ed21cd 100644 --- a/tex/context/base/mkiv/grph-rul.lua +++ b/tex/context/base/mkiv/grph-rul.lua @@ -12,12 +12,16 @@ local attributes = attributes local nodes = nodes local context = context +local bpfactor = number.dimenfactors.bp + local nuts = nodes.nuts -local ruleactions = nodes.rules.ruleactions local userrule = nuts.rules.userrule -local bpfactor = number.dimenfactors.bp +local ruleactions = nuts.rules.ruleactions local setattrlist = nuts.setattrlist +local setattr = nuts.setattr +local tonode = nuts.tonode + local getattribute = tex.getattribute local a_color = attributes.private('color') @@ -237,11 +241,11 @@ interfaces.implement { t.ca = ca t.ta = ta else - rule[a_colormodel] = ma - rule[a_color] = ca - rule[a_transparency] = ta + setattr(rule,a_colormodel,ma) + setattr(rule,a_color,ca) + setattr(rule,a_transparency,ta) end - context(tonode(rule)) + context(tonode(rule)) -- will become context.nodes.flush end } diff --git a/tex/context/base/mkiv/l-dir.lua b/tex/context/base/mkiv/l-dir.lua index d13550643..b0b2c5283 100644 --- a/tex/context/base/mkiv/l-dir.lua +++ b/tex/context/base/mkiv/l-dir.lua @@ -91,7 +91,6 @@ local function glob_pattern_function(path,patt,recurse,action) end local dirs local nofdirs = 0 - local noffiles = #result for name in walkdir(usedpath) do if name ~= "." and name ~= ".." then local full = path .. name diff --git a/tex/context/base/mkiv/l-os.lua b/tex/context/base/mkiv/l-os.lua index b34c35edb..534be5edf 100644 --- a/tex/context/base/mkiv/l-os.lua +++ b/tex/context/base/mkiv/l-os.lua @@ -582,3 +582,20 @@ function os.validdate(year,month,day) end return year, month, day end + +local osexit = os.exit +local exitcode = nil + +function os.setexitcode(code) + exitcode = code +end + +function os.exit(c) + if exitcode ~= nil then + return osexit(exitcode) + end + if c ~= nil then + return osexit(c) + end + return osexit() +end diff --git a/tex/context/base/mkiv/mtx-context-domotica.tex b/tex/context/base/mkiv/mtx-context-domotica.tex index 83562ee30..5a162893b 100644 --- a/tex/context/base/mkiv/mtx-context-domotica.tex +++ b/tex/context/base/mkiv/mtx-context-domotica.tex @@ -29,7 +29,9 @@ % % example: context --extra=domotica --openzwave ./config/fibaro/fgms.xml ./open-zwave-master/config/aeotec/zw100.xml % example: context --extra=domotica --openzwave --pattern="./open-zwave-master/config/**.xml" -% example: context --extra=domotica --hue hue-pragma-tasks.lua +% example: context --extra=domotica --hue hue-pragma-tasks.lua +% example: context --extra=domotica --hue pragma-youless-gas.lua --year=2018 --month=8 +% example: context --extra=domotica --hue pragma-youless-electricity.lua % % end help @@ -161,8 +163,11 @@ \stopmode + \startmode[hue] + \usemodule[youless] + \starttext \setupheadertexts @@ -171,10 +176,22 @@ local arguments = document.arguments local files = document.files - local pattern = arguments.pattern local filename = files[1] - - if filename then + local pattern = arguments.pattern + local year = arguments.year + local month = arguments.month + + local action = (arguments.tasks and "task") + or (arguments.graphics and "graphics") + or (string.find(filename,"tasks") and "tasks") + or (string.find(filename,"electricity") and "graphics") + or (string.find(filename,"pulse") and "graphics") + or (string.find(filename,"gas") and "graphics") + + if not filename or filename == "" then + logs.report("youless","provide filename") + context("no files given") + elseif action == "tasks" then context.starttitle { title = "Hue: " .. file.nameonly(filename) } filename = file.addsuffix(filename,"lua") if lfs.isfile(filename) then @@ -183,9 +200,11 @@ context("unknown file %a",filename) end context.stoptitle() + elseif action == "graphics" then + moduledata.youless.graphics { year = year, month = month, filename = filename } else - context("no files given") - context.stoptitle() + logs.report("youless","provide --status or --graphics") + context("no action given") end \stopluacode diff --git a/tex/context/base/mkiv/mult-prm.lua b/tex/context/base/mkiv/mult-prm.lua index 77c53beb9..579750bc9 100644 --- a/tex/context/base/mkiv/mult-prm.lua +++ b/tex/context/base/mkiv/mult-prm.lua @@ -278,6 +278,7 @@ return { "lastxpos", "lastypos", "latelua", + "lateluafunction", "leftghost", "leftmarginkern", "letcharcode", diff --git a/tex/context/base/mkiv/publ-dat.lua b/tex/context/base/mkiv/publ-dat.lua index 6754382ff..b6e49da0f 100644 --- a/tex/context/base/mkiv/publ-dat.lua +++ b/tex/context/base/mkiv/publ-dat.lua @@ -1313,7 +1313,7 @@ do end -do +if implement then implement { name = "btxshortcut", diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf Binary files differindex 2223d9b0b..3f8b70ed8 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 5e96fd065..7ca202545 100644 --- a/tex/context/base/mkiv/status-lua.pdf +++ b/tex/context/base/mkiv/status-lua.pdf diff --git a/tex/context/base/mkiv/strc-con.mkvi b/tex/context/base/mkiv/strc-con.mkvi index ed7e401f0..0e5f3d8a5 100644 --- a/tex/context/base/mkiv/strc-con.mkvi +++ b/tex/context/base/mkiv/strc-con.mkvi @@ -1093,7 +1093,7 @@ \endgroup \edef\noexpand\currentconstructionlistentry {\the\scratchcounter}% \edef\noexpand\currentconstructionattribute {\the\lastdestinationattribute}% - \edef\noexpand\currentconstructionsynchronize{\clf_deferredenhancelist\scratchcounter}% + \edef\noexpand\currentconstructionsynchronize{\clf_deferredenhancelist\the\scratchcounter}% }% \fi} @@ -1103,11 +1103,11 @@ \def\reinstateconstructionnumberentry#1% was xdef {\edef\currentconstructionattribute {\clf_getinternallistreference#1}% - \edef\currentconstructionsynchronize{\clf_deferredenhancelist#1}} + \edef\currentconstructionsynchronize{\clf_deferredenhancelist\number#1}} \def\reinstatecachedconstructionnumberentry#1% was xdef | #1 = cached index can be different from real {\edef\currentconstructionattribute {\clf_getinternalcachedlistreference#1}% destination - \edef\currentconstructionsynchronize{\clf_deferredenhancelist#1}} + \edef\currentconstructionsynchronize{\clf_deferredenhancelist\number#1}} \installstructurelistprocessor{construction}{\usestructurelistprocessor{number+title}} diff --git a/tex/context/base/mkiv/strc-doc.mkiv b/tex/context/base/mkiv/strc-doc.mkiv index 3b4b656d3..7e7ad7e7d 100644 --- a/tex/context/base/mkiv/strc-doc.mkiv +++ b/tex/context/base/mkiv/strc-doc.mkiv @@ -27,7 +27,7 @@ view {\interactionparameter\c!focus}% \relax \xdef\currentstructureattribute {\the\lastdestinationattribute}% - \xdef\currentstructuresynchronize{\strc_lists_inject_enhance{#1}{\the\locationcount}}} + \xdef\currentstructuresynchronize{\strc_lists_inject_enhance{#1}}} \unexpanded\def\setstructurecomponentsynchronization#1% todo: use ctxcontext {\clf_setinternalreference @@ -37,6 +37,6 @@ view {\interactionparameter\c!focus}% \relax \xdef\currentstructurecomponentattribute {\the\lastdestinationattribute}% - \xdef\currentstructurecomponentsynchronize{\strc_lists_inject_enhance{#1}{\the\locationcount}}} + \xdef\currentstructurecomponentsynchronize{\strc_lists_inject_enhance{#1}}} \protect \endinput diff --git a/tex/context/base/mkiv/strc-lst.lua b/tex/context/base/mkiv/strc-lst.lua index 02b0c5b8c..72c24ed5d 100644 --- a/tex/context/base/mkiv/strc-lst.lua +++ b/tex/context/base/mkiv/strc-lst.lua @@ -1082,7 +1082,7 @@ implement { implement { name = "deferredenhancelist", arguments = "integer", - protected = true, + protected = true, -- for now, pre 1.09 actions = function(n) ctx_latelua(function() enhancelist(n) end) end, diff --git a/tex/context/base/mkiv/strc-lst.mkvi b/tex/context/base/mkiv/strc-lst.mkvi index f082615bb..6febd5040 100644 --- a/tex/context/base/mkiv/strc-lst.mkvi +++ b/tex/context/base/mkiv/strc-lst.mkvi @@ -146,8 +146,8 @@ % \unexpanded -\def\strc_lists_inject_enhance#listindex#internal% - {\clf_deferredenhancelist#listindex\relax} +\def\strc_lists_inject_enhance#listindex% + {\expandafter\clf_deferredenhancelist\number#listindex\relax} \unexpanded\def\strc_lists_inject_yes[#settings][#userdata]% can be used directly {\setupcurrentlist[\c!type=userdata,\c!location=\v!none,#settings]% grouped (use \let... @@ -172,7 +172,7 @@ \setxvalue{\??listlocations\currentlist}{\the\locationcount}% \ifx\p_location\v!here % this branch injects nodes ! - \strc_lists_inject_enhance{\currentlistnumber}{\the\locationcount}% + \strc_lists_inject_enhance{\currentlistnumber}% \clf_setinternalreference internal \locationcount view {\interactionparameter\c!focus}% @@ -212,7 +212,7 @@ \def\strc_lists_write_data_to[#tag]% {\begingroup \edef\currentlist{#tag}% - \ {\namedlistparameter{#tag}\c!state}\v!start + \doifelse{\namedlistparameter{#tag}\c!state}\v!start \strc_lists_write_data_to_yes \strc_lists_write_data_to_nop} diff --git a/tex/context/base/mkiv/strc-ref.lua b/tex/context/base/mkiv/strc-ref.lua index 4f4820aae..3874573e7 100644 --- a/tex/context/base/mkiv/strc-ref.lua +++ b/tex/context/base/mkiv/strc-ref.lua @@ -410,6 +410,7 @@ function references.set(data) pd[ref] = data local r = data.references ctx_dofinishreference(prefix or "",ref or "",r and r.internal or 0) + -- ctx_latelua(function() structures.references.enhance(prefix or ref,ref or "") end) end end process_settings(reference,action) diff --git a/tex/context/base/mkiv/strc-reg.mkiv b/tex/context/base/mkiv/strc-reg.mkiv index 1b77f135f..f00021170 100644 --- a/tex/context/base/mkiv/strc-reg.mkiv +++ b/tex/context/base/mkiv/strc-reg.mkiv @@ -305,7 +305,7 @@ \ifx\currentregisterownnumber\v!yes \glet\currentregistersynchronize\relax \else - \xdef\currentregistersynchronize{\clf_deferredenhanceregister{\currentregister}\currentregisternumber}% + \xdef\currentregistersynchronize{\clf_deferredenhanceregister{\currentregister}\number\currentregisternumber}% \fi \currentregistersynchronize % here? % needs thinking ... bla\index{bla}. will break before the . but adding a @@ -341,7 +341,7 @@ % internal \locationcount % view {\interactionparameter\c!focus}% \relax % this will change - \xdef\currentregistersynchronize{\clf_deferredenhanceregister{\currentregister}\currentregisternumber}% + \xdef\currentregistersynchronize{\clf_deferredenhanceregister{\currentregister}\number\currentregisternumber}% \currentregistersynchronize % here? \dostarttagged\t!registerlocation\currentregister \attribute\destinationattribute\lastdestinationattribute \signalcharacter % no \strut as it will be removed during cleanup diff --git a/tex/context/base/mkiv/util-env.lua b/tex/context/base/mkiv/util-env.lua index 064bd513a..1ff4c7f23 100644 --- a/tex/context/base/mkiv/util-env.lua +++ b/tex/context/base/mkiv/util-env.lua @@ -281,13 +281,20 @@ if arg then for index=1,#arg do local argument = arg[index] if find(argument,"^\"") then - newarg[#newarg+1] = gsub(argument,"^\"","") - if not find(argument,"\"$") then + if find(argument,"\"$") then + newarg[#newarg+1] = gsub(argument,"^\"(.-)\"$","%1") + instring = false + else + newarg[#newarg+1] = gsub(argument,"^\"","") instring = true end elseif find(argument,"\"$") then - newarg[#newarg] = newarg[#newarg] .. " " .. gsub(argument,"\"$","") - instring = false + if instring then + newarg[#newarg] = newarg[#newarg] .. " " .. gsub(argument,"\"$","") + instring = false + else + newarg[#newarg+1] = argument + end elseif instring then newarg[#newarg] = newarg[#newarg] .. " " .. argument else diff --git a/tex/context/base/mkiv/util-evo.lua b/tex/context/base/mkiv/util-evo.lua index 7f0b59ac4..2a6d6d6b8 100644 --- a/tex/context/base/mkiv/util-evo.lua +++ b/tex/context/base/mkiv/util-evo.lua @@ -536,6 +536,7 @@ local function gettemperatures(presets) if zones then local z = s[i].zones for i=1,#zones do + local zone = zones[i] if validzonetypes[zone.zoneType] then local z = z[i] if z.name == zone.name then diff --git a/tex/context/base/mkiv/util-sql-imp-ffi.lua b/tex/context/base/mkiv/util-sql-imp-ffi.lua index fededa63f..6f1555f7c 100644 --- a/tex/context/base/mkiv/util-sql-imp-ffi.lua +++ b/tex/context/base/mkiv/util-sql-imp-ffi.lua @@ -8,7 +8,7 @@ if not modules then modules = { } end modules ['util-sql-imp-ffi'] = { -- I looked at luajit-mysql to see how the ffi mapping was done but it didn't work -- out that well (at least not on windows) but I got the picture. As I have somewhat --- different demands I simplified / redid the ffi bti and just took the swiglib +-- different demands I simplified / redid the ffi bit and just took the swiglib -- variant and adapted that. local tonumber = tonumber @@ -33,6 +33,9 @@ ffi.cdef [[ a query. The rest is handled already in the Lua code elsewhere. */ + void free(void*ptr); + void * malloc(size_t size); + typedef void MYSQL_instance; typedef void MYSQL_result; typedef char **MYSQL_row; @@ -188,7 +191,10 @@ local ffi_tostring = ffi.string local ffi_gc = ffi.gc ----- mysqldata = ffi.cast("MYSQL_instance*",mysql.malloc(1024*1024)) -local instance = mysql.mysql_init(nil) -- (mysqldata) +-- local instance = mysql.mysql_init(nil) -- (mysqldata) + +local instance = ffi.cast("MYSQL_instance*",mysql.malloc(1024*1024)) +local success = mysql.mysql_init(mysqldata) local mysql_constant_false = false local mysql_constant_true = true diff --git a/tex/context/interface/mkiv/i-context.pdf b/tex/context/interface/mkiv/i-context.pdf Binary files differindex b1ac585f5..08d8e9499 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 5b8acf1ca..5ac2cb7ab 100644 --- a/tex/context/interface/mkiv/i-readme.pdf +++ b/tex/context/interface/mkiv/i-readme.pdf diff --git a/tex/context/modules/mkiv/s-youless.mkiv b/tex/context/modules/mkiv/s-youless.mkiv index 662025484..e218e6110 100644 --- a/tex/context/modules/mkiv/s-youless.mkiv +++ b/tex/context/modules/mkiv/s-youless.mkiv @@ -33,7 +33,26 @@ moduledata.youless = { } - local function process(specification) + local defaults = { + electricity = { + unit = "watt", + maxunit = "maxwatt", + }, + watt = { + unit = "watt", + maxunit = "maxwatt", + }, + pulse = { + unit = "watt", + maxunit = "maxwatt", + }, + gas = { + unit = "liters", + maxunit = "maxliters", + }, + } + + local function process(specification,thevariant) local data, message = utilities.youless.analyze(specification.filename or "youless-electricity.lua") @@ -42,13 +61,32 @@ return end - local year = tonumber(specification.year) or os.today().year - local month = tonumber(specification.month) - local years = data.years local variant = data.variant local unit = specification.unit local maxunit = specification.maxunit + if thevariant then + if variant ~= thevariant then + context("invalid variant") + return + end + elseif variant then + local d = defaults[variant] + if d then + unit = d.unit + maxunit = d.maxunit + else + context("unknown variant") + return + end + else + context("invalid variant") + return + end + + local year = tonumber(specification.year) or os.today().year + local month = tonumber(specification.month) + local years = data.years local max = specification[maxunit] if not max then @@ -171,7 +209,7 @@ function moduledata.youless.electricity(specification) specification.unit = "watt" specification.maxunit = "maxwatt" - process(specification) + process(specification,"electricity") end moduledata.youless.watt = moduledata.youless.electricity @@ -179,12 +217,16 @@ function moduledata.youless.gas(specification) specification.unit = "liters" specification.maxunit = "maxliters" - process(specification) + process(specification,"gas") end function moduledata.youless.pulse(specification) specification.unit = "watt" specification.maxunit = "maxwatt" + process(specification,"pulse") + end + + function moduledata.youless.graphics(specification) process(specification) end diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 4776e2cb0..23153ec46 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 : 08/19/18 12:52:28 +-- merge date : 08/20/18 17:47:01 do -- begin closure to overcome local limits and interference |