#ifndef CALLBACK_H
#define CALLBACK_H
+#ifndef va_start
+#include <ansidecl.h>
+#ifdef ANSI_PROTOTYPES
+#include <stdarg.h>
+#else
+#include <varargs.h>
+#endif
+#endif
+
typedef struct host_callback_struct host_callback;
#define MAX_CALLBACK_FDS 10
int (*write_stderr) PARAMS ((host_callback *, const char *, int));
void (*flush_stderr) PARAMS ((host_callback *));
+ /* When present, call to the client to give it the oportunity to
+ poll any io devices for a request to quit (indicated by a nonzero
+ return value). */
+ int (*poll_quit) PARAMS ((host_callback *));
+
/* Used when the target has gone away, so we can close open
handles and free memory etc etc. */
int (*shutdown) PARAMS ((host_callback *));
/* depreciated, use vprintf_filtered - Talk to the user on a console. */
void (*printf_filtered) PARAMS ((host_callback *, const char *, ...));
- /* Talk to the user on a console.
- The `void *' is actually `va_list *'. */
- void (*vprintf_filtered) PARAMS ((host_callback *, const char *, void *));
+ /* Talk to the user on a console. */
+ void (*vprintf_filtered) PARAMS ((host_callback *, const char *, va_list));
/* Same as vprintf_filtered but to stderr. */
- void (*evprintf_filtered) PARAMS ((host_callback *, const char *, void *));
+ void (*evprintf_filtered) PARAMS ((host_callback *, const char *, va_list));
/* Print an error message and "exit".
In the case of gdb "exiting" means doing a longjmp back to the main
int fdmap[MAX_CALLBACK_FDS];
char fdopen[MAX_CALLBACK_FDS];
char alwaysopen[MAX_CALLBACK_FDS];
+
+ /* Marker for thse wanting to do sanity checks.
+ This should remain the last memeber of this struct to help catch
+ miscompilation errors. */
+#define HOST_CALLBACK_MAGIC 4705 /* teds constant */
+ int magic;
};
extern host_callback default_callback;
extern int host_to_target_errno PARAMS ((int));
extern int target_to_host_open PARAMS ((int));
+/* Cover functions to the vprintf callbacks. */
+extern void cb_printf PARAMS ((host_callback *, const char *, ...));
+extern void cb_eprintf PARAMS ((host_callback *, const char *, ...));
+
#endif