22 #ifndef AGS_ENGINE_SCRIPT_CC_INSTANCE_H 23 #define AGS_ENGINE_SCRIPT_CC_INSTANCE_H 25 #include "ags/lib/std/memory.h" 26 #include "ags/lib/std/map.h" 27 #include "ags/engine/ac/timer.h" 28 #include "ags/shared/script/cc_internal.h" 29 #include "ags/shared/script/cc_script.h" 30 #include "ags/engine/script/non_blocking_script_function.h" 31 #include "ags/shared/util/string.h" 37 #define INSTF_SHAREDATA 1 38 #define INSTF_ABORTED 2 40 #define INSTF_RUNNING 8 // set by main code to confirm script isn't stuck 41 #define CC_STACK_SIZE 250 42 #define CC_STACK_DATA_SIZE (1000 * sizeof(int32_t)) 43 #define MAX_CALL_STACK 100 46 #define MAX_LOADED_INSTANCES 256 48 #define INSTANCE_ID_SHIFT 24LL 49 #define INSTANCE_ID_MASK 0x00000000000000ffLL 50 #define INSTANCE_ID_REMOVEMASK 0x0000000000ffffffLL 82 struct FunctionCallStack;
105 PScVarMap globalvars;
107 int32_t globaldatasize;
118 int num_stackentries;
123 int32_t stackdatasize;
129 int loadedInstanceId;
133 int32_t callStackLineNumber[MAX_CALL_STACK];
134 int32_t callStackAddr[MAX_CALL_STACK];
135 ccInstance *callStackCodeInst[MAX_CALL_STACK];
138 uint32_t *resolved_imports;
148 static void FreeInstanceStack();
152 static void SetExecTimeout(
unsigned sys_poll_ms,
unsigned abort_ms,
unsigned abort_loops);
162 void AbortAndDestroy();
165 int CallScriptFunction(
const char *funcname, int32_t num_params,
const RuntimeScriptValue *params);
175 bool IsBeingRun()
const;
181 bool ResolveScriptImports(
const ccScript *scri);
185 bool ResolveImportFixups(
const ccScript *scri);
192 bool CreateGlobalVars(
const ccScript *scri);
195 bool CreateRuntimeCodeFixups(
const ccScript *scri);
199 int Run(int32_t curpc);
207 void PushDataToStack(int32_t num_bytes);
212 void PopValuesFromStack(int32_t num_entries);
213 void PopDataFromStack(int32_t num_bytes);
222 void PushToFuncCallStack(FunctionCallStack &func_callstack,
const RuntimeScriptValue &rval);
223 void PopFromFuncCallStack(FunctionCallStack &func_callstack, int32_t num_entries);
226 AGS_Clock::time_point _lastAliveTs;
229 extern void script_commands_init();
230 extern void script_commands_free();
Definition: achievements_tables.h:27
Definition: runtime_script_value.h:65
Definition: cc_instance.h:84
Definition: cc_instance.h:52
Definition: cc_instance.h:62
Definition: geometry.h:114
Definition: cc_script.h:37
Definition: cc_instance.h:99
Definition: cc_instance.h:72