1. Re: C to Euphoria

> > How to convert these structures in Euphoria and will they
> > keep the same size as in C. For example structure IDNAME is
> > 162 bytes long Will it still be 162 bytes long in Euphoria?
>
> Euphoria does not have structures like C.
> Euphoria has atoms and sequences (only).

I know Euphoria does not have structures that is why I would like to know
what would be the equivalent of this in Euphoria Style.
 typedef struct {
        unsigned int no;
        char    n[4][32];
        char tel[16],fax[16];
 } IDNAME;

> The size of data in Euphoria is largely irrelevant since
> Euphoria is a high level language and does not define
> the way that atoms and sequences are laid out in memory.
> You can't get the address of a Euphoria variable.

What I mean is will it occupy the same amount of Disk Space. In memory I
dont realy care, but on Disk it matters since a whole data base is created
using the Structure of 162Bytes.

>
> Euphoria programs can call C functions via
> the Euphoria routines c_func() and c_proc().
> Euphoria can access memory using peek() and poke()
> and can allocate memory using allocate(). To access
> fields in a C structure you must get a pointer (address)
> to the structure, and then use peek() and poke(), or peek4u(),
> peek4s(), or poke4() to read/write the fields. You need to
> calculate the offsets of the fields you are interested in.
> Most fields are 4 bytes in size. Sometimes a structure
> will contain a gap so the next field will be better aligned.
>
> See one of the WIN32 example programs on the RDS Web site.
> Also read DOC\PLATFORM.DOC in the Euphoria .ZIP file.
>

Done that Been there

new topic     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu