1#ifndef ROSE_COMMANDLINE_UTILITY_H
2#define ROSE_COMMANDLINE_UTILITY_H
32 ROSE_UTIL_API Rose_STL_Container<std::string>
generateOptionList (
const Rose_STL_Container<std::string> & argList, std::string inputPrefix );
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 );
86 ROSE_UTIL_API
bool isSourceFilename (
const std::string& name,
bool isAdaProject =
false );
88 ROSE_UTIL_API
bool isObjectFilename ( std::string name );
89 ROSE_DLL_API
bool isExecutableFilename ( std::string name );
92 ROSE_DLL_API
bool isValidFileWithExecutableFileSuffix ( std::string name );
94 ROSE_UTIL_API
bool isCFileNameSuffix (
const std::string & suffix );
97 ROSE_UTIL_API
bool isUPCFileNameSuffix (
const std::string & suffix );
99 ROSE_UTIL_API
bool isCppFileNameSuffix (
const std::string & suffix );
102 ROSE_UTIL_API
bool isFortranFileNameSuffix (
const std::string & suffix );
106 ROSE_UTIL_API
bool isFortranFileNameSuffixRequiringCPP (
const std::string & suffix );
109 ROSE_UTIL_API
bool isFortran77FileNameSuffix (
const std::string & suffix );
110 ROSE_UTIL_API
bool isFortran90FileNameSuffix (
const std::string & suffix );
111 ROSE_UTIL_API
bool isFortran95FileNameSuffix (
const std::string & suffix );
112 ROSE_UTIL_API
bool isFortran2003FileNameSuffix (
const std::string & suffix );
113 ROSE_UTIL_API
bool isFortran2008FileNameSuffix (
const std::string & suffix );
116 ROSE_UTIL_API
bool isCoArrayFortranFileNameSuffix (
const std::string & suffix );
118 ROSE_UTIL_API
bool isPHPFileNameSuffix (
const std::string & suffix );
120 ROSE_UTIL_API
bool isPythonFileNameSuffix (
const std::string & suffix );
123 ROSE_UTIL_API
bool isCsharpFileNameSuffix (
const std::string & suffix );
129 ROSE_UTIL_API
bool isJovialFileNameSuffix (
const std::string & suffix );
132 ROSE_UTIL_API
bool isCudaFileNameSuffix (
const std::string & suffix );
134 ROSE_UTIL_API
bool isOpenCLFileNameSuffix (
const std::string & suffix );
138 ROSE_UTIL_API
bool isJavaFile(
const std::string &fileName);
139 ROSE_UTIL_API
bool isJavaClassFile(
const std::string &fileName);
140 ROSE_UTIL_API
bool isJavaJarFile(
const std::string &fileName);
141 ROSE_UTIL_API
bool isJavaJvmFile(
const std::string &fileName);
143 ROSE_UTIL_API
void initSourceFileSuffixList();
144 static Rose_STL_Container<std::string> validSourceFileSuffixes;
146 ROSE_UTIL_API
void initObjectFileSuffixList();
147 static Rose_STL_Container<std::string> validObjectFileSuffixes;
149 ROSE_DLL_API
void initExecutableFileSuffixList();
150 static Rose_STL_Container<std::string> validExecutableFileSuffixes;
153 ROSE_DLL_API
bool isOptionTakingSecondParameter( std::string argument );
154 ROSE_DLL_API
bool isOptionTakingThirdParameter ( std::string argument );
162ROSE_DLL_API std::string
163findRoseSupportPathFromSource(
const std::string& sourceTreeLocation,
164 const std::string& installTreeLocation);
171ROSE_DLL_API std::string
172findRoseSupportPathFromBuild(
const std::string& buildTreeLocation,
173 const std::string& installTreeLocation);
183roseInstallPrefix(std::string& result);
Command line processing utility functions. Functions in this namespace are in the ROSE Utilities libr...
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'.
ROSE_UTIL_API bool isSourceFilename(const std::string &name, bool isAdaProject=false)
tests if name refers to a source file.
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 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 removeArgs(std::vector< std::string > &argv, std::string prefix)
Remove all options matching a specified prefix 'prefix' from the argument list 'argv'.
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 > generateArgListFromString(std::string commandline)
Separate a string into individual parameters and store them into a string vector.
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',...
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'.
ROSE_UTIL_API bool isAdaFileNameSuffix(const std::string &suffix, bool isAdaProject)
tests if suffix refers to a file extension for Ada.
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 void addCppSourceFileSuffix(const std::string &suffix)
Add another valid source file suffix (warning deprecated as it is not consistently used)
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 > generateOptionList(const std::vector< std::string > &argList, std::string inputPrefix)
Looks for inputPrefix prefixed options.
ROSE_UTIL_API std::string generateStringFromArgList(const std::vector< std::string > &argList)
Convert a vector of string to a single string.
ROSE_UTIL_API std::vector< std::string > generateOptionListWithDeclaredParameters(const std::vector< std::string > &argList, std::string inputPrefix)
Looks for inputPrefix-prefixed options.
ROSE_UTIL_API void generateArgcArgvFromList(std::vector< std::string > argList, int &argc, char **&argv)
Convert a string vector back to an argc-argv pair.