Disk ARchive
2.4.2
|
00001 /*********************************************************************/ 00002 // dar - disk archive - a backup/restoration program 00003 // Copyright (C) 2002-2052 Denis Corbin 00004 // 00005 // This program is free software; you can redistribute it and/or 00006 // modify it under the terms of the GNU General Public License 00007 // as published by the Free Software Foundation; either version 2 00008 // of the License, or (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 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 // to contact the author : http://dar.linux.free.fr/email.html 00020 /*********************************************************************/ 00021 // $Id: integers.hpp,v 1.17 2011/02/17 21:45:22 edrusb Rel $ 00022 // 00023 /*********************************************************************/ 00024 00025 00029 00030 00031 #ifndef INTEGERS_HPP 00032 #define INTEGERS_HPP 00033 00034 #include "../my_config.h" 00035 #include <string> 00036 00039 00040 #ifndef OS_BITS 00041 00042 #if HAVE_INTTYPES_H 00043 extern "C" 00044 { 00045 #if HAVE_INTTYPES_H 00046 #include <inttypes.h> 00047 #endif 00048 #if HAVE_LIMITS_H 00049 #include <limits.h> 00050 #endif 00051 } // end extern "C" 00052 00053 namespace libdar 00054 { 00055 typedef unsigned char U_8; 00056 typedef uint16_t U_16; 00057 typedef uint32_t U_32; 00058 typedef uint64_t U_64; 00059 typedef size_t U_I; 00060 // configure will define size_t as "unsigned int" if it not defined by system headers 00061 // thus using U_I we are sure we can compare buffer sizes with SSIZE_MAX 00062 typedef signed char S_8; 00063 typedef int16_t S_16; 00064 typedef int32_t S_32; 00065 typedef int64_t S_64; 00066 typedef signed int S_I; 00067 00068 } 00069 00070 #else // HAVE_INTTYPES_H 00071 #error "Cannot determine interger types, use --enable-os-bits=... with the 'configure' script according to your system's CPU register size" 00072 #endif // HAVE_INTTYPES_H 00073 00074 #else // OS_BITS is defined 00075 #if OS_BITS == 32 00076 00077 namespace libdar 00078 { 00079 typedef unsigned char U_8; 00080 typedef unsigned short U_16; 00081 typedef unsigned long U_32; 00082 typedef unsigned long long U_64; 00083 typedef size_t U_I; 00084 typedef signed char S_8; 00085 typedef signed short S_16; 00086 typedef signed long S_32; 00087 typedef signed long long S_64; 00088 typedef signed int S_I; 00089 00090 } 00091 00092 #else // OS_BITS != 32 00093 #if OS_BITS == 64 00094 00095 namespace libdar 00096 { 00097 typedef unsigned char U_8; 00098 typedef unsigned short U_16; 00099 typedef unsigned int U_32; 00100 typedef unsigned long long U_64; 00101 typedef size_t U_I; 00102 typedef signed char S_8; 00103 typedef signed short S_16; 00104 typedef signed int S_32; 00105 typedef signed long long S_64; 00106 typedef signed int S_I; 00107 00108 } 00109 00110 #else // OS_BITS != 32 and OS_BITS != 64 00111 #error "unknown value given to --enable-os-bits=... check the 'configure' script arguments" 00112 // unknown OS_BITS value ! use --enable-os-bits=... option to configure script 00113 // 00114 // the previous line should not compile, this is the expected behaviour 00115 00116 #endif // OS_BITS == 64 00117 #endif // OS_BITS == 32 00118 #endif // OS_BITS not defined 00119 00120 namespace libdar 00121 { 00122 00123 00125 00127 void integer_check(); 00128 00129 00131 00134 bool integers_system_is_big_endian(); 00135 00136 } 00137 00139 00140 00141 #endif // header file multiple inclusion protection