00001 /* Declarations for variables relating to reading the source file. 00002 Used by parsers, lexical analyzers, and error message routines. 00003 Copyright (C) 1993, 1997, 1998, 2000, 2003, 2004 Free Software Foundation, Inc. 00004 00005 This file is part of GCC. 00006 00007 GCC is free software; you can redistribute it and/or modify it under 00008 the terms of the GNU General Public License as published by the Free 00009 Software Foundation; either version 2, or (at your option) any later 00010 version. 00011 00012 GCC is distributed in the hope that it will be useful, but WITHOUT ANY 00013 WARRANTY; without even the implied warranty of MERCHANTABILITY or 00014 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 00015 for more details. 00016 00017 You should have received a copy of the GNU General Public License 00018 along with GCC; see the file COPYING. If not, write to the Free 00019 Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 00020 02110-1301, USA. */ 00021 00022 #ifndef GCC_INPUT_H 00023 #define GCC_INPUT_H 00024 00025 #include "line-map.h" 00026 extern struct line_maps line_table; 00027 00028 /* The location for declarations in "<built-in>" */ 00029 #define BUILTINS_LOCATION ((source_location) 2) 00030 00031 #ifdef USE_MAPPED_LOCATION 00032 00033 typedef struct 00034 { 00035 /* The name of the source file involved. */ 00036 const char *file; 00037 00038 /* The line-location in the source file. */ 00039 int line; 00040 00041 int column; 00042 } expanded_location; 00043 00044 extern expanded_location expand_location (source_location); 00045 00046 #define UNKNOWN_LOCATION ((source_location) 0) 00047 typedef source_location location_t; /* deprecated typedef */ 00048 typedef source_location source_locus; /* to be removed */ 00049 00050 #else /* ! USE_MAPPED_LOCATION */ 00051 00052 struct location_s GTY(()) 00053 { 00054 /* The name of the source file involved. */ 00055 const char *file; 00056 00057 /* The line-location in the source file. */ 00058 int line; 00059 }; 00060 00061 typedef struct location_s expanded_location; 00062 typedef struct location_s location_t; 00063 typedef location_t *source_locus; 00064 00065 #define expand_location(FILELINE) (FILELINE) 00066 extern location_t unknown_location; 00067 #define UNKNOWN_LOCATION unknown_location 00068 00069 #endif /* ! USE_MAPPED_LOCATION */ 00070 00071 struct file_stack 00072 { 00073 struct file_stack *next; 00074 location_t location; 00075 }; 00076 00077 /* Top-level source file. */ 00078 extern const char *main_input_filename; 00079 00080 extern location_t input_location; 00081 #ifdef USE_MAPPED_LOCATION 00082 extern void push_srcloc (location_t); 00083 #else /* ! USE_MAPPED_LOCATION */ 00084 extern void push_srcloc (const char *name, int line); 00085 #endif /* ! USE_MAPPED_LOCATION */ 00086 extern void pop_srcloc (void); 00087 extern void restore_input_file_stack (int); 00088 00089 #define LOCATION_FILE(LOC) ((expand_location (LOC)).file) 00090 #define LOCATION_LINE(LOC) ((expand_location (LOC)).line) 00091 00092 #define input_line LOCATION_LINE(input_location) 00093 #define input_filename LOCATION_FILE(input_location) 00094 00095 /* Stack of currently pending input files. 00096 The line member is not accurate for the innermost file on the stack. */ 00097 extern struct file_stack *input_file_stack; 00098 00099 /* Incremented on each change to input_file_stack. */ 00100 extern int input_file_stack_tick; 00101 00102 /* The number of bits available for input_file_stack_tick. */ 00103 #define INPUT_FILE_STACK_BITS 31 00104 00105 #endif
1.5.6