1. C structure

------=_NextPart_8960c1d6_dcf8_468e_ad82_022a604a507f

Hello,
=20
how to convert this C structure into Euphoria ?
This structure is used for termination table,
in =2Edll for dialogic boards (for telecom=2E apps)
=20
Function in this dll need a pointer where is this
table structure allocated=2E
=20
typedef struct DV_TPT {
      unsigned short   tp_type;             /* Flags describing this en=
try */
      unsigned short   tp_termno;           /* Termination Parameter nu=
mber */
      unsigned short   tp_length;           /* Length of terminator */
      unsigned short   tp_flags;            /* Parameter attribute flag=
 */
      unsigned short   tp_data;             /* Optional additional data=
 */
      unsigned short   rfu;                 /* Reserved                =
 */
      DV_TPT           *tp_nextp;           /* Pointer to next terminat=
ion
                                             * parameter if IO_LINK set=
 */
}DV_TPT;
=20
   tpt[0]=2Etp_type   =3D IO_CONT;
   tpt[0]=2Etp_termno =3D DX_MAXDTMF;       /* Maximum number of digits=
 */
   tpt[0]=2Etp_length =3D 4;                /* terminate on 4 digits */
   tpt[0]=2Etp_flags  =3D TF_MAXDTMF;       /* terminate if already in =
buf=2E */
   tpt[1]=2Etp_type   =3D IO_CONT;
   tpt[1]=2Etp_termno =3D DX_LCOFF;         /* LC off termination */
   tpt[1]=2Etp_length =3D 3;                /* Use 30 ms (10 ms resolut=
ion
                                         * timer) */
   tpt[1]=2Etp_flags  =3D TF_LCOFF|TF_10MS; /* level triggered, clear h=
istory,
                                         * 10 ms resolution */
   tpt[2]=2Etp_type   =3D IO_EOT;
   tpt[2]=2Etp_termno =3D DX_MAXTIME;       /* Function Time */
   tpt[2]=2Etp_length =3D 100;              /* 10 seconds (100 ms resol=
ution
                                         * timer) */
=20
   tpt[2]=2Etp_flags  =3D TF_MAXTIME;       /* Edge-triggered */
=20
=20
=20
I've used structs=2Ee
=20
constant DV_TPT =3D define_c_struct({
    {"tp_type", USHORT, 1},
    {"tp_termno", USHORT, 1},
    {"tp_length", USHORT, 1},
    {"tp_flags", USHORT, 1},
    {"tp_data", USHORT, 1},
    {"rfu", USHORT, 1},
    {"tp_nextp", POINTER, 1}
 })
=20
 dv_tpt =3D alloc_struct(DV_TPT)
=20
poke_struct(dv_tpt,"tp_type",IO_CONT)
poke_struct(dv_tpt,"tp_termno",DX_MAXDTMF)
poke_struct(dv_tpt,"tp_length",1)
poke_struct(dv_tpt,"tp_flags",TF_MAXDTMF)
=20
=20
Is it good or not? Please help me=2E
=20
Bye Vlado
------=_NextPart_8960c1d6_dcf8_468e_ad82_022a604a507f
Content-type: text/html; charset=windows-1250
Content-Transfer-Encoding: quoted-printable

