// this script was compiled with wurst 1.8.1.0-jenkins-Wurst-1365 globals integer array A_nextFree integer A_firstFree=0 integer A_maxIndex=0 integer array Func_nextFree integer Func_firstFree=0 integer Func_maxIndex=0 integer array Func_typeId integer array A_f endglobals native testSuccess takes nothing returns nothing function initGlobals takes nothing returns nothing endfunction function apply_A_test takes integer this, integer x returns integer return x + 1 endfunction function error takes string msg returns nothing call BJDebugMsg(msg + "\n" + "") endfunction function dispatch_Func_test_Func_apply takes integer this, integer x returns integer if Func_typeId[this] == 0 then if this == 0 then call error("Nullpointer exception when calling Func.apply") else call error("Called Func.apply on invalid object.") endif endif return apply_A_test(this, x) endfunction function alloc_A takes nothing returns integer local integer this if A_firstFree == 0 then if A_maxIndex < 32768 then set A_maxIndex = A_maxIndex + 1 set this = A_maxIndex else call error("Out of memory: Could not create A.") set this = 0 endif else set A_firstFree = A_firstFree - 1 set this = A_nextFree[A_firstFree] endif return this endfunction function alloc_Func_A_test takes nothing returns integer local integer this if Func_firstFree == 0 then if Func_maxIndex < 32768 then set Func_maxIndex = Func_maxIndex + 1 set this = Func_maxIndex set Func_typeId[this] = 3 else call error("Out of memory: Could not create Func_A_test.") set this = 0 endif else set Func_firstFree = Func_firstFree - 1 set this = Func_nextFree[Func_firstFree] set Func_typeId[this] = 3 endif return this endfunction function A_init takes integer this returns nothing local integer clVar = alloc_Func_A_test() set A_f[this] = clVar endfunction function construct_A takes integer this returns nothing call A_init(this) endfunction function new_A takes nothing returns integer local integer this = alloc_A() call construct_A(this) return this endfunction function init_test takes nothing returns nothing if dispatch_Func_test_Func_apply(A_f[new_A()], 3) == 4 then call testSuccess() endif endfunction function main takes nothing returns nothing call initGlobals() call init_test() endfunction function config takes nothing returns nothing endfunction