Initial import of binutils 2.22 on the new vendor branch
[dragonfly.git] / contrib / gdb-7 / gdb / macroscope.h
1 /* Interface to functions for deciding which macros are currently in scope.
2    Copyright (C) 2002, 2007, 2008, 2009, 2010, 2011
3    Free Software Foundation, Inc.
4    Contributed by Red Hat, Inc.
5
6    This file is part of GDB.
7
8    This program is free software; you can redistribute it and/or modify
9    it under the terms of the GNU General Public License as published by
10    the Free Software Foundation; either version 3 of the License, or
11    (at your option) any later version.
12
13    This program is distributed in the hope that it will be useful,
14    but WITHOUT ANY WARRANTY; without even the implied warranty of
15    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16    GNU General Public License for more details.
17
18    You should have received a copy of the GNU General Public License
19    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
20
21 #ifndef MACROSCOPE_H
22 #define MACROSCOPE_H
23
24 #include "macrotab.h"
25 #include "symtab.h"
26
27
28 /* The table of macros defined by the user.  */
29 extern struct macro_table *macro_user_macros;
30
31 /* All the information we need to decide which macro definitions are
32    in scope: a source file (either a main source file or an
33    #inclusion), and a line number in that file.  */
34 struct macro_scope {
35   struct macro_source_file *file;
36   int line;
37 };
38
39
40 /* Return a `struct macro_scope' object corresponding to the symtab
41    and line given in SAL.  If we have no macro information for that
42    location, or if SAL's pc is zero, return zero.  */
43 struct macro_scope *sal_macro_scope (struct symtab_and_line sal);
44
45
46 /* Return a `struct macro_scope' object representing just the
47    user-defined macros.  The result is allocated using xmalloc; the
48    caller is responsible for freeing it.  */
49 struct macro_scope *user_macro_scope (void);
50
51 /* Return a `struct macro_scope' object describing the scope the `macro
52    expand' and `macro expand-once' commands should use for looking up
53    macros.  If we have a selected frame, this is the source location of
54    its PC; otherwise, this is the last listing position.
55
56    If we have no macro information for the current location, return
57    the user macro scope.
58
59    The object returned is allocated using xmalloc; the caller is
60    responsible for freeing it.  */
61 struct macro_scope *default_macro_scope (void);
62
63
64 /* Look up the definition of the macro named NAME in scope at the source
65    location given by BATON, which must be a pointer to a `struct
66    macro_scope' structure.  This function is suitable for use as
67    a macro_lookup_ftype function.  */
68 struct macro_definition *standard_macro_lookup (const char *name, void *baton);
69
70
71 #endif /* MACROSCOPE_H */