diff options
author | Brad King <brad.king@kitware.com> | 2019-02-13 18:42:51 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2019-02-14 15:23:02 (GMT) |
commit | 7ae329e2ed84f62165cb11794ad85c6c43dbd7dc (patch) | |
tree | 1a8c00471ec4e78f6f139858f43f9e239b3e1df0 | |
parent | 6f23321d405930241fa431cfda7650f2993f0c19 (diff) | |
download | CMake-7ae329e2ed84f62165cb11794ad85c6c43dbd7dc.zip CMake-7ae329e2ed84f62165cb11794ad85c6c43dbd7dc.tar.gz CMake-7ae329e2ed84f62165cb11794ad85c6c43dbd7dc.tar.bz2 |
Fortran: Factor out .mod and .smod file name construction
-rw-r--r-- | Source/cmFortranParser.h | 4 | ||||
-rw-r--r-- | Source/cmFortranParserImpl.cxx | 23 |
2 files changed, 21 insertions, 6 deletions
diff --git a/Source/cmFortranParser.h b/Source/cmFortranParser.h index 8d4c90b..cc5c113 100644 --- a/Source/cmFortranParser.h +++ b/Source/cmFortranParser.h @@ -137,6 +137,10 @@ struct cmFortranParser_s bool FindIncludeFile(const char* dir, const char* includeName, std::string& fileName); + std::string ModName(std::string const& mod_name) const; + std::string SModName(std::string const& mod_name, + std::string const& sub_name) const; + // The include file search path. std::vector<std::string> IncludePath; diff --git a/Source/cmFortranParserImpl.cxx b/Source/cmFortranParserImpl.cxx index 45481a4..7b0c1a9 100644 --- a/Source/cmFortranParserImpl.cxx +++ b/Source/cmFortranParserImpl.cxx @@ -69,6 +69,17 @@ cmFortranParser_s::~cmFortranParser_s() cmFortran_yylex_destroy(this->Scanner); } +std::string cmFortranParser_s::ModName(std::string const& mod_name) const +{ + return mod_name + ".mod"; +} + +std::string cmFortranParser_s::SModName(std::string const& mod_name, + std::string const& sub_name) const +{ + return mod_name + "@" + sub_name + ".smod"; +} + bool cmFortranParser_FilePush(cmFortranParser* parser, const char* fname) { // Open the new file and push it onto the stack. Save the old @@ -178,7 +189,7 @@ void cmFortranParser_RuleUse(cmFortranParser* parser, const char* module_name) // syntax: "use module_name" // requires: "module_name.mod" std::string const& mod_name = cmSystemTools::LowerCase(module_name); - parser->Info.Requires.insert(mod_name + ".mod"); + parser->Info.Requires.insert(parser->ModName(mod_name)); } void cmFortranParser_RuleLineDirective(cmFortranParser* parser, @@ -242,7 +253,7 @@ void cmFortranParser_RuleModule(cmFortranParser* parser, // syntax: "module module_name" // provides: "module_name.mod" std::string const& mod_name = cmSystemTools::LowerCase(module_name); - parser->Info.Provides.insert(mod_name + ".mod"); + parser->Info.Provides.insert(parser->ModName(mod_name)); } } @@ -265,8 +276,8 @@ void cmFortranParser_RuleSubmodule(cmFortranParser* parser, std::string const& mod_name = cmSystemTools::LowerCase(module_name); std::string const& sub_name = cmSystemTools::LowerCase(submodule_name); - parser->Info.Requires.insert(mod_name + ".mod"); - parser->Info.Provides.insert(mod_name + "@" + sub_name + ".smod"); + parser->Info.Requires.insert(parser->ModName(mod_name)); + parser->Info.Provides.insert(parser->SModName(mod_name, sub_name)); } void cmFortranParser_RuleSubmoduleNested(cmFortranParser* parser, @@ -286,8 +297,8 @@ void cmFortranParser_RuleSubmoduleNested(cmFortranParser* parser, std::string const& sub_name = cmSystemTools::LowerCase(submodule_name); std::string const& nest_name = cmSystemTools::LowerCase(nested_submodule_name); - parser->Info.Requires.insert(mod_name + "@" + sub_name + ".smod"); - parser->Info.Provides.insert(mod_name + "@" + nest_name + ".smod"); + parser->Info.Requires.insert(parser->SModName(mod_name, sub_name)); + parser->Info.Provides.insert(parser->SModName(mod_name, nest_name)); } void cmFortranParser_RuleDefine(cmFortranParser* parser, const char* macro) |