From 4bfad947161d93ce1b566093211bd05f368bdffe Mon Sep 17 00:00:00 2001 From: Arun Persaud Date: Mon, 28 May 2012 13:01:15 -0700 Subject: [PATCH] fix bug #36228: reserved identifier violation variables and macro names beginning with _ are renamed to XB_. More consistent naming of include guards. See link in bug report. --- backend.h | 18 ++++++++---------- backendz.h | 6 +++--- common.h | 40 ++++++++++++++++++++-------------------- frontend.h | 6 +++--- gettext.h | 6 +++--- lists.h | 16 ++++++++-------- xedittags.h | 4 ++-- xevalgraph.h | 4 ++-- xgamelist.h | 6 +++--- xhistory.h | 7 +++---- zippy.h | 4 ++-- 11 files changed, 57 insertions(+), 60 deletions(-) diff --git a/backend.h b/backend.h index c6c7d41..25fbf71 100644 --- a/backend.h +++ b/backend.h @@ -51,8 +51,8 @@ *------------------------------------------------------------------------ ** See the file ChangeLog for a revision history. */ -#ifndef _BACKEND -#define _BACKEND +#ifndef XB_BACKEND +#define XB_BACKEND /* unsigned int 64 for engine nodes work and display */ #ifdef WIN32 @@ -270,8 +270,6 @@ extern GameInfo gameInfo; #define ICS_CHESSNET 3 /* not really supported */ int ics_type; - - /* pgntags.c prototypes */ char *PGNTags P((GameInfo *)); @@ -284,7 +282,7 @@ char *PGNResult P((ChessMove result)); */ /* A game node in the double linked list of games. */ -typedef struct _ListGame { +typedef struct XB_ListGame { ListNode node; int number; int position; @@ -292,7 +290,7 @@ typedef struct _ListGame { unsigned long offset; /* Byte offset of game within file. */ GameInfo gameInfo; /* Note that some entries may be NULL. */ } ListGame; - + extern int storedGames; extern int opponentKibitzes; extern ChessSquare gatingPiece; @@ -323,7 +321,7 @@ int Explode P((Board board, int fromX, int fromY, int toX, int toY)); typedef enum { CheckBox, ComboBox, TextBox, Button, Spin, ResetButton, SaveButton, ListBox, Graph, PopUp, FileName, PathName, Slider, Message, Fractional, Label, BoxBegin, BoxEnd, DropDown, Break, EndMark } Control; -typedef struct _OPT { // [HGM] options: descriptor of UCI-style option +typedef struct XB_OPT { // [HGM] options: descriptor of UCI-style option int value; // current setting, starts as default int min; // Also used for flags int max; @@ -335,7 +333,7 @@ typedef struct _OPT { // [HGM] options: descriptor of UCI-style option char *name; // holds both option name and text value (in allocated memory) } Option; -typedef struct _CPS { +typedef struct XB_CPS { char *which; int maybeThinking; ProcRef pr; @@ -344,7 +342,7 @@ typedef struct _CPS { char *program; char *host; char *dir; - struct _CPS *other; + struct XB_CPS *other; char *initString; char *computerString; int sendTime; /* 0=don't, 1=do, 2=test */ @@ -451,4 +449,4 @@ typedef struct { void GetTimeMark P((TimeMark *)); long SubtractTimeMarks P((TimeMark *, TimeMark *)); -#endif /* _BACKEND */ +#endif /* XB_BACKEND */ diff --git a/backendz.h b/backendz.h index 8f6f5f7..425017d 100644 --- a/backendz.h +++ b/backendz.h @@ -2,7 +2,7 @@ * backendz.h -- Internal interface exported by XBoard backend.c to zippy.c * * Copyright 1991 by Digital Equipment Corporation, Maynard, - * Massachusetts. + * Massachusetts. * * Enhancements Copyright 1992-2001, 2002, 2003, 2004, 2005, 2006, * 2007, 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc. @@ -51,8 +51,8 @@ *------------------------------------------------------------------------ ** See the file ChangeLog for a revision history. */ -#ifndef _BACKENDZ -#define _BACKENDZ +#ifndef XB_BACKENDZ +#define XB_BACKENDZ #include "common.h" #include "frontend.h" diff --git a/common.h b/common.h index c657ef7..05c1180 100644 --- a/common.h +++ b/common.h @@ -2,7 +2,7 @@ * common.h -- Common definitions for X and Windows NT versions of XBoard * * Copyright 1991 by Digital Equipment Corporation, Maynard, - * Massachusetts. + * Massachusetts. * * Enhancements Copyright 1992-2001, 2002, 2003, 2004, 2005, 2006, * 2007, 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc. @@ -51,8 +51,8 @@ *------------------------------------------------------------------------ ** See the file ChangeLog for a revision history. */ -#ifndef _COMMON -#define _COMMON +#ifndef XB_COMMON +#define XB_COMMON /* Begin compatibility grunge */ @@ -128,7 +128,7 @@ int pclose(FILE *); #define BOARD_RANKS 11 /* [HGM] for in declarations */ #define BOARD_FILES 16 /* [HGM] for in declarations */ #define BOARD_HEIGHT (gameInfo.boardHeight) /* [HGM] made user adjustable */ -#define BOARD_WIDTH (gameInfo.boardWidth + 2*gameInfo.holdingsWidth) +#define BOARD_WIDTH (gameInfo.boardWidth + 2*gameInfo.holdingsWidth) #define BOARD_LEFT (gameInfo.holdingsWidth) /* [HGM] play-board edges */ #define BOARD_RGHT (gameInfo.boardWidth + gameInfo.holdingsWidth) #define CASTLING (BOARD_RANKS-1) /* [HGM] hide in upper rank */ @@ -230,15 +230,15 @@ typedef enum { /* [HGM] the order here is crucial for Crazyhouse & Shogi: */ /* only the first N pieces can go into the holdings, and */ /* promotions in those variants shift P-W to U-S */ - WhitePawn, WhiteKnight, WhiteBishop, WhiteRook, WhiteQueen, - WhiteFerz, WhiteAlfil, WhiteAngel, WhiteMarshall, WhiteWazir, WhiteMan, + WhitePawn, WhiteKnight, WhiteBishop, WhiteRook, WhiteQueen, + WhiteFerz, WhiteAlfil, WhiteAngel, WhiteMarshall, WhiteWazir, WhiteMan, WhiteCannon, WhiteNightrider, WhiteCardinal, WhiteDragon, WhiteGrasshopper, WhiteSilver, WhiteFalcon, WhiteLance, WhiteCobra, WhiteUnicorn, WhiteKing, BlackPawn, BlackKnight, BlackBishop, BlackRook, BlackQueen, - BlackFerz, BlackAlfil, BlackAngel, BlackMarshall, BlackWazir, BlackMan, + BlackFerz, BlackAlfil, BlackAngel, BlackMarshall, BlackWazir, BlackMan, BlackCannon, BlackNightrider, BlackCardinal, BlackDragon, BlackGrasshopper, BlackSilver, BlackFalcon, BlackLance, BlackCobra, BlackUnicorn, BlackKing, - EmptySquare, + EmptySquare, NoRights, // [HGM] gamestate: for castling rights hidden in board[CASTLING] ClearBoard, WhitePlay, BlackPlay, PromotePiece, DemotePiece /*for use on EditPosition menus*/ } ChessSquare; @@ -257,14 +257,14 @@ typedef enum { EndOfFile = 0, WhiteKingSideCastle, WhiteQueenSideCastle, WhiteKingSideCastleWild, WhiteQueenSideCastleWild, - WhiteHSideCastleFR, WhiteASideCastleFR, + WhiteHSideCastleFR, WhiteASideCastleFR, BlackKingSideCastle, BlackQueenSideCastle, BlackKingSideCastleWild, BlackQueenSideCastleWild, - BlackHSideCastleFR, BlackASideCastleFR, + BlackHSideCastleFR, BlackASideCastleFR, WhitePromotion, WhiteNonPromotion, BlackPromotion, BlackNonPromotion, WhiteCapturesEnPassant, BlackCapturesEnPassant, - WhiteDrop, BlackDrop, + WhiteDrop, BlackDrop, NormalMove, AmbiguousMove, IllegalMove, ImpossibleMove, WhiteWins, BlackWins, GameIsDrawn, GameUnfinished, GNUChessGame, XBoardGame, MoveNumberOne, Open, Close, Nothing, @@ -313,7 +313,7 @@ typedef enum { VariantGothic, VariantCapablanca, VariantKnightmate, - VariantFairy, + VariantFairy, VariantCylinder, VariantFalcon, VariantCapaRandom, @@ -518,12 +518,12 @@ typedef struct { Boolean highlightLastMove; Boolean highlightDragging; Boolean blindfold; /* if true, no pieces are drawn */ - Boolean premove; /* true if premove feature enabled */ - Boolean premoveWhite; /* true if premoving White first move */ - char *premoveWhiteText; /* text of White premove 1 */ - Boolean premoveBlack; /* true if premoving Black first move */ - char *premoveBlackText; /* text of Black premove 1 */ - Boolean icsAlarm; /* true if sounding alarm at a certain time */ + Boolean premove; /* true if premove feature enabled */ + Boolean premoveWhite; /* true if premoving White first move */ + char *premoveWhiteText; /* text of White premove 1 */ + Boolean premoveBlack; /* true if premoving Black first move */ + char *premoveBlackText; /* text of Black premove 1 */ + Boolean icsAlarm; /* true if sounding alarm at a certain time */ int icsAlarmTime; /* time to sound alarm, in milliseconds */ Boolean autoRaiseBoard; int fontSizeTolerance; /* xboard only */ @@ -532,7 +532,7 @@ typedef struct { char *chatBoxes; int protocolVersion[ENGINES]; Boolean showButtonBar; - Boolean icsEngineAnalyze; + Boolean icsEngineAnalyze; Boolean variations; /* [HGM] enable variation-tree walking */ /* [AS] New properties (down to the "ZIPPY" part) */ @@ -770,7 +770,7 @@ extern WindowPlacement wpTags; #define MAXENGINES 2000 -// [HGM] chat +// [HGM] chat #define MAX_CHAT 5 extern int chatCount; extern char chatPartner[MAX_CHAT][MSG_SIZ]; diff --git a/frontend.h b/frontend.h index 3f239a1..e2b7b60 100644 --- a/frontend.h +++ b/frontend.h @@ -51,8 +51,8 @@ *------------------------------------------------------------------------ ** See the file ChangeLog for a revision history. */ -#ifndef _FRONTEND -#define _FRONTEND +#ifndef XB_FRONTEND +#define XB_FRONTEND #include @@ -247,4 +247,4 @@ void SlavePopUp P((void)); Boolean MoveHistoryIsUp P((void)); void HistoryPopUp P((void)); -#endif +#endif /* XB_FRONTEND */ diff --git a/gettext.h b/gettext.h index fa47899..2b11fca 100644 --- a/gettext.h +++ b/gettext.h @@ -16,8 +16,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef _LIBGETTEXT_H -#define _LIBGETTEXT_H 1 +#ifndef XB_GETTEXT +#define XB_GETTEXT /* NLS can be disabled through the configure --disable-nls option. */ #if ENABLE_NLS @@ -277,4 +277,4 @@ dcnpgettext_expr (const char *domain, return (n == 1 ? msgid : msgid_plural); } -#endif /* _LIBGETTEXT_H */ +#endif /* XB_GETTEXT */ diff --git a/lists.h b/lists.h index 6520875..eae6ce9 100644 --- a/lists.h +++ b/lists.h @@ -28,15 +28,15 @@ * way. */ -#ifndef _LISTS_H -#define _LISTS_H +#ifndef XB_LISTS +#define XB_LISTS /* Type definition: Node of a double linked list. */ -typedef struct _ListNode { - struct _ListNode *succ; - struct _ListNode *pred; +typedef struct XB_ListNode { + struct XB_ListNode *succ; + struct XB_ListNode *pred; } ListNode; @@ -47,9 +47,9 @@ typedef struct _ListNode { * if and only if it consists of 2 nodes. :-) */ typedef struct { - struct _ListNode *head; /* The list structure consists of two */ - struct _ListNode *tail; /* ListNode's: The pred entry of the */ - struct _ListNode *tailPred; /* head being the succ entry of the */ + struct XB_ListNode *head; /* The list structure consists of two */ + struct XB_ListNode *tail; /* ListNode's: The pred entry of the */ + struct XB_ListNode *tailPred; /* head being the succ entry of the */ } List; /* tail. */ diff --git a/xedittags.h b/xedittags.h index 75e4416..6245bfd 100644 --- a/xedittags.h +++ b/xedittags.h @@ -21,8 +21,8 @@ *------------------------------------------------------------------------ ** See the file ChangeLog for a revision history. */ -#ifndef _XEDITTAGS_H -#define _XEDITTAGS_H 1 +#ifndef XB_XEDITTAGS +#define XB_XEDITTAGS void EditTagsProc P((void)); diff --git a/xevalgraph.h b/xevalgraph.h index fd3d6be..e65f8f5 100644 --- a/xevalgraph.h +++ b/xevalgraph.h @@ -21,8 +21,8 @@ *------------------------------------------------------------------------ ** See the file ChangeLog for a revision history. */ -#ifndef _XEVALGRAPH_H -#define _XEVALGRAPH_H 1 +#ifndef XB_XEVALGRAPH +#define XB_XEVALGRAPH void EvalGraphSet P(( int first, int last, int current, ChessProgramStats_Move * pvInfo )); diff --git a/xgamelist.h b/xgamelist.h index 9cacc61..fa7b41a 100644 --- a/xgamelist.h +++ b/xgamelist.h @@ -20,12 +20,12 @@ *------------------------------------------------------------------------ ** See the file ChangeLog for a revision history. */ -#ifndef _XGAMEL_H -#define _XGAMEL_H 1 +#ifndef XB_XGAMELIST +#define XB_XGAMELIST void LoadSelectedProc P((Widget w, XEvent *event, String *prms, Cardinal *nprms)); void SetFilterProc P((Widget w, XEvent *event, String *prms, Cardinal *nprms)); -#endif /* _XGAMEL_H */ +#endif /* XB_XGAMELIST */ diff --git a/xhistory.h b/xhistory.h index 80e748d..90f0c9b 100644 --- a/xhistory.h +++ b/xhistory.h @@ -20,11 +20,10 @@ *------------------------------------------------------------------------ ** See the file ChangeLog for a revision history. */ -#ifndef _XHISTL_H -#define _XHISTL_H 1 +#ifndef XB_XHISTLIST +#define XB_XHISTLIST void HistoryShowProc P((void)); Boolean MoveHistoryIsUp P((void)); -#endif /* _XHISTL_H */ - +#endif /* XB_XHISTLIST */ diff --git a/zippy.h b/zippy.h index 5f0233b..84cff26 100644 --- a/zippy.h +++ b/zippy.h @@ -2,8 +2,8 @@ * zippy.h -- Interface to zippy.c module in XBoard * * Copyright 1991 by Digital Equipment Corporation, Maynard, - * Massachusetts. - * + * Massachusetts. + * * Enhancements Copyright 1992-2001, 2002, 2003, 2004, 2005, 2006, * 2007, 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc. * -- 1.7.0.4