-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtypes.h
152 lines (118 loc) · 3 KB
/
types.h
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
148
149
150
151
152
#ifndef OBJC_TYPES_H
#define OBJC_TYPES_H
/*
* Actual declarations of the structures follow.
*/
struct objc_selector {
/*
* Name of the selector, followed by \0,
* followed by the types, followed by \0.
*
* For example: "init\0@@:\0"
*/
const char *name;
/*
* On registering, the selUID is populated and is
* the pointer into the selector table.
*/
uint16_t sel_uid;
};
struct objc_method {
IMP implementation;
/*
* Need to include name and type since the 16-bit selector sel_uid
* is unknown at compile time and is populated at load time.
*/
const char *selector_name;
const char *selector_types;
SEL selector;
unsigned int version;
};
/*
* Declaration of an Ivar.
*/
struct objc_ivar {
const char *name;
const char *type;
size_t size;
int offset; /* Filled by runtime. */
uint8_t align;
};
struct objc_property {
const char *name;
char attributes;
char attributes2;
char unused1;
char unused2;
const char *getter_name;
const char *getter_types;
const char *setter_name;
const char *setter_types;
};
struct objc_category {
const char *category_name;
const char *class_name;
objc_method_list *instance_methods;
objc_method_list *class_methods;
objc_protocol_list *protocols;
};
typedef struct {
BOOL meta : 1;
BOOL resolved : 1;
BOOL initialized : 1; /* +initialized called */
BOOL user_created : 1;
/* Implements its own -retain, -release, or -autorelease */
BOOL has_custom_arr : 1;
/*
* The class is a fake and doesn't have any of the fields beyond
* the flags.
*/
BOOL fake : 1;
} objc_class_flags;
#define OBJC_CLASS_COMMON_FIELDS \
Class isa; /* Points to meta class. */ \
Class super_class; \
void *dtable; /* Disptach table. */ \
objc_class_flags flags; /* Flags. */ \
objc_method_list *methods; /* Method list */
/* Actual structure of Class. */
struct objc_class {
OBJC_CLASS_COMMON_FIELDS;
const char *name;
/*
* On class registration, the run-time calculates
* offsets of all ivars, allocs an array here and
* populates it with ivar offsets.
*/
size_t *ivar_offsets;
/*
* WARNING: All of the lists are lazily created -> may be NULL!
*/
objc_ivar_list *ivars;
objc_protocol_list *protocols;
objc_property_list *properties;
Class subclass_list;
Class sibling_list;
Class unresolved_class_previous;
Class unresolved_class_next;
/*
* Extra space for the run-time to use. Currently used for objects
* associated with classes.
*/
void *extra_space;
/* The kernel module that this class is declared in. */
void *kernel_module;
size_t instance_size;
int version; /* Right now 0. */
};
struct objc_slot {
Class owner;
Class cachedFor;
IMP implementation;
const char *types;
unsigned int version;
SEL selector;
};
#include "list_types.h"
#include "loader.h"
#endif /* !OBJC_TYPES_H */