File indexing completed on 2024-04-28 15:10:12
0001 /* 0002 SPDX-FileCopyrightText: 1993-2011 Emmanuel Bertin -- IAP /CNRS/UPMC 0003 SPDX-FileCopyrightText: 2014 SEP developers 0004 0005 SPDX-License-Identifier: LGPL-3.0-or-later 0006 */ 0007 0008 #define RETURN_OK 0 /* must be zero */ 0009 #define MEMORY_ALLOC_ERROR 1 0010 #define PIXSTACK_FULL 2 0011 #define ILLEGAL_DTYPE 3 0012 #define ILLEGAL_SUBPIX 4 0013 #define NON_ELLIPSE_PARAMS 5 0014 #define ILLEGAL_APER_PARAMS 6 0015 #define DEBLEND_OVERFLOW 7 0016 #define LINE_NOT_IN_BUF 8 0017 #define RELTHRESH_NO_NOISE 9 0018 #define UNKNOWN_NOISE_TYPE 10 0019 0020 #define BIG 1e+30 /* a huge number (< biggest value a float can store) */ 0021 #define PI 3.1415926535898 0022 #define DEG (PI/180.0) /* 1 deg in radians */ 0023 0024 typedef int LONG; 0025 typedef unsigned int ULONG; 0026 typedef unsigned char BYTE; /* a byte */ 0027 0028 /* keep these synchronized */ 0029 typedef float PIXTYPE; /* type used inside of functions */ 0030 #define PIXDTYPE SEP_TFLOAT /* dtype code corresponding to PIXTYPE */ 0031 0032 0033 /* signature of converters */ 0034 typedef PIXTYPE (*converter)(void *ptr); 0035 typedef void (*array_converter)(void *ptr, int n, PIXTYPE *target); 0036 typedef void (*array_writer)(float *ptr, int n, void *target); 0037 0038 #define QCALLOC(ptr, typ, nel, status) \ 0039 {if (!(ptr = (typ *)calloc((size_t)(nel),sizeof(typ)))) \ 0040 { \ 0041 char errtext[160]; \ 0042 sprintf(errtext, #ptr " (" #nel "=%lu elements) " \ 0043 "at line %d in module " __FILE__ " !", \ 0044 (size_t)(nel)*sizeof(typ), __LINE__); \ 0045 put_errdetail(errtext); \ 0046 status = MEMORY_ALLOC_ERROR; \ 0047 goto exit; \ 0048 }; \ 0049 } 0050 0051 #define QMALLOC(ptr, typ, nel, status) \ 0052 {if (!(ptr = (typ *)malloc((size_t)(nel)*sizeof(typ)))) \ 0053 { \ 0054 char errtext[160]; \ 0055 sprintf(errtext, #ptr " (" #nel "=%lu elements) " \ 0056 "at line %d in module " __FILE__ " !", \ 0057 (size_t)(nel)*sizeof(typ), __LINE__); \ 0058 put_errdetail(errtext); \ 0059 status = MEMORY_ALLOC_ERROR; \ 0060 goto exit; \ 0061 }; \ 0062 } 0063 0064 float fqmedian(float *ra, int n); 0065 void put_errdetail(char *errtext); 0066 0067 int get_converter(int dtype, converter *f, int *size); 0068 int get_array_converter(int dtype, array_converter *f, int *size); 0069 int get_array_writer(int dtype, array_writer *f, int *size); 0070 int get_array_subtractor(int dtype, array_writer *f, int *size);