// this script was compiled with wurst 1.8.1.0-jenkins-Wurst-1366
globals
integer array TFunc_nextFree
integer TFunc_firstFree=0
integer TFunc_maxIndex=0
integer array TFunc_typeId
endglobals
native testSuccess takes nothing returns nothing
function initGlobals takes nothing returns nothing
	set TFunc_firstFree = 0
	set TFunc_maxIndex = 0
endfunction

function error takes string msg returns nothing
	call BJDebugMsg(msg + "\n" + "")
endfunction

function alloc_TFunc_runFunc_test takes nothing returns integer
	local integer this
	if TFunc_firstFree == 0 then
		if TFunc_maxIndex < 32768 then
			set TFunc_maxIndex = TFunc_maxIndex + 1
			set this = TFunc_maxIndex
			set TFunc_typeId[this] = 2
		else
			call error("Out of memory: Could not create TFunc_runFunc_test.")
			set this = 0
		endif
	else
		set TFunc_firstFree = TFunc_firstFree - 1
		set this = TFunc_nextFree[TFunc_firstFree]
		set TFunc_typeId[this] = 2
	endif
	return this
endfunction

function booleanToIndex takes boolean b returns integer
	local integer cond_result
	if b then
		set cond_result = 1
	else
		set cond_result = 0
	endif
	return cond_result
endfunction

function booleanFromIndex takes integer i returns boolean
	local boolean cond_result
	if i == 0 then
		set cond_result = false
	else
		set cond_result = true
	endif
	return cond_result
endfunction

function run_runFunc_test takes integer this, boolean b returns nothing
	call testSuccess()
endfunction

function run_wrapper takes integer this, integer t returns nothing
	call run_runFunc_test(this, booleanFromIndex(t))
endfunction

function dispatch_TFunc_test_TFunc_run takes integer this, integer t returns nothing
	if TFunc_typeId[this] == 0 then
		if this == 0 then
			call error("Nullpointer exception when calling TFunc.run")
		else
			call error("Called TFunc.run on invalid object.")
		endif
	endif
	call run_wrapper(this, t)
endfunction

function runFunc takes integer func returns nothing
	call dispatch_TFunc_test_TFunc_run(func, booleanToIndex(false))
endfunction

function init_test takes nothing returns nothing
	local integer clVar = alloc_TFunc_runFunc_test()
	call runFunc(clVar)
endfunction

function main takes nothing returns nothing
	call initGlobals()
	call init_test()
endfunction

function config takes nothing returns nothing
endfunction