Main Page | Data Structures | File List | Data Fields | Globals

generalDefines.h

Go to the documentation of this file.
00001 /** @file
00002 * This file contains several defines that are used throughout the program.
00003 *
00004 * @author Uli Fechner
00005 * @version 13/05/2003 - Uli Fechner - v1.0.0 - initial release
00006 * @version 24/11/2003 - Uli Fechner - v1.0.1 - modifications to comply to the needs of flux
00007 * @version 29/01/2004 - Tina Grabowski - v1.0.2 - added @ref DAYLIGHT_SMILES, @ref DAYLIGHT_SMIRKS
00008 *                       @ref DAYLIGHT_SMARTS
00009 */
00010 
00011 /* 'simple' define */
00012 #ifndef __GENERALDEFINES_H__
00013 #define __GENERALDEFINES_H__
00014 
00015 /* just some information about this file */
00016 #define GENERALDEFINES_VERSION  "1.0.2"
00017 #define GENERALDEFINES_DATE     "29-Jan-2003"
00018 
00019 /* general defines */
00020 
00021 /** If FLUX_DEBUG is set to 1 some debug information is written to the output file.
00022 *
00023 * @author Uli Fechner
00024 * @version 24/11/2003 - Uli Fechner - initial release
00025 */
00026 #ifndef RETROFLUX_DEBUG
00027 #define RETROFLUX_DEBUG 0
00028 #endif
00029 
00030 /** Simulates the boolean value @c false.
00031 *
00032 * Together with @ref BOOLEAN_TRUE a boolean variable is simulated in C.
00033 * @author Uli Fechner
00034 * @version 13/05/2003 - Uli Fechner - initial release
00035 */
00036 #ifndef BOOLEAN_FALSE
00037 #define BOOLEAN_FALSE 0
00038 #endif
00039 
00040 /** Simulates the boolean value @c true.
00041 *
00042 * Together with @ref BOOLEAN_FALSE a boolean variable is simulated in C.
00043 * @author Uli Fechner
00044 * @version 13/05/2003 - Uli Fechner - initial release
00045 */
00046 #ifndef BOOLEAN_TRUE
00047 #define BOOLEAN_TRUE 1
00048 #endif
00049 
00050 /** If parameter @c daylight_type in @ref SmilesCompound_create is set to DAYLIGHT_SMILES a SMILES is created
00051 *
00052 * @author Tina Grabowski
00053 * @version 29/01/2004 - Tina Grabowski - initial release
00054 */
00055 #ifndef DAYLIGHT_SMILES
00056 #define DAYLIGHT_SMILES 1
00057 #endif
00058 
00059 /** If parameter @c daylight_type in @ref SmilesCompound_create is set to DAYLIGHT_SMIRKS a SMIRKS is created
00060 *
00061 * @author Tina Grabowski
00062 * @version 29/01/2004 - Tina Grabowski - initial release
00063 */
00064 #ifndef DAYLIGHT_SMIRKS
00065 #define DAYLIGHT_SMIRKS 2
00066 #endif
00067 
00068 /** If parameter @c daylight_type in @ref SmilesCompound_create is set to DAYLIGHT_SMARTS a SMARTS is created
00069 *
00070 * @author Tina Grabowski
00071 * @version 29/01/2004 - Tina Grabowski - initial release
00072 */
00073 #ifndef DAYLIGHT_SMARTS
00074 #define DAYLIGHT_SMARTS 3
00075 #endif
00076 
00077 /* define 'functions' */
00078 
00079 /** Final part of the abortion sequence of the program.
00080 *
00081 * If a detectable error occurs during runtime the program initiates an abortion sequence. This consists
00082 * of printing a message on standard error that is related to the error and this define to print a final
00083 * message and exit the program with the exit code EXIT_FAILURE. Such detectable errors include wrong
00084 * command line arguments, missing input files, inconsistent input files, index out of bounds errors,
00085 * memory allocation errors and so on.
00086 * @author Uli Fechner
00087 * @version 05/13/2003 - Uli Fechner - initial release
00088 */
00089 #ifndef AbortProgram
00090 #define AbortProgram fprintf( stderr, "Program aborted.\n\n" ), exit( EXIT_FAILURE )
00091 #endif
00092 
00093 /** Indicates a fatal memory error.
00094 *
00095 * If allocation of memory fails at any time during program execution, this define is called. It prints an
00096 * appropriate message on standard error and calls the define @ref AbortProgram.
00097 *
00098 * @param Variable string containing the name of the variable memory allocation failed
00099 * @param Function string containing the name of the function that tried to allocate memory
00100 * @author Uli Fechner
00101 * @version 05/13/2003 - Uli Fechner - initial release
00102 */
00103 #ifndef MemoryError
00104 #define MemoryError( Variable, Function ) \
00105         fprintf( stderr, "\n\nERROR: Fatal memory error.\n" ), \
00106         fprintf( stderr, "Allocation of memory for %s in function %s failed.\n", Variable, Function ), \
00107         AbortProgram
00108 #endif
00109 
00110 /** Indicates a read error of an input file.
00111 *
00112 * If a read error of an input file occurs at any time during program execution, this define is called. It
00113 * prints a message on standard error and calls the define @ref AbortProgram.
00114 *
00115 * @param FileName string containing the name of the file the read error occured
00116 * @author Uli Fechner
00117 * @version 05/13/2003 - Uli Fechner - initial release
00118 */
00119 #ifndef FileReadError
00120 #define FileReadError( FileName ) \
00121         fprintf( stderr, "\n\nERROR: File error.\n" ), \
00122         fprintf( stderr, "\nCould not read from %s!\n", FileName ), \
00123         AbortProgram
00124 #endif
00125 
00126 /** Indicates a write error of an output file.
00127 *
00128 * If a write error of an output file occurs at any time during program execution, this define is called.
00129 * It prints a message on standard error and calls the define @ref AbortProgram.
00130 *
00131 * @param FileName string containing the name of the file the write error occured
00132 * @author Uli Fechner
00133 * @version 05/13/2003 - Uli Fechner - initial release
00134 */
00135 #ifndef FileWriteError
00136 #define FileWriteError( FileName ) \
00137         fprintf( stderr, "\n\nERROR: File error.\n" ), \
00138         fprintf( stderr, "\nCould not write to %s!\n", FileName ), \
00139         AbortProgram
00140 #endif
00141 
00142 /** Indicates a file integrity error of an input file.
00143 *
00144 * If a file integrity error of an input file occurs at any time during program execution, this define is
00145 * called. It prints a message on standard error and calls the define @ref AbortProgram. A file integrity
00146 * error means that an input file has not the same number of columns in all of its rows.
00147 *
00148 * @param FileName string that contains the name of the file the integrity error occures
00149 * @param Row integer that contains the number of the row the different number of columns appeared
00150 * @param Columns integer containing the number of columns that appear in @c Row
00151 * @param ColumnsBefore integer containing the number of columns that rows have before @c Row
00152 * @author Uli Fechner
00153 * @version 05/13/2003 - Uli Fechner - initial release
00154 */
00155 #ifndef FileIntegrityError
00156 #define FileIntegrityError( FileName, Row, Columns, ColumnsBefore ) \
00157         fprintf( stderr, "\n\nERROR: File error.\n" ), \
00158         fprintf( stderr, "\nFile %s does not contain the same number of columns in all rows!\n", FileName ), \
00159         fprintf( stderr, "Row %d has %d columns, rows before have %d columns.\n", Row, Columns, ColumnsBefore ), \
00160         AbortProgram
00161 #endif
00162 
00163 /** Indicates an incompatibility of command line arguments/options.
00164 *
00165 * The term @c option refers in the following text to arguments and options provided via the command line
00166 * when starting the program. An @c OptionIncompatibility occurs if one options is not allowed to be used
00167 * with another option @b or one option has to be used together with another option that is not provided.
00168 * This is checked in the function parseClp. If such an event takes place this define is called. It
00169 * prints an appropriate message on standard error and calls the define @ref AbortProgram.
00170 *
00171 * @param Option character with the command line abbreviation of the option causing @c OptionIncompatibility
00172 * @param NotOrExclusively string containing either the word @c not or @c exclusively
00173 * @param RegardedOptions string containing the option(s) @c Option is incompatible with
00174 * @author Uli Fechner
00175 * @version 05/13/2003 - Uli Fechner - initial release
00176 */
00177 #ifndef OptionIncompatibility
00178 #define OptionIncompatibility( Option, NotOrExclusively, RegardedOptions ) \
00179         fprintf( stderr, "\nERROR: The %s option may %s ", Option, NotOrExclusively ), \
00180         fprintf( stderr, "be used together with the %s option!\n", RegardedOptions ), \
00181         fprintf( stderr, "Type 'speedcats -h' for a detailed help text!\n"), \
00182         AbortProgram
00183 #endif
00184 
00185 /** Indicates a missing command line arguments/options that is mandatory.
00186 *
00187 * The term @c option refers in the following text to arguments and options provided via the command line
00188 * when starting the program. An @c MandatoryOption error occurs if a mandatory option is not provided 
00189 * at the command line. This is checked in the function parseClp. If such an event takes place this
00190 * define is called. It prints an appropriate message on standard error and calls the define @ref
00191 * AbortProgram.
00192 *
00193 * @param Option character with the command line abbreviation of the mandatory option
00194 * @author Uli Fechner
00195 * @version 05/13/2003 - Uli Fechner - initial release
00196 */
00197 #ifndef MandatoryOption
00198 #define MandatoryOption( Option ) \
00199         fprintf( stderr, "\nERROR: The %s option is mandatory!\n", Option ), \
00200         fprintf( stderr, "Type 'retroflux -h' for a detailed help text!\n"), \
00201         AbortProgram
00202 #endif
00203 
00204 /** Indicates an index out of bounds error.
00205 *
00206 * If an element of a structure is accessed that is not available this define is called. Such a situation
00207 * might occur, if the index of the element is bigger than the number of elements the structure has. The
00208 * access could be a read or a write operation. An appropriate message is printed on standard error and
00209 * the define @ref AbortProgram is called.
00210 *
00211 * @param StructureName string containing the name of the structure
00212 * @param NumberOfElements integer containing the number of elements of the structure
00213 * @param Index integer containing the index of the element that should be accessed
00214 * @author Uli Fechner
00215 * @version 05/13/2003 - Uli Fechner - initial release
00216 */
00217 #ifndef IndexOutOfBoundsError
00218 #define IndexOutOfBoundsError( StructureName, NumberOfElements, Index ) \
00219         fprintf( stderr, "\n\nERROR: Index out of bounds.\n" ), \
00220         fprintf( stderr, "Structure %s has only %d elements.\n", StructureName, NumberOfElements ), \
00221         fprintf( stderr, "These are indexed from 0 to %d.\n", NumberOfElements - 1), \
00222         fprintf( stderr, "There is no element with index %d!\n\n", Index ), \
00223         AbortProgram
00224 #endif
00225 
00226 #endif /* __GENERALDEFINES_H__ */

Generated on Tue Nov 9 16:27:11 2004 for retroflux by doxygen 1.3.6