Discussion:
X.CPP's HTML to TXT converter in Attachmnts().
(too old to reply)
Jeff_Relf
2005-01-12 16:08:11 UTC
Permalink
Re: X.CPP's HTML to TXT converter in Attachmnts(),

I just fixed a buffer overflow problem
caused by posts that begin like this
( Leave it to unix deviants to intentionally post malformed HTML ):
<html><input type crash></html> news:slrncu9h9r.gve.The-Central-***@linux.client.comcast.net

The problem and the fix are described in the code below
( from http://www.Cotse.NET/users/jeffrelf/X.CPP ).

// BB points to the first line ( not char ), EE to one beyond the last line.
// Mode == 1 if BB points to the raw header rather than just the body.

Attachmnts ( int Mode, LnA BB, LnA EE ) { LnA TT = 0, PP = BB ; LnP P ;
// if ( Mode == 2 ) { while ( ++ PP < EE ) __Fm return ; }
if ( Mode == 1 ) {
while ( ++ PP < EE && * * PP ) __Fm BB = PP ; _Fm(("")) }
if ( PP + 1 >= EE ) return ;
if ( EqiN( PP [ 1 ], "<HTML>", 6 ) ) {
while ( ++ PP < EE ) { LnP T, B = * PP, P = B - 1 ; char C = 1 ;
while ( C && * ( T = P + 1 ) ) {
while ( ( C = * ++ P ) && C != '<' ); int Tag = C == '<' && P [ 1 ];
if ( P > T ) { * P = 0 ; P = T - 1 ; C = 1 ;
while ( C && * ( T = P + 1 ) ) {
while ( ( C = * ++ P ) && C != '&' );
if ( ! C || ! P [ 1 ] ) B += Str( B, "%s", T );
else { * P = 0 ; C = * ++ P ; char CC ;
if ( C == '#' ) { CC = atoi( ++ P );
while ( ( C = * ++ P ) && isdigit( C ) ); }
else {
if ( EqiN( P, "lt", 2 ) ) CC = '<' ;
else if ( EqiN( P, "gt", 2 ) ) CC = '>' ; else CC = '¿' ;
while ( ( C = * ++ P ) && C != ';' ); }

// By only adding a character when the &#32; type snytax
// is found, as I do here, a buffer overflow is avoided.
// Before, it was adding a char to all lines, regardless,
// which only worked for HTML were tags and such
// are always removed from each line, leaving room
// ( e.g. HTML-only e-mails from Hotmail.COM and vendors ).

B += Str( B, "%s%c", T, CC ); } } }
if ( Tag ) while ( ( C = * ++ P ) && C != '>' ); }
if ( B == * PP ) continue ; __Fm } return ; }
if ( EqN( PP [ 1 ], "-----BEGIN PGP", 14 ) ) BB = PP += 3 ;
Loop( 7 ) if ( ++ PP >= EE || EqN( * PP ,"--", 2 ) ) break; int Body = 0 ;
if ( PP < EE && EqN( * PP ,"--", 2 ) && EqiN( PP [ 1 ],"Content-", 8 ) ) {
TT = PP ;
while ( ++ PP < EE && * * PP )
if ( EqiN( * PP,"Content-Type: text/plain", 24 ) ) Body = 1 ;
if ( ! Body ) PP = TT ; else {
while ( ++ PP < EE && ! ( EqN( * PP,"--", 2 )
&& EqiN( PP [ 1 ],"Content-", 8 ) ) ) __Fm if ( PP >= EE ) return ; }
LOOP { TT = PP ; LnP Nam = 0 ; const int NamMax = 300 ;
int TTL = strlen ( * TT ), B64 = 0, Text = 0, HTML = 0 ; LnP B = 0 ;
while ( ++ PP < EE && * * PP ) { P = * PP ;
int _Text, Type = EqiN( P,"Content-Type:", 13 );
if ( Type ) _Text = EqiN( P += 13," Text", 5 ), P += 5 ;
if ( _Text && ( EqiN( P,"/HTML", 5 ) || EqiN( P,"/x-vcard", 8 ) )
|| EqiN( P,"Content-ID:", 11 ) ) { HTML = 1 ; continue ; }
if ( EqiN( P,"Content-Transfer-Encoding: Base64", 33 ) ) {
B64 = 1 ; continue ; }
if ( Type && ( ( B = Find ( '"', P, 70 ) )
|| ( B = Find ( '"', PP [ 1 ], 70 ) ) )
&& ( P = Find ( '"', ++ B, NamMax ) ) ) * P = 0, Text = _Text ; }
if ( PP + 1 >= EE ) return ; int Att = B64 && B ; FILE * fp ;
if ( Att ) { LnP P = B, T, SS = "\\/:", S = SS - 1 ;
while ( * ++ S )
while ( T = strchr ( P, * S ) ) * T = '_', P = ++ T ;
fp = fopen ( Nam = P, "wb" ); Att = fp != 0 ;
if ( ! Att )
_Fm ( ( "_ %s _ Can't be Created.", Nam ) ) }
if ( ! Att ) { PP -- ;
while ( ++ PP < EE && ! EqN( * PP, * TT, TTL ) )
if ( ! HTML ) _Fm ( ( "%s", * PP ) )
if ( PP + 1 >= EE ) return ;
if ( EqiN( PP [ 1 ],"Content-", 8 ) ) continue;
Loop( 7 ) if ( ++ PP >= EE || EqN( * PP ,"--", 2 ) ) break;
if ( PP + 1 < EE && EqN( * PP ,"--", 2 )
&& EqiN( PP [ 1 ],"Content-", 8 ) ) continue; return ; }
P = Buff - 1 ; uint X, By, Cnt ; X = By = Cnt = 0 ; int WNCR = 1 ;
LOOP { LnP S = * ++ PP ;
if ( ( rv = P - Buff + 1 ) > Buff_Room - 200 )
fwrite( Buff, 1, rv, fp ), P = Buff - 1 ;
if ( PP + 1 >= EE ) return ;
if ( EqN( * PP, * TT, TTL ) ) {
if ( EqiN( PP [ 1 ],"Content-", 8 ) ) break ;
Loop( 7 ) if ( ++ PP >= EE || EqN( * PP ,"--", 2 ) ) break ;
break ; } S -- ;
LOOP { if ( ! * ++ S ) break ; X <<= 6 ; X |= Tab [ * S ];
if ( * S != '=' ) By ++ ; if ( ++ Cnt < 4 ) continue;
LnP XP = ( ( LnP ) & X ) + 3 ;
Loop( By * 6 / 8 ) { char C = * -- XP ;
if ( ! Text || C != 13 || WNCR ) * ++ P = C ; WNCR = C != 13 ; }
X = By = Cnt = 0 ; } }
if ( Text ) * ++ P = 13, * ++ P = 10 ;
fwrite( Buff, 1, P - Buff + 1, fp ); fclose( fp );
_Fm ( ( " Created: _ %s _", Nam ) ) } return ; }
PP = BB ; int Pgp = 0 ; // Ln.P - Ln.B I_Cook
while ( ++ PP < EE ) {
if ( EqN( * PP, "-----BEGIN PGP", 14 ) ) { Pgp = 1 ; continue ; }
if ( Pgp ) {
if ( EqN( * PP, "-----END PGP", 12 ) ) Pgp = 0 ; continue ; }
__Fm } }
.+.+.+.+.+.+

#define LOOP while ( 1 )
#define Loop( N ) int J = - 1, LLL = N ; while ( ++ J < LLL )
#define Eq ! strcmp
#define Eqi ! stricmp
#define EqN ! strncmp
#define EqiN ! strnicmp
#define Re_Buff( N ) free( Buff ), \
Buff = ( LnP ) malloc( Buff_Room = ER ( N, est_Buff ) )
#define _Fm( X ) { int p = PP - Ln.B, e = EE - Ln.B, t = TT - Ln.B ; \
Fm X ; PP = Ln.B + p ; EE = Ln.B + e ; TT = Ln.B + e ; }
#define __Fm if ( ! ( * ( P = * PP ) == '>' \
&& ( P [ 1 ] == '>' || P [ 2 ] == '>' ) ) ) _Fm ( ( "%s", P ) )

typedef unsigned char uchar ;
typedef char * LnP ; typedef LnP * LnA ; struct LnT { LnA B, P, E ; };

const int est_Buff = 10240 ;
int Buff_Room ;

uchar Tab [ 'z' + 1 ], _Tab [ 64 ];

__int64 ER ( __int64 X, __int64 Y ) { return X > Y ? X : Y ; }
__int64 er ( __int64 X, __int64 Y ) { return X < Y ? X : Y ; }

LnP Find ( char C, LnP B, int N ) {
if ( N -- <= 0 ) return 0 ; LnP P = B - 1 ;
LOOP
if ( * ++ P == C ) return P ;
else if ( P - B >= N || ! * P ) return 0 ; }
.+.+.+.+.+.+

Re_Buff( 0 );
{ LnP CC = "Aa0+/"; int X = -1 ;
Loop( strlen ( CC ) ) {
int L = J > 2 ? 1 : J == 2 ? 10 : 26 ; char C = CC[ J ] - 1 ;
Loop( L ) Tab [ _Tab[ X ] = ++ C ] = ++ X ; } }
General Protection Fault
2005-01-12 16:47:13 UTC
Permalink
Post by Jeff_Relf
Attachmnts ( int Mode, LnA BB, LnA EE ) { LnA TT = 0, PP = BB ; LnP P ;
// if ( Mode == 2 ) { while ( ++ PP < EE ) __Fm return ; }
if ( Mode == 1 ) {
while ( ++ PP < EE && * * PP ) __Fm BB = PP ; _Fm(("")) }
if ( PP + 1 >= EE ) return ;
<snip>

Oh my God. What does lint(1) think of your code?
--
FreeBSD 4.8-RELEASE i386
10:40AM up 50 days, 16:02, 0 users, load averages: 0.00, 0.01, 0.00
The Ghost In The Machine
2005-01-12 21:11:35 UTC
Permalink
In comp.os.linux.advocacy, General Protection Fault
<***@braids.ertw.com>
wrote
on Wed, 12 Jan 2005 16:47:13 GMT
Post by General Protection Fault
Post by Jeff_Relf
Attachmnts ( int Mode, LnA BB, LnA EE ) { LnA TT = 0, PP = BB ; LnP P ;
// if ( Mode == 2 ) { while ( ++ PP < EE ) __Fm return ; }
if ( Mode == 1 ) {
while ( ++ PP < EE && * * PP ) __Fm BB = PP ; _Fm(("")) }
if ( PP + 1 >= EE ) return ;
<snip>
Oh my God. What does lint(1) think of your code?
Lint doesn't do C++. Maybe lint++.
--
#191, ***@earthlink.net
It's still legal to go .sigless.
Hamilcar Barca
2005-01-12 21:28:30 UTC
Permalink
Post by The Ghost In The Machine
Lint doesn't do C++. Maybe lint++.
Lint++ can't handle Relf--.
--
"With open source, there is no way to make more software."
-- Chris Sharp. Director, Platform Strategy. Microsoft Asia-Pacific.
General Protection Fault
2005-01-13 02:47:29 UTC
Permalink
Post by The Ghost In The Machine
In comp.os.linux.advocacy, General Protection Fault
on Wed, 12 Jan 2005 16:47:13 GMT
Post by General Protection Fault
Post by Jeff_Relf
Attachmnts ( int Mode, LnA BB, LnA EE ) { LnA TT = 0, PP = BB ; LnP P ;
// if ( Mode == 2 ) { while ( ++ PP < EE ) __Fm return ; }
if ( Mode == 1 ) {
while ( ++ PP < EE && * * PP ) __Fm BB = PP ; _Fm(("")) }
if ( PP + 1 >= EE ) return ;
<snip>
Oh my God. What does lint(1) think of your code?
Lint doesn't do C++. Maybe lint++.
I'm sorry, I didn't realize that was C++. It's really hard to tell.
--
FreeBSD 4.8-RELEASE i386
8:45PM up 51 days, 2:07, 1 user, load averages: 0.05, 0.03, 0.01
The Ghost In The Machine
2005-01-13 21:01:42 UTC
Permalink
In comp.os.linux.advocacy, General Protection Fault
<***@braids.ertw.com>
wrote
on Thu, 13 Jan 2005 02:47:29 GMT
Post by General Protection Fault
Post by The Ghost In The Machine
In comp.os.linux.advocacy, General Protection Fault
on Wed, 12 Jan 2005 16:47:13 GMT
Post by General Protection Fault
Post by Jeff_Relf
Attachmnts ( int Mode, LnA BB, LnA EE ) { LnA TT = 0, PP = BB ; LnP P ;
// if ( Mode == 2 ) { while ( ++ PP < EE ) __Fm return ; }
if ( Mode == 1 ) {
while ( ++ PP < EE && * * PP ) __Fm BB = PP ; _Fm(("")) }
if ( PP + 1 >= EE ) return ;
<snip>
Oh my God. What does lint(1) think of your code?
Lint doesn't do C++. Maybe lint++.
I'm sorry, I didn't realize that was C++. It's really hard to tell.
You noticed. :-)

The only way I can tell is by the occasional use of constructs
such as

Direct_Draw->CreateSurface(...)

and the use of a reference (&) in the declaration of Move().

So technically it's C++. Practically, it's mostly gibberish. :-P :-)
--
#191, ***@earthlink.net
It's still legal to go .sigless.
General Protection Fault
2005-01-13 21:18:33 UTC
Permalink
Post by The Ghost In The Machine
In comp.os.linux.advocacy, General Protection Fault
You noticed. :-)
The only way I can tell is by the occasional use of constructs
such as
Direct_Draw->CreateSurface(...)
and the use of a reference (&) in the declaration of Move().
So technically it's C++. Practically, it's mostly gibberish. :-P :-)
I thought Relf might have recompiled his compiler to #define -> as some
sort of LOOP variation.
--
FreeBSD 4.8-RELEASE i386
3:15PM up 51 days, 20:37, 1 user, load averages: 0.09, 0.02, 0.01
mlw
2005-01-13 21:38:03 UTC
Permalink
Post by The Ghost In The Machine
In comp.os.linux.advocacy, General Protection Fault
on Thu, 13 Jan 2005 02:47:29 GMT
Post by General Protection Fault
Post by The Ghost In The Machine
In comp.os.linux.advocacy, General Protection Fault
on Wed, 12 Jan 2005 16:47:13 GMT
Post by General Protection Fault
Post by Jeff_Relf
Attachmnts ( int Mode, LnA BB, LnA EE ) { LnA TT = 0, PP = BB ; LnP P ;
// if ( Mode == 2 ) { while ( ++ PP < EE ) __Fm return ; }
if ( Mode == 1 ) {
while ( ++ PP < EE && * * PP ) __Fm BB = PP ; _Fm(("")) }
if ( PP + 1 >= EE ) return ;
<snip>
Oh my God. What does lint(1) think of your code?
Lint doesn't do C++. Maybe lint++.
I'm sorry, I didn't realize that was C++. It's really hard to tell.
You noticed. :-)
The only way I can tell is by the occasional use of constructs
such as
Direct_Draw->CreateSurface(...)
You can do this in C as well:

