replaced libart with new polygon code
[swftools.git] / lib / gocr / progress.h
1 /*
2      ---------------------- progress output ----------------------
3     output progress for GUIs to a pipe
4     format: "counter_name"  counter maxcounter time estimated_time \r|\n
5  */
6 #ifndef GOCR_PROGRESS_H
7 #define GOCR_PROGRESS_H "Oct06"
8 #include <time.h>
9
10 /* initialization of progress output, fname="<fileID>","<filename>","-"  */
11 int ini_progress(char *fname);
12
13 /* ToDo: add by open_* and close_* */
14 /* place to store values for progress calculation, called often, but
15  * dont call systime so often 
16  */
17 typedef struct progress_counter {
18  const char *name;      /* name of counter */
19  int lastprintcount;    /* last counter printed for extrapolation */
20  int maxcount;          /* max counter */
21  int numskip;           /* num of counts to skip before timecall 0..maxcount */
22  time_t starttime;      /* start time of this counter */
23  time_t lastprinttime;  /* last time printed in seconds */
24  
25 } progress_counter_t;
26
27 /* progress output p1=main_progress_0..100% p2=sub_progress_0..100% */
28 /* ToDo: improved_progress: counter, maxcount(ini), counter_name(ini),
29  *   printinterval=10 # time before printing out progressmeter
30  *   *numskip=1  # if (counter-lastprintcounter<numskip) return; gettime() ...
31  *   *startutime, *lastprintutime, *lastprintcounter  # numskip*=2 or /=2
32  *   only 1output/10s, + estimated endtime (test on pixelfields)
33  *   to stderr by default? remove subprogress, ini_progress? rm_progress?
34  *   test on tcl
35  */
36 progress_counter_t *open_progress(int maxcount, const char *name);
37 /* free counter */
38 int close_progress(progress_counter_t *counter);
39 /* output progress for pc */
40 int progress(int counter, progress_counter_t *pc);
41 /* --------------------- end of progress output ---------------------- */
42 #endif