00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
#ifndef JF_DEFINES_H
00021
#define JF_DEFINES_H
00022
00023
#include <jf/jf_config.h>
00024
00025
00026
00027
#ifdef HAVE_STDLIB_H
00028
# include <stdlib.h>
00029
#endif
00030
#ifdef HAVE_STDINT_H
00031
# include <stdint.h>
00032
#endif
00033
#ifdef HAVE_SYS_INTTYPES_H
00034
# include <sys/inttypes.h>
00035
#endif
00036
#ifdef HAVE_SYS_TYPES_H
00037
# include <sys/types.h>
00038
#endif
00039
#ifdef HAVE_TIME_H
00040
# include <time.h>
00041
#endif
00042
00043
00044
00049
#if (SIZEOF_UINT32_T == SIZEOF_INT)
00050 # define UINT32_T_FORMAT "%u"
00051
#elif SIZEOF_UINT32_T == SIZEOF_LONG_INT
00052
# define UINT32_T_FORMAT "%lu"
00053
#elif SIZEOF_UINT32_T == SIZEOF_LONG_LONG_INT
00054
# define UINT32_T_FORMAT "%llu"
00055
#else
00056
# error Unable to determine sizeof(uint32_t)
00057
#endif
00058
00059
00060
00064 #define JF_WORD_T_FORMAT UINT32_T_FORMAT
00065
00066
00067
00068
#if SIZEOF_SIZE_T == SIZEOF_INT
00069 # define SIZE_T_FORMAT "%u"
00070
#elif SIZEOF_SIZE_T == SIZEOF_LONG_INT
00071
# define SIZE_T_FORMAT "%lu"
00072
#elif SIZEOF_SIZE_T == SIZEOF_LONG_LONG_INT
00073
# define SIZE_T_FORMAT "%llu"
00074
#else
00075
# error Unable to determine sizeof(size_t)
00076
#endif
00077
00078
00079
00080
#ifdef HAVE_TIME_H
00081
# if SIZEOF_CLOCK_T == SIZEOF_INT
00082
# define CLOCK_T_FORMAT "%d"
00083
# elif SIZEOF_CLOCK_T == SIZEOF_LONG_INT
00084
# define CLOCK_T_FORMAT "%ld"
00085
# elif SIZEOF_CLOCK_T == SIZEOF_LONG_LONG_INT
00086
# define CLOCK_T_FORMAT "%lld"
00087
# else
00088
# error Unable to determine sizeof(clock_t)
00089
# endif
00090
#endif
00091
00092
00093
00097
#if SIZEOF_OFF_T == SIZEOF_LONG_INT
00098 # define OFF_T_FORMAT "%ld"
00099
#elif SIZEOF_OFF_T == SIZEOF_LONG_LONG_INT
00100
# define OFF_T_FORMAT "%lld"
00101
#else
00102
# error Unable to determine sizeof(off_t)
00103
#endif
00104
00105
00106
00107
00108
#ifdef _MSVCPP
00109
# define _DOS_FILESYSTEM_SCHEME
00110
# if !defined(PATH_MAX)
00111
# if defined(_MAX_PATH)
00112
00113
# define PATH_MAX _MAX_PATH
00114
# endif
00115
# endif
00116
00117
# define inline __inline
00118
00120
# ifdef BUILD_LIBJF_DLL
00121
# define LIBJF_EXPORT __declspec(dllexport)
00122
# else
00123
# define LIBJF_EXPORT __declspec(dllimport)
00124
# endif
00125
00126
# include <io.h>
00127
# include <stdio.h>
00128
# define fileno _fileno
00129
# define fsync _commit
00130
# define HAVE_FSYNC
00131
00132
00133
00134
00135
00136
# ifdef _MSVCPP_ARCH_I386
00137
00138
# define SIZEOF_INT 4
00139
00140
# endif
00141
#else
00142 # define LIBJF_EXPORT
00143
#endif
00144
00145
#ifdef _DOS_FILESYSTEM_SCHEME
00146
00147
# define JF_PATH_SEPARATOR '\\'
00148
#else
00149
00150 # define JF_PATH_SEPARATOR '/'
00151
#endif
00152
00153
00154
00155
#ifdef __cplusplus
00156
extern "C" {
00157
#endif
00158
00159
00160
00161
#ifndef HAVE_UINT8_T
00162
00163 typedef unsigned char uint8_t;
00164
#endif
00165
#ifndef HAVE_UINT32_T
00166
# if (SIZEOF_INT == 4)
00167
00168
typedef unsigned int uint32_t;
00169
# else
00170
# error "Please specify a 32 bit wide unsigned int type"
00171
# endif
00172
#endif
00173
00174
00175
00179 typedef uint8_t byte_t;
00180
00181
00182
00187 typedef uint32_t
jf_word_t;
00188
00189
00190
00191
#ifdef __cplusplus
00192
}
00193
#endif
00194
00195
00196
00197
#endif
00198