typedef stupid_idiotic_attempt_to_be_CPP_on_C
{
void (*DirectDraw)(...)
}STUPIDST;
Post by The Ghost In The Machine
and the use of a reference (&) in the declaration of Move().
I didn't see that one.
Post by The Ghost In The Machine
So technically it's C++. Practically, it's mostly gibberish. :-P :-)
Only "mostly gibberish?" aren't you being a tad generous?
The Ghost In The Machine
2005-01-14 20:01:47 UTC
Permalink
In comp.os.linux.advocacy, mlw
<***@nospam.no>
wrote
on Thu, 13 Jan 2005 16:38:03 -0500
Post by mlw
Post by The Ghost In The Machine
In comp.os.linux.advocacy, General Protection Fault
on Thu, 13 Jan 2005 02:47:29 GMT
Post by General Protection Fault
Post by The Ghost In The Machine
In comp.os.linux.advocacy, General Protection Fault
on Wed, 12 Jan 2005 16:47:13 GMT
Post by General Protection Fault
Post by Jeff_Relf
Attachmnts ( int Mode, LnA BB, LnA EE ) { LnA TT = 0, PP = BB ; LnP P ;
// if ( Mode == 2 ) { while ( ++ PP < EE ) __Fm return ; }
if ( Mode == 1 ) {
while ( ++ PP < EE && * * PP ) __Fm BB = PP ; _Fm(("")) }
if ( PP + 1 >= EE ) return ;
<snip>
Oh my God. What does lint(1) think of your code?
Lint doesn't do C++. Maybe lint++.
I'm sorry, I didn't realize that was C++. It's really hard to tell.
You noticed. :-)
The only way I can tell is by the occasional use of constructs
such as
Direct_Draw->CreateSurface(...)
typedef stupid_idiotic_attempt_to_be_CPP_on_C
{
void (*DirectDraw)(...)
}STUPIDST;
Yes, with some mods that would work. I'd have to look up the
VC++ vtbl format. (Why anyone would actually want to do such
things is best argued elsewhere. :-) )
Post by mlw
Post by The Ghost In The Machine
and the use of a reference (&) in the declaration of Move().
I didn't see that one.
I had to look for it, and it took some doing. It's about the
only example of an argument formal passed by reference I
could find.
Post by mlw
Post by The Ghost In The Machine
So technically it's C++. Practically, it's mostly gibberish. :-P :-)
Only "mostly gibberish?" aren't you being a tad generous?
Well, VC++ understands it. :-) I can see some patterns in parts
of it.
--
#191, ***@earthlink.net
It's still legal to go .sigless.
Jeff_Relf
2005-01-13 10:27:14 UTC
Permalink
Hi General_Protection, Re: The code I showed, You asked me: <<
What does lint(1) think of your code ? >>

What do I think of lint ?
Not much,
in all my 23 years of coding for a living I never saw a need for it.
General Protection Fault
2005-01-13 15:13:33 UTC
Permalink
Post by Jeff_Relf
Hi General_Protection, Re: The code I showed, You asked me: <<
What does lint(1) think of your code ? >>
What do I think of lint ?
Not much,
in all my 23 years of coding for a living I never saw a need for it.
And there, folks, is all you need to know about Jeff Relf.
--
FreeBSD 4.8-RELEASE i386
9:10AM up 51 days, 14:32, 1 user, load averages: 0.05, 0.01, 0.00
chrisv
2005-01-13 16:52:22 UTC
Permalink
Post by General Protection Fault
Post by Jeff_Relf
Hi General_Protection, Re: The code I showed, You asked me: <<
What does lint(1) think of your code ? >>
What do I think of lint ?
Not much,
in all my 23 years of coding for a living I never saw a need for it.
And there, folks, is all you need to know about Jeff Relf.
That he's an idiot? This is news?
Labrat
2005-01-12 17:27:41 UTC
Permalink
Jeff_Relf voiced his/her/it's humble opinion in comp.os.linux.advocacy
Post by Jeff_Relf
Re: X.CPP's HTML to TXT converter in Attachmnts(),
I just fixed a buffer overflow problem
<snip> <snip> <snippity> <snip>
Post by Jeff_Relf
Loop( L ) Tab [ _Tab[ X ] = ++ C ] = ++ X ; } }
Code junkie ... coke junkie.

Somewhere in the middle lies the crux of the biscuit.

GTAFFAARD (Go Take A Flying Fuck At A Rolling Doughnut)
--
Later......

Labrat...... |:^{)


A recent convert to the flightless bird.
Jeff_Relf
2005-01-13 07:35:16 UTC
Permalink
Hi Labrat, Re: This code of mine that you quoted: <<
Loop( L ) Tab [ _Tab[ X ] = ++ C ] = ++ X ; >>

You told me: << Code junkie ... coke junkie.
Somewhere in the middle lies the crux of the biscuit.
GTAFFAARD ( Go Take A Flying Fuck At A Rolling Doughnut ) >>

Oh you must be complaining about the lack of comments, is this better ? :
// A_63 is a sparsely populated table
// to convert from printable ASCII characters ( Base64 )
// to integers between zero and 63. _63_A goes the other way.
uchar A_63 [ 'z' + 1 ], _63_A [ 64 ];
...
LnP CC = "Aa0+/"; int X = -1 ;
Loop( strlen ( CC ) ) {
int L = J > 2 ? 1 : J == 2 ? 10 : 26 ; char C = CC [ J ] - 1 ;
Loop( L ) A_63 [ _63_A [ X ] = ++ C ] = ++ X ; }

See there, you helped me comment my code,
Now anyone and everyone can understand it.
mlw
2005-01-12 20:31:01 UTC
Permalink
Jeff_Relf wrote:
[snip]

Dude, that code is unreadable and you should be ashamed of it.
General Protection Fault
2005-01-12 20:19:54 UTC
Permalink
Post by mlw
[snip]
Dude, that code is unreadable and you should be ashamed of it.
You know what the answer's going to be, right?

"You can't read C++ code."
--
FreeBSD 4.8-RELEASE i386
2:15PM up 50 days, 19:37, 0 users, load averages: 0.00, 0.00, 0.00
The Ghost In The Machine
2005-01-12 22:01:35 UTC
Permalink
In comp.os.linux.advocacy, General Protection Fault
<***@braids.ertw.com>
wrote
on Wed, 12 Jan 2005 20:19:54 GMT
Post by General Protection Fault
Post by mlw
[snip]
Dude, that code is unreadable and you should be ashamed of it.
You know what the answer's going to be, right?
"You can't read C++ code."
Neither can my compiler (g++). :-) There's a few technical
glitches in there.
--
#191, ***@earthlink.net
It's still legal to go .sigless.
Peter Jensen
2005-01-12 23:21:56 UTC
Permalink
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Post by General Protection Fault
Post by mlw
Dude, that code is unreadable and you should be ashamed of it.
You know what the answer's going to be, right?
"You can't read C++ code."
Neither can my compiler (g++). :-) There's a few technical glitches
in there.
Well, he does disable some 35 warnings, just to get it to compile
"cleanly". Personally I like to treat warnings as errors because they
may just be that, and I even compile with -Wall to make sure I catch as
many as possible. I'd like to use -Weffc++ more as well, but
unfortunately gcc for some reason becomes very verbose with warnings
when the STL is used. Personally I don't think it makes sense to report
errors and warnings from any of the system headers, but it doesn't look
like the gcc developers are interested in fixing that shortcoming. The
manual says to just grep -v around it, but they could at least have
shown how! A pity, because -Weffc++ seems very useful to me.

If anyone could tell me how to work around this, preferably in a way
that can be used with automake, then I would be eternally grateful!

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)

iD8DBQFB5bESd1ZThqotgfgRAhOfAJwOnE3Ivw9SU+WeBiq+rnLFbsh/DACcCsWQ
y1X01i9hil8EoPFlJltQY0Y=
=wEmS
-----END PGP SIGNATURE-----
--
PeKaJe

Some programming languages manage to absorb change, but withstand progress.
-- Epigrams in Programming, ACM SIGPLAN Sept. 1982
The Ghost In The Machine
2005-01-13 02:00:15 UTC
Permalink
In comp.os.linux.advocacy, Peter Jensen
<***@pekajemaps.homeip.net>
wrote
on 12 Jan 2005 23:21:56 GMT
[other people have said, though I do agree with the following sentiment!]
Post by Peter Jensen
Post by General Protection Fault
Post by mlw
Dude, that code is unreadable and you should be ashamed of it.
You know what the answer's going to be, right?
"You can't read C++ code."
Neither can my compiler (g++). :-) There's a few technical glitches
in there.
Well, he does disable some 35 warnings, just to get it to compile
"cleanly". Personally I like to treat warnings as errors because they
may just be that, and I even compile with -Wall to make sure I catch as
many as possible.
There's also the -Wsynth option. Not sure how useful that is, as
I've forgotten its exact purpose, but I don't think -Wall includes
-Wsynth, and it's fairly esoteric.
Post by Peter Jensen
I'd like to use -Weffc++ more as well, but
unfortunately gcc for some reason becomes very verbose with warnings
when the STL is used.
Have you tried using STL with VC++? That gets quite verbose too.
I'm wondering which one generates more diagnostics... :-)

I'm not familiar with -Weffc++; I'll have to play with it. Sounds
like it might be useful, verbose, or both.
Post by Peter Jensen
Personally I don't think it makes sense to report
errors and warnings from any of the system headers, but it doesn't look
like the gcc developers are interested in fixing that shortcoming. The
manual says to just grep -v around it, but they could at least have
shown how! A pity, because -Weffc++ seems very useful to me.
Sounds like a feature instead of a bug. Then again, you might have
to complain to the developers of libc and/or Linux to fix that. :-)
Post by Peter Jensen
If anyone could tell me how to work around this, preferably in a way
that can be used with automake, then I would be eternally grateful!
I would suggest the following.

[1] Get and set up xmingw32. On Gentoo, that can simply be emerged,
for example. Nice package for cross-compiling, BTW, if one
really wants to generate executables for That Other OS.
[2] Get a copy of X.CPP.
[3] Try to compile X.CPP, using a very long-handled pole and a lot
of patience.
[4] Repeat [3] until brick wall has fallen over.

:-)

I'll admit, I'm tempted, but can't say offhand whether there's
a good code analyzer out there for C++ (there's a few out
for Java, but this ain't even close :-) ).
--
#191, ***@earthlink.net
It's still legal to go .sigless.
Peter Jensen
2005-01-13 10:19:41 UTC
Permalink
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Post by Peter Jensen
Well, he does disable some 35 warnings, just to get it to compile
"cleanly". Personally I like to treat warnings as errors because
they may just be that, and I even compile with -Wall to make sure I
catch as many as possible.
There's also the -Wsynth option. Not sure how useful that is, as I've
forgotten its exact purpose, but I don't think -Wall includes -Wsynth,
and it's fairly esoteric.
Just read the man page, and yes ... It's fairly esoteric indeed. In
fact, it's so esoteric that I haven't got the faintest clue as to what
it does!
Post by Peter Jensen
I'd like to use -Weffc++ more as well, but unfortunately gcc for some
reason becomes very verbose with warnings when the STL is used.
Have you tried using STL with VC++? That gets quite verbose too. I'm
wondering which one generates more diagnostics... :-)
One single instantiation of std::vector<std::string> results in some 60+
lines of diagnostics when -Weffc++ is used. How about VC++?
I'm not familiar with -Weffc++; I'll have to play with it. Sounds
like it might be useful, verbose, or both.
Well, I think it's quite useful. It enforces object orientation, which
is something that still doesn't come naturally for me due to lack of
practice. It's very unfortunate that the slightest use of the STL
causes it to go nuts. When it's not my "bug", I don't want to know
about it!
Post by Peter Jensen
Personally I don't think it makes sense to report errors and warnings
from any of the system headers, but it doesn't look like the gcc
developers are interested in fixing that shortcoming. The manual
says to just grep -v around it, but they could at least have shown
how! A pity, because -Weffc++ seems very useful to me.
Sounds like a feature instead of a bug.
Well, it does appear in their FAQ as one of the most often-reported
non-bugs, but quite frankly I disagree. The thing is that instantiation
doesn't happen in the header files, but in your own source, so it takes
some extra effort to detect and exclude it. It seems that anyone
capable of fixing it aren't in any hurry to do so because there is a
workaround (grep -v). The STL isn't even meant to be fully OO, so
obviously it will never be made -Weffc++ clean. The only solution is to
not trigger on it.
Then again, you might have to complain to the developers of libc
and/or Linux to fix that. :-)
Well, this has been known for more than five years now. You'll forgive
me if I don't have much confidence that it will be fixed soon. Of
course it's nothing critical, but a working -Weffc++ would be a very
nice feature. Their bugzilla bug #12854 is the most recent mention I
could find, but it looks like it has been suspended for now.

Now, I'm not willing to give up on -Weffc++ just yet, so I'll have to
design some sort of filter for it, which hopefully will not interfere
with real bugs. I just wish I could find something like that on the
web, but so far no luck ...

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)

iD8DBQFB5ks6d1ZThqotgfgRAlWeAJ96ceDbyTqRhayJRVidrZR8KMqbNACgpIsJ
wwISvBxV1zdBIF9otC/ztUk=
=qm4z
-----END PGP SIGNATURE-----
--
PeKaJe

Vini, vidi, Linux!
-- Unknown source
Peter Jensen
2005-01-13 17:02:36 UTC
Permalink
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Peter Jensen wrote:

