Browse Source

Update Foundation linking

gingerBill 3 years ago
parent
commit
42a1c58a80

+ 16 - 16
core/sys/darwin/Foundation/NSError.odin

@@ -5,27 +5,27 @@ foreign import "system:Foundation.framework"
 ErrorDomain :: ^String
 
 foreign Foundation {
-	CocoaErrorDomain:    ErrorDomain
-	POSIXErrorDomain:    ErrorDomain
-	OSStatusErrorDomain: ErrorDomain
-	MachErrorDomain:     ErrorDomain
+	@(linkage="weak") CocoaErrorDomain:    ErrorDomain
+	@(linkage="weak") POSIXErrorDomain:    ErrorDomain
+	@(linkage="weak") OSStatusErrorDomain: ErrorDomain
+	@(linkage="weak") MachErrorDomain:     ErrorDomain
 }
 
 ErrorUserInfoKey :: ^String
 
 foreign Foundation {
-	UnderlyingErrorKey:                  ErrorUserInfoKey
-	LocalizedDescriptionKey:             ErrorUserInfoKey
-	LocalizedFailureReasonErrorKey:      ErrorUserInfoKey
-	LocalizedRecoverySuggestionErrorKey: ErrorUserInfoKey
-	LocalizedRecoveryOptionsErrorKey:    ErrorUserInfoKey
-	RecoveryAttempterErrorKey:           ErrorUserInfoKey
-	HelpAnchorErrorKey:                  ErrorUserInfoKey
-	DebugDescriptionErrorKey:            ErrorUserInfoKey
-	LocalizedFailureErrorKey:            ErrorUserInfoKey
-	StringEncodingErrorKey:              ErrorUserInfoKey
-	URLErrorKey:                         ErrorUserInfoKey
-	FilePathErrorKey:                    ErrorUserInfoKey
+	@(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")

+ 15 - 15
core/sys/darwin/Foundation/NSNumber.odin

@@ -16,8 +16,8 @@ Value_valueWithPointer :: proc(pointer: rawptr) -> ^Value {
 	return msgSend(^Value, Value, "valueWithPointer:", pointer)
 }
 
-Value_initWithBytes :: proc(value: rawptr, type: cstring) -> ^Value {
-	return msgSend(^Value, Value, "initWithBytes:objCType:", value, type)
+Value_initWithBytes :: proc(self: ^Value, value: rawptr, type: cstring) -> ^Value {
+	return msgSend(^Value, self, "initWithBytes:objCType:", value, type)
 }
 
 Value_initWithCoder :: proc(coder: ^Coder) -> ^Value {
@@ -46,19 +46,19 @@ Value_pointerValue :: proc(self: ^Value) -> rawptr {
 Number :: struct{using _: Copying(Number), using _: Value}
 
 
-Number_numberWithI8               :: proc(value: i8)   -> ^Number { return msgSend(^Number, Number, "numberWithChar:",             value) }
-Number_numberWithU8               :: proc(value: u8)   -> ^Number { return msgSend(^Number, Number, "numberWithUnsignedChar:",     value) }
-Number_numberWithI16              :: proc(value: i16)  -> ^Number { return msgSend(^Number, Number, "numberWithShort:",            value) }
-Number_numberWithU16              :: proc(value: u16)  -> ^Number { return msgSend(^Number, Number, "numberWithUnsignedShort:",    value) }
-Number_numberWithI32              :: proc(value: i32)  -> ^Number { return msgSend(^Number, Number, "numberWithInt:",              value) }
-Number_numberWithU32              :: proc(value: u32)  -> ^Number { return msgSend(^Number, Number, "numberWithUnsignedInt:",      value) }
-Number_numberWithInt              :: proc(value: int)  -> ^Number { return msgSend(^Number, Number, "numberWithLong:",             value) }
-Number_numberWithUint             :: proc(value: uint) -> ^Number { return msgSend(^Number, Number, "numberWithUnsignedLong:",     value) }
-Number_numberWithU64              :: proc(value: u64)  -> ^Number { return msgSend(^Number, Number, "numberWithLongLong:",         value) }
-Number_numberWithI64              :: proc(value: i64)  -> ^Number { return msgSend(^Number, Number, "numberWithUnsignedLongLong:", value) }
-Number_numberWithF32              :: proc(value: f32)  -> ^Number { return msgSend(^Number, Number, "numberWithFloat:",            value) }
-Number_numberWithF64              :: proc(value: f64)  -> ^Number { return msgSend(^Number, Number, "numberWithDouble:",           value) }
-Number_numberWithBool             :: proc(value: BOOL) -> ^Number { return msgSend(^Number, Number, "numberWithBool:",             value) }
+Number_numberWithI8   :: proc(value: i8)   -> ^Number { return msgSend(^Number, Number, "numberWithChar:",             value) }
+Number_numberWithU8   :: proc(value: u8)   -> ^Number { return msgSend(^Number, Number, "numberWithUnsignedChar:",     value) }
+Number_numberWithI16  :: proc(value: i16)  -> ^Number { return msgSend(^Number, Number, "numberWithShort:",            value) }
+Number_numberWithU16  :: proc(value: u16)  -> ^Number { return msgSend(^Number, Number, "numberWithUnsignedShort:",    value) }
+Number_numberWithI32  :: proc(value: i32)  -> ^Number { return msgSend(^Number, Number, "numberWithInt:",              value) }
+Number_numberWithU32  :: proc(value: u32)  -> ^Number { return msgSend(^Number, Number, "numberWithUnsignedInt:",      value) }
+Number_numberWithInt  :: proc(value: int)  -> ^Number { return msgSend(^Number, Number, "numberWithLong:",             value) }
+Number_numberWithUint :: proc(value: uint) -> ^Number { return msgSend(^Number, Number, "numberWithUnsignedLong:",     value) }
+Number_numberWithU64  :: proc(value: u64)  -> ^Number { return msgSend(^Number, Number, "numberWithLongLong:",         value) }
+Number_numberWithI64  :: proc(value: i64)  -> ^Number { return msgSend(^Number, Number, "numberWithUnsignedLongLong:", value) }
+Number_numberWithF32  :: proc(value: f32)  -> ^Number { return msgSend(^Number, Number, "numberWithFloat:",            value) }
+Number_numberWithF64  :: proc(value: f64)  -> ^Number { return msgSend(^Number, Number, "numberWithDouble:",           value) }
+Number_numberWithBool :: proc(value: BOOL) -> ^Number { return msgSend(^Number, Number, "numberWithBool:",             value) }
 
 Number_number :: proc{
 	Number_numberWithI8,

+ 1 - 1
core/sys/darwin/Foundation/NSObject.odin

@@ -24,7 +24,7 @@ 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){
+init :: proc(self: ^$T) -> ^T where intrinsics.type_is_subtype_of(T, Object) {
 	return msgSend(^T, self, "init")
 }
 retain :: proc(self: ^$T) -> ^T where intrinsics.type_is_subtype_of(T, Object) {