Lugaru's Epsilon
Programmer's
Editor 14.04

Context:
Epsilon User's Manual and Reference
   Primitives and EEL Subroutines
      Buffer Primitives
         . . .
         Narrowing
         Undo Primitives
         Searching Primitives
            Regular Expression Searching
            Searching Subroutines
         Moving by Lines
         Other Movement Functions
         . . .
      Display Primitives
         Creating & Destroying Windows
         Window Resizing Primitives
         Preserving Window Arrangements
         . . .
         Colors
      . . .

Previous   Up    Next
Undo Primitives  Primitives and EEL Subroutines   Regular Expression Searching


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

Searching Primitives

user int matchstart;
user int matchend;
int search(int dir, char *str)
user short abort_searching;
#define ABORT_JUMP      -1
#define ABORT_ERROR     -2

The search primitives each look for the first occurrence of some text in a particular direction from point. Use 1 to specify forward, -1 to specify backward. They move point to the far end of the match, and set the matchstart and matchend variables to the near and far ends of the match, respectively. For example, if the buffer contains "abcd" and you search backward from the end for "bc", point and matchend will be 1 (between the "a" and the "b") and matchstart will be 3. If the search text does not appear in the buffer, point goes to the appropriate end of the buffer. These primitives return 1 if they find the text and 0 if not.

The most basic searching function is the search( ) primitive. It takes a direction and a string, and searches for the string. It returns 1 if it finds the text, or 0 if it does not.

If the user presses the abort key during searching, Epsilon's behavior depends upon the value of the abort_searching variable. If it's ABORT_IGNORE (0), the key is ignored and the search continues. If it's ABORT_JUMP (the default), Epsilon aborts the search and jumps by calling the check_abort( ) primitive. If it's ABORT_ERROR, Epsilon aborts the search and returns the value ABORT_ERROR. The search( ), re_search( ), re_match( ), and buffer_sort( ) primitives all use the abort_searching variable to control aborting.

user buffer short case_fold;

If the case-fold buffer-specific variable is nonzero, characters that match except for case count as a match. Otherwise, only exact matches (including case) count. To alter folding rules, see Character Types.



Previous   Up    Next
Undo Primitives  Primitives and EEL Subroutines   Regular Expression Searching


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