00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef CUCON_PCMAP_H
00019 #define CUCON_PCMAP_H
00020
00021 #include <cucon/ucmap.h>
00022
00023 CU_BEGIN_DECLARATIONS
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036 CU_SINLINE cucon_pcmap_t
00037 cucon_pcmap_empty() { return NULL; }
00038
00039
00040 CU_SINLINE cucon_pcmap_t
00041 cucon_pcmap_singleton(void *key, uintptr_t val)
00042 { return (cucon_pcmap_t)cucon_ucmap_singleton((uintptr_t)key, val); }
00043
00044
00045 CU_SINLINE cucon_pcmap_t
00046 cucon_pcmap_singleton_ptr(void *key, void *val)
00047 { return (cucon_pcmap_t)cucon_ucmap_singleton_ptr((uintptr_t)key, val); }
00048
00049
00050 CU_SINLINE cu_bool_t
00051 cucon_pcmap_is_singleton(cucon_pcmap_t map)
00052 { return cucon_ucmap_is_singleton((cucon_ucmap_t)map); }
00053
00054
00055
00056 CU_SINLINE cu_bool_t
00057 cucon_pcmap_is_empty(cucon_pcmap_t map) { return map == NULL; }
00058
00059
00060 CU_SINLINE cucon_pcmap_t
00061 cucon_pcmap_insert(cucon_pcmap_t map, void *key, uintptr_t val)
00062 { return (cucon_pcmap_t)cucon_ucmap_insert((cucon_ucmap_t)map,
00063 (uintptr_t)key, val); }
00064
00065
00066
00067 CU_SINLINE cucon_pcmap_t
00068 cucon_pcmap_insert_ptr(cucon_pcmap_t map, void *key, void *val)
00069 {
00070 return (cucon_pcmap_t)cucon_ucmap_insert_ptr((cucon_ucmap_t)map,
00071 (uintptr_t)key, val);
00072 }
00073
00074
00075 CU_SINLINE cucon_pcmap_t
00076 cucon_pcmap_insert_int(cucon_pcmap_t map, void *key, int val)
00077 {
00078 return (cucon_pcmap_t)cucon_ucmap_insert_int((cucon_ucmap_t)map,
00079 (uintptr_t)key, val);
00080 }
00081
00082
00083 CU_SINLINE cu_bool_t
00084 cucon_pcmap_contains(cucon_pcmap_t map, void *key)
00085 { return cucon_ucmap_contains((cucon_ucmap_t)map, (uintptr_t)key); }
00086
00087
00088 CU_SINLINE cu_bool_t
00089 cucon_pcmap_find(cucon_pcmap_t map, void *key, uintptr_t *val_out)
00090 { return cucon_ucmap_find((cucon_ucmap_t)map, (uintptr_t)key, val_out); }
00091
00092 #define cucon_pcmap_int_none cucon_ucmap_int_none
00093
00094
00095 CU_SINLINE void *
00096 cucon_pcmap_find_ptr(cucon_pcmap_t map, void *key)
00097 { return cucon_ucmap_find_ptr((cucon_ucmap_t)map, (uintptr_t)key); }
00098
00099
00100 CU_SINLINE int
00101 cucon_pcmap_find_int(cucon_pcmap_t map, void *key)
00102 { return cucon_ucmap_find_int((cucon_ucmap_t)map, (uintptr_t)key); }
00103
00104 #if CUCONF_SIZEOF_INTPTR_T == CUCONF_SIZEOF_VOID_P
00105
00106
00107 CU_SINLINE cu_bool_t
00108 cucon_pcmap_conj_ptr(cucon_pcmap_t map,
00109 cu_clop(cb, cu_bool_t, void *key, void *val))
00110 { return cucon_ucmap_conj_ptr((cucon_ucmap_t)map,
00111 (cu_clop(, cu_bool_t, uintptr_t, void *))cb); }
00112
00113
00114 CU_SINLINE cu_bool_t
00115 cucon_pcmap_conj_int(cucon_pcmap_t map,
00116 cu_clop(cb, cu_bool_t, void *key, int val))
00117 { return cucon_ucmap_conj_int((cucon_ucmap_t)map,
00118 (cu_clop(, cu_bool_t, uintptr_t, int))cb); }
00119 #else
00120
00121
00122 cu_bool_t
00123 cucon_pcmap_conj_ptr(cucon_pcmap_t map,
00124 cu_clop(cb, cu_bool_t, void *key, void *val));
00125
00126
00127 cu_bool_t
00128 cucon_pcmap_conj_int(cucon_pcmap_t map,
00129 cu_clop(cb, cu_bool_t, void *key, int val));
00130
00131 #endif
00132
00133
00134 CU_SINLINE cu_bool_t
00135 cucon_pcmap_eq(cucon_pcmap_t map0, cucon_pcmap_t map1)
00136 { return cucon_ucmap_eq((cucon_ucmap_t)map0, (cucon_ucmap_t)map1); }
00137
00138
00139 CU_SINLINE cu_bool_t
00140 cucon_pcmap_eq_ptr(cu_clop(f, cu_bool_t, void const *, void const *),
00141 cucon_pcmap_t map0, cucon_pcmap_t map1)
00142 { return cucon_ucmap_eq_ptr(f, (cucon_ucmap_t)map0, (cucon_ucmap_t)map1); }
00143
00144
00145 CU_SINLINE int
00146 cucon_pcmap_cmp(cucon_pcmap_t map0, cucon_pcmap_t map1)
00147 { return cucon_ucmap_cmp((cucon_ucmap_t)map0, (cucon_ucmap_t)map1); }
00148
00149
00150 CU_SINLINE int
00151 cucon_pcmap_cmp_ptr(cu_clop(f, int, void const *, void const *),
00152 cucon_pcmap_t map0, cucon_pcmap_t map1)
00153 { return cucon_ucmap_cmp_ptr(f, (cucon_ucmap_t)map0, (cucon_ucmap_t)map1); }
00154
00155
00156 CU_SINLINE void
00157 cucon_pcmap_dump(cucon_pcmap_t map, FILE *out)
00158 { cucon_ucmap_dump((cucon_ucmap_t)map, out); }
00159
00160
00161 CU_END_DECLARATIONS
00162
00163 #endif