Script.h 583 B

123456789101112131415161718192021222324252627282930313233
  1. #ifndef SCRIPT_H
  2. #define SCRIPT_H
  3. #include <stdbool.h>
  4. #include "ByteCode.h"
  5. #include "Object.h"
  6. #define SCRIPT_STACK_SIZE 1000
  7. #define SCRIPT_ERROR_SIZE 256
  8. typedef struct Script {
  9. char error[SCRIPT_ERROR_SIZE];
  10. ByteCode* code;
  11. int readIndex;
  12. Object returnValue;
  13. Object stack[SCRIPT_STACK_SIZE];
  14. int stackIndex;
  15. int stackVarIndex;
  16. int line;
  17. } Script;
  18. Script* sInit(ByteCode* code);
  19. void sDelete(Script* sc);
  20. void sRun(Script* sc);
  21. typedef bool (*ObjectPrinter)(Object*);
  22. void sSetPrinter(ObjectPrinter p);
  23. void sPrintCode(Script* sc);
  24. #endif