// this script was compiled with wurst 1.8.1.0-jenkins-Wurst-1365 globals integer Test_x=0 integer array VoidFunction_nextFree integer VoidFunction_firstFree=0 integer VoidFunction_maxIndex=0 integer array VoidFunction_typeId endglobals native testSuccess takes nothing returns nothing function error takes string msg returns nothing call BJDebugMsg(msg + "\n" + "") endfunction function cyc_foo takes integer funcChoice, integer i, integer t returns nothing if funcChoice == 0 then set Test_x = Test_x + 1 if VoidFunction_firstFree == 0 then if VoidFunction_maxIndex < 32768 then set VoidFunction_maxIndex = VoidFunction_maxIndex + 1 set funcChoice = VoidFunction_maxIndex set VoidFunction_typeId[funcChoice] = 2 else call error("Out of memory: Could not create VoidFunction_Test.") set funcChoice = 0 endif else set VoidFunction_firstFree = VoidFunction_firstFree - 1 set funcChoice = VoidFunction_nextFree[VoidFunction_firstFree] set VoidFunction_typeId[funcChoice] = 2 endif call cyc_foo(1, funcChoice, i) elseif funcChoice == 1 then if VoidFunction_typeId[i] == 0 then if i == 0 then call error("Nullpointer exception when calling VoidFunction.call") else call error("Called VoidFunction.call on invalid object.") endif endif if VoidFunction_typeId[i] <= 2 then call cyc_foo(2, t - 1, 0) else call cyc_foo(0, t - 1, 0) endif elseif funcChoice == 2 then set Test_x = Test_x + 1 if VoidFunction_firstFree == 0 then if VoidFunction_maxIndex < 32768 then set VoidFunction_maxIndex = VoidFunction_maxIndex + 1 set funcChoice = VoidFunction_maxIndex set VoidFunction_typeId[funcChoice] = 3 else call error("Out of memory: Could not create VoidFunction_Test.") set funcChoice = 0 endif else set VoidFunction_firstFree = VoidFunction_firstFree - 1 set funcChoice = VoidFunction_nextFree[VoidFunction_firstFree] set VoidFunction_typeId[funcChoice] = 3 endif if i > 0 then call cyc_foo(1, funcChoice, i) endif endif endfunction function initGlobals takes nothing returns nothing endfunction function main takes nothing returns nothing call initGlobals() call cyc_foo(2, 10, 0) if Test_x == 11 then call testSuccess() endif endfunction function config takes nothing returns nothing endfunction