Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Climate, not race, makes empires.

5 views
Skip to first unread message

Jeff-Relf.Me

unread,
Jan 11, 2017, 7:02:15 AM1/11/17
to
Climate, not race, makes empires.

Great empires require a mild climate, fire helps;
now, with air conditioning, warmer climes are doing better.

How I process the PlainText part of an email|post:

  //  Examples:  http://Jeff-Relf.Me/Posts.TXT
  //  Help/Settings:  http://Jeff-Relf.Me/X.HTM
  //  
  //  BB is a pointer to the start of 
  //  a dynamic array of ( contiguous ) pointers ( lines );
  //  EE points to the end of the array.

  PrnPlainText( LnA  BB, LnA  EE ) { wchar Ch ;  
    LnP  B = !BB ? 0 : *BB ;  LnA  PP = BB - 1, QQ = 0 ;

    while( B ) {  

      //  Print unquoted lines.

      LoopBody( Ch != '>' ) Sh( L"%s", B );  
      if ( !B ) break;  

      //  Print up to "QuotedLns" >quoted lines.

      QQ = PP ;  LoopBody( Ch == '>' );  QQ = ER( QQ, PP - QuotedLns );
      while ( QQ <= PP - ( Ch == 1 ) ) Sh( L"%s", *QQ ), QQ++ ;  }  }

Globals:

  //  Sh() is like printf(), but to my custom console/Shell.

  int Sh( LnP S, ... )

  //  LoopBody() breaks at a MimePart ( or End of File ).
  //  "LnP MimeSep" and "int Sz_MimeSep" define is the "--" Mime marker
  //  ( before the Mime header ), e.g.:
  //    --XXXXboundary text 
  //    Content-Type: text/plain

  #define  LoopBody( Bool )  \
     LoopDL( ( !MimeSep || !EqN( B, *MimeSep, Sz_MimeSep ) ) && ( Bool ) )

  //  EqN() returns Zero when strings match, for length N.

  #define  EqN  !strCmpN
  #define  strCmpN  wcsncmp

  //  LoopDL() loops though a DownLoad ( a dynamic arry, BB to EE - 1 ).

  #define  LoopDL( Bool )   while ( B = 0, Ch = 1, ++PP < EE && ( B = P = *PP ) && ( Ch = *B ) && ( Bool ) )

  typedef wchar_t  wchar ;  typedef wchar  *LnP ;  typedef  LnP  *LnA ; 

  //  Return the bigER one.

  int ER( int X, int Y ) { return X > Y ? X : Y ;  } 
0 new messages