What is talking to oneself a sign of, again? :-)
Post by Peter Jensen
Now, I'm not willing to give up on -Weffc++ just yet, so I'll have to
design some sort of filter for it, which hopefully will not interfere
with real bugs. I just wish I could find something like that on the
web, but so far no luck ...
Well, I think I have a solution, for now at least. in my ~/.bashrc I
have this function:

effcpp()
{
make CXXFLAGS="-Wall -Weffc++ -fmessage-length=0" $* 2>&1 |\
grep -v \
-e "/usr/lib/gcc-lib/i686-pc-linux-gnu" \
-e "In file included from" \
-e "instantiated from here" \
-e "instantiated from \`std::"
}

The trick is to not use -Weffc++ for the regular compiles, but
occasionally run 'effcpp' instead of make. It seems to catch STL
warnings, but spares those generated by yourself. It may need tweaking,
and I haven't tested it fully, but for now it seems to work for me.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)

iD8DBQFB5qmnd1ZThqotgfgRApa7AJ0TtDAM4sTdtQaFEvsBjxysgxvWTACeJnQY
sliiny6E/wigXJAl3moHD20=
=gEmC
-----END PGP SIGNATURE-----
--
PeKaJe

FOOLED you! Absorb EGO SHATTERING impulse rays, polyester poltroon!!
Jeff_Relf
2005-01-13 09:29:17 UTC
Permalink
Hi Peter_Jensen, Re: X.CPP's HTML to TXT converter,
You told Spooky: << Personally I like to treat warnings as errors... >>

Same here, and at the highest level of warnings too,
but many warnings are bullshit... only making the source code look worse.

Testing is how you know if the code works or not, not compile-time warnings.
mlw
2005-01-13 14:07:54 UTC
Permalink
Post by Jeff_Relf
Hi Peter_Jensen, Re: X.CPP's HTML to TXT converter,
You told Spooky: << Personally I like to treat warnings as errors... >>
Same here, and at the highest level of warnings too,
but many warnings are bullshit... only making the source code look worse.
Testing is how you know if the code works or not, not compile-time warnings.
Typical. If you don't even know what's wrong with that statement, any form
of debate is wasted on you.
chrisv
2005-01-13 17:17:58 UTC
Permalink
Post by mlw
Post by Jeff_Relf
Hi Peter_Jensen, Re: X.CPP's HTML to TXT converter,
You told Spooky: << Personally I like to treat warnings as errors... >>
Same here, and at the highest level of warnings too,
but many warnings are bullshit... only making the source code look worse.
Testing is how you know if the code works or not, not compile-time warnings.
Typical. If you don't even know what's wrong with that statement, any form
of debate is wasted on you.
You're just getting this figured-out, huh?
Jeff_Relf
2005-01-13 09:40:39 UTC
Permalink
Hi Spooky ( and General Protection, MLW ),
Re: People who can't read X.CPP, You told GP: <<
Neither can my compiler ( G++ ). :-)
There's a few technical glitches in there. >>

Post a bug report then, G++ really needs fixing if you're asking me.
The Ghost In The Machine
2005-01-13 21:01:42 UTC
Permalink
In comp.os.linux.advocacy, Jeff_Relf
<***@Privacy.NET>
wrote
on 13 Jan 2005 09:40:39 GMT
Post by Jeff_Relf
Hi Spooky ( and General Protection, MLW ),
Re: People who can't read X.CPP, You told GP: <<
Neither can my compiler ( G++ ). :-)
There's a few technical glitches in there. >>
Post a bug report then, G++ really needs fixing if you're asking me.
Oh? Please be specific as to where g++ has bugs.

I'm curious.
--
#191, ***@earthlink.net
It's still legal to go .sigless.
Jeff_Relf
2005-01-13 10:04:32 UTC
Permalink
Hi General_Protection ( and MLW ),
Re: This comment from MLW to me about X.CPP: <<
Dude, that code is unreadable and you should be ashamed of it. >>

You told him: << You know what the answer's going to be, right ?
" You can't read C++ code. " >>

MLW can't read X.CPP, obviously, which is Micro-Soft C++ 7.1 for WinXP.
That's a shortcomming, if you're asking me.
mlw
2005-01-13 12:14:49 UTC
Permalink
Post by Jeff_Relf
Hi General_Protection ( and MLW ),
Re: This comment from MLW to me about X.CPP: <<
Dude, that code is unreadable and you should be ashamed of it. >>
You told him: << You know what the answer's going to be, right ?
" You can't read C++ code. " >>
MLW can't read X.CPP, obviously, which is Micro-Soft C++ 7.1 for WinXP.
That's a shortcomming, if you're asking me.
If one wanted to waste the time to necessary to familiarize themselves with
your endless macros and get used to zero white space, then one could read
that gibberish.

Gibberish it is, however.
Jeff_Relf
2005-01-13 12:14:06 UTC
Permalink
Hi mlw, Re: Your inability to read X.CPP,

You told me: <<
If one wanted to waste the time to necessary to familiarize themselves with
your endless macros and get used to zero white space,
then one could read that gibberish.

Gibberish it is, however. >>

Ignore it then, I don't require that you understand it.

I use it constantly throughout the day.
It's the best e-mail_client/newsreader I've ever seen,
but it's designed only for those who know MS C++ 7.1 and Visual Studio 2003,
so I don't care what you think of it.
Rick
2005-01-13 22:12:05 UTC
Permalink
Post by Jeff_Relf
Hi mlw, Re: Your inability to read X.CPP,
You told me: <<
If one wanted to waste the time to necessary to familiarize themselves with
your endless macros and get used to zero white space,
then one could read that gibberish.
Gibberish it is, however. >>
Ignore it then, I don't require that you understand it.
I use it constantly throughout the day.
It's the best e-mail_client/newsreader I've ever seen,
but it's designed only for those who know MS C++ 7.1 and Visual Studio 2003,
so I don't care what you think of it.
If you didn't care, you wouldn't keep posting you ... 'code'.
--
Rick
mlw
2005-01-13 23:36:34 UTC
Permalink
Post by Rick
Post by Jeff_Relf
Hi mlw, Re: Your inability to read X.CPP,
You told me: <<
If one wanted to waste the time to necessary to familiarize themselves
with your endless macros and get used to zero white space,
then one could read that gibberish.
Gibberish it is, however. >>
Ignore it then, I don't require that you understand it.
I use it constantly throughout the day.
It's the best e-mail_client/newsreader I've ever seen,
but it's designed only for those who know MS C++ 7.1 and Visual Studio
2003, so I don't care what you think of it.
If you didn't care, you wouldn't keep posting you ... 'code'.
It is amazing how *important* proper quotation is. :)
Jeff_Relf
2005-01-18 14:34:10 UTC
Permalink
Hi Rick ( and M.L.W. ), Re: How X.CPP is designed only for
those who know MS C++ 7.1 and Visual Studio 2003,
so I don't care what M.L.W. thinks of it,

You asked me: <<
If you didn't care, you wouldn't keep posting you ... 'code'. >>

I post code segments mostly for my own benefit,
it helps me reveiw it and make improvements.

Sure, you can't read it Rick, but others can ( sort of ).
Rick
2005-01-18 22:12:21 UTC
Permalink
Post by Jeff_Relf
Hi Rick ( and M.L.W. ), Re: How X.CPP is designed only for
those who know MS C++ 7.1 and Visual Studio 2003,
so I don't care what M.L.W. thinks of it,
You asked me: <<
If you didn't care, you wouldn't keep posting you ... 'code'. >>
I post code segments mostly for my own benefit,
it helps me reveiw it and make improvements.
How in hell can posting your code here help you review it.
Post by Jeff_Relf
Sure, you can't read it Rick,
.. never said I could.
Post by Jeff_Relf
but others can ( sort of ).
Wake up.
--
Rick
Jeff_Relf
2005-01-18 23:06:29 UTC
Permalink
Hi Rick, You asked me: <<
How in hell can posting your code here help you review it. >>

Geez Rick, isn't it obvious to you ?
Of course I review the code that I'm posting,
which often leads to changes... no matter that no one here understands it.

What a shame that no one here is literate enough to read my code.

Also, there's the possibly that someone might enjoy my code
after Googling for something that can convert HTML to TXT, do a quick sort,
implement dynamic arrays, decode MIME, strip out PGP sigs,
set their clocks and benchmark their connections using SNTP,
benchmark their systems ( Tom.CPP ), implement SMTP-AUTH, etc.
Rick
2005-01-19 01:49:24 UTC
Permalink
Post by Jeff_Relf
Hi Rick, You asked me: <<
How in hell can posting your code here help you review it. >>
Geez Rick, isn't it obvious to you ?
Of course I review the code that I'm posting,
which often leads to changes... no matter that no one here understands it.
Are you too stupid or too handicapped to read it on paper?
Post by Jeff_Relf
What a shame that no one here is literate enough to read my code.
AHAH ahahah HAHAH ahhahaha HAHA ahahah HAHAHah
Post by Jeff_Relf
Also, there's the possibly that someone might enjoy my code
aha hhaha HAHAH ahahah HAhaha hahah HAHAH hahah
Post by Jeff_Relf
after Googling for something that can convert HTML to TXT, do a quick
sort, implement dynamic arrays, decode MIME, strip out PGP sigs, set
their clocks and benchmark their connections using SNTP, benchmark their
systems ( Tom.CPP ), implement SMTP-AUTH, etc.
--
Rick
Jeff_Relf
2005-01-19 02:18:20 UTC
Permalink
Hi Rick, Re: How posting code helps me review it,
You asked me: <<
Are you too stupid or too handicapped to read it on paper ? >>

I use Visual Studio .NET 2003 to read my Micro-Soft C++ 7.1 code,
( and to post to Cola ) not paper.

Paper makes a really really poor editor/debugger.
Rick
2005-01-19 02:38:41 UTC
Permalink
Post by Jeff_Relf
Hi Rick, Re: How posting code helps me review it,
You asked me: <<
Are you too stupid or too handicapped to read it on paper ? >>
I use Visual Studio .NET 2003 to read my Micro-Soft C++ 7.1 code,
( and to post to Cola ) not paper.
Paper makes a really really poor editor/debugger.
Does it hurt to have a brain as small, and an ego as big, as yours?
--
Rick
General Protection Fault
2005-01-19 15:16:48 UTC
Permalink
Post by Jeff_Relf
Hi Rick, You asked me: <<
How in hell can posting your code here help you review it. >>
Geez Rick, isn't it obvious to you ?
Of course I review the code that I'm posting,
which often leads to changes... no matter that no one here understands it.
What a shame that no one here is literate enough to read my code.
One *could* read your code, given enough time, but it's just not worth it.
5 minutes of your time could save hours of someone else's.
Post by Jeff_Relf
Also, there's the possibly that someone might enjoy my code
after Googling for something that can convert HTML to TXT, do a quick sort,
implement dynamic arrays, decode MIME, strip out PGP sigs,
set their clocks and benchmark their connections using SNTP,
benchmark their systems ( Tom.CPP ), implement SMTP-AUTH, etc.
HTML can be converted to TXT with Perl in one line. Or sed or awk.
--
FreeBSD 4.8-RELEASE i386
9:10AM up 3 days, 3:41, 0 users, load averages: 0.00, 0.00, 0.00
Jeff_Relf
2005-01-19 19:42:57 UTC
Permalink
Hi General_Protection,
Re: How X.CPP converts HTML to TXT in 16 short lines,
You commented: <<
HTML can be converted to TXT with Perl in one line. Or sed or awk. >>

How long is that line and how readable is it ?

Could you modify that code if you wanted to ?

If so, it only proves that you know Perl better than C++.

You told me: <<
One could read your code, given enough time, but it's just not worth it.
5 minutes of your time could save hours of someone else's. >>

Quite unlike me, you're not reading X.CPP with intent to improve it,
you're just glancing at it and commenting on the style.
The Ghost In The Machine
2005-01-20 01:00:39 UTC
Permalink
In comp.os.linux.advocacy, Jeff_Relf
<***@Privacy.NET>
wrote
on 19 Jan 2005 19:42:57 GMT
Post by Jeff_Relf
Hi General_Protection,
Re: How X.CPP converts HTML to TXT in 16 short lines,
You commented: <<
HTML can be converted to TXT with Perl in one line.
Or sed or awk. >>
How long is that line and how readable is it ?
Could you modify that code if you wanted to ?
If so, it only proves that you know Perl better than C++.
You told me: <<
One could read your code, given enough time,
but it's just not worth it. 5 minutes of your
time could save hours of someone else's. >>
Quite unlike me, you're not reading X.CPP with intent to improve it,
you're just glancing at it and commenting on the style.
Never mind improving it ... I'm trying to read X.CPP to *compile* it.
:-)
--
#191, ***@earthlink.net
It's still legal to go .sigless.
Jeff_Relf
2005-01-20 01:21:25 UTC
Permalink
Hi Spooky, Re: X.CPP, You told me: << Never mind improving it...
I'm trying to read X.CPP to *compile* it. :-) >>

Why haven't you compiled X.CPP using MS C++ ?
CEO Gargantua
2005-01-20 02:26:38 UTC
Permalink
Post by Jeff_Relf
Hi Spooky, Re: X.CPP, You told me: << Never mind improving it...
I'm trying to read X.CPP to *compile* it. :-) >>
Why haven't you compiled X.CPP using MS C++ ?
I don't compile.

I create IL.

Lately, natively.
--
incognito...updated almost daily
http://kentpsychedelic.blogspot.com

Texeme Textcasting Technology
http://texeme.com
Jeff_Relf
2005-01-20 19:28:07 UTC
Permalink
Hi CEO_Gargantua ( Bailo ),
You wrote: << I be illin' with the natives. >>

Fine Bailo, but could you tell us who's using your code ?

Could you tell me why I'd want to use your code ? No ? I thought so.

P.S. You've never commented on any of the songs I gave you,
...does that mean that you never listened to any of them ?
The Ghost In The Machine
2005-01-20 19:01:43 UTC
Permalink
In comp.os.linux.advocacy, Jeff_Relf
<***@Privacy.NET>
wrote
on 20 Jan 2005 01:21:25 GMT
Post by Jeff_Relf
Hi Spooky, Re: X.CPP, You told me: << Never mind improving it...
I'm trying to read X.CPP to *compile* it. :-) >>
Why haven't you compiled X.CPP using MS C++ ?
Because I don't have MS C++ at home, for starters.

