Contains the console system, which disperses all logging to registered consumers as well as handles registered command inputs.
More...
#include "defines.h"
#include "logger.h"
Go to the source code of this file.
|
struct | console_command_argument |
| Represents a single console command argument's value. Always represented as a string, it is up to the console command function to interpret and convert it to the required type during processing. More...
|
|
struct | console_command_context |
| Context to be passed along with an executing console command (i.e. arguments to the command). More...
|
|
|
b8 | console_initialize (u64 *memory_requirement, void *memory, void *config) |
| Initializes the console system. As with other systems, must be called twice; once to get the memory requirement (where memory = 0), and a second time passing allocated memory. More...
|
|
void | console_shutdown (void *state) |
| Shuts down the console system. More...
|
|
KAPI void | console_consumer_register (void *inst, PFN_console_consumer_write callback, u8 *out_consumer_id) |
| Registers a console consumer with the console system. More...
|
|
KAPI void | console_consumer_update (u8 consumer_id, void *inst, PFN_console_consumer_write callback) |
| Updates the instance and callback for the consumer with the given identifier. More...
|
|
void | console_write_line (log_level level, const char *message) |
| Called internally by the logging system to write a new line to the console. More...
|
|
KAPI b8 | console_command_register (const char *command, u8 arg_count, PFN_console_command func) |
| Registers a console command with the console system. More...
|
|
KAPI b8 | console_command_unregister (const char *command) |
| Unregisters the given command. More...
|
|
KAPI b8 | console_command_execute (const char *command) |
| Executes a console command. More...
|
|
Contains the console system, which disperses all logging to registered consumers as well as handles registered command inputs.
- Author
- Travis Vroman (travi.nosp@m.s@ko.nosp@m.hieng.nosp@m.ine..nosp@m.com)
- Version
- 1.0
- Date
- 2023-01-18
- Copyright
- Kohi Game Engine is Copyright (c) Travis Vroman 2021-2023
◆ console_command_argument
Represents a single console command argument's value. Always represented as a string, it is up to the console command function to interpret and convert it to the required type during processing.
◆ console_command_context
Context to be passed along with an executing console command (i.e. arguments to the command).
◆ PFN_console_command
A typedef for a function pointer which represents a registered console command, and is called when triggered by some means of console input (typically a debug console).
◆ PFN_console_consumer_write
typedef b8(* PFN_console_consumer_write) (void *inst, log_level level, const char *message) |
Typedef for a console consumer write function, which is invoked every time a logging event occurs. Consumers must implement this and handle the input thusly.
◆ console_command_execute()
KAPI b8 console_command_execute |
( |
const char * |
command | ) |
|
Executes a console command.
- Parameters
-
command | The command, including arguments separated by spaces. ex: "kvar_int_set test_var 4" |
- Returns
- True on success; otherwise false.
◆ console_command_register()
Registers a console command with the console system.
- Parameters
-
command | The name of the command. |
arg_count | The number of required arguments. |
func | The function pointer to be invoked. |
- Returns
- True on success; otherwise false.
◆ console_command_unregister()
KAPI b8 console_command_unregister |
( |
const char * |
command | ) |
|
Unregisters the given command.
- Parameters
-
command | The name of the command to be unregistered. |
- Returns
- True on success; otherwise false.
◆ console_consumer_register()
Registers a console consumer with the console system.
- Parameters
-
inst | Instance information to pass along with the consumer. |
callback | The callback to be made on console write. |
◆ console_consumer_update()
Updates the instance and callback for the consumer with the given identifier.
- Parameters
-
consumer_id | The identifier of the consumer to update. |
inst | The consumer instance. |
callback | The new callback function. |
◆ console_initialize()
b8 console_initialize |
( |
u64 * |
memory_requirement, |
|
|
void * |
memory, |
|
|
void * |
config |
|
) |
| |
Initializes the console system. As with other systems, must be called twice; once to get the memory requirement (where memory = 0), and a second time passing allocated memory.
- Parameters
-
memory_requirement | A pointer to hold the memory requirement. |
memory | The allocated memory for this system's state. |
config | Ignored. |
- Returns
- True on success; otherwise false.
◆ console_shutdown()
void console_shutdown |
( |
void * |
state | ) |
|
Shuts down the console system.
- Parameters
-
state | A pointer to the console system state. |
◆ console_write_line()
void console_write_line |
( |
log_level |
level, |
|
|
const char * |
message |
|
) |
| |
Called internally by the logging system to write a new line to the console.
- Parameters
-
level | The logging level. |
message | The message to be written. |