Filters, as provided on the Z88, are a fairly general means of achieving simple context-independent transformations in a character sequence. Their anticipated use is in simple text processing, but they may potentially be used for more complex tasks. The calls for handling filters are:
...
Flo
open
...
a
...
filter,
...
returning
...
a
...
filter
...
handleGN_
...
Flw
write
...
a
...
character
...
to
...
a
...
filterGN_
...
Flr
read
...
a
...
character
...
from
...
a
...
filterGN_
...
Fpb
push
...
a
...
character
...
back
...
into
...
the
...
filterGN_
...
Flf
flush
...
the
...
filterGN_
...
Flc
close
...
the
...
filter
To use a filter, the programmer must first set up a 'Filter Definition Table' (FDT), which determines the operation of the filter. The filter must then be opened with GN_Flo with the programmer giving the address of the FDT and setting various input parameters. GN_Flo returns a filter handle which the other filter routines takes as input. Once open the filter can be written to a byte at a time using GN_Flw and read from (again a byte at a time) using GN_Flr. The bytes read out of the filter will be the processed form of the input; if processing has occurred on a particular character this is indicated ny Fz = 1 on return from GN_Flr. While the filter is open, it can be flushed, ie. all the characters written to it, but not read out, can be discarded. It is also possible to push one character back into the filter, before a subsequent filter read takes place. Finally the filter is closed using GN_Flc, which apart from freeing the handle and buffers associated with the filter also returns information as to how many characters have been written to and read from the filter.
...