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)); | |
23 | ||
24 | /* Used when the target has gone away, so we can close open | |
e1144153 | 25 | handles and free memory etc etc. */ |
9d10b92d DE |
26 | int (*shutdown) PARAMS ((host_callback *)); |
27 | int (*init) PARAMS ((host_callback *)); | |
28 | ||
e1144153 | 29 | /* Talk to the user on a console. */ |
9d10b92d | 30 | void (*printf_filtered) PARAMS ((host_callback *, const char *, ...)); |
e1144153 DE |
31 | /* Print an error message and "exit". |
32 | In the case of gdb "exiting" means doing a longjmp back to the main | |
33 | command loop. */ | |
34 | void (*error) PARAMS ((host_callback *, const char *, ...)); | |
9d10b92d DE |
35 | |
36 | int last_errno; /* host format */ | |
37 | ||
38 | int fdmap[MAX_CALLBACK_FDS]; | |
39 | char fdopen[MAX_CALLBACK_FDS]; | |
40 | char alwaysopen[MAX_CALLBACK_FDS]; | |
41 | }; | |
42 | ||
43 | extern host_callback default_callback; | |
44 | ||
45 | /* Mapping of host/target values. */ | |
46 | /* ??? For debugging purposes, one might want to add a string of the | |
47 | name of the symbol. */ | |
48 | ||
49 | typedef struct { | |
50 | int host_val; | |
51 | int target_val; | |
52 | } target_defs_map; | |
53 | ||
54 | extern target_defs_map errno_map[]; | |
55 | extern target_defs_map open_map[]; | |
56 | ||
57 | extern int host_to_target_errno PARAMS ((int)); | |
58 | extern int target_to_host_open PARAMS ((int)); | |
59 | ||
60 | #endif |