diff options
Diffstat (limited to 'src/rt')
-rw-r--r-- | src/rt/Lisp.cc | 22 | ||||
-rw-r--r-- | src/rt/vm.cc | 13 |
2 files changed, 16 insertions, 19 deletions
diff --git a/src/rt/Lisp.cc b/src/rt/Lisp.cc index 71b3c2b1..fae3e02f 100644 --- a/src/rt/Lisp.cc +++ b/src/rt/Lisp.cc @@ -68,8 +68,8 @@ namespace OpenAxiom { constexpr NamedConstant<Value> value_constants[] = { { "NIL", Value::nil }, { "T", Value::t }, - { "MOST-NEGATIVE-FIXNUM", from_fixnum(Fixnum::minimum) }, - { "MOST-POSITIVE-FIXNUM", from_fixnum(Fixnum::maximum) }, + { "MOST-NEGATIVE-FIXNUM", to_value(Fixnum::minimum) }, + { "MOST-POSITIVE-FIXNUM", to_value(Fixnum::maximum) }, }; static void define_special_constants(Evaluator* ctx) { @@ -151,7 +151,7 @@ namespace OpenAxiom { val = -val; } } - return VM::from_fixnum(Fixnum(val)); + return VM::to_value(Fixnum(val)); } static Value @@ -163,14 +163,14 @@ namespace OpenAxiom { if (x.dotted()) result = ctx->make_value(*p++); while (p != x.rend()) - result = from_pair(ctx->make_pair(ctx->make_value(*p++), result)); + result = to_value(ctx->make_pair(ctx->make_value(*p++), result)); return result; } static Value construct(Evaluator* ctx, const Sexpr::StringSyntax& x) { auto s = ctx->intern(x.lexeme().begin(), x.lexeme().size()); - return from_string(s); + return to_value(s); } static Value @@ -457,7 +457,7 @@ namespace OpenAxiom { if (v == Value::nil) break; os << ' '; - if (auto q = to_pair_if_can(v)) { + if (auto q = if_pair(v)) { p = q; continue; } @@ -478,7 +478,7 @@ namespace OpenAxiom { os << '"'; } - static void format(const Dynamic*, std::ostream&); + static void format(const Boxed*, std::ostream&); void format(Value v, std::ostream& os) { if (v == Value::nil) @@ -491,14 +491,14 @@ namespace OpenAxiom { format(to_pair(v), os); else if (is<String>(v)) format(to_string(v), os); - else if (is<Dynamic>(v)) - format(to_dynamic(v), os); + else if (is<Boxed>(v)) + format(to_boxed(v), os); else os << "#<unprintable>"; } - static void format(const Dynamic* x, std::ostream& os) { - struct V : Dynamic::Visitor { + static void format(const Boxed* x, std::ostream& os) { + struct V : Boxed::Visitor { std::ostream& os; V(std::ostream& s) : os(s) { } void visit(const Symbol& s) { diff --git a/src/rt/vm.cc b/src/rt/vm.cc index b099fa70..dbeb7fd0 100644 --- a/src/rt/vm.cc +++ b/src/rt/vm.cc @@ -1,4 +1,4 @@ -// Copyright (C) 2011-2014, Gabriel Dos Reis. +// Copyright (C) 2011-2022, Gabriel Dos Reis. // All rights reserved. // Written by Gabriel Dos Reis. // @@ -39,15 +39,15 @@ namespace OpenAxiom { namespace VM { - void Dynamic::Visitor::visit(const NullaryOperator& x) { + void Boxed::Visitor::visit(const NullaryOperator& x) { visit(as<FunctionBase>(x)); } - void Dynamic::Visitor::visit(const UnaryOperator& x) { + void Boxed::Visitor::visit(const UnaryOperator& x) { visit(as<FunctionBase>(x)); } - void Dynamic::Visitor::visit(const BinaryOperator& x) { + void Boxed::Visitor::visit(const BinaryOperator& x) { visit(as<FunctionBase>(x)); } @@ -72,9 +72,6 @@ namespace OpenAxiom { return nullptr; } - // -- Dynamic - Dynamic::~Dynamic() = default; - // -- Symbol Symbol::Symbol(InternedString s) : name(s), @@ -113,7 +110,7 @@ namespace OpenAxiom { Fixnum count_nodes(Pair p) { FixnumBits n = 1; - for (; auto q = to_pair_if_can(p->tail); p = q) + for (; auto q = if_pair(p->tail); p = q) ++n; return Fixnum(n); } |