File mttroot/mtt/bin/trans/reps_txt2tk artifact 02869b51d3 part of check-in 34967f2efe


#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: reps_txt2tk
# Creates tk/tcl file for xmtt.
# Copyright (c) P.J.Gawthrop, 1998

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.3  1999/08/18 06:15:48  peterg
## Stripped down to just representations menu - see mtt_make_menu
##
## Revision 1.2  1999/03/09 00:03:19  peterg
## Revisions for xmtt
##
## Revision 1.1  1998/10/20 08:13:14  peterg
## Initial revision
##
###############################################################


# Create reps menu
awk --field-separator='|' '{
  
# Find the rep and the title
  split($1,REP," ");
  rep=REP[1];
# find the languages
  N=split($2,LANG," ");

# Important representation?
 if (index(rep,"*")) {
    # Zap *
    rep=substr(rep,1,length(rep)-1);
    sub(/\*/,"",$1);
    printf("\n# Menus for representation %s\n", rep)
    printf(".rep.rep add  cascade -label \"%s\" -menu .rep.rep.%s\n", $1, rep);
    printf("menu .rep.rep.%s\n", rep);
    for (i=1;i<=N;i++) {
      printf(" set mtt {mtt $args $system %s %s} \n", rep, LANG[i]); 
      printf(".rep.rep.%s add  command -label  \"%s\" ", rep, LANG[i]);
      printf(" -command  \"exec echo $mtt &; exec $mtt &\" \n"); 
   }
 }
 else {
    printf("\n# Menus for representation %s\n", rep)
    printf(".repall.repall add  cascade  -label \"%s\" -menu .repall.repall.%s\n", $1, rep);
    printf("menu .repall.repall.%s\n", rep);
    for (i=1;i<=N;i++) {
      printf(" set mtt {mtt $args $system %s %s} \n", rep, LANG[i]); 
      printf(".repall.repall.%s add  command -label  \"%s\" ", rep, LANG[i]);
      printf(" -command  \"exec echo $mtt &; exec $mtt &\" \n"); 
   }
 }
}'











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