1130803Smarcel/* Interface to functions for deciding which macros are currently in scope.
2130803Smarcel   Copyright 2002 Free Software Foundation, Inc.
3130803Smarcel   Contributed by Red Hat, Inc.
4130803Smarcel
5130803Smarcel   This file is part of GDB.
6130803Smarcel
7130803Smarcel   This program is free software; you can redistribute it and/or modify
8130803Smarcel   it under the terms of the GNU General Public License as published by
9130803Smarcel   the Free Software Foundation; either version 2 of the License, or
10130803Smarcel   (at your option) any later version.
11130803Smarcel
12130803Smarcel   This program is distributed in the hope that it will be useful,
13130803Smarcel   but WITHOUT ANY WARRANTY; without even the implied warranty of
14130803Smarcel   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15130803Smarcel   GNU General Public License for more details.
16130803Smarcel
17130803Smarcel   You should have received a copy of the GNU General Public License
18130803Smarcel   along with this program; if not, write to the Free Software
19130803Smarcel   Foundation, Inc., 59 Temple Place - Suite 330,
20130803Smarcel   Boston, MA 02111-1307, USA.  */
21130803Smarcel
22130803Smarcel#ifndef MACROSCOPE_H
23130803Smarcel#define MACROSCOPE_H
24130803Smarcel
25130803Smarcel#include "macrotab.h"
26130803Smarcel#include "symtab.h"
27130803Smarcel
28130803Smarcel
29130803Smarcel/* All the information we need to decide which macro definitions are
30130803Smarcel   in scope: a source file (either a main source file or an
31130803Smarcel   #inclusion), and a line number in that file.  */
32130803Smarcelstruct macro_scope {
33130803Smarcel  struct macro_source_file *file;
34130803Smarcel  int line;
35130803Smarcel};
36130803Smarcel
37130803Smarcel
38130803Smarcel/* Return a `struct macro_scope' object corresponding to the symtab
39130803Smarcel   and line given in SAL.  If we have no macro information for that
40130803Smarcel   location, or if SAL's pc is zero, return zero.  */
41130803Smarcelstruct macro_scope *sal_macro_scope (struct symtab_and_line sal);
42130803Smarcel
43130803Smarcel
44130803Smarcel/* Return a `struct macro_scope' object describing the scope the `macro
45130803Smarcel   expand' and `macro expand-once' commands should use for looking up
46130803Smarcel   macros.  If we have a selected frame, this is the source location of
47130803Smarcel   its PC; otherwise, this is the last listing position.
48130803Smarcel
49130803Smarcel   If we have no macro information for the current location, return zero.
50130803Smarcel
51130803Smarcel   The object returned is allocated using xmalloc; the caller is
52130803Smarcel   responsible for freeing it.  */
53130803Smarcelstruct macro_scope *default_macro_scope (void);
54130803Smarcel
55130803Smarcel
56130803Smarcel/* Look up the definition of the macro named NAME in scope at the source
57130803Smarcel   location given by BATON, which must be a pointer to a `struct
58130803Smarcel   macro_scope' structure.  This function is suitable for use as
59130803Smarcel   a macro_lookup_ftype function.  */
60130803Smarcelstruct macro_definition *standard_macro_lookup (const char *name, void *baton);
61130803Smarcel
62130803Smarcel
63130803Smarcel#endif /* MACROSCOPE_H */
64