mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-23 00:41:02 +00:00
backport missing callbacks
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/branches/stable@33233 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
18696ec591
commit
a1e10d6992
7 changed files with 67 additions and 25 deletions
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
|||
2011-06-02 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/NSCallBacks.h:
|
||||
* Source/NSCallBacks.m:
|
||||
* Source/NSConcreteMapTable.m:
|
||||
* Source/NSConcreteHashTable.m:
|
||||
* Headers/Foundation/NSHashTable.h:
|
||||
* Headers/Foundation/NSMapTable.h:
|
||||
Backport fix for missing callbacks structure.
|
||||
|
||||
2011-06-01 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/NSTimeZone.m: Add more system specific code for guessing
|
||||
|
|
|
@ -183,7 +183,8 @@ typedef struct _NSHashTableCallBacks
|
|||
NSString *(*describe)(NSHashTable *, const void *);
|
||||
} NSHashTableCallBacks;
|
||||
|
||||
GS_EXPORT const NSHashTableCallBacks NSIntHashCallBacks;
|
||||
GS_EXPORT const NSHashTableCallBacks NSIntegerHashCallBacks;
|
||||
GS_EXPORT const NSHashTableCallBacks NSIntHashCallBacks; /*DEPRECATED*/
|
||||
GS_EXPORT const NSHashTableCallBacks NSNonOwnedPointerHashCallBacks;
|
||||
GS_EXPORT const NSHashTableCallBacks NSNonRetainedObjectHashCallBacks;
|
||||
GS_EXPORT const NSHashTableCallBacks NSObjectHashCallBacks;
|
||||
|
|
|
@ -227,13 +227,15 @@ struct _NSMapTableValueCallBacks
|
|||
#define NSNotAnIntMapKey ((const void *)0x80000000)
|
||||
#define NSNotAPointerMapKey ((const void *)0xffffffff)
|
||||
|
||||
GS_EXPORT const NSMapTableKeyCallBacks NSIntMapKeyCallBacks;
|
||||
GS_EXPORT const NSMapTableKeyCallBacks NSIntegerMapKeyCallBacks;
|
||||
GS_EXPORT const NSMapTableKeyCallBacks NSIntMapKeyCallBacks; /*DEPRECATED*/
|
||||
GS_EXPORT const NSMapTableKeyCallBacks NSNonOwnedPointerMapKeyCallBacks;
|
||||
GS_EXPORT const NSMapTableKeyCallBacks NSNonOwnedPointerOrNullMapKeyCallBacks;
|
||||
GS_EXPORT const NSMapTableKeyCallBacks NSNonRetainedObjectMapKeyCallBacks;
|
||||
GS_EXPORT const NSMapTableKeyCallBacks NSObjectMapKeyCallBacks;
|
||||
GS_EXPORT const NSMapTableKeyCallBacks NSOwnedPointerMapKeyCallBacks;
|
||||
GS_EXPORT const NSMapTableValueCallBacks NSIntMapValueCallBacks;
|
||||
GS_EXPORT const NSMapTableValueCallBacks NSIntegerMapValueCallBacks;
|
||||
GS_EXPORT const NSMapTableValueCallBacks NSIntMapValueCallBacks; /*DEPRECATED*/
|
||||
GS_EXPORT const NSMapTableValueCallBacks NSNonOwnedPointerMapValueCallBacks;
|
||||
GS_EXPORT const NSMapTableValueCallBacks NSNonRetainedObjectMapValueCallBacks;
|
||||
GS_EXPORT const NSMapTableValueCallBacks NSObjectMapValueCallBacks;
|
||||
|
|
|
@ -1,28 +1,28 @@
|
|||
/* GNUStep callback functions prototypes.
|
||||
* Copyright(C) 1996 Free Software Foundation, Inc.
|
||||
*
|
||||
*
|
||||
* Author: Albin L. Jones <Albin.L.Jones@Dartmouth.EDU>
|
||||
* Created: Tue Feb 13 23:10:29 EST 1996
|
||||
* Updated: Tue Feb 13 23:10:29 EST 1996
|
||||
* Updated: Mon Feb 7 10:25:00 GMT 2000
|
||||
* Serial: 96.02.13.01
|
||||
*
|
||||
*
|
||||
* This file is part of the GNUstep Base Library.
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or(at your option) any later version.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02111 USA. */
|
||||
* Boston, MA 02111 USA. */
|
||||
|
||||
#ifndef __NSCallBacks_h_OBJECTS_INCLUDE
|
||||
#define __NSCallBacks_h_OBJECTS_INCLUDE 1
|
||||
|
@ -47,7 +47,7 @@
|
|||
|
||||
/** For `int's **/
|
||||
|
||||
unsigned int _NS_int_hash(void *table, void* i) GS_HIDDEN;
|
||||
NSUInteger _NS_int_hash(void *table, void* i) GS_HIDDEN;
|
||||
BOOL _NS_int_is_equal(void *table, void* i, void* j) GS_HIDDEN;
|
||||
void _NS_int_retain(void *table, void* i) GS_HIDDEN;
|
||||
void _NS_int_release(void *table, void* i) GS_HIDDEN;
|
||||
|
@ -55,14 +55,14 @@ NSString *_NS_int_describe(void *table, void* i) GS_HIDDEN;
|
|||
|
||||
/** For owned `void *' **/
|
||||
|
||||
unsigned int _NS_owned_void_p_hash(void *table, void *p) GS_HIDDEN;
|
||||
NSUInteger _NS_owned_void_p_hash(void *table, void *p) GS_HIDDEN;
|
||||
BOOL _NS_owned_void_p_is_equal(void *table, void *p, void *q) GS_HIDDEN;
|
||||
void _NS_owned_void_p_retain(void *table, void *p) GS_HIDDEN;
|
||||
void _NS_owned_void_p_release(void *table, void *p) GS_HIDDEN;
|
||||
NSString *_NS_owned_void_p_describe(void *table, void *p) GS_HIDDEN;
|
||||
|
||||
/** For non-retained Objective-C objects **/
|
||||
unsigned int _NS_non_retained_id_hash(void *table, id <NSObject> o) GS_HIDDEN;
|
||||
NSUInteger _NS_non_retained_id_hash(void *table, id <NSObject> o) GS_HIDDEN;
|
||||
BOOL _NS_non_retained_id_is_equal(void *table,
|
||||
id <NSObject> o, id <NSObject> p) GS_HIDDEN;
|
||||
void _NS_non_retained_id_retain(void *table, id <NSObject> o) GS_HIDDEN;
|
||||
|
@ -70,21 +70,21 @@ void _NS_non_retained_id_release(void *table, id <NSObject> o) GS_HIDDEN;
|
|||
NSString *_NS_non_retained_id_describe(void *table, id <NSObject> o) GS_HIDDEN;
|
||||
|
||||
/** For(retainable) objects **/
|
||||
unsigned int _NS_id_hash(void *table, id <NSObject> o) GS_HIDDEN;
|
||||
NSUInteger _NS_id_hash(void *table, id <NSObject> o) GS_HIDDEN;
|
||||
BOOL _NS_id_is_equal(void *table, id <NSObject> o, id <NSObject> p) GS_HIDDEN;
|
||||
void _NS_id_retain(void *table, id <NSObject> o) GS_HIDDEN;
|
||||
void _NS_id_release(void *table, id <NSObject> o) GS_HIDDEN;
|
||||
NSString *_NS_id_describe(void *table, id <NSObject> o) GS_HIDDEN;
|
||||
|
||||
/** For(non-owned) `void *' **/
|
||||
unsigned int _NS_non_owned_void_p_hash(void *table, void *p) GS_HIDDEN;
|
||||
NSUInteger _NS_non_owned_void_p_hash(void *table, void *p) GS_HIDDEN;
|
||||
BOOL _NS_non_owned_void_p_is_equal(void *table, void *p, void *q) GS_HIDDEN;
|
||||
void _NS_non_owned_void_p_retain(void *table, void *p) GS_HIDDEN;
|
||||
void _NS_non_owned_void_p_release(void *table, void *p) GS_HIDDEN;
|
||||
NSString *_NS_non_owned_void_p_describe(void *table, void *p) GS_HIDDEN;
|
||||
|
||||
/** For pointers to structures and `int *' **/
|
||||
unsigned int _NS_int_p_hash(void *table, int *p) GS_HIDDEN;
|
||||
NSUInteger _NS_int_p_hash(void *table, int *p) GS_HIDDEN;
|
||||
BOOL _NS_int_p_is_equal(void *table, int *p, int *q) GS_HIDDEN;
|
||||
void _NS_int_p_retain(void *table, int *p) GS_HIDDEN;
|
||||
void _NS_int_p_release(void *table, int *p) GS_HIDDEN;
|
||||
|
|
|
@ -38,10 +38,10 @@
|
|||
|
||||
/** For `int's **/
|
||||
|
||||
unsigned int
|
||||
NSUInteger
|
||||
_NS_int_hash(void *table, void* i)
|
||||
{
|
||||
return (unsigned)(uintptr_t)i;
|
||||
return (uintptr_t)i;
|
||||
}
|
||||
|
||||
BOOL
|
||||
|
@ -70,11 +70,11 @@ _NS_int_describe(void *table, void* i)
|
|||
|
||||
/** For owned `void *' **/
|
||||
|
||||
unsigned int
|
||||
NSUInteger
|
||||
_NS_owned_void_p_hash(void *table, void *p)
|
||||
{
|
||||
/* P may be aligned, so we need to compensate. */
|
||||
return ((unsigned)(uintptr_t)p)/4;
|
||||
return ((uintptr_t)p)/4;
|
||||
}
|
||||
|
||||
BOOL
|
||||
|
@ -105,7 +105,7 @@ _NS_owned_void_p_describe(void *table, void *p)
|
|||
|
||||
/** For non-retained Objective-C objects **/
|
||||
|
||||
unsigned int
|
||||
NSUInteger
|
||||
_NS_non_retained_id_hash(void *table, id <NSObject> o)
|
||||
{
|
||||
return [o hash];
|
||||
|
@ -137,7 +137,7 @@ _NS_non_retained_id_describe(void *table, id <NSObject> o)
|
|||
|
||||
/** For(retainable) objects **/
|
||||
|
||||
unsigned int
|
||||
NSUInteger
|
||||
_NS_id_hash(void *table, id <NSObject> o)
|
||||
{
|
||||
return [o hash];
|
||||
|
@ -172,10 +172,10 @@ _NS_id_describe(void *table, id <NSObject> o)
|
|||
|
||||
/** For(non-owned) `void *' **/
|
||||
|
||||
unsigned int
|
||||
NSUInteger
|
||||
_NS_non_owned_void_p_hash(void *table, void *p)
|
||||
{
|
||||
return ((unsigned)(uintptr_t)p)/4;
|
||||
return ((uintptr_t)p)/4;
|
||||
}
|
||||
|
||||
BOOL
|
||||
|
@ -204,10 +204,10 @@ _NS_non_owned_void_p_describe(void *table, void *p)
|
|||
|
||||
/** For pointers to structures and `int *' **/
|
||||
|
||||
unsigned int
|
||||
NSUInteger
|
||||
_NS_int_p_hash(void *table, int *p)
|
||||
{
|
||||
return ((unsigned)(uintptr_t)p)/4;
|
||||
return ((uintptr_t)p)/4;
|
||||
}
|
||||
|
||||
BOOL
|
||||
|
|
|
@ -733,6 +733,16 @@ typedef void (*NSHT_release_func_t)(NSHashTable *, void *);
|
|||
typedef NSString *(*NSHT_describe_func_t)(NSHashTable *, const void *);
|
||||
|
||||
/** For sets of pointer-sized or smaller quantities. */
|
||||
const NSHashTableCallBacks NSIntegerHashCallBacks =
|
||||
{
|
||||
(NSHT_hash_func_t) _NS_int_hash,
|
||||
(NSHT_isEqual_func_t) _NS_int_is_equal,
|
||||
(NSHT_retain_func_t) _NS_int_retain,
|
||||
(NSHT_release_func_t) _NS_int_release,
|
||||
(NSHT_describe_func_t) _NS_int_describe
|
||||
};
|
||||
|
||||
/** For backward compatibility. */
|
||||
const NSHashTableCallBacks NSIntHashCallBacks =
|
||||
{
|
||||
(NSHT_hash_func_t) _NS_int_hash,
|
||||
|
|
|
@ -1012,6 +1012,17 @@ typedef NSString *(*NSMT_describe_func_t)(NSMapTable *, const void *);
|
|||
|
||||
|
||||
/** For keys that are pointer-sized or smaller quantities. */
|
||||
const NSMapTableKeyCallBacks NSIntegerMapKeyCallBacks =
|
||||
{
|
||||
(NSMT_hash_func_t) _NS_int_hash,
|
||||
(NSMT_is_equal_func_t) _NS_int_is_equal,
|
||||
(NSMT_retain_func_t) _NS_int_retain,
|
||||
(NSMT_release_func_t) _NS_int_release,
|
||||
(NSMT_describe_func_t) _NS_int_describe,
|
||||
NSNotAnIntMapKey
|
||||
};
|
||||
|
||||
/** For backward compatibility. */
|
||||
const NSMapTableKeyCallBacks NSIntMapKeyCallBacks =
|
||||
{
|
||||
(NSMT_hash_func_t) _NS_int_hash,
|
||||
|
@ -1078,6 +1089,14 @@ const NSMapTableKeyCallBacks NSOwnedPointerMapKeyCallBacks =
|
|||
};
|
||||
|
||||
/** For values that are pointer-sized integer quantities. */
|
||||
const NSMapTableValueCallBacks NSIntegerMapValueCallBacks =
|
||||
{
|
||||
(NSMT_retain_func_t) _NS_int_retain,
|
||||
(NSMT_release_func_t) _NS_int_release,
|
||||
(NSMT_describe_func_t) _NS_int_describe
|
||||
};
|
||||
|
||||
/** For backward compatibilty. */
|
||||
const NSMapTableValueCallBacks NSIntMapValueCallBacks =
|
||||
{
|
||||
(NSMT_retain_func_t) _NS_int_retain,
|
||||
|
|
Loading…
Reference in a new issue