home *** CD-ROM | disk | FTP | other *** search
/ Geek Gadgets 1 / ADE-1.bin / ade-dist / ncftp-2.3.0-src.tgz / tar.out / contrib / ncftp / Progress.h < prev    next >
C/C++ Source or Header  |  1996-09-28  |  2KB  |  71 lines

  1. /* Progress.h */
  2.  
  3. #ifndef _progress_h_
  4. #define _progress_h_
  5.  
  6. #ifndef _xfer_h
  7. #include "Xfer.h"
  8. #endif
  9.  
  10. /* Progress-meter types. */
  11. #define kPrNone 0
  12. #define kPrPercent 1
  13. #define kPrPhilBar 2
  14. #define kPrKBytes 3
  15. #define kPrDots 4
  16. #define kPrStatBar 5
  17. #define kPrLast kPrStatBar
  18.  
  19. /* Messages we pass to the current progress meter function. */
  20. #define kPrInitMsg 1
  21. #define kPrUpdateMsg 2
  22. #define kPrEndMsg 3
  23.  
  24. /* This message is passed to ProgressReport() from EndProgress(). */
  25. #define kPrLastUpdateMsg 4
  26.  
  27. /* This message is returned by a p.m. function (after receiving a
  28.  * kPrEndMsg) if it wants EndProgress() to print the final transfer
  29.  * statistics.
  30.  */
  31. #define kPrWantStatsMsg 5
  32.  
  33. /* This is how many seconds we wait between visual updates.  We don't
  34.  * want to spend too much time tweaking the meter when we should be
  35.  * doing the transferring!
  36.  */
  37. #define kDelaySeconds 2
  38.  
  39. /* Parameter to ProgressReport, specifying if we have to do an update,
  40.  * or if we only should do it if needed.
  41.  */
  42. #define kOptionalUpdate 0
  43. #define kForceUpdate 1
  44.  
  45. /* Note that we may start writing at the end of an existing file, so if
  46.  * you want to know how much data is in the file you need to know how
  47.  * much you skipped, and how much you actually wrote yourself.
  48.  */
  49. #define LOCALSIZE(a) ((a)->bytesTransferred + (a)->startPoint)
  50.  
  51. #define kKilobyte 1024
  52. #define kMegabyte (kKilobyte * 1000)
  53. #define kGigabyte ((long) kMegabyte * 1000L)
  54.  
  55.  
  56. int StartProgress(XferSpecPtr);
  57. void ProgressReport(XferSpecPtr, int);
  58. void EndProgress(XferSpecPtr);
  59. void TimeValSubtract(struct timeval *, struct timeval *, struct timeval *);
  60. double TransferRate(long, struct timeval *, struct timeval *, char **, double *);
  61. int PrNone(XferSpecPtr, int),
  62.     PrPercent(XferSpecPtr, int),
  63.     PrPhilBar(XferSpecPtr, int),
  64.     PrKBytes(XferSpecPtr, int),
  65.     PrDots(XferSpecPtr, int),
  66.     PrStatBar(XferSpecPtr, int);
  67.  
  68. #endif /* _progress_h_ */
  69.  
  70. /* eof progress.h */
  71.