πŸš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.readers
Article #230729

I combined the two loops that used β€œ unQ ” into one.

#230729
From: Jeffβ–²Relf
Date: Sat, 28 Feb 2009 04:44
64 lines
3767 bytes
I didn't like that big-ass β€œ unQ ” macro,
so I combined the two loops that used β€œ unQ ” into one.
>From β€œ JeffRelf.F-M.FM/X.CPP ”:

  //  This line was explained earlier in the thread.
  if ( ! Checked && ( Checked = 1, MimeHeader ) )  goto Attach ;
  //  This is a test case:
  //  news:d7adnXU3PJxXNhLUnZ2dnUVZ_g-WnZ2d@centurytel.net
  LnA QQ = PP = BB - 1 ; LnP prnQ1 = 0, prnQ2 = 0, Λ„  = L"Λ„" ;
  int cntBL = 0, β˜’ = 0, Pgp = 0, wrpQL, QL = 0 ;
  //  Pass through all the lines of the body ( to print ),
  //  might get stopped by an attachment line.
  while (    ++ PP < EE && ( P = B = * PP )
          && ! ( MimeSep && EqN( B, * MimeSep, Sz_MimeSep ) ) ) {
    
    if ( Q && PP > QQ ) {
      //  Might be passing the first 5 lines twice,
      //  so remember which ones were unQ'd ( once is enough ).
      QQ = PP ;
      int  SzB = strSz( B );
      wchar_t  & Ch
      = SzB <= 1 || B[ SzB - 2 ] == '=' ? B[ SzB ] : B[ SzB - 1 ];
      if ( Ch != '=' )
        //  Resolve the quoted printable.
        unQ( B ); 
      else {  
        //  An =char at the end of the line, combine lines.
        SzB --, Ch = 0 ;
        if ( PP + 1 >= EE )  continue ;
        LnP  B2 = PP[ 1 ];
        int SzB2 = strSz( B2 ), SzBigB = SzB + SzB2 + 1 ;
        //  Allocating from a very temporary heap.
        LnP  BigB = PP[ 1 ] = MallocTmp( SzBigB * SzChar );
        wmemmove( BigB, B, SzB );
        wmemmove( BigB + SzB, B2, SzB2 + 1 ); continue ;  } }
    
    wrpQL = QL, Ch = * B, QL = isQL ;
    
    //  Haven't β€œ β˜’ ” for attribution lines ?
    if ( !β˜’ ) {  
      //  β€œ β˜’ == 1 ” when a >quoted line is hit.
      β˜’ = QL, cntBL += !*B ;
      
      //  β€œ β˜’ == 1 ” when two blank lines are hit
      //  and/or 5 lines have been checked.
      if ( cntBL >= 2 || PP - BB > 5 ) {
      
        //  Restart the loop for printing, not checking.
        β˜’ = 1, QL = 0, PP = BB - 1 ; continue ;  }
      if ( !β˜’ )
        //  Keep checking.
        continue ;
        
      //  β€œ β˜’ == 1 ”, attribution lines were killed ( not printed ),
      //  start ( conditionally ) printing here, at the >quoted line.
    }
    
    //  This was explained earlier in the thread.
    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 ;  continue ;  }
....
Technical Details
Message-ID: <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!border2.nntp.ams.giganews.com!nntp.giganews.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
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>

Show Full Headers
Complete Article Headers
Message-ID: <Jeff_Relf@Seattle.2009_Feb.27|8.44pm|q>
Subject: I combined the two loops that used β€œ unQ ” into one.
Date: Sat, 28 Feb 2009 04:44:51 +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>
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!border2.nntp.ams.giganews.com!nntp.giganews.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
Newsgroups: news.software.readers
Lines: 64
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Trace: individual.net NfztrMc9w3z1Kkxz76rNgQ3O9sZN56k/L2J8zHg6X1kInWXiwQ
Cancel-Lock: sha1:7gb34MOTcPBaytvXqHWPj3I7uYY=
User-Agent: JeffRelf.F-M.FM/X.ZIP
X-Original-Bytes: 3548