Re: [HACKERS] Running pgindent

From: "Thomas G(dot) Lockhart" <lockhart(at)alumni(dot)caltech(dot)edu>
To: Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us>
Cc: hackers(at)postgresql(dot)org
Subject: Re: [HACKERS] Running pgindent
Date: 1998-02-20 03:34:24
Message-ID: 34ECF9C0.70C7BFC2@alumni.caltech.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Bruce Momjian wrote:

> >
> > Bruce Momjian wrote:
> >
> > > I want to run pgindent before the final release. Who has outstanding
> > > patches they are sitting on that would be affected by this? Only places
> > > where we have added non-conforming code would be affected.
> >
> > Ack! Can you make at least three changes to pgindent before doing this?
> >
> > 1) for functions which look like
> > datetime *
> > abstime_datetime(int4 x)
> > {
> > ...
> > do not put a tab (or extra spaces) between "datetime" and "*".
> >
> > For the end of functions which look like
> > ...
> > } /* abstime_datetime() */
> >
> > do not put any tabs (or just one) between the "{" and the comment.
> >
> > Also, some comments get wrapped to the next line, making some ugly sources;
> > perhaps pgindent should not touch comment lines at all? Or at least keep
> > things on the same line, messing with the tabbing only??
>
> Well, that is what indent does. I can try and work around it, but I am
> afraid I will mess it up somehow. Right now, all the stuff is indented
> consistently, and running it again will only make the changed stuff look
> like the rest.
>
> Making a change will change all the code, even the unchanged stuff.
> Also, for comments, it will not change comments that are block-style.
> See the indent manual page and the flags I use for help. Keep in mind I
> use BSD indent, which does not have the bugs in GNU indent.

Well, *&^*^#$! I wasted hours cleaning up some of what I considered damage from
the last pass through.
Would it be possible to pass back through (i.e. pipe indent output to a filter)
and fix at least points (1) and (2)? _That_ would be pretty easy to automate
since the heuristics can be pretty simple:

if (first char is nonwhitespace) && (next word is "*") && (next line starts with
word+paren)
then compress whitespace

else if (first char is "}") && (next word is "/*")
then compress whitespace

else
write line as-is

I'll write the perl if you would be willing to use it?

- Tom

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message The Hermit Hacker 1998-02-20 03:36:58 Re: [HACKERS] atttypmod
Previous Message Thomas G. Lockhart 1998-02-20 03:24:54 Re: [HACKERS] atttypmod