#define TN_PORT 23
char*
-safeStrCpy( char *dst, const char *src, size_t count )
+safeStrCpy (char *dst, const char *src, size_t count)
{ // [HGM] made safe
int i;
assert( dst != NULL );
* We used this for all compiler
*/
double
-u64ToDouble(u64 value)
+u64ToDouble (u64 value)
{
double r;
u64 tmp = value & u64Const(0x7fffffffffffffff);
by this function.
*/
int
-PosFlags(index)
+PosFlags (index)
{
int flags = F_ALL_CASTLE_OK;
if ((index % 2) == 0) flags |= F_WHITE_ON_MOVE;
"++++", etc. Also strips ()'s */
int
-string_to_rating(str)
- char *str;
+string_to_rating (char *str)
{
while(*str && !isdigit(*str)) ++str;
if (!*str)
}
void
-ClearProgramStats()
+ClearProgramStats ()
{
/* Init programStats */
programStats.movelist[0] = 0;
}
void
-CommonEngineInit()
+CommonEngineInit ()
{ // [HGM] moved some code here from InitBackend1 that has to be done after both engines have contributed their settings
if (appData.firstPlaysBlack) {
first.twoMachinesColor = "black\n";
}
void
-UnloadEngine(ChessProgramState *cps)
+UnloadEngine (ChessProgramState *cps)
{
/* Kill off first chess program */
if (cps->isr != NULL)
}
void
-ClearOptions(ChessProgramState *cps)
+ClearOptions (ChessProgramState *cps)
{
int i;
cps->nrOptions = cps->comboCnt = 0;
};
void
-InitEngine(ChessProgramState *cps, int n)
+InitEngine (ChessProgramState *cps, int n)
{ // [HGM] all engine initialiation put in a function that does one engine
ClearOptions(cps);
ChessProgramState *savCps;
void
-LoadEngine()
+LoadEngine ()
{
int i;
if(WaitForEngine(savCps, LoadEngine)) return;
}
void
-ReplaceEngine(ChessProgramState *cps, int n)
+ReplaceEngine (ChessProgramState *cps, int n)
{
EditGameEvent();
UnloadEngine(cps);
"-firstOptions \"\" -firstNPS -1 -fn \"\"";
void
-Load(ChessProgramState *cps, int i)
+Load (ChessProgramState *cps, int i)
{
char *p, *q, buf[MSG_SIZ], command[MSG_SIZ], buf2[MSG_SIZ];
if(engineLine && engineLine[0]) { // an engine was selected from the combo box
}
void
-InitTimeControls()
+InitTimeControls ()
{
int matched, min, sec;
/*
}
void
-InitBackEnd1()
+InitBackEnd1 ()
{
ShowThinkingEvent(); // [HGM] thinking: make sure post/nopost state is set according to options
}
-int NextIntegerFromString( char ** str, long * value )
+int
+NextIntegerFromString (char ** str, long * value)
{
int result = -1;
char * s = *str;
return result;
}
-int NextTimeControlFromString( char ** str, long * value )
+int
+NextTimeControlFromString (char ** str, long * value)
{
long temp;
int result = NextIntegerFromString( str, &temp );
return result;
}
-int NextSessionFromString( char ** str, int *moves, long * tc, long *inc, int *incType)
+int
+NextSessionFromString (char ** str, int *moves, long * tc, long *inc, int *incType)
{ /* [HGM] routine added to read '+moves/time' for secondary time control. */
int result = -1, type = 0; long temp, temp2;
return result;
}
-int GetTimeQuota(int movenr, int lastUsed, char *tcString)
+int
+GetTimeQuota (int movenr, int lastUsed, char *tcString)
{ /* [HGM] get time to add from the multi-session time-control string */
int incType, moves=1; /* kludge to force reading of first session */
long time, increment;
}
int
-ParseTimeControl(tc, ti, mps)
- char *tc;
- float ti;
- int mps;
+ParseTimeControl (char *tc, float ti, int mps)
{
long tc1;
long tc2;
}
void
-InitBackEnd2()
+InitBackEnd2 ()
{
if (appData.debugMode) {
fprintf(debugFP, "%s\n", programVersion);
}
int
-CalculateIndex(int index, int gameNr)
+CalculateIndex (int index, int gameNr)
{ // [HGM] autoinc: absolute way to determine load index from game number (taking auto-inc and rewind into account)
int res;
if(index > 0) return index; // fixed nmber
}
int
-LoadGameOrPosition(int gameNr)
+LoadGameOrPosition (int gameNr)
{ // [HGM] taken out of MatchEvent and NextMatchGame (to combine it)
if (*appData.loadGameFile != NULLCHAR) {
if (!LoadGameFromFile(appData.loadGameFile,
}
void
-ReserveGame(int gameNr, char resChar)
+ReserveGame (int gameNr, char resChar)
{
FILE *tf = fopen(appData.tourneyFile, "r+");
char *p, *q, c, buf[MSG_SIZ];
}
void
-MatchEvent(int mode)
+MatchEvent (int mode)
{ // [HGM] moved out of InitBackend3, to make it callable when match starts through menu
int dummy;
if(matchMode) { // already in match mode: switch it off
}
void
-HistorySet( char movelist[][2*MOVE_LEN], int first, int last, int current )
+HistorySet (char movelist[][2*MOVE_LEN], int first, int last, int current)
{
DisplayBook(current+1);
* Returns 0 if okay, error code if not.
*/
int
-establish()
+establish ()
{
char buf[MSG_SIZ];
}
}
-void EscapeExpand(char *p, char *q)
+void
+EscapeExpand (char *p, char *q)
{ // [HGM] initstring: routine to shape up string arguments
while(*p++ = *q++) if(p[-1] == '\\')
switch(*q++) {
}
void
-show_bytes(fp, buf, count)
- FILE *fp;
- char *buf;
- int count;
+show_bytes (FILE *fp, char *buf, int count)
{
while (count--) {
if (*buf < 040 || *(unsigned char *) buf > 0177) {
/* Returns an errno value */
int
-OutputMaybeTelnet(pr, message, count, outError)
- ProcRef pr;
- char *message;
- int count;
- int *outError;
+OutputMaybeTelnet (ProcRef pr, char *message, int count, int *outError)
{
char buf[8192], *p, *q, *buflim;
int left, newcount, outcount;
}
void
-read_from_player(isr, closure, message, count, error)
- InputSourceRef isr;
- VOIDSTAR closure;
- char *message;
- int count;
- int error;
+read_from_player (InputSourceRef isr, VOIDSTAR closure, char *message, int count, int error)
{
int outError, outCount;
static int gotEof = 0;
}
void
-KeepAlive()
+KeepAlive ()
{ // [HGM] alive: periodically send dummy (date) command to ICS to prevent time-out
if(!connectionAlive) DisplayFatalError("No response from ICS", 0, 1);
connectionAlive = FALSE; // only sticks if no response to 'date' command.
}
/* added routine for printf style output to ics */
-void ics_printf(char *format, ...)
+void
+ics_printf (char *format, ...)
{
char buffer[MSG_SIZ];
va_list args;
}
void
-SendToICS(s)
- char *s;
+SendToICS (char *s)
{
int count, outCount, outError;
without a delay causes problems when using timestamp on ICC
(at least on my machine). */
void
-SendToICSDelayed(s,msdelay)
- char *s;
- long msdelay;
+SendToICSDelayed (char *s, long msdelay)
{
int count, outCount, outError;
Also deletes any suffix starting with '('
*/
char *
-StripHighlightAndTitle(s)
- char *s;
+StripHighlightAndTitle (char *s)
{
static char retbuf[MSG_SIZ];
char *p = retbuf;
/* Remove all highlighting escape sequences in s */
char *
-StripHighlight(s)
- char *s;
+StripHighlight (char *s)
{
static char retbuf[MSG_SIZ];
char *p = retbuf;
char *variantNames[] = VARIANT_NAMES;
char *
-VariantName(v)
- VariantClass v;
+VariantName (VariantClass v)
{
return variantNames[v];
}
/* Identify a variant from the strings the chess servers use or the
PGN Variant tag names we use. */
VariantClass
-StringToVariant(e)
- char *e;
+StringToVariant (char *e)
{
char *p;
int wnum = -1;
copied into star_match.
*/
int
-looking_at(buf, index, pattern)
- char *buf;
- int *index;
- char *pattern;
+looking_at ( char *buf, int *index, char *pattern)
{
char *bufp = &buf[*index], *patternp = pattern;
int star_count = 0;
}
void
-SendToPlayer(data, length)
- char *data;
- int length;
+SendToPlayer (char *data, int length)
{
int error, outCount;
outCount = OutputToProcess(NoProc, data, length, &error);
}
void
-PackHolding(packed, holding)
- char packed[];
- char *holding;
+PackHolding (char packed[], char *holding)
{
char *p = holding;
char *q = packed;
/* Telnet protocol requests from the front end */
void
-TelnetRequest(ddww, option)
- unsigned char ddww, option;
+TelnetRequest (unsigned char ddww, unsigned char option)
{
unsigned char msg[3];
int outCount, outError;
}
void
-DoEcho()
+DoEcho ()
{
if (!appData.icsActive) return;
TelnetRequest(TN_DO, TN_ECHO);
}
void
-DontEcho()
+DontEcho ()
{
if (!appData.icsActive) return;
TelnetRequest(TN_DONT, TN_ECHO);
}
void
-CopyHoldings(Board board, char *holdings, ChessSquare lowestPiece)
+CopyHoldings (Board board, char *holdings, ChessSquare lowestPiece)
{
/* put the holdings sent to us by the server on the board holdings area */
int i, j, holdingsColumn, holdingsStartRow, direction, countsColumn;
void
-VariantSwitch(Board board, VariantClass newVariant)
+VariantSwitch (Board board, VariantClass newVariant)
{
int newHoldingsWidth, newWidth = 8, newHeight = 8, i, j;
static Board oldBoard;
extern int squareSize, lineGap;
void
-PlotSeekAd(int i)
+PlotSeekAd (int i)
{
int x, y, color = 0, r = ratingList[i]; float tc = tcList[i];
xList[i] = yList[i] = -100; // outside graph, so cannot be clicked
}
void
-AddAd(char *handle, char *rating, int base, int inc, char rated, char *type, int nr, Boolean plot)
+AddAd (char *handle, char *rating, int base, int inc, char rated, char *type, int nr, Boolean plot)
{
char buf[MSG_SIZ], *ext = "";
VariantClass v = StringToVariant(type);
}
void
-EraseSeekDot(int i)
+EraseSeekDot (int i)
{
int x = xList[i], y = yList[i], d=squareSize/4, k;
DrawSeekBackground(x-squareSize/8, y-squareSize/8, x+squareSize/8+1, y+squareSize/8+1);
}
void
-RemoveSeekAd(int nr)
+RemoveSeekAd (int nr)
{
int i;
for(i=0; i<nrOfSeekAds; i++) if(seekNrList[i] == nr) {
}
Boolean
-MatchSoughtLine(char *line)
+MatchSoughtLine (char *line)
{
char handle[MSG_SIZ], rating[MSG_SIZ], type[MSG_SIZ];
int nr, base, inc, u=0; char dummy;
}
int
-DrawSeekGraph()
+DrawSeekGraph ()
{
int i;
if(!seekGraphUp) return FALSE;
return TRUE;
}
-int SeekGraphClick(ClickType click, int x, int y, int moving)
+int
+SeekGraphClick (ClickType click, int x, int y, int moving)
{
static int lastDown = 0, displayed = 0, lastSecond;
if(!seekGraphUp) { // initiate cration of seek graph by requesting seek-ad list
}
void
-read_from_ics(isr, closure, data, count, error)
- InputSourceRef isr;
- VOIDSTAR closure;
- char *data;
- int count;
- int error;
+read_from_ics (InputSourceRef isr, VOIDSTAR closure, char *data, int count, int error)
{
#define BUF_SIZE (16*1024) /* overflowed at 8K with "inchannel 1" on FICS? */
#define STARTED_NONE 0
#define RELATION_STARTING_POSITION -4 /* FICS only */
void
-ParseBoard12(string)
- char *string;
+ParseBoard12 (char *string)
{
GameMode newGameMode;
int gamenum, newGame, newMove, relation, basetime, increment, ics_flip = 0, i;
}
void
-GetMoveListEvent()
+GetMoveListEvent ()
{
char buf[MSG_SIZ];
if (appData.icsActive && gameMode != IcsIdle && ics_gamenum > 0) {
}
void
-AnalysisPeriodicEvent(force)
- int force;
+AnalysisPeriodicEvent (int force)
{
if (((programStats.ok_to_send == 0 || programStats.line_is_book)
&& !force) || !appData.periodicUpdates)
programStats.ok_to_send = 0;
}
-void ics_update_width(new_width)
- int new_width;
+void
+ics_update_width (int new_width)
{
ics_printf("set width %d\n", new_width);
}
void
-SendMoveToProgram(moveNum, cps)
- int moveNum;
- ChessProgramState *cps;
+SendMoveToProgram (int moveNum, ChessProgramState *cps)
{
char buf[MSG_SIZ];
}
void
-SendMoveToICS(moveType, fromX, fromY, toX, toY, promoChar)
- ChessMove moveType;
- int fromX, fromY, toX, toY;
- char promoChar;
+SendMoveToICS (ChessMove moveType, int fromX, int fromY, int toX, int toY, char promoChar)
{
char user_move[MSG_SIZ];
char suffix[4];
}
void
-UploadGameEvent()
+UploadGameEvent ()
{ // [HGM] upload: send entire stored game to ICS as long-algebraic moves.
int i, last = forwardMostMove; // make sure ICS reply cannot pre-empt us by clearing fmm
static char *castlingStrings[4] = { "none", "kside", "qside", "both" };
}
void
-CoordsToComputerAlgebraic(rf, ff, rt, ft, promoChar, move)
- int rf, ff, rt, ft;
- char promoChar;
- char move[7];
+CoordsToComputerAlgebraic (int rf, int ff, int rt, int ft, char promoChar, char move[7])
{
if (rf == DROP_RANK) {
if(ff == EmptySquare) sprintf(move, "@@@@\n"); else // [HGM] pass
}
void
-ProcessICSInitScript(f)
- FILE *f;
+ProcessICSInitScript (FILE *f)
{
char buf[MSG_SIZ];
static int lastX, lastY, selectFlag, dragging;
void
-Sweep(int step)
+Sweep (int step)
{
ChessSquare king = WhiteKing, pawn = WhitePawn, last = promoSweep;
if(gameInfo.variant == VariantKnightmate) king = WhiteUnicorn;
ChangeDragPiece(promoSweep);
}
-int PromoScroll(int x, int y)
+int
+PromoScroll (int x, int y)
{
int step = 0;
}
void
-NextPiece(int step)
+NextPiece (int step)
{
ChessSquare piece = boards[currentMove][toY][toX];
do {
}
/* [HGM] Shogi move preprocessor: swap digits for letters, vice versa */
void
-AlphaRank(char *move, int n)
+AlphaRank (char *move, int n)
{
// char *p = move, c; int x, y;
/* Parser for moves from gnuchess, ICS, or user typein box */
Boolean
-ParseOneMove(move, moveNum, moveType, fromX, fromY, toX, toY, promoChar)
- char *move;
- int moveNum;
- ChessMove *moveType;
- int *fromX, *fromY, *toX, *toY;
- char *promoChar;
+ParseOneMove (char *move, int moveNum, ChessMove *moveType, int *fromX, int *fromY, int *toX, int *toY, char *promoChar)
{
*moveType = yylexstr(moveNum, move, yy_textstr, sizeof yy_textstr);
char *lastParseAttempt;
void
-ParsePV(char *pv, Boolean storeComments, Boolean atEnd)
+ParsePV (char *pv, Boolean storeComments, Boolean atEnd)
{ // Parse a string of PV moves, and append to current game, behind forwardMostMove
int fromX, fromY, toX, toY; char promoChar;
ChessMove moveType;
}
int
-MultiPV(ChessProgramState *cps)
+MultiPV (ChessProgramState *cps)
{ // check if engine supports MultiPV, and if so, return the number of the option that sets it
int i;
for(i=0; i<cps->nrOptions; i++)
}
Boolean
-LoadMultiPV(int x, int y, char *buf, int index, int *start, int *end)
+LoadMultiPV (int x, int y, char *buf, int index, int *start, int *end)
{
int startPV, multi, lineStart, origIndex = index;
char *p, buf2[MSG_SIZ];
}
char *
-PvToSAN(char *pv)
+PvToSAN (char *pv)
{
static char buf[10*MSG_SIZ];
int i, k=0, savedEnd=endPV, saveFMM = forwardMostMove;
}
Boolean
-LoadPV(int x, int y)
+LoadPV (int x, int y)
{ // called on right mouse click to load PV
int which = gameMode == TwoMachinesPlay && (WhiteOnMove(forwardMostMove) == (second.twoMachinesColor[0] == 'w'));
lastX = x; lastY = y;
}
void
-UnLoadPV()
+UnLoadPV ()
{
int oldFMM = forwardMostMove; // N.B.: this was currentMove before PV was loaded!
if(endPV < 0) return;
}
void
-MovePV(int x, int y, int h)
+MovePV (int x, int y, int h)
{ // step through PV based on mouse coordinates (called on mouse move)
int margin = h>>3, step = 0, threshold = (pieceSweep == EmptySquare ? 10 : 15);
int piecesLeft[(int)BlackPawn];
int seed, nrOfShuffles;
-void GetPositionNumber()
+void
+GetPositionNumber ()
{ // sets global variable seed
int i;
}
}
-int put(Board board, int pieceType, int rank, int n, int shade)
+int
+put (Board board, int pieceType, int rank, int n, int shade)
// put the piece on the (n-1)-th empty squares of the given shade
{
int i;
}
-void AddOnePiece(Board board, int pieceType, int rank, int shade)
+void
+AddOnePiece (Board board, int pieceType, int rank, int shade)
// calculate where the next piece goes, (any empty square), and put it there
{
int i;
put(board, pieceType, rank, i, shade);
}
-void AddTwoPieces(Board board, int pieceType, int rank)
+void
+AddTwoPieces (Board board, int pieceType, int rank)
// calculate where the next 2 identical pieces go, (any empty square), and put it there
{
int i, n=squaresLeft[ANY], j=n-1, k;
put(board, pieceType, rank, i, ANY);
}
-void SetUpShuffle(Board board, int number)
+void
+SetUpShuffle (Board board, int number)
{
int i, p, first=1;
if(number >= 0) appData.defaultFrcPosition %= nrOfShuffles; // normalize
}
-int SetCharTable( char *table, const char * map )
+int
+SetCharTable (char *table, const char * map)
/* [HGM] moved here from winboard.c because of its general usefulness */
/* Basically a safe strcpy that uses the last character as King */
{
return result;
}
-void Prelude(Board board)
+void
+Prelude (Board board)
{ // [HGM] superchess: random selection of exo-pieces
int i, j, k; ChessSquare p;
static ChessSquare exoPieces[4] = { WhiteAngel, WhiteMarshall, WhiteSilver, WhiteLance };
}
void
-InitPosition(redraw)
- int redraw;
+InitPosition (int redraw)
{
ChessSquare (* pieces)[BOARD_FILES];
int i, j, pawnRow, overrule,
}
void
-SendBoard(cps, moveNum)
- ChessProgramState *cps;
- int moveNum;
+SendBoard (ChessProgramState *cps, int moveNum)
{
char message[MSG_SIZ];
}
ChessSquare
-DefaultPromoChoice(int white)
+DefaultPromoChoice (int white)
{
ChessSquare result;
if(gameInfo.variant == VariantShatranj || gameInfo.variant == VariantCourier || gameInfo.variant == VariantMakruk)
static int autoQueen; // [HGM] oneclick
int
-HasPromotionChoice(int fromX, int fromY, int toX, int toY, char *promoChoice, int sweepSelect)
+HasPromotionChoice (int fromX, int fromY, int toX, int toY, char *promoChoice, int sweepSelect)
{
/* [HGM] rewritten IsPromotion to only flag promotions that offer a choice */
/* [HGM] add Shogi promotions */
}
int
-InPalace(row, column)
- int row, column;
+InPalace (int row, int column)
{ /* [HGM] for Xiangqi */
if( (row < 3 || row > BOARD_HEIGHT-4) &&
column < (BOARD_WIDTH + 4)/2 &&
}
int
-PieceForSquare (x, y)
- int x;
- int y;
+PieceForSquare (int x, int y)
{
if (x < 0 || x >= BOARD_WIDTH || y < 0 || y >= BOARD_HEIGHT)
return -1;
}
int
-OKToStartUserMove(x, y)
- int x, y;
+OKToStartUserMove (int x, int y)
{
ChessSquare from_piece;
int white_piece;
}
Boolean
-OnlyMove(int *x, int *y, Boolean captures) {
+OnlyMove (int *x, int *y, Boolean captures)
+{
DisambiguateClosure cl;
if (appData.zippyPlay || !appData.testLegality) return FALSE;
switch(gameMode) {
ChessMove lastLoadGameStart = EndOfFile;
void
-UserMoveEvent(fromX, fromY, toX, toY, promoChar)
- int fromX, fromY, toX, toY;
- int promoChar;
+UserMoveEvent(int fromX, int fromY, int toX, int toY, int promoChar)
{
ChessMove moveType;
ChessSquare pdown, pup;
/* Common tail of UserMoveEvent and DropMenuEvent */
int
-FinishMove(moveType, fromX, fromY, toX, toY, promoChar)
- ChessMove moveType;
- int fromX, fromY, toX, toY;
- /*char*/int promoChar;
+FinishMove (ChessMove moveType, int fromX, int fromY, int toX, int toY, int promoChar)
{
char *bookHit = 0;
}
void
-Mark(board, flags, kind, rf, ff, rt, ft, closure)
- Board board;
- int flags;
- ChessMove kind;
- int rf, ff, rt, ft;
- VOIDSTAR closure;
+Mark (Board board, int flags, ChessMove kind, int rf, int ff, int rt, int ft, VOIDSTAR closure)
{
typedef char Markers[BOARD_RANKS][BOARD_FILES];
Markers *m = (Markers *) closure;
}
void
-MarkTargetSquares(int clear)
+MarkTargetSquares (int clear)
{
int x, y;
if(!appData.markers || !appData.highlightDragging || appData.icsActive && gameInfo.variant < VariantShogi ||
}
int
-Explode(Board board, int fromX, int fromY, int toX, int toY)
+Explode (Board board, int fromX, int fromY, int toX, int toY)
{
if(gameInfo.variant == VariantAtomic &&
(board[toY][toX] != EmptySquare || // capture?
ChessSquare gatingPiece = EmptySquare; // exported to front-end, for dragging
-int CanPromote(ChessSquare piece, int y)
+int
+CanPromote (ChessSquare piece, int y)
{
if(gameMode == EditPosition) return FALSE; // no promotions when editing position
// some variants have fixed promotion piece, no promotion at all, or another selection mechanism
piece == WhiteLance && y == BOARD_HEIGHT-2 );
}
-void LeftClick(ClickType clickType, int xPix, int yPix)
+void
+LeftClick (ClickType clickType, int xPix, int yPix)
{
int x, y;
Boolean saveAnimate;
}
}
-int RightClick(ClickType action, int x, int y, int *fromX, int *fromY)
+int
+RightClick (ClickType action, int x, int y, int *fromX, int *fromY)
{ // front-end-free part taken out of PieceMenuPopup
int whichMenu; int xSqr, ySqr;
return whichMenu;
}
-void SendProgramStatsToFrontend( ChessProgramState * cps, ChessProgramStats * cpstats )
+void
+SendProgramStatsToFrontend (ChessProgramState * cps, ChessProgramStats * cpstats)
{
// char * hint = lastHint;
FrontEndProgramStats stats;
}
void
-ClearEngineOutputPane(int which)
+ClearEngineOutputPane (int which)
{
static FrontEndProgramStats dummyStats;
dummyStats.which = which;
#define MAXPLAYERS 500
char *
-TourneyStandings(int display)
+TourneyStandings (int display)
{
int i, w, b, color, wScore, bScore, dummy, nr=0, nPlayers=0;
int score[MAXPLAYERS], ranking[MAXPLAYERS], points[MAXPLAYERS], games[MAXPLAYERS];
}
void
-Count(Board board, int pCnt[], int *nW, int *nB, int *wStale, int *bStale, int *bishopColor)
+Count (Board board, int pCnt[], int *nW, int *nB, int *wStale, int *bStale, int *bishopColor)
{ // count all piece types
int p, f, r;
*nB = *nW = *wStale = *bStale = *bishopColor = 0;
}
int
-SufficientDefence(int pCnt[], int side, int nMine, int nHis)
+SufficientDefence (int pCnt[], int side, int nMine, int nHis)
{
int myPawns = pCnt[WhitePawn+side]; // my total Pawn count;
int majorDefense = pCnt[BlackRook-side] + pCnt[BlackCannon-side] + pCnt[BlackKnight-side];
}
int
-MatingPotential(int pCnt[], int side, int nMine, int nHis, int stale, int bisColor)
+MatingPotential (int pCnt[], int side, int nMine, int nHis, int stale, int bisColor)
{
VariantClass v = gameInfo.variant;
}
int
-CompareWithRights(Board b1, Board b2)
+CompareWithRights (Board b1, Board b2)
{
int rights = 0;
if(!CompareBoards(b1, b2)) return FALSE;
}
int
-Adjudicate(ChessProgramState *cps)
+Adjudicate (ChessProgramState *cps)
{ // [HGM] some adjudications useful with buggy engines
// [HGM] adjudicate: made into separate routine, which now can be called after every move
// In any case it determnes if the game is a claimable draw (filling in EP_STATUS).
return 0;
}
-char *SendMoveToBookUser(int moveNr, ChessProgramState *cps, int initial)
+char *
+SendMoveToBookUser (int moveNr, ChessProgramState *cps, int initial)
{ // [HGM] book: this routine intercepts moves to simulate book replies
char *bookHit = NULL;
char *savedMessage;
ChessProgramState *savedState;
-void DeferredBookMove(void)
+void
+DeferredBookMove (void)
{
if(savedState->lastPing != savedState->lastPong)
ScheduleDelayedEvent(DeferredBookMove, 10);
static int savedWhitePlayer, savedBlackPlayer, pairingReceived;
void
-HandleMachineMove(message, cps)
- char *message;
- ChessProgramState *cps;
+HandleMachineMove (char *message, ChessProgramState *cps)
{
char machineMove[MSG_SIZ], buf1[MSG_SIZ*10], buf2[MSG_SIZ];
char realname[MSG_SIZ];
The display is not updated in any way.
*/
void
-ParseGameHistory(game)
- char *game;
+ParseGameHistory (char *game)
{
ChessMove moveType;
int fromX, fromY, toX, toY, boardIndex;
/* Apply a move to the given board */
void
-ApplyMove(fromX, fromY, toX, toY, promoChar, board)
- int fromX, fromY, toX, toY;
- int promoChar;
- Board board;
+ApplyMove (int fromX, int fromY, int toX, int toY, int promoChar, Board board)
{
ChessSquare captured = board[toY][toX], piece, king; int p, oldEP = EP_NONE, berolina = 0;
int promoRank = gameInfo.variant == VariantMakruk || gameInfo.variant == VariantGrand ? 3 : 1;
/* Updates forwardMostMove */
void
-MakeMove(fromX, fromY, toX, toY, promoChar)
- int fromX, fromY, toX, toY;
- int promoChar;
+MakeMove (int fromX, int fromY, int toX, int toY, int promoChar)
{
// forwardMostMove++; // [HGM] bare: moved downstream
/* Updates currentMove if not pausing */
void
-ShowMove(fromX, fromY, toX, toY)
+ShowMove (int fromX, int fromY, int toX, int toY)
{
int instant = (gameMode == PlayFromGameFile) ?
(matchMode || (appData.timeDelay == 0 && !pausing)) : pausing;
HistorySet(parseList,backwardMostMove,forwardMostMove,currentMove-1);
}
-void SendEgtPath(ChessProgramState *cps)
+void
+SendEgtPath (ChessProgramState *cps)
{ /* [HGM] EGT: match formats given in feature with those given by user, and send info for each match */
char buf[MSG_SIZ], name[MSG_SIZ], *p;
}
void
-InitChessProgram(cps, setup)
- ChessProgramState *cps;
- int setup; /* [HGM] needed to setup FRC opening position */
+InitChessProgram (ChessProgramState *cps, int setup)
+/* setup needed to setup FRC opening position */
{
char buf[MSG_SIZ], b[MSG_SIZ]; int overruled;
if (appData.noChessProgram) return;
void
-StartChessProgram(cps)
- ChessProgramState *cps;
+StartChessProgram (ChessProgramState *cps)
{
char buf[MSG_SIZ];
int err;
}
char *
-MakeName(char *template)
+MakeName (char *template)
{
time_t clock;
struct tm *tm;
}
int
-CountPlayers(char *p)
+CountPlayers (char *p)
{
int n = 0;
while(p = strchr(p, '\n')) p++, n++; // count participants
}
FILE *
-WriteTourneyFile(char *results, FILE *f)
+WriteTourneyFile (char *results, FILE *f)
{ // write tournament parameters on tourneyFile; on success return the stream pointer for closing
if(f == NULL) f = fopen(appData.tourneyFile, "w");
if(f == NULL) DisplayError(_("Could not write on tourney file"), 0); else {
#define MAXENGINES 1000
char *command[MAXENGINES], *mnemonic[MAXENGINES];
-void Substitute(char *participants, int expunge)
+void
+Substitute (char *participants, int expunge)
{
int i, changed, changes=0, nPlayers=0;
char *p, *q, *r, buf[MSG_SIZ];
}
int
-CreateTourney(char *name)
+CreateTourney (char *name)
{
FILE *f;
if(matchMode && strcmp(name, appData.tourneyFile)) {
return 1;
}
-void NamesToList(char *names, char **engineList, char **engineMnemonic)
+void
+NamesToList (char *names, char **engineList, char **engineMnemonic)
{
char buf[MSG_SIZ], *p, *q;
int i=1;
// following implemented as macro to avoid type limitations
#define SWAP(item, temp) temp = appData.item[0]; appData.item[0] = appData.item[n]; appData.item[n] = temp;
-void SwapEngines(int n)
+void
+SwapEngines (int n)
{ // swap settings for first engine and other engine (so far only some selected options)
int h;
char *p;
}
void
-SetPlayer(int player)
+SetPlayer (int player)
{ // [HGM] find the engine line of the partcipant given by number, and parse its options.
int i;
char buf[MSG_SIZ], *engineName, *p = appData.participants;
}
int
-Pairing(int nr, int nPlayers, int *whitePlayer, int *blackPlayer, int *syncInterval)
+Pairing (int nr, int nPlayers, int *whitePlayer, int *blackPlayer, int *syncInterval)
{ // determine players from game number
int curCycle, curRound, curPairing, gamesPerCycle, gamesPerRound, roundsPerCycle=1, pairingsPerRound=1;
}
int
-NextTourneyGame(int nr, int *swapColors)
+NextTourneyGame (int nr, int *swapColors)
{ // !!!major kludge!!! fiddle appData settings to get everything in order for next tourney game
char *p, *q;
int whitePlayer, blackPlayer, firstBusy=1000000000, syncInterval = 0, nPlayers;
}
void
-NextMatchGame()
+NextMatchGame ()
{ // performs game initialization that does not invoke engines, and then tries to start the game
int res, firstWhite, swapColors = 0;
if(!NextTourneyGame(nextGame, &swapColors)) return; // this sets matchGame, -fcp / -scp and other options for next game, if needed
TwoMachinesEvent();
}
-void UserAdjudicationEvent( int result )
+void
+UserAdjudicationEvent (int result)
{
ChessMove gameResult = GameIsDrawn;
// [HGM] save: calculate checksum of game to make games easily identifiable
-int StringCheckSum(char *s)
+int
+StringCheckSum (char *s)
{
int i = 0;
if(s==NULL) return 0;
return i;
}
-int GameCheckSum()
+int
+GameCheckSum ()
{
int i, sum=0;
for(i=backwardMostMove; i<forwardMostMove; i++) {
} // end of save patch
void
-GameEnds(result, resultDetails, whosays)
- ChessMove result;
- char *resultDetails;
- int whosays;
+GameEnds (ChessMove result, char *resultDetails, int whosays)
{
GameMode nextGameMode;
int isIcsGame;
/* Assumes program was just initialized (initString sent).
Leaves program in force mode. */
void
-FeedMovesToProgram(cps, upto)
- ChessProgramState *cps;
- int upto;
+FeedMovesToProgram (ChessProgramState *cps, int upto)
{
int i;
int
-ResurrectChessProgram()
+ResurrectChessProgram ()
{
/* The chess program may have exited.
If so, restart it and feed it all the moves made so far. */
* Button procedures
*/
void
-Reset(redraw, init)
- int redraw, init;
+Reset (int redraw, int init)
{
int i;
}
void
-AutoPlayGameLoop()
+AutoPlayGameLoop ()
{
for (;;) {
if (!AutoPlayOneMove())
int
-AutoPlayOneMove()
+AutoPlayOneMove ()
{
int fromX, fromY, toX, toY;
int
-LoadGameOneMove(readAhead)
- ChessMove readAhead;
+LoadGameOneMove (ChessMove readAhead)
{
int fromX = 0, fromY = 0, toX = 0, toY = 0, done;
char promoChar = NULLCHAR;
/* Load the nth game from the given file */
int
-LoadGameFromFile(filename, n, title, useList)
- char *filename;
- int n;
- char *title;
- /*Boolean*/ int useList;
+LoadGameFromFile (char *filename, int n, char *title, int useList)
{
FILE *f;
char buf[MSG_SIZ];
void
-MakeRegisteredMove()
+MakeRegisteredMove ()
{
int fromX, fromY, toX, toY;
char promoChar;
/* Wrapper around LoadGame for use when a Cmail message is loaded */
int
-CmailLoadGame(f, gameNumber, title, useList)
- FILE *f;
- int gameNumber;
- char *title;
- int useList;
+CmailLoadGame (FILE *f, int gameNumber, char *title, int useList)
{
int retVal;
/* Support for LoadNextGame, LoadPreviousGame, ReloadSameGame */
int
-ReloadGame(offset)
- int offset;
+ReloadGame (int offset)
{
int gameNumber = lastLoadGameNumber + offset;
if (lastLoadGameFP == NULL) {
int keys[EmptySquare+1];
int
-PositionMatches(Board b1, Board b2)
+PositionMatches (Board b1, Board b2)
{
int r, f, sum=0;
switch(appData.searchMode) {
Move *moveDatabase = initialSpace;
unsigned int movePtr, dataSize = DSIZE;
-int MakePieceList(Board board, int *counts)
+int
+MakePieceList (Board board, int *counts)
{
int r, f, n=Q_PROMO, total=0;
for(r=0;r<EmptySquare;r++) counts[r] = 0; // piece-type counts
return total;
}
-void PackMove(int fromX, int fromY, int toX, int toY, ChessSquare promoPiece)
+void
+PackMove (int fromX, int fromY, int toX, int toY, ChessSquare promoPiece)
{
int sq = fromX + (fromY<<4);
int piece = quickBoard[sq];
movePtr++;
}
-int PackGame(Board board)
+int
+PackGame (Board board)
{
Move *newSpace = NULL;
moveDatabase[movePtr].piece = 0; // terminate previous game
return movePtr;
}
-int QuickCompare(Board board, int *minCounts, int *maxCounts)
+int
+QuickCompare (Board board, int *minCounts, int *maxCounts)
{ // compare according to search mode
int r, f;
switch(appData.searchMode)
return TRUE;
}
-int QuickScan(Board board, Move *move)
+int
+QuickScan (Board board, Move *move)
{ // reconstruct game,and compare all positions in it
int cnt=0, stretch=0, total = MakePieceList(board, counts);
do {
} while(1);
}
-void InitSearch()
+void
+InitSearch ()
{
int r, f;
flipSearch = FALSE;
GameInfo dummyInfo;
-int GameContainsPosition(FILE *f, ListGame *lg)
+int
+GameContainsPosition (FILE *f, ListGame *lg)
{
int next, btm=0, plyNr=0, scratch=forwardMostMove+2&~1;
int fromX, fromY, toX, toY;
/* Load the nth game from open file f */
int
-LoadGame(f, gameNumber, title, useList)
- FILE *f;
- int gameNumber;
- char *title;
- int useList;
+LoadGame (FILE *f, int gameNumber, char *title, int useList)
{
ChessMove cm;
char buf[MSG_SIZ];
/* Support for LoadNextPosition, LoadPreviousPosition, ReloadSamePosition */
int
-ReloadPosition(offset)
- int offset;
+ReloadPosition (int offset)
{
int positionNumber = lastLoadPositionNumber + offset;
if (lastLoadPositionFP == NULL) {
/* Load the nth position from the given file */
int
-LoadPositionFromFile(filename, n, title)
- char *filename;
- int n;
- char *title;
+LoadPositionFromFile (char *filename, int n, char *title)
{
FILE *f;
char buf[MSG_SIZ];
/* Load the nth position from the given open file, and close it */
int
-LoadPosition(f, positionNumber, title)
- FILE *f;
- int positionNumber;
- char *title;
+LoadPosition (FILE *f, int positionNumber, char *title)
{
char *p, line[MSG_SIZ];
Board initial_position;
void
-CopyPlayerNameIntoFileName(dest, src)
- char **dest, *src;
+CopyPlayerNameIntoFileName (char **dest, char *src)
{
while (*src != NULLCHAR && *src != ',') {
if (*src == ' ') {
}
}
-char *DefaultFileName(ext)
- char *ext;
+char *
+DefaultFileName (char *ext)
{
static char def[MSG_SIZ];
char *p;
/* Save the current game to the given file */
int
-SaveGameToFile(filename, append)
- char *filename;
- int append;
+SaveGameToFile (char *filename, int append)
{
FILE *f;
char buf[MSG_SIZ];
}
char *
-SavePart(str)
- char *str;
+SavePart (char *str)
{
static char buf[MSG_SIZ];
char *p;
#define PGN_SIDE_WHITE 0
#define PGN_SIDE_BLACK 1
-/* [AS] */
-static int FindFirstMoveOutOfBook( int side )
+static int
+FindFirstMoveOutOfBook (int side)
{
int result = -1;
return result;
}
-/* [AS] */
-void GetOutOfBookInfo( char * buf )
+void
+GetOutOfBookInfo (char * buf)
{
int oob[2];
int i;
/* Save game in PGN style and close the file */
int
-SaveGamePGN(f)
- FILE *f;
+SaveGamePGN (FILE *f)
{
int i, offset, linelen, newblock;
time_t tm;
/* Save game in old style and close the file */
int
-SaveGameOldStyle(f)
- FILE *f;
+SaveGameOldStyle (FILE *f)
{
int i, offset;
time_t tm;
/* Save the current game to open file f and close the file */
int
-SaveGame(f, dummy, dummy2)
- FILE *f;
- int dummy;
- char *dummy2;
+SaveGame (FILE *f, int dummy, char *dummy2)
{
if (gameMode == EditPosition) EditPositionDone(TRUE);
lastSavedGame = GameCheckSum(); // [HGM] save: remember ID of last saved game to prevent double saving
/* Save the current position to the given file */
int
-SavePositionToFile(filename)
- char *filename;
+SavePositionToFile (char *filename)
{
FILE *f;
char buf[MSG_SIZ];
/* Save the current position to the given open file and close the file */
int
-SavePosition(f, dummy, dummy2)
- FILE *f;
- int dummy;
- char *dummy2;
+SavePosition (FILE *f, int dummy, char *dummy2)
{
time_t tm;
char *fen;
}
void
-ReloadCmailMsgEvent(unregister)
- int unregister;
+ReloadCmailMsgEvent (int unregister)
{
#if !WIN32
static char *inFilename = NULL;
}
int
-RegisterMove()
+RegisterMove ()
{
FILE *f;
char string[MSG_SIZ];
}
void
-MailMoveEvent()
+MailMoveEvent ()
{
#if !WIN32
static char *partCommandString = "cmail -xv%s -remail -game %s 2>&1";
}
char *
-CmailMsg()
+CmailMsg ()
{
#if WIN32
return NULL;
}
void
-ResetGameEvent()
+ResetGameEvent ()
{
if (gameMode == Training)
SetTrainingModeOff();
}
void
-ExitEvent(status)
- int status;
+ExitEvent (int status)
{
exiting++;
if (exiting > 2) {
}
void
-PauseEvent()
+PauseEvent ()
{
if (appData.debugMode)
fprintf(debugFP, "PauseEvent(): pausing %d\n", pausing);
}
void
-EditCommentEvent()
+EditCommentEvent ()
{
char title[MSG_SIZ];
void
-EditTagsEvent()
+EditTagsEvent ()
{
char *tags = PGNTags(&gameInfo);
bookUp = FALSE;
}
void
-AnalyzeModeEvent()
+AnalyzeModeEvent ()
{
if (appData.noChessProgram || gameMode == AnalyzeMode)
return;
}
void
-AnalyzeFileEvent()
+AnalyzeFileEvent ()
{
if (appData.noChessProgram || gameMode == AnalyzeFile)
return;
}
void
-MachineWhiteEvent()
+MachineWhiteEvent ()
{
char buf[MSG_SIZ];
char *bookHit = NULL;
}
void
-MachineBlackEvent()
+MachineBlackEvent ()
{
char buf[MSG_SIZ];
char *bookHit = NULL;
void
-DisplayTwoMachinesTitle()
+DisplayTwoMachinesTitle ()
{
char buf[MSG_SIZ];
if (appData.matchGames > 0) {
}
void
-SettingsMenuIfReady()
+SettingsMenuIfReady ()
{
if (second.lastPing != second.lastPong) {
DisplayMessage("", _("Waiting for second chess program"));
}
int
-WaitForEngine(ChessProgramState *cps, DelayedEventCallback retry)
+WaitForEngine (ChessProgramState *cps, DelayedEventCallback retry)
{
char buf[MSG_SIZ];
if (cps->pr == NoProc) {
}
void
-TrainingEvent()
+TrainingEvent ()
{
if (gameMode == Training) {
SetTrainingModeOff();
}
void
-IcsClientEvent()
+IcsClientEvent ()
{
if (!appData.icsActive) return;
switch (gameMode) {
return;
}
-
void
-EditGameEvent()
+EditGameEvent ()
{
int i;
void
-EditPositionEvent()
+EditPositionEvent ()
{
if (gameMode == EditPosition) {
EditGameEvent();
}
void
-ExitAnalyzeMode()
+ExitAnalyzeMode ()
{
/* [DM] icsEngineAnalyze - possible call from other functions */
if (appData.icsEngineAnalyze) {
}
void
-EditPositionDone(Boolean fakeRights)
+EditPositionDone (Boolean fakeRights)
{
int king = gameInfo.variant == VariantKnightmate ? WhiteUnicorn : WhiteKing;
/* Pause for `ms' milliseconds */
/* !! Ugh, this is a kludge. Fix it sometime. --tpm */
void
-TimeDelay(ms)
- long ms;
+TimeDelay (long ms)
{
TimeMark m1, m2;
/* !! Ugh, this is a kludge. Fix it sometime. --tpm */
void
-SendMultiLineToICS(buf)
- char *buf;
+SendMultiLineToICS (char *buf)
{
char temp[MSG_SIZ+1], *p;
int len;
}
void
-SetWhiteToPlayEvent()
+SetWhiteToPlayEvent ()
{
if (gameMode == EditPosition) {
blackPlaysFirst = FALSE;
}
void
-SetBlackToPlayEvent()
+SetBlackToPlayEvent ()
{
if (gameMode == EditPosition) {
blackPlaysFirst = TRUE;
}
void
-EditPositionMenuEvent(selection, x, y)
- ChessSquare selection;
- int x, y;
+EditPositionMenuEvent (ChessSquare selection, int x, int y)
{
char buf[MSG_SIZ];
ChessSquare piece = boards[0][y][x];
void
-DropMenuEvent(selection, x, y)
- ChessSquare selection;
- int x, y;
+DropMenuEvent (ChessSquare selection, int x, int y)
{
ChessMove moveType;
}
void
-AcceptEvent()
+AcceptEvent ()
{
/* Accept a pending offer of any kind from opponent */
}
void
-DeclineEvent()
+DeclineEvent ()
{
/* Decline a pending offer of any kind from opponent */
}
void
-RematchEvent()
+RematchEvent ()
{
/* Issue ICS rematch command */
if (appData.icsActive) {
}
void
-CallFlagEvent()
+CallFlagEvent ()
{
/* Call your opponent's flag (claim a win on time) */
if (appData.icsActive) {
}
void
-ClockClick(int which)
+ClockClick (int which)
{ // [HGM] code moved to back-end from winboard.c
if(which) { // black clock
if (gameMode == EditPosition || gameMode == IcsExamining) {
}
void
-DrawEvent()
+DrawEvent ()
{
/* Offer draw or accept pending draw offer from opponent */
}
void
-AdjournEvent()
+AdjournEvent ()
{
/* Offer Adjourn or accept pending Adjourn offer from opponent */
void
-AbortEvent()
+AbortEvent ()
{
/* Offer Abort or accept pending Abort offer from opponent */
}
void
-ResignEvent()
+ResignEvent ()
{
/* Resign. You can do this even if it's not your turn. */
void
-StopObservingEvent()
+StopObservingEvent ()
{
/* Stop observing current games */
SendToICS(ics_prefix);
}
void
-StopExaminingEvent()
+StopExaminingEvent ()
{
/* Stop observing current game */
SendToICS(ics_prefix);
}
void
-ForwardInner(target)
- int target;
+ForwardInner (int target)
{
int limit;
void
-ForwardEvent()
+ForwardEvent ()
{
if (gameMode == IcsExamining && !pausing) {
SendToICS(ics_prefix);
}
void
-ToEndEvent()
+ToEndEvent ()
{
if (gameMode == AnalyzeMode || gameMode == AnalyzeFile) {
/* to optimze, we temporarily turn off analysis mode while we feed
}
void
-BackwardInner(target)
- int target;
+BackwardInner (int target)
{
int full_redraw = TRUE; /* [AS] Was FALSE, had to change it! */
}
void
-BackwardEvent()
+BackwardEvent ()
{
if (gameMode == IcsExamining && !pausing) {
SendToICS(ics_prefix);
}
void
-ToStartEvent()
+ToStartEvent ()
{
if (gameMode == AnalyzeMode || gameMode == AnalyzeFile) {
/* to optimize, we temporarily turn off analysis mode while we undo
}
void
-ToNrEvent(int to)
+ToNrEvent (int to)
{
if (gameMode == PlayFromGameFile && !pausing) PauseEvent();
if (to >= forwardMostMove) to = forwardMostMove;
}
void
-RevertEvent(Boolean annotate)
+RevertEvent (Boolean annotate)
{
if(PopTail(annotate)) { // [HGM] vari: restore old game tail
return;
}
void
-RetractMoveEvent()
+RetractMoveEvent ()
{
switch (gameMode) {
case MachinePlaysWhite:
}
void
-MoveNowEvent()
+MoveNowEvent ()
{
ChessProgramState *cps;
}
void
-TruncateGameEvent()
+TruncateGameEvent ()
{
EditGameEvent();
if (gameMode != EditGame) return;
}
void
-TruncateGame()
+TruncateGame ()
{
CleanupTail(); // [HGM] vari: only keep current variation if we explicitly truncate
if (forwardMostMove > currentMove) {
}
void
-HintEvent()
+HintEvent ()
{
if (appData.noChessProgram) return;
switch (gameMode) {
}
void
-BookEvent()
+BookEvent ()
{
if (appData.noChessProgram) return;
switch (gameMode) {
}
void
-AboutGameEvent()
+AboutGameEvent ()
{
char *tags = PGNTags(&gameInfo);
TagsPopUp(tags, CmailMsg());
/* end button procedures */
void
-PrintPosition(fp, move)
- FILE *fp;
- int move;
+PrintPosition (FILE *fp, int move)
{
int i, j;
}
void
-PrintOpponents(fp)
- FILE *fp;
+PrintOpponents (FILE *fp)
{
if (gameInfo.white != NULL) {
fprintf(fp, "\t%s vs. %s\n", gameInfo.white, gameInfo.black);
/* Find last component of program's own name, using some heuristics */
void
-TidyProgramName(prog, host, buf)
- char *prog, *host, buf[MSG_SIZ];
+TidyProgramName (char *prog, char *host, char buf[MSG_SIZ])
{
char *p, *q;
int local = (strcmp(host, "localhost") == 0);
}
char *
-TimeControlTagValue()
+TimeControlTagValue ()
{
char buf[MSG_SIZ];
if (!appData.clockMode) {
}
void
-SetGameInfo()
+SetGameInfo ()
{
/* This routine is used only for certain modes */
VariantClass v = gameInfo.variant;
}
void
-ReplaceComment(index, text)
- int index;
- char *text;
+ReplaceComment (int index, char *text)
{
int len;
char *p;
}
void
-CrushCRs(text)
- char *text;
+CrushCRs (char *text)
{
char *p = text;
char *q = text;
}
void
-AppendComment(index, text, addBraces)
- int index;
- char *text;
- Boolean addBraces; // [HGM] braces: tells if we should add {}
+AppendComment (int index, char *text, Boolean addBraces)
+/* addBraces tells if we should add {} */
{
int oldlen, len;
char *old;
}
}
-static char * FindStr( char * text, char * sub_text )
+static char *
+FindStr (char * text, char * sub_text)
{
char * result = strstr( text, sub_text );
/* [AS] Try to extract PV info from PGN comment */
/* [HGM] PV time: and then remove it, to prevent it appearing twice */
-char *GetInfoFromComment( int index, char * text )
+char *
+GetInfoFromComment (int index, char * text)
{
char * sep = text, *p;
}
void
-SendToProgram(message, cps)
- char *message;
- ChessProgramState *cps;
+SendToProgram (char *message, ChessProgramState *cps)
{
int count, outCount, error;
char buf[MSG_SIZ];
}
void
-ReceiveFromProgram(isr, closure, message, count, error)
- InputSourceRef isr;
- VOIDSTAR closure;
- char *message;
- int count;
- int error;
+ReceiveFromProgram (InputSourceRef isr, VOIDSTAR closure, char *message, int count, int error)
{
char *end_str;
char buf[MSG_SIZ];
void
-SendTimeControl(cps, mps, tc, inc, sd, st)
- ChessProgramState *cps;
- int mps, inc, sd, st;
- long tc;
+SendTimeControl (ChessProgramState *cps, int mps, long tc, int inc, int sd, int st)
{
char buf[MSG_SIZ];
int seconds;
}
}
-ChessProgramState *WhitePlayer()
+ChessProgramState *
+WhitePlayer ()
/* [HGM] return pointer to 'first' or 'second', depending on who plays white */
{
if(gameMode == TwoMachinesPlay && first.twoMachinesColor[0] == 'b' ||
}
void
-SendTimeRemaining(cps, machineWhite)
- ChessProgramState *cps;
- int /*boolean*/ machineWhite;
+SendTimeRemaining (ChessProgramState *cps, int machineWhite)
{
char message[MSG_SIZ];
long time, otime;
}
int
-BoolFeature(p, name, loc, cps)
- char **p;
- char *name;
- int *loc;
- ChessProgramState *cps;
+BoolFeature (char **p, char *name, int *loc, ChessProgramState *cps)
{
char buf[MSG_SIZ];
int len = strlen(name);
}
int
-IntFeature(p, name, loc, cps)
- char **p;
- char *name;
- int *loc;
- ChessProgramState *cps;
+IntFeature (char **p, char *name, int *loc, ChessProgramState *cps)
{
char buf[MSG_SIZ];
int len = strlen(name);
}
int
-StringFeature(p, name, loc, cps)
- char **p;
- char *name;
- char loc[];
- ChessProgramState *cps;
+StringFeature (char **p, char *name, char loc[], ChessProgramState *cps)
{
char buf[MSG_SIZ];
int len = strlen(name);
}
int
-ParseOption(Option *opt, ChessProgramState *cps)
+ParseOption (Option *opt, ChessProgramState *cps)
// [HGM] options: process the string that defines an engine option, and determine
// name, type, default value, and allowed value range
{
}
void
-FeatureDone(cps, val)
- ChessProgramState* cps;
- int val;
+FeatureDone (ChessProgramState *cps, int val)
{
DelayedEventCallback cb = GetDelayedEvent();
if ((cb == InitBackEnd3 && cps == &first) ||
/* Parse feature command from engine */
void
-ParseFeatures(args, cps)
- char* args;
- ChessProgramState *cps;
+ParseFeatures (char *args, ChessProgramState *cps)
{
char *p = args;
char *q;
}
void
-PeriodicUpdatesEvent(newState)
- int newState;
+PeriodicUpdatesEvent (int newState)
{
if (newState == appData.periodicUpdates)
return;
}
void
-PonderNextMoveEvent(newState)
- int newState;
+PonderNextMoveEvent (int newState)
{
if (newState == appData.ponderNextMove) return;
if (gameMode == EditPosition) EditPositionDone(TRUE);
}
void
-NewSettingEvent(option, feature, command, value)
- char *command;
- int option, value, *feature;
+NewSettingEvent (int option, int *feature, char *command, int value)
{
char buf[MSG_SIZ];
}
void
-ShowThinkingEvent()
+ShowThinkingEvent ()
// [HGM] thinking: this routine is now also called from "Options -> Engine..." popup
{
static int oldState = 2; // kludge alert! Neither true nor fals, so first time oldState is always updated
}
void
-AskQuestionEvent(title, question, replyPrefix, which)
- char *title; char *question; char *replyPrefix; char *which;
+AskQuestionEvent (char *title, char *question, char *replyPrefix, char *which)
{
ProcRef pr = (which[0] == '1') ? first.pr : second.pr;
if (pr == NoProc) return;
}
void
-TypeInEvent(char firstChar)
+TypeInEvent (char firstChar)
{
if ((gameMode == BeginningOfGame && !appData.icsActive) ||
gameMode == MachinePlaysWhite || gameMode == MachinePlaysBlack ||
}
void
-TypeInDoneEvent(char *move)
+TypeInDoneEvent (char *move)
{
Board board;
int n, fromX, fromY, toX, toY;
}
void
-DisplayMove(moveNumber)
- int moveNumber;
+DisplayMove (int moveNumber)
{
char message[MSG_SIZ];
char res[MSG_SIZ];
}
void
-DisplayComment(moveNumber, text)
- int moveNumber;
- char *text;
+DisplayComment (int moveNumber, char *text)
{
char title[MSG_SIZ];
* ioctl, which does not work properly on some flavors of Unix.
*/
void
-Attention(cps)
- ChessProgramState *cps;
+Attention (ChessProgramState *cps)
{
#if ATTENTION
if (!cps->useSigint) return;
}
int
-CheckFlags()
+CheckFlags ()
{
if (whiteTimeRemaining <= 0) {
if (!whiteFlag) {
}
void
-CheckTimeControl()
+CheckTimeControl ()
{
if (!appData.clockMode || appData.icsActive || searchTime || // [HGM] st: no inc in st mode
gameMode == PlayFromGameFile || forwardMostMove == 0) return;
}
void
-DisplayBothClocks()
+DisplayBothClocks ()
{
int wom = gameMode == EditPosition ?
!blackPlaysFirst : WhiteOnMove(currentMove);
/* Get the current time as a TimeMark */
void
-GetTimeMark(tm)
- TimeMark *tm;
+GetTimeMark (TimeMark *tm)
{
#if HAVE_GETTIMEOFDAY
time marks. We assume the difference will fit in a long!
*/
long
-SubtractTimeMarks(tm2, tm1)
- TimeMark *tm2, *tm1;
+SubtractTimeMarks (TimeMark *tm2, TimeMark *tm1)
{
return 1000L*(tm2->sec - tm1->sec) +
(long) (tm2->ms - tm1->ms);
static long intendedTickLength;
long
-NextTickLength(timeRemaining)
- long timeRemaining;
+NextTickLength (long timeRemaining)
{
long nominalTickLength, nextTickLength;
/* Adjust clock one minute up or down */
void
-AdjustClock(Boolean which, int dir)
+AdjustClock (Boolean which, int dir)
{
if(appData.autoCallFlag) { DisplayError(_("Clock adjustment not allowed in auto-flag mode"), 0); return; }
if(which) blackTimeRemaining += 60000*dir;
/* Stop clocks and reset to a fresh time control */
void
-ResetClocks()
+ResetClocks ()
{
(void) StopClockTimer();
if (appData.icsActive) {
/* Decrement running clock by amount of time that has passed */
void
-DecrementClocks()
+DecrementClocks ()
{
long timeRemaining;
long lastTickLength, fudge;
from the color that is *not* on move now.
*/
void
-SwitchClocks(int newMoveNr)
+SwitchClocks (int newMoveNr)
{
long lastTickLength;
TimeMark now;
/* Stop both clocks */
void
-StopClocks()
+StopClocks ()
{
long lastTickLength;
TimeMark now;
/* Start clock of player on move. Time may have been reset, so
if clock is already running, stop and restart it. */
void
-StartClocks()
+StartClocks ()
{
(void) StopClockTimer(); /* in case it was running already */
DisplayBothClocks();
}
char *
-TimeString(ms)
- long ms;
+TimeString (long ms)
{
long second, minute, hour, day;
char *sign = "";
* This is necessary because some C libraries aren't ANSI C compliant yet.
*/
char *
-StrStr(string, match)
- char *string, *match;
+StrStr (char *string, char *match)
{
int i, length;
}
char *
-StrCaseStr(string, match)
- char *string, *match;
+StrCaseStr (char *string, char *match)
{
int i, j, length;
#ifndef _amigados
int
-StrCaseCmp(s1, s2)
- char *s1, *s2;
+StrCaseCmp (char *s1, char *s2)
{
char c1, c2;
int
-ToLower(c)
- int c;
+ToLower (int c)
{
return isupper(c) ? tolower(c) : c;
}
int
-ToUpper(c)
- int c;
+ToUpper (int c)
{
return islower(c) ? toupper(c) : c;
}
#endif /* !_amigados */
char *
-StrSave(s)
- char *s;
+StrSave (char *s)
{
char *ret;
}
char *
-StrSavePtr(s, savePtr)
- char *s, **savePtr;
+StrSavePtr (char *s, char **savePtr)
{
if (*savePtr) {
free(*savePtr);
}
char *
-PGNDate()
+PGNDate ()
{
time_t clock;
struct tm *tm;
char *
-PositionToFEN(move, overrideCastling)
- int move;
- char *overrideCastling;
+PositionToFEN (int move, char *overrideCastling)
{
int i, j, fromX, fromY, toX, toY;
int whiteToPlay;
}
Boolean
-ParseFEN(board, blackPlaysFirst, fen)
- Board board;
- int *blackPlaysFirst;
- char *fen;
+ParseFEN (Board board, int *blackPlaysFirst, char *fen)
{
int i, j;
char *p, c;
}
void
-EditPositionPasteFEN(char *fen)
+EditPositionPasteFEN (char *fen)
{
if (fen != NULL) {
Board initial_position;
static char cseq[12] = "\\ ";
-Boolean set_cont_sequence(char *new_seq)
+Boolean
+set_cont_sequence (char *new_seq)
{
int len;
Boolean ret;
for the dest buffer. lp argument indicats line position upon entry, and it's
passed back upon exit.
*/
-int wrap(char *dest, char *src, int count, int width, int *lp)
+int
+wrap (char *dest, char *src, int count, int width, int *lp)
{
int len, i, ansi, cseq_len, line, old_line, old_i, old_len, clen;
Boolean modeRestore = FALSE;
void
-PushInner(int firstMove, int lastMove)
+PushInner (int firstMove, int lastMove)
{
int i, j, nrMoves = lastMove - firstMove;
}
void
-PushTail(int firstMove, int lastMove)
+PushTail (int firstMove, int lastMove)
{
if(appData.icsActive) { // only in local mode
forwardMostMove = currentMove; // mimic old ICS behavior
}
void
-PopInner(Boolean annotate)
+PopInner (Boolean annotate)
{
int i, j, nrMoves;
char buf[8000], moveBuf[20];
}
Boolean
-PopTail(Boolean annotate)
+PopTail (Boolean annotate)
{
if(appData.icsActive) return FALSE; // only in local mode
if(!storedGames) return FALSE; // sanity
}
void
-CleanupTail()
+CleanupTail ()
{ // remove all shelved variations
int i;
for(i=0; i<storedGames; i++) {
}
void
-LoadVariation(int index, char *text)
+LoadVariation (int index, char *text)
{ // [HGM] vari: shelve previous line and load new variation, parsed from text around text[index]
char *p = text, *start = NULL, *end = NULL, wait = NULLCHAR;
int level = 0, move;
uint64 *RandomTurn =Random64+780;
-uint64 hash(int moveNr)
+uint64
+hash (int moveNr)
{
int r, f, p_enc, squareNr, pieceGroup;
uint64 key=0, holdingsKey=0, Zobrist;
#define MOVE_BUF 100
-int int_from_file(FILE *f, int l, uint64 *r)
+int
+int_from_file (FILE *f, int l, uint64 *r)
{
int i,c;
for(i=0;i<l;i++){
return 0;
}
-int entry_from_file(FILE *f, entry_t *entry)
+int
+entry_from_file (FILE *f, entry_t *entry)
{
int ret;
uint64 r;
return 0;
}
-int find_key(FILE *f, uint64 key, entry_t *entry)
+int
+find_key (FILE *f, uint64 key, entry_t *entry)
{
int first, last, middle;
entry_t first_entry=entry_none, last_entry,middle_entry;
}
}
-void move_to_string(char move_s[6], uint16 move)
+void
+move_to_string (char move_s[6], uint16 move)
{
int f,fr,ff,t,tr,tf,p;
int width = BOARD_RGHT - BOARD_LEFT, size; // allow for alternative board formats
}
}
-int GetBookMoves(int moveNr, char *book, entry_t entries[])
+int
+GetBookMoves (int moveNr, char *book, entry_t entries[])
{ // retrieve all entries for given position from book in 'entries', return number.
static FILE *f = NULL;
static char curBook[MSG_SIZ];
return count;
}
-char *ProbeBook(int moveNr, char *book)
-{ //
+char *
+ProbeBook (int moveNr, char *book)
+{
entry_t entries[MOVE_BUF];
int count;
int i, j;
extern char yy_textstr[];
entry_t lastEntries[MOVE_BUF];
-char *MovesToText(int count, entry_t *entries)
+char *
+MovesToText (int count, entry_t *entries)
{
int i, totalWeight = 0;
char algMove[6];
return p;
}
-int TextToMoves(char *text, int moveNum, entry_t *entries)
+int
+TextToMoves (char *text, int moveNum, entry_t *entries)
{
int i, w, count=0;
uint64 hashKey = hash(moveNum);
Boolean bookUp;
int currentCount;
-Boolean DisplayBook(int moveNr)
+Boolean
+DisplayBook (int moveNr)
{
entry_t entries[MOVE_BUF];
int count;
return TRUE;
}
-void EditBookEvent()
+void
+EditBookEvent ()
{
bookUp = TRUE;
bookUp = DisplayBook(currentMove);
}
-void int_to_file(FILE *f, int l, uint64 r)
+void
+int_to_file (FILE *f, int l, uint64 r)
{
int i;
for(i=l-1;i>=0;i--) fputc(r>>8*i & 255, f);
}
-void entry_to_file(FILE *f, entry_t *entry)
+void
+entry_to_file (FILE *f, entry_t *entry)
{
int_to_file(f,8,entry->key);
int_to_file(f,2,entry->move);
char buf1[4096], buf2[4096];
-void SaveToBook(char *text)
+void
+SaveToBook (char *text)
{
entry_t entries[MOVE_BUF], entry;
int count = TextToMoves(text, currentMove, entries);
#if !USE_PTYS
/* This code is for systems where pipes work properly */
-void SetUpChildIO(to_prog, from_prog)
- int to_prog[2], from_prog[2];
+void
+SetUpChildIO (int to_prog[2], int from_prog[2])
{
signal(SIGPIPE, SIG_IGN);
pipe(to_prog);
int PseudoTTY P((char pty_name[]));
-int SetUpChildIO(to_prog, from_prog)
- int to_prog[2], from_prog[2];
+int
+SetUpChildIO (int to_prog[2], int from_prog[2])
{
char pty_name[MSG_SIZ];
#if HAVE_GRANTPT
/* This code is for SVR4 */
-int PseudoTTY(pty_name)
- char pty_name[];
+int
+PseudoTTY (char pty_name[])
{
extern char *ptsname();
char *ptss;
#if HAVE__GETPTY
/* This code is for IRIX */
-int PseudoTTY(pty_name)
- char pty_name[];
+int
+PseudoTTY (char pty_name[])
{
int fd;
char *ptyn;
#if HAVE_LIBSEQ
/* This code is for Sequent DYNIX/ptx. Untested. --tpm */
-int PseudoTTY(pty_name)
- char pty_name[];
+int
+PseudoTTY (char pty_name[])
{
int fd;
char *slave, *master;
#define LAST_PTY_LETTER 'z'
#endif
-int PseudoTTY(pty_name)
- char pty_name[];
+int
+PseudoTTY (char pty_name[])
{
struct stat stb;
register c, i;
extern int initialRulePlies;
-void MakeEngineOutputTitle()
+void
+MakeEngineOutputTitle ()
{
static char buf[MSG_SIZ];
static char oldTitle[MSG_SIZ];
}
// back end, due to front-end wrapper for SetWindowText, and new SetIcon arguments
-void SetEngineState( int which, int state, char * state_data )
+void
+SetEngineState (int which, int state, char * state_data)
{
int x_which = 1 - which;
}
// back end, now the front-end wrapper ClearMemo is used, and ed no longer contains handles.
-void SetProgramStats( FrontEndProgramStats * stats ) // now directly called by back-end
+void
+SetProgramStats (FrontEndProgramStats * stats) // now directly called by back-end
{
EngineOutputData ed;
int clearMemo = FALSE;
#define ENGINE_COLOR_UNKNOWN ' '
// pure back end
-static char GetEngineColor( int which )
+static char
+GetEngineColor (int which)
{
char result = ENGINE_COLOR_UNKNOWN;
}
// pure back end
-static char GetActiveEngineColor()
+static char
+GetActiveEngineColor ()
{
char result = ENGINE_COLOR_UNKNOWN;
}
// pure back end
-static int IsEnginePondering( int which )
+static int
+IsEnginePondering (int which)
{
int result = FALSE;
}
// back end
-static void SetDisplayMode( int mode )
+static void
+SetDisplayMode (int mode)
{
if( windowMode != mode ) {
windowMode = mode;
}
// pure back end
-static void VerifyDisplayMode()
+static void
+VerifyDisplayMode ()
{
int mode;
}
// back end. Determine what icon to set in the color-icon field, and print it
-void SetEngineColorIcon( int which )
+void
+SetEngineColorIcon (int which)
{
char color = GetEngineColor(which);
int nicon = 0;
// [HGM] multivar: sort Thinking Output within one depth on score
-static int InsertionPoint( int len, EngineOutputData * ed )
+static int
+InsertionPoint (int len, EngineOutputData *ed)
{
int i, offs = 0, newScore = ed->score, n = ed->which;
// pure back end, now SetWindowText is called via wrapper DoSetWindowText
-static void UpdateControls( EngineOutputData * ed )
+static void
+UpdateControls (EngineOutputData *ed)
{
// int isPondering = FALSE;
}
// [HGM] kibitz: write kibitz line; split window for it if necessary
-void OutputKibitz(int window, char *text)
+void
+OutputKibitz (int window, char *text)
{
static int currentLineEnd[2];
int where = 0;
int MarginH = 4;
// back-end
-static void DrawLine( int x1, int y1, int x2, int y2, int penType )
+static void
+DrawLine (int x1, int y1, int x2, int y2, int penType)
{
DrawSegment( x1, y1, NULL, NULL, PEN_NONE );
DrawSegment( x2, y2, NULL, NULL, penType );
}
// back-end
-static void DrawLineEx( int x1, int y1, int x2, int y2, int penType )
+static void
+DrawLineEx (int x1, int y1, int x2, int y2, int penType)
{
int savX, savY;
DrawSegment( x1, y1, &savX, &savY, PEN_NONE );
}
// back-end
-static int GetPvScore( int index )
+static int
+GetPvScore (int index)
{
int score = currPvInfo[ index ].score;
return score;
}
-char* MakeEvalTitle( char * title)
+char *
+MakeEvalTitle (char *title)
{
int score, depth;
static char buf[MSG_SIZ];
Note: height can be negative!
*/
-static int GetValueY( int value )
+static int
+GetValueY (int value)
{
if( value < -range*700 ) value = -range*700;
if( value > +range*700 ) value = +range*700;
// the brush selection is made part of the DrawLine, by passing a style argument
// the wrapper for doing the text output makes this back-end
-static void DrawAxisSegmentHoriz( int value, Boolean drawValue )
+static void
+DrawAxisSegmentHoriz (int value, Boolean drawValue)
{
int y = GetValueY( range*value*100 );
// The DrawLines again must select their own brush.
// the initial brush selection is useless? BkMode needed for dotted line and text
-static void DrawAxis()
+static void
+DrawAxis ()
{
int cy = nHeightPB / 2, space = nHeightPB/(6 + appData.zoom);
}
// back-end
-static void DrawHistogram( int x, int y, int width, int value, int side )
+static void
+DrawHistogram (int x, int y, int width, int value, int side)
{
int left, top, right, bottom;
}
// back-end
-static void DrawSeparator( int index, int x )
+static void
+DrawSeparator (int index, int x)
{
if( index > 0 ) {
if( index == currCurrent ) {
// made back-end by replacing MoveToEx and LineTo by DrawSegment
/* Actually draw histogram as a diagram, cause there's too much data */
-static void DrawHistogramAsDiagram( int cy, int paint_width, int hist_count )
+static void
+DrawHistogramAsDiagram (int cy, int paint_width, int hist_count)
{
double step;
int i;
}
// back-end, delete pen selection
-static void DrawHistogramFull( int cy, int hist_width, int hist_count )
+static void
+DrawHistogramFull (int cy, int hist_width, int hist_count)
{
int i;
} VisualizationData;
// back-end
-static Boolean InitVisualization( VisualizationData * vd )
+static Boolean
+InitVisualization (VisualizationData *vd)
{
Boolean result = FALSE;
}
// back-end
-static void DrawHistograms()
+static void
+DrawHistograms ()
{
VisualizationData vd;
}
// back-end
-int GetMoveIndexFromPoint( int x, int y )
+int
+GetMoveIndexFromPoint (int x, int y)
{
int result = -1;
int start_x = MarginX + MarginW;
}
// init and display part split of so they can be moved to front end
-void PaintEvalGraph( void )
+void
+PaintEvalGraph (void)
{
VariantClass v = gameInfo.variant;
range = (gameInfo.holdingsWidth && v != VariantSuper && v != VariantGreat && v != VariantSChess) ? 2 : 1; // [HGM] double range in drop games
DrawAxis();
DrawHistograms();
}
-
/* [AS] Wildcard pattern matching */
Boolean
-HasPattern( const char * text, const char * pattern )
+HasPattern (const char * text, const char * pattern)
{
while( *pattern != '\0' ) {
if( *pattern == '*' ) {
}
Boolean
-SearchPattern( const char * text, const char * pattern )
+SearchPattern (const char * text, const char * pattern)
{
Boolean result = TRUE;
/* Delete a ListGame; implies removint it from a list.
*/
-static void GameListDeleteGame(listGame)
- ListGame *listGame;
+static void
+GameListDeleteGame (ListGame *listGame)
{
if (listGame) {
if (listGame->gameInfo.event) free(listGame->gameInfo.event);
/* Free the previous list of games.
*/
-static void GameListFree(gameList)
- List *gameList;
+static void
+GameListFree (List *gameList)
{
- while (!ListEmpty(gameList))
+ while (!ListEmpty(gameList))
{
GameListDeleteGame((ListGame *) gameList->head);
}
/* Initialize a new GameInfo structure.
*/
-void GameListInitGameInfo(gameInfo)
- GameInfo *gameInfo;
+void
+GameListInitGameInfo (GameInfo *gameInfo)
{
gameInfo->event = NULL;
gameInfo->site = NULL;
*
* Note, that the ListGame is *not* added to any list
*/
-static ListGame *GameListCreate()
-
+static ListGame *
+GameListCreate ()
{
ListGame *listGame;
/* Creates a new game for the gamelist.
*/
-static int GameListNewGame(listGamePtr)
- ListGame **listGamePtr;
+static int
+GameListNewGame (ListGame **listGamePtr)
{
if (!(*listGamePtr = (ListGame *) GameListCreate())) {
GameListFree(&gameList);
/* Build the list of games in the open file f.
* Returns 0 for success or error number.
*/
-int GameListBuild(f)
- FILE *f;
+int
+GameListBuild (FILE *f)
{
ChessMove cm, lastStart;
int gameNumber;
/* Clear an existing GameInfo structure.
*/
-void ClearGameInfo(gameInfo)
- GameInfo *gameInfo;
+void
+ClearGameInfo (GameInfo *gameInfo)
{
if (gameInfo->event != NULL) {
free(gameInfo->event);
/* [AS] Replaced by "dynamic" tag selection below */
char *
-GameListLineOld(number, gameInfo)
- int number;
- GameInfo *gameInfo;
+GameListLineOld (int number, GameInfo *gameInfo)
{
char *event = (gameInfo->event && strcmp(gameInfo->event, "?") != 0) ?
gameInfo->event : gameInfo->site ? gameInfo->site : "?";
#define MAX_FIELD_LEN 80 /* To avoid overflowing the buffer */
-char * GameListLine( int number, GameInfo * gameInfo )
+char *
+GameListLine (int number, GameInfo * gameInfo)
{
char buffer[2*MSG_SIZ];
char * buf = buffer;
return strdup( buffer );
}
-char * GameListLineFull( int number, GameInfo * gameInfo )
+char *
+GameListLineFull (int number, GameInfo * gameInfo)
{
char * event = gameInfo->event ? gameInfo->event : "?";
char * site = gameInfo->site ? gameInfo->site : "?";
char lpUserGLT[LPUSERGLT_SIZE];
// back-end: convert the tag id-char to a full tag name
-char * GLT_FindItem( char id )
+char *
+GLT_FindItem (char id)
{
char * result = 0;
// back-end: build the list of tag names
void
-GLT_TagsToList( char * tags )
+GLT_TagsToList (char *tags)
{
char * pc = tags;
// back-end: retrieve item from dialog and translate to id-char
char
-GLT_ListItemToTag( int index )
+GLT_ListItemToTag (int index)
{
char result = '\0';
char name[MSG_SIZ];
// back-end: add items id-chars one-by-one to temp tags string
void
-GLT_ParseList()
+GLT_ParseList ()
{
char * pc = lpUserGLT;
int idx = 0;
/* Note: in the following code a "Memo" is a Rich Edit control (it's Delphi lingo) */
// back-end after replacing Windows data-types by equivalents
-static Boolean OnlyCurrentPositionChanged()
+static Boolean
+OnlyCurrentPositionChanged ()
{
Boolean result = FALSE;
}
// back-end, after replacing Windows data types
-static Boolean OneMoveAppended()
+static Boolean
+OneMoveAppended ()
{
Boolean result = FALSE;
}
// back-end, now that color and font-style are passed as numbers
-static void AppendMoveToMemo( int index )
+static void
+AppendMoveToMemo (int index)
{
char buf[64];
}
// back-end
-void RefreshMemoContent()
+void
+RefreshMemoContent ()
{
int i;
}
// back-end part taken out of HighlightMove to determine character positions
-static void DoHighlight(int index, int onoff)
+static void
+DoHighlight (int index, int onoff)
{
if( index >= 0 && index < MAX_MOVES ) {
HighlightMove( histMoves[index].memoOffset,
}
// back-end, now that a wrapper is provided for the front-end code to do the actual scrolling
-void MemoContentUpdated()
+void
+MemoContentUpdated ()
{
int caretPos;
}
// back-end. Must be called as double-click call-back on move-history text edit
-void FindMoveByCharIndex( int char_index )
+void
+FindMoveByCharIndex (int char_index)
{
int index;
}
// back-end. In WinBoard called by call-back, but could be called directly by SetIfExists?
-void UpdateMoveHistory()
+void
+UpdateMoveHistory ()
{
/* Update the GUI */
if( OnlyCurrentPositionChanged() ) {
}
// back-end
-void MoveHistorySet( char movelist[][2*MOVE_LEN], int first, int last, int current, ChessProgramStats_Move * pvInfo )
+void
+MoveHistorySet (char movelist[][2*MOVE_LEN], int first, int last, int current, ChessProgramStats_Move * pvInfo)
{
/* [AS] Danger! For now we rely on the movelist parameter being a static variable! */
/* Check, if List l is empty; returns TRUE, if it is, FALSE
* otherwise.
*/
-int ListEmpty(l)
- List *l;
+int
+ListEmpty (List *l)
{
return(l->head == (ListNode *) &l->tail);
}
/* Initialize a list. Must be executed before list is used.
*/
-void ListNew(l)
- List *l;
+void
+ListNew (List *l)
{
l->head = (ListNode *) &l->tail;
l->tail = NULL;
/* Remove node n from the list it is inside.
*/
-void ListRemove(n)
- ListNode *n;
+void
+ListRemove (ListNode *n)
{
if (n->succ != NULL) { /* Be safe */
n->pred->succ = n->succ;
/* Delete node n.
*/
-void ListNodeFree(n)
- ListNode *n;
+void
+ListNodeFree (ListNode *n)
{
if (n) {
ListRemove(n);
/* Create a list node with size s. Returns NULL, if out of memory.
*/
-ListNode *ListNodeCreate(s)
- size_t s;
+ListNode *
+ListNodeCreate (size_t s)
{
ListNode *n;
/* Insert node n into the list of node m after m.
*/
-void ListInsert(m, n)
- ListNode *m, *n;
+void
+ListInsert (ListNode *m, ListNode *n)
{
n->succ = m->succ;
n->pred = m;
/* Add node n to the head of list l.
*/
-void ListAddHead(l, n)
- List *l;
- ListNode *n;
+void
+ListAddHead (List *l, ListNode *n)
{
ListInsert((ListNode *) &l->head, n);
}
/* Add node n to the tail of list l.
*/
-void ListAddTail(l, n)
- List *l;
- ListNode *n;
+void
+ListAddTail (List *l, ListNode *n)
{
ListInsert((ListNode *) l->tailPred, n);
}
/* Return element with number n of list l. (NULL, if n doesn't exist.)
* Counting starts with 0.
*/
-ListNode *ListElem(l, n)
- List *l;
- int n;
+ListNode *
+ListElem (List *l, int n)
{
ListNode *ln;
extern signed char initialRights[BOARD_FILES]; /* [HGM] all rights enabled, set in InitPosition */
int quickFlag;
-int WhitePiece(piece)
- ChessSquare piece;
+int
+WhitePiece (ChessSquare piece)
{
return (int) piece >= (int) WhitePawn && (int) piece < (int) BlackPawn;
}
-int BlackPiece(piece)
- ChessSquare piece;
+int
+BlackPiece (ChessSquare piece)
{
return (int) piece >= (int) BlackPawn && (int) piece < (int) EmptySquare;
}
#if 0
-int SameColor(piece1, piece2)
- ChessSquare piece1, piece2;
+int
+SameColor (ChessSquare piece1, ChessSquare piece2)
{
return ((int) piece1 >= (int) WhitePawn && /* [HGM] can be > King ! */
(int) piece1 < (int) BlackPawn &&
'x' };
char pieceNickName[EmptySquare];
-char PieceToChar(p)
- ChessSquare p;
+char
+PieceToChar (ChessSquare p)
{
if((int)p < 0 || (int)p >= (int)EmptySquare) return('x'); /* [HGM] for safety */
return pieceToChar[(int) p];
}
-int PieceToNumber(p) /* [HGM] holdings: count piece type, ignoring non-participating piece types */
- ChessSquare p;
+int
+PieceToNumber (ChessSquare p) /* [HGM] holdings: count piece type, ignoring non-participating piece types */
{
int i=0;
ChessSquare start = (int)p >= (int)BlackPawn ? BlackPawn : WhitePawn;
return i;
}
-ChessSquare CharToPiece(c)
- int c;
+ChessSquare
+CharToPiece (int c)
{
int i;
if(c == '.') return EmptySquare;
return EmptySquare;
}
-void CopyBoard(to, from)
- Board to, from;
+void
+CopyBoard (Board to, Board from)
{
int i, j;
to[HOLDINGS_SET] = 0; // flag used in ICS play
}
-int CompareBoards(board1, board2)
- Board board1, board2;
+int
+CompareBoards (Board board1, Board board2)
{
int i, j;
EP_UNKNOWN if we don't know and want to allow all e.p. captures.
Promotion moves generated are to Queen only.
*/
-void GenPseudoLegal(board, flags, callback, closure, filter)
- Board board;
- int flags;
- MoveCallback callback;
- VOIDSTAR closure;
- ChessSquare filter; // [HGM] speed: only do moves with this piece type
+void
+GenPseudoLegal (Board board, int flags, MoveCallback callback, VOIDSTAR closure, ChessSquare filter)
+// speed: only do moves with this piece type
{
int rf, ff;
int i, j, d, s, fs, rs, rt, ft, m;
int rf, int ff, int rt, int ft,
VOIDSTAR closure));
-void GenLegalCallback(board, flags, kind, rf, ff, rt, ft, closure)
- Board board;
- int flags;
- ChessMove kind;
- int rf, ff, rt, ft;
- VOIDSTAR closure;
+void
+GenLegalCallback (Board board, int flags, ChessMove kind, int rf, int ff, int rt, int ft, VOIDSTAR closure)
{
register GenLegalClosure *cl = (GenLegalClosure *) closure;
true if castling is not yet ruled out by a move of the king or
rook. Return TRUE if the player on move is currently in check and
F_IGNORE_CHECK is not set. [HGM] add castlingRights parameter */
-int GenLegal(board, flags, callback, closure, filter)
- Board board;
- int flags;
- MoveCallback callback;
- VOIDSTAR closure;
- ChessSquare filter;
+int
+GenLegal (Board board, int flags, MoveCallback callback, VOIDSTAR closure, ChessSquare filter)
{
GenLegalClosure cl;
int ff, ft, k, left, right, swap;
VOIDSTAR closure));
-void CheckTestCallback(board, flags, kind, rf, ff, rt, ft, closure)
- Board board;
- int flags;
- ChessMove kind;
- int rf, ff, rt, ft;
- VOIDSTAR closure;
+void
+CheckTestCallback (Board board, int flags, ChessMove kind, int rf, int ff, int rt, int ft, VOIDSTAR closure)
{
register CheckTestClosure *cl = (CheckTestClosure *) closure;
back rank is not accounted for (i.e., we still return nonzero), as
this is illegal anyway. Return value is the number of times the
king is in check. */
-int CheckTest(board, flags, rf, ff, rt, ft, enPassant)
- Board board;
- int flags;
- int rf, ff, rt, ft, enPassant;
+int
+CheckTest (Board board, int flags, int rf, int ff, int rt, int ft, int enPassant)
{
CheckTestClosure cl;
ChessSquare king = flags & F_WHITE_ON_MOVE ? WhiteKing : BlackKing;
return cl.fking < BOARD_RGHT ? cl.check : 1000; // [HGM] atomic: return 1000 if we have no king
}
-ChessMove LegalDrop(board, flags, piece, rt, ft)
- Board board;
- int flags;
- ChessSquare piece;
- int rt, ft;
+ChessMove
+LegalDrop (Board board, int flags, ChessSquare piece, int rt, int ft)
{ // [HGM] put drop legality testing in separate routine for clarity
int n;
if(appData.debugMode) fprintf(debugFP, "LegalDrop: %d @ %d,%d)\n", piece, ft, rt);
int rf, int ff, int rt, int ft,
VOIDSTAR closure));
-void LegalityTestCallback(board, flags, kind, rf, ff, rt, ft, closure)
- Board board;
- int flags;
- ChessMove kind;
- int rf, ff, rt, ft;
- VOIDSTAR closure;
+void
+LegalityTestCallback (Board board, int flags, ChessMove kind, int rf, int ff, int rt, int ft, VOIDSTAR closure)
{
register LegalityTestClosure *cl = (LegalityTestClosure *) closure;
cl->kind = kind;
}
-ChessMove LegalityTest(board, flags, rf, ff, rt, ft, promoChar)
- Board board;
- int flags;
- int rf, ff, rt, ft, promoChar;
+ChessMove
+LegalityTest (Board board, int flags, int rf, int ff, int rt, int ft, int promoChar)
{
LegalityTestClosure cl; ChessSquare piece, filterPiece, *castlingRights = board[CASTLING];
int rf, int ff, int rt, int ft,
VOIDSTAR closure));
-void MateTestCallback(board, flags, kind, rf, ff, rt, ft, closure)
- Board board;
- int flags;
- ChessMove kind;
- int rf, ff, rt, ft;
- VOIDSTAR closure;
+void
+MateTestCallback (Board board, int flags, ChessMove kind, int rf, int ff, int rt, int ft, VOIDSTAR closure)
{
register MateTestClosure *cl = (MateTestClosure *) closure;
}
/* Return MT_NONE, MT_CHECK, MT_CHECKMATE, or MT_STALEMATE */
-int MateTest(board, flags)
- Board board;
- int flags;
+int
+MateTest (Board board, int flags)
{
MateTestClosure cl;
int inCheck, r, f, myPieces=0, hisPieces=0, nrKing=0;
int rf, int ff, int rt, int ft,
VOIDSTAR closure));
-void DisambiguateCallback(board, flags, kind, rf, ff, rt, ft, closure)
- Board board;
- int flags;
- ChessMove kind;
- int rf, ff, rt, ft;
- VOIDSTAR closure;
+void
+DisambiguateCallback (Board board, int flags, ChessMove kind, int rf, int ff, int rt, int ft, VOIDSTAR closure)
{
register DisambiguateClosure *cl = (DisambiguateClosure *) closure;
int wildCard = FALSE; ChessSquare piece = board[rf][ff];
}
}
-void Disambiguate(board, flags, closure)
- Board board;
- int flags;
- DisambiguateClosure *closure;
+void
+Disambiguate (Board board, int flags, DisambiguateClosure *closure)
{
int illegal = 0; char c = closure->promoCharIn;
ChessMove kind, int rf, int ff,
int rt, int ft, VOIDSTAR closure));
-void CoordsToAlgebraicCallback(board, flags, kind, rf, ff, rt, ft, closure)
- Board board;
- int flags;
- ChessMove kind;
- int rf, ff, rt, ft;
- VOIDSTAR closure;
+void
+CoordsToAlgebraicCallback (Board board, int flags, ChessMove kind, int rf, int ff, int rt, int ft, VOIDSTAR closure)
{
register CoordsToAlgebraicClosure *cl =
(CoordsToAlgebraicClosure *) closure;
/* Convert coordinates to normal algebraic notation.
promoChar must be NULLCHAR or 'x' if not a promotion.
*/
-ChessMove CoordsToAlgebraic(board, flags, rf, ff, rt, ft, promoChar, out)
- Board board;
- int flags;
- int rf, ff, rt, ft;
- int promoChar;
- char out[MOVE_LEN];
+ChessMove
+CoordsToAlgebraic (Board board, int flags, int rf, int ff, int rt, int ft, int promoChar, char out[MOVE_LEN])
{
ChessSquare piece;
ChessMove kind;
int rf, int ff, int rt, int ft,
VOIDSTAR closure));
-void AttacksCallback(board, flags, kind, rf, ff, rt, ft, closure)
- Board board;
- int flags;
- ChessMove kind;
- int rf, ff, rt, ft;
- VOIDSTAR closure;
+void
+AttacksCallback (Board board, int flags, ChessMove kind, int rf, int ff, int rt, int ft, VOIDSTAR closure)
{ // For adding captures that can lead to chase indictment to the chaseStack
if(board[rt][ft] == EmptySquare) return; // non-capture
if(board[rt][ft] == WhitePawn && rt < BOARD_HEIGHT/2) return; // Pawn before river can be chased
int rf, int ff, int rt, int ft,
VOIDSTAR closure));
-void ExistingAttacksCallback(board, flags, kind, rf, ff, rt, ft, closure)
- Board board;
- int flags;
- ChessMove kind;
- int rf, ff, rt, ft;
- VOIDSTAR closure;
+void
+ExistingAttacksCallback (Board board, int flags, ChessMove kind, int rf, int ff, int rt, int ft, VOIDSTAR closure)
{ // for removing pre-exsting captures from the chaseStack, to be left with newly created ones
int i;
register ChaseClosure *cl = (ChaseClosure *) closure; //closure tells us the move played in the repeat loop
int rf, int ff, int rt, int ft,
VOIDSTAR closure));
-void ProtectedCallback(board, flags, kind, rf, ff, rt, ft, closure)
- Board board;
- int flags;
- ChessMove kind;
- int rf, ff, rt, ft;
- VOIDSTAR closure;
+void
+ProtectedCallback (Board board, int flags, ChessMove kind, int rf, int ff, int rt, int ft, VOIDSTAR closure)
{ // for determining if a piece (given through the closure) is protected
register ChaseClosure *cl = (ChaseClosure *) closure; // closure tells us where to recapture
extern char moveList[MAX_MOVES][MOVE_LEN];
-int PerpetualChase(int first, int last)
+int
+PerpetualChase (int first, int last)
{ // this routine detects if the side to move in the 'first' position is perpetually chasing (when not checking)
int i, j, k, tail;
ChaseClosure cl;
#define ALPHABETIC 2
#define BADNUMBER (-2000000000)
-int ReadLine()
+int
+ReadLine ()
{ // Read one line from the input file, and append to the buffer
char c, *start = inPtr;
if(fromString) return 0; // parsing string, so the end is a hard end
return 1;
}
-int Scan(char c, char **p)
+int
+Scan (char c, char **p)
{ // line-spanning skip to mentioned character or EOF
do {
while(**p) if(*(*p)++ == c) return 0;
return 1;
}
-int SkipWhite(char **p)
+int
+SkipWhite (char **p)
{ // skip spaces tabs and newlines; return 1 if anything was skipped
char *start = *p;
do{
return *p != start;
}
-inline int Match(char *pattern, char **ptr)
+inline int
+Match (char *pattern, char **ptr)
{
char *p = pattern, *s = *ptr;
while(*p && (*p == *s++ || s[-1] == '\r' && *p--)) p++;
return 0; // no match, no ptr update
}
-inline int Word(char *pattern, char **p)
+inline int
+Word (char *pattern, char **p)
{
if(Match(pattern, p)) return 1;
if(*pattern >= 'a' && *pattern <= 'z' && *pattern - **p == 'a' - 'A') { // capitalized
return 0;
}
-int Verb(char *pattern, char **p)
+int
+Verb (char *pattern, char **p)
{
int res = Word(pattern, p);
if(res && !Match("s", p)) Match("ed", p); // eat conjugation suffix, if any
return res;
}
-
-int Number(char **p)
+int
+Number (char **p)
{
int val = 0;
if(**p < '0' || **p > '9') return BADNUMBER;
return val;
}
-int RdTime(char c, char **p)
+int
+RdTime (char c, char **p)
{
char *start = ++(*p), *sec; // increment *p, as it was pointing to the opening ( or {
if(Number(p) == BADNUMBER) return 0;
return 0;
}
-char PromoSuffix(char **p)
+char
+PromoSuffix (char **p)
{
char *start = *p;
if(**p == 'e' && (Match("ep", p) || Match("e.p.", p))) { *p = start; return NULLCHAR; } // non-compliant e.p. suffix is no promoChar!
return NULLCHAR; // no suffix detected
}
-int NextUnit(char **p)
+int
+NextUnit (char **p)
{ // Main parser routine
int coord[4], n, result, piece, i;
char type[4], promoted, separator, slash, *oldp, *commentEnd, c;
/*
Return offset of next pattern in the current file.
*/
-int yyoffset()
+int
+yyoffset ()
{
return ftell(inputFile) - (inPtr - parsePtr); // subtract what is read but not yet parsed
}
-void yynewfile (FILE *f)
+void
+yynewfile (FILE *f)
{ // prepare parse buffer for reading file
inputFile = f;
inPtr = parsePtr = inputBuf;
*inPtr = NULLCHAR; // make sure we will start by reading a line
}
-void yynewstr P((char *s))
+void
+yynewstr P((char *s))
{
parsePtr = s;
inputFile = NULL;
fromString = 1;
}
-int yylex()
+int
+yylex ()
{ // this replaces the flex-generated parser
int result = NextUnit(&parsePtr);
char *p = parseStart, *q = yytext;
return result;
}
-int Myylex()
+int
+Myylex ()
{ // [HGM] wrapper for yylex, which treats nesting of parentheses
int symbol, nestingLevel = 0, i=0;
char *p;
return symbol;
}
-ChessMove yylexstr(int boardIndex, char *s, char *buf, int buflen)
+ChessMove
+yylexstr (int boardIndex, char *s, char *buf, int buflen)
{
ChessMove ret;
char *savPP = parsePtr;
fromString = 0;
return ret;
}
-
/* Parse PGN tags; returns 0 for success or error number
*/
-int ParsePGNTag(tag, gameInfo)
- char *tag;
- GameInfo *gameInfo;
+int
+ParsePGNTag (char *tag, GameInfo *gameInfo)
{
char *name, *value, *p, *oldTags;
int len;
}
-/* Print game info
- */
-void PrintPGNTags(fp, gameInfo)
- FILE *fp;
- GameInfo *gameInfo;
+/* Print game info */
+void
+PrintPGNTags (FILE *fp, GameInfo *gameInfo)
{
fprintf(fp, "[Event \"%s\"]\n", gameInfo->event ? gameInfo->event : "?");
fprintf(fp, "[Site \"%s\"]\n", gameInfo->site ? gameInfo->site : "?");
/* Return a non-static buffer with a games info.
*/
-char *PGNTags(gameInfo)
- GameInfo *gameInfo;
+char *
+PGNTags (GameInfo *gameInfo)
{
size_t len;
char *buf;
/* Returns pointer to a static string with a result.
*/
-char *PGNResult(result)
- ChessMove result;
+char *
+PGNResult (ChessMove result)
{
switch (result) {
case GameUnfinished:
/* Returns 0 for success, nonzero for error */
int
-ReplaceTags(tags, gameInfo)
- char *tags;
- GameInfo *gameInfo;
+ReplaceTags (char *tags, GameInfo *gameInfo)
{
ChessMove moveType;
int err;
#include "backend.h"
Boolean GetArgValue(char *a);
-void InitEngineUCI( const char * iniDir, ChessProgramState * cps )
+void
+InitEngineUCI (const char *iniDir, ChessProgramState *cps)
{ // replace engine command line by adapter command with expanded meta-symbols
if( cps->isUCI ) {
char *p, *q;
/* Extract piece size from filename */
static int
-xpm_getsize(name, len, ext)
- char *name;
- int len;
- char *ext;
+xpm_getsize (char *name, int len, char *ext)
{
char *p, *d;
char buf[10];
/* Setup xpm_avail */
static int
-xpm_getavail(dirname, ext)
- char *dirname;
- char *ext;
+xpm_getavail (char *dirname, char *ext)
{
DIR *dir;
struct dirent *ent;
}
void
-xpm_print_avail(fp, ext)
- FILE *fp;
- char *ext;
+xpm_print_avail (FILE *fp, char *ext)
{
int i;
/* Return XPM piecesize closest to size */
int
-xpm_closest_to(dirname, size, ext)
- char *dirname;
- int size;
- char *ext;
+xpm_closest_to (char *dirname, int size, char *ext)
{
int i;
int sm_diff = MAXSQSIZE;
read the directory, so we can't collect a list of
filenames, etc., so we can't do any size-fitting. */
int
-xpm_closest_to(dirname, size, ext)
- char *dirname;
- int size;
- char *ext;
+xpm_closest_to (char *dirname, int size, char *ext)
{
fprintf(stderr, _("\
Warning: No DIR structure found on this system --\n\
/* String is: "fg, bg, attr". Which is 0, 1, 2 */
static int
-parse_color(str, which)
- char *str;
- int which;
+parse_color (char *str, int which)
{
char *p, buf[100], *d;
int i;
}
static int
-parse_cpair(cc, str)
- ColorClass cc;
- char *str;
+parse_cpair (ColorClass cc, char *str)
{
if ((textColors[(int)cc].fg=parse_color(str, 0)) == -2) {
fprintf(stderr, _("%s: can't parse foreground color in `%s'\n"),
/* Arrange to catch delete-window events */
Atom wm_delete_window;
void
-CatchDeleteWindow(Widget w, String procname)
+CatchDeleteWindow (Widget w, String procname)
{
char buf[MSG_SIZ];
XSetWMProtocols(xDisplay, XtWindow(w), &wm_delete_window, 1);
}
void
-BoardToTop()
+BoardToTop ()
{
Arg args[16];
XtSetArg(args[0], XtNiconic, False);
char *fontTable[NUM_FONTS][MAX_SIZE];
void
-ParseFont(char *name, int number)
+ParseFont (char *name, int number)
{ // in XBoard, only 2 of the fonts are currently implemented, and we just copy their name
int size;
if(sscanf(name, "size%d:", &size)) {
}
void
-SetFontDefaults()
+SetFontDefaults ()
{ // only 2 fonts currently
appData.clockFont = CLOCK_FONT_NAME;
appData.coordFont = COORD_FONT_NAME;
}
void
-CreateFonts()
+CreateFonts ()
{ // no-op, until we identify the code for this already in XBoard and move it here
}
void
-ParseColor(int n, char *name)
+ParseColor (int n, char *name)
{ // in XBoard, just copy the color-name string
if(colorVariable[n]) *(char**)colorVariable[n] = strdup(name);
}
void
-ParseTextAttribs(ColorClass cc, char *s)
+ParseTextAttribs (ColorClass cc, char *s)
{
(&appData.colorShout)[cc] = strdup(s);
}
void
-ParseBoardSize(void *addr, char *name)
+ParseBoardSize (void *addr, char *name)
{
appData.boardSize = strdup(name);
}
void
-LoadAllSounds()
+LoadAllSounds ()
{ // In XBoard the sound-playing program takes care of obtaining the actual sound
}
void
-SetCommPortDefaults()
+SetCommPortDefaults ()
{ // for now, this is a no-op, as the corresponding option does not exist in XBoard
}
// [HGM] args: these three cases taken out to stay in front-end
void
-SaveFontArg(FILE *f, ArgDescriptor *ad)
+SaveFontArg (FILE *f, ArgDescriptor *ad)
{
char *name;
int i, n = (int)(intptr_t)ad->argLoc;
}
void
-ExportSounds()
+ExportSounds ()
{ // nothing to do, as the sounds are at all times represented by their text-string names already
}
void
-SaveAttribsArg(FILE *f, ArgDescriptor *ad)
+SaveAttribsArg (FILE *f, ArgDescriptor *ad)
{ // here the "argLoc" defines a table index. It could have contained the 'ta' pointer itself, though
fprintf(f, OPTCHAR "%s" SEPCHAR "%s\n", ad->argName, (&appData.colorShout)[(int)(intptr_t)ad->argLoc]);
}
void
-SaveColor(FILE *f, ArgDescriptor *ad)
+SaveColor (FILE *f, ArgDescriptor *ad)
{ // in WinBoard the color is an int and has to be converted to text. In X it would be a string already?
if(colorVariable[(int)(intptr_t)ad->argLoc])
fprintf(f, OPTCHAR "%s" SEPCHAR "%s\n", ad->argName, *(char**)colorVariable[(int)(intptr_t)ad->argLoc]);
}
void
-SaveBoardSize(FILE *f, char *name, void *addr)
+SaveBoardSize (FILE *f, char *name, void *addr)
{ // wrapper to shield back-end from BoardSize & sizeInfo
fprintf(f, OPTCHAR "%s" SEPCHAR "%s\n", name, appData.boardSize);
}
void
-ParseCommPortSettings(char *s)
+ParseCommPortSettings (char *s)
{ // no such option in XBoard (yet)
}
extern Widget engineOutputShell;
void
-GetActualPlacement(Widget wg, WindowPlacement *wp)
+GetActualPlacement (Widget wg, WindowPlacement *wp)
{
Arg args[16];
Dimension w, h;
}
void
-GetWindowCoords()
+GetWindowCoords ()
{ // wrapper to shield use of window handles from back-end (make addressible by number?)
// In XBoard this will have to wait until awareness of window parameters is implemented
GetActualPlacement(shellWidget, &wpMain);
}
void
-PrintCommPortSettings(FILE *f, char *name)
+PrintCommPortSettings (FILE *f, char *name)
{ // This option does not exist in XBoard
}
int
-MySearchPath(char *installDir, char *name, char *fullname)
+MySearchPath (char *installDir, char *name, char *fullname)
{ // just append installDir and name. Perhaps ExpandPath should be used here?
name = ExpandPathName(name);
if(name && name[0] == '/')
}
int
-MyGetFullPathName(char *name, char *fullname)
+MyGetFullPathName (char *name, char *fullname)
{ // should use ExpandPath?
name = ExpandPathName(name);
safeStrCpy(fullname, name, MSG_SIZ );
}
void
-EnsureOnScreen(int *x, int *y, int minX, int minY)
+EnsureOnScreen (int *x, int *y, int minX, int minY)
{
return;
}
int
-MainWindowUp()
+MainWindowUp ()
{ // [HGM] args: allows testing if main window is realized from back-end
return xBoardWindow != 0;
}
void
-PopUpStartupDialog()
+PopUpStartupDialog ()
{ // start menu not implemented in XBoard
}
char *
-ConvertToLine(int argc, char **argv)
+ConvertToLine (int argc, char **argv)
{
static char line[128*1024], buf[1024];
int i;
// eventually, all layout determining code should go into a subroutine, but until then IDSIZE remains undefined
#else
#define BoardSize int
-void InitDrawingSizes(BoardSize boardSize, int flags)
+void
+InitDrawingSizes (BoardSize boardSize, int flags)
{ // [HGM] resize is functional now, but for board format changes only (nr of ranks, files)
Dimension timerWidth, boardWidth, boardHeight, w, h, sep, bor, wr, hr;
Arg args[16];
}
#endif
-void ParseIcsTextColors()
+void
+ParseIcsTextColors ()
{ // [HGM] tken out of main(), so it can be called from ICS-Options dialog
if (parse_cpair(ColorShout, appData.colorShout) < 0 ||
parse_cpair(ColorSShout, appData.colorSShout) < 0 ||
}
}
-int MakeColors()
+int
+MakeColors ()
{ // [HGM] taken out of main(), so it can be called from BoardOptions dialog
XrmValue vFrom, vTo;
int forceMono = False;
}
void
-CreateAnyPieces()
+CreateAnyPieces ()
{ // [HGM] taken out of main
#if HAVE_LIBXPM
if (appData.monoMode && // [HGM] no sense to go on to certain doom
}
int
-main(argc, argv)
- int argc;
- char **argv;
+main (int argc, char **argv)
{
int i, j, clockFontPxlSize, coordFontPxlSize, fontPxlSize;
XSetWindowAttributes window_attributes;
static Boolean noEcho;
void
-ShutDownFrontEnd()
+ShutDownFrontEnd ()
{
if (appData.icsActive && oldICSInteractionTitle != NULL) {
DisplayIcsInteractionTitle(oldICSInteractionTitle);
if(noEcho) EchoOn();
}
-RETSIGTYPE TermSizeSigHandler(int sig)
+RETSIGTYPE
+TermSizeSigHandler (int sig)
{
update_ics_width();
}
RETSIGTYPE
-IntSigHandler(sig)
- int sig;
+IntSigHandler (int sig)
{
ExitEvent(sig);
}
RETSIGTYPE
-CmailSigHandler(sig)
- int sig;
+CmailSigHandler (int sig)
{
int dummy = 0;
int error;
}
void
-CmailSigHandlerCallBack(isr, closure, message, count, error)
- InputSourceRef isr;
- VOIDSTAR closure;
- char *message;
- int count;
- int error;
+CmailSigHandlerCallBack (InputSourceRef isr, VOIDSTAR closure, char *message, int count, int error)
{
BoardToTop();
ReloadCmailMsgEvent(TRUE); /* Reload cmail msg */
void
-ICSInitScript()
+ICSInitScript ()
{
/* try to open the icsLogon script, either in the location given
* or in the users HOME directory
}
void
-ResetFrontEnd()
+ResetFrontEnd ()
{
CommentPopDown();
TagsPopDown();
} Enables;
void
-GreyRevert(grey)
- Boolean grey;
+GreyRevert (Boolean grey)
{
Widget w;
if (!menuBarWidget) return;
}
void
-SetMenuEnables(enab)
- Enables *enab;
+SetMenuEnables (Enables *enab)
{
Widget w;
if (!menuBarWidget) return;
{ NULL, False }
};
-void SetICSMode()
+void
+SetICSMode ()
{
SetMenuEnables(icsEnables);
}
void
-SetNCPMode()
+SetNCPMode ()
{
SetMenuEnables(ncpEnables);
}
void
-SetGNUMode()
+SetGNUMode ()
{
SetMenuEnables(gnuEnables);
}
void
-SetCmailMode()
+SetCmailMode ()
{
SetMenuEnables(cmailEnables);
}
void
-SetTrainingModeOn()
+SetTrainingModeOn ()
{
SetMenuEnables(trainingOnEnables);
if (appData.showButtonBar) {
}
void
-SetTrainingModeOff()
+SetTrainingModeOff ()
{
SetMenuEnables(trainingOffEnables);
if (appData.showButtonBar) {
}
void
-SetUserThinkingEnables()
+SetUserThinkingEnables ()
{
if (appData.noChessProgram) return;
SetMenuEnables(userThinkingEnables);
}
void
-SetMachineThinkingEnables()
+SetMachineThinkingEnables ()
{
if (appData.noChessProgram) return;
SetMenuEnables(machineThinkingEnables);
int histIn = 0, histP = 0;
void
-SaveInHistory(char *cmd)
+SaveInHistory (char *cmd)
{
if (history[histIn] != NULL) {
free(history[histIn]);
}
char *
-PrevInHistory(char *cmd)
+PrevInHistory (char *cmd)
{
int newhp;
if (histP == histIn) {
}
char *
-NextInHistory()
+NextInHistory ()
{
if (histP == histIn) return NULL;
histP = (histP + 1) % HISTORY_SIZE;
#ifdef ENABLE_NLS
char *
-InsertPxlSize(pattern, targetPxlSize)
- char *pattern;
- int targetPxlSize;
+InsertPxlSize (char *pattern, int targetPxlSize)
{
char *base_fnt_lst, strInt[12], *p, *q;
int alternatives, i, len, strIntLen;
}
XFontSet
-CreateFontSet(base_fnt_lst)
- char *base_fnt_lst;
+CreateFontSet (char *base_fnt_lst)
{
XFontSet fntSet;
char **missing_list;
* longer needed.
*/
char *
-FindFont(pattern, targetPxlSize)
- char *pattern;
- int targetPxlSize;
+FindFont (char *pattern, int targetPxlSize)
{
char **fonts, *p, *best, *scalable, *scalableTail;
int i, j, nfonts, minerr, err, pxlSize;
}
#endif
-void DeleteGCs()
+void
+DeleteGCs ()
{ // [HGM] deletes GCs that are to be remade, to prevent resource leak;
// must be called before all non-first callse to CreateGCs()
XtReleaseGC(shellWidget, highlineGC);
}
}
-void CreateGCs(int redo)
+void
+CreateGCs (int redo)
{
XtGCMask value_mask = GCLineWidth | GCLineStyle | GCForeground
| GCBackground | GCFunction | GCPlaneMask;
}
}
-void loadXIM(xim, xmask, filename, dest, mask)
- XImage *xim;
- XImage *xmask;
- char *filename;
- Pixmap *dest;
- Pixmap *mask;
+void
+loadXIM (XImage *xim, XImage *xmask, char *filename, Pixmap *dest, Pixmap *mask)
{
int x, y, w, h, p;
FILE *fp;
char pieceBitmapNames[] = "pnbrqfeacwmohijgdvlsukpnsl";
-void CreateXIMPieces()
+void
+CreateXIMPieces ()
{
int piece, kind;
char buf[MSG_SIZ];
static VariantClass oldVariant = (VariantClass) -1; // [HGM] pieces: redo every time variant changes
#if HAVE_LIBXPM
-void CreateXPMBoard(char *s, int kind)
+void
+CreateXPMBoard (char *s, int kind)
{
XpmAttributes attr;
attr.valuemask = 0;
}
}
-void FreeXPMPieces()
+void
+FreeXPMPieces ()
{ // [HGM] to prevent resoucre leak on calling CreaeXPMPieces() a second time,
// thisroutine has to be called t free the old piece pixmaps
int piece, kind;
}
}
-void CreateXPMPieces()
+void
+CreateXPMPieces ()
{
int piece, kind, r;
char buf[MSG_SIZ];
}
#else
/* With built-in bitmaps */
-void CreatePieces()
+void
+CreatePieces ()
{
BuiltInBits* bib = builtInBits;
int piece, kind;
}
#endif
-void ReadBitmap(pm, name, bits, wreq, hreq)
- Pixmap *pm;
- String name;
- unsigned char bits[];
- u_int wreq, hreq;
+void
+ReadBitmap (Pixmap *pm, String name, unsigned char bits[], u_int wreq, u_int hreq)
{
int x_hot, y_hot;
u_int w, h;
}
}
-void CreateGrid()
+void
+CreateGrid ()
{
int i, j;
}
}
-static void MenuBarSelect(w, addr, index)
- Widget w;
- caddr_t addr;
- caddr_t index;
+static void
+MenuBarSelect (Widget w, caddr_t addr, caddr_t index)
{
XtActionProc proc = (XtActionProc) addr;
(proc)(NULL, NULL, NULL, NULL);
}
-void CreateMenuBarPopup(parent, name, mb)
- Widget parent;
- String name;
- Menu *mb;
+void
+CreateMenuBarPopup (Widget parent, String name, Menu *mb)
{
int j;
Widget menu, entry;
}
}
-Widget CreateMenuBar(mb, boardWidth)
- Menu *mb;
- int boardWidth;
+Widget
+CreateMenuBar (Menu *mb, int boardWidth)
{
int i, j, nr = 0, wtot = 0, widths[10];
Widget menuBar;
return menuBar;
}
-Widget CreateButtonBar(mi)
- MenuItem *mi;
+Widget
+CreateButtonBar (MenuItem *mi)
{
int j;
Widget button, buttonBar;
}
Widget
-CreatePieceMenu(name, color)
- char *name;
- int color;
+CreatePieceMenu (char *name, int color)
{
int i;
Widget entry, menu;
}
void
-CreatePieceMenus()
+CreatePieceMenus ()
{
int i;
Widget entry;
}
}
-void SetupDropMenu()
+void
+SetupDropMenu ()
{
int i, j, count;
char label[32];
}
}
-void PieceMenuPopup(w, event, params, num_params)
- Widget w;
- XEvent *event;
- String *params;
- Cardinal *num_params;
+void
+PieceMenuPopup (Widget w, XEvent *event, String *params, Cardinal *num_params)
{
String whichMenu; int menuNr = -2;
shiftKey = strcmp(params[0], "menuW"); // used to indicate black
XtPopupSpringLoaded(XtNameToWidget(boardWidget, whichMenu));
}
-static void PieceMenuSelect(w, piece, junk)
- Widget w;
- ChessSquare piece;
- caddr_t junk;
+static void
+PieceMenuSelect (Widget w, ChessSquare piece, caddr_t junk)
{
if (pmFromX < 0 || pmFromY < 0) return;
EditPositionMenuEvent(piece, pmFromX, pmFromY);
}
-static void DropMenuSelect(w, piece, junk)
- Widget w;
- ChessSquare piece;
- caddr_t junk;
+static void
+DropMenuSelect (Widget w, ChessSquare piece, caddr_t junk)
{
if (pmFromX < 0 || pmFromY < 0) return;
DropMenuEvent(piece, pmFromX, pmFromY);
}
-void WhiteClock(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
+void
+WhiteClock (Widget w, XEvent *event, String *prms, Cardinal *nprms)
{
shiftKey = prms[0][0] & 1;
ClockClick(0);
}
-void BlackClock(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
+void
+BlackClock (Widget w, XEvent *event, String *prms, Cardinal *nprms)
{
shiftKey = prms[0][0] & 1;
ClockClick(1);
* If the user selects on a border boundary, return -1; if off the board,
* return -2. Otherwise map the event coordinate to the square.
*/
-int EventToSquare(x, limit)
- int x;
+int
+EventToSquare (int x, int limit)
{
if (x <= 0)
return -2;
return x;
}
-static void do_flash_delay(msec)
- unsigned long msec;
+static void
+do_flash_delay (unsigned long msec)
{
TimeDelay(msec);
}
-static void drawHighlight(file, rank, gc)
- int file, rank;
- GC gc;
+static void
+drawHighlight (int file, int rank, GC gc)
{
int x, y;
int pm1X = -1, pm1Y = -1, pm2X = -1, pm2Y = -1;
void
-SetHighlights(fromX, fromY, toX, toY)
- int fromX, fromY, toX, toY;
+SetHighlights (int fromX, int fromY, int toX, int toY)
{
if (hi1X != fromX || hi1Y != fromY) {
if (hi1X >= 0 && hi1Y >= 0) {
}
void
-ClearHighlights()
+ClearHighlights ()
{
SetHighlights(-1, -1, -1, -1);
}
void
-SetPremoveHighlights(fromX, fromY, toX, toY)
- int fromX, fromY, toX, toY;
+SetPremoveHighlights (int fromX, int fromY, int toX, int toY)
{
if (pm1X != fromX || pm1Y != fromY) {
if (pm1X >= 0 && pm1Y >= 0) {
}
void
-ClearPremoveHighlights()
+ClearPremoveHighlights ()
{
SetPremoveHighlights(-1, -1, -1, -1);
}
-static int CutOutSquare(x, y, x0, y0, kind)
- int x, y, *x0, *y0, kind;
+static int
+CutOutSquare (int x, int y, int *x0, int *y0, int kind)
{
int W = BOARD_WIDTH, H = BOARD_HEIGHT;
int nx = x/(squareSize + lineGap), ny = y/(squareSize + lineGap);
return 1;
}
-static void BlankSquare(x, y, color, piece, dest, fac)
- int x, y, color, fac;
- ChessSquare piece;
- Drawable dest;
+static void
+BlankSquare (int x, int y, int color, ChessSquare piece, Drawable dest, int fac)
{ // [HGM] extra param 'fac' for forcing destination to (0,0) for copying to animation buffer
int x0, y0;
if (useImages && color != 2 && (useTexture & color+1) && CutOutSquare(x, y, &x0, &y0, color)) {
I split out the routines to draw a piece so that I could
make a generic flash routine.
*/
-static void monoDrawPiece_1bit(piece, square_color, x, y, dest)
- ChessSquare piece;
- int square_color, x, y;
- Drawable dest;
+static void
+monoDrawPiece_1bit (ChessSquare piece, int square_color, int x, int y, Drawable dest)
{
/* Avoid XCopyPlane on 1-bit screens to work around Sun bug */
switch (square_color) {
}
}
-static void monoDrawPiece(piece, square_color, x, y, dest)
- ChessSquare piece;
- int square_color, x, y;
- Drawable dest;
+static void
+monoDrawPiece (ChessSquare piece, int square_color, int x, int y, Drawable dest)
{
switch (square_color) {
case 1: /* light */
}
}
-static void colorDrawPiece(piece, square_color, x, y, dest)
- ChessSquare piece;
- int square_color, x, y;
- Drawable dest;
+static void
+colorDrawPiece (ChessSquare piece, int square_color, int x, int y, Drawable dest)
{
if(pieceToSolid(piece) == NULL) return; // [HGM] bitmaps: make it non-fatal if we have no bitmap;
switch (square_color) {
}
}
-static void colorDrawPieceImage(piece, square_color, x, y, dest)
- ChessSquare piece;
- int square_color, x, y;
- Drawable dest;
+static void
+colorDrawPieceImage (ChessSquare piece, int square_color, int x, int y, Drawable dest)
{
int kind, p = piece;
typedef void (*DrawFunc)();
-DrawFunc ChooseDrawFunc()
+DrawFunc
+ChooseDrawFunc ()
{
if (appData.monoMode) {
if (DefaultDepth(xDisplay, xScreen) == 1) {
}
/* [HR] determine square color depending on chess variant. */
-static int SquareColor(row, column)
- int row, column;
+static int
+SquareColor (int row, int column)
{
int square_color;
return square_color;
}
-void DrawSquare(row, column, piece, do_flash)
- int row, column, do_flash;
- ChessSquare piece;
+void
+DrawSquare (int row, int column, ChessSquare piece, int do_flash)
{
int square_color, x, y, direction, font_ascent, font_descent;
int i;
/* Why is this needed on some versions of X? */
-void EventProc(widget, unused, event)
- Widget widget;
- caddr_t unused;
- XEvent *event;
+void
+EventProc (Widget widget, caddr_t unused, XEvent *event)
{
if (!XtIsRealized(widget))
return;
}
/* end why */
-void DrawPosition(fullRedraw, board)
- /*Boolean*/int fullRedraw;
- Board board;
+void
+DrawPosition (int fullRedraw, Board board)
{
XDrawPosition(boardWidget, fullRedraw, board);
}
/* Returns 1 if there are "too many" differences between b1 and b2
(i.e. more than 1 move was made) */
-static int too_many_diffs(b1, b2)
- Board b1, b2;
+static int
+too_many_diffs (Board b1, Board b2)
{
int i, j;
int c = 0;
Note: Only handles a max of 1 castling move, so be sure
to call too_many_diffs() first.
*/
-static int check_castle_draw(newb, oldb, rrow, rcol)
- Board newb, oldb;
- int *rrow, *rcol;
+static int
+check_castle_draw (Board newb, Board oldb, int *rrow, int *rcol)
{
int i, *r, j;
int match;
}
// [HGM] seekgraph: some low-level drawing routines cloned from xevalgraph
-void DrawSeekAxis( int x, int y, int xTo, int yTo )
+void
+DrawSeekAxis (int x, int y, int xTo, int yTo)
{
XDrawLine(xDisplay, xBoardWindow, lineGC, x, y, xTo, yTo);
}
-void DrawSeekBackground( int left, int top, int right, int bottom )
+void
+DrawSeekBackground (int left, int top, int right, int bottom)
{
XFillRectangle(xDisplay, xBoardWindow, lightSquareGC, left, top, right-left, bottom-top);
}
-void DrawSeekText(char *buf, int x, int y)
+void
+DrawSeekText (char *buf, int x, int y)
{
XDrawString(xDisplay, xBoardWindow, coordGC, x, y+4, buf, strlen(buf));
}
-void DrawSeekDot(int x, int y, int colorNr)
+void
+DrawSeekDot (int x, int y, int colorNr)
{
int square = colorNr & 0x80;
GC color;
/*
* event handler for redrawing the board
*/
-void XDrawPosition(w, repaint, board)
- Widget w;
- /*Boolean*/int repaint;
- Board board;
+void
+XDrawPosition (Widget w, int repaint, Board board)
{
int i, j, do_flash;
static int lastFlipView = 0;
/*
* event handler for redrawing the board
*/
-void DrawPositionProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
+void
+DrawPositionProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
{
XDrawPosition(w, True, NULL);
}
// move, (which will weed out the illegal selfcaptures and moves into the holdings, and flag promotions),
// and at the end FinishMove() to perform the move after optional promotion popups.
// For now I patched it to allow self-capture with King, and suppress clicks between board and holdings.
-void HandleUserMove(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
+void
+HandleUserMove (Widget w, XEvent *event, String *prms, Cardinal *nprms)
{
if (w != boardWidget || errorExitStatus != -1) return;
if(nprms) shiftKey = !strcmp(prms[0], "1");
if(event->type == ButtonRelease) LeftClick(Release, event->xbutton.x, event->xbutton.y);
}
-void AnimateUserMove (Widget w, XEvent * event,
- String * params, Cardinal * nParams)
+void
+AnimateUserMove (Widget w, XEvent *event, String *params, Cardinal *nParams)
{
if(!PromoScroll(event->xmotion.x, event->xmotion.y))
DragPieceMove(event->xmotion.x, event->xmotion.y);
}
-void HandlePV (Widget w, XEvent * event,
- String * params, Cardinal * nParams)
+void
+HandlePV (Widget w, XEvent * event, String * params, Cardinal * nParams)
{ // [HGM] pv: walk PV
MovePV(event->xmotion.x, event->xmotion.y, lineGap + BOARD_HEIGHT * (squareSize + lineGap));
}
static int savedIndex; /* gross that this is global */
-void CommentClick (Widget w, XEvent * event, String * params, Cardinal * nParams)
+void
+CommentClick (Widget w, XEvent * event, String * params, Cardinal * nParams)
{
String val;
XawTextPosition index, dummy;
LoadVariation( index, val ); // [HGM] also does the actual moving to it, now
}
-void EditCommentPopUp(index, title, text)
- int index;
- char *title, *text;
+void
+EditCommentPopUp (int index, char *title, char *text)
{
savedIndex = index;
if (text == NULL) text = "";
NewCommentPopup(title, text, index);
}
-void ICSInputBoxPopUp()
+void
+ICSInputBoxPopUp ()
{
InputBoxPopup();
}
extern Option boxOptions[];
-void ICSInputSendText()
+void
+ICSInputSendText ()
{
Widget edit;
int j;
XtCallActionProc(edit, "kill-selection", NULL, NULL, 0);
}
-void ICSInputBoxPopDown()
+void
+ICSInputBoxPopDown ()
{
PopDown(4);
}
-void CommentPopUp(title, text)
- char *title, *text;
+void
+CommentPopUp (char *title, char *text)
{
savedIndex = currentMove; // [HGM] vari
NewCommentPopup(title, text, currentMove);
}
-void CommentPopDown()
+void
+CommentPopDown ()
{
PopDown(1);
}
static char *openName;
FILE *openFP;
-void DelayedLoad()
+void
+DelayedLoad ()
{
(void) (*fileProc)(openFP, 0, openName);
}
-void FileNamePopUp(label, def, filter, proc, openMode)
- char *label;
- char *def;
- char *filter;
- FileProc proc;
- char *openMode;
+void
+FileNamePopUp (char *label, char *def, char *filter, FileProc proc, char *openMode)
{
fileProc = proc; /* I can't see a way not */
fileOpenMode = openMode; /* to use globals here */
}
}
-void FileNamePopDown()
+void
+FileNamePopDown ()
{
if (!filenameUp) return;
XtPopdown(fileNameShell);
ModeHighlight();
}
-void FileNameCallback(w, client_data, call_data)
- Widget w;
- XtPointer client_data, call_data;
+void
+FileNameCallback (Widget w, XtPointer client_data, XtPointer call_data)
{
String name;
Arg args[16];
FileNameAction(w, NULL, NULL, NULL);
}
-void FileNameAction(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
+void
+FileNameAction (Widget w, XEvent *event, String *prms, Cardinal *nprms)
{
char buf[MSG_SIZ];
String name;
ModeHighlight();
}
-void PromotionPopUp()
+void
+PromotionPopUp ()
{
Arg args[16];
Widget dialog, layout;
promotionUp = True;
}
-void PromotionPopDown()
+void
+PromotionPopDown ()
{
if (!promotionUp) return;
XtPopdown(promotionShell);
promotionUp = False;
}
-void PromotionCallback(w, client_data, call_data)
- Widget w;
- XtPointer client_data, call_data;
+void
+PromotionCallback (Widget w, XtPointer client_data, XtPointer call_data)
{
int promoChar = * (const char *) client_data;
}
-void ErrorCallback(w, client_data, call_data)
- Widget w;
- XtPointer client_data, call_data;
+void
+ErrorCallback (Widget w, XtPointer client_data, XtPointer call_data)
{
errorUp = False;
XtPopdown(w = XtParent(XtParent(XtParent(w))));
}
-void ErrorPopDown()
+void
+ErrorPopDown ()
{
if (!errorUp) return;
errorUp = False;
if (errorExitStatus != -1) ExitEvent(errorExitStatus);
}
-void ErrorPopUp(title, label, modal)
- char *title, *label;
- int modal;
+void
+ErrorPopUp (char *title, char *label, int modal)
{
Arg args[16];
Widget dialog, layout;
/* Disable all user input other than deleting the window */
static int frozen = 0;
-void FreezeUI()
+
+void
+FreezeUI ()
{
if (frozen) return;
/* Grab by a widget that doesn't accept input */
}
/* Undo a FreezeUI */
-void ThawUI()
+void
+ThawUI ()
{
if (!frozen) return;
XtRemoveGrab(messageWidget);
frozen = 0;
}
-char *ModeToWidgetName(mode)
- GameMode mode;
+char *
+ModeToWidgetName (GameMode mode)
{
switch (mode) {
case BeginningOfGame:
}
}
-void ModeHighlight()
+void
+ModeHighlight ()
{
Arg args[16];
static int oldPausing = FALSE;
/*
* Button/menu procedures
*/
-void ResetProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
+void
+ResetProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
{
ResetGameEvent();
}
-int LoadGamePopUp(f, gameNumber, title)
- FILE *f;
- int gameNumber;
- char *title;
+int
+LoadGamePopUp (FILE *f, int gameNumber, char *title)
{
cmailMsgLoaded = FALSE;
if (gameNumber == 0) {
return LoadGame(f, gameNumber, title, FALSE);
}
-void LoadGameProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
+void
+LoadGameProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
{
if (gameMode == AnalyzeMode || gameMode == AnalyzeFile) {
Reset(FALSE, TRUE);
FileNamePopUp(_("Load game file name?"), "", ".pgn .game", LoadGamePopUp, "rb");
}
-void LoadNextGameProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
+void
+LoadNextGameProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
{
ReloadGame(1);
}
-void LoadPrevGameProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
+void
+LoadPrevGameProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
{
ReloadGame(-1);
}
-void ReloadGameProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
+void
+ReloadGameProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
{
ReloadGame(0);
}
-void LoadNextPositionProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
+void
+LoadNextPositionProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
{
ReloadPosition(1);
}
-void LoadPrevPositionProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
+void
+LoadPrevPositionProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
{
ReloadPosition(-1);
}
-void ReloadPositionProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
+void
+ReloadPositionProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
{
ReloadPosition(0);
}
-void LoadPositionProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
+void
+LoadPositionProc(Widget w, XEvent *event, String *prms, Cardinal *nprms)
{
if (gameMode == AnalyzeMode || gameMode == AnalyzeFile) {
Reset(FALSE, TRUE);
FileNamePopUp(_("Load position file name?"), "", ".fen .epd .pos", LoadPosition, "rb");
}
-void SaveGameProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
+void
+SaveGameProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
{
FileNamePopUp(_("Save game file name?"),
DefaultFileName(appData.oldSaveStyle ? "game" : "pgn"),
SaveGame, "a");
}
-void SavePositionProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
+void
+SavePositionProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
{
FileNamePopUp(_("Save position file name?"),
DefaultFileName(appData.oldSaveStyle ? "pos" : "fen"),
SavePosition, "a");
}
-void ReloadCmailMsgProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
+void
+ReloadCmailMsgProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
{
ReloadCmailMsgEvent(FALSE);
}
-void MailMoveProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
+void
+MailMoveProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
{
MailMoveEvent();
}
char *selected_fen_position=NULL;
Boolean
-SendPositionSelection(Widget w, Atom *selection, Atom *target,
- Atom *type_return, XtPointer *value_return,
- unsigned long *length_return, int *format_return)
+SendPositionSelection (Widget w, Atom *selection, Atom *target,
+ Atom *type_return, XtPointer *value_return,
+ unsigned long *length_return, int *format_return)
{
char *selection_tmp;
/* note: when called from menu all parameters are NULL, so no clue what the
* Widget which was clicked on was, or what the click event was
*/
-void CopyPositionProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
- {
+void
+CopyPositionProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
+{
/*
* Set both PRIMARY (the selection) and CLIPBOARD, since we don't
* have a notion of a position that is selected but not copied.
SendPositionSelection,
NULL/* lose_ownership_proc */ ,
NULL/* transfer_done_proc */);
- }
+}
/* function called when the data to Paste is ready */
static void
-PastePositionCB(Widget w, XtPointer client_data, Atom *selection,
- Atom *type, XtPointer value, unsigned long *len, int *format)
+PastePositionCB (Widget w, XtPointer client_data, Atom *selection,
+ Atom *type, XtPointer value, unsigned long *len, int *format)
{
char *fenstr=value;
if (value==NULL || *len==0) return; /* nothing had been selected to copy */
}
static Boolean
-SendGameSelection(Widget w, Atom *selection, Atom *target,
- Atom *type_return, XtPointer *value_return,
- unsigned long *length_return, int *format_return)
+SendGameSelection (Widget w, Atom *selection, Atom *target,
+ Atom *type_return, XtPointer *value_return,
+ unsigned long *length_return, int *format_return)
{
char *selection_tmp;
}
}
-void CopySomething()
+void
+CopySomething ()
{
/*
* Set both PRIMARY (the selection) and CLIPBOARD, since we don't
/* note: when called from menu all parameters are NULL, so no clue what the
* Widget which was clicked on was, or what the click event was
*/
-void CopyGameProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
+void
+CopyGameProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
{
int ret;
CopySomething();
}
-void CopyGameListProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
+void
+CopyGameListProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
{
if(!SaveGameListAsText(fopen(gameCopyFilename, "w"))) return;
CopySomething();
/* function called when the data to Paste is ready */
static void
-PasteGameCB(Widget w, XtPointer client_data, Atom *selection,
- Atom *type, XtPointer value, unsigned long *len, int *format)
+PasteGameCB (Widget w, XtPointer client_data, Atom *selection,
+ Atom *type, XtPointer value, unsigned long *len, int *format)
{
FILE* f;
if (value == NULL || *len == 0) {
/* called when Paste Game button is pressed,
* all parameters will be NULL */
-void PasteGameProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
+void
+PasteGameProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
{
XtGetSelectionValue(menuBarWidget,
appData.pasteSelection ? XA_PRIMARY: XA_CLIPBOARD(xDisplay), XA_STRING,
}
-void AutoSaveGame()
+void
+AutoSaveGame ()
{
SaveGameProc(NULL, NULL, NULL, NULL);
}
-void QuitProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
+void
+QuitProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
{
ExitEvent(0);
}
-void PauseProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
+void
+PauseProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
{
PauseEvent();
}
-
-void MachineBlackProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
+void
+MachineBlackProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
{
MachineBlackEvent();
}
-void MachineWhiteProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
+void
+MachineWhiteProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
{
MachineWhiteEvent();
}
-void AnalyzeModeProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
+void
+AnalyzeModeProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
{
char buf[MSG_SIZ];
AnalyzeModeEvent();
}
-void AnalyzeFileProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
+void
+AnalyzeFileProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
{
if (!first.analysisSupport) {
char buf[MSG_SIZ];
AnalysisPeriodicEvent(1);
}
-void TwoMachinesProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
+void
+TwoMachinesProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
{
TwoMachinesEvent();
}
-void MatchProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
+void
+MatchProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
{
MatchEvent(2);
}
-void IcsClientProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
+void
+IcsClientProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
{
IcsClientEvent();
}
-void EditGameProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
+void
+EditGameProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
{
EditGameEvent();
}
-void EditPositionProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
+void
+EditPositionProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
{
EditPositionEvent();
}
-void TrainingProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
+void
+TrainingProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
{
TrainingEvent();
}
-void EditCommentProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
+void
+EditCommentProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
{
Arg args[5];
int j;
EditCommentEvent();
}
-void IcsInputBoxProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
+void
+IcsInputBoxProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
{
if (!PopDown(4)) ICSInputBoxPopUp();
}
-void AcceptProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
+void
+AcceptProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
{
AcceptEvent();
}
-void DeclineProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
+void
+DeclineProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
{
DeclineEvent();
}
-void RematchProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
+void
+RematchProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
{
RematchEvent();
}
-void CallFlagProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
+void
+CallFlagProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
{
CallFlagEvent();
}
-void DrawProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
+void
+DrawProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
{
DrawEvent();
}
-void AbortProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
+void
+AbortProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
{
AbortEvent();
}
-void AdjournProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
+void
+AdjournProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
{
AdjournEvent();
}
-void ResignProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
+void
+ResignProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
{
ResignEvent();
}
-void AdjuWhiteProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
+void
+AdjuWhiteProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
{
UserAdjudicationEvent(+1);
}
-void AdjuBlackProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
+void
+AdjuBlackProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
{
UserAdjudicationEvent(-1);
}
-void AdjuDrawProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
+void
+AdjuDrawProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
{
UserAdjudicationEvent(0);
}
-void EnterKeyProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
+void
+EnterKeyProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
{
if (shellUp[4] == True)
ICSInputSendText();
}
-void UpKeyProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
+void
+UpKeyProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
{ // [HGM] input: let up-arrow recall previous line from history
Widget edit;
int j;
}
}
-void DownKeyProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
+void
+DownKeyProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
{ // [HGM] input: let down-arrow recall next line from history
Widget edit;
String val;
}
}
-void StopObservingProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
+void
+StopObservingProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
{
StopObservingEvent();
}
-void StopExaminingProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
+void
+StopExaminingProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
{
StopExaminingEvent();
}
-void UploadProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
+void
+UploadProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
{
UploadGameEvent();
}
-void ForwardProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
+void
+ForwardProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
{
ForwardEvent();
}
-void BackwardProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
+void
+BackwardProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
{
BackwardEvent();
}
-void TempBackwardProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
+void
+TempBackwardProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
{
if (!TempBackwardActive) {
TempBackwardActive = True;
}
}
-void TempForwardProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
+void
+TempForwardProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
{
/* Check to see if triggered by a key release event for a repeating key.
* If so the next queued event will be a key press of the same key at the same time */
TempBackwardActive = False;
}
-void ToStartProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
+void
+ToStartProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
{
ToStartEvent();
}
-void ToEndProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
+void
+ToEndProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
{
ToEndEvent();
}
-void RevertProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
+void
+RevertProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
{
RevertEvent(False);
}
-void AnnotateProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
+void
+AnnotateProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
{
RevertEvent(True);
}
-void TruncateGameProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
+void
+TruncateGameProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
{
TruncateGameEvent();
}
-void RetractMoveProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
+
+void
+RetractMoveProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
{
RetractMoveEvent();
}
-void MoveNowProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
+void
+MoveNowProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
{
MoveNowEvent();
}
-void FlipViewProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
+void
+FlipViewProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
{
flipView = !flipView;
DrawPosition(True, NULL);
}
-void PonderNextMoveProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
+void
+PonderNextMoveProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
{
Arg args[16];
}
#ifndef OPTIONSDIALOG
-void AlwaysQueenProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
+void
+AlwaysQueenProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
{
Arg args[16];
args, 1);
}
-void AnimateDraggingProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
+void
+AnimateDraggingProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
{
Arg args[16];
args, 1);
}
-void AnimateMovingProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
+void
+AnimateMovingProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
{
Arg args[16];
args, 1);
}
-void AutoflagProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
+void
+AutoflagProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
{
Arg args[16];
args, 1);
}
-void AutoflipProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
+void
+AutoflipProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
{
Arg args[16];
args, 1);
}
-void BlindfoldProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
+void
+BlindfoldProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
{
Arg args[16];
DrawPosition(True, NULL);
}
-void TestLegalityProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
+void
+TestLegalityProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
{
Arg args[16];
}
-void FlashMovesProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
+void
+FlashMovesProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
{
Arg args[16];
}
#if HIGHDRAG
-void HighlightDraggingProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
+void
+HighlightDraggingProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
{
Arg args[16];
}
#endif
-void HighlightLastMoveProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
+void
+HighlightLastMoveProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
{
Arg args[16];
"menuOptions.Highlight Last Move"), args, 1);
}
-void HighlightArrowProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
+void
+HighlightArrowProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
{
Arg args[16];
}
#if 0
-void IcsAlarmProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
+void
+IcsAlarmProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
{
Arg args[16];
}
#endif
-void MoveSoundProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
+void
+MoveSoundProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
{
Arg args[16];
args, 1);
}
-void OneClickProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
+void
+OneClickProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
{
Arg args[16];
args, 1);
}
-void PeriodicUpdatesProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
+void
+PeriodicUpdatesProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
{
Arg args[16];
args, 1);
}
-void PopupExitMessageProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
+void
+PopupExitMessageProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
{
Arg args[16];
"menuOptions.Popup Exit Message"), args, 1);
}
-void PopupMoveErrorsProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
+void
+PopupMoveErrorsProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
{
Arg args[16];
}
#if 0
-void PremoveProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
+void
+PremoveProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
{
Arg args[16];
}
#endif
-void ShowCoordsProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
+void
+ShowCoordsProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
{
Arg args[16];
DrawPosition(True, NULL);
}
-void ShowThinkingProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
+void
+ShowThinkingProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
{
appData.showThinking = !appData.showThinking; // [HGM] thinking: tken out of ShowThinkingEvent
ShowThinkingEvent();
}
-void HideThinkingProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
+void
+HideThinkingProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
{
Arg args[16];
}
#endif
-void SaveOnExitProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
+void
+SaveOnExitProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
{
Arg args[16];
args, 1);
}
-void SaveSettingsProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
+void
+SaveSettingsProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
{
SaveSettings(settingsFileName);
}
-void InfoProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
+void
+InfoProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
{
char buf[MSG_SIZ];
snprintf(buf, sizeof(buf), "xterm -e info --directory %s --directory . -f %s &",
system(buf);
}
-void ManProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
+void
+ManProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
{
char buf[MSG_SIZ];
String name;
system(buf);
}
-void HintProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
+void
+HintProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
{
HintEvent();
}
-void BookProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
+void
+BookProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
{
BookEvent();
}
-void AboutProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
+void
+AboutProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
{
char buf[MSG_SIZ];
#if ZIPPY
ErrorPopUp(_("About XBoard"), buf, FALSE);
}
-void DebugProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
+void
+DebugProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
{
appData.debugMode = !appData.debugMode;
}
-void AboutGameProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
+void
+AboutGameProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
{
AboutGameEvent();
}
-void NothingProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
+void
+NothingProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
{
return;
}
-void DisplayMessage(message, extMessage)
- char *message, *extMessage;
+void
+DisplayMessage (char *message, char *extMessage)
{
/* display a message in the message widget */
return;
}
-void DisplayTitle(text)
- char *text;
+void
+DisplayTitle (char *text)
{
Arg args[16];
int i;
void
-DisplayError(message, error)
- String message;
- int error;
+DisplayError (String message, int error)
{
char buf[MSG_SIZ];
}
-void DisplayMoveError(message)
- String message;
+void
+DisplayMoveError (String message)
{
fromX = fromY = -1;
ClearHighlights();
}
-void DisplayFatalError(message, error, status)
- String message;
- int error, status;
+void
+DisplayFatalError (String message, int error, int status)
{
char buf[MSG_SIZ];
}
}
-void DisplayInformation(message)
- String message;
+void
+DisplayInformation (String message)
{
ErrorPopDown();
ErrorPopUp(_("Information"), message, TRUE);
}
-void DisplayNote(message)
- String message;
+void
+DisplayNote (String message)
{
ErrorPopDown();
ErrorPopUp(_("Note"), message, FALSE);
}
static int
-NullXErrorCheck(dpy, error_event)
- Display *dpy;
- XErrorEvent *error_event;
+NullXErrorCheck (Display *dpy, XErrorEvent *error_event)
{
return 0;
}
-void DisplayIcsInteractionTitle(message)
- String message;
+void
+DisplayIcsInteractionTitle (String message)
{
if (oldICSInteractionTitle == NULL) {
/* Magic to find the old window title, adapted from vim */
char pendingReplyPrefix[MSG_SIZ];
ProcRef pendingReplyPR;
-void AskQuestionProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
+void
+AskQuestionProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
{
if (*nprms != 4) {
fprintf(stderr, _("AskQuestionProc needed 4 parameters, got %d\n"),
AskQuestionEvent(prms[0], prms[1], prms[2], prms[3]);
}
-void AskQuestionPopDown()
+void
+AskQuestionPopDown ()
{
if (!askQuestionUp) return;
XtPopdown(askQuestionShell);
askQuestionUp = False;
}
-void AskQuestionReplyAction(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
+void
+AskQuestionReplyAction (Widget w, XEvent *event, String *prms, Cardinal *nprms)
{
char buf[MSG_SIZ];
int err;
if (err) DisplayFatalError(_("Error writing to chess program"), err, 0);
}
-void AskQuestionCallback(w, client_data, call_data)
- Widget w;
- XtPointer client_data, call_data;
+void
+AskQuestionCallback (Widget w, XtPointer client_data, XtPointer call_data)
{
String name;
Arg args[16];
}
}
-void AskQuestion(title, question, replyPrefix, pr)
- char *title, *question, *replyPrefix;
- ProcRef pr;
+void
+AskQuestion (char *title, char *question, char *replyPrefix, ProcRef pr)
{
Arg args[16];
Widget popup, layout, dialog, edit;
void
-PlaySound(name)
- char *name;
+PlaySound (char *name)
{
if (*name == NULLCHAR) {
return;
}
void
-RingBell()
+RingBell ()
{
PlaySound(appData.soundMove);
}
void
-PlayIcsWinSound()
+PlayIcsWinSound ()
{
PlaySound(appData.soundIcsWin);
}
void
-PlayIcsLossSound()
+PlayIcsLossSound ()
{
PlaySound(appData.soundIcsLoss);
}
void
-PlayIcsDrawSound()
+PlayIcsDrawSound ()
{
PlaySound(appData.soundIcsDraw);
}
void
-PlayIcsUnfinishedSound()
+PlayIcsUnfinishedSound ()
{
PlaySound(appData.soundIcsUnfinished);
}
void
-PlayAlarmSound()
+PlayAlarmSound ()
{
PlaySound(appData.soundIcsAlarm);
}
void
-PlayTellSound()
+PlayTellSound ()
{
PlaySound(appData.soundTell);
}
void
-EchoOn()
+EchoOn ()
{
system("stty echo");
noEcho = False;
}
void
-EchoOff()
+EchoOff ()
{
system("stty -echo");
noEcho = True;
}
void
-RunCommand(char *buf)
+RunCommand (char *buf)
{
system(buf);
}
void
-Colorize(cc, continuation)
- ColorClass cc;
- int continuation;
+Colorize (ColorClass cc, int continuation)
{
char buf[MSG_SIZ];
int count, outCount, error;
}
}
-char *UserName()
+char *
+UserName ()
{
return getpwuid(getuid())->pw_name;
}
static char *
-ExpandPathName(path)
- char *path;
+ExpandPathName (char *path)
{
static char static_buf[4*MSG_SIZ];
char *d, *s, buf[4*MSG_SIZ];
return static_buf;
}
-char *HostName()
+char *
+HostName ()
{
static char host_name[MSG_SIZ];
DelayedEventCallback delayedEventCallback = 0;
void
-FireDelayedEvent()
+FireDelayedEvent ()
{
delayedEventTimerXID = 0;
delayedEventCallback();
}
void
-ScheduleDelayedEvent(cb, millisec)
- DelayedEventCallback cb; long millisec;
+ScheduleDelayedEvent (DelayedEventCallback cb, long millisec)
{
if(delayedEventTimerXID && delayedEventCallback == cb)
// [HGM] alive: replace, rather than add or flush identical event
}
DelayedEventCallback
-GetDelayedEvent()
+GetDelayedEvent ()
{
if (delayedEventTimerXID) {
return delayedEventCallback;
}
void
-CancelDelayedEvent()
+CancelDelayedEvent ()
{
if (delayedEventTimerXID) {
XtRemoveTimeOut(delayedEventTimerXID);
XtIntervalId loadGameTimerXID = 0;
-int LoadGameTimerRunning()
+int
+LoadGameTimerRunning ()
{
return loadGameTimerXID != 0;
}
-int StopLoadGameTimer()
+int
+StopLoadGameTimer ()
{
if (loadGameTimerXID != 0) {
XtRemoveTimeOut(loadGameTimerXID);
}
void
-LoadGameTimerCallback(arg, id)
- XtPointer arg;
- XtIntervalId *id;
+LoadGameTimerCallback (XtPointer arg, XtIntervalId *id)
{
loadGameTimerXID = 0;
AutoPlayGameLoop();
}
void
-StartLoadGameTimer(millisec)
- long millisec;
+StartLoadGameTimer (long millisec)
{
loadGameTimerXID =
XtAppAddTimeOut(appContext, millisec,
XtIntervalId analysisClockXID = 0;
void
-AnalysisClockCallback(arg, id)
- XtPointer arg;
- XtIntervalId *id;
+AnalysisClockCallback (XtPointer arg, XtIntervalId *id)
{
if (gameMode == AnalyzeMode || gameMode == AnalyzeFile
|| appData.icsEngineAnalyze) { // [DM]
}
void
-StartAnalysisClock()
+StartAnalysisClock ()
{
analysisClockXID =
XtAppAddTimeOut(appContext, 2000,
XtIntervalId clockTimerXID = 0;
-int ClockTimerRunning()
+int
+ClockTimerRunning ()
{
return clockTimerXID != 0;
}
-int StopClockTimer()
+int
+StopClockTimer ()
{
if (clockTimerXID != 0) {
XtRemoveTimeOut(clockTimerXID);
}
void
-ClockTimerCallback(arg, id)
- XtPointer arg;
- XtIntervalId *id;
+ClockTimerCallback (XtPointer arg, XtIntervalId *id)
{
clockTimerXID = 0;
DecrementClocks();
}
void
-StartClockTimer(millisec)
- long millisec;
+StartClockTimer (long millisec)
{
clockTimerXID =
XtAppAddTimeOut(appContext, millisec,
}
void
-DisplayTimerLabel(w, color, timer, highlight)
- Widget w;
- char *color;
- long timer;
- int highlight;
+DisplayTimerLabel (Widget w, char *color, long timer, int highlight)
{
char buf[MSG_SIZ];
Arg args[16];
}
void
-DisplayWhiteClock(timeRemaining, highlight)
- long timeRemaining;
- int highlight;
+DisplayWhiteClock (long timeRemaining, int highlight)
{
Arg args[16];
}
void
-DisplayBlackClock(timeRemaining, highlight)
- long timeRemaining;
- int highlight;
+DisplayBlackClock (long timeRemaining, int highlight)
{
Arg args[16];
} ChildProc;
-int StartChildProcess(cmdLine, dir, pr)
- char *cmdLine;
- char *dir;
- ProcRef *pr;
+int
+StartChildProcess (char *cmdLine, char *dir, ProcRef *pr)
{
char *argv[64], *p;
int i, pid;
}
// [HGM] kill: implement the 'hard killing' of AS's Winboard_x
-static RETSIGTYPE AlarmCallBack(int n)
+static RETSIGTYPE
+AlarmCallBack (int n)
{
return;
}
void
-DestroyChildProcess(pr, signalType)
- ProcRef pr;
- int signalType;
+DestroyChildProcess (ProcRef pr, int signalType)
{
ChildProc *cp = (ChildProc *) pr;
}
void
-InterruptChildProcess(pr)
- ProcRef pr;
+InterruptChildProcess (ProcRef pr)
{
ChildProc *cp = (ChildProc *) pr;
(void) kill(cp->pid, SIGINT); /* stop it thinking */
}
-int OpenTelnet(host, port, pr)
- char *host;
- char *port;
- ProcRef *pr;
+int
+OpenTelnet (char *host, char *port, ProcRef *pr)
{
char cmdLine[MSG_SIZ];
return StartChildProcess(cmdLine, "", pr);
}
-int OpenTCP(host, port, pr)
- char *host;
- char *port;
- ProcRef *pr;
+int
+OpenTCP (char *host, char *port, ProcRef *pr)
{
#if OMIT_SOCKETS
DisplayFatalError(_("Socket support is not configured in"), 0, 2);
return 0;
}
-int OpenCommPort(name, pr)
- char *name;
- ProcRef *pr;
+int
+OpenCommPort (char *name, ProcRef *pr)
{
int fd;
ChildProc *cp;
return 0;
}
-int OpenLoopback(pr)
- ProcRef *pr;
+int
+OpenLoopback (ProcRef *pr)
{
ChildProc *cp;
int to[2], from[2];
return 0;
}
-int OpenRcmd(host, user, cmd, pr)
- char *host, *user, *cmd;
- ProcRef *pr;
+int
+OpenRcmd (char *host, char *user, char *cmd, ProcRef *pr)
{
DisplayFatalError(_("internal rcmd not implemented for Unix"), 0, 1);
return -1;
} InputSource;
void
-DoInputCallback(closure, source, xid)
- caddr_t closure;
- int *source;
- XtInputId *xid;
+DoInputCallback (caddr_t closure, int *source, XtInputId *xid)
{
InputSource *is = (InputSource *) closure;
int count;
}
}
-InputSourceRef AddInputSource(pr, lineByLine, func, closure)
- ProcRef pr;
- int lineByLine;
- InputCallback func;
- VOIDSTAR closure;
+InputSourceRef
+AddInputSource (ProcRef pr, int lineByLine, InputCallback func, VOIDSTAR closure)
{
InputSource *is;
ChildProc *cp = (ChildProc *) pr;
}
void
-RemoveInputSource(isr)
- InputSourceRef isr;
+RemoveInputSource (InputSourceRef isr)
{
InputSource *is = (InputSource *) isr;
is->xid = 0;
}
-int OutputToProcess(pr, message, count, outError)
- ProcRef pr;
- char *message;
- int count;
- int *outError;
+int
+OutputToProcess (ProcRef pr, char *message, int count, int *outError)
{
static int line = 0;
ChildProc *cp = (ChildProc *) pr;
between each character. This is needed when sending the logon
script to ICC, which for some reason doesn't like the
instantaneous send. */
-int OutputToProcessDelayed(pr, message, count, outError, msdelay)
- ProcRef pr;
- char *message;
- int count;
- int *outError;
- long msdelay;
+int
+OutputToProcessDelayed (ProcRef pr, char *message, int count, int *outError, long msdelay)
{
ChildProc *cp = (ChildProc *) pr;
int outCount = 0;
static int xpmDone = 0;
static void
-CreateAnimMasks (pieceDepth)
- int pieceDepth;
+CreateAnimMasks (int pieceDepth)
{
ChessSquare piece;
Pixmap buf;
}
static void
-InitAnimState (anim, info)
- AnimState * anim;
- XWindowAttributes * info;
+InitAnimState (AnimState *anim, XWindowAttributes *info)
{
XtGCMask mask;
XGCValues values;
static Boolean frameWaiting;
-static RETSIGTYPE FrameAlarm (sig)
- int sig;
+static RETSIGTYPE
+FrameAlarm (int sig)
{
frameWaiting = False;
/* In case System-V style signals. Needed?? */
}
static void
-FrameDelay (time)
- int time;
+FrameDelay (int time)
{
struct itimerval delay;
#else
static void
-FrameDelay (time)
- int time;
+FrameDelay (int time)
{
XSync(xDisplay, False);
if (time > 0)
#endif
void
-DoSleep(int n)
+DoSleep (int n)
{
FrameDelay(n);
}
/* Convert board position to corner of screen rect and color */
static void
-ScreenSquare(column, row, pt, color)
- int column; int row; XPoint * pt; int * color;
+ScreenSquare (int column, int row, XPoint *pt, int *color)
{
if (flipView) {
pt->x = lineGap + ((BOARD_WIDTH-1)-column) * (squareSize + lineGap);
/* Convert window coords to square */
static void
-BoardSquare(x, y, column, row)
- int x; int y; int * column; int * row;
+BoardSquare (int x, int y, int *column, int *row)
{
*column = EventToSquare(x, BOARD_WIDTH);
if (flipView && *column >= 0)
#define Min(a, b) ((a) < (b) ? (a) : (b))
static void
-SetRect(rect, x, y, width, height)
- XRectangle * rect; int x; int y; int width; int height;
+SetRect (XRectangle *rect, int x, int y, int width, int height)
{
rect->x = x;
rect->y = y;
that rect within new. */
static Boolean
-Intersect(old, new, size, area, pt)
- XPoint * old; XPoint * new;
- int size; XRectangle * area; XPoint * pt;
+Intersect ( XPoint *old, XPoint *new, int size, XRectangle *area, XPoint *pt)
{
if (old->x > new->x + size || new->x > old->x + size ||
old->y > new->y + size || new->y > old->y + size) {
in the old that do not intersect with the new. */
static void
-CalcUpdateRects(old, new, size, update, nUpdates)
- XPoint * old; XPoint * new; int size;
- XRectangle update[]; int * nUpdates;
+CalcUpdateRects (XPoint *old, XPoint *new, int size, XRectangle update[], int *nUpdates)
{
int count;
noticeable. */
static void
-Tween(start, mid, finish, factor, frames, nFrames)
- XPoint * start; XPoint * mid;
- XPoint * finish; int factor;
- XPoint frames[]; int * nFrames;
+Tween (XPoint *start, XPoint *mid, XPoint *finish, int factor, XPoint frames[], int *nFrames)
{
int fraction, n, count;
/* Draw a piece on the screen without disturbing what's there */
static void
-SelectGCMask(piece, clip, outline, mask)
- ChessSquare piece; GC * clip; GC * outline; Pixmap * mask;
+SelectGCMask (ChessSquare piece, GC *clip, GC *outline, Pixmap *mask)
{
GC source;
}
static void
-OverlayPiece(piece, clip, outline, dest)
- ChessSquare piece; GC clip; GC outline; Drawable dest;
+OverlayPiece (ChessSquare piece, GC clip, GC outline, Drawable dest)
{
int kind;
/* Animate the movement of a single piece */
static void
-BeginAnimation(anim, piece, startColor, start)
- AnimState *anim;
- ChessSquare piece;
- int startColor;
- XPoint * start;
+BeginAnimation (AnimState *anim, ChessSquare piece, int startColor, XPoint *start)
{
Pixmap mask;
}
static void
-AnimationFrame(anim, frame, piece)
- AnimState *anim;
- XPoint *frame;
- ChessSquare piece;
+AnimationFrame (AnimState *anim, XPoint *frame, ChessSquare piece)
{
XRectangle updates[4];
XRectangle overlap;
}
static void
-EndAnimation (anim, finish)
- AnimState *anim;
- XPoint *finish;
+EndAnimation (AnimState *anim, XPoint *finish)
{
XRectangle updates[4];
XRectangle overlap;
}
static void
-FrameSequence(anim, piece, startColor, start, finish, frames, nFrames)
- AnimState *anim;
- ChessSquare piece; int startColor;
- XPoint * start; XPoint * finish;
- XPoint frames[]; int nFrames;
+FrameSequence (AnimState *anim, ChessSquare piece, int startColor, XPoint *start, XPoint *finish, XPoint frames[], int nFrames)
{
int n;
}
void
-AnimateAtomicCapture(Board board, int fromX, int fromY, int toX, int toY)
+AnimateAtomicCapture (Board board, int fromX, int fromY, int toX, int toY)
{
int i, x, y;
ChessSquare piece = board[fromY][toY];
/* Main control logic for deciding what to animate and how */
void
-AnimateMove(board, fromX, fromY, toX, toY)
- Board board;
- int fromX;
- int fromY;
- int toX;
- int toY;
+AnimateMove (Board board, int fromX, int fromY, int toX, int toY)
{
ChessSquare piece;
int hop;
}
void
-DragPieceBegin(x, y, instantly)
- int x; int y; Boolean instantly;
+DragPieceBegin (int x, int y, Boolean instantly)
{
int boardX, boardY, color;
XPoint corner;
}
void
-ChangeDragPiece(ChessSquare piece)
+ChangeDragPiece (ChessSquare piece)
{
Pixmap mask;
player.dragPiece = piece;
}
static void
-DragPieceMove(x, y)
- int x; int y;
+DragPieceMove (int x, int y)
{
XPoint corner;
}
void
-DragPieceEnd(x, y)
- int x; int y;
+DragPieceEnd (int x, int y)
{
int boardX, boardY, color;
XPoint corner;
}
#include <sys/ioctl.h>
-int get_term_width()
+int
+get_term_width ()
{
int fd, default_width;
}
void
-update_ics_width()
+update_ics_width ()
{
static int old_width = 0;
int new_width = get_term_width();
old_width = new_width;
}
-void NotifyFrontendLogin()
+void
+NotifyFrontendLogin ()
{
update_ics_width();
}
#define A_HEIGHT_FACTOR 6 /* Length of arrow "point", relative to body width */
#define A_WIDTH_FACTOR 3 /* Width of arrow "point", relative to body width */
-static double Sqr( double x )
+static double
+Sqr (double x)
{
return x*x;
}
-static int Round( double x )
+static int
+Round (double x)
{
return (int) (x + 0.5);
}
-void SquareToPos(int rank, int file, int *x, int *y)
+void
+SquareToPos (int rank, int file, int *x, int *y)
{
if (flipView) {
*x = lineGap + ((BOARD_WIDTH-1)-file) * (squareSize + lineGap);
}
/* Draw an arrow between two points using current settings */
-void DrawArrowBetweenPoints( int s_x, int s_y, int d_x, int d_y )
+void
+DrawArrowBetweenPoints (int s_x, int s_y, int d_x, int d_y)
{
XPoint arrow[8];
double dx, dy, j, k, x, y;
}
/* [AS] Draw an arrow between two squares */
-void DrawArrowBetweenSquares( int s_col, int s_row, int d_col, int d_row )
+void
+DrawArrowBetweenSquares (int s_col, int s_row, int d_col, int d_row)
{
int s_x, s_y, d_x, d_y, hor, vert, i;
}
}
-Boolean IsDrawArrowEnabled()
+Boolean
+IsDrawArrowEnabled ()
{
return appData.highlightMoveWithArrow && squareSize >= 32;
}
-void DrawArrowHighlight(int fromX, int fromY, int toX,int toY)
+void
+DrawArrowHighlight (int fromX, int fromY, int toX,int toY)
{
if( IsDrawArrowEnabled() && fromX >= 0 && fromY >= 0 && toX >= 0 && toY >= 0)
DrawArrowBetweenSquares(fromX, fromY, toX, toY);
}
-void UpdateLogos(int displ)
+void
+UpdateLogos (int displ)
{
return; // no logos in XBoard yet
}
Position tagsX = -1, tagsY = -1;
-void TagsPopUp(tags, msg)
- char *tags, *msg;
+void
+TagsPopUp (char *tags, char *msg)
{
NewTagsPopup(tags, cmailMsgLoaded ? msg : NULL);
}
-void EditTagsPopUp(tags, dest)
- char *tags;
- char **dest;
+void
+EditTagsPopUp (char *tags, char **dest)
{
NewTagsPopup(tags, NULL);
}
-void TagsPopDown()
+void
+TagsPopDown()
{
PopDown(2);
bookUp = False;
}
void
-EditTagsProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
+EditTagsProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
{
Arg args[5];
int j;
//static void UpdateControls( EngineOutputData * ed );
-void ReadIcon(char *pixData[], int iconNr)
+void
+ReadIcon (char *pixData[], int iconNr)
{
int r;
}
}
-static void InitializeEngineOutput()
+static void
+InitializeEngineOutput ()
{
ReadIcon(WHITE_14, nColorWhite);
ReadIcon(BLACK_14, nColorBlack);
ReadIcon(ANALYZE_14, nAnalyzing);
}
-void DoSetWindowText(int which, int field, char *s_label)
+void
+DoSetWindowText (int which, int field, char *s_label)
{
Arg arg;
XtSetValues(outputField[which][field], &arg, 1);
}
-void SetEngineOutputTitle(char *title)
+void
+SetEngineOutputTitle (char *title)
{
Arg arg;
XtSetArg(arg, XtNtitle, (XtArgVal) title);
XtSetValues(engineOutputShell, &arg, 1);
}
-void InsertIntoMemo( int which, char * text, int where )
+void
+InsertIntoMemo (int which, char * text, int where)
{
XawTextBlock t;
Widget edit;
}
}
-void SetIcon( int which, int field, int nIcon )
+void
+SetIcon (int which, int field, int nIcon)
{
Arg arg;
}
}
-void DoClearMemo(int which)
+void
+DoClearMemo (int which)
{
Widget edit = XtNameToWidget(engineOutputShell, which ? "*form2.text" : "*form.text");
Arg arg;
}
static void
-MemoCB(Widget w, XtPointer client_data, Atom *selection,
- Atom *type, XtPointer value, unsigned long *len, int *format)
+MemoCB (Widget w, XtPointer client_data, Atom *selection,
+ Atom *type, XtPointer value, unsigned long *len, int *format)
{
if (value==NULL || *len==0) return; /* nothing had been selected to copy */
selected_fen_position = value;
NULL/* transfer_done_proc */);
}
-void CopyMemoProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
+void
+CopyMemoProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
{
if(appData.pasteSelection) return;
if (selected_fen_position) free(selected_fen_position);
// The following routines are mutated clones of the commentPopUp routines
-void PositionControlSet(which, shell, form, bw_width)
- int which;
- Widget shell, form;
- Dimension bw_width;
+void
+PositionControlSet (int which, Widget shell, Widget form, Dimension bw_width)
{
Arg args[16];
Widget edit, NameWidget, ColorWidget, ModeWidget, MoveWidget, NodesWidget;
XtSetValues(edit, args, j);
}
-Widget EngineOutputCreate(name, text)
- char *name, *text;
+Widget
+EngineOutputCreate (char *name, char *text)
{
Arg args[16];
Widget shell, layout, form, form2;
return shell;
}
-void ResizeWindowControls(mode)
- int mode;
+void
+ResizeWindowControls (int mode)
{
Widget form1, form2;
Arg args[16];
}
void
-EngineOutputPopUp()
+EngineOutputPopUp ()
{
Arg args[16];
int j;
ShowThinkingEvent(); // [HGM] thinking: might need to prompt engine for thinking output
}
-void EngineOutputPopDown()
+void
+EngineOutputPopDown ()
{
Arg args[16];
int j;
ShowThinkingEvent(); // [HGM] thinking: might need to shut off thinking output
}
-int EngineOutputIsUp()
+int
+EngineOutputIsUp ()
{
return engineOutputDialogUp;
}
-int EngineOutputDialogExists()
+int
+EngineOutputDialogExists ()
{
return engineOutputShell != NULL;
}
void
-EngineOutputProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
+EngineOutputProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
{
if (engineOutputDialogUp) {
EngineOutputPopDown();
#endif
// [HGM] front-end, added as wrapper to avoid use of LineTo and MoveToEx in other routines (so they can be back-end)
-void DrawSegment( int x, int y, int *lastX, int *lastY, int penType )
+void
+DrawSegment (int x, int y, int *lastX, int *lastY, int penType)
{
static int curX, curY;
}
// front-end wrapper for drawing functions to do rectangles
-void DrawRectangle( int left, int top, int right, int bottom, int side, int style )
+void
+DrawRectangle (int left, int top, int right, int bottom, int side, int style)
{
XFillRectangle(yDisplay, eGraphWindow, hbrHist[side], left, top, right-left, bottom-top);
if(style != FILLED)
}
// front-end wrapper for putting text in graph
-void DrawEvalText(char *buf, int cbBuf, int y)
+void
+DrawEvalText (char *buf, int cbBuf, int y)
{
// the magic constants 7 and 5 should really be derived from the font size somehow
XDrawString(yDisplay, eGraphWindow, coordGC, MarginX - 2 - 7*cbBuf, y+5, buf, cbBuf);
}
// front-end
-static Pixel MakeColor(char *color )
+static Pixel
+MakeColor (char *color)
{
XrmValue vFrom, vTo;
return *(Pixel *) vTo.addr;
}
-static GC CreateGC(int width, char *fg, char *bg, int style)
+static GC
+CreateGC (int width, char *fg, char *bg, int style)
{
XtGCMask value_mask = GCLineWidth | GCLineStyle | GCForeground
| GCBackground | GCFunction | GCPlaneMask;
// front-end. Create pens, device context and buffer bitmap for global use, copy result to display
// The back-end part n the middle has been taken out and moed to PainEvalGraph()
-static void DisplayEvalGraph()
+static void
+DisplayEvalGraph ()
{
int j;
int width;
XSync(yDisplay, False);
}
-static void InitializeEvalGraph()
+static void
+InitializeEvalGraph ()
{
pens[PEN_BLACK] = CreateGC(1, "black", "black", LineSolid);
pens[PEN_DOTTED] = CreateGC(1, "#A0A0A0", "#A0A0A0", LineOnOffDash);
hbrHist[2] = CreateGC(3, "#E0E0F0", "#E0E0F0", LineSolid);; // background (a bit blueish, for contrst with yellow curve)
}
-void EvalClick(widget, unused, event)
- Widget widget;
- caddr_t unused;
- XEvent *event;
+void
+EvalClick (Widget widget, caddr_t unused, XEvent *event)
{
if( widget && event->type == ButtonPress ) {
int index = GetMoveIndexFromPoint( event->xbutton.x, event->xbutton.y );
// This (cloned from EventProc in xboard.c) is needed as event handler, to prevent
// the graph being wiped out after covering / uncovering by other windows.
-void EvalEventProc(widget, unused, event)
- Widget widget;
- caddr_t unused;
- XEvent *event;
+void
+EvalEventProc (Widget widget, caddr_t unused, XEvent *event)
{
if (!XtIsRealized(widget))
return;
}
// The following routines are mutated clones of the commentPopUp routines
-Widget EvalGraphCreate(name)
- char *name;
+Widget
+EvalGraphCreate (char *name)
{
Arg args[16];
Widget shell, layout, form;
}
void
-EvalGraphPopUp()
+EvalGraphPopUp ()
{
Arg args[16];
int j;
// ShowThinkingEvent(); // [HGM] thinking: might need to prompt engine for thinking output
}
-void EvalGraphPopDown()
+void
+EvalGraphPopDown ()
{
Arg args[16];
int j;
// ShowThinkingEvent(); // [HGM] thinking: might need to shut off thinking output
}
-Boolean EvalGraphIsUp()
+Boolean
+EvalGraphIsUp ()
{
return evalGraphDialogUp;
}
-int EvalGraphDialogExists()
+int
+EvalGraphDialogExists ()
{
return evalGraphShell != NULL;
}
void
-EvalGraphProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
+EvalGraphProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
{
if (evalGraphDialogUp) {
EvalGraphPopDown();
// This function is the interface to the back-end. It is currently called through the front-end,
// though, where it shares the HistorySet() wrapper with MoveHistorySet(). Once all front-ends
// support the eval graph, it would be more logical to call it directly from the back-end.
-void EvalGraphSet( int first, int last, int current, ChessProgramStats_Move * pvInfo )
+void
+EvalGraphSet (int first, int last, int current, ChessProgramStats_Move * pvInfo)
{
/* [AS] Danger! For now we rely on the pvInfo parameter being a static variable! */
static GameListClosure *glc = NULL;
Widget
-GameListCreate(name, callback, client_data)
- char *name;
- XtCallbackProc callback;
- XtPointer client_data;
+GameListCreate (char *name, XtCallbackProc callback, XtPointer client_data)
{
Arg args[16];
Widget shell, form, viewport, listwidg, layout, label;
extern Board soughtBoard;
static int
-GameListPrepare(int byPos)
+GameListPrepare (int byPos)
{ // [HGM] filter: put in separate routine, to make callable from call-back
int nstrings;
ListGame *lg;
int listEnd;
static void
-GameListReplace(int page)
+GameListReplace (int page)
{
// filter: put in separate routine, to make callable from call-back
Widget listwidg;
}
void
-GameListCallback(w, client_data, call_data)
- Widget w;
- XtPointer client_data, call_data;
+GameListCallback (Widget w, XtPointer client_data, XtPointer call_data)
{
String name;
Arg args[16];
}
void
-GameListPopUp(fp, filename)
- FILE *fp;
- char *filename;
+GameListPopUp (FILE *fp, char *filename)
{
Arg args[16];
int j;
}
void
-GameListDestroy()
+GameListDestroy ()
{
if (glc == NULL) return;
GameListPopDown();
}
void
-ShowGameListProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
+ShowGameListProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
{
Arg args[16];
int j;
}
void
-LoadSelectedProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
+LoadSelectedProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
{
Widget listwidg;
XawListReturnStruct *rs;
}
void
-SetFilterProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
+SetFilterProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
{
Arg args[16];
String name;
}
void
-GameListPopDown()
+GameListPopDown ()
{
Arg args[16];
int j;
}
void
-GameListHighlight(index)
- int index;
+GameListHighlight (int index)
{
Widget listwidg;
int i=0; char **st;
}
Boolean
-GameListIsUp()
+GameListIsUp ()
{
return glc && glc->up;
}
-int SaveGameListAsText(FILE *f)
+int
+SaveGameListAsText (FILE *f)
{
ListGame * lg = (ListGame *) gameList.head;
int nItem;
char *strings[20];
int stringPtr;
-void GLT_ClearList()
+void
+GLT_ClearList ()
{
strings[0] = NULL;
stringPtr = 0;
}
-void GLT_AddToList(char *name)
+void
+GLT_AddToList (char *name)
{
strings[stringPtr++] = name;
strings[stringPtr] = NULL;
}
-Boolean GLT_GetFromList(int index, char *name)
+Boolean
+GLT_GetFromList (int index, char *name)
{
safeStrCpy(name, strings[index], MSG_SIZ);
return TRUE;
}
-void GLT_DeSelectList()
+void
+GLT_DeSelectList ()
{
XawListChange(listwidg, strings, 0, 0, True);
XawListHighlight(listwidg, 0);
}
void
-GameListOptionsPopDown()
+GameListOptionsPopDown ()
{
if (gameListOptShell == NULL) return;
}
void
-GameListOptionsCallback(w, client_data, call_data)
- Widget w;
- XtPointer client_data, call_data;
+GameListOptionsCallback (Widget w, XtPointer client_data, XtPointer call_data)
{
String name;
Arg args[16];
}
Widget
-GameListOptionsCreate()
+GameListOptionsCreate ()
{
Arg args[16];
Widget shell, form, viewport, layout;
}
void
-GameListOptionsPopUp(Widget w, XEvent *event, String *prms, Cardinal *nprms)
+GameListOptionsPopUp (Widget w, XEvent *event, String *prms, Cardinal *nprms)
{
if (gameListOptShell == NULL)
gameListOptShell = GameListOptionsCreate();
// ------------- low-level front-end actions called by MoveHistory back-end -----------------
-void HighlightMove( int from, int to, Boolean highlight )
+void
+HighlightMove (int from, int to, Boolean highlight)
{
if(highlight)
XawTextSetSelection( historyOptions[0].handle, from, to ); // for lack of a better method, use selection for highighting
}
-void ClearHistoryMemo()
+void
+ClearHistoryMemo ()
{
ClearTextWidget(&historyOptions[0]);
}
// the bold argument says 0 = normal, 1 = bold typeface
// the colorNr argument says 0 = font-default, 1 = gray
-int AppendToHistoryMemo( char * text, int bold, int colorNr )
+int
+AppendToHistoryMemo (char * text, int bold, int colorNr)
{
return AppendText(&historyOptions[0], text); // for now ignore bold & color stuff, as Xaw cannot handle that
}
-void ScrollToCurrent(int caretPos)
+void
+ScrollToCurrent (int caretPos)
{
Arg args[10];
char *s;
// ------------ standard entry points into MoveHistory code -----------
-Boolean MoveHistoryIsUp()
+Boolean
+MoveHistoryIsUp ()
{
return shellUp[7];
}
-Boolean MoveHistoryDialogExists()
+Boolean
+MoveHistoryDialogExists ()
{
return shells[7] != NULL;
}
-void HistoryPopUp()
+void
+HistoryPopUp ()
{
if(GenericPopUp(historyOptions, _("Move list"), 7))
XtOverrideTranslations(historyOptions[0].handle, XtParseTranslationTable(historyTranslations));
}
void
-HistoryShowProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
+HistoryShowProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
{
if (!shellUp[7]) {
ASSIGN(historyText, "");
static Widget previous = NULL;
-void SetFocus(Widget w, XtPointer data, XEvent *event, Boolean *b)
+void
+SetFocus (Widget w, XtPointer data, XEvent *event, Boolean *b)
{
Arg args[2];
char *s;
static Boolean browserUp;
ButtonCallback *comboCallback;
-void GetWidgetText(Option *opt, char **buf)
+void
+GetWidgetText (Option *opt, char **buf)
{
Arg arg;
XtSetArg(arg, XtNstring, buf);
XtGetValues(opt->handle, &arg, 1);
}
-void SetWidgetText(Option *opt, char *buf, int n)
+void
+SetWidgetText (Option *opt, char *buf, int n)
{
Arg arg;
XtSetArg(arg, XtNstring, buf);
SetFocus(opt->handle, shells[n], NULL, False);
}
-void SetWidgetState(Option *opt, int state)
+void
+SetWidgetState (Option *opt, int state)
{
Arg arg;
XtSetArg(arg, XtNstate, state);
XtSetValues(opt->handle, &arg, 1);
}
-void CheckCallback(Widget ww, XtPointer data, XEvent *event, Boolean *b)
+void
+CheckCallback (Widget ww, XtPointer data, XEvent *event, Boolean *b)
{
Widget w = currentOption[(int)(intptr_t)data].handle;
Boolean s;
SetWidgetState(¤tOption[(int)(intptr_t)data], !s);
}
-void SpinCallback(w, client_data, call_data)
- Widget w;
- XtPointer client_data, call_data;
+void
+SpinCallback (Widget w, XtPointer client_data, XtPointer call_data)
{
String name, val;
Arg args[16];
SetWidgetText(¤tOption[data], buf, 0);
}
-void ComboSelect(w, addr, index) // callback for all combo items
- Widget w;
- caddr_t addr;
- caddr_t index;
+void
+ComboSelect (Widget w, caddr_t addr, caddr_t index) // callback for all combo items
{
Arg args[16];
int i = ((intptr_t)addr)>>8;
if(currentOption[i].min & COMBO_CALLBACK && !currentCps && comboCallback) (comboCallback)(i);
}
-void CreateComboPopup(parent, option, n)
- Widget parent;
- Option *option;
- int n;
+void
+CreateComboPopup (Widget parent, Option *option, int n)
{
int i=0, j;
Widget menu, entry;
WindowPlacement *wp[10] = { NULL, &wpComment, &wpTags, NULL, NULL, NULL, NULL, &wpMoveHistory };
Option *dialogOptions[10];
-void MarkMenu(char *item, int dlgNr)
+void
+MarkMenu (char *item, int dlgNr)
{
Arg args[2];
XtSetArg(args[0], XtNleftBitmap, xMarkPixmap);
XtSetValues(marked[dlgNr] = XtNameToWidget(menuBarWidget, item), args, 1);
}
-int PopDown(int n)
+int
+PopDown (int n)
{
int j;
Arg args[10];
return 1;
}
-void GenericPopDown(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
+void
+GenericPopDown (Widget w, XEvent *event, String *prms, Cardinal *nprms)
{
if(browserUp) return; // prevent closing dialog when it has an open file-browse daughter
PopDown(prms[0][0] - '0');
char *engineNr[] = { N_("First Engine"), N_("Second Engine"), NULL };
char *engineList[100] = {" "}, *engineMnemonic[100] = {""};
-int AppendText(Option *opt, char *s)
+int
+AppendText (Option *opt, char *s)
{
XawTextBlock t;
char *v;
return len;
}
-void AddLine(Option *opt, char *s)
+void
+AddLine (Option *opt, char *s)
{
AppendText(opt, s);
AppendText(opt, "\n");
}
-void AddToTourney(int n)
+void
+AddToTourney (int n)
{
GenericReadout(4); // selected engine
AddLine(&matchOptions[3], engineChoice);
}
-int MatchOK(int n)
+int
+MatchOK (int n)
{
ASSIGN(appData.participants, engineName);
if(!CreateTourney(tfName) || matchMode) return matchMode || !appData.participants[0];
return 1;
}
-void ReplaceParticipant()
+void
+ReplaceParticipant ()
{
GenericReadout(3);
Substitute(strdup(engineName), True);
}
-void UpgradeParticipant()
+void
+UpgradeParticipant ()
{
GenericReadout(3);
Substitute(strdup(engineName), False);
{ 0, 1, 0, NULL, (void*) &MatchOK, "", NULL, EndMark , "" }
};
-int GeneralOptionsOK(int n)
+int
+GeneralOptionsOK (int n)
{
int newPonder = appData.ponderNextMove;
appData.ponderNextMove = oldPonder;
{ 0, 0, 0, NULL, (void*) &GeneralOptionsOK, "", NULL, EndMark , "" }
};
-void Pick(int n)
+void
+Pick (int n)
{
VariantClass v = currentOption[n].value;
if(!appData.noChessProgram) {
{ 0, 2, 0, NULL, NULL, "", NULL, EndMark , "" }
};
-int CommonOptionsOK(int n)
+int
+CommonOptionsOK (int n)
{
int newPonder = appData.ponderNextMove;
// make sure changes are sent to first engine by re-initializing it
{ 0, 1, 0, NULL, NULL, "", NULL, EndMark , "" }
};
-int IcsOptionsOK(int n)
+int
+IcsOptionsOK (int n)
{
ParseIcsTextColors();
return 1;
char *modeValues[] = { "1", "2", "3", "4", "5", "6" };
char *searchMode;
-int LoadOptionsOK()
+int
+LoadOptionsOK ()
{
appData.searchMode = atoi(searchMode);
return 1;
NULL
};
-void Test(int n)
+void
+Test (int n)
{
GenericReadout(2);
if(soundFiles[values[3]]) PlaySound(soundFiles[values[3]]);
{ 0, 1, 0, NULL, NULL, "", NULL, EndMark , "" }
};
-void SetColor(char *colorName, Option *box)
+void
+SetColor (char *colorName, Option *box)
{
Arg args[5];
Pixel buttonColor;
XtSetValues(box->handle, args, 1);
}
-void SetColorText(int n, char *buf)
+void
+SetColorText (int n, char *buf)
{
SetWidgetText(¤tOption[n-1], buf, 0);
SetColor(buf, ¤tOption[n]);
}
-void DefColor(int n)
+void
+DefColor (int n)
{
SetColorText(n, (char*) currentOption[n].choice);
}
-void RefreshColor(int source, int n)
+void
+RefreshColor (int source, int n)
{
int col, j, r, g, b, step = 10;
char *s, buf[MSG_SIZ]; // color string
SetColorText(source+1, buf);
}
-void ColorChanged(Widget w, XtPointer data, XEvent *event, Boolean *b)
+void
+ColorChanged (Widget w, XtPointer data, XEvent *event, Boolean *b)
{
char buf[10];
if ( (XLookupString(&(event->xkey), buf, 2, NULL, NULL) == 1) && *buf == '\r' )
RefreshColor((int)(intptr_t) data, 0);
}
-void AdjustColor(int i)
+void
+AdjustColor (int i)
{
int n = currentOption[i].value;
RefreshColor(i-n-1, n);
}
-int BoardOptionsOK(int n)
+int
+BoardOptionsOK (int n)
{
if(appData.overrideLineGap >= 0) lineGap = appData.overrideLineGap; else lineGap = defaultLineGap;
useImages = useImageSqs = 0;
{ 0, 0, 0, NULL, (void*) &BoardOptionsOK, "", NULL, EndMark , "" }
};
-int GenericReadout(int selected)
+int
+GenericReadout (int selected)
{
int i, j, res=1;
String val;
return res;
}
-void GenericCallback(w, client_data, call_data)
- Widget w;
- XtPointer client_data, call_data;
+void
+GenericCallback (Widget w, XtPointer client_data, XtPointer call_data)
{
String name;
Arg args[16];
static char *oneLiner = "<Key>Return: redraw-display()\n";
int
-GenericPopUp(Option *option, char *title, int dlgNr)
+GenericPopUp (Option *option, char *title, int dlgNr)
{
Arg args[16];
Widget popup, layout, dialog=NULL, edit=NULL, form, last, b_ok, b_cancel, leftMargin = NULL, textField = NULL;
}
-void IcsOptionsProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
+void
+IcsOptionsProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
{
GenericPopUp(icsOptions, _("ICS Options"), 0);
}
-void LoadOptionsProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
+void
+LoadOptionsProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
{
ASSIGN(searchMode, modeValues[appData.searchMode-1]);
GenericPopUp(loadOptions, _("Load Game Options"), 0);
}
-void SaveOptionsProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
+void
+SaveOptionsProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
{
GenericPopUp(saveOptions, _("Save Game Options"), 0);
}
-void SoundOptionsProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
+void
+SoundOptionsProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
{
free(soundFiles[2]);
soundFiles[2] = strdup("*");
GenericPopUp(soundOptions, _("Sound Options"), 0);
}
-void BoardOptionsProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
+void
+BoardOptionsProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
{
GenericPopUp(boardOptions, _("Board Options"), 0);
}
-void EngineMenuProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
+void
+EngineMenuProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
{
GenericPopUp(adjudicationOptions, _("Adjudicate non-ICS Games"), 0);
}
-void UciMenuProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
+void
+UciMenuProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
{
oldCores = appData.smpCores;
oldPonder = appData.ponderNextMove;
GenericPopUp(commonEngineOptions, _("Common Engine Settings"), 0);
}
-void NewVariantProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
+void
+NewVariantProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
{
GenericPopUp(variantDescriptors, _("New Variant"), 0);
}
-void OptionsProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
+void
+OptionsProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
{
oldPonder = appData.ponderNextMove;
GenericPopUp(generalOptions, _("General Options"), 0);
}
-void MatchOptionsProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
+void
+MatchOptionsProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
{
NamesToList(firstChessProgramNames, engineList, engineMnemonic);
comboCallback = &AddToTourney;
Option textOptions[100];
void PutText P((char *text, int pos));
-void SendString(char *p)
+void
+SendString (char *p)
{
char buf[MSG_SIZ], *q;
if(q = strstr(p, "$input")) {
/* function called when the data to Paste is ready */
static void
-SendTextCB(Widget w, XtPointer client_data, Atom *selection,
- Atom *type, XtPointer value, unsigned long *len, int *format)
+SendTextCB (Widget w, XtPointer client_data, Atom *selection,
+ Atom *type, XtPointer value, unsigned long *len, int *format)
{
char buf[MSG_SIZ], *p = (char*) textOptions[(int)(intptr_t) client_data].choice, *name = (char*) value, *q;
if (value==NULL || *len==0) return; /* nothing selected, abort */
XtFree(value);
}
-void SendText(int n)
+void
+SendText (int n)
{
char *p = (char*) textOptions[n].choice;
if(strstr(p, "$name")) {
} else SendString(p);
}
-void IcsTextProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
+void
+IcsTextProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
{
int i=0, j;
char *p, *q, *r;
void ClearComment P((int n));
extern char commentTranslations[];
-int NewComCallback(int n)
+int
+NewComCallback (int n)
{
ReplaceComment(commentIndex, commentText);
return 1;
}
-void SaveChanges(int n)
+void
+SaveChanges (int n)
{
GenericReadout(0);
ReplaceComment(commentIndex, commentText);
{ 0, 1, 0, NULL, (void*) &NewComCallback, "", NULL, EndMark , "" }
};
-void ClearTextWidget(Option *opt)
+void
+ClearTextWidget (Option *opt)
{
// XtCallActionProc(opt->handle, "select-all", NULL, NULL, 0);
// XtCallActionProc(opt->handle, "kill-selection", NULL, NULL, 0);
XtSetValues(opt->handle, &arg, 1);
}
-void ClearComment(int n)
+void
+ClearComment (int n)
{
ClearTextWidget(&commentOptions[0]);
}
-void NewCommentPopup(char *title, char *text, int index)
+void
+NewCommentPopup (char *title, char *text, int index)
{
Arg args[16];
static char *tagsText;
-int NewTagsCallback(int n)
+int
+NewTagsCallback (int n)
{
ReplaceTags(tagsText, &gameInfo);
return 1;
}
-void changeTags(int n)
+void
+changeTags (int n)
{
GenericReadout(1);
if(bookUp) SaveToBook(tagsText); else
{ 0, 1, 0, NULL, (void*) &NewTagsCallback, "", NULL, EndMark , "" }
};
-void NewTagsPopup(char *text, char *msg)
+void
+NewTagsPopup (char *text, char *msg)
{
Arg args[16];
char *title = bookUp ? _("Edit book") : _("Tags");
{ 0, 3, 0, NULL, NULL, "", NULL, EndMark , "" }
};
-void PutText(char *text, int pos)
+void
+PutText (char *text, int pos)
{
Arg args[16];
char buf[MSG_SIZ], *p;
XSetInputFocus(xDisplay, XtWindow(boxOptions[0].handle), RevertToPointerRoot, CurrentTime);
}
-void InputBoxPopup()
+void
+InputBoxPopup ()
{
MarkMenu("menuView.ICS Input Box", 4);
if(GenericPopUp(boxOptions, _("ICS input box"), 4))
XtOverrideTranslations(boxOptions[0].handle, XtParseTranslationTable(ICSInputTranslations));
}
-void TypeInProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
+void
+TypeInProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
{
char *val;
"<Key>Return: TypeInProc(1) \n"
"<Key>Escape: TypeInProc(0) \n";
-void PopUpMoveDialog(char firstchar)
+void
+PopUpMoveDialog (char firstchar)
{
static char buf[2];
buf[0] = firstchar; icsText = buf;
XtOverrideTranslations(boxOptions[0].handle, XtParseTranslationTable(moveTypeInTranslations));
}
-void MoveTypeInProc(Widget widget, caddr_t unused, XEvent *event)
+void
+MoveTypeInProc (Widget widget, caddr_t unused, XEvent *event)
{
char buf[10], keys[32];
KeySym sym;
}
void
-SettingsPopUp(ChessProgramState *cps)
+SettingsPopUp (ChessProgramState *cps)
{
currentCps = cps;
GenericPopUp(cps->option, _("Engine Settings"), 0);
}
-void FirstSettingsProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
+void
+FirstSettingsProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
{
SettingsPopUp(&first);
}
-void SecondSettingsProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
+void
+SecondSettingsProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
{
if(WaitForEngine(&second, SettingsMenuIfReady)) return;
SettingsPopUp(&second);
}
-int InstallOK(int n)
+int
+InstallOK (int n)
{
PopDown(0); // early popdown, to allow FreezeUI to instate grab
if(engineChoice[0] == engineNr[0][0]) Load(&first, 0); else Load(&second, 1);
{ 0, 1, 0, NULL, (void*) &InstallOK, "", NULL, EndMark , "" }
};
-void LoadEngineProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
+void
+LoadEngineProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
{
isUCI = storeVariant = v1 = useNick = False; addToList = hasBook = True; // defaults
if(engineChoice) free(engineChoice); engineChoice = strdup(engineNr[0]);
GenericPopUp(installOptions, _("Load engine"), 0);
}
-void EditBookProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
+void
+EditBookProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
{
EditBookEvent();
}
void SetRandom P((int n));
-int ShuffleOK(int n)
+int
+ShuffleOK (int n)
{
ResetGameEvent();
return 1;
{ 0, 1, 0, NULL, (void*) &ShuffleOK, "", NULL, EndMark , "" }
};
-void SetRandom(int n)
+void
+SetRandom (int n)
{
int r = n==2 ? -1 : random() & (1<<30)-1;
char buf[MSG_SIZ];
SetWidgetState(&shuffleOptions[0], True);
}
-void ShuffleMenuProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
+void
+ShuffleMenuProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
{
GenericPopUp(shuffleOptions, _("New Shuffle Game"), 0);
}
int tmpMoves, tmpTc, tmpInc, tmpOdds1, tmpOdds2, tcType;
-void ShowTC(int n)
+void
+ShowTC (int n)
{
}
void SetTcType P((int n));
-char *Value(int n)
+char *
+Value (int n)
{
static char buf[MSG_SIZ];
snprintf(buf, MSG_SIZ, "%d", n);
return buf;
}
-int TcOK(int n)
+int
+TcOK (int n)
{
char *tc;
if(tcType == 0 && tmpMoves <= 0) return 0;
{ 0, 0, 0, NULL, (void*) &TcOK, "", NULL, EndMark , "" }
};
-void SetTcType(int n)
+void
+SetTcType (int n)
{
switch(tcType = n) {
case 0:
}
}
-void TimeControlProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
+void
+TimeControlProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
{
tmpMoves = appData.movesPerSession;
tmpInc = appData.timeIncrement; if(tmpInc < 0) tmpInc = 0;
//---------------------------- Chat Windows ----------------------------------------------
-void OutputChatMessage(int partner, char *mess)
+void
+OutputChatMessage (int partner, char *mess)
{
return; // dummy
}
{ 14, '*', "light_square", "gray" },
{ 2, '.', "dark_square", "green" } };
-void fatal( str )
- char *str;
+void
+fatal (char *str)
{
printf("Fatal error: %s\n", str );
exit(1);
}
-z2xim *lookup_xim_color( color )
- int color;
+z2xim *
+lookup_xim_color (int color)
{
int i;
return NULL; /* Make compiler happy */
}
-z2xpm *lookup_xpm_color( color )
- int color;
+z2xpm *
+lookup_xpm_color (int color)
{
int i;
char *src_name;
-int up8( i )
- int i;
+int
+up8 (int i)
{
int r;
return i + 8 - r;
}
-unsigned int vga_imagesize( w, h )
- int w, h;
+unsigned int
+vga_imagesize (int w, int h)
{
int w8;
unsigned int s;
return s;
}
-unsigned char *decode_byte( dest, b, w )
- unsigned char *dest, *b;
- int w;
+unsigned char *
+decode_byte (unsigned char *dest, unsigned char *b, int w)
{
int i, j;
unsigned char byte, bit;
SRC is in packed pixel format.
DEST is filled with 1 BYTE per PIXEL.
*/
-unsigned char *decode_line( dest, src, w )
- unsigned char *dest, *src;
- int w;
+unsigned char *
+decode_line (unsigned char *dest, unsigned char *src, int w)
{
unsigned int w8;
unsigned int bpp;
return (src + bpp * 4);
}
-int write_xim_header( fp, w, h )
- FILE *fp;
- int w, h;
+int
+write_xim_header (FILE *fp, int w, int h)
{
fputc( w, fp );
fputc( h, fp );
return 0;
}
-int write_xpm_header( fp, w, h )
- FILE *fp;
- int w, h;
+int
+write_xpm_header (FILE *fp, int w, int h)
{
int i;
z2xpm *cv;
return 0;
}
-void create_piece_xim( outname, fpin, W, H )
- char *outname;
- FILE *fpin;
- int W, H;
+void
+create_piece_xim (char *outname, FILE *fpin, int W, int H)
{
FILE *fpout;
int w, h, i, j, c;
fclose( fpout );
}
-void create_piece_xpm( outname, fpin, W, H )
- char *outname;
- FILE *fpin;
- int W, H;
+void
+create_piece_xpm (char *outname, FILE *fpin, int W, int H)
{
FILE *fpout;
int w, h, i, j, c;
/* The suborder - Light/Light, Light/Dark, etc. */
char *prefixes[] = { "ll", "ld", "dl", "dd" };
-int process_file_xim( filename )
- char *filename;
+int
+process_file_xim (char *filename)
{
int w, h, piece, kind, c;
int nr_pieces = 6;
return 0;
}
-int process_file_xpm( filename )
- char *filename;
+int
+process_file_xpm (char *filename)
{
int w, h, piece, kind, c;
int nr_pieces = 6;
return 0;
}
-int main( argc, argv )
- int argc;
- char *argv[];
+int
+main (int argc, char **argv)
{
int i;
extern void mysrandom(unsigned int seed);
extern int myrandom(void);
-void ZippyInit()
+void
+ZippyInit ()
{
char *p;
#define MAX_SPEECH 250
-void Speak(how, whom)
- char *how, *whom;
+void
+Speak (char *how, char *whom)
{
static FILE *zipfile = NULL;
static struct stat zipstat;
Speak(how, whom); /* tail recursion */
}
-int ZippyCalled(str)
- char *str;
+int
+ZippyCalled (char *str)
{
return ics_handle[0] != NULLCHAR && StrCaseStr(str, ics_handle) != NULL;
}
extern ColorClass curColor;
-static void SetCurColor( ColorClass color )
+static void
+SetCurColor (ColorClass color)
{
curColor = color;
}
-static void ColorizeEx( ColorClass color, int cont )
+static void
+ColorizeEx (ColorClass color, int cont)
{
if( appData.colorize ) {
Colorize( color, cont );
}
}
-int ZippyControl(buf, i)
- char *buf;
- int *i;
+int
+ZippyControl (char *buf, int *i)
{
char *player, *p;
char reply[MSG_SIZ];
return FALSE;
}
-int ZippyConverse(buf, i)
- char *buf;
- int *i;
+int
+ZippyConverse(char *buf, int *i)
{
static char lastgreet[MSG_SIZ];
char reply[MSG_SIZ];
return FALSE;
}
-void ZippyGameStart(white, black)
- char *white, *black;
+void
+ZippyGameStart (char *white, char* black)
{
if (!first.initDone) {
/* Game is starting prematurely. We can't deal with this */
}
}
-void ZippyGameEnd(result, resultDetails)
- ChessMove result;
- char *resultDetails;
+void
+ZippyGameEnd (ChessMove result, char *resultDetails)
{
if (appData.zippyAcceptOnly[0] == NULLCHAR &&
appData.zippyGameEnd[0] != NULLCHAR) {
* Routines to implement Zippy playing chess
*/
-void ZippyHandleChallenge(srated, swild, sbase, sincrement, opponent)
- char *srated, *swild, *sbase, *sincrement, *opponent;
+void
+ZippyHandleChallenge (char *srated, char *swild, char *sbase, char *sincrement, char *opponent)
{
char buf[MSG_SIZ];
int base, increment, i=0;
/* Accept matches */
-int ZippyMatch(buf, i)
- char *buf;
- int *i;
+int
+ZippyMatch (char *buf, int *i)
{
if (looking_at(buf, i, "* * match * * requested with * (*)")) {
/* Initialize chess program with data from the first board
* of a new or resumed game.
*/
-void ZippyFirstBoard(moveNum, basetime, increment)
- int moveNum, basetime, increment;
+void
+ZippyFirstBoard (int moveNum, int basetime, int increment)
{
char buf[MSG_SIZ];
int w, b;
void
-ZippyHoldings(white_holding, black_holding, new_piece)
- char *white_holding, *black_holding, *new_piece;
+ZippyHoldings (char *white_holding, char *black_holding, char *new_piece)
{
char buf[MSG_SIZ];
if (gameMode != IcsPlayingBlack && gameMode != IcsPlayingWhite) return;