2014-03-01 03:17:32 -06:00
/* 28 february 2014 */
/*
This includes all Objective - C runtime headers for convenience . It also creates wrappers around objc_msgSend ( ) out of necessity .
cgo doesn ' t support calling variable argument list C functions , so objc_msgSend ( ) cannot be called directly .
Furthermore , Objective - C selectors work by basically sending the arguments to objc_msgSend ( ) verbatim across the wire . This basically means we ' re stuck making wrapper functions for every possible argument list . What fun !
The format should be self - explanatory .
*/
2014-03-01 16:01:28 -06:00
/* for some reason I now have to use an include guard after commit [master 9b4e30c] ("Started to build a single global delegate object; now to fix issues.") */
# ifndef _OBJC_DARWIN_H_
# define _OBJC_DARWIN_H_
2014-03-01 03:17:32 -06:00
# include <objc/message.h>
# include <objc/objc.h>
# include <objc/runtime.h>
# include <stdint.h>
2014-03-02 22:11:29 -06:00
/* for listbox_darwin.go */
extern id * _NSObservedObjectKey ;
2014-03-05 09:31:16 -06:00
static inline id objc_msgSend_noargs ( id obj , SEL sel )
2014-03-01 03:17:32 -06:00
{
return objc_msgSend ( obj , sel ) ;
}
2014-03-01 12:58:38 -06:00
struct xrect {
int64_t x ;
int64_t y ;
int64_t width ;
int64_t height ;
} ;
extern struct xrect objc_msgSend_stret_rect_noargs ( id obj , SEL sel ) ;
2014-03-01 03:21:47 -06:00
struct xsize {
int64_t width ;
int64_t height ;
} ;
2014-03-01 03:43:22 -06:00
extern struct xsize objc_msgSend_stret_size_noargs ( id obj , SEL sel ) ;
2014-03-01 03:21:47 -06:00
2014-03-30 16:52:27 -05:00
struct xpoint {
int64_t x ;
int64_t y ;
} ;
2014-03-02 22:28:43 -06:00
extern uintptr_t objc_msgSend_uintret_noargs ( id objc , SEL sel ) ;
2014-03-02 17:38:45 -06:00
extern intptr_t objc_msgSend_intret_noargs ( id obj , SEL sel ) ;
2014-03-30 18:53:44 -05:00
extern uintptr_t objc_msgSend_ushortret_noargs ( id objc , SEL sel ) ;
2014-03-01 03:17:32 -06:00
# define m1(name, type1) \
2014-03-05 09:31:16 -06:00
static inline id objc_msgSend_ # # name ( id obj , SEL sel , type1 a ) \
2014-03-01 03:17:32 -06:00
{ \
return objc_msgSend ( obj , sel , a ) ; \
}
# define m2(name, type1, type2) \
2014-03-05 09:31:16 -06:00
static inline id objc_msgSend_ # # name ( id obj , SEL sel , type1 a , type2 b ) \
2014-03-01 03:17:32 -06:00
{ \
return objc_msgSend ( obj , sel , a , b ) ; \
}
# define m3(name, type1, type2, type3) \
2014-03-05 09:31:16 -06:00
static inline id objc_msgSend_ # # name ( id obj , SEL sel , type1 a , type2 b , type3 c ) \
2014-03-01 03:17:32 -06:00
{ \
return objc_msgSend ( obj , sel , a , b , c ) ; \
}
# define m4(name, type1, type2, type3, type4) \
2014-03-05 09:31:16 -06:00
static inline id objc_msgSend_ # # name ( id obj , SEL sel , type1 a , type2 b , type3 c , type4 d ) \
2014-03-01 03:17:32 -06:00
{ \
return objc_msgSend ( obj , sel , a , b , c , d ) ; \
}
m1 ( str , char * ) /* TODO Go string? */
m1 ( id , id )
2014-04-04 18:51:23 -05:00
extern id objc_msgSend_rect ( id obj , SEL sel , int64_t x , int64_t y , int64_t w , int64_t h ) ;
2014-03-01 03:17:32 -06:00
m1 ( sel , SEL )
2014-04-04 17:56:37 -05:00
extern id objc_msgSend_uint ( id obj , SEL sel , uintptr_t a ) ;
2014-03-01 03:23:49 -06:00
m1 ( ptr , void * )
2014-03-01 12:29:24 -06:00
m1 ( bool , BOOL )
2014-03-01 19:31:17 -06:00
extern id objc_msgSend_int ( id obj , SEL sel , intptr_t a ) ;
2014-03-03 14:32:54 -06:00
m1 ( double , double )
2014-03-01 03:17:32 -06:00
m2 ( id_id , id , id )
2014-04-04 18:08:25 -05:00
extern id objc_msgSend_rect_bool ( id obj , SEL sel , int64_t x , int64_t y , int64_t w , int64_t h , BOOL b ) ;
2014-03-02 16:44:13 -06:00
extern id objc_msgSend_id_int ( id obj , SEL sel , id a , intptr_t b ) ;
2014-03-02 22:28:43 -06:00
extern id objc_msgSend_id_uint ( id obj , SEL sel , id a , uintptr_t b ) ;
2014-03-05 19:09:15 -06:00
m2 ( id_bool , id , BOOL )
2014-03-30 13:25:01 -05:00
extern id objc_msgSend_point ( id obj , SEL sel , int64_t x , int64_t y ) ;
2014-03-01 03:17:32 -06:00
m3 ( id_id_id , id , id , id )
m3 ( sel_id_bool , SEL , id , BOOL )
2014-04-04 18:14:03 -05:00
extern id objc_msgSend_rect_uint_uint_bool ( id obj , SEL sel , int64_t x , int64_t y , int64_t w , int64_t h , uintptr_t b , uintptr_t c , BOOL d ) ;
2014-03-01 03:17:32 -06:00
m4 ( id_sel_id_id , id , SEL , id , id )
2014-03-02 22:28:43 -06:00
m4 ( id_id_id_id , id , id , id , id )
2014-03-01 16:01:28 -06:00
2014-03-02 22:11:29 -06:00
/* for listbox_darwin.go */
extern uintptr_t * NSIndexSetEntries ( id , uintptr_t ) ;
2014-03-05 19:09:15 -06:00
/* for uitask_darwin.go */
2014-04-05 12:30:56 -05:00
extern void initBleh ( ) ;
2014-03-05 19:09:15 -06:00
extern id makeDummyEvent ( ) ;
2014-03-29 22:57:49 -05:00
/* for area_darwin.go */
2014-04-04 21:21:53 -05:00
extern void * _areaView_drawRect ;
2014-03-30 16:52:27 -05:00
extern void drawImage ( void * , int64_t , int64_t , int64_t , int64_t , int64_t ) ;
extern struct xpoint getTranslatedEventPoint ( id , id ) ;
2014-03-29 22:57:49 -05:00
2014-04-04 21:21:53 -05:00
/* for objc_darwin.go */
extern char * encodedNSRect ;
2014-04-06 22:33:27 -05:00
extern char * encodedTerminateReply ;
2014-04-04 21:21:53 -05:00
2014-04-04 13:52:38 -05:00
/* for sysdata_darwin.go */
extern void objc_setFont ( id , unsigned int ) ;
2014-04-06 22:33:27 -05:00
/* for delegate_darwin.go */
extern void * _appDelegate_applicationShouldTerminate ;
2014-03-01 16:01:28 -06:00
# endif