diff options
author | Taco Hoekwater <taco@elvenkind.com> | 2011-06-01 08:54:21 +0000 |
---|---|---|
committer | Taco Hoekwater <taco@elvenkind.com> | 2011-06-01 08:54:21 +0000 |
commit | d7ccb42582f85acf30568913610ccf4d602023fb (patch) | |
tree | 7292e3545a420676878e7451b68892d360c62cb6 /Master/texmf-dist/tex/context/base/mult-chk.lua | |
parent | 2d62a6fe9b80def59c392268022f1f9a2d6e358f (diff) |
commit context 2011.05.18
git-svn-id: svn://tug.org/texlive/trunk@22719 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/context/base/mult-chk.lua')
-rw-r--r-- | Master/texmf-dist/tex/context/base/mult-chk.lua | 47 |
1 files changed, 27 insertions, 20 deletions
diff --git a/Master/texmf-dist/tex/context/base/mult-chk.lua b/Master/texmf-dist/tex/context/base/mult-chk.lua index bdbd1dd22f9..4b1ba12ee3e 100644 --- a/Master/texmf-dist/tex/context/base/mult-chk.lua +++ b/Master/texmf-dist/tex/context/base/mult-chk.lua @@ -10,57 +10,64 @@ local format = string.format local lpegmatch = lpeg.match local type = type local texsprint, ctxcatcodes = tex.sprint, tex.ctxcatcodes +local make_settings_to_hash_pattern, settings_to_set = utilities.parsers.make_settings_to_hash_pattern, utilities.parsers.settings_to_set + +local allocate = utilities.storage.allocate + +local report_interface = logs.reporter("interface","checking") interfaces = interfaces or { } -interfaces.syntax = { +interfaces.syntax = allocate { 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) +function interfaces.invalidkey(category,key) + report_interface("invalid key '%s' for '%s' in line %s",key,category,tex.inputlineno) end -function interfaces.setvalidkeys(kind,list) - local s = interfaces.syntax[kind] +function interfaces.setvalidkeys(category,list) + local s = interfaces.syntax[category] if not s then - interfaces.syntax[kind] = { - keys = aux.settings_to_set(list) + interfaces.syntax[category] = { + keys = settings_to_set(list) } else - s.keys = aux.settings_to_set(list) + s.keys = settings_to_set(list) end end -function interfaces.addvalidkeys(kind,list) - local s = interfaces.syntax[kind] +function interfaces.addvalidkeys(category,list) + local s = interfaces.syntax[category] if not s then - interfaces.syntax[kind] = { - keys = aux.settings_to_set(list) + interfaces.syntax[category] = { + keys = settings_to_set(list) } else - aux.settings_to_set(list,s.keys) + settings_to_set(list,s.keys) end end -local prefix, kind, keys +-- weird code, looks incomplete ... probbably an experiment + +local prefix, category, keys local function set(key,value) if keys and not keys[key] then - interfaces.invalidkey(kind,key) + interfaces.invalidkey(category,key) else - texsprint(ctxcatcodes,format("\\setsomevalue{%s}{%s}{%s}",prefix,key,value)) + context.setsomevalue(prefix,key,value) end end -local pattern = aux.make_settings_to_hash_pattern(set,"tolerant") +local pattern = make_settings_to_hash_pattern(set,"tolerant") -function commands.getcheckedparameters(k,p,s) +function interfaces.getcheckedparameters(k,p,s) if s and s ~= "" then - prefix, kind = p, k + prefix, category = p, k keys = k and k ~= "" and interfaces.syntax[k].keys lpegmatch(pattern,s) end end -_gcp_ = commands.getcheckedparameters +-- _igcp_ = interfaces.getcheckedparameters |