1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101
|
/**
* @file
* @brief Global Definitions
*
* This file contains the declaration of global variables and
* their related values. The actual definition is located in andi.c
*/
#ifndef _GLOBAL_H_
#define _GLOBAL_H_
#include <gsl/gsl_rng.h>
#include "config.h"
#include <err.h>
/**
* The *global* variable ::FLAGS is used to set different options
* for the execution of the program. Use `FLAGS & F_NAME` to check
* if `F_NAME` was set.
*/
extern int FLAGS;
/**
* The *global* variable ::THREADS contains the number of threads the program
* should use.
*/
extern int THREADS;
/**
* The ::ANCHOR_P_VALUE represents the probability that an anchor will be found,
* if the two sequences are unrelated. I.e. it is the p-value for H_0: random
* sequences. Its value can be set using the `-p` switch.
*/
extern double ANCHOR_P_VALUE;
/**
* The number of matrices that should be bootstrapped.
*/
extern long unsigned int BOOTSTRAP;
/**
* A global random number generator. Has to be seedable.
*/
extern gsl_rng *RNG;
/**
* The evolutionary model.
*/
extern int MODEL;
enum { M_RAW, M_JC, M_KIMURA };
/**
* This enum contains the available flags. Please note that all
* available options are a power of 2.
*/
enum {
F_NONE = 0,
F_TRUNCATE_NAMES = 1,
F_VERBOSE = 2,
F_EXTRA_VERBOSE = 4,
F_NON_ACGT = 8,
F_JOIN = 16,
F_LOW_MEMORY = 32,
F_SHORT = 64,
F_PRINT_PROGRESS = 128,
F_SOFT_ERROR = 256
};
/**
* @brief This macro is used to unify the checks for the return value of malloc.
*
* @param PTR - The pointer getting checked.
*/
#define CHECK_MALLOC(PTR) \
do { \
if (PTR == NULL) { \
err(errno, "Out of memory"); \
} \
} while (0)
/**
* @brief This macro is used to print a warning and make the program exit with
* an failure exit code, later.
*/
#define soft_err(...) \
do { \
FLAGS |= F_SOFT_ERROR; \
warn(__VA_ARGS__); \
} while (0)
/**
* @brief This macro is used to print a warning and make the program exit with
* an failure exit code, later.
*/
#define soft_errx(...) \
do { \
FLAGS |= F_SOFT_ERROR; \
warnx(__VA_ARGS__); \
} while (0)
#endif
|