// this script was compiled with wurst 1.8.1.0-jenkins-Wurst-1365 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 set LinkedList_firstFree = 0 set LinkedList_maxIndex = 0 endfunction function LinkedList_add takes integer this, integer t returns nothing set LinkedList_t[this] = t endfunction function error takes string msg returns nothing call BJDebugMsg(msg + "\n" + "") endfunction function dispatch_LinkedList_Test_LinkedList_add takes integer this, integer t returns nothing if LinkedList_typeId[this] == 0 then if this == 0 then call error("Nullpointer exception when calling LinkedList.add") else call error("Called LinkedList.add on invalid object.") endif endif call LinkedList_add(this, t) endfunction function alloc_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 LinkedList_init takes integer this returns nothing endfunction function construct_LinkedList takes integer this returns nothing call LinkedList_init(this) endfunction function new_LinkedList takes nothing returns integer local integer this = alloc_LinkedList() call construct_LinkedList(this) return this endfunction function asList_1 takes integer ts_0 returns integer local integer ll = new_LinkedList() call dispatch_LinkedList_Test_LinkedList_add(ll, ts_0) return ll endfunction function LinkedList_getFirst takes integer this returns integer return LinkedList_t[this] endfunction function dispatch_LinkedList_Test_LinkedList_getFirst takes integer this returns integer local integer Test_LinkedList_getFirst_result if LinkedList_typeId[this] == 0 then if this == 0 then call error("Nullpointer exception when calling LinkedList.getFirst") else call error("Called LinkedList.getFirst on invalid object.") endif endif set Test_LinkedList_getFirst_result = LinkedList_getFirst(this) return Test_LinkedList_getFirst_result endfunction function init_Test takes nothing returns nothing set Test_x = dispatch_LinkedList_Test_LinkedList_getFirst(asList_1(asList_1(42))) if dispatch_LinkedList_Test_LinkedList_getFirst(Test_x) == 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