mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-07 14:20:06 -06:00
Fortran: Factor out .mod and .smod file name construction
This commit is contained in:
@@ -137,6 +137,10 @@ struct cmFortranParser_s
|
|||||||
bool FindIncludeFile(const char* dir, const char* includeName,
|
bool FindIncludeFile(const char* dir, const char* includeName,
|
||||||
std::string& fileName);
|
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.
|
// The include file search path.
|
||||||
std::vector<std::string> IncludePath;
|
std::vector<std::string> IncludePath;
|
||||||
|
|
||||||
|
|||||||
@@ -69,6 +69,17 @@ cmFortranParser_s::~cmFortranParser_s()
|
|||||||
cmFortran_yylex_destroy(this->Scanner);
|
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)
|
bool cmFortranParser_FilePush(cmFortranParser* parser, const char* fname)
|
||||||
{
|
{
|
||||||
// Open the new file and push it onto the stack. Save the old
|
// 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"
|
// syntax: "use module_name"
|
||||||
// requires: "module_name.mod"
|
// requires: "module_name.mod"
|
||||||
std::string const& mod_name = cmSystemTools::LowerCase(module_name);
|
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,
|
void cmFortranParser_RuleLineDirective(cmFortranParser* parser,
|
||||||
@@ -242,7 +253,7 @@ void cmFortranParser_RuleModule(cmFortranParser* parser,
|
|||||||
// syntax: "module module_name"
|
// syntax: "module module_name"
|
||||||
// provides: "module_name.mod"
|
// provides: "module_name.mod"
|
||||||
std::string const& mod_name = cmSystemTools::LowerCase(module_name);
|
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& mod_name = cmSystemTools::LowerCase(module_name);
|
||||||
std::string const& sub_name = cmSystemTools::LowerCase(submodule_name);
|
std::string const& sub_name = cmSystemTools::LowerCase(submodule_name);
|
||||||
parser->Info.Requires.insert(mod_name + ".mod");
|
parser->Info.Requires.insert(parser->ModName(mod_name));
|
||||||
parser->Info.Provides.insert(mod_name + "@" + sub_name + ".smod");
|
parser->Info.Provides.insert(parser->SModName(mod_name, sub_name));
|
||||||
}
|
}
|
||||||
|
|
||||||
void cmFortranParser_RuleSubmoduleNested(cmFortranParser* parser,
|
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& sub_name = cmSystemTools::LowerCase(submodule_name);
|
||||||
std::string const& nest_name =
|
std::string const& nest_name =
|
||||||
cmSystemTools::LowerCase(nested_submodule_name);
|
cmSystemTools::LowerCase(nested_submodule_name);
|
||||||
parser->Info.Requires.insert(mod_name + "@" + sub_name + ".smod");
|
parser->Info.Requires.insert(parser->SModName(mod_name, sub_name));
|
||||||
parser->Info.Provides.insert(mod_name + "@" + nest_name + ".smod");
|
parser->Info.Provides.insert(parser->SModName(mod_name, nest_name));
|
||||||
}
|
}
|
||||||
|
|
||||||
void cmFortranParser_RuleDefine(cmFortranParser* parser, const char* macro)
|
void cmFortranParser_RuleDefine(cmFortranParser* parser, const char* macro)
|
||||||
|
|||||||
Reference in New Issue
Block a user