1 /*****************************************************************************
2    Major portions of this software are copyrighted by the Medical College
3    of Wisconsin, 1994-2000, and are released under the Gnu General Public
4    License, Version 2.  See the file README.Copyright for details.
5 ******************************************************************************/
6 
7 #ifndef _MCW_THDSOURCE_HEADER_
8 #define _MCW_THDSOURCE_HEADER_
9 
10 #ifndef EXIT
11 #define EXIT exit
12 #endif
13 
14 #define THD_FATAL_ERROR(str) \
15   { fprintf(stderr,"\a\n*** FATAL INTERNAL ERROR: %s\n",str);sleep(1);EXIT(1); }
16 
17 #define ATR_ALLINC 8
18 
19 #define DSET_ERR(str) \
20    {fprintf(stderr,"\n*** DATASET error:   %s\n",str);dset_ok=False;}
21 
22 #define DSET_ERRN(str,val) \
23    {fprintf(stderr,"\n*** DATASET error:   %s (%f)\n",str,(float)(val));dset_ok=False;}
24 
25 #define DSET_WARN(str) \
26    {fprintf(stderr,"\n*** DATASET warning: %s\n",str);}
27 
28 #define WRITE_ERR(str) \
29   { fprintf(stderr,"*** Datablock write error: %s\n",str); return False; }
30 
31 #undef  ORCODE
32 #define ORCODE(aa)                         \
33   ( ((aa)=='R'||(aa)=='r') ? ORI_R2L_TYPE  \
34    :((aa)=='L'||(aa)=='l') ? ORI_L2R_TYPE  \
35    :((aa)=='P'||(aa)=='p') ? ORI_P2A_TYPE  \
36    :((aa)=='A'||(aa)=='a') ? ORI_A2P_TYPE  \
37    :((aa)=='I'||(aa)=='i') ? ORI_I2S_TYPE  \
38    :((aa)=='S'||(aa)=='s') ? ORI_S2I_TYPE : ILLEGAL_TYPE )
39 
40 #define OR3OK(x,y,z) ( ((x)&6) + ((y)&6) + ((z)&6) == 6 )
41 
42 #define XLAB(xl,xv) ((xl) = ((xv)==0.0) ? (ZZ) : ( ((xv)<0.0) ? (RR) : (LL) ))
43 #define YLAB(yl,yv) ((yl) = ((yv)==0.0) ? (ZZ) : ( ((yv)<0.0) ? (AA) : (PP) ))
44 #define ZLAB(zl,zv) ((zl) = ((zv)==0.0) ? (ZZ) : ( ((zv)<0.0) ? (II) : (SS) ))
45 
46 #define FSWAP(x,y) (tf=(x),(x)=(y),(y)=tf)
47 
48 #include "mcw_malloc.h"
49 
50 #endif
51