Differences From Artifact [cdcb03b9ce]:

To Artifact [3e0008849a]:


10
11
12
13
14
15
16



17
18
19
20
21
22
23
# Copyright (c) P.J.Gawthrop, 1989, 1990, 1991, 1993, 1994, 1995, 1996.

###############################################################
## Version control history
###############################################################
## $Header$
## $Log$



## Revision 1.115  1998/01/29 19:37:31  peterg
## Fixed spurious call to X server bug
##
## Revision 1.114  1998/01/23 13:38:07  peterg
## VERSION 2.7
##
## Revision 1.113  1998/01/23 13:27:13  peterg







>
>
>







10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# Copyright (c) P.J.Gawthrop, 1989, 1990, 1991, 1993, 1994, 1995, 1996.

###############################################################
## Version control history
###############################################################
## $Header$
## $Log$
## Revision 1.116  1998/02/04 11:00:04  peterg
## Added view of subsystems.
##
## Revision 1.115  1998/01/29 19:37:31  peterg
## Fixed spurious call to X server bug
##
## Revision 1.114  1998/01/23 13:38:07  peterg
## VERSION 2.7
##
## Revision 1.113  1998/01/23 13:27:13  peterg
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
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468

469
470
471
472
473
474
475
476
477


















478
479
480
481
482
483
484
dae_is_ode=0

# By default, don't look for BG switches
switches=0

#By default, don't print the environment variables
print='';




#Initialise list
mtt_switches='';


#Look for a command line argument
while [ -n "`echo $1 | grep '^-'`" ]; do
  case $1 in
	-q )
                mtt_switches="$mtt_switches $1";
		quiet=quiet;;  
	-p )
                mtt_switches="$mtt_switches $1";
		print='-p';;
	-c )
                mtt_switches="$mtt_switches $1";
		computation=c ;;
	-o )
                mtt_switches="$mtt_switches $1";
		dae_is_ode=1 ;;
	-s )
                mtt_switches="$mtt_switches $1";
		switches=1 ;;
	-d )

		directory=$2; cd $directory; shift ;;
	-D )

		debug=debug ;;







	-l )
                mtt_switches="$mtt_switches $1";
		level=$2; shift ;;
	*)
		echo "$1 is an invalid argument - ignoring" ;;
  esac
  shift
done

#Print header if not in quiet (-q) mode.
if [ "$quiet" != "quiet" ]; then
  echo
  echo 'MTT (Model Transformation Tools) version 2.7++ ($Date$)'
  echo 'This is free software with ABSOLUTELY NO WARRANTY.'
  echo 'Type `mtt warranty'\' 'for details.'
  echo
fi

# Print current directory if in -d mode
if [ -n "$directory" ]; then
  echo Using directory $directory
  echo

fi

#Check the principle paths
mtt_check_vars $print

# Exit if just printing paths
if [ "$print" != "" ]; then
  exit
fi



















if [ -z "$1" ]; then
  if [ -z "$print" ]; then
    echo 'Usage: mtt help             -- mtt on-line help'
    echo '       mtt info             -- info-based manual'
    echo '       mtt info topic'
    echo '       mtt hinfo            -- hypertext manual'







>
>
>



>




















>


>

>
>
>
>
>
>
>
















<
<
|
|
|
|
>









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







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
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478


479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
dae_is_ode=0

# By default, don't look for BG switches
switches=0

#By default, don't print the environment variables
print='';

# By default, make it untidy
tidy=untidy;

#Initialise list
mtt_switches='';


#Look for a command line argument
while [ -n "`echo $1 | grep '^-'`" ]; do
  case $1 in
	-q )
                mtt_switches="$mtt_switches $1";
		quiet=quiet;;  
	-p )
                mtt_switches="$mtt_switches $1";
		print='-p';;
	-c )
                mtt_switches="$mtt_switches $1";
		computation=c ;;
	-o )
                mtt_switches="$mtt_switches $1";
		dae_is_ode=1 ;;
	-s )
                mtt_switches="$mtt_switches $1";
		switches=1 ;;
	-d )
                mtt_switches="$mtt_switches $1";
		directory=$2; cd $directory; shift ;;
	-D )
                mtt_switches="$mtt_switches $1";
		debug=debug ;;
	-t )
		tidy=tidy ;;
	-T )
		tidy=tidy;
                verytidy=verytidy ;;
	-u )
		tidy=untidy ;;
	-l )
                mtt_switches="$mtt_switches $1";
		level=$2; shift ;;
	*)
		echo "$1 is an invalid argument - ignoring" ;;
  esac
  shift
done

