public software.psfex

[/] [branches/] [rhl/] [src/] [dummies.c] - Blame information for rev 191

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

Line No. Rev Author Line
1 191 rhl
#include <stdlib.h>
2
#include <string.h>
3
#include <time.h>
4
#include "define.h"
5
#include "sample.h"
6
 
7
struct cat; typedef struct cat catstruct;
8
struct field; typedef struct field fieldstruct;
9
struct key; typedef struct key keystruct;
10
struct tab; typedef struct tab tabstruct;
11
struct wcs; typedef struct wcs wcsstruct;
12
 
13
typedef enum {H_TYPE} h_type;
14
typedef enum {T_TYPE} t_type;
15
typedef enum {ACCESS_TYPE_T} access_type_t;
16
typedef float PIXTYPE;
17
 
18
const int t_size[] = {0};
19
time_t thetime, thetime2;
20
 
21
int
22
add_key(keystruct *key, tabstruct *tab, int pos)
23
{
24
   abort();
25
   return -1;
26
}
27
 
28
int
29
addkeywordto_head(tabstruct *tab, char *keyword, char *comment)
30
{
31
   abort();
32
   return -1;
33
}
34
 
35
int
36
blank_keys(tabstruct *tab)
37
{
38
   abort();
39
   return -1;
40
}
41
 
42
void
43
end_wcs(wcsstruct *wcs)
44
{
45
   abort();
46
}
47
 
48
int
49
fitsread(char *fitsbuf, char *keyword, void *ptr, h_type htype,
50
         t_type ttype)
51
{
52
   abort();
53
   return -1;
54
}
55
 
56
int
57
fitswrite(char *fitsbuf, char *keyword, void *ptr, h_type htype,
58
          t_type ttype)
59
{
60
   abort();
61
   return -1;
62
}
63
 
64
int
65
init_cat(catstruct *cat)
66
{
67
   abort();
68
   return -1;
69
}
70
 
71
catstruct *
72
read_cat(char *filename)
73
{
74
   abort();
75
   return NULL;
76
}
77
 
78
keystruct *
79
read_key(tabstruct *tab, char *keyname)
80
{
81
   abort();
82
   return NULL;
83
}
84
 
85
keystruct *
86
new_key(char *keyname)
87
{
88
   abort();
89
   return NULL;
90
}
91
 
92
tabstruct *
93
new_tab(char *tabname)
94
{
95
   abort();
96
   return NULL;
97
}
98
 
99
wcsstruct *
100
read_wcs(tabstruct *tab)
101
{
102
   abort();
103
   return NULL;
104
}
105
 
106
double
107
wcs_dist(wcsstruct *wcs, double *wcspos1, double *wcspos2)
108
{
109
   abort();
110
   return -1.0;
111
}
112
 
113
double
114
wcs_scale(wcsstruct *wcs, double *pixpos)
115
{
116
   abort();
117
   return -1.0;
118
}
119
 
120
void
121
readbasic_head(tabstruct *tab)
122
{
123
   abort();
124
}
125
 
126
catstruct *
127
new_cat(int ncat)
128
{
129
   abort();
130
   return NULL;
131
}
132
 
133
void
134
free_cat(catstruct **cat, int ncat)
135
{
136
   abort();
137
}
138
 
139
void
140
free_tab(tabstruct *tab)
141
{
142
   abort();
143
}
144
 
145
int
146
open_cat(catstruct *cat, access_type_t at)
147
{
148
   abort();
149
   return -1;
150
}
151
 
152
int
153
prim_head(tabstruct *tab)
154
{
155
   abort();
156
   return -1;
157
}
158
 
159
void
160
read_body(tabstruct *tab, PIXTYPE *ptr, size_t size)
161
{
162
   abort();
163
}
164
 
165
void
166
save_tab(catstruct *cat, tabstruct *tab)
167
{
168
   abort();
169
}
170
 
171
/*****************************************************************************/
172
/*
173
 * These are not dummies.  They replace psfex routines
174
 */
175
typedef enum {CHECKENUM} checkenum;
176
 
177
void
178
check_write(fieldstruct *field, setstruct *set,
179
            char *checkname, checkenum checktype,
180
            int ext, int next, int cubeflag)
181
{
182
    ;
183
}
184
 
185
setstruct *
186
load_samples(char **filenames, int catindex, int ncat, int ext,
187
             int next, contextstruct *context)
188
{
189
    /*
190
     * The C version of this is called two ways:
191
     *   catindex == 0, ncat == ncat            Read all catalogues
192
     *   catindex == c, ncat == 1               Read only catalogue c
193
     */
194
   setstruct *completeSet = (setstruct *)(filenames[catindex + 0]);
195
    /*
196
     * Make a new set, which may be a subset of the completeSet
197
     */
198
    setstruct *set = init_set(context);
199
    set->fwhm = completeSet->fwhm;
200
    for (int i = 0; i != completeSet->vigdim; ++i) {
201
        set->vigsize[i] = completeSet->vigsize[i];
202
    }
203
    for (int i = 0; i != completeSet->ncontext; ++i) {
204
        strcpy(set->contextname[i], completeSet->contextname[i]);
205
        set->contextoffset[i] = completeSet->contextoffset[i];
206
        set->contextscale[i] = completeSet->contextscale[i];
207
    }
208
    /*
209
     * Count how many samples we'll be including
210
     */
211
    int nsample_keep = 0;
212
    for (int i = 0; i != ncat; ++i) {
213
        setstruct *s = (setstruct *)(filenames[catindex + i]);
214
        for (int j = 0; j != completeSet->nsample; ++j) {
215
            samplestruct const *samp = s->sample[j];
216
            if (ext == ALL_EXTENSIONS || ext == samp->extindex) {
217
                ++nsample_keep;
218
            }
219
        }
220
    }
221
 
222
    set->samples_owner = 0;
223
    malloc_samples(set, nsample_keep);
224
    for (int i = 0; i != ncat; ++i) {
225
       setstruct *s = (setstruct *)(filenames[catindex + i]);
226
        for (int j = 0; j != completeSet->nsample; ++j) {
227
            samplestruct *samp = s->sample[j];
228
            if (ext == ALL_EXTENSIONS || ext == samp->extindex) {
229
                set->sample[set->nsample++] = samp;
230
            }
231
        }
232
    }
233
 
234
    return set;
235
}