menu.h
Go to the documentation of this file.
/* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
enum menu_argument_t {
MENU_ARGUMENT_NONE,
MENU_ARGUMENT_SIGNED,
MENU_ARGUMENT_UNSIGNED,
MENU_ARGUMENT_FLOAT,
MENU_ARGUMENT_STRING,
};
struct menu_command_t {
char shortcut;
char* name;
char* command_description;
enum menu_argument_t argument;
char* argument_description;
void (*command_handler)(void* argument);
};
bool menu_handle_command(const char* line, const struct menu_command_t* command_list, size_t command_list_length);
void menu_print_commands(const struct menu_command_t* command_list, size_t command_list_length);
menu_command_t
command menu entry
Definition: menu.h:31
menu_command_t::argument_description
char * argument_description
human readable description of the argument it can accept
Definition: menu.h:36
menu_command_t::argument
enum menu_argument_t argument
what kind of argument it accepts
Definition: menu.h:35
menu_command_t::name
char * name
complete name of the command (space-free)
Definition: menu.h:33
menu_command_t::shortcut
char shortcut
short command code (0 if not available)
Definition: menu.h:32
menu_command_t::command_handler
void(* command_handler)(void *argument)
function to be called to handle this command
Definition: menu.h:37
menu_command_t::command_description
char * command_description
human readable description of the command purpose
Definition: menu.h:34