array A_nextFree734 integer A_firstFree105 integer A_maxIndex356 array A_typeId186 integer A_firstFree105 = 0 integer A_maxIndex356 = 0 function initGlobals612() { } function main165() { initGlobals612(); init_Test162(); } function config414() { } function init_Test162() { local integer a240 local integer e978 local integer count1210 local integer count2530 a_240 = new_A188(); new_A188(); new_A188(); new_A188(); e_978 = new_A188(); count1_210 = maxInstanceCount173(1); dispatch_A_destroyA272(a_240); dispatch_A_destroyA272(e_978); count2_530 = maxInstanceCount173(1); if ((count1_210 == 5) and (count2_530 == 5)) { testSuccess207(); } else { }; } IS_NATIVE function testSuccess207() { } function new_A188() returns integer { local integer this203 local integer this156 if (A_firstFree_105 == 0) { if (A_maxIndex_356 < 32768) { A_maxIndex_356 = (A_maxIndex_356 + 1); this_156 = A_maxIndex_356; A_typeId_186[this_156] = 1; } else { error291("Out of memory: Could not create A."); this_156 = 0; }; } else { A_firstFree_105 = (A_firstFree_105 - 1); this_156 = A_nextFree_734[A_firstFree_105]; A_typeId_186[this_156] = 1; }; this_203 = this_156; return this_203; } function maxInstanceCount173(integer typeId977) returns integer { return A_maxIndex_356; return 0; } function error291(string msg507) { $debugPrint211((msg_507 + (" " + #getStackTrace()))); } function dispatch_A_destroyA272(integer this540) { local integer this132 local integer obj956 if (A_typeId_186[this_540] == 0) { if (this_540 == 0) { error291("Nullpointer exception when calling A.A"); } else { error291("Called A.A on invalid object."); }; } else { }; this_132 = this_540; obj_956 = this_132; if (A_typeId_186[obj_956] == 0) { error291("Double free: object of type A"); } else { A_nextFree_734[A_firstFree_105] = obj_956; A_firstFree_105 = (A_firstFree_105 + 1); A_typeId_186[obj_956] = 0; }; }