]> git.saurik.com Git - apple/objc4.git/blobdiff - runtime/maptable.h
objc4-493.9.tar.gz
[apple/objc4.git] / runtime / maptable.h
index c289f4ab4d53d553b7649704d1c173e99d46bd3f..bc2a6355517ea27b83d887dccd3cb227e83b7a39 100644 (file)
 #define _OBJC_MAPTABLE_H_
 
 #ifndef _OBJC_PRIVATE_H_
 #define _OBJC_MAPTABLE_H_
 
 #ifndef _OBJC_PRIVATE_H_
-#warning the API in this header is obsolete
+#   define OBJC_MAP_AVAILABILITY __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0,__MAC_10_1, __IPHONE_NA,__IPHONE_NA);
+#else
+#   define OBJC_MAP_AVAILABILITY
 #endif
 
 #include <objc/objc.h>
 
 #endif
 
 #include <objc/objc.h>
 
+__BEGIN_DECLS
+
 /***************       Definitions             ***************/
 
     /* This module allows hashing of arbitrary associations [key -> value].  Keys and values must be pointers or integers, and client is responsible for allocating/deallocating this data.  A deallocation call-back is provided.
 /***************       Definitions             ***************/
 
     /* This module allows hashing of arbitrary associations [key -> value].  Keys and values must be pointers or integers, and client is responsible for allocating/deallocating this data.  A deallocation call-back is provided.
@@ -45,16 +49,16 @@ typedef struct _NXMapTable {
     /* private data structure; may change */
     const struct _NXMapTablePrototype  *prototype;
     unsigned   count;
     /* private data structure; may change */
     const struct _NXMapTablePrototype  *prototype;
     unsigned   count;
-    unsigned   nbBuckets;
+    unsigned   nbBucketsMinusOne;
     void       *buckets;
     void       *buckets;
-} NXMapTable;
+} NXMapTable OBJC_MAP_AVAILABILITY;
 
 typedef struct _NXMapTablePrototype {
     unsigned   (*hash)(NXMapTable *, const void *key);
     int                (*isEqual)(NXMapTable *, const void *key1, const void *key2);
     void       (*free)(NXMapTable *, void *key, void *value);
     int                style; /* reserved for future expansion; currently 0 */
 
 typedef struct _NXMapTablePrototype {
     unsigned   (*hash)(NXMapTable *, const void *key);
     int                (*isEqual)(NXMapTable *, const void *key1, const void *key2);
     void       (*free)(NXMapTable *, void *key, void *value);
     int                style; /* reserved for future expansion; currently 0 */
-} NXMapTablePrototype;
+} NXMapTablePrototype OBJC_MAP_AVAILABILITY;
     
     /* invariants assumed by the implementation: 
        A - key != -1
     
     /* invariants assumed by the implementation: 
        A - key != -1
@@ -68,32 +72,32 @@ typedef struct _NXMapTablePrototype {
 
 /***************       Functions               ***************/
 
 
 /***************       Functions               ***************/
 
-OBJC_EXPORT NXMapTable *NXCreateMapTableFromZone(NXMapTablePrototype prototype, unsigned capacity, void *z);
-OBJC_EXPORT NXMapTable *NXCreateMapTable(NXMapTablePrototype prototype, unsigned capacity);
+OBJC_EXPORT NXMapTable *NXCreateMapTableFromZone(NXMapTablePrototype prototype, unsigned capacity, void *z) OBJC_MAP_AVAILABILITY;
+OBJC_EXPORT NXMapTable *NXCreateMapTable(NXMapTablePrototype prototype, unsigned capacity) OBJC_MAP_AVAILABILITY;
     /* capacity is only a hint; 0 creates a small table */
 
     /* capacity is only a hint; 0 creates a small table */
 
-OBJC_EXPORT void NXFreeMapTable(NXMapTable *table);
+OBJC_EXPORT void NXFreeMapTable(NXMapTable *table) OBJC_MAP_AVAILABILITY;
     /* call free for each pair, and recovers table */
        
     /* call free for each pair, and recovers table */
        
-OBJC_EXPORT void NXResetMapTable(NXMapTable *table);
+OBJC_EXPORT void NXResetMapTable(NXMapTable *table) OBJC_MAP_AVAILABILITY;
     /* free each pair; keep current capacity */
 
     /* free each pair; keep current capacity */
 
-OBJC_EXPORT BOOL NXCompareMapTables(NXMapTable *table1, NXMapTable *table2);
+OBJC_EXPORT BOOL NXCompareMapTables(NXMapTable *table1, NXMapTable *table2) OBJC_MAP_AVAILABILITY;
     /* Returns YES if the two sets are equal (each member of table1 in table2, and table have same size) */
 
     /* Returns YES if the two sets are equal (each member of table1 in table2, and table have same size) */
 
