Re: Phix: c-struct
- Posted by petelomax 2 weeks ago
- 210 views
Oh dear. That works fine in 0.8.2 but is broken in 1.0.1 and everything after...
Obviously no-one, including myself, has used c-structs in the last five years, so I'm inclined to just drop 'em.
Anyway, a c-struct was only ever meant to be a thin wrapper to the following, which still works fine.
include cffi.e constant idRECT = define_struct(""" typedef struct _RECT { LONG left; LONG top; LONG right; LONG bottom; } RECT, *PRECT;""") -- replaces 'q', could be named that: atom pRECT = allocate_struct(idRECT) -- The above is still equivalent to allocate, but with size auto-calculated, -- and the following are still equivalent to poke(), with offset&size "". set_struct_field(idRECT,pRECT,"left",10) set_struct_field(idRECT,pRECT,"top",10) set_struct_field(idRECT,pRECT,"right",350) set_struct_field(idRECT,pRECT,"bottom",200)
So unless anyone has any serious objections, I'm just going to delete all references to c-struct in the docs,
and clean up builtins/structs.e and pmain.e a bit, and leave it at that. You good with that?

