From a57aa4359aa74d187e63a3e6f7c2bba794d501e8 Mon Sep 17 00:00:00 2001
From: Houtan Bastani <houtanb@gmail.com>
Date: Sun, 26 Sep 2010 13:42:41 +0200
Subject: [PATCH] replace deprecated Matlab function strvcat with char

---
 Shocks.cc      |  6 +++++-
 SymbolList.cc  |  7 +++++--
 SymbolTable.cc | 21 ++++++++++++---------
 3 files changed, 22 insertions(+), 12 deletions(-)

diff --git a/Shocks.cc b/Shocks.cc
index dc66b7c1..750b9367 100644
--- a/Shocks.cc
+++ b/Shocks.cc
@@ -288,7 +288,11 @@ ConditionalForecastPathsStatement::writeOutput(ostream &output, const string &ba
   for (AbstractShocksStatement::det_shocks_t::const_iterator it = paths.begin();
        it != paths.end(); it++)
     {
-      output << "constrained_vars_ = strvcat(constrained_vars_, '" << it->first << "');" << endl;
+      if (it == paths.begin())
+        output << "constrained_vars_ = '" << it->first << "';" << endl;
+      else
+        output << "constrained_vars_ = char(constrained_vars_, '" << it->first << "');" << endl;
+
       const vector<AbstractShocksStatement::DetShockElement> &elems = it->second;
       for (int i = 0; i < (int) elems.size(); i++)
         for (int j = elems[i].period1; j <= elems[i].period2; j++)
diff --git a/SymbolList.cc b/SymbolList.cc
index 24f3df58..af4c1911 100644
--- a/SymbolList.cc
+++ b/SymbolList.cc
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2003-2008 Dynare Team
+ * Copyright (C) 2003-2010 Dynare Team
  *
  * This file is part of Dynare.
  *
@@ -31,7 +31,10 @@ SymbolList::writeOutput(const string &varname, ostream &output) const
   output << varname << "=[];" << endl;
   for (vector<string>::const_iterator it = symbols.begin();
        it != symbols.end(); it++)
-    output << varname << " = strvcat(" << varname << ", '" << *it << "');" << endl;
+    if (it == symbols.begin())
+      output << varname << " = '" << *it << "';" << endl;
+    else
+      output << varname << " = char(" << varname << ", '" << *it << "');" << endl;
 }
 
 void
diff --git a/SymbolTable.cc b/SymbolTable.cc
index 2db56ae4..a1e0d0b1 100644
--- a/SymbolTable.cc
+++ b/SymbolTable.cc
@@ -169,8 +169,8 @@ SymbolTable::writeOutput(ostream &output) const throw (NotYetFrozenException)
       output << "M_.exo_names_tex = '" << getTeXName(exo_ids[0]) << "';" << endl;
       for (int id = 1; id < exo_nbr(); id++)
         {
-          output << "M_.exo_names = strvcat(M_.exo_names, '" << getName(exo_ids[id]) << "');" << endl
-                 << "M_.exo_names_tex = strvcat(M_.exo_names_tex, '" << getTeXName(exo_ids[id]) << "');" << endl;
+          output << "M_.exo_names = char(M_.exo_names, '" << getName(exo_ids[id]) << "');" << endl
+                 << "M_.exo_names_tex = char(M_.exo_names_tex, '" << getTeXName(exo_ids[id]) << "');" << endl;
         }
     }
   if (exo_det_nbr() > 0)
@@ -179,8 +179,8 @@ SymbolTable::writeOutput(ostream &output) const throw (NotYetFrozenException)
       output << "M_.exo_det_names_tex = '" << getTeXName(exo_det_ids[0]) << "';" << endl;
       for (int id = 1; id < exo_det_nbr(); id++)
         {
-          output << "M_.exo_det_names = strvcat(M_.exo_det_names, '" << getName(exo_det_ids[id]) << "');" << endl
-                 << "M_.exo_det_names_tex = strvcat(M_.exo_det_names_tex, '" << getTeXName(exo_det_ids[id]) << "');" << endl;
+          output << "M_.exo_det_names = char(M_.exo_det_names, '" << getName(exo_det_ids[id]) << "');" << endl
+                 << "M_.exo_det_names_tex = char(M_.exo_det_names_tex, '" << getTeXName(exo_det_ids[id]) << "');" << endl;
         }
     }
   if (endo_nbr() > 0)
@@ -189,8 +189,8 @@ SymbolTable::writeOutput(ostream &output) const throw (NotYetFrozenException)
       output << "M_.endo_names_tex = '" << getTeXName(endo_ids[0]) << "';" << endl;
       for (int id = 1; id < endo_nbr(); id++)
         {
-          output << "M_.endo_names = strvcat(M_.endo_names, '" << getName(endo_ids[id]) << "');" << endl
-                 << "M_.endo_names_tex = strvcat(M_.endo_names_tex, '" << getTeXName(endo_ids[id]) << "');" << endl;
+          output << "M_.endo_names = char(M_.endo_names, '" << getName(endo_ids[id]) << "');" << endl
+                 << "M_.endo_names_tex = char(M_.endo_names_tex, '" << getTeXName(endo_ids[id]) << "');" << endl;
         }
     }
   if (param_nbr() > 0)
@@ -199,8 +199,8 @@ SymbolTable::writeOutput(ostream &output) const throw (NotYetFrozenException)
       output << "M_.param_names_tex = '" << getTeXName(param_ids[0]) << "';" << endl;
       for (int id = 1; id < param_nbr(); id++)
         {
-          output << "M_.param_names = strvcat(M_.param_names, '" << getName(param_ids[id]) << "');" << endl
-                 << "M_.param_names_tex = strvcat(M_.param_names_tex, '" << getTeXName(param_ids[id]) << "');" << endl;
+          output << "M_.param_names = char(M_.param_names, '" << getName(param_ids[id]) << "');" << endl
+                 << "M_.param_names_tex = char(M_.param_names_tex, '" << getTeXName(param_ids[id]) << "');" << endl;
 
           if (getName(param_ids[id]) == "dsge_prior_weight")
             output << "options_.dsge_var = 1;" << endl;
@@ -252,7 +252,10 @@ SymbolTable::writeOutput(ostream &output) const throw (NotYetFrozenException)
       output << "options_.varobs = [];" << endl;
       for (vector<int>::const_iterator it = varobs.begin();
            it != varobs.end(); it++)
-        output << "options_.varobs = strvcat(options_.varobs, '" << getName(*it) << "');" << endl;
+        if (it == varobs.begin())
+          output << "options_.varobs = '" << getName(*it) << "';" << endl;
+        else
+          output << "options_.varobs = char(options_.varobs, '" << getName(*it) << "');" << endl;
 
       output << "options_.varobs_id = [ ";
       for (vector<int>::const_iterator it = varobs.begin();
-- 
GitLab