HOPS
HOPS class reference
mk4_data.h
Go to the documentation of this file.
1 /************************************************************************/
2 /* */
3 /* These are the definitions of memory representations of Mk4 data */
4 /* files. The IO library will read the file into memory, then arrange */
5 /* for the information to find its way into these structures. The */
6 /* structure elements are all pointers to data record structures. The */
7 /* pointer values can be filled in by setting them to the address of */
8 /* the appropriate segment of the raw memory image. If the disk format */
9 /* of the record and the definition of the C structure have become */
10 /* different, due to format evolution, the IO library must identify */
11 /* the version number of the disk format, allocate memory for the */
12 /* structure, and copy required data fields into the structure. */
13 /* The status of the format and structure compatibility is kept in the */
14 /* header file mk4_version.h, which is used by the IO library. */
15 /* */
16 /* The "allocated" array of pointers, and the "nalloc" variable, are my */
17 /* brute force way of eliminating memory allocation blues. Since it is */
18 /* a ghastly error to free memory multiple times, or to keep on */
19 /* allocating memory without freeing it up again (very time-consuming */
20 /* bugs to track down), here I aim to keep a master list of allocated */
21 /* pointers. Every malloc or related call places a copy of the pointer */
22 /* in the "allocated" array, and increments "nalloc". When it's time */
23 /* to free memory, you just free the first "nalloc" members of the */
24 /* "allocated" array. This should be fairly bulletproof, except that */
25 /* realloc() calls could mess you up. For each pointer, allocation */
26 /* should be done in one place only, then left well alone. Memory that */
27 /* is allocated outside the routines which fill these structures is */
28 /* somebody else's problem. */
29 /* */
30 /* Created August 14 1995 by CJL */
31 /* */
32 /************************************************************************/
33 #ifndef MK4_DATA
34 #define MK4_DATA
35 
36 #include "mk4_sizes.h"
37 
38 #define MAXSTATIONS 32
39 #define MAXIND 8192
40 #define MAXAP 8192 /* debug!! make larger, but with
41  more clever code in plot_data.h
42  rjc 99.8.9 */
43 #define MAXLAG 8192
44 
45 #define MAXMAX 8192 /* set this to max(MAXAP,MAXLAG) */
46 
47 /* #define MAXAP 4096 */
48 /* #define MAXLAG 1024 */
49 /* #define MAXMAX 4096 */
50 
51  /* MAKE SURE that the following
52  * constant is the product of the
53  * variables above, i.e.
54  * = (MAXAP * MAXLAG) */
55 /* #define MAX_APXLAG 262144 */
56 /* #define MAX_APXLAG 1048576 */
57 /* #define MAX_APXLAG 2097152 */
58 // #define MAX_APXLAG 4194304
59 #define MAX_APXLAG MAXAP * MAXLAG
60 #define MAXSPLINES 64 /* Spline polynomial intervals */
61 #define MAXSTATPER 3600 /* Statistics acc periods */
62 
63 #include "mk4_records.h"
64 
65 struct index_tag
66  {
67  struct type_101 *t101;
68  int ap_space;
69  struct type_120 **t120;
70  };;
71 
72 struct mk4_corel
73  {
74  void *allocated[MAXIND + 4]; /* Ignore type 120 recs */
75  int nalloc;
76  char *file_image;
77  struct type_000 *id;
78  struct type_100 *t100;
79  int index_space;
80  struct index_tag* index;
81  };
82 
83 struct mk4_fringe
84  {
85  void *allocated[MAXFREQ + 16];
86  int nalloc;
87  char *file_image;
88  struct type_000 *id;
89  struct type_200 *t200;
90  struct type_201 *t201;
91  struct type_202 *t202;
92  struct type_203 *t203;
93  struct type_204 *t204;
94  struct type_205 *t205;
95  struct type_206 *t206;
96  struct type_207 *t207;
97  struct type_208 *t208;
98  struct type_210 *t210;
99 /* struct type_211 *t211; */
100  int n212;
102  struct type_220 *t220;
103  struct type_221 *t221;
104  struct type_222 *t222;
105  int n230;
106  struct type_230 *t230[MAXFREQ * MAXAP];
107  };
108 
109 struct mk4_sdata
110  {
112  int nalloc;
113  char *file_image;
114  struct type_000 *id;
115  struct type_300 *t300;
116  struct
117  {
118  char chan_id[32];
119  struct type_301 *t301[MAXSPLINES];
120  struct type_302 *t302[MAXSPLINES];
121  struct type_303 *t303[MAXSPLINES];
123  int n304;
124  int n305;
125  int n306;
126  int n307;
127  int n308;
128  int n309;
133  struct type_308 *t308[MAXSTATPER];
134  struct type_309 *t309[MAXSTATPER];
135  };
136 
137 struct mk4_log
138  {
139  char *file_image;
140  struct type_000 *id;
141  };
142 #endif
int nalloc
Definition: mk4_data.h:110
struct type_212 * t212[MAXFREQ]
Definition: mk4_data.h:99
struct type_307 * t307[MAXSTATPER]
Definition: mk4_data.h:130
struct type_203 * t203
Definition: mk4_data.h:90
int index_space
Definition: mk4_data.h:77
int n308
Definition: mk4_data.h:125
struct mk4_sdata::@6 model[MAXFREQ]
struct type_306 * t306[MAXSTATPER]
Definition: mk4_data.h:129
struct type_000 * id
Definition: mk4_data.h:75
struct type_200 * t200
Definition: mk4_data.h:87
struct type_305 * t305[MAXSTATPER]
Definition: mk4_data.h:128
int n304
Definition: mk4_data.h:121
int n306
Definition: mk4_data.h:123
struct type_309 * t309[MAXSTATPER]
Definition: mk4_data.h:132
void * allocated[MAXIND+4]
Definition: mk4_data.h:72
char * file_image
Definition: mk4_data.h:111
int nalloc
Definition: mk4_data.h:73
#define MAXSPLINES
Definition: mk4_data.h:58
#define MAXSTATPER
Definition: mk4_data.h:59
struct type_308 * t308[MAXSTATPER]
Definition: mk4_data.h:131
struct type_202 * t202
Definition: mk4_data.h:89
struct type_000 * id
Definition: mk4_data.h:138
struct type_100 * t100
Definition: mk4_data.h:76
struct index_tag * index
Definition: mk4_data.h:78
struct type_300 * t300
Definition: mk4_data.h:113
void * allocated[2 *MAXSPLINES *MAXFREQ+7 *MAXSTATPER+3]
Definition: mk4_data.h:109
struct type_221 * t221
Definition: mk4_data.h:101
struct type_220 * t220
Definition: mk4_data.h:100
struct type_304 * t304[MAXSTATPER]
Definition: mk4_data.h:127
struct type_210 * t210
Definition: mk4_data.h:96
struct type_204 * t204
Definition: mk4_data.h:91
struct type_205 * t205
Definition: mk4_data.h:92
struct type_000 * id
Definition: mk4_data.h:86
struct type_222 * t222
Definition: mk4_data.h:102
struct type_201 * t201
Definition: mk4_data.h:88
int nalloc
Definition: mk4_data.h:84
#define MAXIND
Definition: mk4_data.h:39
int n307
Definition: mk4_data.h:124
struct type_000 * id
Definition: mk4_data.h:112
struct type_101 * t101
Definition: mk4_data.h:65
struct type_207 * t207
Definition: mk4_data.h:94
void * allocated[MAXFREQ+16]
Definition: mk4_data.h:83
struct type_206 * t206
Definition: mk4_data.h:93
char * file_image
Definition: mk4_data.h:137
struct type_208 * t208
Definition: mk4_data.h:95
struct type_230 * t230[MAXFREQ *MAXAP]
Definition: mk4_data.h:104
int ap_space
Definition: mk4_data.h:66
#define MAXAP
Definition: mk4_data.h:40
int n212
Definition: mk4_data.h:98
struct type_120 ** t120
Definition: mk4_data.h:67
int n305
Definition: mk4_data.h:122
int n230
Definition: mk4_data.h:103
char * file_image
Definition: mk4_data.h:85
int n309
Definition: mk4_data.h:126
char * file_image
Definition: mk4_data.h:74
Definition: mk4_data.h:64
Definition: mk4_data.h:71
Definition: mk4_data.h:82
Definition: mk4_data.h:136
Definition: mk4_data.h:108
#define MAXFREQ
Definition: sizelimits.h:1
Definition: type_000.h:5
Definition: type_100.h:11
Definition: type_101.h:11
Definition: type_120.h:80
Definition: type_200.h:11
Definition: type_201.h:11
Definition: type_202.h:9
Definition: type_203.h:43
Definition: type_204.h:12
Definition: type_205.h:34
Definition: type_206.h:77
Definition: type_207.h:54
Definition: type_208.h:43
Definition: type_210.h:24
Definition: type_212.h:36
Definition: type_220.h:5
Definition: type_221.h:10
Definition: type_222.h:10
Definition: type_230.h:11
Definition: type_300.h:11
Definition: type_301.h:11
Definition: type_302.h:11
Definition: type_303.h:11
Definition: type_304.h:11
Definition: type_305.h:11
Definition: type_306.h:11
Definition: type_307.h:23
Definition: type_308.h:11
Definition: type_309.h:33