GenEx: factor out reusable SORT comparator and option-parsing helpers

Prepare for a genex-driven SORT comparator without changing behavior: let
cmList::sort() accept a caller-supplied comparison function, and give the
$<LIST:SORT> COMPARE:/CASE:/ORDER: option parsing a single definition shared
with the canned handler.  The new feature can then reuse both rather than
duplicating the sort plumbing and the option syntax.

Issue: #27892
3 files changed