diff options
author | bd <bdunahu@operationnull.com> | 2025-03-10 20:55:21 -0400 |
---|---|---|
committer | bd <bdunahu@operationnull.com> | 2025-03-10 20:55:21 -0400 |
commit | af103123a90eaf34437b7979eee2579bab8b4b36 (patch) | |
tree | fbf6219eb7b38cd41b2fbc2544dc2410f2df13cf /src/cli/cli.cc | |
parent | a69b57c4e850e55167424d890a7a2e7a46460e71 (diff) |
before error with catch crashing with global singleton logger
Diffstat (limited to 'src/cli/cli.cc')
-rw-r--r-- | src/cli/cli.cc | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/src/cli/cli.cc b/src/cli/cli.cc index a5706fb..2126798 100644 --- a/src/cli/cli.cc +++ b/src/cli/cli.cc @@ -3,9 +3,7 @@ #include "definitions.h" #include "dram.h" #include "response.h" -#include <iostream> -#include <sstream> -#include <vector> +#include <stdio.h> Cli::Cli() { @@ -95,10 +93,7 @@ void Cli::help() << " q - Quits the program\n"; } -void Cli::load(int memory_address) -{ - std::cout << "Loading data from memory address " << memory_address; -} +void Cli::load(int memory_address) { ; } void Cli::store(Accessor accessor, int data, int address) { @@ -142,11 +137,12 @@ void Cli::run() { std::cout << "Memory Command Processor Started. Type 'h' for a list of " "commands.\n"; - std::string input; + while (true) { std::cout << "> "; std::getline(std::cin, input); + std::istringstream iss(input); std::vector<std::string> tokens; std::string word; @@ -168,15 +164,16 @@ void Cli::run() if (it != commands.end()) { it->second(tokens); } else { - std::cout - << "Unknown command. Type 'help' for available commands.\n"; + std::cout << "Unknown command: '" << command + << "'. Type 'help' for available commands.\n"; } } } void Cli::initialize() { - std::cout << "Resetting memory configuration.\n"; + Logger *global_log = Logger::getInstance(); + global_log->log(INFO, "Resetting memory configuration.\n"); if (this->cache == nullptr) delete this->cache; Dram *d = new Dram(MEM_SIZE, MEM_DELAY); |