Script.h 751 B

12345678910111213141516171819202122232425262728293031323334353637
  1. #ifndef SCRIPT_H
  2. #define SCRIPT_H
  3. #include <stdbool.h>
  4. #include "vm/Allocator.h"
  5. #include "vm/ByteCode.h"
  6. #include "vm/Object.h"
  7. #define SCRIPT_STACK_SIZE 1000
  8. #define SCRIPT_ERROR_SIZE 256
  9. typedef struct {
  10. char error[SCRIPT_ERROR_SIZE];
  11. ByteCode* code;
  12. int readIndex;
  13. // Object returnValue;
  14. char stack[SCRIPT_STACK_SIZE];
  15. int stackIndex;
  16. // int stackVarIndex;
  17. int line;
  18. // Allocator allocator;
  19. } Script;
  20. Script* sInit(ByteCode* code);
  21. void sDelete(Script* sc);
  22. void sRun(Script* sc);
  23. typedef void (*IntPrinter)(int);
  24. void sSetIntPrinter(IntPrinter p);
  25. typedef void (*FloatPrinter)(float);
  26. void sSetFloatPrinter(FloatPrinter p);
  27. typedef void (*BoolPrinter)(bool);
  28. void sSetBoolPrinter(BoolPrinter p);
  29. #endif