Next question?
--
#191, ***@earthlink.net
It's still legal to go .sigless.
Jeff_Relf
2005-01-20 19:36:36 UTC
Permalink
Hi Spooky, Re: Why you haven't you compiled X.CPP using MS C++,
You told me: << Because I don't have MS C++ at home, for starters.
Next question ? >>

Why don't you have Micro-Soft C++ and Visual Studio ?

Because the only thing you know is old-school unix variants ?
General Protection Fault
2005-01-20 19:40:35 UTC
Permalink
Post by Jeff_Relf
Hi Spooky, Re: Why you haven't you compiled X.CPP using MS C++,
You told me: << Because I don't have MS C++ at home, for starters.
Next question ? >>
Why don't you have Micro-Soft C++ and Visual Studio ?
Because the only thing you know is old-school unix variants ?
It shouldn't matter what compiler you use on a given platform. It should
compile no matter what. Which yours does not. It does not compile with
the Platform SDK, which is the de facto Win32 compiler.
--
FreeBSD 4.8-RELEASE i386
1:35PM up 2:33, 0 users, load averages: 0.00, 0.00, 0.00
Jeff_Relf
2005-01-20 21:03:30 UTC
Permalink
Hi General_Protection,
Re: Why Spooky doesn't compile X.CPP using Micro-Soft C++ and Visual Studio,
You told me: <<
It shouldn't matter what compiler you use on a given platform. >>

Right, and everyone should be immortal billionaires... get real.

You added: << It should compile no matter what. Which yours does not.
It does not compile with the Platform SDK,
which is the de facto Win32 compiler. >>

X.CPP uses the very latest Platform SDK, Direct Draw 7, WinSock 2:
#include <Winsock2.h>
#pragma comment( lib, "Ws2_32.LIB")
#include <ddraw.h>
#pragma comment( lib, "DDraw.LIB")
#pragma comment( lib, "DXguid.LIB")

If your toy compiler can't handle that... it's time to upgrade.
General Protection Fault
2005-01-20 21:08:20 UTC
Permalink
Post by Jeff_Relf
Hi General_Protection,
Re: Why Spooky doesn't compile X.CPP using Micro-Soft C++ and Visual Studio,
You told me: <<
It shouldn't matter what compiler you use on a given platform. >>
Right, and everyone should be immortal billionaires... get real.
The above goal is achievable and generally desired by anyone who knows
anything about C++. Don't ever target the compiler.
Post by Jeff_Relf
You added: << It should compile no matter what. Which yours does not.
It does not compile with the Platform SDK,
which is the de facto Win32 compiler. >>
#include <Winsock2.h>
#pragma comment( lib, "Ws2_32.LIB")
#include <ddraw.h>
#pragma comment( lib, "DDraw.LIB")
#pragma comment( lib, "DXguid.LIB")
If your toy compiler can't handle that... it's time to upgrade.
You told us you compile X.CPP with VS.NET, which is *not* the Platform SDK.
Which statement is the lie? Or did you rig (read: cripple) VS.NET to use
the Platform SDK compiler instead?
--
FreeBSD 4.8-RELEASE i386
3:00PM up 3:58, 1 user, load averages: 0.01, 0.02, 0.00
Jeff_Relf
2005-01-20 22:49:22 UTC
Permalink
Hi General_Protection,
Re: Your desire to dethrone Micro-Soft C++ and Visual Studio
from it's rule over the retail scene ( along with Borland, I might add ),
You told me: << The above goal is achievable
and generally desired by anyone who knows anything about C++.
Don't ever target the compiler. >>

I say just the opposite, target Micro-Soft C++ and Visual Studio.
Just like it's very convenient if everyone speaks English here,
Micro-Soft C++ and Visual Studio provide a much needed standard.

Borland's compiler would also compile my code, by the way,
even if it required a few minor changes.

Re: How X.CPP uses the very latest Platform SDK, Direct Draw 7, and WinSock 2:
#include <Winsock2.h>
#pragma comment( lib, "Ws2_32.LIB")
#include <ddraw.h>
#pragma comment( lib, "DDraw.LIB")
#pragma comment( lib, "DXguid.LIB")

You asked me: << You told us you compile X.CPP with VS.NET,
which is *not* the Platform SDK. Which statement is the lie ?
Or did you rig ( read: cripple ) VS.NET
to use the Platform SDK compiler instead ? >>

The Platform SDK is not a compiler, it's .H and .LIB files, etc.
and it comes with Micro-Soft C++ and Visual Studio.

X.CPP could be easily compiled using just the free Platform_SDK/Compiler
...but why omit the editor: VS ?
The Ghost In The Machine
2005-01-21 00:01:47 UTC
Permalink
In comp.os.linux.advocacy, Jeff_Relf
<***@Privacy.NET>
wrote
on 20 Jan 2005 22:49:22 GMT
Post by Jeff_Relf
Hi General_Protection,
Re: Your desire to dethrone Micro-Soft C++ and Visual Studio
from it's rule over the retail scene ( along with Borland, I might add ),
You told me: << The above goal is achievable
and generally desired by anyone who knows anything about C++.
Don't ever target the compiler. >>
I say just the opposite, target Micro-Soft C++ and Visual Studio.
Just like it's very convenient if everyone speaks English here,
Micro-Soft C++ and Visual Studio provide a much needed standard.
For Windows machines, maybe. How about:

- IA64 running OpenVMS?
- An s390 running Linux?
- For that matter, *almost anything* running Linux?
- FreeBSD?
- PalmOS?
- Cell phone?
- One's pocket calculator, microwave, electronic coffee maker, ...?

Oh, that's right; everyone should be using ActiveX and .NET on
Windows XP Home Edition or Windows XP Embedded Edition (the
replacement for Win CE, if I'm not mistaken; I don't know
the exact name). That way, Microsoft can achieve
100% market dominance^W^W^W100% compatibility.

Silly me.
Post by Jeff_Relf
Borland's compiler would also compile my code, by the way,
even if it required a few minor changes.
Hmmm...I hear a challenge. I might consider it, though
Borland C++ 4.51 has never heard of .NET and probably
hasn't heard of ActiveX, either. But I do have a Win98
system I can try it on. I'll get back to you on that.

(It's a very pure system, too. I just wiped GRUB off
of it. The reasons have to do more with a problematic
hard drive than any issues with Linux per se. The drive
is now sitting in another machine and I'll have to see how
well it behaves in there. I may have to test the Kayak's
power supply.)
Post by Jeff_Relf
#include <Winsock2.h>
#pragma comment( lib, "Ws2_32.LIB")
#include <ddraw.h>
#pragma comment( lib, "DDraw.LIB")
#pragma comment( lib, "DXguid.LIB")
You asked me: << You told us you compile X.CPP with VS.NET,
which is *not* the Platform SDK. Which statement is the lie ?
Or did you rig ( read: cripple ) VS.NET
to use the Platform SDK compiler instead ? >>
The Platform SDK is not a compiler, it's .H and .LIB files, etc.
and it comes with Micro-Soft C++ and Visual Studio.
X.CPP could be easily compiled using just the free Platform_SDK/Compiler
...but why omit the editor: VS ?
Free compiler? What free compiler? Is Microsoft giving away VC++ now?
--
#191, ***@earthlink.net
It's still legal to go .sigless.
Jeff_Relf
2005-01-21 01:05:52 UTC
Permalink
Hi Spooky ( and General_Protection ), You asked me: <<
Free compiler ? What free compiler ?
Is Microsoft giving away VC++ now ? >>

Yes, only VS' editor and debugger cost money, it seems.
And even that is free if you priate it like I did ( ah, the campus life ).
Although X.CPP is integrated into VS' editor with it's VBA macros,
...you could integrate it into another editor.

X.CPP was once integrated into MS Word,
but I switched to VS 2003 ( after receiving a pirated copy of it )
because it's searching capabilities were far superior.

A Google search for: << download compiler site:microsoft.com >>
shows this: http://msdn.microsoft.com/visualc/vctoolkit2003/ <<
The Microsoft Visual C++ Toolkit 2003 includes
the core tools developers need to compile and link C++-based applications
for Windows and the .NET Common Language Runtime:

1. Microsoft C/C++ Optimizing Compiler and Linker.
These are the same compiler and linker that ship with
Visual Studio .NET 2003 Professional !
2. C Runtime Library and the C++ Standard Library,
including the Standard Template Library.
These are the same static-link libraries included with Visual Studio.
3. Microsoft .NET Framework Common Language Runtime.
Visual C++ can optionally build applications
that target the Common Language Runtime ( CLR ).
4. Sample code.
The toolkit includes four samples
designed to showcase the powerful new features of the 2003 version,
including new optimization capabilities,
features to improve code-security and robustness,
enhanced ISO C++ standards support,
and the ability to use the .NET Framework library and target the CLR.

Download the Visual C++ Toolkit 2003 >>

Re: How Micro-Soft C++ and Visual Studio are a standard like English is here,

You told me: << For Windows machines, maybe.
How about:
- IA64 running OpenVMS ?
- An s390 running Linux ?
- For that matter, *almost anything* running Linux ?
- FreeBSD ?
- PalmOS ?
- Cell phone ?
- One's pocket calculator, microwave, electronic coffee maker, ...?

