aboutsummaryrefslogtreecommitdiff
path: root/gcc/bi-reverse.c
diff options
context:
space:
mode:
authorJan Brittenson <bson@gnu.org>1993-09-22 08:48:59 -0700
committerJan Brittenson <bson@gnu.org>1993-09-22 08:48:59 -0700
commit538d56bb75ad00b1841398e10e6563035bfde442 (patch)
tree19a5cbd87ccf3dada3dd12d0749afbc85674ab25 /gcc/bi-reverse.c
parent1b0211eb002d20c9f67fc1d74c8c84aba82c5959 (diff)
downloadgcc-538d56bb75ad00b1841398e10e6563035bfde442.zip
gcc-538d56bb75ad00b1841398e10e6563035bfde442.tar.gz
gcc-538d56bb75ad00b1841398e10e6563035bfde442.tar.bz2
Initial revision
From-SVN: r5389
Diffstat (limited to 'gcc/bi-reverse.c')
-rw-r--r--gcc/bi-reverse.c61
1 files changed, 61 insertions, 0 deletions
diff --git a/gcc/bi-reverse.c b/gcc/bi-reverse.c
new file mode 100644
index 0000000..30eecba
--- /dev/null
+++ b/gcc/bi-reverse.c
@@ -0,0 +1,61 @@
+/* Reverse order of definitions obtained from bytecode definition file.
+ Copyright (C) 1993 Free Software Foundation, Inc.
+
+This file is part of GNU CC.
+
+GNU CC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU CC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU CC; see the file COPYING. If not, write to
+the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
+
+
+#include "bi-defs.h"
+
+#define NULL 0
+
+void
+reverse()
+{
+ struct def *dp, *d, *dn;
+ struct variation *vp, *v, *vn;
+
+ dp = defs;
+ if (dp)
+ {
+ vp = dp->variations;
+ if (vp)
+ {
+ for (v = vp->next, vp->next = NULL; v; vp = v, v = vn)
+ {
+ vn = v->next;
+ v->next = vp;
+ }
+ dp->variations = vp;
+ }
+ for (d = dp->next, dp->next = NULL; d; dp = d, d = dn)
+ {
+ vp = d->variations;
+ if (vp)
+ {
+ for (v = vp->next, vp->next = NULL; v; vp = v, v = vn)
+ {
+ vn = v->next;
+ v->next = vp;
+ }
+ d->variations = vp;
+ }
+ dn = d->next;
+ d->next = dp;
+ }
+ defs = dp;
+ }
+}