string test_s211 array C_nextFree118 integer C_firstFree183 integer C_maxIndex789 array C_typeId196 string test_s211 = "" integer C_firstFree183 = 0 integer C_maxIndex789 = 0 function initGlobals640() { } function main185() { initGlobals640(); init_test213(); } function config131() { } function init_test213() { local integer c190 test_s_211 = ""; c_190 = new_C103(); if (C_typeId_196[c_190] == 0) { if (c_190 == 0) { error196("Nullpointer exception when calling C.C"); } else { error196("Called C.C on invalid object."); }; } else { }; destroyC953(c_190); if (test_s_211 != "ABCcba") { testFail100(("fail, result = " + test_s_211)); } else { }; testSuccess159(); } IS_NATIVE function testFail100(string msg135) { } IS_NATIVE function testSuccess159() { } function new_C103() returns integer { local integer this241 if (C_firstFree_183 == 0) { if (C_maxIndex_789 < 32768) { C_maxIndex_789 = (C_maxIndex_789 + 1); this_241 = C_maxIndex_789; C_typeId_196[this_241] = 1; } else { error196("Out of memory: Could not create C."); this_241 = 0; }; } else { C_firstFree_183 = (C_firstFree_183 - 1); this_241 = C_nextFree_118[C_firstFree_183]; C_typeId_196[this_241] = 1; }; test_s_211 = (test_s_211 + "A"); test_s_211 = ((test_s_211 + "B") + "C"); return this_241; } function destroyC953(integer this715) { test_s_211 = (((test_s_211 + "c") + "b") + "a"); if (C_typeId_196[this_715] == 0) { error196("Double free: object of type C"); } else { C_nextFree_118[C_firstFree_183] = this_715; C_firstFree_183 = (C_firstFree_183 + 1); C_typeId_196[this_715] = 0; }; } function error196(string msg637) { $debugPrint194((msg_637 + (" " + #getStackTrace()))); }