Differences From Artifact [0bcc94c670]:

To Artifact [44cf73e41f]:


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.63  2000/12/04 08:24:29  peterg
## Added swithc logic declarations
##
## Revision 1.62  2000/12/03 17:15:18  peterg
## *** empty log message ***
##
## Revision 1.61  2000/11/10 14:46:53  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.64  2001/02/03 14:00:01  gawthrop
## Geraint's temp. variable patch applied
##
## Revision 1.63  2000/12/04 08:24:29  peterg
## Added swithc logic declarations
##
## Revision 1.62  2000/12/03 17:15:18  peterg
## *** empty log message ***
##
## Revision 1.61  2000/11/10 14:46:53  peterg
401
402
403
404
405
406
407















408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423

424
425
426
427
428
429
430
  tab='	'
  space="[ $tab]*"
  spaces="[ $tab][ $tab]*"
  non_space="[^ ]*"
  args='[a-zA-Z0-9,._"]*'

# Body	















cat $Sys_rep.m |\
grep -v 'Remove in mtt_m2p'  |\
grep -v '^[ ]*function'  |\
grep -v '^[ ]*endfunction'  |\
grep -v 'MTT_data'  |\
sed "s/^$space%/#/" | sed "s/\([;)]$space\)%/\1#/" |\
awk -F# '{printf("%s",$1) 
          if (NF>1) printf("{* %s *}", $2)
          printf("\n") 
         }' |\
sed "s/$space\[\($non_space\)\]$spaces=$spaces\($fun_name\)(\($args\))/\2(\1,\3)/" |\
sed "s/$space\[\($non_space\)\]$spaces=$spaces\($mttfun_name\)(\($args\))/\2(\1,\3)/" |\
sed "s/$space\[\($non_space\)\]$spaces=$spaces\($mttfun_name\)/\2(\1)/" |\
sed "s/$space\[\($non_space\)\]$spaces=$spaces\(zeros\)(\($args\))/\2(\1,\3)/" |\
sed "s/$space\($non_space\)$spaces=$spaces\($fun_name\)(\($args\))/\2(\1,\3)/" |\
sed "s/,)/)/" |\

awk '
function printvar(Name,N) {
  if (N<1) return;
  width = 10;
  kk = 0; 
  for (k=1;k<=N;k++) {
    printf("mtt%s%i", Name, k);







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
















>







404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
  tab='	'
  space="[ $tab]*"
  spaces="[ $tab][ $tab]*"
  non_space="[^ ]*"
  args='[a-zA-Z0-9,._"]*'

# Body	
fix_operators ()
{
    m_neq="(\!\=)|(\~\=)"
    m_not="\!"
    m__eq="\=\="

    p_neq="\<\>"
    p_not="NOT\ "
    p__eq="\="

    sed "s/$m_neq/$p_neq/g"	|\
    sed "s/$m_not/$p_not/g"	|\
    sed "s/$m__eq/$p__eq/g"
}

cat $Sys_rep.m |\
grep -v 'Remove in mtt_m2p'  |\
grep -v '^[ ]*function'  |\
grep -v '^[ ]*endfunction'  |\
grep -v 'MTT_data'  |\
sed "s/^$space%/#/" | sed "s/\([;)]$space\)%/\1#/" |\
awk -F# '{printf("%s",$1) 
          if (NF>1) printf("{* %s *}", $2)
          printf("\n") 
         }' |\
sed "s/$space\[\($non_space\)\]$spaces=$spaces\($fun_name\)(\($args\))/\2(\1,\3)/" |\
sed "s/$space\[\($non_space\)\]$spaces=$spaces\($mttfun_name\)(\($args\))/\2(\1,\3)/" |\
sed "s/$space\[\($non_space\)\]$spaces=$spaces\($mttfun_name\)/\2(\1)/" |\
sed "s/$space\[\($non_space\)\]$spaces=$spaces\(zeros\)(\($args\))/\2(\1,\3)/" |\
sed "s/$space\($non_space\)$spaces=$spaces\($fun_name\)(\($args\))/\2(\1,\3)/" |\
sed "s/,)/)/" |\
fix_operators |\
awk '
function printvar(Name,N) {
  if (N<1) return;
  width = 10;
  kk = 0; 
  for (k=1;k<=N;k++) {
    printf("mtt%s%i", Name, k);

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