1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-19 16:40:26 +02:00

Added VarArgs

This commit is contained in:
Brian Fiete 2021-01-22 04:58:08 -08:00
parent fd1d9644f7
commit 9ccdf7282e
8 changed files with 228 additions and 26 deletions

View file

@ -21,6 +21,38 @@ namespace System
}
}
struct VarArgs
{
void* mVAList;
[Intrinsic("va_start")]
static extern void Start(void* vaList);
[Intrinsic("va_end")]
static extern void End(void* vaList);
[Intrinsic("va_arg")]
static extern void Arg(void* vaList, void* destPtr, int32 typeId);
[Inline]
public mixin Start() mut
{
Start(&mVAList);
}
[Inline]
public mixin End() mut
{
End(&mVAList);
}
[Inline]
public mixin Get<T>() mut
{
T val = ?;
Arg(&mVAList, &val, (.)typeof(T).TypeId);
val
}
}
[AlwaysInclude]
static class Internal
{