File: output.h

package info (click to toggle)
rhash 1.4.3-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 2,408 kB
  • sloc: ansic: 19,132; sh: 1,196; xml: 933; makefile: 662; python: 431; java: 364; cs: 288; perl: 196; ruby: 76; sed: 16
file content (65 lines) | stat: -rw-r--r-- 1,806 bytes parent folder | download
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
/* output.h */
#ifndef OUTPUT_H
#define OUTPUT_H

#include <stdint.h>
#include <stdio.h>

#ifdef __cplusplus
extern "C" {
#endif

struct file_info;
struct file_t;

/**
 * A 'method' to output percents.
 */
struct percents_output_info_t
{
	int  (*init)(struct file_info* info);
	void (*update)(struct file_info* info, uint64_t offset);
	int  (*finish)(struct file_info* info, int process_res);
	const char* name;
};

/* pointer to the selected percents output method */
extern struct percents_output_info_t* percents_output;
#define init_percents(info)   percents_output->init(info)
#define update_percents(info, offset) percents_output->update(info, offset)
#define finish_percents(info, process_res) percents_output->finish(info, process_res)

/* initialization of percents output method */
void setup_output(void);
void setup_percents(void);

enum FileOutputFlags {
	OutDefaultFlags = 0x0,
	OutForceUtf8 = 0x1,
	OutBaseName = 0x4,
	OutCountSymbols = 0x8
};
int fprintf_file_t(FILE* out, const char* format, struct file_t* file, unsigned output_flags);
int fprint_urlencoded(FILE* out, const char* str, int upper_case);

void log_msg(const char* format, ...);
void log_msg_file_t(const char* format, struct file_t* file);
#define log_warning log_error
#define log_warning_msg_file_t log_error_msg_file_t
void log_error(const char* format, ...);
void log_error_file_t(struct file_t* file);
void log_error_msg_file_t(const char* format, struct file_t* file);

void report_interrupted(void);
int print_verifying_header(struct file_t* file);
int print_verifying_footer(void);
int print_check_stats(void);

void print_time_stats(uint64_t time, uint64_t size, int total);
void print_file_time_stats(struct file_info* info);

#ifdef __cplusplus
} /* extern "C" */
#endif /* __cplusplus */

#endif /* OUTPUT_H */