File: Progress.h

package info (click to toggle)
ncftp2 1%3A2.4.3-2
  • links: PTS
  • area: main
  • in suites: slink
  • size: 872 kB
  • ctags: 1,231
  • sloc: ansic: 13,766; makefile: 176; sh: 9
file content (70 lines) | stat: -rw-r--r-- 1,908 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/* Progress.h */

#ifndef _progress_h_
#define _progress_h_

#ifndef _xfer_h
#include "Xfer.h"
#endif

/* Progress-meter types. */
#define kPrNone 0
#define kPrPercent 1
#define kPrPhilBar 2
#define kPrKBytes 3
#define kPrDots 4
#define kPrStatBar 5
#define kPrLast kPrStatBar

/* Messages we pass to the current progress meter function. */
#define kPrInitMsg 1
#define kPrUpdateMsg 2
#define kPrEndMsg 3

/* This message is passed to ProgressReport() from EndProgress(). */
#define kPrLastUpdateMsg 4

/* This message is returned by a p.m. function (after receiving a
 * kPrEndMsg) if it wants EndProgress() to print the final transfer
 * statistics.
 */
#define kPrWantStatsMsg 5

/* This is how many seconds we wait between visual updates.  We don't
 * want to spend too much time tweaking the meter when we should be
 * doing the transferring!
 */
#define kDelaySeconds 2

/* Parameter to ProgressReport, specifying if we have to do an update,
 * or if we only should do it if needed.
 */
#define kOptionalUpdate 0
#define kForceUpdate 1

/* Note that we may start writing at the end of an existing file, so if
 * you want to know how much data is in the file you need to know how
 * much you skipped, and how much you actually wrote yourself.
 */
#define LOCALSIZE(a) ((a)->bytesTransferred + (a)->startPoint)

#define kKilobyte 1024
#define kMegabyte (kKilobyte * 1024)
#define kGigabyte ((long) kMegabyte * 1024L)


int StartProgress(XferSpecPtr);
void ProgressReport(XferSpecPtr, int);
void EndProgress(XferSpecPtr);
void TimeValSubtract(struct timeval *, struct timeval *, struct timeval *);
double TransferRate(long, struct timeval *, struct timeval *, char **, double *);
int PrNone(XferSpecPtr, int),
	PrPercent(XferSpecPtr, int),
	PrPhilBar(XferSpecPtr, int),
	PrKBytes(XferSpecPtr, int),
	PrDots(XferSpecPtr, int),
	PrStatBar(XferSpecPtr, int);

#endif /* _progress_h_ */

/* eof progress.h */