Skip to content

Commit

Permalink
Move all enum types definitions to types.h
Browse files Browse the repository at this point in the history
Cleanup headers while there.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
  • Loading branch information
mcostalba committed Feb 23, 2011
1 parent 9521222 commit 0fcda09
Show file tree
Hide file tree
Showing 28 changed files with 319 additions and 608 deletions.
16 changes: 1 addition & 15 deletions src/bitbase.cpp
Expand Up @@ -17,20 +17,10 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/


////
//// Includes
////

#include <cassert>

#include "bitboard.h"
#include "square.h"


////
//// Local definitions
////
#include "types.h"

namespace {

Expand Down Expand Up @@ -63,10 +53,6 @@ namespace {
}


////
//// Functions
////

void generate_kpk_bitbase(uint8_t bitbase[]) {

bool repeat;
Expand Down
2 changes: 0 additions & 2 deletions src/bitboard.h
Expand Up @@ -21,8 +21,6 @@
#if !defined(BITBOARD_H_INCLUDED)
#define BITBOARD_H_INCLUDED

#include "piece.h"
#include "square.h"
#include "types.h"

const Bitboard EmptyBoardBB = 0;
Expand Down
1 change: 0 additions & 1 deletion src/bitcount.h
Expand Up @@ -18,7 +18,6 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/


#if !defined(BITCOUNT_H_INCLUDED)
#define BITCOUNT_H_INCLUDED

Expand Down
43 changes: 0 additions & 43 deletions src/depth.h

This file was deleted.

19 changes: 1 addition & 18 deletions src/endgame.h
Expand Up @@ -17,21 +17,11 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/


#if !defined(ENDGAME_H_INCLUDED)
#define ENDGAME_H_INCLUDED

////
//// Includes
////

#include "position.h"
#include "value.h"


////
//// Types
////
#include "types.h"

enum EndgameType {

Expand Down Expand Up @@ -94,11 +84,4 @@ struct ScalingFunction : public EndgameScalingFunctionBase {
ScaleFactor apply(const Position&) const;
};


////
//// Prototypes
////

extern void init_bitbases();

#endif // !defined(ENDGAME_H_INCLUDED)
4 changes: 1 addition & 3 deletions src/evaluate.h
Expand Up @@ -17,12 +17,10 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/


#if !defined(EVALUATE_H_INCLUDED)
#define EVALUATE_H_INCLUDED

#include "piece.h"
#include "value.h"
#include "types.h"

class Position;

Expand Down
7 changes: 1 addition & 6 deletions src/history.h
Expand Up @@ -21,12 +21,7 @@
#define HISTORY_H_INCLUDED

#include <cstring>

#include "depth.h"
#include "piece.h"
#include "square.h"
#include "value.h"

#include "types.h"

/// The History class stores statistics about how often different moves
/// have been successful or unsuccessful during the current search. These
Expand Down
2 changes: 0 additions & 2 deletions src/lock.h
Expand Up @@ -17,11 +17,9 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/


#if !defined(LOCK_H_INCLUDED)
#define LOCK_H_INCLUDED


#if !defined(_MSC_VER)

# include <pthread.h>
Expand Down
15 changes: 1 addition & 14 deletions src/main.cpp
Expand Up @@ -20,23 +20,13 @@
// To profile with callgrind uncomment following line
//#define USE_CALLGRIND


////
//// Includes
////

#include <cstdio>
#include <iostream>
#include <string>

#include "bitboard.h"
#include "bitcount.h"
#include "endgame.h"
#include "evaluate.h"
#include "material.h"
#include "misc.h"
#include "position.h"
#include "search.h"
#include "thread.h"
#include "ucioption.h"

Expand All @@ -48,10 +38,7 @@ using namespace std;

extern bool execute_uci_command(const string& cmd);
extern void benchmark(int argc, char* argv[]);

////
//// Functions
////
extern void init_bitbases();

int main(int argc, char* argv[]) {

Expand Down
17 changes: 2 additions & 15 deletions src/material.h
Expand Up @@ -17,23 +17,13 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/


#if !defined(MATERIAL_H_INCLUDED)
#define MATERIAL_H_INCLUDED

////
//// Includes
////

#include "endgame.h"
#include "position.h"
#include "tt.h"


////
//// Types
////

const int MaterialTableSize = 1024;

/// MaterialInfo is a class which contains various information about a
Expand Down Expand Up @@ -83,11 +73,6 @@ class MaterialInfoTable : public SimpleHash<MaterialInfo, MaterialTableSize> {
};


////
//// Inline functions
////


/// MaterialInfo::material_value simply returns the material balance
/// evaluation that is independent from game phase.

Expand All @@ -96,6 +81,7 @@ inline Score MaterialInfo::material_value() const {
return make_score(value, value);
}


/// MaterialInfo::scale_factor takes a position and a color as input, and
/// returns a scale factor for the given color. We have to provide the
/// position in addition to the color, because the scale factor need not
Expand Down Expand Up @@ -123,6 +109,7 @@ inline int MaterialInfo::space_weight() const {
return spaceWeight;
}


/// MaterialInfo::game_phase() returns the game phase according
/// to this material configuration.

Expand Down
1 change: 0 additions & 1 deletion src/misc.h
Expand Up @@ -21,7 +21,6 @@
#define MISC_H_INCLUDED

#include <string>

#include "types.h"

extern const std::string engine_name();
Expand Down
4 changes: 1 addition & 3 deletions src/move.h
Expand Up @@ -23,9 +23,7 @@
#include <string>

#include "misc.h"
#include "piece.h"
#include "square.h"
#include "value.h"
#include "types.h"

// Maximum number of allowed moves per position
const int MOVES_MAX = 256;
Expand Down
10 changes: 0 additions & 10 deletions src/movegen.cpp
Expand Up @@ -17,16 +17,10 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/


////
//// Includes
////

#include <cassert>

#include "bitcount.h"
#include "movegen.h"
#include "types.h"

// Simple macro to wrap a very common while loop, no facny, no flexibility,
// hardcoded list name 'mlist' and from square 'from'.
Expand All @@ -35,10 +29,6 @@
// Version used for pawns, where the 'from' square is given as a delta from the 'to' square
#define SERIALIZE_MOVES_D(b, d) while (b) { to = pop_1st_bit(&b); (*mlist++).move = make_move(to + (d), to); }

////
//// Local definitions
////

namespace {

enum CastlingSide {
Expand Down
1 change: 0 additions & 1 deletion src/movegen.h
Expand Up @@ -17,7 +17,6 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/


#if !defined(MOVEGEN_H_INCLUDED)
#define MOVEGEN_H_INCLUDED

Expand Down
2 changes: 1 addition & 1 deletion src/movepick.cpp
Expand Up @@ -24,7 +24,7 @@
#include "movegen.h"
#include "movepick.h"
#include "search.h"
#include "value.h"
#include "types.h"

namespace {

Expand Down
2 changes: 1 addition & 1 deletion src/movepick.h
Expand Up @@ -20,9 +20,9 @@
#if !defined MOVEPICK_H_INCLUDED
#define MOVEPICK_H_INCLUDED

#include "depth.h"
#include "history.h"
#include "position.h"
#include "types.h"

struct SearchStack;

Expand Down
17 changes: 1 addition & 16 deletions src/pawns.h
Expand Up @@ -17,23 +17,13 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/


#if !defined(PAWNS_H_INCLUDED)
#define PAWNS_H_INCLUDED

////
//// Includes
////

#include "bitboard.h"
#include "position.h"
#include "tt.h"
#include "value.h"


////
//// Types
////
#include "types.h"

const int PawnTableSize = 16384;

Expand Down Expand Up @@ -88,11 +78,6 @@ class PawnInfoTable : public SimpleHash<PawnInfo, PawnTableSize> {
Score evaluate_pawns(const Position& pos, Bitboard ourPawns, Bitboard theirPawns, PawnInfo* pi) const;
};


////
//// Inline functions
////

inline Square pawn_push(Color c) {
return c == WHITE ? DELTA_N : DELTA_S;
}
Expand Down

0 comments on commit 0fcda09

Please sign in to comment.