Re: [gtk-list] suggestion/request: gtk_init returns on failure
- From: Jan Kratochvil <short ucw cz>
- To: Andy Kahn <kahn zk3 dec com>
- Cc: gtk-list redhat com
- Subject: Re: [gtk-list] suggestion/request: gtk_init returns on failure
- Date: Fri, 19 Feb 1999 01:35:13 +0100
> basically, it would be something like this:
>
> /*
> * returns 0 on success, some other value if error
> */
> int gtk_init(int *argc, char ***argv);
Maybe it is a hack, but from yet unreleased gBill under development:
#ifdef DEBUG
#define dbg(x) x
#else
#define dbg(x)
#endif
jmp_buf jumpbuffer;
char isinit;
static void gdk_recovery(void)
{
dbg(printf("gdk_recovery!!!\n"));
if (isinit) {
dbg(printf("already inited/failed\n"));
return;
}
longjmp(jumpbuffer,1);
}
void init_that_mess(int *argcp,char ***argvp)
{
if (isinit||setjmp(jumpbuffer)) {
dbg(printf("failing...\n"));
isinit=1;
return(FALSE);
}
dbg(printf("gtk_init...\n"));
atexit(gdk_recovery);
gtk_init(argcp,argvp);
dbg(printf("gtk_inited.\n"));
isinit=2;
return(TRUE);
}
Lace
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]