Thread: Re: [GENERAL] pgindented tsearch2 for 7.3.4

Re: [GENERAL] pgindented tsearch2 for 7.3.4

From
Bruce Momjian
Date:
Nigel J. Andrews wrote:
> 
> 
> I never knew running indent was so damn complicated. All three of my
> development systems can not manage it without throughing a fault (I've
> absolutely no idea why indent in the shell works but doesn't in pgindent on
> one).
> 
> Anyway, has anyone pgindented the version of tsearch2 that runs with 7.3.4? If
> so please email it to me. The tar file is tsearch-v2-stable.tar.gz, just for
> clarity and I can supply it if someone volunteers but doesn't have it.

There are about 6 files that can't be run through pgindent, and tsearch2
has one of them:
$ pgindent *.cHope you installed /src/tools/pgindent/indent.bsd.patch.gistidx.cError@186: Unbalanced parensWarning@187:
Extra)Error@314: Unbalanced parensWarning@315: Extra )Error@386: Unbalanced parensWarning@390: Extra )Error@427:
UnbalancedparensWarning@429: Extra )Error@439: Unbalanced parensWarning@440: Extra )Error@670: Unbalanced
parensWarning@671:Extra )Error@682: Unbalanced parensWarning@683: Extra )
 

It is actually this code that is causing it:
       LOOPBYTE(                if ((sign[i] & 0xff) != 0xff)                PG_RETURN_POINTER(retval);       );

With the macro being:
#define LOOPBYTE(a) \        for(i=0;i<SIGLEN;i++) {\                a;\        }

If you ask me, this is just _weird_ code and should not be allowed.

--  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,
Pennsylvania19073
 


Re: [GENERAL] pgindented tsearch2 for 7.3.4

From
Andrew Dunstan
Date:
Bruce Momjian wrote:

>It is actually this code that is causing it:
>
>        LOOPBYTE(
>                 if ((sign[i] & 0xff) != 0xff)
>                 PG_RETURN_POINTER(retval);
>        );
>
>With the macro being:
>
>    #define LOOPBYTE(a) \
>            for(i=0;i<SIGLEN;i++) {\
>                    a;\
>            }
>
>If you ask me, this is just _weird_ code and should not be allowed.
>
>  
>
Amen :-)

This reminds me of the famous "Real Programmers Don't Use Pascal", which 
says:

"If you ignore the fact that it's "structured", even 'C' programming can 
be appreciated by the Real Programmer: after all, there's no type 
checking, variable names are seven (ten? eight?) characters long, and 
the added bonus of the Pointer data type is thrown in—-like having the 
best parts of *FORTRAN * and assembly language in one place (not to 
mention some of the more creative uses for *#DEFINE*)."

:-)


cheers

andrew





Re: [GENERAL] pgindented tsearch2 for 7.3.4

From
"Nigel J. Andrews"
Date:
On Wed, 24 Sep 2003, Bruce Momjian wrote:

> Nigel J. Andrews wrote:
> > 
> > 
> > I never knew running indent was so damn complicated. All three of my
> > development systems can not manage it without throughing a fault
> ...
> 
> There are about 6 files that can't be run through pgindent, and tsearch2
> has one of them:
> 
>     $ pgindent *.c
>     Hope you installed /src/tools/pgindent/indent.bsd.patch.
>     
>     gistidx.c
>     Error@186: Unbalanced parens
>     Warning@187: Extra )
>     Error@314: Unbalanced parens
> ...

It was a far more basic problem than that! I'd have been pleased if I'd got as
far as that. You developers of today don't know you're born. Back in my day we
used to have to get up before noon just to turn the computer on...

Actually, I had a problem in that I only had GNU indent and BSD indent that was
core dumping but it was unpatched, plus I couldn't find the BSD indent source
on the web. Eventually found it, in a linux distribution of all places, and
then I got the above errors, by which time I was quite prepared to not count
those as such.

There are a few macro's defined that make me think of fortran programmers
moving to C.

Anyway Bruce, you'll see the patch eventually generated lower down you inbox.


-- 
Nigel J. Andrews



Re: [GENERAL] pgindented tsearch2 for 7.3.4

From
Bruce Momjian
Date:
Nigel J. Andrews wrote:
> It was a far more basic problem than that! I'd have been pleased if I'd got as
> far as that. You developers of today don't know you're born. Back in my day we
> used to have to get up before noon just to turn the computer on...
> 
> Actually, I had a problem in that I only had GNU indent and BSD indent that was
> core dumping but it was unpatched, plus I couldn't find the BSD indent source
> on the web. Eventually found it, in a linux distribution of all places, and
> then I got the above errors, by which time I was quite prepared to not count
> those as such.
> 
> There are a few macro's defined that make me think of fortran programmers
> moving to C.
> 
> Anyway Bruce, you'll see the patch eventually generated lower down you inbox.

I have put a patched NetBSD indent on our ftp server in /pub/dev so if
anyone wants it, they can download it from there.

--  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,
Pennsylvania19073