#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <flexipix/flexipix.h>
#ifdef WINDOWS
#include <winsock.h>
#endif
/* just an example for some data */
typedef struct userdata_s {
int i;
float f;
char c;
} userdata_t;
/* callback function called during display creation,
the p_ctx parameter is the userdata supplied in the call
to flp_display_create() */
void msg(void *p_ctx, flp_msg_type_t type, const char *fmt, ...)
{
userdata_t *p_userdata = (userdata_t *)p_ctx;
va_list va;
printf("msg (%d %f %c): ",
p_userdata->i, p_userdata->f,
p_userdata->c); /* make use of the userdata */
/* type tells if the message is an error, a warning or an information */
switch (type) {
case flp_msg_type_err:
printf("ERROR: ");
break;
case flp_msg_type_warn:
printf("WARNING: ");
break;
case flp_msg_type_info:
printf("INFORMATION: ");
break;
}
/* fmt is a printf-style format string,
the arguments are passed exactly as for printf */
va_start(va, fmt);
vprintf(fmt, va);
va_end(va);
}
int main(int argc, char *argv[])
{