{Specs for Routines for handling IFF plus files.  Full code is in IFFUTILS}
{Full documentation commented in at the end of IFFUTILS.}
{J. Butler 12 Jan 86}

const iff_not_magic=16_81;       iff_no_file = 16_82;
      iff_wrong_length = 16_83;  iff_header_too_short = 16_84;
      iff_last_one = 16_84;
      iff_read=0;                iff_write=1;

type  iffhdr_fm = record
      hlen, datatype, ht, wid, signed, fov_ht, fov_wid, stereo, 
      baseline, vergence, gaze, id, processed: integer;
      fstop, focus, appno, images, subs, xoff, yoff, aspect:integer;
      mapaddr, mapwid, maplen, context, app:integer; 
      title: string [255];
      date, time: string[8];
end;

var   iff_error: array [iff_not_magic..iff_last_one] of string [31];

function IFF_OPEN_FILE(
filename: string[255]; var iffh:iffhdr_fm; readwrite:integer):integer; extern;
{opens an IFF file for input or output.  Result=0 if it succeeds #0 otherwise}
{Note uses stream 1 for output}

procedure IFF_CLOSE_FILE(var iffh:iffhdr_fm); extern;
{closes an IFF OPENed file}

function IFF_READ_HEADER(var iffh:iffhdr_fm):integer; extern;
{read header from an IFF OPENed file and puts field values in IFFH}

function IFF_WRITE_HEADER(var iffh:iffhdr_fm):integer; extern;
{writes a valid IFF header from values supplied in IFFH. Uses sensible defaults}

procedure IFF_SHOW_HEADER(iffh:iffhdr_fm; detail:integer); extern;
{Dumps some of the more interesting IFF header values to current o/p stream}

function IFF_READ_IMAGE(var iffh: iffhdr_fm; address:integer):integer; extern;
{reads the image from an IFF OPENed file which has had the header read by}
{IFF READ HEADER (normally).  Will expand the image if compressed}

function IFF_WRITE_IMAGE(var iffh: iffhdr_fm; address:integer):integer; extern;
{writes the image to an IFF OPENed file which has had the header written by}
{IFF_WRITE_HEADER (normally).  Will compress the image if IFFHDR.DATATYPE has}
{the compress bits set}

procedure IFF_SETUP;
{initialises a few variables (e.g. iff_error above)}
begin
   iff_error[16_81] := 'File has wrong magic number    ';
   iff_error[16_82] := 'File does not exist            ';
   iff_error[16_83] := 'File length inconsistent       ';
   iff_error[16_84] := 'Header too short'
end;
