(sorry for the delay, this message slept in my outbox)
Tim Hochberg wrote:
> Is there any reason that this can't be done in the same way as pint_add. For
> static vinfo_t* pfloat_add(PsycoObject* po, vinfo_t* v, vinfo_t* w)
> Where CONVERT_TO_DOUBLE would start out as:
This is perfect.
> Eventually it would get extended as we allowed integers and other types to
> be converted to floats.
Yes. For (short) integers this is easily done by using
PsycoInt_AS_LONG(). For long integers you will need to define in
plongobject.h a function PsycoLong_AsDouble(), implemented in
plongobject.c (a dummy implementation just like PsycoLong_AsLong() is
> psyfs_float would have to be defined in pobject.c
> and presumably entered into some array of fixed_switch values somewhere, but
> I haven't got that far yet.
Yes, exactly. The definition is done in pobject.h, where the array is
filled with (one) value in psy_object_init(). To recognize int-to-float
conversions, you will need a 'psyfs_int_long_float' array instead of
> Is this a reasonable way to approach this if my goal is to first get
> float-float operations working and then to branch out from there, or am I
> way off target here....
No, it is all right. I think it is a very good way to start learning how
Psyco works by translating the code of the Python interpreter into the