7 #include "cprogress_p.h" 10 #include <gwenhywfar/inherit.h> 11 #include <gwenhywfar/debug.h> 12 #include <gwenhywfar/misc.h> 14 #include <sys/types.h> 30 uint32_t progressFlags,
41 cp->startTime=time(0);
42 cp->flags=progressFlags;
44 cp->title=strdup(title);
46 cp->text=strdup(text);
54 s=getenv(
"GWEN_CPROGRESS_LOGLEVEL");
184 progress=cp->current+1;
186 if (progress!=cp->current) {
198 (uint64_t)cp->total);
202 cp->current=progress;
211 fl=fcntl(fileno(stdin), F_GETFL);
216 if (fcntl(fileno(stdin), F_SETFL, fl | O_NONBLOCK)) {
223 fcntl(fileno(stdin), F_SETFL, fl);
224 if (chr==GWEN_GUI_CPROGRESS_CHAR_ABORT) {
const char * GWEN_Gui_CProgress_GetText(const GWEN_GUI_CPROGRESS *cp)
int GWEN_Gui_CProgress_GetAborted(const GWEN_GUI_CPROGRESS *cp)
char * GWEN_Buffer_GetStart(const GWEN_BUFFER *bf)
uint32_t GWEN_Gui_CProgress_GetId(const GWEN_GUI_CPROGRESS *cp)
uint32_t GWEN_Buffer_GetUsedBytes(const GWEN_BUFFER *bf)
#define GWEN_GUI_FLAGS_NONINTERACTIVE
uint64_t GWEN_Gui_CProgress_GetCurrent(const GWEN_GUI_CPROGRESS *cp)
GWENHYWFAR_API int GWEN_Gui_StdPrintf(const GWEN_GUI *gui, FILE *stream, const char *fmt,...) GWEN_FORMAT(printf
#define GWEN_FREE_OBJECT(varname)
const char * GWEN_Gui_CProgress_GetLogBuf(const GWEN_GUI_CPROGRESS *cp)
#define GWEN_GUI_PROGRESS_DELAY
GWEN_LOGGER_LEVEL GWEN_Logger_Name2Level(const char *name)
GWEN_BUFFER * GWEN_Buffer_new(char *buffer, uint32_t size, uint32_t used, int take)
int GWEN_Gui_CProgress_End(GWEN_GUI_CPROGRESS *cp)
GWEN_GUI * GWEN_Gui_CProgress_GetGui(const GWEN_GUI_CPROGRESS *cp)
#define GWEN_GUI_PROGRESS_ONE
#define GWEN_NEW_OBJECT(typ, varname)
#define GWEN_GUI_PROGRESS_NONE
GWEN_GUI_CPROGRESS * GWEN_Gui_CProgress_new(GWEN_GUI *gui, uint32_t id, uint32_t progressFlags, const char *title, const char *text, uint64_t total)
static GWEN_LOGGER_LEVEL CProgressLevel
int GWEN_Buffer_AppendByte(GWEN_BUFFER *bf, char c)
uint64_t GWEN_Gui_CProgress_GetTotal(const GWEN_GUI_CPROGRESS *cp)
int GWEN_Gui_CProgress_Log(GWEN_GUI_CPROGRESS *cp, GWEN_LOGGER_LEVEL level, const char *text)
void GWEN_Buffer_free(GWEN_BUFFER *bf)
struct GWEN_BUFFER GWEN_BUFFER
A dynamically resizeable text buffer.
int GWEN_Gui_CProgress_Advance(GWEN_GUI_CPROGRESS *cp, uint64_t progress)
#define DBG_INFO(dbg_logger, format, args...)
#define GWEN_LIST_INIT(t, element)
const char * GWEN_Gui_CProgress_GetTitle(const GWEN_GUI_CPROGRESS *cp)
void GWEN_Gui_CProgress_SetTotal(GWEN_GUI_CPROGRESS *cp, uint64_t i)
struct GWEN_GUI_CPROGRESS GWEN_GUI_CPROGRESS
#define GWEN_LIST_FUNCTIONS(t, pr)
void GWEN_Gui_CProgress_free(GWEN_GUI_CPROGRESS *cp)
#define GWEN_ERROR_USER_ABORTED
GWENHYWFAR_API int GWENHYWFAR_API void GWEN_Gui_GetRawText(const GWEN_GUI *gui, const char *text, GWEN_BUFFER *tbuf)
uint32_t GWEN_Gui_GetFlags(const GWEN_GUI *gui)
#define GWEN_LIST_FINI(t, element)
int GWEN_Buffer_AppendString(GWEN_BUFFER *bf, const char *buffer)
#define GWEN_GUI_DELAY_SECS