summaryrefslogtreecommitdiff
path: root/csv-parse.h
diff options
context:
space:
mode:
authormrb0nk500 <b0nk@b0nk.xyz>2020-07-06 20:04:41 -0400
committermrb0nk500 <b0nk@b0nk.xyz>2020-07-06 20:04:41 -0400
commit756c606af68be8ccca7aced3b9c3d56fb2d5087f (patch)
treefbc02b63feb1933a213d26ae68ab1b1a104e4ef3 /csv-parse.h
parent887802efcdb3b56263069cc6778a8f53ed89d599 (diff)
- Implemented a new opcode table.
- Added a new preifx called the OF prefix, which adds the contents of a specific register to the current operand. - Added a table generator, which parses opcode table csv files.
Diffstat (limited to 'csv-parse.h')
-rw-r--r--csv-parse.h32
1 files changed, 32 insertions, 0 deletions
diff --git a/csv-parse.h b/csv-parse.h
new file mode 100644
index 0000000..8fc5d29
--- /dev/null
+++ b/csv-parse.h
@@ -0,0 +1,32 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+struct tok {
+ int skip; /* Number of blank tokens to skip. */
+ char *value;
+ struct tok *next;
+};
+
+typedef struct tok token;
+
+struct line {
+ int skip; /* Number of blank lines to skip. */
+ token *tok;
+ token *last_tok;
+ struct line *next;
+};
+
+typedef struct line line;
+
+extern token *tokens;
+extern token *last_tok;
+extern line *lines;
+extern line *last_line;
+
+extern int iseol(char c);
+extern token *make_token(char *value);
+extern line *get_line(char *str);
+extern void parse_csv(FILE *fp);
+extern void free_tokens(token *t, token *lt, int row);
+extern void free_lines();