Oh, that's right; everyone should be using ActiveX
and .NET on Windows XP Home Edition or Windows XP Embedded Edition
( the replacement for Win CE, if I'm not mistaken;
I don't know the exact name ). That way, Microsoft can achieve
100% market dominance^W^W^W100% compatibility.

Silly me. >>

ActiveX and .NET ? What are those ? I never use them.

I'm talking about MS C++ 7.1 and the VS editor/debugger.
As for IDEs for unix variants and hand-helds, that's simply not retail,
so they're foreign to me.

Re: How Borland's compiler would also compile X.CPP with few changes,

You told me: << Hmmm... I hear a challenge. I might consider it,
though Borland C++ 4.51 has never heard of .NET and probably
hasn't heard of ActiveX, either. >>

X.CPP doesn't use any of that.

You added: << But I do have a Win98 system I can try it on.
I'll get back to you on that.

( It's a very pure system, too. I just wiped GRUB off
of it. The reasons have to do more with a problematic
hard drive than any issues with Linux per se. The drive
is now sitting in another machine and I'll have to see how
well it behaves in there.
I may have to test the Kayak's power supply. ) >>

Yea, burnt-out power supplies and dirty fans will kill you everytime.
( All the more so if you happen to smoke cigars in the same room )

The latest X.CPP has no references to any of the Ras-Dailer stuff,
so it should compile fine using Borland C++ 4.51 for Win98,
you might have to load DirectX on it though and make some minor changes.
General Protection Fault
2005-01-21 15:00:13 UTC
Permalink
Post by The Ghost In The Machine
In comp.os.linux.advocacy, Jeff_Relf
Post by Jeff_Relf
X.CPP could be easily compiled using just the free Platform_SDK/Compiler
...but why omit the editor: VS ?
Free compiler? What free compiler? Is Microsoft giving away VC++ now?
The Platform SDK includes a C++ compiler. And yes, it's free. It isn't
VC++. It's just Microsoft C++.
--
FreeBSD 4.8-RELEASE i386
8:55AM up 21:53, 1 user, load averages: 0.00, 0.00, 0.00
Jeff_Relf
2005-01-21 20:07:20 UTC
Permalink
Hi General_Protection, You told Spooky: <<
The Platform SDK includes a C++ compiler. And yes, it's free.
It isn't VC++. It's just Microsoft C++. >>

Ok GP, There is one download from MS to get the compiler and the CRT,
the Platform SDK is an entirely Different download,
and the VS editor/debugger has to be purchased or pirated.

VS' dialog editors, wizards and such are garbage, if you're asking me.
I never use them.

X.CPP will compile without VS but is designed to run alongside VS,
including the use of VBA macros.
General Protection Fault
2005-01-21 20:08:21 UTC
Permalink
Post by Jeff_Relf
Hi General_Protection, You told Spooky: <<
The Platform SDK includes a C++ compiler. And yes, it's free.
It isn't VC++. It's just Microsoft C++. >>
Ok GP, There is one download from MS to get the compiler and the CRT,
the Platform SDK is an entirely Different download,
and the VS editor/debugger has to be purchased or pirated.
VS' dialog editors, wizards and such are garbage, if you're asking me.
I never use them.
X.CPP will compile without VS but is designed to run alongside VS,
including the use of VBA macros.
I know all this, thanks Jeff.

FYI, designing an application to run alongside another is pretty stupid,
but then it's meant only for you, in which case please stop posting that
shitty code here.
--
FreeBSD 4.8-RELEASE i386
2:05PM up 1 day, 3:03, 1 user, load averages: 0.02, 0.03, 0.00
Jeff_Relf
2005-01-21 20:35:37 UTC
Permalink
Hi General_Protection, You told me: <<
FYI, designing an application to run alongside another is pretty stupid,
but then it's meant only for you,
in which case please stop posting that shitty code here. >>

XNews, which is probably more popular than any newsreader found on unix,
really requires another editor ( I used to use MS Word with it ).
40tude Dialog has a good editor all by itself, thanks to Borland's Delphi.

But the best editor of all is Visual Studio,
because of it's tabbed windows and it's unmatched searching abilities.
Once the text-cursor is over a word, it's one click to find that word.
I have two icons, up and down, for searching like that., shown here:
Loading Image...
http://www.Cotse.NET/users/jeffrelf/X_CPP
Another pair of icons will simply repeat the last search,
regardless of where the text-cursor is.

I might have X.CPP work without VS sometime,
but that would cause a lot of frustration
as I switched between the two editors to compile or read newsgroups.

I could have X.CPP replace VS' code-editing and debugging,
but that sounds like too much work... at least right now.

If you don't like looking at my so-called shitty code,
and if it makes you break out in hives, I suggest you ignore my posts.
General Protection Fault
2005-01-21 20:47:58 UTC
Permalink
Post by Jeff_Relf
Hi General_Protection, You told me: <<
FYI, designing an application to run alongside another is pretty stupid,
but then it's meant only for you,
in which case please stop posting that shitty code here. >>
XNews, which is probably more popular than any newsreader found on unix,
really requires another editor ( I used to use MS Word with it ).
40tude Dialog has a good editor all by itself, thanks to Borland's Delphi.
So it embeds a Delphi control. So what?

I highly doubt XNews is more popular than any Unix newsreader.
Post by Jeff_Relf
But the best editor of all is Visual Studio,
because of it's tabbed windows and it's unmatched searching abilities.
Once the text-cursor is over a word, it's one click to find that word.
Many editors do that. Ultra-Edit, Programmer's Editor, etc. Even my first
C++ IDE, Turbo C++ 2.0 for DOS did that.
Post by Jeff_Relf
http://www.Cotse.NET/users/jeffrelf/Cola_TXT.PNG
http://www.Cotse.NET/users/jeffrelf/X_CPP
Another pair of icons will simply repeat the last search,
regardless of where the text-cursor is.
I might have X.CPP work without VS sometime,
but that would cause a lot of frustration
as I switched between the two editors to compile or read newsgroups.
I could have X.CPP replace VS' code-editing and debugging,
but that sounds like too much work... at least right now.
If you don't like looking at my so-called shitty code,
and if it makes you break out in hives, I suggest you ignore my posts.
But everyone else wants you to quit posting it, too. The problem is *you*.
--
FreeBSD 4.8-RELEASE i386
2:40PM up 1 day, 3:38, 1 user, load averages: 0.85, 0.65, 0.38
Ray Ingles
2005-01-21 14:02:12 UTC
Permalink
Post by Jeff_Relf
I say just the opposite, target Micro-Soft C++ and Visual Studio.
Just like it's very convenient if everyone speaks English here,
Micro-Soft C++ and Visual Studio provide a much needed standard.
If you standardize on tools (applications), you will get bitten when
the app changes (remember how it took time and pressure before M$
finally provided an 'update' so that Word 97 could write Word 95 files?)
or is abandoned. If you standardize on file formats, then anyone can
use any application that can read that format.

I write stuff that's portable to any platform, until and unless I
need to do something platform-specific. You, on the other hand, get
tied to the tools.
--
Sincerely,

Ray Ingles (313) 227-2317

Microsoft Windows - Form follows malfunction.
General Protection Fault
2005-01-21 15:02:01 UTC
Permalink
Post by Jeff_Relf
Hi General_Protection,
Re: Your desire to dethrone Micro-Soft C++ and Visual Studio
from it's rule over the retail scene ( along with Borland, I might add ),
You told me: << The above goal is achievable
and generally desired by anyone who knows anything about C++.
Don't ever target the compiler. >>
I say just the opposite, target Micro-Soft C++ and Visual Studio.
Just like it's very convenient if everyone speaks English here,
Micro-Soft C++ and Visual Studio provide a much needed standard.
C++ is a standard. Microsoft C++ is an implementation of a standard.
gcc is an implementation of a standard.
Post by Jeff_Relf
Borland's compiler would also compile my code, by the way,
even if it required a few minor changes.
Try it and see. I'm sure more than a few "minor" changes are required.
Post by Jeff_Relf
#include <Winsock2.h>
#pragma comment( lib, "Ws2_32.LIB")
#include <ddraw.h>
#pragma comment( lib, "DDraw.LIB")
#pragma comment( lib, "DXguid.LIB")
You asked me: << You told us you compile X.CPP with VS.NET,
which is *not* the Platform SDK. Which statement is the lie ?
Or did you rig ( read: cripple ) VS.NET
to use the Platform SDK compiler instead ? >>
The Platform SDK is not a compiler, it's .H and .LIB files, etc.
and it comes with Micro-Soft C++ and Visual Studio.
No, the Platform SDK is separately downloadable and DOES include a C++
compiler. If you knew fuck all about proper enterprise Windows development
you'd know *that* is the compiler to use, not VC++.
Post by Jeff_Relf
X.CPP could be easily compiled using just the free Platform_SDK/Compiler
...but why omit the editor: VS ?
Oh, it "could" be easily compiled? But you said previously that you *did*
compile it with the SDK compiler and that it worked. So you were lying?
--
FreeBSD 4.8-RELEASE i386
8:55AM up 21:53, 1 user, load averages: 0.00, 0.00, 0.00
Jeff_Relf
2005-01-21 21:04:12 UTC
Permalink
Hi General_Protection, You told me: <<
C++ is a standard. Microsoft C++ is an implementation of a standard.
gcc is an implementation of a standard. >>

In the retail world, MS C++ is the standard... while gcc falls way short.

Re: How Borland could compile my code with few changes,

You told me: << Try it and see.
I'm sure more than a few "minor" changes are required. >>

I don't have a copy of it... and I'm not about to buy it.

You wrote: << The Platform SDK is separately downloadable
and DOES include a C++ compiler. >>

The Platform SDK download does not include a compiler.
Micro-Soft's compiler is free, but it's a separate download.

You told me: <<
If you knew fuck all about proper enterprise Windows development
you'd know that is the compiler to use, not VC++. >>

Micro-Soft's free compiler is exactly the same one that comes with VS,
VS costs money because it has an editor and debugger as well.
As you know, I don't use the wizards or dialog editors.

Further, I target the retail market, not the enterprise market.

I've never compiled X.CPP using anything other than VS,
which means that the free compiler/SDK from MS would also compile it.
I don't know why you think I said otherwise.

But compiling X.CPP is meaningless unless you actually run it,
and that requires an editor/debugger of somekind.

mlw
2005-01-20 23:28:46 UTC
Permalink
[snip]

I really think the guy is retarded, give it up.
Jeff_Relf
2005-01-20 23:54:46 UTC
Permalink
Hi MLW ( and General Protection ),
You claim my code is unreadable yet you refuse my efforts to explain it.
You even refuse to talk about your own code, getting a defensive about it.

You run from me like a little kid from a bully.

Now you're calling me retarded ?

Are there any men here ?
The Ghost In The Machine
2005-01-20 23:00:08 UTC
Permalink
In comp.os.linux.advocacy, Jeff_Relf
<***@Privacy.NET>
wrote
on 20 Jan 2005 21:03:30 GMT
Post by Jeff_Relf
Hi General_Protection,
Re: Why Spooky doesn't compile X.CPP using Micro-Soft C++ and Visual Studio,
You told me: <<
It shouldn't matter what compiler you use on a given platform. >>
Right, and everyone should be immortal billionaires... get real.
You added: << It should compile no matter what. Which yours does not.
It does not compile with the Platform SDK,
which is the de facto Win32 compiler. >>
#include <Winsock2.h>
#pragma comment( lib, "Ws2_32.LIB")
#include <ddraw.h>
#pragma comment( lib, "DDraw.LIB")
#pragma comment( lib, "DXguid.LIB")
If your toy compiler can't handle that... it's time to upgrade.
While there are some minor issues in that area, they are
easily correctable.

The problems lie elsewhere. I'll have to work out where,
but there's a few issues that XMingw32 just doesn't like
about your code. :-)
--
#191, ***@earthlink.net
It's still legal to go .sigless.
Jeff_Relf
2005-01-21 00:14:10 UTC
Permalink
Hi Spooky, Re: X.CPP using the Platform SDK, Direct Draw 7, WinSock 2,
You told me: << While there are some minor issues in that area,
they are easily correctable.

The problems lie elsewhere. I'll have to work out where,
but there's a few issues that XMingw32 just doesn't like
about your code. :-) >>

Like what exactly ?
The Ghost In The Machine
2005-01-21 17:12:05 UTC
Permalink
In comp.os.linux.advocacy, Jeff_Relf
<***@Privacy.NET>
wrote
on 21 Jan 2005 00:14:10 GMT
Post by Jeff_Relf
Hi Spooky, Re: X.CPP using the Platform SDK, Direct Draw 7, WinSock 2,
You told me: << While there are some minor issues in that area,
they are easily correctable.
The problems lie elsewhere. I'll have to work out where,
but there's a few issues that XMingw32 just doesn't like
about your code. :-) >>
Like what exactly ?
I'll refer you to Message-ID
qho7c2-***@sirius.athghost7038suus.net
for the gory details.
--
#191, ***@earthlink.net
It's still legal to go .sigless.
The Ghost In The Machine
2005-01-20 22:05:58 UTC
Permalink
In comp.os.linux.advocacy, Jeff_Relf
<***@Privacy.NET>
wrote
on 20 Jan 2005 19:36:36 GMT
Post by Jeff_Relf
Hi Spooky, Re: Why you haven't you compiled X.CPP using MS C++,
You told me: << Because I don't have MS C++ at home, for starters.
Next question ? >>
Why don't you have Micro-Soft C++ and Visual Studio ?
Because the only thing you know is old-school unix variants ?
I have Borland C++ 4.51. I'm not all that inclined to get
something newer just to satisfy your need for me to compile
your attempts to throw bad code at a good problem. :-P

Besides, I *do* have XMingw32, which is better anyway;
it's a crosscompiler that runs on Linux and generates
Win32 executables. Neat, but it doesn't like X.CPP either.

It's got taste. :-)
--
#191, ***@earthlink.net
It's still legal to go .sigless.
Rick
2005-01-12 22:18:58 UTC
Permalink
Post by Jeff_Relf
Re: X.CPP's HTML to TXT converter in Attachmnts(),
I just fixed a buffer overflow problem
caused by posts that begin like this
(snip)

Why aren't you telling this to people that actually care?
--
Rick
Jeff_Relf
2005-01-14 12:46:34 UTC
Permalink
X.CPP's Attachmnts() now handles the Content-Type: multipart attachemnts
generated by MS Outlook, e.g. news:#***@TK2MSFTNGP12.phx.gbl

Also, it now uses a local buffer for Base64
( called Buff_B64 [ Sz_Buff_B64 ] ).
It was using a global buffer,
but that worked only for e-mails, not Usenet articles.

The problem and the fix are described in the code below
( from http://www.Cotse.NET/users/jeffrelf/X.CPP ).

// BB points to the first line ( not the firt character ).
// EE to one beyond the last line.

Attachmnts ( int Mode, LnA BB, LnA EE ) { LnA TT = 0, PP = BB ; LnP P ;
// while ( ++ PP < EE ) __Fm return ;
if ( Mode == Show_Raw_Header ) {
while ( ++ PP < EE && * * PP ) __Fm BB = PP ; _Fm(("")) }
if ( PP + 1 >= EE ) return ;
if ( EqiN( PP [ 1 ], "<HTML>", 6 ) ) {
while ( ++ PP < EE ) { LnP T, B = * PP, P = B - 1 ; char C = 1 ;
while ( C && * ( T = P + 1 ) ) {
while ( ( C = * ++ P ) && C != '<' ); int Tag = C == '<' && P [ 1 ];
if ( P > T ) { * P = 0 ; P = T - 1 ; C = 1 ;
while ( C && * ( T = P + 1 ) ) {
while ( ( C = * ++ P ) && C != '&' );
if ( ! C || ! P [ 1 ] ) B += Str( B, "%s", T );
else { * P = 0 ; C = * ++ P ; char CC ;
if ( C == '#' ) { CC = atoi( ++ P );
while ( ( C = * ++ P ) && isdigit( C ) ); }
else {
if ( EqiN( P, "lt", 2 ) ) CC = '<' ;
else if ( EqiN( P, "gt", 2 ) ) CC = '>' ; else CC = '¿' ;
while ( ( C = * ++ P ) && C != ';' ); }
B += Str( B, "%s%c", T, CC ); } } }
if ( Tag ) while ( ( C = * ++ P ) && C != '>' ); }
if ( B == * PP ) continue ; __Fm } return ; }
if ( EqN( PP [ 1 ], "-----BEGIN PGP", 14 ) ) BB = PP += 3 ;
Loop( 7 ) if ( ++ PP >= EE || EqN( * PP ,"--", 2 ) ) break; int Body = 0 ;
if ( PP + 1 < EE
&& EqN( * PP ,"--", 2 ) && EqiN( PP [ 1 ],"Content-", 8 ) ) {

// Make TT point to the line that holds the section name/divider.

TT = PP ;
while ( ++ PP < EE && * * PP ) {

// Here it's searching through the attachment's headers.
// ( a blank line, * * PP, terminates the headers )
// If it finds a multipart section it just ignores that header
// and looks for a plain-text attachment somewhere in the next 7 lines.

if ( EqiN( * PP,"Content-Type: multipart", 23 ) ) {
Loop( 7 ) if ( ++ PP >= EE || EqN( * PP ,"--", 2 ) ) break;
if ( PP + 1 < EE
&& EqN( * PP ,"--", 2 ) && EqiN( PP [ 1 ],"Content-", 8 ) )
TT = PP ; }
if ( EqiN( * PP,"Content-Type: text/plain", 24 ) ) Body = 1 ; }
if ( ! Body ) PP = TT ; else {
while ( ++ PP < EE
&& ! ( EqN( * PP,"--", 2 )
&& PP + 1 < EE && EqiN( PP [ 1 ],"Content-", 8 ) ) ) __Fm }
LOOP { if ( PP >= EE ) return ;
TT = PP ; LnP Nam = 0 ; const int NamMax = 300 ;
int TTL = strlen ( * TT ), B64 = 0, Text = 0, HTML = 0 ; LnP B = 0 ;
while ( ++ PP < EE && * * PP ) { P = * PP ;
int _Text, Type = EqiN( P,"Content-Type:", 13 );
if ( Type ) _Text = EqiN( P += 13," Text", 5 ), P += 5 ;
if ( _Text && ( EqiN( P,"/HTML", 5 ) || EqiN( P,"/x-vcard", 8 ) )
|| EqiN( P,"Content-ID:", 11 ) ) { HTML = 1 ; continue ; }
if ( EqiN( P,"Content-Transfer-Encoding: Base64", 33 ) ) {
B64 = 1 ; continue ; }
if ( Type
&& ( ( B = Find ( '"', P, 70 ) )
|| ( B = Find ( '"', PP [ 1 ], 70 ) ) )
&& EqiN( B - 5,"name=", 5 )
&& ( P = Find ( '"', ++ B, NamMax ) ) ) * P = 0, Text = _Text ; }
if ( PP + 1 >= EE ) return ; int Att = B64 && B ; FILE * fp ;
if ( Att ) { LnP P = B, T, SS = "\\/:", S = SS - 1 ;
while ( * ++ S )
while ( T = strchr ( P, * S ) ) * T = '_', P = ++ T ;
fp = fopen ( Nam = P, "wb" ); Att = fp != 0 ;
// TT - BB PP - BB * BB [ 1 ] EE - BB - ( Ln.B + I_Raw )
if ( ! Att )
_Fm ( ( "_ %s _ Can't be Created.", Nam ) ) }
if ( ! Att ) { PP -- ;
while ( ++ PP < EE && ! EqN( * PP, * TT, TTL ) )
if ( ! HTML ) _Fm ( ( "%s", * PP ) )
if ( PP + 1 >= EE ) return ;
if ( EqiN( PP [ 1 ],"Content-", 8 ) ) continue;
Loop( 7 ) if ( ++ PP >= EE || EqN( * PP ,"--", 2 ) ) break;
if ( PP + 1 < EE && EqN( * PP ,"--", 2 )
&& EqiN( PP [ 1 ],"Content-", 8 ) ) continue; return ; }

// This buffer, Buff_B64, is now local
// because Usenet Articles use the global one.

const int Sz_Buff_B64 = 9000 ; char Buff_B64 [ Sz_Buff_B64 ];
P = Buff_B64 - 1 ; uint X, By, Cnt ; X = By = Cnt = 0 ; int WNCR = 1 ;
LOOP { LnP S = * ++ PP ;
if ( ( rv = P - Buff_B64 + 1 ) > Sz_Buff_B64 - 200 )
fwrite( Buff_B64, 1, rv, fp ), P = Buff_B64 - 1 ;
if ( PP + 1 >= EE ) return ;
if ( EqN( * PP, * TT, TTL ) ) {
if ( EqiN( PP [ 1 ],"Content-", 8 ) ) break ;
Loop( 7 ) if ( ++ PP >= EE || EqN( * PP ,"--", 2 ) ) break ;
break ; } S -- ;
LOOP { if ( ! * ++ S ) break ; X <<= 6 ; X |= A_63 [ * S ];
if ( * S != '=' ) By ++ ; if ( ++ Cnt < 4 ) continue;
LnP XP = ( ( LnP ) & X ) + 3 ;
Loop( By * 6 / 8 ) { char C = * -- XP ;
if ( ! Text || C != 13 || WNCR ) * ++ P = C ; WNCR = C != 13 ; }
X = By = Cnt = 0 ; } }
if ( Text ) * ++ P = 13, * ++ P = 10 ;
fwrite( Buff_B64, 1, P - Buff_B64 + 1, fp ); fclose( fp );
_Fm ( ( " Created: _ %s _", Nam ) ) } return ; }
PP = BB ; int Pgp = 0 ; // Ln.P - Ln.B I_Cook
while ( ++ PP < EE ) {
if ( EqN( * PP, "-----BEGIN PGP", 14 ) ) { Pgp = 1 ; continue ; }
if ( Pgp ) {
if ( EqN( * PP, "-----END PGP", 12 ) ) Pgp = 0 ; continue ; }
__Fm } }
.+.+.+.+.+.+

#define LOOP while ( 1 )
#define Loop( N ) int J = - 1, LLL = N ; while ( ++ J < LLL )
#define Eq ! strcmp
#define Eqi ! stricmp
#define EqN ! strncmp
#define EqiN ! strnicmp
#define _Fm( X ) { int p = PP - Ln.B, e = EE - Ln.B, t = TT - Ln.B ; \
Fm X ; PP = Ln.B + p ; EE = Ln.B + e ; TT = Ln.B + e ; }
#define __Fm if ( ! ( * ( P = * PP ) == '>' \
&& ( P [ 1 ] == '>' || P [ 2 ] == '>' ) ) ) _Fm ( ( "%s", P ) )

