summaryrefslogtreecommitdiff
path: root/Objective-C/libobjcl.h
blob: 09b08ab8c45b942ffca64d286644a3ce70585d55 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
/* -*- mode: objc; coding: utf-8 -*- */
/* Objective-CL, an Objective-C bridge for Common Lisp.
 * Copyright (C) 2007  Matthias Andreas Benkard.
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this program.  If not, see
 * <http://www.gnu.org/licenses/>.
 */

#import "Foundation/Foundation.h"
#include <objc/objc-api.h>

#include "../config.h"

#import "PyObjC/pyobjc.h"
#import "PyObjC/objc_support.h"
#import "PyObjC/objc-runtime-compat.h"

#ifdef USE_LIBFFI
#ifdef HAVE_FFI_H
#include <ffi.h>
#elif HAVE_FFI_FFI_H
#include <ffi/ffi.h>
#else
/* We are using our own build of libffi. */
#include <ffi.h>
#endif
#endif

#ifdef __NEXT_RUNTIME__
typedef Ivar IVAR_T;
#else
typedef struct objc_ivar *IVAR_T;
#endif

extern NSException *objcl_oom_exception;


void
objcl_initialise_runtime (void);

void
objcl_shutdown_runtime (void);

id
objcl_invoke_with_types (int argc,
                         char *return_typespec,
                         char *arg_typespecs[],
                         void *return_value,
                         void **argv);

Class
objcl_find_class (const char *class_name);

Class
objcl_find_meta_class (const char *class_name);

SEL
objcl_find_selector (const char *selector_name);

SEL
objcl_intern_selector (const char *selector_name);

/* Return a null-terminated list of type information strings.
   The first entry describes the type of the method's return value. */
char **
objcl_query_arglist_info (void *receiver,
                          const char *method_name);


const char *
objcl_class_name (Class class);

Class
objcl_class_superclass (Class class);

const char *
objcl_selector_name (SEL selector);

IMP
objcl_get_method_implementation (id object,
                                 SEL selector);

BOOL
objcl_object_is_class (id obj);

BOOL
objcl_object_is_meta_class (id obj);

Class
objcl_object_get_class (id obj);

Class
objcl_object_get_meta_class (id obj);

id
objcl_get_nil (void);

/* In principle, we do not know whether a BOOL fits into a long.  In
   practise, it is very likely. */
long
objcl_get_yes (void);

long
objcl_get_no (void);

const char *
objcl_get_runtime_type (void);

int
objcl_objc2_p (void);

long
objcl_sizeof_type (const char *typespec);

long
objcl_sizeof_return_type (const char *typespec);

long
objcl_alignof_type (const char *typespec);

void
objcl_set_slot_value (id obj, const char *ivar_name, void *value);

void *
objcl_slot_value (id obj, const char *ivar_name);

/* The following function returns a freshly consed array that the caller
   must deallocate. */
IVAR_T *
objcl_class_direct_slots (Class class, unsigned int *count, unsigned int *element_size);

const char *
objcl_slot_name (IVAR_T ivar);

const char *
objcl_slot_type (IVAR_T ivar);