Skip to main content

Appendix III: Utility Routines and Data Formats (2)

CSINIT(FAX)​

NAME​

csinit - initiate the Clean and Simple interface

SYNOPSIS​

int  csinit();

DESCRIPTION​

This routine is called to initiate the Clean and Simple in-terface for the calling process. Its code is re-entrant, so that only one copy is needed for all processes in a system.

This routine returns the task identifier, which must be used on all subsequent interface calls.

SEE ALSO​

csopen(fax), csread(fax), cswrite(fax), fitter(fax)

CSOPEN(FAX)​

NAME​

csopen - establish the Clean and Simple connection

SYNOPSIS​

char *csopen(tid);

int tid;

DESCRIPTION​

A process calls this routine, waiting to be scheduled. Its code is re-entrant, so that only one copy is needed for all processes in a system.

The task identifier tid is the word returned from the csinit call. When the fitter process has established the Clean and Simple connection for the process, this routine returns the pointer to the parameter string of the corresponding task command.

SEE ALSO​

csinit(fax), csread(fax), cswrite(fax), fitter(fax)

CSREAD(FAX)​

NAME​

csread - read data from the Clean and Simple interface

SYNOPSIS​

char *csread(tid, need);

int tid, need;

DESCRIPTION​

This routine is called to read data from the Clean and Sim-ple interface. Its code is re-entrant, so that only one copy is needed for all processes in a system.

The task identifier tid is the word returned from the csinit call. The need parameter indicates the number of bytes that are required. This routine returns a pointer to a buffer with this much data in it. This is usually more efficient as it means that the data does not have to be reblocked.

DIAGNOSTICS​

If the returned value is 0, the end of data is reached.

BUGS​

Funnies happen at the end of data to be read. The csread() call has no way of saying that the final buffer is partly filled. Thus if you ask for more data, you hang forever. But if the data structures are working correctly, this should never happen.

SEE ALSO​

csinit(fax), cswrite(fax), fitter(fax)

CSWRITE(FAX)​

NAME​

cswrite - write data to the Clean and Simple interface

SYNOPSIS​

char *cswrite(tid, need);

int tid, need;

DESCRIPTION​

This routine is call to write data to the Clean and Simple interface. Its code is re-entrant, so that only one copy is needed for all processes in a system.

The task identifier tid is the word returned from the csinit call. The need parameter indicates the number of bytes that are to be written. This routine returns a write buffer of the required length, to which the user data can be copied. The subsequent cswrite() call automatically releases the previous write buffer.

The cswrite() call with need set to 0 indicates the end of data, closing the current Clean and Simple connection.

BUGS​

As indicated, the write buffer must be filled up before the next cswrite() call.

SEE ALSO​

csinit(fax), csread(fax), fitter(fax)

GETL(FAX)​

NAME​

getl - get a line vector from the Clean and Simple interface

SYNOPSIS​

int  *getl(tid);

int tid, need;

DESCRIPTION​

This routine is called to read a line vector from the Clean and Simple interface. Its code is re-entrant, so that only one copy is needed for all processes in a system.

The task identifier tid is the word returned from the csinit call. The routine returns the pointer to the buffer where the line vector is stored.

DIAGNOSTICS​

0 will be returned when end of file is reached.

BUGS​

Any memory violation causes the whole task chain to be aborted.

SEE ALSO​

vector(fax), putl(fax), fitter(fax)

PUTL(FAX)​

NAME​

putl - put a line vector to the Clean and Simple Interface

SYNOPSIS​

putl(tid, buf);

int tid, *buf;

DESCRIPTION​

This routine is called to write a line vector to the Clean and Simple interface. Its code is re-entrant, so that only one copy is needed for all processes in a system.

The task identifier tid is the word returned from the csinit call. The line vector is stored in a buffer pointed by buf.

SEE ALSO​

vector(fax), getl(fax), fitter(fax)