@@ -45,39 +45,38 @@ inline namespace kernel
45
45
46
46
const dispatcher<std::string> long_options, long_options_with_arguments;
47
47
48
- protected:
49
- let batch = f;
50
- let debug = f;
51
- let interactive = f;
52
- let trace = f;
53
- let verbose = f;
54
-
55
48
public:
49
+ bool batch = false ;
50
+ bool debug = false ;
51
+ bool interactive = false ;
52
+ bool trace = false ;
53
+ bool verbose = false ;
54
+
56
55
explicit configurator ()
57
56
: short_options
58
57
{
59
58
std::make_pair (' b' , [this ](auto &&...)
60
59
{
61
- return batch = t ;
60
+ return make< bool >( batch = true ) ;
62
61
}),
63
62
64
63
std::make_pair (' d' , [this ](auto &&...)
65
64
{
66
- return debug = t ;
65
+ return make< bool >( debug = true ) ;
67
66
}),
68
67
69
- std::make_pair (' h' , [this ](auto &&...) -> object
68
+ std::make_pair (' h' , [this ](auto &&...) -> lvalue
70
69
{
71
70
display_help ();
72
71
throw exit_status::success;
73
72
}),
74
73
75
74
std::make_pair (' i' , [this ](auto &&...)
76
75
{
77
- return interactive = t ;
76
+ return make< bool >( interactive = true ) ;
78
77
}),
79
78
80
- std::make_pair (' v' , [this ](auto &&...) -> object
79
+ std::make_pair (' v' , [this ](auto &&...) -> lvalue
81
80
{
82
81
display_version ();
83
82
throw exit_status::success;
@@ -93,7 +92,7 @@ inline namespace kernel
93
92
94
93
std::make_pair (' l' , [this ](const_reference x, auto &&...)
95
94
{
96
- return load (x.as <string>());
95
+ return load (x.as_const <string>());
97
96
}),
98
97
99
98
std::make_pair (' w' , [this ](const_reference x, auto &&...)
@@ -106,36 +105,36 @@ inline namespace kernel
106
105
{
107
106
std::make_pair (" batch" , [this ](auto &&...)
108
107
{
109
- return batch = t ;
108
+ return make< bool >( batch = true ) ;
110
109
}),
111
110
112
111
std::make_pair (" debug" , [this ](auto &&...)
113
112
{
114
- return debug = t ;
113
+ return make< bool >( debug = true ) ;
115
114
}),
116
115
117
- std::make_pair (" help" , [this ](auto &&...) -> object
116
+ std::make_pair (" help" , [this ](auto &&...) -> lvalue
118
117
{
119
118
display_help ();
120
119
throw exit_status::success;
121
120
}),
122
121
123
122
std::make_pair (" interactive" , [this ](auto &&...)
124
123
{
125
- return interactive = t ;
124
+ return make< bool >( interactive = true ) ;
126
125
}),
127
126
128
127
std::make_pair (" trace" , [this ](auto &&...)
129
128
{
130
- return trace = t ;
129
+ return make< bool >( trace = true ) ;
131
130
}),
132
131
133
132
std::make_pair (" verbose" , [this ](auto &&...)
134
133
{
135
- return verbose = t ;
134
+ return make< bool >( verbose = true ) ;
136
135
}),
137
136
138
- std::make_pair (" version" , [this ](auto &&...) -> object
137
+ std::make_pair (" version" , [this ](auto &&...) -> lvalue
139
138
{
140
139
display_version ();
141
140
throw exit_status::success;
@@ -151,7 +150,7 @@ inline namespace kernel
151
150
152
151
std::make_pair (" load" , [this ](const_reference x, auto &&...)
153
152
{
154
- return load (x.as <string>());
153
+ return load (x.as_const <string>());
155
154
}),
156
155
157
156
std::make_pair (" write" , [this ](const_reference x, auto &&...)
@@ -172,22 +171,19 @@ inline namespace kernel
172
171
173
172
if (std::empty (args))
174
173
{
175
- interactive = t ;
174
+ interactive = true ;
176
175
}
177
176
else for (auto current_option = std::begin (args); current_option != std::end (args); ++current_option) [&]()
178
177
{
179
178
std::smatch analysis {};
180
179
181
180
std::regex_match (*current_option, analysis, pattern);
182
181
183
- if (is_debug_mode ())
184
- {
185
- std::cout << header (" configure" ) << " analysis[0] = " << analysis[0 ] << std::endl;
186
- std::cout << header (" " ) << " analysis[1] = " << analysis[1 ] << std::endl;
187
- std::cout << header (" " ) << " analysis[2] = " << analysis[2 ] << std::endl;
188
- std::cout << header (" " ) << " analysis[3] = " << analysis[3 ] << std::endl;
189
- std::cout << header (" " ) << " analysis[4] = " << analysis[4 ] << std::endl;
190
- }
182
+ // std::cout << header("configure") << "analysis[0] = " << analysis[0] << std::endl;
183
+ // std::cout << header("") << "analysis[1] = " << analysis[1] << std::endl;
184
+ // std::cout << header("") << "analysis[2] = " << analysis[2] << std::endl;
185
+ // std::cout << header("") << "analysis[3] = " << analysis[3] << std::endl;
186
+ // std::cout << header("") << "analysis[4] = " << analysis[4] << std::endl;
191
187
192
188
if (auto const current_short_options = analysis.str (4 ); not current_short_options.empty ())
193
189
{
@@ -276,21 +272,6 @@ inline namespace kernel
276
272
print (" --verbose Display detailed informations." );
277
273
print (" -w, --write=OBJECT Same as -e '(write OBJECT)'" );
278
274
}
279
-
280
- #define BOILERPLATE (NAME ) \
281
- auto is_##NAME##_mode() const -> bool \
282
- { \
283
- return select (NAME); \
284
- } \
285
- static_assert (true )
286
-
287
- BOILERPLATE (batch);
288
- BOILERPLATE (debug);
289
- BOILERPLATE (interactive);
290
- BOILERPLATE (trace);
291
- BOILERPLATE (verbose);
292
-
293
- #undef BOILERPLATE
294
275
};
295
276
} // namespace kernel
296
277
} // namespace meevax
0 commit comments