dceconstraints.h 3.1 KB

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