string test_s672 array C_nextFree947 integer C_firstFree136 integer C_maxIndex180 array C_typeId149 string test_s672 = "" integer C_firstFree136 = 0 integer C_maxIndex180 = 0 function initGlobals775() { } function main194() { initGlobals775(); init_test135(); } function config157() { } function init_test135() { test_s_672 = ""; dispatch_C_destroyC873(new_C206()); if (test_s_672 != "ABCcba") { testFail203(("fail, result = " + test_s_672)); } else { }; testSuccess770(); } IS_NATIVE function testFail203(string msg140) { } IS_NATIVE function testSuccess770() { } function C_init264(integer this220) { construct_C_B185(this_220); } function construct_C_B185(integer this158) { construct_C_B_A987(this_158); test_s_672 = (test_s_672 + "B"); } function construct_C_B_A987(integer this120) { test_s_672 = (test_s_672 + "A"); } function new_C206() returns integer { local integer this117 this_117 = alloc_C613(); construct_C187(this_117); return this_117; } function construct_C187(integer this781) { C_init264(this_781); test_s_672 = (test_s_672 + "C"); } function C_onDestroy112(integer this152) { test_s_672 = (((test_s_672 + "c") + "b") + "a"); } function destroyC497(integer this917) { C_onDestroy112(this_917); dealloc_C211(this_917); } function alloc_C613() returns integer { local integer this104 if (C_firstFree_136 == 0) { if (C_maxIndex_180 < 32768) { C_maxIndex_180 = (C_maxIndex_180 + 1); this_104 = C_maxIndex_180; C_typeId_149[this_104] = 1; } else { error177("Out of memory: Could not create C."); this_104 = 0; }; } else { C_firstFree_136 = (C_firstFree_136 - 1); this_104 = C_nextFree_947[C_firstFree_136]; C_typeId_149[this_104] = 1; }; return this_104; } function error177(string msg428) { $debugPrint113((msg_428 + (" " + #getStackTrace()))); } function dealloc_C211(integer obj188) { if (C_typeId_149[obj_188] == 0) { error177("Double free: object of type C"); } else { C_nextFree_947[C_firstFree_136] = obj_188; C_firstFree_136 = (C_firstFree_136 + 1); C_typeId_149[obj_188] = 0; }; } function dispatch_C_destroyC873(integer this629) { if (C_typeId_149[this_629] == 0) { if (this_629 == 0) { error177("Nullpointer exception when calling C.C"); } else { error177("Called C.C on invalid object."); }; } else { }; destroyC497(this_629); }