7 #define CUBE_MAX_DIM (100)
37 #define POINT_BIT 0x80000000
38 #define DIM_MASK 0x7fffffff
40 #define IS_POINT(cube) ( ((cube)->header & POINT_BIT) != 0 )
41 #define SET_POINT_BIT(cube) ( (cube)->header |= POINT_BIT )
42 #define DIM(cube) ( (cube)->header & DIM_MASK )
43 #define SET_DIM(cube, _dim) ( (cube)->header = ((cube)->header & ~DIM_MASK) | (_dim) )
45 #define LL_COORD(cube, i) ( (cube)->x[i] )
46 #define UR_COORD(cube, i) ( IS_POINT(cube) ? (cube)->x[i] : (cube)->x[(i) + DIM(cube)] )
48 #define POINT_SIZE(_dim) (offsetof(NDBOX, x) + sizeof(double)*(_dim))
49 #define CUBE_SIZE(_dim) (offsetof(NDBOX, x) + sizeof(double)*(_dim)*2)
52 #define DatumGetNDBOXP(x) ((NDBOX *) PG_DETOAST_DATUM(x))
53 #define PG_GETARG_NDBOX_P(x) DatumGetNDBOXP(PG_GETARG_DATUM(x))
54 #define PG_RETURN_NDBOX_P(x) PG_RETURN_POINTER(x)
57 #define CubeKNNDistanceCoord 15
58 #define CubeKNNDistanceTaxicab 16
59 #define CubeKNNDistanceEuclid 17
60 #define CubeKNNDistanceChebyshev 18
65 struct Node *escontext,
72 struct Node *escontext);
#define FLEXIBLE_ARRAY_MEMBER
void cube_scanner_finish(void)
int cube_yyparse(NDBOX **result, Size scanbuflen, struct Node *escontext)
void cube_yyerror(NDBOX **result, Size scanbuflen, struct Node *escontext, const char *message)
void cube_scanner_init(const char *str, Size *scanbuflen)
double x[FLEXIBLE_ARRAY_MEMBER]