Re: Phix: c-struct

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

It's good to see that Phix is still being actively developed.

Sometimes I wonder why I bother, then I have a week like I've just had and I realise it's because I enjoy it!
I've been struggling with a new GUI, and finally bit the bullet at the end of November, threw 0.1 in the bin
and started a brand new 0.2: two months of hard slog with not much to show, then it suddenly burst into life.
Several days nailing down a few things and a tough time ironing out all the bugs in the new layout manager,
then this week everything I touch is just turning to gold smile

andreasWagner said...

Naturally, I would prefer dot notation.

Me too, but a) I can't justify it, and b) what the language really deserves, and even I would use, is summat like:

#ilSTRUCT(""" 
typedef struct RECT {  
  LONG left;  
  LONG top;  
  LONG right;  
  LONG bottom;  
}""") // (so the inline assembler now understands what a RECT is, at compile-time [only]) 
#ilASM { 
  mov ecx, RECT.length 
  call :%pGetPool        // aka eax := allocate(sizeof(RECT)) 
  pragma struct RECT eax // an assembly directive, aka "eax is a *RECT" 
  mov [eax.left], 10 
  mov [eax.top], 10 
  mov [eax.right], 350 
  mov [eax.bottom], 200 
  pragma struct none eax // switch off the special eax dot handling 
} 
Which emits the perfect super-fast machine code to do these things. One day, maybe, but probably not soon.
To clarify: hll code using dot notation calling generic code in builtins/structs.e is daft compared to asm.
The #ilASM would just treat mov [eax.top], 10 as if it said mov dword[eax+4], 10 ie automate size/offset.

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

Search



Quick Links

User menu

Not signed in.

Misc Menu