miriad 4.1.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/ext/maskio.c ADDED
@@ -0,0 +1,398 @@
1
+ /************************************************************************/
2
+ /* */
3
+ /* A package of routines to read and write masks (bitmaps) */
4
+ /* These are used by MIRIAD for data flagging and blanking. */
5
+ /* */
6
+ /* Masks are implemented as integer data items. The 32nd */
7
+ /* bit in the integer is not used, as this could cause */
8
+ /* portability problems. As it is, this software assumes that */
9
+ /* the host integer is at least 32 bits long. */
10
+ /* */
11
+ /* History: */
12
+ /* rjs Dark-ages Original version. */
13
+ /* rjs 6nov89 Does not abort if the mask file is missing. */
14
+ /* rjs 3mar93 Make mkflush a user-callable routine. */
15
+ /* rjs 23dec93 Do not open in read/write mode unless necessary. */
16
+ /* rjs 6nov94 Change item handle to an integer. */
17
+ /* rjs 19apr97 Handle FORTRAN LOGICALs better. Some tidying. */
18
+ /************************************************************************/
19
+
20
+ #define BUG(sev,a) bug_c(sev,a)
21
+ #define ERROR(sev,a) bug_c(sev,((void)sprintf a,message))
22
+ #define CHECK(x) if(x) bugno_c('f',x)
23
+ #define private static
24
+
25
+ #include <stdio.h>
26
+ #include <stdlib.h>
27
+ #include <string.h>
28
+ #include "miriad.h"
29
+
30
+
31
+ static char message[128];
32
+
33
+ #define BITS_PER_INT 31
34
+
35
+ static int bits[BITS_PER_INT] = {
36
+ 0x00000001,0x00000002,0x00000004,0x00000008,
37
+ 0x00000010,0x00000020,0x00000040,0x00000080,
38
+ 0x00000100,0x00000200,0x00000400,0x00000800,
39
+ 0x00001000,0x00002000,0x00004000,0x00008000,
40
+ 0x00010000,0x00020000,0x00040000,0x00080000,
41
+ 0x00100000,0x00200000,0x00400000,0x00800000,
42
+ 0x01000000,0x02000000,0x04000000,0x08000000,
43
+ 0x10000000,0x20000000,0x40000000};
44
+
45
+ static int masks[BITS_PER_INT+1]={
46
+ 0x00000000,0x00000001,0x00000003,0x00000007,0x0000000F,
47
+ 0x0000001F,0x0000003F,0x0000007F,0x000000FF,
48
+ 0x000001FF,0x000003FF,0x000007FF,0x00000FFF,
49
+ 0x00001FFF,0x00003FFF,0x00007FFF,0x0000FFFF,
50
+ 0x0001FFFF,0x0003FFFF,0x0007FFFF,0x000FFFFF,
51
+ 0x001FFFFF,0x003FFFFF,0x007FFFFF,0x00FFFFFF,
52
+ 0x01FFFFFF,0x03FFFFFF,0x07FFFFFF,0x0FFFFFFF,
53
+ 0x1FFFFFFF,0x3FFFFFFF,0x7FFFFFFF};
54
+
55
+ #include "io.h"
56
+
57
+ #define MK_FLAGS 1
58
+ #define MK_RUNS 2
59
+ #define BUFFERSIZE 128
60
+ #define OFFSET (((ITEM_HDR_SIZE-1)/H_INT_SIZE + 1)*BITS_PER_INT)
61
+ typedef struct {
62
+ int item;
63
+ int buf[BUFFERSIZE],offset,length,size,modified,rdonly,tno;
64
+ char name[32];
65
+ } MASK_INFO;
66
+
67
+
68
+ private void mkfill(MASK_INFO *mask,int offset);
69
+
70
+ /************************************************************************/
71
+ char *mkopen_c(int tno,char *name,char *status)
72
+ /*
73
+ This opens a mask item, and readies it for access.
74
+
75
+ Inputs:
76
+ tno The handle of the data set containing the item.
77
+ name Name of the item (something like "mask" or "flags").
78
+ status "old" or "new".
79
+
80
+ Output:
81
+ mkopen_c This is a handle used in subsequent calls to the maskio
82
+ routines. A NULL indicates that an error was encountered.
83
+
84
+ ------------------------------------------------------------------------*/
85
+ {
86
+ MASK_INFO *mask;
87
+ int iostat;
88
+ char s[ITEM_HDR_SIZE];
89
+
90
+ mask = (MASK_INFO *)malloc((unsigned int)sizeof(MASK_INFO));
91
+
92
+ /* The case of an old mask file. Perform a number of checks to make sure
93
+ the file looks OK. */
94
+
95
+ if(!strcmp("old",status)) {
96
+ haccess_c(tno,&(mask->item),name,"read",&iostat);
97
+ if(iostat) { free((char *)mask); return(NULL); }
98
+ mask->size = hsize_c(mask->item);
99
+ if(mask->size <= H_INT_SIZE * (OFFSET/BITS_PER_INT))
100
+ ERROR('f',(message,"Mask file %s appears bad",name));
101
+ hreadb_c(mask->item,s,0,ITEM_HDR_SIZE,&iostat); CHECK(iostat);
102
+ if(memcmp(s,int_item,ITEM_HDR_SIZE))
103
+ ERROR('f',(message,"Mask file %s is not integer valued",name));
104
+ mask->rdonly = TRUE;
105
+
106
+ /* The case of a new masl file. Create it and make it look nice. */
107
+
108
+ } else if(!strcmp("new",status)) {
109
+ haccess_c(tno,&(mask->item),name,"write",&iostat); CHECK(iostat);
110
+ hwriteb_c(mask->item,int_item,0,ITEM_HDR_SIZE,&iostat); CHECK(iostat);
111
+ mask->size = OFFSET/BITS_PER_INT * H_INT_SIZE;
112
+ mask->rdonly = FALSE;
113
+ } else ERROR('f',(message,"Unrecognised status %s in MKOPEN",status));
114
+
115
+ /* Common to both old and new mask files. Initialise the structure
116
+ describing the file. */
117
+
118
+ mask->size = (mask->size/H_INT_SIZE) * BITS_PER_INT;
119
+ mask->offset = -BUFFERSIZE*BITS_PER_INT;
120
+ mask->length = 0;
121
+ mask->modified = FALSE;
122
+ mask->tno = tno;
123
+ strcpy(mask->name,name);
124
+
125
+ return((char *)mask);
126
+ }
127
+ /************************************************************************/
128
+ void mkclose_c(char *handle)
129
+ /*
130
+ This writes out any stuff that we have buffered up, and then closes
131
+ the mask file.
132
+
133
+ Inputs:
134
+ handle Pointer to the structure describing the massk file.
135
+ ------------------------------------------------------------------------*/
136
+ {
137
+ MASK_INFO *mask;
138
+ int iostat;
139
+
140
+ mask = (MASK_INFO *)handle;
141
+ if(mask->modified) mkflush_c(handle);
142
+ hdaccess_c(mask->item,&iostat); CHECK(iostat);
143
+ free((char *)mask);
144
+ }
145
+ /************************************************************************/
146
+ int mkread_c(char *handle,int mode,int *flags,int offset,int n,int nsize)
147
+ /*
148
+ ------------------------------------------------------------------------*/
149
+ {
150
+ #define SWITCH_STATE *flags++ = runs + (state ? 0 : 1 ); \
151
+ t = state; state = otherstate; otherstate = t
152
+
153
+ MASK_INFO *mask;
154
+ int i,len,boff,blen,bitmask,*buf,iostat,t,state,otherstate,runs;
155
+ int *flags0;
156
+
157
+ flags0 = flags;
158
+ mask = (MASK_INFO *)handle;
159
+ offset += OFFSET;
160
+ state = 0;
161
+ otherstate = 0x7FFFFFFF;
162
+ runs = 0;
163
+
164
+
165
+ /* Get a buffer full of information if we need it. */
166
+
167
+ while(n > 0){
168
+ if(offset < mask->offset || offset >= mask->offset + mask->length) {
169
+ if(mask->modified)mkflush_c(handle);
170
+ mask->offset = (offset/BITS_PER_INT)*BITS_PER_INT;
171
+ mask->length = min(mask->size - mask->offset,BUFFERSIZE*BITS_PER_INT);
172
+ mask->modified = FALSE;
173
+ if(mask->length == 0) BUG('f',"Read past end of mask file");
174
+ hreadi_c(mask->item,mask->buf,
175
+ (mask->offset/BITS_PER_INT)*H_INT_SIZE,
176
+ (mask->length/BITS_PER_INT)*H_INT_SIZE,
177
+ &iostat); CHECK(iostat);
178
+ }
179
+
180
+ /* Copy the flags to the output buffer. Use special sections of code
181
+ to deal with all bits being set of clear. */
182
+
183
+ boff = offset - mask->offset;
184
+ t = boff/BITS_PER_INT;
185
+ buf = mask->buf + t;
186
+ len = min(mask->length - boff,n);
187
+ boff -= t*BITS_PER_INT;
188
+
189
+ n -= len;
190
+ offset += len;
191
+
192
+ /* Copy to the output, in "flags" format. */
193
+
194
+ if(mode == MK_FLAGS){
195
+ while( len > 0){
196
+ blen = min( BITS_PER_INT - boff,len);
197
+ bitmask = *buf++;
198
+ if(bitmask == 0x7FFFFFFF) for(i=0; i<blen; i++) *flags++ = FORT_TRUE;
199
+ else if(bitmask == 0) for(i=0; i<blen; i++) *flags++ = FORT_FALSE;
200
+ else{
201
+ for(i=boff; i<boff+blen; i++)
202
+ *flags++ = ( bits[i] & bitmask ? FORT_TRUE : FORT_FALSE );
203
+ }
204
+ len -= blen;
205
+ boff = 0;
206
+ }
207
+
208
+ /* Copy to the output, in "runs" format. */
209
+
210
+ } else {
211
+ while( len > 0){
212
+ blen = min( BITS_PER_INT - boff,len);
213
+ bitmask = *buf++;
214
+ if(bitmask == state ) runs += blen;
215
+ else if(bitmask == otherstate ) { SWITCH_STATE; runs += blen; }
216
+ else {
217
+ for(i=boff; i<boff+blen; i++){
218
+ if((bits[i] & bitmask) != (bits[i] & state)) { SWITCH_STATE; }
219
+ runs++;
220
+ }
221
+ }
222
+ len -= blen;
223
+ boff = 0;
224
+ }
225
+ }
226
+ }
227
+ if(state) *flags++ = runs;
228
+ nsize -= (flags - flags0);
229
+ if(nsize < 0) bug_c('f',"Buffer overflow in MKREAD");
230
+ return(flags - flags0);
231
+ }
232
+ /************************************************************************/
233
+ void mkwrite_c(char *handle,int mode,int *flags,int offset,int n,int nsize)
234
+ /*
235
+ ------------------------------------------------------------------------*/
236
+ {
237
+ MASK_INFO *mask;
238
+ int i,len,boff,blen,bitmask,*buf,t;
239
+ int run,curr,state,iostat;
240
+
241
+ curr = 0;
242
+ state = 1;
243
+ run = 0;
244
+
245
+ mask = (MASK_INFO *)handle;
246
+ offset += OFFSET;
247
+
248
+ /* If the mask is currently read-only, close it and reopen it as read/write. */
249
+
250
+ if(mask->rdonly){
251
+ hdaccess_c(mask->item,&iostat);
252
+ haccess_c(mask->tno,&(mask->item),mask->name,"append",&iostat);
253
+ if(iostat){
254
+ bug_c('w',"Error opening mask/flagging file in read/write mode\n");
255
+ bugno_c('f',iostat);
256
+ }
257
+ mask->rdonly = FALSE;
258
+ }
259
+
260
+ /* Check if we have the right buffer. Flush if not. */
261
+
262
+ while(n > 0){
263
+ if(offset < mask->offset || offset >= mask->offset + BUFFERSIZE*BITS_PER_INT) {
264
+ if(mask->modified)mkflush_c(handle);
265
+ mask->offset = (offset/BITS_PER_INT)*BITS_PER_INT;
266
+ mask->length = 0;
267
+ mask->modified = FALSE;
268
+ }
269
+
270
+ /* See if we have to read in any stuff to fill in between the last write
271
+ and the current write. */
272
+
273
+ if(offset > mask->offset + mask->length)mkfill(mask,offset);
274
+
275
+ /* Copy the flags to the output buffer. */
276
+
277
+ boff = offset - mask->offset;
278
+ t = boff/BITS_PER_INT;
279
+ buf = mask->buf + t;
280
+ len = min(BITS_PER_INT*BUFFERSIZE - boff,n);
281
+ boff -= t*BITS_PER_INT;
282
+
283
+ mask->length = max(mask->length,offset - mask->offset + len);
284
+ mask->modified = TRUE;
285
+
286
+ n -= len;
287
+ offset += len;
288
+
289
+ /* Write to the file, assuming the input is in FLAGS format. */
290
+
291
+ if(mode == MK_FLAGS){
292
+ while( len > 0){
293
+ blen = min( BITS_PER_INT - boff,len);
294
+ bitmask = *buf;
295
+ for(i=boff; i<boff+blen; i++){
296
+ if(FORT_LOGICAL(*flags)) bitmask |= bits[i];
297
+ else bitmask &= ~bits[i];
298
+ flags++;
299
+ }
300
+ *buf++ = bitmask;
301
+ len -= blen;
302
+ boff = 0;
303
+ }
304
+
305
+ /* Write to the file, assuming the input is in RUNS format. */
306
+
307
+ } else {
308
+ while( len > 0 ){
309
+ while(run == 0){
310
+ if(nsize == 0) run = n + len;
311
+ else{
312
+ t = *flags++ - (state ? 1 : 0);
313
+ run = t - curr;
314
+ curr = t;
315
+ nsize --;
316
+ }
317
+ state ^= 1;
318
+ }
319
+ blen = min(run, min( BITS_PER_INT - boff, len));
320
+ bitmask = masks[boff+blen] ^ masks[boff];
321
+ if(state) *buf |= bitmask; /* Set the bits. */
322
+ else *buf &= ~bitmask; /* Clear the bits. */
323
+ run -= blen;
324
+ len -= blen;
325
+ boff = (boff + blen) % BITS_PER_INT;
326
+ if(!boff) buf++;
327
+ }
328
+ }
329
+ }
330
+ }
331
+ /************************************************************************/
332
+ void mkflush_c(char *handle)
333
+ /*
334
+ Flush out the data in the buffer. A complication is that the last
335
+ integer in the buffer may not be completely filled. In this case we
336
+ have to read in the value of this integer, and copy the old bits to
337
+ the output.
338
+
339
+ Input:
340
+ mask Pointer to the mask structure.
341
+ ------------------------------------------------------------------------*/
342
+ {
343
+ MASK_INFO *mask;
344
+ int i,t,*buf,offset,iostat;
345
+
346
+ mask = (MASK_INFO *)handle;
347
+
348
+ /* If we are writing at the end of the file, make sure the number we
349
+ write is a multiple of BITS_PER_INT. Also update the size of the
350
+ file. */
351
+
352
+ if( mask->offset + mask->length >= mask->size) {
353
+ mask->length = ((mask->length-1)/BITS_PER_INT + 1)*BITS_PER_INT;
354
+ mask->size = mask->offset + mask->length;
355
+
356
+ /* If the last word is only partially filled, read in the rest of the
357
+ word and transfer the bits. */
358
+
359
+ } else if((mask->length % BITS_PER_INT) != 0) {
360
+ offset = (mask->offset + mask->length) / BITS_PER_INT * H_INT_SIZE;
361
+ hreadi_c(mask->item,&t,offset,H_INT_SIZE,&iostat); CHECK(iostat);
362
+ buf = mask->buf + mask->length/BITS_PER_INT;
363
+ i = mask->length % BITS_PER_INT;
364
+ *buf = ( t & ~masks[i] ) | (*buf & masks[i]);
365
+ mask->length = ((mask->length-1)/BITS_PER_INT + 1)*BITS_PER_INT;
366
+ }
367
+
368
+ /* Write out the stuff at last. */
369
+
370
+ hwritei_c(mask->item,mask->buf,
371
+ mask->offset/BITS_PER_INT*H_INT_SIZE,
372
+ mask->length/BITS_PER_INT*H_INT_SIZE,&iostat); CHECK(iostat);
373
+ mask->modified = FALSE;
374
+ }
375
+ /************************************************************************/
376
+ private void mkfill(MASK_INFO *mask,int offset)
377
+ /*
378
+ We have to fill in some bits in the current buffer.
379
+
380
+ Inputs:
381
+ mask Pointer to the mask structure.
382
+ offset The first location that we want to write at.
383
+ ------------------------------------------------------------------------*/
384
+ {
385
+ int off,len,t,*buf,iostat,i;
386
+
387
+ if(mask->offset+mask->length < mask->size) {
388
+ buf = mask->buf + mask->length/BITS_PER_INT;
389
+ t = *buf;
390
+ off = (mask->offset + mask->length)/BITS_PER_INT;
391
+ len = min(offset/BITS_PER_INT + 1,mask->size/BITS_PER_INT) - off;
392
+ hreadi_c(mask->item,buf,
393
+ off*H_INT_SIZE,len*H_INT_SIZE,&iostat); CHECK(iostat);
394
+ i = mask->length % BITS_PER_INT;
395
+ *buf = ( t & masks[i] ) | (*buf & ~masks[i]);
396
+ mask->length = (off + len)*BITS_PER_INT - mask->offset;
397
+ }
398
+ }
data/ext/maxdimc.h.in ADDED
@@ -0,0 +1,9 @@
1
+ /*
2
+ * Warning: do not edit this file, it has possibly been generated by extconf.rb
3
+ */
4
+ #define MAXDIM @MAXDIM@
5
+ #define MAXIANT @MAXIANT@
6
+ #define MAXANT @MAXANT@
7
+ #define MAXNAX @MAXNAX@
8
+ #define MAXWIN @MAXWIN@
9
+ #define MAXBUF @MAXBUF@
data/ext/miriad.h ADDED
@@ -0,0 +1,371 @@
1
+ /*
2
+ // Header that gives C++ code access to the MIRIAD IO routines
3
+ // Is now also used a global prototype header file for all C routines
4
+ //
5
+ // History:
6
+ //
7
+ // 21-oct-94 pjt Created as follows:
8
+ // cproto uvio.c hio.c dio.c bug.c pack.c headio.c maskio.c > miriad.h
9
+ // and edited to please the C++ compiler and the eye:
10
+ //
11
+ // 22-oct-94 pjt added hio.h definitions - clumsy .... pjt
12
+ // (the hio routines are macros we don't want to allow that here)
13
+ //
14
+ // fall-96 pjt minor tidying up for AIPS++ bimafiller release - pjt
15
+ // 13-dec-96 rjs Regenerated, using
16
+ // cproto -I$MIRINC -p -fARGS hio.c headio.c uvio.c xyio.c xyzio.c bug.c
17
+ // 07-feb-97 rjs Added "Const" to definitions, and eliminate some rubbish, as
18
+ // suggested by Scott Gordon.
19
+ // 19-Mar-97 rjs Check for definition of various thingos before doing them.
20
+ // 15-jun-01 pjt Added key.c for BIMA version (ATNF uses keyc.c) as well as
21
+ // the uvget* uvrd* macros from uvio.c
22
+ // 28-may-02 pjt LFS patches: make it for for > 2GB file using off_t/size_t (prep for MIR4)
23
+ // 17-jun-02 pjt added interface.c routines; now used as global prototype file
24
+ // 23-jun-02 pjt define MIR4 here if you want to enable the LSF and MIR4
25
+ // 30-aug-04 pjt removed deprecated ARGS() macro
26
+ // 1-dec-05 pjt added bugv_c
27
+ // 18-may-06 pjt/df added mir.c prototypes for mir (the miriad->mir converter)
28
+ */
29
+
30
+ #if !defined(MIR_MIRIAD_H)
31
+ #define MIR_MIRIAD_H
32
+
33
+
34
+ /* comment this out if you only handle data < 2GB and need to be compatible with old MIRIAD */
35
+ /* or simply define MIR3 through compile options */
36
+ #if !defined(MIR3)
37
+ #define MIR4
38
+ #endif
39
+
40
+ #include <sys/types.h> /* provides off_t */
41
+ #include <unistd.h>
42
+ #include <stdarg.h>
43
+ #include "sysdep.h" /* since it now contains the "pack.c" prototypes */
44
+
45
+ /* Define const and void if needed. */
46
+
47
+ #ifndef MIRIAD_TYPES_DEFINED
48
+
49
+ #define MIRIAD_TYPES_DEFINED 1
50
+ #ifdef __STDC__
51
+ #if (__STDC__ == 1)
52
+ typedef void Void;
53
+ #define Const const
54
+ #else
55
+ typedef char Void;
56
+ #define Const /* NULL */
57
+ #endif /* (__STDC__ == 1) */
58
+ #else
59
+ typedef char Void;
60
+ #define Const /* NULL */
61
+ #endif /* __STDC__ */
62
+
63
+ /* Define the argument list if needed. */
64
+
65
+ #if !defined(ARGS)
66
+ # if defined(__STDC__) || defined(__cplusplus)
67
+ # define ARGS(s) s
68
+ # else
69
+ # define ARGS(s) ()
70
+ # endif
71
+ #endif
72
+
73
+ #endif
74
+
75
+ #if defined(__cplusplus)
76
+ extern "C" {
77
+ #endif
78
+
79
+ /* hio.h */
80
+
81
+ #if !defined(TRUE)
82
+ # define TRUE 1
83
+ #else
84
+ # if TRUE != 1
85
+ # error "TRUE should be 1"
86
+ # endif
87
+ #endif
88
+
89
+ #if !defined(FALSE)
90
+ # define FALSE 0
91
+ #else
92
+ # if FALSE != 0
93
+ # error "FALSE should be 0"
94
+ # endif
95
+ #endif
96
+
97
+ #define H_BYTE 1
98
+ #define H_INT 2
99
+ #define H_INT2 3
100
+ #define H_REAL 4
101
+ #define H_DBLE 5
102
+ #define H_TXT 6
103
+ #define H_CMPLX 7
104
+
105
+ /* hio.c */
106
+
107
+ void hopen_c(int *tno, Const char *name, Const char *status, int *iostat);
108
+ void hflush_c(int tno, int *iostat);
109
+ void habort_c(void);
110
+ void hrm_c(int tno);
111
+ void hclose_c(int tno);
112
+ void hdelete_c(int tno, Const char *keyword, int *iostat);
113
+ void haccess_c(int tno, int *ihandle, Const char *keyword, Const char *status, int *iostat);
114
+ void hmode_c(int tno, char *mode);
115
+ int hexists_c(int tno, Const char *keyword);
116
+ void hdaccess_c(int ihandle, int *iostat);
117
+ off_t hsize_c(int ihandle);
118
+ void hio_c(int ihandle, int dowrite, int type, char *buf, off_t offset, size_t length, int *iostat);
119
+ void hseek_c(int ihandle, off_t offset);
120
+ off_t htell_c(int ihandle);
121
+ void hreada_c(int ihandle, char *line, size_t length, int *iostat);
122
+ void hwritea_c(int ihandle, Const char *line, size_t length, int *iostat);
123
+
124
+ /* Macros defined in hio.c */
125
+
126
+ #define hreadb_c(item,buf,offset,length,iostat) \
127
+ hio_c(item,FALSE,H_BYTE,buf,offset,length,iostat)
128
+ #define hwriteb_c(item,buf,offset,length,iostat) \
129
+ hio_c(item,TRUE,H_BYTE,buf,offset,length,iostat)
130
+ #define hreadi_c(item,buf,offset,length,iostat) \
131
+ hio_c(item,FALSE,H_INT,(char *)(buf),offset,length,iostat)
132
+ #define hwritei_c(item,buf,offset,length,iostat) \
133
+ hio_c(item,TRUE,H_INT,(char *)(buf),offset,length,iostat)
134
+ #define hreadj_c(item,buf,offset,length,iostat) \
135
+ hio_c(item,FALSE,H_INT2,(char *)(buf),offset,length,iostat)
136
+ #define hwritej_c(item,buf,offset,length,iostat) \
137
+ hio_c(item,TRUE,H_INT2,(char *)(buf),offset,length,iostat)
138
+ #define hreadl_c(item,buf,offset,length,iostat) \
139
+ hio_c(item,FALSE,H_INT8,(char *)(buf),offset,length,iostat)
140
+ #define hwritel_c(item,buf,offset,length,iostat) \
141
+ hio_c(item,TRUE,H_INT8,(char *)(buf),offset,length,iostat)
142
+ #define hreadr_c(item,buf,offset,length,iostat) \
143
+ hio_c(item,FALSE,H_REAL,(char *)(buf),offset,length,iostat)
144
+ #define hwriter_c(item,buf,offset,length,iostat) \
145
+ hio_c(item,TRUE,H_REAL,(char *)(buf),offset,length,iostat)
146
+ #define hreadd_c(item,buf,offset,length,iostat) \
147
+ hio_c(item,FALSE,H_DBLE,(char *)(buf),offset,length,iostat)
148
+ #define hwrited_c(item,buf,offset,length,iostat) \
149
+ hio_c(item,TRUE,H_DBLE,(char *)(buf),offset,length,iostat)
150
+ #define hreadc_c(item,buf,offset,length,iostat) \
151
+ hio_c(item,FALSE,H_CMPLX,(char *)(buf),offset,length,iostat)
152
+ #define hwritec_c(item,buf,offset,length,iostat) \
153
+ hio_c(item,TRUE,H_CMPLX,(char *)(buf),offset,length,iostat)
154
+ #define hwrite_c(item,type,buf,offset,length,iostat) \
155
+ hio_c(item,TRUE,type,(char *)(buf),offset,length,iostat)
156
+ #define hread_c(item,type,buf,offset,length,iostat) \
157
+ hio_c(item,FALSE,type,(char *)(buf),offset,length,iostat)
158
+
159
+ /* headio.c */
160
+
161
+ void hisopen_c (int tno, Const char *status);
162
+ void hiswrite_c (int tno, Const char *text);
163
+ void hisread_c (int tno, char *text, size_t length, int *eof);
164
+ void hisclose_c (int tno);
165
+ void wrhdr_c (int tno, Const char *keyword, double value);
166
+ void wrhdd_c (int tno, Const char *keyword, double value);
167
+ void wrhdi_c (int tno, Const char *keyword, int value);
168
+ void wrhdl_c (int tno, Const char *keyword, int8 value);
169
+ void wrhdc_c (int tno, Const char *keyword, Const float *value);
170
+ void wrhda_c (int tno, Const char *keyword, Const char *value);
171
+ void rdhdr_c (int tno, Const char *keyword, float *value, double defval);
172
+ void rdhdi_c (int tno, Const char *keyword, int *value, int defval);
173
+ void rdhdl_c (int tno, Const char *keyword, int8 *value, int8 defval);
174
+ void rdhdd_c (int tno, Const char *keyword, double *value, double defval);
175
+ void rdhdc_c (int tno, Const char *keyword, float *value, Const float *defval);
176
+ void rdhda_c (int tno, Const char *keyword, char *value, Const char *defval, int len);
177
+ void hdcopy_c (int tin, int tout, Const char *keyword);
178
+ int hdprsnt_c (int tno, Const char *keyword);
179
+ void hdprobe_c (int tno, Const char *keyword, char *descr, size_t length, char *type, int *n);
180
+
181
+ /* dio.c */
182
+
183
+ void ddelete_c (char *path, int *iostat);
184
+ void dtrans_c (char *inpath, char *outpath, int *iostat);
185
+ void dmkdir_c (char *path, int *iostat);
186
+ void drmdir_c (char *path, int *iostat);
187
+ void dopen_c (int *fd, char *name, char *status, off_t *size, int *iostat);
188
+ void dclose_c (int fd, int *iostat);
189
+ void dread_c (int fd, char *buffer, off_t offset, size_t length, int *iostat);
190
+ void dwrite_c (int fd, char *buffer, off_t offset, size_t length, int *iostat);
191
+ void dwait_c (int fd, int *iostat);
192
+ int dexpand_c (char *tmplte, char *output, int length);
193
+ void dopendir_c (char **contxt, char *path);
194
+ void dclosedir_c (char *contxt);
195
+ void dreaddir_c (char *contxt, char *path, int length);
196
+
197
+ /* uvio.c */
198
+
199
+ void uvopen_c (int *tno, Const char *name, Const char *status);
200
+ void uvclose_c (int tno);
201
+ void uvflush_c (int tno);
202
+ void uvnext_c (int tno);
203
+ void uvrewind_c (int tno);
204
+ void uvcopyvr_c (int tin, int tout);
205
+ int uvupdate_c (int tno);
206
+ void uvvarini_c (int tno, int *vhan);
207
+ void uvvarset_c (int vhan, Const char *var);
208
+ void uvvarcpy_c (int vhan, int tout);
209
+ int uvvarupd_c (int vhan);
210
+ void uvrdvr_c (int tno, int type, Const char *var, char *data, char *def, int n);
211
+ void uvgetvr_c (int tno, int type, Const char *var, char *data, int n);
212
+ void uvprobvr_c (int tno, Const char *var, char *type, int *length, int *updated);
213
+ void uvputvr_c (int tno, int type, Const char *var, Const char *data, int n);
214
+ void uvtrack_c (int tno, Const char *name, Const char *switches);
215
+ int uvscan_c (int tno, Const char *var);
216
+ void uvwrite_c (int tno, Const double *preamble, Const float *data, Const int *flags, int n);
217
+ void uvwwrite_c (int tno, Const float *data, Const int *flags, int n);
218
+ void uvsela_c (int tno, Const char *object, Const char *string, int datasel);
219
+ void uvselect_c (int tno, Const char *object, double p1, double p2, int datasel);
220
+ void uvset_c (int tno, Const char *object, Const char *type, int n, double p1, double p2, double p3);
221
+ void uvread_c (int tno, double *preamble, float *data, int *flags, int n, int *nread);
222
+ void uvwread_c (int tno, float *data, int *flags, int n, int *nread);
223
+ void uvflgwr_c (int tno, Const int *flags);
224
+ void uvwflgwr_c (int tno, Const int *flags);
225
+ void uvinfo_c (int tno, Const char *object, double *data);
226
+
227
+ /* Macros defined in uvio.c */
228
+
229
+ #define uvputvra_c(tno,name,value) \
230
+ uvputvr_c(tno,H_BYTE,name,value,strlen(value))
231
+ #define uvputvrj_c(tno,name,value,n) \
232
+ uvputvr_c(tno,H_INT2,name,(char *)(value),n)
233
+ #define uvputvri_c(tno,name,value,n) \
234
+ uvputvr_c(tno,H_INT,name,(char *)(value),n)
235
+ #define uvputvrr_c(tno,name,value,n) \
236
+ uvputvr_c(tno,H_REAL,name,(char *)(value),n)
237
+ #define uvputvrd_c(tno,name,value,n) \
238
+ uvputvr_c(tno,H_DBLE,name,(char *)(value),n)
239
+ #define uvputvrc_c(tno,name,value,n) \
240
+ uvputvr_c(tno,H_CMPLX,name,(char *)(value),n)
241
+
242
+ #define uvgetvra_c(tno,name,value,n) \
243
+ uvgetvr_c(tno,H_BYTE,name,value,n)
244
+ #define uvgetvrj_c(tno,name,value,n) \
245
+ uvgetvr_c(tno,H_INT2,name,(char *)(value),n)
246
+ #define uvgetvri_c(tno,name,value,n) \
247
+ uvgetvr_c(tno,H_INT,name,(char *)(value),n)
248
+ #define uvgetvrr_c(tno,name,value,n) \
249
+ uvgetvr_c(tno,H_REAL,name,(char *)(value),n)
250
+ #define uvgetvrd_c(tno,name,value,n) \
251
+ uvgetvr_c(tno,H_DBLE,name,(char *)(value),n)
252
+ #define uvgetvrc_c(tno,name,value,n) \
253
+ uvgetvr_c(tno,H_CMPLX,name,(char *)(value),n)
254
+
255
+ #define uvrdvra_c(tno,name,data,def,len) \
256
+ uvrdvr_c(tno,H_BYTE,name,data,def,len)
257
+ #define uvrdvri_c(tno,name,data,def) \
258
+ uvrdvr_c(tno,H_INT,name,(char *)(data),(char *)(def),1)
259
+ #define uvrdvrr_c(tno,name,data,def) \
260
+ uvrdvr_c(tno,H_REAL,name,(char *)(data),(char *)(def),1)
261
+ #define uvrdvrd_c(tno,name,data,def) \
262
+ uvrdvr_c(tno,H_DBLE,name,(char *)(data),(char *)(def),1)
263
+ #define uvrdvrc_c(tno,name,data,def) \
264
+ uvrdvr_c(tno,H_CMPLX,name,(char *)(data),(char *)(def),1)
265
+
266
+ /* xyio.c */
267
+
268
+ void xyopen_c (int *tno, Const char *name, Const char *status, int naxis, int axes[]);
269
+ void xyflush_c (int tno);
270
+ void xyclose_c (int tno);
271
+ void xyread_c (int tno, int index, float *array);
272
+ void xywrite_c (int tno, int index, Const float *array);
273
+ void xymkrd_c (int tno, int index, int *runs, int n, int *nread);
274
+ void xymkwr_c (int tno, int index, Const int *runs, int n);
275
+ void xyflgwr_c (int tno, int index, Const int *flags);
276
+ void xyflgrd_c (int tno, int index, int *flags);
277
+ void xysetpl_c (int tno, int naxis, Const int *axes);
278
+
279
+ /* maskio.c */
280
+ char *mkopen_c (int tno, char *name, char *status);
281
+ void mkclose_c (char *handle);
282
+ int mkread_c (char *handle, int mode, int *flags, int offset, int n, int nsize);
283
+ void mkwrite_c (char *handle, int mode, int *flags, int offset, int n, int nsize);
284
+ void mkflush_c (char *handle);
285
+
286
+
287
+ /* xyzio.c */
288
+
289
+ void xyzopen_c (int *tno, Const char *name, Const char *status, int *naxis, int axlen[]);
290
+ void xyzclose_c (int tno);
291
+ void xyzflush_c (int tno);
292
+ void xyzmkbuf_c (void);
293
+ void xyzsetup_c (int tno, Const char *subcube, Const int blc[], Const int trc[], int viraxlen[], int vircubesize[]);
294
+ void xyzs2c_c (int tno, int subcubenr, int coords[]);
295
+ void xyzc2s_c (int tno, Const int coords[], int *subcubenr);
296
+ void xyzread_c (int tno, Const int coords[], float *data, int *mask, int *ndata);
297
+ void xyzpixrd_c (int tno, int pixelnr, float *data, int *mask);
298
+ void xyzprfrd_c (int tno, int profilenr, float *data, int *mask, int *ndata);
299
+ void xyzplnrd_c (int tno, int planenr, float *data, int *mask, int *ndata);
300
+ void xyzwrite_c (int tno, Const int coords[], Const float *data, Const int *mask, Const int *ndata);
301
+ void xyzpixwr_c (int tno, int pixelnr, Const float *data, Const int *mask);
302
+ void xyzprfwr_c (int tno, int profilenr, Const float *data, Const int *mask, Const int *ndata);
303
+ void xyzplnwr_c (int tno, int planenr, Const float *data, Const int *mask, Const int *ndata);
304
+
305
+
306
+ /* bug.c */
307
+
308
+ char bugseverity_c(void);
309
+ char *bugmessage_c(void);
310
+ void bugrecover_c(void (*cl)(void));
311
+ void buglabel_c (Const char *name);
312
+ void bugno_c (char s, int n);
313
+ void bug_c (char s, Const char *m);
314
+ void bugv_c (char s, Const char *m, ...);
315
+
316
+ /* scrio.c */
317
+
318
+ void scropen_c (int *handle);
319
+ void scrclose_c (int handle);
320
+ void scrread_c (int handle, float *buffer, int offset, int length);
321
+ void scrwrite_c (int handle, Const float *buffer, int offset, int length);
322
+
323
+
324
+ /* tabio.c */
325
+
326
+ void tabopen_c (int *tno, Const char *name, Const char *status, int *ncol, int *nrow);
327
+ void tabclose_c (int tno);
328
+ void tabsetr_c (int tno, int row);
329
+ void tabfmtc_c (int tno, int col, char *fmt);
330
+ void tabcmt_c (int tno, char *comment);
331
+ void tabwcr_c (int tno, int col, float value);
332
+ void tabwcd_c (int tno, int col, double value);
333
+ void tabwci_c (int tno, int col, int value);
334
+ void tabwca_c (int tno, int col, char *value);
335
+
336
+
337
+ /* key.c */
338
+
339
+ void keyinit_c (Const char *task);
340
+ void keyput_c (Const char *task, char *string);
341
+ void keyini_c (int argc, char *argv[]);
342
+ void keyfin_c (void);
343
+ int keyprsnt_c (Const char *keyword);
344
+ void keya_c (Const char *keyword, char *value, Const char *keydef);
345
+ void keyf_c (Const char *keyword, char *value, Const char *keydef);
346
+ void keyd_c (Const char *keyword, double *value, Const double keydef);
347
+ void keyr_c (Const char *keyword, float *value, Const float keydef);
348
+ void keyi_c (Const char *keyword, int *value, Const int keydef);
349
+ void keyl_c (Const char *keyword, int *value, Const int keydef);
350
+ void mkeyd_c (Const char *keyword, double value[], Const int nmax, int *n);
351
+ void mkeyr_c (Const char *keyword, float value[], Const int nmax, int *n);
352
+ void mkeyi_c (Const char *keyword, int value[], Const int nmax, int *n);
353
+
354
+ /* mir.c */
355
+ void mirInit_c(const char *f_name);
356
+ void mirClose_c(void);
357
+ void inWrite_c(const int conid, const int icocd, const int traid, const int inhid, const int ints, const int itq, const float az, const float el, const float ha, const int iut, const int iref_time, const double dhrs, const float vc, const int ivctype, const double sx, const double sy, const double sz, const float rinteg, const int proid, const int souid, const int isource, const int ipos, const float offx, const float offy, const int iofftype, const int ira, const int idec, const double rar, const double decr, const float epoch, const float sflux, const float size);
358
+ void blWrite_c(const int blhid, const int inhid, const int isb, const int ipol, const float pa, const int iaq, const int ibq, const int icq, const int ioq, const int irec, const int iffc, const float u, const float v, const float w, const float prbl, const float angres, const float vis, const float coh, const float sigcoh, const float csnr, const float vflux, const float cnoise, const double avedhrs, const float ampav, const float phaave, const float tpvar, const int blsid, const int itel1, const int itel2, const int iblcd, const float ble, const float bln, const float blu, const int soid);
359
+ void spWrite_c(const int sphid, const int blhid, const int inhid, const int igq, const int ipq, const int iband, const int ipstate, const float tau0, const double vel, const float vres, const int ivtype, const double fsky, const float fres, const float tssb, const float integ, const float wt, const int itaper, const float snoise, const int nch, const int nrec, const int dataoff, const int linid, const int itrans, const double rfreq, const int pasid, const int gaiidamp, const int gaiidpha, const int flcid, const int atmid);
360
+ void codeWrite_c(const char *v_name, const int icode, const char *code, const int ncode);
361
+ void visWrite_c(const float *re, const float *im, const int numvis, const int startvis, int *nbytes);
362
+
363
+ /* interface.c */
364
+ void pad(char *string, int length);
365
+ char *zterm(char *string, int length);
366
+
367
+ #if defined(__cplusplus)
368
+ }
369
+ #endif
370
+
371
+ #endif /* MIR_MIRIAD_H */