🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: alt.free.newsservers
Article #145885

--

#145885
From: Jeff-Relf.Me
Date: Wed, 14 Nov 2012 09:51
70 lines
4001 bytes
ďťż<PRE><H2>
Hello, my dear fantasy audience... How are you ?
My, you look lovely tonight !

I changed most of the code that I last posted.
[ uploaded to: ⌿ <A hRef="http://Jeff-Relf.Me/X.CPP">X.CPP, Visual C++</A> ]

Now, a block of text is 5 lines ( or words, when comparing words on a line ),
not 30 characters... for a better, more sure match.
[ A blank line, for example, would match too often, too soon ]

"diff" ( text file comparison ) works like this:

  You've an inner and outer loop, like this:

    IncPair:  if ( !*Tx.PP && !*Tx₂.PP ) goto Done ;
    if ( !*Tx₂.PP ) {
      while( *Tx.PP ) PrnB( 0, *Tx.PP++ );  goto Done ;  }

    if ( !*Tx.PP ) {
      while( *Tx₂.PP ) PrnB( 1, *Tx₂.PP++ );  goto Done ;  }

    if ( =≣( Tx.PP, Tx₂.PP ), Tx.PP = EE‗, Tx₂.PP = EE₂‗, Match )
      goto IncPair ;  

    Identical = 0, PP⋅Slow = Tx.PP, PP⋅Fast = Top = Tx₂.PP + 1;
    PP⋅Slow₂ = Tx₂.PP, PP⋅Fast₂ = Top₂ = Tx.PP + 1 ;

    while( *PP⋅Slow || *PP⋅Slow₂ ) {

      while( *PP⋅Fast || *PP⋅Fast₂ ) {

        if ( *PP⋅Fast  )
          if ( =≣( PP⋅Slow,  PP⋅Fast  ) ) Sh⋅Diff else PP⋅Fast++ ;

        if ( *PP⋅Fast₂ )
          if ( =≣( PP⋅Fast₂, PP⋅Slow₂ ) ) Sh⋅Diff else PP⋅Fast₂++ ;  }

      PP⋅Slow += !!*PP⋅Slow, PP⋅Slow₂ += !!*PP⋅Slow₂ ;
      PP⋅Fast = Top, PP⋅Fast₂ = Top₂ ;  }
    
    BB‗ = Tx.ee, BB₂‗ = Tx₂.ee ;  Sh⋅Diff

    Done:
    
    Sh( L"%s%s(%s) lines.", Identical ? L"Identical −− " : L""
    , Prn( Tx₂.PP - Tx₂.BB + H + Tr )
    , Prn( Tx.PP - Tx.BB + H + Tr ));  return 1 ;  }

"PP⋅Slow" and "PP⋅Slow₂" step through the outer loop,
comparing every line of the two files, from both sides,
ignoring previously reported changes.

Likewise, "PP⋅Fast" and "PP⋅Fast₂" increment the inner loop,
stepping though every line of the pair of files,
minus the bit that's already been reported on. "Sh⋅Diff" reports.

At the end of each inner loop, PP⋅Slow is incremented
and PP⋅Fast goes back to the top ("Top") of the unreported portion.

Take, for example, two files, each 100 lines long;
their lines are compared 100 * 100 * 2 times.

=≣() compares two blocks of 5 lines ( or 5 Words ) each.
Changed words are high⋅lighted, not just changed lines,
via a best⋅fit algorithm ( it's not 100% correct ).

Once blocks match, previous unmatched lines are displayed.
The top⋅most block of unmatched text is displayed first,
no matter if it's in the "left" ( older mod ) or "right" ( newer ).
Technical Details
Message-ID: <Jeff-Relf.Me@Nov.14{1.51.AM.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!num2.nntp.dca.giganews.com!num1.nntp.dca.giganews.com!number.nntp.dca.giganews.com!border3.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!news-out.octanews.net!indigo.octanews.net!news.glorb.com!news-spur1.glorb.com!newsread.glorb.com!.POSTED!not-for-mail
References: <k7i5f5$1gs$1@pcls6.std.com> <Jeff-Relf.Me@Nov.9{9.48.PM.Seattle.2012}> <k7lo68$904$1@pcls6.std.com> <Jeff-Relf.Me@Nov.10{2.16.PM.Seattle.2012}> <k7oq5j$o26$1@pcls6.std.com> <Jeff-Relf.Me@Nov.11{11.51.PM.Seattle.2012}>

Show Full Headers
Complete Article Headers
Message-ID: <Jeff-Relf.Me@Nov.14{1.51.AM.Seattle.2012}>
Subject: --
Date: Wed, 14 Nov 2012 09:51:25 +0000
From: Jeff-Relf.Me <@.>
References: <k7i5f5$1gs$1@pcls6.std.com> <Jeff-Relf.Me@Nov.9{9.48.PM.Seattle.2012}> <k7lo68$904$1@pcls6.std.com> <Jeff-Relf.Me@Nov.10{2.16.PM.Seattle.2012}> <k7oq5j$o26$1@pcls6.std.com> <Jeff-Relf.Me@Nov.11{11.51.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!num2.nntp.dca.giganews.com!num1.nntp.dca.giganews.com!number.nntp.dca.giganews.com!border3.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!news-out.octanews.net!indigo.octanews.net!news.glorb.com!news-spur1.glorb.com!newsread.glorb.com!.POSTED!not-for-mail
Newsgroups: alt.free.newsservers,sci.physics,comp.os.linux.advocacy
Organization: Glorb Internet Services, http://www.glorb.com
Lines: 70
NNTP-Posting-Host: XJGH+5GM8EvggnDfgIBqtQ.813.posting.glorb.com
Content-Type: Text/HTML; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Complaints-To: abuse@glorb.com
NNTP-Posting-Date: Wed, 14 Nov 2012 09:51:25 +0000 (UTC)
User-Agent: Jeff-Relf.Me/X.TXT
X-Notice: Scanned by Mr. Bill