Script.h 484 B

123456789101112131415161718192021222324252627
  1. #ifndef SCRIPT_H
  2. #define SCRIPT_H
  3. #include <stdbool.h>
  4. #include "Object.h"
  5. #define SCRIPT_STACK_SIZE 50
  6. typedef struct Script {
  7. const char* error;
  8. unsigned char* byteCode;
  9. int byteCodeLength;
  10. int readIndex;
  11. Object stack[SCRIPT_STACK_SIZE];
  12. int stackIndex;
  13. } Script;
  14. Script* sInit(unsigned char* byteCode, int codeLength);
  15. void sDelete(Script* sc);
  16. void sRun(Script* sc);
  17. typedef bool (*ObjectPrinter)(Object*);
  18. void sSetPrinter(ObjectPrinter p);
  19. #endif