File tree Expand file tree Collapse file tree 3 files changed +37
-3
lines changed Expand file tree Collapse file tree 3 files changed +37
-3
lines changed Original file line number Diff line number Diff line change @@ -30,3 +30,9 @@ We get the list of typedef's included in pgindent by running:
30
30
Make sure to do the pgsql/bin directory, and the src/interfaces/odbc
31
31
directory. Merge the output of these and remove duplicates.
32
32
33
+ ---------------------------------------------------------------------------
34
+
35
+ For java, we use astyle, http://astyle.sourceforge.net/, with the
36
+ following options:
37
+
38
+ find . -name '*.java' -type f -print | xargs -n100 pgjindent
Original file line number Diff line number Diff line change 24
24
25
25
for FILE
26
26
do
27
- cat $FILE |
27
+ cat " $FILE " |
28
28
# convert // comments to /* */
29
29
sed ' s;^\([ ]*\)//\(.*\)$;\1/* \2 */;g' |
30
30
# mark some comments for special treatment later
@@ -1319,7 +1319,7 @@ int pgindent_func_no_var_fix;\
1319
1319
# add space after comments that start on tab stops
1320
1320
sed ' s,;\(/\*.*\*/\)$,; \1,' |
1321
1321
# work around #else indenting next line if #ifdef defines variables at top
1322
- # work around case misindenting function has no variables defined
1322
+ # work around misindenting of function with no variables defined
1323
1323
awk '
1324
1324
{
1325
1325
if ($0 ~ "^[ ]*int[ ]*pgindent_func_no_var_fix;")
@@ -1329,6 +1329,7 @@ int pgindent_func_no_var_fix;\
1329
1329
}
1330
1330
else print $0;
1331
1331
}' |
1332
+ # remove tabs and retab with four spaces
1332
1333
detab -t8 -qc |
1333
1334
entab -t4 -qc |
1334
1335
# move trailing * in function return type
@@ -1459,7 +1460,7 @@ int pgindent_func_no_var_fix;\
1459
1460
}
1460
1461
else print $0;
1461
1462
}' |
1462
- cat > /tmp/$$ && cat /tmp/$$ > $FILE
1463
+ cat > /tmp/$$ && cat /tmp/$$ > " $FILE "
1463
1464
done
1464
1465
1465
1466
# The 'for' loop makes these backup files useless so delete them
Original file line number Diff line number Diff line change
1
+ #! /bin/sh
2
+
3
+ trap " rm -f /tmp/$$ /tmp/$$ a" 0 1 2 3 15
4
+ entab < /dev/null > /dev/null
5
+ if [ " $? " -ne 0 ]
6
+ then echo " Go to the src/tools/entab directory and do a 'make' and 'make install'." >&2
7
+ echo " This will put the 'entab' command in your path." >&2
8
+ echo " Then run $0 again."
9
+ exit 1
10
+ fi
11
+ astyle --version < /dev/null > /dev/null 2>&1
12
+ if [ " $? " -eq 0 ]
13
+ then echo " You do not appear to have 'astyle' installed on your system." >&2
14
+ exit 1
15
+ fi
16
+
17
+ for FILE
18
+ do
19
+ astyle --style=java -b -p -j < " $FILE " > /tmp/$$ 2> /tmp/$$ a
20
+ if [ " $? " -ne 0 -o -s /tmp/$$ a ]
21
+ then echo " $FILE "
22
+ cat /tmp/$$ a
23
+ fi
24
+ cat /tmp/$$ |
25
+ entab -t4 -qc |
26
+ cat > /tmp/$$ a && cat /tmp/$$ a > " $FILE "
27
+ done
You can’t perform that action at this time.
0 commit comments