[+] Added exported functions for array sorting:
// Sorts given integer array in ascending order
procedure SortInt32 (Arr: pointer to array of integer; MinInd, MaxInd: integer); stdcall;
// Sorts given integer array in ascending order using custom ERM comparator function
procedure Erm_CustomStableSortInt32 (Arr: pointer to array of integer; MinInd, MaxInd: integer; ComparatorFuncId: integer; State: integer); stdcall;
The caller passes ID of ERM function, which will be used for items comparison. The function must return:
- 0 if two values are equal;
- positive number if the first value is greater than the second one (i.e. +1);
- negative number if the first value is smaller, than the second one (i.e. -1).
The comparator function prototype is:
Function will always receive special 'State' argument, containing the value, you specified calling Erm_CustomStableSortInt32.
This value may hold array ID, some structure address or any other useful custom data.