File mttroot/mtt/bin/trans/abg2sensitivity_fig artifact 868b237a9b part of check-in 8eb6e09e9a


#!/bin/sh

## Converts abg.fig to sensitivity version

## Copyright (C) 1999 by Peter J. Gawthrop

filename=$1_abg.fig
sfilename=s$filename

if [ -f "$sfilename" ]; then
    echo $sfilename exists -- no action taken
    exit
fi

if [ -f $filename ]; then
    echo Using existing $filename
else
    echo "Looking for $1 in library"
    mtt -q  compcopy $1  
fi


echo Creating $sfilename   

awk '
  function modulo10(x) {
    return x-int(x/10)*10
    }
  {

  level_index = 4;
  if ( match($NF,"001")&&(modulo10($level_index)==0)&&(index($NF,"[") != 1) ){
    last = $NF
    if ( (index($NF,"0") != 1)&&(index($NF,"1") != 1)&&(index($NF,"SS") != 1) ) {
      $NF = sprintf("s%s", $NF);
      print $0;
    }
    else {
      x_1_index = 10;
      x_2_index = 12;
      y_1_index = 11;
      y_2_index = 13;
      colour_index=3;
      yellow = 6;

      ## save details 
      colour=$colour_index;
      component=$NF;
      x_1 = $x_1_index;
      x_2 = $x_2_index;
      y_1 = $y_1_index;
      y_2 = $y_2_index;
      
      ## print the label
      $colour_index = yellow;
      $NF = "[1,2]\\001";
      $x_1_index = x_1+1;
      $x_2_index = x_2+1;
      $y_1_index = y_1+1;
      $y_2_index = y_2+1;
      print $0;

      ## print the component
      $colour_index = colour;
      $NF = component;
      $x_1_index = x_1;
      $x_1_index = x_1;
      $y_1_index = y_1;
      $y_2_index = y_2;
      print $0;

      
    }
  }
  else
    print $0;
'} < $filename >$sfilename





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