My favorites | Sign in
Project Home Downloads Wiki Issues Source
Repository:
Checkout   Browse   Changes   Clones  
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
#import <objc/runtime.h>
#import <string.h>
#import <stddef.h>
#import <stdlib.h>
#import <ctype.h>
#import <Foundation/NSObject.h>

const char *property_getAttributes(objc_property_t property){
return property->attributes;
}

const char *property_getName(objc_property_t property) {
return property->name;
}

id objc_assign_ivar(id self,id value,unsigned int offset){
// NSCLog("objc_assign_ivar(%x,%s,%x,%s,%d)",self,(self!=nil)?self->isa->name:"nil",value,(value!=nil)?value->isa->name:"nil",offset);
id *ivar=(id *)(((uint8_t *)self)+offset);
return *ivar=value;
}

void objc_copyStruct(void *dest, const void *src, size_t size, BOOL atomic,BOOL hasStrong) {
int i;

for(i=0;i<size;i++)
((uint8_t *)dest)[i]=((uint8_t *)src)[i];
}


void objc_setProperty (id self, SEL _cmd, size_t offset, id value, BOOL isAtomic, BOOL shouldCopy)
{
if(isAtomic)
{
// NSUnimplementedFunction();
}
void *buffer=(void*)self+offset;
id oldValue=*(id*)buffer;

if(shouldCopy)
value=[value copy];
else
value=[value retain];

*(id*)buffer=value;

[oldValue release];
}

id objc_getProperty (id self, SEL _cmd, size_t offset, BOOL isAtomic)
{
if(isAtomic)
{
// NSUnimplementedFunction();
}

void *buffer=(void*)self+offset;
id value=*(id*)buffer;

return value;
}

Change log

e100cb64ea03 by Christopher Lloyd <c...@objc.net> on Nov 8, 2010   Diff
OpenGLView/Context/CGL fixes to not use
child windows
Go to: 
Project members, sign in to write a code review

Older revisions

b66cda1a7abd by Christopher Lloyd <c...@objc.net> on Oct 21, 2010   Diff
property and protocol functions in the
objc runtime
273a8bb9893e by cocotron on Mar 18, 2010   Diff
- split objc_debugHelpers code between
Foundation/NSException and objc/
accordingly
- objc_setForwardHandler used from
NSObject to set handlers explcitly
...
6b7bb1d4a561 by cocotron on Mar 17, 2010   Diff
moved objc/ files out of Foundation
and into objc/ project directory
All revisions of this file

File info

Size: 1307 bytes, 61 lines
Powered by Google Project Hosting