19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
#include <stdio.h>
#include <stdlib.h>
#import "runtime.h"
#import "runtime-private.h"
#import "macros.h"
static IMP not_found_handler(id, SEL);
IMP (*objc_forward_handler)(id, SEL) = not_found_handler;
static IMP
not_found_handler(id obj, SEL sel)
{
ERROR("Selector %s is not implemented for class %s!",
sel_getName(sel), obj->isa->name);
}
BOOL
class_respondsToSelector(Class cls, SEL sel)
{
|
<
|
|
|
>
>
>
|
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
#include <stdio.h>
#include <stdlib.h>
#import "runtime.h"
#import "runtime-private.h"
#import "macros.h"
IMP (*objc_forward_handler)(id, SEL) = NULL;
IMP
objc_not_found_handler(id obj, SEL sel)
{
if (objc_forward_handler != NULL)
return objc_forward_handler(obj, sel);
ERROR("Selector %s is not implemented for class %s!",
sel_getName(sel), obj->isa->name);
}
BOOL
class_respondsToSelector(Class cls, SEL sel)
{
|
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
|
if (obj == nil)
return (IMP)nil_method;
imp = objc_sparsearray_get(obj->isa->dtable, (uint32_t)sel->uid);
if (imp == NULL)
return objc_forward_handler(obj, sel);
return imp;
}
IMP
objc_msg_lookup_super(struct objc_super *super, SEL sel)
{
IMP imp;
if (super->self == nil)
return (IMP)nil_method;
imp = objc_sparsearray_get(super->class->dtable, (uint32_t)sel->uid);
if (imp == NULL)
return objc_forward_handler(super->self, sel);
return imp;
}
#endif
|
|
|
|
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
|
if (obj == nil)
return (IMP)nil_method;
imp = objc_sparsearray_get(obj->isa->dtable, (uint32_t)sel->uid);
if (imp == NULL)
return objc_not_found_handler(obj, sel);
return imp;
}
IMP
objc_msg_lookup_super(struct objc_super *super, SEL sel)
{
IMP imp;
if (super->self == nil)
return (IMP)nil_method;
imp = objc_sparsearray_get(super->class->dtable, (uint32_t)sel->uid);
if (imp == NULL)
return objc_not_found_handler(super->self, sel);
return imp;
}
#endif
|