string test_s399 array C_nextFree143 integer C_firstFree145 integer C_maxIndex457 array C_typeId204 string test_s399 = "" integer C_firstFree145 = 0 integer C_maxIndex457 = 0 function initGlobals901() { } function main848() { initGlobals901(); init_test140(); } function config135() { } function init_test140() { local integer c207 test_s_399 = ""; c_207 = new_C871(); if (C_typeId_204[c_207] == 0) { if (c_207 == 0) { error137("Nullpointer exception when calling C.C"); } else { error137("Called C.C on invalid object."); }; } else { }; destroyC492(c_207); if (test_s_399 != "ABCcba") { testFail846(("fail, result = " + test_s_399)); } else { }; testSuccess150(); } IS_NATIVE function testFail846(string msg126) { } IS_NATIVE function testSuccess150() { } function new_C871() returns integer { local integer this132 if (C_firstFree_145 == 0) { if (C_maxIndex_457 < 32768) { C_maxIndex_457 = (C_maxIndex_457 + 1); this_132 = C_maxIndex_457; C_typeId_204[this_132] = 1; } else { error137("Out of memory: Could not create C."); this_132 = 0; }; } else { C_firstFree_145 = (C_firstFree_145 - 1); this_132 = C_nextFree_143[C_firstFree_145]; C_typeId_204[this_132] = 1; }; test_s_399 = (test_s_399 + "A"); test_s_399 = ((test_s_399 + "B") + "C"); return this_132; } function destroyC492(integer this184) { test_s_399 = (((test_s_399 + "c") + "b") + "a"); if (C_typeId_204[this_184] == 0) { error137("Double free: object of type C"); } else { C_nextFree_143[C_firstFree_145] = this_184; C_firstFree_145 = (C_firstFree_145 + 1); C_typeId_204[this_184] = 0; }; } function error137(string msg211) { $debugPrint185((msg_211 + (" " + #getStackTrace()))); }