Main Page | Namespace List | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

yepp_utils.h

Go to the documentation of this file.
00001 /*************************************************************************** 00002 * $Id: yepp_utils.h,v 1.4 2005/05/25 18:58:46 cowo Exp $ 00003 ****************************************************************************/ 00004 /* 00005 * This program is free software; you can redistribute it and/or modify 00006 * it under the terms of the GNU General Public License as published by 00007 * the Free Software Foundation; either version 2 of the License, or 00008 * (at your option) any later version. 00009 * 00010 * This program is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 * GNU Library General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU General Public License 00016 * along with this program; if not, write to the Free Software 00017 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00018 */ 00019 00026 #ifndef _YEPP_UTILS_H_ 00027 #define _YEPP_UTILS_H_ 00028 00029 #ifdef HAVE_CONFIG_H 00030 #include "config.h" 00031 #endif //HAVE_CONFIG_H 00032 00033 #ifdef __cplusplus 00034 extern "C" { 00035 #endif //__cplusplus 00036 00037 #ifdef _WIN32 00038 #define DIR_SEPARATOR '\\' 00039 #define DIR_SEPARATOR_S "\\" 00040 #else 00041 #define DIR_SEPARATOR '/' 00042 #define DIR_SEPARATOR_S "//" 00043 #endif //_WIN32 00044 00045 #ifdef _MSC_VER 00046 #if _MSC_VER <= 1300 00047 #error "M$C does not support variadic macros" 00048 #endif 00049 #endif //_MSC_VER 00050 00056 int chars2uint (unsigned char *buf, int len); 00058 int chars2int (char *buf, int len); 00060 int chars2int_le (char *buf, int len); 00061 void prbytes_x (char *message, char *buffer, int blen); 00062 #ifdef DEBUG 00063 #define prbytes(m,b,l) prbytes_x(m, b, l) 00064 #else 00065 #define prbytes(m,b,l) 00066 #endif 00067 00068 void debug_printf_x(const char *file, int line, const char *format, ...); 00069 void debug_printf_msc(const char *file, int line, const char *debugstring); 00070 #define li_to_4_byte(a, i) (((unsigned char *)(a))[3] = ((i) >> 24)& 0xFF,\ 00071 ((unsigned char *)(a))[2] = ((i) >> 16)& 0xFF,\ 00072 ((unsigned char *)(a))[1] = ((i) >> 8) & 0xFF,\ 00073 ((unsigned char *)(a))[0] = (i) & 0xFF) 00074 #define li_to_4_byte_le(a, i) (((unsigned char *)(a))[0] = ((i) >> 24)& 0xFF,\ 00075 ((unsigned char *)(a))[1] = ((i) >> 16)& 0xFF,\ 00076 ((unsigned char *)(a))[2] = ((i) >> 8) & 0xFF,\ 00077 ((unsigned char *)(a))[3] = (i) & 0xFF) 00078 00079 #ifdef DEBUG 00080 00081 #ifdef __GNUC__ 00082 #define debug_printf(F, args...) debug_printf_x(__FILE__, __LINE__, F, ## args) 00083 #elif // C99 00084 #define debug_printf(F, ...) debug_printf_x(__FILE__, __LINE__, F, __VA_ARGS__) 00085 #endif //__GNUC__ 00086 00087 #else //DEBUG 00088 00089 #ifdef __GNUC__ 00090 #define debug_printf(F, args...) 00091 #else // C99 00092 #define debug_printf(F, ...) 00093 #endif //__GNUC__ 00094 00095 #endif /* DEBUG */ 00096 00097 #ifdef __cplusplus 00098 } 00099 #endif 00100 00105 #define GET_BITS(var, bit, bits) (((var) >> (bit)) & ((1UL << (bits)) - 1)) 00106 00113 #define SET_BITS(var, bit, bits, x) (var) = ((var) & ~(((1UL << (bits)) - 1) << (bit))) | (((x) & ((1UL << (bits)) - 1)) << (bit)); 00114 00115 #endif // _YEPP_UTILS_H_ 00116

Generated on Sun May 29 16:13:38 2005 for yex by doxygen 1.3.7