Skip to content

Commit 9591cd4

Browse files
committed
Rationalise organisation of core directory
Improve organisation of code in core/: * Remove header dependency on game classes * Update file paths in copyright notice * Update #include guards to match file paths
1 parent 70690db commit 9591cd4

24 files changed

Lines changed: 244 additions & 185 deletions

Makefile.am

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,8 @@ EXTRA_DIST = \
245245
src/README.rst
246246

247247
core_SOURCES = \
248+
src/core/core.h \
249+
src/core/util.h \
248250
src/core/array.h \
249251
src/core/list.h \
250252
src/core/vector.h \

src/core/array.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// This file is part of Gambit
33
// Copyright (c) 1994-2025, The Gambit Project (https://www.gambit-project.org)
44
//
5-
// FILE: src/libgambit/array.h
5+
// FILE: src/core/array.h
66
// A basic bounds-checked array type
77
//
88
// This program is free software; you can redistribute it and/or modify
@@ -20,12 +20,14 @@
2020
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
2121
//
2222

23-
#ifndef LIBGAMBIT_ARRAY_H
24-
#define LIBGAMBIT_ARRAY_H
23+
#ifndef GAMBIT_CORE_ARRAY_H
24+
#define GAMBIT_CORE_ARRAY_H
2525

2626
#include <vector>
2727
#include <iterator>
2828

29+
#include "util.h"
30+
2931
namespace Gambit {
3032

3133
/// \brief An extension of std::vector to have arbitrary offset index
@@ -282,4 +284,4 @@ template <class T> void erase_atindex(Array<T> &p_array, int p_index)
282284

283285
} // end namespace Gambit
284286

285-
#endif // LIBGAMBIT_ARRAY_H
287+
#endif // GAMBIT_CORE_ARRAY_H

src/core/core.h

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
//
2+
// This file is part of Gambit
3+
// Copyright (c) 1994-2025, The Gambit Project (https://www.gambit-project.org)
4+
//
5+
// FILE: src/core/core.h
6+
// Core (game theory-independent) declarations and utilities for Gambit
7+
//
8+
// This program is free software; you can redistribute it and/or modify
9+
// it under the terms of the GNU General Public License as published by
10+
// the Free Software Foundation; either version 2 of the License, or
11+
// (at your option) any later version.
12+
//
13+
// This program is distributed in the hope that it will be useful,
14+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
15+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16+
// GNU General Public License for more details.
17+
//
18+
// You should have received a copy of the GNU General Public License
19+
// along with this program; if not, write to the Free Software
20+
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21+
//
22+
23+
#ifndef GAMBIT_CORE_CORE_H
24+
#define GAMBIT_CORE_CORE_H
25+
26+
#include "util.h"
27+
#include "array.h"
28+
#include "list.h"
29+
#include "recarray.h"
30+
#include "vector.h"
31+
#include "matrix.h"
32+
#include "rational.h"
33+
34+
#endif // GAMBIT_CORE_CORE_H

src/core/function.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// This file is part of Gambit
33
// Copyright (c) 1994-2025, The Gambit Project (https://www.gambit-project.org)
44
//
5-
// FILE: src/libgambit/function.cc
5+
// FILE: src/core/function.cc
66
// Implementation of function and function minimization routines
77
//
88
// These routines derive from the N-dimensional function minimization
@@ -28,7 +28,7 @@
2828
//
2929

3030
#include <cmath>
31-
#include "gambit.h"
31+
3232
#include "function.h"
3333

3434
using namespace Gambit;

src/core/function.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// This file is part of Gambit
33
// Copyright (c) 1994-2025, The Gambit Project (https://www.gambit-project.org)
44
//
5-
// FILE: src/libgambit/function.h
5+
// FILE: src/core/function.h
66
// Interface to function and function minimization routines
77
//
88
// This program is free software; you can redistribute it and/or modify
@@ -20,10 +20,10 @@
2020
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
2121
//
2222

23-
#ifndef LIBGAMBIT_FUNCTION_H
24-
#define LIBGAMBIT_FUNCTION_H
23+
#ifndef GAMBIT_CORE_FUNCTION_H
24+
#define GAMBIT_CORE_FUNCTION_H
2525

26-
#include "core/vector.h"
26+
#include "vector.h"
2727

