structmemberalign: simplify API

This commit is contained in:
Thomas Desveaux 2018-04-10 20:10:49 +02:00
parent c92c58037b
commit 7d23654c16
3 changed files with 18 additions and 9 deletions

View File

@ -1244,7 +1244,7 @@
-- --
function suite.structMemberAlignment() function suite.structMemberAlignment()
structmemberalign "1Byte" structmemberalign(1)
prepare() prepare()
test.capture [[ test.capture [[
<ClCompile> <ClCompile>

View File

@ -1347,8 +1347,17 @@
end end
function m.structMemberAlignment(cfg) function m.structMemberAlignment(cfg)
if cfg.structmemberalign then local map = {
m.element("StructMemberAlignment", nil, cfg.structmemberalign) [1] = "1Byte",
[2] = "2Bytes",
[4] = "4Bytes",
[8] = "8Bytes",
[16] = "16Bytes"
}
local value = map[cfg.structmemberalign]
if value then
m.element("StructMemberAlignment", nil, value)
end end
end end

View File

@ -1339,13 +1339,13 @@
p.api.register { p.api.register {
name = "structmemberalign", name = "structmemberalign",
scope = "config", scope = "config",
kind = "string", kind = "integer",
allowed = { allowed = {
"1Byte", "1",
"2Bytes", "2",
"4Bytes", "4",
"8Bytes", "8",
"16Bytes", "16",
} }
} }