| Disk ARchive 2.5.10 Full featured and portable backup and archiving tool

- Main Page
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

integers.hpp
Go to the documentation of this file.
1 /*********************************************************************/
2 // dar - disk archive - a backup/restoration program
3 // Copyright (C) 2002-2052 Denis Corbin
4 //
5 // This program is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU General Public License
7 // as published by the Free Software Foundation; either version 2
8 // of the License, or (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 //
19 // to contact the author : http://dar.linux.free.fr/email.html
20 /*********************************************************************/
21
25
26
27 #ifndef INTEGERS_HPP
28 #define INTEGERS_HPP
29
30 #include "../my_config.h"
31 #include <string>
32
35
36 #ifndef OS_BITS
37
38 #if HAVE_INTTYPES_H
39 extern "C"
40 {
41 #if HAVE_INTTYPES_H
42 #include <inttypes.h>
43 #endif
44 #if HAVE_LIMITS_H
45 #include <limits.h>
46 #endif
47 } // end extern "C"
48
49 namespace libdar
50 {
51 typedef unsigned char U_8;
52 typedef uint16_t U_16;
53 typedef uint32_t U_32;
54 typedef uint64_t U_64;
55 typedef size_t U_I;
56 // configure will define size_t as "unsigned int" if it not defined by system headers
57 // thus using U_I we are sure we can compare buffer sizes with SSIZE_MAX
58 typedef signed char S_8;
59 typedef int16_t S_16;
60 typedef int32_t S_32;
61 typedef int64_t S_64;
62 typedef signed int S_I;
63
64 }
65
66 #else // HAVE_INTTYPES_H
67 #error "Cannot determine interger types, use --enable-os-bits=... with the 'configure' script according to your system's CPU register size"
68 #endif // HAVE_INTTYPES_H
69
70 #else // OS_BITS is defined
71 #if OS_BITS == 32
72
73 namespace libdar
74 {
75 typedef unsigned char U_8;
76 typedef unsigned short U_16;
77 typedef unsigned long U_32;
78 typedef unsigned long long U_64;
79 typedef size_t U_I;
80 typedef signed char S_8;
81 typedef signed short S_16;
82 typedef signed long S_32;
83 typedef signed long long S_64;
84 typedef signed int S_I;
85
86 }
87
88 #else // OS_BITS != 32
89 #if OS_BITS == 64
90
91 namespace libdar
92 {
93 typedef unsigned char U_8;
94 typedef unsigned short U_16;
95 typedef unsigned int U_32;
96 typedef unsigned long long U_64;
97 typedef size_t U_I;
98 typedef signed char S_8;
99 typedef signed short S_16;
100 typedef signed int S_32;
101 typedef signed long long S_64;
102 typedef signed int S_I;
103
104 }
105
106 #else // OS_BITS != 32 and OS_BITS != 64
107 #error "unknown value given to --enable-os-bits=... check the 'configure' script arguments"
108 // unknown OS_BITS value ! use --enable-os-bits=... option to configure script
109 //
110 // the previous line should not compile, this is the expected behaviour
111
112 #endif // OS_BITS == 64
113 #endif // OS_BITS == 32
114 #endif // OS_BITS not defined
115
116 namespace libdar
117 {
118
119
121
123 void integer_check();
124
125
127
130 bool integers_system_is_big_endian();
131
132 }
133
135
136
137 #endif // header file multiple inclusion protection
libdar::integers_system_is_big_endian
bool integers_system_is_big_endian()
returns true if the system is big endian, false else
libdar::integer_check
void integer_check()
checks sign and width of integer types
libdar
libdar namespace encapsulate all libdar symbols
Definition: archive.hpp:47