From 8fc3039c82d48605b5ca8b2eda3f4fdd755681e1 Mon Sep 17 00:00:00 2001 From: Taco Hoekwater Date: Sun, 23 Aug 2009 11:11:32 +0000 Subject: this is context 2009.08.19 17:10 git-svn-id: svn://tug.org/texlive/trunk@14827 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/tex/context/base/mult-chk.lua | 66 +++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 Master/texmf-dist/tex/context/base/mult-chk.lua (limited to 'Master/texmf-dist/tex/context/base/mult-chk.lua') diff --git a/Master/texmf-dist/tex/context/base/mult-chk.lua b/Master/texmf-dist/tex/context/base/mult-chk.lua new file mode 100644 index 00000000000..2c1ab3c78aa --- /dev/null +++ b/Master/texmf-dist/tex/context/base/mult-chk.lua @@ -0,0 +1,66 @@ +if not modules then modules = { } end modules ['mult-chk'] = { + version = 1.001, + comment = "companion to mult-chk.tex", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +local format = string.format +local type = type +local texsprint = tex.sprint +local ctxcatcodes = tex.ctxcatcodes + +interfaces = interfaces or { } + +interfaces.syntax = { + test = { keys = table.tohash { "a","b","c","d","e","f","g" } } +} + +function interfaces.invalidkey(kind,key) + commands.writestatus("syntax","invalid key '%s' for '%s' in line %s",key,kind,tex.inputlineno) +end + +function interfaces.setvalidkeys(kind,list) + local s = interfaces.syntax[kind] + if not s then + interfaces.syntax[kind] = { + keys = aux.settings_to_set(list) + } + else + s.keys = aux.settings_to_set(list) + end +end + +function interfaces.addvalidkeys(kind,list) + local s = interfaces.syntax[kind] + if not s then + interfaces.syntax[kind] = { + keys = aux.settings_to_set(list) + } + else + aux.settings_to_set(list,s.keys) + end +end + +local prefix, kind, keys + +local function set(key,value) + if keys and not keys[key] then + interfaces.invalidkey(kind,key) + else + texsprint(ctxcatcodes,format("\\setsomevalue{%s}{%s}{%s}",prefix,key,value)) + end +end + +local pattern = aux.make_settings_to_hash_pattern(set,"tolerant") + +function commands.getcheckedparameters(k,p,s) + if s and s ~= "" then + prefix, kind = p, k + keys = k and k ~= "" and interfaces.syntax[k].keys + pattern:match(s) + end +end + +_gcp_ = commands.getcheckedparameters -- cgit v1.2.3