diff --git a/doc/manual/source/running-dynare.rst b/doc/manual/source/running-dynare.rst index be6d0aa3c6037cb2e785ad3d67f74e6e4ae0dfd2..5d89cf6ff3144b84f68d71ee3162ddced2c0b4b9 100644 --- a/doc/manual/source/running-dynare.rst +++ b/doc/manual/source/running-dynare.rst @@ -365,14 +365,15 @@ by the ``dynare`` command. instead of ``psexec``, to properly allocate affinity when there are more than 32 cores in the local machine. [default=true] - .. option:: -DMACRO_VARIABLE=MACRO_EXPRESSION + .. option:: -DMACRO_VARIABLE[=MACRO_EXPRESSION] Defines a macro-variable from the command line (the same effect as using the Macro directive ``@#define`` in a model file, see :ref:`macro-proc-lang`). See the :ref:`note on quotes<quote-note>` for info on passing a ``MACRO_EXPRESSION`` argument containing spaces. Note that an expression passed on the command line can reference variables - defined before it. + defined before it. If ``MACRO_EXPRESSION`` is omitted, the variable is + assigned the ``true`` logical value. *Example* @@ -380,7 +381,7 @@ by the ``dynare`` command. .. code-block:: matlab - >> dynare <<modfile.mod>> -DA=true '-DB="A string with space"' -DC=[1,2,3] '-DD=[ i in C when i > 1 ]' + >> dynare <<modfile.mod>> -DA=true '-DB="A string with space"' -DC=[1,2,3] '-DD=[ i in C when i > 1 ]' -DE .. option:: -I<<path>> diff --git a/doc/manual/source/the-model-file.rst b/doc/manual/source/the-model-file.rst index 33a811a551660565ad9ec649a4823aa266e311ef..63ddf0f212ed2341cef7bd5b9aa1cb638bba9af6 100644 --- a/doc/manual/source/the-model-file.rst +++ b/doc/manual/source/the-model-file.rst @@ -14278,7 +14278,7 @@ Macro directives :: - @#define var // Equals 1 + @#define var // Equals true @#define x = 5 // Real @#define y = "US" // String @#define v = [ 1, 2, 4 ] // Real array diff --git a/preprocessor b/preprocessor index 2a68f5a3af2886ce40149b1af10a9c08d5b4099c..41b1e897569763c6688894597b7cab0cbb14a83d 160000 --- a/preprocessor +++ b/preprocessor @@ -1 +1 @@ -Subproject commit 2a68f5a3af2886ce40149b1af10a9c08d5b4099c +Subproject commit 41b1e897569763c6688894597b7cab0cbb14a83d diff --git a/tests/macro_processor/example1_macro.mod b/tests/macro_processor/example1_macro.mod index 45ad345c4cd2f9642edfee95ea224a3dc26b60c4..a0bd796c5c1b30fbc739dafd4e7cc41791523c55 100644 --- a/tests/macro_processor/example1_macro.mod +++ b/tests/macro_processor/example1_macro.mod @@ -103,7 +103,12 @@ e = 0; u = 0; end; -@#define DEFINEDvar=0 +@#define DEFINEDvar + +// See preprocessor#43 +@#if !(DEFINEDvar == true) +@#error "A variable defined without a value should be equal to logical true" +@#endif @#ifndef DEFINEDvar @#error "IFNDEF PROBLEM"