Script.h 843 B

123456789101112131415161718192021222324252627282930313233343536373839
  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 (*LongPrinter)(long);
  24. void sSetLongPrinter(LongPrinter p);
  25. typedef void (*FloatPrinter)(float);
  26. void sSetFloatPrinter(FloatPrinter p);
  27. typedef void (*BoolPrinter)(bool);
  28. void sSetBoolPrinter(BoolPrinter p);
  29. typedef void (*PointerPrinter)(Pointer*);
  30. void sSetPointerPrinter(PointerPrinter p);
  31. #endif