Overview
Comment:Now lower cases globals in numpar files
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: ee53e006ef1b19cb57394d3fdb673e426972ef4f235f03c425d132961bd2c2c5
User & Date: gawthrop@users.sourceforge.net on 1998-08-31 11:43:37
Other Links: branch diff | manifest | tags
Context
1998-09-02
10:30:30
Now writes out list of ports ans list of subsystems.
These ordereded lists determine the order of processing of ports ans
subsystems.
check-in: 7428a2fda5 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
1998-08-31
11:43:37
Now lower cases globals in numpar files check-in: ee53e006ef user: gawthrop@users.sourceforge.net tags: origin/master, trunk
10:49:15
Minor changes to -abg operation check-in: 77e68e13f0 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
Changes

Modified mttroot/mtt/bin/trans/txt2m from [2e1d8be855] to [6644a7d903].

11
12
13
14
15
16
17



18
19
20
21
22
23
24


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



# %% Revision 1.11  1998/08/14 10:43:44  peterg
# %% Added ImplicitS - sparse integration
# %%
# %% Revision 1.10  1998/08/11 13:27:51  peterg
# %% Lowercase mttLAST etc
# %%
# %% Revision 1.9  1998/07/30 15:07:17  peterg







>
>
>







11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27


# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %% Version control history
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %% $Id$
# %% $Log$
# %% Revision 1.12  1998/08/14 10:47:31  peterg
# %% Put ImplicitS sub before Implicit!!
# %%
# %% Revision 1.11  1998/08/14 10:43:44  peterg
# %% Added ImplicitS - sparse integration
# %%
# %% Revision 1.10  1998/08/11 13:27:51  peterg
# %% Lowercase mttLAST etc
# %%
# %% Revision 1.9  1998/07/30 15:07:17  peterg
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
    name='mttu';
    arg='(mttx,mttt)'
fi

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


if [ "$representation" != "simpar" ]; then
    #Create the $2 file complete with headers.


    echo "function $name = $1_$2$arg" > $1_$2.m
    echo "%% $2 file ($1_$2.m)" >> $1_$2.m
    echo "%% Generated by MTT at `date`" >> $1_$2.m
    echo "% Global variable list" >>  $1_$2.m
    sympar2global_txt2m $1 >> $1_$2.m
else
    echo "% Script file  $1_$2.m" > $1_$2.m
    echo '% Dummy globals' >>  $1_$2.m
    echo 'global ...' >>  $1_$2.m
    echo 'mtt_dummy_global;' >>  $1_$2.m


fi














#Write out the variables in m format.
cat  $1_$2.txt |\
awk -F#  'BEGIN{
quote = "\047";
doublequote = "\042";
}







<
<
|
>
>
|
|
|
<
<
<
<
|
|
|
>
>
|
|
>
>
>
>
>
>
>
>
>
>
>
>







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
    name='mttu';
    arg='(mttx,mttt)'
fi

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



#Create the $2 file complete with headers.
case $representation in
    simpar)
      echo "% Script file  $1_$2.m" > $1_$2.m
      echo "%% $2 file ($1_$2.m)" >> $1_$2.m
      echo "%% Generated by MTT at `date`" >> $1_$2.m




      echo '% Dummy globals' >>  $1_$2.m
      echo 'global ...' >>  $1_$2.m
      echo 'mtt_dummy_global;' >>  $1_$2.m
      ;;
    numpar)
      echo "% Script file  $1_$2.m" > $1_$2.m
      echo "%% $2 file ($1_$2.m)" >> $1_$2.m
      echo "%% Generated by MTT at `date`" >> $1_$2.m
      echo "% Global variable list" >>  $1_$2.m
      sympar2global_txt2m $1 >> $1_$2.m
      ;;
    *)
      echo "function $name = $1_$2$arg" > $1_$2.m
      echo "%% $2 file ($1_$2.m)" >> $1_$2.m
      echo "%% Generated by MTT at `date`" >> $1_$2.m
      echo "% Global variable list" >>  $1_$2.m
      sympar2global_txt2m $1 >> $1_$2.m
      ;;
esac

#Write out the variables in m format.
cat  $1_$2.txt |\
awk -F#  'BEGIN{
quote = "\047";
doublequote = "\042";
}
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
    sub(/^METHOD/, "mttMETHOD", LHS);
    sub(/^WMIN/, "mttWMIN", LHS);
    sub(/^WMAX/, "mttWMAX", LHS);
    sub(/^WSTEPS/, "mttWSTEPS", LHS);
    LHS = tolower(LHS);
    RHS = tolower(RHS);
    sub(/["]*euler["]*/, 1, RHS);   
    sub(/["]*implicitl["]*/, 2, RHS);   
    sub(/["]*implicits["]*/, 4, RHS);  
    sub(/["]*implicit["]*/, 3, RHS);  
    statement = sprintf("%s= %s",LHS,RHS);
    if ( (match(statement,";")==0)&&\
         ((match(statement,"if ")==0))&&\
         ((match(statement,"for ")==0)) )
      statement = sprintf("%s;", statement);
  }



  else
    statement = $1;

  if (NF<2) print statement
  if (NF>1)  print statement " # " $2
}' | sed\
     -e 's/\[\([0-9]*\)\]/(\1)/g' \
     -e 's/\([^a-zA-Z_]\)t\([^a-zA-Z_]\)/\1mttt\2/g' \
     -e 's/x(/mttx(/g' \
     -e 's/u(/mttu(/g' \
     -e 's/mttmtt/mtt/g' \

>> $1_$2.m











<
<
|






>
>
>











>





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
    sub(/^METHOD/, "mttMETHOD", LHS);
    sub(/^WMIN/, "mttWMIN", LHS);
    sub(/^WMAX/, "mttWMAX", LHS);
    sub(/^WSTEPS/, "mttWSTEPS", LHS);
    LHS = tolower(LHS);
    RHS = tolower(RHS);
    sub(/["]*euler["]*/, 1, RHS);   


    sub(/["]*implicit["]*/, 2, RHS);  
    statement = sprintf("%s= %s",LHS,RHS);
    if ( (match(statement,";")==0)&&\
         ((match(statement,"if ")==0))&&\
         ((match(statement,"for ")==0)) )
      statement = sprintf("%s;", statement);
  }
  else if (match($1,"global")==1) {
    statement = tolower($1); # Lower case globals as well
  }
  else
    statement = $1;

  if (NF<2) print statement
  if (NF>1)  print statement " # " $2
}' | sed\
     -e 's/\[\([0-9]*\)\]/(\1)/g' \
     -e 's/\([^a-zA-Z_]\)t\([^a-zA-Z_]\)/\1mttt\2/g' \
     -e 's/x(/mttx(/g' \
     -e 's/u(/mttu(/g' \
     -e 's/mttmtt/mtt/g' \
     -e 's/#/%/g' \
>> $1_$2.m





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