summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbd <bdunahu@operationnull.com>2025-03-20 18:04:01 -0400
committerbd <bdunahu@operationnull.com>2025-03-20 18:04:01 -0400
commitc4bb9576e8d9c3913e515a7f0eb0d0e9965ebc72 (patch)
tree8ba64ec5c88fb9bc4435c1f42dfc9198aa38df4d /src
parentc55104f8e99ea6ccb0c66a5e0d3cfc81dbbc19ab (diff)
Make memory simulator an optional command, experiment with fixtures
Diffstat (limited to 'src')
-rw-r--r--src/main.cc43
1 files changed, 22 insertions, 21 deletions
diff --git a/src/main.cc b/src/main.cc
index 08b38e6..f5eecac 100644
--- a/src/main.cc
+++ b/src/main.cc
@@ -1,6 +1,6 @@
#include "cli.h"
-#include "logger.h"
#include "definitions.h"
+#include "logger.h"
#include <getopt.h>
#include <iostream>
@@ -22,36 +22,39 @@ static std::string banner =
" _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ \n"
" _/ _/ _/_/_/_/ _/_/_/ _/ _/_/ _/ _/ _/ \n"
" _/_/ _/_/ ";
-static void print_version_number() { std::cout << banner << version_number << '\n'; }
+static void print_version_number()
+{
+ std::cout << banner << version_number << '\n';
+}
static void err()
{
std::cerr << "Usage:\n\trisc_vector [OPTIONS]\nOptions:\n\t--debug,\t-d: "
- "turn on verbose output\n\t--no-python,\t-p: run without "
- "GUI\n\t--version,\t-v: print the version information and exit\n"
+ "turn on verbose output\n\t--memory-only,\t-m: run the memory "
+ "simulator only, without a GUI.\n\t--version,\t-v: print the "
+ "version information and exit\n"
<< std::endl;
}
-static void parseArguments(int argc, char **argv, bool &python)
+static void
+parseArguments(int argc, char **argv, bool &memory_only)
{
struct option long_options[] = {
{"debug", no_argument, 0, 'd'},
- {"no-python", no_argument, 0, 'p'},
+ {"memory-only", no_argument, 0, 'm'},
{0, 0, 0, 0}};
- python = true;
-
int opt;
- while ((opt = getopt_long(argc, argv, "d:p", long_options, NULL)) != -1) {
+ while ((opt = getopt_long(argc, argv, "d:m", long_options, NULL)) != -1) {
switch (opt) {
case 'd':
global_log->setLevel(DEBUG);
global_log->log(DEBUG, "DEBUG output enabled.");
break;
- case 'p':
- global_log->log(INFO, "Python will NOT be started!");
- python = false;
+ case 'm':
+ global_log->log(INFO, "Starting the storage CLI interface...");
+ memory_only = true;
break;
default:
err();
@@ -63,20 +66,18 @@ static void parseArguments(int argc, char **argv, bool &python)
int main(int argc, char **argv)
{
print_version_number();
- Cli cli;
global_log->log(INFO, "Initializing...");
- bool python = true;
- parseArguments(argc, argv, python);
+ bool memory_only = false;
+ parseArguments(argc, argv, memory_only);
- if (python) {
- // fork off python here
- ;
- global_log->log(INFO, "Python started.");
+ if (memory_only) {
+ Cli cli;
+ cli.run();
}
- cli.run();
-
+ // fork off python here
+ global_log->log(INFO, "Python started.");
global_log->log(INFO, "Cleaning up...");
global_log->log(INFO, "Goodbye!");
return EXIT_SUCCESS;