~ubuntu-branches/ubuntu/gutsy/libpgjava/gutsy

« back to all changes in this revision

Viewing changes to src/tools/pgindent/README

  • Committer: Bazaar Package Importer
  • Author(s): Arnaud Vandyck
  • Date: 2005-04-21 14:25:11 UTC
  • mfrom: (1.2.1 upstream) (2.1.1 warty)
  • Revision ID: james.westby@ubuntu.com-20050421142511-wibh5vc31fkrorx7
Tags: 7.4.7-3
Built with sources...

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
This can format all PostgreSQL *.c and *.h files, but excludes *.y, and *.l
 
2
files.
 
3
 
 
4
Get the list of typedef's included in pgindent by running this on the
 
5
pgsql/bin directory:
 
6
 
 
7
        /src/tools/find_typedef
 
8
 
 
9
and update the list in pgindent.  This requires the binaries have debug 
 
10
symbols.
 
11
 
 
12
From the top directory, run:
 
13
 
 
14
  find . -name '*.[ch]' -type f -print | egrep -v '\+\+|s_lock.h' | xargs -n100 pgindent
 
15
 
 
16
The stock BSD indent has two bugs.  First, a comment after the word 'else'
 
17
causes the rest of the file to be ignored.  Second, it silently ignores
 
18
typedefs after getting the first 100.
 
19
 
 
20
Both problems are worked-around in this script.  We also include a patch
 
21
for the second bug in:
 
22
 
 
23
        /src/tools/pgindent/indent.bsd.patch
 
24
 
 
25
Even with the workaround, installation of the patch produces better
 
26
output.  You can get a patched BSD indent from ftp://ftp.postgresql.org/pub/dev.
 
27
 
 
28
GNU indent, version 2.2.6, has several problems, and is not recommended.
 
29
These bugs become pretty major when you are doing >400k lines of code.
 
30
If you don't believe me, take a directory and make a copy.  Run pgindent
 
31
on the copy using GNU indent, and do a diff -r. You will see what I
 
32
mean. GNU indent does some things better, but mangles too.
 
33
 
 
34
 
 
35
---------------------------------------------------------------------------
 
36
 
 
37
For java, we use astyle, http://astyle.sourceforge.net/, with the
 
38
following options:
 
39
 
 
40
        find . \( -name '*.java' -o -name '*.java.in' \) -print |
 
41
                xargs -n100 pgjindent
 
42
 
 
43
---------------------------------------------------------------------------
 
44
 
 
45
For cpp, we use astyle, http://astyle.sourceforge.net/, with the
 
46
following options:
 
47
 
 
48
        find src/interfaces/libpq++ -name '*.[ch]' -print |
 
49
                xargs -n100 pgcppindent
 
50