Subversion Repositories wimsdev

Rev

Rev 20 | Rev 16107 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
20 reyssat 1
#! /bin/sh
2
 
11566 bpr 3
LL="env LC_COLLATE=POSIX LANG=POSIX LC_CTYPE=fr_FR.UTF-8"
4
LL="env LC_ALL=C LC_CTYPE=C LANG=C"
20 reyssat 5
thisdir=`pwd`
6
lastdir=$thisdir
7
if [ -z "$wims_home" ]; then wims_home=$w_wims_home; fi
8
 
9
while [ -z "$wims_home" ] && [ "$lastdir" != "/" ]
10
do
11
 wims_home=`cat $lastdir/.wimshome 2>/dev/null`
12
 lastdir=`dirname $lastdir`
13
done
14
if [ -z "$wims_home" ]; then
15
 echo WIMS home directory not found.
16
 exit;
17
fi
18
proc=$wims_home/public_html/scripts/deduc
19
 
20
if [ ! -d def ]; then exit; fi
21
if [ ! -d src ]; then exit; fi
22
 
23
deff=`cd def; ls *.def 2>/dev/null`
24
for i in $deff
25
do
26
 dd=`echo $i | sed 's!\.def!.ded!g'`
11566 bpr 27
 if [ ! -f src/$dd ]; then
20 reyssat 28
  echo Removing def/$i.
29
  rm -f def/$i >/dev/null;
30
 fi
31
done
32
 
33
sext=ded
34
cd src
35
if [ -d cpp ]; then
36
 cd cpp
37
 incf=`ls *.inc 2>/dev/null`
38
 for i in $incf
39
 do
40
  list=`egrep -l '#[[:blank:]]*include[[:blank:]]+"'$i'"' *.cpp`
41
  for j in $list
42
  do
43
   if [ $i -nt $j ]; then touch $j; fi
44
  done
45
 done
46
 pref=`ls *.cpp 2>/dev/null`
47
 for i in $pref
48
 do
11566 bpr 49
  list=`$LL grep . $i | head -1 | grep target \
20 reyssat 50
	| tr ',:;./?*#~$\\ ' '                  ' \
51
	| awk -F'=' '{print $2}'`
52
  test=`grep -E '^[[:blank:]]*#[[:blank:]]*include' $i \
53
	| grep -E -v '^[[:blank:]]*#[[:blank:]]*include[[:blank:]]*"[[:alnum:]_]+.inc"'`
54
  if [ ! -z "$test" ]; then
55
   echo $i: include violation.
56
   list=
57
  fi
58
  grep . $i | awk 'BEGIN {l=0}; {l++}; l>1 {print}' >cpp.tmp
59
  for j in $list
60
  do
61
   if [ ! -f ../$j.$sext ] || [ $i -nt ../$j.$sext ]; then
62
    echo "Preprocessing: $i -> ../$j.$sext"
63
    cat <<@ >../$j.$sext
64
%% This file is generated by preprocessor!
65
%% Do not edit it by hand.
66
%% Edit the source file cpp/$i.
67
 
68
@
69
    cpp -P -C -nostdinc -A- -D TARGET_$j -A "TARGET($j)" cpp.tmp >>../$j.$sext
70
   fi
71
  done
72
  rm -f cpp.tmp
73
 done
74
 cd ..
75
fi
76
 
77
srcf=`ls *.ded 2>/dev/null`
78
cd ..
79
oef2wims_mdef="methods variables context environ equivalence startname goal newobject minsteps options"
80
export oef2wims_mdef
81
for i in $srcf
82
do
83
 dd=`echo $i | sed 's!\.ded!.def!g'`
11566 bpr 84
 if [ ! -f def/$dd ] || [ src/$i -nt def/$dd ]; then
20 reyssat 85
  # echo $dd
86
  rm -f def/$dd 2>/dev/null
87
  $wims_home/bin/oef2wims src/$i def/$dd
88
 fi
89
done
90
 
91
rm -f Exindex Extitles >/dev/null
92
list=`cd def; ls *.def 2>/dev/null | sed 's/\.def//g'`
93
 
94
if [ -z "$list" ]; then exit; fi
95
titlist=
96
for i in $list
97
do
11566 bpr 98
 tit=`awk -F= 'NF>=2 {print $2; exit}' def/$i.def | $LL tr ',\11' '; '`
20 reyssat 99
 echo "$i:$tit" >>Extitles
100
 titlist="$titlist$tit
101
"
102
done
103
$wims_home/bin/dicsort Extitles
104
if [ -s Extitles.sorted ]; then
105
 mv Extitles.sorted Extitles
106
fi
107
 
108
echo "$titlist" >tmp1
109
echo "$list" >tmp2
11566 bpr 110
llist=`$LL paste tmp1 tmp2 | $LL sort -t '	' -f -k 1,1`
111
list=`echo "$llist" | awk -F'\11' 'length()>2 {print $2}' |$LL tr '\n' ','`
112
titlist=`echo "$llist" | awk -F'\11' 'length()>2 {print $1}' | $LL tr '\n' ','`
20 reyssat 113
 
114
cat >Exindex <<@
115
!set exolist  =!char 1 to -2 of $list
116
!set titlelist=!char 1 to -2 of $titlist
117
!set exototal =!itemcnt \$exolist
118
 
119
@
120
 
121
rm -f tmp1 tmp2
122