-OBJC_EXPORT unsigned NXCountMapTable(NXMapTable *table);
+OBJC_EXPORT unsigned NXCountMapTable(NXMapTable *table) OBJC_MAP_AVAILABILITY;
     /* current number of data in table */
        
     /* current number of data in table */
        
-OBJC_EXPORT void *NXMapMember(NXMapTable *table, const void *key, void **value);
+OBJC_EXPORT void *NXMapMember(NXMapTable *table, const void *key, void **value) OBJC_MAP_AVAILABILITY;
     /* return original table key or NX_MAPNOTAKEY.  If key is found, value is set */
        
     /* return original table key or NX_MAPNOTAKEY.  If key is found, value is set */
        
-OBJC_EXPORT void *NXMapGet(NXMapTable *table, const void *key);
+OBJC_EXPORT void *NXMapGet(NXMapTable *table, const void *key) OBJC_MAP_AVAILABILITY;
     /* return original corresponding value or NULL.  When NULL need be stored as value, NXMapMember can be used to test for presence */
        
     /* return original corresponding value or NULL.  When NULL need be stored as value, NXMapMember can be used to test for presence */
        
-OBJC_EXPORT void *NXMapInsert(NXMapTable *table, const void *key, const void *value);
+OBJC_EXPORT void *NXMapInsert(NXMapTable *table, const void *key, const void *value) OBJC_MAP_AVAILABILITY;
     /* override preexisting pair; Return previous value or NULL. */
        
     /* override preexisting pair; Return previous value or NULL. */
        
-OBJC_EXPORT void *NXMapRemove(NXMapTable *table, const void *key);
+OBJC_EXPORT void *NXMapRemove(NXMapTable *table, const void *key) OBJC_MAP_AVAILABILITY;
     /* previous value or NULL is returned */
        
 /* Iteration over all elements of a table consists in setting up an iteration state and then to progress until all entries have been visited.  An example of use for counting elements in a table is:
     /* previous value or NULL is returned */
        
 /* Iteration over all elements of a table consists in setting up an iteration state and then to progress until all entries have been visited.  An example of use for counting elements in a table is:
@@ -106,25 +110,27 @@ OBJC_EXPORT void *NXMapRemove(NXMapTable *table, const void *key);
     }
 */
 
     }
 */
 
-typedef struct {int index;} NXMapState;
+typedef struct {int index;} NXMapState OBJC_MAP_AVAILABILITY;
     /* callers should not rely on actual contents of the struct */
 
     /* callers should not rely on actual contents of the struct */
 
-OBJC_EXPORT NXMapState NXInitMapState(NXMapTable *table);
+OBJC_EXPORT NXMapState NXInitMapState(NXMapTable *table) OBJC_MAP_AVAILABILITY;
 
 
-OBJC_EXPORT int NXNextMapState(NXMapTable *table, NXMapState *state, const void **key, const void **value);
+OBJC_EXPORT int NXNextMapState(NXMapTable *table, NXMapState *state, const void **key, const void **value) OBJC_MAP_AVAILABILITY;
     /* returns 0 when all elements have been visited */
 
 /***************       Conveniences            ***************/
 
     /* returns 0 when all elements have been visited */
 
 /***************       Conveniences            ***************/
 
-OBJC_EXPORT const NXMapTablePrototype NXPtrValueMapPrototype;
+OBJC_EXPORT const NXMapTablePrototype NXPtrValueMapPrototype OBJC_MAP_AVAILABILITY;
     /* hashing is pointer/integer hashing;
       isEqual is identity;
       free is no-op. */
     /* hashing is pointer/integer hashing;
       isEqual is identity;
       free is no-op. */
-OBJC_EXPORT const NXMapTablePrototype NXStrValueMapPrototype;
+OBJC_EXPORT const NXMapTablePrototype NXStrValueMapPrototype OBJC_MAP_AVAILABILITY;
     /* hashing is string hashing;
       isEqual is strcmp;
       free is no-op. */
 OBJC_EXPORT const NXMapTablePrototype NXObjectMapPrototype  OBJC2_UNAVAILABLE;
     /* for objects; uses methods: hash, isEqual:, free, all for key. */
 
     /* hashing is string hashing;
       isEqual is strcmp;
       free is no-op. */
 OBJC_EXPORT const NXMapTablePrototype NXObjectMapPrototype  OBJC2_UNAVAILABLE;
     /* for objects; uses methods: hash, isEqual:, free, all for key. */
 
+__END_DECLS
+
 #endif /* _OBJC_MAPTABLE_H_ */
 #endif /* _OBJC_MAPTABLE_H_ */