Commit | Line | Data |
---|---|---|
9d10b92d DE |
1 | #ifndef CALLBACK_H |
2 | #define CALLBACK_H | |
3 | ||
4 | typedef struct host_callback_struct host_callback; | |
5 | ||
6 | #define MAX_CALLBACK_FDS 10 | |
7 | ||
8 | struct host_callback_struct | |
9 | { | |
10 | int (*close) PARAMS ((host_callback *,int)); | |
11 | int (*get_errno) PARAMS ((host_callback *)); | |
12 | int (*isatty) PARAMS ((host_callback *, int)); | |
13 | int (*lseek) PARAMS ((host_callback *, int, long , int)); | |
14 | int (*open) PARAMS ((host_callback *, const char*, int mode)); | |
15 | int (*read) PARAMS ((host_callback *,int, char *, int)); | |
16 | int (*read_stdin) PARAMS (( host_callback *, char *, int)); | |
17 | int (*rename) PARAMS ((host_callback *, const char *, const char *)); | |
18 | int (*system) PARAMS ((host_callback *, const char *)); | |
19 | long (*time) PARAMS ((host_callback *, long *)); | |
20 | int (*unlink) PARAMS ((host_callback *, const char *)); | |
21 | int (*write) PARAMS ((host_callback *,int, const char *, int)); | |
22 | int (*write_stdout) PARAMS ((host_callback *, const char *, int)); | |
6d685937 AC |
23 | void (*flush_stdout) PARAMS ((host_callback *)); |
24 | int (*write_stderr) PARAMS ((host_callback *, const char *, int)); | |
25 | void (*flush_stderr) PARAMS ((host_callback *)); | |
9d10b92d DE |
26 | |
27 | /* Used when the target has gone away, so we can close open | |
e1144153 | 28 | handles and free memory etc etc. */ |
9d10b92d DE |
29 | int (*shutdown) PARAMS ((host_callback *)); |
30 | int (*init) PARAMS ((host_callback *)); | |
31 | ||
6d685937 | 32 | /* depreciated, use vprintf_filtered - Talk to the user on a console. */ |
9d10b92d | 33 | void (*printf_filtered) PARAMS ((host_callback *, const char *, ...)); |
6d685937 AC |
34 | |
35 | /* Talk to the user on a console. */ | |
36 | void (*vprintf_filtered) PARAMS ((host_callback *, const char *, void *)); | |
37 | ||
e1144153 DE |
38 | /* Print an error message and "exit". |
39 | In the case of gdb "exiting" means doing a longjmp back to the main | |
40 | command loop. */ | |
6d685937 | 41 | void (*evprintf_filtered) PARAMS ((host_callback *, const char *, void *)); |
e1144153 | 42 | void (*error) PARAMS ((host_callback *, const char *, ...)); |
9d10b92d DE |
43 | |
44 | int last_errno; /* host format */ | |
45 | ||
46 | int fdmap[MAX_CALLBACK_FDS]; | |
47 | char fdopen[MAX_CALLBACK_FDS]; | |
48 | char alwaysopen[MAX_CALLBACK_FDS]; | |
49 | }; | |
50 | ||
51 | extern host_callback default_callback; | |
52 | ||
53 | /* Mapping of host/target values. */ | |
54 | /* ??? For debugging purposes, one might want to add a string of the | |
55 | name of the symbol. */ | |
56 | ||
57 | typedef struct { | |
58 | int host_val; | |
59 | int target_val; | |
60 | } target_defs_map; | |
61 | ||
62 | extern target_defs_map errno_map[]; | |
63 | extern target_defs_map open_map[]; | |
64 | ||
65 | extern int host_to_target_errno PARAMS ((int)); | |
66 | extern int target_to_host_open PARAMS ((int)); | |
67 | ||
68 | #endif |