Tools: Fix param code generation to generate correct union access based on type. Generate #error C-code for unknown types to prevent silent failure.

This commit is contained in:
Lorenz Meier 2015-09-14 00:16:49 +02:00
parent 97802999e8
commit e6cbee74bf
1 changed files with 7 additions and 2 deletions

View File

@ -71,14 +71,19 @@ for group in root:
if not start_name:
start_name = param.attrib["name"]
end_name = param.attrib["name"]
val_str = "#error UNKNOWN PARAM TYPE, FIX px_generate_params.py"
if (param.attrib["type"] == "FLOAT"):
val_str = ".val.f = "
elif (param.attrib["type"] == "INT32"):
val_str = ".val.i = "
i+=1
src += """
{
"%s",
PARAM_TYPE_%s,
.val.f = %s
%s%s
},
""" % (param.attrib["name"], param.attrib["type"], param.attrib["default"])
""" % (param.attrib["name"], param.attrib["type"], val_str, param.attrib["default"])
src += """
%d
};