When calling a method on an object of a built-in type (but nothing else at this point, unfortunately), we should set the top level int hoc_return_type_code to 0.... if when the method returns the value is 2, the double that's returned should be treated as a logical... if the value is 1, then it should be an integer... otherwise it should be treated as a double.
How do we know if it's a built-in class? That's easy, we check the object's ctemplate->id. If it's less-than or equal to the top-level hoc_max_builtin_class_id (which is also an int), then the class is of a built-in type and the hoc_return_type_code should be meaningful... if not, we treat everything as doubles.
(It's a little messy, because the underlying stack machine has no concept of booleans or integers as returnable entities, so this work-around was added to allow Python to receive meaningful types.)
When calling a method on an object of a built-in type (but nothing else at this point, unfortunately), we should set the top level
int hoc_return_type_code
to0
.... if when the method returns the value is2
, the double that's returned should be treated as a logical... if the value is1
, then it should be an integer... otherwise it should be treated as a double.How do we know if it's a built-in class? That's easy, we check the object's
ctemplate->id
. If it's less-than or equal to the top-levelhoc_max_builtin_class_id
(which is also an int), then the class is of a built-in type and thehoc_return_type_code
should be meaningful... if not, we treat everything as doubles.(It's a little messy, because the underlying stack machine has no concept of booleans or integers as returnable entities, so this work-around was added to allow Python to receive meaningful types.)