Overview
Comment: | Added insertor variable to stop sh-mode font-lock from getting hopelessly confused by embedded C++. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | origin/master | trunk |
Files: | files | file ages | folders |
SHA3-256: |
0d28f049703a5d96b643787721c905d2 |
User & Date: | geraint@users.sourceforge.net on 2002-05-22 09:35:49 |
Other Links: | branch diff | manifest | tags |
Context
2002-05-22
| ||
10:33:18 |
Nameless components are now named according to type - replaces old mtt1 etc style. check-in: edd8b3a6d9 user: gawthrop@users.sourceforge.net tags: origin/master, trunk | |
09:35:49 | Added insertor variable to stop sh-mode font-lock from getting hopelessly confused by embedded C++. check-in: 0d28f04970 user: geraint@users.sourceforge.net tags: origin/master, trunk | |
09:15:03 | Non-repetitive components no longer use _1 in names check-in: adbb1b266e user: gawthrop@users.sourceforge.net tags: origin/master, trunk | |
Changes
Modified mttroot/mtt/bin/trans/make_ode2odes from [9a174cbb5b] to [fa0297c797].
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | #! /bin/sh ###################################### ##### Model Transformation Tools ##### ###################################### ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ ## Revision 1.78 2002/05/11 01:14:17 geraint ## Fix for [ 553218 ] simpar.oct and simpar.m different. ## Translation added between ColumnVector in base .cc and Octave_map in .oct. ## ## Revision 1.77 2002/05/08 16:03:32 geraint ## Added mex support for ode2odes: mtt sys ode2odes mexglx. ## This mex stuff seems to require octave2.1-headers. | > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | #! /bin/sh ###################################### ##### Model Transformation Tools ##### ###################################### ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ ## Revision 1.79 2002/05/20 13:42:31 gawthrop ## Uses simpar.first for first printed output ## ## Revision 1.78 2002/05/11 01:14:17 geraint ## Fix for [ 553218 ] simpar.oct and simpar.m different. ## Translation added between ColumnVector in base .cc and Octave_map in .oct. ## ## Revision 1.77 2002/05/08 16:03:32 geraint ## Added mex support for ode2odes: mtt sys ode2odes mexglx. ## This mex stuff seems to require octave2.1-headers. |
︙ | ︙ | |||
318 319 320 321 322 323 324 325 326 327 328 329 330 331 | fi if [ -n "$4" ]; then algebraic_solver=$4 else algebraic_solver="Reduce_Solver" fi echo Creating $filename with $method integration method # Find system constants Nx=`mtt_getsize $sys x` # States Nu=`mtt_getsize $sys u` # Inputs Ny=`mtt_getsize $sys y` # Outputs | > > | 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 | fi if [ -n "$4" ]; then algebraic_solver=$4 else algebraic_solver="Reduce_Solver" fi insertor=\<\< # help emacs sh-mode handle C++ lines echo Creating $filename with $method integration method # Find system constants Nx=`mtt_getsize $sys x` # States Nu=`mtt_getsize $sys u` # Inputs Ny=`mtt_getsize $sys y` # Outputs |
︙ | ︙ | |||
951 952 953 954 955 956 957 | static int row; if (dump_data) { if (row > 0) { Matrix written_data = data.extract (0, 0, row-1, data.cols ()-1); | | | | | | | 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 | static int row; if (dump_data) { if (row > 0) { Matrix written_data = data.extract (0, 0, row-1, data.cols ()-1); file $insertor "# name: mtt_dump" $insertor std::endl $insertor "# type: matrix" $insertor std::endl $insertor "# rows: " $insertor written_data.rows () $insertor std::endl $insertor "# columns: " $insertor written_data.columns () $insertor std::endl $insertor written_data; file.flush (); } return; } const int nx = x.length (), ny = y.length (); register int col = 0; |
︙ | ︙ | |||
982 983 984 985 986 987 988 | row++; }; static std::fstream fcputime ("MTT.cputime", std::ios::out | std::ios::trunc | std::ios::app); static clock_t cputime0 = clock(); static clock_t cputime1 = cputime0; clock_t cputime = clock(); | | | | | | | | | | 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 | row++; }; static std::fstream fcputime ("MTT.cputime", std::ios::out | std::ios::trunc | std::ios::app); static clock_t cputime0 = clock(); static clock_t cputime1 = cputime0; clock_t cputime = clock(); fcputime $insertor t $insertor '\t' $insertor static_cast <double> (cputime - cputime0) / CLOCKS_PER_SEC $insertor '\t' $insertor static_cast <double> (cputime - cputime1) / CLOCKS_PER_SEC $insertor std::endl; cputime1 = cputime; if (nrows == row) { #if (CODEGENTARGET == STANDALONE) file $insertor "# name: mtt_dump" $insertor std::endl $insertor "# type: matrix" $insertor std::endl $insertor "# rows: " $insertor data.rows () $insertor std::endl $insertor "# columns: " $insertor data.columns () $insertor std::endl $insertor data; file.flush (); #elif ((CODEGENTARGET == OCTAVEDLD) || (CODEGENTARGET == MATLABMEX)) set_global_value ("MTT_data", data); #endif // (CODEGENTARGET == STANDALONE) row = 0; fcputime.close(); } |
︙ | ︙ | |||
1116 1117 1118 1119 1120 1121 1122 | ColumnVector null (0); mtt_write (0.0, null, null, 0, true, file); } void handle_signal (int signum) { // handle some signals to ensure data is written. | | | | 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 | ColumnVector null (0); mtt_write (0.0, null, null, 0, true, file); } void handle_signal (int signum) { // handle some signals to ensure data is written. std::cerr $insertor "# Writing data to MTT.core (signal " $insertor signum $insertor ")" $insertor std::endl; std::ofstream corefile ("MTT.core"); dump_data (corefile); switch (signum) { case SIGFPE: // Intel chips do not raise SIGFPE for DIVZERO :-( // raise (SIGABRT); break; case SIGINT: break; case SIGQUIT: signal (SIGQUIT, SIG_DFL); raise (SIGQUIT); break; default: std::cerr $insertor "# Warning: make_ode2odes needs updating!" $insertor std::endl; signal (signum, SIG_DFL); raise (signum); break; } corefile.close (); set_signal_handlers (); } |
︙ | ︙ | |||
1245 1246 1247 1248 1249 1250 1251 | break; case 0: simpar = mtt_simpar (); numpar = mtt_numpar (); state0 = mtt_state (numpar); break; default: | | | 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 | break; case 0: simpar = mtt_simpar (); numpar = mtt_numpar (); state0 = mtt_state (numpar); break; default: std::cerr $insertor "usage: ${sys}_ode2odes (x par simpar)" $insertor std::endl; return; } ${sys}_ode2odes (state0, numpar, simpar); plhs[0] = mtt_mxArray (get_global_value ("MTT_data").matrix_value ()); } |
︙ | ︙ |