#!/bin/bash
#Author Martin Prudek
#check for empty string
if [ "$#" -eq 0 ]; then
	echo "Enter .dat file name from '../data/..' directory.";
	echo "For one input, svg will be generated and plot shown."
	echo "For more inputs only svgs will be generated, plot_data erased."
	exit;
fi

. ./parse_name.sh "${1}";
title0='';
title1='';
title2='';
title3='';

if [  ${#nm[t]} -ne 0 ]; then
	case "${nm[t]}" in
		can)
			title0="${title0} CAN latencies"
		;;
		lat)
			title0="${title0} Model sample loop latencies"
		;;
                *)
			title0="${title0}"
	esac
fi;
if [  ${#nm[bn]} -ne 0 ]; then title0="${title0} BN ${nm[bn]}"; fi;
if [  ${#nm[si]} -ne 0 ]; then title1="${title1} Simulation time=${nm[si]}"; fi;
if [  ${#nm[sa]} -ne 0 ]; then title1="${title1} Sample time=${nm[sa]}"; fi;
if [  ${#nm[p]} -ne 0 ]; then title1="${title1} Priority=${nm[p]}"; fi;
if [  ${#nm[hw]} -ne 0 ]; then title2="${title2} HW=${nm[hw]}"; fi;
if [  ${#nm[k]} -ne 0 ]; then title2="${title2} Kernel=${nm[vk]},${nm[k]}"; fi;
if [  ${#nm[m]} -ne 0 ]; then
	case "${nm[m]}" in
		CF)
			title2="${title2} Memory lock=Current and Future";
		;;
		*)
	esac
fi
if [  ${#nm[cn]} -ne 0 ]; then
	case "${nm[cn]}" in
		Yes)
			title3="${title3} Patch-nanosleep"
		;;
                *)
	esac
fi
if [  ${#nm[n]} -ne 0 ]; then title3="${title3} ${nm[n]}"; fi;
if [  ${#nm[lo]} -ne 0 ]; then
	case "${nm[lo]}" in
		No)
			title3="${title3} No Load"
		;;
		6W)
			title3="${title3} Load=6xdoWhile"
		;;
		8W1F)
			title3="${title3} Load=8xdoWhile 1xFind"
		;;
		*)
			title3="${title3} Load=${nm[lo]}"
	esac
fi
if [  ${#nm[ert]} -ne 0 ]; then
	case "${nm[ert]}" in
		CTU)
			title3="${title3} ert-linux"
		;;
		*)
	esac
fi
