fix(console): rename macros and add enum EXECMODE

This commit is contained in:
phaneron 2023-08-16 17:51:14 -04:00
parent ee51e76795
commit 47e8d94842
2 changed files with 12 additions and 3 deletions

View file

@ -26,7 +26,7 @@ int32_t ValidateFileName(const char* filename) {
} }
TSHashTable<CONSOLECOMMAND, HASHKEY_STRI> g_consoleCommandHash; TSHashTable<CONSOLECOMMAND, HASHKEY_STRI> g_consoleCommandHash;
char g_commandHistory[HISTORY_DEPTH][CMD_BUFFER_SIZE]; char g_commandHistory[CONSOLE_HISTORY_DEPTH][CONSOLE_CMD_BUFFER_SIZE];
uint32_t g_commandHistoryIndex; uint32_t g_commandHistoryIndex;
char g_ExecBuffer[CONSOLE_EXEC_BUFFER_SIZE] = {0}; char g_ExecBuffer[CONSOLE_EXEC_BUFFER_SIZE] = {0};
EXECMODE g_ExecCreateMode = EM_NOTACTIVE; EXECMODE g_ExecCreateMode = EM_NOTACTIVE;
@ -76,12 +76,12 @@ void ConsoleCommandDestroy() {
char* ConsoleCommandHistory(uint32_t index) { char* ConsoleCommandHistory(uint32_t index) {
// Return a pointer to the buffer at the specified index // Return a pointer to the buffer at the specified index
return g_commandHistory[((g_commandHistoryIndex + (HISTORY_DEPTH - 1) - index) & (HISTORY_DEPTH - 1))]; return g_commandHistory[((g_commandHistoryIndex + (CONSOLE_HISTORY_DEPTH - 1) - index) & (CONSOLE_HISTORY_DEPTH - 1))];
} }
void AddToHistory(const char* command) { void AddToHistory(const char* command) {
SStrCopy(g_commandHistory[g_commandHistoryIndex], command, CONSOLE_LINE_LENGTH); SStrCopy(g_commandHistory[g_commandHistoryIndex], command, CONSOLE_LINE_LENGTH);
g_commandHistoryIndex = (g_commandHistoryIndex + 1) & (HISTORY_DEPTH-1); g_commandHistoryIndex = (g_commandHistoryIndex + 1) & (CONSOLE_HISTORY_DEPTH-1);
} }
uint32_t ConsoleCommandHistoryDepth() { uint32_t ConsoleCommandHistoryDepth() {

View file

@ -33,6 +33,15 @@ enum CATEGORY {
LAST LAST
}; };
enum EXECMODE {
EM_PROMPTOVERWRITE = 0,
EM_RECORDING = 1,
EM_APPEND = 2,
EM_WRITEFILE = 3,
EM_NOTACTIVE = 4,
EM_NUM_EXECMODES = 5
};
enum CONSOLERESIZESTATE { enum CONSOLERESIZESTATE {
CS_NONE, CS_NONE,
CS_STRETCH, CS_STRETCH,