USING: accessors alien alien.c-types alien.strings arrays assocs
combinators compiler kernel math namespaces make parser
prettyprint prettyprint.sections quotations sequences strings
-words cocoa.runtime io macros memoize debugger
+words cocoa.runtime io macros memoize debugger fry
io.encodings.ascii effects compiler.generator libc libc.private ;
IN: cocoa.messages
swap method_getName sel_getName
objc-methods get set-at ;
-: (register-objc-methods) ( methods count -- methods )
- over [ void*-nth register-objc-method ] curry each ;
+: each-method-in-class ( class quot -- )
+ [ 0 <uint> [ class_copyMethodList ] keep *uint over ] dip
+ '[ _ void*-nth @ ] each (free) ; inline
: register-objc-methods ( class -- )
- 0 <uint> [ class_copyMethodList ] keep *uint
- (register-objc-methods) (free) ;
+ [ register-objc-method ] each-method-in-class ;
+
+: method. ( method -- )
+ {
+ [ method_getName sel_getName ]
+ [ method-return-type ]
+ [ method-arg-types ]
+ [ method_getImplementation ]
+ } cleave 4array . ;
+
+: methods. ( class -- )
+ [ method. ] each-method-in-class ;
: class-exists? ( string -- class ) objc_getClass >boolean ;
FUNCTION: char* sel_getName ( SEL aSelector ) ;
-FUNCTION: bool sel_isMapped ( SEL aSelector ) ;
+FUNCTION: char sel_isMapped ( SEL aSelector ) ;
FUNCTION: SEL sel_registerName ( char* str ) ;
FUNCTION: Class class_getSuperclass ( Class cls ) ;
+FUNCTION: char* class_getName ( Class cls ) ;
+
FUNCTION: char class_addMethod ( Class class, SEL name, void* imp, void* types ) ;
FUNCTION: char class_addProtocol ( Class class, Protocol protocol ) ;
FUNCTION: SEL method_getName ( Method method ) ;
FUNCTION: void* method_setImplementation ( Method method, void* imp ) ;
+FUNCTION: void* method_getImplementation ( Method method ) ;
FUNCTION: Class object_getClass ( id object ) ;