OSDN Git Service

64th Cygnus<->FSF merge
[pf3gnuchains/gcc-fork.git] / gcc / bi-reverse.c
1 /* Reverse order of definitions obtained from bytecode definition file.
2    Copyright (C) 1993 Free Software Foundation, Inc.
3
4 This file is part of GNU CC.
5
6 GNU CC is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
9 any later version.
10
11 GNU CC is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with GNU CC; see the file COPYING.  If not, write to
18 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
19
20
21 #include "hconfig.h"
22 #include "bi-defs.h"
23
24 void
25 reverse()
26 {
27   struct def *dp, *d, *dn;
28   struct variation *vp, *v, *vn;
29
30   dp = defs;
31   if (dp)
32     {
33       vp = dp->variations;
34       if (vp)
35         {
36           for (v = vp->next, vp->next = 0; v; vp = v, v = vn)
37             {
38               vn = v->next;
39               v->next = vp;
40             }
41           dp->variations = vp;
42         }
43       for (d = dp->next, dp->next = 0; d; dp = d, d = dn)
44         {
45           vp = d->variations;
46           if (vp)
47             {
48               for (v = vp->next, vp->next = 0; v; vp = v, v = vn)
49                 {
50                   vn = v->next;
51                   v->next = vp;
52                 }
53               d->variations = vp;
54             }
55           dn = d->next;
56           d->next = dp;
57         }
58       defs = dp;
59     }
60 }