Overview
Comment:- parameters option
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: 92ee2d113013d8958fb637d496385a3dd98f525cbc2b674351f9616a266f14c0
User & Date: gawthrop@users.sourceforge.net on 2000-04-18 11:14:32
Other Links: branch diff | manifest | tags
Context
2000-04-18
11:24:19
Removed _numpar. check-in: 2ea0f553cf user: gawthrop@users.sourceforge.net tags: origin/master, trunk
11:14:32
- parameters option check-in: 92ee2d1130 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
11:14:18
Put in the -parameters option check-in: f6b2c1366c user: gawthrop@users.sourceforge.net tags: origin/master, trunk
Changes

Modified mttroot/mtt/bin/trans/lang_header from [1aec1a82a3] to [fa491f89c7].

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.8  1999/02/16 04:14:53  peterg
## Small change to modeline generation
##
## Revision 1.7  1999/01/20 22:19:21  peterg
## Puts emacs mode line at top of .m files
##
## Revision 1.6  1998/07/27 20:30:39  peterg










>
>
>







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.9  2000/04/08 10:23:38  peterg
## Added -noglobal option
##
## Revision 1.8  1999/02/16 04:14:53  peterg
## Small change to modeline generation
##
## Revision 1.7  1999/01/20 22:19:21  peterg
## Puts emacs mode line at top of .m files
##
## Revision 1.6  1998/07/27 20:30:39  peterg
36
37
38
39
40
41
42



43
44
45
46
47
48
49

# Args
while [ -n "`echo $1 | grep '^-'`" ]; do
  case $1 in
    -noglobal)
	noglobal=noglobal;
	;;



    *)
	echo $1 is an unknown option
        exit;;
  esac
  shift
done








>
>
>







39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55

# Args
while [ -n "`echo $1 | grep '^-'`" ]; do
  case $1 in
    -noglobal)
	noglobal=noglobal;
	;;
    -parameters)
	parameters=parameters;
	;;
    *)
	echo $1 is an unknown option
        exit;;
  esac
  shift
done

60
61
62
63
64
65
66








67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
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
	modeline='% -*-octave-*- Put Emacs into octave-mode%';
	ext='m';
	Lc='#';
	Rc='#';
	Lb='(';
	Rb=')';
	;;








    c)
	ext='c';
	Lc='/*';
	Rc='*/';
	Lb='[';
	Rb=']';
	;;
    java)
	ext='java';
	Lc='/*';
	Rc='*/';
	Lb='[';
	Rb=']';
	;;
    *)
	echo Language $language not supported - sorry; exit 1
esac

# Appropriate emacs mode line
cat <<EOF
$modeline
EOF

######### 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


######### c code
if [ "$language" = c ]; then
cat <<EOF
void $1_$rep() {
/*
System $system, representation $rep, language $language;
File $1_$rep.$ext;
Generated by MTT on `date`;

NB Arrays are be defined to be one larger than expected
 - the 0 element is not used.
*/

EOF






# Declarations
$MATRIX -q  <<EOF 
  %System structure
  [nx,ny,nu,nz,nyz] = $1_def;

  printf("$Lc Declare standard arrays $Rc\n");







>
>
>
>
>
>
>
>


















<
<
<
<












>
















>
>
>
>







66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
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
	modeline='% -*-octave-*- Put Emacs into octave-mode%';
	ext='m';
	Lc='#';
	Rc='#';
	Lb='(';
	Rb=')';
	;;
    p)
	modeline='% -*-octave-*- Put Emacs into octave-mode%';
	ext='m';
	Lc='#';
	Rc='#';
	Lb='[';
	Rb=']';
	;;
    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


######### c code
if [ "$language" = c ]; then
cat <<EOF
void $1_$rep() {
/*
System $system, representation $rep, language $language;
File $1_$rep.$ext;
Generated by MTT on `date`;

NB Arrays are be defined to be one larger than expected
 - the 0 element is not used.
*/

EOF

# Appropriate emacs mode line
cat <<EOF
$modeline
EOF

# Declarations
$MATRIX -q  <<EOF 
  %System structure
  [nx,ny,nu,nz,nyz] = $1_def;

  printf("$Lc Declare standard arrays $Rc\n");
173
174
175
176
177
178
179











180
181
182
183
184
185
186
$extras
EOF
fi

# Globals
if [ -z "$noglobal" ]; then
    sympar2global_txt2lang $1 $language











fi

## if [ "$language" = "c" ] || [ "$language" = "m" ]; then
##   if [ "$rep" != "sm" ]&&[ "$rep" != "dm" ]&&[ "$rep" != "switch" ]; then
##   # Common part - ode (c and m)
##   # Use octave for this bit - needs the definition file
##   $MATRIX -q  <<EOF 







>
>
>
>
>
>
>
>
>
>
>







188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
$extras
EOF
fi

# Globals
if [ -z "$noglobal" ]; then
    sympar2global_txt2lang $1 $language
else
cat<<EOF
global ...
mtt_no_globals ..
;
EOF
fi

# Explicit parameters
if [ -n "$parameters" ]; then
    sympar2par_txt2m $1 
fi

## if [ "$language" = "c" ] || [ "$language" = "m" ]; then
##   if [ "$rep" != "sm" ]&&[ "$rep" != "dm" ]&&[ "$rep" != "switch" ]; then
##   # Common part - ode (c and m)
##   # Use octave for this bit - needs the definition file
##   $MATRIX -q  <<EOF 


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