MISR Toolkit  1.5.1
odldef.h
Go to the documentation of this file.
1 /*****************************************************************************
2 
3  Module: odldef.h
4 
5  Description: This C-language include file contains declarations for
6  data structures used by PDS Object Description Language
7  (ODL) processing software. No storage is allocated.
8 
9  Author: Randy Davis, University of Colorado LASP
10 
11  Creation Date: 12 March 1989
12  Last Modified: 18 May 1991
13 
14  History:
15 
16  Creation - This include file was included in the Version 1 release of
17  the ODLC library.
18 
19  Version 2.0 - 30 August 1990 - R. Davis, U. of Colorado LASP
20  a) Data structures and function prototypes have been modified to support
21  ODL Version 2. The biggest change is that the Object_Node data
22  structure has been supplanted by an Aggregate_Node that handles
23  groups as well as objects, and the Attribute_Node structure by a
24  Parameter_Node structure for both attributes and pointers.
25 
26  Version 2.1 - 13 March 1991 - R. Davis, U. of Colorado LASP
27  a) Added support for comments for aggregate and parameter nodes. Also
28  added two fields to aggregates node for use by end-user applications.
29  b) Eliminated the level field for aggregate structures.
30 
31  Version 2.2 - 18 May 1991- M. DeMore, Jet Propulsion Laboratory
32  a) Added two fields to the parameter node for use by the PDS toolbox.
33  b) Reorganized and added prototypes to create generic version for both
34  Unix and VMS
35 Ocy. 18, 1999 Abe Taaheri Changed ODLMAXSTMT value from 24000 to 255001 to
36  make it consistent with the max lengthes set in the
37  MET header files for array length and each array
38  element length, i.e. 1000 and 255
39  (per NCR ECSed24377)
40 *****************************************************************************/
41 #ifndef ODLDEF
42 #define ODLDEF
43 
44 /*------------------------------------------------------------------------*/
45 /* Includes */
46 /*------------------------------------------------------------------------*/
47 
48 #ifndef TRUE /* 1992/08/05 JWH Values didn't exist on SGI */
49 #define TRUE 1
50 #endif
51 
52 #ifndef FALSE
53 #define FALSE 0
54 #endif
55 
56 #include <stdio.h>
57 #include <stdlib.h>
58 #include <string.h>
59 
60 /*------------------------------------------------------------------------*/
61 /* Defines */
62 /*------------------------------------------------------------------------*/
63 
64 /* The following value identifies the version of the Object Description
65  Language to which the data structures and associated software conforms. */
66 
67 #define ODLVERSION "2"
68 
69 /* The following constant specifies the maximum number of characters allowed
70  in an ODL statement. */
71 
72 #ifndef MSDOS_TC
73 
74 #define ODLMAXSTMT 255001 /* (Max attribute array elements size [1000] */
75  /* times size of each string [255] plus 1 ) */
76 #else
77 
78 #define ODLMAXSTMT 8000
79 
80 #endif
81 
82 
83 /*------------------------------------------------------------------------*/
84 /* Enums and Enum Typedefs */
85 /*------------------------------------------------------------------------*/
86 
89 
92 
94 typedef enum Value_Kind VALUE_KIND;
95 
98 typedef enum Value_Type VALUE_TYPE;
99 
100 
101 /*------------------------------------------------------------------------*/
102 /* Structure Definitions */
103 /*------------------------------------------------------------------------*/
104 
105 /* The following structure contains information about a single object or
106  group including its name and (for objects) its class. The structure
107  contains pointers that thread the object/group nodes together and that
108  connect an object or group with attributes. */
109 
111 {
112  char *name; /* Name of the object or group */
113  char *objClass; /* The class of object */
114  char *comment; /* Annotation */
115  AGGREGATE_KIND kind; /* Kind of node (object or group)*/
116  long appl1; /* Available for application use */
117  long appl2; /* Available for application use */
118  struct Aggregate_Node *parent; /* Pointer to parent node */
119  struct Aggregate_Node *left_sibling; /* Pointer to sibling on left */
120  struct Aggregate_Node *right_sibling; /* Pointer to sibling on right */
121  struct Aggregate_Node *first_child; /* Pointer to first child */
122  struct Aggregate_Node *last_child; /* Pointer to last child */
123  struct Parameter_Node *first_parameter; /* Pointer to first parameter */
124  struct Parameter_Node *last_parameter; /* Pointer to last parameter */
125 };
126 
127 /* The following structure contains information about a parameter -- an
128  attribute of an object or a pointer. This includes the attribute or
129  pointer name and the kind of value associated with the parameter
130  (scalar, sequence or set). For sequences the number of rows and
131  columns are given. Each parameter node contains a pointer to the
132  aggregate -- group or object -- node to which it belongs and a list
133  of values associated with the parameter. All of the parameter nodes
134  for an aggregat are threaded together in a doubly-linked list. */
135 
137 {
138  char *name; /* The name of the parameter */
139  char *comment; /* Annotation */
140  PARAMETER_KIND node_kind; /* Param kind (Attribute or Ptr) */
141  VALUE_KIND value_kind; /* Indicates the kind of value */
142  long value_count; /* Total number of values */
143  short columns; /* Number of columns in sequence */
144  short rows; /* Number of rows in sequence */
145  struct Aggregate_Node *owner; /* Pointer to parameter's owner */
146  struct Parameter_Node *left_sibling; /* Pointer to parameter to left */
147  struct Parameter_Node *right_sibling; /* Pointer to parameter to right */
148  struct Value_Node *first_value; /* Pointer to first value node */
149  struct Value_Node *last_value; /* Pointer to last value node */
150 
151 /* >>>>>>>>>>>>>>>>>>>>>>>>>> BEGIN CN CHANGES >>>>>>>>>>>>>>>>>>>>>>>>> */
152 /* >>>>> MDD 5/14/91 Added the appl1 and appl2 fields to the >>>>> */
153 /* >>>>> parameter structure >>>>> */
154 /* >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> */
155 
156 #ifdef PDS_TOOLBOX
157 
158  long appl1; /* Application defined field 1 */
159  long appl2; /* Application defined field 2 */
160 
161 #endif
162 
163 /* >>>>>>>>>>>>>>>>>>>>>>>>>> END OF CN CHANGES >>>>>>>>>>>>>>>>>>>>>>>>> */
164 
165 };
166 
167 /* The following structures are used to hold information on a single value.
168  The ODLReal structure holds a double precision floating point value
169  and a pointer to a (possibly null) list of units designators which
170  are represented through the ODLUnits structure. Similarly, the
171  ODLInteger structure holds a long integer value and units. The
172  ODLDate structure holds date and time values. */
173 
174 struct ODLUnits
175 {
176  char *designator; /* Pointer to name of units */
177  long exponent; /* Exponent for units */
178  struct ODLUnits *next_field; /* Pointer to next units */
179 };
180 
181 
182 struct ODLReal
183 {
184  double number; /* The floating numeric value */
185  struct ODLUnits *units; /* Pointer to units list */
186 };
187 
188 
190 {
191  long number; /* The integer numeric value */
192  struct ODLUnits *units; /* Pointer to units list */
193 };
194 
195 
196 struct ODLDate
197 {
198  short year; /* Year number */
199  short doy; /* Day of year (0-366) */
200  char month; /* Month of year (1-12) */
201  char day; /* Day of month (1-31) */
202  short zone_hours; /* Zone hours from GMT (-12 - +12)*/
203  char zone_minutes; /* Zone minutes from GMT (0-59) */
204  char hours; /* Hours of day (0-23) */
205  char minutes; /* Minutes of hour (0-59) */
206  char seconds; /* Seconds of minute (0-59) */
207  long nanoseconds; /* Nanoseconds (0-999999999) */
208 };
209 
210 
212 {
213  VALUE_TYPE type; /* Indicator of value type */
214  char valid; /* Value valid if this is > 0 */
215  char format; /* Value-specific format indicator*/
216  short precision; /* Value-specific precision */
217  short length; /* Number of chars in value field */
218  union {
219  struct ODLInteger integer; /* Integer value */
220  struct ODLReal real; /* Real value */
221  struct ODLDate date_time; /* Date and time value */
222  char *string; /* Pointer to text value */
223  } value;
224 };
225 
226 
228 {
229  struct Value_Data item; /* Data value */
230  struct Parameter_Node *parameter; /* Pointer to value's parameter */
231  struct Value_Node *left_sibling; /* Pointer to value to left */
232  struct Value_Node *right_sibling; /* Pointer to value to right */
233 };
234 
235 /*------------------------------------------------------------------------*/
236 /* Typedefs */
237 /*------------------------------------------------------------------------*/
238 
239 /* Because object, group, attribute and value nodes are created in virtual
240  memory, they are almost always referred to using pointers. The following
241  types are therefore defined to be equivalent to pointers to the
242  aggregate, parameter and value structures */
243 
244 typedef struct Aggregate_Node *AGGREGATE;
245 typedef struct Aggregate_Node *OBJECT;
246 typedef struct Aggregate_Node *GROUP;
247 
248 typedef struct Parameter_Node *PARAMETER;
249 typedef struct Parameter_Node *ATTRIBUTE;
250 typedef struct Parameter_Node *POINTER;
251 
252 typedef struct Value_Node *VALUE;
253 
254 /* The following provides an alternative name for the often-used structure
255  that is used to hold a data value. */
256 
257 typedef struct Value_Data VALUE_DATA;
258 
259 
260 /*------------------------------------------------------------------------*/
261 /* Macros */
262 /*------------------------------------------------------------------------*/
263 
264 #define AGGREGATE_NODE_SIZE (sizeof(struct Aggregate_Node))
265 
266 #define PARAMETER_NODE_SIZE (sizeof(struct Parameter_Node))
267 
268 #define VALUE_DATA_SIZE (sizeof(struct Value_Data))
269 
270 #define VALUE_NODE_SIZE (sizeof(struct Value_Node))
271 
272 
273 /*------------------------------------------------------------------------*/
274 /* Prototypes */
275 /*------------------------------------------------------------------------*/
276 
277 #ifdef __cplusplus
278 extern "C" {
279 #endif
280 
281 #if defined(__STDC__) || defined(__cplusplus)/* 1992/08/05 JWH changed from SUN_UNIX */
282 
283 AGGREGATE NewAggregate (AGGREGATE base_node,
285  char *name,
286  char *objClass);
287 AGGREGATE RemoveAggregate (AGGREGATE base_node);
288 AGGREGATE ParentAggregate (AGGREGATE base_node);
289 AGGREGATE NextAggregate (AGGREGATE base_node);
290 AGGREGATE NextSubAggregate (AGGREGATE base_node,
291  AGGREGATE start_node);
292 AGGREGATE FindAggregate (AGGREGATE base_node,
293  char *name);
294 AGGREGATE FindNextAggregate (AGGREGATE base_node,
295  AGGREGATE start_node,
296  char *name);
297 AGGREGATE CutAggregate (AGGREGATE base_node);
298 AGGREGATE CopyAggregate (AGGREGATE base_node);
299 AGGREGATE PasteAggregate (AGGREGATE base_node,
300  AGGREGATE aggregate);
301 
302 
303 OBJECT ParentObject (AGGREGATE base_node);
304 OBJECT NextObject (AGGREGATE base_node);
305 OBJECT NextSubObject (AGGREGATE base_node,
306  AGGREGATE start_node);
307 OBJECT FindObject (AGGREGATE base_node,
308  char *name,
309  char *objClass);
310 OBJECT FindNextObject (AGGREGATE base_node,
311  AGGREGATE start_node,
312  char *name,
313  char *objClass);
314 
315 
316 GROUP ParentGroup (AGGREGATE base_node);
317 GROUP NextGroup (AGGREGATE base_node);
318 GROUP NextSubGroup (AGGREGATE base_node,
319  AGGREGATE start_node);
320 GROUP FindGroup (AGGREGATE base_node,
321  char *name);
322 GROUP FindNextGroup (AGGREGATE base_node,
323  AGGREGATE start_node,
324  char *name);
325 
326 
327 PARAMETER NewParameter (AGGREGATE aggregate,
328  PARAMETER_KIND kind,
329  char *name);
330 PARAMETER RemoveParameter (PARAMETER parameter);
331 PARAMETER FirstParameter (AGGREGATE aggregate);
332 PARAMETER NextParameter (PARAMETER parameter);
333 PARAMETER FindParameter (AGGREGATE aggregate,
334  char *name);
335 PARAMETER CutParameter (PARAMETER parameter);
336 PARAMETER CopyParameter (PARAMETER parameter);
337 PARAMETER PasteParameter (AGGREGATE aggregate,
338  PARAMETER parameter);
339 
340 
341 VALUE NewValue (PARAMETER parameter,
342  VALUE_DATA *value_data);
343 VALUE RemoveValue (VALUE value);
344 VALUE FirstValue (PARAMETER parameter);
345 VALUE NextValue (VALUE value);
346 VALUE CutValue (VALUE value);
347 VALUE CopyValue (VALUE value);
348 VALUE PasteValue (PARAMETER parameter,
349  VALUE value);
350 
351 
352 int CommentAggregate (AGGREGATE aggregate,
353  char *comment);
354 int CommentParameter (PARAMETER parameter,
355  char *comment);
356 void StripComments (void);
357 
358 
359 int ReadLabel (FILE *input_file,
360  AGGREGATE root);
361 int ReadValue (AGGREGATE node,
362  char *parameter_name,
363  char *value_string);
364 void WriteLabel (FILE *output_file,
365  AGGREGATE base_node);
366 void WriteSource (FILE *source_file,
367  FILE* output_file);
368 void PrintLabel (AGGREGATE base_node);
369 void PrintSource (FILE *source_file,
370  long first_line,
371  long last_line);
372 
373 #else
374 
375 AGGREGATE NewAggregate ();
376 AGGREGATE RemoveAggregate ();
377 AGGREGATE ParentAggregate ();
378 AGGREGATE NextAggregate ();
379 AGGREGATE NextSubAggregate ();
380 AGGREGATE FindAggregate ();
381 AGGREGATE FindNextAggregate ();
382 AGGREGATE CutAggregate ();
383 AGGREGATE CopyAggregate ();
384 AGGREGATE PasteAggregate ();
385 
386 OBJECT ParentObject ();
387 OBJECT NextObject ();
388 OBJECT NextSubObject ();
389 OBJECT FindObject ();
390 OBJECT FindNextObject ();
391 
392 GROUP ParentGroup ();
393 GROUP NextGroup ();
394 GROUP NextSubGroup ();
395 GROUP FindGroup ();
396 GROUP FindNextGroup ();
397 
398 PARAMETER NewParameter ();
399 PARAMETER RemoveParameter ();
400 PARAMETER FirstParameter ();
401 PARAMETER NextParameter ();
402 PARAMETER FindParameter ();
403 PARAMETER CutParameter ();
404 PARAMETER CopyParameter ();
405 PARAMETER PasteParameter ();
406 
407 VALUE NewValue ();
408 VALUE RemoveValue ();
409 VALUE FirstValue ();
410 VALUE NextValue ();
411 VALUE CutValue ();
412 VALUE CopyValue ();
413 VALUE PasteValue ();
414 
415 int CommentAggregate ();
416 int CommentParameter ();
417 void StripComments ();
418 
419 int ReadLabel ();
420 int ReadValue ();
421 void WriteLabel ();
422 void WriteSource ();
423 void PrintLabel ();
424 void PrintSource ();
425 
426 #endif
427 
428 #ifdef __cplusplus
429 }
430 #endif
431 
432 #include "odldef_prototypes.h"
433 
434 #endif
int CommentParameter()
GROUP FindNextGroup()
char hours
Definition: odldef.h:204
AGGREGATE FindNextAggregate()
PARAMETER CopyParameter()
void PrintSource()
AGGREGATE PasteAggregate()
char day
Definition: odldef.h:201
struct Value_Node * right_sibling
Definition: odldef.h:232
char format
Definition: odldef.h:215
PARAMETER PasteParameter()
char month
Definition: odldef.h:200
Definition: odldef.h:97
struct Parameter_Node * last_parameter
Definition: odldef.h:124
PARAMETER FirstParameter()
struct Aggregate_Node * last_child
Definition: odldef.h:122
short year
Definition: odldef.h:198
Definition: odldef.h:97
void WriteSource()
char * name
Definition: odldef.h:138
Definition: odldef.h:96
struct Aggregate_Node * right_sibling
Definition: odldef.h:120
VALUE CutValue()
struct Aggregate_Node * GROUP
Definition: odldef.h:246
Aggregate_Kind
Definition: odldef.h:87
OBJECT FindNextObject()
long value_count
Definition: odldef.h:142
struct Parameter_Node * PARAMETER
Definition: odldef.h:248
char seconds
Definition: odldef.h:206
OBJECT NextSubObject()
short length
Definition: odldef.h:217
enum Parameter_Kind PARAMETER_KIND
Definition: odldef.h:91
OBJECT FindObject()
char * comment
Definition: odldef.h:139
AGGREGATE CopyAggregate()
long appl2
Definition: odldef.h:117
struct Parameter_Node * left_sibling
Definition: odldef.h:146
PARAMETER NewParameter()
double number
Definition: odldef.h:184
struct Value_Node * VALUE
Definition: odldef.h:252
char minutes
Definition: odldef.h:205
char * comment
Definition: odldef.h:114
AGGREGATE_KIND kind
Definition: odldef.h:115
Parameter_Kind
Definition: odldef.h:90
short doy
Definition: odldef.h:199
GROUP NextGroup()
AGGREGATE NextSubAggregate()
struct Parameter_Node * POINTER
Definition: odldef.h:250
Definition: odldef.h:96
struct ODLUnits * next_field
Definition: odldef.h:178
void WriteLabel()
char valid
Definition: odldef.h:214
struct Aggregate_Node * first_child
Definition: odldef.h:121
int ReadValue()
PARAMETER CutParameter()
short rows
Definition: odldef.h:144
VALUE RemoveValue()
long appl1
Definition: odldef.h:116
VALUE CopyValue()
long exponent
Definition: odldef.h:177
short precision
Definition: odldef.h:216
enum Aggregate_Kind AGGREGATE_KIND
Definition: odldef.h:88
struct Aggregate_Node * owner
Definition: odldef.h:145
int ReadLabel()
GROUP NextSubGroup()
OBJECT ParentObject()
char * string
Definition: odldef.h:222
struct Aggregate_Node * parent
Definition: odldef.h:118
struct Parameter_Node * first_parameter
Definition: odldef.h:123
struct Parameter_Node * ATTRIBUTE
Definition: odldef.h:249
GROUP ParentGroup()
VALUE_TYPE type
Definition: odldef.h:213
enum Value_Type VALUE_TYPE
Definition: odldef.h:98
struct Aggregate_Node * AGGREGATE
Definition: odldef.h:244
char * objClass
Definition: odldef.h:113
struct Value_Node * first_value
Definition: odldef.h:148
char * designator
Definition: odldef.h:176
OBJECT NextObject()
PARAMETER FindParameter()
VALUE PasteValue()
AGGREGATE RemoveAggregate()
struct ODLUnits * units
Definition: odldef.h:185
struct ODLUnits * units
Definition: odldef.h:192
GROUP FindGroup()
struct Parameter_Node * parameter
Definition: odldef.h:230
AGGREGATE NewAggregate()
Value_Kind
Definition: odldef.h:93
PARAMETER NextParameter()
AGGREGATE ParentAggregate()
VALUE FirstValue()
char zone_minutes
Definition: odldef.h:203
struct Aggregate_Node * OBJECT
Definition: odldef.h:245
void StripComments()
VALUE NextValue()
Definition: odldef.h:93
VALUE NewValue()
long nanoseconds
Definition: odldef.h:207
struct Value_Node * last_value
Definition: odldef.h:149
VALUE_KIND value_kind
Definition: odldef.h:141
void PrintLabel()
PARAMETER_KIND node_kind
Definition: odldef.h:140
struct Value_Node * left_sibling
Definition: odldef.h:231
int CommentAggregate()
short columns
Definition: odldef.h:143
AGGREGATE FindAggregate()
AGGREGATE NextAggregate()
PARAMETER RemoveParameter()
union Value_Data::@2 value
struct Parameter_Node * right_sibling
Definition: odldef.h:147
char * name
Definition: odldef.h:112
short zone_hours
Definition: odldef.h:202
struct Aggregate_Node * left_sibling
Definition: odldef.h:119
enum Value_Kind VALUE_KIND
Definition: odldef.h:94
AGGREGATE CutAggregate()
Value_Type
Definition: odldef.h:96
long number
Definition: odldef.h:191

MISR Toolkit - Copyright © 2005 - 2020 Jet Propulsion Laboratory
Generated on Fri Jun 19 2020 22:49:51