#Print header if not in quiet (-q) mode.
if [ "$quiet" != "quiet" ]; then
  echo
  echo 'MTT (Model Transformation Tools) version 2.7++ ($Date$)'
  echo 'This is free software with ABSOLUTELY NO WARRANTY.'
  echo 'Type `mtt warranty'\' 'for details.'
  echo


  # Print current directory if in -d mode
  if [ -n "$directory" ]; then
    echo Using directory $directory
    echo
  fi
fi

#Check the principle paths
mtt_check_vars $print

# Exit if just printing paths
if [ "$print" != "" ]; then
  exit
fi

# Tidy mode - operate in the directory MTT-work
if [ "$tidy" = "tidy" ]; then
   mkdir -p MTT_work
   cp -u *_*.* MTT_work
   cd MTT_work
   mtt -u -q  $mtt_switches $1 $2 $3 $4
   if [ "$3" != "view" ]; then
     cp -f MTT_work/$1_$2.$3 .
   fi

   # Remove the MTT_work directory if very tidy
   if [ "$verytidy" = "verytidy" ]; then
    echo Removing all working files
    rm -rf ../MTT_work
  fi
exit
fi 

if [ -z "$1" ]; then
  if [ -z "$print" ]; then
    echo 'Usage: mtt help             -- mtt on-line help'
    echo '       mtt info             -- info-based manual'
    echo '       mtt info topic'
    echo '       mtt hinfo            -- hypertext manual'
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
  rm -f *_struc.* *_sympar.txt *_sympar.c *_sympar.h *_sympar.m
  rm -f *_odes.c *_odes.dat *_odes.gdat *_odes.m *_odes.ps
  rm -f *_odeso.dat *_odeso.gdat *_odeso.sdat *_odeso.m *_odeso.ps
  rm -f *_*.doc *_*.idx *_*.ind *_*.ilg *_*.dvi *_*.aux *_*.lof *_*.toc
  rm -f *_rep.tex
  rm -f  *_unique_raw_list *_raw_list
  rm -f mtt_error.txt mtt_info.txt a.out 
  rm -fR *_rep
  exit
fi

# Clean up named system
if [ "$2" = "clean" ] && [ "$3" = "" ]; then
  echo 'Removing all generated files for system ' $1
  rm -f *.log  mtt_info.txt warning.txt







|







602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
  rm -f *_struc.* *_sympar.txt *_sympar.c *_sympar.h *_sympar.m
  rm -f *_odes.c *_odes.dat *_odes.gdat *_odes.m *_odes.ps
  rm -f *_odeso.dat *_odeso.gdat *_odeso.sdat *_odeso.m *_odeso.ps
  rm -f *_*.doc *_*.idx *_*.ind *_*.ilg *_*.dvi *_*.aux *_*.lof *_*.toc
  rm -f *_rep.tex
  rm -f  *_unique_raw_list *_raw_list
  rm -f mtt_error.txt mtt_info.txt a.out 
  rm -fR *_rep MTT_work
  exit
fi

# Clean up named system
if [ "$2" = "clean" ] && [ "$3" = "" ]; then
  echo 'Removing all generated files for system ' $1
  rm -f *.log  mtt_info.txt warning.txt
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
  rm -f $1_struc.* $1_sympar.txt $1_sympar.c $1_sympar.h $1_sympar.m
  rm -f $1_odes.c $1_odes.dat $1_odes.gdat $1_odes.sdat $1_odes.m $1_odes.ps
  rm -f $1_odeso.dat $1_odeso.gdat $1_odeso.m $1_odeso.ps
  rm -f $1_*.doc $1_*.idx $1_*.ind $1_*.ilg $1_*.dvi $1_*.aux $1_*.lof $1_*.toc
  rm -f $1_rep.tex
  rm -f $1_unique_raw_list $1_raw_list
  rm -f mtt_error.txt mtt_info.txt a.out 
  rm -fR $1_rep
  exit
fi

#SUMMARY abg	acausal bond graph (fig)
#SUMMARY abg	acausal bond graph (ps)
#SUMMARY abg	acausal bond graph (view)
# Invoke explicit requests for modification







|







626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
  rm -f $1_struc.* $1_sympar.txt $1_sympar.c $1_sympar.h $1_sympar.m
  rm -f $1_odes.c $1_odes.dat $1_odes.gdat $1_odes.sdat $1_odes.m $1_odes.ps
  rm -f $1_odeso.dat $1_odeso.gdat $1_odeso.m $1_odeso.ps
  rm -f $1_*.doc $1_*.idx $1_*.ind $1_*.ilg $1_*.dvi $1_*.aux $1_*.lof $1_*.toc
  rm -f $1_rep.tex
  rm -f $1_unique_raw_list $1_raw_list
  rm -f mtt_error.txt mtt_info.txt a.out 
  rm -fR $1_rep MTT_work
  exit
fi

