about summary refs log tree commit diff
path: root/src/libexpr/eval.hh
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2004-08-04T10·59+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2004-08-04T10·59+0000
commitbbfdd64741546863c2412d780097b1fe2457395e (patch)
tree198309fd082893cfbb24f5dd044e53d1723a2b6b /src/libexpr/eval.hh
parente3a50f7e25c552a78974fae684484d27a36b7c60 (diff)
* Allow primops with more that 1 arguments.
Diffstat (limited to 'src/libexpr/eval.hh')
-rw-r--r--src/libexpr/eval.hh15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/libexpr/eval.hh b/src/libexpr/eval.hh
index 34ac467f1d80..b51a5b07988c 100644
--- a/src/libexpr/eval.hh
+++ b/src/libexpr/eval.hh
@@ -12,16 +12,16 @@ typedef map<Path, PathSet> DrvPaths;
 typedef map<Path, Hash> DrvHashes;
 
 struct EvalState;
-typedef Expr (* PrimOp0) (EvalState &);
-typedef Expr (* PrimOp1) (EvalState &, Expr arg);
+
+/* Note: using a ATermVector is safe here, since when we call a primop
+   we also have an ATermList on the stack. */
+typedef Expr (* PrimOp) (EvalState &, const ATermVector & args);
 
 
 struct EvalState 
 {
     ATermMap normalForms;
-    ATermMap primOps0; /* nullary primops */
-    ATermMap primOps1; /* unary primops */
-    ATermMap primOpsAll;
+    ATermMap primOps;
     DrvPaths drvPaths;
     DrvHashes drvHashes; /* normalised derivation hashes */
     Expr blackHole;
@@ -31,8 +31,9 @@ struct EvalState
 
     EvalState();
 
-    void addPrimOp0(const string & name, PrimOp0 primOp);
-    void addPrimOp1(const string & name, PrimOp1 primOp);
+    void addPrimOps();
+    void addPrimOp(const string & name,
+        unsigned int arity, PrimOp primOp);
 };