Overview
Comment:Don't call the _input function - make it external from now on ...
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: a20789181dd815abf38f83cfa3986897d8d414cf6e73c262feee906d4d36ae38
User & Date: gawthrop@users.sourceforge.net on 1998-07-19 15:52:15
Other Links: branch diff | manifest | tags
Context
1998-07-19
16:00:22
Added smx representation check-in: c396c88b7c user: gawthrop@users.sourceforge.net tags: origin/master, trunk
15:52:15
Don't call the _input function - make it external from now on ... check-in: a20789181d user: gawthrop@users.sourceforge.net tags: origin/master, trunk
12:44:35
Set MTTYz := 0 if the array is empty - avoids irritating error
message.
check-in: a249e95c5e user: gawthrop@users.sourceforge.net tags: origin/master, trunk
Changes

Modified mttroot/mtt/bin/trans/lang_header from [72de602827] to [01b10f8c3c].

1
2
3
4
5
6
7
8
9
10



11
12
13
14
15
16
17
#!/bin/sh

# Generates function header for a computer language
# PJ Gawthrop May 1998

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$



## Revision 1.1  1998/05/23 16:17:40  peterg
## Initial revision
##
###############################################################


# Set up the language specific stuff










>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/bin/sh

# Generates function header for a computer language
# PJ Gawthrop May 1998

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.2  1998/05/24 12:47:39  peterg
## This still needs worjk doing for c generation!!
##
## Revision 1.1  1998/05/23 16:17:40  peterg
## Initial revision
##
###############################################################


# Set up the language specific stuff
33
34
35
36
37
38
39







40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
    c)
	ext='c';
	Lc='/*';
	Rc='*/';
	Lb='[';
	Rb=']';
	;;







    *)
	echo Language $language not supported - sorry; exit 1
esac

######### Octave (matlab) code
if [ "$language" = m ]; then
cat <<EOF
function $output = $1_$rep($args);
% $output = $1_ode($args);
%System $system, representation $rep, language $language;
%File $1_$rep.$ext;
%Generated by MTT on `date`;
%
EOF
fi








>
>
>
>
>
>
>








|







36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
    c)
	ext='c';
	Lc='/*';
	Rc='*/';
	Lb='[';
	Rb=']';
	;;
    java)
	ext='java';
	Lc='/*';
	Rc='*/';
	Lb='[';
	Rb=']';
	;;
    *)
	echo Language $language not supported - sorry; exit 1
esac

######### Octave (matlab) code
if [ "$language" = m ]; then
cat <<EOF
function $output = $1_$rep($args);
% $output = $1_$rep($args);
%System $system, representation $rep, language $language;
%File $1_$rep.$ext;
%Generated by MTT on `date`;
%
EOF
fi

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










printf("$Lc Time $Rc\n");
printf("  double t;\n");
printf("\n");

EOF

fi













# Any extra bits ..
if [ -n "$extras" ]; then
cat <<EOF
$Lc Extra bits here $Rc
$extras
EOF
fi

# Globals
sympar2global_txt2lang $1 $language


# Common part - ode
# Use octave for this bit - needs the definition file
$MATRIX -q  <<EOF 
  %System structure
  [nx,ny,nu,nz,nyz] = $1_def;


printf("$Lc======  Read in the input ======$Rc\n");
printf("mttu = $1_input(mttx,t);\n");
printf("\n");


printf("$Lc====== Set up the state variables ======$Rc\n");
for i = 1:nx
  printf("  mttx%i = mttx$Lb%i$Rb;\n",i,i);
end;
printf("\n");

printf("$Lc====== Set up the input variables ======$Rc\n");
for i = 1:nu
  printf("  mttu%i = mttu$Lb%i$Rb;\n",i,i);
end;
printf("\n");

EOF

















>
>
>
>
>
>
>
>
>
>
>
>












>
|






|
|
|















>
>
>
>
>
>
>
>
>
>
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
166
167
168
169
170
171
172
173
174
175
176
177
178
179
printf("$Lc Time $Rc\n");
printf("  double t;\n");
printf("\n");

EOF

fi

if [ "$language" = "java" ]; then
cat <<EOF
public class $1_ode{
/*
System $system, representation $rep, language $language;
File $1_$rep.$ext;
Generated by MTT on `date`;
*/

EOF
fi

# Any extra bits ..
if [ -n "$extras" ]; then
cat <<EOF
$Lc Extra bits here $Rc
$extras
EOF
fi

# Globals
sympar2global_txt2lang $1 $language

if [ "$language" = "c" ] || [ "$language" = "m" ]; then
# Common part - ode (c and m)
# Use octave for this bit - needs the definition file
$MATRIX -q  <<EOF 
  %System structure
  [nx,ny,nu,nz,nyz] = $1_def;


#printf("$Lc======  Read in the input ======$Rc\n");
#printf("mttu = $1_input(mttx,t);\n");
#printf("\n");


printf("$Lc====== Set up the state variables ======$Rc\n");
for i = 1:nx
  printf("  mttx%i = mttx$Lb%i$Rb;\n",i,i);
end;
printf("\n");

printf("$Lc====== Set up the input variables ======$Rc\n");
for i = 1:nu
  printf("  mttu%i = mttu$Lb%i$Rb;\n",i,i);
end;
printf("\n");

EOF
fi

#if [ "$language" = "java" ]; then

#$MATRIX -q <<EOF   
#    printf("JAVA\n");
#EOF

#fi


MTT: Model Transformation Tools
GitHub | SourceHut | Sourceforge | Fossil RSS ]