summaryrefslogtreecommitdiff
path: root/apps/interpreters/bas/auto.h
diff options
context:
space:
mode:
authorGregory Nutt <gnutt@nuttx.org>2014-10-27 07:53:12 -0600
committerGregory Nutt <gnutt@nuttx.org>2014-10-27 07:53:12 -0600
commit4ef5633f361ab5302007045dcef945043d6d6225 (patch)
tree1806fe0ec9221c4e6c7439419e8b57bfe7865d29 /apps/interpreters/bas/auto.h
parentf2fe892334074612e4e3159c754b65d13bc348fc (diff)
downloadnuttx-4ef5633f361ab5302007045dcef945043d6d6225.tar.gz
nuttx-4ef5633f361ab5302007045dcef945043d6d6225.tar.bz2
nuttx-4ef5633f361ab5302007045dcef945043d6d6225.zip
Port of BAS 2.4 to NuttX by Alan Carvalho de Assis
Diffstat (limited to 'apps/interpreters/bas/auto.h')
-rw-r--r--apps/interpreters/bas/auto.h63
1 files changed, 63 insertions, 0 deletions
diff --git a/apps/interpreters/bas/auto.h b/apps/interpreters/bas/auto.h
new file mode 100644
index 000000000..73912ad1a
--- /dev/null
+++ b/apps/interpreters/bas/auto.h
@@ -0,0 +1,63 @@
+#ifndef AUTO_H
+#define AUTO_H
+
+#include "programtypes.h"
+#include "var.h"
+
+struct Auto
+{
+ long int stackPointer;
+ long int stackCapacity;
+ long int framePointer;
+ long int frameSize;
+ struct Pc onerror;
+ union AutoSlot *slot;
+ long int erl;
+ struct Pc erpc;
+ struct Value err;
+ struct Value lastdet;
+ struct Pc begindata;
+ int resumeable;
+ struct Symbol *cur,*all; /* should be hung off the funcs/procs */
+};
+
+struct AutoFrameSlot
+{
+ long int framePointer;
+ long int frameSize;
+ struct Pc pc;
+};
+
+struct AutoExceptionSlot
+{
+ struct Pc onerror;
+ int resumeable;
+};
+
+union AutoSlot
+{
+ struct AutoFrameSlot retFrame;
+ struct AutoExceptionSlot retException;
+ struct Var var;
+};
+
+#include "token.h"
+
+extern struct Auto *Auto_new(struct Auto *this);
+extern void Auto_destroy(struct Auto *this);
+extern struct Var *Auto_pushArg(struct Auto *this);
+extern void Auto_pushFuncRet(struct Auto *this, int firstarg, struct Pc *pc);
+extern void Auto_pushGosubRet(struct Auto *this, struct Pc *pc);
+extern struct Var *Auto_local(struct Auto *this, int l);
+extern int Auto_funcReturn(struct Auto *this, struct Pc *pc);
+extern int Auto_gosubReturn(struct Auto *this, struct Pc *pc);
+extern void Auto_frameToError(struct Auto *this, struct Program *program, struct Value *v);
+extern void Auto_setError(struct Auto *this, long int line, struct Pc *pc, struct Value *v);
+
+extern int Auto_find(struct Auto *this, struct Identifier *ident);
+extern int Auto_variable(struct Auto *this, const struct Identifier *ident);
+extern enum ValueType Auto_argType(const struct Auto *this, int l);
+extern enum ValueType Auto_varType(const struct Auto *this, struct Symbol *sym);
+extern void Auto_funcEnd(struct Auto *this);
+
+#endif