// Hey, Emacs, this a -*-C++-*- file !

// Copyright distributed.net 1997-1999 - All Rights Reserved
// For use in distributed.net projects only.
// Any other distribution or use of this source violates copyright.

// $Log: clisrate.h,v $
// Revision 1.14.2.3  1999/01/11 00:09:42  remi
// Synced with :
//
//  Revision 1.15  1999/01/01 02:45:15  cramer
//  Part 1 of 1999 Copyright updates...
//
// Revision 1.14.2.2  1998/11/08 11:50:43  remi
// Lots of $Log tags.
//

#ifndef _CLICSTAT_H_
#define _CLICSTAT_H_

// ---------------------------------------------------------------------------

#ifndef _U32LimitDouble_
  #define _U32LimitDouble_  ((double)(0xFFFFFFFFul))
  #define U64TODOUBLE( hi, lo ) ((double)((((double)(hi))* \
           (((double)(_U32LimitDouble_))+((double)(1))))+((double)(lo))))
#endif

// returns keyrate as string (maxlen=26) "nnnn.nn ['k'|'M'|'G'|'T']"
// return value is a pointer to buffer.
char *CliGetKeyrateAsString( char *buffer, double rate );

// return iter/keysdone/whatever as string. set inNetOrder if 'u'
// needs ntohl()ing first, set contestID = -1 to have the ID ignored
const char *CliGetU64AsString( u64 *u, int inNetOrder, int contestID );

// combines CliGetKeyrateForProblem() and CliGetKeyrateAsString()
const char *CliGetKeyrateStringForProblem( Problem *prob );

// combines CliGetKeyrateForContest() and CliGetKeyrateAsString()
const char *CliGetKeyrateStringForContest( int contestid );

// "4 RC5 Blocks 12:34:56.78 - [123456789 keys/s]"
const char *CliGetSummaryStringForContest( int contestid );

// Completed RC5 block 68E0D85A:A0000000 (123456789 keys)
//           123:45:67:89 - [987654321 keys/s]
const char *CliGetMessageForProblemCompleted( Problem *problem );

// same as above, but does not affect cumulative stats
const char *CliGetMessageForProblemCompletedNoSave( Problem *problem );

// breaks 'message' into (max) two lines with correct word wrap
// forced newlines ('\n') and non-breaking space ('\xFF') are supported
const char *CliReformatMessage( const char *header, const char *message );

#endif // ifdef _CLICSTAT_H_

