public software.sextractor

[/] [trunk/] [src/] [define.h] - Blame information for rev 20

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 bertin
 /*
2
                                define.h
3
 
4
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5
*
6
*       Part of:        SExtractor
7
*
8
*       Author:         E.BERTIN (IAP)
9
*
10
*       Contents:       global definitions.
11
*
12 15 bertin
*       Last modify:    12/07/2006
13 2 bertin
*
14
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
15
*/
16
 
17
/* Check if we are using a configure script here */
18
#ifndef HAVE_CONFIG_H
19
#define         VERSION         "2.x"
20 5 bertin
#define         DATE            "2006-01-12"
21 8 bertin
#define         THREADS_NMAX    16              /* max. number of threads */
22 2 bertin
#endif
23
 
24
/*------------------------ what, who, when and where ------------------------*/
25
 
26
#define         BANNER          "SExtractor"
27
#define         EXECUTABLE      "sex"
28
#define         MYVERSION       VERSION
29
#define         COPYRIGHT       "Emmanuel BERTIN (bertin@iap.fr)"
30
#define         WEBSITE         "http://terapix.iap.fr/soft/sextractor"
31
#define         MAILINGLIST     "sextractor@iap.fr"
32
#define         MAILINGLISTREQ  "sextractor-request@iap.fr"
33
#define         INSTITUTE       "TERAPIX team at IAP  http://terapix.iap.fr"
34
 
35
/*--------------------------- Internal constants ----------------------------*/
36
 
37
#define BIG                     1e+30           /* a huge number */
38 4 bertin
#define LESSBIG                 1e+25           /* a somewhat smaller number */
39 2 bertin
#define DATA_BUFSIZE            262144          /* data buffer size */
40
#define MARGIN_SCALE            2.0             /* Margin / object height */ 
41
#define MAXCHAR                 512             /* max. number of characters */
42 15 bertin
#define MAXCHARL                16384           /* max.nb of chars in strlist*/
43 2 bertin
#define MAXCHECK                32              /* max. # of CHECKimages */
44
#define MAXDEBAREA              3               /* max. area for deblending */
45
#define MAXFLAG                 4               /* max. # of FLAG-images */
46
#define MAXIMAGE                2               /* max. # of input images */
47
#define MAXNAPER                32              /* max. number of apertures */
48
#define MAXNASSOC               32              /* max. number of assoc. */
49
#define MAXPICSIZE              1048576         /* max. image size */
50
#define NISO                    8               /* number of isophotes */
51 8 bertin
#define OUTPUT                  stdout          /* where all msgs are sent */
52 5 bertin
#define PSF_NPSFMAX             9               /* Max number of fitted PSFs */
53 2 bertin
 
54
#ifndef PI
55
#define PI                      3.1415926535898 /* never met before? */
56
#endif
57
 
58
/* NOTES:
59
 *
60
 *One must have:        BIG < the biggest element a float can store
61
 *                      DATA_BUFSIZE >= 2880 with DATA_BUFSIZE%8 = 0
62
 *                      MAXCHAR >= 16
63
 *                      1 <= MAXCHECK <= MAXLIST (see prefs.h)
64
 *                      1 <= MAXDEBAREA (see prefs.c & extract.c)
65
 *                      1 <= MAXFLAG <= MAXLIST (see prefs.h)
66
 *                      1 <= MAXIMAGE <= MAXLIST (see prefs.h)
67
 *                      1 <= MAXNAPER <= MAXLIST (see prefs.h)
68
 *                      1 <= MAXNASSOC <= MAXLIST (see prefs.h)
69
 *                      MAXPICSIZE > size of any image!!
70
 *                      NISO = 8 (otherwise need to change prefs.h)
71
 *                      1 <= PSF_NPSFMAX
72
*/
73
 
74
/*---- Set defines according to machine's specificities and customizing -----*/
75
 
76
#if _LARGEFILE_SOURCE
77
#define FSEEKO  fseeko
78
#define FTELLO  ftello
79
#else
80
#define FSEEKO  fseek
81
#define FTELLO  ftell
82
#endif
83
/*--------------------- in case of missing constants ------------------------*/
84
 
85
#ifndef         SEEK_SET
86
#define         SEEK_SET        0
87
#endif
88
#ifndef         SEEK_CUR
89
#define         SEEK_CUR        1
90
#endif
91
 
92
#ifndef EXIT_SUCCESS
93
#define EXIT_SUCCESS            0
94
#endif
95
#ifndef EXIT_FAILURE
96
#define EXIT_FAILURE            -1
97
#endif
98
 
99
/*---------------------------- return messages ------------------------------*/
100
 
101
#define         RETURN_OK               0
102
#define         RETURN_ERROR            (-1)
103
#define         RETURN_FATAL_ERROR      (-2)
104
 
