#ifndef CGENERATOR_H #define CGENERATOR_H #include #include #include #include #include #include #include "NodeTree.h" #include "ASTData.h" #include "Type.h" #include "util.h" #include "Poset.h" // 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. class CGenerator { public: CGenerator(); ~CGenerator(); void generateCompSet(std::map*> ASTs, std::string outputName); std::string generateClassStruct(NodeTree* from); bool isUnderTranslationUnit(NodeTree* from, NodeTree* typeDefinition); NodeTree* highestScope(NodeTree* node); std::pair generateTranslationUnit(std::string name, std::map*> ASTs); std::string generate(NodeTree* from, NodeTree* enclosingObject = NULL, bool justFuncName = false); std::string generateAliasChains(std::map*> ASTs, NodeTree* definition); static std::string ValueTypeToCType(Type *type, std::string); static std::string ValueTypeToCTypeDecoration(Type *type); static std::string ValueTypeToCTypeThingHelper(Type *type, std::string ptrStr); static std::string CifyName(std::string name); static std::string scopePrefix(NodeTree* from); std::string generateObjectMethod(NodeTree* enclosingObject, NodeTree* from, std::string *functionPrototype); NodeTree* getMethodsObjectType(NodeTree* scope, std::string functionName); std::string tabs(); int tabLevel; std::string generatorString; std::string linkerString; std::vector*>> deferDoubleStack; std::stack loopDeferStackDepth; private: }; #endif