/***********************************************************************\

	Product Number: SC-06-5.7

	Version: rev5.7

	Product Name: Spelling Components - CLAM

	Filename: clam.h


	This document contains private and confidential information and
	its disclosure does not constitute publication.  Some of the
	information herein also may appear in United States and or
	Foreign Patents Pending.  All rights are reserved by Proximity
	Technology Inc., except those specifically granted by license.

\***********************************************************************/

#ifndef SC_CLAM
#define SC_CLAM

#ifndef _PROXLIB
#include <proxlib.h>
#endif

#ifndef _PROXIO
#include <proxio.h>
#endif

#ifndef SC_SCDEF
#include "scdef.h"
#endif

/* flags to be maintained in the cl_flags element of the CLAM structure */ 

#define CL_REV          5               /* Clam version */
#define CL_INIT         0x10            /* whether to initialize CLAM file */
#define CL_REORG        0x20            /* split at block end instead of mid*/
#define CL_READONLY     0x40            /* CLAM opened read only */
#define CL_CORRUPT      0x80            /* CLAM file is corrupted */
#define CL_LATEST       0x80            /* set to forbid earlier rev clams */

/* macros for easy access to these flags */

#define cl_corrupt(clamptr) (clamptr->cl_flags & CL_CORRUPT)
#define cl_rdonly(clamptr) (clamptr->cl_flags & CL_READONLY)

/* end-of-file indicator returned from clamnext() */ 

#define CL_EOF          (-2)

/* CLAM control structure */

typedef struct {
	char    cl_screv;       /* revision code */
	char    cl_env;         /* language code */
	char    cl_flags;       /* control flags (see #defines) */
	HANDLE  cl_file;        /* file access handle */
	int     cl_nblks;       /* number of MM_BLKSIZE blocks in CLAM file */

	UCHAR   *cl_blk0;       /* in-memory copy of a block being examined */
	UCHAR   *cl_blkptr;     /* current decompression point. */

	/* These fields are used by clamnext. */

	int     cl_blksav;      /* index into current block */
	int     cl_searchb;     /* position in file of current block */
	UCHAR   cl_word[LONGWORD];/* most recent word decompressed from clam */
} CLAM;

#endif
