input.h revision 132718
1/* Declarations for variables relating to reading the source file.
2   Used by parsers, lexical analyzers, and error message routines.
3   Copyright (C) 1993, 1997, 1998, 2000, 2003 Free Software Foundation, Inc.
4
5This file is part of GCC.
6
7GCC is free software; you can redistribute it and/or modify it under
8the terms of the GNU General Public License as published by the Free
9Software Foundation; either version 2, or (at your option) any later
10version.
11
12GCC is distributed in the hope that it will be useful, but WITHOUT ANY
13WARRANTY; without even the implied warranty of MERCHANTABILITY or
14FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
15for more details.
16
17You should have received a copy of the GNU General Public License
18along with GCC; see the file COPYING.  If not, write to the Free
19Software Foundation, 59 Temple Place - Suite 330, Boston, MA
2002111-1307, USA.  */
21
22#ifndef GCC_INPUT_H
23#define GCC_INPUT_H
24
25/* The data structure used to record a location in a translation unit.  */
26/* Long-term, we want to get rid of this and typedef fileline location_t.  */
27struct location_s GTY (())
28{
29  /* The name of the source file involved.  */
30  const char *file;
31
32  /* The line-location in the source file.  */
33  int line;
34};
35typedef struct location_s location_t;
36
37struct file_stack
38{
39  struct file_stack *next;
40  location_t location;
41};
42
43/* Top-level source file.  */
44extern const char *main_input_filename;
45
46extern location_t input_location;
47#define input_line (input_location.line)
48#define input_filename (input_location.file)
49
50/* Stack of currently pending input files.
51   The line member is not accurate for the innermost file on the stack.  */
52extern struct file_stack *input_file_stack;
53
54/* Stack of EXPR_WITH_FILE_LOCATION nested expressions.  */
55extern struct file_stack *expr_wfl_stack;
56
57/* Incremented on each change to input_file_stack.  */
58extern int input_file_stack_tick;
59
60extern void push_srcloc (const char *name, int line);
61extern void pop_srcloc (void);
62
63#endif
64