1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
#include <stdio.h>
#include "samples.h"
static void
ctx_error_func (GPContext *context, const char *format, va_list args, void *data)
{
fprintf (stderr, "\n");
fprintf (stderr, "*** Contexterror *** \n");
vfprintf (stderr, format, args);
fprintf (stderr, "\n");
fflush (stderr);
}
static void
ctx_status_func (GPContext *context, const char *format, va_list args, void *data)
{
vfprintf (stderr, format, args);
fprintf (stderr, "\n");
fflush (stderr);
}
GPContext* sample_create_context() {
GPContext *context;
/* This is the mandatory part */
context = gp_context_new();
/* All the parts below are optional! */
gp_context_set_error_func (context, ctx_error_func, NULL);
gp_context_set_status_func (context, ctx_status_func, NULL);
/* also:
gp_context_set_cancel_func (p->context, ctx_cancel_func, p);
gp_context_set_message_func (p->context, ctx_message_func, p);
if (isatty (STDOUT_FILENO))
gp_context_set_progress_funcs (p->context,
ctx_progress_start_func, ctx_progress_update_func,
ctx_progress_stop_func, p);
*/
return context;
}
|