Article View: alt.free.newsservers
Article #146825Re: Most often, the best code ( for me, and only me ) is the code I wrote.
From: xxein
Date: Tue, 01 Jan 2013 00:33
Date: Tue, 01 Jan 2013 00:33
79 lines
6971 bytes
6971 bytes
On Dec 30, 9:20Â pm, Jeff-Relf.Me <@.> wrote:
> Â Most often, the best code ( for me, and only me ) is the code I wrote. As a programmer, text comparison is like water; an essential, daily thing. So I wrote my own diff routine ( as part of X.EXE, my console/newsreader ). At it's heart, and right off the bat, my "diff" sort of "skips past" the unchanged part at the beginning and the ends of both lines and files. A run of whitespace, including "new lines" ( ASCII 13 and 10 ), is treated as if it were a single space ( ASCII 32 ). I could've stopped right there, if I wanted to, as that is (almost) good enough; but I didn't. The heart of the line/token comparison routine looks like this: #define white( P ) ( *P <= 32 || *P == 0xA0 ) #define Data ( ToData( P, EEx, EE, SyncCnt ), ToData( _P, _EEx, _EE, _SyncCnt ), EEx < EE && _EEx < _EE ) ToData( LnP &P, LnA &EEx, LnA EE, int &SyncCnt ) { if ( P ) while( *P && white( P ) ) P++ ; while( ( !P || !*P ) && EEx < EE ) ( ++EEx >= EE ? ( P = 0, 0 ) : ( P = *EEx, SyncCnt += !!*P ) ); } LnA BBx, EEx, _BBx, _EEx ; int SyncCnt, _SyncCnt ; int inSync( int minSyncCnt, LnA BB, LnA EE, LnA _BB, LnA _EE ) { int rv ; LnP P, _P ; LnA PP, _PP ; BBx = PP = EEx = BB, _BBx = _PP = _EEx = _BB, SyncCnt = _SyncCnt = 0, P = _P = 0, EEx--, _EEx-- ; while ( Data ) { while( *P && *P == *_P && !white( _P ) ) P++, _P++ ; if ( !white( P ) || !white( _P ) ) return 0 ; if ( !*P && !*_P && ( SyncCnt + _SyncCnt ) / 2 >= minSyncCnt ) return Data, 1 ; } return 0 ; } #define EoFS ( S = PPâ‹…Slow < EE, _S = _PPâ‹…Slow < _EE, F = PPâ‹…Fast < EE, _F = _PPâ‹…Fast < _EE ) ReSync( int minSyncCnt, LnA BB, LnA EE, LnA _BB, LnA _EE ) { int S, _S, F, _F ; LnA PPâ‹…Slow, PPâ‹…Fast, _PPâ‹…Slow, _PPâ‹…Fast ; PPâ‹…Slow = BB, _PPâ‹…Slow = _BB ; Top_: PPâ‹…Fast = BB, _PPâ‹…Fast = _BB ; Down: if ( EoFS, !S && !_S ) { BBx = EEx = EE, _BBx = _EEx = _EE ; return ; } if ( F && _S ) if ( inSync( minSyncCnt, PPâ‹…Fast, EE, _PPâ‹…Slow, _EE ) ) return; else PPâ‹…Fast++ ; if ( S && _F ) if ( inSync( minSyncCnt, PPâ‹…Slow, EE, _PPâ‹…Fast, _EE ) ) return; else _PPâ‹…Fast++ ; if ( EoFS, F && _S || S && _F ) goto Down ; PPâ‹…Slow += S, _PPâ‹…Slow += _S ; goto Top_ ; } â‹…â‹…â‹…â‹…â‹…â‹…â‹…â‹…â‹…â‹…â‹…â‹…â‹…â‹…â‹…â‹…â‹…â‹…â‹…â‹…â‹…â‹…â‹…â‹…â‹…â‹…â‹…â‹…â‹…â‹…â‹… WhileSynced: if ( Vx.PP >= Vx.ee || _Vx.PP >= _Vx.ee ) { VxPPă‚ ( Diffâ‹…Ch, Vx.ee, _Vx.ee ), Str( D, L"%s", D2 ); return Bâ‹…D ; } if ( rv = inSync( 99, Vx.PP, Vx.ee, _Vx.PP, _Vx.ee ), VxPPă‚ ( textâ‹…Ch, EEx, _EEx ), rv ) goto WhileSynced ; ReSync( 2, Vx.PP, Vx.ee, _Vx.PP, _Vx.ee ), VxPPă‚ ( Diffâ‹…Ch, BBx, _BBx ); goto WhileSynced ; }
xxein: ZZZ. Sorry. I dozed off trying to find a meaning for this.
Did you mean
69}dL7'lleO:0u}}OOXX``j<<Xuu*<<:88Brr1NN^Xy++447{bJ5%jj0qgJJRR(w=
tW__1==b)#//Ty''ZUE*M=33<HH|m3tjMUU6frrSx?9EE&Kp||]2-{`%siir
Ejdd""GllrxxY E??[[<a((11eVz]S6>>jZ,,2bnn<,MMSx?9EEqa$$InzzeUKKQ&!
oTwg]]ffccN66>>nnwwpZE3x"",\
\bhhaK6,qyyKKTT]]/:EE``YC.zaiiqqrDDB@@AK{{&&,22W|vv44Y ))11<Gl3--Khh/
TTss{{MMjjz((88AA[[cc55RR\#HBNN#|lQtdZZe$$%&0``iir//..ZJkk/QKWW|
C=II*LnhttUzA;;VVA1''ZUE*M=3?? SN>#F6,,GG2"vvaQ&!oT\\G7--zeU*%sX{kamm;
+LLn2>>jZ{{BgssA1RR3Uw%%QAbbCh//8855 nddXPPkk9)YY+77vHHcc1!
BBrDPP1a33NNp4..KK{MMjj1VPPmm1S__@b& ==|N ==|Chbb!!`
$FRR'"pUxh^^{{\1,z_$rhh''7CCss22qCC``p||Chbo|**i0UO\ii&&}gR@''//
S6,mmvvsslVA/t||(XX^ddn@@]zz&e77=CCD='pfMUU6ffooxxJU`llM}*55PP;##++,
%mXN5==mmvvtrrslVA7|&&e77@@II=$xocSScc iQQYYZd66<BBCM.^^djjrrGB2u:* +
+j?:*m2"vv!!00BB`}}lWGzueJm]SS\\P7-$vff,mcFRRcc }}qXNE9))99TTSSV<#iTD+
+PAg<<DDww66f8qF4%||::_&22qFFccDtF!TB3,,HH)Ns!!GGdd6fAgJ?
55QQv=II*PPmmN P+Q4)}};;zAffooC*]XH-55 nddS>.a\L1TD:FFrb%
%GiuuC3TTy@LLxh++j.P\
\*x;;zAffoollWG==p||]2>>dppQww44`PqqCsN#o`Yee7gBhK@6BB#S%^3!
piuuV(X3Y<1''BBrD}R@1**GGi-99xJzU*vg``}}
^"DD__5&vWqqCsNtWLBB__#EQQ2b4m5vkaa
_#EE``&un^xxcKKSSxi1dppqFFLRRS4ggppmm1SMMjj1VPPmm4YeeFh,&&CC$Inhh''f-
RRmmaH>5)ww4433|ddll44:@@!TT]]H0088#qFA1t||kVFytdIl
\R^^0`;aD9/;;`'33rDtO$paZffGl33<<EE9 tk_OjjQ?4yyK{V|_TJU``{{fNNVV+
+177v>>GG2xx""k[0+y^ffU@0c^N3VF<HHxJ%XF70<<a(44sEuPvYNDPP1V{{&&//
#h^UI9TT;)|ccDtF!G*}s ++FF1ww!!F7]2>>ddjppQ&&
$""UU[aaBhhqqZKA22VG@00KK{M([I:33>[[0<<{M}X-yjccn--lAA\\E6,{{QB4ss00//
hC|W2kF!Z5nI$]8qL'`;tO*c>wR-fAzzS=(t[0+y^E+EE0vv VP^0`` ==sm{bIIGEE&
\Vd6ff&CC$ZTbI009966lf8h)11U@(nIlVbb:4B)nzz[3-;"ggp||QG;CCgssACH=?
KKo##,GG;"vmaQQsNrr//..w__gg[SSpp[K yiNVVo*66lftFv$
$ZTbI0<<{SM[-]iiJ"z*oVV_kkC=m?^ff\C=3l1y''LqkwwX}D>>GSSG??
HH1"vgg@*saH{vfK2vv33eL!zjOWWiuuMGU'Wcc;5C*o{{\4.<l>JJ+a[iP77@LL$|N ?
GGkV>&_$lxx<^XddEg+%%.II2#whhA+tbI|wgL3ww443 ?
I totally missed it. It's my fault.
Technical Details
Message-ID:
<8330bd6d-a584-4610-8a00-2cecce320e9c@z8g2000yqo.googlegroups.com>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!mbox2nntp-alt.free.newsservers.20150605.mbox.gz!border1.nntp.ams3.giganews.com!border1.nntp.ams2.giganews.com!border3.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!feeder3.cambriumusenet.nl!feed.tweaknews.nl!209.85.216.87.MISMATCH!ee4no9973914qab.0!news-out.google.com!k2ni4226qap.0!nntp.google.com!ee4no10087245qab.0!postnews.google.com!z8g2000yqo.googlegroups.com!not-for-mailReferences:
<Jeff-Relf.Me@Dec.30{6.20.PM.Seattle.2012}>Show Full Headers
Complete Article Headers
Message-ID: <8330bd6d-a584-4610-8a00-2cecce320e9c@z8g2000yqo.googlegroups.com>
Subject: Re: Most often, the best code ( for me, and only me ) is the code I wrote.
Date: Tue, 01 Jan 2013 00:33:44 +0000
From: xxein <xxein@att.net>
References: <Jeff-Relf.Me@Dec.30{6.20.PM.Seattle.2012}>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!mbox2nntp-alt.free.newsservers.20150605.mbox.gz!border1.nntp.ams3.giganews.com!border1.nntp.ams2.giganews.com!border3.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!feeder3.cambriumusenet.nl!feed.tweaknews.nl!209.85.216.87.MISMATCH!ee4no9973914qab.0!news-out.google.com!k2ni4226qap.0!nntp.google.com!ee4no10087245qab.0!postnews.google.com!z8g2000yqo.googlegroups.com!not-for-mail
X-Received: by 10.224.181.140 with SMTP id by12mr22924717qab.0.1357000424893;
MIME-Version: 1.0
Received: by 10.49.1.70 with SMTP id 6mr6295566qek.27.1357000424866; Mon, 31
Newsgroups: comp.os.linux.advocacy, alt.free.newsservers, sci.physics, alt.astronomy
alt.astronomy
Complaints-To: groups-abuse@google.com
Injection-Info: z8g2000yqo.googlegroups.com; posting-host=66.229.156.164;
posting-account=5Th4nAoAAABvCDu6tWl6yI4h_GI2Uuon
NNTP-Posting-Host: 66.229.156.164
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.11
(KHTML, like Gecko) Chrome/23.0.1271.97 Safari/537.11,gzip(gfe)
Injection-Date: Tue, 01 Jan 2013 00:33:44 +0000
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
Lines: 78
X-Original-Bytes: 6744