L
lordkain
Hello all,
I have a problem which I cant seem to solve, I dont know if it is
solvable.. it should though.
What I want is to call a function, whith x arguments on base of an xml
file. In the xml file are the specification to call the function.
XML FILE
---------------
<function name="test">
<arg nr=1 type="string">hello world</arg>
<arg nr=2 type="int">5</arg>
<arg nr=3 type="long">123456</arg>
</function>
IMPLEMENTATION of the function test:
-------------------------------------------------------
void test(char * arg1, int arg2, long arg3);
Which should result in the function call
-----------------------------------------------------
test("hello world", 5, 123456);
So far i have some source-code to translate the xml to a structure, but
when i call the function i must translate the datatype explicite, this
is what i dont want to do..
void * arg[10] = {NULL}; // maximal 10 arguments
char * arg1 = "hello world";
int arg1 = 5;
long arg1 = 123456;
arg[1] = a1;
arg[2] = &a2;
arg[3] = &a3;
// here i translate the datatype from the arg array to its datatype, i
dont really want this. i want to automaticly castsing here of some
sort..
test( (char *) arg[1],
*((int *)arg[2]),
*((long *)arg[3])
);
Cheerz, David
I have a problem which I cant seem to solve, I dont know if it is
solvable.. it should though.
What I want is to call a function, whith x arguments on base of an xml
file. In the xml file are the specification to call the function.
XML FILE
---------------
<function name="test">
<arg nr=1 type="string">hello world</arg>
<arg nr=2 type="int">5</arg>
<arg nr=3 type="long">123456</arg>
</function>
IMPLEMENTATION of the function test:
-------------------------------------------------------
void test(char * arg1, int arg2, long arg3);
Which should result in the function call
-----------------------------------------------------
test("hello world", 5, 123456);
So far i have some source-code to translate the xml to a structure, but
when i call the function i must translate the datatype explicite, this
is what i dont want to do..
void * arg[10] = {NULL}; // maximal 10 arguments
char * arg1 = "hello world";
int arg1 = 5;
long arg1 = 123456;
arg[1] = a1;
arg[2] = &a2;
arg[3] = &a3;
// here i translate the datatype from the arg array to its datatype, i
dont really want this. i want to automaticly castsing here of some
sort..
test( (char *) arg[1],
*((int *)arg[2]),
*((long *)arg[3])
);
Cheerz, David