Overview
Comment:Now uses the header # ... line to trigger initial code.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: 54e30bcfda7d896453ac2db23450a10eb5c7fce756298b07641adbc5731b2770
User & Date: gawthrop@users.sourceforge.net on 1998-07-26 10:30:32
Other Links: branch diff | manifest | tags
Context
1998-07-26
10:44:08
Now strips comment lines first check-in: 5627a17b7c user: gawthrop@users.sourceforge.net tags: origin/master, trunk
10:30:32
Now uses the header # ... line to trigger initial code. check-in: 54e30bcfda user: gawthrop@users.sourceforge.net tags: origin/master, trunk
10:28:30
Added a header line to avoid empty file and to trigger
switch_txt2m to write initial stuff.
check-in: 267315d480 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
Changes

Modified mttroot/mtt/bin/trans/switch_txt2m from [6290ef09de] to [3ecc3caa72].

17
18
19
20
21
22
23
24
25


26
27
28

29
30

31
32
33
34
35
36
17
18
19
20
21
22
23


24
25
26
27
28
29
30
31
32
33
34
35
36
37
38







-
-
+
+



+


+






Nx=`grep "MTTNx " <$1_def.r | awk '{print $3}' | sed 's/;//'`

#Write some file headers
lang_header $1 switch m mttx '[mttxs]' > $1_switch.m

# This is the main transformation using gawk
awk '{
  if (NR==1){
    printf("for i=1:%s\n",Nx)
  if ($1=="#"){
    printf("for i=1:%s\n", Nx)
    printf("  mttxs(i) = mttx(i);\n")
    printf("end;\n\n")
  }
  else{
  printf("if (%s==0.0)\n  mttxs(%s)=0.0;\nend;\n\n", $1,$2)
  printf("if (%s<0.0)\n  if (mttx(%s)<0.0)\n    mttxs(%s)=0.0;\n  end;\nend;\n", $1,$2,$2)
  }
}' Nx=$Nx < $1_switch.txt >> $1_switch.m






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