Skip to content

Commit 70b8d6e

Browse files
Fix init_ fn names
1 parent 519c61e commit 70b8d6e

6 files changed

Lines changed: 57 additions & 60 deletions

File tree

src/cong-common.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535

3636
// libsemigroups_pybind11....
3737
#include "constants.hpp"
38-
#include "main.hpp" // for init_cong_intf
38+
#include "main.hpp" // for init_detail_cong_common
3939

4040
namespace libsemigroups {
4141
namespace py = pybind11;
@@ -1165,7 +1165,7 @@ the congruence represented by an instance of :any:`{name}`.
11651165
// The init function for detail::CongruenceCommon
11661166
////////////////////////////////////////////////////////////////////////
11671167

1168-
void init_cong_intf(py::module& m) {
1168+
void init_detail_cong_common(py::module& m) {
11691169
py::class_<detail::CongruenceCommon, Runner> thing(
11701170
m, "detail::CongruenceCommon");
11711171

@@ -1228,5 +1228,5 @@ This function returns the number of generating pairs of the congruence.
12281228
:rtype:
12291229
int
12301230
)pbdoc");
1231-
} // init_cong_intf
1231+
} // init_detail_cong_common
12321232
} // namespace libsemigroups

src/knuth-bendix-impl.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939

4040
// libsemigroups_pybind11....
4141
#include "cong-common.hpp" // for contains etc
42-
#include "main.hpp" // for init_knuth_bendix_base
42+
#include "main.hpp" // for init_detail_knuth_bendix_impl
4343

4444
// TODO(2): remove unused doc from this file.
4545

