mirror of
https://github.com/Ed94/Odin.git
synced 2026-07-09 13:01:38 -07:00
Merge branch 'master' of https://github.com/odin-lang/Odin
This commit is contained in:
@@ -47,8 +47,6 @@ _entities :: proc() {
|
||||
}
|
||||
|
||||
_main :: proc() {
|
||||
using fmt
|
||||
|
||||
options := xml.Options{ flags = { .Ignore_Unsupported, .Intern_Comments, .Unbox_CDATA, .Decode_SGML_Entities }}
|
||||
|
||||
doc, _ := xml.parse(#load("test.html"), options)
|
||||
@@ -58,8 +56,6 @@ _main :: proc() {
|
||||
}
|
||||
|
||||
main :: proc() {
|
||||
using fmt
|
||||
|
||||
track: mem.Tracking_Allocator
|
||||
mem.tracking_allocator_init(&track, context.allocator)
|
||||
context.allocator = mem.tracking_allocator(&track)
|
||||
@@ -68,9 +64,9 @@ main :: proc() {
|
||||
_entities()
|
||||
|
||||
if len(track.allocation_map) > 0 {
|
||||
println()
|
||||
fmt.println()
|
||||
for _, v in track.allocation_map {
|
||||
printf("%v Leaked %v bytes.\n", v.location, v.size)
|
||||
fmt.printf("%v Leaked %v bytes.\n", v.location, v.size)
|
||||
}
|
||||
}
|
||||
}
|
||||
+3010
-5412
File diff suppressed because it is too large
Load Diff
@@ -201,20 +201,37 @@ unmarshal_string_token :: proc(p: ^Parser, val: any, str: string, ti: ^reflect.T
|
||||
unmarshal_value :: proc(p: ^Parser, v: any) -> (err: Unmarshal_Error) {
|
||||
UNSUPPORTED_TYPE := Unsupported_Type_Error{v.id, p.curr_token}
|
||||
token := p.curr_token
|
||||
|
||||
|
||||
v := v
|
||||
ti := reflect.type_info_base(type_info_of(v.id))
|
||||
// NOTE: If it's a union with only one variant, then treat it as that variant
|
||||
if u, ok := ti.variant.(reflect.Type_Info_Union); ok && len(u.variants) == 1 && token.kind != .Null {
|
||||
variant := u.variants[0]
|
||||
v.id = variant.id
|
||||
ti = reflect.type_info_base(variant)
|
||||
if !reflect.is_pointer_internally(variant) {
|
||||
tag := any{rawptr(uintptr(v.data) + u.tag_offset), u.tag_type.id}
|
||||
assign_int(tag, 1)
|
||||
if u, ok := ti.variant.(reflect.Type_Info_Union); ok && token.kind != .Null {
|
||||
// NOTE: If it's a union with only one variant, then treat it as that variant
|
||||
if len(u.variants) == 1 {
|
||||
variant := u.variants[0]
|
||||
v.id = variant.id
|
||||
ti = reflect.type_info_base(variant)
|
||||
if !reflect.is_pointer_internally(variant) {
|
||||
tag := any{rawptr(uintptr(v.data) + u.tag_offset), u.tag_type.id}
|
||||
assign_int(tag, 1)
|
||||
}
|
||||
} else if v.id != Value {
|
||||
for variant, i in u.variants {
|
||||
variant_any := any{v.data, variant.id}
|
||||
variant_p := p^
|
||||
if err = unmarshal_value(&variant_p, variant_any); err == nil {
|
||||
p^ = variant_p
|
||||
|
||||
raw_tag := i
|
||||
if !u.no_nil { raw_tag += 1 }
|
||||
tag := any{rawptr(uintptr(v.data) + u.tag_offset), u.tag_type.id}
|
||||
assign_int(tag, raw_tag)
|
||||
return
|
||||
}
|
||||
}
|
||||
return UNSUPPORTED_TYPE
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
switch &dst in v {
|
||||
// Handle json.Value as an unknown type
|
||||
case Value:
|
||||
|
||||
@@ -348,7 +348,7 @@ make_multi_pointer :: proc($T: typeid/[^]$E, #any_int len: int, allocator := con
|
||||
//
|
||||
// Similar to `new`, the first argument is a type, not a value. Unlike new, make's return type is the same as the
|
||||
// type of its argument, not a pointer to it.
|
||||
// Make uses the specified allocator, default is context.allocator, default is context.allocator
|
||||
// Make uses the specified allocator, default is context.allocator.
|
||||
@builtin
|
||||
make :: proc{
|
||||
make_slice,
|
||||
|
||||
+12
-1
@@ -37,7 +37,18 @@ when ODIN_NO_CRT && ODIN_OS == .Windows {
|
||||
}
|
||||
return ptr
|
||||
}
|
||||
|
||||
|
||||
@(link_name="bzero", linkage="strong", require)
|
||||
bzero :: proc "c" (ptr: rawptr, len: int) -> rawptr {
|
||||
if ptr != nil && len != 0 {
|
||||
p := ([^]byte)(ptr)
|
||||
for i := 0; i < len; i += 1 {
|
||||
p[i] = 0
|
||||
}
|
||||
}
|
||||
return ptr
|
||||
}
|
||||
|
||||
@(link_name="memmove", linkage="strong", require)
|
||||
memmove :: proc "c" (dst, src: rawptr, len: int) -> rawptr {
|
||||
d, s := ([^]byte)(dst), ([^]byte)(src)
|
||||
|
||||
+423
-65
@@ -1,7 +1,9 @@
|
||||
package linux
|
||||
|
||||
|
||||
/// Represents an error returned by most of syscalls
|
||||
/*
|
||||
Represents an error returned by most of syscalls
|
||||
*/
|
||||
Errno :: enum i32 {
|
||||
NONE = 0,
|
||||
// Errno-base
|
||||
@@ -142,8 +144,9 @@ Errno :: enum i32 {
|
||||
EDEADLOCK = EDEADLK,
|
||||
}
|
||||
|
||||
|
||||
/// Bits for Open_Flags
|
||||
/*
|
||||
Bits for Open_Flags
|
||||
*/
|
||||
Open_Flags_Bits :: enum {
|
||||
RDONLY = 0,
|
||||
WRONLY = 1,
|
||||
@@ -164,7 +167,9 @@ Open_Flags_Bits :: enum {
|
||||
PATH = 21,
|
||||
}
|
||||
|
||||
/// Bits for FD_Flags bitset
|
||||
/*
|
||||
Bits for FD_Flags bitset
|
||||
*/
|
||||
FD_Flags_Bits :: enum {
|
||||
SYMLINK_NOFOLLOW = 8,
|
||||
REMOVEDIR = 9,
|
||||
@@ -177,7 +182,9 @@ FD_Flags_Bits :: enum {
|
||||
RECURSIVE = 15,
|
||||
}
|
||||
|
||||
/// The bits for the Mode bitset.
|
||||
/*
|
||||
The bits for the Mode bitset.
|
||||
*/
|
||||
Mode_Bits :: enum {
|
||||
IXOTH = 0, // 0o0000001
|
||||
IWOTH = 1, // 0o0000002
|
||||
@@ -197,7 +204,9 @@ Mode_Bits :: enum {
|
||||
IFREG = 15, // 0o0100000
|
||||
}
|
||||
|
||||
/// The bits used by the Statx_Mask bitset
|
||||
/*
|
||||
The bits used by the Statx_Mask bitset
|
||||
*/
|
||||
Statx_Mask_Bits :: enum {
|
||||
TYPE = 0,
|
||||
MODE = 1,
|
||||
@@ -215,8 +224,10 @@ Statx_Mask_Bits :: enum {
|
||||
DIOALIGN = 13,
|
||||
}
|
||||
|
||||
/// Bits found in Statx_Attr bitset
|
||||
/// You should not use these directly
|
||||
/*
|
||||
Bits found in Statx_Attr bitset
|
||||
You should not use these directly
|
||||
*/
|
||||
Statx_Attr_Bits :: enum {
|
||||
COMPRESSED = 2, // 0x00000004
|
||||
IMMUTABLE = 4, // 0x00000010
|
||||
@@ -229,7 +240,9 @@ Statx_Attr_Bits :: enum {
|
||||
DAX = 21, // 0x00200000
|
||||
}
|
||||
|
||||
/// Magic bits for filesystems returned by Stat_FS
|
||||
/*
|
||||
Magic bits for filesystems returned by Stat_FS
|
||||
*/
|
||||
FS_Magic :: enum u32 {
|
||||
ADFS_SUPER_MAGIC = 0xadf5,
|
||||
AFFS_SUPER_MAGIC = 0xadff,
|
||||
@@ -317,7 +330,9 @@ FS_Magic :: enum u32 {
|
||||
_XIAFS_SUPER_MAGIC = 0x012fd16d,
|
||||
}
|
||||
|
||||
/// Bits for FS_Flags bitset
|
||||
/*
|
||||
Bits for FS_Flags bitset
|
||||
*/
|
||||
FS_Flags_Bits :: enum {
|
||||
RDONLY = 0,
|
||||
NOSUID = 1,
|
||||
@@ -340,20 +355,26 @@ Seek_Whence :: enum i16 {
|
||||
HOLE = 4,
|
||||
}
|
||||
|
||||
/// Bits for Close_Range_Flags
|
||||
/*
|
||||
Bits for Close_Range_Flags
|
||||
*/
|
||||
Close_Range_Flags_Bits :: enum {
|
||||
CLOEXEC = 2,
|
||||
UNSHARE = 1,
|
||||
}
|
||||
|
||||
/// Bits for Rename_Flags
|
||||
/*
|
||||
Bits for Rename_Flags
|
||||
*/
|
||||
Rename_Flags_Bits :: enum {
|
||||
EXCHANGE = 1,
|
||||
NOREPLACE = 0,
|
||||
WHITEOUT = 2,
|
||||
}
|
||||
|
||||
/// Type of the file in a directory entry
|
||||
/*
|
||||
Type of the file in a directory entry
|
||||
*/
|
||||
Dirent_Type :: enum u8 {
|
||||
UNKNOWN = 0,
|
||||
FIFO = 1,
|
||||
@@ -366,14 +387,18 @@ Dirent_Type :: enum u8 {
|
||||
WHT = 14,
|
||||
}
|
||||
|
||||
/// Type of a lock for fcntl.2
|
||||
/*
|
||||
Type of a lock for fcntl(2)
|
||||
*/
|
||||
FLock_Type :: enum i16 {
|
||||
RDLCK = 0,
|
||||
WRLCK = 1,
|
||||
UNLCK = 2,
|
||||
}
|
||||
|
||||
/// Bits for FD_Notifications
|
||||
/*
|
||||
Bits for FD_Notifications
|
||||
*/
|
||||
FD_Notifications_Bits :: enum {
|
||||
ACCESS = 0,
|
||||
MODIFY = 1,
|
||||
@@ -384,7 +409,9 @@ FD_Notifications_Bits :: enum {
|
||||
MULTISHOT = 31,
|
||||
}
|
||||
|
||||
/// Bits for seal
|
||||
/*
|
||||
Bits for seal
|
||||
*/
|
||||
Seal_Bits :: enum {
|
||||
SEAL = 0,
|
||||
SHRINK = 1,
|
||||
@@ -408,14 +435,18 @@ FD_Lease :: enum {
|
||||
UNLCK = 2,
|
||||
}
|
||||
|
||||
/// Kind of owner for FD_Owner
|
||||
/*
|
||||
Kind of owner for FD_Owner
|
||||
*/
|
||||
F_Owner_Type :: enum i32 {
|
||||
OWNER_TID = 0,
|
||||
OWNER_PID = 1,
|
||||
OWNER_PGRP = 2,
|
||||
}
|
||||
|
||||
/// Command for fcntl.2
|
||||
/*
|
||||
Command for fcntl(2)
|
||||
*/
|
||||
FCntl_Command :: enum {
|
||||
DUPFD = 0,
|
||||
GETFD = 1,
|
||||
@@ -465,7 +496,9 @@ Fd_Poll_Events_Bits :: enum {
|
||||
RDHUP = 13,
|
||||
}
|
||||
|
||||
/// Bits for Mem_Protection bitfield
|
||||
/*
|
||||
Bits for Mem_Protection bitfield
|
||||
*/
|
||||
Mem_Protection_Bits :: enum{
|
||||
READ = 0,
|
||||
WRITE = 1,
|
||||
@@ -479,7 +512,9 @@ Mem_Protection_Bits :: enum{
|
||||
GROWSUP = 25,
|
||||
}
|
||||
|
||||
/// Bits for Map_Flags
|
||||
/*
|
||||
Bits for Map_Flags
|
||||
*/
|
||||
Map_Flags_Bits :: enum {
|
||||
SHARED = 0,
|
||||
PRIVATE = 1,
|
||||
@@ -504,19 +539,25 @@ Map_Flags_Bits :: enum {
|
||||
UNINITIALIZED = 26,
|
||||
}
|
||||
|
||||
/// Bits for MLock_Flags
|
||||
/*
|
||||
Bits for MLock_Flags
|
||||
*/
|
||||
MLock_Flags_Bits :: enum {
|
||||
ONFAULT = 0,
|
||||
}
|
||||
|
||||
/// Bits for MSync_Flags
|
||||
/*
|
||||
Bits for MSync_Flags
|
||||
*/
|
||||
MSync_Flags_Bits :: enum {
|
||||
ASYNC = 0,
|
||||
INVALIDATE = 1,
|
||||
SYNC = 2,
|
||||
}
|
||||
|
||||
/// Argument for madvice.2
|
||||
/*
|
||||
Argument for madvice(2)
|
||||
*/
|
||||
MAdvice :: enum {
|
||||
NORMAL = 0,
|
||||
RANDOM = 1,
|
||||
@@ -545,27 +586,35 @@ MAdvice :: enum {
|
||||
SOFT_OFFLINE = 101,
|
||||
}
|
||||
|
||||
/// Bits for PKey_Access_Rights
|
||||
/*
|
||||
Bits for PKey_Access_Rights
|
||||
*/
|
||||
PKey_Access_Bits :: enum {
|
||||
DISABLE_ACCESS = 0,
|
||||
DISABLE_WRITE = 2,
|
||||
}
|
||||
|
||||
/// Bits for MRemap_Flags
|
||||
/*
|
||||
Bits for MRemap_Flags
|
||||
*/
|
||||
MRemap_Flags_Bits :: enum {
|
||||
MAYMOVE = 0,
|
||||
FIXED = 1,
|
||||
DONTUNMAP = 2,
|
||||
}
|
||||
|
||||
/// Bits for Get_Random_Flags
|
||||
/*
|
||||
Bits for Get_Random_Flags
|
||||
*/
|
||||
Get_Random_Flags_Bits :: enum {
|
||||
RANDOM = 0,
|
||||
NONBLOCK = 1,
|
||||
INSECURE = 2,
|
||||
}
|
||||
|
||||
/// Bits for Perf_Flags
|
||||
/*
|
||||
Bits for Perf_Flags
|
||||
*/
|
||||
Perf_Flags_Bits :: enum {
|
||||
FD_NO_GROUP = 0,
|
||||
FD_OUTPUT = 1,
|
||||
@@ -573,7 +622,9 @@ Perf_Flags_Bits :: enum {
|
||||
FD_CLOEXEC = 3,
|
||||
}
|
||||
|
||||
/// Union tag for Perf_Event_Attr struct
|
||||
/*
|
||||
Union tag for Perf_Event_Attr struct
|
||||
*/
|
||||
Perf_Event_Type :: enum u32 {
|
||||
HARDWARE = 0,
|
||||
SOFTWARE = 1,
|
||||
@@ -633,7 +684,9 @@ Perf_Cap_Flags_Bits :: enum u64 {
|
||||
User_Time_Short = 5,
|
||||
}
|
||||
|
||||
/// Specifies the type of the hardware event that you want to get info about
|
||||
/*
|
||||
Specifies the type of the hardware event that you want to get info about
|
||||
*/
|
||||
Perf_Hardware_Id :: enum u64 {
|
||||
CPU_CYCLES = 0,
|
||||
INSTRUCTIONS = 1,
|
||||
@@ -647,7 +700,9 @@ Perf_Hardware_Id :: enum u64 {
|
||||
REF_CPU_CYCLES = 9,
|
||||
}
|
||||
|
||||
/// Specifies the cache for the particular cache event that you want to get info about
|
||||
/*
|
||||
Specifies the cache for the particular cache event that you want to get info about
|
||||
*/
|
||||
Perf_Hardware_Cache_Id :: enum u64 {
|
||||
L1D = 0,
|
||||
L1I = 1,
|
||||
@@ -658,20 +713,26 @@ Perf_Hardware_Cache_Id :: enum u64 {
|
||||
NODE = 6,
|
||||
}
|
||||
|
||||
/// Specifies the cache op that you want to get info about
|
||||
/*
|
||||
Specifies the cache op that you want to get info about
|
||||
*/
|
||||
Perf_Hardware_Cache_Op_Id :: enum u64 {
|
||||
READ = 0,
|
||||
WRITE = 1,
|
||||
PREFETCH = 2,
|
||||
}
|
||||
|
||||
/// Specifies the cache operation result that you want to get info about
|
||||
/*
|
||||
Specifies the cache operation result that you want to get info about
|
||||
*/
|
||||
Perf_Hardware_Cache_Result_Id :: enum u64 {
|
||||
ACCESS = 0,
|
||||
MISS = 1,
|
||||
}
|
||||
|
||||
/// Specifies the particular software event that you want to get info about
|
||||
/*
|
||||
Specifies the particular software event that you want to get info about
|
||||
*/
|
||||
Perf_Software_Id :: enum u64 {
|
||||
CPU_CLOCK = 0,
|
||||
TASK_CLOCK = 1,
|
||||
@@ -688,7 +749,9 @@ Perf_Software_Id :: enum u64 {
|
||||
|
||||
}
|
||||
|
||||
/// Specifies which values to include in the sample
|
||||
/*
|
||||
Specifies which values to include in the sample
|
||||
*/
|
||||
Perf_Event_Sample_Type_Bits :: enum {
|
||||
IP = 0,
|
||||
TID = 1,
|
||||
@@ -726,7 +789,9 @@ Perf_Read_Format_Bits :: enum {
|
||||
LOST = 4,
|
||||
}
|
||||
|
||||
/// Chooses the breakpoint type
|
||||
/*
|
||||
Chooses the breakpoint type
|
||||
*/
|
||||
Hardware_Breakpoint_Type :: enum u32 {
|
||||
EMPTY = 0,
|
||||
R = 1,
|
||||
@@ -736,7 +801,9 @@ Hardware_Breakpoint_Type :: enum u32 {
|
||||
INVALID = RW | X,
|
||||
}
|
||||
|
||||
/// Bits for Branch_Sample_Type
|
||||
/*
|
||||
Bits for Branch_Sample_Type
|
||||
*/
|
||||
Branch_Sample_Type_Bits :: enum {
|
||||
USER = 0,
|
||||
KERNEL = 1,
|
||||
@@ -759,7 +826,9 @@ Branch_Sample_Type_Bits :: enum {
|
||||
PRIV_SAVE = 18,
|
||||
}
|
||||
|
||||
/// Represent the type of Id
|
||||
/*
|
||||
Represent the type of Id
|
||||
*/
|
||||
Id_Type :: enum uint {
|
||||
ALL = 0,
|
||||
PID = 1,
|
||||
@@ -767,7 +836,9 @@ Id_Type :: enum uint {
|
||||
PIDFD = 3,
|
||||
}
|
||||
|
||||
/// Options for wait syscalls
|
||||
/*
|
||||
Options for wait syscalls
|
||||
*/
|
||||
Wait_Option :: enum {
|
||||
WNOHANG = 0,
|
||||
WUNTRACED = 1,
|
||||
@@ -781,12 +852,16 @@ Wait_Option :: enum {
|
||||
__WCLONE = 31,
|
||||
}
|
||||
|
||||
/// Bits for flags for pidfd
|
||||
/*
|
||||
Bits for flags for pidfd
|
||||
*/
|
||||
Pid_FD_Flags_Bits :: enum {
|
||||
NONBLOCK = 11,
|
||||
}
|
||||
|
||||
/// Priority for process, process group, user
|
||||
/*
|
||||
Priority for process, process group, user
|
||||
*/
|
||||
Priority_Which :: enum i32 {
|
||||
PROCESS = 0,
|
||||
PGRP = 1,
|
||||
@@ -849,10 +924,12 @@ Sig_Stack_Flag :: enum i32 {
|
||||
AUTODISARM = 31,
|
||||
}
|
||||
|
||||
/// Type of socket to create
|
||||
/// For TCP you want to use SOCK_STREAM
|
||||
/// For UDP you want to use SOCK_DGRAM
|
||||
/// Also see Protocol
|
||||
/*
|
||||
Type of socket to create
|
||||
- For TCP you want to use SOCK_STREAM
|
||||
- For UDP you want to use SOCK_DGRAM
|
||||
Also see `Protocol`
|
||||
*/
|
||||
Socket_Type :: enum {
|
||||
STREAM = 1,
|
||||
DGRAM = 2,
|
||||
@@ -863,13 +940,17 @@ Socket_Type :: enum {
|
||||
PACKET = 10,
|
||||
}
|
||||
|
||||
/// Bits for Socket_FD_Flags
|
||||
/*
|
||||
Bits for Socket_FD_Flags
|
||||
*/
|
||||
Socket_FD_Flags_Bits :: enum {
|
||||
NONBLOCK = 14,
|
||||
CLOEXEC = 25,
|
||||
}
|
||||
|
||||
/// Protocol family
|
||||
/*
|
||||
Protocol family
|
||||
*/
|
||||
Protocol_Family :: enum u16 {
|
||||
UNSPEC = 0,
|
||||
LOCAL = 1,
|
||||
@@ -922,11 +1003,13 @@ Protocol_Family :: enum u16 {
|
||||
MCTP = 45,
|
||||
}
|
||||
|
||||
/// The protocol number according to IANA protocol number list
|
||||
/// Full list of protocol numbers:
|
||||
/// https://www.iana.org/assignments/protocol-numbers/protocol-numbers.xhtml
|
||||
/// Supported by the OS protocols can be queried by reading:
|
||||
/// /etc/protocols
|
||||
/*
|
||||
The protocol number according to IANA protocol number list
|
||||
Full list of protocol numbers:
|
||||
https://www.iana.org/assignments/protocol-numbers/protocol-numbers.xhtml
|
||||
Supported by the OS protocols can be queried by reading:
|
||||
/etc/protocols
|
||||
*/
|
||||
Protocol :: enum {
|
||||
HOPOPT = 0,
|
||||
ICMP = 1,
|
||||
@@ -1066,7 +1149,9 @@ Protocol :: enum {
|
||||
Reserved = 255,
|
||||
}
|
||||
|
||||
/// API Level for get/setsockopt.2
|
||||
/*
|
||||
API Level for getsockopt(2)/setsockopt(2)
|
||||
*/
|
||||
Socket_API_Level :: enum {
|
||||
// Comes from <bits/socket-constants.h>
|
||||
SOCKET = 1,
|
||||
@@ -1103,8 +1188,10 @@ Socket_API_Level :: enum {
|
||||
SMC = 286,
|
||||
}
|
||||
|
||||
/// If Socket_API_Level == .SOCKET, these are the options
|
||||
/// you can specify in get/setsockopt.2
|
||||
/*
|
||||
If Socket_API_Level == .SOCKET, these are the options
|
||||
you can specify in getsockopt(2)/setsockopt(2)
|
||||
*/
|
||||
Socket_Option :: enum {
|
||||
DEBUG = 1,
|
||||
REUSEADDR = 2,
|
||||
@@ -1249,7 +1336,9 @@ Socket_TCP_Option :: enum {
|
||||
TX_DELAY = 37,
|
||||
}
|
||||
|
||||
/// Bits for Socket_Msg
|
||||
/*
|
||||
Bits for Socket_Msg
|
||||
*/
|
||||
Socket_Msg_Bits :: enum {
|
||||
OOB = 0,
|
||||
PEEK = 1,
|
||||
@@ -1275,14 +1364,18 @@ Socket_Msg_Bits :: enum {
|
||||
CMSG_CLOEXEC = 30,
|
||||
}
|
||||
|
||||
/// Argument to shutdown.2
|
||||
/*
|
||||
Argument to shutdown(2)
|
||||
*/
|
||||
Shutdown_How :: enum i32 {
|
||||
RD = 0,
|
||||
WR = 1,
|
||||
RDWR = 2,
|
||||
}
|
||||
|
||||
/// Second argument to futex.2 syscall
|
||||
/*
|
||||
Second argument to futex(2) syscall
|
||||
*/
|
||||
Futex_Op :: enum u32 {
|
||||
WAIT = 0,
|
||||
WAKE = 1,
|
||||
@@ -1300,13 +1393,17 @@ Futex_Op :: enum u32 {
|
||||
LOCK_PI2 = 13,
|
||||
}
|
||||
|
||||
/// Bits for Futex_Flags
|
||||
/*
|
||||
Bits for Futex_Flags
|
||||
*/
|
||||
Futex_Flags_Bits :: enum {
|
||||
PRIVATE = 7,
|
||||
REALTIME = 8,
|
||||
}
|
||||
|
||||
/// Kind of operation on futex, see FUTEX_WAKE_OP
|
||||
/*
|
||||
Kind of operation on futex, see FUTEX_WAKE_OP
|
||||
*/
|
||||
Futex_Arg_Op :: enum {
|
||||
SET = 0, /* uaddr2 = oparg; */
|
||||
ADD = 1, /* uaddr2 += oparg; */
|
||||
@@ -1320,7 +1417,9 @@ Futex_Arg_Op :: enum {
|
||||
PO2_XOR = 4, /* uaddr2 ^= 1<<oparg; */
|
||||
}
|
||||
|
||||
/// Kind of comparison operation on futex, see FUTEX_WAKE_OP
|
||||
/*
|
||||
Kind of comparison operation on futex, see FUTEX_WAKE_OP
|
||||
*/
|
||||
Futex_Cmp_Op :: enum {
|
||||
EQ = 0, /* if (oldval == cmparg) wake */
|
||||
NE = 1, /* if (oldval != cmparg) wake */
|
||||
@@ -1330,7 +1429,9 @@ Futex_Cmp_Op :: enum {
|
||||
GE = 5, /* if (oldval >= cmparg) wake */
|
||||
}
|
||||
|
||||
/// The kind of resource limits
|
||||
/*
|
||||
The kind of resource limits
|
||||
*/
|
||||
RLimit_Kind :: enum i32 {
|
||||
CPU = 0,
|
||||
FSIZE = 1,
|
||||
@@ -1351,7 +1452,9 @@ RLimit_Kind :: enum i32 {
|
||||
NLIMITS = 16,
|
||||
}
|
||||
|
||||
/// Represents the user of resources
|
||||
/*
|
||||
Represents the user of resources
|
||||
*/
|
||||
RUsage_Who :: enum i32 {
|
||||
CHILDREN = -1,
|
||||
SELF = 0,
|
||||
@@ -1359,7 +1462,9 @@ RUsage_Who :: enum i32 {
|
||||
LWP = THREAD,
|
||||
}
|
||||
|
||||
/// Bits for Personality_Flags
|
||||
/*
|
||||
Bits for Personality_Flags
|
||||
*/
|
||||
UNAME26 :: 17
|
||||
ADDR_NO_RANDOMIZE :: 18
|
||||
FDPIC_FUNCPTRS :: 19
|
||||
@@ -1372,8 +1477,10 @@ WHOLE_SECONDS :: 25
|
||||
STICKY_TIMEOUTS :: 26
|
||||
ADDR_LIMIT_3GB :: 27
|
||||
|
||||
/// Personality type
|
||||
/// These go into the bottom 8 bits of the personality value
|
||||
/*
|
||||
Personality type
|
||||
These go into the bottom 8 bits of the personality value
|
||||
*/
|
||||
PER_LINUX :: 0x0000
|
||||
PER_LINUX_32BIT :: 0x0000 | ADDR_LIMIT_32BIT
|
||||
PER_LINUX_FDPIC :: 0x0000 | FDPIC_FUNCPTRS
|
||||
@@ -1398,3 +1505,254 @@ PER_OSF4 :: 0x000f
|
||||
PER_HPUX :: 0x0010
|
||||
PER_MASK :: 0x00ff
|
||||
|
||||
/*
|
||||
Bits for access modes for shared memory
|
||||
*/
|
||||
IPC_Mode_Bits :: enum {
|
||||
WROTH = 1,
|
||||
RDOTH = 2,
|
||||
WRGRP = 4,
|
||||
RDGRP = 5,
|
||||
WRUSR = 7,
|
||||
RDUSR = 8,
|
||||
DEST = 9,
|
||||
LOCKED = 10,
|
||||
}
|
||||
|
||||
/*
|
||||
Shared memory flags bits
|
||||
*/
|
||||
IPC_Flags_Bits :: enum {
|
||||
IPC_CREAT = 9,
|
||||
IPC_EXCL = 10,
|
||||
IPC_NOWAIT = 11,
|
||||
// Semaphore
|
||||
SEM_UNDO = 9,
|
||||
// Shared memory
|
||||
SHM_HUGETLB = 11,
|
||||
SHM_NORESERVE = 12,
|
||||
SHM_RDONLY = 12,
|
||||
SHM_RND = 13,
|
||||
SHM_REMAP = 14,
|
||||
SHM_EXEC = 15,
|
||||
// Message queue
|
||||
MSG_NOERROR = 12,
|
||||
MSG_EXCEPT = 13,
|
||||
MSG_COPY = 14,
|
||||
}
|
||||
|
||||
/*
|
||||
IPC memory commands
|
||||
*/
|
||||
IPC_Cmd :: enum i16 {
|
||||
// IPC common
|
||||
IPC_RMID = 0,
|
||||
IPC_SET = 1,
|
||||
IPC_STAT = 2,
|
||||
// Shared memory
|
||||
SHM_LOCK = 11,
|
||||
SHM_UNLOCK = 12,
|
||||
SHM_STAT = 13,
|
||||
SHM_INFO = 14,
|
||||
SHM_STAT_ANY = 15,
|
||||
// Semaphore
|
||||
GETPID = 11,
|
||||
GETVAL = 12,
|
||||
GETALL = 13,
|
||||
GETNCNT = 14,
|
||||
GETZCNT = 15,
|
||||
SETVAL = 16,
|
||||
SETALL = 17,
|
||||
SEM_STAT = 18,
|
||||
SEM_INFO = 19,
|
||||
SEM_STAT_ANY = 20,
|
||||
// Message queue
|
||||
MSG_STAT = 11,
|
||||
MSG_INFO = 12,
|
||||
MSG_STAT_ANY = 13,
|
||||
}
|
||||
|
||||
/*
|
||||
File locking operation bits
|
||||
*/
|
||||
FLock_Op_Bits :: enum {
|
||||
SH = 1,
|
||||
EX = 2,
|
||||
NB = 4,
|
||||
UN = 8,
|
||||
}
|
||||
|
||||
/*
|
||||
ptrace requests
|
||||
*/
|
||||
PTrace_Request :: enum {
|
||||
TRACEME = 0,
|
||||
PEEKTEXT = 1,
|
||||
PEEKDATA = 2,
|
||||
PEEKUSER = 3,
|
||||
POKETEXT = 4,
|
||||
POKEDATA = 5,
|
||||
POKEUSER = 6,
|
||||
CONT = 7,
|
||||
KILL = 8,
|
||||
SINGLESTEP = 9,
|
||||
GETREGS = 12,
|
||||
SETREGS = 13,
|
||||
GETFPREGS = 14,
|
||||
SETFPREGS = 15,
|
||||
ATTACH = 16,
|
||||
DETACH = 17,
|
||||
GETFPXREGS = 18,
|
||||
SETFPXREGS = 19,
|
||||
SYSCALL = 24,
|
||||
GET_THREAD_AREA = 25,
|
||||
SET_THREAD_AREA = 26,
|
||||
ARCH_PRCTL = 30,
|
||||
SYSEMU = 31,
|
||||
SYSEMU_SINGLESTEP = 32,
|
||||
SINGLEBLOCK = 33,
|
||||
SETOPTIONS = 0x4200,
|
||||
GETEVENTMSG = 0x4201,
|
||||
GETSIGINFO = 0x4202,
|
||||
SETSIGINFO = 0x4203,
|
||||
GETREGSET = 0x4204,
|
||||
SETREGSET = 0x4205,
|
||||
SEIZE = 0x4206,
|
||||
INTERRUPT = 0x4207,
|
||||
LISTEN = 0x4208,
|
||||
PEEKSIGINFO = 0x4209,
|
||||
GETSIGMASK = 0x420a,
|
||||
SETSIGMASK = 0x420b,
|
||||
SECCOMP_GET_FILTER = 0x420c,
|
||||
SECCOMP_GET_METADATA = 0x420d,
|
||||
GET_SYSCALL_INFO = 0x420e,
|
||||
GET_RSEQ_CONFIGURATION = 0x420f,
|
||||
}
|
||||
|
||||
/*
|
||||
ptrace options
|
||||
*/
|
||||
PTrace_Options_Bits :: enum {
|
||||
TRACESYSGOOD = 0,
|
||||
TRACEFORK = 1,
|
||||
TRACEVFORK = 2,
|
||||
TRACECLONE = 3,
|
||||
TRACEEXEC = 4,
|
||||
TRACEVFORKDONE = 5,
|
||||
TRACEEXIT = 6,
|
||||
TRACESECCOMP = 7,
|
||||
EXITKILL = 20,
|
||||
SUSPEND_SECCOMP = 21,
|
||||
}
|
||||
|
||||
/*
|
||||
ptrace event codes.
|
||||
*/
|
||||
PTrace_Event_Code :: enum {
|
||||
EVENT_FORK = 1,
|
||||
EVENT_VFORK = 2,
|
||||
EVENT_CLONE = 3,
|
||||
EVENT_EXEC = 4,
|
||||
EVENT_VFORK_DONE = 5,
|
||||
EVENT_EXIT = 6,
|
||||
EVENT_SECCOMP = 7,
|
||||
EVENT_STOP = 128,
|
||||
}
|
||||
|
||||
/*
|
||||
ptrace's get syscall info operation.
|
||||
*/
|
||||
PTrace_Get_Syscall_Info_Op :: enum u8 {
|
||||
NONE = 0,
|
||||
ENTRY = 1,
|
||||
EXIT = 2,
|
||||
SECCOMP = 3,
|
||||
}
|
||||
|
||||
/*
|
||||
ptrace's PEEKSIGINFO flags bits
|
||||
*/
|
||||
PTrace_Peek_Sig_Info_Flags_Bits :: enum {
|
||||
SHARED = 0,
|
||||
}
|
||||
|
||||
/*
|
||||
Syslog actions.
|
||||
*/
|
||||
Syslog_Action :: enum i32 {
|
||||
CLOSE = 0,
|
||||
OPEN = 1,
|
||||
READ = 2,
|
||||
READ_ALL = 3,
|
||||
READ_CLEAR = 4,
|
||||
CLEAR = 5,
|
||||
CONSOLE_OFF = 6,
|
||||
CONSOLE_ON = 7,
|
||||
CONSOLE_LEVEL = 8,
|
||||
SIZE_UNREAD = 9,
|
||||
SIZE_BUFFER = 10,
|
||||
}
|
||||
|
||||
/*
|
||||
Bits for splice flags.
|
||||
*/
|
||||
Splice_Flags_Bits :: enum {
|
||||
MOVE = 0x01,
|
||||
NONBLOCK = 0x02,
|
||||
MORE = 0x04,
|
||||
GIFT = 0x08,
|
||||
}
|
||||
|
||||
/*
|
||||
Clock IDs for various system clocks.
|
||||
*/
|
||||
Clock_Id :: enum {
|
||||
REALTIME = 0,
|
||||
MONOTONIC = 1,
|
||||
PROCESS_CPUTIME_ID = 2,
|
||||
THREAD_CPUTIME_ID = 3,
|
||||
MONOTONIC_RAW = 4,
|
||||
REALTIME_COARSE = 5,
|
||||
MONOTONIC_COARSE = 6,
|
||||
BOOTTIME = 7,
|
||||
REALTIME_ALARM = 8,
|
||||
BOOTTIME_ALARM = 9,
|
||||
}
|
||||
|
||||
/*
|
||||
Bits for POSIX interval timer flags.
|
||||
*/
|
||||
ITimer_Flags_Bits :: enum {
|
||||
ABSTIME = 1,
|
||||
}
|
||||
|
||||
/*
|
||||
Bits for epoll_create(2) flags.
|
||||
*/
|
||||
EPoll_Flags_Bits :: enum {
|
||||
FDCLOEXEC = 19,
|
||||
}
|
||||
|
||||
EPoll_Event_Kind :: enum u32 {
|
||||
IN = 0x001,
|
||||
PRI = 0x002,
|
||||
OUT = 0x004,
|
||||
RDNORM = 0x040,
|
||||
RDBAND = 0x080,
|
||||
WRNORM = 0x100,
|
||||
WRBAND = 0x200,
|
||||
MSG = 0x400,
|
||||
ERR = 0x008,
|
||||
HUP = 0x010,
|
||||
RDHUP = 0x2000,
|
||||
EXCLUSIVE = 1<<28,
|
||||
WAKEUP = 1<<29,
|
||||
ONESHOT = 1<<30,
|
||||
ET = 1<<31,
|
||||
}
|
||||
|
||||
EPoll_Ctl_Opcode :: enum i32 {
|
||||
ADD = 1,
|
||||
DEL = 2,
|
||||
MOD = 3,
|
||||
}
|
||||
|
||||
+166
-29
@@ -1,26 +1,40 @@
|
||||
|
||||
package linux
|
||||
|
||||
/// Special file descriptor to pass to `*at` functions to specify
|
||||
/// that relative paths are relative to current directory
|
||||
/*
|
||||
Special file descriptor to pass to `*at` functions to specify
|
||||
that relative paths are relative to current directory.
|
||||
*/
|
||||
AT_FDCWD :: Fd(-100)
|
||||
|
||||
/// Special value to put into timespec for utimensat() to set timestamp to the current time
|
||||
/*
|
||||
Special value to put into timespec for utimensat() to set timestamp to the current time.
|
||||
*/
|
||||
UTIME_NOW :: uint((1 << 30) - 1)
|
||||
|
||||
/// Special value to put into the timespec for utimensat() to leave the corresponding field of the timestamp unchanged
|
||||
/*
|
||||
Special value to put into the timespec for utimensat() to leave the corresponding field of the timestamp unchanged.
|
||||
*/
|
||||
UTIME_OMIT :: uint((1 << 30) - 2)
|
||||
|
||||
/// For wait4: Pass this pid to wait for any process
|
||||
/*
|
||||
For wait4: Pass this pid to wait for any process.
|
||||
*/
|
||||
WAIT_ANY :: Pid(-1)
|
||||
|
||||
/// For wait4: Pass this pid to wait for any process in current process group
|
||||
/*
|
||||
For wait4: Pass this pid to wait for any process in current process group.
|
||||
*/
|
||||
WAIT_MYPGRP :: Pid(0)
|
||||
|
||||
/// Maximum priority (aka nice value) for the process
|
||||
/*
|
||||
Maximum priority (aka nice value) for the process.
|
||||
*/
|
||||
PRIO_MAX :: 20
|
||||
|
||||
/// Minimum priority (aka nice value) for the process
|
||||
/*
|
||||
Minimum priority (aka nice value) for the process.
|
||||
*/
|
||||
PRIO_MIN :: -20
|
||||
|
||||
SIGRTMIN :: Signal(32)
|
||||
@@ -35,40 +49,64 @@ S_IFCHR :: Mode{.IFCHR}
|
||||
S_IFDIR :: Mode{.IFDIR}
|
||||
S_IFREG :: Mode{.IFREG}
|
||||
|
||||
/// Checks the Mode bits to see if the file is a named pipe (FIFO)
|
||||
/*
|
||||
Checks the Mode bits to see if the file is a named pipe (FIFO).
|
||||
*/
|
||||
S_ISFIFO :: #force_inline proc "contextless" (m: Mode) -> bool {return (S_IFFIFO == (m & S_IFMT))}
|
||||
|
||||
/// Check the Mode bits to see if the file is a character device
|
||||
/*
|
||||
Check the Mode bits to see if the file is a character device.
|
||||
*/
|
||||
S_ISCHR :: #force_inline proc "contextless" (m: Mode) -> bool {return (S_IFCHR == (m & S_IFMT))}
|
||||
|
||||
/// Check the Mode bits to see if the file is a directory
|
||||
|
||||
/*
|
||||
Check the Mode bits to see if the file is a directory.
|
||||
*/
|
||||
S_ISDIR :: #force_inline proc "contextless" (m: Mode) -> bool {return (S_IFDIR == (m & S_IFMT))}
|
||||
|
||||
/// Check the Mode bits to see if the file is a register
|
||||
/*
|
||||
Check the Mode bits to see if the file is a register.
|
||||
*/
|
||||
S_ISREG :: #force_inline proc "contextless" (m: Mode) -> bool {return (S_IFREG == (m & S_IFMT))}
|
||||
|
||||
/// Check the Mode bits to see if the file is a socket
|
||||
/*
|
||||
Check the Mode bits to see if the file is a socket.
|
||||
*/
|
||||
S_ISSOCK :: #force_inline proc "contextless" (m: Mode) -> bool {return (S_IFSOCK == (m & S_IFMT))}
|
||||
|
||||
/// Check the Mode bits to see if the file is a symlink
|
||||
/*
|
||||
Check the Mode bits to see if the file is a symlink.
|
||||
*/
|
||||
S_ISLNK :: #force_inline proc "contextless" (m: Mode) -> bool {return (S_IFLNK == (m & S_IFMT))}
|
||||
|
||||
/// Check the Mode bits to see if the file is a block device
|
||||
/*
|
||||
Check the Mode bits to see if the file is a block device.
|
||||
*/
|
||||
S_ISBLK :: #force_inline proc "contextless" (m: Mode) -> bool {return (S_IFBLK == (m & S_IFMT))}
|
||||
|
||||
/// For access.2 syscall family: instruct to check if the file exists
|
||||
/*
|
||||
For access.2 syscall family: instruct to check if the file exists.
|
||||
*/
|
||||
F_OK :: Mode{}
|
||||
|
||||
/// For access.2 syscall family: instruct to check if the file is executable
|
||||
/*
|
||||
For access.2 syscall family: instruct to check if the file is executable.
|
||||
*/
|
||||
X_OK :: Mode{.IXOTH}
|
||||
|
||||
/// For access.2 syscall family: instruct to check if the file is writeable
|
||||
/*
|
||||
For access.2 syscall family: instruct to check if the file is writeable.
|
||||
*/
|
||||
W_OK :: Mode{.IWOTH}
|
||||
|
||||
/// For access.2 syscall family: instruct to check if the file is readable
|
||||
/*
|
||||
For access.2 syscall family: instruct to check if the file is readable.
|
||||
*/
|
||||
R_OK :: Mode{.IROTH}
|
||||
|
||||
/// The stats you get by calling `stat`
|
||||
/*
|
||||
The stats you get by calling `stat`.
|
||||
*/
|
||||
STATX_BASIC_STATS :: Statx_Mask {
|
||||
.TYPE,
|
||||
.MODE,
|
||||
@@ -83,6 +121,10 @@ STATX_BASIC_STATS :: Statx_Mask {
|
||||
.BLOCKS,
|
||||
}
|
||||
|
||||
/*
|
||||
Tell `shmget` to create a new key
|
||||
*/
|
||||
IPC_PRIVATE :: Key(0)
|
||||
|
||||
FCntl_Command_DUPFD :: distinct FCntl_Command
|
||||
FCntl_Command_GETFD :: distinct FCntl_Command
|
||||
@@ -165,28 +207,44 @@ Futex_Wait_requeue_Pi_Type :: distinct Futex_Op
|
||||
Futex_Cmp_requeue_Pi_Type :: distinct Futex_Op
|
||||
Futex_Lock_Pi2_Type :: distinct Futex_Op
|
||||
|
||||
/// Wait on futex wakeup signal
|
||||
/*
|
||||
Wait on futex wakeup signal.
|
||||
*/
|
||||
FUTEX_WAIT :: Futex_Wait_Type(.WAIT)
|
||||
|
||||
/// Wake up other processes waiting on the futex
|
||||
/*
|
||||
Wake up other processes waiting on the futex.
|
||||
*/
|
||||
FUTEX_WAKE :: Futex_Wake_Type(.WAKE)
|
||||
|
||||
/// Not implemented. Basically, since
|
||||
/*
|
||||
Not implemented. Basically, since.
|
||||
*/
|
||||
FUTEX_FD :: Futex_Fd_Type(.FD)
|
||||
|
||||
/// Requeue waiters from one futex to another
|
||||
/*
|
||||
Requeue waiters from one futex to another.
|
||||
*/
|
||||
FUTEX_REQUEUE :: Futex_Requeue_Type(.REQUEUE)
|
||||
|
||||
/// Requeue waiters from one futex to another if the value at mutex matches
|
||||
/*
|
||||
Requeue waiters from one futex to another if the value at mutex matches.
|
||||
*/
|
||||
FUTEX_CMP_REQUEUE :: Futex_Cmp_Requeue_Type(.CMP_REQUEUE)
|
||||
|
||||
/// See man pages, I'm not describing it here
|
||||
/*
|
||||
See man pages, I'm not describing it here.
|
||||
*/
|
||||
FUTEX_WAKE_OP :: Futex_Wake_Op_Type(.WAKE_OP)
|
||||
|
||||
/// Wait on a futex, but the value is a bitset
|
||||
/*
|
||||
Wait on a futex, but the value is a bitset.
|
||||
*/
|
||||
FUTEX_WAIT_BITSET :: Futex_Wait_Bitset_Type(.WAIT_BITSET)
|
||||
|
||||
/// Wait on a futex, but the value is a bitset
|
||||
/*
|
||||
Wait on a futex, but the value is a bitset.
|
||||
*/
|
||||
FUTEX_WAKE_BITSET :: Futex_Wake_Bitset_Type(.WAKE_BITSET)
|
||||
|
||||
// TODO(flysand): Priority inversion futexes
|
||||
@@ -197,3 +255,82 @@ FUTEX_WAIT_REQUEUE_PI :: Futex_Wait_requeue_Pi_Type(.WAIT_REQUEUE_PI)
|
||||
FUTEX_CMP_REQUEUE_PI :: Futex_Cmp_requeue_Pi_Type(.CMP_REQUEUE_PI)
|
||||
FUTEX_LOCK_PI2 :: Futex_Lock_Pi2_Type(.LOCK_PI2)
|
||||
|
||||
PTrace_Traceme_Type :: distinct PTrace_Request
|
||||
PTrace_Peek_Type :: distinct PTrace_Request
|
||||
PTrace_Poke_Type :: distinct PTrace_Request
|
||||
PTrace_Cont_Type :: distinct PTrace_Request
|
||||
PTrace_Kill_Type :: distinct PTrace_Request
|
||||
PTrace_Singlestep_Type :: distinct PTrace_Request
|
||||
PTrace_Getregs_Type :: distinct PTrace_Request
|
||||
PTrace_Setregs_Type :: distinct PTrace_Request
|
||||
PTrace_Getfpregs_Type :: distinct PTrace_Request
|
||||
PTrace_Setfpregs_Type :: distinct PTrace_Request
|
||||
PTrace_Attach_Type :: distinct PTrace_Request
|
||||
PTrace_Detach_Type :: distinct PTrace_Request
|
||||
PTrace_Getfpxregs_Type :: distinct PTrace_Request
|
||||
PTrace_Setfpxregs_Type :: distinct PTrace_Request
|
||||
PTrace_Syscall_Type :: distinct PTrace_Request
|
||||
PTrace_Get_Thread_Area_Type :: distinct PTrace_Request
|
||||
PTrace_Set_Thread_Area_Type :: distinct PTrace_Request
|
||||
PTrace_Arch_Prctl_Type :: distinct PTrace_Request
|
||||
PTrace_Sysemu_Type :: distinct PTrace_Request
|
||||
PTrace_Sysemu_Singlestep_Type :: distinct PTrace_Request
|
||||
PTrace_Singleblock_Type :: distinct PTrace_Request
|
||||
PTrace_Setoptions_Type :: distinct PTrace_Request
|
||||
PTrace_Geteventmsg_Type :: distinct PTrace_Request
|
||||
PTrace_Getsiginfo_Type :: distinct PTrace_Request
|
||||
PTrace_Setsiginfo_Type :: distinct PTrace_Request
|
||||
PTrace_Getregset_Type :: distinct PTrace_Request
|
||||
PTrace_Setregset_Type :: distinct PTrace_Request
|
||||
PTrace_Seize_Type :: distinct PTrace_Request
|
||||
PTrace_Interrupt_Type :: distinct PTrace_Request
|
||||
PTrace_Listen_Type :: distinct PTrace_Request
|
||||
PTrace_Peeksiginfo_Type :: distinct PTrace_Request
|
||||
PTrace_Getsigmask_Type :: distinct PTrace_Request
|
||||
PTrace_Setsigmask_Type :: distinct PTrace_Request
|
||||
PTrace_Seccomp_Get_Filter_Type :: distinct PTrace_Request
|
||||
PTrace_Seccomp_Get_Metadata_Type :: distinct PTrace_Request
|
||||
PTrace_Get_Syscall_Info_Type :: distinct PTrace_Request
|
||||
PTrace_Get_RSeq_Configuration_Type :: distinct PTrace_Request
|
||||
|
||||
PTRACE_TRACEME :: PTrace_Traceme_Type(.TRACEME)
|
||||
PTRACE_PEEKTEXT :: PTrace_Peek_Type(.PEEKTEXT)
|
||||
PTRACE_PEEKDATA :: PTrace_Peek_Type(.PEEKDATA)
|
||||
PTRACE_PEEKUSER :: PTrace_Peek_Type(.PEEKUSER)
|
||||
PTRACE_POKETEXT :: PTrace_Poke_Type(.POKETEXT)
|
||||
PTRACE_POKEDATA :: PTrace_Poke_Type(.POKEDATA)
|
||||
PTRACE_POKEUSER :: PTrace_Poke_Type(.POKEUSER)
|
||||
PTRACE_CONT :: PTrace_Cont_Type(.CONT)
|
||||
PTRACE_KILL :: PTrace_Kill_Type(.KILL)
|
||||
PTRACE_SINGLESTEP :: PTrace_Singlestep_Type(.SINGLESTEP)
|
||||
PTRACE_GETREGS :: PTrace_Getregs_Type(.GETREGS)
|
||||
PTRACE_SETREGS :: PTrace_Setregs_Type(.SETREGS)
|
||||
PTRACE_GETFPREGS :: PTrace_Getfpregs_Type(.GETFPREGS)
|
||||
PTRACE_SETFPREGS :: PTrace_Setfpregs_Type(.SETFPREGS)
|
||||
PTRACE_ATTACH :: PTrace_Attach_Type(.ATTACH)
|
||||
PTRACE_DETACH :: PTrace_Detach_Type(.DETACH)
|
||||
PTRACE_GETFPXREGS :: PTrace_Getfpxregs_Type(.GETFPXREGS)
|
||||
PTRACE_SETFPXREGS :: PTrace_Setfpxregs_Type(.SETFPXREGS)
|
||||
PTRACE_SYSCALL :: PTrace_Syscall_Type(.SYSCALL)
|
||||
PTRACE_GET_THREAD_AREA :: PTrace_Get_Thread_Area_Type(.GET_THREAD_AREA)
|
||||
PTRACE_SET_THREAD_AREA :: PTrace_Set_Thread_Area_Type(.SET_THREAD_AREA)
|
||||
PTRACE_ARCH_PRCTL :: PTrace_Arch_Prctl_Type(.ARCH_PRCTL)
|
||||
PTRACE_SYSEMU :: PTrace_Sysemu_Type(.SYSEMU)
|
||||
PTRACE_SYSEMU_SINGLESTEP :: PTrace_Sysemu_Singlestep_Type(.SYSEMU_SINGLESTEP)
|
||||
PTRACE_SINGLEBLOCK :: PTrace_Singleblock_Type(.SINGLEBLOCK)
|
||||
PTRACE_SETOPTIONS :: PTrace_Setoptions_Type(.SETOPTIONS)
|
||||
PTRACE_GETEVENTMSG :: PTrace_Geteventmsg_Type(.GETEVENTMSG)
|
||||
PTRACE_GETSIGINFO :: PTrace_Getsiginfo_Type(.GETSIGINFO)
|
||||
PTRACE_SETSIGINFO :: PTrace_Setsiginfo_Type(.SETSIGINFO)
|
||||
PTRACE_GETREGSET :: PTrace_Getregset_Type(.GETREGSET)
|
||||
PTRACE_SETREGSET :: PTrace_Setregset_Type(.SETREGSET)
|
||||
PTRACE_SEIZE :: PTrace_Seize_Type(.SEIZE)
|
||||
PTRACE_INTERRUPT :: PTrace_Interrupt_Type(.INTERRUPT)
|
||||
PTRACE_LISTEN :: PTrace_Listen_Type(.LISTEN)
|
||||
PTRACE_PEEKSIGINFO :: PTrace_Peeksiginfo_Type(.PEEKSIGINFO)
|
||||
PTRACE_GETSIGMASK :: PTrace_Getsigmask_Type(.GETSIGMASK)
|
||||
PTRACE_SETSIGMASK :: PTrace_Setsigmask_Type(.SETSIGMASK)
|
||||
PTRACE_SECCOMP_GET_FILTER :: PTrace_Seccomp_Get_Filter_Type(.SECCOMP_GET_FILTER)
|
||||
PTRACE_SECCOMP_GET_METADATA :: PTrace_Seccomp_Get_Metadata_Type(.SECCOMP_GET_METADATA)
|
||||
PTRACE_GET_SYSCALL_INFO :: PTrace_Get_Syscall_Info_Type(.GET_SYSCALL_INFO)
|
||||
PTRACE_GET_RSEQ_CONFIGURATION :: PTrace_Get_RSeq_Configuration_Type(.GET_RSEQ_CONFIGURATION)
|
||||
|
||||
+1353
-451
File diff suppressed because it is too large
Load Diff
+746
-73
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -2,7 +2,7 @@ package xml_example
|
||||
|
||||
import "core:encoding/xml"
|
||||
import "core:os"
|
||||
import "core:path"
|
||||
import path "core:path/filepath"
|
||||
import "core:mem"
|
||||
import "core:strings"
|
||||
import "core:strconv"
|
||||
@@ -23,38 +23,38 @@ Entity :: struct {
|
||||
}
|
||||
|
||||
generate_encoding_entity_table :: proc() {
|
||||
using fmt
|
||||
|
||||
filename := path.join(ODIN_ROOT, "tests", "core", "assets", "XML", "unicode.xml")
|
||||
filename := path.join({ODIN_ROOT, "tests", "core", "assets", "XML", "unicode.xml"})
|
||||
defer delete(filename)
|
||||
|
||||
generated_filename := path.join(ODIN_ROOT, "core", "encoding", "entity", "generated.odin")
|
||||
generated_filename := path.join({ODIN_ROOT, "core", "encoding", "entity", "generated.odin"})
|
||||
defer delete(generated_filename)
|
||||
|
||||
doc, err := xml.parse(filename, OPTIONS, Error_Handler)
|
||||
doc, err := xml.load_from_file(filename, OPTIONS, Error_Handler)
|
||||
defer xml.destroy(doc)
|
||||
|
||||
if err != .None {
|
||||
printf("Load/Parse error: %v\n", err)
|
||||
fmt.printf("Load/Parse error: %v\n", err)
|
||||
if err == .File_Error {
|
||||
printf("\"%v\" not found. Did you run \"tests\\download_assets.py\"?", filename)
|
||||
fmt.printf("\"%v\" not found. Did you run \"tests\\download_assets.py\"?", filename)
|
||||
}
|
||||
os.exit(1)
|
||||
}
|
||||
|
||||
printf("\"%v\" loaded and parsed.\n", filename)
|
||||
fmt.printf("\"%v\" loaded and parsed.\n", filename)
|
||||
|
||||
generated_buf: strings.Builder
|
||||
defer strings.builder_destroy(&generated_buf)
|
||||
w := strings.to_writer(&generated_buf)
|
||||
|
||||
charlist, charlist_ok := xml.find_child_by_ident(doc.root, "charlist")
|
||||
charlist_id, charlist_ok := xml.find_child_by_ident(doc, 0, "charlist")
|
||||
if !charlist_ok {
|
||||
eprintln("Could not locate top-level `<charlist>` tag.")
|
||||
fmt.eprintln("Could not locate top-level `<charlist>` tag.")
|
||||
os.exit(1)
|
||||
}
|
||||
|
||||
printf("Found `<charlist>` with %v children.\n", len(charlist.children))
|
||||
charlist := doc.elements[charlist_id]
|
||||
|
||||
fmt.printf("Found `<charlist>` with %v children.\n", len(charlist.value))
|
||||
|
||||
entity_map: map[string]Entity
|
||||
names: [dynamic]string
|
||||
@@ -65,20 +65,26 @@ generate_encoding_entity_table :: proc() {
|
||||
longest_name: string
|
||||
|
||||
count := 0
|
||||
for char in charlist.children {
|
||||
for char_id in charlist.value {
|
||||
id := char_id.(xml.Element_ID)
|
||||
char := doc.elements[id]
|
||||
|
||||
if char.ident != "character" {
|
||||
eprintf("Expected `<character>`, got `<%v>`\n", char.ident)
|
||||
fmt.eprintf("Expected `<character>`, got `<%v>`\n", char.ident)
|
||||
os.exit(1)
|
||||
}
|
||||
|
||||
if codepoint_string, ok := xml.find_attribute_val_by_key(char, "dec"); !ok {
|
||||
eprintln("`<character id=\"...\">` attribute not found.")
|
||||
if codepoint_string, ok := xml.find_attribute_val_by_key(doc, id, "dec"); !ok {
|
||||
fmt.eprintln("`<character id=\"...\">` attribute not found.")
|
||||
os.exit(1)
|
||||
} else {
|
||||
codepoint := strconv.atoi(codepoint_string)
|
||||
|
||||
desc, desc_ok := xml.find_child_by_ident(char, "description")
|
||||
description := desc.value if desc_ok else ""
|
||||
desc, desc_ok := xml.find_child_by_ident(doc, id, "description")
|
||||
description := ""
|
||||
if len(doc.elements[desc].value) == 1 {
|
||||
description = doc.elements[desc].value[0].(string)
|
||||
}
|
||||
|
||||
/*
|
||||
For us to be interested in this codepoint, it has to have at least one entity.
|
||||
@@ -86,9 +92,9 @@ generate_encoding_entity_table :: proc() {
|
||||
|
||||
nth := 0
|
||||
for {
|
||||
character_entity := xml.find_child_by_ident(char, "entity", nth) or_break
|
||||
character_entity := xml.find_child_by_ident(doc, id, "entity", nth) or_break
|
||||
nth += 1
|
||||
name := xml.find_attribute_val_by_key(character_entity, "id") or_continue
|
||||
name := xml.find_attribute_val_by_key(doc, character_entity, "id") or_continue
|
||||
if len(name) == 0 {
|
||||
/*
|
||||
Invalid name. Skip.
|
||||
@@ -97,8 +103,8 @@ generate_encoding_entity_table :: proc() {
|
||||
}
|
||||
|
||||
if name == "\"\"" {
|
||||
printf("%#v\n", char)
|
||||
printf("%#v\n", character_entity)
|
||||
fmt.printf("%#v\n", char)
|
||||
fmt.printf("%#v\n", character_entity)
|
||||
}
|
||||
|
||||
if len(name) > max_name_length { longest_name = name }
|
||||
@@ -129,29 +135,27 @@ generate_encoding_entity_table :: proc() {
|
||||
*/
|
||||
slice.sort(names[:])
|
||||
|
||||
printf("Found %v unique `&name;` -> rune mappings.\n", count)
|
||||
printf("Shortest name: %v (%v)\n", shortest_name, min_name_length)
|
||||
printf("Longest name: %v (%v)\n", longest_name, max_name_length)
|
||||
|
||||
// println(rune_to_string(1234))
|
||||
fmt.printf("Found %v unique `&name;` -> rune mappings.\n", count)
|
||||
fmt.printf("Shortest name: %v (%v)\n", shortest_name, min_name_length)
|
||||
fmt.printf("Longest name: %v (%v)\n", longest_name, max_name_length)
|
||||
|
||||
/*
|
||||
Generate table.
|
||||
*/
|
||||
wprintln(w, "package unicode_entity")
|
||||
wprintln(w, "")
|
||||
wprintln(w, GENERATED)
|
||||
wprintln(w, "")
|
||||
wprintf (w, TABLE_FILE_PROLOG)
|
||||
wprintln(w, "")
|
||||
fmt.wprintln(w, "package unicode_entity")
|
||||
fmt.wprintln(w, "")
|
||||
fmt.wprintln(w, GENERATED)
|
||||
fmt.wprintln(w, "")
|
||||
fmt.wprintf (w, TABLE_FILE_PROLOG)
|
||||
fmt.wprintln(w, "")
|
||||
|
||||
wprintf (w, "// `&%v;`\n", shortest_name)
|
||||
wprintf (w, "XML_NAME_TO_RUNE_MIN_LENGTH :: %v\n", min_name_length)
|
||||
wprintf (w, "// `&%v;`\n", longest_name)
|
||||
wprintf (w, "XML_NAME_TO_RUNE_MAX_LENGTH :: %v\n", max_name_length)
|
||||
wprintln(w, "")
|
||||
fmt.wprintf (w, "// `&%v;`\n", shortest_name)
|
||||
fmt.wprintf (w, "XML_NAME_TO_RUNE_MIN_LENGTH :: %v\n", min_name_length)
|
||||
fmt.wprintf (w, "// `&%v;`\n", longest_name)
|
||||
fmt.wprintf (w, "XML_NAME_TO_RUNE_MAX_LENGTH :: %v\n", max_name_length)
|
||||
fmt.wprintln(w, "")
|
||||
|
||||
wprintln(w,
|
||||
fmt.wprintln(w,
|
||||
`
|
||||
/*
|
||||
Input:
|
||||
@@ -181,38 +185,41 @@ named_xml_entity_to_rune :: proc(name: string) -> (decoded: rune, ok: bool) {
|
||||
for v in names {
|
||||
if rune(v[0]) != prefix {
|
||||
if should_close {
|
||||
wprintln(w, "\t\t}\n")
|
||||
fmt.wprintln(w, "\t\t}\n")
|
||||
}
|
||||
|
||||
prefix = rune(v[0])
|
||||
wprintf (w, "\tcase '%v':\n", prefix)
|
||||
wprintln(w, "\t\tswitch name {")
|
||||
fmt.wprintf (w, "\tcase '%v':\n", prefix)
|
||||
fmt.wprintln(w, "\t\tswitch name {")
|
||||
}
|
||||
|
||||
e := entity_map[v]
|
||||
|
||||
wprintf(w, "\t\t\tcase \"%v\": \n", e.name)
|
||||
wprintf(w, "\t\t\t\t// %v\n", e.description)
|
||||
wprintf(w, "\t\t\t\treturn %v, true\n", rune_to_string(e.codepoint))
|
||||
fmt.wprintf(w, "\t\t\tcase \"%v\":", e.name)
|
||||
for i := len(e.name); i < max_name_length; i += 1 {
|
||||
fmt.wprintf(w, " ")
|
||||
}
|
||||
fmt.wprintf(w, " // %v\n", e.description)
|
||||
fmt.wprintf(w, "\t\t\t\treturn %v, true\n", rune_to_string(e.codepoint))
|
||||
|
||||
should_close = true
|
||||
}
|
||||
wprintln(w, "\t\t}")
|
||||
wprintln(w, "\t}")
|
||||
wprintln(w, "\treturn -1, false")
|
||||
wprintln(w, "}\n")
|
||||
wprintln(w, GENERATED)
|
||||
fmt.wprintln(w, "\t\t}")
|
||||
fmt.wprintln(w, "\t}")
|
||||
fmt.wprintln(w, "\treturn -1, false")
|
||||
fmt.wprintln(w, "}\n")
|
||||
fmt.wprintln(w, GENERATED)
|
||||
|
||||
println()
|
||||
println(strings.to_string(generated_buf))
|
||||
println()
|
||||
fmt.println()
|
||||
fmt.println(strings.to_string(generated_buf))
|
||||
fmt.println()
|
||||
|
||||
written := os.write_entire_file(generated_filename, transmute([]byte)strings.to_string(generated_buf))
|
||||
|
||||
if written {
|
||||
fmt.printf("Successfully written generated \"%v\".", generated_filename)
|
||||
fmt.printf("Successfully written generated \"%v\".\n", generated_filename)
|
||||
} else {
|
||||
fmt.printf("Failed to write generated \"%v\".", generated_filename)
|
||||
fmt.printf("Failed to write generated \"%v\".\n", generated_filename)
|
||||
}
|
||||
|
||||
delete(entity_map)
|
||||
@@ -227,7 +234,7 @@ GENERATED :: `/*
|
||||
*/`
|
||||
|
||||
TABLE_FILE_PROLOG :: `/*
|
||||
This file is generated from "https://www.w3.org/2003/entities/2007xml/unicode.xml".
|
||||
This file is generated from "https://github.com/w3c/xml-entities/blob/gh-pages/unicode.xml".
|
||||
|
||||
UPDATE:
|
||||
- Ensure the XML file was downloaded using "tests\core\download_assets.py".
|
||||
@@ -235,15 +242,21 @@ TABLE_FILE_PROLOG :: `/*
|
||||
|
||||
Odin unicode generated tables: https://github.com/odin-lang/Odin/tree/master/core/encoding/entity
|
||||
|
||||
Copyright © 2021 World Wide Web Consortium, (Massachusetts Institute of Technology,
|
||||
European Research Consortium for Informatics and Mathematics, Keio University, Beihang).
|
||||
Copyright David Carlisle 1999-2023
|
||||
|
||||
All Rights Reserved.
|
||||
Use and distribution of this code are permitted under the terms of the
|
||||
W3C Software Notice and License.
|
||||
http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231.html
|
||||
|
||||
This work is distributed under the W3C® Software License [1] in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
[1] http://www.w3.org/Consortium/Legal/copyright-software
|
||||
|
||||
This file is a collection of information about how to map
|
||||
Unicode entities to LaTeX, and various SGML/XML entity
|
||||
sets (ISO and MathML/HTML). A Unicode character may be mapped
|
||||
to several entities.
|
||||
|
||||
Originally designed by Sebastian Rahtz in conjunction with
|
||||
Barbara Beeton for the STIX project
|
||||
|
||||
See also: LICENSE_table.md
|
||||
*/
|
||||
@@ -265,8 +278,6 @@ is_dotted_name :: proc(name: string) -> (dotted: bool) {
|
||||
}
|
||||
|
||||
main :: proc() {
|
||||
using fmt
|
||||
|
||||
track: mem.Tracking_Allocator
|
||||
mem.tracking_allocator_init(&track, context.allocator)
|
||||
context.allocator = mem.tracking_allocator(&track)
|
||||
@@ -274,10 +285,10 @@ main :: proc() {
|
||||
generate_encoding_entity_table()
|
||||
|
||||
if len(track.allocation_map) > 0 {
|
||||
println()
|
||||
fmt.println()
|
||||
for _, v in track.allocation_map {
|
||||
printf("%v Leaked %v bytes.\n", v.location, v.size)
|
||||
fmt.printf("%v Leaked %v bytes.\n", v.location, v.size)
|
||||
}
|
||||
}
|
||||
println("Done and cleaned up!")
|
||||
fmt.println("Done and cleaned up!")
|
||||
}
|
||||
+17
-17
@@ -2070,33 +2070,33 @@ gb_internal bool check_procedure_type(CheckerContext *ctx, Type *type, Ast *proc
|
||||
type->Proc.diverging = pt->diverging;
|
||||
type->Proc.optional_ok = optional_ok;
|
||||
|
||||
if (param_count > 0) {
|
||||
Entity *end = params->Tuple.variables[param_count-1];
|
||||
if (end->flags&EntityFlag_CVarArg) {
|
||||
bool is_polymorphic = false;
|
||||
for (isize i = 0; i < param_count; i++) {
|
||||
Entity *e = params->Tuple.variables[i];
|
||||
|
||||
if (e->kind != Entity_Variable) {
|
||||
is_polymorphic = true;
|
||||
} else if (is_type_polymorphic(e->type)) {
|
||||
is_polymorphic = true;
|
||||
}
|
||||
|
||||
if (e->flags&EntityFlag_CVarArg) {
|
||||
if (i != param_count - 1) {
|
||||
error(e->token, "#c_vararg can only be applied to the last parameter");
|
||||
continue;
|
||||
}
|
||||
|
||||
switch (cc) {
|
||||
default:
|
||||
type->Proc.c_vararg = true;
|
||||
break;
|
||||
case ProcCC_Odin:
|
||||
case ProcCC_Contextless:
|
||||
error(end->token, "Calling convention does not support #c_vararg");
|
||||
error(e->token, "Calling convention does not support #c_vararg");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool is_polymorphic = false;
|
||||
for (isize i = 0; i < param_count; i++) {
|
||||
Entity *e = params->Tuple.variables[i];
|
||||
if (e->kind != Entity_Variable) {
|
||||
is_polymorphic = true;
|
||||
break;
|
||||
} else if (is_type_polymorphic(e->type)) {
|
||||
is_polymorphic = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (isize i = 0; i < result_count; i++) {
|
||||
Entity *e = results->Tuple.variables[i];
|
||||
if (e->kind != Entity_Variable) {
|
||||
|
||||
+23
-6
@@ -7,10 +7,19 @@ struct LinkerData {
|
||||
Array<String> output_temp_paths;
|
||||
String output_base;
|
||||
String output_name;
|
||||
#if defined(GB_SYSTEM_OSX)
|
||||
b8 needs_system_library_linked;
|
||||
#endif
|
||||
};
|
||||
|
||||
gb_internal i32 system_exec_command_line_app(char const *name, char const *fmt, ...);
|
||||
|
||||
#if defined(GB_SYSTEM_OSX)
|
||||
gb_internal void linker_enable_system_library_linking(LinkerData *ld) {
|
||||
ld->needs_system_library_linked = 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
gb_internal void linker_data_init(LinkerData *ld, CheckerInfo *info, String const &init_fullpath) {
|
||||
gbAllocator ha = heap_allocator();
|
||||
array_init(&ld->output_object_paths, ha);
|
||||
@@ -18,6 +27,10 @@ gb_internal void linker_data_init(LinkerData *ld, CheckerInfo *info, String cons
|
||||
array_init(&ld->foreign_libraries, ha, 0, 1024);
|
||||
ptr_set_init(&ld->foreign_libraries_set, 1024);
|
||||
|
||||
#if defined(GB_SYSTEM_OSX)
|
||||
ld->needs_system_library_linked = 0;
|
||||
#endif
|
||||
|
||||
if (build_context.out_filepath.len == 0) {
|
||||
ld->output_name = remove_directory_from_path(init_fullpath);
|
||||
ld->output_name = remove_extension_from_path(ld->output_name);
|
||||
@@ -195,7 +208,7 @@ gb_internal i32 linker_stage(LinkerData *gen) {
|
||||
|
||||
if (build_context.pdb_filepath != "") {
|
||||
String pdb_path = path_to_string(heap_allocator(), build_context.build_paths[BuildPath_PDB]);
|
||||
link_settings = gb_string_append_fmt(link_settings, " /PDB:%.*s", LIT(pdb_path));
|
||||
link_settings = gb_string_append_fmt(link_settings, " /PDB:\"%.*s\"", LIT(pdb_path));
|
||||
}
|
||||
|
||||
if (build_context.no_crt) {
|
||||
@@ -470,7 +483,15 @@ gb_internal i32 linker_stage(LinkerData *gen) {
|
||||
gbString platform_lib_str = gb_string_make(heap_allocator(), "");
|
||||
defer (gb_string_free(platform_lib_str));
|
||||
if (build_context.metrics.os == TargetOs_darwin) {
|
||||
platform_lib_str = gb_string_appendc(platform_lib_str, "-lSystem -lm -Wl,-syslibroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -L/usr/local/lib");
|
||||
platform_lib_str = gb_string_appendc(platform_lib_str, "-Wl,-syslibroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -L/usr/local/lib");
|
||||
#if defined(GB_SYSTEM_OSX)
|
||||
if(!build_context.no_crt) {
|
||||
platform_lib_str = gb_string_appendc(platform_lib_str, " -lm ");
|
||||
if(gen->needs_system_library_linked == 1) {
|
||||
platform_lib_str = gb_string_appendc(platform_lib_str, " -lSystem ");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
platform_lib_str = gb_string_appendc(platform_lib_str, "-lc -lm");
|
||||
}
|
||||
@@ -479,10 +500,6 @@ gb_internal i32 linker_stage(LinkerData *gen) {
|
||||
// This sets a requirement of Mountain Lion and up, but the compiler doesn't work without this limit.
|
||||
if (build_context.minimum_os_version_string.len) {
|
||||
link_settings = gb_string_append_fmt(link_settings, " -mmacosx-version-min=%.*s ", LIT(build_context.minimum_os_version_string));
|
||||
} else if (build_context.metrics.arch == TargetArch_arm64) {
|
||||
link_settings = gb_string_appendc(link_settings, " -mmacosx-version-min=12.0.0 ");
|
||||
} else {
|
||||
link_settings = gb_string_appendc(link_settings, " -mmacosx-version-min=10.12.0 ");
|
||||
}
|
||||
// This points the linker to where the entry point is
|
||||
link_settings = gb_string_appendc(link_settings, " -e _main ");
|
||||
|
||||
@@ -107,6 +107,10 @@ gb_internal bool lb_init_generator(lbGenerator *gen, Checker *c) {
|
||||
String init_fullpath = c->parser->init_fullpath;
|
||||
linker_data_init(gen, &c->info, init_fullpath);
|
||||
|
||||
#if defined(GB_SYSTEM_OSX) && (LLVM_VERSION_MAJOR < 14)
|
||||
linker_enable_system_library_linking(gen);
|
||||
#endif
|
||||
|
||||
gen->info = &c->info;
|
||||
|
||||
map_init(&gen->modules, gen->info->packages.count*2);
|
||||
|
||||
@@ -3385,7 +3385,7 @@ gb_internal lbValue lb_build_call_expr_internal(lbProcedure *p, Ast *expr) {
|
||||
}
|
||||
|
||||
lbValue arg = args[arg_index];
|
||||
if (arg.value == nullptr) {
|
||||
if (arg.value == nullptr && arg.type == nullptr) {
|
||||
switch (e->kind) {
|
||||
case Entity_TypeName:
|
||||
args[arg_index] = lb_const_nil(p->module, e->type);
|
||||
|
||||
@@ -726,6 +726,10 @@ gb_internal bool cg_generate_code(Checker *c, LinkerData *linker_data) {
|
||||
|
||||
linker_data_init(linker_data, info, c->parser->init_fullpath);
|
||||
|
||||
#if defined(GB_SYSTEM_OSX)
|
||||
linker_enable_system_library_linking(linker_data);
|
||||
#endif
|
||||
|
||||
cg_global_arena_init();
|
||||
|
||||
cgModule *m = cg_module_create(c);
|
||||
|
||||
+102
-102
@@ -1,102 +1,102 @@
|
||||
@echo off
|
||||
set COMMON=-no-bounds-check -vet -strict-style
|
||||
set COLLECTION=-collection:tests=..
|
||||
set PATH_TO_ODIN==..\..\odin
|
||||
python3 download_assets.py
|
||||
echo ---
|
||||
echo Running core:image tests
|
||||
echo ---
|
||||
%PATH_TO_ODIN% run image %COMMON% -out:test_core_image.exe || exit /b
|
||||
|
||||
echo ---
|
||||
echo Running core:compress tests
|
||||
echo ---
|
||||
%PATH_TO_ODIN% run compress %COMMON% -out:test_core_compress.exe || exit /b
|
||||
|
||||
echo ---
|
||||
echo Running core:strings tests
|
||||
echo ---
|
||||
%PATH_TO_ODIN% run strings %COMMON% -out:test_core_strings.exe || exit /b
|
||||
|
||||
echo ---
|
||||
echo Running core:hash tests
|
||||
echo ---
|
||||
%PATH_TO_ODIN% run hash %COMMON% -o:size -out:test_core_hash.exe || exit /b
|
||||
|
||||
echo ---
|
||||
echo Running core:odin tests
|
||||
echo ---
|
||||
%PATH_TO_ODIN% run odin %COMMON% -o:size -out:test_core_odin.exe || exit /b
|
||||
|
||||
echo ---
|
||||
echo Running core:crypto hash tests
|
||||
echo ---
|
||||
%PATH_TO_ODIN% run crypto %COMMON% -out:test_crypto_hash.exe || exit /b
|
||||
|
||||
echo ---
|
||||
echo Running core:encoding tests
|
||||
echo ---
|
||||
%PATH_TO_ODIN% run encoding/hxa %COMMON% %COLLECTION% -out:test_hxa.exe || exit /b
|
||||
%PATH_TO_ODIN% run encoding/json %COMMON% -out:test_json.exe || exit /b
|
||||
%PATH_TO_ODIN% run encoding/varint %COMMON% -out:test_varint.exe || exit /b
|
||||
%PATH_TO_ODIN% run encoding/xml %COMMON% -out:test_xml.exe || exit /b
|
||||
|
||||
echo ---
|
||||
echo Running core:math/noise tests
|
||||
echo ---
|
||||
%PATH_TO_ODIN% run math/noise %COMMON% -out:test_noise.exe || exit /b
|
||||
|
||||
echo ---
|
||||
echo Running core:math tests
|
||||
echo ---
|
||||
%PATH_TO_ODIN% run math %COMMON% %COLLECTION% -out:test_core_math.exe || exit /b
|
||||
|
||||
echo ---
|
||||
echo Running core:math/linalg/glsl tests
|
||||
echo ---
|
||||
%PATH_TO_ODIN% run math/linalg/glsl %COMMON% %COLLECTION% -out:test_linalg_glsl.exe || exit /b
|
||||
|
||||
echo ---
|
||||
echo Running core:path/filepath tests
|
||||
echo ---
|
||||
%PATH_TO_ODIN% run path/filepath %COMMON% %COLLECTION% -out:test_core_filepath.exe || exit /b
|
||||
|
||||
echo ---
|
||||
echo Running core:reflect tests
|
||||
echo ---
|
||||
%PATH_TO_ODIN% run reflect %COMMON% %COLLECTION% -out:test_core_reflect.exe || exit /b
|
||||
|
||||
echo ---
|
||||
echo Running core:slice tests
|
||||
echo ---
|
||||
%PATH_TO_ODIN% run slice %COMMON% -out:test_core_slice.exe || exit /b
|
||||
|
||||
echo ---
|
||||
echo Running core:text/i18n tests
|
||||
echo ---
|
||||
%PATH_TO_ODIN% run text\i18n %COMMON% -out:test_core_i18n.exe || exit /b
|
||||
|
||||
echo ---
|
||||
echo Running core:net
|
||||
echo ---
|
||||
%PATH_TO_ODIN% run net %COMMON% -out:test_core_net.exe || exit /b
|
||||
|
||||
echo ---
|
||||
echo Running core:slice tests
|
||||
echo ---
|
||||
%PATH_TO_ODIN% run slice %COMMON% -out:test_core_slice.exe || exit /b
|
||||
|
||||
echo ---
|
||||
echo Running core:container tests
|
||||
echo ---
|
||||
%PATH_TO_ODIN% run container %COMMON% %COLLECTION% -out:test_core_container.exe || exit /b
|
||||
|
||||
echo ---
|
||||
echo Running core:thread tests
|
||||
echo ---
|
||||
%PATH_TO_ODIN% run thread %COMMON% %COLLECTION% -out:test_core_thread.exe || exit /b
|
||||
|
||||
echo ---
|
||||
echo Running core:runtime tests
|
||||
echo ---
|
||||
%PATH_TO_ODIN% run runtime %COMMON% %COLLECTION% -out:test_core_runtime.exe || exit /b
|
||||
@echo off
|
||||
set COMMON=-no-bounds-check -vet -strict-style
|
||||
set COLLECTION=-collection:tests=..
|
||||
set PATH_TO_ODIN==..\..\odin
|
||||
python3 download_assets.py
|
||||
echo ---
|
||||
echo Running core:image tests
|
||||
echo ---
|
||||
%PATH_TO_ODIN% run image %COMMON% -out:test_core_image.exe || exit /b
|
||||
|
||||
echo ---
|
||||
echo Running core:compress tests
|
||||
echo ---
|
||||
%PATH_TO_ODIN% run compress %COMMON% -out:test_core_compress.exe || exit /b
|
||||
|
||||
echo ---
|
||||
echo Running core:strings tests
|
||||
echo ---
|
||||
%PATH_TO_ODIN% run strings %COMMON% -out:test_core_strings.exe || exit /b
|
||||
|
||||
echo ---
|
||||
echo Running core:hash tests
|
||||
echo ---
|
||||
%PATH_TO_ODIN% run hash %COMMON% -o:size -out:test_core_hash.exe || exit /b
|
||||
|
||||
echo ---
|
||||
echo Running core:odin tests
|
||||
echo ---
|
||||
%PATH_TO_ODIN% run odin %COMMON% -o:size -out:test_core_odin.exe || exit /b
|
||||
|
||||
echo ---
|
||||
echo Running core:crypto hash tests
|
||||
echo ---
|
||||
%PATH_TO_ODIN% run crypto %COMMON% -out:test_crypto_hash.exe || exit /b
|
||||
|
||||
echo ---
|
||||
echo Running core:encoding tests
|
||||
echo ---
|
||||
rem %PATH_TO_ODIN% run encoding/hxa %COMMON% %COLLECTION% -out:test_hxa.exe || exit /b
|
||||
%PATH_TO_ODIN% run encoding/json %COMMON% -out:test_json.exe || exit /b
|
||||
%PATH_TO_ODIN% run encoding/varint %COMMON% -out:test_varint.exe || exit /b
|
||||
%PATH_TO_ODIN% run encoding/xml %COMMON% -out:test_xml.exe || exit /b
|
||||
|
||||
echo ---
|
||||
echo Running core:math/noise tests
|
||||
echo ---
|
||||
%PATH_TO_ODIN% run math/noise %COMMON% -out:test_noise.exe || exit /b
|
||||
|
||||
echo ---
|
||||
echo Running core:math tests
|
||||
echo ---
|
||||
%PATH_TO_ODIN% run math %COMMON% %COLLECTION% -out:test_core_math.exe || exit /b
|
||||
|
||||
echo ---
|
||||
echo Running core:math/linalg/glsl tests
|
||||
echo ---
|
||||
%PATH_TO_ODIN% run math/linalg/glsl %COMMON% %COLLECTION% -out:test_linalg_glsl.exe || exit /b
|
||||
|
||||
echo ---
|
||||
echo Running core:path/filepath tests
|
||||
echo ---
|
||||
%PATH_TO_ODIN% run path/filepath %COMMON% %COLLECTION% -out:test_core_filepath.exe || exit /b
|
||||
|
||||
echo ---
|
||||
echo Running core:reflect tests
|
||||
echo ---
|
||||
%PATH_TO_ODIN% run reflect %COMMON% %COLLECTION% -out:test_core_reflect.exe || exit /b
|
||||
|
||||
echo ---
|
||||
echo Running core:slice tests
|
||||
echo ---
|
||||
%PATH_TO_ODIN% run slice %COMMON% -out:test_core_slice.exe || exit /b
|
||||
|
||||
echo ---
|
||||
echo Running core:text/i18n tests
|
||||
echo ---
|
||||
%PATH_TO_ODIN% run text\i18n %COMMON% -out:test_core_i18n.exe || exit /b
|
||||
|
||||
echo ---
|
||||
echo Running core:net
|
||||
echo ---
|
||||
%PATH_TO_ODIN% run net %COMMON% -out:test_core_net.exe || exit /b
|
||||
|
||||
echo ---
|
||||
echo Running core:slice tests
|
||||
echo ---
|
||||
%PATH_TO_ODIN% run slice %COMMON% -out:test_core_slice.exe || exit /b
|
||||
|
||||
echo ---
|
||||
echo Running core:container tests
|
||||
echo ---
|
||||
%PATH_TO_ODIN% run container %COMMON% %COLLECTION% -out:test_core_container.exe || exit /b
|
||||
|
||||
echo ---
|
||||
echo Running core:thread tests
|
||||
echo ---
|
||||
%PATH_TO_ODIN% run thread %COMMON% %COLLECTION% -out:test_core_thread.exe || exit /b
|
||||
|
||||
echo ---
|
||||
echo Running core:runtime tests
|
||||
echo ---
|
||||
%PATH_TO_ODIN% run runtime %COMMON% %COLLECTION% -out:test_core_runtime.exe || exit /b
|
||||
|
||||
@@ -159,7 +159,7 @@ TESTS :: []TEST{
|
||||
},
|
||||
|
||||
/*
|
||||
Parse the 8.2 MiB unicode.xml for good measure.
|
||||
Parse the 9.08 MiB unicode.xml for good measure.
|
||||
*/
|
||||
{
|
||||
filename = "XML/unicode.xml",
|
||||
@@ -170,7 +170,7 @@ TESTS :: []TEST{
|
||||
expected_doctype = "",
|
||||
},
|
||||
err = .None,
|
||||
crc32 = 0x420dbac5,
|
||||
crc32 = 0x0b6100ab,
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
Vendored
+71
-55
@@ -40,7 +40,7 @@ IUnknown_VTable :: struct {
|
||||
foreign dxgi {
|
||||
CreateDXGIFactory :: proc(riid: ^IID, ppFactory: ^rawptr) -> HRESULT ---
|
||||
CreateDXGIFactory1 :: proc(riid: ^IID, ppFactory: ^rawptr) -> HRESULT ---
|
||||
CreateDXGIFactory2 :: proc(Flags: u32, riid: ^IID, ppFactory: ^rawptr) -> HRESULT ---
|
||||
CreateDXGIFactory2 :: proc(Flags: CREATE_FACTORY, riid: ^IID, ppFactory: ^rawptr) -> HRESULT ---
|
||||
DXGIGetDebugInterface1 :: proc(Flags: u32, riid: ^IID, pDebug: ^rawptr) -> HRESULT ---
|
||||
}
|
||||
|
||||
@@ -76,10 +76,11 @@ RESOURCE_PRIORITY :: enum u32 {
|
||||
MAXIMUM = 0xc8000000,
|
||||
}
|
||||
|
||||
MAP :: enum u32 {
|
||||
READ = 1,
|
||||
WRITE = 2,
|
||||
DISCARD = 4,
|
||||
MAP :: distinct bit_set[MAP_FLAG; u32]
|
||||
MAP_FLAG :: enum u32 {
|
||||
READ = 0,
|
||||
WRITE = 1,
|
||||
DISCARD = 2,
|
||||
}
|
||||
|
||||
ENUM_MODES :: distinct bit_set[ENUM_MODE; u32]
|
||||
@@ -117,10 +118,20 @@ MWA_VALID :: MWA{
|
||||
.NO_PRINT_SCREEN,
|
||||
}
|
||||
|
||||
SHARED_RESOURCE_RW :: distinct bit_set[SHARED_RESOURCE_RW_FLAG; u32]
|
||||
SHARED_RESOURCE_RW_FLAG :: enum u32 {
|
||||
READ = 31,
|
||||
WRITE = 0,
|
||||
}
|
||||
SHARED_RESOURCE_READ :: 0x80000000
|
||||
SHARED_RESOURCE_WRITE :: 1
|
||||
CREATE_FACTORY_DEBUG :: 0x1
|
||||
|
||||
CREATE_FACTORY :: distinct bit_set[CREATE_FACTORY_FLAG; u32]
|
||||
CREATE_FACTORY_FLAG :: enum u32 {
|
||||
DEBUG = 0,
|
||||
}
|
||||
|
||||
RATIONAL :: struct {
|
||||
Numerator: u32,
|
||||
Denominator: u32,
|
||||
@@ -418,20 +429,21 @@ SWAP_EFFECT :: enum i32 {
|
||||
FLIP_DISCARD = 4,
|
||||
}
|
||||
|
||||
SWAP_CHAIN_FLAG :: enum u32 { // TODO: convert to bit_set
|
||||
NONPREROTATED = 0x1,
|
||||
ALLOW_MODE_SWITCH = 0x2,
|
||||
GDI_COMPATIBLE = 0x4,
|
||||
RESTRICTED_CONTENT = 0x8,
|
||||
RESTRICT_SHARED_RESOURCE_DRIVER = 0x10,
|
||||
DISPLAY_ONLY = 0x20,
|
||||
FRAME_LATENCY_WAITABLE_OBJECT = 0x40,
|
||||
FOREGROUND_LAYER = 0x80,
|
||||
FULLSCREEN_VIDEO = 0x100,
|
||||
YUV_VIDEO = 0x200,
|
||||
HW_PROTECTED = 0x400,
|
||||
ALLOW_TEARING = 0x800,
|
||||
RESTRICTED_TO_ALL_HOLOGRAPHIC_DISPLAYS = 0x1000,
|
||||
SWAP_CHAIN :: distinct bit_set[SWAP_CHAIN_FLAG; u32]
|
||||
SWAP_CHAIN_FLAG :: enum u32 {
|
||||
NONPREROTATED = 0,
|
||||
ALLOW_MODE_SWITCH,
|
||||
GDI_COMPATIBLE,
|
||||
RESTRICTED_CONTENT,
|
||||
RESTRICT_SHARED_RESOURCE_DRIVER,
|
||||
DISPLAY_ONLY,
|
||||
FRAME_LATENCY_WAITABLE_OBJECT,
|
||||
FOREGROUND_LAYER,
|
||||
FULLSCREEN_VIDEO,
|
||||
YUV_VIDEO,
|
||||
HW_PROTECTED,
|
||||
ALLOW_TEARING,
|
||||
RESTRICTED_TO_ALL_HOLOGRAPHIC_DISPLAYS,
|
||||
}
|
||||
|
||||
SWAP_CHAIN_DESC :: struct {
|
||||
@@ -442,7 +454,7 @@ SWAP_CHAIN_DESC :: struct {
|
||||
OutputWindow: HWND,
|
||||
Windowed: BOOL,
|
||||
SwapEffect: SWAP_EFFECT,
|
||||
Flags: u32,
|
||||
Flags: SWAP_CHAIN,
|
||||
}
|
||||
|
||||
|
||||
@@ -481,8 +493,8 @@ IResource_VTable :: struct {
|
||||
using idxgidevicesubobject_vtable: IDeviceSubObject_VTable,
|
||||
GetSharedHandle: proc "stdcall" (this: ^IResource, pSharedHandle: ^HANDLE) -> HRESULT,
|
||||
GetUsage: proc "stdcall" (this: ^IResource, pUsage: ^USAGE) -> HRESULT,
|
||||
SetEvictionPriority: proc "stdcall" (this: ^IResource, EvictionPriority: u32) -> HRESULT,
|
||||
GetEvictionPriority: proc "stdcall" (this: ^IResource, pEvictionPriority: ^u32) -> HRESULT,
|
||||
SetEvictionPriority: proc "stdcall" (this: ^IResource, EvictionPriority: RESOURCE_PRIORITY) -> HRESULT,
|
||||
GetEvictionPriority: proc "stdcall" (this: ^IResource, pEvictionPriority: ^RESOURCE_PRIORITY) -> HRESULT,
|
||||
}
|
||||
|
||||
IKeyedMutex_UUID_STRING :: "9D8E1289-D7B3-465F-8126-250E349AF85D"
|
||||
@@ -506,7 +518,7 @@ ISurface :: struct #raw_union {
|
||||
ISurface_VTable :: struct {
|
||||
using idxgidevicesubobject_vtable: IDeviceSubObject_VTable,
|
||||
GetDesc: proc "stdcall" (this: ^ISurface, pDesc: ^SURFACE_DESC) -> HRESULT,
|
||||
Map: proc "stdcall" (this: ^ISurface, pLockedRect: ^MAPPED_RECT, MapFlags: u32) -> HRESULT,
|
||||
Map: proc "stdcall" (this: ^ISurface, pLockedRect: ^MAPPED_RECT, MapFlags: MAP) -> HRESULT,
|
||||
Unmap: proc "stdcall" (this: ^ISurface) -> HRESULT,
|
||||
}
|
||||
|
||||
@@ -544,7 +556,7 @@ IOutput :: struct #raw_union {
|
||||
IOutput_VTable :: struct {
|
||||
using idxgiobject_vtable: IObject_VTable,
|
||||
GetDesc: proc "stdcall" (this: ^IOutput, pDesc: ^OUTPUT_DESC) -> HRESULT,
|
||||
GetDisplayModeList: proc "stdcall" (this: ^IOutput, EnumFormat: FORMAT, Flags: u32, pNumModes: ^u32, pDesc: ^MODE_DESC) -> HRESULT,
|
||||
GetDisplayModeList: proc "stdcall" (this: ^IOutput, EnumFormat: FORMAT, Flags: ENUM_MODES, pNumModes: ^u32, pDesc: ^MODE_DESC) -> HRESULT,
|
||||
FindClosestMatchingMode: proc "stdcall" (this: ^IOutput, pModeToMatch: ^MODE_DESC, pClosestMatch: ^MODE_DESC, pConcernedDevice: ^IUnknown) -> HRESULT,
|
||||
WaitForVBlank: proc "stdcall" (this: ^IOutput) -> HRESULT,
|
||||
TakeOwnership: proc "stdcall" (this: ^IOutput, pDevice: ^IUnknown, Exclusive: BOOL) -> HRESULT,
|
||||
@@ -565,12 +577,12 @@ ISwapChain :: struct #raw_union {
|
||||
}
|
||||
ISwapChain_VTable :: struct {
|
||||
using idxgidevicesubobject_vtable: IDeviceSubObject_VTable,
|
||||
Present: proc "stdcall" (this: ^ISwapChain, SyncInterval: u32, Flags: u32) -> HRESULT,
|
||||
Present: proc "stdcall" (this: ^ISwapChain, SyncInterval: u32, Flags: PRESENT) -> HRESULT,
|
||||
GetBuffer: proc "stdcall" (this: ^ISwapChain, Buffer: u32, riid: ^IID, ppSurface: ^rawptr) -> HRESULT,
|
||||
SetFullscreenState: proc "stdcall" (this: ^ISwapChain, Fullscreen: BOOL, pTarget: ^IOutput) -> HRESULT,
|
||||
GetFullscreenState: proc "stdcall" (this: ^ISwapChain, pFullscreen: ^BOOL, ppTarget: ^^IOutput) -> HRESULT,
|
||||
GetDesc: proc "stdcall" (this: ^ISwapChain, pDesc: ^SWAP_CHAIN_DESC) -> HRESULT,
|
||||
ResizeBuffers: proc "stdcall" (this: ^ISwapChain, BufferCount: u32, Width: u32, Height: u32, NewFormat: FORMAT, SwapChainFlags: u32) -> HRESULT,
|
||||
ResizeBuffers: proc "stdcall" (this: ^ISwapChain, BufferCount: u32, Width: u32, Height: u32, NewFormat: FORMAT, SwapChainFlags: SWAP_CHAIN) -> HRESULT,
|
||||
ResizeTarget: proc "stdcall" (this: ^ISwapChain, pNewTargetParameters: ^MODE_DESC) -> HRESULT,
|
||||
GetContainingOutput: proc "stdcall" (this: ^ISwapChain, ppOutput: ^^IOutput) -> HRESULT,
|
||||
GetFrameStatistics: proc "stdcall" (this: ^ISwapChain, pStats: ^FRAME_STATISTICS) -> HRESULT,
|
||||
@@ -586,7 +598,7 @@ IFactory :: struct #raw_union {
|
||||
IFactory_VTable :: struct {
|
||||
using idxgiobject_vtable: IObject_VTable,
|
||||
EnumAdapters: proc "stdcall" (this: ^IFactory, Adapter: u32, ppAdapter: ^^IAdapter) -> HRESULT,
|
||||
MakeWindowAssociation: proc "stdcall" (this: ^IFactory, WindowHandle: HWND, Flags: u32) -> HRESULT,
|
||||
MakeWindowAssociation: proc "stdcall" (this: ^IFactory, WindowHandle: HWND, Flags: MWA) -> HRESULT,
|
||||
GetWindowAssociation: proc "stdcall" (this: ^IFactory, pWindowHandle: ^HWND) -> HRESULT,
|
||||
CreateSwapChain: proc "stdcall" (this: ^IFactory, pDevice: ^IUnknown, pDesc: ^SWAP_CHAIN_DESC, ppSwapChain: ^^ISwapChain) -> HRESULT,
|
||||
CreateSoftwareAdapter: proc "stdcall" (this: ^IFactory, Module: HMODULE, ppAdapter: ^^IAdapter) -> HRESULT,
|
||||
@@ -622,7 +634,7 @@ ADAPTER_DESC1 :: struct {
|
||||
DedicatedSystemMemory: SIZE_T,
|
||||
SharedSystemMemory: SIZE_T,
|
||||
AdapterLuid: LUID,
|
||||
Flags: u32,
|
||||
Flags: ADAPTER_FLAG,
|
||||
}
|
||||
|
||||
DISPLAY_COLOR_SPACE :: struct {
|
||||
@@ -700,7 +712,7 @@ OUTDUPL_POINTER_SHAPE_TYPE :: enum i32 {
|
||||
}
|
||||
|
||||
OUTDUPL_POINTER_SHAPE_INFO :: struct {
|
||||
Type: u32,
|
||||
Type: OUTDUPL_POINTER_SHAPE_TYPE,
|
||||
Width: u32,
|
||||
Height: u32,
|
||||
Pitch: u32,
|
||||
@@ -765,7 +777,7 @@ IResource1 :: struct #raw_union {
|
||||
IResource1_VTable :: struct {
|
||||
using idxgiresource_vtable: IResource_VTable,
|
||||
CreateSubresourceSurface: proc "stdcall" (this: ^IResource1, index: u32, ppSurface: ^^ISurface2) -> HRESULT,
|
||||
CreateSharedHandle: proc "stdcall" (this: ^IResource1, pAttributes: ^win32.SECURITY_ATTRIBUTES, dwAccess: u32, lpName: ^i16, pHandle: ^HANDLE) -> HRESULT,
|
||||
CreateSharedHandle: proc "stdcall" (this: ^IResource1, pAttributes: ^win32.SECURITY_ATTRIBUTES, dwAccess: SHARED_RESOURCE_RW, lpName: ^i16, pHandle: ^HANDLE) -> HRESULT,
|
||||
}
|
||||
OFFER_RESOURCE_PRIORITY :: enum i32 {
|
||||
LOW = 1,
|
||||
@@ -813,7 +825,7 @@ SWAP_CHAIN_DESC1 :: struct {
|
||||
Scaling: SCALING,
|
||||
SwapEffect: SWAP_EFFECT,
|
||||
AlphaMode: ALPHA_MODE,
|
||||
Flags: u32,
|
||||
Flags: SWAP_CHAIN,
|
||||
}
|
||||
|
||||
SWAP_CHAIN_FULLSCREEN_DESC :: struct {
|
||||
@@ -844,7 +856,7 @@ ISwapChain1_VTable :: struct {
|
||||
GetFullscreenDesc: proc "stdcall" (this: ^ISwapChain1, pDesc: ^SWAP_CHAIN_FULLSCREEN_DESC) -> HRESULT,
|
||||
GetHwnd: proc "stdcall" (this: ^ISwapChain1, pHwnd: ^HWND) -> HRESULT,
|
||||
GetCoreWindow: proc "stdcall" (this: ^ISwapChain1, refiid: ^IID, ppUnk: ^rawptr) -> HRESULT,
|
||||
Present1: proc "stdcall" (this: ^ISwapChain1, SyncInterval: u32, PresentFlags: u32, pPresentParameters: ^PRESENT_PARAMETERS) -> HRESULT,
|
||||
Present1: proc "stdcall" (this: ^ISwapChain1, SyncInterval: u32, PresentFlags: PRESENT, pPresentParameters: ^PRESENT_PARAMETERS) -> HRESULT,
|
||||
IsTemporaryMonoSupported: proc "stdcall" (this: ^ISwapChain1) -> BOOL,
|
||||
GetRestrictToOutput: proc "stdcall" (this: ^ISwapChain1, ppRestrictToOutput: ^^IOutput) -> HRESULT,
|
||||
SetBackgroundColor: proc "stdcall" (this: ^ISwapChain1, pColor: ^RGBA) -> HRESULT,
|
||||
@@ -899,7 +911,7 @@ ADAPTER_DESC2 :: struct {
|
||||
DedicatedSystemMemory: SIZE_T,
|
||||
SharedSystemMemory: SIZE_T,
|
||||
AdapterLuid: LUID,
|
||||
Flags: u32,
|
||||
Flags: ADAPTER_FLAG,
|
||||
GraphicsPreemptionGranularity: GRAPHICS_PREEMPTION_GRANULARITY,
|
||||
ComputePreemptionGranularity: COMPUTE_PREEMPTION_GRANULARITY,
|
||||
}
|
||||
@@ -924,7 +936,7 @@ IOutput1 :: struct #raw_union {
|
||||
}
|
||||
IOutput1_VTable :: struct {
|
||||
using idxgioutput_vtable: IOutput_VTable,
|
||||
GetDisplayModeList1: proc "stdcall" (this: ^IOutput1, EnumFormat: FORMAT, Flags: u32, pNumModes: ^u32, pDesc: ^MODE_DESC1) -> HRESULT,
|
||||
GetDisplayModeList1: proc "stdcall" (this: ^IOutput1, EnumFormat: FORMAT, Flags: ENUM_MODES, pNumModes: ^u32, pDesc: ^MODE_DESC1) -> HRESULT,
|
||||
FindClosestMatchingMode1: proc "stdcall" (this: ^IOutput1, pModeToMatch: ^MODE_DESC1, pClosestMatch: ^MODE_DESC1, pConcernedDevice: ^IUnknown) -> HRESULT,
|
||||
GetDisplaySurfaceData1: proc "stdcall" (this: ^IOutput1, pDestination: ^IResource) -> HRESULT,
|
||||
DuplicateOutput: proc "stdcall" (this: ^IOutput1, pDevice: ^IUnknown, ppOutputDuplication: ^^IOutputDuplication) -> HRESULT,
|
||||
@@ -985,16 +997,17 @@ IFactory3 :: struct #raw_union {
|
||||
}
|
||||
IFactory3_VTable :: struct {
|
||||
using idxgifactory2_vtable: IFactory2_VTable,
|
||||
GetCreationFlags: proc "stdcall" (this: ^IFactory3) -> u32,
|
||||
GetCreationFlags: proc "stdcall" (this: ^IFactory3) -> CREATE_FACTORY,
|
||||
}
|
||||
DECODE_SWAP_CHAIN_DESC :: struct {
|
||||
Flags: u32,
|
||||
Flags: SWAP_CHAIN,
|
||||
}
|
||||
|
||||
MULTIPLANE_OVERLAY_YCbCr_FLAGS :: enum u32 { // TODO: convert to bit_set
|
||||
NOMINAL_RANGE = 0x1,
|
||||
BT709 = 0x2,
|
||||
xvYCC = 0x4,
|
||||
MULTIPLANE_OVERLAY_YCbCr :: distinct bit_set[MULTIPLANE_OVERLAY_YCbCr_FLAGS; u32]
|
||||
MULTIPLANE_OVERLAY_YCbCr_FLAGS :: enum u32 {
|
||||
NOMINAL_RANGE = 0,
|
||||
BT709,
|
||||
xvYCC,
|
||||
}
|
||||
|
||||
|
||||
@@ -1006,15 +1019,15 @@ IDecodeSwapChain :: struct #raw_union {
|
||||
}
|
||||
IDecodeSwapChain_VTable :: struct {
|
||||
using iunknown_vtable: IUnknown_VTable,
|
||||
PresentBuffer: proc "stdcall" (this: ^IDecodeSwapChain, BufferToPresent: u32, SyncInterval: u32, Flags: u32) -> HRESULT,
|
||||
PresentBuffer: proc "stdcall" (this: ^IDecodeSwapChain, BufferToPresent: u32, SyncInterval: u32, Flags: PRESENT) -> HRESULT,
|
||||
SetSourceRect: proc "stdcall" (this: ^IDecodeSwapChain, pRect: ^RECT) -> HRESULT,
|
||||
SetTargetRect: proc "stdcall" (this: ^IDecodeSwapChain, pRect: ^RECT) -> HRESULT,
|
||||
SetDestSize: proc "stdcall" (this: ^IDecodeSwapChain, Width: u32, Height: u32) -> HRESULT,
|
||||
GetSourceRect: proc "stdcall" (this: ^IDecodeSwapChain, pRect: ^RECT) -> HRESULT,
|
||||
GetTargetRect: proc "stdcall" (this: ^IDecodeSwapChain, pRect: ^RECT) -> HRESULT,
|
||||
GetDestSize: proc "stdcall" (this: ^IDecodeSwapChain, pWidth: ^u32, pHeight: ^u32) -> HRESULT,
|
||||
SetColorSpace: proc "stdcall" (this: ^IDecodeSwapChain, ColorSpace: MULTIPLANE_OVERLAY_YCbCr_FLAGS) -> HRESULT,
|
||||
GetColorSpace: proc "stdcall" (this: ^IDecodeSwapChain) -> MULTIPLANE_OVERLAY_YCbCr_FLAGS,
|
||||
SetColorSpace: proc "stdcall" (this: ^IDecodeSwapChain, ColorSpace: MULTIPLANE_OVERLAY_YCbCr) -> HRESULT,
|
||||
GetColorSpace: proc "stdcall" (this: ^IDecodeSwapChain) -> MULTIPLANE_OVERLAY_YCbCr,
|
||||
}
|
||||
|
||||
IFactoryMedia_UUID_STRING :: "41E7D1F2-A591-4F7B-A2E5-FA9C843E1C12"
|
||||
@@ -1058,9 +1071,10 @@ ISwapChainMedia_VTable :: struct {
|
||||
SetPresentDuration: proc "stdcall" (this: ^ISwapChainMedia, Duration: u32) -> HRESULT,
|
||||
CheckPresentDurationSupport: proc "stdcall" (this: ^ISwapChainMedia, DesiredPresentDuration: u32, pClosestSmallerPresentDuration: ^u32, pClosestLargerPresentDuration: ^u32) -> HRESULT,
|
||||
}
|
||||
OVERLAY_SUPPORT_FLAG :: enum u32 { // TODO: convert to bit_set
|
||||
DIRECT = 0x1,
|
||||
SCALING = 0x2,
|
||||
OVERLAY_SUPPORT :: distinct bit_set[OVERLAY_SUPPORT_FLAG; u32]
|
||||
OVERLAY_SUPPORT_FLAG :: enum u32 {
|
||||
DIRECT = 0,
|
||||
SCALING = 1,
|
||||
}
|
||||
|
||||
|
||||
@@ -1072,11 +1086,12 @@ IOutput3 :: struct #raw_union {
|
||||
}
|
||||
IOutput3_VTable :: struct {
|
||||
using idxgioutput2_vtable: IOutput2_VTable,
|
||||
CheckOverlaySupport: proc "stdcall" (this: ^IOutput3, EnumFormat: FORMAT, pConcernedDevice: ^IUnknown, pFlags: ^u32) -> HRESULT,
|
||||
CheckOverlaySupport: proc "stdcall" (this: ^IOutput3, EnumFormat: FORMAT, pConcernedDevice: ^IUnknown, pFlags: ^OVERLAY_SUPPORT) -> HRESULT,
|
||||
}
|
||||
SWAP_CHAIN_COLOR_SPACE_SUPPORT_FLAG :: enum u32 { // TODO: convert to bit_set
|
||||
PRESENT = 0x1,
|
||||
OVERLAY_PRESENT = 0x2,
|
||||
SWAP_CHAIN_COLOR_SPACE_SUPPORT :: distinct bit_set[SWAP_CHAIN_COLOR_SPACE_SUPPORT_FLAG; u32]
|
||||
SWAP_CHAIN_COLOR_SPACE_SUPPORT_FLAG :: enum u32 {
|
||||
PRESENT = 0,
|
||||
OVERLAY_PRESENT = 1,
|
||||
}
|
||||
|
||||
|
||||
@@ -1089,12 +1104,13 @@ ISwapChain3 :: struct #raw_union {
|
||||
ISwapChain3_VTable :: struct {
|
||||
using idxgiswapchain2_vtable: ISwapChain2_VTable,
|
||||
GetCurrentBackBufferIndex: proc "stdcall" (this: ^ISwapChain3) -> u32,
|
||||
CheckColorSpaceSupport: proc "stdcall" (this: ^ISwapChain3, ColorSpace: COLOR_SPACE_TYPE, pColorSpaceSupport: ^u32) -> HRESULT,
|
||||
CheckColorSpaceSupport: proc "stdcall" (this: ^ISwapChain3, ColorSpace: COLOR_SPACE_TYPE, pColorSpaceSupport: ^SWAP_CHAIN_COLOR_SPACE_SUPPORT) -> HRESULT,
|
||||
SetColorSpace1: proc "stdcall" (this: ^ISwapChain3, ColorSpace: COLOR_SPACE_TYPE) -> HRESULT,
|
||||
ResizeBuffers1: proc "stdcall" (this: ^ISwapChain3, BufferCount: u32, Width: u32, Height: u32, Format: FORMAT, SwapChainFlags: u32, pCreationNodeMask: ^u32, ppPresentQueue: ^^IUnknown) -> HRESULT,
|
||||
ResizeBuffers1: proc "stdcall" (this: ^ISwapChain3, BufferCount: u32, Width: u32, Height: u32, Format: FORMAT, SwapChainFlags: SWAP_CHAIN, pCreationNodeMask: ^u32, ppPresentQueue: ^^IUnknown) -> HRESULT,
|
||||
}
|
||||
OVERLAY_COLOR_SPACE_SUPPORT_FLAG :: enum u32 { // TODO: convert to bit_set
|
||||
PRESENT = 0x1,
|
||||
OVERLAY_COLOR_SPACE_SUPPORT :: distinct bit_set[OVERLAY_COLOR_SPACE_SUPPORT_FLAG; u32]
|
||||
OVERLAY_COLOR_SPACE_SUPPORT_FLAG :: enum u32 {
|
||||
PRESENT = 0,
|
||||
}
|
||||
|
||||
|
||||
@@ -1106,7 +1122,7 @@ IOutput4 :: struct #raw_union {
|
||||
}
|
||||
IOutput4_VTable :: struct {
|
||||
using idxgioutput3_vtable: IOutput3_VTable,
|
||||
CheckOverlayColorSpaceSupport: proc "stdcall" (this: ^IOutput4, Format: FORMAT, ColorSpace: COLOR_SPACE_TYPE, pConcernedDevice: ^IUnknown, pFlags: ^u32) -> HRESULT,
|
||||
CheckOverlayColorSpaceSupport: proc "stdcall" (this: ^IOutput4, Format: FORMAT, ColorSpace: COLOR_SPACE_TYPE, pConcernedDevice: ^IUnknown, pFlags: ^OVERLAY_COLOR_SPACE_SUPPORT) -> HRESULT,
|
||||
}
|
||||
|
||||
IFactory4_UUID_STRING :: "1BC6EA02-EF36-464F-BF0C-21CA39E5168A"
|
||||
|
||||
Vendored
+1
-1
@@ -181,7 +181,7 @@ foreign glfw {
|
||||
SetCharCallback :: proc(window: WindowHandle, cbfun: CharProc) -> CharProc ---
|
||||
SetCharModsCallback :: proc(window: WindowHandle, cbfun: CharModsProc) -> CharModsProc ---
|
||||
SetCursorEnterCallback :: proc(window: WindowHandle, cbfun: CursorEnterProc) -> CursorEnterProc ---
|
||||
SetJoystickCallback :: proc(window: WindowHandle, cbfun: JoystickProc) -> JoystickProc ---
|
||||
SetJoystickCallback :: proc(cbfun: JoystickProc) -> JoystickProc ---
|
||||
|
||||
SetErrorCallback :: proc(cbfun: ErrorProc) -> ErrorProc ---
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -39,7 +39,7 @@ features
|
||||
- **NO external dependencies**, all required libraries are [bundled into raylib](https://github.com/raysan5/raylib/tree/master/src/external)
|
||||
- Multiple platforms supported: **Windows, Linux, MacOS, RPI, Android, HTML5... and more!**
|
||||
- Written in plain C code (C99) using PascalCase/camelCase notation
|
||||
- Hardware accelerated with OpenGL (**1.1, 2.1, 3.3, 4.3 or ES 2.0**)
|
||||
- Hardware accelerated with OpenGL (**1.1, 2.1, 3.3, 4.3, ES 2.0 or ES 3.0**)
|
||||
- **Unique OpenGL abstraction layer** (usable as standalone module): [rlgl](https://github.com/raysan5/raylib/blob/master/src/rlgl.h)
|
||||
- Multiple **Fonts** formats supported (TTF, Image fonts, AngelCode fonts)
|
||||
- Multiple texture formats supported, including **compressed formats** (DXT, ETC, ASTC)
|
||||
|
||||
Vendored
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
+1
@@ -0,0 +1 @@
|
||||
libraylib.so.500
|
||||
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
BIN
Binary file not shown.
+1
@@ -0,0 +1 @@
|
||||
libraylib.so.5.0.0
|
||||
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
+1
@@ -0,0 +1 @@
|
||||
libraylib.5.0.0.dylib
|
||||
BIN
Binary file not shown.
BIN
Binary file not shown.
+1
@@ -0,0 +1 @@
|
||||
libraylib.5.0.0.dylib
|
||||
Vendored
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
+1
@@ -0,0 +1 @@
|
||||
libraylib.5.0.0.dylib
|
||||
Vendored
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
+1
@@ -0,0 +1 @@
|
||||
libraylib.5.0.0.dylib
|
||||
Vendored
+20
-3
@@ -23,7 +23,9 @@ when ODIN_OS == .Windows {
|
||||
} else when ODIN_OS == .Darwin {
|
||||
when ODIN_ARCH == .arm64 {
|
||||
when RAYGUI_SHARED {
|
||||
// #panic("Cannot link libraygui.450.dylib: not in the vendor collection")
|
||||
foreign import lib {
|
||||
"macos-arm64/libraygui.dylib",
|
||||
}
|
||||
} else {
|
||||
foreign import lib {
|
||||
"macos-arm64/libraygui.a",
|
||||
@@ -34,7 +36,9 @@ when ODIN_OS == .Windows {
|
||||
}
|
||||
} else {
|
||||
when RAYGUI_SHARED {
|
||||
// #panic("Cannot link libraygui.450.dylib: not in the vendor collection")
|
||||
foreign import lib {
|
||||
"macos/libraygui.dylib",
|
||||
}
|
||||
} else {
|
||||
foreign import lib {
|
||||
"macos/libraygui.a",
|
||||
@@ -72,6 +76,18 @@ GuiTextAlignment :: enum c.int {
|
||||
TEXT_ALIGN_RIGHT,
|
||||
}
|
||||
|
||||
GuiTextAlignmentVertical :: enum c.int {
|
||||
TEXT_ALIGN_TOP = 0,
|
||||
TEXT_ALIGN_MIDDLE,
|
||||
TEXT_ALIGN_BOTTOM,
|
||||
}
|
||||
|
||||
GuiTextWrapMode :: enum c.int {
|
||||
TEXT_WRAP_NONE = 0,
|
||||
TEXT_WRAP_CHAR,
|
||||
TEXT_WRAP_WORD,
|
||||
}
|
||||
|
||||
// Gui controls
|
||||
GuiControl :: enum c.int {
|
||||
// Default -> populates to all controls when set
|
||||
@@ -284,6 +300,7 @@ foreign lib {
|
||||
GuiLabelButton :: proc(bounds: Rectangle, text: cstring) -> bool --- // Label button control, show true when clicked
|
||||
GuiToggle :: proc(bounds: Rectangle, text: cstring, active: ^bool) -> c.int --- // Toggle Button control, returns true when active
|
||||
GuiToggleGroup :: proc(bounds: Rectangle, text: cstring, active: ^c.int) -> c.int --- // Toggle Group control, returns active toggle index
|
||||
GuiToggleSlider :: proc(bounds: Rectangle, text: cstring, active: ^c.int) -> c.int ---
|
||||
GuiCheckBox :: proc(bounds: Rectangle, text: cstring, checked: ^bool) -> bool --- // Check Box control, returns true when active
|
||||
GuiComboBox :: proc(bounds: Rectangle, text: cstring, active: ^c.int) -> c.int --- // Combo Box control, returns selected item index
|
||||
|
||||
@@ -573,4 +590,4 @@ GuiIconName :: enum c.int {
|
||||
ICON_253 = 253,
|
||||
ICON_254 = 254,
|
||||
ICON_255 = 255,
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+152
-72
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
Package vendor:raylib implements bindings for version 4.5 of the raylib library (https://www.raylib.com/)
|
||||
Package vendor:raylib implements bindings for version 5.0 of the raylib library (https://www.raylib.com/)
|
||||
|
||||
*********************************************************************************************
|
||||
*
|
||||
* raylib v4.5 - A simple and easy-to-use library to enjoy videogames programming (www.raylib.com)
|
||||
* raylib v5.0 - A simple and easy-to-use library to enjoy videogames programming (www.raylib.com)
|
||||
*
|
||||
* FEATURES:
|
||||
* - NO external dependencies, all required libraries included with raylib
|
||||
@@ -124,7 +124,7 @@ when ODIN_OS == .Windows {
|
||||
// multiple copies of raylib.so, but since these bindings are for
|
||||
// particular version of the library, I better specify it. Ideally,
|
||||
// though, it's best specified in terms of major (.so.4)
|
||||
"linux/libraylib.so.450",
|
||||
"linux/libraylib.so.500",
|
||||
"system:dl",
|
||||
"system:pthread",
|
||||
}
|
||||
@@ -139,7 +139,7 @@ when ODIN_OS == .Windows {
|
||||
when ODIN_ARCH == .arm64 {
|
||||
when RAYLIB_SHARED {
|
||||
foreign import lib {
|
||||
"macos-arm64/libraylib.450.dylib",
|
||||
"macos-arm64/libraylib.500.dylib",
|
||||
"system:Cocoa.framework",
|
||||
"system:OpenGL.framework",
|
||||
"system:IOKit.framework",
|
||||
@@ -155,7 +155,7 @@ when ODIN_OS == .Windows {
|
||||
} else {
|
||||
when RAYLIB_SHARED {
|
||||
foreign import lib {
|
||||
"macos/libraylib.450.dylib",
|
||||
"macos/libraylib.500.dylib",
|
||||
"system:Cocoa.framework",
|
||||
"system:OpenGL.framework",
|
||||
"system:IOKit.framework",
|
||||
@@ -173,7 +173,10 @@ when ODIN_OS == .Windows {
|
||||
foreign import lib "system:raylib"
|
||||
}
|
||||
|
||||
VERSION :: "4.5"
|
||||
VERSION_MAJOR :: 5
|
||||
VERSION_MINOR :: 0
|
||||
VERSION_PATCH :: 0
|
||||
VERSION :: "5.0"
|
||||
|
||||
PI :: 3.14159265358979323846
|
||||
DEG2RAD :: PI/180.0
|
||||
@@ -514,6 +517,19 @@ FilePathList :: struct {
|
||||
paths: [^]cstring, // Filepaths entries
|
||||
}
|
||||
|
||||
// Automation event
|
||||
AutomationEvent :: struct {
|
||||
frame: c.uint, // Event frame
|
||||
type: c.uint, // Event type (AutomationEventType)
|
||||
params: [4]c.int, // Event parameters (if required) ---
|
||||
}
|
||||
|
||||
// Automation event list
|
||||
AutomationEventList :: struct {
|
||||
capacity: c.uint, // Events max entries (MAX_AUTOMATION_EVENTS)
|
||||
count: c.uint, // Events entries count
|
||||
events: [^]AutomationEvent, // Events entries
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
// Enumerators Definition
|
||||
@@ -535,6 +551,7 @@ ConfigFlag :: enum c.int {
|
||||
WINDOW_TRANSPARENT = 4, // Set to allow transparent framebuffer
|
||||
WINDOW_HIGHDPI = 13, // Set to support HighDPI
|
||||
WINDOW_MOUSE_PASSTHROUGH = 14, // Set to support mouse passthrough, only supported when FLAG_WINDOW_UNDECORATED
|
||||
BORDERLESS_WINDOWED_MODE = 15, // Set to run program in borderless windowed mode
|
||||
MSAA_4X_HINT = 5, // Set to try enabling MSAA 4X
|
||||
INTERLACED_HINT = 16, // Set to try enabling interlaced video format (for V3D)
|
||||
}
|
||||
@@ -805,6 +822,9 @@ PixelFormat :: enum c.int {
|
||||
UNCOMPRESSED_R32, // 32 bpp (1 channel - float)
|
||||
UNCOMPRESSED_R32G32B32, // 32*3 bpp (3 channels - float)
|
||||
UNCOMPRESSED_R32G32B32A32, // 32*4 bpp (4 channels - float)
|
||||
UNCOMPRESSED_R16, // 16 bpp (1 channel - float)
|
||||
UNCOMPRESSED_R16G16B16, // 16*3 bpp (3 channels - float)
|
||||
UNCOMPRESSED_R16G16B16A16, // 16*4 bpp (4 channels - float)
|
||||
COMPRESSED_DXT1_RGB, // 4 bpp (no alpha)
|
||||
COMPRESSED_DXT1_RGBA, // 4 bpp (1 bit alpha)
|
||||
COMPRESSED_DXT3_RGBA, // 8 bpp
|
||||
@@ -869,7 +889,7 @@ BlendMode :: enum c.int {
|
||||
|
||||
// Gestures
|
||||
// NOTE: It could be used as flags to enable only some gestures
|
||||
Gesture :: enum c.int {
|
||||
Gesture :: enum c.uint {
|
||||
TAP = 0, // Tap gesture
|
||||
DOUBLETAP = 1, // Double tap gesture
|
||||
HOLD = 2, // Hold gesture
|
||||
@@ -881,7 +901,7 @@ Gesture :: enum c.int {
|
||||
PINCH_IN = 8, // Pinch in gesture
|
||||
PINCH_OUT = 9, // Pinch out gesture
|
||||
}
|
||||
Gestures :: distinct bit_set[Gesture; c.int]
|
||||
Gestures :: distinct bit_set[Gesture; c.uint]
|
||||
|
||||
// Camera system modes
|
||||
CameraMode :: enum c.int {
|
||||
@@ -910,8 +930,8 @@ NPatchLayout :: enum c.int {
|
||||
// Callbacks to hook some internal functions
|
||||
// WARNING: This callbacks are intended for advance users
|
||||
TraceLogCallback :: #type proc "c" (logLevel: TraceLogLevel, text: cstring, args: c.va_list) // Logging: Redirect trace log messages
|
||||
LoadFileDataCallback :: #type proc "c"(fileName: cstring, bytesRead: ^c.uint) -> [^]u8 // FileIO: Load binary data
|
||||
SaveFileDataCallback :: #type proc "c" (fileName: cstring, data: rawptr, bytesToWrite: c.uint) -> bool // FileIO: Save binary data
|
||||
LoadFileDataCallback :: #type proc "c"(fileName: cstring, dataSize: ^c.int) -> [^]u8 // FileIO: Load binary data
|
||||
SaveFileDataCallback :: #type proc "c" (fileName: cstring, data: rawptr, dataSize: c.int) -> bool // FileIO: Save binary data
|
||||
LoadFileTextCallback :: #type proc "c" (fileName: cstring) -> [^]u8 // FileIO: Load text data
|
||||
SaveFileTextCallback :: #type proc "c" (fileName: cstring, text: cstring) -> bool // FileIO: Save text data
|
||||
|
||||
@@ -932,7 +952,7 @@ foreign lib {
|
||||
// Window-related functions
|
||||
|
||||
InitWindow :: proc(width, height: c.int, title: cstring) --- // Initialize window and OpenGL context
|
||||
WindowShouldClose :: proc() -> bool --- // Check if KEY_ESCAPE pressed or Close icon pressed
|
||||
WindowShouldClose :: proc() -> bool --- // Check if application should close (KEY_ESCAPE pressed or windows close icon clicked)
|
||||
CloseWindow :: proc() --- // Close window and unload OpenGL context
|
||||
IsWindowReady :: proc() -> bool --- // Check if window has been initialized successfully
|
||||
IsWindowFullscreen :: proc() -> bool --- // Check if window is currently fullscreen
|
||||
@@ -945,17 +965,20 @@ foreign lib {
|
||||
SetWindowState :: proc(flags: ConfigFlags) --- // Set window configuration state using flags (only PLATFORM_DESKTOP)
|
||||
ClearWindowState :: proc(flags: ConfigFlags) --- // Clear window configuration state flags
|
||||
ToggleFullscreen :: proc() --- // Toggle window state: fullscreen/windowed (only PLATFORM_DESKTOP)
|
||||
ToggleBorderlessWindowed :: proc() --- // Toggle window state: borderless windowed (only PLATFORM_DESKTOP)
|
||||
MaximizeWindow :: proc() --- // Set window state: maximized, if resizable (only PLATFORM_DESKTOP)
|
||||
MinimizeWindow :: proc() --- // Set window state: minimized, if resizable (only PLATFORM_DESKTOP)
|
||||
RestoreWindow :: proc() --- // Set window state: not minimized/maximized (only PLATFORM_DESKTOP)
|
||||
SetWindowIcon :: proc(image: Image) --- // Set icon for window (single image, RGBA 32bit, only PLATFORM_DESKTOP)
|
||||
SetWindowIcons :: proc(images: [^]Image, count: c.int) --- // Set icon for window (multiple images, RGBA 32bit, only PLATFORM_DESKTOP)
|
||||
SetWindowTitle :: proc(title: cstring) --- // Set title for window (only PLATFORM_DESKTOP)
|
||||
SetWindowTitle :: proc(title: cstring) --- // Set title for window (only PLATFORM_DESKTOP and PLATFORM_WEB)
|
||||
SetWindowPosition :: proc(x, y: c.int) --- // Set window position on screen (only PLATFORM_DESKTOP)
|
||||
SetWindowMonitor :: proc(monitor: c.int) --- // Set monitor for the current window (fullscreen mode)
|
||||
SetWindowMonitor :: proc(monitor: c.int) --- // Set monitor for the current window
|
||||
SetWindowMinSize :: proc(width, height: c.int) --- // Set window minimum dimensions (for FLAG_WINDOW_RESIZABLE)
|
||||
SetWindowMaxSize :: proc(width, height: c.int) --- // Set window maximum dimensions (for FLAG_WINDOW_RESIZABLE)
|
||||
SetWindowSize :: proc(width, height: c.int) --- // Set window dimensions
|
||||
SetWindowOpacity :: proc(opacity: f32) --- // Set window opacity [0.0f..1.0f] (only PLATFORM_DESKTOP)
|
||||
SetWindowFocused :: proc() --- // Set window focused (only PLATFORM_DESKTOP)
|
||||
GetWindowHandle :: proc() -> rawptr --- // Get native window handle
|
||||
GetScreenWidth :: proc() -> c.int --- // Get current screen width
|
||||
GetScreenHeight :: proc() -> c.int --- // Get current screen height
|
||||
@@ -971,7 +994,7 @@ foreign lib {
|
||||
GetMonitorRefreshRate :: proc(monitor: c.int) -> c.int --- // Get specified monitor refresh rate
|
||||
GetWindowPosition :: proc() -> Vector2 --- // Get window position XY on monitor
|
||||
GetWindowScaleDPI :: proc() -> Vector2 --- // Get window scale DPI factor
|
||||
GetMonitorName :: proc(monitor: c.int) -> cstring --- // Get the human-readable, UTF-8 encoded name of the primary monitor
|
||||
GetMonitorName :: proc(monitor: c.int) -> cstring --- // Get the human-readable, UTF-8 encoded name of the specified monitor
|
||||
SetClipboardText :: proc(text: cstring) --- // Set clipboard text content
|
||||
GetClipboardText :: proc() -> cstring --- // Get clipboard text content
|
||||
EnableEventWaiting :: proc() --- // Enable waiting for events on EndDrawing(), no automatic event polling
|
||||
@@ -980,7 +1003,7 @@ foreign lib {
|
||||
|
||||
// Custom frame control functions
|
||||
// NOTE: Those functions are intended for advance users that want full control over the frame processing
|
||||
// By default EndDrawing() does this job: draws everything + SwapScreenBuffer() + manage frame timming + PollInputEvents()
|
||||
// By default EndDrawing() does this job: draws everything + SwapScreenBuffer() + manage frame timing + PollInputEvents()
|
||||
// To avoid that behaviour and control frame processes manually, enable in config.h: SUPPORT_CUSTOM_FRAME_CONTROL
|
||||
|
||||
SwapScreenBuffer :: proc() --- // Swap back buffer with front buffer (screen drawing)
|
||||
@@ -1053,21 +1076,26 @@ foreign lib {
|
||||
GetFrameTime :: proc() -> f32 --- // Returns time in seconds for last frame drawn (delta time)
|
||||
GetTime :: proc() -> f64 --- // Returns elapsed time in seconds since InitWindow()
|
||||
|
||||
// Misc. functions
|
||||
// Random value generation functions
|
||||
|
||||
GetRandomValue :: proc(min, max: c.int) -> c.int --- // Returns a random value between min and max (both included)
|
||||
SetRandomSeed :: proc(seed: c.uint) --- // Set the seed for the random number generator
|
||||
SetRandomSeed :: proc(seed: c.uint) --- // Set the seed for the random number generator
|
||||
GetRandomValue :: proc(min, max: c.int) -> c.int --- // Get a random value between min and max (both included)
|
||||
LoadRandomSequence :: proc(count : c.uint, min, max: c.int) --- // Load random values sequence, no values repeated
|
||||
UnloadRandomSequence :: proc(sequence : ^c.int) --- // Unload random values sequence
|
||||
|
||||
// Misc. functions
|
||||
TakeScreenshot :: proc(fileName: cstring) --- // Takes a screenshot of current screen (filename extension defines format)
|
||||
SetConfigFlags :: proc(flags: ConfigFlags) --- // Setup init configuration flags (view FLAGS)
|
||||
OpenURL :: proc(url: cstring) --- // Open URL with default system browser (if available)
|
||||
|
||||
// NOTE: Following functions implemented in module [utils]
|
||||
//------------------------------------------------------------------
|
||||
TraceLog :: proc(logLevel: TraceLogLevel, text: cstring, #c_vararg args: ..any) --- // Show trace log messages (LOG_DEBUG, LOG_INFO, LOG_WARNING, LOG_ERROR)
|
||||
SetTraceLogLevel :: proc(logLevel: TraceLogLevel) --- // Set the current threshold (minimum) log level
|
||||
MemAlloc :: proc(size: c.uint) -> rawptr --- // Internal memory allocator
|
||||
MemRealloc :: proc(ptr: rawptr, size: c.uint) -> rawptr --- // Internal memory reallocator
|
||||
MemFree :: proc(ptr: rawptr) --- // Internal memory free
|
||||
|
||||
OpenURL :: proc(url: cstring) --- // Open URL with default system browser (if available)
|
||||
|
||||
// Set custom callbacks
|
||||
// WARNING: Callbacks setup is intended for advance users
|
||||
|
||||
@@ -1079,13 +1107,16 @@ foreign lib {
|
||||
|
||||
// Files management functions
|
||||
|
||||
LoadFileData :: proc(fileName: cstring, bytesRead: ^c.uint) -> [^]byte --- // Load file data as byte array (read)
|
||||
UnloadFileData :: proc(data: [^]byte) --- // Unload file data allocated by LoadFileData()
|
||||
SaveFileData :: proc(fileName: cstring, data: rawptr, bytesToWrite: c.uint) -> bool --- // Save data to file from byte array (write), returns true on success
|
||||
ExportDataAsCode :: proc(data: rawptr, size: c.uint, fileName: cstring) -> bool --- // Export data to code (.h), returns true on success
|
||||
LoadFileText :: proc(fileName: cstring) -> [^]byte --- // Load text data from file (read), returns a '\0' terminated string
|
||||
UnloadFileText :: proc(text: [^]byte) --- // Unload file text data allocated by LoadFileText()
|
||||
SaveFileText :: proc(fileName: cstring, text: [^]byte) -> bool --- // Save text data to file (write), string must be '\0' terminated, returns true on success
|
||||
LoadFileData :: proc(fileName: cstring, dataSize: ^c.int) -> [^]byte --- // Load file data as byte array (read)
|
||||
UnloadFileData :: proc(data: [^]byte) --- // Unload file data allocated by LoadFileData()
|
||||
SaveFileData :: proc(fileName: cstring, data: rawptr, dataSize: c.int) -> bool --- // Save data to file from byte array (write), returns true on success
|
||||
ExportDataAsCode :: proc(data: rawptr, dataSize: c.int, fileName: cstring) -> bool --- // Export data to code (.h), returns true on success
|
||||
LoadFileText :: proc(fileName: cstring) -> [^]byte --- // Load text data from file (read), returns a '\0' terminated string
|
||||
UnloadFileText :: proc(text: [^]byte) --- // Unload file text data allocated by LoadFileText()
|
||||
SaveFileText :: proc(fileName: cstring, text: [^]byte) -> bool --- // Save text data to file (write), string must be '\0' terminated, returns true on success
|
||||
|
||||
// File system functions
|
||||
|
||||
FileExists :: proc(fileName: cstring) -> bool --- // Check if file exists
|
||||
DirectoryExists :: proc(dirPath: cstring) -> bool --- // Check if a directory path exists
|
||||
IsFileExtension :: proc(fileName, ext: cstring) -> bool --- // Check file extension (including point: .png, .wav)
|
||||
@@ -1096,7 +1127,7 @@ foreign lib {
|
||||
GetDirectoryPath :: proc(filePath: cstring) -> cstring --- // Get full path for a given fileName with path (uses static string)
|
||||
GetPrevDirectoryPath :: proc(dirPath: cstring) -> cstring --- // Get previous directory path for a given path (uses static string)
|
||||
GetWorkingDirectory :: proc() -> cstring --- // Get current working directory (uses static string)
|
||||
GetApplicationDirectory :: proc() -> cstring --- // Get the directory if the running application (uses static string)
|
||||
GetApplicationDirectory :: proc() -> cstring --- // Get the directory of the running application (uses static string)
|
||||
ChangeDirectory :: proc(dir: cstring) -> bool --- // Change working directory, return true on success
|
||||
IsPathFile :: proc(path: cstring) -> bool --- // Check if a given path is a file or a directory
|
||||
LoadDirectoryFiles :: proc(dirPath: cstring) -> FilePathList --- // Load directory filepaths
|
||||
@@ -1114,19 +1145,31 @@ foreign lib {
|
||||
EncodeDataBase64 :: proc(data: rawptr, dataSize: c.int, outputSize: ^c.int) -> [^]byte --- // Encode data to Base64 string, memory must be MemFree()
|
||||
DecodeDataBase64 :: proc(data: rawptr, outputSize: ^c.int) -> [^]byte --- // Decode Base64 string data, memory must be MemFree()
|
||||
|
||||
// Automation events functionality
|
||||
|
||||
LoadAutomationEventList :: proc(fileName: cstring) -> AutomationEventList --- // Load automation events list from file, NULL for empty list, capacity = MAX_AUTOMATION_EVENTS
|
||||
UnloadAutomationEventList :: proc(list: ^AutomationEventList) --- // Unload automation events list from file
|
||||
ExportAutomationEventList :: proc(list: AutomationEventList, fileName: cstring) -> bool --- // Export automation events list as text file
|
||||
SetAutomationEventList :: proc(list: ^AutomationEventList) --- // Set automation event list to record to
|
||||
SetAutomationEventBaseFrame :: proc(frame: c.int) --- // Set automation event internal base frame to start recording
|
||||
StartAutomationEventRecording :: proc() --- // Start recording automation events (AutomationEventList must be set)
|
||||
StopAutomationEventRecording :: proc() --- // Stop recording automation events
|
||||
PlayAutomationEvent :: proc(event: AutomationEvent) --- // Play a recorded automation event
|
||||
|
||||
//------------------------------------------------------------------------------------
|
||||
// Input Handling Functions (Module: core)
|
||||
//------------------------------------------------------------------------------------
|
||||
|
||||
// Input-related functions: keyboard
|
||||
|
||||
IsKeyPressed :: proc(key: KeyboardKey) -> bool --- // Detect if a key has been pressed once
|
||||
IsKeyDown :: proc(key: KeyboardKey) -> bool --- // Detect if a key is being pressed
|
||||
IsKeyReleased :: proc(key: KeyboardKey) -> bool --- // Detect if a key has been released once
|
||||
IsKeyUp :: proc(key: KeyboardKey) -> bool --- // Detect if a key is NOT being pressed
|
||||
SetExitKey :: proc(key: KeyboardKey) --- // Set a custom key to exit program (default is ESC)
|
||||
GetKeyPressed :: proc() -> KeyboardKey --- // Get key pressed (keycode), call it multiple times for keys queued
|
||||
GetCharPressed :: proc() -> rune --- // Get char pressed (unicode), call it multiple times for chars queued
|
||||
IsKeyPressed :: proc(key: KeyboardKey) -> bool --- // Detect if a key has been pressed once
|
||||
IsKeyPressedRepeat :: proc(key: KeyboardKey) -> bool --- // Check if a key has been pressed again (Only PLATFORM_DESKTOP)
|
||||
IsKeyDown :: proc(key: KeyboardKey) -> bool --- // Detect if a key is being pressed
|
||||
IsKeyReleased :: proc(key: KeyboardKey) -> bool --- // Detect if a key has been released once
|
||||
IsKeyUp :: proc(key: KeyboardKey) -> bool --- // Detect if a key is NOT being pressed
|
||||
GetKeyPressed :: proc() -> KeyboardKey --- // Get key pressed (keycode), call it multiple times for keys queued
|
||||
GetCharPressed :: proc() -> rune --- // Get char pressed (unicode), call it multiple times for chars queued
|
||||
SetExitKey :: proc(key: KeyboardKey) --- // Set a custom key to exit program (default is ESC)
|
||||
|
||||
// Input-related functions: gamepads
|
||||
|
||||
@@ -1146,7 +1189,12 @@ foreign lib {
|
||||
IsMouseButtonPressed :: proc(button: MouseButton) -> bool --- // Detect if a mouse button has been pressed once
|
||||
IsMouseButtonDown :: proc(button: MouseButton) -> bool --- // Detect if a mouse button is being pressed
|
||||
IsMouseButtonReleased :: proc(button: MouseButton) -> bool --- // Detect if a mouse button has been released once
|
||||
IsMouseButtonUp :: proc(button: MouseButton) -> bool --- // Detect if a mouse button is NOT being pressed
|
||||
|
||||
when VERSION != "5.0" {
|
||||
#panic("IsMouseButtonUp was broken in Raylib 5.0 but should be fixed in Raylib > 5.0. Remove this panic and the when block around it and also remove the workaround version of IsMouseButtonUp just after the end of the 'foreign lib {' block.")
|
||||
IsMouseButtonUp :: proc(button: MouseButton) -> bool ---
|
||||
}
|
||||
|
||||
GetMouseX :: proc() -> c.int --- // Returns mouse position X
|
||||
GetMouseY :: proc() -> c.int --- // Returns mouse position Y
|
||||
GetMousePosition :: proc() -> Vector2 --- // Returns mouse position XY
|
||||
@@ -1200,18 +1248,17 @@ foreign lib {
|
||||
DrawPixel :: proc(posX, posY: c.int, color: Color) --- // Draw a pixel
|
||||
DrawPixelV :: proc(position: Vector2, color: Color) --- // Draw a pixel (Vector version)
|
||||
DrawLine :: proc(startPosX, startPosY, endPosX, endPosY: c.int, color: Color) --- // Draw a line
|
||||
DrawLineV :: proc(startPos, endPos: Vector2, color: Color) --- // Draw a line (Vector version)
|
||||
DrawLineEx :: proc(startPos, endPos: Vector2, thick: f32, color: Color) --- // Draw a line defining thickness
|
||||
DrawLineBezier :: proc(startPos, endPos: Vector2, thick: f32, color: Color) --- // Draw a line using cubic-bezier curves in-out
|
||||
DrawLineBezierQuad :: proc(startPos, endPos: Vector2, controlPos: Vector2, thick: f32, color: Color) --- // Draw line using quadratic bezier curves with a control point
|
||||
DrawLineBezierCubic :: proc(startPos, endPos: Vector2, startControlPos, endControlPos: Vector2, thick: f32, color: Color) --- // Draw line using cubic bezier curves with 2 control points
|
||||
DrawLineStrip :: proc(points: [^]Vector2, pointCount: c.int, color: Color) --- // Draw lines sequence
|
||||
DrawLineV :: proc(startPos, endPos: Vector2, color: Color) --- // Draw a line (using gl lines)
|
||||
DrawLineEx :: proc(startPos, endPos: Vector2, thick: f32, color: Color) --- // Draw a line (using triangles/quads)
|
||||
DrawLineStrip :: proc(points: [^]Vector2, pointCount: c.int, color: Color) --- // Draw lines sequence (using gl lines)
|
||||
DrawLineBezier :: proc(startPos, endPos: Vector2, thick: f32, color: Color) --- // Draw line segment cubic-bezier in-out interpolation
|
||||
DrawCircle :: proc(centerX, centerY: c.int, radius: f32, color: Color) --- // Draw a color-filled circle
|
||||
DrawCircleSector :: proc(center: Vector2, radius: f32, startAngle, endAngle: f32, segments: c.int, color: Color) --- // Draw a piece of a circle
|
||||
DrawCircleSectorLines :: proc(center: Vector2, radius: f32, startAngle, endAngle: f32, segments: c.int, color: Color) --- // Draw circle sector outline
|
||||
DrawCircleGradient :: proc(centerX, centerY: c.int, radius: f32, color1, color2: Color) --- // Draw a gradient-filled circle
|
||||
DrawCircleV :: proc(center: Vector2, radius: f32, color: Color) --- // Draw a color-filled circle (Vector version)
|
||||
DrawCircleLines :: proc(centerX, centerY: c.int, radius: f32, color: Color) --- // Draw circle outline
|
||||
DrawCircleLinesV :: proc(center: Vector2, radius: f32, color: Color) --- // Draw circle outline (Vector version)
|
||||
DrawEllipse :: proc(centerX, centerY: c.int, radiusH, radiusV: f32, color: Color) --- // Draw ellipse
|
||||
DrawEllipseLines :: proc(centerX, centerY: c.int, radiusH, radiusV: f32, color: Color) --- // Draw ellipse outline
|
||||
DrawRing :: proc(center: Vector2, innerRadius, outerRadius: f32, startAngle, endAngle: f32, segments: c.int, color: Color) --- // Draw ring
|
||||
@@ -1235,6 +1282,24 @@ foreign lib {
|
||||
DrawPolyLines :: proc(center: Vector2, sides: c.int, radius: f32, rotation: f32, color: Color) --- // Draw a polygon outline of n sides
|
||||
DrawPolyLinesEx :: proc(center: Vector2, sides: c.int, radius: f32, rotation: f32, lineThick: f32, color: Color) --- // Draw a polygon outline of n sides with extended parameters
|
||||
|
||||
// Splines drawing functions
|
||||
DrawSplineLinear :: proc(points: [^]Vector2, pointCount: c.int, thick: f32, color: Color) --- // Draw spline: Linear, minimum 2 points
|
||||
DrawSplineBasis :: proc(points: [^]Vector2, pointCount: c.int, thick: f32, color: Color) --- // Draw spline: B-Spline, minimum 4 points
|
||||
DrawSplineCatmullRom :: proc(points: [^]Vector2, pointCount: c.int, thick: f32, color: Color) --- // Draw spline: Catmull-Rom, minimum 4 points
|
||||
DrawSplineBezierQuadratic :: proc(points: [^]Vector2, pointCount: c.int, thick: f32, color: Color) --- // Draw spline: Quadratic Bezier, minimum 3 points (1 control point): [p1, c2, p3, c4...]
|
||||
DrawSplineBezierCubic :: proc(points: [^]Vector2, pointCount: c.int, thick: f32, color: Color) --- // Draw spline: Cubic Bezier, minimum 4 points (2 control points): [p1, c2, c3, p4, c5, c6...]
|
||||
DrawSplineSegmentLinear :: proc(p1, p2: Vector2, thick: f32, color: Color) --- // Draw spline segment: Linear, 2 points
|
||||
DrawSplineSegmentBasis :: proc(p1, p2, p3, p4: Vector2, thick: f32, color: Color) --- // Draw spline segment: B-Spline, 4 points
|
||||
DrawSplineSegmentCatmullRom :: proc(p1, p2, p3, p4: Vector2, thick: f32, color: Color) --- // Draw spline segment: Catmull-Rom, 4 points
|
||||
DrawSplineSegmentBezierQuadratic :: proc(p1, c2, p3: Vector2, thick: f32, color: Color) --- // Draw spline segment: Quadratic Bezier, 2 points, 1 control point
|
||||
DrawSplineSegmentBezierCubic :: proc(p1, c2, c3, p4: Vector2, thick: f32, color: Color) --- // Draw spline segment: Cubic Bezier, 2 points, 2 control points
|
||||
|
||||
// Spline segment point evaluation functions, for a given t [0.0f .. 1.0f]
|
||||
GetSplinePointLinear :: proc(startPos, endPos: Vector2, t: f32) -> Vector2 --- // Get (evaluate) spline point: Linear
|
||||
GetSplinePointBasis :: proc(p1, p2, p3, p4: Vector2, t: f32) -> Vector2 --- // Get (evaluate) spline point: B-Spline
|
||||
GetSplinePointCatmullRom :: proc(p1, p2, p3, p4: Vector2, t: f32) -> Vector2 --- // Get (evaluate) spline point: Catmull-Rom
|
||||
GetSplinePointBezierQuad :: proc(p1, c2, p3: Vector2, t: f32) -> Vector2 --- // Get (evaluate) spline point: Quadratic Bezier
|
||||
GetSplinePointBezierCubic :: proc(p1, c2, c3, p4: Vector2, t: f32) -> Vector2 --- // Get (evaluate) spline point: Cubic Bezier
|
||||
// Basic shapes collision detection functions
|
||||
CheckCollisionRecs :: proc(rec1, rec2: Rectangle) -> bool --- // Check collision between two rectangles
|
||||
CheckCollisionCircles :: proc(center1: Vector2, radius1: f32, center2: Vector2, radius2: f32) -> bool --- // Check collision between two circles
|
||||
@@ -1254,6 +1319,7 @@ foreign lib {
|
||||
|
||||
LoadImage :: proc(fileName: cstring) -> Image --- // Load image from file into CPU memory (RAM)
|
||||
LoadImageRaw :: proc(fileName: cstring, width, height: c.int, format: PixelFormat, headerSize: c.int) -> Image --- // Load image from RAW file data
|
||||
LoadImageSvg :: proc(fileNameOrString: cstring, width, height: c.int) -> Image --- // Load image from SVG file data or string with specified size
|
||||
LoadImageAnim :: proc(fileName: cstring, frames: [^]c.int) -> Image --- // Load image sequence from file (frames appended to image.data)
|
||||
LoadImageFromMemory :: proc(fileType: cstring, fileData: rawptr, dataSize: c.int) -> Image --- // Load image from memory buffer, fileType refers to extension: i.e. '.png'
|
||||
LoadImageFromTexture :: proc(texture: Texture2D) -> Image --- // Load image from GPU texture data
|
||||
@@ -1261,14 +1327,15 @@ foreign lib {
|
||||
IsImageReady :: proc(image: Image) -> bool --- // Check if an image is ready
|
||||
UnloadImage :: proc(image: Image) --- // Unload image from CPU memory (RAM)
|
||||
ExportImage :: proc(image: Image, fileName: cstring) -> bool --- // Export image data to file, returns true on success
|
||||
ExportImageToMemory :: proc(image: Image, fileType: cstring, fileSize: ^c.int) -> rawptr --- // Export image to memory buffer
|
||||
ExportImageAsCode :: proc(image: Image, fileName: cstring) -> bool --- // Export image as code file defining an array of bytes, returns true on success
|
||||
|
||||
// Image generation functions
|
||||
|
||||
GenImageColor :: proc(width, height: c.int, color: Color) -> Image --- // Generate image: plain color
|
||||
GenImageGradientV :: proc(width, height: c.int, top, bottom: Color) -> Image --- // Generate image: vertical gradient
|
||||
GenImageGradientH :: proc(width, height: c.int, left, right: Color) -> Image --- // Generate image: horizontal gradient
|
||||
GenImageGradientLinear :: proc(width, height, direction: c.int, start, end: Color) -> Image --- // Generate image: linear gradient, direction in degrees [0..360], 0=Vertical gradient
|
||||
GenImageGradientRadial :: proc(width, height: c.int, density: f32, inner, outer: Color) -> Image --- // Generate image: radial gradient
|
||||
GenImageGradientSquare :: proc(width, height: c.int, density: f32, inner, outer: Color) -> Image --- // Generate image: square gradient
|
||||
GenImageChecked :: proc(width, height: c.int, checksX, checksY: c.int, col1, col2: Color) -> Image --- // Generate image: checked
|
||||
GenImageWhiteNoise :: proc(width, height: c.int, factor: f32) -> Image --- // Generate image: white noise
|
||||
GenImagePerlinNoise :: proc(width, height: c.int, offsetX, offsetY: c.int, scale: f32) -> Image --- // Generate image: perlin noise
|
||||
@@ -1296,6 +1363,7 @@ foreign lib {
|
||||
ImageDither :: proc(image: ^Image, rBpp, gBpp, bBpp, aBpp: c.int) --- // Dither image data to 16bpp or lower (Floyd-Steinberg dithering)
|
||||
ImageFlipVertical :: proc(image: ^Image) --- // Flip image vertically
|
||||
ImageFlipHorizontal :: proc(image: ^Image) --- // Flip image horizontally
|
||||
ImageRotate :: proc(image: ^Image, degrees: c.int) --- // Rotate image by input angle in degrees( -359 to 359)
|
||||
ImageRotateCW :: proc(image: ^Image) --- // Rotate image clockwise 90deg
|
||||
ImageRotateCCW :: proc(image: ^Image) --- // Rotate image counter-clockwise 90deg
|
||||
ImageColorTint :: proc(image: ^Image, color: Color) --- // Modify image color: tint
|
||||
@@ -1386,34 +1454,35 @@ foreign lib {
|
||||
|
||||
// Font loading/unloading functions
|
||||
|
||||
GetFontDefault :: proc() -> Font --- // Get the default Font
|
||||
LoadFont :: proc(fileName: cstring) -> Font --- // Load font from file into GPU memory (VRAM)
|
||||
LoadFontEx :: proc(fileName: cstring, fontSize: c.int, fontChars: [^]rune, glyphCount: c.int) -> Font --- // Load font from file with extended parameters, use NULL for fontChars and 0 for glyphCount to load the default character set
|
||||
LoadFontFromImage :: proc(image: Image, key: Color, firstChar: rune) -> Font --- // Load font from Image (XNA style)
|
||||
LoadFontFromMemory :: proc(fileType: cstring, fileData: rawptr, dataSize: c.int, fontSize: c.int, fontChars: [^]rune, glyphCount: c.int) -> Font --- // Load font from memory buffer, fileType refers to extension: i.e. '.ttf'
|
||||
IsFontReady :: proc(font: Font) -> bool --- // Check if a font is ready
|
||||
LoadFontData :: proc(fileData: rawptr, dataSize: c.int, fontSize: c.int, fontChars: [^]rune, glyphCount: c.int, type: FontType) -> [^]GlyphInfo --- // Load font data for further use
|
||||
GenImageFontAtlas :: proc(chars: [^]GlyphInfo, recs: ^[^]Rectangle, glyphCount: c.int, fontSize: c.int, padding: c.int, packMethod: c.int) -> Image --- // Generate image font atlas using chars info
|
||||
UnloadFontData :: proc(chars: [^]GlyphInfo, glyphCount: c.int) --- // Unload font chars info data (RAM)
|
||||
UnloadFont :: proc(font: Font) --- // Unload font from GPU memory (VRAM)
|
||||
ExportFontAsCode :: proc(font: Font, fileName: cstring) -> bool --- // Export font as code file, returns true on success
|
||||
GetFontDefault :: proc() -> Font --- // Get the default Font
|
||||
LoadFont :: proc(fileName: cstring) -> Font --- // Load font from file into GPU memory (VRAM)
|
||||
LoadFontEx :: proc(fileName: cstring, fontSize: c.int, codepoints: [^]rune, codepointCount: c.int) -> Font --- // Load font from file with extended parameters, use NULL for codepoints and 0 for codepointCount to load the default character set
|
||||
LoadFontFromImage :: proc(image: Image, key: Color, firstChar: rune) -> Font --- // Load font from Image (XNA style)
|
||||
LoadFontFromMemory :: proc(fileType: cstring, fileData: rawptr, dataSize: c.int, fontSize: c.int, codepoints: [^]rune, codepointCount: c.int) -> Font --- // Load font from memory buffer, fileType refers to extension: i.e. '.ttf'
|
||||
IsFontReady :: proc(font: Font) -> bool --- // Check if a font is ready
|
||||
LoadFontData :: proc(fileData: rawptr, dataSize: c.int, fontSize: c.int, codepoints: [^]rune, codepointCount: c.int, type: FontType) -> [^]GlyphInfo --- // Load font data for further use
|
||||
GenImageFontAtlas :: proc(glyphs: [^]GlyphInfo, glyphRecs: ^[^]Rectangle, codepointCount: c.int, fontSize: c.int, padding: c.int, packMethod: c.int) -> Image --- // Generate image font atlas using chars info
|
||||
UnloadFontData :: proc(glyphs: [^]GlyphInfo, glyphCount: c.int) --- // Unload font chars info data (RAM)
|
||||
UnloadFont :: proc(font: Font) --- // Unload font from GPU memory (VRAM)
|
||||
ExportFontAsCode :: proc(font: Font, fileName: cstring) -> bool --- // Export font as code file, returns true on success
|
||||
|
||||
// Text drawing functions
|
||||
|
||||
DrawFPS :: proc(posX, posY: c.int) --- // Draw current FPS
|
||||
DrawText :: proc(text: cstring, posX, posY: c.int, fontSize: c.int, color: Color) --- // Draw text (using default font)
|
||||
DrawTextEx :: proc(font: Font, text: cstring, position: Vector2, fontSize: f32, spacing: f32, tint: Color) --- // Draw text using font and additional parameters
|
||||
DrawTextPro :: proc(font: Font, text: cstring, position, origin: Vector2, rotation: f32, fontSize: f32, spacing: f32, tint: Color) --- // Draw text using Font and pro parameters (rotation)
|
||||
DrawTextCodepoint :: proc(font: Font, codepoint: rune, position: Vector2, fontSize: f32, tint: Color) --- // Draw one character (codepoint)
|
||||
DrawTextCodepoints :: proc(font: Font, codepoints: [^]rune, count: c.int, position: Vector2, fontSize: f32, spacing: f32, tint: Color) --- // Draw multiple character (codepoint)
|
||||
DrawFPS :: proc(posX, posY: c.int) --- // Draw current FPS
|
||||
DrawText :: proc(text: cstring, posX, posY: c.int, fontSize: c.int, color: Color) --- // Draw text (using default font)
|
||||
DrawTextEx :: proc(font: Font, text: cstring, position: Vector2, fontSize: f32, spacing: f32, tint: Color) --- // Draw text using font and additional parameters
|
||||
DrawTextPro :: proc(font: Font, text: cstring, position, origin: Vector2, rotation: f32, fontSize: f32, spacing: f32, tint: Color) --- // Draw text using Font and pro parameters (rotation)
|
||||
DrawTextCodepoint :: proc(font: Font, codepoint: rune, position: Vector2, fontSize: f32, tint: Color) --- // Draw one character (codepoint)
|
||||
DrawTextCodepoints :: proc(font: Font, codepoints: [^]rune, codepointCount: c.int, position: Vector2, fontSize: f32, spacing: f32, tint: Color) --- // Draw multiple character (codepoint)
|
||||
|
||||
// Text font info functions
|
||||
|
||||
MeasureText :: proc(text: cstring, fontSize: c.int) -> c.int --- // Measure string width for default font
|
||||
MeasureTextEx :: proc(font: Font, text: cstring, fontSize: f32, spacing: f32) -> Vector2 --- // Measure string size for Font
|
||||
GetGlyphIndex :: proc(font: Font, codepoint: rune) -> c.int --- // Get glyph index position in font for a codepoint (unicode character), fallback to '?' if not found
|
||||
GetGlyphInfo :: proc(font: Font, codepoint: rune) -> GlyphInfo --- // Get glyph font info data for a codepoint (unicode character), fallback to '?' if not found
|
||||
GetGlyphAtlasRec :: proc(font: Font, codepoint: rune) -> Rectangle --- // Get glyph rectangle in font atlas for a codepoint (unicode character), fallback to '?' if not found
|
||||
SetTextLineSpacing :: proc(spacing: c.int) --- // Set vertical line spacing when drawing with line-breaks
|
||||
MeasureText :: proc(text: cstring, fontSize: c.int) -> c.int --- // Measure string width for default font
|
||||
MeasureTextEx :: proc(font: Font, text: cstring, fontSize: f32, spacing: f32) -> Vector2 --- // Measure string size for Font
|
||||
GetGlyphIndex :: proc(font: Font, codepoint: rune) -> c.int --- // Get glyph index position in font for a codepoint (unicode character), fallback to '?' if not found
|
||||
GetGlyphInfo :: proc(font: Font, codepoint: rune) -> GlyphInfo --- // Get glyph font info data for a codepoint (unicode character), fallback to '?' if not found
|
||||
GetGlyphAtlasRec :: proc(font: Font, codepoint: rune) -> Rectangle --- // Get glyph rectangle in font atlas for a codepoint (unicode character), fallback to '?' if not found
|
||||
|
||||
// Text codepoints management functions (unicode characters)
|
||||
|
||||
@@ -1536,10 +1605,10 @@ foreign lib {
|
||||
|
||||
// Model animations loading/unloading functions
|
||||
|
||||
LoadModelAnimations :: proc(fileName: cstring, animCount: ^c.uint) -> [^]ModelAnimation --- // Load model animations from file
|
||||
LoadModelAnimations :: proc(fileName: cstring, animCount: ^c.int) -> [^]ModelAnimation --- // Load model animations from file
|
||||
UpdateModelAnimation :: proc(model: Model, anim: ModelAnimation, frame: c.int) --- // Update model animation pose
|
||||
UnloadModelAnimation :: proc(anim: ModelAnimation) --- // Unload animation data
|
||||
UnloadModelAnimations :: proc(animations: [^]ModelAnimation, count: c.uint) --- // Unload animation array data
|
||||
UnloadModelAnimations :: proc(animations: [^]ModelAnimation, animCount: c.int) --- // Unload animation array data
|
||||
IsModelAnimationValid :: proc(model: Model, anim: ModelAnimation) -> bool --- // Check model animation skeleton match
|
||||
|
||||
// Collision detection functions
|
||||
@@ -1563,6 +1632,7 @@ foreign lib {
|
||||
CloseAudioDevice :: proc() --- // Close the audio device and context
|
||||
IsAudioDeviceReady :: proc() -> bool --- // Check if audio device has been initialized successfully
|
||||
SetMasterVolume :: proc(volume: f32) --- // Set master volume (listener)
|
||||
GetMasterVolume :: proc() -> f32 --- // Get master volume (listener)
|
||||
|
||||
// Wave/Sound loading/unloading functions
|
||||
|
||||
@@ -1571,10 +1641,12 @@ foreign lib {
|
||||
IsWaveReady :: proc(wave: Wave) -> bool --- // Checks if wave data is ready
|
||||
LoadSound :: proc(fileName: cstring) -> Sound --- // Load sound from file
|
||||
LoadSoundFromWave :: proc(wave: Wave) -> Sound --- // Load sound from wave data
|
||||
LoadSoundAlias :: proc(source: Sound) -> Sound --- // Create a new sound that shares the same sample data as the source sound, does not own the sound data
|
||||
IsSoundReady :: proc(sound: Sound) -> bool --- // Checks if a sound is ready
|
||||
UpdateSound :: proc(sound: Sound, data: rawptr, sampleCount: c.int) --- // Update sound buffer with new data
|
||||
UpdateSound :: proc(sound: Sound, data: rawptr, frameCount: c.int) --- // Update sound buffer with new data
|
||||
UnloadWave :: proc(wave: Wave) --- // Unload wave data
|
||||
UnloadSound :: proc(sound: Sound) --- // Unload sound
|
||||
UnloadSoundAlias :: proc(alias: Sound) --- // Unload a sound alias (does not deallocate sample data)
|
||||
ExportWave :: proc(wave: Wave, fileName: cstring) -> bool --- // Export wave data to file, returns true on success
|
||||
ExportWaveAsCode :: proc(wave: Wave, fileName: cstring) -> bool --- // Export wave sample data to code (.h), returns true on success
|
||||
|
||||
@@ -1594,6 +1666,7 @@ foreign lib {
|
||||
LoadWaveSamples :: proc(wave: Wave) -> [^]f32 --- // Load samples data from wave as a 32bit float data array
|
||||
UnloadWaveSamples :: proc(samples: [^]f32) --- // Unload samples data loaded with LoadWaveSamples()
|
||||
|
||||
|
||||
// Music management functions
|
||||
|
||||
LoadMusicStream :: proc(fileName: cstring) -> Music --- // Load music stream from file
|
||||
@@ -1631,14 +1704,21 @@ foreign lib {
|
||||
SetAudioStreamBufferSizeDefault :: proc(size: c.int) --- // Default size for new audio streams
|
||||
SetAudioStreamCallback :: proc(stream: AudioStream, callback: AudioCallback) --- // Audio thread callback to request new data
|
||||
|
||||
AttachAudioStreamProcessor :: proc(stream: AudioStream, processor: AudioCallback) --- // Attach audio stream processor to stream
|
||||
AttachAudioStreamProcessor :: proc(stream: AudioStream, processor: AudioCallback) --- // Attach audio stream processor to stream, receives the samples as <float>s
|
||||
DetachAudioStreamProcessor :: proc(stream: AudioStream, processor: AudioCallback) --- // Detach audio stream processor from stream
|
||||
|
||||
AttachAudioMixedProcessor :: proc(processor: AudioCallback) --- // Attach audio stream processor to the entire audio pipeline
|
||||
AttachAudioMixedProcessor :: proc(processor: AudioCallback) --- // Attach audio stream processor to the entire audio pipeline, receives the samples as <float>s
|
||||
DetachAudioMixedProcessor :: proc(processor: AudioCallback) --- // Detach audio stream processor from the entire audio pipeline
|
||||
}
|
||||
|
||||
|
||||
// Workaround for broken IsMouseButtonUp in Raylib 5.0.
|
||||
when VERSION == "5.0" {
|
||||
IsMouseButtonUp :: proc(button: MouseButton) -> bool {
|
||||
return !IsMouseButtonDown(button)
|
||||
}
|
||||
} else {
|
||||
#panic("Remove this this when block and everything inside it for Raylib > 5.0. It's just here to fix a bug in Raylib 5.0. See IsMouseButtonUp inside 'foreign lib {' block.")
|
||||
}
|
||||
|
||||
// Text formatting with variables (sprintf style)
|
||||
TextFormat :: proc(text: cstring, args: ..any) -> cstring {
|
||||
|
||||
Vendored
+84
-73
@@ -1,83 +1,84 @@
|
||||
/**********************************************************************************************
|
||||
*
|
||||
* rlgl v4.5 - A multi-OpenGL abstraction layer with an immediate-mode style API
|
||||
* rlgl v5.0 - A multi-OpenGL abstraction layer with an immediate-mode style API
|
||||
*
|
||||
* An abstraction layer for multiple OpenGL versions (1.1, 2.1, 3.3 Core, 4.3 Core, ES 2.0)
|
||||
* that provides a pseudo-OpenGL 1.1 immediate-mode style API (rlVertex, rlTranslate, rlRotate...)
|
||||
* DESCRIPTION:
|
||||
* An abstraction layer for multiple OpenGL versions (1.1, 2.1, 3.3 Core, 4.3 Core, ES 2.0)
|
||||
* that provides a pseudo-OpenGL 1.1 immediate-mode style API (rlVertex, rlTranslate, rlRotate...)
|
||||
*
|
||||
* When choosing an OpenGL backend different than OpenGL 1.1, some internal buffer are
|
||||
* initialized on rlglInit() to accumulate vertex data.
|
||||
* ADDITIONAL NOTES:
|
||||
* When choosing an OpenGL backend different than OpenGL 1.1, some internal buffer are
|
||||
* initialized on rlglInit() to accumulate vertex data.
|
||||
*
|
||||
* When an internal state change is required all the stored vertex data is renderer in batch,
|
||||
* additionally, rlDrawRenderBatchActive() could be called to force flushing of the batch.
|
||||
* When an internal state change is required all the stored vertex data is renderer in batch,
|
||||
* additionally, rlDrawRenderBatchActive() could be called to force flushing of the batch.
|
||||
*
|
||||
* Some additional resources are also loaded for convenience, here the complete list:
|
||||
* - Default batch (RLGL.defaultBatch): RenderBatch system to accumulate vertex data
|
||||
* - Default texture (RLGL.defaultTextureId): 1x1 white pixel R8G8B8A8
|
||||
* - Default shader (RLGL.State.defaultShaderId, RLGL.State.defaultShaderLocs)
|
||||
*
|
||||
* Internal buffer (and additional resources) must be manually unloaded calling rlglClose().
|
||||
* Some resources are also loaded for convenience, here the complete list:
|
||||
* - Default batch (RLGL.defaultBatch): RenderBatch system to accumulate vertex data
|
||||
* - Default texture (RLGL.defaultTextureId): 1x1 white pixel R8G8B8A8
|
||||
* - Default shader (RLGL.State.defaultShaderId, RLGL.State.defaultShaderLocs)
|
||||
*
|
||||
* Internal buffer (and resources) must be manually unloaded calling rlglClose().
|
||||
*
|
||||
* CONFIGURATION:
|
||||
* #define GRAPHICS_API_OPENGL_11
|
||||
* #define GRAPHICS_API_OPENGL_21
|
||||
* #define GRAPHICS_API_OPENGL_33
|
||||
* #define GRAPHICS_API_OPENGL_43
|
||||
* #define GRAPHICS_API_OPENGL_ES2
|
||||
* #define GRAPHICS_API_OPENGL_ES3
|
||||
* Use selected OpenGL graphics backend, should be supported by platform
|
||||
* Those preprocessor defines are only used on rlgl module, if OpenGL version is
|
||||
* required by any other module, use rlGetVersion() to check it
|
||||
*
|
||||
* #define GRAPHICS_API_OPENGL_11
|
||||
* #define GRAPHICS_API_OPENGL_21
|
||||
* #define GRAPHICS_API_OPENGL_33
|
||||
* #define GRAPHICS_API_OPENGL_43
|
||||
* #define GRAPHICS_API_OPENGL_ES2
|
||||
* Use selected OpenGL graphics backend, should be supported by platform
|
||||
* Those preprocessor defines are only used on rlgl module, if OpenGL version is
|
||||
* required by any other module, use rlGetVersion() to check it
|
||||
* #define RLGL_IMPLEMENTATION
|
||||
* Generates the implementation of the library into the included file.
|
||||
* If not defined, the library is in header only mode and can be included in other headers
|
||||
* or source files without problems. But only ONE file should hold the implementation.
|
||||
*
|
||||
* #define RLGL_IMPLEMENTATION
|
||||
* Generates the implementation of the library into the included file.
|
||||
* If not defined, the library is in header only mode and can be included in other headers
|
||||
* or source files without problems. But only ONE file should hold the implementation.
|
||||
* #define RLGL_RENDER_TEXTURES_HINT
|
||||
* Enable framebuffer objects (fbo) support (enabled by default)
|
||||
* Some GPUs could not support them despite the OpenGL version
|
||||
*
|
||||
* #define RLGL_RENDER_TEXTURES_HINT
|
||||
* Enable framebuffer objects (fbo) support (enabled by default)
|
||||
* Some GPUs could not support them despite the OpenGL version
|
||||
* #define RLGL_SHOW_GL_DETAILS_INFO
|
||||
* Show OpenGL extensions and capabilities detailed logs on init
|
||||
*
|
||||
* #define RLGL_SHOW_GL_DETAILS_INFO
|
||||
* Show OpenGL extensions and capabilities detailed logs on init
|
||||
* #define RLGL_ENABLE_OPENGL_DEBUG_CONTEXT
|
||||
* Enable debug context (only available on OpenGL 4.3)
|
||||
*
|
||||
* #define RLGL_ENABLE_OPENGL_DEBUG_CONTEXT
|
||||
* Enable debug context (only available on OpenGL 4.3)
|
||||
* rlgl capabilities could be customized just defining some internal
|
||||
* values before library inclusion (default values listed):
|
||||
*
|
||||
* rlgl capabilities could be customized just defining some internal
|
||||
* values before library inclusion (default values listed):
|
||||
* #define RL_DEFAULT_BATCH_BUFFER_ELEMENTS 8192 // Default internal render batch elements limits
|
||||
* #define RL_DEFAULT_BATCH_BUFFERS 1 // Default number of batch buffers (multi-buffering)
|
||||
* #define RL_DEFAULT_BATCH_DRAWCALLS 256 // Default number of batch draw calls (by state changes: mode, texture)
|
||||
* #define RL_DEFAULT_BATCH_MAX_TEXTURE_UNITS 4 // Maximum number of textures units that can be activated on batch drawing (SetShaderValueTexture())
|
||||
*
|
||||
* #define RL_DEFAULT_BATCH_BUFFER_ELEMENTS 8192 // Default internal render batch elements limits
|
||||
* #define RL_DEFAULT_BATCH_BUFFERS 1 // Default number of batch buffers (multi-buffering)
|
||||
* #define RL_DEFAULT_BATCH_DRAWCALLS 256 // Default number of batch draw calls (by state changes: mode, texture)
|
||||
* #define RL_DEFAULT_BATCH_MAX_TEXTURE_UNITS 4 // Maximum number of textures units that can be activated on batch drawing (SetShaderValueTexture())
|
||||
* #define RL_MAX_MATRIX_STACK_SIZE 32 // Maximum size of internal Matrix stack
|
||||
* #define RL_MAX_SHADER_LOCATIONS 32 // Maximum number of shader locations supported
|
||||
* #define RL_CULL_DISTANCE_NEAR 0.01 // Default projection matrix near cull distance
|
||||
* #define RL_CULL_DISTANCE_FAR 1000.0 // Default projection matrix far cull distance
|
||||
*
|
||||
* #define RL_MAX_MATRIX_STACK_SIZE 32 // Maximum size of internal Matrix stack
|
||||
* #define RL_MAX_SHADER_LOCATIONS 32 // Maximum number of shader locations supported
|
||||
* #define RL_CULL_DISTANCE_NEAR 0.01 // Default projection matrix near cull distance
|
||||
* #define RL_CULL_DISTANCE_FAR 1000.0 // Default projection matrix far cull distance
|
||||
* When loading a shader, the following vertex attributes and uniform
|
||||
* location names are tried to be set automatically:
|
||||
*
|
||||
* When loading a shader, the following vertex attribute and uniform
|
||||
* location names are tried to be set automatically:
|
||||
*
|
||||
* #define RL_DEFAULT_SHADER_ATTRIB_NAME_POSITION "vertexPosition" // Bound by default to shader location: 0
|
||||
* #define RL_DEFAULT_SHADER_ATTRIB_NAME_TEXCOORD "vertexTexCoord" // Bound by default to shader location: 1
|
||||
* #define RL_DEFAULT_SHADER_ATTRIB_NAME_NORMAL "vertexNormal" // Bound by default to shader location: 2
|
||||
* #define RL_DEFAULT_SHADER_ATTRIB_NAME_COLOR "vertexColor" // Bound by default to shader location: 3
|
||||
* #define RL_DEFAULT_SHADER_ATTRIB_NAME_TANGENT "vertexTangent" // Bound by default to shader location: 4
|
||||
* #define RL_DEFAULT_SHADER_UNIFORM_NAME_MVP "mvp" // model-view-projection matrix
|
||||
* #define RL_DEFAULT_SHADER_UNIFORM_NAME_VIEW "matView" // view matrix
|
||||
* #define RL_DEFAULT_SHADER_UNIFORM_NAME_PROJECTION "matProjection" // projection matrix
|
||||
* #define RL_DEFAULT_SHADER_UNIFORM_NAME_MODEL "matModel" // model matrix
|
||||
* #define RL_DEFAULT_SHADER_UNIFORM_NAME_NORMAL "matNormal" // normal matrix (transpose(inverse(matModelView))
|
||||
* #define RL_DEFAULT_SHADER_UNIFORM_NAME_COLOR "colDiffuse" // color diffuse (base tint color, multiplied by texture color)
|
||||
* #define RL_DEFAULT_SHADER_SAMPLER2D_NAME_TEXTURE0 "texture0" // texture0 (texture slot active 0)
|
||||
* #define RL_DEFAULT_SHADER_SAMPLER2D_NAME_TEXTURE1 "texture1" // texture1 (texture slot active 1)
|
||||
* #define RL_DEFAULT_SHADER_SAMPLER2D_NAME_TEXTURE2 "texture2" // texture2 (texture slot active 2)
|
||||
* #define RL_DEFAULT_SHADER_ATTRIB_NAME_POSITION "vertexPosition" // Bound by default to shader location: 0
|
||||
* #define RL_DEFAULT_SHADER_ATTRIB_NAME_TEXCOORD "vertexTexCoord" // Bound by default to shader location: 1
|
||||
* #define RL_DEFAULT_SHADER_ATTRIB_NAME_NORMAL "vertexNormal" // Bound by default to shader location: 2
|
||||
* #define RL_DEFAULT_SHADER_ATTRIB_NAME_COLOR "vertexColor" // Bound by default to shader location: 3
|
||||
* #define RL_DEFAULT_SHADER_ATTRIB_NAME_TANGENT "vertexTangent" // Bound by default to shader location: 4
|
||||
* #define RL_DEFAULT_SHADER_ATTRIB_NAME_TEXCOORD2 "vertexTexCoord2" // Bound by default to shader location: 5
|
||||
* #define RL_DEFAULT_SHADER_UNIFORM_NAME_MVP "mvp" // model-view-projection matrix
|
||||
* #define RL_DEFAULT_SHADER_UNIFORM_NAME_VIEW "matView" // view matrix
|
||||
* #define RL_DEFAULT_SHADER_UNIFORM_NAME_PROJECTION "matProjection" // projection matrix
|
||||
* #define RL_DEFAULT_SHADER_UNIFORM_NAME_MODEL "matModel" // model matrix
|
||||
* #define RL_DEFAULT_SHADER_UNIFORM_NAME_NORMAL "matNormal" // normal matrix (transpose(inverse(matModelView))
|
||||
* #define RL_DEFAULT_SHADER_UNIFORM_NAME_COLOR "colDiffuse" // color diffuse (base tint color, multiplied by texture color)
|
||||
* #define RL_DEFAULT_SHADER_SAMPLER2D_NAME_TEXTURE0 "texture0" // texture0 (texture slot active 0)
|
||||
* #define RL_DEFAULT_SHADER_SAMPLER2D_NAME_TEXTURE1 "texture1" // texture1 (texture slot active 1)
|
||||
* #define RL_DEFAULT_SHADER_SAMPLER2D_NAME_TEXTURE2 "texture2" // texture2 (texture slot active 2)
|
||||
*
|
||||
* DEPENDENCIES:
|
||||
*
|
||||
* - OpenGL libraries (depending on platform and OpenGL version selected)
|
||||
* - GLAD OpenGL extensions loading library (only for OpenGL 3.3 Core, 4.3 Core)
|
||||
*
|
||||
@@ -108,6 +109,8 @@ package raylib
|
||||
|
||||
import "core:c"
|
||||
|
||||
RLGL_VERSION :: "4.5"
|
||||
|
||||
when ODIN_OS == .Windows {
|
||||
foreign import lib {
|
||||
"windows/raylib.lib",
|
||||
@@ -143,7 +146,12 @@ RL_GRAPHICS_API_OPENGL_21 :: true
|
||||
RL_GRAPHICS_API_OPENGL_33 :: RL_GRAPHICS_API_OPENGL_21 // default currently
|
||||
RL_GRAPHICS_API_OPENGL_ES2 :: false
|
||||
RL_GRAPHICS_API_OPENGL_43 :: false
|
||||
RL_GRAPHICS_API_OPENGL_ES3 :: false
|
||||
|
||||
when RL_GRAPHICS_API_OPENGL_ES3 {
|
||||
RL_GRAPHICS_API_OPENGL_ES2 :: true
|
||||
}
|
||||
|
||||
when !RL_GRAPHICS_API_OPENGL_ES2 {
|
||||
// This is the maximum amount of elements (quads) per batch
|
||||
// NOTE: Be careful with text, every letter maps to a quad
|
||||
@@ -300,6 +308,7 @@ GlVersion :: enum c.int {
|
||||
OPENGL_33, // OpenGL 3.3 (GLSL 330)
|
||||
OPENGL_43, // OpenGL 4.3 (using GLSL 330)
|
||||
OPENGL_ES_20, // OpenGL ES 2.0 (GLSL 100)
|
||||
OPENGL_ES_30, // OpenGL ES 3.0 (GLSL 300 es)
|
||||
}
|
||||
|
||||
|
||||
@@ -315,13 +324,13 @@ ShaderAttributeDataType :: enum c.int {
|
||||
// NOTE: By default up to 8 color channels defined, but it can be more
|
||||
FramebufferAttachType :: enum c.int {
|
||||
COLOR_CHANNEL0 = 0, // Framebuffer attachment type: color 0
|
||||
COLOR_CHANNEL1, // Framebuffer attachment type: color 1
|
||||
COLOR_CHANNEL2, // Framebuffer attachment type: color 2
|
||||
COLOR_CHANNEL3, // Framebuffer attachment type: color 3
|
||||
COLOR_CHANNEL4, // Framebuffer attachment type: color 4
|
||||
COLOR_CHANNEL5, // Framebuffer attachment type: color 5
|
||||
COLOR_CHANNEL6, // Framebuffer attachment type: color 6
|
||||
COLOR_CHANNEL7, // Framebuffer attachment type: color 7
|
||||
COLOR_CHANNEL1 = 1, // Framebuffer attachment type: color 1
|
||||
COLOR_CHANNEL2 = 2, // Framebuffer attachment type: color 2
|
||||
COLOR_CHANNEL3 = 3, // Framebuffer attachment type: color 3
|
||||
COLOR_CHANNEL4 = 4, // Framebuffer attachment type: color 4
|
||||
COLOR_CHANNEL5 = 5, // Framebuffer attachment type: color 5
|
||||
COLOR_CHANNEL6 = 6, // Framebuffer attachment type: color 6
|
||||
COLOR_CHANNEL7 = 7, // Framebuffer attachment type: color 7
|
||||
DEPTH = 100, // Framebuffer attachment type: depth
|
||||
STENCIL = 200, // Framebuffer attachment type: stencil
|
||||
}
|
||||
@@ -329,11 +338,11 @@ FramebufferAttachType :: enum c.int {
|
||||
// Framebuffer texture attachment type
|
||||
FramebufferAttachTextureType :: enum c.int {
|
||||
CUBEMAP_POSITIVE_X = 0, // Framebuffer texture attachment type: cubemap, +X side
|
||||
CUBEMAP_NEGATIVE_X, // Framebuffer texture attachment type: cubemap, -X side
|
||||
CUBEMAP_POSITIVE_Y, // Framebuffer texture attachment type: cubemap, +Y side
|
||||
CUBEMAP_NEGATIVE_Y, // Framebuffer texture attachment type: cubemap, -Y side
|
||||
CUBEMAP_POSITIVE_Z, // Framebuffer texture attachment type: cubemap, +Z side
|
||||
CUBEMAP_NEGATIVE_Z, // Framebuffer texture attachment type: cubemap, -Z side
|
||||
CUBEMAP_NEGATIVE_X = 1, // Framebuffer texture attachment type: cubemap, -X side
|
||||
CUBEMAP_POSITIVE_Y = 2, // Framebuffer texture attachment type: cubemap, +Y side
|
||||
CUBEMAP_NEGATIVE_Y = 3, // Framebuffer texture attachment type: cubemap, -Y side
|
||||
CUBEMAP_POSITIVE_Z = 4, // Framebuffer texture attachment type: cubemap, +Z side
|
||||
CUBEMAP_NEGATIVE_Z = 5, // Framebuffer texture attachment type: cubemap, -Z side
|
||||
TEXTURE2D = 100, // Framebuffer texture attachment type: texture2d
|
||||
RENDERBUFFER = 200, // Framebuffer texture attachment type: renderbuffer
|
||||
}
|
||||
@@ -411,6 +420,7 @@ foreign lib {
|
||||
rlEnableFramebuffer :: proc(id: c.uint) --- // Enable render texture (fbo)
|
||||
rlDisableFramebuffer :: proc() --- // Disable render texture (fbo), return to default framebuffer
|
||||
rlActiveDrawBuffers :: proc(count: c.int) --- // Activate multiple draw color buffers
|
||||
rlBlitFramebuffer :: proc(srcX, srcY, srcWidth, srcHeight, dstX, dstY, dstWidth, dstHeight, bufferMask: c.int) --- // Blit active framebuffer to main framebuffer
|
||||
|
||||
// General render state
|
||||
rlDisableColorBlend :: proc() --- // Disable color blending
|
||||
@@ -425,7 +435,8 @@ foreign lib {
|
||||
rlDisableScissorTest :: proc() --- // Disable scissor test
|
||||
rlScissor :: proc(x, y, width, height: c.int) --- // Scissor test
|
||||
rlEnableWireMode :: proc() --- // Enable wire mode
|
||||
rlDisableWireMode :: proc() --- // Disable wire mode
|
||||
rlEnablePointMode :: proc() --- // Enable point mode
|
||||
rlDisableWireMode :: proc() --- // Disable wire and point modes
|
||||
rlSetLineWidth :: proc(width: f32) --- // Set the line drawing width
|
||||
rlGetLineWidth :: proc() -> f32 --- // Get the line drawing width
|
||||
rlEnableSmoothLines :: proc() --- // Enable line aliasing
|
||||
|
||||
Vendored
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
Reference in New Issue
Block a user