mirror of
https://github.com/odin-lang/Odin.git
synced 2026-02-16 16:14:06 +00:00
Merge pull request #1438 from odin-lang/odin-global-constants-as-enums
Odin global constants as enums
This commit is contained in:
@@ -7,20 +7,20 @@ char :: builtin.u8 // assuming -funsigned-char
|
||||
schar :: builtin.i8
|
||||
short :: builtin.i16
|
||||
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
|
||||
|
||||
uchar :: builtin.u8
|
||||
ushort :: builtin.u16
|
||||
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
|
||||
|
||||
bool :: builtin.bool
|
||||
|
||||
size_t :: builtin.uint
|
||||
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
|
||||
double :: builtin.f64
|
||||
@@ -48,7 +48,7 @@ int_least64_t :: builtin.i64
|
||||
uint_least64_t :: builtin.u64
|
||||
|
||||
// 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
|
||||
uint_fast8_t :: builtin.u8
|
||||
int_fast16_t :: builtin.i32
|
||||
|
||||
@@ -2,9 +2,9 @@ package libc
|
||||
|
||||
// 7.3 Complex arithmetic
|
||||
|
||||
when ODIN_OS == "windows" {
|
||||
when ODIN_OS == .Windows {
|
||||
foreign import libc "system:libucrt.lib"
|
||||
} else when ODIN_OS == "darwin" {
|
||||
} else when ODIN_OS == .Darwin {
|
||||
foreign import libc "system:System.framework"
|
||||
} else {
|
||||
foreign import libc "system:c"
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package libc
|
||||
|
||||
when ODIN_OS == "windows" {
|
||||
when ODIN_OS == .Windows {
|
||||
foreign import libc "system:libucrt.lib"
|
||||
} else when ODIN_OS == "darwin" {
|
||||
} else when ODIN_OS == .Darwin {
|
||||
foreign import libc "system:System.framework"
|
||||
} else {
|
||||
foreign import libc "system:c"
|
||||
|
||||
@@ -2,9 +2,9 @@ package libc
|
||||
|
||||
// 7.5 Errors
|
||||
|
||||
when ODIN_OS == "windows" {
|
||||
when ODIN_OS == .Windows {
|
||||
foreign import libc "system:libucrt.lib"
|
||||
} else when ODIN_OS == "darwin" {
|
||||
} else when ODIN_OS == .Darwin {
|
||||
foreign import libc "system:System.framework"
|
||||
} else {
|
||||
foreign import libc "system:c"
|
||||
@@ -14,7 +14,7 @@ when ODIN_OS == "windows" {
|
||||
// EDOM,
|
||||
// EILSEQ
|
||||
// ERANGE
|
||||
when ODIN_OS == "linux" || ODIN_OS == "freebsd" {
|
||||
when ODIN_OS == .Linux || ODIN_OS == .FreeBSD {
|
||||
@(private="file")
|
||||
@(default_calling_convention="c")
|
||||
foreign libc {
|
||||
@@ -27,7 +27,7 @@ when ODIN_OS == "linux" || ODIN_OS == "freebsd" {
|
||||
ERANGE :: 34
|
||||
}
|
||||
|
||||
when ODIN_OS == "windows" {
|
||||
when ODIN_OS == .Windows {
|
||||
@(private="file")
|
||||
@(default_calling_convention="c")
|
||||
foreign libc {
|
||||
@@ -40,7 +40,7 @@ when ODIN_OS == "windows" {
|
||||
ERANGE :: 34
|
||||
}
|
||||
|
||||
when ODIN_OS == "darwin" {
|
||||
when ODIN_OS == .Darwin {
|
||||
@(private="file")
|
||||
@(default_calling_convention="c")
|
||||
foreign libc {
|
||||
|
||||
@@ -4,9 +4,9 @@ package libc
|
||||
|
||||
import "core:intrinsics"
|
||||
|
||||
when ODIN_OS == "windows" {
|
||||
when ODIN_OS == .Windows {
|
||||
foreign import libc "system:libucrt.lib"
|
||||
} else when ODIN_OS == "darwin" {
|
||||
} else when ODIN_OS == .Darwin {
|
||||
foreign import libc "system:System.framework"
|
||||
} else {
|
||||
foreign import libc "system:c"
|
||||
|
||||
@@ -2,14 +2,14 @@ package libc
|
||||
|
||||
// 7.13 Nonlocal jumps
|
||||
|
||||
when ODIN_OS == "windows" {
|
||||
when ODIN_OS == .Windows {
|
||||
foreign import libc "system:libucrt.lib"
|
||||
} else when ODIN_OS == "darwin" {
|
||||
} else when ODIN_OS == .Darwin {
|
||||
foreign import libc "system:System.framework"
|
||||
} else {
|
||||
foreign import libc "system:c"
|
||||
}
|
||||
when ODIN_OS == "windows" {
|
||||
when ODIN_OS == .Windows {
|
||||
@(default_calling_convention="c")
|
||||
foreign libc {
|
||||
// 7.13.1 Save calling environment
|
||||
|
||||
@@ -2,9 +2,9 @@ package libc
|
||||
|
||||
// 7.14 Signal handling
|
||||
|
||||
when ODIN_OS == "windows" {
|
||||
when ODIN_OS == .Windows {
|
||||
foreign import libc "system:libucrt.lib"
|
||||
} else when ODIN_OS == "darwin" {
|
||||
} else when ODIN_OS == .Darwin {
|
||||
foreign import libc "system:System.framework"
|
||||
} else {
|
||||
foreign import libc "system:c"
|
||||
@@ -21,7 +21,7 @@ foreign libc {
|
||||
raise :: proc(sig: int) -> int ---
|
||||
}
|
||||
|
||||
when ODIN_OS == "windows" {
|
||||
when ODIN_OS == .Windows {
|
||||
SIG_ERR :: rawptr(~uintptr(0))
|
||||
SIG_DFL :: rawptr(uintptr(0))
|
||||
SIG_IGN :: rawptr(uintptr(1))
|
||||
@@ -34,7 +34,7 @@ when ODIN_OS == "windows" {
|
||||
SIGTERM :: 15
|
||||
}
|
||||
|
||||
when ODIN_OS == "linux" || ODIN_OS == "freebsd" {
|
||||
when ODIN_OS == .Linux || ODIN_OS == .FreeBSD {
|
||||
SIG_ERR :: rawptr(~uintptr(0))
|
||||
SIG_DFL :: rawptr(uintptr(0))
|
||||
SIG_IGN :: rawptr(uintptr(1))
|
||||
@@ -47,7 +47,7 @@ when ODIN_OS == "linux" || ODIN_OS == "freebsd" {
|
||||
SIGTERM :: 15
|
||||
}
|
||||
|
||||
when ODIN_OS == "darwin" {
|
||||
when ODIN_OS == .Darwin {
|
||||
SIG_ERR :: rawptr(~uintptr(0))
|
||||
SIG_DFL :: rawptr(uintptr(0))
|
||||
SIG_IGN :: rawptr(uintptr(1))
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package libc
|
||||
|
||||
when ODIN_OS == "windows" {
|
||||
when ODIN_OS == .Windows {
|
||||
foreign import libc "system:libucrt.lib"
|
||||
} else when ODIN_OS == "darwin" {
|
||||
} else when ODIN_OS == .Darwin {
|
||||
foreign import libc "system:System.framework"
|
||||
} else {
|
||||
foreign import libc "system:c"
|
||||
@@ -13,7 +13,7 @@ when ODIN_OS == "windows" {
|
||||
FILE :: struct {}
|
||||
|
||||
// MSVCRT compatible.
|
||||
when ODIN_OS == "windows" {
|
||||
when ODIN_OS == .Windows {
|
||||
_IOFBF :: 0x0000
|
||||
_IONBF :: 0x0004
|
||||
_IOLBF :: 0x0040
|
||||
@@ -48,7 +48,7 @@ when ODIN_OS == "windows" {
|
||||
}
|
||||
|
||||
// GLIBC and MUSL compatible.
|
||||
when ODIN_OS == "linux" {
|
||||
when ODIN_OS == .Linux {
|
||||
fpos_t :: struct #raw_union { _: [16]char, _: longlong, _: double, }
|
||||
|
||||
_IOFBF :: 0
|
||||
@@ -78,7 +78,7 @@ when ODIN_OS == "linux" {
|
||||
}
|
||||
}
|
||||
|
||||
when ODIN_OS == "darwin" {
|
||||
when ODIN_OS == .Darwin {
|
||||
fpos_t :: distinct i64
|
||||
|
||||
_IOFBF :: 0
|
||||
|
||||
@@ -2,15 +2,15 @@ package libc
|
||||
|
||||
// 7.22 General utilities
|
||||
|
||||
when ODIN_OS == "windows" {
|
||||
when ODIN_OS == .Windows {
|
||||
foreign import libc "system:libucrt.lib"
|
||||
} else when ODIN_OS == "darwin" {
|
||||
} else when ODIN_OS == .Darwin {
|
||||
foreign import libc "system:System.framework"
|
||||
} else {
|
||||
foreign import libc "system:c"
|
||||
}
|
||||
|
||||
when ODIN_OS == "windows" {
|
||||
when ODIN_OS == .Windows {
|
||||
RAND_MAX :: 0x7fff
|
||||
|
||||
@(private="file")
|
||||
@@ -24,7 +24,7 @@ when ODIN_OS == "windows" {
|
||||
}
|
||||
}
|
||||
|
||||
when ODIN_OS == "linux" {
|
||||
when ODIN_OS == .Linux {
|
||||
RAND_MAX :: 0x7fffffff
|
||||
|
||||
// GLIBC and MUSL only
|
||||
@@ -40,7 +40,7 @@ when ODIN_OS == "linux" {
|
||||
}
|
||||
|
||||
|
||||
when ODIN_OS == "darwin" {
|
||||
when ODIN_OS == .Darwin {
|
||||
RAND_MAX :: 0x7fffffff
|
||||
|
||||
// GLIBC and MUSL only
|
||||
|
||||
@@ -4,9 +4,9 @@ import "core:runtime"
|
||||
|
||||
// 7.24 String handling
|
||||
|
||||
when ODIN_OS == "windows" {
|
||||
when ODIN_OS == .Windows {
|
||||
foreign import libc "system:libucrt.lib"
|
||||
} else when ODIN_OS == "darwin" {
|
||||
} else when ODIN_OS == .Darwin {
|
||||
foreign import libc "system:System.framework"
|
||||
} else {
|
||||
foreign import libc "system:c"
|
||||
|
||||
@@ -5,7 +5,7 @@ package libc
|
||||
thrd_start_t :: proc "c" (rawptr) -> int
|
||||
tss_dtor_t :: proc "c" (rawptr)
|
||||
|
||||
when ODIN_OS == "windows" {
|
||||
when ODIN_OS == .Windows {
|
||||
foreign import libc {
|
||||
"system:libucrt.lib",
|
||||
"system:msvcprt.lib"
|
||||
@@ -74,7 +74,7 @@ when ODIN_OS == "windows" {
|
||||
}
|
||||
|
||||
// GLIBC and MUSL compatible constants and types.
|
||||
when ODIN_OS == "linux" {
|
||||
when ODIN_OS == .Linux {
|
||||
foreign import libc {
|
||||
"system:c",
|
||||
"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!
|
||||
}
|
||||
|
||||
@@ -2,9 +2,9 @@ package libc
|
||||
|
||||
// 7.27 Date and time
|
||||
|
||||
when ODIN_OS == "windows" {
|
||||
when ODIN_OS == .Windows {
|
||||
foreign import libc "system:libucrt.lib"
|
||||
} else when ODIN_OS == "darwin" {
|
||||
} else when ODIN_OS == .Darwin {
|
||||
foreign import libc "system:System.framework"
|
||||
} else {
|
||||
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 approach the 2038 problem. Windows has defaulted to this since VC8 (2005).
|
||||
when ODIN_OS == "windows" {
|
||||
when ODIN_OS == .Windows {
|
||||
foreign libc {
|
||||
// 7.27.2 Time manipulation functions
|
||||
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")
|
||||
foreign libc {
|
||||
// 7.27.2 Time manipulation functions
|
||||
|
||||
@@ -2,9 +2,9 @@ package libc
|
||||
|
||||
// 7.28 Unicode utilities
|
||||
|
||||
when ODIN_OS == "windows" {
|
||||
when ODIN_OS == .Windows {
|
||||
foreign import libc "system:libucrt.lib"
|
||||
} else when ODIN_OS == "darwin" {
|
||||
} else when ODIN_OS == .Darwin {
|
||||
foreign import libc "system:System.framework"
|
||||
} else {
|
||||
foreign import libc "system:c"
|
||||
|
||||
@@ -2,9 +2,9 @@ package libc
|
||||
|
||||
// 7.29 Extended multibyte and wide character utilities
|
||||
|
||||
when ODIN_OS == "windows" {
|
||||
when ODIN_OS == .Windows {
|
||||
foreign import libc "system:libucrt.lib"
|
||||
} else when ODIN_OS == "darwin" {
|
||||
} else when ODIN_OS == .Darwin {
|
||||
foreign import libc "system:System.framework"
|
||||
} else {
|
||||
foreign import libc "system:c"
|
||||
|
||||
@@ -2,25 +2,25 @@ package libc
|
||||
|
||||
// 7.30 Wide character classification and mapping utilities
|
||||
|
||||
when ODIN_OS == "windows" {
|
||||
when ODIN_OS == .Windows {
|
||||
foreign import libc "system:libucrt.lib"
|
||||
} else when ODIN_OS == "darwin" {
|
||||
} else when ODIN_OS == .Darwin {
|
||||
foreign import libc "system:System.framework"
|
||||
} else {
|
||||
foreign import libc "system:c"
|
||||
}
|
||||
|
||||
when ODIN_OS == "windows" {
|
||||
when ODIN_OS == .Windows {
|
||||
wctrans_t :: distinct wchar_t
|
||||
wctype_t :: distinct ushort
|
||||
}
|
||||
|
||||
when ODIN_OS == "linux" {
|
||||
when ODIN_OS == .Linux {
|
||||
wctrans_t :: distinct intptr_t
|
||||
wctype_t :: distinct ulong
|
||||
}
|
||||
|
||||
when ODIN_OS == "darwin" {
|
||||
when ODIN_OS == .Darwin {
|
||||
wctrans_t :: distinct int
|
||||
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)
|
||||
|
||||
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
|
||||
// own when fiat-crypto provides equivalent functionality,
|
||||
// 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
|
||||
// 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
|
||||
// systems that also happen to not be strict about aligned
|
||||
// memory access.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package crypto
|
||||
|
||||
when ODIN_OS != "linux" {
|
||||
when ODIN_OS != .Linux {
|
||||
_rand_bytes :: proc (dst: []byte) {
|
||||
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
|
||||
when ODIN_OS == "linux" || ODIN_OS == "darwin" {
|
||||
when ODIN_OS == .Linux || ODIN_OS == .Darwin {
|
||||
// NOTE(justasd): 644 (owner read, write; group read; others read)
|
||||
mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH
|
||||
}
|
||||
|
||||
@@ -443,7 +443,7 @@ when false {
|
||||
}
|
||||
|
||||
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)
|
||||
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] == '/' {
|
||||
return true
|
||||
}
|
||||
when ODIN_OS == "windows" {
|
||||
when ODIN_OS == .Windows {
|
||||
if len(path) > 2 {
|
||||
switch path[0] {
|
||||
case 'A'..='Z', 'a'..='z':
|
||||
|
||||
@@ -139,7 +139,7 @@ write_entire_file :: proc(name: string, data: []byte, truncate := true) -> (succ
|
||||
}
|
||||
|
||||
mode: int = 0
|
||||
when OS == "linux" || OS == "darwin" {
|
||||
when OS == .Linux || OS == .Darwin {
|
||||
// NOTE(justasd): 644 (owner read, write; group read; others read)
|
||||
mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH
|
||||
}
|
||||
|
||||
@@ -3,13 +3,13 @@ package os2
|
||||
import "core:strings"
|
||||
|
||||
user_cache_dir :: proc(allocator := context.allocator) -> (dir: string, is_defined: bool) {
|
||||
switch ODIN_OS {
|
||||
case "windows":
|
||||
#partial switch ODIN_OS {
|
||||
case .Windows:
|
||||
dir = get_env("LocalAppData")
|
||||
if dir != "" {
|
||||
dir = strings.clone(dir, allocator)
|
||||
}
|
||||
case "darwin":
|
||||
case .Darwin:
|
||||
dir = get_env("HOME")
|
||||
if dir != "" {
|
||||
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) {
|
||||
switch ODIN_OS {
|
||||
case "windows":
|
||||
#partial switch ODIN_OS {
|
||||
case .Windows:
|
||||
dir = get_env("AppData")
|
||||
if dir != "" {
|
||||
dir = strings.clone(dir, allocator)
|
||||
}
|
||||
case "darwin":
|
||||
case .Darwin:
|
||||
dir = get_env("HOME")
|
||||
if dir != "" {
|
||||
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) {
|
||||
env := "HOME"
|
||||
switch ODIN_OS {
|
||||
case "windows":
|
||||
#partial switch ODIN_OS {
|
||||
case .Windows:
|
||||
env = "USERPROFILE"
|
||||
}
|
||||
if v := get_env(env); v != "" {
|
||||
|
||||
@@ -320,7 +320,7 @@ foreign libc {
|
||||
@(link_name="exit") _unix_exit :: proc(status: c.int) -> ! ---
|
||||
}
|
||||
|
||||
when ODIN_ARCH != "arm64" {
|
||||
when ODIN_ARCH != .arm64 {
|
||||
_unix_fdopendir :: proc {_unix_fdopendir_amd64}
|
||||
_unix_readdir_r :: proc {_unix_readdir_r_amd64}
|
||||
} else {
|
||||
@@ -351,7 +351,7 @@ open :: proc(path: string, flags: int = O_RDWR, mode: int = 0) -> (Handle, Errno
|
||||
return INVALID_HANDLE, 1
|
||||
}
|
||||
|
||||
when ODIN_OS == "darwin" && ODIN_ARCH == "arm64" {
|
||||
when ODIN_OS == .Darwin && ODIN_ARCH == .arm64 {
|
||||
if mode != 0 {
|
||||
err := fchmod(handle, cast(u16)mode)
|
||||
if err != 0 {
|
||||
|
||||
@@ -271,7 +271,7 @@ AT_REMOVEDIR :: uintptr(0x200)
|
||||
AT_SYMLINK_NOFOLLOW :: uintptr(0x100)
|
||||
|
||||
_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)))
|
||||
} else { // NOTE: arm64 does not have open
|
||||
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 {
|
||||
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)))
|
||||
} else {
|
||||
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 {
|
||||
when ODIN_ARCH == "amd64" {
|
||||
when ODIN_ARCH == .amd64 {
|
||||
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)))
|
||||
} else { // NOTE: arm64 does not have stat
|
||||
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 {
|
||||
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)))
|
||||
} else {
|
||||
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 {
|
||||
when ODIN_ARCH == "amd64" {
|
||||
when ODIN_ARCH == .amd64 {
|
||||
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)))
|
||||
} 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))
|
||||
@@ -332,7 +332,7 @@ _unix_lstat :: proc(path: cstring, stat: ^OS_Stat) -> 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)))
|
||||
} else { // NOTE: arm64 does not have readlink
|
||||
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 {
|
||||
when ODIN_ARCH != "arm64" {
|
||||
when ODIN_ARCH != .arm64 {
|
||||
return int(intrinsics.syscall(unix.SYS_access, uintptr(rawptr(path)), uintptr(mask)))
|
||||
} else { // NOTE: arm64 does not have access
|
||||
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 {
|
||||
when ODIN_ARCH != "arm64" {
|
||||
when ODIN_ARCH != .arm64 {
|
||||
return int(intrinsics.syscall(unix.SYS_rename, uintptr(rawptr(old)), uintptr(rawptr(new))))
|
||||
} else { // NOTE: arm64 does not have rename
|
||||
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 {
|
||||
when ODIN_ARCH != "arm64" {
|
||||
when ODIN_ARCH != .arm64 {
|
||||
return int(intrinsics.syscall(unix.SYS_unlink, uintptr(rawptr(path))))
|
||||
} else { // NOTE: arm64 does not have unlink
|
||||
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 {
|
||||
when ODIN_ARCH != "arm64" {
|
||||
when ODIN_ARCH != .arm64 {
|
||||
return int(intrinsics.syscall(unix.SYS_rmdir, uintptr(rawptr(path))))
|
||||
} else { // NOTE: arm64 does not have rmdir
|
||||
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 {
|
||||
when ODIN_ARCH != "arm64" {
|
||||
when ODIN_ARCH != .arm64 {
|
||||
return int(intrinsics.syscall(unix.SYS_mkdir, uintptr(rawptr(path)), uintptr(mode)))
|
||||
} else { // NOTE: arm64 does not have mkdir
|
||||
return int(intrinsics.syscall(unix.SYS_mkdirat, uintptr(AT_FDCWD), uintptr(rawptr(path)), uintptr(mode)))
|
||||
|
||||
@@ -19,7 +19,7 @@ _file_stream_vtable := &io.Stream_VTable{
|
||||
return
|
||||
},
|
||||
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))
|
||||
os_err: Errno
|
||||
n, os_err = read_at(fd, p, offset)
|
||||
@@ -33,7 +33,7 @@ _file_stream_vtable := &io.Stream_VTable{
|
||||
return
|
||||
},
|
||||
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))
|
||||
os_err: Errno
|
||||
n, os_err = write_at(fd, p, offset)
|
||||
@@ -53,7 +53,7 @@ _file_stream_vtable := &io.Stream_VTable{
|
||||
return sz
|
||||
},
|
||||
impl_flush = proc(s: io.Stream) -> io.Error {
|
||||
when ODIN_OS == "windows" {
|
||||
when ODIN_OS == .Windows {
|
||||
fd := Handle(uintptr(s.stream_data))
|
||||
flush(fd)
|
||||
} 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 {
|
||||
switch pattern[i] {
|
||||
case '\\':
|
||||
when ODIN_OS != "windows" {
|
||||
when ODIN_OS != .Windows {
|
||||
if i+1 < len(pattern) {
|
||||
i += 1
|
||||
}
|
||||
@@ -161,7 +161,7 @@ match_chunk :: proc(chunk, s: string) -> (rest: string, ok: bool, err: Match_Err
|
||||
chunk = chunk[1:]
|
||||
|
||||
case '\\':
|
||||
when ODIN_OS != "windows" {
|
||||
when ODIN_OS != .Windows {
|
||||
chunk = chunk[1:]
|
||||
if len(chunk) == 0 {
|
||||
err = .Syntax_Error
|
||||
@@ -188,7 +188,7 @@ get_escape :: proc(chunk: string) -> (r: rune, next_chunk: string, err: Match_Er
|
||||
return
|
||||
}
|
||||
chunk := chunk
|
||||
if chunk[0] == '\\' && ODIN_OS != "windows" {
|
||||
if chunk[0] == '\\' && ODIN_OS != .Windows {
|
||||
chunk = chunk[1:]
|
||||
if len(chunk) == 0 {
|
||||
err = .Syntax_Error
|
||||
@@ -229,7 +229,7 @@ glob :: proc(pattern: string, allocator := context.allocator) -> (matches: []str
|
||||
|
||||
dir, file := split(pattern)
|
||||
volume_len := 0
|
||||
when ODIN_OS == "windows" {
|
||||
when ODIN_OS == .Windows {
|
||||
temp_buf: [8]byte
|
||||
volume_len, dir = clean_glob_path_windows(dir, temp_buf[:])
|
||||
} else {
|
||||
@@ -307,7 +307,7 @@ _glob :: proc(dir, pattern: string, matches: ^[dynamic]string) -> (m: [dynamic]s
|
||||
|
||||
@(private)
|
||||
has_meta :: proc(path: string) -> bool {
|
||||
when ODIN_OS == "windows" {
|
||||
when ODIN_OS == .Windows {
|
||||
CHARS :: `*?[`
|
||||
} else {
|
||||
CHARS :: `*?[\`
|
||||
|
||||
@@ -8,7 +8,7 @@ import "core:strings"
|
||||
is_separator :: proc(c: byte) -> bool {
|
||||
switch c {
|
||||
case '/': return true
|
||||
case '\\': return ODIN_OS == "windows"
|
||||
case '\\': return ODIN_OS == .Windows
|
||||
}
|
||||
return false
|
||||
}
|
||||
@@ -32,7 +32,7 @@ volume_name :: proc(path: string) -> string {
|
||||
}
|
||||
|
||||
volume_name_len :: proc(path: string) -> int {
|
||||
if ODIN_OS == "windows" {
|
||||
if ODIN_OS == .Windows {
|
||||
if len(path) < 2 {
|
||||
return 0
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//+build linux, darwin, freebsd
|
||||
package filepath
|
||||
|
||||
when ODIN_OS == "darwin" {
|
||||
when ODIN_OS == .Darwin {
|
||||
foreign import libc "System.framework"
|
||||
} else {
|
||||
foreign import libc "system:c"
|
||||
@@ -54,7 +54,7 @@ foreign libc {
|
||||
@(link_name="free") _unix_free :: proc(ptr: rawptr) ---
|
||||
|
||||
}
|
||||
when ODIN_OS == "darwin" {
|
||||
when ODIN_OS == .Darwin {
|
||||
@(private)
|
||||
foreign libc {
|
||||
@(link_name="__error") __error :: proc() -> ^i32 ---
|
||||
|
||||
@@ -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
|
||||
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) -> ! {
|
||||
when ODIN_OS == "freestanding" {
|
||||
when ODIN_OS == .Freestanding {
|
||||
// Do nothing
|
||||
} else {
|
||||
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 :: nil_allocator
|
||||
}
|
||||
@@ -3,7 +3,7 @@ package runtime
|
||||
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_init :: proc(s: ^Default_Temp_Allocator, size: int, backup_allocator := context.allocator) {}
|
||||
|
||||
@@ -22,7 +22,7 @@ when ODIN_BUILD_MODE == .Dynamic {
|
||||
return true
|
||||
}
|
||||
} 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)
|
||||
mainCRTStartup :: proc "stdcall" () -> i32 {
|
||||
context = default_context()
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package runtime
|
||||
|
||||
bounds_trap :: proc "contextless" () -> ! {
|
||||
when ODIN_OS == "windows" {
|
||||
when ODIN_OS == .Windows {
|
||||
windows_trap_array_bounds()
|
||||
} else {
|
||||
trap()
|
||||
@@ -9,7 +9,7 @@ bounds_trap :: proc "contextless" () -> ! {
|
||||
}
|
||||
|
||||
type_assertion_trap :: proc "contextless" () -> ! {
|
||||
when ODIN_OS == "windows" {
|
||||
when ODIN_OS == .Windows {
|
||||
windows_trap_type_assertion()
|
||||
} else {
|
||||
trap()
|
||||
|
||||
@@ -3,7 +3,7 @@ package runtime
|
||||
import "core:intrinsics"
|
||||
|
||||
@(private="file")
|
||||
IS_WASM :: ODIN_ARCH == "wasm32" || ODIN_ARCH == "wasm64"
|
||||
IS_WASM :: ODIN_ARCH == .wasm32 || ODIN_ARCH == .wasm64
|
||||
|
||||
@(private)
|
||||
RUNTIME_LINKAGE :: "strong" when (
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package runtime
|
||||
|
||||
when ODIN_NO_CRT && ODIN_OS == "windows" {
|
||||
when ODIN_NO_CRT && ODIN_OS == .Windows {
|
||||
foreign import lib "system:NtDll.lib"
|
||||
|
||||
@(private="file")
|
||||
@@ -25,7 +25,7 @@ when ODIN_NO_CRT && ODIN_OS == "windows" {
|
||||
RtlMoveMemory(dst, src, len)
|
||||
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)
|
||||
memset :: proc "c" (ptr: rawptr, val: i32, len: int) -> rawptr {
|
||||
if ptr != nil && len != 0 {
|
||||
|
||||
@@ -11,7 +11,7 @@ current_thread_id :: proc "contextless" () -> int {
|
||||
//
|
||||
// A Mutex must not be copied after first use
|
||||
Mutex :: struct {
|
||||
impl: _Mutex,
|
||||
impl: _Mutex `This is a tag`,
|
||||
}
|
||||
|
||||
// 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_Half_Width :: size_of(RW_Mutex_State)*8/2
|
||||
RW_Mutex_State_Is_Writing :: RW_Mutex_State(1)
|
||||
|
||||
@@ -15,7 +15,7 @@ import "core:intrinsics"
|
||||
// 386: arch/x86/entry/syscalls/sycall_32.tbl
|
||||
// arm: arch/arm/tools/syscall.tbl
|
||||
|
||||
when ODIN_ARCH == "amd64" {
|
||||
when ODIN_ARCH == .amd64 {
|
||||
SYS_read : uintptr : 0
|
||||
SYS_write : uintptr : 1
|
||||
SYS_open : uintptr : 2
|
||||
@@ -374,7 +374,7 @@ when ODIN_ARCH == "amd64" {
|
||||
SYS_landlock_add_rule : uintptr : 445
|
||||
SYS_landlock_restrict_self : uintptr : 446
|
||||
SYS_memfd_secret : uintptr : 447
|
||||
} else when ODIN_ARCH == "arm64" {
|
||||
} else when ODIN_ARCH == .arm64 {
|
||||
SYS_io_setup : uintptr : 0
|
||||
SYS_io_destroy : uintptr : 1
|
||||
SYS_io_submit : uintptr : 2
|
||||
@@ -675,7 +675,7 @@ when ODIN_ARCH == "amd64" {
|
||||
SYS_landlock_create_ruleset : uintptr : 444
|
||||
SYS_landlock_add_rule : uintptr : 445
|
||||
SYS_landlock_restrict_self : uintptr : 446
|
||||
} else when ODIN_ARCH == "i386" {
|
||||
} else when ODIN_ARCH == .i386 {
|
||||
SYS_restart_syscall : uintptr : 0
|
||||
SYS_exit : uintptr : 1
|
||||
SYS_fork : uintptr : 2
|
||||
@@ -1112,7 +1112,7 @@ when ODIN_ARCH == "amd64" {
|
||||
SYS_landlock_add_rule : uintptr : 445
|
||||
SYS_landlock_restrict_self : uintptr : 446
|
||||
SYS_memfd_secret : uintptr : 447
|
||||
} else when ODIN_ARCH == "arm" {
|
||||
} else when false /*ODIN_ARCH == .arm*/ { // TODO
|
||||
SYS_restart_syscall : uintptr : 0
|
||||
SYS_exit : uintptr : 1
|
||||
SYS_fork : uintptr : 2
|
||||
|
||||
@@ -3,7 +3,7 @@ package time
|
||||
|
||||
IS_SUPPORTED :: true // NOTE: Times on Darwin are UTC.
|
||||
|
||||
when ODIN_OS == "darwin" {
|
||||
when ODIN_OS == .Darwin {
|
||||
foreign import libc "System.framework"
|
||||
} else {
|
||||
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.
|
||||
// In Odin, the default case is denoted as a case without any expression.
|
||||
|
||||
switch arch := ODIN_ARCH; arch {
|
||||
case "386":
|
||||
#partial switch arch := ODIN_ARCH; arch {
|
||||
case .i386:
|
||||
fmt.println("32-bit")
|
||||
case "amd64":
|
||||
case .amd64:
|
||||
fmt.println("64-bit")
|
||||
case: // default
|
||||
fmt.println("Unsupported architecture")
|
||||
@@ -363,12 +363,12 @@ control_flow :: proc() {
|
||||
*/
|
||||
|
||||
// Example
|
||||
when ODIN_ARCH == "386" {
|
||||
when ODIN_ARCH == .i386 {
|
||||
fmt.println("32 bit")
|
||||
} else when ODIN_ARCH == "amd64" {
|
||||
} else when ODIN_ARCH == .amd64 {
|
||||
fmt.println("64 bit")
|
||||
} else {
|
||||
fmt.println("Unsupported architecture")
|
||||
fmt.println("Unknown architecture")
|
||||
}
|
||||
// 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,
|
||||
@@ -1100,7 +1100,7 @@ prefix_table := [?]string{
|
||||
}
|
||||
|
||||
threading_example :: proc() {
|
||||
if ODIN_OS == "darwin" {
|
||||
if ODIN_OS == .Darwin {
|
||||
// TODO: Fix threads on darwin/macOS
|
||||
return
|
||||
}
|
||||
@@ -1606,13 +1606,13 @@ where_clauses :: proc() {
|
||||
}
|
||||
|
||||
|
||||
when ODIN_OS == "windows" {
|
||||
when ODIN_OS == .Windows {
|
||||
foreign import kernel32 "system:kernel32.lib"
|
||||
}
|
||||
|
||||
foreign_system :: proc() {
|
||||
fmt.println("\n#foreign system")
|
||||
when ODIN_OS == "windows" {
|
||||
when ODIN_OS == .Windows {
|
||||
// It is sometimes necessarily to interface with foreign code,
|
||||
// such as a C library. In Odin, this is achieved through the
|
||||
// foreign system. You can “import” a library into the code
|
||||
|
||||
@@ -881,11 +881,42 @@ void init_universal(void) {
|
||||
add_global_bool_constant("false", false);
|
||||
|
||||
// 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_VERSION", bc->ODIN_VERSION);
|
||||
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] = {
|
||||
@@ -900,7 +931,6 @@ void init_universal(void) {
|
||||
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] = {
|
||||
{"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));
|
||||
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) {
|
||||
log(t, "Testing rand_bytes")
|
||||
|
||||
if ODIN_OS != "linux" {
|
||||
if ODIN_OS != .Linux {
|
||||
log(t, "rand_bytes not supported - skipping")
|
||||
return
|
||||
}
|
||||
|
||||
@@ -1785,7 +1785,7 @@ write_image_as_ppm :: proc(filename: string, image: ^image.Image) -> (success: b
|
||||
}
|
||||
|
||||
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)
|
||||
mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH
|
||||
}
|
||||
|
||||
4
vendor/ENet/enet.odin
vendored
4
vendor/ENet/enet.odin
vendored
@@ -1,7 +1,7 @@
|
||||
package ENet
|
||||
|
||||
when ODIN_OS == "windows" {
|
||||
when ODIN_ARCH == "amd64" {
|
||||
when ODIN_OS == .Windows {
|
||||
when ODIN_ARCH == .amd64 {
|
||||
foreign import ENet {
|
||||
"lib/enet64.lib",
|
||||
"system:Ws2_32.lib",
|
||||
|
||||
2
vendor/OpenGL/helpers.odin
vendored
2
vendor/OpenGL/helpers.odin
vendored
@@ -188,7 +188,7 @@ load_shaders_source :: proc(vs_source, fs_source: string, binary_retrievable :=
|
||||
load_shaders :: proc{load_shaders_file}
|
||||
|
||||
|
||||
when ODIN_OS == "windows" {
|
||||
when ODIN_OS == .Windows {
|
||||
update_shader_if_changed :: proc(
|
||||
vertex_name, fragment_name: string,
|
||||
program: u32,
|
||||
|
||||
6
vendor/botan/bindings/botan.odin
vendored
6
vendor/botan/bindings/botan.odin
vendored
@@ -136,11 +136,11 @@ totp_t :: ^totp_struct
|
||||
fpe_struct :: struct{}
|
||||
fpe_t :: ^fpe_struct
|
||||
|
||||
when ODIN_OS == "windows" {
|
||||
when ODIN_OS == .Windows {
|
||||
foreign import botan_lib "botan.lib"
|
||||
} else when ODIN_OS == "linux" {
|
||||
} else when ODIN_OS == .Linux {
|
||||
foreign import botan_lib "system:botan-2"
|
||||
} else when ODIN_OS == "darwin" {
|
||||
} else when ODIN_OS == .Darwin {
|
||||
foreign import botan_lib "system:botan-2"
|
||||
}
|
||||
|
||||
|
||||
6
vendor/glfw/bindings/bindings.odin
vendored
6
vendor/glfw/bindings/bindings.odin
vendored
@@ -3,9 +3,9 @@ package glfw_bindings
|
||||
import "core:c"
|
||||
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 == "darwin" { foreign import glfw "system:glfw" }
|
||||
when ODIN_OS == "windows" {
|
||||
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 == .Windows {
|
||||
foreign import glfw {
|
||||
"../lib/glfw3_mt.lib",
|
||||
"system:user32.lib",
|
||||
|
||||
6
vendor/glfw/native.odin
vendored
6
vendor/glfw/native.odin
vendored
@@ -1,6 +1,6 @@
|
||||
package glfw
|
||||
|
||||
when ODIN_OS == "windows" {
|
||||
when ODIN_OS == .Windows {
|
||||
import win32 "core:sys/windows"
|
||||
|
||||
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 ---
|
||||
GetWGLContext :: proc(window: WindowHandle) -> rawptr ---
|
||||
}
|
||||
} else when ODIN_OS == "linux" {
|
||||
} else when ODIN_OS == .Linux {
|
||||
// TODO: Native Linux
|
||||
// Display* glfwGetX11Display(void);
|
||||
// RRCrtc glfwGetX11Adapter(GLFWmonitor* monitor);
|
||||
@@ -24,7 +24,7 @@ when ODIN_OS == "windows" {
|
||||
// struct wl_display* glfwGetWaylandDisplay(void);
|
||||
// struct wl_output* glfwGetWaylandMonitor(GLFWmonitor* monitor);
|
||||
// struct wl_surface* glfwGetWaylandWindow(GLFWwindow* window);
|
||||
} else when ODIN_OS == "darwin" {
|
||||
} else when ODIN_OS == .Darwin {
|
||||
// TODO: Native Darwin
|
||||
// CGDirectDisplayID glfwGetCocoaMonitor(GLFWmonitor* monitor);
|
||||
// id glfwGetCocoaWindow(GLFWwindow* window);
|
||||
|
||||
6
vendor/miniaudio/common.odin
vendored
6
vendor/miniaudio/common.odin
vendored
@@ -2,8 +2,8 @@ package miniaudio
|
||||
|
||||
import "core:c"
|
||||
|
||||
when ODIN_OS == "windows" { foreign import lib "lib/miniaudio.lib" }
|
||||
when ODIN_OS == "linux" { foreign import lib "lib/miniaudio.a" }
|
||||
when ODIN_OS == .Windows { foreign import lib "lib/miniaudio.lib" }
|
||||
when ODIN_OS == .Linux { foreign import lib "lib/miniaudio.a" }
|
||||
|
||||
handle :: distinct rawptr
|
||||
|
||||
@@ -270,7 +270,7 @@ thread_priority :: enum c.int {
|
||||
/* Spinlocks are 32-bit for compatibility reasons. */
|
||||
spinlock :: distinct u32
|
||||
|
||||
when ODIN_OS == "windows" {
|
||||
when ODIN_OS == .Windows {
|
||||
thread :: distinct rawptr
|
||||
mutex :: distinct rawptr
|
||||
event :: distinct rawptr
|
||||
|
||||
4
vendor/miniaudio/data_conversion.odin
vendored
4
vendor/miniaudio/data_conversion.odin
vendored
@@ -2,8 +2,8 @@ package miniaudio
|
||||
|
||||
import "core:c"
|
||||
|
||||
when ODIN_OS == "windows" { foreign import lib "lib/miniaudio.lib" }
|
||||
when ODIN_OS == "linux" { foreign import lib "lib/miniaudio.a" }
|
||||
when ODIN_OS == .Windows { foreign import lib "lib/miniaudio.lib" }
|
||||
when ODIN_OS == .Linux { foreign import lib "lib/miniaudio.a" }
|
||||
|
||||
|
||||
/************************************************************************************************************************************************************
|
||||
|
||||
4
vendor/miniaudio/decoding.odin
vendored
4
vendor/miniaudio/decoding.odin
vendored
@@ -2,8 +2,8 @@ package miniaudio
|
||||
|
||||
import "core:c"
|
||||
|
||||
when ODIN_OS == "windows" { foreign import lib "lib/miniaudio.lib" }
|
||||
when ODIN_OS == "linux" { foreign import lib "lib/miniaudio.a" }
|
||||
when ODIN_OS == .Windows { foreign import lib "lib/miniaudio.lib" }
|
||||
when ODIN_OS == .Linux { foreign import lib "lib/miniaudio.a" }
|
||||
|
||||
|
||||
|
||||
|
||||
4
vendor/miniaudio/device_io_procs.odin
vendored
4
vendor/miniaudio/device_io_procs.odin
vendored
@@ -1,7 +1,7 @@
|
||||
package miniaudio
|
||||
|
||||
when ODIN_OS == "windows" { foreign import lib "lib/miniaudio.lib" }
|
||||
when ODIN_OS == "linux" { foreign import lib "lib/miniaudio.a" }
|
||||
when ODIN_OS == .Windows { foreign import lib "lib/miniaudio.lib" }
|
||||
when ODIN_OS == .Linux { foreign import lib "lib/miniaudio.a" }
|
||||
|
||||
import "core:c"
|
||||
|
||||
|
||||
32
vendor/miniaudio/device_io_types.odin
vendored
32
vendor/miniaudio/device_io_types.odin
vendored
@@ -2,21 +2,21 @@ package miniaudio
|
||||
|
||||
import "core:c"
|
||||
|
||||
SUPPORT_WASAPI :: ODIN_OS == "windows"
|
||||
SUPPORT_DSOUND :: ODIN_OS == "windows"
|
||||
SUPPORT_WINMM :: ODIN_OS == "windows"
|
||||
SUPPORT_COREAUDIO :: ODIN_OS == "darwin"
|
||||
SUPPORT_SNDIO :: ODIN_OS == "openbsd"
|
||||
SUPPORT_AUDIO4 :: ODIN_OS == "openbsd" || ODIN_OS == "netbsd"
|
||||
SUPPORT_OSS :: ODIN_OS == "freebsd"
|
||||
SUPPORT_PULSEAUDIO :: ODIN_OS == "linux"
|
||||
SUPPORT_ALSA :: ODIN_OS == "linux"
|
||||
SUPPORT_JACK :: ODIN_OS == "windows"
|
||||
SUPPORT_AAUDIO :: ODIN_OS == "android"
|
||||
SUPPORT_OPENSL :: ODIN_OS == "android"
|
||||
SUPPORT_WEBAUDIO :: ODIN_OS == "emscripten"
|
||||
SUPPORT_WASAPI :: ODIN_OS == .Windows
|
||||
SUPPORT_DSOUND :: ODIN_OS == .Windows
|
||||
SUPPORT_WINMM :: ODIN_OS == .Windows
|
||||
SUPPORT_COREAUDIO :: ODIN_OS == .Darwin
|
||||
SUPPORT_SNDIO :: false // ODIN_OS == .OpenBSD
|
||||
SUPPORT_AUDIO4 :: false // ODIN_OS == .OpenBSD || ODIN_OS == .NetBSD
|
||||
SUPPORT_OSS :: ODIN_OS == .FreeBSD
|
||||
SUPPORT_PULSEAUDIO :: ODIN_OS == .Linux
|
||||
SUPPORT_ALSA :: ODIN_OS == .Linux
|
||||
SUPPORT_JACK :: ODIN_OS == .Windows
|
||||
SUPPORT_AAUDIO :: false // ODIN_OS == .Android
|
||||
SUPPORT_OPENSL :: false // ODIN_OS == .Android
|
||||
SUPPORT_WEBAUDIO :: false // ODIN_OS == .Emscripten
|
||||
SUPPORT_CUSTOM :: true
|
||||
SUPPORT_NULL :: ODIN_OS != "emscripten"
|
||||
SUPPORT_NULL :: true // ODIN_OS != .Emscripten
|
||||
|
||||
STATE_UNINITIALIZED :: 0
|
||||
STATE_STOPPED :: 1 /* The device's default state after initialization. */
|
||||
@@ -895,7 +895,7 @@ context_type :: struct {
|
||||
RegOpenKeyExA: proc "system" (),
|
||||
RegCloseKey: proc "system" (),
|
||||
RegQueryValueExA: proc "system" (),
|
||||
} when ODIN_OS == "windows" else struct {}),
|
||||
} when ODIN_OS == .Windows else struct {}),
|
||||
|
||||
posix: (struct {
|
||||
pthreadSO: handle,
|
||||
@@ -914,7 +914,7 @@ context_type :: struct {
|
||||
pthread_attr_setschedpolicy: proc "system" (),
|
||||
pthread_attr_getschedparam: proc "system" (),
|
||||
pthread_attr_setschedparam: proc "system" (),
|
||||
} when ODIN_OS != "windows" else struct {}),
|
||||
} when ODIN_OS != .Windows else struct {}),
|
||||
|
||||
_unused: c.int,
|
||||
},
|
||||
|
||||
4
vendor/miniaudio/encoding.odin
vendored
4
vendor/miniaudio/encoding.odin
vendored
@@ -2,8 +2,8 @@ package miniaudio
|
||||
|
||||
import "core:c"
|
||||
|
||||
when ODIN_OS == "windows" { foreign import lib "lib/miniaudio.lib" }
|
||||
when ODIN_OS == "linux" { foreign import lib "lib/miniaudio.a" }
|
||||
when ODIN_OS == .Windows { foreign import lib "lib/miniaudio.lib" }
|
||||
when ODIN_OS == .Linux { foreign import lib "lib/miniaudio.a" }
|
||||
|
||||
/************************************************************************************************************************************************************
|
||||
|
||||
|
||||
4
vendor/miniaudio/filtering.odin
vendored
4
vendor/miniaudio/filtering.odin
vendored
@@ -1,7 +1,7 @@
|
||||
package miniaudio
|
||||
|
||||
when ODIN_OS == "windows" { foreign import lib "lib/miniaudio.lib" }
|
||||
when ODIN_OS == "linux" { foreign import lib "lib/miniaudio.a" }
|
||||
when ODIN_OS == .Windows { foreign import lib "lib/miniaudio.lib" }
|
||||
when ODIN_OS == .Linux { foreign import lib "lib/miniaudio.a" }
|
||||
|
||||
/**************************************************************************************************************************************************************
|
||||
|
||||
|
||||
4
vendor/miniaudio/generation.odin
vendored
4
vendor/miniaudio/generation.odin
vendored
@@ -2,8 +2,8 @@ package miniaudio
|
||||
|
||||
import "core:c"
|
||||
|
||||
when ODIN_OS == "windows" { foreign import lib "lib/miniaudio.lib" }
|
||||
when ODIN_OS == "linux" { foreign import lib "lib/miniaudio.a" }
|
||||
when ODIN_OS == .Windows { foreign import lib "lib/miniaudio.lib" }
|
||||
when ODIN_OS == .Linux { foreign import lib "lib/miniaudio.a" }
|
||||
|
||||
waveform_type :: enum c.int {
|
||||
sine,
|
||||
|
||||
4
vendor/miniaudio/logging.odin
vendored
4
vendor/miniaudio/logging.odin
vendored
@@ -2,8 +2,8 @@ package miniaudio
|
||||
|
||||
import c "core:c/libc"
|
||||
|
||||
when ODIN_OS == "windows" { foreign import lib "lib/miniaudio.lib" }
|
||||
when ODIN_OS == "linux" { foreign import lib "lib/miniaudio.a" }
|
||||
when ODIN_OS == .Windows { foreign import lib "lib/miniaudio.lib" }
|
||||
when ODIN_OS == .Linux { foreign import lib "lib/miniaudio.a" }
|
||||
|
||||
MAX_LOG_CALLBACKS :: 4
|
||||
|
||||
|
||||
4
vendor/miniaudio/utilities.odin
vendored
4
vendor/miniaudio/utilities.odin
vendored
@@ -1,7 +1,7 @@
|
||||
package miniaudio
|
||||
|
||||
when ODIN_OS == "windows" { foreign import lib "lib/miniaudio.lib" }
|
||||
when ODIN_OS == "linux" { foreign import lib "lib/miniaudio.a" }
|
||||
when ODIN_OS == .Windows { foreign import lib "lib/miniaudio.lib" }
|
||||
when ODIN_OS == .Linux { foreign import lib "lib/miniaudio.a" }
|
||||
|
||||
@(default_calling_convention="c", link_prefix="ma_")
|
||||
foreign lib {
|
||||
|
||||
4
vendor/miniaudio/vfs.odin
vendored
4
vendor/miniaudio/vfs.odin
vendored
@@ -2,8 +2,8 @@ package miniaudio
|
||||
|
||||
import "core:c"
|
||||
|
||||
when ODIN_OS == "windows" { foreign import lib "lib/miniaudio.lib" }
|
||||
when ODIN_OS == "linux" { foreign import lib "lib/miniaudio.a" }
|
||||
when ODIN_OS == .Windows { foreign import lib "lib/miniaudio.lib" }
|
||||
when ODIN_OS == .Linux { foreign import lib "lib/miniaudio.a" }
|
||||
|
||||
/************************************************************************************************************************************************************
|
||||
|
||||
|
||||
2
vendor/portmidi/portmidi.odin
vendored
2
vendor/portmidi/portmidi.odin
vendored
@@ -3,7 +3,7 @@ package portmidi
|
||||
import "core:c"
|
||||
import "core:strings"
|
||||
|
||||
when ODIN_OS == "windows" {
|
||||
when ODIN_OS == .Windows {
|
||||
foreign import lib {
|
||||
"portmidi_s.lib",
|
||||
"system:Winmm.lib",
|
||||
|
||||
2
vendor/portmidi/util.odin
vendored
2
vendor/portmidi/util.odin
vendored
@@ -7,7 +7,7 @@ package portmidi
|
||||
|
||||
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
|
||||
|
||||
6
vendor/raylib/raylib.odin
vendored
6
vendor/raylib/raylib.odin
vendored
@@ -91,7 +91,7 @@ MAX_TEXT_BUFFER_LENGTH :: #config(RAYLIB_MAX_TEXT_BUFFER_LENGTH, 1024)
|
||||
|
||||
#assert(size_of(rune) == size_of(c.int))
|
||||
|
||||
when ODIN_OS == "windows" {
|
||||
when ODIN_OS == .Windows {
|
||||
foreign import lib {
|
||||
"raylib.lib",
|
||||
"system:Winmm.lib",
|
||||
@@ -100,14 +100,14 @@ when ODIN_OS == "windows" {
|
||||
"system:Shell32.lib",
|
||||
}
|
||||
}
|
||||
when ODIN_OS == "linux" {
|
||||
when ODIN_OS == .Linux {
|
||||
foreign import lib {
|
||||
"linux/libraylib.a",
|
||||
"system:dl",
|
||||
"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"
|
||||
|
||||
|
||||
6
vendor/raylib/rlgl.odin
vendored
6
vendor/raylib/rlgl.odin
vendored
@@ -2,7 +2,7 @@ package raylib
|
||||
|
||||
import "core:c"
|
||||
|
||||
when ODIN_OS == "windows" {
|
||||
when ODIN_OS == .Windows {
|
||||
foreign import lib {
|
||||
"raylib.lib",
|
||||
"system:Winmm.lib",
|
||||
@@ -11,8 +11,8 @@ when ODIN_OS == "windows" {
|
||||
"system:Shell32.lib",
|
||||
}
|
||||
}
|
||||
when ODIN_OS == "linux" { foreign import lib "linux/libraylib.a" }
|
||||
when ODIN_OS == "darwin" { foreign import lib "macos/libraylib.a" }
|
||||
when ODIN_OS == .Linux { foreign import lib "linux/libraylib.a" }
|
||||
when ODIN_OS == .Darwin { foreign import lib "macos/libraylib.a" }
|
||||
|
||||
GRAPHICS_API_OPENGL_11 :: false
|
||||
GRAPHICS_API_OPENGL_21 :: true
|
||||
|
||||
8
vendor/sdl2/image/sdl_image.odin
vendored
8
vendor/sdl2/image/sdl_image.odin
vendored
@@ -3,10 +3,10 @@ package sdl2_image
|
||||
import "core:c"
|
||||
import SDL ".."
|
||||
|
||||
when ODIN_OS == "windows" { foreign import lib "SDL2_image.lib" }
|
||||
when ODIN_OS == "linux" { 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 == .Windows { foreign import lib "SDL2_image.lib" }
|
||||
when ODIN_OS == .Linux { 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" }
|
||||
|
||||
bool :: SDL.bool
|
||||
|
||||
|
||||
8
vendor/sdl2/mixer/sdl_mixer.odin
vendored
8
vendor/sdl2/mixer/sdl_mixer.odin
vendored
@@ -3,10 +3,10 @@ package sdl2_mixer
|
||||
import "core:c"
|
||||
import SDL ".."
|
||||
|
||||
when ODIN_OS == "windows" { foreign import lib "SDL2_mixer.lib" }
|
||||
when ODIN_OS == "linux" { 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 == .Windows { foreign import lib "SDL2_mixer.lib" }
|
||||
when ODIN_OS == .Linux { 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" }
|
||||
|
||||
|
||||
MAJOR_VERSION :: 2
|
||||
|
||||
8
vendor/sdl2/net/sdl_net.odin
vendored
8
vendor/sdl2/net/sdl_net.odin
vendored
@@ -3,10 +3,10 @@ package sdl2_net
|
||||
import "core:c"
|
||||
import SDL ".."
|
||||
|
||||
when ODIN_OS == "windows" { foreign import lib "SDL2_net.lib" }
|
||||
when ODIN_OS == "linux" { 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 == .Windows { foreign import lib "SDL2_net.lib" }
|
||||
when ODIN_OS == .Linux { 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" }
|
||||
|
||||
bool :: SDL.bool
|
||||
|
||||
|
||||
8
vendor/sdl2/sdl2.odin
vendored
8
vendor/sdl2/sdl2.odin
vendored
@@ -25,10 +25,10 @@ package sdl2
|
||||
import "core:c"
|
||||
import "core:intrinsics"
|
||||
|
||||
when ODIN_OS == "windows" { foreign import lib "SDL2.lib" }
|
||||
when ODIN_OS == "linux" { 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 == .Windows { foreign import lib "SDL2.lib" }
|
||||
when ODIN_OS == .Linux { foreign import lib "system:SDL2" }
|
||||
when ODIN_OS == .Darwin { foreign import lib "system:SDL2" }
|
||||
when ODIN_OS == .FreeBSD { foreign import lib "system:SDL2" }
|
||||
|
||||
version :: struct {
|
||||
major: u8, /**< major version */
|
||||
|
||||
8
vendor/sdl2/sdl_audio.odin
vendored
8
vendor/sdl2/sdl_audio.odin
vendored
@@ -2,10 +2,10 @@ package sdl2
|
||||
|
||||
import "core:c"
|
||||
|
||||
when ODIN_OS == "windows" { foreign import lib "SDL2.lib" }
|
||||
when ODIN_OS == "linux" { 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 == .Windows { foreign import lib "SDL2.lib" }
|
||||
when ODIN_OS == .Linux { foreign import lib "system:SDL2" }
|
||||
when ODIN_OS == .Darwin { foreign import lib "system:SDL2" }
|
||||
when ODIN_OS == .FreeBSD { foreign import lib "system:SDL2" }
|
||||
|
||||
/**
|
||||
* \brief Audio format flags.
|
||||
|
||||
8
vendor/sdl2/sdl_blendmode.odin
vendored
8
vendor/sdl2/sdl_blendmode.odin
vendored
@@ -2,10 +2,10 @@ package sdl2
|
||||
|
||||
import "core:c"
|
||||
|
||||
when ODIN_OS == "windows" { foreign import lib "SDL2.lib" }
|
||||
when ODIN_OS == "linux" { 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 == .Windows { foreign import lib "SDL2.lib" }
|
||||
when ODIN_OS == .Linux { foreign import lib "system:SDL2" }
|
||||
when ODIN_OS == .Darwin { 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.
|
||||
|
||||
8
vendor/sdl2/sdl_cpuinfo.odin
vendored
8
vendor/sdl2/sdl_cpuinfo.odin
vendored
@@ -2,10 +2,10 @@ package sdl2
|
||||
|
||||
import "core:c"
|
||||
|
||||
when ODIN_OS == "windows" { foreign import lib "SDL2.lib" }
|
||||
when ODIN_OS == "linux" { 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 == .Windows { foreign import lib "SDL2.lib" }
|
||||
when ODIN_OS == .Linux { foreign import lib "system:SDL2" }
|
||||
when ODIN_OS == .Darwin { 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.
|
||||
* Most x86 processors have a 64 byte cache line.
|
||||
|
||||
8
vendor/sdl2/sdl_events.odin
vendored
8
vendor/sdl2/sdl_events.odin
vendored
@@ -2,10 +2,10 @@ package sdl2
|
||||
|
||||
import "core:c"
|
||||
|
||||
when ODIN_OS == "windows" { foreign import lib "SDL2.lib" }
|
||||
when ODIN_OS == "linux" { 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 == .Windows { foreign import lib "SDL2.lib" }
|
||||
when ODIN_OS == .Linux { foreign import lib "system:SDL2" }
|
||||
when ODIN_OS == .Darwin { foreign import lib "system:SDL2" }
|
||||
when ODIN_OS == .FreeBSD { foreign import lib "system:SDL2" }
|
||||
|
||||
RELEASED :: 0
|
||||
PRESSED :: 1
|
||||
|
||||
8
vendor/sdl2/sdl_gamecontroller.odin
vendored
8
vendor/sdl2/sdl_gamecontroller.odin
vendored
@@ -2,10 +2,10 @@ package sdl2
|
||||
|
||||
import "core:c"
|
||||
|
||||
when ODIN_OS == "windows" { foreign import lib "SDL2.lib" }
|
||||
when ODIN_OS == "linux" { 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 == .Windows { foreign import lib "SDL2.lib" }
|
||||
when ODIN_OS == .Linux { foreign import lib "system:SDL2" }
|
||||
when ODIN_OS == .Darwin { foreign import lib "system:SDL2" }
|
||||
when ODIN_OS == .FreeBSD { foreign import lib "system:SDL2" }
|
||||
|
||||
GameController :: struct {}
|
||||
|
||||
|
||||
8
vendor/sdl2/sdl_gesture_haptic.odin
vendored
8
vendor/sdl2/sdl_gesture_haptic.odin
vendored
@@ -2,10 +2,10 @@ package sdl2
|
||||
|
||||
import "core:c"
|
||||
|
||||
when ODIN_OS == "windows" { foreign import lib "SDL2.lib" }
|
||||
when ODIN_OS == "linux" { 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 == .Windows { foreign import lib "SDL2.lib" }
|
||||
when ODIN_OS == .Linux { foreign import lib "system:SDL2" }
|
||||
when ODIN_OS == .Darwin { foreign import lib "system:SDL2" }
|
||||
when ODIN_OS == .FreeBSD { foreign import lib "system:SDL2" }
|
||||
|
||||
// Gesture
|
||||
|
||||
|
||||
8
vendor/sdl2/sdl_hints.odin
vendored
8
vendor/sdl2/sdl_hints.odin
vendored
@@ -2,10 +2,10 @@ package sdl2
|
||||
|
||||
import "core:c"
|
||||
|
||||
when ODIN_OS == "windows" { foreign import lib "SDL2.lib" }
|
||||
when ODIN_OS == "linux" { 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 == .Windows { foreign import lib "SDL2.lib" }
|
||||
when ODIN_OS == .Linux { foreign import lib "system:SDL2" }
|
||||
when ODIN_OS == .Darwin { foreign import lib "system:SDL2" }
|
||||
when ODIN_OS == .FreeBSD { foreign import lib "system:SDL2" }
|
||||
|
||||
HINT_ACCELEROMETER_AS_JOYSTICK :: "SDL_ACCELEROMETER_AS_JOYSTICK"
|
||||
HINT_ALLOW_ALT_TAB_WHILE_GRABBED :: "SDL_ALLOW_ALT_TAB_WHILE_GRABBED"
|
||||
|
||||
8
vendor/sdl2/sdl_joystick.odin
vendored
8
vendor/sdl2/sdl_joystick.odin
vendored
@@ -2,10 +2,10 @@ package sdl2
|
||||
|
||||
import "core:c"
|
||||
|
||||
when ODIN_OS == "windows" { foreign import lib "SDL2.lib" }
|
||||
when ODIN_OS == "linux" { 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 == .Windows { foreign import lib "SDL2.lib" }
|
||||
when ODIN_OS == .Linux { foreign import lib "system:SDL2" }
|
||||
when ODIN_OS == .Darwin { foreign import lib "system:SDL2" }
|
||||
when ODIN_OS == .FreeBSD { foreign import lib "system:SDL2" }
|
||||
|
||||
Joystick :: struct {}
|
||||
|
||||
|
||||
8
vendor/sdl2/sdl_keyboard.odin
vendored
8
vendor/sdl2/sdl_keyboard.odin
vendored
@@ -2,10 +2,10 @@ package sdl2
|
||||
|
||||
import "core:c"
|
||||
|
||||
when ODIN_OS == "windows" { foreign import lib "SDL2.lib" }
|
||||
when ODIN_OS == "linux" { 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 == .Windows { foreign import lib "SDL2.lib" }
|
||||
when ODIN_OS == .Linux { foreign import lib "system:SDL2" }
|
||||
when ODIN_OS == .Darwin { foreign import lib "system:SDL2" }
|
||||
when ODIN_OS == .FreeBSD { foreign import lib "system:SDL2" }
|
||||
|
||||
Keysym :: struct {
|
||||
scancode: Scancode, /**< SDL physical key code - see ::SDL_Scancode for details */
|
||||
|
||||
8
vendor/sdl2/sdl_log.odin
vendored
8
vendor/sdl2/sdl_log.odin
vendored
@@ -2,10 +2,10 @@ package sdl2
|
||||
|
||||
import "core:c"
|
||||
|
||||
when ODIN_OS == "windows" { foreign import lib "SDL2.lib" }
|
||||
when ODIN_OS == "linux" { 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 == .Windows { foreign import lib "SDL2.lib" }
|
||||
when ODIN_OS == .Linux { foreign import lib "system:SDL2" }
|
||||
when ODIN_OS == .Darwin { foreign import lib "system:SDL2" }
|
||||
when ODIN_OS == .FreeBSD { foreign import lib "system:SDL2" }
|
||||
|
||||
MAX_LOG_MESSAGE :: 4096
|
||||
|
||||
|
||||
8
vendor/sdl2/sdl_messagebox.odin
vendored
8
vendor/sdl2/sdl_messagebox.odin
vendored
@@ -2,10 +2,10 @@ package sdl2
|
||||
|
||||
import "core:c"
|
||||
|
||||
when ODIN_OS == "windows" { foreign import lib "SDL2.lib" }
|
||||
when ODIN_OS == "linux" { 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 == .Windows { foreign import lib "SDL2.lib" }
|
||||
when ODIN_OS == .Linux { foreign import lib "system:SDL2" }
|
||||
when ODIN_OS == .Darwin { foreign import lib "system:SDL2" }
|
||||
when ODIN_OS == .FreeBSD { foreign import lib "system:SDL2" }
|
||||
|
||||
MessageBoxFlag :: enum u32 {
|
||||
_ = 0,
|
||||
|
||||
8
vendor/sdl2/sdl_metal.odin
vendored
8
vendor/sdl2/sdl_metal.odin
vendored
@@ -2,10 +2,10 @@ package sdl2
|
||||
|
||||
import "core:c"
|
||||
|
||||
when ODIN_OS == "windows" { foreign import lib "SDL2.lib" }
|
||||
when ODIN_OS == "linux" { 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 == .Windows { foreign import lib "SDL2.lib" }
|
||||
when ODIN_OS == .Linux { foreign import lib "system:SDL2" }
|
||||
when ODIN_OS == .Darwin { foreign import lib "system:SDL2" }
|
||||
when ODIN_OS == .FreeBSD { foreign import lib "system:SDL2" }
|
||||
|
||||
MetalView :: distinct rawptr
|
||||
|
||||
|
||||
8
vendor/sdl2/sdl_mouse.odin
vendored
8
vendor/sdl2/sdl_mouse.odin
vendored
@@ -2,10 +2,10 @@ package sdl2
|
||||
|
||||
import "core:c"
|
||||
|
||||
when ODIN_OS == "windows" { foreign import lib "SDL2.lib" }
|
||||
when ODIN_OS == "linux" { 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 == .Windows { foreign import lib "SDL2.lib" }
|
||||
when ODIN_OS == .Linux { foreign import lib "system:SDL2" }
|
||||
when ODIN_OS == .Darwin { foreign import lib "system:SDL2" }
|
||||
when ODIN_OS == .FreeBSD { foreign import lib "system:SDL2" }
|
||||
|
||||
Cursor :: struct {}
|
||||
|
||||
|
||||
8
vendor/sdl2/sdl_mutex.odin
vendored
8
vendor/sdl2/sdl_mutex.odin
vendored
@@ -2,10 +2,10 @@ package sdl2
|
||||
|
||||
import "core:c"
|
||||
|
||||
when ODIN_OS == "windows" { foreign import lib "SDL2.lib" }
|
||||
when ODIN_OS == "linux" { 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 == .Windows { foreign import lib "SDL2.lib" }
|
||||
when ODIN_OS == .Linux { foreign import lib "system:SDL2" }
|
||||
when ODIN_OS == .Darwin { foreign import lib "system:SDL2" }
|
||||
when ODIN_OS == .FreeBSD { foreign import lib "system:SDL2" }
|
||||
|
||||
MUTEX_TIMEDOUT :: 1
|
||||
MUTEX_MAXWAIT :: ~u32(0)
|
||||
|
||||
8
vendor/sdl2/sdl_pixels.odin
vendored
8
vendor/sdl2/sdl_pixels.odin
vendored
@@ -2,10 +2,10 @@ package sdl2
|
||||
|
||||
import "core:c"
|
||||
|
||||
when ODIN_OS == "windows" { foreign import lib "SDL2.lib" }
|
||||
when ODIN_OS == "linux" { 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 == .Windows { foreign import lib "SDL2.lib" }
|
||||
when ODIN_OS == .Linux { foreign import lib "system:SDL2" }
|
||||
when ODIN_OS == .Darwin { foreign import lib "system:SDL2" }
|
||||
when ODIN_OS == .FreeBSD { foreign import lib "system:SDL2" }
|
||||
|
||||
ALPHA_OPAQUE :: 255
|
||||
ALPHA_TRANSPARENT :: 0
|
||||
|
||||
8
vendor/sdl2/sdl_rect.odin
vendored
8
vendor/sdl2/sdl_rect.odin
vendored
@@ -2,10 +2,10 @@ package sdl2
|
||||
|
||||
import "core:c"
|
||||
|
||||
when ODIN_OS == "windows" { foreign import lib "SDL2.lib" }
|
||||
when ODIN_OS == "linux" { 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 == .Windows { foreign import lib "SDL2.lib" }
|
||||
when ODIN_OS == .Linux { foreign import lib "system:SDL2" }
|
||||
when ODIN_OS == .Darwin { foreign import lib "system:SDL2" }
|
||||
when ODIN_OS == .FreeBSD { foreign import lib "system:SDL2" }
|
||||
|
||||
Point :: struct {
|
||||
x: c.int,
|
||||
|
||||
8
vendor/sdl2/sdl_render.odin
vendored
8
vendor/sdl2/sdl_render.odin
vendored
@@ -2,10 +2,10 @@ package sdl2
|
||||
|
||||
import "core:c"
|
||||
|
||||
when ODIN_OS == "windows" { foreign import lib "SDL2.lib" }
|
||||
when ODIN_OS == "linux" { 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 == .Windows { foreign import lib "SDL2.lib" }
|
||||
when ODIN_OS == .Linux { foreign import lib "system:SDL2" }
|
||||
when ODIN_OS == .Darwin { foreign import lib "system:SDL2" }
|
||||
when ODIN_OS == .FreeBSD { foreign import lib "system:SDL2" }
|
||||
|
||||
RendererFlag :: enum u32 {
|
||||
SOFTWARE = 0, /**< The renderer is a software fallback */
|
||||
|
||||
8
vendor/sdl2/sdl_rwops.odin
vendored
8
vendor/sdl2/sdl_rwops.odin
vendored
@@ -2,10 +2,10 @@ package sdl2
|
||||
|
||||
import "core:c"
|
||||
|
||||
when ODIN_OS == "windows" { foreign import lib "SDL2.lib" }
|
||||
when ODIN_OS == "linux" { 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 == .Windows { foreign import lib "SDL2.lib" }
|
||||
when ODIN_OS == .Linux { foreign import lib "system:SDL2" }
|
||||
when ODIN_OS == .Darwin { foreign import lib "system:SDL2" }
|
||||
when ODIN_OS == .FreeBSD { foreign import lib "system:SDL2" }
|
||||
|
||||
/* RWops Types */
|
||||
RWOPS_UNKNOWN :: 0 /**< Unknown stream type */
|
||||
|
||||
8
vendor/sdl2/sdl_stdinc.odin
vendored
8
vendor/sdl2/sdl_stdinc.odin
vendored
@@ -5,10 +5,10 @@ import "core:intrinsics"
|
||||
import "core:runtime"
|
||||
_, _ :: intrinsics, runtime
|
||||
|
||||
when ODIN_OS == "windows" { foreign import lib "SDL2.lib" }
|
||||
when ODIN_OS == "linux" { 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 == .Windows { foreign import lib "SDL2.lib" }
|
||||
when ODIN_OS == .Linux { foreign import lib "system:SDL2" }
|
||||
when ODIN_OS == .Darwin { foreign import lib "system:SDL2" }
|
||||
when ODIN_OS == .FreeBSD { foreign import lib "system:SDL2" }
|
||||
|
||||
bool :: distinct b32
|
||||
#assert(size_of(bool) == size_of(c.int))
|
||||
|
||||
8
vendor/sdl2/sdl_surface.odin
vendored
8
vendor/sdl2/sdl_surface.odin
vendored
@@ -2,10 +2,10 @@ package sdl2
|
||||
|
||||
import "core:c"
|
||||
|
||||
when ODIN_OS == "windows" { foreign import lib "SDL2.lib" }
|
||||
when ODIN_OS == "linux" { 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 == .Windows { foreign import lib "SDL2.lib" }
|
||||
when ODIN_OS == .Linux { foreign import lib "system:SDL2" }
|
||||
when ODIN_OS == .Darwin { foreign import lib "system:SDL2" }
|
||||
when ODIN_OS == .FreeBSD { foreign import lib "system:SDL2" }
|
||||
|
||||
SWSURFACE :: 0 /**< Just here for compatibility */
|
||||
PREALLOC :: 0x00000001 /**< Surface uses preallocated memory */
|
||||
|
||||
8
vendor/sdl2/sdl_system.odin
vendored
8
vendor/sdl2/sdl_system.odin
vendored
@@ -2,10 +2,10 @@ package sdl2
|
||||
|
||||
import "core:c"
|
||||
|
||||
when ODIN_OS == "windows" { foreign import lib "SDL2.lib" }
|
||||
when ODIN_OS == "linux" { 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 == .Windows { foreign import lib "SDL2.lib" }
|
||||
when ODIN_OS == .Linux { foreign import lib "system:SDL2" }
|
||||
when ODIN_OS == .Darwin { foreign import lib "system:SDL2" }
|
||||
when ODIN_OS == .FreeBSD { foreign import lib "system:SDL2" }
|
||||
|
||||
// General
|
||||
@(default_calling_convention="c", link_prefix="SDL_")
|
||||
|
||||
8
vendor/sdl2/sdl_syswm.odin
vendored
8
vendor/sdl2/sdl_syswm.odin
vendored
@@ -2,10 +2,10 @@ package sdl2
|
||||
|
||||
import "core:c"
|
||||
|
||||
when ODIN_OS == "windows" { foreign import lib "SDL2.lib" }
|
||||
when ODIN_OS == "linux" { 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 == .Windows { foreign import lib "SDL2.lib" }
|
||||
when ODIN_OS == .Linux { foreign import lib "system:SDL2" }
|
||||
when ODIN_OS == .Darwin { foreign import lib "system:SDL2" }
|
||||
when ODIN_OS == .FreeBSD { foreign import lib "system:SDL2" }
|
||||
|
||||
SYSWM_TYPE :: enum c.int {
|
||||
UNKNOWN,
|
||||
|
||||
8
vendor/sdl2/sdl_thread.odin
vendored
8
vendor/sdl2/sdl_thread.odin
vendored
@@ -2,10 +2,10 @@ package sdl2
|
||||
|
||||
import "core:c"
|
||||
|
||||
when ODIN_OS == "windows" { foreign import lib "SDL2.lib" }
|
||||
when ODIN_OS == "linux" { 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 == .Windows { foreign import lib "SDL2.lib" }
|
||||
when ODIN_OS == .Linux { foreign import lib "system:SDL2" }
|
||||
when ODIN_OS == .Darwin { foreign import lib "system:SDL2" }
|
||||
when ODIN_OS == .FreeBSD { foreign import lib "system:SDL2" }
|
||||
|
||||
Thread :: struct {}
|
||||
|
||||
|
||||
8
vendor/sdl2/sdl_timer.odin
vendored
8
vendor/sdl2/sdl_timer.odin
vendored
@@ -2,10 +2,10 @@ package sdl2
|
||||
|
||||
import "core:c"
|
||||
|
||||
when ODIN_OS == "windows" { foreign import lib "SDL2.lib" }
|
||||
when ODIN_OS == "linux" { 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 == .Windows { foreign import lib "SDL2.lib" }
|
||||
when ODIN_OS == .Linux { foreign import lib "system:SDL2" }
|
||||
when ODIN_OS == .Darwin { foreign import lib "system:SDL2" }
|
||||
when ODIN_OS == .FreeBSD { foreign import lib "system:SDL2" }
|
||||
|
||||
TimerCallback :: proc "c" (interval: u32, param: rawptr) -> u32
|
||||
TimerID :: distinct c.int
|
||||
|
||||
8
vendor/sdl2/sdl_touch.odin
vendored
8
vendor/sdl2/sdl_touch.odin
vendored
@@ -2,10 +2,10 @@ package sdl2
|
||||
|
||||
import "core:c"
|
||||
|
||||
when ODIN_OS == "windows" { foreign import lib "SDL2.lib" }
|
||||
when ODIN_OS == "linux" { 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 == .Windows { foreign import lib "SDL2.lib" }
|
||||
when ODIN_OS == .Linux { foreign import lib "system:SDL2" }
|
||||
when ODIN_OS == .Darwin { foreign import lib "system:SDL2" }
|
||||
when ODIN_OS == .FreeBSD { foreign import lib "system:SDL2" }
|
||||
|
||||
TouchID :: distinct i64
|
||||
FingerID :: distinct i64
|
||||
|
||||
8
vendor/sdl2/sdl_video.odin
vendored
8
vendor/sdl2/sdl_video.odin
vendored
@@ -2,10 +2,10 @@ package sdl2
|
||||
|
||||
import "core:c"
|
||||
|
||||
when ODIN_OS == "windows" { foreign import lib "SDL2.lib" }
|
||||
when ODIN_OS == "linux" { 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 == .Windows { foreign import lib "SDL2.lib" }
|
||||
when ODIN_OS == .Linux { foreign import lib "system:SDL2" }
|
||||
when ODIN_OS == .Darwin { foreign import lib "system:SDL2" }
|
||||
when ODIN_OS == .FreeBSD { foreign import lib "system:SDL2" }
|
||||
|
||||
DisplayMode :: struct {
|
||||
format: u32, /**< pixel format */
|
||||
|
||||
8
vendor/sdl2/sdl_vulkan.odin
vendored
8
vendor/sdl2/sdl_vulkan.odin
vendored
@@ -3,10 +3,10 @@ package sdl2
|
||||
import "core:c"
|
||||
import vk "vendor:vulkan"
|
||||
|
||||
when ODIN_OS == "windows" { foreign import lib "SDL2.lib" }
|
||||
when ODIN_OS == "linux" { 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 == .Windows { foreign import lib "SDL2.lib" }
|
||||
when ODIN_OS == .Linux { foreign import lib "system:SDL2" }
|
||||
when ODIN_OS == .Darwin { foreign import lib "system:SDL2" }
|
||||
when ODIN_OS == .FreeBSD { foreign import lib "system:SDL2" }
|
||||
|
||||
VkInstance :: vk.Instance
|
||||
VkSurfaceKHR :: vk.SurfaceKHR
|
||||
|
||||
8
vendor/sdl2/ttf/sdl_ttf.odin
vendored
8
vendor/sdl2/ttf/sdl_ttf.odin
vendored
@@ -3,10 +3,10 @@ package sdl2_ttf
|
||||
import "core:c"
|
||||
import SDL ".."
|
||||
|
||||
when ODIN_OS == "windows" { foreign import lib "SDL2_ttf.lib" }
|
||||
when ODIN_OS == "linux" { 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 == .Windows { foreign import lib "SDL2_ttf.lib" }
|
||||
when ODIN_OS == .Linux { 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" }
|
||||
|
||||
bool :: SDL.bool
|
||||
|
||||
|
||||
4
vendor/stb/image/stb_image.odin
vendored
4
vendor/stb/image/stb_image.odin
vendored
@@ -4,8 +4,8 @@ import c "core:c/libc"
|
||||
|
||||
#assert(size_of(c.int) == size_of(b32))
|
||||
|
||||
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 == .Windows { foreign import stbi "../lib/stb_image.lib" }
|
||||
when ODIN_OS == .Linux { foreign import stbi "../lib/stb_image.a" }
|
||||
|
||||
#assert(size_of(b32) == size_of(c.int))
|
||||
|
||||
|
||||
4
vendor/stb/image/stb_image_resize.odin
vendored
4
vendor/stb/image/stb_image_resize.odin
vendored
@@ -2,8 +2,8 @@ package stb_image
|
||||
|
||||
import c "core:c/libc"
|
||||
|
||||
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 == .Windows { foreign import lib "../lib/stb_image_resize.lib" }
|
||||
when ODIN_OS == .Linux { foreign import lib "../lib/stb_image_resize.a" }
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
|
||||
4
vendor/stb/image/stb_image_write.odin
vendored
4
vendor/stb/image/stb_image_write.odin
vendored
@@ -2,8 +2,8 @@ package stb_image
|
||||
|
||||
import c "core:c/libc"
|
||||
|
||||
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 == .Windows { foreign import stbiw "../lib/stb_image_write.lib" }
|
||||
when ODIN_OS == .Linux { foreign import stbiw "../lib/stb_image_write.a" }
|
||||
|
||||
|
||||
write_func :: proc "c" (ctx: rawptr, data: rawptr, size: c.int)
|
||||
|
||||
4
vendor/stb/rect_pack/stb_rect_pack.odin
vendored
4
vendor/stb/rect_pack/stb_rect_pack.odin
vendored
@@ -4,8 +4,8 @@ import c "core:c/libc"
|
||||
|
||||
#assert(size_of(b32) == size_of(c.int))
|
||||
|
||||
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 == .Windows { foreign import lib "../lib/stb_rect_pack.lib" }
|
||||
when ODIN_OS == .Linux { foreign import lib "../lib/stb_rect_pack.a" }
|
||||
|
||||
Coord :: distinct c.int
|
||||
_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