// this script was compiled with wurst 1.8.1.0-jenkins-Wurst-1366 globals integer Test_x=0 integer array LinkedList_nextFree integer LinkedList_firstFree=0 integer LinkedList_maxIndex=0 integer array LinkedList_typeId integer array LinkedList_t endglobals native testSuccess takes nothing returns nothing function initGlobals takes nothing returns nothing endfunction function error takes string msg returns nothing call BJDebugMsg(msg + "\n" + "") endfunction function new_LinkedList takes nothing returns integer local integer this if LinkedList_firstFree == 0 then if LinkedList_maxIndex < 32768 then set LinkedList_maxIndex = LinkedList_maxIndex + 1 set this = LinkedList_maxIndex set LinkedList_typeId[this] = 1 else call error("Out of memory: Could not create LinkedList.") set this = 0 endif else set LinkedList_firstFree = LinkedList_firstFree - 1 set this = LinkedList_nextFree[LinkedList_firstFree] set LinkedList_typeId[this] = 1 endif return this endfunction function asList_1 takes integer ts_0 returns integer local integer ll = new_LinkedList() if LinkedList_typeId[ll] == 0 then if ll == 0 then call error("Nullpointer exception when calling LinkedList.add") else call error("Called LinkedList.add on invalid object.") endif endif set LinkedList_t[ll] = ts_0 return ll endfunction function init_Test takes nothing returns nothing local integer ll = new_LinkedList() if LinkedList_typeId[ll] == 0 then if ll == 0 then call error("Nullpointer exception when calling LinkedList.add") else call error("Called LinkedList.add on invalid object.") endif endif set LinkedList_t[ll] = 42 set ll = asList_1(ll) if LinkedList_typeId[ll] == 0 then if ll == 0 then call error("Nullpointer exception when calling LinkedList.getFirst") else call error("Called LinkedList.getFirst on invalid object.") endif endif set Test_x = LinkedList_t[ll] set ll = Test_x if LinkedList_typeId[ll] == 0 then if ll == 0 then call error("Nullpointer exception when calling LinkedList.getFirst") else call error("Called LinkedList.getFirst on invalid object.") endif endif if LinkedList_t[ll] == 42 then call testSuccess() endif endfunction function main takes nothing returns nothing call initGlobals() call init_Test() endfunction function config takes nothing returns nothing endfunction