Re: Structures and eraier Windows graphics

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

Jeff Fielding wrote:

> My problem is that in struct.e, I need to know how to poke shorys,
> ints,
> and longs, and chars into memory. I need to know the format. If anyone
> has
> any ideas, please tell me and I'll post my files on the Offical
> Euphoria
> Programming Page.

Ints have to be converted to 4 bytes/atom values between 0 en 255
Longs have to be converted to 8 bytes/atom values between 0 en 255
Chars have to be converted to 1 byte. (so just poke it in)

To convert an atom to 4-bytes:
    poke(addres, {a, a/2^8, a/2^16, a/2^24})

2^8 means 2 to the power of 8.
See the logic ??
BTW for poking an atom as an 4-byte machine integer, you can use some
inbuilt routine called poke4 or something.
It is a new routine for Euphoria 2. It is a lot faster (i suppose)

BTW 2 you needed to convert anything to poke a char, it is automatically
done...
    poke (addres, char)
works, just as
    poke (addres, "ralf")
works fine..

Euphoria converts stuff being poked to memory to an byte/char as
default.

Ralf N.
nieuwen at xs4all.nl

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

Search



Quick Links

User menu

Not signed in.

Misc Menu