Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
db64df4b
Commit
db64df4b
authored
Sep 14, 2004
by
Tom Lane
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix contrib/cube and contrib/seg to compile on Windows.
Andreas Pflug
parent
92244e8e
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
59 additions
and
63 deletions
+59
-63
contrib/cube/cube.c
contrib/cube/cube.c
+48
-50
contrib/cube/cubeparse.y
contrib/cube/cubeparse.y
+3
-3
contrib/cube/cubescan.l
contrib/cube/cubescan.l
+1
-1
contrib/seg/seg.c
contrib/seg/seg.c
+2
-4
contrib/seg/segparse.y
contrib/seg/segparse.y
+4
-4
contrib/seg/segscan.l
contrib/seg/segscan.l
+1
-1
No files found.
contrib/cube/cube.c
View file @
db64df4b
...
...
@@ -15,8 +15,6 @@
#include "cubedata.h"
#define max(a,b) ((a) > (b) ? (a) : (b))
#define min(a,b) ((a) <= (b) ? (a) : (b))
#define abs(a) ((a) < (0) ? (-a) : (a))
extern
int
cube_yyparse
();
...
...
@@ -590,8 +588,8 @@ cube_union(NDBOX * a, NDBOX * b)
*/
for
(
i
=
0
;
i
<
b
->
dim
;
i
++
)
{
result
->
x
[
i
]
=
m
in
(
b
->
x
[
i
],
b
->
x
[
i
+
b
->
dim
]);
result
->
x
[
i
+
a
->
dim
]
=
m
ax
(
b
->
x
[
i
],
b
->
x
[
i
+
b
->
dim
]);
result
->
x
[
i
]
=
M
in
(
b
->
x
[
i
],
b
->
x
[
i
+
b
->
dim
]);
result
->
x
[
i
+
a
->
dim
]
=
M
ax
(
b
->
x
[
i
],
b
->
x
[
i
+
b
->
dim
]);
}
for
(
i
=
b
->
dim
;
i
<
a
->
dim
;
i
++
)
{
...
...
@@ -603,8 +601,8 @@ cube_union(NDBOX * a, NDBOX * b)
for
(
i
=
0
;
i
<
a
->
dim
;
i
++
)
{
result
->
x
[
i
]
=
min
(
m
in
(
a
->
x
[
i
],
a
->
x
[
i
+
a
->
dim
]),
result
->
x
[
i
]);
result
->
x
[
i
+
a
->
dim
]
=
max
(
m
ax
(
a
->
x
[
i
],
Min
(
M
in
(
a
->
x
[
i
],
a
->
x
[
i
+
a
->
dim
]),
result
->
x
[
i
]);
result
->
x
[
i
+
a
->
dim
]
=
Max
(
M
ax
(
a
->
x
[
i
],
a
->
x
[
i
+
a
->
dim
]),
result
->
x
[
i
+
a
->
dim
]);
}
...
...
@@ -648,8 +646,8 @@ cube_inter(NDBOX * a, NDBOX * b)
*/
for
(
i
=
0
;
i
<
b
->
dim
;
i
++
)
{
result
->
x
[
i
]
=
m
in
(
b
->
x
[
i
],
b
->
x
[
i
+
b
->
dim
]);
result
->
x
[
i
+
a
->
dim
]
=
m
ax
(
b
->
x
[
i
],
b
->
x
[
i
+
b
->
dim
]);
result
->
x
[
i
]
=
M
in
(
b
->
x
[
i
],
b
->
x
[
i
+
b
->
dim
]);
result
->
x
[
i
+
a
->
dim
]
=
M
ax
(
b
->
x
[
i
],
b
->
x
[
i
+
b
->
dim
]);
}
for
(
i
=
b
->
dim
;
i
<
a
->
dim
;
i
++
)
{
...
...
@@ -661,8 +659,8 @@ cube_inter(NDBOX * a, NDBOX * b)
for
(
i
=
0
;
i
<
a
->
dim
;
i
++
)
{
result
->
x
[
i
]
=
max
(
m
in
(
a
->
x
[
i
],
a
->
x
[
i
+
a
->
dim
]),
result
->
x
[
i
]);
result
->
x
[
i
+
a
->
dim
]
=
min
(
m
ax
(
a
->
x
[
i
],
Max
(
M
in
(
a
->
x
[
i
],
a
->
x
[
i
+
a
->
dim
]),
result
->
x
[
i
]);
result
->
x
[
i
+
a
->
dim
]
=
Min
(
M
ax
(
a
->
x
[
i
],
a
->
x
[
i
+
a
->
dim
]),
result
->
x
[
i
+
a
->
dim
]);
}
...
...
@@ -720,8 +718,8 @@ cube_over_left(NDBOX * a, NDBOX * b)
if
((
a
==
NULL
)
||
(
b
==
NULL
))
return
(
FALSE
);
return
(
m
in
(
a
->
x
[
a
->
dim
-
1
],
a
->
x
[
2
*
a
->
dim
-
1
])
<=
m
in
(
b
->
x
[
b
->
dim
-
1
],
b
->
x
[
2
*
b
->
dim
-
1
])
&&
return
(
M
in
(
a
->
x
[
a
->
dim
-
1
],
a
->
x
[
2
*
a
->
dim
-
1
])
<=
M
in
(
b
->
x
[
b
->
dim
-
1
],
b
->
x
[
2
*
b
->
dim
-
1
])
&&
!
cube_left
(
a
,
b
)
&&
!
cube_right
(
a
,
b
));
}
...
...
@@ -733,8 +731,8 @@ cube_over_right(NDBOX * a, NDBOX * b)
if
((
a
==
NULL
)
||
(
b
==
NULL
))
return
(
FALSE
);
return
(
m
in
(
a
->
x
[
a
->
dim
-
1
],
a
->
x
[
2
*
a
->
dim
-
1
])
>=
m
in
(
b
->
x
[
b
->
dim
-
1
],
b
->
x
[
2
*
b
->
dim
-
1
])
&&
return
(
M
in
(
a
->
x
[
a
->
dim
-
1
],
a
->
x
[
2
*
a
->
dim
-
1
])
>=
M
in
(
b
->
x
[
b
->
dim
-
1
],
b
->
x
[
2
*
b
->
dim
-
1
])
&&
!
cube_left
(
a
,
b
)
&&
!
cube_right
(
a
,
b
));
}
...
...
@@ -747,8 +745,8 @@ cube_left(NDBOX * a, NDBOX * b)
if
((
a
==
NULL
)
||
(
b
==
NULL
))
return
(
FALSE
);
return
(
m
in
(
a
->
x
[
a
->
dim
-
1
],
a
->
x
[
2
*
a
->
dim
-
1
])
<
m
in
(
b
->
x
[
0
],
b
->
x
[
b
->
dim
]));
return
(
M
in
(
a
->
x
[
a
->
dim
-
1
],
a
->
x
[
2
*
a
->
dim
-
1
])
<
M
in
(
b
->
x
[
0
],
b
->
x
[
b
->
dim
]));
}
/* return 'true' if the projection of 'a' is
...
...
@@ -759,8 +757,8 @@ cube_right(NDBOX * a, NDBOX * b)
if
((
a
==
NULL
)
||
(
b
==
NULL
))
return
(
FALSE
);
return
(
m
in
(
a
->
x
[
0
],
a
->
x
[
a
->
dim
])
>
m
in
(
b
->
x
[
b
->
dim
-
1
],
b
->
x
[
2
*
b
->
dim
-
1
]));
return
(
M
in
(
a
->
x
[
0
],
a
->
x
[
a
->
dim
])
>
M
in
(
b
->
x
[
b
->
dim
-
1
],
b
->
x
[
2
*
b
->
dim
-
1
]));
}
/* make up a metric in which one box will be 'lower' than the other
...
...
@@ -771,25 +769,25 @@ cube_cmp(NDBOX * a, NDBOX * b)
int
i
;
int
dim
;
dim
=
m
in
(
a
->
dim
,
b
->
dim
);
dim
=
M
in
(
a
->
dim
,
b
->
dim
);
/* compare the common dimensions */
for
(
i
=
0
;
i
<
dim
;
i
++
)
{
if
(
m
in
(
a
->
x
[
i
],
a
->
x
[
a
->
dim
+
i
])
>
m
in
(
b
->
x
[
i
],
b
->
x
[
b
->
dim
+
i
]))
if
(
M
in
(
a
->
x
[
i
],
a
->
x
[
a
->
dim
+
i
])
>
M
in
(
b
->
x
[
i
],
b
->
x
[
b
->
dim
+
i
]))
return
1
;
if
(
m
in
(
a
->
x
[
i
],
a
->
x
[
a
->
dim
+
i
])
<
m
in
(
b
->
x
[
i
],
b
->
x
[
b
->
dim
+
i
]))
if
(
M
in
(
a
->
x
[
i
],
a
->
x
[
a
->
dim
+
i
])
<
M
in
(
b
->
x
[
i
],
b
->
x
[
b
->
dim
+
i
]))
return
-
1
;
}
for
(
i
=
0
;
i
<
dim
;
i
++
)
{
if
(
m
ax
(
a
->
x
[
i
],
a
->
x
[
a
->
dim
+
i
])
>
m
ax
(
b
->
x
[
i
],
b
->
x
[
b
->
dim
+
i
]))
if
(
M
ax
(
a
->
x
[
i
],
a
->
x
[
a
->
dim
+
i
])
>
M
ax
(
b
->
x
[
i
],
b
->
x
[
b
->
dim
+
i
]))
return
1
;
if
(
m
ax
(
a
->
x
[
i
],
a
->
x
[
a
->
dim
+
i
])
<
m
ax
(
b
->
x
[
i
],
b
->
x
[
b
->
dim
+
i
]))
if
(
M
ax
(
a
->
x
[
i
],
a
->
x
[
a
->
dim
+
i
])
<
M
ax
(
b
->
x
[
i
],
b
->
x
[
b
->
dim
+
i
]))
return
-
1
;
}
...
...
@@ -798,16 +796,16 @@ cube_cmp(NDBOX * a, NDBOX * b)
{
for
(
i
=
dim
;
i
<
a
->
dim
;
i
++
)
{
if
(
m
in
(
a
->
x
[
i
],
a
->
x
[
a
->
dim
+
i
])
>
0
)
if
(
M
in
(
a
->
x
[
i
],
a
->
x
[
a
->
dim
+
i
])
>
0
)
return
1
;
if
(
m
in
(
a
->
x
[
i
],
a
->
x
[
a
->
dim
+
i
])
<
0
)
if
(
M
in
(
a
->
x
[
i
],
a
->
x
[
a
->
dim
+
i
])
<
0
)
return
-
1
;
}
for
(
i
=
dim
;
i
<
a
->
dim
;
i
++
)
{
if
(
m
ax
(
a
->
x
[
i
],
a
->
x
[
a
->
dim
+
i
])
>
0
)
if
(
M
ax
(
a
->
x
[
i
],
a
->
x
[
a
->
dim
+
i
])
>
0
)
return
1
;
if
(
m
ax
(
a
->
x
[
i
],
a
->
x
[
a
->
dim
+
i
])
<
0
)
if
(
M
ax
(
a
->
x
[
i
],
a
->
x
[
a
->
dim
+
i
])
<
0
)
return
-
1
;
}
...
...
@@ -821,16 +819,16 @@ cube_cmp(NDBOX * a, NDBOX * b)
{
for
(
i
=
dim
;
i
<
b
->
dim
;
i
++
)
{
if
(
m
in
(
b
->
x
[
i
],
b
->
x
[
b
->
dim
+
i
])
>
0
)
if
(
M
in
(
b
->
x
[
i
],
b
->
x
[
b
->
dim
+
i
])
>
0
)
return
-
1
;
if
(
m
in
(
b
->
x
[
i
],
b
->
x
[
b
->
dim
+
i
])
<
0
)
if
(
M
in
(
b
->
x
[
i
],
b
->
x
[
b
->
dim
+
i
])
<
0
)
return
1
;
}
for
(
i
=
dim
;
i
<
b
->
dim
;
i
++
)
{
if
(
m
ax
(
b
->
x
[
i
],
b
->
x
[
b
->
dim
+
i
])
>
0
)
if
(
M
ax
(
b
->
x
[
i
],
b
->
x
[
b
->
dim
+
i
])
>
0
)
return
-
1
;
if
(
m
ax
(
b
->
x
[
i
],
b
->
x
[
b
->
dim
+
i
])
<
0
)
if
(
M
ax
(
b
->
x
[
i
],
b
->
x
[
b
->
dim
+
i
])
<
0
)
return
1
;
}
...
...
@@ -911,13 +909,13 @@ cube_contains(NDBOX * a, NDBOX * b)
}
/* Can't care less about the excess dimensions of (a), if any */
for
(
i
=
0
;
i
<
m
in
(
a
->
dim
,
b
->
dim
);
i
++
)
for
(
i
=
0
;
i
<
M
in
(
a
->
dim
,
b
->
dim
);
i
++
)
{
if
(
m
in
(
a
->
x
[
i
],
a
->
x
[
a
->
dim
+
i
])
>
m
in
(
b
->
x
[
i
],
b
->
x
[
b
->
dim
+
i
]))
if
(
M
in
(
a
->
x
[
i
],
a
->
x
[
a
->
dim
+
i
])
>
M
in
(
b
->
x
[
i
],
b
->
x
[
b
->
dim
+
i
]))
return
(
FALSE
);
if
(
m
ax
(
a
->
x
[
i
],
a
->
x
[
a
->
dim
+
i
])
<
m
ax
(
b
->
x
[
i
],
b
->
x
[
b
->
dim
+
i
]))
if
(
M
ax
(
a
->
x
[
i
],
a
->
x
[
a
->
dim
+
i
])
<
M
ax
(
b
->
x
[
i
],
b
->
x
[
b
->
dim
+
i
]))
return
(
FALSE
);
}
...
...
@@ -961,20 +959,20 @@ cube_overlap(NDBOX * a, NDBOX * b)
/* compare within the dimensions of (b) */
for
(
i
=
0
;
i
<
b
->
dim
;
i
++
)
{
if
(
m
in
(
a
->
x
[
i
],
a
->
x
[
a
->
dim
+
i
])
>
m
ax
(
b
->
x
[
i
],
b
->
x
[
b
->
dim
+
i
]))
if
(
M
in
(
a
->
x
[
i
],
a
->
x
[
a
->
dim
+
i
])
>
M
ax
(
b
->
x
[
i
],
b
->
x
[
b
->
dim
+
i
]))
return
(
FALSE
);
if
(
m
ax
(
a
->
x
[
i
],
a
->
x
[
a
->
dim
+
i
])
<
m
in
(
b
->
x
[
i
],
b
->
x
[
b
->
dim
+
i
]))
if
(
M
ax
(
a
->
x
[
i
],
a
->
x
[
a
->
dim
+
i
])
<
M
in
(
b
->
x
[
i
],
b
->
x
[
b
->
dim
+
i
]))
return
(
FALSE
);
}
/* compare to zero those dimensions in (a) absent in (b) */
for
(
i
=
b
->
dim
;
i
<
a
->
dim
;
i
++
)
{
if
(
m
in
(
a
->
x
[
i
],
a
->
x
[
a
->
dim
+
i
])
>
0
)
if
(
M
in
(
a
->
x
[
i
],
a
->
x
[
a
->
dim
+
i
])
>
0
)
return
(
FALSE
);
if
(
m
ax
(
a
->
x
[
i
],
a
->
x
[
a
->
dim
+
i
])
<
0
)
if
(
M
ax
(
a
->
x
[
i
],
a
->
x
[
a
->
dim
+
i
])
<
0
)
return
(
FALSE
);
}
...
...
@@ -1031,11 +1029,11 @@ distance_1D(double a1, double a2, double b1, double b2)
{
/* interval (a) is entirely on the left of (b) */
if
((
a1
<=
b1
)
&&
(
a2
<=
b1
)
&&
(
a1
<=
b2
)
&&
(
a2
<=
b2
))
return
(
min
(
b1
,
b2
)
-
m
ax
(
a1
,
a2
));
return
(
Min
(
b1
,
b2
)
-
M
ax
(
a1
,
a2
));
/* interval (a) is entirely on the right of (b) */
if
((
a1
>
b1
)
&&
(
a2
>
b1
)
&&
(
a1
>
b2
)
&&
(
a2
>
b2
))
return
(
min
(
a1
,
a2
)
-
m
ax
(
b1
,
b2
));
return
(
Min
(
a1
,
a2
)
-
M
ax
(
b1
,
b2
));
/* the rest are all sorts of intersections */
return
(
0
.
0
);
...
...
@@ -1074,7 +1072,7 @@ cube_ll_coord(NDBOX * a, int4 n)
result
=
(
double
*
)
palloc
(
sizeof
(
double
));
*
result
=
0
;
if
(
a
->
dim
>=
n
&&
n
>
0
)
*
result
=
m
in
(
a
->
x
[
n
-
1
],
a
->
x
[
a
->
dim
+
n
-
1
]);
*
result
=
M
in
(
a
->
x
[
n
-
1
],
a
->
x
[
a
->
dim
+
n
-
1
]);
return
result
;
}
...
...
@@ -1087,7 +1085,7 @@ cube_ur_coord(NDBOX * a, int4 n)
result
=
(
double
*
)
palloc
(
sizeof
(
double
));
*
result
=
0
;
if
(
a
->
dim
>=
n
&&
n
>
0
)
*
result
=
m
ax
(
a
->
x
[
n
-
1
],
a
->
x
[
a
->
dim
+
n
-
1
]);
*
result
=
M
ax
(
a
->
x
[
n
-
1
],
a
->
x
[
a
->
dim
+
n
-
1
]);
return
result
;
}
...
...
contrib/cube/cubeparse.y
View file @
db64df4b
...
...
@@ -28,7 +28,7 @@ static NDBOX * write_point_as_box(char *s, int dim);
%}
/* BISON Declarations */
%token FLOAT O_PAREN C_PAREN O_BRACKET C_BRACKET COMMA
%token
CUBE
FLOAT O_PAREN C_PAREN O_BRACKET C_BRACKET COMMA
%start box
/* Grammar follows */
...
...
@@ -128,13 +128,13 @@ paren_list:
;
list:
FLOAT {
CUBE
FLOAT {
/* alloc enough space to be sure whole list will fit */
$$ = palloc(scanbuflen + 1);
strcpy($$, $1);
}
|
list COMMA FLOAT {
list COMMA
CUBE
FLOAT {
$$ = $1;
strcat($$, ",");
strcat($$, $3);
...
...
contrib/cube/cubescan.l
View file @
db64df4b
...
...
@@ -39,7 +39,7 @@ float ({integer}|{real})([eE]{integer})?
%%
{float} yylval = yytext; return FLOAT;
{float} yylval = yytext; return
CUBE
FLOAT;
\[ yylval = "("; return O_BRACKET;
\] yylval = ")"; return C_BRACKET;
\( yylval = "("; return O_PAREN;
...
...
contrib/seg/seg.c
View file @
db64df4b
...
...
@@ -14,8 +14,6 @@
#include "segdata.h"
#define max(a,b) ((a) > (b) ? (a) : (b))
#define min(a,b) ((a) <= (b) ? (a) : (b))
#define abs(a) ((a) < (0) ? (-a) : (a))
/*
...
...
@@ -924,7 +922,7 @@ restore(char *result, float val, int n)
* put a cap on the number of siugnificant digits to avoid nonsense in
* the output
*/
n
=
m
in
(
n
,
FLT_DIG
);
n
=
M
in
(
n
,
FLT_DIG
);
/* remember the sign */
sign
=
(
val
<
0
?
1
:
0
);
...
...
@@ -946,7 +944,7 @@ restore(char *result, float val, int n)
if
(
exp
==
0
)
{
/* use the supplied mantyssa with sign */
strcpy
((
char
*
)
index
(
result
,
'e'
),
""
);
strcpy
((
char
*
)
strchr
(
result
,
'e'
),
""
);
}
else
{
...
...
contrib/seg/segparse.y
View file @
db64df4b
...
...
@@ -38,7 +38,7 @@
} bnd;
char * text;
}
%token <text> FLOAT
%token <text>
SEG
FLOAT
%token <text> RANGE
%token <text> PLUMIN
%token <text> EXTENSION
...
...
@@ -105,13 +105,13 @@ range:
;
boundary:
FLOAT {
SEG
FLOAT {
$$.ext = '\0';
$$.sigd = significant_digits($1);
$$.val = seg_atof($1);
}
|
EXTENSION FLOAT {
EXTENSION
SEG
FLOAT {
$$.ext = $1[0];
$$.sigd = significant_digits($2);
$$.val = seg_atof($2);
...
...
@@ -119,7 +119,7 @@ boundary:
;
deviation:
FLOAT {
SEG
FLOAT {
$$.ext = '\0';
$$.sigd = significant_digits($1);
$$.val = seg_atof($1);
...
...
contrib/seg/segscan.l
View file @
db64df4b
...
...
@@ -41,7 +41,7 @@ float ({integer}|{real})([eE]{integer})?
{range} yylval.text = yytext; return RANGE;
{plumin} yylval.text = yytext; return PLUMIN;
{float} yylval.text = yytext; return FLOAT;
{float} yylval.text = yytext; return
SEG
FLOAT;
\< yylval.text = "<"; return EXTENSION;
\> yylval.text = ">"; return EXTENSION;
\~ yylval.text = "~"; return EXTENSION;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment