4.4BSD/usr/src/contrib/emacs-18.57/lisp/sort.elc
(provide (quote sort))
(defun sort-subr (reverse nextrecfun endrecfun &optional startkeyfun endkeyfun) "\
General text sorting routine to divide buffer into records and sort them.
Arguments are REVERSE NEXTRECFUN ENDRECFUN &optional STARTKEYFUN ENDKEYFUN.
We consider this portion of the buffer to be divided into disjoint pieces
called sort records. A portion of each sort record (perhaps all of it)
is designated as the sort key. The records are rearranged in the buffer
in order by their sort keys. The records may or may not be contiguous.
Usually the records are rearranged in order of ascending sort key.
If REVERSE is non-nil, they are rearranged in order of descending sort key.
The next four arguments are functions to be called to move point
across a sort record. They will be called many times from within sort-subr.
NEXTRECFUN is called with point at the end of the previous record.
It moves point to the start of the next record.
The first record is assumed to start at the position of point when sort-subr
is called.
ENDRECFUN is is called with point within the record.
It should move point to the end of the record.
STARTKEYFUN may moves from the start of the record to the start of the key.
It may return either return a non-nil value to be used as the key, or
else the key will be the substring between the values of point after
STARTKEYFUN and ENDKEYFUN are called. If STARTKEYFUN is nil, the key
starts at the beginning of the record.
ENDKEYFUN moves from the start of the sort key to the end of the sort key.
ENDRECFUN may be nil if STARTKEYFUN returns a value or if it would be the
same as ENDRECFUN." (byte-code "!
$!? Ƃ} # !!!L @@!<