From 0c9dc7318361c93e837c8f4bc5c29869076c36cd Mon Sep 17 00:00:00 2001 From: nsfisis Date: Mon, 21 Jul 2025 20:48:01 +0900 Subject: feat: implement va_*() functions --- std.h | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'std.h') 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 + +#endif + +int vfprintf(FILE*, const char*, va_list); -- cgit v1.2.3-70-g09d2