common.h

Go to the documentation of this file.
00001 /*
00002  * steghide 0.5.1 - a steganography program
00003  * Copyright (C) 1999-2003 Stefan Hetzl <shetzl@chello.at>
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  */
00020 
00021 #ifndef SH_COMMON_H
00022 #define SH_COMMON_H
00023 
00024 //
00025 // this file contains some definitions that are/can be used throughout the whole program
00026 //
00027 
00028 //
00029 // include config.h
00030 #ifdef HAVE_CONFIG_H
00031 #include "config.h"
00032 #endif
00033 
00034 //
00035 // generic type definitions
00036 #ifdef HAVE_CONFIG_H
00037 typedef TYPE_UWORD32    UWORD32 ;
00038 typedef TYPE_UWORD16    UWORD16 ;
00039 typedef TYPE_BYTE               BYTE ;
00040 typedef TYPE_SWORD32    SWORD32 ;
00041 typedef TYPE_SWORD16    SWORD16 ;
00042 typedef TYPE_SBYTE              SBYTE ;
00043 #else
00044 // use types that are at least the correct size
00045 typedef unsigned long   UWORD32 ;
00046 typedef unsigned short  UWORD16 ;
00047 typedef unsigned char   BYTE ;
00048 typedef long                    SWORD32 ;
00049 typedef short                   SWORD16 ;
00050 typedef char                    SBYTE ;
00051 #endif
00052 
00053 #define UWORD32_MAX             0xFFFFFFFFUL
00054 #define UWORD16_MAX             0xFFFF
00055 #define BYTE_MAX                0xFF
00056 #define SWORD32_MIN             -2147483647 - 1 // to avoid a gcc warning (caused by an overflow)
00057 #define SWORD32_MAX             2147483647
00058 #define SWORD16_MIN             -32768
00059 #define SWORD16_MAX             32767
00060 #define SBYTE_MIN               -128
00061 #define SBYTE_MAX               127
00062 
00063 //
00064 // specialised type definitions
00065 typedef bool BIT ;
00066 typedef BYTE    EmbValue ;
00067 typedef UWORD32 SamplePos ;
00068 typedef UWORD32 VertexLabel ;
00069 typedef UWORD32 SampleValueLabel ;
00070 typedef UWORD32 SampleKey ;
00071 
00072 #define SAMPLEKEY_MAX UWORD32_MAX
00073 #define VERTEXLABEL_MAX UWORD32_MAX
00074 
00075 //
00076 // gettext support
00077 #include "gettext.h" 
00078 #define _(S) gettext (S)
00079 
00080 //
00081 // global variables
00082 #include "Globals.h"
00083 extern Globals Globs ;
00084 
00085 //
00086 // every class should (be able to) do assertions
00087 // (myassert(expr) is more verbose than the standard C assert)
00088 #include "AssertionFailed.h"
00089 #define myassert(expr)          if (!(expr)) throw AssertionFailed (__FILE__, __LINE__)
00090 
00091 //
00092 // every class can have debugging output
00093 #include <iostream> // for verbose testing output
00094 #if DEBUG
00095 #define RUNDEBUGLEVEL(LEVEL) ((LEVEL) <= Args.DebugLevel.getValue())
00096 extern void printDebug (unsigned short level, const char *msgfmt, ...) ;
00097 #endif
00098 
00099 //
00100 // every class has access to the command line arguments
00101 #include "Arguments.h"
00102 extern Arguments Args ;
00103 
00104 //
00105 // every class has access to random data
00106 #include "RandomSource.h"
00107 extern RandomSource RndSrc ;
00108 
00109 #endif // ndef SH_COMMON_H

Generated on Fri Feb 2 09:21:48 2007 for steghide by  doxygen 1.5.1