string test_s328 array C_nextFree278 integer C_firstFree173 integer C_maxIndex180 array C_typeId135 string test_s328 = "" integer C_firstFree173 = 0 integer C_maxIndex180 = 0 function initGlobals364() { } function main198() { initGlobals364(); init_test706(); } function config194() { } function init_test706() { local integer c144 test_s_328 = ""; c_144 = new_C129(); if (C_typeId_135[c_144] == 0) { if (c_144 == 0) { error111("Nullpointer exception when calling C.C"); } else { error111("Called C.C on invalid object."); }; } else { }; destroyC897(c_144); if (test_s_328 != "ABCcba") { testFail154(("fail, result = " + test_s_328)); } else { }; testSuccess189(); } IS_NATIVE function testFail154(string msg957) { } IS_NATIVE function testSuccess189() { } function new_C129() returns integer { local integer this134 if (C_firstFree_173 == 0) { if (C_maxIndex_180 < 32768) { C_maxIndex_180 = (C_maxIndex_180 + 1); this_134 = C_maxIndex_180; C_typeId_135[this_134] = 1; } else { error111("Out of memory: Could not create C."); this_134 = 0; }; } else { C_firstFree_173 = (C_firstFree_173 - 1); this_134 = C_nextFree_278[C_firstFree_173]; C_typeId_135[this_134] = 1; }; test_s_328 = (test_s_328 + "A"); test_s_328 = ((test_s_328 + "B") + "C"); return this_134; } function destroyC897(integer this498) { test_s_328 = (((test_s_328 + "c") + "b") + "a"); if (C_typeId_135[this_498] == 0) { error111("Double free: object of type C"); } else { C_nextFree_278[C_firstFree_173] = this_498; C_firstFree_173 = (C_firstFree_173 + 1); C_typeId_135[this_498] = 0; }; } function error111(string msg174) { $debugPrint109((msg_174 + (" " + #getStackTrace()))); }