<html><div style=3D"font-family: tahoma, arial; font-size: 12px;">Hello=
,<BR>&nbsp;<BR>how to convert this C structure into Euphoria ?<BR>This =
structure is used for termination table,<BR>in =2Edll for dialogic boar=
ds (for telecom=2E apps)<BR>&nbsp;<BR>Function in this dll need a point=
er where is this<BR>table structure allocated=2E<BR>&nbsp;<BR>typedef s=
truct DV_TPT {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; unsigned short&nbsp;&n=
bsp; tp_type;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp; /* Flags describing this entry */<BR>&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp; unsigned short&nbsp;&nbsp; tp_termno;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* Termination Parameter number =
*/<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; unsigned short&nbsp;&nbsp; tp_leng=
th;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* Leng=
th of terminator */<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; unsigned short&nb=
sp;&nbsp; tp_flags;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp; /* Parameter attribute flag */<BR>&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp; unsigned short&nbsp;&nbsp; tp_data;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* Optional additional da=
ta */<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; unsigned short&nbsp;&nbsp; rfu;=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp; /* Reserved&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; */<BR>&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp; DV_TPT&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp; *tp_nextp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp; /* Pointer to next termination<BR>&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * parameter if IO_LINK set */<B=
R>}DV_TPT;<BR>&nbsp;<BR>&nbsp;&nbsp; tpt[0]=2Etp_type&nbsp;&nbsp; =3D I=
O_CONT;<BR>&nbsp;&nbsp; tpt[0]=2Etp_termno =3D DX_MAXDTMF;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp; /* Maximum number of digits */<BR>&nbsp;&nbsp; =
tpt[0]=2Etp_length =3D 4;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* terminate on 4 digits *=
/<BR>&nbsp;&nbsp; tpt[0]=2Etp_flags&nbsp; =3D TF_MAXDTMF;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp; /* terminate if already in buf=2E */<BR>&nbsp;&n=
bsp; tpt[1]=2Etp_type&nbsp;&nbsp; =3D IO_CONT;<BR>&nbsp;&nbsp; tpt[1]=2E=
tp_termno =3D DX_LCOFF;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
 /* LC off termination */<BR>&nbsp;&nbsp; tpt[1]=2Etp_length =3D 3;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp; /* Use 30 ms (10 ms resolution<BR>&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp; * timer) */<BR>&nbsp;&nbsp; tpt[1]=2Etp_flags&nbsp; =3D TF_LCOFF=
|TF_10MS; /* level triggered, clear history,<BR>&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp; * 10 ms resolution */<BR>&nbsp;&nbsp; tpt[2]=2Etp_type&nbsp;&nbsp;=
 =3D IO_EOT;<BR>&nbsp;&nbsp; tpt[2]=2Etp_termno =3D DX_MAXTIME;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp; /* Function Time */<BR>&nbsp;&nbsp; tpt[2]=
=2Etp_length =3D 100;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp; /* 10 seconds (100 ms resolution<BR>&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp; * timer) */<BR>&nbsp;<BR>&nbsp;&nbsp; tpt[2]=2Etp=
_flags&nbsp; =3D TF_MAXTIME;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* Edg=
e-triggered */<BR>&nbsp;<BR>&nbsp;<BR>&nbsp;<BR>I've used structs=2Ee<B=
R>&nbsp;<BR>constant DV_TPT =3D define_c_struct({<BR>&nbsp;&nbsp;&nbsp;=
 {"tp_type", USHORT, 1},<BR>&nbsp;&nbsp;&nbsp; {"tp_termno", USHORT, 1}=
,<BR>&nbsp;&nbsp;&nbsp; {"tp_length", USHORT, 1},<BR>&nbsp;&nbsp;&nbsp;=
 {"tp_flags", USHORT, 1},<BR>&nbsp;&nbsp;&nbsp; {"tp_data", USHORT, 1},=
<BR>&nbsp;&nbsp;&nbsp; {"rfu", USHORT, 1},<BR>&nbsp;&nbsp;&nbsp; {"tp_n=
extp", POINTER, 1}<BR>&nbsp;})<BR>&nbsp;<BR>&nbsp;dv_tpt =3D alloc_stru=
ct(DV_TPT)<BR>&nbsp;<BR>poke_struct(dv_tpt,"tp_type",IO_CONT)<BR>poke_s=
truct(dv_tpt,"tp_termno",DX_MAXDTMF)<BR>poke_struct(dv_tpt,"tp_length",=
1)<BR>poke_struct(dv_tpt,"tp_flags",TF_MAXDTMF)<BR>&nbsp;<BR>&nbsp;<BR>=
>
------=_NextPart_8960c1d6_dcf8_468e_ad82_022a604a507f--

new topic     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu