12345678910111213141516171819202122232425262728293031323334353637 |
- #ifndef SCRIPT_H
- #define SCRIPT_H
- #include <stdbool.h>
- #include "Allocator.h"
- #include "ByteCode.h"
- #include "Object.h"
- #define SCRIPT_STACK_SIZE 1000
- #define SCRIPT_ERROR_SIZE 256
- typedef struct Script {
- char error[SCRIPT_ERROR_SIZE];
- ByteCode* code;
- int readIndex;
- Object returnValue;
- Object stack[SCRIPT_STACK_SIZE];
- int stackIndex;
- int stackVarIndex;
- int line;
- Allocator allocator;
- } Script;
- Script* sInit(ByteCode* code);
- void sDelete(Script* sc);
- void sRun(Script* sc);
- typedef bool (*ObjectPrinter)(Object*);
- void sSetPrinter(ObjectPrinter p);
- void sCollectGarbage(Script* sc);
- void sPrintCode(Script* sc);
- #endif
|