Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
dynare
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Stéphane Adjemian
dynare
Commits
cda0e037
Commit
cda0e037
authored
Mar 18, 2013
by
Sébastien Villemot
Browse files
Options
Downloads
Patches
Plain Diff
Add preprocessor messages (stdout, stderr) to the logfile
Closes #306
parent
ba889e85
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
matlab/dynare.m
+14
-0
14 additions, 0 deletions
matlab/dynare.m
preprocessor/DynareMain.cc
+9
-0
9 additions, 0 deletions
preprocessor/DynareMain.cc
preprocessor/ModFile.cc
+1
-5
1 addition, 5 deletions
preprocessor/ModFile.cc
with
24 additions
and
5 deletions
matlab/dynare.m
+
14
−
0
View file @
cda0e037
...
...
@@ -102,7 +102,21 @@ for i=2:nargin
end
[
status
,
result
]
=
system
(
command
);
disp
(
result
)
% Save preprocessor result in logfile (if `no_log' option not present)
no_log
=
0
;
for
i
=
2
:
nargin
no_log
=
no_log
||
strcmp
(
varargin
{
i
-
1
},
"nolog"
);
end
if
~
no_log
logname
=
[
substr
(
fname
,
1
,
-
4
)
".log"
];
fid
=
fopen
(
logname
,
"w"
);
fputs
(
fid
,
result
);
fclose
(
fid
);
end
if
status
% Should not use "error(result)" since message will be truncated if too long
error
(
'DYNARE: preprocessing failed'
)
...
...
This diff is collapsed.
Click to expand it.
preprocessor/DynareMain.cc
+
9
−
0
View file @
cda0e037
...
...
@@ -30,6 +30,8 @@ using namespace std;
#endif
#include
"macro/MacroDriver.hh"
#include
<unistd.h>
/* Prototype for second part of main function
Splitting main() in two parts was necessary because ParsingDriver.h and MacroDriver.h can't be
included simultaneously (because of Bison limitations).
...
...
@@ -58,6 +60,13 @@ usage()
int
main
(
int
argc
,
char
**
argv
)
{
/*
Redirect stderr to stdout.
Made necessary because MATLAB/Octave can only capture stdout (but not
stderr), in order to put it in the logfile (see issue #306)
*/
dup2
(
STDOUT_FILENO
,
STDERR_FILENO
);
if
(
argc
<
2
)
{
cerr
<<
"Missing model file!"
<<
endl
;
...
...
This diff is collapsed.
Click to expand it.
preprocessor/ModFile.cc
+
1
−
5
View file @
cda0e037
...
...
@@ -477,11 +477,7 @@ ModFile::writeOutputFiles(const string &basename, bool clear_all, bool no_log, b
mOutputFile
<<
"global_initialization;"
<<
endl
<<
"diary off;"
<<
endl
;
if
(
!
no_log
)
mOutputFile
<<
"logname_ = '"
<<
basename
<<
".log';"
<<
endl
<<
"if exist(logname_, 'file')"
<<
endl
<<
" delete(logname_)"
<<
endl
<<
"end"
<<
endl
<<
"diary(logname_)"
<<
endl
;
mOutputFile
<<
"diary('"
<<
basename
<<
".log');"
<<
endl
;
if
(
console
)
mOutputFile
<<
"options_.console_mode = 1;"
<<
endl
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment