From 4e062d14429ed3a3a251c971690bade4c8cba946 Mon Sep 17 00:00:00 2001 From: Arun Persaud Date: Tue, 3 Jan 2012 21:30:59 -0800 Subject: [PATCH] code cleanup: make function definition confirm to GNU coding style change everything in the main directory to void funcname (int a, int b) format --- backend.c | 807 ++++++++++++------------------ book.c | 44 ++- childio.c | 24 +- engineoutput.c | 36 +- evalgraph.c | 46 ++- gamelist.c | 53 +- history.c | 27 +- lists.c | 39 +- moves.c | 162 ++---- parser.c | 50 ++- pgntags.c | 25 +- uci.c | 3 +- xboard.c | 1506 ++++++++++++++++++++----------------------------------- xedittags.c | 18 +- xengineoutput.c | 63 ++-- xevalgraph.c | 57 ++- xgamelist.c | 69 +-- xhistory.c | 27 +- xoptions.c | 310 ++++++------ zic2xpm.c | 65 +-- zippy.c | 52 +- 21 files changed, 1437 insertions(+), 2046 deletions(-) diff --git a/backend.c b/backend.c index 46a0df4..3e91099 100644 --- a/backend.c +++ b/backend.c @@ -312,7 +312,7 @@ int promoDefaultAltered; #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 ); @@ -340,7 +340,7 @@ safeStrCpy( char *dst, const char *src, size_t count ) * We used this for all compiler */ double -u64ToDouble(u64 value) +u64ToDouble (u64 value) { double r; u64 tmp = value & u64Const(0x7fffffffffffffff); @@ -358,7 +358,7 @@ u64ToDouble(u64 value) by this function. */ int -PosFlags(index) +PosFlags (index) { int flags = F_ALL_CASTLE_OK; if ((index % 2) == 0) flags |= F_WHITE_ON_MOVE; @@ -643,8 +643,7 @@ Board initialPosition; "++++", etc. Also strips ()'s */ int -string_to_rating(str) - char *str; +string_to_rating (char *str) { while(*str && !isdigit(*str)) ++str; if (!*str) @@ -654,7 +653,7 @@ string_to_rating(str) } void -ClearProgramStats() +ClearProgramStats () { /* Init programStats */ programStats.movelist[0] = 0; @@ -670,7 +669,7 @@ ClearProgramStats() } 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"; @@ -704,7 +703,7 @@ CommonEngineInit() } void -UnloadEngine(ChessProgramState *cps) +UnloadEngine (ChessProgramState *cps) { /* Kill off first chess program */ if (cps->isr != NULL) @@ -723,7 +722,7 @@ UnloadEngine(ChessProgramState *cps) } void -ClearOptions(ChessProgramState *cps) +ClearOptions (ChessProgramState *cps) { int i; cps->nrOptions = cps->comboCnt = 0; @@ -739,7 +738,7 @@ char *engineNames[] = { }; 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); @@ -832,7 +831,7 @@ InitEngine(ChessProgramState *cps, int n) ChessProgramState *savCps; void -LoadEngine() +LoadEngine () { int i; if(WaitForEngine(savCps, LoadEngine)) return; @@ -852,7 +851,7 @@ LoadEngine() } void -ReplaceEngine(ChessProgramState *cps, int n) +ReplaceEngine (ChessProgramState *cps, int n) { EditGameEvent(); UnloadEngine(cps); @@ -874,7 +873,7 @@ static char resetOptions[] = "-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 @@ -931,7 +930,7 @@ Load(ChessProgramState *cps, int i) } void -InitTimeControls() +InitTimeControls () { int matched, min, sec; /* @@ -962,7 +961,7 @@ InitTimeControls() } void -InitBackEnd1() +InitBackEnd1 () { ShowThinkingEvent(); // [HGM] thinking: make sure post/nopost state is set according to options @@ -1126,7 +1125,8 @@ InitBackEnd1() } -int NextIntegerFromString( char ** str, long * value ) +int +NextIntegerFromString (char ** str, long * value) { int result = -1; char * s = *str; @@ -1151,7 +1151,8 @@ int NextIntegerFromString( char ** str, long * value ) return result; } -int NextTimeControlFromString( char ** str, long * value ) +int +NextTimeControlFromString (char ** str, long * value) { long temp; int result = NextIntegerFromString( str, &temp ); @@ -1168,7 +1169,8 @@ int NextTimeControlFromString( char ** str, long * value ) 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; @@ -1209,7 +1211,8 @@ int NextSessionFromString( char ** str, int *moves, long * tc, long *inc, int *i 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; @@ -1232,10 +1235,7 @@ int GetTimeQuota(int movenr, int lastUsed, char *tcString) } int -ParseTimeControl(tc, ti, mps) - char *tc; - float ti; - int mps; +ParseTimeControl (char *tc, float ti, int mps) { long tc1; long tc2; @@ -1298,7 +1298,7 @@ ParseTimeControl(tc, ti, mps) } void -InitBackEnd2() +InitBackEnd2 () { if (appData.debugMode) { fprintf(debugFP, "%s\n", programVersion); @@ -1328,7 +1328,7 @@ InitBackEnd2() } 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 @@ -1339,7 +1339,7 @@ CalculateIndex(int index, int gameNr) } 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, @@ -1360,7 +1360,7 @@ LoadGameOrPosition(int gameNr) } void -ReserveGame(int gameNr, char resChar) +ReserveGame (int gameNr, char resChar) { FILE *tf = fopen(appData.tourneyFile, "r+"); char *p, *q, c, buf[MSG_SIZ]; @@ -1402,7 +1402,7 @@ ReserveGame(int gameNr, char resChar) } 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 @@ -1655,7 +1655,7 @@ InitBackEnd3 P((void)) } 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); @@ -1673,7 +1673,7 @@ HistorySet( char movelist[][2*MOVE_LEN], int first, int last, int current ) * Returns 0 if okay, error code if not. */ int -establish() +establish () { char buf[MSG_SIZ]; @@ -1714,7 +1714,8 @@ establish() } } -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++) { @@ -1728,10 +1729,7 @@ void EscapeExpand(char *p, char *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) { @@ -1746,11 +1744,7 @@ show_bytes(fp, buf, count) /* 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; @@ -1804,12 +1798,7 @@ OutputMaybeTelnet(pr, message, count, outError) } 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; @@ -1831,7 +1820,7 @@ read_from_player(isr, closure, message, count, error) } 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. @@ -1840,7 +1829,8 @@ KeepAlive() } /* 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; @@ -1853,8 +1843,7 @@ void ics_printf(char *format, ...) } void -SendToICS(s) - char *s; +SendToICS (char *s) { int count, outCount, outError; @@ -1871,9 +1860,7 @@ SendToICS(s) 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; @@ -1897,8 +1884,7 @@ SendToICSDelayed(s,msdelay) Also deletes any suffix starting with '(' */ char * -StripHighlightAndTitle(s) - char *s; +StripHighlightAndTitle (char *s) { static char retbuf[MSG_SIZ]; char *p = retbuf; @@ -1922,8 +1908,7 @@ StripHighlightAndTitle(s) /* Remove all highlighting escape sequences in s */ char * -StripHighlight(s) - char *s; +StripHighlight (char *s) { static char retbuf[MSG_SIZ]; char *p = retbuf; @@ -1943,8 +1928,7 @@ StripHighlight(s) char *variantNames[] = VARIANT_NAMES; char * -VariantName(v) - VariantClass v; +VariantName (VariantClass v) { return variantNames[v]; } @@ -1953,8 +1937,7 @@ VariantName(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; @@ -2165,10 +2148,7 @@ char star_match[STAR_MATCH_N][MSG_SIZ]; 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; @@ -2206,9 +2186,7 @@ looking_at(buf, index, pattern) } void -SendToPlayer(data, length) - char *data; - int length; +SendToPlayer (char *data, int length) { int error, outCount; outCount = OutputToProcess(NoProc, data, length, &error); @@ -2218,9 +2196,7 @@ SendToPlayer(data, length) } void -PackHolding(packed, holding) - char packed[]; - char *holding; +PackHolding (char packed[], char *holding) { char *p = holding; char *q = packed; @@ -2255,8 +2231,7 @@ PackHolding(packed, holding) /* 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; @@ -2304,21 +2279,21 @@ TelnetRequest(ddww, option) } 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; @@ -2360,7 +2335,7 @@ CopyHoldings(Board board, char *holdings, ChessSquare lowestPiece) void -VariantSwitch(Board board, VariantClass newVariant) +VariantSwitch (Board board, VariantClass newVariant) { int newHoldingsWidth, newWidth = 8, newHeight = 8, i, j; static Board oldBoard; @@ -2471,7 +2446,7 @@ int hMargin = 10, vMargin = 20, h, w; 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 @@ -2493,7 +2468,7 @@ PlotSeekAd(int i) } 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); @@ -2517,7 +2492,7 @@ AddAd(char *handle, char *rating, int base, int inc, char rated, char *type, in } 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); @@ -2531,7 +2506,7 @@ EraseSeekDot(int i) } void -RemoveSeekAd(int nr) +RemoveSeekAd (int nr) { int i; for(i=0; i 0) { @@ -4844,8 +4814,7 @@ GetMoveListEvent() } void -AnalysisPeriodicEvent(force) - int force; +AnalysisPeriodicEvent (int force) { if (((programStats.ok_to_send == 0 || programStats.line_is_book) && !force) || !appData.periodicUpdates) @@ -4861,16 +4830,14 @@ AnalysisPeriodicEvent(force) 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]; @@ -4948,10 +4915,7 @@ SendMoveToProgram(moveNum, cps) } 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]; @@ -5028,7 +4992,7 @@ SendMoveToICS(moveType, fromX, fromY, toX, toY, promoChar) } 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" }; @@ -5095,10 +5059,7 @@ UploadGameEvent() } 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 @@ -5116,8 +5077,7 @@ CoordsToComputerAlgebraic(rf, ff, rt, ft, promoChar, move) } void -ProcessICSInitScript(f) - FILE *f; +ProcessICSInitScript (FILE *f) { char buf[MSG_SIZ]; @@ -5132,7 +5092,7 @@ ProcessICSInitScript(f) 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; @@ -5153,7 +5113,8 @@ Sweep(int step) ChangeDragPiece(promoSweep); } -int PromoScroll(int x, int y) +int +PromoScroll (int x, int y) { int step = 0; @@ -5169,7 +5130,7 @@ int PromoScroll(int x, int y) } void -NextPiece(int step) +NextPiece (int step) { ChessSquare piece = boards[currentMove][toY][toX]; do { @@ -5184,7 +5145,7 @@ NextPiece(int step) } /* [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; @@ -5236,12 +5197,7 @@ char yy_textstr[8000]; /* 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); @@ -5324,7 +5280,7 @@ Boolean pushed = FALSE; 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; @@ -5390,7 +5346,7 @@ fprintf(debugFP,"parsePV: %d %c%c%c%c yy='%s'\nPV = '%s'\n", valid, fromX+AAA, f } 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; inrOptions; i++) @@ -5400,7 +5356,7 @@ MultiPV(ChessProgramState *cps) } 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]; @@ -5430,7 +5386,7 @@ LoadMultiPV(int x, int y, char *buf, int index, int *start, int *end) } char * -PvToSAN(char *pv) +PvToSAN (char *pv) { static char buf[10*MSG_SIZ]; int i, k=0, savedEnd=endPV, saveFMM = forwardMostMove; @@ -5449,7 +5405,7 @@ PvToSAN(char *pv) } 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; @@ -5458,7 +5414,7 @@ LoadPV(int x, int y) } void -UnLoadPV() +UnLoadPV () { int oldFMM = forwardMostMove; // N.B.: this was currentMove before PV was loaded! if(endPV < 0) return; @@ -5484,7 +5440,7 @@ UnLoadPV() } 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); @@ -5519,7 +5475,8 @@ int squaresLeft[4]; int piecesLeft[(int)BlackPawn]; int seed, nrOfShuffles; -void GetPositionNumber() +void +GetPositionNumber () { // sets global variable seed int i; @@ -5531,7 +5488,8 @@ void GetPositionNumber() } } -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; @@ -5549,7 +5507,8 @@ int put(Board board, int pieceType, int rank, int n, int shade) } -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; @@ -5560,7 +5519,8 @@ void AddOnePiece(Board board, int pieceType, int rank, int shade) 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; @@ -5575,7 +5535,8 @@ void AddTwoPieces(Board board, int pieceType, int rank) put(board, pieceType, rank, i, ANY); } -void SetUpShuffle(Board board, int number) +void +SetUpShuffle (Board board, int number) { int i, p, first=1; @@ -5663,7 +5624,8 @@ void SetUpShuffle(Board board, int number) 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 */ { @@ -5687,7 +5649,8 @@ int SetCharTable( char *table, const char * map ) 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 }; @@ -5724,8 +5687,7 @@ void Prelude(Board board) } void -InitPosition(redraw) - int redraw; +InitPosition (int redraw) { ChessSquare (* pieces)[BOARD_FILES]; int i, j, pawnRow, overrule, @@ -6019,9 +5981,7 @@ InitPosition(redraw) } void -SendBoard(cps, moveNum) - ChessProgramState *cps; - int moveNum; +SendBoard (ChessProgramState *cps, int moveNum) { char message[MSG_SIZ]; @@ -6097,7 +6057,7 @@ SendBoard(cps, moveNum) } ChessSquare -DefaultPromoChoice(int white) +DefaultPromoChoice (int white) { ChessSquare result; if(gameInfo.variant == VariantShatranj || gameInfo.variant == VariantCourier || gameInfo.variant == VariantMakruk) @@ -6114,7 +6074,7 @@ DefaultPromoChoice(int white) 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 */ @@ -6216,8 +6176,7 @@ HasPromotionChoice(int fromX, int fromY, int toX, int toY, char *promoChoice, in } 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 && @@ -6226,9 +6185,7 @@ InPalace(row, column) } 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; @@ -6237,8 +6194,7 @@ PieceForSquare (x, y) } int -OKToStartUserMove(x, y) - int x, y; +OKToStartUserMove (int x, int y) { ChessSquare from_piece; int white_piece; @@ -6338,7 +6294,8 @@ OKToStartUserMove(x, y) } 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) { @@ -6402,9 +6359,7 @@ char lastLoadGameTitle[MSG_SIZ], lastLoadPositionTitle[MSG_SIZ]; 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; @@ -6579,10 +6534,7 @@ UserMoveEvent(fromX, fromY, toX, toY, promoChar) /* 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; @@ -6767,12 +6719,7 @@ FinishMove(moveType, fromX, fromY, toX, toY, promoChar) } 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; @@ -6784,7 +6731,7 @@ Mark(board, flags, kind, rf, ff, rt, ft, closure) } void -MarkTargetSquares(int clear) +MarkTargetSquares (int clear) { int x, y; if(!appData.markers || !appData.highlightDragging || appData.icsActive && gameInfo.variant < VariantShogi || @@ -6804,7 +6751,7 @@ MarkTargetSquares(int clear) } 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? @@ -6819,7 +6766,8 @@ Explode(Board board, int fromX, int fromY, int toX, int toY) 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 @@ -6833,7 +6781,8 @@ int CanPromote(ChessSquare piece, int y) 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; @@ -7131,7 +7080,8 @@ void LeftClick(ClickType clickType, int xPix, int yPix) } } -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; @@ -7221,7 +7171,8 @@ int RightClick(ClickType action, int x, int y, int *fromX, int *fromY) return whichMenu; } -void SendProgramStatsToFrontend( ChessProgramState * cps, ChessProgramStats * cpstats ) +void +SendProgramStatsToFrontend (ChessProgramState * cps, ChessProgramStats * cpstats) { // char * hint = lastHint; FrontEndProgramStats stats; @@ -7248,7 +7199,7 @@ void SendProgramStatsToFrontend( ChessProgramState * cps, ChessProgramStats * cp } void -ClearEngineOutputPane(int which) +ClearEngineOutputPane (int which) { static FrontEndProgramStats dummyStats; dummyStats.which = which; @@ -7259,7 +7210,7 @@ ClearEngineOutputPane(int 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]; @@ -7303,7 +7254,7 @@ TourneyStandings(int display) } 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; @@ -7321,7 +7272,7 @@ Count(Board board, int pCnt[], int *nW, int *nB, int *wStale, int *bStale, int * } 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]; @@ -7350,7 +7301,7 @@ SufficientDefence(int pCnt[], int side, int nMine, int nHis) } 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; @@ -7400,7 +7351,7 @@ MatingPotential(int pCnt[], int side, int nMine, int nHis, int stale, int bisCol } int -CompareWithRights(Board b1, Board b2) +CompareWithRights (Board b1, Board b2) { int rights = 0; if(!CompareBoards(b1, b2)) return FALSE; @@ -7422,7 +7373,7 @@ CompareWithRights(Board b1, Board b2) } 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). @@ -7731,7 +7682,8 @@ Adjudicate(ChessProgramState *cps) 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; @@ -7781,7 +7733,8 @@ char *SendMoveToBookUser(int moveNr, ChessProgramState *cps, int initial) char *savedMessage; ChessProgramState *savedState; -void DeferredBookMove(void) +void +DeferredBookMove (void) { if(savedState->lastPing != savedState->lastPong) ScheduleDelayedEvent(DeferredBookMove, 10); @@ -7792,9 +7745,7 @@ void DeferredBookMove(void) 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]; @@ -8892,8 +8843,7 @@ if(appData.debugMode) fprintf(debugFP, "nodes = %d, %lld\n", (int) programStats. The display is not updated in any way. */ void -ParseGameHistory(game) - char *game; +ParseGameHistory (char *game) { ChessMove moveType; int fromX, fromY, toX, toY, boardIndex; @@ -9076,10 +9026,7 @@ ParseGameHistory(game) /* 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; @@ -9382,9 +9329,7 @@ ApplyMove(fromX, fromY, toX, toY, promoChar, board) /* 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 @@ -9489,7 +9434,7 @@ MakeMove(fromX, fromY, toX, toY, promoChar) /* 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; @@ -9515,7 +9460,8 @@ ShowMove(fromX, fromY, toX, toY) 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; @@ -9549,9 +9495,8 @@ void SendEgtPath(ChessProgramState *cps) } 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; @@ -9672,8 +9617,7 @@ InitChessProgram(cps, setup) void -StartChessProgram(cps) - ChessProgramState *cps; +StartChessProgram (ChessProgramState *cps) { char buf[MSG_SIZ]; int err; @@ -9740,7 +9684,7 @@ TwoMachinesEventIfReady P((void)) } char * -MakeName(char *template) +MakeName (char *template) { time_t clock; struct tm *tm; @@ -9769,7 +9713,7 @@ MakeName(char *template) } int -CountPlayers(char *p) +CountPlayers (char *p) { int n = 0; while(p = strchr(p, '\n')) p++, n++; // count participants @@ -9777,7 +9721,7 @@ CountPlayers(char *p) } 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 { @@ -9811,7 +9755,8 @@ WriteTourneyFile(char *results, FILE *f) #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]; @@ -9869,7 +9814,7 @@ void Substitute(char *participants, int expunge) } int -CreateTourney(char *name) +CreateTourney (char *name) { FILE *f; if(matchMode && strcmp(name, appData.tourneyFile)) { @@ -9901,7 +9846,8 @@ CreateTourney(char *name) 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; @@ -9929,7 +9875,8 @@ void NamesToList(char *names, char **engineList, char **engineMnemonic) // 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; @@ -9949,7 +9896,7 @@ void SwapEngines(int n) } 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; @@ -9966,7 +9913,7 @@ SetPlayer(int player) } 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; @@ -10012,7 +9959,7 @@ Pairing(int nr, int nPlayers, int *whitePlayer, int *blackPlayer, int *syncInter } 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; @@ -10078,7 +10025,7 @@ NextTourneyGame(int nr, int *swapColors) } 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 @@ -10095,7 +10042,8 @@ NextMatchGame() TwoMachinesEvent(); } -void UserAdjudicationEvent( int result ) +void +UserAdjudicationEvent (int result) { ChessMove gameResult = GameIsDrawn; @@ -10113,7 +10061,8 @@ void UserAdjudicationEvent( int result ) // [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; @@ -10121,7 +10070,8 @@ int StringCheckSum(char *s) return i; } -int GameCheckSum() +int +GameCheckSum () { int i, sum=0; for(i=backwardMostMove; i 2) { @@ -13021,7 +12936,7 @@ ExitEvent(status) } void -PauseEvent() +PauseEvent () { if (appData.debugMode) fprintf(debugFP, "PauseEvent(): pausing %d\n", pausing); @@ -13086,7 +13001,7 @@ PauseEvent() } void -EditCommentEvent() +EditCommentEvent () { char title[MSG_SIZ]; @@ -13103,7 +13018,7 @@ EditCommentEvent() void -EditTagsEvent() +EditTagsEvent () { char *tags = PGNTags(&gameInfo); bookUp = FALSE; @@ -13112,7 +13027,7 @@ EditTagsEvent() } void -AnalyzeModeEvent() +AnalyzeModeEvent () { if (appData.noChessProgram || gameMode == AnalyzeMode) return; @@ -13140,7 +13055,7 @@ AnalyzeModeEvent() } void -AnalyzeFileEvent() +AnalyzeFileEvent () { if (appData.noChessProgram || gameMode == AnalyzeFile) return; @@ -13167,7 +13082,7 @@ AnalyzeFileEvent() } void -MachineWhiteEvent() +MachineWhiteEvent () { char buf[MSG_SIZ]; char *bookHit = NULL; @@ -13248,7 +13163,7 @@ MachineWhiteEvent() } void -MachineBlackEvent() +MachineBlackEvent () { char buf[MSG_SIZ]; char *bookHit = NULL; @@ -13324,7 +13239,7 @@ MachineBlackEvent() void -DisplayTwoMachinesTitle() +DisplayTwoMachinesTitle () { char buf[MSG_SIZ]; if (appData.matchGames > 0) { @@ -13352,7 +13267,7 @@ DisplayTwoMachinesTitle() } void -SettingsMenuIfReady() +SettingsMenuIfReady () { if (second.lastPing != second.lastPong) { DisplayMessage("", _("Waiting for second chess program")); @@ -13365,7 +13280,7 @@ SettingsMenuIfReady() } int -WaitForEngine(ChessProgramState *cps, DelayedEventCallback retry) +WaitForEngine (ChessProgramState *cps, DelayedEventCallback retry) { char buf[MSG_SIZ]; if (cps->pr == NoProc) { @@ -13522,7 +13437,7 @@ TwoMachinesEvent P((void)) } void -TrainingEvent() +TrainingEvent () { if (gameMode == Training) { SetTrainingModeOff(); @@ -13545,7 +13460,7 @@ TrainingEvent() } void -IcsClientEvent() +IcsClientEvent () { if (!appData.icsActive) return; switch (gameMode) { @@ -13579,9 +13494,8 @@ IcsClientEvent() return; } - void -EditGameEvent() +EditGameEvent () { int i; @@ -13671,7 +13585,7 @@ EditGameEvent() void -EditPositionEvent() +EditPositionEvent () { if (gameMode == EditPosition) { EditGameEvent(); @@ -13695,7 +13609,7 @@ EditPositionEvent() } void -ExitAnalyzeMode() +ExitAnalyzeMode () { /* [DM] icsEngineAnalyze - possible call from other functions */ if (appData.icsEngineAnalyze) { @@ -13711,7 +13625,7 @@ ExitAnalyzeMode() } void -EditPositionDone(Boolean fakeRights) +EditPositionDone (Boolean fakeRights) { int king = gameInfo.variant == VariantKnightmate ? WhiteUnicorn : WhiteKing; @@ -13754,8 +13668,7 @@ EditPositionDone(Boolean fakeRights) /* Pause for `ms' milliseconds */ /* !! Ugh, this is a kludge. Fix it sometime. --tpm */ void -TimeDelay(ms) - long ms; +TimeDelay (long ms) { TimeMark m1, m2; @@ -13767,8 +13680,7 @@ TimeDelay(ms) /* !! 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; @@ -13793,7 +13705,7 @@ SendMultiLineToICS(buf) } void -SetWhiteToPlayEvent() +SetWhiteToPlayEvent () { if (gameMode == EditPosition) { blackPlaysFirst = FALSE; @@ -13805,7 +13717,7 @@ SetWhiteToPlayEvent() } void -SetBlackToPlayEvent() +SetBlackToPlayEvent () { if (gameMode == EditPosition) { blackPlaysFirst = TRUE; @@ -13819,9 +13731,7 @@ SetBlackToPlayEvent() } 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]; @@ -13949,9 +13859,7 @@ EditPositionMenuEvent(selection, x, y) void -DropMenuEvent(selection, x, y) - ChessSquare selection; - int x, y; +DropMenuEvent (ChessSquare selection, int x, int y) { ChessMove moveType; @@ -13992,7 +13900,7 @@ DropMenuEvent(selection, x, y) } void -AcceptEvent() +AcceptEvent () { /* Accept a pending offer of any kind from opponent */ @@ -14017,7 +13925,7 @@ AcceptEvent() } void -DeclineEvent() +DeclineEvent () { /* Decline a pending offer of any kind from opponent */ @@ -14042,7 +13950,7 @@ DeclineEvent() } void -RematchEvent() +RematchEvent () { /* Issue ICS rematch command */ if (appData.icsActive) { @@ -14052,7 +13960,7 @@ RematchEvent() } void -CallFlagEvent() +CallFlagEvent () { /* Call your opponent's flag (claim a win on time) */ if (appData.icsActive) { @@ -14089,7 +13997,7 @@ CallFlagEvent() } 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) { @@ -14119,7 +14027,7 @@ ClockClick(int which) } void -DrawEvent() +DrawEvent () { /* Offer draw or accept pending draw offer from opponent */ @@ -14161,7 +14069,7 @@ DrawEvent() } void -AdjournEvent() +AdjournEvent () { /* Offer Adjourn or accept pending Adjourn offer from opponent */ @@ -14175,7 +14083,7 @@ AdjournEvent() void -AbortEvent() +AbortEvent () { /* Offer Abort or accept pending Abort offer from opponent */ @@ -14188,7 +14096,7 @@ AbortEvent() } void -ResignEvent() +ResignEvent () { /* Resign. You can do this even if it's not your turn. */ @@ -14222,7 +14130,7 @@ ResignEvent() void -StopObservingEvent() +StopObservingEvent () { /* Stop observing current games */ SendToICS(ics_prefix); @@ -14230,7 +14138,7 @@ StopObservingEvent() } void -StopExaminingEvent() +StopExaminingEvent () { /* Stop observing current game */ SendToICS(ics_prefix); @@ -14238,8 +14146,7 @@ StopExaminingEvent() } void -ForwardInner(target) - int target; +ForwardInner (int target) { int limit; @@ -14306,7 +14213,7 @@ ForwardInner(target) void -ForwardEvent() +ForwardEvent () { if (gameMode == IcsExamining && !pausing) { SendToICS(ics_prefix); @@ -14317,7 +14224,7 @@ ForwardEvent() } void -ToEndEvent() +ToEndEvent () { if (gameMode == AnalyzeMode || gameMode == AnalyzeFile) { /* to optimze, we temporarily turn off analysis mode while we feed @@ -14347,8 +14254,7 @@ ToEndEvent() } void -BackwardInner(target) - int target; +BackwardInner (int target) { int full_redraw = TRUE; /* [AS] Was FALSE, had to change it! */ @@ -14418,7 +14324,7 @@ BackwardInner(target) } void -BackwardEvent() +BackwardEvent () { if (gameMode == IcsExamining && !pausing) { SendToICS(ics_prefix); @@ -14429,7 +14335,7 @@ BackwardEvent() } void -ToStartEvent() +ToStartEvent () { if (gameMode == AnalyzeMode || gameMode == AnalyzeFile) { /* to optimize, we temporarily turn off analysis mode while we undo @@ -14458,7 +14364,7 @@ ToStartEvent() } void -ToNrEvent(int to) +ToNrEvent (int to) { if (gameMode == PlayFromGameFile && !pausing) PauseEvent(); if (to >= forwardMostMove) to = forwardMostMove; @@ -14471,7 +14377,7 @@ ToNrEvent(int to) } void -RevertEvent(Boolean annotate) +RevertEvent (Boolean annotate) { if(PopTail(annotate)) { // [HGM] vari: restore old game tail return; @@ -14489,7 +14395,7 @@ RevertEvent(Boolean annotate) } void -RetractMoveEvent() +RetractMoveEvent () { switch (gameMode) { case MachinePlaysWhite: @@ -14528,7 +14434,7 @@ RetractMoveEvent() } void -MoveNowEvent() +MoveNowEvent () { ChessProgramState *cps; @@ -14563,7 +14469,7 @@ MoveNowEvent() } void -TruncateGameEvent() +TruncateGameEvent () { EditGameEvent(); if (gameMode != EditGame) return; @@ -14571,7 +14477,7 @@ TruncateGameEvent() } void -TruncateGame() +TruncateGame () { CleanupTail(); // [HGM] vari: only keep current variation if we explicitly truncate if (forwardMostMove > currentMove) { @@ -14587,7 +14493,7 @@ TruncateGame() } void -HintEvent() +HintEvent () { if (appData.noChessProgram) return; switch (gameMode) { @@ -14613,7 +14519,7 @@ HintEvent() } void -BookEvent() +BookEvent () { if (appData.noChessProgram) return; switch (gameMode) { @@ -14644,7 +14550,7 @@ BookEvent() } void -AboutGameEvent() +AboutGameEvent () { char *tags = PGNTags(&gameInfo); TagsPopUp(tags, CmailMsg()); @@ -14654,9 +14560,7 @@ AboutGameEvent() /* end button procedures */ void -PrintPosition(fp, move) - FILE *fp; - int move; +PrintPosition (FILE *fp, int move) { int i, j; @@ -14674,8 +14578,7 @@ PrintPosition(fp, move) } void -PrintOpponents(fp) - FILE *fp; +PrintOpponents (FILE *fp) { if (gameInfo.white != NULL) { fprintf(fp, "\t%s vs. %s\n", gameInfo.white, gameInfo.black); @@ -14686,8 +14589,7 @@ PrintOpponents(fp) /* 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); @@ -14716,7 +14618,7 @@ TidyProgramName(prog, host, buf) } char * -TimeControlTagValue() +TimeControlTagValue () { char buf[MSG_SIZ]; if (!appData.clockMode) { @@ -14732,7 +14634,7 @@ TimeControlTagValue() } void -SetGameInfo() +SetGameInfo () { /* This routine is used only for certain modes */ VariantClass v = gameInfo.variant; @@ -14830,9 +14732,7 @@ SetGameInfo() } void -ReplaceComment(index, text) - int index; - char *text; +ReplaceComment (int index, char *text) { int len; char *p; @@ -14873,8 +14773,7 @@ ReplaceComment(index, text) } void -CrushCRs(text) - char *text; +CrushCRs (char *text) { char *p = text; char *q = text; @@ -14888,10 +14787,8 @@ CrushCRs(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; @@ -14938,7 +14835,8 @@ if(appData.debugMode) fprintf(debugFP, "Append: in='%s' %d\n", text, addBraces); } } -static char * FindStr( char * text, char * sub_text ) +static char * +FindStr (char * text, char * sub_text) { char * result = strstr( text, sub_text ); @@ -14951,7 +14849,8 @@ static char * FindStr( char * text, char * 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; @@ -15046,9 +14945,7 @@ char *GetInfoFromComment( int index, char * text ) } void -SendToProgram(message, cps) - char *message; - ChessProgramState *cps; +SendToProgram (char *message, ChessProgramState *cps) { int count, outCount, error; char buf[MSG_SIZ]; @@ -15088,12 +14985,7 @@ SendToProgram(message, cps) } 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]; @@ -15183,10 +15075,7 @@ ReceiveFromProgram(isr, closure, message, count, error) 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; @@ -15250,7 +15139,8 @@ SendTimeControl(cps, mps, tc, inc, sd, st) } } -ChessProgramState *WhitePlayer() +ChessProgramState * +WhitePlayer () /* [HGM] return pointer to 'first' or 'second', depending on who plays white */ { if(gameMode == TwoMachinesPlay && first.twoMachinesColor[0] == 'b' || @@ -15260,9 +15150,7 @@ ChessProgramState *WhitePlayer() } void -SendTimeRemaining(cps, machineWhite) - ChessProgramState *cps; - int /*boolean*/ machineWhite; +SendTimeRemaining (ChessProgramState *cps, int machineWhite) { char message[MSG_SIZ]; long time, otime; @@ -15295,11 +15183,7 @@ SendTimeRemaining(cps, machineWhite) } 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); @@ -15319,11 +15203,7 @@ BoolFeature(p, name, loc, cps) } 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); @@ -15339,11 +15219,7 @@ IntFeature(p, name, loc, cps) } 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); @@ -15361,7 +15237,7 @@ StringFeature(p, name, loc, cps) } 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 { @@ -15452,9 +15328,7 @@ ParseOption(Option *opt, ChessProgramState *cps) } void -FeatureDone(cps, val) - ChessProgramState* cps; - int val; +FeatureDone (ChessProgramState *cps, int val) { DelayedEventCallback cb = GetDelayedEvent(); if ((cb == InitBackEnd3 && cps == &first) || @@ -15469,9 +15343,7 @@ FeatureDone(cps, val) /* Parse feature command from engine */ void -ParseFeatures(args, cps) - char* args; - ChessProgramState *cps; +ParseFeatures (char *args, ChessProgramState *cps) { char *p = args; char *q; @@ -15563,8 +15435,7 @@ ParseFeatures(args, cps) } void -PeriodicUpdatesEvent(newState) - int newState; +PeriodicUpdatesEvent (int newState) { if (newState == appData.periodicUpdates) return; @@ -15582,8 +15453,7 @@ PeriodicUpdatesEvent(newState) } void -PonderNextMoveEvent(newState) - int newState; +PonderNextMoveEvent (int newState) { if (newState == appData.ponderNextMove) return; if (gameMode == EditPosition) EditPositionDone(TRUE); @@ -15603,9 +15473,7 @@ PonderNextMoveEvent(newState) } 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]; @@ -15618,7 +15486,7 @@ NewSettingEvent(option, feature, command, value) } 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 @@ -15645,8 +15513,7 @@ ShowThinkingEvent() } 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; @@ -15654,7 +15521,7 @@ AskQuestionEvent(title, question, replyPrefix, which) } void -TypeInEvent(char firstChar) +TypeInEvent (char firstChar) { if ((gameMode == BeginningOfGame && !appData.icsActive) || gameMode == MachinePlaysWhite || gameMode == MachinePlaysBlack || @@ -15668,7 +15535,7 @@ TypeInEvent(char firstChar) } void -TypeInDoneEvent(char *move) +TypeInDoneEvent (char *move) { Board board; int n, fromX, fromY, toX, toY; @@ -15703,8 +15570,7 @@ TypeInDoneEvent(char *move) } void -DisplayMove(moveNumber) - int moveNumber; +DisplayMove (int moveNumber) { char message[MSG_SIZ]; char res[MSG_SIZ]; @@ -15761,9 +15627,7 @@ DisplayMove(moveNumber) } void -DisplayComment(moveNumber, text) - int moveNumber; - char *text; +DisplayComment (int moveNumber, char *text) { char title[MSG_SIZ]; @@ -15785,8 +15649,7 @@ DisplayComment(moveNumber, text) * 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; @@ -15813,7 +15676,7 @@ Attention(cps) } int -CheckFlags() +CheckFlags () { if (whiteTimeRemaining <= 0) { if (!whiteFlag) { @@ -15863,7 +15726,7 @@ CheckFlags() } void -CheckTimeControl() +CheckTimeControl () { if (!appData.clockMode || appData.icsActive || searchTime || // [HGM] st: no inc in st mode gameMode == PlayFromGameFile || forwardMostMove == 0) return; @@ -15888,7 +15751,7 @@ CheckTimeControl() } void -DisplayBothClocks() +DisplayBothClocks () { int wom = gameMode == EditPosition ? !blackPlaysFirst : WhiteOnMove(currentMove); @@ -15910,8 +15773,7 @@ DisplayBothClocks() /* Get the current time as a TimeMark */ void -GetTimeMark(tm) - TimeMark *tm; +GetTimeMark (TimeMark *tm) { #if HAVE_GETTIMEOFDAY @@ -15943,8 +15805,7 @@ GetTimeMark(tm) 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); @@ -15965,8 +15826,7 @@ static TimeMark tickStartTM; static long intendedTickLength; long -NextTickLength(timeRemaining) - long timeRemaining; +NextTickLength (long timeRemaining) { long nominalTickLength, nextTickLength; @@ -15982,7 +15842,7 @@ NextTickLength(timeRemaining) /* 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; @@ -15993,7 +15853,7 @@ AdjustClock(Boolean which, int dir) /* Stop clocks and reset to a fresh time control */ void -ResetClocks() +ResetClocks () { (void) StopClockTimer(); if (appData.icsActive) { @@ -16019,7 +15879,7 @@ ResetClocks() /* Decrement running clock by amount of time that has passed */ void -DecrementClocks() +DecrementClocks () { long timeRemaining; long lastTickLength, fudge; @@ -16099,7 +15959,7 @@ DecrementClocks() from the color that is *not* on move now. */ void -SwitchClocks(int newMoveNr) +SwitchClocks (int newMoveNr) { long lastTickLength; TimeMark now; @@ -16162,7 +16022,7 @@ SwitchClocks(int newMoveNr) /* Stop both clocks */ void -StopClocks() +StopClocks () { long lastTickLength; TimeMark now; @@ -16188,7 +16048,7 @@ StopClocks() /* 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(); @@ -16219,8 +16079,7 @@ StartClocks() } char * -TimeString(ms) - long ms; +TimeString (long ms) { long second, minute, hour, day; char *sign = ""; @@ -16267,8 +16126,7 @@ TimeString(ms) * 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; @@ -16282,8 +16140,7 @@ StrStr(string, match) } char * -StrCaseStr(string, match) - char *string, *match; +StrCaseStr (char *string, char *match) { int i, j, length; @@ -16302,8 +16159,7 @@ StrCaseStr(string, match) #ifndef _amigados int -StrCaseCmp(s1, s2) - char *s1, *s2; +StrCaseCmp (char *s1, char *s2) { char c1, c2; @@ -16318,24 +16174,21 @@ StrCaseCmp(s1, s2) 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; @@ -16347,8 +16200,7 @@ StrSave(s) } char * -StrSavePtr(s, savePtr) - char *s, **savePtr; +StrSavePtr (char *s, char **savePtr) { if (*savePtr) { free(*savePtr); @@ -16360,7 +16212,7 @@ StrSavePtr(s, savePtr) } char * -PGNDate() +PGNDate () { time_t clock; struct tm *tm; @@ -16375,9 +16227,7 @@ PGNDate() char * -PositionToFEN(move, overrideCastling) - int move; - char *overrideCastling; +PositionToFEN (int move, char *overrideCastling) { int i, j, fromX, fromY, toX, toY; int whiteToPlay; @@ -16545,10 +16395,7 @@ PositionToFEN(move, overrideCastling) } Boolean -ParseFEN(board, blackPlaysFirst, fen) - Board board; - int *blackPlaysFirst; - char *fen; +ParseFEN (Board board, int *blackPlaysFirst, char *fen) { int i, j; char *p, c; @@ -16788,7 +16635,7 @@ ParseFEN(board, blackPlaysFirst, fen) } void -EditPositionPasteFEN(char *fen) +EditPositionPasteFEN (char *fen) { if (fen != NULL) { Board initial_position; @@ -16811,7 +16658,8 @@ EditPositionPasteFEN(char *fen) static char cseq[12] = "\\ "; -Boolean set_cont_sequence(char *new_seq) +Boolean +set_cont_sequence (char *new_seq) { int len; Boolean ret; @@ -16836,7 +16684,8 @@ Boolean set_cont_sequence(char *new_seq) 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; @@ -16920,7 +16769,7 @@ int wrap(char *dest, char *src, int count, int width, int *lp) Boolean modeRestore = FALSE; void -PushInner(int firstMove, int lastMove) +PushInner (int firstMove, int lastMove) { int i, j, nrMoves = lastMove - firstMove; @@ -16951,7 +16800,7 @@ PushInner(int firstMove, int lastMove) } void -PushTail(int firstMove, int lastMove) +PushTail (int firstMove, int lastMove) { if(appData.icsActive) { // only in local mode forwardMostMove = currentMove; // mimic old ICS behavior @@ -16965,7 +16814,7 @@ PushTail(int firstMove, int lastMove) } void -PopInner(Boolean annotate) +PopInner (Boolean annotate) { int i, j, nrMoves; char buf[8000], moveBuf[20]; @@ -17012,7 +16861,7 @@ PopInner(Boolean annotate) } Boolean -PopTail(Boolean annotate) +PopTail (Boolean annotate) { if(appData.icsActive) return FALSE; // only in local mode if(!storedGames) return FALSE; // sanity @@ -17027,7 +16876,7 @@ PopTail(Boolean annotate) } void -CleanupTail() +CleanupTail () { // remove all shelved variations int i; for(i=0; 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); @@ -675,7 +688,8 @@ void entry_to_file(FILE *f, entry_t *entry) 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); diff --git a/childio.c b/childio.c index 53edee7..0cb4dc1 100644 --- a/childio.c +++ b/childio.c @@ -72,8 +72,8 @@ #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); @@ -99,8 +99,8 @@ void SetUpChildIO(to_prog, from_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]; @@ -127,8 +127,8 @@ int SetUpChildIO(to_prog, from_prog) #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; @@ -147,8 +147,8 @@ int PseudoTTY(pty_name) #if HAVE__GETPTY /* This code is for IRIX */ -int PseudoTTY(pty_name) - char pty_name[]; +int +PseudoTTY (char pty_name[]) { int fd; char *ptyn; @@ -163,8 +163,8 @@ int PseudoTTY(pty_name) #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; @@ -186,8 +186,8 @@ int PseudoTTY(pty_name) #define LAST_PTY_LETTER 'z' #endif -int PseudoTTY(pty_name) - char pty_name[]; +int +PseudoTTY (char pty_name[]) { struct stat stb; register c, i; diff --git a/engineoutput.c b/engineoutput.c index 83c7141..a409f19 100644 --- a/engineoutput.c +++ b/engineoutput.c @@ -89,7 +89,8 @@ static int scores[MAX_VAR], textEnd[MAX_VAR], curDepth[2], nrVariations[2]; extern int initialRulePlies; -void MakeEngineOutputTitle() +void +MakeEngineOutputTitle () { static char buf[MSG_SIZ]; static char oldTitle[MSG_SIZ]; @@ -115,7 +116,8 @@ void MakeEngineOutputTitle() } // 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; @@ -147,7 +149,8 @@ void SetEngineState( int which, int state, char * state_data ) } // 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; @@ -234,7 +237,8 @@ void SetProgramStats( FrontEndProgramStats * stats ) // now directly called by b #define ENGINE_COLOR_UNKNOWN ' ' // pure back end -static char GetEngineColor( int which ) +static char +GetEngineColor (int which) { char result = ENGINE_COLOR_UNKNOWN; @@ -267,7 +271,8 @@ static char GetEngineColor( int which ) } // pure back end -static char GetActiveEngineColor() +static char +GetActiveEngineColor () { char result = ENGINE_COLOR_UNKNOWN; @@ -279,7 +284,8 @@ static char GetActiveEngineColor() } // pure back end -static int IsEnginePondering( int which ) +static int +IsEnginePondering (int which) { int result = FALSE; @@ -304,7 +310,8 @@ static int IsEnginePondering( int which ) } // back end -static void SetDisplayMode( int mode ) +static void +SetDisplayMode (int mode) { if( windowMode != mode ) { windowMode = mode; @@ -314,7 +321,8 @@ static void SetDisplayMode( int mode ) } // pure back end -static void VerifyDisplayMode() +static void +VerifyDisplayMode () { int mode; @@ -344,7 +352,8 @@ static void VerifyDisplayMode() } // 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; @@ -363,7 +372,8 @@ void SetEngineColorIcon( int which ) // [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; @@ -395,7 +405,8 @@ static int InsertionPoint( int len, EngineOutputData * ed ) // pure back end, now SetWindowText is called via wrapper DoSetWindowText -static void UpdateControls( EngineOutputData * ed ) +static void +UpdateControls (EngineOutputData *ed) { // int isPondering = FALSE; @@ -536,7 +547,8 @@ static void UpdateControls( EngineOutputData * ed ) } // [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; diff --git a/evalgraph.c b/evalgraph.c index 39c9abd..7a18151 100644 --- a/evalgraph.c +++ b/evalgraph.c @@ -62,14 +62,16 @@ int MarginW = 4; 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 ); @@ -78,7 +80,8 @@ static void DrawLineEx( int x1, int y1, int x2, int y2, int penType ) } // back-end -static int GetPvScore( int index ) +static int +GetPvScore (int index) { int score = currPvInfo[ index ].score; @@ -87,7 +90,8 @@ static int GetPvScore( int index ) return score; } -char* MakeEvalTitle( char * title) +char * +MakeEvalTitle (char *title) { int score, depth; static char buf[MSG_SIZ]; @@ -110,7 +114,8 @@ char* MakeEvalTitle( char * title) 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; @@ -122,7 +127,8 @@ static int GetValueY( int value ) // 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 ); @@ -141,7 +147,8 @@ static void DrawAxisSegmentHoriz( int value, Boolean drawValue ) // 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); @@ -158,7 +165,8 @@ static void DrawAxis() } // 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; @@ -187,7 +195,8 @@ static void DrawHistogram( int x, int y, int width, int value, int side ) } // back-end -static void DrawSeparator( int index, int x ) +static void +DrawSeparator (int index, int x) { if( index > 0 ) { if( index == currCurrent ) { @@ -201,7 +210,8 @@ static void DrawSeparator( int index, int x ) // 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; @@ -243,7 +253,8 @@ static void DrawHistogramAsDiagram( int cy, int paint_width, int hist_count ) } // 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; @@ -271,7 +282,8 @@ typedef struct { } VisualizationData; // back-end -static Boolean InitVisualization( VisualizationData * vd ) +static Boolean +InitVisualization (VisualizationData *vd) { Boolean result = FALSE; @@ -295,7 +307,8 @@ static Boolean InitVisualization( VisualizationData * vd ) } // back-end -static void DrawHistograms() +static void +DrawHistograms () { VisualizationData vd; @@ -310,7 +323,8 @@ static void DrawHistograms() } // back-end -int GetMoveIndexFromPoint( int x, int y ) +int +GetMoveIndexFromPoint (int x, int y) { int result = -1; int start_x = MarginX + MarginW; @@ -343,7 +357,8 @@ int GetMoveIndexFromPoint( int x, int y ) } // 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 @@ -352,4 +367,3 @@ void PaintEvalGraph( void ) DrawAxis(); DrawHistograms(); } - diff --git a/gamelist.c b/gamelist.c index 8763055..2fc5211 100644 --- a/gamelist.c +++ b/gamelist.c @@ -70,7 +70,7 @@ static int GameListNewGame P((ListGame **)); /* [AS] Wildcard pattern matching */ Boolean -HasPattern( const char * text, const char * pattern ) +HasPattern (const char * text, const char * pattern) { while( *pattern != '\0' ) { if( *pattern == '*' ) { @@ -102,7 +102,7 @@ HasPattern( const char * text, const char * pattern ) } Boolean -SearchPattern( const char * text, const char * pattern ) +SearchPattern (const char * text, const char * pattern) { Boolean result = TRUE; @@ -128,8 +128,8 @@ SearchPattern( const char * text, const char * pattern ) /* 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); @@ -150,10 +150,10 @@ static void GameListDeleteGame(listGame) /* 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); } @@ -163,8 +163,8 @@ static void GameListFree(gameList) /* Initialize a new GameInfo structure. */ -void GameListInitGameInfo(gameInfo) - GameInfo *gameInfo; +void +GameListInitGameInfo (GameInfo *gameInfo) { gameInfo->event = NULL; gameInfo->site = NULL; @@ -189,8 +189,8 @@ void GameListInitGameInfo(gameInfo) * * Note, that the ListGame is *not* added to any list */ -static ListGame *GameListCreate() - +static ListGame * +GameListCreate () { ListGame *listGame; @@ -203,8 +203,8 @@ static ListGame *GameListCreate() /* Creates a new game for the gamelist. */ -static int GameListNewGame(listGamePtr) - ListGame **listGamePtr; +static int +GameListNewGame (ListGame **listGamePtr) { if (!(*listGamePtr = (ListGame *) GameListCreate())) { GameListFree(&gameList); @@ -218,8 +218,8 @@ static int GameListNewGame(listGamePtr) /* 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; @@ -404,8 +404,8 @@ GetTimeMark(&t2);printf("GameListBuild %ld msec\n", SubtractTimeMarks(&t2,&t)); /* Clear an existing GameInfo structure. */ -void ClearGameInfo(gameInfo) - GameInfo *gameInfo; +void +ClearGameInfo (GameInfo *gameInfo) { if (gameInfo->event != NULL) { free(gameInfo->event); @@ -445,9 +445,7 @@ void ClearGameInfo(gameInfo) /* [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 : "?"; @@ -464,7 +462,8 @@ GameListLineOld(number, gameInfo) #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; @@ -541,7 +540,8 @@ char * GameListLine( int number, GameInfo * gameInfo ) 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 : "?"; @@ -589,7 +589,8 @@ static GLT_Item GLT_ItemInfo[] = { 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; @@ -609,7 +610,7 @@ char * GLT_FindItem( char id ) // back-end: build the list of tag names void -GLT_TagsToList( char * tags ) +GLT_TagsToList (char *tags) { char * pc = tags; @@ -636,7 +637,7 @@ GLT_TagsToList( char * 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]; @@ -659,7 +660,7 @@ GLT_ListItemToTag( int index ) // back-end: add items id-chars one-by-one to temp tags string void -GLT_ParseList() +GLT_ParseList () { char * pc = lpUserGLT; int idx = 0; diff --git a/history.c b/history.c index c556325..a1f82fd 100644 --- a/history.c +++ b/history.c @@ -72,7 +72,8 @@ static HistoryMove histMoves[ MAX_MOVES ]; /* 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; @@ -98,7 +99,8 @@ static Boolean OnlyCurrentPositionChanged() } // back-end, after replacing Windows data types -static Boolean OneMoveAppended() +static Boolean +OneMoveAppended () { Boolean result = FALSE; @@ -117,7 +119,8 @@ static Boolean OneMoveAppended() } // 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]; @@ -152,7 +155,8 @@ static void AppendMoveToMemo( int index ) } // back-end -void RefreshMemoContent() +void +RefreshMemoContent () { int i; @@ -164,7 +168,8 @@ void RefreshMemoContent() } // 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, @@ -173,7 +178,8 @@ static void DoHighlight(int index, int onoff) } // back-end, now that a wrapper is provided for the front-end code to do the actual scrolling -void MemoContentUpdated() +void +MemoContentUpdated () { int caretPos; @@ -202,7 +208,8 @@ void MemoContentUpdated() } // 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; @@ -216,7 +223,8 @@ void FindMoveByCharIndex( int char_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() ) { @@ -233,7 +241,8 @@ void UpdateMoveHistory() } // 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! */ diff --git a/lists.c b/lists.c index 08d06e8..bbafb3f 100644 --- a/lists.c +++ b/lists.c @@ -43,8 +43,8 @@ /* 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); } @@ -52,8 +52,8 @@ int ListEmpty(l) /* 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; @@ -63,8 +63,8 @@ void ListNew(l) /* 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; @@ -77,8 +77,8 @@ void ListRemove(n) /* Delete node n. */ -void ListNodeFree(n) - ListNode *n; +void +ListNodeFree (ListNode *n) { if (n) { ListRemove(n); @@ -89,8 +89,8 @@ void ListNodeFree(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; @@ -104,8 +104,8 @@ ListNode *ListNodeCreate(s) /* 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; @@ -116,9 +116,8 @@ void ListInsert(m, n) /* 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); } @@ -126,9 +125,8 @@ void ListAddHead(l, 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); } @@ -137,9 +135,8 @@ void ListAddTail(l, 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; diff --git a/moves.c b/moves.c index 12eed07..02ced64 100644 --- a/moves.c +++ b/moves.c @@ -72,21 +72,21 @@ int PosFlags(int index); 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 && @@ -109,15 +109,15 @@ char pieceToChar[] = { '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; @@ -126,8 +126,8 @@ int PieceToNumber(p) /* [HGM] holdings: count piece type, ignoring non-particip return i; } -ChessSquare CharToPiece(c) - int c; +ChessSquare +CharToPiece (int c) { int i; if(c == '.') return EmptySquare; @@ -138,8 +138,8 @@ ChessSquare CharToPiece(c) return EmptySquare; } -void CopyBoard(to, from) - Board to, from; +void +CopyBoard (Board to, Board from) { int i, j; @@ -151,8 +151,8 @@ void CopyBoard(to, from) 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; @@ -173,12 +173,9 @@ int CompareBoards(board1, board2) 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; @@ -723,12 +720,8 @@ extern void GenLegalCallback P((Board board, int flags, ChessMove kind, 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; @@ -783,12 +776,8 @@ typedef struct { 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; @@ -972,12 +961,8 @@ extern void CheckTestCallback P((Board board, int flags, ChessMove kind, 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; @@ -996,10 +981,8 @@ void CheckTestCallback(board, flags, kind, rf, ff, rt, ft, 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; @@ -1063,11 +1046,8 @@ int CheckTest(board, flags, rf, ff, rt, ft, enPassant) 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); @@ -1103,12 +1083,8 @@ extern void LegalityTestCallback P((Board board, int flags, ChessMove kind, 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; @@ -1121,10 +1097,8 @@ void LegalityTestCallback(board, flags, kind, rf, ff, rt, ft, 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]; @@ -1235,12 +1209,8 @@ extern void MateTestCallback P((Board board, int flags, ChessMove kind, 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; @@ -1248,9 +1218,8 @@ void MateTestCallback(board, flags, kind, rf, ff, rt, ft, 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; @@ -1310,12 +1279,8 @@ extern void DisambiguateCallback P((Board board, int flags, ChessMove kind, 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]; @@ -1348,10 +1313,8 @@ void DisambiguateCallback(board, flags, kind, rf, ff, rt, ft, closure) } } -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; @@ -1483,12 +1446,8 @@ extern void CoordsToAlgebraicCallback P((Board board, int flags, 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; @@ -1517,12 +1476,8 @@ void CoordsToAlgebraicCallback(board, flags, kind, rf, ff, rt, ft, 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; @@ -1766,12 +1721,8 @@ extern void AtacksCallback P((Board board, int flags, 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 @@ -1790,12 +1741,8 @@ extern void ExistingAtacksCallback P((Board board, int flags, ChessMove kind, 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 @@ -1819,12 +1766,8 @@ extern void ProtectedCallback P((Board board, int flags, ChessMove kind, 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 @@ -1835,7 +1778,8 @@ void ProtectedCallback(board, flags, kind, rf, ff, rt, ft, closure) 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; diff --git a/parser.c b/parser.c index a0a7ad1..c4330d1 100644 --- a/parser.c +++ b/parser.c @@ -51,7 +51,8 @@ static char fromString = 0, lastChar = '\n'; #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 @@ -66,7 +67,8 @@ int ReadLine() 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; @@ -75,7 +77,8 @@ int Scan(char c, char **p) 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{ @@ -84,7 +87,8 @@ int SkipWhite(char **p) 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++; @@ -95,7 +99,8 @@ inline int Match(char *pattern, char **ptr) 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 @@ -106,15 +111,16 @@ inline int Word(char *pattern, char **p) 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; @@ -124,7 +130,8 @@ int Number(char **p) 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; @@ -139,7 +146,8 @@ int RdTime(char c, char **p) 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! @@ -151,7 +159,8 @@ char PromoSuffix(char **p) 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; @@ -533,12 +542,14 @@ badMove:// we failed to find algebraic move /* 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; @@ -547,14 +558,16 @@ void yynewfile (FILE *f) *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; @@ -564,7 +577,8 @@ int yylex() return result; } -int Myylex() +int +Myylex () { // [HGM] wrapper for yylex, which treats nesting of parentheses int symbol, nestingLevel = 0, i=0; char *p; @@ -584,7 +598,8 @@ int Myylex() 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; @@ -598,4 +613,3 @@ ChessMove yylexstr(int boardIndex, char *s, char *buf, int buflen) fromString = 0; return ret; } - diff --git a/pgntags.c b/pgntags.c index 28e607d..23957f6 100644 --- a/pgntags.c +++ b/pgntags.c @@ -50,9 +50,8 @@ /* 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; @@ -141,11 +140,9 @@ int ParsePGNTag(tag, gameInfo) } -/* 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 : "?"); @@ -169,8 +166,8 @@ void PrintPGNTags(fp, gameInfo) /* Return a non-static buffer with a games info. */ -char *PGNTags(gameInfo) - GameInfo *gameInfo; +char * +PGNTags (GameInfo *gameInfo) { size_t len; char *buf; @@ -219,8 +216,8 @@ char *PGNTags(gameInfo) /* Returns pointer to a static string with a result. */ -char *PGNResult(result) - ChessMove result; +char * +PGNResult (ChessMove result) { switch (result) { case GameUnfinished: @@ -237,9 +234,7 @@ char *PGNResult(result) /* Returns 0 for success, nonzero for error */ int -ReplaceTags(tags, gameInfo) - char *tags; - GameInfo *gameInfo; +ReplaceTags (char *tags, GameInfo *gameInfo) { ChessMove moveType; int err; diff --git a/uci.c b/uci.c index e0dfb15..683a71b 100644 --- a/uci.c +++ b/uci.c @@ -33,7 +33,8 @@ #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; diff --git a/xboard.c b/xboard.c index f29eb15..dc74e22 100644 --- a/xboard.c +++ b/xboard.c @@ -1171,10 +1171,7 @@ static int xpm_avail[MAXSQSIZE]; /* 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]; @@ -1198,9 +1195,7 @@ xpm_getsize(name, len, ext) /* Setup xpm_avail */ static int -xpm_getavail(dirname, ext) - char *dirname; - char *ext; +xpm_getavail (char *dirname, char *ext) { DIR *dir; struct dirent *ent; @@ -1232,9 +1227,7 @@ xpm_getavail(dirname, ext) } void -xpm_print_avail(fp, ext) - FILE *fp; - char *ext; +xpm_print_avail (FILE *fp, char *ext) { int i; @@ -1247,10 +1240,7 @@ xpm_print_avail(fp, ext) /* 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; @@ -1285,10 +1275,7 @@ xpm_closest_to(dirname, size, ext) 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\ @@ -1308,9 +1295,7 @@ TextColors textColors[(int)NColorClasses]; /* 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; @@ -1356,9 +1341,7 @@ parse_color(str, which) } 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"), @@ -1378,7 +1361,7 @@ parse_cpair(cc, str) /* 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); @@ -1387,7 +1370,7 @@ CatchDeleteWindow(Widget w, String procname) } void -BoardToTop() +BoardToTop () { Arg args[16]; XtSetArg(args[0], XtNiconic, False); @@ -1445,7 +1428,7 @@ Boolean fontIsSet[NUM_FONTS], fontValid[NUM_FONTS][MAX_SIZE]; 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)) { @@ -1474,7 +1457,7 @@ ParseFont(char *name, int number) } void -SetFontDefaults() +SetFontDefaults () { // only 2 fonts currently appData.clockFont = CLOCK_FONT_NAME; appData.coordFont = COORD_FONT_NAME; @@ -1482,41 +1465,41 @@ SetFontDefaults() } 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; @@ -1544,38 +1527,38 @@ SaveFontArg(FILE *f, ArgDescriptor *ad) } 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; @@ -1597,7 +1580,7 @@ GetActualPlacement(Widget wg, WindowPlacement *wp) } 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); @@ -1610,12 +1593,12 @@ GetWindowCoords() } 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] == '/') @@ -1627,7 +1610,7 @@ MySearchPath(char *installDir, char *name, char *fullname) } int -MyGetFullPathName(char *name, char *fullname) +MyGetFullPathName (char *name, char *fullname) { // should use ExpandPath? name = ExpandPathName(name); safeStrCpy(fullname, name, MSG_SIZ ); @@ -1635,24 +1618,24 @@ MyGetFullPathName(char *name, char *fullname) } 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; @@ -1680,7 +1663,8 @@ extern Boolean twoBoards, partnerUp; // 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]; @@ -1844,7 +1828,8 @@ void InitDrawingSizes(BoardSize boardSize, int flags) } #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 || @@ -1866,7 +1851,8 @@ void ParseIcsTextColors() } } -int MakeColors() +int +MakeColors () { // [HGM] taken out of main(), so it can be called from BoardOptions dialog XrmValue vFrom, vTo; int forceMono = False; @@ -1943,7 +1929,7 @@ int MakeColors() } void -CreateAnyPieces() +CreateAnyPieces () { // [HGM] taken out of main #if HAVE_LIBXPM if (appData.monoMode && // [HGM] no sense to go on to certain doom @@ -1965,9 +1951,7 @@ CreateAnyPieces() } int -main(argc, argv) - int argc; - char **argv; +main (int argc, char **argv) { int i, j, clockFontPxlSize, coordFontPxlSize, fontPxlSize; XSetWindowAttributes window_attributes; @@ -2721,7 +2705,7 @@ XBoard square size (hint): %d\n\ static Boolean noEcho; void -ShutDownFrontEnd() +ShutDownFrontEnd () { if (appData.icsActive && oldICSInteractionTitle != NULL) { DisplayIcsInteractionTitle(oldICSInteractionTitle); @@ -2732,21 +2716,20 @@ ShutDownFrontEnd() 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; @@ -2760,12 +2743,7 @@ CmailSigHandler(sig) } 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 */ @@ -2774,7 +2752,7 @@ CmailSigHandlerCallBack(isr, closure, message, count, error) void -ICSInitScript() +ICSInitScript () { /* try to open the icsLogon script, either in the location given * or in the users HOME directory @@ -2806,7 +2784,7 @@ ICSInitScript() } void -ResetFrontEnd() +ResetFrontEnd () { CommentPopDown(); TagsPopDown(); @@ -2819,8 +2797,7 @@ typedef struct { } Enables; void -GreyRevert(grey) - Boolean grey; +GreyRevert (Boolean grey) { Widget w; if (!menuBarWidget) return; @@ -2839,8 +2816,7 @@ GreyRevert(grey) } void -SetMenuEnables(enab) - Enables *enab; +SetMenuEnables (Enables *enab) { Widget w; if (!menuBarWidget) return; @@ -3029,7 +3005,8 @@ Enables userThinkingEnables[] = { { NULL, False } }; -void SetICSMode() +void +SetICSMode () { SetMenuEnables(icsEnables); @@ -3042,25 +3019,25 @@ void SetICSMode() } void -SetNCPMode() +SetNCPMode () { SetMenuEnables(ncpEnables); } void -SetGNUMode() +SetGNUMode () { SetMenuEnables(gnuEnables); } void -SetCmailMode() +SetCmailMode () { SetMenuEnables(cmailEnables); } void -SetTrainingModeOn() +SetTrainingModeOn () { SetMenuEnables(trainingOnEnables); if (appData.showButtonBar) { @@ -3070,7 +3047,7 @@ SetTrainingModeOn() } void -SetTrainingModeOff() +SetTrainingModeOff () { SetMenuEnables(trainingOffEnables); if (appData.showButtonBar) { @@ -3079,14 +3056,14 @@ SetTrainingModeOff() } void -SetUserThinkingEnables() +SetUserThinkingEnables () { if (appData.noChessProgram) return; SetMenuEnables(userThinkingEnables); } void -SetMachineThinkingEnables() +SetMachineThinkingEnables () { if (appData.noChessProgram) return; SetMenuEnables(machineThinkingEnables); @@ -3108,7 +3085,7 @@ static char *history[HISTORY_SIZE]; int histIn = 0, histP = 0; void -SaveInHistory(char *cmd) +SaveInHistory (char *cmd) { if (history[histIn] != NULL) { free(history[histIn]); @@ -3125,7 +3102,7 @@ SaveInHistory(char *cmd) } char * -PrevInHistory(char *cmd) +PrevInHistory (char *cmd) { int newhp; if (histP == histIn) { @@ -3139,7 +3116,7 @@ PrevInHistory(char *cmd) } char * -NextInHistory() +NextInHistory () { if (histP == histIn) return NULL; histP = (histP + 1) % HISTORY_SIZE; @@ -3151,9 +3128,7 @@ NextInHistory() #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; @@ -3204,8 +3179,7 @@ InsertPxlSize(pattern, targetPxlSize) } XFontSet -CreateFontSet(base_fnt_lst) - char *base_fnt_lst; +CreateFontSet (char *base_fnt_lst) { XFontSet fntSet; char **missing_list; @@ -3249,9 +3223,7 @@ CreateFontSet(base_fnt_lst) * 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; @@ -3308,7 +3280,8 @@ FindFont(pattern, targetPxlSize) } #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); @@ -3333,7 +3306,8 @@ void DeleteGCs() } } -void CreateGCs(int redo) +void +CreateGCs (int redo) { XtGCMask value_mask = GCLineWidth | GCLineStyle | GCForeground | GCBackground | GCFunction | GCPlaneMask; @@ -3438,12 +3412,8 @@ void CreateGCs(int redo) } } -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; @@ -3526,7 +3496,8 @@ void loadXIM(xim, xmask, filename, dest, mask) char pieceBitmapNames[] = "pnbrqfeacwmohijgdvlsukpnsl"; -void CreateXIMPieces() +void +CreateXIMPieces () { int piece, kind; char buf[MSG_SIZ]; @@ -3614,7 +3585,8 @@ void CreateXIMPieces() 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; @@ -3624,7 +3596,8 @@ void CreateXPMBoard(char *s, int kind) } } -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; @@ -3636,7 +3609,8 @@ void FreeXPMPieces() } } -void CreateXPMPieces() +void +CreateXPMPieces () { int piece, kind, r; char buf[MSG_SIZ]; @@ -3804,7 +3778,8 @@ void CreatePieces() } #else /* With built-in bitmaps */ -void CreatePieces() +void +CreatePieces () { BuiltInBits* bib = builtInBits; int piece, kind; @@ -3833,11 +3808,8 @@ void CreatePieces() } #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; @@ -3884,7 +3856,8 @@ void ReadBitmap(pm, name, bits, wreq, hreq) } } -void CreateGrid() +void +CreateGrid () { int i, j; @@ -3909,20 +3882,16 @@ void CreateGrid() } } -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; @@ -3951,9 +3920,8 @@ void CreateMenuBarPopup(parent, name, mb) } } -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; @@ -3999,8 +3967,8 @@ Widget CreateMenuBar(mb, boardWidth) return menuBar; } -Widget CreateButtonBar(mi) - MenuItem *mi; +Widget +CreateButtonBar (MenuItem *mi) { int j; Widget button, buttonBar; @@ -4034,9 +4002,7 @@ Widget CreateButtonBar(mi) } Widget -CreatePieceMenu(name, color) - char *name; - int color; +CreatePieceMenu (char *name, int color) { int i; Widget entry, menu; @@ -4070,7 +4036,7 @@ CreatePieceMenu(name, color) } void -CreatePieceMenus() +CreatePieceMenus () { int i; Widget entry; @@ -4105,7 +4071,8 @@ CreatePieceMenus() } } -void SetupDropMenu() +void +SetupDropMenu () { int i, j, count; char label[32]; @@ -4129,11 +4096,8 @@ void SetupDropMenu() } } -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 @@ -4151,39 +4115,29 @@ void PieceMenuPopup(w, event, params, num_params) 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); @@ -4194,8 +4148,8 @@ void BlackClock(w, event, prms, nprms) * 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; @@ -4210,15 +4164,14 @@ int EventToSquare(x, limit) 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; @@ -4242,8 +4195,7 @@ int hi1X = -1, hi1Y = -1, hi2X = -1, hi2Y = -1; 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) { @@ -4272,15 +4224,14 @@ SetHighlights(fromX, fromY, toX, toY) } 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) { @@ -4305,13 +4256,13 @@ SetPremoveHighlights(fromX, fromY, toX, toY) } 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); @@ -4328,10 +4279,8 @@ static int CutOutSquare(x, y, x0, y0, kind) 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)) { @@ -4376,10 +4325,8 @@ static void BlankSquare(x, y, color, piece, dest, fac) 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) { @@ -4402,10 +4349,8 @@ static void monoDrawPiece_1bit(piece, square_color, x, y, dest) } } -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 */ @@ -4427,10 +4372,8 @@ static void monoDrawPiece(piece, square_color, x, y, dest) } } -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) { @@ -4456,10 +4399,8 @@ static void colorDrawPiece(piece, square_color, x, y, dest) } } -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; @@ -4499,7 +4440,8 @@ static void colorDrawPieceImage(piece, square_color, x, y, dest) typedef void (*DrawFunc)(); -DrawFunc ChooseDrawFunc() +DrawFunc +ChooseDrawFunc () { if (appData.monoMode) { if (DefaultDepth(xDisplay, xScreen) == 1) { @@ -4516,8 +4458,8 @@ DrawFunc ChooseDrawFunc() } /* [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; @@ -4541,9 +4483,8 @@ static int SquareColor(row, column) 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; @@ -4666,10 +4607,8 @@ void DrawSquare(row, column, piece, do_flash) /* 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; @@ -4692,17 +4631,16 @@ void EventProc(widget, unused, event) } /* 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; @@ -4735,9 +4673,8 @@ static int castling_matrix[4][5] = { 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; @@ -4766,22 +4703,26 @@ static int check_castle_draw(newb, oldb, rrow, rcol) } // [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; @@ -4800,10 +4741,8 @@ static int damage[2][BOARD_RANKS][BOARD_FILES]; /* * 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; @@ -4910,11 +4849,8 @@ void XDrawPosition(w, repaint, board) /* * 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); } @@ -4930,11 +4866,8 @@ void DrawPositionProc(w, event, prms, nprms) // 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"); @@ -4956,22 +4889,23 @@ void HandleUserMove(w, event, prms, nprms) 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; @@ -4985,23 +4919,24 @@ void CommentClick (Widget w, XEvent * event, String * params, Cardinal * nParams 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; @@ -5018,19 +4953,21 @@ void ICSInputSendText() 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); } @@ -5038,17 +4975,14 @@ void CommentPopDown() 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 */ @@ -5061,7 +4995,8 @@ void FileNamePopUp(label, def, filter, proc, openMode) } } -void FileNamePopDown() +void +FileNamePopDown () { if (!filenameUp) return; XtPopdown(fileNameShell); @@ -5070,9 +5005,8 @@ void FileNamePopDown() 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]; @@ -5088,11 +5022,8 @@ void FileNameCallback(w, client_data, call_data) 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; @@ -5137,7 +5068,8 @@ void FileNameAction(w, event, prms, nprms) ModeHighlight(); } -void PromotionPopUp() +void +PromotionPopUp () { Arg args[16]; Widget dialog, layout; @@ -5218,7 +5150,8 @@ void PromotionPopUp() promotionUp = True; } -void PromotionPopDown() +void +PromotionPopDown () { if (!promotionUp) return; XtPopdown(promotionShell); @@ -5226,9 +5159,8 @@ void PromotionPopDown() 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; @@ -5249,9 +5181,8 @@ void PromotionCallback(w, client_data, call_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)))); @@ -5260,7 +5191,8 @@ void ErrorCallback(w, client_data, call_data) } -void ErrorPopDown() +void +ErrorPopDown () { if (!errorUp) return; errorUp = False; @@ -5269,9 +5201,8 @@ void ErrorPopDown() 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; @@ -5339,7 +5270,9 @@ void ErrorPopUp(title, label, modal) /* 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 */ @@ -5348,15 +5281,16 @@ void FreezeUI() } /* 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: @@ -5397,7 +5331,8 @@ char *ModeToWidgetName(mode) } } -void ModeHighlight() +void +ModeHighlight () { Arg args[16]; static int oldPausing = FALSE; @@ -5456,19 +5391,14 @@ void ModeHighlight() /* * 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) { @@ -5486,11 +5416,8 @@ int LoadGamePopUp(f, gameNumber, title) 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); @@ -5498,65 +5425,44 @@ void LoadGameProc(w, event, prms, nprms) 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); @@ -5564,11 +5470,8 @@ void LoadPositionProc(w, event, prms, nprms) 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"), @@ -5576,11 +5479,8 @@ void SaveGameProc(w, event, prms, nprms) 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"), @@ -5588,20 +5488,14 @@ void SavePositionProc(w, event, prms, nprms) 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(); } @@ -5610,9 +5504,9 @@ void MailMoveProc(w, event, prms, nprms) 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; @@ -5658,12 +5552,9 @@ SendPositionSelection(Widget w, Atom *selection, Atom *target, /* 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. @@ -5683,12 +5574,12 @@ void CopyPositionProc(w, event, prms, nprms) 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 */ @@ -5719,9 +5610,9 @@ void PastePositionProc(w, event, prms, nprms) } 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; @@ -5772,7 +5663,8 @@ SendGameSelection(Widget w, Atom *selection, Atom *target, } } -void CopySomething() +void +CopySomething () { /* * Set both PRIMARY (the selection) and CLIPBOARD, since we don't @@ -5794,11 +5686,8 @@ void CopySomething() /* 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; @@ -5808,11 +5697,8 @@ void CopyGameProc(w, event, prms, nprms) 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(); @@ -5820,8 +5706,8 @@ void CopyGameListProc(w, event, prms, nprms) /* 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) { @@ -5840,11 +5726,8 @@ PasteGameCB(Widget w, XtPointer client_data, Atom *selection, /* 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, @@ -5860,54 +5743,39 @@ void PasteGameProc(w, event, prms, nprms) } -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]; @@ -5948,11 +5816,8 @@ void AnalyzeModeProc(w, event, prms, nprms) 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]; @@ -5970,65 +5835,44 @@ void AnalyzeFileProc(w, event, prms, nprms) 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; @@ -6041,129 +5885,87 @@ void EditCommentProc(w, event, prms, nprms) 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; @@ -6186,11 +5988,8 @@ void UpKeyProc(w, event, prms, nprms) } } -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; @@ -6208,58 +6007,40 @@ void DownKeyProc(w, event, prms, nprms) } } -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; @@ -6267,11 +6048,8 @@ void TempBackwardProc(w, event, prms, nprms) } } -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 */ @@ -6286,83 +6064,57 @@ void TempForwardProc(w, event, prms, nprms) 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]; @@ -6379,11 +6131,8 @@ void PonderNextMoveProc(w, event, prms, nprms) } #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]; @@ -6398,11 +6147,8 @@ void AlwaysQueenProc(w, event, prms, nprms) 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]; @@ -6418,11 +6164,8 @@ void AnimateDraggingProc(w, event, prms, nprms) 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]; @@ -6438,11 +6181,8 @@ void AnimateMovingProc(w, event, prms, nprms) 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]; @@ -6457,11 +6197,8 @@ void AutoflagProc(w, event, prms, nprms) 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]; @@ -6476,11 +6213,8 @@ void AutoflipProc(w, event, prms, nprms) 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]; @@ -6497,11 +6231,8 @@ void BlindfoldProc(w, event, prms, nprms) 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]; @@ -6517,11 +6248,8 @@ void TestLegalityProc(w, event, prms, nprms) } -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]; @@ -6541,11 +6269,8 @@ void FlashMovesProc(w, event, prms, nprms) } #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]; @@ -6561,11 +6286,8 @@ void HighlightDraggingProc(w, event, prms, nprms) } #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]; @@ -6580,11 +6302,8 @@ void HighlightLastMoveProc(w, event, prms, nprms) "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]; @@ -6600,11 +6319,8 @@ void HighlightArrowProc(w, event, prms, nprms) } #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]; @@ -6620,11 +6336,8 @@ void IcsAlarmProc(w, event, prms, nprms) } #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]; @@ -6639,11 +6352,8 @@ void MoveSoundProc(w, event, prms, nprms) 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]; @@ -6658,11 +6368,8 @@ void OneClickProc(w, event, prms, nprms) 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]; @@ -6677,11 +6384,8 @@ void PeriodicUpdatesProc(w, event, prms, nprms) 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]; @@ -6696,11 +6400,8 @@ void PopupExitMessageProc(w, event, prms, nprms) "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]; @@ -6716,11 +6417,8 @@ void PopupMoveErrorsProc(w, event, prms, nprms) } #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]; @@ -6736,11 +6434,8 @@ void PremoveProc(w, event, prms, nprms) } #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]; @@ -6757,21 +6452,15 @@ void ShowCoordsProc(w, event, prms, nprms) 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]; @@ -6788,11 +6477,8 @@ void HideThinkingProc(w, event, prms, nprms) } #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]; @@ -6807,20 +6493,14 @@ void SaveOnExitProc(w, event, prms, nprms) 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 &", @@ -6828,11 +6508,8 @@ void InfoProc(w, event, prms, nprms) 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; @@ -6844,29 +6521,20 @@ void ManProc(w, event, prms, nprms) 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 @@ -6885,35 +6553,26 @@ _("%s%s\n\n" 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 */ @@ -6947,8 +6606,8 @@ void DisplayMessage(message, extMessage) return; } -void DisplayTitle(text) - char *text; +void +DisplayTitle (char *text) { Arg args[16]; int i; @@ -6999,9 +6658,7 @@ void DisplayTitle(text) void -DisplayError(message, error) - String message; - int error; +DisplayError (String message, int error) { char buf[MSG_SIZ]; @@ -7021,8 +6678,8 @@ DisplayError(message, error) } -void DisplayMoveError(message) - String message; +void +DisplayMoveError (String message) { fromX = fromY = -1; ClearHighlights(); @@ -7038,9 +6695,8 @@ void DisplayMoveError(message) } -void DisplayFatalError(message, error, status) - String message; - int error, status; +void +DisplayFatalError (String message, int error, int status) { char buf[MSG_SIZ]; @@ -7060,30 +6716,28 @@ void DisplayFatalError(message, error, status) } } -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 */ @@ -7114,11 +6768,8 @@ void DisplayIcsInteractionTitle(message) 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"), @@ -7128,7 +6779,8 @@ void AskQuestionProc(w, event, prms, nprms) AskQuestionEvent(prms[0], prms[1], prms[2], prms[3]); } -void AskQuestionPopDown() +void +AskQuestionPopDown () { if (!askQuestionUp) return; XtPopdown(askQuestionShell); @@ -7136,11 +6788,8 @@ void AskQuestionPopDown() 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; @@ -7157,9 +6806,8 @@ void AskQuestionReplyAction(w, event, prms, nprms) 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]; @@ -7174,9 +6822,8 @@ void AskQuestionCallback(w, client_data, call_data) } } -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; @@ -7230,8 +6877,7 @@ void AskQuestion(title, question, replyPrefix, pr) void -PlaySound(name) - char *name; +PlaySound (char *name) { if (*name == NULLCHAR) { return; @@ -7248,71 +6894,69 @@ PlaySound(name) } 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; @@ -7375,14 +7019,14 @@ Colorize(cc, continuation) } } -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]; @@ -7424,7 +7068,8 @@ ExpandPathName(path) return static_buf; } -char *HostName() +char * +HostName () { static char host_name[MSG_SIZ]; @@ -7445,15 +7090,14 @@ XtIntervalId delayedEventTimerXID = 0; 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 @@ -7465,7 +7109,7 @@ ScheduleDelayedEvent(cb, millisec) } DelayedEventCallback -GetDelayedEvent() +GetDelayedEvent () { if (delayedEventTimerXID) { return delayedEventCallback; @@ -7475,7 +7119,7 @@ GetDelayedEvent() } void -CancelDelayedEvent() +CancelDelayedEvent () { if (delayedEventTimerXID) { XtRemoveTimeOut(delayedEventTimerXID); @@ -7485,12 +7129,14 @@ CancelDelayedEvent() XtIntervalId loadGameTimerXID = 0; -int LoadGameTimerRunning() +int +LoadGameTimerRunning () { return loadGameTimerXID != 0; } -int StopLoadGameTimer() +int +StopLoadGameTimer () { if (loadGameTimerXID != 0) { XtRemoveTimeOut(loadGameTimerXID); @@ -7502,17 +7148,14 @@ int StopLoadGameTimer() } 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, @@ -7523,9 +7166,7 @@ StartLoadGameTimer(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] @@ -7535,7 +7176,7 @@ AnalysisClockCallback(arg, id) } void -StartAnalysisClock() +StartAnalysisClock () { analysisClockXID = XtAppAddTimeOut(appContext, 2000, @@ -7545,12 +7186,14 @@ StartAnalysisClock() XtIntervalId clockTimerXID = 0; -int ClockTimerRunning() +int +ClockTimerRunning () { return clockTimerXID != 0; } -int StopClockTimer() +int +StopClockTimer () { if (clockTimerXID != 0) { XtRemoveTimeOut(clockTimerXID); @@ -7562,17 +7205,14 @@ int StopClockTimer() } 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, @@ -7581,11 +7221,7 @@ StartClockTimer(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]; @@ -7619,9 +7255,7 @@ DisplayTimerLabel(w, color, timer, highlight) } void -DisplayWhiteClock(timeRemaining, highlight) - long timeRemaining; - int highlight; +DisplayWhiteClock (long timeRemaining, int highlight) { Arg args[16]; @@ -7635,9 +7269,7 @@ DisplayWhiteClock(timeRemaining, highlight) } void -DisplayBlackClock(timeRemaining, highlight) - long timeRemaining; - int highlight; +DisplayBlackClock (long timeRemaining, int highlight) { Arg args[16]; @@ -7664,10 +7296,8 @@ typedef struct { } 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; @@ -7739,15 +7369,14 @@ int StartChildProcess(cmdLine, dir, pr) } // [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; @@ -7774,8 +7403,7 @@ DestroyChildProcess(pr, signalType) } void -InterruptChildProcess(pr) - ProcRef pr; +InterruptChildProcess (ProcRef pr) { ChildProc *cp = (ChildProc *) pr; @@ -7783,10 +7411,8 @@ InterruptChildProcess(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]; @@ -7798,10 +7424,8 @@ int OpenTelnet(host, port, pr) 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); @@ -7853,9 +7477,8 @@ int OpenTCP(host, port, pr) return 0; } -int OpenCommPort(name, pr) - char *name; - ProcRef *pr; +int +OpenCommPort (char *name, ProcRef *pr) { int fd; ChildProc *cp; @@ -7873,8 +7496,8 @@ int OpenCommPort(name, pr) return 0; } -int OpenLoopback(pr) - ProcRef *pr; +int +OpenLoopback (ProcRef *pr) { ChildProc *cp; int to[2], from[2]; @@ -7891,9 +7514,8 @@ int OpenLoopback(pr) 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; @@ -7913,10 +7535,7 @@ typedef struct { } 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; @@ -7954,11 +7573,8 @@ DoInputCallback(closure, source, xid) } } -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; @@ -7986,8 +7602,7 @@ InputSourceRef AddInputSource(pr, lineByLine, func, closure) } void -RemoveInputSource(isr) - InputSourceRef isr; +RemoveInputSource (InputSourceRef isr) { InputSource *is = (InputSource *) isr; @@ -7996,11 +7611,8 @@ RemoveInputSource(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; @@ -8044,12 +7656,8 @@ int OutputToProcess(pr, message, count, outError) 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; @@ -8091,8 +7699,7 @@ int OutputToProcessDelayed(pr, message, count, outError, msdelay) static int xpmDone = 0; static void -CreateAnimMasks (pieceDepth) - int pieceDepth; +CreateAnimMasks (int pieceDepth) { ChessSquare piece; Pixmap buf; @@ -8170,9 +7777,7 @@ CreateAnimMasks (pieceDepth) } static void -InitAnimState (anim, info) - AnimState * anim; - XWindowAttributes * info; +InitAnimState (AnimState *anim, XWindowAttributes *info) { XtGCMask mask; XGCValues values; @@ -8222,8 +7827,8 @@ CreateAnimVars () static Boolean frameWaiting; -static RETSIGTYPE FrameAlarm (sig) - int sig; +static RETSIGTYPE +FrameAlarm (int sig) { frameWaiting = False; /* In case System-V style signals. Needed?? */ @@ -8231,8 +7836,7 @@ static RETSIGTYPE FrameAlarm (sig) } static void -FrameDelay (time) - int time; +FrameDelay (int time) { struct itimerval delay; @@ -8256,8 +7860,7 @@ FrameDelay (time) #else static void -FrameDelay (time) - int time; +FrameDelay (int time) { XSync(xDisplay, False); if (time > 0) @@ -8267,7 +7870,7 @@ FrameDelay (time) #endif void -DoSleep(int n) +DoSleep (int n) { FrameDelay(n); } @@ -8275,8 +7878,7 @@ DoSleep(int 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); @@ -8291,8 +7893,7 @@ ScreenSquare(column, row, pt, color) /* 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) @@ -8310,8 +7911,7 @@ BoardSquare(x, y, column, row) #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; @@ -8324,9 +7924,7 @@ SetRect(rect, x, y, width, height) 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) { @@ -8344,9 +7942,7 @@ Intersect(old, new, size, area, pt) 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; @@ -8392,10 +7988,7 @@ CalcUpdateRects(old, new, size, update, nUpdates) 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; @@ -8430,8 +8023,7 @@ Tween(start, mid, finish, factor, frames, nFrames) /* 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; @@ -8471,8 +8063,7 @@ SelectGCMask(piece, clip, outline, mask) } 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; @@ -8502,11 +8093,7 @@ OverlayPiece(piece, clip, outline, dest) /* 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; @@ -8521,10 +8108,7 @@ BeginAnimation(anim, piece, startColor, start) } static void -AnimationFrame(anim, frame, piece) - AnimState *anim; - XPoint *frame; - ChessSquare piece; +AnimationFrame (AnimState *anim, XPoint *frame, ChessSquare piece) { XRectangle updates[4]; XRectangle overlap; @@ -8574,9 +8158,7 @@ AnimationFrame(anim, frame, piece) } static void -EndAnimation (anim, finish) - AnimState *anim; - XPoint *finish; +EndAnimation (AnimState *anim, XPoint *finish) { XRectangle updates[4]; XRectangle overlap; @@ -8601,11 +8183,7 @@ EndAnimation (anim, finish) } 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; @@ -8618,7 +8196,7 @@ FrameSequence(anim, piece, startColor, start, finish, frames, nFrames) } 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]; @@ -8643,12 +8221,7 @@ AnimateAtomicCapture(Board board, int fromX, int fromY, int toX, int 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; @@ -8713,8 +8286,7 @@ AnimateMove(board, fromX, fromY, toX, toY) } void -DragPieceBegin(x, y, instantly) - int x; int y; Boolean instantly; +DragPieceBegin (int x, int y, Boolean instantly) { int boardX, boardY, color; XPoint corner; @@ -8767,7 +8339,7 @@ DragPieceBegin(x, y, instantly) } void -ChangeDragPiece(ChessSquare piece) +ChangeDragPiece (ChessSquare piece) { Pixmap mask; player.dragPiece = piece; @@ -8777,8 +8349,7 @@ ChangeDragPiece(ChessSquare piece) } static void -DragPieceMove(x, y) - int x; int y; +DragPieceMove (int x, int y) { XPoint corner; @@ -8804,8 +8375,7 @@ DragPieceMove(x, y) } void -DragPieceEnd(x, y) - int x; int y; +DragPieceEnd (int x, int y) { int boardX, boardY, color; XPoint corner; @@ -8851,7 +8421,8 @@ DrawDragPiece () } #include -int get_term_width() +int +get_term_width () { int fd, default_width; @@ -8871,7 +8442,7 @@ int get_term_width() } void -update_ics_width() +update_ics_width () { static int old_width = 0; int new_width = get_term_width(); @@ -8881,7 +8452,8 @@ update_ics_width() old_width = new_width; } -void NotifyFrontendLogin() +void +NotifyFrontendLogin () { update_ics_width(); } @@ -8893,17 +8465,20 @@ static double A_WIDTH = 5; /* Width of arrow body */ #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); @@ -8915,7 +8490,8 @@ void SquareToPos(int rank, int file, int *x, int *y) } /* 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; @@ -9019,7 +8595,8 @@ void DrawArrowBetweenPoints( int s_x, int s_y, int d_x, int d_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; @@ -9069,18 +8646,21 @@ void DrawArrowBetweenSquares( int s_col, int s_row, int d_col, int d_row ) } } -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 } diff --git a/xedittags.c b/xedittags.c index b1fdd67..36f5fb4 100644 --- a/xedittags.c +++ b/xedittags.c @@ -93,32 +93,28 @@ extern char *getenv(); 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; diff --git a/xengineoutput.c b/xengineoutput.c index fc1c9a2..6bb2917 100644 --- a/xengineoutput.c +++ b/xengineoutput.c @@ -134,7 +134,8 @@ typedef struct { //static void UpdateControls( EngineOutputData * ed ); -void ReadIcon(char *pixData[], int iconNr) +void +ReadIcon (char *pixData[], int iconNr) { int r; @@ -147,7 +148,8 @@ void ReadIcon(char *pixData[], int iconNr) } } -static void InitializeEngineOutput() +static void +InitializeEngineOutput () { ReadIcon(WHITE_14, nColorWhite); ReadIcon(BLACK_14, nColorBlack); @@ -159,7 +161,8 @@ static void InitializeEngineOutput() ReadIcon(ANALYZE_14, nAnalyzing); } -void DoSetWindowText(int which, int field, char *s_label) +void +DoSetWindowText (int which, int field, char *s_label) { Arg arg; @@ -167,14 +170,16 @@ void DoSetWindowText(int which, int field, char *s_label) 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; @@ -193,7 +198,8 @@ void InsertIntoMemo( int which, char * text, int where ) } } -void SetIcon( int which, int field, int nIcon ) +void +SetIcon (int which, int field, int nIcon) { Arg arg; @@ -203,7 +209,8 @@ void SetIcon( int which, int field, int nIcon ) } } -void DoClearMemo(int which) +void +DoClearMemo (int which) { Widget edit = XtNameToWidget(engineOutputShell, which ? "*form2.text" : "*form.text"); Arg arg; @@ -257,8 +264,8 @@ StopPV (Widget w, XEvent * event, String * params, Cardinal * nParams) } 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; @@ -270,11 +277,8 @@ MemoCB(Widget w, XtPointer client_data, Atom *selection, 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); @@ -292,10 +296,8 @@ void CopyMemoProc(w, event, prms, nprms) // 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; @@ -398,8 +400,8 @@ void PositionControlSet(which, shell, form, bw_width) 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; @@ -490,8 +492,8 @@ Widget EngineOutputCreate(name, text) return shell; } -void ResizeWindowControls(mode) - int mode; +void +ResizeWindowControls (int mode) { Widget form1, form2; Arg args[16]; @@ -528,7 +530,7 @@ void ResizeWindowControls(mode) } void -EngineOutputPopUp() +EngineOutputPopUp () { Arg args[16]; int j; @@ -572,7 +574,8 @@ EngineOutputPopUp() ShowThinkingEvent(); // [HGM] thinking: might need to prompt engine for thinking output } -void EngineOutputPopDown() +void +EngineOutputPopDown () { Arg args[16]; int j; @@ -600,22 +603,20 @@ void EngineOutputPopDown() 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(); diff --git a/xevalgraph.c b/xevalgraph.c index 627763b..ad0e962 100644 --- a/xevalgraph.c +++ b/xevalgraph.c @@ -117,7 +117,8 @@ static HBITMAP hbmPB = NULL; #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; @@ -128,7 +129,8 @@ void DrawSegment( int x, int y, int *lastX, int *lastY, int penType ) } // 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) @@ -136,14 +138,16 @@ void DrawRectangle( int left, int top, int right, int bottom, int side, int styl } // 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; @@ -155,7 +159,8 @@ static Pixel MakeColor(char *color ) 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; @@ -174,7 +179,8 @@ static GC CreateGC(int width, char *fg, char *bg, int style) // 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; @@ -205,7 +211,8 @@ static void DisplayEvalGraph() 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); @@ -217,10 +224,8 @@ static void InitializeEvalGraph() 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 ); @@ -233,10 +238,8 @@ void EvalClick(widget, unused, event) // 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; @@ -252,8 +255,8 @@ void EvalEventProc(widget, unused, event) } // 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; @@ -341,7 +344,7 @@ Widget EvalGraphCreate(name) } void -EvalGraphPopUp() +EvalGraphPopUp () { Arg args[16]; int j; @@ -376,7 +379,8 @@ EvalGraphPopUp() // ShowThinkingEvent(); // [HGM] thinking: might need to prompt engine for thinking output } -void EvalGraphPopDown() +void +EvalGraphPopDown () { Arg args[16]; int j; @@ -403,22 +407,20 @@ void EvalGraphPopDown() // 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(); @@ -429,7 +431,8 @@ EvalGraphProc(w, event, prms, nprms) // 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! */ diff --git a/xgamelist.c b/xgamelist.c index ecdc915..a0f964b 100644 --- a/xgamelist.c +++ b/xgamelist.c @@ -125,10 +125,7 @@ typedef struct { 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; @@ -330,7 +327,7 @@ extern int soughtCounts[]; 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; @@ -373,7 +370,7 @@ static char *list[1003]; int listEnd; static void -GameListReplace(int page) +GameListReplace (int page) { // filter: put in separate routine, to make callable from call-back Widget listwidg; @@ -398,9 +395,7 @@ GameListReplace(int page) } 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]; @@ -468,9 +463,7 @@ GameListCallback(w, client_data, call_data) } void -GameListPopUp(fp, filename) - FILE *fp; - char *filename; +GameListPopUp (FILE *fp, char *filename) { Arg args[16]; int j; @@ -510,7 +503,7 @@ GameListPopUp(fp, filename) } void -GameListDestroy() +GameListDestroy () { if (glc == NULL) return; GameListPopDown(); @@ -527,11 +520,7 @@ GameListDestroy() } 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; @@ -554,11 +543,7 @@ ShowGameListProc(w, event, prms, nprms) } 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; @@ -602,11 +587,7 @@ LoadSelectedProc(w, event, prms, nprms) } 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; @@ -625,7 +606,7 @@ SetFilterProc(w, event, prms, nprms) } void -GameListPopDown() +GameListPopDown () { Arg args[16]; int j; @@ -651,8 +632,7 @@ GameListPopDown() } void -GameListHighlight(index) - int index; +GameListHighlight (int index) { Widget listwidg; int i=0; char **st; @@ -664,12 +644,13 @@ GameListHighlight(index) } Boolean -GameListIsUp() +GameListIsUp () { return glc && glc->up; } -int SaveGameListAsText(FILE *f) +int +SaveGameListAsText (FILE *f) { ListGame * lg = (ListGame *) gameList.head; int nItem; @@ -705,32 +686,36 @@ Widget gameListOptShell, listwidg; 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; @@ -741,9 +726,7 @@ GameListOptionsPopDown() } 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]; @@ -794,7 +777,7 @@ GameListOptionsCallback(w, client_data, call_data) } Widget -GameListOptionsCreate() +GameListOptionsCreate () { Arg args[16]; Widget shell, form, viewport, layout; @@ -895,7 +878,7 @@ GameListOptionsCreate() } void -GameListOptionsPopUp(Widget w, XEvent *event, String *prms, Cardinal *nprms) +GameListOptionsPopUp (Widget w, XEvent *event, String *prms, Cardinal *nprms) { if (gameListOptShell == NULL) gameListOptShell = GameListOptionsCreate(); diff --git a/xhistory.c b/xhistory.c index 7ce2d31..1a0d2e5 100644 --- a/xhistory.c +++ b/xhistory.c @@ -70,25 +70,29 @@ extern Option historyOptions[]; // ------------- 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; @@ -131,17 +135,20 @@ Option historyOptions[] = { // ------------ 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)); @@ -149,11 +156,7 @@ void HistoryPopUp() } 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, ""); diff --git a/xoptions.c b/xoptions.c index 9188fd4..6742e3f 100644 --- a/xoptions.c +++ b/xoptions.c @@ -84,7 +84,8 @@ extern char *getenv(); 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; @@ -115,14 +116,16 @@ static Option *currentOption; 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); @@ -130,14 +133,16 @@ void SetWidgetText(Option *opt, char *buf, int n) 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; @@ -148,9 +153,8 @@ void CheckCallback(Widget ww, XtPointer data, XEvent *event, Boolean *b) 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]; @@ -190,10 +194,8 @@ void SpinCallback(w, client_data, call_data) 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; @@ -211,10 +213,8 @@ void ComboSelect(w, addr, index) // callback for all combo items 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; @@ -259,14 +259,16 @@ Boolean shellUp[10]; 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]; @@ -296,11 +298,8 @@ int PopDown(int n) 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'); @@ -312,7 +311,8 @@ extern Option installOptions[], matchOptions[]; 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; @@ -324,19 +324,22 @@ int AppendText(Option *opt, char *s) 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]; @@ -345,13 +348,15 @@ int MatchOK(int n) return 1; } -void ReplaceParticipant() +void +ReplaceParticipant () { GenericReadout(3); Substitute(strdup(engineName), True); } -void UpgradeParticipant() +void +UpgradeParticipant () { GenericReadout(3); Substitute(strdup(engineName), False); @@ -380,7 +385,8 @@ Option matchOptions[] = { { 0, 1, 0, NULL, (void*) &MatchOK, "", NULL, EndMark , "" } }; -int GeneralOptionsOK(int n) +int +GeneralOptionsOK (int n) { int newPonder = appData.ponderNextMove; appData.ponderNextMove = oldPonder; @@ -418,7 +424,8 @@ Option generalOptions[] = { { 0, 0, 0, NULL, (void*) &GeneralOptionsOK, "", NULL, EndMark , "" } }; -void Pick(int n) +void +Pick (int n) { VariantClass v = currentOption[n].value; if(!appData.noChessProgram) { @@ -495,7 +502,8 @@ Option variantDescriptors[] = { { 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 @@ -540,7 +548,8 @@ Option adjudicationOptions[] = { { 0, 1, 0, NULL, NULL, "", NULL, EndMark , "" } }; -int IcsOptionsOK(int n) +int +IcsOptionsOK (int n) { ParseIcsTextColors(); return 1; @@ -584,7 +593,8 @@ char *modeNames[] = { N_("Exact position match"), N_("Shown position is subset") char *modeValues[] = { "1", "2", "3", "4", "5", "6" }; char *searchMode; -int LoadOptionsOK() +int +LoadOptionsOK () { appData.searchMode = atoi(searchMode); return 1; @@ -655,7 +665,8 @@ char *soundFiles[] = { // sound files corresponding to above names NULL }; -void Test(int n) +void +Test (int n) { GenericReadout(2); if(soundFiles[values[3]]) PlaySound(soundFiles[values[3]]); @@ -685,7 +696,8 @@ Option soundOptions[] = { { 0, 1, 0, NULL, NULL, "", NULL, EndMark , "" } }; -void SetColor(char *colorName, Option *box) +void +SetColor (char *colorName, Option *box) { Arg args[5]; Pixel buttonColor; @@ -704,18 +716,21 @@ void SetColor(char *colorName, Option *box) 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 @@ -736,20 +751,23 @@ void RefreshColor(int source, int n) 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; @@ -809,7 +827,8 @@ Option boardOptions[] = { { 0, 0, 0, NULL, (void*) &BoardOptionsOK, "", NULL, EndMark , "" } }; -int GenericReadout(int selected) +int +GenericReadout (int selected) { int i, j, res=1; String val; @@ -896,9 +915,8 @@ int GenericReadout(int selected) 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]; @@ -928,7 +946,7 @@ void GenericCallback(w, client_data, call_data) static char *oneLiner = "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; @@ -1271,98 +1289,68 @@ GenericPopUp(Option *option, char *title, int dlgNr) } -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; @@ -1375,7 +1363,8 @@ void MatchOptionsProc(w, event, prms, nprms) 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")) { @@ -1391,8 +1380,8 @@ void SendString(char *p) /* 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 */ @@ -1404,7 +1393,8 @@ SendTextCB(Widget w, XtPointer client_data, Atom *selection, XtFree(value); } -void SendText(int n) +void +SendText (int n) { char *p = (char*) textOptions[n].choice; if(strstr(p, "$name")) { @@ -1417,11 +1407,8 @@ void SendText(int n) } 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; @@ -1457,13 +1444,15 @@ static int commentIndex; 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); @@ -1476,7 +1465,8 @@ Option commentOptions[] = { { 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); @@ -1485,12 +1475,14 @@ void ClearTextWidget(Option *opt) 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]; @@ -1508,13 +1500,15 @@ void NewCommentPopup(char *title, char *text, int index) 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 @@ -1528,7 +1522,8 @@ Option tagsOptions[] = { { 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"); @@ -1551,7 +1546,8 @@ Option boxOptions[] = { { 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; @@ -1568,18 +1564,16 @@ void PutText(char *text, int pos) 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; @@ -1594,7 +1588,8 @@ char moveTypeInTranslations[] = "Return: TypeInProc(1) \n" "Escape: TypeInProc(0) \n"; -void PopUpMoveDialog(char firstchar) +void +PopUpMoveDialog (char firstchar) { static char buf[2]; buf[0] = firstchar; icsText = buf; @@ -1602,7 +1597,8 @@ void PopUpMoveDialog(char firstchar) 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; @@ -1632,32 +1628,27 @@ void MoveTypeInProc(Widget widget, caddr_t unused, XEvent *event) } 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); @@ -1681,11 +1672,8 @@ Option installOptions[] = { { 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]); @@ -1697,18 +1685,16 @@ void LoadEngineProc(w, event, prms, nprms) 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; @@ -1722,7 +1708,8 @@ Option shuffleOptions[] = { { 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]; @@ -1731,31 +1718,31 @@ void SetRandom(int n) 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; @@ -1796,7 +1783,8 @@ Option tcOptions[] = { { 0, 0, 0, NULL, (void*) &TcOK, "", NULL, EndMark , "" } }; -void SetTcType(int n) +void +SetTcType (int n) { switch(tcType = n) { case 0: @@ -1816,11 +1804,8 @@ void SetTcType(int n) } } -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; @@ -1831,7 +1816,8 @@ void TimeControlProc(w, event, prms, nprms) //---------------------------- Chat Windows ---------------------------------------------- -void OutputChatMessage(int partner, char *mess) +void +OutputChatMessage (int partner, char *mess) { return; // dummy } diff --git a/zic2xpm.c b/zic2xpm.c index 842f03d..12545ba 100644 --- a/zic2xpm.c +++ b/zic2xpm.c @@ -132,15 +132,15 @@ z2xpm z2xpm_tab[NR_ZIICS_COLORS] = { { 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; @@ -156,8 +156,8 @@ z2xim *lookup_xim_color( color ) return NULL; /* Make compiler happy */ } -z2xpm *lookup_xpm_color( color ) - int color; +z2xpm * +lookup_xpm_color (int color) { int i; @@ -175,8 +175,8 @@ z2xpm *lookup_xpm_color( color ) char *src_name; -int up8( i ) - int i; +int +up8 (int i) { int r; @@ -187,8 +187,8 @@ int up8( i ) 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; @@ -200,9 +200,8 @@ unsigned int vga_imagesize( w, h ) 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; @@ -232,9 +231,8 @@ unsigned char *decode_byte( dest, b, w ) 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; @@ -266,9 +264,8 @@ unsigned char *decode_line( dest, src, w ) 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 ); @@ -276,9 +273,8 @@ int write_xim_header( fp, w, h ) 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; @@ -308,10 +304,8 @@ int write_xpm_header( fp, w, h ) 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; @@ -366,10 +360,8 @@ void create_piece_xim( outname, fpin, W, H ) 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; @@ -435,8 +427,8 @@ char *pname[] = { "Pawn", "Rook", "King", "Queen", "Bishop", "Knight" }; /* 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; @@ -502,8 +494,8 @@ int process_file_xim( filename ) 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; @@ -569,9 +561,8 @@ int process_file_xpm( filename ) return 0; } -int main( argc, argv ) - int argc; - char *argv[]; +int +main (int argc, char **argv) { int i; diff --git a/zippy.c b/zippy.c index 23b3794..c5c4207 100644 --- a/zippy.c +++ b/zippy.c @@ -105,7 +105,8 @@ static time_t zippyLastGameEnd; extern void mysrandom(unsigned int seed); extern int myrandom(void); -void ZippyInit() +void +ZippyInit () { char *p; @@ -304,8 +305,8 @@ char *swifties[] = { #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; @@ -381,8 +382,8 @@ void Speak(how, whom) Speak(how, whom); /* tail recursion */ } -int ZippyCalled(str) - char *str; +int +ZippyCalled (char *str) { return ics_handle[0] != NULLCHAR && StrCaseStr(str, ics_handle) != NULL; } @@ -392,12 +393,14 @@ static int num_opps=0; 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 ); @@ -405,9 +408,8 @@ static void ColorizeEx( ColorClass color, int cont ) } } -int ZippyControl(buf, i) - char *buf; - int *i; +int +ZippyControl (char *buf, int *i) { char *player, *p; char reply[MSG_SIZ]; @@ -580,9 +582,8 @@ int ZippyControl(buf, i) 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]; @@ -732,8 +733,8 @@ int ZippyConverse(buf, i) 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 */ @@ -750,9 +751,8 @@ void ZippyGameStart(white, black) } } -void ZippyGameEnd(result, resultDetails) - ChessMove result; - char *resultDetails; +void +ZippyGameEnd (ChessMove result, char *resultDetails) { if (appData.zippyAcceptOnly[0] == NULLCHAR && appData.zippyGameEnd[0] != NULLCHAR) { @@ -770,8 +770,8 @@ void ZippyGameEnd(result, resultDetails) * 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; @@ -859,9 +859,8 @@ void ZippyHandleChallenge(srated, swild, sbase, sincrement, opponent) /* Accept matches */ -int ZippyMatch(buf, i) - char *buf; - int *i; +int +ZippyMatch (char *buf, int *i) { if (looking_at(buf, i, "* * match * * requested with * (*)")) { @@ -979,8 +978,8 @@ int ZippyMatch(buf, i) /* 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; @@ -1143,8 +1142,7 @@ void ZippyFirstBoard(moveNum, basetime, increment) 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; -- 1.7.0.4