123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- #ifndef SCRIPT_H
- #define SCRIPT_H
- #ifdef __cplusplus
- extern "C" {
- #endif
- #include <stdbool.h>
- #include "vm/Arrays.h"
- #include "vm/ByteCode.h"
- #define SCRIPT_STACK_SIZE 1000
- #define SCRIPT_ERROR_SIZE 256
- typedef struct {
- char error[SCRIPT_ERROR_SIZE];
- ByteCode* code;
- int readIndex;
- char stack[SCRIPT_STACK_SIZE];
- int stackIndex;
- int stackVarIndex;
- int line;
- SnuviArrays arrays;
- } Script;
- Script* sInit(ByteCode* code);
- void sDelete(Script* sc);
- void sRun(Script* sc);
- void sError(Script* sc, const char* format, ...);
- bool sPopInt32(Script* sc, int32* i);
- bool sPushInt32(Script* sc, int32 i);
- bool sPopInt64(Script* sc, int64* i);
- bool sPushInt64(Script* sc, int64 i);
- bool sPopFloat(Script* sc, float* f);
- bool sPushFloat(Script* sc, float f);
- bool sPopBool(Script* sc, bool* b);
- bool sPushBool(Script* sc, bool b);
- bool sPopPointer(Script* sc, Pointer* p);
- bool sPushPointer(Script* sc, Pointer* p);
- bool sPushNullPointer(Script* sc);
- void* sCheckAddress(Script* sc, Pointer* p, int length);
- bool sGetPointerLength(Script* sc, Pointer* p, int32* length);
- #ifdef __cplusplus
- }
- #endif
- #endif
|