69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
// -*-c++-*- Put emacs into c++-mode
//
// System ${Sys}, representation input, language oct;
// File ${Sys}_input.oct;
// Generated by MTT on `date`;
#ifdef STANDALONE
#include <octave/oct.h>
#include "${Sys}_def.h"
void strip_comments (istream &str)
{
char c;
c = str.peek ();
|
>
|
>
>
>
>
>
>
|
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
|
// -*-c++-*- Put emacs into c++-mode
//
// System ${Sys}, representation input, language oct;
// File ${Sys}_input.oct;
// Generated by MTT on `date`;
// Code generation directives
#define STANDALONE 0
#define OCTAVEDLD 1
#if (! defined (CODEGENTARGET))
#define CODEGENTARGET STANDALONE
#endif // (! defined (CODEGENTARGET))
#if (CODEGENTARGET == STANDALONE)
#include <octave/oct.h>
#include "${Sys}_def.h"
void strip_comments (istream &str)
{
char c;
c = str.peek ();
|
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
|
ColumnVector F${Sys}_input (
ColumnVector &mttx,
ColumnVector &mtty,
const double &mttt,
ColumnVector &mttpar
)
{
#endif // STANDALONE
#ifndef STANDALONE
#include <octave/oct.h>
#include <variables.h>
#include "${Sys}_def.h"
DEFUN_DLD (${Sys}_input, args, ,
"Usage: [mttu] = ${Sys}_input()
Octave input (-stdin) representation of system ${Sys}
Generated by MTT on `date`")
{
octave_value_list retval;
#endif // ! STANDALONE
ColumnVector mttu (MTTNU);
// Set up the mttu vector
#ifndef STANDALONE
int MTT_input_index = static_cast<int>(get_global_value ("MTT_input_index").double_value ());
int MTT_input_last = static_cast<int>(get_global_value ("MTT_input_last").double_value ());
Matrix MTT_input = get_global_value ("MTT_input").matrix_value();
mttu = MTT_input.row (MTT_input_index);
if (MTT_input_index < (MTT_input_last - 1))
{
set_global_value ("MTT_input_index", static_cast<double>(++MTT_input_index));
}
#else
double t, u;
strip_comments (cin);
cin >> t;
for (register int i = 0; i < MTTNU; i++)
{
cin >> u;
mttu(i) = u;
}
#endif
#ifndef STANDALONE
retval (0) = octave_value (mttu);
return (retval);
}
#endif // ! STANDALONE
#ifdef STANDALONE
return mttu;
}
#endif // STANDALONE
EOF
}
case $lang in
p)
make_p
;;
|
|
<
|
|
|
|
|
<
|
|
|
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
|
ColumnVector F${Sys}_input (
ColumnVector &mttx,
ColumnVector &mtty,
const double &mttt,
ColumnVector &mttpar
)
{
#elif (CODEGENTARGET == OCTAVEDLD)
#include <octave/oct.h>
#include <variables.h>
#include "${Sys}_def.h"
DEFUN_DLD (${Sys}_input, args, ,
"Usage: [mttu] = ${Sys}_input()
Octave input (-stdin) representation of system ${Sys}
Generated by MTT on `date`")
{
octave_value_list retval;
#endif // (CODEGENTARGET == STANDALONE)
ColumnVector mttu (MTTNU);
// Set up the mttu vector
#if (CODEGENTARGET == OCTAVEDLD)
int MTT_input_index = static_cast<int>(get_global_value ("MTT_input_index").double_value ());
int MTT_input_last = static_cast<int>(get_global_value ("MTT_input_last").double_value ());
Matrix MTT_input = get_global_value ("MTT_input").matrix_value();
mttu = MTT_input.row (MTT_input_index);
if (MTT_input_index < (MTT_input_last - 1))
{
set_global_value ("MTT_input_index", static_cast<double>(++MTT_input_index));
}
#elif (CODEGENTARGET == STANDALONE)
double t, u;
strip_comments (cin);
cin >> t;
for (register int i = 0; i < MTTNU; i++)
{
cin >> u;
mttu(i) = u;
}
#endif // (CODEGENTARGET == OCTAVEDLD)
#if (CODEGENTARGET == OCTAVEDLD)
retval (0) = octave_value (mttu);
return (retval);
}
#elif (CODEGENTARGET == STANDALONE)
return mttu;
}
#endif // (CODEGENTARGET == OCTAVEDLD)
EOF
}
case $lang in
p)
make_p
;;
|