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()
structmemberalign "1Byte"
structmemberalign(1)
prepare()
test.capture [[
<ClCompile>

View File

@ -1347,8 +1347,17 @@
end
function m.structMemberAlignment(cfg)
if cfg.structmemberalign then
m.element("StructMemberAlignment", nil, cfg.structmemberalign)
local map = {
[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

View File

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