2015-08-17 00:03:53 -05:00
|
|
|
// 17 august 2015
|
|
|
|
#import "uipriv_darwin.h"
|
|
|
|
|
2015-11-28 11:16:05 -06:00
|
|
|
// TODO are the NSValues being garbage collected underfoot? open menuless window and check the checkbox
|
|
|
|
|
2015-08-17 00:03:53 -05:00
|
|
|
// unfortunately NSMutableDictionary copies its keys, meaning we can't use it for pointers
|
|
|
|
// hence, this file
|
|
|
|
|
|
|
|
NSMapTable *newMap(void)
|
|
|
|
{
|
2015-08-21 23:30:36 -05:00
|
|
|
return [NSMapTable mapTableWithKeyOptions:(NSPointerFunctionsOpaqueMemory | NSPointerFunctionsOpaquePersonality)
|
2015-08-17 00:03:53 -05:00
|
|
|
valueOptions:NSPointerFunctionsOpaqueMemory];
|
|
|
|
}
|
|
|
|
|
|
|
|
void *mapGet(NSMapTable *map, id key)
|
|
|
|
{
|
|
|
|
NSValue *v;
|
|
|
|
|
2015-08-17 00:41:04 -05:00
|
|
|
v = (NSValue *) [map objectForKey:key];
|
2015-08-17 00:03:53 -05:00
|
|
|
return [v pointerValue];
|
|
|
|
}
|
|
|
|
|
|
|
|
void mapSet(NSMapTable *map, id key, void *value)
|
|
|
|
{
|
|
|
|
NSValue *v;
|
|
|
|
|
|
|
|
v = [NSValue valueWithPointer:value];
|
|
|
|
[map setObject:v forKey:key];
|
|
|
|
}
|