(root)/
bison-3.8.2/
src/
files.h
       1  /* File names and variables for bison,
       2  
       3     Copyright (C) 1984, 1989, 2000-2002, 2006-2007, 2009-2015, 2018-2021
       4     Free Software Foundation, Inc.
       5  
       6     This file is part of Bison, the GNU Compiler Compiler.
       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 <https://www.gnu.org/licenses/>.  */
      20  
      21  #ifndef FILES_H_
      22  # define FILES_H_
      23  
      24  # include "location.h"
      25  # include "uniqstr.h"
      26  
      27  /* File name specified with -o for the output file, or 0 if no -o.  */
      28  extern char const *spec_outfile;
      29  
      30  /* File name for the parser (i.e., the one above, or its default.) */
      31  extern char *parser_file_name;
      32  
      33  /* Symbol prefix specified with -p, or 0 if no -p.  */
      34  extern const char *spec_name_prefix;
      35  extern location spec_name_prefix_loc;
      36  
      37  /* File name prefix specified with -b, or 0 if no -b.  */
      38  extern char const *spec_file_prefix;
      39  extern location spec_file_prefix_loc;
      40  
      41  /* --verbose. */
      42  extern char *spec_verbose_file;
      43  
      44  /* File name specified for the output graph.  */
      45  extern char *spec_graph_file;
      46  
      47  /* File name specified for the HTML output.  */
      48  extern char *spec_html_file;
      49  
      50  /* File name specified for the XML output.  */
      51  extern char *spec_xml_file;
      52  
      53  /* File name specified with --header.  */
      54  extern char *spec_header_file;
      55  
      56  /* Directory prefix of output file names.  */
      57  extern char *dir_prefix;
      58  
      59  /* The file name as given on the command line.
      60     Not named "input_file" because Flex uses this name for an argument,
      61     and therefore GCC warns about a name clash. */
      62  extern uniqstr grammar_file;
      63  
      64  /* The computed base for output file names.  */
      65  extern char *all_but_ext;
      66  
      67  /* Where our data files are installed.  */
      68  char const *pkgdatadir (void);
      69  
      70  /* Where the m4 program is installed.  */
      71  char const *m4path (void);
      72  
      73  void compute_output_file_names (void);
      74  void output_file_names_free (void);
      75  
      76  /** Record that we generate a file.
      77   *
      78   *  \param file_name  the name of file being generated.
      79   *  \param source whether this is a source file (*c, *.java...)
      80   *                as opposed to a report (*.output, *.dot...).
      81   */
      82  void output_file_name_check (char **file_name, bool source);
      83  
      84  /** Remove all the generated source files. */
      85  void unlink_generated_sources (void);
      86  
      87  FILE *xfopen (const char *name, char const *mode);
      88  void xfclose (FILE *ptr);
      89  FILE *xfdopen (int fd, char const *mode);
      90  
      91  /* Given an input file path, return a string that contains the path
      92     with the file prefix mapping rules applied, or NULL if the input
      93     was NULL.  Do not free the return value.  */
      94  const char *map_file_name (char const *filename);
      95  
      96  /* Add a new file prefix mapping. If a file path starts with
      97     oldprefix, it will be replaced with newprefix.  */
      98  void add_prefix_map (char const *oldprefix, char const *newprefix);
      99  
     100  #endif /* !FILES_H_ */