aboutsummaryrefslogtreecommitdiffhomepage
path: root/std.h
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2025-07-21 20:48:01 +0900
committernsfisis <nsfisis@gmail.com>2025-08-15 10:04:32 +0900
commit0c9dc7318361c93e837c8f4bc5c29869076c36cd (patch)
treea0998f947324fb42885338d0bd729d02d4309f40 /std.h
parent1c48d0fe728c263bbe946a5d3adebaa29323ddff (diff)
downloadducc-0c9dc7318361c93e837c8f4bc5c29869076c36cd.tar.gz
ducc-0c9dc7318361c93e837c8f4bc5c29869076c36cd.tar.zst
ducc-0c9dc7318361c93e837c8f4bc5c29869076c36cd.zip
feat: implement va_*() functions
Diffstat (limited to 'std.h')
-rw-r--r--std.h31
1 files changed, 31 insertions, 0 deletions
diff --git a/std.h b/std.h
index 23a2e9a..86c86f5 100644
--- a/std.h
+++ b/std.h
@@ -29,3 +29,34 @@ int strncmp(const char*, const char*, size_t);
char* strstr(const char*, const char*);
#define NULL 0
+
+#ifdef __ducc__
+
+// System V Application Binary Interface
+// AMD64 Architecture Processor Supplement
+// (With LP64 and ILP32 Programming Models)
+// Version 1.0
+// Figure 3.34: va_list Type Declaration
+struct __va_list__ {
+ // unsigned int gp_offset;
+ // unsigned int fp_offset;
+ int gp_offset;
+ int fp_offset;
+ void* overflow_arg_area;
+ void* reg_save_area;
+};
+// ducc currently does not support array type.
+// typedef struct __va_list__ va_list[1];
+typedef struct __va_list__* va_list;
+
+// va_start() is currently implemented as a special form due to the limitation of #define macro.
+void va_end(va_list args) {
+}
+
+#else
+
+#include <stdarg.h>
+
+#endif
+
+int vfprintf(FILE*, const char*, va_list);