do
# Collect all bas box class
# FIXME: this is not completely fine with a separate compilation scheme
- for classname in ["Int", "Bool", "Char", "Float", "NativeString", "Pointer"] do
+ for classname in ["Int", "Bool", "Byte", "Char", "Float", "NativeString", "Pointer"] do
var classes = self.mainmodule.model.get_mclasses_by_name(classname)
if classes == null then continue
assert classes.length == 1 else print classes.join(", ")
end
v.add_decl("\},")
else
- v.add_decl("0, \{\}, /*DEAD TYPE*/")
+ # Use -1 to indicate dead type, the info is used by --hardening
+ v.add_decl("-1, \{\}, /*DEAD TYPE*/")
end
v.add_decl("\};")
end
v.add("if({t} == NULL) \{")
v.add_abort("type null")
v.add("\}")
- v.add("if({t}->table_size == 0) \{")
+ v.add("if({t}->table_size < 0) \{")
v.add("PRINT_ERROR(\"Insantiation of a dead type: %s\\n\", {t}->name);")
v.add_abort("type dead")
v.add("\}")
if mtype.name == "Int" then
return self.new_expr("(long)({value})>>2", mtype)
else if mtype.name == "Char" then
- return self.new_expr("(char)((long)({value})>>2)", mtype)
+ return self.new_expr("(uint32_t)((long)({value})>>2)", mtype)
else if mtype.name == "Bool" then
return self.new_expr("(short int)((long)({value})>>2)", mtype)
else