Script.h 504 B

1234567891011121314151617181920212223242526272829
  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 50
  7. #define SCRIPT_ERROR_SIZE 256
  8. typedef struct Script {
  9. char error[SCRIPT_ERROR_SIZE];
  10. ByteCode* code;
  11. int readIndex;
  12. Object stack[SCRIPT_STACK_SIZE];
  13. int stackIndex;
  14. int line;
  15. } Script;
  16. Script* sInit(ByteCode* code);
  17. void sDelete(Script* sc);
  18. void sRun(Script* sc);
  19. typedef bool (*ObjectPrinter)(Object*);
  20. void sSetPrinter(ObjectPrinter p);
  21. #endif