aboutsummaryrefslogtreecommitdiffstats
path: root/Godeps/_workspace/src/github.com/ethereum/serpent-go/serpent/preprocess.h
diff options
context:
space:
mode:
authorTaylor Gerring <taylor.gerring@gmail.com>2015-02-16 21:28:33 +0800
committerTaylor Gerring <taylor.gerring@gmail.com>2015-02-16 21:28:33 +0800
commit702218008ee2b6d708d6b2821cdef80736bb3224 (patch)
treed55ff7ce88187082378e7d8e4c2f3aad14d23b4e /Godeps/_workspace/src/github.com/ethereum/serpent-go/serpent/preprocess.h
parent202362d9258335c695eb75f55f4be74a50a1af33 (diff)
downloadgo-tangerine-702218008ee2b6d708d6b2821cdef80736bb3224.tar.gz
go-tangerine-702218008ee2b6d708d6b2821cdef80736bb3224.tar.zst
go-tangerine-702218008ee2b6d708d6b2821cdef80736bb3224.zip
Add versioned dependencies from godep
Diffstat (limited to 'Godeps/_workspace/src/github.com/ethereum/serpent-go/serpent/preprocess.h')
-rw-r--r--Godeps/_workspace/src/github.com/ethereum/serpent-go/serpent/preprocess.h58
1 files changed, 58 insertions, 0 deletions
diff --git a/Godeps/_workspace/src/github.com/ethereum/serpent-go/serpent/preprocess.h b/Godeps/_workspace/src/github.com/ethereum/serpent-go/serpent/preprocess.h
new file mode 100644
index 000000000..944436aef
--- /dev/null
+++ b/Godeps/_workspace/src/github.com/ethereum/serpent-go/serpent/preprocess.h
@@ -0,0 +1,58 @@
+#ifndef ETHSERP_PREPROCESSOR
+#define ETHSERP_PREPROCESSOR
+
+#include <stdio.h>
+#include <iostream>
+#include <vector>
+#include <map>
+#include "util.h"
+
+// Storage variable index storing object
+struct svObj {
+ std::map<std::string, std::string> offsets;
+ std::map<std::string, int> indices;
+ std::map<std::string, std::vector<std::string> > coefficients;
+ std::map<std::string, bool> nonfinal;
+ std::string globalOffset;
+};
+
+class rewriteRule {
+ public:
+ rewriteRule(Node p, Node s) {
+ pattern = p;
+ substitution = s;
+ }
+ Node pattern;
+ Node substitution;
+};
+
+
+// Preprocessing result storing object
+class preprocessAux {
+ public:
+ preprocessAux() {
+ globalExterns = std::map<std::string, int>();
+ localExterns = std::map<std::string, std::map<std::string, int> >();
+ localExterns["self"] = std::map<std::string, int>();
+ }
+ std::map<std::string, int> globalExterns;
+ std::map<std::string, std::string> globalExternSigs;
+ std::map<std::string, std::map<std::string, int> > localExterns;
+ std::map<std::string, std::map<std::string, std::string> > localExternSigs;
+ std::vector<rewriteRule> customMacros;
+ std::map<std::string, std::string> types;
+ svObj storageVars;
+};
+
+#define preprocessResult std::pair<Node, preprocessAux>
+
+// Populate an svObj with the arguments needed to determine
+// the storage position of a node
+svObj getStorageVars(svObj pre, Node node, std::string prefix="",
+ int index=0);
+
+// Preprocess a function (see cpp for details)
+preprocessResult preprocess(Node inp);
+
+
+#endif