• R/O
  • SSH
  • HTTPS

oricsdk: Commit


Commit MetaInfo

Revision1700 (tree)
Time2023-09-24 18:25:43
Authordbug

Log Message

Link65 1.0 (Yeah, it's been a 0.xx for wayyyyy too long)
- Added a "-i" option to provide alternative include file paths

Change Summary

Incremental Difference

--- public/pc/tools/osdk/main/link65/includes/infos.h (revision 1699)
+++ public/pc/tools/osdk/main/link65/includes/infos.h (revision 1700)
@@ -48,8 +48,11 @@
4848 0.68 - 2023/01/18
4949 - The 'Unresolved external: <name>' now also specify the filename and line number of the first place where the symbol was requested, as well as the total number of references.
5050
51+1.00 - 2023/09/24
52+- Added a "-i" option to provide alternative include file paths
53+
5154 */
5255
5356
54-#define TOOL_VERSION_MAJOR 0
55-#define TOOL_VERSION_MINOR 68
57+#define TOOL_VERSION_MAJOR 1
58+#define TOOL_VERSION_MINOR 0
--- public/pc/tools/osdk/main/link65/sources/Link65.cpp (revision 1699)
+++ public/pc/tools/osdk/main/link65/sources/Link65.cpp (revision 1700)
@@ -1,4 +1,4 @@
1-/*
1+/*
22
33 The 6502 Linker, for the lcc or similar, that produce .s files to be processed later by a cross assembler
44 (See infos.h for details and version history)
@@ -92,7 +92,7 @@
9292
9393 int Main();
9494
95- bool ParseFile(const std::string& filename);
95+ bool ParseFile(const std::string& filename, const std::vector<std::string>& searchPaths);
9696 LabelState Parseline(char* inpline, bool parseIncludeFiles);
9797
9898 bool LoadLibrary(const std::string& path_library_files);
@@ -112,6 +112,7 @@
112112 // Init the path_library_files variable with default library directory and the output_file_name var with the default go.s
113113 std::string m_PathLibraryFiles = "lib6502\\"; ///< Directory to find library files (Set by -d)
114114 std::string m_PathSourceFiles = ""; ///< Directory to find source files (set by -s)
115+ std::vector<std::string> m_PathHeaderFiles = {""}; ///< Directories to find header files (set by -i)
115116 std::string m_OutputFileName = "go.s"; ///< Output file (set by -o)
116117
117118
@@ -266,7 +267,7 @@
266267 }
267268 else
268269 {
269- ParseFile(filename);
270+ ParseFile(filename, m_PathHeaderFiles);
270271 }
271272 }
272273 return e_NoLabel;
@@ -369,11 +370,18 @@
369370
370371
371372
372-bool Linker::ParseFile(const std::string& filename)
373+bool Linker::ParseFile(const std::string& filename, const std::vector<std::string>& searchPaths)
373374 {
374375 std::vector<std::string> textData;
375- if (!LoadText(filename.c_str(),textData))
376+ for (const auto& path : searchPaths)
376377 {
378+ if (LoadText(path+filename, textData))
379+ {
380+ break;
381+ }
382+ }
383+ if (textData.empty())
384+ {
377385 ShowError("\nCannot open %s \n", filename.c_str());
378386 }
379387
@@ -595,6 +603,17 @@
595603 m_PathSourceFiles=GetStringValue();
596604 }
597605 else
606+ if (IsSwitch("-i") || IsSwitch("-I"))
607+ {
608+ // Directory to find header files.Next arg in line is the dir name
609+ if (!ProcessNextArgument() || !IsParameter())
610+ {
611+ printf(" Must have dir name after -h option\n");
612+ exit(1);
613+ }
614+ m_PathHeaderFiles.push_back(GetStringValue());
615+ }
616+ else
598617 if (IsSwitch("-o") || IsSwitch("-O"))
599618 {
600619 // Output file. Default is go.s . Next arg in line is the file name. e.g : link65 -o out.s test.s
@@ -681,7 +700,7 @@
681700 k=1;
682701 }
683702
684- ParseFile(m_InputFileList[k].m_FileName);
703+ ParseFile(m_InputFileList[k].m_FileName, {""});
685704
686705 //
687706 // Check if used labels are defined inside the files
@@ -879,6 +898,7 @@
879898 " -d : Directory to find library files.Next arg in line is the dir name.\r\n"
880899 " e.g : link65 -d /usr/oric/lib/ test.s\r\n"
881900 " -s : Directory to find source files.Next arg in line is the dir name.\r\n"
901+ " -i : Directory to find include files.Next arg in line is the dir name.\r\n"
882902 " -o : Output file. Default is go.s . Next arg in line is the file name.\r\n"
883903 " e.g : link65 -o out.s test.s\r\n"
884904 " -l : Print out defined labels.Usefull when building lib index files.\r\n"
Show on old repository browser