File: gate.in

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 (149 lines) | stat: -rw-r--r-- 2,683 bytes parent folder | download | duplicates (3)
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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
#!/bin/sh

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

echo Generating Ada files...

dir=`dirname $1`
file=`cd $dir; pwd`/`basename $1`
info=`gate-in.exe -p -s -x $file`
stat=$?

if [ $stat != 0 ]; then
  if [ $stat = 2 ]; then
     echo $info
  fi

  echo "Couldn't parse $file Exiting."
  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."
  exit 1
fi

gt=".gate/$prj"
mkdir -p $gt > /dev/null 2>&1
tmp=$gt/tmp
/bin/rm -rf $tmp
mkdir $tmp
wd=`pwd`
gate-in.exe $file > $tmp/gate.ada

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

cd $tmp
if gnatchop gate.ada > /dev/null 2>&1; then
  true
else
  echo "Warning: gnatchop returned non zero status."
fi 

/bin/rm -f gate.ada
files=`echo *`
cd $wd

if [ "@MERGE_AVAIL@" = "True" ]; then
  conflicts=0
  echo "Merge of some changes failed. It usually means that some modified code
is obsolete in the current project file.
Conflicts have been kept in the following files to help merging manually:
" > $gt/conflicts.txt

  for j in $files; do
    if [ -f $j ]; then
      @MERGE@ $j $gt/$j $tmp/$j 2>/dev/null
    else
      cp $tmp/$j $j
    fi

    if [ $? = 1 ]; then
      conflicts=1
      echo "$j" >> $gt/conflicts.txt
    fi
  done

  echo "The following files have been created/updated in $psrcdir:"

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

  if [ $conflicts = 1 ]; then
    cat $gt/conflicts.txt | gdialog error justify_left
  fi
  
  echo done.

else

  /bin/rm -f $gt/gate.difs

  for j in $files; do
    @DIFF@ $gt/$j $j >> $gt/gate.difs 2>/dev/null
  done

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

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

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

    /bin/rm -f *.orig
  else
    echo "The following files have been updated in $psrcdir:"

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

    cat << EOF | gdialog error justify_left
Merge of some changes failed. It usually means that some modified code
is obsolete in the current project file.
.rej files have been generated to help merging manually if needed.
EOF
  fi

  echo done.
fi

/bin/mv -f $tmp/* $gt/