From 01f2dd2ab1eca333c62ab9d37a9c3fffe0f3f546 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Adjemian=20=28Scylla=29?= Date: Thu, 28 Nov 2013 15:21:52 +0100 Subject: [PATCH] Changed the paths to Dynare's prior and post processing hooks. --- doc/dynare.texi | 4 ++-- matlab/dynare.m | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/doc/dynare.texi b/doc/dynare.texi index c531fa892..bc97dc3b9 100644 --- a/doc/dynare.texi +++ b/doc/dynare.texi @@ -866,9 +866,9 @@ Structure containing the various results of the computations. @section Dynare hooks It is possible to call pre and post dynare preprocessor hooks written as matlab scripts. -The script @file{@var{FILENAME}_pre_dynare_preprocessor_hook.m} is executed before the +The script @file{@var{MODFILENAME}/hooks/priorprocessing.m} is executed before the call to Dynare's preprocessor, and can be used to programatically transform the mod file -that will be read by the preprocessor. The script @file{@var{FILENAME}_post_dynare_preprocessor_hook.m} +that will be read by the preprocessor. The script @file{@var{MODFILENAME}/hooks/postprocessing.m} is executed just after the call to Dynare's preprocessor, and can be used to programatically transform the files generated by Dynare's preprocessor before actual computations start. The pre and/or post dynare preprocessor hooks are executed if and only if the aforementioned scripts diff --git a/matlab/dynare.m b/matlab/dynare.m index 6b35486b8..aea60ea5e 100644 --- a/matlab/dynare.m +++ b/matlab/dynare.m @@ -118,8 +118,8 @@ if ~exist(fname,'file') || isequal(fname,'dir') end % pre-dynare-preprocessor-hook -if exist([fname(1:end-4) '_pre_dynare_preprocessor_hook.m'],'file') - eval([fname(1:end-4) '_pre_dynare_preprocessor_hook']) +if exist(fname(1:end-4),'dir') && exist([fname(1:end-4) filesep 'hooks'],'dir') && exist([fname(1:end-4) filesep 'hooks/priorprocessing.m'],'file') + run([fname(1:end-4) filesep 'hooks/priorprocessing']) end command = ['"' dynareroot 'dynare_m" ' fname] ; @@ -135,8 +135,8 @@ if ismember('onlymacro', varargin) end % post-dynare-prerocessor-hook -if exist([fname(1:end-4) '_post_dynare_preprocessor_hook.m'],'file') - eval([fname(1:end-4) '_post_dynare_preprocessor_hook']) +if exist(fname(1:end-4),'dir') && exist([fname(1:end-4) filesep 'hooks'],'dir') && exist([fname(1:end-4) filesep 'hooks/postprocessing.m'],'file') + run([fname(1:end-4) filesep 'hooks/postprocessing']) end % Save preprocessor result in logfile (if `no_log' option not present)