7#include "cprogress_p.h"
10#include <gwenhywfar/inherit.h>
11#include <gwenhywfar/debug.h>
12#include <gwenhywfar/misc.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) {
GWEN_BUFFER * GWEN_Buffer_new(char *buffer, uint32_t size, uint32_t used, int take)
void GWEN_Buffer_free(GWEN_BUFFER *bf)
int GWEN_Buffer_AppendString(GWEN_BUFFER *bf, const char *buffer)
uint32_t GWEN_Buffer_GetUsedBytes(const GWEN_BUFFER *bf)
char * GWEN_Buffer_GetStart(const GWEN_BUFFER *bf)
int GWEN_Buffer_AppendByte(GWEN_BUFFER *bf, char c)
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)
int GWEN_Gui_CProgress_GetAborted(const GWEN_GUI_CPROGRESS *cp)
void GWEN_Gui_CProgress_free(GWEN_GUI_CPROGRESS *cp)
void GWEN_Gui_CProgress_SetTotal(GWEN_GUI_CPROGRESS *cp, uint64_t i)
int GWEN_Gui_CProgress_Advance(GWEN_GUI_CPROGRESS *cp, uint64_t progress)
const char * GWEN_Gui_CProgress_GetLogBuf(const GWEN_GUI_CPROGRESS *cp)
GWEN_GUI * GWEN_Gui_CProgress_GetGui(const GWEN_GUI_CPROGRESS *cp)
uint32_t GWEN_Gui_CProgress_GetId(const GWEN_GUI_CPROGRESS *cp)
uint64_t GWEN_Gui_CProgress_GetCurrent(const GWEN_GUI_CPROGRESS *cp)
int GWEN_Gui_CProgress_End(GWEN_GUI_CPROGRESS *cp)
uint64_t GWEN_Gui_CProgress_GetTotal(const GWEN_GUI_CPROGRESS *cp)
const char * GWEN_Gui_CProgress_GetText(const GWEN_GUI_CPROGRESS *cp)
int GWEN_Gui_CProgress_Log(GWEN_GUI_CPROGRESS *cp, GWEN_LOGGER_LEVEL level, const char *text)
static GWEN_LOGGER_LEVEL CProgressLevel
const char * GWEN_Gui_CProgress_GetTitle(const GWEN_GUI_CPROGRESS *cp)
struct GWEN_GUI_CPROGRESS GWEN_GUI_CPROGRESS
#define DBG_INFO(dbg_logger, format,...)
#define GWEN_ERROR_USER_ABORTED
struct GWEN_BUFFER GWEN_BUFFER
A dynamically resizeable text buffer.
uint32_t GWEN_Gui_GetFlags(const GWEN_GUI *gui)
#define GWEN_GUI_PROGRESS_DELAY
#define GWEN_GUI_FLAGS_NONINTERACTIVE
#define GWEN_GUI_PROGRESS_NONE
#define GWEN_GUI_DELAY_SECS
#define GWEN_GUI_PROGRESS_ONE
GWENHYWFAR_API int GWENHYWFAR_API void GWEN_Gui_GetRawText(const GWEN_GUI *gui, const char *text, GWEN_BUFFER *tbuf)
GWENHYWFAR_API int GWEN_Gui_StdPrintf(const GWEN_GUI *gui, FILE *stream, const char *fmt,...) GWEN_FORMAT(printf
#define GWEN_LIST_FINI(t, element)
#define GWEN_LIST_FUNCTIONS(t, pr)
#define GWEN_LIST_INIT(t, element)
GWEN_LOGGER_LEVEL GWEN_Logger_Name2Level(const char *name)
@ GWEN_LoggerLevel_Unknown
@ GWEN_LoggerLevel_Warning
@ GWEN_LoggerLevel_Notice
#define GWEN_FREE_OBJECT(varname)
#define GWEN_NEW_OBJECT(typ, varname)