gpp4  1.3.1
ccp4_types.h
Go to the documentation of this file.
1 /*
2  ccp4_types.h: CCP4 library.c macro definitions etc
3  Copyright (C) 2001 CCLRC
4  Copyright (C) 2007 Morten Kjeldgaard
5 
6  This library is free software: you can redistribute it and/or
7  modify it under the terms of the GNU Lesser General Public
8  License as published by the Free Software Foundation, either
9  version 3 of the License, or (at your option) any later version.
10 
11  This library is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  Lesser General Public License for more details.
15 
16  You should have received a copy of the GNU Lesser General Public
17  License along with This library. If not, see
18  <http://www.gnu.org/licenses/>.
19 
20 */
21 
27 #ifndef __CCP4_TYPES
28 #define __CCP4_TYPES
29 
30 #include "ccp4_sysdep.h"
31 
32 typedef unsigned short uint16;
33 #ifdef SIXTEENBIT
34 typedef unsigned long uint32;
35 #else
36 typedef unsigned int uint32;
37 #endif
38 typedef float float32;
39 typedef unsigned char uint8;
40 
45  float32 f;
46  uint32 i;
47  uint8 c[4];
48  };
49 
51 typedef char *pstr;
52 
53 /* CCP4 library.c macro definitions */
54 
55 #ifndef FALSE
56 #define FALSE 0
57 #define TRUE 1
58 #endif
59 
63 typedef struct { double r;
64  double i;
65  } COMPLEX;
70 typedef struct { double r;
71  double phi;
72  } POLAR;
74 /* some simple macros, which may exist anyway */
75 
79 #ifndef SQR
80 #define SQR(x) ((x)*(x))
81 #endif
82 
87 #ifndef DEGREE
88 #define DEGREE(x) ((((x < 0)?(x)+2*M_PI:(x))*360)/(2*M_PI))
89 #endif
90 
95 #ifndef RADIAN
96 #define RADIAN(x) ((((x<0)?(x)+360:(x))*2*M_PI)/360)
97 #endif
98 
102 #ifndef MAX
103 #define MAX(x, y) (((x)>(y))?(x):(y))
104 #endif
105 
109 #ifndef MIN
110 #define MIN(x, y) (((x)<(y))?(x):(y))
111 #endif
112 
116 #ifndef ABS
117 #define ABS(x) (((x)<0)?-(x):(x))
118 #endif
119 
123 #ifndef SIGN
124 #define SIGN(x) (((x)<0)?-1:1)
125 #endif
126 
127 #endif /* __CCP4_TYPES */
128 
129 /*
130  Local variables:
131  mode: font-lock
132  End:
133 */
float_uint_uchar::f
float32 f
Definition: ccp4_types.h:45
COMPLEX::i
double i
Definition: ccp4_types.h:64
float_uint_uchar::i
uint32 i
Definition: ccp4_types.h:46
COMPLEX
Contruct representing a complex number.
Definition: ccp4_types.h:63
POLAR
Contruct representing a polar coordinate complex number.
Definition: ccp4_types.h:70
ccp4_sysdep.h
System-dependent definitions.
POLAR::phi
double phi
Definition: ccp4_types.h:71
float_uint_uchar
Common data structure for floats, ints, and chars.
Definition: ccp4_types.h:44
POLAR::r
double r
Definition: ccp4_types.h:70
float_uint_uchar::c
uint8 c[4]
Definition: ccp4_types.h:47
COMPLEX::r
double r
Definition: ccp4_types.h:63