]> gitweb.factorcode.org Git - factor.git/commitdiff
cocoa: Add more cocoa/objc methods. lookup-method -> lookup-objc-method
authorDoug Coleman <doug.coleman@gmail.com>
Thu, 28 Jan 2021 14:21:46 +0000 (08:21 -0600)
committerDoug Coleman <doug.coleman@gmail.com>
Thu, 28 Jan 2021 14:33:04 +0000 (08:33 -0600)
basis/cocoa/cocoa.factor
basis/cocoa/messages/messages.factor
basis/cocoa/runtime/runtime.factor
basis/cocoa/touchbar/touchbar.factor

index a0f2af59e440780f07a8616777d5865d23b6bfd8..1bd2d8bb090e15f1a918ece049ea92c6f7974785 100644 (file)
@@ -13,7 +13,7 @@ sent-messages [ H{ } clone ] initialize
 
 SYNTAX: ->
     scan-token dup remember-send
-    [ lookup-method suffix! ] [ suffix! ] bi \ send suffix! ;
+    [ lookup-objc-method suffix! ] [ suffix! ] bi \ send suffix! ;
 
 SYNTAX: ?->
     dup last cache-stubs
@@ -33,7 +33,7 @@ super-sent-messages [ H{ } clone ] initialize
 
 SYNTAX: SUPER->
     scan-token dup remember-super-send
-    [ lookup-method suffix! ] [ suffix! ] bi \ super-send suffix! ;
+    [ lookup-objc-method suffix! ] [ suffix! ] bi \ super-send suffix! ;
 
 SYMBOL: frameworks
 
@@ -80,6 +80,7 @@ SYNTAX: IMPORT: scan-token [ ] import-objc-class ;
         "NSOpenPanel"
         "NSPanel"
         "NSPasteboard"
+        "NSPopover"
         "NSPropertyListSerialization"
         "NSResponder"
         "NSSavePanel"
index b03bf83080d2e555e10ef8a4c4fe07982203b765..67a5fb1ae4cf04a55bcba4c17384729033f16eb0 100644 (file)
@@ -67,11 +67,11 @@ objc-methods [ H{ } clone ] initialize
 
 ERROR: no-objc-method name ;
 
-: ?lookup-method ( selector -- signature/f )
+: ?lookup-objc-method ( name -- signature/f )
     objc-methods get at ;
 
-: lookup-method ( selector -- signature )
-    dup ?lookup-method [ ] [ no-objc-method ] ?if ;
+: lookup-objc-method ( name -- signature )
+    dup ?lookup-objc-method [ ] [ no-objc-method ] ?if ;
 
 MEMO: make-prepare-send ( selector signature super? -- quot )
     [
index e307304a82accdb5fe58f70740b7db0da169f309..58238c0b4f5248e76a5505c1f624d1d5a578d288 100644 (file)
@@ -1,6 +1,6 @@
 ! Copyright (C) 2006, 2007 Slava Pestov
 ! See http://factorcode.org/license.txt for BSD license.
-USING: alien.c-types alien.syntax classes.struct ;
+USING: alien.c-types alien.syntax classes.struct core-foundation ;
 IN: cocoa.runtime
 
 TYPEDEF: void* SEL
@@ -16,6 +16,7 @@ FUNCTION: SEL sel_registerName ( c-string str )
 TYPEDEF: void* Class
 TYPEDEF: void* Method
 TYPEDEF: void* Protocol
+TYPEDEF: void* Ivar
 
 STRUCT: objc-super
     { receiver id }
@@ -42,6 +43,8 @@ FUNCTION: Protocol objc_getProtocol ( c-string class )
 FUNCTION: Class objc_allocateClassPair ( Class superclass, c-string name, size_t extraBytes )
 FUNCTION: void objc_registerClassPair ( Class cls )
 
+FUNCTION: void* objc_getAssociatedObject ( void* obj, c-string key )
+
 FUNCTION: id class_createInstance ( Class class, uint additionalByteCount )
 
 FUNCTION: id class_createInstanceFromZone ( Class class, uint additionalByteCount, void* zone )
@@ -56,6 +59,14 @@ FUNCTION: Class class_getSuperclass ( Class cls )
 
 FUNCTION: c-string class_getName ( Class cls )
 
+FUNCTION: Boolean class_isMetaClass ( Class cls )
+
+FUNCTION: Method class_getInstanceVariable ( Class class, c-string str )
+
+FUNCTION: Method class_getClassVariable ( Class class, c-string str )
+
+FUNCTION: uint8_t* class_getIvarLayout ( Class class )
+
 FUNCTION: char class_addMethod ( Class class, SEL name, void* imp, void* types )
 
 FUNCTION: char class_addProtocol ( Class class, Protocol protocol )
@@ -74,3 +85,5 @@ FUNCTION: void* method_setImplementation ( Method method, void* imp )
 FUNCTION: void* method_getImplementation ( Method method )
 
 FUNCTION: Class object_getClass ( id object )
+
+FUNCTION: void* object_getIvar ( Class class, Ivar ivar )
\ No newline at end of file
index e040840b9320289355e7e7d91094c9b9e32f909b..6d198f075f2979d83e78630733d29a7b405f70fb 100644 (file)
@@ -1,8 +1,7 @@
 ! Copyright (C) 2017 Doug Coleman.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: alien.c-types cocoa cocoa.classes cocoa.messages
-cocoa.runtime combinators core-foundation.strings kernel locals
-;
+cocoa.runtime combinators core-foundation.strings kernel locals ;
 IN: cocoa.touchbar
 
 : make-touchbar ( seq self -- touchbar )