mirror of
https://github.com/odin-lang/Odin.git
synced 2026-06-14 06:13:45 +00:00
Minor corrections for core:sys/darwin
This commit is contained in:
@@ -7,6 +7,8 @@ foreign import "system:Foundation.framework"
|
||||
import "base:intrinsics"
|
||||
import "core:c"
|
||||
|
||||
SELECTOR :: intrinsics.objc_find_selector
|
||||
|
||||
IMP :: proc "c" (object: id, sel: SEL, #c_vararg args: ..any) -> id
|
||||
|
||||
@(default_calling_convention="c")
|
||||
@@ -163,4 +165,4 @@ objc_AssociationPolicy :: enum c.uintptr_t {
|
||||
Copy_Nonatomic = 3,
|
||||
Retain = 01401,
|
||||
Copy = 01403,
|
||||
}
|
||||
}
|
||||
@@ -17,6 +17,19 @@ Class_VTable_Info :: struct {
|
||||
protocol_vtable: rawptr,
|
||||
}
|
||||
|
||||
|
||||
Selector_Variant :: union {
|
||||
SEL, // Selector
|
||||
cstring, // Selector name
|
||||
}
|
||||
|
||||
Method_Info :: struct {
|
||||
method: rawptr,
|
||||
selector: Selector_Variant,
|
||||
type_code: string,
|
||||
}
|
||||
|
||||
|
||||
@(require_results)
|
||||
class_get_metaclass :: #force_inline proc "contextless" (cls: Class) -> Class {
|
||||
return (^Class)(cls)^
|
||||
@@ -27,6 +40,12 @@ object_get_vtable_info :: proc "contextless" (obj: id) -> ^Class_VTable_Info {
|
||||
return (^Class_VTable_Info)(object_getIndexedIvars(obj))
|
||||
}
|
||||
|
||||
@(require_results)
|
||||
object_get_protocol_vtable :: #force_inline proc "contextless" ($T: typeid, obj: id) -> ^T {
|
||||
info := object_get_vtable_info(obj)
|
||||
return (^T)(info.protocol_vtable)
|
||||
}
|
||||
|
||||
@(require_results)
|
||||
make_subclasser :: #force_inline proc(vtable: ^$T, impl: proc(cls: Class, vt: ^T)) -> Object_VTable_Info {
|
||||
return Object_VTable_Info{
|
||||
@@ -133,4 +152,18 @@ alloc_user_object :: proc "contextless" (cls: Class, _context: Maybe(runtime.Con
|
||||
obj_info._context = _context.?
|
||||
}
|
||||
return obj
|
||||
}
|
||||
}
|
||||
|
||||
@(require_results)
|
||||
super_msg_send :: #force_inline proc "contextless" (self: ^$T, $R: typeid, selector: SEL) -> R
|
||||
where intrinsics.type_is_subtype_of(T, intrinsics.objc_object) {
|
||||
|
||||
msg_sendSuper := (proc "c" (^objc_super, SEL) -> id)(objc_msgSendSuper)
|
||||
|
||||
super := objc_super{
|
||||
receiver = self,
|
||||
super_class = self->superclass() ,
|
||||
}
|
||||
|
||||
return R(msg_sendSuper(&super, selector))
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#+build darwin
|
||||
package darwin
|
||||
|
||||
import "core:sys/posix"
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#+build darwin
|
||||
package darwin
|
||||
|
||||
foreign import mach "system:System"
|
||||
@@ -5,6 +6,44 @@ foreign import mach "system:System"
|
||||
import "core:c"
|
||||
import "base:intrinsics"
|
||||
|
||||
HOST_INFO_MAX :: 1024
|
||||
HOST_BASIC_INFO :: 1
|
||||
HOST_SCHED_INFO :: 3
|
||||
HOST_RESOURCE_SIZES :: 4
|
||||
HOST_PRIORITY_INFO :: 5
|
||||
HOST_SEMAPHORE_TRAPS :: 7
|
||||
HOST_MACH_MSG_TRAP :: 8
|
||||
HOST_VM_PURGABLE :: 9
|
||||
HOST_DEBUG_INFO_INTERNAL :: 10
|
||||
HOST_CAN_HAS_DEBUGGER :: 11
|
||||
HOST_PREFERRED_USER_ARCH :: 12
|
||||
HOST_CAN_HAS_DEBUGGER_COUNT :: 1
|
||||
HOST_BASIC_INFO_COUNT :: 12
|
||||
HOST_SCHED_INFO_COUNT :: 2
|
||||
HOST_RESOURCE_SIZES_COUNT :: 5
|
||||
HOST_PRIORITY_INFO_COUNT :: 8
|
||||
HOST_LOAD_INFO :: 1
|
||||
HOST_VM_INFO :: 2
|
||||
HOST_CPU_LOAD_INFO :: 3
|
||||
HOST_VM_INFO64 :: 4
|
||||
HOST_EXTMOD_INFO64 :: 5
|
||||
HOST_EXPIRED_TASK_INFO :: 6
|
||||
HOST_LOAD_INFO_COUNT :: 6
|
||||
HOST_VM_PURGABLE_COUNT :: 68
|
||||
HOST_VM_INFO64_COUNT :: 38
|
||||
HOST_VM_INFO64_LATEST_COUNT :: 38
|
||||
HOST_VM_INFO64_REV1_COUNT :: 38
|
||||
HOST_VM_INFO64_REV0_COUNT :: 24
|
||||
HOST_EXTMOD_INFO64_COUNT :: 12
|
||||
HOST_EXTMOD_INFO64_LATEST_COUNT :: 12
|
||||
HOST_VM_INFO_COUNT :: 15
|
||||
HOST_VM_INFO_LATEST_COUNT :: 15
|
||||
HOST_VM_INFO_REV2_COUNT :: 15
|
||||
HOST_VM_INFO_REV1_COUNT :: 14
|
||||
HOST_VM_INFO_REV0_COUNT :: 12
|
||||
HOST_CPU_LOAD_INFO_COUNT :: 4
|
||||
HOST_PREFERRED_USER_ARCH_COUNT :: 2
|
||||
|
||||
mach_port_t :: distinct c.uint
|
||||
task_t :: mach_port_t
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#+build darwin
|
||||
package darwin
|
||||
|
||||
import "base:intrinsics"
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#+build darwin
|
||||
package darwin
|
||||
|
||||
// #define OS_WAIT_ON_ADDR_AVAILABILITY \
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#+build darwin
|
||||
package darwin
|
||||
|
||||
import "core:c"
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#+build darwin
|
||||
package darwin
|
||||
|
||||
// IMPORTANT NOTE: direct syscall usage is not allowed by Apple's review process of apps and should
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#+build darwin
|
||||
package darwin
|
||||
|
||||
import "core:c"
|
||||
|
||||
Reference in New Issue
Block a user