Re: Passing a packed C structure to a c module

2006-04-14 Thread Philippe Martin
I'll take a look, thanks. Jay Parlar wrote: > > On Apr 14, 2006, at 9:44 AM, Philippe Martin wrote: > >> Thanks, >> >> It's a pretty big structure: painfull to pass each item as a param. >> >> Regards, >> >> Philippe >> > > Maybe this can do something for you? > > http://pyconstruct.source

Re: Passing a packed C structure to a c module

2006-04-14 Thread Philippe Martin
I misslead you: it is a smart card-style ioctl ... Philippe "Martin v. Löwis" wrote: > Philippe Martin wrote: >> The call actually is an IOCtl: depending on the control code, the >> structure has a different format. > > Ah. In that case, I recommend to use the ioctl module; you won't need a >

Re: Passing a packed C structure to a c module

2006-04-14 Thread Martin v. Löwis
Philippe Martin wrote: > The call actually is an IOCtl: depending on the control code, the structure > has a different format. Ah. In that case, I recommend to use the ioctl module; you won't need a C wrapper, then. > Although the number of control codes/structures is finite, it would make the >

Re: Passing a packed C structure to a c module

2006-04-14 Thread Jay Parlar
On Apr 14, 2006, at 9:44 AM, Philippe Martin wrote: > Thanks, > > It's a pretty big structure: painfull to pass each item as a param. > > Regards, > > Philippe > Maybe this can do something for you? http://pyconstruct.sourceforge.net/ Jay P. -- http://mail.python.org/mailman/listinfo/python

Re: Passing a packed C structure to a c module

2006-04-14 Thread Philippe Martin
Well, The call actually is an IOCtl: depending on the control code, the structure has a different format. Although the number of control codes/structures is finite, it would make the wrapper function fairly large. You seem to think that building the structure from python would be a mistake: why

Re: Passing a packed C structure to a c module

2006-04-14 Thread Martin v. Löwis
Philippe Martin wrote: > It's a pretty big structure: painfull to pass each item as a param. So how else would you like to pass them? Define the API you want, and then just implement it. It still shouldn't require to define the layout in Python. Regards, Martin -- http://mail.python.org/mailman/

Re: Passing a packed C structure to a c module

2006-04-14 Thread Philippe Martin
Thanks, It's a pretty big structure: painfull to pass each item as a param. Regards, Philippe "Martin v. Löwis" wrote: > Philippe Martin wrote: >> Is it possible to define a packed C structure in python and pass it to >> the c module, or should the wrapper do that ? > > You can create a pack

Re: Passing a packed C structure to a c module

2006-04-14 Thread Martin v. Löwis
Philippe Martin wrote: > Is it possible to define a packed C structure in python and pass it to the c > module, or should the wrapper do that ? You can create a packed structure using string concatenation, and with the help of the struct module. However, this gives you a string object in the end,