-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathConsole.h
76 lines (61 loc) · 1.4 KB
/
Console.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
//
// Console.h
// LC3-Sim-Core
//
// Created by Lars Ott on 3/29/17.
// Copyright © 2017 EIU. All rights reserved.
//
#ifndef Console_h
#define Console_h
#include "computer.h"
typedef enum console_err_t {
consoleNoErr,
invalidCmd,
parseErr
} console_err_t;
typedef enum console_cmd_t {
help,
assemble,
_break,
_continue,
check,
clear,
dump,
input,
list,
load,
next,
print,
quit,
_reset,
step,
set,
stop,
trace,
run, // TODO console commands
assembleNLoad
} console_cmd_t;
typedef void* console_arg_t; // TODO improve this
static bool traceState;
static FILE tracefile;
void startConsole();
/** runs a console command.
* \param cmd the command to run.
* \param args arguments for that command
* \return an error if applicable.
*/
console_err_t executeCommand(console_cmd_t cmd, console_arg_t args);
/** pareses and runs a command for the console including arguments
* \param str the string to parse and run
* \return an error if applicable
*/
console_err_t parseAndRunCommand(char *str);
/** gives a description for each of the console errors
* \param err the error to be described
* \return a string containing the description.
*/
char * getConsoleErrorDescription(console_err_t err);
// TODO printing
bool handleSaveCommand(char * * argv, int remaining);
bool handleConsoleIn(char * line);
#endif /* Console_h */