Article View: news.software.readers
Article #230734Now using labels and goto's instead of β while() β.
From: Jeffβ²Relf
Date: Sat, 28 Feb 2009 06:28
Date: Sat, 28 Feb 2009 06:28
76 lines
4334 bytes
4334 bytes
Oops, that last try didn't work for posts under 5 lines.
Now using labels and goto's instead of β while() β.
At the end of the loop though all lines of the body ..
if, for lack of lines, it can't complete the check for attribution
lines, it goes to β reScan: β ( to print ) instead of to β EoScan: β.
>From β JeffRelf.F-M.FM/X.CPP β:
// This line was explained up the thread.
if ( ! Checked && ( Checked = 1, MimeHeader ) ) goto Attach ;
// Some test cases:
// news:d7adnXU3PJxXNhLUnZ2dnUVZ_g-WnZ2d@centurytel.net
// news:Xns9BB19489DD7E82362352@127.0.0.1
// news:Jeff_Relf@Seattle.2009_Feb.27|8.55pm|w
int cntBL = 0, β = 0 ;
LnP prnQ1 = 0, prnQ2 = 0, Λ = L"Λ" ; LnA QQ = BB - 1 ;
reScan:
// Might pass through here twice:
// once to check for attribution lines, and again to print.
PP = BB - 1 ; int wrpQL, QL = 0 ;
nxLn:
// Seen once for each line in the body of a post, eMail
// or PlainText attachment.
if ( ++ PP >= EE || !( P = B = * PP )
|| ( MimeSep && EqN( B, * MimeSep, Sz_MimeSep ) ) )
if ( β )
// Checked for attribution lines and done printing the body.
goto EoScan ;
else {
// Can't complete the check for attribution lines;
// they don't exist, goto β reScan: β ( to print ).
β = 1 ; goto reScan ; }
// The following lines were explained up the thread;
// now using β goto nxLn β instead of β continue β
// and β goto EoScan β instead of β break β.
if ( Q && PP > QQ ) { QQ = PP ; int SzB = strSz( B );
wchar_t & Ch
= SzB <= 1 || B[ SzB - 2 ] == '=' ? B[ SzB ] : B[ SzB - 1 ];
if ( Ch != '=' ) unQ( B );
else { SzB --, Ch = 0 ; if ( PP + 1 >= EE ) goto nxLn ;
LnP B2 = PP[ 1 ];
int SzB2 = strSz( B2 ), SzBigB = SzB + SzB2 + 1 ;
LnP BigB = PP[ 1 ] = MallocTmp( SzBigB * SzChar );
wmemmove( BigB, B, SzB ),
wmemmove( BigB + SzB, B2, SzB2 + 1 ); goto nxLn ; } }
wrpQL = QL, Ch = * B, QL = isQL ;
// Checked for attribution lines ?
if ( !β ) { β = QL, cntBL += !*B ;
if ( cntBL >= 2 || PP - BB > 5 ) {
// No attribution lines; goto β reScan: β ( to print ).
β = 1 ; goto reScan ; }
if ( !β ) goto nxLn ; }
if ( QL ) { if ( !prnQ2 ) prnQ2 = Λ ;
P = B ; While( Ch <= 32 || οΌ );
if ( Ch
&& !( isQL || EqiN( P, L"- Show q", 8 )
|| EqiN( P, L"- Hide q", 8 ) ) )
prnQ1 = prnQ2, prnQ2 = B ; goto nxLn ; }
if ( Eq( B, L"- -- " ) || Eq( B, L"--" )
|| Eq( B, L"-- " ) || EqN( B, L"-----BEGIN PGP SIGNA", 20 ) ) {
// Four different sigs, to end the printing.
Sh( L"\"%s\"", B ); goto EoScan ; }
if ( wrpQL && 1 + PP < EE && ( P = PP[1] ) && ( Ch = * P, οΌ ) )
goto nxLn ;
if ( prnQ2 ) { if ( prnQ1 && prnQ1 != Λ ) Sh( L"%s", prnQ1 );
Sh( L"%s", prnQ2 ), prnQ1 = prnQ2 = 0 ; }
Sh( L"%s", B ); goto nxLn ;
EoScan: PP -- ; skipToHdr
Attach:
.....
Technical Details
Message-ID:
<Jeff_Relf@Seattle.2009_Feb.27|10.28pm|X>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.20140922.mbox.gz!border1.nntp.ams.giganews.com!nntp.giganews.com!xlned.com!feeder3.xlned.com!news2.euro.net!newsfeed.freenet.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mailReferences:
<1ivra6k.s0l2dp1m2bahfN%snipe@spambin.fsnet.co.uk> <ac87b$49a6f99f$5ed00124$25389@cache6.tilbu1.nb.home.nl> <slrngqe9hu.67t.pjr@pjr.gotdns.org> <1ivrr1f.1dzjg4tlyoocaN%snipe@spambin.fsnet.co.uk> <Jeff_Relf@Seattle.2009_Feb.26|11.32pm|y> <Jeff_Relf@Seattle.2009_Feb.26|11.57pm|n> <Jeff_Relf@Seattle.2009_Feb.27|0.38am|K> <Jeff_Relf@Seattle.2009_Feb.27|8.44pm|q>Show Full Headers
Complete Article Headers
Message-ID: <Jeff_Relf@Seattle.2009_Feb.27|10.28pm|X> Subject: Now using labels and goto's instead of β while() β. Date: Sat, 28 Feb 2009 06:28:31 +0000 From: Jeffβ²Relf <Jeff_Relf@Seattle.TEST> References: <1ivra6k.s0l2dp1m2bahfN%snipe@spambin.fsnet.co.uk> <ac87b$49a6f99f$5ed00124$25389@cache6.tilbu1.nb.home.nl> <slrngqe9hu.67t.pjr@pjr.gotdns.org> <1ivrr1f.1dzjg4tlyoocaN%snipe@spambin.fsnet.co.uk> <Jeff_Relf@Seattle.2009_Feb.26|11.32pm|y> <Jeff_Relf@Seattle.2009_Feb.26|11.57pm|n> <Jeff_Relf@Seattle.2009_Feb.27|0.38am|K> <Jeff_Relf@Seattle.2009_Feb.27|8.44pm|q> Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.20140922.mbox.gz!border1.nntp.ams.giganews.com!nntp.giganews.com!xlned.com!feeder3.xlned.com!news2.euro.net!newsfeed.freenet.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail Newsgroups: news.software.readers Lines: 76 Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Trace: individual.net eIwRAi9RL6fdzCHTJ8xv5gdHIVqX/fREltTUNf4e2NF/y5V7H+ Cancel-Lock: sha1:I5DKOxOgnPACnW5cUQvYbGr7a24= User-Agent: JeffRelf.F-M.FM/X.ZIP