Commit 7ae329e2 authored by Brad King's avatar Brad King

Fortran: Factor out .mod and .smod file name construction

parent 6f23321d
......@@ -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;
......
......@@ -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)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment