[src/erc32] Use ncurses instead of termcap on Cygwin too
[binutils-gdb.git] / sim / common / sim-arange.h
blob45eb1746e4c871958adee1b35a22fd384abf02b7
1 /* Address ranges.
2 Copyright (C) 1998-2018 Free Software Foundation, Inc.
3 Contributed by Cygnus Solutions.
5 This file is part of the GNU Simulators.
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
20 /* This file is meant to be included by sim-basics.h. */
22 #ifndef SIM_ARANGE_H
23 #define SIM_ARANGE_H
25 /* A list of address ranges. */
27 typedef struct _addr_subrange {
28 struct _addr_subrange *next;
30 /* Range of addresses to be traced is [start,end]. */
31 address_word start,end;
32 } ADDR_SUBRANGE;
34 /* For speed, searching is done on a tree. */
36 typedef struct _addr_range_tree {
37 struct _addr_range_tree *lower;
38 struct _addr_range_tree *higher;
40 /* Range of addresses to be traced is [start,end]. */
41 address_word start,end;
42 } ADDR_RANGE_TREE;
44 /* The top level struct. */
46 typedef struct _addr_range {
47 ADDR_SUBRANGE *ranges;
48 #define ADDR_RANGE_RANGES(ar) ((ar)->ranges)
49 ADDR_RANGE_TREE *range_tree;
50 #define ADDR_RANGE_TREE(ar) ((ar)->range_tree)
51 } ADDR_RANGE;
53 /* Add address range START,END to AR. */
54 extern void sim_addr_range_add (ADDR_RANGE * /*ar*/,
55 address_word /*start*/,
56 address_word /*end*/);
58 /* Delete address range START,END from AR. */
59 extern void sim_addr_range_delete (ADDR_RANGE * /*ar*/,
60 address_word /*start*/,
61 address_word /*end*/);
63 /* TODO: This should get moved into sim-inline.h. */
64 #ifdef HAVE_INLINE
65 #ifdef SIM_ARANGE_C
66 #define SIM_ARANGE_INLINE INLINE
67 #else
68 #define SIM_ARANGE_INLINE EXTERN_INLINE
69 #endif
70 #else
71 #define SIM_ARANGE_INLINE EXTERN
72 #endif
74 /* Return non-zero if ADDR is in range AR, traversing the entire tree.
75 If no range is specified, that is defined to mean "everything". */
76 SIM_ARANGE_INLINE int
77 sim_addr_range_hit_p (ADDR_RANGE * /*ar*/, address_word /*addr*/);
78 #define ADDR_RANGE_HIT_P(ar, addr) \
79 ((ar)->range_tree == NULL || sim_addr_range_hit_p ((ar), (addr)))
81 #ifdef HAVE_INLINE
82 #include "sim-arange.c"
83 #endif
84 #define SIM_ARANGE_C_INCLUDED
86 #endif /* SIM_ARANGE_H */