typedef union

"Nils Wagner" <[email protected]>
Newsgroups gmane.comp.python.ctypes
Message-ID <[email protected]>
Hi all,

I am newbie to ctypes.

How can I "translate" the following C-code into Python ?
I don't know how to handle HEAD and memcpy ?
Any pointer would be appreciated.

Thanks in advance.

Nils


       typedef union {
int i;
float f;
char c[4];
} Word;

       int 
I,J,K,N,IDE,IA,IE,IERR,JUNIT,JUNCAT,NDATA,NREC,LREADY,ONE=1;
       Word BUF[100],HEAD[30];

       for (I=5;I<LHEAD;I++)
HEAD[I].i = 0;
       HEAD[ 0].i = 1;
       HEAD[ 1].i = LHEAD + NDATA*7;
       HEAD[ 2].i = LHEAD;
       HEAD[ 3].i = NDATA;
       HEAD[ 4].i = 7;
       memcpy (HEAD[ 7].c,"DSIO",4);
       memcpy (HEAD[ 8].c,"TEST",4);
       memcpy (HEAD[ 9].c,"NPCO",4);
       memcpy (HEAD[10].c," ",4);
       memcpy (HEAD[11].c,"DSIO",4);
       HEAD[20].i = 1;
       HEAD[21].i = NDATA;
       STRING = "MM RAD";
       DSEINH(STRING,&HEAD[24].i,&ONE,
strlen(STRING));

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.