diff options
author | Harry Jeffery <harry@exec64.co.uk> | 2019-08-21 20:16:43 +0100 |
---|---|---|
committer | Harry Jeffery <harry@exec64.co.uk> | 2019-08-21 20:16:43 +0100 |
commit | d2f5deb27816889cdc9b25e868557f0bcd23e163 (patch) | |
tree | b5709f59f5b5d0fe7c2735f01e79ffe5d6df2844 /src/commands.h | |
parent | cf7f3127cbde7354f1b592af0d23de4d7cd1123f (diff) | |
download | imv-d2f5deb27816889cdc9b25e868557f0bcd23e163.tar.gz |
Improve header commenting
Diffstat (limited to 'src/commands.h')
-rw-r--r-- | src/commands.h | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/src/commands.h b/src/commands.h index cf81f68..3bd7650 100644 --- a/src/commands.h +++ b/src/commands.h @@ -2,16 +2,29 @@ #define COMMANDS_H struct list; +struct imv_commands; -struct imv_commands { - struct list *command_list; -}; - +/* Create an imv_commands instance */ struct imv_commands *imv_commands_create(void); + +/* Cleans up an imv_commands instance */ void imv_commands_free(struct imv_commands *cmds); -void imv_command_register(struct imv_commands *cmds, const char *command, void (*handler)(struct list*, const char*, void*)); + +/* Register a new command. When a command is executed, the appropriate handler + * is called, with a void* for passing context. + */ +void imv_command_register(struct imv_commands *cmds, const char *command, + void (*handler)(struct list*, const char*, void*)); + +/* Add a command alias. Any arguments provided when invoking an alias are + * appended to the arguments being passed to the command. + */ void imv_command_alias(struct imv_commands *cmds, const char *command, const char *alias); + +/* Execute a single command */ int imv_command_exec(struct imv_commands *cmds, const char *command, void *data); + +/* Execute a list of commands */ int imv_command_exec_list(struct imv_commands *cmds, struct list *commands, void *data); #endif |