steghide  0.5.1
common.h
Go to the documentation of this file.
1 /*
2  * steghide 0.5.1 - a steganography program
3  * Copyright (C) 1999-2003 Stefan Hetzl <shetzl@chello.at>
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  */
20 
21 #ifndef SH_COMMON_H
22 #define SH_COMMON_H
23 
24 //
25 // this file contains some definitions that are/can be used throughout the whole program
26 //
27 
28 //
29 // include config.h
30 #ifdef HAVE_CONFIG_H
31 #include "config.h"
32 #endif
33 
34 //
35 // generic type definitions
36 #ifdef HAVE_CONFIG_H
37 typedef TYPE_UWORD32 UWORD32 ;
38 typedef TYPE_UWORD16 UWORD16 ;
39 typedef TYPE_BYTE BYTE ;
40 typedef TYPE_SWORD32 SWORD32 ;
41 typedef TYPE_SWORD16 SWORD16 ;
42 typedef TYPE_SBYTE SBYTE ;
43 #else
44 // use types that are at least the correct size
45 typedef unsigned long UWORD32 ;
46 typedef unsigned short UWORD16 ;
47 typedef unsigned char BYTE ;
48 typedef long SWORD32 ;
49 typedef short SWORD16 ;
50 typedef char SBYTE ;
51 #endif
52 
53 #define UWORD32_MAX 0xFFFFFFFFUL
54 #define UWORD16_MAX 0xFFFF
55 #define BYTE_MAX 0xFF
56 #define SWORD32_MIN -2147483647 - 1 // to avoid a gcc warning (caused by an overflow)
57 #define SWORD32_MAX 2147483647
58 #define SWORD16_MIN -32768
59 #define SWORD16_MAX 32767
60 #define SBYTE_MIN -128
61 #define SBYTE_MAX 127
62 
63 //
64 // specialised type definitions
65 typedef bool BIT ;
66 typedef BYTE EmbValue ;
67 typedef UWORD32 SamplePos ;
70 typedef UWORD32 SampleKey ;
71 
72 #define SAMPLEKEY_MAX UWORD32_MAX
73 #define VERTEXLABEL_MAX UWORD32_MAX
74 
75 //
76 // gettext support
77 #include "gettext.h"
78 #define _(S) gettext (S)
79 
80 //
81 // global variables
82 #include "Globals.h"
83 extern Globals Globs ;
84 
85 //
86 // every class should (be able to) do assertions
87 // (myassert(expr) is more verbose than the standard C assert)
88 #include "AssertionFailed.h"
89 #define myassert(expr) if (!(expr)) throw AssertionFailed (__FILE__, __LINE__)
90 
91 //
92 // every class can have debugging output
93 #include <iostream> // for verbose testing output
94 #if DEBUG
95 #define RUNDEBUGLEVEL(LEVEL) ((LEVEL) <= Args.DebugLevel.getValue())
96 extern void printDebug (unsigned short level, const char *msgfmt, ...) ;
97 #endif
98 
99 //
100 // every class has access to the command line arguments
101 #include "Arguments.h"
102 extern Arguments Args ;
103 
104 //
105 // every class has access to random data
106 #include "RandomSource.h"
107 extern RandomSource RndSrc ;
108 
109 #endif // ndef SH_COMMON_H
Arguments.h
AssertionFailed.h
SamplePos
UWORD32 SamplePos
Definition: common.h:67
SampleValueLabel
UWORD32 SampleValueLabel
Definition: common.h:69
UWORD32
unsigned long UWORD32
Definition: common.h:45
UWORD16
unsigned short UWORD16
Definition: common.h:46
Globals
some useful pointers that should be global
Definition: Globals.h:52
VertexLabel
UWORD32 VertexLabel
Definition: common.h:68
BYTE
unsigned char BYTE
Definition: common.h:47
RandomSource
objects of this class are used as a source of random (non reproduceable) data
Definition: RandomSource.h:33
Args
Arguments Args
Definition: Arguments.cc:34
SWORD32
long SWORD32
Definition: common.h:48
gettext.h
EmbValue
BYTE EmbValue
Definition: common.h:66
Globals.h
SBYTE
char SBYTE
Definition: common.h:50
SampleKey
UWORD32 SampleKey
Definition: common.h:70
RndSrc
RandomSource RndSrc
Definition: RandomSource.cc:31
BIT
bool BIT
Definition: common.h:65
Arguments
parsing and data representation of command-line arguments
Definition: Arguments.h:38
SWORD16
short SWORD16
Definition: common.h:49
Globs
Globals Globs
Definition: Embedder.cc:41
RandomSource.h