OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
lablib3.h
Go to the documentation of this file.
1 /**************************************************************************/
2 /* lablib3.h */
3 /* */
4 /* Version: */
5 /* */
6 /* 1.0 March 31, 1994 */
7 /* */
8 /* Change History: */
9 /* */
10 /* 03-31-94 Original code */
11 /* 01-09-95 jsh - Changed OBJECT to OBJDESC */
12 /* 03-11-97 Add ODL_GROUP & ODL_OBJECT, */
13 /* change OdlValidEndObjDesc prototype */
14 /* 04-09-97 Added Landsat 7 Date and Time */
15 /* change OdlDataType prototype */
16 /* */
17 /**************************************************************************/
18 
19 #ifndef __LABLIB3_LOADED
20 #define __LABLIB3_LOADED
21 
22 #include "oli_toolbox.h"
23 
24 /**************************************************************************/
25 /* Symbol definitions */
26 /**************************************************************************/
27 
28 /* These symbols are used by the label library to determine what, if any,
29  type of expanding should be performed on a label. They are used as masks
30  and MUST be in powers of two.
31 */
32 
33 #define ODL_NOEXPAND 0
34 #define ODL_EXPAND_STRUCTURE 1
35 #define ODL_EXPAND_CATALOG 2
36 
37 /* These symbols are used to restrict the scope of an object search */
38 
39 #define ODL_RECURSIVE_DOWN 0
40 #define ODL_TO_END 1
41 #define ODL_CHILDREN_ONLY 2
42 #define ODL_SIBLINGS_ONLY 3
43 #define ODL_THIS_OBJECT 4
44 
45 /* These symbols represent the different data location types */
46 
47 #define ODL_RECORD_LOCATION 0
48 #define ODL_BYTE_LOCATION 1
49 
50 /* These symbols represent the data type of a keyword's value */
51 
52 #define ODL_UNKNOWN 0
53 #define ODL_INTEGER 1
54 #define ODL_REAL 2
55 #define ODL_SYMBOL 3
56 #define ODL_TEXT 4
57 #define ODL_DATE 5
58 #define ODL_DATE_TIME 6
59 #define ODL_SEQUENCE 7
60 #define ODL_SET 8
61 #define ODL_L7_DATE_TIME 9
62 #define ODL_L7_DATE_TIME_FRAC 10
63 
64 /* Valid is_a_group settings */
65 #define ODL_OBJECT 0 /* class is OBJECT */
66 #define ODL_GROUP 1 /* class is GROUP */
67 
68 /**************************************************************************/
69 /* Typedefs */
70 /**************************************************************************/
71 
72 typedef struct Object_Structure
73 {
74  char *class;
75  char *pre_comment; /* Comments before the OBJECT = line */
76  char *line_comment; /* Comments on the OBJECT = line */
77  char *post_comment; /* Comments before the END_OBJECT = line */
78  char *end_comment; /* Comments on the OBJECT = line */
79  char *file_name;
80  char *appl1; /* free for your application to use as you see fit */
81  char *appl2; /* free for your application to use as you see fit */
82  unsigned short is_a_group;
83  unsigned long level;
84  unsigned long line_number;
85  unsigned long child_count;
93 
94 } OBJDESC;
95 
96 typedef struct Keyword_Structure
97 {
98  char *name;
99  char *file_name;
100  char *value;
101  unsigned long size;
102  char *pre_comment; /* Comments before the KEYWORD = line */
103  char *line_comment; /* Comments on the KEYWORD = line */
104  char *appl1; /* free for your application to use as you see fit */
105  char *appl2; /* free for your application to use as you see fit */
106  unsigned short is_a_pointer;
107  unsigned short is_a_list;
108  unsigned long line_number;
112 
113 } KEYWORD;
114 
115 /**************************************************************************/
116 /* Function Prototypes */
117 /**************************************************************************/
118 
119 #ifdef _NO_PROTO
120 
121 OBJDESC *OdlParseLabelFile();
122 OBJDESC *OdlParseLabelString();
123 OBJDESC *OdlExpandLabelFile();
124 unsigned short ExpandIsRecursive();
125 OBJDESC *OdlFindObjDesc();
126 OBJDESC *OdlNextObjDesc();
127 OBJDESC *OdlCutObjDesc();
128 OBJDESC *OdlPasteObjDesc();
129 OBJDESC *OdlPasteObjDescBefore();
130 OBJDESC *OdlPasteObjDescAfter();
131 OBJDESC *OdlCopyObjDesc();
132 OBJDESC *OdlNewObjDesc();
133 char *OdlGetLabelVersion();
134 char *OdlGetObjDescClassName();
136 int OdlGetObjDescLevel();
137 OBJDESC *OdlGetObjDescParent();
138 void OdlAdjustObjDescLevel();
139 KEYWORD *OdlFindKwd();
140 KEYWORD *OdlNextKwd ();
141 KEYWORD *OdlCutKwd();
142 KEYWORD *OdlPasteKwd();
143 KEYWORD *OdlPasteKwdBefore();
144 KEYWORD *OdlPasteKwdAfter();
145 KEYWORD *OdlCopyKwd();
146 KEYWORD *OdlNewKwd();
147 KEYWORD *OdlGetFirstKwd ();
148 KEYWORD *OdlGetNextKwd ();
149 char *OdlGetKwdValue();
150 unsigned short OdlGetKwdValueType();
151 char *OdlGetKwdUnit();
152 char *OdlGetKwdName();
153 char *OdlGetFileName();
154 char *OdlGetFileSpec();
155 OBJDESC *OdlFreeTree();
156 KEYWORD *OdlFreeAllKwds();
157 KEYWORD *OdlFreeKwd();
158 FILE *OdlLocateStart();
159 FILE *OdlOpenMessageFile();
160 short OdlPrintMessage();
161 char *OdlFormatMessage();
162 void OdlPrintHierarchy();
163 void OdlPrintLabel();
164 void OdlPrintKeywords();
165 OBJDESC *OdlParseFile();
166 short OdlNestingLevel();
167 short OdlValidBraces();
168 short OdlValidElement();
169 short OdlValidEndObjDesc();
170 short OdlValidIdentifier();
171 short OdlValidKwd();
172 short OdlValidObjDesc();
173 short OdlValidValueList();
174 OBJDESC *OdlTraverseTree();
175 char *OdlFirstWord();
176 char *OdlNextWord();
177 char *OdlValueStart();
178 char *OdlValueEnd();
179 char *OdlValueRowStart();
180 char *OdlValueRowEnd();
181 unsigned short OdlDataType();
182 char *OdlTypeString();
183 TB_STRING_LIST *OdlGetAllKwdValues();
184 char *OdlTempFname();
185 unsigned short OdlWildCardCompare();
186 short CheckBalance();
187 
188 #else
189 
190 OBJDESC *OdlParseLabelFile (char *, char *, MASK, unsigned short);
191 OBJDESC *OdlParseLabelString (char *, char *, MASK, unsigned short);
192 OBJDESC *OdlExpandLabelFile (OBJDESC *, char *, MASK, unsigned short);
193 unsigned short ExpandIsRecursive (KEYWORD *, char *);
194 OBJDESC *OdlFindObjDesc(OBJDESC *, const char *, const char *, char *,
195  unsigned long, unsigned short);
196 OBJDESC *OdlNextObjDesc (OBJDESC *, unsigned long, unsigned short *);
197 OBJDESC *OdlTraverseTree (OBJDESC *, unsigned long);
198 OBJDESC *OdlCutObjDesc (OBJDESC *);
199 OBJDESC *OdlPasteObjDesc (OBJDESC *, OBJDESC *);
200 OBJDESC *OdlPasteObjDescBefore (OBJDESC *, OBJDESC *);
201 OBJDESC *OdlPasteObjDescAfter (OBJDESC *, OBJDESC *);
202 OBJDESC *OdlCopyObjDesc (OBJDESC *);
203 OBJDESC *OdlNewObjDesc (const char *,const char *,const char *,const char *,
204  const char *, const char *, short, long);
205 char *OdlGetLabelVersion (OBJDESC *);
206 char *OdlGetObjDescClassName (OBJDESC *);
207 int OdlGetObjDescChildCount (OBJDESC *);
208 int OdlGetObjDescLevel (OBJDESC *);
209 OBJDESC *OdlGetObjDescParent (OBJDESC *);
210 void OdlAdjustObjDescLevel (OBJDESC *);
211 KEYWORD *OdlFindKwd (OBJDESC *, const char *, char *, unsigned long, unsigned short);
212 KEYWORD *OdlNextKwd (KEYWORD *, char *, char *, unsigned long, unsigned short);
213 KEYWORD *OdlCutKwd (KEYWORD *);
214 KEYWORD *OdlPasteKwd (KEYWORD *, OBJDESC *);
215 KEYWORD *OdlPasteKwdBefore (KEYWORD *, KEYWORD *);
216 KEYWORD *OdlPasteKwdAfter (KEYWORD *, KEYWORD *);
217 KEYWORD *OdlCopyKwd (KEYWORD *);
218 KEYWORD *OdlNewKwd (char *, char *, char *, char *, char *, long);
219 KEYWORD *OdlGetFirstKwd (OBJDESC *);
220 KEYWORD *OdlGetNextKwd (KEYWORD *);
221 char *OdlGetKwdValue (KEYWORD *);
222 unsigned short OdlGetKwdValueType (KEYWORD *);
223 char *OdlGetKwdUnit (KEYWORD *);
224 char *OdlGetKwdName (KEYWORD *);
225 char *OdlGetFileName (KEYWORD *, unsigned long *, unsigned short *);
226 char *OdlGetFileSpec (char *);
227 OBJDESC *OdlFreeTree (OBJDESC *);
228 KEYWORD *OdlFreeAllKwds (OBJDESC *);
229 KEYWORD *OdlFreeKwd (KEYWORD *);
230 FILE *OdlOpenMessageFile (const char *, FILE *);
231 FILE *OdlLocateStart(char *, unsigned long, unsigned short);
232 short OdlPrintMessage (const char *, FILE *, long, const char *);
233 char *OdlFormatMessage (char *);
234 void OdlPrintHierarchy (OBJDESC *, char *, FILE *);
235 void OdlPrintLabel (OBJDESC *, char *, FILE *, unsigned long);
236 void OdlPrintKeywords (OBJDESC *, char *, FILE *);
237 OBJDESC *OdlParseFile (char *, FILE *, char *, FILE *,
238  unsigned short, unsigned short, unsigned short, unsigned short);
239 short OdlNestingLevel (char *, long *, long *);
240 short OdlValidBraces (char *, long, long, char *, FILE *, long);
241 short OdlValidElement (char *, char *, FILE *, long, long);
242 short OdlValidEndObjDesc (OBJDESC *, char *, char *, char *, FILE *,long,unsigned short);
243 short OdlValidIdentifier (const char *, const char *, const char *, FILE *,
244  long);
245 short OdlValidKwd (OBJDESC *, char *, char *, char *, char *,FILE *,long);
246 short OdlValidObjDesc (OBJDESC *, char *, char *, char *, FILE *,long);
247 short OdlValidValueList (char *, char *, FILE *,long);
248 char *OdlFirstWord (char *);
249 char *OdlNextWord (char *);
250 char *OdlValueStart (char *);
251 char *OdlValueEnd (char *);
252 char *OdlValueRowStart (char *);
253 char *OdlValueRowEnd (char *);
254 unsigned short OdlDataType(char *);
255 char *OdlTypeString (unsigned short, char *);
256 TB_STRING_LIST *OdlGetAllKwdValues(KEYWORD *);
257 char *OdlTempFname();
258 unsigned short OdlWildCardCompare(const char *, const char *);
259 short CheckBalance(char *);
260 
261 #endif /* _NO_PROTO */
262 
263 /**************************************************************************/
264 /* End of lablib3.h stuff */
265 /**************************************************************************/
266 
267 #endif /* __LABLIB3_LOADED */
268 
void OdlPrintHierarchy(OBJDESC *, char *, FILE *)
Definition: lablib3.c:3363
char * post_comment
Definition: lablib3.h:77
OBJDESC * OdlNextObjDesc(OBJDESC *, unsigned long, unsigned short *)
Definition: lablib3.c:619
char * OdlValueRowEnd(char *)
Definition: lablib3.c:5320
char * OdlGetLabelVersion(OBJDESC *)
Definition: lablib3.c:1102
FILE * OdlLocateStart(char *, unsigned long, unsigned short)
Definition: lablib3.c:2972
void OdlPrintLabel(OBJDESC *, char *, FILE *, unsigned long)
Definition: lablib3.c:3463
char * end_comment
Definition: lablib3.h:78
char * pre_comment
Definition: lablib3.h:102
TB_STRING_LIST * OdlGetAllKwdValues(KEYWORD *)
Definition: lablib3.c:2200
KEYWORD * OdlFreeAllKwds(OBJDESC *)
Definition: lablib3.c:2520
OBJDESC * OdlParseLabelString(char *, char *, MASK, unsigned short)
Definition: lablib3.c:196
char * OdlValueEnd(char *)
Definition: lablib3.c:5221
OBJDESC * OdlFindObjDesc(OBJDESC *, const char *, const char *, char *, unsigned long, unsigned short)
Definition: lablib3.c:536
short OdlValidEndObjDesc(OBJDESC *, char *, char *, char *, FILE *, long, unsigned short)
Definition: lablib3.c:4447
short OdlNestingLevel(char *, long *, long *)
Definition: lablib3.c:4101
OBJDESC * OdlPasteObjDescBefore(OBJDESC *, OBJDESC *)
Definition: lablib3.c:830
char * file_name
Definition: lablib3.h:99
FILE * OdlOpenMessageFile(const char *, FILE *)
Definition: lablib3.c:2648
short OdlValidKwd(OBJDESC *, char *, char *, char *, char *, FILE *, long)
Definition: lablib3.c:4609
struct Keyword_Structure * left_sibling
Definition: lablib3.h:110
struct Keyword_Structure * right_sibling
Definition: lablib3.h:111
KEYWORD * OdlNextKwd(KEYWORD *, char *, char *, unsigned long, unsigned short)
Definition: lablib3.c:1538
short OdlPrintMessage(const char *, FILE *, long, const char *)
Definition: lablib3.c:3074
OBJDESC * OdlCopyObjDesc(OBJDESC *)
Definition: lablib3.c:956
char * OdlFormatMessage(char *)
Definition: lablib3.c:3207
unsigned short OdlDataType(char *)
Definition: lablib3.c:5373
char * OdlGetKwdValue(KEYWORD *)
Definition: lablib3.c:2131
KEYWORD * OdlPasteKwdBefore(KEYWORD *, KEYWORD *)
Definition: lablib3.c:1760
unsigned short ExpandIsRecursive(KEYWORD *, char *)
Definition: lablib3.c:441
char * appl1
Definition: lablib3.h:80
char * OdlGetKwdUnit(KEYWORD *)
Definition: lablib3.c:2331
struct Keyword_Structure * first_keyword
Definition: lablib3.h:91
unsigned short OdlGetKwdValueType(KEYWORD *)
Definition: lablib3.c:2280
short OdlValidIdentifier(const char *, const char *, const char *, FILE *, long)
Definition: lablib3.c:4524
OBJDESC * OdlTraverseTree(OBJDESC *, unsigned long)
Definition: lablib3.c:4998
char * line_comment
Definition: lablib3.h:76
struct Object_Structure * last_child
Definition: lablib3.h:90
OBJDESC * OdlCutObjDesc(OBJDESC *)
Definition: lablib3.c:702
char * file_name
Definition: lablib3.h:79
KEYWORD * OdlFindKwd(OBJDESC *, const char *, char *, unsigned long, unsigned short)
Definition: lablib3.c:1452
unsigned short OdlWildCardCompare(const char *, const char *)
Definition: lablib3.c:4844
unsigned long line_number
Definition: lablib3.h:108
OBJDESC * OdlParseLabelFile(char *, char *, MASK, unsigned short)
Definition: lablib3.c:124
char * appl2
Definition: lablib3.h:81
char * OdlGetKwdName(KEYWORD *)
Definition: lablib3.c:2401
struct Object_Structure * left_sibling
Definition: lablib3.h:87
unsigned short MASK
Definition: oli_toolbox.h:148
KEYWORD * OdlPasteKwd(KEYWORD *, OBJDESC *)
Definition: lablib3.c:1699
char * OdlTempFname()
Definition: lablib3.c:5787
short OdlValidBraces(char *, long, long, char *, FILE *, long)
Definition: lablib3.c:4146
unsigned long child_count
Definition: lablib3.h:85
char * OdlValueRowStart(char *)
Definition: lablib3.c:5274
char * pre_comment
Definition: lablib3.h:75
OBJDESC * OdlGetObjDescParent(OBJDESC *)
Definition: lablib3.c:1386
char * OdlTypeString(unsigned short, char *)
Definition: lablib3.c:5715
struct Object_Structure * parent
Definition: lablib3.h:109
KEYWORD * OdlNewKwd(char *, char *, char *, char *, char *, long)
Definition: lablib3.c:1940
struct Keyword_Structure * last_keyword
Definition: lablib3.h:92
char * OdlGetFileSpec(char *)
Definition: lablib3.c:2913
short CheckBalance(char *)
Definition: lablib3.c:5834
short OdlValidValueList(char *, char *, FILE *, long)
Definition: lablib3.c:4763
KEYWORD * OdlFreeKwd(KEYWORD *)
Definition: lablib3.c:2578
KEYWORD * OdlCopyKwd(KEYWORD *)
Definition: lablib3.c:1880
int OdlGetObjDescChildCount(OBJDESC *)
Definition: lablib3.c:1217
short OdlValidElement(char *, char *, FILE *, long, long)
Definition: lablib3.c:4241
OBJDESC * OdlPasteObjDesc(OBJDESC *, OBJDESC *)
Definition: lablib3.c:766
KEYWORD * OdlCutKwd(KEYWORD *)
Definition: lablib3.c:1634
char * OdlNextWord(char *)
Definition: lablib3.c:5126
unsigned long size
Definition: lablib3.h:101
int OdlGetObjDescLevel(OBJDESC *)
Definition: lablib3.c:1271
short OdlValidObjDesc(OBJDESC *, char *, char *, char *, FILE *, long)
Definition: lablib3.c:4723
void OdlAdjustObjDescLevel(OBJDESC *)
Definition: lablib3.c:1329
char * OdlGetObjDescClassName(OBJDESC *)
Definition: lablib3.c:1167
char * OdlValueStart(char *)
Definition: lablib3.c:5174
struct Object_Structure * right_sibling
Definition: lablib3.h:88
unsigned short is_a_pointer
Definition: lablib3.h:106
unsigned long level
Definition: lablib3.h:83
OBJDESC * OdlPasteObjDescAfter(OBJDESC *, OBJDESC *)
Definition: lablib3.c:893
char * OdlGetFileName(KEYWORD *, unsigned long *, unsigned short *)
Definition: lablib3.c:2784
struct Object_Structure * parent
Definition: lablib3.h:86
char * line_comment
Definition: lablib3.h:103
KEYWORD * OdlGetFirstKwd(OBJDESC *)
Definition: lablib3.c:2024
OBJDESC * OdlParseFile(char *, FILE *, char *, FILE *, unsigned short, unsigned short, unsigned short, unsigned short)
Definition: lablib3.c:3713
KEYWORD * OdlGetNextKwd(KEYWORD *)
Definition: lablib3.c:2078
unsigned short is_a_list
Definition: lablib3.h:107
OBJDESC * OdlExpandLabelFile(OBJDESC *, char *, MASK, unsigned short)
Definition: lablib3.c:280
KEYWORD * OdlPasteKwdAfter(KEYWORD *, KEYWORD *)
Definition: lablib3.c:1820
unsigned long line_number
Definition: lablib3.h:84
OBJDESC * OdlNewObjDesc(const char *, const char *, const char *, const char *, const char *, const char *, short, long)
Definition: lablib3.c:1019
unsigned short is_a_group
Definition: lablib3.h:82
void OdlPrintKeywords(OBJDESC *, char *, FILE *)
Definition: lablib3.c:3595
char * OdlFirstWord(char *)
Definition: lablib3.c:5076
OBJDESC * OdlFreeTree(OBJDESC *)
Definition: lablib3.c:2459
struct Object_Structure * first_child
Definition: lablib3.h:89