File: progress.h

package info (click to toggle)
swftools 0.9.2%2Bds1-3
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 9,488 kB
  • sloc: ansic: 122,576; sh: 8,494; cpp: 8,020; yacc: 2,260; lisp: 904; makefile: 581; python: 304
file content (42 lines) | stat: -rw-r--r-- 1,737 bytes parent folder | download | duplicates (9)
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
/*
     ---------------------- progress output ----------------------
    output progress for GUIs to a pipe
    format: "counter_name"  counter maxcounter time estimated_time \r|\n
 */
#ifndef GOCR_PROGRESS_H
#define GOCR_PROGRESS_H "Oct06"
#include <time.h>

/* initialization of progress output, fname="<fileID>","<filename>","-"  */
int ini_progress(char *fname);

/* ToDo: add by open_* and close_* */
/* place to store values for progress calculation, called often, but
 * dont call systime so often 
 */
typedef struct progress_counter {
 const char *name;      /* name of counter */
 int lastprintcount;    /* last counter printed for extrapolation */
 int maxcount;          /* max counter */
 int numskip;           /* num of counts to skip before timecall 0..maxcount */
 time_t starttime;      /* start time of this counter */
 time_t lastprinttime;  /* last time printed in seconds */
 
} progress_counter_t;

/* progress output p1=main_progress_0..100% p2=sub_progress_0..100% */
/* ToDo: improved_progress: counter, maxcount(ini), counter_name(ini),
 *   printinterval=10 # time before printing out progressmeter
 *   *numskip=1  # if (counter-lastprintcounter<numskip) return; gettime() ...
 *   *startutime, *lastprintutime, *lastprintcounter  # numskip*=2 or /=2
 *   only 1output/10s, + estimated endtime (test on pixelfields)
 *   to stderr by default? remove subprogress, ini_progress? rm_progress?
 *   test on tcl
 */
progress_counter_t *open_progress(int maxcount, const char *name);
/* free counter */
int close_progress(progress_counter_t *counter);
/* output progress for pc */
int progress(int counter, progress_counter_t *pc);
/* --------------------- end of progress output ---------------------- */
#endif