typedef unsigned char uchar ;
typedef char * LnP ; typedef LnP * LnA ; struct LnT { LnA B, P, E ; };

enum { Body_Only, Show_Raw_Header };

__int64 ER ( __int64 X, __int64 Y ) { return X > Y ? X : Y ; }
__int64 er ( __int64 X, __int64 Y ) { return X < Y ? X : Y ; }

LnP Find ( char C, LnP B, int N ) {
if ( N -- <= 0 ) return 0 ; LnP P = B - 1 ;
LOOP
if ( * ++ P == C ) return P ;
else if ( P - B >= N || ! * P ) return 0 ; }

uchar A_63 [ 'z' + 1 ], _63_A [ 64 ];

.+.+.+.+.+.+

{ LnP CC = "Aa0+/"; int X = -1 ;
Loop( strlen ( CC ) ) {
int L = J > 2 ? 1 : J == 2 ? 10 : 26 ; char C = CC[ J ] - 1 ;
Loop( L ) A_63 [ _63_A[ X ] = ++ C ] = ++ X ; } }
John
2005-01-14 14:03:07 UTC
Permalink
Post by Jeff_Relf
X.CPP's Attachmnts() now handles the Content-Type: multipart attachemnts
Also, it now uses a local buffer for Base64
( called Buff_B64 [ Sz_Buff_B64 ] ).
It was using a global buffer,
but that worked only for e-mails, not Usenet articles.
The problem and the fix are described in the code below
( from http://www.Cotse.NET/users/jeffrelf/X.CPP ).
// BB points to the first line ( not the firt character ).
// EE to one beyond the last line.
Attachmnts ( int Mode, LnA BB, LnA EE ) { LnA TT = 0, PP = BB ; LnP P ;
// while ( ++ PP < EE ) __Fm return ;
if ( Mode == Show_Raw_Header ) {
while ( ++ PP < EE && * * PP ) __Fm BB = PP ; _Fm(("")) }
if ( PP + 1 >= EE ) return ;
if ( EqiN( PP [ 1 ], "<HTML>", 6 ) ) {
while ( ++ PP < EE ) { LnP T, B = * PP, P = B - 1 ; char C = 1 ;
while ( C && * ( T = P + 1 ) ) {
while ( ( C = * ++ P ) && C != '<' ); int Tag = C == '<' && P [ 1 ];
if ( P > T ) { * P = 0 ; P = T - 1 ; C = 1 ;
while ( C && * ( T = P + 1 ) ) {
while ( ( C = * ++ P ) && C != '&' );
if ( ! C || ! P [ 1 ] ) B += Str( B, "%s", T );
else { * P = 0 ; C = * ++ P ; char CC ;
if ( C == '#' ) { CC = atoi( ++ P );
while ( ( C = * ++ P ) && isdigit( C ) ); }
else {
if ( EqiN( P, "lt", 2 ) ) CC = '<' ;
else if ( EqiN( P, "gt", 2 ) ) CC = '>' ; else CC = '¿' ;
while ( ( C = * ++ P ) && C != ';' ); }
B += Str( B, "%s%c", T, CC ); } } }
if ( Tag ) while ( ( C = * ++ P ) && C != '>' ); }
if ( B == * PP ) continue ; __Fm } return ; }
if ( EqN( PP [ 1 ], "-----BEGIN PGP", 14 ) ) BB = PP += 3 ;
Loop( 7 ) if ( ++ PP >= EE || EqN( * PP ,"--", 2 ) ) break; int Body = 0 ;
if ( PP + 1 < EE
&& EqN( * PP ,"--", 2 ) && EqiN( PP [ 1 ],"Content-", 8 ) ) {
// Make TT point to the line that holds the section name/divider.
TT = PP ;
while ( ++ PP < EE && * * PP ) {
// Here it's searching through the attachment's headers.
// ( a blank line, * * PP, terminates the headers )
// If it finds a multipart section it just ignores that header
// and looks for a plain-text attachment somewhere in the next 7 lines.
if ( EqiN( * PP,"Content-Type: multipart", 23 ) ) {
Loop( 7 ) if ( ++ PP >= EE || EqN( * PP ,"--", 2 ) ) break;
if ( PP + 1 < EE
&& EqN( * PP ,"--", 2 ) && EqiN( PP [ 1 ],"Content-", 8 ) )
TT = PP ; }
if ( EqiN( * PP,"Content-Type: text/plain", 24 ) ) Body = 1 ; }
if ( ! Body ) PP = TT ; else {
while ( ++ PP < EE
&& ! ( EqN( * PP,"--", 2 )
&& PP + 1 < EE && EqiN( PP [ 1 ],"Content-", 8 ) ) ) __Fm }
LOOP { if ( PP >= EE ) return ;
TT = PP ; LnP Nam = 0 ; const int NamMax = 300 ;
int TTL = strlen ( * TT ), B64 = 0, Text = 0, HTML = 0 ; LnP B = 0 ;
while ( ++ PP < EE && * * PP ) { P = * PP ;
int _Text, Type = EqiN( P,"Content-Type:", 13 );
if ( Type ) _Text = EqiN( P += 13," Text", 5 ), P += 5 ;
if ( _Text && ( EqiN( P,"/HTML", 5 ) || EqiN( P,"/x-vcard", 8 ) )
|| EqiN( P,"Content-ID:", 11 ) ) { HTML = 1 ; continue ; }
if ( EqiN( P,"Content-Transfer-Encoding: Base64", 33 ) ) {
B64 = 1 ; continue ; }
if ( Type
&& ( ( B = Find ( '"', P, 70 ) )
|| ( B = Find ( '"', PP [ 1 ], 70 ) ) )
&& EqiN( B - 5,"name=", 5 )
&& ( P = Find ( '"', ++ B, NamMax ) ) ) * P = 0, Text = _Text ; }
if ( PP + 1 >= EE ) return ; int Att = B64 && B ; FILE * fp ;
if ( Att ) { LnP P = B, T, SS = "\\/:", S = SS - 1 ;
while ( * ++ S )
while ( T = strchr ( P, * S ) ) * T = '_', P = ++ T ;
fp = fopen ( Nam = P, "wb" ); Att = fp != 0 ;
// TT - BB PP - BB * BB [ 1 ] EE - BB - ( Ln.B + I_Raw )
if ( ! Att )
_Fm ( ( "_ %s _ Can't be Created.", Nam ) ) }
if ( ! Att ) { PP -- ;
while ( ++ PP < EE && ! EqN( * PP, * TT, TTL ) )
if ( ! HTML ) _Fm ( ( "%s", * PP ) )
if ( PP + 1 >= EE ) return ;
if ( EqiN( PP [ 1 ],"Content-", 8 ) ) continue;
Loop( 7 ) if ( ++ PP >= EE || EqN( * PP ,"--", 2 ) ) break;
if ( PP + 1 < EE && EqN( * PP ,"--", 2 )
&& EqiN( PP [ 1 ],"Content-", 8 ) ) continue; return ; }
// This buffer, Buff_B64, is now local
// because Usenet Articles use the global one.
const int Sz_Buff_B64 = 9000 ; char Buff_B64 [ Sz_Buff_B64 ];
P = Buff_B64 - 1 ; uint X, By, Cnt ; X = By = Cnt = 0 ; int WNCR = 1 ;
LOOP { LnP S = * ++ PP ;
if ( ( rv = P - Buff_B64 + 1 ) > Sz_Buff_B64 - 200 )
fwrite( Buff_B64, 1, rv, fp ), P = Buff_B64 - 1 ;
if ( PP + 1 >= EE ) return ;
if ( EqN( * PP, * TT, TTL ) ) {
if ( EqiN( PP [ 1 ],"Content-", 8 ) ) break ;
Loop( 7 ) if ( ++ PP >= EE || EqN( * PP ,"--", 2 ) ) break ;
break ; } S -- ;
LOOP { if ( ! * ++ S ) break ; X <<= 6 ; X |= A_63 [ * S ];
if ( * S != '=' ) By ++ ; if ( ++ Cnt < 4 ) continue;
LnP XP = ( ( LnP ) & X ) + 3 ;
Loop( By * 6 / 8 ) { char C = * -- XP ;
if ( ! Text || C != 13 || WNCR ) * ++ P = C ; WNCR = C != 13 ; }
X = By = Cnt = 0 ; } }
if ( Text ) * ++ P = 13, * ++ P = 10 ;
fwrite( Buff_B64, 1, P - Buff_B64 + 1, fp ); fclose( fp );
_Fm ( ( " Created: _ %s _", Nam ) ) } return ; }
PP = BB ; int Pgp = 0 ; // Ln.P - Ln.B I_Cook
while ( ++ PP < EE ) {
if ( EqN( * PP, "-----BEGIN PGP", 14 ) ) { Pgp = 1 ; continue ; }
if ( Pgp ) {
if ( EqN( * PP, "-----END PGP", 12 ) ) Pgp = 0 ; continue ; }
__Fm } }
.+.+.+.+.+.+
#define LOOP while ( 1 )
#define Loop( N ) int J = - 1, LLL = N ; while ( ++ J < LLL )
#define Eq ! strcmp
#define Eqi ! stricmp
#define EqN ! strncmp
#define EqiN ! strnicmp
#define _Fm( X ) { int p = PP - Ln.B, e = EE - Ln.B, t = TT - Ln.B ; \
Fm X ; PP = Ln.B + p ; EE = Ln.B + e ; TT = Ln.B + e ; }
#define __Fm if ( ! ( * ( P = * PP ) == '>' \
&& ( P [ 1 ] == '>' || P [ 2 ] == '>' ) ) ) _Fm ( ( "%s", P ) )
typedef unsigned char uchar ;
typedef char * LnP ; typedef LnP * LnA ; struct LnT { LnA B, P, E ; };
enum { Body_Only, Show_Raw_Header };
__int64 ER ( __int64 X, __int64 Y ) { return X > Y ? X : Y ; }
__int64 er ( __int64 X, __int64 Y ) { return X < Y ? X : Y ; }
LnP Find ( char C, LnP B, int N ) {
if ( N -- <= 0 ) return 0 ; LnP P = B - 1 ;
LOOP
if ( * ++ P == C ) return P ;
else if ( P - B >= N || ! * P ) return 0 ; }
uchar A_63 [ 'z' + 1 ], _63_A [ 64 ];
.+.+.+.+.+.+
{ LnP CC = "Aa0+/"; int X = -1 ;
Loop( strlen ( CC ) ) {
int L = J > 2 ? 1 : J == 2 ? 10 : 26 ; char C = CC[ J ] - 1 ;
Loop( L ) A_63 [ _63_A[ X ] = ++ C ] = ++ X ; } }
Have you intentionally obfuscated that code?
mlw
2005-01-14 15:37:35 UTC
Permalink
[bad code snipped]
Post by John
Have you intentionally obfuscated that code?
That's the funniest part, no.
Mark Kent
2005-01-16 23:07:10 UTC
Permalink
Post by mlw
[bad code snipped]
Post by John
Have you intentionally obfuscated that code?
That's the funniest part, no.
But that's awful. It looks like commodore pet basic... hang on,
I'm going back to find the line nos...
--
| Mark Kent -- mark at ellandroad dot demon dot co dot uk |
Maturity is only a short break in adolescence.
-- Jules Feiffer
Jeff_Relf
2005-01-17 11:39:03 UTC
Permalink
Hi Mark_Kent ( and MLW ), Re: The attachment handling code that I showed,
You told MLW: << But that's awful.
It looks like commodore pet basic... hang on,
I'm going back to find the line [ ¿ noise ]... >>

