ccp4_types.h

Go to the documentation of this file.
00001 /*
00002      ccp4_types.h: CCP4 library.c macro definitions etc
00003      Copyright (C) 2001  CCLRC
00004      Copyright (C) 2007  Morten Kjeldgaard
00005 
00006      This library is free software; you can redistribute it and/or
00007      modify it under the terms of the GNU Lesser General Public
00008      License as published by the Free Software Foundation; either
00009      version 2.1 of the License, or (at your option) any later
00010      version.
00011 
00012      This library is distributed in the hope that it will be useful,
00013      but WITHOUT ANY WARRANTY; without even the implied warranty of
00014      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015      Lesser General Public License for more details.
00016 
00017      You should have received a copy of the GNU Lesser General Public
00018      License along with this library; if not, write to the Free
00019      Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00020      Boston, MA 02110-1301 USA
00021 
00022 */
00023 
00029 #ifndef __CCP4_TYPES
00030 #define __CCP4_TYPES
00031 
00032 #include "ccp4_sysdep.h"
00033 
00034 #ifdef HAVE_STDINT_H
00035 #include <stdint.h>
00036 typedef uint16_t uint16;
00037 typedef uint32_t uint32;
00038 typedef unsigned char uint8;
00039 
00040 #else
00041 
00042 typedef unsigned short uint16;
00043 #ifdef SIXTEENBIT
00044 typedef unsigned long uint32;
00045 #else
00046 typedef unsigned int uint32;
00047 #endif
00048 typedef unsigned char uint8;
00049 #endif
00050 
00051 typedef float float32;
00052 
00056 union float_uint_uchar {
00057   float32 f;                    
00058   uint32 i;                     
00059   uint8 c[4];                   
00060   };
00061 
00063 typedef char *pstr;             
00064 
00065 /* CCP4 library.c macro definitions */
00066 
00067 #ifndef FALSE
00068 #  define FALSE 0
00069 #  define TRUE 1
00070 #endif
00071 
00075 typedef struct { double r;             
00076                  double i;             
00077                } COMPLEX;              
00082 typedef struct { double r;             
00083                  double phi;           
00084                } POLAR;                
00086 /* some simple macros, which may exist anyway */
00087 
00091 #ifndef SQR
00092 #  define SQR(x) ((x)*(x))
00093 #endif
00094 
00099 #ifndef DEGREE
00100 #  define DEGREE(x) ((((x < 0)?(x)+2*M_PI:(x))*360)/(2*M_PI))
00101 #endif
00102 
00107 #ifndef RADIAN
00108 #  define RADIAN(x) ((((x<0)?(x)+360:(x))*2*M_PI)/360)
00109 #endif
00110 
00114 #ifndef MAX
00115 #  define MAX(x, y) (((x)>(y))?(x):(y))
00116 #endif
00117 
00121 #ifndef MIN
00122 #  define MIN(x, y) (((x)<(y))?(x):(y))
00123 #endif
00124 
00128 #ifndef ABS
00129 #  define ABS(x) (((x)<0)?-(x):(x))
00130 #endif
00131 
00135 #ifndef SIGN
00136 #  define SIGN(x) (((x)<0)?-1:1)
00137 #endif
00138 
00139 #endif   /* __CCP4_TYPES */
00140 
00141 /*
00142   Local variables:
00143   mode: font-lock
00144   End:
00145 */

Generated on Wed Oct 29 21:14:24 2008 for gpp4 by  doxygen 1.4.7