From 21841958262dd8275bca228412c2a272b7c85270 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Adjemian=20=28Charybdis=29?= Date: Thu, 5 Dec 2019 12:10:36 +0100 Subject: [PATCH 1/8] Updated dseries submodule. [ci skip] --- matlab/modules/dseries | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/matlab/modules/dseries b/matlab/modules/dseries index 03b2ea4ff..6cbe459ac 160000 --- a/matlab/modules/dseries +++ b/matlab/modules/dseries @@ -1 +1 @@ -Subproject commit 03b2ea4ffa017a618a10e1cb8e9680dbef9d8e78 +Subproject commit 6cbe459ac842b298cb3f65faefa1e82800e2b31d From 3a223e9c0866982a701513bb959b54ea51d1448d Mon Sep 17 00:00:00 2001 From: Houtan Bastani Date: Tue, 3 Dec 2019 12:04:49 +0100 Subject: [PATCH 2/8] fix uncommon bug in parsing dynare command line options previously, `nopathchange` and `nopreprocessoroutput` were set even if they were values instead of option names. `nopathchange` would further remove all options that contained `'nopathchange'` e.g. `dynare example1.mod savemacro=nopathchange` would erroneously set `nopathchange` to true and would delete the `savemacro` option altogether In the fix, just check that the match starts in position 1 as, if the argument passed is longer than the matching pattern (e.g. nopathchangee), the preprocessor will stop processing with a usage error --- matlab/dynare.m | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/matlab/dynare.m b/matlab/dynare.m index d5b86f54b..324261e43 100644 --- a/matlab/dynare.m +++ b/matlab/dynare.m @@ -51,15 +51,12 @@ change_path_flag = true; % Filter out some options. preprocessoroutput = true; if nargin>1 - id = strfind(varargin,'nopathchange'); - if ~all(cellfun(@isempty, id)) + id = ismember(varargin, 'nopathchange'); + if any(id) change_path_flag = false; - varargin(cellfun(@isempty, id) == 0) = []; - end - id = strfind(varargin, 'nopreprocessoroutput'); - if ~all(cellfun(@isempty, id)) - preprocessoroutput = false; + varargin(id) = []; end + preprocessoroutput = ~ismember('nopreprocessoroutput', varargin); end % Check matlab path From dec7d4fdb48d8cf75c6a8a783be7e24d25430636 Mon Sep 17 00:00:00 2001 From: Houtan Bastani Date: Tue, 3 Dec 2019 12:48:15 +0100 Subject: [PATCH 3/8] dynare.m: simplify code --- matlab/dynare.m | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/matlab/dynare.m b/matlab/dynare.m index 324261e43..10b28a9fc 100644 --- a/matlab/dynare.m +++ b/matlab/dynare.m @@ -206,8 +206,9 @@ end command = ['"' dynareroot 'preprocessor' arch_ext filesep 'dynare_m" ' fname] ; command = [ command ' mexext=' mexext ' "matlabroot=' matlabroot '"']; -for i=1:length(varargin) - command = [command ' ' varargin{i}]; +if ~isempty(varargin) + dynare_varargin = strjoin(varargin); + command = [command ' ' dynare_varargin]; end if preprocessoroutput @@ -216,7 +217,7 @@ if preprocessoroutput if isempty(varargin) disp('none') else - disp(strjoin(varargin)); + disp(dynare_varargin); end end @@ -252,17 +253,11 @@ if exist(fname(1:end-4),'dir') && exist([fname(1:end-4) filesep 'hooks'],'dir') end % Save preprocessor result in logfile (if `no_log' option not present) -no_log = 0; -for i=1:length(varargin) - no_log = no_log || strcmp(varargin{i}, 'nolog'); -end fid = fopen(fname, 'r'); firstline = fgetl(fid); fclose(fid); -if ~isempty(regexp(firstline, '//\s*--\+\s*options:(|.*\s|.*,)nolog(|\s.*|,.*)\+--')) - no_log = 1; -end -if ~no_log +if ~ismember('nolog', varargin) ... + && isempty(regexp(firstline, '//\s*--\+\s*options:(|.*\s|.*,)nolog(|\s.*|,.*)\+--')) logname = [fname(1:end-4) '.log']; fid = fopen(logname, 'w'); fprintf(fid, '%s', result); From fa493bc10a236d6594826f387956deaa99b1aa97 Mon Sep 17 00:00:00 2001 From: Houtan Bastani Date: Wed, 4 Dec 2019 14:46:44 +0100 Subject: [PATCH 4/8] doc: fix typo --- doc/manual/source/installation-and-configuration.rst | 2 +- doc/manual/source/running-dynare.rst | 4 ++-- doc/manual/source/the-model-file.rst | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/manual/source/installation-and-configuration.rst b/doc/manual/source/installation-and-configuration.rst index 146101c6a..eeaca6bd1 100644 --- a/doc/manual/source/installation-and-configuration.rst +++ b/doc/manual/source/installation-and-configuration.rst @@ -125,7 +125,7 @@ Compiler installation Prerequisites on Windows ------------------------ -There is no prerequisites on Windows. Dynare now ships a compilation +There are no prerequisites on Windows. Dynare now ships a compilation environment that can be used with the :opt:`use_dll` option. diff --git a/doc/manual/source/running-dynare.rst b/doc/manual/source/running-dynare.rst index 25f95ce05..eba4eca14 100644 --- a/doc/manual/source/running-dynare.rst +++ b/doc/manual/source/running-dynare.rst @@ -36,7 +36,7 @@ by the ``dynare`` command. first line of the ``.mod`` file itself (see below). dynare begins by launching the preprocessor on the ``.mod - file``. By default (unless ``use_dll`` option has been given to + file``. By default (unless the :opt:`use_dll` option has been given to ``model``), the preprocessor creates three intermediary files: - ``+FILENAME/driver.m`` @@ -364,7 +364,7 @@ by the ``dynare`` command. .. option:: fast - Only useful with model option ``use_dll``. Don’t recompile the + Only useful with model option :opt:`use_dll`. Don’t recompile the MEX files when running again the same model file and the lists of variables and the equations haven’t changed. We use a 32 bit checksum, stored in ``/checksum``. There diff --git a/doc/manual/source/the-model-file.rst b/doc/manual/source/the-model-file.rst index 6f7a7db58..b219ce01a 100644 --- a/doc/manual/source/the-model-file.rst +++ b/doc/manual/source/the-model-file.rst @@ -620,7 +620,7 @@ MODEL_EXPRESSION and EXPRESSION: .. function:: cbrt(x) - Cubic root. + Cube root. .. function:: sign(x) From 5e429f8c9267408eb83b3ccfe236c352e8ee8bdf Mon Sep 17 00:00:00 2001 From: Houtan Bastani Date: Wed, 4 Dec 2019 17:05:03 +0100 Subject: [PATCH 5/8] update preprocessor - fix bug with cbrt - fix latex output - add compilation_setup command. closes preprocessor#35 - fix bugs with initial_condition_decomposition. preprocessor#37 --- doc/manual/source/the-model-file.rst | 34 ++++++++++++++++++++++++++++ preprocessor | 2 +- 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/doc/manual/source/the-model-file.rst b/doc/manual/source/the-model-file.rst index b219ce01a..16d40aea2 100644 --- a/doc/manual/source/the-model-file.rst +++ b/doc/manual/source/the-model-file.rst @@ -11200,6 +11200,40 @@ Misc commands ``save_params_and_steady_state``; see the documentation of that function for more information. +.. command:: compilation_setup (OPTIONS); + + When the :opt:`use_dll` option is present, Dynare uses the GCC compiler that + was distributed with it to compile the static and dynamic C files produced + by the preprocessor. You can use this option to change the compiler, flags, + and libraries used. + + *Options* + + .. option:: compiler = FILENAME + + The path to the compiler. + + .. option:: substitute_flags = QUOTED_STRING + + The flags to use instead of the default flags. + + .. option:: add_flags = QUOTED_STRING + + The flags to use in addition to the default flags. If + ``substitute_flags`` is passed, these flags are added to the flags + specified there. + + .. option:: substitute_libs = QUOTED_STRING + + The libraries to link against instead of the default libraries. + + .. option:: add_libs = QUOTED_STRING + + The libraries to link against in addition to the default libraries. If + ``substitute_libs`` is passed, these libraries are added to the + libraries specified there. + + .. matcomm:: dynare_version ; |br| Output the version of Dynare that is currently being used diff --git a/preprocessor b/preprocessor index 23ff36a0d..3f3ef7ca0 160000 --- a/preprocessor +++ b/preprocessor @@ -1 +1 @@ -Subproject commit 23ff36a0dd4f5ee56f553d72849a79d320b2a456 +Subproject commit 3f3ef7ca002e7a86d924c9b6de6894cf62610d39 From a77472772f54c7c0e0eb1b7cd91613efe46fb147 Mon Sep 17 00:00:00 2001 From: Houtan Bastani Date: Fri, 6 Dec 2019 14:57:46 +0100 Subject: [PATCH 6/8] doc: update macOS min version and document package installation --- .../source/installation-and-configuration.rst | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/doc/manual/source/installation-and-configuration.rst b/doc/manual/source/installation-and-configuration.rst index eeaca6bd1..256c0d3b9 100644 --- a/doc/manual/source/installation-and-configuration.rst +++ b/doc/manual/source/installation-and-configuration.rst @@ -9,7 +9,7 @@ Software requirements Packaged versions of Dynare are available for Windows 7/8/10, several GNU/Linux distributions (Debian, Ubuntu, Linux Mint, Arch Linux) and macOS -10.8 or later. Dynare should work on other systems, but some compilation steps +10.11 or later. Dynare should work on other systems, but some compilation steps are necessary in that case. In order to run Dynare, you need one of the following: @@ -143,12 +143,11 @@ install liboctave-dev``). Prerequisites on macOS ---------------------- -[TO BE UPDATED] - -If you are using MATLAB under macOS, you should install the latest -version of XCode: `see instructions on the Dynare wiki -`__. - +Dynare now ships a compilation environment that can be used with the +:opt:`use_dll` option. Specifically, the Dynare installer downloads and +installs the Xcode Command Line Tools, installs `Homebrew `_ +under the Dynare installation directory (in the ``.brew`` folder), and finally +installs GCC. Configuration ============= From c646736b9bf0c80924ef1310f4828505f52d6843 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= Date: Tue, 3 Dec 2019 17:02:53 +0100 Subject: [PATCH 7/8] Emacs mode: update for recent additions to the language --- scripts/dynare.el | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/scripts/dynare.el b/scripts/dynare.el index aec37fe77..9a505c6f1 100644 --- a/scripts/dynare.el +++ b/scripts/dynare.el @@ -38,6 +38,7 @@ ;; - basically deactivate the mode within verbatim blocks? ;; - blocks templates "model/end", "initval/end", etc. ;; - functions to insert main keywords, with shortcuts in the keymap +;; - make font-locking case insensitive (as is Dynare lexer) (defgroup dynare nil "Editing Dynare mod files." @@ -87,7 +88,7 @@ ;; Also include "verbatim" in this list (defvar dynare-blocks '("model" "steady_state_model" "initval" "endval" "histval" "shocks" - "shock_groups" "mshocks" "estimated_params" "epilogue" "priors" + "shock_groups" "init2shocks" "mshocks" "estimated_params" "epilogue" "priors" "estimated_param_init" "estimated_params_bounds" "osr_params_bounds" "observation_trends" "optim_weights" "homotopy_setup" "conditional_forecast_paths" "svar_identification" "moment_calibration" @@ -95,11 +96,12 @@ "verbatim") "Dynare block keywords.") -;; Mathematical functions used in model equations (see "expression" in Bison file) +;; Mathematical functions and operators used in model equations (see "hand_side" in Bison file) (defvar dynare-functions - '("exp" "log" "ln" "log10" "sin" "cos" "tan" "asin" "acos" "atan" "sqrt" - "abs" "sign" "max" "min" "normcdf" "normpdf" "erf") - "Dynare mathematical functions.") + '("expectation" "var_expectation" "pac_expectation" "exp" "diff" "adl" "log" + "ln" "log10" "sin" "cos" "tan" "asin" "acos" "atan" "sqrt" "cbrt" "abs" + "sign" "max" "min" "normcdf" "normpdf" "erf" "steady_state") + "Dynare mathematical functions and operators.") (defvar dynare-constants '("nan" "inf") @@ -110,8 +112,13 @@ "Dynare attributes for on-the-fly type declarations.") (defvar dynare-macro-keywords - '("in" "length" "line" "define" "echomacrovars" "save" "for" "endfor" "ifdef" - "ifndef" "if" "else" "endif" "echo" "error" "include" "includepath") + '("line" "include" "includepath" "define" "echo" "error" "if" "ifdef" "ifndef" + "elseif" "else" "endif" "for" "endfor" "echomacrovars" "in" "when" "save" + "true" "false" "exp" "log" "ln" "log10" "sin" "cos" "tan" "asin" "acos" + "atan" "sqrt" "cbrt" "sign" "max" "min" "floor" "ceil" "trunc" "mod" "sum" + "erf" "erfc" "gamma" "lgamma" "round" "length" "normpdf" "normcdf" "isempty" + "isboolean" "isreal" "isstring" "istuple" "isarray" "bool" "real" "string" + "tuple" "array" "defined" "nan" "inf") "Dynare macroprocessor keywords.") (defvar dynare-font-lock-keywords From 8586fea2b94071b1029664e08c6dccf6893ace40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= Date: Fri, 6 Dec 2019 15:25:00 +0100 Subject: [PATCH 8/8] Preprocessor: under Windows, apply the workaround for + removal to +objective subfolder --- preprocessor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/preprocessor b/preprocessor index 3f3ef7ca0..8962a9d58 160000 --- a/preprocessor +++ b/preprocessor @@ -1 +1 @@ -Subproject commit 3f3ef7ca002e7a86d924c9b6de6894cf62610d39 +Subproject commit 8962a9d5897e3b835c19bdc1b3132c2eebee4af5