summaryrefslogtreecommitdiff
path: root/src/user/app/kbasic/var.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/user/app/kbasic/var.c')
-rw-r--r--src/user/app/kbasic/var.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/user/app/kbasic/var.c b/src/user/app/kbasic/var.c
new file mode 100644
index 0000000..a49ce61
--- /dev/null
+++ b/src/user/app/kbasic/var.c
@@ -0,0 +1,19 @@
+#include <ctype.h>
+
+#include "basic.h"
+
+int variables[26]= { /* 26 user variables, A-Z */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0
+};
+
+/* Find a pointer to the value of a variable. */
+int* find_var(char *s)
+{
+ if(!isalpha(*s)){
+ serror(4); /* not a variable */
+ return 0;
+ }
+ return variables + (toupper(*s)-'A');
+}