Differences From Artifact [f362dd6f57]:

To Artifact [0aca255e89]:


11
12
13
14
15
16
17



18
19
20
21
22
23
24
# Copyright (c) P.J.Gawthrop 1998

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



## Revision 1.11  1998/07/29 14:18:34  peterg
## Reorganised rep dependednt output
##
## Revision 1.10  1998/07/27 20:26:15  peterg
## Added new VARs mttWSTEPS, MTTWMIN,mttWMAX
##
## Revision 1.9  1998/07/27 17:20:42  peterg







>
>
>







11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# Copyright (c) P.J.Gawthrop 1998

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.12  1998/07/30 11:30:42  peterg
## Included zeros function
##
## Revision 1.11  1998/07/29 14:18:34  peterg
## Reorganised rep dependednt output
##
## Revision 1.10  1998/07/27 20:26:15  peterg
## Added new VARs mttWSTEPS, MTTWMIN,mttWMAX
##
## Revision 1.9  1998/07/27 17:20:42  peterg
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236


237
238
239
240
241
242
243
244
245
246


247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
          printf("{%s %s_input.p}\n",inc,sys)
          printf("{%s %s_ode.p}\n",inc,sys)
          printf("{%s %s_odeo.p}\n",inc,sys)
          printf("{%s %s_smx.p}\n",inc,sys)
          printf("{%s %s_switch.p}\n",inc,sys)
          for (k=1;k<=j;k++) printf("%s\n", comment[k])
          printf("\n")
          printf("\nBEGIN\n")
        }
        else{
          for (k=1;k<=j;k++) printf("%s\n", comment[k])
          printf("\n")
          printf("\nBEGIN\n")
       }
        doing_header = 0;
      }
      if (match($1,comment_regexp)>0){
        if (doing_header==1)
          comment[++j] = $0
        else
          printf("%s\n", $0)
      }
      else {
        if ($1=="if") {
          sub(/==/, "=", $0)


          printf("%s THEN BEGIN\n", $0)
        }
        else{ 
          if ($1=="for"){
          sub(/:/," TO ",$0)
          sub(/=/,":=",$0)
          printf("%s DO BEGIN\n", $0) 
          }
          else {
            sub(/=/,":=",$0)


            gsub(/\^/,"**",$0)
            gsub(/&&/," AND ",$0)
            gsub(/\|\|/," OR ",$0)
            printf("%s\n",$0)
          }
        }
      }
    }
  }
}
END{
  if (rep=="def"){
    printf("EULER = 1,\n")
    printf("IMPLICITL = 2;\n")
    printf("IMPLICIT = 3;\n")
    }
    else
      if (rep=="ode2odes")
        print "END."
      else
        print "END;"
}' sys=$sys rep=$rep Nx=$Nx Nu=$Nu Ny=$Ny |\
sed 's/(\([ijk0-9,]*\))/\[\1\]/g'  |\
sed 's/(\(MTT[ijk0-9,]*\))/\[\1\]/g' \
>> $Filename

# p2c doesn't like mixed case filenames!
if [ "$Filename" != "$filename" ]; then
  echo Creating $filename
  cp -f $Filename $filename
fi









|




|












>
>








|

>
>


















|

|
|











215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
          printf("{%s %s_input.p}\n",inc,sys)
          printf("{%s %s_ode.p}\n",inc,sys)
          printf("{%s %s_odeo.p}\n",inc,sys)
          printf("{%s %s_smx.p}\n",inc,sys)
          printf("{%s %s_switch.p}\n",inc,sys)
          for (k=1;k<=j;k++) printf("%s\n", comment[k])
          printf("\n")
          printf("\nBEGIN{%s}\n", Sys_rep)
        }
        else{
          for (k=1;k<=j;k++) printf("%s\n", comment[k])
          printf("\n")
          printf("\nBEGIN{%s}\n", Sys_rep)
       }
        doing_header = 0;
      }
      if (match($1,comment_regexp)>0){
        if (doing_header==1)
          comment[++j] = $0
        else
          printf("%s\n", $0)
      }
      else {
        if ($1=="if") {
          sub(/==/, "=", $0)
            gsub(/&&/," AND ",$0)
            gsub(/\|\|/," OR ",$0)
          printf("%s THEN BEGIN\n", $0)
        }
        else{ 
          if ($1=="for"){
          sub(/:/," TO ",$0)
          sub(/=/,":=",$0)
          printf("%s DO BEGIN\n", $0) 
          }
          else{
            sub(/=/,":=",$0)
            sub(/endif/,"END{IF}",$0)
            sub(/endfor/,"END{FOR}",$0)
            gsub(/\^/,"**",$0)
            gsub(/&&/," AND ",$0)
            gsub(/\|\|/," OR ",$0)
            printf("%s\n",$0)
          }
        }
      }
    }
  }
}
END{
  if (rep=="def"){
    printf("EULER = 1,\n")
    printf("IMPLICITL = 2;\n")
    printf("IMPLICIT = 3;\n")
    }
    else
      if (rep=="ode2odes")
                printf("END{%s}.\n", Sys_rep)
      else
        printf("END{%s};\n", Sys_rep)
}' sys=$sys Sys_rep=$Sys_rep rep=$rep Nx=$Nx Nu=$Nu Ny=$Ny |\
sed 's/(\([ijk0-9,]*\))/\[\1\]/g'  |\
sed 's/(\(MTT[ijk0-9,]*\))/\[\1\]/g' \
>> $Filename

# p2c doesn't like mixed case filenames!
if [ "$Filename" != "$filename" ]; then
  echo Creating $filename
  cp -f $Filename $filename
fi



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