mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-05 23:28:48 +00:00
move va_list into core:c
This commit is contained in:
@@ -104,3 +104,13 @@ NULL :: rawptr(uintptr(0))
|
|||||||
NDEBUG :: !ODIN_DEBUG
|
NDEBUG :: !ODIN_DEBUG
|
||||||
|
|
||||||
CHAR_BIT :: 8
|
CHAR_BIT :: 8
|
||||||
|
|
||||||
|
// Since there are no types in C with an alignment larger than that of
|
||||||
|
// max_align_t, which cannot be larger than sizeof(long double) as any other
|
||||||
|
// exposed type wouldn't be valid C, the maximum alignment possible in a
|
||||||
|
// strictly conformant C implementation is 16 on the platforms we care about.
|
||||||
|
// The choice of 4096 bytes for storage of this type is more than enough on all
|
||||||
|
// relevant platforms.
|
||||||
|
va_list :: struct #align(16) {
|
||||||
|
_: [4096]u8,
|
||||||
|
}
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ package libc
|
|||||||
|
|
||||||
import "base:intrinsics"
|
import "base:intrinsics"
|
||||||
|
|
||||||
|
import "core:c"
|
||||||
|
|
||||||
@(private="file")
|
@(private="file")
|
||||||
@(default_calling_convention="none")
|
@(default_calling_convention="none")
|
||||||
foreign _ {
|
foreign _ {
|
||||||
@@ -12,15 +14,7 @@ foreign _ {
|
|||||||
@(link_name="llvm.va_copy") _va_copy :: proc(dst, src: ^i8) ---
|
@(link_name="llvm.va_copy") _va_copy :: proc(dst, src: ^i8) ---
|
||||||
}
|
}
|
||||||
|
|
||||||
// Since there are no types in C with an alignment larger than that of
|
va_list :: c.va_list
|
||||||
// max_align_t, which cannot be larger than sizeof(long double) as any other
|
|
||||||
// exposed type wouldn't be valid C, the maximum alignment possible in a
|
|
||||||
// strictly conformant C implementation is 16 on the platforms we care about.
|
|
||||||
// The choice of 4096 bytes for storage of this type is more than enough on all
|
|
||||||
// relevant platforms.
|
|
||||||
va_list :: struct #align(16) {
|
|
||||||
_: [4096]u8,
|
|
||||||
}
|
|
||||||
|
|
||||||
va_start :: #force_inline proc(ap: ^va_list, _: any) {
|
va_start :: #force_inline proc(ap: ^va_list, _: any) {
|
||||||
_va_start(cast(^i8)ap)
|
_va_start(cast(^i8)ap)
|
||||||
|
|||||||
Vendored
+1
-7
@@ -925,15 +925,9 @@ NPatchLayout :: enum c.int {
|
|||||||
THREE_PATCH_HORIZONTAL, // Npatch layout: 3x1 tiles
|
THREE_PATCH_HORIZONTAL, // Npatch layout: 3x1 tiles
|
||||||
}
|
}
|
||||||
|
|
||||||
// NOTE: Castable to `core:c/libc`'s `va_list`.
|
|
||||||
// But some use cases of raylib do not want `libc` imported.
|
|
||||||
va_list :: struct #align(16) {
|
|
||||||
_: [4096]u8,
|
|
||||||
}
|
|
||||||
|
|
||||||
// Callbacks to hook some internal functions
|
// Callbacks to hook some internal functions
|
||||||
// WARNING: This callbacks are intended for advance users
|
// WARNING: This callbacks are intended for advance users
|
||||||
TraceLogCallback :: #type proc "c" (logLevel: TraceLogLevel, text: cstring, args: va_list) // Logging: Redirect trace log messages
|
TraceLogCallback :: #type proc "c" (logLevel: TraceLogLevel, text: cstring, args: c.va_list) // Logging: Redirect trace log messages
|
||||||
LoadFileDataCallback :: #type proc "c"(fileName: cstring, dataSize: ^c.int) -> [^]u8 // FileIO: Load binary data
|
LoadFileDataCallback :: #type proc "c"(fileName: cstring, dataSize: ^c.int) -> [^]u8 // FileIO: Load binary data
|
||||||
SaveFileDataCallback :: #type proc "c" (fileName: cstring, data: rawptr, dataSize: c.int) -> bool // FileIO: Save binary data
|
SaveFileDataCallback :: #type proc "c" (fileName: cstring, data: rawptr, dataSize: c.int) -> bool // FileIO: Save binary data
|
||||||
LoadFileTextCallback :: #type proc "c" (fileName: cstring) -> [^]u8 // FileIO: Load text data
|
LoadFileTextCallback :: #type proc "c" (fileName: cstring) -> [^]u8 // FileIO: Load text data
|
||||||
|
|||||||
Reference in New Issue
Block a user