|Automatic type registering|
CliPP supports automatic registration of types. This means, that when you register eg. a function to CliPP, CliPP will parse the argument list of the function, and try to register these types to CliPP eg. by calling the static init function on the class if applicable.
int test(const point3& p1,double r,const vector3& v);//Register function function(c,"test",test);
In the above example, the following procedure is used when registering types:
Register return type:
int -> native type. Have no means to register this type. Ignore.
Register argument types:
point3 -> class type. Does it inherit from value? If so, call point3::init(c);
double -> native type. Have no means to register this type. Ignore.
vector3 -> class type. Does it inherit from value? If so, call vector3::init(c);
Of course, the system also checks if the types have been registered already. If so, no action is performed
Automatic type registering is performed in the following contexts:
This framework can be used to report programming errors, such as missing initialization of types. Since it checks all relevant types exposed to the scripting, it would be easy to generate a list of types that were not registered during initialization of the parser. This list could then be displayed to the programmer. Alas, this feature has not been implemented.
Copyright © 2003-2005 Peder Holt
Permission to copy, use, modify, sell and distribute this document is granted provided this copyright notice appears in all copies. This document is provided "as is" without express or implied warranty, and with no claim as to its suitability for any purpose.