Re: [JDBC] driver source code indentation

2001-09-07 Thread Bruce Momjian

 
 On Tue, Sep 04, 2001 at 03:25:33PM -0400, Bruce Momjian wrote:
  I must say it looks very good.
  
  Can people tak a look at that and see if they like it?  I will work on
  astyle to find a format that matches the main code indenting.
 
 I like it. The following results in a closer match to the main
 PostgreSQL code:
 
 $ astyle --style=java -b -p -j foo.java
 
 I'm in agreement with Barry about using spaces instead of tabs. astyle
 does that by default (at least with the java style).

OK, I have created pgjindent in src/tools/pgindent, and ran it over the
current CVS.  It compiles so it should be fine:

ftp://candle.pha.pa.us/pub/postgresql/astyle_jdbc.tar.gz

I am using the same formatting as the PostgreSQL C code, including tab
size.

I will run this before beta. I will also fix the if( to if (.  Any
other issues, please let me know.

-- 
  Bruce Momjian|  http://candle.pha.pa.us
  [EMAIL PROTECTED]   |  (610) 853-3000
  +  If your life is a hard drive, |  830 Blythe Avenue
  +  Christ can be your backup.|  Drexel Hill, Pennsylvania 19026

---(end of broadcast)---
TIP 2: you can get off all lists at once with the unregister command
(send unregister YourEmailAddressHere to [EMAIL PROTECTED])



Re: [JDBC] driver source code indentation

2001-09-06 Thread Barry Lind

Dave,

I agree with you, and it seems that much of the existing jdbc code is 
formated that way.  But before starting a thread on what everybody 
prefers as their java format, let me first ask the question:


Should the jdbc java code use the same formatting as the C code?

If the answer is yes, then we know what the format is going to be.  Else 
we can have what I am sure will be a long religious battle on what style 
would be best for the java code.

My personal vote is to stick with the same format as the C code.  While 
personally I think a different format would be better, I don't think it 
is worth the hassle, and I can live with the existing format.

thanks,
--Barry



Dave Cramer wrote:
 Well, my vote would be for a 2 space indent.
 
 Dave
 On Tue, 2001-09-04 at 16:59, Tom Lane wrote:
 
Barry Lind [EMAIL PROTECTED] writes:

I am OK with the style used for the C code.  However I would like the 
following additional step done for the java code:  replace all tabs with 
spaces.

I disagree with this, because then we are *not* applying the same coding
standards in the backend and in JDBC.  If you want to propose that we
dispense with tabs throughout the system, feel free to propose that ---
but it was shot down last time and likely will be again.

I personally concur that four-space tabs is a horrible standard, and
would much rather see us using eight-space tab stops.  But I haven't
been able to obtain any significant consensus for that view.  Some
developers apparently use editors where a physical tab character needs
to equal the logical indent amount...

  regards, tom lane

---(end of broadcast)---
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/users-lounge/docs/faq.html



 
 
 
 
 ---(end of broadcast)---
 TIP 3: if posting/reading through Usenet, please send an appropriate
 subscribe-nomail command to [EMAIL PROTECTED] so that your
 message can get through to the mailing list cleanly
 
 



---(end of broadcast)---
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/users-lounge/docs/faq.html



Re: [JDBC] driver source code indentation

2001-09-06 Thread Liam Stewart

On Thu, Sep 06, 2001 at 09:51:19AM -0700, Barry Lind wrote:

 Should the jdbc java code use the same formatting as the C code?

IMHO, yes: for consistency and because it is, at the moment, part of the
main package.

Liam

-- 
Liam Stewart :: Red Hat Canada, Ltd. :: [EMAIL PROTECTED]

---(end of broadcast)---
TIP 6: Have you searched our list archives?

http://www.postgresql.org/search.mpl



Re: [JDBC] driver source code indentation

2001-09-06 Thread Rene Pijlman

On Thu, 6 Sep 2001 07:06:29 -0400, you wrote:
Public int foo(int x,int y){
   x=y;
}

Turns into 

Public int foo( int x, int y )
{
   x = y;
}


I find this easier to read.

I agree. This is my preference as well in Java.

Regards,
René Pijlman [EMAIL PROTECTED]

---(end of broadcast)---
TIP 2: you can get off all lists at once with the unregister command
(send unregister YourEmailAddressHere to [EMAIL PROTECTED])



Re: [JDBC] driver source code indentation

2001-09-05 Thread Anders Bengtsson

On Tue, 4 Sep 2001, Bruce Momjian wrote:

 Can people tak a look at that and see if they like it?  I will work on
 astyle to find a format that matches the main code indenting.

 If you like it, I will indent just after we go beta.

Looks great!

I only noticed two things that I sort of disliked. Luckily this seems to
be the only differences between the example and the standard used in the C
sources! :) It's also the only differences between the example and Sun's
standard that I could see.

* Missing a space between if and (.
* Missing a space after a type cast.

/Anders
_
A n d e r s  B e n g t s s o n   [EMAIL PROTECTED]
Stockholm, Sweden


_
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


---(end of broadcast)---
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to [EMAIL PROTECTED] so that your
message can get through to the mailing list cleanly



Re: [JDBC] driver source code indentation

2001-09-05 Thread Dave Cramer

Well, my vote would be for a 2 space indent.

Dave
On Tue, 2001-09-04 at 16:59, Tom Lane wrote:
 Barry Lind [EMAIL PROTECTED] writes:
  I am OK with the style used for the C code.  However I would like the 
  following additional step done for the java code:  replace all tabs with 
  spaces.
 
 I disagree with this, because then we are *not* applying the same coding
 standards in the backend and in JDBC.  If you want to propose that we
 dispense with tabs throughout the system, feel free to propose that ---
 but it was shot down last time and likely will be again.
 
 I personally concur that four-space tabs is a horrible standard, and
 would much rather see us using eight-space tab stops.  But I haven't
 been able to obtain any significant consensus for that view.  Some
 developers apparently use editors where a physical tab character needs
 to equal the logical indent amount...
 
   regards, tom lane
 
 ---(end of broadcast)---
 TIP 5: Have you checked our extensive FAQ?
 
 http://www.postgresql.org/users-lounge/docs/faq.html
 
 




---(end of broadcast)---
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to [EMAIL PROTECTED] so that your
message can get through to the mailing list cleanly



Re: [JDBC] driver source code indentation

2001-09-04 Thread Bruce Momjian

 
 I suggest that the JDBC driver adopt PostgreSQL's indentation standards 
 (see PostgreSQL developers FAQ, question 1). I see that some source
 files have used this standard, but the vast majority do not. We should
 have a standard for consistency and our own sanity if nothing else.

Glad someone brought this up.  A while ago I wrote:

I tried pgindent but it doesn't understand Java and made a mess of it. 
I used astyle with the options:

$ astyle --style=java -j *.java

I have the reformatted jdbc files at:

ftp://candle.pha.pa.us/pub/postgresql/astyle_jdbc.tar.gz

I must say it looks very good.

Can people tak a look at that and see if they like it?  I will work on
astyle to find a format that matches the main code indenting.

If you like it, I will indent just after we go beta.

-- 
  Bruce Momjian|  http://candle.pha.pa.us
  [EMAIL PROTECTED]   |  (610) 853-3000
  +  If your life is a hard drive, |  830 Blythe Avenue
  +  Christ can be your backup.|  Drexel Hill, Pennsylvania 19026

---(end of broadcast)---
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to [EMAIL PROTECTED] so that your
message can get through to the mailing list cleanly



Re: [JDBC] driver source code indentation

2001-09-04 Thread Barry Lind

I agree that this is needed.  In fact I know Bruce wants to do something 
in this area.  In fact he sent out a few months ago a sample of the code 
after it had been cleaned up by some tool.  At the time no one seemed to 
be very interested.  Going forward for 7.2 I think now is the time that 
something should be done.  We need the equivalent of pgindent for java.

I am OK with the style used for the C code.  However I would like the 
following additional step done for the java code:  replace all tabs with 
spaces.

I often end up viewing files in editors/viewers other than the one I 
normally code with.  Having to worry about getting the tab settings 
correct so that the code is readable is a pain (and sometimes not 
possible depending on the editor).  I have personally adopted in my java 
IDE of choice (JBuilder) to have the IDE automatically replace tabs with 
spaces for this reason.

thanks,
--Barry


Liam Stewart wrote:
 I suggest that the JDBC driver adopt PostgreSQL's indentation standards 
 (see PostgreSQL developers FAQ, question 1). I see that some source
 files have used this standard, but the vast majority do not. We should
 have a standard for consistency and our own sanity if nothing else.
 
 Liam
 
 



---(end of broadcast)---
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/users-lounge/docs/faq.html



Re: [JDBC] driver source code indentation

2001-09-04 Thread Liam Stewart


On Tue, Sep 04, 2001 at 03:25:33PM -0400, Bruce Momjian wrote:
   I must say it looks very good.
 
 Can people tak a look at that and see if they like it?  I will work on
 astyle to find a format that matches the main code indenting.

I like it. The following results in a closer match to the main
PostgreSQL code:

$ astyle --style=java -b -p -j foo.java

I'm in agreement with Barry about using spaces instead of tabs. astyle
does that by default (at least with the java style).

 If you like it, I will indent just after we go beta.

Yes, please.

Liam

-- 
Liam Stewart :: Red Hat Canada, Ltd. :: [EMAIL PROTECTED]

---(end of broadcast)---
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/users-lounge/docs/faq.html



Re: [JDBC] driver source code indentation

2001-09-04 Thread Ross J. Reedstrom

On Tue, Sep 04, 2001 at 12:43:21PM -0700, Barry Lind wrote:
snip
  
 I am OK with the style used for the C code.  However I would like the 
 following additional step done for the java code:  replace all tabs with 
 spaces.


Oh noo! Barry's stumbled over the tripwire of the Tab/Spaces flamewar trap!
Everyone duck!

More seriously, this was actually voted on some time ago. (Check the HACKERS
archives) Since the JDBC source is well segregated from the rest of the
tree, it can have a different style, but if you want to adopt the 'standard'
style, I'd suggest going all the way. 

In the other hand, since you'll need to use a different tool to maintain the
style (unless Bruce update his pgident to handle java ...) it'll never be
completely the same, anyway. I'd image that the core developers will go with
whatever the JDBC maintainers want.


Ross

---(end of broadcast)---
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/users-lounge/docs/faq.html



Re: [JDBC] driver source code indentation

2001-09-04 Thread Tom Lane

Barry Lind [EMAIL PROTECTED] writes:
 I am OK with the style used for the C code.  However I would like the 
 following additional step done for the java code:  replace all tabs with 
 spaces.

I disagree with this, because then we are *not* applying the same coding
standards in the backend and in JDBC.  If you want to propose that we
dispense with tabs throughout the system, feel free to propose that ---
but it was shot down last time and likely will be again.

I personally concur that four-space tabs is a horrible standard, and
would much rather see us using eight-space tab stops.  But I haven't
been able to obtain any significant consensus for that view.  Some
developers apparently use editors where a physical tab character needs
to equal the logical indent amount...

regards, tom lane

---(end of broadcast)---
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/users-lounge/docs/faq.html