mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-05 23:28:48 +00:00
Move Objective-C libraries located in core:sys/darwin/* to vendor:darwin/*
This commit is contained in:
@@ -1,42 +0,0 @@
|
||||
package objc_Foundation
|
||||
|
||||
import "core:intrinsics"
|
||||
|
||||
@(objc_class="NSArray")
|
||||
Array :: struct {
|
||||
using _: Copying(Array),
|
||||
}
|
||||
|
||||
@(objc_type=Array, objc_name="alloc", objc_is_class_method=true)
|
||||
Array_alloc :: proc() -> ^Array {
|
||||
return msgSend(^Array, Array, "alloc")
|
||||
}
|
||||
|
||||
@(objc_type=Array, objc_name="init")
|
||||
Array_init :: proc(self: ^Array) -> ^Array {
|
||||
return msgSend(^Array, self, "init")
|
||||
}
|
||||
|
||||
@(objc_type=Array, objc_name="initWithObjects")
|
||||
Array_initWithObjects :: proc(self: ^Array, objects: [^]^Object, count: UInteger) -> ^Array {
|
||||
return msgSend(^Array, self, "initWithObjects:count:", objects, count)
|
||||
}
|
||||
|
||||
@(objc_type=Array, objc_name="initWithCoder")
|
||||
Array_initWithCoder :: proc(self: ^Array, coder: ^Coder) -> ^Array {
|
||||
return msgSend(^Array, self, "initWithCoder:", coder)
|
||||
}
|
||||
|
||||
@(objc_type=Array, objc_name="object")
|
||||
Array_object :: proc(self: ^Array, index: UInteger) -> ^Object {
|
||||
return msgSend(^Object, self, "objectAtIndex:", index)
|
||||
}
|
||||
@(objc_type=Array, objc_name="objectAs")
|
||||
Array_objectAs :: proc(self: ^Array, index: UInteger, $T: typeid) -> T where intrinsics.type_is_pointer(T), intrinsics.type_is_subtype_of(T, ^Object) {
|
||||
return (T)(Array_object(self, index))
|
||||
}
|
||||
|
||||
@(objc_type=Array, objc_name="count")
|
||||
Array_count :: proc(self: ^Array) -> UInteger {
|
||||
return msgSend(UInteger, self, "count")
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
package objc_Foundation
|
||||
|
||||
@(objc_class="NSAutoreleasePool")
|
||||
AutoreleasePool :: struct {using _: Object}
|
||||
|
||||
@(objc_type=AutoreleasePool, objc_name="alloc", objc_is_class_method=true)
|
||||
AutoreleasePool_alloc :: proc() -> ^AutoreleasePool {
|
||||
return msgSend(^AutoreleasePool, AutoreleasePool, "alloc")
|
||||
}
|
||||
|
||||
@(objc_type=AutoreleasePool, objc_name="init")
|
||||
AutoreleasePool_init :: proc(self: ^AutoreleasePool) -> ^AutoreleasePool {
|
||||
return msgSend(^AutoreleasePool, self, "init")
|
||||
}
|
||||
|
||||
@(objc_type=AutoreleasePool, objc_name="drain")
|
||||
AutoreleasePool_drain :: proc(self: ^AutoreleasePool) {
|
||||
msgSend(nil, self, "drain")
|
||||
}
|
||||
@(objc_type=AutoreleasePool, objc_name="addObject")
|
||||
AutoreleasePool_addObject :: proc(self: ^AutoreleasePool, obj: ^Object) {
|
||||
msgSend(nil, self, "addObject:", obj)
|
||||
}
|
||||
@(objc_type=AutoreleasePool, objc_name="showPools")
|
||||
AutoreleasePool_showPools :: proc(self: ^AutoreleasePool, obj: ^Object) {
|
||||
msgSend(nil, self, "showPools")
|
||||
}
|
||||
|
||||
|
||||
@(deferred_out=AutoreleasePool_drain)
|
||||
scoped_autoreleasepool :: proc() -> ^AutoreleasePool {
|
||||
return AutoreleasePool.alloc()->init()
|
||||
}
|
||||
@@ -1,191 +0,0 @@
|
||||
package objc_Foundation
|
||||
|
||||
@(objc_class="NSBundle")
|
||||
Bundle :: struct { using _: Object }
|
||||
|
||||
@(objc_type=Bundle, objc_name="mainBundle", objc_is_class_method=true)
|
||||
Bundle_mainBundle :: proc() -> ^Bundle {
|
||||
return msgSend(^Bundle, Bundle, "mainBundle")
|
||||
}
|
||||
|
||||
@(objc_type=Bundle, objc_name="bundleWithPath", objc_is_class_method=true)
|
||||
Bundle_bundleWithPath :: proc(path: ^String) -> ^Bundle {
|
||||
return msgSend(^Bundle, Bundle, "bundleWithPath:", path)
|
||||
}
|
||||
|
||||
@(objc_type=Bundle, objc_name="bundleWithURL", objc_is_class_method=true)
|
||||
Bundle_bundleWithURL :: proc(url: ^URL) -> ^Bundle {
|
||||
return msgSend(^Bundle, Bundle, "bundleWithUrl:", url)
|
||||
}
|
||||
|
||||
|
||||
@(objc_type=Bundle, objc_name="alloc", objc_is_class_method=true)
|
||||
Bundle_alloc :: proc() -> ^Bundle {
|
||||
return msgSend(^Bundle, Bundle, "alloc")
|
||||
}
|
||||
|
||||
@(objc_type=Bundle, objc_name="init")
|
||||
Bundle_init :: proc(self: ^Bundle) -> ^Bundle {
|
||||
return msgSend(^Bundle, self, "init")
|
||||
}
|
||||
|
||||
@(objc_type=Bundle, objc_name="initWithPath")
|
||||
Bundle_initWithPath :: proc(self: ^Bundle, path: ^String) -> ^Bundle {
|
||||
return msgSend(^Bundle, self, "initWithPath:", path)
|
||||
}
|
||||
|
||||
@(objc_type=Bundle, objc_name="initWithURL")
|
||||
Bundle_initWithURL :: proc(self: ^Bundle, url: ^URL) -> ^Bundle {
|
||||
return msgSend(^Bundle, self, "initWithUrl:", url)
|
||||
}
|
||||
|
||||
@(objc_type=Bundle, objc_name="allBundles")
|
||||
Bundle_allBundles :: proc() -> (all: ^Array) {
|
||||
return msgSend(type_of(all), Bundle, "allBundles")
|
||||
}
|
||||
|
||||
@(objc_type=Bundle, objc_name="allFrameworks")
|
||||
Bundle_allFrameworks :: proc() -> (all: ^Array) {
|
||||
return msgSend(type_of(all), Bundle, "allFrameworks")
|
||||
}
|
||||
|
||||
@(objc_type=Bundle, objc_name="load")
|
||||
Bundle_load :: proc(self: ^Bundle) -> BOOL {
|
||||
return msgSend(BOOL, self, "load")
|
||||
}
|
||||
@(objc_type=Bundle, objc_name="unload")
|
||||
Bundle_unload :: proc(self: ^Bundle) -> BOOL {
|
||||
return msgSend(BOOL, self, "unload")
|
||||
}
|
||||
|
||||
@(objc_type=Bundle, objc_name="isLoaded")
|
||||
Bundle_isLoaded :: proc(self: ^Bundle) -> BOOL {
|
||||
return msgSend(BOOL, self, "isLoaded")
|
||||
}
|
||||
|
||||
@(objc_type=Bundle, objc_name="preflightAndReturnError")
|
||||
Bundle_preflightAndReturnError :: proc(self: ^Bundle) -> (ok: BOOL, error: ^Error) {
|
||||
ok = msgSend(BOOL, self, "preflightAndReturnError:", &error)
|
||||
return
|
||||
}
|
||||
|
||||
@(objc_type=Bundle, objc_name="loadAndReturnError")
|
||||
Bundle_loadAndReturnError :: proc(self: ^Bundle) -> (ok: BOOL, error: ^Error) {
|
||||
ok = msgSend(BOOL, self, "loadAndReturnError:", &error)
|
||||
return
|
||||
}
|
||||
|
||||
@(objc_type=Bundle, objc_name="bundleURL")
|
||||
Bundle_bundleURL :: proc(self: ^Bundle) -> ^URL {
|
||||
return msgSend(^URL, self, "bundleURL")
|
||||
}
|
||||
|
||||
@(objc_type=Bundle, objc_name="resourceURL")
|
||||
Bundle_resourceURL :: proc(self: ^Bundle) -> ^URL {
|
||||
return msgSend(^URL, self, "resourceURL")
|
||||
}
|
||||
|
||||
@(objc_type=Bundle, objc_name="executableURL")
|
||||
Bundle_executableURL :: proc(self: ^Bundle) -> ^URL {
|
||||
return msgSend(^URL, self, "executableURL")
|
||||
}
|
||||
|
||||
@(objc_type=Bundle, objc_name="URLForAuxiliaryExecutable")
|
||||
Bundle_URLForAuxiliaryExecutable :: proc(self: ^Bundle, executableName: ^String) -> ^URL {
|
||||
return msgSend(^URL, self, "URLForAuxiliaryExecutable:", executableName)
|
||||
}
|
||||
|
||||
@(objc_type=Bundle, objc_name="privateFrameworksURL")
|
||||
Bundle_privateFrameworksURL :: proc(self: ^Bundle) -> ^URL {
|
||||
return msgSend(^URL, self, "privateFrameworksURL")
|
||||
}
|
||||
|
||||
@(objc_type=Bundle, objc_name="sharedFrameworksURL")
|
||||
Bundle_sharedFrameworksURL :: proc(self: ^Bundle) -> ^URL {
|
||||
return msgSend(^URL, self, "sharedFrameworksURL")
|
||||
}
|
||||
|
||||
@(objc_type=Bundle, objc_name="sharedSupportURL")
|
||||
Bundle_sharedSupportURL :: proc(self: ^Bundle) -> ^URL {
|
||||
return msgSend(^URL, self, "sharedSupportURL")
|
||||
}
|
||||
|
||||
@(objc_type=Bundle, objc_name="builtInPlugInsURL")
|
||||
Bundle_builtInPlugInsURL :: proc(self: ^Bundle) -> ^URL {
|
||||
return msgSend(^URL, self, "builtInPlugInsURL")
|
||||
}
|
||||
|
||||
@(objc_type=Bundle, objc_name="appStoreReceiptURL")
|
||||
Bundle_appStoreReceiptURL :: proc(self: ^Bundle) -> ^URL {
|
||||
return msgSend(^URL, self, "appStoreReceiptURL")
|
||||
}
|
||||
|
||||
@(objc_type=Bundle, objc_name="bundlePath")
|
||||
Bundle_bundlePath :: proc(self: ^Bundle) -> ^String {
|
||||
return msgSend(^String, self, "bundlePath")
|
||||
}
|
||||
|
||||
@(objc_type=Bundle, objc_name="resourcePath")
|
||||
Bundle_resourcePath :: proc(self: ^Bundle) -> ^String {
|
||||
return msgSend(^String, self, "resourcePath")
|
||||
}
|
||||
|
||||
@(objc_type=Bundle, objc_name="executablePath")
|
||||
Bundle_executablePath :: proc(self: ^Bundle) -> ^String {
|
||||
return msgSend(^String, self, "executablePath")
|
||||
}
|
||||
|
||||
@(objc_type=Bundle, objc_name="PathForAuxiliaryExecutable")
|
||||
Bundle_PathForAuxiliaryExecutable :: proc(self: ^Bundle, executableName: ^String) -> ^String {
|
||||
return msgSend(^String, self, "PathForAuxiliaryExecutable:", executableName)
|
||||
}
|
||||
|
||||
@(objc_type=Bundle, objc_name="privateFrameworksPath")
|
||||
Bundle_privateFrameworksPath :: proc(self: ^Bundle) -> ^String {
|
||||
return msgSend(^String, self, "privateFrameworksPath")
|
||||
}
|
||||
|
||||
@(objc_type=Bundle, objc_name="sharedFrameworksPath")
|
||||
Bundle_sharedFrameworksPath :: proc(self: ^Bundle) -> ^String {
|
||||
return msgSend(^String, self, "sharedFrameworksPath")
|
||||
}
|
||||
|
||||
@(objc_type=Bundle, objc_name="sharedSupportPath")
|
||||
Bundle_sharedSupportPath :: proc(self: ^Bundle) -> ^String {
|
||||
return msgSend(^String, self, "sharedSupportPath")
|
||||
}
|
||||
|
||||
@(objc_type=Bundle, objc_name="builtInPlugInsPath")
|
||||
Bundle_builtInPlugInsPath :: proc(self: ^Bundle) -> ^String {
|
||||
return msgSend(^String, self, "builtInPlugInsPath")
|
||||
}
|
||||
|
||||
@(objc_type=Bundle, objc_name="appStoreReceiptPath")
|
||||
Bundle_appStoreReceiptPath :: proc(self: ^Bundle) -> ^String {
|
||||
return msgSend(^String, self, "appStoreReceiptPath")
|
||||
}
|
||||
|
||||
@(objc_type=Bundle, objc_name="bundleIdentifier")
|
||||
Bundle_bundleIdentifier :: proc(self: ^Bundle) -> ^String {
|
||||
return msgSend(^String, self, "bundleIdentifier")
|
||||
}
|
||||
|
||||
@(objc_type=Bundle, objc_name="infoDictionary")
|
||||
Bundle_infoDictionary :: proc(self: ^Bundle) -> ^Dictionary {
|
||||
return msgSend(^Dictionary, self, "infoDictionary")
|
||||
}
|
||||
|
||||
@(objc_type=Bundle, objc_name="localizedInfoDictionary")
|
||||
Bundle_localizedInfoDictionary :: proc(self: ^Bundle) -> ^Dictionary {
|
||||
return msgSend(^Dictionary, self, "localizedInfoDictionary")
|
||||
}
|
||||
|
||||
@(objc_type=Bundle, objc_name="objectForInfoDictionaryKey")
|
||||
Bundle_objectForInfoDictionaryKey :: proc(self: ^Bundle, key: ^String) -> ^Object {
|
||||
return msgSend(^Object, self, "objectForInfoDictionaryKey:", key)
|
||||
}
|
||||
|
||||
@(objc_type=Bundle, objc_name="localizedStringForKey")
|
||||
Bundle_localizedStringForKey :: proc(self: ^Bundle, key: ^String, value: ^String = nil, tableName: ^String = nil) -> ^String {
|
||||
return msgSend(^String, self, "localizedStringForKey:value:table:", key, value, tableName)
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
package objc_Foundation
|
||||
|
||||
@(objc_class="NSData")
|
||||
Data :: struct {using _: Copying(Data)}
|
||||
|
||||
@(objc_type=Data, objc_name="alloc", objc_is_class_method=true)
|
||||
Data_alloc :: proc() -> ^Data {
|
||||
return msgSend(^Data, Data, "alloc")
|
||||
}
|
||||
|
||||
@(objc_type=Data, objc_name="init")
|
||||
Data_init :: proc(self: ^Data) -> ^Data {
|
||||
return msgSend(^Data, self, "init")
|
||||
}
|
||||
|
||||
@(objc_type=Data, objc_name="mutableBytes")
|
||||
Data_mutableBytes :: proc(self: ^Data) -> rawptr {
|
||||
return msgSend(rawptr, self, "mutableBytes")
|
||||
}
|
||||
|
||||
@(objc_type=Data, objc_name="length")
|
||||
Data_length :: proc(self: ^Data) -> UInteger {
|
||||
return msgSend(UInteger, self, "length")
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
package objc_Foundation
|
||||
|
||||
@(objc_class="NSDate")
|
||||
Date :: struct {using _: Copying(Date)}
|
||||
|
||||
@(objc_type=Date, objc_name="alloc", objc_is_class_method=true)
|
||||
Date_alloc :: proc() -> ^Date {
|
||||
return msgSend(^Date, Date, "alloc")
|
||||
}
|
||||
|
||||
@(objc_type=Date, objc_name="init")
|
||||
Date_init :: proc(self: ^Date) -> ^Date {
|
||||
return msgSend(^Date, self, "init")
|
||||
}
|
||||
|
||||
@(objc_type=Date, objc_name="dateWithTimeIntervalSinceNow")
|
||||
Date_dateWithTimeIntervalSinceNow :: proc(secs: TimeInterval) -> ^Date {
|
||||
return msgSend(^Date, Date, "dateWithTimeIntervalSinceNow:", secs)
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
package objc_Foundation
|
||||
|
||||
@(objc_class="NSDictionary")
|
||||
Dictionary :: struct {using _: Copying(Dictionary)}
|
||||
|
||||
@(objc_type=Dictionary, objc_name="dictionary", objc_is_class_method=true)
|
||||
Dictionary_dictionary :: proc() -> ^Dictionary {
|
||||
return msgSend(^Dictionary, Dictionary, "dictionary")
|
||||
}
|
||||
|
||||
@(objc_type=Dictionary, objc_name="dictionaryWithObject", objc_is_class_method=true)
|
||||
Dictionary_dictionaryWithObject :: proc(object: ^Object, forKey: ^Object) -> ^Dictionary {
|
||||
return msgSend(^Dictionary, Dictionary, "dictionaryWithObject:forKey:", object, forKey)
|
||||
}
|
||||
|
||||
@(objc_type=Dictionary, objc_name="dictionaryWithObjects", objc_is_class_method=true)
|
||||
Dictionary_dictionaryWithObjects :: proc(objects: [^]^Object, forKeys: [^]^Object, count: UInteger) -> ^Dictionary {
|
||||
return msgSend(^Dictionary, Dictionary, "dictionaryWithObjects:forKeys:count", objects, forKeys, count)
|
||||
}
|
||||
|
||||
|
||||
@(objc_type=Dictionary, objc_name="alloc", objc_is_class_method=true)
|
||||
Dictionary_alloc :: proc() -> ^Dictionary {
|
||||
return msgSend(^Dictionary, Dictionary, "alloc")
|
||||
}
|
||||
|
||||
@(objc_type=Dictionary, objc_name="init")
|
||||
Dictionary_init :: proc(self: ^Dictionary) -> ^Dictionary {
|
||||
return msgSend(^Dictionary, self, "init")
|
||||
}
|
||||
|
||||
@(objc_type=Dictionary, objc_name="initWithObjects")
|
||||
Dictionary_initWithObjects :: proc(self: ^Dictionary, objects: [^]^Object, forKeys: [^]^Object, count: UInteger) -> ^Dictionary {
|
||||
return msgSend(^Dictionary, self, "initWithObjects:forKeys:count", objects, forKeys, count)
|
||||
}
|
||||
|
||||
@(objc_type=Dictionary, objc_name="objectForKey")
|
||||
Dictionary_objectForKey :: proc(self: ^Dictionary, key: ^Object) -> ^Object {
|
||||
return msgSend(^Dictionary, self, "objectForKey:", key)
|
||||
}
|
||||
|
||||
@(objc_type=Dictionary, objc_name="count")
|
||||
Dictionary_count :: proc(self: ^Dictionary) -> UInteger {
|
||||
return msgSend(UInteger, self, "count")
|
||||
}
|
||||
|
||||
@(objc_type=Dictionary, objc_name="keyEnumerator")
|
||||
Dictionary_keyEnumerator :: proc(self: ^Dictionary, $KeyType: typeid) -> (enumerator: ^Enumerator(KeyType)) {
|
||||
return msgSend(type_of(enumerator), self, "keyEnumerator")
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
package objc_Foundation
|
||||
|
||||
import "core:c"
|
||||
import "core:intrinsics"
|
||||
|
||||
FastEnumerationState :: struct #packed {
|
||||
state: c.ulong,
|
||||
itemsPtr: [^]^Object,
|
||||
mutationsPtr: [^]c.ulong,
|
||||
extra: [5]c.ulong,
|
||||
}
|
||||
|
||||
@(objc_class="NSFastEnumeration")
|
||||
FastEnumeration :: struct {using _: Object}
|
||||
|
||||
@(objc_class="NSEnumerator")
|
||||
Enumerator :: struct($T: typeid) where intrinsics.type_is_pointer(T), intrinsics.type_is_subtype_of(T, ^Object) {
|
||||
using _: FastEnumeration,
|
||||
}
|
||||
|
||||
|
||||
@(objc_type=FastEnumeration, objc_name="alloc", objc_is_class_method=true)
|
||||
FastEnumeration_alloc :: proc() -> ^FastEnumeration {
|
||||
return msgSend(^FastEnumeration, FastEnumeration, "alloc")
|
||||
}
|
||||
|
||||
@(objc_type=FastEnumeration, objc_name="init")
|
||||
FastEnumeration_init :: proc(self: ^FastEnumeration) -> ^FastEnumeration {
|
||||
return msgSend(^FastEnumeration, self, "init")
|
||||
}
|
||||
|
||||
|
||||
@(objc_type=FastEnumeration, objc_name="countByEnumerating")
|
||||
FastEnumeration_countByEnumerating :: proc(self: ^FastEnumeration, state: ^FastEnumerationState, buffer: [^]^Object, len: UInteger) -> UInteger {
|
||||
return msgSend(UInteger, self, "countByEnumeratingWithState:objects:count:", state, buffer, len)
|
||||
}
|
||||
|
||||
Enumerator_nextObject :: proc(self: ^$E/Enumerator($T)) -> T {
|
||||
return msgSend(T, self, "nextObject")
|
||||
}
|
||||
|
||||
Enumerator_allObjects :: proc(self: ^$E/Enumerator($T)) -> (all: ^Array) {
|
||||
return msgSend(type_of(all), self, "allObjects")
|
||||
}
|
||||
|
||||
Enumerator_iterator :: proc(self: ^$E/Enumerator($T)) -> (obj: T, ok: bool) {
|
||||
obj = msgSend(T, self, "nextObject")
|
||||
ok = obj != nil
|
||||
return
|
||||
}
|
||||
@@ -1,88 +0,0 @@
|
||||
package objc_Foundation
|
||||
|
||||
foreign import "system:Foundation.framework"
|
||||
|
||||
ErrorDomain :: ^String
|
||||
|
||||
foreign Foundation {
|
||||
@(linkage="weak") CocoaErrorDomain: ErrorDomain
|
||||
@(linkage="weak") POSIXErrorDomain: ErrorDomain
|
||||
@(linkage="weak") OSStatusErrorDomain: ErrorDomain
|
||||
@(linkage="weak") MachErrorDomain: ErrorDomain
|
||||
}
|
||||
|
||||
ErrorUserInfoKey :: ^String
|
||||
|
||||
foreign Foundation {
|
||||
@(linkage="weak") UnderlyingErrorKey: ErrorUserInfoKey
|
||||
@(linkage="weak") LocalizedDescriptionKey: ErrorUserInfoKey
|
||||
@(linkage="weak") LocalizedFailureReasonErrorKey: ErrorUserInfoKey
|
||||
@(linkage="weak") LocalizedRecoverySuggestionErrorKey: ErrorUserInfoKey
|
||||
@(linkage="weak") LocalizedRecoveryOptionsErrorKey: ErrorUserInfoKey
|
||||
@(linkage="weak") RecoveryAttempterErrorKey: ErrorUserInfoKey
|
||||
@(linkage="weak") HelpAnchorErrorKey: ErrorUserInfoKey
|
||||
@(linkage="weak") DebugDescriptionErrorKey: ErrorUserInfoKey
|
||||
@(linkage="weak") LocalizedFailureErrorKey: ErrorUserInfoKey
|
||||
@(linkage="weak") StringEncodingErrorKey: ErrorUserInfoKey
|
||||
@(linkage="weak") URLErrorKey: ErrorUserInfoKey
|
||||
@(linkage="weak") FilePathErrorKey: ErrorUserInfoKey
|
||||
}
|
||||
|
||||
@(objc_class="NSError")
|
||||
Error :: struct { using _: Copying(Error) }
|
||||
|
||||
|
||||
@(objc_type=Error, objc_name="alloc", objc_is_class_method=true)
|
||||
Error_alloc :: proc() -> ^Error {
|
||||
return msgSend(^Error, Error, "alloc")
|
||||
}
|
||||
|
||||
@(objc_type=Error, objc_name="init")
|
||||
Error_init :: proc(self: ^Error) -> ^Error {
|
||||
return msgSend(^Error, self, "init")
|
||||
}
|
||||
|
||||
@(objc_type=Error, objc_name="errorWithDomain", objc_is_class_method=true)
|
||||
Error_errorWithDomain :: proc(domain: ErrorDomain, code: Integer, userInfo: ^Dictionary) -> ^Error {
|
||||
return msgSend(^Error, Error, "errorWithDomain:code:userInfo:", domain, code, userInfo)
|
||||
}
|
||||
|
||||
@(objc_type=Error, objc_name="initWithDomain")
|
||||
Error_initWithDomain :: proc(self: ^Error, domain: ErrorDomain, code: Integer, userInfo: ^Dictionary) -> ^Error {
|
||||
return msgSend(^Error, self, "initWithDomain:code:userInfo:", domain, code, userInfo)
|
||||
}
|
||||
|
||||
@(objc_type=Error, objc_name="code")
|
||||
Error_code :: proc(self: ^Error) -> Integer {
|
||||
return msgSend(Integer, self, "code")
|
||||
}
|
||||
|
||||
@(objc_type=Error, objc_name="domain")
|
||||
Error_domain :: proc(self: ^Error) -> ErrorDomain {
|
||||
return msgSend(ErrorDomain, self, "domain")
|
||||
}
|
||||
|
||||
@(objc_type=Error, objc_name="userInfo")
|
||||
Error_userInfo :: proc(self: ^Error) -> ^Dictionary {
|
||||
return msgSend(^Dictionary, self, "userInfo")
|
||||
}
|
||||
|
||||
@(objc_type=Error, objc_name="localizedDescription")
|
||||
Error_localizedDescription :: proc(self: ^Error) -> ^String {
|
||||
return msgSend(^String, self, "localizedDescription")
|
||||
}
|
||||
|
||||
@(objc_type=Error, objc_name="localizedRecoveryOptions")
|
||||
Error_localizedRecoveryOptions :: proc(self: ^Error) -> (options: ^Array) {
|
||||
return msgSend(type_of(options), self, "localizedRecoveryOptions")
|
||||
}
|
||||
|
||||
@(objc_type=Error, objc_name="localizedRecoverySuggestion")
|
||||
Error_localizedRecoverySuggestion :: proc(self: ^Error) -> ^String {
|
||||
return msgSend(^String, self, "localizedRecoverySuggestion")
|
||||
}
|
||||
|
||||
@(objc_type=Error, objc_name="localizedFailureReason")
|
||||
Error_localizedFailureReason :: proc(self: ^Error) -> ^String {
|
||||
return msgSend(^String, self, "localizedFailureReason")
|
||||
}
|
||||
@@ -1,53 +0,0 @@
|
||||
package objc_Foundation
|
||||
|
||||
Locking :: struct($T: typeid) {using _: Object}
|
||||
|
||||
Locking_lock :: proc(self: ^Locking($T)) {
|
||||
msgSend(nil, self, "lock")
|
||||
}
|
||||
Locking_unlock :: proc(self: ^Locking($T)) {
|
||||
msgSend(nil, self, "unlock")
|
||||
}
|
||||
|
||||
@(objc_class="NSCondition")
|
||||
Condition :: struct {using _: Locking(Condition) }
|
||||
|
||||
|
||||
@(objc_type=Condition, objc_name="alloc", objc_is_class_method=true)
|
||||
Condition_alloc :: proc() -> ^Condition {
|
||||
return msgSend(^Condition, Condition, "alloc")
|
||||
}
|
||||
|
||||
@(objc_type=Condition, objc_name="init")
|
||||
Condition_init :: proc(self: ^Condition) -> ^Condition {
|
||||
return msgSend(^Condition, self, "init")
|
||||
}
|
||||
|
||||
@(objc_type=Condition, objc_name="wait")
|
||||
Condition_wait :: proc(self: ^Condition) {
|
||||
msgSend(nil, self, "wait")
|
||||
}
|
||||
|
||||
@(objc_type=Condition, objc_name="waitUntilDate")
|
||||
Condition_waitUntilDate :: proc(self: ^Condition, limit: ^Date) -> BOOL {
|
||||
return msgSend(BOOL, self, "waitUntilDate:", limit)
|
||||
}
|
||||
|
||||
@(objc_type=Condition, objc_name="signal")
|
||||
Condition_signal :: proc(self: ^Condition) {
|
||||
msgSend(nil, self, "signal")
|
||||
}
|
||||
|
||||
@(objc_type=Condition, objc_name="broadcast")
|
||||
Condition_broadcast :: proc(self: ^Condition) {
|
||||
msgSend(nil, self, "broadcast")
|
||||
}
|
||||
|
||||
@(objc_type=Condition, objc_name="lock")
|
||||
Condition_lock :: proc(self: ^Condition) {
|
||||
msgSend(nil, self, "lock")
|
||||
}
|
||||
@(objc_type=Condition, objc_name="unlock")
|
||||
Condition_unlock :: proc(self: ^Condition) {
|
||||
msgSend(nil, self, "unlock")
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
package objc_Foundation
|
||||
|
||||
@(objc_class="NSNotification")
|
||||
Notification :: struct{using _: Object}
|
||||
|
||||
|
||||
@(objc_type=Notification, objc_name="alloc", objc_is_class_method=true)
|
||||
Notification_alloc :: proc() -> ^Notification {
|
||||
return msgSend(^Notification, Notification, "alloc")
|
||||
}
|
||||
|
||||
@(objc_type=Notification, objc_name="init")
|
||||
Notification_init :: proc(self: ^Notification) -> ^Notification {
|
||||
return msgSend(^Notification, self, "init")
|
||||
}
|
||||
|
||||
@(objc_type=Notification, objc_name="name")
|
||||
Notification_name :: proc(self: ^Notification) -> ^String {
|
||||
return msgSend(^String, self, "name")
|
||||
}
|
||||
|
||||
@(objc_type=Notification, objc_name="object")
|
||||
Notification_object :: proc(self: ^Notification) -> ^Object {
|
||||
return msgSend(^Object, self, "object")
|
||||
}
|
||||
|
||||
@(objc_type=Notification, objc_name="userInfo")
|
||||
Notification_userInfo :: proc(self: ^Notification) -> ^Dictionary {
|
||||
return msgSend(^Dictionary, self, "userInfo")
|
||||
}
|
||||
@@ -1,151 +0,0 @@
|
||||
package objc_Foundation
|
||||
|
||||
import "core:c"
|
||||
|
||||
#assert(size_of(c.long) == size_of(int))
|
||||
#assert(size_of(c.ulong) == size_of(uint))
|
||||
|
||||
@(objc_class="NSValue")
|
||||
Value :: struct{using _: Copying(Value)}
|
||||
|
||||
@(objc_type=Value, objc_name="alloc", objc_is_class_method=true)
|
||||
Value_alloc :: proc() -> ^Value {
|
||||
return msgSend(^Value, Value, "alloc")
|
||||
}
|
||||
|
||||
@(objc_type=Value, objc_name="init")
|
||||
Value_init :: proc(self: ^Value) -> ^Value {
|
||||
return msgSend(^Value, self, "init")
|
||||
}
|
||||
|
||||
@(objc_type=Value, objc_name="valueWithBytes", objc_is_class_method=true)
|
||||
Value_valueWithBytes :: proc(value: rawptr, type: cstring) -> ^Value {
|
||||
return msgSend(^Value, Value, "valueWithBytes:objCType:", value, type)
|
||||
}
|
||||
|
||||
@(objc_type=Value, objc_name="valueWithPointer", objc_is_class_method=true)
|
||||
Value_valueWithPointer :: proc(pointer: rawptr) -> ^Value {
|
||||
return msgSend(^Value, Value, "valueWithPointer:", pointer)
|
||||
}
|
||||
|
||||
@(objc_type=Value, objc_name="initWithBytes")
|
||||
Value_initWithBytes :: proc(self: ^Value, value: rawptr, type: cstring) -> ^Value {
|
||||
return msgSend(^Value, self, "initWithBytes:objCType:", value, type)
|
||||
}
|
||||
|
||||
@(objc_type=Value, objc_name="initWithCoder")
|
||||
Value_initWithCoder :: proc(self: ^Value, coder: ^Coder) -> ^Value {
|
||||
return msgSend(^Value, self, "initWithCoder:", coder)
|
||||
}
|
||||
|
||||
@(objc_type=Value, objc_name="getValue")
|
||||
Value_getValue :: proc(self: ^Value, value: rawptr, size: UInteger) {
|
||||
msgSend(nil, self, "getValue:size:", value, size)
|
||||
}
|
||||
|
||||
|
||||
@(objc_type=Value, objc_name="objCType")
|
||||
Value_objCType :: proc(self: ^Value) -> cstring {
|
||||
return msgSend(cstring, self, "objCType")
|
||||
}
|
||||
|
||||
@(objc_type=Value, objc_name="isEqualToValue")
|
||||
Value_isEqualToValue :: proc(self, other: ^Value) -> BOOL {
|
||||
return msgSend(BOOL, self, "isEqualToValue:", other)
|
||||
}
|
||||
|
||||
@(objc_type=Value, objc_name="pointerValue")
|
||||
Value_pointerValue :: proc(self: ^Value) -> rawptr {
|
||||
return msgSend(rawptr, self, "pointerValue")
|
||||
}
|
||||
|
||||
|
||||
@(objc_class="NSNumber")
|
||||
Number :: struct{using _: Copying(Number), using _: Value}
|
||||
|
||||
@(objc_type=Number, objc_name="alloc", objc_is_class_method=true)
|
||||
Number_alloc :: proc() -> ^Number {
|
||||
return msgSend(^Number, Number, "alloc")
|
||||
}
|
||||
|
||||
@(objc_type=Number, objc_name="init")
|
||||
Number_init :: proc(self: ^Number) -> ^Number {
|
||||
return msgSend(^Number, self, "init")
|
||||
}
|
||||
|
||||
@(objc_type=Number, objc_name="numberWithI8", objc_is_class_method=true) Number_numberWithI8 :: proc(value: i8) -> ^Number { return msgSend(^Number, Number, "numberWithChar:", value) }
|
||||
@(objc_type=Number, objc_name="numberWithU8", objc_is_class_method=true) Number_numberWithU8 :: proc(value: u8) -> ^Number { return msgSend(^Number, Number, "numberWithUnsignedChar:", value) }
|
||||
@(objc_type=Number, objc_name="numberWithI16", objc_is_class_method=true) Number_numberWithI16 :: proc(value: i16) -> ^Number { return msgSend(^Number, Number, "numberWithShort:", value) }
|
||||
@(objc_type=Number, objc_name="numberWithU16", objc_is_class_method=true) Number_numberWithU16 :: proc(value: u16) -> ^Number { return msgSend(^Number, Number, "numberWithUnsignedShort:", value) }
|
||||
@(objc_type=Number, objc_name="numberWithI32", objc_is_class_method=true) Number_numberWithI32 :: proc(value: i32) -> ^Number { return msgSend(^Number, Number, "numberWithInt:", value) }
|
||||
@(objc_type=Number, objc_name="numberWithU32", objc_is_class_method=true) Number_numberWithU32 :: proc(value: u32) -> ^Number { return msgSend(^Number, Number, "numberWithUnsignedInt:", value) }
|
||||
@(objc_type=Number, objc_name="numberWithInt", objc_is_class_method=true) Number_numberWithInt :: proc(value: int) -> ^Number { return msgSend(^Number, Number, "numberWithLong:", value) }
|
||||
@(objc_type=Number, objc_name="numberWithUint", objc_is_class_method=true) Number_numberWithUint :: proc(value: uint) -> ^Number { return msgSend(^Number, Number, "numberWithUnsignedLong:", value) }
|
||||
@(objc_type=Number, objc_name="numberWithU64", objc_is_class_method=true) Number_numberWithU64 :: proc(value: u64) -> ^Number { return msgSend(^Number, Number, "numberWithLongLong:", value) }
|
||||
@(objc_type=Number, objc_name="numberWithI64", objc_is_class_method=true) Number_numberWithI64 :: proc(value: i64) -> ^Number { return msgSend(^Number, Number, "numberWithUnsignedLongLong:", value) }
|
||||
@(objc_type=Number, objc_name="numberWithF32", objc_is_class_method=true) Number_numberWithF32 :: proc(value: f32) -> ^Number { return msgSend(^Number, Number, "numberWithFloat:", value) }
|
||||
@(objc_type=Number, objc_name="numberWithF64", objc_is_class_method=true) Number_numberWithF64 :: proc(value: f64) -> ^Number { return msgSend(^Number, Number, "numberWithDouble:", value) }
|
||||
@(objc_type=Number, objc_name="numberWithBool", objc_is_class_method=true) Number_numberWithBool :: proc(value: BOOL) -> ^Number { return msgSend(^Number, Number, "numberWithBool:", value) }
|
||||
|
||||
Number_number :: proc{
|
||||
Number_numberWithI8,
|
||||
Number_numberWithU8,
|
||||
Number_numberWithI16,
|
||||
Number_numberWithU16,
|
||||
Number_numberWithI32,
|
||||
Number_numberWithU32,
|
||||
Number_numberWithInt,
|
||||
Number_numberWithUint,
|
||||
Number_numberWithU64,
|
||||
Number_numberWithI64,
|
||||
Number_numberWithF32,
|
||||
Number_numberWithF64,
|
||||
Number_numberWithBool,
|
||||
}
|
||||
|
||||
@(objc_type=Number, objc_name="initWithI8") Number_initWithI8 :: proc(self: ^Number, value: i8) -> ^Number { return msgSend(^Number, self, "initWithChar:", value) }
|
||||
@(objc_type=Number, objc_name="initWithU8") Number_initWithU8 :: proc(self: ^Number, value: u8) -> ^Number { return msgSend(^Number, self, "initWithUnsignedChar:", value) }
|
||||
@(objc_type=Number, objc_name="initWithI16") Number_initWithI16 :: proc(self: ^Number, value: i16) -> ^Number { return msgSend(^Number, self, "initWithShort:", value) }
|
||||
@(objc_type=Number, objc_name="initWithU16") Number_initWithU16 :: proc(self: ^Number, value: u16) -> ^Number { return msgSend(^Number, self, "initWithUnsignedShort:", value) }
|
||||
@(objc_type=Number, objc_name="initWithI32") Number_initWithI32 :: proc(self: ^Number, value: i32) -> ^Number { return msgSend(^Number, self, "initWithInt:", value) }
|
||||
@(objc_type=Number, objc_name="initWithU32") Number_initWithU32 :: proc(self: ^Number, value: u32) -> ^Number { return msgSend(^Number, self, "initWithUnsignedInt:", value) }
|
||||
@(objc_type=Number, objc_name="initWithInt") Number_initWithInt :: proc(self: ^Number, value: int) -> ^Number { return msgSend(^Number, self, "initWithLong:", value) }
|
||||
@(objc_type=Number, objc_name="initWithUint") Number_initWithUint :: proc(self: ^Number, value: uint) -> ^Number { return msgSend(^Number, self, "initWithUnsignedLong:", value) }
|
||||
@(objc_type=Number, objc_name="initWithU64") Number_initWithU64 :: proc(self: ^Number, value: u64) -> ^Number { return msgSend(^Number, self, "initWithLongLong:", value) }
|
||||
@(objc_type=Number, objc_name="initWithI64") Number_initWithI64 :: proc(self: ^Number, value: i64) -> ^Number { return msgSend(^Number, self, "initWithUnsignedLongLong:", value) }
|
||||
@(objc_type=Number, objc_name="initWithF32") Number_initWithF32 :: proc(self: ^Number, value: f32) -> ^Number { return msgSend(^Number, self, "initWithFloat:", value) }
|
||||
@(objc_type=Number, objc_name="initWithF64") Number_initWithF64 :: proc(self: ^Number, value: f64) -> ^Number { return msgSend(^Number, self, "initWithDouble:", value) }
|
||||
@(objc_type=Number, objc_name="initWithBool") Number_initWithBool :: proc(self: ^Number, value: BOOL) -> ^Number { return msgSend(^Number, self, "initWithBool:", value) }
|
||||
|
||||
|
||||
@(objc_type=Number, objc_name="i8Value") Number_i8Value :: proc(self: ^Number) -> i8 { return msgSend(i8, self, "charValue") }
|
||||
@(objc_type=Number, objc_name="u8Value") Number_u8Value :: proc(self: ^Number) -> u8 { return msgSend(u8, self, "unsignedCharValue") }
|
||||
@(objc_type=Number, objc_name="i16Value") Number_i16Value :: proc(self: ^Number) -> i16 { return msgSend(i16, self, "shortValue") }
|
||||
@(objc_type=Number, objc_name="u16Value") Number_u16Value :: proc(self: ^Number) -> u16 { return msgSend(u16, self, "unsignedShortValue") }
|
||||
@(objc_type=Number, objc_name="i32Value") Number_i32Value :: proc(self: ^Number) -> i32 { return msgSend(i32, self, "intValue") }
|
||||
@(objc_type=Number, objc_name="u32Value") Number_u32Value :: proc(self: ^Number) -> u32 { return msgSend(u32, self, "unsignedIntValue") }
|
||||
@(objc_type=Number, objc_name="intValue") Number_intValue :: proc(self: ^Number) -> int { return msgSend(int, self, "longValue") }
|
||||
@(objc_type=Number, objc_name="uintValue") Number_uintValue :: proc(self: ^Number) -> uint { return msgSend(uint, self, "unsignedLongValue") }
|
||||
@(objc_type=Number, objc_name="u64Value") Number_u64Value :: proc(self: ^Number) -> u64 { return msgSend(u64, self, "longLongValue") }
|
||||
@(objc_type=Number, objc_name="i64Value") Number_i64Value :: proc(self: ^Number) -> i64 { return msgSend(i64, self, "unsignedLongLongValue") }
|
||||
@(objc_type=Number, objc_name="f32Value") Number_f32Value :: proc(self: ^Number) -> f32 { return msgSend(f32, self, "floatValue") }
|
||||
@(objc_type=Number, objc_name="f64Value") Number_f64Value :: proc(self: ^Number) -> f64 { return msgSend(f64, self, "doubleValue") }
|
||||
@(objc_type=Number, objc_name="boolValue") Number_boolValue :: proc(self: ^Number) -> BOOL { return msgSend(BOOL, self, "boolValue") }
|
||||
@(objc_type=Number, objc_name="integerValue") Number_integerValue :: proc(self: ^Number) -> Integer { return msgSend(Integer, self, "integerValue") }
|
||||
@(objc_type=Number, objc_name="uintegerValue") Number_uintegerValue :: proc(self: ^Number) -> UInteger { return msgSend(UInteger, self, "unsignedIntegerValue") }
|
||||
@(objc_type=Number, objc_name="stringValue") Number_stringValue :: proc(self: ^Number) -> ^String { return msgSend(^String, self, "stringValue") }
|
||||
|
||||
@(objc_type=Number, objc_name="compare")
|
||||
Number_compare :: proc(self, other: ^Number) -> ComparisonResult {
|
||||
return msgSend(ComparisonResult, self, "compare:", other)
|
||||
}
|
||||
|
||||
@(objc_type=Number, objc_name="isEqualToNumber")
|
||||
Number_isEqualToNumber :: proc(self, other: ^Number) -> BOOL {
|
||||
return msgSend(BOOL, self, "isEqualToNumber:", other)
|
||||
}
|
||||
|
||||
@(objc_type=Number, objc_name="descriptionWithLocale")
|
||||
Number_descriptionWithLocale :: proc(self: ^Number, locale: ^Object) -> ^String {
|
||||
return msgSend(^String, self, "descriptionWithLocale:", locale)
|
||||
}
|
||||
@@ -1,86 +0,0 @@
|
||||
package objc_Foundation
|
||||
|
||||
import "core:intrinsics"
|
||||
|
||||
methodSignatureForSelector :: proc "c" (obj: ^Object, selector: SEL) -> rawptr {
|
||||
return msgSend(rawptr, obj, "methodSignatureForSelector:", selector)
|
||||
}
|
||||
|
||||
respondsToSelector :: proc "c" (obj: ^Object, selector: SEL) -> BOOL {
|
||||
return msgSend(BOOL, obj, "respondsToSelector:", selector)
|
||||
}
|
||||
|
||||
msgSendSafeCheck :: proc "c" (obj: ^Object, selector: SEL) -> BOOL {
|
||||
return respondsToSelector(obj, selector) || methodSignatureForSelector(obj, selector) != nil
|
||||
}
|
||||
|
||||
|
||||
@(objc_class="NSObject")
|
||||
Object :: struct {using _: intrinsics.objc_object}
|
||||
|
||||
@(objc_class="NSObject")
|
||||
Copying :: struct($T: typeid) {using _: Object}
|
||||
|
||||
alloc :: proc($T: typeid) -> ^T where intrinsics.type_is_subtype_of(T, Object) {
|
||||
return msgSend(^T, T, "alloc")
|
||||
}
|
||||
init :: proc(self: ^$T) -> ^T where intrinsics.type_is_subtype_of(T, Object) {
|
||||
return msgSend(^T, self, "init")
|
||||
}
|
||||
copy :: proc(self: ^Copying($T)) -> ^T where intrinsics.type_is_subtype_of(T, Object) {
|
||||
return msgSend(^T, self, "copy")
|
||||
}
|
||||
|
||||
new :: proc($T: typeid) -> ^T where intrinsics.type_is_subtype_of(T, Object) {
|
||||
return init(alloc(T))
|
||||
}
|
||||
|
||||
@(objc_type=Object, objc_name="retain")
|
||||
retain :: proc(self: ^Object) {
|
||||
_ = msgSend(^Object, self, "retain")
|
||||
}
|
||||
@(objc_type=Object, objc_name="release")
|
||||
release :: proc(self: ^Object) {
|
||||
msgSend(nil, self, "release")
|
||||
}
|
||||
@(objc_type=Object, objc_name="autorelease")
|
||||
autorelease :: proc(self: ^Object) {
|
||||
msgSend(nil, self, "autorelease")
|
||||
}
|
||||
@(objc_type=Object, objc_name="retainCount")
|
||||
retainCount :: proc(self: ^Object) -> UInteger {
|
||||
return msgSend(UInteger, self, "retainCount")
|
||||
}
|
||||
|
||||
|
||||
@(objc_type=Object, objc_name="hash")
|
||||
hash :: proc(self: ^Object) -> UInteger {
|
||||
return msgSend(UInteger, self, "hash")
|
||||
}
|
||||
|
||||
@(objc_type=Object, objc_name="isEqual")
|
||||
isEqual :: proc(self, pObject: ^Object) -> BOOL {
|
||||
return msgSend(BOOL, self, "isEqual:", pObject)
|
||||
}
|
||||
|
||||
@(objc_type=Object, objc_name="description")
|
||||
description :: proc(self: ^Object) -> ^String {
|
||||
return msgSend(^String, self, "description")
|
||||
}
|
||||
|
||||
@(objc_type=Object, objc_name="debugDescription")
|
||||
debugDescription :: proc(self: ^Object) -> ^String {
|
||||
if msgSendSafeCheck(self, intrinsics.objc_find_selector("debugDescription")) {
|
||||
return msgSend(^String, self, "debugDescription")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
bridgingCast :: proc($T: typeid, obj: ^Object) where intrinsics.type_is_pointer(T), intrinsics.type_is_subtype_of(T, ^Object) {
|
||||
return (T)(obj)
|
||||
}
|
||||
|
||||
|
||||
@(objc_class="NSCoder")
|
||||
Coder :: struct {using _: Object}
|
||||
// TODO(bill): Implement all the methods for this massive type
|
||||
@@ -1,22 +0,0 @@
|
||||
package objc_Foundation
|
||||
|
||||
Range :: struct {
|
||||
location: UInteger,
|
||||
length: UInteger,
|
||||
}
|
||||
|
||||
Range_Make :: proc(loc, len: UInteger) -> Range {
|
||||
return Range{loc, len}
|
||||
}
|
||||
|
||||
Range_Equal :: proc(a, b: Range) -> BOOL {
|
||||
return a == b
|
||||
}
|
||||
|
||||
Range_LocationInRange :: proc(self: Range, loc: UInteger) -> BOOL {
|
||||
return !((loc < self.location) && ((loc - self.location) < self.length))
|
||||
}
|
||||
|
||||
Range_Max :: proc(self: Range) -> UInteger {
|
||||
return self.location + self.length
|
||||
}
|
||||
@@ -1,136 +0,0 @@
|
||||
package objc_Foundation
|
||||
|
||||
foreign import "system:Foundation.framework"
|
||||
|
||||
@(objc_class="NSString")
|
||||
String :: struct {using _: Copying(String)}
|
||||
|
||||
StringEncoding :: enum UInteger {
|
||||
ASCII = 1,
|
||||
NEXTSTEP = 2,
|
||||
JapaneseEUC = 3,
|
||||
UTF8 = 4,
|
||||
ISOLatin1 = 5,
|
||||
Symbol = 6,
|
||||
NonLossyASCII = 7,
|
||||
ShiftJIS = 8,
|
||||
ISOLatin2 = 9,
|
||||
Unicode = 10,
|
||||
WindowsCP1251 = 11,
|
||||
WindowsCP1252 = 12,
|
||||
WindowsCP1253 = 13,
|
||||
WindowsCP1254 = 14,
|
||||
WindowsCP1250 = 15,
|
||||
ISO2022JP = 21,
|
||||
MacOSRoman = 30,
|
||||
|
||||
UTF16 = Unicode,
|
||||
|
||||
UTF16BigEndian = 0x90000100,
|
||||
UTF16LittleEndian = 0x94000100,
|
||||
|
||||
UTF32 = 0x8c000100,
|
||||
UTF32BigEndian = 0x98000100,
|
||||
UTF32LittleEndian = 0x9c000100,
|
||||
}
|
||||
|
||||
StringCompareOptions :: distinct bit_set[StringCompareOption; UInteger]
|
||||
StringCompareOption :: enum UInteger {
|
||||
CaseInsensitive = 0,
|
||||
LiteralSearch = 1,
|
||||
BackwardsSearch = 2,
|
||||
AnchoredSearch = 3,
|
||||
NumericSearch = 6,
|
||||
DiacriticInsensitive = 7,
|
||||
WidthInsensitive = 8,
|
||||
ForcedOrdering = 9,
|
||||
RegularExpression = 10,
|
||||
}
|
||||
|
||||
unichar :: distinct u16
|
||||
|
||||
|
||||
AT :: MakeConstantString
|
||||
MakeConstantString :: proc "c" (#const c: cstring) -> ^String {
|
||||
foreign Foundation {
|
||||
__CFStringMakeConstantString :: proc "c" (c: cstring) -> ^String ---
|
||||
}
|
||||
return __CFStringMakeConstantString(c)
|
||||
}
|
||||
|
||||
|
||||
@(objc_type=String, objc_name="alloc", objc_is_class_method=true)
|
||||
String_alloc :: proc() -> ^String {
|
||||
return msgSend(^String, String, "alloc")
|
||||
}
|
||||
|
||||
@(objc_type=String, objc_name="init")
|
||||
String_init :: proc(self: ^String) -> ^String {
|
||||
return msgSend(^String, self, "init")
|
||||
}
|
||||
|
||||
|
||||
@(objc_type=String, objc_name="initWithString")
|
||||
String_initWithString :: proc(self: ^String, other: ^String) -> ^String {
|
||||
return msgSend(^String, self, "initWithString:", other)
|
||||
}
|
||||
|
||||
@(objc_type=String, objc_name="initWithCString")
|
||||
String_initWithCString :: proc(self: ^String, pString: cstring, encoding: StringEncoding) -> ^String {
|
||||
return msgSend(^String, self, "initWithCstring:encoding:", pString, encoding)
|
||||
}
|
||||
|
||||
@(objc_type=String, objc_name="initWithBytesNoCopy")
|
||||
String_initWithBytesNoCopy :: proc(self: ^String, pBytes: rawptr, length: UInteger, encoding: StringEncoding, freeWhenDone: bool) -> ^String {
|
||||
return msgSend(^String, self, "initWithBytesNoCopy:length:encoding:freeWhenDone:", pBytes, length, encoding, freeWhenDone)
|
||||
}
|
||||
|
||||
@(objc_type=String, objc_name="initWithOdinString")
|
||||
String_initWithOdinString :: proc(self: ^String, str: string) -> ^String {
|
||||
return String_initWithBytesNoCopy(self, raw_data(str), UInteger(len(str)), .UTF8, false)
|
||||
}
|
||||
|
||||
@(objc_type=String, objc_name="characterAtIndex")
|
||||
String_characterAtIndex :: proc(self: ^String, index: UInteger) -> unichar {
|
||||
return msgSend(unichar, self, "characterAtIndex:", index)
|
||||
}
|
||||
|
||||
@(objc_type=String, objc_name="length")
|
||||
String_length :: proc(self: ^String) -> UInteger {
|
||||
return msgSend(UInteger, self, "length")
|
||||
}
|
||||
|
||||
@(objc_type=String, objc_name="cstringUsingEncoding")
|
||||
String_cstringUsingEncoding :: proc(self: ^String, encoding: StringEncoding) -> cstring {
|
||||
return msgSend(cstring, self, "cStringUsingEncoding:", encoding)
|
||||
}
|
||||
|
||||
@(objc_type=String, objc_name="UTF8String")
|
||||
String_UTF8String :: proc(self: ^String) -> cstring {
|
||||
return msgSend(cstring, self, "UTF8String")
|
||||
}
|
||||
|
||||
@(objc_type=String, objc_name="odinString")
|
||||
String_odinString :: proc(self: ^String) -> string {
|
||||
return string(String_UTF8String(self))
|
||||
}
|
||||
|
||||
@(objc_type=String, objc_name="maximumLengthOfBytesUsingEncoding")
|
||||
String_maximumLengthOfBytesUsingEncoding :: proc(self: ^String, encoding: StringEncoding) -> UInteger {
|
||||
return msgSend(UInteger, self, "maximumLengthOfBytesUsingEncoding:", encoding)
|
||||
}
|
||||
|
||||
@(objc_type=String, objc_name="lengthOfBytesUsingEncoding")
|
||||
String_lengthOfBytesUsingEncoding :: proc(self: ^String, encoding: StringEncoding) -> UInteger {
|
||||
return msgSend(UInteger, self, "lengthOfBytesUsingEncoding:", encoding)
|
||||
}
|
||||
|
||||
@(objc_type=String, objc_name="isEqualToString")
|
||||
String_isEqualToString :: proc(self, other: ^String) -> BOOL {
|
||||
return msgSend(BOOL, self, "isEqualToString:", other)
|
||||
}
|
||||
|
||||
@(objc_type=String, objc_name="rangeOfString")
|
||||
String_rangeOfString :: proc(self, other: ^String, options: StringCompareOptions) -> Range {
|
||||
return msgSend(Range, self, "rangeOfString:options:", other, options)
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
package objc_Foundation
|
||||
|
||||
import "core:intrinsics"
|
||||
|
||||
@(private) msgSend :: intrinsics.objc_send
|
||||
|
||||
id :: ^intrinsics.objc_object
|
||||
SEL :: ^intrinsics.objc_selector
|
||||
Class :: ^intrinsics.objc_class
|
||||
|
||||
TimeInterval :: distinct f64
|
||||
Integer :: distinct int
|
||||
UInteger :: distinct uint
|
||||
|
||||
IntegerMax :: max(Integer)
|
||||
Integermin :: min(Integer)
|
||||
UIntegerMax :: max(UInteger)
|
||||
|
||||
BOOL :: bool // TODO(bill): should this be `distinct`?
|
||||
YES :: true
|
||||
NO :: false
|
||||
|
||||
OperatingSystemVersion :: struct #packed {
|
||||
majorVersion: Integer,
|
||||
minorVersion: Integer,
|
||||
patchVersion: Integer,
|
||||
}
|
||||
|
||||
ComparisonResult :: enum Integer {
|
||||
OrderedAscending = -1,
|
||||
OrderedSame = 0,
|
||||
OrderedDescending = 1,
|
||||
}
|
||||
|
||||
NotFound :: IntegerMax
|
||||
@@ -1,30 +0,0 @@
|
||||
package objc_Foundation
|
||||
|
||||
@(objc_class="NSURL")
|
||||
URL :: struct{using _: Copying(URL)}
|
||||
|
||||
|
||||
@(objc_type=URL, objc_name="alloc", objc_is_class_method=true)
|
||||
URL_alloc :: proc() -> ^URL {
|
||||
return msgSend(^URL, URL, "alloc")
|
||||
}
|
||||
|
||||
@(objc_type=URL, objc_name="init")
|
||||
URL_init :: proc(self: ^URL) -> ^URL {
|
||||
return msgSend(^URL, self, "init")
|
||||
}
|
||||
|
||||
@(objc_type=URL, objc_name="initWithString")
|
||||
URL_initWithString :: proc(self: ^URL, value: ^String) -> ^URL {
|
||||
return msgSend(^URL, self, "initWithString:", value)
|
||||
}
|
||||
|
||||
@(objc_type=URL, objc_name="initFileURLWithPath")
|
||||
URL_initFileURLWithPath :: proc(self: ^URL, path: ^String) -> ^URL {
|
||||
return msgSend(^URL, self, "initFileURLWithPath:", path)
|
||||
}
|
||||
|
||||
@(objc_type=URL, objc_name="fileSystemRepresentation")
|
||||
URL_fileSystemRepresentation :: proc(self: ^URL) -> ^String {
|
||||
return msgSend(^String, self, "fileSystemRepresentation")
|
||||
}
|
||||
@@ -1,74 +0,0 @@
|
||||
package objc_Foundation
|
||||
|
||||
import NS "core:sys/darwin/Foundation"
|
||||
|
||||
Rect :: struct {
|
||||
x, y: f64,
|
||||
width, height: f64,
|
||||
}
|
||||
|
||||
@(objc_class="NSColor")
|
||||
Color :: struct {using _: Object}
|
||||
|
||||
@(objc_class="CALayer")
|
||||
Layer :: struct { using _: NS.Object }
|
||||
|
||||
@(objc_class="NSResponder")
|
||||
Responder :: struct {using _: Object}
|
||||
|
||||
@(objc_class="NSView")
|
||||
View :: struct {using _: Responder}
|
||||
|
||||
@(objc_type=View, objc_name="layer")
|
||||
View_layer :: proc(self: ^View) -> ^Layer {
|
||||
return msgSend(^Layer, self, "layer")
|
||||
}
|
||||
@(objc_type=View, objc_name="setLayer")
|
||||
View_setLayer :: proc(self: ^View, layer: ^Layer) {
|
||||
msgSend(nil, self, "setLayer:", layer)
|
||||
}
|
||||
@(objc_type=View, objc_name="setSubLayer")
|
||||
View_setSubLayer :: proc(self: ^View, layer: ^Layer) {
|
||||
msgSend(nil, self, "setSubLayer:", layer)
|
||||
}
|
||||
@(objc_type=View, objc_name="wantsLayer")
|
||||
View_wantsLayer :: proc(self: ^View) -> BOOL {
|
||||
return msgSend(BOOL, self, "wantsLayer")
|
||||
}
|
||||
@(objc_type=View, objc_name="setWantsLayer")
|
||||
View_setWantsLayer :: proc(self: ^View, wantsLayer: BOOL) {
|
||||
msgSend(nil, self, "setWantsLayer:", wantsLayer)
|
||||
}
|
||||
|
||||
|
||||
@(objc_class="NSWindow")
|
||||
Window :: struct {using _: Responder}
|
||||
|
||||
@(objc_type=Window, objc_name="contentView")
|
||||
Window_contentView :: proc(self: ^Window) -> ^View {
|
||||
return msgSend(^View, self, "contentView")
|
||||
}
|
||||
@(objc_type=Window, objc_name="frame")
|
||||
Window_frame :: proc(self: ^Window) -> Rect {
|
||||
return msgSend(Rect, self, "frame")
|
||||
}
|
||||
@(objc_type=Window, objc_name="setFrame")
|
||||
Window_setFrame :: proc(self: ^Window, frame: Rect) {
|
||||
msgSend(nil, self, "setFrame:", frame)
|
||||
}
|
||||
@(objc_type=Window, objc_name="opaque")
|
||||
Window_opaque :: proc(self: ^Window) -> NS.BOOL {
|
||||
return msgSend(NS.BOOL, self, "opaque")
|
||||
}
|
||||
@(objc_type=Window, objc_name="setOpaque")
|
||||
Window_setOpaque :: proc(self: ^Window, ok: NS.BOOL) {
|
||||
msgSend(nil, self, "setOpaque:", ok)
|
||||
}
|
||||
@(objc_type=Window, objc_name="backgroundColor")
|
||||
Window_backgroundColor :: proc(self: ^Window) -> ^NS.Color {
|
||||
return msgSend(^NS.Color, self, "backgroundColor")
|
||||
}
|
||||
@(objc_type=Window, objc_name="setBackgroundColor")
|
||||
Window_setBackgroundColor :: proc(self: ^Window, color: ^NS.Color) {
|
||||
msgSend(nil, self, "setBackgroundColor:", color)
|
||||
}
|
||||
Reference in New Issue
Block a user