Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit654e1f9

Browse files
committed
Clean up whitespace and indentation in parser and scanner files
These are not touched by pgindent, so clean them up a bit manually.
1 parentf3ebaad commit654e1f9

File tree

12 files changed

+730
-609
lines changed

12 files changed

+730
-609
lines changed

‎contrib/cube/cubeparse.y

Lines changed: 151 additions & 148 deletions
Original file line numberDiff line numberDiff line change
@@ -47,165 +47,167 @@ static NDBOX * write_point_as_box(char *s, int dim);
4747
/* Grammar follows*/
4848
%%
4949

50-
box:
51-
O_BRACKETparen_listCOMMAparen_listC_BRACKET{
52-
53-
int dim;
54-
55-
dim =delim_count($2,',') +1;
56-
if ( (delim_count($4,',') +1) != dim ){
57-
ereport(ERROR,
58-
(errcode(ERRCODE_SYNTAX_ERROR),
59-
errmsg("bad cube representation"),
60-
errdetail("Different point dimensions in (%s) and (%s).",
61-
$2, $4)));
62-
YYABORT;
63-
}
64-
if (dim > CUBE_MAX_DIM) {
65-
ereport(ERROR,
66-
(errcode(ERRCODE_SYNTAX_ERROR),
67-
errmsg("bad cube representation"),
68-
errdetail("A cube cannot have more than %d dimensions.",
69-
CUBE_MAX_DIM)));
70-
YYABORT;
71-
}
72-
73-
*((void **)result) = write_box( dim,$2,$4 );
74-
75-
}
76-
|
77-
paren_listCOMMAparen_list {
78-
int dim;
79-
80-
dim = delim_count($1,',') +1;
81-
82-
if ( (delim_count($3,',') +1) != dim ) {
83-
ereport(ERROR,
84-
(errcode(ERRCODE_SYNTAX_ERROR),
85-
errmsg("bad cube representation"),
86-
errdetail("Different point dimensions in (%s) and (%s).",
87-
$1, $3)));
88-
YYABORT;
89-
}
90-
if (dim > CUBE_MAX_DIM) {
91-
ereport(ERROR,
92-
(errcode(ERRCODE_SYNTAX_ERROR),
93-
errmsg("bad cube representation"),
94-
errdetail("A cubecannot have more than %d dimensions.",
95-
CUBE_MAX_DIM)));
96-
YYABORT;
97-
}
98-
99-
*((void **)result) = write_box( dim,$1,$3 );
100-
}
101-
|
102-
103-
paren_list {
104-
int dim;
105-
106-
dim = delim_count($1,',') +1;
107-
if (dim > CUBE_MAX_DIM) {
108-
ereport(ERROR,
109-
(errcode(ERRCODE_SYNTAX_ERROR),
110-
errmsg("bad cube representation"),
111-
errdetail("A cubecannot have more than %d dimensions.",
112-
CUBE_MAX_DIM)));
113-
YYABORT;
114-
}
115-
116-
*((void **)result) = write_point_as_box($1, dim);
117-
}
118-
119-
|
120-
121-
list{
122-
int dim;
123-
124-
dim = delim_count($1,',') +1;
125-
if (dim > CUBE_MAX_DIM) {
126-
ereport(ERROR,
127-
(errcode(ERRCODE_SYNTAX_ERROR),
128-
errmsg("bad cube representation"),
129-
errdetail("A cube cannot have more than %d dimensions.",
130-
CUBE_MAX_DIM)));
131-
YYABORT;
132-
}
133-
*((void **)result) = write_point_as_box($1, dim);
134-
}
135-
;
136-
137-
paren_list:
138-
O_PARENlistC_PAREN{
139-
$$ =$2;
140-
}
141-
;
142-
143-
list:
144-
CUBEFLOAT{
145-
/* alloc enough space to be sure whole list will fit*/
146-
$$ = palloc(scanbuflen +1);
147-
strcpy($$, $1);
148-
}
149-
|
150-
listCOMMACUBEFLOAT{
151-
$$ =$1;
152-
strcat($$,",");
153-
strcat($$, $3);
154-
}
155-
;
50+
box:O_BRACKETparen_listCOMMAparen_listC_BRACKET
51+
{
52+
int dim;
53+
54+
dim = delim_count($2,',') +1;
55+
if ((delim_count($4,',') +1) != dim)
56+
{
57+
ereport(ERROR,
58+
(errcode(ERRCODE_SYNTAX_ERROR),
59+
errmsg("bad cube representation"),
60+
errdetail("Different point dimensions in (%s) and (%s).",
61+
$2, $4)));
62+
YYABORT;
63+
}
64+
if (dim > CUBE_MAX_DIM) {
65+
ereport(ERROR,
66+
(errcode(ERRCODE_SYNTAX_ERROR),
67+
errmsg("bad cube representation"),
68+
errdetail("A cube cannot have more than %d dimensions.",
69+
CUBE_MAX_DIM)));
70+
YYABORT;
71+
}
72+
73+
*((void **)result) = write_box( dim,$2,$4 );
74+
75+
}
76+
77+
|paren_listCOMMAparen_list
78+
{
79+
int dim;
80+
81+
dim = delim_count($1,',') +1;
82+
83+
if ( (delim_count($3,',') +1) != dim ) {
84+
ereport(ERROR,
85+
(errcode(ERRCODE_SYNTAX_ERROR),
86+
errmsg("bad cube representation"),
87+
errdetail("Different point dimensions in (%s) and (%s).",
88+
$1, $3)));
89+
YYABORT;
90+
}
91+
if (dim > CUBE_MAX_DIM) {
92+
ereport(ERROR,
93+
(errcode(ERRCODE_SYNTAX_ERROR),
94+
errmsg("bad cuberepresentation"),
95+
errdetail("A cube cannot have more than %d dimensions.",
96+
CUBE_MAX_DIM)));
97+
YYABORT;
98+
}
99+
100+
*((void **)result) = write_box( dim,$1,$3 );
101+
}
102+
103+
|paren_list
104+
{
105+
int dim;
106+
107+
dim = delim_count($1,',') +1;
108+
if (dim > CUBE_MAX_DIM) {
109+
ereport(ERROR,
110+
(errcode(ERRCODE_SYNTAX_ERROR),
111+
errmsg("bad cuberepresentation"),
112+
errdetail("A cube cannot have more than %d dimensions.",
113+
CUBE_MAX_DIM)));
114+
YYABORT;
115+
}
116+
117+
*((void **)result) = write_point_as_box($1, dim);
118+
}
119+
120+
|list
121+
{
122+
int dim;
123+
124+
dim = delim_count($1,',') +1;
125+
if (dim > CUBE_MAX_DIM) {
126+
ereport(ERROR,
127+
(errcode(ERRCODE_SYNTAX_ERROR),
128+
errmsg("bad cube representation"),
129+
errdetail("A cube cannot have more than %d dimensions.",
130+
CUBE_MAX_DIM)));
131+
YYABORT;
132+
}
133+
*((void **)result) = write_point_as_box($1, dim);
134+
}
135+
;
136+
137+
paren_list:O_PARENlistC_PAREN
138+
{
139+
$$ =$2;
140+
}
141+
;
142+
143+
list:CUBEFLOAT
144+
{
145+
/* alloc enough space to be sure whole list will fit*/
146+
$$ = palloc(scanbuflen +1);
147+
strcpy($$, $1);
148+
}
149+
|listCOMMACUBEFLOAT
150+
{
151+
$$ =$1;
152+
strcat($$,",");
153+
strcat($$, $3);
154+
}
155+
;
156156

