#ifndef SCRIPT_H #define SCRIPT_H #ifdef __cplusplus extern "C" { #endif #include #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; Value 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); check_format(2, 3) void sError(Script* sc, const char* format, ...); bool sPopInt32(Script* sc, int32* i); bool sPushInt32(Script* sc, int32 i); bool sPopFloat(Script* sc, float* f); bool sPushFloat(Script* sc, float f); SnuviArray* sGetArray(Script* sc); Value* sPopStructPointer(Script* sc, ValueType type); #ifdef __cplusplus } #endif #endif