Merge pull request #10 from gunyarakun/fix-invalid-return
[cocotron.git] / objc / objc_protocol.c
blob011fa8f18e53f53c99db14c6a8bc97fbbbd11a30
1 #import "objc_protocol.h"
2 #import <string.h>
4 const char *protocol_getName(Protocol *protocol) {
5 return protocol->nameCString;
8 objc_property_t protocol_getProperty(Protocol *protocol, const char *name, BOOL isRequired, BOOL isInstance) {
9 // UNIMPLEMENTED
10 return NULL;
13 objc_property_t *protocol_copyPropertyList(Protocol *protocol, unsigned int *countp) {
14 // UNIMPLEMENTED
15 return NULL;
18 Protocol **protocol_copyProtocolList(Protocol *protocol, unsigned int *countp) {
19 // UNIMPLEMENTED
20 return NULL;
23 struct objc_method_description *protocol_copyMethodDescriptionList(Protocol *protocol, BOOL isRequired, BOOL isInstance, unsigned int *countp) {
24 // UNIMPLEMENTED
25 return NULL;
28 struct objc_method_description protocol_getMethodDescription(Protocol *protocol, SEL selector, BOOL isRequired, BOOL isInstance) {
29 struct objc_method_description result = {0, 0};
30 // UNIMPLEMENTED
31 return result;
34 BOOL protocol_conformsToProtocol(Protocol *protocol, Protocol *other) {
36 if(other == nil)
37 return NO;
39 if(strcmp(other->nameCString, protocol->nameCString) == 0)
40 return YES;
41 else if(protocol->childProtocols == NULL)
42 return NO;
43 else {
44 int i;
46 for(i = 0; i < protocol->childProtocols->count; i++) {
47 Protocol *proto = protocol->childProtocols->list[i];
49 if(strcmp(other->nameCString, proto->nameCString) == 0)
50 return YES;
52 if(protocol_conformsToProtocol(proto, other))
53 return YES;
55 return NO;
59 BOOL protocol_isEqual(Protocol *protocol, Protocol *other) {
60 // UNIMPLEMENTED
61 return NO;