aboutsummaryrefslogtreecommitdiffstats
path: root/tuplr.hpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2009-03-06 22:33:58 +0000
committerDavid Robillard <d@drobilla.net>2009-03-06 22:33:58 +0000
commit77162da0f773b8e79939491aca4e0232c62c255c (patch)
treec9618c6b9b52a20a9bf9830d9da69bd6ff732fbc /tuplr.hpp
parentecef8f697c66e15b85beb934d2b617b915a97aab (diff)
downloadresp-77162da0f773b8e79939491aca4e0232c62c255c.tar.gz
resp-77162da0f773b8e79939491aca4e0232c62c255c.tar.bz2
resp-77162da0f773b8e79939491aca4e0232c62c255c.zip
Remove low level type stuff completely from core code (let the backend deal with conversion of abstract types to compiled types).
git-svn-id: http://svn.drobilla.net/resp/tuplr@65 ad02d1e2-f140-0410-9f75-f8b11f17cedd
Diffstat (limited to 'tuplr.hpp')
-rw-r--r--tuplr.hpp32
1 files changed, 19 insertions, 13 deletions
diff --git a/tuplr.hpp b/tuplr.hpp
index 0bfb5c1..489868a 100644
--- a/tuplr.hpp
+++ b/tuplr.hpp
@@ -26,17 +26,26 @@
#include <vector>
#include <boost/format.hpp>
-typedef void* CValue; ///< Compiled value (opaque)
-typedef const void* CType; ///< Compiled type (opaque)
-typedef void* CFunction; ///< Compiled function (opaque)
-
-struct CEngine; ///< Backend data (opaque)
-
#define FOREACH(IT, i, c) for (IT i = (c).begin(); i != (c).end(); ++i)
using namespace std;
using boost::format;
+
+/***************************************************************************
+ * Backend *
+ ***************************************************************************/
+
+typedef void* CValue; ///< Compiled value (opaque)
+typedef void* CFunction; ///< Compiled function (opaque)
+
+struct CEngine; ///< Backend data (opaque)
+
+
+/***************************************************************************
+ * Basic Utility Classes *
+ ***************************************************************************/
+
extern std::ostream& err;
extern std::ostream& out;
@@ -56,7 +65,7 @@ struct Error {
};
template<typename Atom>
-struct Exp { // ::= Atom | (Exp*)
+struct Exp {
Exp(Cursor c) : type(LIST), loc(c) {}
Exp(Cursor c, const Atom& a) : type(ATOM), loc(c), atom(a) {}
typedef std::vector< Exp<Atom> > List;
@@ -164,9 +173,9 @@ struct ASTTuple : public AST, public vector<AST*> {
/// Type Expression, e.g. "Int", "(Fn (Int Int) Float)"
struct AType : public ASTTuple {
- AType(const ASTTuple& t) : ASTTuple(t), kind(EXPR), _ctype(0) {}
- AType(unsigned i) : kind(VAR), id(i), _ctype(0) {}
- AType(ASTSymbol* n, CType t) : kind(PRIM), _ctype(t) { push_back(n); }
+ AType(unsigned i) : kind(VAR), id(i) {}
+ AType(ASTSymbol* s) : kind(PRIM), id(0) { push_back(s); }
+ AType(const ASTTuple& t) : ASTTuple(t), kind(EXPR), id(0) {}
string str() const {
switch (kind) {
case VAR: return (format("?%1%") % id).str();
@@ -203,11 +212,8 @@ struct AType : public ASTTuple {
}
return false; // never reached
}
- CType ctype();
enum { VAR, PRIM, EXPR } kind;
unsigned id;
-private:
- const CType _ctype;
};
/// Lifted system functions (of various types) for a single Tuplr function