Merge branch 'odin-lang:master' into patch-2

This commit is contained in:
Damian Tarnawski
2024-01-18 10:30:21 +01:00
committed by GitHub
176 changed files with 2646 additions and 1949 deletions
+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
+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
}
+3 -1
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"
+1 -1
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 {
+3 -1
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) {
+3 -1
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"
+70 -147
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
} }
+9
View File
@@ -96,6 +96,15 @@ log_allocator_proc :: proc(allocator_data: rawptr, mode: runtime.Allocator_Mode,
str := fmt.bprintf(buf[:], format, la.prefix, padding, old_memory, old_size, size, alignment) 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) context.logger.procedure(context.logger.data, la.level, str, context.logger.options, location)
case .Resize_Non_Zeroed:
format: string
switch la.size_fmt {
case .Bytes: format = "%s%s>>> ALLOCATOR(mode=.Resize_Non_Zeroed, ptr=%p, old_size=%d, size=%d, alignment=%d)"
case .Human: format = "%s%s>>> ALLOCATOR(mode=.Resize_Non_Zeroed, ptr=%p, old_size=%m, size=%m, alignment=%d)"
}
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:
str := fmt.bprintf(buf[:], "%s%sALLOCATOR(mode=.Query_Features)", la.prefix, padding) str := fmt.bprintf(buf[:], "%s%sALLOCATOR(mode=.Query_Features)", la.prefix, padding)
context.logger.procedure(context.logger.data, la.level, str, context.logger.options, location) context.logger.procedure(context.logger.data, la.level, str, context.logger.options, location)
+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
} }
+3 -3
View File
@@ -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))
+24 -2
View File
@@ -11,6 +11,8 @@ Allocator_Mode :: enum byte {
Free_All, Free_All,
Resize, Resize,
Query_Features, Query_Features,
Alloc_Non_Zeroed,
Resize_Non_Zeroed,
} }
*/ */
@@ -243,12 +245,26 @@ default_resize_align :: proc(old_memory: rawptr, old_size, new_size, alignment:
res = raw_data(data) res = raw_data(data)
return return
} }
@(require_results)
default_resize_bytes_align_non_zeroed :: proc(old_data: []byte, new_size, alignment: int, allocator := context.allocator, loc := #caller_location) -> ([]byte, Allocator_Error) {
return _default_resize_bytes_align(old_data, new_size, alignment, false, allocator, loc)
}
@(require_results) @(require_results)
default_resize_bytes_align :: proc(old_data: []byte, new_size, alignment: int, allocator := context.allocator, loc := #caller_location) -> ([]byte, Allocator_Error) { default_resize_bytes_align :: proc(old_data: []byte, new_size, alignment: int, allocator := context.allocator, loc := #caller_location) -> ([]byte, Allocator_Error) {
return _default_resize_bytes_align(old_data, new_size, alignment, true, allocator, loc)
}
@(require_results)
_default_resize_bytes_align :: #force_inline proc(old_data: []byte, new_size, alignment: int, should_zero: bool, allocator := context.allocator, loc := #caller_location) -> ([]byte, Allocator_Error) {
old_memory := raw_data(old_data) old_memory := raw_data(old_data)
old_size := len(old_data) old_size := len(old_data)
if old_memory == nil { if old_memory == nil {
return alloc_bytes(new_size, alignment, allocator, loc) if should_zero {
return alloc_bytes(new_size, alignment, allocator, loc)
} else {
return alloc_bytes_non_zeroed(new_size, alignment, allocator, loc)
}
} }
if new_size == 0 { if new_size == 0 {
@@ -260,7 +276,13 @@ default_resize_bytes_align :: proc(old_data: []byte, new_size, alignment: int, a
return old_data, .None return old_data, .None
} }
new_memory, err := alloc_bytes(new_size, alignment, allocator, loc) new_memory : []byte
err : Allocator_Error
if should_zero {
new_memory, err = alloc_bytes(new_size, alignment, allocator, loc)
} else {
new_memory, err = alloc_bytes_non_zeroed(new_size, alignment, allocator, loc)
}
if new_memory == nil || err != nil { if new_memory == nil || err != nil {
return nil, err return nil, err
} }
+23 -16
View File
@@ -85,13 +85,16 @@ arena_allocator_proc :: proc(allocator_data: rawptr, mode: Allocator_Mode,
case .Free_All: case .Free_All:
arena.offset = 0 arena.offset = 0
case .Resize: case .Resize:
return default_resize_bytes_align(byte_slice(old_memory, old_size), size, alignment, arena_allocator(arena)) return default_resize_bytes_align(byte_slice(old_memory, old_size), size, alignment, arena_allocator(arena))
case .Resize_Non_Zeroed:
return default_resize_bytes_align_non_zeroed(byte_slice(old_memory, old_size), size, alignment, arena_allocator(arena))
case .Query_Features: case .Query_Features:
set := (^Allocator_Mode_Set)(old_memory) set := (^Allocator_Mode_Set)(old_memory)
if set != nil { if set != nil {
set^ = {.Alloc, .Alloc_Non_Zeroed, .Free_All, .Resize, .Query_Features} set^ = {.Alloc, .Alloc_Non_Zeroed, .Free_All, .Resize, .Resize_Non_Zeroed, .Query_Features}
} }
return nil, nil return nil, nil
@@ -259,7 +262,7 @@ scratch_allocator_proc :: proc(allocator_data: rawptr, mode: Allocator_Mode,
} }
clear(&s.leaked_allocations) clear(&s.leaked_allocations)
case .Resize: case .Resize, .Resize_Non_Zeroed:
begin := uintptr(raw_data(s.data)) begin := uintptr(raw_data(s.data))
end := begin + uintptr(len(s.data)) end := begin + uintptr(len(s.data))
old_ptr := uintptr(old_memory) old_ptr := uintptr(old_memory)
@@ -278,7 +281,7 @@ scratch_allocator_proc :: proc(allocator_data: rawptr, mode: Allocator_Mode,
case .Query_Features: case .Query_Features:
set := (^Allocator_Mode_Set)(old_memory) set := (^Allocator_Mode_Set)(old_memory)
if set != nil { if set != nil {
set^ = {.Alloc, .Alloc_Non_Zeroed, .Free, .Free_All, .Resize, .Query_Features} set^ = {.Alloc, .Alloc_Non_Zeroed, .Free, .Free_All, .Resize, .Resize_Non_Zeroed, .Query_Features}
} }
return nil, nil return nil, nil
@@ -406,9 +409,9 @@ stack_allocator_proc :: proc(allocator_data: rawptr, mode: Allocator_Mode,
s.prev_offset = 0 s.prev_offset = 0
s.curr_offset = 0 s.curr_offset = 0
case .Resize: case .Resize, .Resize_Non_Zeroed:
if old_memory == nil { if old_memory == nil {
return raw_alloc(s, size, alignment, true) return raw_alloc(s, size, alignment, mode == .Resize)
} }
if size == 0 { if size == 0 {
return nil, nil return nil, nil
@@ -434,7 +437,7 @@ stack_allocator_proc :: proc(allocator_data: rawptr, mode: Allocator_Mode,
old_offset := int(curr_addr - uintptr(header.padding) - uintptr(raw_data(s.data))) old_offset := int(curr_addr - uintptr(header.padding) - uintptr(raw_data(s.data)))
if old_offset != header.prev_offset { if old_offset != header.prev_offset {
data, err := raw_alloc(s, size, alignment, true) data, err := raw_alloc(s, size, alignment, mode == .Resize)
if err == nil { if err == nil {
runtime.copy(data, byte_slice(old_memory, old_size)) runtime.copy(data, byte_slice(old_memory, old_size))
} }
@@ -455,7 +458,7 @@ stack_allocator_proc :: proc(allocator_data: rawptr, mode: Allocator_Mode,
case .Query_Features: case .Query_Features:
set := (^Allocator_Mode_Set)(old_memory) set := (^Allocator_Mode_Set)(old_memory)
if set != nil { if set != nil {
set^ = {.Alloc, .Alloc_Non_Zeroed, .Free, .Free_All, .Resize, .Query_Features} set^ = {.Alloc, .Alloc_Non_Zeroed, .Free, .Free_All, .Resize, .Resize_Non_Zeroed, .Query_Features}
} }
return nil, nil return nil, nil
case .Query_Info: case .Query_Info:
@@ -565,9 +568,9 @@ small_stack_allocator_proc :: proc(allocator_data: rawptr, mode: Allocator_Mode,
case .Free_All: case .Free_All:
s.offset = 0 s.offset = 0
case .Resize: case .Resize, .Resize_Non_Zeroed:
if old_memory == nil { if old_memory == nil {
return raw_alloc(s, size, align, true) return raw_alloc(s, size, align, mode == .Resize)
} }
if size == 0 { if size == 0 {
return nil, nil return nil, nil
@@ -590,7 +593,7 @@ small_stack_allocator_proc :: proc(allocator_data: rawptr, mode: Allocator_Mode,
return byte_slice(old_memory, size), nil return byte_slice(old_memory, size), nil
} }
data, err := raw_alloc(s, size, align, true) data, err := raw_alloc(s, size, align, mode == .Resize)
if err == nil { if err == nil {
runtime.copy(data, byte_slice(old_memory, old_size)) runtime.copy(data, byte_slice(old_memory, old_size))
} }
@@ -599,7 +602,7 @@ small_stack_allocator_proc :: proc(allocator_data: rawptr, mode: Allocator_Mode,
case .Query_Features: case .Query_Features:
set := (^Allocator_Mode_Set)(old_memory) set := (^Allocator_Mode_Set)(old_memory)
if set != nil { if set != nil {
set^ = {.Alloc, .Alloc_Non_Zeroed, .Free, .Free_All, .Resize, .Query_Features} set^ = {.Alloc, .Alloc_Non_Zeroed, .Free, .Free_All, .Resize, .Resize_Non_Zeroed, .Query_Features}
} }
return nil, nil return nil, nil
@@ -649,7 +652,7 @@ dynamic_pool_allocator_proc :: proc(allocator_data: rawptr, mode: Allocator_Mode
case .Free_All: case .Free_All:
dynamic_pool_free_all(pool) dynamic_pool_free_all(pool)
return nil, nil return nil, nil
case .Resize: case .Resize, .Resize_Non_Zeroed:
if old_size >= size { if old_size >= size {
return byte_slice(old_memory, size), nil return byte_slice(old_memory, size), nil
} }
@@ -662,7 +665,7 @@ dynamic_pool_allocator_proc :: proc(allocator_data: rawptr, mode: Allocator_Mode
case .Query_Features: case .Query_Features:
set := (^Allocator_Mode_Set)(old_memory) set := (^Allocator_Mode_Set)(old_memory)
if set != nil { if set != nil {
set^ = {.Alloc, .Alloc_Non_Zeroed, .Free_All, .Resize, .Query_Features, .Query_Info} set^ = {.Alloc, .Alloc_Non_Zeroed, .Free_All, .Resize, .Resize_Non_Zeroed, .Query_Features, .Query_Info}
} }
return nil, nil return nil, nil
@@ -826,6 +829,10 @@ panic_allocator_proc :: proc(allocator_data: rawptr, mode: Allocator_Mode,
if size > 0 { if size > 0 {
panic("mem: panic allocator, .Resize called", loc=loc) panic("mem: panic allocator, .Resize called", loc=loc)
} }
case .Resize_Non_Zeroed:
if size > 0 {
panic("mem: panic allocator, .Resize_Non_Zeroed called", loc=loc)
}
case .Free: case .Free:
if old_memory != nil { if old_memory != nil {
panic("mem: panic allocator, .Free called", loc=loc) panic("mem: panic allocator, .Free called", loc=loc)
@@ -958,7 +965,7 @@ tracking_allocator_proc :: proc(allocator_data: rawptr, mode: Allocator_Mode,
if data.clear_on_free_all { if data.clear_on_free_all {
clear_map(&data.allocation_map) clear_map(&data.allocation_map)
} }
case .Resize: case .Resize, .Resize_Non_Zeroed:
if old_memory != result_ptr { if old_memory != result_ptr {
delete_key(&data.allocation_map, old_memory) delete_key(&data.allocation_map, old_memory)
} }
+1 -1
View File
@@ -288,7 +288,7 @@ arena_allocator_proc :: proc(allocator_data: rawptr, mode: mem.Allocator_Mode,
err = .Mode_Not_Implemented err = .Mode_Not_Implemented
case .Free_All: case .Free_All:
arena_free_all(arena, location) arena_free_all(arena, location)
case .Resize: case .Resize, .Resize_Non_Zeroed:
old_data := ([^]byte)(old_memory) old_data := ([^]byte)(old_memory)
switch { switch {
+47
View File
@@ -0,0 +1,47 @@
package mem_virtual
import "core:os"
Map_File_Error :: enum {
None,
Open_Failure,
Stat_Failure,
Negative_Size,
Too_Large_Size,
Map_Failure,
}
Map_File_Flag :: enum u32 {
Read,
Write,
}
Map_File_Flags :: distinct bit_set[Map_File_Flag; u32]
map_file :: proc{
map_file_from_path,
map_file_from_file_descriptor,
}
map_file_from_path :: proc(filename: string, flags: Map_File_Flags) -> (data: []byte, error: Map_File_Error) {
fd, err := os.open(filename, os.O_RDWR)
if err != 0 {
return nil, .Open_Failure
}
defer os.close(fd)
return map_file_from_file_descriptor(uintptr(fd), flags)
}
map_file_from_file_descriptor :: proc(fd: uintptr, flags: Map_File_Flags) -> (data: []byte, error: Map_File_Error) {
size, os_err := os.file_size(os.Handle(fd))
if os_err != 0 {
return nil, .Stat_Failure
}
if size < 0 {
return nil, .Negative_Size
}
if size != i64(int(size)) {
return nil, .Too_Large_Size
}
return _map_file(fd, size, flags)
}
+4
View File
@@ -22,3 +22,7 @@ _protect :: proc "contextless" (data: rawptr, size: uint, flags: Protect_Flags)
_platform_memory_init :: proc() { _platform_memory_init :: proc() {
} }
_map_file :: proc "contextless" (fd: uintptr, size: i64, flags: Map_File_Flags) -> (data: []byte, error: Map_File_Error) {
return nil, .Map_Failure
}
+18 -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
} }
@@ -146,3 +146,20 @@ _platform_memory_init :: proc() {
// is power of two // is power of two
assert(DEFAULT_PAGE_SIZE != 0 && (DEFAULT_PAGE_SIZE & (DEFAULT_PAGE_SIZE-1)) == 0) assert(DEFAULT_PAGE_SIZE != 0 && (DEFAULT_PAGE_SIZE & (DEFAULT_PAGE_SIZE-1)) == 0)
} }
_map_file :: proc "contextless" (fd: uintptr, size: i64, flags: Map_File_Flags) -> (data: []byte, error: Map_File_Error) {
prot, mflags: c.int
if .Read in flags {
prot |= PROT_READ
}
if .Write in flags {
prot |= PROT_WRITE
}
mflags |= MAP_SHARED
addr := _mmap(nil, c.size_t(size), prot, mflags, i32(fd), 0)
if addr == nil {
return nil, .Map_Failure
}
return ([^]byte)(addr)[:size], nil
}
+19 -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() {
@@ -48,3 +48,21 @@ _platform_memory_init :: proc() {
// is power of two // is power of two
assert(DEFAULT_PAGE_SIZE != 0 && (DEFAULT_PAGE_SIZE & (DEFAULT_PAGE_SIZE-1)) == 0) assert(DEFAULT_PAGE_SIZE != 0 && (DEFAULT_PAGE_SIZE & (DEFAULT_PAGE_SIZE-1)) == 0)
} }
_map_file :: proc "contextless" (fd: uintptr, size: i64, flags: Map_File_Flags) -> (data: []byte, error: Map_File_Error) {
prot: linux.Mem_Protection
if .Read in flags {
prot += {.READ}
}
if .Write in flags {
prot += {.WRITE}
}
flags := linux.Map_Flags{.SHARED}
addr, errno := linux.mmap(0, uint(size), prot, flags, linux.Fd(fd), offset=0)
if addr == nil || errno != nil {
return nil, .Map_Failure
}
return ([^]byte)(addr)[:size], nil
}
+53 -3
View File
@@ -50,19 +50,39 @@ PAGE_WRITECOPY :: 0x08
PAGE_TARGETS_INVALID :: 0x40000000 PAGE_TARGETS_INVALID :: 0x40000000
PAGE_TARGETS_NO_UPDATE :: 0x40000000 PAGE_TARGETS_NO_UPDATE :: 0x40000000
SECTION_MAP_WRITE :: 0x0002
SECTION_MAP_READ :: 0x0004
FILE_MAP_WRITE :: SECTION_MAP_WRITE
FILE_MAP_READ :: SECTION_MAP_READ
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 ---
VirtualFree :: proc(lpAddress: rawptr, dwSize: uint, dwFreeType: u32) -> b32 --- VirtualFree :: proc(lpAddress: rawptr, dwSize: uint, dwFreeType: u32) -> b32 ---
VirtualProtect :: proc(lpAddress: rawptr, dwSize: uint, flNewProtect: u32, lpflOldProtect: ^u32) -> b32 --- VirtualProtect :: proc(lpAddress: rawptr, dwSize: uint, flNewProtect: u32, lpflOldProtect: ^u32) -> b32 ---
GetLastError :: proc() -> u32 --- GetLastError :: proc() -> u32 ---
CreateFileMappingW :: proc(
hFile: rawptr,
lpFileMappingAttributes: rawptr,
flProtect: u32,
dwMaximumSizeHigh: u32,
dwMaximumSizeLow: u32,
lpName: [^]u16,
) -> rawptr ---
MapViewOfFile :: proc(
hFileMappingObject: rawptr,
dwDesiredAccess: u32,
dwFileOffsetHigh: u32,
dwFileOffsetLow: u32,
dwNumberOfBytesToMap: uint,
) -> rawptr ---
} }
_reserve :: proc "contextless" (size: uint) -> (data: []byte, err: Allocator_Error) { _reserve :: proc "contextless" (size: uint) -> (data: []byte, err: Allocator_Error) {
result := VirtualAlloc(nil, size, MEM_RESERVE, PAGE_READWRITE) result := VirtualAlloc(nil, size, MEM_RESERVE, PAGE_READWRITE)
if result == nil { if result == nil {
@@ -125,3 +145,33 @@ _platform_memory_init :: proc() {
// is power of two // is power of two
assert(DEFAULT_PAGE_SIZE != 0 && (DEFAULT_PAGE_SIZE & (DEFAULT_PAGE_SIZE-1)) == 0) assert(DEFAULT_PAGE_SIZE != 0 && (DEFAULT_PAGE_SIZE & (DEFAULT_PAGE_SIZE-1)) == 0)
} }
_map_file :: proc "contextless" (fd: uintptr, size: i64, flags: Map_File_Flags) -> (data: []byte, error: Map_File_Error) {
page_flags: u32
if flags == {.Read} {
page_flags = PAGE_READONLY
} else if flags == {.Write} {
page_flags = PAGE_READWRITE
} else if flags == {.Read, .Write} {
page_flags = PAGE_READWRITE
} else {
page_flags = PAGE_NOACCESS
}
maximum_size := transmute([2]u32)size
handle := CreateFileMappingW(rawptr(fd), nil, page_flags, maximum_size[1], maximum_size[0], nil)
if handle == nil {
return nil, .Map_Failure
}
desired_access: u32
if .Read in flags {
desired_access |= FILE_MAP_READ
}
if .Write in flags {
desired_access |= FILE_MAP_WRITE
}
file_data := MapViewOfFile(handle, desired_access, 0, 0, uint(size))
return ([^]byte)(file_data)[:size], nil
}
+7 -7
View File
@@ -210,15 +210,15 @@ heap_allocator_proc :: proc(allocator_data: rawptr, mode: mem.Allocator_Mode,
} }
} }
aligned_resize :: proc(p: rawptr, old_size: int, new_size: int, new_alignment: int) -> (new_memory: []byte, err: mem.Allocator_Error) { aligned_resize :: proc(p: rawptr, old_size: int, new_size: int, new_alignment: int, zero_memory := true) -> (new_memory: []byte, err: mem.Allocator_Error) {
if p == nil { if p == nil {
return nil, nil return nil, nil
} }
new_memory = aligned_alloc(new_size, new_alignment, p) or_return new_memory = aligned_alloc(new_size, new_alignment, p, zero_memory) or_return
// NOTE: heap_resize does not zero the new memory, so we do it // NOTE: heap_resize does not zero the new memory, so we do it
if new_size > old_size { if zero_memory && new_size > old_size {
new_region := mem.raw_data(new_memory[old_size:]) new_region := mem.raw_data(new_memory[old_size:])
mem.zero(new_region, new_size - old_size) mem.zero(new_region, new_size - old_size)
} }
@@ -235,16 +235,16 @@ heap_allocator_proc :: proc(allocator_data: rawptr, mode: mem.Allocator_Mode,
case .Free_All: case .Free_All:
return nil, .Mode_Not_Implemented return nil, .Mode_Not_Implemented
case .Resize: case .Resize, .Resize_Non_Zeroed:
if old_memory == nil { if old_memory == nil {
return aligned_alloc(size, alignment) return aligned_alloc(size, alignment, nil, mode == .Resize)
} }
return aligned_resize(old_memory, old_size, size, alignment) return aligned_resize(old_memory, old_size, size, alignment, mode == .Resize)
case .Query_Features: case .Query_Features:
set := (^mem.Allocator_Mode_Set)(old_memory) set := (^mem.Allocator_Mode_Set)(old_memory)
if set != nil { if set != nil {
set^ = {.Alloc, .Alloc_Non_Zeroed, .Free, .Resize, .Query_Features} set^ = {.Alloc, .Alloc_Non_Zeroed, .Free, .Resize, .Resize_Non_Zeroed, .Query_Features}
} }
return nil, nil return nil, nil
+2
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"
@@ -306,6 +307,7 @@ Allocator_Mode :: enum byte {
Query_Features, Query_Features,
Query_Info, Query_Info,
Alloc_Non_Zeroed, Alloc_Non_Zeroed,
Resize_Non_Zeroed,
} }
Allocator_Mode_Set :: distinct bit_set[Allocator_Mode] Allocator_Mode_Set :: distinct bit_set[Allocator_Mode]
+90 -15
View File
@@ -169,10 +169,16 @@ clear :: proc{clear_dynamic_array, clear_map}
@builtin @builtin
reserve :: proc{reserve_dynamic_array, reserve_map} reserve :: proc{reserve_dynamic_array, reserve_map}
@builtin
non_zero_reserve :: proc{non_zero_reserve_dynamic_array}
// `resize` will try to resize memory of a passed dynamic array or map to the requested element count (setting the `len`, and possibly `cap`). // `resize` will try to resize memory of a passed dynamic array or map to the requested element count (setting the `len`, and possibly `cap`).
@builtin @builtin
resize :: proc{resize_dynamic_array} resize :: proc{resize_dynamic_array}
@builtin
non_zero_resize :: proc{non_zero_resize_dynamic_array}
// Shrinks the capacity of a dynamic array or map down to the current length, or the given capacity. // Shrinks the capacity of a dynamic array or map down to the current length, or the given capacity.
@builtin @builtin
shrink :: proc{shrink_dynamic_array, shrink_map} shrink :: proc{shrink_dynamic_array, shrink_map}
@@ -406,10 +412,7 @@ delete_key :: proc(m: ^$T/map[$K]$V, key: K) -> (deleted_key: K, deleted_value:
return return
} }
_append_elem :: #force_inline proc(array: ^$T/[dynamic]$E, arg: E, should_zero: bool, loc := #caller_location) -> (n: int, err: Allocator_Error) #optional_allocator_error {
@builtin
append_elem :: proc(array: ^$T/[dynamic]$E, arg: E, loc := #caller_location) -> (n: int, err: Allocator_Error) #optional_allocator_error {
if array == nil { if array == nil {
return 0, nil return 0, nil
} }
@@ -420,7 +423,13 @@ append_elem :: proc(array: ^$T/[dynamic]$E, arg: E, loc := #caller_location) ->
} else { } else {
if cap(array) < len(array)+1 { if cap(array) < len(array)+1 {
cap := 2 * cap(array) + max(8, 1) cap := 2 * cap(array) + max(8, 1)
err = reserve(array, cap, loc) // do not 'or_return' here as it could be a partial success
// do not 'or_return' here as it could be a partial success
if should_zero {
err = reserve(array, cap, loc)
} else {
err = non_zero_reserve(array, cap, loc)
}
} }
if cap(array)-len(array) > 0 { if cap(array)-len(array) > 0 {
a := (^Raw_Dynamic_Array)(array) a := (^Raw_Dynamic_Array)(array)
@@ -437,7 +446,16 @@ append_elem :: proc(array: ^$T/[dynamic]$E, arg: E, loc := #caller_location) ->
} }
@builtin @builtin
append_elems :: proc(array: ^$T/[dynamic]$E, args: ..E, loc := #caller_location) -> (n: int, err: Allocator_Error) #optional_allocator_error { append_elem :: proc(array: ^$T/[dynamic]$E, arg: E, loc := #caller_location) -> (n: int, err: Allocator_Error) #optional_allocator_error {
return _append_elem(array, arg, true, loc=loc)
}
@builtin
non_zero_append_elem :: proc(array: ^$T/[dynamic]$E, arg: E, loc := #caller_location) -> (n: int, err: Allocator_Error) #optional_allocator_error {
return _append_elem(array, arg, false, loc=loc)
}
_append_elems :: #force_inline proc(array: ^$T/[dynamic]$E, should_zero: bool, loc := #caller_location, args: ..E) -> (n: int, err: Allocator_Error) #optional_allocator_error {
if array == nil { if array == nil {
return 0, nil return 0, nil
} }
@@ -454,7 +472,13 @@ append_elems :: proc(array: ^$T/[dynamic]$E, args: ..E, loc := #caller_location)
} else { } else {
if cap(array) < len(array)+arg_len { if cap(array) < len(array)+arg_len {
cap := 2 * cap(array) + max(8, arg_len) cap := 2 * cap(array) + max(8, arg_len)
err = reserve(array, cap, loc) // do not 'or_return' here as it could be a partial success
// do not 'or_return' here as it could be a partial success
if should_zero {
err = reserve(array, cap, loc)
} else {
err = non_zero_reserve(array, cap, loc)
}
} }
arg_len = min(cap(array)-len(array), arg_len) arg_len = min(cap(array)-len(array), arg_len)
if arg_len > 0 { if arg_len > 0 {
@@ -470,11 +494,33 @@ append_elems :: proc(array: ^$T/[dynamic]$E, args: ..E, loc := #caller_location)
} }
} }
@builtin
append_elems :: proc(array: ^$T/[dynamic]$E, args: ..E, loc := #caller_location) -> (n: int, err: Allocator_Error) #optional_allocator_error {
return _append_elems(array, true, loc, ..args)
}
@builtin
non_zero_append_elems :: proc(array: ^$T/[dynamic]$E, args: ..E, loc := #caller_location) -> (n: int, err: Allocator_Error) #optional_allocator_error {
return _append_elems(array, false, loc, ..args)
}
// The append_string built-in procedure appends a string to the end of a [dynamic]u8 like type // The append_string built-in procedure appends a string to the end of a [dynamic]u8 like type
_append_elem_string :: proc(array: ^$T/[dynamic]$E/u8, arg: $A/string, should_zero: bool, loc := #caller_location) -> (n: int, err: Allocator_Error) #optional_allocator_error {
args := transmute([]E)arg
if should_zero {
return append_elems(array, ..args, loc=loc)
} else {
return non_zero_append_elems(array, ..args, loc=loc)
}
}
@builtin @builtin
append_elem_string :: proc(array: ^$T/[dynamic]$E/u8, arg: $A/string, loc := #caller_location) -> (n: int, err: Allocator_Error) #optional_allocator_error { append_elem_string :: proc(array: ^$T/[dynamic]$E/u8, arg: $A/string, loc := #caller_location) -> (n: int, err: Allocator_Error) #optional_allocator_error {
args := transmute([]E)arg return _append_elem_string(array, arg, true, loc)
return append_elems(array, ..args, loc=loc) }
@builtin
non_zero_append_elem_string :: proc(array: ^$T/[dynamic]$E/u8, arg: $A/string, loc := #caller_location) -> (n: int, err: Allocator_Error) #optional_allocator_error {
return _append_elem_string(array, arg, false, loc)
} }
@@ -494,6 +540,7 @@ append_string :: proc(array: ^$T/[dynamic]$E/u8, args: ..string, loc := #caller_
// The append built-in procedure appends elements to the end of a dynamic array // The append built-in procedure appends elements to the end of a dynamic array
@builtin append :: proc{append_elem, append_elems, append_elem_string} @builtin append :: proc{append_elem, append_elems, append_elem_string}
@builtin non_zero_append :: proc{non_zero_append_elem, non_zero_append_elems, non_zero_append_elem_string}
@builtin @builtin
@@ -638,8 +685,7 @@ clear_dynamic_array :: proc "contextless" (array: ^$T/[dynamic]$E) {
// `reserve_dynamic_array` will try to reserve memory of a passed dynamic array or map to the requested element count (setting the `cap`). // `reserve_dynamic_array` will try to reserve memory of a passed dynamic array or map to the requested element count (setting the `cap`).
// //
// Note: Prefer the procedure group `reserve`. // Note: Prefer the procedure group `reserve`.
@builtin _reserve_dynamic_array :: #force_inline proc(array: ^$T/[dynamic]$E, capacity: int, should_zero: bool, loc := #caller_location) -> Allocator_Error {
reserve_dynamic_array :: proc(array: ^$T/[dynamic]$E, capacity: int, loc := #caller_location) -> Allocator_Error {
if array == nil { if array == nil {
return nil return nil
} }
@@ -658,7 +704,12 @@ reserve_dynamic_array :: proc(array: ^$T/[dynamic]$E, capacity: int, loc := #cal
new_size := capacity * size_of(E) new_size := capacity * size_of(E)
allocator := a.allocator allocator := a.allocator
new_data := mem_resize(a.data, old_size, new_size, align_of(E), allocator, loc) or_return new_data: []byte
if should_zero {
new_data = mem_resize(a.data, old_size, new_size, align_of(E), allocator, loc) or_return
} else {
new_data = non_zero_mem_resize(a.data, old_size, new_size, align_of(E), allocator, loc) or_return
}
if new_data == nil && new_size > 0 { if new_data == nil && new_size > 0 {
return .Out_Of_Memory return .Out_Of_Memory
} }
@@ -668,11 +719,20 @@ reserve_dynamic_array :: proc(array: ^$T/[dynamic]$E, capacity: int, loc := #cal
return nil return nil
} }
@builtin
reserve_dynamic_array :: proc(array: ^$T/[dynamic]$E, capacity: int, loc := #caller_location) -> Allocator_Error {
return _reserve_dynamic_array(array, capacity, true, loc)
}
@builtin
non_zero_reserve_dynamic_array :: proc(array: ^$T/[dynamic]$E, capacity: int, loc := #caller_location) -> Allocator_Error {
return _reserve_dynamic_array(array, capacity, false, loc)
}
// `resize_dynamic_array` will try to resize memory of a passed dynamic array or map to the requested element count (setting the `len`, and possibly `cap`). // `resize_dynamic_array` will try to resize memory of a passed dynamic array or map to the requested element count (setting the `len`, and possibly `cap`).
// //
// Note: Prefer the procedure group `resize` // Note: Prefer the procedure group `resize`
@builtin _resize_dynamic_array :: #force_inline proc(array: ^$T/[dynamic]$E, length: int, should_zero: bool, loc := #caller_location) -> Allocator_Error {
resize_dynamic_array :: proc(array: ^$T/[dynamic]$E, length: int, loc := #caller_location) -> Allocator_Error {
if array == nil { if array == nil {
return nil return nil
} }
@@ -692,7 +752,12 @@ resize_dynamic_array :: proc(array: ^$T/[dynamic]$E, length: int, loc := #caller
new_size := length * size_of(E) new_size := length * size_of(E)
allocator := a.allocator allocator := a.allocator
new_data := mem_resize(a.data, old_size, new_size, align_of(E), allocator, loc) or_return new_data : []byte
if should_zero {
new_data = mem_resize(a.data, old_size, new_size, align_of(E), allocator, loc) or_return
} else {
new_data = non_zero_mem_resize(a.data, old_size, new_size, align_of(E), allocator, loc) or_return
}
if new_data == nil && new_size > 0 { if new_data == nil && new_size > 0 {
return .Out_Of_Memory return .Out_Of_Memory
} }
@@ -703,6 +768,16 @@ resize_dynamic_array :: proc(array: ^$T/[dynamic]$E, length: int, loc := #caller
return nil return nil
} }
@builtin
resize_dynamic_array :: proc(array: ^$T/[dynamic]$E, length: int, loc := #caller_location) -> Allocator_Error {
return _resize_dynamic_array(array, length, true, loc=loc)
}
@builtin
non_zero_resize_dynamic_array :: proc(array: ^$T/[dynamic]$E, length: int, loc := #caller_location) -> Allocator_Error {
return _resize_dynamic_array(array, length, false, loc=loc)
}
/* /*
Shrinks the capacity of a dynamic array down to the current length, or the given capacity. Shrinks the capacity of a dynamic array down to the current length, or the given capacity.
+1 -1
View File
@@ -195,7 +195,7 @@ arena_allocator_proc :: proc(allocator_data: rawptr, mode: Allocator_Mode,
err = .Mode_Not_Implemented err = .Mode_Not_Implemented
case .Free_All: case .Free_All:
arena_free_all(arena, location) arena_free_all(arena, location)
case .Resize: case .Resize, .Resize_Non_Zeroed:
old_data := ([^]byte)(old_memory) old_data := ([^]byte)(old_memory)
switch { switch {
+5 -1
View File
@@ -10,7 +10,7 @@ nil_allocator_proc :: proc(allocator_data: rawptr, mode: Allocator_Mode,
return nil, .None return nil, .None
case .Free_All: case .Free_All:
return nil, .Mode_Not_Implemented return nil, .Mode_Not_Implemented
case .Resize: case .Resize, .Resize_Non_Zeroed:
if size == 0 { if size == 0 {
return nil, .None return nil, .None
} }
@@ -55,6 +55,10 @@ panic_allocator_proc :: proc(allocator_data: rawptr, mode: Allocator_Mode,
if size > 0 { if size > 0 {
panic("panic allocator, .Resize called", loc=loc) panic("panic allocator, .Resize called", loc=loc)
} }
case .Resize_Non_Zeroed:
if size > 0 {
panic("panic allocator, .Alloc_Non_Zeroed called", loc=loc)
}
case .Free: case .Free:
if old_memory != nil { if old_memory != nil {
panic("panic allocator, .Free called", loc=loc) panic("panic allocator, .Free called", loc=loc)
+1 -1
View File
@@ -19,7 +19,7 @@ when ODIN_DEFAULT_TO_NIL_ALLOCATOR {
case .Free_All: case .Free_All:
return nil, .Mode_Not_Implemented return nil, .Mode_Not_Implemented
case .Resize: case .Resize, .Resize_Non_Zeroed:
data, err = _windows_default_resize(old_memory, old_size, size, alignment) data, err = _windows_default_resize(old_memory, old_size, size, alignment)
case .Query_Features: case .Query_Features:
+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: ")
+23 -4
View File
@@ -187,7 +187,7 @@ mem_free_all :: #force_inline proc(allocator := context.allocator, loc := #calle
return return
} }
mem_resize :: proc(ptr: rawptr, old_size, new_size: int, alignment: int = DEFAULT_ALIGNMENT, allocator := context.allocator, loc := #caller_location) -> (data: []byte, err: Allocator_Error) { _mem_resize :: #force_inline proc(ptr: rawptr, old_size, new_size: int, alignment: int = DEFAULT_ALIGNMENT, allocator := context.allocator, should_zero: bool, loc := #caller_location) -> (data: []byte, err: Allocator_Error) {
if allocator.procedure == nil { if allocator.procedure == nil {
return nil, nil return nil, nil
} }
@@ -198,15 +198,27 @@ mem_resize :: proc(ptr: rawptr, old_size, new_size: int, alignment: int = DEFAUL
} }
return return
} else if ptr == nil { } else if ptr == nil {
return allocator.procedure(allocator.data, .Alloc, new_size, alignment, nil, 0, loc) if should_zero {
return allocator.procedure(allocator.data, .Alloc, new_size, alignment, nil, 0, loc)
} else {
return allocator.procedure(allocator.data, .Alloc_Non_Zeroed, new_size, alignment, nil, 0, loc)
}
} else if old_size == new_size && uintptr(ptr) % uintptr(alignment) == 0 { } else if old_size == new_size && uintptr(ptr) % uintptr(alignment) == 0 {
data = ([^]byte)(ptr)[:old_size] data = ([^]byte)(ptr)[:old_size]
return return
} }
data, err = allocator.procedure(allocator.data, .Resize, new_size, alignment, ptr, old_size, loc) if should_zero {
data, err = allocator.procedure(allocator.data, .Resize, new_size, alignment, ptr, old_size, loc)
} else {
data, err = allocator.procedure(allocator.data, .Resize_Non_Zeroed, new_size, alignment, ptr, old_size, loc)
}
if err == .Mode_Not_Implemented { if err == .Mode_Not_Implemented {
data, err = allocator.procedure(allocator.data, .Alloc, new_size, alignment, nil, 0, loc) if should_zero {
data, err = allocator.procedure(allocator.data, .Alloc, new_size, alignment, nil, 0, loc)
} else {
data, err = allocator.procedure(allocator.data, .Alloc_Non_Zeroed, new_size, alignment, nil, 0, loc)
}
if err != nil { if err != nil {
return return
} }
@@ -216,6 +228,13 @@ mem_resize :: proc(ptr: rawptr, old_size, new_size: int, alignment: int = DEFAUL
return return
} }
mem_resize :: proc(ptr: rawptr, old_size, new_size: int, alignment: int = DEFAULT_ALIGNMENT, allocator := context.allocator, loc := #caller_location) -> (data: []byte, err: Allocator_Error) {
return _mem_resize(ptr, old_size, new_size, alignment, allocator, true, loc)
}
non_zero_mem_resize :: proc(ptr: rawptr, old_size, new_size: int, alignment: int = DEFAULT_ALIGNMENT, allocator := context.allocator, loc := #caller_location) -> (data: []byte, err: Allocator_Error) {
return _mem_resize(ptr, old_size, new_size, alignment, allocator, false, loc)
}
memory_equal :: proc "contextless" (x, y: rawptr, n: int) -> bool { memory_equal :: proc "contextless" (x, y: rawptr, n: int) -> bool {
switch { switch {
case n == 0: return true case n == 0: return true
+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
+1 -1
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) ---
+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 ---
+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]
+2 -1
View File
@@ -1792,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)
+2 -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 ---
@@ -24,7 +24,7 @@ foreign advapi32 {
} }
// 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 ---
+1 -1
View File
@@ -124,7 +124,7 @@ HIDP_REPORT_TYPE :: enum c.int {
HIDP_STATUS_SUCCESS : NTSTATUS : 0x110000 HIDP_STATUS_SUCCESS : NTSTATUS : 0x110000
foreign import hid "system:hid.lib" foreign import hid "system:hid.lib"
@(default_calling_convention="stdcall") @(default_calling_convention="system")
foreign hid { foreign hid {
HidP_GetCaps :: proc(PreparsedData: PHIDP_PREPARSED_DATA, Capabilities: PHIDP_CAPS) -> NTSTATUS --- 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_GetButtonCaps :: proc(ReportType: HIDP_REPORT_TYPE, ButtonCaps: PHIDP_BUTTON_CAPS, ButtonCapsLength: PUSHORT, PreparsedData: PHIDP_PREPARSED_DATA) -> 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) ---
+167 -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
@@ -692,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,
@@ -2325,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,
@@ -2495,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,
@@ -2559,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,
@@ -2614,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,
@@ -2720,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
@@ -3427,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 {
@@ -3436,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 {
@@ -3446,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 {
@@ -3463,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 {
@@ -3472,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 {
@@ -3484,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 {
@@ -3507,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 {
@@ -3519,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 {
@@ -3534,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 {
@@ -3546,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 {
@@ -3564,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 {
@@ -3576,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 {
@@ -3589,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 {
@@ -3604,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 {
@@ -3619,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 {
@@ -3629,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 {
@@ -3660,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 {
@@ -3670,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 {
@@ -3683,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 {
@@ -3693,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 {
@@ -3717,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 {
@@ -3730,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 {
@@ -3743,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 {
@@ -3788,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 ---
+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 ---
+2 -2
View File
@@ -90,7 +90,7 @@ Thread_Os_Specific :: struct {
} }
thread_create :: proc(procedure: Thread_Proc) -> ^Thread { thread_create :: proc(procedure: Thread_Proc) -> ^Thread {
__windows_thread_entry_proc :: proc "stdcall" (t_: rawptr) -> win32.DWORD { __windows_thread_entry_proc :: proc "system" (t_: rawptr) -> win32.DWORD {
t := (^Thread)(t_) t := (^Thread)(t_)
context = t.init_context.? or_else runtime.default_context() context = t.init_context.? or_else runtime.default_context()
@@ -172,7 +172,7 @@ global_current_t: ^T
run_internal_test :: proc(t: ^T, it: Internal_Test) { run_internal_test :: proc(t: ^T, it: Internal_Test) {
thread := thread_create(proc(thread: ^Thread) { thread := thread_create(proc(thread: ^Thread) {
exception_handler_proc :: proc "stdcall" (ExceptionInfo: ^win32.EXCEPTION_POINTERS) -> win32.LONG { exception_handler_proc :: proc "system" (ExceptionInfo: ^win32.EXCEPTION_POINTERS) -> win32.LONG {
switch ExceptionInfo.ExceptionRecord.ExceptionCode { switch ExceptionInfo.ExceptionRecord.ExceptionCode {
case case
win32.EXCEPTION_DATATYPE_MISALIGNMENT, win32.EXCEPTION_DATATYPE_MISALIGNMENT,
+1 -1
View File
@@ -21,7 +21,7 @@ _thread_priority_map := [Thread_Priority]i32{
_create :: proc(procedure: Thread_Proc, priority: Thread_Priority) -> ^Thread { _create :: proc(procedure: Thread_Proc, priority: Thread_Priority) -> ^Thread {
win32_thread_id: win32.DWORD win32_thread_id: win32.DWORD
__windows_thread_entry_proc :: proc "stdcall" (t_: rawptr) -> win32.DWORD { __windows_thread_entry_proc :: proc "system" (t_: rawptr) -> win32.DWORD {
t := (^Thread)(t_) t := (^Thread)(t_)
t.id = sync.current_thread_id() t.id = sync.current_thread_id()
-27
View File
@@ -1,27 +0,0 @@
{ pkgs ? import <nixpkgs> { } }:
let
odin-unwrapped = pkgs.llvmPackages_11.stdenv.mkDerivation (rec {
name = "odin-unwrapped";
src = ./.;
dontConfigure = true;
nativeBuildInputs = [ pkgs.git ];
buildPhase = ''
make debug SHELL=${pkgs.llvmPackages_11.stdenv.shell}
'';
installPhase = ''
mkdir -p $out/bin
cp odin $out/bin/odin
cp -r core $out/bin/core
'';
});
path = builtins.map (path: path + "/bin") (with pkgs.llvmPackages_11; [
bintools
llvm
clang
lld
]);
in
pkgs.writeScriptBin "odin" ''
#!${pkgs.llvmPackages_11.stdenv.shell}
PATH="${(builtins.concatStringsSep ":" path)}" exec ${odin-unwrapped}/bin/odin $@
''
+3
View File
@@ -0,0 +1,3 @@
# `examples/all` for Documentation
**NOTE:** This exists purely for the documentation generator located at <https://pkg.odin-lang.org/>
+40
View File
@@ -81,3 +81,43 @@ _ :: nvg_gl
_ :: fontstash _ :: fontstash
_ :: xlib _ :: xlib
// NOTE: needed for doc generator
import NS "vendor:darwin/Foundation"
import MTL "vendor:darwin/Metal"
import MTK "vendor:darwin/MetalKit"
import CA "vendor:darwin/QuartzCore"
_ :: NS
_ :: MTL
_ :: MTK
_ :: CA
import D3D11 "vendor:directx/d3d11"
import D3D12 "vendor:directx/d3d12"
import DXGI "vendor:directx/dxgi"
_ :: D3D11
_ :: D3D12
_ :: DXGI
import cm "vendor:commonmark"
_ :: cm
import stb_easy_font "vendor:stb/easy_font"
import stbi "vendor:stb/image"
import stbrp "vendor:stb/rect_pack"
import stbtt "vendor:stb/truetype"
import stb_vorbis "vendor:stb/vorbis"
_ :: stb_easy_font
_ :: stbi
_ :: stbrp
_ :: stbtt
_ :: stb_vorbis
-5
View File
@@ -1,5 +0,0 @@
//+build windows, linux
package all
import cm "vendor:commonmark"
_ :: cm
-12
View File
@@ -1,12 +0,0 @@
//+build darwin
package all
import NS "vendor:darwin/Foundation"
import MTL "vendor:darwin/Metal"
import MTK "vendor:darwin/MetalKit"
import CA "vendor:darwin/QuartzCore"
_ :: NS
_ :: MTL
_ :: MTK
_ :: CA
-10
View File
@@ -1,10 +0,0 @@
//+build windows
package all
import D3D11 "vendor:directx/d3d11"
import D3D12 "vendor:directx/d3d12"
import DXGI "vendor:directx/dxgi"
_ :: D3D11
_ :: D3D12
_ :: DXGI
-15
View File
@@ -1,15 +0,0 @@
//+build windows, linux
package all
import stb_easy_font "vendor:stb/easy_font"
import stbi "vendor:stb/image"
import stbrp "vendor:stb/rect_pack"
import stbtt "vendor:stb/truetype"
import stb_vorbis "vendor:stb/vorbis"
_ :: stb_easy_font
_ :: stbi
_ :: stbrp
_ :: stbtt
_ :: stb_vorbis
-5
View File
@@ -1,5 +0,0 @@
//+build windows, linux
package all
import zlib "vendor:zlib"
_ :: zlib
+11
View File
@@ -0,0 +1,11 @@
{ pkgs ? import <nixpkgs> {} }:
pkgs.mkShell {
name = "odin";
nativeBuildInputs = with pkgs; [
git
clang_17
llvmPackages_17.llvm
llvmPackages_17.bintools
];
shellHook="CXX=clang++";
}
+62 -8
View File
@@ -824,6 +824,17 @@ gb_internal void report_os_info() {
{"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}}},
{"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}}},
@@ -836,6 +847,42 @@ gb_internal void report_os_info() {
{"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}}},
{"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}}},
{"22A380", {13, 0, 0}, "macOS", {"Ventura", {22, 1, 0}}},
{"22A400", {13, 0, 1}, "macOS", {"Ventura", {22, 1, 0}}},
{"22C65", {13, 1, 0}, "macOS", {"Ventura", {22, 2, 0}}},
{"22D49", {13, 2, 0}, "macOS", {"Ventura", {22, 3, 0}}},
{"22D68", {13, 2, 1}, "macOS", {"Ventura", {22, 3, 0}}},
{"22E252", {13, 3, 0}, "macOS", {"Ventura", {22, 4, 0}}},
{"22E261", {13, 3, 1}, "macOS", {"Ventura", {22, 4, 0}}},
{"22F66", {13, 4, 0}, "macOS", {"Ventura", {22, 5, 0}}},
{"22F82", {13, 4, 1}, "macOS", {"Ventura", {22, 5, 0}}},
{"22E772610a", {13, 4, 1}, "macOS", {"Ventura", {22, 5, 0}}},
{"22F770820d", {13, 4, 1}, "macOS", {"Ventura", {22, 5, 0}}},
{"22G74", {13, 5, 0}, "macOS", {"Ventura", {22, 6, 0}}},
{"22G90", {13, 5, 1}, "macOS", {"Ventura", {22, 6, 0}}},
{"22G91", {13, 5, 2}, "macOS", {"Ventura", {22, 6, 0}}},
{"22G120", {13, 6, 0}, "macOS", {"Ventura", {22, 6, 0}}},
{"22G313", {13, 6, 1}, "macOS", {"Ventura", {22, 6, 0}}},
{"22G320", {13, 6, 2}, "macOS", {"Ventura", {22, 6, 0}}},
{"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}}},
}; };
@@ -867,38 +914,45 @@ gb_internal void report_os_info() {
// Scan table for match on BUILD // Scan table for match on BUILD
int macos_release_count = sizeof(macos_release_map) / sizeof(macos_release_map[0]); int macos_release_count = sizeof(macos_release_map) / sizeof(macos_release_map[0]);
Darwin_To_Release match = {}; Darwin_To_Release build_match = {};
Darwin_To_Release kernel_match = {};
for (int build = 0; build < macos_release_count; build++) { for (int build = 0; build < macos_release_count; build++) {
Darwin_To_Release rel = macos_release_map[build]; Darwin_To_Release rel = macos_release_map[build];
// Do we have an exact match on the BUILD? // Do we have an exact match on the BUILD?
if (gb_strcmp(rel.build, (const char *)build_buffer) == 0) { if (gb_strcmp(rel.build, (const char *)build_buffer) == 0) {
match = rel; build_match = rel;
break; break;
} }
// Do we have an exact Darwin match? // Do we have an exact Darwin match?
if (rel.darwin[0] == major && rel.darwin[1] == minor && rel.darwin[2] == patch) { if (rel.darwin[0] == major && rel.darwin[1] == minor && rel.darwin[2] == patch) {
match = rel; kernel_match = rel;
break;
} }
// Major kernel version needs to match exactly, // Major kernel version needs to match exactly,
if (rel.darwin[0] == major) { if (rel.darwin[0] == major) {
// No major version match yet. // No major version match yet.
if (!match.os_name) { if (!kernel_match.os_name) {
match = rel; kernel_match = rel;
} }
if (minor >= rel.darwin[1]) { if (minor >= rel.darwin[1]) {
match = rel; kernel_match = rel;
if (patch >= rel.darwin[2]) { if (patch >= rel.darwin[2]) {
match = rel; kernel_match = rel;
} }
} }
} }
} }
Darwin_To_Release match = {};
if(!build_match.build) {
match = kernel_match;
} else {
match = build_match;
}
if (match.os_name) { if (match.os_name) {
gb_printf("%s %s %d", match.os_name, match.release.name, match.release.version[0]); gb_printf("%s %s %d", match.os_name, match.release.name, match.release.version[0]);
if (match.release.version[1] > 0 || match.release.version[2] > 0) { if (match.release.version[1] > 0 || match.release.version[2] > 0) {
+11 -2
View File
@@ -582,7 +582,13 @@ gb_global TargetMetrics target_freestanding_amd64_sysv = {
TargetABI_SysV, TargetABI_SysV,
}; };
gb_global TargetMetrics target_freestanding_arm64 = {
TargetOs_freestanding,
TargetArch_arm64,
8, 8, 8, 16,
str_lit("aarch64-none-elf"),
str_lit("e-m:o-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64"),
};
struct NamedTargetMetrics { struct NamedTargetMetrics {
String name; String name;
@@ -617,6 +623,7 @@ gb_global NamedTargetMetrics named_targets[] = {
{ str_lit("wasi_wasm64p32"), &target_wasi_wasm64p32 }, { str_lit("wasi_wasm64p32"), &target_wasi_wasm64p32 },
{ str_lit("freestanding_amd64_sysv"), &target_freestanding_amd64_sysv }, { str_lit("freestanding_amd64_sysv"), &target_freestanding_amd64_sysv },
{ str_lit("freestanding_arm64"), &target_freestanding_arm64 },
}; };
gb_global NamedTargetMetrics *selected_target_metrics; gb_global NamedTargetMetrics *selected_target_metrics;
@@ -1493,7 +1500,7 @@ gb_internal void enable_target_feature(TokenPos pos, String const &target_featur
} }
gb_internal char const *target_features_set_to_cstring(gbAllocator allocator, bool with_quotes) { gb_internal char const *target_features_set_to_cstring(gbAllocator allocator, bool with_quotes, bool with_plus) {
isize len = 0; isize len = 0;
isize i = 0; isize i = 0;
for (String const &feature : build_context.target_features_set) { for (String const &feature : build_context.target_features_set) {
@@ -1502,6 +1509,7 @@ gb_internal char const *target_features_set_to_cstring(gbAllocator allocator, bo
} }
len += feature.len; len += feature.len;
if (with_quotes) len += 2; if (with_quotes) len += 2;
if (with_plus) len += 1;
i += 1; i += 1;
} }
char *features = gb_alloc_array(allocator, char, len+1); char *features = gb_alloc_array(allocator, char, len+1);
@@ -1513,6 +1521,7 @@ gb_internal char const *target_features_set_to_cstring(gbAllocator allocator, bo
} }
if (with_quotes) features[len++] = '"'; if (with_quotes) features[len++] = '"';
if (with_plus) features[len++] = '+';
gb_memmove(features + len, feature.text, feature.len); gb_memmove(features + len, feature.text, feature.len);
len += feature.len; len += feature.len;
if (with_quotes) features[len++] = '"'; if (with_quotes) features[len++] = '"';
+83
View File
@@ -909,6 +909,89 @@ gb_internal void check_proc_decl(CheckerContext *ctx, Entity *e, DeclInfo *d) {
e->Procedure.entry_point_only = ac.entry_point_only; e->Procedure.entry_point_only = ac.entry_point_only;
e->Procedure.is_export = ac.is_export; e->Procedure.is_export = ac.is_export;
bool has_instrumentation = false;
if (pl->body == nullptr) {
has_instrumentation = false;
if (ac.no_instrumentation != Instrumentation_Default) {
error(e->token, "@(no_instrumentation) is not allowed on foreign procedures");
}
} else {
AstFile *file = e->token.pos.file_id ? global_files[e->token.pos.file_id] : nullptr;
if (file) {
has_instrumentation = (file->flags & AstFile_NoInstrumentation) == 0;
}
switch (ac.no_instrumentation) {
case Instrumentation_Enabled: has_instrumentation = true; break;
case Instrumentation_Default: break;
case Instrumentation_Disabled: has_instrumentation = false; break;
}
}
auto const is_valid_instrumentation_call = [](Type *type) -> bool {
if (type == nullptr || type->kind != Type_Proc) {
return false;
}
if (type->Proc.calling_convention != ProcCC_Contextless) {
return false;
}
if (type->Proc.result_count != 0) {
return false;
}
if (type->Proc.param_count != 3) {
return false;
}
Type *p0 = type->Proc.params->Tuple.variables[0]->type;
Type *p1 = type->Proc.params->Tuple.variables[1]->type;
Type *p3 = type->Proc.params->Tuple.variables[2]->type;
return is_type_rawptr(p0) && is_type_rawptr(p1) && are_types_identical(p3, t_source_code_location);
};
static char const *instrumentation_proc_type_str = "proc \"contextless\" (proc_address: rawptr, call_site_return_address: rawptr, loc: runtime.Source_Code_Location)";
if (ac.instrumentation_enter && ac.instrumentation_exit) {
error(e->token, "A procedure cannot be marked with both @(instrumentation_enter) and @(instrumentation_exit)");
has_instrumentation = false;
e->flags |= EntityFlag_Require;
} else if (ac.instrumentation_enter) {
if (!is_valid_instrumentation_call(e->type)) {
init_core_source_code_location(ctx->checker);
gbString s = type_to_string(e->type);
error(e->token, "@(instrumentation_enter) procedures must have the type '%s', got %s", instrumentation_proc_type_str, s);
gb_string_free(s);
}
MUTEX_GUARD(&ctx->info->instrumentation_mutex);
if (ctx->info->instrumentation_enter_entity != nullptr) {
error(e->token, "@(instrumentation_enter) has already been set");
} else {
ctx->info->instrumentation_enter_entity = e;
}
has_instrumentation = false;
e->flags |= EntityFlag_Require;
} else if (ac.instrumentation_exit) {
init_core_source_code_location(ctx->checker);
if (!is_valid_instrumentation_call(e->type)) {
gbString s = type_to_string(e->type);
error(e->token, "@(instrumentation_exit) procedures must have the type '%s', got %s", instrumentation_proc_type_str, s);
gb_string_free(s);
}
MUTEX_GUARD(&ctx->info->instrumentation_mutex);
if (ctx->info->instrumentation_exit_entity != nullptr) {
error(e->token, "@(instrumentation_exit) has already been set");
} else {
ctx->info->instrumentation_exit_entity = e;
}
has_instrumentation = false;
e->flags |= EntityFlag_Require;
}
e->Procedure.has_instrumentation = has_instrumentation;
e->deprecated_message = ac.deprecated_message; e->deprecated_message = ac.deprecated_message;
e->warning_message = ac.warning_message; e->warning_message = ac.warning_message;
ac.link_name = handle_link_name(ctx, e->token, ac.link_name, ac.link_prefix); ac.link_name = handle_link_name(ctx, e->token, ac.link_name, ac.link_prefix);
+44
View File
@@ -2581,6 +2581,9 @@ gb_internal void generate_minimum_dependency_set(Checker *c, Entity *start) {
str_lit("multi_pointer_slice_expr_error"), str_lit("multi_pointer_slice_expr_error"),
); );
add_dependency_to_set(c, c->info.instrumentation_enter_entity);
add_dependency_to_set(c, c->info.instrumentation_exit_entity);
generate_minimum_dependency_set_internal(c, start); generate_minimum_dependency_set_internal(c, start);
@@ -3414,8 +3417,38 @@ gb_internal DECL_ATTRIBUTE_PROC(proc_decl_attribute) {
} }
return true; return true;
} else if (name == "entry_point_only") { } else if (name == "entry_point_only") {
if (value != nullptr) {
error(value, "'%.*s' expects no parameter", LIT(name));
}
ac->entry_point_only = true; ac->entry_point_only = true;
return true; return true;
} else if (name == "no_instrumentation") {
ExactValue ev = check_decl_attribute_value(c, value);
if (ev.kind == ExactValue_Invalid) {
ac->no_instrumentation = Instrumentation_Disabled;
} else if (ev.kind == ExactValue_Bool) {
if (ev.value_bool) {
ac->no_instrumentation = Instrumentation_Disabled;
} else {
ac->no_instrumentation = Instrumentation_Enabled;
}
} else {
error(value, "Expected either a boolean or no parameter for '%.*s'", LIT(name));
return false;
}
return true;
} else if (name == "instrumentation_enter") {
if (value != nullptr) {
error(value, "'%.*s' expects no parameter", LIT(name));
}
ac->instrumentation_enter = true;
return true;
} else if (name == "instrumentation_exit") {
if (value != nullptr) {
error(value, "'%.*s' expects no parameter", LIT(name));
}
ac->instrumentation_exit = true;
return true;
} }
return false; return false;
} }
@@ -6216,6 +6249,17 @@ gb_internal void check_parsed_files(Checker *c) {
GB_ASSERT(c->info.entity_queue.count.load(std::memory_order_relaxed) == 0); GB_ASSERT(c->info.entity_queue.count.load(std::memory_order_relaxed) == 0);
GB_ASSERT(c->info.definition_queue.count.load(std::memory_order_relaxed) == 0); GB_ASSERT(c->info.definition_queue.count.load(std::memory_order_relaxed) == 0);
TIME_SECTION("check instrumentation calls");
{
if ((c->info.instrumentation_enter_entity != nullptr) ^
(c->info.instrumentation_exit_entity != nullptr)) {
Entity *e = c->info.instrumentation_enter_entity;
if (!e) e = c->info.instrumentation_exit_entity;
error(e->token, "Both @(instrumentation_enter) and @(instrumentation_exit) must be defined");
}
}
TIME_SECTION("add untyped expression values"); TIME_SECTION("add untyped expression values");
// Add untyped expression values // Add untyped expression values
for (UntypedExprInfo u = {}; mpsc_dequeue(&c->global_untyped_queue, &u); /**/) { for (UntypedExprInfo u = {}; mpsc_dequeue(&c->global_untyped_queue, &u); /**/) {
+24 -11
View File
@@ -103,6 +103,12 @@ struct DeferredProcedure {
}; };
enum InstrumentationFlag : i32 {
Instrumentation_Enabled = -1,
Instrumentation_Default = 0,
Instrumentation_Disabled = +1,
};
struct AttributeContext { struct AttributeContext {
String link_name; String link_name;
String link_prefix; String link_prefix;
@@ -113,20 +119,23 @@ struct AttributeContext {
String deprecated_message; String deprecated_message;
String warning_message; String warning_message;
DeferredProcedure deferred_procedure; DeferredProcedure deferred_procedure;
bool is_export : 1; bool is_export : 1;
bool is_static : 1; bool is_static : 1;
bool require_results : 1; bool require_results : 1;
bool require_declaration : 1; bool require_declaration : 1;
bool has_disabled_proc : 1; bool has_disabled_proc : 1;
bool disabled_proc : 1; bool disabled_proc : 1;
bool test : 1; bool test : 1;
bool init : 1; bool init : 1;
bool fini : 1; bool fini : 1;
bool set_cold : 1; bool set_cold : 1;
bool entry_point_only : 1; bool entry_point_only : 1;
bool instrumentation_enter : 1;
bool instrumentation_exit : 1;
u32 optimization_mode; // ProcedureOptimizationMode u32 optimization_mode; // ProcedureOptimizationMode
i64 foreign_import_priority_index; i64 foreign_import_priority_index;
String extra_linker_flags; String extra_linker_flags;
InstrumentationFlag no_instrumentation;
String objc_class; String objc_class;
String objc_name; String objc_name;
@@ -403,6 +412,10 @@ struct CheckerInfo {
BlockingMutex all_procedures_mutex; BlockingMutex all_procedures_mutex;
Array<ProcInfo *> all_procedures; Array<ProcInfo *> all_procedures;
BlockingMutex instrumentation_mutex;
Entity *instrumentation_enter_entity;
Entity *instrumentation_exit_entity;
}; };
struct CheckerContext { struct CheckerContext {
+1
View File
@@ -251,6 +251,7 @@ struct Entity {
bool generated_from_polymorphic : 1; bool generated_from_polymorphic : 1;
bool target_feature_disabled : 1; bool target_feature_disabled : 1;
bool entry_point_only : 1; bool entry_point_only : 1;
bool has_instrumentation : 1;
String target_feature; String target_feature;
} Procedure; } Procedure;
struct { struct {
+20 -4
View File
@@ -174,7 +174,7 @@ gb_internal ExactValue exact_value_integer_from_string(String const &string) {
gb_internal f64 float_from_string(String const &string) { gb_internal f64 float_from_string(String const &string, bool *success = nullptr) {
if (string.len < 128) { if (string.len < 128) {
char buf[128] = {}; char buf[128] = {};
isize n = 0; isize n = 0;
@@ -187,7 +187,13 @@ gb_internal f64 float_from_string(String const &string) {
buf[n++] = cast(char)c; buf[n++] = cast(char)c;
} }
buf[n] = 0; buf[n] = 0;
return atof(buf);
char *end_ptr;
f64 f = strtod(buf, &end_ptr);
if (success != nullptr) {
*success = *end_ptr == '\0';
}
return f;
} else { } else {
TEMPORARY_ALLOCATOR_GUARD(); TEMPORARY_ALLOCATOR_GUARD();
char *buf = gb_alloc_array(temporary_allocator(), char, string.len+1); char *buf = gb_alloc_array(temporary_allocator(), char, string.len+1);
@@ -201,7 +207,13 @@ gb_internal f64 float_from_string(String const &string) {
buf[n++] = cast(char)c; buf[n++] = cast(char)c;
} }
buf[n] = 0; buf[n] = 0;
return atof(buf);
char *end_ptr;
f64 f = strtod(buf, &end_ptr);
if (success != nullptr) {
*success = *end_ptr == '\0';
}
return f;
} }
/* /*
isize i = 0; isize i = 0;
@@ -313,7 +325,11 @@ gb_internal ExactValue exact_value_float_from_string(String string) {
return exact_value_integer_from_string(string); return exact_value_integer_from_string(string);
} }
f64 f = float_from_string(string); bool success;
f64 f = float_from_string(string, &success);
if (!success) {
return {ExactValue_Invalid};
}
return exact_value_float(f); return exact_value_float(f);
} }
+1 -1
View File
@@ -448,7 +448,7 @@ typedef i32 b32; // NOTE(bill): Prefer this!!!
#define gb_inline __forceinline #define gb_inline __forceinline
#endif #endif
#else #else
#define gb_inline __attribute__ ((__always_inline__)) #define gb_inline inline __attribute__ ((__always_inline__))
#endif #endif
#endif #endif
+11
View File
@@ -484,6 +484,17 @@ gb_internal i32 linker_stage(LinkerData *gen) {
defer (gb_string_free(platform_lib_str)); defer (gb_string_free(platform_lib_str));
if (build_context.metrics.os == TargetOs_darwin) { if (build_context.metrics.os == TargetOs_darwin) {
platform_lib_str = gb_string_appendc(platform_lib_str, "-Wl,-syslibroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -L/usr/local/lib"); platform_lib_str = gb_string_appendc(platform_lib_str, "-Wl,-syslibroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -L/usr/local/lib");
// Homebrew's default library path, checking if it exists to avoid linking warnings.
if (gb_file_exists("/opt/homebrew/lib")) {
platform_lib_str = gb_string_appendc(platform_lib_str, " -L/opt/homebrew/lib");
}
// MacPort's default library path, checking if it exists to avoid linking warnings.
if (gb_file_exists("/opt/local/lib")) {
platform_lib_str = gb_string_appendc(platform_lib_str, " -L/opt/local/lib");
}
#if defined(GB_SYSTEM_OSX) #if defined(GB_SYSTEM_OSX)
if(!build_context.no_crt) { if(!build_context.no_crt) {
platform_lib_str = gb_string_appendc(platform_lib_str, " -lm "); platform_lib_str = gb_string_appendc(platform_lib_str, " -lm ");
+41 -4
View File
@@ -1497,8 +1497,6 @@ gb_internal WORKER_TASK_PROC(lb_llvm_module_pass_worker_proc) {
auto passes = array_make<char const *>(heap_allocator(), 0, 64); auto passes = array_make<char const *>(heap_allocator(), 0, 64);
defer (array_free(&passes)); defer (array_free(&passes));
LLVMPassBuilderOptionsRef pb_options = LLVMCreatePassBuilderOptions(); LLVMPassBuilderOptionsRef pb_options = LLVMCreatePassBuilderOptions();
defer (LLVMDisposePassBuilderOptions(pb_options)); defer (LLVMDisposePassBuilderOptions(pb_options));
@@ -2505,7 +2503,7 @@ gb_internal bool lb_generate_code(lbGenerator *gen) {
LLVMCodeModel code_mode = LLVMCodeModelDefault; LLVMCodeModel code_mode = LLVMCodeModelDefault;
if (is_arch_wasm()) { if (is_arch_wasm()) {
code_mode = LLVMCodeModelJITDefault; code_mode = LLVMCodeModelJITDefault;
} else if (build_context.metrics.os == TargetOs_freestanding) { } else if (is_arch_x86() && build_context.metrics.os == TargetOs_freestanding) {
code_mode = LLVMCodeModelKernel; code_mode = LLVMCodeModelKernel;
} }
@@ -2531,7 +2529,46 @@ gb_internal bool lb_generate_code(lbGenerator *gen) {
*/ */
if (build_context.target_features_set.entries.count != 0) { if (build_context.target_features_set.entries.count != 0) {
llvm_features = target_features_set_to_cstring(permanent_allocator(), false); // Prefix all of the features with a `+`, because we are
// enabling additional features.
char const *additional_features = target_features_set_to_cstring(permanent_allocator(), false, true);
String f_string = make_string_c(llvm_features);
String a_string = make_string_c(additional_features);
isize f_len = f_string.len;
if (f_len == 0) {
// The common case is that llvm_features is empty, so
// the target_features_set additions can be used as is.
llvm_features = additional_features;
} else {
// The user probably specified `-microarch:native`, so
// llvm_features is populated by LLVM's idea of what
// the host CPU supports.
//
// As far as I can tell, (which is barely better than
// wild guessing), a bitset is formed by parsing the
// string left to right.
//
// So, llvm_features + ',' + additonal_features, will
// makes the target_features_set override llvm_features.
char *tmp = gb_alloc_array(permanent_allocator(), char, f_len + 1 + a_string.len + 1);
isize len = 0;
// tmp = f_string
gb_memmove(tmp, f_string.text, f_string.len);
len += f_string.len;
// tmp += ','
tmp[len++] = ',';
// tmp += a_string
gb_memmove(tmp + len, a_string.text, a_string.len);
len += a_string.len;
// tmp += NUL
tmp[len++] = 0;
llvm_features = tmp;
}
} }
// GB_ASSERT_MSG(LLVMTargetHasAsmBackend(target)); // GB_ASSERT_MSG(LLVMTargetHasAsmBackend(target));
+2
View File
@@ -563,7 +563,9 @@ gb_internal LLVMTypeRef OdinLLVMGetVectorElementType(LLVMTypeRef type);
gb_internal String lb_filepath_ll_for_module(lbModule *m); gb_internal String lb_filepath_ll_for_module(lbModule *m);
gb_internal LLVMTypeRef lb_type_internal_for_procedures_raw(lbModule *m, Type *type);
gb_internal lbValue lb_emit_source_code_location_as_global_ptr(lbProcedure *p, String const &procedure, TokenPos const &pos);
gb_internal LLVMTypeRef llvm_array_type(LLVMTypeRef ElementType, uint64_t ElementCount) { gb_internal LLVMTypeRef llvm_array_type(LLVMTypeRef ElementType, uint64_t ElementCount) {
#if LB_USE_NEW_PASS_SYSTEM #if LB_USE_NEW_PASS_SYSTEM
+13
View File
@@ -2348,6 +2348,15 @@ gb_internal LLVMAttributeRef lb_create_enum_attribute(LLVMContextRef ctx, char c
return LLVMCreateEnumAttribute(ctx, kind, value); return LLVMCreateEnumAttribute(ctx, kind, value);
} }
gb_internal LLVMAttributeRef lb_create_string_attribute(LLVMContextRef ctx, String const &key, String const &value) {
LLVMAttributeRef attr = LLVMCreateStringAttribute(
ctx,
cast(char const *)key.text, cast(unsigned)key.len,
cast(char const *)value.text, cast(unsigned)value.len);
return attr;
}
gb_internal void lb_add_proc_attribute_at_index(lbProcedure *p, isize index, char const *name, u64 value) { gb_internal void lb_add_proc_attribute_at_index(lbProcedure *p, isize index, char const *name, u64 value) {
LLVMAttributeRef attr = lb_create_enum_attribute(p->module->ctx, name, value); LLVMAttributeRef attr = lb_create_enum_attribute(p->module->ctx, name, value);
GB_ASSERT(attr != nullptr); GB_ASSERT(attr != nullptr);
@@ -2361,6 +2370,10 @@ gb_internal void lb_add_proc_attribute_at_index(lbProcedure *p, isize index, cha
gb_internal void lb_add_attribute_to_proc(lbModule *m, LLVMValueRef proc_value, char const *name, u64 value=0) { gb_internal void lb_add_attribute_to_proc(lbModule *m, LLVMValueRef proc_value, char const *name, u64 value=0) {
LLVMAddAttributeAtIndex(proc_value, LLVMAttributeIndex_FunctionIndex, lb_create_enum_attribute(m->ctx, name, value)); LLVMAddAttributeAtIndex(proc_value, LLVMAttributeIndex_FunctionIndex, lb_create_enum_attribute(m->ctx, name, value));
} }
gb_internal void lb_add_attribute_to_proc_with_string(lbModule *m, LLVMValueRef proc_value, String const &name, String const &value) {
LLVMAttributeRef attr = lb_create_string_attribute(m->ctx, name, value);
LLVMAddAttributeAtIndex(proc_value, LLVMAttributeIndex_FunctionIndex, attr);
}

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