Re: Phix: c-struct

new topic     » goto parent     » topic index » view thread      » older message » newer message
petelomax said...

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?

Thanks for the prompt reply. It's good to see that Phix is still being actively developed.

Of course, I can only speak for myself. Naturally, I would prefer dot notation. But since I haven't really used c-struct, I won't miss it. These things are for code that you write once and then it disappears into an include file that you hopefully never have to look at again.

By the way, I've only been using Phix since version 1.02 or 1.03 for more than just testing.

So it's okay for me.

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu