15796c8dcSSimon Schubert /* Interface to functions for deciding which macros are currently in scope. 2*ef5ccd6cSJohn Marino Copyright (C) 2002-2013 Free Software Foundation, Inc. 35796c8dcSSimon Schubert Contributed by Red Hat, Inc. 45796c8dcSSimon Schubert 55796c8dcSSimon Schubert This file is part of GDB. 65796c8dcSSimon Schubert 75796c8dcSSimon Schubert This program is free software; you can redistribute it and/or modify 85796c8dcSSimon Schubert it under the terms of the GNU General Public License as published by 95796c8dcSSimon Schubert the Free Software Foundation; either version 3 of the License, or 105796c8dcSSimon Schubert (at your option) any later version. 115796c8dcSSimon Schubert 125796c8dcSSimon Schubert This program is distributed in the hope that it will be useful, 135796c8dcSSimon Schubert but WITHOUT ANY WARRANTY; without even the implied warranty of 145796c8dcSSimon Schubert MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 155796c8dcSSimon Schubert GNU General Public License for more details. 165796c8dcSSimon Schubert 175796c8dcSSimon Schubert You should have received a copy of the GNU General Public License 185796c8dcSSimon Schubert along with this program. If not, see <http://www.gnu.org/licenses/>. */ 195796c8dcSSimon Schubert 205796c8dcSSimon Schubert #ifndef MACROSCOPE_H 215796c8dcSSimon Schubert #define MACROSCOPE_H 225796c8dcSSimon Schubert 235796c8dcSSimon Schubert #include "macrotab.h" 245796c8dcSSimon Schubert #include "symtab.h" 255796c8dcSSimon Schubert 265796c8dcSSimon Schubert 275796c8dcSSimon Schubert /* The table of macros defined by the user. */ 285796c8dcSSimon Schubert extern struct macro_table *macro_user_macros; 295796c8dcSSimon Schubert 305796c8dcSSimon Schubert /* All the information we need to decide which macro definitions are 315796c8dcSSimon Schubert in scope: a source file (either a main source file or an 325796c8dcSSimon Schubert #inclusion), and a line number in that file. */ 335796c8dcSSimon Schubert struct macro_scope { 345796c8dcSSimon Schubert struct macro_source_file *file; 355796c8dcSSimon Schubert int line; 365796c8dcSSimon Schubert }; 375796c8dcSSimon Schubert 385796c8dcSSimon Schubert 395796c8dcSSimon Schubert /* Return a `struct macro_scope' object corresponding to the symtab 405796c8dcSSimon Schubert and line given in SAL. If we have no macro information for that 415796c8dcSSimon Schubert location, or if SAL's pc is zero, return zero. */ 425796c8dcSSimon Schubert struct macro_scope *sal_macro_scope (struct symtab_and_line sal); 435796c8dcSSimon Schubert 445796c8dcSSimon Schubert 455796c8dcSSimon Schubert /* Return a `struct macro_scope' object representing just the 465796c8dcSSimon Schubert user-defined macros. The result is allocated using xmalloc; the 475796c8dcSSimon Schubert caller is responsible for freeing it. */ 485796c8dcSSimon Schubert struct macro_scope *user_macro_scope (void); 495796c8dcSSimon Schubert 505796c8dcSSimon Schubert /* Return a `struct macro_scope' object describing the scope the `macro 515796c8dcSSimon Schubert expand' and `macro expand-once' commands should use for looking up 525796c8dcSSimon Schubert macros. If we have a selected frame, this is the source location of 535796c8dcSSimon Schubert its PC; otherwise, this is the last listing position. 545796c8dcSSimon Schubert 555796c8dcSSimon Schubert If we have no macro information for the current location, return 565796c8dcSSimon Schubert the user macro scope. 575796c8dcSSimon Schubert 585796c8dcSSimon Schubert The object returned is allocated using xmalloc; the caller is 595796c8dcSSimon Schubert responsible for freeing it. */ 605796c8dcSSimon Schubert struct macro_scope *default_macro_scope (void); 615796c8dcSSimon Schubert 625796c8dcSSimon Schubert 635796c8dcSSimon Schubert /* Look up the definition of the macro named NAME in scope at the source 645796c8dcSSimon Schubert location given by BATON, which must be a pointer to a `struct 655796c8dcSSimon Schubert macro_scope' structure. This function is suitable for use as 665796c8dcSSimon Schubert a macro_lookup_ftype function. */ 675796c8dcSSimon Schubert struct macro_definition *standard_macro_lookup (const char *name, void *baton); 685796c8dcSSimon Schubert 695796c8dcSSimon Schubert 705796c8dcSSimon Schubert #endif /* MACROSCOPE_H */ 71