summaryrefslogtreecommitdiff
path: root/tools/src/preproc/preproc.cpp
diff options
context:
space:
mode:
authorTal Hayon <talhayon1@gmail.com>2022-05-13 18:44:14 +0300
committerTal Hayon <talhayon1@gmail.com>2022-05-13 21:46:39 +0300
commit2062499f0c17e7564e30b4a9c7ae96a32491c5c1 (patch)
tree31962be30046c40c67b27ef14afed943466ff5fa /tools/src/preproc/preproc.cpp
parentb675bce0d1d75cf2c703fb26e5e864e3ee789b8e (diff)
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]);