bring log allocator up to date

This commit is contained in:
Colin Davidson
2024-01-17 13:11:10 -08:00
263 changed files with 32404 additions and 25810 deletions
+1
View File
@@ -1 +1,2 @@
*.odin linguist-language=Odin *.odin linguist-language=Odin
* text=auto
+1 -1
View File
@@ -163,7 +163,7 @@ jobs:
run: | run: |
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat
cd tests\documentation cd tests\documentation
call build.bat rem call build.bat
timeout-minutes: 10 timeout-minutes: 10
- name: core:math/big tests - name: core:math/big tests
shell: cmd shell: cmd
+5
View File
@@ -47,6 +47,8 @@ tests/core/test_linalg_glsl_math
tests/core/test_noise tests/core/test_noise
tests/core/test_varint tests/core/test_varint
tests/core/test_xml tests/core/test_xml
tests/core/test_core_slice
tests/core/test_core_thread
tests/vendor/vendor_botan tests/vendor/vendor_botan
# Visual Studio 2015 cache/options directory # Visual Studio 2015 cache/options directory
.vs/ .vs/
@@ -312,3 +314,6 @@ shared/
examples/bug/ examples/bug/
build.sh build.sh
!core/debug/ !core/debug/
# RAD debugger project file
*.raddbg
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
+1 -1
View File
@@ -110,7 +110,7 @@ typeid_of :: proc($T: typeid) -> typeid ---
swizzle :: proc(x: [N]T, indices: ..int) -> [len(indices)]T --- swizzle :: proc(x: [N]T, indices: ..int) -> [len(indices)]T ---
complex :: proc(real, imag: Float) -> Complex_Type --- complex :: proc(real, imag: Float) -> Complex_Type ---
quaternion :: proc(real, imag, jmag, kmag: Float) -> Quaternion_Type --- quaternion :: proc(imag, jmag, kmag, real: Float) -> Quaternion_Type --- // fields must be named
real :: proc(value: Complex_Or_Quaternion) -> Float --- real :: proc(value: Complex_Or_Quaternion) -> Float ---
imag :: proc(value: Complex_Or_Quaternion) -> Float --- imag :: proc(value: Complex_Or_Quaternion) -> Float ---
jmag :: proc(value: Quaternion) -> Float --- jmag :: proc(value: Quaternion) -> Float ---
+1 -1
View File
@@ -895,7 +895,7 @@ split_multi_iterator :: proc(s: ^[]byte, substrs: [][]byte, skip_empty := false)
// scrub scruvs invalid utf-8 characters and replaces them with the replacement string // Scrubs invalid utf-8 characters and replaces them with the replacement string
// Adjacent invalid bytes are only replaced once // Adjacent invalid bytes are only replaced once
scrub :: proc(s: []byte, replacement: []byte, allocator := context.allocator) -> []byte { scrub :: proc(s: []byte, replacement: []byte, allocator := context.allocator) -> []byte {
str := s str := s
+101
View File
@@ -1,5 +1,7 @@
package libc package libc
import "core:io"
when ODIN_OS == .Windows { when ODIN_OS == .Windows {
foreign import libc { foreign import libc {
"system:libucrt.lib", "system:libucrt.lib",
@@ -218,3 +220,102 @@ foreign libc {
ferror :: proc(stream: ^FILE) -> int --- ferror :: proc(stream: ^FILE) -> int ---
perror :: proc(s: cstring) --- perror :: proc(s: cstring) ---
} }
to_stream :: proc(file: ^FILE) -> io.Stream {
stream_proc :: proc(stream_data: rawptr, mode: io.Stream_Mode, p: []byte, offset: i64, whence: io.Seek_From) -> (n: i64, err: io.Error) {
unknown_or_eof :: proc(f: ^FILE) -> io.Error {
switch {
case ferror(f) != 0:
return .Unknown
case feof(f) != 0:
return .EOF
case:
return nil
}
}
file := (^FILE)(stream_data)
switch mode {
case .Close:
if fclose(file) != 0 {
return 0, unknown_or_eof(file)
}
case .Flush:
if fflush(file) != 0 {
return 0, unknown_or_eof(file)
}
case .Read:
n = i64(fread(raw_data(p), size_of(byte), len(p), file))
if n == 0 { err = unknown_or_eof(file) }
case .Read_At:
curr := ftell(file)
if curr == -1 {
return 0, unknown_or_eof(file)
}
if fseek(file, long(offset), SEEK_SET) != 0 {
return 0, unknown_or_eof(file)
}
defer fseek(file, long(curr), SEEK_SET)
n = i64(fread(raw_data(p), size_of(byte), len(p), file))
if n == 0 { err = unknown_or_eof(file) }
case .Write:
n = i64(fwrite(raw_data(p), size_of(byte), len(p), file))
if n == 0 { err = unknown_or_eof(file) }
case .Write_At:
curr := ftell(file)
if curr == -1 {
return 0, unknown_or_eof(file)
}
if fseek(file, long(offset), SEEK_SET) != 0 {
return 0, unknown_or_eof(file)
}
defer fseek(file, long(curr), SEEK_SET)
n = i64(fwrite(raw_data(p), size_of(byte), len(p), file))
if n == 0 { err = unknown_or_eof(file) }
case .Seek:
if fseek(file, long(offset), int(whence)) != 0 {
return 0, unknown_or_eof(file)
}
case .Size:
curr := ftell(file)
if curr == -1 {
return 0, unknown_or_eof(file)
}
defer fseek(file, curr, SEEK_SET)
if fseek(file, 0, SEEK_END) != 0 {
return 0, unknown_or_eof(file)
}
n = i64(ftell(file))
if n == -1 {
return 0, unknown_or_eof(file)
}
case .Destroy:
return 0, .Empty
case .Query:
return io.query_utility({ .Close, .Flush, .Read, .Read_At, .Write, .Write_At, .Seek, .Size })
}
return
}
return {
data = file,
procedure = stream_proc,
}
}
+31 -41
View File
@@ -20,10 +20,9 @@ import "core:runtime"
*/ */
/*
When a decompression routine doesn't stream its output, but writes to a buffer, // When a decompression routine doesn't stream its output, but writes to a buffer,
we pre-allocate an output buffer to speed up decompression. The default is 1 MiB. // we pre-allocate an output buffer to speed up decompression. The default is 1 MiB.
*/
COMPRESS_OUTPUT_ALLOCATE_MIN :: int(#config(COMPRESS_OUTPUT_ALLOCATE_MIN, 1 << 20)) COMPRESS_OUTPUT_ALLOCATE_MIN :: int(#config(COMPRESS_OUTPUT_ALLOCATE_MIN, 1 << 20))
/* /*
@@ -34,16 +33,14 @@ COMPRESS_OUTPUT_ALLOCATE_MIN :: int(#config(COMPRESS_OUTPUT_ALLOCATE_MIN, 1 << 2
*/ */
when size_of(uintptr) == 8 { when size_of(uintptr) == 8 {
/*
For 64-bit platforms, we set the default max buffer size to 4 GiB, // For 64-bit platforms, we set the default max buffer size to 4 GiB,
which is GZIP and PKZIP's max payload size. // which is GZIP and PKZIP's max payload size.
*/
COMPRESS_OUTPUT_ALLOCATE_MAX :: int(#config(COMPRESS_OUTPUT_ALLOCATE_MAX, 1 << 32)) COMPRESS_OUTPUT_ALLOCATE_MAX :: int(#config(COMPRESS_OUTPUT_ALLOCATE_MAX, 1 << 32))
} else { } else {
/*
For 32-bit platforms, we set the default max buffer size to 512 MiB. // For 32-bit platforms, we set the default max buffer size to 512 MiB.
*/ COMPRESS_OUTPUT_ALLOCATE_MAX :: int(#config(COMPRESS_OUTPUT_ALLOCATE_MAX, 1 << 29))
COMPRESS_OUTPUT_ALLOCATE_MAX :: int(#config(COMPRESS_OUTPUT_ALLOCATE_MAX, 1 << 29))
} }
@@ -69,9 +66,8 @@ General_Error :: enum {
Incompatible_Options, Incompatible_Options,
Unimplemented, Unimplemented,
/* // Memory errors
Memory errors
*/
Allocation_Failed, Allocation_Failed,
Resize_Failed, Resize_Failed,
} }
@@ -86,17 +82,16 @@ GZIP_Error :: enum {
Payload_Length_Invalid, Payload_Length_Invalid,
Payload_CRC_Invalid, Payload_CRC_Invalid,
/* // GZIP's payload can be a maximum of max(u32le), or 4 GiB.
GZIP's payload can be a maximum of max(u32le), or 4 GiB. // If you tell it you expect it to contain more, that's obviously an error.
If you tell it you expect it to contain more, that's obviously an error.
*/
Payload_Size_Exceeds_Max_Payload, Payload_Size_Exceeds_Max_Payload,
/*
For buffered instead of streamed output, the payload size can't exceed // For buffered instead of streamed output, the payload size can't exceed
the max set by the `COMPRESS_OUTPUT_ALLOCATE_MAX` switch in compress/common.odin. // the max set by the `COMPRESS_OUTPUT_ALLOCATE_MAX` switch in compress/common.odin.
//
// You can tweak this setting using `-define:COMPRESS_OUTPUT_ALLOCATE_MAX=size_in_bytes`
You can tweak this setting using `-define:COMPRESS_OUTPUT_ALLOCATE_MAX=size_in_bytes`
*/
Output_Exceeds_COMPRESS_OUTPUT_ALLOCATE_MAX, Output_Exceeds_COMPRESS_OUTPUT_ALLOCATE_MAX,
} }
@@ -137,9 +132,8 @@ Context_Memory_Input :: struct #packed {
code_buffer: u64, code_buffer: u64,
num_bits: u64, num_bits: u64,
/* // If we know the data size, we can optimize the reads and writes.
If we know the data size, we can optimize the reads and writes.
*/
size_packed: i64, size_packed: i64,
size_unpacked: i64, size_unpacked: i64,
} }
@@ -159,18 +153,16 @@ Context_Stream_Input :: struct #packed {
code_buffer: u64, code_buffer: u64,
num_bits: u64, num_bits: u64,
/* // If we know the data size, we can optimize the reads and writes.
If we know the data size, we can optimize the reads and writes.
*/
size_packed: i64, size_packed: i64,
size_unpacked: i64, size_unpacked: i64,
/* // Flags:
Flags: // `input_fully_in_memory`
`input_fully_in_memory` // true = This tells us we read input from `input_data` exclusively. [] = EOF.
true = This tells us we read input from `input_data` exclusively. [] = EOF. // false = Try to refill `input_data` from the `input` stream.
false = Try to refill `input_data` from the `input` stream.
*/
input_fully_in_memory: b8, input_fully_in_memory: b8,
padding: [1]u8, padding: [1]u8,
@@ -214,7 +206,7 @@ read_slice_from_memory :: #force_inline proc(z: ^Context_Memory_Input, size: int
@(optimization_mode="speed") @(optimization_mode="speed")
read_slice_from_stream :: #force_inline proc(z: ^Context_Stream_Input, size: int) -> (res: []u8, err: io.Error) { read_slice_from_stream :: #force_inline proc(z: ^Context_Stream_Input, size: int) -> (res: []u8, err: io.Error) {
// TODO: REMOVE ALL USE OF context.temp_allocator here // TODO: REMOVE ALL USE OF context.temp_allocator here
// the is literally no need for it // there is literally no need for it
b := make([]u8, size, context.temp_allocator) b := make([]u8, size, context.temp_allocator)
_ = io.read(z.input, b[:]) or_return _ = io.read(z.input, b[:]) or_return
return b, nil return b, nil
@@ -248,10 +240,8 @@ read_u8_from_stream :: #force_inline proc(z: ^Context_Stream_Input) -> (res: u8,
read_u8 :: proc{read_u8_from_memory, read_u8_from_stream} read_u8 :: proc{read_u8_from_memory, read_u8_from_stream}
/* // You would typically only use this at the end of Inflate, to drain bits from the code buffer
You would typically only use this at the end of Inflate, to drain bits from the code buffer // preferentially.
preferentially.
*/
@(optimization_mode="speed") @(optimization_mode="speed")
read_u8_prefer_code_buffer_lsb :: #force_inline proc(z: ^$C) -> (res: u8, err: io.Error) { read_u8_prefer_code_buffer_lsb :: #force_inline proc(z: ^$C) -> (res: u8, err: io.Error) {
if z.num_bits >= 8 { if z.num_bits >= 8 {
@@ -140,3 +140,18 @@ remove :: proc(pq: ^$Q/Priority_Queue($T), i: int) -> (value: T, ok: bool) {
return return
} }
peek_safe :: proc(pq: $Q/Priority_Queue($T), loc := #caller_location) -> (res: T, ok: bool) {
if builtin.len(pq.queue) > 0 {
return pq.queue[0], true
}
return
}
peek :: proc(pq: $Q/Priority_Queue($T), loc := #caller_location) -> (res: T) {
assert(condition=builtin.len(pq.queue)>0, loc=loc)
if builtin.len(pq.queue) > 0 {
return pq.queue[0]
}
return
}
+5 -1
View File
@@ -1,7 +1,11 @@
//+build ignore
/* /*
Package core:dynlib implements loading of shared libraries/DLLs and their symbols. Package core:dynlib implements loading of shared libraries/DLLs and their symbols.
The behaviour of dynamically loaded libraries is specific to the target platform of the program. The behaviour of dynamically loaded libraries is specific to the target platform of the program.
For in depth detail on the underlying behaviour please refer to your target platform's documentation. For in depth detail on the underlying behaviour please refer to your target platform's documentation.
See `example` directory for an example library exporting 3 symbols and a host program loading them automatically
by defining a symbol table struct.
*/ */
package dynlib package dynlib
+36
View File
@@ -0,0 +1,36 @@
package example
import "core:dynlib"
import "core:fmt"
Symbols :: struct {
// `foo_` is prefixed, so we look for the symbol `foo_add`.
add: proc "c" (int, int) -> int,
// We use the tag here to override the symbol to look for, namely `bar_sub`.
sub: proc "c" (int, int) -> int `dynlib:"bar_sub"`,
// Exported global (if exporting an i32, the type must be ^i32 because the symbol is a pointer to the export.)
// If it's not a pointer or procedure type, we'll skip the struct field.
hellope: ^i32,
// Handle to free library.
// We can have more than one of these so we can match symbols for more than one DLL with one struct.
_my_lib_handle: dynlib.Library,
}
main :: proc() {
sym: Symbols
// Load symbols from `lib.dll` into Symbols struct.
// Each struct field is prefixed with `foo_` before lookup in the DLL's symbol table.
// The library's Handle (to unload) will be stored in `sym._my_lib_handle`. This way you can load multiple DLLs in one struct.
count, ok := dynlib.initialize_symbols(&sym, "lib.dll", "foo_", "_my_lib_handle")
defer dynlib.unload_library(sym._my_lib_handle)
fmt.printf("ok: %v. %v symbols loaded from lib.dll (%p).\n", ok, count, sym._my_lib_handle)
if count > 0 {
fmt.println("42 + 42 =", sym.add(42, 42))
fmt.println("84 - 13 =", sym.sub(84, 13))
fmt.println("hellope =", sym.hellope^)
}
}
+14
View File
@@ -0,0 +1,14 @@
package library
@(export)
foo_add :: proc "c" (a, b: int) -> (res: int) {
return a + b
}
@(export)
bar_sub :: proc "c" (a, b: int) -> (res: int) {
return a - b
}
@(export)
foo_hellope: i32 = 42
+99 -9
View File
@@ -1,5 +1,12 @@
package dynlib package dynlib
import "core:intrinsics"
import "core:reflect"
import "core:runtime"
_ :: intrinsics
_ :: reflect
_ :: runtime
/* /*
A handle to a dynamically loaded library. A handle to a dynamically loaded library.
*/ */
@@ -12,11 +19,11 @@ library available to resolve references in subsequently loaded libraries.
The paramater `global_symbols` is only used for the platforms `linux`, `darwin`, `freebsd` and `openbsd`. The paramater `global_symbols` is only used for the platforms `linux`, `darwin`, `freebsd` and `openbsd`.
On `windows` this paramater is ignored. On `windows` this paramater is ignored.
The underlying behaviour is platform specific. The underlying behaviour is platform specific.
On `linux`, `darwin`, `freebsd` and `openbsd` refer to `dlopen`. On `linux`, `darwin`, `freebsd` and `openbsd` refer to `dlopen`.
On `windows` refer to `LoadLibraryW`. On `windows` refer to `LoadLibraryW`.
**Implicit Allocators** **Implicit Allocators**
`context.temp_allocator` `context.temp_allocator`
Example: Example:
@@ -27,6 +34,7 @@ Example:
LIBRARY_PATH :: "my_library.dll" LIBRARY_PATH :: "my_library.dll"
library, ok := dynlib.load_library(LIBRARY_PATH) library, ok := dynlib.load_library(LIBRARY_PATH)
if ! ok { if ! ok {
fmt.eprintln(dynlib.last_error())
return return
} }
fmt.println("The library %q was successfully loaded", LIBRARY_PATH) fmt.println("The library %q was successfully loaded", LIBRARY_PATH)
@@ -39,8 +47,8 @@ load_library :: proc(path: string, global_symbols := false) -> (library: Library
/* /*
Unloads a dynamic library. Unloads a dynamic library.
The underlying behaviour is platform specific. The underlying behaviour is platform specific.
On `linux`, `darwin`, `freebsd` and `openbsd` refer to `dlclose`. On `linux`, `darwin`, `freebsd` and `openbsd` refer to `dlclose`.
On `windows` refer to `FreeLibrary`. On `windows` refer to `FreeLibrary`.
Example: Example:
@@ -51,10 +59,12 @@ Example:
LIBRARY_PATH :: "my_library.dll" LIBRARY_PATH :: "my_library.dll"
library, ok := dynlib.load_library(LIBRARY_PATH) library, ok := dynlib.load_library(LIBRARY_PATH)
if ! ok { if ! ok {
fmt.eprintln(dynlib.last_error())
return return
} }
did_unload := dynlib.unload_library(library) did_unload := dynlib.unload_library(library)
if ! did_unload { if ! did_unload {
fmt.eprintln(dynlib.last_error())
return return
} }
fmt.println("The library %q was successfully unloaded", LIBRARY_PATH) fmt.println("The library %q was successfully unloaded", LIBRARY_PATH)
@@ -67,11 +77,11 @@ unload_library :: proc(library: Library) -> (did_unload: bool) {
/* /*
Loads the address of a procedure/variable from a dynamic library. Loads the address of a procedure/variable from a dynamic library.
The underlying behaviour is platform specific. The underlying behaviour is platform specific.
On `linux`, `darwin`, `freebsd` and `openbsd` refer to `dlsym`. On `linux`, `darwin`, `freebsd` and `openbsd` refer to `dlsym`.
On `windows` refer to `GetProcAddress`. On `windows` refer to `GetProcAddress`.
**Implicit Allocators** **Implicit Allocators**
`context.temp_allocator` `context.temp_allocator`
Example: Example:
@@ -82,13 +92,93 @@ Example:
LIBRARY_PATH :: "my_library.dll" LIBRARY_PATH :: "my_library.dll"
library, ok := dynlib.load_library(LIBRARY_PATH) library, ok := dynlib.load_library(LIBRARY_PATH)
if ! ok { if ! ok {
fmt.eprintln(dynlib.last_error())
return return
} }
a, found_a := dynlib.symbol_address(library, "a") a, found_a := dynlib.symbol_address(library, "a")
if found_a do fmt.printf("The symbol %q was found at the address %v", "a", a) if found_a {
fmt.printf("The symbol %q was found at the address %v", "a", a)
} else {
fmt.eprintln(dynlib.last_error())
}
} }
*/ */
symbol_address :: proc(library: Library, symbol: string) -> (ptr: rawptr, found: bool) #optional_ok { symbol_address :: proc(library: Library, symbol: string) -> (ptr: rawptr, found: bool) #optional_ok {
return _symbol_address(library, symbol) return _symbol_address(library, symbol)
} }
/*
Scans a dynamic library for symbols matching a struct's members, assigning found procedure pointers to the corresponding entry.
Optionally takes a symbol prefix added to the struct's member name to construct the symbol looked up in the library.
Optionally also takes the struct member to assign the library handle to, `__handle` by default.
This allows using one struct to hold library handles and symbol pointers for more than 1 dynamic library.
Returns:
* `-1, false` if the library could not be loaded.
* The number of symbols assigned on success. `ok` = true if `count` > 0
See doc.odin for an example.
*/
initialize_symbols :: proc(symbol_table: ^$T, library_name: string, symbol_prefix := "", handle_field_name := "__handle") -> (count: int, ok: bool) where intrinsics.type_is_struct(T) {
assert(symbol_table != nil)
handle: Library
if handle, ok = load_library(library_name); !ok {
return -1, false
}
// `symbol_table` must be a struct because of the where clause, so this can't fail.
ti := runtime.type_info_base(type_info_of(T))
s, _ := ti.variant.(runtime.Type_Info_Struct)
// Buffer to concatenate the prefix + symbol name.
prefixed_symbol_buf: [2048]u8 = ---
sym_ptr: rawptr
for field_name, i in s.names {
// Calculate address of struct member
field_ptr := rawptr(uintptr(rawptr(symbol_table)) + uintptr(s.offsets[i]))
// If we've come across the struct member for the handle, store it and continue scanning for other symbols.
if field_name == handle_field_name {
(^Library)(field_ptr)^ = handle
continue
}
// We're not the library handle, so the field needs to be a pointer type, be it a procedure pointer or an exported global.
if !(reflect.is_procedure(s.types[i]) || reflect.is_pointer(s.types[i])) {
continue
}
// Let's look up or construct the symbol name to find in the library
prefixed_name: string
// Do we have a symbol override tag?
if override, tag_ok := reflect.struct_tag_lookup(reflect.Struct_Tag(s.tags[i]), "dynlib"); tag_ok {
prefixed_name = string(override)
}
// No valid symbol override tag found, fall back to `<symbol_prefix>name`.
if len(prefixed_name) == 0 {
offset := copy(prefixed_symbol_buf[:], symbol_prefix)
copy(prefixed_symbol_buf[offset:], field_name)
prefixed_name = string(prefixed_symbol_buf[:len(symbol_prefix) + len(field_name)])
}
// Assign procedure (or global) pointer if found.
if sym_ptr, ok = symbol_address(handle, prefixed_name); ok {
(^rawptr)(field_ptr)^ = sym_ptr
count += 1
}
}
return count, count > 0
}
/*
Returns an error message for the last failed procedure call.
*/
last_error :: proc() -> string {
return _last_error()
}
+4
View File
@@ -13,3 +13,7 @@ _unload_library :: proc(library: Library) -> bool {
_symbol_address :: proc(library: Library, symbol: string) -> (ptr: rawptr, found: bool) { _symbol_address :: proc(library: Library, symbol: string) -> (ptr: rawptr, found: bool) {
return nil, false return nil, false
} }
_last_error :: proc() -> string {
return ""
}
+5
View File
@@ -22,3 +22,8 @@ _symbol_address :: proc(library: Library, symbol: string) -> (ptr: rawptr, found
found = ptr != nil found = ptr != nil
return return
} }
_last_error :: proc() -> string {
err := os.dlerror()
return "unknown" if err == "" else err
}
+7
View File
@@ -5,6 +5,7 @@ package dynlib
import win32 "core:sys/windows" import win32 "core:sys/windows"
import "core:strings" import "core:strings"
import "core:runtime" import "core:runtime"
import "core:reflect"
_load_library :: proc(path: string, global_symbols := false) -> (Library, bool) { _load_library :: proc(path: string, global_symbols := false) -> (Library, bool) {
// NOTE(bill): 'global_symbols' is here only for consistency with POSIX which has RTLD_GLOBAL // NOTE(bill): 'global_symbols' is here only for consistency with POSIX which has RTLD_GLOBAL
@@ -27,3 +28,9 @@ _symbol_address :: proc(library: Library, symbol: string) -> (ptr: rawptr, found
found = ptr != nil found = ptr != nil
return return
} }
_last_error :: proc() -> string {
err := win32.System_Error(win32.GetLastError())
err_msg := reflect.enum_string(err)
return "unknown" if err_msg == "" else err_msg
}
@@ -47,8 +47,6 @@ _entities :: proc() {
} }
_main :: proc() { _main :: proc() {
using fmt
options := xml.Options{ flags = { .Ignore_Unsupported, .Intern_Comments, .Unbox_CDATA, .Decode_SGML_Entities }} options := xml.Options{ flags = { .Ignore_Unsupported, .Intern_Comments, .Unbox_CDATA, .Decode_SGML_Entities }}
doc, _ := xml.parse(#load("test.html"), options) doc, _ := xml.parse(#load("test.html"), options)
@@ -58,8 +56,6 @@ _main :: proc() {
} }
main :: proc() { main :: proc() {
using fmt
track: mem.Tracking_Allocator track: mem.Tracking_Allocator
mem.tracking_allocator_init(&track, context.allocator) mem.tracking_allocator_init(&track, context.allocator)
context.allocator = mem.tracking_allocator(&track) context.allocator = mem.tracking_allocator(&track)
@@ -68,9 +64,9 @@ main :: proc() {
_entities() _entities()
if len(track.allocation_map) > 0 { if len(track.allocation_map) > 0 {
println() fmt.println()
for _, v in track.allocation_map { 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)
} }
} }
} }
File diff suppressed because it is too large Load Diff
+30 -13
View File
@@ -137,9 +137,9 @@ assign_float :: proc(val: any, f: $T) -> bool {
case complex64: dst = complex(f32(f), 0) case complex64: dst = complex(f32(f), 0)
case complex128: dst = complex(f64(f), 0) case complex128: dst = complex(f64(f), 0)
case quaternion64: dst = quaternion(f16(f), 0, 0, 0) case quaternion64: dst = quaternion(w=f16(f), x=0, y=0, z=0)
case quaternion128: dst = quaternion(f32(f), 0, 0, 0) case quaternion128: dst = quaternion(w=f32(f), x=0, y=0, z=0)
case quaternion256: dst = quaternion(f64(f), 0, 0, 0) case quaternion256: dst = quaternion(w=f64(f), x=0, y=0, z=0)
case: return false case: return false
} }
@@ -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) { unmarshal_value :: proc(p: ^Parser, v: any) -> (err: Unmarshal_Error) {
UNSUPPORTED_TYPE := Unsupported_Type_Error{v.id, p.curr_token} UNSUPPORTED_TYPE := Unsupported_Type_Error{v.id, p.curr_token}
token := p.curr_token token := p.curr_token
v := v v := v
ti := reflect.type_info_base(type_info_of(v.id)) 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 && token.kind != .Null {
if u, ok := ti.variant.(reflect.Type_Info_Union); ok && len(u.variants) == 1 && token.kind != .Null { // NOTE: If it's a union with only one variant, then treat it as that variant
variant := u.variants[0] if len(u.variants) == 1 {
v.id = variant.id variant := u.variants[0]
ti = reflect.type_info_base(variant) v.id = variant.id
if !reflect.is_pointer_internally(variant) { ti = reflect.type_info_base(variant)
tag := any{rawptr(uintptr(v.data) + u.tag_offset), u.tag_type.id} if !reflect.is_pointer_internally(variant) {
assign_int(tag, 1) 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 { switch &dst in v {
// Handle json.Value as an unknown type // Handle json.Value as an unknown type
case Value: case Value:
+4 -2
View File
@@ -1,3 +1,5 @@
package xml
/* /*
An XML 1.0 / 1.1 parser An XML 1.0 / 1.1 parser
@@ -9,7 +11,7 @@
List of contributors: List of contributors:
Jeroen van Rijn: Initial implementation. Jeroen van Rijn: Initial implementation.
*/ */
package xml
import "core:io" import "core:io"
import "core:fmt" import "core:fmt"
@@ -81,4 +83,4 @@ print_element :: proc(writer: io.Writer, doc: ^Document, element_id: Element_ID,
} }
return written, .None return written, .None
} }
+2 -2
View File
@@ -20,7 +20,7 @@ example :: proc() {
xml.destroy(docs[round]) xml.destroy(docs[round])
} }
DOC :: #load("../../../../tests/core/assets/XML/unicode.xml") DOC :: #load("../../../../tests/core/assets/XML/utf8.xml")
input := DOC input := DOC
for round in 0..<N { for round in 0..<N {
@@ -109,4 +109,4 @@ main :: proc() {
} }
} }
println("Done and cleaned up!") println("Done and cleaned up!")
} }
+4 -2
View File
@@ -1,3 +1,5 @@
package xml
/* /*
An XML 1.0 / 1.1 parser An XML 1.0 / 1.1 parser
@@ -6,7 +8,7 @@
This file contains helper functions. This file contains helper functions.
*/ */
package xml
// Find parent's nth child with a given ident. // Find parent's nth child with a given ident.
find_child_by_ident :: proc(doc: ^Document, parent_id: Element_ID, ident: string, nth := 0) -> (res: Element_ID, found: bool) { find_child_by_ident :: proc(doc: ^Document, parent_id: Element_ID, ident: string, nth := 0) -> (res: Element_ID, found: bool) {
@@ -47,4 +49,4 @@ find_attribute_val_by_key :: proc(doc: ^Document, parent_id: Element_ID, key: st
if attr.key == key { return attr.val, true } if attr.key == key { return attr.val, true }
} }
return "", false return "", false
} }
+4 -2
View File
@@ -1,3 +1,5 @@
package xml
/* /*
An XML 1.0 / 1.1 parser An XML 1.0 / 1.1 parser
@@ -9,7 +11,7 @@
List of contributors: List of contributors:
Jeroen van Rijn: Initial implementation. Jeroen van Rijn: Initial implementation.
*/ */
package xml
import "core:fmt" import "core:fmt"
import "core:unicode" import "core:unicode"
@@ -433,4 +435,4 @@ scan :: proc(t: ^Tokenizer) -> Token {
lit = string(t.src[offset : t.offset]) lit = string(t.src[offset : t.offset])
} }
return Token{kind, lit, pos} return Token{kind, lit, pos}
} }
+71 -148
View File
@@ -1,28 +1,28 @@
/* /*
An XML 1.0 / 1.1 parser XML 1.0 / 1.1 parser
Copyright 2021-2022 Jeroen van Rijn <nom@duclavier.com>. 2021-2022 Jeroen van Rijn <nom@duclavier.com>.
Made available under Odin's BSD-3 license. available under Odin's BSD-3 license.
A from-scratch XML implementation, loosely modelled on the [spec](https://www.w3.org/TR/2006/REC-xml11-20060816). from-scratch XML implementation, loosely modelled on the [spec](https://www.w3.org/TR/2006/REC-xml11-20060816).
Features: Features:
- Supports enough of the XML 1.0/1.1 spec to handle the 99.9% of XML documents in common current usage. - Supports enough of the XML 1.0/1.1 spec to handle the 99.9% of XML documents in common current usage.
- Simple to understand and use. Small. - Simple to understand and use. Small.
Caveats: Caveats:
- We do NOT support HTML in this package, as that may or may not be valid XML. - We do NOT support HTML in this package, as that may or may not be valid XML.
If it works, great. If it doesn't, that's not considered a bug. If it works, great. If it doesn't, that's not considered a bug.
- We do NOT support UTF-16. If you have a UTF-16 XML file, please convert it to UTF-8 first. Also, our condolences. - We do NOT support UTF-16. If you have a UTF-16 XML file, please convert it to UTF-8 first. Also, our condolences.
- <[!ELEMENT and <[!ATTLIST are not supported, and will be either ignored or return an error depending on the parser options. - <[!ELEMENT and <[!ATTLIST are not supported, and will be either ignored or return an error depending on the parser options.
MAYBE: MAYBE:
- XML writer? - XML writer?
- Serialize/deserialize Odin types? - Serialize/deserialize Odin types?
List of contributors: List of contributors:
Jeroen van Rijn: Initial implementation. - Jeroen van Rijn: Initial implementation.
*/ */
package xml package xml
// An XML 1.0 / 1.1 parser // An XML 1.0 / 1.1 parser
@@ -43,48 +43,32 @@ DEFAULT_OPTIONS :: Options{
} }
Option_Flag :: enum { Option_Flag :: enum {
/* // If the caller says that input may be modified, we can perform in-situ parsing.
If the caller says that input may be modified, we can perform in-situ parsing. // If this flag isn't provided, the XML parser first duplicates the input so that it can.
If this flag isn't provided, the XML parser first duplicates the input so that it can.
*/
Input_May_Be_Modified, Input_May_Be_Modified,
/* // Document MUST start with `<?xml` prologue.
Document MUST start with `<?xml` prologue.
*/
Must_Have_Prolog, Must_Have_Prolog,
/* // Document MUST have a `<!DOCTYPE`.
Document MUST have a `<!DOCTYPE`.
*/
Must_Have_DocType, Must_Have_DocType,
/* // By default we skip comments. Use this option to intern a comment on a parented Element.
By default we skip comments. Use this option to intern a comment on a parented Element.
*/
Intern_Comments, Intern_Comments,
/* // How to handle unsupported parts of the specification, like <! other than <!DOCTYPE and <![CDATA[
How to handle unsupported parts of the specification, like <! other than <!DOCTYPE and <![CDATA[
*/
Error_on_Unsupported, Error_on_Unsupported,
Ignore_Unsupported, Ignore_Unsupported,
/* // By default CDATA tags are passed-through as-is.
By default CDATA tags are passed-through as-is. // This option unwraps them when encountered.
This option unwraps them when encountered.
*/
Unbox_CDATA, Unbox_CDATA,
/* // By default SGML entities like `&gt;`, `&#32;` and `&#x20;` are passed-through as-is.
By default SGML entities like `&gt;`, `&#32;` and `&#x20;` are passed-through as-is. // This option decodes them when encountered.
This option decodes them when encountered.
*/
Decode_SGML_Entities, Decode_SGML_Entities,
/* // If a tag body has a comment, it will be stripped unless this option is given.
If a tag body has a comment, it will be stripped unless this option is given.
*/
Keep_Tag_Body_Comments, Keep_Tag_Body_Comments,
} }
Option_Flags :: bit_set[Option_Flag; u16] Option_Flags :: bit_set[Option_Flag; u16]
@@ -97,28 +81,20 @@ Document :: struct {
encoding: Encoding, encoding: Encoding,
doctype: struct { doctype: struct {
/* // We only scan the <!DOCTYPE IDENT part and skip the rest.
We only scan the <!DOCTYPE IDENT part and skip the rest.
*/
ident: string, ident: string,
rest: string, rest: string,
}, },
/* // If we encounter comments before the root node, and the option to intern comments is given, this is where they'll live.
If we encounter comments before the root node, and the option to intern comments is given, this is where they'll live. // Otherwise they'll be in the element tree.
Otherwise they'll be in the element tree.
*/
comments: [dynamic]string, comments: [dynamic]string,
/* // Internal
Internal
*/
tokenizer: ^Tokenizer, tokenizer: ^Tokenizer,
allocator: mem.Allocator, allocator: mem.Allocator,
/* // Input. Either the original buffer, or a copy if `.Input_May_Be_Modified` isn't specified.
Input. Either the original buffer, or a copy if `.Input_May_Be_Modified` isn't specified.
*/
input: []u8, input: []u8,
strings_to_free: [dynamic]string, strings_to_free: [dynamic]string,
} }
@@ -158,34 +134,24 @@ Encoding :: enum {
UTF_8, UTF_8,
ISO_8859_1, ISO_8859_1,
/* // Aliases
Aliases
*/
LATIN_1 = ISO_8859_1, LATIN_1 = ISO_8859_1,
} }
Error :: enum { Error :: enum {
/* // General return values.
General return values.
*/
None = 0, None = 0,
General_Error, General_Error,
Unexpected_Token, Unexpected_Token,
Invalid_Token, Invalid_Token,
/* // Couldn't find, open or read file.
Couldn't find, open or read file.
*/
File_Error, File_Error,
/* // File too short.
File too short.
*/
Premature_EOF, Premature_EOF,
/* // XML-specific errors.
XML-specific errors.
*/
No_Prolog, No_Prolog,
Invalid_Prolog, Invalid_Prolog,
Too_Many_Prologs, Too_Many_Prologs,
@@ -194,11 +160,9 @@ Error :: enum {
Too_Many_DocTypes, Too_Many_DocTypes,
DocType_Must_Preceed_Elements, DocType_Must_Preceed_Elements,
/* // If a DOCTYPE is present _or_ the caller
If a DOCTYPE is present _or_ the caller // asked for a specific DOCTYPE and the DOCTYPE
asked for a specific DOCTYPE and the DOCTYPE // and root tag don't match, we return `.Invalid_DocType`.
and root tag don't match, we return `.Invalid_DocType`.
*/
Invalid_DocType, Invalid_DocType,
Invalid_Tag_Value, Invalid_Tag_Value,
@@ -211,27 +175,20 @@ Error :: enum {
Unsupported_Version, Unsupported_Version,
Unsupported_Encoding, Unsupported_Encoding,
/* // <!FOO are usually skipped.
<!FOO are usually skipped.
*/
Unhandled_Bang, Unhandled_Bang,
Duplicate_Attribute, Duplicate_Attribute,
Conflicting_Options, Conflicting_Options,
} }
/*
Implementation starts here.
*/
parse_bytes :: proc(data: []u8, options := DEFAULT_OPTIONS, path := "", error_handler := default_error_handler, allocator := context.allocator) -> (doc: ^Document, err: Error) { parse_bytes :: proc(data: []u8, options := DEFAULT_OPTIONS, path := "", error_handler := default_error_handler, allocator := context.allocator) -> (doc: ^Document, err: Error) {
data := data data := data
context.allocator = allocator context.allocator = allocator
opts := validate_options(options) or_return opts := validate_options(options) or_return
/* // If `.Input_May_Be_Modified` is not specified, we duplicate the input so that we can modify it in-place.
If `.Input_May_Be_Modified` is not specified, we duplicate the input so that we can modify it in-place.
*/
if .Input_May_Be_Modified not_in opts.flags { if .Input_May_Be_Modified not_in opts.flags {
data = bytes.clone(data) data = bytes.clone(data)
} }
@@ -252,10 +209,8 @@ parse_bytes :: proc(data: []u8, options := DEFAULT_OPTIONS, path := "", error_ha
element, parent: Element_ID element, parent: Element_ID
open: Token open: Token
/* // If a DOCTYPE is present, the root tag has to match.
If a DOCTYPE is present, the root tag has to match. // If an expected DOCTYPE is given in options (i.e. it's non-empty), the DOCTYPE (if present) and root tag have to match.
If an expected DOCTYPE is given in options (i.e. it's non-empty), the DOCTYPE (if present) and root tag have to match.
*/
expected_doctype := options.expected_doctype expected_doctype := options.expected_doctype
loop: for { loop: for {
@@ -263,17 +218,13 @@ parse_bytes :: proc(data: []u8, options := DEFAULT_OPTIONS, path := "", error_ha
// NOTE(Jeroen): This is faster as a switch. // NOTE(Jeroen): This is faster as a switch.
switch t.ch { switch t.ch {
case '<': case '<':
/* // Consume peeked `<`
Consume peeked `<`
*/
advance_rune(t) advance_rune(t)
open = scan(t) open = scan(t)
// NOTE(Jeroen): We're not using a switch because this if-else chain ordered by likelihood is 2.5% faster at -o:size and -o:speed. // NOTE(Jeroen): We're not using a switch because this if-else chain ordered by likelihood is 2.5% faster at -o:size and -o:speed.
if likely(open.kind, Token_Kind.Ident) == .Ident { if likely(open.kind, Token_Kind.Ident) == .Ident {
/* // e.g. <odin - Start of new element.
e.g. <odin - Start of new element.
*/
element = new_element(doc) element = new_element(doc)
if element == 0 { // First Element if element == 0 { // First Element
parent = element parent = element
@@ -286,11 +237,9 @@ parse_bytes :: proc(data: []u8, options := DEFAULT_OPTIONS, path := "", error_ha
parse_attributes(doc, &doc.elements[element].attribs) or_return parse_attributes(doc, &doc.elements[element].attribs) or_return
/* // If a DOCTYPE is present _or_ the caller
If a DOCTYPE is present _or_ the caller // asked for a specific DOCTYPE and the DOCTYPE
asked for a specific DOCTYPE and the DOCTYPE // and root tag don't match, we return .Invalid_Root_Tag.
and root tag don't match, we return .Invalid_Root_Tag.
*/
if element == 0 { // Root tag? if element == 0 { // Root tag?
if len(expected_doctype) > 0 && expected_doctype != open.text { if len(expected_doctype) > 0 && expected_doctype != open.text {
error(t, t.offset, "Root Tag doesn't match DOCTYPE. Expected: %v, got: %v\n", expected_doctype, open.text) error(t, t.offset, "Root Tag doesn't match DOCTYPE. Expected: %v, got: %v\n", expected_doctype, open.text)
@@ -298,23 +247,17 @@ parse_bytes :: proc(data: []u8, options := DEFAULT_OPTIONS, path := "", error_ha
} }
} }
/* // One of these should follow:
One of these should follow: // - `>`, which means we've just opened this tag and expect a later element to close it.
- `>`, which means we've just opened this tag and expect a later element to close it. // - `/>`, which means this is an 'empty' or self-closing tag.
- `/>`, which means this is an 'empty' or self-closing tag.
*/
end_token := scan(t) end_token := scan(t)
#partial switch end_token.kind { #partial switch end_token.kind {
case .Gt: case .Gt:
/* // We're now the new parent.
We're now the new parent.
*/
parent = element parent = element
case .Slash: case .Slash:
/* // Empty tag. Close it.
Empty tag. Close it.
*/
expect(t, .Gt) or_return expect(t, .Gt) or_return
parent = doc.elements[element].parent parent = doc.elements[element].parent
element = parent element = parent
@@ -325,9 +268,7 @@ parse_bytes :: proc(data: []u8, options := DEFAULT_OPTIONS, path := "", error_ha
} }
} else if open.kind == .Slash { } else if open.kind == .Slash {
/* // Close tag.
Close tag.
*/
ident := expect(t, .Ident) or_return ident := expect(t, .Ident) or_return
_ = expect(t, .Gt) or_return _ = expect(t, .Gt) or_return
@@ -339,9 +280,7 @@ parse_bytes :: proc(data: []u8, options := DEFAULT_OPTIONS, path := "", error_ha
element = parent element = parent
} else if open.kind == .Exclaim { } else if open.kind == .Exclaim {
/* // <!
<!
*/
next := scan(t) next := scan(t)
#partial switch next.kind { #partial switch next.kind {
case .Ident: case .Ident:
@@ -370,10 +309,8 @@ parse_bytes :: proc(data: []u8, options := DEFAULT_OPTIONS, path := "", error_ha
} }
case .Dash: case .Dash:
/* // Comment: <!-- -->.
Comment: <!-- -->. // The grammar does not allow a comment to end in --->
The grammar does not allow a comment to end in --->
*/
expect(t, .Dash) expect(t, .Dash)
comment := scan_comment(t) or_return comment := scan_comment(t) or_return
@@ -395,23 +332,17 @@ parse_bytes :: proc(data: []u8, options := DEFAULT_OPTIONS, path := "", error_ha
} }
} else if open.kind == .Question { } else if open.kind == .Question {
/* // <?xml
<?xml
*/
next := scan(t) next := scan(t)
#partial switch next.kind { #partial switch next.kind {
case .Ident: case .Ident:
if len(next.text) == 3 && strings.equal_fold(next.text, "xml") { if len(next.text) == 3 && strings.equal_fold(next.text, "xml") {
parse_prologue(doc) or_return parse_prologue(doc) or_return
} else if len(doc.prologue) > 0 { } else if len(doc.prologue) > 0 {
/* // We've already seen a prologue.
We've already seen a prologue.
*/
return doc, .Too_Many_Prologs return doc, .Too_Many_Prologs
} else { } else {
/* // Could be `<?xml-stylesheet`, etc. Ignore it.
Could be `<?xml-stylesheet`, etc. Ignore it.
*/
skip_element(t) or_return skip_element(t) or_return
} }
case: case:
@@ -425,15 +356,11 @@ parse_bytes :: proc(data: []u8, options := DEFAULT_OPTIONS, path := "", error_ha
} }
case -1: case -1:
/* // End of file.
End of file.
*/
break loop break loop
case: case:
/* // This should be a tag's body text.
This should be a tag's body text.
*/
body_text := scan_string(t, t.offset) or_return body_text := scan_string(t, t.offset) or_return
needs_processing := .Unbox_CDATA in opts.flags needs_processing := .Unbox_CDATA in opts.flags
needs_processing |= .Decode_SGML_Entities in opts.flags needs_processing |= .Decode_SGML_Entities in opts.flags
@@ -613,9 +540,7 @@ parse_prologue :: proc(doc: ^Document) -> (err: Error) {
doc.encoding = .LATIN_1 doc.encoding = .LATIN_1
case: case:
/* // Unrecognized encoding, assume UTF-8.
Unrecognized encoding, assume UTF-8.
*/
error(t, offset, "[parse_prologue] Warning: Unrecognized encoding: %v\n", attr.val) error(t, offset, "[parse_prologue] Warning: Unrecognized encoding: %v\n", attr.val)
} }
@@ -658,11 +583,11 @@ skip_element :: proc(t: ^Tokenizer) -> (err: Error) {
parse_doctype :: proc(doc: ^Document) -> (err: Error) { parse_doctype :: proc(doc: ^Document) -> (err: Error) {
/* /*
<!DOCTYPE greeting SYSTEM "hello.dtd"> <!DOCTYPE greeting SYSTEM "hello.dtd">
<!DOCTYPE greeting [ <!DOCTYPE greeting [
<!ELEMENT greeting (#PCDATA)> <!ELEMENT greeting (#PCDATA)>
]> ]>
*/ */
assert(doc != nil) assert(doc != nil)
context.allocator = doc.allocator context.allocator = doc.allocator
@@ -675,9 +600,7 @@ parse_doctype :: proc(doc: ^Document) -> (err: Error) {
offset := t.offset offset := t.offset
skip_element(t) or_return skip_element(t) or_return
/* // -1 because the current offset is that of the closing tag, so the rest of the DOCTYPE tag ends just before it.
-1 because the current offset is that of the closing tag, so the rest of the DOCTYPE tag ends just before it.
*/
doc.doctype.rest = string(t.src[offset : t.offset - 1]) doc.doctype.rest = string(t.src[offset : t.offset - 1])
return .None return .None
} }
@@ -700,4 +623,4 @@ new_element :: proc(doc: ^Document) -> (id: Element_ID) {
cur := doc.element_count cur := doc.element_count
doc.element_count += 1 doc.element_count += 1
return cur return cur
} }
+15 -9
View File
@@ -216,7 +216,7 @@ tprintf :: proc(fmt: string, args: ..any) -> string {
// Returns: A formatted string // Returns: A formatted string
// //
bprint :: proc(buf: []byte, args: ..any, sep := " ") -> string { bprint :: proc(buf: []byte, args: ..any, sep := " ") -> string {
sb := strings.builder_from_bytes(buf[0:len(buf)]) sb := strings.builder_from_bytes(buf)
return sbprint(&sb, ..args, sep=sep) return sbprint(&sb, ..args, sep=sep)
} }
// Creates a formatted string using a supplied buffer as the backing array, appends newline. Writes into the buffer. // Creates a formatted string using a supplied buffer as the backing array, appends newline. Writes into the buffer.
@@ -229,7 +229,7 @@ bprint :: proc(buf: []byte, args: ..any, sep := " ") -> string {
// Returns: A formatted string with a newline character at the end // Returns: A formatted string with a newline character at the end
// //
bprintln :: proc(buf: []byte, args: ..any, sep := " ") -> string { bprintln :: proc(buf: []byte, args: ..any, sep := " ") -> string {
sb := strings.builder_from_bytes(buf[0:len(buf)]) sb := strings.builder_from_bytes(buf)
return sbprintln(&sb, ..args, sep=sep) return sbprintln(&sb, ..args, sep=sep)
} }
// Creates a formatted string using a supplied buffer as the backing array. Writes into the buffer. // Creates a formatted string using a supplied buffer as the backing array. Writes into the buffer.
@@ -242,7 +242,7 @@ bprintln :: proc(buf: []byte, args: ..any, sep := " ") -> string {
// Returns: A formatted string // Returns: A formatted string
// //
bprintf :: proc(buf: []byte, fmt: string, args: ..any) -> string { bprintf :: proc(buf: []byte, fmt: string, args: ..any) -> string {
sb := strings.builder_from_bytes(buf[0:len(buf)]) sb := strings.builder_from_bytes(buf)
return sbprintf(&sb, fmt, ..args) return sbprintf(&sb, fmt, ..args)
} }
// Runtime assertion with a formatted message // Runtime assertion with a formatted message
@@ -1232,8 +1232,12 @@ _pad :: proc(fi: ^Info, s: string) {
// //
// NOTE: Can return "NaN", "+Inf", "-Inf", "+<value>", or "-<value>". // NOTE: Can return "NaN", "+Inf", "-Inf", "+<value>", or "-<value>".
// //
_fmt_float_as :: proc(fi: ^Info, v: f64, bit_size: int, verb: rune, float_fmt: byte) { _fmt_float_as :: proc(fi: ^Info, v: f64, bit_size: int, verb: rune, float_fmt: byte, prec: int) {
prec := fi.prec if fi.prec_set else 3 prec := prec
if fi.prec_set {
prec = fi.prec
}
buf: [386]byte buf: [386]byte
// Can return "NaN", "+Inf", "-Inf", "+<value>", "-<value>". // Can return "NaN", "+Inf", "-Inf", "+<value>", "-<value>".
@@ -1242,7 +1246,7 @@ _fmt_float_as :: proc(fi: ^Info, v: f64, bit_size: int, verb: rune, float_fmt: b
if !fi.plus { if !fi.plus {
// Strip sign from "+<value>" but not "+Inf". // Strip sign from "+<value>" but not "+Inf".
if str[0] == '+' && str[1] != 'I' { if str[0] == '+' && str[1] != 'I' {
str = str[1:] str = str[1:]
} }
} }
@@ -1258,11 +1262,13 @@ _fmt_float_as :: proc(fi: ^Info, v: f64, bit_size: int, verb: rune, float_fmt: b
// //
fmt_float :: proc(fi: ^Info, v: f64, bit_size: int, verb: rune) { fmt_float :: proc(fi: ^Info, v: f64, bit_size: int, verb: rune) {
switch verb { switch verb {
case 'f', 'F', 'g', 'G', 'v': case 'g', 'G', 'v':
_fmt_float_as(fi, v, bit_size, verb, 'f') _fmt_float_as(fi, v, bit_size, verb, 'g', -1)
case 'f', 'F':
_fmt_float_as(fi, v, bit_size, verb, 'f', 3)
case 'e', 'E': case 'e', 'E':
// BUG(): "%.3e" returns "3.000e+00" // BUG(): "%.3e" returns "3.000e+00"
_fmt_float_as(fi, v, bit_size, verb, 'e') _fmt_float_as(fi, v, bit_size, verb, 'e', 6)
case 'h', 'H': case 'h', 'H':
prev_fi := fi^ prev_fi := fi^
+2 -1
View File
@@ -1,4 +1,5 @@
//+build !freestanding !js //+build !freestanding
//+build !js
package fmt package fmt
import "core:runtime" import "core:runtime"
+68 -61
View File
@@ -1,19 +1,28 @@
package log package log
import "core:runtime" import "core:runtime"
import "core:fmt"
Log_Allocator_Format :: enum {
Bytes, // Actual number of bytes.
Human, // Bytes in human units like bytes, kibibytes, etc. as appropriate.
}
Log_Allocator :: struct { Log_Allocator :: struct {
allocator: runtime.Allocator, allocator: runtime.Allocator,
level: Level, level: Level,
prefix: string, prefix: string,
locked: bool, locked: bool,
size_fmt: Log_Allocator_Format,
} }
log_allocator_init :: proc(la: ^Log_Allocator, level: Level, allocator := context.allocator, prefix := "") { log_allocator_init :: proc(la: ^Log_Allocator, level: Level, size_fmt := Log_Allocator_Format.Bytes,
allocator := context.allocator, prefix := "") {
la.allocator = allocator la.allocator = allocator
la.level = level la.level = level
la.prefix = prefix la.prefix = prefix
la.locked = false la.locked = false
la.size_fmt = size_fmt
} }
@@ -29,78 +38,80 @@ log_allocator_proc :: proc(allocator_data: rawptr, mode: runtime.Allocator_Mode,
old_memory: rawptr, old_size: int, location := #caller_location) -> ([]byte, runtime.Allocator_Error) { old_memory: rawptr, old_size: int, location := #caller_location) -> ([]byte, runtime.Allocator_Error) {
la := (^Log_Allocator)(allocator_data) la := (^Log_Allocator)(allocator_data)
if context.logger.procedure == nil || la.level < context.logger.lowest_level {
return la.allocator.procedure(la.allocator.data, mode, size, alignment, old_memory, old_size, location)
}
padding := " " if la.prefix != "" else "" padding := " " if la.prefix != "" else ""
buf: [256]byte = ---
if !la.locked { if !la.locked {
la.locked = true la.locked = true
defer la.locked = false defer la.locked = false
switch mode { switch mode {
case .Alloc: case .Alloc:
logf( format: string
la.level, switch la.size_fmt {
"%s%s>>> ALLOCATOR(mode=.Alloc, size=%d, alignment=%d)", case .Bytes: format = "%s%s>>> ALLOCATOR(mode=.Alloc, size=%d, alignment=%d)"
la.prefix, padding, size, alignment, case .Human: format = "%s%s>>> ALLOCATOR(mode=.Alloc, size=%m, alignment=%d)"
location = location, }
) str := fmt.bprintf(buf[:], format, la.prefix, padding, size, alignment)
context.logger.procedure(context.logger.data, la.level, str, context.logger.options, location)
case .Alloc_Non_Zeroed: case .Alloc_Non_Zeroed:
logf( format: string
la.level, switch la.size_fmt {
"%s%s>>> ALLOCATOR(mode=.Alloc_Non_Zeroed, size=%d, alignment=%d)", case .Bytes: format = "%s%s>>> ALLOCATOR(mode=.Alloc_Non_Zeroed, size=%d, alignment=%d)"
la.prefix, padding, size, alignment, case .Human: format = "%s%s>>> ALLOCATOR(mode=.Alloc_Non_Zeroed, size=%m, alignment=%d)"
location = location, }
) str := fmt.bprintf(buf[:], format, la.prefix, padding, size, alignment)
context.logger.procedure(context.logger.data, la.level, str, context.logger.options, location)
case .Free: case .Free:
if old_size != 0 { if old_size != 0 {
logf( format: string
la.level, switch la.size_fmt {
"%s%s<<< ALLOCATOR(mode=.Free, ptr=%p, size=%d)", case .Bytes: format = "%s%s<<< ALLOCATOR(mode=.Free, ptr=%p, size=%d)"
la.prefix, padding, old_memory, old_size, case .Human: format = "%s%s<<< ALLOCATOR(mode=.Free, ptr=%p, size=%m)"
location = location, }
) str := fmt.bprintf(buf[:], format, la.prefix, padding, old_memory, old_size)
context.logger.procedure(context.logger.data, la.level, str, context.logger.options, location)
} else { } else {
logf( str := fmt.bprintf(buf[:], "%s%s<<< ALLOCATOR(mode=.Free, ptr=%p)", la.prefix, padding, old_memory)
la.level, context.logger.procedure(context.logger.data, la.level, str, context.logger.options, location)
"%s%s<<< ALLOCATOR(mode=.Free, ptr=%p)",
la.prefix, padding, old_memory,
location = location,
)
} }
case .Free_All: case .Free_All:
logf( str := fmt.bprintf(buf[:], "%s%s<<< ALLOCATOR(mode=.Free_All)", la.prefix, padding)
la.level, context.logger.procedure(context.logger.data, la.level, str, context.logger.options, location)
"%s%s<<< ALLOCATOR(mode=.Free_All)",
la.prefix, padding,
location = location,
)
case .Resize: case .Resize:
logf( format: string
la.level, switch la.size_fmt {
"%s%s>>> ALLOCATOR(mode=.Resize, ptr=%p, old_size=%d, size=%d, alignment=%d)", case .Bytes: format = "%s%s>>> ALLOCATOR(mode=.Resize, ptr=%p, old_size=%d, size=%d, alignment=%d)"
la.prefix, padding, old_memory, old_size, size, alignment, case .Human: format = "%s%s>>> ALLOCATOR(mode=.Resize, ptr=%p, old_size=%m, size=%m, alignment=%d)"
location = location, }
) str := fmt.bprintf(buf[:], format, la.prefix, padding, old_memory, old_size, size, alignment)
context.logger.procedure(context.logger.data, la.level, str, context.logger.options, location)
case .Resize_Non_Zeroed: case .Resize_Non_Zeroed:
logf( format: string
la.level, switch la.size_fmt {
"%s%s>>> ALLOCATOR(mode=.Resize_Non_Zeroed, ptr=%p, old_size=%d, size=%d, alignment=%d)", case .Bytes: format = "%s%s>>> ALLOCATOR(mode=.Resize_Non_Zeroed, ptr=%p, old_size=%d, size=%d, alignment=%d)"
la.prefix, padding, old_memory, old_size, size, alignment, case .Human: format = "%s%s>>> ALLOCATOR(mode=.Resize_Non_Zeroed, ptr=%p, old_size=%m, size=%m, alignment=%d)"
location = location, }
) str := fmt.bprintf(buf[:], format, la.prefix, padding, old_memory, old_size, size, alignment)
context.logger.procedure(context.logger.data, la.level, str, context.logger.options, location)
case .Query_Features: case .Query_Features:
logf( str := fmt.bprintf(buf[:], "%s%sALLOCATOR(mode=.Query_Features)", la.prefix, padding)
la.level, context.logger.procedure(context.logger.data, la.level, str, context.logger.options, location)
"%s%ALLOCATOR(mode=.Query_Features)",
la.prefix, padding,
location = location,
)
case .Query_Info: case .Query_Info:
logf( str := fmt.bprintf(buf[:], "%s%sALLOCATOR(mode=.Query_Info)", la.prefix, padding)
la.level, context.logger.procedure(context.logger.data, la.level, str, context.logger.options, location)
"%s%ALLOCATOR(mode=.Query_Info)",
la.prefix, padding,
location = location,
)
} }
} }
@@ -109,12 +120,8 @@ log_allocator_proc :: proc(allocator_data: rawptr, mode: runtime.Allocator_Mode,
la.locked = true la.locked = true
defer la.locked = false defer la.locked = false
if err != nil { if err != nil {
logf( str := fmt.bprintf(buf[:], "%s%sALLOCATOR ERROR=%v", la.prefix, padding, err)
la.level, context.logger.procedure(context.logger.data, la.level, str, context.logger.options, location)
"%s%ALLOCATOR ERROR=%v",
la.prefix, padding, error,
location = location,
)
} }
} }
return data, err return data, err
+7 -5
View File
@@ -88,17 +88,19 @@ div_sat :: proc(x, y: $T/Fixed($Backing, $Fraction_Width)) -> (z: T) {
@(require_results) @(require_results)
floor :: proc(x: $T/Fixed($Backing, $Fraction_Width)) -> Backing { floor :: proc(x: $T/Fixed($Backing, $Fraction_Width)) -> Backing {
return x.i >> Fraction_Width if x.i >= 0 {
return x.i >> Fraction_Width
} else {
return (x.i - (1 << (Fraction_Width - 1)) + (1 << (Fraction_Width - 2))) >> Fraction_Width
}
} }
@(require_results) @(require_results)
ceil :: proc(x: $T/Fixed($Backing, $Fraction_Width)) -> Backing { ceil :: proc(x: $T/Fixed($Backing, $Fraction_Width)) -> Backing {
Integer :: 8*size_of(Backing) - Fraction_Width return (x.i + (1 << Fraction_Width - 1)) >> Fraction_Width
return (x.i + (1 << Integer-1)) >> Fraction_Width
} }
@(require_results) @(require_results)
round :: proc(x: $T/Fixed($Backing, $Fraction_Width)) -> Backing { round :: proc(x: $T/Fixed($Backing, $Fraction_Width)) -> Backing {
Integer :: 8*size_of(Backing) - Fraction_Width return (x.i + (1 << (Fraction_Width - 1))) >> Fraction_Width
return (x.i + (1 << (Integer - 1))) >> Fraction_Width
} }
+4 -4
View File
@@ -70,7 +70,7 @@ outer_product :: builtin.outer_product
@(require_results) @(require_results)
quaternion_inverse :: proc "contextless" (q: $Q) -> Q where IS_QUATERNION(Q) { quaternion_inverse :: proc "contextless" (q: $Q) -> Q where IS_QUATERNION(Q) {
return conj(q) * quaternion(1.0/dot(q, q), 0, 0, 0) return conj(q) * quaternion(w=1.0/dot(q, q), x=0, y=0, z=0)
} }
@@ -217,7 +217,7 @@ quaternion64_mul_vector3 :: proc "contextless" (q: $Q/quaternion64, v: $V/[3]$F/
Raw_Quaternion :: struct {xyz: [3]f16, r: f16} Raw_Quaternion :: struct {xyz: [3]f16, r: f16}
q := transmute(Raw_Quaternion)q q := transmute(Raw_Quaternion)q
v := transmute([3]f16)v v := v
t := cross(2*q.xyz, v) t := cross(2*q.xyz, v)
return V(v + q.r*t + cross(q.xyz, t)) return V(v + q.r*t + cross(q.xyz, t))
@@ -227,7 +227,7 @@ quaternion128_mul_vector3 :: proc "contextless" (q: $Q/quaternion128, v: $V/[3]$
Raw_Quaternion :: struct {xyz: [3]f32, r: f32} Raw_Quaternion :: struct {xyz: [3]f32, r: f32}
q := transmute(Raw_Quaternion)q q := transmute(Raw_Quaternion)q
v := transmute([3]f32)v v := v
t := cross(2*q.xyz, v) t := cross(2*q.xyz, v)
return V(v + q.r*t + cross(q.xyz, t)) return V(v + q.r*t + cross(q.xyz, t))
@@ -237,7 +237,7 @@ quaternion256_mul_vector3 :: proc "contextless" (q: $Q/quaternion256, v: $V/[3]$
Raw_Quaternion :: struct {xyz: [3]f64, r: f64} Raw_Quaternion :: struct {xyz: [3]f64, r: f64}
q := transmute(Raw_Quaternion)q q := transmute(Raw_Quaternion)q
v := transmute([3]f64)v v := v
t := cross(2*q.xyz, v) t := cross(2*q.xyz, v)
return V(v + q.r*t + cross(q.xyz, t)) return V(v + q.r*t + cross(q.xyz, t))
+60 -60
View File
@@ -7,96 +7,96 @@ F16_EPSILON :: 1e-3
F32_EPSILON :: 1e-7 F32_EPSILON :: 1e-7
F64_EPSILON :: 1e-15 F64_EPSILON :: 1e-15
Vector2f16 :: distinct [2]f16 Vector2f16 :: [2]f16
Vector3f16 :: distinct [3]f16 Vector3f16 :: [3]f16
Vector4f16 :: distinct [4]f16 Vector4f16 :: [4]f16
Matrix1x1f16 :: distinct matrix[1, 1]f16 Matrix1x1f16 :: matrix[1, 1]f16
Matrix1x2f16 :: distinct matrix[1, 2]f16 Matrix1x2f16 :: matrix[1, 2]f16
Matrix1x3f16 :: distinct matrix[1, 3]f16 Matrix1x3f16 :: matrix[1, 3]f16
Matrix1x4f16 :: distinct matrix[1, 4]f16 Matrix1x4f16 :: matrix[1, 4]f16
Matrix2x1f16 :: distinct matrix[2, 1]f16 Matrix2x1f16 :: matrix[2, 1]f16
Matrix2x2f16 :: distinct matrix[2, 2]f16 Matrix2x2f16 :: matrix[2, 2]f16
Matrix2x3f16 :: distinct matrix[2, 3]f16 Matrix2x3f16 :: matrix[2, 3]f16
Matrix2x4f16 :: distinct matrix[2, 4]f16 Matrix2x4f16 :: matrix[2, 4]f16
Matrix3x1f16 :: distinct matrix[3, 1]f16 Matrix3x1f16 :: matrix[3, 1]f16
Matrix3x2f16 :: distinct matrix[3, 2]f16 Matrix3x2f16 :: matrix[3, 2]f16
Matrix3x3f16 :: distinct matrix[3, 3]f16 Matrix3x3f16 :: matrix[3, 3]f16
Matrix3x4f16 :: distinct matrix[3, 4]f16 Matrix3x4f16 :: matrix[3, 4]f16
Matrix4x1f16 :: distinct matrix[4, 1]f16 Matrix4x1f16 :: matrix[4, 1]f16
Matrix4x2f16 :: distinct matrix[4, 2]f16 Matrix4x2f16 :: matrix[4, 2]f16
Matrix4x3f16 :: distinct matrix[4, 3]f16 Matrix4x3f16 :: matrix[4, 3]f16
Matrix4x4f16 :: distinct matrix[4, 4]f16 Matrix4x4f16 :: matrix[4, 4]f16
Matrix1f16 :: Matrix1x1f16 Matrix1f16 :: Matrix1x1f16
Matrix2f16 :: Matrix2x2f16 Matrix2f16 :: Matrix2x2f16
Matrix3f16 :: Matrix3x3f16 Matrix3f16 :: Matrix3x3f16
Matrix4f16 :: Matrix4x4f16 Matrix4f16 :: Matrix4x4f16
Vector2f32 :: distinct [2]f32 Vector2f32 :: [2]f32
Vector3f32 :: distinct [3]f32 Vector3f32 :: [3]f32
Vector4f32 :: distinct [4]f32 Vector4f32 :: [4]f32
Matrix1x1f32 :: distinct matrix[1, 1]f32 Matrix1x1f32 :: matrix[1, 1]f32
Matrix1x2f32 :: distinct matrix[1, 2]f32 Matrix1x2f32 :: matrix[1, 2]f32
Matrix1x3f32 :: distinct matrix[1, 3]f32 Matrix1x3f32 :: matrix[1, 3]f32
Matrix1x4f32 :: distinct matrix[1, 4]f32 Matrix1x4f32 :: matrix[1, 4]f32
Matrix2x1f32 :: distinct matrix[2, 1]f32 Matrix2x1f32 :: matrix[2, 1]f32
Matrix2x2f32 :: distinct matrix[2, 2]f32 Matrix2x2f32 :: matrix[2, 2]f32
Matrix2x3f32 :: distinct matrix[2, 3]f32 Matrix2x3f32 :: matrix[2, 3]f32
Matrix2x4f32 :: distinct matrix[2, 4]f32 Matrix2x4f32 :: matrix[2, 4]f32
Matrix3x1f32 :: distinct matrix[3, 1]f32 Matrix3x1f32 :: matrix[3, 1]f32
Matrix3x2f32 :: distinct matrix[3, 2]f32 Matrix3x2f32 :: matrix[3, 2]f32
Matrix3x3f32 :: distinct matrix[3, 3]f32 Matrix3x3f32 :: matrix[3, 3]f32
Matrix3x4f32 :: distinct matrix[3, 4]f32 Matrix3x4f32 :: matrix[3, 4]f32
Matrix4x1f32 :: distinct matrix[4, 1]f32 Matrix4x1f32 :: matrix[4, 1]f32
Matrix4x2f32 :: distinct matrix[4, 2]f32 Matrix4x2f32 :: matrix[4, 2]f32
Matrix4x3f32 :: distinct matrix[4, 3]f32 Matrix4x3f32 :: matrix[4, 3]f32
Matrix4x4f32 :: distinct matrix[4, 4]f32 Matrix4x4f32 :: matrix[4, 4]f32
Matrix1f32 :: Matrix1x1f32 Matrix1f32 :: Matrix1x1f32
Matrix2f32 :: Matrix2x2f32 Matrix2f32 :: Matrix2x2f32
Matrix3f32 :: Matrix3x3f32 Matrix3f32 :: Matrix3x3f32
Matrix4f32 :: Matrix4x4f32 Matrix4f32 :: Matrix4x4f32
Vector2f64 :: distinct [2]f64 Vector2f64 :: [2]f64
Vector3f64 :: distinct [3]f64 Vector3f64 :: [3]f64
Vector4f64 :: distinct [4]f64 Vector4f64 :: [4]f64
Matrix1x1f64 :: distinct matrix[1, 1]f64 Matrix1x1f64 :: matrix[1, 1]f64
Matrix1x2f64 :: distinct matrix[1, 2]f64 Matrix1x2f64 :: matrix[1, 2]f64
Matrix1x3f64 :: distinct matrix[1, 3]f64 Matrix1x3f64 :: matrix[1, 3]f64
Matrix1x4f64 :: distinct matrix[1, 4]f64 Matrix1x4f64 :: matrix[1, 4]f64
Matrix2x1f64 :: distinct matrix[2, 1]f64 Matrix2x1f64 :: matrix[2, 1]f64
Matrix2x2f64 :: distinct matrix[2, 2]f64 Matrix2x2f64 :: matrix[2, 2]f64
Matrix2x3f64 :: distinct matrix[2, 3]f64 Matrix2x3f64 :: matrix[2, 3]f64
Matrix2x4f64 :: distinct matrix[2, 4]f64 Matrix2x4f64 :: matrix[2, 4]f64
Matrix3x1f64 :: distinct matrix[3, 1]f64 Matrix3x1f64 :: matrix[3, 1]f64
Matrix3x2f64 :: distinct matrix[3, 2]f64 Matrix3x2f64 :: matrix[3, 2]f64
Matrix3x3f64 :: distinct matrix[3, 3]f64 Matrix3x3f64 :: matrix[3, 3]f64
Matrix3x4f64 :: distinct matrix[3, 4]f64 Matrix3x4f64 :: matrix[3, 4]f64
Matrix4x1f64 :: distinct matrix[4, 1]f64 Matrix4x1f64 :: matrix[4, 1]f64
Matrix4x2f64 :: distinct matrix[4, 2]f64 Matrix4x2f64 :: matrix[4, 2]f64
Matrix4x3f64 :: distinct matrix[4, 3]f64 Matrix4x3f64 :: matrix[4, 3]f64
Matrix4x4f64 :: distinct matrix[4, 4]f64 Matrix4x4f64 :: matrix[4, 4]f64
Matrix1f64 :: Matrix1x1f64 Matrix1f64 :: Matrix1x1f64
Matrix2f64 :: Matrix2x2f64 Matrix2f64 :: Matrix2x2f64
Matrix3f64 :: Matrix3x3f64 Matrix3f64 :: Matrix3x3f64
Matrix4f64 :: Matrix4x4f64 Matrix4f64 :: Matrix4x4f64
Quaternionf16 :: distinct quaternion64 Quaternionf16 :: quaternion64
Quaternionf32 :: distinct quaternion128 Quaternionf32 :: quaternion128
Quaternionf64 :: distinct quaternion256 Quaternionf64 :: quaternion256
MATRIX1F16_IDENTITY :: Matrix1f16(1) MATRIX1F16_IDENTITY :: Matrix1f16(1)
MATRIX2F16_IDENTITY :: Matrix2f16(1) MATRIX2F16_IDENTITY :: Matrix2f16(1)
+5 -5
View File
@@ -51,7 +51,7 @@ arena_init_growing :: proc(arena: ^Arena, reserved: uint = DEFAULT_ARENA_GROWING
// Initialization of an `Arena` to be a `.Static` variant. // Initialization of an `Arena` to be a `.Static` variant.
// A static arena contains a single `Memory_Block` allocated with virtual memory. // A static arena contains a single `Memory_Block` allocated with virtual memory.
@(require_results) @(require_results)
arena_init_static :: proc(arena: ^Arena, reserved: uint, commit_size: uint = DEFAULT_ARENA_STATIC_COMMIT_SIZE) -> (err: Allocator_Error) { arena_init_static :: proc(arena: ^Arena, reserved: uint = DEFAULT_ARENA_STATIC_RESERVE_SIZE, commit_size: uint = DEFAULT_ARENA_STATIC_COMMIT_SIZE) -> (err: Allocator_Error) {
arena.kind = .Static arena.kind = .Static
arena.curr_block = memory_block_alloc(commit_size, reserved, {}) or_return arena.curr_block = memory_block_alloc(commit_size, reserved, {}) or_return
arena.total_used = 0 arena.total_used = 0
@@ -98,15 +98,15 @@ arena_alloc :: proc(arena: ^Arena, size: uint, alignment: uint, loc := #caller_l
switch arena.kind { switch arena.kind {
case .Growing: case .Growing:
if arena.curr_block == nil || (safe_add(arena.curr_block.used, size) or_else 0) > arena.curr_block.reserved { needed := mem.align_forward_uint(size, alignment)
size = mem.align_forward_uint(size, alignment) if arena.curr_block == nil || (safe_add(arena.curr_block.used, needed) or_else 0) > arena.curr_block.reserved {
if arena.minimum_block_size == 0 { if arena.minimum_block_size == 0 {
arena.minimum_block_size = DEFAULT_ARENA_GROWING_MINIMUM_BLOCK_SIZE arena.minimum_block_size = DEFAULT_ARENA_GROWING_MINIMUM_BLOCK_SIZE
} }
block_size := max(size, arena.minimum_block_size) block_size := max(needed, arena.minimum_block_size)
new_block := memory_block_alloc(size, block_size, {}) or_return new_block := memory_block_alloc(needed, block_size, alignment, {}) or_return
new_block.prev = arena.curr_block new_block.prev = arena.curr_block
arena.curr_block = new_block arena.curr_block = new_block
arena.total_reserved += new_block.reserved arena.total_reserved += new_block.reserved
+4 -4
View File
@@ -68,7 +68,7 @@ align_formula :: #force_inline proc "contextless" (size, align: uint) -> uint {
} }
@(require_results) @(require_results)
memory_block_alloc :: proc(committed, reserved: uint, flags: Memory_Block_Flags) -> (block: ^Memory_Block, err: Allocator_Error) { memory_block_alloc :: proc(committed, reserved: uint, alignment: uint = 0, flags: Memory_Block_Flags = {}) -> (block: ^Memory_Block, err: Allocator_Error) {
page_size := DEFAULT_PAGE_SIZE page_size := DEFAULT_PAGE_SIZE
assert(mem.is_power_of_two(uintptr(page_size))) assert(mem.is_power_of_two(uintptr(page_size)))
@@ -79,8 +79,8 @@ memory_block_alloc :: proc(committed, reserved: uint, flags: Memory_Block_Flags)
reserved = align_formula(reserved, page_size) reserved = align_formula(reserved, page_size)
committed = clamp(committed, 0, reserved) committed = clamp(committed, 0, reserved)
total_size := uint(reserved + size_of(Platform_Memory_Block)) total_size := uint(reserved + max(alignment, size_of(Platform_Memory_Block)))
base_offset := uintptr(size_of(Platform_Memory_Block)) base_offset := uintptr(max(alignment, size_of(Platform_Memory_Block)))
protect_offset := uintptr(0) protect_offset := uintptr(0)
do_protection := false do_protection := false
@@ -183,4 +183,4 @@ memory_block_dealloc :: proc(block_to_free: ^Memory_Block) {
safe_add :: #force_inline proc "contextless" (x, y: uint) -> (uint, bool) { safe_add :: #force_inline proc "contextless" (x, y: uint) -> (uint, bool) {
z, did_overflow := intrinsics.overflow_add(x, y) z, did_overflow := intrinsics.overflow_add(x, y)
return z, !did_overflow return z, !did_overflow
} }
+1 -1
View File
@@ -136,7 +136,7 @@ _protect :: proc "contextless" (data: rawptr, size: uint, flags: Protect_Flags)
if .Write in flags { pflags |= PROT_WRITE } if .Write in flags { pflags |= PROT_WRITE }
if .Execute in flags { pflags |= PROT_EXEC } if .Execute in flags { pflags |= PROT_EXEC }
err := _mprotect(data, size, pflags) err := _mprotect(data, size, pflags)
return err != 0 return err == 0
} }
+1 -1
View File
@@ -40,7 +40,7 @@ _protect :: proc "contextless" (data: rawptr, size: uint, flags: Protect_Flags)
if .Write in flags { pflags |= {.WRITE} } if .Write in flags { pflags |= {.WRITE} }
if .Execute in flags { pflags |= {.EXEC} } if .Execute in flags { pflags |= {.EXEC} }
errno := linux.mprotect(data, size, pflags) errno := linux.mprotect(data, size, pflags)
return errno != .NONE return errno == .NONE
} }
_platform_memory_init :: proc() { _platform_memory_init :: proc() {
+1 -1
View File
@@ -53,7 +53,7 @@ PAGE_TARGETS_NO_UPDATE :: 0x40000000
ERROR_INVALID_ADDRESS :: 487 ERROR_INVALID_ADDRESS :: 487
ERROR_COMMITMENT_LIMIT :: 1455 ERROR_COMMITMENT_LIMIT :: 1455
@(default_calling_convention="stdcall") @(default_calling_convention="system")
foreign Kernel32 { foreign Kernel32 {
GetSystemInfo :: proc(lpSystemInfo: LPSYSTEM_INFO) --- GetSystemInfo :: proc(lpSystemInfo: LPSYSTEM_INFO) ---
VirtualAlloc :: proc(lpAddress: rawptr, dwSize: uint, flAllocationType: u32, flProtect: u32) -> rawptr --- VirtualAlloc :: proc(lpAddress: rawptr, dwSize: uint, flAllocationType: u32, flProtect: u32) -> rawptr ---
+1 -1
View File
@@ -1438,7 +1438,7 @@ parse_stmt :: proc(p: ^Parser) -> ^ast.Stmt {
} }
range.reverse = true range.reverse = true
} else { } else {
error(p, range.pos, "#reverse can only be applied to a 'for in' statement") error(p, stmt.pos, "#reverse can only be applied to a 'for in' statement")
} }
return stmt return stmt
case "include": case "include":
+40 -18
View File
@@ -263,26 +263,48 @@ Unix_File_Time :: struct {
nanoseconds: i64, nanoseconds: i64,
} }
OS_Stat :: struct { when ODIN_ARCH == .arm64 {
device_id: u64, // ID of device containing file OS_Stat :: struct {
serial: u64, // File serial number device_id: u64, // ID of device containing file
nlink: u64, // Number of hard links serial: u64, // File serial number
mode: u32, // Mode of the file mode: u32, // Mode of the file
uid: u32, // User ID of the file's owner nlink: u32, // Number of hard links
gid: u32, // Group ID of the file's group uid: u32, // User ID of the file's owner
_padding: i32, // 32 bits of padding gid: u32, // Group ID of the file's group
rdev: u64, // Device ID, if device rdev: u64, // Device ID, if device
size: i64, // Size of the file, in bytes _: u64, // Padding
block_size: i64, // Optimal bllocksize for I/O size: i64, // Size of the file, in bytes
blocks: i64, // Number of 512-byte blocks allocated block_size: i32, // Optimal blocksize for I/O
_: i32, // Padding
blocks: i64, // Number of 512-byte blocks allocated
last_access: Unix_File_Time, // Time of last access last_access: Unix_File_Time, // Time of last access
modified: Unix_File_Time, // Time of last modification modified: Unix_File_Time, // Time of last modification
status_change: Unix_File_Time, // Time of last status change status_change: Unix_File_Time, // Time of last status change
_reserve1, _reserved: [2]i32,
_reserve2, }
_reserve3: i64, #assert(size_of(OS_Stat) == 128)
} else {
OS_Stat :: struct {
device_id: u64, // ID of device containing file
serial: u64, // File serial number
nlink: u64, // Number of hard links
mode: u32, // Mode of the file
uid: u32, // User ID of the file's owner
gid: u32, // Group ID of the file's group
_: i32, // 32 bits of padding
rdev: u64, // Device ID, if device
size: i64, // Size of the file, in bytes
block_size: i64, // Optimal bllocksize for I/O
blocks: i64, // Number of 512-byte blocks allocated
last_access: Unix_File_Time, // Time of last access
modified: Unix_File_Time, // Time of last modification
status_change: Unix_File_Time, // Time of last status change
_reserved: [3]i64,
}
} }
// NOTE(laleksic, 2021-01-21): Comment and rename these to match OS_Stat above // NOTE(laleksic, 2021-01-21): Comment and rename these to match OS_Stat above
+1
View File
@@ -18,6 +18,7 @@
// This could change at a later date if the all these data structures are // This could change at a later date if the all these data structures are
// implemented within the compiler rather than in this "preload" file // implemented within the compiler rather than in this "preload" file
// //
//+no-instrumentation
package runtime package runtime
import "core:intrinsics" import "core:intrinsics"
+8 -3
View File
@@ -240,6 +240,8 @@ delete :: proc{
delete_dynamic_array, delete_dynamic_array,
delete_slice, delete_slice,
delete_map, delete_map,
delete_soa_slice,
delete_soa_dynamic_array,
} }
@@ -352,7 +354,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 // 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. // 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 @builtin
make :: proc{ make :: proc{
make_slice, make_slice,
@@ -634,11 +636,14 @@ assign_at_elem :: proc(array: ^$T/[dynamic]$E, index: int, arg: E, loc := #calle
@builtin @builtin
assign_at_elems :: proc(array: ^$T/[dynamic]$E, index: int, args: ..E, loc := #caller_location) -> (ok: bool, err: Allocator_Error) #no_bounds_check #optional_allocator_error { assign_at_elems :: proc(array: ^$T/[dynamic]$E, index: int, args: ..E, loc := #caller_location) -> (ok: bool, err: Allocator_Error) #no_bounds_check #optional_allocator_error {
if index+len(args) < len(array) { new_size := index + len(args)
if len(args) == 0 {
ok = true
} else if new_size < len(array) {
copy(array[index:], args) copy(array[index:], args)
ok = true ok = true
} else { } else {
resize(array, index+1+len(args), loc) or_return resize(array, new_size, loc) or_return
copy(array[index:], args) copy(array[index:], args)
ok = true ok = true
} }
+10 -10
View File
@@ -28,11 +28,11 @@ safe_add :: #force_inline proc "contextless" (x, y: uint) -> (uint, bool) {
} }
@(require_results) @(require_results)
memory_block_alloc :: proc(allocator: Allocator, capacity: uint, loc := #caller_location) -> (block: ^Memory_Block, err: Allocator_Error) { memory_block_alloc :: proc(allocator: Allocator, capacity: uint, alignment: uint, loc := #caller_location) -> (block: ^Memory_Block, err: Allocator_Error) {
total_size := uint(capacity + size_of(Memory_Block)) total_size := uint(capacity + max(alignment, size_of(Memory_Block)))
base_offset := uintptr(size_of(Memory_Block)) base_offset := uintptr(max(alignment, size_of(Memory_Block)))
min_alignment: int = max(16, align_of(Memory_Block)) min_alignment: int = max(16, align_of(Memory_Block), int(alignment))
data := mem_alloc(int(total_size), min_alignment, allocator, loc) or_return data := mem_alloc(int(total_size), min_alignment, allocator, loc) or_return
block = (^Memory_Block)(raw_data(data)) block = (^Memory_Block)(raw_data(data))
end := uintptr(raw_data(data)[len(data):]) end := uintptr(raw_data(data)[len(data):])
@@ -102,20 +102,20 @@ arena_alloc :: proc(arena: ^Arena, size, alignment: uint, loc := #caller_locatio
if size == 0 { if size == 0 {
return return
} }
if arena.curr_block == nil || (safe_add(arena.curr_block.used, size) or_else 0) > arena.curr_block.capacity { needed := align_forward_uint(size, alignment)
size = align_forward_uint(size, alignment) if arena.curr_block == nil || (safe_add(arena.curr_block.used, needed) or_else 0) > arena.curr_block.capacity {
if arena.minimum_block_size == 0 { if arena.minimum_block_size == 0 {
arena.minimum_block_size = DEFAULT_ARENA_GROWING_MINIMUM_BLOCK_SIZE arena.minimum_block_size = DEFAULT_ARENA_GROWING_MINIMUM_BLOCK_SIZE
} }
block_size := max(size, arena.minimum_block_size) block_size := max(needed, arena.minimum_block_size)
if arena.backing_allocator.procedure == nil { if arena.backing_allocator.procedure == nil {
arena.backing_allocator = default_allocator() arena.backing_allocator = default_allocator()
} }
new_block := memory_block_alloc(arena.backing_allocator, block_size, loc) or_return new_block := memory_block_alloc(arena.backing_allocator, block_size, alignment, loc) or_return
new_block.prev = arena.curr_block new_block.prev = arena.curr_block
arena.curr_block = new_block arena.curr_block = new_block
arena.total_capacity += new_block.capacity arena.total_capacity += new_block.capacity
@@ -134,7 +134,7 @@ arena_init :: proc(arena: ^Arena, size: uint, backing_allocator: Allocator, loc
arena^ = {} arena^ = {}
arena.backing_allocator = backing_allocator arena.backing_allocator = backing_allocator
arena.minimum_block_size = max(size, 1<<12) // minimum block size of 4 KiB arena.minimum_block_size = max(size, 1<<12) // minimum block size of 4 KiB
new_block := memory_block_alloc(arena.backing_allocator, arena.minimum_block_size, loc) or_return new_block := memory_block_alloc(arena.backing_allocator, arena.minimum_block_size, 0, loc) or_return
arena.curr_block = new_block arena.curr_block = new_block
arena.total_capacity += new_block.capacity arena.total_capacity += new_block.capacity
return nil return nil
+1
View File
@@ -1,5 +1,6 @@
//+private //+private
//+build linux, darwin, freebsd, openbsd //+build linux, darwin, freebsd, openbsd
//+no-instrumentation
package runtime package runtime
import "core:intrinsics" import "core:intrinsics"
+1
View File
@@ -1,5 +1,6 @@
//+private //+private
//+build wasm32, wasm64p32 //+build wasm32, wasm64p32
//+no-instrumentation
package runtime package runtime
import "core:intrinsics" import "core:intrinsics"
+3 -2
View File
@@ -1,12 +1,13 @@
//+private //+private
//+build windows //+build windows
//+no-instrumentation
package runtime package runtime
import "core:intrinsics" import "core:intrinsics"
when ODIN_BUILD_MODE == .Dynamic { when ODIN_BUILD_MODE == .Dynamic {
@(link_name="DllMain", linkage="strong", require) @(link_name="DllMain", linkage="strong", require)
DllMain :: proc "stdcall" (hinstDLL: rawptr, fdwReason: u32, lpReserved: rawptr) -> b32 { DllMain :: proc "system" (hinstDLL: rawptr, fdwReason: u32, lpReserved: rawptr) -> b32 {
context = default_context() context = default_context()
// Populate Windows DLL-specific global // Populate Windows DLL-specific global
@@ -28,7 +29,7 @@ when ODIN_BUILD_MODE == .Dynamic {
} else when !ODIN_TEST && !ODIN_NO_ENTRY_POINT { } else when !ODIN_TEST && !ODIN_NO_ENTRY_POINT {
when ODIN_ARCH == .i386 || ODIN_NO_CRT { when ODIN_ARCH == .i386 || ODIN_NO_CRT {
@(link_name="mainCRTStartup", linkage="strong", require) @(link_name="mainCRTStartup", linkage="strong", require)
mainCRTStartup :: proc "stdcall" () -> i32 { mainCRTStartup :: proc "system" () -> i32 {
context = default_context() context = default_context()
#force_no_inline _startup_runtime() #force_no_inline _startup_runtime()
intrinsics.__entry_point() intrinsics.__entry_point()
+14 -10
View File
@@ -1,5 +1,6 @@
package runtime package runtime
@(no_instrumentation)
bounds_trap :: proc "contextless" () -> ! { bounds_trap :: proc "contextless" () -> ! {
when ODIN_OS == .Windows { when ODIN_OS == .Windows {
windows_trap_array_bounds() windows_trap_array_bounds()
@@ -8,6 +9,7 @@ bounds_trap :: proc "contextless" () -> ! {
} }
} }
@(no_instrumentation)
type_assertion_trap :: proc "contextless" () -> ! { type_assertion_trap :: proc "contextless" () -> ! {
when ODIN_OS == .Windows { when ODIN_OS == .Windows {
windows_trap_type_assertion() windows_trap_type_assertion()
@@ -21,7 +23,7 @@ bounds_check_error :: proc "contextless" (file: string, line, column: i32, index
if uint(index) < uint(count) { if uint(index) < uint(count) {
return return
} }
@(cold) @(cold, no_instrumentation)
handle_error :: proc "contextless" (file: string, line, column: i32, index, count: int) -> ! { handle_error :: proc "contextless" (file: string, line, column: i32, index, count: int) -> ! {
print_caller_location(Source_Code_Location{file, line, column, ""}) print_caller_location(Source_Code_Location{file, line, column, ""})
print_string(" Index ") print_string(" Index ")
@@ -34,6 +36,7 @@ bounds_check_error :: proc "contextless" (file: string, line, column: i32, index
handle_error(file, line, column, index, count) handle_error(file, line, column, index, count)
} }
@(no_instrumentation)
slice_handle_error :: proc "contextless" (file: string, line, column: i32, lo, hi: int, len: int) -> ! { slice_handle_error :: proc "contextless" (file: string, line, column: i32, lo, hi: int, len: int) -> ! {
print_caller_location(Source_Code_Location{file, line, column, ""}) print_caller_location(Source_Code_Location{file, line, column, ""})
print_string(" Invalid slice indices ") print_string(" Invalid slice indices ")
@@ -46,6 +49,7 @@ slice_handle_error :: proc "contextless" (file: string, line, column: i32, lo, h
bounds_trap() bounds_trap()
} }
@(no_instrumentation)
multi_pointer_slice_handle_error :: proc "contextless" (file: string, line, column: i32, lo, hi: int) -> ! { multi_pointer_slice_handle_error :: proc "contextless" (file: string, line, column: i32, lo, hi: int) -> ! {
print_caller_location(Source_Code_Location{file, line, column, ""}) print_caller_location(Source_Code_Location{file, line, column, ""})
print_string(" Invalid slice indices ") print_string(" Invalid slice indices ")
@@ -82,7 +86,7 @@ dynamic_array_expr_error :: proc "contextless" (file: string, line, column: i32,
if 0 <= low && low <= high && high <= max { if 0 <= low && low <= high && high <= max {
return return
} }
@(cold) @(cold, no_instrumentation)
handle_error :: proc "contextless" (file: string, line, column: i32, low, high, max: int) -> ! { handle_error :: proc "contextless" (file: string, line, column: i32, low, high, max: int) -> ! {
print_caller_location(Source_Code_Location{file, line, column, ""}) print_caller_location(Source_Code_Location{file, line, column, ""})
print_string(" Invalid dynamic array indices ") print_string(" Invalid dynamic array indices ")
@@ -103,7 +107,7 @@ matrix_bounds_check_error :: proc "contextless" (file: string, line, column: i32
uint(column_index) < uint(column_count) { uint(column_index) < uint(column_count) {
return return
} }
@(cold) @(cold, no_instrumentation)
handle_error :: proc "contextless" (file: string, line, column: i32, row_index, column_index, row_count, column_count: int) -> ! { handle_error :: proc "contextless" (file: string, line, column: i32, row_index, column_index, row_count, column_count: int) -> ! {
print_caller_location(Source_Code_Location{file, line, column, ""}) print_caller_location(Source_Code_Location{file, line, column, ""})
print_string(" Matrix indices [") print_string(" Matrix indices [")
@@ -127,7 +131,7 @@ when ODIN_NO_RTTI {
if ok { if ok {
return return
} }
@(cold) @(cold, no_instrumentation)
handle_error :: proc "contextless" (file: string, line, column: i32) -> ! { handle_error :: proc "contextless" (file: string, line, column: i32) -> ! {
print_caller_location(Source_Code_Location{file, line, column, ""}) print_caller_location(Source_Code_Location{file, line, column, ""})
print_string(" Invalid type assertion\n") print_string(" Invalid type assertion\n")
@@ -140,7 +144,7 @@ when ODIN_NO_RTTI {
if ok { if ok {
return return
} }
@(cold) @(cold, no_instrumentation)
handle_error :: proc "contextless" (file: string, line, column: i32) -> ! { handle_error :: proc "contextless" (file: string, line, column: i32) -> ! {
print_caller_location(Source_Code_Location{file, line, column, ""}) print_caller_location(Source_Code_Location{file, line, column, ""})
print_string(" Invalid type assertion\n") print_string(" Invalid type assertion\n")
@@ -153,7 +157,7 @@ when ODIN_NO_RTTI {
if ok { if ok {
return return
} }
@(cold) @(cold, no_instrumentation)
handle_error :: proc "contextless" (file: string, line, column: i32, from, to: typeid) -> ! { handle_error :: proc "contextless" (file: string, line, column: i32, from, to: typeid) -> ! {
print_caller_location(Source_Code_Location{file, line, column, ""}) print_caller_location(Source_Code_Location{file, line, column, ""})
print_string(" Invalid type assertion from ") print_string(" Invalid type assertion from ")
@@ -198,7 +202,7 @@ when ODIN_NO_RTTI {
return id return id
} }
@(cold) @(cold, no_instrumentation)
handle_error :: proc "contextless" (file: string, line, column: i32, from, to: typeid, from_data: rawptr) -> ! { handle_error :: proc "contextless" (file: string, line, column: i32, from, to: typeid, from_data: rawptr) -> ! {
actual := variant_type(from, from_data) actual := variant_type(from, from_data)
@@ -224,7 +228,7 @@ make_slice_error_loc :: #force_inline proc "contextless" (loc := #caller_locatio
if 0 <= len { if 0 <= len {
return return
} }
@(cold) @(cold, no_instrumentation)
handle_error :: proc "contextless" (loc: Source_Code_Location, len: int) -> ! { handle_error :: proc "contextless" (loc: Source_Code_Location, len: int) -> ! {
print_caller_location(loc) print_caller_location(loc)
print_string(" Invalid slice length for make: ") print_string(" Invalid slice length for make: ")
@@ -239,7 +243,7 @@ make_dynamic_array_error_loc :: #force_inline proc "contextless" (loc := #caller
if 0 <= len && len <= cap { if 0 <= len && len <= cap {
return return
} }
@(cold) @(cold, no_instrumentation)
handle_error :: proc "contextless" (loc: Source_Code_Location, len, cap: int) -> ! { handle_error :: proc "contextless" (loc: Source_Code_Location, len, cap: int) -> ! {
print_caller_location(loc) print_caller_location(loc)
print_string(" Invalid dynamic array parameters for make: ") print_string(" Invalid dynamic array parameters for make: ")
@@ -256,7 +260,7 @@ make_map_expr_error_loc :: #force_inline proc "contextless" (loc := #caller_loca
if 0 <= cap { if 0 <= cap {
return return
} }
@(cold) @(cold, no_instrumentation)
handle_error :: proc "contextless" (loc: Source_Code_Location, cap: int) -> ! { handle_error :: proc "contextless" (loc: Source_Code_Location, cap: int) -> ! {
print_caller_location(loc) print_caller_location(loc)
print_string(" Invalid map capacity for make: ") print_string(" Invalid map capacity for make: ")
+6 -6
View File
@@ -749,7 +749,7 @@ mul_quaternion64 :: proc "contextless" (q, r: quaternion64) -> quaternion64 {
t2 := r0*q2 + r1*q3 + r2*q0 - r3*q1 t2 := r0*q2 + r1*q3 + r2*q0 - r3*q1
t3 := r0*q3 - r1*q2 + r2*q1 + r3*q0 t3 := r0*q3 - r1*q2 + r2*q1 + r3*q0
return quaternion(t0, t1, t2, t3) return quaternion(w=t0, x=t1, y=t2, z=t3)
} }
mul_quaternion128 :: proc "contextless" (q, r: quaternion128) -> quaternion128 { mul_quaternion128 :: proc "contextless" (q, r: quaternion128) -> quaternion128 {
@@ -761,7 +761,7 @@ mul_quaternion128 :: proc "contextless" (q, r: quaternion128) -> quaternion128 {
t2 := r0*q2 + r1*q3 + r2*q0 - r3*q1 t2 := r0*q2 + r1*q3 + r2*q0 - r3*q1
t3 := r0*q3 - r1*q2 + r2*q1 + r3*q0 t3 := r0*q3 - r1*q2 + r2*q1 + r3*q0
return quaternion(t0, t1, t2, t3) return quaternion(w=t0, x=t1, y=t2, z=t3)
} }
mul_quaternion256 :: proc "contextless" (q, r: quaternion256) -> quaternion256 { mul_quaternion256 :: proc "contextless" (q, r: quaternion256) -> quaternion256 {
@@ -773,7 +773,7 @@ mul_quaternion256 :: proc "contextless" (q, r: quaternion256) -> quaternion256 {
t2 := r0*q2 + r1*q3 + r2*q0 - r3*q1 t2 := r0*q2 + r1*q3 + r2*q0 - r3*q1
t3 := r0*q3 - r1*q2 + r2*q1 + r3*q0 t3 := r0*q3 - r1*q2 + r2*q1 + r3*q0
return quaternion(t0, t1, t2, t3) return quaternion(w=t0, x=t1, y=t2, z=t3)
} }
quo_quaternion64 :: proc "contextless" (q, r: quaternion64) -> quaternion64 { quo_quaternion64 :: proc "contextless" (q, r: quaternion64) -> quaternion64 {
@@ -787,7 +787,7 @@ quo_quaternion64 :: proc "contextless" (q, r: quaternion64) -> quaternion64 {
t2 := (r0*q2 - r1*q3 - r2*q0 + r3*q1) * invmag2 t2 := (r0*q2 - r1*q3 - r2*q0 + r3*q1) * invmag2
t3 := (r0*q3 + r1*q2 + r2*q1 - r3*q0) * invmag2 t3 := (r0*q3 + r1*q2 + r2*q1 - r3*q0) * invmag2
return quaternion(t0, t1, t2, t3) return quaternion(w=t0, x=t1, y=t2, z=t3)
} }
quo_quaternion128 :: proc "contextless" (q, r: quaternion128) -> quaternion128 { quo_quaternion128 :: proc "contextless" (q, r: quaternion128) -> quaternion128 {
@@ -801,7 +801,7 @@ quo_quaternion128 :: proc "contextless" (q, r: quaternion128) -> quaternion128 {
t2 := (r0*q2 - r1*q3 - r2*q0 + r3*q1) * invmag2 t2 := (r0*q2 - r1*q3 - r2*q0 + r3*q1) * invmag2
t3 := (r0*q3 + r1*q2 + r2*q1 - r3*q0) * invmag2 t3 := (r0*q3 + r1*q2 + r2*q1 - r3*q0) * invmag2
return quaternion(t0, t1, t2, t3) return quaternion(w=t0, x=t1, y=t2, z=t3)
} }
quo_quaternion256 :: proc "contextless" (q, r: quaternion256) -> quaternion256 { quo_quaternion256 :: proc "contextless" (q, r: quaternion256) -> quaternion256 {
@@ -815,7 +815,7 @@ quo_quaternion256 :: proc "contextless" (q, r: quaternion256) -> quaternion256 {
t2 := (r0*q2 - r1*q3 - r2*q0 + r3*q1) * invmag2 t2 := (r0*q2 - r1*q3 - r2*q0 + r3*q1) * invmag2
t3 := (r0*q3 + r1*q2 + r2*q1 - r3*q0) * invmag2 t3 := (r0*q3 + r1*q2 + r2*q1 - r3*q0) * invmag2
return quaternion(t0, t1, t2, t3) return quaternion(w=t0, x=t1, y=t2, z=t3)
} }
@(link_name="__truncsfhf2", linkage=RUNTIME_LINKAGE, require=RUNTIME_REQUIRE) @(link_name="__truncsfhf2", linkage=RUNTIME_LINKAGE, require=RUNTIME_REQUIRE)
+5 -1
View File
@@ -1,4 +1,8 @@
//+build !freestanding !wasi !windows !js !darwin //+build !darwin
//+build !freestanding
//+build !js
//+build !wasi
//+build !windows
package runtime package runtime
import "core:os" import "core:os"
+1 -1
View File
@@ -4,7 +4,7 @@ package runtime
import "core:intrinsics" import "core:intrinsics"
_os_write :: proc "contextless" (data: []byte) -> (int, _OS_Errno) { _os_write :: proc "contextless" (data: []byte) -> (int, _OS_Errno) {
ret := intrinsics.syscall(4, 1, uintptr(raw_data(data)), uintptr(len(data))) ret := intrinsics.syscall(0x2000004, 1, uintptr(raw_data(data)), uintptr(len(data)))
if ret < 0 { if ret < 0 {
return 0, _OS_Errno(-ret) return 0, _OS_Errno(-ret)
} }
+1 -1
View File
@@ -4,7 +4,7 @@ package runtime
foreign import kernel32 "system:Kernel32.lib" foreign import kernel32 "system:Kernel32.lib"
@(private="file") @(private="file")
@(default_calling_convention="stdcall") @(default_calling_convention="system")
foreign kernel32 { foreign kernel32 {
// NOTE(bill): The types are not using the standard names (e.g. DWORD and LPVOID) to just minimizing the dependency // NOTE(bill): The types are not using the standard names (e.g. DWORD and LPVOID) to just minimizing the dependency
+13 -2
View File
@@ -4,7 +4,7 @@ when ODIN_NO_CRT && ODIN_OS == .Windows {
foreign import lib "system:NtDll.lib" foreign import lib "system:NtDll.lib"
@(private="file") @(private="file")
@(default_calling_convention="stdcall") @(default_calling_convention="system")
foreign lib { foreign lib {
RtlMoveMemory :: proc(dst, s: rawptr, length: int) --- RtlMoveMemory :: proc(dst, s: rawptr, length: int) ---
RtlFillMemory :: proc(dst: rawptr, length: int, fill: i32) --- RtlFillMemory :: proc(dst: rawptr, length: int, fill: i32) ---
@@ -37,7 +37,18 @@ when ODIN_NO_CRT && ODIN_OS == .Windows {
} }
return ptr 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) @(link_name="memmove", linkage="strong", require)
memmove :: proc "c" (dst, src: rawptr, len: int) -> rawptr { memmove :: proc "c" (dst, src: rawptr, len: int) -> rawptr {
d, s := ([^]byte)(dst), ([^]byte)(src) d, s := ([^]byte)(dst), ([^]byte)(src)
+2 -1
View File
@@ -1,11 +1,12 @@
//+private //+private
//+no-instrumentation
package runtime package runtime
foreign import kernel32 "system:Kernel32.lib" foreign import kernel32 "system:Kernel32.lib"
@(private) @(private)
foreign kernel32 { foreign kernel32 {
RaiseException :: proc "stdcall" (dwExceptionCode, dwExceptionFlags, nNumberOfArguments: u32, lpArguments: ^uint) -> ! --- RaiseException :: proc "system" (dwExceptionCode, dwExceptionFlags, nNumberOfArguments: u32, lpArguments: ^uint) -> ! ---
} }
windows_trap_array_bounds :: proc "contextless" () -> ! { windows_trap_array_bounds :: proc "contextless" () -> ! {
+2 -1
View File
@@ -1,4 +1,5 @@
//+private //+private
//+no-instrumentation
package runtime package runtime
@require foreign import "system:int64.lib" @require foreign import "system:int64.lib"
@@ -12,7 +13,7 @@ windows_trap_array_bounds :: proc "contextless" () -> ! {
EXCEPTION_ARRAY_BOUNDS_EXCEEDED :: 0xC000008C EXCEPTION_ARRAY_BOUNDS_EXCEEDED :: 0xC000008C
foreign kernel32 { foreign kernel32 {
RaiseException :: proc "stdcall" (dwExceptionCode, dwExceptionFlags, nNumberOfArguments: DWORD, lpArguments: ^ULONG_PTR) -> ! --- RaiseException :: proc "system" (dwExceptionCode, dwExceptionFlags, nNumberOfArguments: DWORD, lpArguments: ^ULONG_PTR) -> ! ---
} }
RaiseException(EXCEPTION_ARRAY_BOUNDS_EXCEEDED, 0, 0, nil) RaiseException(EXCEPTION_ARRAY_BOUNDS_EXCEEDED, 0, 0, nil)
+1 -1
View File
@@ -37,7 +37,7 @@ when ODIN_ARCH == .amd64 {
} }
} }
@(private, default_calling_convention="c") @(private, default_calling_convention="none")
foreign _ { foreign _ {
@(link_name="llvm.x86.addcarry.32") @(link_name="llvm.x86.addcarry.32")
llvm_addcarry_u32 :: proc(a: u8, b: u32, c: u32) -> (u8, u32) --- llvm_addcarry_u32 :: proc(a: u8, b: u32, c: u32) -> (u8, u32) ---
+1 -1
View File
@@ -21,7 +21,7 @@ when ODIN_ARCH == .amd64 {
} }
} }
@(private, default_calling_convention="c") @(private, default_calling_convention="none")
foreign _ { foreign _ {
@(link_name="llvm.x86.fxsave") @(link_name="llvm.x86.fxsave")
fxsave :: proc(p: rawptr) --- fxsave :: proc(p: rawptr) ---
+2 -2
View File
@@ -1,12 +1,12 @@
//+build i386, amd64 //+build i386, amd64
package simd_x86 package simd_x86
@(require_results, enable_target_feature="pclmulqdq") @(require_results, enable_target_feature="pclmul")
_mm_clmulepi64_si128 :: #force_inline proc "c" (a, b: __m128i, $IMM8: u8) -> __m128i { _mm_clmulepi64_si128 :: #force_inline proc "c" (a, b: __m128i, $IMM8: u8) -> __m128i {
return pclmulqdq(a, b, u8(IMM8)) return pclmulqdq(a, b, u8(IMM8))
} }
@(private, default_calling_convention="c") @(private, default_calling_convention="none")
foreign _ { foreign _ {
@(link_name="llvm.x86.pclmulqdq") @(link_name="llvm.x86.pclmulqdq")
pclmulqdq :: proc(a, round_key: __m128i, #const imm8: u8) -> __m128i --- pclmulqdq :: proc(a, round_key: __m128i, #const imm8: u8) -> __m128i ---
+1 -1
View File
@@ -11,7 +11,7 @@ __rdtscp :: #force_inline proc "c" (aux: ^u32) -> u64 {
return rdtscp(aux) return rdtscp(aux)
} }
@(private, default_calling_convention="c") @(private, default_calling_convention="none")
foreign _ { foreign _ {
@(link_name="llvm.x86.rdtsc") @(link_name="llvm.x86.rdtsc")
rdtsc :: proc() -> u64 --- rdtsc :: proc() -> u64 ---
+1 -1
View File
@@ -30,7 +30,7 @@ _mm_sha256rnds2_epu32 :: #force_inline proc "c" (a, b, k: __m128i) -> __m128i {
return transmute(__m128i)sha256rnds2(transmute(i32x4)a, transmute(i32x4)b, transmute(i32x4)k) return transmute(__m128i)sha256rnds2(transmute(i32x4)a, transmute(i32x4)b, transmute(i32x4)k)
} }
@(private, default_calling_convention="c") @(private, default_calling_convention="none")
foreign _ { foreign _ {
@(link_name="llvm.x86.sha1msg1") @(link_name="llvm.x86.sha1msg1")
sha1msg1 :: proc(a, b: i32x4) -> i32x4 --- sha1msg1 :: proc(a, b: i32x4) -> i32x4 ---
+1 -1
View File
@@ -532,7 +532,7 @@ when ODIN_ARCH == .amd64 {
} }
@(private, default_calling_convention="c") @(private, default_calling_convention="none")
foreign _ { foreign _ {
@(link_name="llvm.x86.sse.add.ss") @(link_name="llvm.x86.sse.add.ss")
addss :: proc(a, b: __m128) -> __m128 --- addss :: proc(a, b: __m128) -> __m128 ---
+1 -1
View File
@@ -1040,7 +1040,7 @@ when ODIN_ARCH == .amd64 {
} }
@(private, default_calling_convention="c") @(private, default_calling_convention="none")
foreign _ { foreign _ {
@(link_name="llvm.x86.sse2.pause") @(link_name="llvm.x86.sse2.pause")
pause :: proc() --- pause :: proc() ---
+1 -1
View File
@@ -49,7 +49,7 @@ _mm_moveldup_ps :: #force_inline proc "c" (a: __m128) -> __m128 {
return simd.shuffle(a, a, 0, 0, 2, 2) return simd.shuffle(a, a, 0, 0, 2, 2)
} }
@(private, default_calling_convention="c") @(private, default_calling_convention="none")
foreign _ { foreign _ {
@(link_name = "llvm.x86.sse3.addsub.ps") @(link_name = "llvm.x86.sse3.addsub.ps")
addsubps :: proc(a, b: __m128) -> __m128 --- addsubps :: proc(a, b: __m128) -> __m128 ---
+1 -1
View File
@@ -291,7 +291,7 @@ when ODIN_ARCH == .amd64 {
} }
@(private, default_calling_convention="c") @(private, default_calling_convention="none")
foreign _ { foreign _ {
@(link_name = "llvm.x86.sse41.pblendvb") @(link_name = "llvm.x86.sse41.pblendvb")
pblendvb :: proc(a, b: i8x16, mask: i8x16) -> i8x16 --- pblendvb :: proc(a, b: i8x16, mask: i8x16) -> i8x16 ---
+1 -1
View File
@@ -104,7 +104,7 @@ when ODIN_ARCH == .amd64 {
} }
} }
@(private, default_calling_convention="c") @(private, default_calling_convention="none")
foreign _ { foreign _ {
// SSE 4.2 string and text comparison ops // SSE 4.2 string and text comparison ops
@(link_name="llvm.x86.sse42.pcmpestrm128") @(link_name="llvm.x86.sse42.pcmpestrm128")
+1 -1
View File
@@ -105,7 +105,7 @@ _mm_sign_epi32 :: #force_inline proc "c" (a, b: __m128i) -> __m128i {
@(private, default_calling_convention="c") @(private, default_calling_convention="none")
foreign _ { foreign _ {
@(link_name = "llvm.x86.ssse3.pabs.b.128") @(link_name = "llvm.x86.ssse3.pabs.b.128")
pabsb128 :: proc(a: i8x16) -> u8x16 --- pabsb128 :: proc(a: i8x16) -> u8x16 ---
+91 -44
View File
@@ -158,53 +158,25 @@ linear_search_proc :: proc(array: $A/[]$T, f: proc(T) -> bool) -> (index: int, f
binary_search :: proc(array: $A/[]$T, key: T) -> (index: int, found: bool) binary_search :: proc(array: $A/[]$T, key: T) -> (index: int, found: bool)
where intrinsics.type_is_ordered(T) #no_bounds_check where intrinsics.type_is_ordered(T) #no_bounds_check
{ {
// I would like to use binary_search_by(array, key, cmp) here, but it doesn't like it: return binary_search_by(array, key, cmp_proc(T))
// Cannot assign value 'cmp' of type 'proc($E, $E) -> Ordering' to 'proc(i32, i32) -> Ordering' in argument
return binary_search_by(array, key, proc(key: T, element: T) -> Ordering {
switch {
case element < key: return .Less
case element > key: return .Greater
case: return .Equal
}
})
} }
@(require_results) @(require_results)
binary_search_by :: proc(array: $A/[]$T, key: T, f: proc(T, T) -> Ordering) -> (index: int, found: bool) binary_search_by :: proc(array: $A/[]$T, key: T, f: proc(T, T) -> Ordering) -> (index: int, found: bool) #no_bounds_check {
where intrinsics.type_is_ordered(T) #no_bounds_check n := len(array)
{ left, right := 0, n
// INVARIANTS:
// - 0 <= left <= (left + size = right) <= len(array)
// - f returns .Less for everything in array[:left]
// - f returns .Greater for everything in array[right:]
size := len(array)
left := 0
right := size
for left < right { for left < right {
mid := left + size / 2 mid := int(uint(left+right) >> 1)
if f(array[mid], key) == .Less {
// Steps to verify this is in-bounds: left = mid+1
// 1. We note that `size` is strictly positive due to the loop condition } else {
// 2. Therefore `size/2 < size` // .Equal or .Greater
// 3. Adding `left` to both sides yields `(left + size/2) < (left + size)` right = mid
// 4. We know from the invariant that `left + size <= len(array)`
// 5. Therefore `left + size/2 < self.len()`
cmp := f(key, array[mid])
left = mid + 1 if cmp == .Less else left
right = mid if cmp == .Greater else right
switch cmp {
case .Equal: return mid, true
case .Less: left = mid + 1
case .Greater: right = mid
} }
size = right - left
} }
// left == right
return left, false // f(array[left-1], key) == .Less (if left > 0)
return left, left < n && f(array[left], key) == .Equal
} }
@(require_results) @(require_results)
@@ -446,14 +418,35 @@ reduce :: proc(s: $S/[]$U, initializer: $V, f: proc(V, U) -> V) -> V {
} }
@(require_results) @(require_results)
filter :: proc(s: $S/[]$U, f: proc(U) -> bool, allocator := context.allocator) -> S { reduce_reverse :: proc(s: $S/[]$U, initializer: $V, f: proc(V, U) -> V) -> V {
r := make([dynamic]U, 0, 0, allocator) r := initializer
for i := len(s)-1; i >= 0; i -= 1 {
#no_bounds_check r = f(r, s[i])
}
return r
}
@(require_results)
filter :: proc(s: $S/[]$U, f: proc(U) -> bool, allocator := context.allocator) -> (res: S, err: runtime.Allocator_Error) #optional_allocator_error {
r := make([dynamic]U, 0, 0, allocator) or_return
for v in s { for v in s {
if f(v) { if f(v) {
append(&r, v) append(&r, v)
} }
} }
return r[:] return r[:], nil
}
@(require_results)
filter_reverse :: proc(s: $S/[]$U, f: proc(U) -> bool, allocator := context.allocator) -> (res: S, err: runtime.Allocator_Error) #optional_allocator_error {
r := make([dynamic]U, 0, 0, allocator) or_return
for i := len(s)-1; i >= 0; i -= 1 {
#no_bounds_check v := s[i]
if f(v) {
append(&r, v)
}
}
return r[:], nil
} }
@(require_results) @(require_results)
@@ -476,6 +469,60 @@ scanner :: proc (s: $S/[]$U, initializer: $V, f: proc(V, U) -> V, allocator := c
} }
@(require_results)
repeat :: proc(s: $S/[]$U, count: int, allocator := context.allocator) -> (b: S, err: runtime.Allocator_Error) #optional_allocator_error {
if count < 0 {
panic("slice: negative repeat count")
} else if count > 0 && (len(s)*count)/count != len(s) {
panic("slice: repeat count will cause an overflow")
}
b = make(S, len(s)*count, allocator) or_return
i := copy(b, s)
for i < len(b) { // 2^N trick to reduce the need to copy
copy(b[i:], b[:i])
i *= 2
}
return
}
// 'unique' replaces consecutive runs of equal elements with a single copy.
// The procedures modifies the slice in-place and returns the modified slice.
@(require_results)
unique :: proc(s: $S/[]$T) -> S where intrinsics.type_is_comparable(T) #no_bounds_check {
if len(s) < 2 {
return s
}
i := 1
for j in 1..<len(s) {
if s[j] != s[j-1] && i != j {
s[i] = s[j]
}
i += 1
}
return s[:i]
}
// 'unique_proc' replaces consecutive runs of equal elements with a single copy using a comparison procedure
// The procedures modifies the slice in-place and returns the modified slice.
@(require_results)
unique_proc :: proc(s: $S/[]$T, eq: proc(T, T) -> bool) -> S #no_bounds_check {
if len(s) < 2 {
return s
}
i := 1
for j in 1..<len(s) {
if !eq(s[j], s[j-1]) && i != j {
s[i] = s[j]
}
i += 1
}
return s[:i]
}
@(require_results) @(require_results)
min :: proc(s: $S/[]$T) -> (res: T, ok: bool) where intrinsics.type_is_ordered(T) #optional_ok { min :: proc(s: $S/[]$T) -> (res: T, ok: bool) where intrinsics.type_is_ordered(T) #optional_ok {
if len(s) != 0 { if len(s) != 0 {
+1 -1
View File
@@ -62,7 +62,7 @@ _sort_by_indices :: proc(data, sorted: $T/[]$E, indices: []int) {
sort_by_indices_overwrite :: proc(data: $T/[]$E, indices: []int) { sort_by_indices_overwrite :: proc(data: $T/[]$E, indices: []int) {
assert(len(data) == len(indices)) assert(len(data) == len(indices))
temp := make([]int, len(data), context.allocator) temp := make([]E, len(data), context.allocator)
defer delete(temp) defer delete(temp)
for v, i in indices { for v, i in indices {
temp[i] = data[v] temp[i] = data[v]
+5 -2
View File
@@ -103,8 +103,11 @@ generic_ftoa :: proc(buf: []byte, val: f64, fmt: byte, precision, bit_size: int)
} }
} else { } else {
switch fmt { switch fmt {
case 'e', 'E': decimal.round(d, prec+1) case 'e', 'E':
case 'f', 'F': decimal.round(d, d.decimal_point+prec) prec += 1
decimal.round(d, prec)
case 'f', 'F':
decimal.round(d, d.decimal_point+prec)
case 'g', 'G': case 'g', 'G':
if prec == 0 { if prec == 0 {
prec = 1 prec = 1
+3 -1
View File
@@ -885,6 +885,7 @@ Splits a string into parts based on a separator. If n < count of seperators, the
Inputs: Inputs:
- s: The string to split. - s: The string to split.
- sep: The separator string used to split the input string. - sep: The separator string used to split the input string.
- n: The maximum amount of parts to split the string into.
- allocator: (default is context.allocator) - allocator: (default is context.allocator)
Returns: Returns:
@@ -1791,7 +1792,8 @@ last_index_any :: proc(s, chars: string) -> (res: int) {
if r >= utf8.RUNE_SELF { if r >= utf8.RUNE_SELF {
r = utf8.RUNE_ERROR r = utf8.RUNE_ERROR
} }
return index_rune(chars, r) i := index_rune(chars, r)
return i if i < 0 else 0
} }
if len(s) > 8 { if len(s) > 8 {
+3 -3
View File
@@ -5,14 +5,14 @@ package sync
import "core:time" import "core:time"
foreign import Synchronization "system:Synchronization.lib" foreign import Synchronization "system:Synchronization.lib"
@(default_calling_convention="stdcall") @(default_calling_convention="system")
foreign Synchronization { foreign Synchronization {
WakeByAddressSingle :: proc(Address: rawptr) --- WakeByAddressSingle :: proc(Address: rawptr) ---
WakeByAddressAll :: proc(Address: rawptr) --- WakeByAddressAll :: proc(Address: rawptr) ---
} }
foreign import Ntdll "system:Ntdll.lib" foreign import Ntdll "system:Ntdll.lib"
@(default_calling_convention="stdcall") @(default_calling_convention="system")
foreign Ntdll { foreign Ntdll {
RtlWaitOnAddress :: proc(Address: rawptr, CompareAddress: rawptr, AddressSize: uint, Timeout: ^i64) -> i32 --- RtlWaitOnAddress :: proc(Address: rawptr, CompareAddress: rawptr, AddressSize: uint, Timeout: ^i64) -> i32 ---
RtlNtStatusToDosError :: proc(status: i32) -> u32 --- RtlNtStatusToDosError :: proc(status: i32) -> u32 ---
@@ -30,7 +30,7 @@ foreign Ntdll {
GODDAMN MICROSOFT! GODDAMN MICROSOFT!
*/ */
CustomWaitOnAddress :: proc "stdcall" (Address: rawptr, CompareAddress: rawptr, AddressSize: uint, Timeout: ^i64) -> bool { CustomWaitOnAddress :: proc "system" (Address: rawptr, CompareAddress: rawptr, AddressSize: uint, Timeout: ^i64) -> bool {
status := RtlWaitOnAddress(Address, CompareAddress, AddressSize, Timeout) status := RtlWaitOnAddress(Address, CompareAddress, AddressSize, Timeout)
if status != 0 { if status != 0 {
SetLastError(RtlNtStatusToDosError(status)) SetLastError(RtlNtStatusToDosError(status))
+4 -4
View File
@@ -37,11 +37,11 @@ cpu_name: Maybe(string)
@(init, private) @(init, private)
init_cpu_features :: proc "c" () { init_cpu_features :: proc "c" () {
is_set :: #force_inline proc "c" (hwc: u32, value: u32) -> bool { is_set :: #force_inline proc "c" (bit: u32, value: u32) -> bool {
return hwc&(1 << value) != 0 return (value>>bit) & 0x1 != 0
} }
try_set :: #force_inline proc "c" (set: ^CPU_Features, feature: CPU_Feature, hwc: u32, value: u32) { try_set :: #force_inline proc "c" (set: ^CPU_Features, feature: CPU_Feature, bit: u32, value: u32) {
if is_set(hwc, value) { if is_set(bit, value) {
set^ += {feature} set^ += {feature}
} }
} }
+356 -306
View File
@@ -138,338 +138,388 @@ Darwin_To_Release :: struct {
@(private) @(private)
macos_release_map: map[string]Darwin_To_Release = { macos_release_map: map[string]Darwin_To_Release = {
// MacOS Tiger // MacOS Tiger
"8A428" = {{8, 0, 0}, "macOS", {"Tiger", {10, 4, 0}}}, "8A428" = {{8, 0, 0}, "macOS", {"Tiger", {10, 4, 0}}},
"8A432" = {{8, 0, 0}, "macOS", {"Tiger", {10, 4, 0}}}, "8A432" = {{8, 0, 0}, "macOS", {"Tiger", {10, 4, 0}}},
"8B15" = {{8, 1, 0}, "macOS", {"Tiger", {10, 4, 1}}}, "8B15" = {{8, 1, 0}, "macOS", {"Tiger", {10, 4, 1}}},
"8B17" = {{8, 1, 0}, "macOS", {"Tiger", {10, 4, 1}}}, "8B17" = {{8, 1, 0}, "macOS", {"Tiger", {10, 4, 1}}},
"8C46" = {{8, 2, 0}, "macOS", {"Tiger", {10, 4, 2}}}, "8C46" = {{8, 2, 0}, "macOS", {"Tiger", {10, 4, 2}}},
"8C47" = {{8, 2, 0}, "macOS", {"Tiger", {10, 4, 2}}}, "8C47" = {{8, 2, 0}, "macOS", {"Tiger", {10, 4, 2}}},
"8E102" = {{8, 2, 0}, "macOS", {"Tiger", {10, 4, 2}}}, "8E102" = {{8, 2, 0}, "macOS", {"Tiger", {10, 4, 2}}},
"8E45" = {{8, 2, 0}, "macOS", {"Tiger", {10, 4, 2}}}, "8E45" = {{8, 2, 0}, "macOS", {"Tiger", {10, 4, 2}}},
"8E90" = {{8, 2, 0}, "macOS", {"Tiger", {10, 4, 2}}}, "8E90" = {{8, 2, 0}, "macOS", {"Tiger", {10, 4, 2}}},
"8F46" = {{8, 3, 0}, "macOS", {"Tiger", {10, 4, 3}}}, "8F46" = {{8, 3, 0}, "macOS", {"Tiger", {10, 4, 3}}},
"8G32" = {{8, 4, 0}, "macOS", {"Tiger", {10, 4, 4}}}, "8G32" = {{8, 4, 0}, "macOS", {"Tiger", {10, 4, 4}}},
"8G1165" = {{8, 4, 0}, "macOS", {"Tiger", {10, 4, 4}}}, "8G1165" = {{8, 4, 0}, "macOS", {"Tiger", {10, 4, 4}}},
"8H14" = {{8, 5, 0}, "macOS", {"Tiger", {10, 4, 5}}}, "8H14" = {{8, 5, 0}, "macOS", {"Tiger", {10, 4, 5}}},
"8G1454" = {{8, 5, 0}, "macOS", {"Tiger", {10, 4, 5}}}, "8G1454" = {{8, 5, 0}, "macOS", {"Tiger", {10, 4, 5}}},
"8I127" = {{8, 6, 0}, "macOS", {"Tiger", {10, 4, 6}}}, "8I127" = {{8, 6, 0}, "macOS", {"Tiger", {10, 4, 6}}},
"8I1119" = {{8, 6, 0}, "macOS", {"Tiger", {10, 4, 6}}}, "8I1119" = {{8, 6, 0}, "macOS", {"Tiger", {10, 4, 6}}},
"8J135" = {{8, 7, 0}, "macOS", {"Tiger", {10, 4, 7}}}, "8J135" = {{8, 7, 0}, "macOS", {"Tiger", {10, 4, 7}}},
"8J2135a" = {{8, 7, 0}, "macOS", {"Tiger", {10, 4, 7}}}, "8J2135a" = {{8, 7, 0}, "macOS", {"Tiger", {10, 4, 7}}},
"8K1079" = {{8, 7, 0}, "macOS", {"Tiger", {10, 4, 7}}}, "8K1079" = {{8, 7, 0}, "macOS", {"Tiger", {10, 4, 7}}},
"8N5107" = {{8, 7, 0}, "macOS", {"Tiger", {10, 4, 7}}}, "8N5107" = {{8, 7, 0}, "macOS", {"Tiger", {10, 4, 7}}},
"8L127" = {{8, 8, 0}, "macOS", {"Tiger", {10, 4, 8}}}, "8L127" = {{8, 8, 0}, "macOS", {"Tiger", {10, 4, 8}}},
"8L2127" = {{8, 8, 0}, "macOS", {"Tiger", {10, 4, 8}}}, "8L2127" = {{8, 8, 0}, "macOS", {"Tiger", {10, 4, 8}}},
"8P135" = {{8, 9, 0}, "macOS", {"Tiger", {10, 4, 9}}}, "8P135" = {{8, 9, 0}, "macOS", {"Tiger", {10, 4, 9}}},
"8P2137" = {{8, 9, 0}, "macOS", {"Tiger", {10, 4, 9}}}, "8P2137" = {{8, 9, 0}, "macOS", {"Tiger", {10, 4, 9}}},
"8R218" = {{8, 10, 0}, "macOS", {"Tiger", {10, 4, 10}}}, "8R218" = {{8, 10, 0}, "macOS", {"Tiger", {10, 4, 10}}},
"8R2218" = {{8, 10, 0}, "macOS", {"Tiger", {10, 4, 10}}}, "8R2218" = {{8, 10, 0}, "macOS", {"Tiger", {10, 4, 10}}},
"8R2232" = {{8, 10, 0}, "macOS", {"Tiger", {10, 4, 10}}}, "8R2232" = {{8, 10, 0}, "macOS", {"Tiger", {10, 4, 10}}},
"8S165" = {{8, 11, 0}, "macOS", {"Tiger", {10, 4, 11}}}, "8S165" = {{8, 11, 0}, "macOS", {"Tiger", {10, 4, 11}}},
"8S2167" = {{8, 11, 0}, "macOS", {"Tiger", {10, 4, 11}}}, "8S2167" = {{8, 11, 0}, "macOS", {"Tiger", {10, 4, 11}}},
// MacOS Leopard // MacOS Leopard
"9A581" = {{9, 0, 0}, "macOS", {"Leopard", {10, 5, 0}}}, "9A581" = {{9, 0, 0}, "macOS", {"Leopard", {10, 5, 0}}},
"9B18" = {{9, 1, 0}, "macOS", {"Leopard", {10, 5, 1}}}, "9B18" = {{9, 1, 0}, "macOS", {"Leopard", {10, 5, 1}}},
"9B2117" = {{9, 1, 1}, "macOS", {"Leopard", {10, 5, 1}}}, "9B2117" = {{9, 1, 1}, "macOS", {"Leopard", {10, 5, 1}}},
"9C31" = {{9, 2, 0}, "macOS", {"Leopard", {10, 5, 2}}}, "9C31" = {{9, 2, 0}, "macOS", {"Leopard", {10, 5, 2}}},
"9C7010" = {{9, 2, 0}, "macOS", {"Leopard", {10, 5, 2}}}, "9C7010" = {{9, 2, 0}, "macOS", {"Leopard", {10, 5, 2}}},
"9D34" = {{9, 3, 0}, "macOS", {"Leopard", {10, 5, 3}}}, "9D34" = {{9, 3, 0}, "macOS", {"Leopard", {10, 5, 3}}},
"9E17" = {{9, 4, 0}, "macOS", {"Leopard", {10, 5, 4}}}, "9E17" = {{9, 4, 0}, "macOS", {"Leopard", {10, 5, 4}}},
"9F33" = {{9, 5, 0}, "macOS", {"Leopard", {10, 5, 5}}}, "9F33" = {{9, 5, 0}, "macOS", {"Leopard", {10, 5, 5}}},
"9G55" = {{9, 6, 0}, "macOS", {"Leopard", {10, 5, 6}}}, "9G55" = {{9, 6, 0}, "macOS", {"Leopard", {10, 5, 6}}},
"9G66" = {{9, 6, 0}, "macOS", {"Leopard", {10, 5, 6}}}, "9G66" = {{9, 6, 0}, "macOS", {"Leopard", {10, 5, 6}}},
"9G71" = {{9, 6, 0}, "macOS", {"Leopard", {10, 5, 6}}}, "9G71" = {{9, 6, 0}, "macOS", {"Leopard", {10, 5, 6}}},
"9J61" = {{9, 7, 0}, "macOS", {"Leopard", {10, 5, 7}}}, "9J61" = {{9, 7, 0}, "macOS", {"Leopard", {10, 5, 7}}},
"9L30" = {{9, 8, 0}, "macOS", {"Leopard", {10, 5, 8}}}, "9L30" = {{9, 8, 0}, "macOS", {"Leopard", {10, 5, 8}}},
"9L34" = {{9, 8, 0}, "macOS", {"Leopard", {10, 5, 8}}}, "9L34" = {{9, 8, 0}, "macOS", {"Leopard", {10, 5, 8}}},
// MacOS Snow Leopard // MacOS Snow Leopard
"10A432" = {{10, 0, 0}, "macOS", {"Snow Leopard", {10, 6, 0}}}, "10A432" = {{10, 0, 0}, "macOS", {"Snow Leopard", {10, 6, 0}}},
"10A433" = {{10, 0, 0}, "macOS", {"Snow Leopard", {10, 6, 0}}}, "10A433" = {{10, 0, 0}, "macOS", {"Snow Leopard", {10, 6, 0}}},
"10B504" = {{10, 1, 0}, "macOS", {"Snow Leopard", {10, 6, 1}}}, "10B504" = {{10, 1, 0}, "macOS", {"Snow Leopard", {10, 6, 1}}},
"10C540" = {{10, 2, 0}, "macOS", {"Snow Leopard", {10, 6, 2}}}, "10C540" = {{10, 2, 0}, "macOS", {"Snow Leopard", {10, 6, 2}}},
"10D573" = {{10, 3, 0}, "macOS", {"Snow Leopard", {10, 6, 3}}}, "10D573" = {{10, 3, 0}, "macOS", {"Snow Leopard", {10, 6, 3}}},
"10D575" = {{10, 3, 0}, "macOS", {"Snow Leopard", {10, 6, 3}}}, "10D575" = {{10, 3, 0}, "macOS", {"Snow Leopard", {10, 6, 3}}},
"10D578" = {{10, 3, 0}, "macOS", {"Snow Leopard", {10, 6, 3}}}, "10D578" = {{10, 3, 0}, "macOS", {"Snow Leopard", {10, 6, 3}}},
"10F569" = {{10, 4, 0}, "macOS", {"Snow Leopard", {10, 6, 4}}}, "10F569" = {{10, 4, 0}, "macOS", {"Snow Leopard", {10, 6, 4}}},
"10H574" = {{10, 5, 0}, "macOS", {"Snow Leopard", {10, 6, 5}}}, "10H574" = {{10, 5, 0}, "macOS", {"Snow Leopard", {10, 6, 5}}},
"10J567" = {{10, 6, 0}, "macOS", {"Snow Leopard", {10, 6, 6}}}, "10J567" = {{10, 6, 0}, "macOS", {"Snow Leopard", {10, 6, 6}}},
"10J869" = {{10, 7, 0}, "macOS", {"Snow Leopard", {10, 6, 7}}}, "10J869" = {{10, 7, 0}, "macOS", {"Snow Leopard", {10, 6, 7}}},
"10J3250" = {{10, 7, 0}, "macOS", {"Snow Leopard", {10, 6, 7}}}, "10J3250" = {{10, 7, 0}, "macOS", {"Snow Leopard", {10, 6, 7}}},
"10J4138" = {{10, 7, 0}, "macOS", {"Snow Leopard", {10, 6, 7}}}, "10J4138" = {{10, 7, 0}, "macOS", {"Snow Leopard", {10, 6, 7}}},
"10K540" = {{10, 8, 0}, "macOS", {"Snow Leopard", {10, 6, 8}}}, "10K540" = {{10, 8, 0}, "macOS", {"Snow Leopard", {10, 6, 8}}},
"10K549" = {{10, 8, 0}, "macOS", {"Snow Leopard", {10, 6, 8}}}, "10K549" = {{10, 8, 0}, "macOS", {"Snow Leopard", {10, 6, 8}}},
// MacOS Lion // MacOS Lion
"11A511" = {{11, 0, 0}, "macOS", {"Lion", {10, 7, 0}}}, "11A511" = {{11, 0, 0}, "macOS", {"Lion", {10, 7, 0}}},
"11A511s" = {{11, 0, 0}, "macOS", {"Lion", {10, 7, 0}}}, "11A511s" = {{11, 0, 0}, "macOS", {"Lion", {10, 7, 0}}},
"11A2061" = {{11, 0, 2}, "macOS", {"Lion", {10, 7, 0}}}, "11A2061" = {{11, 0, 2}, "macOS", {"Lion", {10, 7, 0}}},
"11A2063" = {{11, 0, 2}, "macOS", {"Lion", {10, 7, 0}}}, "11A2063" = {{11, 0, 2}, "macOS", {"Lion", {10, 7, 0}}},
"11B26" = {{11, 1, 0}, "macOS", {"Lion", {10, 7, 1}}}, "11B26" = {{11, 1, 0}, "macOS", {"Lion", {10, 7, 1}}},
"11B2118" = {{11, 1, 0}, "macOS", {"Lion", {10, 7, 1}}}, "11B2118" = {{11, 1, 0}, "macOS", {"Lion", {10, 7, 1}}},
"11C74" = {{11, 2, 0}, "macOS", {"Lion", {10, 7, 2}}}, "11C74" = {{11, 2, 0}, "macOS", {"Lion", {10, 7, 2}}},
"11D50" = {{11, 3, 0}, "macOS", {"Lion", {10, 7, 3}}}, "11D50" = {{11, 3, 0}, "macOS", {"Lion", {10, 7, 3}}},
"11E53" = {{11, 4, 0}, "macOS", {"Lion", {10, 7, 4}}}, "11E53" = {{11, 4, 0}, "macOS", {"Lion", {10, 7, 4}}},
"11G56" = {{11, 4, 2}, "macOS", {"Lion", {10, 7, 5}}}, "11G56" = {{11, 4, 2}, "macOS", {"Lion", {10, 7, 5}}},
"11G63" = {{11, 4, 2}, "macOS", {"Lion", {10, 7, 5}}}, "11G63" = {{11, 4, 2}, "macOS", {"Lion", {10, 7, 5}}},
// MacOS Mountain Lion // MacOS Mountain Lion
"12A269" = {{12, 0, 0}, "macOS", {"Mountain Lion", {10, 8, 0}}}, "12A269" = {{12, 0, 0}, "macOS", {"Mountain Lion", {10, 8, 0}}},
"12B19" = {{12, 1, 0}, "macOS", {"Mountain Lion", {10, 8, 1}}}, "12B19" = {{12, 1, 0}, "macOS", {"Mountain Lion", {10, 8, 1}}},
"12C54" = {{12, 2, 0}, "macOS", {"Mountain Lion", {10, 8, 2}}}, "12C54" = {{12, 2, 0}, "macOS", {"Mountain Lion", {10, 8, 2}}},
"12C60" = {{12, 2, 0}, "macOS", {"Mountain Lion", {10, 8, 2}}}, "12C60" = {{12, 2, 0}, "macOS", {"Mountain Lion", {10, 8, 2}}},
"12C2034" = {{12, 2, 0}, "macOS", {"Mountain Lion", {10, 8, 2}}}, "12C2034" = {{12, 2, 0}, "macOS", {"Mountain Lion", {10, 8, 2}}},
"12C3104" = {{12, 2, 0}, "macOS", {"Mountain Lion", {10, 8, 2}}}, "12C3104" = {{12, 2, 0}, "macOS", {"Mountain Lion", {10, 8, 2}}},
"12D78" = {{12, 3, 0}, "macOS", {"Mountain Lion", {10, 8, 3}}}, "12D78" = {{12, 3, 0}, "macOS", {"Mountain Lion", {10, 8, 3}}},
"12E55" = {{12, 4, 0}, "macOS", {"Mountain Lion", {10, 8, 4}}}, "12E55" = {{12, 4, 0}, "macOS", {"Mountain Lion", {10, 8, 4}}},
"12E3067" = {{12, 4, 0}, "macOS", {"Mountain Lion", {10, 8, 4}}}, "12E3067" = {{12, 4, 0}, "macOS", {"Mountain Lion", {10, 8, 4}}},
"12E4022" = {{12, 4, 0}, "macOS", {"Mountain Lion", {10, 8, 4}}}, "12E4022" = {{12, 4, 0}, "macOS", {"Mountain Lion", {10, 8, 4}}},
"12F37" = {{12, 5, 0}, "macOS", {"Mountain Lion", {10, 8, 5}}}, "12F37" = {{12, 5, 0}, "macOS", {"Mountain Lion", {10, 8, 5}}},
"12F45" = {{12, 5, 0}, "macOS", {"Mountain Lion", {10, 8, 5}}}, "12F45" = {{12, 5, 0}, "macOS", {"Mountain Lion", {10, 8, 5}}},
"12F2501" = {{12, 5, 0}, "macOS", {"Mountain Lion", {10, 8, 5}}}, "12F2501" = {{12, 5, 0}, "macOS", {"Mountain Lion", {10, 8, 5}}},
"12F2518" = {{12, 5, 0}, "macOS", {"Mountain Lion", {10, 8, 5}}}, "12F2518" = {{12, 5, 0}, "macOS", {"Mountain Lion", {10, 8, 5}}},
"12F2542" = {{12, 5, 0}, "macOS", {"Mountain Lion", {10, 8, 5}}}, "12F2542" = {{12, 5, 0}, "macOS", {"Mountain Lion", {10, 8, 5}}},
"12F2560" = {{12, 5, 0}, "macOS", {"Mountain Lion", {10, 8, 5}}}, "12F2560" = {{12, 5, 0}, "macOS", {"Mountain Lion", {10, 8, 5}}},
// MacOS Mavericks // MacOS Mavericks
"13A603" = {{13, 0, 0}, "macOS", {"Mavericks", {10, 9, 0}}}, "13A603" = {{13, 0, 0}, "macOS", {"Mavericks", {10, 9, 0}}},
"13B42" = {{13, 0, 0}, "macOS", {"Mavericks", {10, 9, 1}}}, "13B42" = {{13, 0, 0}, "macOS", {"Mavericks", {10, 9, 1}}},
"13C64" = {{13, 1, 0}, "macOS", {"Mavericks", {10, 9, 2}}}, "13C64" = {{13, 1, 0}, "macOS", {"Mavericks", {10, 9, 2}}},
"13C1021" = {{13, 1, 0}, "macOS", {"Mavericks", {10, 9, 2}}}, "13C1021" = {{13, 1, 0}, "macOS", {"Mavericks", {10, 9, 2}}},
"13D65" = {{13, 2, 0}, "macOS", {"Mavericks", {10, 9, 3}}}, "13D65" = {{13, 2, 0}, "macOS", {"Mavericks", {10, 9, 3}}},
"13E28" = {{13, 3, 0}, "macOS", {"Mavericks", {10, 9, 4}}}, "13E28" = {{13, 3, 0}, "macOS", {"Mavericks", {10, 9, 4}}},
"13F34" = {{13, 4, 0}, "macOS", {"Mavericks", {10, 9, 5}}}, "13F34" = {{13, 4, 0}, "macOS", {"Mavericks", {10, 9, 5}}},
"13F1066" = {{13, 4, 0}, "macOS", {"Mavericks", {10, 9, 5}}}, "13F1066" = {{13, 4, 0}, "macOS", {"Mavericks", {10, 9, 5}}},
"13F1077" = {{13, 4, 0}, "macOS", {"Mavericks", {10, 9, 5}}}, "13F1077" = {{13, 4, 0}, "macOS", {"Mavericks", {10, 9, 5}}},
"13F1096" = {{13, 4, 0}, "macOS", {"Mavericks", {10, 9, 5}}}, "13F1096" = {{13, 4, 0}, "macOS", {"Mavericks", {10, 9, 5}}},
"13F1112" = {{13, 4, 0}, "macOS", {"Mavericks", {10, 9, 5}}}, "13F1112" = {{13, 4, 0}, "macOS", {"Mavericks", {10, 9, 5}}},
"13F1134" = {{13, 4, 0}, "macOS", {"Mavericks", {10, 9, 5}}}, "13F1134" = {{13, 4, 0}, "macOS", {"Mavericks", {10, 9, 5}}},
"13F1507" = {{13, 4, 0}, "macOS", {"Mavericks", {10, 9, 5}}}, "13F1507" = {{13, 4, 0}, "macOS", {"Mavericks", {10, 9, 5}}},
"13F1603" = {{13, 4, 0}, "macOS", {"Mavericks", {10, 9, 5}}}, "13F1603" = {{13, 4, 0}, "macOS", {"Mavericks", {10, 9, 5}}},
"13F1712" = {{13, 4, 0}, "macOS", {"Mavericks", {10, 9, 5}}}, "13F1712" = {{13, 4, 0}, "macOS", {"Mavericks", {10, 9, 5}}},
"13F1808" = {{13, 4, 0}, "macOS", {"Mavericks", {10, 9, 5}}}, "13F1808" = {{13, 4, 0}, "macOS", {"Mavericks", {10, 9, 5}}},
"13F1911" = {{13, 4, 0}, "macOS", {"Mavericks", {10, 9, 5}}}, "13F1911" = {{13, 4, 0}, "macOS", {"Mavericks", {10, 9, 5}}},
// MacOS Yosemite // MacOS Yosemite
"14A389" = {{14, 0, 0}, "macOS", {"Yosemite", {10, 10, 0}}}, "14A389" = {{14, 0, 0}, "macOS", {"Yosemite", {10, 10, 0}}},
"14B25" = {{14, 0, 0}, "macOS", {"Yosemite", {10, 10, 1}}}, "14B25" = {{14, 0, 0}, "macOS", {"Yosemite", {10, 10, 1}}},
"14C109" = {{14, 1, 0}, "macOS", {"Yosemite", {10, 10, 2}}}, "14C109" = {{14, 1, 0}, "macOS", {"Yosemite", {10, 10, 2}}},
"14C1510" = {{14, 1, 0}, "macOS", {"Yosemite", {10, 10, 2}}}, "14C1510" = {{14, 1, 0}, "macOS", {"Yosemite", {10, 10, 2}}},
"14C2043" = {{14, 1, 0}, "macOS", {"Yosemite", {10, 10, 2}}}, "14C2043" = {{14, 1, 0}, "macOS", {"Yosemite", {10, 10, 2}}},
"14C1514" = {{14, 1, 0}, "macOS", {"Yosemite", {10, 10, 2}}}, "14C1514" = {{14, 1, 0}, "macOS", {"Yosemite", {10, 10, 2}}},
"14C2513" = {{14, 1, 0}, "macOS", {"Yosemite", {10, 10, 2}}}, "14C2513" = {{14, 1, 0}, "macOS", {"Yosemite", {10, 10, 2}}},
"14D131" = {{14, 3, 0}, "macOS", {"Yosemite", {10, 10, 3}}}, "14D131" = {{14, 3, 0}, "macOS", {"Yosemite", {10, 10, 3}}},
"14D136" = {{14, 3, 0}, "macOS", {"Yosemite", {10, 10, 3}}}, "14D136" = {{14, 3, 0}, "macOS", {"Yosemite", {10, 10, 3}}},
"14E46" = {{14, 4, 0}, "macOS", {"Yosemite", {10, 10, 4}}}, "14E46" = {{14, 4, 0}, "macOS", {"Yosemite", {10, 10, 4}}},
"14F27" = {{14, 5, 0}, "macOS", {"Yosemite", {10, 10, 5}}}, "14F27" = {{14, 5, 0}, "macOS", {"Yosemite", {10, 10, 5}}},
"14F1021" = {{14, 5, 0}, "macOS", {"Yosemite", {10, 10, 5}}}, "14F1021" = {{14, 5, 0}, "macOS", {"Yosemite", {10, 10, 5}}},
"14F1505" = {{14, 5, 0}, "macOS", {"Yosemite", {10, 10, 5}}}, "14F1505" = {{14, 5, 0}, "macOS", {"Yosemite", {10, 10, 5}}},
"14F1509" = {{14, 5, 0}, "macOS", {"Yosemite", {10, 10, 5}}}, "14F1509" = {{14, 5, 0}, "macOS", {"Yosemite", {10, 10, 5}}},
"14F1605" = {{14, 5, 0}, "macOS", {"Yosemite", {10, 10, 5}}}, "14F1605" = {{14, 5, 0}, "macOS", {"Yosemite", {10, 10, 5}}},
"14F1713" = {{14, 5, 0}, "macOS", {"Yosemite", {10, 10, 5}}}, "14F1713" = {{14, 5, 0}, "macOS", {"Yosemite", {10, 10, 5}}},
"14F1808" = {{14, 5, 0}, "macOS", {"Yosemite", {10, 10, 5}}}, "14F1808" = {{14, 5, 0}, "macOS", {"Yosemite", {10, 10, 5}}},
"14F1909" = {{14, 5, 0}, "macOS", {"Yosemite", {10, 10, 5}}}, "14F1909" = {{14, 5, 0}, "macOS", {"Yosemite", {10, 10, 5}}},
"14F1912" = {{14, 5, 0}, "macOS", {"Yosemite", {10, 10, 5}}}, "14F1912" = {{14, 5, 0}, "macOS", {"Yosemite", {10, 10, 5}}},
"14F2009" = {{14, 5, 0}, "macOS", {"Yosemite", {10, 10, 5}}}, "14F2009" = {{14, 5, 0}, "macOS", {"Yosemite", {10, 10, 5}}},
"14F2109" = {{14, 5, 0}, "macOS", {"Yosemite", {10, 10, 5}}}, "14F2109" = {{14, 5, 0}, "macOS", {"Yosemite", {10, 10, 5}}},
"14F2315" = {{14, 5, 0}, "macOS", {"Yosemite", {10, 10, 5}}}, "14F2315" = {{14, 5, 0}, "macOS", {"Yosemite", {10, 10, 5}}},
"14F2411" = {{14, 5, 0}, "macOS", {"Yosemite", {10, 10, 5}}}, "14F2411" = {{14, 5, 0}, "macOS", {"Yosemite", {10, 10, 5}}},
"14F2511" = {{14, 5, 0}, "macOS", {"Yosemite", {10, 10, 5}}}, "14F2511" = {{14, 5, 0}, "macOS", {"Yosemite", {10, 10, 5}}},
// MacOS El Capitan // MacOS El Capitan
"15A284" = {{15, 0, 0}, "macOS", {"El Capitan", {10, 11, 0}}}, "15A284" = {{15, 0, 0}, "macOS", {"El Capitan", {10, 11, 0}}},
"15B42" = {{15, 0, 0}, "macOS", {"El Capitan", {10, 11, 1}}}, "15B42" = {{15, 0, 0}, "macOS", {"El Capitan", {10, 11, 1}}},
"15C50" = {{15, 2, 0}, "macOS", {"El Capitan", {10, 11, 2}}}, "15C50" = {{15, 2, 0}, "macOS", {"El Capitan", {10, 11, 2}}},
"15D21" = {{15, 3, 0}, "macOS", {"El Capitan", {10, 11, 3}}}, "15D21" = {{15, 3, 0}, "macOS", {"El Capitan", {10, 11, 3}}},
"15E65" = {{15, 4, 0}, "macOS", {"El Capitan", {10, 11, 4}}}, "15E65" = {{15, 4, 0}, "macOS", {"El Capitan", {10, 11, 4}}},
"15F34" = {{15, 5, 0}, "macOS", {"El Capitan", {10, 11, 5}}}, "15F34" = {{15, 5, 0}, "macOS", {"El Capitan", {10, 11, 5}}},
"15G31" = {{15, 6, 0}, "macOS", {"El Capitan", {10, 11, 6}}}, "15G31" = {{15, 6, 0}, "macOS", {"El Capitan", {10, 11, 6}}},
"15G1004" = {{15, 6, 0}, "macOS", {"El Capitan", {10, 11, 6}}}, "15G1004" = {{15, 6, 0}, "macOS", {"El Capitan", {10, 11, 6}}},
"15G1011" = {{15, 6, 0}, "macOS", {"El Capitan", {10, 11, 6}}}, "15G1011" = {{15, 6, 0}, "macOS", {"El Capitan", {10, 11, 6}}},
"15G1108" = {{15, 6, 0}, "macOS", {"El Capitan", {10, 11, 6}}}, "15G1108" = {{15, 6, 0}, "macOS", {"El Capitan", {10, 11, 6}}},
"15G1212" = {{15, 6, 0}, "macOS", {"El Capitan", {10, 11, 6}}}, "15G1212" = {{15, 6, 0}, "macOS", {"El Capitan", {10, 11, 6}}},
"15G1217" = {{15, 6, 0}, "macOS", {"El Capitan", {10, 11, 6}}}, "15G1217" = {{15, 6, 0}, "macOS", {"El Capitan", {10, 11, 6}}},
"15G1421" = {{15, 6, 0}, "macOS", {"El Capitan", {10, 11, 6}}}, "15G1421" = {{15, 6, 0}, "macOS", {"El Capitan", {10, 11, 6}}},
"15G1510" = {{15, 6, 0}, "macOS", {"El Capitan", {10, 11, 6}}}, "15G1510" = {{15, 6, 0}, "macOS", {"El Capitan", {10, 11, 6}}},
"15G1611" = {{15, 6, 0}, "macOS", {"El Capitan", {10, 11, 6}}}, "15G1611" = {{15, 6, 0}, "macOS", {"El Capitan", {10, 11, 6}}},
"15G17023" = {{15, 6, 0}, "macOS", {"El Capitan", {10, 11, 6}}}, "15G17023" = {{15, 6, 0}, "macOS", {"El Capitan", {10, 11, 6}}},
"15G18013" = {{15, 6, 0}, "macOS", {"El Capitan", {10, 11, 6}}}, "15G18013" = {{15, 6, 0}, "macOS", {"El Capitan", {10, 11, 6}}},
"15G19009" = {{15, 6, 0}, "macOS", {"El Capitan", {10, 11, 6}}}, "15G19009" = {{15, 6, 0}, "macOS", {"El Capitan", {10, 11, 6}}},
"15G20015" = {{15, 6, 0}, "macOS", {"El Capitan", {10, 11, 6}}}, "15G20015" = {{15, 6, 0}, "macOS", {"El Capitan", {10, 11, 6}}},
"15G21013" = {{15, 6, 0}, "macOS", {"El Capitan", {10, 11, 6}}}, "15G21013" = {{15, 6, 0}, "macOS", {"El Capitan", {10, 11, 6}}},
"15G22010" = {{15, 6, 0}, "macOS", {"El Capitan", {10, 11, 6}}}, "15G22010" = {{15, 6, 0}, "macOS", {"El Capitan", {10, 11, 6}}},
// MacOS Sierra // MacOS Sierra
"16A323" = {{16, 0, 0}, "macOS", {"Sierra", {10, 12, 0}}}, "16A323" = {{16, 0, 0}, "macOS", {"Sierra", {10, 12, 0}}},
"16B2555" = {{16, 1, 0}, "macOS", {"Sierra", {10, 12, 1}}}, "16B2555" = {{16, 1, 0}, "macOS", {"Sierra", {10, 12, 1}}},
"16B2657" = {{16, 1, 0}, "macOS", {"Sierra", {10, 12, 1}}}, "16B2657" = {{16, 1, 0}, "macOS", {"Sierra", {10, 12, 1}}},
"16C67" = {{16, 3, 0}, "macOS", {"Sierra", {10, 12, 2}}}, "16C67" = {{16, 3, 0}, "macOS", {"Sierra", {10, 12, 2}}},
"16C68" = {{16, 3, 0}, "macOS", {"Sierra", {10, 12, 2}}}, "16C68" = {{16, 3, 0}, "macOS", {"Sierra", {10, 12, 2}}},
"16D32" = {{16, 4, 0}, "macOS", {"Sierra", {10, 12, 3}}}, "16D32" = {{16, 4, 0}, "macOS", {"Sierra", {10, 12, 3}}},
"16E195" = {{16, 5, 0}, "macOS", {"Sierra", {10, 12, 4}}}, "16E195" = {{16, 5, 0}, "macOS", {"Sierra", {10, 12, 4}}},
"16F73" = {{16, 6, 0}, "macOS", {"Sierra", {10, 12, 5}}}, "16F73" = {{16, 6, 0}, "macOS", {"Sierra", {10, 12, 5}}},
"16F2073" = {{16, 6, 0}, "macOS", {"Sierra", {10, 12, 5}}}, "16F2073" = {{16, 6, 0}, "macOS", {"Sierra", {10, 12, 5}}},
"16G29" = {{16, 7, 0}, "macOS", {"Sierra", {10, 12, 6}}}, "16G29" = {{16, 7, 0}, "macOS", {"Sierra", {10, 12, 6}}},
"16G1036" = {{16, 7, 0}, "macOS", {"Sierra", {10, 12, 6}}}, "16G1036" = {{16, 7, 0}, "macOS", {"Sierra", {10, 12, 6}}},
"16G1114" = {{16, 7, 0}, "macOS", {"Sierra", {10, 12, 6}}}, "16G1114" = {{16, 7, 0}, "macOS", {"Sierra", {10, 12, 6}}},
"16G1212" = {{16, 7, 0}, "macOS", {"Sierra", {10, 12, 6}}}, "16G1212" = {{16, 7, 0}, "macOS", {"Sierra", {10, 12, 6}}},
"16G1314" = {{16, 7, 0}, "macOS", {"Sierra", {10, 12, 6}}}, "16G1314" = {{16, 7, 0}, "macOS", {"Sierra", {10, 12, 6}}},
"16G1408" = {{16, 7, 0}, "macOS", {"Sierra", {10, 12, 6}}}, "16G1408" = {{16, 7, 0}, "macOS", {"Sierra", {10, 12, 6}}},
"16G1510" = {{16, 7, 0}, "macOS", {"Sierra", {10, 12, 6}}}, "16G1510" = {{16, 7, 0}, "macOS", {"Sierra", {10, 12, 6}}},
"16G1618" = {{16, 7, 0}, "macOS", {"Sierra", {10, 12, 6}}}, "16G1618" = {{16, 7, 0}, "macOS", {"Sierra", {10, 12, 6}}},
"16G1710" = {{16, 7, 0}, "macOS", {"Sierra", {10, 12, 6}}}, "16G1710" = {{16, 7, 0}, "macOS", {"Sierra", {10, 12, 6}}},
"16G1815" = {{16, 7, 0}, "macOS", {"Sierra", {10, 12, 6}}}, "16G1815" = {{16, 7, 0}, "macOS", {"Sierra", {10, 12, 6}}},
"16G1917" = {{16, 7, 0}, "macOS", {"Sierra", {10, 12, 6}}}, "16G1917" = {{16, 7, 0}, "macOS", {"Sierra", {10, 12, 6}}},
"16G1918" = {{16, 7, 0}, "macOS", {"Sierra", {10, 12, 6}}}, "16G1918" = {{16, 7, 0}, "macOS", {"Sierra", {10, 12, 6}}},
"16G2016" = {{16, 7, 0}, "macOS", {"Sierra", {10, 12, 6}}}, "16G2016" = {{16, 7, 0}, "macOS", {"Sierra", {10, 12, 6}}},
"16G2127" = {{16, 7, 0}, "macOS", {"Sierra", {10, 12, 6}}}, "16G2127" = {{16, 7, 0}, "macOS", {"Sierra", {10, 12, 6}}},
"16G2128" = {{16, 7, 0}, "macOS", {"Sierra", {10, 12, 6}}}, "16G2128" = {{16, 7, 0}, "macOS", {"Sierra", {10, 12, 6}}},
"16G2136" = {{16, 7, 0}, "macOS", {"Sierra", {10, 12, 6}}}, "16G2136" = {{16, 7, 0}, "macOS", {"Sierra", {10, 12, 6}}},
// MacOS High Sierra // MacOS High Sierra
"17A365" = {{17, 0, 0}, "macOS", {"High Sierra", {10, 13, 0}}}, "17A365" = {{17, 0, 0}, "macOS", {"High Sierra", {10, 13, 0}}},
"17A405" = {{17, 0, 0}, "macOS", {"High Sierra", {10, 13, 0}}}, "17A405" = {{17, 0, 0}, "macOS", {"High Sierra", {10, 13, 0}}},
"17B48" = {{17, 2, 0}, "macOS", {"High Sierra", {10, 13, 1}}}, "17B48" = {{17, 2, 0}, "macOS", {"High Sierra", {10, 13, 1}}},
"17B1002" = {{17, 2, 0}, "macOS", {"High Sierra", {10, 13, 1}}}, "17B1002" = {{17, 2, 0}, "macOS", {"High Sierra", {10, 13, 1}}},
"17B1003" = {{17, 2, 0}, "macOS", {"High Sierra", {10, 13, 1}}}, "17B1003" = {{17, 2, 0}, "macOS", {"High Sierra", {10, 13, 1}}},
"17C88" = {{17, 3, 0}, "macOS", {"High Sierra", {10, 13, 2}}}, "17C88" = {{17, 3, 0}, "macOS", {"High Sierra", {10, 13, 2}}},
"17C89" = {{17, 3, 0}, "macOS", {"High Sierra", {10, 13, 2}}}, "17C89" = {{17, 3, 0}, "macOS", {"High Sierra", {10, 13, 2}}},
"17C205" = {{17, 3, 0}, "macOS", {"High Sierra", {10, 13, 2}}}, "17C205" = {{17, 3, 0}, "macOS", {"High Sierra", {10, 13, 2}}},
"17C2205" = {{17, 3, 0}, "macOS", {"High Sierra", {10, 13, 2}}}, "17C2205" = {{17, 3, 0}, "macOS", {"High Sierra", {10, 13, 2}}},
"17D47" = {{17, 4, 0}, "macOS", {"High Sierra", {10, 13, 3}}}, "17D47" = {{17, 4, 0}, "macOS", {"High Sierra", {10, 13, 3}}},
"17D2047" = {{17, 4, 0}, "macOS", {"High Sierra", {10, 13, 3}}}, "17D2047" = {{17, 4, 0}, "macOS", {"High Sierra", {10, 13, 3}}},
"17D102" = {{17, 4, 0}, "macOS", {"High Sierra", {10, 13, 3}}}, "17D102" = {{17, 4, 0}, "macOS", {"High Sierra", {10, 13, 3}}},
"17D2102" = {{17, 4, 0}, "macOS", {"High Sierra", {10, 13, 3}}}, "17D2102" = {{17, 4, 0}, "macOS", {"High Sierra", {10, 13, 3}}},
"17E199" = {{17, 5, 0}, "macOS", {"High Sierra", {10, 13, 4}}}, "17E199" = {{17, 5, 0}, "macOS", {"High Sierra", {10, 13, 4}}},
"17E202" = {{17, 5, 0}, "macOS", {"High Sierra", {10, 13, 4}}}, "17E202" = {{17, 5, 0}, "macOS", {"High Sierra", {10, 13, 4}}},
"17F77" = {{17, 6, 0}, "macOS", {"High Sierra", {10, 13, 5}}}, "17F77" = {{17, 6, 0}, "macOS", {"High Sierra", {10, 13, 5}}},
"17G65" = {{17, 7, 0}, "macOS", {"High Sierra", {10, 13, 6}}}, "17G65" = {{17, 7, 0}, "macOS", {"High Sierra", {10, 13, 6}}},
"17G2208" = {{17, 7, 0}, "macOS", {"High Sierra", {10, 13, 6}}}, "17G2208" = {{17, 7, 0}, "macOS", {"High Sierra", {10, 13, 6}}},
"17G2307" = {{17, 7, 0}, "macOS", {"High Sierra", {10, 13, 6}}}, "17G2307" = {{17, 7, 0}, "macOS", {"High Sierra", {10, 13, 6}}},
"17G3025" = {{17, 7, 0}, "macOS", {"High Sierra", {10, 13, 6}}}, "17G3025" = {{17, 7, 0}, "macOS", {"High Sierra", {10, 13, 6}}},
"17G4015" = {{17, 7, 0}, "macOS", {"High Sierra", {10, 13, 6}}}, "17G4015" = {{17, 7, 0}, "macOS", {"High Sierra", {10, 13, 6}}},
"17G5019" = {{17, 7, 0}, "macOS", {"High Sierra", {10, 13, 6}}}, "17G5019" = {{17, 7, 0}, "macOS", {"High Sierra", {10, 13, 6}}},
"17G6029" = {{17, 7, 0}, "macOS", {"High Sierra", {10, 13, 6}}}, "17G6029" = {{17, 7, 0}, "macOS", {"High Sierra", {10, 13, 6}}},
"17G6030" = {{17, 7, 0}, "macOS", {"High Sierra", {10, 13, 6}}}, "17G6030" = {{17, 7, 0}, "macOS", {"High Sierra", {10, 13, 6}}},
"17G7024" = {{17, 7, 0}, "macOS", {"High Sierra", {10, 13, 6}}}, "17G7024" = {{17, 7, 0}, "macOS", {"High Sierra", {10, 13, 6}}},
"17G8029" = {{17, 7, 0}, "macOS", {"High Sierra", {10, 13, 6}}}, "17G8029" = {{17, 7, 0}, "macOS", {"High Sierra", {10, 13, 6}}},
"17G8030" = {{17, 7, 0}, "macOS", {"High Sierra", {10, 13, 6}}}, "17G8030" = {{17, 7, 0}, "macOS", {"High Sierra", {10, 13, 6}}},
"17G8037" = {{17, 7, 0}, "macOS", {"High Sierra", {10, 13, 6}}}, "17G8037" = {{17, 7, 0}, "macOS", {"High Sierra", {10, 13, 6}}},
"17G9016" = {{17, 7, 0}, "macOS", {"High Sierra", {10, 13, 6}}}, "17G9016" = {{17, 7, 0}, "macOS", {"High Sierra", {10, 13, 6}}},
"17G10021" = {{17, 7, 0}, "macOS", {"High Sierra", {10, 13, 6}}}, "17G10021" = {{17, 7, 0}, "macOS", {"High Sierra", {10, 13, 6}}},
"17G11023" = {{17, 7, 0}, "macOS", {"High Sierra", {10, 13, 6}}}, "17G11023" = {{17, 7, 0}, "macOS", {"High Sierra", {10, 13, 6}}},
"17G12034" = {{17, 7, 0}, "macOS", {"High Sierra", {10, 13, 6}}}, "17G12034" = {{17, 7, 0}, "macOS", {"High Sierra", {10, 13, 6}}},
"17G13033" = {{17, 7, 0}, "macOS", {"High Sierra", {10, 13, 6}}}, "17G13033" = {{17, 7, 0}, "macOS", {"High Sierra", {10, 13, 6}}},
"17G13035" = {{17, 7, 0}, "macOS", {"High Sierra", {10, 13, 6}}}, "17G13035" = {{17, 7, 0}, "macOS", {"High Sierra", {10, 13, 6}}},
"17G14019" = {{17, 7, 0}, "macOS", {"High Sierra", {10, 13, 6}}}, "17G14019" = {{17, 7, 0}, "macOS", {"High Sierra", {10, 13, 6}}},
"17G14033" = {{17, 7, 0}, "macOS", {"High Sierra", {10, 13, 6}}}, "17G14033" = {{17, 7, 0}, "macOS", {"High Sierra", {10, 13, 6}}},
"17G14042" = {{17, 7, 0}, "macOS", {"High Sierra", {10, 13, 6}}}, "17G14042" = {{17, 7, 0}, "macOS", {"High Sierra", {10, 13, 6}}},
// MacOS Mojave // MacOS Mojave
"18A391" = {{18, 0, 0}, "macOS", {"Mojave", {10, 14, 0}}}, "18A391" = {{18, 0, 0}, "macOS", {"Mojave", {10, 14, 0}}},
"18B75" = {{18, 2, 0}, "macOS", {"Mojave", {10, 14, 1}}}, "18B75" = {{18, 2, 0}, "macOS", {"Mojave", {10, 14, 1}}},
"18B2107" = {{18, 2, 0}, "macOS", {"Mojave", {10, 14, 1}}}, "18B2107" = {{18, 2, 0}, "macOS", {"Mojave", {10, 14, 1}}},
"18B3094" = {{18, 2, 0}, "macOS", {"Mojave", {10, 14, 1}}}, "18B3094" = {{18, 2, 0}, "macOS", {"Mojave", {10, 14, 1}}},
"18C54" = {{18, 2, 0}, "macOS", {"Mojave", {10, 14, 2}}}, "18C54" = {{18, 2, 0}, "macOS", {"Mojave", {10, 14, 2}}},
"18D42" = {{18, 2, 0}, "macOS", {"Mojave", {10, 14, 3}}}, "18D42" = {{18, 2, 0}, "macOS", {"Mojave", {10, 14, 3}}},
"18D43" = {{18, 2, 0}, "macOS", {"Mojave", {10, 14, 3}}}, "18D43" = {{18, 2, 0}, "macOS", {"Mojave", {10, 14, 3}}},
"18D109" = {{18, 2, 0}, "macOS", {"Mojave", {10, 14, 3}}}, "18D109" = {{18, 2, 0}, "macOS", {"Mojave", {10, 14, 3}}},
"18E226" = {{18, 5, 0}, "macOS", {"Mojave", {10, 14, 4}}}, "18E226" = {{18, 5, 0}, "macOS", {"Mojave", {10, 14, 4}}},
"18E227" = {{18, 5, 0}, "macOS", {"Mojave", {10, 14, 4}}}, "18E227" = {{18, 5, 0}, "macOS", {"Mojave", {10, 14, 4}}},
"18F132" = {{18, 6, 0}, "macOS", {"Mojave", {10, 14, 5}}}, "18F132" = {{18, 6, 0}, "macOS", {"Mojave", {10, 14, 5}}},
"18G84" = {{18, 7, 0}, "macOS", {"Mojave", {10, 14, 6}}}, "18G84" = {{18, 7, 0}, "macOS", {"Mojave", {10, 14, 6}}},
"18G87" = {{18, 7, 0}, "macOS", {"Mojave", {10, 14, 6}}}, "18G87" = {{18, 7, 0}, "macOS", {"Mojave", {10, 14, 6}}},
"18G95" = {{18, 7, 0}, "macOS", {"Mojave", {10, 14, 6}}}, "18G95" = {{18, 7, 0}, "macOS", {"Mojave", {10, 14, 6}}},
"18G103" = {{18, 7, 0}, "macOS", {"Mojave", {10, 14, 6}}}, "18G103" = {{18, 7, 0}, "macOS", {"Mojave", {10, 14, 6}}},
"18G1012" = {{18, 7, 0}, "macOS", {"Mojave", {10, 14, 6}}}, "18G1012" = {{18, 7, 0}, "macOS", {"Mojave", {10, 14, 6}}},
"18G2022" = {{18, 7, 0}, "macOS", {"Mojave", {10, 14, 6}}}, "18G2022" = {{18, 7, 0}, "macOS", {"Mojave", {10, 14, 6}}},
"18G3020" = {{18, 7, 0}, "macOS", {"Mojave", {10, 14, 6}}}, "18G3020" = {{18, 7, 0}, "macOS", {"Mojave", {10, 14, 6}}},
"18G4032" = {{18, 7, 0}, "macOS", {"Mojave", {10, 14, 6}}}, "18G4032" = {{18, 7, 0}, "macOS", {"Mojave", {10, 14, 6}}},
"18G5033" = {{18, 7, 0}, "macOS", {"Mojave", {10, 14, 6}}}, "18G5033" = {{18, 7, 0}, "macOS", {"Mojave", {10, 14, 6}}},
"18G6020" = {{18, 7, 0}, "macOS", {"Mojave", {10, 14, 6}}}, "18G6020" = {{18, 7, 0}, "macOS", {"Mojave", {10, 14, 6}}},
"18G6032" = {{18, 7, 0}, "macOS", {"Mojave", {10, 14, 6}}}, "18G6032" = {{18, 7, 0}, "macOS", {"Mojave", {10, 14, 6}}},
"18G6042" = {{18, 7, 0}, "macOS", {"Mojave", {10, 14, 6}}}, "18G6042" = {{18, 7, 0}, "macOS", {"Mojave", {10, 14, 6}}},
"18G7016" = {{18, 7, 0}, "macOS", {"Mojave", {10, 14, 6}}}, "18G7016" = {{18, 7, 0}, "macOS", {"Mojave", {10, 14, 6}}},
"18G8012" = {{18, 7, 0}, "macOS", {"Mojave", {10, 14, 6}}}, "18G8012" = {{18, 7, 0}, "macOS", {"Mojave", {10, 14, 6}}},
"18G8022" = {{18, 7, 0}, "macOS", {"Mojave", {10, 14, 6}}}, "18G8022" = {{18, 7, 0}, "macOS", {"Mojave", {10, 14, 6}}},
"18G9028" = {{18, 7, 0}, "macOS", {"Mojave", {10, 14, 6}}}, "18G9028" = {{18, 7, 0}, "macOS", {"Mojave", {10, 14, 6}}},
"18G9216" = {{18, 7, 0}, "macOS", {"Mojave", {10, 14, 6}}}, "18G9216" = {{18, 7, 0}, "macOS", {"Mojave", {10, 14, 6}}},
"18G9323" = {{18, 7, 0}, "macOS", {"Mojave", {10, 14, 6}}}, "18G9323" = {{18, 7, 0}, "macOS", {"Mojave", {10, 14, 6}}},
// MacOS Catalina // MacOS Catalina
"19A583" = {{19, 0, 0}, "macOS", {"Catalina", {10, 15, 0}}}, "19A583" = {{19, 0, 0}, "macOS", {"Catalina", {10, 15, 0}}},
"19A602" = {{19, 0, 0}, "macOS", {"Catalina", {10, 15, 0}}}, "19A602" = {{19, 0, 0}, "macOS", {"Catalina", {10, 15, 0}}},
"19A603" = {{19, 0, 0}, "macOS", {"Catalina", {10, 15, 0}}}, "19A603" = {{19, 0, 0}, "macOS", {"Catalina", {10, 15, 0}}},
"19B88" = {{19, 0, 0}, "macOS", {"Catalina", {10, 15, 1}}}, "19B88" = {{19, 0, 0}, "macOS", {"Catalina", {10, 15, 1}}},
"19C57" = {{19, 2, 0}, "macOS", {"Catalina", {10, 15, 2}}}, "19C57" = {{19, 2, 0}, "macOS", {"Catalina", {10, 15, 2}}},
"19C58" = {{19, 2, 0}, "macOS", {"Catalina", {10, 15, 2}}}, "19C58" = {{19, 2, 0}, "macOS", {"Catalina", {10, 15, 2}}},
"19D76" = {{19, 3, 0}, "macOS", {"Catalina", {10, 15, 3}}}, "19D76" = {{19, 3, 0}, "macOS", {"Catalina", {10, 15, 3}}},
"19E266" = {{19, 4, 0}, "macOS", {"Catalina", {10, 15, 4}}}, "19E266" = {{19, 4, 0}, "macOS", {"Catalina", {10, 15, 4}}},
"19E287" = {{19, 4, 0}, "macOS", {"Catalina", {10, 15, 4}}}, "19E287" = {{19, 4, 0}, "macOS", {"Catalina", {10, 15, 4}}},
"19F96" = {{19, 5, 0}, "macOS", {"Catalina", {10, 15, 5}}}, "19F96" = {{19, 5, 0}, "macOS", {"Catalina", {10, 15, 5}}},
"19F101" = {{19, 5, 0}, "macOS", {"Catalina", {10, 15, 5}}}, "19F101" = {{19, 5, 0}, "macOS", {"Catalina", {10, 15, 5}}},
"19G73" = {{19, 6, 0}, "macOS", {"Catalina", {10, 15, 6}}}, "19G73" = {{19, 6, 0}, "macOS", {"Catalina", {10, 15, 6}}},
"19G2021" = {{19, 6, 0}, "macOS", {"Catalina", {10, 15, 6}}}, "19G2021" = {{19, 6, 0}, "macOS", {"Catalina", {10, 15, 6}}},
"19H2" = {{19, 6, 0}, "macOS", {"Catalina", {10, 15, 7}}}, "19H2" = {{19, 6, 0}, "macOS", {"Catalina", {10, 15, 7}}},
"19H4" = {{19, 6, 0}, "macOS", {"Catalina", {10, 15, 7}}}, "19H4" = {{19, 6, 0}, "macOS", {"Catalina", {10, 15, 7}}},
"19H15" = {{19, 6, 0}, "macOS", {"Catalina", {10, 15, 7}}}, "19H15" = {{19, 6, 0}, "macOS", {"Catalina", {10, 15, 7}}},
"19H114" = {{19, 6, 0}, "macOS", {"Catalina", {10, 15, 7}}}, "19H114" = {{19, 6, 0}, "macOS", {"Catalina", {10, 15, 7}}},
"19H512" = {{19, 6, 0}, "macOS", {"Catalina", {10, 15, 7}}}, "19H512" = {{19, 6, 0}, "macOS", {"Catalina", {10, 15, 7}}},
"19H524" = {{19, 6, 0}, "macOS", {"Catalina", {10, 15, 7}}}, "19H524" = {{19, 6, 0}, "macOS", {"Catalina", {10, 15, 7}}},
"19H1030" = {{19, 6, 0}, "macOS", {"Catalina", {10, 15, 7}}}, "19H1030" = {{19, 6, 0}, "macOS", {"Catalina", {10, 15, 7}}},
"19H1217" = {{19, 6, 0}, "macOS", {"Catalina", {10, 15, 7}}}, "19H1217" = {{19, 6, 0}, "macOS", {"Catalina", {10, 15, 7}}},
"19H1323" = {{19, 6, 0}, "macOS", {"Catalina", {10, 15, 7}}}, "19H1323" = {{19, 6, 0}, "macOS", {"Catalina", {10, 15, 7}}},
"19H1417" = {{19, 6, 0}, "macOS", {"Catalina", {10, 15, 7}}}, "19H1417" = {{19, 6, 0}, "macOS", {"Catalina", {10, 15, 7}}},
"19H1419" = {{19, 6, 0}, "macOS", {"Catalina", {10, 15, 7}}}, "19H1419" = {{19, 6, 0}, "macOS", {"Catalina", {10, 15, 7}}},
"19H1519" = {{19, 6, 0}, "macOS", {"Catalina", {10, 15, 7}}}, "19H1519" = {{19, 6, 0}, "macOS", {"Catalina", {10, 15, 7}}},
"19H1615" = {{19, 6, 0}, "macOS", {"Catalina", {10, 15, 7}}}, "19H1615" = {{19, 6, 0}, "macOS", {"Catalina", {10, 15, 7}}},
"19H1713" = {{19, 6, 0}, "macOS", {"Catalina", {10, 15, 7}}}, "19H1713" = {{19, 6, 0}, "macOS", {"Catalina", {10, 15, 7}}},
"19H1715" = {{19, 6, 0}, "macOS", {"Catalina", {10, 15, 7}}}, "19H1715" = {{19, 6, 0}, "macOS", {"Catalina", {10, 15, 7}}},
"19H1824" = {{19, 6, 0}, "macOS", {"Catalina", {10, 15, 7}}}, "19H1824" = {{19, 6, 0}, "macOS", {"Catalina", {10, 15, 7}}},
"19H1922" = {{19, 6, 0}, "macOS", {"Catalina", {10, 15, 7}}}, "19H1922" = {{19, 6, 0}, "macOS", {"Catalina", {10, 15, 7}}},
"19H2026" = {{19, 6, 0}, "macOS", {"Catalina", {10, 15, 7}}}, "19H2026" = {{19, 6, 0}, "macOS", {"Catalina", {10, 15, 7}}},
// MacOS Big Sur // MacOS Big Sur
"20A2411" = {{20, 1, 0}, "macOS", {"Big Sur", {11, 0, 0}}}, "20A2411" = {{20, 1, 0}, "macOS", {"Big Sur", {11, 0, 0}}},
"20B29" = {{20, 1, 0}, "macOS", {"Big Sur", {11, 0, 1}}}, "20B29" = {{20, 1, 0}, "macOS", {"Big Sur", {11, 0, 1}}},
"20B50" = {{20, 1, 0}, "macOS", {"Big Sur", {11, 0, 1}}}, "20B50" = {{20, 1, 0}, "macOS", {"Big Sur", {11, 0, 1}}},
"20C69" = {{20, 2, 0}, "macOS", {"Big Sur", {11, 1, 0}}}, "20C69" = {{20, 2, 0}, "macOS", {"Big Sur", {11, 1, 0}}},
"20D64" = {{20, 3, 0}, "macOS", {"Big Sur", {11, 2, 0}}}, "20D64" = {{20, 3, 0}, "macOS", {"Big Sur", {11, 2, 0}}},
"20D74" = {{20, 3, 0}, "macOS", {"Big Sur", {11, 2, 1}}}, "20D74" = {{20, 3, 0}, "macOS", {"Big Sur", {11, 2, 1}}},
"20D75" = {{20, 3, 0}, "macOS", {"Big Sur", {11, 2, 1}}}, "20D75" = {{20, 3, 0}, "macOS", {"Big Sur", {11, 2, 1}}},
"20D80" = {{20, 3, 0}, "macOS", {"Big Sur", {11, 2, 2}}}, "20D80" = {{20, 3, 0}, "macOS", {"Big Sur", {11, 2, 2}}},
"20D91" = {{20, 3, 0}, "macOS", {"Big Sur", {11, 2, 3}}}, "20D91" = {{20, 3, 0}, "macOS", {"Big Sur", {11, 2, 3}}},
"20E232" = {{20, 4, 0}, "macOS", {"Big Sur", {11, 3, 0}}}, "20E232" = {{20, 4, 0}, "macOS", {"Big Sur", {11, 3, 0}}},
"20E241" = {{20, 4, 0}, "macOS", {"Big Sur", {11, 3, 1}}}, "20E241" = {{20, 4, 0}, "macOS", {"Big Sur", {11, 3, 1}}},
"20F71" = {{20, 5, 0}, "macOS", {"Big Sur", {11, 4, 0}}}, "20F71" = {{20, 5, 0}, "macOS", {"Big Sur", {11, 4, 0}}},
"20G71" = {{20, 6, 0}, "macOS", {"Big Sur", {11, 5, 0}}}, "20G71" = {{20, 6, 0}, "macOS", {"Big Sur", {11, 5, 0}}},
"20G80" = {{20, 6, 0}, "macOS", {"Big Sur", {11, 5, 1}}}, "20G80" = {{20, 6, 0}, "macOS", {"Big Sur", {11, 5, 1}}},
"20G95" = {{20, 6, 0}, "macOS", {"Big Sur", {11, 5, 2}}}, "20G95" = {{20, 6, 0}, "macOS", {"Big Sur", {11, 5, 2}}},
"20G165" = {{20, 6, 0}, "macOS", {"Big Sur", {11, 6, 0}}}, "20G165" = {{20, 6, 0}, "macOS", {"Big Sur", {11, 6, 0}}},
"20G224" = {{20, 6, 0}, "macOS", {"Big Sur", {11, 6, 1}}}, "20G224" = {{20, 6, 0}, "macOS", {"Big Sur", {11, 6, 1}}},
"20G314" = {{20, 6, 0}, "macOS", {"Big Sur", {11, 6, 2}}}, "20G314" = {{20, 6, 0}, "macOS", {"Big Sur", {11, 6, 2}}},
"20G415" = {{20, 6, 0}, "macOS", {"Big Sur", {11, 6, 3}}}, "20G415" = {{20, 6, 0}, "macOS", {"Big Sur", {11, 6, 3}}},
"20G417" = {{20, 6, 0}, "macOS", {"Big Sur", {11, 6, 4}}}, "20G417" = {{20, 6, 0}, "macOS", {"Big Sur", {11, 6, 4}}},
"20G527" = {{20, 6, 0}, "macOS", {"Big Sur", {11, 6, 5}}}, "20G527" = {{20, 6, 0}, "macOS", {"Big Sur", {11, 6, 5}}},
"20G624" = {{20, 6, 0}, "macOS", {"Big Sur", {11, 6, 6}}}, "20G624" = {{20, 6, 0}, "macOS", {"Big Sur", {11, 6, 6}}},
"20G630" = {{20, 6, 0}, "macOS", {"Big Sur", {11, 6, 7}}}, "20G630" = {{20, 6, 0}, "macOS", {"Big Sur", {11, 6, 7}}},
"20G730" = {{20, 6, 0}, "macOS", {"Big Sur", {11, 6, 8}}}, "20G730" = {{20, 6, 0}, "macOS", {"Big Sur", {11, 6, 8}}},
"20G817" = {{20, 6, 0}, "macOS", {"Big Sur", {11, 7, 0}}},
"20G918" = {{20, 6, 0}, "macOS", {"Big Sur", {11, 7, 1}}},
"20G1020" = {{20, 6, 0}, "macOS", {"Big Sur", {11, 7, 2}}},
"20G1116" = {{20, 6, 0}, "macOS", {"Big Sur", {11, 7, 3}}},
"20G1120" = {{20, 6, 0}, "macOS", {"Big Sur", {11, 7, 4}}},
"20G1225" = {{20, 6, 0}, "macOS", {"Big Sur", {11, 7, 5}}},
"20G1231" = {{20, 6, 0}, "macOS", {"Big Sur", {11, 7, 6}}},
"20G1345" = {{20, 6, 0}, "macOS", {"Big Sur", {11, 7, 7}}},
"20G1351" = {{20, 6, 0}, "macOS", {"Big Sur", {11, 7, 8}}},
"20G1426" = {{20, 6, 0}, "macOS", {"Big Sur", {11, 7, 9}}},
"20G1427" = {{20, 6, 0}, "macOS", {"Big Sur", {11, 7, 10}}},
// MacOS Monterey // MacOS Monterey
"21A344" = {{21, 0, 1}, "macOS", {"Monterey", {12, 0, 0}}}, "21A344" = {{21, 0, 1}, "macOS", {"Monterey", {12, 0, 0}}},
"21A559" = {{21, 1, 0}, "macOS", {"Monterey", {12, 0, 1}}}, "21A559" = {{21, 1, 0}, "macOS", {"Monterey", {12, 0, 1}}},
"21C52" = {{21, 2, 0}, "macOS", {"Monterey", {12, 1, 0}}}, "21C52" = {{21, 2, 0}, "macOS", {"Monterey", {12, 1, 0}}},
"21D49" = {{21, 3, 0}, "macOS", {"Monterey", {12, 2, 0}}}, "21D49" = {{21, 3, 0}, "macOS", {"Monterey", {12, 2, 0}}},
"21D62" = {{21, 3, 0}, "macOS", {"Monterey", {12, 2, 1}}}, "21D62" = {{21, 3, 0}, "macOS", {"Monterey", {12, 2, 1}}},
"21E230" = {{21, 4, 0}, "macOS", {"Monterey", {12, 3, 0}}}, "21E230" = {{21, 4, 0}, "macOS", {"Monterey", {12, 3, 0}}},
"21E258" = {{21, 4, 0}, "macOS", {"Monterey", {12, 3, 1}}}, "21E258" = {{21, 4, 0}, "macOS", {"Monterey", {12, 3, 1}}},
"21F79" = {{21, 5, 0}, "macOS", {"Monterey", {12, 4, 0}}}, "21F79" = {{21, 5, 0}, "macOS", {"Monterey", {12, 4, 0}}},
"21F2081" = {{21, 5, 0}, "macOS", {"Monterey", {12, 4, 0}}}, "21F2081" = {{21, 5, 0}, "macOS", {"Monterey", {12, 4, 0}}},
"21F2092" = {{21, 5, 0}, "macOS", {"Monterey", {12, 4, 0}}}, "21F2092" = {{21, 5, 0}, "macOS", {"Monterey", {12, 4, 0}}},
"21G72" = {{21, 6, 0}, "macOS", {"Monterey", {12, 5, 0}}}, "21G72" = {{21, 6, 0}, "macOS", {"Monterey", {12, 5, 0}}},
"21G83" = {{21, 6, 0}, "macOS", {"Monterey", {12, 5, 1}}}, "21G83" = {{21, 6, 0}, "macOS", {"Monterey", {12, 5, 1}}},
"21G115" = {{21, 6, 0}, "macOS", {"Monterey", {12, 6, 0}}}, "21G115" = {{21, 6, 0}, "macOS", {"Monterey", {12, 6, 0}}},
"21G217" = {{21, 6, 0}, "macOS", {"Monterey", {12, 6, 1}}},
"21G320" = {{21, 6, 0}, "macOS", {"Monterey", {12, 6, 2}}},
"21G419" = {{21, 6, 0}, "macOS", {"Monterey", {12, 6, 3}}},
"21G526" = {{21, 6, 0}, "macOS", {"Monterey", {12, 6, 4}}},
"21G531" = {{21, 6, 0}, "macOS", {"Monterey", {12, 6, 5}}},
"21G646" = {{21, 6, 0}, "macOS", {"Monterey", {12, 6, 6}}},
"21G651" = {{21, 6, 0}, "macOS", {"Monterey", {12, 6, 7}}},
"21G725" = {{21, 6, 0}, "macOS", {"Monterey", {12, 6, 8}}},
"21G726" = {{21, 6, 0}, "macOS", {"Monterey", {12, 6, 9}}},
"21G816" = {{21, 6, 0}, "macOS", {"Monterey", {12, 7, 0}}},
"21G920" = {{21, 6, 0}, "macOS", {"Monterey", {12, 7, 1}}},
"21G1974" = {{21, 6, 0}, "macOS", {"Monterey", {12, 7, 2}}},
// MacOS Ventura
"22A380" = {{22, 1, 0}, "macOS", {"Ventura", {13, 0, 0}}},
"22A400" = {{22, 1, 0}, "macOS", {"Ventura", {13, 0, 1}}},
"22C65" = {{22, 2, 0}, "macOS", {"Ventura", {13, 1, 0}}},
"22D49" = {{22, 3, 0}, "macOS", {"Ventura", {13, 2, 0}}},
"22D68" = {{22, 3, 0}, "macOS", {"Ventura", {13, 2, 1}}},
"22E252" = {{22, 4, 0}, "macOS", {"Ventura", {13, 3, 0}}},
"22E261" = {{22, 4, 0}, "macOS", {"Ventura", {13, 3, 1}}},
"22F66" = {{22, 5, 0}, "macOS", {"Ventura", {13, 4, 0}}},
"22F82" = {{22, 5, 0}, "macOS", {"Ventura", {13, 4, 1}}},
"22E772610a" = {{22, 5, 0}, "macOS", {"Ventura", {13, 4, 1}}},
"22F770820d" = {{22, 5, 0}, "macOS", {"Ventura", {13, 4, 1}}},
"22G74" = {{22, 6, 0}, "macOS", {"Ventura", {13, 5, 0}}},
"22G90" = {{22, 6, 0}, "macOS", {"Ventura", {13, 5, 1}}},
"22G91" = {{22, 6, 0}, "macOS", {"Ventura", {13, 5, 2}}},
"22G120" = {{22, 6, 0}, "macOS", {"Ventura", {13, 6, 0}}},
"22G313" = {{22, 6, 0}, "macOS", {"Ventura", {13, 6, 1}}},
"22G320" = {{22, 6, 0}, "macOS", {"Ventura", {13, 6, 2}}},
// MacOS Sonoma
"23A344" = {{23, 0, 0}, "macOS", {"Sonoma", {14, 0, 0}}},
"23B74" = {{23, 1, 0}, "macOS", {"Sonoma", {14, 1, 0}}},
"23B81" = {{23, 1, 0}, "macOS", {"Sonoma", {14, 1, 1}}},
"23B92" = {{23, 1, 0}, "macOS", {"Sonoma", {14, 1, 2}}},
"23C64" = {{23, 2, 0}, "macOS", {"Sonoma", {14, 2, 0}}},
"23C71" = {{23, 2, 0}, "macOS", {"Sonoma", {14, 2, 1}}},
} }
@(private) @(private)
+423 -65
View File
@@ -1,7 +1,9 @@
package linux package linux
/// Represents an error returned by most of syscalls /*
Represents an error returned by most of syscalls
*/
Errno :: enum i32 { Errno :: enum i32 {
NONE = 0, NONE = 0,
// Errno-base // Errno-base
@@ -142,8 +144,9 @@ Errno :: enum i32 {
EDEADLOCK = EDEADLK, EDEADLOCK = EDEADLK,
} }
/*
/// Bits for Open_Flags Bits for Open_Flags
*/
Open_Flags_Bits :: enum { Open_Flags_Bits :: enum {
RDONLY = 0, RDONLY = 0,
WRONLY = 1, WRONLY = 1,
@@ -164,7 +167,9 @@ Open_Flags_Bits :: enum {
PATH = 21, PATH = 21,
} }
/// Bits for FD_Flags bitset /*
Bits for FD_Flags bitset
*/
FD_Flags_Bits :: enum { FD_Flags_Bits :: enum {
SYMLINK_NOFOLLOW = 8, SYMLINK_NOFOLLOW = 8,
REMOVEDIR = 9, REMOVEDIR = 9,
@@ -177,7 +182,9 @@ FD_Flags_Bits :: enum {
RECURSIVE = 15, RECURSIVE = 15,
} }
/// The bits for the Mode bitset. /*
The bits for the Mode bitset.
*/
Mode_Bits :: enum { Mode_Bits :: enum {
IXOTH = 0, // 0o0000001 IXOTH = 0, // 0o0000001
IWOTH = 1, // 0o0000002 IWOTH = 1, // 0o0000002
@@ -197,7 +204,9 @@ Mode_Bits :: enum {
IFREG = 15, // 0o0100000 IFREG = 15, // 0o0100000
} }
/// The bits used by the Statx_Mask bitset /*
The bits used by the Statx_Mask bitset
*/
Statx_Mask_Bits :: enum { Statx_Mask_Bits :: enum {
TYPE = 0, TYPE = 0,
MODE = 1, MODE = 1,
@@ -215,8 +224,10 @@ Statx_Mask_Bits :: enum {
DIOALIGN = 13, 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 { Statx_Attr_Bits :: enum {
COMPRESSED = 2, // 0x00000004 COMPRESSED = 2, // 0x00000004
IMMUTABLE = 4, // 0x00000010 IMMUTABLE = 4, // 0x00000010
@@ -229,7 +240,9 @@ Statx_Attr_Bits :: enum {
DAX = 21, // 0x00200000 DAX = 21, // 0x00200000
} }
/// Magic bits for filesystems returned by Stat_FS /*
Magic bits for filesystems returned by Stat_FS
*/
FS_Magic :: enum u32 { FS_Magic :: enum u32 {
ADFS_SUPER_MAGIC = 0xadf5, ADFS_SUPER_MAGIC = 0xadf5,
AFFS_SUPER_MAGIC = 0xadff, AFFS_SUPER_MAGIC = 0xadff,
@@ -317,7 +330,9 @@ FS_Magic :: enum u32 {
_XIAFS_SUPER_MAGIC = 0x012fd16d, _XIAFS_SUPER_MAGIC = 0x012fd16d,
} }
/// Bits for FS_Flags bitset /*
Bits for FS_Flags bitset
*/
FS_Flags_Bits :: enum { FS_Flags_Bits :: enum {
RDONLY = 0, RDONLY = 0,
NOSUID = 1, NOSUID = 1,
@@ -340,20 +355,26 @@ Seek_Whence :: enum i16 {
HOLE = 4, HOLE = 4,
} }
/// Bits for Close_Range_Flags /*
Bits for Close_Range_Flags
*/
Close_Range_Flags_Bits :: enum { Close_Range_Flags_Bits :: enum {
CLOEXEC = 2, CLOEXEC = 2,
UNSHARE = 1, UNSHARE = 1,
} }
/// Bits for Rename_Flags /*
Bits for Rename_Flags
*/
Rename_Flags_Bits :: enum { Rename_Flags_Bits :: enum {
EXCHANGE = 1, EXCHANGE = 1,
NOREPLACE = 0, NOREPLACE = 0,
WHITEOUT = 2, WHITEOUT = 2,
} }
/// Type of the file in a directory entry /*
Type of the file in a directory entry
*/
Dirent_Type :: enum u8 { Dirent_Type :: enum u8 {
UNKNOWN = 0, UNKNOWN = 0,
FIFO = 1, FIFO = 1,
@@ -366,14 +387,18 @@ Dirent_Type :: enum u8 {
WHT = 14, WHT = 14,
} }
/// Type of a lock for fcntl.2 /*
Type of a lock for fcntl(2)
*/
FLock_Type :: enum i16 { FLock_Type :: enum i16 {
RDLCK = 0, RDLCK = 0,
WRLCK = 1, WRLCK = 1,
UNLCK = 2, UNLCK = 2,
} }
/// Bits for FD_Notifications /*
Bits for FD_Notifications
*/
FD_Notifications_Bits :: enum { FD_Notifications_Bits :: enum {
ACCESS = 0, ACCESS = 0,
MODIFY = 1, MODIFY = 1,
@@ -384,7 +409,9 @@ FD_Notifications_Bits :: enum {
MULTISHOT = 31, MULTISHOT = 31,
} }
/// Bits for seal /*
Bits for seal
*/
Seal_Bits :: enum { Seal_Bits :: enum {
SEAL = 0, SEAL = 0,
SHRINK = 1, SHRINK = 1,
@@ -408,14 +435,18 @@ FD_Lease :: enum {
UNLCK = 2, UNLCK = 2,
} }
/// Kind of owner for FD_Owner /*
Kind of owner for FD_Owner
*/
F_Owner_Type :: enum i32 { F_Owner_Type :: enum i32 {
OWNER_TID = 0, OWNER_TID = 0,
OWNER_PID = 1, OWNER_PID = 1,
OWNER_PGRP = 2, OWNER_PGRP = 2,
} }
/// Command for fcntl.2 /*
Command for fcntl(2)
*/
FCntl_Command :: enum { FCntl_Command :: enum {
DUPFD = 0, DUPFD = 0,
GETFD = 1, GETFD = 1,
@@ -465,7 +496,9 @@ Fd_Poll_Events_Bits :: enum {
RDHUP = 13, RDHUP = 13,
} }
/// Bits for Mem_Protection bitfield /*
Bits for Mem_Protection bitfield
*/
Mem_Protection_Bits :: enum{ Mem_Protection_Bits :: enum{
READ = 0, READ = 0,
WRITE = 1, WRITE = 1,
@@ -479,7 +512,9 @@ Mem_Protection_Bits :: enum{
GROWSUP = 25, GROWSUP = 25,
} }
/// Bits for Map_Flags /*
Bits for Map_Flags
*/
Map_Flags_Bits :: enum { Map_Flags_Bits :: enum {
SHARED = 0, SHARED = 0,
PRIVATE = 1, PRIVATE = 1,
@@ -504,19 +539,25 @@ Map_Flags_Bits :: enum {
UNINITIALIZED = 26, UNINITIALIZED = 26,
} }
/// Bits for MLock_Flags /*
Bits for MLock_Flags
*/
MLock_Flags_Bits :: enum { MLock_Flags_Bits :: enum {
ONFAULT = 0, ONFAULT = 0,
} }
/// Bits for MSync_Flags /*
Bits for MSync_Flags
*/
MSync_Flags_Bits :: enum { MSync_Flags_Bits :: enum {
ASYNC = 0, ASYNC = 0,
INVALIDATE = 1, INVALIDATE = 1,
SYNC = 2, SYNC = 2,
} }
/// Argument for madvice.2 /*
Argument for madvice(2)
*/
MAdvice :: enum { MAdvice :: enum {
NORMAL = 0, NORMAL = 0,
RANDOM = 1, RANDOM = 1,
@@ -545,27 +586,35 @@ MAdvice :: enum {
SOFT_OFFLINE = 101, SOFT_OFFLINE = 101,
} }
/// Bits for PKey_Access_Rights /*
Bits for PKey_Access_Rights
*/
PKey_Access_Bits :: enum { PKey_Access_Bits :: enum {
DISABLE_ACCESS = 0, DISABLE_ACCESS = 0,
DISABLE_WRITE = 2, DISABLE_WRITE = 2,
} }
/// Bits for MRemap_Flags /*
Bits for MRemap_Flags
*/
MRemap_Flags_Bits :: enum { MRemap_Flags_Bits :: enum {
MAYMOVE = 0, MAYMOVE = 0,
FIXED = 1, FIXED = 1,
DONTUNMAP = 2, DONTUNMAP = 2,
} }
/// Bits for Get_Random_Flags /*
Bits for Get_Random_Flags
*/
Get_Random_Flags_Bits :: enum { Get_Random_Flags_Bits :: enum {
RANDOM = 0, RANDOM = 0,
NONBLOCK = 1, NONBLOCK = 1,
INSECURE = 2, INSECURE = 2,
} }
/// Bits for Perf_Flags /*
Bits for Perf_Flags
*/
Perf_Flags_Bits :: enum { Perf_Flags_Bits :: enum {
FD_NO_GROUP = 0, FD_NO_GROUP = 0,
FD_OUTPUT = 1, FD_OUTPUT = 1,
@@ -573,7 +622,9 @@ Perf_Flags_Bits :: enum {
FD_CLOEXEC = 3, FD_CLOEXEC = 3,
} }
/// Union tag for Perf_Event_Attr struct /*
Union tag for Perf_Event_Attr struct
*/
Perf_Event_Type :: enum u32 { Perf_Event_Type :: enum u32 {
HARDWARE = 0, HARDWARE = 0,
SOFTWARE = 1, SOFTWARE = 1,
@@ -633,7 +684,9 @@ Perf_Cap_Flags_Bits :: enum u64 {
User_Time_Short = 5, 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 { Perf_Hardware_Id :: enum u64 {
CPU_CYCLES = 0, CPU_CYCLES = 0,
INSTRUCTIONS = 1, INSTRUCTIONS = 1,
@@ -647,7 +700,9 @@ Perf_Hardware_Id :: enum u64 {
REF_CPU_CYCLES = 9, 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 { Perf_Hardware_Cache_Id :: enum u64 {
L1D = 0, L1D = 0,
L1I = 1, L1I = 1,
@@ -658,20 +713,26 @@ Perf_Hardware_Cache_Id :: enum u64 {
NODE = 6, 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 { Perf_Hardware_Cache_Op_Id :: enum u64 {
READ = 0, READ = 0,
WRITE = 1, WRITE = 1,
PREFETCH = 2, 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 { Perf_Hardware_Cache_Result_Id :: enum u64 {
ACCESS = 0, ACCESS = 0,
MISS = 1, 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 { Perf_Software_Id :: enum u64 {
CPU_CLOCK = 0, CPU_CLOCK = 0,
TASK_CLOCK = 1, 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 { Perf_Event_Sample_Type_Bits :: enum {
IP = 0, IP = 0,
TID = 1, TID = 1,
@@ -726,7 +789,9 @@ Perf_Read_Format_Bits :: enum {
LOST = 4, LOST = 4,
} }
/// Chooses the breakpoint type /*
Chooses the breakpoint type
*/
Hardware_Breakpoint_Type :: enum u32 { Hardware_Breakpoint_Type :: enum u32 {
EMPTY = 0, EMPTY = 0,
R = 1, R = 1,
@@ -736,7 +801,9 @@ Hardware_Breakpoint_Type :: enum u32 {
INVALID = RW | X, INVALID = RW | X,
} }
/// Bits for Branch_Sample_Type /*
Bits for Branch_Sample_Type
*/
Branch_Sample_Type_Bits :: enum { Branch_Sample_Type_Bits :: enum {
USER = 0, USER = 0,
KERNEL = 1, KERNEL = 1,
@@ -759,7 +826,9 @@ Branch_Sample_Type_Bits :: enum {
PRIV_SAVE = 18, PRIV_SAVE = 18,
} }
/// Represent the type of Id /*
Represent the type of Id
*/
Id_Type :: enum uint { Id_Type :: enum uint {
ALL = 0, ALL = 0,
PID = 1, PID = 1,
@@ -767,7 +836,9 @@ Id_Type :: enum uint {
PIDFD = 3, PIDFD = 3,
} }
/// Options for wait syscalls /*
Options for wait syscalls
*/
Wait_Option :: enum { Wait_Option :: enum {
WNOHANG = 0, WNOHANG = 0,
WUNTRACED = 1, WUNTRACED = 1,
@@ -781,12 +852,16 @@ Wait_Option :: enum {
__WCLONE = 31, __WCLONE = 31,
} }
/// Bits for flags for pidfd /*
Bits for flags for pidfd
*/
Pid_FD_Flags_Bits :: enum { Pid_FD_Flags_Bits :: enum {
NONBLOCK = 11, NONBLOCK = 11,
} }
/// Priority for process, process group, user /*
Priority for process, process group, user
*/
Priority_Which :: enum i32 { Priority_Which :: enum i32 {
PROCESS = 0, PROCESS = 0,
PGRP = 1, PGRP = 1,
@@ -849,10 +924,12 @@ Sig_Stack_Flag :: enum i32 {
AUTODISARM = 31, AUTODISARM = 31,
} }
/// Type of socket to create /*
/// For TCP you want to use SOCK_STREAM Type of socket to create
/// For UDP you want to use SOCK_DGRAM - For TCP you want to use SOCK_STREAM
/// Also see Protocol - For UDP you want to use SOCK_DGRAM
Also see `Protocol`
*/
Socket_Type :: enum { Socket_Type :: enum {
STREAM = 1, STREAM = 1,
DGRAM = 2, DGRAM = 2,
@@ -863,13 +940,17 @@ Socket_Type :: enum {
PACKET = 10, PACKET = 10,
} }
/// Bits for Socket_FD_Flags /*
Bits for Socket_FD_Flags
*/
Socket_FD_Flags_Bits :: enum { Socket_FD_Flags_Bits :: enum {
NONBLOCK = 14, NONBLOCK = 14,
CLOEXEC = 25, CLOEXEC = 25,
} }
/// Protocol family /*
Protocol family
*/
Protocol_Family :: enum u16 { Protocol_Family :: enum u16 {
UNSPEC = 0, UNSPEC = 0,
LOCAL = 1, LOCAL = 1,
@@ -922,11 +1003,13 @@ Protocol_Family :: enum u16 {
MCTP = 45, MCTP = 45,
} }
/// The protocol number according to IANA protocol number list /*
/// Full list of protocol numbers: The protocol number according to IANA protocol number list
/// https://www.iana.org/assignments/protocol-numbers/protocol-numbers.xhtml Full list of protocol numbers:
/// Supported by the OS protocols can be queried by reading: https://www.iana.org/assignments/protocol-numbers/protocol-numbers.xhtml
/// /etc/protocols Supported by the OS protocols can be queried by reading:
/etc/protocols
*/
Protocol :: enum { Protocol :: enum {
HOPOPT = 0, HOPOPT = 0,
ICMP = 1, ICMP = 1,
@@ -1066,7 +1149,9 @@ Protocol :: enum {
Reserved = 255, Reserved = 255,
} }
/// API Level for get/setsockopt.2 /*
API Level for getsockopt(2)/setsockopt(2)
*/
Socket_API_Level :: enum { Socket_API_Level :: enum {
// Comes from <bits/socket-constants.h> // Comes from <bits/socket-constants.h>
SOCKET = 1, SOCKET = 1,
@@ -1103,8 +1188,10 @@ Socket_API_Level :: enum {
SMC = 286, 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 { Socket_Option :: enum {
DEBUG = 1, DEBUG = 1,
REUSEADDR = 2, REUSEADDR = 2,
@@ -1249,7 +1336,9 @@ Socket_TCP_Option :: enum {
TX_DELAY = 37, TX_DELAY = 37,
} }
/// Bits for Socket_Msg /*
Bits for Socket_Msg
*/
Socket_Msg_Bits :: enum { Socket_Msg_Bits :: enum {
OOB = 0, OOB = 0,
PEEK = 1, PEEK = 1,
@@ -1275,14 +1364,18 @@ Socket_Msg_Bits :: enum {
CMSG_CLOEXEC = 30, CMSG_CLOEXEC = 30,
} }
/// Argument to shutdown.2 /*
Argument to shutdown(2)
*/
Shutdown_How :: enum i32 { Shutdown_How :: enum i32 {
RD = 0, RD = 0,
WR = 1, WR = 1,
RDWR = 2, RDWR = 2,
} }
/// Second argument to futex.2 syscall /*
Second argument to futex(2) syscall
*/
Futex_Op :: enum u32 { Futex_Op :: enum u32 {
WAIT = 0, WAIT = 0,
WAKE = 1, WAKE = 1,
@@ -1300,13 +1393,17 @@ Futex_Op :: enum u32 {
LOCK_PI2 = 13, LOCK_PI2 = 13,
} }
/// Bits for Futex_Flags /*
Bits for Futex_Flags
*/
Futex_Flags_Bits :: enum { Futex_Flags_Bits :: enum {
PRIVATE = 7, PRIVATE = 7,
REALTIME = 8, REALTIME = 8,
} }
/// Kind of operation on futex, see FUTEX_WAKE_OP /*
Kind of operation on futex, see FUTEX_WAKE_OP
*/
Futex_Arg_Op :: enum { Futex_Arg_Op :: enum {
SET = 0, /* uaddr2 = oparg; */ SET = 0, /* uaddr2 = oparg; */
ADD = 1, /* uaddr2 += oparg; */ ADD = 1, /* uaddr2 += oparg; */
@@ -1320,7 +1417,9 @@ Futex_Arg_Op :: enum {
PO2_XOR = 4, /* uaddr2 ^= 1<<oparg; */ 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 { Futex_Cmp_Op :: enum {
EQ = 0, /* if (oldval == cmparg) wake */ EQ = 0, /* if (oldval == cmparg) wake */
NE = 1, /* if (oldval != cmparg) wake */ NE = 1, /* if (oldval != cmparg) wake */
@@ -1330,7 +1429,9 @@ Futex_Cmp_Op :: enum {
GE = 5, /* if (oldval >= cmparg) wake */ GE = 5, /* if (oldval >= cmparg) wake */
} }
/// The kind of resource limits /*
The kind of resource limits
*/
RLimit_Kind :: enum i32 { RLimit_Kind :: enum i32 {
CPU = 0, CPU = 0,
FSIZE = 1, FSIZE = 1,
@@ -1351,7 +1452,9 @@ RLimit_Kind :: enum i32 {
NLIMITS = 16, NLIMITS = 16,
} }
/// Represents the user of resources /*
Represents the user of resources
*/
RUsage_Who :: enum i32 { RUsage_Who :: enum i32 {
CHILDREN = -1, CHILDREN = -1,
SELF = 0, SELF = 0,
@@ -1359,7 +1462,9 @@ RUsage_Who :: enum i32 {
LWP = THREAD, LWP = THREAD,
} }
/// Bits for Personality_Flags /*
Bits for Personality_Flags
*/
UNAME26 :: 17 UNAME26 :: 17
ADDR_NO_RANDOMIZE :: 18 ADDR_NO_RANDOMIZE :: 18
FDPIC_FUNCPTRS :: 19 FDPIC_FUNCPTRS :: 19
@@ -1372,8 +1477,10 @@ WHOLE_SECONDS :: 25
STICKY_TIMEOUTS :: 26 STICKY_TIMEOUTS :: 26
ADDR_LIMIT_3GB :: 27 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 :: 0x0000
PER_LINUX_32BIT :: 0x0000 | ADDR_LIMIT_32BIT PER_LINUX_32BIT :: 0x0000 | ADDR_LIMIT_32BIT
PER_LINUX_FDPIC :: 0x0000 | FDPIC_FUNCPTRS PER_LINUX_FDPIC :: 0x0000 | FDPIC_FUNCPTRS
@@ -1398,3 +1505,254 @@ PER_OSF4 :: 0x000f
PER_HPUX :: 0x0010 PER_HPUX :: 0x0010
PER_MASK :: 0x00ff 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
View File
@@ -1,26 +1,40 @@
package linux 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) 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) 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) 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) 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) WAIT_MYPGRP :: Pid(0)
/// Maximum priority (aka nice value) for the process /*
Maximum priority (aka nice value) for the process.
*/
PRIO_MAX :: 20 PRIO_MAX :: 20
/// Minimum priority (aka nice value) for the process /*
Minimum priority (aka nice value) for the process.
*/
PRIO_MIN :: -20 PRIO_MIN :: -20
SIGRTMIN :: Signal(32) SIGRTMIN :: Signal(32)
@@ -35,40 +49,64 @@ S_IFCHR :: Mode{.IFCHR}
S_IFDIR :: Mode{.IFDIR} S_IFDIR :: Mode{.IFDIR}
S_IFREG :: Mode{.IFREG} 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))} 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))} 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))} 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))} 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))} 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))} 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))} 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{} 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} 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} 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} R_OK :: Mode{.IROTH}
/// The stats you get by calling `stat` /*
The stats you get by calling `stat`.
*/
STATX_BASIC_STATS :: Statx_Mask { STATX_BASIC_STATS :: Statx_Mask {
.TYPE, .TYPE,
.MODE, .MODE,
@@ -83,6 +121,10 @@ STATX_BASIC_STATS :: Statx_Mask {
.BLOCKS, .BLOCKS,
} }
/*
Tell `shmget` to create a new key
*/
IPC_PRIVATE :: Key(0)
FCntl_Command_DUPFD :: distinct FCntl_Command FCntl_Command_DUPFD :: distinct FCntl_Command
FCntl_Command_GETFD :: 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_Cmp_requeue_Pi_Type :: distinct Futex_Op
Futex_Lock_Pi2_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) 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) FUTEX_WAKE :: Futex_Wake_Type(.WAKE)
/// Not implemented. Basically, since /*
Not implemented. Basically, since.
*/
FUTEX_FD :: Futex_Fd_Type(.FD) 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) 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) 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) 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) 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) FUTEX_WAKE_BITSET :: Futex_Wake_Bitset_Type(.WAKE_BITSET)
// TODO(flysand): Priority inversion futexes // 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_CMP_REQUEUE_PI :: Futex_Cmp_requeue_Pi_Type(.CMP_REQUEUE_PI)
FUTEX_LOCK_PI2 :: Futex_Lock_Pi2_Type(.LOCK_PI2) 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
View File
File diff suppressed because it is too large Load Diff
+746 -73
View File
File diff suppressed because it is too large Load Diff
+7 -2
View File
@@ -5,7 +5,7 @@ foreign import advapi32 "system:Advapi32.lib"
HCRYPTPROV :: distinct HANDLE HCRYPTPROV :: distinct HANDLE
@(default_calling_convention="stdcall") @(default_calling_convention="system")
foreign advapi32 { foreign advapi32 {
@(link_name = "SystemFunction036") @(link_name = "SystemFunction036")
RtlGenRandom :: proc(RandomBuffer: ^u8, RandomBufferLength: ULONG) -> BOOLEAN --- RtlGenRandom :: proc(RandomBuffer: ^u8, RandomBufferLength: ULONG) -> BOOLEAN ---
@@ -13,13 +13,18 @@ foreign advapi32 {
DesiredAccess: DWORD, DesiredAccess: DWORD,
TokenHandle: ^HANDLE) -> BOOL --- TokenHandle: ^HANDLE) -> BOOL ---
OpenThreadToken :: proc(ThreadHandle: HANDLE,
DesiredAccess: DWORD,
OpenAsSelf: BOOL,
TokenHandle: ^HANDLE) -> BOOL ---
CryptAcquireContextW :: proc(hProv: ^HCRYPTPROV, szContainer, szProvider: wstring, dwProvType, dwFlags: DWORD) -> DWORD --- CryptAcquireContextW :: proc(hProv: ^HCRYPTPROV, szContainer, szProvider: wstring, dwProvType, dwFlags: DWORD) -> DWORD ---
CryptGenRandom :: proc(hProv: HCRYPTPROV, dwLen: DWORD, buf: LPVOID) -> DWORD --- CryptGenRandom :: proc(hProv: HCRYPTPROV, dwLen: DWORD, buf: LPVOID) -> DWORD ---
CryptReleaseContext :: proc(hProv: HCRYPTPROV, dwFlags: DWORD) -> DWORD --- CryptReleaseContext :: proc(hProv: HCRYPTPROV, dwFlags: DWORD) -> DWORD ---
} }
// Necessary to create a token to impersonate a user with for CreateProcessAsUser // Necessary to create a token to impersonate a user with for CreateProcessAsUser
@(default_calling_convention="stdcall") @(default_calling_convention="system")
foreign advapi32 { foreign advapi32 {
LogonUserW :: proc( LogonUserW :: proc(
lpszUsername: LPCWSTR, lpszUsername: LPCWSTR,
+1 -1
View File
@@ -5,7 +5,7 @@ foreign import bcrypt "system:Bcrypt.lib"
BCRYPT_USE_SYSTEM_PREFERRED_RNG: DWORD : 0x00000002 BCRYPT_USE_SYSTEM_PREFERRED_RNG: DWORD : 0x00000002
@(default_calling_convention="stdcall") @(default_calling_convention="system")
foreign bcrypt { foreign bcrypt {
BCryptGenRandom :: proc(hAlgorithm: LPVOID, pBuffer: [^]u8, cbBuffer: ULONG, dwFlags: ULONG) -> LONG --- BCryptGenRandom :: proc(hAlgorithm: LPVOID, pBuffer: [^]u8, cbBuffer: ULONG, dwFlags: ULONG) -> LONG ---
} }
+1 -1
View File
@@ -51,7 +51,7 @@ BLUETOOTH_DEVICE_INFO :: struct {
name: [BLUETOOTH_MAX_NAME_SIZE]u16, // Name of the device name: [BLUETOOTH_MAX_NAME_SIZE]u16, // Name of the device
} }
@(default_calling_convention="stdcall") @(default_calling_convention="system")
foreign bthprops { foreign bthprops {
/* /*
Version Version
+1 -1
View File
@@ -3,7 +3,7 @@ package sys_windows
foreign import "system:Comctl32.lib" foreign import "system:Comctl32.lib"
@(default_calling_convention="stdcall") @(default_calling_convention="system")
foreign Comctl32 { foreign Comctl32 {
LoadIconWithScaleDown :: proc(hinst: HINSTANCE, pszName: PCWSTR, cx: c_int, cy: c_int, phico: ^HICON) -> HRESULT --- LoadIconWithScaleDown :: proc(hinst: HINSTANCE, pszName: PCWSTR, cx: c_int, cy: c_int, phico: ^HICON) -> HRESULT ---
} }
+2 -2
View File
@@ -3,7 +3,7 @@ package sys_windows
foreign import "system:Comdlg32.lib" foreign import "system:Comdlg32.lib"
LPOFNHOOKPROC :: #type proc "stdcall" (hdlg: HWND, msg: u32, wparam: WPARAM, lparam: LPARAM) -> UINT_PTR LPOFNHOOKPROC :: #type proc "system" (hdlg: HWND, msg: u32, wparam: WPARAM, lparam: LPARAM) -> UINT_PTR
OPENFILENAMEW :: struct { OPENFILENAMEW :: struct {
lStructSize: DWORD, lStructSize: DWORD,
@@ -31,7 +31,7 @@ OPENFILENAMEW :: struct {
FlagsEx: DWORD, FlagsEx: DWORD,
} }
@(default_calling_convention="stdcall") @(default_calling_convention="system")
foreign Comdlg32 { foreign Comdlg32 {
GetOpenFileNameW :: proc(arg1: ^OPENFILENAMEW) -> BOOL --- GetOpenFileNameW :: proc(arg1: ^OPENFILENAMEW) -> BOOL ---
GetSaveFileNameW :: proc(arg1: ^OPENFILENAMEW) -> BOOL --- GetSaveFileNameW :: proc(arg1: ^OPENFILENAMEW) -> BOOL ---
+2 -2
View File
@@ -44,7 +44,7 @@ MINIDUMP_USER_STREAM_INFORMATION :: struct {
UserStreamArray: ^MINIDUMP_USER_STREAM, UserStreamArray: ^MINIDUMP_USER_STREAM,
} }
MINIDUMP_CALLBACK_ROUTINE :: #type proc "stdcall" ( MINIDUMP_CALLBACK_ROUTINE :: #type proc "system" (
CallbackParam: PVOID, CallbackParam: PVOID,
CallbackInput: ^MINIDUMP_CALLBACK_INPUT, CallbackInput: ^MINIDUMP_CALLBACK_INPUT,
CallbackOutpu: ^MINIDUMP_CALLBACK_OUTPUT, CallbackOutpu: ^MINIDUMP_CALLBACK_OUTPUT,
@@ -228,7 +228,7 @@ MINIDUMP_TYPE :: enum u32 {
ValidTypeFlags = 0x01ffffff, ValidTypeFlags = 0x01ffffff,
} }
@(default_calling_convention = "stdcall") @(default_calling_convention = "system")
foreign Dbghelp { foreign Dbghelp {
MiniDumpWriteDump :: proc( MiniDumpWriteDump :: proc(
hProcess: HANDLE, hProcess: HANDLE,
+1 -1
View File
@@ -3,7 +3,7 @@ package sys_windows
foreign import "system:Dnsapi.lib" foreign import "system:Dnsapi.lib"
@(default_calling_convention="std") @(default_calling_convention="system")
foreign Dnsapi { foreign Dnsapi {
DnsQuery_UTF8 :: proc(name: cstring, type: u16, options: DWORD, extra: PVOID, results: ^^DNS_RECORD, reserved: PVOID) -> DNS_STATUS --- DnsQuery_UTF8 :: proc(name: cstring, type: u16, options: DWORD, extra: PVOID, results: ^^DNS_RECORD, reserved: PVOID) -> DNS_STATUS ---
DnsRecordListFree :: proc(list: ^DNS_RECORD, options: DWORD) --- DnsRecordListFree :: proc(list: ^DNS_RECORD, options: DWORD) ---
+1 -1
View File
@@ -38,7 +38,7 @@ DWMNCRENDERINGPOLICY :: enum {
DWMNCRP_LAST, DWMNCRP_LAST,
} }
@(default_calling_convention="stdcall") @(default_calling_convention="system")
foreign dwmapi { foreign dwmapi {
DwmFlush :: proc() -> HRESULT --- DwmFlush :: proc() -> HRESULT ---
DwmIsCompositionEnabled :: proc(pfEnabled: ^BOOL) -> HRESULT --- DwmIsCompositionEnabled :: proc(pfEnabled: ^BOOL) -> HRESULT ---
+1 -1
View File
@@ -3,7 +3,7 @@ package sys_windows
foreign import gdi32 "system:Gdi32.lib" foreign import gdi32 "system:Gdi32.lib"
@(default_calling_convention="stdcall") @(default_calling_convention="system")
foreign gdi32 { foreign gdi32 {
GetStockObject :: proc(i: c_int) -> HGDIOBJ --- GetStockObject :: proc(i: c_int) -> HGDIOBJ ---
SelectObject :: proc(hdc: HDC, h: HGDIOBJ) -> HGDIOBJ --- SelectObject :: proc(hdc: HDC, h: HGDIOBJ) -> HGDIOBJ ---
+134
View File
@@ -0,0 +1,134 @@
// +build windows
package sys_windows
import "core:c"
USAGE :: distinct USHORT
PUSAGE :: ^USAGE
HIDP_CAPS :: struct {
Usage: USAGE,
UsagePage: USAGE,
InputReportByteLength: USHORT,
OutputReportByteLength: USHORT,
FeatureReportByteLength: USHORT,
Reserved: [17]USHORT,
NumberLinkCollectionNodes: USHORT,
NumberInputButtonCaps: USHORT,
NumberInputValueCaps: USHORT,
NumberInputDataIndices: USHORT,
NumberOutputButtonCaps: USHORT,
NumberOutputValueCaps: USHORT,
NumberOutputDataIndices: USHORT,
NumberFeatureButtonCaps: USHORT,
NumberFeatureValueCaps: USHORT,
NumberFeatureDataIndices: USHORT,
}
PHIDP_CAPS :: ^HIDP_CAPS
HIDP_BUTTON_CAPS :: struct {
UsagePage: USAGE,
ReportID: UCHAR,
IsAlias: BOOLEAN,
BitField: USHORT,
LinkCollection: USHORT,
LinkUsage: USAGE,
LinkUsagePage: USAGE,
IsRange: BOOLEAN,
IsStringRange: BOOLEAN,
IsDesignatorRange: BOOLEAN,
IsAbsolute: BOOLEAN,
ReportCount: USHORT,
Reserved2: USHORT,
Reserved: [9]ULONG,
using _: struct #raw_union {
Range: struct {
UsageMin: USAGE,
UsageMax: USAGE,
StringMin: USHORT,
StringMax: USHORT,
DesignatorMin: USHORT,
DesignatorMax: USHORT,
DataIndexMin: USHORT,
DataIndexMax: USHORT,
},
NotRange: struct {
Usage: USAGE,
Reserved1: USAGE,
StringIndex: USHORT,
Reserved2: USHORT,
DesignatorIndex: USHORT,
Reserved3: USHORT,
DataIndex: USHORT,
Reserved4: USHORT,
},
},
}
PHIDP_BUTTON_CAPS :: ^HIDP_BUTTON_CAPS
HIDP_VALUE_CAPS :: struct {
UsagePage: USAGE,
ReportID: UCHAR,
IsAlias: BOOLEAN,
BitField: USHORT,
LinkCollection: USHORT,
LinkUsage: USAGE,
LinkUsagePage: USAGE,
IsRange: BOOLEAN,
IsStringRange: BOOLEAN,
IsDesignatorRange: BOOLEAN,
IsAbsolute: BOOLEAN,
HasNull: BOOLEAN,
Reserved: UCHAR,
BitSize: USHORT,
ReportCount: USHORT,
Reserved2: [5]USHORT,
UnitsExp: ULONG,
Units: ULONG,
LogicalMin: LONG,
LogicalMax: LONG,
PhysicalMin: LONG,
PhysicalMax: LONG,
using _: struct #raw_union {
Range: struct {
UsageMin: USAGE,
UsageMax: USAGE,
StringMin: USHORT,
StringMax: USHORT,
DesignatorMin: USHORT,
DesignatorMax: USHORT,
DataIndexMin: USHORT,
DataIndexMax: USHORT,
},
NotRange: struct {
Usage: USAGE,
Reserved1: USAGE,
StringIndex: USHORT,
Reserved2: USHORT,
DesignatorIndex: USHORT,
Reserved3: USHORT,
DataIndex: USHORT,
Reserved4: USHORT,
},
},
}
PHIDP_VALUE_CAPS :: ^HIDP_VALUE_CAPS
PHIDP_PREPARSED_DATA :: rawptr
HIDP_REPORT_TYPE :: enum c.int {
Input,
Output,
Feature,
}
HIDP_STATUS_SUCCESS : NTSTATUS : 0x110000
foreign import hid "system:hid.lib"
@(default_calling_convention="system")
foreign hid {
HidP_GetCaps :: proc(PreparsedData: PHIDP_PREPARSED_DATA, Capabilities: PHIDP_CAPS) -> NTSTATUS ---
HidP_GetButtonCaps :: proc(ReportType: HIDP_REPORT_TYPE, ButtonCaps: PHIDP_BUTTON_CAPS, ButtonCapsLength: PUSHORT, PreparsedData: PHIDP_PREPARSED_DATA) -> NTSTATUS ---
HidP_GetValueCaps :: proc(ReportType: HIDP_REPORT_TYPE, ValueCaps: PHIDP_VALUE_CAPS, ValueCapsLength: PUSHORT, PreparsedData: PHIDP_PREPARSED_DATA) -> NTSTATUS ---
HidP_GetUsages :: proc(ReportType: HIDP_REPORT_TYPE, UsagePage: USAGE, LinkCollection: USHORT, UsageList: PUSAGE, UsageLength: PULONG, PreparsedData: PHIDP_PREPARSED_DATA, Report: PCHAR, ReportLength: ULONG) -> NTSTATUS ---
HidP_GetUsageValue :: proc(ReportType: HIDP_REPORT_TYPE, UsagePage: USAGE, LinkCollection: USHORT, Usage: USAGE, UsageValue: PULONG, PreparsedData: PHIDP_PREPARSED_DATA, Report: PCHAR, ReportLength: ULONG) -> NTSTATUS ---
}
+1 -1
View File
@@ -217,7 +217,7 @@ NL_DAD_STATE :: enum i32 {
IpDadStatePreferred = 4, IpDadStatePreferred = 4,
} }
@(default_calling_convention = "std") @(default_calling_convention = "system")
foreign iphlpapi { foreign iphlpapi {
/* /*
The GetAdaptersAddresses function retrieves the addresses associated with the adapters on the local computer. The GetAdaptersAddresses function retrieves the addresses associated with the adapters on the local computer.
+20 -20
View File
@@ -21,7 +21,7 @@ COMMON_LVB_REVERSE_VIDEO :: WORD(0x4000)
COMMON_LVB_UNDERSCORE :: WORD(0x8000) COMMON_LVB_UNDERSCORE :: WORD(0x8000)
COMMON_LVB_SBCSDBCS :: WORD(0x0300) COMMON_LVB_SBCSDBCS :: WORD(0x0300)
@(default_calling_convention="stdcall") @(default_calling_convention="system")
foreign kernel32 { foreign kernel32 {
OutputDebugStringA :: proc(lpOutputString: LPCSTR) --- // The only A thing that is allowed OutputDebugStringA :: proc(lpOutputString: LPCSTR) --- // The only A thing that is allowed
OutputDebugStringW :: proc(lpOutputString: LPCWSTR) --- OutputDebugStringW :: proc(lpOutputString: LPCWSTR) ---
@@ -112,7 +112,7 @@ foreign kernel32 {
CreateThread :: proc( CreateThread :: proc(
lpThreadAttributes: LPSECURITY_ATTRIBUTES, lpThreadAttributes: LPSECURITY_ATTRIBUTES,
dwStackSize: SIZE_T, dwStackSize: SIZE_T,
lpStartAddress: proc "stdcall" (rawptr) -> DWORD, lpStartAddress: proc "system" (rawptr) -> DWORD,
lpParameter: LPVOID, lpParameter: LPVOID,
dwCreationFlags: DWORD, dwCreationFlags: DWORD,
lpThreadId: LPDWORD, lpThreadId: LPDWORD,
@@ -121,7 +121,7 @@ foreign kernel32 {
hProcess: HANDLE, hProcess: HANDLE,
lpThreadAttributes: LPSECURITY_ATTRIBUTES, lpThreadAttributes: LPSECURITY_ATTRIBUTES,
dwStackSize: SIZE_T, dwStackSize: SIZE_T,
lpStartAddress: proc "stdcall" (rawptr) -> DWORD, lpStartAddress: proc "system" (rawptr) -> DWORD,
lpParameter: LPVOID, lpParameter: LPVOID,
dwCreationFlags: DWORD, dwCreationFlags: DWORD,
lpThreadId: LPDWORD, lpThreadId: LPDWORD,
@@ -581,7 +581,7 @@ MEM_TOP_DOWN :: 0x100000
MEM_LARGE_PAGES :: 0x20000000 MEM_LARGE_PAGES :: 0x20000000
MEM_4MB_PAGES :: 0x80000000 MEM_4MB_PAGES :: 0x80000000
@(default_calling_convention="stdcall") @(default_calling_convention="system")
foreign kernel32 { foreign kernel32 {
VirtualAlloc :: proc( VirtualAlloc :: proc(
lpAddress: LPVOID, lpAddress: LPVOID,
@@ -724,7 +724,7 @@ LowMemoryResourceNotification :: MEMORY_RESOURCE_NOTIFICATION_TYPE.LowMemoryRes
HighMemoryResourceNotification :: MEMORY_RESOURCE_NOTIFICATION_TYPE.HighMemoryResourceNotification HighMemoryResourceNotification :: MEMORY_RESOURCE_NOTIFICATION_TYPE.HighMemoryResourceNotification
@(default_calling_convention="stdcall") @(default_calling_convention="system")
foreign kernel32 { foreign kernel32 {
CreateMemoryResourceNotification :: proc( CreateMemoryResourceNotification :: proc(
NotificationType: MEMORY_RESOURCE_NOTIFICATION_TYPE, NotificationType: MEMORY_RESOURCE_NOTIFICATION_TYPE,
@@ -740,7 +740,7 @@ FILE_CACHE_MAX_HARD_DISABLE :: DWORD(0x00000002)
FILE_CACHE_MIN_HARD_ENABLE :: DWORD(0x00000004) FILE_CACHE_MIN_HARD_ENABLE :: DWORD(0x00000004)
FILE_CACHE_MIN_HARD_DISABLE :: DWORD(0x00000008) FILE_CACHE_MIN_HARD_DISABLE :: DWORD(0x00000008)
@(default_calling_convention="stdcall") @(default_calling_convention="system")
foreign kernel32 { foreign kernel32 {
GetSystemFileCacheSize :: proc( GetSystemFileCacheSize :: proc(
lpMinimumFileCacheSize: PSIZE_T, lpMinimumFileCacheSize: PSIZE_T,
@@ -770,7 +770,7 @@ WIN32_MEMORY_RANGE_ENTRY :: struct {
PWIN32_MEMORY_RANGE_ENTRY :: ^WIN32_MEMORY_RANGE_ENTRY PWIN32_MEMORY_RANGE_ENTRY :: ^WIN32_MEMORY_RANGE_ENTRY
@(default_calling_convention="stdcall") @(default_calling_convention="system")
foreign kernel32 { foreign kernel32 {
PrefetchVirtualMemory :: proc( PrefetchVirtualMemory :: proc(
hProcess: HANDLE, hProcess: HANDLE,
@@ -828,23 +828,23 @@ foreign kernel32 {
MEHC_PATROL_SCRUBBER_PRESENT :: ULONG(0x1) MEHC_PATROL_SCRUBBER_PRESENT :: ULONG(0x1)
@(default_calling_convention="stdcall") @(default_calling_convention="system")
foreign kernel32 { foreign kernel32 {
GetMemoryErrorHandlingCapabilities :: proc( GetMemoryErrorHandlingCapabilities :: proc(
Capabilities: PULONG, Capabilities: PULONG,
) -> BOOL --- ) -> BOOL ---
} }
@(default_calling_convention="stdcall") @(default_calling_convention="system")
foreign kernel32 { foreign kernel32 {
GlobalMemoryStatusEx :: proc( GlobalMemoryStatusEx :: proc(
lpBuffer: ^MEMORYSTATUSEX, lpBuffer: ^MEMORYSTATUSEX,
) -> BOOL --- ) -> BOOL ---
} }
PBAD_MEMORY_CALLBACK_ROUTINE :: #type proc "stdcall" () PBAD_MEMORY_CALLBACK_ROUTINE :: #type proc "system" ()
@(default_calling_convention="stdcall") @(default_calling_convention="system")
foreign kernel32 { foreign kernel32 {
RegisterBadMemoryNotification :: proc( RegisterBadMemoryNotification :: proc(
Callback: PBAD_MEMORY_CALLBACK_ROUTINE, Callback: PBAD_MEMORY_CALLBACK_ROUTINE,
@@ -865,7 +865,7 @@ VmOfferPriorityLow :: OFFER_PRIORITY.VmOfferPriorityLow
VmOfferPriorityBelowNormal :: OFFER_PRIORITY.VmOfferPriorityBelowNormal VmOfferPriorityBelowNormal :: OFFER_PRIORITY.VmOfferPriorityBelowNormal
VmOfferPriorityNormal :: OFFER_PRIORITY.VmOfferPriorityNormal VmOfferPriorityNormal :: OFFER_PRIORITY.VmOfferPriorityNormal
@(default_calling_convention="stdcall") @(default_calling_convention="system")
foreign kernel32 { foreign kernel32 {
OfferVirtualMemory :: proc( OfferVirtualMemory :: proc(
VirtualAddress: PVOID, VirtualAddress: PVOID,
@@ -930,7 +930,7 @@ WIN32_MEMORY_REGION_INFORMATION_u_s_Bitfield :: distinct ULONG
Reserved : 32-6, Reserved : 32-6,
}*/ }*/
@(default_calling_convention="stdcall") @(default_calling_convention="system")
foreign one_core { foreign one_core {
QueryVirtualMemoryInformation :: proc( QueryVirtualMemoryInformation :: proc(
Process: HANDLE, Process: HANDLE,
@@ -955,7 +955,7 @@ foreign one_core {
NUMA_NO_PREFERRED_NODE :: 0xffffffff NUMA_NO_PREFERRED_NODE :: 0xffffffff
MapViewOfFile2 :: #force_inline proc "stdcall" ( MapViewOfFile2 :: #force_inline proc "system" (
FileMappingHandle: HANDLE, FileMappingHandle: HANDLE,
ProcessHandle: HANDLE, ProcessHandle: HANDLE,
Offset: ULONG64, Offset: ULONG64,
@@ -976,7 +976,7 @@ MapViewOfFile2 :: #force_inline proc "stdcall" (
) )
} }
@(default_calling_convention="stdcall") @(default_calling_convention="system")
foreign kernel32 { foreign kernel32 {
UnmapViewOfFile2 :: proc( UnmapViewOfFile2 :: proc(
ProcessHandle: HANDLE, ProcessHandle: HANDLE,
@@ -985,7 +985,7 @@ foreign kernel32 {
) -> BOOL --- ) -> BOOL ---
} }
@(default_calling_convention="stdcall") @(default_calling_convention="system")
foreign kernel32 { foreign kernel32 {
GetProductInfo :: proc( GetProductInfo :: proc(
OSMajorVersion: DWORD, OSMajorVersion: DWORD,
@@ -996,7 +996,7 @@ foreign kernel32 {
) -> BOOL --- ) -> BOOL ---
} }
HandlerRoutine :: proc "stdcall" (dwCtrlType: DWORD) -> BOOL HandlerRoutine :: proc "system" (dwCtrlType: DWORD) -> BOOL
PHANDLER_ROUTINE :: HandlerRoutine PHANDLER_ROUTINE :: HandlerRoutine
@@ -1137,16 +1137,16 @@ DCB :: struct {
wReserved1: WORD, wReserved1: WORD,
} }
@(default_calling_convention="stdcall") @(default_calling_convention="system")
foreign kernel32 { foreign kernel32 {
GetCommState :: proc(handle: HANDLE, dcb: ^DCB) -> BOOL --- GetCommState :: proc(handle: HANDLE, dcb: ^DCB) -> BOOL ---
SetCommState :: proc(handle: HANDLE, dcb: ^DCB) -> BOOL --- SetCommState :: proc(handle: HANDLE, dcb: ^DCB) -> BOOL ---
} }
LPFIBER_START_ROUTINE :: #type proc "stdcall" (lpFiberParameter: LPVOID) LPFIBER_START_ROUTINE :: #type proc "system" (lpFiberParameter: LPVOID)
@(default_calling_convention = "stdcall") @(default_calling_convention = "system")
foreign kernel32 { foreign kernel32 {
CreateFiber :: proc(dwStackSize: SIZE_T, lpStartAddress: LPFIBER_START_ROUTINE, lpParameter: LPVOID) -> LPVOID --- CreateFiber :: proc(dwStackSize: SIZE_T, lpStartAddress: LPFIBER_START_ROUTINE, lpParameter: LPVOID) -> LPVOID ---
DeleteFiber :: proc(lpFiber: LPVOID) --- DeleteFiber :: proc(lpFiber: LPVOID) ---
+1 -1
View File
@@ -3,7 +3,7 @@ package sys_windows
foreign import netapi32 "system:Netapi32.lib" foreign import netapi32 "system:Netapi32.lib"
@(default_calling_convention="stdcall") @(default_calling_convention="system")
foreign netapi32 { foreign netapi32 {
NetUserAdd :: proc( NetUserAdd :: proc(
servername: wstring, servername: wstring,
+1 -1
View File
@@ -3,7 +3,7 @@ package sys_windows
foreign import ntdll_lib "system:ntdll.lib" foreign import ntdll_lib "system:ntdll.lib"
@(default_calling_convention="stdcall") @(default_calling_convention="system")
foreign ntdll_lib { foreign ntdll_lib {
RtlGetVersion :: proc(lpVersionInformation: ^OSVERSIONINFOEXW) -> NTSTATUS --- RtlGetVersion :: proc(lpVersionInformation: ^OSVERSIONINFOEXW) -> NTSTATUS ---
} }
+4 -5
View File
@@ -1,4 +1,3 @@
// +build windows
package sys_windows package sys_windows
foreign import "system:Ole32.lib" foreign import "system:Ole32.lib"
@@ -15,14 +14,14 @@ IUnknown :: struct {
using Vtbl: ^IUnknownVtbl, using Vtbl: ^IUnknownVtbl,
} }
IUnknownVtbl :: struct { IUnknownVtbl :: struct {
QueryInterface: proc "stdcall" (This: ^IUnknown, riid: REFIID, ppvObject: ^rawptr) -> HRESULT, QueryInterface: proc "system" (This: ^IUnknown, riid: REFIID, ppvObject: ^rawptr) -> HRESULT,
AddRef: proc "stdcall" (This: ^IUnknown) -> ULONG, AddRef: proc "system" (This: ^IUnknown) -> ULONG,
Release: proc "stdcall" (This: ^IUnknown) -> ULONG, Release: proc "system" (This: ^IUnknown) -> ULONG,
} }
LPUNKNOWN :: ^IUnknown LPUNKNOWN :: ^IUnknown
@(default_calling_convention="stdcall") @(default_calling_convention="system")
foreign Ole32 { foreign Ole32 {
CoInitializeEx :: proc(reserved: rawptr, co_init: COINIT) -> HRESULT --- CoInitializeEx :: proc(reserved: rawptr, co_init: COINIT) -> HRESULT ---
CoUninitialize :: proc() --- CoUninitialize :: proc() ---
+1 -1
View File
@@ -3,7 +3,7 @@ package sys_windows
foreign import shell32 "system:Shell32.lib" foreign import shell32 "system:Shell32.lib"
@(default_calling_convention="stdcall") @(default_calling_convention="system")
foreign shell32 { foreign shell32 {
CommandLineToArgvW :: proc(cmd_list: wstring, num_args: ^c_int) -> ^wstring --- CommandLineToArgvW :: proc(cmd_list: wstring, num_args: ^c_int) -> ^wstring ---
ShellExecuteW :: proc( ShellExecuteW :: proc(
+1 -1
View File
@@ -3,7 +3,7 @@ package sys_windows
foreign import shlwapi "system:shlwapi.lib" foreign import shlwapi "system:shlwapi.lib"
@(default_calling_convention="stdcall") @(default_calling_convention="system")
foreign shlwapi { foreign shlwapi {
PathFileExistsW :: proc(pszPath: wstring) -> BOOL --- PathFileExistsW :: proc(pszPath: wstring) -> BOOL ---
PathFindExtensionW :: proc(pszPath: wstring) -> wstring --- PathFindExtensionW :: proc(pszPath: wstring) -> wstring ---
+1 -1
View File
@@ -3,7 +3,7 @@ package sys_windows
foreign import Synchronization "system:Synchronization.lib" foreign import Synchronization "system:Synchronization.lib"
@(default_calling_convention="stdcall") @(default_calling_convention="system")
foreign Synchronization { foreign Synchronization {
WaitOnAddress :: proc(Address: PVOID, CompareAddress: PVOID, AddressSize: SIZE_T, dwMilliseconds: DWORD) -> BOOL --- WaitOnAddress :: proc(Address: PVOID, CompareAddress: PVOID, AddressSize: SIZE_T, dwMilliseconds: DWORD) -> BOOL ---
WakeByAddressSingle :: proc(Address: PVOID) --- WakeByAddressSingle :: proc(Address: PVOID) ---
+169 -167
View File
@@ -1,4 +1,3 @@
// +build windows
package sys_windows package sys_windows
import "core:c" import "core:c"
@@ -7,9 +6,9 @@ c_char :: c.char
c_uchar :: c.uchar c_uchar :: c.uchar
c_int :: c.int c_int :: c.int
c_uint :: c.uint c_uint :: c.uint
c_long :: c.long c_long :: i32
c_longlong :: c.longlong c_longlong :: c.longlong
c_ulong :: c.ulong c_ulong :: u32
c_ulonglong :: c.ulonglong c_ulonglong :: c.ulonglong
c_short :: c.short c_short :: c.short
c_ushort :: c.ushort c_ushort :: c.ushort
@@ -75,6 +74,8 @@ LPRECT :: ^RECT
LPPOINT :: ^POINT LPPOINT :: ^POINT
LSTATUS :: LONG LSTATUS :: LONG
PHKEY :: ^HKEY PHKEY :: ^HKEY
PUSHORT :: ^USHORT
PCHAR :: ^CHAR
UINT8 :: u8 UINT8 :: u8
UINT16 :: u16 UINT16 :: u16
@@ -690,13 +691,13 @@ FW_DEMIBOLD :: FW_SEMIBOLD
FW_ULTRABOLD :: FW_EXTRABOLD FW_ULTRABOLD :: FW_EXTRABOLD
FW_BLACK :: FW_HEAVY FW_BLACK :: FW_HEAVY
PTIMERAPCROUTINE :: #type proc "stdcall" (lpArgToCompletionRoutine: LPVOID, dwTimerLowValue, dwTimerHighValue: DWORD) PTIMERAPCROUTINE :: #type proc "system" (lpArgToCompletionRoutine: LPVOID, dwTimerLowValue, dwTimerHighValue: DWORD)
TIMERPROC :: #type proc "stdcall" (HWND, UINT, UINT_PTR, DWORD) TIMERPROC :: #type proc "system" (HWND, UINT, UINT_PTR, DWORD)
WNDPROC :: #type proc "stdcall" (HWND, UINT, WPARAM, LPARAM) -> LRESULT WNDPROC :: #type proc "system" (HWND, UINT, WPARAM, LPARAM) -> LRESULT
HOOKPROC :: #type proc "stdcall" (code: c_int, wParam: WPARAM, lParam: LPARAM) -> LRESULT HOOKPROC :: #type proc "system" (code: c_int, wParam: WPARAM, lParam: LPARAM) -> LRESULT
CWPRETSTRUCT :: struct { CWPRETSTRUCT :: struct {
lResult: LRESULT, lResult: LRESULT,
@@ -2323,7 +2324,7 @@ MOUNT_POINT_REPARSE_BUFFER :: struct {
PathBuffer: WCHAR, PathBuffer: WCHAR,
} }
LPPROGRESS_ROUTINE :: #type proc "stdcall" ( LPPROGRESS_ROUTINE :: #type proc "system" (
TotalFileSize: LARGE_INTEGER, TotalFileSize: LARGE_INTEGER,
TotalBytesTransferred: LARGE_INTEGER, TotalBytesTransferred: LARGE_INTEGER,
StreamSize: LARGE_INTEGER, StreamSize: LARGE_INTEGER,
@@ -2493,7 +2494,7 @@ OVERLAPPED_ENTRY :: struct {
dwNumberOfBytesTransferred: DWORD, dwNumberOfBytesTransferred: DWORD,
} }
LPOVERLAPPED_COMPLETION_ROUTINE :: #type proc "stdcall" ( LPOVERLAPPED_COMPLETION_ROUTINE :: #type proc "system" (
dwErrorCode: DWORD, dwErrorCode: DWORD,
dwNumberOfBytesTransfered: DWORD, dwNumberOfBytesTransfered: DWORD,
lpOverlapped: LPOVERLAPPED, lpOverlapped: LPOVERLAPPED,
@@ -2557,7 +2558,7 @@ EXCEPTION_POINTERS :: struct {
ContextRecord: ^CONTEXT, ContextRecord: ^CONTEXT,
} }
PVECTORED_EXCEPTION_HANDLER :: #type proc "stdcall" (ExceptionInfo: ^EXCEPTION_POINTERS) -> LONG PVECTORED_EXCEPTION_HANDLER :: #type proc "system" (ExceptionInfo: ^EXCEPTION_POINTERS) -> LONG
CONSOLE_READCONSOLE_CONTROL :: struct { CONSOLE_READCONSOLE_CONTROL :: struct {
nLength: ULONG, nLength: ULONG,
@@ -2612,7 +2613,7 @@ ADDRINFOEXW :: struct {
ai_next: ^ADDRINFOEXW, ai_next: ^ADDRINFOEXW,
} }
LPLOOKUPSERVICE_COMPLETION_ROUTINE :: #type proc "stdcall" ( LPLOOKUPSERVICE_COMPLETION_ROUTINE :: #type proc "system" (
dwErrorCode: DWORD, dwErrorCode: DWORD,
dwNumberOfBytesTransfered: DWORD, dwNumberOfBytesTransfered: DWORD,
lpOverlapped: LPOVERLAPPED, lpOverlapped: LPOVERLAPPED,
@@ -2718,16 +2719,17 @@ SECURITY_MAX_SID_SIZE :: 68
// https://docs.microsoft.com/en-us/windows/win32/api/winnt/ns-winnt-sid // https://docs.microsoft.com/en-us/windows/win32/api/winnt/ns-winnt-sid
SID :: struct #packed { SID :: struct #packed {
Revision: byte, Revision: byte,
SubAuthorityCount: byte, SubAuthorityCount: byte,
IdentifierAuthority: SID_IDENTIFIER_AUTHORITY, IdentifierAuthority: SID_IDENTIFIER_AUTHORITY,
SubAuthority: [15]DWORD, // Array of DWORDs SubAuthority: [15]DWORD, // Array of DWORDs
} }
#assert(size_of(SID) == SECURITY_MAX_SID_SIZE) #assert(size_of(SID) == SECURITY_MAX_SID_SIZE)
SID_IDENTIFIER_AUTHORITY :: struct #packed { SID_IDENTIFIER_AUTHORITY :: struct #packed {
Value: [6]u8, Value: [6]u8,
} }
#assert(size_of(SID_IDENTIFIER_AUTHORITY) == 6)
// For NetAPI32 // For NetAPI32
// https://github.com/tpn/winsdk-10/blob/master/Include/10.0.14393.0/shared/lmerr.h // https://github.com/tpn/winsdk-10/blob/master/Include/10.0.14393.0/shared/lmerr.h
@@ -3425,7 +3427,7 @@ IModalWindow :: struct #raw_union {
} }
IModalWindowVtbl :: struct { IModalWindowVtbl :: struct {
using IUnknownVtbl: IUnknownVtbl, using IUnknownVtbl: IUnknownVtbl,
Show: proc "stdcall" (this: ^IModalWindow, hwndOwner: HWND) -> HRESULT, Show: proc "system" (this: ^IModalWindow, hwndOwner: HWND) -> HRESULT,
} }
ISequentialStream :: struct #raw_union { ISequentialStream :: struct #raw_union {
@@ -3434,8 +3436,8 @@ ISequentialStream :: struct #raw_union {
} }
ISequentialStreamVtbl :: struct { ISequentialStreamVtbl :: struct {
using IUnknownVtbl: IUnknownVtbl, using IUnknownVtbl: IUnknownVtbl,
Read: proc "stdcall" (this: ^ISequentialStream, pv: rawptr, cb: ULONG, pcbRead: ^ULONG) -> HRESULT, Read: proc "system" (this: ^ISequentialStream, pv: rawptr, cb: ULONG, pcbRead: ^ULONG) -> HRESULT,
Write: proc "stdcall" (this: ^ISequentialStream, pv: rawptr, cb: ULONG, pcbWritten: ^ULONG) -> HRESULT, Write: proc "system" (this: ^ISequentialStream, pv: rawptr, cb: ULONG, pcbWritten: ^ULONG) -> HRESULT,
} }
IStream :: struct #raw_union { IStream :: struct #raw_union {
@@ -3444,15 +3446,15 @@ IStream :: struct #raw_union {
} }
IStreamVtbl :: struct { IStreamVtbl :: struct {
using ISequentialStreamVtbl: ISequentialStreamVtbl, using ISequentialStreamVtbl: ISequentialStreamVtbl,
Seek: proc "stdcall" (this: ^IStream, dlibMove: LARGE_INTEGER, dwOrigin: DWORD, plibNewPosition: ^ULARGE_INTEGER) -> HRESULT, Seek: proc "system" (this: ^IStream, dlibMove: LARGE_INTEGER, dwOrigin: DWORD, plibNewPosition: ^ULARGE_INTEGER) -> HRESULT,
SetSize: proc "stdcall" (this: ^IStream, libNewSize: ULARGE_INTEGER) -> HRESULT, SetSize: proc "system" (this: ^IStream, libNewSize: ULARGE_INTEGER) -> HRESULT,
CopyTo: proc "stdcall" (this: ^IStream, pstm: ^IStream, cb: ULARGE_INTEGER, pcbRead: ^ULARGE_INTEGER, pcbWritten: ^ULARGE_INTEGER) -> HRESULT, CopyTo: proc "system" (this: ^IStream, pstm: ^IStream, cb: ULARGE_INTEGER, pcbRead: ^ULARGE_INTEGER, pcbWritten: ^ULARGE_INTEGER) -> HRESULT,
Commit: proc "stdcall" (this: ^IStream, grfCommitFlags: DWORD) -> HRESULT, Commit: proc "system" (this: ^IStream, grfCommitFlags: DWORD) -> HRESULT,
Revert: proc "stdcall" (this: ^IStream) -> HRESULT, Revert: proc "system" (this: ^IStream) -> HRESULT,
LockRegion: proc "stdcall" (this: ^IStream, libOffset: ULARGE_INTEGER, cb: ULARGE_INTEGER, dwLockType: DWORD) -> HRESULT, LockRegion: proc "system" (this: ^IStream, libOffset: ULARGE_INTEGER, cb: ULARGE_INTEGER, dwLockType: DWORD) -> HRESULT,
UnlockRegion: proc "stdcall" (this: ^IStream, libOffset: ULARGE_INTEGER, cb: ULARGE_INTEGER, dwLockType: DWORD) -> HRESULT, UnlockRegion: proc "system" (this: ^IStream, libOffset: ULARGE_INTEGER, cb: ULARGE_INTEGER, dwLockType: DWORD) -> HRESULT,
Stat: proc "stdcall" (this: ^IStream, pstatstg: ^STATSTG, grfStatFlag: DWORD) -> HRESULT, Stat: proc "system" (this: ^IStream, pstatstg: ^STATSTG, grfStatFlag: DWORD) -> HRESULT,
Clone: proc "stdcall" (this: ^IStream, ppstm: ^^IStream) -> HRESULT, Clone: proc "system" (this: ^IStream, ppstm: ^^IStream) -> HRESULT,
} }
IPersist :: struct #raw_union { IPersist :: struct #raw_union {
@@ -3461,7 +3463,7 @@ IPersist :: struct #raw_union {
} }
IPersistVtbl :: struct { IPersistVtbl :: struct {
using IUnknownVtbl: IUnknownVtbl, using IUnknownVtbl: IUnknownVtbl,
GetClassID: proc "stdcall" (this: ^IPersist, pClassID: ^CLSID) -> HRESULT, GetClassID: proc "system" (this: ^IPersist, pClassID: ^CLSID) -> HRESULT,
} }
IPersistStream :: struct #raw_union { IPersistStream :: struct #raw_union {
@@ -3470,10 +3472,10 @@ IPersistStream :: struct #raw_union {
} }
IPersistStreamVtbl :: struct { IPersistStreamVtbl :: struct {
using IPersistVtbl: IPersistVtbl, using IPersistVtbl: IPersistVtbl,
IsDirty: proc "stdcall" (this: ^IPersistStream) -> HRESULT, IsDirty: proc "system" (this: ^IPersistStream) -> HRESULT,
Load: proc "stdcall" (this: ^IPersistStream, pStm: ^IStream) -> HRESULT, Load: proc "system" (this: ^IPersistStream, pStm: ^IStream) -> HRESULT,
Save: proc "stdcall" (this: ^IPersistStream, pStm: ^IStream, fClearDirty: BOOL) -> HRESULT, Save: proc "system" (this: ^IPersistStream, pStm: ^IStream, fClearDirty: BOOL) -> HRESULT,
GetSizeMax: proc "stdcall" (this: ^IPersistStream, pcbSize: ^ULARGE_INTEGER) -> HRESULT, GetSizeMax: proc "system" (this: ^IPersistStream, pcbSize: ^ULARGE_INTEGER) -> HRESULT,
} }
IMoniker :: struct #raw_union { IMoniker :: struct #raw_union {
@@ -3482,21 +3484,21 @@ IMoniker :: struct #raw_union {
} }
IMonikerVtbl :: struct { IMonikerVtbl :: struct {
using IPersistStreamVtbl: IPersistStreamVtbl, using IPersistStreamVtbl: IPersistStreamVtbl,
BindToObject: proc "stdcall" (this: ^IMoniker, pbc: ^IBindCtx, pmkToLeft: ^IMoniker, riidResult: REFIID, ppvResult: ^rawptr) -> HRESULT, BindToObject: proc "system" (this: ^IMoniker, pbc: ^IBindCtx, pmkToLeft: ^IMoniker, riidResult: REFIID, ppvResult: ^rawptr) -> HRESULT,
BindToStorage: proc "stdcall" (this: ^IMoniker, pbc: ^IBindCtx, pmkToLeft: ^IMoniker, riid: REFIID, ppvObj: ^rawptr) -> HRESULT, BindToStorage: proc "system" (this: ^IMoniker, pbc: ^IBindCtx, pmkToLeft: ^IMoniker, riid: REFIID, ppvObj: ^rawptr) -> HRESULT,
Reduce: proc "stdcall" (this: ^IMoniker, pbc: ^IBindCtx, dwReduceHowFar: DWORD, ppmkToLeft: ^^IMoniker, ppmkReduced: ^^IMoniker) -> HRESULT, Reduce: proc "system" (this: ^IMoniker, pbc: ^IBindCtx, dwReduceHowFar: DWORD, ppmkToLeft: ^^IMoniker, ppmkReduced: ^^IMoniker) -> HRESULT,
ComposeWith: proc "stdcall" (this: ^IMoniker, pmkRight: ^IMoniker, fOnlyIfNotGeneric: BOOL, ppmkComposite: ^^IMoniker) -> HRESULT, ComposeWith: proc "system" (this: ^IMoniker, pmkRight: ^IMoniker, fOnlyIfNotGeneric: BOOL, ppmkComposite: ^^IMoniker) -> HRESULT,
Enum: proc "stdcall" (this: ^IMoniker, fForward: BOOL, ppenumMoniker: ^^IEnumMoniker) -> HRESULT, Enum: proc "system" (this: ^IMoniker, fForward: BOOL, ppenumMoniker: ^^IEnumMoniker) -> HRESULT,
IsEqual: proc "stdcall" (this: ^IMoniker, pmkOtherMoniker: ^IMoniker) -> HRESULT, IsEqual: proc "system" (this: ^IMoniker, pmkOtherMoniker: ^IMoniker) -> HRESULT,
Hash: proc "stdcall" (this: ^IMoniker, pdwHash: ^DWORD) -> HRESULT, Hash: proc "system" (this: ^IMoniker, pdwHash: ^DWORD) -> HRESULT,
IsRunning: proc "stdcall" (this: ^IMoniker, pbc: ^IBindCtx, pmkToLeft: ^IMoniker, pmkNewlyRunning: ^IMoniker) -> HRESULT, IsRunning: proc "system" (this: ^IMoniker, pbc: ^IBindCtx, pmkToLeft: ^IMoniker, pmkNewlyRunning: ^IMoniker) -> HRESULT,
GetTimeOfLastChange: proc "stdcall" (this: ^IMoniker, pbc: ^IBindCtx, pmkToLeft: ^IMoniker, pFileTime: ^FILETIME) -> HRESULT, GetTimeOfLastChange: proc "system" (this: ^IMoniker, pbc: ^IBindCtx, pmkToLeft: ^IMoniker, pFileTime: ^FILETIME) -> HRESULT,
Inverse: proc "stdcall" (this: ^IMoniker, ppmk: ^^IMoniker) -> HRESULT, Inverse: proc "system" (this: ^IMoniker, ppmk: ^^IMoniker) -> HRESULT,
CommonPrefixWith: proc "stdcall" (this: ^IMoniker, pmkOther: ^IMoniker, ppmkPrefix: ^^IMoniker) -> HRESULT, CommonPrefixWith: proc "system" (this: ^IMoniker, pmkOther: ^IMoniker, ppmkPrefix: ^^IMoniker) -> HRESULT,
RelativePathTo: proc "stdcall" (this: ^IMoniker, pmkOther: ^IMoniker, ppmkRelPath: ^^IMoniker) -> HRESULT, RelativePathTo: proc "system" (this: ^IMoniker, pmkOther: ^IMoniker, ppmkRelPath: ^^IMoniker) -> HRESULT,
GetDisplayName: proc "stdcall" (this: ^IMoniker, pbc: ^IBindCtx, pmkToLeft: ^IMoniker, ppszDisplayName: ^LPOLESTR) -> HRESULT, GetDisplayName: proc "system" (this: ^IMoniker, pbc: ^IBindCtx, pmkToLeft: ^IMoniker, ppszDisplayName: ^LPOLESTR) -> HRESULT,
ParseDisplayName: proc "stdcall" (this: ^IMoniker, pbc: ^IBindCtx, pmkToLeft: ^IMoniker, pszDisplayName: LPOLESTR, pchEaten: ^ULONG, ppmkOut: ^^IMoniker) -> HRESULT, ParseDisplayName: proc "system" (this: ^IMoniker, pbc: ^IBindCtx, pmkToLeft: ^IMoniker, pszDisplayName: LPOLESTR, pchEaten: ^ULONG, ppmkOut: ^^IMoniker) -> HRESULT,
IsSystemMoniker: proc "stdcall" (this: ^IMoniker, pdwMksys: ^DWORD) -> HRESULT, IsSystemMoniker: proc "system" (this: ^IMoniker, pdwMksys: ^DWORD) -> HRESULT,
} }
IEnumMoniker :: struct #raw_union { IEnumMoniker :: struct #raw_union {
@@ -3505,10 +3507,10 @@ IEnumMoniker :: struct #raw_union {
} }
IEnumMonikerVtbl :: struct { IEnumMonikerVtbl :: struct {
using IUnknownVtbl: IUnknownVtbl, using IUnknownVtbl: IUnknownVtbl,
Next: proc "stdcall" (this: ^IEnumMoniker, celt: ULONG, rgelt: ^^IMoniker, pceltFetched: ^ULONG) -> HRESULT, Next: proc "system" (this: ^IEnumMoniker, celt: ULONG, rgelt: ^^IMoniker, pceltFetched: ^ULONG) -> HRESULT,
Skip: proc "stdcall" (this: ^IEnumMoniker, celt: ULONG) -> HRESULT, Skip: proc "system" (this: ^IEnumMoniker, celt: ULONG) -> HRESULT,
Reset: proc "stdcall" (this: ^IEnumMoniker) -> HRESULT, Reset: proc "system" (this: ^IEnumMoniker) -> HRESULT,
Clone: proc "stdcall" (this: ^IEnumMoniker, ppenum: ^^IEnumMoniker) -> HRESULT, Clone: proc "system" (this: ^IEnumMoniker, ppenum: ^^IEnumMoniker) -> HRESULT,
} }
IRunningObjectTable :: struct #raw_union { IRunningObjectTable :: struct #raw_union {
@@ -3517,13 +3519,13 @@ IRunningObjectTable :: struct #raw_union {
} }
IRunningObjectTableVtbl :: struct { IRunningObjectTableVtbl :: struct {
using IUnknownVtbl: IUnknownVtbl, using IUnknownVtbl: IUnknownVtbl,
Register: proc "stdcall" (this: ^IRunningObjectTable, grfFlags: DWORD, punkObject: ^IUnknown, pmkObjectName: ^IMoniker, pdwRegister: ^DWORD) -> HRESULT, Register: proc "system" (this: ^IRunningObjectTable, grfFlags: DWORD, punkObject: ^IUnknown, pmkObjectName: ^IMoniker, pdwRegister: ^DWORD) -> HRESULT,
Revoke: proc "stdcall" (this: ^IRunningObjectTable, dwRegister: DWORD) -> HRESULT, Revoke: proc "system" (this: ^IRunningObjectTable, dwRegister: DWORD) -> HRESULT,
IsRunning: proc "stdcall" (this: ^IRunningObjectTable, pmkObjectName: ^IMoniker) -> HRESULT, IsRunning: proc "system" (this: ^IRunningObjectTable, pmkObjectName: ^IMoniker) -> HRESULT,
GetObject: proc "stdcall" (this: ^IRunningObjectTable, pmkObjectName: ^IMoniker, ppunkObject: ^^IUnknown) -> HRESULT, GetObject: proc "system" (this: ^IRunningObjectTable, pmkObjectName: ^IMoniker, ppunkObject: ^^IUnknown) -> HRESULT,
NoteChangeTime: proc "stdcall" (this: ^IRunningObjectTable, dwRegister: DWORD, pfiletime: ^FILETIME) -> HRESULT, NoteChangeTime: proc "system" (this: ^IRunningObjectTable, dwRegister: DWORD, pfiletime: ^FILETIME) -> HRESULT,
GetTimeOfLastChange: proc "stdcall" (this: ^IRunningObjectTable, pmkObjectName: ^IMoniker, pfiletime: ^FILETIME) -> HRESULT, GetTimeOfLastChange: proc "system" (this: ^IRunningObjectTable, pmkObjectName: ^IMoniker, pfiletime: ^FILETIME) -> HRESULT,
EnumRunning: proc "stdcall" (this: ^IRunningObjectTable, ppenumMoniker: ^^IEnumMoniker) -> HRESULT, EnumRunning: proc "system" (this: ^IRunningObjectTable, ppenumMoniker: ^^IEnumMoniker) -> HRESULT,
} }
IEnumString :: struct #raw_union { IEnumString :: struct #raw_union {
@@ -3532,10 +3534,10 @@ IEnumString :: struct #raw_union {
} }
IEnumStringVtbl :: struct { IEnumStringVtbl :: struct {
using IUnknownVtbl: IUnknownVtbl, using IUnknownVtbl: IUnknownVtbl,
Next: proc "stdcall" (this: ^IEnumString, celt: ULONG, rgelt: ^LPOLESTR, pceltFetched: ^ULONG) -> HRESULT, Next: proc "system" (this: ^IEnumString, celt: ULONG, rgelt: ^LPOLESTR, pceltFetched: ^ULONG) -> HRESULT,
Skip: proc "stdcall" (this: ^IEnumString, celt: ULONG) -> HRESULT, Skip: proc "system" (this: ^IEnumString, celt: ULONG) -> HRESULT,
Reset: proc "stdcall" (this: ^IEnumString) -> HRESULT, Reset: proc "system" (this: ^IEnumString) -> HRESULT,
Clone: proc "stdcall" (this: ^IEnumString, ppenum: ^^IEnumString) -> HRESULT, Clone: proc "system" (this: ^IEnumString, ppenum: ^^IEnumString) -> HRESULT,
} }
IBindCtx :: struct #raw_union { IBindCtx :: struct #raw_union {
@@ -3544,16 +3546,16 @@ IBindCtx :: struct #raw_union {
} }
IBindCtxVtbl :: struct { IBindCtxVtbl :: struct {
using IUnknownVtbl: IUnknownVtbl, using IUnknownVtbl: IUnknownVtbl,
RegisterObjectBound: proc "stdcall" (this: ^IBindCtx, punk: ^IUnknown) -> HRESULT, RegisterObjectBound: proc "system" (this: ^IBindCtx, punk: ^IUnknown) -> HRESULT,
RevokeObjectBound: proc "stdcall" (this: ^IBindCtx, punk: ^IUnknown) -> HRESULT, RevokeObjectBound: proc "system" (this: ^IBindCtx, punk: ^IUnknown) -> HRESULT,
ReleaseBoundObjects: proc "stdcall" (this: ^IBindCtx) -> HRESULT, ReleaseBoundObjects: proc "system" (this: ^IBindCtx) -> HRESULT,
SetBindOptions: proc "stdcall" (this: ^IBindCtx, pbindopts: ^BIND_OPTS) -> HRESULT, SetBindOptions: proc "system" (this: ^IBindCtx, pbindopts: ^BIND_OPTS) -> HRESULT,
GetBindOptions: proc "stdcall" (this: ^IBindCtx, pbindopts: ^BIND_OPTS) -> HRESULT, GetBindOptions: proc "system" (this: ^IBindCtx, pbindopts: ^BIND_OPTS) -> HRESULT,
GetRunningObjectTable: proc "stdcall" (this: ^IBindCtx, pprot: ^^IRunningObjectTable) -> HRESULT, GetRunningObjectTable: proc "system" (this: ^IBindCtx, pprot: ^^IRunningObjectTable) -> HRESULT,
RegisterObjectParam: proc "stdcall" (this: ^IBindCtx, pszKey: LPOLESTR, punk: ^IUnknown) -> HRESULT, RegisterObjectParam: proc "system" (this: ^IBindCtx, pszKey: LPOLESTR, punk: ^IUnknown) -> HRESULT,
GetObjectParam: proc "stdcall" (this: ^IBindCtx, pszKey: LPOLESTR, ppunk: ^^IUnknown) -> HRESULT, GetObjectParam: proc "system" (this: ^IBindCtx, pszKey: LPOLESTR, ppunk: ^^IUnknown) -> HRESULT,
EnumObjectParam: proc "stdcall" (this: ^IBindCtx, ppenum: ^^IEnumString) -> HRESULT, EnumObjectParam: proc "system" (this: ^IBindCtx, ppenum: ^^IEnumString) -> HRESULT,
RevokeObjectParam: proc "stdcall" (this: ^IBindCtx, pszKey: LPOLESTR) -> HRESULT, RevokeObjectParam: proc "system" (this: ^IBindCtx, pszKey: LPOLESTR) -> HRESULT,
} }
IEnumShellItems :: struct #raw_union { IEnumShellItems :: struct #raw_union {
@@ -3562,10 +3564,10 @@ IEnumShellItems :: struct #raw_union {
} }
IEnumShellItemsVtbl :: struct { IEnumShellItemsVtbl :: struct {
using IUnknownVtbl: IUnknownVtbl, using IUnknownVtbl: IUnknownVtbl,
Next: proc "stdcall" (this: ^IEnumShellItems, celt: ULONG, rgelt: ^^IShellItem, pceltFetched: ^ULONG) -> HRESULT, Next: proc "system" (this: ^IEnumShellItems, celt: ULONG, rgelt: ^^IShellItem, pceltFetched: ^ULONG) -> HRESULT,
Skip: proc "stdcall" (this: ^IEnumShellItems, celt: ULONG) -> HRESULT, Skip: proc "system" (this: ^IEnumShellItems, celt: ULONG) -> HRESULT,
Reset: proc "stdcall" (this: ^IEnumShellItems) -> HRESULT, Reset: proc "system" (this: ^IEnumShellItems) -> HRESULT,
Clone: proc "stdcall" (this: ^IEnumShellItems, ppenum: ^^IEnumShellItems) -> HRESULT, Clone: proc "system" (this: ^IEnumShellItems, ppenum: ^^IEnumShellItems) -> HRESULT,
} }
IShellItem :: struct #raw_union { IShellItem :: struct #raw_union {
@@ -3574,11 +3576,11 @@ IShellItem :: struct #raw_union {
} }
IShellItemVtbl :: struct { IShellItemVtbl :: struct {
using IUnknownVtbl: IUnknownVtbl, using IUnknownVtbl: IUnknownVtbl,
BindToHandler: proc "stdcall" (this: ^IShellItem, pbc: ^IBindCtx, bhid: REFGUID, riid: REFIID, ppv: ^rawptr) -> HRESULT, BindToHandler: proc "system" (this: ^IShellItem, pbc: ^IBindCtx, bhid: REFGUID, riid: REFIID, ppv: ^rawptr) -> HRESULT,
GetParent: proc "stdcall" (this: ^IShellItem, ppsiFolder: ^^IShellItem) -> HRESULT, GetParent: proc "system" (this: ^IShellItem, ppsiFolder: ^^IShellItem) -> HRESULT,
GetDisplayName: proc "stdcall" (this: ^IShellItem, sigdnName: SIGDN, ppszName: ^LPWSTR) -> HRESULT, GetDisplayName: proc "system" (this: ^IShellItem, sigdnName: SIGDN, ppszName: ^LPWSTR) -> HRESULT,
GetAttributes: proc "stdcall" (this: ^IShellItem, sfgaoMask: SFGAOF, psfgaoAttribs: ^SFGAOF) -> HRESULT, GetAttributes: proc "system" (this: ^IShellItem, sfgaoMask: SFGAOF, psfgaoAttribs: ^SFGAOF) -> HRESULT,
Compare: proc "stdcall" (this: ^IShellItem, psi: ^IShellItem, hint: SICHINTF, piOrder: ^c_int) -> HRESULT, Compare: proc "system" (this: ^IShellItem, psi: ^IShellItem, hint: SICHINTF, piOrder: ^c_int) -> HRESULT,
} }
IShellItemArray :: struct #raw_union { IShellItemArray :: struct #raw_union {
@@ -3587,13 +3589,13 @@ IShellItemArray :: struct #raw_union {
} }
IShellItemArrayVtbl :: struct { IShellItemArrayVtbl :: struct {
using IUnknownVtbl: IUnknownVtbl, using IUnknownVtbl: IUnknownVtbl,
BindToHandler: proc "stdcall" (this: ^IShellItemArray, pbc: ^IBindCtx, bhid: REFGUID, riid: REFIID, ppvOut: ^rawptr) -> HRESULT, BindToHandler: proc "system" (this: ^IShellItemArray, pbc: ^IBindCtx, bhid: REFGUID, riid: REFIID, ppvOut: ^rawptr) -> HRESULT,
GetPropertyStore: proc "stdcall" (this: ^IShellItemArray, flags: GETPROPERTYSTOREFLAGS, riid: REFIID, ppv: ^rawptr) -> HRESULT, GetPropertyStore: proc "system" (this: ^IShellItemArray, flags: GETPROPERTYSTOREFLAGS, riid: REFIID, ppv: ^rawptr) -> HRESULT,
GetPropertyDescriptionList: proc "stdcall" (this: ^IShellItemArray, keyType: REFPROPERTYKEY, riid: REFIID, ppv: ^rawptr) -> HRESULT, GetPropertyDescriptionList: proc "system" (this: ^IShellItemArray, keyType: REFPROPERTYKEY, riid: REFIID, ppv: ^rawptr) -> HRESULT,
GetAttributes: proc "stdcall" (this: ^IShellItemArray, AttribFlags: SIATTRIBFLAGS, sfgaoMask: SFGAOF, psfgaoAttribs: ^SFGAOF) -> HRESULT, GetAttributes: proc "system" (this: ^IShellItemArray, AttribFlags: SIATTRIBFLAGS, sfgaoMask: SFGAOF, psfgaoAttribs: ^SFGAOF) -> HRESULT,
GetCount: proc "stdcall" (this: ^IShellItemArray, pdwNumItems: ^DWORD) -> HRESULT, GetCount: proc "system" (this: ^IShellItemArray, pdwNumItems: ^DWORD) -> HRESULT,
GetItemAt: proc "stdcall" (this: ^IShellItemArray, dwIndex: DWORD, ppsi: ^^IShellItem) -> HRESULT, GetItemAt: proc "system" (this: ^IShellItemArray, dwIndex: DWORD, ppsi: ^^IShellItem) -> HRESULT,
EnumItems: proc "stdcall" (this: ^IShellItemArray, ppenumShellItems: ^^IEnumShellItems) -> HRESULT, EnumItems: proc "system" (this: ^IShellItemArray, ppenumShellItems: ^^IEnumShellItems) -> HRESULT,
} }
IFileDialogEvents :: struct #raw_union { IFileDialogEvents :: struct #raw_union {
@@ -3602,13 +3604,13 @@ IFileDialogEvents :: struct #raw_union {
} }
IFileDialogEventsVtbl :: struct { IFileDialogEventsVtbl :: struct {
using IUnknownVtbl: IUnknownVtbl, using IUnknownVtbl: IUnknownVtbl,
OnFileOk: proc "stdcall" (this: ^IFileDialogEvents, pfd: ^IFileDialog) -> HRESULT, OnFileOk: proc "system" (this: ^IFileDialogEvents, pfd: ^IFileDialog) -> HRESULT,
OnFolderChanging: proc "stdcall" (this: ^IFileDialogEvents, pfd: ^IFileDialog, psiFolder: ^IShellItem) -> HRESULT, OnFolderChanging: proc "system" (this: ^IFileDialogEvents, pfd: ^IFileDialog, psiFolder: ^IShellItem) -> HRESULT,
OnFolderChange: proc "stdcall" (this: ^IFileDialogEvents, pfd: ^IFileDialog) -> HRESULT, OnFolderChange: proc "system" (this: ^IFileDialogEvents, pfd: ^IFileDialog) -> HRESULT,
OnSelectionChange: proc "stdcall" (this: ^IFileDialogEvents, pfd: ^IFileDialog) -> HRESULT, OnSelectionChange: proc "system" (this: ^IFileDialogEvents, pfd: ^IFileDialog) -> HRESULT,
OnShareViolation: proc "stdcall" (this: ^IFileDialogEvents, pfd: ^IFileDialog, psi: ^IShellItem, pResponse: ^FDE_SHAREVIOLATION_RESPONSE) -> HRESULT, OnShareViolation: proc "system" (this: ^IFileDialogEvents, pfd: ^IFileDialog, psi: ^IShellItem, pResponse: ^FDE_SHAREVIOLATION_RESPONSE) -> HRESULT,
OnTypeChange: proc "stdcall" (this: ^IFileDialogEvents, pfd: ^IFileDialog) -> HRESULT, OnTypeChange: proc "system" (this: ^IFileDialogEvents, pfd: ^IFileDialog) -> HRESULT,
OnOverwrite: proc "stdcall" (this: ^IFileDialogEvents, pfd: ^IFileDialog, psi: ^IShellItem, pResponse: ^FDE_SHAREVIOLATION_RESPONSE) -> HRESULT, OnOverwrite: proc "system" (this: ^IFileDialogEvents, pfd: ^IFileDialog, psi: ^IShellItem, pResponse: ^FDE_SHAREVIOLATION_RESPONSE) -> HRESULT,
} }
IShellItemFilter :: struct #raw_union { IShellItemFilter :: struct #raw_union {
@@ -3617,8 +3619,8 @@ IShellItemFilter :: struct #raw_union {
} }
IShellItemFilterVtbl :: struct { IShellItemFilterVtbl :: struct {
using IUnknownVtbl: IUnknownVtbl, using IUnknownVtbl: IUnknownVtbl,
IncludeItem: proc "stdcall" (this: ^IShellItemFilter, psi: ^IShellItem) -> HRESULT, IncludeItem: proc "system" (this: ^IShellItemFilter, psi: ^IShellItem) -> HRESULT,
GetEnumFlagsForItem: proc "stdcall" (this: ^IShellItemFilter, psi: ^IShellItem, pgrfFlags: ^SHCONTF) -> HRESULT, GetEnumFlagsForItem: proc "system" (this: ^IShellItemFilter, psi: ^IShellItem, pgrfFlags: ^SHCONTF) -> HRESULT,
} }
IFileDialog :: struct #raw_union { IFileDialog :: struct #raw_union {
@@ -3627,29 +3629,29 @@ IFileDialog :: struct #raw_union {
} }
IFileDialogVtbl :: struct { IFileDialogVtbl :: struct {
using IModalWindowVtbl: IModalWindowVtbl, using IModalWindowVtbl: IModalWindowVtbl,
SetFileTypes: proc "stdcall" (this: ^IFileDialog, cFileTypes: UINT, rgFilterSpec: ^COMDLG_FILTERSPEC) -> HRESULT, SetFileTypes: proc "system" (this: ^IFileDialog, cFileTypes: UINT, rgFilterSpec: ^COMDLG_FILTERSPEC) -> HRESULT,
SetFileTypeIndex: proc "stdcall" (this: ^IFileDialog, iFileType: UINT) -> HRESULT, SetFileTypeIndex: proc "system" (this: ^IFileDialog, iFileType: UINT) -> HRESULT,
GetFileTypeIndex: proc "stdcall" (this: ^IFileDialog, piFileType: ^UINT) -> HRESULT, GetFileTypeIndex: proc "system" (this: ^IFileDialog, piFileType: ^UINT) -> HRESULT,
Advise: proc "stdcall" (this: ^IFileDialog, pfde: ^IFileDialogEvents, pdwCookie: ^DWORD) -> HRESULT, Advise: proc "system" (this: ^IFileDialog, pfde: ^IFileDialogEvents, pdwCookie: ^DWORD) -> HRESULT,
Unadvise: proc "stdcall" (this: ^IFileDialog, dwCookie: DWORD) -> HRESULT, Unadvise: proc "system" (this: ^IFileDialog, dwCookie: DWORD) -> HRESULT,
SetOptions: proc "stdcall" (this: ^IFileDialog, fos: FILEOPENDIALOGOPTIONS) -> HRESULT, SetOptions: proc "system" (this: ^IFileDialog, fos: FILEOPENDIALOGOPTIONS) -> HRESULT,
GetOptions: proc "stdcall" (this: ^IFileDialog, pfos: ^FILEOPENDIALOGOPTIONS) -> HRESULT, GetOptions: proc "system" (this: ^IFileDialog, pfos: ^FILEOPENDIALOGOPTIONS) -> HRESULT,
SetDefaultFolder: proc "stdcall" (this: ^IFileDialog, psi: ^IShellItem) -> HRESULT, SetDefaultFolder: proc "system" (this: ^IFileDialog, psi: ^IShellItem) -> HRESULT,
SetFolder: proc "stdcall" (this: ^IFileDialog, psi: ^IShellItem) -> HRESULT, SetFolder: proc "system" (this: ^IFileDialog, psi: ^IShellItem) -> HRESULT,
GetFolder: proc "stdcall" (this: ^IFileDialog, ppsi: ^^IShellItem) -> HRESULT, GetFolder: proc "system" (this: ^IFileDialog, ppsi: ^^IShellItem) -> HRESULT,
GetCurrentSelection: proc "stdcall" (this: ^IFileDialog, ppsi: ^^IShellItem) -> HRESULT, GetCurrentSelection: proc "system" (this: ^IFileDialog, ppsi: ^^IShellItem) -> HRESULT,
SetFileName: proc "stdcall" (this: ^IFileDialog, pszName: LPCWSTR) -> HRESULT, SetFileName: proc "system" (this: ^IFileDialog, pszName: LPCWSTR) -> HRESULT,
GetFileName: proc "stdcall" (this: ^IFileDialog, pszName: ^LPCWSTR) -> HRESULT, GetFileName: proc "system" (this: ^IFileDialog, pszName: ^LPCWSTR) -> HRESULT,
SetTitle: proc "stdcall" (this: ^IFileDialog, pszTitle: LPCWSTR) -> HRESULT, SetTitle: proc "system" (this: ^IFileDialog, pszTitle: LPCWSTR) -> HRESULT,
SetOkButtonLabel: proc "stdcall" (this: ^IFileDialog, pszText: LPCWSTR) -> HRESULT, SetOkButtonLabel: proc "system" (this: ^IFileDialog, pszText: LPCWSTR) -> HRESULT,
SetFileNameLabel: proc "stdcall" (this: ^IFileDialog, pszLabel: LPCWSTR) -> HRESULT, SetFileNameLabel: proc "system" (this: ^IFileDialog, pszLabel: LPCWSTR) -> HRESULT,
GetResult: proc "stdcall" (this: ^IFileDialog, ppsi: ^^IShellItem) -> HRESULT, GetResult: proc "system" (this: ^IFileDialog, ppsi: ^^IShellItem) -> HRESULT,
AddPlace: proc "stdcall" (this: ^IFileDialog, psi: ^IShellItem, fdap: FDAP) -> HRESULT, AddPlace: proc "system" (this: ^IFileDialog, psi: ^IShellItem, fdap: FDAP) -> HRESULT,
SetDefaultExtension: proc "stdcall" (this: ^IFileDialog, pszDefaultExtension: LPCWSTR) -> HRESULT, SetDefaultExtension: proc "system" (this: ^IFileDialog, pszDefaultExtension: LPCWSTR) -> HRESULT,
Close: proc "stdcall" (this: ^IFileDialog, hr: HRESULT) -> HRESULT, Close: proc "system" (this: ^IFileDialog, hr: HRESULT) -> HRESULT,
SetClientGuid: proc "stdcall" (this: ^IFileDialog, guid: REFGUID) -> HRESULT, SetClientGuid: proc "system" (this: ^IFileDialog, guid: REFGUID) -> HRESULT,
ClearClientData: proc "stdcall" (this: ^IFileDialog) -> HRESULT, ClearClientData: proc "system" (this: ^IFileDialog) -> HRESULT,
SetFilter: proc "stdcall" (this: ^IFileDialog, pFilter: ^IShellItemFilter) -> HRESULT, SetFilter: proc "system" (this: ^IFileDialog, pFilter: ^IShellItemFilter) -> HRESULT,
} }
IFileOpenDialog :: struct #raw_union { IFileOpenDialog :: struct #raw_union {
@@ -3658,8 +3660,8 @@ IFileOpenDialog :: struct #raw_union {
} }
IFileOpenDialogVtbl :: struct { IFileOpenDialogVtbl :: struct {
using IFileDialogVtbl: IFileDialogVtbl, using IFileDialogVtbl: IFileDialogVtbl,
GetResults: proc "stdcall" (this: ^IFileOpenDialog, ppenum: ^^IShellItemArray) -> HRESULT, GetResults: proc "system" (this: ^IFileOpenDialog, ppenum: ^^IShellItemArray) -> HRESULT,
GetSelectedItems: proc "stdcall" (this: ^IFileOpenDialog, ppsai: ^^IShellItemArray) -> HRESULT, GetSelectedItems: proc "system" (this: ^IFileOpenDialog, ppsai: ^^IShellItemArray) -> HRESULT,
} }
IPropertyStore :: struct #raw_union { IPropertyStore :: struct #raw_union {
@@ -3668,11 +3670,11 @@ IPropertyStore :: struct #raw_union {
} }
IPropertyStoreVtbl :: struct { IPropertyStoreVtbl :: struct {
using IUnknownVtbl: IUnknownVtbl, using IUnknownVtbl: IUnknownVtbl,
GetCount: proc "stdcall" (this: ^IPropertyStore, cProps: ^DWORD) -> HRESULT, GetCount: proc "system" (this: ^IPropertyStore, cProps: ^DWORD) -> HRESULT,
GetAt: proc "stdcall" (this: ^IPropertyStore, iProp: DWORD, pkey: ^PROPERTYKEY) -> HRESULT, GetAt: proc "system" (this: ^IPropertyStore, iProp: DWORD, pkey: ^PROPERTYKEY) -> HRESULT,
GetValue: proc "stdcall" (this: ^IPropertyStore, key: REFPROPERTYKEY, pv: ^PROPVARIANT) -> HRESULT, GetValue: proc "system" (this: ^IPropertyStore, key: REFPROPERTYKEY, pv: ^PROPVARIANT) -> HRESULT,
SetValue: proc "stdcall" (this: ^IPropertyStore, key: REFPROPERTYKEY, propvar: REFPROPVARIANT) -> HRESULT, SetValue: proc "system" (this: ^IPropertyStore, key: REFPROPERTYKEY, propvar: REFPROPVARIANT) -> HRESULT,
Commit: proc "stdcall" (this: ^IPropertyStore) -> HRESULT, Commit: proc "system" (this: ^IPropertyStore) -> HRESULT,
} }
IPropertyDescriptionList :: struct #raw_union { IPropertyDescriptionList :: struct #raw_union {
@@ -3681,8 +3683,8 @@ IPropertyDescriptionList :: struct #raw_union {
} }
IPropertyDescriptionListVtbl :: struct { IPropertyDescriptionListVtbl :: struct {
using IUnknownVtbl: IUnknownVtbl, using IUnknownVtbl: IUnknownVtbl,
GetCount: proc "stdcall" (this: ^IPropertyDescriptionList, pcElem: ^UINT) -> HRESULT, GetCount: proc "system" (this: ^IPropertyDescriptionList, pcElem: ^UINT) -> HRESULT,
GetAt: proc "stdcall" (this: ^IPropertyDescriptionList, iElem: UINT, riid: REFIID, ppv: ^rawptr) -> HRESULT, GetAt: proc "system" (this: ^IPropertyDescriptionList, iElem: UINT, riid: REFIID, ppv: ^rawptr) -> HRESULT,
} }
IFileOperationProgressSink :: struct #raw_union { IFileOperationProgressSink :: struct #raw_union {
@@ -3691,22 +3693,22 @@ IFileOperationProgressSink :: struct #raw_union {
} }
IFileOperationProgressSinkVtbl :: struct { IFileOperationProgressSinkVtbl :: struct {
using IUnknownVtbl: IUnknownVtbl, using IUnknownVtbl: IUnknownVtbl,
StartOperations: proc "stdcall" (this: ^IFileOperationProgressSink) -> HRESULT, StartOperations: proc "system" (this: ^IFileOperationProgressSink) -> HRESULT,
FinishOperations: proc "stdcall" (this: ^IFileOperationProgressSink, hrResult: HRESULT) -> HRESULT, FinishOperations: proc "system" (this: ^IFileOperationProgressSink, hrResult: HRESULT) -> HRESULT,
PreRenameItem: proc "stdcall" (this: ^IFileOperationProgressSink, dwFlags: DWORD, psiItem: ^IShellItem, pszNewName: LPCWSTR) -> HRESULT, PreRenameItem: proc "system" (this: ^IFileOperationProgressSink, dwFlags: DWORD, psiItem: ^IShellItem, pszNewName: LPCWSTR) -> HRESULT,
PostRenameItem: proc "stdcall" (this: ^IFileOperationProgressSink, dwFlags: DWORD, psiItem: ^IShellItem, pszNewName: LPCWSTR, hrRename: HRESULT, psiNewlyCreated: ^IShellItem) -> HRESULT, PostRenameItem: proc "system" (this: ^IFileOperationProgressSink, dwFlags: DWORD, psiItem: ^IShellItem, pszNewName: LPCWSTR, hrRename: HRESULT, psiNewlyCreated: ^IShellItem) -> HRESULT,
PreMoveItem: proc "stdcall" (this: ^IFileOperationProgressSink, dwFlags: DWORD, psiItem: ^IShellItem, psiDestinationFolder: ^IShellItem, pszNewName: LPCWSTR) -> HRESULT, PreMoveItem: proc "system" (this: ^IFileOperationProgressSink, dwFlags: DWORD, psiItem: ^IShellItem, psiDestinationFolder: ^IShellItem, pszNewName: LPCWSTR) -> HRESULT,
PostMoveItem: proc "stdcall" (this: ^IFileOperationProgressSink, dwFlags: DWORD, psiItem: ^IShellItem, psiDestinationFolder: ^IShellItem, pszNewName: LPCWSTR, hrMove: HRESULT, psiNewlyCreated: ^IShellItem) -> HRESULT, PostMoveItem: proc "system" (this: ^IFileOperationProgressSink, dwFlags: DWORD, psiItem: ^IShellItem, psiDestinationFolder: ^IShellItem, pszNewName: LPCWSTR, hrMove: HRESULT, psiNewlyCreated: ^IShellItem) -> HRESULT,
PreCopyItem: proc "stdcall" (this: ^IFileOperationProgressSink, dwFlags: DWORD, psiItem: ^IShellItem, psiDestinationFolder: ^IShellItem, pszNewName: LPCWSTR) -> HRESULT, PreCopyItem: proc "system" (this: ^IFileOperationProgressSink, dwFlags: DWORD, psiItem: ^IShellItem, psiDestinationFolder: ^IShellItem, pszNewName: LPCWSTR) -> HRESULT,
PostCopyItem: proc "stdcall" (this: ^IFileOperationProgressSink, dwFlags: DWORD, psiItem: ^IShellItem, psiDestinationFolder: ^IShellItem, pszNewName: LPCWSTR, hrMove: HRESULT, psiNewlyCreated: ^IShellItem) -> HRESULT, PostCopyItem: proc "system" (this: ^IFileOperationProgressSink, dwFlags: DWORD, psiItem: ^IShellItem, psiDestinationFolder: ^IShellItem, pszNewName: LPCWSTR, hrMove: HRESULT, psiNewlyCreated: ^IShellItem) -> HRESULT,
PreDeleteItem: proc "stdcall" (this: ^IFileOperationProgressSink, dwFlags: DWORD, psiItem: ^IShellItem) -> HRESULT, PreDeleteItem: proc "system" (this: ^IFileOperationProgressSink, dwFlags: DWORD, psiItem: ^IShellItem) -> HRESULT,
PostDeleteItem: proc "stdcall" (this: ^IFileOperationProgressSink, dwFlags: DWORD, psiItem: ^IShellItem, hrDelete: HRESULT, psiNewlyCreated: ^IShellItem) -> HRESULT, PostDeleteItem: proc "system" (this: ^IFileOperationProgressSink, dwFlags: DWORD, psiItem: ^IShellItem, hrDelete: HRESULT, psiNewlyCreated: ^IShellItem) -> HRESULT,
PreNewItem: proc "stdcall" (this: ^IFileOperationProgressSink, dwFlags: DWORD, psiDestinationFolder: ^IShellItem, pszNewName: LPCWSTR) -> HRESULT, PreNewItem: proc "system" (this: ^IFileOperationProgressSink, dwFlags: DWORD, psiDestinationFolder: ^IShellItem, pszNewName: LPCWSTR) -> HRESULT,
PostNewItem: proc "stdcall" (this: ^IFileOperationProgressSink, dwFlags: DWORD, psiDestinationFolder: ^IShellItem, pszNewName: LPCWSTR, pszTemplateName: LPCWSTR, dwFileAttributes: DWORD, hrNew: HRESULT, psiNewItem: ^IShellItem) -> HRESULT, PostNewItem: proc "system" (this: ^IFileOperationProgressSink, dwFlags: DWORD, psiDestinationFolder: ^IShellItem, pszNewName: LPCWSTR, pszTemplateName: LPCWSTR, dwFileAttributes: DWORD, hrNew: HRESULT, psiNewItem: ^IShellItem) -> HRESULT,
UpdateProgress: proc "stdcall" (this: ^IFileOperationProgressSink, iWorkTotal: UINT, iWorkSoFar: UINT) -> HRESULT, UpdateProgress: proc "system" (this: ^IFileOperationProgressSink, iWorkTotal: UINT, iWorkSoFar: UINT) -> HRESULT,
ResetTimer: proc "stdcall" (this: ^IFileOperationProgressSink) -> HRESULT, ResetTimer: proc "system" (this: ^IFileOperationProgressSink) -> HRESULT,
PauseTimer: proc "stdcall" (this: ^IFileOperationProgressSink) -> HRESULT, PauseTimer: proc "system" (this: ^IFileOperationProgressSink) -> HRESULT,
ResumeTimer: proc "stdcall" (this: ^IFileOperationProgressSink) -> HRESULT, ResumeTimer: proc "system" (this: ^IFileOperationProgressSink) -> HRESULT,
} }
IFileSaveDialog :: struct #raw_union { IFileSaveDialog :: struct #raw_union {
@@ -3715,11 +3717,11 @@ IFileSaveDialog :: struct #raw_union {
} }
IFileSaveDialogVtbl :: struct { IFileSaveDialogVtbl :: struct {
using IFileDialogVtbl: IFileDialogVtbl, using IFileDialogVtbl: IFileDialogVtbl,
SetSaveAsItem: proc "stdcall" (this: ^IFileSaveDialog, psi: ^IShellItem) -> HRESULT, SetSaveAsItem: proc "system" (this: ^IFileSaveDialog, psi: ^IShellItem) -> HRESULT,
SetProperties: proc "stdcall" (this: ^IFileSaveDialog, pStore: ^IPropertyStore) -> HRESULT, SetProperties: proc "system" (this: ^IFileSaveDialog, pStore: ^IPropertyStore) -> HRESULT,
SetCollectedProperties: proc "stdcall" (this: ^IFileSaveDialog, pList: ^IPropertyDescriptionList, fAppendDefault: BOOL) -> HRESULT, SetCollectedProperties: proc "system" (this: ^IFileSaveDialog, pList: ^IPropertyDescriptionList, fAppendDefault: BOOL) -> HRESULT,
GetProperties: proc "stdcall" (this: ^IFileSaveDialog, ppStore: ^^IPropertyStore) -> HRESULT, GetProperties: proc "system" (this: ^IFileSaveDialog, ppStore: ^^IPropertyStore) -> HRESULT,
ApplyProperties: proc "stdcall" (this: ^IFileSaveDialog, psi: ^IShellItem, pStore: ^IPropertyStore, hwnd: HWND, pSink: ^IFileOperationProgressSink) -> HRESULT, ApplyProperties: proc "system" (this: ^IFileSaveDialog, psi: ^IShellItem, pStore: ^IPropertyStore, hwnd: HWND, pSink: ^IFileOperationProgressSink) -> HRESULT,
} }
ITaskbarList :: struct #raw_union { ITaskbarList :: struct #raw_union {
@@ -3728,11 +3730,11 @@ ITaskbarList :: struct #raw_union {
} }
ITaskbarListVtbl :: struct { ITaskbarListVtbl :: struct {
using IUnknownVtbl: IUnknownVtbl, using IUnknownVtbl: IUnknownVtbl,
HrInit: proc "stdcall" (this: ^ITaskbarList) -> HRESULT, HrInit: proc "system" (this: ^ITaskbarList) -> HRESULT,
AddTab: proc "stdcall" (this: ^ITaskbarList, hwnd: HWND) -> HRESULT, AddTab: proc "system" (this: ^ITaskbarList, hwnd: HWND) -> HRESULT,
DeleteTab: proc "stdcall" (this: ^ITaskbarList, hwnd: HWND) -> HRESULT, DeleteTab: proc "system" (this: ^ITaskbarList, hwnd: HWND) -> HRESULT,
ActivateTab: proc "stdcall" (this: ^ITaskbarList, hwnd: HWND) -> HRESULT, ActivateTab: proc "system" (this: ^ITaskbarList, hwnd: HWND) -> HRESULT,
SetActiveAlt: proc "stdcall" (this: ^ITaskbarList, hwnd: HWND) -> HRESULT, SetActiveAlt: proc "system" (this: ^ITaskbarList, hwnd: HWND) -> HRESULT,
} }
ITaskbarList2 :: struct #raw_union { ITaskbarList2 :: struct #raw_union {
@@ -3741,7 +3743,7 @@ ITaskbarList2 :: struct #raw_union {
} }
ITaskbarList2Vtbl :: struct { ITaskbarList2Vtbl :: struct {
using ITaskbarListVtbl: ITaskbarListVtbl, using ITaskbarListVtbl: ITaskbarListVtbl,
MarkFullscreenWindow: proc "stdcall" (this: ^ITaskbarList2, hwnd: HWND, fFullscreen: BOOL) -> HRESULT, MarkFullscreenWindow: proc "system" (this: ^ITaskbarList2, hwnd: HWND, fFullscreen: BOOL) -> HRESULT,
} }
TBPFLAG :: enum c_int { TBPFLAG :: enum c_int {
@@ -3786,18 +3788,18 @@ ITaskbarList3 :: struct #raw_union {
} }
ITaskbarList3Vtbl :: struct { ITaskbarList3Vtbl :: struct {
using ITaskbarList2Vtbl: ITaskbarList2Vtbl, using ITaskbarList2Vtbl: ITaskbarList2Vtbl,
SetProgressValue: proc "stdcall" (this: ^ITaskbarList3, hwnd: HWND, ullCompleted: ULONGLONG, ullTotal: ULONGLONG) -> HRESULT, SetProgressValue: proc "system" (this: ^ITaskbarList3, hwnd: HWND, ullCompleted: ULONGLONG, ullTotal: ULONGLONG) -> HRESULT,
SetProgressState: proc "stdcall" (this: ^ITaskbarList3, hwnd: HWND, tbpFlags: TBPFLAG) -> HRESULT, SetProgressState: proc "system" (this: ^ITaskbarList3, hwnd: HWND, tbpFlags: TBPFLAG) -> HRESULT,
RegisterTab: proc "stdcall" (this: ^ITaskbarList3, hwndTab: HWND, hwndMDI: HWND) -> HRESULT, RegisterTab: proc "system" (this: ^ITaskbarList3, hwndTab: HWND, hwndMDI: HWND) -> HRESULT,
UnregisterTab: proc "stdcall" (this: ^ITaskbarList3, hwndTab: HWND) -> HRESULT, UnregisterTab: proc "system" (this: ^ITaskbarList3, hwndTab: HWND) -> HRESULT,
SetTabOrder: proc "stdcall" (this: ^ITaskbarList3, hwndTab: HWND, hwndInsertBefore: HWND) -> HRESULT, SetTabOrder: proc "system" (this: ^ITaskbarList3, hwndTab: HWND, hwndInsertBefore: HWND) -> HRESULT,
SetTabActive: proc "stdcall" (this: ^ITaskbarList3, hwndTab: HWND, hwndMDI: HWND, dwReserved: DWORD) -> HRESULT, SetTabActive: proc "system" (this: ^ITaskbarList3, hwndTab: HWND, hwndMDI: HWND, dwReserved: DWORD) -> HRESULT,
ThumbBarAddButtons: proc "stdcall" (this: ^ITaskbarList3, hwnd: HWND, cButtons: UINT, pButton: LPTHUMBBUTTON) -> HRESULT, ThumbBarAddButtons: proc "system" (this: ^ITaskbarList3, hwnd: HWND, cButtons: UINT, pButton: LPTHUMBBUTTON) -> HRESULT,
ThumbBarUpdateButtons: proc "stdcall" (this: ^ITaskbarList3, hwnd: HWND, cButtons: UINT, pButton: LPTHUMBBUTTON) -> HRESULT, ThumbBarUpdateButtons: proc "system" (this: ^ITaskbarList3, hwnd: HWND, cButtons: UINT, pButton: LPTHUMBBUTTON) -> HRESULT,
ThumbBarSetImageList: proc "stdcall" (this: ^ITaskbarList3, hwnd: HWND, himl: HIMAGELIST) -> HRESULT, ThumbBarSetImageList: proc "system" (this: ^ITaskbarList3, hwnd: HWND, himl: HIMAGELIST) -> HRESULT,
SetOverlayIcon: proc "stdcall" (this: ^ITaskbarList3, hwnd: HWND, hIcon: HICON, pszDescription: LPCWSTR) -> HRESULT, SetOverlayIcon: proc "system" (this: ^ITaskbarList3, hwnd: HWND, hIcon: HICON, pszDescription: LPCWSTR) -> HRESULT,
SetThumbnailTooltip: proc "stdcall" (this: ^ITaskbarList3, hwnd: HWND, pszTip: LPCWSTR) -> HRESULT, SetThumbnailTooltip: proc "system" (this: ^ITaskbarList3, hwnd: HWND, pszTip: LPCWSTR) -> HRESULT,
SetThumbnailClip: proc "stdcall" (this: ^ITaskbarList3, hwnd: HWND, prcClip: ^RECT) -> HRESULT, SetThumbnailClip: proc "system" (this: ^ITaskbarList3, hwnd: HWND, prcClip: ^RECT) -> HRESULT,
} }
MEMORYSTATUSEX :: struct { MEMORYSTATUSEX :: struct {
+5 -5
View File
@@ -3,7 +3,7 @@ package sys_windows
foreign import user32 "system:User32.lib" foreign import user32 "system:User32.lib"
@(default_calling_convention="stdcall") @(default_calling_convention="system")
foreign user32 { foreign user32 {
GetClassInfoW :: proc(hInstance: HINSTANCE, lpClassNAme: LPCWSTR, lpWndClass: ^WNDCLASSW) -> BOOL --- GetClassInfoW :: proc(hInstance: HINSTANCE, lpClassNAme: LPCWSTR, lpWndClass: ^WNDCLASSW) -> BOOL ---
GetClassInfoExW :: proc(hInsatnce: HINSTANCE, lpszClass: LPCWSTR, lpwcx: ^WNDCLASSEXW) -> BOOL --- GetClassInfoExW :: proc(hInsatnce: HINSTANCE, lpszClass: LPCWSTR, lpwcx: ^WNDCLASSEXW) -> BOOL ---
@@ -236,7 +236,7 @@ foreign user32 {
EnableMenuItem :: proc(hMenu: HMENU, uIDEnableItem: UINT, uEnable: UINT) -> BOOL --- EnableMenuItem :: proc(hMenu: HMENU, uIDEnableItem: UINT, uEnable: UINT) -> BOOL ---
} }
CreateWindowW :: #force_inline proc "stdcall" ( CreateWindowW :: #force_inline proc "system" (
lpClassName: LPCTSTR, lpClassName: LPCTSTR,
lpWindowName: LPCTSTR, lpWindowName: LPCTSTR,
dwStyle: DWORD, dwStyle: DWORD,
@@ -266,7 +266,7 @@ CreateWindowW :: #force_inline proc "stdcall" (
} }
when ODIN_ARCH == .amd64 { when ODIN_ARCH == .amd64 {
@(default_calling_convention="stdcall") @(default_calling_convention="system")
foreign user32 { foreign user32 {
GetClassLongPtrW :: proc(hWnd: HWND, nIndex: c_int) -> ULONG_PTR --- GetClassLongPtrW :: proc(hWnd: HWND, nIndex: c_int) -> ULONG_PTR ---
SetClassLongPtrW :: proc(hWnd: HWND, nIndex: c_int, dwNewLong: LONG_PTR) -> ULONG_PTR --- SetClassLongPtrW :: proc(hWnd: HWND, nIndex: c_int, dwNewLong: LONG_PTR) -> ULONG_PTR ---
@@ -312,8 +312,8 @@ Monitor_From_Flags :: enum DWORD {
MONITOR_DEFAULTTONEAREST = 0x00000002, // Returns a handle to the display monitor that is nearest to the window MONITOR_DEFAULTTONEAREST = 0x00000002, // Returns a handle to the display monitor that is nearest to the window
} }
Monitor_Enum_Proc :: #type proc "stdcall" (HMONITOR, HDC, LPRECT, LPARAM) -> BOOL Monitor_Enum_Proc :: #type proc "system" (HMONITOR, HDC, LPRECT, LPARAM) -> BOOL
Window_Enum_Proc :: #type proc "stdcall" (HWND, LPARAM) -> BOOL Window_Enum_Proc :: #type proc "system" (HWND, LPARAM) -> BOOL
USER_DEFAULT_SCREEN_DPI :: 96 USER_DEFAULT_SCREEN_DPI :: 96
DPI_AWARENESS_CONTEXT :: distinct HANDLE DPI_AWARENESS_CONTEXT :: distinct HANDLE
+1 -1
View File
@@ -3,7 +3,7 @@ package sys_windows
foreign import userenv "system:Userenv.lib" foreign import userenv "system:Userenv.lib"
@(default_calling_convention="stdcall") @(default_calling_convention="system")
foreign userenv { foreign userenv {
GetUserProfileDirectoryW :: proc(hToken: HANDLE, GetUserProfileDirectoryW :: proc(hToken: HANDLE,
lpProfileDir: LPWSTR, lpProfileDir: LPWSTR,
+1 -1
View File
@@ -6,7 +6,7 @@ foreign import uxtheme "system:UxTheme.lib"
MARGINS :: distinct [4]int MARGINS :: distinct [4]int
PMARGINS :: ^MARGINS PMARGINS :: ^MARGINS
@(default_calling_convention="stdcall") @(default_calling_convention="system")
foreign uxtheme { foreign uxtheme {
IsThemeActive :: proc() -> BOOL --- IsThemeActive :: proc() -> BOOL ---
} }
+1 -1
View File
@@ -66,7 +66,7 @@ GetExtensionsStringARBType :: #type proc "c" (HDC) -> cstring
wglGetExtensionsStringARB: GetExtensionsStringARBType wglGetExtensionsStringARB: GetExtensionsStringARBType
@(default_calling_convention="stdcall") @(default_calling_convention="system")
foreign Opengl32 { foreign Opengl32 {
wglCreateContext :: proc(hdc: HDC) -> HGLRC --- wglCreateContext :: proc(hdc: HDC) -> HGLRC ---
wglMakeCurrent :: proc(hdc: HDC, HGLRC: HGLRC) -> BOOL --- wglMakeCurrent :: proc(hdc: HDC, HGLRC: HGLRC) -> BOOL ---
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -5,7 +5,7 @@ foreign import winmm "system:Winmm.lib"
MMRESULT :: UINT MMRESULT :: UINT
@(default_calling_convention="stdcall") @(default_calling_convention="system")
foreign winmm { foreign winmm {
timeGetDevCaps :: proc(ptc: LPTIMECAPS, cbtc: UINT) -> MMRESULT --- timeGetDevCaps :: proc(ptc: LPTIMECAPS, cbtc: UINT) -> MMRESULT ---
timeBeginPeriod :: proc(uPeriod: UINT) -> MMRESULT --- timeBeginPeriod :: proc(uPeriod: UINT) -> MMRESULT ---
+1 -1
View File
@@ -56,7 +56,7 @@ Example Load:
*/ */
foreign import ws2_32 "system:Ws2_32.lib" foreign import ws2_32 "system:Ws2_32.lib"
@(default_calling_convention="stdcall") @(default_calling_convention="system")
foreign ws2_32 { foreign ws2_32 {
// [MS-Docs](https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-wsastartup) // [MS-Docs](https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-wsastartup)
WSAStartup :: proc(wVersionRequested: WORD, lpWSAData: LPWSADATA) -> c_int --- WSAStartup :: proc(wVersionRequested: WORD, lpWSAData: LPWSADATA) -> c_int ---

Some files were not shown because too many files have changed in this diff Show More