added verbosity command to shell
authorJustin Wind <justin.wind@gmail.com>
Fri, 25 May 2012 00:45:43 +0000 (17:45 -0700)
committerJustin Wind <justin.wind@gmail.com>
Fri, 25 May 2012 00:45:43 +0000 (17:45 -0700)
vm-dcpu16.c

index cc06b111b0eb3630da346967996e0a6bf2f2479e..aefbcf16560c6ec4733503574dd4dfa73d1af525 100644 (file)
@@ -309,6 +309,7 @@ COMMAND_IMPL(reset) {
 
     dcpu16_reset(vm);
     printf("initialized\n");
+
     return 0;
 }
 COMMAND_HELP(reset) {
@@ -319,6 +320,27 @@ COMMAND_HELP(reset) {
 }
 
 
+COMMAND_IMPL(verbosity) {
+    int l;
+    (void)vm, (void)arg_count;
+
+    l = str_to_word(arg_vector[1]);
+    if (l < 0) {
+        fprintf(stderr, "invalid level\n");
+        return 0;
+    }
+
+    opt_.verbose = l;
+
+    return 0;
+}
+COMMAND_HELP(verbosity) {
+    fprintf(f, "\tverbosity level\n");
+    if (summary) return;
+
+    fprintf(f, "sets the verbosity level\n");
+}
+
 COMMAND_IMPL(load) {
     int addr = 0;
 
@@ -737,6 +759,7 @@ COMMAND_HELP(help);
 static struct command_ command_table_[] = {
     COMMAND_ENTRY(help, 0, -1),
     COMMAND_ENTRY(quit, 0, -1),
+    COMMAND_ENTRY(verbosity, 1, 1),
     COMMAND_ENTRY(load, 1, 2),
     COMMAND_ENTRY(dump, 0, 2),
     COMMAND_ENTRY(disassemble, 0, 2),