// this script was compiled with wurst 1.8.1.0-jenkins-Wurst-1365 globals integer array MyInterface_nextFree integer MyInterface_firstFree=0 integer MyInterface_maxIndex=0 integer array MyInterface_typeId 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 dispatch_MyInterface_Test_MyInterface_getStr takes integer this returns string local string Test_MyInterface_getStr_result if MyInterface_typeId[this] == 0 then if this == 0 then call error("Nullpointer exception when calling MyInterface.getStr") else call error("Called MyInterface.getStr on invalid object.") endif endif if MyInterface_typeId[this] <= 3 then if MyInterface_typeId[this] == 0 then if this == 0 then call error("Nullpointer exception when calling MyInterfaceAbstract.getSome") else call error("Called MyInterfaceAbstract.getSome on invalid object.") endif endif set Test_MyInterface_getStr_result = "AAbstract" else set Test_MyInterface_getStr_result = "MyInterfaceImpl" endif return Test_MyInterface_getStr_result endfunction function new_MyInterfaceAbstractImpl takes nothing returns integer local integer this if MyInterface_firstFree == 0 then if MyInterface_maxIndex < 32768 then set MyInterface_maxIndex = MyInterface_maxIndex + 1 set this = MyInterface_maxIndex set MyInterface_typeId[this] = 3 else call error("Out of memory: Could not create MyInterfaceAbstractImpl.") set this = 0 endif else set MyInterface_firstFree = MyInterface_firstFree - 1 set this = MyInterface_nextFree[MyInterface_firstFree] set MyInterface_typeId[this] = 3 endif return this endfunction function new_MyInterfaceImpl takes nothing returns integer local integer this if MyInterface_firstFree == 0 then if MyInterface_maxIndex < 32768 then set MyInterface_maxIndex = MyInterface_maxIndex + 1 set this = MyInterface_maxIndex set MyInterface_typeId[this] = 4 else call error("Out of memory: Could not create MyInterfaceImpl.") set this = 0 endif else set MyInterface_firstFree = MyInterface_firstFree - 1 set this = MyInterface_nextFree[MyInterface_firstFree] set MyInterface_typeId[this] = 4 endif return this endfunction function init_Test takes nothing returns nothing local integer a = new_MyInterfaceImpl() local integer b = new_MyInterfaceAbstractImpl() if dispatch_MyInterface_Test_MyInterface_getStr(a) == "MyInterfaceImpl" and dispatch_MyInterface_Test_MyInterface_getStr(b) == "AAbstract" then call testSuccess() endif endfunction function main takes nothing returns nothing call initGlobals() call init_Test() endfunction function config takes nothing returns nothing endfunction