Luke Lonergan wrote:
> Patch to update pgindent with new symbols and fix a bug in an awk section
> (extra \\ in front of a ')').

Yea, that '\' wasn't needed.  I applied the following patch to use //
instead of "" for patterns, and removed the unneeded backslash.

I will update the typedefs in a separate commit.

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073
Index: src/tools/pgindent/pgindent
===================================================================
RCS file: /cvsroot/pgsql/src/tools/pgindent/pgindent,v
retrieving revision 1.73
diff -c -c -r1.73 pgindent
*** src/tools/pgindent/pgindent 7 Oct 2004 14:15:50 -0000       1.73
--- src/tools/pgindent/pgindent 28 Jun 2005 23:12:07 -0000
***************
*** 50,62 ****
                        if (NR >= 2)
                                print line1;
                        if (NR >= 2 &&
!                           line2 ~ "^{[        ]*$" &&
!                           line1 !~ "^struct" &&
!                           line1 !~ "^enum" &&
!                           line1 !~ "^typedef" &&
!                           line1 !~ "^extern[  ][      ]*\"C\"" &&
!                           line1 !~ "=" &&
!                           line1 ~ "\)")
                                print "int      pgindent_func_no_var_fix;";
                        line1 = line2;
                }
--- 50,62 ----
                        if (NR >= 2)
                                print line1;
                        if (NR >= 2 &&
!                           line2 ~ /^{[        ]*$/ &&
!                           line1 !~ /^struct/ &&
!                           line1 !~ /^enum/ &&
!                           line1 !~ /^typedef/ &&
!                           line1 !~ /^extern[  ][      ]*"C"/ &&
!                           line1 !~ /=/ &&
!                           line1 ~ /)/)
                                print "int      pgindent_func_no_var_fix;";
                        line1 = line2;
                }
***************
*** 70,77 ****
                        line2 = $0;
                        if (skips > 0)
                                skips--;
