mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-02 12:48:14 +00:00
Merge branch 'master' into macharena
This commit is contained in:
@@ -1,7 +1,5 @@
|
||||
package CoreFoundation
|
||||
|
||||
import "base:runtime"
|
||||
|
||||
foreign import CoreFoundation "system:CoreFoundation.framework"
|
||||
|
||||
String :: distinct TypeRef // same as CFStringRef
|
||||
@@ -9,157 +7,157 @@ String :: distinct TypeRef // same as CFStringRef
|
||||
StringEncoding :: distinct u32
|
||||
|
||||
StringBuiltInEncodings :: enum StringEncoding {
|
||||
MacRoman = 0,
|
||||
MacRoman = 0,
|
||||
WindowsLatin1 = 0x0500,
|
||||
ISOLatin1 = 0x0201,
|
||||
ISOLatin1 = 0x0201,
|
||||
NextStepLatin = 0x0B01,
|
||||
ASCII = 0x0600,
|
||||
Unicode = 0x0100,
|
||||
UTF8 = 0x08000100,
|
||||
ASCII = 0x0600,
|
||||
Unicode = 0x0100,
|
||||
UTF8 = 0x08000100,
|
||||
NonLossyASCII = 0x0BFF,
|
||||
|
||||
UTF16 = 0x0100,
|
||||
UTF16 = 0x0100,
|
||||
UTF16BE = 0x10000100,
|
||||
UTF16LE = 0x14000100,
|
||||
|
||||
UTF32 = 0x0c000100,
|
||||
UTF32BE = 0x18000100,
|
||||
UTF32LE = 0x1c000100,
|
||||
UTF32 = 0x0c000100,
|
||||
UTF32BE = 0x18000100,
|
||||
UTF32LE = 0x1c000100,
|
||||
}
|
||||
|
||||
StringEncodings :: enum Index {
|
||||
MacJapanese = 1,
|
||||
MacChineseTrad = 2,
|
||||
MacKorean = 3,
|
||||
MacArabic = 4,
|
||||
MacHebrew = 5,
|
||||
MacGreek = 6,
|
||||
MacCyrillic = 7,
|
||||
MacDevanagari = 9,
|
||||
MacGurmukhi = 10,
|
||||
MacGujarati = 11,
|
||||
MacOriya = 12,
|
||||
MacBengali = 13,
|
||||
MacTamil = 14,
|
||||
MacTelugu = 15,
|
||||
MacKannada = 16,
|
||||
MacMalayalam = 17,
|
||||
MacSinhalese = 18,
|
||||
MacBurmese = 19,
|
||||
MacKhmer = 20,
|
||||
MacThai = 21,
|
||||
MacLaotian = 22,
|
||||
MacGeorgian = 23,
|
||||
MacArmenian = 24,
|
||||
MacChineseSimp = 25,
|
||||
MacTibetan = 26,
|
||||
MacMongolian = 27,
|
||||
MacEthiopic = 28,
|
||||
MacCentralEurRoman = 29,
|
||||
MacVietnamese = 30,
|
||||
MacExtArabic = 31,
|
||||
MacSymbol = 33,
|
||||
MacDingbats = 34,
|
||||
MacTurkish = 35,
|
||||
MacCroatian = 36,
|
||||
MacIcelandic = 37,
|
||||
MacRomanian = 38,
|
||||
MacCeltic = 39,
|
||||
MacGaelic = 40,
|
||||
MacFarsi = 0x8C,
|
||||
MacUkrainian = 0x98,
|
||||
MacInuit = 0xEC,
|
||||
MacVT100 = 0xFC,
|
||||
MacHFS = 0xFF,
|
||||
ISOLatin2 = 0x0202,
|
||||
ISOLatin3 = 0x0203,
|
||||
ISOLatin4 = 0x0204,
|
||||
ISOLatinCyrillic = 0x0205,
|
||||
ISOLatinArabic = 0x0206,
|
||||
ISOLatinGreek = 0x0207,
|
||||
ISOLatinHebrew = 0x0208,
|
||||
ISOLatin5 = 0x0209,
|
||||
ISOLatin6 = 0x020A,
|
||||
ISOLatinThai = 0x020B,
|
||||
ISOLatin7 = 0x020D,
|
||||
ISOLatin8 = 0x020E,
|
||||
ISOLatin9 = 0x020F,
|
||||
ISOLatin10 = 0x0210,
|
||||
DOSLatinUS = 0x0400,
|
||||
DOSGreek = 0x0405,
|
||||
DOSBalticRim = 0x0406,
|
||||
DOSLatin1 = 0x0410,
|
||||
DOSGreek1 = 0x0411,
|
||||
DOSLatin2 = 0x0412,
|
||||
DOSCyrillic = 0x0413,
|
||||
DOSTurkish = 0x0414,
|
||||
DOSPortuguese = 0x0415,
|
||||
DOSIcelandic = 0x0416,
|
||||
DOSHebrew = 0x0417,
|
||||
DOSCanadianFrench = 0x0418,
|
||||
DOSArabic = 0x0419,
|
||||
DOSNordic = 0x041A,
|
||||
DOSRussian = 0x041B,
|
||||
DOSGreek2 = 0x041C,
|
||||
DOSThai = 0x041D,
|
||||
DOSJapanese = 0x0420,
|
||||
DOSChineseSimplif = 0x0421,
|
||||
DOSKorean = 0x0422,
|
||||
DOSChineseTrad = 0x0423,
|
||||
WindowsLatin2 = 0x0501,
|
||||
WindowsCyrillic = 0x0502,
|
||||
WindowsGreek = 0x0503,
|
||||
WindowsLatin5 = 0x0504,
|
||||
WindowsHebrew = 0x0505,
|
||||
WindowsArabic = 0x0506,
|
||||
WindowsBalticRim = 0x0507,
|
||||
WindowsVietnamese = 0x0508,
|
||||
WindowsKoreanJohab = 0x0510,
|
||||
ANSEL = 0x0601,
|
||||
JIS_X0201_76 = 0x0620,
|
||||
JIS_X0208_83 = 0x0621,
|
||||
JIS_X0208_90 = 0x0622,
|
||||
JIS_X0212_90 = 0x0623,
|
||||
JIS_C6226_78 = 0x0624,
|
||||
ShiftJIS_X0213 = 0x0628,
|
||||
ShiftJIS_X0213_MenKuTen = 0x0629,
|
||||
GB_2312_80 = 0x0630,
|
||||
GBK_95 = 0x0631,
|
||||
GB_18030_2000 = 0x0632,
|
||||
KSC_5601_87 = 0x0640,
|
||||
KSC_5601_92_Johab = 0x0641,
|
||||
CNS_11643_92_P1 = 0x0651,
|
||||
CNS_11643_92_P2 = 0x0652,
|
||||
CNS_11643_92_P3 = 0x0653,
|
||||
ISO_2022_JP = 0x0820,
|
||||
ISO_2022_JP_2 = 0x0821,
|
||||
ISO_2022_JP_1 = 0x0822,
|
||||
ISO_2022_JP_3 = 0x0823,
|
||||
ISO_2022_CN = 0x0830,
|
||||
ISO_2022_CN_EXT = 0x0831,
|
||||
ISO_2022_KR = 0x0840,
|
||||
EUC_JP = 0x0920,
|
||||
EUC_CN = 0x0930,
|
||||
EUC_TW = 0x0931,
|
||||
EUC_KR = 0x0940,
|
||||
ShiftJIS = 0x0A01,
|
||||
KOI8_R = 0x0A02,
|
||||
Big5 = 0x0A03,
|
||||
MacRomanLatin1 = 0x0A04,
|
||||
HZ_GB_2312 = 0x0A05,
|
||||
Big5_HKSCS_1999 = 0x0A06,
|
||||
VISCII = 0x0A07,
|
||||
KOI8_U = 0x0A08,
|
||||
Big5_E = 0x0A09,
|
||||
NextStepJapanese = 0x0B02,
|
||||
EBCDIC_US = 0x0C01,
|
||||
EBCDIC_CP037 = 0x0C02,
|
||||
UTF7 = 0x04000100,
|
||||
UTF7_IMAP = 0x0A10,
|
||||
ShiftJIS_X0213_00 = 0x0628, // Deprecated. Use `ShiftJIS_X0213` instead.
|
||||
MacJapanese = 1,
|
||||
MacChineseTrad = 2,
|
||||
MacKorean = 3,
|
||||
MacArabic = 4,
|
||||
MacHebrew = 5,
|
||||
MacGreek = 6,
|
||||
MacCyrillic = 7,
|
||||
MacDevanagari = 9,
|
||||
MacGurmukhi = 10,
|
||||
MacGujarati = 11,
|
||||
MacOriya = 12,
|
||||
MacBengali = 13,
|
||||
MacTamil = 14,
|
||||
MacTelugu = 15,
|
||||
MacKannada = 16,
|
||||
MacMalayalam = 17,
|
||||
MacSinhalese = 18,
|
||||
MacBurmese = 19,
|
||||
MacKhmer = 20,
|
||||
MacThai = 21,
|
||||
MacLaotian = 22,
|
||||
MacGeorgian = 23,
|
||||
MacArmenian = 24,
|
||||
MacChineseSimp = 25,
|
||||
MacTibetan = 26,
|
||||
MacMongolian = 27,
|
||||
MacEthiopic = 28,
|
||||
MacCentralEurRoman = 29,
|
||||
MacVietnamese = 30,
|
||||
MacExtArabic = 31,
|
||||
MacSymbol = 33,
|
||||
MacDingbats = 34,
|
||||
MacTurkish = 35,
|
||||
MacCroatian = 36,
|
||||
MacIcelandic = 37,
|
||||
MacRomanian = 38,
|
||||
MacCeltic = 39,
|
||||
MacGaelic = 40,
|
||||
MacFarsi = 0x8C,
|
||||
MacUkrainian = 0x98,
|
||||
MacInuit = 0xEC,
|
||||
MacVT100 = 0xFC,
|
||||
MacHFS = 0xFF,
|
||||
ISOLatin2 = 0x0202,
|
||||
ISOLatin3 = 0x0203,
|
||||
ISOLatin4 = 0x0204,
|
||||
ISOLatinCyrillic = 0x0205,
|
||||
ISOLatinArabic = 0x0206,
|
||||
ISOLatinGreek = 0x0207,
|
||||
ISOLatinHebrew = 0x0208,
|
||||
ISOLatin5 = 0x0209,
|
||||
ISOLatin6 = 0x020A,
|
||||
ISOLatinThai = 0x020B,
|
||||
ISOLatin7 = 0x020D,
|
||||
ISOLatin8 = 0x020E,
|
||||
ISOLatin9 = 0x020F,
|
||||
ISOLatin10 = 0x0210,
|
||||
DOSLatinUS = 0x0400,
|
||||
DOSGreek = 0x0405,
|
||||
DOSBalticRim = 0x0406,
|
||||
DOSLatin1 = 0x0410,
|
||||
DOSGreek1 = 0x0411,
|
||||
DOSLatin2 = 0x0412,
|
||||
DOSCyrillic = 0x0413,
|
||||
DOSTurkish = 0x0414,
|
||||
DOSPortuguese = 0x0415,
|
||||
DOSIcelandic = 0x0416,
|
||||
DOSHebrew = 0x0417,
|
||||
DOSCanadianFrench = 0x0418,
|
||||
DOSArabic = 0x0419,
|
||||
DOSNordic = 0x041A,
|
||||
DOSRussian = 0x041B,
|
||||
DOSGreek2 = 0x041C,
|
||||
DOSThai = 0x041D,
|
||||
DOSJapanese = 0x0420,
|
||||
DOSChineseSimplif = 0x0421,
|
||||
DOSKorean = 0x0422,
|
||||
DOSChineseTrad = 0x0423,
|
||||
WindowsLatin2 = 0x0501,
|
||||
WindowsCyrillic = 0x0502,
|
||||
WindowsGreek = 0x0503,
|
||||
WindowsLatin5 = 0x0504,
|
||||
WindowsHebrew = 0x0505,
|
||||
WindowsArabic = 0x0506,
|
||||
WindowsBalticRim = 0x0507,
|
||||
WindowsVietnamese = 0x0508,
|
||||
WindowsKoreanJohab = 0x0510,
|
||||
ANSEL = 0x0601,
|
||||
JIS_X0201_76 = 0x0620,
|
||||
JIS_X0208_83 = 0x0621,
|
||||
JIS_X0208_90 = 0x0622,
|
||||
JIS_X0212_90 = 0x0623,
|
||||
JIS_C6226_78 = 0x0624,
|
||||
ShiftJIS_X0213 = 0x0628,
|
||||
ShiftJIS_X0213_MenKuTen = 0x0629,
|
||||
GB_2312_80 = 0x0630,
|
||||
GBK_95 = 0x0631,
|
||||
GB_18030_2000 = 0x0632,
|
||||
KSC_5601_87 = 0x0640,
|
||||
KSC_5601_92_Johab = 0x0641,
|
||||
CNS_11643_92_P1 = 0x0651,
|
||||
CNS_11643_92_P2 = 0x0652,
|
||||
CNS_11643_92_P3 = 0x0653,
|
||||
ISO_2022_JP = 0x0820,
|
||||
ISO_2022_JP_2 = 0x0821,
|
||||
ISO_2022_JP_1 = 0x0822,
|
||||
ISO_2022_JP_3 = 0x0823,
|
||||
ISO_2022_CN = 0x0830,
|
||||
ISO_2022_CN_EXT = 0x0831,
|
||||
ISO_2022_KR = 0x0840,
|
||||
EUC_JP = 0x0920,
|
||||
EUC_CN = 0x0930,
|
||||
EUC_TW = 0x0931,
|
||||
EUC_KR = 0x0940,
|
||||
ShiftJIS = 0x0A01,
|
||||
KOI8_R = 0x0A02,
|
||||
Big5 = 0x0A03,
|
||||
MacRomanLatin1 = 0x0A04,
|
||||
HZ_GB_2312 = 0x0A05,
|
||||
Big5_HKSCS_1999 = 0x0A06,
|
||||
VISCII = 0x0A07,
|
||||
KOI8_U = 0x0A08,
|
||||
Big5_E = 0x0A09,
|
||||
NextStepJapanese = 0x0B02,
|
||||
EBCDIC_US = 0x0C01,
|
||||
EBCDIC_CP037 = 0x0C02,
|
||||
UTF7 = 0x04000100,
|
||||
UTF7_IMAP = 0x0A10,
|
||||
ShiftJIS_X0213_00 = 0x0628, // Deprecated. Use `ShiftJIS_X0213` instead.
|
||||
}
|
||||
|
||||
@(link_prefix = "CF", default_calling_convention = "c")
|
||||
@(link_prefix="CF", default_calling_convention="c")
|
||||
foreign CoreFoundation {
|
||||
// Copies the character contents of a string to a local C string buffer after converting the characters to a given encoding.
|
||||
StringGetCString :: proc(theString: String, buffer: [^]byte, bufferSize: Index, encoding: StringEncoding) -> b8 ---
|
||||
@@ -181,23 +179,16 @@ foreign CoreFoundation {
|
||||
|
||||
STR :: StringMakeConstantString
|
||||
|
||||
StringCopyToOdinString :: proc(
|
||||
theString: String,
|
||||
allocator := context.allocator,
|
||||
) -> (
|
||||
str: string,
|
||||
ok: bool,
|
||||
) #optional_ok {
|
||||
StringCopyToOdinString :: proc(theString: String, allocator := context.allocator) -> (str: string, ok: bool) #optional_ok {
|
||||
length := StringGetLength(theString)
|
||||
max := StringGetMaximumSizeForEncoding(length, StringEncoding(StringBuiltInEncodings.UTF8))
|
||||
|
||||
buf, err := make([]byte, max, allocator)
|
||||
if err != nil { return }
|
||||
|
||||
raw_str := runtime.Raw_String {
|
||||
data = raw_data(buf),
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
StringGetBytes(theString, {0, length}, StringEncoding(StringBuiltInEncodings.UTF8), 0, false, raw_data(buf), max, (^Index)(&raw_str.len))
|
||||
|
||||
return transmute(string)raw_str, true
|
||||
n: Index
|
||||
StringGetBytes(theString, {0, length}, StringEncoding(StringBuiltInEncodings.UTF8), 0, false, raw_data(buf), Index(len(buf)), &n)
|
||||
return string(buf[:n]), true
|
||||
}
|
||||
|
||||
@@ -79,7 +79,10 @@ Application_setActivationPolicy :: proc "c" (self: ^Application, activationPolic
|
||||
return msgSend(BOOL, self, "setActivationPolicy:", activationPolicy)
|
||||
}
|
||||
|
||||
@(deprecated="Use NSApplication method activate instead.")
|
||||
// NOTE: this is technically deprecated but still actively used (Sokol, glfw, SDL, etc.)
|
||||
// and has no clear alternative although `activate` is what Apple tells you to use,
|
||||
// that does not work the same way.
|
||||
// @(deprecated="Use NSApplication method activate instead.")
|
||||
@(objc_type=Application, objc_name="activateIgnoringOtherApps")
|
||||
Application_activateIgnoringOtherApps :: proc "c" (self: ^Application, ignoreOtherApps: BOOL) {
|
||||
msgSend(nil, self, "activateIgnoringOtherApps:", ignoreOtherApps)
|
||||
|
||||
@@ -5,8 +5,8 @@ Event :: struct {using _: Object}
|
||||
|
||||
|
||||
|
||||
EventMask :: distinct bit_set[EventType; UInteger]
|
||||
EventMaskAny :: ~EventMask{}
|
||||
EventMask :: distinct bit_set[EventType; UInteger]
|
||||
EventMaskAny :: transmute(EventMask)(max(UInteger))
|
||||
|
||||
when size_of(UInteger) == 4 {
|
||||
// We don't support a 32-bit darwin system but this is mostly to shut up the type checker for the time being
|
||||
|
||||
@@ -58,7 +58,10 @@ MakeConstantString :: proc "c" (#const c: cstring) -> ^String {
|
||||
|
||||
@(link_prefix="NS", default_calling_convention="c")
|
||||
foreign Foundation {
|
||||
StringFromClass :: proc(cls: Class) -> ^String ---
|
||||
StringFromClass :: proc(cls: Class) -> ^String ---
|
||||
ClassFromString :: proc(str: ^String) -> Class ---
|
||||
StringFromSelector :: proc(selector: SEL) -> ^String ---
|
||||
SelectorFromString :: proc(str: ^String) -> SEL ---
|
||||
}
|
||||
|
||||
@(objc_type=String, objc_name="alloc", objc_is_class_method=true)
|
||||
|
||||
@@ -9,24 +9,85 @@ import "core:c"
|
||||
|
||||
IMP :: proc "c" (object: id, sel: SEL, #c_vararg args: ..any) -> id
|
||||
|
||||
@(default_calling_convention="c")
|
||||
foreign Foundation {
|
||||
objc_getMetaClass :: proc "c" (name: cstring) -> id ---
|
||||
objc_lookUpClass :: proc "c" (name: cstring) -> Class ---
|
||||
objc_allocateClassPair :: proc "c" (superclass : Class, name : cstring, extraBytes : c.size_t) -> Class ---
|
||||
objc_registerClassPair :: proc "c" (cls : Class) ---
|
||||
objc_getMetaClass :: proc(name: cstring) -> id ---
|
||||
objc_lookUpClass :: proc(name: cstring) -> Class ---
|
||||
objc_allocateClassPair :: proc(superclass: Class, name: cstring, extraBytes: c.size_t) -> Class ---
|
||||
objc_registerClassPair :: proc(cls: Class) ---
|
||||
objc_disposeClassPair :: proc(cls: Class) ---
|
||||
objc_duplicateClass :: proc(original: Class, name: cstring, extraBytes: c.size_t) -> Class ---
|
||||
objc_getProtocol :: proc(name: cstring) -> ^Protocol ---
|
||||
objc_copyProtocolList :: proc(outCount: ^uint) -> [^]^Protocol ---
|
||||
objc_constructInstance :: proc(cls: Class, bytes: rawptr) -> id ---
|
||||
objc_destructInstance :: proc(obj: id) -> rawptr ---
|
||||
objc_getClassList :: proc(buffer: [^]Class, bufferCount: int) -> int ---
|
||||
objc_copyClassList :: proc(outCount: ^uint) -> [^]Class ---
|
||||
objc_getRequiredClass :: proc(name: cstring) -> Class ---
|
||||
objc_setAssociatedObject :: proc(object: id, key: rawptr, value: id, policy: objc_AssociationPolicy) ---
|
||||
objc_getAssociatedObject :: proc(object: id, key: rawptr) -> id ---
|
||||
objc_removeAssociatedObjects :: proc(object: id) ---
|
||||
|
||||
sel_registerName :: proc "c" (name: cstring) -> SEL ---
|
||||
sel_registerName :: proc(name: cstring) -> SEL ---
|
||||
sel_getName :: proc(sel: SEL) -> cstring ---
|
||||
sel_isEqual :: proc(lhs, rhs: SEL) -> BOOL ---
|
||||
|
||||
class_addMethod :: proc "c" (cls: Class, name: SEL, imp: IMP, types: cstring) -> BOOL ---
|
||||
class_getInstanceMethod :: proc "c" (cls: Class, name: SEL) -> Method ---
|
||||
class_createInstance :: proc "c" (cls: Class, extraBytes: c.size_t) -> id ---
|
||||
class_addMethod :: proc(cls: Class, name: SEL, imp: IMP, types: cstring) -> BOOL ---
|
||||
class_getInstanceMethod :: proc(cls: Class, name: SEL) -> Method ---
|
||||
class_getClassMethod :: proc(cls: Class, name: SEL) -> Method ---
|
||||
class_copyMethodList :: proc(cls: Class, outCount: ^uint) -> [^]Method ---
|
||||
class_createInstance :: proc(cls: Class, extraBytes: c.size_t) -> id ---
|
||||
class_replaceMethod :: proc(cls: Class, name: SEL, imp: IMP, types: cstring) -> IMP ---
|
||||
class_getMethodImplementation :: proc(cls: Class, name: SEL) -> IMP ---
|
||||
class_getSuperclass :: proc(cls: Class) -> Class ---
|
||||
class_getName :: proc(cls: Class) -> cstring ---
|
||||
class_isMetaClass :: proc(cls: Class) -> BOOL ---
|
||||
class_addProtocol :: proc(cls: Class, protocol: ^Protocol) -> BOOL ---
|
||||
class_getVersion :: proc(cls: Class) -> c.int ---
|
||||
class_setVersion :: proc(cls: Class, version: c.int) ---
|
||||
class_getProperty :: proc(cls: Class, name: cstring) -> objc_property_t ---
|
||||
class_addProperty :: proc(cls: Class, name: cstring, attributes: [^]objc_property_attribute_t, attributeCount: uint) -> BOOL ---
|
||||
class_replaceProperty :: proc(cls: Class, name: cstring, attributes: [^]objc_property_attribute_t, attributeCount: uint) ---
|
||||
class_copyPropertyList :: proc(cls: Class, outCount: ^uint) -> [^]objc_property_t ---
|
||||
class_conformsToProtocol :: proc(cls: Class, protocol: ^Protocol) -> BOOL ---
|
||||
class_copyProtocolList :: proc(cls: Class, outCount: ^uint) -> [^]^Protocol ---
|
||||
class_respondsToSelector :: proc(cls: Class, sel: SEL) -> BOOL ---
|
||||
class_getClassVariable :: proc(cls: Class, name: cstring) -> Ivar ---
|
||||
class_getInstanceVariable :: proc(cls: Class, name: cstring) -> Ivar ---
|
||||
class_addIvar :: proc(cls: Class, name: cstring, size: c.size_t, alignment: u8, types: cstring) -> BOOL ---
|
||||
class_copyIvarList :: proc(cls: Class, outCount: ^uint) -> [^]Ivar ---
|
||||
class_getInstanceSize :: proc(cls: Class) -> c.size_t ---
|
||||
|
||||
method_setImplementation :: proc "c" (method: Method, imp: IMP) ---
|
||||
property_getName :: proc(property: objc_property_t) -> cstring ---
|
||||
property_getAttributes :: proc(property: objc_property_t) -> cstring ---
|
||||
property_copyAttributeList :: proc(property: objc_property_t, outCount: ^uint) -> [^]objc_property_attribute_t ---
|
||||
property_copyAttributeValue :: proc(property: objc_property_t, attributeName: cstring) -> cstring ---
|
||||
|
||||
object_getClass :: proc "c" (obj: id) -> Class ---
|
||||
object_setClass :: proc "c" (obj: id, cls: Class) -> Class ---
|
||||
object_getClassName :: proc "c" (obj: id) -> cstring ---
|
||||
object_getIndexedIvars :: proc "c" (obj: id) -> rawptr ---
|
||||
protocol_conformsToProtocol :: proc(proto: ^Protocol, other: ^Protocol) -> BOOL ---
|
||||
protocol_isEqual :: proc(proto: ^Protocol, other: ^Protocol) -> BOOL ---
|
||||
protocol_getName :: proc(proto: ^Protocol) -> cstring ---
|
||||
|
||||
method_getImplementation :: proc(m: Method) -> IMP ---
|
||||
method_setImplementation :: proc(m: Method, imp: IMP) ---
|
||||
method_copyArgumentType :: proc(m: Method, index: uint) -> cstring ---
|
||||
method_getReturnType :: proc(m: Method, dst: cstring, dst_len: c.size_t) ---
|
||||
method_getNumberOfArguments :: proc(m: Method) -> uint ---
|
||||
method_getArgumentType :: proc(m: Method, index: uint, dst: cstring, dst_len: c.size_t) ---
|
||||
|
||||
object_getClass :: proc(obj: id) -> Class ---
|
||||
object_setClass :: proc(obj: id, cls: Class) -> Class ---
|
||||
object_copy :: proc(obj: id, size: c.size_t) -> id ---
|
||||
object_dispose :: proc(obj: id) -> id ---
|
||||
object_getClassName :: proc(obj: id) -> cstring ---
|
||||
object_getIndexedIvars :: proc(obj: id) -> rawptr ---
|
||||
object_getInstanceVariable :: proc(obj: id, name: cstring, outValue: rawptr) -> Ivar ---
|
||||
object_setInstanceVariable :: proc(obj: id, name: cstring, value: rawptr) -> Ivar ---
|
||||
object_getIvar :: proc(obj: id, ivar: Ivar) -> id ---
|
||||
object_setIvar :: proc(obj: id, ivar: Ivar, value: id) ---
|
||||
|
||||
ivar_getName :: proc(v: Ivar) -> cstring ---
|
||||
ivar_getTypeEncoding :: proc(v: Ivar) -> cstring ---
|
||||
ivar_getOffset :: proc(v: Ivar) -> c.ptrdiff_t ---
|
||||
}
|
||||
|
||||
|
||||
@@ -47,7 +108,17 @@ objc_method :: struct {
|
||||
}
|
||||
objc_method_list :: struct {}
|
||||
|
||||
objc_property :: struct{}
|
||||
objc_property_t :: ^objc_property
|
||||
|
||||
objc_property_attribute_t :: struct {
|
||||
name: cstring,
|
||||
value: cstring,
|
||||
}
|
||||
|
||||
objc_ivar :: struct {}
|
||||
Ivar :: ^objc_ivar
|
||||
|
||||
objc_ivar_list :: struct {}
|
||||
|
||||
objc_cache :: struct {
|
||||
@@ -85,3 +156,11 @@ objc_class_internals :: struct {
|
||||
protocols: rawptr,
|
||||
|
||||
}
|
||||
|
||||
objc_AssociationPolicy :: enum c.uintptr_t {
|
||||
Assign = 0,
|
||||
Retain_Nonatomic = 1,
|
||||
Copy_Nonatomic = 3,
|
||||
Retain = 01401,
|
||||
Copy = 01403,
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//+build darwin
|
||||
#+build darwin
|
||||
package darwin
|
||||
|
||||
import "core:c"
|
||||
|
||||
@@ -5,6 +5,7 @@ foreign import system "system:System.framework"
|
||||
// #define OS_WAIT_ON_ADDR_AVAILABILITY \
|
||||
// __API_AVAILABLE(macos(14.4), ios(17.4), tvos(17.4), watchos(10.4))
|
||||
when ODIN_OS == .Darwin {
|
||||
|
||||
when ODIN_PLATFORM_SUBTARGET == .iOS && ODIN_MINIMUM_OS_VERSION >= 17_04_00 {
|
||||
WAIT_ON_ADDRESS_AVAILABLE :: true
|
||||
} else when ODIN_MINIMUM_OS_VERSION >= 14_04_00 {
|
||||
@@ -12,8 +13,18 @@ when ODIN_OS == .Darwin {
|
||||
} else {
|
||||
WAIT_ON_ADDRESS_AVAILABLE :: false
|
||||
}
|
||||
|
||||
when ODIN_PLATFORM_SUBTARGET == .iOS && ODIN_MINIMUM_OS_VERSION >= 14_00_00 {
|
||||
ULOCK_WAIT_2_AVAILABLE :: true
|
||||
} else when ODIN_MINIMUM_OS_VERSION >= 11_00_00 {
|
||||
ULOCK_WAIT_2_AVAILABLE :: true
|
||||
} else {
|
||||
ULOCK_WAIT_2_AVAILABLE :: false
|
||||
}
|
||||
|
||||
} else {
|
||||
WAIT_ON_ADDRESS_AVAILABLE :: false
|
||||
ULOCK_WAIT_2_AVAILABLE :: false
|
||||
}
|
||||
|
||||
os_sync_wait_on_address_flag :: enum u32 {
|
||||
|
||||
@@ -15,9 +15,9 @@ sys_write_string :: proc (fd: c.int, message: string) -> bool {
|
||||
Offset_From :: enum c.int {
|
||||
SEEK_SET = 0, // the offset is set to offset bytes.
|
||||
SEEK_CUR = 1, // the offset is set to its current location plus offset bytes.
|
||||
SEEK_END = 2, // the offset is set to the size of the file plus offset bytes.
|
||||
SEEK_HOLE = 3, // the offset is set to the start of the next hole greater than or equal to the supplied offset.
|
||||
SEEK_DATA = 4, // the offset is set to the start of the next non-hole file region greater than or equal to the supplied offset.
|
||||
SEEK_END = 2, // the offset is set to the size of the file plus offset bytes.
|
||||
SEEK_HOLE = 3, // the offset is set to the start of the next hole greater than or equal to the supplied offset.
|
||||
SEEK_DATA = 4, // the offset is set to the start of the next non-hole file region greater than or equal to the supplied offset.
|
||||
}
|
||||
|
||||
Open_Flags_Enum :: enum u8 {
|
||||
|
||||
@@ -192,43 +192,43 @@ _STRUCT_TIMEVAL :: struct {
|
||||
|
||||
/* pwd.h */
|
||||
_Password_Entry :: struct {
|
||||
pw_name: cstring, /* username */
|
||||
pw_passwd: cstring, /* user password */
|
||||
pw_uid: i32, /* user ID */
|
||||
pw_gid: i32, /* group ID */
|
||||
pw_name: cstring, /* username */
|
||||
pw_passwd: cstring, /* user password */
|
||||
pw_uid: i32, /* user ID */
|
||||
pw_gid: i32, /* group ID */
|
||||
pw_change: u64, /* password change time */
|
||||
pw_class: cstring, /* user access class */
|
||||
pw_gecos: cstring, /* full user name */
|
||||
pw_dir: cstring, /* home directory */
|
||||
pw_shell: cstring, /* shell program */
|
||||
pw_gecos: cstring, /* full user name */
|
||||
pw_dir: cstring, /* home directory */
|
||||
pw_shell: cstring, /* shell program */
|
||||
pw_expire: u64, /* account expiration */
|
||||
pw_fields: i32, /* filled fields */
|
||||
}
|
||||
|
||||
/* processinfo.h */
|
||||
_Proc_Bsdinfo :: struct {
|
||||
pbi_flags: u32, /* if is 64bit; emulated etc */
|
||||
pbi_status: u32,
|
||||
pbi_xstatus: u32,
|
||||
pbi_pid: u32,
|
||||
pbi_ppid: u32,
|
||||
pbi_uid: u32,
|
||||
pbi_gid: u32,
|
||||
pbi_ruid: u32,
|
||||
pbi_rgid: u32,
|
||||
pbi_svuid: u32,
|
||||
pbi_svgid: u32,
|
||||
res: u32,
|
||||
pbi_comm: [DARWIN_MAXCOMLEN]u8,
|
||||
pbi_name: [2 * DARWIN_MAXCOMLEN]u8, /* empty if no name is registered */
|
||||
pbi_nfiles: u32,
|
||||
pbi_pgid: u32,
|
||||
pbi_pjobc: u32,
|
||||
e_tdev: u32, /* controlling tty dev */
|
||||
e_tpgid: u32, /* tty process group id */
|
||||
pbi_nice: i32,
|
||||
pbi_start_tvsec: u64,
|
||||
pbi_start_tvusec: u64,
|
||||
pbi_flags: u32, /* if is 64bit; emulated etc */
|
||||
pbi_status: u32,
|
||||
pbi_xstatus: u32,
|
||||
pbi_pid: u32,
|
||||
pbi_ppid: u32,
|
||||
pbi_uid: u32,
|
||||
pbi_gid: u32,
|
||||
pbi_ruid: u32,
|
||||
pbi_rgid: u32,
|
||||
pbi_svuid: u32,
|
||||
pbi_svgid: u32,
|
||||
res: u32,
|
||||
pbi_comm: [DARWIN_MAXCOMLEN]u8,
|
||||
pbi_name: [2 * DARWIN_MAXCOMLEN]u8, /* empty if no name is registered */
|
||||
pbi_nfiles: u32,
|
||||
pbi_pgid: u32,
|
||||
pbi_pjobc: u32,
|
||||
e_tdev: u32, /* controlling tty dev */
|
||||
e_tpgid: u32, /* tty process group id */
|
||||
pbi_nice: i32,
|
||||
pbi_start_tvsec: u64,
|
||||
pbi_start_tvusec: u64,
|
||||
}
|
||||
|
||||
/*--==========================================================================--*/
|
||||
|
||||
Reference in New Issue
Block a user