00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef CU_FWD_H
00019 #define CU_FWD_H
00020
00021 #include <stdlib.h>
00022 #include <stdint.h>
00023 #include <cu/conf.h>
00024
00025 #ifdef __cplusplus
00026 # define CU_BEGIN_DECLARATIONS extern "C" {
00027 # define CU_END_DECLARATIONS }
00028 #else
00029 # define CU_BEGIN_DECLARATIONS
00030 # define CU_END_DECLARATIONS
00031 #endif
00032
00033
00034 CU_BEGIN_DECLARATIONS
00035
00036
00037
00038
00039
00040 #define CU_SINLINE static inline
00041
00042 #ifdef NDEBUG
00043 # define CU_NDEBUG
00044 # define CU_NDEBUG_CLIENT
00045 #endif
00046
00047 #ifndef CU_MARG
00048 # ifndef CU_NDEBUG
00049 # define CU_MARG(ptr_t, ptr) ((ptr_t)(1? (ptr_t)(ptr) : (ptr)))
00050 # else
00051 # define CU_MARG(ptr_t, ptr) ((ptr_t)(ptr))
00052 # endif
00053 #endif
00054
00055 CU_SINLINE void cu_noop() {}
00056
00057
00058
00059
00060 #define CU_NOINIT(...) = __VA_ARGS__
00061
00062
00063 #define CU_DISCARD(call) ((call)? cu_noop() : cu_noop())
00064
00065
00066
00067
00068 #ifdef __GNUC__
00069 # define CU_ATTR_NORETURN __attribute__ ((noreturn))
00070 # define CU_ATTR_PURE __attribute__ ((pure))
00071 # define CU_ATTR_CONST __attribute__ ((const))
00072 # define CU_ATTR_UNUSED __attribute__ ((unused))
00073 # define CU_ATTR_DEPRECATED __attribute__ ((deprecated))
00074 # define CU_ATTR_MALLOC __attribute__ ((malloc))
00075 # define cu_expect(e, c) __builtin_expect(e, c)
00076 #else
00077 # define CU_ATTR_NORETURN
00078 # define CU_ATTR_PURE
00079 # define CU_ATTR_CONST
00080 # define CU_ATTR_UNUSED
00081 # define CU_ATTR_DEPRECATED
00082 # define CU_ATTR_MALLOC
00083 # define cu_expect(e, c) (e)
00084 #endif
00085 #define cu_expect_false(e) cu_expect(e, cu_false)
00086 #define cu_expect_true(e) cu_expect(e, cu_true)
00087
00088 #define CU_END_BOILERPLATE struct cuP_expecting_semicolor_after_boilerplate
00089
00090 #define CU_DOXY_FAKED
00091 #define CU_DOXY_ENDFAKED(...)
00092 #ifdef CU_IN_DOXYGEN
00093 # define CU_DOXY_AID(fake, ...) \
00094 \
00095 \
00096 \
00097 \
00098 fake
00099 #else
00100 # define CU_DOXY_AID(fake, ...) __VA_ARGS__
00101 #endif
00102
00103
00104
00105
00106
00107
00108 typedef unsigned int cu_bool_t;
00109
00110
00111 typedef unsigned int cu_bool_fast_t;
00112
00113
00114 typedef unsigned char cu_bool_least_t;
00115
00116
00117 #define cu_true 1
00118
00119
00120 #define cu_false 0
00121
00122 typedef void *cu_ptr_t;
00123
00124
00125 typedef void *cu_ptr_ptr_t;
00126
00127
00128
00129 typedef void (*cu_fnptr_t)();
00130
00131
00132
00133
00134 typedef unsigned int cu_shortsize_t;
00135 typedef unsigned int cu_rank_t;
00136 #define CU_RANK_MAX UINT_MAX
00137
00138
00139
00140 typedef unsigned int cu_logsize_fast_t;
00141 typedef unsigned char cu_logsize_least_t;
00142 #define cu_logsize_width 6
00143
00144
00145 typedef unsigned long int cu_hash_t;
00146
00147
00148 #define CUCONF_SIZEOF_CU_HASH_T CUCONF_SIZEOF_LONG
00149
00150
00151
00152
00153
00154 typedef uintptr_t cu_word_t;
00155
00156 #define CU_WORD_WIDTH CUCONF_WIDTHOF_INTPTR_T
00157 #define CU_WORD_P2WIDTH CUCONF_P2WIDTHOF_INTPTR_T
00158 #define CU_WORD_LOG2_P2WIDTH CUCONF_LOG2_P2WIDTHOF_INTPTR_T
00159 #define CU_WORD_SIZE CUCONF_SIZEOF_INTPTR_T
00160 #define CU_WORD_C(x) ((cu_word_t)x##UL)
00161 #define CU_PRIdWORD PRIdPTR
00162 #define CU_PRIuWORD PRIuPTR
00163 #define CU_PRIxWORD PRIxPTR
00164 #define CU_SCNdWORD SCNdPTR
00165 #define CU_SCNiWORD SCNiPTR
00166 #define CU_SCNuWORD SCNuPTR
00167 #define CU_SCNxWORD SCNxPTR
00168
00169
00170 #define CU_UINTPTR_C(x) ((uintptr_t)x##UL)
00171
00172
00173 typedef int cu_offset_t;
00174 #define CU_OFFSET_NAME CUP_UINT_NAME
00175
00176 #ifdef CUCONF_ENABLE_LARGE_DATASETS
00177 typedef size_t cu_count_t;
00178 typedef ptrdiff_t cu_countdiff_t;
00179 #else
00180 typedef unsigned int cu_count_t;
00181 typedef int cu_countdiff_t;
00182 #endif
00183
00184
00185
00186
00187
00188 typedef struct cu_buffer *cu_buffer_t;
00189 typedef struct cu_dlink *cu_dlink_t;
00190 typedef struct cu_dbufsink *cu_dbufsink_t;
00191 typedef struct cu_dcountsink *cu_dcountsink_t;
00192 typedef struct cu_dsink *cu_dsink_t;
00193 typedef struct cu_dsource *cu_dsource_t;
00194 typedef struct cu_idr *cu_idr_t;
00195 typedef struct cu_locbound *cu_locbound_t;
00196 typedef struct cu_locorigin *cu_locorigin_t;
00197 typedef struct cu_location *cu_location_t;
00198 typedef struct cu_log_facility *cu_log_facility_t;
00199 typedef struct cu_ptr_array_source *cu_ptr_array_source_t;
00200 typedef struct cu_ptr_source *cu_ptr_source_t;
00201 typedef struct cu_ptr_sink *cu_ptr_sink_t;
00202 typedef struct cu_ptr_junction *cu_ptr_junction_t;
00203 typedef struct cu_ptr_sinktor *cu_ptr_sinktor_t;
00204 typedef struct cu_ptr_junctor *cu_ptr_junctor_t;
00205 typedef struct cu_location *cu_sref_t;
00206 typedef struct cu_str *cu_str_t;
00207 typedef struct cu_wstring *cu_wstring_t;
00208
00209
00210
00211
00212
00213
00214
00215
00216 void cu_init(void);
00217
00218
00219 CU_END_DECLARATIONS
00220
00221 #ifndef CU_NCOMPAT
00222 # include <cu/compat.h>
00223 #endif
00224 #endif