From 51beb9c2ef74d0c687ed28543609a0fee57998c3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= <sebastien@dynare.org>
Date: Wed, 15 May 2019 15:02:36 +0200
Subject: [PATCH] New M_.has_external_function field

---
 src/DynamicModel.cc | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/src/DynamicModel.cc b/src/DynamicModel.cc
index 729e8482..67510c68 100644
--- a/src/DynamicModel.cc
+++ b/src/DynamicModel.cc
@@ -3093,6 +3093,18 @@ DynamicModel::writeOutput(ostream &output, const string &basename, bool block_de
          << (static_only_equations.size() > 0 ? "true" :"false")
          << ";" << endl;
 
+  // Say if model contains an external function call
+  bool has_external_function = false;
+  for (size_t eq = 0; eq < equations.size(); eq++)
+    if (equations[eq]->containsExternalFunction())
+      {
+        has_external_function = true;
+        break;
+      }
+  output << modstruct << "has_external_function = "
+         << (has_external_function ? "true" : "false")
+         << ';' << endl;
+
   vector<int> state_var;
   for (int endoID = 0; endoID < symbol_table.endo_nbr(); endoID++)
     // Loop on periods
-- 
GitLab