File: gate.sh

package info (click to toggle)
libgtkada2 2.8.1-6lenny3
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 13,496 kB
  • ctags: 3,886
  • sloc: ada: 103,189; ansic: 45,411; perl: 5,500; sh: 2,812; makefile: 1,169; xml: 19
file content (104 lines) | stat: -rwxr-xr-x 2,061 bytes parent folder | download | duplicates (4)
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
#

if [ $# -eq 0 ]; then
  echo "Usage: gate project-file" | gdialog error justify_left
  exit 1
fi

dir=`dirname $1|sed -e 's$\\\\$/$g'`
file=`cd $dir; pwd`/`basename $1`
info=`gate-in.exe -p -s -x $file`

if [ $? != 0 ]; then
  echo "Couldn't parse $file. Exiting." | gdialog error justify_left
  exit 1
fi

set $info

if [ "$1" = "<no_name>" ]; then
   prj=default
else
   prj=$1
fi

if [ "$2" = "<no_name>" ]; then
   srcdir=.
   psrcdir="the current directory"
else
   srcdir=$2
   psrcdir=$srcdir
fi

pixdir="$3"
# Copy any pixmap files from pixdir to srcdir

mkdir -p $dir/$srcdir

if [ "$pixdir" != "<no_name>" -a -d $dir/$pixdir ]; then
   cp $dir/$pixdir/*xpm $dir/$srcdir > /dev/null 2>&1
fi

owd=`pwd`
cd $dir/$srcdir

if [ $? != 0 ]; then
  echo "Couldn't change to $dir/$srcdir, aborting." | gdialog error justify_left
  exit 1
fi

gt=".gate/$prj"
mkdir -p .gate > /dev/null 2>&1
mkdir -p $gt > /dev/null 2>&1
tmp=$gt/tmp
rm -rf $tmp
mkdir $tmp
wd=`pwd`
out=$gt/output.txt

gate-in.exe $file | grep -v Gtk-WARNING > $tmp/gate.ada

if [ $? != 0 ]; then
  echo "Couldn't generate Ada code. Exiting." | gdialog error justify_left
  exit 1
fi

cd $tmp
gnatchop gate.ada > /dev/null 2>&1
rm -f gate.ada
files=`echo *`
cd $wd
rm -f $gt/gate.difs

for j in $files; do
  diff -u $gt/$j $j >> $gt/gate.difs 2>/dev/null
done

cp -f $tmp/* .
rm -f *.rej *.orig

if cat $gt/gate.difs | patch -f > $gt/patch.out 2>&1; then
  echo "The following files have been created/updated in $psrcdir:" > $out

  for j in $files; do
    echo "  "$j >> $out
  done

  rm -f *.orig
  # cat $out | gdialog information justify_fill
else
  echo "The following files have been updated in $psrcdir:" > $out

  for j in $files; do
    echo "  "$j >> $out
  done

  echo Merge of some changes failed. It usually means that some modified>> $out
  echo code is obsolete in the current project file.>> $out
  echo Files with the ".rej" extension have been generated to help merging>>$out
  echo manually if needed.>> $out

  cat $out | gdialog error justify_fill
fi

cp -f $tmp/* $gt