|Burwell||Electronics & DIY||Family History||Hi-Fi History||Misc||Natural History||Wild Food||Walks|
|For sale||DIY tips||Sinclair Radionics||Circuits & technical||Risc OS|
To understand the search process it is important to remember that a file in memory is stored as a long string of Bytes, each Byte representing a character. The search expression consists of a number of separate elements strung together, with spaces as desired to make the expression readable. Spaces outside of search element are ignored. The diagram shows six elements, e1 to e6.
During a search, StrongED maintains three pointers. Pointer Ts (Text Start) points to the Start of the Text string currently being inspected for a match, and is tied to the first element in the Search expression. Tm (Text Match) points to the byte currently being inspected for a Match against the Search expression.
Em (Element Match?) points to the search element currently doing the inspecting.
At the start of a search, Tm points to the same place as Ts. Em points to e1. If no match is found, all are moved on together one byte in the text and so on until the text matches e1. Now e2 is matched against the next byte(s) of the text - in this case starting at the letter e. If these bytes match, Tm moves on to the end of the matched section and Em moves to e3.
Thus the matching continues in chunks until one if two things happens:
There is also an element ~ which causes search to look ahead without moving the Text Match (Tm) pointer - as shown by Ta (Text ahead) - until the element qualified by the ~ fails to match it (in other words, the ~ qualifier causes any bytes that match the qualified element to be ignored).
The text byte that caused the failure (i.e. is not ignored) is then matched against the following element.
Top of page