From ff6aef0e45cdf9bd82477c3ca182d6399bbbabe0 Mon Sep 17 00:00:00 2001 From: Johannes Pfeifer <jpfeifer@gmx.de> Date: Thu, 30 May 2024 11:57:17 +0200 Subject: [PATCH] savemacro: use valid filename Closes https://git.dynare.org/Dynare/preprocessor/-/issues/126 --- doc/macroprocessor/macroprocessor.tex | 2 +- src/MacroExpandModFile.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/macroprocessor/macroprocessor.tex b/doc/macroprocessor/macroprocessor.tex index 3c9c61f4..df97810e 100644 --- a/doc/macroprocessor/macroprocessor.tex +++ b/doc/macroprocessor/macroprocessor.tex @@ -611,7 +611,7 @@ end; \begin{frame} \frametitle{Macro-related command line options} \begin{itemize} - \item \texttt{savemacro}: Useful for debugging or learning purposes, saves the output of the macro processor. If your \texttt{.mod} file is called \texttt{file.mod}, the output is saved to \texttt{file-macroexp.mod}. + \item \texttt{savemacro}: Useful for debugging or learning purposes, saves the output of the macro processor. If your \texttt{.mod} file is called \texttt{file.mod}, the output is saved to \texttt{file\_macroexp.mod}. \item NB: \texttt{savemacro=filename} allows a user-defined file name \item \texttt{linemacro}: In the output of \texttt{savemacro}, print line numbers where the macro directives were placed. \item \texttt{onlymacro}: Stops processing after the macro processing step. diff --git a/src/MacroExpandModFile.cc b/src/MacroExpandModFile.cc index 0cebcb2d..88f7e42d 100644 --- a/src/MacroExpandModFile.cc +++ b/src/MacroExpandModFile.cc @@ -41,7 +41,7 @@ macroExpandModFile(const filesystem::path& filename, const istream& modfile, boo if (save_macro) { if (save_macro_file.empty()) - save_macro_file = filename.stem().string() + "-macroexp.mod"; + save_macro_file = filename.stem().string() + "_macroexp.mod"; ofstream macro_output_file {save_macro_file}; if (macro_output_file.fail()) { -- GitLab