| FILTER(2) | System Calls Manual | FILTER(2) |
filter - data processing interface
include "filter.m";
filter := load Filter filterpath;
Rq: adt {
pick {
Start =>
pid: int;
Fill or Result =>
buf: array of byte;
reply: chan of int;
Finished =>
buf: array of byte;
Info =>
msg: string;
Error =>
e: string;
}
};
init: fn();
start: fn(param: string): chan of ref Rq;
Filter defines a general module interface for byte-stream processing. This manual page documents how to use the interface, and by implication how a Filter module should behave. There is a different implementation module for each filter type and algorithm (eg, for compression or line encoding). All implementations are instances of type Filter, loaded from the Dis file filterpath, given in the manual page for each standard filter (or you can write your own to match this specification). For details of each existing filter module, see filter-deflate (2) and following manual pages.
Init must be called before any other operation of a filter module.
Start sets the filter going; param can be used to pass any filter-specific information to the processor. Start spawns a new thread to do the processing; it returns a channel that is used to receive requests from the filter. The first message sent is always Rq.Start; pid is the process id of the new process spawned.
Subsequent messages are:
/module/filter.m