|
libhatchet
|
Go to the source code of this file.
Macros | |
| #define | hxconsole_command(x_) |
| #define | hxconsole_command_named(x_, name_) |
| #define | hxconsole_variable(x_) |
| #define | hxconsole_variable_named(x_, name_) |
Functions | |
| HX_NS_BEGIN_ void | hxconsole_deregister (const char *id_) |
| bool | hxconsole_exec_line (const char *command_) |
| bool | hxconsole_help (void) |
| bool | hxconsole_exec_file (hxfile &file_) |
| bool | hxconsole_exec_filename (const char *filename_) |
Implements a simple console for debugging, remote use or for parsing configuration files.
Output is directed to the system log with hxlog_level_console. Requires C++20 or later. Set HX_USE_CONSOLE=2 to enable the debug console. See hxconsole.cpp for details. This is optimized for generated code size and not speed.
Here is how to write lambdas that cease to exist entirely when the console is disabled:
hxconsole_command_named(*+[](void) -> bool { return true; }, command_name);
| #define hxconsole_command | ( | x_ | ) |
hxconsole_command - Registers a function using a global constructor.
Use in a global scope. The command uses the same name and arguments as the function. E.g., hxconsole_command(srand);
| #define hxconsole_command_named | ( | x_, | |
| name_ ) |
hxconsole_command_named - Registers a named function using a global constructor.
Use in a global scope. The provided name must be a valid C identifier. E.g., hxconsole_command_named(srand, seed_rand);
| #define hxconsole_variable | ( | x_ | ) |
hxconsole_variable - Registers a variable.
Use in a global scope. The command has the same name as the variable. E.g.,
| #define hxconsole_variable_named | ( | x_, | |
| name_ ) |
hxconsole_variable_named - Registers a named variable.
Use in a global scope. The provided name must be a valid C identifier. E.g.,
| HX_NS_BEGIN_ void hxconsole_deregister | ( | const char * | id_ | ) |
hxconsole_deregister - Explicitly deregisters a console symbol.
| bool hxconsole_exec_file | ( | hxfile & | file_ | ) |
hxconsole_exec_file - Executes a configuration file that is opened for reading.
Ignores blank lines and comments that start with #. Disables asserts so that EOF is allowed. WARNING: file must not have asserts enabled as this call reads past the end.
| bool hxconsole_exec_filename | ( | const char * | filename_ | ) |
hxconsole_exec_filename - Opens a configuration file by name and executes it.
| bool hxconsole_exec_line | ( | const char * | command_ | ) |
hxconsole_exec_line - Evaluates a console command to either call a function or set a variable.
E.g., srand 77 or a_variable 5.
| bool hxconsole_help | ( | void | ) |
hxconsole_help - Logs every console symbol to the console log.