From: Renier M. <re...@us...> - 2006-07-06 16:01:30
|
Hello, Having trouble figuring out how to map a C struct, which has an array of structs as a member, to Python. I have this C struct, EntityPath, which I want to convert over to Python: struct Entity { unsigned int type; unsigned int location; }; struct EntityPath { Entity entry[16]; }; I know I could represent the "entry" member as a list of tuples (e.g. [(<type1>,<location1>),(<type2>,<location2>),...]) by using typemaps so that I can access it using "entitypath.entry[n][m]". However, what I would prefer is to access the struct members like this: entitypath = EntityPath() # Swig makes this works already entitypath.entry[3].type # This is what I want. If this is possible, can someone give me a pointer? I suppose you would use typemaps for this also, but not quite sure how to. Saludos, --Renier Renier Morales OpenHPI Team http://openhpi.sf.net IBM Linux Technology Center T/L: 349-8774 Toll free: (877) 403-3948 |