public software.sextractor

[/] [trunk/] [src/] [ldactoasc.h] - Blame information for rev 235

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 233 bertin
/*
2
*                               ldactoasc.h
3 29 bertin
*
4 233 bertin
* Include file for ldactoasc.c.
5 29 bertin
*
6 233 bertin
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7 29 bertin
*
8 233 bertin
*       This file part of:      SExtractor
9 29 bertin
*
10 235 bertin
*       Copyright:              (C) 2007-2010 Emmanuel Bertin -- IAP/CNRS/UPMC
11 29 bertin
*
12 233 bertin
*       License:                GNU General Public License
13
*
14
*       SExtractor is free software: you can redistribute it and/or modify
15
*       it under the terms of the GNU General Public License as published by
16
*       the Free Software Foundation, either version 3 of the License, or
17
*       (at your option) any later version.
18
*       SExtractor is distributed in the hope that it will be useful,
19
*       but WITHOUT ANY WARRANTY; without even the implied warranty of
20
*       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21
*       GNU General Public License for more details.
22
*       You should have received a copy of the GNU General Public License
23
*       along with SExtractor. If not, see <http://www.gnu.org/licenses/>.
24
*
25
*       Last modified:          11/10/2010
26
*
27
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
28 29 bertin
 
29
/* Check if we are using a configure script here */
30
#ifndef HAVE_CONFIG_H
31
#define         VERSION         "1.x"
32
#define         DATE            "2007-06-04"
33
#define         THREADS_NMAX    16              /* max. number of threads */
34
#endif
35
 
36
/*------------------------ what, who, when and where ------------------------*/
37
 
38
#define         BANNER          "LDACtoASC"
39
#ifdef USE_THREADS
40
#define         MYVERSION       VERSION "-MP"
41
#else
42
#define         MYVERSION       VERSION
43
#endif
44
#define         COPYRIGHT       "Emmanuel BERTIN <bertin@iap.fr>"
45 228 bertin
#define         WEBSITE         "http://astromatic.net/software/sextractor/"
46 184 bertin
#define         INSTITUTE       "IAP  http://www.iap.fr"
47 29 bertin
 
48
/*----------------------------- Physical constants --------------------------*/
49
 
50
#ifndef PI
51
#define PI              3.1415926535898
52
#endif
53
 
54
/*----------------------------- Internal constants --------------------------*/
55
 
56
#define         BIG             1e+30           /* a huge number */
57
#define         TINY            (1.0/BIG)       /* a small number */
58
#define         OUTPUT          stdout          /* where all msgs are sent */
59
#define         MAXCHAR         512             /* max. number of characters */
60
#define         MAXFILE         32768           /* max number of input files */
61
 
62
/*------------ Set defines according to machine's specificities -------------*/
63
 
64
#if 0
65
#define NO_ENVVAR
66
#endif
67
 
68
/*--------------------- in case of missing constants ------------------------*/
69
 
70
#ifndef         SEEK_SET
71
#define         SEEK_SET        0
72
#endif
73
#ifndef         SEEK_CUR
74
#define         SEEK_CUR        1
75
#endif
76
 
77
#ifndef EXIT_SUCCESS
78
#define         EXIT_SUCCESS    0
79
#endif
80
#ifndef EXIT_FAILURE
81
#define         EXIT_FAILURE    -1
82
#endif
83
 
84
/*---------------------------- return messages ------------------------------*/
85
 
86
#define         RETURN_OK               0
87
#define         RETURN_ERROR            (-1)
88
#define         RETURN_FATAL_ERROR      (-2)
89
 
90
/*------------------------------- Other Macros ------------------------------*/
91
 
92
#define DEXP(x) exp(2.30258509299*(x))  /* 10^x */
93
 
94
#define QFREAD(ptr, size, afile, fname) \
95
                if (fread(ptr, (size_t)(size), (size_t)1, afile)!=1) \
96
                  error(EXIT_FAILURE, "*Error* while reading ", fname)
97
 
98
#define QFWRITE(ptr, size, afile, fname) \
99
                if (fwrite(ptr, (size_t)(size), (size_t)1, afile)!=1) \
100
                  error(EXIT_FAILURE, "*Error* while writing ", fname)
101
 
102
#define QFSEEK(afile, offset, pos, fname) \
103
                if (fseek(afile, (offset), pos)) \
104
                  error(EXIT_FAILURE,"*Error*: file positioning failed in ", \
105
                        fname)
106
 
107
#define QFTELL(pos, afile, fname) \
108
                if ((pos=ftell(afile))==-1) \
109
                  error(EXIT_FAILURE,"*Error*: file position unknown in ", \
110
                        fname)
111
 
112
#define QCALLOC(ptr, typ, nel) \
113
                {if (!(ptr = (typ *)calloc((size_t)(nel),sizeof(typ)))) \
114
                  error(EXIT_FAILURE, "Not enough memory for ", \
115
                        #ptr " (" #nel " elements) !");;}
116
 
117
#define QMALLOC(ptr, typ, nel) \
118
                {if (!(ptr = (typ *)malloc((size_t)(nel)*sizeof(typ)))) \
119
                  error(EXIT_FAILURE, "Not enough memory for ", \
120
                        #ptr " (" #nel " elements) !");;}
121
 
122
#define QREALLOC(ptr, typ, nel) \
123
                {if (!(ptr = (typ *)realloc(ptr, (size_t)(nel)*sizeof(typ)))) \
124
                   error(EXIT_FAILURE, "Not enough memory for ", \
125
                        #ptr " (" #nel " elements) !");;}
126
 
127
#define QMEMCPY(ptrin, ptrout, typ, nel) \
128
                {if (ptrin) \
129
                  {if (!(ptrout = (typ *)malloc((size_t)(nel)*sizeof(typ)))) \
130
                    error(EXIT_FAILURE, "Not enough memory for ", \
131
                        #ptrout " (" #nel " elements) !"); \
132
                   memcpy(ptrout, ptrin, (size_t)(nel)*sizeof(typ));};;}
133
 
134
#define QPOPEN(file, cmdline, flag) \
135
                {if (!(file=popen(cmdline, flag))) \
136
                  error(EXIT_FAILURE, "*Error*: cannot execute ", cmdline);;}
137
 
138
#define RINT(x) (int)(floor(x+0.5))
139
 
140
#define NPRINTF         if (prefs.verbose_type == NORM) fprintf
141
 
142
#define NFPRINTF(w,x)   {if (prefs.verbose_type == NORM) \
143
                          fprintf(w, "\33[1M> %s\n\33[1A",x);}
144
 
145
#define FPRINTF         if (prefs.verbose_type == FULL) fprintf
146
 
147
#define QPRINTF         if (prefs.verbose_type != QUIET)        fprintf
148
 
149
#define QIPRINTF(w,x)   {if (prefs.verbose_type == NORM) \
150
                                fprintf(w, "\33[7m%s\33[0m\n", x); \
151
                        else if (prefs.verbose_type == LOG) \
152
                                fprintf(w, "%s\n", x);}
153
 
154
#define QBPRINTF(w,x)   {if (prefs.verbose_type == NORM) \
155
                                fprintf(w, "\33[01;31m%s\33[0m\n", x); \
156
                        else if (prefs.verbose_type == LOG) \
157
                                fprintf(w, "%s\n", x);}
158