Script.h 808 B

1234567891011121314151617181920212223242526272829303132333435363738
  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. void sError(Script* sc, const char* format, ...);
  22. bool sPopInt(Script* sc, int* i);
  23. bool sPushInt(Script* sc, int i);
  24. bool sPopLong(Script* sc, long* l);
  25. bool sPushLong(Script* sc, long l);
  26. bool sPopFloat(Script* sc, float* f);
  27. bool sPushFloat(Script* sc, float f);
  28. bool sPopBool(Script* sc, bool* b);
  29. bool sPushBool(Script* sc, bool b);
  30. #endif