<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
</head>
<body text="#000000" bgcolor="#FFFFFF">
Hi, I need help.<br>
<div class="moz-forward-container"> <br>
I want to create a python script that will store the value of the
structure <i>MainStruct</i> from the c file.<br>
Suppose my c file looks like this:<br>
----------------------------------------------------------<br>
#define max (3)<br>
<br>
typedef struct A<br>
{<br>
int a; <br>
char b;<br>
}A;<br>
<br>
typedef struct MainStruct<br>
{<br>
A var1;<br>
int var2;<br>
int var3[max];<br>
}Main;<br>
<br>
void generate()<br>
{<br>
MainStruct myMain = {0};<br>
myMain.var1.a = 1<br>
myMain.var1.b = 'a'<br>
myMain.var2 = 3<br>
myMain.var3[0] = -3<br>
myMain.var3[1] = 6<br>
myMain.var3[2] = 18<br>
}<br>
-------------------------------------------------------------<br>
My python script accepts a c file as input.<br>
How can I get the values of the structure?<br>
Can I call the function generate() in python script, but it
doesn't have a return statement, how can I get the values by
calling the function?<br>
Help me, I'm really new in python.<br>
All I could think is just parse the c file. But it seems that it's
not a good idea.<br>
<br>
<br>
<br>
</div>
<br>
</body>
</html>