Linuxpops  3.01.04
Spectral Anaysis Package for Single Dish Data
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
swapsdd.c
Go to the documentation of this file.
1 #include <stdlib.h>
2 #include <stdio.h>
3 #include <strings.h>
4 #include <unistd.h>
5 #include <ctype.h>
6 #include <fcntl.h>
7 #include <malloc.h>
8 #include <math.h>
9 #include <sys/types.h>
10 #include <sys/time.h>
11 
12 #include "observing_par.h"
13 
14 #include "scans.h"
15 #include "global.h"
16 #include "linuxlib_proto.h"
17 
19 
20 int swapBoot(boot)
21 struct BOOTSTRAP *boot;
22 {
23  int i;
24  unsigned int *p;
25 
26  if(boot->version != 1)
27  {
28  swapThisSdd = 1;
29 
30  for(i=0,p=(unsigned int *)&boot->num_index_rec;i<8;i++,p++)
31  {
32  in_swapl(p);
33  }
34  }
35  else
36  {
37  swapThisSdd = 0;
38  }
39 
40  return(0);
41 }
42 
43 
44 int force_swapBoot(boot)
45 struct BOOTSTRAP *boot;
46 {
47  int i;
48  unsigned int *p;
49 
50  for(i=0,p=(unsigned int *)&boot->num_index_rec;i<8;i++,p++)
51  {
52  in_swapl(p);
53  }
54 
55  return(0);
56 }
57 
58 
59 
60 int swapDir(dir)
61 struct DIRECTORY *dir;
62 {
63 
64  in_swapl(&dir->start_rec);
65  in_swapl(&dir->end_rec);
66 
67  in_swapf(&dir->h_coord);
68  in_swapf(&dir->v_coord);
69 
70 /* leave the char "source" alone */
71 
72  in_swapf(&dir->scan);
73  in_swapf(&dir->freq_res);
74 
75  in_swapd(&dir->rest_freq);
76 
77  in_swapf(&dir->lst);
78  in_swapf(&dir->ut);
79 
80  in_swaps(&dir->obsmode);
81  in_swaps(&dir->phase_rec);
82  in_swaps(&dir->pos_code);
83  in_swaps(&dir->unused);
84 
85  return(0);
86 }
87 
88 
89 int swapHeader(head)
90 struct HEADER *head;
91 {
92  int j;
93  double *d;
94  short *s;
95 
96  for(j=0,s=&head->headcls;j<16;j++,s++)
97  {
98  in_swaps(s);
99  }
100 
101 /* class 1 */
102 
103  in_swapd(&head->headlen);
104  in_swapd(&head->datalen);
105  in_swapd(&head->scan);
106  /* leave the chars alone */
107 
108 /* class 2 */
109 
110  for(j=0,d=&head->xpoint;j<12;j++,d++)
111  {
112  in_swapd(d);
113  }
114  /* leave the chars alone */
115 
116 /* class 3 */
117 
118  for(j=0,d=&head->utdate;j<8;j++,d++)
119  {
120  in_swapd(d);
121  }
122  /* leave the chars alone */
123 
124 /* class 4 */
125 
126  for(j=0,d=&head->epoch;j<16;j++,d++)
127  {
128  in_swapd(d);
129  }
130  /* leave the chars alone */
131 
132 /* class 5 */
133 
134  for(j=0,d=&head->tamb;j<6;j++,d++)
135  {
136  in_swapd(d);
137  }
138 
139 /* class 6 */
140 
141  for(j=0,d=&head->scanang;j<10;j++,d++)
142  {
143  in_swapd(d);
144  }
145  /* leave the chars alone */
146 
147 /* class 7 */
148 
149  for(j=0,d=&head->bfwhm;j<5;j++,d++)
150  {
151  in_swapd(d);
152  }
153  /* leave the chars alone */
154 
155 /* class 8 */
156 
157  for(j=0,d=&head->appeff;j<5;j++,d++)
158  {
159  in_swapd(d);
160  }
161 
162 /* class 9 */
163 
164  for(j=0,d=&head->synfreq;j<25;j++,d++)
165  {
166  in_swapd(d);
167  }
168 
169 /* class 10 */
170 
171  for(j=0,d=head->openpar;j<10;j++,d++)
172  {
173  in_swapd(d);
174  }
175 
176 /* class 11 */
177 
178  for(j=0,d=&head->current_disk;j<15;j++,d++)
179  {
180  in_swapd(d);
181  }
182 
183  /* leave the chars "linename" alone */
184 
185  for(j=0,d=&head->refpt_vel;j<13;j++,d++)
186  {
187  in_swapd(d);
188  }
189 
190  for(j=0,d=head->spares05;j<6;j++,d++)
191  {
192  in_swapd(d);
193  }
194 
195 /* class 12 */
196 
197  for(j=0,d=&head->obsfreq;j<20;j++,d++)
198  {
199  in_swapd(d);
200  }
201 
202  /* leave the chars "polariz" alone */
203 
204  in_swapd(&head->effint);
205 
206  /* leave the chars "rx_info" alone */
207 
208 /* class 13 */
209 
210  for(j=0,d=&head->nostac;j<11;j++,d++)
211  {
212  in_swapd(d);
213  }
214 
215  return(0);
216 }
217 
218 
219 
220 int swapData(data, n)
221 float *data;
222 int n;
223 {
224  int i;
225  float *f;
226 
227  f = data;
228 
229  for(i=0;i<n;i++,f++)
230  {
231  in_swapf(f);
232  }
233 
234  return(0);
235 }
236 
Definition: header.h:13
int swapBoot()
int force_swapBoot()
int swapData()
int swapThisSdd
Definition: swapsdd.c:18
int swapHeader()
Definition: sdd.h:4
Definition: sdd.h:31
int swapDir()