Charles.Forsyth20060303-partialeea662d19 years agoHistory
112 lines · 2.4 KB · Text
RawDownload
.TH FILTER 2.SH NAMEfilter \- data processing interface.SH SYNOPSIS.Binclude "filter.m";.br.BI "filter := load Filter " filterpath ";" .EXRq: 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;.EE.SH DESCRIPTION.B Filterdefines a general module interface for byte-stream processing.This manual page documents how to use the interface, andby implication how a.B Filtermodule should behave.There is a different implementation module for each filter typeand algorithm (eg, for compression or line encoding).All implementations are instances of type.BR Filter ,loaded from the Dis file.IR 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.IR filter-deflate (2)and following manual pages..PP.B Initmust be called before any other operation of a filter module..PP.B Startsets the filter going;.I paramcan be used to pass any filter-specific informationto the processor..B Startspawns a new thread to do the processing; it returnsa channel that is used to receive requests from thefilter.The first message sent is always.BR Rq.Start ;.I pidis the process id of the new process spawned..PPSubsequent messages are:.TF Rq.Finished.PD.TP.B Rq.FillA request by the filter to fill.I bufwith data.The number of bytes that have actuallybeen placed in the buffer should be senton.IR reply .If \-1 is sent, the filter will terminate.If the value is 0, the filter will terminate once it has processedall its input..TP.B Rq.Result.I Bufcontains data from the filter.Receipt of the the data must be acknowledgedby sending a value on.IR reply .If the value is \-1, the filter will terminate..TP.B Rq.FinishedThe filter has finished processing..I Bufcontains any data that was not consumedby the filter. The filter terminates aftersending this message..TP.B Rq.InfoThis message is used to send a string ofarbitrary information from the filterduring the course of its processing..TP.B Rq.ErrorThe filter has encountered an error when processing..I Eis a string describing the error. The filter terminatesafter sending this message..SH SOURCE.B /module/filter.m.SH SEE ALSO.IR gzip (1),.IR filter-deflate (2),.IR filter-slip (2)