#SUMMARY abg	acausal bond graph (fig)
#SUMMARY abg	acausal bond graph (ps)
#SUMMARY abg	acausal bond graph (view)
# Invoke explicit requests for modification
616
617
618
619
620
621
622









623
624
625
626
627
628
629
630
631
632
633




634
635
636
637
638
639
640
641










642
643
644
645
646
647
648
649
650
651
652

653




654

655
656
657
658
659
660
661
if [ "$1" = "rename" ]; then
  mtt_rename_all $2 $3
  exit
fi

# Copy systems from the example library
if [ "$1" = "copy" ]; then









  # check that its not here already
  file_exists=`ls $2 2> /dev/null`
  if [ -n "$file_exists" ]; then
    if [ "$quiet" != "quiet" ]; then    
      echo Directory $2 exists already - no action taken
    fi
  else
    path_name=$3
    if [ -z "$path_name" ]; then
      path_name=$MTTPATH/lib/examples
    fi




    echo Copying system $2 to here from $path_name into directory $2
    find $path_name -name "$2" -exec cp -r {} . \; 
  fi
  exit
fi

# Copy components from the library
if [ "$1" = "compcopy" ]; then










  # check that its not here already
  file_exists=`ls $2_abg.fig 2> /dev/null`
  if [ -n "$file_exists" ]; then
    if [ "$quiet" != "quiet" ]; then    
      echo $2_abg.fig exists already - no action taken
    fi
  else
    path_name=$3
    if [ -z "$path_name" ]; then
      path_name=$MTTPATH/lib/comp/compound
    fi

    echo Copying component $2 from $path_name




    find $path_name -name "$2_*.*" -exec cp {} . \;

  fi
  exit
fi

# Copy CRs from the library
if [ "$1" = "crcopy" ]; then
  # check that its not here already







>
>
>
>
>
>
>
>
>
|
|


|


|
|
|

>
>
>
>
|
|






>
>
>
>
>
>
>
>
>
>

|


|


<
|
|

>
|
>
>
>
>
|
>







649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704

705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
if [ "$1" = "rename" ]; then
  mtt_rename_all $2 $3
  exit
fi

# Copy systems from the example library
if [ "$1" = "copy" ]; then
   #set up source and destination dirs
    source=$3
    if [ -z "$source" ]; then
      source=$MTTPATH/lib/examples
    fi
    destination=$4
    if [ -z "$destination" ]; then
      destination=$2
    fi      
# check that its not here already
  file_exists=`ls $destination/$2_abg.fig 2> /dev/null`
  if [ -n "$file_exists" ]; then
    if [ "$quiet" != "quiet" ]; then    
      echo System $2 exists already - no action taken
    fi
  else
    source=$3
    if [ -z "$source" ]; then
      source=$MTTPATH/lib/examples
    fi
    destination=$4
    if [ -z "$destination" ]; then
      destination=$2
    fi    
echo Copying system $2 from $source into directory $destination
    find $source -name "$2" -exec cp -rf {} . \; 
  fi
  exit
fi

# Copy components from the library
if [ "$1" = "compcopy" ]; then
   #set up source and destination dirs
    source=$3
    if [ -z "$source" ]; then
      source=$MTTPATH/lib/comp/compound
    fi
    destination=$4
    if [ -z "$destination" ]; then
      destination='.'
    fi   

  # check that its not here already
  file_exists=`ls $destination/$2_abg.fig 2> /dev/null`
  if [ -n "$file_exists" ]; then
    if [ "$quiet" != "quiet" ]; then    
      echo $destination/$2_abg.fig exists already - no action taken
    fi
  else

    if [ -z "$source" ]; then
      source=$MTTPATH/lib/comp/compound
    fi
    if [ "$quiet" != "quiet" ]; then    
      echo Copying component $2 from $source to  $destination
    fi
    if [ $source = "." ]; then
      cp -u *_*.* $destination
    else
      find $source -name "$2_*.*" -exec cp {} $destination \;
    fi
  fi
  exit
fi

# Copy CRs from the library
if [ "$1" = "crcopy" ]; then
  # check that its not here already
1568
1569
1570
1571
1572
1573
1574
1575


1576

  rm -f  mtt_info.txt warning.txt
#  rm -f *_*.idx *_*.ind *_*.ilg  *_*.lof *_*.toc

# Remove logs if not debugging
if [ "$debug" != "debug" ]; then
  rm -f *.log
else
  echo Debugging - log files retained


fi








|
>
>

>
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
  rm -f  mtt_info.txt warning.txt
#  rm -f *_*.idx *_*.ind *_*.ilg  *_*.lof *_*.toc

# Remove logs if not debugging
if [ "$debug" != "debug" ]; then
  rm -f *.log
else
  echo Debugging - log files retained in $directory/LOGFILES  
  mkdir -p LOGFILES
  mv -f *.log LOGFILES
fi


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