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: 1404c4a1cdb4933ec5ba088c5fae09faa8d1968a39af81f25e13df0d656ca604
User & Date: gawthrop@users.sourceforge.net on 2000-12-27 16:05:29
Other Links: branch diff | manifest | tags
Context
2000-12-27
16:06:17
*** empty log message *** check-in: 406757eed0 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
16:05:29
Initial revision check-in: 1404c4a1cd user: gawthrop@users.sourceforge.net tags: origin/master, trunk
15:16:44
If then else format check-in: f760d4f50f user: gawthrop@users.sourceforge.net tags: origin/master, trunk
Changes

Added mttroot/mtt/bin/trans/makedoc version [577d894696].

















































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
#! /bin/sh

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

# Bourne shell script: makedoc
# Encapsulates a tex file in a document.

# P.J.Gawthrop August 1996
# Copyright (c) P.J.Gawthrop, 1996.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.1  1997/05/17 13:55:42  peterg
## Initial revision
##
# Revision 1.2  1997/04/23  10:06:51  peterg
# Put output in the correct file!
#
# Revision 1.1  1997/04/23  10:03:41  peterg
# Initial revision
#
###############################################################

date=`date`
switches=$1
system=$2
representation=$3
lang=$4
args=$5
documenttype=$6
ps=$7

if [ "$documenttype" = "book" ]; then
  document=book
else
  document=article
fi

if [ "$documenttype" = "book" ]||[ "$documenttype" = "article" ]; then
    title="\title{Report on $system}"
else
    title="\title{System $system, representation $representation}"
fi

filename=$2_$3.doc
texname=$2_$3.tex
indexname=$2_$3.ind

# Inform user
echo "Creating $filename"
# Make arguments acceptable to LateX
Args=`echo $args | sed 's/_/\\\_/g'`

cat<<EOF  > $filename 
\nonstopmode
\documentclass[12pt,a4paper]{$document}
    $title
    \author{Generated by MTT using :\\\\
     (mtt $switches $system $representation $lang $Args)}
    \date{$date}
EOF

if [ "$documenttype" = "book" ]; then
  cat <<EOF   >> $filename 
  \makeindex
EOF
fi

