Lugaru's Epsilon
Programmer's
Editor 14.04

Context:
Epsilon User's Manual and Reference
   Primitives and EEL Subroutines
      Buffer Primitives
         . . .
         Moving by Lines
         Other Movement Functions
         Sorting Primitives
         Other Formatting Functions
         Comparing Primitives
         . . .
      Display Primitives
         Creating & Destroying Windows
         Window Resizing Primitives
         Preserving Window Arrangements
         . . .
         Colors
      . . .

Previous   Up    Next
Other Movement Functions  Primitives and EEL Subroutines   Other Formatting Functions


Epsilon User's Manual and Reference > Primitives and EEL Subroutines > Buffer Primitives >

Sorting Primitives

buffer_sort(char *newbuf, ?int col, int rev)
do_buffer_sort(char *newbuf, int col, int rev)
sort_another(char *buf, int col, int rev)
do_sort_region(int from, int to, int col, int rev)
char show_status;

The EEL primitive buffer_sort( ) sorts the lines of the current buffer alphabetically. It does not modify the buffer, but rather inserts a sorted copy into the named buffer (which must be different). It performs each comparison starting at column col, which is optional and defaults to 0 (the first column). If the case_fold variable is nonzero, sorting ignores the case of letters. It sorts lines in reverse order if the optional rev parameter is 1, not 0. (To alter folding rules, see Character Types.)

If the variable show_status is nonzero, Epsilon will display progress messages as the sort progresses. Otherwise, no status messages appear.

The do_buffer_sort( ) subroutine is similar, but respects the sort-case-fold variable, not case-fold like buffer_sort( ).

The sort_another( ) subroutine takes the name of a buffer and sorts it in place. The parameter col specifies the column to sort on, and rev, if nonzero, requests a reverse sort.

The do_sort_region( ) subroutine sorts a portion of the current buffer in place. The from and to parameters specify the region to sort. The col parameter specifies the column to sort on, and the rev parameter, if nonzero, requests a reverse sort.

If the user presses the abort key during sorting, Epsilon's behavior depends upon the value of the abort_searching variable. If 0, the key is ignored and the sort will run to completion. If ABORT_JUMP, Epsilon aborts the sort and jumps by calling the check_abort( ) primitive. If ABORT_ERROR, Epsilon aborts the sort and returns ABORT_ERROR. Whenever Epsilon aborts a sort, nothing gets inserted in the newbuf buffer. (For the subroutines that sort in place, the buffer is not changed.) Except when aborted, the buffer_sort( ) primitive and all the sorting subroutines described above return 0.



Previous   Up    Next
Other Movement Functions  Primitives and EEL Subroutines   Other Formatting Functions


Lugaru Epsilon Programmer's Editor 14.04 manual. Copyright (C) 1984, 2021 by Lugaru Software Ltd. All rights reserved.