about summary refs log tree commit diff stats
path: root/wrapperhelper/src/preproc_private.h
diff options
context:
space:
mode:
authorrajdakin <rajdakin@gmail.com>2024-09-07 15:20:17 +0200
committerGitHub <noreply@github.com>2024-09-07 15:20:17 +0200
commitf0d7582845e124ed61b86f43da30a7b3f3f0c3f5 (patch)
tree2ee0c53821805b33ca47e0919fea95ccb920cd52 /wrapperhelper/src/preproc_private.h
parent75bdb328284b8e5b6827eeb7d5cedef26222e7db (diff)
downloadbox64-f0d7582845e124ed61b86f43da30a7b3f3f0c3f5.tar.gz
box64-f0d7582845e124ed61b86f43da30a7b3f3f0c3f5.zip
Upgraded the wrapper helper (#1803)
* [WRAPPERHELPER] Fixed unsigned comparison in macros, added macro expanding in include commands, added -I option

* [WRAPPERHELPER] Forgot the README
Diffstat (limited to 'wrapperhelper/src/preproc_private.h')
-rw-r--r--wrapperhelper/src/preproc_private.h39
1 files changed, 39 insertions, 0 deletions
diff --git a/wrapperhelper/src/preproc_private.h b/wrapperhelper/src/preproc_private.h
new file mode 100644
index 00000000..d1b5f804
--- /dev/null
+++ b/wrapperhelper/src/preproc_private.h
@@ -0,0 +1,39 @@
+#pragma once
+
+#ifndef PREPROC_PRIVATE_H
+#define PREPROC_PRIVATE_H
+
+#include <stdio.h>
+
+#include "lang.h"
+
+typedef struct mtoken_s {
+	enum mtoken_e {
+		MTOK_TOKEN,
+		MTOK_ARG,
+		MTOK_STRINGIFY,
+		MTOK_CONCAT,
+	} typ;
+	union {
+		preproc_token_t tok;
+		unsigned argid;
+		struct { struct mtoken_s *l, *r; } concat;
+	} val;
+} mtoken_t;
+
+VECTOR_DECLARE(mtoken, mtoken_t*)
+
+typedef struct macro_s {
+	int is_funlike;
+	int has_varargs;
+	unsigned nargs;
+	VECTOR(mtoken) *toks;
+} macro_t;
+
+mtoken_t *mtoken_new_token(preproc_token_t tok);
+mtoken_t *mtoken_new_arg(unsigned argid, int as_string);
+mtoken_t *mtoken_new_concat(mtoken_t *l, mtoken_t *r);
+void mtoken_del(mtoken_t *tok);
+void macro_del(macro_t *m);
+
+#endif // PREPROC_PRIVATE_H