@@ -49,7 +49,7 @@ namespace libsemigroups {
4949
namespace detail {
5050

5151
template <typename Rewriter>
52-
void bind_knuth_bendix_base(py::module& m, std::string const& name) {
52+
void bind_detail_knuth_bendix_impl(py::module& m, std::string const& name) {
5353
//////////////////////////////////////////////////////////////////////////
5454
// KnuthBendixImpl class definition . . .
5555
//////////////////////////////////////////////////////////////////////////
@@ -510,10 +510,10 @@ infinite; ``False`` is returned if it is not.
510510
}
511511
} // namespace detail
512512

513-
void init_knuth_bendix_base(py::module& m) {
514-
detail::bind_knuth_bendix_base<detail::RewriteFromLeft>(
513+
void init_detail_knuth_bendix_impl(py::module& m) {
514+
detail::bind_detail_knuth_bendix_impl<detail::RewriteFromLeft>(
515515
m, "KnuthBendixImplRewriteFromLeft");
516-
detail::bind_knuth_bendix_base<detail::RewriteTrie>(
516+
detail::bind_detail_knuth_bendix_impl<detail::RewriteTrie>(
517517
m, "KnuthBendixImplRewriteTrie");
518518
}
519519
} // namespace libsemigroups

src/main.cpp

Lines changed: 38 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,8 @@
1919
#include "main.hpp"
2020

2121
// C std headers....
22-
#include <stddef.h> // for size_t
23-
24-
// C++ stl headers....
25-
#include <initializer_list> // for initializer_list
22+
#include <cstddef> // for size_t
23+
#include <stdexcept>
2624

2725
// libsemigroups....
2826
#include <libsemigroups/config.hpp> // for LIBSEMIGROUPS_EIGEN_ENABLED
@@ -39,11 +37,11 @@
3937
// pybind11....
4038
#include <pybind11/operators.h> // for self, operator<, operator==, self_t
4139
#include <pybind11/pybind11.h> // for module_, class_, enum_, init
42-
#include <stdexcept>
4340

4441
namespace libsemigroups {
4542
namespace py = pybind11;
4643

44+
// TODO move to separate fil
4745
bool ERROR_MESSAGE_WITH_PREFIX = false;
4846

4947
void error_message_with_prefix(bool value) {
@@ -68,6 +66,7 @@ namespace libsemigroups {
6866
}
6967
}
7068

69+
// TODO move to separate fil
7170
// This has its own function so the py::options can be set for just this enum
7271
void init_tril(py::module& m) {
7372
py::options options;
@@ -99,6 +98,7 @@ The valid values are:
9998
}
10099

101100
PYBIND11_MODULE(_libsemigroups_pybind11, m) {
101+
// TODO move to separate file
102102
py::class_<Undefined>(m, "Undefined")
103103
.def("__repr__",
104104
[](Undefined const& val) -> std::string { return "UNDEFINED"; })
@@ -193,64 +193,60 @@ The valid values are:
193193
});
194194

195195
////////////////////////////////////////////////////////////////////////
196-
// Classes
196+
// Classes that need to be initialised early
197197
////////////////////////////////////////////////////////////////////////
198198

199199
init_reporter(m);
200200
init_runner(m);
201-
202-
////////////////////////////////////////////////////////////////////////
203-
// Misc that needs to be initialised early
204-
////////////////////////////////////////////////////////////////////////
205-
206201
init_tril(m);
207202

208203
////////////////////////////////////////////////////////////////////////
209-
// Abstract classes that are required by other classes
204+
// Classes in (almost) alphabetical order
210205
////////////////////////////////////////////////////////////////////////
211206

212-
init_imagerightaction(m);
207+
init_detail_cong_common(m);
208+
init_detail_todd_coxeter_impl(m);
209+
init_detail_knuth_bendix_impl(m);
210+
213211
init_action(m);
214-
init_bmat8(m);
215212
init_aho_corasick(m);
216-
init_blocks(m);
217213
init_bipart(m);
218-
init_PBR(m);
214+
init_blocks(m);
215+
init_bmat8(m);
216+
init_cong(m);
217+
init_dot(m);
219218
init_forest(m);
220219
init_freeband(m);
220+
init_froidure_pin_base(m); // Must be before init_froidure_pin
221+
init_froidure_pin(m);
221222
init_gabow(m);
222-
init_order(m);
223+
init_imagerightaction(m);
224+
init_kambites(m);
225+
init_knuth_bendix(m);
226+
init_konieczny(m);
227+
init_matrix(m);
223228
init_obvinf(m);
229+
init_order(m);
224230
init_paths(m);
231+
init_pbr(m);
225232
init_present(m);
226-
init_inverse_present(m);
227-
init_to_present(m);
228-
init_sims(m);
229-
init_stephen(m);
230-
init_transf(m);
233+
init_inverse_present(m); // Must be after init_present
234+
init_presentation_examples(m);
231235
init_ranges(m);
232-
init_words(m);
233-
init_word_graph(m);
234-
init_dot(m);
235-
init_matrix(m);
236-
init_froidure_pin_base(m);
237-
init_ukkonen(m);
238-
init_froidure_pin(m);
239236
init_schreier_sims(m);
240-
init_cong_intf(m);
241-
init_todd_coxeter_base(m);
242-
init_todd_coxeter(m);
243-
init_kambites(m);
244-
init_knuth_bendix_base(m);
245-
init_knuth_bendix(m);
246-
init_presentation_examples(m);
247-
init_cong(m);
237+
init_sims(m);
238+
init_stephen(m);
239+
init_to_congruence(m);
248240
init_to_froidure_pin(m);
249-
init_to_todd_coxeter(m);
250-
init_to_present(m);
251241
init_to_knuth_bendix(m);
252-
init_to_congruence(m);
253-
init_konieczny(m);
242+
init_to_present(m);
243+
init_to_present(m);
244+
init_to_todd_coxeter(m);
245+
init_todd_coxeter(m);
246+
init_transf(m);
247+
init_ukkonen(m);
248+
init_word_graph(m);
249+
init_words(m);
254250

255251
#ifdef VERSION_INFO
256252
m.attr("__version__") = VERSION_INFO;
@@ -413,7 +409,7 @@ default.
413409

414410
py::class_<LimitMax>(m, "LimitMax")
415411
.def("__repr__",
416-
[](LimitMax const& val) -> std::string { return "<LIMIT_MAX>"; })
412+
[](LimitMax const& val) -> std::string { return "LIMIT_MAX"; })
417413
.def(pybind11::self < LimitMax())
418414
.def(pybind11::self < int())
419415
.def(int() < pybind11::self)

src/main.hpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,16 @@ namespace libsemigroups {
2929

3030
namespace py = pybind11;
3131

32-
void init_PBR(py::module&);
32+
void init_detail_cong_common(py::module&);
33+
void init_detail_knuth_bendix_impl(py::module&);
34+
void init_detail_todd_coxeter_impl(py::module&);
35+
3336
void init_action(py::module&);
3437
void init_aho_corasick(py::module&);
3538
void init_bipart(py::module&);
3639
void init_blocks(py::module&);
3740
void init_bmat8(py::module&);
3841
void init_cong(py::module&);
39-
void init_cong_intf(py::module&);
4042
void init_dot(py::module&);
4143
void init_forest(py::module&);
4244
void init_freeband(py::module&);
@@ -47,28 +49,27 @@ namespace libsemigroups {
4749
void init_inverse_present(py::module&);
4850
void init_kambites(py::module&);
4951
void init_knuth_bendix(py::module&);
50-
void init_knuth_bendix_base(py::module&);
5152
void init_konieczny(py::module&);
5253
void init_matrix(py::module&);
5354
void init_obvinf(py::module&);
5455
void init_order(py::module&);
5556
void init_paths(py::module&);
57+
void init_pbr(py::module&);
5658
void init_present(py::module&);
5759
void init_presentation_examples(py::module&);
5860
void init_ranges(py::module&);
5961
void init_reporter(py::module&);
6062
void init_runner(py::module&);
61-
void init_stephen(py::module&);
6263
void init_schreier_sims(py::module&);
6364
void init_sims(py::module&);
65+
void init_stephen(py::module&);
6466
void init_to_congruence(py::module&);
6567
void init_to_froidure_pin(py::module&);
6668
void init_to_knuth_bendix(py::module&);
6769
void init_to_present(py::module&);
6870
void init_to_present(py::module&);
6971
void init_to_todd_coxeter(py::module&);
7072
void init_todd_coxeter(py::module&);
71-
void init_todd_coxeter_base(py::module&);
7273
void init_transf(py::module&);
7374
void init_ukkonen(py::module&);
7475
void init_word_graph(py::module&);

src/pbr.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@
2626
#include <pybind11/stl.h>
2727

2828
// libsemigroups_pybind11....
29-
#include "main.hpp" // for init_PBR
29+
#include "main.hpp" // for init_pbr
3030

3131
namespace libsemigroups {
3232

3333
namespace py = pybind11;
34-
void init_PBR(py::module& m) {
34+
void init_pbr(py::module& m) {
3535
py::class_<PBR> thing(m,
3636
"PBR",
3737
R"pbdoc(
@@ -271,6 +271,6 @@ value is adjacent to its negative. Equivalently, ``i`` is adjacent
271271
:returns: The identity.
272272
:rtype: PBR
273273
)pbdoc");
274-
} // init_PBR
274+
} // init_pbr
275275

276276
} // namespace libsemigroups

src/todd-coxeter-impl.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,13 @@
3232

3333
// libsemigroups_pybind11....
3434
#include "cong-common.hpp" // for contains
35-
#include "main.hpp" // for init_todd_coxeter_base
35+
#include "main.hpp" // for init_detail_todd_coxeter_impl
3636

3737
namespace libsemigroups {
3838
namespace py = pybind11;
3939
using std::literals::operator""sv;
4040

41-
void init_todd_coxeter_base(py::module& m) {
41+
void init_detail_todd_coxeter_impl(py::module& m) {
4242
using ToddCoxeterImpl_ = detail::ToddCoxeterImpl;
4343
py::class_<ToddCoxeterImpl_, detail::CongruenceCommon> thing(
4444
m, "ToddCoxeterImpl");

0 commit comments

Comments
 (0)