files.h 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. /* File names and variables for bison,
  2. Copyright (C) 1984, 1989, 2000-2002, 2006-2007, 2009-2015, 2018-2021
  3. Free Software Foundation, Inc.
  4. This file is part of Bison, the GNU Compiler Compiler.
  5. This program is free software: you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation, either version 3 of the License, or
  8. (at your option) any later version.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with this program. If not, see <https://www.gnu.org/licenses/>. */
  15. #ifndef FILES_H_
  16. # define FILES_H_
  17. # include "location.h"
  18. # include "uniqstr.h"
  19. /* File name specified with -o for the output file, or 0 if no -o. */
  20. extern char const *spec_outfile;
  21. /* File name for the parser (i.e., the one above, or its default.) */
  22. extern char *parser_file_name;
  23. /* Symbol prefix specified with -p, or 0 if no -p. */
  24. extern const char *spec_name_prefix;
  25. extern location spec_name_prefix_loc;
  26. /* File name prefix specified with -b, or 0 if no -b. */
  27. extern char const *spec_file_prefix;
  28. extern location spec_file_prefix_loc;
  29. /* --verbose. */
  30. extern char *spec_verbose_file;
  31. /* File name specified for the output graph. */
  32. extern char *spec_graph_file;
  33. /* File name specified for the xml output. */
  34. extern char *spec_xml_file;
  35. /* File name specified with --defines. */
  36. extern char *spec_header_file;
  37. /* File name specified with --defines, adjusted for mapped prefixes. */
  38. extern char *spec_mapped_header_file;
  39. /* Directory prefix of output file names. */
  40. extern char *dir_prefix;
  41. /* Directory prefix of output file name, adjusted for mapped prefixes. */
  42. extern char *mapped_dir_prefix;
  43. /* The file name as given on the command line.
  44. Not named "input_file" because Flex uses this name for an argument,
  45. and therefore GCC warns about a name clash. */
  46. extern uniqstr grammar_file;
  47. /* The computed base for output file names. */
  48. extern char *all_but_ext;
  49. /* Where our data files are installed. */
  50. char const *pkgdatadir (void);
  51. /* Where the m4 program is installed. */
  52. char const *m4path (void);
  53. void compute_output_file_names (void);
  54. void output_file_names_free (void);
  55. /** Record that we generate a file.
  56. *
  57. * \param file_name the name of file being generated.
  58. * \param source whether this is a source file (*c, *.java...)
  59. * as opposed to a report (*.output, *.dot...).
  60. */
  61. void output_file_name_check (char **file_name, bool source);
  62. /** Remove all the generated source files. */
  63. void unlink_generated_sources (void);
  64. FILE *xfopen (const char *name, char const *mode);
  65. void xfclose (FILE *ptr);
  66. FILE *xfdopen (int fd, char const *mode);
  67. char *map_file_name (char const *filename);
  68. void add_prefix_map (char const *oldprefix, char const *newprefix);
  69. #endif /* !FILES_H_ */