transformationSupport.h

Go to the documentation of this file.
00001 #ifndef ROSE_TRANSFORMATION_SUPPORT
00002 #define ROSE_TRANSFORMATION_SUPPORT
00003 
00004 // #include "transformationOptions.h"
00005 
00006 #include "optionDeclaration.h"
00007 
00008 // Access to Query Libraries
00009 #include "roseQueryLib.h"
00010 
00011 // include "nodeQuery.h"
00012 // include "nameQuery.h"
00013 // include "numberQuery.h"
00014 
00024 class TransformationSupport
00025    {
00026      public:
00027 
00037           enum operatorCodeType
00038              {
00040                FUNCTION_CALL_OPERATOR_CODE = 0,
00041 
00042             // binary operators
00043                ADD_OPERATOR_CODE          = 1,
00044                SUBT_OPERATOR_CODE         = 2,
00045                MULT_OPERATOR_CODE         = 3,
00046                DIV_OPERATOR_CODE          = 4,
00047                INTEGER_DIV_OPERATOR_CODE  = 5,
00048                MOD_OPERATOR_CODE          = 6,
00049                AND_OPERATOR_CODE          = 7,
00050                OR_OPERATOR_CODE           = 8,
00051                BITXOR_OPERATOR_CODE       = 9,
00052                BITAND_OPERATOR_CODE       = 10,
00053                BITOR_OPERATOR_CODE        = 11,
00054                EQ_OPERATOR_CODE           = 12,
00055                LT_OPERATOR_CODE           = 13,
00056                GT_OPERATOR_CODE           = 14,
00057                NE_OPERATOR_CODE           = 15,
00058                LE_OPERATOR_CODE           = 16,
00059                GE_OPERATOR_CODE           = 17,
00060                ASSIGN_OPERATOR_CODE       = 18,
00061                PLUS_ASSIGN_OPERATOR_CODE  = 19,
00062                MINUS_ASSIGN_OPERATOR_CODE = 20,
00063                AND_ASSIGN_OPERATOR_CODE   = 21,
00064                IOR_ASSIGN_OPERATOR_CODE   = 22,
00065                MULT_ASSIGN_OPERATOR_CODE  = 23,
00066                DIV_ASSIGN_OPERATOR_CODE   = 24,
00067                MOD_ASSIGN_OPERATOR_CODE   = 25,
00068                XOR_ASSIGN_OPERATOR_CODE   = 26,
00069 
00070             // operator() and operator[]
00071                PARENTHESIS_OPERATOR_CODE  = 27,
00072                BRACKET_OPERATOR_CODE      = 28,
00073 
00074             // unary operators
00075                NOT_OPERATOR_CODE          = 29,
00076                DEREFERENCE_OPERATOR_CODE  = 30,
00077                ADDRESS_OPERATOR_CODE      = 31,
00078                LSHIFT_OPERATOR_CODE       = 32,
00079                RSHIFT_OPERATOR_CODE       = 33,
00080                LSHIFT_ASSIGN_OPERATOR_CODE      = 34,
00081                RSHIFT_ASSIGN_OPERATOR_CODE      = 35,
00082                PREFIX_PLUSPLUS_OPERATOR_CODE    = 36,
00083                POSTFIX_PLUSPLUS_OPERATOR_CODE   = 37,
00084                PREFIX_MINUSMINUS_OPERATOR_CODE  = 38,
00085                POSTFIX_MINUSMINUS_OPERATOR_CODE = 39,
00086 
00087             // End of list tag
00088                OPERATOR_CODE_LAST_TAG = 99
00089              };
00090 
00097           static std::string stringifyOperator (std::string name);
00098 
00108           static operatorCodeType classifyOverloadedOperator (
00109                std::string name,
00110                int numberOfParameters = 0,
00111                bool prefixOperator    = false);
00112 
00119           static std::string buildOperatorString ( SgNode* astNode );
00120 
00122           static std::string getFunctionName ( SgFunctionCallExp* functionCallExp );
00124           static std::string getTypeName ( SgType* type );
00125 
00132           static std::string getFunctionTypeName ( SgFunctionCallExp* functionCallExpression );
00133 
00140           static std::string buildMacro ( std::string s );
00141 
00159           static void getTransformationOptions (
00160                     SgNode* astNode,
00161                     std::list<OptionDeclaration> & variableNameList,
00162                     std::string identifingTypeName );
00163 
00171           static void getTransformationOptions (
00172                     SgNode* astNode,
00173                     std::list<int> & variableNameList,
00174                     std::string identifingTypeName );
00175 
00180           static void getTransformationOptionsFromVariableDeclarationConstructorArguments (
00181                     SgVariableDeclaration* variableDeclaration,
00182                     std::list<int> & returnList );
00183 
00188           static void getTransformationOptionsFromVariableDeclarationConstructorArguments (
00189                     SgVariableDeclaration* variableDeclaration,
00190                     std::list<OptionDeclaration> & returnList );
00201           static std::string internalSupportingGlobalDeclarations( SgNode* astNode, std::string prefixString );
00202 
00203        // DQ (9/26/03) Added here to eliminate ProjectQueryLibrary 
00204        // (which as mostly an experiment with the reverse traversal)
00205           static SgProject* getProject( const SgNode* astNode);
00206           static SgDirectory* getDirectory( const SgNode* astNode);
00207           static SgFile* getFile( const SgNode* astNode);
00208           static SgSourceFile* getSourceFile( const SgNode* astNode);
00209           static SgBinaryComposite* getBinaryFile( const SgNode* astNode);
00210           static SgGlobal* getGlobalScope( const SgNode* astNode);
00211           static SgStatement* getStatement(const SgNode* astNode);
00212           static SgFunctionDeclaration* getFunctionDeclaration( const SgNode* astNode);
00213           static SgFunctionDefinition* getFunctionDefinition( const SgNode* astNode);
00214           static SgClassDefinition* getClassDefinition( const SgNode* astNode);
00215           static SgModuleStatement* getModuleStatement( const SgNode* astNode);
00216 
00217        // DQ (5/11/2011): This function was moved to SgTemplateArgument a long time ago and is not longer available.
00218        // DQ (6/9/2007): This function traverses through the parents to the first scope (used for name qualification support of template arguments)
00219        // static SgScopeStatement* getScope(const SgNode* astNode);
00220 
00221        // static SgValueExp* getValueExpr(const SgNode* astNode);
00222    };
00223 
00224 // endif for ROSE_TRANSFORMATION_SUPPORT
00225 #endif
00226 
00227 
00228 
00229 
00230 
00231 
00232 
00233 
00234 
00235 
00236 
00237 
00238 
00239 
00240 
00241 
00242 
00243 
00244 
00245 

Generated on Sat May 19 00:53:07 2012 for ROSE by  doxygen 1.4.7