home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Professional / OS2PRO194.ISO / os2 / prgramer / adaptor / src / include / pred.h < prev    next >
C/C++ Source or Header  |  1993-07-08  |  4KB  |  121 lines

  1. /*************************************************************************
  2. *                                                                        *
  3. *  Name : pred.h                                                         *
  4. *  Purpose : Data Structures for Predicate Vectors and Predicates        *
  5. *                                                                        *
  6. *  Author : Dr. Thomas Brandes, GMD, Z1.HR                               *
  7. *  Date   : 3. 12. 1991                                                  *
  8. *                                                                        *
  9. *************************************************************************/
  10.  
  11. /* Data Structures :
  12.  
  13.    PredSimple, PredVector, Predicate
  14.  
  15.    Operations :
  16.  
  17.    PVSetFalse, PVSetExact, PVAndComponent, PVMakeForLoopNest,
  18.    PVIsFalse, PVIsExact, PVGetDimension, PVGetComponent
  19.  
  20.    PMakeFalse, POrVector, PHoldConstant, PRestrict,
  21.    PIsFalse, PGetLevel
  22.  
  23.    PSOut (Str, ps), PVOut (Str, *pv), POut (Str, *p)
  24.  
  25. */
  26.  
  27.  
  28. # if defined __STDC__ | defined __cplusplus
  29. # define ARGS(parameters)    parameters
  30. # else
  31. # define ARGS(parameters)    ()
  32. # endif
  33.  
  34. #include <stdio.h>
  35. #include <string.h>
  36. #include "Tree.h"  /* MAX_DIMENSIONS */
  37.  
  38. #define MaxInt 20000     /* 2**31-1 */
  39.  
  40. typedef struct
  41.   { int Low, High;
  42.   } PredSimple;       /* corresponds [Low, High] */
  43.  
  44.   /* abbreviations:
  45.  
  46.      <   : stands for [ -maxint, -1 ]
  47.      <=  : stands for [ -maxint, 0  ]
  48.      >   : stands for [ 1, maxint ]
  49.      >=  : stands for [ 0, maxint ]
  50.      T   : stands for [ -maxint, maxint ]
  51.      <=a : stands for [ -maxint, a ]
  52.      >=a : stands for [ a, maxint ]
  53.      'a' : stands for [ a, a ]
  54.  
  55.   */
  56.  
  57. typedef struct
  58.   { int pv_dim ;                         /* dimension */
  59.     int pv_exact;                        /* 1 if predicate is exact */
  60.     PredSimple pv_arr[MAX_DIMENSIONS];
  61.   } PredVector;
  62.  
  63. /*  p = (pv_arr[0], ..., pv_arr[pv_dim-1]),
  64.     pv_exact = 1 if vector is exact
  65.     pv_dim = 0  : p is equivalent to TRUE,
  66.     pv_dim = -1 : p is equivalent to FALSE       */
  67.  
  68. typedef struct
  69.   { int p_dim;
  70.     PredVector p_arr[MAX_DIMENSIONS];
  71.   } Predicate;
  72.  
  73. /* p = p_arr[0] or p_arr[1] or ... or p_arr[p_dim-1]
  74.    p_dim = 0  :  p is FALSE  (neutrales Element bzgl. or)   */
  75.  
  76. /**************************************************************************
  77. *                                                                         *
  78. *  Predicate Vectors                                                      *
  79. *                                                                         *
  80. **************************************************************************/
  81.  
  82. extern void PVMakeForLoopNest 
  83.    ARGS((int N, int CommonL, int ConstL, PredVector *PV));
  84.  
  85. extern void PVAndComponent 
  86.    ARGS((PredVector *PV, int k, int Low1, int High1));
  87.  
  88. extern void PVSetFalse ARGS((PredVector *PV));
  89.  
  90. extern void PVSetNotExact ARGS((PredVector *PV));
  91.  
  92. extern int PVIsFalse ARGS((PredVector *PV));
  93.  
  94. extern int PVIsExact ARGS((PredVector *PV));
  95.  
  96. extern int PVGetDimension ARGS((PredVector *PV));
  97.  
  98. extern void PVGetComponent ARGS((PredVector *PV, int k, int *Low, int *High));
  99.  
  100. /*     General  Predicates                                               */
  101.  
  102. extern void PMakeFalse ARGS((Predicate *P));
  103.  
  104. extern void POrVector ARGS((Predicate *P, PredVector *PV));
  105.  
  106. extern void PHoldConstant ARGS((Predicate *P, int n));
  107.  
  108. extern void PRestrict ARGS((Predicate *P, int n));
  109.  
  110. extern int PIsFalse ARGS((Predicate *P));
  111.  
  112. extern int PGetLevel ARGS((Predicate *P));
  113.  
  114. /*  String Representation of Predicates and PredVectors  */
  115.  
  116. char * PSOut ARGS((char *Str, PredSimple ps));
  117.  
  118. char * PVOut ARGS((char *Str, PredVector *PV));
  119.  
  120. char * POut ARGS((char *Str, Predicate *P));
  121.