!                       if (line1 ~ "^#ifdef[   ]*__cplusplus" &&
!                           line2 ~ "^extern[   ]*\"C\"[        ]*$")
                        {
                                print line1;
                                print line2;
--- 70,77 ----
                        line2 = $0;
                        if (skips > 0)
                                skips--;
!                       if (line1 ~ /^#ifdef[   ]*__cplusplus/ &&
!                           line2 ~ /^extern[   ]*"C"[  ]*$/)
                        {
                                print line1;
                                print line2;
***************
*** 81,88 ****
                                line2 = "";
                                skips = 2;
                        }
!                       else if (line1 ~ "^#ifdef[      ]*__cplusplus" &&
!                           line2 ~ "^}[        ]*$")
                        {
                                print line1;
                                print "/* Close extern \"C\" */";
--- 81,88 ----
                                line2 = "";
                                skips = 2;
                        }
!                       else if (line1 ~ /^#ifdef[      ]*__cplusplus/ &&
!                           line2 ~ /^}[        ]*$/)
                        {
                                print line1;
                                print "/* Close extern \"C\" */";
***************
*** 1732,1738 ****
  # work around misindenting of function with no variables defined
        awk '
        {
!               if ($0 ~ "^[    ]*int[  ]*pgindent_func_no_var_fix;")
                {
                        if (getline && $0 != "")
                                print $0;
--- 1732,1738 ----
  # work around misindenting of function with no variables defined
        awk '
        {
!               if ($0 ~ /^[    ]*int[  ]*pgindent_func_no_var_fix;/)
                {
                        if (getline && $0 != "")
                                print $0;
***************
*** 1751,1759 ****
  #                     line3 = $0;  
  #                     if (skips > 0)
  #                             skips--;
! #                     if (line1 ~ "           *{$" &&
! #                         line2 ~ "           *[^;{}]*;$" &&
! #                         line3 ~ "           *}$")
  #                     {
  #                             print line2;
  #                             line2 = "";
--- 1751,1759 ----
  #                     line3 = $0;  
  #                     if (skips > 0)
  #                             skips--;
! #                     if (line1 ~ /           *{$/ &&
! #                         line2 ~ /           *[^;{}]*;$/ &&
! #                         line3 ~ /           *}$/)
  #                     {
  #                             print line2;
  #                             line2 = "";
***************
*** 1778,1786 ****
                        line3 = $0;  
                        if (skips > 0)
                                skips--;
!                       if (line1 ~ "   *{$" &&
!                           line2 ~ "^$" &&
!                           line3 ~ "           */\\*$")
                        {
                                print line1;
                                print line3;
--- 1778,1786 ----
                        line3 = $0;  
                        if (skips > 0)
                                skips--;
!                       if (line1 ~ /   *{$/ &&
!                           line2 ~ /^$/ &&
!                           line3 ~ /           *\/\*$/)
                        {
                                print line1;
                                print line3;
***************
*** 1819,1826 ****
                        line2 = $0;
                        if (skips > 0)
                                skips--;
!                       if (line1 ~ "^$" &&
!                           line2 ~ "^#endif")
                        {
                                print line2;
                                line2 = "";
--- 1819,1826 ----
                        line2 = $0;
                        if (skips > 0)
                                skips--;
!                       if (line1 ~ /^$/ &&
!                           line2 ~ /^#endif/)
                        {
                                print line2;
                                line2 = "";
***************
*** 1844,1850 ****
                        line1 = line2;
                }
                END {
!                       if (NR >= 1 && line2 ~ "^#endif")
                                printf "\n";
                        print line1;
                }' |
--- 1844,1850 ----
                        line1 = line2;
                }
                END {
!                       if (NR >= 1 && line2 ~ /^#endif/)
                                printf "\n";
                        print line1;
                }' |
***************
*** 1853,1868 ****
  #  like real functions.
        awk '   BEGIN   {paren_level = 0}  
        {
!               if ($0 ~ /^[a-zA-Z_][a-zA-Z_0-9]*[^\(]*$/)
                {
                        saved_len = 0;
                        saved_lines[++saved_len] = $0;
                        if ((getline saved_lines[++saved_len]) == 0)
                                print saved_lines[1];
                        else
!                       if (saved_lines[saved_len] !~ 
/^[a-zA-Z_][a-zA-Z_0-9]*\(/ ||
!                           saved_lines[saved_len] ~  
/^[a-zA-Z_][a-zA-Z_0-9]*\(.*\)$/ ||
!                           saved_lines[saved_len] ~  
/^[a-zA-Z_][a-zA-Z_0-9]*\(.*\);$/)
                        {
                                print saved_lines[1];
                                print saved_lines[2];
--- 1853,1868 ----
  #  like real functions.
        awk '   BEGIN   {paren_level = 0}  
        {
!               if ($0 ~ /^[a-zA-Z_][a-zA-Z_0-9]*[^(]*$/)
                {
                        saved_len = 0;
                        saved_lines[++saved_len] = $0;
                        if ((getline saved_lines[++saved_len]) == 0)
                                print saved_lines[1];
                        else
!                       if (saved_lines[saved_len] !~ 
/^[a-zA-Z_][a-zA-Z_0-9]*(/ ||
!                           saved_lines[saved_len] ~  
/^[a-zA-Z_][a-zA-Z_0-9]*(.*)$/ ||
!                           saved_lines[saved_len] ~  
/^[a-zA-Z_][a-zA-Z_0-9]*(.*);$/)
                        {
                                print saved_lines[1];
                                print saved_lines[2];
***************
*** 1879,1885 ****
                                }
                                for (i=1; i <= saved_len; i++)
                                {
!                                       if (i == 1 && saved_lines[saved_len] ~ 
/\);$/)
                                        {
                                                printf "%s", saved_lines[i];
                                                if (substr(saved_lines[i], 
length(saved_lines[i]),1) != "*")
--- 1879,1885 ----
                                }
                                for (i=1; i <= saved_len; i++)
                                {
!                                       if (i == 1 && saved_lines[saved_len] ~ 
/);$/)
                                        {
                                                printf "%s", saved_lines[i];
                                                if (substr(saved_lines[i], 
length(saved_lines[i]),1) != "*")
---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

Reply via email to