string test_s122 array C_nextFree934 integer C_firstFree274 integer C_maxIndex895 array C_typeId117 string test_s122 = "" integer C_firstFree274 = 0 integer C_maxIndex895 = 0 function initGlobals629() { } function main884() { initGlobals629(); init_test212(); } function config715() { } function init_test212() { local integer c209 local integer this520 test_s_122 = ""; c_209 = new_C212(); this_520 = c_209; if (C_typeId_117[this_520] == 0) { if (this_520 == 0) { error114("Nullpointer exception when calling C.C"); } else { error114("Called C.C on invalid object."); }; } else { }; destroyC177(this_520); if (test_s_122 != "ABCcba") { testFail712(("fail, result = " + test_s_122)); } else { }; testSuccess154(); } IS_NATIVE function testFail712(string msg454) { } IS_NATIVE function testSuccess154() { } function new_C212() returns integer { local integer this124 local integer this208 local integer this606 local string x510 local string x187 if (C_firstFree_274 == 0) { if (C_maxIndex_895 < 32768) { C_maxIndex_895 = (C_maxIndex_895 + 1); this_208 = C_maxIndex_895; C_typeId_117[this_208] = 1; } else { error114("Out of memory: Could not create C."); this_208 = 0; }; } else { C_firstFree_274 = (C_firstFree_274 - 1); this_208 = C_nextFree_934[C_firstFree_274]; C_typeId_117[this_208] = 1; }; this_124 = this_208; this_606 = this_124; x_187 = "A"; test_s_122 = (test_s_122 + x_187); x_510 = "B"; test_s_122 = (test_s_122 + x_510); test_s_122 = (test_s_122 + "C"); return this_124; } function destroyC177(integer this206) { local integer obj213 test_s_122 = (test_s_122 + "c"); test_s_122 = (test_s_122 + "b"); test_s_122 = (test_s_122 + "a"); obj_213 = this_206; if (C_typeId_117[obj_213] == 0) { error114("Double free: object of type C"); } else { C_nextFree_934[C_firstFree_274] = obj_213; C_firstFree_274 = (C_firstFree_274 + 1); C_typeId_117[obj_213] = 0; }; } function error114(string msg144) { $debugPrint163((msg_144 + (" " + #getStackTrace()))); }