From 0cf31f98acd6d84c17fe47569a1022f28d09a7a9 Mon Sep 17 00:00:00 2001 From: Ted Trask Date: Thu, 6 Dec 2012 14:08:24 +0000 Subject: Interfaces: Added support for unknown options in a separate cfe The previous implementation would display them as separate options with errors, and silently drop when writing --- interfaces-model.lua | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'interfaces-model.lua') diff --git a/interfaces-model.lua b/interfaces-model.lua index 1e86b8c..c955937 100644 --- a/interfaces-model.lua +++ b/interfaces-model.lua @@ -78,7 +78,7 @@ local expandentry = function (self, prefix) local strings = {} for line in string.gmatch(self, "(.-)\n") do if #line > 0 then - strings[#strings+1] = prefix .. " " .. line + strings[#strings+1] = prefix .. line end end return table.concat(strings, "\n") @@ -122,10 +122,10 @@ local unpack_interfaces = function () comment = "" end if not (interface[param]) then - interface[param] = cfe({label=param, errtxt = "Unknown parameter"}) + interface.other.value = appendentry(interface.other.value, param.." "..val) + else + interface[param].value = appendentry(interface[param].value, val) end - interface[param].value = - appendentry(interface[param].value, val) end end end @@ -146,14 +146,14 @@ local commit_interfaces = function() local required = {} for name,value in pairs(iface.required) do -- Check for the ones handled by other means - if name~="comment" and name~="name" and name~="family" and name~="method" and name~="auto" then + if name~="comment" and name~="name" and name~="family" and name~="method" and name~="auto" and name~="other" then required[name] = true end end for n,int in ipairs(array) do local me = int.value if me.comment.value ~= "" then - strings[#strings+1] = expandentry(me.comment.value, "#") + strings[#strings+1] = expandentry(me.comment.value, "# ") end if me.auto.value then strings[#strings+1] = "auto " .. me.name.value @@ -163,9 +163,12 @@ local commit_interfaces = function() local optional = get_options(me.family.value, me.method.value) for name,entry in pairs(me) do if (required[name] or optional[name]) and entry.value ~= "" then - strings[#strings+1] = expandentry(entry.value, "\t"..name) + strings[#strings+1] = expandentry(entry.value, "\t"..name.." ") end end + if me.other.value ~= "" then + strings[#strings+1] = expandentry(me.other.value, "\t") + end strings[#strings+1] = "" end -- cgit v1.2.3