[fpc-pascal] Re: How to create this "union" ?

ik idokan at gmail.com
Mon Dec 26 19:12:44 CET 2011


Better redefining my problem:

I have a first union. But on records we do not end case with "end". and
beneath the union, I have to place another union, or another fields that is
not part of the union.
How can I do that ?

Thanks,
Ido

On Mon, Dec 26, 2011 at 16:41, ik <idokan at gmail.com> wrote:

> Hello,
>
> I'm trying to translate the following to Pascal:
> ------------
> struct xt_option_call {
>     const char *arg, *ext_name;
>     const struct xt_option_entry *entry;
>     void *data;
>     unsigned int xflags;
>     bool invert;
>     uint8_t nvals;
>     union {
>         uint8_t u8, u8_range[2], syslog_level, protocol;
>         uint16_t u16, u16_range[2], port, port_range[2];
>         uint32_t u32, u32_range[2];
>         uint64_t u64, u64_range[2];
>         double dbl;
>         struct {
>             union nf_inet_addr haddr, hmask;
>             uint8_t hlen;
>         };
>         struct {
>             uint8_t tos_value, tos_mask;
>         };
>         struct {
>             uint32_t mark, mask;
>         };
>         uint8_t ethermac[6];
>     } val;
>     /* Wished for a world where the ones below were gone: */
>     union {
>         struct xt_entry_match **match;
>         struct xt_entry_target **target;
>     };
>     void *xt_entry;
>     void *udata;
> };
>
> ------
> h2pas does not capable of translating it, and I'm not sure that I know to
> make the "case" statement that will be equivalent for this complex union.
> How can I translate it ?
>
> Thanks,
> Ido
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20111226/cc6d2063/attachment.html>


More information about the fpc-pascal mailing list