mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-05 15:18:49 +00:00
Merge pull request #1438 from odin-lang/odin-global-constants-as-enums
Odin global constants as enums
This commit is contained in:
+4
-4
@@ -7,20 +7,20 @@ char :: builtin.u8 // assuming -funsigned-char
|
|||||||
schar :: builtin.i8
|
schar :: builtin.i8
|
||||||
short :: builtin.i16
|
short :: builtin.i16
|
||||||
int :: builtin.i32
|
int :: builtin.i32
|
||||||
long :: builtin.i32 when (ODIN_OS == "windows" || size_of(builtin.rawptr) == 4) else builtin.i64
|
long :: builtin.i32 when (ODIN_OS == .Windows || size_of(builtin.rawptr) == 4) else builtin.i64
|
||||||
longlong :: builtin.i64
|
longlong :: builtin.i64
|
||||||
|
|
||||||
uchar :: builtin.u8
|
uchar :: builtin.u8
|
||||||
ushort :: builtin.u16
|
ushort :: builtin.u16
|
||||||
uint :: builtin.u32
|
uint :: builtin.u32
|
||||||
ulong :: builtin.u32 when (ODIN_OS == "windows" || size_of(builtin.rawptr) == 4) else builtin.u64
|
ulong :: builtin.u32 when (ODIN_OS == .Windows || size_of(builtin.rawptr) == 4) else builtin.u64
|
||||||
ulonglong :: builtin.u64
|
ulonglong :: builtin.u64
|
||||||
|
|
||||||
bool :: builtin.bool
|
bool :: builtin.bool
|
||||||
|
|
||||||
size_t :: builtin.uint
|
size_t :: builtin.uint
|
||||||
ssize_t :: builtin.int
|
ssize_t :: builtin.int
|
||||||
wchar_t :: builtin.u16 when (ODIN_OS == "windows") else builtin.u32
|
wchar_t :: builtin.u16 when (ODIN_OS == .Windows) else builtin.u32
|
||||||
|
|
||||||
float :: builtin.f32
|
float :: builtin.f32
|
||||||
double :: builtin.f64
|
double :: builtin.f64
|
||||||
@@ -48,7 +48,7 @@ int_least64_t :: builtin.i64
|
|||||||
uint_least64_t :: builtin.u64
|
uint_least64_t :: builtin.u64
|
||||||
|
|
||||||
// Same on Windows, Linux, and FreeBSD
|
// Same on Windows, Linux, and FreeBSD
|
||||||
when ODIN_ARCH == "i386" || ODIN_ARCH == "amd64" {
|
when ODIN_ARCH == .i386 || ODIN_ARCH == .amd64 {
|
||||||
int_fast8_t :: builtin.i8
|
int_fast8_t :: builtin.i8
|
||||||
uint_fast8_t :: builtin.u8
|
uint_fast8_t :: builtin.u8
|
||||||
int_fast16_t :: builtin.i32
|
int_fast16_t :: builtin.i32
|
||||||
|
|||||||
@@ -2,9 +2,9 @@ package libc
|
|||||||
|
|
||||||
// 7.3 Complex arithmetic
|
// 7.3 Complex arithmetic
|
||||||
|
|
||||||
when ODIN_OS == "windows" {
|
when ODIN_OS == .Windows {
|
||||||
foreign import libc "system:libucrt.lib"
|
foreign import libc "system:libucrt.lib"
|
||||||
} else when ODIN_OS == "darwin" {
|
} else when ODIN_OS == .Darwin {
|
||||||
foreign import libc "system:System.framework"
|
foreign import libc "system:System.framework"
|
||||||
} else {
|
} else {
|
||||||
foreign import libc "system:c"
|
foreign import libc "system:c"
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
package libc
|
package libc
|
||||||
|
|
||||||
when ODIN_OS == "windows" {
|
when ODIN_OS == .Windows {
|
||||||
foreign import libc "system:libucrt.lib"
|
foreign import libc "system:libucrt.lib"
|
||||||
} else when ODIN_OS == "darwin" {
|
} else when ODIN_OS == .Darwin {
|
||||||
foreign import libc "system:System.framework"
|
foreign import libc "system:System.framework"
|
||||||
} else {
|
} else {
|
||||||
foreign import libc "system:c"
|
foreign import libc "system:c"
|
||||||
|
|||||||
@@ -2,9 +2,9 @@ package libc
|
|||||||
|
|
||||||
// 7.5 Errors
|
// 7.5 Errors
|
||||||
|
|
||||||
when ODIN_OS == "windows" {
|
when ODIN_OS == .Windows {
|
||||||
foreign import libc "system:libucrt.lib"
|
foreign import libc "system:libucrt.lib"
|
||||||
} else when ODIN_OS == "darwin" {
|
} else when ODIN_OS == .Darwin {
|
||||||
foreign import libc "system:System.framework"
|
foreign import libc "system:System.framework"
|
||||||
} else {
|
} else {
|
||||||
foreign import libc "system:c"
|
foreign import libc "system:c"
|
||||||
@@ -14,7 +14,7 @@ when ODIN_OS == "windows" {
|
|||||||
// EDOM,
|
// EDOM,
|
||||||
// EILSEQ
|
// EILSEQ
|
||||||
// ERANGE
|
// ERANGE
|
||||||
when ODIN_OS == "linux" || ODIN_OS == "freebsd" {
|
when ODIN_OS == .Linux || ODIN_OS == .FreeBSD {
|
||||||
@(private="file")
|
@(private="file")
|
||||||
@(default_calling_convention="c")
|
@(default_calling_convention="c")
|
||||||
foreign libc {
|
foreign libc {
|
||||||
@@ -27,7 +27,7 @@ when ODIN_OS == "linux" || ODIN_OS == "freebsd" {
|
|||||||
ERANGE :: 34
|
ERANGE :: 34
|
||||||
}
|
}
|
||||||
|
|
||||||
when ODIN_OS == "windows" {
|
when ODIN_OS == .Windows {
|
||||||
@(private="file")
|
@(private="file")
|
||||||
@(default_calling_convention="c")
|
@(default_calling_convention="c")
|
||||||
foreign libc {
|
foreign libc {
|
||||||
@@ -40,7 +40,7 @@ when ODIN_OS == "windows" {
|
|||||||
ERANGE :: 34
|
ERANGE :: 34
|
||||||
}
|
}
|
||||||
|
|
||||||
when ODIN_OS == "darwin" {
|
when ODIN_OS == .Darwin {
|
||||||
@(private="file")
|
@(private="file")
|
||||||
@(default_calling_convention="c")
|
@(default_calling_convention="c")
|
||||||
foreign libc {
|
foreign libc {
|
||||||
|
|||||||
@@ -4,9 +4,9 @@ package libc
|
|||||||
|
|
||||||
import "core:intrinsics"
|
import "core:intrinsics"
|
||||||
|
|
||||||
when ODIN_OS == "windows" {
|
when ODIN_OS == .Windows {
|
||||||
foreign import libc "system:libucrt.lib"
|
foreign import libc "system:libucrt.lib"
|
||||||
} else when ODIN_OS == "darwin" {
|
} else when ODIN_OS == .Darwin {
|
||||||
foreign import libc "system:System.framework"
|
foreign import libc "system:System.framework"
|
||||||
} else {
|
} else {
|
||||||
foreign import libc "system:c"
|
foreign import libc "system:c"
|
||||||
|
|||||||
@@ -2,14 +2,14 @@ package libc
|
|||||||
|
|
||||||
// 7.13 Nonlocal jumps
|
// 7.13 Nonlocal jumps
|
||||||
|
|
||||||
when ODIN_OS == "windows" {
|
when ODIN_OS == .Windows {
|
||||||
foreign import libc "system:libucrt.lib"
|
foreign import libc "system:libucrt.lib"
|
||||||
} else when ODIN_OS == "darwin" {
|
} else when ODIN_OS == .Darwin {
|
||||||
foreign import libc "system:System.framework"
|
foreign import libc "system:System.framework"
|
||||||
} else {
|
} else {
|
||||||
foreign import libc "system:c"
|
foreign import libc "system:c"
|
||||||
}
|
}
|
||||||
when ODIN_OS == "windows" {
|
when ODIN_OS == .Windows {
|
||||||
@(default_calling_convention="c")
|
@(default_calling_convention="c")
|
||||||
foreign libc {
|
foreign libc {
|
||||||
// 7.13.1 Save calling environment
|
// 7.13.1 Save calling environment
|
||||||
|
|||||||
@@ -2,9 +2,9 @@ package libc
|
|||||||
|
|
||||||
// 7.14 Signal handling
|
// 7.14 Signal handling
|
||||||
|
|
||||||
when ODIN_OS == "windows" {
|
when ODIN_OS == .Windows {
|
||||||
foreign import libc "system:libucrt.lib"
|
foreign import libc "system:libucrt.lib"
|
||||||
} else when ODIN_OS == "darwin" {
|
} else when ODIN_OS == .Darwin {
|
||||||
foreign import libc "system:System.framework"
|
foreign import libc "system:System.framework"
|
||||||
} else {
|
} else {
|
||||||
foreign import libc "system:c"
|
foreign import libc "system:c"
|
||||||
@@ -21,7 +21,7 @@ foreign libc {
|
|||||||
raise :: proc(sig: int) -> int ---
|
raise :: proc(sig: int) -> int ---
|
||||||
}
|
}
|
||||||
|
|
||||||
when ODIN_OS == "windows" {
|
when ODIN_OS == .Windows {
|
||||||
SIG_ERR :: rawptr(~uintptr(0))
|
SIG_ERR :: rawptr(~uintptr(0))
|
||||||
SIG_DFL :: rawptr(uintptr(0))
|
SIG_DFL :: rawptr(uintptr(0))
|
||||||
SIG_IGN :: rawptr(uintptr(1))
|
SIG_IGN :: rawptr(uintptr(1))
|
||||||
@@ -34,7 +34,7 @@ when ODIN_OS == "windows" {
|
|||||||
SIGTERM :: 15
|
SIGTERM :: 15
|
||||||
}
|
}
|
||||||
|
|
||||||
when ODIN_OS == "linux" || ODIN_OS == "freebsd" {
|
when ODIN_OS == .Linux || ODIN_OS == .FreeBSD {
|
||||||
SIG_ERR :: rawptr(~uintptr(0))
|
SIG_ERR :: rawptr(~uintptr(0))
|
||||||
SIG_DFL :: rawptr(uintptr(0))
|
SIG_DFL :: rawptr(uintptr(0))
|
||||||
SIG_IGN :: rawptr(uintptr(1))
|
SIG_IGN :: rawptr(uintptr(1))
|
||||||
@@ -47,7 +47,7 @@ when ODIN_OS == "linux" || ODIN_OS == "freebsd" {
|
|||||||
SIGTERM :: 15
|
SIGTERM :: 15
|
||||||
}
|
}
|
||||||
|
|
||||||
when ODIN_OS == "darwin" {
|
when ODIN_OS == .Darwin {
|
||||||
SIG_ERR :: rawptr(~uintptr(0))
|
SIG_ERR :: rawptr(~uintptr(0))
|
||||||
SIG_DFL :: rawptr(uintptr(0))
|
SIG_DFL :: rawptr(uintptr(0))
|
||||||
SIG_IGN :: rawptr(uintptr(1))
|
SIG_IGN :: rawptr(uintptr(1))
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
package libc
|
package libc
|
||||||
|
|
||||||
when ODIN_OS == "windows" {
|
when ODIN_OS == .Windows {
|
||||||
foreign import libc "system:libucrt.lib"
|
foreign import libc "system:libucrt.lib"
|
||||||
} else when ODIN_OS == "darwin" {
|
} else when ODIN_OS == .Darwin {
|
||||||
foreign import libc "system:System.framework"
|
foreign import libc "system:System.framework"
|
||||||
} else {
|
} else {
|
||||||
foreign import libc "system:c"
|
foreign import libc "system:c"
|
||||||
@@ -13,7 +13,7 @@ when ODIN_OS == "windows" {
|
|||||||
FILE :: struct {}
|
FILE :: struct {}
|
||||||
|
|
||||||
// MSVCRT compatible.
|
// MSVCRT compatible.
|
||||||
when ODIN_OS == "windows" {
|
when ODIN_OS == .Windows {
|
||||||
_IOFBF :: 0x0000
|
_IOFBF :: 0x0000
|
||||||
_IONBF :: 0x0004
|
_IONBF :: 0x0004
|
||||||
_IOLBF :: 0x0040
|
_IOLBF :: 0x0040
|
||||||
@@ -48,7 +48,7 @@ when ODIN_OS == "windows" {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// GLIBC and MUSL compatible.
|
// GLIBC and MUSL compatible.
|
||||||
when ODIN_OS == "linux" {
|
when ODIN_OS == .Linux {
|
||||||
fpos_t :: struct #raw_union { _: [16]char, _: longlong, _: double, }
|
fpos_t :: struct #raw_union { _: [16]char, _: longlong, _: double, }
|
||||||
|
|
||||||
_IOFBF :: 0
|
_IOFBF :: 0
|
||||||
@@ -78,7 +78,7 @@ when ODIN_OS == "linux" {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
when ODIN_OS == "darwin" {
|
when ODIN_OS == .Darwin {
|
||||||
fpos_t :: distinct i64
|
fpos_t :: distinct i64
|
||||||
|
|
||||||
_IOFBF :: 0
|
_IOFBF :: 0
|
||||||
|
|||||||
@@ -2,15 +2,15 @@ package libc
|
|||||||
|
|
||||||
// 7.22 General utilities
|
// 7.22 General utilities
|
||||||
|
|
||||||
when ODIN_OS == "windows" {
|
when ODIN_OS == .Windows {
|
||||||
foreign import libc "system:libucrt.lib"
|
foreign import libc "system:libucrt.lib"
|
||||||
} else when ODIN_OS == "darwin" {
|
} else when ODIN_OS == .Darwin {
|
||||||
foreign import libc "system:System.framework"
|
foreign import libc "system:System.framework"
|
||||||
} else {
|
} else {
|
||||||
foreign import libc "system:c"
|
foreign import libc "system:c"
|
||||||
}
|
}
|
||||||
|
|
||||||
when ODIN_OS == "windows" {
|
when ODIN_OS == .Windows {
|
||||||
RAND_MAX :: 0x7fff
|
RAND_MAX :: 0x7fff
|
||||||
|
|
||||||
@(private="file")
|
@(private="file")
|
||||||
@@ -24,7 +24,7 @@ when ODIN_OS == "windows" {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
when ODIN_OS == "linux" {
|
when ODIN_OS == .Linux {
|
||||||
RAND_MAX :: 0x7fffffff
|
RAND_MAX :: 0x7fffffff
|
||||||
|
|
||||||
// GLIBC and MUSL only
|
// GLIBC and MUSL only
|
||||||
@@ -40,7 +40,7 @@ when ODIN_OS == "linux" {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
when ODIN_OS == "darwin" {
|
when ODIN_OS == .Darwin {
|
||||||
RAND_MAX :: 0x7fffffff
|
RAND_MAX :: 0x7fffffff
|
||||||
|
|
||||||
// GLIBC and MUSL only
|
// GLIBC and MUSL only
|
||||||
|
|||||||
@@ -4,9 +4,9 @@ import "core:runtime"
|
|||||||
|
|
||||||
// 7.24 String handling
|
// 7.24 String handling
|
||||||
|
|
||||||
when ODIN_OS == "windows" {
|
when ODIN_OS == .Windows {
|
||||||
foreign import libc "system:libucrt.lib"
|
foreign import libc "system:libucrt.lib"
|
||||||
} else when ODIN_OS == "darwin" {
|
} else when ODIN_OS == .Darwin {
|
||||||
foreign import libc "system:System.framework"
|
foreign import libc "system:System.framework"
|
||||||
} else {
|
} else {
|
||||||
foreign import libc "system:c"
|
foreign import libc "system:c"
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ package libc
|
|||||||
thrd_start_t :: proc "c" (rawptr) -> int
|
thrd_start_t :: proc "c" (rawptr) -> int
|
||||||
tss_dtor_t :: proc "c" (rawptr)
|
tss_dtor_t :: proc "c" (rawptr)
|
||||||
|
|
||||||
when ODIN_OS == "windows" {
|
when ODIN_OS == .Windows {
|
||||||
foreign import libc {
|
foreign import libc {
|
||||||
"system:libucrt.lib",
|
"system:libucrt.lib",
|
||||||
"system:msvcprt.lib"
|
"system:msvcprt.lib"
|
||||||
@@ -74,7 +74,7 @@ when ODIN_OS == "windows" {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// GLIBC and MUSL compatible constants and types.
|
// GLIBC and MUSL compatible constants and types.
|
||||||
when ODIN_OS == "linux" {
|
when ODIN_OS == .Linux {
|
||||||
foreign import libc {
|
foreign import libc {
|
||||||
"system:c",
|
"system:c",
|
||||||
"system:pthread"
|
"system:pthread"
|
||||||
@@ -138,6 +138,6 @@ when ODIN_OS == "linux" {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
when ODIN_OS == "darwin" {
|
when ODIN_OS == .Darwin {
|
||||||
// TODO: find out what this is meant to be!
|
// TODO: find out what this is meant to be!
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,9 +2,9 @@ package libc
|
|||||||
|
|
||||||
// 7.27 Date and time
|
// 7.27 Date and time
|
||||||
|
|
||||||
when ODIN_OS == "windows" {
|
when ODIN_OS == .Windows {
|
||||||
foreign import libc "system:libucrt.lib"
|
foreign import libc "system:libucrt.lib"
|
||||||
} else when ODIN_OS == "darwin" {
|
} else when ODIN_OS == .Darwin {
|
||||||
foreign import libc "system:System.framework"
|
foreign import libc "system:System.framework"
|
||||||
} else {
|
} else {
|
||||||
foreign import libc "system:c"
|
foreign import libc "system:c"
|
||||||
@@ -12,7 +12,7 @@ when ODIN_OS == "windows" {
|
|||||||
|
|
||||||
// We enforce 64-bit time_t and timespec as there is no reason to use 32-bit as
|
// We enforce 64-bit time_t and timespec as there is no reason to use 32-bit as
|
||||||
// we approach the 2038 problem. Windows has defaulted to this since VC8 (2005).
|
// we approach the 2038 problem. Windows has defaulted to this since VC8 (2005).
|
||||||
when ODIN_OS == "windows" {
|
when ODIN_OS == .Windows {
|
||||||
foreign libc {
|
foreign libc {
|
||||||
// 7.27.2 Time manipulation functions
|
// 7.27.2 Time manipulation functions
|
||||||
clock :: proc() -> clock_t ---
|
clock :: proc() -> clock_t ---
|
||||||
@@ -45,7 +45,7 @@ when ODIN_OS == "windows" {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
when ODIN_OS == "linux" || ODIN_OS == "freebsd" || ODIN_OS == "darwin" {
|
when ODIN_OS == .Linux || ODIN_OS == .FreeBSD || ODIN_OS == .Darwin {
|
||||||
@(default_calling_convention="c")
|
@(default_calling_convention="c")
|
||||||
foreign libc {
|
foreign libc {
|
||||||
// 7.27.2 Time manipulation functions
|
// 7.27.2 Time manipulation functions
|
||||||
|
|||||||
@@ -2,9 +2,9 @@ package libc
|
|||||||
|
|
||||||
// 7.28 Unicode utilities
|
// 7.28 Unicode utilities
|
||||||
|
|
||||||
when ODIN_OS == "windows" {
|
when ODIN_OS == .Windows {
|
||||||
foreign import libc "system:libucrt.lib"
|
foreign import libc "system:libucrt.lib"
|
||||||
} else when ODIN_OS == "darwin" {
|
} else when ODIN_OS == .Darwin {
|
||||||
foreign import libc "system:System.framework"
|
foreign import libc "system:System.framework"
|
||||||
} else {
|
} else {
|
||||||
foreign import libc "system:c"
|
foreign import libc "system:c"
|
||||||
|
|||||||
@@ -2,9 +2,9 @@ package libc
|
|||||||
|
|
||||||
// 7.29 Extended multibyte and wide character utilities
|
// 7.29 Extended multibyte and wide character utilities
|
||||||
|
|
||||||
when ODIN_OS == "windows" {
|
when ODIN_OS == .Windows {
|
||||||
foreign import libc "system:libucrt.lib"
|
foreign import libc "system:libucrt.lib"
|
||||||
} else when ODIN_OS == "darwin" {
|
} else when ODIN_OS == .Darwin {
|
||||||
foreign import libc "system:System.framework"
|
foreign import libc "system:System.framework"
|
||||||
} else {
|
} else {
|
||||||
foreign import libc "system:c"
|
foreign import libc "system:c"
|
||||||
|
|||||||
@@ -2,25 +2,25 @@ package libc
|
|||||||
|
|
||||||
// 7.30 Wide character classification and mapping utilities
|
// 7.30 Wide character classification and mapping utilities
|
||||||
|
|
||||||
when ODIN_OS == "windows" {
|
when ODIN_OS == .Windows {
|
||||||
foreign import libc "system:libucrt.lib"
|
foreign import libc "system:libucrt.lib"
|
||||||
} else when ODIN_OS == "darwin" {
|
} else when ODIN_OS == .Darwin {
|
||||||
foreign import libc "system:System.framework"
|
foreign import libc "system:System.framework"
|
||||||
} else {
|
} else {
|
||||||
foreign import libc "system:c"
|
foreign import libc "system:c"
|
||||||
}
|
}
|
||||||
|
|
||||||
when ODIN_OS == "windows" {
|
when ODIN_OS == .Windows {
|
||||||
wctrans_t :: distinct wchar_t
|
wctrans_t :: distinct wchar_t
|
||||||
wctype_t :: distinct ushort
|
wctype_t :: distinct ushort
|
||||||
}
|
}
|
||||||
|
|
||||||
when ODIN_OS == "linux" {
|
when ODIN_OS == .Linux {
|
||||||
wctrans_t :: distinct intptr_t
|
wctrans_t :: distinct intptr_t
|
||||||
wctype_t :: distinct ulong
|
wctype_t :: distinct ulong
|
||||||
}
|
}
|
||||||
|
|
||||||
when ODIN_OS == "darwin" {
|
when ODIN_OS == .Darwin {
|
||||||
wctrans_t :: distinct int
|
wctrans_t :: distinct int
|
||||||
wctype_t :: distinct u32
|
wctype_t :: distinct u32
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ fe_from_bytes :: #force_inline proc (out1: ^Tight_Field_Element, arg1: []byte, a
|
|||||||
|
|
||||||
assert(len(arg1) == 16)
|
assert(len(arg1) == 16)
|
||||||
|
|
||||||
when ODIN_ARCH == "i386" || ODIN_ARCH == "amd64" {
|
when ODIN_ARCH == .i386 || ODIN_ARCH == .amd64 {
|
||||||
// While it may be unwise to do deserialization here on our
|
// While it may be unwise to do deserialization here on our
|
||||||
// own when fiat-crypto provides equivalent functionality,
|
// own when fiat-crypto provides equivalent functionality,
|
||||||
// doing it this way provides a little under 3x performance
|
// doing it this way provides a little under 3x performance
|
||||||
|
|||||||
@@ -346,7 +346,7 @@ _do_blocks :: proc (ctx: ^Context, dst, src: []byte, nr_blocks: int) {
|
|||||||
// Until dedicated assembly can be written leverage the fact that
|
// Until dedicated assembly can be written leverage the fact that
|
||||||
// the callers of this routine ensure that src/dst are valid.
|
// the callers of this routine ensure that src/dst are valid.
|
||||||
|
|
||||||
when ODIN_ARCH == "i386" || ODIN_ARCH == "amd64" {
|
when ODIN_ARCH == .i386 || ODIN_ARCH == .amd64 {
|
||||||
// util.PUT_U32_LE/util.U32_LE are not required on little-endian
|
// util.PUT_U32_LE/util.U32_LE are not required on little-endian
|
||||||
// systems that also happen to not be strict about aligned
|
// systems that also happen to not be strict about aligned
|
||||||
// memory access.
|
// memory access.
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package crypto
|
package crypto
|
||||||
|
|
||||||
when ODIN_OS != "linux" {
|
when ODIN_OS != .Linux {
|
||||||
_rand_bytes :: proc (dst: []byte) {
|
_rand_bytes :: proc (dst: []byte) {
|
||||||
unimplemented("crypto: rand_bytes not supported on this OS")
|
unimplemented("crypto: rand_bytes not supported on this OS")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -207,7 +207,7 @@ write_image_as_ppm :: proc(filename: string, image: ^image.Image) -> (success: b
|
|||||||
}
|
}
|
||||||
|
|
||||||
mode: int = 0
|
mode: int = 0
|
||||||
when ODIN_OS == "linux" || ODIN_OS == "darwin" {
|
when ODIN_OS == .Linux || ODIN_OS == .Darwin {
|
||||||
// NOTE(justasd): 644 (owner read, write; group read; others read)
|
// NOTE(justasd): 644 (owner read, write; group read; others read)
|
||||||
mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH
|
mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -443,7 +443,7 @@ when false {
|
|||||||
}
|
}
|
||||||
|
|
||||||
mode: int = 0
|
mode: int = 0
|
||||||
when ODIN_OS == "linux" || ODIN_OS == "darwin" {
|
when ODIN_OS == .Linux || ODIN_OS == .Darwin {
|
||||||
// NOTE(justasd): 644 (owner read, write; group read; others read)
|
// NOTE(justasd): 644 (owner read, write; group read; others read)
|
||||||
mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH
|
mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -399,7 +399,7 @@ is_abs :: proc(path: string) -> bool {
|
|||||||
if len(path) > 0 && path[0] == '/' {
|
if len(path) > 0 && path[0] == '/' {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
when ODIN_OS == "windows" {
|
when ODIN_OS == .Windows {
|
||||||
if len(path) > 2 {
|
if len(path) > 2 {
|
||||||
switch path[0] {
|
switch path[0] {
|
||||||
case 'A'..='Z', 'a'..='z':
|
case 'A'..='Z', 'a'..='z':
|
||||||
|
|||||||
+1
-1
@@ -139,7 +139,7 @@ write_entire_file :: proc(name: string, data: []byte, truncate := true) -> (succ
|
|||||||
}
|
}
|
||||||
|
|
||||||
mode: int = 0
|
mode: int = 0
|
||||||
when OS == "linux" || OS == "darwin" {
|
when OS == .Linux || OS == .Darwin {
|
||||||
// NOTE(justasd): 644 (owner read, write; group read; others read)
|
// NOTE(justasd): 644 (owner read, write; group read; others read)
|
||||||
mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH
|
mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,13 +3,13 @@ package os2
|
|||||||
import "core:strings"
|
import "core:strings"
|
||||||
|
|
||||||
user_cache_dir :: proc(allocator := context.allocator) -> (dir: string, is_defined: bool) {
|
user_cache_dir :: proc(allocator := context.allocator) -> (dir: string, is_defined: bool) {
|
||||||
switch ODIN_OS {
|
#partial switch ODIN_OS {
|
||||||
case "windows":
|
case .Windows:
|
||||||
dir = get_env("LocalAppData")
|
dir = get_env("LocalAppData")
|
||||||
if dir != "" {
|
if dir != "" {
|
||||||
dir = strings.clone(dir, allocator)
|
dir = strings.clone(dir, allocator)
|
||||||
}
|
}
|
||||||
case "darwin":
|
case .Darwin:
|
||||||
dir = get_env("HOME")
|
dir = get_env("HOME")
|
||||||
if dir != "" {
|
if dir != "" {
|
||||||
dir = strings.concatenate({dir, "/Library/Caches"}, allocator)
|
dir = strings.concatenate({dir, "/Library/Caches"}, allocator)
|
||||||
@@ -29,13 +29,13 @@ user_cache_dir :: proc(allocator := context.allocator) -> (dir: string, is_defin
|
|||||||
}
|
}
|
||||||
|
|
||||||
user_config_dir :: proc(allocator := context.allocator) -> (dir: string, is_defined: bool) {
|
user_config_dir :: proc(allocator := context.allocator) -> (dir: string, is_defined: bool) {
|
||||||
switch ODIN_OS {
|
#partial switch ODIN_OS {
|
||||||
case "windows":
|
case .Windows:
|
||||||
dir = get_env("AppData")
|
dir = get_env("AppData")
|
||||||
if dir != "" {
|
if dir != "" {
|
||||||
dir = strings.clone(dir, allocator)
|
dir = strings.clone(dir, allocator)
|
||||||
}
|
}
|
||||||
case "darwin":
|
case .Darwin:
|
||||||
dir = get_env("HOME")
|
dir = get_env("HOME")
|
||||||
if dir != "" {
|
if dir != "" {
|
||||||
dir = strings.concatenate({dir, "/Library/Application Support"}, allocator)
|
dir = strings.concatenate({dir, "/Library/Application Support"}, allocator)
|
||||||
@@ -56,8 +56,8 @@ user_config_dir :: proc(allocator := context.allocator) -> (dir: string, is_defi
|
|||||||
|
|
||||||
user_home_dir :: proc() -> (dir: string, is_defined: bool) {
|
user_home_dir :: proc() -> (dir: string, is_defined: bool) {
|
||||||
env := "HOME"
|
env := "HOME"
|
||||||
switch ODIN_OS {
|
#partial switch ODIN_OS {
|
||||||
case "windows":
|
case .Windows:
|
||||||
env = "USERPROFILE"
|
env = "USERPROFILE"
|
||||||
}
|
}
|
||||||
if v := get_env(env); v != "" {
|
if v := get_env(env); v != "" {
|
||||||
|
|||||||
@@ -320,7 +320,7 @@ foreign libc {
|
|||||||
@(link_name="exit") _unix_exit :: proc(status: c.int) -> ! ---
|
@(link_name="exit") _unix_exit :: proc(status: c.int) -> ! ---
|
||||||
}
|
}
|
||||||
|
|
||||||
when ODIN_ARCH != "arm64" {
|
when ODIN_ARCH != .arm64 {
|
||||||
_unix_fdopendir :: proc {_unix_fdopendir_amd64}
|
_unix_fdopendir :: proc {_unix_fdopendir_amd64}
|
||||||
_unix_readdir_r :: proc {_unix_readdir_r_amd64}
|
_unix_readdir_r :: proc {_unix_readdir_r_amd64}
|
||||||
} else {
|
} else {
|
||||||
@@ -351,7 +351,7 @@ open :: proc(path: string, flags: int = O_RDWR, mode: int = 0) -> (Handle, Errno
|
|||||||
return INVALID_HANDLE, 1
|
return INVALID_HANDLE, 1
|
||||||
}
|
}
|
||||||
|
|
||||||
when ODIN_OS == "darwin" && ODIN_ARCH == "arm64" {
|
when ODIN_OS == .Darwin && ODIN_ARCH == .arm64 {
|
||||||
if mode != 0 {
|
if mode != 0 {
|
||||||
err := fchmod(handle, cast(u16)mode)
|
err := fchmod(handle, cast(u16)mode)
|
||||||
if err != 0 {
|
if err != 0 {
|
||||||
|
|||||||
+13
-13
@@ -271,7 +271,7 @@ AT_REMOVEDIR :: uintptr(0x200)
|
|||||||
AT_SYMLINK_NOFOLLOW :: uintptr(0x100)
|
AT_SYMLINK_NOFOLLOW :: uintptr(0x100)
|
||||||
|
|
||||||
_unix_open :: proc(path: cstring, flags: int, mode: int = 0o000) -> Handle {
|
_unix_open :: proc(path: cstring, flags: int, mode: int = 0o000) -> Handle {
|
||||||
when ODIN_ARCH != "arm64" {
|
when ODIN_ARCH != .arm64 {
|
||||||
res := int(intrinsics.syscall(unix.SYS_open, uintptr(rawptr(path)), uintptr(flags), uintptr(mode)))
|
res := int(intrinsics.syscall(unix.SYS_open, uintptr(rawptr(path)), uintptr(flags), uintptr(mode)))
|
||||||
} else { // NOTE: arm64 does not have open
|
} else { // NOTE: arm64 does not have open
|
||||||
res := int(intrinsics.syscall(unix.SYS_openat, uintptr(AT_FDCWD), uintptr(rawptr(path), uintptr(flags), uintptr(mode))))
|
res := int(intrinsics.syscall(unix.SYS_openat, uintptr(AT_FDCWD), uintptr(rawptr(path), uintptr(flags), uintptr(mode))))
|
||||||
@@ -292,7 +292,7 @@ _unix_write :: proc(fd: Handle, buf: rawptr, size: uint) -> int {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_unix_seek :: proc(fd: Handle, offset: i64, whence: int) -> i64 {
|
_unix_seek :: proc(fd: Handle, offset: i64, whence: int) -> i64 {
|
||||||
when ODIN_ARCH == "amd64" || ODIN_ARCH == "arm64" {
|
when ODIN_ARCH == .amd64 || ODIN_ARCH == .arm64 {
|
||||||
return i64(intrinsics.syscall(unix.SYS_lseek, uintptr(fd), uintptr(offset), uintptr(whence)))
|
return i64(intrinsics.syscall(unix.SYS_lseek, uintptr(fd), uintptr(offset), uintptr(whence)))
|
||||||
} else {
|
} else {
|
||||||
low := uintptr(offset & 0xFFFFFFFF)
|
low := uintptr(offset & 0xFFFFFFFF)
|
||||||
@@ -304,9 +304,9 @@ _unix_seek :: proc(fd: Handle, offset: i64, whence: int) -> i64 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_unix_stat :: proc(path: cstring, stat: ^OS_Stat) -> int {
|
_unix_stat :: proc(path: cstring, stat: ^OS_Stat) -> int {
|
||||||
when ODIN_ARCH == "amd64" {
|
when ODIN_ARCH == .amd64 {
|
||||||
return int(intrinsics.syscall(unix.SYS_stat, uintptr(rawptr(path)), uintptr(stat)))
|
return int(intrinsics.syscall(unix.SYS_stat, uintptr(rawptr(path)), uintptr(stat)))
|
||||||
} else when ODIN_ARCH != "arm64" {
|
} else when ODIN_ARCH != .arm64 {
|
||||||
return int(intrinsics.syscall(unix.SYS_stat64, uintptr(rawptr(path)), uintptr(stat)))
|
return int(intrinsics.syscall(unix.SYS_stat64, uintptr(rawptr(path)), uintptr(stat)))
|
||||||
} else { // NOTE: arm64 does not have stat
|
} else { // NOTE: arm64 does not have stat
|
||||||
return int(intrinsics.syscall(unix.SYS_fstatat, uintptr(AT_FDCWD), uintptr(rawptr(path)), uintptr(stat), 0))
|
return int(intrinsics.syscall(unix.SYS_fstatat, uintptr(AT_FDCWD), uintptr(rawptr(path)), uintptr(stat), 0))
|
||||||
@@ -314,7 +314,7 @@ _unix_stat :: proc(path: cstring, stat: ^OS_Stat) -> int {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_unix_fstat :: proc(fd: Handle, stat: ^OS_Stat) -> int {
|
_unix_fstat :: proc(fd: Handle, stat: ^OS_Stat) -> int {
|
||||||
when ODIN_ARCH == "amd64" || ODIN_ARCH == "arm64" {
|
when ODIN_ARCH == .amd64 || ODIN_ARCH == .arm64 {
|
||||||
return int(intrinsics.syscall(unix.SYS_fstat, uintptr(fd), uintptr(stat)))
|
return int(intrinsics.syscall(unix.SYS_fstat, uintptr(fd), uintptr(stat)))
|
||||||
} else {
|
} else {
|
||||||
return int(intrinsics.syscall(unix.SYS_fstat64, uintptr(fd), uintptr(stat)))
|
return int(intrinsics.syscall(unix.SYS_fstat64, uintptr(fd), uintptr(stat)))
|
||||||
@@ -322,9 +322,9 @@ _unix_fstat :: proc(fd: Handle, stat: ^OS_Stat) -> int {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_unix_lstat :: proc(path: cstring, stat: ^OS_Stat) -> int {
|
_unix_lstat :: proc(path: cstring, stat: ^OS_Stat) -> int {
|
||||||
when ODIN_ARCH == "amd64" {
|
when ODIN_ARCH == .amd64 {
|
||||||
return int(intrinsics.syscall(unix.SYS_lstat, uintptr(rawptr(path)), uintptr(stat)))
|
return int(intrinsics.syscall(unix.SYS_lstat, uintptr(rawptr(path)), uintptr(stat)))
|
||||||
} else when ODIN_ARCH != "arm64" {
|
} else when ODIN_ARCH != .arm64 {
|
||||||
return int(intrinsics.syscall(unix.SYS_lstat64, uintptr(rawptr(path)), uintptr(stat)))
|
return int(intrinsics.syscall(unix.SYS_lstat64, uintptr(rawptr(path)), uintptr(stat)))
|
||||||
} else { // NOTE: arm64 does not have any lstat
|
} else { // NOTE: arm64 does not have any lstat
|
||||||
return int(intrinsics.syscall(unix.SYS_fstatat, uintptr(AT_FDCWD), uintptr(rawptr(path)), uintptr(stat), AT_SYMLINK_NOFOLLOW))
|
return int(intrinsics.syscall(unix.SYS_fstatat, uintptr(AT_FDCWD), uintptr(rawptr(path)), uintptr(stat), AT_SYMLINK_NOFOLLOW))
|
||||||
@@ -332,7 +332,7 @@ _unix_lstat :: proc(path: cstring, stat: ^OS_Stat) -> int {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_unix_readlink :: proc(path: cstring, buf: rawptr, bufsiz: uint) -> int {
|
_unix_readlink :: proc(path: cstring, buf: rawptr, bufsiz: uint) -> int {
|
||||||
when ODIN_ARCH != "arm64" {
|
when ODIN_ARCH != .arm64 {
|
||||||
return int(intrinsics.syscall(unix.SYS_readlink, uintptr(rawptr(path)), uintptr(buf), uintptr(bufsiz)))
|
return int(intrinsics.syscall(unix.SYS_readlink, uintptr(rawptr(path)), uintptr(buf), uintptr(bufsiz)))
|
||||||
} else { // NOTE: arm64 does not have readlink
|
} else { // NOTE: arm64 does not have readlink
|
||||||
return int(intrinsics.syscall(unix.SYS_readlinkat, uintptr(AT_FDCWD), uintptr(rawptr(path)), uintptr(buf), uintptr(bufsiz)))
|
return int(intrinsics.syscall(unix.SYS_readlinkat, uintptr(AT_FDCWD), uintptr(rawptr(path)), uintptr(buf), uintptr(bufsiz)))
|
||||||
@@ -340,7 +340,7 @@ _unix_readlink :: proc(path: cstring, buf: rawptr, bufsiz: uint) -> int {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_unix_access :: proc(path: cstring, mask: int) -> int {
|
_unix_access :: proc(path: cstring, mask: int) -> int {
|
||||||
when ODIN_ARCH != "arm64" {
|
when ODIN_ARCH != .arm64 {
|
||||||
return int(intrinsics.syscall(unix.SYS_access, uintptr(rawptr(path)), uintptr(mask)))
|
return int(intrinsics.syscall(unix.SYS_access, uintptr(rawptr(path)), uintptr(mask)))
|
||||||
} else { // NOTE: arm64 does not have access
|
} else { // NOTE: arm64 does not have access
|
||||||
return int(intrinsics.syscall(unix.SYS_faccessat, uintptr(AT_FDCWD), uintptr(rawptr(path)), uintptr(mask)))
|
return int(intrinsics.syscall(unix.SYS_faccessat, uintptr(AT_FDCWD), uintptr(rawptr(path)), uintptr(mask)))
|
||||||
@@ -356,7 +356,7 @@ _unix_chdir :: proc(path: cstring) -> int {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_unix_rename :: proc(old, new: cstring) -> int {
|
_unix_rename :: proc(old, new: cstring) -> int {
|
||||||
when ODIN_ARCH != "arm64" {
|
when ODIN_ARCH != .arm64 {
|
||||||
return int(intrinsics.syscall(unix.SYS_rename, uintptr(rawptr(old)), uintptr(rawptr(new))))
|
return int(intrinsics.syscall(unix.SYS_rename, uintptr(rawptr(old)), uintptr(rawptr(new))))
|
||||||
} else { // NOTE: arm64 does not have rename
|
} else { // NOTE: arm64 does not have rename
|
||||||
return int(intrinsics.syscall(unix.SYS_renameat, uintptr(AT_FDCWD), uintptr(rawptr(old)), uintptr(rawptr(new))))
|
return int(intrinsics.syscall(unix.SYS_renameat, uintptr(AT_FDCWD), uintptr(rawptr(old)), uintptr(rawptr(new))))
|
||||||
@@ -364,7 +364,7 @@ _unix_rename :: proc(old, new: cstring) -> int {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_unix_unlink :: proc(path: cstring) -> int {
|
_unix_unlink :: proc(path: cstring) -> int {
|
||||||
when ODIN_ARCH != "arm64" {
|
when ODIN_ARCH != .arm64 {
|
||||||
return int(intrinsics.syscall(unix.SYS_unlink, uintptr(rawptr(path))))
|
return int(intrinsics.syscall(unix.SYS_unlink, uintptr(rawptr(path))))
|
||||||
} else { // NOTE: arm64 does not have unlink
|
} else { // NOTE: arm64 does not have unlink
|
||||||
return int(intrinsics.syscall(unix.SYS_unlinkat, uintptr(AT_FDCWD), uintptr(rawptr(path), 0)))
|
return int(intrinsics.syscall(unix.SYS_unlinkat, uintptr(AT_FDCWD), uintptr(rawptr(path), 0)))
|
||||||
@@ -372,7 +372,7 @@ _unix_unlink :: proc(path: cstring) -> int {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_unix_rmdir :: proc(path: cstring) -> int {
|
_unix_rmdir :: proc(path: cstring) -> int {
|
||||||
when ODIN_ARCH != "arm64" {
|
when ODIN_ARCH != .arm64 {
|
||||||
return int(intrinsics.syscall(unix.SYS_rmdir, uintptr(rawptr(path))))
|
return int(intrinsics.syscall(unix.SYS_rmdir, uintptr(rawptr(path))))
|
||||||
} else { // NOTE: arm64 does not have rmdir
|
} else { // NOTE: arm64 does not have rmdir
|
||||||
return int(intrinsics.syscall(unix.SYS_unlinkat, uintptr(AT_FDCWD), uintptr(rawptr(path)), AT_REMOVEDIR))
|
return int(intrinsics.syscall(unix.SYS_unlinkat, uintptr(AT_FDCWD), uintptr(rawptr(path)), AT_REMOVEDIR))
|
||||||
@@ -380,7 +380,7 @@ _unix_rmdir :: proc(path: cstring) -> int {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_unix_mkdir :: proc(path: cstring, mode: u32) -> int {
|
_unix_mkdir :: proc(path: cstring, mode: u32) -> int {
|
||||||
when ODIN_ARCH != "arm64" {
|
when ODIN_ARCH != .arm64 {
|
||||||
return int(intrinsics.syscall(unix.SYS_mkdir, uintptr(rawptr(path)), uintptr(mode)))
|
return int(intrinsics.syscall(unix.SYS_mkdir, uintptr(rawptr(path)), uintptr(mode)))
|
||||||
} else { // NOTE: arm64 does not have mkdir
|
} else { // NOTE: arm64 does not have mkdir
|
||||||
return int(intrinsics.syscall(unix.SYS_mkdirat, uintptr(AT_FDCWD), uintptr(rawptr(path)), uintptr(mode)))
|
return int(intrinsics.syscall(unix.SYS_mkdirat, uintptr(AT_FDCWD), uintptr(rawptr(path)), uintptr(mode)))
|
||||||
|
|||||||
+3
-3
@@ -19,7 +19,7 @@ _file_stream_vtable := &io.Stream_VTable{
|
|||||||
return
|
return
|
||||||
},
|
},
|
||||||
impl_read_at = proc(s: io.Stream, p: []byte, offset: i64) -> (n: int, err: io.Error) {
|
impl_read_at = proc(s: io.Stream, p: []byte, offset: i64) -> (n: int, err: io.Error) {
|
||||||
when ODIN_OS == "windows" || ODIN_OS == "wasi" {
|
when ODIN_OS == .Windows || ODIN_OS == .WASI {
|
||||||
fd := Handle(uintptr(s.stream_data))
|
fd := Handle(uintptr(s.stream_data))
|
||||||
os_err: Errno
|
os_err: Errno
|
||||||
n, os_err = read_at(fd, p, offset)
|
n, os_err = read_at(fd, p, offset)
|
||||||
@@ -33,7 +33,7 @@ _file_stream_vtable := &io.Stream_VTable{
|
|||||||
return
|
return
|
||||||
},
|
},
|
||||||
impl_write_at = proc(s: io.Stream, p: []byte, offset: i64) -> (n: int, err: io.Error) {
|
impl_write_at = proc(s: io.Stream, p: []byte, offset: i64) -> (n: int, err: io.Error) {
|
||||||
when ODIN_OS == "windows" || ODIN_OS == "wasi" {
|
when ODIN_OS == .Windows || ODIN_OS == .WASI {
|
||||||
fd := Handle(uintptr(s.stream_data))
|
fd := Handle(uintptr(s.stream_data))
|
||||||
os_err: Errno
|
os_err: Errno
|
||||||
n, os_err = write_at(fd, p, offset)
|
n, os_err = write_at(fd, p, offset)
|
||||||
@@ -53,7 +53,7 @@ _file_stream_vtable := &io.Stream_VTable{
|
|||||||
return sz
|
return sz
|
||||||
},
|
},
|
||||||
impl_flush = proc(s: io.Stream) -> io.Error {
|
impl_flush = proc(s: io.Stream) -> io.Error {
|
||||||
when ODIN_OS == "windows" {
|
when ODIN_OS == .Windows {
|
||||||
fd := Handle(uintptr(s.stream_data))
|
fd := Handle(uintptr(s.stream_data))
|
||||||
flush(fd)
|
flush(fd)
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ scan_chunk :: proc(pattern: string) -> (star: bool, chunk, rest: string) {
|
|||||||
scan_loop: for i = 0; i < len(pattern); i += 1 {
|
scan_loop: for i = 0; i < len(pattern); i += 1 {
|
||||||
switch pattern[i] {
|
switch pattern[i] {
|
||||||
case '\\':
|
case '\\':
|
||||||
when ODIN_OS != "windows" {
|
when ODIN_OS != .Windows {
|
||||||
if i+1 < len(pattern) {
|
if i+1 < len(pattern) {
|
||||||
i += 1
|
i += 1
|
||||||
}
|
}
|
||||||
@@ -161,7 +161,7 @@ match_chunk :: proc(chunk, s: string) -> (rest: string, ok: bool, err: Match_Err
|
|||||||
chunk = chunk[1:]
|
chunk = chunk[1:]
|
||||||
|
|
||||||
case '\\':
|
case '\\':
|
||||||
when ODIN_OS != "windows" {
|
when ODIN_OS != .Windows {
|
||||||
chunk = chunk[1:]
|
chunk = chunk[1:]
|
||||||
if len(chunk) == 0 {
|
if len(chunk) == 0 {
|
||||||
err = .Syntax_Error
|
err = .Syntax_Error
|
||||||
@@ -188,7 +188,7 @@ get_escape :: proc(chunk: string) -> (r: rune, next_chunk: string, err: Match_Er
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
chunk := chunk
|
chunk := chunk
|
||||||
if chunk[0] == '\\' && ODIN_OS != "windows" {
|
if chunk[0] == '\\' && ODIN_OS != .Windows {
|
||||||
chunk = chunk[1:]
|
chunk = chunk[1:]
|
||||||
if len(chunk) == 0 {
|
if len(chunk) == 0 {
|
||||||
err = .Syntax_Error
|
err = .Syntax_Error
|
||||||
@@ -229,7 +229,7 @@ glob :: proc(pattern: string, allocator := context.allocator) -> (matches: []str
|
|||||||
|
|
||||||
dir, file := split(pattern)
|
dir, file := split(pattern)
|
||||||
volume_len := 0
|
volume_len := 0
|
||||||
when ODIN_OS == "windows" {
|
when ODIN_OS == .Windows {
|
||||||
temp_buf: [8]byte
|
temp_buf: [8]byte
|
||||||
volume_len, dir = clean_glob_path_windows(dir, temp_buf[:])
|
volume_len, dir = clean_glob_path_windows(dir, temp_buf[:])
|
||||||
} else {
|
} else {
|
||||||
@@ -307,7 +307,7 @@ _glob :: proc(dir, pattern: string, matches: ^[dynamic]string) -> (m: [dynamic]s
|
|||||||
|
|
||||||
@(private)
|
@(private)
|
||||||
has_meta :: proc(path: string) -> bool {
|
has_meta :: proc(path: string) -> bool {
|
||||||
when ODIN_OS == "windows" {
|
when ODIN_OS == .Windows {
|
||||||
CHARS :: `*?[`
|
CHARS :: `*?[`
|
||||||
} else {
|
} else {
|
||||||
CHARS :: `*?[\`
|
CHARS :: `*?[\`
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import "core:strings"
|
|||||||
is_separator :: proc(c: byte) -> bool {
|
is_separator :: proc(c: byte) -> bool {
|
||||||
switch c {
|
switch c {
|
||||||
case '/': return true
|
case '/': return true
|
||||||
case '\\': return ODIN_OS == "windows"
|
case '\\': return ODIN_OS == .Windows
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
@@ -32,7 +32,7 @@ volume_name :: proc(path: string) -> string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
volume_name_len :: proc(path: string) -> int {
|
volume_name_len :: proc(path: string) -> int {
|
||||||
if ODIN_OS == "windows" {
|
if ODIN_OS == .Windows {
|
||||||
if len(path) < 2 {
|
if len(path) < 2 {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
//+build linux, darwin, freebsd
|
//+build linux, darwin, freebsd
|
||||||
package filepath
|
package filepath
|
||||||
|
|
||||||
when ODIN_OS == "darwin" {
|
when ODIN_OS == .Darwin {
|
||||||
foreign import libc "System.framework"
|
foreign import libc "System.framework"
|
||||||
} else {
|
} else {
|
||||||
foreign import libc "system:c"
|
foreign import libc "system:c"
|
||||||
@@ -54,7 +54,7 @@ foreign libc {
|
|||||||
@(link_name="free") _unix_free :: proc(ptr: rawptr) ---
|
@(link_name="free") _unix_free :: proc(ptr: rawptr) ---
|
||||||
|
|
||||||
}
|
}
|
||||||
when ODIN_OS == "darwin" {
|
when ODIN_OS == .Darwin {
|
||||||
@(private)
|
@(private)
|
||||||
foreign libc {
|
foreign libc {
|
||||||
@(link_name="__error") __error :: proc() -> ^i32 ---
|
@(link_name="__error") __error :: proc() -> ^i32 ---
|
||||||
|
|||||||
+30
-1
@@ -387,6 +387,35 @@ Raw_Cstring :: struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
// Defined internally by the compiler
|
||||||
|
Odin_OS_Type :: enum int {
|
||||||
|
Unknown,
|
||||||
|
Windows,
|
||||||
|
Darwin,
|
||||||
|
Linux,
|
||||||
|
Essence,
|
||||||
|
FreeBSD,
|
||||||
|
WASI,
|
||||||
|
JS,
|
||||||
|
Freestanding,
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
Odin_OS_Type :: type_of(ODIN_OS)
|
||||||
|
|
||||||
|
/*
|
||||||
|
// Defined internally by the compiler
|
||||||
|
Odin_Arch_Type :: enum int {
|
||||||
|
Unknown,
|
||||||
|
amd64,
|
||||||
|
i386,
|
||||||
|
arm64,
|
||||||
|
wasm32,
|
||||||
|
wasm64,
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
Odin_Arch_Type :: type_of(ODIN_ARCH)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
// Defined internally by the compiler
|
// Defined internally by the compiler
|
||||||
Odin_Build_Mode_Type :: enum int {
|
Odin_Build_Mode_Type :: enum int {
|
||||||
@@ -540,7 +569,7 @@ __init_context :: proc "contextless" (c: ^Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
default_assertion_failure_proc :: proc(prefix, message: string, loc: Source_Code_Location) -> ! {
|
default_assertion_failure_proc :: proc(prefix, message: string, loc: Source_Code_Location) -> ! {
|
||||||
when ODIN_OS == "freestanding" {
|
when ODIN_OS == .Freestanding {
|
||||||
// Do nothing
|
// Do nothing
|
||||||
} else {
|
} else {
|
||||||
print_caller_location(loc)
|
print_caller_location(loc)
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ nil_allocator :: proc() -> Allocator {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
when ODIN_OS == "freestanding" {
|
when ODIN_OS == .Freestanding {
|
||||||
default_allocator_proc :: nil_allocator_proc
|
default_allocator_proc :: nil_allocator_proc
|
||||||
default_allocator :: nil_allocator
|
default_allocator :: nil_allocator
|
||||||
}
|
}
|
||||||
@@ -3,7 +3,7 @@ package runtime
|
|||||||
DEFAULT_TEMP_ALLOCATOR_BACKING_SIZE: int : #config(DEFAULT_TEMP_ALLOCATOR_BACKING_SIZE, 1<<22)
|
DEFAULT_TEMP_ALLOCATOR_BACKING_SIZE: int : #config(DEFAULT_TEMP_ALLOCATOR_BACKING_SIZE, 1<<22)
|
||||||
|
|
||||||
|
|
||||||
when ODIN_OS == "freestanding" || ODIN_OS == "js" || ODIN_DEFAULT_TO_NIL_ALLOCATOR {
|
when ODIN_OS == .Freestanding || ODIN_OS == .JS || ODIN_DEFAULT_TO_NIL_ALLOCATOR {
|
||||||
Default_Temp_Allocator :: struct {}
|
Default_Temp_Allocator :: struct {}
|
||||||
|
|
||||||
default_temp_allocator_init :: proc(s: ^Default_Temp_Allocator, size: int, backup_allocator := context.allocator) {}
|
default_temp_allocator_init :: proc(s: ^Default_Temp_Allocator, size: int, backup_allocator := context.allocator) {}
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ when ODIN_BUILD_MODE == .Dynamic {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
} else when !ODIN_TEST && !ODIN_NO_ENTRY_POINT {
|
} else when !ODIN_TEST && !ODIN_NO_ENTRY_POINT {
|
||||||
when ODIN_ARCH == "i386" || ODIN_NO_CRT {
|
when ODIN_ARCH == .i386 || ODIN_NO_CRT {
|
||||||
@(link_name="mainCRTStartup", linkage="strong", require)
|
@(link_name="mainCRTStartup", linkage="strong", require)
|
||||||
mainCRTStartup :: proc "stdcall" () -> i32 {
|
mainCRTStartup :: proc "stdcall" () -> i32 {
|
||||||
context = default_context()
|
context = default_context()
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package runtime
|
package runtime
|
||||||
|
|
||||||
bounds_trap :: proc "contextless" () -> ! {
|
bounds_trap :: proc "contextless" () -> ! {
|
||||||
when ODIN_OS == "windows" {
|
when ODIN_OS == .Windows {
|
||||||
windows_trap_array_bounds()
|
windows_trap_array_bounds()
|
||||||
} else {
|
} else {
|
||||||
trap()
|
trap()
|
||||||
@@ -9,7 +9,7 @@ bounds_trap :: proc "contextless" () -> ! {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type_assertion_trap :: proc "contextless" () -> ! {
|
type_assertion_trap :: proc "contextless" () -> ! {
|
||||||
when ODIN_OS == "windows" {
|
when ODIN_OS == .Windows {
|
||||||
windows_trap_type_assertion()
|
windows_trap_type_assertion()
|
||||||
} else {
|
} else {
|
||||||
trap()
|
trap()
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package runtime
|
|||||||
import "core:intrinsics"
|
import "core:intrinsics"
|
||||||
|
|
||||||
@(private="file")
|
@(private="file")
|
||||||
IS_WASM :: ODIN_ARCH == "wasm32" || ODIN_ARCH == "wasm64"
|
IS_WASM :: ODIN_ARCH == .wasm32 || ODIN_ARCH == .wasm64
|
||||||
|
|
||||||
@(private)
|
@(private)
|
||||||
RUNTIME_LINKAGE :: "strong" when (
|
RUNTIME_LINKAGE :: "strong" when (
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package runtime
|
package runtime
|
||||||
|
|
||||||
when ODIN_NO_CRT && ODIN_OS == "windows" {
|
when ODIN_NO_CRT && ODIN_OS == .Windows {
|
||||||
foreign import lib "system:NtDll.lib"
|
foreign import lib "system:NtDll.lib"
|
||||||
|
|
||||||
@(private="file")
|
@(private="file")
|
||||||
@@ -25,7 +25,7 @@ when ODIN_NO_CRT && ODIN_OS == "windows" {
|
|||||||
RtlMoveMemory(dst, src, len)
|
RtlMoveMemory(dst, src, len)
|
||||||
return dst
|
return dst
|
||||||
}
|
}
|
||||||
} else when ODIN_NO_CRT || (ODIN_ARCH == "wasm32" || ODIN_ARCH == "wasm64") {
|
} else when ODIN_NO_CRT || (ODIN_ARCH == .wasm32 || ODIN_ARCH == .wasm64) {
|
||||||
@(link_name="memset", linkage="strong", require)
|
@(link_name="memset", linkage="strong", require)
|
||||||
memset :: proc "c" (ptr: rawptr, val: i32, len: int) -> rawptr {
|
memset :: proc "c" (ptr: rawptr, val: i32, len: int) -> rawptr {
|
||||||
if ptr != nil && len != 0 {
|
if ptr != nil && len != 0 {
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ current_thread_id :: proc "contextless" () -> int {
|
|||||||
//
|
//
|
||||||
// A Mutex must not be copied after first use
|
// A Mutex must not be copied after first use
|
||||||
Mutex :: struct {
|
Mutex :: struct {
|
||||||
impl: _Mutex,
|
impl: _Mutex `This is a tag`,
|
||||||
}
|
}
|
||||||
|
|
||||||
// mutex_lock locks m
|
// mutex_lock locks m
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ when #config(ODIN_SYNC_RECURSIVE_MUTEX_USE_FUTEX, true) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
when ODIN_OS != "windows" {
|
when ODIN_OS != .Windows {
|
||||||
RW_Mutex_State :: distinct uint
|
RW_Mutex_State :: distinct uint
|
||||||
RW_Mutex_State_Half_Width :: size_of(RW_Mutex_State)*8/2
|
RW_Mutex_State_Half_Width :: size_of(RW_Mutex_State)*8/2
|
||||||
RW_Mutex_State_Is_Writing :: RW_Mutex_State(1)
|
RW_Mutex_State_Is_Writing :: RW_Mutex_State(1)
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ import "core:intrinsics"
|
|||||||
// 386: arch/x86/entry/syscalls/sycall_32.tbl
|
// 386: arch/x86/entry/syscalls/sycall_32.tbl
|
||||||
// arm: arch/arm/tools/syscall.tbl
|
// arm: arch/arm/tools/syscall.tbl
|
||||||
|
|
||||||
when ODIN_ARCH == "amd64" {
|
when ODIN_ARCH == .amd64 {
|
||||||
SYS_read : uintptr : 0
|
SYS_read : uintptr : 0
|
||||||
SYS_write : uintptr : 1
|
SYS_write : uintptr : 1
|
||||||
SYS_open : uintptr : 2
|
SYS_open : uintptr : 2
|
||||||
@@ -374,7 +374,7 @@ when ODIN_ARCH == "amd64" {
|
|||||||
SYS_landlock_add_rule : uintptr : 445
|
SYS_landlock_add_rule : uintptr : 445
|
||||||
SYS_landlock_restrict_self : uintptr : 446
|
SYS_landlock_restrict_self : uintptr : 446
|
||||||
SYS_memfd_secret : uintptr : 447
|
SYS_memfd_secret : uintptr : 447
|
||||||
} else when ODIN_ARCH == "arm64" {
|
} else when ODIN_ARCH == .arm64 {
|
||||||
SYS_io_setup : uintptr : 0
|
SYS_io_setup : uintptr : 0
|
||||||
SYS_io_destroy : uintptr : 1
|
SYS_io_destroy : uintptr : 1
|
||||||
SYS_io_submit : uintptr : 2
|
SYS_io_submit : uintptr : 2
|
||||||
@@ -675,7 +675,7 @@ when ODIN_ARCH == "amd64" {
|
|||||||
SYS_landlock_create_ruleset : uintptr : 444
|
SYS_landlock_create_ruleset : uintptr : 444
|
||||||
SYS_landlock_add_rule : uintptr : 445
|
SYS_landlock_add_rule : uintptr : 445
|
||||||
SYS_landlock_restrict_self : uintptr : 446
|
SYS_landlock_restrict_self : uintptr : 446
|
||||||
} else when ODIN_ARCH == "i386" {
|
} else when ODIN_ARCH == .i386 {
|
||||||
SYS_restart_syscall : uintptr : 0
|
SYS_restart_syscall : uintptr : 0
|
||||||
SYS_exit : uintptr : 1
|
SYS_exit : uintptr : 1
|
||||||
SYS_fork : uintptr : 2
|
SYS_fork : uintptr : 2
|
||||||
@@ -1112,7 +1112,7 @@ when ODIN_ARCH == "amd64" {
|
|||||||
SYS_landlock_add_rule : uintptr : 445
|
SYS_landlock_add_rule : uintptr : 445
|
||||||
SYS_landlock_restrict_self : uintptr : 446
|
SYS_landlock_restrict_self : uintptr : 446
|
||||||
SYS_memfd_secret : uintptr : 447
|
SYS_memfd_secret : uintptr : 447
|
||||||
} else when ODIN_ARCH == "arm" {
|
} else when false /*ODIN_ARCH == .arm*/ { // TODO
|
||||||
SYS_restart_syscall : uintptr : 0
|
SYS_restart_syscall : uintptr : 0
|
||||||
SYS_exit : uintptr : 1
|
SYS_exit : uintptr : 1
|
||||||
SYS_fork : uintptr : 2
|
SYS_fork : uintptr : 2
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package time
|
|||||||
|
|
||||||
IS_SUPPORTED :: true // NOTE: Times on Darwin are UTC.
|
IS_SUPPORTED :: true // NOTE: Times on Darwin are UTC.
|
||||||
|
|
||||||
when ODIN_OS == "darwin" {
|
when ODIN_OS == .Darwin {
|
||||||
foreign import libc "System.framework"
|
foreign import libc "System.framework"
|
||||||
} else {
|
} else {
|
||||||
foreign import libc "system:c"
|
foreign import libc "system:c"
|
||||||
|
|||||||
@@ -244,10 +244,10 @@ control_flow :: proc() {
|
|||||||
// A switch statement is another way to write a sequence of if-else statements.
|
// A switch statement is another way to write a sequence of if-else statements.
|
||||||
// In Odin, the default case is denoted as a case without any expression.
|
// In Odin, the default case is denoted as a case without any expression.
|
||||||
|
|
||||||
switch arch := ODIN_ARCH; arch {
|
#partial switch arch := ODIN_ARCH; arch {
|
||||||
case "386":
|
case .i386:
|
||||||
fmt.println("32-bit")
|
fmt.println("32-bit")
|
||||||
case "amd64":
|
case .amd64:
|
||||||
fmt.println("64-bit")
|
fmt.println("64-bit")
|
||||||
case: // default
|
case: // default
|
||||||
fmt.println("Unsupported architecture")
|
fmt.println("Unsupported architecture")
|
||||||
@@ -363,12 +363,12 @@ control_flow :: proc() {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// Example
|
// Example
|
||||||
when ODIN_ARCH == "386" {
|
when ODIN_ARCH == .i386 {
|
||||||
fmt.println("32 bit")
|
fmt.println("32 bit")
|
||||||
} else when ODIN_ARCH == "amd64" {
|
} else when ODIN_ARCH == .amd64 {
|
||||||
fmt.println("64 bit")
|
fmt.println("64 bit")
|
||||||
} else {
|
} else {
|
||||||
fmt.println("Unsupported architecture")
|
fmt.println("Unknown architecture")
|
||||||
}
|
}
|
||||||
// The when statement is very useful for writing platform specific code.
|
// The when statement is very useful for writing platform specific code.
|
||||||
// This is akin to the #if construct in C’s preprocessor however, in Odin,
|
// This is akin to the #if construct in C’s preprocessor however, in Odin,
|
||||||
@@ -1100,7 +1100,7 @@ prefix_table := [?]string{
|
|||||||
}
|
}
|
||||||
|
|
||||||
threading_example :: proc() {
|
threading_example :: proc() {
|
||||||
if ODIN_OS == "darwin" {
|
if ODIN_OS == .Darwin {
|
||||||
// TODO: Fix threads on darwin/macOS
|
// TODO: Fix threads on darwin/macOS
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -1606,13 +1606,13 @@ where_clauses :: proc() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
when ODIN_OS == "windows" {
|
when ODIN_OS == .Windows {
|
||||||
foreign import kernel32 "system:kernel32.lib"
|
foreign import kernel32 "system:kernel32.lib"
|
||||||
}
|
}
|
||||||
|
|
||||||
foreign_system :: proc() {
|
foreign_system :: proc() {
|
||||||
fmt.println("\n#foreign system")
|
fmt.println("\n#foreign system")
|
||||||
when ODIN_OS == "windows" {
|
when ODIN_OS == .Windows {
|
||||||
// It is sometimes necessarily to interface with foreign code,
|
// It is sometimes necessarily to interface with foreign code,
|
||||||
// such as a C library. In Odin, this is achieved through the
|
// such as a C library. In Odin, this is achieved through the
|
||||||
// foreign system. You can “import” a library into the code
|
// foreign system. You can “import” a library into the code
|
||||||
|
|||||||
+34
-3
@@ -881,12 +881,43 @@ void init_universal(void) {
|
|||||||
add_global_bool_constant("false", false);
|
add_global_bool_constant("false", false);
|
||||||
|
|
||||||
// TODO(bill): Set through flags in the compiler
|
// TODO(bill): Set through flags in the compiler
|
||||||
add_global_string_constant("ODIN_OS", bc->ODIN_OS);
|
|
||||||
add_global_string_constant("ODIN_ARCH", bc->ODIN_ARCH);
|
|
||||||
add_global_string_constant("ODIN_VENDOR", bc->ODIN_VENDOR);
|
add_global_string_constant("ODIN_VENDOR", bc->ODIN_VENDOR);
|
||||||
add_global_string_constant("ODIN_VERSION", bc->ODIN_VERSION);
|
add_global_string_constant("ODIN_VERSION", bc->ODIN_VERSION);
|
||||||
add_global_string_constant("ODIN_ROOT", bc->ODIN_ROOT);
|
add_global_string_constant("ODIN_ROOT", bc->ODIN_ROOT);
|
||||||
|
|
||||||
|
{
|
||||||
|
GlobalEnumValue values[TargetOs_COUNT] = {
|
||||||
|
{"Unknown", TargetOs_Invalid},
|
||||||
|
{"Windows", TargetOs_windows},
|
||||||
|
{"Darwin", TargetOs_darwin},
|
||||||
|
{"Linux", TargetOs_linux},
|
||||||
|
{"Essence", TargetOs_essence},
|
||||||
|
{"FreeBSD", TargetOs_freebsd},
|
||||||
|
{"WASI", TargetOs_wasi},
|
||||||
|
{"JS", TargetOs_js},
|
||||||
|
{"Freestanding", TargetOs_freestanding},
|
||||||
|
};
|
||||||
|
|
||||||
|
auto fields = add_global_enum_type(str_lit("Odin_OS_Type"), values, gb_count_of(values));
|
||||||
|
add_global_enum_constant(fields, "ODIN_OS", bc->metrics.os);
|
||||||
|
add_global_string_constant("ODIN_OS_STRING", target_os_names[bc->metrics.os]);
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
GlobalEnumValue values[TargetArch_COUNT] = {
|
||||||
|
{"Unknown", TargetArch_Invalid},
|
||||||
|
{"amd64", TargetArch_amd64},
|
||||||
|
{"i386", TargetArch_i386},
|
||||||
|
{"arm64", TargetArch_arm64},
|
||||||
|
{"wasm32", TargetArch_wasm32},
|
||||||
|
{"wasm64", TargetArch_wasm64},
|
||||||
|
};
|
||||||
|
|
||||||
|
auto fields = add_global_enum_type(str_lit("Odin_Arch_Type"), values, gb_count_of(values));
|
||||||
|
add_global_enum_constant(fields, "ODIN_ARCH", bc->metrics.arch);
|
||||||
|
add_global_string_constant("ODIN_ARCH_STRING", target_arch_names[bc->metrics.arch]);
|
||||||
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
GlobalEnumValue values[BuildMode_COUNT] = {
|
GlobalEnumValue values[BuildMode_COUNT] = {
|
||||||
{"Executable", BuildMode_Executable},
|
{"Executable", BuildMode_Executable},
|
||||||
@@ -900,7 +931,6 @@ void init_universal(void) {
|
|||||||
add_global_enum_constant(fields, "ODIN_BUILD_MODE", bc->build_mode);
|
add_global_enum_constant(fields, "ODIN_BUILD_MODE", bc->build_mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
add_global_string_constant("ODIN_ENDIAN_STRING", target_endian_names[target_endians[bc->metrics.arch]]);
|
|
||||||
{
|
{
|
||||||
GlobalEnumValue values[TargetEndian_COUNT] = {
|
GlobalEnumValue values[TargetEndian_COUNT] = {
|
||||||
{"Unknown", TargetEndian_Invalid},
|
{"Unknown", TargetEndian_Invalid},
|
||||||
@@ -911,6 +941,7 @@ void init_universal(void) {
|
|||||||
|
|
||||||
auto fields = add_global_enum_type(str_lit("Odin_Endian_Type"), values, gb_count_of(values));
|
auto fields = add_global_enum_type(str_lit("Odin_Endian_Type"), values, gb_count_of(values));
|
||||||
add_global_enum_constant(fields, "ODIN_ENDIAN", target_endians[bc->metrics.arch]);
|
add_global_enum_constant(fields, "ODIN_ENDIAN", target_endians[bc->metrics.arch]);
|
||||||
|
add_global_string_constant("ODIN_ENDIAN_STRING", target_endian_names[target_endians[bc->metrics.arch]]);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -308,7 +308,7 @@ test_x25519 :: proc(t: ^testing.T) {
|
|||||||
test_rand_bytes :: proc(t: ^testing.T) {
|
test_rand_bytes :: proc(t: ^testing.T) {
|
||||||
log(t, "Testing rand_bytes")
|
log(t, "Testing rand_bytes")
|
||||||
|
|
||||||
if ODIN_OS != "linux" {
|
if ODIN_OS != .Linux {
|
||||||
log(t, "rand_bytes not supported - skipping")
|
log(t, "rand_bytes not supported - skipping")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1785,7 +1785,7 @@ write_image_as_ppm :: proc(filename: string, image: ^image.Image) -> (success: b
|
|||||||
}
|
}
|
||||||
|
|
||||||
mode: int = 0
|
mode: int = 0
|
||||||
when ODIN_OS == "linux" || ODIN_OS == "darwin" {
|
when ODIN_OS == .Linux || ODIN_OS == .Darwin {
|
||||||
// NOTE(justasd): 644 (owner read, write; group read; others read)
|
// NOTE(justasd): 644 (owner read, write; group read; others read)
|
||||||
mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH
|
mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH
|
||||||
}
|
}
|
||||||
|
|||||||
Vendored
+2
-2
@@ -1,7 +1,7 @@
|
|||||||
package ENet
|
package ENet
|
||||||
|
|
||||||
when ODIN_OS == "windows" {
|
when ODIN_OS == .Windows {
|
||||||
when ODIN_ARCH == "amd64" {
|
when ODIN_ARCH == .amd64 {
|
||||||
foreign import ENet {
|
foreign import ENet {
|
||||||
"lib/enet64.lib",
|
"lib/enet64.lib",
|
||||||
"system:Ws2_32.lib",
|
"system:Ws2_32.lib",
|
||||||
|
|||||||
Vendored
+1
-1
@@ -188,7 +188,7 @@ load_shaders_source :: proc(vs_source, fs_source: string, binary_retrievable :=
|
|||||||
load_shaders :: proc{load_shaders_file}
|
load_shaders :: proc{load_shaders_file}
|
||||||
|
|
||||||
|
|
||||||
when ODIN_OS == "windows" {
|
when ODIN_OS == .Windows {
|
||||||
update_shader_if_changed :: proc(
|
update_shader_if_changed :: proc(
|
||||||
vertex_name, fragment_name: string,
|
vertex_name, fragment_name: string,
|
||||||
program: u32,
|
program: u32,
|
||||||
|
|||||||
Vendored
+3
-3
@@ -136,11 +136,11 @@ totp_t :: ^totp_struct
|
|||||||
fpe_struct :: struct{}
|
fpe_struct :: struct{}
|
||||||
fpe_t :: ^fpe_struct
|
fpe_t :: ^fpe_struct
|
||||||
|
|
||||||
when ODIN_OS == "windows" {
|
when ODIN_OS == .Windows {
|
||||||
foreign import botan_lib "botan.lib"
|
foreign import botan_lib "botan.lib"
|
||||||
} else when ODIN_OS == "linux" {
|
} else when ODIN_OS == .Linux {
|
||||||
foreign import botan_lib "system:botan-2"
|
foreign import botan_lib "system:botan-2"
|
||||||
} else when ODIN_OS == "darwin" {
|
} else when ODIN_OS == .Darwin {
|
||||||
foreign import botan_lib "system:botan-2"
|
foreign import botan_lib "system:botan-2"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Vendored
+3
-3
@@ -3,9 +3,9 @@ package glfw_bindings
|
|||||||
import "core:c"
|
import "core:c"
|
||||||
import vk "vendor:vulkan"
|
import vk "vendor:vulkan"
|
||||||
|
|
||||||
when ODIN_OS == "linux" { foreign import glfw "system:glfw" } // TODO: Add the billion-or-so static libs to link to in linux
|
when ODIN_OS == .Linux { foreign import glfw "system:glfw" } // TODO: Add the billion-or-so static libs to link to in linux
|
||||||
when ODIN_OS == "darwin" { foreign import glfw "system:glfw" }
|
when ODIN_OS == .Darwin { foreign import glfw "system:glfw" }
|
||||||
when ODIN_OS == "windows" {
|
when ODIN_OS == .Windows {
|
||||||
foreign import glfw {
|
foreign import glfw {
|
||||||
"../lib/glfw3_mt.lib",
|
"../lib/glfw3_mt.lib",
|
||||||
"system:user32.lib",
|
"system:user32.lib",
|
||||||
|
|||||||
Vendored
+3
-3
@@ -1,6 +1,6 @@
|
|||||||
package glfw
|
package glfw
|
||||||
|
|
||||||
when ODIN_OS == "windows" {
|
when ODIN_OS == .Windows {
|
||||||
import win32 "core:sys/windows"
|
import win32 "core:sys/windows"
|
||||||
|
|
||||||
foreign import glfw { "lib/glfw3.lib", "system:user32.lib", "system:gdi32.lib", "system:shell32.lib" }
|
foreign import glfw { "lib/glfw3.lib", "system:user32.lib", "system:gdi32.lib", "system:shell32.lib" }
|
||||||
@@ -12,7 +12,7 @@ when ODIN_OS == "windows" {
|
|||||||
GetWin32Window :: proc(window: WindowHandle) -> win32.HWND ---
|
GetWin32Window :: proc(window: WindowHandle) -> win32.HWND ---
|
||||||
GetWGLContext :: proc(window: WindowHandle) -> rawptr ---
|
GetWGLContext :: proc(window: WindowHandle) -> rawptr ---
|
||||||
}
|
}
|
||||||
} else when ODIN_OS == "linux" {
|
} else when ODIN_OS == .Linux {
|
||||||
// TODO: Native Linux
|
// TODO: Native Linux
|
||||||
// Display* glfwGetX11Display(void);
|
// Display* glfwGetX11Display(void);
|
||||||
// RRCrtc glfwGetX11Adapter(GLFWmonitor* monitor);
|
// RRCrtc glfwGetX11Adapter(GLFWmonitor* monitor);
|
||||||
@@ -24,7 +24,7 @@ when ODIN_OS == "windows" {
|
|||||||
// struct wl_display* glfwGetWaylandDisplay(void);
|
// struct wl_display* glfwGetWaylandDisplay(void);
|
||||||
// struct wl_output* glfwGetWaylandMonitor(GLFWmonitor* monitor);
|
// struct wl_output* glfwGetWaylandMonitor(GLFWmonitor* monitor);
|
||||||
// struct wl_surface* glfwGetWaylandWindow(GLFWwindow* window);
|
// struct wl_surface* glfwGetWaylandWindow(GLFWwindow* window);
|
||||||
} else when ODIN_OS == "darwin" {
|
} else when ODIN_OS == .Darwin {
|
||||||
// TODO: Native Darwin
|
// TODO: Native Darwin
|
||||||
// CGDirectDisplayID glfwGetCocoaMonitor(GLFWmonitor* monitor);
|
// CGDirectDisplayID glfwGetCocoaMonitor(GLFWmonitor* monitor);
|
||||||
// id glfwGetCocoaWindow(GLFWwindow* window);
|
// id glfwGetCocoaWindow(GLFWwindow* window);
|
||||||
|
|||||||
Vendored
+3
-3
@@ -2,8 +2,8 @@ package miniaudio
|
|||||||
|
|
||||||
import "core:c"
|
import "core:c"
|
||||||
|
|
||||||
when ODIN_OS == "windows" { foreign import lib "lib/miniaudio.lib" }
|
when ODIN_OS == .Windows { foreign import lib "lib/miniaudio.lib" }
|
||||||
when ODIN_OS == "linux" { foreign import lib "lib/miniaudio.a" }
|
when ODIN_OS == .Linux { foreign import lib "lib/miniaudio.a" }
|
||||||
|
|
||||||
handle :: distinct rawptr
|
handle :: distinct rawptr
|
||||||
|
|
||||||
@@ -270,7 +270,7 @@ thread_priority :: enum c.int {
|
|||||||
/* Spinlocks are 32-bit for compatibility reasons. */
|
/* Spinlocks are 32-bit for compatibility reasons. */
|
||||||
spinlock :: distinct u32
|
spinlock :: distinct u32
|
||||||
|
|
||||||
when ODIN_OS == "windows" {
|
when ODIN_OS == .Windows {
|
||||||
thread :: distinct rawptr
|
thread :: distinct rawptr
|
||||||
mutex :: distinct rawptr
|
mutex :: distinct rawptr
|
||||||
event :: distinct rawptr
|
event :: distinct rawptr
|
||||||
|
|||||||
+2
-2
@@ -2,8 +2,8 @@ package miniaudio
|
|||||||
|
|
||||||
import "core:c"
|
import "core:c"
|
||||||
|
|
||||||
when ODIN_OS == "windows" { foreign import lib "lib/miniaudio.lib" }
|
when ODIN_OS == .Windows { foreign import lib "lib/miniaudio.lib" }
|
||||||
when ODIN_OS == "linux" { foreign import lib "lib/miniaudio.a" }
|
when ODIN_OS == .Linux { foreign import lib "lib/miniaudio.a" }
|
||||||
|
|
||||||
|
|
||||||
/************************************************************************************************************************************************************
|
/************************************************************************************************************************************************************
|
||||||
|
|||||||
Vendored
+2
-2
@@ -2,8 +2,8 @@ package miniaudio
|
|||||||
|
|
||||||
import "core:c"
|
import "core:c"
|
||||||
|
|
||||||
when ODIN_OS == "windows" { foreign import lib "lib/miniaudio.lib" }
|
when ODIN_OS == .Windows { foreign import lib "lib/miniaudio.lib" }
|
||||||
when ODIN_OS == "linux" { foreign import lib "lib/miniaudio.a" }
|
when ODIN_OS == .Linux { foreign import lib "lib/miniaudio.a" }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -1,7 +1,7 @@
|
|||||||
package miniaudio
|
package miniaudio
|
||||||
|
|
||||||
when ODIN_OS == "windows" { foreign import lib "lib/miniaudio.lib" }
|
when ODIN_OS == .Windows { foreign import lib "lib/miniaudio.lib" }
|
||||||
when ODIN_OS == "linux" { foreign import lib "lib/miniaudio.a" }
|
when ODIN_OS == .Linux { foreign import lib "lib/miniaudio.a" }
|
||||||
|
|
||||||
import "core:c"
|
import "core:c"
|
||||||
|
|
||||||
|
|||||||
+16
-16
@@ -2,21 +2,21 @@ package miniaudio
|
|||||||
|
|
||||||
import "core:c"
|
import "core:c"
|
||||||
|
|
||||||
SUPPORT_WASAPI :: ODIN_OS == "windows"
|
SUPPORT_WASAPI :: ODIN_OS == .Windows
|
||||||
SUPPORT_DSOUND :: ODIN_OS == "windows"
|
SUPPORT_DSOUND :: ODIN_OS == .Windows
|
||||||
SUPPORT_WINMM :: ODIN_OS == "windows"
|
SUPPORT_WINMM :: ODIN_OS == .Windows
|
||||||
SUPPORT_COREAUDIO :: ODIN_OS == "darwin"
|
SUPPORT_COREAUDIO :: ODIN_OS == .Darwin
|
||||||
SUPPORT_SNDIO :: ODIN_OS == "openbsd"
|
SUPPORT_SNDIO :: false // ODIN_OS == .OpenBSD
|
||||||
SUPPORT_AUDIO4 :: ODIN_OS == "openbsd" || ODIN_OS == "netbsd"
|
SUPPORT_AUDIO4 :: false // ODIN_OS == .OpenBSD || ODIN_OS == .NetBSD
|
||||||
SUPPORT_OSS :: ODIN_OS == "freebsd"
|
SUPPORT_OSS :: ODIN_OS == .FreeBSD
|
||||||
SUPPORT_PULSEAUDIO :: ODIN_OS == "linux"
|
SUPPORT_PULSEAUDIO :: ODIN_OS == .Linux
|
||||||
SUPPORT_ALSA :: ODIN_OS == "linux"
|
SUPPORT_ALSA :: ODIN_OS == .Linux
|
||||||
SUPPORT_JACK :: ODIN_OS == "windows"
|
SUPPORT_JACK :: ODIN_OS == .Windows
|
||||||
SUPPORT_AAUDIO :: ODIN_OS == "android"
|
SUPPORT_AAUDIO :: false // ODIN_OS == .Android
|
||||||
SUPPORT_OPENSL :: ODIN_OS == "android"
|
SUPPORT_OPENSL :: false // ODIN_OS == .Android
|
||||||
SUPPORT_WEBAUDIO :: ODIN_OS == "emscripten"
|
SUPPORT_WEBAUDIO :: false // ODIN_OS == .Emscripten
|
||||||
SUPPORT_CUSTOM :: true
|
SUPPORT_CUSTOM :: true
|
||||||
SUPPORT_NULL :: ODIN_OS != "emscripten"
|
SUPPORT_NULL :: true // ODIN_OS != .Emscripten
|
||||||
|
|
||||||
STATE_UNINITIALIZED :: 0
|
STATE_UNINITIALIZED :: 0
|
||||||
STATE_STOPPED :: 1 /* The device's default state after initialization. */
|
STATE_STOPPED :: 1 /* The device's default state after initialization. */
|
||||||
@@ -895,7 +895,7 @@ context_type :: struct {
|
|||||||
RegOpenKeyExA: proc "system" (),
|
RegOpenKeyExA: proc "system" (),
|
||||||
RegCloseKey: proc "system" (),
|
RegCloseKey: proc "system" (),
|
||||||
RegQueryValueExA: proc "system" (),
|
RegQueryValueExA: proc "system" (),
|
||||||
} when ODIN_OS == "windows" else struct {}),
|
} when ODIN_OS == .Windows else struct {}),
|
||||||
|
|
||||||
posix: (struct {
|
posix: (struct {
|
||||||
pthreadSO: handle,
|
pthreadSO: handle,
|
||||||
@@ -914,7 +914,7 @@ context_type :: struct {
|
|||||||
pthread_attr_setschedpolicy: proc "system" (),
|
pthread_attr_setschedpolicy: proc "system" (),
|
||||||
pthread_attr_getschedparam: proc "system" (),
|
pthread_attr_getschedparam: proc "system" (),
|
||||||
pthread_attr_setschedparam: proc "system" (),
|
pthread_attr_setschedparam: proc "system" (),
|
||||||
} when ODIN_OS != "windows" else struct {}),
|
} when ODIN_OS != .Windows else struct {}),
|
||||||
|
|
||||||
_unused: c.int,
|
_unused: c.int,
|
||||||
},
|
},
|
||||||
|
|||||||
Vendored
+2
-2
@@ -2,8 +2,8 @@ package miniaudio
|
|||||||
|
|
||||||
import "core:c"
|
import "core:c"
|
||||||
|
|
||||||
when ODIN_OS == "windows" { foreign import lib "lib/miniaudio.lib" }
|
when ODIN_OS == .Windows { foreign import lib "lib/miniaudio.lib" }
|
||||||
when ODIN_OS == "linux" { foreign import lib "lib/miniaudio.a" }
|
when ODIN_OS == .Linux { foreign import lib "lib/miniaudio.a" }
|
||||||
|
|
||||||
/************************************************************************************************************************************************************
|
/************************************************************************************************************************************************************
|
||||||
|
|
||||||
|
|||||||
Vendored
+2
-2
@@ -1,7 +1,7 @@
|
|||||||
package miniaudio
|
package miniaudio
|
||||||
|
|
||||||
when ODIN_OS == "windows" { foreign import lib "lib/miniaudio.lib" }
|
when ODIN_OS == .Windows { foreign import lib "lib/miniaudio.lib" }
|
||||||
when ODIN_OS == "linux" { foreign import lib "lib/miniaudio.a" }
|
when ODIN_OS == .Linux { foreign import lib "lib/miniaudio.a" }
|
||||||
|
|
||||||
/**************************************************************************************************************************************************************
|
/**************************************************************************************************************************************************************
|
||||||
|
|
||||||
|
|||||||
Vendored
+2
-2
@@ -2,8 +2,8 @@ package miniaudio
|
|||||||
|
|
||||||
import "core:c"
|
import "core:c"
|
||||||
|
|
||||||
when ODIN_OS == "windows" { foreign import lib "lib/miniaudio.lib" }
|
when ODIN_OS == .Windows { foreign import lib "lib/miniaudio.lib" }
|
||||||
when ODIN_OS == "linux" { foreign import lib "lib/miniaudio.a" }
|
when ODIN_OS == .Linux { foreign import lib "lib/miniaudio.a" }
|
||||||
|
|
||||||
waveform_type :: enum c.int {
|
waveform_type :: enum c.int {
|
||||||
sine,
|
sine,
|
||||||
|
|||||||
Vendored
+2
-2
@@ -2,8 +2,8 @@ package miniaudio
|
|||||||
|
|
||||||
import c "core:c/libc"
|
import c "core:c/libc"
|
||||||
|
|
||||||
when ODIN_OS == "windows" { foreign import lib "lib/miniaudio.lib" }
|
when ODIN_OS == .Windows { foreign import lib "lib/miniaudio.lib" }
|
||||||
when ODIN_OS == "linux" { foreign import lib "lib/miniaudio.a" }
|
when ODIN_OS == .Linux { foreign import lib "lib/miniaudio.a" }
|
||||||
|
|
||||||
MAX_LOG_CALLBACKS :: 4
|
MAX_LOG_CALLBACKS :: 4
|
||||||
|
|
||||||
|
|||||||
Vendored
+2
-2
@@ -1,7 +1,7 @@
|
|||||||
package miniaudio
|
package miniaudio
|
||||||
|
|
||||||
when ODIN_OS == "windows" { foreign import lib "lib/miniaudio.lib" }
|
when ODIN_OS == .Windows { foreign import lib "lib/miniaudio.lib" }
|
||||||
when ODIN_OS == "linux" { foreign import lib "lib/miniaudio.a" }
|
when ODIN_OS == .Linux { foreign import lib "lib/miniaudio.a" }
|
||||||
|
|
||||||
@(default_calling_convention="c", link_prefix="ma_")
|
@(default_calling_convention="c", link_prefix="ma_")
|
||||||
foreign lib {
|
foreign lib {
|
||||||
|
|||||||
Vendored
+2
-2
@@ -2,8 +2,8 @@ package miniaudio
|
|||||||
|
|
||||||
import "core:c"
|
import "core:c"
|
||||||
|
|
||||||
when ODIN_OS == "windows" { foreign import lib "lib/miniaudio.lib" }
|
when ODIN_OS == .Windows { foreign import lib "lib/miniaudio.lib" }
|
||||||
when ODIN_OS == "linux" { foreign import lib "lib/miniaudio.a" }
|
when ODIN_OS == .Linux { foreign import lib "lib/miniaudio.a" }
|
||||||
|
|
||||||
/************************************************************************************************************************************************************
|
/************************************************************************************************************************************************************
|
||||||
|
|
||||||
|
|||||||
Vendored
+1
-1
@@ -3,7 +3,7 @@ package portmidi
|
|||||||
import "core:c"
|
import "core:c"
|
||||||
import "core:strings"
|
import "core:strings"
|
||||||
|
|
||||||
when ODIN_OS == "windows" {
|
when ODIN_OS == .Windows {
|
||||||
foreign import lib {
|
foreign import lib {
|
||||||
"portmidi_s.lib",
|
"portmidi_s.lib",
|
||||||
"system:Winmm.lib",
|
"system:Winmm.lib",
|
||||||
|
|||||||
Vendored
+1
-1
@@ -7,7 +7,7 @@ package portmidi
|
|||||||
|
|
||||||
import "core:c"
|
import "core:c"
|
||||||
|
|
||||||
when ODIN_OS == "windows" { foreign import lib "portmidi_s.lib" }
|
when ODIN_OS == .Windows { foreign import lib "portmidi_s.lib" }
|
||||||
|
|
||||||
|
|
||||||
Queue :: distinct rawptr
|
Queue :: distinct rawptr
|
||||||
|
|||||||
Vendored
+3
-3
@@ -91,7 +91,7 @@ MAX_TEXT_BUFFER_LENGTH :: #config(RAYLIB_MAX_TEXT_BUFFER_LENGTH, 1024)
|
|||||||
|
|
||||||
#assert(size_of(rune) == size_of(c.int))
|
#assert(size_of(rune) == size_of(c.int))
|
||||||
|
|
||||||
when ODIN_OS == "windows" {
|
when ODIN_OS == .Windows {
|
||||||
foreign import lib {
|
foreign import lib {
|
||||||
"raylib.lib",
|
"raylib.lib",
|
||||||
"system:Winmm.lib",
|
"system:Winmm.lib",
|
||||||
@@ -100,14 +100,14 @@ when ODIN_OS == "windows" {
|
|||||||
"system:Shell32.lib",
|
"system:Shell32.lib",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
when ODIN_OS == "linux" {
|
when ODIN_OS == .Linux {
|
||||||
foreign import lib {
|
foreign import lib {
|
||||||
"linux/libraylib.a",
|
"linux/libraylib.a",
|
||||||
"system:dl",
|
"system:dl",
|
||||||
"system:pthread",
|
"system:pthread",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
when ODIN_OS == "darwin" { foreign import lib "macos/libraylib.a" }
|
when ODIN_OS == .Darwin { foreign import lib "macos/libraylib.a" }
|
||||||
|
|
||||||
VERSION :: "4.0"
|
VERSION :: "4.0"
|
||||||
|
|
||||||
|
|||||||
Vendored
+3
-3
@@ -2,7 +2,7 @@ package raylib
|
|||||||
|
|
||||||
import "core:c"
|
import "core:c"
|
||||||
|
|
||||||
when ODIN_OS == "windows" {
|
when ODIN_OS == .Windows {
|
||||||
foreign import lib {
|
foreign import lib {
|
||||||
"raylib.lib",
|
"raylib.lib",
|
||||||
"system:Winmm.lib",
|
"system:Winmm.lib",
|
||||||
@@ -11,8 +11,8 @@ when ODIN_OS == "windows" {
|
|||||||
"system:Shell32.lib",
|
"system:Shell32.lib",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
when ODIN_OS == "linux" { foreign import lib "linux/libraylib.a" }
|
when ODIN_OS == .Linux { foreign import lib "linux/libraylib.a" }
|
||||||
when ODIN_OS == "darwin" { foreign import lib "macos/libraylib.a" }
|
when ODIN_OS == .Darwin { foreign import lib "macos/libraylib.a" }
|
||||||
|
|
||||||
GRAPHICS_API_OPENGL_11 :: false
|
GRAPHICS_API_OPENGL_11 :: false
|
||||||
GRAPHICS_API_OPENGL_21 :: true
|
GRAPHICS_API_OPENGL_21 :: true
|
||||||
|
|||||||
Vendored
+4
-4
@@ -3,10 +3,10 @@ package sdl2_image
|
|||||||
import "core:c"
|
import "core:c"
|
||||||
import SDL ".."
|
import SDL ".."
|
||||||
|
|
||||||
when ODIN_OS == "windows" { foreign import lib "SDL2_image.lib" }
|
when ODIN_OS == .Windows { foreign import lib "SDL2_image.lib" }
|
||||||
when ODIN_OS == "linux" { foreign import lib "system:SDL2_image" }
|
when ODIN_OS == .Linux { foreign import lib "system:SDL2_image" }
|
||||||
when ODIN_OS == "darwin" { foreign import lib "system:SDL2_image" }
|
when ODIN_OS == .Darwin { foreign import lib "system:SDL2_image" }
|
||||||
when ODIN_OS == "freebsd" { foreign import lib "system:SDL2_image" }
|
when ODIN_OS == .FreeBSD { foreign import lib "system:SDL2_image" }
|
||||||
|
|
||||||
bool :: SDL.bool
|
bool :: SDL.bool
|
||||||
|
|
||||||
|
|||||||
Vendored
+4
-4
@@ -3,10 +3,10 @@ package sdl2_mixer
|
|||||||
import "core:c"
|
import "core:c"
|
||||||
import SDL ".."
|
import SDL ".."
|
||||||
|
|
||||||
when ODIN_OS == "windows" { foreign import lib "SDL2_mixer.lib" }
|
when ODIN_OS == .Windows { foreign import lib "SDL2_mixer.lib" }
|
||||||
when ODIN_OS == "linux" { foreign import lib "system:SDL2_mixer" }
|
when ODIN_OS == .Linux { foreign import lib "system:SDL2_mixer" }
|
||||||
when ODIN_OS == "darwin" { foreign import lib "system:SDL2_mixer" }
|
when ODIN_OS == .Darwin { foreign import lib "system:SDL2_mixer" }
|
||||||
when ODIN_OS == "freebsd" { foreign import lib "system:SDL2_mixer" }
|
when ODIN_OS == .FreeBSD { foreign import lib "system:SDL2_mixer" }
|
||||||
|
|
||||||
|
|
||||||
MAJOR_VERSION :: 2
|
MAJOR_VERSION :: 2
|
||||||
|
|||||||
Vendored
+4
-4
@@ -3,10 +3,10 @@ package sdl2_net
|
|||||||
import "core:c"
|
import "core:c"
|
||||||
import SDL ".."
|
import SDL ".."
|
||||||
|
|
||||||
when ODIN_OS == "windows" { foreign import lib "SDL2_net.lib" }
|
when ODIN_OS == .Windows { foreign import lib "SDL2_net.lib" }
|
||||||
when ODIN_OS == "linux" { foreign import lib "system:SDL2_net" }
|
when ODIN_OS == .Linux { foreign import lib "system:SDL2_net" }
|
||||||
when ODIN_OS == "darwin" { foreign import lib "system:SDL2_net" }
|
when ODIN_OS == .Darwin { foreign import lib "system:SDL2_net" }
|
||||||
when ODIN_OS == "freebsd" { foreign import lib "system:SDL2_net" }
|
when ODIN_OS == .FreeBSD { foreign import lib "system:SDL2_net" }
|
||||||
|
|
||||||
bool :: SDL.bool
|
bool :: SDL.bool
|
||||||
|
|
||||||
|
|||||||
Vendored
+4
-4
@@ -25,10 +25,10 @@ package sdl2
|
|||||||
import "core:c"
|
import "core:c"
|
||||||
import "core:intrinsics"
|
import "core:intrinsics"
|
||||||
|
|
||||||
when ODIN_OS == "windows" { foreign import lib "SDL2.lib" }
|
when ODIN_OS == .Windows { foreign import lib "SDL2.lib" }
|
||||||
when ODIN_OS == "linux" { foreign import lib "system:SDL2" }
|
when ODIN_OS == .Linux { foreign import lib "system:SDL2" }
|
||||||
when ODIN_OS == "darwin" { foreign import lib "system:SDL2" }
|
when ODIN_OS == .Darwin { foreign import lib "system:SDL2" }
|
||||||
when ODIN_OS == "freebsd" { foreign import lib "system:SDL2" }
|
when ODIN_OS == .FreeBSD { foreign import lib "system:SDL2" }
|
||||||
|
|
||||||
version :: struct {
|
version :: struct {
|
||||||
major: u8, /**< major version */
|
major: u8, /**< major version */
|
||||||
|
|||||||
Vendored
+4
-4
@@ -2,10 +2,10 @@ package sdl2
|
|||||||
|
|
||||||
import "core:c"
|
import "core:c"
|
||||||
|
|
||||||
when ODIN_OS == "windows" { foreign import lib "SDL2.lib" }
|
when ODIN_OS == .Windows { foreign import lib "SDL2.lib" }
|
||||||
when ODIN_OS == "linux" { foreign import lib "system:SDL2" }
|
when ODIN_OS == .Linux { foreign import lib "system:SDL2" }
|
||||||
when ODIN_OS == "darwin" { foreign import lib "system:SDL2" }
|
when ODIN_OS == .Darwin { foreign import lib "system:SDL2" }
|
||||||
when ODIN_OS == "freebsd" { foreign import lib "system:SDL2" }
|
when ODIN_OS == .FreeBSD { foreign import lib "system:SDL2" }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Audio format flags.
|
* \brief Audio format flags.
|
||||||
|
|||||||
Vendored
+4
-4
@@ -2,10 +2,10 @@ package sdl2
|
|||||||
|
|
||||||
import "core:c"
|
import "core:c"
|
||||||
|
|
||||||
when ODIN_OS == "windows" { foreign import lib "SDL2.lib" }
|
when ODIN_OS == .Windows { foreign import lib "SDL2.lib" }
|
||||||
when ODIN_OS == "linux" { foreign import lib "system:SDL2" }
|
when ODIN_OS == .Linux { foreign import lib "system:SDL2" }
|
||||||
when ODIN_OS == "darwin" { foreign import lib "system:SDL2" }
|
when ODIN_OS == .Darwin { foreign import lib "system:SDL2" }
|
||||||
when ODIN_OS == "freebsd" { foreign import lib "system:SDL2" }
|
when ODIN_OS == .FreeBSD { foreign import lib "system:SDL2" }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief The blend mode used in SDL_RenderCopy() and drawing operations.
|
* \brief The blend mode used in SDL_RenderCopy() and drawing operations.
|
||||||
|
|||||||
Vendored
+4
-4
@@ -2,10 +2,10 @@ package sdl2
|
|||||||
|
|
||||||
import "core:c"
|
import "core:c"
|
||||||
|
|
||||||
when ODIN_OS == "windows" { foreign import lib "SDL2.lib" }
|
when ODIN_OS == .Windows { foreign import lib "SDL2.lib" }
|
||||||
when ODIN_OS == "linux" { foreign import lib "system:SDL2" }
|
when ODIN_OS == .Linux { foreign import lib "system:SDL2" }
|
||||||
when ODIN_OS == "darwin" { foreign import lib "system:SDL2" }
|
when ODIN_OS == .Darwin { foreign import lib "system:SDL2" }
|
||||||
when ODIN_OS == "freebsd" { foreign import lib "system:SDL2" }
|
when ODIN_OS == .FreeBSD { foreign import lib "system:SDL2" }
|
||||||
|
|
||||||
/* This is a guess for the cacheline size used for padding.
|
/* This is a guess for the cacheline size used for padding.
|
||||||
* Most x86 processors have a 64 byte cache line.
|
* Most x86 processors have a 64 byte cache line.
|
||||||
|
|||||||
Vendored
+4
-4
@@ -2,10 +2,10 @@ package sdl2
|
|||||||
|
|
||||||
import "core:c"
|
import "core:c"
|
||||||
|
|
||||||
when ODIN_OS == "windows" { foreign import lib "SDL2.lib" }
|
when ODIN_OS == .Windows { foreign import lib "SDL2.lib" }
|
||||||
when ODIN_OS == "linux" { foreign import lib "system:SDL2" }
|
when ODIN_OS == .Linux { foreign import lib "system:SDL2" }
|
||||||
when ODIN_OS == "darwin" { foreign import lib "system:SDL2" }
|
when ODIN_OS == .Darwin { foreign import lib "system:SDL2" }
|
||||||
when ODIN_OS == "freebsd" { foreign import lib "system:SDL2" }
|
when ODIN_OS == .FreeBSD { foreign import lib "system:SDL2" }
|
||||||
|
|
||||||
RELEASED :: 0
|
RELEASED :: 0
|
||||||
PRESSED :: 1
|
PRESSED :: 1
|
||||||
|
|||||||
Vendored
+4
-4
@@ -2,10 +2,10 @@ package sdl2
|
|||||||
|
|
||||||
import "core:c"
|
import "core:c"
|
||||||
|
|
||||||
when ODIN_OS == "windows" { foreign import lib "SDL2.lib" }
|
when ODIN_OS == .Windows { foreign import lib "SDL2.lib" }
|
||||||
when ODIN_OS == "linux" { foreign import lib "system:SDL2" }
|
when ODIN_OS == .Linux { foreign import lib "system:SDL2" }
|
||||||
when ODIN_OS == "darwin" { foreign import lib "system:SDL2" }
|
when ODIN_OS == .Darwin { foreign import lib "system:SDL2" }
|
||||||
when ODIN_OS == "freebsd" { foreign import lib "system:SDL2" }
|
when ODIN_OS == .FreeBSD { foreign import lib "system:SDL2" }
|
||||||
|
|
||||||
GameController :: struct {}
|
GameController :: struct {}
|
||||||
|
|
||||||
|
|||||||
Vendored
+4
-4
@@ -2,10 +2,10 @@ package sdl2
|
|||||||
|
|
||||||
import "core:c"
|
import "core:c"
|
||||||
|
|
||||||
when ODIN_OS == "windows" { foreign import lib "SDL2.lib" }
|
when ODIN_OS == .Windows { foreign import lib "SDL2.lib" }
|
||||||
when ODIN_OS == "linux" { foreign import lib "system:SDL2" }
|
when ODIN_OS == .Linux { foreign import lib "system:SDL2" }
|
||||||
when ODIN_OS == "darwin" { foreign import lib "system:SDL2" }
|
when ODIN_OS == .Darwin { foreign import lib "system:SDL2" }
|
||||||
when ODIN_OS == "freebsd" { foreign import lib "system:SDL2" }
|
when ODIN_OS == .FreeBSD { foreign import lib "system:SDL2" }
|
||||||
|
|
||||||
// Gesture
|
// Gesture
|
||||||
|
|
||||||
|
|||||||
Vendored
+4
-4
@@ -2,10 +2,10 @@ package sdl2
|
|||||||
|
|
||||||
import "core:c"
|
import "core:c"
|
||||||
|
|
||||||
when ODIN_OS == "windows" { foreign import lib "SDL2.lib" }
|
when ODIN_OS == .Windows { foreign import lib "SDL2.lib" }
|
||||||
when ODIN_OS == "linux" { foreign import lib "system:SDL2" }
|
when ODIN_OS == .Linux { foreign import lib "system:SDL2" }
|
||||||
when ODIN_OS == "darwin" { foreign import lib "system:SDL2" }
|
when ODIN_OS == .Darwin { foreign import lib "system:SDL2" }
|
||||||
when ODIN_OS == "freebsd" { foreign import lib "system:SDL2" }
|
when ODIN_OS == .FreeBSD { foreign import lib "system:SDL2" }
|
||||||
|
|
||||||
HINT_ACCELEROMETER_AS_JOYSTICK :: "SDL_ACCELEROMETER_AS_JOYSTICK"
|
HINT_ACCELEROMETER_AS_JOYSTICK :: "SDL_ACCELEROMETER_AS_JOYSTICK"
|
||||||
HINT_ALLOW_ALT_TAB_WHILE_GRABBED :: "SDL_ALLOW_ALT_TAB_WHILE_GRABBED"
|
HINT_ALLOW_ALT_TAB_WHILE_GRABBED :: "SDL_ALLOW_ALT_TAB_WHILE_GRABBED"
|
||||||
|
|||||||
Vendored
+4
-4
@@ -2,10 +2,10 @@ package sdl2
|
|||||||
|
|
||||||
import "core:c"
|
import "core:c"
|
||||||
|
|
||||||
when ODIN_OS == "windows" { foreign import lib "SDL2.lib" }
|
when ODIN_OS == .Windows { foreign import lib "SDL2.lib" }
|
||||||
when ODIN_OS == "linux" { foreign import lib "system:SDL2" }
|
when ODIN_OS == .Linux { foreign import lib "system:SDL2" }
|
||||||
when ODIN_OS == "darwin" { foreign import lib "system:SDL2" }
|
when ODIN_OS == .Darwin { foreign import lib "system:SDL2" }
|
||||||
when ODIN_OS == "freebsd" { foreign import lib "system:SDL2" }
|
when ODIN_OS == .FreeBSD { foreign import lib "system:SDL2" }
|
||||||
|
|
||||||
Joystick :: struct {}
|
Joystick :: struct {}
|
||||||
|
|
||||||
|
|||||||
Vendored
+4
-4
@@ -2,10 +2,10 @@ package sdl2
|
|||||||
|
|
||||||
import "core:c"
|
import "core:c"
|
||||||
|
|
||||||
when ODIN_OS == "windows" { foreign import lib "SDL2.lib" }
|
when ODIN_OS == .Windows { foreign import lib "SDL2.lib" }
|
||||||
when ODIN_OS == "linux" { foreign import lib "system:SDL2" }
|
when ODIN_OS == .Linux { foreign import lib "system:SDL2" }
|
||||||
when ODIN_OS == "darwin" { foreign import lib "system:SDL2" }
|
when ODIN_OS == .Darwin { foreign import lib "system:SDL2" }
|
||||||
when ODIN_OS == "freebsd" { foreign import lib "system:SDL2" }
|
when ODIN_OS == .FreeBSD { foreign import lib "system:SDL2" }
|
||||||
|
|
||||||
Keysym :: struct {
|
Keysym :: struct {
|
||||||
scancode: Scancode, /**< SDL physical key code - see ::SDL_Scancode for details */
|
scancode: Scancode, /**< SDL physical key code - see ::SDL_Scancode for details */
|
||||||
|
|||||||
Vendored
+4
-4
@@ -2,10 +2,10 @@ package sdl2
|
|||||||
|
|
||||||
import "core:c"
|
import "core:c"
|
||||||
|
|
||||||
when ODIN_OS == "windows" { foreign import lib "SDL2.lib" }
|
when ODIN_OS == .Windows { foreign import lib "SDL2.lib" }
|
||||||
when ODIN_OS == "linux" { foreign import lib "system:SDL2" }
|
when ODIN_OS == .Linux { foreign import lib "system:SDL2" }
|
||||||
when ODIN_OS == "darwin" { foreign import lib "system:SDL2" }
|
when ODIN_OS == .Darwin { foreign import lib "system:SDL2" }
|
||||||
when ODIN_OS == "freebsd" { foreign import lib "system:SDL2" }
|
when ODIN_OS == .FreeBSD { foreign import lib "system:SDL2" }
|
||||||
|
|
||||||
MAX_LOG_MESSAGE :: 4096
|
MAX_LOG_MESSAGE :: 4096
|
||||||
|
|
||||||
|
|||||||
Vendored
+4
-4
@@ -2,10 +2,10 @@ package sdl2
|
|||||||
|
|
||||||
import "core:c"
|
import "core:c"
|
||||||
|
|
||||||
when ODIN_OS == "windows" { foreign import lib "SDL2.lib" }
|
when ODIN_OS == .Windows { foreign import lib "SDL2.lib" }
|
||||||
when ODIN_OS == "linux" { foreign import lib "system:SDL2" }
|
when ODIN_OS == .Linux { foreign import lib "system:SDL2" }
|
||||||
when ODIN_OS == "darwin" { foreign import lib "system:SDL2" }
|
when ODIN_OS == .Darwin { foreign import lib "system:SDL2" }
|
||||||
when ODIN_OS == "freebsd" { foreign import lib "system:SDL2" }
|
when ODIN_OS == .FreeBSD { foreign import lib "system:SDL2" }
|
||||||
|
|
||||||
MessageBoxFlag :: enum u32 {
|
MessageBoxFlag :: enum u32 {
|
||||||
_ = 0,
|
_ = 0,
|
||||||
|
|||||||
Vendored
+4
-4
@@ -2,10 +2,10 @@ package sdl2
|
|||||||
|
|
||||||
import "core:c"
|
import "core:c"
|
||||||
|
|
||||||
when ODIN_OS == "windows" { foreign import lib "SDL2.lib" }
|
when ODIN_OS == .Windows { foreign import lib "SDL2.lib" }
|
||||||
when ODIN_OS == "linux" { foreign import lib "system:SDL2" }
|
when ODIN_OS == .Linux { foreign import lib "system:SDL2" }
|
||||||
when ODIN_OS == "darwin" { foreign import lib "system:SDL2" }
|
when ODIN_OS == .Darwin { foreign import lib "system:SDL2" }
|
||||||
when ODIN_OS == "freebsd" { foreign import lib "system:SDL2" }
|
when ODIN_OS == .FreeBSD { foreign import lib "system:SDL2" }
|
||||||
|
|
||||||
MetalView :: distinct rawptr
|
MetalView :: distinct rawptr
|
||||||
|
|
||||||
|
|||||||
Vendored
+4
-4
@@ -2,10 +2,10 @@ package sdl2
|
|||||||
|
|
||||||
import "core:c"
|
import "core:c"
|
||||||
|
|
||||||
when ODIN_OS == "windows" { foreign import lib "SDL2.lib" }
|
when ODIN_OS == .Windows { foreign import lib "SDL2.lib" }
|
||||||
when ODIN_OS == "linux" { foreign import lib "system:SDL2" }
|
when ODIN_OS == .Linux { foreign import lib "system:SDL2" }
|
||||||
when ODIN_OS == "darwin" { foreign import lib "system:SDL2" }
|
when ODIN_OS == .Darwin { foreign import lib "system:SDL2" }
|
||||||
when ODIN_OS == "freebsd" { foreign import lib "system:SDL2" }
|
when ODIN_OS == .FreeBSD { foreign import lib "system:SDL2" }
|
||||||
|
|
||||||
Cursor :: struct {}
|
Cursor :: struct {}
|
||||||
|
|
||||||
|
|||||||
Vendored
+4
-4
@@ -2,10 +2,10 @@ package sdl2
|
|||||||
|
|
||||||
import "core:c"
|
import "core:c"
|
||||||
|
|
||||||
when ODIN_OS == "windows" { foreign import lib "SDL2.lib" }
|
when ODIN_OS == .Windows { foreign import lib "SDL2.lib" }
|
||||||
when ODIN_OS == "linux" { foreign import lib "system:SDL2" }
|
when ODIN_OS == .Linux { foreign import lib "system:SDL2" }
|
||||||
when ODIN_OS == "darwin" { foreign import lib "system:SDL2" }
|
when ODIN_OS == .Darwin { foreign import lib "system:SDL2" }
|
||||||
when ODIN_OS == "freebsd" { foreign import lib "system:SDL2" }
|
when ODIN_OS == .FreeBSD { foreign import lib "system:SDL2" }
|
||||||
|
|
||||||
MUTEX_TIMEDOUT :: 1
|
MUTEX_TIMEDOUT :: 1
|
||||||
MUTEX_MAXWAIT :: ~u32(0)
|
MUTEX_MAXWAIT :: ~u32(0)
|
||||||
|
|||||||
Vendored
+4
-4
@@ -2,10 +2,10 @@ package sdl2
|
|||||||
|
|
||||||
import "core:c"
|
import "core:c"
|
||||||
|
|
||||||
when ODIN_OS == "windows" { foreign import lib "SDL2.lib" }
|
when ODIN_OS == .Windows { foreign import lib "SDL2.lib" }
|
||||||
when ODIN_OS == "linux" { foreign import lib "system:SDL2" }
|
when ODIN_OS == .Linux { foreign import lib "system:SDL2" }
|
||||||
when ODIN_OS == "darwin" { foreign import lib "system:SDL2" }
|
when ODIN_OS == .Darwin { foreign import lib "system:SDL2" }
|
||||||
when ODIN_OS == "freebsd" { foreign import lib "system:SDL2" }
|
when ODIN_OS == .FreeBSD { foreign import lib "system:SDL2" }
|
||||||
|
|
||||||
ALPHA_OPAQUE :: 255
|
ALPHA_OPAQUE :: 255
|
||||||
ALPHA_TRANSPARENT :: 0
|
ALPHA_TRANSPARENT :: 0
|
||||||
|
|||||||
Vendored
+4
-4
@@ -2,10 +2,10 @@ package sdl2
|
|||||||
|
|
||||||
import "core:c"
|
import "core:c"
|
||||||
|
|
||||||
when ODIN_OS == "windows" { foreign import lib "SDL2.lib" }
|
when ODIN_OS == .Windows { foreign import lib "SDL2.lib" }
|
||||||
when ODIN_OS == "linux" { foreign import lib "system:SDL2" }
|
when ODIN_OS == .Linux { foreign import lib "system:SDL2" }
|
||||||
when ODIN_OS == "darwin" { foreign import lib "system:SDL2" }
|
when ODIN_OS == .Darwin { foreign import lib "system:SDL2" }
|
||||||
when ODIN_OS == "freebsd" { foreign import lib "system:SDL2" }
|
when ODIN_OS == .FreeBSD { foreign import lib "system:SDL2" }
|
||||||
|
|
||||||
Point :: struct {
|
Point :: struct {
|
||||||
x: c.int,
|
x: c.int,
|
||||||
|
|||||||
Vendored
+4
-4
@@ -2,10 +2,10 @@ package sdl2
|
|||||||
|
|
||||||
import "core:c"
|
import "core:c"
|
||||||
|
|
||||||
when ODIN_OS == "windows" { foreign import lib "SDL2.lib" }
|
when ODIN_OS == .Windows { foreign import lib "SDL2.lib" }
|
||||||
when ODIN_OS == "linux" { foreign import lib "system:SDL2" }
|
when ODIN_OS == .Linux { foreign import lib "system:SDL2" }
|
||||||
when ODIN_OS == "darwin" { foreign import lib "system:SDL2" }
|
when ODIN_OS == .Darwin { foreign import lib "system:SDL2" }
|
||||||
when ODIN_OS == "freebsd" { foreign import lib "system:SDL2" }
|
when ODIN_OS == .FreeBSD { foreign import lib "system:SDL2" }
|
||||||
|
|
||||||
RendererFlag :: enum u32 {
|
RendererFlag :: enum u32 {
|
||||||
SOFTWARE = 0, /**< The renderer is a software fallback */
|
SOFTWARE = 0, /**< The renderer is a software fallback */
|
||||||
|
|||||||
Vendored
+4
-4
@@ -2,10 +2,10 @@ package sdl2
|
|||||||
|
|
||||||
import "core:c"
|
import "core:c"
|
||||||
|
|
||||||
when ODIN_OS == "windows" { foreign import lib "SDL2.lib" }
|
when ODIN_OS == .Windows { foreign import lib "SDL2.lib" }
|
||||||
when ODIN_OS == "linux" { foreign import lib "system:SDL2" }
|
when ODIN_OS == .Linux { foreign import lib "system:SDL2" }
|
||||||
when ODIN_OS == "darwin" { foreign import lib "system:SDL2" }
|
when ODIN_OS == .Darwin { foreign import lib "system:SDL2" }
|
||||||
when ODIN_OS == "freebsd" { foreign import lib "system:SDL2" }
|
when ODIN_OS == .FreeBSD { foreign import lib "system:SDL2" }
|
||||||
|
|
||||||
/* RWops Types */
|
/* RWops Types */
|
||||||
RWOPS_UNKNOWN :: 0 /**< Unknown stream type */
|
RWOPS_UNKNOWN :: 0 /**< Unknown stream type */
|
||||||
|
|||||||
Vendored
+4
-4
@@ -5,10 +5,10 @@ import "core:intrinsics"
|
|||||||
import "core:runtime"
|
import "core:runtime"
|
||||||
_, _ :: intrinsics, runtime
|
_, _ :: intrinsics, runtime
|
||||||
|
|
||||||
when ODIN_OS == "windows" { foreign import lib "SDL2.lib" }
|
when ODIN_OS == .Windows { foreign import lib "SDL2.lib" }
|
||||||
when ODIN_OS == "linux" { foreign import lib "system:SDL2" }
|
when ODIN_OS == .Linux { foreign import lib "system:SDL2" }
|
||||||
when ODIN_OS == "darwin" { foreign import lib "system:SDL2" }
|
when ODIN_OS == .Darwin { foreign import lib "system:SDL2" }
|
||||||
when ODIN_OS == "freebsd" { foreign import lib "system:SDL2" }
|
when ODIN_OS == .FreeBSD { foreign import lib "system:SDL2" }
|
||||||
|
|
||||||
bool :: distinct b32
|
bool :: distinct b32
|
||||||
#assert(size_of(bool) == size_of(c.int))
|
#assert(size_of(bool) == size_of(c.int))
|
||||||
|
|||||||
Vendored
+4
-4
@@ -2,10 +2,10 @@ package sdl2
|
|||||||
|
|
||||||
import "core:c"
|
import "core:c"
|
||||||
|
|
||||||
when ODIN_OS == "windows" { foreign import lib "SDL2.lib" }
|
when ODIN_OS == .Windows { foreign import lib "SDL2.lib" }
|
||||||
when ODIN_OS == "linux" { foreign import lib "system:SDL2" }
|
when ODIN_OS == .Linux { foreign import lib "system:SDL2" }
|
||||||
when ODIN_OS == "darwin" { foreign import lib "system:SDL2" }
|
when ODIN_OS == .Darwin { foreign import lib "system:SDL2" }
|
||||||
when ODIN_OS == "freebsd" { foreign import lib "system:SDL2" }
|
when ODIN_OS == .FreeBSD { foreign import lib "system:SDL2" }
|
||||||
|
|
||||||
SWSURFACE :: 0 /**< Just here for compatibility */
|
SWSURFACE :: 0 /**< Just here for compatibility */
|
||||||
PREALLOC :: 0x00000001 /**< Surface uses preallocated memory */
|
PREALLOC :: 0x00000001 /**< Surface uses preallocated memory */
|
||||||
|
|||||||
Vendored
+4
-4
@@ -2,10 +2,10 @@ package sdl2
|
|||||||
|
|
||||||
import "core:c"
|
import "core:c"
|
||||||
|
|
||||||
when ODIN_OS == "windows" { foreign import lib "SDL2.lib" }
|
when ODIN_OS == .Windows { foreign import lib "SDL2.lib" }
|
||||||
when ODIN_OS == "linux" { foreign import lib "system:SDL2" }
|
when ODIN_OS == .Linux { foreign import lib "system:SDL2" }
|
||||||
when ODIN_OS == "darwin" { foreign import lib "system:SDL2" }
|
when ODIN_OS == .Darwin { foreign import lib "system:SDL2" }
|
||||||
when ODIN_OS == "freebsd" { foreign import lib "system:SDL2" }
|
when ODIN_OS == .FreeBSD { foreign import lib "system:SDL2" }
|
||||||
|
|
||||||
// General
|
// General
|
||||||
@(default_calling_convention="c", link_prefix="SDL_")
|
@(default_calling_convention="c", link_prefix="SDL_")
|
||||||
|
|||||||
Vendored
+4
-4
@@ -2,10 +2,10 @@ package sdl2
|
|||||||
|
|
||||||
import "core:c"
|
import "core:c"
|
||||||
|
|
||||||
when ODIN_OS == "windows" { foreign import lib "SDL2.lib" }
|
when ODIN_OS == .Windows { foreign import lib "SDL2.lib" }
|
||||||
when ODIN_OS == "linux" { foreign import lib "system:SDL2" }
|
when ODIN_OS == .Linux { foreign import lib "system:SDL2" }
|
||||||
when ODIN_OS == "darwin" { foreign import lib "system:SDL2" }
|
when ODIN_OS == .Darwin { foreign import lib "system:SDL2" }
|
||||||
when ODIN_OS == "freebsd" { foreign import lib "system:SDL2" }
|
when ODIN_OS == .FreeBSD { foreign import lib "system:SDL2" }
|
||||||
|
|
||||||
SYSWM_TYPE :: enum c.int {
|
SYSWM_TYPE :: enum c.int {
|
||||||
UNKNOWN,
|
UNKNOWN,
|
||||||
|
|||||||
Vendored
+4
-4
@@ -2,10 +2,10 @@ package sdl2
|
|||||||
|
|
||||||
import "core:c"
|
import "core:c"
|
||||||
|
|
||||||
when ODIN_OS == "windows" { foreign import lib "SDL2.lib" }
|
when ODIN_OS == .Windows { foreign import lib "SDL2.lib" }
|
||||||
when ODIN_OS == "linux" { foreign import lib "system:SDL2" }
|
when ODIN_OS == .Linux { foreign import lib "system:SDL2" }
|
||||||
when ODIN_OS == "darwin" { foreign import lib "system:SDL2" }
|
when ODIN_OS == .Darwin { foreign import lib "system:SDL2" }
|
||||||
when ODIN_OS == "freebsd" { foreign import lib "system:SDL2" }
|
when ODIN_OS == .FreeBSD { foreign import lib "system:SDL2" }
|
||||||
|
|
||||||
Thread :: struct {}
|
Thread :: struct {}
|
||||||
|
|
||||||
|
|||||||
Vendored
+4
-4
@@ -2,10 +2,10 @@ package sdl2
|
|||||||
|
|
||||||
import "core:c"
|
import "core:c"
|
||||||
|
|
||||||
when ODIN_OS == "windows" { foreign import lib "SDL2.lib" }
|
when ODIN_OS == .Windows { foreign import lib "SDL2.lib" }
|
||||||
when ODIN_OS == "linux" { foreign import lib "system:SDL2" }
|
when ODIN_OS == .Linux { foreign import lib "system:SDL2" }
|
||||||
when ODIN_OS == "darwin" { foreign import lib "system:SDL2" }
|
when ODIN_OS == .Darwin { foreign import lib "system:SDL2" }
|
||||||
when ODIN_OS == "freebsd" { foreign import lib "system:SDL2" }
|
when ODIN_OS == .FreeBSD { foreign import lib "system:SDL2" }
|
||||||
|
|
||||||
TimerCallback :: proc "c" (interval: u32, param: rawptr) -> u32
|
TimerCallback :: proc "c" (interval: u32, param: rawptr) -> u32
|
||||||
TimerID :: distinct c.int
|
TimerID :: distinct c.int
|
||||||
|
|||||||
Vendored
+4
-4
@@ -2,10 +2,10 @@ package sdl2
|
|||||||
|
|
||||||
import "core:c"
|
import "core:c"
|
||||||
|
|
||||||
when ODIN_OS == "windows" { foreign import lib "SDL2.lib" }
|
when ODIN_OS == .Windows { foreign import lib "SDL2.lib" }
|
||||||
when ODIN_OS == "linux" { foreign import lib "system:SDL2" }
|
when ODIN_OS == .Linux { foreign import lib "system:SDL2" }
|
||||||
when ODIN_OS == "darwin" { foreign import lib "system:SDL2" }
|
when ODIN_OS == .Darwin { foreign import lib "system:SDL2" }
|
||||||
when ODIN_OS == "freebsd" { foreign import lib "system:SDL2" }
|
when ODIN_OS == .FreeBSD { foreign import lib "system:SDL2" }
|
||||||
|
|
||||||
TouchID :: distinct i64
|
TouchID :: distinct i64
|
||||||
FingerID :: distinct i64
|
FingerID :: distinct i64
|
||||||
|
|||||||
Vendored
+4
-4
@@ -2,10 +2,10 @@ package sdl2
|
|||||||
|
|
||||||
import "core:c"
|
import "core:c"
|
||||||
|
|
||||||
when ODIN_OS == "windows" { foreign import lib "SDL2.lib" }
|
when ODIN_OS == .Windows { foreign import lib "SDL2.lib" }
|
||||||
when ODIN_OS == "linux" { foreign import lib "system:SDL2" }
|
when ODIN_OS == .Linux { foreign import lib "system:SDL2" }
|
||||||
when ODIN_OS == "darwin" { foreign import lib "system:SDL2" }
|
when ODIN_OS == .Darwin { foreign import lib "system:SDL2" }
|
||||||
when ODIN_OS == "freebsd" { foreign import lib "system:SDL2" }
|
when ODIN_OS == .FreeBSD { foreign import lib "system:SDL2" }
|
||||||
|
|
||||||
DisplayMode :: struct {
|
DisplayMode :: struct {
|
||||||
format: u32, /**< pixel format */
|
format: u32, /**< pixel format */
|
||||||
|
|||||||
Vendored
+4
-4
@@ -3,10 +3,10 @@ package sdl2
|
|||||||
import "core:c"
|
import "core:c"
|
||||||
import vk "vendor:vulkan"
|
import vk "vendor:vulkan"
|
||||||
|
|
||||||
when ODIN_OS == "windows" { foreign import lib "SDL2.lib" }
|
when ODIN_OS == .Windows { foreign import lib "SDL2.lib" }
|
||||||
when ODIN_OS == "linux" { foreign import lib "system:SDL2" }
|
when ODIN_OS == .Linux { foreign import lib "system:SDL2" }
|
||||||
when ODIN_OS == "darwin" { foreign import lib "system:SDL2" }
|
when ODIN_OS == .Darwin { foreign import lib "system:SDL2" }
|
||||||
when ODIN_OS == "freebsd" { foreign import lib "system:SDL2" }
|
when ODIN_OS == .FreeBSD { foreign import lib "system:SDL2" }
|
||||||
|
|
||||||
VkInstance :: vk.Instance
|
VkInstance :: vk.Instance
|
||||||
VkSurfaceKHR :: vk.SurfaceKHR
|
VkSurfaceKHR :: vk.SurfaceKHR
|
||||||
|
|||||||
Vendored
+4
-4
@@ -3,10 +3,10 @@ package sdl2_ttf
|
|||||||
import "core:c"
|
import "core:c"
|
||||||
import SDL ".."
|
import SDL ".."
|
||||||
|
|
||||||
when ODIN_OS == "windows" { foreign import lib "SDL2_ttf.lib" }
|
when ODIN_OS == .Windows { foreign import lib "SDL2_ttf.lib" }
|
||||||
when ODIN_OS == "linux" { foreign import lib "system:SDL2_ttf" }
|
when ODIN_OS == .Linux { foreign import lib "system:SDL2_ttf" }
|
||||||
when ODIN_OS == "darwin" { foreign import lib "system:SDL2_ttf" }
|
when ODIN_OS == .Darwin { foreign import lib "system:SDL2_ttf" }
|
||||||
when ODIN_OS == "freebsd" { foreign import lib "system:SDL2_ttf" }
|
when ODIN_OS == .FreeBSD { foreign import lib "system:SDL2_ttf" }
|
||||||
|
|
||||||
bool :: SDL.bool
|
bool :: SDL.bool
|
||||||
|
|
||||||
|
|||||||
Vendored
+2
-2
@@ -4,8 +4,8 @@ import c "core:c/libc"
|
|||||||
|
|
||||||
#assert(size_of(c.int) == size_of(b32))
|
#assert(size_of(c.int) == size_of(b32))
|
||||||
|
|
||||||
when ODIN_OS == "windows" { foreign import stbi "../lib/stb_image.lib" }
|
when ODIN_OS == .Windows { foreign import stbi "../lib/stb_image.lib" }
|
||||||
when ODIN_OS == "linux" { foreign import stbi "../lib/stb_image.a" }
|
when ODIN_OS == .Linux { foreign import stbi "../lib/stb_image.a" }
|
||||||
|
|
||||||
#assert(size_of(b32) == size_of(c.int))
|
#assert(size_of(b32) == size_of(c.int))
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -2,8 +2,8 @@ package stb_image
|
|||||||
|
|
||||||
import c "core:c/libc"
|
import c "core:c/libc"
|
||||||
|
|
||||||
when ODIN_OS == "windows" { foreign import lib "../lib/stb_image_resize.lib" }
|
when ODIN_OS == .Windows { foreign import lib "../lib/stb_image_resize.lib" }
|
||||||
when ODIN_OS == "linux" { foreign import lib "../lib/stb_image_resize.a" }
|
when ODIN_OS == .Linux { foreign import lib "../lib/stb_image_resize.a" }
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
|
|||||||
+2
-2
@@ -2,8 +2,8 @@ package stb_image
|
|||||||
|
|
||||||
import c "core:c/libc"
|
import c "core:c/libc"
|
||||||
|
|
||||||
when ODIN_OS == "windows" { foreign import stbiw "../lib/stb_image_write.lib" }
|
when ODIN_OS == .Windows { foreign import stbiw "../lib/stb_image_write.lib" }
|
||||||
when ODIN_OS == "linux" { foreign import stbiw "../lib/stb_image_write.a" }
|
when ODIN_OS == .Linux { foreign import stbiw "../lib/stb_image_write.a" }
|
||||||
|
|
||||||
|
|
||||||
write_func :: proc "c" (ctx: rawptr, data: rawptr, size: c.int)
|
write_func :: proc "c" (ctx: rawptr, data: rawptr, size: c.int)
|
||||||
|
|||||||
+2
-2
@@ -4,8 +4,8 @@ import c "core:c/libc"
|
|||||||
|
|
||||||
#assert(size_of(b32) == size_of(c.int))
|
#assert(size_of(b32) == size_of(c.int))
|
||||||
|
|
||||||
when ODIN_OS == "windows" { foreign import lib "../lib/stb_rect_pack.lib" }
|
when ODIN_OS == .Windows { foreign import lib "../lib/stb_rect_pack.lib" }
|
||||||
when ODIN_OS == "linux" { foreign import lib "../lib/stb_rect_pack.a" }
|
when ODIN_OS == .Linux { foreign import lib "../lib/stb_rect_pack.a" }
|
||||||
|
|
||||||
Coord :: distinct c.int
|
Coord :: distinct c.int
|
||||||
_MAXVAL :: max(Coord)
|
_MAXVAL :: max(Coord)
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user