aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordos-reis <gdr@axiomatics.org>2013-06-25 04:08:39 +0000
committerdos-reis <gdr@axiomatics.org>2013-06-25 04:08:39 +0000
commitf9e4a03a220766099d6b5fc683a58185c4805a05 (patch)
tree9a7eb92745c5feeed83d37aff61123f6db4fd7cc /src
parentbba0c431de24f2291011be1960eeb1f5d15dfb8b (diff)
downloadopen-axiom-f9e4a03a220766099d6b5fc683a58185c4805a05.tar.gz
* include/sexpr.H: Move from utils.
(UniqueAllocator): Remove. (SyntaxComparator): Likewise. * syntax/sexpr.cc: Move from utils.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog7
-rw-r--r--src/include/sexpr.H (renamed from src/utils/sexpr.H)72
-rw-r--r--src/syntax/Makefile.am2
-rw-r--r--src/syntax/Makefile.in20
-rw-r--r--src/syntax/sexpr.cc (renamed from src/utils/sexpr.cc)30
-rw-r--r--src/utils/Makefile.in6
6 files changed, 63 insertions, 74 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 88d35204..e72747a2 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,12 @@
2013-06-24 Gabriel Dos Reis <gdr@integrable-solutions.net>
+ * include/sexpr.H: Move from utils.
+ (UniqueAllocator): Remove.
+ (SyntaxComparator): Likewise.
+ * syntax/sexpr.cc: Move from utils.
+
+2013-06-24 Gabriel Dos Reis <gdr@integrable-solutions.net>
+
* interp/cattable.boot (squeezeList): Remove.
(squeeze1): Likewise.
* interp/daase.lisp (*COMPRESSVECTOR*): Likewise.
diff --git a/src/utils/sexpr.H b/src/include/sexpr.H
index 5c9934d5..a9371139 100644
--- a/src/utils/sexpr.H
+++ b/src/include/sexpr.H
@@ -30,8 +30,8 @@
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#ifndef OPENAXIOM_SEXPR_INCLUDED
-#define OPENAXIOM_SEXPR_INCLUDED
+#ifndef OPENAXIOM_SEXPR_included
+#define OPENAXIOM_SEXPR_included
// --% Author: Gabriel Dos Reis.
// --% Description:
@@ -44,7 +44,7 @@
#include <iosfwd>
#include <vector>
-#include <set>
+#include <open-axiom/storage>
#include <open-axiom/string-pool>
#include <open-axiom/token>
@@ -365,40 +365,6 @@ namespace OpenAxiom {
// ---------------
// -- Allocator --
// ---------------
-
- // The next two classes are helper classes for the main
- // allocation class Allocator. We use std::set as allocator
- // that guarantee uuniqueness of atomic syntax object with
- // respect to the constituent token. That container needs
- // a relational comparator. In an ideal world, this class
- // should not exist.
- struct SyntaxComparator {
- bool operator()(const Atom& lhs, const Atom& rhs) const {
- return std::less<BasicString>()(lhs.lexeme(), rhs.lexeme());
- }
-
- template<typename T>
- bool
- operator()(const unary_form<T>& lhs, const unary_form<T>& rhs) const {
- return std::less<const void*>()(lhs.body(), rhs.body());
- }
-
- bool operator()(const Anchor& lhs, const Anchor& rhs) const {
- return std::less<size_t>()(lhs.ref(), rhs.ref());
- }
- };
-
- template<typename T>
- struct UniqueAllocator : std::set<T, SyntaxComparator> {
- typedef std::set<T, SyntaxComparator> base;
- typedef typename base::const_iterator const_iterator;
-
- template<typename... Args>
- const T* allocate(const Args&... args) {
- return &*this->insert(T(args...)).first;
- }
- };
-
// Allocator of syntax objects.
struct Allocator {
Allocator();
@@ -423,21 +389,21 @@ namespace OpenAxiom {
const Vector* make_vector(const std::vector<const Syntax*>&);
private:
- UniqueAllocator<Integer> ints;
- UniqueAllocator<Character> chars;
- UniqueAllocator<String> strs;
- UniqueAllocator<Symbol> syms;
- UniqueAllocator<Anchor> ancs;
- UniqueAllocator<Reference> refs;
- UniqueAllocator<Quote> quotes;
- UniqueAllocator<Antiquote> antis;
- UniqueAllocator<Expand> exps;
- UniqueAllocator<Function> funs;
- UniqueAllocator<Include> incs;
- UniqueAllocator<Exclude> excs;
- UniqueAllocator<Eval> evls;
- UniqueAllocator<Splice> spls;
- UniqueAllocator<DotTail> tails;
+ Memory::Factory<Integer> ints;
+ Memory::Factory<Character> chars;
+ Memory::Factory<String> strs;
+ Memory::Factory<Symbol> syms;
+ Memory::Factory<Anchor> ancs;
+ Memory::Factory<Reference> refs;
+ Memory::Factory<Quote> quotes;
+ Memory::Factory<Antiquote> antis;
+ Memory::Factory<Expand> exps;
+ Memory::Factory<Function> funs;
+ Memory::Factory<Include> incs;
+ Memory::Factory<Exclude> excs;
+ Memory::Factory<Eval> evls;
+ Memory::Factory<Splice> spls;
+ Memory::Factory<DotTail> tails;
Memory::Factory<List> lists;
Memory::Factory<Vector> vectors;
List empty_list;
@@ -492,4 +458,4 @@ namespace OpenAxiom {
}
}
-#endif // OPENAXIOM_SEXPR_INCLUDED
+#endif // OPENAXIOM_SEXPR_included
diff --git a/src/syntax/Makefile.am b/src/syntax/Makefile.am
index a731618f..964f7e54 100644
--- a/src/syntax/Makefile.am
+++ b/src/syntax/Makefile.am
@@ -32,7 +32,7 @@
noinst_LIBRARIES = libsyntax.a
-libsyntax_a_SOURCES = token.cc
+libsyntax_a_SOURCES = token.cc sexpr.cc
oa_target_incdir = $(top_builddir)/$(target)/include
diff --git a/src/syntax/Makefile.in b/src/syntax/Makefile.in
index 8982abc0..f492a7f7 100644
--- a/src/syntax/Makefile.in
+++ b/src/syntax/Makefile.in
@@ -136,7 +136,8 @@ am__v_AR_0 = @echo " AR " $@;
am__v_AR_1 =
libsyntax_a_AR = $(AR) $(ARFLAGS)
libsyntax_a_LIBADD =
-am_libsyntax_a_OBJECTS = libsyntax_a-token.$(OBJEXT)
+am_libsyntax_a_OBJECTS = libsyntax_a-token.$(OBJEXT) \
+ libsyntax_a-sexpr.$(OBJEXT)
libsyntax_a_OBJECTS = $(am_libsyntax_a_OBJECTS)
AM_V_P = $(am__v_P_@AM_V@)
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
@@ -375,7 +376,7 @@ top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
void_type = @void_type@
noinst_LIBRARIES = libsyntax.a
-libsyntax_a_SOURCES = token.cc
+libsyntax_a_SOURCES = token.cc sexpr.cc
oa_target_incdir = $(top_builddir)/$(target)/include
libsyntax_a_CPPFLAGS = -I$(top_srcdir)/src/include -I$(oa_target_incdir)
all: all-am
@@ -427,6 +428,7 @@ mostlyclean-compile:
distclean-compile:
-rm -f *.tab.c
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsyntax_a-sexpr.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsyntax_a-token.Po@am__quote@
.cc.o:
@@ -464,6 +466,20 @@ libsyntax_a-token.obj: token.cc
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsyntax_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libsyntax_a-token.obj `if test -f 'token.cc'; then $(CYGPATH_W) 'token.cc'; else $(CYGPATH_W) '$(srcdir)/token.cc'; fi`
+libsyntax_a-sexpr.o: sexpr.cc
+@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsyntax_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libsyntax_a-sexpr.o -MD -MP -MF $(DEPDIR)/libsyntax_a-sexpr.Tpo -c -o libsyntax_a-sexpr.o `test -f 'sexpr.cc' || echo '$(srcdir)/'`sexpr.cc
+@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsyntax_a-sexpr.Tpo $(DEPDIR)/libsyntax_a-sexpr.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='sexpr.cc' object='libsyntax_a-sexpr.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsyntax_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libsyntax_a-sexpr.o `test -f 'sexpr.cc' || echo '$(srcdir)/'`sexpr.cc
+
+libsyntax_a-sexpr.obj: sexpr.cc
+@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsyntax_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libsyntax_a-sexpr.obj -MD -MP -MF $(DEPDIR)/libsyntax_a-sexpr.Tpo -c -o libsyntax_a-sexpr.obj `if test -f 'sexpr.cc'; then $(CYGPATH_W) 'sexpr.cc'; else $(CYGPATH_W) '$(srcdir)/sexpr.cc'; fi`
+@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsyntax_a-sexpr.Tpo $(DEPDIR)/libsyntax_a-sexpr.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='sexpr.cc' object='libsyntax_a-sexpr.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsyntax_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libsyntax_a-sexpr.obj `if test -f 'sexpr.cc'; then $(CYGPATH_W) 'sexpr.cc'; else $(CYGPATH_W) '$(srcdir)/sexpr.cc'; fi`
+
mostlyclean-libtool:
-rm -f *.lo
diff --git a/src/utils/sexpr.cc b/src/syntax/sexpr.cc
index 3e6b5e90..14113164 100644
--- a/src/utils/sexpr.cc
+++ b/src/syntax/sexpr.cc
@@ -535,77 +535,77 @@ namespace OpenAxiom {
const Character*
Allocator::make_character(const Token& t) {
- return chars.allocate(t);
+ return chars.make(t);
}
const Integer*
Allocator::make_integer(const Token& t) {
- return ints.allocate(t);
+ return ints.make(t);
}
const String*
Allocator::make_string(const Token& t) {
- return strs.allocate(t);
+ return strs.make(t);
}
const Symbol*
Allocator::make_symbol(const Token& t, Symbol::Kind k) {
- return syms.allocate(t, k);
+ return syms.make(t, k);
}
const Anchor*
Allocator::make_anchor(size_t t, const Syntax* s) {
- return ancs.allocate(t, s);
+ return ancs.make(t, s);
}
const Reference*
Allocator::make_reference(const Token& t, size_t i) {
- return refs.allocate(t, i);
+ return refs.make(t, i);
}
const Quote*
Allocator::make_quote(const Syntax* s) {
- return quotes.allocate(s);
+ return quotes.make(s);
}
const Antiquote*
Allocator::make_antiquote(const Syntax* s) {
- return antis.allocate(s);
+ return antis.make(s);
}
const Expand*
Allocator::make_expand(const Syntax* s) {
- return exps.allocate(s);
+ return exps.make(s);
}
const Eval*
Allocator::make_eval(const Syntax* s) {
- return evls.allocate(s);
+ return evls.make(s);
}
const Splice*
Allocator::make_splice(const Syntax* s) {
- return spls.allocate(s);
+ return spls.make(s);
}
const Function*
Allocator::make_function(const Syntax* s) {
- return funs.allocate(s);
+ return funs.make(s);
}
const Include*
Allocator::make_include(const Syntax* s) {
- return incs.allocate(s);
+ return incs.make(s);
}
const Exclude*
Allocator::make_exclude(const Syntax* s) {
- return excs.allocate(s);
+ return excs.make(s);
}
const DotTail*
Allocator::make_dot_tail(const Syntax* f) {
- return tails.allocate(f);
+ return tails.make(f);
}
const List*
diff --git a/src/utils/Makefile.in b/src/utils/Makefile.in
index a3021748..0ac6b300 100644
--- a/src/utils/Makefile.in
+++ b/src/utils/Makefile.in
@@ -36,14 +36,14 @@ hammer_SOURCES = hammer.cc
hammer_OBJECTS = $(hammer_SOURCES:.cc=.lo)
hammer_LDADD = -L. -lOpenAxiom
-libOpenAxiom_HEADERS = hash-table.H string-pool.H sexpr.H vm.H
+libOpenAxiom_HEADERS = hash-table.H string-pool.H vm.H
libOpenAxiom_SOURCES = \
- storage.cc string-pool.cc sexpr.cc command.cc \
+ storage.cc string-pool.cc command.cc \
filesystem.cc vm.cc
libOpenAxiom_OBJECTS = $(libOpenAxiom_SOURCES:.cc=.lo)
-oa_public_headers = hash-table string-pool sexpr vm
+oa_public_headers = hash-table string-pool vm
## Where we store public header files
oa_target_headerdir = $(oa_target_includedir)/open-axiom