Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
postgres-lambda-diff
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jakob Huber
postgres-lambda-diff
Commits
3fb36784
Commit
3fb36784
authored
23 years ago
by
Bruce Momjian
Browse files
Options
Downloads
Patches
Plain Diff
Create pgjindent for java.
parent
17c03b30
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/tools/pgindent/README
+6
-0
6 additions, 0 deletions
src/tools/pgindent/README
src/tools/pgindent/pgindent
+4
-3
4 additions, 3 deletions
src/tools/pgindent/pgindent
src/tools/pgindent/pgjindent
+27
-0
27 additions, 0 deletions
src/tools/pgindent/pgjindent
with
37 additions
and
3 deletions
src/tools/pgindent/README
+
6
−
0
View file @
3fb36784
...
@@ -30,3 +30,9 @@ We get the list of typedef's included in pgindent by running:
...
@@ -30,3 +30,9 @@ We get the list of typedef's included in pgindent by running:
Make sure to do the pgsql/bin directory, and the src/interfaces/odbc
Make sure to do the pgsql/bin directory, and the src/interfaces/odbc
directory. Merge the output of these and remove duplicates.
directory. Merge the output of these and remove duplicates.
---------------------------------------------------------------------------
For java, we use astyle, http://astyle.sourceforge.net/, with the
following options:
find . -name '*.java' -type f -print | xargs -n100 pgjindent
This diff is collapsed.
Click to expand it.
src/tools/pgindent/pgindent
+
4
−
3
View file @
3fb36784
...
@@ -24,7 +24,7 @@ fi
...
@@ -24,7 +24,7 @@ fi
for
FILE
for
FILE
do
do
cat
$FILE
|
cat
"
$FILE
"
|
# convert // comments to /* */
# convert // comments to /* */
sed
's;^\([ ]*\)//\(.*\)$;\1/* \2 */;g'
|
sed
's;^\([ ]*\)//\(.*\)$;\1/* \2 */;g'
|
# mark some comments for special treatment later
# mark some comments for special treatment later
...
@@ -1319,7 +1319,7 @@ int pgindent_func_no_var_fix;\
...
@@ -1319,7 +1319,7 @@ int pgindent_func_no_var_fix;\
# add space after comments that start on tab stops
# add space after comments that start on tab stops
sed
's,;\(/\*.*\*/\)$,; \1,'
|
sed
's,;\(/\*.*\*/\)$,; \1,'
|
# work around #else indenting next line if #ifdef defines variables at top
# work around #else indenting next line if #ifdef defines variables at top
# work around
case
misindenting function
has
no variables defined
# work around misindenting
of
function
with
no variables defined
awk
'
awk
'
{
{
if ($0 ~ "^[ ]*int[ ]*pgindent_func_no_var_fix;")
if ($0 ~ "^[ ]*int[ ]*pgindent_func_no_var_fix;")
...
@@ -1329,6 +1329,7 @@ int pgindent_func_no_var_fix;\
...
@@ -1329,6 +1329,7 @@ int pgindent_func_no_var_fix;\
}
}
else print $0;
else print $0;
}'
|
}'
|
# remove tabs and retab with four spaces
detab
-t8
-qc
|
detab
-t8
-qc
|
entab
-t4
-qc
|
entab
-t4
-qc
|
# move trailing * in function return type
# move trailing * in function return type
...
@@ -1459,7 +1460,7 @@ int pgindent_func_no_var_fix;\
...
@@ -1459,7 +1460,7 @@ int pgindent_func_no_var_fix;\
}
}
else print $0;
else print $0;
}'
|
}'
|
cat
>
/tmp/
$$
&&
cat
/tmp/
$$
>
$FILE
cat
>
/tmp/
$$
&&
cat
/tmp/
$$
>
"
$FILE
"
done
done
# The 'for' loop makes these backup files useless so delete them
# The 'for' loop makes these backup files useless so delete them
...
...
This diff is collapsed.
Click to expand it.
src/tools/pgindent/pgjindent
0 → 100755
+
27
−
0
View file @
3fb36784
#!/bin/sh
trap
"rm -f /tmp/
$$
/tmp/
$$
a"
0 1 2 3 15
entab </dev/null
>
/dev/null
if
[
"
$?
"
-ne
0
]
then
echo
"Go to the src/tools/entab directory and do a 'make' and 'make install'."
>
&2
echo
"This will put the 'entab' command in your path."
>
&2
echo
"Then run
$0
again."
exit
1
fi
astyle
--version
</dev/null
>
/dev/null 2>&1
if
[
"
$?
"
-eq
0
]
then
echo
"You do not appear to have 'astyle' installed on your system."
>
&2
exit
1
fi
for
FILE
do
astyle
--style
=
java
-b
-p
-j
<
"
$FILE
"
>
/tmp/
$$
2>/tmp/
$$
a
if
[
"
$?
"
-ne
0
-o
-s
/tmp/
$$
a
]
then
echo
"
$FILE
"
cat
/tmp/
$$
a
fi
cat
/tmp/
$$
|
entab
-t4
-qc
|
cat
>
/tmp/
$$
a
&&
cat
/tmp/
$$
a
>
"
$FILE
"
done
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment