Article View: alt.free.newsservers
Article #146835Re: Most often, the best code ( for me, and only me ) is the code I wrote.
From: Phil Da Lick!
Date: Wed, 02 Jan 2013 12:45
Date: Wed, 02 Jan 2013 12:45
45 lines
6545 bytes
6545 bytes
On 01/01/2013 00:33, xxein wrote:
> 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.
>
lol
Technical Details
Message-ID:
<KvGdnQRFbPxCtnnNnZ2dnUVZ7rGdnZ2d@brightview.co.uk>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.dca3.giganews.com!border3.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!news.glorb.com!ecngs!feeder.ecngs.de!border1.nntp.ams.giganews.com!nntp.giganews.com!local2.nntp.ams.giganews.com!nntp.brightview.co.uk!news.brightview.co.uk.POSTED!not-for-mailReferences:
<Jeff-Relf.Me@Dec.30{6.20.PM.Seattle.2012}> <8330bd6d-a584-4610-8a00-2cecce320e9c@z8g2000yqo.googlegroups.com>Show Full Headers
Complete Article Headers
Message-ID: <KvGdnQRFbPxCtnnNnZ2dnUVZ7rGdnZ2d@brightview.co.uk>
Subject: Re: Most often, the best code ( for me, and only me ) is the code I wrote.
Date: Wed, 02 Jan 2013 12:45:51 +0000
From: "Phil Da Lick!" <phil_the_lick@SPAMMERSKISSMYARSE.hotmail.com>
References: <Jeff-Relf.Me@Dec.30{6.20.PM.Seattle.2012}> <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.dca3.giganews.com!border3.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!news.glorb.com!ecngs!feeder.ecngs.de!border1.nntp.ams.giganews.com!nntp.giganews.com!local2.nntp.ams.giganews.com!nntp.brightview.co.uk!news.brightview.co.uk.POSTED!not-for-mail
NNTP-Posting-Date: Wed, 02 Jan 2013 06:45:19 -0600
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64;
MIME-Version: 1.0
Newsgroups: comp.os.linux.advocacy, alt.free.newsservers, sci.physics, alt.astronomy
alt.astronomy
In-Reply-To: <8330bd6d-a584-4610-8a00-2cecce320e9c@z8g2000yqo.googlegroups.com>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Lines: 45
X-Usenet-Provider: http://www.giganews.com
X-Trace: sv3-mM05sOMyvOgwNIY7PNjbMCF2kspsmHboRr2p8cqRKE/iott8lQ2m+CEXYdw+1r0L/ryGAtGywZhkKNt!1S6rXT7SfiqAcyUvo4U/aEr7oP5ZImPopdI5aXd/jTqidKlD/UKSLEoxwKvLt9S6rHao9mjr57HY!/opMKhEjK2MccDUDDhO0oiDr1A==
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint
properly
X-Postfilter: 1.3.40
X-Original-Bytes: 6349