Author: bdonlan Date: 2004-12-31 20:53:09 -0500 (Fri, 31 Dec 2004) New Revision: 493
Added: trunk/clients/havercurs/cmdline.h Modified: trunk/ Log: [EMAIL PROTECTED]: bdonlan | 2005-01-01T01:48:47.010919Z Add command line procesing header Property changes on: trunk ___________________________________________________________________ Name: svk:merge - 1f59643a-e6e5-0310-bc24-f7d4c744f460:/haver/local/trunk:10252 27e50396-46e3-0310-8b22-ae223a1f35ce:/local:212 edfcd8bd-4ce7-0310-a97e-bb1efd40edf3:/local:238 + 1f59643a-e6e5-0310-bc24-f7d4c744f460:/haver/local/trunk:10255 27e50396-46e3-0310-8b22-ae223a1f35ce:/local:212 edfcd8bd-4ce7-0310-a97e-bb1efd40edf3:/local:238 Added: trunk/clients/havercurs/cmdline.h =================================================================== --- trunk/clients/havercurs/cmdline.h 2004-12-31 05:02:05 UTC (rev 492) +++ trunk/clients/havercurs/cmdline.h 2005-01-01 01:53:09 UTC (rev 493) @@ -0,0 +1,93 @@ +/* vim: set ts=4 sw=4 expandtab si ai sta tw=104: */ + +#ifndef CMDLINE_H +#define CMDLINE_H 1 + +/* cmdline.h + * Functions for processing and dispatching commands. + */ + +/** cmdline_callback + * + * Function type for command line dispatching. + * + * Arguments: + * void *baton - external value passed to cmdline_register() + * const char *cmdline - pointer to full command line + */ +typedef void cmdline_callback(void *baton, const char *cmdline); + +/** cmdline_init() + * + * Initializes the module. Must be called before any other functions in this header. + */ +void cmdline_init(void); + +/** cmdline_free() + * + * De-initializes the module. cmdline_init() must be called again after calling this, + * before any other functions from this header are called + */ +void cmdline_free(void); + +/** cmdline_register() + * + * Registers a command handler. + * + * Arguments: + * const char *command - name of the command + * cmdline_callback *cb - callback to call when command is invoked + * void *baton - value to pass to the callback's baton argument + * + * Return value: + * Previous handler or NULL if none + */ +cmdline_callback *cmdline_register( + const char *command, + cmdline_callback *cb, + void *baton + ); + +/** cmdline_unregister() + * + * Unregisters a command handler + * + * Arguments: + * const char *command - name of the command + * + * Return value: + * Previous handler or NULL if none + */ +cmdline_callback *cmdline_unregister(const char *command); + +/** cmdline_lookup() + * + * Obtains the handler for a given command + * + * Arguments: + * const char *command - name of the command + * void **baton - pointer to location to place the baton value, or NULL + * to discard + * + * Return value: + * Handler callback, or NULL if none + */ +cmdline_callback *cmdline_lookup( + const char *command, + void **baton + ); + +/** cmdline_process() + * + * Dispatches a command to its handler, if any. + * + * Arguments: + * const char *cmdline - full command line to process + * + * Return value: + * 1 if command was successfully processed + * 0 if no handler was found + */ +int cmdline_process(const char *cmdline); + +#endif Property changes on: trunk/clients/havercurs/cmdline.h ___________________________________________________________________ Name: svn:eol-style + native
