summaryrefslogtreecommitdiff
path: root/tools/src/preproc/preproc.cpp
diff options
context:
space:
mode:
authornotyourav <65437533+notyourav@users.noreply.github.com>2022-05-17 14:35:16 -0700
committerGitHub <noreply@github.com>2022-05-17 14:35:16 -0700
commit3afbd0e9012be95e687ccb36eb62f6df08cded19 (patch)
tree00b83f84cdefeaa6d4e334d3154278589bdb76b5 /tools/src/preproc/preproc.cpp
parent393db92f245c93927fd402738db8a04f61e0d56d (diff)
parentaceb014a82c89fd1783dc13e7eb3cffc26ac4ca4 (diff)
Merge pull request #516 from hatal175/enumasm
Initial version of enum extractor script
Diffstat (limited to 'tools/src/preproc/preproc.cpp')
-rw-r--r--tools/src/preproc/preproc.cpp16
1 files changed, 13 insertions, 3 deletions
diff --git a/tools/src/preproc/preproc.cpp b/tools/src/preproc/preproc.cpp
index 2aada83d..40bc66e2 100644
--- a/tools/src/preproc/preproc.cpp
+++ b/tools/src/preproc/preproc.cpp
@@ -19,7 +19,9 @@
// THE SOFTWARE.
#include <string>
+#include <cstring>
#include <stack>
+#include <vector>
#include "preproc.h"
#include "asm_file.h"
#include "c_file.h"
@@ -27,6 +29,7 @@
Charmap* g_charmap;
std::string g_buildName;
+std::vector<std::string> g_incPaths;
void PrintAsmBytes(unsigned char* s, int length) {
if (length > 0) {
@@ -117,13 +120,20 @@ char* GetFileExtension(char* filename) {
}
int main(int argc, char** argv) {
- if (argc != 4 && argc != 3) {
- std::fprintf(stderr, "Usage: %s BUILD_NAME SRC_FILE CHARMAP_FILE", argv[0]);
+ if (argc < 3) {
+ std::fprintf(stderr, "Usage: %s BUILD_NAME SRC_FILE [CHARMAP_FILE] -- [ASM INC PATH] ...", argv[0]);
return 1;
}
+ int pathStart = 0;
+ while (pathStart < argc && strcmp(argv[pathStart], "--") != 0) pathStart++;
+
+ for (int i = pathStart + 1; i < argc; i++) {
+ g_incPaths.push_back(argv[i]);
+ }
+
g_buildName = std::string(argv[1]);
- g_charmap = new Charmap(argc == 4 ? argv[3] : "");
+ g_charmap = new Charmap(argc > 3 && pathStart > 3 ? argv[3] : "");
char* extension = GetFileExtension(argv[2]);