22#ifndef AGS_ENGINE_SCRIPT_CC_INSTANCE_H
23#define AGS_ENGINE_SCRIPT_CC_INSTANCE_H
25#include "common/std/memory.h"
26#include "common/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
43#define CC_STACK_SIZE 256
45#define CC_STACK_DATA_SIZE (1024 * sizeof(int32_t))
46#define MAX_CALL_STACK 128
47#define MAX_FUNCTION_PARAMS 20
50#define MAX_LOADED_INSTANCES 256
52#define INSTANCE_ID_SHIFT 24LL
53#define INSTANCE_ID_MASK 0x00000000000000ffLL
54#define INSTANCE_ID_REMOVEMASK 0x0000000000ffffffLL
59#define DEBUG_CC_EXEC (0)
67 int32_t InstanceId = 0;
81 inline int Arg1i()
const {
return Args[0].IValue; }
82 inline int Arg2i()
const {
return Args[1].IValue; }
83 inline int Arg3i()
const {
return Args[2].IValue; }
96struct FunctionCallStack;
122 int32_t globaldatasize;
133 int num_stackentries;
138 int32_t stackdatasize;
144 int loadedInstanceId;
148 int32_t callStackLineNumber[MAX_CALL_STACK];
149 int32_t callStackAddr[MAX_CALL_STACK];
150 ccInstance *callStackCodeInst[MAX_CALL_STACK];
153 uint32_t *resolved_imports;
163 static void FreeInstanceStack();
167 static void SetExecTimeout(
unsigned sys_poll_ms,
unsigned abort_ms,
unsigned abort_loops);
177 void AbortAndDestroy();
180 int CallScriptFunction(
const char *funcname, int32_t num_params,
const RuntimeScriptValue *params);
190 bool IsBeingRun()
const;
196 bool ResolveScriptImports(
const ccScript *scri);
200 bool ResolveImportFixups(
const ccScript *scri);
207 bool CreateGlobalVars(
const ccScript *scri);
210 bool CreateRuntimeCodeFixups(
const ccScript *scri);
213 int Run(int32_t curpc);
219 void PushDataToStack(int32_t num_bytes);
224 void PopValuesFromStack(int32_t num_entries);
225 void PopDataFromStack(int32_t num_bytes);
231 void PushToFuncCallStack(FunctionCallStack &func_callstack,
const RuntimeScriptValue &rval);
232 void PopFromFuncCallStack(FunctionCallStack &func_callstack, int32_t num_entries);
235 AGS_Clock::time_point _lastAliveTs;
238extern void script_commands_init();
239extern void script_commands_free();
Definition: geometry.h:118
Definition: runtime_script_value.h:63
Definition: cc_instance.h:62
Definition: cc_instance.h:70
Definition: cc_instance.h:98
Definition: cc_instance.h:86
Definition: cc_instance.h:114
Definition: cc_script.h:37