It's possible to do something like :
DeclareFunction(int,SetMinMaxForce,floa,maxforce,float,minforce)
{
....
}
which will generate :
Code: Select all
int SetMinMaxForce(float maxforce, float minforce);
ApiRegistrator( TYPE_INT, "SetMinMaxForce" &SetMaxForce, TYPE_FLOAT, "maxforce", TYPE_FLOAT, "minforce");
int SetMinMaxForce(float maxforce, float minforce);
{
....
}
But it won't work if you got comma in your types (like std::map<int,int>). So another one that is available is :
Code: Select all
DeclareFunction((int)(SetMinMaxForce)(float)(maxforce)(float)(minforce))
{
....
}
I already did one like this once.
But before you got further here are 2 other potential ways of doing it.
A/ use your own code parser/generator. In that case, what you proposed becomes completely doable, and more readable/maintainable.
B/ use boost to extract the function characteristics. So you just need to get the function name as input, and everything else can be generated. I think boost::function + boost::fusion should be able to do it well. Have a look at how ChaiScript works (in its c++ side, when you declare function), because I think it can do just that.