Overview
Comment:Initial revision
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: ce28c6b4f92198db055ab01c325cc32f67edf14633e32841c5c15ce49cbc227d
User & Date: gawthrop@users.sourceforge.net on 2000-02-10 15:40:18
Other Links: branch diff | manifest | tags
Context
2000-02-10
18:51:31
Included OFF exp; in subs.r default check-in: f7d2d0f0d9 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
15:40:18
Initial revision check-in: ce28c6b4f9 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
15:03:10
Put subs.r file into the m-code generation -- allows the off exp;
switch for simpler expresions.
check-in: 2b9c75db77 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
Changes

Added mttroot/mtt/bin/trans/mtt_p2cc version [4424a8dffa].

































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
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
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
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: mtt_p2oct

# Pascal to .oct (octave loadable binary).
# P.J.Gawthrop Feb 2000
# Copyright (C) 2000 by Peter J. Gawthrop

    #$Id$	

# Find system constants
Nx=`mtt_getsize $1 x`
Nu=`mtt_getsize $1 u`

# Create numpar code
mtt_p2C $1 numpar

# Create input code
mtt_p2C $1 input

# Create the representation code
mtt_p2C $1 $2

# Inform user
echo Creating $1_$2.cc

# Create the c++ code
# Heading
date=`date`

cat > $1_$2.cc <<EOF
#include <octave/oct.h>
 
DEFUN_DLD ($1_$2, args, ,
	   "$1_$2 was generated by MTT on $date")
{
  ColumnVector mttdx ($Nx);
  ColumnVector mttu ($Nu);
  ColumnVector mttx = args(0).vector_value ();

EOF

#Extract Type info
#echo '/* Types */'                >> $1_$2.cc
#grep typedef $1_$2.C              >> $1_$2.cc

#Extract any additional mtt_tmp variables
awk 'BEGIN{
  writing = 1;
}
{
  if (match($1,"mtt")==1) writing=0;  
  if ( (writing)&&(match($0,"mtt_t[0-9]")>0) ) print $0;
}' < $1_$2.C >> $1_$2.cc

#Extract the numpar code
echo '/* Numerical parameters */' >> $1_$2.cc
awk '{
  if ($1=="}") writing=0;
  if (writing) print $0;
  if ($1=="{") writing=1;
}' <$1_numpar.C >> $1_$2.cc

#Extract the input code converting [] to ()
echo "/* Input information */" >> $1_$2.cc
awk '{
  if ($1=="}") writing=0;
  if (match($1,"mtt")==1) writing=1;
  if (writing) print $0;
}' <$1_input.C |\
sed 's/\[\([0-9]*\)\]/(\1)/g' >> $1_$2.cc


#Extract the rep code converting [] to ()
echo "/* Representation $2 information */" >> $1_$2.cc
awk '{
  if ($1=="}") writing=0;
  if (match($1,"mtt")==1) writing=1;
  if (writing) print $0;
}' <$1_$2.C |\
sed 's/\[\([0-9]*\)\]/(\1)/g' >> $1_$2.cc

# Tail
cat >> $1_$2.cc <<EOF

  return octave_value (mttdx);
}
EOF

# Convert to octave loadable code
echo Creating $1_$2.oct
mkoctfile $1_$2.cc


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