Skip to content

Commit 215c45e

Browse files
authored
Merge pull request #394 from yamacir-kit/cleanup
Cleanup
2 parents d0f170f + b25aab2 commit 215c45e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+1486
-996
lines changed

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,9 @@ sudo rm -rf /usr/local/share/meevax
103103

104104
| Target Name | Description
105105
|:-------------------|:--
106-
| `all` (default) | Build shared-library `libmeevax.0.4.0.so` and executable `meevax`.
106+
| `all` (default) | Build shared-library `libmeevax.0.4.40.so` and executable `meevax`.
107107
| `test` | Test executable `meevax`.
108-
| `package` | Generate debian package `meevax_0.4.0_amd64.deb`.
108+
| `package` | Generate debian package `meevax_0.4.40_amd64.deb`.
109109
| `install` | Copy files into `/usr/local` __(1)__.
110110
| `install.deb` | `all` + `package` + `sudo apt install <meevax>.deb`
111111
| `safe-install.deb` | `all` + `test` + `package` + `sudo apt install <meevax>.deb`
@@ -120,7 +120,7 @@ __(1)__ Meevax installed by `make install` cannot be uninstalled by the system's
120120
## Usage
121121

122122
```
123-
Meevax Lisp System, version 0.4.0
123+
Meevax Lisp System, version 0.4.40
124124
125125
Usage: meevax [OPTION...] [FILE...]
126126

VERSION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.4.0
1+
0.4.40

basis/srfi-34.ss

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
; IN THE SOFTWARE.
2020

2121
(define-library (srfi 34)
22-
(import (only (meevax exception) default-exception-handler)
22+
(import (only (meevax exception) throw)
2323
(scheme r5rs)
2424
)
2525

@@ -29,7 +29,7 @@
2929
guard
3030
)
3131

32-
(begin (define %current-exception-handlers (list default-exception-handler))
32+
(begin (define %current-exception-handlers (list throw))
3333

3434
(define (%with-exception-handlers new-handlers thunk)
3535
(let ((old-handlers %current-exception-handlers))

benchmark/ack.ss

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
(import (scheme r5rs)
2+
(scheme process-context))
3+
14
(define (ack m n)
25
(cond ((= m 0) (+ n 1))
36
((= n 0) (ack (- m 1) 1))

benchmark/tarai.ss

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
(import (scheme r5rs)
2+
(scheme process-context))
3+
14
(define (tarai x y z)
25
(if (not (< y x)) y
36
(tarai (tarai (- x 1) y z)

include/meevax/kernel/complex.hpp

+7-7
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ inline namespace kernel
3838
auto imag() noexcept -> reference;
3939

4040
#define DEFINE(NAME) \
41-
auto NAME() const -> object override \
41+
auto NAME() const -> lvalue override \
4242
{ \
4343
return unspecified_object; \
4444
} \
@@ -55,7 +55,7 @@ inline namespace kernel
5555
#undef DEFINE
5656

5757
#define DEFINE(NAME) \
58-
auto NAME(const_reference) const -> object override \
58+
auto NAME(const_reference) const -> lvalue override \
5959
{ \
6060
return unspecified_object; \
6161
} \
@@ -66,11 +66,11 @@ inline namespace kernel
6666

6767
#undef DEFINE
6868

69-
auto operator + (const_reference) const -> object override { return unspecified_object; }
70-
auto operator - (const_reference) const -> object override { return unspecified_object; }
71-
auto operator * (const_reference) const -> object override { return unspecified_object; }
72-
auto operator / (const_reference) const -> object override { return unspecified_object; }
73-
auto operator % (const_reference) const -> object override { return unspecified_object; }
69+
auto operator + (const_reference) const -> lvalue override { return unspecified_object; }
70+
auto operator - (const_reference) const -> lvalue override { return unspecified_object; }
71+
auto operator * (const_reference) const -> lvalue override { return unspecified_object; }
72+
auto operator / (const_reference) const -> lvalue override { return unspecified_object; }
73+
auto operator % (const_reference) const -> lvalue override { return unspecified_object; }
7474

7575
auto operator ==(const_reference) const -> bool override { return false; };
7676
auto operator !=(const_reference) const -> bool override { return false; };

include/meevax/kernel/configurator.hpp

+26-45
Original file line numberDiff line numberDiff line change
@@ -45,39 +45,38 @@ inline namespace kernel
4545

4646
const dispatcher<std::string> long_options, long_options_with_arguments;
4747

48-
protected:
49-
let batch = f;
50-
let debug = f;
51-
let interactive = f;
52-
let trace = f;
53-
let verbose = f;
54-
5548
public:
49+
bool batch = false;
50+
bool debug = false;
51+
bool interactive = false;
52+
bool trace = false;
53+
bool verbose = false;
54+
5655
explicit configurator()
5756
: short_options
5857
{
5958
std::make_pair('b', [this](auto&&...)
6059
{
61-
return batch = t;
60+
return make<bool>(batch = true);
6261
}),
6362

6463
std::make_pair('d', [this](auto&&...)
6564
{
66-
return debug = t;
65+
return make<bool>(debug = true);
6766
}),
6867

69-
std::make_pair('h', [this](auto&&...) -> object
68+
std::make_pair('h', [this](auto&&...) -> lvalue
7069
{
7170
display_help();
7271
throw exit_status::success;
7372
}),
7473

7574
std::make_pair('i', [this](auto&&...)
7675
{
77-
return interactive = t;
76+
return make<bool>(interactive = true);
7877
}),
7978

80-
std::make_pair('v', [this](auto&&...) -> object
79+
std::make_pair('v', [this](auto&&...) -> lvalue
8180
{
8281
display_version();
8382
throw exit_status::success;
@@ -93,7 +92,7 @@ inline namespace kernel
9392

9493
std::make_pair('l', [this](const_reference x, auto&&...)
9594
{
96-
return load(x.as<string>());
95+
return load(x.as_const<string>());
9796
}),
9897

9998
std::make_pair('w', [this](const_reference x, auto&&...)
@@ -106,36 +105,36 @@ inline namespace kernel
106105
{
107106
std::make_pair("batch", [this](auto&&...)
108107
{
109-
return batch = t;
108+
return make<bool>(batch = true);
110109
}),
111110

112111
std::make_pair("debug", [this](auto&&...)
113112
{
114-
return debug = t;
113+
return make<bool>(debug = true);
115114
}),
116115

117-
std::make_pair("help", [this](auto&&...) -> object
116+
std::make_pair("help", [this](auto&&...) -> lvalue
118117
{
119118
display_help();
120119
throw exit_status::success;
121120
}),
122121

123122
std::make_pair("interactive", [this](auto&&...)
124123
{
125-
return interactive = t;
124+
return make<bool>(interactive = true);
126125
}),
127126

128127
std::make_pair("trace", [this](auto&&...)
129128
{
130-
return trace = t;
129+
return make<bool>(trace = true);
131130
}),
132131

133132
std::make_pair("verbose", [this](auto&&...)
134133
{
135-
return verbose = t;
134+
return make<bool>(verbose = true);
136135
}),
137136

138-
std::make_pair("version", [this](auto&&...) -> object
137+
std::make_pair("version", [this](auto&&...) -> lvalue
139138
{
140139
display_version();
141140
throw exit_status::success;
@@ -151,7 +150,7 @@ inline namespace kernel
151150

152151
std::make_pair("load", [this](const_reference x, auto&&...)
153152
{
154-
return load(x.as<string>());
153+
return load(x.as_const<string>());
155154
}),
156155

157156
std::make_pair("write", [this](const_reference x, auto&&...)
@@ -172,22 +171,19 @@ inline namespace kernel
172171

173172
if (std::empty(args))
174173
{
175-
interactive = t;
174+
interactive = true;
176175
}
177176
else for (auto current_option = std::begin(args); current_option != std::end(args); ++current_option) [&]()
178177
{
179178
std::smatch analysis {};
180179

181180
std::regex_match(*current_option, analysis, pattern);
182181

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;
191187

192188
if (auto const current_short_options = analysis.str(4); not current_short_options.empty())
193189
{
@@ -276,21 +272,6 @@ inline namespace kernel
276272
print(" --verbose Display detailed informations.");
277273
print(" -w, --write=OBJECT Same as -e '(write OBJECT)'");
278274
}
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
294275
};
295276
} // namespace kernel
296277
} // namespace meevax

include/meevax/kernel/constant.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ namespace meevax
2323
{
2424
inline namespace kernel
2525
{
26-
extern std::unordered_map<std::string, object> const constants;
26+
extern std::unordered_map<std::string, lvalue> const constants;
2727
} // namespace kernel
2828
} // namespace meevax
2929

include/meevax/kernel/environment.hpp

+16-16
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ inline namespace kernel
3535
using pair::pair;
3636

3737
public:
38-
using configurator::is_debug_mode;
39-
using configurator::is_trace_mode;
40-
using configurator::is_verbose_mode;
38+
using configurator::debug;
39+
using configurator::trace;
40+
using configurator::verbose;
4141

4242
using reader::intern;
4343
using reader::read;
@@ -55,18 +55,18 @@ inline namespace kernel
5555
{
5656
(import(xs), ...);
5757

58-
define<procedure>("set-batch!", [this](let const& xs, auto&&...) { return batch = car(xs); });
59-
define<procedure>("set-debug!", [this](let const& xs, auto&&...) { return debug = car(xs); });
60-
define<procedure>("set-interactive!", [this](let const& xs, auto&&...) { return interactive = car(xs); });
61-
define<procedure>("set-trace!", [this](let const& xs, auto&&...) { return trace = car(xs); });
62-
define<procedure>("set-verbose!", [this](let const& xs, auto&&...) { return verbose = car(xs); });
58+
define<procedure>("set-batch!", [this](let const& xs, auto&&...) { return batch = select(car(xs)); });
59+
define<procedure>("set-debug!", [this](let const& xs, auto&&...) { return debug = select(car(xs)); });
60+
define<procedure>("set-interactive!", [this](let const& xs, auto&&...) { return interactive = select(car(xs)); });
61+
define<procedure>("set-trace!", [this](let const& xs, auto&&...) { return trace = select(car(xs)); });
62+
define<procedure>("set-verbose!", [this](let const& xs, auto&&...) { return verbose = select(car(xs)); });
6363
}
6464

6565
auto operator [](const_reference) -> const_reference;
6666

6767
auto operator [](std::string const&) -> const_reference;
6868

69-
auto apply(const_reference, const_reference) -> object;
69+
auto apply(const_reference, const_reference) -> lvalue;
7070

7171
auto declare_import(const_reference) -> void;
7272

@@ -86,13 +86,13 @@ inline namespace kernel
8686
define(name, make<T>(name, std::forward<decltype(xs)>(xs)...));
8787
}
8888

89-
auto evaluate(const_reference) -> object;
89+
auto evaluate(const_reference) -> lvalue;
9090

91-
auto execute() -> object;
91+
auto execute() -> lvalue;
9292

93-
auto execute(const_reference) -> object;
93+
auto execute(const_reference) -> lvalue;
9494

95-
auto fork() const -> object
95+
auto fork() const -> lvalue
9696
{
9797
return make<environment>(*this);
9898
}
@@ -108,15 +108,15 @@ inline namespace kernel
108108

109109
auto global() const noexcept -> const_reference;
110110

111-
auto load(std::string const&) -> object;
111+
auto load(std::string const&) -> lvalue;
112112

113113
auto scope() const noexcept -> const_reference;
114114

115115
auto scope() noexcept -> reference;
116116

117-
auto identify(const_reference, const_reference) -> object;
117+
auto identify(const_reference, const_reference) -> lvalue;
118118

119-
auto identify(const_reference, const_reference) const -> object;
119+
auto identify(const_reference, const_reference) const -> lvalue;
120120
};
121121

122122
auto operator >>(std::istream &, environment &) -> std::istream &;

include/meevax/kernel/error.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ inline namespace kernel
8282
return underlying_cast(value);
8383
}
8484

85-
catch (const_reference error) // NOTE: default-exception-handler (Terminate the program without running any outstanding dynamic-wind after procedures)
85+
catch (const_reference error) // NOTE: procedure `throw` (Terminate the program without running any outstanding dynamic-wind after procedures)
8686
{
8787
std::cerr << "; " << error << std::endl;
8888
return underlying_cast(exit_status::failure);

include/meevax/kernel/exact_integer.hpp

+7-7
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ inline namespace kernel
8585

8686
auto truncate_quotient(exact_integer const&) const -> exact_integer;
8787

88-
#define DEFINE(NAME) auto NAME() const -> object override
88+
#define DEFINE(NAME) auto NAME() const -> lvalue override
8989

9090
DEFINE(exact); DEFINE(inexact);
9191

@@ -97,7 +97,7 @@ inline namespace kernel
9797

9898
#undef DEFINE
9999

100-
#define DEFINE(NAME) auto NAME(const_reference) const -> object override
100+
#define DEFINE(NAME) auto NAME(const_reference) const -> lvalue override
101101

102102
DEFINE(atan2);
103103
DEFINE(pow);
@@ -118,11 +118,11 @@ inline namespace kernel
118118

119119
explicit operator std::string() const;
120120

121-
auto operator + (const_reference) const -> object override;
122-
auto operator - (const_reference) const -> object override;
123-
auto operator * (const_reference) const -> object override;
124-
auto operator / (const_reference) const -> object override;
125-
auto operator % (const_reference) const -> object override;
121+
auto operator + (const_reference) const -> lvalue override;
122+
auto operator - (const_reference) const -> lvalue override;
123+
auto operator * (const_reference) const -> lvalue override;
124+
auto operator / (const_reference) const -> lvalue override;
125+
auto operator % (const_reference) const -> lvalue override;
126126

127127
auto operator ==(const_reference) const -> bool override;
128128
auto operator !=(const_reference) const -> bool override;

0 commit comments

Comments
 (0)