ITM 9.4 notes, in describing the way that attribute data for class objects is handled:
[(*) This is a change made in Inform 6.12. Previously, class objects
had the attributes which would be inherited from the class. 6.12 moves
this information to a harmless block of six bytes elsewhere, essentially
so that loops like "objectloop (x has animate)" do not pick up classes
as well as objects.]
Are those attribute data bytes still located within the story file somewhere after compilation? I know that each class declared with a particular number of instances, (e.g. Class Pebble(10)...
) will always have at least one prototype object for the class as a child, but I would want to get the attribute data for a class that does not have a prototype (e.g. Class Pebble...
).
It looks like the data is written out as part of compiler routine write_property_block_z()
:
// write attribute data of class objects in hidden location, as cited ITM 9.4
if (current_defn_is_class)
{ mark = write_properties_between(p,mark,3,3);
for (i=0;i<6;i++)
p[mark++] = full_object.atts[i];
class_begins_at[no_classes++] = mark;
}
mark = write_properties_between(p, mark, 1, (version_number==3)?31:63); // writes prop 3 again?
There’s something strange going on in the above, in that, after having made a special case for class objects when writing out the property data block for property ID 3, the code continues to write all property data. Per ITM 9.2:
Immediately following the common property values table for a class (which is bound
to be short, since it can only contain the short name and perhaps property 3)
is a six-byte block of attributes which would be inherited from the class (*)
which is the text to which the explanatory comment from the first post above is attached by asterisk. This makes it seem like property 3 is the only possible valid property ID for a class object, so it’s not clear why any other ID should be considered.
Is there a reason to write out the property block for ID 3 a second time, or is this just missing an else
?
Never mind, I got it. Had to go the long way around, but was able to find a guide in veneer code.