| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
#if !defined(TOOL_H_) |
| 17 |
#define TOOL_H_ |
| 18 |
|
| 19 |
#include "gotcha/gotcha.h" |
| 20 |
#include "gotcha/gotcha_types.h" |
| 21 |
#include "hash.h" |
| 22 |
|
| 23 |
struct tool_t; |
| 24 |
|
| 25 |
#define UNSET_PRIORITY (-1) |
| 26 |
|
| 27 |
enum gotcha_config_key_t { GOTCHA_PRIORITY }; |
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
struct gotcha_configuration_t { |
| 33 |
int priority; |
| 34 |
}; |
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
#define LIB_GOT_MARKED_WRITEABLE (1 << 0) |
| 40 |
#define LIB_PRESENT (1 << 1) |
| 41 |
typedef struct library_t { |
| 42 |
struct link_map *map; |
| 43 |
struct library_t *next; |
| 44 |
struct library_t *prev; |
| 45 |
unsigned int generation; |
| 46 |
int flags; |
| 47 |
} library_t; |
| 48 |
struct library_t *get_library(struct link_map *map); |
| 49 |
struct library_t *add_library(struct link_map *map); |
| 50 |
void remove_library(struct link_map *map); |
| 51 |
extern unsigned int current_generation; |
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
|
| 58 |
|
| 59 |
typedef struct binding_t { |
| 60 |
struct tool_t *tool; |
| 61 |
struct internal_binding_t *internal_bindings; |
| 62 |
int internal_bindings_size; |
| 63 |
hash_table_t binding_hash; |
| 64 |
struct binding_t *next_tool_binding; |
| 65 |
struct binding_t *next_binding; |
| 66 |
} binding_t; |
| 67 |
|
| 68 |
|
| 69 |
|
| 70 |
|
| 71 |
|
| 72 |
typedef struct tool_t { |
| 73 |
const char *tool_name; |
| 74 |
binding_t *binding; |
| 75 |
struct tool_t *next_tool; |
| 76 |
struct gotcha_configuration_t config; |
| 77 |
hash_table_t child_tools; |
| 78 |
struct tool_t *parent_tool; |
| 79 |
} tool_t; |
| 80 |
|
| 81 |
struct internal_binding_t { |
| 82 |
struct binding_t *associated_binding_table; |
| 83 |
struct gotcha_binding_t *user_binding; |
| 84 |
struct internal_binding_t *next_binding; |
| 85 |
void *wrappee_pointer; |
| 86 |
}; |
| 87 |
|
| 88 |
tool_t *create_tool(const char *tool_name); |
| 89 |
tool_t *get_tool(const char *tool_name); |
| 90 |
tool_t *get_tool_list(); |
| 91 |
void reorder_tool(tool_t *new_tool); |
| 92 |
void remove_tool_from_list(struct tool_t *target); |
| 93 |
void print_tools(); |
| 94 |
|
| 95 |
binding_t *add_binding_to_tool(tool_t *tool, |
| 96 |
struct gotcha_binding_t *user_binding, |
| 97 |
int user_binding_size); |
| 98 |
binding_t *get_bindings(); |
| 99 |
binding_t *get_tool_bindings(tool_t *tool); |
| 100 |
|
| 101 |
struct gotcha_configuration_t get_default_configuration(); |
| 102 |
enum gotcha_error_t get_configuration_value(const char *tool_name, |
| 103 |
enum gotcha_config_key_t key, |
| 104 |
void *location_to_store_result); |
| 105 |
int get_priority(tool_t *tool); |
| 106 |
int tool_equal(tool_t *tool_1, tool_t *tool_2); |
| 107 |
|
| 108 |
#endif |