gwenhywfar  4.99.8beta
cgui.c
Go to the documentation of this file.
1 /***************************************************************************
2  begin : Tue Oct 02 2002
3  copyright : (C) 2002-2017 by Martin Preuss
4  email : martin@libchipcard.de
5 
6  ***************************************************************************
7  * *
8  * This library is free software; you can redistribute it and/or *
9  * modify it under the terms of the GNU Lesser General Public *
10  * License as published by the Free Software Foundation; either *
11  * version 2.1 of the License, or (at your option) any later version. *
12  * *
13  * This library is distributed in the hope that it will be useful, *
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
16  * Lesser General Public License for more details. *
17  * *
18  * You should have received a copy of the GNU Lesser General Public *
19  * License along with this library; if not, write to the Free Software *
20  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, *
21  * MA 02111-1307 USA *
22  * *
23  ***************************************************************************/
24 
25 
26 #ifdef HAVE_CONFIG_H
27 # include <config.h>
28 #endif
29 
30 #define DISABLE_DEBUGLOG
31 
32 
33 #include "cgui_p.h"
34 #include "i18n_l.h"
35 
36 #include <gwenhywfar/gui_be.h>
37 #include <gwenhywfar/inherit.h>
38 #include <gwenhywfar/debug.h>
39 #include <gwenhywfar/misc.h>
40 #include <gwenhywfar/db.h>
41 #include <gwenhywfar/gwentime.h>
42 #include <gwenhywfar/mdigest.h>
43 #include <gwenhywfar/text.h>
44 
45 
46 #include <stdlib.h>
47 #include <string.h>
48 #include <ctype.h>
49 #ifdef HAVE_TERMIOS_H
50 # include <termios.h>
51 #endif
52 #include <unistd.h>
53 #include <fcntl.h>
54 #include <stdio.h>
55 #include <errno.h>
56 
57 #ifdef HAVE_SIGNAL_H
58 # include <signal.h>
59 #endif
60 #ifdef HAVE_ICONV_H
61 # include <iconv.h>
62 #endif
63 #ifndef ICONV_CONST
64 # define ICONV_CONST
65 #endif
66 
67 
68 
69 GWEN_INHERIT(GWEN_GUI, GWEN_GUI_CGUI)
70 
71 
72 
73 
75  GWEN_GUI *gui;
76  GWEN_GUI_CGUI *cgui;
77 
78  gui=GWEN_Gui_new();
79  GWEN_NEW_OBJECT(GWEN_GUI_CGUI, cgui);
80  cgui->progressList=GWEN_Gui_CProgress_List_new();
81  GWEN_INHERIT_SETDATA(GWEN_GUI, GWEN_GUI_CGUI, gui, cgui,
83 
93 
94  return gui;
95 }
96 
97 
98 
100  GWEN_GUI_CGUI *cgui;
101 
102  cgui=(GWEN_GUI_CGUI*)p;
103  GWEN_Gui_CProgress_List_free(cgui->progressList);
104  GWEN_FREE_OBJECT(cgui);
105 }
106 
107 
108 
110  int chr;
111 #ifdef HAVE_TERMIOS_H
112  struct termios OldAttr, NewAttr;
113  int AttrChanged = 0;
114 #endif
115 #if HAVE_DECL_SIGPROCMASK
116  sigset_t snew, sold;
117 #endif
118 
119  // disable canonical mode to receive a single character
120 #if HAVE_DECL_SIGPROCMASK
121  sigemptyset(&snew);
122  sigaddset(&snew, SIGINT);
123  sigaddset(&snew, SIGSTOP);
124  sigprocmask(SIG_BLOCK, &snew, &sold);
125 #endif
126 #ifdef HAVE_TERMIOS_H
127  if (0 == tcgetattr (fileno (stdin), &OldAttr)) {
128  NewAttr = OldAttr;
129  NewAttr.c_lflag &= ~ICANON;
130  NewAttr.c_lflag &= ~ECHO;
131  tcsetattr (fileno (stdin), TCSAFLUSH, &NewAttr);
132  AttrChanged = !0;
133  }
134 #endif
135 
136  for (;;) {
137  chr=getchar();
138  if (waitFor) {
139  if (chr==-1 ||
140  chr==GWEN_GUI_CGUI_CHAR_ABORT ||
141  chr==GWEN_GUI_CGUI_CHAR_ENTER ||
142  chr==waitFor)
143  break;
144  }
145  else
146  break;
147  }
148 
149 #ifdef HAVE_TERMIOS_H
150  /* re-enable canonical mode (if previously disabled) */
151  if (AttrChanged)
152  tcsetattr (fileno (stdin), TCSADRAIN, &OldAttr);
153 #endif
154 
155 #if HAVE_DECL_SIGPROCMASK
156  sigprocmask(SIG_BLOCK, &sold, 0);
157 #endif
158 
159  return chr;
160 }
161 
162 
163 
165  uint32_t flags,
166  char *buffer,
167  int minLen,
168  int maxLen,
169  uint32_t guiid) {
170 #ifdef HAVE_TERMIOS_H
171  struct termios OldInAttr, NewInAttr;
172  struct termios OldOutAttr, NewOutAttr;
173  int AttrInChanged = 0;
174  int AttrOutChanged = 0;
175 #endif
176  int chr;
177  unsigned int pos;
178  char *pOutbuf;
179  int rv;
180 #if HAVE_DECL_SIGPROCMASK
181  sigset_t snew, sold;
182 #endif
183 #ifdef HAVE_ICONV
184 #define INBUFSIZE 6
185  char inbuf[INBUFSIZE];
186  iconv_t ic;
187  size_t inLeft;
188  size_t outLeft;
189  size_t done;
190  ICONV_CONST char *pInbuf;
191  char *nextchr;
192 
193  nextchr=(char *)GWEN_Gui_GetCharSet(gui);
194  if (!nextchr)
195  nextchr="UTF-8";
196  ic=iconv_open("UTF-8", nextchr);
197  if (ic==(iconv_t)-1) {
198  DBG_ERROR(GWEN_LOGDOMAIN, "Cannot convert from \"%s\" to \"UTF-8\", %s",
199  nextchr, strerror(errno));
200  return GWEN_ERROR_GENERIC;
201  }
202 
203  pInbuf=inbuf;
204  outLeft=maxLen;
205 #endif
206 
207  /* if possible, disable echo from stdin to stderr during password
208  * entry */
209 #if HAVE_DECL_SIGPROCMASK
210  sigemptyset(&snew);
211  sigaddset(&snew, SIGINT);
212  sigaddset(&snew, SIGSTOP);
213  sigprocmask(SIG_BLOCK, &snew, &sold);
214 #endif
215 
216 #ifdef HAVE_TERMIOS_H
217  if (0 == tcgetattr (fileno (stdin), &OldInAttr)) {
218  NewInAttr = OldInAttr;
219  NewInAttr.c_lflag &= ~ECHO;
220  NewInAttr.c_lflag &= ~ICANON;
221  tcsetattr (fileno (stdin), TCSAFLUSH, &NewInAttr);
222  AttrInChanged = !0;
223  }
224  if (0 == tcgetattr (fileno (stderr), &OldOutAttr)) {
225  NewOutAttr = OldOutAttr;
226  NewOutAttr.c_lflag &= ~ICANON;
227  tcsetattr (fileno (stderr), TCSAFLUSH, &NewOutAttr);
228  AttrOutChanged = !0;
229  }
230 #endif
231 
232  pos=0;
233  pOutbuf=buffer;
234  for (;;) {
235 #ifdef HAVE_ICONV
236  nextchr=inbuf;
237  pInbuf=inbuf;
238  inLeft=0;
239  outLeft=maxLen-pos;
240  do {
241  chr=getchar();
242  if (chr==EOF)
243  break;
244  *nextchr++=chr;
245  inLeft++;
246  done=iconv(ic, &pInbuf, &inLeft, &pOutbuf, &outLeft);
247  }
248  while (done==(size_t)-1 && errno==EINVAL &&
249  nextchr-inbuf<INBUFSIZE);
250 
251  if (chr==EOF) {
252  DBG_ERROR(GWEN_LOGDOMAIN, "Unexpected EOF while reading from stdin");
254  break;
255  }
256  else if (done==(size_t)-1) {
257  if (errno==E2BIG || errno==EILSEQ) {
258  GWEN_Gui_StdPrintf(gui, stderr, "\007");
259  continue;
260  }
261  DBG_ERROR(GWEN_LOGDOMAIN, "Unrecoverable error in conversion: %s",
262  strerror(errno));
264  break;
265  }
266 #else /* HAVE_ICONV */
267  chr=getchar();
268  if (chr!=EOF)
269  *pOutbuf++=chr;
270  else {
271  DBG_ERROR(GWEN_LOGDOMAIN, "Unexpected EOF while reading from stdin");
273  break;
274  }
275 #endif /* HAVE_ICONV */
276 
277  if (chr==GWEN_GUI_CGUI_CHAR_DELETE) {
278  if (pos) {
279  /* Look for the start of the previous UTF-8 character */
280  do
281  pos--;
282  while ((buffer[pos]&0xC0)==0x80 && pos);
283  GWEN_Gui_StdPrintf(gui, stderr, "%c %c", 8, 8);
284  }
285  pOutbuf=buffer+pos;
286  }
287  else if (chr==GWEN_GUI_CGUI_CHAR_ENTER) {
288  if (minLen && pos<minLen) {
289  if (pos==0 && (flags & GWEN_GUI_INPUT_FLAGS_ALLOW_DEFAULT)) {
293  I18N("Empty Input"),
294  I18N("Your input was empty.\n"
295  "Do you want to use the default?"),
296  I18N("Yes"),
297  I18N("No"),
298  I18N("Abort"), guiid);
299  if (rv==1) {
301  break;
302  }
303  else {
305  break;
306  }
307  }
308  else {
309  /* too few characters */
310  GWEN_Gui_StdPrintf(gui, stderr, "\007");
311  pOutbuf=buffer+pos;
312  }
313  }
314  else {
315  GWEN_Gui_StdPrintf(gui, stderr, "\n");
316  buffer[pos]=0;
317  rv=0;
318  break;
319  }
320  }
321  else if (chr==GWEN_GUI_CGUI_CHAR_ABORT) {
322  DBG_INFO(GWEN_LOGDOMAIN, "User aborted");
324  break;
325  }
326  else if (pOutbuf-buffer<maxLen) {
327  if ((flags & GWEN_GUI_INPUT_FLAGS_NUMERIC) &&
328  !isdigit(chr)) {
329  /* bad character */
330  GWEN_Gui_StdPrintf(gui, stderr, "\007");
331  pOutbuf=buffer+pos;
332  }
333  else {
334  if (flags & GWEN_GUI_INPUT_FLAGS_SHOW) {
335  *pOutbuf=0;
336  GWEN_Gui_StdPrintf(gui, stderr, "%s", buffer+pos);
337  }
338  else
339 #ifndef HAVE_ICONV
340  /* Do not print stars for continuation bytes */
341  if ((chr&0xC0)!=0x80)
342 #endif
343  GWEN_Gui_StdPrintf(gui, stderr, "*");
344  pos=pOutbuf-buffer;
345  }
346  }
347  else {
348  /* buffer full */
349  GWEN_Gui_StdPrintf(gui, stderr, "\007");
350  pOutbuf=buffer+pos;
351  }
352  } /* for */
353 
354 #ifdef HAVE_TERMIOS_H
355  /* re-enable echo (if previously disabled) */
356  if (AttrOutChanged)
357  tcsetattr (fileno (stderr), TCSADRAIN, &OldOutAttr);
358  if (AttrInChanged)
359  tcsetattr (fileno (stdin), TCSADRAIN, &OldInAttr);
360 #endif
361 
362 #if HAVE_DECL_SIGPROCMASK
363  sigprocmask(SIG_BLOCK, &sold, 0);
364 #endif
365 #ifdef HAVE_ICONV
366  iconv_close(ic);
367 #endif
368  return rv;
369 }
370 
371 
372 
374  uint32_t flags,
375  const char *title,
376  const char *text,
377  const char *b1,
378  const char *b2,
379  const char *b3,
380  GWEN_UNUSED uint32_t guiid) {
381  GWEN_BUFFER *tbuf;
382  int c;
383 
384  assert(gui);
385 
386  tbuf=GWEN_Buffer_new(0, 256, 0, 1);
387  GWEN_Gui_GetRawText(gui, text, tbuf);
388 
391  GWEN_Gui_StdPrintf(gui, stderr,
392  "Got the following dangerous message:\n%s\n",
393  GWEN_Buffer_GetStart(tbuf));
394  GWEN_Buffer_free(tbuf);
395  return 0;
396  }
397  else {
399  "Auto-answering the following message with %d:\n%s",
401  GWEN_Buffer_GetStart(tbuf));
402  GWEN_Buffer_free(tbuf);
403  return GWEN_GUI_MSG_FLAGS_CONFIRM_BUTTON(flags);
404  }
405  }
406 
407  GWEN_Gui_StdPrintf(gui, stderr, "===== %s =====\n", title);
408  GWEN_Gui_StdPrintf(gui, stderr, "%s\n", GWEN_Buffer_GetStart(tbuf));
409  GWEN_Buffer_free(tbuf);
410  tbuf=0;
411 
412  if (b1) {
413  GWEN_Gui_StdPrintf(gui, stderr, "(1) %s", b1);
414  if (b2) {
415  GWEN_Gui_StdPrintf(gui, stderr, " (2) %s", b2);
416  if (b3) {
417  GWEN_Gui_StdPrintf(gui, stderr, " (3) %s", b3);
418  }
419  }
420  GWEN_Gui_StdPrintf(gui, stderr, "\n");
421  }
422  GWEN_Gui_StdPrintf(gui, stderr, "Please enter your choice: ");
423  for(;;) {
425  if (c==EOF) {
426  GWEN_Gui_StdPrintf(gui, stderr, "Aborted.\n");
428  }
429  if (!b1 && c==13)
430  return 0;
431  if (c=='1' && b1) {
432  GWEN_Gui_StdPrintf(gui, stderr, "1\n");
433  return 1;
434  }
435  else if (c=='2' && b2) {
436  GWEN_Gui_StdPrintf(gui, stderr, "2\n");
437  return 2;
438  }
439  else if (c=='3' && b3) {
440  GWEN_Gui_StdPrintf(gui, stderr, "3\n");
441  return 3;
442  }
443  else {
444  GWEN_Gui_StdPrintf(gui, stderr, "%c", 7);
445  }
446  } /* for */
447 
448 }
449 
450 
451 
453  uint32_t flags,
454  const char *title,
455  const char *text,
456  char *buffer,
457  int minLen,
458  int maxLen,
459  uint32_t guiid) {
460  int rv;
461  GWEN_BUFFER *tbuf;
462 
463  assert(gui);
464  tbuf=GWEN_Buffer_new(0, 256, 0, 1);
465  GWEN_Gui_GetRawText(gui, text, tbuf);
466 
467  GWEN_Gui_StdPrintf(gui, stderr, "===== %s =====\n", title);
468  GWEN_Gui_StdPrintf(gui, stderr, "%s\n", GWEN_Buffer_GetStart(tbuf));
469  GWEN_Buffer_free(tbuf);
470  tbuf=0;
471 
472  if (flags & GWEN_GUI_INPUT_FLAGS_CONFIRM) {
473  char *lbuffer=0;
474 
475  lbuffer=(char*)malloc(maxLen);
476  if (!lbuffer) {
477  DBG_ERROR(GWEN_LOGDOMAIN, "Not enough memory for %d bytes", maxLen);
478  return GWEN_ERROR_INVALID;
479  }
480  for (;;) {
481  GWEN_Gui_StdPrintf(gui, stderr, "Input: ");
482  rv=GWEN_Gui_CGui__input(gui, flags, lbuffer, minLen, maxLen, guiid);
483  if (rv) {
484  free(lbuffer);
485  return rv;
486  }
487 
488  GWEN_Gui_StdPrintf(gui, stderr, "Again: ");
489  rv=GWEN_Gui_CGui__input(gui, flags, buffer, minLen, maxLen, guiid);
490  if (rv) {
491  free(lbuffer);
492  return rv;
493  }
494  if (strcmp(lbuffer, buffer)!=0) {
495  GWEN_Gui_StdPrintf(gui, stderr,
496  "ERROR: Entries do not match, please try (again or abort)\n");
497  }
498  else {
499  rv=0;
500  break;
501  }
502 
503  } /* for */
504  free(lbuffer);
505  }
506  else {
507  GWEN_Gui_StdPrintf(gui, stderr, "Input: ");
508  rv=GWEN_Gui_CGui__input(gui, flags, buffer, minLen, maxLen, guiid);
509  }
510 
511  if ((rv==0) && (GWEN_Gui_GetFlags(gui) & GWEN_GUI_FLAGS_PERMPASSWORDS)) {
512  /* if the user allows it (by setting flag GWEN_GUI_FLAGS_PERMPASSWORDS)
513  * return 1, meaning the input may be stored in a permanent password store */
514  return 1;
515  }
516 
517  return rv;
518 }
519 
520 
521 
523  GWEN_UNUSED uint32_t flags,
524  const char *title,
525  const char *text,
526  GWEN_UNUSED uint32_t guiid) {
527  GWEN_GUI_CGUI *cgui;
528  GWEN_BUFFER *tbuf;
529 
530  assert(gui);
531  cgui=GWEN_INHERIT_GETDATA(GWEN_GUI, GWEN_GUI_CGUI, gui);
532  assert(cgui);
533 
534  tbuf=GWEN_Buffer_new(0, 256, 0, 1);
535  GWEN_Gui_GetRawText(gui, text, tbuf);
536 
537  GWEN_Gui_StdPrintf(gui, stderr, "===== %s =====\n", title);
538  GWEN_Gui_StdPrintf(gui, stderr, "%s\n", GWEN_Buffer_GetStart(tbuf));
539  GWEN_Buffer_free(tbuf);
540  tbuf=0;
541 
542  return ++(cgui->nextBoxId);
543 }
544 
545 
546 
547 void GWEN_Gui_CGui_HideBox(GWEN_GUI *gui, GWEN_UNUSED uint32_t id) {
548  GWEN_GUI_CGUI *cgui;
549 
550  assert(gui);
551  cgui=GWEN_INHERIT_GETDATA(GWEN_GUI, GWEN_GUI_CGUI, gui);
552  assert(cgui);
553 
554  /* nothing to do right now */
555 }
556 
557 
558 
560  uint32_t progressFlags,
561  const char *title,
562  const char *text,
563  uint64_t total,
564  GWEN_UNUSED uint32_t guiid) {
565  GWEN_GUI_CGUI *cgui;
566  GWEN_GUI_CPROGRESS *cp;
567 
568  assert(gui);
569  cgui=GWEN_INHERIT_GETDATA(GWEN_GUI, GWEN_GUI_CGUI, gui);
570  assert(cgui);
571 
572  cp=GWEN_Gui_CProgress_new(gui,
573  ++(cgui->nextProgressId),
574  progressFlags,
575  title,
576  text,
577  total);
578  GWEN_Gui_CProgress_List_Insert(cp, cgui->progressList);
579  return GWEN_Gui_CProgress_GetId(cp);
580 }
581 
582 
583 
585  GWEN_GUI_CGUI *cgui;
586  GWEN_GUI_CPROGRESS *cp;
587 
588  assert(gui);
589  cgui=GWEN_INHERIT_GETDATA(GWEN_GUI, GWEN_GUI_CGUI, gui);
590  assert(cgui);
591 
592  cp=GWEN_Gui_CProgress_List_First(cgui->progressList);
593  if (id==0)
594  return cp;
595  while(cp) {
596  if (GWEN_Gui_CProgress_GetId(cp)==id)
597  break;
598  cp=GWEN_Gui_CProgress_List_Next(cp);
599  } /* while */
600 
601  return cp;
602 }
603 
604 
605 
607  uint32_t id,
608  uint64_t progress) {
609  GWEN_GUI_CGUI *cgui;
610  GWEN_GUI_CPROGRESS *cp;
611 
612  assert(gui);
613  cgui=GWEN_INHERIT_GETDATA(GWEN_GUI, GWEN_GUI_CGUI, gui);
614  assert(cgui);
615 
616  cp=GWEN_Gui_CGui__findProgress(gui, id);
617  if (!cp) {
618  DBG_DEBUG(GWEN_LOGDOMAIN, "Progress object %u not found", id);
619  return 0;
620  }
621  else {
622  return GWEN_Gui_CProgress_Advance(cp, progress);
623  }
624 }
625 
626 
627 
628 int GWEN_Gui_CGui_ProgressSetTotal(GWEN_GUI *gui, uint32_t id, uint64_t total) {
629  GWEN_GUI_CGUI *cgui;
630  GWEN_GUI_CPROGRESS *cp;
631 
632  assert(gui);
633  cgui=GWEN_INHERIT_GETDATA(GWEN_GUI, GWEN_GUI_CGUI, gui);
634  assert(cgui);
635 
636  cp=GWEN_Gui_CGui__findProgress(gui, id);
637  if (!cp) {
638  DBG_DEBUG(GWEN_LOGDOMAIN, "Progress object %u not found", id);
639  }
640  else
641  GWEN_Gui_CProgress_SetTotal(cp, total);
642  return 0;
643 }
644 
645 
646 
648  uint32_t id,
649  GWEN_LOGGER_LEVEL level,
650  const char *text) {
651  GWEN_GUI_CGUI *cgui;
652  GWEN_GUI_CPROGRESS *cp;
653 
654  assert(gui);
655  cgui=GWEN_INHERIT_GETDATA(GWEN_GUI, GWEN_GUI_CGUI, gui);
656  assert(cgui);
657 
658  cp=GWEN_Gui_CGui__findProgress(gui, id);
659  if (!cp) {
660  DBG_DEBUG(GWEN_LOGDOMAIN, "Progress object %u not found", id);
661  return 0;
662  }
663  else {
664  return GWEN_Gui_CProgress_Log(cp, level, text);
665  }
666 }
667 
668 
669 
670 int GWEN_Gui_CGui_ProgressEnd(GWEN_GUI *gui,uint32_t id) {
671  GWEN_GUI_CGUI *cgui;
672  GWEN_GUI_CPROGRESS *cp;
673 
674  assert(gui);
675  cgui=GWEN_INHERIT_GETDATA(GWEN_GUI, GWEN_GUI_CGUI, gui);
676  assert(cgui);
677 
678  cp=GWEN_Gui_CGui__findProgress(gui, id);
679  if (!cp) {
680  DBG_DEBUG(GWEN_LOGDOMAIN, "Progress object %u not found", id);
681  return 0;
682  }
683  else {
684  int rv;
685 
686  rv=GWEN_Gui_CProgress_End(cp);
687  GWEN_Gui_CProgress_List_Del(cp);
689  return rv;
690  }
691 }
692 
693 
694 
GWEN_GUI_CPROGRESS * GWEN_Gui_CGui__findProgress(GWEN_GUI *gui, uint32_t id)
Definition: cgui.c:584
char * GWEN_Buffer_GetStart(const GWEN_BUFFER *bf)
Definition: buffer.c:223
#define I18N(m)
Definition: error.c:42
GWEN_GUI_PROGRESS_END_FN GWEN_Gui_SetProgressEndFn(GWEN_GUI *gui, GWEN_GUI_PROGRESS_END_FN f)
Definition: gui.c:461
uint32_t GWEN_Gui_CProgress_GetId(const GWEN_GUI_CPROGRESS *cp)
Definition: cprogress.c:77
#define GWEN_ERROR_INVALID
Definition: error.h:67
#define GWEN_GUI_MSG_FLAGS_SEVERITY_IS_DANGEROUS(fl)
Definition: gui.h:338
GWEN_GUI_PROGRESS_LOG_FN GWEN_Gui_SetProgressLogFn(GWEN_GUI *gui, GWEN_GUI_PROGRESS_LOG_FN f)
Definition: gui.c:449
#define GWEN_GUI_INPUT_FLAGS_CONFIRM
Definition: gui.h:211
GWEN_GUI_HIDEBOX_FN GWEN_Gui_SetHideBoxFn(GWEN_GUI *gui, GWEN_GUI_HIDEBOX_FN f)
Definition: gui.c:400
#define GWEN_GUI_FLAGS_NONINTERACTIVE
Definition: gui.h:979
int GWEN_Gui_CGui_ProgressSetTotal(GWEN_GUI *gui, uint32_t id, uint64_t total)
Definition: cgui.c:628
GWEN_LOGGER_LEVEL
Definition: logger.h:64
#define GWEN_GUI_INPUT_FLAGS_ALLOW_DEFAULT
Definition: gui.h:220
#define GWEN_FREE_OBJECT(varname)
Definition: memory.h:92
#define GWEN_GUI_FLAGS_PERMPASSWORDS
Definition: gui.h:985
#define GWEN_GUI_INPUT_FLAGS_NUMERIC
Definition: gui.h:215
#define GWEN_LOGDOMAIN
Definition: logger.h:35
int GWEN_Gui_MessageBox(uint32_t flags, const char *title, const char *text, const char *b1, const char *b2, const char *b3, uint32_t guiid)
Definition: gui.c:821
char GWEN_Gui_CGui__readCharFromStdin(int waitFor)
Definition: cgui.c:109
void GWENHYWFAR_CB GWEN_Gui_CGui_FreeData(GWEN_UNUSED void *bp, void *p)
Definition: cgui.c:99
GWEN_BUFFER * GWEN_Buffer_new(char *buffer, uint32_t size, uint32_t used, int take)
Definition: buffer.c:38
#define GWEN_GUI_MSG_FLAGS_TYPE_INFO
Definition: gui.h:281
int GWEN_Gui_CProgress_End(GWEN_GUI_CPROGRESS *cp)
Definition: cprogress.c:237
int GWEN_Gui_CGui_ProgressEnd(GWEN_GUI *gui, uint32_t id)
Definition: cgui.c:670
GWEN_GUI_PROGRESS_SETTOTAL_FN GWEN_Gui_SetProgressSetTotalFn(GWEN_GUI *gui, GWEN_GUI_PROGRESS_SETTOTAL_FN f)
Definition: gui.c:437
#define GWEN_NEW_OBJECT(typ, varname)
Definition: memory.h:86
void GWEN_Gui_GetRawText(const GWEN_GUI *gui, const char *text, GWEN_BUFFER *tbuf)
Definition: gui.c:329
#define GWEN_GUI_MSG_FLAGS_CONFIRM_BUTTON(fl)
Definition: gui.h:305
#define GWEN_GUI_MSG_FLAGS_SEVERITY_DANGEROUS
Definition: gui.h:337
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)
Definition: cprogress.c:27
uint32_t GWEN_Gui_CGui_ProgressStart(GWEN_GUI *gui, uint32_t progressFlags, const char *title, const char *text, uint64_t total, GWEN_UNUSED uint32_t guiid)
Definition: cgui.c:559
#define GWENHYWFAR_CB
Definition: gwenhywfarapi.h:89
#define DBG_DEBUG(dbg_logger, format, args...)
Definition: debug.h:192
int GWEN_Gui_CGui_ProgressAdvance(GWEN_GUI *gui, uint32_t id, uint64_t progress)
Definition: cgui.c:606
GWEN_GUI_MESSAGEBOX_FN GWEN_Gui_SetMessageBoxFn(GWEN_GUI *gui, GWEN_GUI_MESSAGEBOX_FN f)
Definition: gui.c:364
int GWEN_Gui_CGui_InputBox(GWEN_GUI *gui, uint32_t flags, const char *title, const char *text, char *buffer, int minLen, int maxLen, uint32_t guiid)
Definition: cgui.c:452
GWEN_GUI_PROGRESS_START_FN GWEN_Gui_SetProgressStartFn(GWEN_GUI *gui, GWEN_GUI_PROGRESS_START_FN f)
Definition: gui.c:413
#define GWEN_ERROR_GENERIC
Definition: error.h:62
void GWEN_Buffer_free(GWEN_BUFFER *bf)
Definition: buffer.c:83
struct GWEN_BUFFER GWEN_BUFFER
A dynamically resizeable text buffer.
Definition: buffer.h:41
#define GWEN_ERROR_DEFAULT_VALUE
Definition: error.h:117
int GWEN_Gui_CGui__input(GWEN_UNUSED GWEN_GUI *gui, uint32_t flags, char *buffer, int minLen, int maxLen, uint32_t guiid)
Definition: cgui.c:164
void GWEN_Gui_CGui_HideBox(GWEN_GUI *gui, GWEN_UNUSED uint32_t id)
Definition: cgui.c:547
GWEN_GUI_SHOWBOX_FN GWEN_Gui_SetShowBoxFn(GWEN_GUI *gui, GWEN_GUI_SHOWBOX_FN f)
Definition: gui.c:388
int GWEN_Gui_CGui_ProgressLog(GWEN_GUI *gui, uint32_t id, GWEN_LOGGER_LEVEL level, const char *text)
Definition: cgui.c:647
#define DBG_ERROR(dbg_logger, format, args...)
Definition: debug.h:97
#define GWEN_GUI_INPUT_FLAGS_SHOW
Definition: gui.h:213
int GWEN_Gui_CProgress_Advance(GWEN_GUI_CPROGRESS *cp, uint64_t progress)
Definition: cprogress.c:137
GWEN_GUI * GWEN_Gui_new(void)
Definition: gui.c:78
#define GWEN_GUI_MSG_FLAGS_CONFIRM_B1
Definition: gui.h:299
#define ICONV_CONST
Definition: cgui.c:64
GWEN_GUI_INPUTBOX_FN GWEN_Gui_SetInputBoxFn(GWEN_GUI *gui, GWEN_GUI_INPUTBOX_FN f)
Definition: gui.c:376
#define DBG_INFO(dbg_logger, format, args...)
Definition: debug.h:164
uint32_t GWEN_Gui_CGui_ShowBox(GWEN_GUI *gui, GWEN_UNUSED uint32_t flags, const char *title, const char *text, GWEN_UNUSED uint32_t guiid)
Definition: cgui.c:522
struct GWEN_GUI GWEN_GUI
Definition: gui.h:176
void GWEN_Gui_CProgress_SetTotal(GWEN_GUI_CPROGRESS *cp, uint64_t i)
Definition: cprogress.c:105
struct GWEN_GUI_CPROGRESS GWEN_GUI_CPROGRESS
Definition: cprogress_l.h:14
#define GWEN_INHERIT(bt, t)
Definition: inherit.h:264
void GWEN_Gui_CProgress_free(GWEN_GUI_CPROGRESS *cp)
Definition: cprogress.c:58
#define GWEN_ERROR_USER_ABORTED
Definition: error.h:65
int GWEN_Gui_StdPrintf(const GWEN_GUI *gui, FILE *stream, const char *fmt,...)
Definition: gui.c:251
#define GWEN_INHERIT_SETDATA(bt, t, element, data, fn)
Definition: inherit.h:292
GWEN_GUI * GWEN_Gui_CGui_new(void)
Definition: cgui.c:74
int GWEN_Gui_CGui_MessageBox(GWEN_GUI *gui, uint32_t flags, const char *title, const char *text, const char *b1, const char *b2, const char *b3, GWEN_UNUSED uint32_t guiid)
Definition: cgui.c:373
uint32_t GWEN_Gui_GetFlags(const GWEN_GUI *gui)
Definition: gui.c:660
GWEN_GUI_PROGRESS_ADVANCE_FN GWEN_Gui_SetProgressAdvanceFn(GWEN_GUI *gui, GWEN_GUI_PROGRESS_ADVANCE_FN f)
Definition: gui.c:425
#define GWEN_UNUSED
const char * GWEN_Gui_GetCharSet(const GWEN_GUI *gui)
Definition: gui.c:704
#define GWEN_INHERIT_GETDATA(bt, t, element)
Definition: inherit.h:271
int GWEN_Gui_CProgress_Log(GWEN_GUI_CPROGRESS *cp, GWEN_UNUSED GWEN_LOGGER_LEVEL level, const char *text)
Definition: cprogress.c:206