diff options
author | GriffinR <griffin.richards@comcast.net> | 2019-09-26 15:02:38 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-09-26 15:02:38 -0400 |
commit | 1016b239186097361ea20f2f91adf3932026f40c (patch) | |
tree | 840a0f28046d3c66fcaf1c2bb8ab3228386a3a8a /tools/ramscrgen/main.cpp | |
parent | bb236b490d99fef02ed172e7ca86f6c70ef09527 (diff) | |
parent | 208e1c968959c781562f0b94c03368385ce7012c (diff) |
Merge branch 'master' into rename-tablecmds
Diffstat (limited to 'tools/ramscrgen/main.cpp')
-rw-r--r-- | tools/ramscrgen/main.cpp | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/tools/ramscrgen/main.cpp b/tools/ramscrgen/main.cpp index 6c4f4bbd7..5e5894f47 100644 --- a/tools/ramscrgen/main.cpp +++ b/tools/ramscrgen/main.cpp @@ -27,9 +27,15 @@ void HandleCommonInclude(std::string filename, std::string sourcePath, std::string symOrderPath, std::string lang) { - auto commonSymbols = GetCommonSymbols(sourcePath + "/" + filename); + auto commonSymbols = GetCommonSymbols(sourcePath, filename); + std::size_t dotIndex; - std::size_t dotIndex = filename.find_last_of('.'); + if (filename[0] == '*') { + dotIndex = filename.find_last_of(':'); + filename = filename.substr(dotIndex + 1); + } + + dotIndex = filename.find_last_of('.'); if (dotIndex == std::string::npos) FATAL_ERROR("error: \"%s\" doesn't have a file extension\n", filename.c_str()); @@ -73,7 +79,7 @@ void HandleCommonInclude(std::string filename, std::string sourcePath, std::stri } } -void ConvertSymFile(std::string filename, std::string sectionName, std::string lang, bool common, std::string sourcePath, std::string commonSymPath) +void ConvertSymFile(std::string filename, std::string sectionName, std::string lang, bool common, std::string sourcePath, std::string commonSymPath, std::string libSourcePath) { SymFile symFile(filename); @@ -91,7 +97,7 @@ void ConvertSymFile(std::string filename, std::string sectionName, std::string l symFile.ExpectEmptyRestOfLine(); printf(". = ALIGN(4);\n"); if (common) - HandleCommonInclude(incFilename, sourcePath, commonSymPath, lang); + HandleCommonInclude(incFilename, incFilename[0] == '*' ? libSourcePath : sourcePath, commonSymPath, lang); else printf("%s(%s);\n", incFilename.c_str(), sectionName.c_str()); break; @@ -148,6 +154,7 @@ int main(int argc, char **argv) std::string lang = std::string(argv[3]); std::string sourcePath; std::string commonSymPath; + std::string libSourcePath; if (argc > 4) { @@ -166,8 +173,15 @@ int main(int argc, char **argv) sourcePath = paths.substr(0, commaPos); commonSymPath = paths.substr(commaPos + 1); + commaPos = commonSymPath.find(','); + if (commaPos == std::string::npos) { + libSourcePath = "tools/agbcc/lib"; + } else { + libSourcePath = commonSymPath.substr(commaPos + 1); + commonSymPath = commonSymPath.substr(0, commaPos); + } } - ConvertSymFile(symFileName, sectionName, lang, common, sourcePath, commonSymPath); + ConvertSymFile(symFileName, sectionName, lang, common, sourcePath, commonSymPath, libSourcePath); return 0; } |