+ else if (yacc_flag)
+ {
+ /* If --yacc, then the output is `y.tab.c'. */
+ dir_prefix = xstrdup ("");
+ all_but_tab_ext = xstrdup ("y");
+ }
+ else
+ {
+ /* Otherwise, ALL_BUT_TAB_EXT is computed from the input
+ grammar: `foo/bar.yy' => `bar'. */
+ dir_prefix = xstrdup ("");
+ all_but_tab_ext =
+ xstrndup (base, (strlen (base) - (ext ? strlen (ext) : 0)));
+ }
+
+ if (language->add_tab)
+ all_but_ext = concat2 (all_but_tab_ext, TAB_EXT);
+ else
+ all_but_ext = xstrdup (all_but_tab_ext);
+
+ /* Compute the extensions from the grammar file name. */
+ if (ext && !yacc_flag)
+ compute_exts_from_gf (ext);
+ }
+}
+
+
+/* Compute the output file names. Warn if we detect conflicting
+ outputs to the same file. */
+
+void
+compute_output_file_names (void)
+{
+ compute_file_name_parts ();
+
+ /* If not yet done. */
+ if (!src_extension)
+ src_extension = xstrdup (".c");
+ if (!header_extension)
+ header_extension = xstrdup (".h");
+
+ parser_file_name =
+ (spec_outfile
+ ? xstrdup (spec_outfile)
+ : concat2 (all_but_ext, src_extension));
+
+ if (defines_flag)
+ {
+ if (! spec_defines_file)
+ spec_defines_file = concat2 (all_but_ext, header_extension);