string test_s111 array C_nextFree174 integer C_firstFree212 integer C_maxIndex486 array C_typeId527 string test_s111 = "" integer C_firstFree212 = 0 integer C_maxIndex486 = 0 function initGlobals186() { C_firstFree_212 = 0; C_maxIndex_486 = 0; } function main201() { initGlobals186(); init_test113(); } function config110() { } function init_test113() { local integer c980 test_s_111 = ""; c_980 = new_C975(); dispatch_C_destroyC136(c_980); if (test_s_111 != "ABCcba") { testFail181(("fail, result = " + test_s_111)); } else { }; testSuccess176(); } IS_NATIVE function testFail181(string msg182) { } IS_NATIVE function testSuccess176() { } function C_init674(integer this259) { construct_C_B117(this_259); } function construct_C_B117(integer this516) { local string x441 construct_C_B_A133(this_516); x_441 = "B"; test_s_111 = (test_s_111 + x_441); } function construct_C_B_A133(integer this189) { local string x128 x_128 = "A"; test_s_111 = (test_s_111 + x_128); } function new_C975() returns integer { local integer this151 this_151 = alloc_C210(); construct_C360(this_151); return this_151; } function construct_C360(integer this205) { C_init674(this_205); test_s_111 = (test_s_111 + "C"); } function C_onDestroy172(integer this704) { test_s_111 = (test_s_111 + "c"); test_s_111 = (test_s_111 + "b"); test_s_111 = (test_s_111 + "a"); } function destroyC185(integer this480) { C_onDestroy172(this_480); dealloc_C981(this_480); } function alloc_C210() returns integer { local integer this159 if (C_firstFree_212 == 0) { if (C_maxIndex_486 < 32768) { C_maxIndex_486 = (C_maxIndex_486 + 1); this_159 = C_maxIndex_486; C_typeId_527[this_159] = 1; } else { error591("Out of memory: Could not create C."); this_159 = 0; }; } else { C_firstFree_212 = (C_firstFree_212 - 1); this_159 = C_nextFree_174[C_firstFree_212]; C_typeId_527[this_159] = 1; }; return this_159; } function error591(string msg846) { $debugPrint936((msg_846 + (" " + #getStackTrace()))); } function dealloc_C981(integer obj908) { if (C_typeId_527[obj_908] == 0) { error591("Double free: object of type C"); } else { C_nextFree_174[C_firstFree_212] = obj_908; C_firstFree_212 = (C_firstFree_212 + 1); C_typeId_527[obj_908] = 0; }; } function dispatch_C_destroyC136(integer this181) { if (C_typeId_527[this_181] == 0) { if (this_181 == 0) { error591("Nullpointer exception when calling C.C"); } else { error591("Called C.C on invalid object."); }; } else { }; destroyC185(this_181); }