Skip to content

Commit

Permalink
Merge pull request #5 from jphickey/fix-4-cmdcode-values
Browse files Browse the repository at this point in the history
Fix #4, incorrect cmdcode macro values
  • Loading branch information
jphickey authored Jun 11, 2021
2 parents 2cfcb26 + 3b0b365 commit ee3f7dd
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions cfecfs/missionlib/eds/75-cfe_sb_dispatch_tables.lua
Original file line number Diff line number Diff line change
Expand Up @@ -200,10 +200,19 @@ for ds in SEDS.root:iterate_children(SEDS.basenode_filter) do
intf_commands[reqintf] = intfcmds
for _,cmd in ipairs(intfcmds) do
if (cmd.subcommand_arg) then
for i,subcommand in ipairs(cmd.args[cmd.subcommand_arg].type.edslib_derivtable_list) do
local argtype = cmd.args[cmd.subcommand_arg].type
for _,subcommand in ipairs(argtype.edslib_derivtable_list) do
-- Note that this list is not in value-order, the index relates to the lookup table, not the actual cmdcode value
-- To get the command code value, need to drill down into the constraint set. This assumes a single value constraint.
local cmdname = subcommand:get_flattened_name()
hdrout:add_documentation(string.format("Command code associated with %s_t", cmdname))
hdrout:write(string.format("#define %-60s %s", SEDS.to_macro_name(cmdname) .. "_CC", i-1))
local constraint = subcommand:find_first("CONSTRAINT_SET")
if (constraint) then
constraint = constraint:find_first("VALUE_CONSTRAINT")
end
if (constraint) then
hdrout:add_documentation(string.format("Command code associated with %s_t", cmdname))
hdrout:write(string.format("#define %-60s %s", SEDS.to_macro_name(cmdname) .. "_CC", constraint.attributes["value"]))
end
end
end
end
Expand Down Expand Up @@ -482,4 +491,3 @@ dbout:end_group("};")
dbout:add_whitespace(1)

SEDS.output_close(dbout)

0 comments on commit ee3f7dd

Please sign in to comment.