summaryrefslogtreecommitdiff
path: root/web/yacco2/qa/test_use_cnt.sh
blob: 40264137a7933a50084713d5c0990637ba2fcca9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#! /bin/sh
#file: test_use_cnt.sh
echo "////////////////////////////////////////"
echo "////////////test_use_cnt.sh////////////"
echo "////////////////////////////////////////"
o2=/usr/local/yacco2/bin/o2
tmp=/tmp/o2
if [ ! -e "$tmp" ] 
then
  mkdir $tmp
fi
cd $tmp

#echo '\input eplain' > $tmp/eplain.txt
cont=n
ccresult=0

sw1=$1
sw2=$2
sw3=$3
sw4=$4

file_no=$((0))
file_pos=$((1))
cc_lex()
{
  file_name_only="`basename $2`"
  dir_only="`dirname $2`"
  echo "%%%%%%%%%%%%%%%%target directory $dir_only"
  eval "$o2  -p $sw1 $sw2 $sw3 $sw4 $1"
  if test $ccresult -eq 1; then
    echo -n "grammar in error: continue y or n: ";
    read cont;
    if test $cont -eq n; then
      echo "Error in grammar exiting";
      exit 1;
    fi
  fi 
  eval "mpost $file_name_only.mp"
  eval "cweave $file_name_only.w"
  ##eval "cat eplain.txt $file_name_only.tex > $file_name_only.tex1"
  eval "pdftex $file_name_only.tex"
  for k in `ls * `;
  do
   #echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!Casing on $k"
   case $k in
    *.cpp|*.h) 
      eval "cp $k $dir_only/$k";
      #echo "-------------> Deleting $k"
      eval "rm -f $k" ;;
    *.scn|*.idx|*.log|*.toc)
      #echo "-------------> Deleting $k"
      eval "rm -f $k" ;;
    Err.w|T.w) # error and terminal documents to be cweave then pdftex printed by xpdf
      #echo "-------------> Deleting $k"
      #eval "rm -f $k" 
;;
    *.w)
      #echo "-------------> Deleting $k"
      eval "rm -f $k" ;;
    *.tex)
      #echo "-------------> Deleting $k"
      eval "rm -f $k" ;;
    *.mp)
      #echo "-------------> Deleting $k"
      eval "rm -f $k" ;;
    *.tex1)
      #echo "-------------> Deleting $k"
      eval "rm -f $k" ;;
    *.[1-9])
      #echo "-------------> Deleting Mpost diagrams $k"
      eval "rm -f $k" ;;
     *.[1-9][0-9]*)
      #echo "-------------> Deleting Mpost diagrams $k"
      eval "rm -f $k" ;;
   esac
  done
}

cc_lex /usr/local/yacco2/qa/test_use_cnt.lex /usr/local/yacco2/qa/test_use_cnt/test_use_cnt