// ----------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------


#ifndef _CQCUSER_
#define _CQCUSER_

//#define TESTPROGRAM

#ifdef TESTPROGRAM
#include <stdio.h>
#include <stdlib.h>
#endif


#include "CUsrDct.h"
#include "UExtend.h"
#include "TSpell.h"
// #include "user.cpp"

#ifndef TRUE
#define TRUE  (1)
#define FALSE (0)
#endif

#define inMsDb		(1)
#define inDbChar	(2)
#define inMiss 		(4)
#define inTrans 	(8)
#define inExtra 	(16)
#define	inWrong		(32)
#define inDouble 	(64)



//#define TEST
#define MAXWORDLENGTH        (40)

class CQCUser : public CUserDict
{
public:
       short QCFind(char *Word, char *Suggestion, CallBackProc CallBack);
       short QCNext(char *Word, char *Suggestion, CallBackProc CallBack);

       CQCUser(short NumBuffers, FioParam * theFile );
       ~CQCUser();

       #ifdef TESTPROGRAM
       short CheckDoubleLetter(char *Word, char *Suggestion);
       short CheckMissingDouble(char *Word, char *Suggestion);
       short CheckTransposedLetters(char *Word, char *Suggestion);
       short CheckExtraLetter(char *Word, char *Suggestion);
       short CheckOneWrongAt(short Position, char *Word, char *Suggestion);
       short CheckWrongLetter(char *Word, char *Suggestion);
       short CheckMissingLetter(char *Word, char *Suggestion);
       short CheckDoubleWord(char *Word, char *Suggestion);
       #endif

protected:


private:

	 short Same(char *Word1,char *Word2);

	   #ifndef TESTPROGRAM
      short CheckDoubleLetter(char *Word, char *Suggestion);
      short CheckMissingDouble(char *Word, char *Suggestion);
	   short CheckTransposedLetters(char *Word, char *Suggestion);
	   short CheckExtraLetter(char *Word, char *Suggestion);
	   short CheckOneWrongAt(short Position, char *Word, char *Suggestion);
	   short CheckWrongLetter(char *Word, char *Suggestion);
	   short CheckMissingLetter(char *Word, char *Suggestion);
       short CheckDoubleWord(char *Word, char *Suggestion);
	   #endif
	
	   short	inOne;		// in One Wrong;
	   short	inFlag;
	   
	   short	Length;		// string length 
	   short 	CMD_Loop;	// loop counter in Check Missing Word
	   short 	CDL_Loop;	// loop counter in Check Double Word
	   short 	CTL_Loop1;	// loop counter in Check Transposed Letters
	   short 	CTL_Loop2;	// loop counter in Check Transposed Letters
	   short	CEL_Loop;	// loop counter in Check Extra Letter
	   char  	COW_Loop;	// loop counter in Check One Wrong At
	   char		COW_Temp;	// temporary in Check One Wrong At
	   short	CWL_Loop;	// loop counter in Check Wrong Letter
	   short 	CML_Loop;	// loop counter in Check Missing Letter
	   short	CDW_Loop;	// loop counter in Check Double Word
	   
	   char Cursor[MAXWORDLENGTH+1];
	   	   
	// in Missing Letter;

};


#endif