2828
namespace Gambit {
2929

@@ -106,4 +106,4 @@ class ConjugatePRMinimizer : public FunctionMinimizer {
106106

107107
} // end namespace Gambit
108108

109-
#endif // LIBGAMBIT_FUNCTION_H
109+
#endif // GAMBIT_CORE_FUNCTION_H

src/core/integer.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// This file is part of Gambit
33
// Copyright (c) 1994-2025, The Gambit Project (https://www.gambit-project.org)
44
//
5-
// FILE: src/libgambit/integer.cc
5+
// FILE: src/core/integer.cc
66
// Implementation of an arbitrary-length integer class
77
//
88
// The original copyright and license are included below.
@@ -35,14 +35,14 @@ Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
3535
*/
3636

3737
#include <iostream>
38-
39-
#include "integer.h"
4038
#include <cctype>
4139
#include <cfloat>
4240
#include <climits>
4341
#include <cmath>
4442
#include <cstring>
45-
#include "gambit.h"
43+
44+
#include "integer.h"
45+
#include "util.h"
4646

4747
namespace Gambit {
4848

src/core/integer.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// This file is part of Gambit
33
// Copyright (c) 1994-2025, The Gambit Project (https://www.gambit-project.org)
44
//
5-
// FILE: src/libgambit/integer.h
5+
// FILE: src/core/integer.h
66
// Interface to an arbitrary-length integer class
77
//
88
// The original copyright and license are included below.
@@ -25,8 +25,8 @@ License along with this library; if not, write to the Free Software
2525
Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
2626
*/
2727

28-
#ifndef LIBGAMBIT_INTEGER_H
29-
#define LIBGAMBIT_INTEGER_H
28+
#ifndef GAMBIT_CORE_INTEGER_H
29+
#define GAMBIT_CORE_INTEGER_H
3030

3131
#include <string>
3232

@@ -249,4 +249,4 @@ extern Integer lcm(const Integer &x, const Integer &y); // least common mult
249249

250250
} // end namespace Gambit
251251

252-
#endif // LIBGAMBIT_INTEGER_H
252+
#endif // GAMBIT_CORE_INTEGER_H

src/core/list.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// This file is part of Gambit
33
// Copyright (c) 1994-2025, The Gambit Project (https://www.gambit-project.org)
44
//
5-
// FILE: src/libgambit/list.h
5+
// FILE: src/core/list.h
66
// A generic linked-list container class
77
//
88
// This program is free software; you can redistribute it and/or modify
@@ -20,8 +20,8 @@
2020
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
2121
//
2222

23-
#ifndef LIBGAMBIT_LIST_H
24-
#define LIBGAMBIT_LIST_H
23+
#ifndef GAMBIT_CORE_LIST_H
24+
#define GAMBIT_CORE_LIST_H
2525

2626
#include <list>
2727

@@ -129,4 +129,4 @@ template <class T> class List {
129129

130130
} // namespace Gambit
131131

132-
#endif // LIBGAMBIT_LIST_H
132+
#endif // GAMBIT_CORE_LIST_H

src/core/matrix.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// This file is part of Gambit
33
// Copyright (c) 1994-2025, The Gambit Project (https://www.gambit-project.org)
44
//
5-
// FILE: src/libgambit/matrix.cc
5+
// FILE: src/core/matrix.cc
66
// Instantiation of common matrix types
77
//
88
// This program is free software; you can redistribute it and/or modify
@@ -20,7 +20,7 @@
2020
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
2121
//
2222

23-
#include "gambit.h"
23+
#include "core.h"
2424
#include "matrix.imp"
2525

2626
namespace Gambit {

src/core/matrix.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// This file is part of Gambit
33
// Copyright (c) 1994-2025, The Gambit Project (https://www.gambit-project.org)
44
//
5-
// FILE: src/libgambit/matrix.h
5+
// FILE: src/core/matrix.h
66
// Interface to a matrix class
77
//
88
// This program is free software; you can redistribute it and/or modify
@@ -20,8 +20,8 @@
2020
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
2121
//
2222

23-
#ifndef LIBGAMBIT_MATRIX_H
24-
#define LIBGAMBIT_MATRIX_H
23+
#ifndef GAMBIT_CORE_MATRIX_H
24+
#define GAMBIT_CORE_MATRIX_H
2525

2626
#include "recarray.h"
2727
#include "vector.h"
@@ -99,4 +99,4 @@ template <class T> Vector<T> operator*(const Vector<T> &, const Matrix<T> &);
9999

100100
} // end namespace Gambit
101101

102-
#endif // LIBGAMBIT_MATRIX_H
102+
#endif // GAMBIT_CORE_MATRIX_H

0 commit comments

Comments
 (0)