Compatibility fix with MATLAB ≤ R2011a

issue#70
Sébastien Villemot 2019-03-26 15:41:48 +01:00
parent f4b95d3aa5
commit 58adbdeddd
No known key found for this signature in database
GPG Key ID: 2CECE9350ECEBE4A
2 changed files with 10 additions and 6 deletions

View File

@ -1716,11 +1716,12 @@ DynamicModel::writeDynamicCFile(const string &basename, const int order) const
<< " */" << endl
<< "#include <math.h>" << endl;
mDynamicModelFile << "#include <stdlib.h>" << endl;
if (external_functions_table.get_total_number_of_unique_model_block_external_functions())
// External Matlab function, implies Dynamic function will call mex
mDynamicModelFile << "#include \"mex.h\"" << endl;
else
mDynamicModelFile << "#include <stdlib.h>" << endl;
mDynamicModelFile << "#include <uchar.h>" << endl // For MATLAB ≤ R2011a
<< "#include \"mex.h\"" << endl;
mDynamicModelFile << "#define max(a, b) (((a) > (b)) ? (a) : (b))" << endl
<< "#define min(a, b) (((a) > (b)) ? (b) : (a))" << endl;
@ -1756,6 +1757,7 @@ DynamicModel::writeDynamicCFile(const string &basename, const int order) const
<< " */" << endl
<< endl
<< "#include <stdlib.h>" << endl
<< "#include <uchar.h>" << endl // For MATLAB ≤ R2011a
<< "#include \"mex.h\"" << endl
<< endl
<< "const int ntt = " << ntt << ";" << endl

View File

@ -2026,11 +2026,12 @@ StaticModel::writeStaticCFile(const string &basename) const
<< " */" << endl
<< "#include <math.h>" << endl;
output << "#include <stdlib.h>" << endl;
if (external_functions_table.get_total_number_of_unique_model_block_external_functions())
// External Matlab function, implies Static function will call mex
output << "#include \"mex.h\"" << endl;
else
output << "#include <stdlib.h>" << endl;
output << "#include <uchar.h>" << endl // For MATLAB ≤ R2011a
<< "#include \"mex.h\"" << endl;
output << "#define max(a, b) (((a) > (b)) ? (a) : (b))" << endl
<< "#define min(a, b) (((a) > (b)) ? (b) : (a))" << endl;
@ -2065,6 +2066,7 @@ StaticModel::writeStaticCFile(const string &basename) const
<< " */" << endl
<< endl
<< "#include <stdlib.h>" << endl
<< "#include <uchar.h>" << endl // For MATLAB ≤ R2011a
<< "#include \"mex.h\"" << endl
<< endl
<< "const int ntt = " << ntt << ";" << endl