diff --git a/initializer.h b/initializer.h index d156e589..dcd3820c 100644 --- a/initializer.h +++ b/initializer.h @@ -13,21 +13,51 @@ Markus Zolliker, March 2005 typedef void (*Initializer)(void); void MakeInitializer(const char *type, const char *name, Initializer maker, int startupOnly); +/* + install an initializer + + type: the type of the initializer + name: the name of the initalizer + maker: an initalizer function. The prototype does normally not match, + a cast (Initializer) is needed on the call. But: all initializers + with the same type must have the same prototype. + startupOnly: put 1, if the initializer should only be available during + startup +*/ Initializer GetInitializer(const char *type, const char *name); +/* + Get back an initializer with given type and name. + The result must be casted to the proper prototype for the given + type. +*/ +static int MakeObject(SConnection *con, SicsInterp *sics, + void *data, int argc, char *argv[]); /* MakeObject has the following syntax: MakeObject objectName driver [ args ... ] + + It executes the initializer with the type "Object" and and the + driver given as name. The found initalizer should use the given arguments + to create a driver. */ + typedef int (*CmdInitializer) (SConnection *pCon, int argc, char *argv[], int dynamic); -/* - make a driver with the initializer function maker - when the dynamic argument is not 0, the command was created after startup, - i.e. the SaveStatus routine has also to write command creation code. +/* + The initalizer prototype for the type "Object". + - pCon: the sics connection calling this initializer + - argc: the total number of args + - argv: the args (argv[0]: "MakeObject", argv[1]: object name, argv[3]: driver ...) + - dynamic: the initializer was called _after_ startup */ + void MakeDriver(const char *driver, CmdInitializer maker, int startupOnly); +/* + Install a driver of type "Object" with the initializer function maker. + - startupOnly: the driver creation should only be possible at startup +*/ #endif