commandline_processing.h

Go to the documentation of this file.
00001 #ifndef ROSE_COMMANDLINE_UTILITY_H
00002 #define ROSE_COMMANDLINE_UTILITY_H
00003 #include "setup.h"
00004 //#include "rosedefs.h"
00005 #include <list>
00006 #define Rose_STL_Container std::vector
00007 
00008 //Rama (12/22/2006): changing the class to a namespace and removing the "static"ness of the "member" functions
00009 
00010 namespace CommandlineProcessing
00011    {
00013           Rose_STL_Container<std::string> generateArgListFromString ( std::string commandline );
00014 
00016        // std::string generateStringFromArgList( Rose_STL_Container<std::string> & argList);
00017           std::string generateStringFromArgList( const Rose_STL_Container<std::string> & argList);
00018 
00020           Rose_STL_Container<std::string> generateArgListFromArgcArgv ( int argc, const char* argv[] );
00021           
00022           inline Rose_STL_Container<std::string> generateArgListFromArgcArgv ( int argc, char* argv[] ) 
00023           {return generateArgListFromArgcArgv(argc, (const char**)argv);}
00024           
00026           void generateArgcArgvFromList ( Rose_STL_Container<std::string> argList, int & argc, char** & argv );
00027 
00028           Rose_STL_Container<std::string> generateOptionList ( Rose_STL_Container<std::string> & argList, std::string inputPrefix );
00029 
00032           Rose_STL_Container<std::string> generateOptionWithNameParameterList ( Rose_STL_Container<std::string> & argList, std::string inputPrefix );
00033 
00034           extern Rose_STL_Container<std::string> extraCppSourceFileSuffixes;
00035 
00037 
00042           bool isOption ( std::vector<std::string> & argv, std::string optionPrefix, std::string Option, bool removeOption );
00043 
00046           bool isOptionWithParameter ( std::vector<std::string> & argv, std::string optionPrefix, std::string Option, int & optionParameter, bool removeOption );
00047 
00049           bool isOptionWithParameter ( std::vector<std::string> & argv, std::string optionPrefix, std::string Option, float & optionParameter, bool removeOption );
00050 
00052           bool isOptionWithParameter ( std::vector<std::string> & argv, std::string optionPrefix, std::string Option, std::string & optionParameter, bool removeOption );
00053 
00055           void addListToCommandLine ( std::vector<std::string> & argv , std::string prefix, Rose_STL_Container<std::string> argList );
00057           void removeArgs ( std::vector<std::string> & argv, std::string prefix );
00059           void removeArgsWithParameters ( std::vector<std::string> & argv, std::string prefix );
00061           void removeAllFileNamesExcept ( std::vector<std::string> & argv, Rose_STL_Container<std::string> filenameList, std::string exceptFilename );
00062 
00064           std::string generateStringFromArgList ( Rose_STL_Container<std::string> argList, bool skipInitialEntry, bool skipSourceFiles );
00065 
00067           Rose_STL_Container<std::string> generateSourceFilenames ( Rose_STL_Container<std::string> argList, bool binaryMode );
00068 
00069        // DQ and PC (6/1/2006): Added Peter's suggested fixes to support auto-documentation.
00071           void addSourceFileSuffix ( const std::string &suffix );
00072           void addCppSourceFileSuffix ( const std::string &suffix );
00073 
00074           bool isSourceFilename ( std::string name ); 
00075 
00076           bool isObjectFilename ( std::string name );
00077           bool isExecutableFilename ( std::string name );
00078 
00079        // DQ (8/20/2008): Added test that will allow bogus exececutable files (marked as .exe but not executable) to pass
00080           bool isValidFileWithExecutableFileSuffixes ( std::string name );
00081 
00082           bool isCFileNameSuffix ( const std::string & suffix );
00083 
00084        // Liao (6/6/2008): Added support for UPC file suffix name    
00085           bool isUPCFileNameSuffix ( const std::string & suffix );
00086 
00087           bool isCppFileNameSuffix ( const std::string & suffix );
00088 
00089        // DQ (8/7/2007): Added support for Fortran file suffix names.
00090           bool isFortranFileNameSuffix ( const std::string & suffix );
00091 
00092        // DQ (5/18/2008): Support to marking when C preprocessing is required for 
00093        // Fortran files, default is true for C and C++.
00094           bool isFortranFileNameSuffixRequiringCPP ( const std::string & suffix );
00095 
00096        // DQ (11/17/2007): Added fortran mode specific suffix checking
00097           bool isFortran77FileNameSuffix   ( const std::string & suffix );
00098           bool isFortran90FileNameSuffix   ( const std::string & suffix );
00099           bool isFortran95FileNameSuffix   ( const std::string & suffix );
00100           bool isFortran2003FileNameSuffix ( const std::string & suffix );
00101           bool isFortran2008FileNameSuffix ( const std::string & suffix );
00102 
00103        // DQ (1/23/2009): Added support for Co-Array Fortran file extension.
00104           bool isCoArrayFortranFileNameSuffix ( const std::string & suffix );
00105 
00106           bool isPHPFileNameSuffix ( const std::string & suffix );
00107 
00108           bool isPythonFileNameSuffix ( const std::string & suffix );
00109 
00110        // TV (05/17/2010) Support for CUDA
00111           bool isCudaFileNameSuffix ( const std::string & suffix );
00112        // TV (05/17/2010) Support for OpenCL
00113           bool isOpenCLFileNameSuffix ( const std::string & suffix );
00114 
00115        // DQ (10/11/2010): Adding Java support.
00116           bool isJavaFileNameSuffix ( const std::string & suffix );
00117 
00118           void initSourceFileSuffixList();
00119           static Rose_STL_Container<std::string> validSourceFileSuffixes;
00120           
00121           void initObjectFileSuffixList();
00122           static Rose_STL_Container<std::string> validObjectFileSuffixes;
00123 
00124           void initExecutableFileSuffixList();
00125           static Rose_STL_Container<std::string> validExecutableFileSuffixes;
00126 
00127        // bool isOptionTakingFileName( std::string argument );
00128           bool isOptionTakingSecondParameter( std::string argument );
00129           bool isOptionTakingThirdParameter ( std::string argument );
00130    };
00131 
00132 // DQ (4/5/2010): This are defined in sageSupport.C
00137 std::string
00138 findRoseSupportPathFromSource(const std::string& sourceTreeLocation,
00139                               const std::string& installTreeLocation);
00140 
00141 // DQ (4/5/2010): This are defined in sageSupport.C
00146 std::string
00147 findRoseSupportPathFromBuild(const std::string& buildTreeLocation,
00148                              const std::string& installTreeLocation);
00149 
00150 // DQ (4/5/2010): This are defined in sageSupport.C
00157 bool
00158 roseInstallPrefix(std::string& result);
00159 
00160 // endif associated with define ROSE_COMMANDLINE_UTILITY_H
00161 #endif

Generated on Tue Jan 31 05:31:20 2012 for ROSE by  doxygen 1.4.7