| 1 | // ============================================================= // |
|---|
| 2 | // // |
|---|
| 3 | // File : defs.h // |
|---|
| 4 | // Purpose : // |
|---|
| 5 | // // |
|---|
| 6 | // Institute of Microbiology (Technical University Munich) // |
|---|
| 7 | // http://www.arb-home.de/ // |
|---|
| 8 | // // |
|---|
| 9 | // ============================================================= // |
|---|
| 10 | |
|---|
| 11 | #ifndef DEFS_H |
|---|
| 12 | #define DEFS_H |
|---|
| 13 | |
|---|
| 14 | #define BUFFERLENGTH 200000 |
|---|
| 15 | |
|---|
| 16 | #ifndef TRUE |
|---|
| 17 | #define TRUE 1 |
|---|
| 18 | #endif |
|---|
| 19 | |
|---|
| 20 | #ifndef FALSE |
|---|
| 21 | #define FALSE 0 |
|---|
| 22 | #endif |
|---|
| 23 | |
|---|
| 24 | #define INTEGER_MAX 2147483648 |
|---|
| 25 | #define REAL_MAX 1.7976931348623157E+308 |
|---|
| 26 | #define REAL_MIN 2.2250738585072014E-308 |
|---|
| 27 | #define LOG_REAL_MIN -708.396 |
|---|
| 28 | |
|---|
| 29 | #define INTEGER_MAX2EXP 31 |
|---|
| 30 | #define REAL_MAX2EXP 1024 |
|---|
| 31 | #define REAL_MIN2EXP -1022 |
|---|
| 32 | |
|---|
| 33 | #define LOG2 0.6931471805599453094172321214581765680755 |
|---|
| 34 | #define PI 3.141592653589793238462643383279502884197 |
|---|
| 35 | |
|---|
| 36 | #define Make(x,ref) ((x)->t=ELEMENT,(x)->r=ref) |
|---|
| 37 | #define MakeList(x) ((x)->t=ELEMENT,(x)->r=List_R) |
|---|
| 38 | #define MakeInteger(x,val) ((x)->t=INTEGER,(x)->u.v.i=val) |
|---|
| 39 | |
|---|
| 40 | #define Is(x,ref) ((x)->t==ELEMENT&&(x)->r==ref) |
|---|
| 41 | #define IsList(x) ((x)->t==ELEMENT&&(x)->r==List_R) |
|---|
| 42 | #define IsInteger(x) ((x)->t==INTEGER) |
|---|
| 43 | #define IsReal(x) ((x)->t==REAL) |
|---|
| 44 | #define IsNumber(x) ((x)->t==INTEGER||(x)->t==REAL) |
|---|
| 45 | |
|---|
| 46 | #define Is0(x) ((x)->t==INTEGER&&(x)->u.v.i==0||(x)->t==REAL&&(x)->u.v.r==0.) |
|---|
| 47 | #define Is1(x) ((x)->t==INTEGER&&(x)->u.v.i==1||(x)->t==REAL&&(x)->u.v.r==1.) |
|---|
| 48 | #define IsMinus1(x) ((x)->t==INTEGER&&(x)->u.v.i==-1||(x)->t==REAL&&(x)->u.v.r==-1.) |
|---|
| 49 | #define IsPositiveNumber(x) ((x)->t==INTEGER&&(x)->u.v.i>0||(x)->t==REAL&&(x)->u.v.r>0.) |
|---|
| 50 | #define IsNegativeNumber(x) ((x)->t==INTEGER&&(x)->u.v.i<0||(x)->t==REAL&&(x)->u.v.r<0.) |
|---|
| 51 | #define IsPositiveInteger(x) ((x)->t==INTEGER&&(x)->u.v.i>0) |
|---|
| 52 | #define IsNegativeInteger(x) ((x)->t==INTEGER&&(x)->u.v.i<0) |
|---|
| 53 | |
|---|
| 54 | #define Has1Arg(x) ((x)->l&&!(x)->l->n) |
|---|
| 55 | #define Has2Args(x) ((x)->l&&(x)->l->n&&!(x)->l->n->n) |
|---|
| 56 | |
|---|
| 57 | #else |
|---|
| 58 | #error defs.h included twice |
|---|
| 59 | #endif // DEFS_H |
|---|