From 1a9d6eece52f849b1aacda82d593123c18aec133 Mon Sep 17 00:00:00 2001
From: Houtan Bastani <houtan.bastani@ens.fr>
Date: Mon, 20 Dec 2010 14:40:26 +0100
Subject: [PATCH] fixed bug: end _dynamic and _static and getPowerDeriv
 functions with "end" tags to comply with commit
 d8dbc68e841a93b40d2a5005bd69bdd1cbb1778a

---
 preprocessor/DataTree.cc     | 3 ++-
 preprocessor/DynamicModel.cc | 5 +++--
 preprocessor/StaticModel.cc  | 3 ++-
 3 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/preprocessor/DataTree.cc b/preprocessor/DataTree.cc
index cc8da091d2..f151fa3aa8 100644
--- a/preprocessor/DataTree.cc
+++ b/preprocessor/DataTree.cc
@@ -659,6 +659,7 @@ DataTree::writePowerDeriv(ostream &output, bool use_dll) const
            << "            dxp = dxp*p;" << endl
            << "            p = p-1;" << endl
            << "        end" << endl
-           << "    end" << endl;
+           << "    end" << endl
+           << "end" << endl;
 
 }
diff --git a/preprocessor/DynamicModel.cc b/preprocessor/DynamicModel.cc
index ee0673ec6d..ec81d22930 100644
--- a/preprocessor/DynamicModel.cc
+++ b/preprocessor/DynamicModel.cc
@@ -1530,6 +1530,7 @@ DynamicModel::writeDynamicMFile(const string &dynamic_basename) const
     mDynamicModelFile << "global oo_;" << endl << endl;
 
   writeDynamicModel(mDynamicModelFile, false);
+  mDynamicModelFile << "end" << endl; // Close *_dynamic function
   writePowerDeriv(mDynamicModelFile, false);
   mDynamicModelFile.close();
 }
@@ -2213,7 +2214,7 @@ DynamicModel::writeDynamicModel(ostream &DynamicOutput, bool use_dll) const
                       << "  g2 = sparse(v2(:,1),v2(:,2),v2(:,3)," << nrows << "," << hessianColsNbr << ");" << endl;
       else // Either hessian is all zero, or we didn't compute it
         DynamicOutput << "  g2 = sparse([],[],[]," << nrows << "," << hessianColsNbr << ");" << endl;
-      DynamicOutput << "end;" << endl;
+      DynamicOutput << "end" << endl;
 
       // Initialize g3 matrix
       DynamicOutput << "if nargout >= 4," << endl
@@ -2229,7 +2230,7 @@ DynamicModel::writeDynamicModel(ostream &DynamicOutput, bool use_dll) const
       else // Either 3rd derivatives is all zero, or we didn't compute it
         DynamicOutput << "  g3 = sparse([],[],[]," << nrows << "," << ncols << ");" << endl;
 
-      DynamicOutput << "end;" << endl;
+      DynamicOutput << "end" << endl;
     }
   else
     {
diff --git a/preprocessor/StaticModel.cc b/preprocessor/StaticModel.cc
index f072ff2b26..79624b3f6d 100644
--- a/preprocessor/StaticModel.cc
+++ b/preprocessor/StaticModel.cc
@@ -1244,7 +1244,8 @@ StaticModel::writeStaticMFile(const string &func_name) const
   else // Either hessian is all zero, or we didn't compute it
     output << "  g2 = sparse([],[],[]," << equations.size() << "," << g2ncols << ");" << endl;
 
-  output << "end;" << endl; // Close the if nargout >= 3 statement
+  output << "end" << endl; // Close the if nargout >= 3 statement
+  output << "end" << endl; // Close the *_static function
   writePowerDeriv(output, false);
   output.close();
 }
-- 
GitLab