105
/*------------------- a few definitions to read FITS parameters ------------*/
106
 
107
#define FBSIZE  2880L   /* size (in bytes) of one FITS block */
108
 
109
#define FITSTOF(k, def) \
110
                        (st[0]=0,((point = fitsnfind(buf, k, n))? \
111
                                 fixexponent(point), \
112
                                atof(strncat(st, &point[10], 70)) \
113
                                :(def)))
114
 
115
#define FITSTOI(k, def) \
116
                        (st[0]=0,(point = fitsnfind(buf, k, n))? \
117
                                 atoi(strncat(st, &point[10], 70)) \
118
                                :(def))
119
 
120
#define FITSTOS(k, str, def) \
121
                { if (fitsread(buf,k,str,H_STRING,T_STRING)!= RETURN_OK) \
122
                    strcpy(str, (def)); \
123
                }
124
 
125
/*------------------------------- Other Macros -----------------------------*/
126
 
127
#define DEXP(x) exp(2.30258509299*(x))  /* 10^x */
128
 
129
#define QFREAD(ptr, size, afile, fname) \
130
                if (fread(ptr, (size_t)(size), (size_t)1, afile)!=1) \
131
                  error(EXIT_FAILURE, "*Error* while reading ", fname)
132
 
133
#define QFWRITE(ptr, size, afile, fname) \
134
                if (fwrite(ptr, (size_t)(size), (size_t)1, afile)!=1) \
135
                  error(EXIT_FAILURE, "*Error* while writing ", fname)
136
 
137
#define QFSEEK(afile, offset, pos, fname) \
138
                if (FSEEKO(afile, (offset), pos)) \
139
                  error(EXIT_FAILURE,"*Error*: file positioning failed in ", \
140
                        fname)
141
 
142
#define QFTELL(afile, pos, fname) \
143
                if ((pos=FTELLO(afile))==-1) \
144
                  error(EXIT_FAILURE,"*Error*: file position unknown in ", \
145
                        fname)
146
 
147
#define QCALLOC(ptr, typ, nel) \
148
                {if (!(ptr = (typ *)calloc((size_t)(nel),sizeof(typ)))) \
149
                  error(EXIT_FAILURE, "Not enough memory for ", \
150
                        #ptr " (" #nel " elements) !");;}
151
 
152
#define QMALLOC(ptr, typ, nel) \
153
                {if (!(ptr = (typ *)malloc((size_t)(nel)*sizeof(typ)))) \
154
                  error(EXIT_FAILURE, "Not enough memory for ", \
155
                        #ptr " (" #nel " elements) !");;}
156
 
157
#define QFREE(ptr) \
158
                {free(ptr); \
159
                ptr = NULL;}
160
 
161
#define QREALLOC(ptr, typ, nel) \
162
                {if (!(ptr = (typ *)realloc(ptr, (size_t)(nel)*sizeof(typ)))) \
163
                   error(EXIT_FAILURE, "Not enough memory for ", \
164
                        #ptr " (" #nel " elements) !");;}
165
 
166
#define QMEMCPY(ptrin, ptrout, typ, nel) \
167
                {if (ptrin) \
168
                  {if (!(ptrout = (typ *)malloc((size_t)(nel)*sizeof(typ)))) \
169
                    error(EXIT_FAILURE, "Not enough memory for ", \
170
                        #ptrout " (" #nel " elements) !"); \
171
                   memcpy(ptrout, ptrin, (size_t)(nel)*sizeof(typ));};}
172
 
173
#define RINT(x) (int)(floor(x+0.5))
174
 
175
#define PIX(pic, x, y)  pic->strip[(((int)y)%pic->stripheight) \
176
                                *pic->width +(int)x]
177
 
178
#define NPRINTF         if (prefs.verbose_type == NORM \
179
                                || prefs.verbose_type==WARN) fprintf
180
 
181
#define NFPRINTF(w,x)   {if (prefs.verbose_type==NORM \
182
                                || prefs.verbose_type==WARN) \
183
                                fprintf(w, "\33[1M> %s\n\33[1A",x); \
184
                        else if (prefs.verbose_type == FULL) \
185
                                fprintf(w, "%s.\n", x);}
186
 
187
#define QPRINTF         if (prefs.verbose_type != QUIET)        fprintf
188
 
189
#define FPRINTF         if (prefs.verbose_type == FULL) fprintf
190
 
191
#define QWARNING        if (prefs.verbose_type==WARN \
192
                                || prefs.verbose_type==FULL)    warning
193
 
194
#define FLAG(x)         (*((char *)&flag##x))
195
 
196
#define VECFLAG(x)      (*((char *)flag##x))