1. data structures in EU

The ref manual states that "the exact layout of a data structure does 
not have to be declared in advance". But can I do so if it serves my 
purpose?
I would like to declare a "record_layout" consisting of { 
"16_text_bytes", 4-byte_integer}. I will put a number into the first 
three bytes of the integer and do bit-fiddling with the 8 bits of the 
last byte. I would like to address the pieces individually and then move 
the structure as a whole (and vice-versa). I can see how to do this with 
offsets into a buffer allocated in RAM, but are there more direct 
methods provided by Euphoria?

Allen

new topic     » topic index » view message » categorize

2. Re: data structures in EU

While showering, I realized that an embarrassingly easy solution to my 
data structure question is to define a function which takes the data 
elements and concatenates them into the required sequence for the record 
definition. A similar function would accept the record sequence and pars 
it into the required fields.
I see how I can do the bit-fiddling by using bits_to_int and int_to_bits 
in the functions mentioned above. Are there better ways?

Allen

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu