
//	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-
//
//	Gerbil
//
//	Copyright (c) 2001, Bruce Moreland.  All rights reserved.
//
//	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-
//
//	This file is part of the Gerbil chess program project.
//
//	Gerbil is free software; you can redistribute it and/or modify it under
//	the terms of the GNU General Public License as published by the Free
//	Software Foundation; either version 2 of the License, or (at your option)
//	any later version.
//
//	Gerbil is distributed in the hope that it will be useful, but WITHOUT ANY
//	WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
//	FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
//	details.
//
//	You should have received a copy of the GNU General Public License along
//	with Gerbil; if not, write to the Free Software Foundation, Inc.,
//	59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
//
//	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-

//	BOOL used to come from <windows.h>.  Define it ourselves for the
//	Linux port (matches the "typedef int BOOL;" in engine/engine.h).

typedef	int	BOOL;

#define	wmodeANALYZE	0
#define	wmodeTHINK		1

#define	bfXBOARD		0x01
#define	bfCMDLINE		0x02

#define	coWHITE		0			// This stuff is all for the protover 1
#define	coBLACK		1			//  edit command.
#define	coMAX		2

#define	pcPAWN		0
#define	pcKNIGHT	1
#define	pcBISHOP	2
#define	pcROOK		3
#define	pcQUEEN		4
#define	pcKING		5
#define	pcMAX		6

#define	csqMAX		64

typedef	struct	tagPCCO {
	char	pc;
	char	co;
}	PCCO;

typedef	struct	tagIVARS {
	int	wmode;
	BOOL	fForce;
	BOOL	fDidInitEngine;
	unsigned long tmMyTime;
	unsigned long tmTheirTime;
	int	iProtover;
	int	coOnMove;				// If in protover 1, the side to move now.
	int	coEditing;				// If in protover 1, the color whose pieces I
								//  am adding.
	PCCO	argpcco[csqMAX];	// If it protover 1, the pieces being added
	BOOL	bfMode;
	BOOL	fEditing;
}	IVARS;

IVARS	s_ivars;

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

void VAssertFailedW(const char * szMod, int iLine);

#define	Assert(cond)		if (!(cond)) VAssertFailedW(s_aszModule, __LINE__)

#define	fTRUE	1
#define	fFALSE	0

void VSendToWinboard(const char * szFmt, ...);
void VProcessEngineCommand(void * pv, BOOL fThinking);
BOOL FInitEngineThread(int argc, char * argv[]);
void VSendToEngine(const char * szFmt, ...);
void VStripWb(char * sz);
int	CszVectorizeWb(char * sz, char * rgsz[]);
void VErrorWb(char * szMsg, char * szCmd);
