libjf API reference guide

Main Page | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

jf_defines.h

Go to the documentation of this file.
00001 /* 00002 * Copyright 2005 Tiian 00003 * {In real life Tiian is Christian Ferrari} 00004 * This file is part of "libjf" package. 00005 * 00006 * "libjf" is free software; you can redistribute it and/or modify 00007 * it under the terms of the GNU Lesser General Public License as published by 00008 * the Free Software Foundation; either version 2.1 of the License, or 00009 * (at your option) any later version. 00010 * 00011 * "libjf" is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 * GNU Lesser General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU Lesser General Public License 00017 * along with ; if not, write to the Free Software 00018 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 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 /* HAVE_STDLIB_H */ 00030 #ifdef HAVE_STDINT_H 00031 # include <stdint.h> 00032 #endif /* HAVE_STDINT_H */ 00033 #ifdef HAVE_SYS_INTTYPES_H 00034 # include <sys/inttypes.h> 00035 #endif /* HAVE_SYS_INTTYPES_H */ 00036 #ifdef HAVE_SYS_TYPES_H 00037 # include <sys/types.h> 00038 #endif /* HAVE_SYS_TYPES_H */ 00039 #ifdef HAVE_TIME_H 00040 # include <time.h> 00041 #endif /* HAVE_TIME_H */ 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 /* HAVE_TIME_H */ 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 /* Microsoft Visual C++ specific macros */ 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 /* defined(MAX_PATH) */ 00115 # endif /* !defined(PATH_MAX) */ 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 /* Macro redefinition for MS Visual C++ */ 00126 # include <io.h> 00127 # include <stdio.h> 00128 # define fileno _fileno 00129 # define fsync _commit 00130 # define HAVE_FSYNC 00131 00132 /* architecture specific constants defined only 00133 00134 * when using Microsoft Visual C++ compiler */ 00135 00136 # ifdef _MSVCPP_ARCH_I386 00137 00138 # define SIZEOF_INT 4 00139 00140 # endif /* _MSVCPP_ARCH_I386 */ 00141 #else 00142 # define LIBJF_EXPORT 00143 #endif /* _MSVCPP */ 00144 00145 #ifdef _DOS_FILESYSTEM_SCHEME 00146 00147 # define JF_PATH_SEPARATOR '\\' 00148 #else 00149 00150 # define JF_PATH_SEPARATOR '/' 00151 #endif /* _DOS_FILESYSTEM_SCHEME */ 00152 00153 00154 00155 #ifdef __cplusplus 00156 extern "C" { 00157 #endif /* __cplusplus */ 00158 00159 00160 00161 #ifndef HAVE_UINT8_T 00162 00163 typedef unsigned char uint8_t; 00164 #endif /* HAVE_UINT8_T */ 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 /* if (SIZEOF_INT == 4) */ 00172 #endif /* HAVE_UINT32_T */ 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 /* __cplusplus */ 00194 00195 00196 00197 #endif /* JF_DEFINES_H */ 00198

Copyright 2005 © Tiian