mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-05 15:18:49 +00:00
Fix various foreign signatures
This commit is contained in:
@@ -275,7 +275,7 @@ foreign libc {
|
|||||||
// 7.21.7 Character input/output functions
|
// 7.21.7 Character input/output functions
|
||||||
fgetc :: proc(stream: ^FILE) -> int ---
|
fgetc :: proc(stream: ^FILE) -> int ---
|
||||||
fgets :: proc(s: [^]char, n: int, stream: ^FILE) -> [^]char ---
|
fgets :: proc(s: [^]char, n: int, stream: ^FILE) -> [^]char ---
|
||||||
fputc :: proc(s: cstring, stream: ^FILE) -> int ---
|
fputc :: proc(s: c.int, stream: ^FILE) -> int ---
|
||||||
getc :: proc(stream: ^FILE) -> int ---
|
getc :: proc(stream: ^FILE) -> int ---
|
||||||
getchar :: proc() -> int ---
|
getchar :: proc() -> int ---
|
||||||
putc :: proc(c: int, stream: ^FILE) -> int ---
|
putc :: proc(c: int, stream: ^FILE) -> int ---
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
package CoreFoundation
|
package CoreFoundation
|
||||||
|
|
||||||
|
import "core:c"
|
||||||
|
|
||||||
foreign import CoreFoundation "system:CoreFoundation.framework"
|
foreign import CoreFoundation "system:CoreFoundation.framework"
|
||||||
|
|
||||||
String :: distinct TypeRef // same as CFStringRef
|
String :: distinct TypeRef // same as CFStringRef
|
||||||
|
|
||||||
StringEncoding :: distinct u32
|
StringEncoding :: distinct c.long
|
||||||
|
|
||||||
StringBuiltInEncodings :: enum StringEncoding {
|
StringBuiltInEncodings :: enum StringEncoding {
|
||||||
MacRoman = 0,
|
MacRoman = 0,
|
||||||
@@ -171,7 +173,7 @@ foreign CoreFoundation {
|
|||||||
// Fetches a range of the characters from a string into a byte buffer after converting the characters to a specified encoding.
|
// Fetches a range of the characters from a string into a byte buffer after converting the characters to a specified encoding.
|
||||||
StringGetBytes :: proc(thestring: String, range: Range, encoding: StringEncoding, lossByte: u8, isExternalRepresentation: b8, buffer: [^]byte, maxBufLen: Index, usedBufLen: ^Index) -> Index ---
|
StringGetBytes :: proc(thestring: String, range: Range, encoding: StringEncoding, lossByte: u8, isExternalRepresentation: b8, buffer: [^]byte, maxBufLen: Index, usedBufLen: ^Index) -> Index ---
|
||||||
|
|
||||||
StringIsEncodingAvailable :: proc(encoding: StringEncoding) -> bool ---
|
StringIsEncodingAvailable :: proc(encoding: StringEncoding) -> b8 ---
|
||||||
|
|
||||||
@(link_name = "__CFStringMakeConstantString")
|
@(link_name = "__CFStringMakeConstantString")
|
||||||
StringMakeConstantString :: proc "c" (#const c: cstring) -> String ---
|
StringMakeConstantString :: proc "c" (#const c: cstring) -> String ---
|
||||||
|
|||||||
@@ -50,7 +50,6 @@ foreign lib {
|
|||||||
af: AF, // INET or INET6
|
af: AF, // INET or INET6
|
||||||
src: cstring,
|
src: cstring,
|
||||||
dst: rawptr, // either ^in_addr or ^in_addr6
|
dst: rawptr, // either ^in_addr or ^in_addr6
|
||||||
size: socklen_t, // size_of(dst^)
|
|
||||||
) -> pton_result ---
|
) -> pton_result ---
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -124,7 +124,7 @@ foreign lib {
|
|||||||
|
|
||||||
[[ More; https://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_attr_getscope.html ]]
|
[[ More; https://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_attr_getscope.html ]]
|
||||||
*/
|
*/
|
||||||
pthread_attr_setscope :: proc(attr: ^pthread_attr_t, contentionscope: ^Thread_Scope) -> Errno ---
|
pthread_attr_setscope :: proc(attr: ^pthread_attr_t, contentionscope: Thread_Scope) -> Errno ---
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Get the area of storage to be used for the created thread's stack.
|
Get the area of storage to be used for the created thread's stack.
|
||||||
@@ -400,7 +400,7 @@ when ODIN_OS == .Darwin {
|
|||||||
PTHREAD_SCOPE_PROCESS :: 2
|
PTHREAD_SCOPE_PROCESS :: 2
|
||||||
PTHREAD_SCOPE_SYSTEM :: 1
|
PTHREAD_SCOPE_SYSTEM :: 1
|
||||||
|
|
||||||
pthread_t :: distinct u64
|
pthread_t :: distinct rawptr
|
||||||
|
|
||||||
pthread_attr_t :: struct {
|
pthread_attr_t :: struct {
|
||||||
__sig: c.long,
|
__sig: c.long,
|
||||||
|
|||||||
@@ -92,7 +92,12 @@ foreign lib {
|
|||||||
|
|
||||||
[[ More; https://pubs.opengroup.org/onlinepubs/9699919799/functions/shm_open.html ]]
|
[[ More; https://pubs.opengroup.org/onlinepubs/9699919799/functions/shm_open.html ]]
|
||||||
*/
|
*/
|
||||||
shm_open :: proc(name: cstring, oflag: O_Flags, mode: mode_t) -> FD ---
|
when ODIN_OS == .Darwin {
|
||||||
|
// https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/shm_open.2.html
|
||||||
|
shm_open :: proc(name: cstring, oflag: O_Flags, #c_vararg args: ..any) -> FD ---
|
||||||
|
} else {
|
||||||
|
shm_open :: proc(name: cstring, oflag: O_Flags, mode: mode_t) -> FD ---
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Removes a shared memory object.
|
Removes a shared memory object.
|
||||||
|
|||||||
@@ -851,6 +851,12 @@ gb_internal bool signature_parameter_similar_enough(Type *x, Type *y) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Type *x_base = base_type(x);
|
||||||
|
Type *y_base = base_type(y);
|
||||||
|
if (x_base->kind == y_base->kind && x_base->kind == Type_Struct) {
|
||||||
|
return type_size_of(x_base) == type_size_of(y_base) && type_align_of(x_base) == type_align_of(y_base);
|
||||||
|
}
|
||||||
|
|
||||||
return are_types_identical(x, y);
|
return are_types_identical(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user