1 #ifndef ROSE_COMMANDLINE_UTILITY_H
2 #define ROSE_COMMANDLINE_UTILITY_H
7 #define Rose_STL_Container std::vector
32 ROSE_UTIL_API Rose_STL_Container<std::string>
generateOptionList (
const Rose_STL_Container<std::string> & argList, std::string inputPrefix );
41 ROSE_UTIL_API Rose_STL_Container<std::string>
generateOptionWithNameParameterList ( Rose_STL_Container<std::string> & argList, std::string inputPrefix, std::string newPrefix =
"");
43 extern Rose_STL_Container<std::string> extraCppSourceFileSuffixes;
51 ROSE_UTIL_API
bool isOption ( std::vector<std::string> & argv, std::string optionPrefix, std::string Option,
bool removeOption );
55 ROSE_UTIL_API
bool isOptionWithParameter ( std::vector<std::string> & argv, std::string optionPrefix, std::string Option,
int & optionParameter,
bool removeOption );
58 ROSE_UTIL_API
bool isOptionWithParameter ( std::vector<std::string> & argv, std::string optionPrefix, std::string Option,
float & optionParameter,
bool removeOption );
61 ROSE_DLL_API
bool isOptionWithParameter ( std::vector<std::string> & argv, std::string optionPrefix, std::string Option, std::string & optionParameter,
bool removeOption );
64 ROSE_UTIL_API
void addListToCommandLine ( std::vector<std::string> & argv , std::string prefix, Rose_STL_Container<std::string> argList );
66 ROSE_UTIL_API
void removeArgs ( std::vector<std::string> & argv, std::string prefix );
70 ROSE_UTIL_API
void removeAllFileNamesExcept ( std::vector<std::string> & argv, Rose_STL_Container<std::string> filenameList, std::string exceptFilename );
73 ROSE_UTIL_API std::string
generateStringFromArgList ( Rose_STL_Container<std::string> argList,
bool skipInitialEntry,
bool skipSourceFiles );
76 ROSE_DLL_API Rose_STL_Container<std::string>
generateSourceFilenames ( Rose_STL_Container<std::string> argList,
bool binaryMode );
81 ROSE_UTIL_API
void addCppSourceFileSuffix (
const std::string &suffix );
83 ROSE_UTIL_API
bool isSourceFilename ( std::string name );
85 ROSE_UTIL_API
bool isObjectFilename ( std::string name );
86 ROSE_DLL_API
bool isExecutableFilename ( std::string name );
89 ROSE_DLL_API
bool isValidFileWithExecutableFileSuffixes ( std::string name );
91 ROSE_UTIL_API
bool isCFileNameSuffix (
const std::string & suffix );
94 ROSE_UTIL_API
bool isUPCFileNameSuffix (
const std::string & suffix );
96 ROSE_UTIL_API
bool isCppFileNameSuffix (
const std::string & suffix );
99 ROSE_UTIL_API
bool isFortranFileNameSuffix (
const std::string & suffix );
103 ROSE_UTIL_API
bool isFortranFileNameSuffixRequiringCPP (
const std::string & suffix );
106 ROSE_UTIL_API
bool isFortran77FileNameSuffix (
const std::string & suffix );
107 ROSE_UTIL_API
bool isFortran90FileNameSuffix (
const std::string & suffix );
108 ROSE_UTIL_API
bool isFortran95FileNameSuffix (
const std::string & suffix );
109 ROSE_UTIL_API
bool isFortran2003FileNameSuffix (
const std::string & suffix );
110 ROSE_UTIL_API
bool isFortran2008FileNameSuffix (
const std::string & suffix );
113 ROSE_UTIL_API
bool isCoArrayFortranFileNameSuffix (
const std::string & suffix );
115 ROSE_UTIL_API
bool isPHPFileNameSuffix (
const std::string & suffix );
117 ROSE_UTIL_API
bool isPythonFileNameSuffix (
const std::string & suffix );
120 ROSE_UTIL_API
bool isCsharpFileNameSuffix (
const std::string & suffix );
121 ROSE_UTIL_API
bool isAdaFileNameSuffix (
const std::string & suffix );
122 ROSE_UTIL_API
bool isJovialFileNameSuffix (
const std::string & suffix );
125 ROSE_UTIL_API
bool isCudaFileNameSuffix (
const std::string & suffix );
127 ROSE_UTIL_API
bool isOpenCLFileNameSuffix (
const std::string & suffix );
131 ROSE_UTIL_API
bool isJavaFile(
const std::string &fileName);
132 ROSE_UTIL_API
bool isJavaClassFile(
const std::string &fileName);
133 ROSE_UTIL_API
bool isJavaJarFile(
const std::string &fileName);
134 ROSE_UTIL_API
bool isJavaJvmFile(
const std::string &fileName);
136 ROSE_UTIL_API
bool isX10FileNameSuffix (
const std::string & suffix );
138 ROSE_UTIL_API
void initSourceFileSuffixList();
139 static Rose_STL_Container<std::string> validSourceFileSuffixes;
141 ROSE_UTIL_API
void initObjectFileSuffixList();
142 static Rose_STL_Container<std::string> validObjectFileSuffixes;
144 ROSE_DLL_API
void initExecutableFileSuffixList();
145 static Rose_STL_Container<std::string> validExecutableFileSuffixes;
148 ROSE_DLL_API
bool isOptionTakingSecondParameter( std::string argument );
149 ROSE_DLL_API
bool isOptionTakingThirdParameter ( std::string argument );
157 ROSE_DLL_API std::string
158 findRoseSupportPathFromSource(
const std::string& sourceTreeLocation,
159 const std::string& installTreeLocation);
166 ROSE_DLL_API std::string
167 findRoseSupportPathFromBuild(
const std::string& buildTreeLocation,
168 const std::string& installTreeLocation);
178 roseInstallPrefix(std::string& result);
ROSE_UTIL_API std::vector< std::string > generateOptionListWithDeclaredParameters(const std::vector< std::string > &argList, std::string inputPrefix)
Looks for inputPrefix-prefixed options.
ROSE_DLL_API std::vector< std::string > generateSourceFilenames(std::vector< std::string > argList, bool binaryMode)
Build the list of isolated file names from the command line.
ROSE_UTIL_API std::vector< std::string > generateOptionList(const std::vector< std::string > &argList, std::string inputPrefix)
Looks for inputPrefix prefixed options.
ROSE_UTIL_API bool isOption(std::vector< std::string > &argv, std::string optionPrefix, std::string Option, bool removeOption)
Search 'argv' for an option like optionPrefixOption, remove the option if 'removeOption' is true...
ROSE_UTIL_API std::vector< std::string > generateOptionWithNameParameterList(std::vector< std::string > &argList, std::string inputPrefix, std::string newPrefix="")
Find all options matching 'inputPrefix:optionName' || 'inputPrefix:optionName optionValue' from argLi...
ROSE_UTIL_API void removeArgsWithParameters(std::vector< std::string > &argv, std::string prefix)
Remove all options matching a specified prefix 'prefix' from the argument list 'argv', as well as the option values following them.
ROSE_UTIL_API void removeAllFileNamesExcept(std::vector< std::string > &argv, std::vector< std::string > filenameList, std::string exceptFilename)
Remove file names specified in filenameList from argv, except for 'exceptFilename'.
Command line processing utility functions. Functions in this namespace are in the ROSE Utilities libr...
ROSE_UTIL_API std::vector< std::string > generateArgListFromString(std::string commandline)
Separate a string into individual parameters and store them into a string vector. ...
ROSE_UTIL_API void generateArgcArgvFromList(std::vector< std::string > argList, int &argc, char **&argv)
Convert a string vector back to an argc-argv pair.
ROSE_UTIL_API void addListToCommandLine(std::vector< std::string > &argv, std::string prefix, std::vector< std::string > argList)
Add the strings in argList to the command line represented by argc and argv, prepend 'prefix' to each...
ROSE_UTIL_API std::string generateStringFromArgList(const std::vector< std::string > &argList)
Convert a vector of string to a single string.
ROSE_UTIL_API void addSourceFileSuffix(const std::string &suffix)
Add another valid source file suffix.
ROSE_UTIL_API std::vector< std::string > generateArgListFromArgcArgv(int argc, const char *argv[])
Convert an argc-argv pair into a string vector.
ROSE_UTIL_API void removeArgs(std::vector< std::string > &argv, std::string prefix)
Remove all options matching a specified prefix 'prefix' from the argument list 'argv'.
ROSE_UTIL_API bool isOptionWithParameter(std::vector< std::string > &argv, std::string optionPrefix, std::string Option, int &optionParameter, bool removeOption)
Search 'argv' for 'optionPrefixOption value', store the integer value into 'optionParameter'.