das2C
das core C utilities (v3)
Loading...
Searching...
No Matches
cli.h
Go to the documentation of this file.
1
8#ifndef das2_2_cli_H_
9#define das2_2_cli_H_
10
11#include <das3/das1.h>
12
13#include <string.h>
14#include <stdbool.h>
15
16#ifdef __cplusplus
17extern "C" {
18#endif
19
21#define OP_BEG ".ge."
22#define OP_END ".lt."
23#define OP_EQ ".eq."
24#define OP_NE ".ne."
25#define OP_LT ".lt."
26#define OP_GT ".gt."
27#define OP_LE ".le."
28#define OP_GE ".ge."
29
31enum das_selfmt{bool_t, int_t, real_t, string_t, timept_t};
32
34#define REQUIRED 0x00
35#define OPTIONAL 0x01
36#define ENUM 0x02
37#define INTERVAL 0x04
38#define XLATE_GE_LT 0x08 /* Use .beg. and .end. synonyms for .ge. and .lt.
39 when providing user text for this selector. */
40
41#define SHOW_DEFAULT 0x10 /* Show the default values in the help text */
42
44typedef struct das_selector_t{
45
47 const char* sKey;
48
50 enum das_selfmt nFmt;
51
53 unsigned int nFlags;
54
57 const char** psBounds;
58
59 /* A major design oversight: Should be allowed to place the default
60 values here. Since we can't do that the user ends up re-specifying
61 them all over the place in their programs which invites bugs! */
62 /* const char** psDefaults; */
63
65 const char* sSummary;
66
68 char** psValues;
69
71
72
83const char* das_get_selstr(const DasSelector* pSels, const char* sKey,
84 const char* sOp, const char* sDefault);
85
86const char* das_selstr(const DasSelector* pSel, const char* sOp,
87 const char* sDefault);
88
92int das_get_selint(const DasSelector* pSels, const char* sKey,
93 const char* sOp, int nDefault);
94
95int das_selint(const DasSelector* pSel, const char* sOp, int nDefault);
96
97
101bool das_get_selbool(const DasSelector* pSels, const char* sKey, bool bDefault);
102
103bool das_selbool(const DasSelector* pSel, bool bDefault);
104
105
110double das_get_selreal(const DasSelector* pSels, const char* sKey,
111 const char* sOp, double rDefault);
112
115double das_selreal(const DasSelector* pSel, const char* sOp, double rDefault);
116
117
121void das_get_seltime(const DasSelector* pSels, const char* sKey, const char* sOp,
122 int* yr, int* mon, int* dom, int* doy, int* hr, int* min, double* sec);
123
124void das_seltime(const DasSelector* pSel, const char* sOp, int* yr, int* mon,
125 int* dom, int* doy, int* hr, int* min, double* sec);
126
129 const DasSelector* pSels, const char* sKey, const char* sOp, das_time* pDt
130);
131
133void das_seldastime(const DasSelector* pSel, const char* sOp, das_time* pDt);
134
135
141const char* das_get_selenum(const DasSelector* pSels, const char* sKey,
142 const char* sDefault);
143
144const char* das_selenum(const DasSelector* pSel, const char* sDefault);
145
146
149#define DAS_OUT_DISABLE 0x0200
150
154typedef struct das_output_t{
155
157 const char* sKey;
158
160 const char* sUnits;
161
163 unsigned int nOpts;
164
166 const char** psDepends;
167
169 const char* sSummary;
170
172 char* sInterval;
173
174}DasOutput;
175
176
178bool das_get_outenabled(const DasOutput* pOuts, const char* sKey);
179
181bool das_outenabled(const DasOutput* pOut);
182
184double das_get_outinterval(const DasOutput* pOuts, const char* sKey,
185 double rDefault);
186
188double das_outinterval(const DasOutput* pOut, double rDefault);
189
191const char* das_get_outunit(const DasOutput* pOut);
192
193
231void das_parsecmdline(int nArgs, char** sArgs, DasSelector* pSels,
232 DasOutput* pOuts, const char* sDesc, const char* sFooter);
233
234
238const char* das_progname();
239
240#define DAS_LL_CRIT 100 /* same as java.util.logging.Level.SEVERE */
241#define DAS_LL_ERROR 80
242#define DAS_LL_WARN 60 /* same as java.util.logging.Level.WARNING */
243#define DAS_LL_INFO 40 /* same as java.util.logging.Level.INFO & CONFIG */
244#define DAS_LL_DEBUG 20 /* same as java.util.logging.Level.FINE */
245#define DAS_LL_TRACE 0 /* same as java.util.logging.Level.FINER & FINEST */
246
254int das_loglevel();
255
256
257#ifdef __cplusplus
258}
259#endif
260
261
262#endif /* das2_2_cli_H_ */
bool das_get_outenabled(const DasOutput *pOuts, const char *sKey)
Search for the enabled status for a named output.
double das_selreal(const DasSelector *pSel, const char *sOp, double rDefault)
Get a selection criteria from a particular selector as a double.
const char * das_get_outunit(const DasOutput *pOut)
Get the units for an output.
const char * das_progname()
Get the program basename Only works after das_parsecmdline() has been called.
bool das_outenabled(const DasOutput *pOut)
Get the enabled status for a given output.
int das_loglevel()
Get the log level.
void das_get_seldastime(const DasSelector *pSels, const char *sKey, const char *sOp, das_time *pDt)
Equivalent to das_get_seltime but uses the new das_time type from time.h.
void das_seldastime(const DasSelector *pSel, const char *sOp, das_time *pDt)
Equivalent to das_seltime but uses the new das_time type from time.h.
das_selfmt
An enumeration of das selector value types.
Definition cli.h:31
double das_outinterval(const DasOutput *pOut, double rDefault)
Get the interval setting for a given output.
bool das_get_selbool(const DasSelector *pSels, const char *sKey, bool bDefault)
Get a selection criteria as a boolean Only works for BOOLEAN format selectors.
int das_get_selint(const DasSelector *pSels, const char *sKey, const char *sOp, int nDefault)
Get the selection boundary as an integer This function only works for INTEGER parameter types.
void das_get_seltime(const DasSelector *pSels, const char *sKey, const char *sOp, int *yr, int *mon, int *dom, int *doy, int *hr, int *min, double *sec)
Parse the boundary value into a time tuple.
const char * das_get_selstr(const DasSelector *pSels, const char *sKey, const char *sOp, const char *sDefault)
Get the a selection boundary as a raw string.
double das_get_selreal(const DasSelector *pSels, const char *sKey, const char *sOp, double rDefault)
Search for a selection criteria, return boundary value as a double.
void das_parsecmdline(int nArgs, char **sArgs, DasSelector *pSels, DasOutput *pOuts, const char *sDesc, const char *sFooter)
Parse a Das 2.3 style commandline, with Das 2.1 support.
double das_get_outinterval(const DasOutput *pOuts, const char *sKey, double rDefault)
Search for the interval setting for a named output.
const char * das_get_selenum(const DasSelector *pSels, const char *sKey, const char *sDefault)
A short form of das_getstr for enumeration selectors.
Das 1 Compatibility Utilities.
A basic statement of output is needed to help with output resolution reduction.
Definition cli.h:153
Holds a single data selection query parameter.
Definition cli.h:43
Basic date-time structure used throughout the Das1 & Das2 utilities.
Definition time.h:43