Script.h 771 B

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