I sincerely doubt you could show ( much less write ) an app
that get used throughout the day, every day ( like I did )
present it here ( like I did )
and have eveyone say that it's more readable than my code.
Rick
2005-01-17 11:56:56 UTC
Permalink
Post by Jeff_Relf
Hi Mark_Kent ( and MLW ), Re: The attachment handling code that I showed,
You told MLW: << But that's awful.
It looks like commodore pet basic... hang on,
I'm going back to find the line [ ¿ noise ]... >>
I sincerely doubt you could show ( much less write ) an app
that get used throughout the day, every day ( like I did )
present it here ( like I did )
and have eveyone say that it's more readable than my code.
From what I've read, -everyone- says your code is basically unreadable.
--
Rick
Jeff_Relf
2005-01-17 12:24:54 UTC
Permalink
Hi Rick ( and Mark, MLW ), Re: The attachment handling code that I showed,
You told me: <<
From what I've read, -everyone- says your code is basically unreadable. >>

Compared to what, Rick ?
Some hello-world app that you pulled out of a magazine ?

All you ever do is post one-liners, Rick,
that's the most effort I've ever seen from you, and it's usually a demand.
Rick
2005-01-17 12:49:53 UTC
Permalink
Post by Jeff_Relf
Hi Rick ( and Mark, MLW ), Re: The attachment handling code that I showed,
You told me: <<
From what I've read, -everyone- says your code is basically unreadable. >>
Compared to what, Rick ?
Code that is readable?
Post by Jeff_Relf
Some hello-world app that you pulled out of a magazine ?
Actually, I've only written one program, and that was over 20 years ago.
It was written in ZBasic, and it wasn't documented very well (almost none
at all), either. It was an Advanced Cardiac Life Support tutorial and
seemed to have been used to issue continuing education credits in various
places.
Post by Jeff_Relf
All you ever do is post one-liners, Rick,
That is a lie.
Post by Jeff_Relf
that's the most effort I've ever seen from you, and it's usually a demand.
Another lie.
--
Rick
Jeff_Relf
2005-01-17 13:25:53 UTC
Permalink
Hi Rick ( and Mark, MLW ), Re: What you consider to be readable code,
You told me: <<
Actually, I've only written one program, and that was over 20 years ago.
It was written in ZBasic, and it wasn't documented very well
( almost none at all ), either.
It was an Advanced Cardiac Life Support tutorial
and seemed to have been used to issue continuing education credits
in various places. >>

For almost 12 years now, my professional code ( Bank Management Simulations )
has been heavily documented at the student, administrator
and even the design level ( three seperate manuals ).

I just coded it, I didn't design it. I do the bit twiddling.
The essential design is over 40 years old, in fact,
coming from the Stanford Game.

My games are used by Banking schools in the U.S. and abroad,
I estimate that about a thousand students use them every year.

A couple of organizations want to modify some of my code,
so I've been asked to provide a manual for programmers.
Two programmers in Bellevue ( working out of the PCBS offices )
are under contract to modify it.

I've never actually meet these two guys,
but I honestly think they're Afraid of me.
I've been told that the older of the two
drives a nice car and programmed for Microsoft back in 1990.
Peter Köhlmann
2005-01-14 15:46:48 UTC
Permalink
< snip Relf droppings >
Post by John
Have you intentionally obfuscated that code?
Nope. That asshole thinks he is doing C++
And posts his shit in linux groups, as he is too ashamed to show it in
windows groups, where his idiot peers lurk
--
Who the fuck is General Failure, and why is he reading my harddisk?
The Ghost In The Machine
2005-01-14 20:01:47 UTC
Permalink
In comp.os.linux.advocacy, Peter Köhlmann
<***@t-online.de>
wrote
on Fri, 14 Jan 2005 16:46:48 +0100
Post by Peter Köhlmann
< snip Relf droppings >
Post by John
Have you intentionally obfuscated that code?
Nope. That asshole thinks he is doing C++
The sad thing is, he *is* doing C++. As someone once
said, "one can do Fortran in any language".

X.CPP is an example of this notion.
Post by Peter Köhlmann
And posts his shit in linux groups, as he is too ashamed to show it in
windows groups, where his idiot peers lurk
Maybe he just likes to be vilified. :-)
--
#191, ***@earthlink.net
It's still legal to go .sigless.
Jeff_Relf
2005-01-15 14:12:55 UTC
Permalink
Hi Spooky ( and Pete ), Re: Why I post to Cola when I don't use Linux,
You speculated to Pete: << Maybe he just likes to be vilified. :-) >>

I'm here for the kicks, obviously,
this is a very active group with lots of interesting people.
X.CPP is not my only interest.
Jeff_Relf
2005-01-15 15:10:20 UTC
Permalink
Hi John, Re: This code that I showed ( and more )
from http://www.Cotse.NET/users/jeffrelf/X.CPP: <<
// A_63 is a sparsely populated table
// to convert from Base64's ( MIME ) printable ASCII characters
// ( A-Z, a-z, 0-9, + ) to integers between zero and 63.
// _63_A goes the other way.
uchar A_63 [ 'z' + 1 ], _63_A [ 64 ];
.+.+.+
{ LnP CC = "Aa0+/"; int X = -1 ;
Loop( strlen ( CC ) ) {
int L = J > 2 ? 1 : J == 2 ? 10 : 26 ; char C = CC [ J ] - 1 ;
Loop( L ) A_63 [ _63_A [ X ] = ++ C ] = ++ X ; } }
.+.+.+
#define Loop( N ) int J = - 1, LLL = N ; while ( ++ J < LLL )
typedef char * LnP ; typedef unsigned char uchar ; >>

You asked me: << Have you intentionally obfuscated that code ? >>

No. Using tables like that is very quick and clear,
if you can't read it, may I suggest that the problem is on your end ?
mlw
2005-01-15 16:29:55 UTC
Permalink
Post by Jeff_Relf
Hi John, Re: This code that I showed ( and more )
from http://www.Cotse.NET/users/jeffrelf/X.CPP: <<
// A_63 is a sparsely populated table
// to convert from Base64's ( MIME ) printable ASCII characters
// ( A-Z, a-z, 0-9, + ) to integers between zero and 63.
// _63_A goes the other way.
uchar A_63 [ 'z' + 1 ], _63_A [ 64 ];
.+.+.+
{ LnP CC = "Aa0+/"; int X = -1 ;
Loop( strlen ( CC ) ) {
int L = J > 2 ? 1 : J == 2 ? 10 : 26 ; char C = CC [ J ] - 1 ;
Loop( L ) A_63 [ _63_A [ X ] = ++ C ] = ++ X ; } }
.+.+.+
#define Loop( N ) int J = - 1, LLL = N ; while ( ++ J < LLL )
typedef char * LnP ; typedef unsigned char uchar ; >>
You asked me: << Have you intentionally obfuscated that code ? >>
No. Using tables like that is very quick and clear,
if you can't read it, may I suggest that the problem is on your end ?
Any fool can write something that is difficult to read. It implies nothing
about the reader. The real truth is that it takes talent and skill to
produce something that both works and is easy to read and maintain. This is
called professionalism. A quality, it that must be said, your code lacks in
abundance.
Jeff_Relf
2005-01-17 14:31:47 UTC
Permalink
Hi M.L.W. ( and John ), Re: The Base64 decoder that I showed,
You told me: <<
Any fool can write something that is difficult to read. >>

Any fool can write hard to read code ? Why don't you do it then ?
Write a Base64 decoder that handles attachments in e-mails and Usenet articles,
converts HTML to plain text, etc.,
show it to us and explain exactly why you think it's more readable.
( Even if you could do that, I know the result would just be a bad joke )

Continuing on the subject of hard to read code, You wrote: <<
It implies nothing about the reader. >>

Sure it does, plenty of people can't read Micro-Soft C++ 7.1 .
I put you in that set, MLW, until you demonstrate otherwise.

You concluded: <<
The real truth is that it takes talent and skill to produce
something that both works and is easy to read and maintain.
This is called professionalism.
A quality, it that must be said, your code lacks in abundance. >>

