HW12/display_bar.h

37 lines
831 B
C
Raw Normal View History

2020-12-08 02:59:11 +09:00
#include<stdio.h>
#include<time.h>
#include<stdbool.h>
#ifndef _DISPLAY_BAR_H_
#define _DISPLAY_BAR_H_
typedef unsigned raw_progress_bar_t;
void lock_scrolled();
void unlock_scrolled();
void ready_progress_bar();
void add_scrolled_unlocked(unsigned int i);
raw_progress_bar_t create_raw_progress_bar();
void RawDisplayProgressBar(raw_progress_bar_t bar,size_t offset,size_t total,const char * filename);
bool isatty_file(FILE * file);
void myd_perror(const char * msg);
typedef struct {
raw_progress_bar_t bar;
//millisecond unit
int update_rate;
struct timespec last_update;
} progress_bar_t;
2020-12-09 00:14:42 +09:00
//update rate is millsecond unit
2020-12-08 02:59:11 +09:00
void init_progress_bar(progress_bar_t * bar,int update_rate);
void DisplayProgressBar(progress_bar_t * bar,size_t offset,size_t total,const char * filename, bool sync);
#endif