cp -v $MTTPATH/trans/*.sty .
cat  >> $filename <<EOF
\usepackage{mtt_$ps}
EOF

cat <<EOF  >> $filename 
\begin{document}
  \maketitle
EOF

if [ "$documenttype" = "book" ]||[ "$documenttype" = "article" ]; then
  cat $MTTPATH/trans/contents.tex >> $filename
fi

cat <<EOF  >> $filename 
%Fancy headings
  \pagestyle{fancy}
  \renewcommand{\sectionmark}[1]{\markboth{#1}{}}
  \lhead{Report \textbf{$system}}
  \rhead{Representation \textbf{$representation}}
  \rfoot{Page \thepage.}\cfoot{}
  \lfoot{\emph{$date}}

  \input{$texname}
EOF

if [ "$documenttype" = "book" ]; then
  cat <<EOF   >> $filename 
  \input{$indexname}
EOF
fi

cat<<EOF  >> $filename 
\end{document}
EOF












Added mttroot/mtt/bin/trans/ode_r2tex version [d72a266090].



















































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
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
#! /bin/sh

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

# Bourne shell script: ode_r2tex
# Reduce differential-algebraic to LaTex differential-algebraic equations.
# P.J.Gawthrop 10th May 1991, April 1994
# Copyright (c) P.J.Gawthrop, 1991, 1994, 1996.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.3  1998/01/23 15:51:01  peterg
## Repleace eqnarray by equation + aligned -- this works with Latex2html
##
## Revision 1.2  1996/12/20 08:59:10  peterg
## Now writes out mtti instead of mtt_{i} -- lets latex_tidy do the
## conversion.
##
## Revision 1.1  1996/12/20 08:53:57  peterg
## Initial revision
##
###############################################################

# Inform user
echo Creating $1_ode.tex

# Remove the old log file
rm -f ode_r2tex.log

# Use reduce to accomplish the transformation
reduce >ode_r2tex.log << EOF

%Read the definitions file
in "$1_def.r";

%Read the differential-algebraic equations file
in "$1_ode.r";

%Read the symbolic parameter file
%%in "$1_sympar.r";



OFF Echo;
OFF Nat;

%Read the substitution file
IN "$1_subs.r";

%Read the simplifying expressions file
IN "$1_simp.r";

OUT "$1_ode.tex";

%Write out the  differential-algebraic equations.

write "%File: $1_ode.tex";

write "%ordinary differential equations";
write "% Generated by MTT";

IF MTTNx>0 THEN
BEGIN
  write"\begin{equation} \label{eq_$1_ode_x}";
  write"\begin{aligned}";
  FOR Row := 1:MTTNx DO
  BEGIN
	write "\dot MTTX", Row, " &= ";
	write "{";
	write MTTdx(Row,1);
	write "}";
        IF Row<MTTNx THEN write "\cr";
  END;
  write"\end{aligned}";
  write"\end{equation}";
END;

IF MTTNyz>0 THEN
BEGIN
  write"\begin{equation}";
  write"\begin{aligned}";
FOR Row := 1:MTTNyz DO
  BEGIN
	write "0 &= ";
	write "{";
	write MTTyz(Row,1);
	write "}";
        IF Row<MTTNyz THEN write "\cr";
  END;
  write"\end{aligned}";
  write"\end{equation}";
END;

IF MTTNy>0 THEN
BEGIN
  write"\begin{equation} \label{eq_$1_ode_y}";
  write"\begin{aligned}";
  FOR Row := 1:MTTNy DO
  BEGIN
	write "MTTy", Row, " &= ";
	write "{";
	write MTTy(Row,1);
	write "}";
        IF Row<MTTNy THEN write "\cr";
  END;
  write"\end{aligned}";
  write"\end{equation}";
END;





SHUT "$1_ode.tex";
quit;
EOF

Added mttroot/mtt/bin/trans/rep_txt2tex version [d29f0048ba].





































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
#! /bin/sh

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

# Bourne shell script: rep_txt2tex
# Converts the text file dercribing a report to a report.
# P.J.Gawthrop August 1996
# Copyright (c) P.J.Gawthrop, 1996.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.15  2000/04/06 10:57:12  peterg
## Removed debug line
##
## Revision 1.14  2000/04/06 10:51:14  peterg
## replaces $PWD by `pwd` for sh compatibility
##
## Revision 1.13  1999/10/19 23:47:27  peterg
## Rewrote for the extra representations - but with .ps at the end
## Need to retrofit old desc files using multiple figures
##
## Revision 1.12  1999/10/19 03:33:01  peterg
## Temporaraly removed argument stripping
##
## Revision 1.11  1999/02/17 02:00:29  peterg
## Absolute pathname for files.
## Indirect include via \input
##
## Revision 1.10  1998/08/25 12:45:27  peterg
## Added icad to languages
##
## Revision 1.9  1998/03/09 13:26:22  peterg
## Removed `system' from part and section headers.
##
## Revision 1.8  1998/02/09 08:59:35  peterg
## Minor debugging lines removed.
##
## Revision 1.7  1998/01/29 19:32:33  peterg
## Removed a spurious X from the file -- tried to run  the X server !!!
##
## Revision 1.6  1997/12/04 22:08:52  peterg
## Handles multiple odes.ps files
##
## Revision 1.5  1997/12/04 17:05:57  peterg
## Now handles multiple odeso.ps files
##
## Revision 1.4  1997/08/25 09:15:48  peterg
## Don't do sections for unrecognised languages.
##
# Revision 1.3  1997/06/27  13:28:25  peterg
# New version using explicit command line arguments in the text file
#
## Revision 1.2  1997/05/19 16:11:36  peterg
## Modified section headers.
##
# Revision 1.1  1996/08/18  20:00:38  peter
# Initial revision
#
###############################################################

documenttype=$2; 

if [  "$documenttype" = "book" ]; then # do book version
  # Inform user
  echo "Creating $1_rep.tex (directory version)"
  strip_comments < $1_rep.txt|\
  awk '
BEGIN{
oldpart = ""
}
{
  # Find directory name.
  for (i=1;i<NF;i++){
    if ($i=="-d") 
       directory=$(i+1);
  }
  # Find next to last name
  N=split(directory,a,"/");
  if (N>1) 
    part = a[N-1];
  if (length(part)>0)
    if (part!=oldpart)
      printf("\\part{\\textbf{%s}}\n", part);
  oldpart=part;
  printf("\\chapter{\\textbf{%s}}\n", $(NF-2));
  printf("\\label{chap:%s(%s)}\n", $(NF-2), directory);
  printf("\\input{%s/%s_rep}\n\n", directory, $(NF-2));
  }' > $1_rep.tex


else # do article and section version

if [ -z "$3" ]; then
  directory="";
else
  directory=$3/;
fi

# Inform user
echo "Creating $1_rep.tex"

# Create the LaTeX file
strip_comments <$1_rep.txt |\
awk '
{
  ## Count the switches (noting that -i has an argument)
  Switches=0;
  for (i=2;i<=NF;i++) {
    if (match($i,"-")==1) Switches++;
    if (match($i,"-i")==1) Switches++;
  }

  System = $(Switches+2)
  Representation = $(Switches+3);
  Multiple = "odes odeso sms smso daes daeso";
  Language = $(Switches+4);
  Languages = "tex txt r m c h ps icad";
  args = $(Switches+5);
  quote = "\047";
  args = gensub(quote, "", "g",  args);
  args = gensub(/"/, "", "g",  args);
#  args = substr(Args,2,length(Args)-2);
#  if ( (length(Args)>0)&&(match(Multiple,Representation)>0)) {
  if ( (length(args)>0)&&(match(Language,"ps")>0)) {
    _Args = sprintf("-%s", args); 
    __Args = sprintf("-%s", gensub(/_/, "-", "g", args) );
    ___Args = sprintf("-%s", gensub(/,/, "-", "g", args) );
  }
  else
  {
  _Args = "";
  __Args = "";
  ___Args = "";
  }
#  print "DEBUG", Language, args, _Args, __Args
  RepLang = sprintf("%s%s.%s", Representation, __Args, Language);
  SysRepLang = sprintf("%s_%s", System, RepLang);
  SysRep = sprintf("%s_%s%s", System, Representation, _Args);
  filename = gensub(/,/, "-", "g", SysRep);
  section_head = sprintf("\\textbf{%s.%s}: System %s, representation \\textbf{%s%s}, language \\textbf{%s}",
   Representation,Language,System,Representation,__Args,Language);
   
# section headings
    if (match(Languages,Language)>0) {
    print "\n\n\\section{" section_head "}";
    print "\\label{sec:" SysRepLang "}";
    print "\\index{\\textbf{" System "} -- " Representation "}";
    
    print "\n\nMTT command:";
    print "\\begin{verbatim}";
      for (i=1;i<=NF;i++) printf("%s ", $i);
    print "\n\\end{verbatim}";
    }

# tex files
    if( match("tex",Language)>0) {
      printf("  \\input{%s/%s_%s.%s}\n", PWD, System, Representation, Language);
#      command = sprintf("sed s!fig{!fig{%s! < %s_%s.%s", Directory, System, Representation, Language);
#      system(command);    
}

# text files
    if( match("txt r m c h icad",Language)>0) {
      print "  \\begin{verbatim}";
      command = sprintf("cat %s_%s.%s", System, Representation, Language);
      system(command);
      print "  \\end{verbatim}";  
    }
# ps files
    if( match("ps",Language)>0) {
      printf("This representation is given as Figure \\Ref{fig:%s}.\n", SysRepLang);
      FileName = sprintf("%s/%s", PWD, filename);
      Label = sprintf("%s", SysRepLang);
      Caption = sprintf("System \\textbf{%s}, representation %s%s", System, Representation, __Args);
      printf("\\fig{%s}\n    {%s}\n    {0.9}\n    {%s}\n",FileName,Label,Caption);
  }
}
END {

}' system=$1 Directory=$directory PWD=`pwd` > $1_rep.tex

fi







Added mttroot/mtt/bin/trans/sm_r2tex version [d3ad0d67bd].



































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
97
#! /bin/sh

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

# Bourne shell script: sm_r2tex
# Reduce constrained-state matrices to LaTex constrained-state matrices.
# P.J.Gawthrop  9 Sep 1991, May 1994
# Copyright (c) P.J.Gawthrop, 1991, May 1994, 1996.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.4  1998/02/18 08:25:36  peterg
## Now uses latex_matrix for formatting
##
## Revision 1.3  1997/06/13 13:50:11  peterg
## Matrices in amstex format
##
# Revision 1.2  1997/04/18  12:54:00  peterg
# No longer does labels.
#
# Revision 1.1  1996/08/19  15:19:23  peter
# Initial revision
#
###############################################################


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

# Remove the old log file
rm -f sm_r2tex.log

# Use reduce to accomplish the transformation
reduce >sm_r2tex.log << EOF

%Read the definitions file
in "$1_def.r";

%Read the constrained-state matrices file
in "$1_$2.r";

%Read the symbolic parameters file
%%in "$1_sympar.r";

%Read the substitution file
in "$1_subs.r";

%Read the simplification file
in "$1_simp.r";

%Read the formatting function
in "$MTTPATH/trans/latex_matrix.r";

OFF Echo;
OFF Nat;

MATRIX MTT_Matrix(MTTNx,MTTNx);

OUT "$1_$2.tex";

%Write out the state matrices.
write "%state  matrices $1";
write "%File: $1_$2.tex";
write"";

MTT_Matrix := MTTA$ 
MTT_Matrix_name := "MTTA"$
MTT_Matrix_n := MTTNx$
MTT_Matrix_m := MTTNx$
LaTeX_Matrix()$

MTT_Matrix := MTTB$ 
MTT_Matrix_name := "MTTB"$
MTT_Matrix_n := MTTNx$
MTT_Matrix_m := MTTNu$
LaTeX_Matrix()$

MTT_Matrix := MTTC$ 
MTT_Matrix_name := "MTTC"$
MTT_Matrix_n := MTTNy$
MTT_Matrix_m := MTTNx$
LaTeX_Matrix()$

MTT_Matrix := MTTD$ 
MTT_Matrix_name := "MTTD"$
MTT_Matrix_n := MTTNu$
MTT_Matrix_m := MTTNu$
LaTeX_Matrix()$

SHUT "$1_$2.tex";
quit;
EOF

Added mttroot/mtt/bin/trans/ss_r2tex version [5d4b26acd7].



























































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
#! /bin/sh

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

# Bourne shell script: ss_r2tex
# Reduce transfer-function matrices to LaTex transfer-function matrices.
# P.J.Gawthrop 9 June 1990, 8 July 1990, May 1994
# Copyright (c) P.J.Gawthrop, 1990, 1994.



# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %% Version control history
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %% $Id$
# %% $Log$
# %% Revision 1.2  1998/02/24 09:21:36  peterg
# %% Put under rcs
# %%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


#Unform user
echo Creating $1_ss.tex

# Remove the old log file
rm -f ss_r2tex.log

# Use reduce to accomplish the transformation
reduce >ss_r2tex.log << EOF


%Read the definitions file
in "$1_def.r";

%Read the parameter file
%%in "$1_sympar.r";

%Read the substitution file
in "$1_subs.r";

%Read the simplifiy file
in "$1_simp.r";

%Read the CR file
in "$1_cr.r";

%Read the steady-state file
in "$1_ss.r";

%Read the formatting function
in "$MTTPATH/trans/latex_matrix.r";

OFF Echo;
OFF Nat;
%ON Rounded;
%Precision 5;

OUT "$1_ss.tex";
write "%  - X0";
MTT_Matrix := MTTX$ 
MTT_Matrix_name := "MTTX"$
MTT_Matrix_n := MTTNx$
MTT_Matrix_m := 1$
LaTeX_Matrix()$

write "%  - U";
MTT_Matrix := MTTU$ 
MTT_Matrix_name := "MTTU"$
MTT_Matrix_n := MTTNu$
MTT_Matrix_m := 1$
LaTeX_Matrix()$


write "%  - Y";
MTT_Matrix := MTTY$ 
MTT_Matrix_name := "MTTY"$
MTT_Matrix_n := MTTNy$
MTT_Matrix_m := 1$
LaTeX_Matrix()$

write "%  - dX";
MTT_Matrix := MTTdX$ 
MTT_Matrix_name := "MTTdX"$
MTT_Matrix_n := MTTNx$
MTT_Matrix_m := 1$
LaTeX_Matrix()$

SHUT "$1_ss.tex";
quit;
EOF

Added mttroot/mtt/bin/trans/sub_sh2tex version [d032780a77].























































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
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
#!/bin/sh

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

# Bourne shell script: sub_sh2tex
# Converts _sub_sh files to a latex itemized list.
# P.J.Gawthrop May 1997
# Copyright (c) P.J.Gawthrop, 1997.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.7  1998/02/04 10:59:37  peterg
## Tidied up.
##
# Revision 1.6  1997/09/08  19:42:37  peterg
# Replaced copy by compcopy
#
## Revision 1.5  1997/08/15 11:20:13  peterg
## Explicitly copies compound components (if not already there)
##
# Revision 1.4  1997/06/24  08:28:26  peterg
# Now takes %SUMMARY description from the label file
# Appends count of number of subsystems at that level
#
## Revision 1.3  1997/05/21 10:07:36  peterg
## Fixed \ probs for GNU sh/echo
##
## Revision 1.2  1997/05/19 16:46:17  peterg
## *** empty log message ***
##
# Revision 1.1  1997/05/19  11:29:44  peterg
# Initial revision
#
###############################################################


#Useful strings
quote="'";
listtype="itemize"

# Maximum list depth - maybe I should learn sh arithmetic!!
# Just go to two levels
maxlevel='0+1+1'; 

#Look for a command line argument
labels=''; arg='';
while [ -n "`echo $1 | grep '-'`" ]; do
  case $1 in
	-l )
		labels='yes'; arg='-l' ;;
	*)
		echo "$1 is an invalid argument - ignoring" ;;
  esac
  shift
done


system=$1
filename=$2 


if [ -z "$3" ]; then
    level=0;
else
    level=$4;
fi

#Top-level commands
if [ -z "$2" ]; then
  filename="$1_sub.tex"

  # Inform user
  echo "Creating $filename"

  #Write some file headers
  echo "% Subsystem file for system $system ($filename)"   > $filename
  echo "% Generated by MTT at `date`"  >> $filename
  echo  >> $filename
fi

# Write list item if not at the top level.
if [ -n "$2" ]; then
  #Set up some names
  filename=$2
  figfile=$3_abg.fig
  lblfile=$1_lbl.txt
  summary='%SUMMARY'

  #Get the system description, copying where necesary
  mtt -q -u compcopy $system $MTTPATH/lib/comp/compound
  # mtt -q -u $system lbl txt
  desc=`grep $summary $lblfile | sed "s/$summary//"`

  #Count the number of subsystems
  subs=`grep -c $system $figfile`

  if [ "$labels" = "yes" ]; then
    echo '  \item '$desc ' ('$subs') Section \Ref{sec:'$system'}' >> $filename
  else
    echo '  \item' $desc ' ('$subs')'   >> $filename
  fi
fi

# Create the subsystem sh files (if not too deep)
if [ "$level" != "$maxlevel" ]; then
    mtt -q -u  -l 1 $system sub sh

    # Write the list of subsystems (if they exist).
    n_subsystems=`grep -c '$1' $1_sub.sh`

    if [ "$n_subsystems" != "0" ]; then
	cat <<EOF >> $filename
	    \begin{$listtype}
EOF
	# Recursively generate the subsystems
        level1="$level+1"
	sh $system\_sub.sh "sub_sh2tex $arg " " $filename $system $level1" 
	cat <<EOF >> $filename
	    \end{$listtype}
EOF
else
    cat  <<EOF >> $filename
         No subsystems.
EOF
fi
fi








Added mttroot/mtt/bin/trans/sympar_txt2tex version [9ce2cbef3d].



























































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
#! /bin/sh

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

# Bourne shell script: sympar_txt2tex

# Sympar file - text to TeX table conversion
# P.J.Gawthrop April 1997
# Copyright (c) P.J.Gawthrop, 1997.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.2  1998/01/19 14:17:26  peterg
## Modified struc_txt2tex to make this.
##
## Revision 1.1  1998/01/19 14:16:39  peterg
## Initial revision
##
# Revision 1.3  1997/12/06  19:10:41  peterg
# Reverted to tabular --- from supertabular
#
# Revision 1.2  1997/04/15  11:17:58  peterg
# Uses supertabular for long tables.
#
# Revision 1.1  1997/04/15  09:49:04  peterg
# Initial revision
#
###############################################################


# Inform user
echo "Creating $1_sympar.tex"

rm -f mtt_error

#Write some file headers
echo "%% Parameter file ($1_sympar.txt)" > $1_sympar.tex
echo "%% Generated by MTT at `date`" >> $1_sympar.tex

# This is the main transformation using awk
sed 's/_/\\_/g' < $1_sympar.txt |  awk '
#function header(what){
#  print "  \\centering";
# print "  \\tablefirsthead{\\hline %";
#  print "    \\multicolumn{4}{|c|}{\\bf List of " what "s for system " SYSTEM "} \\\\";
#  print "    \\hline";
#  print "     & Component & System & Repetition \\\\";
#  print "    \\hline}";
#
#  print "  \\tablehead{\\hline %";
#  print "    \\multicolumn{4}{|c|}{\\bf List of " what "s for system " SYSTEM " (continued)} \\\\";
#  print "    \\hline";
#  print "     & Component & System & Repetition \\\\";
#  print "    \\hline}";
#
#  print "  \\tabletail{\\hline}";
#  print "  \\begin{supertabular}{|l|l|l|l|}";
#}
function header(what){
  print "\\begin{table}[htbp]";
  print "  \\centering";
  print "  \\begin{tabular}{|l|l|}";  print "    \\hline";
  print "     Parameter & System\\\\";
  print "    \\hline";
}
function footer(what){
  print "    \\hline";
  print "  \\end{tabular}";
  print "  \\caption{" what "}";
  print "\\end{table}";
  print "   \\bigskip";
  print "   \\bigskip";
}
BEGIN{
  header($1);
}
{
  print $1, "&", $2, "\\\\";
}
END{
  footer("Parameters")
}
'  SYSTEM=$1  >> $1_sympar.tex 2>mtt_error.txt

# Now invoke the standard error handling.
mtt_error mtt_error.txt


Added mttroot/mtt/bin/trans/tf_r2tex version [30ab1ef46d].



































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
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
#! /bin/sh

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

# Bourne shell script: tf_r2tex
# Reduce transfer-function matrices to LaTex transfer-function matrices.
# P.J.Gawthrop 9 June 1990, 8 July 1990, April 1994.
# Copyright (c) P.J.Gawthrop, 1990, 1994.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.2  1996/12/20 08:59:40  peterg
## Now writes out mtti instead of mtt_{i} -- lets latex_tidy do the
## conversion.
##
## Revision 1.1  1996/11/05 11:01:51  peterg
## Initial revision
##
###############################################################

#Inform user
echo Creating $1_tf.tex

# Remove the old log file
rm -f tf_r2tex.log

# Use reduce to accomplish the transformation
reduce >tf_r2tex.log << EOF

%Read the definitions file
in "$1_def.r";

%Read the parameter file
%%in "$1_sympar.r";

%Read the formatting function
in "$MTTPATH/trans/latex_matrix.r";

%Read the transfer-function matrices file
in "$1_tf.r";

%Read the substitution file
IN "$1_subs.r";

%Read the simplification file
in "$1_simp.r";

OFF Echo;
OFF Nat;

OUT "$1_tf.tex";
MTT_Matrix := MTTTF$ 
MTT_Matrix_name := "MTTG"$
MTT_Matrix_n := MTTNy$
MTT_Matrix_m := MTTNu$
LaTeX_Matrix()$

%%  FOR Row := 1:MTTNy DO
%%  BEGIN
%%    FOR Col := 1:MTTNu DO
%%    BEGIN
%%      numerator := num(MTTtf(Row,Col));
%%      denominator := den(MTTtf(Row,Col));
%%      cnumerator := coeff(numerator, s);
%%      cdenominator := coeff(denominator, s);
%%      write "!begin{equation} !label{eq_$1_tf", Row, Col, "}";
%%      IF MTTNy=1 AND MTTNu=1 
%%                          THEN
%%                          write "MTTTF(s) =  {"
%%                          ELSE
%%                          write "MTTTF", Row, Col, "(s) =  {";
%%      IF numerator = 0
%%       THEN write "0"
%%       ELSE 
%%       BEGIN
%%           FOR i := 1:Length(cnumerator) DO
%%           BEGIN
%%             cof := part(cnumerator,i);
%%               IF cof NEQ 0 THEN 
%%               BEGIN
%%                IF i>1 THEN write " + ";
%%                IF cof NEQ 1 THEN 
%%                 BEGIN
%%                 IF Terms(cof)>1 THEN write "(", cof, ")"
%%                                 ELSE write cof; 
%%                 END
%%                 ELSE IF i=1 THEN Write "1";
%%
%%               IF i=2 THEN write "s";
%%               IF i>2 THEN write "s^", i-1;
%%               END;
%%           END;
%%       END;
%%
%%       IF denominator NEQ 1 THEN
%%       BEGIN
%%       Write "!over";
%%           FOR i := 1:Length(cdenominator) DO
%%           BEGIN
%%           cof := part(cdenominator,i);
%%               IF cof NEQ 0 THEN 
%%               BEGIN
%%               IF i>1 THEN write " + ";
%%               IF cof NEQ 1 THEN 
%%               BEGIN
%%                 IF Terms(cof)>1 THEN write "(", cof, ")"
%%                                 ELSE write cof; 
%%               END
%%               ELSE IF i=1 THEN Write "1";
%%
%%             IF i=2 THEN write "s";
%%             IF i>2 THEN write "s^", i-1;
%%             END;
%%           END;
%%       END;
%%       write "}";
%%       write "!end{equation}";
%%    END;
%%  END;
%%
SHUT "$1_tf.tex";
quit;
EOF


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