So you say... So you say.
General Protection Fault
2005-01-14 15:18:34 UTC
Permalink
Post by Jeff_Relf
TT = PP ;
while ( ++ PP < EE && * * PP ) {
// Here it's searching through the attachment's headers.
// ( a blank line, * * PP, terminates the headers )
// If it finds a multipart section it just ignores that header
// and looks for a plain-text attachment somewhere in the next 7 lines.
if ( EqiN( * PP,"Content-Type: multipart", 23 ) ) {
Loop( 7 ) if ( ++ PP >= EE || EqN( * PP ,"--", 2 ) ) break;
if ( PP + 1 < EE
&& EqN( * PP ,"--", 2 ) && EqiN( PP [ 1 ],"Content-", 8 ) )
TT = PP ; }
Jeff, I retract one of my earlier statements. Comments do *not* help make
your code any more readable.
--
FreeBSD 4.8-RELEASE i386
9:15AM up 52 days, 14:37, 1 user, load averages: 0.00, 0.03, 0.00
Jeff_Relf
2005-01-15 14:57:10 UTC
Permalink
Hi General_Protection, Re: This from me ( revised ): <<
// Searching through the attachment's headers ( i.e. lines )
// a blank line, ! * * PP, terminates the list of headers.
// If it finds a multipart section it just ignores those headers
// and looks for the beginning of the headers of a plain-text attachment
// somewhere within the next 7 lines.

while ( ++ PP < EE && * * PP ) {
if ( EqiN( * PP,"Content-Type: multipart", 23 ) ) {
Loop( 7 ) if ( ++ PP >= EE || EqN( * PP ,"--", 2 ) ) break;
if ( PP + 1 < EE
&& EqN( * PP ,"--", 2 ) && EqiN( PP [ 1 ],"Content-", 8 ) )
TT = PP ; } >>

You told me: << Jeff, I retract one of my earlier statements.
Comments do * not * help make your code any more readable. >>

But I'm right here to clarify anything if you need it.
General Protection Fault
2005-01-16 16:41:56 UTC
Permalink
Post by Jeff_Relf
Hi General_Protection, Re: This from me ( revised ): <<
// Searching through the attachment's headers ( i.e. lines )
// a blank line, ! * * PP, terminates the list of headers.
// If it finds a multipart section it just ignores those headers
// and looks for the beginning of the headers of a plain-text attachment
// somewhere within the next 7 lines.
while ( ++ PP < EE && * * PP ) {
if ( EqiN( * PP,"Content-Type: multipart", 23 ) ) {
Loop( 7 ) if ( ++ PP >= EE || EqN( * PP ,"--", 2 ) ) break;
if ( PP + 1 < EE
&& EqN( * PP ,"--", 2 ) && EqiN( PP [ 1 ],"Content-", 8 ) )
TT = PP ; } >>
You told me: << Jeff, I retract one of my earlier statements.
Comments do * not * help make your code any more readable. >>
But I'm right here to clarify anything if you need it.
Jeff, one's code should not need clarification from the author.
--
FreeBSD 4.8-RELEASE i386
10:35AM up 5:06, 1 user, load averages: 0.01, 0.03, 0.00
Rick
2005-01-16 17:43:43 UTC
Permalink
Post by General Protection Fault
Post by Jeff_Relf
Hi General_Protection, Re: This from me ( revised ): <<
// Searching through the attachment's headers ( i.e. lines )
// a blank line, ! * * PP, terminates the list of headers.
// If it finds a multipart section it just ignores those headers
// and looks for the beginning of the headers of a plain-text attachment
// somewhere within the next 7 lines.
while ( ++ PP < EE && * * PP ) {
if ( EqiN( * PP,"Content-Type: multipart", 23 ) ) {
Loop( 7 ) if ( ++ PP >= EE || EqN( * PP ,"--", 2 ) ) break;
if ( PP + 1 < EE
&& EqN( * PP ,"--", 2 ) && EqiN( PP [ 1 ],"Content-", 8 ) )
TT = PP ; } >>
You told me: << Jeff, I retract one of my earlier statements.
Comments do * not * help make your code any more readable. >>
But I'm right here to clarify anything if you need it.
Jeff, one's code should not need clarification from the author.
You are talkig to Jeff_Relf. He thinks his way is the One True Way. Always.
--
Rick
Jeff_Relf
2005-01-17 13:54:27 UTC
Permalink
Hi Rick ( and General Protection )
Re: GP's difficulty reading my code,
You told him: << You are talkig to Jeff_Relf.
He thinks his way is the One True Way. Always. >>

It's meaningless to just say my code is unreadable,
how do I know that you're not just plain illiterate ?

If you wanted to sound intelligent, for a change,
you'd have to compare X.CPP to another program of similar utility,
explaining exactly why you think it's more readable.
Rick
2005-01-17 14:34:29 UTC
Permalink
Post by Jeff_Relf
Hi Rick ( and General Protection )
Re: GP's difficulty reading my code,
You told him: << You are talkig to Jeff_Relf.
He thinks his way is the One True Way. Always. >>
It's meaningless to just say my code is unreadable,
how do I know that you're not just plain illiterate ?
If you wanted to sound intelligent, for a change,
you'd have to compare X.CPP to another program of similar utility,
explaining exactly why you think it's more readable.
Your statement has no relation to your quotation.
--
Rick
William Poaster
2005-01-17 14:58:49 UTC
Permalink
begin It was on Mon, 17 Jan 2005 09:34:29 -0500, that Rick scribbled
Post by Rick
Post by Jeff_Relf
Hi Rick ( and General Protection )
Re: GP's difficulty reading my code,
You told him: << You are talkig to Jeff_Relf.
He thinks his way is the One True Way. Always. >>
It's meaningless to just say my code is unreadable,
how do I know that you're not just plain illiterate ?
If you wanted to sound intelligent, for a change,
you'd have to compare X.CPP to another program of similar utility,
explaining exactly why you think it's more readable.
Your statement has no relation to your quotation.
If he's so confident that his so-called coding is ok, *why* doesn't he go
& talk about it in a group where coding is discussed? Is he afraid to?
Afraid he'd be laughed out of court? He sounds like a complete tosser to
me.
Jeff_Relf
2005-01-18 14:06:28 UTC
Permalink
Hi Bill Poster, Re: The code I showed from X.CPP, You asked Rick: <<
If he's so confident that his so-called coding is ok,
why doesn't he go & talk about it in a group where coding is discussed ?
Is he afraid to ? Afraid he'd be laughed out of court ?
He sounds like a complete tosser to me. >>

The coding groups are very dry with ultra low traffic.
mlw
2005-01-18 15:19:59 UTC
Permalink
Post by Jeff_Relf
Hi Bill Poster, Re: The code I showed from X.CPP, You asked Rick: <<
If he's so confident that his so-called coding is ok,
why doesn't he go & talk about it in a group where coding is discussed ?
Is he afraid to ? Afraid he'd be laughed out of court ?
He sounds like a complete tosser to me. >>
The coding groups are very dry with ultra low traffic.
Post your code, the groups will light up with laughter.
Jim Richardson
2005-01-16 19:04:06 UTC
Permalink
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Sun, 16 Jan 2005 16:41:56 GMT,
Post by General Protection Fault
Post by Jeff_Relf
Hi General_Protection, Re: This from me ( revised ): <<
// Searching through the attachment's headers ( i.e. lines )
// a blank line, ! * * PP, terminates the list of headers.
// If it finds a multipart section it just ignores those headers
// and looks for the beginning of the headers of a plain-text attachment
// somewhere within the next 7 lines.
while ( ++ PP < EE && * * PP ) {
if ( EqiN( * PP,"Content-Type: multipart", 23 ) ) {
Loop( 7 ) if ( ++ PP >= EE || EqN( * PP ,"--", 2 ) ) break;
if ( PP + 1 < EE
&& EqN( * PP ,"--", 2 ) && EqiN( PP [ 1 ],"Content-", 8 ) )
TT = PP ; } >>
You told me: << Jeff, I retract one of my earlier statements.
Comments do * not * help make your code any more readable. >>
But I'm right here to clarify anything if you need it.
Jeff, one's code should not need clarification from the author.
Do you think that even Jeff could clarify his code?

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)

iD8DBQFB6rqmd90bcYOAWPYRAk9PAKCkLMSaV6oZ4TbqIMpQhumTmmFRAgCggSur
jx56+wGP1iIO8rM4PyFt/WI=
=F5O6
-----END PGP SIGNATURE-----
--
Jim Richardson http://www.eskimo.com/~warlock
The nice thing about Windows is - It does not just crash, it displays
a dialog box and lets you press 'OK' first.
Jeff_Relf
2005-01-17 13:46:16 UTC
Permalink
Hi Jim ( and General Protection ),
Re: The HTML to TXT converer that I showed in Attachmnts()
( 18 lines, 68 columns ) which I constantly use and improve,

You asked GP: << Do you think that even Jeff could clarify his code ? >>

Ask me and find out... if you could think of a serious question, that is.
Jeff_Relf
2005-01-16 22:23:25 UTC
Permalink
Hi General_Protection,
You wrote: << one's code should not need clarification from the author. >>

No code absolutely requires clarification,
given sufficient determination and the ability to compile/debug it,
I can read it.

Having the author of the code around is better than a trillion code-comments.

X.CPP is not a hello-world app, so of course it requires effort.

If you can write something that _ I _ think is just as good
and that other people here find easier to read, I'd like to see it.

I can read X.CPP almost as easily as I can read the funny pages,
...It's that simple to me.
mlw
2005-01-17 05:29:27 UTC
Permalink
Post by Jeff_Relf
X.CPP is not a hello-world app, so of course it requires effort.
Yes *all* code requires an amount of effort. If the amount of time and
effort required to completely understand the code, enough to modify and fix
bugs, exceeds the amount of time to write the code in the first place, the
code is a waste.

I would argue, as many would agree, that your code is far too obfuscated to
be useful. You may counter with "I can read it," and while that may be
true, I can say that I can read my own handwriting, but I know of few other
human beings that can say that they can. The difference? I know my hand
writing is bad, while you think everyone is just confused about your code.

FYI: They ain't.
Jeff_Relf
2005-01-17 13:03:10 UTC
Permalink
Hi M.L.W.,
Re: The code I've shown from X.CPP including an HTML to TXT converter,
You told me: << Yes all code requires an amount of effort.
If the amount of time and effort required to completely understand the code,
enough to modify and fix bugs, exceeds
the amount of time to write the code in the first place,
the code is a waste. >>

I'm continually fixing bugs and enhancing X.CPP,
I don't rewrite it every time.

Take a look at the HTML to TXT converter that I showed in Attachmnts(),
it's all of 18 lines, the longest of which is 68 columns.
That's beauty and elegance, if you're asking me.

Just today it converted an HTML-only e-mail that my sister sent me
using Hotmail.COM ... This app gets used dude.

You told me: << I would argue, as many would agree,
that your code is far too obfuscated to be useful. >>

Sure, You have to have know a lot about Visual Studio 2003
and it's VBA macros, as well as Micro-Soft C++ 7.1 to use X.CPP,
so I'm the only one using it... that alone makes it harder to read,
...but that's your problem, not mine.
You get inferior e-mail and Usenet handling as a result.

You concluded with: << You may counter with " I can read it,"
and while that may be true, I can say that I can read my own handwriting,
but I know of few other human beings that can say that they can.
The difference ? I know my hand writing is bad,
while you think everyone is just confused about your code.

FYI: They ain't. >>

My handwritting can be read by anyone, I print using all caps,
larger caps are used where others use caps ( draftsman style ).
I use permanent ink, felt-tip, red, on 3 by 5 cards,
which I carry with me everywhere I go.

You claim that my code is obfuscated, I claim that you're a poor reader,
But, quite unlike you, anyone can see what I wrote:
http://www.Cotse.NET/users/jeffrelf/X.CPP
John
2005-01-17 16:27:21 UTC
Permalink
Post by Jeff_Relf
Hi M.L.W.,
Re: The code I've shown from X.CPP including an HTML to TXT converter,
You told me: << Yes all code requires an amount of effort.
If the amount of time and effort required to completely understand the code,
enough to modify and fix bugs, exceeds
the amount of time to write the code in the first place,
the code is a waste. >>
I'm continually fixing bugs and enhancing X.CPP,
I don't rewrite it every time.
Take a look at the HTML to TXT converter that I showed in Attachmnts(),
it's all of 18 lines, the longest of which is 68 columns.
That's beauty and elegance, if you're asking me.
Just today it converted an HTML-only e-mail that my sister sent me
using Hotmail.COM ... This app gets used dude.
You told me: << I would argue, as many would agree,
that your code is far too obfuscated to be useful. >>
Sure, You have to have know a lot about Visual Studio 2003
and it's VBA macros, as well as Micro-Soft C++ 7.1 to use X.CPP,
so I'm the only one using it... that alone makes it harder to read,
...but that's your problem, not mine.
You get inferior e-mail and Usenet handling as a result.
You concluded with: << You may counter with " I can read it,"
and while that may be true, I can say that I can read my own handwriting,
but I know of few other human beings that can say that they can.
The difference ? I know my hand writing is bad,
while you think everyone is just confused about your code.
FYI: They ain't. >>
My handwritting can be read by anyone, I print using all caps,
larger caps are used where others use caps ( draftsman style ).
I use permanent ink, felt-tip, red, on 3 by 5 cards,
which I carry with me everywhere I go.
You claim that my code is obfuscated, I claim that you're a poor reader,
http://www.Cotse.NET/users/jeffrelf/X.CPP
Jeff,

With all due respect, doesn't the top one look better than the bottom?
Imagine if you used proper variable names as well. It may give you some
staisfaction to code QSort in 7 lines rather than 17, but if no-one else
can tell what it does, what's the point? You might as well destroy the
source.

void QSort_Pnts ( LsA _B, LsA _E ) {
if ( _E <= _B ) return;
LsA B = _B - 1, E = _E + 1 ;
int Pnts = ( * _B )->Pnts ;
LOOP {
while ( ( * ++ B )->Pnts > Pnts );
while ( E >= B && ( * -- E )->Pnts < Pnts );
if ( E < B ) break;
if ( B < E ) {
LsP T = * B ;
* B = * E ;
* E = T ;
}
}
QSort_Pnts ( _B , E );
QSort_Pnts ( E + 1, _E );
}

void QSort_Pnts ( LsA _B, LsA _E ) { if ( _E <= _B ) return;
LsA B = _B - 1, E = _E + 1 ; int Pnts = ( * _B )->Pnts ;
LOOP { while ( ( * ++ B )->Pnts > Pnts );
while ( E >= B && ( * -- E )->Pnts < Pnts );
if ( E < B ) break;
if ( B < E ) { LsP T = * B ; * B = * E ; * E = T ; } }
QSort_Pnts ( _B, E ); QSort_Pnts ( E + 1, _E ); }

As an exercise, why not use words for the variable names, throw in a few
comments and re-post the top example? We can then have a vote on the
pros and cons of each option.

John
Jeff_Relf
2005-01-17 22:27:05 UTC
Permalink
Hi John, Re: How you rewrapped QSort_Pnts() from X.CPP,
You asked me: <<
With all due respect, doesn't the top one look better than the bottom ? >>

As I just finished telling Spooky ( The Ghost ),
X.CPP doesn't auto-wrap e-mails or Usenet articles,
...because re-wrapping stuff by hand is essential to how I read.

So, for me, I don't care how you wrap lines,
I even change my wrapping style myself from time to time,
...because all that matters to me is that I/you wrap by hand.

You told me: << Imagine if you used proper variable names as well.
It may give you some staisfaction to code QSort in 7 lines rather than 17,
but if no-one else can tell what it does, what's the point ?
You might as well destroy the source. >>

Wait a minute... you do know that I'm the sole user/coder of X.CPP don't you ?
Every identifier is named how I wanted them ( at least at the time ).

You'd have to actually run X.CPP under Visual Studio to truly understand it,
but I think your having to rewrap the lines would only help, not hurt,
...Me doing that for you wouldn't do any good for anyone.

You asked me: << As an exercise, why not use words for the variable names,
throw in a few comments and re-post the top example ?
We can then have a vote on the pros and cons of each option. >>

Everyone uses whitespace as they choose,
and I think those choices should, in fact, change periodically.

However I'd be more than happy to explain QSort_Pnts().

// QSort_Pnts() sorts the score that each Usenet article is given ( Pnts ).
// The score is merely a count of how frequently the article's Message-ID
// is found in the 5 most recent Message-IDs
// as found in the References headers of the last 1,200+ articles
// LsA is a ( dynamic ) array of pointers as defined below:
// struct HeaderT {
// LnP NG, MID, _1, _2, _3, _4, _5, Title, Name_Date_Path_Reader ; };
//
// struct NodeT { int HasH, FromTo, Del, Pnts ;
// HeaderT H ; int Num ; int BodyCnt ; LnA Body ; };
//
// typedef NodeT * LsP ; typedef LsP * LsA ;
//
// _B is the array, _E points to the last element of the array.

void QSort_Pnts ( LsA _B, LsA _E ) {

// Pop out one level when _E == _B

if ( _E <= _B ) return;

// B scans from left to right, E from right to left.
// All elements have been scanned when they meet in the middle,
// at which point the array will then be split in half at E
// and the whole process will be recursively repeated.

LsA B = _B - 1, E = _E + 1 ;

// The_Comparison is
// the element to which all other elements will be compared.
// Notice that X.CPP is now using the middle element of the array
// instead of the leftmost one... I don't know if that matters or not.

int The_Comparison = _B [ ( _E - _B ) / 2 ]->Pnts ;

// LOOP forever... while ( 1 )

LOOP {

// Scanning from the left end of the array,
// stop when an element is less than or equal to The_Comparison.

while ( ( * ++ B )->Pnts > The_Comparison );

// Going from the right end of the array,
// stop when an element is greater than or equal to The_Comparison.

while ( E >= B && ( * -- E )->Pnts < The_Comparison );


if ( E <= B ) // The E < B that I showed before was a poor idea.

// All elements have been considered, so break out of the loop.

break;

// Swap the left and the right elements ( pointers ).

LsP T = * B ; * B = * E ; * E = T ; }

// Now that we've considered all the elements,
// split the array of pointers in half at where B and E met
// and do the same thing with each of the two halves.

QSort_Pnts ( _B, E ); QSort_Pnts ( E + 1, _E ); }

Of course I don't mind such verbage in my code to answer your question,
in fact you made me cleanup that code up quite a bit,
...but no way in hell would I want to look at that verbage myself all the time,
so I always remove the comments and extra whitespace.

Comments ( including long identifiers ) signal trouble to me,
...it means that something needs attending to.
Jeff_Relf
2005-01-18 00:58:54 UTC
Permalink
Oops, I just realize that, given the change I made to QSort_Pnts(),
I need to add E < _E ? E : -- E like this:
QSort_Pnts ( _B, E < _E ? E : -- E ); QSort_Pnts ( E + 1, _E );

Otherwise it might never pop out.
General Protection Fault
2005-01-18 01:41:06 UTC
Permalink
Post by Jeff_Relf
Oops, I just realize that, given the change I made to QSort_Pnts(),
QSort_Pnts ( _B, E < _E ? E : -- E ); QSort_Pnts ( E + 1, _E );
Otherwise it might never pop out.
You didn't need to post that; the error was so obvious we all picked it out
upon cursory examination.
--
FreeBSD 4.8-RELEASE i386
7:35PM up 1 day, 14:06, 1 user, load averages: 0.00, 0.03, 0.00
Jeff_Relf
2005-01-18 13:28:37 UTC
Permalink
Hi General_Protection, Re: Adding E < _E ? E : -- E like this:
<< QSort_Pnts ( _B, E < _E ? E : -- E ); QSort_Pnts ( E + 1, _E ); >>
to prevent what might become an infinite rescursion,

You told me: << You didn't need to post that; the error was so obvious
we all picked it out upon cursory examination. >>

You're joking right ?

The ultra-famous Quick-Sort Al Gore Rhythm is a bit hard like that,
...you can't blame me for that.

By the way, you don't_need/shouldn't_use X.CPP to test QSort_Pnts(),
a simple Test.CPP file with a call from main() could be used.
Loading...