Debian Codegraph @

ext/GOTCHA/src/tool.h

raw symbols SCIP
1 /*
2 This file is part of GOTCHA. For copyright information see the COPYRIGHT
3 file in the top level directory, or at
4 https://github.com/LLNL/gotcha/blob/master/COPYRIGHT
5 This program is free software; you can redistribute it and/or modify it under
6 the terms of the GNU Lesser General Public License (as published by the Free
7 Software Foundation) version 2.1 dated February 1999. This program is
8 distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
9 without even the IMPLIED WARRANTY OF MERCHANTABILITY or FITNESS FOR A PARTICULAR
10 PURPOSE. See the terms and conditions of the GNU Lesser General Public License
11 for more details. You should have received a copy of the GNU Lesser General
12 Public License along with this program; if not, write to the Free Software
13 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
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 * A structure representing how a given tool's bindings are configured
31 */
32 struct gotcha_configuration_t {
33 int priority;
34 };
35
36 /**
37 * A per-library structure
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 * The internal structure that matches the external gotcha_binding_t.
55 * In addition to the data specified in the gotcha_binding_t, we add:
56 * - a linked-list pointer to the next binding table for this tool
57 * - a linked-list pointer to the next binding table
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 * A structure for representing tools. Once we support stacking multiple
70 * tools this will become more important.
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