This is the mail archive of the libc-hacker@cygnus.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

removing the need for `tsort' in manual/



This patch replaces the use of `tsort' when generating chapters.texi
with an awk script (a modified version of scripts/gen-sorted.awk).  I
get identical chapters.texi/top-menu.texi generation.  This should fix
the problem Hurd people have with the chapters list being incorrect
(once Uli takes the generated files out of CVS, anyway).

zw

1999-01-18 10:07 -0500  Zack Weinberg  <zack@rabi.phys.columbia.edu>

	* manual/libc-texinfo.sh: Use tsort.awk.
	* manual/tsort.awk: New file.
	* manual/Makefile (minimal-dist): Add tsort.awk.
	(distribute): Remove generated files: summary.texi, 
	stamp-summary, chapters.texi, top-menu.texi, and texis.

============================================================
Index: manual/Makefile
--- manual/Makefile	1999/01/14 12:44:39	1.87
+++ manual/Makefile	1999/01/18 15:07:20
@@ -105,15 +105,14 @@
 	$(TEXI2DVI) $<
 
 # Distribution.
-minimal-dist = summary.awk texis.awk libc-texinfo.sh libc.texinfo	\
-	       $(filter-out summary.texi, $(nonexamples))		\
+minimal-dist = summary.awk texis.awk tsort.awk libc-texinfo.sh libc.texinfo \
+	       $(filter-out summary.texi, $(nonexamples))		    \
 	       $(patsubst %.c.texi,examples/%.c, $(examples))
 
 doc-only-dist = Makefile COPYING.LIB
-distribute = $(minimal-dist) $(examples) texis stdio-fp.c		\
-	     libc.info* libc.?? libc.??s texinfo.tex stamp-summary	\
-	     xtract-typefun.awk dir-add.info dir			\
-	     chapters.texi top-menu.texi summary.texi
+distribute = $(minimal-dist) $(examples) stdio-fp.c	\
+	     libc.info* libc.?? libc.??s texinfo.tex 	\
+	     xtract-typefun.awk dir-add.info dir 
 export distribute := $(distribute)
 
 tar-it = tar chovf $@ $^
============================================================
Index: manual/libc-texinfo.sh
--- manual/libc-texinfo.sh	1999/01/07 09:50:46	1.3
+++ manual/libc-texinfo.sh	1999/01/18 15:07:20
@@ -25,7 +25,7 @@
 	END  { for (x in file)
 		 if (file[x] != "")
 		   print file[x] ":" x, file[nnode[x]] ":" nnode[x] }' |
-  tsort | sed 's/_/ /g; $d'
+  $AWK -f tsort.awk | sed 's/_/ /g'
 }
 
 collect_nodes $1 | build_menu
============================================================
Index: manual/tsort.awk
--- manual/tsort.awk	Wed Dec 31 19:00:00 1969
+++ manual/tsort.awk	Mon Jan 18 09:57:05 1999	1.1
@@ -0,0 +1,46 @@
+#! /usr/bin/awk -f
+# Generate topologically sorted list of manual chapters.
+# (C) Copyright 1998, 1999 Free Software Foundation, Inc.
+# Written by Ulrich Drepper <drepper@cygnus.com>, 1998.
+
+BEGIN {
+  cnt = 0
+  dnt = 0
+}
+{
+    to[dnt] = $1
+    from[dnt] = $2
+    ++dnt
+    all[cnt++] = $1
+}
+END {
+  do {
+    moved = 0
+    for (i = 0; i < dnt; ++i) {
+      for (j = 0; j < cnt; ++j) {
+	if (all[j] == from[i]) {
+	  for (k = j + 1; k < cnt; ++k) {
+	    if (all[k] == to[i]) {
+	      break;
+	    }
+	  }
+	  if (k < cnt) {
+	    for (l = k - 1; l >= j; --l) {
+	      all[l + 1] = all[l]
+	    }
+	    all[j] = to[i]
+	    break;
+	  }
+	}
+      }
+      if (j < cnt) {
+	moved = 1
+	break
+      }
+    }
+  } while (moved)
+
+  for (i = 0; i < cnt; ++i) {
+    print all[i];
+  }
+}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]