![]() |
Disk ARchive
2.5.2
Full featured and portable backup and archiving tool
|
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 00025 00026 00027 #ifndef INTEGERS_HPP 00028 #define INTEGERS_HPP 00029 00030 #include "../my_config.h" 00031 #include <string> 00032 00035 00036 #ifndef OS_BITS 00037 00038 #if HAVE_INTTYPES_H 00039 extern "C" 00040 { 00041 #if HAVE_INTTYPES_H 00042 #include <inttypes.h> 00043 #endif 00044 #if HAVE_LIMITS_H 00045 #include <limits.h> 00046 #endif 00047 } // end extern "C" 00048 00049 namespace libdar 00050 { 00051 typedef unsigned char U_8; 00052 typedef uint16_t U_16; 00053 typedef uint32_t U_32; 00054 typedef uint64_t U_64; 00055 typedef size_t U_I; 00056 // configure will define size_t as "unsigned int" if it not defined by system headers 00057 // thus using U_I we are sure we can compare buffer sizes with SSIZE_MAX 00058 typedef signed char S_8; 00059 typedef int16_t S_16; 00060 typedef int32_t S_32; 00061 typedef int64_t S_64; 00062 typedef signed int S_I; 00063 00064 } 00065 00066 #else // HAVE_INTTYPES_H 00067 #error "Cannot determine interger types, use --enable-os-bits=... with the 'configure' script according to your system's CPU register size" 00068 #endif // HAVE_INTTYPES_H 00069 00070 #else // OS_BITS is defined 00071 #if OS_BITS == 32 00072 00073 namespace libdar 00074 { 00075 typedef unsigned char U_8; 00076 typedef unsigned short U_16; 00077 typedef unsigned long U_32; 00078 typedef unsigned long long U_64; 00079 typedef size_t U_I; 00080 typedef signed char S_8; 00081 typedef signed short S_16; 00082 typedef signed long S_32; 00083 typedef signed long long S_64; 00084 typedef signed int S_I; 00085 00086 } 00087 00088 #else // OS_BITS != 32 00089 #if OS_BITS == 64 00090 00091 namespace libdar 00092 { 00093 typedef unsigned char U_8; 00094 typedef unsigned short U_16; 00095 typedef unsigned int U_32; 00096 typedef unsigned long long U_64; 00097 typedef size_t U_I; 00098 typedef signed char S_8; 00099 typedef signed short S_16; 00100 typedef signed int S_32; 00101 typedef signed long long S_64; 00102 typedef signed int S_I; 00103 00104 } 00105 00106 #else // OS_BITS != 32 and OS_BITS != 64 00107 #error "unknown value given to --enable-os-bits=... check the 'configure' script arguments" 00108 // unknown OS_BITS value ! use --enable-os-bits=... option to configure script 00109 // 00110 // the previous line should not compile, this is the expected behaviour 00111 00112 #endif // OS_BITS == 64 00113 #endif // OS_BITS == 32 00114 #endif // OS_BITS not defined 00115 00116 namespace libdar 00117 { 00118 00119 00121 00123 void integer_check(); 00124 00125 00127 00130 bool integers_system_is_big_endian(); 00131 00132 } 00133 00135 00136 00137 #endif // header file multiple inclusion protection