157157
%%
158158

159159
staticint
160160
delim_count(char *s,char delim)
161161
{
162-
intndelim =0;
163-
164-
while ((s =strchr(s, delim)) !=NULL)
165-
{
166-
ndelim++;
167-
s++;
168-
}
169-
return (ndelim);
162+
intndelim =0;
163+
164+
while ((s =strchr(s, delim)) !=NULL)
165+
{
166+
ndelim++;
167+
s++;
168+
}
169+
return (ndelim);
170170
}
171171

172172
static NDBOX *
173173
write_box(unsignedint dim,char *str1,char *str2)
174174
{
175-
NDBOX * bp;
176-
char * s;
177-
int i;
178-
int size =offsetof(NDBOX, x[0]) +sizeof(double) * dim *2;
179-
180-
bp =palloc0(size);
181-
SET_VARSIZE(bp, size);
182-
bp->dim = dim;
183-
184-
s = str1;
185-
bp->x[i=0] =strtod(s,NULL);
186-
while ((s =strchr(s,',')) !=NULL) {
187-
s++; i++;
188-
bp->x[i] =strtod(s,NULL);
189-
}
190-
191-
s = str2;
192-
bp->x[i=dim] =strtod(s,NULL);
193-
while ((s =strchr(s,',')) !=NULL) {
194-
s++; i++;
195-
bp->x[i] =strtod(s,NULL);
196-
}
197-
198-
return(bp);
175+
NDBOX *bp;
176+
char *s;
177+
inti;
178+
intsize =offsetof(NDBOX, x[0]) +sizeof(double) * dim *2;
179+
180+
bp =palloc0(size);
181+
SET_VARSIZE(bp, size);
182+
bp->dim = dim;
183+
184+
s = str1;
185+
bp->x[i=0] =strtod(s,NULL);
186+
while ((s =strchr(s,',')) !=NULL)
187+
{
188+
s++; i++;
189+
bp->x[i] =strtod(s,NULL);
190+
}
191+
192+
s = str2;
193+
bp->x[i=dim] =strtod(s,NULL);
194+
while ((s =strchr(s,',')) !=NULL)
195+
{
196+
s++; i++;
197+
bp->x[i] =strtod(s,NULL);
198+
}
199+
200+
return(bp);
199201
}
200202

201-
202203
static NDBOX *
203204
write_point_as_box(char *str,int dim)
204205
{
205-
NDBOX * bp;
206-
int i, size;
207-
double x;
208-
char * s = str;
206+
NDBOX *bp;
207+
inti,
208+
size;
209+
doublex;
210+
char *s = str;
209211

210212
size =offsetof(NDBOX, x[0]) +sizeof(double) * dim *2;
211213

@@ -217,11 +219,12 @@ write_point_as_box(char *str, int dim)
217219
x =strtod(s,NULL);
218220
bp->x[0] = x;
219221
bp->x[dim] = x;
220-
while ((s =strchr(s,',')) !=NULL) {
221-
s++; i++;
222-
x =strtod(s,NULL);
223-
bp->x[i] = x;
224-
bp->x[i+dim] = x;
222+
while ((s =strchr(s,',')) !=NULL)
223+
{
224+
s++; i++;
225+
x =strtod(s,NULL);
226+
bp->x[i] = x;
227+
bp->x[i+dim] = x;
225228
}
226229

227230
return(bp);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp