// 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 A_typeId integer array D_c integer wurst_stack_depth=0 string array wurst_stack endglobals native testSuccess takes nothing returns nothing function error takes string msg, string w__wurst_stackPos returns nothing local integer stacktraceIndex local integer stacktraceLimit set wurst_stack[wurst_stack_depth] = w__wurst_stackPos set wurst_stack_depth = wurst_stack_depth + 1 set w__wurst_stackPos = "" set stacktraceIndex = wurst_stack_depth set stacktraceLimit = 0 loop set stacktraceIndex = stacktraceIndex - 1 set stacktraceLimit = stacktraceLimit + 1 exitwhen stacktraceLimit > 20 or stacktraceIndex < 0 set w__wurst_stackPos = w__wurst_stackPos + "\n " + wurst_stack[stacktraceIndex] endloop call BJDebugMsg(msg + "\n" + w__wurst_stackPos) set wurst_stack_depth = wurst_stack_depth - 1 endfunction function destroyD takes integer this, string w__wurst_stackPos returns nothing local integer this_1 set wurst_stack[wurst_stack_depth] = w__wurst_stackPos set wurst_stack_depth = wurst_stack_depth + 1 set this_1 = this loop exitwhen D_c[this_1] >= 4 set D_c[this_1] = D_c[this_1] + 1 endloop call testSuccess() set wurst_stack[wurst_stack_depth] = "when calling dealloc_D in OndestroyL.wurst, line 35" set wurst_stack_depth = wurst_stack_depth + 1 if A_typeId[this] == 0 then call error("Double free: object of type D", "when calling error in OndestroyL.wurst, line 29") else set A_nextFree[A_firstFree] = this set A_firstFree = A_firstFree + 1 set A_typeId[this] = 0 endif set wurst_stack_depth = wurst_stack_depth - 1 - 1 endfunction function initGlobals takes nothing returns nothing endfunction function new_D takes integer i, string w__wurst_stackPos returns integer local integer this set wurst_stack[wurst_stack_depth] = w__wurst_stackPos set wurst_stack_depth = wurst_stack_depth + 1 set wurst_stack[wurst_stack_depth] = "when calling alloc_D in OndestroyL.wurst, line 31" set wurst_stack_depth = wurst_stack_depth + 1 if A_firstFree == 0 then if A_maxIndex < 32768 then set A_maxIndex = A_maxIndex + 1 set this = A_maxIndex set A_typeId[this] = 4 else call error("Out of memory: Could not create D.", "when calling error in OndestroyL.wurst, line 29") set this = 0 endif else set A_firstFree = A_firstFree - 1 set this = A_nextFree[A_firstFree] set A_typeId[this] = 4 endif set wurst_stack_depth = wurst_stack_depth - 1 set D_c[this] = i set wurst_stack_depth = wurst_stack_depth - 1 return this endfunction function main takes nothing returns nothing local integer d call initGlobals() set wurst_stack[wurst_stack_depth] = "when calling init_Test in OndestroyL.wurst, line 1" set wurst_stack_depth = wurst_stack_depth + 1 set d = new_D(0, "when calling new_D in OndestroyL.wurst, line 42") set wurst_stack[wurst_stack_depth] = "when calling dispatch_D_destroyD in OndestroyL.wurst, line 43" set wurst_stack_depth = wurst_stack_depth + 1 if A_typeId[d] == 0 then if d == 0 then call error("Nullpointer exception when calling D.D", "when calling error in OndestroyL.wurst, line 29") else call error("Called D.D on invalid object.", "when calling error in OndestroyL.wurst, line 29") endif endif call destroyD(d, "when calling destroyD in OndestroyL.wurst, line 29") set wurst_stack_depth = wurst_stack_depth - 1 - 1 endfunction function config takes nothing returns nothing endfunction