Script.h 540 B

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