SPOOLER(2)                                             SPOOLER(2)

     NAME
          spooler, view, print - file spooler module interface for use
          with spool

     SYNOPSIS
          include "spooler.m";
          sppoler := load Spooler MOD->PATH;

          Sfile: adt {
               fd:  ref Sys->FD;   # avail to be used by spooler
               sval: string;       # avail to be used by spooler

               start:         fn(path: string, endc: chan of string): (ref Sfile, string);
               stop:     fn(file: self ref Sfile);
               status:   fn(file: self ref Sfile): string;
          };

          init:          fn(args: list of string);
          status:   fn(): string;
          debug:    int;

     DESCRIPTION
          A spooler is a module that implements this interface. It is
          intented to be given as an argument for spool(4), which is a
          file server that implements the spooling interface seen by
          the user.

          Each file being spooled is represented by a Sfile.  The
          function Sfile.start is called to start spooling for a file
          with a path name. The function must send either nil or an
          error string through endc when the file has been processed.
          But note that endc may be nil and nothing has to be sent in
          that case.  The function must return an appropriate Sfile
          containing what is needed to implement Sfile.stop and
          Sfile.status . Both Sfile.fd and Sfile.sval are available
          for internal use of the module implementor.

          Sfile.stop must stop processing the file, and release any
          resource held for its processing.

          Sfile.status must return a string with the status for the
          spool request corresponding to the file.

          Status must return a string (perhaps multiple lines) with
          the status of the spooling service.

          The global debug will be set to either zero or non-zero from
          outside to ask debug diagnostics when set.

          Clients must call init before calling any other service from

     SPOOLER(2)                                             SPOOLER(2)

          a Spooler module

     EXAMPLE
          See /usr/octopus/port/lib/view.b or
          /usr/octopus/MacOSX/print.b

     SEE ALSO
          spool(4).