Skip to content

Commit 6ba128b

Browse files
author
Jesper Torp Kristensen
committed
Now the program can actually start (but probably not much more)
1 parent 6abfbfb commit 6ba128b

File tree

6 files changed

+19
-24
lines changed

6 files changed

+19
-24
lines changed

src/Makefile

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
CXX = g++
22

3-
CFLAGS = -O3 -arch x86_64 -Wall -pedantic -ansi -Werror -Wextra -DNDEBUG
4-
CFLAGS_DB = -ggdb3 -pg -Wall -pedantic -ansi -Werror -Wextra
5-
CFLAGS_XB = -O3 -Wall -pedantic -ansi -DNDEBUG -DXBOARD
6-
CFLAGS_DB_XB = -ggdb3 -pg -Wall -pedantic -ansi -DXBOARD
3+
COMMON_FLAGS = -Wall -pedantic -pedantic-errors -ansi -Werror -Wextra -Wcomment -Wformat -Winit-self -Wmissing-include-dirs
4+
CFLAGS = -O3 -arch x86_64 -DNDEBUG $(COMMON_FLAGS)
5+
CFLAGS_DB = -ggdb3 -pg $(COMMON_FLAGS)
6+
CFLAGS_XB = -O3 -DNDEBUG -DXBOARD $(COMMON_FLAGS)
7+
CFLAGS_DB_XB = -ggdb3 -pg -DXBOARD $(COMMON_FLAGS)
78

89
SOURCES = $(wildcard *.cxx) $(wildcard */*.cxx) $(wildcard */*/*.cxx)
910
MODS = $(SOURCES:.cxx=.o)

src/chess.cxx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,9 @@ int main(__attribute__((unused)) int argc, __attribute__((unused)) char* argv[])
4747
cout << "feature sigint=0\n";
4848
cout << "feature sigterm=0\n";
4949
cout << "feature done=1\n";
50-
5150
endgame_settings = new EndgameSettings(&(comm->settings));
52-
5351
search_version = *(comm->settings.get_int_setting("Default_search_function", 1));
5452
evaluation_version = *(comm->settings.get_int_setting("Default_evaluation_function", 1));
55-
5653
cpu = load_cpu(cpu, search_version, evaluation_version, comm);
5754
cpu->new_game();
5855

src/endgames/endgame_settings.cxx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ void EndgameSettings::set_settings(Settings *_settings) {
1919

2020
construction_method = get_int("construction_method");
2121
unreachability_depth_test = get_int("unreachability_depth_test");
22-
2322
directory = get_string("directory");
2423

2524
output_bdd_tables = get_bool("output_bdd_tables");

src/settings.cxx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ char *new_string(int allocated_size = 256) {
1919
return (char *)malloc(allocated_size);
2020
}
2121

22-
2322
SettingValue::SettingValue(string value, string comment) : comment(comment) {
2423
if (value=="true" || value=="false") {
2524
value_type = BoolValue;
@@ -34,7 +33,7 @@ SettingValue::SettingValue(string value, string comment) : comment(comment) {
3433
} else if (strstr(value.c_str(), "false")) {
3534
value_type = BoolValue;
3635
u.bool_value = false;
37-
36+
3837
} else if (value[0]=='\"') {
3938
value_type = StringValue;
4039
u.string_value = new_string();
@@ -162,11 +161,10 @@ int *Settings::get_int_setting(string name, int _default) {
162161
}
163162

164163

165-
char *Settings::get_string_setting(string name, char *_default) {
164+
char *Settings::get_string_setting(string name) {
166165
if (values.count(name)) return values[name]->u.string_value;
167-
cerr << "\nWarning: setting " << name << " not found. Returning "
168-
<< (_default ? _default : "\"\"") << ".\n";
169-
values[name] = new SettingValue(_default, "// default value set");
166+
cerr << "\nWarning: setting " << name << " not found. Returning \"\"." << endl;
167+
values[name] = new SettingValue("\"\"", "// default value set");
170168
return values[name]->u.string_value;
171169
}
172170

src/settings.hxx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ struct SettingValue {
2929
union {
3030
bool bool_value;
3131
int int_value;
32-
char *string_value;
32+
char * string_value;
3333
} u;
3434

3535
string comment;
@@ -54,9 +54,9 @@ public:
5454
void print(ostream &os, string only_with_prefix = "");
5555
void save();
5656

57-
bool *get_bool_setting(string name, bool _default = false);
58-
int *get_int_setting(string name, int _default = 0);
59-
char *get_string_setting(string name, char *_default = 0);
57+
bool *get_bool_setting(string name, bool _default);
58+
int *get_int_setting(string name, int _default);
59+
char *get_string_setting(string name);
6060

6161
void define(string name, string value, string comment="", bool force_new = false);
6262

@@ -96,19 +96,19 @@ protected:
9696
assert(settings);
9797
return settings->get_int_setting(setting_name + name, _default);
9898
}
99-
char *get_string(string name, char *_default = 0) {
99+
char *get_string(string name) {
100100
assert(settings);
101-
return settings->get_string_setting(setting_name + name, _default);
101+
return settings->get_string_setting(setting_name + name);
102102
}
103103

104104
void pbool(ostream &os, string name) {
105105
const string TF[2] = {"false","true"};
106-
os << "\t" << name << " = " << TF[*(settings->get_bool_setting(setting_name + name))] << "\n";
106+
os << "\t" << name << " = " << TF[*(settings->get_bool_setting(setting_name + name, false))] << "\n";
107107
}
108108
void pint(ostream &os, string name) {
109-
os << "\t" << name << " = " << *(settings->get_int_setting(setting_name + name)) << "\n";
109+
os << "\t" << name << " = " << *(settings->get_int_setting(setting_name + name, 0)) << "\n";
110110
}
111-
111+
112112
string setting_name;
113113
Settings *settings;
114114
};

src/test_suite.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,7 @@ class CompareEval {
394394
<< ", fast evaluate = " << cpu->fast_evaluate() << "\n\n";
395395
allowed_diff = abs(l[index]-e);
396396
if (allowed_diff > 10000)
397-
*(comm->settings.get_bool_setting("Eval3_show_evaluation_info")) = true;
397+
*(comm->settings.get_bool_setting("Eval3_show_evaluation_info", false)) = true;
398398
}
399399
}
400400
if (++index == num_positions) load_files = false;

0 commit comments

Comments
 (0)