Merge pull request #1438 from odin-lang/odin-global-constants-as-enums

Odin global constants as enums
This commit is contained in:
gingerBill
2022-02-15 16:18:07 +00:00
committed by GitHub
104 changed files with 382 additions and 322 deletions

View File

@@ -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

View File

@@ -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"

View File

@@ -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"

View File

@@ -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 {

View File

@@ -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"

View File

@@ -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

View File

@@ -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))

View File

@@ -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

View File

@@ -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

View File

@@ -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"

View File

@@ -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!
}

View File

@@ -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

View File

@@ -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"

View File

@@ -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"

View File

@@ -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
}

View File

@@ -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

View File

@@ -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.

View File

@@ -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")
}

View File

@@ -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
}

View File

@@ -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
}

View File

@@ -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':

View File

@@ -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
}

View File

@@ -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 != "" {

View File

@@ -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 {

View File

@@ -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)))

View File

@@ -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 {

View File

@@ -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 :: `*?[\`

View File

@@ -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
}

View File

@@ -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 ---

View File

@@ -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)

View File

@@ -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
}

View File

@@ -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) {}

View File

@@ -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()

View File

@@ -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()

View File

@@ -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 (

View File

@@ -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 {

View File

@@ -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

View File

@@ -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)

View File

@@ -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

View File

@@ -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"

View File

@@ -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 Cs 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

View File

@@ -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]]);
}
{

View File

@@ -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
}

View File

@@ -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
}

View File

@@ -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",

View File

@@ -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,

View File

@@ -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"
}

View File

@@ -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",

View File

@@ -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);

View File

@@ -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

View File

@@ -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" }
/************************************************************************************************************************************************************

View File

@@ -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" }

View File

@@ -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"

View File

@@ -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,
},

View File

@@ -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" }
/************************************************************************************************************************************************************

View File

@@ -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" }
/**************************************************************************************************************************************************************

View File

@@ -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,

View File

@@ -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

View File

@@ -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 {

View File

@@ -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" }
/************************************************************************************************************************************************************

View File

@@ -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",

View File

@@ -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

View File

@@ -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"

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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 */

View File

@@ -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.

View File

@@ -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.

View File

@@ -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.

View File

@@ -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

View File

@@ -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 {}

View File

@@ -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

View File

@@ -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"

View File

@@ -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 {}

View File

@@ -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 */

View File

@@ -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

View File

@@ -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,

View File

@@ -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

View File

@@ -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 {}

View File

@@ -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)

View File

@@ -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

View File

@@ -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,

View File

@@ -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 */

View File

@@ -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 */

View File

@@ -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))

View File

@@ -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 */

View File

@@ -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_")

View File

@@ -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,

View File

@@ -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 {}

View File

@@ -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

View File

@@ -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

View File

@@ -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 */

View File

@@ -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

View File

@@ -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

View File

@@ -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))

View File

@@ -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" }
//////////////////////////////////////////////////////////////////////////////
//

View File

@@ -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)

View File

@@ -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