aboutsummaryrefslogtreecommitdiff
path: root/bas.h
diff options
context:
space:
mode:
authorB. Watson <urchlay@slackware.uk>2024-06-13 15:30:33 -0400
committerB. Watson <urchlay@slackware.uk>2024-06-13 15:30:33 -0400
commit9d1ce7321f27d47b76cba907127af777d6672188 (patch)
tree9d0af044cbead9f251cbf401f5664d6c766edb72 /bas.h
parent79cbc8914d90ced367b68c4aaf899dfe596449a3 (diff)
downloadbw-atari8-tools-9d1ce7321f27d47b76cba907127af777d6672188.tar.gz
major surgery: callback API, port dumpbas to use callbacks, add vxrefbas.
Diffstat (limited to 'bas.h')
-rw-r--r--bas.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/bas.h b/bas.h
index 9d117cc..eb3f4e5 100644
--- a/bas.h
+++ b/bas.h
@@ -42,6 +42,10 @@
#define CMD_REM 0x00
#define CMD_DATA 0x01
#define CMD_ERROR 0x37
+#define CMD_FOR 0x08
+#define CMD_NEXT 0x09
+#define CMD_LET 0x06
+#define CMD_ILET 0x36
#define OP_GOTO 0x17
#define OP_GOSUB 0x18
#define OP_THEN 0x1b
@@ -56,6 +60,26 @@
#define TYPE_ARRAY 1
#define TYPE_STRING 2
+/* callbacks */
+#define CALLBACK(x) void x(unsigned int lineno, unsigned int pos, unsigned int tok, unsigned int end)
+#define CALLBACK_PTR(x) void (*x)(unsigned int lineno, unsigned int pos, unsigned int tok, unsigned int end)
+#define walk_all_code() walk_code(0, 32768)
+
+void walk_code(unsigned int startlineno, unsigned int endlineno);
+unsigned char get_vartype(unsigned char tok);
+
+extern CALLBACK_PTR(on_start_line);
+extern CALLBACK_PTR(on_bad_line_length);
+extern CALLBACK_PTR(on_end_line);
+extern CALLBACK_PTR(on_start_stmt);
+extern CALLBACK_PTR(on_end_stmt);
+extern CALLBACK_PTR(on_cmd_token);
+extern CALLBACK_PTR(on_text);
+extern CALLBACK_PTR(on_exp_token);
+extern CALLBACK_PTR(on_var_token);
+extern CALLBACK_PTR(on_string_const);
+extern CALLBACK_PTR(on_num_const);
+
/* BASIC 14-byte header values */
extern unsigned short lomem;
extern unsigned short vntp;