ROSE  0.9.6a
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
commandline_processing.h
Go to the documentation of this file.
1 #ifndef ROSE_COMMANDLINE_UTILITY_H
2 #define ROSE_COMMANDLINE_UTILITY_H
3 #include "setup.h"
4 //#include "rosedefs.h"
5 #include "rosedll.h"
6 #include <list>
7 #define Rose_STL_Container std::vector
8 
9 //Rama (12/22/2006): changing the class to a namespace and removing the "static"ness of the "member" functions
10 
11 namespace CommandlineProcessing
12  {
14  ROSE_UTIL_API Rose_STL_Container<std::string> generateArgListFromString ( std::string commandline );
15 
17  // std::string generateStringFromArgList( Rose_STL_Container<std::string> & argList);
18  ROSE_UTIL_API std::string generateStringFromArgList( const Rose_STL_Container<std::string> & argList);
19 
21  ROSE_UTIL_API Rose_STL_Container<std::string> generateArgListFromArgcArgv ( int argc, const char* argv[] );
22 
23  inline Rose_STL_Container<std::string> generateArgListFromArgcArgv ( int argc, char* argv[] )
24  {return generateArgListFromArgcArgv(argc, (const char**)argv);}
25 
27  ROSE_UTIL_API void generateArgcArgvFromList ( Rose_STL_Container<std::string> argList, int & argc, char** & argv );
28 
31  ROSE_UTIL_API Rose_STL_Container<std::string> generateOptionList (const Rose_STL_Container<std::string> & argList, std::string inputPrefix );
32 
35  ROSE_UTIL_API Rose_STL_Container<std::string> generateOptionListWithDeclaredParameters (const Rose_STL_Container<std::string> & argList, std::string inputPrefix );
36 
40  ROSE_UTIL_API Rose_STL_Container<std::string> generateOptionWithNameParameterList ( Rose_STL_Container<std::string> & argList, std::string inputPrefix, std::string newPrefix = "");
41 
42  extern Rose_STL_Container<std::string> extraCppSourceFileSuffixes;
43 
45 
50  ROSE_UTIL_API bool isOption ( std::vector<std::string> & argv, std::string optionPrefix, std::string Option, bool removeOption );
51 
54  ROSE_UTIL_API bool isOptionWithParameter ( std::vector<std::string> & argv, std::string optionPrefix, std::string Option, int & optionParameter, bool removeOption );
55 
57  ROSE_UTIL_API bool isOptionWithParameter ( std::vector<std::string> & argv, std::string optionPrefix, std::string Option, float & optionParameter, bool removeOption );
58 
60  ROSE_DLL_API bool isOptionWithParameter ( std::vector<std::string> & argv, std::string optionPrefix, std::string Option, std::string & optionParameter, bool removeOption );
61 
63  ROSE_UTIL_API void addListToCommandLine ( std::vector<std::string> & argv , std::string prefix, Rose_STL_Container<std::string> argList );
65  ROSE_UTIL_API void removeArgs ( std::vector<std::string> & argv, std::string prefix );
67  ROSE_UTIL_API void removeArgsWithParameters ( std::vector<std::string> & argv, std::string prefix );
69  ROSE_UTIL_API void removeAllFileNamesExcept ( std::vector<std::string> & argv, Rose_STL_Container<std::string> filenameList, std::string exceptFilename );
70 
72  ROSE_UTIL_API std::string generateStringFromArgList ( Rose_STL_Container<std::string> argList, bool skipInitialEntry, bool skipSourceFiles );
73 
75  ROSE_DLL_API Rose_STL_Container<std::string> generateSourceFilenames ( Rose_STL_Container<std::string> argList, bool binaryMode );
76 
77  // DQ and PC (6/1/2006): Added Peter's suggested fixes to support auto-documentation.
79  ROSE_UTIL_API void addSourceFileSuffix ( const std::string &suffix );
80  ROSE_UTIL_API void addCppSourceFileSuffix ( const std::string &suffix );
81 
82  ROSE_UTIL_API bool isSourceFilename ( std::string name );
83 
84  ROSE_UTIL_API bool isObjectFilename ( std::string name );
85  ROSE_DLL_API bool isExecutableFilename ( std::string name );
86 
87  // DQ (8/20/2008): Added test that will allow bogus exececutable files (marked as .exe but not executable) to pass
89 
90  ROSE_UTIL_API bool isCFileNameSuffix ( const std::string & suffix );
91 
92  // Liao (6/6/2008): Added support for UPC file suffix name
93  ROSE_UTIL_API bool isUPCFileNameSuffix ( const std::string & suffix );
94 
95  ROSE_UTIL_API bool isCppFileNameSuffix ( const std::string & suffix );
96 
97  // DQ (8/7/2007): Added support for Fortran file suffix names.
98  ROSE_UTIL_API bool isFortranFileNameSuffix ( const std::string & suffix );
99 
100  // DQ (5/18/2008): Support to marking when C preprocessing is required for
101  // Fortran files, default is true for C and C++.
102  ROSE_UTIL_API bool isFortranFileNameSuffixRequiringCPP ( const std::string & suffix );
103 
104  // DQ (11/17/2007): Added fortran mode specific suffix checking
105  ROSE_UTIL_API bool isFortran77FileNameSuffix ( const std::string & suffix );
106  ROSE_UTIL_API bool isFortran90FileNameSuffix ( const std::string & suffix );
107  ROSE_UTIL_API bool isFortran95FileNameSuffix ( const std::string & suffix );
108  ROSE_UTIL_API bool isFortran2003FileNameSuffix ( const std::string & suffix );
109  ROSE_UTIL_API bool isFortran2008FileNameSuffix ( const std::string & suffix );
110 
111  // DQ (1/23/2009): Added support for Co-Array Fortran file extension.
112  ROSE_UTIL_API bool isCoArrayFortranFileNameSuffix ( const std::string & suffix );
113 
114  ROSE_UTIL_API bool isPHPFileNameSuffix ( const std::string & suffix );
115 
116  ROSE_UTIL_API bool isPythonFileNameSuffix ( const std::string & suffix );
117 
118  // TV (05/17/2010) Support for CUDA
119  ROSE_UTIL_API bool isCudaFileNameSuffix ( const std::string & suffix );
120  // TV (05/17/2010) Support for OpenCL
121  ROSE_UTIL_API bool isOpenCLFileNameSuffix ( const std::string & suffix );
122 
123  // DQ (10/11/2010): Adding Java support.
124  ROSE_UTIL_API bool isJavaFileNameSuffix ( const std::string & suffix );
125  ROSE_UTIL_API bool isX10FileNameSuffix (const std::string& suffix);
126 
128  static Rose_STL_Container<std::string> validSourceFileSuffixes;
129 
131  static Rose_STL_Container<std::string> validObjectFileSuffixes;
132 
134  static Rose_STL_Container<std::string> validExecutableFileSuffixes;
135 
136  // bool isOptionTakingFileName( std::string argument );
137  ROSE_DLL_API bool isOptionTakingSecondParameter( std::string argument );
138  ROSE_DLL_API bool isOptionTakingThirdParameter ( std::string argument );
139  };
140 
141 // DQ (4/5/2010): This are defined in sage_support.cpp
146 ROSE_DLL_API std::string
147 findRoseSupportPathFromSource(const std::string& sourceTreeLocation,
148  const std::string& installTreeLocation);
149 
150 // DQ (4/5/2010): This are defined in sage_support.cpp
155 ROSE_DLL_API std::string
156 findRoseSupportPathFromBuild(const std::string& buildTreeLocation,
157  const std::string& installTreeLocation);
158 
159 // DQ (4/5/2010): This are defined in sage_support.cpp
166 ROSE_DLL_API bool
167 roseInstallPrefix(std::string& result);
168 
169 // endif associated with define ROSE_COMMANDLINE_UTILITY_H
170 #endif