aboutsummaryrefslogtreecommitdiff
path: root/src/rt
diff options
context:
space:
mode:
authordos-reis <gdr@axiomatics.org>2014-11-16 20:32:55 +0000
committerdos-reis <gdr@axiomatics.org>2014-11-16 20:32:55 +0000
commit452696064e43c23f2a44edcded311f3d7b466d7e (patch)
tree375ea3690ca7ea469675313cae728a670dd26b09 /src/rt
parent564aff97f80abac84be64552f5238903cb126c33 (diff)
downloadopen-axiom-452696064e43c23f2a44edcded311f3d7b466d7e.tar.gz
Check for LLVM framework
Diffstat (limited to 'src/rt')
-rw-r--r--src/rt/Makefile.in4
-rw-r--r--src/rt/vm.cc38
2 files changed, 41 insertions, 1 deletions
diff --git a/src/rt/Makefile.in b/src/rt/Makefile.in
index f1dfdf20..61aa22ba 100644
--- a/src/rt/Makefile.in
+++ b/src/rt/Makefile.in
@@ -1,4 +1,4 @@
-# Makefile.in generated by automake 1.13.4 from Makefile.am.
+# Makefile.in generated by automake 1.14.1 from Makefile.am.
# @configure_input@
# Copyright (C) 1994-2013 Free Software Foundation, Inc.
@@ -250,6 +250,7 @@ LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LIBTOOL_DEPS = @LIBTOOL_DEPS@
LIPO = @LIPO@
+LLVM_CONFIG = @LLVM_CONFIG@
LNKEXT = @LNKEXT@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
@@ -370,6 +371,7 @@ oa_target_texdir = @oa_target_texdir@
oa_targetdir = @oa_targetdir@
oa_use_dynamic_lib = @oa_use_dynamic_lib@
oa_use_libtool_for_shared_lib = @oa_use_libtool_for_shared_lib@
+oa_use_llvm = @oa_use_llvm@
oa_use_x = @oa_use_x@
oldincludedir = @oldincludedir@
open_axiom_installdir = @open_axiom_installdir@
diff --git a/src/rt/vm.cc b/src/rt/vm.cc
index 7f5cd5fc..4cedc030 100644
--- a/src/rt/vm.cc
+++ b/src/rt/vm.cc
@@ -33,6 +33,9 @@
// --% Author: Gabriel Dos Reis
#include <open-axiom/vm>
+#include <iterator>
+#include <algorithm>
+#include <ostream>
namespace OpenAxiom {
namespace VM {
@@ -46,6 +49,15 @@ namespace OpenAxiom {
p->symbol->value = p->value;
}
+ Environment::Binding*
+ Environment::lookup(InternedString name) {
+ for (auto& b : lexical) {
+ if (b.symbol->name == name)
+ return &b;
+ }
+ return nullptr;
+ }
+
// -- Dynamic
Dynamic::~Dynamic() { }
@@ -59,11 +71,24 @@ namespace OpenAxiom {
attributes()
{ }
+ void Symbol::format_on(std::ostream& os) const {
+ // FIXME: handle escapes.
+ std::copy(name->begin(), name->end(),
+ std::ostream_iterator<char>(os));
+ }
+
// -- Package
Package::Package(InternedString s)
: name(s)
{ }
+ void Package::format_on(std::ostream& os) const {
+ os << "#<PACKAGE \"";
+ std::copy(name->begin(), name->end(),
+ std::ostream_iterator<char>(os));
+ os << '"' << '>';
+ }
+
Symbol*
Package::make_symbol(InternedString s) {
auto sym = const_cast<Symbol*>(&*symbols.insert(Symbol(s)).first);
@@ -71,6 +96,19 @@ namespace OpenAxiom {
return sym;
}
+ Symbol*
+ Package::find_symbol(InternedString s) {
+ auto p = symbols.find(Symbol(s));
+ return p == symbols.end() ? nullptr : const_cast<Symbol*>(&*p);
+ }
+
+ // -- FunctionBase
+ void FunctionBase::format_on(std::ostream& os) const {
+ os << "#<FUNCTION ";
+ name->format_on(os);
+ os << '>';
+ }
+
Fixnum
count_nodes(Pair p) {
FixnumBits n = 1;