Overview
Comment:Translate some binary operators
Allows use of ! in logic.txt
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: 51220a5eb8f10efdbe0cb065d54abc34f4ec0e79c491564ffad3c3f38b0220c8
User & Date: geraint@users.sourceforge.net on 2001-02-09 02:56:46
Other Links: branch diff | manifest | tags
Context
2001-02-11
05:25:53
Reduced number of matrix operations during .oct simulation data write check-in: 16e1f414da user: geraint@users.sourceforge.net tags: origin/master, trunk
2001-02-09
02:56:46
Translate some binary operators
Allows use of ! in logic.txt
check-in: 51220a5eb8 user: geraint@users.sourceforge.net tags: origin/master, trunk
2001-02-08
00:39:56
Removed clear from code generated by: mtt -c -i euler -o check-in: 823f1b334d user: geraint@users.sourceforge.net tags: origin/master, trunk
Changes

Modified mttroot/mtt/bin/trans/mtt_m2p from [0bcc94c670] to [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 ]