Fix the CGenerator so that function values can be stored in member variables
This commit is contained in:
@@ -20,7 +20,7 @@
|
||||
|
||||
// Note the use of std::pair to hold two strings - the running string for the header file and the running string for the c file.
|
||||
|
||||
enum ClosureTypeSpecialType { ClosureTypeRegularNone, ClosureFunctionPointerTypeWithClosedParam };
|
||||
enum ClosureTypeSpecialType { ClosureTypeRegularNone, ClosureFunctionPointerTypeWithoutClosedParam, ClosureFunctionPointerTypeWithClosedParam };
|
||||
|
||||
class CGenerator {
|
||||
public:
|
||||
@@ -55,7 +55,8 @@ class CGenerator {
|
||||
std::string generatorString;
|
||||
std::string linkerString;
|
||||
std::string functionTypedefString;
|
||||
std::map<Type, std::pair<std::string, std::string>> functionTypedefMap;
|
||||
std::string functionTypedefStringPre;
|
||||
std::map<Type, triple<std::string, std::string, std::string>> functionTypedefMap;
|
||||
std::map<std::set<NodeTree<ASTData>*>, std::string> closureStructMap;
|
||||
std::vector<std::vector<NodeTree<ASTData>*>> distructDoubleStack;
|
||||
std::stack<int> loopDistructStackDepth;
|
||||
|
||||
@@ -22,6 +22,21 @@ std::string join(const std::vector<std::string> &strVec, std::string joinStr);
|
||||
std::string readFile(std::istream &file);
|
||||
std::string padWithSpaces(std::string str, int padTo);
|
||||
|
||||
template <typename T, typename U, typename V>
|
||||
class triple {
|
||||
public:
|
||||
T first;
|
||||
U second;
|
||||
V third;
|
||||
};
|
||||
template <typename T, typename U, typename V>
|
||||
triple<T,U,V> make_triple(T f, U s, V t) {
|
||||
triple<T,U,V> out;
|
||||
out.first = f;
|
||||
out.second = s;
|
||||
out.third = t;
|
||||
return out;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
bool contains(std::vector<T> vec, T item) {
|
||||
|
||||
Reference in New Issue
Block a user