libjf API reference guide

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

jf_utils.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 UTILS_H 00021 #define UTILS_H 00022 00023 00024 00025 #include <jf/jf_config.h> 00026 00027 00028 00029 #ifdef HAVE_STDIO_H 00030 # include <stdio.h> 00031 #endif /* HAVE_STDIO_H */ 00032 00033 #include <jf/jf_defines.h> 00034 #include <jf/jf_wrappers.h> 00035 #include <jf/jf_errors.h> 00036 00037 00038 00039 /* save old JF_TRACE_MODULE and set a new value */ 00040 #ifdef JF_TRACE_MODULE 00041 # define JF_TRACE_MODULE_SAVE JF_TRACE_MODULE 00042 # undef JF_TRACE_MODULE 00043 #else 00044 # undef JF_TRACE_MODULE_SAVE 00045 #endif /* JF_TRACE_MODULE */ 00046 #define JF_TRACE_MODULE JF_TRACE_MOD_LIB_UTILS 00047 00048 00049 00050 #ifndef MAX 00051 #define MAX(a,b) (a>b ? a : b) 00052 #endif /* MAX */ 00053 #ifndef MIN 00054 #define MIN(a,b) (a<b ? a : b) 00055 #endif /* MIN */ 00056 00057 00058 00059 #ifdef __cplusplus 00060 extern "C" { 00061 #endif /* __cplusplus */ 00062 00063 00064 00072 extern const char *jf_feature_debug; 00073 00081 extern const char *jf_feature_crash_simul; 00082 00090 extern const char *jf_feature_cache_stress; 00091 00099 extern const char *jf_feature_extra_check; 00100 00101 00102 00113 int jf_translate_NL_CRLF(const byte_t *in_data, jf_word_t in_size, 00114 byte_t **out_data, jf_word_t *out_size); 00115 00116 00117 00118 00127 int jf_translate_CRLF_NL(byte_t *data, jf_word_t *size); 00128 00129 00130 00131 00143 unsigned long jf_magnitude(unsigned long v); 00144 00145 00146 00153 int jf_stream_truncate(FILE *stream, jf_offset_t size); 00154 00155 00156 00163 int jf_stream_size(FILE *stream, jf_offset_t *size); 00164 00165 00166 00176 int jf_stream_sync(FILE *stream, jf_word_t policy); 00177 00178 00179 00187 int jf_path_is_absolute(const char *path); 00188 00189 00190 00191 #ifdef __cplusplus 00192 } 00193 #endif /* __cplusplus */ 00194 00195 00196 00197 /* restore old value of JF_TRACE_MODULE */ 00198 #ifdef JF_TRACE_MODULE_SAVE 00199 # undef JF_TRACE_MODULE 00200 # define JF_TRACE_MODULE JF_TRACE_MODULE_SAVE 00201 # undef JF_TRACE_MODULE_SAVE 00202 #endif /* JF_TRACE_MODULE_SAVE */ 00203 00204 00205 00206 #endif /* UTILS_H */

Copyright 2005 © Tiian