1 | /********************************************************************* |
---|
2 | * Copyright 1993, UCAR/Unidata |
---|
3 | * See netcdf/COPYRIGHT file for copying and redistribution conditions. |
---|
4 | *********************************************************************/ |
---|
5 | /* $Header$ */ |
---|
6 | |
---|
7 | #ifndef DCECONSTRAINTS_H |
---|
8 | #define DCECONSTRAINTS_H 1 |
---|
9 | |
---|
10 | #include "ceconstraints.h" |
---|
11 | |
---|
12 | /* Provide a universal cast type containing common fields */ |
---|
13 | |
---|
14 | /* Define the common "supertype */ |
---|
15 | typedef struct DCEnode { |
---|
16 | CEsort sort; |
---|
17 | } DCEnode; |
---|
18 | |
---|
19 | /* The slice structure is assumed common to all uses */ |
---|
20 | typedef struct DCEslice { |
---|
21 | DCEnode node; |
---|
22 | size_t first; |
---|
23 | size_t count; |
---|
24 | size_t length; /* count*stride */ |
---|
25 | size_t stride; |
---|
26 | size_t stop; /* == first + count*/ |
---|
27 | size_t declsize; /* from defining dimension, if any.*/ |
---|
28 | } DCEslice; |
---|
29 | |
---|
30 | typedef struct DCEsegment { |
---|
31 | DCEnode node; |
---|
32 | char* name; |
---|
33 | int slicesdefined; /*1=>slice counts defined, except declsize*/ |
---|
34 | int slicesdeclized; /*1=>slice declsize defined */ |
---|
35 | size_t rank; |
---|
36 | DCEslice slices[NC_MAX_VAR_DIMS]; |
---|
37 | void* annotation; |
---|
38 | } DCEsegment; |
---|
39 | |
---|
40 | typedef struct DCEfcn { |
---|
41 | DCEnode node; |
---|
42 | char* name; |
---|
43 | NClist* args; |
---|
44 | } DCEfcn; |
---|
45 | |
---|
46 | typedef struct DCEvar { |
---|
47 | DCEnode node; |
---|
48 | NClist* segments; |
---|
49 | void* annotation; |
---|
50 | } DCEvar; |
---|
51 | |
---|
52 | typedef struct DCEconstant { |
---|
53 | DCEnode node; |
---|
54 | CEsort discrim; |
---|
55 | char* text; |
---|
56 | long long intvalue; |
---|
57 | double floatvalue; |
---|
58 | } DCEconstant; |
---|
59 | |
---|
60 | typedef struct DCEvalue { |
---|
61 | DCEnode node; |
---|
62 | CEsort discrim; |
---|
63 | /* Do not bother with a union */ |
---|
64 | DCEconstant* constant; |
---|
65 | DCEvar* var; |
---|
66 | DCEfcn* fcn; |
---|
67 | } DCEvalue; |
---|
68 | |
---|
69 | typedef struct DCEselection { |
---|
70 | DCEnode node; |
---|
71 | CEsort operator; |
---|
72 | DCEvalue* lhs; |
---|
73 | NClist* rhs; |
---|
74 | } DCEselection; |
---|
75 | |
---|
76 | typedef struct DCEprojection { |
---|
77 | DCEnode node; |
---|
78 | CEsort discrim; |
---|
79 | /* Do not bother with a union */ |
---|
80 | DCEvar* var; |
---|
81 | DCEfcn* fcn; |
---|
82 | } DCEprojection; |
---|
83 | |
---|
84 | typedef struct DCEconstraint { |
---|
85 | DCEnode node; |
---|
86 | NClist* projections; |
---|
87 | NClist* selections; |
---|
88 | } DCEconstraint; |
---|
89 | |
---|
90 | |
---|
91 | extern int dceparseconstraints(char* constraints, DCEconstraint* DCEonstraint); |
---|
92 | extern int dceslicemerge(DCEslice* dst, DCEslice* src); |
---|
93 | extern int dcemergeprojectionlists(NClist* dst, NClist* src); |
---|
94 | |
---|
95 | extern DCEnode* dceclone(DCEnode* node); |
---|
96 | extern NClist* dceclonelist(NClist* list); |
---|
97 | |
---|
98 | extern void dcefree(DCEnode* node); |
---|
99 | extern void dcefreelist(NClist* list); |
---|
100 | |
---|
101 | extern char* dcetostring(DCEnode* node); |
---|
102 | extern char* dcelisttostring(NClist* list,char*); |
---|
103 | extern void dcetobuffer(DCEnode* node, NCbytes* buf); |
---|
104 | extern void dcelisttobuffer(NClist* list, NCbytes* buf,char*); |
---|
105 | |
---|
106 | extern NClist* dceallnodes(DCEnode* node, CEsort which); |
---|
107 | |
---|
108 | extern DCEnode* dcecreate(CEsort sort); |
---|
109 | |
---|
110 | extern void dcemakewholeslice(DCEslice* slice, size_t declsize); |
---|
111 | extern void dcemakewholeprojection(DCEprojection*); |
---|
112 | |
---|
113 | extern int dceiswholesegment(DCEsegment*); |
---|
114 | extern int dceiswholeslice(DCEslice*); |
---|
115 | extern int dceiswholeseglist(NClist*); |
---|
116 | extern int dceiswholeprojection(DCEprojection*); |
---|
117 | extern int dcesamepath(NClist* list1, NClist* list2); |
---|
118 | extern int dcemergeprojections(DCEprojection* dst, DCEprojection* src); |
---|
119 | |
---|
120 | extern int dceverbose; |
---|
121 | |
---|
122 | #endif /*DCECONSTRAINTS_H*/ |
---|