// this script was compiled with wurst 1.8.1.0-jenkins-Wurst-1367 globals integer array F_nextFree integer F_firstFree=0 integer F_maxIndex=0 integer array F_typeId integer array X_t endglobals native testSuccess takes nothing returns nothing function initGlobals takes nothing returns nothing set F_firstFree = 0 set F_maxIndex = 0 endfunction function X_get takes integer this returns integer return X_t[this] endfunction function error takes string msg returns nothing call BJDebugMsg(msg + "\n" + "") endfunction function dispatch_F_test_F_get takes integer this returns integer local integer test_F_get_result if F_typeId[this] == 0 then if this == 0 then call error("Nullpointer exception when calling F.get") else call error("Called F.get on invalid object.") endif endif set test_F_get_result = X_get(this) return test_F_get_result endfunction function alloc_X takes nothing returns integer local integer this if F_firstFree == 0 then if F_maxIndex < 32768 then set F_maxIndex = F_maxIndex + 1 set this = F_maxIndex set F_typeId[this] = 2 else call error("Out of memory: Could not create X.") set this = 0 endif else set F_firstFree = F_firstFree - 1 set this = F_nextFree[F_firstFree] set F_typeId[this] = 2 endif return this endfunction function X_init takes integer this returns nothing endfunction function F_init takes integer this returns nothing endfunction function construct_F takes integer this returns nothing call F_init(this) endfunction function construct_X takes integer this, integer t returns nothing call construct_F(this) call X_init(this) set X_t[this] = t endfunction function new_X takes integer t returns integer local integer this = alloc_X() call construct_X(this, t) return this endfunction function init_test takes nothing returns nothing local integer x = new_X(42) if dispatch_F_test_F_get(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