array A_nextFree170 integer A_firstFree704 integer A_maxIndex426 array A_typeId803 integer A_firstFree704 = 0 integer A_maxIndex426 = 0 function initGlobals215() { A_firstFree_704 = 0; A_maxIndex_426 = 0; } function main738() { initGlobals215(); init_Test148(); } function config176() { } function init_Test148() { local integer a644 local integer e105 local integer count1649 local integer count2837 a_644 = new_A819(); new_A819(); new_A819(); new_A819(); e_105 = new_A819(); count1_649 = maxInstanceCount151(1); dispatch_A_destroyA178(a_644); dispatch_A_destroyA178(e_105); count2_837 = maxInstanceCount151(1); if ((count1_649 == 5) and (count2_837 == 5)) { testSuccess186(); } else { }; } IS_NATIVE function testSuccess186() { } function A_init895(integer this458) { } function new_A819() returns integer { local integer this102 this_102 = alloc_A476(); construct_A154(this_102); return this_102; } function construct_A154(integer this332) { A_init895(this_332); } function A_onDestroy348(integer this325) { } function destroyA108(integer this154) { A_onDestroy348(this_154); dealloc_A602(this_154); } function maxInstanceCount151(integer typeId130) returns integer { return A_maxIndex_426; return 0; } function alloc_A476() returns integer { local integer this118 if (A_firstFree_704 == 0) { if (A_maxIndex_426 < 32768) { A_maxIndex_426 = (A_maxIndex_426 + 1); this_118 = A_maxIndex_426; A_typeId_803[this_118] = 1; } else { error142("Out of memory: Could not create A."); this_118 = 0; }; } else { A_firstFree_704 = (A_firstFree_704 - 1); this_118 = A_nextFree_170[A_firstFree_704]; A_typeId_803[this_118] = 1; }; return this_118; } function error142(string msg125) { $debugPrint210((msg_125 + (" " + #getStackTrace()))); } function dealloc_A602(integer obj213) { if (A_typeId_803[obj_213] == 0) { error142("Double free: object of type A"); } else { A_nextFree_170[A_firstFree_704] = obj_213; A_firstFree_704 = (A_firstFree_704 + 1); A_typeId_803[obj_213] = 0; }; } function dispatch_A_destroyA178(integer this437) { if (A_typeId_803[this_437] == 0) { if (this_437 == 0) { error142("Nullpointer exception when calling A.A"); } else { error142("Called A.A on invalid object."); }; } else { }; destroyA108(this_437); }