Index: mttroot/mtt/cc/include/useful-functions.hh ================================================================== --- mttroot/mtt/cc/include/useful-functions.hh +++ mttroot/mtt/cc/include/useful-functions.hh @@ -1,16 +1,25 @@ #ifndef HAVE_USEFUL_FUNCTIONS_HH #define HAVE_USEFUL_FUNCTIONS_HH +/* Code generation directives */ +#define STANDALONE 0 +#define OCTAVEDLD 1 +#define MATLABMEX 2 +#if (! defined (CODEGENTARGET)) +#define CODEGENTARGET -1 +#endif /* (! defined (CODEGENTARGET)) */ #ifndef __cplusplus #define inline /* strip */ #define cast_to_double (double) +/* typedef unsigned int bool; const bool true = 1; const bool false = 0; +*/ #else #define cast_to_double static_cast #endif /* ! __cplusplus */ static inline double @@ -37,10 +46,11 @@ return cast_to_double ((x > 0) ? +1 : (x < 0) ? -1 : 0); } /* Octave functions */ +#if ((CODEGENTARGET == STANDALONE) || (CODEGENTARGET == OCTAVEDLD)) #ifdef __cplusplus static Matrix ones (const int r = 1, const int c = 1) { Matrix m (r, c, 1.0); @@ -80,9 +90,10 @@ { Matrix m (r, c, 0.0); return m; } #endif /* __cplusplus */ +#endif /* ((CODEGENTARGET == STANDALONE) || (CODEGENTARGET == OCTAVEDLD)) */ #endif /* HAVE_USEFUL_FUNCTIONS_HH */ Index: mttroot/mtt/cc/sympar_txt2h.sh ================================================================== --- mttroot/mtt/cc/sympar_txt2h.sh +++ mttroot/mtt/cc/sympar_txt2h.sh @@ -1,8 +1,23 @@ #! /bin/sh # $Id$ # $Log$ +# Revision 1.7 2002/07/10 11:53:32 geraint +# Replaced shell loop with template expansion - perceptibly quicker generation of sympar.h. +# +# Revision 1.6 2002/05/19 13:01:22 geraint +# Numerical solution of algebraic equations implemented for S-function target. +# +# Equation solving requires the Matlab Optimization Toolbox to be installed. +# +# Code has been changed from C++ to C to allow mex files to be built with LCC, +# the compiler bundled with Matlab. +# +# Parameters are now obtained from numpar.c instead of a dialogue box. +# +# `mtt sfun zip` creates all necessary files for building the model mex files. +# # Revision 1.5 2002/04/28 18:58:06 geraint # Fixed [ 549658 ] awk should be gawk. # Replaced calls to awk with call to gawk. # # Revision 1.4 2001/08/24 21:41:04 geraint @@ -66,16 +81,523 @@ declare_temp_vars () { for name in ${TMP_VAR_NAMES} do echo "" - i=0 - while [ ${i} -le ${NUM_OF_TMP_VAR} ] - do - echo "static double ${name}${i} MTT_UNUSED;" - i=`expr ${i} + 1` - done + + cat < ${OUT}